diff --git a/.env.example b/.env.example index b10d46b..6789001 100644 --- a/.env.example +++ b/.env.example @@ -6,22 +6,21 @@ ENCRYPTED_PRIVATE_KEY= MAINNET_HTTPS_URL= OPTIMISM_HTTPS_URL= POLYGON_HTTPS_URL= -GOERLI_HTTPS_URL= -OP_GOERLI_HTTPS_URL= +SEPOLIA_HTTPS_URL= +OP_SEPOLIA_HTTPS_URL= # Account's private keys MAINNET_PRIVATE_KEY= OPTIMISM_PRIVATE_KEY= POLYGON_PRIVATE_KEY= -GOERLI_PRIVATE_KEY= -OP_GOERLI_PRIVATE_KEY= +SEPOLIA_PRIVATE_KEY= +OP_SEPOLIA_PRIVATE_KEY= # Etherscan (optional, only for verifying smart contracts) ETHERSCAN_API_KEY= ETHEREUM_ETHERSCAN_API_KEY= OPTIMISTIC_ETHERSCAN_API_KEY= POLYGON_ETHERSCAN_API_KEY= -GOERLI_ETHERSCAN_API_KEY= -OP_GOERLI_ETHERSCAN_API_KEY= +OP_SEPOLIA_ETHERSCAN_API_KEY= HARDHAT_DEPLOY_LOG=TRUE diff --git a/.gitignore b/.gitignore index 5d35e95..49e414b 100644 --- a/.gitignore +++ b/.gitignore @@ -11,6 +11,7 @@ cache artifacts deployments/hardhat deployments/localhost +deployments/**/solcInputs # Config files .env diff --git a/deploy/0-mainnet/001_keep3r_v1.ts b/deploy/0-mainnet/001_keep3r_v1.ts index e54a56f..b8fc37d 100644 --- a/deploy/0-mainnet/001_keep3r_v1.ts +++ b/deploy/0-mainnet/001_keep3r_v1.ts @@ -1,13 +1,13 @@ import { DeployFunction } from 'hardhat-deploy/types'; import { HardhatRuntimeEnvironment } from 'hardhat/types'; -import IERC20 from '../../artifacts/@openzeppelin/contracts/token/ERC20/IERC20.sol/IERC20.json'; +import ERC20ForTest from '../../artifacts/solidity/for-test/ERC20ForTest.sol/ERC20ForTest.json'; const deployFunction: DeployFunction = async function (hre: HardhatRuntimeEnvironment) { const { kp3rV1 } = await hre.getNamedAccounts(); await hre.deployments.save('KP3Rv1', { address: kp3rV1, - abi: IERC20.abi, + abi: ERC20ForTest.abi, }); }; diff --git a/deploy/1-mainnet-test/101_uni_v3_pool.ts b/deploy/1-mainnet-test/101_uni_v3_pool.ts index e771a54..94db905 100644 --- a/deploy/1-mainnet-test/101_uni_v3_pool.ts +++ b/deploy/1-mainnet-test/101_uni_v3_pool.ts @@ -5,10 +5,9 @@ import IUniswapV3Factory from '../../artifacts/@uniswap/v3-core/contracts/interf import IUniswapV3Pool from '../../artifacts/@uniswap/v3-core/contracts/interfaces/IUniswapV3Pool.sol/IUniswapV3Pool.json'; const deployFunction: DeployFunction = async function (hre: HardhatRuntimeEnvironment) { - const { deployer, weth } = await hre.getNamedAccounts(); + const { deployer, weth, uniV3Factory } = await hre.getNamedAccounts(); const kp3RForTest = await hre.deployments.get('KP3Rv1'); - const uniV3Factory = '0x1f98431c8ad98523631ae4a59f267346ea31f984'; await hre.deployments.save('WETH', { address: weth, diff --git a/deploy/1-mainnet-test/110_job_for_test.ts b/deploy/1-mainnet-test/110_job_for_test.ts index 86fd393..761b8d2 100644 --- a/deploy/1-mainnet-test/110_job_for_test.ts +++ b/deploy/1-mainnet-test/110_job_for_test.ts @@ -1,43 +1,54 @@ +import { WETH_ADDRESS } from '@e2e/common'; import { toUnit } from '@utils/bn'; import { DeployFunction } from 'hardhat-deploy/types'; import { HardhatRuntimeEnvironment } from 'hardhat/types'; const deployFunction: DeployFunction = async function (hre: HardhatRuntimeEnvironment) { - const { deployer, kp3rV1 } = await hre.getNamedAccounts(); + const { deployer } = await hre.getNamedAccounts(); const kp3RForTest = await hre.deployments.get('KP3Rv1'); const keep3rV2 = await hre.deployments.get('Keep3rForTestnet'); const pairManager = await hre.deployments.get('UniV3PairManager'); - const jobForTest = await hre.deployments.deploy('BasicJob', { + const jobForTest = await hre.deployments.deploy('JobForTest', { from: deployer, contract: 'solidity/for-test/JobForTest.sol:JobForTest', args: [keep3rV2.address], log: true, }); - // register job - if (jobForTest.newlyDeployed) { + const jobs = await hre.deployments.read('Keep3rForTestnet', 'jobs'); + + if (!jobs.includes(jobForTest.address)) { await hre.deployments.execute('Keep3rForTestnet', { from: deployer, log: true }, 'addJob', jobForTest.address); } - const LIQUIDITY = await hre.deployments.read('Keep3rForTestnet', 'liquidityAmount', jobForTest.address, pairManager.address); - if (LIQUIDITY == 0) { + const liquidity = await hre.deployments.read('Keep3rForTestnet', 'liquidityAmount', jobForTest.address, pairManager.address); + + if (liquidity == 0) { // deployer needs to have KP3R and WETH balance let klpBalance = await hre.deployments.read('UniV3PairManager', 'balanceOf', deployer); if (klpBalance == 0) { const wethBalance = await hre.deployments.read('WETH', 'balanceOf', deployer); - if (wethBalance < toUnit(1)) { + if (wethBalance < toUnit(0.1)) { await hre.deployments.execute('WETH', { from: deployer, log: true, value: toUnit(0.1) }, 'deposit'); } const kp3rBalance = await hre.deployments.read('KP3Rv1', 'balanceOf', deployer); - if (kp3rBalance < toUnit(100)) { - await hre.deployments.execute('KP3Rv1', { from: deployer, log: true }, 'mint(uint256)', toUnit(1)); + if (kp3rBalance < toUnit(10)) { + await hre.deployments.execute('KP3Rv1', { from: deployer, log: true }, 'mint(uint256)', toUnit(100_000)); } await hre.deployments.execute('KP3Rv1', { from: deployer, log: true }, 'approve', pairManager.address, toUnit(100)); - await hre.deployments.execute('WETH', { from: deployer, log: true }, 'approve', pairManager.address, toUnit(100)); + await hre.deployments.execute('WETH', { from: deployer, log: true }, 'approve', pairManager.address, toUnit(100_000)); + + let mintArguments: any[]; + + // Check if WETH is the first token in the pair + if (WETH_ADDRESS > kp3RForTest.address) { + mintArguments = [toUnit(0.1), toUnit(100_000), 0, 0, deployer]; + } else { + mintArguments = [toUnit(100_000), toUnit(0.1), 0, 0, deployer]; + } - const mintArguments: any[] = [toUnit(1), toUnit(0.1), 0, 0, deployer]; await hre.deployments.execute('UniV3PairManager', { from: deployer, log: true }, 'mint', ...mintArguments); klpBalance = await hre.deployments.read('UniV3PairManager', 'balanceOf', deployer); @@ -55,14 +66,19 @@ const deployFunction: DeployFunction = async function (hre: HardhatRuntimeEnviro ); } - const IS_KEEPER = await hre.deployments.read('Keep3rForTestnet', 'isKeeper', deployer); - if (!IS_KEEPER) { + const isKeeper = await hre.deployments.read('Keep3rForTestnet', 'isKeeper', deployer); + if (!isKeeper) { // register deployer as keeper await hre.deployments.execute('Keep3rForTestnet', { from: deployer, log: true }, 'bond', kp3RForTest.address, 0); + + // wait for bond to be processed + console.log('waiting for bond to be processed'); + await new Promise((resolve) => setTimeout(resolve, 10_000)); + await hre.deployments.execute('Keep3rForTestnet', { from: deployer, log: true }, 'activate', kp3RForTest.address); } - await hre.deployments.execute('BasicJob', { from: deployer, log: true, gasLimit: 1e6 }, 'work'); + await hre.deployments.execute('JobForTest', { from: deployer, log: true, gasLimit: 1e6 }, 'work'); }; deployFunction.dependencies = ['testnet-keep3r']; diff --git a/deploy/2-sidechain/203_keep3r_helper_and_sidechain.ts b/deploy/2-sidechain/203_keep3r_helper_and_sidechain.ts index 5c961c8..6045333 100644 --- a/deploy/2-sidechain/203_keep3r_helper_and_sidechain.ts +++ b/deploy/2-sidechain/203_keep3r_helper_and_sidechain.ts @@ -22,7 +22,7 @@ const deployFunction: DeployFunction = async function (hre: HardhatRuntimeEnviro const keep3rV2Args = [governor, keep3rHelper.address, kp3rV1, keep3rEscrow.address]; - const keep3r = await hre.deployments.deploy('Keep3rSidechain', { + await hre.deployments.deploy('Keep3rSidechain', { contract: 'solidity/contracts/sidechain/Keep3rSidechain.sol:Keep3rSidechain', from: deployer, args: keep3rV2Args, diff --git a/deploy/3-sidechain-test/301_keep3r_helper_and_sidechain.ts b/deploy/3-sidechain-test/301_keep3r_helper_and_sidechain.ts index c7288b0..e7580eb 100644 --- a/deploy/3-sidechain-test/301_keep3r_helper_and_sidechain.ts +++ b/deploy/3-sidechain-test/301_keep3r_helper_and_sidechain.ts @@ -2,16 +2,14 @@ import { DeployFunction } from 'hardhat-deploy/types'; import { HardhatRuntimeEnvironment } from 'hardhat/types'; const deployFunction: DeployFunction = async function (hre: HardhatRuntimeEnvironment) { - const { deployer, governor, kp3rV1, kp3rWethOracle, wethUsdOracle, usdDecimals } = await hre.getNamedAccounts(); - const { kp3rV1: mainnetKp3rV1, weth: mainnetWeth } = await hre.companionNetworks['mainnet'].getNamedAccounts(); - + const { deployer, governor, kp3rV1, weth, kp3rWethOracle, wethUsdOracle, usdDecimals } = await hre.getNamedAccounts(); const keep3rEscrow = await hre.deployments.get('Keep3rEscrow'); // precalculate the address of Keep3rV2 contract const currentNonce: number = await hre.ethers.provider.getTransactionCount(deployer); const keeperV2Address: string = hre.ethers.utils.getContractAddress({ from: deployer, nonce: currentNonce + 1 }); - const keep3rHelperArgs = [keeperV2Address, governor, mainnetKp3rV1, mainnetWeth, kp3rWethOracle, wethUsdOracle, usdDecimals]; + const keep3rHelperArgs = [keeperV2Address, governor, kp3rV1, weth, kp3rWethOracle, wethUsdOracle, usdDecimals]; const keep3rHelper = await hre.deployments.deploy('Keep3rHelperSidechain', { from: deployer, @@ -22,7 +20,7 @@ const deployFunction: DeployFunction = async function (hre: HardhatRuntimeEnviro const keep3rV2Args = [governor, keep3rHelper.address, kp3rV1, keep3rEscrow.address]; - const keep3r = await hre.deployments.deploy('Keep3rSidechainForTestnet', { + await hre.deployments.deploy('Keep3rSidechainForTestnet', { contract: 'solidity/for-test/testnet/Keep3rSidechainForTestnet.sol:Keep3rSidechainForTestnet', from: deployer, args: keep3rV2Args, diff --git a/deploy/3-sidechain-test/311_job_rated_for_test.ts b/deploy/3-sidechain-test/311_job_rated_for_test.ts index cea7a39..3975623 100644 --- a/deploy/3-sidechain-test/311_job_rated_for_test.ts +++ b/deploy/3-sidechain-test/311_job_rated_for_test.ts @@ -11,22 +11,24 @@ const deployFunction: DeployFunction = async function (hre: HardhatRuntimeEnviro abi: IERC20.abi, }); - const jobForTest = await hre.deployments.deploy('BasicJob', { + const jobForTest = await hre.deployments.deploy('JobRatedForTest', { from: deployer, contract: 'solidity/for-test/JobRatedForTest.sol:JobRatedForTest', args: [keep3rV2.address], log: true, }); - // register job - if (jobForTest.newlyDeployed) { + const jobs = await hre.deployments.read('Keep3rSidechainForTestnet', 'jobs'); + + if (!jobs.includes(jobForTest.address)) { await hre.deployments.execute('Keep3rSidechainForTestnet', { from: deployer, log: true }, 'addJob', jobForTest.address); } - const LIQUIDITY = await hre.deployments.read('Keep3rSidechainForTestnet', 'liquidityAmount', jobForTest.address, wkLP); - if (LIQUIDITY == 0) { + const liquidity = await hre.deployments.read('Keep3rSidechainForTestnet', 'liquidityAmount', jobForTest.address, wkLP); + if (liquidity == 0) { // deployer needs to have kLP balance const keep3rSidechain = await hre.deployments.get('Keep3rSidechainForTestnet'); + await hre.deployments.execute('wkLP', { from: deployer, log: true }, 'approve', keep3rSidechain.address, toUnit(10)); await hre.deployments.execute( 'Keep3rSidechainForTestnet', @@ -34,18 +36,23 @@ const deployFunction: DeployFunction = async function (hre: HardhatRuntimeEnviro 'addLiquidityToJob', jobForTest.address, wkLP, - toUnit(1) + toUnit(10) ); } - const IS_KEEPER = await hre.deployments.read('Keep3rSidechainForTestnet', 'isKeeper', deployer); - if (!IS_KEEPER) { + const isKeeper = await hre.deployments.read('Keep3rSidechainForTestnet', 'isKeeper', deployer); + if (!isKeeper) { // register deployer as keeper await hre.deployments.execute('Keep3rSidechainForTestnet', { from: deployer, log: true }, 'bond', kp3rV1, 0); + + // wait for bond to be processed + console.log('waiting for bond to be processed'); + await new Promise((resolve) => setTimeout(resolve, 10_000)); + await hre.deployments.execute('Keep3rSidechainForTestnet', { from: deployer, log: true, gasLimit: 1e6 }, 'activate', kp3rV1); } - await hre.deployments.execute('BasicJob', { from: deployer, log: true, gasLimit: 1e6 }, 'work'); + await hre.deployments.execute('JobRatedForTest', { from: deployer, log: true, gasLimit: 1e6 }, 'work'); }; deployFunction.dependencies = ['approve-testnet-liquidity']; diff --git a/deploy/4-verify/421_verify_testnet.ts b/deploy/4-verify/421_verify_testnet.ts index 0748b8c..8b5dd76 100644 --- a/deploy/4-verify/421_verify_testnet.ts +++ b/deploy/4-verify/421_verify_testnet.ts @@ -12,7 +12,7 @@ const deployFunction: DeployFunction = async function (hre: HardhatRuntimeEnviro const keep3rV2 = await hre.deployments.get('Keep3rForTestnet'); await verifyContract(hre, keep3rV2); - const jobForTest = await hre.deployments.getOrNull('BasicJob'); + const jobForTest = await hre.deployments.getOrNull('JobForTest'); if (jobForTest) { await verifyContract(hre, jobForTest); } diff --git a/deploy/4-verify/422_verify_testnet_sidechain.ts b/deploy/4-verify/422_verify_testnet_sidechain.ts index 412e9c3..1168e0d 100644 --- a/deploy/4-verify/422_verify_testnet_sidechain.ts +++ b/deploy/4-verify/422_verify_testnet_sidechain.ts @@ -12,7 +12,7 @@ const deployFunction: DeployFunction = async function (hre: HardhatRuntimeEnviro const keep3rV2 = await hre.deployments.get('Keep3rSidechainForTestnet'); await verifyContract(hre, keep3rV2); - const jobForTest = await hre.deployments.getOrNull('BasicJob'); + const jobForTest = await hre.deployments.getOrNull('JobRatedForTest'); if (jobForTest) { await verifyContract(hre, jobForTest); } diff --git a/deployments/goerli/.chainId b/deployments/goerli/.chainId deleted file mode 100644 index 7813681..0000000 --- a/deployments/goerli/.chainId +++ /dev/null @@ -1 +0,0 @@ -5 \ No newline at end of file diff --git a/deployments/goerli/BasicJob.json b/deployments/goerli/BasicJob.json deleted file mode 100644 index 7fea89d..0000000 --- a/deployments/goerli/BasicJob.json +++ /dev/null @@ -1,133 +0,0 @@ -{ - "address": "0xa2c7A15FFc02e00cdeedBba56c41dAaed84f8734", - "abi": [ - { - "inputs": [ - { - "internalType": "address", - "name": "_keep3r", - "type": "address" - } - ], - "stateMutability": "nonpayable", - "type": "constructor" - }, - { - "inputs": [], - "name": "InvalidKeeper", - "type": "error" - }, - { - "inputs": [], - "name": "keep3r", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "nonce", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "work", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "_factor", - "type": "uint256" - } - ], - "name": "workHard", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - } - ], - "transactionHash": "0xf993d8bfd999d2fc3ff80f122f960de2de3de06f5cd4653bd19c9e56e378c630", - "receipt": { - "to": null, - "from": "0x258b180E741157763236F5277619D71ECf00B906", - "contractAddress": "0xa2c7A15FFc02e00cdeedBba56c41dAaed84f8734", - "transactionIndex": 8, - "gasUsed": "299912", - "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", - "blockHash": "0x119433484e9184255ac3f2ab0f486614ae8247b48f8f098fd0f43eed4b7837f8", - "transactionHash": "0xf993d8bfd999d2fc3ff80f122f960de2de3de06f5cd4653bd19c9e56e378c630", - "logs": [], - "blockNumber": 8091010, - "cumulativeGasUsed": "1736676", - "status": 1, - "byzantium": true - }, - "args": [ - "0x85063437C02Ba7F4f82F898859e4992380DEd3bb" - ], - "numDeployments": 4, - "solcInputHash": "0d224f905ebe4be6830f2d07ee9fcf58", - "metadata": "{\"compiler\":{\"version\":\"0.8.7+commit.e28d00a7\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_keep3r\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"inputs\":[],\"name\":\"InvalidKeeper\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"keep3r\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"nonce\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"work\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_factor\",\"type\":\"uint256\"}],\"name\":\"workHard\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"}],\"devdoc\":{\"kind\":\"dev\",\"methods\":{},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{},\"version\":1}},\"settings\":{\"compilationTarget\":{\"solidity/for-test/JobForTest.sol\":\"JobForTest\"},\"evmVersion\":\"london\",\"libraries\":{\":__CACHE_BREAKER__\":\"0x00000000d41867734bbee4c6863d9255b2b06ac1\"},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":33},\"remappings\":[]},\"sources\":{\"solidity/for-test/JobForTest.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4 <0.9.0;\\n\\nimport '../interfaces/IKeep3r.sol';\\n\\ncontract JobForTest {\\n error InvalidKeeper();\\n address public keep3r;\\n uint256 public nonce;\\n\\n constructor(address _keep3r) {\\n keep3r = _keep3r;\\n }\\n\\n function work() external {\\n if (!IKeep3r(keep3r).isKeeper(msg.sender)) revert InvalidKeeper();\\n\\n for (uint256 i; i < 1000; i++) {\\n nonce++;\\n }\\n\\n IKeep3r(keep3r).worked(msg.sender);\\n }\\n\\n function workHard(uint256 _factor) external {\\n if (!IKeep3r(keep3r).isKeeper(msg.sender)) revert InvalidKeeper();\\n\\n for (uint256 i; i < 1000 * _factor; i++) {\\n nonce++;\\n }\\n\\n IKeep3r(keep3r).worked(msg.sender);\\n }\\n}\\n\",\"keccak256\":\"0x399bb5de1fd8e09bd46993fd9fd423bf5955238edacee0b44f985604fb74272b\",\"license\":\"MIT\"},\"solidity/interfaces/IKeep3r.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4 <0.9.0;\\n\\nimport './peripherals/IKeep3rJobs.sol';\\nimport './peripherals/IKeep3rKeepers.sol';\\nimport './peripherals/IKeep3rParameters.sol';\\n\\n// solhint-disable-next-line no-empty-blocks\\n\\n/// @title Keep3rV2 contract\\n/// @notice This contract inherits all the functionality of Keep3rV2\\ninterface IKeep3r is IKeep3rJobs, IKeep3rKeepers, IKeep3rParameters {\\n\\n}\\n\",\"keccak256\":\"0x273a39984c1475c60182e636bb91a1b89ec98646a036cac6a87067869b3adeb9\",\"license\":\"MIT\"},\"solidity/interfaces/peripherals/IBaseErrors.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity >=0.8.4 <0.9.0;\\n\\ninterface IBaseErrors {\\n /// @notice Throws if a variable is assigned to the zero address\\n error ZeroAddress();\\n}\\n\",\"keccak256\":\"0x9130019a08d9eaedfb920a323fed5c7f409736cd918f1a32921c93551b3ee00e\",\"license\":\"MIT\"},\"solidity/interfaces/peripherals/IDustCollector.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity >=0.8.4 <0.9.0;\\n\\nimport './IBaseErrors.sol';\\n\\ninterface IDustCollector is IBaseErrors {\\n /// @notice Emitted when dust is sent\\n /// @param _token The token that will be transferred\\n /// @param _amount The amount of the token that will be transferred\\n /// @param _to The address which will receive the funds\\n event DustSent(address _token, uint256 _amount, address _to);\\n\\n /// @notice Allows an authorized user to transfer the tokens or eth that may have been left in a contract\\n /// @param _token The token that will be transferred\\n /// @param _amount The amount of the token that will be transferred\\n /// @param _to The address that will receive the idle funds\\n function sendDust(\\n address _token,\\n uint256 _amount,\\n address _to\\n ) external;\\n}\\n\",\"keccak256\":\"0x38dce228111f2a3c6b26ac09c5652c3f1f184c4cfe50d11ff0958ef6a50683bb\",\"license\":\"MIT\"},\"solidity/interfaces/peripherals/IGovernable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4 <0.9.0;\\n\\n/// @title Governable contract\\n/// @notice Manages the governance role\\ninterface IGovernable {\\n // Events\\n\\n /// @notice Emitted when pendingGovernance accepts to be governance\\n /// @param _governance Address of the new governance\\n event GovernanceSet(address _governance);\\n\\n /// @notice Emitted when a new governance is proposed\\n /// @param _pendingGovernance Address that is proposed to be the new governance\\n event GovernanceProposal(address _pendingGovernance);\\n\\n // Errors\\n\\n /// @notice Throws if the caller of the function is not governance\\n error OnlyGovernance();\\n\\n /// @notice Throws if the caller of the function is not pendingGovernance\\n error OnlyPendingGovernance();\\n\\n /// @notice Throws if trying to set governance to zero address\\n error NoGovernanceZeroAddress();\\n\\n // Variables\\n\\n /// @notice Stores the governance address\\n /// @return _governance The governance addresss\\n function governance() external view returns (address _governance);\\n\\n /// @notice Stores the pendingGovernance address\\n /// @return _pendingGovernance The pendingGovernance addresss\\n function pendingGovernance() external view returns (address _pendingGovernance);\\n\\n // Methods\\n\\n /// @notice Proposes a new address to be governance\\n /// @param _governance The address being proposed as the new governance\\n function setGovernance(address _governance) external;\\n\\n /// @notice Changes the governance from the current governance to the previously proposed address\\n function acceptGovernance() external;\\n}\\n\",\"keccak256\":\"0x3284624b2479bbf97c821f37c93a096dcb869b30bbf9b20d30d1800f9535452c\",\"license\":\"MIT\"},\"solidity/interfaces/peripherals/IKeep3rAccountance.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4 <0.9.0;\\n\\nimport './IKeep3rRoles.sol';\\n\\n/// @title Keep3rDisputable contract\\n/// @notice Disputes keepers, or if they're already disputed, it can resolve the case\\n/// @dev Argument `bonding` can be the address of either a token or a liquidity\\ninterface IKeep3rAccountance is IKeep3rRoles {\\n // Events\\n\\n /// @notice Emitted when the bonding process of a new keeper begins\\n /// @param _keeper The caller of Keep3rKeeperFundable#bond function\\n /// @param _bonding The asset the keeper has bonded\\n /// @param _amount The amount the keeper has bonded\\n event Bonding(address indexed _keeper, address indexed _bonding, uint256 _amount);\\n\\n /// @notice Emitted when a keeper or job begins the unbonding process to withdraw the funds\\n /// @param _keeperOrJob The keeper or job that began the unbonding process\\n /// @param _unbonding The liquidity pair or asset being unbonded\\n /// @param _amount The amount being unbonded\\n event Unbonding(address indexed _keeperOrJob, address indexed _unbonding, uint256 _amount);\\n\\n // Variables\\n\\n /// @notice Tracks the total amount of bonded KP3Rs in the contract\\n /// @return _totalBonds The total amount of bonded KP3Rs in the contract\\n function totalBonds() external view returns (uint256 _totalBonds);\\n\\n /// @notice Tracks the total KP3R earnings of a keeper since it started working\\n /// @param _keeper The address of the keeper\\n /// @return _workCompleted Total KP3R earnings of a keeper since it started working\\n function workCompleted(address _keeper) external view returns (uint256 _workCompleted);\\n\\n /// @notice Tracks when a keeper was first registered\\n /// @param _keeper The address of the keeper\\n /// @return timestamp The time at which the keeper was first registered\\n function firstSeen(address _keeper) external view returns (uint256 timestamp);\\n\\n /// @notice Tracks if a keeper or job has a pending dispute\\n /// @param _keeperOrJob The address of the keeper or job\\n /// @return _disputed Whether a keeper or job has a pending dispute\\n function disputes(address _keeperOrJob) external view returns (bool _disputed);\\n\\n /// @notice Tracks how much a keeper has bonded of a certain token\\n /// @param _keeper The address of the keeper\\n /// @param _bond The address of the token being bonded\\n /// @return _bonds Amount of a certain token that a keeper has bonded\\n function bonds(address _keeper, address _bond) external view returns (uint256 _bonds);\\n\\n /// @notice The current token credits available for a job\\n /// @param _job The address of the job\\n /// @param _token The address of the token bonded\\n /// @return _amount The amount of token credits available for a job\\n function jobTokenCredits(address _job, address _token) external view returns (uint256 _amount);\\n\\n /// @notice Tracks the amount of assets deposited in pending bonds\\n /// @param _keeper The address of the keeper\\n /// @param _bonding The address of the token being bonded\\n /// @return _pendingBonds Amount of a certain asset a keeper has unbonding\\n function pendingBonds(address _keeper, address _bonding) external view returns (uint256 _pendingBonds);\\n\\n /// @notice Tracks when a bonding for a keeper can be activated\\n /// @param _keeper The address of the keeper\\n /// @param _bonding The address of the token being bonded\\n /// @return _timestamp Time at which the bonding for a keeper can be activated\\n function canActivateAfter(address _keeper, address _bonding) external view returns (uint256 _timestamp);\\n\\n /// @notice Tracks when keeper bonds are ready to be withdrawn\\n /// @param _keeper The address of the keeper\\n /// @param _bonding The address of the token being unbonded\\n /// @return _timestamp Time at which the keeper bonds are ready to be withdrawn\\n function canWithdrawAfter(address _keeper, address _bonding) external view returns (uint256 _timestamp);\\n\\n /// @notice Tracks how much keeper bonds are to be withdrawn\\n /// @param _keeper The address of the keeper\\n /// @param _bonding The address of the token being unbonded\\n /// @return _pendingUnbonds The amount of keeper bonds that are to be withdrawn\\n function pendingUnbonds(address _keeper, address _bonding) external view returns (uint256 _pendingUnbonds);\\n\\n /// @notice Checks whether the address has ever bonded an asset\\n /// @param _keeper The address of the keeper\\n /// @return _hasBonded Whether the address has ever bonded an asset\\n function hasBonded(address _keeper) external view returns (bool _hasBonded);\\n\\n // Methods\\n\\n /// @notice Lists all jobs\\n /// @return _jobList Array with all the jobs in _jobs\\n function jobs() external view returns (address[] memory _jobList);\\n\\n /// @notice Lists all keepers\\n /// @return _keeperList Array with all the keepers in _keepers\\n function keepers() external view returns (address[] memory _keeperList);\\n\\n // Errors\\n\\n /// @notice Throws when an address is passed as a job, but that address is not a job\\n error JobUnavailable();\\n\\n /// @notice Throws when an action that requires an undisputed job is applied on a disputed job\\n error JobDisputed();\\n}\\n\",\"keccak256\":\"0xf4748c236ddf409e45e7169c735e2fc54e627b2b3ccd189ebb438ad768f1deb1\",\"license\":\"MIT\"},\"solidity/interfaces/peripherals/IKeep3rDisputable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4 <0.9.0;\\n\\n/// @title Keep3rDisputable contract\\n/// @notice Creates/resolves disputes for jobs or keepers\\n/// A disputed keeper is slashable and is not able to bond, activate, withdraw or receive direct payments\\n/// A disputed job is slashable and is not able to pay the keepers, withdraw tokens or to migrate\\ninterface IKeep3rDisputable {\\n /// @notice Emitted when a keeper or a job is disputed\\n /// @param _jobOrKeeper The address of the disputed keeper/job\\n /// @param _disputer The user that called the function and disputed the keeper\\n event Dispute(address indexed _jobOrKeeper, address indexed _disputer);\\n\\n /// @notice Emitted when a dispute is resolved\\n /// @param _jobOrKeeper The address of the disputed keeper/job\\n /// @param _resolver The user that called the function and resolved the dispute\\n event Resolve(address indexed _jobOrKeeper, address indexed _resolver);\\n\\n /// @notice Throws when a job or keeper is already disputed\\n error AlreadyDisputed();\\n\\n /// @notice Throws when a job or keeper is not disputed and someone tries to resolve the dispute\\n error NotDisputed();\\n\\n /// @notice Allows governance to create a dispute for a given keeper/job\\n /// @param _jobOrKeeper The address in dispute\\n function dispute(address _jobOrKeeper) external;\\n\\n /// @notice Allows governance to resolve a dispute on a keeper/job\\n /// @param _jobOrKeeper The address cleared\\n function resolve(address _jobOrKeeper) external;\\n}\\n\",\"keccak256\":\"0x002b9b4c75e62d48d74b6447649d39eb5c1e128d2523bb11e08e9cd3e27b1f70\",\"license\":\"MIT\"},\"solidity/interfaces/peripherals/IKeep3rJobs.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4 <0.9.0;\\n\\nimport './IKeep3rDisputable.sol';\\n\\n/// @title Keep3rJobOwnership contract\\n/// @notice Handles the ownership of the jobs\\ninterface IKeep3rJobOwnership {\\n // Events\\n\\n /// @notice Emitted when Keep3rJobOwnership#changeJobOwnership is called\\n /// @param _job The address of the job proposed to have a change of owner\\n /// @param _owner The current owner of the job\\n /// @param _pendingOwner The new address proposed to be the owner of the job\\n event JobOwnershipChange(address indexed _job, address indexed _owner, address indexed _pendingOwner);\\n\\n /// @notice Emitted when Keep3rJobOwnership#JobOwnershipAssent is called\\n /// @param _job The address of the job which the proposed owner will now own\\n /// @param _previousOwner The previous owner of the job\\n /// @param _newOwner The new owner of the job\\n event JobOwnershipAssent(address indexed _job, address indexed _previousOwner, address indexed _newOwner);\\n\\n // Errors\\n\\n /// @notice Throws when the caller of the function is not the job owner\\n error OnlyJobOwner();\\n\\n /// @notice Throws when the caller of the function is not the pending job owner\\n error OnlyPendingJobOwner();\\n\\n // Variables\\n\\n /// @notice Maps the job to the owner of the job\\n /// @param _job The address of the job\\n /// @return _owner The address of the owner of the job\\n function jobOwner(address _job) external view returns (address _owner);\\n\\n /// @notice Maps the job to its pending owner\\n /// @param _job The address of the job\\n /// @return _pendingOwner The address of the pending owner of the job\\n function jobPendingOwner(address _job) external view returns (address _pendingOwner);\\n\\n // Methods\\n\\n /// @notice Proposes a new address to be the owner of the job\\n /// @param _job The address of the job\\n /// @param _newOwner The address of the proposed new owner\\n function changeJobOwnership(address _job, address _newOwner) external;\\n\\n /// @notice The proposed address accepts to be the owner of the job\\n /// @param _job The address of the job\\n function acceptJobOwnership(address _job) external;\\n}\\n\\n/// @title Keep3rJobManager contract\\n/// @notice Handles the addition and withdrawal of credits from a job\\ninterface IKeep3rJobManager is IKeep3rJobOwnership {\\n // Events\\n\\n /// @notice Emitted when Keep3rJobManager#addJob is called\\n /// @param _job The address of the job to add\\n /// @param _jobOwner The job's owner\\n event JobAddition(address indexed _job, address indexed _jobOwner);\\n\\n // Errors\\n\\n /// @notice Throws when trying to add a job that has already been added\\n error JobAlreadyAdded();\\n\\n /// @notice Throws when the address that is trying to register as a keeper is already a keeper\\n error AlreadyAKeeper();\\n\\n // Methods\\n\\n /// @notice Allows any caller to add a new job\\n /// @param _job Address of the contract for which work should be performed\\n function addJob(address _job) external;\\n}\\n\\n/// @title Keep3rJobFundableCredits contract\\n/// @notice Handles the addition and withdrawal of credits from a job\\ninterface IKeep3rJobFundableCredits is IKeep3rJobOwnership {\\n // Events\\n\\n /// @notice Emitted when Keep3rJobFundableCredits#addTokenCreditsToJob is called\\n /// @param _job The address of the job being credited\\n /// @param _token The address of the token being provided\\n /// @param _provider The user that calls the function\\n /// @param _amount The amount of credit being added to the job\\n event TokenCreditAddition(address indexed _job, address indexed _token, address indexed _provider, uint256 _amount);\\n\\n /// @notice Emitted when Keep3rJobFundableCredits#withdrawTokenCreditsFromJob is called\\n /// @param _job The address of the job from which the credits are withdrawn\\n /// @param _token The credit being withdrawn from the job\\n /// @param _receiver The user that receives the tokens\\n /// @param _amount The amount of credit withdrawn\\n event TokenCreditWithdrawal(address indexed _job, address indexed _token, address indexed _receiver, uint256 _amount);\\n\\n // Errors\\n\\n /// @notice Throws when the token is KP3R, as it should not be used for direct token payments\\n error TokenUnallowed();\\n\\n /// @notice Throws when the token withdraw cooldown has not yet passed\\n error JobTokenCreditsLocked();\\n\\n /// @notice Throws when the user tries to withdraw more tokens than it has\\n error InsufficientJobTokenCredits();\\n\\n // Variables\\n\\n /// @notice Last block where tokens were added to the job\\n /// @param _job The address of the job credited\\n /// @param _token The address of the token credited\\n /// @return _timestamp The last block where tokens were added to the job\\n function jobTokenCreditsAddedAt(address _job, address _token) external view returns (uint256 _timestamp);\\n\\n // Methods\\n\\n /// @notice Add credit to a job to be paid out for work\\n /// @param _job The address of the job being credited\\n /// @param _token The address of the token being credited\\n /// @param _amount The amount of credit being added\\n function addTokenCreditsToJob(\\n address _job,\\n address _token,\\n uint256 _amount\\n ) external;\\n\\n /// @notice Withdraw credit from a job\\n /// @param _job The address of the job from which the credits are withdrawn\\n /// @param _token The address of the token being withdrawn\\n /// @param _amount The amount of token to be withdrawn\\n /// @param _receiver The user that will receive tokens\\n function withdrawTokenCreditsFromJob(\\n address _job,\\n address _token,\\n uint256 _amount,\\n address _receiver\\n ) external;\\n}\\n\\n/// @title Keep3rJobFundableLiquidity contract\\n/// @notice Handles the funding of jobs through specific liquidity pairs\\ninterface IKeep3rJobFundableLiquidity is IKeep3rJobOwnership {\\n // Events\\n\\n /// @notice Emitted when Keep3rJobFundableLiquidity#approveLiquidity function is called\\n /// @param _liquidity The address of the liquidity pair being approved\\n event LiquidityApproval(address _liquidity);\\n\\n /// @notice Emitted when Keep3rJobFundableLiquidity#revokeLiquidity function is called\\n /// @param _liquidity The address of the liquidity pair being revoked\\n event LiquidityRevocation(address _liquidity);\\n\\n /// @notice Emitted when IKeep3rJobFundableLiquidity#addLiquidityToJob function is called\\n /// @param _job The address of the job to which liquidity will be added\\n /// @param _liquidity The address of the liquidity being added\\n /// @param _provider The user that calls the function\\n /// @param _amount The amount of liquidity being added\\n event LiquidityAddition(address indexed _job, address indexed _liquidity, address indexed _provider, uint256 _amount);\\n\\n /// @notice Emitted when IKeep3rJobFundableLiquidity#withdrawLiquidityFromJob function is called\\n /// @param _job The address of the job of which liquidity will be withdrawn from\\n /// @param _liquidity The address of the liquidity being withdrawn\\n /// @param _receiver The receiver of the liquidity tokens\\n /// @param _amount The amount of liquidity being withdrawn from the job\\n event LiquidityWithdrawal(address indexed _job, address indexed _liquidity, address indexed _receiver, uint256 _amount);\\n\\n /// @notice Emitted when Keep3rJobFundableLiquidity#addLiquidityToJob function is called\\n /// @param _job The address of the job whose credits will be updated\\n /// @param _rewardedAt The time at which the job was last rewarded\\n /// @param _currentCredits The current credits of the job\\n /// @param _periodCredits The credits of the job for the current period\\n event LiquidityCreditsReward(address indexed _job, uint256 _rewardedAt, uint256 _currentCredits, uint256 _periodCredits);\\n\\n /// @notice Emitted when Keep3rJobFundableLiquidity#forceLiquidityCreditsToJob function is called\\n /// @param _job The address of the job whose credits will be updated\\n /// @param _rewardedAt The time at which the job was last rewarded\\n /// @param _currentCredits The current credits of the job\\n event LiquidityCreditsForced(address indexed _job, uint256 _rewardedAt, uint256 _currentCredits);\\n\\n // Errors\\n\\n /// @notice Throws when the liquidity being approved has already been approved\\n error LiquidityPairApproved();\\n\\n /// @notice Throws when the liquidity being removed has not been approved\\n error LiquidityPairUnexistent();\\n\\n /// @notice Throws when trying to add liquidity to an unapproved pool\\n error LiquidityPairUnapproved();\\n\\n /// @notice Throws when the job doesn't have the requested liquidity\\n error JobLiquidityUnexistent();\\n\\n /// @notice Throws when trying to remove more liquidity than the job has\\n error JobLiquidityInsufficient();\\n\\n /// @notice Throws when trying to add less liquidity than the minimum liquidity required\\n error JobLiquidityLessThanMin();\\n\\n // Structs\\n\\n /// @notice Stores the tick information of the different liquidity pairs\\n struct TickCache {\\n int56 current; // Tracks the current tick\\n int56 difference; // Stores the difference between the current tick and the last tick\\n uint256 period; // Stores the period at which the last observation was made\\n }\\n\\n // Variables\\n\\n /// @notice Lists liquidity pairs\\n /// @return _list An array of addresses with all the approved liquidity pairs\\n function approvedLiquidities() external view returns (address[] memory _list);\\n\\n /// @notice Amount of liquidity in a specified job\\n /// @param _job The address of the job being checked\\n /// @param _liquidity The address of the liquidity we are checking\\n /// @return _amount Amount of liquidity in the specified job\\n function liquidityAmount(address _job, address _liquidity) external view returns (uint256 _amount);\\n\\n /// @notice Last time the job was rewarded liquidity credits\\n /// @param _job The address of the job being checked\\n /// @return _timestamp Timestamp of the last time the job was rewarded liquidity credits\\n function rewardedAt(address _job) external view returns (uint256 _timestamp);\\n\\n /// @notice Last time the job was worked\\n /// @param _job The address of the job being checked\\n /// @return _timestamp Timestamp of the last time the job was worked\\n function workedAt(address _job) external view returns (uint256 _timestamp);\\n\\n // Methods\\n\\n /// @notice Returns the liquidity credits of a given job\\n /// @param _job The address of the job of which we want to know the liquidity credits\\n /// @return _amount The liquidity credits of a given job\\n function jobLiquidityCredits(address _job) external view returns (uint256 _amount);\\n\\n /// @notice Returns the credits of a given job for the current period\\n /// @param _job The address of the job of which we want to know the period credits\\n /// @return _amount The credits the given job has at the current period\\n function jobPeriodCredits(address _job) external view returns (uint256 _amount);\\n\\n /// @notice Calculates the total credits of a given job\\n /// @param _job The address of the job of which we want to know the total credits\\n /// @return _amount The total credits of the given job\\n function totalJobCredits(address _job) external view returns (uint256 _amount);\\n\\n /// @notice Calculates how many credits should be rewarded periodically for a given liquidity amount\\n /// @dev _periodCredits = underlying KP3Rs for given liquidity amount * rewardPeriod / inflationPeriod\\n /// @param _liquidity The address of the liquidity to provide\\n /// @param _amount The amount of liquidity to provide\\n /// @return _periodCredits The amount of KP3R periodically minted for the given liquidity\\n function quoteLiquidity(address _liquidity, uint256 _amount) external view returns (uint256 _periodCredits);\\n\\n /// @notice Observes the current state of the liquidity pair being observed and updates TickCache with the information\\n /// @param _liquidity The address of the liquidity pair being observed\\n /// @return _tickCache The updated TickCache\\n function observeLiquidity(address _liquidity) external view returns (TickCache memory _tickCache);\\n\\n /// @notice Gifts liquidity credits to the specified job\\n /// @param _job The address of the job being credited\\n /// @param _amount The amount of liquidity credits to gift\\n function forceLiquidityCreditsToJob(address _job, uint256 _amount) external;\\n\\n /// @notice Approve a liquidity pair for being accepted in future\\n /// @param _liquidity The address of the liquidity accepted\\n function approveLiquidity(address _liquidity) external;\\n\\n /// @notice Revoke a liquidity pair from being accepted in future\\n /// @param _liquidity The liquidity no longer accepted\\n function revokeLiquidity(address _liquidity) external;\\n\\n /// @notice Allows anyone to fund a job with liquidity\\n /// @param _job The address of the job to assign liquidity to\\n /// @param _liquidity The liquidity being added\\n /// @param _amount The amount of liquidity tokens to add\\n function addLiquidityToJob(\\n address _job,\\n address _liquidity,\\n uint256 _amount\\n ) external;\\n\\n /// @notice Unbond liquidity for a job\\n /// @dev Can only be called by the job's owner\\n /// @param _job The address of the job being unbonded from\\n /// @param _liquidity The liquidity being unbonded\\n /// @param _amount The amount of liquidity being removed\\n function unbondLiquidityFromJob(\\n address _job,\\n address _liquidity,\\n uint256 _amount\\n ) external;\\n\\n /// @notice Withdraw liquidity from a job\\n /// @param _job The address of the job being withdrawn from\\n /// @param _liquidity The liquidity being withdrawn\\n /// @param _receiver The address that will receive the withdrawn liquidity\\n function withdrawLiquidityFromJob(\\n address _job,\\n address _liquidity,\\n address _receiver\\n ) external;\\n}\\n\\n/// @title Keep3rJobMigration contract\\n/// @notice Handles the migration process of jobs to different addresses\\ninterface IKeep3rJobMigration is IKeep3rJobFundableCredits, IKeep3rJobFundableLiquidity {\\n // Events\\n\\n /// @notice Emitted when Keep3rJobMigration#migrateJob function is called\\n /// @param _fromJob The address of the job that requests to migrate\\n /// @param _toJob The address at which the job requests to migrate\\n event JobMigrationRequested(address indexed _fromJob, address _toJob);\\n\\n /// @notice Emitted when Keep3rJobMigration#acceptJobMigration function is called\\n /// @param _fromJob The address of the job that requested to migrate\\n /// @param _toJob The address at which the job had requested to migrate\\n event JobMigrationSuccessful(address _fromJob, address indexed _toJob);\\n\\n // Errors\\n\\n /// @notice Throws when the address of the job that requests to migrate wants to migrate to its same address\\n error JobMigrationImpossible();\\n\\n /// @notice Throws when the _toJob address differs from the address being tracked in the pendingJobMigrations mapping\\n error JobMigrationUnavailable();\\n\\n /// @notice Throws when cooldown between migrations has not yet passed\\n error JobMigrationLocked();\\n\\n // Variables\\n\\n /// @notice Maps the jobs that have requested a migration to the address they have requested to migrate to\\n /// @return _toJob The address to which the job has requested to migrate to\\n function pendingJobMigrations(address _fromJob) external view returns (address _toJob);\\n\\n // Methods\\n\\n /// @notice Initializes the migration process for a job by adding the request to the pendingJobMigrations mapping\\n /// @param _fromJob The address of the job that is requesting to migrate\\n /// @param _toJob The address at which the job is requesting to migrate\\n function migrateJob(address _fromJob, address _toJob) external;\\n\\n /// @notice Completes the migration process for a job\\n /// @dev Unbond/withdraw process doesn't get migrated\\n /// @param _fromJob The address of the job that requested to migrate\\n /// @param _toJob The address to which the job wants to migrate to\\n function acceptJobMigration(address _fromJob, address _toJob) external;\\n}\\n\\n/// @title Keep3rJobWorkable contract\\n/// @notice Handles the mechanisms jobs can pay keepers with along with the restrictions jobs can put on keepers before they can work on jobs\\ninterface IKeep3rJobWorkable is IKeep3rJobMigration {\\n // Events\\n\\n /// @notice Emitted when a keeper is validated before a job\\n /// @param _gasLeft The amount of gas that the transaction has left at the moment of keeper validation\\n event KeeperValidation(uint256 _gasLeft);\\n\\n /// @notice Emitted when a keeper works a job\\n /// @param _credit The address of the asset in which the keeper is paid\\n /// @param _job The address of the job the keeper has worked\\n /// @param _keeper The address of the keeper that has worked the job\\n /// @param _payment The amount that has been paid out to the keeper in exchange for working the job\\n /// @param _gasLeft The amount of gas that the transaction has left at the moment of payment\\n event KeeperWork(address indexed _credit, address indexed _job, address indexed _keeper, uint256 _payment, uint256 _gasLeft);\\n\\n // Errors\\n\\n /// @notice Throws if work method was called without calling isKeeper or isBondedKeeper\\n error GasNotInitialized();\\n\\n /// @notice Throws if the address claiming to be a job is not in the list of approved jobs\\n error JobUnapproved();\\n\\n /// @notice Throws if the amount of funds in the job is less than the payment that must be paid to the keeper that works that job\\n error InsufficientFunds();\\n\\n // Methods\\n\\n /// @notice Confirms if the current keeper is registered\\n /// @dev Can be used for general (non critical) functions\\n /// @param _keeper The keeper being investigated\\n /// @return _isKeeper Whether the address passed as a parameter is a keeper or not\\n function isKeeper(address _keeper) external returns (bool _isKeeper);\\n\\n /// @notice Confirms if the current keeper is registered and has a minimum bond of any asset.\\n /// @dev Should be used for protected functions\\n /// @param _keeper The keeper to check\\n /// @param _bond The bond token being evaluated\\n /// @param _minBond The minimum amount of bonded tokens\\n /// @param _earned The minimum funds earned in the keepers lifetime\\n /// @param _age The minimum keeper age required\\n /// @return _isBondedKeeper Whether the `_keeper` meets the given requirements\\n function isBondedKeeper(\\n address _keeper,\\n address _bond,\\n uint256 _minBond,\\n uint256 _earned,\\n uint256 _age\\n ) external returns (bool _isBondedKeeper);\\n\\n /// @notice Implemented by jobs to show that a keeper performed work\\n /// @dev Automatically calculates the payment for the keeper and pays the keeper with bonded KP3R\\n /// @param _keeper Address of the keeper that performed the work\\n function worked(address _keeper) external;\\n\\n /// @notice Implemented by jobs to show that a keeper performed work\\n /// @dev Pays the keeper that performs the work with KP3R\\n /// @param _keeper Address of the keeper that performed the work\\n /// @param _payment The reward that should be allocated for the job\\n function bondedPayment(address _keeper, uint256 _payment) external;\\n\\n /// @notice Implemented by jobs to show that a keeper performed work\\n /// @dev Pays the keeper that performs the work with a specific token\\n /// @param _token The asset being awarded to the keeper\\n /// @param _keeper Address of the keeper that performed the work\\n /// @param _amount The reward that should be allocated\\n function directTokenPayment(\\n address _token,\\n address _keeper,\\n uint256 _amount\\n ) external;\\n}\\n\\n/// @title Keep3rJobDisputable contract\\n/// @notice Handles the actions that can be taken on a disputed job\\ninterface IKeep3rJobDisputable is IKeep3rDisputable, IKeep3rJobFundableCredits, IKeep3rJobFundableLiquidity {\\n // Events\\n\\n /// @notice Emitted when Keep3rJobDisputable#slashTokenFromJob is called\\n /// @param _job The address of the job from which the token will be slashed\\n /// @param _token The address of the token being slashed\\n /// @param _slasher The user that slashes the token\\n /// @param _amount The amount of the token being slashed\\n event JobSlashToken(address indexed _job, address _token, address indexed _slasher, uint256 _amount);\\n\\n /// @notice Emitted when Keep3rJobDisputable#slashLiquidityFromJob is called\\n /// @param _job The address of the job from which the liquidity will be slashed\\n /// @param _liquidity The address of the liquidity being slashed\\n /// @param _slasher The user that slashes the liquidity\\n /// @param _amount The amount of the liquidity being slashed\\n event JobSlashLiquidity(address indexed _job, address _liquidity, address indexed _slasher, uint256 _amount);\\n\\n // Errors\\n\\n /// @notice Throws when the token trying to be slashed doesn't exist\\n error JobTokenUnexistent();\\n\\n /// @notice Throws when someone tries to slash more tokens than the job has\\n error JobTokenInsufficient();\\n\\n // Methods\\n\\n /// @notice Allows governance or slasher to slash a job specific token\\n /// @param _job The address of the job from which the token will be slashed\\n /// @param _token The address of the token that will be slashed\\n /// @param _amount The amount of the token that will be slashed\\n function slashTokenFromJob(\\n address _job,\\n address _token,\\n uint256 _amount\\n ) external;\\n\\n /// @notice Allows governance or a slasher to slash liquidity from a job\\n /// @param _job The address being slashed\\n /// @param _liquidity The address of the liquidity that will be slashed\\n /// @param _amount The amount of liquidity that will be slashed\\n function slashLiquidityFromJob(\\n address _job,\\n address _liquidity,\\n uint256 _amount\\n ) external;\\n}\\n\\n// solhint-disable-next-line no-empty-blocks\\ninterface IKeep3rJobs is IKeep3rJobWorkable, IKeep3rJobManager, IKeep3rJobDisputable {\\n\\n}\\n\",\"keccak256\":\"0x08915189f1a9484d17a51b7fb343b765b9edba29062bb644af9663af18f03e34\",\"license\":\"MIT\"},\"solidity/interfaces/peripherals/IKeep3rKeepers.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4 <0.9.0;\\n\\nimport './IKeep3rDisputable.sol';\\n\\n/// @title Keep3rKeeperFundable contract\\n/// @notice Handles the actions required to become a keeper\\ninterface IKeep3rKeeperFundable {\\n // Events\\n\\n /// @notice Emitted when Keep3rKeeperFundable#activate is called\\n /// @param _keeper The keeper that has been activated\\n /// @param _bond The asset the keeper has bonded\\n /// @param _amount The amount of the asset the keeper has bonded\\n event Activation(address indexed _keeper, address indexed _bond, uint256 _amount);\\n\\n /// @notice Emitted when Keep3rKeeperFundable#withdraw is called\\n /// @param _keeper The caller of Keep3rKeeperFundable#withdraw function\\n /// @param _bond The asset to withdraw from the bonding pool\\n /// @param _amount The amount of funds withdrawn\\n event Withdrawal(address indexed _keeper, address indexed _bond, uint256 _amount);\\n\\n // Errors\\n\\n /// @notice Throws when the address that is trying to register as a job is already a job\\n error AlreadyAJob();\\n\\n // Methods\\n\\n /// @notice Beginning of the bonding process\\n /// @param _bonding The asset being bonded\\n /// @param _amount The amount of bonding asset being bonded\\n function bond(address _bonding, uint256 _amount) external;\\n\\n /// @notice Beginning of the unbonding process\\n /// @param _bonding The asset being unbonded\\n /// @param _amount Allows for partial unbonding\\n function unbond(address _bonding, uint256 _amount) external;\\n\\n /// @notice End of the bonding process after bonding time has passed\\n /// @param _bonding The asset being activated as bond collateral\\n function activate(address _bonding) external;\\n\\n /// @notice Withdraw funds after unbonding has finished\\n /// @param _bonding The asset to withdraw from the bonding pool\\n function withdraw(address _bonding) external;\\n}\\n\\n/// @title Keep3rKeeperDisputable contract\\n/// @notice Handles the actions that can be taken on a disputed keeper\\ninterface IKeep3rKeeperDisputable is IKeep3rDisputable, IKeep3rKeeperFundable {\\n // Events\\n\\n /// @notice Emitted when Keep3rKeeperDisputable#slash is called\\n /// @param _keeper The address of the slashed keeper\\n /// @param _slasher The user that called Keep3rKeeperDisputable#slash\\n /// @param _amount The amount of credits slashed from the keeper\\n event KeeperSlash(address indexed _keeper, address indexed _slasher, uint256 _amount);\\n\\n /// @notice Emitted when Keep3rKeeperDisputable#revoke is called\\n /// @param _keeper The address of the revoked keeper\\n /// @param _slasher The user that called Keep3rKeeperDisputable#revoke\\n event KeeperRevoke(address indexed _keeper, address indexed _slasher);\\n\\n // Methods\\n\\n /// @notice Allows governance to slash a keeper based on a dispute\\n /// @param _keeper The address being slashed\\n /// @param _bonded The asset being slashed\\n /// @param _bondAmount The bonded amount being slashed\\n /// @param _unbondAmount The pending unbond amount being slashed\\n function slash(\\n address _keeper,\\n address _bonded,\\n uint256 _bondAmount,\\n uint256 _unbondAmount\\n ) external;\\n\\n /// @notice Blacklists a keeper from participating in the network\\n /// @param _keeper The address being slashed\\n function revoke(address _keeper) external;\\n}\\n\\n// solhint-disable-next-line no-empty-blocks\\n\\n/// @title Keep3rKeepers contract\\ninterface IKeep3rKeepers is IKeep3rKeeperDisputable {\\n\\n}\\n\",\"keccak256\":\"0xc95e6bba82a8371c6bd15a8e9d0df91c826b5050b8ee01d913c1c13a4e92a49b\",\"license\":\"MIT\"},\"solidity/interfaces/peripherals/IKeep3rParameters.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4 <0.9.0;\\n\\nimport './IKeep3rAccountance.sol';\\n\\n/// @title Keep3rParameters contract\\n/// @notice Handles and sets all the required parameters for Keep3r\\ninterface IKeep3rParameters is IKeep3rAccountance {\\n // Events\\n\\n /// @notice Emitted when the Keep3rHelper address is changed\\n /// @param _keep3rHelper The address of Keep3rHelper's contract\\n event Keep3rHelperChange(address _keep3rHelper);\\n\\n /// @notice Emitted when the Keep3rV1 address is changed\\n /// @param _keep3rV1 The address of Keep3rV1's contract\\n event Keep3rV1Change(address _keep3rV1);\\n\\n /// @notice Emitted when the Keep3rV1Proxy address is changed\\n /// @param _keep3rV1Proxy The address of Keep3rV1Proxy's contract\\n event Keep3rV1ProxyChange(address _keep3rV1Proxy);\\n\\n /// @notice Emitted when bondTime is changed\\n /// @param _bondTime The new bondTime\\n event BondTimeChange(uint256 _bondTime);\\n\\n /// @notice Emitted when _liquidityMinimum is changed\\n /// @param _liquidityMinimum The new _liquidityMinimum\\n event LiquidityMinimumChange(uint256 _liquidityMinimum);\\n\\n /// @notice Emitted when _unbondTime is changed\\n /// @param _unbondTime The new _unbondTime\\n event UnbondTimeChange(uint256 _unbondTime);\\n\\n /// @notice Emitted when _rewardPeriodTime is changed\\n /// @param _rewardPeriodTime The new _rewardPeriodTime\\n event RewardPeriodTimeChange(uint256 _rewardPeriodTime);\\n\\n /// @notice Emitted when the inflationPeriod is changed\\n /// @param _inflationPeriod The new inflationPeriod\\n event InflationPeriodChange(uint256 _inflationPeriod);\\n\\n /// @notice Emitted when the fee is changed\\n /// @param _fee The new token credits fee\\n event FeeChange(uint256 _fee);\\n\\n // Variables\\n\\n /// @notice Address of Keep3rHelper's contract\\n /// @return _keep3rHelper The address of Keep3rHelper's contract\\n function keep3rHelper() external view returns (address _keep3rHelper);\\n\\n /// @notice Address of Keep3rV1's contract\\n /// @return _keep3rV1 The address of Keep3rV1's contract\\n function keep3rV1() external view returns (address _keep3rV1);\\n\\n /// @notice Address of Keep3rV1Proxy's contract\\n /// @return _keep3rV1Proxy The address of Keep3rV1Proxy's contract\\n function keep3rV1Proxy() external view returns (address _keep3rV1Proxy);\\n\\n /// @notice The amount of time required to pass after a keeper has bonded assets for it to be able to activate\\n /// @return _days The required bondTime in days\\n function bondTime() external view returns (uint256 _days);\\n\\n /// @notice The amount of time required to pass before a keeper can unbond what he has bonded\\n /// @return _days The required unbondTime in days\\n function unbondTime() external view returns (uint256 _days);\\n\\n /// @notice The minimum amount of liquidity required to fund a job per liquidity\\n /// @return _amount The minimum amount of liquidity in KP3R\\n function liquidityMinimum() external view returns (uint256 _amount);\\n\\n /// @notice The amount of time between each scheduled credits reward given to a job\\n /// @return _days The reward period in days\\n function rewardPeriodTime() external view returns (uint256 _days);\\n\\n /// @notice The inflation period is the denominator used to regulate the emission of KP3R\\n /// @return _period The denominator used to regulate the emission of KP3R\\n function inflationPeriod() external view returns (uint256 _period);\\n\\n /// @notice The fee to be sent to governance when a user adds liquidity to a job\\n /// @return _amount The fee amount to be sent to governance when a user adds liquidity to a job\\n function fee() external view returns (uint256 _amount);\\n\\n // Errors\\n\\n /// @notice Throws if the reward period is less than the minimum reward period time\\n error MinRewardPeriod();\\n\\n /// @notice Throws if either a job or a keeper is disputed\\n error Disputed();\\n\\n /// @notice Throws if there are no bonded assets\\n error BondsUnexistent();\\n\\n /// @notice Throws if the time required to bond an asset has not passed yet\\n error BondsLocked();\\n\\n /// @notice Throws if there are no bonds to withdraw\\n error UnbondsUnexistent();\\n\\n /// @notice Throws if the time required to withdraw the bonds has not passed yet\\n error UnbondsLocked();\\n\\n // Methods\\n\\n /// @notice Sets the Keep3rHelper address\\n /// @param _keep3rHelper The Keep3rHelper address\\n function setKeep3rHelper(address _keep3rHelper) external;\\n\\n /// @notice Sets the Keep3rV1 address\\n /// @param _keep3rV1 The Keep3rV1 address\\n function setKeep3rV1(address _keep3rV1) external;\\n\\n /// @notice Sets the Keep3rV1Proxy address\\n /// @param _keep3rV1Proxy The Keep3rV1Proxy address\\n function setKeep3rV1Proxy(address _keep3rV1Proxy) external;\\n\\n /// @notice Sets the bond time required to activate as a keeper\\n /// @param _bond The new bond time\\n function setBondTime(uint256 _bond) external;\\n\\n /// @notice Sets the unbond time required unbond what has been bonded\\n /// @param _unbond The new unbond time\\n function setUnbondTime(uint256 _unbond) external;\\n\\n /// @notice Sets the minimum amount of liquidity required to fund a job\\n /// @param _liquidityMinimum The new minimum amount of liquidity\\n function setLiquidityMinimum(uint256 _liquidityMinimum) external;\\n\\n /// @notice Sets the time required to pass between rewards for jobs\\n /// @param _rewardPeriodTime The new amount of time required to pass between rewards\\n function setRewardPeriodTime(uint256 _rewardPeriodTime) external;\\n\\n /// @notice Sets the new inflation period\\n /// @param _inflationPeriod The new inflation period\\n function setInflationPeriod(uint256 _inflationPeriod) external;\\n\\n /// @notice Sets the new fee\\n /// @param _fee The new fee\\n function setFee(uint256 _fee) external;\\n}\\n\",\"keccak256\":\"0x942f99c6e3b229a551faaae8f03000b934b20502a7cfade14780508201fd098e\",\"license\":\"MIT\"},\"solidity/interfaces/peripherals/IKeep3rRoles.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4 <0.9.0;\\n\\nimport './IBaseErrors.sol';\\nimport './IGovernable.sol';\\nimport './IDustCollector.sol';\\n\\n/// @title Keep3rRoles contract\\n/// @notice Manages the Keep3r specific roles\\ninterface IKeep3rRoles is IBaseErrors, IDustCollector, IGovernable {\\n // Events\\n\\n /// @notice Emitted when a slasher is added\\n /// @param _slasher Address of the added slasher\\n event SlasherAdded(address _slasher);\\n\\n /// @notice Emitted when a slasher is removed\\n /// @param _slasher Address of the removed slasher\\n event SlasherRemoved(address _slasher);\\n\\n /// @notice Emitted when a disputer is added\\n /// @param _disputer Address of the added disputer\\n event DisputerAdded(address _disputer);\\n\\n /// @notice Emitted when a disputer is removed\\n /// @param _disputer Address of the removed disputer\\n event DisputerRemoved(address _disputer);\\n\\n // Variables\\n\\n /// @notice Tracks whether the address is a slasher or not\\n /// @param _slasher Address being checked as a slasher\\n /// @return _isSlasher Whether the address is a slasher or not\\n function slashers(address _slasher) external view returns (bool _isSlasher);\\n\\n /// @notice Tracks whether the address is a disputer or not\\n /// @param _disputer Address being checked as a disputer\\n /// @return _isDisputer Whether the address is a disputer or not\\n function disputers(address _disputer) external view returns (bool _isDisputer);\\n\\n // Errors\\n\\n /// @notice Throws if the address is already a registered slasher\\n error SlasherExistent();\\n\\n /// @notice Throws if caller is not a registered slasher\\n error SlasherUnexistent();\\n\\n /// @notice Throws if the address is already a registered disputer\\n error DisputerExistent();\\n\\n /// @notice Throws if caller is not a registered disputer\\n error DisputerUnexistent();\\n\\n /// @notice Throws if the msg.sender is not a slasher or is not a part of governance\\n error OnlySlasher();\\n\\n /// @notice Throws if the msg.sender is not a disputer or is not a part of governance\\n error OnlyDisputer();\\n\\n // Methods\\n\\n /// @notice Registers a slasher by updating the slashers mapping\\n function addSlasher(address _slasher) external;\\n\\n /// @notice Removes a slasher by updating the slashers mapping\\n function removeSlasher(address _slasher) external;\\n\\n /// @notice Registers a disputer by updating the disputers mapping\\n function addDisputer(address _disputer) external;\\n\\n /// @notice Removes a disputer by updating the disputers mapping\\n function removeDisputer(address _disputer) external;\\n}\\n\",\"keccak256\":\"0xe6eca166cf6ad99e5379d754030222873bb9868ff3e2a76de815a438ead533a2\",\"license\":\"MIT\"}},\"version\":1}", - "bytecode": "0x608060405234801561001057600080fd5b5060405161049938038061049983398101604081905261002f91610054565b600080546001600160a01b0319166001600160a01b0392909216919091179055610084565b60006020828403121561006657600080fd5b81516001600160a01b038116811461007d57600080fd5b9392505050565b610406806100936000396000f3fe608060405234801561001057600080fd5b506004361061004c5760003560e01c8063322e9f04146100515780633bb39c331461005b578063634c7bb51461006e578063affed0e014610097575b600080fd5b6100596100ae565b005b610059610069366004610353565b6101e7565b600054610081906001600160a01b031681565b60405161008e919061036c565b60405180910390f35b6100a060015481565b60405190815260200161008e565b6000546040516335d2155560e11b81526001600160a01b0390911690636ba42aaa906100de90339060040161036c565b602060405180830381600087803b1580156100f857600080fd5b505af115801561010c573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610130919061032a565b61014d57604051637671ff4960e11b815260040160405180910390fd5b60005b6103e8811015610182576001805490600061016a8361039f565b9190505550808061017a9061039f565b915050610150565b506000546040516317fbade560e21b81526001600160a01b0390911690635feeb794906101b390339060040161036c565b600060405180830381600087803b1580156101cd57600080fd5b505af11580156101e1573d6000803e3d6000fd5b50505050565b6000546040516335d2155560e11b81526001600160a01b0390911690636ba42aaa9061021790339060040161036c565b602060405180830381600087803b15801561023157600080fd5b505af1158015610245573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610269919061032a565b61028657604051637671ff4960e11b815260040160405180910390fd5b60005b610295826103e8610380565b8110156102c457600180549060006102ac8361039f565b919050555080806102bc9061039f565b915050610289565b506000546040516317fbade560e21b81526001600160a01b0390911690635feeb794906102f590339060040161036c565b600060405180830381600087803b15801561030f57600080fd5b505af1158015610323573d6000803e3d6000fd5b5050505050565b60006020828403121561033c57600080fd5b8151801515811461034c57600080fd5b9392505050565b60006020828403121561036557600080fd5b5035919050565b6001600160a01b0391909116815260200190565b600081600019048311821515161561039a5761039a6103ba565b500290565b60006000198214156103b3576103b36103ba565b5060010190565b634e487b7160e01b600052601160045260246000fdfea264697066735822122072f8c8f00b08f3b67ddde30dce3d3b407bfbe619e838b7a0dff19ba72918e0f264736f6c63430008070033", - "deployedBytecode": "0x608060405234801561001057600080fd5b506004361061004c5760003560e01c8063322e9f04146100515780633bb39c331461005b578063634c7bb51461006e578063affed0e014610097575b600080fd5b6100596100ae565b005b610059610069366004610353565b6101e7565b600054610081906001600160a01b031681565b60405161008e919061036c565b60405180910390f35b6100a060015481565b60405190815260200161008e565b6000546040516335d2155560e11b81526001600160a01b0390911690636ba42aaa906100de90339060040161036c565b602060405180830381600087803b1580156100f857600080fd5b505af115801561010c573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610130919061032a565b61014d57604051637671ff4960e11b815260040160405180910390fd5b60005b6103e8811015610182576001805490600061016a8361039f565b9190505550808061017a9061039f565b915050610150565b506000546040516317fbade560e21b81526001600160a01b0390911690635feeb794906101b390339060040161036c565b600060405180830381600087803b1580156101cd57600080fd5b505af11580156101e1573d6000803e3d6000fd5b50505050565b6000546040516335d2155560e11b81526001600160a01b0390911690636ba42aaa9061021790339060040161036c565b602060405180830381600087803b15801561023157600080fd5b505af1158015610245573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610269919061032a565b61028657604051637671ff4960e11b815260040160405180910390fd5b60005b610295826103e8610380565b8110156102c457600180549060006102ac8361039f565b919050555080806102bc9061039f565b915050610289565b506000546040516317fbade560e21b81526001600160a01b0390911690635feeb794906102f590339060040161036c565b600060405180830381600087803b15801561030f57600080fd5b505af1158015610323573d6000803e3d6000fd5b5050505050565b60006020828403121561033c57600080fd5b8151801515811461034c57600080fd5b9392505050565b60006020828403121561036557600080fd5b5035919050565b6001600160a01b0391909116815260200190565b600081600019048311821515161561039a5761039a6103ba565b500290565b60006000198214156103b3576103b36103ba565b5060010190565b634e487b7160e01b600052601160045260246000fdfea264697066735822122072f8c8f00b08f3b67ddde30dce3d3b407bfbe619e838b7a0dff19ba72918e0f264736f6c63430008070033", - "devdoc": { - "kind": "dev", - "methods": {}, - "version": 1 - }, - "userdoc": { - "kind": "user", - "methods": {}, - "version": 1 - }, - "storageLayout": { - "storage": [ - { - "astId": 10747, - "contract": "solidity/for-test/JobForTest.sol:JobForTest", - "label": "keep3r", - "offset": 0, - "slot": "0", - "type": "t_address" - }, - { - "astId": 10749, - "contract": "solidity/for-test/JobForTest.sol:JobForTest", - "label": "nonce", - "offset": 0, - "slot": "1", - "type": "t_uint256" - } - ], - "types": { - "t_address": { - "encoding": "inplace", - "label": "address", - "numberOfBytes": "20" - }, - "t_uint256": { - "encoding": "inplace", - "label": "uint256", - "numberOfBytes": "32" - } - } - } -} \ No newline at end of file diff --git a/deployments/goerli/KP3Rv1.json b/deployments/goerli/KP3Rv1.json deleted file mode 100644 index 5d4b7bf..0000000 --- a/deployments/goerli/KP3Rv1.json +++ /dev/null @@ -1,189 +0,0 @@ -{ - "address": "0x16F63C5036d3F48A239358656a8f123eCE85789C", - "abi": [ - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "owner", - "type": "address" - }, - { - "indexed": true, - "internalType": "address", - "name": "spender", - "type": "address" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "value", - "type": "uint256" - } - ], - "name": "Approval", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "from", - "type": "address" - }, - { - "indexed": true, - "internalType": "address", - "name": "to", - "type": "address" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "value", - "type": "uint256" - } - ], - "name": "Transfer", - "type": "event" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "owner", - "type": "address" - }, - { - "internalType": "address", - "name": "spender", - "type": "address" - } - ], - "name": "allowance", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "spender", - "type": "address" - }, - { - "internalType": "uint256", - "name": "amount", - "type": "uint256" - } - ], - "name": "approve", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "account", - "type": "address" - } - ], - "name": "balanceOf", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "totalSupply", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "recipient", - "type": "address" - }, - { - "internalType": "uint256", - "name": "amount", - "type": "uint256" - } - ], - "name": "transfer", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "sender", - "type": "address" - }, - { - "internalType": "address", - "name": "recipient", - "type": "address" - }, - { - "internalType": "uint256", - "name": "amount", - "type": "uint256" - } - ], - "name": "transferFrom", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "stateMutability": "nonpayable", - "type": "function" - } - ], - "numDeployments": 3 -} \ No newline at end of file diff --git a/deployments/goerli/Keep3rForTestnet.json b/deployments/goerli/Keep3rForTestnet.json deleted file mode 100644 index 0c8a38b..0000000 --- a/deployments/goerli/Keep3rForTestnet.json +++ /dev/null @@ -1,3954 +0,0 @@ -{ - "address": "0x85063437C02Ba7F4f82F898859e4992380DEd3bb", - "abi": [ - { - "inputs": [ - { - "internalType": "address", - "name": "_governance", - "type": "address" - }, - { - "internalType": "address", - "name": "_keep3rHelper", - "type": "address" - }, - { - "internalType": "address", - "name": "_keep3rV1", - "type": "address" - }, - { - "internalType": "address", - "name": "_keep3rV1Proxy", - "type": "address" - } - ], - "stateMutability": "nonpayable", - "type": "constructor" - }, - { - "inputs": [], - "name": "AlreadyAJob", - "type": "error" - }, - { - "inputs": [], - "name": "AlreadyAKeeper", - "type": "error" - }, - { - "inputs": [], - "name": "AlreadyDisputed", - "type": "error" - }, - { - "inputs": [], - "name": "BondsLocked", - "type": "error" - }, - { - "inputs": [], - "name": "BondsUnexistent", - "type": "error" - }, - { - "inputs": [], - "name": "Disputed", - "type": "error" - }, - { - "inputs": [], - "name": "DisputerExistent", - "type": "error" - }, - { - "inputs": [], - "name": "DisputerUnexistent", - "type": "error" - }, - { - "inputs": [], - "name": "GasNotInitialized", - "type": "error" - }, - { - "inputs": [], - "name": "InsufficientFunds", - "type": "error" - }, - { - "inputs": [], - "name": "InsufficientJobTokenCredits", - "type": "error" - }, - { - "inputs": [], - "name": "JobAlreadyAdded", - "type": "error" - }, - { - "inputs": [], - "name": "JobDisputed", - "type": "error" - }, - { - "inputs": [], - "name": "JobLiquidityInsufficient", - "type": "error" - }, - { - "inputs": [], - "name": "JobLiquidityLessThanMin", - "type": "error" - }, - { - "inputs": [], - "name": "JobLiquidityUnexistent", - "type": "error" - }, - { - "inputs": [], - "name": "JobMigrationImpossible", - "type": "error" - }, - { - "inputs": [], - "name": "JobMigrationLocked", - "type": "error" - }, - { - "inputs": [], - "name": "JobMigrationUnavailable", - "type": "error" - }, - { - "inputs": [], - "name": "JobTokenCreditsLocked", - "type": "error" - }, - { - "inputs": [], - "name": "JobTokenInsufficient", - "type": "error" - }, - { - "inputs": [], - "name": "JobTokenUnexistent", - "type": "error" - }, - { - "inputs": [], - "name": "JobUnapproved", - "type": "error" - }, - { - "inputs": [], - "name": "JobUnavailable", - "type": "error" - }, - { - "inputs": [], - "name": "LiquidityPairApproved", - "type": "error" - }, - { - "inputs": [], - "name": "LiquidityPairUnapproved", - "type": "error" - }, - { - "inputs": [], - "name": "LiquidityPairUnexistent", - "type": "error" - }, - { - "inputs": [], - "name": "MinRewardPeriod", - "type": "error" - }, - { - "inputs": [], - "name": "NoGovernanceZeroAddress", - "type": "error" - }, - { - "inputs": [], - "name": "NotDisputed", - "type": "error" - }, - { - "inputs": [], - "name": "OnlyDisputer", - "type": "error" - }, - { - "inputs": [], - "name": "OnlyGovernance", - "type": "error" - }, - { - "inputs": [], - "name": "OnlyJobOwner", - "type": "error" - }, - { - "inputs": [], - "name": "OnlyPendingGovernance", - "type": "error" - }, - { - "inputs": [], - "name": "OnlyPendingJobOwner", - "type": "error" - }, - { - "inputs": [], - "name": "OnlySlasher", - "type": "error" - }, - { - "inputs": [], - "name": "SlasherExistent", - "type": "error" - }, - { - "inputs": [], - "name": "SlasherUnexistent", - "type": "error" - }, - { - "inputs": [], - "name": "TokenUnallowed", - "type": "error" - }, - { - "inputs": [], - "name": "UnbondsLocked", - "type": "error" - }, - { - "inputs": [], - "name": "UnbondsUnexistent", - "type": "error" - }, - { - "inputs": [], - "name": "ZeroAddress", - "type": "error" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "_keeper", - "type": "address" - }, - { - "indexed": true, - "internalType": "address", - "name": "_bond", - "type": "address" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "_amount", - "type": "uint256" - } - ], - "name": "Activation", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "uint256", - "name": "_bondTime", - "type": "uint256" - } - ], - "name": "BondTimeChange", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "_keeper", - "type": "address" - }, - { - "indexed": true, - "internalType": "address", - "name": "_bonding", - "type": "address" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "_amount", - "type": "uint256" - } - ], - "name": "Bonding", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "_jobOrKeeper", - "type": "address" - }, - { - "indexed": true, - "internalType": "address", - "name": "_disputer", - "type": "address" - } - ], - "name": "Dispute", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "address", - "name": "_disputer", - "type": "address" - } - ], - "name": "DisputerAdded", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "address", - "name": "_disputer", - "type": "address" - } - ], - "name": "DisputerRemoved", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "address", - "name": "_token", - "type": "address" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "_amount", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "address", - "name": "_to", - "type": "address" - } - ], - "name": "DustSent", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "uint256", - "name": "_fee", - "type": "uint256" - } - ], - "name": "FeeChange", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "address", - "name": "_pendingGovernance", - "type": "address" - } - ], - "name": "GovernanceProposal", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "address", - "name": "_governance", - "type": "address" - } - ], - "name": "GovernanceSet", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "uint256", - "name": "_inflationPeriod", - "type": "uint256" - } - ], - "name": "InflationPeriodChange", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "_job", - "type": "address" - }, - { - "indexed": true, - "internalType": "address", - "name": "_jobOwner", - "type": "address" - } - ], - "name": "JobAddition", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "_fromJob", - "type": "address" - }, - { - "indexed": false, - "internalType": "address", - "name": "_toJob", - "type": "address" - } - ], - "name": "JobMigrationRequested", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "address", - "name": "_fromJob", - "type": "address" - }, - { - "indexed": true, - "internalType": "address", - "name": "_toJob", - "type": "address" - } - ], - "name": "JobMigrationSuccessful", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "_job", - "type": "address" - }, - { - "indexed": true, - "internalType": "address", - "name": "_previousOwner", - "type": "address" - }, - { - "indexed": true, - "internalType": "address", - "name": "_newOwner", - "type": "address" - } - ], - "name": "JobOwnershipAssent", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "_job", - "type": "address" - }, - { - "indexed": true, - "internalType": "address", - "name": "_owner", - "type": "address" - }, - { - "indexed": true, - "internalType": "address", - "name": "_pendingOwner", - "type": "address" - } - ], - "name": "JobOwnershipChange", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "_job", - "type": "address" - }, - { - "indexed": false, - "internalType": "address", - "name": "_liquidity", - "type": "address" - }, - { - "indexed": true, - "internalType": "address", - "name": "_slasher", - "type": "address" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "_amount", - "type": "uint256" - } - ], - "name": "JobSlashLiquidity", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "_job", - "type": "address" - }, - { - "indexed": false, - "internalType": "address", - "name": "_token", - "type": "address" - }, - { - "indexed": true, - "internalType": "address", - "name": "_slasher", - "type": "address" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "_amount", - "type": "uint256" - } - ], - "name": "JobSlashToken", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "address", - "name": "_keep3rHelper", - "type": "address" - } - ], - "name": "Keep3rHelperChange", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "address", - "name": "_keep3rV1", - "type": "address" - } - ], - "name": "Keep3rV1Change", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "address", - "name": "_keep3rV1Proxy", - "type": "address" - } - ], - "name": "Keep3rV1ProxyChange", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "_keeper", - "type": "address" - }, - { - "indexed": true, - "internalType": "address", - "name": "_slasher", - "type": "address" - } - ], - "name": "KeeperRevoke", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "_keeper", - "type": "address" - }, - { - "indexed": true, - "internalType": "address", - "name": "_slasher", - "type": "address" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "_amount", - "type": "uint256" - } - ], - "name": "KeeperSlash", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "uint256", - "name": "_gasLeft", - "type": "uint256" - } - ], - "name": "KeeperValidation", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "_credit", - "type": "address" - }, - { - "indexed": true, - "internalType": "address", - "name": "_job", - "type": "address" - }, - { - "indexed": true, - "internalType": "address", - "name": "_keeper", - "type": "address" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "_payment", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "_gasLeft", - "type": "uint256" - } - ], - "name": "KeeperWork", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "_job", - "type": "address" - }, - { - "indexed": true, - "internalType": "address", - "name": "_liquidity", - "type": "address" - }, - { - "indexed": true, - "internalType": "address", - "name": "_provider", - "type": "address" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "_amount", - "type": "uint256" - } - ], - "name": "LiquidityAddition", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "address", - "name": "_liquidity", - "type": "address" - } - ], - "name": "LiquidityApproval", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "_job", - "type": "address" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "_rewardedAt", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "_currentCredits", - "type": "uint256" - } - ], - "name": "LiquidityCreditsForced", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "_job", - "type": "address" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "_rewardedAt", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "_currentCredits", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "_periodCredits", - "type": "uint256" - } - ], - "name": "LiquidityCreditsReward", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "uint256", - "name": "_liquidityMinimum", - "type": "uint256" - } - ], - "name": "LiquidityMinimumChange", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "address", - "name": "_liquidity", - "type": "address" - } - ], - "name": "LiquidityRevocation", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "_job", - "type": "address" - }, - { - "indexed": true, - "internalType": "address", - "name": "_liquidity", - "type": "address" - }, - { - "indexed": true, - "internalType": "address", - "name": "_receiver", - "type": "address" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "_amount", - "type": "uint256" - } - ], - "name": "LiquidityWithdrawal", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "_jobOrKeeper", - "type": "address" - }, - { - "indexed": true, - "internalType": "address", - "name": "_resolver", - "type": "address" - } - ], - "name": "Resolve", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "uint256", - "name": "_rewardPeriodTime", - "type": "uint256" - } - ], - "name": "RewardPeriodTimeChange", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "address", - "name": "_slasher", - "type": "address" - } - ], - "name": "SlasherAdded", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "address", - "name": "_slasher", - "type": "address" - } - ], - "name": "SlasherRemoved", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "_job", - "type": "address" - }, - { - "indexed": true, - "internalType": "address", - "name": "_token", - "type": "address" - }, - { - "indexed": true, - "internalType": "address", - "name": "_provider", - "type": "address" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "_amount", - "type": "uint256" - } - ], - "name": "TokenCreditAddition", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "_job", - "type": "address" - }, - { - "indexed": true, - "internalType": "address", - "name": "_token", - "type": "address" - }, - { - "indexed": true, - "internalType": "address", - "name": "_receiver", - "type": "address" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "_amount", - "type": "uint256" - } - ], - "name": "TokenCreditWithdrawal", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "uint256", - "name": "_unbondTime", - "type": "uint256" - } - ], - "name": "UnbondTimeChange", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "_keeperOrJob", - "type": "address" - }, - { - "indexed": true, - "internalType": "address", - "name": "_unbonding", - "type": "address" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "_amount", - "type": "uint256" - } - ], - "name": "Unbonding", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "_keeper", - "type": "address" - }, - { - "indexed": true, - "internalType": "address", - "name": "_bond", - "type": "address" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "_amount", - "type": "uint256" - } - ], - "name": "Withdrawal", - "type": "event" - }, - { - "inputs": [], - "name": "acceptGovernance", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_fromJob", - "type": "address" - }, - { - "internalType": "address", - "name": "_toJob", - "type": "address" - } - ], - "name": "acceptJobMigration", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_job", - "type": "address" - } - ], - "name": "acceptJobOwnership", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_bonding", - "type": "address" - } - ], - "name": "activate", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_disputer", - "type": "address" - } - ], - "name": "addDisputer", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_job", - "type": "address" - } - ], - "name": "addJob", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_job", - "type": "address" - }, - { - "internalType": "address", - "name": "_liquidity", - "type": "address" - }, - { - "internalType": "uint256", - "name": "_amount", - "type": "uint256" - } - ], - "name": "addLiquidityToJob", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_slasher", - "type": "address" - } - ], - "name": "addSlasher", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_job", - "type": "address" - }, - { - "internalType": "address", - "name": "_token", - "type": "address" - }, - { - "internalType": "uint256", - "name": "_amount", - "type": "uint256" - } - ], - "name": "addTokenCreditsToJob", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_liquidity", - "type": "address" - } - ], - "name": "approveLiquidity", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [], - "name": "approvedLiquidities", - "outputs": [ - { - "internalType": "address[]", - "name": "_list", - "type": "address[]" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_bonding", - "type": "address" - }, - { - "internalType": "uint256", - "name": "_amount", - "type": "uint256" - } - ], - "name": "bond", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [], - "name": "bondTime", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_keeper", - "type": "address" - }, - { - "internalType": "uint256", - "name": "_payment", - "type": "uint256" - } - ], - "name": "bondedPayment", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - }, - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "name": "bonds", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - }, - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "name": "canActivateAfter", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - }, - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "name": "canWithdrawAfter", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_job", - "type": "address" - }, - { - "internalType": "address", - "name": "_newOwner", - "type": "address" - } - ], - "name": "changeJobOwnership", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_token", - "type": "address" - }, - { - "internalType": "address", - "name": "_keeper", - "type": "address" - }, - { - "internalType": "uint256", - "name": "_amount", - "type": "uint256" - } - ], - "name": "directTokenPayment", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_jobOrKeeper", - "type": "address" - } - ], - "name": "dispute", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "name": "disputers", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "name": "disputes", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "fee", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "name": "firstSeen", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_job", - "type": "address" - }, - { - "internalType": "uint256", - "name": "_amount", - "type": "uint256" - } - ], - "name": "forceLiquidityCreditsToJob", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [], - "name": "governance", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "name": "hasBonded", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "inflationPeriod", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_keeper", - "type": "address" - }, - { - "internalType": "address", - "name": "_bond", - "type": "address" - }, - { - "internalType": "uint256", - "name": "_minBond", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "_earned", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "_age", - "type": "uint256" - } - ], - "name": "isBondedKeeper", - "outputs": [ - { - "internalType": "bool", - "name": "_isBondedKeeper", - "type": "bool" - } - ], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_keeper", - "type": "address" - } - ], - "name": "isKeeper", - "outputs": [ - { - "internalType": "bool", - "name": "_isKeeper", - "type": "bool" - } - ], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_job", - "type": "address" - } - ], - "name": "jobLiquidityCredits", - "outputs": [ - { - "internalType": "uint256", - "name": "_liquidityCredits", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "name": "jobOwner", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "name": "jobPendingOwner", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_job", - "type": "address" - } - ], - "name": "jobPeriodCredits", - "outputs": [ - { - "internalType": "uint256", - "name": "_periodCredits", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - }, - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "name": "jobTokenCredits", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - }, - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "name": "jobTokenCreditsAddedAt", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "jobs", - "outputs": [ - { - "internalType": "address[]", - "name": "_list", - "type": "address[]" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "keep3rHelper", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "keep3rV1", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "keep3rV1Proxy", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "keepers", - "outputs": [ - { - "internalType": "address[]", - "name": "_list", - "type": "address[]" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - }, - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "name": "liquidityAmount", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "liquidityMinimum", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_fromJob", - "type": "address" - }, - { - "internalType": "address", - "name": "_toJob", - "type": "address" - } - ], - "name": "migrateJob", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_liquidity", - "type": "address" - } - ], - "name": "observeLiquidity", - "outputs": [ - { - "components": [ - { - "internalType": "int56", - "name": "current", - "type": "int56" - }, - { - "internalType": "int56", - "name": "difference", - "type": "int56" - }, - { - "internalType": "uint256", - "name": "period", - "type": "uint256" - } - ], - "internalType": "struct IKeep3rJobFundableLiquidity.TickCache", - "name": "_tickCache", - "type": "tuple" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - }, - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "name": "pendingBonds", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "pendingGovernance", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "name": "pendingJobMigrations", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - }, - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "name": "pendingUnbonds", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_liquidity", - "type": "address" - }, - { - "internalType": "uint256", - "name": "_amount", - "type": "uint256" - } - ], - "name": "quoteLiquidity", - "outputs": [ - { - "internalType": "uint256", - "name": "_periodCredits", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_disputer", - "type": "address" - } - ], - "name": "removeDisputer", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_slasher", - "type": "address" - } - ], - "name": "removeSlasher", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_jobOrKeeper", - "type": "address" - } - ], - "name": "resolve", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_keeper", - "type": "address" - } - ], - "name": "revoke", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_liquidity", - "type": "address" - } - ], - "name": "revokeLiquidity", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [], - "name": "rewardPeriodTime", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "name": "rewardedAt", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_token", - "type": "address" - }, - { - "internalType": "uint256", - "name": "_amount", - "type": "uint256" - }, - { - "internalType": "address", - "name": "_to", - "type": "address" - } - ], - "name": "sendDust", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "_bondTime", - "type": "uint256" - } - ], - "name": "setBondTime", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "_fee", - "type": "uint256" - } - ], - "name": "setFee", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_governance", - "type": "address" - } - ], - "name": "setGovernance", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "_inflationPeriod", - "type": "uint256" - } - ], - "name": "setInflationPeriod", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_keep3rHelper", - "type": "address" - } - ], - "name": "setKeep3rHelper", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_keep3rV1", - "type": "address" - } - ], - "name": "setKeep3rV1", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_keep3rV1Proxy", - "type": "address" - } - ], - "name": "setKeep3rV1Proxy", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "_liquidityMinimum", - "type": "uint256" - } - ], - "name": "setLiquidityMinimum", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "_rewardPeriodTime", - "type": "uint256" - } - ], - "name": "setRewardPeriodTime", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "_unbondTime", - "type": "uint256" - } - ], - "name": "setUnbondTime", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_keeper", - "type": "address" - }, - { - "internalType": "address", - "name": "_bonded", - "type": "address" - }, - { - "internalType": "uint256", - "name": "_bondAmount", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "_unbondAmount", - "type": "uint256" - } - ], - "name": "slash", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_job", - "type": "address" - }, - { - "internalType": "address", - "name": "_liquidity", - "type": "address" - }, - { - "internalType": "uint256", - "name": "_amount", - "type": "uint256" - } - ], - "name": "slashLiquidityFromJob", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_job", - "type": "address" - }, - { - "internalType": "address", - "name": "_token", - "type": "address" - }, - { - "internalType": "uint256", - "name": "_amount", - "type": "uint256" - } - ], - "name": "slashTokenFromJob", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "name": "slashers", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "totalBonds", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_job", - "type": "address" - } - ], - "name": "totalJobCredits", - "outputs": [ - { - "internalType": "uint256", - "name": "_credits", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_bonding", - "type": "address" - }, - { - "internalType": "uint256", - "name": "_amount", - "type": "uint256" - } - ], - "name": "unbond", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_job", - "type": "address" - }, - { - "internalType": "address", - "name": "_liquidity", - "type": "address" - }, - { - "internalType": "uint256", - "name": "_amount", - "type": "uint256" - } - ], - "name": "unbondLiquidityFromJob", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [], - "name": "unbondTime", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_bonding", - "type": "address" - } - ], - "name": "withdraw", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_job", - "type": "address" - }, - { - "internalType": "address", - "name": "_liquidity", - "type": "address" - }, - { - "internalType": "address", - "name": "_receiver", - "type": "address" - } - ], - "name": "withdrawLiquidityFromJob", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_job", - "type": "address" - }, - { - "internalType": "address", - "name": "_token", - "type": "address" - }, - { - "internalType": "uint256", - "name": "_amount", - "type": "uint256" - }, - { - "internalType": "address", - "name": "_receiver", - "type": "address" - } - ], - "name": "withdrawTokenCreditsFromJob", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "name": "workCompleted", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_keeper", - "type": "address" - } - ], - "name": "worked", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "name": "workedAt", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - } - ], - "transactionHash": "0xbfc81543bf5b462a258b28d05a2336a064eb33bcefe27a6482317d1e276305d2", - "receipt": { - "to": null, - "from": "0x258b180E741157763236F5277619D71ECf00B906", - "contractAddress": "0x85063437C02Ba7F4f82F898859e4992380DEd3bb", - "transactionIndex": 36, - "gasUsed": "5474843", - "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", - "blockHash": "0x0b622992793b8b301839fe4c1f8beb8baf4d5980dbf7e7fb91c89342a347f780", - "transactionHash": "0xbfc81543bf5b462a258b28d05a2336a064eb33bcefe27a6482317d1e276305d2", - "logs": [], - "blockNumber": 8091007, - "cumulativeGasUsed": "9048487", - "status": 1, - "byzantium": true - }, - "args": [ - "0x258b180E741157763236F5277619D71ECf00B906", - "0x399394ca069dCDE2C4d2a32E00a06C3D5fE17E3A", - "0x16F63C5036d3F48A239358656a8f123eCE85789C", - "0x16F63C5036d3F48A239358656a8f123eCE85789C" - ], - "numDeployments": 5, - "solcInputHash": "0d224f905ebe4be6830f2d07ee9fcf58", - "metadata": "{\"compiler\":{\"version\":\"0.8.7+commit.e28d00a7\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_governance\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"_keep3rHelper\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"_keep3rV1\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"_keep3rV1Proxy\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"inputs\":[],\"name\":\"AlreadyAJob\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"AlreadyAKeeper\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"AlreadyDisputed\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"BondsLocked\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"BondsUnexistent\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"Disputed\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"DisputerExistent\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"DisputerUnexistent\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"GasNotInitialized\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"InsufficientFunds\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"InsufficientJobTokenCredits\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"JobAlreadyAdded\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"JobDisputed\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"JobLiquidityInsufficient\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"JobLiquidityLessThanMin\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"JobLiquidityUnexistent\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"JobMigrationImpossible\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"JobMigrationLocked\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"JobMigrationUnavailable\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"JobTokenCreditsLocked\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"JobTokenInsufficient\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"JobTokenUnexistent\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"JobUnapproved\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"JobUnavailable\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"LiquidityPairApproved\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"LiquidityPairUnapproved\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"LiquidityPairUnexistent\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"MinRewardPeriod\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"NoGovernanceZeroAddress\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"NotDisputed\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"OnlyDisputer\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"OnlyGovernance\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"OnlyJobOwner\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"OnlyPendingGovernance\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"OnlyPendingJobOwner\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"OnlySlasher\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"SlasherExistent\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"SlasherUnexistent\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"TokenUnallowed\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"UnbondsLocked\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"UnbondsUnexistent\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"ZeroAddress\",\"type\":\"error\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"_keeper\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"_bond\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"_amount\",\"type\":\"uint256\"}],\"name\":\"Activation\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"_bondTime\",\"type\":\"uint256\"}],\"name\":\"BondTimeChange\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"_keeper\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"_bonding\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"_amount\",\"type\":\"uint256\"}],\"name\":\"Bonding\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"_jobOrKeeper\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"_disputer\",\"type\":\"address\"}],\"name\":\"Dispute\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"_disputer\",\"type\":\"address\"}],\"name\":\"DisputerAdded\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"_disputer\",\"type\":\"address\"}],\"name\":\"DisputerRemoved\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"_token\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"_amount\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"_to\",\"type\":\"address\"}],\"name\":\"DustSent\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"_fee\",\"type\":\"uint256\"}],\"name\":\"FeeChange\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"_pendingGovernance\",\"type\":\"address\"}],\"name\":\"GovernanceProposal\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"_governance\",\"type\":\"address\"}],\"name\":\"GovernanceSet\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"_inflationPeriod\",\"type\":\"uint256\"}],\"name\":\"InflationPeriodChange\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"_job\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"_jobOwner\",\"type\":\"address\"}],\"name\":\"JobAddition\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"_fromJob\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"_toJob\",\"type\":\"address\"}],\"name\":\"JobMigrationRequested\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"_fromJob\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"_toJob\",\"type\":\"address\"}],\"name\":\"JobMigrationSuccessful\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"_job\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"_previousOwner\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"_newOwner\",\"type\":\"address\"}],\"name\":\"JobOwnershipAssent\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"_job\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"_owner\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"_pendingOwner\",\"type\":\"address\"}],\"name\":\"JobOwnershipChange\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"_job\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"_liquidity\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"_slasher\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"_amount\",\"type\":\"uint256\"}],\"name\":\"JobSlashLiquidity\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"_job\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"_token\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"_slasher\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"_amount\",\"type\":\"uint256\"}],\"name\":\"JobSlashToken\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"_keep3rHelper\",\"type\":\"address\"}],\"name\":\"Keep3rHelperChange\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"_keep3rV1\",\"type\":\"address\"}],\"name\":\"Keep3rV1Change\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"_keep3rV1Proxy\",\"type\":\"address\"}],\"name\":\"Keep3rV1ProxyChange\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"_keeper\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"_slasher\",\"type\":\"address\"}],\"name\":\"KeeperRevoke\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"_keeper\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"_slasher\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"_amount\",\"type\":\"uint256\"}],\"name\":\"KeeperSlash\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"_gasLeft\",\"type\":\"uint256\"}],\"name\":\"KeeperValidation\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"_credit\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"_job\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"_keeper\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"_payment\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"_gasLeft\",\"type\":\"uint256\"}],\"name\":\"KeeperWork\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"_job\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"_liquidity\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"_provider\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"_amount\",\"type\":\"uint256\"}],\"name\":\"LiquidityAddition\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"_liquidity\",\"type\":\"address\"}],\"name\":\"LiquidityApproval\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"_job\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"_rewardedAt\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"_currentCredits\",\"type\":\"uint256\"}],\"name\":\"LiquidityCreditsForced\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"_job\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"_rewardedAt\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"_currentCredits\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"_periodCredits\",\"type\":\"uint256\"}],\"name\":\"LiquidityCreditsReward\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"_liquidityMinimum\",\"type\":\"uint256\"}],\"name\":\"LiquidityMinimumChange\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"_liquidity\",\"type\":\"address\"}],\"name\":\"LiquidityRevocation\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"_job\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"_liquidity\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"_receiver\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"_amount\",\"type\":\"uint256\"}],\"name\":\"LiquidityWithdrawal\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"_jobOrKeeper\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"_resolver\",\"type\":\"address\"}],\"name\":\"Resolve\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"_rewardPeriodTime\",\"type\":\"uint256\"}],\"name\":\"RewardPeriodTimeChange\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"_slasher\",\"type\":\"address\"}],\"name\":\"SlasherAdded\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"_slasher\",\"type\":\"address\"}],\"name\":\"SlasherRemoved\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"_job\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"_token\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"_provider\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"_amount\",\"type\":\"uint256\"}],\"name\":\"TokenCreditAddition\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"_job\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"_token\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"_receiver\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"_amount\",\"type\":\"uint256\"}],\"name\":\"TokenCreditWithdrawal\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"_unbondTime\",\"type\":\"uint256\"}],\"name\":\"UnbondTimeChange\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"_keeperOrJob\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"_unbonding\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"_amount\",\"type\":\"uint256\"}],\"name\":\"Unbonding\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"_keeper\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"_bond\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"_amount\",\"type\":\"uint256\"}],\"name\":\"Withdrawal\",\"type\":\"event\"},{\"inputs\":[],\"name\":\"acceptGovernance\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_fromJob\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"_toJob\",\"type\":\"address\"}],\"name\":\"acceptJobMigration\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_job\",\"type\":\"address\"}],\"name\":\"acceptJobOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_bonding\",\"type\":\"address\"}],\"name\":\"activate\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_disputer\",\"type\":\"address\"}],\"name\":\"addDisputer\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_job\",\"type\":\"address\"}],\"name\":\"addJob\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_job\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"_liquidity\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"_amount\",\"type\":\"uint256\"}],\"name\":\"addLiquidityToJob\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_slasher\",\"type\":\"address\"}],\"name\":\"addSlasher\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_job\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"_token\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"_amount\",\"type\":\"uint256\"}],\"name\":\"addTokenCreditsToJob\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_liquidity\",\"type\":\"address\"}],\"name\":\"approveLiquidity\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"approvedLiquidities\",\"outputs\":[{\"internalType\":\"address[]\",\"name\":\"_list\",\"type\":\"address[]\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_bonding\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"_amount\",\"type\":\"uint256\"}],\"name\":\"bond\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"bondTime\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_keeper\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"_payment\",\"type\":\"uint256\"}],\"name\":\"bondedPayment\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"bonds\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"canActivateAfter\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"canWithdrawAfter\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_job\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"_newOwner\",\"type\":\"address\"}],\"name\":\"changeJobOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_token\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"_keeper\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"_amount\",\"type\":\"uint256\"}],\"name\":\"directTokenPayment\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_jobOrKeeper\",\"type\":\"address\"}],\"name\":\"dispute\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"disputers\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"disputes\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"fee\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"firstSeen\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_job\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"_amount\",\"type\":\"uint256\"}],\"name\":\"forceLiquidityCreditsToJob\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"governance\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"hasBonded\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"inflationPeriod\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_keeper\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"_bond\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"_minBond\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"_earned\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"_age\",\"type\":\"uint256\"}],\"name\":\"isBondedKeeper\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"_isBondedKeeper\",\"type\":\"bool\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_keeper\",\"type\":\"address\"}],\"name\":\"isKeeper\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"_isKeeper\",\"type\":\"bool\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_job\",\"type\":\"address\"}],\"name\":\"jobLiquidityCredits\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"_liquidityCredits\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"jobOwner\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"jobPendingOwner\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_job\",\"type\":\"address\"}],\"name\":\"jobPeriodCredits\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"_periodCredits\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"jobTokenCredits\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"jobTokenCreditsAddedAt\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"jobs\",\"outputs\":[{\"internalType\":\"address[]\",\"name\":\"_list\",\"type\":\"address[]\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"keep3rHelper\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"keep3rV1\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"keep3rV1Proxy\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"keepers\",\"outputs\":[{\"internalType\":\"address[]\",\"name\":\"_list\",\"type\":\"address[]\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"liquidityAmount\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"liquidityMinimum\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_fromJob\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"_toJob\",\"type\":\"address\"}],\"name\":\"migrateJob\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_liquidity\",\"type\":\"address\"}],\"name\":\"observeLiquidity\",\"outputs\":[{\"components\":[{\"internalType\":\"int56\",\"name\":\"current\",\"type\":\"int56\"},{\"internalType\":\"int56\",\"name\":\"difference\",\"type\":\"int56\"},{\"internalType\":\"uint256\",\"name\":\"period\",\"type\":\"uint256\"}],\"internalType\":\"struct IKeep3rJobFundableLiquidity.TickCache\",\"name\":\"_tickCache\",\"type\":\"tuple\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"pendingBonds\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"pendingGovernance\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"pendingJobMigrations\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"pendingUnbonds\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_liquidity\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"_amount\",\"type\":\"uint256\"}],\"name\":\"quoteLiquidity\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"_periodCredits\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_disputer\",\"type\":\"address\"}],\"name\":\"removeDisputer\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_slasher\",\"type\":\"address\"}],\"name\":\"removeSlasher\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_jobOrKeeper\",\"type\":\"address\"}],\"name\":\"resolve\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_keeper\",\"type\":\"address\"}],\"name\":\"revoke\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_liquidity\",\"type\":\"address\"}],\"name\":\"revokeLiquidity\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"rewardPeriodTime\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"rewardedAt\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_token\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"_amount\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"_to\",\"type\":\"address\"}],\"name\":\"sendDust\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_bondTime\",\"type\":\"uint256\"}],\"name\":\"setBondTime\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_fee\",\"type\":\"uint256\"}],\"name\":\"setFee\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_governance\",\"type\":\"address\"}],\"name\":\"setGovernance\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_inflationPeriod\",\"type\":\"uint256\"}],\"name\":\"setInflationPeriod\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_keep3rHelper\",\"type\":\"address\"}],\"name\":\"setKeep3rHelper\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_keep3rV1\",\"type\":\"address\"}],\"name\":\"setKeep3rV1\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_keep3rV1Proxy\",\"type\":\"address\"}],\"name\":\"setKeep3rV1Proxy\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_liquidityMinimum\",\"type\":\"uint256\"}],\"name\":\"setLiquidityMinimum\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_rewardPeriodTime\",\"type\":\"uint256\"}],\"name\":\"setRewardPeriodTime\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_unbondTime\",\"type\":\"uint256\"}],\"name\":\"setUnbondTime\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_keeper\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"_bonded\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"_bondAmount\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"_unbondAmount\",\"type\":\"uint256\"}],\"name\":\"slash\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_job\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"_liquidity\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"_amount\",\"type\":\"uint256\"}],\"name\":\"slashLiquidityFromJob\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_job\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"_token\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"_amount\",\"type\":\"uint256\"}],\"name\":\"slashTokenFromJob\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"slashers\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"totalBonds\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_job\",\"type\":\"address\"}],\"name\":\"totalJobCredits\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"_credits\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_bonding\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"_amount\",\"type\":\"uint256\"}],\"name\":\"unbond\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_job\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"_liquidity\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"_amount\",\"type\":\"uint256\"}],\"name\":\"unbondLiquidityFromJob\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"unbondTime\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_bonding\",\"type\":\"address\"}],\"name\":\"withdraw\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_job\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"_liquidity\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"_receiver\",\"type\":\"address\"}],\"name\":\"withdrawLiquidityFromJob\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_job\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"_token\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"_amount\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"_receiver\",\"type\":\"address\"}],\"name\":\"withdrawTokenCreditsFromJob\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"workCompleted\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_keeper\",\"type\":\"address\"}],\"name\":\"worked\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"workedAt\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"}],\"devdoc\":{\"kind\":\"dev\",\"methods\":{\"acceptJobMigration(address,address)\":{\"details\":\"Unbond/withdraw process doesn't get migrated\",\"params\":{\"_fromJob\":\"The address of the job that requested to migrate\",\"_toJob\":\"The address to which the job wants to migrate to\"}},\"acceptJobOwnership(address)\":{\"params\":{\"_job\":\"The address of the job\"}},\"activate(address)\":{\"params\":{\"_bonding\":\"The asset being activated as bond collateral\"}},\"addJob(address)\":{\"params\":{\"_job\":\"Address of the contract for which work should be performed\"}},\"addLiquidityToJob(address,address,uint256)\":{\"params\":{\"_amount\":\"The amount of liquidity tokens to add\",\"_job\":\"The address of the job to assign liquidity to\",\"_liquidity\":\"The liquidity being added\"}},\"addTokenCreditsToJob(address,address,uint256)\":{\"params\":{\"_amount\":\"The amount of credit being added\",\"_job\":\"The address of the job being credited\",\"_token\":\"The address of the token being credited\"}},\"approveLiquidity(address)\":{\"params\":{\"_liquidity\":\"The address of the liquidity accepted\"}},\"approvedLiquidities()\":{\"returns\":{\"_list\":\"An array of addresses with all the approved liquidity pairs\"}},\"bond(address,uint256)\":{\"params\":{\"_amount\":\"The amount of bonding asset being bonded\",\"_bonding\":\"The asset being bonded\"}},\"bondedPayment(address,uint256)\":{\"details\":\"Pays the keeper that performs the work with KP3R\",\"params\":{\"_keeper\":\"Address of the keeper that performed the work\",\"_payment\":\"The reward that should be allocated for the job\"}},\"changeJobOwnership(address,address)\":{\"params\":{\"_job\":\"The address of the job\",\"_newOwner\":\"The address of the proposed new owner\"}},\"directTokenPayment(address,address,uint256)\":{\"details\":\"Pays the keeper that performs the work with a specific token\",\"params\":{\"_amount\":\"The reward that should be allocated\",\"_keeper\":\"Address of the keeper that performed the work\",\"_token\":\"The asset being awarded to the keeper\"}},\"dispute(address)\":{\"params\":{\"_jobOrKeeper\":\"The address in dispute\"}},\"forceLiquidityCreditsToJob(address,uint256)\":{\"params\":{\"_amount\":\"The amount of liquidity credits to gift\",\"_job\":\"The address of the job being credited\"}},\"isBondedKeeper(address,address,uint256,uint256,uint256)\":{\"details\":\"Should be used for protected functions\",\"params\":{\"_age\":\"The minimum keeper age required\",\"_bond\":\"The bond token being evaluated\",\"_earned\":\"The minimum funds earned in the keepers lifetime\",\"_keeper\":\"The keeper to check\",\"_minBond\":\"The minimum amount of bonded tokens\"},\"returns\":{\"_isBondedKeeper\":\"Whether the `_keeper` meets the given requirements\"}},\"isKeeper(address)\":{\"details\":\"Can be used for general (non critical) functions\",\"params\":{\"_keeper\":\"The keeper being investigated\"},\"returns\":{\"_isKeeper\":\"Whether the address passed as a parameter is a keeper or not\"}},\"jobLiquidityCredits(address)\":{\"params\":{\"_job\":\"The address of the job of which we want to know the liquidity credits\"},\"returns\":{\"_liquidityCredits\":\"The liquidity credits of a given job\"}},\"jobPeriodCredits(address)\":{\"params\":{\"_job\":\"The address of the job of which we want to know the period credits\"},\"returns\":{\"_periodCredits\":\"The credits the given job has at the current period\"}},\"jobs()\":{\"returns\":{\"_list\":\"Array with all the jobs in _jobs\"}},\"keepers()\":{\"returns\":{\"_list\":\"Array with all the keepers in _keepers\"}},\"migrateJob(address,address)\":{\"params\":{\"_fromJob\":\"The address of the job that is requesting to migrate\",\"_toJob\":\"The address at which the job is requesting to migrate\"}},\"observeLiquidity(address)\":{\"params\":{\"_liquidity\":\"The address of the liquidity pair being observed\"},\"returns\":{\"_tickCache\":\"The updated TickCache\"}},\"quoteLiquidity(address,uint256)\":{\"details\":\"_periodCredits = underlying KP3Rs for given liquidity amount * rewardPeriod / inflationPeriod\",\"params\":{\"_amount\":\"The amount of liquidity to provide\",\"_liquidity\":\"The address of the liquidity to provide\"},\"returns\":{\"_periodCredits\":\"The amount of KP3R periodically minted for the given liquidity\"}},\"resolve(address)\":{\"params\":{\"_jobOrKeeper\":\"The address cleared\"}},\"revoke(address)\":{\"params\":{\"_keeper\":\"The address being slashed\"}},\"revokeLiquidity(address)\":{\"params\":{\"_liquidity\":\"The liquidity no longer accepted\"}},\"sendDust(address,uint256,address)\":{\"params\":{\"_amount\":\"The amount of the token that will be transferred\",\"_to\":\"The address that will receive the idle funds\",\"_token\":\"The token that will be transferred\"}},\"setBondTime(uint256)\":{\"params\":{\"_bond\":\"The new bond time\"}},\"setFee(uint256)\":{\"params\":{\"_fee\":\"The new fee\"}},\"setGovernance(address)\":{\"params\":{\"_governance\":\"The address being proposed as the new governance\"}},\"setInflationPeriod(uint256)\":{\"params\":{\"_inflationPeriod\":\"The new inflation period\"}},\"setKeep3rHelper(address)\":{\"params\":{\"_keep3rHelper\":\"The Keep3rHelper address\"}},\"setKeep3rV1(address)\":{\"params\":{\"_keep3rV1\":\"The Keep3rV1 address\"}},\"setKeep3rV1Proxy(address)\":{\"params\":{\"_keep3rV1Proxy\":\"The Keep3rV1Proxy address\"}},\"setLiquidityMinimum(uint256)\":{\"params\":{\"_liquidityMinimum\":\"The new minimum amount of liquidity\"}},\"setRewardPeriodTime(uint256)\":{\"params\":{\"_rewardPeriodTime\":\"The new amount of time required to pass between rewards\"}},\"setUnbondTime(uint256)\":{\"params\":{\"_unbond\":\"The new unbond time\"}},\"slash(address,address,uint256,uint256)\":{\"params\":{\"_bondAmount\":\"The bonded amount being slashed\",\"_bonded\":\"The asset being slashed\",\"_keeper\":\"The address being slashed\",\"_unbondAmount\":\"The pending unbond amount being slashed\"}},\"slashLiquidityFromJob(address,address,uint256)\":{\"params\":{\"_amount\":\"The amount of liquidity that will be slashed\",\"_job\":\"The address being slashed\",\"_liquidity\":\"The address of the liquidity that will be slashed\"}},\"slashTokenFromJob(address,address,uint256)\":{\"params\":{\"_amount\":\"The amount of the token that will be slashed\",\"_job\":\"The address of the job from which the token will be slashed\",\"_token\":\"The address of the token that will be slashed\"}},\"totalJobCredits(address)\":{\"params\":{\"_job\":\"The address of the job of which we want to know the total credits\"},\"returns\":{\"_credits\":\"The total credits of the given job\"}},\"unbond(address,uint256)\":{\"params\":{\"_amount\":\"Allows for partial unbonding\",\"_bonding\":\"The asset being unbonded\"}},\"unbondLiquidityFromJob(address,address,uint256)\":{\"details\":\"Can only be called by the job's owner\",\"params\":{\"_amount\":\"The amount of liquidity being removed\",\"_job\":\"The address of the job being unbonded from\",\"_liquidity\":\"The liquidity being unbonded\"}},\"withdraw(address)\":{\"params\":{\"_bonding\":\"The asset to withdraw from the bonding pool\"}},\"withdrawLiquidityFromJob(address,address,address)\":{\"params\":{\"_job\":\"The address of the job being withdrawn from\",\"_liquidity\":\"The liquidity being withdrawn\",\"_receiver\":\"The address that will receive the withdrawn liquidity\"}},\"withdrawTokenCreditsFromJob(address,address,uint256,address)\":{\"params\":{\"_amount\":\"The amount of token to be withdrawn\",\"_job\":\"The address of the job from which the credits are withdrawn\",\"_receiver\":\"The user that will receive tokens\",\"_token\":\"The address of the token being withdrawn\"}},\"worked(address)\":{\"details\":\"Automatically calculates the payment for the keeper and pays the keeper with bonded KP3R\",\"params\":{\"_keeper\":\"Address of the keeper that performed the work\"}}},\"version\":1},\"userdoc\":{\"errors\":{\"AlreadyAJob()\":[{\"notice\":\"Throws when the address that is trying to register as a job is already a job\"}],\"AlreadyAKeeper()\":[{\"notice\":\"Throws when the address that is trying to register as a keeper is already a keeper\"}],\"AlreadyDisputed()\":[{\"notice\":\"Throws when a job or keeper is already disputed\"}],\"BondsLocked()\":[{\"notice\":\"Throws if the time required to bond an asset has not passed yet\"}],\"BondsUnexistent()\":[{\"notice\":\"Throws if there are no bonded assets\"}],\"Disputed()\":[{\"notice\":\"Throws if either a job or a keeper is disputed\"}],\"DisputerExistent()\":[{\"notice\":\"Throws if the address is already a registered disputer\"}],\"DisputerUnexistent()\":[{\"notice\":\"Throws if caller is not a registered disputer\"}],\"GasNotInitialized()\":[{\"notice\":\"Throws if work method was called without calling isKeeper or isBondedKeeper\"}],\"InsufficientFunds()\":[{\"notice\":\"Throws if the amount of funds in the job is less than the payment that must be paid to the keeper that works that job\"}],\"InsufficientJobTokenCredits()\":[{\"notice\":\"Throws when the user tries to withdraw more tokens than it has\"}],\"JobAlreadyAdded()\":[{\"notice\":\"Throws when trying to add a job that has already been added\"}],\"JobDisputed()\":[{\"notice\":\"Throws when an action that requires an undisputed job is applied on a disputed job\"}],\"JobLiquidityInsufficient()\":[{\"notice\":\"Throws when trying to remove more liquidity than the job has\"}],\"JobLiquidityLessThanMin()\":[{\"notice\":\"Throws when trying to add less liquidity than the minimum liquidity required\"}],\"JobLiquidityUnexistent()\":[{\"notice\":\"Throws when the job doesn't have the requested liquidity\"}],\"JobMigrationImpossible()\":[{\"notice\":\"Throws when the address of the job that requests to migrate wants to migrate to its same address\"}],\"JobMigrationLocked()\":[{\"notice\":\"Throws when cooldown between migrations has not yet passed\"}],\"JobMigrationUnavailable()\":[{\"notice\":\"Throws when the _toJob address differs from the address being tracked in the pendingJobMigrations mapping\"}],\"JobTokenCreditsLocked()\":[{\"notice\":\"Throws when the token withdraw cooldown has not yet passed\"}],\"JobTokenInsufficient()\":[{\"notice\":\"Throws when someone tries to slash more tokens than the job has\"}],\"JobTokenUnexistent()\":[{\"notice\":\"Throws when the token trying to be slashed doesn't exist\"}],\"JobUnapproved()\":[{\"notice\":\"Throws if the address claiming to be a job is not in the list of approved jobs\"}],\"JobUnavailable()\":[{\"notice\":\"Throws when an address is passed as a job, but that address is not a job\"}],\"LiquidityPairApproved()\":[{\"notice\":\"Throws when the liquidity being approved has already been approved\"}],\"LiquidityPairUnapproved()\":[{\"notice\":\"Throws when trying to add liquidity to an unapproved pool\"}],\"LiquidityPairUnexistent()\":[{\"notice\":\"Throws when the liquidity being removed has not been approved\"}],\"MinRewardPeriod()\":[{\"notice\":\"Throws if the reward period is less than the minimum reward period time\"}],\"NoGovernanceZeroAddress()\":[{\"notice\":\"Throws if trying to set governance to zero address\"}],\"NotDisputed()\":[{\"notice\":\"Throws when a job or keeper is not disputed and someone tries to resolve the dispute\"}],\"OnlyDisputer()\":[{\"notice\":\"Throws if the msg.sender is not a disputer or is not a part of governance\"}],\"OnlyGovernance()\":[{\"notice\":\"Throws if the caller of the function is not governance\"}],\"OnlyJobOwner()\":[{\"notice\":\"Throws when the caller of the function is not the job owner\"}],\"OnlyPendingGovernance()\":[{\"notice\":\"Throws if the caller of the function is not pendingGovernance\"}],\"OnlyPendingJobOwner()\":[{\"notice\":\"Throws when the caller of the function is not the pending job owner\"}],\"OnlySlasher()\":[{\"notice\":\"Throws if the msg.sender is not a slasher or is not a part of governance\"}],\"SlasherExistent()\":[{\"notice\":\"Throws if the address is already a registered slasher\"}],\"SlasherUnexistent()\":[{\"notice\":\"Throws if caller is not a registered slasher\"}],\"TokenUnallowed()\":[{\"notice\":\"Throws when the token is KP3R, as it should not be used for direct token payments\"}],\"UnbondsLocked()\":[{\"notice\":\"Throws if the time required to withdraw the bonds has not passed yet\"}],\"UnbondsUnexistent()\":[{\"notice\":\"Throws if there are no bonds to withdraw\"}],\"ZeroAddress()\":[{\"notice\":\"Throws if a variable is assigned to the zero address\"}]},\"events\":{\"Activation(address,address,uint256)\":{\"notice\":\"Emitted when Keep3rKeeperFundable#activate is called\"},\"BondTimeChange(uint256)\":{\"notice\":\"Emitted when bondTime is changed\"},\"Bonding(address,address,uint256)\":{\"notice\":\"Emitted when the bonding process of a new keeper begins\"},\"Dispute(address,address)\":{\"notice\":\"Emitted when a keeper or a job is disputed\"},\"DisputerAdded(address)\":{\"notice\":\"Emitted when a disputer is added\"},\"DisputerRemoved(address)\":{\"notice\":\"Emitted when a disputer is removed\"},\"DustSent(address,uint256,address)\":{\"notice\":\"Emitted when dust is sent\"},\"FeeChange(uint256)\":{\"notice\":\"Emitted when the fee is changed\"},\"GovernanceProposal(address)\":{\"notice\":\"Emitted when a new governance is proposed\"},\"GovernanceSet(address)\":{\"notice\":\"Emitted when pendingGovernance accepts to be governance\"},\"InflationPeriodChange(uint256)\":{\"notice\":\"Emitted when the inflationPeriod is changed\"},\"JobAddition(address,address)\":{\"notice\":\"Emitted when Keep3rJobManager#addJob is called\"},\"JobMigrationRequested(address,address)\":{\"notice\":\"Emitted when Keep3rJobMigration#migrateJob function is called\"},\"JobMigrationSuccessful(address,address)\":{\"notice\":\"Emitted when Keep3rJobMigration#acceptJobMigration function is called\"},\"JobOwnershipAssent(address,address,address)\":{\"notice\":\"Emitted when Keep3rJobOwnership#JobOwnershipAssent is called\"},\"JobOwnershipChange(address,address,address)\":{\"notice\":\"Emitted when Keep3rJobOwnership#changeJobOwnership is called\"},\"JobSlashLiquidity(address,address,address,uint256)\":{\"notice\":\"Emitted when Keep3rJobDisputable#slashLiquidityFromJob is called\"},\"JobSlashToken(address,address,address,uint256)\":{\"notice\":\"Emitted when Keep3rJobDisputable#slashTokenFromJob is called\"},\"Keep3rHelperChange(address)\":{\"notice\":\"Emitted when the Keep3rHelper address is changed\"},\"Keep3rV1Change(address)\":{\"notice\":\"Emitted when the Keep3rV1 address is changed\"},\"Keep3rV1ProxyChange(address)\":{\"notice\":\"Emitted when the Keep3rV1Proxy address is changed\"},\"KeeperRevoke(address,address)\":{\"notice\":\"Emitted when Keep3rKeeperDisputable#revoke is called\"},\"KeeperSlash(address,address,uint256)\":{\"notice\":\"Emitted when Keep3rKeeperDisputable#slash is called\"},\"KeeperValidation(uint256)\":{\"notice\":\"Emitted when a keeper is validated before a job\"},\"KeeperWork(address,address,address,uint256,uint256)\":{\"notice\":\"Emitted when a keeper works a job\"},\"LiquidityAddition(address,address,address,uint256)\":{\"notice\":\"Emitted when IKeep3rJobFundableLiquidity#addLiquidityToJob function is called\"},\"LiquidityApproval(address)\":{\"notice\":\"Emitted when Keep3rJobFundableLiquidity#approveLiquidity function is called\"},\"LiquidityCreditsForced(address,uint256,uint256)\":{\"notice\":\"Emitted when Keep3rJobFundableLiquidity#forceLiquidityCreditsToJob function is called\"},\"LiquidityCreditsReward(address,uint256,uint256,uint256)\":{\"notice\":\"Emitted when Keep3rJobFundableLiquidity#addLiquidityToJob function is called\"},\"LiquidityMinimumChange(uint256)\":{\"notice\":\"Emitted when _liquidityMinimum is changed\"},\"LiquidityRevocation(address)\":{\"notice\":\"Emitted when Keep3rJobFundableLiquidity#revokeLiquidity function is called\"},\"LiquidityWithdrawal(address,address,address,uint256)\":{\"notice\":\"Emitted when IKeep3rJobFundableLiquidity#withdrawLiquidityFromJob function is called\"},\"Resolve(address,address)\":{\"notice\":\"Emitted when a dispute is resolved\"},\"RewardPeriodTimeChange(uint256)\":{\"notice\":\"Emitted when _rewardPeriodTime is changed\"},\"SlasherAdded(address)\":{\"notice\":\"Emitted when a slasher is added\"},\"SlasherRemoved(address)\":{\"notice\":\"Emitted when a slasher is removed\"},\"TokenCreditAddition(address,address,address,uint256)\":{\"notice\":\"Emitted when Keep3rJobFundableCredits#addTokenCreditsToJob is called\"},\"TokenCreditWithdrawal(address,address,address,uint256)\":{\"notice\":\"Emitted when Keep3rJobFundableCredits#withdrawTokenCreditsFromJob is called\"},\"UnbondTimeChange(uint256)\":{\"notice\":\"Emitted when _unbondTime is changed\"},\"Unbonding(address,address,uint256)\":{\"notice\":\"Emitted when a keeper or job begins the unbonding process to withdraw the funds\"},\"Withdrawal(address,address,uint256)\":{\"notice\":\"Emitted when Keep3rKeeperFundable#withdraw is called\"}},\"kind\":\"user\",\"methods\":{\"acceptGovernance()\":{\"notice\":\"Changes the governance from the current governance to the previously proposed address\"},\"acceptJobMigration(address,address)\":{\"notice\":\"Completes the migration process for a job\"},\"acceptJobOwnership(address)\":{\"notice\":\"The proposed address accepts to be the owner of the job\"},\"activate(address)\":{\"notice\":\"End of the bonding process after bonding time has passed\"},\"addDisputer(address)\":{\"notice\":\"Registers a disputer by updating the disputers mapping\"},\"addJob(address)\":{\"notice\":\"Allows any caller to add a new job\"},\"addLiquidityToJob(address,address,uint256)\":{\"notice\":\"Allows anyone to fund a job with liquidity\"},\"addSlasher(address)\":{\"notice\":\"Registers a slasher by updating the slashers mapping\"},\"addTokenCreditsToJob(address,address,uint256)\":{\"notice\":\"Add credit to a job to be paid out for work\"},\"approveLiquidity(address)\":{\"notice\":\"Approve a liquidity pair for being accepted in future\"},\"approvedLiquidities()\":{\"notice\":\"Lists liquidity pairs\"},\"bond(address,uint256)\":{\"notice\":\"Beginning of the bonding process\"},\"bondTime()\":{\"notice\":\"The amount of time required to pass after a keeper has bonded assets for it to be able to activate\"},\"bondedPayment(address,uint256)\":{\"notice\":\"Implemented by jobs to show that a keeper performed work\"},\"bonds(address,address)\":{\"notice\":\"Mapping (job => bonding => amount)\"},\"canActivateAfter(address,address)\":{\"notice\":\"Tracks when a bonding for a keeper can be activated\"},\"canWithdrawAfter(address,address)\":{\"notice\":\"Tracks when keeper bonds are ready to be withdrawn\"},\"changeJobOwnership(address,address)\":{\"notice\":\"Proposes a new address to be the owner of the job\"},\"directTokenPayment(address,address,uint256)\":{\"notice\":\"Implemented by jobs to show that a keeper performed work\"},\"dispute(address)\":{\"notice\":\"Allows governance to create a dispute for a given keeper/job\"},\"disputers(address)\":{\"notice\":\"Tracks whether the address is a disputer or not\"},\"disputes(address)\":{\"notice\":\"Tracks if a keeper or job has a pending dispute\"},\"fee()\":{\"notice\":\"The fee to be sent to governance when a user adds liquidity to a job\"},\"firstSeen(address)\":{\"notice\":\"Tracks when a keeper was first registered\"},\"forceLiquidityCreditsToJob(address,uint256)\":{\"notice\":\"Gifts liquidity credits to the specified job\"},\"governance()\":{\"notice\":\"Stores the governance address\"},\"hasBonded(address)\":{\"notice\":\"Checks whether the address has ever bonded an asset\"},\"inflationPeriod()\":{\"notice\":\"The inflation period is the denominator used to regulate the emission of KP3R\"},\"isBondedKeeper(address,address,uint256,uint256,uint256)\":{\"notice\":\"Confirms if the current keeper is registered and has a minimum bond of any asset.\"},\"isKeeper(address)\":{\"notice\":\"Confirms if the current keeper is registered\"},\"jobLiquidityCredits(address)\":{\"notice\":\"Returns the liquidity credits of a given job\"},\"jobOwner(address)\":{\"notice\":\"Maps the job to the owner of the job\"},\"jobPendingOwner(address)\":{\"notice\":\"Maps the job to its pending owner\"},\"jobPeriodCredits(address)\":{\"notice\":\"Returns the credits of a given job for the current period\"},\"jobTokenCredits(address,address)\":{\"notice\":\"The current token credits available for a job\"},\"jobTokenCreditsAddedAt(address,address)\":{\"notice\":\"Last block where tokens were added to the job\"},\"jobs()\":{\"notice\":\"Lists all jobs\"},\"keep3rHelper()\":{\"notice\":\"Address of Keep3rHelper's contract\"},\"keep3rV1()\":{\"notice\":\"Address of Keep3rV1's contract\"},\"keep3rV1Proxy()\":{\"notice\":\"Address of Keep3rV1Proxy's contract\"},\"keepers()\":{\"notice\":\"Lists all keepers\"},\"liquidityAmount(address,address)\":{\"notice\":\"Amount of liquidity in a specified job\"},\"liquidityMinimum()\":{\"notice\":\"The minimum amount of liquidity required to fund a job per liquidity\"},\"migrateJob(address,address)\":{\"notice\":\"Initializes the migration process for a job by adding the request to the pendingJobMigrations mapping\"},\"observeLiquidity(address)\":{\"notice\":\"Observes the current state of the liquidity pair being observed and updates TickCache with the information\"},\"pendingBonds(address,address)\":{\"notice\":\"Tracks the amount of assets deposited in pending bonds\"},\"pendingGovernance()\":{\"notice\":\"Stores the pendingGovernance address\"},\"pendingJobMigrations(address)\":{\"notice\":\"Maps the jobs that have requested a migration to the address they have requested to migrate to\"},\"pendingUnbonds(address,address)\":{\"notice\":\"Tracks how much keeper bonds are to be withdrawn\"},\"quoteLiquidity(address,uint256)\":{\"notice\":\"Calculates how many credits should be rewarded periodically for a given liquidity amount\"},\"removeDisputer(address)\":{\"notice\":\"Removes a disputer by updating the disputers mapping\"},\"removeSlasher(address)\":{\"notice\":\"Removes a slasher by updating the slashers mapping\"},\"resolve(address)\":{\"notice\":\"Allows governance to resolve a dispute on a keeper/job\"},\"revoke(address)\":{\"notice\":\"Blacklists a keeper from participating in the network\"},\"revokeLiquidity(address)\":{\"notice\":\"Revoke a liquidity pair from being accepted in future\"},\"rewardPeriodTime()\":{\"notice\":\"The amount of time between each scheduled credits reward given to a job\"},\"rewardedAt(address)\":{\"notice\":\"Last time the job was rewarded liquidity credits\"},\"sendDust(address,uint256,address)\":{\"notice\":\"Allows an authorized user to transfer the tokens or eth that may have been left in a contract\"},\"setBondTime(uint256)\":{\"notice\":\"Sets the bond time required to activate as a keeper\"},\"setFee(uint256)\":{\"notice\":\"Sets the new fee\"},\"setGovernance(address)\":{\"notice\":\"Proposes a new address to be governance\"},\"setInflationPeriod(uint256)\":{\"notice\":\"Sets the new inflation period\"},\"setKeep3rHelper(address)\":{\"notice\":\"Sets the Keep3rHelper address\"},\"setKeep3rV1(address)\":{\"notice\":\"Sets the Keep3rV1 address\"},\"setKeep3rV1Proxy(address)\":{\"notice\":\"Sets the Keep3rV1Proxy address\"},\"setLiquidityMinimum(uint256)\":{\"notice\":\"Sets the minimum amount of liquidity required to fund a job\"},\"setRewardPeriodTime(uint256)\":{\"notice\":\"Sets the time required to pass between rewards for jobs\"},\"setUnbondTime(uint256)\":{\"notice\":\"Sets the unbond time required unbond what has been bonded\"},\"slash(address,address,uint256,uint256)\":{\"notice\":\"Allows governance to slash a keeper based on a dispute\"},\"slashLiquidityFromJob(address,address,uint256)\":{\"notice\":\"Allows governance or a slasher to slash liquidity from a job\"},\"slashTokenFromJob(address,address,uint256)\":{\"notice\":\"Allows governance or slasher to slash a job specific token\"},\"slashers(address)\":{\"notice\":\"Tracks whether the address is a slasher or not\"},\"totalBonds()\":{\"notice\":\"Tracks the total amount of bonded KP3Rs in the contract\"},\"totalJobCredits(address)\":{\"notice\":\"Calculates the total credits of a given job\"},\"unbond(address,uint256)\":{\"notice\":\"Beginning of the unbonding process\"},\"unbondLiquidityFromJob(address,address,uint256)\":{\"notice\":\"Unbond liquidity for a job\"},\"unbondTime()\":{\"notice\":\"The amount of time required to pass before a keeper can unbond what he has bonded\"},\"withdraw(address)\":{\"notice\":\"Withdraw funds after unbonding has finished\"},\"withdrawLiquidityFromJob(address,address,address)\":{\"notice\":\"Withdraw liquidity from a job\"},\"withdrawTokenCreditsFromJob(address,address,uint256,address)\":{\"notice\":\"Withdraw credit from a job\"},\"workCompleted(address)\":{\"notice\":\"Tracks the total KP3R earnings of a keeper since it started working\"},\"worked(address)\":{\"notice\":\"Implemented by jobs to show that a keeper performed work\"},\"workedAt(address)\":{\"notice\":\"Last time the job was worked\"}},\"version\":1}},\"settings\":{\"compilationTarget\":{\"solidity/for-test/testnet/Keep3rForTestnet.sol\":\"Keep3rForTestnet\"},\"evmVersion\":\"london\",\"libraries\":{\":__CACHE_BREAKER__\":\"0x00000000d41867734bbee4c6863d9255b2b06ac1\"},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":33},\"remappings\":[]},\"sources\":{\"@openzeppelin/contracts/security/ReentrancyGuard.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Contract module that helps prevent reentrant calls to a function.\\n *\\n * Inheriting from `ReentrancyGuard` will make the {nonReentrant} modifier\\n * available, which can be applied to functions to make sure there are no nested\\n * (reentrant) calls to them.\\n *\\n * Note that because there is a single `nonReentrant` guard, functions marked as\\n * `nonReentrant` may not call one another. This can be worked around by making\\n * those functions `private`, and then adding `external` `nonReentrant` entry\\n * points to them.\\n *\\n * TIP: If you would like to learn more about reentrancy and alternative ways\\n * to protect against it, check out our blog post\\n * https://blog.openzeppelin.com/reentrancy-after-istanbul/[Reentrancy After Istanbul].\\n */\\nabstract contract ReentrancyGuard {\\n // Booleans are more expensive than uint256 or any type that takes up a full\\n // word because each write operation emits an extra SLOAD to first read the\\n // slot's contents, replace the bits taken up by the boolean, and then write\\n // back. This is the compiler's defense against contract upgrades and\\n // pointer aliasing, and it cannot be disabled.\\n\\n // The values being non-zero value makes deployment a bit more expensive,\\n // but in exchange the refund on every call to nonReentrant will be lower in\\n // amount. Since refunds are capped to a percentage of the total\\n // transaction's gas, it is best to keep them low in cases like this one, to\\n // increase the likelihood of the full refund coming into effect.\\n uint256 private constant _NOT_ENTERED = 1;\\n uint256 private constant _ENTERED = 2;\\n\\n uint256 private _status;\\n\\n constructor() {\\n _status = _NOT_ENTERED;\\n }\\n\\n /**\\n * @dev Prevents a contract from calling itself, directly or indirectly.\\n * Calling a `nonReentrant` function from another `nonReentrant`\\n * function is not supported. It is possible to prevent this from happening\\n * by making the `nonReentrant` function external, and make it call a\\n * `private` function that does the actual work.\\n */\\n modifier nonReentrant() {\\n // On the first call to nonReentrant, _notEntered will be true\\n require(_status != _ENTERED, \\\"ReentrancyGuard: reentrant call\\\");\\n\\n // Any calls to nonReentrant after this point will fail\\n _status = _ENTERED;\\n\\n _;\\n\\n // By storing the original value once again, a refund is triggered (see\\n // https://eips.ethereum.org/EIPS/eip-2200)\\n _status = _NOT_ENTERED;\\n }\\n}\\n\",\"keccak256\":\"0x842ccf9a6cd33e17b7acef8372ca42090755217b358fe0c44c98e951ea549d3a\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC20/IERC20.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Interface of the ERC20 standard as defined in the EIP.\\n */\\ninterface IERC20 {\\n /**\\n * @dev Returns the amount of tokens in existence.\\n */\\n function totalSupply() external view returns (uint256);\\n\\n /**\\n * @dev Returns the amount of tokens owned by `account`.\\n */\\n function balanceOf(address account) external view returns (uint256);\\n\\n /**\\n * @dev Moves `amount` tokens from the caller's account to `recipient`.\\n *\\n * Returns a boolean value indicating whether the operation succeeded.\\n *\\n * Emits a {Transfer} event.\\n */\\n function transfer(address recipient, uint256 amount) external returns (bool);\\n\\n /**\\n * @dev Returns the remaining number of tokens that `spender` will be\\n * allowed to spend on behalf of `owner` through {transferFrom}. This is\\n * zero by default.\\n *\\n * This value changes when {approve} or {transferFrom} are called.\\n */\\n function allowance(address owner, address spender) external view returns (uint256);\\n\\n /**\\n * @dev Sets `amount` as the allowance of `spender` over the caller's tokens.\\n *\\n * Returns a boolean value indicating whether the operation succeeded.\\n *\\n * IMPORTANT: Beware that changing an allowance with this method brings the risk\\n * that someone may use both the old and the new allowance by unfortunate\\n * transaction ordering. One possible solution to mitigate this race\\n * condition is to first reduce the spender's allowance to 0 and set the\\n * desired value afterwards:\\n * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729\\n *\\n * Emits an {Approval} event.\\n */\\n function approve(address spender, uint256 amount) external returns (bool);\\n\\n /**\\n * @dev Moves `amount` tokens from `sender` to `recipient` using the\\n * allowance mechanism. `amount` is then deducted from the caller's\\n * allowance.\\n *\\n * Returns a boolean value indicating whether the operation succeeded.\\n *\\n * Emits a {Transfer} event.\\n */\\n function transferFrom(\\n address sender,\\n address recipient,\\n uint256 amount\\n ) external returns (bool);\\n\\n /**\\n * @dev Emitted when `value` tokens are moved from one account (`from`) to\\n * another (`to`).\\n *\\n * Note that `value` may be zero.\\n */\\n event Transfer(address indexed from, address indexed to, uint256 value);\\n\\n /**\\n * @dev Emitted when the allowance of a `spender` for an `owner` is set by\\n * a call to {approve}. `value` is the new allowance.\\n */\\n event Approval(address indexed owner, address indexed spender, uint256 value);\\n}\\n\",\"keccak256\":\"0x027b891937d20ccf213fdb9c31531574256de774bda99d3a70ecef6e1913ed2a\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../IERC20.sol\\\";\\n\\n/**\\n * @dev Interface for the optional metadata functions from the ERC20 standard.\\n *\\n * _Available since v4.1._\\n */\\ninterface IERC20Metadata is IERC20 {\\n /**\\n * @dev Returns the name of the token.\\n */\\n function name() external view returns (string memory);\\n\\n /**\\n * @dev Returns the symbol of the token.\\n */\\n function symbol() external view returns (string memory);\\n\\n /**\\n * @dev Returns the decimals places of the token.\\n */\\n function decimals() external view returns (uint8);\\n}\\n\",\"keccak256\":\"0x83fe24f5c04a56091e50f4a345ff504c8bff658a76d4c43b16878c8f940c53b2\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../IERC20.sol\\\";\\nimport \\\"../../../utils/Address.sol\\\";\\n\\n/**\\n * @title SafeERC20\\n * @dev Wrappers around ERC20 operations that throw on failure (when the token\\n * contract returns false). Tokens that return no value (and instead revert or\\n * throw on failure) are also supported, non-reverting calls are assumed to be\\n * successful.\\n * To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract,\\n * which allows you to call the safe operations as `token.safeTransfer(...)`, etc.\\n */\\nlibrary SafeERC20 {\\n using Address for address;\\n\\n function safeTransfer(\\n IERC20 token,\\n address to,\\n uint256 value\\n ) internal {\\n _callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value));\\n }\\n\\n function safeTransferFrom(\\n IERC20 token,\\n address from,\\n address to,\\n uint256 value\\n ) internal {\\n _callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value));\\n }\\n\\n /**\\n * @dev Deprecated. This function has issues similar to the ones found in\\n * {IERC20-approve}, and its usage is discouraged.\\n *\\n * Whenever possible, use {safeIncreaseAllowance} and\\n * {safeDecreaseAllowance} instead.\\n */\\n function safeApprove(\\n IERC20 token,\\n address spender,\\n uint256 value\\n ) internal {\\n // safeApprove should only be called when setting an initial allowance,\\n // or when resetting it to zero. To increase and decrease it, use\\n // 'safeIncreaseAllowance' and 'safeDecreaseAllowance'\\n require(\\n (value == 0) || (token.allowance(address(this), spender) == 0),\\n \\\"SafeERC20: approve from non-zero to non-zero allowance\\\"\\n );\\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value));\\n }\\n\\n function safeIncreaseAllowance(\\n IERC20 token,\\n address spender,\\n uint256 value\\n ) internal {\\n uint256 newAllowance = token.allowance(address(this), spender) + value;\\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));\\n }\\n\\n function safeDecreaseAllowance(\\n IERC20 token,\\n address spender,\\n uint256 value\\n ) internal {\\n unchecked {\\n uint256 oldAllowance = token.allowance(address(this), spender);\\n require(oldAllowance >= value, \\\"SafeERC20: decreased allowance below zero\\\");\\n uint256 newAllowance = oldAllowance - value;\\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));\\n }\\n }\\n\\n /**\\n * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement\\n * on the return value: the return value is optional (but if data is returned, it must not be false).\\n * @param token The token targeted by the call.\\n * @param data The call data (encoded using abi.encode or one of its variants).\\n */\\n function _callOptionalReturn(IERC20 token, bytes memory data) private {\\n // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since\\n // we're implementing it ourselves. We use {Address.functionCall} to perform this call, which verifies that\\n // the target address contains contract code and also asserts for success in the low-level call.\\n\\n bytes memory returndata = address(token).functionCall(data, \\\"SafeERC20: low-level call failed\\\");\\n if (returndata.length > 0) {\\n // Return data is optional\\n require(abi.decode(returndata, (bool)), \\\"SafeERC20: ERC20 operation did not succeed\\\");\\n }\\n }\\n}\\n\",\"keccak256\":\"0x02348b2e4b9f3200c7e3907c5c2661643a6d8520e9f79939fbb9b4005a54894d\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/Address.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Collection of functions related to the address type\\n */\\nlibrary Address {\\n /**\\n * @dev Returns true if `account` is a contract.\\n *\\n * [IMPORTANT]\\n * ====\\n * It is unsafe to assume that an address for which this function returns\\n * false is an externally-owned account (EOA) and not a contract.\\n *\\n * Among others, `isContract` will return false for the following\\n * types of addresses:\\n *\\n * - an externally-owned account\\n * - a contract in construction\\n * - an address where a contract will be created\\n * - an address where a contract lived, but was destroyed\\n * ====\\n */\\n function isContract(address account) internal view returns (bool) {\\n // This method relies on extcodesize, which returns 0 for contracts in\\n // construction, since the code is only stored at the end of the\\n // constructor execution.\\n\\n uint256 size;\\n assembly {\\n size := extcodesize(account)\\n }\\n return size > 0;\\n }\\n\\n /**\\n * @dev Replacement for Solidity's `transfer`: sends `amount` wei to\\n * `recipient`, forwarding all available gas and reverting on errors.\\n *\\n * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost\\n * of certain opcodes, possibly making contracts go over the 2300 gas limit\\n * imposed by `transfer`, making them unable to receive funds via\\n * `transfer`. {sendValue} removes this limitation.\\n *\\n * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].\\n *\\n * IMPORTANT: because control is transferred to `recipient`, care must be\\n * taken to not create reentrancy vulnerabilities. Consider using\\n * {ReentrancyGuard} or the\\n * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].\\n */\\n function sendValue(address payable recipient, uint256 amount) internal {\\n require(address(this).balance >= amount, \\\"Address: insufficient balance\\\");\\n\\n (bool success, ) = recipient.call{value: amount}(\\\"\\\");\\n require(success, \\\"Address: unable to send value, recipient may have reverted\\\");\\n }\\n\\n /**\\n * @dev Performs a Solidity function call using a low level `call`. A\\n * plain `call` is an unsafe replacement for a function call: use this\\n * function instead.\\n *\\n * If `target` reverts with a revert reason, it is bubbled up by this\\n * function (like regular Solidity function calls).\\n *\\n * Returns the raw returned data. To convert to the expected return value,\\n * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\\n *\\n * Requirements:\\n *\\n * - `target` must be a contract.\\n * - calling `target` with `data` must not revert.\\n *\\n * _Available since v3.1._\\n */\\n function functionCall(address target, bytes memory data) internal returns (bytes memory) {\\n return functionCall(target, data, \\\"Address: low-level call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with\\n * `errorMessage` as a fallback revert reason when `target` reverts.\\n *\\n * _Available since v3.1._\\n */\\n function functionCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, 0, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but also transferring `value` wei to `target`.\\n *\\n * Requirements:\\n *\\n * - the calling contract must have an ETH balance of at least `value`.\\n * - the called Solidity function must be `payable`.\\n *\\n * _Available since v3.1._\\n */\\n function functionCallWithValue(\\n address target,\\n bytes memory data,\\n uint256 value\\n ) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, value, \\\"Address: low-level call with value failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but\\n * with `errorMessage` as a fallback revert reason when `target` reverts.\\n *\\n * _Available since v3.1._\\n */\\n function functionCallWithValue(\\n address target,\\n bytes memory data,\\n uint256 value,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n require(address(this).balance >= value, \\\"Address: insufficient balance for call\\\");\\n require(isContract(target), \\\"Address: call to non-contract\\\");\\n\\n (bool success, bytes memory returndata) = target.call{value: value}(data);\\n return verifyCallResult(success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but performing a static call.\\n *\\n * _Available since v3.3._\\n */\\n function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\\n return functionStaticCall(target, data, \\\"Address: low-level static call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\\n * but performing a static call.\\n *\\n * _Available since v3.3._\\n */\\n function functionStaticCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal view returns (bytes memory) {\\n require(isContract(target), \\\"Address: static call to non-contract\\\");\\n\\n (bool success, bytes memory returndata) = target.staticcall(data);\\n return verifyCallResult(success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but performing a delegate call.\\n *\\n * _Available since v3.4._\\n */\\n function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {\\n return functionDelegateCall(target, data, \\\"Address: low-level delegate call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\\n * but performing a delegate call.\\n *\\n * _Available since v3.4._\\n */\\n function functionDelegateCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n require(isContract(target), \\\"Address: delegate call to non-contract\\\");\\n\\n (bool success, bytes memory returndata) = target.delegatecall(data);\\n return verifyCallResult(success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the\\n * revert reason using the provided one.\\n *\\n * _Available since v4.3._\\n */\\n function verifyCallResult(\\n bool success,\\n bytes memory returndata,\\n string memory errorMessage\\n ) internal pure returns (bytes memory) {\\n if (success) {\\n return returndata;\\n } else {\\n // Look for revert reason and bubble it up if present\\n if (returndata.length > 0) {\\n // The easiest way to bubble the revert reason is using memory via assembly\\n\\n assembly {\\n let returndata_size := mload(returndata)\\n revert(add(32, returndata), returndata_size)\\n }\\n } else {\\n revert(errorMessage);\\n }\\n }\\n }\\n}\\n\",\"keccak256\":\"0x3336baae5cf23e94274d75336e2d412193be508504aee185e61dc7d58cd05c8a\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/math/Math.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Standard math utilities missing in the Solidity language.\\n */\\nlibrary Math {\\n /**\\n * @dev Returns the largest of two numbers.\\n */\\n function max(uint256 a, uint256 b) internal pure returns (uint256) {\\n return a >= b ? a : b;\\n }\\n\\n /**\\n * @dev Returns the smallest of two numbers.\\n */\\n function min(uint256 a, uint256 b) internal pure returns (uint256) {\\n return a < b ? a : b;\\n }\\n\\n /**\\n * @dev Returns the average of two numbers. The result is rounded towards\\n * zero.\\n */\\n function average(uint256 a, uint256 b) internal pure returns (uint256) {\\n // (a + b) / 2 can overflow.\\n return (a & b) + (a ^ b) / 2;\\n }\\n\\n /**\\n * @dev Returns the ceiling of the division of two numbers.\\n *\\n * This differs from standard division with `/` in that it rounds up instead\\n * of rounding down.\\n */\\n function ceilDiv(uint256 a, uint256 b) internal pure returns (uint256) {\\n // (a + b - 1) / b can overflow on addition, so we distribute.\\n return a / b + (a % b == 0 ? 0 : 1);\\n }\\n}\\n\",\"keccak256\":\"0x49ebdac5d515aebb95168564158940b79d7d5d12fbfe59cec546a00d57fee64a\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/structs/EnumerableSet.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Library for managing\\n * https://en.wikipedia.org/wiki/Set_(abstract_data_type)[sets] of primitive\\n * types.\\n *\\n * Sets have the following properties:\\n *\\n * - Elements are added, removed, and checked for existence in constant time\\n * (O(1)).\\n * - Elements are enumerated in O(n). No guarantees are made on the ordering.\\n *\\n * ```\\n * contract Example {\\n * // Add the library methods\\n * using EnumerableSet for EnumerableSet.AddressSet;\\n *\\n * // Declare a set state variable\\n * EnumerableSet.AddressSet private mySet;\\n * }\\n * ```\\n *\\n * As of v3.3.0, sets of type `bytes32` (`Bytes32Set`), `address` (`AddressSet`)\\n * and `uint256` (`UintSet`) are supported.\\n */\\nlibrary EnumerableSet {\\n // To implement this library for multiple types with as little code\\n // repetition as possible, we write it in terms of a generic Set type with\\n // bytes32 values.\\n // The Set implementation uses private functions, and user-facing\\n // implementations (such as AddressSet) are just wrappers around the\\n // underlying Set.\\n // This means that we can only create new EnumerableSets for types that fit\\n // in bytes32.\\n\\n struct Set {\\n // Storage of set values\\n bytes32[] _values;\\n // Position of the value in the `values` array, plus 1 because index 0\\n // means a value is not in the set.\\n mapping(bytes32 => uint256) _indexes;\\n }\\n\\n /**\\n * @dev Add a value to a set. O(1).\\n *\\n * Returns true if the value was added to the set, that is if it was not\\n * already present.\\n */\\n function _add(Set storage set, bytes32 value) private returns (bool) {\\n if (!_contains(set, value)) {\\n set._values.push(value);\\n // The value is stored at length-1, but we add 1 to all indexes\\n // and use 0 as a sentinel value\\n set._indexes[value] = set._values.length;\\n return true;\\n } else {\\n return false;\\n }\\n }\\n\\n /**\\n * @dev Removes a value from a set. O(1).\\n *\\n * Returns true if the value was removed from the set, that is if it was\\n * present.\\n */\\n function _remove(Set storage set, bytes32 value) private returns (bool) {\\n // We read and store the value's index to prevent multiple reads from the same storage slot\\n uint256 valueIndex = set._indexes[value];\\n\\n if (valueIndex != 0) {\\n // Equivalent to contains(set, value)\\n // To delete an element from the _values array in O(1), we swap the element to delete with the last one in\\n // the array, and then remove the last element (sometimes called as 'swap and pop').\\n // This modifies the order of the array, as noted in {at}.\\n\\n uint256 toDeleteIndex = valueIndex - 1;\\n uint256 lastIndex = set._values.length - 1;\\n\\n if (lastIndex != toDeleteIndex) {\\n bytes32 lastvalue = set._values[lastIndex];\\n\\n // Move the last value to the index where the value to delete is\\n set._values[toDeleteIndex] = lastvalue;\\n // Update the index for the moved value\\n set._indexes[lastvalue] = valueIndex; // Replace lastvalue's index to valueIndex\\n }\\n\\n // Delete the slot where the moved value was stored\\n set._values.pop();\\n\\n // Delete the index for the deleted slot\\n delete set._indexes[value];\\n\\n return true;\\n } else {\\n return false;\\n }\\n }\\n\\n /**\\n * @dev Returns true if the value is in the set. O(1).\\n */\\n function _contains(Set storage set, bytes32 value) private view returns (bool) {\\n return set._indexes[value] != 0;\\n }\\n\\n /**\\n * @dev Returns the number of values on the set. O(1).\\n */\\n function _length(Set storage set) private view returns (uint256) {\\n return set._values.length;\\n }\\n\\n /**\\n * @dev Returns the value stored at position `index` in the set. O(1).\\n *\\n * Note that there are no guarantees on the ordering of values inside the\\n * array, and it may change when more values are added or removed.\\n *\\n * Requirements:\\n *\\n * - `index` must be strictly less than {length}.\\n */\\n function _at(Set storage set, uint256 index) private view returns (bytes32) {\\n return set._values[index];\\n }\\n\\n /**\\n * @dev Return the entire set in an array\\n *\\n * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed\\n * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that\\n * this function has an unbounded cost, and using it as part of a state-changing function may render the function\\n * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.\\n */\\n function _values(Set storage set) private view returns (bytes32[] memory) {\\n return set._values;\\n }\\n\\n // Bytes32Set\\n\\n struct Bytes32Set {\\n Set _inner;\\n }\\n\\n /**\\n * @dev Add a value to a set. O(1).\\n *\\n * Returns true if the value was added to the set, that is if it was not\\n * already present.\\n */\\n function add(Bytes32Set storage set, bytes32 value) internal returns (bool) {\\n return _add(set._inner, value);\\n }\\n\\n /**\\n * @dev Removes a value from a set. O(1).\\n *\\n * Returns true if the value was removed from the set, that is if it was\\n * present.\\n */\\n function remove(Bytes32Set storage set, bytes32 value) internal returns (bool) {\\n return _remove(set._inner, value);\\n }\\n\\n /**\\n * @dev Returns true if the value is in the set. O(1).\\n */\\n function contains(Bytes32Set storage set, bytes32 value) internal view returns (bool) {\\n return _contains(set._inner, value);\\n }\\n\\n /**\\n * @dev Returns the number of values in the set. O(1).\\n */\\n function length(Bytes32Set storage set) internal view returns (uint256) {\\n return _length(set._inner);\\n }\\n\\n /**\\n * @dev Returns the value stored at position `index` in the set. O(1).\\n *\\n * Note that there are no guarantees on the ordering of values inside the\\n * array, and it may change when more values are added or removed.\\n *\\n * Requirements:\\n *\\n * - `index` must be strictly less than {length}.\\n */\\n function at(Bytes32Set storage set, uint256 index) internal view returns (bytes32) {\\n return _at(set._inner, index);\\n }\\n\\n /**\\n * @dev Return the entire set in an array\\n *\\n * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed\\n * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that\\n * this function has an unbounded cost, and using it as part of a state-changing function may render the function\\n * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.\\n */\\n function values(Bytes32Set storage set) internal view returns (bytes32[] memory) {\\n return _values(set._inner);\\n }\\n\\n // AddressSet\\n\\n struct AddressSet {\\n Set _inner;\\n }\\n\\n /**\\n * @dev Add a value to a set. O(1).\\n *\\n * Returns true if the value was added to the set, that is if it was not\\n * already present.\\n */\\n function add(AddressSet storage set, address value) internal returns (bool) {\\n return _add(set._inner, bytes32(uint256(uint160(value))));\\n }\\n\\n /**\\n * @dev Removes a value from a set. O(1).\\n *\\n * Returns true if the value was removed from the set, that is if it was\\n * present.\\n */\\n function remove(AddressSet storage set, address value) internal returns (bool) {\\n return _remove(set._inner, bytes32(uint256(uint160(value))));\\n }\\n\\n /**\\n * @dev Returns true if the value is in the set. O(1).\\n */\\n function contains(AddressSet storage set, address value) internal view returns (bool) {\\n return _contains(set._inner, bytes32(uint256(uint160(value))));\\n }\\n\\n /**\\n * @dev Returns the number of values in the set. O(1).\\n */\\n function length(AddressSet storage set) internal view returns (uint256) {\\n return _length(set._inner);\\n }\\n\\n /**\\n * @dev Returns the value stored at position `index` in the set. O(1).\\n *\\n * Note that there are no guarantees on the ordering of values inside the\\n * array, and it may change when more values are added or removed.\\n *\\n * Requirements:\\n *\\n * - `index` must be strictly less than {length}.\\n */\\n function at(AddressSet storage set, uint256 index) internal view returns (address) {\\n return address(uint160(uint256(_at(set._inner, index))));\\n }\\n\\n /**\\n * @dev Return the entire set in an array\\n *\\n * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed\\n * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that\\n * this function has an unbounded cost, and using it as part of a state-changing function may render the function\\n * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.\\n */\\n function values(AddressSet storage set) internal view returns (address[] memory) {\\n bytes32[] memory store = _values(set._inner);\\n address[] memory result;\\n\\n assembly {\\n result := store\\n }\\n\\n return result;\\n }\\n\\n // UintSet\\n\\n struct UintSet {\\n Set _inner;\\n }\\n\\n /**\\n * @dev Add a value to a set. O(1).\\n *\\n * Returns true if the value was added to the set, that is if it was not\\n * already present.\\n */\\n function add(UintSet storage set, uint256 value) internal returns (bool) {\\n return _add(set._inner, bytes32(value));\\n }\\n\\n /**\\n * @dev Removes a value from a set. O(1).\\n *\\n * Returns true if the value was removed from the set, that is if it was\\n * present.\\n */\\n function remove(UintSet storage set, uint256 value) internal returns (bool) {\\n return _remove(set._inner, bytes32(value));\\n }\\n\\n /**\\n * @dev Returns true if the value is in the set. O(1).\\n */\\n function contains(UintSet storage set, uint256 value) internal view returns (bool) {\\n return _contains(set._inner, bytes32(value));\\n }\\n\\n /**\\n * @dev Returns the number of values on the set. O(1).\\n */\\n function length(UintSet storage set) internal view returns (uint256) {\\n return _length(set._inner);\\n }\\n\\n /**\\n * @dev Returns the value stored at position `index` in the set. O(1).\\n *\\n * Note that there are no guarantees on the ordering of values inside the\\n * array, and it may change when more values are added or removed.\\n *\\n * Requirements:\\n *\\n * - `index` must be strictly less than {length}.\\n */\\n function at(UintSet storage set, uint256 index) internal view returns (uint256) {\\n return uint256(_at(set._inner, index));\\n }\\n\\n /**\\n * @dev Return the entire set in an array\\n *\\n * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed\\n * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that\\n * this function has an unbounded cost, and using it as part of a state-changing function may render the function\\n * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.\\n */\\n function values(UintSet storage set) internal view returns (uint256[] memory) {\\n bytes32[] memory store = _values(set._inner);\\n uint256[] memory result;\\n\\n assembly {\\n result := store\\n }\\n\\n return result;\\n }\\n}\\n\",\"keccak256\":\"0x3778dc944f4a696335878bad8beca60f38b7c79b7a0bd8ddbeb618bd502a95ae\",\"license\":\"MIT\"},\"solidity/contracts/Keep3r.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\n/*\\n\\nCoded for The Keep3r Network with \\u2665 by\\n\\n\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2557\\u2591\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2557\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2557\\u2588\\u2588\\u2557\\u2591\\u2591\\u2591\\u2588\\u2588\\u2557\\u2591\\u2591\\u2591\\u2591\\u2591\\u2591\\u2591\\u2588\\u2588\\u2557\\u2591\\u2588\\u2588\\u2588\\u2588\\u2588\\u2557\\u2591\\u2588\\u2588\\u2588\\u2557\\u2591\\u2591\\u2588\\u2588\\u2557\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2557\\u2591\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2557\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2557\\u2591\\u2588\\u2588\\u2557\\u2591\\u2591\\u2591\\u2591\\u2591\\u2591\\u2588\\u2588\\u2588\\u2588\\u2588\\u2557\\u2591\\u2588\\u2588\\u2588\\u2557\\u2591\\u2591\\u2588\\u2588\\u2557\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2557\\u2591\\n\\u2588\\u2588\\u2554\\u2550\\u2550\\u2588\\u2588\\u2557\\u2588\\u2588\\u2554\\u2550\\u2550\\u2550\\u2550\\u255d\\u2588\\u2588\\u2554\\u2550\\u2550\\u2550\\u2550\\u255d\\u2588\\u2588\\u2551\\u2591\\u2591\\u2591\\u2588\\u2588\\u2551\\u2591\\u2591\\u2588\\u2588\\u2557\\u2591\\u2591\\u2588\\u2588\\u2551\\u2588\\u2588\\u2554\\u2550\\u2550\\u2588\\u2588\\u2557\\u2588\\u2588\\u2588\\u2588\\u2557\\u2591\\u2588\\u2588\\u2551\\u2588\\u2588\\u2554\\u2550\\u2550\\u2588\\u2588\\u2557\\u2588\\u2588\\u2554\\u2550\\u2550\\u2550\\u2550\\u255d\\u2588\\u2588\\u2554\\u2550\\u2550\\u2588\\u2588\\u2557\\u2588\\u2588\\u2551\\u2591\\u2591\\u2591\\u2591\\u2591\\u2588\\u2588\\u2554\\u2550\\u2550\\u2588\\u2588\\u2557\\u2588\\u2588\\u2588\\u2588\\u2557\\u2591\\u2588\\u2588\\u2551\\u2588\\u2588\\u2554\\u2550\\u2550\\u2588\\u2588\\u2557\\n\\u2588\\u2588\\u2551\\u2591\\u2591\\u2588\\u2588\\u2551\\u2588\\u2588\\u2588\\u2588\\u2588\\u2557\\u2591\\u2591\\u2588\\u2588\\u2588\\u2588\\u2588\\u2557\\u2591\\u2591\\u2588\\u2588\\u2551\\u2591\\u2591\\u2591\\u255a\\u2588\\u2588\\u2557\\u2588\\u2588\\u2588\\u2588\\u2557\\u2588\\u2588\\u2554\\u255d\\u2588\\u2588\\u2551\\u2591\\u2591\\u2588\\u2588\\u2551\\u2588\\u2588\\u2554\\u2588\\u2588\\u2557\\u2588\\u2588\\u2551\\u2588\\u2588\\u2551\\u2591\\u2591\\u2588\\u2588\\u2551\\u2588\\u2588\\u2588\\u2588\\u2588\\u2557\\u2591\\u2591\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2554\\u255d\\u2588\\u2588\\u2551\\u2591\\u2591\\u2591\\u2591\\u2591\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2551\\u2588\\u2588\\u2554\\u2588\\u2588\\u2557\\u2588\\u2588\\u2551\\u2588\\u2588\\u2551\\u2591\\u2591\\u2588\\u2588\\u2551\\n\\u2588\\u2588\\u2551\\u2591\\u2591\\u2588\\u2588\\u2551\\u2588\\u2588\\u2554\\u2550\\u2550\\u255d\\u2591\\u2591\\u2588\\u2588\\u2554\\u2550\\u2550\\u255d\\u2591\\u2591\\u2588\\u2588\\u2551\\u2591\\u2591\\u2591\\u2591\\u2588\\u2588\\u2588\\u2588\\u2554\\u2550\\u2588\\u2588\\u2588\\u2588\\u2551\\u2591\\u2588\\u2588\\u2551\\u2591\\u2591\\u2588\\u2588\\u2551\\u2588\\u2588\\u2551\\u255a\\u2588\\u2588\\u2588\\u2588\\u2551\\u2588\\u2588\\u2551\\u2591\\u2591\\u2588\\u2588\\u2551\\u2588\\u2588\\u2554\\u2550\\u2550\\u255d\\u2591\\u2591\\u2588\\u2588\\u2554\\u2550\\u2550\\u2588\\u2588\\u2557\\u2588\\u2588\\u2551\\u2591\\u2591\\u2591\\u2591\\u2591\\u2588\\u2588\\u2554\\u2550\\u2550\\u2588\\u2588\\u2551\\u2588\\u2588\\u2551\\u255a\\u2588\\u2588\\u2588\\u2588\\u2551\\u2588\\u2588\\u2551\\u2591\\u2591\\u2588\\u2588\\u2551\\n\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2554\\u255d\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2557\\u2588\\u2588\\u2551\\u2591\\u2591\\u2591\\u2591\\u2591\\u2588\\u2588\\u2551\\u2591\\u2591\\u2591\\u2591\\u255a\\u2588\\u2588\\u2554\\u255d\\u2591\\u255a\\u2588\\u2588\\u2554\\u255d\\u2591\\u255a\\u2588\\u2588\\u2588\\u2588\\u2588\\u2554\\u255d\\u2588\\u2588\\u2551\\u2591\\u255a\\u2588\\u2588\\u2588\\u2551\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2554\\u255d\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2557\\u2588\\u2588\\u2551\\u2591\\u2591\\u2588\\u2588\\u2551\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2557\\u2588\\u2588\\u2551\\u2591\\u2591\\u2588\\u2588\\u2551\\u2588\\u2588\\u2551\\u2591\\u255a\\u2588\\u2588\\u2588\\u2551\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2554\\u255d\\n\\u255a\\u2550\\u2550\\u2550\\u2550\\u2550\\u255d\\u2591\\u255a\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u255d\\u255a\\u2550\\u255d\\u2591\\u2591\\u2591\\u2591\\u2591\\u255a\\u2550\\u255d\\u2591\\u2591\\u2591\\u2591\\u2591\\u255a\\u2550\\u255d\\u2591\\u2591\\u2591\\u255a\\u2550\\u255d\\u2591\\u2591\\u2591\\u255a\\u2550\\u2550\\u2550\\u2550\\u255d\\u2591\\u255a\\u2550\\u255d\\u2591\\u2591\\u255a\\u2550\\u2550\\u255d\\u255a\\u2550\\u2550\\u2550\\u2550\\u2550\\u255d\\u2591\\u255a\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u255d\\u255a\\u2550\\u255d\\u2591\\u2591\\u255a\\u2550\\u255d\\u255a\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u255d\\u255a\\u2550\\u255d\\u2591\\u2591\\u255a\\u2550\\u255d\\u255a\\u2550\\u255d\\u2591\\u2591\\u255a\\u2550\\u2550\\u255d\\u255a\\u2550\\u2550\\u2550\\u2550\\u2550\\u255d\\u2591\\n\\nhttps://defi.sucks\\n\\n*/\\n\\npragma solidity >=0.8.4 <0.9.0;\\n\\nimport '../interfaces/IKeep3r.sol';\\nimport './peripherals/jobs/Keep3rJobs.sol';\\nimport './peripherals/keepers/Keep3rKeepers.sol';\\nimport './peripherals/DustCollector.sol';\\n\\ncontract Keep3r is IKeep3r, Keep3rJobs, Keep3rKeepers {\\n constructor(\\n address _governance,\\n address _keep3rHelper,\\n address _keep3rV1,\\n address _keep3rV1Proxy\\n ) Keep3rParameters(_keep3rHelper, _keep3rV1, _keep3rV1Proxy) Keep3rRoles(_governance) {}\\n}\\n\",\"keccak256\":\"0x8b7a11409585a734b97d64773753921ea64b17ea6ee45d712d0478898990a8b0\",\"license\":\"MIT\"},\"solidity/contracts/libraries/FullMath.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4 <0.9.0;\\n\\n/// @title Contains 512-bit math functions\\n/// @notice Facilitates multiplication and division that can have overflow of an intermediate value without any loss of precision\\n/// @dev Handles \\\"phantom overflow\\\" i.e., allows multiplication and division where an intermediate value overflows 256 bits\\nlibrary FullMath {\\n /// @notice Calculates floor(a\\u00d7b\\u00f7denominator) with full precision. Throws if result overflows a uint256 or denominator == 0\\n /// @param a The multiplicand\\n /// @param b The multiplier\\n /// @param denominator The divisor\\n /// @return result The 256-bit result\\n /// @dev Credit to Remco Bloemen under MIT license https://xn--2-umb.com/21/muldiv\\n function mulDiv(\\n uint256 a,\\n uint256 b,\\n uint256 denominator\\n ) internal pure returns (uint256 result) {\\n unchecked {\\n // 512-bit multiply [prod1 prod0] = a * b\\n // Compute the product mod 2**256 and mod 2**256 - 1\\n // then use the Chinese Remainder Theorem to reconstruct\\n // the 512 bit result. The result is stored in two 256\\n // variables such that product = prod1 * 2**256 + prod0\\n uint256 prod0; // Least significant 256 bits of the product\\n uint256 prod1; // Most significant 256 bits of the product\\n assembly {\\n let mm := mulmod(a, b, not(0))\\n prod0 := mul(a, b)\\n prod1 := sub(sub(mm, prod0), lt(mm, prod0))\\n }\\n\\n // Handle non-overflow cases, 256 by 256 division\\n if (prod1 == 0) {\\n require(denominator > 0);\\n assembly {\\n result := div(prod0, denominator)\\n }\\n return result;\\n }\\n\\n // Make sure the result is less than 2**256.\\n // Also prevents denominator == 0\\n require(denominator > prod1);\\n\\n ///////////////////////////////////////////////\\n // 512 by 256 division.\\n ///////////////////////////////////////////////\\n\\n // Make division exact by subtracting the remainder from [prod1 prod0]\\n // Compute remainder using mulmod\\n uint256 remainder;\\n assembly {\\n remainder := mulmod(a, b, denominator)\\n }\\n // Subtract 256 bit number from 512 bit number\\n assembly {\\n prod1 := sub(prod1, gt(remainder, prod0))\\n prod0 := sub(prod0, remainder)\\n }\\n\\n // Factor powers of two out of denominator\\n // Compute largest power of two divisor of denominator.\\n // Always >= 1.\\n uint256 twos = (~denominator + 1) & denominator;\\n // Divide denominator by power of two\\n assembly {\\n denominator := div(denominator, twos)\\n }\\n\\n // Divide [prod1 prod0] by the factors of two\\n assembly {\\n prod0 := div(prod0, twos)\\n }\\n // Shift in bits from prod1 into prod0. For this we need\\n // to flip `twos` such that it is 2**256 / twos.\\n // If twos is zero, then it becomes one\\n assembly {\\n twos := add(div(sub(0, twos), twos), 1)\\n }\\n prod0 |= prod1 * twos;\\n\\n // Invert denominator mod 2**256\\n // Now that denominator is an odd number, it has an inverse\\n // modulo 2**256 such that denominator * inv = 1 mod 2**256.\\n // Compute the inverse by starting with a seed that is correct\\n // correct for four bits. That is, denominator * inv = 1 mod 2**4\\n uint256 inv = (3 * denominator) ^ 2;\\n // Now use Newton-Raphson iteration to improve the precision.\\n // Thanks to Hensel's lifting lemma, this also works in modular\\n // arithmetic, doubling the correct bits in each step.\\n inv *= 2 - denominator * inv; // inverse mod 2**8\\n inv *= 2 - denominator * inv; // inverse mod 2**16\\n inv *= 2 - denominator * inv; // inverse mod 2**32\\n inv *= 2 - denominator * inv; // inverse mod 2**64\\n inv *= 2 - denominator * inv; // inverse mod 2**128\\n inv *= 2 - denominator * inv; // inverse mod 2**256\\n\\n // Because the division is now exact we can divide by multiplying\\n // with the modular inverse of denominator. This will give us the\\n // correct result modulo 2**256. Since the precoditions guarantee\\n // that the outcome is less than 2**256, this is the final result.\\n // We don't need to compute the high bits of the result and prod1\\n // is no longer required.\\n result = prod0 * inv;\\n return result;\\n }\\n }\\n\\n /// @notice Calculates ceil(a\\u00d7b\\u00f7denominator) with full precision. Throws if result overflows a uint256 or denominator == 0\\n /// @param a The multiplicand\\n /// @param b The multiplier\\n /// @param denominator The divisor\\n /// @return result The 256-bit result\\n function mulDivRoundingUp(\\n uint256 a,\\n uint256 b,\\n uint256 denominator\\n ) internal pure returns (uint256 result) {\\n unchecked {\\n result = mulDiv(a, b, denominator);\\n if (mulmod(a, b, denominator) > 0) {\\n require(result < type(uint256).max);\\n result++;\\n }\\n }\\n }\\n}\\n\",\"keccak256\":\"0xe1c595da02adf8ba2ae74ac579b9b3c966d1ecb2a99c25081a62ee8550f26569\",\"license\":\"MIT\"},\"solidity/contracts/peripherals/DustCollector.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity >=0.8.4 <0.9.0;\\n\\nimport '@openzeppelin/contracts/token/ERC20/IERC20.sol';\\nimport '@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol';\\nimport '../../contracts/peripherals/Governable.sol';\\nimport '../../interfaces/peripherals/IDustCollector.sol';\\n\\nabstract contract DustCollector is IDustCollector, Governable {\\n using SafeERC20 for IERC20;\\n\\n address internal constant _ETH_ADDRESS = 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE;\\n\\n function sendDust(\\n address _token,\\n uint256 _amount,\\n address _to\\n ) external override onlyGovernance {\\n if (_to == address(0)) revert ZeroAddress();\\n if (_token == _ETH_ADDRESS) {\\n payable(_to).transfer(_amount);\\n } else {\\n IERC20(_token).safeTransfer(_to, _amount);\\n }\\n emit DustSent(_token, _amount, _to);\\n }\\n}\\n\",\"keccak256\":\"0x246ac2c4057520bb627ea8040367549786f4477a04fd79358927cd607952bc2f\",\"license\":\"MIT\"},\"solidity/contracts/peripherals/Governable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4 <0.9.0;\\n\\nimport '../../interfaces/peripherals/IGovernable.sol';\\n\\nabstract contract Governable is IGovernable {\\n /// @inheritdoc IGovernable\\n address public override governance;\\n\\n /// @inheritdoc IGovernable\\n address public override pendingGovernance;\\n\\n constructor(address _governance) {\\n if (_governance == address(0)) revert NoGovernanceZeroAddress();\\n governance = _governance;\\n }\\n\\n /// @inheritdoc IGovernable\\n function setGovernance(address _governance) external override onlyGovernance {\\n pendingGovernance = _governance;\\n emit GovernanceProposal(_governance);\\n }\\n\\n /// @inheritdoc IGovernable\\n function acceptGovernance() external override onlyPendingGovernance {\\n governance = pendingGovernance;\\n delete pendingGovernance;\\n emit GovernanceSet(governance);\\n }\\n\\n /// @notice Functions with this modifier can only be called by governance\\n modifier onlyGovernance {\\n if (msg.sender != governance) revert OnlyGovernance();\\n _;\\n }\\n\\n /// @notice Functions with this modifier can only be called by pendingGovernance\\n modifier onlyPendingGovernance {\\n if (msg.sender != pendingGovernance) revert OnlyPendingGovernance();\\n _;\\n }\\n}\\n\",\"keccak256\":\"0x5b6d7601a42d2229657a7f60021c7e2bfe890c3541ab0003f7d88e20a28d722b\",\"license\":\"MIT\"},\"solidity/contracts/peripherals/Keep3rAccountance.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4 <0.9.0;\\n\\nimport '@openzeppelin/contracts/utils/structs/EnumerableSet.sol';\\nimport '../../interfaces/peripherals/IKeep3rAccountance.sol';\\nimport './Keep3rRoles.sol';\\n\\nabstract contract Keep3rAccountance is IKeep3rAccountance, Keep3rRoles {\\n using EnumerableSet for EnumerableSet.AddressSet;\\n\\n /// @notice List of all enabled keepers\\n EnumerableSet.AddressSet internal _keepers;\\n\\n /// @inheritdoc IKeep3rAccountance\\n uint256 public override totalBonds;\\n\\n /// @inheritdoc IKeep3rAccountance\\n mapping(address => uint256) public override workCompleted;\\n\\n /// @inheritdoc IKeep3rAccountance\\n mapping(address => uint256) public override firstSeen;\\n\\n /// @inheritdoc IKeep3rAccountance\\n mapping(address => bool) public override disputes;\\n\\n /// @inheritdoc IKeep3rAccountance\\n /// @notice Mapping (job => bonding => amount)\\n mapping(address => mapping(address => uint256)) public override bonds;\\n\\n /// @inheritdoc IKeep3rAccountance\\n mapping(address => mapping(address => uint256)) public override jobTokenCredits;\\n\\n /// @notice The current liquidity credits available for a job\\n mapping(address => uint256) internal _jobLiquidityCredits;\\n\\n /// @notice Map the address of a job to its correspondent periodCredits\\n mapping(address => uint256) internal _jobPeriodCredits;\\n\\n /// @notice Enumerable array of Job Tokens for Credits\\n mapping(address => EnumerableSet.AddressSet) internal _jobTokens;\\n\\n /// @notice List of liquidities that a job has (job => liquidities)\\n mapping(address => EnumerableSet.AddressSet) internal _jobLiquidities;\\n\\n /// @notice Liquidity pool to observe\\n mapping(address => address) internal _liquidityPool;\\n\\n /// @notice Tracks if a pool has KP3R as token0\\n mapping(address => bool) internal _isKP3RToken0;\\n\\n /// @inheritdoc IKeep3rAccountance\\n mapping(address => mapping(address => uint256)) public override pendingBonds;\\n\\n /// @inheritdoc IKeep3rAccountance\\n mapping(address => mapping(address => uint256)) public override canActivateAfter;\\n\\n /// @inheritdoc IKeep3rAccountance\\n mapping(address => mapping(address => uint256)) public override canWithdrawAfter;\\n\\n /// @inheritdoc IKeep3rAccountance\\n mapping(address => mapping(address => uint256)) public override pendingUnbonds;\\n\\n /// @inheritdoc IKeep3rAccountance\\n mapping(address => bool) public override hasBonded;\\n\\n /// @notice List of all enabled jobs\\n EnumerableSet.AddressSet internal _jobs;\\n\\n /// @inheritdoc IKeep3rAccountance\\n function jobs() external view override returns (address[] memory _list) {\\n _list = _jobs.values();\\n }\\n\\n /// @inheritdoc IKeep3rAccountance\\n function keepers() external view override returns (address[] memory _list) {\\n _list = _keepers.values();\\n }\\n}\\n\",\"keccak256\":\"0xcd2a525e6567eea4f2a7f93e8eb686e484d2a078686f2744dde35a8383881730\",\"license\":\"MIT\"},\"solidity/contracts/peripherals/Keep3rDisputable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4 <0.9.0;\\n\\nimport './Keep3rParameters.sol';\\nimport '../../interfaces/peripherals/IKeep3rDisputable.sol';\\n\\nabstract contract Keep3rDisputable is IKeep3rDisputable, Keep3rParameters {\\n /// @inheritdoc IKeep3rDisputable\\n function dispute(address _jobOrKeeper) external override onlyDisputer {\\n if (disputes[_jobOrKeeper]) revert AlreadyDisputed();\\n disputes[_jobOrKeeper] = true;\\n emit Dispute(_jobOrKeeper, msg.sender);\\n }\\n\\n /// @inheritdoc IKeep3rDisputable\\n function resolve(address _jobOrKeeper) external override onlyDisputer {\\n if (!disputes[_jobOrKeeper]) revert NotDisputed();\\n disputes[_jobOrKeeper] = false;\\n emit Resolve(_jobOrKeeper, msg.sender);\\n }\\n}\\n\",\"keccak256\":\"0x664b54040aa4e734f68a01fcfb5bf67cbb1a70efd03862cd3a456457536b1fb4\",\"license\":\"MIT\"},\"solidity/contracts/peripherals/Keep3rParameters.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4 <0.9.0;\\n\\nimport '../../interfaces/IKeep3rHelper.sol';\\nimport '../../interfaces/peripherals/IKeep3rParameters.sol';\\nimport '../../interfaces/external/IKeep3rV1Proxy.sol';\\nimport './Keep3rAccountance.sol';\\n\\nabstract contract Keep3rParameters is IKeep3rParameters, Keep3rAccountance {\\n /// @inheritdoc IKeep3rParameters\\n address public override keep3rV1;\\n\\n /// @inheritdoc IKeep3rParameters\\n address public override keep3rV1Proxy;\\n\\n /// @inheritdoc IKeep3rParameters\\n address public override keep3rHelper;\\n\\n /// @inheritdoc IKeep3rParameters\\n uint256 public override bondTime = 3 days;\\n\\n /// @inheritdoc IKeep3rParameters\\n uint256 public override unbondTime = 14 days;\\n\\n /// @inheritdoc IKeep3rParameters\\n uint256 public override liquidityMinimum = 3 ether;\\n\\n /// @inheritdoc IKeep3rParameters\\n uint256 public override rewardPeriodTime = 5 days;\\n\\n /// @inheritdoc IKeep3rParameters\\n uint256 public override inflationPeriod = 34 days;\\n\\n /// @inheritdoc IKeep3rParameters\\n uint256 public override fee = 30;\\n\\n /// @notice The base that will be used to calculate the fee\\n uint256 internal constant _BASE = 10_000;\\n\\n /// @notice The minimum reward period\\n uint256 internal constant _MIN_REWARD_PERIOD_TIME = 1 days;\\n\\n constructor(\\n address _keep3rHelper,\\n address _keep3rV1,\\n address _keep3rV1Proxy\\n ) {\\n keep3rHelper = _keep3rHelper;\\n keep3rV1 = _keep3rV1;\\n keep3rV1Proxy = _keep3rV1Proxy;\\n }\\n\\n /// @inheritdoc IKeep3rParameters\\n function setKeep3rHelper(address _keep3rHelper) external override onlyGovernance {\\n if (_keep3rHelper == address(0)) revert ZeroAddress();\\n keep3rHelper = _keep3rHelper;\\n emit Keep3rHelperChange(_keep3rHelper);\\n }\\n\\n /// @inheritdoc IKeep3rParameters\\n function setKeep3rV1(address _keep3rV1) public virtual override onlyGovernance {\\n if (_keep3rV1 == address(0)) revert ZeroAddress();\\n _mint(totalBonds);\\n\\n keep3rV1 = _keep3rV1;\\n emit Keep3rV1Change(_keep3rV1);\\n }\\n\\n /// @inheritdoc IKeep3rParameters\\n function setKeep3rV1Proxy(address _keep3rV1Proxy) external override onlyGovernance {\\n if (_keep3rV1Proxy == address(0)) revert ZeroAddress();\\n keep3rV1Proxy = _keep3rV1Proxy;\\n emit Keep3rV1ProxyChange(_keep3rV1Proxy);\\n }\\n\\n /// @inheritdoc IKeep3rParameters\\n function setBondTime(uint256 _bondTime) external override onlyGovernance {\\n bondTime = _bondTime;\\n emit BondTimeChange(_bondTime);\\n }\\n\\n /// @inheritdoc IKeep3rParameters\\n function setUnbondTime(uint256 _unbondTime) external override onlyGovernance {\\n unbondTime = _unbondTime;\\n emit UnbondTimeChange(_unbondTime);\\n }\\n\\n /// @inheritdoc IKeep3rParameters\\n function setLiquidityMinimum(uint256 _liquidityMinimum) external override onlyGovernance {\\n liquidityMinimum = _liquidityMinimum;\\n emit LiquidityMinimumChange(_liquidityMinimum);\\n }\\n\\n /// @inheritdoc IKeep3rParameters\\n function setRewardPeriodTime(uint256 _rewardPeriodTime) external override onlyGovernance {\\n if (_rewardPeriodTime < _MIN_REWARD_PERIOD_TIME) revert MinRewardPeriod();\\n rewardPeriodTime = _rewardPeriodTime;\\n emit RewardPeriodTimeChange(_rewardPeriodTime);\\n }\\n\\n /// @inheritdoc IKeep3rParameters\\n function setInflationPeriod(uint256 _inflationPeriod) external override onlyGovernance {\\n inflationPeriod = _inflationPeriod;\\n emit InflationPeriodChange(_inflationPeriod);\\n }\\n\\n /// @inheritdoc IKeep3rParameters\\n function setFee(uint256 _fee) external override onlyGovernance {\\n fee = _fee;\\n emit FeeChange(_fee);\\n }\\n\\n function _mint(uint256 _amount) internal {\\n totalBonds -= _amount;\\n IKeep3rV1Proxy(keep3rV1Proxy).mint(_amount);\\n }\\n}\\n\",\"keccak256\":\"0x180349c0ff1fffec1566fba13b494595dcc5ca7eaf049d3f7a2a8d1c60de7d0f\",\"license\":\"MIT\"},\"solidity/contracts/peripherals/Keep3rRoles.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4 <0.9.0;\\n\\nimport '../../interfaces/peripherals/IKeep3rRoles.sol';\\nimport '@openzeppelin/contracts/utils/structs/EnumerableSet.sol';\\nimport './DustCollector.sol';\\nimport './Governable.sol';\\n\\ncontract Keep3rRoles is IKeep3rRoles, Governable, DustCollector {\\n /// @inheritdoc IKeep3rRoles\\n mapping(address => bool) public override slashers;\\n\\n /// @inheritdoc IKeep3rRoles\\n mapping(address => bool) public override disputers;\\n\\n constructor(address _governance) Governable(_governance) DustCollector() {}\\n\\n /// @inheritdoc IKeep3rRoles\\n function addSlasher(address _slasher) external override onlyGovernance {\\n if (_slasher == address(0)) revert ZeroAddress();\\n if (slashers[_slasher]) revert SlasherExistent();\\n slashers[_slasher] = true;\\n emit SlasherAdded(_slasher);\\n }\\n\\n /// @inheritdoc IKeep3rRoles\\n function removeSlasher(address _slasher) external override onlyGovernance {\\n if (!slashers[_slasher]) revert SlasherUnexistent();\\n delete slashers[_slasher];\\n emit SlasherRemoved(_slasher);\\n }\\n\\n /// @inheritdoc IKeep3rRoles\\n function addDisputer(address _disputer) external override onlyGovernance {\\n if (_disputer == address(0)) revert ZeroAddress();\\n if (disputers[_disputer]) revert DisputerExistent();\\n disputers[_disputer] = true;\\n emit DisputerAdded(_disputer);\\n }\\n\\n /// @inheritdoc IKeep3rRoles\\n function removeDisputer(address _disputer) external override onlyGovernance {\\n if (!disputers[_disputer]) revert DisputerUnexistent();\\n delete disputers[_disputer];\\n emit DisputerRemoved(_disputer);\\n }\\n\\n /// @notice Functions with this modifier can only be called by either a slasher or governance\\n modifier onlySlasher {\\n if (!slashers[msg.sender]) revert OnlySlasher();\\n _;\\n }\\n\\n /// @notice Functions with this modifier can only be called by either a disputer or governance\\n modifier onlyDisputer {\\n if (!disputers[msg.sender]) revert OnlyDisputer();\\n _;\\n }\\n}\\n\",\"keccak256\":\"0x61a1cf0d52db8fe78fa8cfb76d9b02f93ef3adc23e6655969bc1a4bb83ea9a95\",\"license\":\"MIT\"},\"solidity/contracts/peripherals/jobs/Keep3rJobDisputable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4 <0.9.0;\\n\\nimport './Keep3rJobFundableCredits.sol';\\nimport './Keep3rJobFundableLiquidity.sol';\\nimport '../Keep3rDisputable.sol';\\n\\nabstract contract Keep3rJobDisputable is IKeep3rJobDisputable, Keep3rDisputable, Keep3rJobFundableCredits, Keep3rJobFundableLiquidity {\\n using EnumerableSet for EnumerableSet.AddressSet;\\n using SafeERC20 for IERC20;\\n\\n /// @inheritdoc IKeep3rJobDisputable\\n function slashTokenFromJob(\\n address _job,\\n address _token,\\n uint256 _amount\\n ) external override onlySlasher {\\n if (!disputes[_job]) revert NotDisputed();\\n if (!_jobTokens[_job].contains(_token)) revert JobTokenUnexistent();\\n if (jobTokenCredits[_job][_token] < _amount) revert JobTokenInsufficient();\\n\\n try IERC20(_token).transfer(governance, _amount) {} catch {}\\n jobTokenCredits[_job][_token] -= _amount;\\n if (jobTokenCredits[_job][_token] == 0) {\\n _jobTokens[_job].remove(_token);\\n }\\n\\n emit JobSlashToken(_job, _token, msg.sender, _amount);\\n }\\n\\n /// @inheritdoc IKeep3rJobDisputable\\n function slashLiquidityFromJob(\\n address _job,\\n address _liquidity,\\n uint256 _amount\\n ) external override onlySlasher {\\n if (!disputes[_job]) revert NotDisputed();\\n\\n _unbondLiquidityFromJob(_job, _liquidity, _amount);\\n try IERC20(_liquidity).transfer(governance, _amount) {} catch {}\\n emit JobSlashLiquidity(_job, _liquidity, msg.sender, _amount);\\n }\\n}\\n\",\"keccak256\":\"0x86cdbf44dfa46c6b6e184e48e11cb8571e26cf50c793b6b07227c29e743da397\",\"license\":\"MIT\"},\"solidity/contracts/peripherals/jobs/Keep3rJobFundableCredits.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4 <0.9.0;\\n\\nimport './Keep3rJobOwnership.sol';\\nimport '../Keep3rAccountance.sol';\\nimport '../Keep3rParameters.sol';\\nimport '../../../interfaces/peripherals/IKeep3rJobs.sol';\\n\\nimport '@openzeppelin/contracts/security/ReentrancyGuard.sol';\\nimport '@openzeppelin/contracts/token/ERC20/IERC20.sol';\\nimport '@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol';\\nimport '@openzeppelin/contracts/utils/math/Math.sol';\\n\\nabstract contract Keep3rJobFundableCredits is IKeep3rJobFundableCredits, ReentrancyGuard, Keep3rJobOwnership, Keep3rParameters {\\n using EnumerableSet for EnumerableSet.AddressSet;\\n using SafeERC20 for IERC20;\\n\\n /// @notice Cooldown between withdrawals\\n uint256 internal constant _WITHDRAW_TOKENS_COOLDOWN = 1 minutes;\\n\\n /// @inheritdoc IKeep3rJobFundableCredits\\n mapping(address => mapping(address => uint256)) public override jobTokenCreditsAddedAt;\\n\\n /// @inheritdoc IKeep3rJobFundableCredits\\n function addTokenCreditsToJob(\\n address _job,\\n address _token,\\n uint256 _amount\\n ) external override nonReentrant {\\n if (!_jobs.contains(_job)) revert JobUnavailable();\\n // KP3R shouldn't be used for direct token payments\\n if (_token == keep3rV1) revert TokenUnallowed();\\n uint256 _before = IERC20(_token).balanceOf(address(this));\\n IERC20(_token).safeTransferFrom(msg.sender, address(this), _amount);\\n uint256 _received = IERC20(_token).balanceOf(address(this)) - _before;\\n uint256 _tokenFee = (_received * fee) / _BASE;\\n jobTokenCredits[_job][_token] += _received - _tokenFee;\\n jobTokenCreditsAddedAt[_job][_token] = block.timestamp;\\n IERC20(_token).safeTransfer(governance, _tokenFee);\\n _jobTokens[_job].add(_token);\\n\\n emit TokenCreditAddition(_job, _token, msg.sender, _received);\\n }\\n\\n /// @inheritdoc IKeep3rJobFundableCredits\\n function withdrawTokenCreditsFromJob(\\n address _job,\\n address _token,\\n uint256 _amount,\\n address _receiver\\n ) external override nonReentrant onlyJobOwner(_job) {\\n if (block.timestamp <= jobTokenCreditsAddedAt[_job][_token] + _WITHDRAW_TOKENS_COOLDOWN) revert JobTokenCreditsLocked();\\n if (jobTokenCredits[_job][_token] < _amount) revert InsufficientJobTokenCredits();\\n if (disputes[_job]) revert JobDisputed();\\n\\n jobTokenCredits[_job][_token] -= _amount;\\n IERC20(_token).safeTransfer(_receiver, _amount);\\n\\n if (jobTokenCredits[_job][_token] == 0) {\\n _jobTokens[_job].remove(_token);\\n }\\n\\n emit TokenCreditWithdrawal(_job, _token, _receiver, _amount);\\n }\\n}\\n\",\"keccak256\":\"0xb600d18903a008a1ca03743de7cef8330c2d5e66db52c900822551a4be75f7a5\",\"license\":\"MIT\"},\"solidity/contracts/peripherals/jobs/Keep3rJobFundableLiquidity.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4 <0.9.0;\\n\\nimport './Keep3rJobOwnership.sol';\\nimport '../Keep3rAccountance.sol';\\nimport '../Keep3rParameters.sol';\\nimport '../../../interfaces/IPairManager.sol';\\nimport '../../../interfaces/peripherals/IKeep3rJobs.sol';\\n\\nimport '../../libraries/FullMath.sol';\\n\\nimport '@openzeppelin/contracts/security/ReentrancyGuard.sol';\\nimport '@openzeppelin/contracts/token/ERC20/IERC20.sol';\\nimport '@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol';\\nimport '@openzeppelin/contracts/utils/math/Math.sol';\\n\\nabstract contract Keep3rJobFundableLiquidity is IKeep3rJobFundableLiquidity, ReentrancyGuard, Keep3rJobOwnership, Keep3rParameters {\\n using EnumerableSet for EnumerableSet.AddressSet;\\n using SafeERC20 for IERC20;\\n\\n /// @notice List of liquidities that are accepted in the system\\n EnumerableSet.AddressSet internal _approvedLiquidities;\\n\\n /// @inheritdoc IKeep3rJobFundableLiquidity\\n mapping(address => mapping(address => uint256)) public override liquidityAmount;\\n\\n /// @inheritdoc IKeep3rJobFundableLiquidity\\n mapping(address => uint256) public override rewardedAt;\\n\\n /// @inheritdoc IKeep3rJobFundableLiquidity\\n mapping(address => uint256) public override workedAt;\\n\\n /// @notice Tracks an address and returns its TickCache\\n mapping(address => TickCache) internal _tick;\\n\\n // Views\\n\\n /// @inheritdoc IKeep3rJobFundableLiquidity\\n function approvedLiquidities() external view override returns (address[] memory _list) {\\n _list = _approvedLiquidities.values();\\n }\\n\\n /// @inheritdoc IKeep3rJobFundableLiquidity\\n function jobPeriodCredits(address _job) public view override returns (uint256 _periodCredits) {\\n for (uint256 i; i < _jobLiquidities[_job].length(); i++) {\\n address _liquidity = _jobLiquidities[_job].at(i);\\n if (_approvedLiquidities.contains(_liquidity)) {\\n TickCache memory _tickCache = observeLiquidity(_liquidity);\\n if (_tickCache.period != 0) {\\n int56 _tickDifference = _isKP3RToken0[_liquidity] ? _tickCache.difference : -_tickCache.difference;\\n _periodCredits += _getReward(\\n IKeep3rHelper(keep3rHelper).getKP3RsAtTick(liquidityAmount[_job][_liquidity], _tickDifference, rewardPeriodTime)\\n );\\n }\\n }\\n }\\n }\\n\\n /// @inheritdoc IKeep3rJobFundableLiquidity\\n function jobLiquidityCredits(address _job) public view override returns (uint256 _liquidityCredits) {\\n uint256 _periodCredits = jobPeriodCredits(_job);\\n\\n // If the job was rewarded in the past 1 period time\\n if ((block.timestamp - rewardedAt[_job]) < rewardPeriodTime) {\\n // If the job has period credits, update minted job credits to new twap\\n _liquidityCredits = _periodCredits > 0\\n ? (_jobLiquidityCredits[_job] * _periodCredits) / _jobPeriodCredits[_job] // If the job has period credits, return remaining job credits updated to new twap\\n : _jobLiquidityCredits[_job]; // If not, return remaining credits, forced credits should not be updated\\n } else {\\n // Else return a full period worth of credits if current credits have expired\\n _liquidityCredits = _periodCredits;\\n }\\n }\\n\\n /// @inheritdoc IKeep3rJobFundableLiquidity\\n function totalJobCredits(address _job) external view override returns (uint256 _credits) {\\n uint256 _periodCredits = jobPeriodCredits(_job);\\n uint256 _cooldown = block.timestamp;\\n\\n if ((rewardedAt[_job] > _period(block.timestamp - rewardPeriodTime))) {\\n // Will calculate cooldown if it outdated\\n if ((block.timestamp - rewardedAt[_job]) >= rewardPeriodTime) {\\n // Will calculate cooldown from last reward reference in this period\\n _cooldown -= (rewardedAt[_job] + rewardPeriodTime);\\n } else {\\n // Will calculate cooldown from last reward timestamp\\n _cooldown -= rewardedAt[_job];\\n }\\n } else {\\n // Will calculate cooldown from period start if expired\\n _cooldown -= _period(block.timestamp);\\n }\\n _credits = jobLiquidityCredits(_job) + _phase(_cooldown, _periodCredits);\\n }\\n\\n /// @inheritdoc IKeep3rJobFundableLiquidity\\n function quoteLiquidity(address _liquidity, uint256 _amount) external view override returns (uint256 _periodCredits) {\\n if (_approvedLiquidities.contains(_liquidity)) {\\n TickCache memory _tickCache = observeLiquidity(_liquidity);\\n if (_tickCache.period != 0) {\\n int56 _tickDifference = _isKP3RToken0[_liquidity] ? _tickCache.difference : -_tickCache.difference;\\n return _getReward(IKeep3rHelper(keep3rHelper).getKP3RsAtTick(_amount, _tickDifference, rewardPeriodTime));\\n }\\n }\\n }\\n\\n /// @inheritdoc IKeep3rJobFundableLiquidity\\n function observeLiquidity(address _liquidity) public view virtual override returns (TickCache memory _tickCache) {\\n if (_tick[_liquidity].period == _period(block.timestamp)) {\\n // Will return cached twaps if liquidity is updated\\n _tickCache = _tick[_liquidity];\\n } else {\\n bool success;\\n uint256 lastPeriod = _period(block.timestamp - rewardPeriodTime);\\n\\n if (_tick[_liquidity].period == lastPeriod) {\\n // Will only ask for current period accumulator if liquidity is outdated\\n uint32[] memory _secondsAgo = new uint32[](1);\\n int56 previousTick = _tick[_liquidity].current;\\n\\n _secondsAgo[0] = uint32(block.timestamp - _period(block.timestamp));\\n\\n (_tickCache.current, , success) = IKeep3rHelper(keep3rHelper).observe(_liquidityPool[_liquidity], _secondsAgo);\\n\\n _tickCache.difference = _tickCache.current - previousTick;\\n } else if (_tick[_liquidity].period < lastPeriod) {\\n // Will ask for 2 accumulators if liquidity is expired\\n uint32[] memory _secondsAgo = new uint32[](2);\\n\\n _secondsAgo[0] = uint32(block.timestamp - _period(block.timestamp));\\n _secondsAgo[1] = uint32(block.timestamp - _period(block.timestamp) + rewardPeriodTime);\\n\\n int56 _tickCumulative2;\\n (_tickCache.current, _tickCumulative2, success) = IKeep3rHelper(keep3rHelper).observe(_liquidityPool[_liquidity], _secondsAgo);\\n\\n _tickCache.difference = _tickCache.current - _tickCumulative2;\\n }\\n if (success) {\\n _tickCache.period = _period(block.timestamp);\\n } else {\\n delete _tickCache.period;\\n }\\n }\\n }\\n\\n // Methods\\n\\n /// @inheritdoc IKeep3rJobFundableLiquidity\\n function forceLiquidityCreditsToJob(address _job, uint256 _amount) external override onlyGovernance {\\n if (!_jobs.contains(_job)) revert JobUnavailable();\\n _settleJobAccountance(_job);\\n _jobLiquidityCredits[_job] += _amount;\\n emit LiquidityCreditsForced(_job, rewardedAt[_job], _jobLiquidityCredits[_job]);\\n }\\n\\n /// @inheritdoc IKeep3rJobFundableLiquidity\\n function approveLiquidity(address _liquidity) external virtual override onlyGovernance {\\n if (!_approvedLiquidities.add(_liquidity)) revert LiquidityPairApproved();\\n _liquidityPool[_liquidity] = IPairManager(_liquidity).pool();\\n _isKP3RToken0[_liquidity] = IKeep3rHelper(keep3rHelper).isKP3RToken0(_liquidityPool[_liquidity]);\\n _tick[_liquidity] = observeLiquidity(_liquidity);\\n emit LiquidityApproval(_liquidity);\\n }\\n\\n /// @inheritdoc IKeep3rJobFundableLiquidity\\n function revokeLiquidity(address _liquidity) external override onlyGovernance {\\n if (!_approvedLiquidities.remove(_liquidity)) revert LiquidityPairUnexistent();\\n delete _liquidityPool[_liquidity];\\n delete _isKP3RToken0[_liquidity];\\n delete _tick[_liquidity];\\n\\n emit LiquidityRevocation(_liquidity);\\n }\\n\\n /// @inheritdoc IKeep3rJobFundableLiquidity\\n function addLiquidityToJob(\\n address _job,\\n address _liquidity,\\n uint256 _amount\\n ) external override nonReentrant {\\n if (!_approvedLiquidities.contains(_liquidity)) revert LiquidityPairUnapproved();\\n if (!_jobs.contains(_job)) revert JobUnavailable();\\n\\n _jobLiquidities[_job].add(_liquidity);\\n\\n _settleJobAccountance(_job);\\n\\n if (_quoteLiquidity(liquidityAmount[_job][_liquidity] + _amount, _liquidity) < liquidityMinimum) revert JobLiquidityLessThanMin();\\n\\n emit LiquidityCreditsReward(_job, rewardedAt[_job], _jobLiquidityCredits[_job], _jobPeriodCredits[_job]);\\n\\n IERC20(_liquidity).safeTransferFrom(msg.sender, address(this), _amount);\\n liquidityAmount[_job][_liquidity] += _amount;\\n _jobPeriodCredits[_job] += _getReward(_quoteLiquidity(_amount, _liquidity));\\n emit LiquidityAddition(_job, _liquidity, msg.sender, _amount);\\n }\\n\\n /// @inheritdoc IKeep3rJobFundableLiquidity\\n function unbondLiquidityFromJob(\\n address _job,\\n address _liquidity,\\n uint256 _amount\\n ) external override onlyJobOwner(_job) {\\n canWithdrawAfter[_job][_liquidity] = block.timestamp + unbondTime;\\n pendingUnbonds[_job][_liquidity] += _amount;\\n _unbondLiquidityFromJob(_job, _liquidity, _amount);\\n\\n uint256 _remainingLiquidity = liquidityAmount[_job][_liquidity];\\n if (_remainingLiquidity > 0 && _quoteLiquidity(_remainingLiquidity, _liquidity) < liquidityMinimum) revert JobLiquidityLessThanMin();\\n\\n emit Unbonding(_job, _liquidity, _amount);\\n }\\n\\n /// @inheritdoc IKeep3rJobFundableLiquidity\\n function withdrawLiquidityFromJob(\\n address _job,\\n address _liquidity,\\n address _receiver\\n ) external override onlyJobOwner(_job) {\\n if (_receiver == address(0)) revert ZeroAddress();\\n if (pendingUnbonds[_job][_liquidity] == 0) revert UnbondsUnexistent();\\n if (canWithdrawAfter[_job][_liquidity] >= block.timestamp) revert UnbondsLocked();\\n if (disputes[_job]) revert Disputed();\\n\\n uint256 _amount = pendingUnbonds[_job][_liquidity];\\n\\n delete pendingUnbonds[_job][_liquidity];\\n delete canWithdrawAfter[_job][_liquidity];\\n\\n IERC20(_liquidity).safeTransfer(_receiver, _amount);\\n emit LiquidityWithdrawal(_job, _liquidity, _receiver, _amount);\\n }\\n\\n // Internal functions\\n\\n /// @notice Updates or rewards job liquidity credits depending on time since last job reward\\n function _updateJobCreditsIfNeeded(address _job) internal returns (bool _rewarded) {\\n if (rewardedAt[_job] < _period(block.timestamp)) {\\n // Will exit function if job has been rewarded in current period\\n if (rewardedAt[_job] <= _period(block.timestamp - rewardPeriodTime)) {\\n // Will reset job to period syncronicity if a full period passed without rewards\\n _updateJobPeriod(_job);\\n _jobLiquidityCredits[_job] = _jobPeriodCredits[_job];\\n rewardedAt[_job] = _period(block.timestamp);\\n _rewarded = true;\\n } else if ((block.timestamp - rewardedAt[_job]) >= rewardPeriodTime) {\\n // Will reset job's syncronicity if last reward was more than epoch ago\\n _updateJobPeriod(_job);\\n _jobLiquidityCredits[_job] = _jobPeriodCredits[_job];\\n rewardedAt[_job] += rewardPeriodTime;\\n _rewarded = true;\\n } else if (workedAt[_job] < _period(block.timestamp)) {\\n // First keeper on period has to update job accountance to current twaps\\n uint256 previousPeriodCredits = _jobPeriodCredits[_job];\\n _updateJobPeriod(_job);\\n _jobLiquidityCredits[_job] = (_jobLiquidityCredits[_job] * _jobPeriodCredits[_job]) / previousPeriodCredits;\\n // Updating job accountance does not reward job\\n }\\n }\\n }\\n\\n /// @notice Only called if _jobLiquidityCredits < payment\\n function _rewardJobCredits(address _job) internal {\\n /// @notice Only way to += jobLiquidityCredits is when keeper rewarding (cannot pay work)\\n /* WARNING: this allows to top up _jobLiquidityCredits to a max of 1.99 but have to spend at least 1 */\\n _jobLiquidityCredits[_job] += _phase(block.timestamp - rewardedAt[_job], _jobPeriodCredits[_job]);\\n rewardedAt[_job] = block.timestamp;\\n }\\n\\n /// @notice Updates accountance for _jobPeriodCredits\\n function _updateJobPeriod(address _job) internal {\\n _jobPeriodCredits[_job] = _calculateJobPeriodCredits(_job);\\n }\\n\\n /// @notice Quotes the outdated job liquidities and calculates _periodCredits\\n /// @dev This function is also responsible for keeping the KP3R/WETH quote updated\\n function _calculateJobPeriodCredits(address _job) internal returns (uint256 _periodCredits) {\\n for (uint256 i; i < _jobLiquidities[_job].length(); i++) {\\n address _liquidity = _jobLiquidities[_job].at(i);\\n if (_approvedLiquidities.contains(_liquidity)) {\\n if (_tick[_liquidity].period != _period(block.timestamp)) {\\n // Updates liquidity cache only if needed\\n _tick[_liquidity] = observeLiquidity(_liquidity);\\n }\\n _periodCredits += _getReward(_quoteLiquidity(liquidityAmount[_job][_liquidity], _liquidity));\\n }\\n }\\n }\\n\\n /// @notice Updates job accountance calculating the impact of the unbonded liquidity amount\\n function _unbondLiquidityFromJob(\\n address _job,\\n address _liquidity,\\n uint256 _amount\\n ) internal nonReentrant {\\n if (!_jobLiquidities[_job].contains(_liquidity)) revert JobLiquidityUnexistent();\\n if (liquidityAmount[_job][_liquidity] < _amount) revert JobLiquidityInsufficient();\\n\\n // Ensures current twaps in job liquidities\\n _updateJobPeriod(_job);\\n uint256 _periodCreditsToRemove = _getReward(_quoteLiquidity(_amount, _liquidity));\\n\\n // A liquidity can be revoked causing a job to have 0 periodCredits\\n if (_jobPeriodCredits[_job] > 0) {\\n // Removes a % correspondant to a full rewardPeriodTime for the liquidity withdrawn vs all of the liquidities\\n _jobLiquidityCredits[_job] -= (_jobLiquidityCredits[_job] * _periodCreditsToRemove) / _jobPeriodCredits[_job];\\n _jobPeriodCredits[_job] -= _periodCreditsToRemove;\\n }\\n\\n liquidityAmount[_job][_liquidity] -= _amount;\\n if (liquidityAmount[_job][_liquidity] == 0) {\\n _jobLiquidities[_job].remove(_liquidity);\\n }\\n }\\n\\n /// @notice Returns a fraction of the multiplier or the whole multiplier if equal or more than a rewardPeriodTime has passed\\n function _phase(uint256 _timePassed, uint256 _multiplier) internal view returns (uint256 _result) {\\n if (_timePassed < rewardPeriodTime) {\\n _result = (_timePassed * _multiplier) / rewardPeriodTime;\\n } else _result = _multiplier;\\n }\\n\\n /// @notice Returns the start of the period of the provided timestamp\\n function _period(uint256 _timestamp) internal view returns (uint256 _periodTimestamp) {\\n return _timestamp - (_timestamp % rewardPeriodTime);\\n }\\n\\n /// @notice Calculates relation between rewardPeriod and inflationPeriod\\n function _getReward(uint256 _baseAmount) internal view returns (uint256 _credits) {\\n return FullMath.mulDiv(_baseAmount, rewardPeriodTime, inflationPeriod);\\n }\\n\\n /// @notice Returns underlying KP3R amount for a given liquidity amount\\n function _quoteLiquidity(uint256 _amount, address _liquidity) internal view returns (uint256 _quote) {\\n if (_tick[_liquidity].period != 0) {\\n int56 _tickDifference = _isKP3RToken0[_liquidity] ? _tick[_liquidity].difference : -_tick[_liquidity].difference;\\n _quote = IKeep3rHelper(keep3rHelper).getKP3RsAtTick(_amount, _tickDifference, rewardPeriodTime);\\n }\\n }\\n\\n /// @notice Updates job credits to current quotes and rewards job's pending minted credits\\n /// @dev Ensures a maximum of 1 period of credits\\n function _settleJobAccountance(address _job) internal virtual {\\n _updateJobCreditsIfNeeded(_job);\\n _rewardJobCredits(_job);\\n _jobLiquidityCredits[_job] = Math.min(_jobLiquidityCredits[_job], _jobPeriodCredits[_job]);\\n }\\n}\\n\",\"keccak256\":\"0xe3b244460364baf1ea293db6f6feba8365fd376320ad77ae6d6813ed65b52929\",\"license\":\"MIT\"},\"solidity/contracts/peripherals/jobs/Keep3rJobManager.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4 <0.9.0;\\n\\nimport './Keep3rJobOwnership.sol';\\nimport '../Keep3rAccountance.sol';\\nimport '../../../interfaces/peripherals/IKeep3rJobs.sol';\\n\\nabstract contract Keep3rJobManager is IKeep3rJobManager, Keep3rJobOwnership, Keep3rAccountance {\\n using EnumerableSet for EnumerableSet.AddressSet;\\n\\n /// @inheritdoc IKeep3rJobManager\\n function addJob(address _job) external override {\\n if (_jobs.contains(_job)) revert JobAlreadyAdded();\\n if (hasBonded[_job]) revert AlreadyAKeeper();\\n _jobs.add(_job);\\n jobOwner[_job] = msg.sender;\\n emit JobAddition(_job, msg.sender);\\n }\\n}\\n\",\"keccak256\":\"0xf6e1577a6a34b674ca34a6d7530dc81349e3ad13d321281c37e0b25b7325d013\",\"license\":\"MIT\"},\"solidity/contracts/peripherals/jobs/Keep3rJobMigration.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4 <0.9.0;\\n\\nimport '../../../interfaces/peripherals/IKeep3rJobs.sol';\\nimport './Keep3rJobFundableCredits.sol';\\nimport './Keep3rJobFundableLiquidity.sol';\\n\\nabstract contract Keep3rJobMigration is IKeep3rJobMigration, Keep3rJobFundableCredits, Keep3rJobFundableLiquidity {\\n using EnumerableSet for EnumerableSet.AddressSet;\\n\\n uint256 internal constant _MIGRATION_COOLDOWN = 1 minutes;\\n\\n /// @inheritdoc IKeep3rJobMigration\\n mapping(address => address) public override pendingJobMigrations;\\n mapping(address => mapping(address => uint256)) internal _migrationCreatedAt;\\n\\n /// @inheritdoc IKeep3rJobMigration\\n function migrateJob(address _fromJob, address _toJob) external override onlyJobOwner(_fromJob) {\\n if (_fromJob == _toJob) revert JobMigrationImpossible();\\n\\n pendingJobMigrations[_fromJob] = _toJob;\\n _migrationCreatedAt[_fromJob][_toJob] = block.timestamp;\\n\\n emit JobMigrationRequested(_fromJob, _toJob);\\n }\\n\\n /// @inheritdoc IKeep3rJobMigration\\n function acceptJobMigration(address _fromJob, address _toJob) external override onlyJobOwner(_toJob) {\\n if (disputes[_fromJob] || disputes[_toJob]) revert JobDisputed();\\n if (pendingJobMigrations[_fromJob] != _toJob) revert JobMigrationUnavailable();\\n if (block.timestamp < _migrationCreatedAt[_fromJob][_toJob] + _MIGRATION_COOLDOWN) revert JobMigrationLocked();\\n\\n // force job credits update for both jobs\\n _settleJobAccountance(_fromJob);\\n _settleJobAccountance(_toJob);\\n\\n // migrate tokens\\n while (_jobTokens[_fromJob].length() > 0) {\\n address _tokenToMigrate = _jobTokens[_fromJob].at(0);\\n jobTokenCredits[_toJob][_tokenToMigrate] += jobTokenCredits[_fromJob][_tokenToMigrate];\\n delete jobTokenCredits[_fromJob][_tokenToMigrate];\\n _jobTokens[_fromJob].remove(_tokenToMigrate);\\n _jobTokens[_toJob].add(_tokenToMigrate);\\n }\\n\\n // migrate liquidities\\n while (_jobLiquidities[_fromJob].length() > 0) {\\n address _liquidity = _jobLiquidities[_fromJob].at(0);\\n\\n liquidityAmount[_toJob][_liquidity] += liquidityAmount[_fromJob][_liquidity];\\n delete liquidityAmount[_fromJob][_liquidity];\\n\\n _jobLiquidities[_toJob].add(_liquidity);\\n _jobLiquidities[_fromJob].remove(_liquidity);\\n }\\n\\n // migrate job balances\\n _jobPeriodCredits[_toJob] += _jobPeriodCredits[_fromJob];\\n delete _jobPeriodCredits[_fromJob];\\n\\n _jobLiquidityCredits[_toJob] += _jobLiquidityCredits[_fromJob];\\n delete _jobLiquidityCredits[_fromJob];\\n\\n // stop _fromJob from being a job\\n delete rewardedAt[_fromJob];\\n _jobs.remove(_fromJob);\\n\\n // delete unused data slots\\n delete jobOwner[_fromJob];\\n delete jobPendingOwner[_fromJob];\\n delete _migrationCreatedAt[_fromJob][_toJob];\\n delete pendingJobMigrations[_fromJob];\\n\\n emit JobMigrationSuccessful(_fromJob, _toJob);\\n }\\n}\\n\",\"keccak256\":\"0xd46c3c9ce970098d8d75f11966894a341824aceb40583fcfbbc0ebda93d869f9\",\"license\":\"MIT\"},\"solidity/contracts/peripherals/jobs/Keep3rJobOwnership.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4 <0.9.0;\\n\\nimport '../../../interfaces/peripherals/IKeep3rJobs.sol';\\n\\nabstract contract Keep3rJobOwnership is IKeep3rJobOwnership {\\n /// @inheritdoc IKeep3rJobOwnership\\n mapping(address => address) public override jobOwner;\\n\\n /// @inheritdoc IKeep3rJobOwnership\\n mapping(address => address) public override jobPendingOwner;\\n\\n /// @inheritdoc IKeep3rJobOwnership\\n function changeJobOwnership(address _job, address _newOwner) external override onlyJobOwner(_job) {\\n jobPendingOwner[_job] = _newOwner;\\n emit JobOwnershipChange(_job, jobOwner[_job], _newOwner);\\n }\\n\\n /// @inheritdoc IKeep3rJobOwnership\\n function acceptJobOwnership(address _job) external override onlyPendingJobOwner(_job) {\\n address _previousOwner = jobOwner[_job];\\n\\n jobOwner[_job] = jobPendingOwner[_job];\\n delete jobPendingOwner[_job];\\n\\n emit JobOwnershipAssent(msg.sender, _job, _previousOwner);\\n }\\n\\n modifier onlyJobOwner(address _job) {\\n if (msg.sender != jobOwner[_job]) revert OnlyJobOwner();\\n _;\\n }\\n\\n modifier onlyPendingJobOwner(address _job) {\\n if (msg.sender != jobPendingOwner[_job]) revert OnlyPendingJobOwner();\\n _;\\n }\\n}\\n\",\"keccak256\":\"0xa837590ade9cd5d25690e3f2d8b9a63e7202f7179b32e42eab4fa4c4324b9728\",\"license\":\"MIT\"},\"solidity/contracts/peripherals/jobs/Keep3rJobWorkable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4 <0.9.0;\\n\\nimport './Keep3rJobMigration.sol';\\nimport '../../../interfaces/IKeep3rHelper.sol';\\nimport '../../../interfaces/peripherals/IKeep3rJobs.sol';\\n\\nimport '@openzeppelin/contracts/token/ERC20/IERC20.sol';\\nimport '@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol';\\n\\nabstract contract Keep3rJobWorkable is IKeep3rJobWorkable, Keep3rJobMigration {\\n using EnumerableSet for EnumerableSet.AddressSet;\\n using SafeERC20 for IERC20;\\n\\n uint256 internal _initialGas;\\n\\n /// @inheritdoc IKeep3rJobWorkable\\n function isKeeper(address _keeper) external override returns (bool _isKeeper) {\\n _initialGas = _getGasLeft();\\n if (_keepers.contains(_keeper)) {\\n emit KeeperValidation(_initialGas);\\n return true;\\n }\\n }\\n\\n /// @inheritdoc IKeep3rJobWorkable\\n function isBondedKeeper(\\n address _keeper,\\n address _bond,\\n uint256 _minBond,\\n uint256 _earned,\\n uint256 _age\\n ) external override returns (bool _isBondedKeeper) {\\n _initialGas = _getGasLeft();\\n if (\\n _keepers.contains(_keeper) &&\\n bonds[_keeper][_bond] >= _minBond &&\\n workCompleted[_keeper] >= _earned &&\\n block.timestamp - firstSeen[_keeper] >= _age\\n ) {\\n emit KeeperValidation(_initialGas);\\n return true;\\n }\\n }\\n\\n /// @inheritdoc IKeep3rJobWorkable\\n function worked(address _keeper) external virtual override {\\n if (_initialGas == 0) revert GasNotInitialized();\\n address _job = msg.sender;\\n if (disputes[_job]) revert JobDisputed();\\n if (!_jobs.contains(_job)) revert JobUnapproved();\\n\\n if (_updateJobCreditsIfNeeded(_job)) {\\n emit LiquidityCreditsReward(_job, rewardedAt[_job], _jobLiquidityCredits[_job], _jobPeriodCredits[_job]);\\n }\\n\\n (uint256 _boost, uint256 _oneEthQuote, uint256 _extraGas) = IKeep3rHelper(keep3rHelper).getPaymentParams(bonds[_keeper][keep3rV1]);\\n\\n uint256 _gasLeft = _getGasLeft();\\n uint256 _payment = _calculatePayment(_gasLeft, _extraGas, _oneEthQuote, _boost);\\n\\n if (_payment > _jobLiquidityCredits[_job]) {\\n _rewardJobCredits(_job);\\n emit LiquidityCreditsReward(_job, rewardedAt[_job], _jobLiquidityCredits[_job], _jobPeriodCredits[_job]);\\n\\n _gasLeft = _getGasLeft();\\n _payment = _calculatePayment(_gasLeft, _extraGas, _oneEthQuote, _boost);\\n }\\n\\n _bondedPayment(_job, _keeper, _payment);\\n delete _initialGas;\\n\\n emit KeeperWork(keep3rV1, _job, _keeper, _payment, _gasLeft);\\n }\\n\\n /// @inheritdoc IKeep3rJobWorkable\\n function bondedPayment(address _keeper, uint256 _payment) external override {\\n address _job = msg.sender;\\n\\n if (disputes[_job]) revert JobDisputed();\\n if (!_jobs.contains(_job)) revert JobUnapproved();\\n\\n if (_updateJobCreditsIfNeeded(_job)) {\\n emit LiquidityCreditsReward(_job, rewardedAt[_job], _jobLiquidityCredits[_job], _jobPeriodCredits[_job]);\\n }\\n\\n if (_payment > _jobLiquidityCredits[_job]) {\\n _rewardJobCredits(_job);\\n emit LiquidityCreditsReward(_job, rewardedAt[_job], _jobLiquidityCredits[_job], _jobPeriodCredits[_job]);\\n }\\n\\n _bondedPayment(_job, _keeper, _payment);\\n emit KeeperWork(keep3rV1, _job, _keeper, _payment, _getGasLeft());\\n }\\n\\n /// @inheritdoc IKeep3rJobWorkable\\n function directTokenPayment(\\n address _token,\\n address _keeper,\\n uint256 _amount\\n ) external override {\\n address _job = msg.sender;\\n\\n if (disputes[_job]) revert JobDisputed();\\n if (disputes[_keeper]) revert Disputed();\\n if (!_jobs.contains(_job)) revert JobUnapproved();\\n if (jobTokenCredits[_job][_token] < _amount) revert InsufficientFunds();\\n jobTokenCredits[_job][_token] -= _amount;\\n IERC20(_token).safeTransfer(_keeper, _amount);\\n emit KeeperWork(_token, _job, _keeper, _amount, _getGasLeft());\\n }\\n\\n function _bondedPayment(\\n address _job,\\n address _keeper,\\n uint256 _payment\\n ) internal {\\n if (_payment > _jobLiquidityCredits[_job]) revert InsufficientFunds();\\n\\n workedAt[_job] = block.timestamp;\\n _jobLiquidityCredits[_job] -= _payment;\\n bonds[_keeper][keep3rV1] += _payment;\\n workCompleted[_keeper] += _payment;\\n totalBonds += _payment;\\n }\\n\\n /// @notice Calculate amount to be payed in KP3R, taking into account multiple parameters\\n /// @param _gasLeft Amount of gas left after working the job\\n /// @param _extraGas Amount of expected unaccounted gas\\n /// @param _oneEthQuote Amount of KP3R equivalent to 1 ETH\\n /// @param _boost Reward given to the keeper for having bonded KP3R tokens\\n /// @return _payment Amount to be payed in KP3R tokens\\n function _calculatePayment(\\n uint256 _gasLeft,\\n uint256 _extraGas,\\n uint256 _oneEthQuote,\\n uint256 _boost\\n ) internal view returns (uint256 _payment) {\\n uint256 _accountedGas = _initialGas - _gasLeft + _extraGas;\\n _payment = (((_accountedGas * _boost) / _BASE) * _oneEthQuote) / 1 ether;\\n }\\n\\n /// @notice Return the gas left and add 1/64 in order to match real gas left at first level of depth (EIP-150)\\n /// @return _gasLeft Amount of gas left recording taking into account EIP-150\\n function _getGasLeft() internal view returns (uint256 _gasLeft) {\\n _gasLeft = (gasleft() * 64) / 63;\\n }\\n}\\n\",\"keccak256\":\"0x7e113a0815d9125e760ee75c9d9c55fc93192ae2535afccdb8835984d17b510f\",\"license\":\"MIT\"},\"solidity/contracts/peripherals/jobs/Keep3rJobs.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4 <0.9.0;\\n\\nimport '../../../interfaces/peripherals/IKeep3rJobs.sol';\\nimport './Keep3rJobManager.sol';\\nimport './Keep3rJobWorkable.sol';\\nimport './Keep3rJobDisputable.sol';\\n\\nabstract contract Keep3rJobs is IKeep3rJobs, Keep3rJobManager, Keep3rJobWorkable, Keep3rJobDisputable {}\\n\",\"keccak256\":\"0x882e1a19891795de04c4c891dc58d50034ca0a32c8b61651aaf0f47d0bc321d4\",\"license\":\"MIT\"},\"solidity/contracts/peripherals/keepers/Keep3rKeeperDisputable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4 <0.9.0;\\n\\nimport './Keep3rKeeperFundable.sol';\\nimport '../Keep3rDisputable.sol';\\nimport '../../../interfaces/external/IKeep3rV1.sol';\\nimport '../../../interfaces/peripherals/IKeep3rKeepers.sol';\\n\\nabstract contract Keep3rKeeperDisputable is IKeep3rKeeperDisputable, Keep3rDisputable, Keep3rKeeperFundable {\\n using EnumerableSet for EnumerableSet.AddressSet;\\n using SafeERC20 for IERC20;\\n\\n /// @inheritdoc IKeep3rKeeperDisputable\\n function slash(\\n address _keeper,\\n address _bonded,\\n uint256 _bondAmount,\\n uint256 _unbondAmount\\n ) external override onlySlasher {\\n if (!disputes[_keeper]) revert NotDisputed();\\n _slash(_keeper, _bonded, _bondAmount, _unbondAmount);\\n emit KeeperSlash(_keeper, msg.sender, _bondAmount + _unbondAmount);\\n }\\n\\n /// @inheritdoc IKeep3rKeeperDisputable\\n function revoke(address _keeper) external override onlySlasher {\\n if (!disputes[_keeper]) revert NotDisputed();\\n _keepers.remove(_keeper);\\n _slash(_keeper, keep3rV1, bonds[_keeper][keep3rV1], pendingUnbonds[_keeper][keep3rV1]);\\n emit KeeperRevoke(_keeper, msg.sender);\\n }\\n\\n function _slash(\\n address _keeper,\\n address _bonded,\\n uint256 _bondAmount,\\n uint256 _unbondAmount\\n ) internal {\\n if (_bonded != keep3rV1) {\\n try IERC20(_bonded).transfer(governance, _bondAmount + _unbondAmount) returns (bool) {} catch (bytes memory) {}\\n }\\n bonds[_keeper][_bonded] -= _bondAmount;\\n pendingUnbonds[_keeper][_bonded] -= _unbondAmount;\\n }\\n}\\n\",\"keccak256\":\"0xa15b13218af4331d1fb3e8cfdfa9b69117f291ac9a462ede6b1b4fb5be8967de\",\"license\":\"MIT\"},\"solidity/contracts/peripherals/keepers/Keep3rKeeperFundable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4 <0.9.0;\\n\\nimport '../Keep3rAccountance.sol';\\nimport '../Keep3rParameters.sol';\\nimport '../../../interfaces/peripherals/IKeep3rKeepers.sol';\\n\\nimport '../../../interfaces/external/IKeep3rV1.sol';\\n\\nimport '@openzeppelin/contracts/security/ReentrancyGuard.sol';\\nimport '@openzeppelin/contracts/token/ERC20/IERC20.sol';\\nimport '@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol';\\n\\nabstract contract Keep3rKeeperFundable is IKeep3rKeeperFundable, ReentrancyGuard, Keep3rParameters {\\n using EnumerableSet for EnumerableSet.AddressSet;\\n using SafeERC20 for IERC20;\\n\\n /// @inheritdoc IKeep3rKeeperFundable\\n function bond(address _bonding, uint256 _amount) external override nonReentrant {\\n if (disputes[msg.sender]) revert Disputed();\\n if (_jobs.contains(msg.sender)) revert AlreadyAJob();\\n canActivateAfter[msg.sender][_bonding] = block.timestamp + bondTime;\\n\\n uint256 _before = IERC20(_bonding).balanceOf(address(this));\\n IERC20(_bonding).safeTransferFrom(msg.sender, address(this), _amount);\\n _amount = IERC20(_bonding).balanceOf(address(this)) - _before;\\n\\n hasBonded[msg.sender] = true;\\n pendingBonds[msg.sender][_bonding] += _amount;\\n\\n emit Bonding(msg.sender, _bonding, _amount);\\n }\\n\\n /// @inheritdoc IKeep3rKeeperFundable\\n function activate(address _bonding) external override {\\n address _keeper = msg.sender;\\n if (disputes[_keeper]) revert Disputed();\\n uint256 _canActivateAfter = canActivateAfter[_keeper][_bonding];\\n if (_canActivateAfter == 0) revert BondsUnexistent();\\n if (_canActivateAfter >= block.timestamp) revert BondsLocked();\\n\\n if (firstSeen[_keeper] == 0) {\\n firstSeen[_keeper] = block.timestamp;\\n }\\n _keepers.add(_keeper);\\n\\n uint256 _amount = pendingBonds[_keeper][_bonding];\\n delete pendingBonds[_keeper][_bonding];\\n\\n // bond provided tokens\\n bonds[_keeper][_bonding] += _amount;\\n if (_bonding == keep3rV1) {\\n totalBonds += _amount;\\n _depositBonds(_amount);\\n }\\n\\n emit Activation(_keeper, _bonding, _amount);\\n }\\n\\n /// @inheritdoc IKeep3rKeeperFundable\\n function unbond(address _bonding, uint256 _amount) external override {\\n canWithdrawAfter[msg.sender][_bonding] = block.timestamp + unbondTime;\\n bonds[msg.sender][_bonding] -= _amount;\\n pendingUnbonds[msg.sender][_bonding] += _amount;\\n\\n emit Unbonding(msg.sender, _bonding, _amount);\\n }\\n\\n /// @inheritdoc IKeep3rKeeperFundable\\n function withdraw(address _bonding) external override nonReentrant {\\n if (pendingUnbonds[msg.sender][_bonding] == 0) revert UnbondsUnexistent();\\n if (canWithdrawAfter[msg.sender][_bonding] >= block.timestamp) revert UnbondsLocked();\\n if (disputes[msg.sender]) revert Disputed();\\n\\n uint256 _amount = pendingUnbonds[msg.sender][_bonding];\\n\\n delete pendingUnbonds[msg.sender][_bonding];\\n delete canWithdrawAfter[msg.sender][_bonding];\\n\\n if (_bonding == keep3rV1) _mint(_amount);\\n IERC20(_bonding).safeTransfer(msg.sender, _amount);\\n\\n emit Withdrawal(msg.sender, _bonding, _amount);\\n }\\n\\n function _depositBonds(uint256 _amount) internal virtual {\\n IKeep3rV1(keep3rV1).burn(_amount);\\n }\\n}\\n\",\"keccak256\":\"0x121dc11fa555731679912d54da3bb8282d26ad425deffae6d4d7085ef3c9290d\",\"license\":\"MIT\"},\"solidity/contracts/peripherals/keepers/Keep3rKeepers.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4 <0.9.0;\\n\\nimport '../../../interfaces/peripherals/IKeep3rKeepers.sol';\\nimport './Keep3rKeeperDisputable.sol';\\n\\nabstract contract Keep3rKeepers is IKeep3rKeepers, Keep3rKeeperDisputable {}\\n\",\"keccak256\":\"0xfc762d9fd6ff478acba446c3ab6fc19c7d49a85de097dc35f02c56e928153c5e\",\"license\":\"MIT\"},\"solidity/for-test/testnet/Keep3rForTestnet.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4 <0.9.0;\\n\\nimport '../../contracts/Keep3r.sol';\\n\\ncontract Keep3rForTestnet is Keep3r {\\n constructor(\\n address _governance,\\n address _keep3rHelper,\\n address _keep3rV1,\\n address _keep3rV1Proxy\\n ) Keep3r(_governance, _keep3rHelper, _keep3rV1, _keep3rV1Proxy) {\\n bondTime = 0; // allows keepers to instantly register\\n unbondTime = 0; // allows keepers & jobOwners to instantly withdraw funds\\n liquidityMinimum = 1; // allows job providers to add low liquidity\\n rewardPeriodTime = 1 days; // reduces twap calculation period\\n inflationPeriod = 5 days; // increases credit minting\\n }\\n}\\n\",\"keccak256\":\"0x4465378f7a00fc8d5d8eedf470fe039bdcf6e56e5eb68160932c80e70951420b\",\"license\":\"MIT\"},\"solidity/interfaces/IKeep3r.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4 <0.9.0;\\n\\nimport './peripherals/IKeep3rJobs.sol';\\nimport './peripherals/IKeep3rKeepers.sol';\\nimport './peripherals/IKeep3rParameters.sol';\\n\\n// solhint-disable-next-line no-empty-blocks\\n\\n/// @title Keep3rV2 contract\\n/// @notice This contract inherits all the functionality of Keep3rV2\\ninterface IKeep3r is IKeep3rJobs, IKeep3rKeepers, IKeep3rParameters {\\n\\n}\\n\",\"keccak256\":\"0x273a39984c1475c60182e636bb91a1b89ec98646a036cac6a87067869b3adeb9\",\"license\":\"MIT\"},\"solidity/interfaces/IKeep3rHelper.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4 <0.9.0;\\n\\nimport './IKeep3rHelperParameters.sol';\\n\\n/// @title Keep3rHelper contract\\n/// @notice Contains all the helper functions used throughout the different files.\\ninterface IKeep3rHelper is IKeep3rHelperParameters {\\n // Errors\\n\\n /// @notice Throws when none of the tokens in the liquidity pair is KP3R\\n error LiquidityPairInvalid();\\n\\n // Methods\\n // solhint-enable func-name-mixedcase\\n\\n /// @notice Calculates the amount of KP3R that corresponds to the ETH passed into the function\\n /// @dev This function allows us to calculate how much KP3R we should pay to a keeper for things expressed in ETH, like gas\\n /// @param _eth The amount of ETH\\n /// @return _amountOut The amount of KP3R\\n function quote(uint256 _eth) external view returns (uint256 _amountOut);\\n\\n /// @notice Returns the amount of KP3R the keeper has bonded\\n /// @param _keeper The address of the keeper to check\\n /// @return _amountBonded The amount of KP3R the keeper has bonded\\n function bonds(address _keeper) external view returns (uint256 _amountBonded);\\n\\n /// @notice Calculates the reward (in KP3R) that corresponds to a keeper for using gas\\n /// @param _keeper The address of the keeper to check\\n /// @param _gasUsed The amount of gas used that will be rewarded\\n /// @return _kp3r The amount of KP3R that should be awarded to the keeper\\n function getRewardAmountFor(address _keeper, uint256 _gasUsed) external view returns (uint256 _kp3r);\\n\\n /// @notice Calculates the boost in the reward given to a keeper based on the amount of KP3R that keeper has bonded\\n /// @dev If the keeper has no bonds, boost should be +10% of gas cost, if keeper has max bonds, +20%\\n /// @param _bonds The amount of KP3R tokens bonded by the keeper\\n /// @return _rewardBoost The reward boost that corresponds to the keeper\\n function getRewardBoostFor(uint256 _bonds) external view returns (uint256 _rewardBoost);\\n\\n /// @notice Calculates the reward (in KP3R) that corresponds to tx.origin for using gas\\n /// @param _gasUsed The amount of gas used that will be rewarded\\n /// @return _amount The amount of KP3R that should be awarded to tx.origin\\n function getRewardAmount(uint256 _gasUsed) external view returns (uint256 _amount);\\n\\n /// @notice Given a pool address, returns the underlying tokens of the pair\\n /// @param _pool Address of the correspondant pool\\n /// @return _token0 Address of the first token of the pair\\n /// @return _token1 Address of the second token of the pair\\n function getPoolTokens(address _pool) external view returns (address _token0, address _token1);\\n\\n /// @notice Defines the order of the tokens in the pair for twap calculations\\n /// @param _pool Address of the correspondant pool\\n /// @return _isKP3RToken0 Boolean indicating the order of the tokens in the pair\\n function isKP3RToken0(address _pool) external view returns (bool _isKP3RToken0);\\n\\n /// @notice Given an array of secondsAgo, returns UniswapV3 pool cumulatives at that moment\\n /// @param _pool Address of the pool to observe\\n /// @param _secondsAgo Array with time references to observe\\n /// @return _tickCumulative1 Cumulative sum of ticks until first time reference\\n /// @return _tickCumulative2 Cumulative sum of ticks until second time reference\\n /// @return _success Boolean indicating if the observe call was succesfull\\n function observe(address _pool, uint32[] memory _secondsAgo)\\n external\\n view\\n returns (\\n int56 _tickCumulative1,\\n int56 _tickCumulative2,\\n bool _success\\n );\\n\\n /// @notice Get multiplier, quote, and extra, in order to calculate keeper payment\\n /// @param _bonds Amount of bonded KP3R owned by the keeper\\n /// @return _boost Multiplier per gas unit. Takes into account the base fee and the amount of bonded KP3R\\n /// @return _oneEthQuote Amount of KP3R tokens equivalent to 1 ETH\\n /// @return _extra Amount of extra gas that should be added to the gas spent\\n function getPaymentParams(uint256 _bonds)\\n external\\n view\\n returns (\\n uint256 _boost,\\n uint256 _oneEthQuote,\\n uint256 _extra\\n );\\n\\n /// @notice Given a tick and a liquidity amount, calculates the underlying KP3R tokens\\n /// @param _liquidityAmount Amount of liquidity to be converted\\n /// @param _tickDifference Tick value used to calculate the quote\\n /// @param _timeInterval Time value used to calculate the quote\\n /// @return _kp3rAmount Amount of KP3R tokens underlying on the given liquidity\\n function getKP3RsAtTick(\\n uint256 _liquidityAmount,\\n int56 _tickDifference,\\n uint256 _timeInterval\\n ) external pure returns (uint256 _kp3rAmount);\\n\\n /// @notice Given a tick and a token amount, calculates the output in correspondant token\\n /// @param _baseAmount Amount of token to be converted\\n /// @param _tickDifference Tick value used to calculate the quote\\n /// @param _timeInterval Time value used to calculate the quote\\n /// @return _quoteAmount Amount of credits deserved for the baseAmount at the tick value\\n function getQuoteAtTick(\\n uint128 _baseAmount,\\n int56 _tickDifference,\\n uint256 _timeInterval\\n ) external pure returns (uint256 _quoteAmount);\\n}\\n\",\"keccak256\":\"0x67817dc98fde9b3a917e25bc16fe60a91772dd5a77e0ce22a208b66b29d3ad8e\",\"license\":\"MIT\"},\"solidity/interfaces/IKeep3rHelperParameters.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4 <0.9.0;\\n\\n/// @title Keep3rHelperParameters contract\\n/// @notice Contains all the helper functions used throughout the different files.\\ninterface IKeep3rHelperParameters {\\n // Structs\\n\\n /// @dev KP3R-WETH Pool address and isKP3RToken0\\n /// @dev Created in order to save gas by avoiding calls to pool's token0 method\\n struct TokenOraclePool {\\n address poolAddress;\\n bool isTKNToken0;\\n }\\n\\n // Errors\\n\\n /// @notice Throws when pool does not have KP3R as token0 nor token1\\n error InvalidOraclePool();\\n\\n // Events\\n\\n /// @notice Emitted when the kp3r weth pool is changed\\n /// @param _address Address of the new kp3r weth pool\\n /// @param _isKP3RToken0 True if calling the token0 method of the pool returns the KP3R token address\\n event Kp3rWethPoolChange(address _address, bool _isKP3RToken0);\\n\\n /// @notice Emitted when the minimum boost multiplier is changed\\n /// @param _minBoost The minimum boost multiplier\\n event MinBoostChange(uint256 _minBoost);\\n\\n /// @notice Emitted when the maximum boost multiplier is changed\\n /// @param _maxBoost The maximum boost multiplier\\n event MaxBoostChange(uint256 _maxBoost);\\n\\n /// @notice Emitted when the target bond amount is changed\\n /// @param _targetBond The target bond amount\\n event TargetBondChange(uint256 _targetBond);\\n\\n /// @notice Emitted when the Keep3r V2 address is changed\\n /// @param _keep3rV2 The address of Keep3r V2\\n event Keep3rV2Change(address _keep3rV2);\\n\\n /// @notice Emitted when the work extra gas amount is changed\\n /// @param _workExtraGas The work extra gas\\n event WorkExtraGasChange(uint256 _workExtraGas);\\n\\n /// @notice Emitted when the quote twap time is changed\\n /// @param _quoteTwapTime The twap time for quoting\\n event QuoteTwapTimeChange(uint32 _quoteTwapTime);\\n\\n /// @notice Emitted when minimum rewarded gas fee is changed\\n /// @param _minBaseFee The minimum rewarded gas fee\\n event MinBaseFeeChange(uint256 _minBaseFee);\\n\\n /// @notice Emitted when minimum rewarded priority fee is changed\\n /// @param _minPriorityFee The minimum expected fee that the keeper should pay\\n event MinPriorityFeeChange(uint256 _minPriorityFee);\\n\\n // Variables\\n\\n /// @notice Address of KP3R token\\n /// @return _kp3r Address of KP3R token\\n // solhint-disable func-name-mixedcase\\n function KP3R() external view returns (address _kp3r);\\n\\n /// @notice The boost base used to calculate the boost rewards for the keeper\\n /// @return _base The boost base number\\n function BOOST_BASE() external view returns (uint256 _base);\\n\\n /// @notice KP3R-WETH pool that is being used as oracle\\n /// @return poolAddress Address of the pool\\n /// @return isTKNToken0 True if calling the token0 method of the pool returns the KP3R token address\\n function kp3rWethPool() external view returns (address poolAddress, bool isTKNToken0);\\n\\n /// @notice The minimum multiplier used to calculate the amount of gas paid to the Keeper for the gas used to perform a job\\n /// For example: if the quoted gas used is 1000, then the minimum amount to be paid will be 1000 * minBoost / BOOST_BASE\\n /// @return _multiplier The minimum boost multiplier\\n function minBoost() external view returns (uint256 _multiplier);\\n\\n /// @notice The maximum multiplier used to calculate the amount of gas paid to the Keeper for the gas used to perform a job\\n /// For example: if the quoted gas used is 1000, then the maximum amount to be paid will be 1000 * maxBoost / BOOST_BASE\\n /// @return _multiplier The maximum boost multiplier\\n function maxBoost() external view returns (uint256 _multiplier);\\n\\n /// @notice The targeted amount of bonded KP3Rs to max-up reward multiplier\\n /// For example: if the amount of KP3R the keeper has bonded is targetBond or more, then the keeper will get\\n /// the maximum boost possible in his rewards, if it's less, the reward boost will be proportional\\n /// @return _target The amount of KP3R that comforms the targetBond\\n function targetBond() external view returns (uint256 _target);\\n\\n /// @notice The amount of unaccounted gas that is going to be added to keeper payments\\n /// @return _workExtraGas The work unaccounted gas amount\\n function workExtraGas() external view returns (uint256 _workExtraGas);\\n\\n /// @notice The twap time for quoting\\n /// @return _quoteTwapTime The twap time\\n function quoteTwapTime() external view returns (uint32 _quoteTwapTime);\\n\\n /// @notice The minimum base fee that is used to calculate keeper rewards\\n /// @return _minBaseFee The minimum rewarded gas fee\\n function minBaseFee() external view returns (uint256 _minBaseFee);\\n\\n /// @notice The minimum priority fee that is also rewarded for keepers\\n /// @return _minPriorityFee The minimum rewarded priority fee\\n function minPriorityFee() external view returns (uint256 _minPriorityFee);\\n\\n /// @notice Address of Keep3r V2\\n /// @return _keep3rV2 Address of Keep3r V2\\n function keep3rV2() external view returns (address _keep3rV2);\\n\\n // Methods\\n\\n /// @notice Sets KP3R-WETH pool\\n /// @param _poolAddress The address of the KP3R-WETH pool\\n function setKp3rWethPool(address _poolAddress) external;\\n\\n /// @notice Sets the minimum boost multiplier\\n /// @param _minBoost The minimum boost multiplier\\n function setMinBoost(uint256 _minBoost) external;\\n\\n /// @notice Sets the maximum boost multiplier\\n /// @param _maxBoost The maximum boost multiplier\\n function setMaxBoost(uint256 _maxBoost) external;\\n\\n /// @notice Sets the target bond amount\\n /// @param _targetBond The target bond amount\\n function setTargetBond(uint256 _targetBond) external;\\n\\n /// @notice Sets the Keep3r V2 address\\n /// @param _keep3rV2 The address of Keep3r V2\\n function setKeep3rV2(address _keep3rV2) external;\\n\\n /// @notice Sets the work extra gas amount\\n /// @param _workExtraGas The work extra gas\\n function setWorkExtraGas(uint256 _workExtraGas) external;\\n\\n /// @notice Sets the quote twap time\\n /// @param _quoteTwapTime The twap time for quoting\\n function setQuoteTwapTime(uint32 _quoteTwapTime) external;\\n\\n /// @notice Sets the minimum rewarded gas fee\\n /// @param _minBaseFee The minimum rewarded gas fee\\n function setMinBaseFee(uint256 _minBaseFee) external;\\n\\n /// @notice Sets the minimum rewarded gas priority fee\\n /// @param _minPriorityFee The minimum rewarded priority fee\\n function setMinPriorityFee(uint256 _minPriorityFee) external;\\n}\\n\",\"keccak256\":\"0x76f99ca04361c0459fc9e99f0387ddb76da18cc470ec5bc744e7dc3bf6e9d334\",\"license\":\"MIT\"},\"solidity/interfaces/IPairManager.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4 <0.9.0;\\n\\nimport '@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol';\\n\\n/// @title Pair Manager interface\\n/// @notice Generic interface for Keep3r liquidity pools (kLP)\\ninterface IPairManager is IERC20Metadata {\\n /// @notice Address of the factory from which the pair manager was created\\n /// @return _factory The address of the PairManager Factory\\n function factory() external view returns (address _factory);\\n\\n /// @notice Address of the pool from which the Keep3r pair manager will interact with\\n /// @return _pool The address of the pool\\n function pool() external view returns (address _pool);\\n\\n /// @notice Token0 of the pool\\n /// @return _token0 The address of token0\\n function token0() external view returns (address _token0);\\n\\n /// @notice Token1 of the pool\\n /// @return _token1 The address of token1\\n function token1() external view returns (address _token1);\\n}\\n\",\"keccak256\":\"0x345c312b340c5775fb8f68d89ce851c7f75522940bd9bc64f2301a3f8312636a\",\"license\":\"MIT\"},\"solidity/interfaces/external/IKeep3rV1.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4 <0.9.0;\\n\\nimport '@openzeppelin/contracts/token/ERC20/IERC20.sol';\\nimport '@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol';\\n\\n// solhint-disable func-name-mixedcase\\ninterface IKeep3rV1 is IERC20, IERC20Metadata {\\n // Structs\\n struct Checkpoint {\\n uint32 fromBlock;\\n uint256 votes;\\n }\\n\\n // Events\\n event DelegateChanged(address indexed _delegator, address indexed _fromDelegate, address indexed _toDelegate);\\n event DelegateVotesChanged(address indexed _delegate, uint256 _previousBalance, uint256 _newBalance);\\n event SubmitJob(address indexed _job, address indexed _liquidity, address indexed _provider, uint256 _block, uint256 _credit);\\n event ApplyCredit(address indexed _job, address indexed _liquidity, address indexed _provider, uint256 _block, uint256 _credit);\\n event RemoveJob(address indexed _job, address indexed _liquidity, address indexed _provider, uint256 _block, uint256 _credit);\\n event UnbondJob(address indexed _job, address indexed _liquidity, address indexed _provider, uint256 _block, uint256 _credit);\\n event JobAdded(address indexed _job, uint256 _block, address _governance);\\n event JobRemoved(address indexed _job, uint256 _block, address _governance);\\n event KeeperWorked(address indexed _credit, address indexed _job, address indexed _keeper, uint256 _block, uint256 _amount);\\n event KeeperBonding(address indexed _keeper, uint256 _block, uint256 _active, uint256 _bond);\\n event KeeperBonded(address indexed _keeper, uint256 _block, uint256 _activated, uint256 _bond);\\n event KeeperUnbonding(address indexed _keeper, uint256 _block, uint256 _deactive, uint256 _bond);\\n event KeeperUnbound(address indexed _keeper, uint256 _block, uint256 _deactivated, uint256 _bond);\\n event KeeperSlashed(address indexed _keeper, address indexed _slasher, uint256 _block, uint256 _slash);\\n event KeeperDispute(address indexed _keeper, uint256 _block);\\n event KeeperResolved(address indexed _keeper, uint256 _block);\\n event TokenCreditAddition(address indexed _credit, address indexed _job, address indexed _creditor, uint256 _block, uint256 _amount);\\n\\n // Variables\\n function KPRH() external returns (address);\\n\\n function delegates(address _delegator) external view returns (address);\\n\\n function checkpoints(address _account, uint32 _checkpoint) external view returns (Checkpoint memory);\\n\\n function numCheckpoints(address _account) external view returns (uint32);\\n\\n function DOMAIN_TYPEHASH() external returns (bytes32);\\n\\n function DOMAINSEPARATOR() external returns (bytes32);\\n\\n function DELEGATION_TYPEHASH() external returns (bytes32);\\n\\n function PERMIT_TYPEHASH() external returns (bytes32);\\n\\n function nonces(address _user) external view returns (uint256);\\n\\n function BOND() external returns (uint256);\\n\\n function UNBOND() external returns (uint256);\\n\\n function LIQUIDITYBOND() external returns (uint256);\\n\\n function FEE() external returns (uint256);\\n\\n function BASE() external returns (uint256);\\n\\n function ETH() external returns (address);\\n\\n function bondings(address _user, address _bonding) external view returns (uint256);\\n\\n function canWithdrawAfter(address _user, address _bonding) external view returns (uint256);\\n\\n function pendingUnbonds(address _keeper, address _bonding) external view returns (uint256);\\n\\n function pendingbonds(address _keeper, address _bonding) external view returns (uint256);\\n\\n function bonds(address _keeper, address _bonding) external view returns (uint256);\\n\\n function votes(address _delegator) external view returns (uint256);\\n\\n function firstSeen(address _keeper) external view returns (uint256);\\n\\n function disputes(address _keeper) external view returns (bool);\\n\\n function lastJob(address _keeper) external view returns (uint256);\\n\\n function workCompleted(address _keeper) external view returns (uint256);\\n\\n function jobs(address _job) external view returns (bool);\\n\\n function credits(address _job, address _credit) external view returns (uint256);\\n\\n function liquidityProvided(\\n address _provider,\\n address _liquidity,\\n address _job\\n ) external view returns (uint256);\\n\\n function liquidityUnbonding(\\n address _provider,\\n address _liquidity,\\n address _job\\n ) external view returns (uint256);\\n\\n function liquidityAmountsUnbonding(\\n address _provider,\\n address _liquidity,\\n address _job\\n ) external view returns (uint256);\\n\\n function jobProposalDelay(address _job) external view returns (uint256);\\n\\n function liquidityApplied(\\n address _provider,\\n address _liquidity,\\n address _job\\n ) external view returns (uint256);\\n\\n function liquidityAmount(\\n address _provider,\\n address _liquidity,\\n address _job\\n ) external view returns (uint256);\\n\\n function keepers(address _keeper) external view returns (bool);\\n\\n function blacklist(address _keeper) external view returns (bool);\\n\\n function keeperList(uint256 _index) external view returns (address);\\n\\n function jobList(uint256 _index) external view returns (address);\\n\\n function governance() external returns (address);\\n\\n function pendingGovernance() external returns (address);\\n\\n function liquidityAccepted(address _liquidity) external view returns (bool);\\n\\n function liquidityPairs(uint256 _index) external view returns (address);\\n\\n // Methods\\n function getCurrentVotes(address _account) external view returns (uint256);\\n\\n function addCreditETH(address _job) external payable;\\n\\n function addCredit(\\n address _credit,\\n address _job,\\n uint256 _amount\\n ) external;\\n\\n function addVotes(address _voter, uint256 _amount) external;\\n\\n function removeVotes(address _voter, uint256 _amount) external;\\n\\n function addKPRCredit(address _job, uint256 _amount) external;\\n\\n function approveLiquidity(address _liquidity) external;\\n\\n function revokeLiquidity(address _liquidity) external;\\n\\n function pairs() external view returns (address[] memory);\\n\\n function addLiquidityToJob(\\n address _liquidity,\\n address _job,\\n uint256 _amount\\n ) external;\\n\\n function applyCreditToJob(\\n address _provider,\\n address _liquidity,\\n address _job\\n ) external;\\n\\n function unbondLiquidityFromJob(\\n address _liquidity,\\n address _job,\\n uint256 _amount\\n ) external;\\n\\n function removeLiquidityFromJob(address _liquidity, address _job) external;\\n\\n function mint(uint256 _amount) external;\\n\\n function burn(uint256 _amount) external;\\n\\n function worked(address _keeper) external;\\n\\n function receipt(\\n address _credit,\\n address _keeper,\\n uint256 _amount\\n ) external;\\n\\n function receiptETH(address _keeper, uint256 _amount) external;\\n\\n function addJob(address _job) external;\\n\\n function getJobs() external view returns (address[] memory);\\n\\n function removeJob(address _job) external;\\n\\n function setKeep3rHelper(address _keep3rHelper) external;\\n\\n function setGovernance(address _governance) external;\\n\\n function acceptGovernance() external;\\n\\n function isKeeper(address _keeper) external returns (bool);\\n\\n function isMinKeeper(\\n address _keeper,\\n uint256 _minBond,\\n uint256 _earned,\\n uint256 _age\\n ) external returns (bool);\\n\\n function isBondedKeeper(\\n address _keeper,\\n address _bond,\\n uint256 _minBond,\\n uint256 _earned,\\n uint256 _age\\n ) external returns (bool);\\n\\n function bond(address _bonding, uint256 _amount) external;\\n\\n function getKeepers() external view returns (address[] memory);\\n\\n function activate(address _bonding) external;\\n\\n function unbond(address _bonding, uint256 _amount) external;\\n\\n function slash(\\n address _bonded,\\n address _keeper,\\n uint256 _amount\\n ) external;\\n\\n function withdraw(address _bonding) external;\\n\\n function dispute(address _keeper) external;\\n\\n function revoke(address _keeper) external;\\n\\n function resolve(address _keeper) external;\\n\\n function permit(\\n address _owner,\\n address _spender,\\n uint256 _amount,\\n uint256 _deadline,\\n uint8 _v,\\n bytes32 _r,\\n bytes32 _s\\n ) external;\\n}\\n\",\"keccak256\":\"0xa9806cd6666ab1b7375ef72446964a72397fd4cefc7cc8c5b37caa7c50df0246\",\"license\":\"MIT\"},\"solidity/interfaces/external/IKeep3rV1Proxy.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4 <0.9.0;\\n\\nimport '../peripherals/IGovernable.sol';\\n\\ninterface IKeep3rV1Proxy is IGovernable {\\n // Structs\\n struct Recipient {\\n address recipient;\\n uint256 caps;\\n }\\n\\n // Variables\\n function keep3rV1() external view returns (address);\\n\\n function minter() external view returns (address);\\n\\n function next(address) external view returns (uint256);\\n\\n function caps(address) external view returns (uint256);\\n\\n function recipients() external view returns (address[] memory);\\n\\n function recipientsCaps() external view returns (Recipient[] memory);\\n\\n // Errors\\n error Cooldown();\\n error NoDrawableAmount();\\n error ZeroAddress();\\n error OnlyMinter();\\n\\n // Methods\\n function addRecipient(address recipient, uint256 amount) external;\\n\\n function removeRecipient(address recipient) external;\\n\\n function draw() external returns (uint256 _amount);\\n\\n function setKeep3rV1(address _keep3rV1) external;\\n\\n function setMinter(address _minter) external;\\n\\n function mint(uint256 _amount) external;\\n\\n function mint(address _account, uint256 _amount) external;\\n\\n function setKeep3rV1Governance(address _governance) external;\\n\\n function acceptKeep3rV1Governance() external;\\n\\n function dispute(address _keeper) external;\\n\\n function slash(\\n address _bonded,\\n address _keeper,\\n uint256 _amount\\n ) external;\\n\\n function revoke(address _keeper) external;\\n\\n function resolve(address _keeper) external;\\n\\n function addJob(address _job) external;\\n\\n function removeJob(address _job) external;\\n\\n function addKPRCredit(address _job, uint256 _amount) external;\\n\\n function approveLiquidity(address _liquidity) external;\\n\\n function revokeLiquidity(address _liquidity) external;\\n\\n function setKeep3rHelper(address _keep3rHelper) external;\\n\\n function addVotes(address _voter, uint256 _amount) external;\\n\\n function removeVotes(address _voter, uint256 _amount) external;\\n}\\n\",\"keccak256\":\"0xfb2e81fe347b39aabce849ef2d42c6df846b7ef0ed5ae952c85bbb708da99408\",\"license\":\"MIT\"},\"solidity/interfaces/peripherals/IBaseErrors.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity >=0.8.4 <0.9.0;\\n\\ninterface IBaseErrors {\\n /// @notice Throws if a variable is assigned to the zero address\\n error ZeroAddress();\\n}\\n\",\"keccak256\":\"0x9130019a08d9eaedfb920a323fed5c7f409736cd918f1a32921c93551b3ee00e\",\"license\":\"MIT\"},\"solidity/interfaces/peripherals/IDustCollector.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity >=0.8.4 <0.9.0;\\n\\nimport './IBaseErrors.sol';\\n\\ninterface IDustCollector is IBaseErrors {\\n /// @notice Emitted when dust is sent\\n /// @param _token The token that will be transferred\\n /// @param _amount The amount of the token that will be transferred\\n /// @param _to The address which will receive the funds\\n event DustSent(address _token, uint256 _amount, address _to);\\n\\n /// @notice Allows an authorized user to transfer the tokens or eth that may have been left in a contract\\n /// @param _token The token that will be transferred\\n /// @param _amount The amount of the token that will be transferred\\n /// @param _to The address that will receive the idle funds\\n function sendDust(\\n address _token,\\n uint256 _amount,\\n address _to\\n ) external;\\n}\\n\",\"keccak256\":\"0x38dce228111f2a3c6b26ac09c5652c3f1f184c4cfe50d11ff0958ef6a50683bb\",\"license\":\"MIT\"},\"solidity/interfaces/peripherals/IGovernable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4 <0.9.0;\\n\\n/// @title Governable contract\\n/// @notice Manages the governance role\\ninterface IGovernable {\\n // Events\\n\\n /// @notice Emitted when pendingGovernance accepts to be governance\\n /// @param _governance Address of the new governance\\n event GovernanceSet(address _governance);\\n\\n /// @notice Emitted when a new governance is proposed\\n /// @param _pendingGovernance Address that is proposed to be the new governance\\n event GovernanceProposal(address _pendingGovernance);\\n\\n // Errors\\n\\n /// @notice Throws if the caller of the function is not governance\\n error OnlyGovernance();\\n\\n /// @notice Throws if the caller of the function is not pendingGovernance\\n error OnlyPendingGovernance();\\n\\n /// @notice Throws if trying to set governance to zero address\\n error NoGovernanceZeroAddress();\\n\\n // Variables\\n\\n /// @notice Stores the governance address\\n /// @return _governance The governance addresss\\n function governance() external view returns (address _governance);\\n\\n /// @notice Stores the pendingGovernance address\\n /// @return _pendingGovernance The pendingGovernance addresss\\n function pendingGovernance() external view returns (address _pendingGovernance);\\n\\n // Methods\\n\\n /// @notice Proposes a new address to be governance\\n /// @param _governance The address being proposed as the new governance\\n function setGovernance(address _governance) external;\\n\\n /// @notice Changes the governance from the current governance to the previously proposed address\\n function acceptGovernance() external;\\n}\\n\",\"keccak256\":\"0x3284624b2479bbf97c821f37c93a096dcb869b30bbf9b20d30d1800f9535452c\",\"license\":\"MIT\"},\"solidity/interfaces/peripherals/IKeep3rAccountance.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4 <0.9.0;\\n\\nimport './IKeep3rRoles.sol';\\n\\n/// @title Keep3rDisputable contract\\n/// @notice Disputes keepers, or if they're already disputed, it can resolve the case\\n/// @dev Argument `bonding` can be the address of either a token or a liquidity\\ninterface IKeep3rAccountance is IKeep3rRoles {\\n // Events\\n\\n /// @notice Emitted when the bonding process of a new keeper begins\\n /// @param _keeper The caller of Keep3rKeeperFundable#bond function\\n /// @param _bonding The asset the keeper has bonded\\n /// @param _amount The amount the keeper has bonded\\n event Bonding(address indexed _keeper, address indexed _bonding, uint256 _amount);\\n\\n /// @notice Emitted when a keeper or job begins the unbonding process to withdraw the funds\\n /// @param _keeperOrJob The keeper or job that began the unbonding process\\n /// @param _unbonding The liquidity pair or asset being unbonded\\n /// @param _amount The amount being unbonded\\n event Unbonding(address indexed _keeperOrJob, address indexed _unbonding, uint256 _amount);\\n\\n // Variables\\n\\n /// @notice Tracks the total amount of bonded KP3Rs in the contract\\n /// @return _totalBonds The total amount of bonded KP3Rs in the contract\\n function totalBonds() external view returns (uint256 _totalBonds);\\n\\n /// @notice Tracks the total KP3R earnings of a keeper since it started working\\n /// @param _keeper The address of the keeper\\n /// @return _workCompleted Total KP3R earnings of a keeper since it started working\\n function workCompleted(address _keeper) external view returns (uint256 _workCompleted);\\n\\n /// @notice Tracks when a keeper was first registered\\n /// @param _keeper The address of the keeper\\n /// @return timestamp The time at which the keeper was first registered\\n function firstSeen(address _keeper) external view returns (uint256 timestamp);\\n\\n /// @notice Tracks if a keeper or job has a pending dispute\\n /// @param _keeperOrJob The address of the keeper or job\\n /// @return _disputed Whether a keeper or job has a pending dispute\\n function disputes(address _keeperOrJob) external view returns (bool _disputed);\\n\\n /// @notice Tracks how much a keeper has bonded of a certain token\\n /// @param _keeper The address of the keeper\\n /// @param _bond The address of the token being bonded\\n /// @return _bonds Amount of a certain token that a keeper has bonded\\n function bonds(address _keeper, address _bond) external view returns (uint256 _bonds);\\n\\n /// @notice The current token credits available for a job\\n /// @param _job The address of the job\\n /// @param _token The address of the token bonded\\n /// @return _amount The amount of token credits available for a job\\n function jobTokenCredits(address _job, address _token) external view returns (uint256 _amount);\\n\\n /// @notice Tracks the amount of assets deposited in pending bonds\\n /// @param _keeper The address of the keeper\\n /// @param _bonding The address of the token being bonded\\n /// @return _pendingBonds Amount of a certain asset a keeper has unbonding\\n function pendingBonds(address _keeper, address _bonding) external view returns (uint256 _pendingBonds);\\n\\n /// @notice Tracks when a bonding for a keeper can be activated\\n /// @param _keeper The address of the keeper\\n /// @param _bonding The address of the token being bonded\\n /// @return _timestamp Time at which the bonding for a keeper can be activated\\n function canActivateAfter(address _keeper, address _bonding) external view returns (uint256 _timestamp);\\n\\n /// @notice Tracks when keeper bonds are ready to be withdrawn\\n /// @param _keeper The address of the keeper\\n /// @param _bonding The address of the token being unbonded\\n /// @return _timestamp Time at which the keeper bonds are ready to be withdrawn\\n function canWithdrawAfter(address _keeper, address _bonding) external view returns (uint256 _timestamp);\\n\\n /// @notice Tracks how much keeper bonds are to be withdrawn\\n /// @param _keeper The address of the keeper\\n /// @param _bonding The address of the token being unbonded\\n /// @return _pendingUnbonds The amount of keeper bonds that are to be withdrawn\\n function pendingUnbonds(address _keeper, address _bonding) external view returns (uint256 _pendingUnbonds);\\n\\n /// @notice Checks whether the address has ever bonded an asset\\n /// @param _keeper The address of the keeper\\n /// @return _hasBonded Whether the address has ever bonded an asset\\n function hasBonded(address _keeper) external view returns (bool _hasBonded);\\n\\n // Methods\\n\\n /// @notice Lists all jobs\\n /// @return _jobList Array with all the jobs in _jobs\\n function jobs() external view returns (address[] memory _jobList);\\n\\n /// @notice Lists all keepers\\n /// @return _keeperList Array with all the keepers in _keepers\\n function keepers() external view returns (address[] memory _keeperList);\\n\\n // Errors\\n\\n /// @notice Throws when an address is passed as a job, but that address is not a job\\n error JobUnavailable();\\n\\n /// @notice Throws when an action that requires an undisputed job is applied on a disputed job\\n error JobDisputed();\\n}\\n\",\"keccak256\":\"0xf4748c236ddf409e45e7169c735e2fc54e627b2b3ccd189ebb438ad768f1deb1\",\"license\":\"MIT\"},\"solidity/interfaces/peripherals/IKeep3rDisputable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4 <0.9.0;\\n\\n/// @title Keep3rDisputable contract\\n/// @notice Creates/resolves disputes for jobs or keepers\\n/// A disputed keeper is slashable and is not able to bond, activate, withdraw or receive direct payments\\n/// A disputed job is slashable and is not able to pay the keepers, withdraw tokens or to migrate\\ninterface IKeep3rDisputable {\\n /// @notice Emitted when a keeper or a job is disputed\\n /// @param _jobOrKeeper The address of the disputed keeper/job\\n /// @param _disputer The user that called the function and disputed the keeper\\n event Dispute(address indexed _jobOrKeeper, address indexed _disputer);\\n\\n /// @notice Emitted when a dispute is resolved\\n /// @param _jobOrKeeper The address of the disputed keeper/job\\n /// @param _resolver The user that called the function and resolved the dispute\\n event Resolve(address indexed _jobOrKeeper, address indexed _resolver);\\n\\n /// @notice Throws when a job or keeper is already disputed\\n error AlreadyDisputed();\\n\\n /// @notice Throws when a job or keeper is not disputed and someone tries to resolve the dispute\\n error NotDisputed();\\n\\n /// @notice Allows governance to create a dispute for a given keeper/job\\n /// @param _jobOrKeeper The address in dispute\\n function dispute(address _jobOrKeeper) external;\\n\\n /// @notice Allows governance to resolve a dispute on a keeper/job\\n /// @param _jobOrKeeper The address cleared\\n function resolve(address _jobOrKeeper) external;\\n}\\n\",\"keccak256\":\"0x002b9b4c75e62d48d74b6447649d39eb5c1e128d2523bb11e08e9cd3e27b1f70\",\"license\":\"MIT\"},\"solidity/interfaces/peripherals/IKeep3rJobs.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4 <0.9.0;\\n\\nimport './IKeep3rDisputable.sol';\\n\\n/// @title Keep3rJobOwnership contract\\n/// @notice Handles the ownership of the jobs\\ninterface IKeep3rJobOwnership {\\n // Events\\n\\n /// @notice Emitted when Keep3rJobOwnership#changeJobOwnership is called\\n /// @param _job The address of the job proposed to have a change of owner\\n /// @param _owner The current owner of the job\\n /// @param _pendingOwner The new address proposed to be the owner of the job\\n event JobOwnershipChange(address indexed _job, address indexed _owner, address indexed _pendingOwner);\\n\\n /// @notice Emitted when Keep3rJobOwnership#JobOwnershipAssent is called\\n /// @param _job The address of the job which the proposed owner will now own\\n /// @param _previousOwner The previous owner of the job\\n /// @param _newOwner The new owner of the job\\n event JobOwnershipAssent(address indexed _job, address indexed _previousOwner, address indexed _newOwner);\\n\\n // Errors\\n\\n /// @notice Throws when the caller of the function is not the job owner\\n error OnlyJobOwner();\\n\\n /// @notice Throws when the caller of the function is not the pending job owner\\n error OnlyPendingJobOwner();\\n\\n // Variables\\n\\n /// @notice Maps the job to the owner of the job\\n /// @param _job The address of the job\\n /// @return _owner The address of the owner of the job\\n function jobOwner(address _job) external view returns (address _owner);\\n\\n /// @notice Maps the job to its pending owner\\n /// @param _job The address of the job\\n /// @return _pendingOwner The address of the pending owner of the job\\n function jobPendingOwner(address _job) external view returns (address _pendingOwner);\\n\\n // Methods\\n\\n /// @notice Proposes a new address to be the owner of the job\\n /// @param _job The address of the job\\n /// @param _newOwner The address of the proposed new owner\\n function changeJobOwnership(address _job, address _newOwner) external;\\n\\n /// @notice The proposed address accepts to be the owner of the job\\n /// @param _job The address of the job\\n function acceptJobOwnership(address _job) external;\\n}\\n\\n/// @title Keep3rJobManager contract\\n/// @notice Handles the addition and withdrawal of credits from a job\\ninterface IKeep3rJobManager is IKeep3rJobOwnership {\\n // Events\\n\\n /// @notice Emitted when Keep3rJobManager#addJob is called\\n /// @param _job The address of the job to add\\n /// @param _jobOwner The job's owner\\n event JobAddition(address indexed _job, address indexed _jobOwner);\\n\\n // Errors\\n\\n /// @notice Throws when trying to add a job that has already been added\\n error JobAlreadyAdded();\\n\\n /// @notice Throws when the address that is trying to register as a keeper is already a keeper\\n error AlreadyAKeeper();\\n\\n // Methods\\n\\n /// @notice Allows any caller to add a new job\\n /// @param _job Address of the contract for which work should be performed\\n function addJob(address _job) external;\\n}\\n\\n/// @title Keep3rJobFundableCredits contract\\n/// @notice Handles the addition and withdrawal of credits from a job\\ninterface IKeep3rJobFundableCredits is IKeep3rJobOwnership {\\n // Events\\n\\n /// @notice Emitted when Keep3rJobFundableCredits#addTokenCreditsToJob is called\\n /// @param _job The address of the job being credited\\n /// @param _token The address of the token being provided\\n /// @param _provider The user that calls the function\\n /// @param _amount The amount of credit being added to the job\\n event TokenCreditAddition(address indexed _job, address indexed _token, address indexed _provider, uint256 _amount);\\n\\n /// @notice Emitted when Keep3rJobFundableCredits#withdrawTokenCreditsFromJob is called\\n /// @param _job The address of the job from which the credits are withdrawn\\n /// @param _token The credit being withdrawn from the job\\n /// @param _receiver The user that receives the tokens\\n /// @param _amount The amount of credit withdrawn\\n event TokenCreditWithdrawal(address indexed _job, address indexed _token, address indexed _receiver, uint256 _amount);\\n\\n // Errors\\n\\n /// @notice Throws when the token is KP3R, as it should not be used for direct token payments\\n error TokenUnallowed();\\n\\n /// @notice Throws when the token withdraw cooldown has not yet passed\\n error JobTokenCreditsLocked();\\n\\n /// @notice Throws when the user tries to withdraw more tokens than it has\\n error InsufficientJobTokenCredits();\\n\\n // Variables\\n\\n /// @notice Last block where tokens were added to the job\\n /// @param _job The address of the job credited\\n /// @param _token The address of the token credited\\n /// @return _timestamp The last block where tokens were added to the job\\n function jobTokenCreditsAddedAt(address _job, address _token) external view returns (uint256 _timestamp);\\n\\n // Methods\\n\\n /// @notice Add credit to a job to be paid out for work\\n /// @param _job The address of the job being credited\\n /// @param _token The address of the token being credited\\n /// @param _amount The amount of credit being added\\n function addTokenCreditsToJob(\\n address _job,\\n address _token,\\n uint256 _amount\\n ) external;\\n\\n /// @notice Withdraw credit from a job\\n /// @param _job The address of the job from which the credits are withdrawn\\n /// @param _token The address of the token being withdrawn\\n /// @param _amount The amount of token to be withdrawn\\n /// @param _receiver The user that will receive tokens\\n function withdrawTokenCreditsFromJob(\\n address _job,\\n address _token,\\n uint256 _amount,\\n address _receiver\\n ) external;\\n}\\n\\n/// @title Keep3rJobFundableLiquidity contract\\n/// @notice Handles the funding of jobs through specific liquidity pairs\\ninterface IKeep3rJobFundableLiquidity is IKeep3rJobOwnership {\\n // Events\\n\\n /// @notice Emitted when Keep3rJobFundableLiquidity#approveLiquidity function is called\\n /// @param _liquidity The address of the liquidity pair being approved\\n event LiquidityApproval(address _liquidity);\\n\\n /// @notice Emitted when Keep3rJobFundableLiquidity#revokeLiquidity function is called\\n /// @param _liquidity The address of the liquidity pair being revoked\\n event LiquidityRevocation(address _liquidity);\\n\\n /// @notice Emitted when IKeep3rJobFundableLiquidity#addLiquidityToJob function is called\\n /// @param _job The address of the job to which liquidity will be added\\n /// @param _liquidity The address of the liquidity being added\\n /// @param _provider The user that calls the function\\n /// @param _amount The amount of liquidity being added\\n event LiquidityAddition(address indexed _job, address indexed _liquidity, address indexed _provider, uint256 _amount);\\n\\n /// @notice Emitted when IKeep3rJobFundableLiquidity#withdrawLiquidityFromJob function is called\\n /// @param _job The address of the job of which liquidity will be withdrawn from\\n /// @param _liquidity The address of the liquidity being withdrawn\\n /// @param _receiver The receiver of the liquidity tokens\\n /// @param _amount The amount of liquidity being withdrawn from the job\\n event LiquidityWithdrawal(address indexed _job, address indexed _liquidity, address indexed _receiver, uint256 _amount);\\n\\n /// @notice Emitted when Keep3rJobFundableLiquidity#addLiquidityToJob function is called\\n /// @param _job The address of the job whose credits will be updated\\n /// @param _rewardedAt The time at which the job was last rewarded\\n /// @param _currentCredits The current credits of the job\\n /// @param _periodCredits The credits of the job for the current period\\n event LiquidityCreditsReward(address indexed _job, uint256 _rewardedAt, uint256 _currentCredits, uint256 _periodCredits);\\n\\n /// @notice Emitted when Keep3rJobFundableLiquidity#forceLiquidityCreditsToJob function is called\\n /// @param _job The address of the job whose credits will be updated\\n /// @param _rewardedAt The time at which the job was last rewarded\\n /// @param _currentCredits The current credits of the job\\n event LiquidityCreditsForced(address indexed _job, uint256 _rewardedAt, uint256 _currentCredits);\\n\\n // Errors\\n\\n /// @notice Throws when the liquidity being approved has already been approved\\n error LiquidityPairApproved();\\n\\n /// @notice Throws when the liquidity being removed has not been approved\\n error LiquidityPairUnexistent();\\n\\n /// @notice Throws when trying to add liquidity to an unapproved pool\\n error LiquidityPairUnapproved();\\n\\n /// @notice Throws when the job doesn't have the requested liquidity\\n error JobLiquidityUnexistent();\\n\\n /// @notice Throws when trying to remove more liquidity than the job has\\n error JobLiquidityInsufficient();\\n\\n /// @notice Throws when trying to add less liquidity than the minimum liquidity required\\n error JobLiquidityLessThanMin();\\n\\n // Structs\\n\\n /// @notice Stores the tick information of the different liquidity pairs\\n struct TickCache {\\n int56 current; // Tracks the current tick\\n int56 difference; // Stores the difference between the current tick and the last tick\\n uint256 period; // Stores the period at which the last observation was made\\n }\\n\\n // Variables\\n\\n /// @notice Lists liquidity pairs\\n /// @return _list An array of addresses with all the approved liquidity pairs\\n function approvedLiquidities() external view returns (address[] memory _list);\\n\\n /// @notice Amount of liquidity in a specified job\\n /// @param _job The address of the job being checked\\n /// @param _liquidity The address of the liquidity we are checking\\n /// @return _amount Amount of liquidity in the specified job\\n function liquidityAmount(address _job, address _liquidity) external view returns (uint256 _amount);\\n\\n /// @notice Last time the job was rewarded liquidity credits\\n /// @param _job The address of the job being checked\\n /// @return _timestamp Timestamp of the last time the job was rewarded liquidity credits\\n function rewardedAt(address _job) external view returns (uint256 _timestamp);\\n\\n /// @notice Last time the job was worked\\n /// @param _job The address of the job being checked\\n /// @return _timestamp Timestamp of the last time the job was worked\\n function workedAt(address _job) external view returns (uint256 _timestamp);\\n\\n // Methods\\n\\n /// @notice Returns the liquidity credits of a given job\\n /// @param _job The address of the job of which we want to know the liquidity credits\\n /// @return _amount The liquidity credits of a given job\\n function jobLiquidityCredits(address _job) external view returns (uint256 _amount);\\n\\n /// @notice Returns the credits of a given job for the current period\\n /// @param _job The address of the job of which we want to know the period credits\\n /// @return _amount The credits the given job has at the current period\\n function jobPeriodCredits(address _job) external view returns (uint256 _amount);\\n\\n /// @notice Calculates the total credits of a given job\\n /// @param _job The address of the job of which we want to know the total credits\\n /// @return _amount The total credits of the given job\\n function totalJobCredits(address _job) external view returns (uint256 _amount);\\n\\n /// @notice Calculates how many credits should be rewarded periodically for a given liquidity amount\\n /// @dev _periodCredits = underlying KP3Rs for given liquidity amount * rewardPeriod / inflationPeriod\\n /// @param _liquidity The address of the liquidity to provide\\n /// @param _amount The amount of liquidity to provide\\n /// @return _periodCredits The amount of KP3R periodically minted for the given liquidity\\n function quoteLiquidity(address _liquidity, uint256 _amount) external view returns (uint256 _periodCredits);\\n\\n /// @notice Observes the current state of the liquidity pair being observed and updates TickCache with the information\\n /// @param _liquidity The address of the liquidity pair being observed\\n /// @return _tickCache The updated TickCache\\n function observeLiquidity(address _liquidity) external view returns (TickCache memory _tickCache);\\n\\n /// @notice Gifts liquidity credits to the specified job\\n /// @param _job The address of the job being credited\\n /// @param _amount The amount of liquidity credits to gift\\n function forceLiquidityCreditsToJob(address _job, uint256 _amount) external;\\n\\n /// @notice Approve a liquidity pair for being accepted in future\\n /// @param _liquidity The address of the liquidity accepted\\n function approveLiquidity(address _liquidity) external;\\n\\n /// @notice Revoke a liquidity pair from being accepted in future\\n /// @param _liquidity The liquidity no longer accepted\\n function revokeLiquidity(address _liquidity) external;\\n\\n /// @notice Allows anyone to fund a job with liquidity\\n /// @param _job The address of the job to assign liquidity to\\n /// @param _liquidity The liquidity being added\\n /// @param _amount The amount of liquidity tokens to add\\n function addLiquidityToJob(\\n address _job,\\n address _liquidity,\\n uint256 _amount\\n ) external;\\n\\n /// @notice Unbond liquidity for a job\\n /// @dev Can only be called by the job's owner\\n /// @param _job The address of the job being unbonded from\\n /// @param _liquidity The liquidity being unbonded\\n /// @param _amount The amount of liquidity being removed\\n function unbondLiquidityFromJob(\\n address _job,\\n address _liquidity,\\n uint256 _amount\\n ) external;\\n\\n /// @notice Withdraw liquidity from a job\\n /// @param _job The address of the job being withdrawn from\\n /// @param _liquidity The liquidity being withdrawn\\n /// @param _receiver The address that will receive the withdrawn liquidity\\n function withdrawLiquidityFromJob(\\n address _job,\\n address _liquidity,\\n address _receiver\\n ) external;\\n}\\n\\n/// @title Keep3rJobMigration contract\\n/// @notice Handles the migration process of jobs to different addresses\\ninterface IKeep3rJobMigration is IKeep3rJobFundableCredits, IKeep3rJobFundableLiquidity {\\n // Events\\n\\n /// @notice Emitted when Keep3rJobMigration#migrateJob function is called\\n /// @param _fromJob The address of the job that requests to migrate\\n /// @param _toJob The address at which the job requests to migrate\\n event JobMigrationRequested(address indexed _fromJob, address _toJob);\\n\\n /// @notice Emitted when Keep3rJobMigration#acceptJobMigration function is called\\n /// @param _fromJob The address of the job that requested to migrate\\n /// @param _toJob The address at which the job had requested to migrate\\n event JobMigrationSuccessful(address _fromJob, address indexed _toJob);\\n\\n // Errors\\n\\n /// @notice Throws when the address of the job that requests to migrate wants to migrate to its same address\\n error JobMigrationImpossible();\\n\\n /// @notice Throws when the _toJob address differs from the address being tracked in the pendingJobMigrations mapping\\n error JobMigrationUnavailable();\\n\\n /// @notice Throws when cooldown between migrations has not yet passed\\n error JobMigrationLocked();\\n\\n // Variables\\n\\n /// @notice Maps the jobs that have requested a migration to the address they have requested to migrate to\\n /// @return _toJob The address to which the job has requested to migrate to\\n function pendingJobMigrations(address _fromJob) external view returns (address _toJob);\\n\\n // Methods\\n\\n /// @notice Initializes the migration process for a job by adding the request to the pendingJobMigrations mapping\\n /// @param _fromJob The address of the job that is requesting to migrate\\n /// @param _toJob The address at which the job is requesting to migrate\\n function migrateJob(address _fromJob, address _toJob) external;\\n\\n /// @notice Completes the migration process for a job\\n /// @dev Unbond/withdraw process doesn't get migrated\\n /// @param _fromJob The address of the job that requested to migrate\\n /// @param _toJob The address to which the job wants to migrate to\\n function acceptJobMigration(address _fromJob, address _toJob) external;\\n}\\n\\n/// @title Keep3rJobWorkable contract\\n/// @notice Handles the mechanisms jobs can pay keepers with along with the restrictions jobs can put on keepers before they can work on jobs\\ninterface IKeep3rJobWorkable is IKeep3rJobMigration {\\n // Events\\n\\n /// @notice Emitted when a keeper is validated before a job\\n /// @param _gasLeft The amount of gas that the transaction has left at the moment of keeper validation\\n event KeeperValidation(uint256 _gasLeft);\\n\\n /// @notice Emitted when a keeper works a job\\n /// @param _credit The address of the asset in which the keeper is paid\\n /// @param _job The address of the job the keeper has worked\\n /// @param _keeper The address of the keeper that has worked the job\\n /// @param _payment The amount that has been paid out to the keeper in exchange for working the job\\n /// @param _gasLeft The amount of gas that the transaction has left at the moment of payment\\n event KeeperWork(address indexed _credit, address indexed _job, address indexed _keeper, uint256 _payment, uint256 _gasLeft);\\n\\n // Errors\\n\\n /// @notice Throws if work method was called without calling isKeeper or isBondedKeeper\\n error GasNotInitialized();\\n\\n /// @notice Throws if the address claiming to be a job is not in the list of approved jobs\\n error JobUnapproved();\\n\\n /// @notice Throws if the amount of funds in the job is less than the payment that must be paid to the keeper that works that job\\n error InsufficientFunds();\\n\\n // Methods\\n\\n /// @notice Confirms if the current keeper is registered\\n /// @dev Can be used for general (non critical) functions\\n /// @param _keeper The keeper being investigated\\n /// @return _isKeeper Whether the address passed as a parameter is a keeper or not\\n function isKeeper(address _keeper) external returns (bool _isKeeper);\\n\\n /// @notice Confirms if the current keeper is registered and has a minimum bond of any asset.\\n /// @dev Should be used for protected functions\\n /// @param _keeper The keeper to check\\n /// @param _bond The bond token being evaluated\\n /// @param _minBond The minimum amount of bonded tokens\\n /// @param _earned The minimum funds earned in the keepers lifetime\\n /// @param _age The minimum keeper age required\\n /// @return _isBondedKeeper Whether the `_keeper` meets the given requirements\\n function isBondedKeeper(\\n address _keeper,\\n address _bond,\\n uint256 _minBond,\\n uint256 _earned,\\n uint256 _age\\n ) external returns (bool _isBondedKeeper);\\n\\n /// @notice Implemented by jobs to show that a keeper performed work\\n /// @dev Automatically calculates the payment for the keeper and pays the keeper with bonded KP3R\\n /// @param _keeper Address of the keeper that performed the work\\n function worked(address _keeper) external;\\n\\n /// @notice Implemented by jobs to show that a keeper performed work\\n /// @dev Pays the keeper that performs the work with KP3R\\n /// @param _keeper Address of the keeper that performed the work\\n /// @param _payment The reward that should be allocated for the job\\n function bondedPayment(address _keeper, uint256 _payment) external;\\n\\n /// @notice Implemented by jobs to show that a keeper performed work\\n /// @dev Pays the keeper that performs the work with a specific token\\n /// @param _token The asset being awarded to the keeper\\n /// @param _keeper Address of the keeper that performed the work\\n /// @param _amount The reward that should be allocated\\n function directTokenPayment(\\n address _token,\\n address _keeper,\\n uint256 _amount\\n ) external;\\n}\\n\\n/// @title Keep3rJobDisputable contract\\n/// @notice Handles the actions that can be taken on a disputed job\\ninterface IKeep3rJobDisputable is IKeep3rDisputable, IKeep3rJobFundableCredits, IKeep3rJobFundableLiquidity {\\n // Events\\n\\n /// @notice Emitted when Keep3rJobDisputable#slashTokenFromJob is called\\n /// @param _job The address of the job from which the token will be slashed\\n /// @param _token The address of the token being slashed\\n /// @param _slasher The user that slashes the token\\n /// @param _amount The amount of the token being slashed\\n event JobSlashToken(address indexed _job, address _token, address indexed _slasher, uint256 _amount);\\n\\n /// @notice Emitted when Keep3rJobDisputable#slashLiquidityFromJob is called\\n /// @param _job The address of the job from which the liquidity will be slashed\\n /// @param _liquidity The address of the liquidity being slashed\\n /// @param _slasher The user that slashes the liquidity\\n /// @param _amount The amount of the liquidity being slashed\\n event JobSlashLiquidity(address indexed _job, address _liquidity, address indexed _slasher, uint256 _amount);\\n\\n // Errors\\n\\n /// @notice Throws when the token trying to be slashed doesn't exist\\n error JobTokenUnexistent();\\n\\n /// @notice Throws when someone tries to slash more tokens than the job has\\n error JobTokenInsufficient();\\n\\n // Methods\\n\\n /// @notice Allows governance or slasher to slash a job specific token\\n /// @param _job The address of the job from which the token will be slashed\\n /// @param _token The address of the token that will be slashed\\n /// @param _amount The amount of the token that will be slashed\\n function slashTokenFromJob(\\n address _job,\\n address _token,\\n uint256 _amount\\n ) external;\\n\\n /// @notice Allows governance or a slasher to slash liquidity from a job\\n /// @param _job The address being slashed\\n /// @param _liquidity The address of the liquidity that will be slashed\\n /// @param _amount The amount of liquidity that will be slashed\\n function slashLiquidityFromJob(\\n address _job,\\n address _liquidity,\\n uint256 _amount\\n ) external;\\n}\\n\\n// solhint-disable-next-line no-empty-blocks\\ninterface IKeep3rJobs is IKeep3rJobWorkable, IKeep3rJobManager, IKeep3rJobDisputable {\\n\\n}\\n\",\"keccak256\":\"0x08915189f1a9484d17a51b7fb343b765b9edba29062bb644af9663af18f03e34\",\"license\":\"MIT\"},\"solidity/interfaces/peripherals/IKeep3rKeepers.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4 <0.9.0;\\n\\nimport './IKeep3rDisputable.sol';\\n\\n/// @title Keep3rKeeperFundable contract\\n/// @notice Handles the actions required to become a keeper\\ninterface IKeep3rKeeperFundable {\\n // Events\\n\\n /// @notice Emitted when Keep3rKeeperFundable#activate is called\\n /// @param _keeper The keeper that has been activated\\n /// @param _bond The asset the keeper has bonded\\n /// @param _amount The amount of the asset the keeper has bonded\\n event Activation(address indexed _keeper, address indexed _bond, uint256 _amount);\\n\\n /// @notice Emitted when Keep3rKeeperFundable#withdraw is called\\n /// @param _keeper The caller of Keep3rKeeperFundable#withdraw function\\n /// @param _bond The asset to withdraw from the bonding pool\\n /// @param _amount The amount of funds withdrawn\\n event Withdrawal(address indexed _keeper, address indexed _bond, uint256 _amount);\\n\\n // Errors\\n\\n /// @notice Throws when the address that is trying to register as a job is already a job\\n error AlreadyAJob();\\n\\n // Methods\\n\\n /// @notice Beginning of the bonding process\\n /// @param _bonding The asset being bonded\\n /// @param _amount The amount of bonding asset being bonded\\n function bond(address _bonding, uint256 _amount) external;\\n\\n /// @notice Beginning of the unbonding process\\n /// @param _bonding The asset being unbonded\\n /// @param _amount Allows for partial unbonding\\n function unbond(address _bonding, uint256 _amount) external;\\n\\n /// @notice End of the bonding process after bonding time has passed\\n /// @param _bonding The asset being activated as bond collateral\\n function activate(address _bonding) external;\\n\\n /// @notice Withdraw funds after unbonding has finished\\n /// @param _bonding The asset to withdraw from the bonding pool\\n function withdraw(address _bonding) external;\\n}\\n\\n/// @title Keep3rKeeperDisputable contract\\n/// @notice Handles the actions that can be taken on a disputed keeper\\ninterface IKeep3rKeeperDisputable is IKeep3rDisputable, IKeep3rKeeperFundable {\\n // Events\\n\\n /// @notice Emitted when Keep3rKeeperDisputable#slash is called\\n /// @param _keeper The address of the slashed keeper\\n /// @param _slasher The user that called Keep3rKeeperDisputable#slash\\n /// @param _amount The amount of credits slashed from the keeper\\n event KeeperSlash(address indexed _keeper, address indexed _slasher, uint256 _amount);\\n\\n /// @notice Emitted when Keep3rKeeperDisputable#revoke is called\\n /// @param _keeper The address of the revoked keeper\\n /// @param _slasher The user that called Keep3rKeeperDisputable#revoke\\n event KeeperRevoke(address indexed _keeper, address indexed _slasher);\\n\\n // Methods\\n\\n /// @notice Allows governance to slash a keeper based on a dispute\\n /// @param _keeper The address being slashed\\n /// @param _bonded The asset being slashed\\n /// @param _bondAmount The bonded amount being slashed\\n /// @param _unbondAmount The pending unbond amount being slashed\\n function slash(\\n address _keeper,\\n address _bonded,\\n uint256 _bondAmount,\\n uint256 _unbondAmount\\n ) external;\\n\\n /// @notice Blacklists a keeper from participating in the network\\n /// @param _keeper The address being slashed\\n function revoke(address _keeper) external;\\n}\\n\\n// solhint-disable-next-line no-empty-blocks\\n\\n/// @title Keep3rKeepers contract\\ninterface IKeep3rKeepers is IKeep3rKeeperDisputable {\\n\\n}\\n\",\"keccak256\":\"0xc95e6bba82a8371c6bd15a8e9d0df91c826b5050b8ee01d913c1c13a4e92a49b\",\"license\":\"MIT\"},\"solidity/interfaces/peripherals/IKeep3rParameters.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4 <0.9.0;\\n\\nimport './IKeep3rAccountance.sol';\\n\\n/// @title Keep3rParameters contract\\n/// @notice Handles and sets all the required parameters for Keep3r\\ninterface IKeep3rParameters is IKeep3rAccountance {\\n // Events\\n\\n /// @notice Emitted when the Keep3rHelper address is changed\\n /// @param _keep3rHelper The address of Keep3rHelper's contract\\n event Keep3rHelperChange(address _keep3rHelper);\\n\\n /// @notice Emitted when the Keep3rV1 address is changed\\n /// @param _keep3rV1 The address of Keep3rV1's contract\\n event Keep3rV1Change(address _keep3rV1);\\n\\n /// @notice Emitted when the Keep3rV1Proxy address is changed\\n /// @param _keep3rV1Proxy The address of Keep3rV1Proxy's contract\\n event Keep3rV1ProxyChange(address _keep3rV1Proxy);\\n\\n /// @notice Emitted when bondTime is changed\\n /// @param _bondTime The new bondTime\\n event BondTimeChange(uint256 _bondTime);\\n\\n /// @notice Emitted when _liquidityMinimum is changed\\n /// @param _liquidityMinimum The new _liquidityMinimum\\n event LiquidityMinimumChange(uint256 _liquidityMinimum);\\n\\n /// @notice Emitted when _unbondTime is changed\\n /// @param _unbondTime The new _unbondTime\\n event UnbondTimeChange(uint256 _unbondTime);\\n\\n /// @notice Emitted when _rewardPeriodTime is changed\\n /// @param _rewardPeriodTime The new _rewardPeriodTime\\n event RewardPeriodTimeChange(uint256 _rewardPeriodTime);\\n\\n /// @notice Emitted when the inflationPeriod is changed\\n /// @param _inflationPeriod The new inflationPeriod\\n event InflationPeriodChange(uint256 _inflationPeriod);\\n\\n /// @notice Emitted when the fee is changed\\n /// @param _fee The new token credits fee\\n event FeeChange(uint256 _fee);\\n\\n // Variables\\n\\n /// @notice Address of Keep3rHelper's contract\\n /// @return _keep3rHelper The address of Keep3rHelper's contract\\n function keep3rHelper() external view returns (address _keep3rHelper);\\n\\n /// @notice Address of Keep3rV1's contract\\n /// @return _keep3rV1 The address of Keep3rV1's contract\\n function keep3rV1() external view returns (address _keep3rV1);\\n\\n /// @notice Address of Keep3rV1Proxy's contract\\n /// @return _keep3rV1Proxy The address of Keep3rV1Proxy's contract\\n function keep3rV1Proxy() external view returns (address _keep3rV1Proxy);\\n\\n /// @notice The amount of time required to pass after a keeper has bonded assets for it to be able to activate\\n /// @return _days The required bondTime in days\\n function bondTime() external view returns (uint256 _days);\\n\\n /// @notice The amount of time required to pass before a keeper can unbond what he has bonded\\n /// @return _days The required unbondTime in days\\n function unbondTime() external view returns (uint256 _days);\\n\\n /// @notice The minimum amount of liquidity required to fund a job per liquidity\\n /// @return _amount The minimum amount of liquidity in KP3R\\n function liquidityMinimum() external view returns (uint256 _amount);\\n\\n /// @notice The amount of time between each scheduled credits reward given to a job\\n /// @return _days The reward period in days\\n function rewardPeriodTime() external view returns (uint256 _days);\\n\\n /// @notice The inflation period is the denominator used to regulate the emission of KP3R\\n /// @return _period The denominator used to regulate the emission of KP3R\\n function inflationPeriod() external view returns (uint256 _period);\\n\\n /// @notice The fee to be sent to governance when a user adds liquidity to a job\\n /// @return _amount The fee amount to be sent to governance when a user adds liquidity to a job\\n function fee() external view returns (uint256 _amount);\\n\\n // Errors\\n\\n /// @notice Throws if the reward period is less than the minimum reward period time\\n error MinRewardPeriod();\\n\\n /// @notice Throws if either a job or a keeper is disputed\\n error Disputed();\\n\\n /// @notice Throws if there are no bonded assets\\n error BondsUnexistent();\\n\\n /// @notice Throws if the time required to bond an asset has not passed yet\\n error BondsLocked();\\n\\n /// @notice Throws if there are no bonds to withdraw\\n error UnbondsUnexistent();\\n\\n /// @notice Throws if the time required to withdraw the bonds has not passed yet\\n error UnbondsLocked();\\n\\n // Methods\\n\\n /// @notice Sets the Keep3rHelper address\\n /// @param _keep3rHelper The Keep3rHelper address\\n function setKeep3rHelper(address _keep3rHelper) external;\\n\\n /// @notice Sets the Keep3rV1 address\\n /// @param _keep3rV1 The Keep3rV1 address\\n function setKeep3rV1(address _keep3rV1) external;\\n\\n /// @notice Sets the Keep3rV1Proxy address\\n /// @param _keep3rV1Proxy The Keep3rV1Proxy address\\n function setKeep3rV1Proxy(address _keep3rV1Proxy) external;\\n\\n /// @notice Sets the bond time required to activate as a keeper\\n /// @param _bond The new bond time\\n function setBondTime(uint256 _bond) external;\\n\\n /// @notice Sets the unbond time required unbond what has been bonded\\n /// @param _unbond The new unbond time\\n function setUnbondTime(uint256 _unbond) external;\\n\\n /// @notice Sets the minimum amount of liquidity required to fund a job\\n /// @param _liquidityMinimum The new minimum amount of liquidity\\n function setLiquidityMinimum(uint256 _liquidityMinimum) external;\\n\\n /// @notice Sets the time required to pass between rewards for jobs\\n /// @param _rewardPeriodTime The new amount of time required to pass between rewards\\n function setRewardPeriodTime(uint256 _rewardPeriodTime) external;\\n\\n /// @notice Sets the new inflation period\\n /// @param _inflationPeriod The new inflation period\\n function setInflationPeriod(uint256 _inflationPeriod) external;\\n\\n /// @notice Sets the new fee\\n /// @param _fee The new fee\\n function setFee(uint256 _fee) external;\\n}\\n\",\"keccak256\":\"0x942f99c6e3b229a551faaae8f03000b934b20502a7cfade14780508201fd098e\",\"license\":\"MIT\"},\"solidity/interfaces/peripherals/IKeep3rRoles.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4 <0.9.0;\\n\\nimport './IBaseErrors.sol';\\nimport './IGovernable.sol';\\nimport './IDustCollector.sol';\\n\\n/// @title Keep3rRoles contract\\n/// @notice Manages the Keep3r specific roles\\ninterface IKeep3rRoles is IBaseErrors, IDustCollector, IGovernable {\\n // Events\\n\\n /// @notice Emitted when a slasher is added\\n /// @param _slasher Address of the added slasher\\n event SlasherAdded(address _slasher);\\n\\n /// @notice Emitted when a slasher is removed\\n /// @param _slasher Address of the removed slasher\\n event SlasherRemoved(address _slasher);\\n\\n /// @notice Emitted when a disputer is added\\n /// @param _disputer Address of the added disputer\\n event DisputerAdded(address _disputer);\\n\\n /// @notice Emitted when a disputer is removed\\n /// @param _disputer Address of the removed disputer\\n event DisputerRemoved(address _disputer);\\n\\n // Variables\\n\\n /// @notice Tracks whether the address is a slasher or not\\n /// @param _slasher Address being checked as a slasher\\n /// @return _isSlasher Whether the address is a slasher or not\\n function slashers(address _slasher) external view returns (bool _isSlasher);\\n\\n /// @notice Tracks whether the address is a disputer or not\\n /// @param _disputer Address being checked as a disputer\\n /// @return _isDisputer Whether the address is a disputer or not\\n function disputers(address _disputer) external view returns (bool _isDisputer);\\n\\n // Errors\\n\\n /// @notice Throws if the address is already a registered slasher\\n error SlasherExistent();\\n\\n /// @notice Throws if caller is not a registered slasher\\n error SlasherUnexistent();\\n\\n /// @notice Throws if the address is already a registered disputer\\n error DisputerExistent();\\n\\n /// @notice Throws if caller is not a registered disputer\\n error DisputerUnexistent();\\n\\n /// @notice Throws if the msg.sender is not a slasher or is not a part of governance\\n error OnlySlasher();\\n\\n /// @notice Throws if the msg.sender is not a disputer or is not a part of governance\\n error OnlyDisputer();\\n\\n // Methods\\n\\n /// @notice Registers a slasher by updating the slashers mapping\\n function addSlasher(address _slasher) external;\\n\\n /// @notice Removes a slasher by updating the slashers mapping\\n function removeSlasher(address _slasher) external;\\n\\n /// @notice Registers a disputer by updating the disputers mapping\\n function addDisputer(address _disputer) external;\\n\\n /// @notice Removes a disputer by updating the disputers mapping\\n function removeDisputer(address _disputer) external;\\n}\\n\",\"keccak256\":\"0xe6eca166cf6ad99e5379d754030222873bb9868ff3e2a76de815a438ead533a2\",\"license\":\"MIT\"}},\"version\":1}", - "bytecode": "0x60806040526203f480601f55621275006020556729a2241af62c000060215562069780602255622cd300602355601e6024553480156200003e57600080fd5b5060405162005fcc38038062005fcc83398101604081905262000061916200012a565b60016000558383838382828286806001600160a01b038116620000965760405162b293ed60e81b815260040160405180910390fd5b600380546001600160a01b03199081166001600160a01b0393841617909155601e8054821696831696909617909555601c805486169482169490941790935550601d8054909316911617905550506000601f8190556020555050600160215550506201518060225550506206978060235562000187565b80516001600160a01b03811681146200012557600080fd5b919050565b600080600080608085870312156200014157600080fd5b6200014c856200010d565b93506200015c602086016200010d565b92506200016c604086016200010d565b91506200017c606086016200010d565b905092959194509250565b615e3580620001976000396000f3fe608060405234801561001057600080fd5b50600436106103e15760003560e01c8063951dc22c1161020d578063c7ae40d011610121578063c7ae40d0146109c3578063cb4be2bb146109d6578063cb54694d146109e9578063cd22af1b146109fc578063d55995fe14610a27578063dd2080d614610a3a578063ddca3f4314610a4d578063e326ac4314610a56578063ebbb619414610a76578063ec00cdfc14610a89578063ec8ca64314610a9c578063f0f346b914610ac5578063f11a1d1a14610ad8578063f136a09d14610aeb578063f25e311b14610b0b578063f263c47014610b1e578063f39c38a014610b27578063f75f9f7b14610b3a578063f9d46cf214610b4d578063fc253d2b14610b60578063fe75bc4614610b6957600080fd5b8063951dc22c146107d6578063966abd00146107de57806398e90a0f146107f15780639d5c33d81461081a578063a21458091461082d578063a39744b514610840578063a515366a1461086b578063a5d059ca1461087e578063a676f9ff14610891578063a7d2e784146108b1578063aac6aa9c146108ba578063ab033ea9146108cd578063af320e81146108e0578063b0103b1a146108f3578063b239223314610916578063b440027f14610929578063b600702a14610954578063b7e7734014610967578063b87fcbff1461097a578063c20297f01461099d578063c5198abc146109b057600080fd5b806359a2255e1161030457806359a2255e146106325780635aa6e675146106455780635ebe23f0146106585780635feeb79414610661578063633fb68f1461067457806364bb43ee1461067d57806368a9f19c14610690578063694798e6146106a357806369fe0e2d146106ce5780636ba42aaa146106e15780636cf262bc146106f45780636e2a9ca61461070757806372da828a1461071a57806374a8f1031461072d578063768b5d90146107405780637c8fce2314610749578063878c723e146107515780638bb6dfa81461077a5780638cb22b761461078d5780638fe204dd146107b057806390a4684e146107c357600080fd5b8063034d4c61146103e657806307b435c21461040c5780630c620bce146104375780630d6a1f871461044c5780631101eb411461045f57806311466d721461047457806315006b8214610487578063165e62e7146104b2578063168f92e7146104ef5780631b44555e1461051a5780631c5a9d9c1461053a5780631ef94b911461054d57806321040b011461056d578063238efcbc14610598578063274a8db4146105a057806351cff8d9146105d357806352a4de29146105e657806355ea6c47146105f9578063575288bf1461060c578063594a3a931461061f575b600080fd5b6103f96103f4366004615786565b610b7c565b6040519081526020015b60405180910390f35b6103f961041a3660046157c0565b601760209081526000928352604080842090915290825290205481565b61043f610c82565b6040516104039190615b35565b6103f961045a36600461596f565b610c93565b61047261046d366004615844565b610d99565b005b61047261048236600461596f565b610ef3565b6103f96104953660046157c0565b601560209081526000928352604080842090915290825290205481565b6104c56104c0366004615786565b611082565b604080518251600690810b825260208085015190910b908201529181015190820152606001610403565b6103f96104fd3660046157c0565b600e60209081526000928352604080842090915290825290205481565b6103f9610528366004615786565b600a6020526000908152604090205481565b610472610548366004615786565b611448565b601c54610560906001600160a01b031681565b6040516104039190615aac565b6103f961057b3660046157c0565b601860209081526000928352604080842090915290825290205481565b610472611603565b6105c36105ae366004615786565b60066020526000908152604090205460ff1681565b6040519015158152602001610403565b6104726105e1366004615786565b61168f565b6104726105f4366004615844565b611827565b610472610607366004615786565b611a58565b61047261061a366004615844565b611b0c565b61047261062d3660046157c0565b611dcf565b610472610640366004615786565b611e74565b600354610560906001600160a01b031681565b6103f9601f5481565b61047261066f366004615786565b611f26565b6103f960215481565b61047261068b366004615786565b6121b5565b61047261069e366004615786565b612296565b6103f96106b13660046157c0565b602860209081526000928352604080842090915290825290205481565b6104726106dc366004615a30565b612375565b6105c36106ef366004615786565b6123d5565b6103f9610702366004615786565b612435565b610472610715366004615844565b61256b565b610472610728366004615786565b6126ba565b61047261073b366004615786565b612757565b6103f960225481565b61043f612852565b61056061075f366004615786565b6001602052600090815260409020546001600160a01b031681565b6103f9610788366004615786565b61285e565b6105c361079b366004615786565b60196020526000908152604090205460ff1681565b6104726107be366004615a30565b612901565b6104726107d13660046157c0565b61295f565b61043f612a4d565b6104726107ec36600461599b565b612a59565b6105606107ff366004615786565b6002602052600090815260409020546001600160a01b031681565b610472610828366004615786565b612b6f565b61047261083b3660046157f9565b612c4e565b6103f961084e3660046157c0565b600d60209081526000928352604080842090915290825290205481565b61047261087936600461596f565b612e1e565b61047261088c36600461596f565b61307f565b6103f961089f366004615786565b60296020526000908152604090205481565b6103f960205481565b6104726108c8366004615786565b613159565b6104726108db366004615786565b61320d565b6104726108ee3660046157c0565b613283565b6105c3610901366004615786565b600c6020526000908152604090205460ff1681565b610472610924366004615a30565b613702565b6103f96109373660046157c0565b602560209081526000928352604080842090915290825290205481565b610472610962366004615786565b613762565b610472610975366004615a30565b613987565b6105c3610988366004615786565b60056020526000908152604090205460ff1681565b6104726109ab3660046158d8565b6139e7565b6104726109be366004615786565b613aa0565b601d54610560906001600160a01b031681565b6104726109e4366004615786565b613b66565b6104726109f7366004615a30565b613c03565b6103f9610a0a3660046157c0565b601660209081526000928352604080842090915290825290205481565b610472610a35366004615885565b613c87565b610472610a48366004615844565b613ebe565b6103f960245481565b6103f9610a64366004615786565b600b6020526000908152604090205481565b610472610a84366004615a30565b61403b565b610472610a97366004615786565b61409b565b610560610aaa366004615786565b602c602052600090815260409020546001600160a01b031681565b610472610ad3366004615786565b614143565b601e54610560906001600160a01b031681565b6103f9610af9366004615786565b602a6020526000908152604090205481565b610472610b19366004615844565b6141f7565b6103f960095481565b600454610560906001600160a01b031681565b610472610b48366004615786565b61443c565b6105c3610b5b36600461591e565b6144f4565b6103f960235481565b610472610b7736600461596f565b6145dd565b600080610b8883612435565b6022549091504290610ba390610b9e9083615cb6565b6146cd565b6001600160a01b0385166000908152602960205260409020541115610c47576022546001600160a01b038516600090815260296020526040902054610be89042615cb6565b10610c24576022546001600160a01b038516600090815260296020526040902054610c139190615c1b565b610c1d9082615cb6565b9050610c5d565b6001600160a01b038416600090815260296020526040902054610c1d9082615cb6565b610c50426146cd565b610c5a9082615cb6565b90505b610c6781836146e7565b610c708561285e565b610c7a9190615c1b565b949350505050565b6060610c8e6026614711565b905090565b6000610ca0602684614725565b15610d93576000610cb084611082565b90508060400151600014610d91576001600160a01b03841660009081526014602052604081205460ff16610cf1578160200151610cec90615d28565b610cf7565b81602001515b601e5460225460405163a0d2710760e01b8152929350610d88926001600160a01b039092169163a0d2710791610d339189918791600401615bec565b60206040518083038186803b158015610d4b57600080fd5b505afa158015610d5f573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d839190615a49565b614747565b92505050610d93565b505b92915050565b6001600160a01b038381166000908152600160205260409020548491163314610dd557604051636efb4f4160e11b815260040160405180910390fd5b602054610de29042615c1b565b6001600160a01b03808616600081815260176020908152604080832094891680845294825280832095909555918152601882528381209281529190529081208054849290610e31908490615c1b565b90915550610e429050848484614758565b6001600160a01b038085166000908152602860209081526040808320938716835292905220548015801590610e815750602154610e7f8286614966565b105b15610e9f57604051636f447fcd60e11b815260040160405180910390fd5b836001600160a01b0316856001600160a01b03167f9aaab310d247ad45aef26bbdefc4ebf20c728fdb84c92b95b2b05d21826940de85604051610ee491815260200190565b60405180910390a35050505050565b336000818152600c602052604090205460ff1615610f245760405163ad2fdf3b60e01b815260040160405180910390fd5b610f2f601a82614725565b610f4b5760405162941a5760e11b815260040160405180910390fd5b610f5481614a84565b15610faf576001600160a01b038116600081815260296020908152604080832054600f835281842054601090935292819020549051600080516020615de083398151915293610fa69390929091615c05565b60405180910390a25b6001600160a01b0381166000908152600f602052604090205482111561102e57610fd881614c5a565b6001600160a01b038116600081815260296020908152604080832054600f835281842054601090935292819020549051600080516020615de0833981519152936110259390929091615c05565b60405180910390a25b611039818484614ce8565b601c546001600160a01b03808516918382169116600080516020615dc083398151915285611065614de5565b6040805192835260208301919091520160405180910390a4505050565b60408051606081018252600080825260208201819052918101919091526110a8426146cd565b6001600160a01b0383166000908152602b6020526040902060010154141561111e57506001600160a01b03166000908152602b602090815260409182902082516060810184528154600681810b810b810b8352600160381b909104810b810b900b92810192909252600101549181019190915290565b60008061113260225442610b9e9190615cb6565b6001600160a01b0385166000908152602b602052604090206001015490915081141561129657604080516001808252818301909252600091602080830190803683375050506001600160a01b0386166000908152602b602052604090205490915060060b61119f426146cd565b6111a99042615cb6565b826000815181106111bc576111bc615d91565b63ffffffff909216602092830291909101820152601e546001600160a01b038881166000908152601390935260409283902054925163dc686d9160e01b81529181169263dc686d91926112189291909116908690600401615ac0565b60606040518083038186803b15801561123057600080fd5b505afa158015611244573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061126891906159ed565b600692830b90920b80885291955061128291839150615c66565b600690810b900b60208601525061141f9050565b6001600160a01b0384166000908152602b602052604090206001015481111561141f576040805160028082526060820183526000926020830190803683370190505090506112e3426146cd565b6112ed9042615cb6565b8160008151811061130057611300615d91565b602002602001019063ffffffff16908163ffffffff1681525050602254611326426146cd565b6113309042615cb6565b61133a9190615c1b565b8160018151811061134d5761134d615d91565b63ffffffff909216602092830291909101820152601e546001600160a01b0387811660009081526013909352604080842054905163dc686d9160e01b81529282169263dc686d91926113a59216908690600401615ac0565b60606040518083038186803b1580156113bd57600080fd5b505afa1580156113d1573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906113f591906159ed565b600692830b90920b8088529195509150611410908290615c66565b600690810b900b602086015250505b81156114385761142e426146cd565b6040840152611440565b600060408401525b50505b919050565b336000818152600c602052604090205460ff1615611479576040516362e6201d60e01b815260040160405180910390fd5b6001600160a01b03808216600090815260166020908152604080832093861683529290522054806114bd57604051636258f48160e01b815260040160405180910390fd5b4281106114dd57604051630fd0eeef60e11b815260040160405180910390fd5b6001600160a01b0382166000908152600b6020526040902054611516576001600160a01b0382166000908152600b602052604090204290555b611521600783614dff565b506001600160a01b038083166000818152601560209081526040808320948816808452948252808320805490849055938352600d8252808320948352939052918220805491928392611574908490615c1b565b9091555050601c546001600160a01b03858116911614156115b05780600960008282546115a19190615c1b565b909155506115b0905081614e14565b836001600160a01b0316836001600160a01b03167f3673530133b6da67e9854f605b0cfa7bb9798cd33c18036dfc10d8da7c4d4a75836040516115f591815260200190565b60405180910390a350505050565b6004546001600160a01b0316331461162e57604051637ef5703160e11b815260040160405180910390fd5b60048054600380546001600160a01b0383166001600160a01b031991821681179092559091169091556040517fc73be659241aade67e9a059bcf21494955018b213dbd1179054ccf928b13f3b69161168591615aac565b60405180910390a1565b600260005414156116bb5760405162461bcd60e51b81526004016116b290615bb5565b60405180910390fd5b600260009081553381526018602090815260408083206001600160a01b03851684529091529020546117005760405163184c088160e21b815260040160405180910390fd5b3360009081526017602090815260408083206001600160a01b03851684529091529020544211611743576040516327cfdcb760e01b815260040160405180910390fd5b336000908152600c602052604090205460ff1615611774576040516362e6201d60e01b815260040160405180910390fd5b3360008181526018602090815260408083206001600160a01b038681168086529184528285208054908690559585526017845282852082865290935290832092909255601c541614156117ca576117ca81614e76565b6117de6001600160a01b0383163383614ebe565b6040518181526001600160a01b0383169033907f2717ead6b9200dd235aad468c9809ea400fe33ac69b5bfaa6d3e90fc922b63989060200160405180910390a350506001600055565b6002600054141561184a5760405162461bcd60e51b81526004016116b290615bb5565b600260005561185a602683614725565b6118775760405163e0b6aead60e01b815260040160405180910390fd5b611882601a84614725565b61189f57604051636211d34960e01b815260040160405180910390fd5b6001600160a01b03831660009081526012602052604090206118c19083614dff565b506118cb83614f19565b6021546001600160a01b0380851660009081526028602090815260408083209387168352929052205461190990611903908490615c1b565b84614966565b101561192857604051636f447fcd60e11b815260040160405180910390fd5b6001600160a01b038316600081815260296020908152604080832054600f835281842054601090935292819020549051600080516020615de0833981519152936119759390929091615c05565b60405180910390a26119926001600160a01b038316333084614f77565b6001600160a01b038084166000908152602860209081526040808320938616835292905290812080548392906119c9908490615c1b565b909155506119dc9050610d838284614966565b6001600160a01b03841660009081526010602052604081208054909190611a04908490615c1b565b909155505060405181815233906001600160a01b0384811691908616907f4e186bc75a2220191b826baff3ee63c3e970e94e58a9007ff94c9a7b8e6ebb3f9060200160405180910390a45050600160005550565b3360009081526006602052604090205460ff16611a8857604051630942721960e31b815260040160405180910390fd5b6001600160a01b0381166000908152600c602052604090205460ff16611ac1576040516310cec38560e21b815260040160405180910390fd5b6001600160a01b0381166000818152600c6020526040808220805460ff19169055513392917fe02b2375d8fb4aef3e5bc5d53bffcf70b6f185c5c93e69dcbe8b6cfc58e837e291a350565b60026000541415611b2f5760405162461bcd60e51b81526004016116b290615bb5565b6002600055611b3f601a84614725565b611b5c57604051636211d34960e01b815260040160405180910390fd5b601c546001600160a01b0383811691161415611b8a5760405162822d9760e71b815260040160405180910390fd5b6040516370a0823160e01b81526000906001600160a01b038416906370a0823190611bb9903090600401615aac565b60206040518083038186803b158015611bd157600080fd5b505afa158015611be5573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611c099190615a49565b9050611c206001600160a01b038416333085614f77565b600081846001600160a01b03166370a08231306040518263ffffffff1660e01b8152600401611c4f9190615aac565b60206040518083038186803b158015611c6757600080fd5b505afa158015611c7b573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611c9f9190615a49565b611ca99190615cb6565b9050600061271060245483611cbe9190615c47565b611cc89190615c33565b9050611cd48183615cb6565b6001600160a01b038088166000908152600e60209081526040808320938a1683529290529081208054909190611d0b908490615c1b565b90915550506001600160a01b0380871660009081526025602090815260408083208985168085529252909120429055600354611d48921683614ebe565b6001600160a01b0386166000908152601160205260409020611d6a9086614dff565b50336001600160a01b0316856001600160a01b0316876001600160a01b03167fec1a37d4a331a5059081e0fb5da1735e7890900cd215a4fb1e9f2779fd7b83eb85604051611dba91815260200190565b60405180910390a45050600160005550505050565b6001600160a01b038281166000908152600160205260409020548391163314611e0b57604051636efb4f4160e11b815260040160405180910390fd5b6001600160a01b03838116600081815260026020908152604080832080546001600160a01b031916888716908117909155600190925280832054905191941692917fa8bad3f0b781e1d954af9945167d5f80bfe5e57930f17c93843187c77557a6b891a4505050565b6001600160a01b038181166000908152600260205260409020548291163314611eb05760405163cfe9663360e01b815260040160405180910390fd5b6001600160a01b03828116600081815260016020908152604080832080546002909352818420805487166001600160a01b031980861691909117909255805490911690555193169283929133917fcf30c54296d5eee76168b564c59c50578d49c271733a470f32707c8cfbc88a8b9190a4505050565b602e54611f4657604051630262ab9b60e61b815260040160405180910390fd5b336000818152600c602052604090205460ff1615611f775760405163ad2fdf3b60e01b815260040160405180910390fd5b611f82601a82614725565b611f9e5760405162941a5760e11b815260040160405180910390fd5b611fa781614a84565b15612002576001600160a01b038116600081815260296020908152604080832054600f835281842054601090935292819020549051600080516020615de083398151915293611ff99390929091615c05565b60405180910390a25b601e546001600160a01b038381166000908152600d60209081526040808320601c548516845290915280822054905163435b21c160e01b8152600481019190915290928392839291169063435b21c19060240160606040518083038186803b15801561206d57600080fd5b505afa158015612081573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906120a59190615a62565b92509250925060006120b5614de5565b905060006120c582848688614fb5565b6001600160a01b0387166000908152600f602052604090205490915081111561215f576120f186614c5a565b6001600160a01b038616600081815260296020908152604080832054600f835281842054601090935292819020549051600080516020615de08339815191529361213e9390929091615c05565b60405180910390a261214e614de5565b915061215c82848688614fb5565b90505b61216a868883614ce8565b6000602e55601c5460408051838152602081018590526001600160a01b038a8116938a821693911691600080516020615dc0833981519152910160405180910390a450505050505050565b6003546001600160a01b031633146121e0576040516354348f0360e01b815260040160405180910390fd5b6121eb602682615012565b61220857604051630a8d08b160e01b815260040160405180910390fd5b6001600160a01b038116600090815260136020908152604080832080546001600160a01b031916905560148252808320805460ff19169055602b90915280822080546001600160701b031916815560010191909155517f51199d699bdfd516fa88dd0d2f8487c40c147b4867acaa23adc8d4df6b098e569061228b908390615aac565b60405180910390a150565b6003546001600160a01b031633146122c1576040516354348f0360e01b815260040160405180910390fd5b6001600160a01b0381166122e85760405163d92e233d60e01b815260040160405180910390fd5b6001600160a01b03811660009081526005602052604090205460ff16156123225760405163546da66560e11b815260040160405180910390fd5b6001600160a01b03811660009081526005602052604090819020805460ff19166001179055517f049ccb28ab796d3225573a065712f6e7754487ced56056cda8889c337511807b9061228b908390615aac565b6003546001600160a01b031633146123a0576040516354348f0360e01b815260040160405180910390fd5b60248190556040518181527f4c10ca068ff7002cf5da78f2f697d1e91f6f0ac27f7344b28e8ef25263f87e5d9060200161228b565b60006123df614de5565b602e556123ed600783614725565b15611443577f4851cad52e624c8f7a1d44c28a80db05988ba2451fc0db6b0ec338d8eca95afb602e5460405161242591815260200190565b60405180910390a1506001919050565b6000805b6001600160a01b038316600090815260126020526040902061245a90615027565b811015612565576001600160a01b03831660009081526012602052604081206124839083615031565b9050612490602682614725565b156125525760006124a082611082565b90508060400151600014612550576001600160a01b03821660009081526014602052604081205460ff166124e15781602001516124dc90615d28565b6124e7565b81602001515b601e546001600160a01b03888116600090815260286020908152604080832089851684529091529081902054602254915163a0d2710760e01b815294955061254294929093169263a0d2710792610d33928791600401615bec565b61254c9086615c1b565b9450505b505b508061255d81615cf9565b915050612439565b50919050565b3360009081526005602052604090205460ff1661259b57604051637e57b1e160e01b815260040160405180910390fd5b6001600160a01b0383166000908152600c602052604090205460ff166125d4576040516310cec38560e21b815260040160405180910390fd5b6125df838383614758565b60035460405163a9059cbb60e01b81526001600160a01b038481169263a9059cbb9261261392909116908590600401615b1c565b602060405180830381600087803b15801561262d57600080fd5b505af192505050801561265d575060408051601f3d908101601f1916820190925261265a918101906159d2565b60015b61266657612668565b505b336001600160a01b0316836001600160a01b03167f6e10247c3c094d220ee99436c164b7f38d63b335a20ed817cbefaee4bb02d20e84846040516126ad929190615b1c565b60405180910390a3505050565b6003546001600160a01b031633146126e5576040516354348f0360e01b815260040160405180910390fd5b6001600160a01b03811661270c5760405163d92e233d60e01b815260040160405180910390fd5b601e80546001600160a01b0319166001600160a01b0383161790556040517f71973fd672e51deb8f739b1f7e1eab991936645acd6f83e2bde6eeeaff5490b09061228b908390615aac565b3360009081526005602052604090205460ff1661278757604051637e57b1e160e01b815260040160405180910390fd5b6001600160a01b0381166000908152600c602052604090205460ff166127c0576040516310cec38560e21b815260040160405180910390fd5b6127cb600782615012565b50601c546001600160a01b038083166000818152600d60209081526040808320949095168083529381528482205492825260188152848220848352905292909220546128199284929161503d565b60405133906001600160a01b038316907f038a17b9b553c0c3fc2ed14b957a5d8420a1666fd2efe5c1b3fe5f23eea61bb390600090a350565b6060610c8e601a614711565b60008061286a83612435565b6022546001600160a01b038516600090815260296020526040902054919250906128949042615cb6565b1015610d9357600081116128c0576001600160a01b0383166000908152600f60205260409020546128fa565b6001600160a01b038316600090815260106020908152604080832054600f909252909120546128f0908390615c47565b6128fa9190615c33565b9150612565565b6003546001600160a01b0316331461292c576040516354348f0360e01b815260040160405180910390fd5b60208181556040518281527fc8d443472c9783cc36f8f5f5091f08ce9f37fc2f9e6d79cf1d9aaf40a433fee2910161228b565b6001600160a01b03828116600090815260016020526040902054839116331461299b57604051636efb4f4160e11b815260040160405180910390fd5b816001600160a01b0316836001600160a01b031614156129ce5760405163afe7ad4960e01b815260040160405180910390fd5b6001600160a01b038381166000818152602c6020908152604080832080546001600160a01b0319169588169586179055602d825280832094835293905282902042905590517fff0456758201108de53c0ff04c69988d4678ff455b2ce6f733328cf85722c04c90612a40908590615aac565b60405180910390a2505050565b6060610c8e6007614711565b6003546001600160a01b03163314612a84576040516354348f0360e01b815260040160405180910390fd5b6001600160a01b038116612aab5760405163d92e233d60e01b815260040160405180910390fd5b6001600160a01b03831673eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee1415612b0c576040516001600160a01b0382169083156108fc029084906000818181858888f19350505050158015612b06573d6000803e3d6000fd5b50612b20565b612b206001600160a01b0384168284614ebe565b604080516001600160a01b0385811682526020820185905283168183015290517f9a3055ded8c8b5f21bbf4946c5afab6e1fa8b3f057922658e5e1ade125fb0b1e9181900360600190a1505050565b6003546001600160a01b03163314612b9a576040516354348f0360e01b815260040160405180910390fd5b6001600160a01b038116612bc15760405163d92e233d60e01b815260040160405180910390fd5b6001600160a01b03811660009081526006602052604090205460ff1615612bfb5760405163274e25dd60e11b815260040160405180910390fd5b6001600160a01b03811660009081526006602052604090819020805460ff19166001179055517f8addc69f897ecca0e41d70ed4ff9d75a9148a615a0fbda8597e53aea2684302f9061228b908390615aac565b6001600160a01b038381166000908152600160205260409020548491163314612c8a57604051636efb4f4160e11b815260040160405180910390fd5b6001600160a01b038216612cb15760405163d92e233d60e01b815260040160405180910390fd5b6001600160a01b03808516600090815260186020908152604080832093871683529290522054612cf45760405163184c088160e21b815260040160405180910390fd5b6001600160a01b038085166000908152601760209081526040808320938716835292905220544211612d39576040516327cfdcb760e01b815260040160405180910390fd5b6001600160a01b0384166000908152600c602052604090205460ff1615612d73576040516362e6201d60e01b815260040160405180910390fd5b6001600160a01b0380851660008181526018602090815260408083209488168084529482528083208054908490559383526017825280832085845290915281205590612dc0908483614ebe565b826001600160a01b0316846001600160a01b0316866001600160a01b03167ffdb7893bf11f50c621e59cc7f1cf540e94295cb27ca869ec7ed7618ca792886284604051612e0f91815260200190565b60405180910390a45050505050565b60026000541415612e415760405162461bcd60e51b81526004016116b290615bb5565b60026000908155338152600c602052604090205460ff1615612e76576040516362e6201d60e01b815260040160405180910390fd5b612e81601a33614725565b15612e9f5760405163d7229c4360e01b815260040160405180910390fd5b601f54612eac9042615c1b565b3360009081526016602090815260408083206001600160a01b03871680855292528083209390935591516370a0823160e01b81529091906370a0823190612ef7903090600401615aac565b60206040518083038186803b158015612f0f57600080fd5b505afa158015612f23573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612f479190615a49565b9050612f5e6001600160a01b038416333085614f77565b6040516370a0823160e01b815281906001600160a01b038516906370a0823190612f8c903090600401615aac565b60206040518083038186803b158015612fa457600080fd5b505afa158015612fb8573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612fdc9190615a49565b612fe69190615cb6565b336000908152601960209081526040808320805460ff19166001179055601582528083206001600160a01b0388168452909152812080549294508492909190613030908490615c1b565b90915550506040518281526001600160a01b0384169033907fa7e66869262026842e8d81f5e6806cdc8d846e27c824e2e22f4fe51442771b349060200160405180910390a35050600160005550565b60205461308c9042615c1b565b3360008181526017602090815260408083206001600160a01b03881680855290835281842095909555928252600d815282822093825292909252812080548392906130d8908490615cb6565b90915550503360009081526018602090815260408083206001600160a01b038616845290915281208054839290613110908490615c1b565b90915550506040518181526001600160a01b0383169033907f9aaab310d247ad45aef26bbdefc4ebf20c728fdb84c92b95b2b05d21826940de9060200160405180910390a35050565b6003546001600160a01b03163314613184576040516354348f0360e01b815260040160405180910390fd5b6001600160a01b03811660009081526005602052604090205460ff166131bd576040516336fe17e760e21b815260040160405180910390fd5b6001600160a01b03811660009081526005602052604090819020805460ff19169055517f3ed8cbce8cab40e59282f1743e2b607effa08b5cbe0111bb4721134f2f80d0259061228b908390615aac565b6003546001600160a01b03163314613238576040516354348f0360e01b815260040160405180910390fd5b600480546001600160a01b0319166001600160a01b0383161790556040517fe987aaedf9d279143bdf1eee16cf1d0feb47742867d81083df8d6cd0a5ac857f9061228b908390615aac565b6001600160a01b0381811660009081526001602052604090205482911633146132bf57604051636efb4f4160e11b815260040160405180910390fd5b6001600160a01b0383166000908152600c602052604090205460ff16806132fe57506001600160a01b0382166000908152600c602052604090205460ff165b1561331c5760405163ad2fdf3b60e01b815260040160405180910390fd5b6001600160a01b038381166000908152602c602052604090205481169083161461335957604051630ced616b60e21b815260040160405180910390fd5b6001600160a01b038084166000908152602d602090815260408083209386168352929052205461338b90603c90615c1b565b4210156133ab576040516356248e9760e01b815260040160405180910390fd5b6133b483614f19565b6133bd82614f19565b6001600160a01b03831660009081526011602052604081206133de90615027565b11156134c0576001600160a01b03831660009081526011602052604081206134069082615031565b6001600160a01b038086166000908152600e6020818152604080842085871680865290835281852054958a168552928252808420928452919052812080549394509192613454908490615c1b565b90915550506001600160a01b038085166000818152600e6020908152604080832094861683529381528382208290559181526011909152206134969082615012565b506001600160a01b03831660009081526011602052604090206134b99082614dff565b50506133bd565b6001600160a01b03831660009081526012602052604081206134e190615027565b11156135c3576001600160a01b03831660009081526012602052604081206135099082615031565b6001600160a01b03808616600090815260286020818152604080842085871680865290835281852054958a168552928252808420928452919052812080549394509192613557908490615c1b565b90915550506001600160a01b03808516600090815260286020908152604080832085851684528252808320839055928616825260129052206135999082614dff565b506001600160a01b03841660009081526012602052604090206135bc9082615012565b50506134c0565b6001600160a01b03808416600090815260106020526040808220549285168252812080549091906135f5908490615c1b565b90915550506001600160a01b038084166000908152601060209081526040808320839055600f90915280822054928516825281208054909190613639908490615c1b565b90915550506001600160a01b0383166000908152600f60209081526040808320839055602990915281205561366f601a84615012565b506001600160a01b03808416600081815260016020908152604080832080546001600160a01b031990811690915560028352818420805482169055602d8352818420958816808552958352818420849055938352602c909152908190208054909216909155517f9b712b63e3fb1325fa042d3c238ce8144937875065900528ea1e4f3b00f379f290612a40908690615aac565b6003546001600160a01b0316331461372d576040516354348f0360e01b815260040160405180910390fd5b60238190556040518181527fbdcfd7b8482f31cff6a87c362d9e2e3887f4cdc2018c7c485d8e78a7b2fadb699060200161228b565b6003546001600160a01b0316331461378d576040516354348f0360e01b815260040160405180910390fd5b613798602682614dff565b6137b55760405163f25e6b9f60e01b815260040160405180910390fd5b806001600160a01b03166316f0115b6040518163ffffffff1660e01b815260040160206040518083038186803b1580156137ee57600080fd5b505afa158015613802573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061382691906157a3565b6001600160a01b038281166000908152601360205260409081902080546001600160a01b0319169383169384179055601e54905163696a437b60e01b815291169163696a437b9161387a9190600401615aac565b60206040518083038186803b15801561389257600080fd5b505afa1580156138a6573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906138ca91906159d2565b6001600160a01b0382166000908152601460205260409020805460ff19169115159190911790556138fa81611082565b6001600160a01b0382166000908152602b60209081526040918290208351815492850151600690810b66ffffffffffffff908116600160381b026001600160701b03199095169290910b161791909117815591810151600190920191909155517fabfa8db4d238fa78bf4e15fcc91328dd35f3978f200e2857a56bb719732b7b0b9061228b908390615aac565b6003546001600160a01b031633146139b2576040516354348f0360e01b815260040160405180910390fd5b601f8190556040518181527fd319ef78d2b690bb773fcccc2d096306bac7c9222dd0bb6b300f461e4a376b439060200161228b565b3360009081526005602052604090205460ff16613a1757604051637e57b1e160e01b815260040160405180910390fd5b6001600160a01b0384166000908152600c602052604090205460ff16613a50576040516310cec38560e21b815260040160405180910390fd5b613a5c8484848461503d565b336001600160a01b0385167f10a73de7ab6e9023aa6e2bc23f7abf4dcef591487e7e55f44c00e34fe60d56db613a928486615c1b565b6040519081526020016115f5565b613aab601a82614725565b15613ac957604051630809740d60e01b815260040160405180910390fd5b6001600160a01b03811660009081526019602052604090205460ff1615613b0357604051632f3d320560e01b815260040160405180910390fd5b613b0e601a82614dff565b506001600160a01b03811660008181526001602052604080822080546001600160a01b0319163390811790915590519092917fed3faef50715743626cd57de74281a2b17cdbfc11c0486feda541fb911e0293d91a350565b6003546001600160a01b03163314613b91576040516354348f0360e01b815260040160405180910390fd5b6001600160a01b038116613bb85760405163d92e233d60e01b815260040160405180910390fd5b601d80546001600160a01b0319166001600160a01b0383161790556040517feb931b4b5a98d20a6b1e6693a7c59d8e337a06e2f1473bb776e19251db7ae2509061228b908390615aac565b6003546001600160a01b03163314613c2e576040516354348f0360e01b815260040160405180910390fd5b62015180811015613c5257604051633f384aad60e21b815260040160405180910390fd5b60228190556040518181527f54aafa56429e22230b52f1495588ffc632277d74f3a85ec755e13ac50c1584d99060200161228b565b60026000541415613caa5760405162461bcd60e51b81526004016116b290615bb5565b600260009081556001600160a01b03858116825260016020526040909120548591163314613ceb57604051636efb4f4160e11b815260040160405180910390fd5b6001600160a01b03808616600090815260256020908152604080832093881683529290522054613d1d90603c90615c1b565b4211613d3c57604051631e0b407560e01b815260040160405180910390fd5b6001600160a01b038086166000908152600e6020908152604080832093881683529290522054831115613d825760405163024ae82d60e61b815260040160405180910390fd5b6001600160a01b0385166000908152600c602052604090205460ff1615613dbc5760405163ad2fdf3b60e01b815260040160405180910390fd5b6001600160a01b038086166000908152600e6020908152604080832093881683529290529081208054859290613df3908490615cb6565b90915550613e0d90506001600160a01b0385168385614ebe565b6001600160a01b038086166000908152600e6020908152604080832093881683529290522054613e5b576001600160a01b0385166000908152601160205260409020613e599085615012565b505b816001600160a01b0316846001600160a01b0316866001600160a01b03167f53e982dd9ec088d634c74c98fbbc161f808b4b6469a26c657120b9a31cb34bfe86604051613eaa91815260200190565b60405180910390a450506001600055505050565b336000818152600c602052604090205460ff1615613eef5760405163ad2fdf3b60e01b815260040160405180910390fd5b6001600160a01b0383166000908152600c602052604090205460ff1615613f29576040516362e6201d60e01b815260040160405180910390fd5b613f34601a82614725565b613f505760405162941a5760e11b815260040160405180910390fd5b6001600160a01b038082166000908152600e6020908152604080832093881683529290522054821115613f965760405163356680b760e01b815260040160405180910390fd5b6001600160a01b038082166000908152600e6020908152604080832093881683529290529081208054849290613fcd908490615cb6565b90915550613fe790506001600160a01b0385168484614ebe565b826001600160a01b0316816001600160a01b0316856001600160a01b0316600080516020615dc08339815191528561401d614de5565b6040805192835260208301919091520160405180910390a450505050565b6003546001600160a01b03163314614066576040516354348f0360e01b815260040160405180910390fd5b60218190556040518181527f24d51b415694a791b1c77df7817c075ac82b83ce611bcd8627d2e66cf37aa3e79060200161228b565b6003546001600160a01b031633146140c6576040516354348f0360e01b815260040160405180910390fd5b6001600160a01b0381166140ed5760405163d92e233d60e01b815260040160405180910390fd5b6140f8600954614e76565b601c80546001600160a01b0319166001600160a01b0383161790556040517f1d1a3e7caf0717056e48dc8aefa54d806c7af86324fece4e5d49f8e1f01f84bf9061228b908390615aac565b6003546001600160a01b0316331461416e576040516354348f0360e01b815260040160405180910390fd5b6001600160a01b03811660009081526006602052604090205460ff166141a757604051633ca0d42760e11b815260040160405180910390fd5b6001600160a01b03811660009081526006602052604090819020805460ff19169055517f5e8bd21d0a98cb2caf33706e56139ff40ffbdca7ec5d9d412a0a2292496dc70e9061228b908390615aac565b3360009081526005602052604090205460ff1661422757604051637e57b1e160e01b815260040160405180910390fd5b6001600160a01b0383166000908152600c602052604090205460ff16614260576040516310cec38560e21b815260040160405180910390fd5b6001600160a01b03831660009081526011602052604090206142829083614725565b61429f57604051632eda7a1160e01b815260040160405180910390fd5b6001600160a01b038084166000908152600e60209081526040808320938616835292905220548111156142e45760405162919bed60e01b815260040160405180910390fd5b60035460405163a9059cbb60e01b81526001600160a01b038481169263a9059cbb9261431892909116908590600401615b1c565b602060405180830381600087803b15801561433257600080fd5b505af1925050508015614362575060408051601f3d908101601f1916820190925261435f918101906159d2565b60015b61436b5761436d565b505b6001600160a01b038084166000908152600e60209081526040808320938616835292905290812080548392906143a4908490615cb6565b90915550506001600160a01b038084166000908152600e60209081526040808320938616835292905220546143f7576001600160a01b03831660009081526011602052604090206143f59083615012565b505b336001600160a01b0316836001600160a01b03167f20262b97130b5cb8f80624eed2733df2b05db4a0789b4a3d0157e1d31833310484846040516126ad929190615b1c565b3360009081526006602052604090205460ff1661446c57604051630942721960e31b815260040160405180910390fd5b6001600160a01b0381166000908152600c602052604090205460ff16156144a6576040516304ee891b60e11b815260040160405180910390fd5b6001600160a01b0381166000818152600c6020526040808220805460ff19166001179055513392917f070125a1c0f5202217aae14ec399abfaaa13c2fd98a91d43bd3a897dd4751e8091a350565b60006144fe614de5565b602e5561450c600787614725565b801561453d57506001600160a01b038087166000908152600d60209081526040808320938916835292905220548411155b801561456157506001600160a01b0386166000908152600a60205260409020548311155b801561459057506001600160a01b0386166000908152600b6020526040902054829061458d9042615cb6565b10155b156145d4577f4851cad52e624c8f7a1d44c28a80db05988ba2451fc0db6b0ec338d8eca95afb602e546040516145c891815260200190565b60405180910390a15060015b95945050505050565b6003546001600160a01b03163314614608576040516354348f0360e01b815260040160405180910390fd5b614613601a83614725565b61463057604051636211d34960e01b815260040160405180910390fd5b61463982614f19565b6001600160a01b0382166000908152600f602052604081208054839290614661908490615c1b565b90915550506001600160a01b038216600081815260296020908152604080832054600f909252918290205491517f5abcf5031fdbd3badb9d1e09094208de329aee72730e87650f346584205d23d1926146c1928252602082015260400190565b60405180910390a25050565b6000602254826146dd9190615d14565b610d939083615cb6565b6000602254831015612565576022546147008385615c47565b61470a9190615c33565b9050610d93565b6060600061471e83615193565b9392505050565b6001600160a01b0381166000908152600183016020526040812054151561471e565b6000610d93826022546023546151ef565b6002600054141561477b5760405162461bcd60e51b81526004016116b290615bb5565b600260009081556001600160a01b03841681526012602052604090206147a19083614725565b6147bd576040516241cfa560e21b815260040160405180910390fd5b6001600160a01b038084166000908152602860209081526040808320938616835292905220548111156148035760405163435b562560e01b815260040160405180910390fd5b61480c8361529d565b600061481b610d838385614966565b6001600160a01b038516600090815260106020526040902054909150156148d1576001600160a01b038416600090815260106020908152604080832054600f9092529091205461486c908390615c47565b6148769190615c33565b6001600160a01b0385166000908152600f60205260408120805490919061489e908490615cb6565b90915550506001600160a01b038416600090815260106020526040812080548392906148cb908490615cb6565b90915550505b6001600160a01b03808516600090815260286020908152604080832093871683529290529081208054849290614908908490615cb6565b90915550506001600160a01b0380851660009081526028602090815260408083209387168352929052205461495b576001600160a01b03841660009081526012602052604090206149599084615012565b505b505060016000555050565b6001600160a01b0381166000908152602b602052604081206001015415610d93576001600160a01b03821660009081526014602052604081205460ff166149d8576001600160a01b0383166000908152602b60205260409020546149d390600160381b900460060b615d28565b6149fc565b6001600160a01b0383166000908152602b6020526040902054600160381b900460060b5b601e5460225460405163a0d2710760e01b81529293506001600160a01b039091169163a0d2710791614a349188918691600401615bec565b60206040518083038186803b158015614a4c57600080fd5b505afa158015614a60573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610c7a9190615a49565b6000614a8f426146cd565b6001600160a01b038316600090815260296020526040902054101561144357614abf60225442610b9e9190615cb6565b6001600160a01b03831660009081526029602052604090205411614b3557614ae68261529d565b6001600160a01b038216600090815260106020908152604080832054600f90925290912055614b14426146cd565b6001600160a01b038316600090815260296020526040902055506001919050565b6022546001600160a01b038316600090815260296020526040902054614b5b9042615cb6565b10614bb757614b698261529d565b6001600160a01b038216600090815260106020908152604080832054600f83528184205560225460299092528220805491929091614ba8908490615c1b565b90915550600191506114439050565b614bc0426146cd565b6001600160a01b0383166000908152602a60205260409020541015611443576001600160a01b038216600090815260106020526040902054614c018361529d565b6001600160a01b038316600090815260106020908152604080832054600f909252909120548291614c3191615c47565b614c3b9190615c33565b6001600160a01b0384166000908152600f602052604090205550919050565b6001600160a01b038116600090815260296020526040902054614c9f90614c819042615cb6565b6001600160a01b0383166000908152601060205260409020546146e7565b6001600160a01b0382166000908152600f602052604081208054909190614cc7908490615c1b565b90915550506001600160a01b03166000908152602960205260409020429055565b6001600160a01b0383166000908152600f6020526040902054811115614d215760405163356680b760e01b815260040160405180910390fd5b6001600160a01b0383166000908152602a60209081526040808320429055600f90915281208054839290614d56908490615cb6565b90915550506001600160a01b038083166000908152600d60209081526040808320601c5490941683529290529081208054839290614d95908490615c1b565b90915550506001600160a01b0382166000908152600a602052604081208054839290614dc2908490615c1b565b925050819055508060096000828254614ddb9190615c1b565b9091555050505050565b6000603f5a614df5906040615c47565b610c8e9190615c33565b600061471e836001600160a01b0384166152c2565b601c54604051630852cd8d60e31b8152600481018390526001600160a01b03909116906342966c68906024015b600060405180830381600087803b158015614e5b57600080fd5b505af1158015614e6f573d6000803e3d6000fd5b5050505050565b8060096000828254614e889190615cb6565b9091555050601d5460405163140e25ad60e31b8152600481018390526001600160a01b039091169063a0712d6890602401614e41565b614f148363a9059cbb60e01b8484604051602401614edd929190615b1c565b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b031990931692909217909152615311565b505050565b614f2281614a84565b50614f2c81614c5a565b6001600160a01b0381166000908152600f6020908152604080832054601090925290912054614f5b91906153e3565b6001600160a01b039091166000908152600f6020526040902055565b6040516001600160a01b0380851660248301528316604482015260648101829052614faf9085906323b872dd60e01b90608401614edd565b50505050565b6000808486602e54614fc79190615cb6565b614fd19190615c1b565b9050670de0b6b3a764000084612710614fea8685615c47565b614ff49190615c33565b614ffe9190615c47565b6150089190615c33565b9695505050505050565b600061471e836001600160a01b0384166153f9565b6000610d93825490565b600061471e83836154ec565b601c546001600160a01b03848116911614615115576003546001600160a01b038085169163a9059cbb91166150728486615c1b565b6040518363ffffffff1660e01b815260040161508f929190615b1c565b602060405180830381600087803b1580156150a957600080fd5b505af19250505080156150d9575060408051601f3d908101601f191682019092526150d6918101906159d2565b60015b615113573d808015615107576040519150601f19603f3d011682016040523d82523d6000602084013e61510c565b606091505b5050615115565b505b6001600160a01b038085166000908152600d602090815260408083209387168352929052908120805484929061514c908490615cb6565b90915550506001600160a01b03808516600090815260186020908152604080832093871683529290529081208054839290615188908490615cb6565b909155505050505050565b6060816000018054806020026020016040519081016040528092919081815260200182805480156151e357602002820191906000526020600020905b8154815260200190600101908083116151cf575b50505050509050919050565b600080806000198587098587029250828110838203039150508060001415615229576000841161521e57600080fd5b50829004905061471e565b80841161523557600080fd5b600084868809600260036001881981018916988990049182028318808302840302808302840302808302840302808302840302808302840302918202909203026000889003889004909101858311909403939093029303949094049190911702949350505050565b6152a681615516565b6001600160a01b03909116600090815260106020526040902055565b600081815260018301602052604081205461530957508154600181810184556000848152602080822090930184905584548482528286019093526040902091909155610d93565b506000610d93565b6000615366826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b03166156599092919063ffffffff16565b805190915015614f14578080602001905181019061538491906159d2565b614f145760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b60648201526084016116b2565b60008183106153f2578161471e565b5090919050565b600081815260018301602052604081205480156154e257600061541d600183615cb6565b855490915060009061543190600190615cb6565b905081811461549657600086600001828154811061545157615451615d91565b906000526020600020015490508087600001848154811061547457615474615d91565b6000918252602080832090910192909255918252600188019052604090208390555b85548690806154a7576154a7615d7b565b600190038181906000526020600020016000905590558560010160008681526020019081526020016000206000905560019350505050610d93565b6000915050610d93565b600082600001828154811061550357615503615d91565b9060005260206000200154905092915050565b6000805b6001600160a01b038316600090815260126020526040902061553b90615027565b811015612565576001600160a01b03831660009081526012602052604081206155649083615031565b9050615571602682614725565b156156465761557f426146cd565b6001600160a01b0382166000908152602b602052604090206001015414615605576155a981611082565b6001600160a01b0382166000908152602b60209081526040918290208351815492850151600690810b66ffffffffffffff908116600160381b026001600160701b03199095169290910b16179190911781559101516001909101555b6001600160a01b0380851660009081526028602090815260408083209385168352929052205461563990610d839083614966565b6156439084615c1b565b92505b508061565181615cf9565b91505061551a565b6060610c7a848460008585843b6156b25760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e747261637400000060448201526064016116b2565b600080866001600160a01b031685876040516156ce9190615a90565b60006040518083038185875af1925050503d806000811461570b576040519150601f19603f3d011682016040523d82523d6000602084013e615710565b606091505b509150915061572082828661572b565b979650505050505050565b6060831561573a57508161471e565b82511561574a5782518084602001fd5b8160405162461bcd60e51b81526004016116b29190615b82565b8051801515811461144357600080fd5b8051600681900b811461144357600080fd5b60006020828403121561579857600080fd5b813561471e81615da7565b6000602082840312156157b557600080fd5b815161471e81615da7565b600080604083850312156157d357600080fd5b82356157de81615da7565b915060208301356157ee81615da7565b809150509250929050565b60008060006060848603121561580e57600080fd5b833561581981615da7565b9250602084013561582981615da7565b9150604084013561583981615da7565b809150509250925092565b60008060006060848603121561585957600080fd5b833561586481615da7565b9250602084013561587481615da7565b929592945050506040919091013590565b6000806000806080858703121561589b57600080fd5b84356158a681615da7565b935060208501356158b681615da7565b92506040850135915060608501356158cd81615da7565b939692955090935050565b600080600080608085870312156158ee57600080fd5b84356158f981615da7565b9350602085013561590981615da7565b93969395505050506040820135916060013590565b600080600080600060a0868803121561593657600080fd5b853561594181615da7565b9450602086013561595181615da7565b94979496505050506040830135926060810135926080909101359150565b6000806040838503121561598257600080fd5b823561598d81615da7565b946020939093013593505050565b6000806000606084860312156159b057600080fd5b83356159bb81615da7565b925060208401359150604084013561583981615da7565b6000602082840312156159e457600080fd5b61471e82615764565b600080600060608486031215615a0257600080fd5b615a0b84615774565b9250615a1960208501615774565b9150615a2760408501615764565b90509250925092565b600060208284031215615a4257600080fd5b5035919050565b600060208284031215615a5b57600080fd5b5051919050565b600080600060608486031215615a7757600080fd5b8351925060208401519150604084015190509250925092565b60008251615aa2818460208701615ccd565b9190910192915050565b6001600160a01b0391909116815260200190565b6001600160a01b038316815260406020808301829052835191830182905260009184820191906060850190845b81811015615b0f57845163ffffffff1683529383019391830191600101615aed565b5090979650505050505050565b6001600160a01b03929092168252602082015260400190565b6020808252825182820181905260009190848201906040850190845b81811015615b765783516001600160a01b031683529284019291840191600101615b51565b50909695505050505050565b6020815260008251806020840152615ba1816040850160208701615ccd565b601f01601f19169190910160400192915050565b6020808252601f908201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604082015260600190565b92835260069190910b6020830152604082015260600190565b9283526020830191909152604082015260600190565b60008219821115615c2e57615c2e615d4f565b500190565b600082615c4257615c42615d65565b500490565b6000816000190483118215151615615c6157615c61615d4f565b500290565b60008160060b8360060b6000811281667fffffffffffff1901831281151615615c9157615c91615d4f565b81667fffffffffffff018313811615615cac57615cac615d4f565b5090039392505050565b600082821015615cc857615cc8615d4f565b500390565b60005b83811015615ce8578181015183820152602001615cd0565b83811115614faf5750506000910152565b6000600019821415615d0d57615d0d615d4f565b5060010190565b600082615d2357615d23615d65565b500690565b60008160060b667fffffffffffff19811415615d4657615d46615d4f565b60000392915050565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052601260045260246000fd5b634e487b7160e01b600052603160045260246000fd5b634e487b7160e01b600052603260045260246000fd5b6001600160a01b0381168114615dbc57600080fd5b5056fe46f2180879a7123a197cc3828c28955d70d661c70acbdc02450daf5f9a9c1cfaee3f0daba9837d1ab0597acf34328550e4832d02e24e467825e7c2dd318c3820a2646970667358221220f7c882e8c48896d57ccb7e708bc5ded3a08e9dae708da84a8703db26482f042e64736f6c63430008070033", - "deployedBytecode": "0x608060405234801561001057600080fd5b50600436106103e15760003560e01c8063951dc22c1161020d578063c7ae40d011610121578063c7ae40d0146109c3578063cb4be2bb146109d6578063cb54694d146109e9578063cd22af1b146109fc578063d55995fe14610a27578063dd2080d614610a3a578063ddca3f4314610a4d578063e326ac4314610a56578063ebbb619414610a76578063ec00cdfc14610a89578063ec8ca64314610a9c578063f0f346b914610ac5578063f11a1d1a14610ad8578063f136a09d14610aeb578063f25e311b14610b0b578063f263c47014610b1e578063f39c38a014610b27578063f75f9f7b14610b3a578063f9d46cf214610b4d578063fc253d2b14610b60578063fe75bc4614610b6957600080fd5b8063951dc22c146107d6578063966abd00146107de57806398e90a0f146107f15780639d5c33d81461081a578063a21458091461082d578063a39744b514610840578063a515366a1461086b578063a5d059ca1461087e578063a676f9ff14610891578063a7d2e784146108b1578063aac6aa9c146108ba578063ab033ea9146108cd578063af320e81146108e0578063b0103b1a146108f3578063b239223314610916578063b440027f14610929578063b600702a14610954578063b7e7734014610967578063b87fcbff1461097a578063c20297f01461099d578063c5198abc146109b057600080fd5b806359a2255e1161030457806359a2255e146106325780635aa6e675146106455780635ebe23f0146106585780635feeb79414610661578063633fb68f1461067457806364bb43ee1461067d57806368a9f19c14610690578063694798e6146106a357806369fe0e2d146106ce5780636ba42aaa146106e15780636cf262bc146106f45780636e2a9ca61461070757806372da828a1461071a57806374a8f1031461072d578063768b5d90146107405780637c8fce2314610749578063878c723e146107515780638bb6dfa81461077a5780638cb22b761461078d5780638fe204dd146107b057806390a4684e146107c357600080fd5b8063034d4c61146103e657806307b435c21461040c5780630c620bce146104375780630d6a1f871461044c5780631101eb411461045f57806311466d721461047457806315006b8214610487578063165e62e7146104b2578063168f92e7146104ef5780631b44555e1461051a5780631c5a9d9c1461053a5780631ef94b911461054d57806321040b011461056d578063238efcbc14610598578063274a8db4146105a057806351cff8d9146105d357806352a4de29146105e657806355ea6c47146105f9578063575288bf1461060c578063594a3a931461061f575b600080fd5b6103f96103f4366004615786565b610b7c565b6040519081526020015b60405180910390f35b6103f961041a3660046157c0565b601760209081526000928352604080842090915290825290205481565b61043f610c82565b6040516104039190615b35565b6103f961045a36600461596f565b610c93565b61047261046d366004615844565b610d99565b005b61047261048236600461596f565b610ef3565b6103f96104953660046157c0565b601560209081526000928352604080842090915290825290205481565b6104c56104c0366004615786565b611082565b604080518251600690810b825260208085015190910b908201529181015190820152606001610403565b6103f96104fd3660046157c0565b600e60209081526000928352604080842090915290825290205481565b6103f9610528366004615786565b600a6020526000908152604090205481565b610472610548366004615786565b611448565b601c54610560906001600160a01b031681565b6040516104039190615aac565b6103f961057b3660046157c0565b601860209081526000928352604080842090915290825290205481565b610472611603565b6105c36105ae366004615786565b60066020526000908152604090205460ff1681565b6040519015158152602001610403565b6104726105e1366004615786565b61168f565b6104726105f4366004615844565b611827565b610472610607366004615786565b611a58565b61047261061a366004615844565b611b0c565b61047261062d3660046157c0565b611dcf565b610472610640366004615786565b611e74565b600354610560906001600160a01b031681565b6103f9601f5481565b61047261066f366004615786565b611f26565b6103f960215481565b61047261068b366004615786565b6121b5565b61047261069e366004615786565b612296565b6103f96106b13660046157c0565b602860209081526000928352604080842090915290825290205481565b6104726106dc366004615a30565b612375565b6105c36106ef366004615786565b6123d5565b6103f9610702366004615786565b612435565b610472610715366004615844565b61256b565b610472610728366004615786565b6126ba565b61047261073b366004615786565b612757565b6103f960225481565b61043f612852565b61056061075f366004615786565b6001602052600090815260409020546001600160a01b031681565b6103f9610788366004615786565b61285e565b6105c361079b366004615786565b60196020526000908152604090205460ff1681565b6104726107be366004615a30565b612901565b6104726107d13660046157c0565b61295f565b61043f612a4d565b6104726107ec36600461599b565b612a59565b6105606107ff366004615786565b6002602052600090815260409020546001600160a01b031681565b610472610828366004615786565b612b6f565b61047261083b3660046157f9565b612c4e565b6103f961084e3660046157c0565b600d60209081526000928352604080842090915290825290205481565b61047261087936600461596f565b612e1e565b61047261088c36600461596f565b61307f565b6103f961089f366004615786565b60296020526000908152604090205481565b6103f960205481565b6104726108c8366004615786565b613159565b6104726108db366004615786565b61320d565b6104726108ee3660046157c0565b613283565b6105c3610901366004615786565b600c6020526000908152604090205460ff1681565b610472610924366004615a30565b613702565b6103f96109373660046157c0565b602560209081526000928352604080842090915290825290205481565b610472610962366004615786565b613762565b610472610975366004615a30565b613987565b6105c3610988366004615786565b60056020526000908152604090205460ff1681565b6104726109ab3660046158d8565b6139e7565b6104726109be366004615786565b613aa0565b601d54610560906001600160a01b031681565b6104726109e4366004615786565b613b66565b6104726109f7366004615a30565b613c03565b6103f9610a0a3660046157c0565b601660209081526000928352604080842090915290825290205481565b610472610a35366004615885565b613c87565b610472610a48366004615844565b613ebe565b6103f960245481565b6103f9610a64366004615786565b600b6020526000908152604090205481565b610472610a84366004615a30565b61403b565b610472610a97366004615786565b61409b565b610560610aaa366004615786565b602c602052600090815260409020546001600160a01b031681565b610472610ad3366004615786565b614143565b601e54610560906001600160a01b031681565b6103f9610af9366004615786565b602a6020526000908152604090205481565b610472610b19366004615844565b6141f7565b6103f960095481565b600454610560906001600160a01b031681565b610472610b48366004615786565b61443c565b6105c3610b5b36600461591e565b6144f4565b6103f960235481565b610472610b7736600461596f565b6145dd565b600080610b8883612435565b6022549091504290610ba390610b9e9083615cb6565b6146cd565b6001600160a01b0385166000908152602960205260409020541115610c47576022546001600160a01b038516600090815260296020526040902054610be89042615cb6565b10610c24576022546001600160a01b038516600090815260296020526040902054610c139190615c1b565b610c1d9082615cb6565b9050610c5d565b6001600160a01b038416600090815260296020526040902054610c1d9082615cb6565b610c50426146cd565b610c5a9082615cb6565b90505b610c6781836146e7565b610c708561285e565b610c7a9190615c1b565b949350505050565b6060610c8e6026614711565b905090565b6000610ca0602684614725565b15610d93576000610cb084611082565b90508060400151600014610d91576001600160a01b03841660009081526014602052604081205460ff16610cf1578160200151610cec90615d28565b610cf7565b81602001515b601e5460225460405163a0d2710760e01b8152929350610d88926001600160a01b039092169163a0d2710791610d339189918791600401615bec565b60206040518083038186803b158015610d4b57600080fd5b505afa158015610d5f573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d839190615a49565b614747565b92505050610d93565b505b92915050565b6001600160a01b038381166000908152600160205260409020548491163314610dd557604051636efb4f4160e11b815260040160405180910390fd5b602054610de29042615c1b565b6001600160a01b03808616600081815260176020908152604080832094891680845294825280832095909555918152601882528381209281529190529081208054849290610e31908490615c1b565b90915550610e429050848484614758565b6001600160a01b038085166000908152602860209081526040808320938716835292905220548015801590610e815750602154610e7f8286614966565b105b15610e9f57604051636f447fcd60e11b815260040160405180910390fd5b836001600160a01b0316856001600160a01b03167f9aaab310d247ad45aef26bbdefc4ebf20c728fdb84c92b95b2b05d21826940de85604051610ee491815260200190565b60405180910390a35050505050565b336000818152600c602052604090205460ff1615610f245760405163ad2fdf3b60e01b815260040160405180910390fd5b610f2f601a82614725565b610f4b5760405162941a5760e11b815260040160405180910390fd5b610f5481614a84565b15610faf576001600160a01b038116600081815260296020908152604080832054600f835281842054601090935292819020549051600080516020615de083398151915293610fa69390929091615c05565b60405180910390a25b6001600160a01b0381166000908152600f602052604090205482111561102e57610fd881614c5a565b6001600160a01b038116600081815260296020908152604080832054600f835281842054601090935292819020549051600080516020615de0833981519152936110259390929091615c05565b60405180910390a25b611039818484614ce8565b601c546001600160a01b03808516918382169116600080516020615dc083398151915285611065614de5565b6040805192835260208301919091520160405180910390a4505050565b60408051606081018252600080825260208201819052918101919091526110a8426146cd565b6001600160a01b0383166000908152602b6020526040902060010154141561111e57506001600160a01b03166000908152602b602090815260409182902082516060810184528154600681810b810b810b8352600160381b909104810b810b900b92810192909252600101549181019190915290565b60008061113260225442610b9e9190615cb6565b6001600160a01b0385166000908152602b602052604090206001015490915081141561129657604080516001808252818301909252600091602080830190803683375050506001600160a01b0386166000908152602b602052604090205490915060060b61119f426146cd565b6111a99042615cb6565b826000815181106111bc576111bc615d91565b63ffffffff909216602092830291909101820152601e546001600160a01b038881166000908152601390935260409283902054925163dc686d9160e01b81529181169263dc686d91926112189291909116908690600401615ac0565b60606040518083038186803b15801561123057600080fd5b505afa158015611244573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061126891906159ed565b600692830b90920b80885291955061128291839150615c66565b600690810b900b60208601525061141f9050565b6001600160a01b0384166000908152602b602052604090206001015481111561141f576040805160028082526060820183526000926020830190803683370190505090506112e3426146cd565b6112ed9042615cb6565b8160008151811061130057611300615d91565b602002602001019063ffffffff16908163ffffffff1681525050602254611326426146cd565b6113309042615cb6565b61133a9190615c1b565b8160018151811061134d5761134d615d91565b63ffffffff909216602092830291909101820152601e546001600160a01b0387811660009081526013909352604080842054905163dc686d9160e01b81529282169263dc686d91926113a59216908690600401615ac0565b60606040518083038186803b1580156113bd57600080fd5b505afa1580156113d1573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906113f591906159ed565b600692830b90920b8088529195509150611410908290615c66565b600690810b900b602086015250505b81156114385761142e426146cd565b6040840152611440565b600060408401525b50505b919050565b336000818152600c602052604090205460ff1615611479576040516362e6201d60e01b815260040160405180910390fd5b6001600160a01b03808216600090815260166020908152604080832093861683529290522054806114bd57604051636258f48160e01b815260040160405180910390fd5b4281106114dd57604051630fd0eeef60e11b815260040160405180910390fd5b6001600160a01b0382166000908152600b6020526040902054611516576001600160a01b0382166000908152600b602052604090204290555b611521600783614dff565b506001600160a01b038083166000818152601560209081526040808320948816808452948252808320805490849055938352600d8252808320948352939052918220805491928392611574908490615c1b565b9091555050601c546001600160a01b03858116911614156115b05780600960008282546115a19190615c1b565b909155506115b0905081614e14565b836001600160a01b0316836001600160a01b03167f3673530133b6da67e9854f605b0cfa7bb9798cd33c18036dfc10d8da7c4d4a75836040516115f591815260200190565b60405180910390a350505050565b6004546001600160a01b0316331461162e57604051637ef5703160e11b815260040160405180910390fd5b60048054600380546001600160a01b0383166001600160a01b031991821681179092559091169091556040517fc73be659241aade67e9a059bcf21494955018b213dbd1179054ccf928b13f3b69161168591615aac565b60405180910390a1565b600260005414156116bb5760405162461bcd60e51b81526004016116b290615bb5565b60405180910390fd5b600260009081553381526018602090815260408083206001600160a01b03851684529091529020546117005760405163184c088160e21b815260040160405180910390fd5b3360009081526017602090815260408083206001600160a01b03851684529091529020544211611743576040516327cfdcb760e01b815260040160405180910390fd5b336000908152600c602052604090205460ff1615611774576040516362e6201d60e01b815260040160405180910390fd5b3360008181526018602090815260408083206001600160a01b038681168086529184528285208054908690559585526017845282852082865290935290832092909255601c541614156117ca576117ca81614e76565b6117de6001600160a01b0383163383614ebe565b6040518181526001600160a01b0383169033907f2717ead6b9200dd235aad468c9809ea400fe33ac69b5bfaa6d3e90fc922b63989060200160405180910390a350506001600055565b6002600054141561184a5760405162461bcd60e51b81526004016116b290615bb5565b600260005561185a602683614725565b6118775760405163e0b6aead60e01b815260040160405180910390fd5b611882601a84614725565b61189f57604051636211d34960e01b815260040160405180910390fd5b6001600160a01b03831660009081526012602052604090206118c19083614dff565b506118cb83614f19565b6021546001600160a01b0380851660009081526028602090815260408083209387168352929052205461190990611903908490615c1b565b84614966565b101561192857604051636f447fcd60e11b815260040160405180910390fd5b6001600160a01b038316600081815260296020908152604080832054600f835281842054601090935292819020549051600080516020615de0833981519152936119759390929091615c05565b60405180910390a26119926001600160a01b038316333084614f77565b6001600160a01b038084166000908152602860209081526040808320938616835292905290812080548392906119c9908490615c1b565b909155506119dc9050610d838284614966565b6001600160a01b03841660009081526010602052604081208054909190611a04908490615c1b565b909155505060405181815233906001600160a01b0384811691908616907f4e186bc75a2220191b826baff3ee63c3e970e94e58a9007ff94c9a7b8e6ebb3f9060200160405180910390a45050600160005550565b3360009081526006602052604090205460ff16611a8857604051630942721960e31b815260040160405180910390fd5b6001600160a01b0381166000908152600c602052604090205460ff16611ac1576040516310cec38560e21b815260040160405180910390fd5b6001600160a01b0381166000818152600c6020526040808220805460ff19169055513392917fe02b2375d8fb4aef3e5bc5d53bffcf70b6f185c5c93e69dcbe8b6cfc58e837e291a350565b60026000541415611b2f5760405162461bcd60e51b81526004016116b290615bb5565b6002600055611b3f601a84614725565b611b5c57604051636211d34960e01b815260040160405180910390fd5b601c546001600160a01b0383811691161415611b8a5760405162822d9760e71b815260040160405180910390fd5b6040516370a0823160e01b81526000906001600160a01b038416906370a0823190611bb9903090600401615aac565b60206040518083038186803b158015611bd157600080fd5b505afa158015611be5573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611c099190615a49565b9050611c206001600160a01b038416333085614f77565b600081846001600160a01b03166370a08231306040518263ffffffff1660e01b8152600401611c4f9190615aac565b60206040518083038186803b158015611c6757600080fd5b505afa158015611c7b573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611c9f9190615a49565b611ca99190615cb6565b9050600061271060245483611cbe9190615c47565b611cc89190615c33565b9050611cd48183615cb6565b6001600160a01b038088166000908152600e60209081526040808320938a1683529290529081208054909190611d0b908490615c1b565b90915550506001600160a01b0380871660009081526025602090815260408083208985168085529252909120429055600354611d48921683614ebe565b6001600160a01b0386166000908152601160205260409020611d6a9086614dff565b50336001600160a01b0316856001600160a01b0316876001600160a01b03167fec1a37d4a331a5059081e0fb5da1735e7890900cd215a4fb1e9f2779fd7b83eb85604051611dba91815260200190565b60405180910390a45050600160005550505050565b6001600160a01b038281166000908152600160205260409020548391163314611e0b57604051636efb4f4160e11b815260040160405180910390fd5b6001600160a01b03838116600081815260026020908152604080832080546001600160a01b031916888716908117909155600190925280832054905191941692917fa8bad3f0b781e1d954af9945167d5f80bfe5e57930f17c93843187c77557a6b891a4505050565b6001600160a01b038181166000908152600260205260409020548291163314611eb05760405163cfe9663360e01b815260040160405180910390fd5b6001600160a01b03828116600081815260016020908152604080832080546002909352818420805487166001600160a01b031980861691909117909255805490911690555193169283929133917fcf30c54296d5eee76168b564c59c50578d49c271733a470f32707c8cfbc88a8b9190a4505050565b602e54611f4657604051630262ab9b60e61b815260040160405180910390fd5b336000818152600c602052604090205460ff1615611f775760405163ad2fdf3b60e01b815260040160405180910390fd5b611f82601a82614725565b611f9e5760405162941a5760e11b815260040160405180910390fd5b611fa781614a84565b15612002576001600160a01b038116600081815260296020908152604080832054600f835281842054601090935292819020549051600080516020615de083398151915293611ff99390929091615c05565b60405180910390a25b601e546001600160a01b038381166000908152600d60209081526040808320601c548516845290915280822054905163435b21c160e01b8152600481019190915290928392839291169063435b21c19060240160606040518083038186803b15801561206d57600080fd5b505afa158015612081573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906120a59190615a62565b92509250925060006120b5614de5565b905060006120c582848688614fb5565b6001600160a01b0387166000908152600f602052604090205490915081111561215f576120f186614c5a565b6001600160a01b038616600081815260296020908152604080832054600f835281842054601090935292819020549051600080516020615de08339815191529361213e9390929091615c05565b60405180910390a261214e614de5565b915061215c82848688614fb5565b90505b61216a868883614ce8565b6000602e55601c5460408051838152602081018590526001600160a01b038a8116938a821693911691600080516020615dc0833981519152910160405180910390a450505050505050565b6003546001600160a01b031633146121e0576040516354348f0360e01b815260040160405180910390fd5b6121eb602682615012565b61220857604051630a8d08b160e01b815260040160405180910390fd5b6001600160a01b038116600090815260136020908152604080832080546001600160a01b031916905560148252808320805460ff19169055602b90915280822080546001600160701b031916815560010191909155517f51199d699bdfd516fa88dd0d2f8487c40c147b4867acaa23adc8d4df6b098e569061228b908390615aac565b60405180910390a150565b6003546001600160a01b031633146122c1576040516354348f0360e01b815260040160405180910390fd5b6001600160a01b0381166122e85760405163d92e233d60e01b815260040160405180910390fd5b6001600160a01b03811660009081526005602052604090205460ff16156123225760405163546da66560e11b815260040160405180910390fd5b6001600160a01b03811660009081526005602052604090819020805460ff19166001179055517f049ccb28ab796d3225573a065712f6e7754487ced56056cda8889c337511807b9061228b908390615aac565b6003546001600160a01b031633146123a0576040516354348f0360e01b815260040160405180910390fd5b60248190556040518181527f4c10ca068ff7002cf5da78f2f697d1e91f6f0ac27f7344b28e8ef25263f87e5d9060200161228b565b60006123df614de5565b602e556123ed600783614725565b15611443577f4851cad52e624c8f7a1d44c28a80db05988ba2451fc0db6b0ec338d8eca95afb602e5460405161242591815260200190565b60405180910390a1506001919050565b6000805b6001600160a01b038316600090815260126020526040902061245a90615027565b811015612565576001600160a01b03831660009081526012602052604081206124839083615031565b9050612490602682614725565b156125525760006124a082611082565b90508060400151600014612550576001600160a01b03821660009081526014602052604081205460ff166124e15781602001516124dc90615d28565b6124e7565b81602001515b601e546001600160a01b03888116600090815260286020908152604080832089851684529091529081902054602254915163a0d2710760e01b815294955061254294929093169263a0d2710792610d33928791600401615bec565b61254c9086615c1b565b9450505b505b508061255d81615cf9565b915050612439565b50919050565b3360009081526005602052604090205460ff1661259b57604051637e57b1e160e01b815260040160405180910390fd5b6001600160a01b0383166000908152600c602052604090205460ff166125d4576040516310cec38560e21b815260040160405180910390fd5b6125df838383614758565b60035460405163a9059cbb60e01b81526001600160a01b038481169263a9059cbb9261261392909116908590600401615b1c565b602060405180830381600087803b15801561262d57600080fd5b505af192505050801561265d575060408051601f3d908101601f1916820190925261265a918101906159d2565b60015b61266657612668565b505b336001600160a01b0316836001600160a01b03167f6e10247c3c094d220ee99436c164b7f38d63b335a20ed817cbefaee4bb02d20e84846040516126ad929190615b1c565b60405180910390a3505050565b6003546001600160a01b031633146126e5576040516354348f0360e01b815260040160405180910390fd5b6001600160a01b03811661270c5760405163d92e233d60e01b815260040160405180910390fd5b601e80546001600160a01b0319166001600160a01b0383161790556040517f71973fd672e51deb8f739b1f7e1eab991936645acd6f83e2bde6eeeaff5490b09061228b908390615aac565b3360009081526005602052604090205460ff1661278757604051637e57b1e160e01b815260040160405180910390fd5b6001600160a01b0381166000908152600c602052604090205460ff166127c0576040516310cec38560e21b815260040160405180910390fd5b6127cb600782615012565b50601c546001600160a01b038083166000818152600d60209081526040808320949095168083529381528482205492825260188152848220848352905292909220546128199284929161503d565b60405133906001600160a01b038316907f038a17b9b553c0c3fc2ed14b957a5d8420a1666fd2efe5c1b3fe5f23eea61bb390600090a350565b6060610c8e601a614711565b60008061286a83612435565b6022546001600160a01b038516600090815260296020526040902054919250906128949042615cb6565b1015610d9357600081116128c0576001600160a01b0383166000908152600f60205260409020546128fa565b6001600160a01b038316600090815260106020908152604080832054600f909252909120546128f0908390615c47565b6128fa9190615c33565b9150612565565b6003546001600160a01b0316331461292c576040516354348f0360e01b815260040160405180910390fd5b60208181556040518281527fc8d443472c9783cc36f8f5f5091f08ce9f37fc2f9e6d79cf1d9aaf40a433fee2910161228b565b6001600160a01b03828116600090815260016020526040902054839116331461299b57604051636efb4f4160e11b815260040160405180910390fd5b816001600160a01b0316836001600160a01b031614156129ce5760405163afe7ad4960e01b815260040160405180910390fd5b6001600160a01b038381166000818152602c6020908152604080832080546001600160a01b0319169588169586179055602d825280832094835293905282902042905590517fff0456758201108de53c0ff04c69988d4678ff455b2ce6f733328cf85722c04c90612a40908590615aac565b60405180910390a2505050565b6060610c8e6007614711565b6003546001600160a01b03163314612a84576040516354348f0360e01b815260040160405180910390fd5b6001600160a01b038116612aab5760405163d92e233d60e01b815260040160405180910390fd5b6001600160a01b03831673eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee1415612b0c576040516001600160a01b0382169083156108fc029084906000818181858888f19350505050158015612b06573d6000803e3d6000fd5b50612b20565b612b206001600160a01b0384168284614ebe565b604080516001600160a01b0385811682526020820185905283168183015290517f9a3055ded8c8b5f21bbf4946c5afab6e1fa8b3f057922658e5e1ade125fb0b1e9181900360600190a1505050565b6003546001600160a01b03163314612b9a576040516354348f0360e01b815260040160405180910390fd5b6001600160a01b038116612bc15760405163d92e233d60e01b815260040160405180910390fd5b6001600160a01b03811660009081526006602052604090205460ff1615612bfb5760405163274e25dd60e11b815260040160405180910390fd5b6001600160a01b03811660009081526006602052604090819020805460ff19166001179055517f8addc69f897ecca0e41d70ed4ff9d75a9148a615a0fbda8597e53aea2684302f9061228b908390615aac565b6001600160a01b038381166000908152600160205260409020548491163314612c8a57604051636efb4f4160e11b815260040160405180910390fd5b6001600160a01b038216612cb15760405163d92e233d60e01b815260040160405180910390fd5b6001600160a01b03808516600090815260186020908152604080832093871683529290522054612cf45760405163184c088160e21b815260040160405180910390fd5b6001600160a01b038085166000908152601760209081526040808320938716835292905220544211612d39576040516327cfdcb760e01b815260040160405180910390fd5b6001600160a01b0384166000908152600c602052604090205460ff1615612d73576040516362e6201d60e01b815260040160405180910390fd5b6001600160a01b0380851660008181526018602090815260408083209488168084529482528083208054908490559383526017825280832085845290915281205590612dc0908483614ebe565b826001600160a01b0316846001600160a01b0316866001600160a01b03167ffdb7893bf11f50c621e59cc7f1cf540e94295cb27ca869ec7ed7618ca792886284604051612e0f91815260200190565b60405180910390a45050505050565b60026000541415612e415760405162461bcd60e51b81526004016116b290615bb5565b60026000908155338152600c602052604090205460ff1615612e76576040516362e6201d60e01b815260040160405180910390fd5b612e81601a33614725565b15612e9f5760405163d7229c4360e01b815260040160405180910390fd5b601f54612eac9042615c1b565b3360009081526016602090815260408083206001600160a01b03871680855292528083209390935591516370a0823160e01b81529091906370a0823190612ef7903090600401615aac565b60206040518083038186803b158015612f0f57600080fd5b505afa158015612f23573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612f479190615a49565b9050612f5e6001600160a01b038416333085614f77565b6040516370a0823160e01b815281906001600160a01b038516906370a0823190612f8c903090600401615aac565b60206040518083038186803b158015612fa457600080fd5b505afa158015612fb8573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612fdc9190615a49565b612fe69190615cb6565b336000908152601960209081526040808320805460ff19166001179055601582528083206001600160a01b0388168452909152812080549294508492909190613030908490615c1b565b90915550506040518281526001600160a01b0384169033907fa7e66869262026842e8d81f5e6806cdc8d846e27c824e2e22f4fe51442771b349060200160405180910390a35050600160005550565b60205461308c9042615c1b565b3360008181526017602090815260408083206001600160a01b03881680855290835281842095909555928252600d815282822093825292909252812080548392906130d8908490615cb6565b90915550503360009081526018602090815260408083206001600160a01b038616845290915281208054839290613110908490615c1b565b90915550506040518181526001600160a01b0383169033907f9aaab310d247ad45aef26bbdefc4ebf20c728fdb84c92b95b2b05d21826940de9060200160405180910390a35050565b6003546001600160a01b03163314613184576040516354348f0360e01b815260040160405180910390fd5b6001600160a01b03811660009081526005602052604090205460ff166131bd576040516336fe17e760e21b815260040160405180910390fd5b6001600160a01b03811660009081526005602052604090819020805460ff19169055517f3ed8cbce8cab40e59282f1743e2b607effa08b5cbe0111bb4721134f2f80d0259061228b908390615aac565b6003546001600160a01b03163314613238576040516354348f0360e01b815260040160405180910390fd5b600480546001600160a01b0319166001600160a01b0383161790556040517fe987aaedf9d279143bdf1eee16cf1d0feb47742867d81083df8d6cd0a5ac857f9061228b908390615aac565b6001600160a01b0381811660009081526001602052604090205482911633146132bf57604051636efb4f4160e11b815260040160405180910390fd5b6001600160a01b0383166000908152600c602052604090205460ff16806132fe57506001600160a01b0382166000908152600c602052604090205460ff165b1561331c5760405163ad2fdf3b60e01b815260040160405180910390fd5b6001600160a01b038381166000908152602c602052604090205481169083161461335957604051630ced616b60e21b815260040160405180910390fd5b6001600160a01b038084166000908152602d602090815260408083209386168352929052205461338b90603c90615c1b565b4210156133ab576040516356248e9760e01b815260040160405180910390fd5b6133b483614f19565b6133bd82614f19565b6001600160a01b03831660009081526011602052604081206133de90615027565b11156134c0576001600160a01b03831660009081526011602052604081206134069082615031565b6001600160a01b038086166000908152600e6020818152604080842085871680865290835281852054958a168552928252808420928452919052812080549394509192613454908490615c1b565b90915550506001600160a01b038085166000818152600e6020908152604080832094861683529381528382208290559181526011909152206134969082615012565b506001600160a01b03831660009081526011602052604090206134b99082614dff565b50506133bd565b6001600160a01b03831660009081526012602052604081206134e190615027565b11156135c3576001600160a01b03831660009081526012602052604081206135099082615031565b6001600160a01b03808616600090815260286020818152604080842085871680865290835281852054958a168552928252808420928452919052812080549394509192613557908490615c1b565b90915550506001600160a01b03808516600090815260286020908152604080832085851684528252808320839055928616825260129052206135999082614dff565b506001600160a01b03841660009081526012602052604090206135bc9082615012565b50506134c0565b6001600160a01b03808416600090815260106020526040808220549285168252812080549091906135f5908490615c1b565b90915550506001600160a01b038084166000908152601060209081526040808320839055600f90915280822054928516825281208054909190613639908490615c1b565b90915550506001600160a01b0383166000908152600f60209081526040808320839055602990915281205561366f601a84615012565b506001600160a01b03808416600081815260016020908152604080832080546001600160a01b031990811690915560028352818420805482169055602d8352818420958816808552958352818420849055938352602c909152908190208054909216909155517f9b712b63e3fb1325fa042d3c238ce8144937875065900528ea1e4f3b00f379f290612a40908690615aac565b6003546001600160a01b0316331461372d576040516354348f0360e01b815260040160405180910390fd5b60238190556040518181527fbdcfd7b8482f31cff6a87c362d9e2e3887f4cdc2018c7c485d8e78a7b2fadb699060200161228b565b6003546001600160a01b0316331461378d576040516354348f0360e01b815260040160405180910390fd5b613798602682614dff565b6137b55760405163f25e6b9f60e01b815260040160405180910390fd5b806001600160a01b03166316f0115b6040518163ffffffff1660e01b815260040160206040518083038186803b1580156137ee57600080fd5b505afa158015613802573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061382691906157a3565b6001600160a01b038281166000908152601360205260409081902080546001600160a01b0319169383169384179055601e54905163696a437b60e01b815291169163696a437b9161387a9190600401615aac565b60206040518083038186803b15801561389257600080fd5b505afa1580156138a6573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906138ca91906159d2565b6001600160a01b0382166000908152601460205260409020805460ff19169115159190911790556138fa81611082565b6001600160a01b0382166000908152602b60209081526040918290208351815492850151600690810b66ffffffffffffff908116600160381b026001600160701b03199095169290910b161791909117815591810151600190920191909155517fabfa8db4d238fa78bf4e15fcc91328dd35f3978f200e2857a56bb719732b7b0b9061228b908390615aac565b6003546001600160a01b031633146139b2576040516354348f0360e01b815260040160405180910390fd5b601f8190556040518181527fd319ef78d2b690bb773fcccc2d096306bac7c9222dd0bb6b300f461e4a376b439060200161228b565b3360009081526005602052604090205460ff16613a1757604051637e57b1e160e01b815260040160405180910390fd5b6001600160a01b0384166000908152600c602052604090205460ff16613a50576040516310cec38560e21b815260040160405180910390fd5b613a5c8484848461503d565b336001600160a01b0385167f10a73de7ab6e9023aa6e2bc23f7abf4dcef591487e7e55f44c00e34fe60d56db613a928486615c1b565b6040519081526020016115f5565b613aab601a82614725565b15613ac957604051630809740d60e01b815260040160405180910390fd5b6001600160a01b03811660009081526019602052604090205460ff1615613b0357604051632f3d320560e01b815260040160405180910390fd5b613b0e601a82614dff565b506001600160a01b03811660008181526001602052604080822080546001600160a01b0319163390811790915590519092917fed3faef50715743626cd57de74281a2b17cdbfc11c0486feda541fb911e0293d91a350565b6003546001600160a01b03163314613b91576040516354348f0360e01b815260040160405180910390fd5b6001600160a01b038116613bb85760405163d92e233d60e01b815260040160405180910390fd5b601d80546001600160a01b0319166001600160a01b0383161790556040517feb931b4b5a98d20a6b1e6693a7c59d8e337a06e2f1473bb776e19251db7ae2509061228b908390615aac565b6003546001600160a01b03163314613c2e576040516354348f0360e01b815260040160405180910390fd5b62015180811015613c5257604051633f384aad60e21b815260040160405180910390fd5b60228190556040518181527f54aafa56429e22230b52f1495588ffc632277d74f3a85ec755e13ac50c1584d99060200161228b565b60026000541415613caa5760405162461bcd60e51b81526004016116b290615bb5565b600260009081556001600160a01b03858116825260016020526040909120548591163314613ceb57604051636efb4f4160e11b815260040160405180910390fd5b6001600160a01b03808616600090815260256020908152604080832093881683529290522054613d1d90603c90615c1b565b4211613d3c57604051631e0b407560e01b815260040160405180910390fd5b6001600160a01b038086166000908152600e6020908152604080832093881683529290522054831115613d825760405163024ae82d60e61b815260040160405180910390fd5b6001600160a01b0385166000908152600c602052604090205460ff1615613dbc5760405163ad2fdf3b60e01b815260040160405180910390fd5b6001600160a01b038086166000908152600e6020908152604080832093881683529290529081208054859290613df3908490615cb6565b90915550613e0d90506001600160a01b0385168385614ebe565b6001600160a01b038086166000908152600e6020908152604080832093881683529290522054613e5b576001600160a01b0385166000908152601160205260409020613e599085615012565b505b816001600160a01b0316846001600160a01b0316866001600160a01b03167f53e982dd9ec088d634c74c98fbbc161f808b4b6469a26c657120b9a31cb34bfe86604051613eaa91815260200190565b60405180910390a450506001600055505050565b336000818152600c602052604090205460ff1615613eef5760405163ad2fdf3b60e01b815260040160405180910390fd5b6001600160a01b0383166000908152600c602052604090205460ff1615613f29576040516362e6201d60e01b815260040160405180910390fd5b613f34601a82614725565b613f505760405162941a5760e11b815260040160405180910390fd5b6001600160a01b038082166000908152600e6020908152604080832093881683529290522054821115613f965760405163356680b760e01b815260040160405180910390fd5b6001600160a01b038082166000908152600e6020908152604080832093881683529290529081208054849290613fcd908490615cb6565b90915550613fe790506001600160a01b0385168484614ebe565b826001600160a01b0316816001600160a01b0316856001600160a01b0316600080516020615dc08339815191528561401d614de5565b6040805192835260208301919091520160405180910390a450505050565b6003546001600160a01b03163314614066576040516354348f0360e01b815260040160405180910390fd5b60218190556040518181527f24d51b415694a791b1c77df7817c075ac82b83ce611bcd8627d2e66cf37aa3e79060200161228b565b6003546001600160a01b031633146140c6576040516354348f0360e01b815260040160405180910390fd5b6001600160a01b0381166140ed5760405163d92e233d60e01b815260040160405180910390fd5b6140f8600954614e76565b601c80546001600160a01b0319166001600160a01b0383161790556040517f1d1a3e7caf0717056e48dc8aefa54d806c7af86324fece4e5d49f8e1f01f84bf9061228b908390615aac565b6003546001600160a01b0316331461416e576040516354348f0360e01b815260040160405180910390fd5b6001600160a01b03811660009081526006602052604090205460ff166141a757604051633ca0d42760e11b815260040160405180910390fd5b6001600160a01b03811660009081526006602052604090819020805460ff19169055517f5e8bd21d0a98cb2caf33706e56139ff40ffbdca7ec5d9d412a0a2292496dc70e9061228b908390615aac565b3360009081526005602052604090205460ff1661422757604051637e57b1e160e01b815260040160405180910390fd5b6001600160a01b0383166000908152600c602052604090205460ff16614260576040516310cec38560e21b815260040160405180910390fd5b6001600160a01b03831660009081526011602052604090206142829083614725565b61429f57604051632eda7a1160e01b815260040160405180910390fd5b6001600160a01b038084166000908152600e60209081526040808320938616835292905220548111156142e45760405162919bed60e01b815260040160405180910390fd5b60035460405163a9059cbb60e01b81526001600160a01b038481169263a9059cbb9261431892909116908590600401615b1c565b602060405180830381600087803b15801561433257600080fd5b505af1925050508015614362575060408051601f3d908101601f1916820190925261435f918101906159d2565b60015b61436b5761436d565b505b6001600160a01b038084166000908152600e60209081526040808320938616835292905290812080548392906143a4908490615cb6565b90915550506001600160a01b038084166000908152600e60209081526040808320938616835292905220546143f7576001600160a01b03831660009081526011602052604090206143f59083615012565b505b336001600160a01b0316836001600160a01b03167f20262b97130b5cb8f80624eed2733df2b05db4a0789b4a3d0157e1d31833310484846040516126ad929190615b1c565b3360009081526006602052604090205460ff1661446c57604051630942721960e31b815260040160405180910390fd5b6001600160a01b0381166000908152600c602052604090205460ff16156144a6576040516304ee891b60e11b815260040160405180910390fd5b6001600160a01b0381166000818152600c6020526040808220805460ff19166001179055513392917f070125a1c0f5202217aae14ec399abfaaa13c2fd98a91d43bd3a897dd4751e8091a350565b60006144fe614de5565b602e5561450c600787614725565b801561453d57506001600160a01b038087166000908152600d60209081526040808320938916835292905220548411155b801561456157506001600160a01b0386166000908152600a60205260409020548311155b801561459057506001600160a01b0386166000908152600b6020526040902054829061458d9042615cb6565b10155b156145d4577f4851cad52e624c8f7a1d44c28a80db05988ba2451fc0db6b0ec338d8eca95afb602e546040516145c891815260200190565b60405180910390a15060015b95945050505050565b6003546001600160a01b03163314614608576040516354348f0360e01b815260040160405180910390fd5b614613601a83614725565b61463057604051636211d34960e01b815260040160405180910390fd5b61463982614f19565b6001600160a01b0382166000908152600f602052604081208054839290614661908490615c1b565b90915550506001600160a01b038216600081815260296020908152604080832054600f909252918290205491517f5abcf5031fdbd3badb9d1e09094208de329aee72730e87650f346584205d23d1926146c1928252602082015260400190565b60405180910390a25050565b6000602254826146dd9190615d14565b610d939083615cb6565b6000602254831015612565576022546147008385615c47565b61470a9190615c33565b9050610d93565b6060600061471e83615193565b9392505050565b6001600160a01b0381166000908152600183016020526040812054151561471e565b6000610d93826022546023546151ef565b6002600054141561477b5760405162461bcd60e51b81526004016116b290615bb5565b600260009081556001600160a01b03841681526012602052604090206147a19083614725565b6147bd576040516241cfa560e21b815260040160405180910390fd5b6001600160a01b038084166000908152602860209081526040808320938616835292905220548111156148035760405163435b562560e01b815260040160405180910390fd5b61480c8361529d565b600061481b610d838385614966565b6001600160a01b038516600090815260106020526040902054909150156148d1576001600160a01b038416600090815260106020908152604080832054600f9092529091205461486c908390615c47565b6148769190615c33565b6001600160a01b0385166000908152600f60205260408120805490919061489e908490615cb6565b90915550506001600160a01b038416600090815260106020526040812080548392906148cb908490615cb6565b90915550505b6001600160a01b03808516600090815260286020908152604080832093871683529290529081208054849290614908908490615cb6565b90915550506001600160a01b0380851660009081526028602090815260408083209387168352929052205461495b576001600160a01b03841660009081526012602052604090206149599084615012565b505b505060016000555050565b6001600160a01b0381166000908152602b602052604081206001015415610d93576001600160a01b03821660009081526014602052604081205460ff166149d8576001600160a01b0383166000908152602b60205260409020546149d390600160381b900460060b615d28565b6149fc565b6001600160a01b0383166000908152602b6020526040902054600160381b900460060b5b601e5460225460405163a0d2710760e01b81529293506001600160a01b039091169163a0d2710791614a349188918691600401615bec565b60206040518083038186803b158015614a4c57600080fd5b505afa158015614a60573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610c7a9190615a49565b6000614a8f426146cd565b6001600160a01b038316600090815260296020526040902054101561144357614abf60225442610b9e9190615cb6565b6001600160a01b03831660009081526029602052604090205411614b3557614ae68261529d565b6001600160a01b038216600090815260106020908152604080832054600f90925290912055614b14426146cd565b6001600160a01b038316600090815260296020526040902055506001919050565b6022546001600160a01b038316600090815260296020526040902054614b5b9042615cb6565b10614bb757614b698261529d565b6001600160a01b038216600090815260106020908152604080832054600f83528184205560225460299092528220805491929091614ba8908490615c1b565b90915550600191506114439050565b614bc0426146cd565b6001600160a01b0383166000908152602a60205260409020541015611443576001600160a01b038216600090815260106020526040902054614c018361529d565b6001600160a01b038316600090815260106020908152604080832054600f909252909120548291614c3191615c47565b614c3b9190615c33565b6001600160a01b0384166000908152600f602052604090205550919050565b6001600160a01b038116600090815260296020526040902054614c9f90614c819042615cb6565b6001600160a01b0383166000908152601060205260409020546146e7565b6001600160a01b0382166000908152600f602052604081208054909190614cc7908490615c1b565b90915550506001600160a01b03166000908152602960205260409020429055565b6001600160a01b0383166000908152600f6020526040902054811115614d215760405163356680b760e01b815260040160405180910390fd5b6001600160a01b0383166000908152602a60209081526040808320429055600f90915281208054839290614d56908490615cb6565b90915550506001600160a01b038083166000908152600d60209081526040808320601c5490941683529290529081208054839290614d95908490615c1b565b90915550506001600160a01b0382166000908152600a602052604081208054839290614dc2908490615c1b565b925050819055508060096000828254614ddb9190615c1b565b9091555050505050565b6000603f5a614df5906040615c47565b610c8e9190615c33565b600061471e836001600160a01b0384166152c2565b601c54604051630852cd8d60e31b8152600481018390526001600160a01b03909116906342966c68906024015b600060405180830381600087803b158015614e5b57600080fd5b505af1158015614e6f573d6000803e3d6000fd5b5050505050565b8060096000828254614e889190615cb6565b9091555050601d5460405163140e25ad60e31b8152600481018390526001600160a01b039091169063a0712d6890602401614e41565b614f148363a9059cbb60e01b8484604051602401614edd929190615b1c565b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b031990931692909217909152615311565b505050565b614f2281614a84565b50614f2c81614c5a565b6001600160a01b0381166000908152600f6020908152604080832054601090925290912054614f5b91906153e3565b6001600160a01b039091166000908152600f6020526040902055565b6040516001600160a01b0380851660248301528316604482015260648101829052614faf9085906323b872dd60e01b90608401614edd565b50505050565b6000808486602e54614fc79190615cb6565b614fd19190615c1b565b9050670de0b6b3a764000084612710614fea8685615c47565b614ff49190615c33565b614ffe9190615c47565b6150089190615c33565b9695505050505050565b600061471e836001600160a01b0384166153f9565b6000610d93825490565b600061471e83836154ec565b601c546001600160a01b03848116911614615115576003546001600160a01b038085169163a9059cbb91166150728486615c1b565b6040518363ffffffff1660e01b815260040161508f929190615b1c565b602060405180830381600087803b1580156150a957600080fd5b505af19250505080156150d9575060408051601f3d908101601f191682019092526150d6918101906159d2565b60015b615113573d808015615107576040519150601f19603f3d011682016040523d82523d6000602084013e61510c565b606091505b5050615115565b505b6001600160a01b038085166000908152600d602090815260408083209387168352929052908120805484929061514c908490615cb6565b90915550506001600160a01b03808516600090815260186020908152604080832093871683529290529081208054839290615188908490615cb6565b909155505050505050565b6060816000018054806020026020016040519081016040528092919081815260200182805480156151e357602002820191906000526020600020905b8154815260200190600101908083116151cf575b50505050509050919050565b600080806000198587098587029250828110838203039150508060001415615229576000841161521e57600080fd5b50829004905061471e565b80841161523557600080fd5b600084868809600260036001881981018916988990049182028318808302840302808302840302808302840302808302840302808302840302918202909203026000889003889004909101858311909403939093029303949094049190911702949350505050565b6152a681615516565b6001600160a01b03909116600090815260106020526040902055565b600081815260018301602052604081205461530957508154600181810184556000848152602080822090930184905584548482528286019093526040902091909155610d93565b506000610d93565b6000615366826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b03166156599092919063ffffffff16565b805190915015614f14578080602001905181019061538491906159d2565b614f145760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b60648201526084016116b2565b60008183106153f2578161471e565b5090919050565b600081815260018301602052604081205480156154e257600061541d600183615cb6565b855490915060009061543190600190615cb6565b905081811461549657600086600001828154811061545157615451615d91565b906000526020600020015490508087600001848154811061547457615474615d91565b6000918252602080832090910192909255918252600188019052604090208390555b85548690806154a7576154a7615d7b565b600190038181906000526020600020016000905590558560010160008681526020019081526020016000206000905560019350505050610d93565b6000915050610d93565b600082600001828154811061550357615503615d91565b9060005260206000200154905092915050565b6000805b6001600160a01b038316600090815260126020526040902061553b90615027565b811015612565576001600160a01b03831660009081526012602052604081206155649083615031565b9050615571602682614725565b156156465761557f426146cd565b6001600160a01b0382166000908152602b602052604090206001015414615605576155a981611082565b6001600160a01b0382166000908152602b60209081526040918290208351815492850151600690810b66ffffffffffffff908116600160381b026001600160701b03199095169290910b16179190911781559101516001909101555b6001600160a01b0380851660009081526028602090815260408083209385168352929052205461563990610d839083614966565b6156439084615c1b565b92505b508061565181615cf9565b91505061551a565b6060610c7a848460008585843b6156b25760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e747261637400000060448201526064016116b2565b600080866001600160a01b031685876040516156ce9190615a90565b60006040518083038185875af1925050503d806000811461570b576040519150601f19603f3d011682016040523d82523d6000602084013e615710565b606091505b509150915061572082828661572b565b979650505050505050565b6060831561573a57508161471e565b82511561574a5782518084602001fd5b8160405162461bcd60e51b81526004016116b29190615b82565b8051801515811461144357600080fd5b8051600681900b811461144357600080fd5b60006020828403121561579857600080fd5b813561471e81615da7565b6000602082840312156157b557600080fd5b815161471e81615da7565b600080604083850312156157d357600080fd5b82356157de81615da7565b915060208301356157ee81615da7565b809150509250929050565b60008060006060848603121561580e57600080fd5b833561581981615da7565b9250602084013561582981615da7565b9150604084013561583981615da7565b809150509250925092565b60008060006060848603121561585957600080fd5b833561586481615da7565b9250602084013561587481615da7565b929592945050506040919091013590565b6000806000806080858703121561589b57600080fd5b84356158a681615da7565b935060208501356158b681615da7565b92506040850135915060608501356158cd81615da7565b939692955090935050565b600080600080608085870312156158ee57600080fd5b84356158f981615da7565b9350602085013561590981615da7565b93969395505050506040820135916060013590565b600080600080600060a0868803121561593657600080fd5b853561594181615da7565b9450602086013561595181615da7565b94979496505050506040830135926060810135926080909101359150565b6000806040838503121561598257600080fd5b823561598d81615da7565b946020939093013593505050565b6000806000606084860312156159b057600080fd5b83356159bb81615da7565b925060208401359150604084013561583981615da7565b6000602082840312156159e457600080fd5b61471e82615764565b600080600060608486031215615a0257600080fd5b615a0b84615774565b9250615a1960208501615774565b9150615a2760408501615764565b90509250925092565b600060208284031215615a4257600080fd5b5035919050565b600060208284031215615a5b57600080fd5b5051919050565b600080600060608486031215615a7757600080fd5b8351925060208401519150604084015190509250925092565b60008251615aa2818460208701615ccd565b9190910192915050565b6001600160a01b0391909116815260200190565b6001600160a01b038316815260406020808301829052835191830182905260009184820191906060850190845b81811015615b0f57845163ffffffff1683529383019391830191600101615aed565b5090979650505050505050565b6001600160a01b03929092168252602082015260400190565b6020808252825182820181905260009190848201906040850190845b81811015615b765783516001600160a01b031683529284019291840191600101615b51565b50909695505050505050565b6020815260008251806020840152615ba1816040850160208701615ccd565b601f01601f19169190910160400192915050565b6020808252601f908201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604082015260600190565b92835260069190910b6020830152604082015260600190565b9283526020830191909152604082015260600190565b60008219821115615c2e57615c2e615d4f565b500190565b600082615c4257615c42615d65565b500490565b6000816000190483118215151615615c6157615c61615d4f565b500290565b60008160060b8360060b6000811281667fffffffffffff1901831281151615615c9157615c91615d4f565b81667fffffffffffff018313811615615cac57615cac615d4f565b5090039392505050565b600082821015615cc857615cc8615d4f565b500390565b60005b83811015615ce8578181015183820152602001615cd0565b83811115614faf5750506000910152565b6000600019821415615d0d57615d0d615d4f565b5060010190565b600082615d2357615d23615d65565b500690565b60008160060b667fffffffffffff19811415615d4657615d46615d4f565b60000392915050565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052601260045260246000fd5b634e487b7160e01b600052603160045260246000fd5b634e487b7160e01b600052603260045260246000fd5b6001600160a01b0381168114615dbc57600080fd5b5056fe46f2180879a7123a197cc3828c28955d70d661c70acbdc02450daf5f9a9c1cfaee3f0daba9837d1ab0597acf34328550e4832d02e24e467825e7c2dd318c3820a2646970667358221220f7c882e8c48896d57ccb7e708bc5ded3a08e9dae708da84a8703db26482f042e64736f6c63430008070033", - "devdoc": { - "kind": "dev", - "methods": { - "acceptJobMigration(address,address)": { - "details": "Unbond/withdraw process doesn't get migrated", - "params": { - "_fromJob": "The address of the job that requested to migrate", - "_toJob": "The address to which the job wants to migrate to" - } - }, - "acceptJobOwnership(address)": { - "params": { - "_job": "The address of the job" - } - }, - "activate(address)": { - "params": { - "_bonding": "The asset being activated as bond collateral" - } - }, - "addJob(address)": { - "params": { - "_job": "Address of the contract for which work should be performed" - } - }, - "addLiquidityToJob(address,address,uint256)": { - "params": { - "_amount": "The amount of liquidity tokens to add", - "_job": "The address of the job to assign liquidity to", - "_liquidity": "The liquidity being added" - } - }, - "addTokenCreditsToJob(address,address,uint256)": { - "params": { - "_amount": "The amount of credit being added", - "_job": "The address of the job being credited", - "_token": "The address of the token being credited" - } - }, - "approveLiquidity(address)": { - "params": { - "_liquidity": "The address of the liquidity accepted" - } - }, - "approvedLiquidities()": { - "returns": { - "_list": "An array of addresses with all the approved liquidity pairs" - } - }, - "bond(address,uint256)": { - "params": { - "_amount": "The amount of bonding asset being bonded", - "_bonding": "The asset being bonded" - } - }, - "bondedPayment(address,uint256)": { - "details": "Pays the keeper that performs the work with KP3R", - "params": { - "_keeper": "Address of the keeper that performed the work", - "_payment": "The reward that should be allocated for the job" - } - }, - "changeJobOwnership(address,address)": { - "params": { - "_job": "The address of the job", - "_newOwner": "The address of the proposed new owner" - } - }, - "directTokenPayment(address,address,uint256)": { - "details": "Pays the keeper that performs the work with a specific token", - "params": { - "_amount": "The reward that should be allocated", - "_keeper": "Address of the keeper that performed the work", - "_token": "The asset being awarded to the keeper" - } - }, - "dispute(address)": { - "params": { - "_jobOrKeeper": "The address in dispute" - } - }, - "forceLiquidityCreditsToJob(address,uint256)": { - "params": { - "_amount": "The amount of liquidity credits to gift", - "_job": "The address of the job being credited" - } - }, - "isBondedKeeper(address,address,uint256,uint256,uint256)": { - "details": "Should be used for protected functions", - "params": { - "_age": "The minimum keeper age required", - "_bond": "The bond token being evaluated", - "_earned": "The minimum funds earned in the keepers lifetime", - "_keeper": "The keeper to check", - "_minBond": "The minimum amount of bonded tokens" - }, - "returns": { - "_isBondedKeeper": "Whether the `_keeper` meets the given requirements" - } - }, - "isKeeper(address)": { - "details": "Can be used for general (non critical) functions", - "params": { - "_keeper": "The keeper being investigated" - }, - "returns": { - "_isKeeper": "Whether the address passed as a parameter is a keeper or not" - } - }, - "jobLiquidityCredits(address)": { - "params": { - "_job": "The address of the job of which we want to know the liquidity credits" - }, - "returns": { - "_liquidityCredits": "The liquidity credits of a given job" - } - }, - "jobPeriodCredits(address)": { - "params": { - "_job": "The address of the job of which we want to know the period credits" - }, - "returns": { - "_periodCredits": "The credits the given job has at the current period" - } - }, - "jobs()": { - "returns": { - "_list": "Array with all the jobs in _jobs" - } - }, - "keepers()": { - "returns": { - "_list": "Array with all the keepers in _keepers" - } - }, - "migrateJob(address,address)": { - "params": { - "_fromJob": "The address of the job that is requesting to migrate", - "_toJob": "The address at which the job is requesting to migrate" - } - }, - "observeLiquidity(address)": { - "params": { - "_liquidity": "The address of the liquidity pair being observed" - }, - "returns": { - "_tickCache": "The updated TickCache" - } - }, - "quoteLiquidity(address,uint256)": { - "details": "_periodCredits = underlying KP3Rs for given liquidity amount * rewardPeriod / inflationPeriod", - "params": { - "_amount": "The amount of liquidity to provide", - "_liquidity": "The address of the liquidity to provide" - }, - "returns": { - "_periodCredits": "The amount of KP3R periodically minted for the given liquidity" - } - }, - "resolve(address)": { - "params": { - "_jobOrKeeper": "The address cleared" - } - }, - "revoke(address)": { - "params": { - "_keeper": "The address being slashed" - } - }, - "revokeLiquidity(address)": { - "params": { - "_liquidity": "The liquidity no longer accepted" - } - }, - "sendDust(address,uint256,address)": { - "params": { - "_amount": "The amount of the token that will be transferred", - "_to": "The address that will receive the idle funds", - "_token": "The token that will be transferred" - } - }, - "setBondTime(uint256)": { - "params": { - "_bond": "The new bond time" - } - }, - "setFee(uint256)": { - "params": { - "_fee": "The new fee" - } - }, - "setGovernance(address)": { - "params": { - "_governance": "The address being proposed as the new governance" - } - }, - "setInflationPeriod(uint256)": { - "params": { - "_inflationPeriod": "The new inflation period" - } - }, - "setKeep3rHelper(address)": { - "params": { - "_keep3rHelper": "The Keep3rHelper address" - } - }, - "setKeep3rV1(address)": { - "params": { - "_keep3rV1": "The Keep3rV1 address" - } - }, - "setKeep3rV1Proxy(address)": { - "params": { - "_keep3rV1Proxy": "The Keep3rV1Proxy address" - } - }, - "setLiquidityMinimum(uint256)": { - "params": { - "_liquidityMinimum": "The new minimum amount of liquidity" - } - }, - "setRewardPeriodTime(uint256)": { - "params": { - "_rewardPeriodTime": "The new amount of time required to pass between rewards" - } - }, - "setUnbondTime(uint256)": { - "params": { - "_unbond": "The new unbond time" - } - }, - "slash(address,address,uint256,uint256)": { - "params": { - "_bondAmount": "The bonded amount being slashed", - "_bonded": "The asset being slashed", - "_keeper": "The address being slashed", - "_unbondAmount": "The pending unbond amount being slashed" - } - }, - "slashLiquidityFromJob(address,address,uint256)": { - "params": { - "_amount": "The amount of liquidity that will be slashed", - "_job": "The address being slashed", - "_liquidity": "The address of the liquidity that will be slashed" - } - }, - "slashTokenFromJob(address,address,uint256)": { - "params": { - "_amount": "The amount of the token that will be slashed", - "_job": "The address of the job from which the token will be slashed", - "_token": "The address of the token that will be slashed" - } - }, - "totalJobCredits(address)": { - "params": { - "_job": "The address of the job of which we want to know the total credits" - }, - "returns": { - "_credits": "The total credits of the given job" - } - }, - "unbond(address,uint256)": { - "params": { - "_amount": "Allows for partial unbonding", - "_bonding": "The asset being unbonded" - } - }, - "unbondLiquidityFromJob(address,address,uint256)": { - "details": "Can only be called by the job's owner", - "params": { - "_amount": "The amount of liquidity being removed", - "_job": "The address of the job being unbonded from", - "_liquidity": "The liquidity being unbonded" - } - }, - "withdraw(address)": { - "params": { - "_bonding": "The asset to withdraw from the bonding pool" - } - }, - "withdrawLiquidityFromJob(address,address,address)": { - "params": { - "_job": "The address of the job being withdrawn from", - "_liquidity": "The liquidity being withdrawn", - "_receiver": "The address that will receive the withdrawn liquidity" - } - }, - "withdrawTokenCreditsFromJob(address,address,uint256,address)": { - "params": { - "_amount": "The amount of token to be withdrawn", - "_job": "The address of the job from which the credits are withdrawn", - "_receiver": "The user that will receive tokens", - "_token": "The address of the token being withdrawn" - } - }, - "worked(address)": { - "details": "Automatically calculates the payment for the keeper and pays the keeper with bonded KP3R", - "params": { - "_keeper": "Address of the keeper that performed the work" - } - } - }, - "version": 1 - }, - "userdoc": { - "errors": { - "AlreadyAJob()": [ - { - "notice": "Throws when the address that is trying to register as a job is already a job" - } - ], - "AlreadyAKeeper()": [ - { - "notice": "Throws when the address that is trying to register as a keeper is already a keeper" - } - ], - "AlreadyDisputed()": [ - { - "notice": "Throws when a job or keeper is already disputed" - } - ], - "BondsLocked()": [ - { - "notice": "Throws if the time required to bond an asset has not passed yet" - } - ], - "BondsUnexistent()": [ - { - "notice": "Throws if there are no bonded assets" - } - ], - "Disputed()": [ - { - "notice": "Throws if either a job or a keeper is disputed" - } - ], - "DisputerExistent()": [ - { - "notice": "Throws if the address is already a registered disputer" - } - ], - "DisputerUnexistent()": [ - { - "notice": "Throws if caller is not a registered disputer" - } - ], - "GasNotInitialized()": [ - { - "notice": "Throws if work method was called without calling isKeeper or isBondedKeeper" - } - ], - "InsufficientFunds()": [ - { - "notice": "Throws if the amount of funds in the job is less than the payment that must be paid to the keeper that works that job" - } - ], - "InsufficientJobTokenCredits()": [ - { - "notice": "Throws when the user tries to withdraw more tokens than it has" - } - ], - "JobAlreadyAdded()": [ - { - "notice": "Throws when trying to add a job that has already been added" - } - ], - "JobDisputed()": [ - { - "notice": "Throws when an action that requires an undisputed job is applied on a disputed job" - } - ], - "JobLiquidityInsufficient()": [ - { - "notice": "Throws when trying to remove more liquidity than the job has" - } - ], - "JobLiquidityLessThanMin()": [ - { - "notice": "Throws when trying to add less liquidity than the minimum liquidity required" - } - ], - "JobLiquidityUnexistent()": [ - { - "notice": "Throws when the job doesn't have the requested liquidity" - } - ], - "JobMigrationImpossible()": [ - { - "notice": "Throws when the address of the job that requests to migrate wants to migrate to its same address" - } - ], - "JobMigrationLocked()": [ - { - "notice": "Throws when cooldown between migrations has not yet passed" - } - ], - "JobMigrationUnavailable()": [ - { - "notice": "Throws when the _toJob address differs from the address being tracked in the pendingJobMigrations mapping" - } - ], - "JobTokenCreditsLocked()": [ - { - "notice": "Throws when the token withdraw cooldown has not yet passed" - } - ], - "JobTokenInsufficient()": [ - { - "notice": "Throws when someone tries to slash more tokens than the job has" - } - ], - "JobTokenUnexistent()": [ - { - "notice": "Throws when the token trying to be slashed doesn't exist" - } - ], - "JobUnapproved()": [ - { - "notice": "Throws if the address claiming to be a job is not in the list of approved jobs" - } - ], - "JobUnavailable()": [ - { - "notice": "Throws when an address is passed as a job, but that address is not a job" - } - ], - "LiquidityPairApproved()": [ - { - "notice": "Throws when the liquidity being approved has already been approved" - } - ], - "LiquidityPairUnapproved()": [ - { - "notice": "Throws when trying to add liquidity to an unapproved pool" - } - ], - "LiquidityPairUnexistent()": [ - { - "notice": "Throws when the liquidity being removed has not been approved" - } - ], - "MinRewardPeriod()": [ - { - "notice": "Throws if the reward period is less than the minimum reward period time" - } - ], - "NoGovernanceZeroAddress()": [ - { - "notice": "Throws if trying to set governance to zero address" - } - ], - "NotDisputed()": [ - { - "notice": "Throws when a job or keeper is not disputed and someone tries to resolve the dispute" - } - ], - "OnlyDisputer()": [ - { - "notice": "Throws if the msg.sender is not a disputer or is not a part of governance" - } - ], - "OnlyGovernance()": [ - { - "notice": "Throws if the caller of the function is not governance" - } - ], - "OnlyJobOwner()": [ - { - "notice": "Throws when the caller of the function is not the job owner" - } - ], - "OnlyPendingGovernance()": [ - { - "notice": "Throws if the caller of the function is not pendingGovernance" - } - ], - "OnlyPendingJobOwner()": [ - { - "notice": "Throws when the caller of the function is not the pending job owner" - } - ], - "OnlySlasher()": [ - { - "notice": "Throws if the msg.sender is not a slasher or is not a part of governance" - } - ], - "SlasherExistent()": [ - { - "notice": "Throws if the address is already a registered slasher" - } - ], - "SlasherUnexistent()": [ - { - "notice": "Throws if caller is not a registered slasher" - } - ], - "TokenUnallowed()": [ - { - "notice": "Throws when the token is KP3R, as it should not be used for direct token payments" - } - ], - "UnbondsLocked()": [ - { - "notice": "Throws if the time required to withdraw the bonds has not passed yet" - } - ], - "UnbondsUnexistent()": [ - { - "notice": "Throws if there are no bonds to withdraw" - } - ], - "ZeroAddress()": [ - { - "notice": "Throws if a variable is assigned to the zero address" - } - ] - }, - "events": { - "Activation(address,address,uint256)": { - "notice": "Emitted when Keep3rKeeperFundable#activate is called" - }, - "BondTimeChange(uint256)": { - "notice": "Emitted when bondTime is changed" - }, - "Bonding(address,address,uint256)": { - "notice": "Emitted when the bonding process of a new keeper begins" - }, - "Dispute(address,address)": { - "notice": "Emitted when a keeper or a job is disputed" - }, - "DisputerAdded(address)": { - "notice": "Emitted when a disputer is added" - }, - "DisputerRemoved(address)": { - "notice": "Emitted when a disputer is removed" - }, - "DustSent(address,uint256,address)": { - "notice": "Emitted when dust is sent" - }, - "FeeChange(uint256)": { - "notice": "Emitted when the fee is changed" - }, - "GovernanceProposal(address)": { - "notice": "Emitted when a new governance is proposed" - }, - "GovernanceSet(address)": { - "notice": "Emitted when pendingGovernance accepts to be governance" - }, - "InflationPeriodChange(uint256)": { - "notice": "Emitted when the inflationPeriod is changed" - }, - "JobAddition(address,address)": { - "notice": "Emitted when Keep3rJobManager#addJob is called" - }, - "JobMigrationRequested(address,address)": { - "notice": "Emitted when Keep3rJobMigration#migrateJob function is called" - }, - "JobMigrationSuccessful(address,address)": { - "notice": "Emitted when Keep3rJobMigration#acceptJobMigration function is called" - }, - "JobOwnershipAssent(address,address,address)": { - "notice": "Emitted when Keep3rJobOwnership#JobOwnershipAssent is called" - }, - "JobOwnershipChange(address,address,address)": { - "notice": "Emitted when Keep3rJobOwnership#changeJobOwnership is called" - }, - "JobSlashLiquidity(address,address,address,uint256)": { - "notice": "Emitted when Keep3rJobDisputable#slashLiquidityFromJob is called" - }, - "JobSlashToken(address,address,address,uint256)": { - "notice": "Emitted when Keep3rJobDisputable#slashTokenFromJob is called" - }, - "Keep3rHelperChange(address)": { - "notice": "Emitted when the Keep3rHelper address is changed" - }, - "Keep3rV1Change(address)": { - "notice": "Emitted when the Keep3rV1 address is changed" - }, - "Keep3rV1ProxyChange(address)": { - "notice": "Emitted when the Keep3rV1Proxy address is changed" - }, - "KeeperRevoke(address,address)": { - "notice": "Emitted when Keep3rKeeperDisputable#revoke is called" - }, - "KeeperSlash(address,address,uint256)": { - "notice": "Emitted when Keep3rKeeperDisputable#slash is called" - }, - "KeeperValidation(uint256)": { - "notice": "Emitted when a keeper is validated before a job" - }, - "KeeperWork(address,address,address,uint256,uint256)": { - "notice": "Emitted when a keeper works a job" - }, - "LiquidityAddition(address,address,address,uint256)": { - "notice": "Emitted when IKeep3rJobFundableLiquidity#addLiquidityToJob function is called" - }, - "LiquidityApproval(address)": { - "notice": "Emitted when Keep3rJobFundableLiquidity#approveLiquidity function is called" - }, - "LiquidityCreditsForced(address,uint256,uint256)": { - "notice": "Emitted when Keep3rJobFundableLiquidity#forceLiquidityCreditsToJob function is called" - }, - "LiquidityCreditsReward(address,uint256,uint256,uint256)": { - "notice": "Emitted when Keep3rJobFundableLiquidity#addLiquidityToJob function is called" - }, - "LiquidityMinimumChange(uint256)": { - "notice": "Emitted when _liquidityMinimum is changed" - }, - "LiquidityRevocation(address)": { - "notice": "Emitted when Keep3rJobFundableLiquidity#revokeLiquidity function is called" - }, - "LiquidityWithdrawal(address,address,address,uint256)": { - "notice": "Emitted when IKeep3rJobFundableLiquidity#withdrawLiquidityFromJob function is called" - }, - "Resolve(address,address)": { - "notice": "Emitted when a dispute is resolved" - }, - "RewardPeriodTimeChange(uint256)": { - "notice": "Emitted when _rewardPeriodTime is changed" - }, - "SlasherAdded(address)": { - "notice": "Emitted when a slasher is added" - }, - "SlasherRemoved(address)": { - "notice": "Emitted when a slasher is removed" - }, - "TokenCreditAddition(address,address,address,uint256)": { - "notice": "Emitted when Keep3rJobFundableCredits#addTokenCreditsToJob is called" - }, - "TokenCreditWithdrawal(address,address,address,uint256)": { - "notice": "Emitted when Keep3rJobFundableCredits#withdrawTokenCreditsFromJob is called" - }, - "UnbondTimeChange(uint256)": { - "notice": "Emitted when _unbondTime is changed" - }, - "Unbonding(address,address,uint256)": { - "notice": "Emitted when a keeper or job begins the unbonding process to withdraw the funds" - }, - "Withdrawal(address,address,uint256)": { - "notice": "Emitted when Keep3rKeeperFundable#withdraw is called" - } - }, - "kind": "user", - "methods": { - "acceptGovernance()": { - "notice": "Changes the governance from the current governance to the previously proposed address" - }, - "acceptJobMigration(address,address)": { - "notice": "Completes the migration process for a job" - }, - "acceptJobOwnership(address)": { - "notice": "The proposed address accepts to be the owner of the job" - }, - "activate(address)": { - "notice": "End of the bonding process after bonding time has passed" - }, - "addDisputer(address)": { - "notice": "Registers a disputer by updating the disputers mapping" - }, - "addJob(address)": { - "notice": "Allows any caller to add a new job" - }, - "addLiquidityToJob(address,address,uint256)": { - "notice": "Allows anyone to fund a job with liquidity" - }, - "addSlasher(address)": { - "notice": "Registers a slasher by updating the slashers mapping" - }, - "addTokenCreditsToJob(address,address,uint256)": { - "notice": "Add credit to a job to be paid out for work" - }, - "approveLiquidity(address)": { - "notice": "Approve a liquidity pair for being accepted in future" - }, - "approvedLiquidities()": { - "notice": "Lists liquidity pairs" - }, - "bond(address,uint256)": { - "notice": "Beginning of the bonding process" - }, - "bondTime()": { - "notice": "The amount of time required to pass after a keeper has bonded assets for it to be able to activate" - }, - "bondedPayment(address,uint256)": { - "notice": "Implemented by jobs to show that a keeper performed work" - }, - "bonds(address,address)": { - "notice": "Mapping (job => bonding => amount)" - }, - "canActivateAfter(address,address)": { - "notice": "Tracks when a bonding for a keeper can be activated" - }, - "canWithdrawAfter(address,address)": { - "notice": "Tracks when keeper bonds are ready to be withdrawn" - }, - "changeJobOwnership(address,address)": { - "notice": "Proposes a new address to be the owner of the job" - }, - "directTokenPayment(address,address,uint256)": { - "notice": "Implemented by jobs to show that a keeper performed work" - }, - "dispute(address)": { - "notice": "Allows governance to create a dispute for a given keeper/job" - }, - "disputers(address)": { - "notice": "Tracks whether the address is a disputer or not" - }, - "disputes(address)": { - "notice": "Tracks if a keeper or job has a pending dispute" - }, - "fee()": { - "notice": "The fee to be sent to governance when a user adds liquidity to a job" - }, - "firstSeen(address)": { - "notice": "Tracks when a keeper was first registered" - }, - "forceLiquidityCreditsToJob(address,uint256)": { - "notice": "Gifts liquidity credits to the specified job" - }, - "governance()": { - "notice": "Stores the governance address" - }, - "hasBonded(address)": { - "notice": "Checks whether the address has ever bonded an asset" - }, - "inflationPeriod()": { - "notice": "The inflation period is the denominator used to regulate the emission of KP3R" - }, - "isBondedKeeper(address,address,uint256,uint256,uint256)": { - "notice": "Confirms if the current keeper is registered and has a minimum bond of any asset." - }, - "isKeeper(address)": { - "notice": "Confirms if the current keeper is registered" - }, - "jobLiquidityCredits(address)": { - "notice": "Returns the liquidity credits of a given job" - }, - "jobOwner(address)": { - "notice": "Maps the job to the owner of the job" - }, - "jobPendingOwner(address)": { - "notice": "Maps the job to its pending owner" - }, - "jobPeriodCredits(address)": { - "notice": "Returns the credits of a given job for the current period" - }, - "jobTokenCredits(address,address)": { - "notice": "The current token credits available for a job" - }, - "jobTokenCreditsAddedAt(address,address)": { - "notice": "Last block where tokens were added to the job" - }, - "jobs()": { - "notice": "Lists all jobs" - }, - "keep3rHelper()": { - "notice": "Address of Keep3rHelper's contract" - }, - "keep3rV1()": { - "notice": "Address of Keep3rV1's contract" - }, - "keep3rV1Proxy()": { - "notice": "Address of Keep3rV1Proxy's contract" - }, - "keepers()": { - "notice": "Lists all keepers" - }, - "liquidityAmount(address,address)": { - "notice": "Amount of liquidity in a specified job" - }, - "liquidityMinimum()": { - "notice": "The minimum amount of liquidity required to fund a job per liquidity" - }, - "migrateJob(address,address)": { - "notice": "Initializes the migration process for a job by adding the request to the pendingJobMigrations mapping" - }, - "observeLiquidity(address)": { - "notice": "Observes the current state of the liquidity pair being observed and updates TickCache with the information" - }, - "pendingBonds(address,address)": { - "notice": "Tracks the amount of assets deposited in pending bonds" - }, - "pendingGovernance()": { - "notice": "Stores the pendingGovernance address" - }, - "pendingJobMigrations(address)": { - "notice": "Maps the jobs that have requested a migration to the address they have requested to migrate to" - }, - "pendingUnbonds(address,address)": { - "notice": "Tracks how much keeper bonds are to be withdrawn" - }, - "quoteLiquidity(address,uint256)": { - "notice": "Calculates how many credits should be rewarded periodically for a given liquidity amount" - }, - "removeDisputer(address)": { - "notice": "Removes a disputer by updating the disputers mapping" - }, - "removeSlasher(address)": { - "notice": "Removes a slasher by updating the slashers mapping" - }, - "resolve(address)": { - "notice": "Allows governance to resolve a dispute on a keeper/job" - }, - "revoke(address)": { - "notice": "Blacklists a keeper from participating in the network" - }, - "revokeLiquidity(address)": { - "notice": "Revoke a liquidity pair from being accepted in future" - }, - "rewardPeriodTime()": { - "notice": "The amount of time between each scheduled credits reward given to a job" - }, - "rewardedAt(address)": { - "notice": "Last time the job was rewarded liquidity credits" - }, - "sendDust(address,uint256,address)": { - "notice": "Allows an authorized user to transfer the tokens or eth that may have been left in a contract" - }, - "setBondTime(uint256)": { - "notice": "Sets the bond time required to activate as a keeper" - }, - "setFee(uint256)": { - "notice": "Sets the new fee" - }, - "setGovernance(address)": { - "notice": "Proposes a new address to be governance" - }, - "setInflationPeriod(uint256)": { - "notice": "Sets the new inflation period" - }, - "setKeep3rHelper(address)": { - "notice": "Sets the Keep3rHelper address" - }, - "setKeep3rV1(address)": { - "notice": "Sets the Keep3rV1 address" - }, - "setKeep3rV1Proxy(address)": { - "notice": "Sets the Keep3rV1Proxy address" - }, - "setLiquidityMinimum(uint256)": { - "notice": "Sets the minimum amount of liquidity required to fund a job" - }, - "setRewardPeriodTime(uint256)": { - "notice": "Sets the time required to pass between rewards for jobs" - }, - "setUnbondTime(uint256)": { - "notice": "Sets the unbond time required unbond what has been bonded" - }, - "slash(address,address,uint256,uint256)": { - "notice": "Allows governance to slash a keeper based on a dispute" - }, - "slashLiquidityFromJob(address,address,uint256)": { - "notice": "Allows governance or a slasher to slash liquidity from a job" - }, - "slashTokenFromJob(address,address,uint256)": { - "notice": "Allows governance or slasher to slash a job specific token" - }, - "slashers(address)": { - "notice": "Tracks whether the address is a slasher or not" - }, - "totalBonds()": { - "notice": "Tracks the total amount of bonded KP3Rs in the contract" - }, - "totalJobCredits(address)": { - "notice": "Calculates the total credits of a given job" - }, - "unbond(address,uint256)": { - "notice": "Beginning of the unbonding process" - }, - "unbondLiquidityFromJob(address,address,uint256)": { - "notice": "Unbond liquidity for a job" - }, - "unbondTime()": { - "notice": "The amount of time required to pass before a keeper can unbond what he has bonded" - }, - "withdraw(address)": { - "notice": "Withdraw funds after unbonding has finished" - }, - "withdrawLiquidityFromJob(address,address,address)": { - "notice": "Withdraw liquidity from a job" - }, - "withdrawTokenCreditsFromJob(address,address,uint256,address)": { - "notice": "Withdraw credit from a job" - }, - "workCompleted(address)": { - "notice": "Tracks the total KP3R earnings of a keeper since it started working" - }, - "worked(address)": { - "notice": "Implemented by jobs to show that a keeper performed work" - }, - "workedAt(address)": { - "notice": "Last time the job was worked" - } - }, - "version": 1 - }, - "storageLayout": { - "storage": [ - { - "astId": 10, - "contract": "solidity/for-test/testnet/Keep3rForTestnet.sol:Keep3rForTestnet", - "label": "_status", - "offset": 0, - "slot": "0", - "type": "t_uint256" - }, - { - "astId": 8431, - "contract": "solidity/for-test/testnet/Keep3rForTestnet.sol:Keep3rForTestnet", - "label": "jobOwner", - "offset": 0, - "slot": "1", - "type": "t_mapping(t_address,t_address)" - }, - { - "astId": 8437, - "contract": "solidity/for-test/testnet/Keep3rForTestnet.sol:Keep3rForTestnet", - "label": "jobPendingOwner", - "offset": 0, - "slot": "2", - "type": "t_mapping(t_address,t_address)" - }, - { - "astId": 5362, - "contract": "solidity/for-test/testnet/Keep3rForTestnet.sol:Keep3rForTestnet", - "label": "governance", - "offset": 0, - "slot": "3", - "type": "t_address" - }, - { - "astId": 5366, - "contract": "solidity/for-test/testnet/Keep3rForTestnet.sol:Keep3rForTestnet", - "label": "pendingGovernance", - "offset": 0, - "slot": "4", - "type": "t_address" - }, - { - "astId": 5999, - "contract": "solidity/for-test/testnet/Keep3rForTestnet.sol:Keep3rForTestnet", - "label": "slashers", - "offset": 0, - "slot": "5", - "type": "t_mapping(t_address,t_bool)" - }, - { - "astId": 6005, - "contract": "solidity/for-test/testnet/Keep3rForTestnet.sol:Keep3rForTestnet", - "label": "disputers", - "offset": 0, - "slot": "6", - "type": "t_mapping(t_address,t_bool)" - }, - { - "astId": 5467, - "contract": "solidity/for-test/testnet/Keep3rForTestnet.sol:Keep3rForTestnet", - "label": "_keepers", - "offset": 0, - "slot": "7", - "type": "t_struct(AddressSet)1631_storage" - }, - { - "astId": 5471, - "contract": "solidity/for-test/testnet/Keep3rForTestnet.sol:Keep3rForTestnet", - "label": "totalBonds", - "offset": 0, - "slot": "9", - "type": "t_uint256" - }, - { - "astId": 5477, - "contract": "solidity/for-test/testnet/Keep3rForTestnet.sol:Keep3rForTestnet", - "label": "workCompleted", - "offset": 0, - "slot": "10", - "type": "t_mapping(t_address,t_uint256)" - }, - { - "astId": 5483, - "contract": "solidity/for-test/testnet/Keep3rForTestnet.sol:Keep3rForTestnet", - "label": "firstSeen", - "offset": 0, - "slot": "11", - "type": "t_mapping(t_address,t_uint256)" - }, - { - "astId": 5489, - "contract": "solidity/for-test/testnet/Keep3rForTestnet.sol:Keep3rForTestnet", - "label": "disputes", - "offset": 0, - "slot": "12", - "type": "t_mapping(t_address,t_bool)" - }, - { - "astId": 5497, - "contract": "solidity/for-test/testnet/Keep3rForTestnet.sol:Keep3rForTestnet", - "label": "bonds", - "offset": 0, - "slot": "13", - "type": "t_mapping(t_address,t_mapping(t_address,t_uint256))" - }, - { - "astId": 5505, - "contract": "solidity/for-test/testnet/Keep3rForTestnet.sol:Keep3rForTestnet", - "label": "jobTokenCredits", - "offset": 0, - "slot": "14", - "type": "t_mapping(t_address,t_mapping(t_address,t_uint256))" - }, - { - "astId": 5510, - "contract": "solidity/for-test/testnet/Keep3rForTestnet.sol:Keep3rForTestnet", - "label": "_jobLiquidityCredits", - "offset": 0, - "slot": "15", - "type": "t_mapping(t_address,t_uint256)" - }, - { - "astId": 5515, - "contract": "solidity/for-test/testnet/Keep3rForTestnet.sol:Keep3rForTestnet", - "label": "_jobPeriodCredits", - "offset": 0, - "slot": "16", - "type": "t_mapping(t_address,t_uint256)" - }, - { - "astId": 5521, - "contract": "solidity/for-test/testnet/Keep3rForTestnet.sol:Keep3rForTestnet", - "label": "_jobTokens", - "offset": 0, - "slot": "17", - "type": "t_mapping(t_address,t_struct(AddressSet)1631_storage)" - }, - { - "astId": 5527, - "contract": "solidity/for-test/testnet/Keep3rForTestnet.sol:Keep3rForTestnet", - "label": "_jobLiquidities", - "offset": 0, - "slot": "18", - "type": "t_mapping(t_address,t_struct(AddressSet)1631_storage)" - }, - { - "astId": 5532, - "contract": "solidity/for-test/testnet/Keep3rForTestnet.sol:Keep3rForTestnet", - "label": "_liquidityPool", - "offset": 0, - "slot": "19", - "type": "t_mapping(t_address,t_address)" - }, - { - "astId": 5537, - "contract": "solidity/for-test/testnet/Keep3rForTestnet.sol:Keep3rForTestnet", - "label": "_isKP3RToken0", - "offset": 0, - "slot": "20", - "type": "t_mapping(t_address,t_bool)" - }, - { - "astId": 5545, - "contract": "solidity/for-test/testnet/Keep3rForTestnet.sol:Keep3rForTestnet", - "label": "pendingBonds", - "offset": 0, - "slot": "21", - "type": "t_mapping(t_address,t_mapping(t_address,t_uint256))" - }, - { - "astId": 5553, - "contract": "solidity/for-test/testnet/Keep3rForTestnet.sol:Keep3rForTestnet", - "label": "canActivateAfter", - "offset": 0, - "slot": "22", - "type": "t_mapping(t_address,t_mapping(t_address,t_uint256))" - }, - { - "astId": 5561, - "contract": "solidity/for-test/testnet/Keep3rForTestnet.sol:Keep3rForTestnet", - "label": "canWithdrawAfter", - "offset": 0, - "slot": "23", - "type": "t_mapping(t_address,t_mapping(t_address,t_uint256))" - }, - { - "astId": 5569, - "contract": "solidity/for-test/testnet/Keep3rForTestnet.sol:Keep3rForTestnet", - "label": "pendingUnbonds", - "offset": 0, - "slot": "24", - "type": "t_mapping(t_address,t_mapping(t_address,t_uint256))" - }, - { - "astId": 5575, - "contract": "solidity/for-test/testnet/Keep3rForTestnet.sol:Keep3rForTestnet", - "label": "hasBonded", - "offset": 0, - "slot": "25", - "type": "t_mapping(t_address,t_bool)" - }, - { - "astId": 5579, - "contract": "solidity/for-test/testnet/Keep3rForTestnet.sol:Keep3rForTestnet", - "label": "_jobs", - "offset": 0, - "slot": "26", - "type": "t_struct(AddressSet)1631_storage" - }, - { - "astId": 5692, - "contract": "solidity/for-test/testnet/Keep3rForTestnet.sol:Keep3rForTestnet", - "label": "keep3rV1", - "offset": 0, - "slot": "28", - "type": "t_address" - }, - { - "astId": 5696, - "contract": "solidity/for-test/testnet/Keep3rForTestnet.sol:Keep3rForTestnet", - "label": "keep3rV1Proxy", - "offset": 0, - "slot": "29", - "type": "t_address" - }, - { - "astId": 5700, - "contract": "solidity/for-test/testnet/Keep3rForTestnet.sol:Keep3rForTestnet", - "label": "keep3rHelper", - "offset": 0, - "slot": "30", - "type": "t_address" - }, - { - "astId": 5705, - "contract": "solidity/for-test/testnet/Keep3rForTestnet.sol:Keep3rForTestnet", - "label": "bondTime", - "offset": 0, - "slot": "31", - "type": "t_uint256" - }, - { - "astId": 5710, - "contract": "solidity/for-test/testnet/Keep3rForTestnet.sol:Keep3rForTestnet", - "label": "unbondTime", - "offset": 0, - "slot": "32", - "type": "t_uint256" - }, - { - "astId": 5715, - "contract": "solidity/for-test/testnet/Keep3rForTestnet.sol:Keep3rForTestnet", - "label": "liquidityMinimum", - "offset": 0, - "slot": "33", - "type": "t_uint256" - }, - { - "astId": 5720, - "contract": "solidity/for-test/testnet/Keep3rForTestnet.sol:Keep3rForTestnet", - "label": "rewardPeriodTime", - "offset": 0, - "slot": "34", - "type": "t_uint256" - }, - { - "astId": 5725, - "contract": "solidity/for-test/testnet/Keep3rForTestnet.sol:Keep3rForTestnet", - "label": "inflationPeriod", - "offset": 0, - "slot": "35", - "type": "t_uint256" - }, - { - "astId": 5730, - "contract": "solidity/for-test/testnet/Keep3rForTestnet.sol:Keep3rForTestnet", - "label": "fee", - "offset": 0, - "slot": "36", - "type": "t_uint256" - }, - { - "astId": 6432, - "contract": "solidity/for-test/testnet/Keep3rForTestnet.sol:Keep3rForTestnet", - "label": "jobTokenCreditsAddedAt", - "offset": 0, - "slot": "37", - "type": "t_mapping(t_address,t_mapping(t_address,t_uint256))" - }, - { - "astId": 6675, - "contract": "solidity/for-test/testnet/Keep3rForTestnet.sol:Keep3rForTestnet", - "label": "_approvedLiquidities", - "offset": 0, - "slot": "38", - "type": "t_struct(AddressSet)1631_storage" - }, - { - "astId": 6683, - "contract": "solidity/for-test/testnet/Keep3rForTestnet.sol:Keep3rForTestnet", - "label": "liquidityAmount", - "offset": 0, - "slot": "40", - "type": "t_mapping(t_address,t_mapping(t_address,t_uint256))" - }, - { - "astId": 6689, - "contract": "solidity/for-test/testnet/Keep3rForTestnet.sol:Keep3rForTestnet", - "label": "rewardedAt", - "offset": 0, - "slot": "41", - "type": "t_mapping(t_address,t_uint256)" - }, - { - "astId": 6695, - "contract": "solidity/for-test/testnet/Keep3rForTestnet.sol:Keep3rForTestnet", - "label": "workedAt", - "offset": 0, - "slot": "42", - "type": "t_mapping(t_address,t_uint256)" - }, - { - "astId": 6701, - "contract": "solidity/for-test/testnet/Keep3rForTestnet.sol:Keep3rForTestnet", - "label": "_tick", - "offset": 0, - "slot": "43", - "type": "t_mapping(t_address,t_struct(TickCache)14589_storage)" - }, - { - "astId": 8152, - "contract": "solidity/for-test/testnet/Keep3rForTestnet.sol:Keep3rForTestnet", - "label": "pendingJobMigrations", - "offset": 0, - "slot": "44", - "type": "t_mapping(t_address,t_address)" - }, - { - "astId": 8158, - "contract": "solidity/for-test/testnet/Keep3rForTestnet.sol:Keep3rForTestnet", - "label": "_migrationCreatedAt", - "offset": 0, - "slot": "45", - "type": "t_mapping(t_address,t_mapping(t_address,t_uint256))" - }, - { - "astId": 8555, - "contract": "solidity/for-test/testnet/Keep3rForTestnet.sol:Keep3rForTestnet", - "label": "_initialGas", - "offset": 0, - "slot": "46", - "type": "t_uint256" - } - ], - "types": { - "t_address": { - "encoding": "inplace", - "label": "address", - "numberOfBytes": "20" - }, - "t_array(t_bytes32)dyn_storage": { - "base": "t_bytes32", - "encoding": "dynamic_array", - "label": "bytes32[]", - "numberOfBytes": "32" - }, - "t_bool": { - "encoding": "inplace", - "label": "bool", - "numberOfBytes": "1" - }, - "t_bytes32": { - "encoding": "inplace", - "label": "bytes32", - "numberOfBytes": "32" - }, - "t_int56": { - "encoding": "inplace", - "label": "int56", - "numberOfBytes": "7" - }, - "t_mapping(t_address,t_address)": { - "encoding": "mapping", - "key": "t_address", - "label": "mapping(address => address)", - "numberOfBytes": "32", - "value": "t_address" - }, - "t_mapping(t_address,t_bool)": { - "encoding": "mapping", - "key": "t_address", - "label": "mapping(address => bool)", - "numberOfBytes": "32", - "value": "t_bool" - }, - "t_mapping(t_address,t_mapping(t_address,t_uint256))": { - "encoding": "mapping", - "key": "t_address", - "label": "mapping(address => mapping(address => uint256))", - "numberOfBytes": "32", - "value": "t_mapping(t_address,t_uint256)" - }, - "t_mapping(t_address,t_struct(AddressSet)1631_storage)": { - "encoding": "mapping", - "key": "t_address", - "label": "mapping(address => struct EnumerableSet.AddressSet)", - "numberOfBytes": "32", - "value": "t_struct(AddressSet)1631_storage" - }, - "t_mapping(t_address,t_struct(TickCache)14589_storage)": { - "encoding": "mapping", - "key": "t_address", - "label": "mapping(address => struct IKeep3rJobFundableLiquidity.TickCache)", - "numberOfBytes": "32", - "value": "t_struct(TickCache)14589_storage" - }, - "t_mapping(t_address,t_uint256)": { - "encoding": "mapping", - "key": "t_address", - "label": "mapping(address => uint256)", - "numberOfBytes": "32", - "value": "t_uint256" - }, - "t_mapping(t_bytes32,t_uint256)": { - "encoding": "mapping", - "key": "t_bytes32", - "label": "mapping(bytes32 => uint256)", - "numberOfBytes": "32", - "value": "t_uint256" - }, - "t_struct(AddressSet)1631_storage": { - "encoding": "inplace", - "label": "struct EnumerableSet.AddressSet", - "members": [ - { - "astId": 1630, - "contract": "solidity/for-test/testnet/Keep3rForTestnet.sol:Keep3rForTestnet", - "label": "_inner", - "offset": 0, - "slot": "0", - "type": "t_struct(Set)1330_storage" - } - ], - "numberOfBytes": "64" - }, - "t_struct(Set)1330_storage": { - "encoding": "inplace", - "label": "struct EnumerableSet.Set", - "members": [ - { - "astId": 1325, - "contract": "solidity/for-test/testnet/Keep3rForTestnet.sol:Keep3rForTestnet", - "label": "_values", - "offset": 0, - "slot": "0", - "type": "t_array(t_bytes32)dyn_storage" - }, - { - "astId": 1329, - "contract": "solidity/for-test/testnet/Keep3rForTestnet.sol:Keep3rForTestnet", - "label": "_indexes", - "offset": 0, - "slot": "1", - "type": "t_mapping(t_bytes32,t_uint256)" - } - ], - "numberOfBytes": "64" - }, - "t_struct(TickCache)14589_storage": { - "encoding": "inplace", - "label": "struct IKeep3rJobFundableLiquidity.TickCache", - "members": [ - { - "astId": 14584, - "contract": "solidity/for-test/testnet/Keep3rForTestnet.sol:Keep3rForTestnet", - "label": "current", - "offset": 0, - "slot": "0", - "type": "t_int56" - }, - { - "astId": 14586, - "contract": "solidity/for-test/testnet/Keep3rForTestnet.sol:Keep3rForTestnet", - "label": "difference", - "offset": 7, - "slot": "0", - "type": "t_int56" - }, - { - "astId": 14588, - "contract": "solidity/for-test/testnet/Keep3rForTestnet.sol:Keep3rForTestnet", - "label": "period", - "offset": 0, - "slot": "1", - "type": "t_uint256" - } - ], - "numberOfBytes": "64" - }, - "t_uint256": { - "encoding": "inplace", - "label": "uint256", - "numberOfBytes": "32" - } - } - } -} \ No newline at end of file diff --git a/deployments/goerli/Keep3rHelperForTestnet.json b/deployments/goerli/Keep3rHelperForTestnet.json deleted file mode 100644 index 1889f95..0000000 --- a/deployments/goerli/Keep3rHelperForTestnet.json +++ /dev/null @@ -1,1297 +0,0 @@ -{ - "address": "0x399394ca069dCDE2C4d2a32E00a06C3D5fE17E3A", - "abi": [ - { - "inputs": [ - { - "internalType": "address", - "name": "_kp3r", - "type": "address" - }, - { - "internalType": "address", - "name": "_keep3rV2", - "type": "address" - }, - { - "internalType": "address", - "name": "_governance", - "type": "address" - }, - { - "internalType": "address", - "name": "_kp3rWethPool", - "type": "address" - } - ], - "stateMutability": "nonpayable", - "type": "constructor" - }, - { - "inputs": [], - "name": "InvalidOraclePool", - "type": "error" - }, - { - "inputs": [], - "name": "LiquidityPairInvalid", - "type": "error" - }, - { - "inputs": [], - "name": "NoGovernanceZeroAddress", - "type": "error" - }, - { - "inputs": [], - "name": "OnlyGovernance", - "type": "error" - }, - { - "inputs": [], - "name": "OnlyPendingGovernance", - "type": "error" - }, - { - "inputs": [], - "name": "ZeroAddress", - "type": "error" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "address", - "name": "_pendingGovernance", - "type": "address" - } - ], - "name": "GovernanceProposal", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "address", - "name": "_governance", - "type": "address" - } - ], - "name": "GovernanceSet", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "address", - "name": "_keep3rV2", - "type": "address" - } - ], - "name": "Keep3rV2Change", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "address", - "name": "_address", - "type": "address" - }, - { - "indexed": false, - "internalType": "bool", - "name": "_isKP3RToken0", - "type": "bool" - } - ], - "name": "Kp3rWethPoolChange", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "uint256", - "name": "_maxBoost", - "type": "uint256" - } - ], - "name": "MaxBoostChange", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "uint256", - "name": "_minBaseFee", - "type": "uint256" - } - ], - "name": "MinBaseFeeChange", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "uint256", - "name": "_minBoost", - "type": "uint256" - } - ], - "name": "MinBoostChange", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "uint256", - "name": "_minPriorityFee", - "type": "uint256" - } - ], - "name": "MinPriorityFeeChange", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "uint32", - "name": "_quoteTwapTime", - "type": "uint32" - } - ], - "name": "QuoteTwapTimeChange", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "uint256", - "name": "_targetBond", - "type": "uint256" - } - ], - "name": "TargetBondChange", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "uint256", - "name": "_workExtraGas", - "type": "uint256" - } - ], - "name": "WorkExtraGasChange", - "type": "event" - }, - { - "inputs": [], - "name": "BOOST_BASE", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "KP3R", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "acceptGovernance", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_keeper", - "type": "address" - } - ], - "name": "bonds", - "outputs": [ - { - "internalType": "uint256", - "name": "_amountBonded", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "_liquidityAmount", - "type": "uint256" - }, - { - "internalType": "int56", - "name": "_tickDifference", - "type": "int56" - }, - { - "internalType": "uint256", - "name": "_timeInterval", - "type": "uint256" - } - ], - "name": "getKP3RsAtTick", - "outputs": [ - { - "internalType": "uint256", - "name": "_kp3rAmount", - "type": "uint256" - } - ], - "stateMutability": "pure", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "_bonds", - "type": "uint256" - } - ], - "name": "getPaymentParams", - "outputs": [ - { - "internalType": "uint256", - "name": "_boost", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "_oneEthQuote", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "_extra", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_pool", - "type": "address" - } - ], - "name": "getPoolTokens", - "outputs": [ - { - "internalType": "address", - "name": "_token0", - "type": "address" - }, - { - "internalType": "address", - "name": "_token1", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint128", - "name": "_baseAmount", - "type": "uint128" - }, - { - "internalType": "int56", - "name": "_tickDifference", - "type": "int56" - }, - { - "internalType": "uint256", - "name": "_timeInterval", - "type": "uint256" - } - ], - "name": "getQuoteAtTick", - "outputs": [ - { - "internalType": "uint256", - "name": "_quoteAmount", - "type": "uint256" - } - ], - "stateMutability": "pure", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "_gasUsed", - "type": "uint256" - } - ], - "name": "getRewardAmount", - "outputs": [ - { - "internalType": "uint256", - "name": "_amount", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_keeper", - "type": "address" - }, - { - "internalType": "uint256", - "name": "_gasUsed", - "type": "uint256" - } - ], - "name": "getRewardAmountFor", - "outputs": [ - { - "internalType": "uint256", - "name": "_kp3r", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "_bonds", - "type": "uint256" - } - ], - "name": "getRewardBoostFor", - "outputs": [ - { - "internalType": "uint256", - "name": "_rewardBoost", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "governance", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_pool", - "type": "address" - } - ], - "name": "isKP3RToken0", - "outputs": [ - { - "internalType": "bool", - "name": "_isKP3RToken0", - "type": "bool" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "keep3rV2", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "kp3rWethPool", - "outputs": [ - { - "internalType": "address", - "name": "poolAddress", - "type": "address" - }, - { - "internalType": "bool", - "name": "isTKNToken0", - "type": "bool" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "maxBoost", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "minBaseFee", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "minBoost", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "minPriorityFee", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_pool", - "type": "address" - }, - { - "internalType": "uint32[]", - "name": "_secondsAgo", - "type": "uint32[]" - } - ], - "name": "observe", - "outputs": [ - { - "internalType": "int56", - "name": "_tickCumulative1", - "type": "int56" - }, - { - "internalType": "int56", - "name": "_tickCumulative2", - "type": "int56" - }, - { - "internalType": "bool", - "name": "_success", - "type": "bool" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "pendingGovernance", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "_eth", - "type": "uint256" - } - ], - "name": "quote", - "outputs": [ - { - "internalType": "uint256", - "name": "_amountOut", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "quoteTwapTime", - "outputs": [ - { - "internalType": "uint32", - "name": "", - "type": "uint32" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_governance", - "type": "address" - } - ], - "name": "setGovernance", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_keep3rV2", - "type": "address" - } - ], - "name": "setKeep3rV2", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_poolAddress", - "type": "address" - } - ], - "name": "setKp3rWethPool", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "_maxBoost", - "type": "uint256" - } - ], - "name": "setMaxBoost", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "_minBaseFee", - "type": "uint256" - } - ], - "name": "setMinBaseFee", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "_minBoost", - "type": "uint256" - } - ], - "name": "setMinBoost", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "_minPriorityFee", - "type": "uint256" - } - ], - "name": "setMinPriorityFee", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint32", - "name": "_quoteTwapTime", - "type": "uint32" - } - ], - "name": "setQuoteTwapTime", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "_targetBond", - "type": "uint256" - } - ], - "name": "setTargetBond", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "_workExtraGas", - "type": "uint256" - } - ], - "name": "setWorkExtraGas", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [], - "name": "targetBond", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "workExtraGas", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - } - ], - "transactionHash": "0x8c0898fdccc22a29ca19fa44f5f79e8962f43a6f2fd4b94df15d47315cd7c208", - "receipt": { - "to": null, - "from": "0x258b180E741157763236F5277619D71ECf00B906", - "contractAddress": "0x399394ca069dCDE2C4d2a32E00a06C3D5fE17E3A", - "transactionIndex": 66, - "gasUsed": "1887545", - "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000040000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000", - "blockHash": "0x3493fcdf8b9c69919dea006bf270e0539cfcfc8c196d620b14cf80653598d12b", - "transactionHash": "0x8c0898fdccc22a29ca19fa44f5f79e8962f43a6f2fd4b94df15d47315cd7c208", - "logs": [ - { - "transactionIndex": 66, - "blockNumber": 8091006, - "transactionHash": "0x8c0898fdccc22a29ca19fa44f5f79e8962f43a6f2fd4b94df15d47315cd7c208", - "address": "0x399394ca069dCDE2C4d2a32E00a06C3D5fE17E3A", - "topics": [ - "0x554c636366d5fc882a9ab4b7b9d5181781d1a7076abe50ed410365620dcf4108" - ], - "data": "0x000000000000000000000000317cecd3eb02158f97df0b67b788edcda4e066e50000000000000000000000000000000000000000000000000000000000000001", - "logIndex": 145, - "blockHash": "0x3493fcdf8b9c69919dea006bf270e0539cfcfc8c196d620b14cf80653598d12b" - } - ], - "blockNumber": 8091006, - "cumulativeGasUsed": "13188511", - "status": 1, - "byzantium": true - }, - "args": [ - "0x16F63C5036d3F48A239358656a8f123eCE85789C", - "0x85063437C02Ba7F4f82F898859e4992380DEd3bb", - "0x258b180E741157763236F5277619D71ECf00B906", - "0x317ceCd3eB02158f97DF0B67B788edCda4E066e5" - ], - "numDeployments": 5, - "solcInputHash": "0d224f905ebe4be6830f2d07ee9fcf58", - "metadata": "{\"compiler\":{\"version\":\"0.8.7+commit.e28d00a7\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_kp3r\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"_keep3rV2\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"_governance\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"_kp3rWethPool\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"inputs\":[],\"name\":\"InvalidOraclePool\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"LiquidityPairInvalid\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"NoGovernanceZeroAddress\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"OnlyGovernance\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"OnlyPendingGovernance\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"ZeroAddress\",\"type\":\"error\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"_pendingGovernance\",\"type\":\"address\"}],\"name\":\"GovernanceProposal\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"_governance\",\"type\":\"address\"}],\"name\":\"GovernanceSet\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"_keep3rV2\",\"type\":\"address\"}],\"name\":\"Keep3rV2Change\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"_address\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"bool\",\"name\":\"_isKP3RToken0\",\"type\":\"bool\"}],\"name\":\"Kp3rWethPoolChange\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"_maxBoost\",\"type\":\"uint256\"}],\"name\":\"MaxBoostChange\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"_minBaseFee\",\"type\":\"uint256\"}],\"name\":\"MinBaseFeeChange\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"_minBoost\",\"type\":\"uint256\"}],\"name\":\"MinBoostChange\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"_minPriorityFee\",\"type\":\"uint256\"}],\"name\":\"MinPriorityFeeChange\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint32\",\"name\":\"_quoteTwapTime\",\"type\":\"uint32\"}],\"name\":\"QuoteTwapTimeChange\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"_targetBond\",\"type\":\"uint256\"}],\"name\":\"TargetBondChange\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"_workExtraGas\",\"type\":\"uint256\"}],\"name\":\"WorkExtraGasChange\",\"type\":\"event\"},{\"inputs\":[],\"name\":\"BOOST_BASE\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"KP3R\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"acceptGovernance\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_keeper\",\"type\":\"address\"}],\"name\":\"bonds\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"_amountBonded\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_liquidityAmount\",\"type\":\"uint256\"},{\"internalType\":\"int56\",\"name\":\"_tickDifference\",\"type\":\"int56\"},{\"internalType\":\"uint256\",\"name\":\"_timeInterval\",\"type\":\"uint256\"}],\"name\":\"getKP3RsAtTick\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"_kp3rAmount\",\"type\":\"uint256\"}],\"stateMutability\":\"pure\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_bonds\",\"type\":\"uint256\"}],\"name\":\"getPaymentParams\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"_boost\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"_oneEthQuote\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"_extra\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_pool\",\"type\":\"address\"}],\"name\":\"getPoolTokens\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"_token0\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"_token1\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint128\",\"name\":\"_baseAmount\",\"type\":\"uint128\"},{\"internalType\":\"int56\",\"name\":\"_tickDifference\",\"type\":\"int56\"},{\"internalType\":\"uint256\",\"name\":\"_timeInterval\",\"type\":\"uint256\"}],\"name\":\"getQuoteAtTick\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"_quoteAmount\",\"type\":\"uint256\"}],\"stateMutability\":\"pure\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_gasUsed\",\"type\":\"uint256\"}],\"name\":\"getRewardAmount\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"_amount\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_keeper\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"_gasUsed\",\"type\":\"uint256\"}],\"name\":\"getRewardAmountFor\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"_kp3r\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_bonds\",\"type\":\"uint256\"}],\"name\":\"getRewardBoostFor\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"_rewardBoost\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"governance\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_pool\",\"type\":\"address\"}],\"name\":\"isKP3RToken0\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"_isKP3RToken0\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"keep3rV2\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"kp3rWethPool\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"poolAddress\",\"type\":\"address\"},{\"internalType\":\"bool\",\"name\":\"isTKNToken0\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"maxBoost\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"minBaseFee\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"minBoost\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"minPriorityFee\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_pool\",\"type\":\"address\"},{\"internalType\":\"uint32[]\",\"name\":\"_secondsAgo\",\"type\":\"uint32[]\"}],\"name\":\"observe\",\"outputs\":[{\"internalType\":\"int56\",\"name\":\"_tickCumulative1\",\"type\":\"int56\"},{\"internalType\":\"int56\",\"name\":\"_tickCumulative2\",\"type\":\"int56\"},{\"internalType\":\"bool\",\"name\":\"_success\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"pendingGovernance\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_eth\",\"type\":\"uint256\"}],\"name\":\"quote\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"_amountOut\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"quoteTwapTime\",\"outputs\":[{\"internalType\":\"uint32\",\"name\":\"\",\"type\":\"uint32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_governance\",\"type\":\"address\"}],\"name\":\"setGovernance\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_keep3rV2\",\"type\":\"address\"}],\"name\":\"setKeep3rV2\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_poolAddress\",\"type\":\"address\"}],\"name\":\"setKp3rWethPool\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_maxBoost\",\"type\":\"uint256\"}],\"name\":\"setMaxBoost\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_minBaseFee\",\"type\":\"uint256\"}],\"name\":\"setMinBaseFee\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_minBoost\",\"type\":\"uint256\"}],\"name\":\"setMinBoost\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_minPriorityFee\",\"type\":\"uint256\"}],\"name\":\"setMinPriorityFee\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint32\",\"name\":\"_quoteTwapTime\",\"type\":\"uint32\"}],\"name\":\"setQuoteTwapTime\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_targetBond\",\"type\":\"uint256\"}],\"name\":\"setTargetBond\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_workExtraGas\",\"type\":\"uint256\"}],\"name\":\"setWorkExtraGas\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"targetBond\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"workExtraGas\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"}],\"devdoc\":{\"kind\":\"dev\",\"methods\":{\"bonds(address)\":{\"params\":{\"_keeper\":\"The address of the keeper to check\"},\"returns\":{\"_amountBonded\":\"The amount of KP3R the keeper has bonded\"}},\"getKP3RsAtTick(uint256,int56,uint256)\":{\"params\":{\"_liquidityAmount\":\"Amount of liquidity to be converted\",\"_tickDifference\":\"Tick value used to calculate the quote\",\"_timeInterval\":\"Time value used to calculate the quote\"},\"returns\":{\"_kp3rAmount\":\"Amount of KP3R tokens underlying on the given liquidity\"}},\"getPaymentParams(uint256)\":{\"params\":{\"_bonds\":\"Amount of bonded KP3R owned by the keeper\"},\"returns\":{\"_boost\":\"Multiplier per gas unit. Takes into account the base fee and the amount of bonded KP3R\",\"_extra\":\"Amount of extra gas that should be added to the gas spent\",\"_oneEthQuote\":\"Amount of KP3R tokens equivalent to 1 ETH\"}},\"getPoolTokens(address)\":{\"params\":{\"_pool\":\"Address of the correspondant pool\"},\"returns\":{\"_token0\":\"Address of the first token of the pair\",\"_token1\":\"Address of the second token of the pair\"}},\"getQuoteAtTick(uint128,int56,uint256)\":{\"params\":{\"_baseAmount\":\"Amount of token to be converted\",\"_tickDifference\":\"Tick value used to calculate the quote\",\"_timeInterval\":\"Time value used to calculate the quote\"},\"returns\":{\"_quoteAmount\":\"Amount of credits deserved for the baseAmount at the tick value\"}},\"getRewardAmount(uint256)\":{\"params\":{\"_gasUsed\":\"The amount of gas used that will be rewarded\"},\"returns\":{\"_amount\":\"The amount of KP3R that should be awarded to tx.origin\"}},\"getRewardAmountFor(address,uint256)\":{\"params\":{\"_gasUsed\":\"The amount of gas used that will be rewarded\",\"_keeper\":\"The address of the keeper to check\"},\"returns\":{\"_kp3r\":\"The amount of KP3R that should be awarded to the keeper\"}},\"getRewardBoostFor(uint256)\":{\"details\":\"If the keeper has no bonds, boost should be +10% of gas cost, if keeper has max bonds, +20%\",\"params\":{\"_bonds\":\"The amount of KP3R tokens bonded by the keeper\"},\"returns\":{\"_rewardBoost\":\"The reward boost that corresponds to the keeper\"}},\"isKP3RToken0(address)\":{\"params\":{\"_pool\":\"Address of the correspondant pool\"},\"returns\":{\"_isKP3RToken0\":\"Boolean indicating the order of the tokens in the pair\"}},\"observe(address,uint32[])\":{\"params\":{\"_pool\":\"Address of the pool to observe\",\"_secondsAgo\":\"Array with time references to observe\"},\"returns\":{\"_success\":\"Boolean indicating if the observe call was succesfull\",\"_tickCumulative1\":\"Cumulative sum of ticks until first time reference\",\"_tickCumulative2\":\"Cumulative sum of ticks until second time reference\"}},\"quote(uint256)\":{\"details\":\"This function allows us to calculate how much KP3R we should pay to a keeper for things expressed in ETH, like gas\",\"params\":{\"_eth\":\"The amount of ETH\"},\"returns\":{\"_amountOut\":\"The amount of KP3R\"}},\"setGovernance(address)\":{\"params\":{\"_governance\":\"The address being proposed as the new governance\"}},\"setKeep3rV2(address)\":{\"params\":{\"_keep3rV2\":\"The address of Keep3r V2\"}},\"setKp3rWethPool(address)\":{\"params\":{\"_poolAddress\":\"The address of the KP3R-WETH pool\"}},\"setMaxBoost(uint256)\":{\"params\":{\"_maxBoost\":\"The maximum boost multiplier\"}},\"setMinBaseFee(uint256)\":{\"params\":{\"_minBaseFee\":\"The minimum rewarded gas fee\"}},\"setMinBoost(uint256)\":{\"params\":{\"_minBoost\":\"The minimum boost multiplier\"}},\"setMinPriorityFee(uint256)\":{\"params\":{\"_minPriorityFee\":\"The minimum rewarded priority fee\"}},\"setQuoteTwapTime(uint32)\":{\"params\":{\"_quoteTwapTime\":\"The twap time for quoting\"}},\"setTargetBond(uint256)\":{\"params\":{\"_targetBond\":\"The target bond amount\"}},\"setWorkExtraGas(uint256)\":{\"params\":{\"_workExtraGas\":\"The work extra gas\"}}},\"version\":1},\"userdoc\":{\"errors\":{\"InvalidOraclePool()\":[{\"notice\":\"Throws when pool does not have KP3R as token0 nor token1\"}],\"LiquidityPairInvalid()\":[{\"notice\":\"Throws when none of the tokens in the liquidity pair is KP3R\"}],\"NoGovernanceZeroAddress()\":[{\"notice\":\"Throws if trying to set governance to zero address\"}],\"OnlyGovernance()\":[{\"notice\":\"Throws if the caller of the function is not governance\"}],\"OnlyPendingGovernance()\":[{\"notice\":\"Throws if the caller of the function is not pendingGovernance\"}],\"ZeroAddress()\":[{\"notice\":\"Throws if a variable is assigned to the zero address\"}]},\"events\":{\"GovernanceProposal(address)\":{\"notice\":\"Emitted when a new governance is proposed\"},\"GovernanceSet(address)\":{\"notice\":\"Emitted when pendingGovernance accepts to be governance\"},\"Keep3rV2Change(address)\":{\"notice\":\"Emitted when the Keep3r V2 address is changed\"},\"Kp3rWethPoolChange(address,bool)\":{\"notice\":\"Emitted when the kp3r weth pool is changed\"},\"MaxBoostChange(uint256)\":{\"notice\":\"Emitted when the maximum boost multiplier is changed\"},\"MinBaseFeeChange(uint256)\":{\"notice\":\"Emitted when minimum rewarded gas fee is changed\"},\"MinBoostChange(uint256)\":{\"notice\":\"Emitted when the minimum boost multiplier is changed\"},\"MinPriorityFeeChange(uint256)\":{\"notice\":\"Emitted when minimum rewarded priority fee is changed\"},\"QuoteTwapTimeChange(uint32)\":{\"notice\":\"Emitted when the quote twap time is changed\"},\"TargetBondChange(uint256)\":{\"notice\":\"Emitted when the target bond amount is changed\"},\"WorkExtraGasChange(uint256)\":{\"notice\":\"Emitted when the work extra gas amount is changed\"}},\"kind\":\"user\",\"methods\":{\"BOOST_BASE()\":{\"notice\":\"The boost base used to calculate the boost rewards for the keeper\"},\"KP3R()\":{\"notice\":\"Address of KP3R token\"},\"acceptGovernance()\":{\"notice\":\"Changes the governance from the current governance to the previously proposed address\"},\"bonds(address)\":{\"notice\":\"Returns the amount of KP3R the keeper has bonded\"},\"getKP3RsAtTick(uint256,int56,uint256)\":{\"notice\":\"Given a tick and a liquidity amount, calculates the underlying KP3R tokens\"},\"getPaymentParams(uint256)\":{\"notice\":\"Get multiplier, quote, and extra, in order to calculate keeper payment\"},\"getPoolTokens(address)\":{\"notice\":\"Given a pool address, returns the underlying tokens of the pair\"},\"getQuoteAtTick(uint128,int56,uint256)\":{\"notice\":\"Given a tick and a token amount, calculates the output in correspondant token\"},\"getRewardAmount(uint256)\":{\"notice\":\"Calculates the reward (in KP3R) that corresponds to tx.origin for using gas\"},\"getRewardAmountFor(address,uint256)\":{\"notice\":\"Calculates the reward (in KP3R) that corresponds to a keeper for using gas\"},\"getRewardBoostFor(uint256)\":{\"notice\":\"Calculates the boost in the reward given to a keeper based on the amount of KP3R that keeper has bonded\"},\"governance()\":{\"notice\":\"Stores the governance address\"},\"isKP3RToken0(address)\":{\"notice\":\"Defines the order of the tokens in the pair for twap calculations\"},\"keep3rV2()\":{\"notice\":\"Address of Keep3r V2\"},\"kp3rWethPool()\":{\"notice\":\"KP3R-WETH pool that is being used as oracle\"},\"maxBoost()\":{\"notice\":\"The maximum multiplier used to calculate the amount of gas paid to the Keeper for the gas used to perform a job For example: if the quoted gas used is 1000, then the maximum amount to be paid will be 1000 * maxBoost / BOOST_BASE\"},\"minBaseFee()\":{\"notice\":\"The minimum base fee that is used to calculate keeper rewards\"},\"minBoost()\":{\"notice\":\"The minimum multiplier used to calculate the amount of gas paid to the Keeper for the gas used to perform a job For example: if the quoted gas used is 1000, then the minimum amount to be paid will be 1000 * minBoost / BOOST_BASE\"},\"minPriorityFee()\":{\"notice\":\"The minimum priority fee that is also rewarded for keepers\"},\"observe(address,uint32[])\":{\"notice\":\"Given an array of secondsAgo, returns UniswapV3 pool cumulatives at that moment\"},\"pendingGovernance()\":{\"notice\":\"Stores the pendingGovernance address\"},\"quote(uint256)\":{\"notice\":\"Calculates the amount of KP3R that corresponds to the ETH passed into the function\"},\"quoteTwapTime()\":{\"notice\":\"The twap time for quoting\"},\"setGovernance(address)\":{\"notice\":\"Proposes a new address to be governance\"},\"setKeep3rV2(address)\":{\"notice\":\"Sets the Keep3r V2 address\"},\"setKp3rWethPool(address)\":{\"notice\":\"Sets KP3R-WETH pool\"},\"setMaxBoost(uint256)\":{\"notice\":\"Sets the maximum boost multiplier\"},\"setMinBaseFee(uint256)\":{\"notice\":\"Sets the minimum rewarded gas fee\"},\"setMinBoost(uint256)\":{\"notice\":\"Sets the minimum boost multiplier\"},\"setMinPriorityFee(uint256)\":{\"notice\":\"Sets the minimum rewarded gas priority fee\"},\"setQuoteTwapTime(uint32)\":{\"notice\":\"Sets the quote twap time\"},\"setTargetBond(uint256)\":{\"notice\":\"Sets the target bond amount\"},\"setWorkExtraGas(uint256)\":{\"notice\":\"Sets the work extra gas amount\"},\"targetBond()\":{\"notice\":\"The targeted amount of bonded KP3Rs to max-up reward multiplier For example: if the amount of KP3R the keeper has bonded is targetBond or more, then the keeper will get the maximum boost possible in his rewards, if it's less, the reward boost will be proportional\"},\"workExtraGas()\":{\"notice\":\"The amount of unaccounted gas that is going to be added to keeper payments\"}},\"version\":1}},\"settings\":{\"compilationTarget\":{\"solidity/for-test/testnet/Keep3rHelperForTestnet.sol\":\"Keep3rHelperForTestnet\"},\"evmVersion\":\"london\",\"libraries\":{\":__CACHE_BREAKER__\":\"0x00000000d41867734bbee4c6863d9255b2b06ac1\"},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":33},\"remappings\":[]},\"sources\":{\"@openzeppelin/contracts/token/ERC20/IERC20.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Interface of the ERC20 standard as defined in the EIP.\\n */\\ninterface IERC20 {\\n /**\\n * @dev Returns the amount of tokens in existence.\\n */\\n function totalSupply() external view returns (uint256);\\n\\n /**\\n * @dev Returns the amount of tokens owned by `account`.\\n */\\n function balanceOf(address account) external view returns (uint256);\\n\\n /**\\n * @dev Moves `amount` tokens from the caller's account to `recipient`.\\n *\\n * Returns a boolean value indicating whether the operation succeeded.\\n *\\n * Emits a {Transfer} event.\\n */\\n function transfer(address recipient, uint256 amount) external returns (bool);\\n\\n /**\\n * @dev Returns the remaining number of tokens that `spender` will be\\n * allowed to spend on behalf of `owner` through {transferFrom}. This is\\n * zero by default.\\n *\\n * This value changes when {approve} or {transferFrom} are called.\\n */\\n function allowance(address owner, address spender) external view returns (uint256);\\n\\n /**\\n * @dev Sets `amount` as the allowance of `spender` over the caller's tokens.\\n *\\n * Returns a boolean value indicating whether the operation succeeded.\\n *\\n * IMPORTANT: Beware that changing an allowance with this method brings the risk\\n * that someone may use both the old and the new allowance by unfortunate\\n * transaction ordering. One possible solution to mitigate this race\\n * condition is to first reduce the spender's allowance to 0 and set the\\n * desired value afterwards:\\n * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729\\n *\\n * Emits an {Approval} event.\\n */\\n function approve(address spender, uint256 amount) external returns (bool);\\n\\n /**\\n * @dev Moves `amount` tokens from `sender` to `recipient` using the\\n * allowance mechanism. `amount` is then deducted from the caller's\\n * allowance.\\n *\\n * Returns a boolean value indicating whether the operation succeeded.\\n *\\n * Emits a {Transfer} event.\\n */\\n function transferFrom(\\n address sender,\\n address recipient,\\n uint256 amount\\n ) external returns (bool);\\n\\n /**\\n * @dev Emitted when `value` tokens are moved from one account (`from`) to\\n * another (`to`).\\n *\\n * Note that `value` may be zero.\\n */\\n event Transfer(address indexed from, address indexed to, uint256 value);\\n\\n /**\\n * @dev Emitted when the allowance of a `spender` for an `owner` is set by\\n * a call to {approve}. `value` is the new allowance.\\n */\\n event Approval(address indexed owner, address indexed spender, uint256 value);\\n}\\n\",\"keccak256\":\"0x027b891937d20ccf213fdb9c31531574256de774bda99d3a70ecef6e1913ed2a\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../IERC20.sol\\\";\\n\\n/**\\n * @dev Interface for the optional metadata functions from the ERC20 standard.\\n *\\n * _Available since v4.1._\\n */\\ninterface IERC20Metadata is IERC20 {\\n /**\\n * @dev Returns the name of the token.\\n */\\n function name() external view returns (string memory);\\n\\n /**\\n * @dev Returns the symbol of the token.\\n */\\n function symbol() external view returns (string memory);\\n\\n /**\\n * @dev Returns the decimals places of the token.\\n */\\n function decimals() external view returns (uint8);\\n}\\n\",\"keccak256\":\"0x83fe24f5c04a56091e50f4a345ff504c8bff658a76d4c43b16878c8f940c53b2\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/math/Math.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Standard math utilities missing in the Solidity language.\\n */\\nlibrary Math {\\n /**\\n * @dev Returns the largest of two numbers.\\n */\\n function max(uint256 a, uint256 b) internal pure returns (uint256) {\\n return a >= b ? a : b;\\n }\\n\\n /**\\n * @dev Returns the smallest of two numbers.\\n */\\n function min(uint256 a, uint256 b) internal pure returns (uint256) {\\n return a < b ? a : b;\\n }\\n\\n /**\\n * @dev Returns the average of two numbers. The result is rounded towards\\n * zero.\\n */\\n function average(uint256 a, uint256 b) internal pure returns (uint256) {\\n // (a + b) / 2 can overflow.\\n return (a & b) + (a ^ b) / 2;\\n }\\n\\n /**\\n * @dev Returns the ceiling of the division of two numbers.\\n *\\n * This differs from standard division with `/` in that it rounds up instead\\n * of rounding down.\\n */\\n function ceilDiv(uint256 a, uint256 b) internal pure returns (uint256) {\\n // (a + b - 1) / b can overflow on addition, so we distribute.\\n return a / b + (a % b == 0 ? 0 : 1);\\n }\\n}\\n\",\"keccak256\":\"0x49ebdac5d515aebb95168564158940b79d7d5d12fbfe59cec546a00d57fee64a\",\"license\":\"MIT\"},\"@uniswap/v3-core/contracts/interfaces/IUniswapV3Pool.sol\":{\"content\":\"// SPDX-License-Identifier: GPL-2.0-or-later\\npragma solidity >=0.5.0;\\n\\nimport './pool/IUniswapV3PoolImmutables.sol';\\nimport './pool/IUniswapV3PoolState.sol';\\nimport './pool/IUniswapV3PoolDerivedState.sol';\\nimport './pool/IUniswapV3PoolActions.sol';\\nimport './pool/IUniswapV3PoolOwnerActions.sol';\\nimport './pool/IUniswapV3PoolEvents.sol';\\n\\n/// @title The interface for a Uniswap V3 Pool\\n/// @notice A Uniswap pool facilitates swapping and automated market making between any two assets that strictly conform\\n/// to the ERC20 specification\\n/// @dev The pool interface is broken up into many smaller pieces\\ninterface IUniswapV3Pool is\\n IUniswapV3PoolImmutables,\\n IUniswapV3PoolState,\\n IUniswapV3PoolDerivedState,\\n IUniswapV3PoolActions,\\n IUniswapV3PoolOwnerActions,\\n IUniswapV3PoolEvents\\n{\\n\\n}\\n\",\"keccak256\":\"0xfe6113d518466cd6652c85b111e01f33eb62157f49ae5ed7d5a3947a2044adb1\",\"license\":\"GPL-2.0-or-later\"},\"@uniswap/v3-core/contracts/interfaces/pool/IUniswapV3PoolActions.sol\":{\"content\":\"// SPDX-License-Identifier: GPL-2.0-or-later\\npragma solidity >=0.5.0;\\n\\n/// @title Permissionless pool actions\\n/// @notice Contains pool methods that can be called by anyone\\ninterface IUniswapV3PoolActions {\\n /// @notice Sets the initial price for the pool\\n /// @dev Price is represented as a sqrt(amountToken1/amountToken0) Q64.96 value\\n /// @param sqrtPriceX96 the initial sqrt price of the pool as a Q64.96\\n function initialize(uint160 sqrtPriceX96) external;\\n\\n /// @notice Adds liquidity for the given recipient/tickLower/tickUpper position\\n /// @dev The caller of this method receives a callback in the form of IUniswapV3MintCallback#uniswapV3MintCallback\\n /// in which they must pay any token0 or token1 owed for the liquidity. The amount of token0/token1 due depends\\n /// on tickLower, tickUpper, the amount of liquidity, and the current price.\\n /// @param recipient The address for which the liquidity will be created\\n /// @param tickLower The lower tick of the position in which to add liquidity\\n /// @param tickUpper The upper tick of the position in which to add liquidity\\n /// @param amount The amount of liquidity to mint\\n /// @param data Any data that should be passed through to the callback\\n /// @return amount0 The amount of token0 that was paid to mint the given amount of liquidity. Matches the value in the callback\\n /// @return amount1 The amount of token1 that was paid to mint the given amount of liquidity. Matches the value in the callback\\n function mint(\\n address recipient,\\n int24 tickLower,\\n int24 tickUpper,\\n uint128 amount,\\n bytes calldata data\\n ) external returns (uint256 amount0, uint256 amount1);\\n\\n /// @notice Collects tokens owed to a position\\n /// @dev Does not recompute fees earned, which must be done either via mint or burn of any amount of liquidity.\\n /// Collect must be called by the position owner. To withdraw only token0 or only token1, amount0Requested or\\n /// amount1Requested may be set to zero. To withdraw all tokens owed, caller may pass any value greater than the\\n /// actual tokens owed, e.g. type(uint128).max. Tokens owed may be from accumulated swap fees or burned liquidity.\\n /// @param recipient The address which should receive the fees collected\\n /// @param tickLower The lower tick of the position for which to collect fees\\n /// @param tickUpper The upper tick of the position for which to collect fees\\n /// @param amount0Requested How much token0 should be withdrawn from the fees owed\\n /// @param amount1Requested How much token1 should be withdrawn from the fees owed\\n /// @return amount0 The amount of fees collected in token0\\n /// @return amount1 The amount of fees collected in token1\\n function collect(\\n address recipient,\\n int24 tickLower,\\n int24 tickUpper,\\n uint128 amount0Requested,\\n uint128 amount1Requested\\n ) external returns (uint128 amount0, uint128 amount1);\\n\\n /// @notice Burn liquidity from the sender and account tokens owed for the liquidity to the position\\n /// @dev Can be used to trigger a recalculation of fees owed to a position by calling with an amount of 0\\n /// @dev Fees must be collected separately via a call to #collect\\n /// @param tickLower The lower tick of the position for which to burn liquidity\\n /// @param tickUpper The upper tick of the position for which to burn liquidity\\n /// @param amount How much liquidity to burn\\n /// @return amount0 The amount of token0 sent to the recipient\\n /// @return amount1 The amount of token1 sent to the recipient\\n function burn(\\n int24 tickLower,\\n int24 tickUpper,\\n uint128 amount\\n ) external returns (uint256 amount0, uint256 amount1);\\n\\n /// @notice Swap token0 for token1, or token1 for token0\\n /// @dev The caller of this method receives a callback in the form of IUniswapV3SwapCallback#uniswapV3SwapCallback\\n /// @param recipient The address to receive the output of the swap\\n /// @param zeroForOne The direction of the swap, true for token0 to token1, false for token1 to token0\\n /// @param amountSpecified The amount of the swap, which implicitly configures the swap as exact input (positive), or exact output (negative)\\n /// @param sqrtPriceLimitX96 The Q64.96 sqrt price limit. If zero for one, the price cannot be less than this\\n /// value after the swap. If one for zero, the price cannot be greater than this value after the swap\\n /// @param data Any data to be passed through to the callback\\n /// @return amount0 The delta of the balance of token0 of the pool, exact when negative, minimum when positive\\n /// @return amount1 The delta of the balance of token1 of the pool, exact when negative, minimum when positive\\n function swap(\\n address recipient,\\n bool zeroForOne,\\n int256 amountSpecified,\\n uint160 sqrtPriceLimitX96,\\n bytes calldata data\\n ) external returns (int256 amount0, int256 amount1);\\n\\n /// @notice Receive token0 and/or token1 and pay it back, plus a fee, in the callback\\n /// @dev The caller of this method receives a callback in the form of IUniswapV3FlashCallback#uniswapV3FlashCallback\\n /// @dev Can be used to donate underlying tokens pro-rata to currently in-range liquidity providers by calling\\n /// with 0 amount{0,1} and sending the donation amount(s) from the callback\\n /// @param recipient The address which will receive the token0 and token1 amounts\\n /// @param amount0 The amount of token0 to send\\n /// @param amount1 The amount of token1 to send\\n /// @param data Any data to be passed through to the callback\\n function flash(\\n address recipient,\\n uint256 amount0,\\n uint256 amount1,\\n bytes calldata data\\n ) external;\\n\\n /// @notice Increase the maximum number of price and liquidity observations that this pool will store\\n /// @dev This method is no-op if the pool already has an observationCardinalityNext greater than or equal to\\n /// the input observationCardinalityNext.\\n /// @param observationCardinalityNext The desired minimum number of observations for the pool to store\\n function increaseObservationCardinalityNext(uint16 observationCardinalityNext) external;\\n}\\n\",\"keccak256\":\"0x9453dd0e7442188667d01d9b65de3f1e14e9511ff3e303179a15f6fc267f7634\",\"license\":\"GPL-2.0-or-later\"},\"@uniswap/v3-core/contracts/interfaces/pool/IUniswapV3PoolDerivedState.sol\":{\"content\":\"// SPDX-License-Identifier: GPL-2.0-or-later\\npragma solidity >=0.5.0;\\n\\n/// @title Pool state that is not stored\\n/// @notice Contains view functions to provide information about the pool that is computed rather than stored on the\\n/// blockchain. The functions here may have variable gas costs.\\ninterface IUniswapV3PoolDerivedState {\\n /// @notice Returns the cumulative tick and liquidity as of each timestamp `secondsAgo` from the current block timestamp\\n /// @dev To get a time weighted average tick or liquidity-in-range, you must call this with two values, one representing\\n /// the beginning of the period and another for the end of the period. E.g., to get the last hour time-weighted average tick,\\n /// you must call it with secondsAgos = [3600, 0].\\n /// @dev The time weighted average tick represents the geometric time weighted average price of the pool, in\\n /// log base sqrt(1.0001) of token1 / token0. The TickMath library can be used to go from a tick value to a ratio.\\n /// @param secondsAgos From how long ago each cumulative tick and liquidity value should be returned\\n /// @return tickCumulatives Cumulative tick values as of each `secondsAgos` from the current block timestamp\\n /// @return secondsPerLiquidityCumulativeX128s Cumulative seconds per liquidity-in-range value as of each `secondsAgos` from the current block\\n /// timestamp\\n function observe(uint32[] calldata secondsAgos)\\n external\\n view\\n returns (int56[] memory tickCumulatives, uint160[] memory secondsPerLiquidityCumulativeX128s);\\n\\n /// @notice Returns a snapshot of the tick cumulative, seconds per liquidity and seconds inside a tick range\\n /// @dev Snapshots must only be compared to other snapshots, taken over a period for which a position existed.\\n /// I.e., snapshots cannot be compared if a position is not held for the entire period between when the first\\n /// snapshot is taken and the second snapshot is taken.\\n /// @param tickLower The lower tick of the range\\n /// @param tickUpper The upper tick of the range\\n /// @return tickCumulativeInside The snapshot of the tick accumulator for the range\\n /// @return secondsPerLiquidityInsideX128 The snapshot of seconds per liquidity for the range\\n /// @return secondsInside The snapshot of seconds per liquidity for the range\\n function snapshotCumulativesInside(int24 tickLower, int24 tickUpper)\\n external\\n view\\n returns (\\n int56 tickCumulativeInside,\\n uint160 secondsPerLiquidityInsideX128,\\n uint32 secondsInside\\n );\\n}\\n\",\"keccak256\":\"0xe603ac5b17ecdee73ba2b27efdf386c257a19c14206e87eee77e2017b742d9e5\",\"license\":\"GPL-2.0-or-later\"},\"@uniswap/v3-core/contracts/interfaces/pool/IUniswapV3PoolEvents.sol\":{\"content\":\"// SPDX-License-Identifier: GPL-2.0-or-later\\npragma solidity >=0.5.0;\\n\\n/// @title Events emitted by a pool\\n/// @notice Contains all events emitted by the pool\\ninterface IUniswapV3PoolEvents {\\n /// @notice Emitted exactly once by a pool when #initialize is first called on the pool\\n /// @dev Mint/Burn/Swap cannot be emitted by the pool before Initialize\\n /// @param sqrtPriceX96 The initial sqrt price of the pool, as a Q64.96\\n /// @param tick The initial tick of the pool, i.e. log base 1.0001 of the starting price of the pool\\n event Initialize(uint160 sqrtPriceX96, int24 tick);\\n\\n /// @notice Emitted when liquidity is minted for a given position\\n /// @param sender The address that minted the liquidity\\n /// @param owner The owner of the position and recipient of any minted liquidity\\n /// @param tickLower The lower tick of the position\\n /// @param tickUpper The upper tick of the position\\n /// @param amount The amount of liquidity minted to the position range\\n /// @param amount0 How much token0 was required for the minted liquidity\\n /// @param amount1 How much token1 was required for the minted liquidity\\n event Mint(\\n address sender,\\n address indexed owner,\\n int24 indexed tickLower,\\n int24 indexed tickUpper,\\n uint128 amount,\\n uint256 amount0,\\n uint256 amount1\\n );\\n\\n /// @notice Emitted when fees are collected by the owner of a position\\n /// @dev Collect events may be emitted with zero amount0 and amount1 when the caller chooses not to collect fees\\n /// @param owner The owner of the position for which fees are collected\\n /// @param tickLower The lower tick of the position\\n /// @param tickUpper The upper tick of the position\\n /// @param amount0 The amount of token0 fees collected\\n /// @param amount1 The amount of token1 fees collected\\n event Collect(\\n address indexed owner,\\n address recipient,\\n int24 indexed tickLower,\\n int24 indexed tickUpper,\\n uint128 amount0,\\n uint128 amount1\\n );\\n\\n /// @notice Emitted when a position's liquidity is removed\\n /// @dev Does not withdraw any fees earned by the liquidity position, which must be withdrawn via #collect\\n /// @param owner The owner of the position for which liquidity is removed\\n /// @param tickLower The lower tick of the position\\n /// @param tickUpper The upper tick of the position\\n /// @param amount The amount of liquidity to remove\\n /// @param amount0 The amount of token0 withdrawn\\n /// @param amount1 The amount of token1 withdrawn\\n event Burn(\\n address indexed owner,\\n int24 indexed tickLower,\\n int24 indexed tickUpper,\\n uint128 amount,\\n uint256 amount0,\\n uint256 amount1\\n );\\n\\n /// @notice Emitted by the pool for any swaps between token0 and token1\\n /// @param sender The address that initiated the swap call, and that received the callback\\n /// @param recipient The address that received the output of the swap\\n /// @param amount0 The delta of the token0 balance of the pool\\n /// @param amount1 The delta of the token1 balance of the pool\\n /// @param sqrtPriceX96 The sqrt(price) of the pool after the swap, as a Q64.96\\n /// @param liquidity The liquidity of the pool after the swap\\n /// @param tick The log base 1.0001 of price of the pool after the swap\\n event Swap(\\n address indexed sender,\\n address indexed recipient,\\n int256 amount0,\\n int256 amount1,\\n uint160 sqrtPriceX96,\\n uint128 liquidity,\\n int24 tick\\n );\\n\\n /// @notice Emitted by the pool for any flashes of token0/token1\\n /// @param sender The address that initiated the swap call, and that received the callback\\n /// @param recipient The address that received the tokens from flash\\n /// @param amount0 The amount of token0 that was flashed\\n /// @param amount1 The amount of token1 that was flashed\\n /// @param paid0 The amount of token0 paid for the flash, which can exceed the amount0 plus the fee\\n /// @param paid1 The amount of token1 paid for the flash, which can exceed the amount1 plus the fee\\n event Flash(\\n address indexed sender,\\n address indexed recipient,\\n uint256 amount0,\\n uint256 amount1,\\n uint256 paid0,\\n uint256 paid1\\n );\\n\\n /// @notice Emitted by the pool for increases to the number of observations that can be stored\\n /// @dev observationCardinalityNext is not the observation cardinality until an observation is written at the index\\n /// just before a mint/swap/burn.\\n /// @param observationCardinalityNextOld The previous value of the next observation cardinality\\n /// @param observationCardinalityNextNew The updated value of the next observation cardinality\\n event IncreaseObservationCardinalityNext(\\n uint16 observationCardinalityNextOld,\\n uint16 observationCardinalityNextNew\\n );\\n\\n /// @notice Emitted when the protocol fee is changed by the pool\\n /// @param feeProtocol0Old The previous value of the token0 protocol fee\\n /// @param feeProtocol1Old The previous value of the token1 protocol fee\\n /// @param feeProtocol0New The updated value of the token0 protocol fee\\n /// @param feeProtocol1New The updated value of the token1 protocol fee\\n event SetFeeProtocol(uint8 feeProtocol0Old, uint8 feeProtocol1Old, uint8 feeProtocol0New, uint8 feeProtocol1New);\\n\\n /// @notice Emitted when the collected protocol fees are withdrawn by the factory owner\\n /// @param sender The address that collects the protocol fees\\n /// @param recipient The address that receives the collected protocol fees\\n /// @param amount0 The amount of token0 protocol fees that is withdrawn\\n /// @param amount0 The amount of token1 protocol fees that is withdrawn\\n event CollectProtocol(address indexed sender, address indexed recipient, uint128 amount0, uint128 amount1);\\n}\\n\",\"keccak256\":\"0x8071514d0fe5d17d6fbd31c191cdfb703031c24e0ece3621d88ab10e871375cd\",\"license\":\"GPL-2.0-or-later\"},\"@uniswap/v3-core/contracts/interfaces/pool/IUniswapV3PoolImmutables.sol\":{\"content\":\"// SPDX-License-Identifier: GPL-2.0-or-later\\npragma solidity >=0.5.0;\\n\\n/// @title Pool state that never changes\\n/// @notice These parameters are fixed for a pool forever, i.e., the methods will always return the same values\\ninterface IUniswapV3PoolImmutables {\\n /// @notice The contract that deployed the pool, which must adhere to the IUniswapV3Factory interface\\n /// @return The contract address\\n function factory() external view returns (address);\\n\\n /// @notice The first of the two tokens of the pool, sorted by address\\n /// @return The token contract address\\n function token0() external view returns (address);\\n\\n /// @notice The second of the two tokens of the pool, sorted by address\\n /// @return The token contract address\\n function token1() external view returns (address);\\n\\n /// @notice The pool's fee in hundredths of a bip, i.e. 1e-6\\n /// @return The fee\\n function fee() external view returns (uint24);\\n\\n /// @notice The pool tick spacing\\n /// @dev Ticks can only be used at multiples of this value, minimum of 1 and always positive\\n /// e.g.: a tickSpacing of 3 means ticks can be initialized every 3rd tick, i.e., ..., -6, -3, 0, 3, 6, ...\\n /// This value is an int24 to avoid casting even though it is always positive.\\n /// @return The tick spacing\\n function tickSpacing() external view returns (int24);\\n\\n /// @notice The maximum amount of position liquidity that can use any tick in the range\\n /// @dev This parameter is enforced per tick to prevent liquidity from overflowing a uint128 at any point, and\\n /// also prevents out-of-range liquidity from being used to prevent adding in-range liquidity to a pool\\n /// @return The max amount of liquidity per tick\\n function maxLiquidityPerTick() external view returns (uint128);\\n}\\n\",\"keccak256\":\"0xf6e5d2cd1139c4c276bdbc8e1d2b256e456c866a91f1b868da265c6d2685c3f7\",\"license\":\"GPL-2.0-or-later\"},\"@uniswap/v3-core/contracts/interfaces/pool/IUniswapV3PoolOwnerActions.sol\":{\"content\":\"// SPDX-License-Identifier: GPL-2.0-or-later\\npragma solidity >=0.5.0;\\n\\n/// @title Permissioned pool actions\\n/// @notice Contains pool methods that may only be called by the factory owner\\ninterface IUniswapV3PoolOwnerActions {\\n /// @notice Set the denominator of the protocol's % share of the fees\\n /// @param feeProtocol0 new protocol fee for token0 of the pool\\n /// @param feeProtocol1 new protocol fee for token1 of the pool\\n function setFeeProtocol(uint8 feeProtocol0, uint8 feeProtocol1) external;\\n\\n /// @notice Collect the protocol fee accrued to the pool\\n /// @param recipient The address to which collected protocol fees should be sent\\n /// @param amount0Requested The maximum amount of token0 to send, can be 0 to collect fees in only token1\\n /// @param amount1Requested The maximum amount of token1 to send, can be 0 to collect fees in only token0\\n /// @return amount0 The protocol fee collected in token0\\n /// @return amount1 The protocol fee collected in token1\\n function collectProtocol(\\n address recipient,\\n uint128 amount0Requested,\\n uint128 amount1Requested\\n ) external returns (uint128 amount0, uint128 amount1);\\n}\\n\",\"keccak256\":\"0x759b78a2918af9e99e246dc3af084f654e48ef32bb4e4cb8a966aa3dcaece235\",\"license\":\"GPL-2.0-or-later\"},\"@uniswap/v3-core/contracts/interfaces/pool/IUniswapV3PoolState.sol\":{\"content\":\"// SPDX-License-Identifier: GPL-2.0-or-later\\npragma solidity >=0.5.0;\\n\\n/// @title Pool state that can change\\n/// @notice These methods compose the pool's state, and can change with any frequency including multiple times\\n/// per transaction\\ninterface IUniswapV3PoolState {\\n /// @notice The 0th storage slot in the pool stores many values, and is exposed as a single method to save gas\\n /// when accessed externally.\\n /// @return sqrtPriceX96 The current price of the pool as a sqrt(token1/token0) Q64.96 value\\n /// tick The current tick of the pool, i.e. according to the last tick transition that was run.\\n /// This value may not always be equal to SqrtTickMath.getTickAtSqrtRatio(sqrtPriceX96) if the price is on a tick\\n /// boundary.\\n /// observationIndex The index of the last oracle observation that was written,\\n /// observationCardinality The current maximum number of observations stored in the pool,\\n /// observationCardinalityNext The next maximum number of observations, to be updated when the observation.\\n /// feeProtocol The protocol fee for both tokens of the pool.\\n /// Encoded as two 4 bit values, where the protocol fee of token1 is shifted 4 bits and the protocol fee of token0\\n /// is the lower 4 bits. Used as the denominator of a fraction of the swap fee, e.g. 4 means 1/4th of the swap fee.\\n /// unlocked Whether the pool is currently locked to reentrancy\\n function slot0()\\n external\\n view\\n returns (\\n uint160 sqrtPriceX96,\\n int24 tick,\\n uint16 observationIndex,\\n uint16 observationCardinality,\\n uint16 observationCardinalityNext,\\n uint8 feeProtocol,\\n bool unlocked\\n );\\n\\n /// @notice The fee growth as a Q128.128 fees of token0 collected per unit of liquidity for the entire life of the pool\\n /// @dev This value can overflow the uint256\\n function feeGrowthGlobal0X128() external view returns (uint256);\\n\\n /// @notice The fee growth as a Q128.128 fees of token1 collected per unit of liquidity for the entire life of the pool\\n /// @dev This value can overflow the uint256\\n function feeGrowthGlobal1X128() external view returns (uint256);\\n\\n /// @notice The amounts of token0 and token1 that are owed to the protocol\\n /// @dev Protocol fees will never exceed uint128 max in either token\\n function protocolFees() external view returns (uint128 token0, uint128 token1);\\n\\n /// @notice The currently in range liquidity available to the pool\\n /// @dev This value has no relationship to the total liquidity across all ticks\\n function liquidity() external view returns (uint128);\\n\\n /// @notice Look up information about a specific tick in the pool\\n /// @param tick The tick to look up\\n /// @return liquidityGross the total amount of position liquidity that uses the pool either as tick lower or\\n /// tick upper,\\n /// liquidityNet how much liquidity changes when the pool price crosses the tick,\\n /// feeGrowthOutside0X128 the fee growth on the other side of the tick from the current tick in token0,\\n /// feeGrowthOutside1X128 the fee growth on the other side of the tick from the current tick in token1,\\n /// tickCumulativeOutside the cumulative tick value on the other side of the tick from the current tick\\n /// secondsPerLiquidityOutsideX128 the seconds spent per liquidity on the other side of the tick from the current tick,\\n /// secondsOutside the seconds spent on the other side of the tick from the current tick,\\n /// initialized Set to true if the tick is initialized, i.e. liquidityGross is greater than 0, otherwise equal to false.\\n /// Outside values can only be used if the tick is initialized, i.e. if liquidityGross is greater than 0.\\n /// In addition, these values are only relative and must be used only in comparison to previous snapshots for\\n /// a specific position.\\n function ticks(int24 tick)\\n external\\n view\\n returns (\\n uint128 liquidityGross,\\n int128 liquidityNet,\\n uint256 feeGrowthOutside0X128,\\n uint256 feeGrowthOutside1X128,\\n int56 tickCumulativeOutside,\\n uint160 secondsPerLiquidityOutsideX128,\\n uint32 secondsOutside,\\n bool initialized\\n );\\n\\n /// @notice Returns 256 packed tick initialized boolean values. See TickBitmap for more information\\n function tickBitmap(int16 wordPosition) external view returns (uint256);\\n\\n /// @notice Returns the information about a position by the position's key\\n /// @param key The position's key is a hash of a preimage composed by the owner, tickLower and tickUpper\\n /// @return _liquidity The amount of liquidity in the position,\\n /// Returns feeGrowthInside0LastX128 fee growth of token0 inside the tick range as of the last mint/burn/poke,\\n /// Returns feeGrowthInside1LastX128 fee growth of token1 inside the tick range as of the last mint/burn/poke,\\n /// Returns tokensOwed0 the computed amount of token0 owed to the position as of the last mint/burn/poke,\\n /// Returns tokensOwed1 the computed amount of token1 owed to the position as of the last mint/burn/poke\\n function positions(bytes32 key)\\n external\\n view\\n returns (\\n uint128 _liquidity,\\n uint256 feeGrowthInside0LastX128,\\n uint256 feeGrowthInside1LastX128,\\n uint128 tokensOwed0,\\n uint128 tokensOwed1\\n );\\n\\n /// @notice Returns data about a specific observation index\\n /// @param index The element of the observations array to fetch\\n /// @dev You most likely want to use #observe() instead of this method to get an observation as of some amount of time\\n /// ago, rather than at a specific index in the array.\\n /// @return blockTimestamp The timestamp of the observation,\\n /// Returns tickCumulative the tick multiplied by seconds elapsed for the life of the pool as of the observation timestamp,\\n /// Returns secondsPerLiquidityCumulativeX128 the seconds per in range liquidity for the life of the pool as of the observation timestamp,\\n /// Returns initialized whether the observation has been initialized and the values are safe to use\\n function observations(uint256 index)\\n external\\n view\\n returns (\\n uint32 blockTimestamp,\\n int56 tickCumulative,\\n uint160 secondsPerLiquidityCumulativeX128,\\n bool initialized\\n );\\n}\\n\",\"keccak256\":\"0x852dc1f5df7dcf7f11e7bb3eed79f0cea72ad4b25f6a9d2c35aafb48925fd49f\",\"license\":\"GPL-2.0-or-later\"},\"solidity/contracts/Keep3rHelper.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\n/*\\n\\nCoded for The Keep3r Network with \\u2665 by\\n\\n\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2557\\u2591\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2557\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2557\\u2588\\u2588\\u2557\\u2003\\u2003\\u2591\\u2588\\u2588\\u2557\\u2591\\u2591\\u2591\\u2591\\u2591\\u2591\\u2591\\u2588\\u2588\\u2557\\u2591\\u2588\\u2588\\u2588\\u2588\\u2588\\u2557\\u2591\\u2588\\u2588\\u2588\\u2557\\u2591\\u2591\\u2588\\u2588\\u2557\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2557\\u2591\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2557\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2557\\u2591\\u2588\\u2588\\u2557\\u2591\\u2591\\u2591\\u2591\\u2591\\u2591\\u2588\\u2588\\u2588\\u2588\\u2588\\u2557\\u2591\\u2588\\u2588\\u2588\\u2557\\u2591\\u2591\\u2588\\u2588\\u2557\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2557\\u2591\\n\\u2588\\u2588\\u2554\\u2550\\u2550\\u2588\\u2588\\u2557\\u2588\\u2588\\u2554\\u2550\\u2550\\u2550\\u2550\\u255d\\u2588\\u2588\\u2554\\u2550\\u2550\\u2550\\u2550\\u255d\\u2588\\u2588\\u2551\\u2003\\u2003\\u2591\\u2588\\u2588\\u2551\\u2591\\u2591\\u2588\\u2588\\u2557\\u2591\\u2591\\u2588\\u2588\\u2551\\u2588\\u2588\\u2554\\u2550\\u2550\\u2588\\u2588\\u2557\\u2588\\u2588\\u2588\\u2588\\u2557\\u2591\\u2588\\u2588\\u2551\\u2588\\u2588\\u2554\\u2550\\u2550\\u2588\\u2588\\u2557\\u2588\\u2588\\u2554\\u2550\\u2550\\u2550\\u2550\\u255d\\u2588\\u2588\\u2554\\u2550\\u2550\\u2588\\u2588\\u2557\\u2588\\u2588\\u2551\\u2591\\u2591\\u2591\\u2591\\u2591\\u2588\\u2588\\u2554\\u2550\\u2550\\u2588\\u2588\\u2557\\u2588\\u2588\\u2588\\u2588\\u2557\\u2591\\u2588\\u2588\\u2551\\u2588\\u2588\\u2554\\u2550\\u2550\\u2588\\u2588\\u2557\\n\\u2588\\u2588\\u2551\\u2591\\u2591\\u2588\\u2588\\u2551\\u2588\\u2588\\u2588\\u2588\\u2588\\u2557\\u2591\\u2591\\u2588\\u2588\\u2588\\u2588\\u2588\\u2557\\u2591\\u2591\\u2588\\u2588\\u2551\\u2003\\u2003\\u2591\\u255a\\u2588\\u2588\\u2557\\u2588\\u2588\\u2588\\u2588\\u2557\\u2588\\u2588\\u2554\\u255d\\u2588\\u2588\\u2551\\u2591\\u2591\\u2588\\u2588\\u2551\\u2588\\u2588\\u2554\\u2588\\u2588\\u2557\\u2588\\u2588\\u2551\\u2588\\u2588\\u2551\\u2591\\u2591\\u2588\\u2588\\u2551\\u2588\\u2588\\u2588\\u2588\\u2588\\u2557\\u2591\\u2591\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2554\\u255d\\u2588\\u2588\\u2551\\u2591\\u2591\\u2591\\u2591\\u2591\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2551\\u2588\\u2588\\u2554\\u2588\\u2588\\u2557\\u2588\\u2588\\u2551\\u2588\\u2588\\u2551\\u2591\\u2591\\u2588\\u2588\\u2551\\n\\u2588\\u2588\\u2551\\u2591\\u2591\\u2588\\u2588\\u2551\\u2588\\u2588\\u2554\\u2550\\u2550\\u255d\\u2591\\u2591\\u2588\\u2588\\u2554\\u2550\\u2550\\u255d\\u2591\\u2591\\u2588\\u2588\\u2551\\u2003\\u2003\\u2591\\u2591\\u2588\\u2588\\u2588\\u2588\\u2554\\u2550\\u2588\\u2588\\u2588\\u2588\\u2551\\u2591\\u2588\\u2588\\u2551\\u2591\\u2591\\u2588\\u2588\\u2551\\u2588\\u2588\\u2551\\u255a\\u2588\\u2588\\u2588\\u2588\\u2551\\u2588\\u2588\\u2551\\u2591\\u2591\\u2588\\u2588\\u2551\\u2588\\u2588\\u2554\\u2550\\u2550\\u255d\\u2591\\u2591\\u2588\\u2588\\u2554\\u2550\\u2550\\u2588\\u2588\\u2557\\u2588\\u2588\\u2551\\u2591\\u2591\\u2591\\u2591\\u2591\\u2588\\u2588\\u2554\\u2550\\u2550\\u2588\\u2588\\u2551\\u2588\\u2588\\u2551\\u255a\\u2588\\u2588\\u2588\\u2588\\u2551\\u2588\\u2588\\u2551\\u2591\\u2591\\u2588\\u2588\\u2551\\n\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2554\\u255d\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2557\\u2588\\u2588\\u2551\\u2591\\u2591\\u2591\\u2591\\u2591\\u2588\\u2588\\u2551\\u2003\\u2003\\u2591\\u2591\\u255a\\u2588\\u2588\\u2554\\u255d\\u2591\\u255a\\u2588\\u2588\\u2554\\u255d\\u2591\\u255a\\u2588\\u2588\\u2588\\u2588\\u2588\\u2554\\u255d\\u2588\\u2588\\u2551\\u2591\\u255a\\u2588\\u2588\\u2588\\u2551\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2554\\u255d\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2557\\u2588\\u2588\\u2551\\u2591\\u2591\\u2588\\u2588\\u2551\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2557\\u2588\\u2588\\u2551\\u2591\\u2591\\u2588\\u2588\\u2551\\u2588\\u2588\\u2551\\u2591\\u255a\\u2588\\u2588\\u2588\\u2551\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2554\\u255d\\n\\u255a\\u2550\\u2550\\u2550\\u2550\\u2550\\u255d\\u2591\\u255a\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u255d\\u255a\\u2550\\u255d\\u2591\\u2591\\u2591\\u2591\\u2591\\u255a\\u2550\\u255d\\u2003\\u2003\\u2591\\u2591\\u2591\\u255a\\u2550\\u255d\\u2591\\u2591\\u2591\\u255a\\u2550\\u255d\\u2591\\u2591\\u2591\\u255a\\u2550\\u2550\\u2550\\u2550\\u255d\\u2591\\u255a\\u2550\\u255d\\u2591\\u2591\\u255a\\u2550\\u2550\\u255d\\u255a\\u2550\\u2550\\u2550\\u2550\\u2550\\u255d\\u2591\\u255a\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u255d\\u255a\\u2550\\u255d\\u2591\\u2591\\u255a\\u2550\\u255d\\u255a\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u255d\\u255a\\u2550\\u255d\\u2591\\u2591\\u255a\\u2550\\u255d\\u255a\\u2550\\u255d\\u2591\\u2591\\u255a\\u2550\\u2550\\u255d\\u255a\\u2550\\u2550\\u2550\\u2550\\u2550\\u255d\\u2591\\n\\nhttps://defi.sucks\\n\\n*/\\n\\npragma solidity >=0.8.7 <0.9.0;\\n\\nimport './libraries/FullMath.sol';\\nimport './libraries/TickMath.sol';\\nimport '../interfaces/IKeep3r.sol';\\nimport '../interfaces/IKeep3rHelper.sol';\\nimport './Keep3rHelperParameters.sol';\\n\\nimport '@openzeppelin/contracts/utils/math/Math.sol';\\nimport '@uniswap/v3-core/contracts/interfaces/IUniswapV3Pool.sol';\\n\\ncontract Keep3rHelper is IKeep3rHelper, Keep3rHelperParameters {\\n constructor(\\n address _kp3r,\\n address _keep3rV2,\\n address _governance,\\n address _kp3rWethPool\\n ) Keep3rHelperParameters(_kp3r, _keep3rV2, _governance, _kp3rWethPool) {}\\n\\n /// @inheritdoc IKeep3rHelper\\n function quote(uint256 _eth) public view override returns (uint256 _amountOut) {\\n uint32[] memory _secondsAgos = new uint32[](2);\\n _secondsAgos[1] = quoteTwapTime;\\n\\n (int56[] memory _tickCumulatives, ) = IUniswapV3Pool(kp3rWethPool.poolAddress).observe(_secondsAgos);\\n int56 _difference = _tickCumulatives[0] - _tickCumulatives[1];\\n _amountOut = getQuoteAtTick(uint128(_eth), kp3rWethPool.isTKNToken0 ? _difference : -_difference, quoteTwapTime);\\n }\\n\\n /// @inheritdoc IKeep3rHelper\\n function bonds(address _keeper) public view virtual override returns (uint256 _amountBonded) {\\n return IKeep3r(keep3rV2).bonds(_keeper, KP3R);\\n }\\n\\n /// @inheritdoc IKeep3rHelper\\n function getRewardAmountFor(address _keeper, uint256 _gasUsed) public view override returns (uint256 _kp3r) {\\n uint256 _boost = getRewardBoostFor(bonds(_keeper));\\n _kp3r = quote((_gasUsed * _boost) / BOOST_BASE);\\n }\\n\\n /// @inheritdoc IKeep3rHelper\\n function getRewardAmount(uint256 _gasUsed) external view override returns (uint256 _amount) {\\n // solhint-disable-next-line avoid-tx-origin\\n return getRewardAmountFor(tx.origin, _gasUsed);\\n }\\n\\n /// @inheritdoc IKeep3rHelper\\n function getRewardBoostFor(uint256 _bonds) public view override returns (uint256 _rewardBoost) {\\n _bonds = Math.min(_bonds, targetBond);\\n uint256 _cap = minBoost + ((maxBoost - minBoost) * _bonds) / targetBond;\\n _rewardBoost = _cap * _getBasefee();\\n }\\n\\n /// @inheritdoc IKeep3rHelper\\n function getPoolTokens(address _pool) public view override returns (address _token0, address _token1) {\\n return (IUniswapV3Pool(_pool).token0(), IUniswapV3Pool(_pool).token1());\\n }\\n\\n /// @inheritdoc IKeep3rHelper\\n function isKP3RToken0(address _pool) external view virtual override returns (bool _isKP3RToken0) {\\n address _token0;\\n address _token1;\\n (_token0, _token1) = getPoolTokens(_pool);\\n if (_token0 == KP3R) {\\n return true;\\n } else if (_token1 != KP3R) {\\n revert LiquidityPairInvalid();\\n }\\n }\\n\\n /// @inheritdoc IKeep3rHelper\\n function observe(address _pool, uint32[] memory _secondsAgo)\\n external\\n view\\n override\\n returns (\\n int56 _tickCumulative1,\\n int56 _tickCumulative2,\\n bool _success\\n )\\n {\\n try IUniswapV3Pool(_pool).observe(_secondsAgo) returns (int56[] memory _uniswapResponse, uint160[] memory) {\\n _tickCumulative1 = _uniswapResponse[0];\\n if (_uniswapResponse.length > 1) {\\n _tickCumulative2 = _uniswapResponse[1];\\n }\\n _success = true;\\n } catch (bytes memory) {}\\n }\\n\\n /// @inheritdoc IKeep3rHelper\\n function getPaymentParams(uint256 _bonds)\\n external\\n view\\n virtual\\n override\\n returns (\\n uint256 _boost,\\n uint256 _oneEthQuote,\\n uint256 _extra\\n )\\n {\\n _oneEthQuote = quote(1 ether);\\n _boost = getRewardBoostFor(_bonds);\\n _extra = workExtraGas;\\n }\\n\\n /// @inheritdoc IKeep3rHelper\\n function getKP3RsAtTick(\\n uint256 _liquidityAmount,\\n int56 _tickDifference,\\n uint256 _timeInterval\\n ) external pure override returns (uint256 _kp3rAmount) {\\n uint160 sqrtRatioX96 = TickMath.getSqrtRatioAtTick(int24(_tickDifference / int256(_timeInterval)));\\n _kp3rAmount = FullMath.mulDiv(1 << 96, _liquidityAmount, sqrtRatioX96);\\n }\\n\\n /// @inheritdoc IKeep3rHelper\\n function getQuoteAtTick(\\n uint128 _baseAmount,\\n int56 _tickDifference,\\n uint256 _timeInterval\\n ) public pure override returns (uint256 _quoteAmount) {\\n uint160 sqrtRatioX96 = TickMath.getSqrtRatioAtTick(int24(_tickDifference / int256(_timeInterval)));\\n\\n if (sqrtRatioX96 <= type(uint128).max) {\\n uint256 ratioX192 = uint256(sqrtRatioX96) * sqrtRatioX96;\\n _quoteAmount = FullMath.mulDiv(1 << 192, _baseAmount, ratioX192);\\n } else {\\n uint256 ratioX128 = FullMath.mulDiv(sqrtRatioX96, sqrtRatioX96, 1 << 64);\\n _quoteAmount = FullMath.mulDiv(1 << 128, _baseAmount, ratioX128);\\n }\\n }\\n\\n /// @notice Gets the gas basefee cost to calculate keeper rewards\\n /// @dev Keepers are required to pay a priority fee to be included, this function recognizes a minimum priority fee\\n /// @return _baseFee The block's basefee + a minimum priority fee, or a preset minimum gas fee\\n function _getBasefee() internal view virtual returns (uint256 _baseFee) {\\n return Math.max(minBaseFee, block.basefee + minPriorityFee);\\n }\\n}\\n\",\"keccak256\":\"0x022987525462636329608fd3032553a123451854d6191d863f068de237302d17\",\"license\":\"MIT\"},\"solidity/contracts/Keep3rHelperParameters.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.7 <0.9.0;\\n\\nimport './libraries/FullMath.sol';\\nimport './libraries/TickMath.sol';\\nimport '../interfaces/peripherals/IBaseErrors.sol';\\nimport '../interfaces/IKeep3r.sol';\\nimport '../interfaces/external/IKeep3rV1.sol';\\nimport '../interfaces/IKeep3rHelperParameters.sol';\\nimport './peripherals/Governable.sol';\\nimport './Keep3rHelperParameters.sol';\\n\\nimport '@openzeppelin/contracts/utils/math/Math.sol';\\nimport '@uniswap/v3-core/contracts/interfaces/IUniswapV3Pool.sol';\\n\\ncontract Keep3rHelperParameters is IKeep3rHelperParameters, IBaseErrors, Governable {\\n /// @inheritdoc IKeep3rHelperParameters\\n address public immutable override KP3R;\\n\\n /// @inheritdoc IKeep3rHelperParameters\\n uint256 public constant override BOOST_BASE = 10_000;\\n\\n /// @inheritdoc IKeep3rHelperParameters\\n uint256 public override minBoost = 11_000;\\n\\n /// @inheritdoc IKeep3rHelperParameters\\n uint256 public override maxBoost = 12_000;\\n\\n /// @inheritdoc IKeep3rHelperParameters\\n uint256 public override targetBond = 200 ether;\\n\\n /// @inheritdoc IKeep3rHelperParameters\\n uint256 public override workExtraGas = 34_000;\\n\\n /// @inheritdoc IKeep3rHelperParameters\\n uint32 public override quoteTwapTime = 10 minutes;\\n\\n /// @inheritdoc IKeep3rHelperParameters\\n uint256 public override minBaseFee = 15e9;\\n\\n /// @inheritdoc IKeep3rHelperParameters\\n uint256 public override minPriorityFee = 2e9;\\n\\n /// @inheritdoc IKeep3rHelperParameters\\n address public override keep3rV2;\\n\\n /// @inheritdoc IKeep3rHelperParameters\\n IKeep3rHelperParameters.TokenOraclePool public override kp3rWethPool;\\n\\n constructor(\\n address _kp3r,\\n address _keep3rV2,\\n address _governance,\\n address _kp3rWethPool\\n ) Governable(_governance) {\\n KP3R = _kp3r;\\n keep3rV2 = _keep3rV2;\\n\\n // Immutable variables [KP3R] cannot be read during contract creation time [_setKp3rWethPool]\\n kp3rWethPool = _validateOraclePool(_kp3rWethPool, _kp3r);\\n emit Kp3rWethPoolChange(kp3rWethPool.poolAddress, kp3rWethPool.isTKNToken0);\\n }\\n\\n /// @inheritdoc IKeep3rHelperParameters\\n function setKp3rWethPool(address _poolAddress) external override onlyGovernance {\\n if (_poolAddress == address(0)) revert ZeroAddress();\\n _setKp3rWethPool(_poolAddress);\\n }\\n\\n /// @inheritdoc IKeep3rHelperParameters\\n function setMinBoost(uint256 _minBoost) external override onlyGovernance {\\n minBoost = _minBoost;\\n emit MinBoostChange(minBoost);\\n }\\n\\n /// @inheritdoc IKeep3rHelperParameters\\n function setMaxBoost(uint256 _maxBoost) external override onlyGovernance {\\n maxBoost = _maxBoost;\\n emit MaxBoostChange(maxBoost);\\n }\\n\\n /// @inheritdoc IKeep3rHelperParameters\\n function setTargetBond(uint256 _targetBond) external override onlyGovernance {\\n targetBond = _targetBond;\\n emit TargetBondChange(targetBond);\\n }\\n\\n /// @inheritdoc IKeep3rHelperParameters\\n function setKeep3rV2(address _keep3rV2) external override onlyGovernance {\\n if (_keep3rV2 == address(0)) revert ZeroAddress();\\n keep3rV2 = _keep3rV2;\\n emit Keep3rV2Change(keep3rV2);\\n }\\n\\n /// @inheritdoc IKeep3rHelperParameters\\n function setWorkExtraGas(uint256 _workExtraGas) external override onlyGovernance {\\n workExtraGas = _workExtraGas;\\n emit WorkExtraGasChange(workExtraGas);\\n }\\n\\n /// @inheritdoc IKeep3rHelperParameters\\n function setQuoteTwapTime(uint32 _quoteTwapTime) external override onlyGovernance {\\n _setQuoteTwapTime(_quoteTwapTime);\\n }\\n\\n function _setQuoteTwapTime(uint32 _quoteTwapTime) internal {\\n quoteTwapTime = _quoteTwapTime;\\n emit QuoteTwapTimeChange(quoteTwapTime);\\n }\\n\\n /// @inheritdoc IKeep3rHelperParameters\\n function setMinBaseFee(uint256 _minBaseFee) external override onlyGovernance {\\n minBaseFee = _minBaseFee;\\n emit MinBaseFeeChange(minBaseFee);\\n }\\n\\n /// @inheritdoc IKeep3rHelperParameters\\n function setMinPriorityFee(uint256 _minPriorityFee) external override onlyGovernance {\\n minPriorityFee = _minPriorityFee;\\n emit MinPriorityFeeChange(minPriorityFee);\\n }\\n\\n /// @notice Sets KP3R-WETH pool\\n /// @param _poolAddress The address of the KP3R-WETH pool\\n function _setKp3rWethPool(address _poolAddress) internal {\\n kp3rWethPool = _validateOraclePool(_poolAddress, KP3R);\\n emit Kp3rWethPoolChange(kp3rWethPool.poolAddress, kp3rWethPool.isTKNToken0);\\n }\\n\\n function _validateOraclePool(address _poolAddress, address _token) internal view virtual returns (TokenOraclePool memory _oraclePool) {\\n bool _isTKNToken0 = IUniswapV3Pool(_poolAddress).token0() == _token;\\n\\n if (!_isTKNToken0 && IUniswapV3Pool(_poolAddress).token1() != _token) revert InvalidOraclePool();\\n\\n return TokenOraclePool(_poolAddress, _isTKNToken0);\\n }\\n}\\n\",\"keccak256\":\"0xff1d1cdd8acec9bed3ac67c0980c1e211e6e09483e30a090c05ed4698a5c0dd4\",\"license\":\"MIT\"},\"solidity/contracts/libraries/FullMath.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4 <0.9.0;\\n\\n/// @title Contains 512-bit math functions\\n/// @notice Facilitates multiplication and division that can have overflow of an intermediate value without any loss of precision\\n/// @dev Handles \\\"phantom overflow\\\" i.e., allows multiplication and division where an intermediate value overflows 256 bits\\nlibrary FullMath {\\n /// @notice Calculates floor(a\\u00d7b\\u00f7denominator) with full precision. Throws if result overflows a uint256 or denominator == 0\\n /// @param a The multiplicand\\n /// @param b The multiplier\\n /// @param denominator The divisor\\n /// @return result The 256-bit result\\n /// @dev Credit to Remco Bloemen under MIT license https://xn--2-umb.com/21/muldiv\\n function mulDiv(\\n uint256 a,\\n uint256 b,\\n uint256 denominator\\n ) internal pure returns (uint256 result) {\\n unchecked {\\n // 512-bit multiply [prod1 prod0] = a * b\\n // Compute the product mod 2**256 and mod 2**256 - 1\\n // then use the Chinese Remainder Theorem to reconstruct\\n // the 512 bit result. The result is stored in two 256\\n // variables such that product = prod1 * 2**256 + prod0\\n uint256 prod0; // Least significant 256 bits of the product\\n uint256 prod1; // Most significant 256 bits of the product\\n assembly {\\n let mm := mulmod(a, b, not(0))\\n prod0 := mul(a, b)\\n prod1 := sub(sub(mm, prod0), lt(mm, prod0))\\n }\\n\\n // Handle non-overflow cases, 256 by 256 division\\n if (prod1 == 0) {\\n require(denominator > 0);\\n assembly {\\n result := div(prod0, denominator)\\n }\\n return result;\\n }\\n\\n // Make sure the result is less than 2**256.\\n // Also prevents denominator == 0\\n require(denominator > prod1);\\n\\n ///////////////////////////////////////////////\\n // 512 by 256 division.\\n ///////////////////////////////////////////////\\n\\n // Make division exact by subtracting the remainder from [prod1 prod0]\\n // Compute remainder using mulmod\\n uint256 remainder;\\n assembly {\\n remainder := mulmod(a, b, denominator)\\n }\\n // Subtract 256 bit number from 512 bit number\\n assembly {\\n prod1 := sub(prod1, gt(remainder, prod0))\\n prod0 := sub(prod0, remainder)\\n }\\n\\n // Factor powers of two out of denominator\\n // Compute largest power of two divisor of denominator.\\n // Always >= 1.\\n uint256 twos = (~denominator + 1) & denominator;\\n // Divide denominator by power of two\\n assembly {\\n denominator := div(denominator, twos)\\n }\\n\\n // Divide [prod1 prod0] by the factors of two\\n assembly {\\n prod0 := div(prod0, twos)\\n }\\n // Shift in bits from prod1 into prod0. For this we need\\n // to flip `twos` such that it is 2**256 / twos.\\n // If twos is zero, then it becomes one\\n assembly {\\n twos := add(div(sub(0, twos), twos), 1)\\n }\\n prod0 |= prod1 * twos;\\n\\n // Invert denominator mod 2**256\\n // Now that denominator is an odd number, it has an inverse\\n // modulo 2**256 such that denominator * inv = 1 mod 2**256.\\n // Compute the inverse by starting with a seed that is correct\\n // correct for four bits. That is, denominator * inv = 1 mod 2**4\\n uint256 inv = (3 * denominator) ^ 2;\\n // Now use Newton-Raphson iteration to improve the precision.\\n // Thanks to Hensel's lifting lemma, this also works in modular\\n // arithmetic, doubling the correct bits in each step.\\n inv *= 2 - denominator * inv; // inverse mod 2**8\\n inv *= 2 - denominator * inv; // inverse mod 2**16\\n inv *= 2 - denominator * inv; // inverse mod 2**32\\n inv *= 2 - denominator * inv; // inverse mod 2**64\\n inv *= 2 - denominator * inv; // inverse mod 2**128\\n inv *= 2 - denominator * inv; // inverse mod 2**256\\n\\n // Because the division is now exact we can divide by multiplying\\n // with the modular inverse of denominator. This will give us the\\n // correct result modulo 2**256. Since the precoditions guarantee\\n // that the outcome is less than 2**256, this is the final result.\\n // We don't need to compute the high bits of the result and prod1\\n // is no longer required.\\n result = prod0 * inv;\\n return result;\\n }\\n }\\n\\n /// @notice Calculates ceil(a\\u00d7b\\u00f7denominator) with full precision. Throws if result overflows a uint256 or denominator == 0\\n /// @param a The multiplicand\\n /// @param b The multiplier\\n /// @param denominator The divisor\\n /// @return result The 256-bit result\\n function mulDivRoundingUp(\\n uint256 a,\\n uint256 b,\\n uint256 denominator\\n ) internal pure returns (uint256 result) {\\n unchecked {\\n result = mulDiv(a, b, denominator);\\n if (mulmod(a, b, denominator) > 0) {\\n require(result < type(uint256).max);\\n result++;\\n }\\n }\\n }\\n}\\n\",\"keccak256\":\"0xe1c595da02adf8ba2ae74ac579b9b3c966d1ecb2a99c25081a62ee8550f26569\",\"license\":\"MIT\"},\"solidity/contracts/libraries/TickMath.sol\":{\"content\":\"// SPDX-License-Identifier: GPL-2.0-or-later\\npragma solidity >=0.5.0;\\n\\n// solhint-disable\\n\\n/// @title Math library for computing sqrt prices from ticks and vice versa\\n/// @notice Computes sqrt price for ticks of size 1.0001, i.e. sqrt(1.0001^tick) as fixed point Q64.96 numbers. Supports\\n/// prices between 2**-128 and 2**128\\nlibrary TickMath {\\n /// @dev The minimum tick that may be passed to #getSqrtRatioAtTick computed from log base 1.0001 of 2**-128\\n int24 internal constant MIN_TICK = -887272;\\n /// @dev The maximum tick that may be passed to #getSqrtRatioAtTick computed from log base 1.0001 of 2**128\\n int24 internal constant MAX_TICK = -MIN_TICK;\\n\\n /// @dev The minimum value that can be returned from #getSqrtRatioAtTick. Equivalent to getSqrtRatioAtTick(MIN_TICK)\\n uint160 internal constant MIN_SQRT_RATIO = 4295128739;\\n /// @dev The maximum value that can be returned from #getSqrtRatioAtTick. Equivalent to getSqrtRatioAtTick(MAX_TICK)\\n uint160 internal constant MAX_SQRT_RATIO = 1461446703485210103287273052203988822378723970342;\\n\\n /// @notice Calculates sqrt(1.0001^tick) * 2^96\\n /// @dev Throws if |tick| > max tick\\n /// @param tick The input tick for the above formula\\n /// @return sqrtPriceX96 A Fixed point Q64.96 number representing the sqrt of the ratio of the two assets (token1/token0)\\n /// at the given tick\\n function getSqrtRatioAtTick(int24 tick) internal pure returns (uint160 sqrtPriceX96) {\\n uint256 absTick = tick < 0 ? uint256(-int256(tick)) : uint256(int256(tick));\\n require(absTick <= uint256(int256(MAX_TICK)), 'T');\\n\\n uint256 ratio = absTick & 0x1 != 0 ? 0xfffcb933bd6fad37aa2d162d1a594001 : 0x100000000000000000000000000000000;\\n if (absTick & 0x2 != 0) ratio = (ratio * 0xfff97272373d413259a46990580e213a) >> 128;\\n if (absTick & 0x4 != 0) ratio = (ratio * 0xfff2e50f5f656932ef12357cf3c7fdcc) >> 128;\\n if (absTick & 0x8 != 0) ratio = (ratio * 0xffe5caca7e10e4e61c3624eaa0941cd0) >> 128;\\n if (absTick & 0x10 != 0) ratio = (ratio * 0xffcb9843d60f6159c9db58835c926644) >> 128;\\n if (absTick & 0x20 != 0) ratio = (ratio * 0xff973b41fa98c081472e6896dfb254c0) >> 128;\\n if (absTick & 0x40 != 0) ratio = (ratio * 0xff2ea16466c96a3843ec78b326b52861) >> 128;\\n if (absTick & 0x80 != 0) ratio = (ratio * 0xfe5dee046a99a2a811c461f1969c3053) >> 128;\\n if (absTick & 0x100 != 0) ratio = (ratio * 0xfcbe86c7900a88aedcffc83b479aa3a4) >> 128;\\n if (absTick & 0x200 != 0) ratio = (ratio * 0xf987a7253ac413176f2b074cf7815e54) >> 128;\\n if (absTick & 0x400 != 0) ratio = (ratio * 0xf3392b0822b70005940c7a398e4b70f3) >> 128;\\n if (absTick & 0x800 != 0) ratio = (ratio * 0xe7159475a2c29b7443b29c7fa6e889d9) >> 128;\\n if (absTick & 0x1000 != 0) ratio = (ratio * 0xd097f3bdfd2022b8845ad8f792aa5825) >> 128;\\n if (absTick & 0x2000 != 0) ratio = (ratio * 0xa9f746462d870fdf8a65dc1f90e061e5) >> 128;\\n if (absTick & 0x4000 != 0) ratio = (ratio * 0x70d869a156d2a1b890bb3df62baf32f7) >> 128;\\n if (absTick & 0x8000 != 0) ratio = (ratio * 0x31be135f97d08fd981231505542fcfa6) >> 128;\\n if (absTick & 0x10000 != 0) ratio = (ratio * 0x9aa508b5b7a84e1c677de54f3e99bc9) >> 128;\\n if (absTick & 0x20000 != 0) ratio = (ratio * 0x5d6af8dedb81196699c329225ee604) >> 128;\\n if (absTick & 0x40000 != 0) ratio = (ratio * 0x2216e584f5fa1ea926041bedfe98) >> 128;\\n if (absTick & 0x80000 != 0) ratio = (ratio * 0x48a170391f7dc42444e8fa2) >> 128;\\n\\n if (tick > 0) ratio = type(uint256).max / ratio;\\n\\n // Divides by 1<<32 rounding up to go from a Q128.128 to a Q128.96.\\n // we then downcast because we know the result always fits within 160 bits due to our tick input constraint\\n // we round up in the division so getTickAtSqrtRatio of the output price is always consistent\\n sqrtPriceX96 = uint160((ratio >> 32) + (ratio % (1 << 32) == 0 ? 0 : 1));\\n }\\n\\n /// @notice Calculates the greatest tick value such that getRatioAtTick(tick) <= ratio\\n /// @dev Throws in case sqrtPriceX96 < MIN_SQRT_RATIO, as MIN_SQRT_RATIO is the lowest value getRatioAtTick may ever return.\\n /// @param sqrtPriceX96 The sqrt ratio for which to compute the tick as a Q64.96\\n /// @return tick The greatest tick for which the ratio is less than or equal to the input ratio\\n function getTickAtSqrtRatio(uint160 sqrtPriceX96) internal pure returns (int24 tick) {\\n // Second inequality must be < because the price can never reach the price at the max tick\\n require(sqrtPriceX96 >= MIN_SQRT_RATIO && sqrtPriceX96 < MAX_SQRT_RATIO, 'R');\\n uint256 ratio = uint256(sqrtPriceX96) << 32;\\n\\n uint256 r = ratio;\\n uint256 msb = 0;\\n\\n assembly {\\n let f := shl(7, gt(r, 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF))\\n msb := or(msb, f)\\n r := shr(f, r)\\n }\\n assembly {\\n let f := shl(6, gt(r, 0xFFFFFFFFFFFFFFFF))\\n msb := or(msb, f)\\n r := shr(f, r)\\n }\\n assembly {\\n let f := shl(5, gt(r, 0xFFFFFFFF))\\n msb := or(msb, f)\\n r := shr(f, r)\\n }\\n assembly {\\n let f := shl(4, gt(r, 0xFFFF))\\n msb := or(msb, f)\\n r := shr(f, r)\\n }\\n assembly {\\n let f := shl(3, gt(r, 0xFF))\\n msb := or(msb, f)\\n r := shr(f, r)\\n }\\n assembly {\\n let f := shl(2, gt(r, 0xF))\\n msb := or(msb, f)\\n r := shr(f, r)\\n }\\n assembly {\\n let f := shl(1, gt(r, 0x3))\\n msb := or(msb, f)\\n r := shr(f, r)\\n }\\n assembly {\\n let f := gt(r, 0x1)\\n msb := or(msb, f)\\n }\\n\\n if (msb >= 128) r = ratio >> (msb - 127);\\n else r = ratio << (127 - msb);\\n\\n int256 log_2 = (int256(msb) - 128) << 64;\\n\\n assembly {\\n r := shr(127, mul(r, r))\\n let f := shr(128, r)\\n log_2 := or(log_2, shl(63, f))\\n r := shr(f, r)\\n }\\n assembly {\\n r := shr(127, mul(r, r))\\n let f := shr(128, r)\\n log_2 := or(log_2, shl(62, f))\\n r := shr(f, r)\\n }\\n assembly {\\n r := shr(127, mul(r, r))\\n let f := shr(128, r)\\n log_2 := or(log_2, shl(61, f))\\n r := shr(f, r)\\n }\\n assembly {\\n r := shr(127, mul(r, r))\\n let f := shr(128, r)\\n log_2 := or(log_2, shl(60, f))\\n r := shr(f, r)\\n }\\n assembly {\\n r := shr(127, mul(r, r))\\n let f := shr(128, r)\\n log_2 := or(log_2, shl(59, f))\\n r := shr(f, r)\\n }\\n assembly {\\n r := shr(127, mul(r, r))\\n let f := shr(128, r)\\n log_2 := or(log_2, shl(58, f))\\n r := shr(f, r)\\n }\\n assembly {\\n r := shr(127, mul(r, r))\\n let f := shr(128, r)\\n log_2 := or(log_2, shl(57, f))\\n r := shr(f, r)\\n }\\n assembly {\\n r := shr(127, mul(r, r))\\n let f := shr(128, r)\\n log_2 := or(log_2, shl(56, f))\\n r := shr(f, r)\\n }\\n assembly {\\n r := shr(127, mul(r, r))\\n let f := shr(128, r)\\n log_2 := or(log_2, shl(55, f))\\n r := shr(f, r)\\n }\\n assembly {\\n r := shr(127, mul(r, r))\\n let f := shr(128, r)\\n log_2 := or(log_2, shl(54, f))\\n r := shr(f, r)\\n }\\n assembly {\\n r := shr(127, mul(r, r))\\n let f := shr(128, r)\\n log_2 := or(log_2, shl(53, f))\\n r := shr(f, r)\\n }\\n assembly {\\n r := shr(127, mul(r, r))\\n let f := shr(128, r)\\n log_2 := or(log_2, shl(52, f))\\n r := shr(f, r)\\n }\\n assembly {\\n r := shr(127, mul(r, r))\\n let f := shr(128, r)\\n log_2 := or(log_2, shl(51, f))\\n r := shr(f, r)\\n }\\n assembly {\\n r := shr(127, mul(r, r))\\n let f := shr(128, r)\\n log_2 := or(log_2, shl(50, f))\\n }\\n\\n int256 log_sqrt10001 = log_2 * 255738958999603826347141; // 128.128 number\\n\\n int24 tickLow = int24((log_sqrt10001 - 3402992956809132418596140100660247210) >> 128);\\n int24 tickHi = int24((log_sqrt10001 + 291339464771989622907027621153398088495) >> 128);\\n\\n tick = tickLow == tickHi ? tickLow : getSqrtRatioAtTick(tickHi) <= sqrtPriceX96 ? tickHi : tickLow;\\n }\\n}\\n\",\"keccak256\":\"0x11b965ba576ff91b4a6e9533c0f334f2b7b6024ee1c54e36d21799de5580899d\",\"license\":\"GPL-2.0-or-later\"},\"solidity/contracts/peripherals/Governable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4 <0.9.0;\\n\\nimport '../../interfaces/peripherals/IGovernable.sol';\\n\\nabstract contract Governable is IGovernable {\\n /// @inheritdoc IGovernable\\n address public override governance;\\n\\n /// @inheritdoc IGovernable\\n address public override pendingGovernance;\\n\\n constructor(address _governance) {\\n if (_governance == address(0)) revert NoGovernanceZeroAddress();\\n governance = _governance;\\n }\\n\\n /// @inheritdoc IGovernable\\n function setGovernance(address _governance) external override onlyGovernance {\\n pendingGovernance = _governance;\\n emit GovernanceProposal(_governance);\\n }\\n\\n /// @inheritdoc IGovernable\\n function acceptGovernance() external override onlyPendingGovernance {\\n governance = pendingGovernance;\\n delete pendingGovernance;\\n emit GovernanceSet(governance);\\n }\\n\\n /// @notice Functions with this modifier can only be called by governance\\n modifier onlyGovernance {\\n if (msg.sender != governance) revert OnlyGovernance();\\n _;\\n }\\n\\n /// @notice Functions with this modifier can only be called by pendingGovernance\\n modifier onlyPendingGovernance {\\n if (msg.sender != pendingGovernance) revert OnlyPendingGovernance();\\n _;\\n }\\n}\\n\",\"keccak256\":\"0x5b6d7601a42d2229657a7f60021c7e2bfe890c3541ab0003f7d88e20a28d722b\",\"license\":\"MIT\"},\"solidity/for-test/testnet/Keep3rHelperForTestnet.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4 <0.9.0;\\n\\nimport '../../contracts/Keep3rHelper.sol';\\n\\ncontract Keep3rHelperForTestnet is Keep3rHelper {\\n constructor(\\n address _kp3r,\\n address _keep3rV2,\\n address _governance,\\n address _kp3rWethPool\\n ) Keep3rHelper(_kp3r, _keep3rV2, _governance, _kp3rWethPool) {}\\n\\n function _getBasefee() internal pure override returns (uint256) {\\n return 1;\\n }\\n}\\n\",\"keccak256\":\"0x81fa0474c36c30674ca643a4829295d512573e7ad61b88024385887ee795f799\",\"license\":\"MIT\"},\"solidity/interfaces/IKeep3r.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4 <0.9.0;\\n\\nimport './peripherals/IKeep3rJobs.sol';\\nimport './peripherals/IKeep3rKeepers.sol';\\nimport './peripherals/IKeep3rParameters.sol';\\n\\n// solhint-disable-next-line no-empty-blocks\\n\\n/// @title Keep3rV2 contract\\n/// @notice This contract inherits all the functionality of Keep3rV2\\ninterface IKeep3r is IKeep3rJobs, IKeep3rKeepers, IKeep3rParameters {\\n\\n}\\n\",\"keccak256\":\"0x273a39984c1475c60182e636bb91a1b89ec98646a036cac6a87067869b3adeb9\",\"license\":\"MIT\"},\"solidity/interfaces/IKeep3rHelper.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4 <0.9.0;\\n\\nimport './IKeep3rHelperParameters.sol';\\n\\n/// @title Keep3rHelper contract\\n/// @notice Contains all the helper functions used throughout the different files.\\ninterface IKeep3rHelper is IKeep3rHelperParameters {\\n // Errors\\n\\n /// @notice Throws when none of the tokens in the liquidity pair is KP3R\\n error LiquidityPairInvalid();\\n\\n // Methods\\n // solhint-enable func-name-mixedcase\\n\\n /// @notice Calculates the amount of KP3R that corresponds to the ETH passed into the function\\n /// @dev This function allows us to calculate how much KP3R we should pay to a keeper for things expressed in ETH, like gas\\n /// @param _eth The amount of ETH\\n /// @return _amountOut The amount of KP3R\\n function quote(uint256 _eth) external view returns (uint256 _amountOut);\\n\\n /// @notice Returns the amount of KP3R the keeper has bonded\\n /// @param _keeper The address of the keeper to check\\n /// @return _amountBonded The amount of KP3R the keeper has bonded\\n function bonds(address _keeper) external view returns (uint256 _amountBonded);\\n\\n /// @notice Calculates the reward (in KP3R) that corresponds to a keeper for using gas\\n /// @param _keeper The address of the keeper to check\\n /// @param _gasUsed The amount of gas used that will be rewarded\\n /// @return _kp3r The amount of KP3R that should be awarded to the keeper\\n function getRewardAmountFor(address _keeper, uint256 _gasUsed) external view returns (uint256 _kp3r);\\n\\n /// @notice Calculates the boost in the reward given to a keeper based on the amount of KP3R that keeper has bonded\\n /// @dev If the keeper has no bonds, boost should be +10% of gas cost, if keeper has max bonds, +20%\\n /// @param _bonds The amount of KP3R tokens bonded by the keeper\\n /// @return _rewardBoost The reward boost that corresponds to the keeper\\n function getRewardBoostFor(uint256 _bonds) external view returns (uint256 _rewardBoost);\\n\\n /// @notice Calculates the reward (in KP3R) that corresponds to tx.origin for using gas\\n /// @param _gasUsed The amount of gas used that will be rewarded\\n /// @return _amount The amount of KP3R that should be awarded to tx.origin\\n function getRewardAmount(uint256 _gasUsed) external view returns (uint256 _amount);\\n\\n /// @notice Given a pool address, returns the underlying tokens of the pair\\n /// @param _pool Address of the correspondant pool\\n /// @return _token0 Address of the first token of the pair\\n /// @return _token1 Address of the second token of the pair\\n function getPoolTokens(address _pool) external view returns (address _token0, address _token1);\\n\\n /// @notice Defines the order of the tokens in the pair for twap calculations\\n /// @param _pool Address of the correspondant pool\\n /// @return _isKP3RToken0 Boolean indicating the order of the tokens in the pair\\n function isKP3RToken0(address _pool) external view returns (bool _isKP3RToken0);\\n\\n /// @notice Given an array of secondsAgo, returns UniswapV3 pool cumulatives at that moment\\n /// @param _pool Address of the pool to observe\\n /// @param _secondsAgo Array with time references to observe\\n /// @return _tickCumulative1 Cumulative sum of ticks until first time reference\\n /// @return _tickCumulative2 Cumulative sum of ticks until second time reference\\n /// @return _success Boolean indicating if the observe call was succesfull\\n function observe(address _pool, uint32[] memory _secondsAgo)\\n external\\n view\\n returns (\\n int56 _tickCumulative1,\\n int56 _tickCumulative2,\\n bool _success\\n );\\n\\n /// @notice Get multiplier, quote, and extra, in order to calculate keeper payment\\n /// @param _bonds Amount of bonded KP3R owned by the keeper\\n /// @return _boost Multiplier per gas unit. Takes into account the base fee and the amount of bonded KP3R\\n /// @return _oneEthQuote Amount of KP3R tokens equivalent to 1 ETH\\n /// @return _extra Amount of extra gas that should be added to the gas spent\\n function getPaymentParams(uint256 _bonds)\\n external\\n view\\n returns (\\n uint256 _boost,\\n uint256 _oneEthQuote,\\n uint256 _extra\\n );\\n\\n /// @notice Given a tick and a liquidity amount, calculates the underlying KP3R tokens\\n /// @param _liquidityAmount Amount of liquidity to be converted\\n /// @param _tickDifference Tick value used to calculate the quote\\n /// @param _timeInterval Time value used to calculate the quote\\n /// @return _kp3rAmount Amount of KP3R tokens underlying on the given liquidity\\n function getKP3RsAtTick(\\n uint256 _liquidityAmount,\\n int56 _tickDifference,\\n uint256 _timeInterval\\n ) external pure returns (uint256 _kp3rAmount);\\n\\n /// @notice Given a tick and a token amount, calculates the output in correspondant token\\n /// @param _baseAmount Amount of token to be converted\\n /// @param _tickDifference Tick value used to calculate the quote\\n /// @param _timeInterval Time value used to calculate the quote\\n /// @return _quoteAmount Amount of credits deserved for the baseAmount at the tick value\\n function getQuoteAtTick(\\n uint128 _baseAmount,\\n int56 _tickDifference,\\n uint256 _timeInterval\\n ) external pure returns (uint256 _quoteAmount);\\n}\\n\",\"keccak256\":\"0x67817dc98fde9b3a917e25bc16fe60a91772dd5a77e0ce22a208b66b29d3ad8e\",\"license\":\"MIT\"},\"solidity/interfaces/IKeep3rHelperParameters.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4 <0.9.0;\\n\\n/// @title Keep3rHelperParameters contract\\n/// @notice Contains all the helper functions used throughout the different files.\\ninterface IKeep3rHelperParameters {\\n // Structs\\n\\n /// @dev KP3R-WETH Pool address and isKP3RToken0\\n /// @dev Created in order to save gas by avoiding calls to pool's token0 method\\n struct TokenOraclePool {\\n address poolAddress;\\n bool isTKNToken0;\\n }\\n\\n // Errors\\n\\n /// @notice Throws when pool does not have KP3R as token0 nor token1\\n error InvalidOraclePool();\\n\\n // Events\\n\\n /// @notice Emitted when the kp3r weth pool is changed\\n /// @param _address Address of the new kp3r weth pool\\n /// @param _isKP3RToken0 True if calling the token0 method of the pool returns the KP3R token address\\n event Kp3rWethPoolChange(address _address, bool _isKP3RToken0);\\n\\n /// @notice Emitted when the minimum boost multiplier is changed\\n /// @param _minBoost The minimum boost multiplier\\n event MinBoostChange(uint256 _minBoost);\\n\\n /// @notice Emitted when the maximum boost multiplier is changed\\n /// @param _maxBoost The maximum boost multiplier\\n event MaxBoostChange(uint256 _maxBoost);\\n\\n /// @notice Emitted when the target bond amount is changed\\n /// @param _targetBond The target bond amount\\n event TargetBondChange(uint256 _targetBond);\\n\\n /// @notice Emitted when the Keep3r V2 address is changed\\n /// @param _keep3rV2 The address of Keep3r V2\\n event Keep3rV2Change(address _keep3rV2);\\n\\n /// @notice Emitted when the work extra gas amount is changed\\n /// @param _workExtraGas The work extra gas\\n event WorkExtraGasChange(uint256 _workExtraGas);\\n\\n /// @notice Emitted when the quote twap time is changed\\n /// @param _quoteTwapTime The twap time for quoting\\n event QuoteTwapTimeChange(uint32 _quoteTwapTime);\\n\\n /// @notice Emitted when minimum rewarded gas fee is changed\\n /// @param _minBaseFee The minimum rewarded gas fee\\n event MinBaseFeeChange(uint256 _minBaseFee);\\n\\n /// @notice Emitted when minimum rewarded priority fee is changed\\n /// @param _minPriorityFee The minimum expected fee that the keeper should pay\\n event MinPriorityFeeChange(uint256 _minPriorityFee);\\n\\n // Variables\\n\\n /// @notice Address of KP3R token\\n /// @return _kp3r Address of KP3R token\\n // solhint-disable func-name-mixedcase\\n function KP3R() external view returns (address _kp3r);\\n\\n /// @notice The boost base used to calculate the boost rewards for the keeper\\n /// @return _base The boost base number\\n function BOOST_BASE() external view returns (uint256 _base);\\n\\n /// @notice KP3R-WETH pool that is being used as oracle\\n /// @return poolAddress Address of the pool\\n /// @return isTKNToken0 True if calling the token0 method of the pool returns the KP3R token address\\n function kp3rWethPool() external view returns (address poolAddress, bool isTKNToken0);\\n\\n /// @notice The minimum multiplier used to calculate the amount of gas paid to the Keeper for the gas used to perform a job\\n /// For example: if the quoted gas used is 1000, then the minimum amount to be paid will be 1000 * minBoost / BOOST_BASE\\n /// @return _multiplier The minimum boost multiplier\\n function minBoost() external view returns (uint256 _multiplier);\\n\\n /// @notice The maximum multiplier used to calculate the amount of gas paid to the Keeper for the gas used to perform a job\\n /// For example: if the quoted gas used is 1000, then the maximum amount to be paid will be 1000 * maxBoost / BOOST_BASE\\n /// @return _multiplier The maximum boost multiplier\\n function maxBoost() external view returns (uint256 _multiplier);\\n\\n /// @notice The targeted amount of bonded KP3Rs to max-up reward multiplier\\n /// For example: if the amount of KP3R the keeper has bonded is targetBond or more, then the keeper will get\\n /// the maximum boost possible in his rewards, if it's less, the reward boost will be proportional\\n /// @return _target The amount of KP3R that comforms the targetBond\\n function targetBond() external view returns (uint256 _target);\\n\\n /// @notice The amount of unaccounted gas that is going to be added to keeper payments\\n /// @return _workExtraGas The work unaccounted gas amount\\n function workExtraGas() external view returns (uint256 _workExtraGas);\\n\\n /// @notice The twap time for quoting\\n /// @return _quoteTwapTime The twap time\\n function quoteTwapTime() external view returns (uint32 _quoteTwapTime);\\n\\n /// @notice The minimum base fee that is used to calculate keeper rewards\\n /// @return _minBaseFee The minimum rewarded gas fee\\n function minBaseFee() external view returns (uint256 _minBaseFee);\\n\\n /// @notice The minimum priority fee that is also rewarded for keepers\\n /// @return _minPriorityFee The minimum rewarded priority fee\\n function minPriorityFee() external view returns (uint256 _minPriorityFee);\\n\\n /// @notice Address of Keep3r V2\\n /// @return _keep3rV2 Address of Keep3r V2\\n function keep3rV2() external view returns (address _keep3rV2);\\n\\n // Methods\\n\\n /// @notice Sets KP3R-WETH pool\\n /// @param _poolAddress The address of the KP3R-WETH pool\\n function setKp3rWethPool(address _poolAddress) external;\\n\\n /// @notice Sets the minimum boost multiplier\\n /// @param _minBoost The minimum boost multiplier\\n function setMinBoost(uint256 _minBoost) external;\\n\\n /// @notice Sets the maximum boost multiplier\\n /// @param _maxBoost The maximum boost multiplier\\n function setMaxBoost(uint256 _maxBoost) external;\\n\\n /// @notice Sets the target bond amount\\n /// @param _targetBond The target bond amount\\n function setTargetBond(uint256 _targetBond) external;\\n\\n /// @notice Sets the Keep3r V2 address\\n /// @param _keep3rV2 The address of Keep3r V2\\n function setKeep3rV2(address _keep3rV2) external;\\n\\n /// @notice Sets the work extra gas amount\\n /// @param _workExtraGas The work extra gas\\n function setWorkExtraGas(uint256 _workExtraGas) external;\\n\\n /// @notice Sets the quote twap time\\n /// @param _quoteTwapTime The twap time for quoting\\n function setQuoteTwapTime(uint32 _quoteTwapTime) external;\\n\\n /// @notice Sets the minimum rewarded gas fee\\n /// @param _minBaseFee The minimum rewarded gas fee\\n function setMinBaseFee(uint256 _minBaseFee) external;\\n\\n /// @notice Sets the minimum rewarded gas priority fee\\n /// @param _minPriorityFee The minimum rewarded priority fee\\n function setMinPriorityFee(uint256 _minPriorityFee) external;\\n}\\n\",\"keccak256\":\"0x76f99ca04361c0459fc9e99f0387ddb76da18cc470ec5bc744e7dc3bf6e9d334\",\"license\":\"MIT\"},\"solidity/interfaces/external/IKeep3rV1.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4 <0.9.0;\\n\\nimport '@openzeppelin/contracts/token/ERC20/IERC20.sol';\\nimport '@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol';\\n\\n// solhint-disable func-name-mixedcase\\ninterface IKeep3rV1 is IERC20, IERC20Metadata {\\n // Structs\\n struct Checkpoint {\\n uint32 fromBlock;\\n uint256 votes;\\n }\\n\\n // Events\\n event DelegateChanged(address indexed _delegator, address indexed _fromDelegate, address indexed _toDelegate);\\n event DelegateVotesChanged(address indexed _delegate, uint256 _previousBalance, uint256 _newBalance);\\n event SubmitJob(address indexed _job, address indexed _liquidity, address indexed _provider, uint256 _block, uint256 _credit);\\n event ApplyCredit(address indexed _job, address indexed _liquidity, address indexed _provider, uint256 _block, uint256 _credit);\\n event RemoveJob(address indexed _job, address indexed _liquidity, address indexed _provider, uint256 _block, uint256 _credit);\\n event UnbondJob(address indexed _job, address indexed _liquidity, address indexed _provider, uint256 _block, uint256 _credit);\\n event JobAdded(address indexed _job, uint256 _block, address _governance);\\n event JobRemoved(address indexed _job, uint256 _block, address _governance);\\n event KeeperWorked(address indexed _credit, address indexed _job, address indexed _keeper, uint256 _block, uint256 _amount);\\n event KeeperBonding(address indexed _keeper, uint256 _block, uint256 _active, uint256 _bond);\\n event KeeperBonded(address indexed _keeper, uint256 _block, uint256 _activated, uint256 _bond);\\n event KeeperUnbonding(address indexed _keeper, uint256 _block, uint256 _deactive, uint256 _bond);\\n event KeeperUnbound(address indexed _keeper, uint256 _block, uint256 _deactivated, uint256 _bond);\\n event KeeperSlashed(address indexed _keeper, address indexed _slasher, uint256 _block, uint256 _slash);\\n event KeeperDispute(address indexed _keeper, uint256 _block);\\n event KeeperResolved(address indexed _keeper, uint256 _block);\\n event TokenCreditAddition(address indexed _credit, address indexed _job, address indexed _creditor, uint256 _block, uint256 _amount);\\n\\n // Variables\\n function KPRH() external returns (address);\\n\\n function delegates(address _delegator) external view returns (address);\\n\\n function checkpoints(address _account, uint32 _checkpoint) external view returns (Checkpoint memory);\\n\\n function numCheckpoints(address _account) external view returns (uint32);\\n\\n function DOMAIN_TYPEHASH() external returns (bytes32);\\n\\n function DOMAINSEPARATOR() external returns (bytes32);\\n\\n function DELEGATION_TYPEHASH() external returns (bytes32);\\n\\n function PERMIT_TYPEHASH() external returns (bytes32);\\n\\n function nonces(address _user) external view returns (uint256);\\n\\n function BOND() external returns (uint256);\\n\\n function UNBOND() external returns (uint256);\\n\\n function LIQUIDITYBOND() external returns (uint256);\\n\\n function FEE() external returns (uint256);\\n\\n function BASE() external returns (uint256);\\n\\n function ETH() external returns (address);\\n\\n function bondings(address _user, address _bonding) external view returns (uint256);\\n\\n function canWithdrawAfter(address _user, address _bonding) external view returns (uint256);\\n\\n function pendingUnbonds(address _keeper, address _bonding) external view returns (uint256);\\n\\n function pendingbonds(address _keeper, address _bonding) external view returns (uint256);\\n\\n function bonds(address _keeper, address _bonding) external view returns (uint256);\\n\\n function votes(address _delegator) external view returns (uint256);\\n\\n function firstSeen(address _keeper) external view returns (uint256);\\n\\n function disputes(address _keeper) external view returns (bool);\\n\\n function lastJob(address _keeper) external view returns (uint256);\\n\\n function workCompleted(address _keeper) external view returns (uint256);\\n\\n function jobs(address _job) external view returns (bool);\\n\\n function credits(address _job, address _credit) external view returns (uint256);\\n\\n function liquidityProvided(\\n address _provider,\\n address _liquidity,\\n address _job\\n ) external view returns (uint256);\\n\\n function liquidityUnbonding(\\n address _provider,\\n address _liquidity,\\n address _job\\n ) external view returns (uint256);\\n\\n function liquidityAmountsUnbonding(\\n address _provider,\\n address _liquidity,\\n address _job\\n ) external view returns (uint256);\\n\\n function jobProposalDelay(address _job) external view returns (uint256);\\n\\n function liquidityApplied(\\n address _provider,\\n address _liquidity,\\n address _job\\n ) external view returns (uint256);\\n\\n function liquidityAmount(\\n address _provider,\\n address _liquidity,\\n address _job\\n ) external view returns (uint256);\\n\\n function keepers(address _keeper) external view returns (bool);\\n\\n function blacklist(address _keeper) external view returns (bool);\\n\\n function keeperList(uint256 _index) external view returns (address);\\n\\n function jobList(uint256 _index) external view returns (address);\\n\\n function governance() external returns (address);\\n\\n function pendingGovernance() external returns (address);\\n\\n function liquidityAccepted(address _liquidity) external view returns (bool);\\n\\n function liquidityPairs(uint256 _index) external view returns (address);\\n\\n // Methods\\n function getCurrentVotes(address _account) external view returns (uint256);\\n\\n function addCreditETH(address _job) external payable;\\n\\n function addCredit(\\n address _credit,\\n address _job,\\n uint256 _amount\\n ) external;\\n\\n function addVotes(address _voter, uint256 _amount) external;\\n\\n function removeVotes(address _voter, uint256 _amount) external;\\n\\n function addKPRCredit(address _job, uint256 _amount) external;\\n\\n function approveLiquidity(address _liquidity) external;\\n\\n function revokeLiquidity(address _liquidity) external;\\n\\n function pairs() external view returns (address[] memory);\\n\\n function addLiquidityToJob(\\n address _liquidity,\\n address _job,\\n uint256 _amount\\n ) external;\\n\\n function applyCreditToJob(\\n address _provider,\\n address _liquidity,\\n address _job\\n ) external;\\n\\n function unbondLiquidityFromJob(\\n address _liquidity,\\n address _job,\\n uint256 _amount\\n ) external;\\n\\n function removeLiquidityFromJob(address _liquidity, address _job) external;\\n\\n function mint(uint256 _amount) external;\\n\\n function burn(uint256 _amount) external;\\n\\n function worked(address _keeper) external;\\n\\n function receipt(\\n address _credit,\\n address _keeper,\\n uint256 _amount\\n ) external;\\n\\n function receiptETH(address _keeper, uint256 _amount) external;\\n\\n function addJob(address _job) external;\\n\\n function getJobs() external view returns (address[] memory);\\n\\n function removeJob(address _job) external;\\n\\n function setKeep3rHelper(address _keep3rHelper) external;\\n\\n function setGovernance(address _governance) external;\\n\\n function acceptGovernance() external;\\n\\n function isKeeper(address _keeper) external returns (bool);\\n\\n function isMinKeeper(\\n address _keeper,\\n uint256 _minBond,\\n uint256 _earned,\\n uint256 _age\\n ) external returns (bool);\\n\\n function isBondedKeeper(\\n address _keeper,\\n address _bond,\\n uint256 _minBond,\\n uint256 _earned,\\n uint256 _age\\n ) external returns (bool);\\n\\n function bond(address _bonding, uint256 _amount) external;\\n\\n function getKeepers() external view returns (address[] memory);\\n\\n function activate(address _bonding) external;\\n\\n function unbond(address _bonding, uint256 _amount) external;\\n\\n function slash(\\n address _bonded,\\n address _keeper,\\n uint256 _amount\\n ) external;\\n\\n function withdraw(address _bonding) external;\\n\\n function dispute(address _keeper) external;\\n\\n function revoke(address _keeper) external;\\n\\n function resolve(address _keeper) external;\\n\\n function permit(\\n address _owner,\\n address _spender,\\n uint256 _amount,\\n uint256 _deadline,\\n uint8 _v,\\n bytes32 _r,\\n bytes32 _s\\n ) external;\\n}\\n\",\"keccak256\":\"0xa9806cd6666ab1b7375ef72446964a72397fd4cefc7cc8c5b37caa7c50df0246\",\"license\":\"MIT\"},\"solidity/interfaces/peripherals/IBaseErrors.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity >=0.8.4 <0.9.0;\\n\\ninterface IBaseErrors {\\n /// @notice Throws if a variable is assigned to the zero address\\n error ZeroAddress();\\n}\\n\",\"keccak256\":\"0x9130019a08d9eaedfb920a323fed5c7f409736cd918f1a32921c93551b3ee00e\",\"license\":\"MIT\"},\"solidity/interfaces/peripherals/IDustCollector.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity >=0.8.4 <0.9.0;\\n\\nimport './IBaseErrors.sol';\\n\\ninterface IDustCollector is IBaseErrors {\\n /// @notice Emitted when dust is sent\\n /// @param _token The token that will be transferred\\n /// @param _amount The amount of the token that will be transferred\\n /// @param _to The address which will receive the funds\\n event DustSent(address _token, uint256 _amount, address _to);\\n\\n /// @notice Allows an authorized user to transfer the tokens or eth that may have been left in a contract\\n /// @param _token The token that will be transferred\\n /// @param _amount The amount of the token that will be transferred\\n /// @param _to The address that will receive the idle funds\\n function sendDust(\\n address _token,\\n uint256 _amount,\\n address _to\\n ) external;\\n}\\n\",\"keccak256\":\"0x38dce228111f2a3c6b26ac09c5652c3f1f184c4cfe50d11ff0958ef6a50683bb\",\"license\":\"MIT\"},\"solidity/interfaces/peripherals/IGovernable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4 <0.9.0;\\n\\n/// @title Governable contract\\n/// @notice Manages the governance role\\ninterface IGovernable {\\n // Events\\n\\n /// @notice Emitted when pendingGovernance accepts to be governance\\n /// @param _governance Address of the new governance\\n event GovernanceSet(address _governance);\\n\\n /// @notice Emitted when a new governance is proposed\\n /// @param _pendingGovernance Address that is proposed to be the new governance\\n event GovernanceProposal(address _pendingGovernance);\\n\\n // Errors\\n\\n /// @notice Throws if the caller of the function is not governance\\n error OnlyGovernance();\\n\\n /// @notice Throws if the caller of the function is not pendingGovernance\\n error OnlyPendingGovernance();\\n\\n /// @notice Throws if trying to set governance to zero address\\n error NoGovernanceZeroAddress();\\n\\n // Variables\\n\\n /// @notice Stores the governance address\\n /// @return _governance The governance addresss\\n function governance() external view returns (address _governance);\\n\\n /// @notice Stores the pendingGovernance address\\n /// @return _pendingGovernance The pendingGovernance addresss\\n function pendingGovernance() external view returns (address _pendingGovernance);\\n\\n // Methods\\n\\n /// @notice Proposes a new address to be governance\\n /// @param _governance The address being proposed as the new governance\\n function setGovernance(address _governance) external;\\n\\n /// @notice Changes the governance from the current governance to the previously proposed address\\n function acceptGovernance() external;\\n}\\n\",\"keccak256\":\"0x3284624b2479bbf97c821f37c93a096dcb869b30bbf9b20d30d1800f9535452c\",\"license\":\"MIT\"},\"solidity/interfaces/peripherals/IKeep3rAccountance.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4 <0.9.0;\\n\\nimport './IKeep3rRoles.sol';\\n\\n/// @title Keep3rDisputable contract\\n/// @notice Disputes keepers, or if they're already disputed, it can resolve the case\\n/// @dev Argument `bonding` can be the address of either a token or a liquidity\\ninterface IKeep3rAccountance is IKeep3rRoles {\\n // Events\\n\\n /// @notice Emitted when the bonding process of a new keeper begins\\n /// @param _keeper The caller of Keep3rKeeperFundable#bond function\\n /// @param _bonding The asset the keeper has bonded\\n /// @param _amount The amount the keeper has bonded\\n event Bonding(address indexed _keeper, address indexed _bonding, uint256 _amount);\\n\\n /// @notice Emitted when a keeper or job begins the unbonding process to withdraw the funds\\n /// @param _keeperOrJob The keeper or job that began the unbonding process\\n /// @param _unbonding The liquidity pair or asset being unbonded\\n /// @param _amount The amount being unbonded\\n event Unbonding(address indexed _keeperOrJob, address indexed _unbonding, uint256 _amount);\\n\\n // Variables\\n\\n /// @notice Tracks the total amount of bonded KP3Rs in the contract\\n /// @return _totalBonds The total amount of bonded KP3Rs in the contract\\n function totalBonds() external view returns (uint256 _totalBonds);\\n\\n /// @notice Tracks the total KP3R earnings of a keeper since it started working\\n /// @param _keeper The address of the keeper\\n /// @return _workCompleted Total KP3R earnings of a keeper since it started working\\n function workCompleted(address _keeper) external view returns (uint256 _workCompleted);\\n\\n /// @notice Tracks when a keeper was first registered\\n /// @param _keeper The address of the keeper\\n /// @return timestamp The time at which the keeper was first registered\\n function firstSeen(address _keeper) external view returns (uint256 timestamp);\\n\\n /// @notice Tracks if a keeper or job has a pending dispute\\n /// @param _keeperOrJob The address of the keeper or job\\n /// @return _disputed Whether a keeper or job has a pending dispute\\n function disputes(address _keeperOrJob) external view returns (bool _disputed);\\n\\n /// @notice Tracks how much a keeper has bonded of a certain token\\n /// @param _keeper The address of the keeper\\n /// @param _bond The address of the token being bonded\\n /// @return _bonds Amount of a certain token that a keeper has bonded\\n function bonds(address _keeper, address _bond) external view returns (uint256 _bonds);\\n\\n /// @notice The current token credits available for a job\\n /// @param _job The address of the job\\n /// @param _token The address of the token bonded\\n /// @return _amount The amount of token credits available for a job\\n function jobTokenCredits(address _job, address _token) external view returns (uint256 _amount);\\n\\n /// @notice Tracks the amount of assets deposited in pending bonds\\n /// @param _keeper The address of the keeper\\n /// @param _bonding The address of the token being bonded\\n /// @return _pendingBonds Amount of a certain asset a keeper has unbonding\\n function pendingBonds(address _keeper, address _bonding) external view returns (uint256 _pendingBonds);\\n\\n /// @notice Tracks when a bonding for a keeper can be activated\\n /// @param _keeper The address of the keeper\\n /// @param _bonding The address of the token being bonded\\n /// @return _timestamp Time at which the bonding for a keeper can be activated\\n function canActivateAfter(address _keeper, address _bonding) external view returns (uint256 _timestamp);\\n\\n /// @notice Tracks when keeper bonds are ready to be withdrawn\\n /// @param _keeper The address of the keeper\\n /// @param _bonding The address of the token being unbonded\\n /// @return _timestamp Time at which the keeper bonds are ready to be withdrawn\\n function canWithdrawAfter(address _keeper, address _bonding) external view returns (uint256 _timestamp);\\n\\n /// @notice Tracks how much keeper bonds are to be withdrawn\\n /// @param _keeper The address of the keeper\\n /// @param _bonding The address of the token being unbonded\\n /// @return _pendingUnbonds The amount of keeper bonds that are to be withdrawn\\n function pendingUnbonds(address _keeper, address _bonding) external view returns (uint256 _pendingUnbonds);\\n\\n /// @notice Checks whether the address has ever bonded an asset\\n /// @param _keeper The address of the keeper\\n /// @return _hasBonded Whether the address has ever bonded an asset\\n function hasBonded(address _keeper) external view returns (bool _hasBonded);\\n\\n // Methods\\n\\n /// @notice Lists all jobs\\n /// @return _jobList Array with all the jobs in _jobs\\n function jobs() external view returns (address[] memory _jobList);\\n\\n /// @notice Lists all keepers\\n /// @return _keeperList Array with all the keepers in _keepers\\n function keepers() external view returns (address[] memory _keeperList);\\n\\n // Errors\\n\\n /// @notice Throws when an address is passed as a job, but that address is not a job\\n error JobUnavailable();\\n\\n /// @notice Throws when an action that requires an undisputed job is applied on a disputed job\\n error JobDisputed();\\n}\\n\",\"keccak256\":\"0xf4748c236ddf409e45e7169c735e2fc54e627b2b3ccd189ebb438ad768f1deb1\",\"license\":\"MIT\"},\"solidity/interfaces/peripherals/IKeep3rDisputable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4 <0.9.0;\\n\\n/// @title Keep3rDisputable contract\\n/// @notice Creates/resolves disputes for jobs or keepers\\n/// A disputed keeper is slashable and is not able to bond, activate, withdraw or receive direct payments\\n/// A disputed job is slashable and is not able to pay the keepers, withdraw tokens or to migrate\\ninterface IKeep3rDisputable {\\n /// @notice Emitted when a keeper or a job is disputed\\n /// @param _jobOrKeeper The address of the disputed keeper/job\\n /// @param _disputer The user that called the function and disputed the keeper\\n event Dispute(address indexed _jobOrKeeper, address indexed _disputer);\\n\\n /// @notice Emitted when a dispute is resolved\\n /// @param _jobOrKeeper The address of the disputed keeper/job\\n /// @param _resolver The user that called the function and resolved the dispute\\n event Resolve(address indexed _jobOrKeeper, address indexed _resolver);\\n\\n /// @notice Throws when a job or keeper is already disputed\\n error AlreadyDisputed();\\n\\n /// @notice Throws when a job or keeper is not disputed and someone tries to resolve the dispute\\n error NotDisputed();\\n\\n /// @notice Allows governance to create a dispute for a given keeper/job\\n /// @param _jobOrKeeper The address in dispute\\n function dispute(address _jobOrKeeper) external;\\n\\n /// @notice Allows governance to resolve a dispute on a keeper/job\\n /// @param _jobOrKeeper The address cleared\\n function resolve(address _jobOrKeeper) external;\\n}\\n\",\"keccak256\":\"0x002b9b4c75e62d48d74b6447649d39eb5c1e128d2523bb11e08e9cd3e27b1f70\",\"license\":\"MIT\"},\"solidity/interfaces/peripherals/IKeep3rJobs.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4 <0.9.0;\\n\\nimport './IKeep3rDisputable.sol';\\n\\n/// @title Keep3rJobOwnership contract\\n/// @notice Handles the ownership of the jobs\\ninterface IKeep3rJobOwnership {\\n // Events\\n\\n /// @notice Emitted when Keep3rJobOwnership#changeJobOwnership is called\\n /// @param _job The address of the job proposed to have a change of owner\\n /// @param _owner The current owner of the job\\n /// @param _pendingOwner The new address proposed to be the owner of the job\\n event JobOwnershipChange(address indexed _job, address indexed _owner, address indexed _pendingOwner);\\n\\n /// @notice Emitted when Keep3rJobOwnership#JobOwnershipAssent is called\\n /// @param _job The address of the job which the proposed owner will now own\\n /// @param _previousOwner The previous owner of the job\\n /// @param _newOwner The new owner of the job\\n event JobOwnershipAssent(address indexed _job, address indexed _previousOwner, address indexed _newOwner);\\n\\n // Errors\\n\\n /// @notice Throws when the caller of the function is not the job owner\\n error OnlyJobOwner();\\n\\n /// @notice Throws when the caller of the function is not the pending job owner\\n error OnlyPendingJobOwner();\\n\\n // Variables\\n\\n /// @notice Maps the job to the owner of the job\\n /// @param _job The address of the job\\n /// @return _owner The address of the owner of the job\\n function jobOwner(address _job) external view returns (address _owner);\\n\\n /// @notice Maps the job to its pending owner\\n /// @param _job The address of the job\\n /// @return _pendingOwner The address of the pending owner of the job\\n function jobPendingOwner(address _job) external view returns (address _pendingOwner);\\n\\n // Methods\\n\\n /// @notice Proposes a new address to be the owner of the job\\n /// @param _job The address of the job\\n /// @param _newOwner The address of the proposed new owner\\n function changeJobOwnership(address _job, address _newOwner) external;\\n\\n /// @notice The proposed address accepts to be the owner of the job\\n /// @param _job The address of the job\\n function acceptJobOwnership(address _job) external;\\n}\\n\\n/// @title Keep3rJobManager contract\\n/// @notice Handles the addition and withdrawal of credits from a job\\ninterface IKeep3rJobManager is IKeep3rJobOwnership {\\n // Events\\n\\n /// @notice Emitted when Keep3rJobManager#addJob is called\\n /// @param _job The address of the job to add\\n /// @param _jobOwner The job's owner\\n event JobAddition(address indexed _job, address indexed _jobOwner);\\n\\n // Errors\\n\\n /// @notice Throws when trying to add a job that has already been added\\n error JobAlreadyAdded();\\n\\n /// @notice Throws when the address that is trying to register as a keeper is already a keeper\\n error AlreadyAKeeper();\\n\\n // Methods\\n\\n /// @notice Allows any caller to add a new job\\n /// @param _job Address of the contract for which work should be performed\\n function addJob(address _job) external;\\n}\\n\\n/// @title Keep3rJobFundableCredits contract\\n/// @notice Handles the addition and withdrawal of credits from a job\\ninterface IKeep3rJobFundableCredits is IKeep3rJobOwnership {\\n // Events\\n\\n /// @notice Emitted when Keep3rJobFundableCredits#addTokenCreditsToJob is called\\n /// @param _job The address of the job being credited\\n /// @param _token The address of the token being provided\\n /// @param _provider The user that calls the function\\n /// @param _amount The amount of credit being added to the job\\n event TokenCreditAddition(address indexed _job, address indexed _token, address indexed _provider, uint256 _amount);\\n\\n /// @notice Emitted when Keep3rJobFundableCredits#withdrawTokenCreditsFromJob is called\\n /// @param _job The address of the job from which the credits are withdrawn\\n /// @param _token The credit being withdrawn from the job\\n /// @param _receiver The user that receives the tokens\\n /// @param _amount The amount of credit withdrawn\\n event TokenCreditWithdrawal(address indexed _job, address indexed _token, address indexed _receiver, uint256 _amount);\\n\\n // Errors\\n\\n /// @notice Throws when the token is KP3R, as it should not be used for direct token payments\\n error TokenUnallowed();\\n\\n /// @notice Throws when the token withdraw cooldown has not yet passed\\n error JobTokenCreditsLocked();\\n\\n /// @notice Throws when the user tries to withdraw more tokens than it has\\n error InsufficientJobTokenCredits();\\n\\n // Variables\\n\\n /// @notice Last block where tokens were added to the job\\n /// @param _job The address of the job credited\\n /// @param _token The address of the token credited\\n /// @return _timestamp The last block where tokens were added to the job\\n function jobTokenCreditsAddedAt(address _job, address _token) external view returns (uint256 _timestamp);\\n\\n // Methods\\n\\n /// @notice Add credit to a job to be paid out for work\\n /// @param _job The address of the job being credited\\n /// @param _token The address of the token being credited\\n /// @param _amount The amount of credit being added\\n function addTokenCreditsToJob(\\n address _job,\\n address _token,\\n uint256 _amount\\n ) external;\\n\\n /// @notice Withdraw credit from a job\\n /// @param _job The address of the job from which the credits are withdrawn\\n /// @param _token The address of the token being withdrawn\\n /// @param _amount The amount of token to be withdrawn\\n /// @param _receiver The user that will receive tokens\\n function withdrawTokenCreditsFromJob(\\n address _job,\\n address _token,\\n uint256 _amount,\\n address _receiver\\n ) external;\\n}\\n\\n/// @title Keep3rJobFundableLiquidity contract\\n/// @notice Handles the funding of jobs through specific liquidity pairs\\ninterface IKeep3rJobFundableLiquidity is IKeep3rJobOwnership {\\n // Events\\n\\n /// @notice Emitted when Keep3rJobFundableLiquidity#approveLiquidity function is called\\n /// @param _liquidity The address of the liquidity pair being approved\\n event LiquidityApproval(address _liquidity);\\n\\n /// @notice Emitted when Keep3rJobFundableLiquidity#revokeLiquidity function is called\\n /// @param _liquidity The address of the liquidity pair being revoked\\n event LiquidityRevocation(address _liquidity);\\n\\n /// @notice Emitted when IKeep3rJobFundableLiquidity#addLiquidityToJob function is called\\n /// @param _job The address of the job to which liquidity will be added\\n /// @param _liquidity The address of the liquidity being added\\n /// @param _provider The user that calls the function\\n /// @param _amount The amount of liquidity being added\\n event LiquidityAddition(address indexed _job, address indexed _liquidity, address indexed _provider, uint256 _amount);\\n\\n /// @notice Emitted when IKeep3rJobFundableLiquidity#withdrawLiquidityFromJob function is called\\n /// @param _job The address of the job of which liquidity will be withdrawn from\\n /// @param _liquidity The address of the liquidity being withdrawn\\n /// @param _receiver The receiver of the liquidity tokens\\n /// @param _amount The amount of liquidity being withdrawn from the job\\n event LiquidityWithdrawal(address indexed _job, address indexed _liquidity, address indexed _receiver, uint256 _amount);\\n\\n /// @notice Emitted when Keep3rJobFundableLiquidity#addLiquidityToJob function is called\\n /// @param _job The address of the job whose credits will be updated\\n /// @param _rewardedAt The time at which the job was last rewarded\\n /// @param _currentCredits The current credits of the job\\n /// @param _periodCredits The credits of the job for the current period\\n event LiquidityCreditsReward(address indexed _job, uint256 _rewardedAt, uint256 _currentCredits, uint256 _periodCredits);\\n\\n /// @notice Emitted when Keep3rJobFundableLiquidity#forceLiquidityCreditsToJob function is called\\n /// @param _job The address of the job whose credits will be updated\\n /// @param _rewardedAt The time at which the job was last rewarded\\n /// @param _currentCredits The current credits of the job\\n event LiquidityCreditsForced(address indexed _job, uint256 _rewardedAt, uint256 _currentCredits);\\n\\n // Errors\\n\\n /// @notice Throws when the liquidity being approved has already been approved\\n error LiquidityPairApproved();\\n\\n /// @notice Throws when the liquidity being removed has not been approved\\n error LiquidityPairUnexistent();\\n\\n /// @notice Throws when trying to add liquidity to an unapproved pool\\n error LiquidityPairUnapproved();\\n\\n /// @notice Throws when the job doesn't have the requested liquidity\\n error JobLiquidityUnexistent();\\n\\n /// @notice Throws when trying to remove more liquidity than the job has\\n error JobLiquidityInsufficient();\\n\\n /// @notice Throws when trying to add less liquidity than the minimum liquidity required\\n error JobLiquidityLessThanMin();\\n\\n // Structs\\n\\n /// @notice Stores the tick information of the different liquidity pairs\\n struct TickCache {\\n int56 current; // Tracks the current tick\\n int56 difference; // Stores the difference between the current tick and the last tick\\n uint256 period; // Stores the period at which the last observation was made\\n }\\n\\n // Variables\\n\\n /// @notice Lists liquidity pairs\\n /// @return _list An array of addresses with all the approved liquidity pairs\\n function approvedLiquidities() external view returns (address[] memory _list);\\n\\n /// @notice Amount of liquidity in a specified job\\n /// @param _job The address of the job being checked\\n /// @param _liquidity The address of the liquidity we are checking\\n /// @return _amount Amount of liquidity in the specified job\\n function liquidityAmount(address _job, address _liquidity) external view returns (uint256 _amount);\\n\\n /// @notice Last time the job was rewarded liquidity credits\\n /// @param _job The address of the job being checked\\n /// @return _timestamp Timestamp of the last time the job was rewarded liquidity credits\\n function rewardedAt(address _job) external view returns (uint256 _timestamp);\\n\\n /// @notice Last time the job was worked\\n /// @param _job The address of the job being checked\\n /// @return _timestamp Timestamp of the last time the job was worked\\n function workedAt(address _job) external view returns (uint256 _timestamp);\\n\\n // Methods\\n\\n /// @notice Returns the liquidity credits of a given job\\n /// @param _job The address of the job of which we want to know the liquidity credits\\n /// @return _amount The liquidity credits of a given job\\n function jobLiquidityCredits(address _job) external view returns (uint256 _amount);\\n\\n /// @notice Returns the credits of a given job for the current period\\n /// @param _job The address of the job of which we want to know the period credits\\n /// @return _amount The credits the given job has at the current period\\n function jobPeriodCredits(address _job) external view returns (uint256 _amount);\\n\\n /// @notice Calculates the total credits of a given job\\n /// @param _job The address of the job of which we want to know the total credits\\n /// @return _amount The total credits of the given job\\n function totalJobCredits(address _job) external view returns (uint256 _amount);\\n\\n /// @notice Calculates how many credits should be rewarded periodically for a given liquidity amount\\n /// @dev _periodCredits = underlying KP3Rs for given liquidity amount * rewardPeriod / inflationPeriod\\n /// @param _liquidity The address of the liquidity to provide\\n /// @param _amount The amount of liquidity to provide\\n /// @return _periodCredits The amount of KP3R periodically minted for the given liquidity\\n function quoteLiquidity(address _liquidity, uint256 _amount) external view returns (uint256 _periodCredits);\\n\\n /// @notice Observes the current state of the liquidity pair being observed and updates TickCache with the information\\n /// @param _liquidity The address of the liquidity pair being observed\\n /// @return _tickCache The updated TickCache\\n function observeLiquidity(address _liquidity) external view returns (TickCache memory _tickCache);\\n\\n /// @notice Gifts liquidity credits to the specified job\\n /// @param _job The address of the job being credited\\n /// @param _amount The amount of liquidity credits to gift\\n function forceLiquidityCreditsToJob(address _job, uint256 _amount) external;\\n\\n /// @notice Approve a liquidity pair for being accepted in future\\n /// @param _liquidity The address of the liquidity accepted\\n function approveLiquidity(address _liquidity) external;\\n\\n /// @notice Revoke a liquidity pair from being accepted in future\\n /// @param _liquidity The liquidity no longer accepted\\n function revokeLiquidity(address _liquidity) external;\\n\\n /// @notice Allows anyone to fund a job with liquidity\\n /// @param _job The address of the job to assign liquidity to\\n /// @param _liquidity The liquidity being added\\n /// @param _amount The amount of liquidity tokens to add\\n function addLiquidityToJob(\\n address _job,\\n address _liquidity,\\n uint256 _amount\\n ) external;\\n\\n /// @notice Unbond liquidity for a job\\n /// @dev Can only be called by the job's owner\\n /// @param _job The address of the job being unbonded from\\n /// @param _liquidity The liquidity being unbonded\\n /// @param _amount The amount of liquidity being removed\\n function unbondLiquidityFromJob(\\n address _job,\\n address _liquidity,\\n uint256 _amount\\n ) external;\\n\\n /// @notice Withdraw liquidity from a job\\n /// @param _job The address of the job being withdrawn from\\n /// @param _liquidity The liquidity being withdrawn\\n /// @param _receiver The address that will receive the withdrawn liquidity\\n function withdrawLiquidityFromJob(\\n address _job,\\n address _liquidity,\\n address _receiver\\n ) external;\\n}\\n\\n/// @title Keep3rJobMigration contract\\n/// @notice Handles the migration process of jobs to different addresses\\ninterface IKeep3rJobMigration is IKeep3rJobFundableCredits, IKeep3rJobFundableLiquidity {\\n // Events\\n\\n /// @notice Emitted when Keep3rJobMigration#migrateJob function is called\\n /// @param _fromJob The address of the job that requests to migrate\\n /// @param _toJob The address at which the job requests to migrate\\n event JobMigrationRequested(address indexed _fromJob, address _toJob);\\n\\n /// @notice Emitted when Keep3rJobMigration#acceptJobMigration function is called\\n /// @param _fromJob The address of the job that requested to migrate\\n /// @param _toJob The address at which the job had requested to migrate\\n event JobMigrationSuccessful(address _fromJob, address indexed _toJob);\\n\\n // Errors\\n\\n /// @notice Throws when the address of the job that requests to migrate wants to migrate to its same address\\n error JobMigrationImpossible();\\n\\n /// @notice Throws when the _toJob address differs from the address being tracked in the pendingJobMigrations mapping\\n error JobMigrationUnavailable();\\n\\n /// @notice Throws when cooldown between migrations has not yet passed\\n error JobMigrationLocked();\\n\\n // Variables\\n\\n /// @notice Maps the jobs that have requested a migration to the address they have requested to migrate to\\n /// @return _toJob The address to which the job has requested to migrate to\\n function pendingJobMigrations(address _fromJob) external view returns (address _toJob);\\n\\n // Methods\\n\\n /// @notice Initializes the migration process for a job by adding the request to the pendingJobMigrations mapping\\n /// @param _fromJob The address of the job that is requesting to migrate\\n /// @param _toJob The address at which the job is requesting to migrate\\n function migrateJob(address _fromJob, address _toJob) external;\\n\\n /// @notice Completes the migration process for a job\\n /// @dev Unbond/withdraw process doesn't get migrated\\n /// @param _fromJob The address of the job that requested to migrate\\n /// @param _toJob The address to which the job wants to migrate to\\n function acceptJobMigration(address _fromJob, address _toJob) external;\\n}\\n\\n/// @title Keep3rJobWorkable contract\\n/// @notice Handles the mechanisms jobs can pay keepers with along with the restrictions jobs can put on keepers before they can work on jobs\\ninterface IKeep3rJobWorkable is IKeep3rJobMigration {\\n // Events\\n\\n /// @notice Emitted when a keeper is validated before a job\\n /// @param _gasLeft The amount of gas that the transaction has left at the moment of keeper validation\\n event KeeperValidation(uint256 _gasLeft);\\n\\n /// @notice Emitted when a keeper works a job\\n /// @param _credit The address of the asset in which the keeper is paid\\n /// @param _job The address of the job the keeper has worked\\n /// @param _keeper The address of the keeper that has worked the job\\n /// @param _payment The amount that has been paid out to the keeper in exchange for working the job\\n /// @param _gasLeft The amount of gas that the transaction has left at the moment of payment\\n event KeeperWork(address indexed _credit, address indexed _job, address indexed _keeper, uint256 _payment, uint256 _gasLeft);\\n\\n // Errors\\n\\n /// @notice Throws if work method was called without calling isKeeper or isBondedKeeper\\n error GasNotInitialized();\\n\\n /// @notice Throws if the address claiming to be a job is not in the list of approved jobs\\n error JobUnapproved();\\n\\n /// @notice Throws if the amount of funds in the job is less than the payment that must be paid to the keeper that works that job\\n error InsufficientFunds();\\n\\n // Methods\\n\\n /// @notice Confirms if the current keeper is registered\\n /// @dev Can be used for general (non critical) functions\\n /// @param _keeper The keeper being investigated\\n /// @return _isKeeper Whether the address passed as a parameter is a keeper or not\\n function isKeeper(address _keeper) external returns (bool _isKeeper);\\n\\n /// @notice Confirms if the current keeper is registered and has a minimum bond of any asset.\\n /// @dev Should be used for protected functions\\n /// @param _keeper The keeper to check\\n /// @param _bond The bond token being evaluated\\n /// @param _minBond The minimum amount of bonded tokens\\n /// @param _earned The minimum funds earned in the keepers lifetime\\n /// @param _age The minimum keeper age required\\n /// @return _isBondedKeeper Whether the `_keeper` meets the given requirements\\n function isBondedKeeper(\\n address _keeper,\\n address _bond,\\n uint256 _minBond,\\n uint256 _earned,\\n uint256 _age\\n ) external returns (bool _isBondedKeeper);\\n\\n /// @notice Implemented by jobs to show that a keeper performed work\\n /// @dev Automatically calculates the payment for the keeper and pays the keeper with bonded KP3R\\n /// @param _keeper Address of the keeper that performed the work\\n function worked(address _keeper) external;\\n\\n /// @notice Implemented by jobs to show that a keeper performed work\\n /// @dev Pays the keeper that performs the work with KP3R\\n /// @param _keeper Address of the keeper that performed the work\\n /// @param _payment The reward that should be allocated for the job\\n function bondedPayment(address _keeper, uint256 _payment) external;\\n\\n /// @notice Implemented by jobs to show that a keeper performed work\\n /// @dev Pays the keeper that performs the work with a specific token\\n /// @param _token The asset being awarded to the keeper\\n /// @param _keeper Address of the keeper that performed the work\\n /// @param _amount The reward that should be allocated\\n function directTokenPayment(\\n address _token,\\n address _keeper,\\n uint256 _amount\\n ) external;\\n}\\n\\n/// @title Keep3rJobDisputable contract\\n/// @notice Handles the actions that can be taken on a disputed job\\ninterface IKeep3rJobDisputable is IKeep3rDisputable, IKeep3rJobFundableCredits, IKeep3rJobFundableLiquidity {\\n // Events\\n\\n /// @notice Emitted when Keep3rJobDisputable#slashTokenFromJob is called\\n /// @param _job The address of the job from which the token will be slashed\\n /// @param _token The address of the token being slashed\\n /// @param _slasher The user that slashes the token\\n /// @param _amount The amount of the token being slashed\\n event JobSlashToken(address indexed _job, address _token, address indexed _slasher, uint256 _amount);\\n\\n /// @notice Emitted when Keep3rJobDisputable#slashLiquidityFromJob is called\\n /// @param _job The address of the job from which the liquidity will be slashed\\n /// @param _liquidity The address of the liquidity being slashed\\n /// @param _slasher The user that slashes the liquidity\\n /// @param _amount The amount of the liquidity being slashed\\n event JobSlashLiquidity(address indexed _job, address _liquidity, address indexed _slasher, uint256 _amount);\\n\\n // Errors\\n\\n /// @notice Throws when the token trying to be slashed doesn't exist\\n error JobTokenUnexistent();\\n\\n /// @notice Throws when someone tries to slash more tokens than the job has\\n error JobTokenInsufficient();\\n\\n // Methods\\n\\n /// @notice Allows governance or slasher to slash a job specific token\\n /// @param _job The address of the job from which the token will be slashed\\n /// @param _token The address of the token that will be slashed\\n /// @param _amount The amount of the token that will be slashed\\n function slashTokenFromJob(\\n address _job,\\n address _token,\\n uint256 _amount\\n ) external;\\n\\n /// @notice Allows governance or a slasher to slash liquidity from a job\\n /// @param _job The address being slashed\\n /// @param _liquidity The address of the liquidity that will be slashed\\n /// @param _amount The amount of liquidity that will be slashed\\n function slashLiquidityFromJob(\\n address _job,\\n address _liquidity,\\n uint256 _amount\\n ) external;\\n}\\n\\n// solhint-disable-next-line no-empty-blocks\\ninterface IKeep3rJobs is IKeep3rJobWorkable, IKeep3rJobManager, IKeep3rJobDisputable {\\n\\n}\\n\",\"keccak256\":\"0x08915189f1a9484d17a51b7fb343b765b9edba29062bb644af9663af18f03e34\",\"license\":\"MIT\"},\"solidity/interfaces/peripherals/IKeep3rKeepers.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4 <0.9.0;\\n\\nimport './IKeep3rDisputable.sol';\\n\\n/// @title Keep3rKeeperFundable contract\\n/// @notice Handles the actions required to become a keeper\\ninterface IKeep3rKeeperFundable {\\n // Events\\n\\n /// @notice Emitted when Keep3rKeeperFundable#activate is called\\n /// @param _keeper The keeper that has been activated\\n /// @param _bond The asset the keeper has bonded\\n /// @param _amount The amount of the asset the keeper has bonded\\n event Activation(address indexed _keeper, address indexed _bond, uint256 _amount);\\n\\n /// @notice Emitted when Keep3rKeeperFundable#withdraw is called\\n /// @param _keeper The caller of Keep3rKeeperFundable#withdraw function\\n /// @param _bond The asset to withdraw from the bonding pool\\n /// @param _amount The amount of funds withdrawn\\n event Withdrawal(address indexed _keeper, address indexed _bond, uint256 _amount);\\n\\n // Errors\\n\\n /// @notice Throws when the address that is trying to register as a job is already a job\\n error AlreadyAJob();\\n\\n // Methods\\n\\n /// @notice Beginning of the bonding process\\n /// @param _bonding The asset being bonded\\n /// @param _amount The amount of bonding asset being bonded\\n function bond(address _bonding, uint256 _amount) external;\\n\\n /// @notice Beginning of the unbonding process\\n /// @param _bonding The asset being unbonded\\n /// @param _amount Allows for partial unbonding\\n function unbond(address _bonding, uint256 _amount) external;\\n\\n /// @notice End of the bonding process after bonding time has passed\\n /// @param _bonding The asset being activated as bond collateral\\n function activate(address _bonding) external;\\n\\n /// @notice Withdraw funds after unbonding has finished\\n /// @param _bonding The asset to withdraw from the bonding pool\\n function withdraw(address _bonding) external;\\n}\\n\\n/// @title Keep3rKeeperDisputable contract\\n/// @notice Handles the actions that can be taken on a disputed keeper\\ninterface IKeep3rKeeperDisputable is IKeep3rDisputable, IKeep3rKeeperFundable {\\n // Events\\n\\n /// @notice Emitted when Keep3rKeeperDisputable#slash is called\\n /// @param _keeper The address of the slashed keeper\\n /// @param _slasher The user that called Keep3rKeeperDisputable#slash\\n /// @param _amount The amount of credits slashed from the keeper\\n event KeeperSlash(address indexed _keeper, address indexed _slasher, uint256 _amount);\\n\\n /// @notice Emitted when Keep3rKeeperDisputable#revoke is called\\n /// @param _keeper The address of the revoked keeper\\n /// @param _slasher The user that called Keep3rKeeperDisputable#revoke\\n event KeeperRevoke(address indexed _keeper, address indexed _slasher);\\n\\n // Methods\\n\\n /// @notice Allows governance to slash a keeper based on a dispute\\n /// @param _keeper The address being slashed\\n /// @param _bonded The asset being slashed\\n /// @param _bondAmount The bonded amount being slashed\\n /// @param _unbondAmount The pending unbond amount being slashed\\n function slash(\\n address _keeper,\\n address _bonded,\\n uint256 _bondAmount,\\n uint256 _unbondAmount\\n ) external;\\n\\n /// @notice Blacklists a keeper from participating in the network\\n /// @param _keeper The address being slashed\\n function revoke(address _keeper) external;\\n}\\n\\n// solhint-disable-next-line no-empty-blocks\\n\\n/// @title Keep3rKeepers contract\\ninterface IKeep3rKeepers is IKeep3rKeeperDisputable {\\n\\n}\\n\",\"keccak256\":\"0xc95e6bba82a8371c6bd15a8e9d0df91c826b5050b8ee01d913c1c13a4e92a49b\",\"license\":\"MIT\"},\"solidity/interfaces/peripherals/IKeep3rParameters.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4 <0.9.0;\\n\\nimport './IKeep3rAccountance.sol';\\n\\n/// @title Keep3rParameters contract\\n/// @notice Handles and sets all the required parameters for Keep3r\\ninterface IKeep3rParameters is IKeep3rAccountance {\\n // Events\\n\\n /// @notice Emitted when the Keep3rHelper address is changed\\n /// @param _keep3rHelper The address of Keep3rHelper's contract\\n event Keep3rHelperChange(address _keep3rHelper);\\n\\n /// @notice Emitted when the Keep3rV1 address is changed\\n /// @param _keep3rV1 The address of Keep3rV1's contract\\n event Keep3rV1Change(address _keep3rV1);\\n\\n /// @notice Emitted when the Keep3rV1Proxy address is changed\\n /// @param _keep3rV1Proxy The address of Keep3rV1Proxy's contract\\n event Keep3rV1ProxyChange(address _keep3rV1Proxy);\\n\\n /// @notice Emitted when bondTime is changed\\n /// @param _bondTime The new bondTime\\n event BondTimeChange(uint256 _bondTime);\\n\\n /// @notice Emitted when _liquidityMinimum is changed\\n /// @param _liquidityMinimum The new _liquidityMinimum\\n event LiquidityMinimumChange(uint256 _liquidityMinimum);\\n\\n /// @notice Emitted when _unbondTime is changed\\n /// @param _unbondTime The new _unbondTime\\n event UnbondTimeChange(uint256 _unbondTime);\\n\\n /// @notice Emitted when _rewardPeriodTime is changed\\n /// @param _rewardPeriodTime The new _rewardPeriodTime\\n event RewardPeriodTimeChange(uint256 _rewardPeriodTime);\\n\\n /// @notice Emitted when the inflationPeriod is changed\\n /// @param _inflationPeriod The new inflationPeriod\\n event InflationPeriodChange(uint256 _inflationPeriod);\\n\\n /// @notice Emitted when the fee is changed\\n /// @param _fee The new token credits fee\\n event FeeChange(uint256 _fee);\\n\\n // Variables\\n\\n /// @notice Address of Keep3rHelper's contract\\n /// @return _keep3rHelper The address of Keep3rHelper's contract\\n function keep3rHelper() external view returns (address _keep3rHelper);\\n\\n /// @notice Address of Keep3rV1's contract\\n /// @return _keep3rV1 The address of Keep3rV1's contract\\n function keep3rV1() external view returns (address _keep3rV1);\\n\\n /// @notice Address of Keep3rV1Proxy's contract\\n /// @return _keep3rV1Proxy The address of Keep3rV1Proxy's contract\\n function keep3rV1Proxy() external view returns (address _keep3rV1Proxy);\\n\\n /// @notice The amount of time required to pass after a keeper has bonded assets for it to be able to activate\\n /// @return _days The required bondTime in days\\n function bondTime() external view returns (uint256 _days);\\n\\n /// @notice The amount of time required to pass before a keeper can unbond what he has bonded\\n /// @return _days The required unbondTime in days\\n function unbondTime() external view returns (uint256 _days);\\n\\n /// @notice The minimum amount of liquidity required to fund a job per liquidity\\n /// @return _amount The minimum amount of liquidity in KP3R\\n function liquidityMinimum() external view returns (uint256 _amount);\\n\\n /// @notice The amount of time between each scheduled credits reward given to a job\\n /// @return _days The reward period in days\\n function rewardPeriodTime() external view returns (uint256 _days);\\n\\n /// @notice The inflation period is the denominator used to regulate the emission of KP3R\\n /// @return _period The denominator used to regulate the emission of KP3R\\n function inflationPeriod() external view returns (uint256 _period);\\n\\n /// @notice The fee to be sent to governance when a user adds liquidity to a job\\n /// @return _amount The fee amount to be sent to governance when a user adds liquidity to a job\\n function fee() external view returns (uint256 _amount);\\n\\n // Errors\\n\\n /// @notice Throws if the reward period is less than the minimum reward period time\\n error MinRewardPeriod();\\n\\n /// @notice Throws if either a job or a keeper is disputed\\n error Disputed();\\n\\n /// @notice Throws if there are no bonded assets\\n error BondsUnexistent();\\n\\n /// @notice Throws if the time required to bond an asset has not passed yet\\n error BondsLocked();\\n\\n /// @notice Throws if there are no bonds to withdraw\\n error UnbondsUnexistent();\\n\\n /// @notice Throws if the time required to withdraw the bonds has not passed yet\\n error UnbondsLocked();\\n\\n // Methods\\n\\n /// @notice Sets the Keep3rHelper address\\n /// @param _keep3rHelper The Keep3rHelper address\\n function setKeep3rHelper(address _keep3rHelper) external;\\n\\n /// @notice Sets the Keep3rV1 address\\n /// @param _keep3rV1 The Keep3rV1 address\\n function setKeep3rV1(address _keep3rV1) external;\\n\\n /// @notice Sets the Keep3rV1Proxy address\\n /// @param _keep3rV1Proxy The Keep3rV1Proxy address\\n function setKeep3rV1Proxy(address _keep3rV1Proxy) external;\\n\\n /// @notice Sets the bond time required to activate as a keeper\\n /// @param _bond The new bond time\\n function setBondTime(uint256 _bond) external;\\n\\n /// @notice Sets the unbond time required unbond what has been bonded\\n /// @param _unbond The new unbond time\\n function setUnbondTime(uint256 _unbond) external;\\n\\n /// @notice Sets the minimum amount of liquidity required to fund a job\\n /// @param _liquidityMinimum The new minimum amount of liquidity\\n function setLiquidityMinimum(uint256 _liquidityMinimum) external;\\n\\n /// @notice Sets the time required to pass between rewards for jobs\\n /// @param _rewardPeriodTime The new amount of time required to pass between rewards\\n function setRewardPeriodTime(uint256 _rewardPeriodTime) external;\\n\\n /// @notice Sets the new inflation period\\n /// @param _inflationPeriod The new inflation period\\n function setInflationPeriod(uint256 _inflationPeriod) external;\\n\\n /// @notice Sets the new fee\\n /// @param _fee The new fee\\n function setFee(uint256 _fee) external;\\n}\\n\",\"keccak256\":\"0x942f99c6e3b229a551faaae8f03000b934b20502a7cfade14780508201fd098e\",\"license\":\"MIT\"},\"solidity/interfaces/peripherals/IKeep3rRoles.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4 <0.9.0;\\n\\nimport './IBaseErrors.sol';\\nimport './IGovernable.sol';\\nimport './IDustCollector.sol';\\n\\n/// @title Keep3rRoles contract\\n/// @notice Manages the Keep3r specific roles\\ninterface IKeep3rRoles is IBaseErrors, IDustCollector, IGovernable {\\n // Events\\n\\n /// @notice Emitted when a slasher is added\\n /// @param _slasher Address of the added slasher\\n event SlasherAdded(address _slasher);\\n\\n /// @notice Emitted when a slasher is removed\\n /// @param _slasher Address of the removed slasher\\n event SlasherRemoved(address _slasher);\\n\\n /// @notice Emitted when a disputer is added\\n /// @param _disputer Address of the added disputer\\n event DisputerAdded(address _disputer);\\n\\n /// @notice Emitted when a disputer is removed\\n /// @param _disputer Address of the removed disputer\\n event DisputerRemoved(address _disputer);\\n\\n // Variables\\n\\n /// @notice Tracks whether the address is a slasher or not\\n /// @param _slasher Address being checked as a slasher\\n /// @return _isSlasher Whether the address is a slasher or not\\n function slashers(address _slasher) external view returns (bool _isSlasher);\\n\\n /// @notice Tracks whether the address is a disputer or not\\n /// @param _disputer Address being checked as a disputer\\n /// @return _isDisputer Whether the address is a disputer or not\\n function disputers(address _disputer) external view returns (bool _isDisputer);\\n\\n // Errors\\n\\n /// @notice Throws if the address is already a registered slasher\\n error SlasherExistent();\\n\\n /// @notice Throws if caller is not a registered slasher\\n error SlasherUnexistent();\\n\\n /// @notice Throws if the address is already a registered disputer\\n error DisputerExistent();\\n\\n /// @notice Throws if caller is not a registered disputer\\n error DisputerUnexistent();\\n\\n /// @notice Throws if the msg.sender is not a slasher or is not a part of governance\\n error OnlySlasher();\\n\\n /// @notice Throws if the msg.sender is not a disputer or is not a part of governance\\n error OnlyDisputer();\\n\\n // Methods\\n\\n /// @notice Registers a slasher by updating the slashers mapping\\n function addSlasher(address _slasher) external;\\n\\n /// @notice Removes a slasher by updating the slashers mapping\\n function removeSlasher(address _slasher) external;\\n\\n /// @notice Registers a disputer by updating the disputers mapping\\n function addDisputer(address _disputer) external;\\n\\n /// @notice Removes a disputer by updating the disputers mapping\\n function removeDisputer(address _disputer) external;\\n}\\n\",\"keccak256\":\"0xe6eca166cf6ad99e5379d754030222873bb9868ff3e2a76de815a438ead533a2\",\"license\":\"MIT\"}},\"version\":1}", - "bytecode": "0x60a0604052612af8600255612ee0600355680ad78ebc5ac62000006004556184d06005556006805463ffffffff191661025817905564037e11d60060075563773594006008553480156200005257600080fd5b50604051620020a2380380620020a2833981016040819052620000759162000338565b8383838383838383816001600160a01b038116620000a55760405162b293ed60e81b815260040160405180910390fd5b600080546001600160a01b03199081166001600160a01b0393841617909155606086901b6001600160601b03191660805260098054909116918516919091179055620000f281856200017c565b8051600a80546020938401511515600160a01b9081026001600160a81b03199092166001600160a01b03948516179190911791829055604080519383168452910460ff161515928201929092527f554c636366d5fc882a9ab4b7b9d5181781d1a7076abe50ed410365620dcf4108910160405180910390a150505050505050505050505062000395565b60408051808201909152600080825260208201526000826001600160a01b0316846001600160a01b0316630dfe16816040518163ffffffff1660e01b815260040160206040518083038186803b158015620001d657600080fd5b505afa158015620001eb573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019062000211919062000313565b6001600160a01b0316149050801581620002b15750826001600160a01b0316846001600160a01b031663d21220a76040518163ffffffff1660e01b815260040160206040518083038186803b1580156200026a57600080fd5b505afa1580156200027f573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190620002a5919062000313565b6001600160a01b031614155b15620002d05760405163db60809d60e01b815260040160405180910390fd5b604080518082019091526001600160a01b03851681529015156020820152905092915050565b80516001600160a01b03811681146200030e57600080fd5b919050565b6000602082840312156200032657600080fd5b6200033182620002f6565b9392505050565b600080600080608085870312156200034f57600080fd5b6200035a85620002f6565b93506200036a60208601620002f6565b92506200037a60408601620002f6565b91506200038a60608601620002f6565b905092959194509250565b60805160601c611cd2620003d0600039600081816101bb015281816108450152818161088901528181610f1b0152610f990152611cd26000f3fe608060405234801561001057600080fd5b50600436106101b15760003560e01c80637b40c913116100f55780637b40c9131461032b5780638561579c146103585780638a9b1b09146103615780639aaad6791461036a578063a0d271071461038f578063a62611a2146103a2578063ab033ea9146103ab578063ab5dce00146103be578063ab8cedc5146103d1578063b2e0df96146103e4578063b93f5af0146103f7578063c84993af1461040a578063ca4f28031461041d578063dc686d911461043e578063e244208b14610476578063ed1bd76c14610489578063f39c38a01461049c578063fe10d774146104af57600080fd5b806305e0b9a0146101b65780630c525835146101f3578063117cfc1b14610208578063160e1e311461021b5780632248e82d1461022e578063238efcbc1461024f57806325f09e61146102575780632742b9e714610260578063289adb441461026957806337090c2f1461027c5780633cc7ab30146102855780633facf24214610298578063435b21c1146102a1578063516c3323146102cf5780635aa6e675146102e2578063607e48d4146102f5578063696a437b14610308575b600080fd5b6101dd7f000000000000000000000000000000000000000000000000000000000000000081565b6040516101ea91906119ec565b60405180910390f35b610206610201366004611978565b6104c2565b005b6009546101dd906001600160a01b031681565b610206610229366004611747565b610529565b61024161023c366004611834565b610587565b6040519081526020016101ea565b6102066105ba565b61024161271081565b61024160045481565b610206610277366004611978565b610646565b61024160035481565b610206610293366004611747565b6106a6565b61024160055481565b6102b46102af366004611978565b610744565b604080519384526020840192909252908201526060016101ea565b6102416102dd366004611978565b610772565b6000546101dd906001600160a01b031681565b610206610303366004611978565b6107cd565b61031b610316366004611747565b61082d565b60405190151581526020016101ea565b600a5461034a906001600160a01b03811690600160a01b900460ff1682565b6040516101ea929190611a1a565b61024160025481565b61024160085481565b60065461037a9063ffffffff1681565b60405163ffffffff90911681526020016101ea565b61024161039d3660046119aa565b6108e0565b61024160075481565b6102066103b9366004611747565b61091c565b6102066103cc366004611978565b610992565b6102416103df36600461192b565b6109f2565b6102066103f2366004611978565b610a96565b6102066104053660046119d1565b610af6565b610241610418366004611978565b610b2a565b61043061042b366004611747565b610b3c565b6040516101ea929190611a00565b61045161044c366004611781565b610c2a565b60408051600694850b81529290930b60208301521515918101919091526060016101ea565b610206610484366004611978565b610d35565b610241610497366004611978565b610d95565b6001546101dd906001600160a01b031681565b6102416104bd366004611747565b610ef0565b6000546001600160a01b031633146104ed576040516354348f0360e01b815260040160405180910390fd5b60028190556040518181527f0919fdaaac0f59c6bc7eeef4f975d6163475220f1e4820d0bce99c84c51cac1d906020015b60405180910390a150565b6000546001600160a01b03163314610554576040516354348f0360e01b815260040160405180910390fd5b6001600160a01b03811661057b5760405163d92e233d60e01b815260040160405180910390fd5b61058481610f93565b50565b6000806105966102dd85610ef0565b90506105b26127106105a88386611b2c565b6104979190611b18565b949350505050565b6001546001600160a01b031633146105e557604051637ef5703160e11b815260040160405180910390fd5b60018054600080546001600160a01b0383166001600160a01b031991821681179092559091169091556040517fc73be659241aade67e9a059bcf21494955018b213dbd1179054ccf928b13f3b69161063c916119ec565b60405180910390a1565b6000546001600160a01b03163314610671576040516354348f0360e01b815260040160405180910390fd5b60058190556040518181527fed847bdbab1a30becee18585f23c759bd06156561390d2e7fbffd18e74b56c9b9060200161051e565b6000546001600160a01b031633146106d1576040516354348f0360e01b815260040160405180910390fd5b6001600160a01b0381166106f85760405163d92e233d60e01b815260040160405180910390fd5b600980546001600160a01b0319166001600160a01b0383169081179091556040517fcf744e4fc39d49b6d8103035078629b8a3be95adc007b0d663e96bdff777b10a9161051e916119ec565b600080600061075a670de0b6b3a7640000610d95565b915061076584610772565b6005549095929450925050565b600061078082600454611029565b91506000600454836002546003546107989190611b9b565b6107a29190611b2c565b6107ac9190611b18565b6002546107b99190611ad2565b90506107c6600182611b2c565b9392505050565b6000546001600160a01b031633146107f8576040516354348f0360e01b815260040160405180910390fd5b60078190556040518181527ff1443dcc693c421058f429cf588bc37e5c8de2275c3771a810a5e4bf0a908a4b9060200161051e565b600080600061083b84610b3c565b80925081935050507f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316826001600160a01b03161415610887575060019392505050565b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316816001600160a01b0316146108d957604051637d7c8f2760e11b815260040160405180910390fd5b5050919050565b6000806108f96108f484600687900b611aea565b61103f565b9050610913600160601b86836001600160a01b031661144d565b95945050505050565b6000546001600160a01b03163314610947576040516354348f0360e01b815260040160405180910390fd5b600180546001600160a01b0319166001600160a01b0383161790556040517fe987aaedf9d279143bdf1eee16cf1d0feb47742867d81083df8d6cd0a5ac857f9061051e9083906119ec565b6000546001600160a01b031633146109bd576040516354348f0360e01b815260040160405180910390fd5b60048190556040518181527feac367d684b6ac6c6ae7e3e852c06f17e6354e0f1e7122832c3e6d17e0a2b71e9060200161051e565b600080610a066108f484600687900b611aea565b90506001600160801b036001600160a01b03821611610a56576000610a346001600160a01b03831680611b2c565b9050610a4e600160c01b876001600160801b03168361144d565b925050610a8e565b6000610a706001600160a01b03831680600160401b61144d565b9050610a8a600160801b876001600160801b03168361144d565b9250505b509392505050565b6000546001600160a01b03163314610ac1576040516354348f0360e01b815260040160405180910390fd5b60038190556040518181527fa1292b4e7a0d916ccfd2bc83858b05f328e344d1f0f507d97ac66723ac7c2aaa9060200161051e565b6000546001600160a01b03163314610b21576040516354348f0360e01b815260040160405180910390fd5b610584816114fb565b6000610b363283610587565b92915050565b600080826001600160a01b0316630dfe16816040518163ffffffff1660e01b815260040160206040518083038186803b158015610b7857600080fd5b505afa158015610b8c573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610bb09190611764565b836001600160a01b031663d21220a76040518163ffffffff1660e01b815260040160206040518083038186803b158015610be957600080fd5b505afa158015610bfd573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610c219190611764565b91509150915091565b6000806000846001600160a01b031663883bdbfd856040518263ffffffff1660e01b8152600401610c5b9190611a35565b60006040518083038186803b158015610c7357600080fd5b505afa925050508015610ca857506040513d6000823e601f3d908101601f19168201604052610ca59190810190611860565b60015b610ce2573d808015610cd6576040519150601f19603f3d011682016040523d82523d6000602084013e610cdb565b606091505b5050610d2e565b81600081518110610cf557610cf5611c4c565b60200260200101519450600182511115610d275781600181518110610d1c57610d1c611c4c565b602002602001015193505b6001925050505b9250925092565b6000546001600160a01b03163314610d60576040516354348f0360e01b815260040160405180910390fd5b60088190556040518181527f403b461d2c3bcad840d570faac033e4e69e5649645ce89f3c5b4e28d541592219060200161051e565b604080516002808252606082018352600092839291906020830190803683375050600654825192935063ffffffff16918391506001908110610dd957610dd9611c4c565b63ffffffff90921660209283029190910190910152600a5460405163883bdbfd60e01b81526000916001600160a01b03169063883bdbfd90610e1f908590600401611a35565b60006040518083038186803b158015610e3757600080fd5b505afa158015610e4b573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052610e739190810190611860565b509050600081600181518110610e8b57610e8b611c4c565b602002602001015182600081518110610ea657610ea6611c4c565b6020026020010151610eb89190611b4b565b600a54909150610913908690600160a01b900460ff16610ee057610edb83611c06565b610ee2565b825b60065463ffffffff166109f2565b60095460405163a39744b560e01b81526000916001600160a01b03169063a39744b590610f439085907f000000000000000000000000000000000000000000000000000000000000000090600401611a00565b60206040518083038186803b158015610f5b57600080fd5b505afa158015610f6f573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610b369190611991565b610fbd817f0000000000000000000000000000000000000000000000000000000000000000611543565b8051600a80546020909301511515600160a01b9081026001600160a81b03199094166001600160a01b039384161793909317908190556040517f554c636366d5fc882a9ab4b7b9d5181781d1a7076abe50ed410365620dcf41089361051e938316920460ff1690611a1a565b600081831061103857816107c6565b5090919050565b60008060008360020b12611056578260020b611063565b8260020b61106390611be9565b9050611072620d89e719611bc6565b60020b8111156110ac5760405162461bcd60e51b81526020600482015260016024820152601560fa1b604482015260640160405180910390fd5b6000600182166110c057600160801b6110d2565b6ffffcb933bd6fad37aa2d162d1a5940015b6001600160881b031690506002821615611107576080611102826ffff97272373d413259a46990580e213a611b2c565b901c90505b600482161561113157608061112c826ffff2e50f5f656932ef12357cf3c7fdcc611b2c565b901c90505b600882161561115b576080611156826fffe5caca7e10e4e61c3624eaa0941cd0611b2c565b901c90505b6010821615611185576080611180826fffcb9843d60f6159c9db58835c926644611b2c565b901c90505b60208216156111af5760806111aa826fff973b41fa98c081472e6896dfb254c0611b2c565b901c90505b60408216156111d95760806111d4826fff2ea16466c96a3843ec78b326b52861611b2c565b901c90505b60808216156112035760806111fe826ffe5dee046a99a2a811c461f1969c3053611b2c565b901c90505b61010082161561122e576080611229826ffcbe86c7900a88aedcffc83b479aa3a4611b2c565b901c90505b610200821615611259576080611254826ff987a7253ac413176f2b074cf7815e54611b2c565b901c90505b61040082161561128457608061127f826ff3392b0822b70005940c7a398e4b70f3611b2c565b901c90505b6108008216156112af5760806112aa826fe7159475a2c29b7443b29c7fa6e889d9611b2c565b901c90505b6110008216156112da5760806112d5826fd097f3bdfd2022b8845ad8f792aa5825611b2c565b901c90505b612000821615611305576080611300826fa9f746462d870fdf8a65dc1f90e061e5611b2c565b901c90505b61400082161561133057608061132b826f70d869a156d2a1b890bb3df62baf32f7611b2c565b901c90505b61800082161561135b576080611356826f31be135f97d08fd981231505542fcfa6611b2c565b901c90505b62010000821615611387576080611382826f09aa508b5b7a84e1c677de54f3e99bc9611b2c565b901c90505b620200008216156113b25760806113ad826e5d6af8dedb81196699c329225ee604611b2c565b901c90505b620400008216156113dc5760806113d7826d2216e584f5fa1ea926041bedfe98611b2c565b901c90505b620800008216156114045760806113ff826b048a170391f7dc42444e8fa2611b2c565b901c90505b60008460020b131561141f5761141c81600019611b18565b90505b61142d600160201b82611bb2565b1561143957600161143c565b60005b6105b29060ff16602083901c611ad2565b600080806000198587098587029250828110838203039150508060001415611487576000841161147c57600080fd5b5082900490506107c6565b80841161149357600080fd5b600084868809600260036001881981018916988990049182028318808302840302808302840302808302840302808302840302808302840302918202909203026000889003889004909101858311909403939093029303949094049190911702949350505050565b6006805463ffffffff191663ffffffff83169081179091556040519081527fc806e26fb64e3a95f4b70abf4d87280555696244d01068b5f45b0e515aceb1de9060200161051e565b60408051808201909152600080825260208201526000826001600160a01b0316846001600160a01b0316630dfe16816040518163ffffffff1660e01b815260040160206040518083038186803b15801561159c57600080fd5b505afa1580156115b0573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906115d49190611764565b6001600160a01b031614905080158161166f5750826001600160a01b0316846001600160a01b031663d21220a76040518163ffffffff1660e01b815260040160206040518083038186803b15801561162b57600080fd5b505afa15801561163f573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906116639190611764565b6001600160a01b031614155b1561168d5760405163db60809d60e01b815260040160405180910390fd5b604080518082019091526001600160a01b03851681529015156020820152905092915050565b600082601f8301126116c457600080fd5b815160206116d96116d483611aaf565b611a7f565b80838252828201915082860187848660051b89010111156116f957600080fd5b60005b8581101561172157815161170f81611c78565b845292840192908401906001016116fc565b5090979650505050505050565b803563ffffffff8116811461174257600080fd5b919050565b60006020828403121561175957600080fd5b81356107c681611c78565b60006020828403121561177657600080fd5b81516107c681611c78565b6000806040838503121561179457600080fd5b823561179f81611c78565b91506020838101356001600160401b038111156117bb57600080fd5b8401601f810186136117cc57600080fd5b80356117da6116d482611aaf565b80828252848201915084840189868560051b87010111156117fa57600080fd5b600094505b83851015611824576118108161172e565b8352600194909401939185019185016117ff565b5080955050505050509250929050565b6000806040838503121561184757600080fd5b823561185281611c78565b946020939093013593505050565b6000806040838503121561187357600080fd5b82516001600160401b038082111561188a57600080fd5b818501915085601f83011261189e57600080fd5b815160206118ae6116d483611aaf565b8083825282820191508286018a848660051b89010111156118ce57600080fd5b600096505b848710156118fa5780516118e681611c8d565b8352600196909601959183019183016118d3565b509188015191965090935050508082111561191457600080fd5b50611921858286016116b3565b9150509250929050565b60008060006060848603121561194057600080fd5b83356001600160801b038116811461195757600080fd5b9250602084013561196781611c8d565b929592945050506040919091013590565b60006020828403121561198a57600080fd5b5035919050565b6000602082840312156119a357600080fd5b5051919050565b6000806000606084860312156119bf57600080fd5b83359250602084013561196781611c8d565b6000602082840312156119e357600080fd5b6107c68261172e565b6001600160a01b0391909116815260200190565b6001600160a01b0392831681529116602082015260400190565b6001600160a01b039290921682521515602082015260400190565b6020808252825182820181905260009190848201906040850190845b81811015611a7357835163ffffffff1683529284019291840191600101611a51565b50909695505050505050565b604051601f8201601f191681016001600160401b0381118282101715611aa757611aa7611c62565b604052919050565b60006001600160401b03821115611ac857611ac8611c62565b5060051b60200190565b60008219821115611ae557611ae5611c20565b500190565b600082611af957611af9611c36565b600160ff1b821460001984141615611b1357611b13611c20565b500590565b600082611b2757611b27611c36565b500490565b6000816000190483118215151615611b4657611b46611c20565b500290565b60008160060b8360060b6000811281667fffffffffffff1901831281151615611b7657611b76611c20565b81667fffffffffffff018313811615611b9157611b91611c20565b5090039392505050565b600082821015611bad57611bad611c20565b500390565b600082611bc157611bc1611c36565b500690565b60008160020b627fffff19811415611be057611be0611c20565b60000392915050565b6000600160ff1b821415611bff57611bff611c20565b5060000390565b60008160060b667fffffffffffff19811415611be057611be05b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052601260045260246000fd5b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052604160045260246000fd5b6001600160a01b038116811461058457600080fd5b8060060b811461058457600080fdfea26469706673582212206e7e541d05de3a39e3b8273e581d49a50f28c8d6663aa5f7a97550d7d9ba5a1364736f6c63430008070033", - "deployedBytecode": "0x608060405234801561001057600080fd5b50600436106101b15760003560e01c80637b40c913116100f55780637b40c9131461032b5780638561579c146103585780638a9b1b09146103615780639aaad6791461036a578063a0d271071461038f578063a62611a2146103a2578063ab033ea9146103ab578063ab5dce00146103be578063ab8cedc5146103d1578063b2e0df96146103e4578063b93f5af0146103f7578063c84993af1461040a578063ca4f28031461041d578063dc686d911461043e578063e244208b14610476578063ed1bd76c14610489578063f39c38a01461049c578063fe10d774146104af57600080fd5b806305e0b9a0146101b65780630c525835146101f3578063117cfc1b14610208578063160e1e311461021b5780632248e82d1461022e578063238efcbc1461024f57806325f09e61146102575780632742b9e714610260578063289adb441461026957806337090c2f1461027c5780633cc7ab30146102855780633facf24214610298578063435b21c1146102a1578063516c3323146102cf5780635aa6e675146102e2578063607e48d4146102f5578063696a437b14610308575b600080fd5b6101dd7f000000000000000000000000000000000000000000000000000000000000000081565b6040516101ea91906119ec565b60405180910390f35b610206610201366004611978565b6104c2565b005b6009546101dd906001600160a01b031681565b610206610229366004611747565b610529565b61024161023c366004611834565b610587565b6040519081526020016101ea565b6102066105ba565b61024161271081565b61024160045481565b610206610277366004611978565b610646565b61024160035481565b610206610293366004611747565b6106a6565b61024160055481565b6102b46102af366004611978565b610744565b604080519384526020840192909252908201526060016101ea565b6102416102dd366004611978565b610772565b6000546101dd906001600160a01b031681565b610206610303366004611978565b6107cd565b61031b610316366004611747565b61082d565b60405190151581526020016101ea565b600a5461034a906001600160a01b03811690600160a01b900460ff1682565b6040516101ea929190611a1a565b61024160025481565b61024160085481565b60065461037a9063ffffffff1681565b60405163ffffffff90911681526020016101ea565b61024161039d3660046119aa565b6108e0565b61024160075481565b6102066103b9366004611747565b61091c565b6102066103cc366004611978565b610992565b6102416103df36600461192b565b6109f2565b6102066103f2366004611978565b610a96565b6102066104053660046119d1565b610af6565b610241610418366004611978565b610b2a565b61043061042b366004611747565b610b3c565b6040516101ea929190611a00565b61045161044c366004611781565b610c2a565b60408051600694850b81529290930b60208301521515918101919091526060016101ea565b610206610484366004611978565b610d35565b610241610497366004611978565b610d95565b6001546101dd906001600160a01b031681565b6102416104bd366004611747565b610ef0565b6000546001600160a01b031633146104ed576040516354348f0360e01b815260040160405180910390fd5b60028190556040518181527f0919fdaaac0f59c6bc7eeef4f975d6163475220f1e4820d0bce99c84c51cac1d906020015b60405180910390a150565b6000546001600160a01b03163314610554576040516354348f0360e01b815260040160405180910390fd5b6001600160a01b03811661057b5760405163d92e233d60e01b815260040160405180910390fd5b61058481610f93565b50565b6000806105966102dd85610ef0565b90506105b26127106105a88386611b2c565b6104979190611b18565b949350505050565b6001546001600160a01b031633146105e557604051637ef5703160e11b815260040160405180910390fd5b60018054600080546001600160a01b0383166001600160a01b031991821681179092559091169091556040517fc73be659241aade67e9a059bcf21494955018b213dbd1179054ccf928b13f3b69161063c916119ec565b60405180910390a1565b6000546001600160a01b03163314610671576040516354348f0360e01b815260040160405180910390fd5b60058190556040518181527fed847bdbab1a30becee18585f23c759bd06156561390d2e7fbffd18e74b56c9b9060200161051e565b6000546001600160a01b031633146106d1576040516354348f0360e01b815260040160405180910390fd5b6001600160a01b0381166106f85760405163d92e233d60e01b815260040160405180910390fd5b600980546001600160a01b0319166001600160a01b0383169081179091556040517fcf744e4fc39d49b6d8103035078629b8a3be95adc007b0d663e96bdff777b10a9161051e916119ec565b600080600061075a670de0b6b3a7640000610d95565b915061076584610772565b6005549095929450925050565b600061078082600454611029565b91506000600454836002546003546107989190611b9b565b6107a29190611b2c565b6107ac9190611b18565b6002546107b99190611ad2565b90506107c6600182611b2c565b9392505050565b6000546001600160a01b031633146107f8576040516354348f0360e01b815260040160405180910390fd5b60078190556040518181527ff1443dcc693c421058f429cf588bc37e5c8de2275c3771a810a5e4bf0a908a4b9060200161051e565b600080600061083b84610b3c565b80925081935050507f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316826001600160a01b03161415610887575060019392505050565b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316816001600160a01b0316146108d957604051637d7c8f2760e11b815260040160405180910390fd5b5050919050565b6000806108f96108f484600687900b611aea565b61103f565b9050610913600160601b86836001600160a01b031661144d565b95945050505050565b6000546001600160a01b03163314610947576040516354348f0360e01b815260040160405180910390fd5b600180546001600160a01b0319166001600160a01b0383161790556040517fe987aaedf9d279143bdf1eee16cf1d0feb47742867d81083df8d6cd0a5ac857f9061051e9083906119ec565b6000546001600160a01b031633146109bd576040516354348f0360e01b815260040160405180910390fd5b60048190556040518181527feac367d684b6ac6c6ae7e3e852c06f17e6354e0f1e7122832c3e6d17e0a2b71e9060200161051e565b600080610a066108f484600687900b611aea565b90506001600160801b036001600160a01b03821611610a56576000610a346001600160a01b03831680611b2c565b9050610a4e600160c01b876001600160801b03168361144d565b925050610a8e565b6000610a706001600160a01b03831680600160401b61144d565b9050610a8a600160801b876001600160801b03168361144d565b9250505b509392505050565b6000546001600160a01b03163314610ac1576040516354348f0360e01b815260040160405180910390fd5b60038190556040518181527fa1292b4e7a0d916ccfd2bc83858b05f328e344d1f0f507d97ac66723ac7c2aaa9060200161051e565b6000546001600160a01b03163314610b21576040516354348f0360e01b815260040160405180910390fd5b610584816114fb565b6000610b363283610587565b92915050565b600080826001600160a01b0316630dfe16816040518163ffffffff1660e01b815260040160206040518083038186803b158015610b7857600080fd5b505afa158015610b8c573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610bb09190611764565b836001600160a01b031663d21220a76040518163ffffffff1660e01b815260040160206040518083038186803b158015610be957600080fd5b505afa158015610bfd573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610c219190611764565b91509150915091565b6000806000846001600160a01b031663883bdbfd856040518263ffffffff1660e01b8152600401610c5b9190611a35565b60006040518083038186803b158015610c7357600080fd5b505afa925050508015610ca857506040513d6000823e601f3d908101601f19168201604052610ca59190810190611860565b60015b610ce2573d808015610cd6576040519150601f19603f3d011682016040523d82523d6000602084013e610cdb565b606091505b5050610d2e565b81600081518110610cf557610cf5611c4c565b60200260200101519450600182511115610d275781600181518110610d1c57610d1c611c4c565b602002602001015193505b6001925050505b9250925092565b6000546001600160a01b03163314610d60576040516354348f0360e01b815260040160405180910390fd5b60088190556040518181527f403b461d2c3bcad840d570faac033e4e69e5649645ce89f3c5b4e28d541592219060200161051e565b604080516002808252606082018352600092839291906020830190803683375050600654825192935063ffffffff16918391506001908110610dd957610dd9611c4c565b63ffffffff90921660209283029190910190910152600a5460405163883bdbfd60e01b81526000916001600160a01b03169063883bdbfd90610e1f908590600401611a35565b60006040518083038186803b158015610e3757600080fd5b505afa158015610e4b573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052610e739190810190611860565b509050600081600181518110610e8b57610e8b611c4c565b602002602001015182600081518110610ea657610ea6611c4c565b6020026020010151610eb89190611b4b565b600a54909150610913908690600160a01b900460ff16610ee057610edb83611c06565b610ee2565b825b60065463ffffffff166109f2565b60095460405163a39744b560e01b81526000916001600160a01b03169063a39744b590610f439085907f000000000000000000000000000000000000000000000000000000000000000090600401611a00565b60206040518083038186803b158015610f5b57600080fd5b505afa158015610f6f573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610b369190611991565b610fbd817f0000000000000000000000000000000000000000000000000000000000000000611543565b8051600a80546020909301511515600160a01b9081026001600160a81b03199094166001600160a01b039384161793909317908190556040517f554c636366d5fc882a9ab4b7b9d5181781d1a7076abe50ed410365620dcf41089361051e938316920460ff1690611a1a565b600081831061103857816107c6565b5090919050565b60008060008360020b12611056578260020b611063565b8260020b61106390611be9565b9050611072620d89e719611bc6565b60020b8111156110ac5760405162461bcd60e51b81526020600482015260016024820152601560fa1b604482015260640160405180910390fd5b6000600182166110c057600160801b6110d2565b6ffffcb933bd6fad37aa2d162d1a5940015b6001600160881b031690506002821615611107576080611102826ffff97272373d413259a46990580e213a611b2c565b901c90505b600482161561113157608061112c826ffff2e50f5f656932ef12357cf3c7fdcc611b2c565b901c90505b600882161561115b576080611156826fffe5caca7e10e4e61c3624eaa0941cd0611b2c565b901c90505b6010821615611185576080611180826fffcb9843d60f6159c9db58835c926644611b2c565b901c90505b60208216156111af5760806111aa826fff973b41fa98c081472e6896dfb254c0611b2c565b901c90505b60408216156111d95760806111d4826fff2ea16466c96a3843ec78b326b52861611b2c565b901c90505b60808216156112035760806111fe826ffe5dee046a99a2a811c461f1969c3053611b2c565b901c90505b61010082161561122e576080611229826ffcbe86c7900a88aedcffc83b479aa3a4611b2c565b901c90505b610200821615611259576080611254826ff987a7253ac413176f2b074cf7815e54611b2c565b901c90505b61040082161561128457608061127f826ff3392b0822b70005940c7a398e4b70f3611b2c565b901c90505b6108008216156112af5760806112aa826fe7159475a2c29b7443b29c7fa6e889d9611b2c565b901c90505b6110008216156112da5760806112d5826fd097f3bdfd2022b8845ad8f792aa5825611b2c565b901c90505b612000821615611305576080611300826fa9f746462d870fdf8a65dc1f90e061e5611b2c565b901c90505b61400082161561133057608061132b826f70d869a156d2a1b890bb3df62baf32f7611b2c565b901c90505b61800082161561135b576080611356826f31be135f97d08fd981231505542fcfa6611b2c565b901c90505b62010000821615611387576080611382826f09aa508b5b7a84e1c677de54f3e99bc9611b2c565b901c90505b620200008216156113b25760806113ad826e5d6af8dedb81196699c329225ee604611b2c565b901c90505b620400008216156113dc5760806113d7826d2216e584f5fa1ea926041bedfe98611b2c565b901c90505b620800008216156114045760806113ff826b048a170391f7dc42444e8fa2611b2c565b901c90505b60008460020b131561141f5761141c81600019611b18565b90505b61142d600160201b82611bb2565b1561143957600161143c565b60005b6105b29060ff16602083901c611ad2565b600080806000198587098587029250828110838203039150508060001415611487576000841161147c57600080fd5b5082900490506107c6565b80841161149357600080fd5b600084868809600260036001881981018916988990049182028318808302840302808302840302808302840302808302840302808302840302918202909203026000889003889004909101858311909403939093029303949094049190911702949350505050565b6006805463ffffffff191663ffffffff83169081179091556040519081527fc806e26fb64e3a95f4b70abf4d87280555696244d01068b5f45b0e515aceb1de9060200161051e565b60408051808201909152600080825260208201526000826001600160a01b0316846001600160a01b0316630dfe16816040518163ffffffff1660e01b815260040160206040518083038186803b15801561159c57600080fd5b505afa1580156115b0573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906115d49190611764565b6001600160a01b031614905080158161166f5750826001600160a01b0316846001600160a01b031663d21220a76040518163ffffffff1660e01b815260040160206040518083038186803b15801561162b57600080fd5b505afa15801561163f573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906116639190611764565b6001600160a01b031614155b1561168d5760405163db60809d60e01b815260040160405180910390fd5b604080518082019091526001600160a01b03851681529015156020820152905092915050565b600082601f8301126116c457600080fd5b815160206116d96116d483611aaf565b611a7f565b80838252828201915082860187848660051b89010111156116f957600080fd5b60005b8581101561172157815161170f81611c78565b845292840192908401906001016116fc565b5090979650505050505050565b803563ffffffff8116811461174257600080fd5b919050565b60006020828403121561175957600080fd5b81356107c681611c78565b60006020828403121561177657600080fd5b81516107c681611c78565b6000806040838503121561179457600080fd5b823561179f81611c78565b91506020838101356001600160401b038111156117bb57600080fd5b8401601f810186136117cc57600080fd5b80356117da6116d482611aaf565b80828252848201915084840189868560051b87010111156117fa57600080fd5b600094505b83851015611824576118108161172e565b8352600194909401939185019185016117ff565b5080955050505050509250929050565b6000806040838503121561184757600080fd5b823561185281611c78565b946020939093013593505050565b6000806040838503121561187357600080fd5b82516001600160401b038082111561188a57600080fd5b818501915085601f83011261189e57600080fd5b815160206118ae6116d483611aaf565b8083825282820191508286018a848660051b89010111156118ce57600080fd5b600096505b848710156118fa5780516118e681611c8d565b8352600196909601959183019183016118d3565b509188015191965090935050508082111561191457600080fd5b50611921858286016116b3565b9150509250929050565b60008060006060848603121561194057600080fd5b83356001600160801b038116811461195757600080fd5b9250602084013561196781611c8d565b929592945050506040919091013590565b60006020828403121561198a57600080fd5b5035919050565b6000602082840312156119a357600080fd5b5051919050565b6000806000606084860312156119bf57600080fd5b83359250602084013561196781611c8d565b6000602082840312156119e357600080fd5b6107c68261172e565b6001600160a01b0391909116815260200190565b6001600160a01b0392831681529116602082015260400190565b6001600160a01b039290921682521515602082015260400190565b6020808252825182820181905260009190848201906040850190845b81811015611a7357835163ffffffff1683529284019291840191600101611a51565b50909695505050505050565b604051601f8201601f191681016001600160401b0381118282101715611aa757611aa7611c62565b604052919050565b60006001600160401b03821115611ac857611ac8611c62565b5060051b60200190565b60008219821115611ae557611ae5611c20565b500190565b600082611af957611af9611c36565b600160ff1b821460001984141615611b1357611b13611c20565b500590565b600082611b2757611b27611c36565b500490565b6000816000190483118215151615611b4657611b46611c20565b500290565b60008160060b8360060b6000811281667fffffffffffff1901831281151615611b7657611b76611c20565b81667fffffffffffff018313811615611b9157611b91611c20565b5090039392505050565b600082821015611bad57611bad611c20565b500390565b600082611bc157611bc1611c36565b500690565b60008160020b627fffff19811415611be057611be0611c20565b60000392915050565b6000600160ff1b821415611bff57611bff611c20565b5060000390565b60008160060b667fffffffffffff19811415611be057611be05b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052601260045260246000fd5b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052604160045260246000fd5b6001600160a01b038116811461058457600080fd5b8060060b811461058457600080fdfea26469706673582212206e7e541d05de3a39e3b8273e581d49a50f28c8d6663aa5f7a97550d7d9ba5a1364736f6c63430008070033", - "devdoc": { - "kind": "dev", - "methods": { - "bonds(address)": { - "params": { - "_keeper": "The address of the keeper to check" - }, - "returns": { - "_amountBonded": "The amount of KP3R the keeper has bonded" - } - }, - "getKP3RsAtTick(uint256,int56,uint256)": { - "params": { - "_liquidityAmount": "Amount of liquidity to be converted", - "_tickDifference": "Tick value used to calculate the quote", - "_timeInterval": "Time value used to calculate the quote" - }, - "returns": { - "_kp3rAmount": "Amount of KP3R tokens underlying on the given liquidity" - } - }, - "getPaymentParams(uint256)": { - "params": { - "_bonds": "Amount of bonded KP3R owned by the keeper" - }, - "returns": { - "_boost": "Multiplier per gas unit. Takes into account the base fee and the amount of bonded KP3R", - "_extra": "Amount of extra gas that should be added to the gas spent", - "_oneEthQuote": "Amount of KP3R tokens equivalent to 1 ETH" - } - }, - "getPoolTokens(address)": { - "params": { - "_pool": "Address of the correspondant pool" - }, - "returns": { - "_token0": "Address of the first token of the pair", - "_token1": "Address of the second token of the pair" - } - }, - "getQuoteAtTick(uint128,int56,uint256)": { - "params": { - "_baseAmount": "Amount of token to be converted", - "_tickDifference": "Tick value used to calculate the quote", - "_timeInterval": "Time value used to calculate the quote" - }, - "returns": { - "_quoteAmount": "Amount of credits deserved for the baseAmount at the tick value" - } - }, - "getRewardAmount(uint256)": { - "params": { - "_gasUsed": "The amount of gas used that will be rewarded" - }, - "returns": { - "_amount": "The amount of KP3R that should be awarded to tx.origin" - } - }, - "getRewardAmountFor(address,uint256)": { - "params": { - "_gasUsed": "The amount of gas used that will be rewarded", - "_keeper": "The address of the keeper to check" - }, - "returns": { - "_kp3r": "The amount of KP3R that should be awarded to the keeper" - } - }, - "getRewardBoostFor(uint256)": { - "details": "If the keeper has no bonds, boost should be +10% of gas cost, if keeper has max bonds, +20%", - "params": { - "_bonds": "The amount of KP3R tokens bonded by the keeper" - }, - "returns": { - "_rewardBoost": "The reward boost that corresponds to the keeper" - } - }, - "isKP3RToken0(address)": { - "params": { - "_pool": "Address of the correspondant pool" - }, - "returns": { - "_isKP3RToken0": "Boolean indicating the order of the tokens in the pair" - } - }, - "observe(address,uint32[])": { - "params": { - "_pool": "Address of the pool to observe", - "_secondsAgo": "Array with time references to observe" - }, - "returns": { - "_success": "Boolean indicating if the observe call was succesfull", - "_tickCumulative1": "Cumulative sum of ticks until first time reference", - "_tickCumulative2": "Cumulative sum of ticks until second time reference" - } - }, - "quote(uint256)": { - "details": "This function allows us to calculate how much KP3R we should pay to a keeper for things expressed in ETH, like gas", - "params": { - "_eth": "The amount of ETH" - }, - "returns": { - "_amountOut": "The amount of KP3R" - } - }, - "setGovernance(address)": { - "params": { - "_governance": "The address being proposed as the new governance" - } - }, - "setKeep3rV2(address)": { - "params": { - "_keep3rV2": "The address of Keep3r V2" - } - }, - "setKp3rWethPool(address)": { - "params": { - "_poolAddress": "The address of the KP3R-WETH pool" - } - }, - "setMaxBoost(uint256)": { - "params": { - "_maxBoost": "The maximum boost multiplier" - } - }, - "setMinBaseFee(uint256)": { - "params": { - "_minBaseFee": "The minimum rewarded gas fee" - } - }, - "setMinBoost(uint256)": { - "params": { - "_minBoost": "The minimum boost multiplier" - } - }, - "setMinPriorityFee(uint256)": { - "params": { - "_minPriorityFee": "The minimum rewarded priority fee" - } - }, - "setQuoteTwapTime(uint32)": { - "params": { - "_quoteTwapTime": "The twap time for quoting" - } - }, - "setTargetBond(uint256)": { - "params": { - "_targetBond": "The target bond amount" - } - }, - "setWorkExtraGas(uint256)": { - "params": { - "_workExtraGas": "The work extra gas" - } - } - }, - "version": 1 - }, - "userdoc": { - "errors": { - "InvalidOraclePool()": [ - { - "notice": "Throws when pool does not have KP3R as token0 nor token1" - } - ], - "LiquidityPairInvalid()": [ - { - "notice": "Throws when none of the tokens in the liquidity pair is KP3R" - } - ], - "NoGovernanceZeroAddress()": [ - { - "notice": "Throws if trying to set governance to zero address" - } - ], - "OnlyGovernance()": [ - { - "notice": "Throws if the caller of the function is not governance" - } - ], - "OnlyPendingGovernance()": [ - { - "notice": "Throws if the caller of the function is not pendingGovernance" - } - ], - "ZeroAddress()": [ - { - "notice": "Throws if a variable is assigned to the zero address" - } - ] - }, - "events": { - "GovernanceProposal(address)": { - "notice": "Emitted when a new governance is proposed" - }, - "GovernanceSet(address)": { - "notice": "Emitted when pendingGovernance accepts to be governance" - }, - "Keep3rV2Change(address)": { - "notice": "Emitted when the Keep3r V2 address is changed" - }, - "Kp3rWethPoolChange(address,bool)": { - "notice": "Emitted when the kp3r weth pool is changed" - }, - "MaxBoostChange(uint256)": { - "notice": "Emitted when the maximum boost multiplier is changed" - }, - "MinBaseFeeChange(uint256)": { - "notice": "Emitted when minimum rewarded gas fee is changed" - }, - "MinBoostChange(uint256)": { - "notice": "Emitted when the minimum boost multiplier is changed" - }, - "MinPriorityFeeChange(uint256)": { - "notice": "Emitted when minimum rewarded priority fee is changed" - }, - "QuoteTwapTimeChange(uint32)": { - "notice": "Emitted when the quote twap time is changed" - }, - "TargetBondChange(uint256)": { - "notice": "Emitted when the target bond amount is changed" - }, - "WorkExtraGasChange(uint256)": { - "notice": "Emitted when the work extra gas amount is changed" - } - }, - "kind": "user", - "methods": { - "BOOST_BASE()": { - "notice": "The boost base used to calculate the boost rewards for the keeper" - }, - "KP3R()": { - "notice": "Address of KP3R token" - }, - "acceptGovernance()": { - "notice": "Changes the governance from the current governance to the previously proposed address" - }, - "bonds(address)": { - "notice": "Returns the amount of KP3R the keeper has bonded" - }, - "getKP3RsAtTick(uint256,int56,uint256)": { - "notice": "Given a tick and a liquidity amount, calculates the underlying KP3R tokens" - }, - "getPaymentParams(uint256)": { - "notice": "Get multiplier, quote, and extra, in order to calculate keeper payment" - }, - "getPoolTokens(address)": { - "notice": "Given a pool address, returns the underlying tokens of the pair" - }, - "getQuoteAtTick(uint128,int56,uint256)": { - "notice": "Given a tick and a token amount, calculates the output in correspondant token" - }, - "getRewardAmount(uint256)": { - "notice": "Calculates the reward (in KP3R) that corresponds to tx.origin for using gas" - }, - "getRewardAmountFor(address,uint256)": { - "notice": "Calculates the reward (in KP3R) that corresponds to a keeper for using gas" - }, - "getRewardBoostFor(uint256)": { - "notice": "Calculates the boost in the reward given to a keeper based on the amount of KP3R that keeper has bonded" - }, - "governance()": { - "notice": "Stores the governance address" - }, - "isKP3RToken0(address)": { - "notice": "Defines the order of the tokens in the pair for twap calculations" - }, - "keep3rV2()": { - "notice": "Address of Keep3r V2" - }, - "kp3rWethPool()": { - "notice": "KP3R-WETH pool that is being used as oracle" - }, - "maxBoost()": { - "notice": "The maximum multiplier used to calculate the amount of gas paid to the Keeper for the gas used to perform a job For example: if the quoted gas used is 1000, then the maximum amount to be paid will be 1000 * maxBoost / BOOST_BASE" - }, - "minBaseFee()": { - "notice": "The minimum base fee that is used to calculate keeper rewards" - }, - "minBoost()": { - "notice": "The minimum multiplier used to calculate the amount of gas paid to the Keeper for the gas used to perform a job For example: if the quoted gas used is 1000, then the minimum amount to be paid will be 1000 * minBoost / BOOST_BASE" - }, - "minPriorityFee()": { - "notice": "The minimum priority fee that is also rewarded for keepers" - }, - "observe(address,uint32[])": { - "notice": "Given an array of secondsAgo, returns UniswapV3 pool cumulatives at that moment" - }, - "pendingGovernance()": { - "notice": "Stores the pendingGovernance address" - }, - "quote(uint256)": { - "notice": "Calculates the amount of KP3R that corresponds to the ETH passed into the function" - }, - "quoteTwapTime()": { - "notice": "The twap time for quoting" - }, - "setGovernance(address)": { - "notice": "Proposes a new address to be governance" - }, - "setKeep3rV2(address)": { - "notice": "Sets the Keep3r V2 address" - }, - "setKp3rWethPool(address)": { - "notice": "Sets KP3R-WETH pool" - }, - "setMaxBoost(uint256)": { - "notice": "Sets the maximum boost multiplier" - }, - "setMinBaseFee(uint256)": { - "notice": "Sets the minimum rewarded gas fee" - }, - "setMinBoost(uint256)": { - "notice": "Sets the minimum boost multiplier" - }, - "setMinPriorityFee(uint256)": { - "notice": "Sets the minimum rewarded gas priority fee" - }, - "setQuoteTwapTime(uint32)": { - "notice": "Sets the quote twap time" - }, - "setTargetBond(uint256)": { - "notice": "Sets the target bond amount" - }, - "setWorkExtraGas(uint256)": { - "notice": "Sets the work extra gas amount" - }, - "targetBond()": { - "notice": "The targeted amount of bonded KP3Rs to max-up reward multiplier For example: if the amount of KP3R the keeper has bonded is targetBond or more, then the keeper will get the maximum boost possible in his rewards, if it's less, the reward boost will be proportional" - }, - "workExtraGas()": { - "notice": "The amount of unaccounted gas that is going to be added to keeper payments" - } - }, - "version": 1 - }, - "storageLayout": { - "storage": [ - { - "astId": 5362, - "contract": "solidity/for-test/testnet/Keep3rHelperForTestnet.sol:Keep3rHelperForTestnet", - "label": "governance", - "offset": 0, - "slot": "0", - "type": "t_address" - }, - { - "astId": 5366, - "contract": "solidity/for-test/testnet/Keep3rHelperForTestnet.sol:Keep3rHelperForTestnet", - "label": "pendingGovernance", - "offset": 0, - "slot": "1", - "type": "t_address" - }, - { - "astId": 2989, - "contract": "solidity/for-test/testnet/Keep3rHelperForTestnet.sol:Keep3rHelperForTestnet", - "label": "minBoost", - "offset": 0, - "slot": "2", - "type": "t_uint256" - }, - { - "astId": 2994, - "contract": "solidity/for-test/testnet/Keep3rHelperForTestnet.sol:Keep3rHelperForTestnet", - "label": "maxBoost", - "offset": 0, - "slot": "3", - "type": "t_uint256" - }, - { - "astId": 2999, - "contract": "solidity/for-test/testnet/Keep3rHelperForTestnet.sol:Keep3rHelperForTestnet", - "label": "targetBond", - "offset": 0, - "slot": "4", - "type": "t_uint256" - }, - { - "astId": 3004, - "contract": "solidity/for-test/testnet/Keep3rHelperForTestnet.sol:Keep3rHelperForTestnet", - "label": "workExtraGas", - "offset": 0, - "slot": "5", - "type": "t_uint256" - }, - { - "astId": 3009, - "contract": "solidity/for-test/testnet/Keep3rHelperForTestnet.sol:Keep3rHelperForTestnet", - "label": "quoteTwapTime", - "offset": 0, - "slot": "6", - "type": "t_uint32" - }, - { - "astId": 3014, - "contract": "solidity/for-test/testnet/Keep3rHelperForTestnet.sol:Keep3rHelperForTestnet", - "label": "minBaseFee", - "offset": 0, - "slot": "7", - "type": "t_uint256" - }, - { - "astId": 3019, - "contract": "solidity/for-test/testnet/Keep3rHelperForTestnet.sol:Keep3rHelperForTestnet", - "label": "minPriorityFee", - "offset": 0, - "slot": "8", - "type": "t_uint256" - }, - { - "astId": 3023, - "contract": "solidity/for-test/testnet/Keep3rHelperForTestnet.sol:Keep3rHelperForTestnet", - "label": "keep3rV2", - "offset": 0, - "slot": "9", - "type": "t_address" - }, - { - "astId": 3028, - "contract": "solidity/for-test/testnet/Keep3rHelperForTestnet.sol:Keep3rHelperForTestnet", - "label": "kp3rWethPool", - "offset": 0, - "slot": "10", - "type": "t_struct(TokenOraclePool)12811_storage" - } - ], - "types": { - "t_address": { - "encoding": "inplace", - "label": "address", - "numberOfBytes": "20" - }, - "t_bool": { - "encoding": "inplace", - "label": "bool", - "numberOfBytes": "1" - }, - "t_struct(TokenOraclePool)12811_storage": { - "encoding": "inplace", - "label": "struct IKeep3rHelperParameters.TokenOraclePool", - "members": [ - { - "astId": 12808, - "contract": "solidity/for-test/testnet/Keep3rHelperForTestnet.sol:Keep3rHelperForTestnet", - "label": "poolAddress", - "offset": 0, - "slot": "0", - "type": "t_address" - }, - { - "astId": 12810, - "contract": "solidity/for-test/testnet/Keep3rHelperForTestnet.sol:Keep3rHelperForTestnet", - "label": "isTKNToken0", - "offset": 20, - "slot": "0", - "type": "t_bool" - } - ], - "numberOfBytes": "32" - }, - "t_uint256": { - "encoding": "inplace", - "label": "uint256", - "numberOfBytes": "32" - }, - "t_uint32": { - "encoding": "inplace", - "label": "uint32", - "numberOfBytes": "4" - } - } - } -} \ No newline at end of file diff --git a/deployments/goerli/UniV3PairManager.json b/deployments/goerli/UniV3PairManager.json deleted file mode 100644 index 6431ffd..0000000 --- a/deployments/goerli/UniV3PairManager.json +++ /dev/null @@ -1,1035 +0,0 @@ -{ - "address": "0xb4A7137B024d4C0531b0164fCb6E8fc20e6777Ae", - "abi": [ - { - "inputs": [ - { - "internalType": "address", - "name": "_pool", - "type": "address" - }, - { - "internalType": "address", - "name": "_governance", - "type": "address" - } - ], - "stateMutability": "nonpayable", - "type": "constructor" - }, - { - "inputs": [], - "name": "ExcessiveSlippage", - "type": "error" - }, - { - "inputs": [], - "name": "NoGovernanceZeroAddress", - "type": "error" - }, - { - "inputs": [], - "name": "OnlyGovernance", - "type": "error" - }, - { - "inputs": [], - "name": "OnlyPendingGovernance", - "type": "error" - }, - { - "inputs": [], - "name": "OnlyPool", - "type": "error" - }, - { - "inputs": [], - "name": "UnsuccessfulTransfer", - "type": "error" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "owner", - "type": "address" - }, - { - "indexed": true, - "internalType": "address", - "name": "spender", - "type": "address" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "value", - "type": "uint256" - } - ], - "name": "Approval", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "address", - "name": "_pendingGovernance", - "type": "address" - } - ], - "name": "GovernanceProposal", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "address", - "name": "_governance", - "type": "address" - } - ], - "name": "GovernanceSet", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "from", - "type": "address" - }, - { - "indexed": true, - "internalType": "address", - "name": "to", - "type": "address" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "value", - "type": "uint256" - } - ], - "name": "Transfer", - "type": "event" - }, - { - "inputs": [], - "name": "acceptGovernance", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - }, - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "name": "allowance", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "spender", - "type": "address" - }, - { - "internalType": "uint256", - "name": "amount", - "type": "uint256" - } - ], - "name": "approve", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "name": "balanceOf", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint128", - "name": "liquidity", - "type": "uint128" - }, - { - "internalType": "uint256", - "name": "amount0Min", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "amount1Min", - "type": "uint256" - }, - { - "internalType": "address", - "name": "to", - "type": "address" - } - ], - "name": "burn", - "outputs": [ - { - "internalType": "uint256", - "name": "amount0", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "amount1", - "type": "uint256" - } - ], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [], - "name": "collect", - "outputs": [ - { - "internalType": "uint256", - "name": "amount0", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "amount1", - "type": "uint256" - } - ], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [], - "name": "decimals", - "outputs": [ - { - "internalType": "uint8", - "name": "", - "type": "uint8" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "factory", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "fee", - "outputs": [ - { - "internalType": "uint24", - "name": "", - "type": "uint24" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "governance", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "amount0Desired", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "amount1Desired", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "amount0Min", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "amount1Min", - "type": "uint256" - }, - { - "internalType": "address", - "name": "to", - "type": "address" - } - ], - "name": "mint", - "outputs": [ - { - "internalType": "uint128", - "name": "liquidity", - "type": "uint128" - } - ], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [], - "name": "name", - "outputs": [ - { - "internalType": "string", - "name": "", - "type": "string" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "pendingGovernance", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "pool", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "position", - "outputs": [ - { - "internalType": "uint128", - "name": "liquidity", - "type": "uint128" - }, - { - "internalType": "uint256", - "name": "feeGrowthInside0LastX128", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "feeGrowthInside1LastX128", - "type": "uint256" - }, - { - "internalType": "uint128", - "name": "tokensOwed0", - "type": "uint128" - }, - { - "internalType": "uint128", - "name": "tokensOwed1", - "type": "uint128" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_governance", - "type": "address" - } - ], - "name": "setGovernance", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [], - "name": "sqrtRatioAX96", - "outputs": [ - { - "internalType": "uint160", - "name": "", - "type": "uint160" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "sqrtRatioBX96", - "outputs": [ - { - "internalType": "uint160", - "name": "", - "type": "uint160" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "symbol", - "outputs": [ - { - "internalType": "string", - "name": "", - "type": "string" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "tickLower", - "outputs": [ - { - "internalType": "int24", - "name": "", - "type": "int24" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "tickSpacing", - "outputs": [ - { - "internalType": "int24", - "name": "", - "type": "int24" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "tickUpper", - "outputs": [ - { - "internalType": "int24", - "name": "", - "type": "int24" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "token0", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "token1", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "totalSupply", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "to", - "type": "address" - }, - { - "internalType": "uint256", - "name": "amount", - "type": "uint256" - } - ], - "name": "transfer", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "from", - "type": "address" - }, - { - "internalType": "address", - "name": "to", - "type": "address" - }, - { - "internalType": "uint256", - "name": "amount", - "type": "uint256" - } - ], - "name": "transferFrom", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "amount0Owed", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "amount1Owed", - "type": "uint256" - }, - { - "internalType": "bytes", - "name": "data", - "type": "bytes" - } - ], - "name": "uniswapV3MintCallback", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - } - ], - "transactionHash": "0x686c566fca2e14ad05c8668b2713b6d7d3f9067247bc6cd58eb840ea1f51f4f0", - "receipt": { - "to": null, - "from": "0x258b180E741157763236F5277619D71ECf00B906", - "contractAddress": "0xb4A7137B024d4C0531b0164fCb6E8fc20e6777Ae", - "transactionIndex": 98, - "gasUsed": "2085137", - "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", - "blockHash": "0xb439a19b3d2509333f2534c8cc3c802dd324c5c199db4d444b066fc5f8d965e0", - "transactionHash": "0x686c566fca2e14ad05c8668b2713b6d7d3f9067247bc6cd58eb840ea1f51f4f0", - "logs": [], - "blockNumber": 8042997, - "cumulativeGasUsed": "21648565", - "status": 1, - "byzantium": true - }, - "args": [ - "0x317ceCd3eB02158f97DF0B67B788edCda4E066e5", - "0x258b180E741157763236F5277619D71ECf00B906" - ], - "numDeployments": 2, - "solcInputHash": "a2dd8c00aab95ba5d841446478d867fa", - "metadata": "{\"compiler\":{\"version\":\"0.8.7+commit.e28d00a7\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_pool\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"_governance\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"inputs\":[],\"name\":\"ExcessiveSlippage\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"NoGovernanceZeroAddress\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"OnlyGovernance\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"OnlyPendingGovernance\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"OnlyPool\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"UnsuccessfulTransfer\",\"type\":\"error\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"owner\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"spender\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"value\",\"type\":\"uint256\"}],\"name\":\"Approval\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"_pendingGovernance\",\"type\":\"address\"}],\"name\":\"GovernanceProposal\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"_governance\",\"type\":\"address\"}],\"name\":\"GovernanceSet\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"from\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"value\",\"type\":\"uint256\"}],\"name\":\"Transfer\",\"type\":\"event\"},{\"inputs\":[],\"name\":\"acceptGovernance\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"allowance\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"spender\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"approve\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"balanceOf\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint128\",\"name\":\"liquidity\",\"type\":\"uint128\"},{\"internalType\":\"uint256\",\"name\":\"amount0Min\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"amount1Min\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"}],\"name\":\"burn\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"amount0\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"amount1\",\"type\":\"uint256\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"collect\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"amount0\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"amount1\",\"type\":\"uint256\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"decimals\",\"outputs\":[{\"internalType\":\"uint8\",\"name\":\"\",\"type\":\"uint8\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"factory\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"fee\",\"outputs\":[{\"internalType\":\"uint24\",\"name\":\"\",\"type\":\"uint24\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"governance\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"amount0Desired\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"amount1Desired\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"amount0Min\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"amount1Min\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"}],\"name\":\"mint\",\"outputs\":[{\"internalType\":\"uint128\",\"name\":\"liquidity\",\"type\":\"uint128\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"name\",\"outputs\":[{\"internalType\":\"string\",\"name\":\"\",\"type\":\"string\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"pendingGovernance\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"pool\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"position\",\"outputs\":[{\"internalType\":\"uint128\",\"name\":\"liquidity\",\"type\":\"uint128\"},{\"internalType\":\"uint256\",\"name\":\"feeGrowthInside0LastX128\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"feeGrowthInside1LastX128\",\"type\":\"uint256\"},{\"internalType\":\"uint128\",\"name\":\"tokensOwed0\",\"type\":\"uint128\"},{\"internalType\":\"uint128\",\"name\":\"tokensOwed1\",\"type\":\"uint128\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_governance\",\"type\":\"address\"}],\"name\":\"setGovernance\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"sqrtRatioAX96\",\"outputs\":[{\"internalType\":\"uint160\",\"name\":\"\",\"type\":\"uint160\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"sqrtRatioBX96\",\"outputs\":[{\"internalType\":\"uint160\",\"name\":\"\",\"type\":\"uint160\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"symbol\",\"outputs\":[{\"internalType\":\"string\",\"name\":\"\",\"type\":\"string\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"tickLower\",\"outputs\":[{\"internalType\":\"int24\",\"name\":\"\",\"type\":\"int24\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"tickSpacing\",\"outputs\":[{\"internalType\":\"int24\",\"name\":\"\",\"type\":\"int24\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"tickUpper\",\"outputs\":[{\"internalType\":\"int24\",\"name\":\"\",\"type\":\"int24\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"token0\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"token1\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"totalSupply\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"transfer\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"from\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"transferFrom\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"amount0Owed\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"amount1Owed\",\"type\":\"uint256\"},{\"internalType\":\"bytes\",\"name\":\"data\",\"type\":\"bytes\"}],\"name\":\"uniswapV3MintCallback\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"}],\"devdoc\":{\"kind\":\"dev\",\"methods\":{\"approve(address,uint256)\":{\"details\":\"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.\"},\"burn(uint128,uint256,uint256,address)\":{\"params\":{\"amount0Min\":\"The minimum amount of token0 we want to send to the recipient (to)\",\"amount1Min\":\"The minimum amount of token1 we want to send to the recipient (to)\",\"liquidity\":\"The amount of liquidity to be burned\",\"to\":\"The address that will receive the due fees\"},\"returns\":{\"amount0\":\"The calculated amount of token0 that will be sent to the recipient\",\"amount1\":\"The calculated amount of token1 that will be sent to the recipient\"}},\"collect()\":{\"details\":\"The collected fees will be sent to governance\",\"returns\":{\"amount0\":\"The amount of fees collected in token0\",\"amount1\":\"The amount of fees collected in token1\"}},\"mint(uint256,uint256,uint256,uint256,address)\":{\"details\":\"Triggers UniV3PairManager#uniswapV3MintCallback\",\"params\":{\"amount0Desired\":\"The amount of token0 we would like to provide\",\"amount0Min\":\"The minimum amount of token0 we want to provide\",\"amount1Desired\":\"The amount of token1 we would like to provide\",\"amount1Min\":\"The minimum amount of token1 we want to provide\",\"to\":\"The address to which the kLP tokens are going to be minted to\"},\"returns\":{\"liquidity\":\"kLP tokens sent in exchange for the provision of tokens\"}},\"position()\":{\"returns\":{\"feeGrowthInside0LastX128\":\"The fee growth of token0 as of the last action on the individual position\",\"feeGrowthInside1LastX128\":\"The fee growth of token1 as of the last action on the individual position\",\"liquidity\":\"The amount of liquidity provided to the UniswapV3 pool by the pair manager\",\"tokensOwed0\":\"The uncollected amount of token0 owed to the position as of the last computation\",\"tokensOwed1\":\"The uncollected amount of token1 owed to the position as of the last computation\"}},\"setGovernance(address)\":{\"params\":{\"_governance\":\"The address being proposed as the new governance\"}},\"transfer(address,uint256)\":{\"details\":\"Moves `amount` tokens from the caller's account to `recipient`. Returns a boolean value indicating whether the operation succeeded. Emits a {Transfer} event.\"},\"transferFrom(address,address,uint256)\":{\"details\":\"Moves `amount` tokens from `sender` to `recipient` 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.\"},\"uniswapV3MintCallback(uint256,uint256,bytes)\":{\"params\":{\"amount0Owed\":\"The amount of token0 due to the pool for the minted liquidity\",\"amount1Owed\":\"The amount of token1 due to the pool for the minted liquidity\",\"data\":\"The encoded token0, token1, fee (_poolKey) and the payer (msg.sender) of the IUniV3PairManager#mint function\"}}},\"stateVariables\":{\"_MAX_TICK\":{\"details\":\"Due to tick spacing, pools with different fees may have differences between _MAX_TICK and tickUpper. Use tickUpper to find the max tick of the pool.\"},\"allowance\":{\"details\":\"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.\"},\"balanceOf\":{\"details\":\"Returns the amount of tokens owned by `account`.\"},\"decimals\":{\"details\":\"Returns the decimals places of the token.\"},\"factory\":{\"return\":\"_factory The address of the PairManager Factory\",\"returns\":{\"_0\":\"_factory The address of the PairManager Factory\"}},\"fee\":{\"return\":\"_fee The fee of the Uniswap pool passed into the constructor\",\"returns\":{\"_0\":\"_fee The fee of the Uniswap pool passed into the constructor\"}},\"name\":{\"details\":\"Returns the name of the token.\"},\"pool\":{\"return\":\"_pool The address of the pool\",\"returns\":{\"_0\":\"_pool The address of the pool\"}},\"sqrtRatioAX96\":{\"return\":\"_sqrtPriceA96 A Fixed point Q64.96 number representing the sqrt of the ratio of the two assets (token1/token0) at the lowest tick\",\"returns\":{\"_0\":\"_sqrtPriceA96 A Fixed point Q64.96 number representing the sqrt of the ratio of the two assets (token1/token0) at the lowest tick\"}},\"sqrtRatioBX96\":{\"return\":\"_sqrtPriceBX96 A Fixed point Q64.96 number representing the sqrt of the ratio of the two assets (token1/token0) at the highest tick\",\"returns\":{\"_0\":\"_sqrtPriceBX96 A Fixed point Q64.96 number representing the sqrt of the ratio of the two assets (token1/token0) at the highest tick\"}},\"symbol\":{\"details\":\"Returns the symbol of the token.\"},\"tickLower\":{\"return\":\"_tickLower The lower tick in the Uniswap's curve\",\"returns\":{\"_0\":\"_tickLower The lower tick in the Uniswap's curve\"}},\"tickSpacing\":{\"return\":\"_tickSpacing The pair tick spacing\",\"returns\":{\"_0\":\"_tickSpacing The pair tick spacing\"}},\"tickUpper\":{\"return\":\"_tickUpper The highest tick in the Uniswap's curve\",\"returns\":{\"_0\":\"_tickUpper The highest tick in the Uniswap's curve\"}},\"token0\":{\"return\":\"_token0 The address of token0\",\"returns\":{\"_0\":\"_token0 The address of token0\"}},\"token1\":{\"return\":\"_token1 The address of token1\",\"returns\":{\"_0\":\"_token1 The address of token1\"}},\"totalSupply\":{\"details\":\"Returns the amount of tokens in existence.\"}},\"version\":1},\"userdoc\":{\"errors\":{\"ExcessiveSlippage()\":[{\"notice\":\"Throws when the slippage exceeds what the user is comfortable with\"}],\"NoGovernanceZeroAddress()\":[{\"notice\":\"Throws if trying to set governance to zero address\"}],\"OnlyGovernance()\":[{\"notice\":\"Throws if the caller of the function is not governance\"}],\"OnlyPendingGovernance()\":[{\"notice\":\"Throws if the caller of the function is not pendingGovernance\"}],\"OnlyPool()\":[{\"notice\":\"Throws when the caller of the function is not the pool\"}],\"UnsuccessfulTransfer()\":[{\"notice\":\"Throws when a transfer is unsuccessful\"}]},\"events\":{\"GovernanceProposal(address)\":{\"notice\":\"Emitted when a new governance is proposed\"},\"GovernanceSet(address)\":{\"notice\":\"Emitted when pendingGovernance accepts to be governance\"}},\"kind\":\"user\",\"methods\":{\"acceptGovernance()\":{\"notice\":\"Changes the governance from the current governance to the previously proposed address\"},\"factory()\":{\"notice\":\"Address of the factory from which the pair manager was created\"},\"fee()\":{\"notice\":\"The fee of the Uniswap pool passed into the constructor\"},\"governance()\":{\"notice\":\"Stores the governance address\"},\"mint(uint256,uint256,uint256,uint256,address)\":{\"notice\":\"Mints kLP tokens to an address according to the liquidity the msg.sender provides to the UniswapV3 pool\"},\"pendingGovernance()\":{\"notice\":\"Stores the pendingGovernance address\"},\"pool()\":{\"notice\":\"Address of the pool from which the Keep3r pair manager will interact with\"},\"position()\":{\"notice\":\"Returns the pair manager's position in the corresponding UniswapV3 pool\"},\"setGovernance(address)\":{\"notice\":\"Proposes a new address to be governance\"},\"sqrtRatioAX96()\":{\"notice\":\"The sqrtRatioAX96 at the lowest tick (-887200) of the Uniswap pool\"},\"sqrtRatioBX96()\":{\"notice\":\"The sqrtRatioBX96 at the highest tick (887200) of the Uniswap pool\"},\"tickLower()\":{\"notice\":\"Lowest tick in the Uniswap's curve\"},\"tickSpacing()\":{\"notice\":\"The pair tick spacing\"},\"tickUpper()\":{\"notice\":\"Highest tick in the Uniswap's curve\"},\"token0()\":{\"notice\":\"Token0 of the pool\"},\"token1()\":{\"notice\":\"Token1 of the pool\"},\"uniswapV3MintCallback(uint256,uint256,bytes)\":{\"notice\":\"This function is called after a user calls IUniV3PairManager#mint function It ensures that any tokens owed to the pool are paid by the msg.sender of IUniV3PairManager#mint function\"}},\"version\":1}},\"settings\":{\"compilationTarget\":{\"solidity/contracts/UniV3PairManager.sol\":\"UniV3PairManager\"},\"evmVersion\":\"london\",\"libraries\":{\":__CACHE_BREAKER__\":\"0x00000000d41867734bbee4c6863d9255b2b06ac1\"},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":33},\"remappings\":[]},\"sources\":{\"@openzeppelin/contracts/token/ERC20/ERC20.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"./IERC20.sol\\\";\\nimport \\\"./extensions/IERC20Metadata.sol\\\";\\nimport \\\"../../utils/Context.sol\\\";\\n\\n/**\\n * @dev Implementation of the {IERC20} interface.\\n *\\n * This implementation is agnostic to the way tokens are created. This means\\n * that a supply mechanism has to be added in a derived contract using {_mint}.\\n * For a generic mechanism see {ERC20PresetMinterPauser}.\\n *\\n * TIP: For a detailed writeup see our guide\\n * https://forum.zeppelin.solutions/t/how-to-implement-erc20-supply-mechanisms/226[How\\n * to implement supply mechanisms].\\n *\\n * We have followed general OpenZeppelin Contracts guidelines: functions revert\\n * instead returning `false` on failure. This behavior is nonetheless\\n * conventional and does not conflict with the expectations of ERC20\\n * applications.\\n *\\n * Additionally, an {Approval} event is emitted on calls to {transferFrom}.\\n * This allows applications to reconstruct the allowance for all accounts just\\n * by listening to said events. Other implementations of the EIP may not emit\\n * these events, as it isn't required by the specification.\\n *\\n * Finally, the non-standard {decreaseAllowance} and {increaseAllowance}\\n * functions have been added to mitigate the well-known issues around setting\\n * allowances. See {IERC20-approve}.\\n */\\ncontract ERC20 is Context, IERC20, IERC20Metadata {\\n mapping(address => uint256) private _balances;\\n\\n mapping(address => mapping(address => uint256)) private _allowances;\\n\\n uint256 private _totalSupply;\\n\\n string private _name;\\n string private _symbol;\\n\\n /**\\n * @dev Sets the values for {name} and {symbol}.\\n *\\n * The default value of {decimals} is 18. To select a different value for\\n * {decimals} you should overload it.\\n *\\n * All two of these values are immutable: they can only be set once during\\n * construction.\\n */\\n constructor(string memory name_, string memory symbol_) {\\n _name = name_;\\n _symbol = symbol_;\\n }\\n\\n /**\\n * @dev Returns the name of the token.\\n */\\n function name() public view virtual override returns (string memory) {\\n return _name;\\n }\\n\\n /**\\n * @dev Returns the symbol of the token, usually a shorter version of the\\n * name.\\n */\\n function symbol() public view virtual override returns (string memory) {\\n return _symbol;\\n }\\n\\n /**\\n * @dev Returns the number of decimals used to get its user representation.\\n * For example, if `decimals` equals `2`, a balance of `505` tokens should\\n * be displayed to a user as `5.05` (`505 / 10 ** 2`).\\n *\\n * Tokens usually opt for a value of 18, imitating the relationship between\\n * Ether and Wei. This is the value {ERC20} uses, unless this function is\\n * overridden;\\n *\\n * NOTE: This information is only used for _display_ purposes: it in\\n * no way affects any of the arithmetic of the contract, including\\n * {IERC20-balanceOf} and {IERC20-transfer}.\\n */\\n function decimals() public view virtual override returns (uint8) {\\n return 18;\\n }\\n\\n /**\\n * @dev See {IERC20-totalSupply}.\\n */\\n function totalSupply() public view virtual override returns (uint256) {\\n return _totalSupply;\\n }\\n\\n /**\\n * @dev See {IERC20-balanceOf}.\\n */\\n function balanceOf(address account) public view virtual override returns (uint256) {\\n return _balances[account];\\n }\\n\\n /**\\n * @dev See {IERC20-transfer}.\\n *\\n * Requirements:\\n *\\n * - `recipient` cannot be the zero address.\\n * - the caller must have a balance of at least `amount`.\\n */\\n function transfer(address recipient, uint256 amount) public virtual override returns (bool) {\\n _transfer(_msgSender(), recipient, amount);\\n return true;\\n }\\n\\n /**\\n * @dev See {IERC20-allowance}.\\n */\\n function allowance(address owner, address spender) public view virtual override returns (uint256) {\\n return _allowances[owner][spender];\\n }\\n\\n /**\\n * @dev See {IERC20-approve}.\\n *\\n * Requirements:\\n *\\n * - `spender` cannot be the zero address.\\n */\\n function approve(address spender, uint256 amount) public virtual override returns (bool) {\\n _approve(_msgSender(), spender, amount);\\n return true;\\n }\\n\\n /**\\n * @dev See {IERC20-transferFrom}.\\n *\\n * Emits an {Approval} event indicating the updated allowance. This is not\\n * required by the EIP. See the note at the beginning of {ERC20}.\\n *\\n * Requirements:\\n *\\n * - `sender` and `recipient` cannot be the zero address.\\n * - `sender` must have a balance of at least `amount`.\\n * - the caller must have allowance for ``sender``'s tokens of at least\\n * `amount`.\\n */\\n function transferFrom(\\n address sender,\\n address recipient,\\n uint256 amount\\n ) public virtual override returns (bool) {\\n _transfer(sender, recipient, amount);\\n\\n uint256 currentAllowance = _allowances[sender][_msgSender()];\\n require(currentAllowance >= amount, \\\"ERC20: transfer amount exceeds allowance\\\");\\n unchecked {\\n _approve(sender, _msgSender(), currentAllowance - amount);\\n }\\n\\n return true;\\n }\\n\\n /**\\n * @dev Atomically increases the allowance granted to `spender` by the caller.\\n *\\n * This is an alternative to {approve} that can be used as a mitigation for\\n * problems described in {IERC20-approve}.\\n *\\n * Emits an {Approval} event indicating the updated allowance.\\n *\\n * Requirements:\\n *\\n * - `spender` cannot be the zero address.\\n */\\n function increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool) {\\n _approve(_msgSender(), spender, _allowances[_msgSender()][spender] + addedValue);\\n return true;\\n }\\n\\n /**\\n * @dev Atomically decreases the allowance granted to `spender` by the caller.\\n *\\n * This is an alternative to {approve} that can be used as a mitigation for\\n * problems described in {IERC20-approve}.\\n *\\n * Emits an {Approval} event indicating the updated allowance.\\n *\\n * Requirements:\\n *\\n * - `spender` cannot be the zero address.\\n * - `spender` must have allowance for the caller of at least\\n * `subtractedValue`.\\n */\\n function decreaseAllowance(address spender, uint256 subtractedValue) public virtual returns (bool) {\\n uint256 currentAllowance = _allowances[_msgSender()][spender];\\n require(currentAllowance >= subtractedValue, \\\"ERC20: decreased allowance below zero\\\");\\n unchecked {\\n _approve(_msgSender(), spender, currentAllowance - subtractedValue);\\n }\\n\\n return true;\\n }\\n\\n /**\\n * @dev Moves `amount` of tokens from `sender` to `recipient`.\\n *\\n * This internal function is equivalent to {transfer}, and can be used to\\n * e.g. implement automatic token fees, slashing mechanisms, etc.\\n *\\n * Emits a {Transfer} event.\\n *\\n * Requirements:\\n *\\n * - `sender` cannot be the zero address.\\n * - `recipient` cannot be the zero address.\\n * - `sender` must have a balance of at least `amount`.\\n */\\n function _transfer(\\n address sender,\\n address recipient,\\n uint256 amount\\n ) internal virtual {\\n require(sender != address(0), \\\"ERC20: transfer from the zero address\\\");\\n require(recipient != address(0), \\\"ERC20: transfer to the zero address\\\");\\n\\n _beforeTokenTransfer(sender, recipient, amount);\\n\\n uint256 senderBalance = _balances[sender];\\n require(senderBalance >= amount, \\\"ERC20: transfer amount exceeds balance\\\");\\n unchecked {\\n _balances[sender] = senderBalance - amount;\\n }\\n _balances[recipient] += amount;\\n\\n emit Transfer(sender, recipient, amount);\\n\\n _afterTokenTransfer(sender, recipient, amount);\\n }\\n\\n /** @dev Creates `amount` tokens and assigns them to `account`, increasing\\n * the total supply.\\n *\\n * Emits a {Transfer} event with `from` set to the zero address.\\n *\\n * Requirements:\\n *\\n * - `account` cannot be the zero address.\\n */\\n function _mint(address account, uint256 amount) internal virtual {\\n require(account != address(0), \\\"ERC20: mint to the zero address\\\");\\n\\n _beforeTokenTransfer(address(0), account, amount);\\n\\n _totalSupply += amount;\\n _balances[account] += amount;\\n emit Transfer(address(0), account, amount);\\n\\n _afterTokenTransfer(address(0), account, amount);\\n }\\n\\n /**\\n * @dev Destroys `amount` tokens from `account`, reducing the\\n * total supply.\\n *\\n * Emits a {Transfer} event with `to` set to the zero address.\\n *\\n * Requirements:\\n *\\n * - `account` cannot be the zero address.\\n * - `account` must have at least `amount` tokens.\\n */\\n function _burn(address account, uint256 amount) internal virtual {\\n require(account != address(0), \\\"ERC20: burn from the zero address\\\");\\n\\n _beforeTokenTransfer(account, address(0), amount);\\n\\n uint256 accountBalance = _balances[account];\\n require(accountBalance >= amount, \\\"ERC20: burn amount exceeds balance\\\");\\n unchecked {\\n _balances[account] = accountBalance - amount;\\n }\\n _totalSupply -= amount;\\n\\n emit Transfer(account, address(0), amount);\\n\\n _afterTokenTransfer(account, address(0), amount);\\n }\\n\\n /**\\n * @dev Sets `amount` as the allowance of `spender` over the `owner` s tokens.\\n *\\n * This internal function is equivalent to `approve`, and can be used to\\n * e.g. set automatic allowances for certain subsystems, etc.\\n *\\n * Emits an {Approval} event.\\n *\\n * Requirements:\\n *\\n * - `owner` cannot be the zero address.\\n * - `spender` cannot be the zero address.\\n */\\n function _approve(\\n address owner,\\n address spender,\\n uint256 amount\\n ) internal virtual {\\n require(owner != address(0), \\\"ERC20: approve from the zero address\\\");\\n require(spender != address(0), \\\"ERC20: approve to the zero address\\\");\\n\\n _allowances[owner][spender] = amount;\\n emit Approval(owner, spender, amount);\\n }\\n\\n /**\\n * @dev Hook that is called before any transfer of tokens. This includes\\n * minting and burning.\\n *\\n * Calling conditions:\\n *\\n * - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens\\n * will be transferred to `to`.\\n * - when `from` is zero, `amount` tokens will be minted for `to`.\\n * - when `to` is zero, `amount` of ``from``'s tokens will be burned.\\n * - `from` and `to` are never both zero.\\n *\\n * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].\\n */\\n function _beforeTokenTransfer(\\n address from,\\n address to,\\n uint256 amount\\n ) internal virtual {}\\n\\n /**\\n * @dev Hook that is called after any transfer of tokens. This includes\\n * minting and burning.\\n *\\n * Calling conditions:\\n *\\n * - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens\\n * has been transferred to `to`.\\n * - when `from` is zero, `amount` tokens have been minted for `to`.\\n * - when `to` is zero, `amount` of ``from``'s tokens have been burned.\\n * - `from` and `to` are never both zero.\\n *\\n * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].\\n */\\n function _afterTokenTransfer(\\n address from,\\n address to,\\n uint256 amount\\n ) internal virtual {}\\n}\\n\",\"keccak256\":\"0xb03df8481a954604ad0c9125680893b2e3f7ff770fe470e38b89ac61b84e8072\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC20/IERC20.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Interface of the ERC20 standard as defined in the EIP.\\n */\\ninterface IERC20 {\\n /**\\n * @dev Returns the amount of tokens in existence.\\n */\\n function totalSupply() external view returns (uint256);\\n\\n /**\\n * @dev Returns the amount of tokens owned by `account`.\\n */\\n function balanceOf(address account) external view returns (uint256);\\n\\n /**\\n * @dev Moves `amount` tokens from the caller's account to `recipient`.\\n *\\n * Returns a boolean value indicating whether the operation succeeded.\\n *\\n * Emits a {Transfer} event.\\n */\\n function transfer(address recipient, uint256 amount) external returns (bool);\\n\\n /**\\n * @dev Returns the remaining number of tokens that `spender` will be\\n * allowed to spend on behalf of `owner` through {transferFrom}. This is\\n * zero by default.\\n *\\n * This value changes when {approve} or {transferFrom} are called.\\n */\\n function allowance(address owner, address spender) external view returns (uint256);\\n\\n /**\\n * @dev Sets `amount` as the allowance of `spender` over the caller's tokens.\\n *\\n * Returns a boolean value indicating whether the operation succeeded.\\n *\\n * IMPORTANT: Beware that changing an allowance with this method brings the risk\\n * that someone may use both the old and the new allowance by unfortunate\\n * transaction ordering. One possible solution to mitigate this race\\n * condition is to first reduce the spender's allowance to 0 and set the\\n * desired value afterwards:\\n * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729\\n *\\n * Emits an {Approval} event.\\n */\\n function approve(address spender, uint256 amount) external returns (bool);\\n\\n /**\\n * @dev Moves `amount` tokens from `sender` to `recipient` using the\\n * allowance mechanism. `amount` is then deducted from the caller's\\n * allowance.\\n *\\n * Returns a boolean value indicating whether the operation succeeded.\\n *\\n * Emits a {Transfer} event.\\n */\\n function transferFrom(\\n address sender,\\n address recipient,\\n uint256 amount\\n ) external returns (bool);\\n\\n /**\\n * @dev Emitted when `value` tokens are moved from one account (`from`) to\\n * another (`to`).\\n *\\n * Note that `value` may be zero.\\n */\\n event Transfer(address indexed from, address indexed to, uint256 value);\\n\\n /**\\n * @dev Emitted when the allowance of a `spender` for an `owner` is set by\\n * a call to {approve}. `value` is the new allowance.\\n */\\n event Approval(address indexed owner, address indexed spender, uint256 value);\\n}\\n\",\"keccak256\":\"0x027b891937d20ccf213fdb9c31531574256de774bda99d3a70ecef6e1913ed2a\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../IERC20.sol\\\";\\n\\n/**\\n * @dev Interface for the optional metadata functions from the ERC20 standard.\\n *\\n * _Available since v4.1._\\n */\\ninterface IERC20Metadata is IERC20 {\\n /**\\n * @dev Returns the name of the token.\\n */\\n function name() external view returns (string memory);\\n\\n /**\\n * @dev Returns the symbol of the token.\\n */\\n function symbol() external view returns (string memory);\\n\\n /**\\n * @dev Returns the decimals places of the token.\\n */\\n function decimals() external view returns (uint8);\\n}\\n\",\"keccak256\":\"0x83fe24f5c04a56091e50f4a345ff504c8bff658a76d4c43b16878c8f940c53b2\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/Context.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Provides information about the current execution context, including the\\n * sender of the transaction and its data. While these are generally available\\n * via msg.sender and msg.data, they should not be accessed in such a direct\\n * manner, since when dealing with meta-transactions the account sending and\\n * paying for execution may not be the actual sender (as far as an application\\n * is concerned).\\n *\\n * This contract is only required for intermediate, library-like contracts.\\n */\\nabstract contract Context {\\n function _msgSender() internal view virtual returns (address) {\\n return msg.sender;\\n }\\n\\n function _msgData() internal view virtual returns (bytes calldata) {\\n return msg.data;\\n }\\n}\\n\",\"keccak256\":\"0x90565a39ae45c80f0468dc96c7b20d0afc3055f344c8203a0c9258239f350b9f\",\"license\":\"MIT\"},\"@uniswap/v3-core/contracts/interfaces/IUniswapV3Pool.sol\":{\"content\":\"// SPDX-License-Identifier: GPL-2.0-or-later\\npragma solidity >=0.5.0;\\n\\nimport './pool/IUniswapV3PoolImmutables.sol';\\nimport './pool/IUniswapV3PoolState.sol';\\nimport './pool/IUniswapV3PoolDerivedState.sol';\\nimport './pool/IUniswapV3PoolActions.sol';\\nimport './pool/IUniswapV3PoolOwnerActions.sol';\\nimport './pool/IUniswapV3PoolEvents.sol';\\n\\n/// @title The interface for a Uniswap V3 Pool\\n/// @notice A Uniswap pool facilitates swapping and automated market making between any two assets that strictly conform\\n/// to the ERC20 specification\\n/// @dev The pool interface is broken up into many smaller pieces\\ninterface IUniswapV3Pool is\\n IUniswapV3PoolImmutables,\\n IUniswapV3PoolState,\\n IUniswapV3PoolDerivedState,\\n IUniswapV3PoolActions,\\n IUniswapV3PoolOwnerActions,\\n IUniswapV3PoolEvents\\n{\\n\\n}\\n\",\"keccak256\":\"0xfe6113d518466cd6652c85b111e01f33eb62157f49ae5ed7d5a3947a2044adb1\",\"license\":\"GPL-2.0-or-later\"},\"@uniswap/v3-core/contracts/interfaces/pool/IUniswapV3PoolActions.sol\":{\"content\":\"// SPDX-License-Identifier: GPL-2.0-or-later\\npragma solidity >=0.5.0;\\n\\n/// @title Permissionless pool actions\\n/// @notice Contains pool methods that can be called by anyone\\ninterface IUniswapV3PoolActions {\\n /// @notice Sets the initial price for the pool\\n /// @dev Price is represented as a sqrt(amountToken1/amountToken0) Q64.96 value\\n /// @param sqrtPriceX96 the initial sqrt price of the pool as a Q64.96\\n function initialize(uint160 sqrtPriceX96) external;\\n\\n /// @notice Adds liquidity for the given recipient/tickLower/tickUpper position\\n /// @dev The caller of this method receives a callback in the form of IUniswapV3MintCallback#uniswapV3MintCallback\\n /// in which they must pay any token0 or token1 owed for the liquidity. The amount of token0/token1 due depends\\n /// on tickLower, tickUpper, the amount of liquidity, and the current price.\\n /// @param recipient The address for which the liquidity will be created\\n /// @param tickLower The lower tick of the position in which to add liquidity\\n /// @param tickUpper The upper tick of the position in which to add liquidity\\n /// @param amount The amount of liquidity to mint\\n /// @param data Any data that should be passed through to the callback\\n /// @return amount0 The amount of token0 that was paid to mint the given amount of liquidity. Matches the value in the callback\\n /// @return amount1 The amount of token1 that was paid to mint the given amount of liquidity. Matches the value in the callback\\n function mint(\\n address recipient,\\n int24 tickLower,\\n int24 tickUpper,\\n uint128 amount,\\n bytes calldata data\\n ) external returns (uint256 amount0, uint256 amount1);\\n\\n /// @notice Collects tokens owed to a position\\n /// @dev Does not recompute fees earned, which must be done either via mint or burn of any amount of liquidity.\\n /// Collect must be called by the position owner. To withdraw only token0 or only token1, amount0Requested or\\n /// amount1Requested may be set to zero. To withdraw all tokens owed, caller may pass any value greater than the\\n /// actual tokens owed, e.g. type(uint128).max. Tokens owed may be from accumulated swap fees or burned liquidity.\\n /// @param recipient The address which should receive the fees collected\\n /// @param tickLower The lower tick of the position for which to collect fees\\n /// @param tickUpper The upper tick of the position for which to collect fees\\n /// @param amount0Requested How much token0 should be withdrawn from the fees owed\\n /// @param amount1Requested How much token1 should be withdrawn from the fees owed\\n /// @return amount0 The amount of fees collected in token0\\n /// @return amount1 The amount of fees collected in token1\\n function collect(\\n address recipient,\\n int24 tickLower,\\n int24 tickUpper,\\n uint128 amount0Requested,\\n uint128 amount1Requested\\n ) external returns (uint128 amount0, uint128 amount1);\\n\\n /// @notice Burn liquidity from the sender and account tokens owed for the liquidity to the position\\n /// @dev Can be used to trigger a recalculation of fees owed to a position by calling with an amount of 0\\n /// @dev Fees must be collected separately via a call to #collect\\n /// @param tickLower The lower tick of the position for which to burn liquidity\\n /// @param tickUpper The upper tick of the position for which to burn liquidity\\n /// @param amount How much liquidity to burn\\n /// @return amount0 The amount of token0 sent to the recipient\\n /// @return amount1 The amount of token1 sent to the recipient\\n function burn(\\n int24 tickLower,\\n int24 tickUpper,\\n uint128 amount\\n ) external returns (uint256 amount0, uint256 amount1);\\n\\n /// @notice Swap token0 for token1, or token1 for token0\\n /// @dev The caller of this method receives a callback in the form of IUniswapV3SwapCallback#uniswapV3SwapCallback\\n /// @param recipient The address to receive the output of the swap\\n /// @param zeroForOne The direction of the swap, true for token0 to token1, false for token1 to token0\\n /// @param amountSpecified The amount of the swap, which implicitly configures the swap as exact input (positive), or exact output (negative)\\n /// @param sqrtPriceLimitX96 The Q64.96 sqrt price limit. If zero for one, the price cannot be less than this\\n /// value after the swap. If one for zero, the price cannot be greater than this value after the swap\\n /// @param data Any data to be passed through to the callback\\n /// @return amount0 The delta of the balance of token0 of the pool, exact when negative, minimum when positive\\n /// @return amount1 The delta of the balance of token1 of the pool, exact when negative, minimum when positive\\n function swap(\\n address recipient,\\n bool zeroForOne,\\n int256 amountSpecified,\\n uint160 sqrtPriceLimitX96,\\n bytes calldata data\\n ) external returns (int256 amount0, int256 amount1);\\n\\n /// @notice Receive token0 and/or token1 and pay it back, plus a fee, in the callback\\n /// @dev The caller of this method receives a callback in the form of IUniswapV3FlashCallback#uniswapV3FlashCallback\\n /// @dev Can be used to donate underlying tokens pro-rata to currently in-range liquidity providers by calling\\n /// with 0 amount{0,1} and sending the donation amount(s) from the callback\\n /// @param recipient The address which will receive the token0 and token1 amounts\\n /// @param amount0 The amount of token0 to send\\n /// @param amount1 The amount of token1 to send\\n /// @param data Any data to be passed through to the callback\\n function flash(\\n address recipient,\\n uint256 amount0,\\n uint256 amount1,\\n bytes calldata data\\n ) external;\\n\\n /// @notice Increase the maximum number of price and liquidity observations that this pool will store\\n /// @dev This method is no-op if the pool already has an observationCardinalityNext greater than or equal to\\n /// the input observationCardinalityNext.\\n /// @param observationCardinalityNext The desired minimum number of observations for the pool to store\\n function increaseObservationCardinalityNext(uint16 observationCardinalityNext) external;\\n}\\n\",\"keccak256\":\"0x9453dd0e7442188667d01d9b65de3f1e14e9511ff3e303179a15f6fc267f7634\",\"license\":\"GPL-2.0-or-later\"},\"@uniswap/v3-core/contracts/interfaces/pool/IUniswapV3PoolDerivedState.sol\":{\"content\":\"// SPDX-License-Identifier: GPL-2.0-or-later\\npragma solidity >=0.5.0;\\n\\n/// @title Pool state that is not stored\\n/// @notice Contains view functions to provide information about the pool that is computed rather than stored on the\\n/// blockchain. The functions here may have variable gas costs.\\ninterface IUniswapV3PoolDerivedState {\\n /// @notice Returns the cumulative tick and liquidity as of each timestamp `secondsAgo` from the current block timestamp\\n /// @dev To get a time weighted average tick or liquidity-in-range, you must call this with two values, one representing\\n /// the beginning of the period and another for the end of the period. E.g., to get the last hour time-weighted average tick,\\n /// you must call it with secondsAgos = [3600, 0].\\n /// @dev The time weighted average tick represents the geometric time weighted average price of the pool, in\\n /// log base sqrt(1.0001) of token1 / token0. The TickMath library can be used to go from a tick value to a ratio.\\n /// @param secondsAgos From how long ago each cumulative tick and liquidity value should be returned\\n /// @return tickCumulatives Cumulative tick values as of each `secondsAgos` from the current block timestamp\\n /// @return secondsPerLiquidityCumulativeX128s Cumulative seconds per liquidity-in-range value as of each `secondsAgos` from the current block\\n /// timestamp\\n function observe(uint32[] calldata secondsAgos)\\n external\\n view\\n returns (int56[] memory tickCumulatives, uint160[] memory secondsPerLiquidityCumulativeX128s);\\n\\n /// @notice Returns a snapshot of the tick cumulative, seconds per liquidity and seconds inside a tick range\\n /// @dev Snapshots must only be compared to other snapshots, taken over a period for which a position existed.\\n /// I.e., snapshots cannot be compared if a position is not held for the entire period between when the first\\n /// snapshot is taken and the second snapshot is taken.\\n /// @param tickLower The lower tick of the range\\n /// @param tickUpper The upper tick of the range\\n /// @return tickCumulativeInside The snapshot of the tick accumulator for the range\\n /// @return secondsPerLiquidityInsideX128 The snapshot of seconds per liquidity for the range\\n /// @return secondsInside The snapshot of seconds per liquidity for the range\\n function snapshotCumulativesInside(int24 tickLower, int24 tickUpper)\\n external\\n view\\n returns (\\n int56 tickCumulativeInside,\\n uint160 secondsPerLiquidityInsideX128,\\n uint32 secondsInside\\n );\\n}\\n\",\"keccak256\":\"0xe603ac5b17ecdee73ba2b27efdf386c257a19c14206e87eee77e2017b742d9e5\",\"license\":\"GPL-2.0-or-later\"},\"@uniswap/v3-core/contracts/interfaces/pool/IUniswapV3PoolEvents.sol\":{\"content\":\"// SPDX-License-Identifier: GPL-2.0-or-later\\npragma solidity >=0.5.0;\\n\\n/// @title Events emitted by a pool\\n/// @notice Contains all events emitted by the pool\\ninterface IUniswapV3PoolEvents {\\n /// @notice Emitted exactly once by a pool when #initialize is first called on the pool\\n /// @dev Mint/Burn/Swap cannot be emitted by the pool before Initialize\\n /// @param sqrtPriceX96 The initial sqrt price of the pool, as a Q64.96\\n /// @param tick The initial tick of the pool, i.e. log base 1.0001 of the starting price of the pool\\n event Initialize(uint160 sqrtPriceX96, int24 tick);\\n\\n /// @notice Emitted when liquidity is minted for a given position\\n /// @param sender The address that minted the liquidity\\n /// @param owner The owner of the position and recipient of any minted liquidity\\n /// @param tickLower The lower tick of the position\\n /// @param tickUpper The upper tick of the position\\n /// @param amount The amount of liquidity minted to the position range\\n /// @param amount0 How much token0 was required for the minted liquidity\\n /// @param amount1 How much token1 was required for the minted liquidity\\n event Mint(\\n address sender,\\n address indexed owner,\\n int24 indexed tickLower,\\n int24 indexed tickUpper,\\n uint128 amount,\\n uint256 amount0,\\n uint256 amount1\\n );\\n\\n /// @notice Emitted when fees are collected by the owner of a position\\n /// @dev Collect events may be emitted with zero amount0 and amount1 when the caller chooses not to collect fees\\n /// @param owner The owner of the position for which fees are collected\\n /// @param tickLower The lower tick of the position\\n /// @param tickUpper The upper tick of the position\\n /// @param amount0 The amount of token0 fees collected\\n /// @param amount1 The amount of token1 fees collected\\n event Collect(\\n address indexed owner,\\n address recipient,\\n int24 indexed tickLower,\\n int24 indexed tickUpper,\\n uint128 amount0,\\n uint128 amount1\\n );\\n\\n /// @notice Emitted when a position's liquidity is removed\\n /// @dev Does not withdraw any fees earned by the liquidity position, which must be withdrawn via #collect\\n /// @param owner The owner of the position for which liquidity is removed\\n /// @param tickLower The lower tick of the position\\n /// @param tickUpper The upper tick of the position\\n /// @param amount The amount of liquidity to remove\\n /// @param amount0 The amount of token0 withdrawn\\n /// @param amount1 The amount of token1 withdrawn\\n event Burn(\\n address indexed owner,\\n int24 indexed tickLower,\\n int24 indexed tickUpper,\\n uint128 amount,\\n uint256 amount0,\\n uint256 amount1\\n );\\n\\n /// @notice Emitted by the pool for any swaps between token0 and token1\\n /// @param sender The address that initiated the swap call, and that received the callback\\n /// @param recipient The address that received the output of the swap\\n /// @param amount0 The delta of the token0 balance of the pool\\n /// @param amount1 The delta of the token1 balance of the pool\\n /// @param sqrtPriceX96 The sqrt(price) of the pool after the swap, as a Q64.96\\n /// @param liquidity The liquidity of the pool after the swap\\n /// @param tick The log base 1.0001 of price of the pool after the swap\\n event Swap(\\n address indexed sender,\\n address indexed recipient,\\n int256 amount0,\\n int256 amount1,\\n uint160 sqrtPriceX96,\\n uint128 liquidity,\\n int24 tick\\n );\\n\\n /// @notice Emitted by the pool for any flashes of token0/token1\\n /// @param sender The address that initiated the swap call, and that received the callback\\n /// @param recipient The address that received the tokens from flash\\n /// @param amount0 The amount of token0 that was flashed\\n /// @param amount1 The amount of token1 that was flashed\\n /// @param paid0 The amount of token0 paid for the flash, which can exceed the amount0 plus the fee\\n /// @param paid1 The amount of token1 paid for the flash, which can exceed the amount1 plus the fee\\n event Flash(\\n address indexed sender,\\n address indexed recipient,\\n uint256 amount0,\\n uint256 amount1,\\n uint256 paid0,\\n uint256 paid1\\n );\\n\\n /// @notice Emitted by the pool for increases to the number of observations that can be stored\\n /// @dev observationCardinalityNext is not the observation cardinality until an observation is written at the index\\n /// just before a mint/swap/burn.\\n /// @param observationCardinalityNextOld The previous value of the next observation cardinality\\n /// @param observationCardinalityNextNew The updated value of the next observation cardinality\\n event IncreaseObservationCardinalityNext(\\n uint16 observationCardinalityNextOld,\\n uint16 observationCardinalityNextNew\\n );\\n\\n /// @notice Emitted when the protocol fee is changed by the pool\\n /// @param feeProtocol0Old The previous value of the token0 protocol fee\\n /// @param feeProtocol1Old The previous value of the token1 protocol fee\\n /// @param feeProtocol0New The updated value of the token0 protocol fee\\n /// @param feeProtocol1New The updated value of the token1 protocol fee\\n event SetFeeProtocol(uint8 feeProtocol0Old, uint8 feeProtocol1Old, uint8 feeProtocol0New, uint8 feeProtocol1New);\\n\\n /// @notice Emitted when the collected protocol fees are withdrawn by the factory owner\\n /// @param sender The address that collects the protocol fees\\n /// @param recipient The address that receives the collected protocol fees\\n /// @param amount0 The amount of token0 protocol fees that is withdrawn\\n /// @param amount0 The amount of token1 protocol fees that is withdrawn\\n event CollectProtocol(address indexed sender, address indexed recipient, uint128 amount0, uint128 amount1);\\n}\\n\",\"keccak256\":\"0x8071514d0fe5d17d6fbd31c191cdfb703031c24e0ece3621d88ab10e871375cd\",\"license\":\"GPL-2.0-or-later\"},\"@uniswap/v3-core/contracts/interfaces/pool/IUniswapV3PoolImmutables.sol\":{\"content\":\"// SPDX-License-Identifier: GPL-2.0-or-later\\npragma solidity >=0.5.0;\\n\\n/// @title Pool state that never changes\\n/// @notice These parameters are fixed for a pool forever, i.e., the methods will always return the same values\\ninterface IUniswapV3PoolImmutables {\\n /// @notice The contract that deployed the pool, which must adhere to the IUniswapV3Factory interface\\n /// @return The contract address\\n function factory() external view returns (address);\\n\\n /// @notice The first of the two tokens of the pool, sorted by address\\n /// @return The token contract address\\n function token0() external view returns (address);\\n\\n /// @notice The second of the two tokens of the pool, sorted by address\\n /// @return The token contract address\\n function token1() external view returns (address);\\n\\n /// @notice The pool's fee in hundredths of a bip, i.e. 1e-6\\n /// @return The fee\\n function fee() external view returns (uint24);\\n\\n /// @notice The pool tick spacing\\n /// @dev Ticks can only be used at multiples of this value, minimum of 1 and always positive\\n /// e.g.: a tickSpacing of 3 means ticks can be initialized every 3rd tick, i.e., ..., -6, -3, 0, 3, 6, ...\\n /// This value is an int24 to avoid casting even though it is always positive.\\n /// @return The tick spacing\\n function tickSpacing() external view returns (int24);\\n\\n /// @notice The maximum amount of position liquidity that can use any tick in the range\\n /// @dev This parameter is enforced per tick to prevent liquidity from overflowing a uint128 at any point, and\\n /// also prevents out-of-range liquidity from being used to prevent adding in-range liquidity to a pool\\n /// @return The max amount of liquidity per tick\\n function maxLiquidityPerTick() external view returns (uint128);\\n}\\n\",\"keccak256\":\"0xf6e5d2cd1139c4c276bdbc8e1d2b256e456c866a91f1b868da265c6d2685c3f7\",\"license\":\"GPL-2.0-or-later\"},\"@uniswap/v3-core/contracts/interfaces/pool/IUniswapV3PoolOwnerActions.sol\":{\"content\":\"// SPDX-License-Identifier: GPL-2.0-or-later\\npragma solidity >=0.5.0;\\n\\n/// @title Permissioned pool actions\\n/// @notice Contains pool methods that may only be called by the factory owner\\ninterface IUniswapV3PoolOwnerActions {\\n /// @notice Set the denominator of the protocol's % share of the fees\\n /// @param feeProtocol0 new protocol fee for token0 of the pool\\n /// @param feeProtocol1 new protocol fee for token1 of the pool\\n function setFeeProtocol(uint8 feeProtocol0, uint8 feeProtocol1) external;\\n\\n /// @notice Collect the protocol fee accrued to the pool\\n /// @param recipient The address to which collected protocol fees should be sent\\n /// @param amount0Requested The maximum amount of token0 to send, can be 0 to collect fees in only token1\\n /// @param amount1Requested The maximum amount of token1 to send, can be 0 to collect fees in only token0\\n /// @return amount0 The protocol fee collected in token0\\n /// @return amount1 The protocol fee collected in token1\\n function collectProtocol(\\n address recipient,\\n uint128 amount0Requested,\\n uint128 amount1Requested\\n ) external returns (uint128 amount0, uint128 amount1);\\n}\\n\",\"keccak256\":\"0x759b78a2918af9e99e246dc3af084f654e48ef32bb4e4cb8a966aa3dcaece235\",\"license\":\"GPL-2.0-or-later\"},\"@uniswap/v3-core/contracts/interfaces/pool/IUniswapV3PoolState.sol\":{\"content\":\"// SPDX-License-Identifier: GPL-2.0-or-later\\npragma solidity >=0.5.0;\\n\\n/// @title Pool state that can change\\n/// @notice These methods compose the pool's state, and can change with any frequency including multiple times\\n/// per transaction\\ninterface IUniswapV3PoolState {\\n /// @notice The 0th storage slot in the pool stores many values, and is exposed as a single method to save gas\\n /// when accessed externally.\\n /// @return sqrtPriceX96 The current price of the pool as a sqrt(token1/token0) Q64.96 value\\n /// tick The current tick of the pool, i.e. according to the last tick transition that was run.\\n /// This value may not always be equal to SqrtTickMath.getTickAtSqrtRatio(sqrtPriceX96) if the price is on a tick\\n /// boundary.\\n /// observationIndex The index of the last oracle observation that was written,\\n /// observationCardinality The current maximum number of observations stored in the pool,\\n /// observationCardinalityNext The next maximum number of observations, to be updated when the observation.\\n /// feeProtocol The protocol fee for both tokens of the pool.\\n /// Encoded as two 4 bit values, where the protocol fee of token1 is shifted 4 bits and the protocol fee of token0\\n /// is the lower 4 bits. Used as the denominator of a fraction of the swap fee, e.g. 4 means 1/4th of the swap fee.\\n /// unlocked Whether the pool is currently locked to reentrancy\\n function slot0()\\n external\\n view\\n returns (\\n uint160 sqrtPriceX96,\\n int24 tick,\\n uint16 observationIndex,\\n uint16 observationCardinality,\\n uint16 observationCardinalityNext,\\n uint8 feeProtocol,\\n bool unlocked\\n );\\n\\n /// @notice The fee growth as a Q128.128 fees of token0 collected per unit of liquidity for the entire life of the pool\\n /// @dev This value can overflow the uint256\\n function feeGrowthGlobal0X128() external view returns (uint256);\\n\\n /// @notice The fee growth as a Q128.128 fees of token1 collected per unit of liquidity for the entire life of the pool\\n /// @dev This value can overflow the uint256\\n function feeGrowthGlobal1X128() external view returns (uint256);\\n\\n /// @notice The amounts of token0 and token1 that are owed to the protocol\\n /// @dev Protocol fees will never exceed uint128 max in either token\\n function protocolFees() external view returns (uint128 token0, uint128 token1);\\n\\n /// @notice The currently in range liquidity available to the pool\\n /// @dev This value has no relationship to the total liquidity across all ticks\\n function liquidity() external view returns (uint128);\\n\\n /// @notice Look up information about a specific tick in the pool\\n /// @param tick The tick to look up\\n /// @return liquidityGross the total amount of position liquidity that uses the pool either as tick lower or\\n /// tick upper,\\n /// liquidityNet how much liquidity changes when the pool price crosses the tick,\\n /// feeGrowthOutside0X128 the fee growth on the other side of the tick from the current tick in token0,\\n /// feeGrowthOutside1X128 the fee growth on the other side of the tick from the current tick in token1,\\n /// tickCumulativeOutside the cumulative tick value on the other side of the tick from the current tick\\n /// secondsPerLiquidityOutsideX128 the seconds spent per liquidity on the other side of the tick from the current tick,\\n /// secondsOutside the seconds spent on the other side of the tick from the current tick,\\n /// initialized Set to true if the tick is initialized, i.e. liquidityGross is greater than 0, otherwise equal to false.\\n /// Outside values can only be used if the tick is initialized, i.e. if liquidityGross is greater than 0.\\n /// In addition, these values are only relative and must be used only in comparison to previous snapshots for\\n /// a specific position.\\n function ticks(int24 tick)\\n external\\n view\\n returns (\\n uint128 liquidityGross,\\n int128 liquidityNet,\\n uint256 feeGrowthOutside0X128,\\n uint256 feeGrowthOutside1X128,\\n int56 tickCumulativeOutside,\\n uint160 secondsPerLiquidityOutsideX128,\\n uint32 secondsOutside,\\n bool initialized\\n );\\n\\n /// @notice Returns 256 packed tick initialized boolean values. See TickBitmap for more information\\n function tickBitmap(int16 wordPosition) external view returns (uint256);\\n\\n /// @notice Returns the information about a position by the position's key\\n /// @param key The position's key is a hash of a preimage composed by the owner, tickLower and tickUpper\\n /// @return _liquidity The amount of liquidity in the position,\\n /// Returns feeGrowthInside0LastX128 fee growth of token0 inside the tick range as of the last mint/burn/poke,\\n /// Returns feeGrowthInside1LastX128 fee growth of token1 inside the tick range as of the last mint/burn/poke,\\n /// Returns tokensOwed0 the computed amount of token0 owed to the position as of the last mint/burn/poke,\\n /// Returns tokensOwed1 the computed amount of token1 owed to the position as of the last mint/burn/poke\\n function positions(bytes32 key)\\n external\\n view\\n returns (\\n uint128 _liquidity,\\n uint256 feeGrowthInside0LastX128,\\n uint256 feeGrowthInside1LastX128,\\n uint128 tokensOwed0,\\n uint128 tokensOwed1\\n );\\n\\n /// @notice Returns data about a specific observation index\\n /// @param index The element of the observations array to fetch\\n /// @dev You most likely want to use #observe() instead of this method to get an observation as of some amount of time\\n /// ago, rather than at a specific index in the array.\\n /// @return blockTimestamp The timestamp of the observation,\\n /// Returns tickCumulative the tick multiplied by seconds elapsed for the life of the pool as of the observation timestamp,\\n /// Returns secondsPerLiquidityCumulativeX128 the seconds per in range liquidity for the life of the pool as of the observation timestamp,\\n /// Returns initialized whether the observation has been initialized and the values are safe to use\\n function observations(uint256 index)\\n external\\n view\\n returns (\\n uint32 blockTimestamp,\\n int56 tickCumulative,\\n uint160 secondsPerLiquidityCumulativeX128,\\n bool initialized\\n );\\n}\\n\",\"keccak256\":\"0x852dc1f5df7dcf7f11e7bb3eed79f0cea72ad4b25f6a9d2c35aafb48925fd49f\",\"license\":\"GPL-2.0-or-later\"},\"solidity/contracts/UniV3PairManager.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\n/*\\n\\nCoded for The Keep3r Network with \\u2665 by\\n\\n\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2557\\u2591\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2557\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2557\\u2588\\u2588\\u2557\\u2003\\u2003\\u2591\\u2588\\u2588\\u2557\\u2591\\u2591\\u2591\\u2591\\u2591\\u2591\\u2591\\u2588\\u2588\\u2557\\u2591\\u2588\\u2588\\u2588\\u2588\\u2588\\u2557\\u2591\\u2588\\u2588\\u2588\\u2557\\u2591\\u2591\\u2588\\u2588\\u2557\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2557\\u2591\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2557\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2557\\u2591\\u2588\\u2588\\u2557\\u2591\\u2591\\u2591\\u2591\\u2591\\u2591\\u2588\\u2588\\u2588\\u2588\\u2588\\u2557\\u2591\\u2588\\u2588\\u2588\\u2557\\u2591\\u2591\\u2588\\u2588\\u2557\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2557\\u2591\\n\\u2588\\u2588\\u2554\\u2550\\u2550\\u2588\\u2588\\u2557\\u2588\\u2588\\u2554\\u2550\\u2550\\u2550\\u2550\\u255d\\u2588\\u2588\\u2554\\u2550\\u2550\\u2550\\u2550\\u255d\\u2588\\u2588\\u2551\\u2003\\u2003\\u2591\\u2588\\u2588\\u2551\\u2591\\u2591\\u2588\\u2588\\u2557\\u2591\\u2591\\u2588\\u2588\\u2551\\u2588\\u2588\\u2554\\u2550\\u2550\\u2588\\u2588\\u2557\\u2588\\u2588\\u2588\\u2588\\u2557\\u2591\\u2588\\u2588\\u2551\\u2588\\u2588\\u2554\\u2550\\u2550\\u2588\\u2588\\u2557\\u2588\\u2588\\u2554\\u2550\\u2550\\u2550\\u2550\\u255d\\u2588\\u2588\\u2554\\u2550\\u2550\\u2588\\u2588\\u2557\\u2588\\u2588\\u2551\\u2591\\u2591\\u2591\\u2591\\u2591\\u2588\\u2588\\u2554\\u2550\\u2550\\u2588\\u2588\\u2557\\u2588\\u2588\\u2588\\u2588\\u2557\\u2591\\u2588\\u2588\\u2551\\u2588\\u2588\\u2554\\u2550\\u2550\\u2588\\u2588\\u2557\\n\\u2588\\u2588\\u2551\\u2591\\u2591\\u2588\\u2588\\u2551\\u2588\\u2588\\u2588\\u2588\\u2588\\u2557\\u2591\\u2591\\u2588\\u2588\\u2588\\u2588\\u2588\\u2557\\u2591\\u2591\\u2588\\u2588\\u2551\\u2003\\u2003\\u2591\\u255a\\u2588\\u2588\\u2557\\u2588\\u2588\\u2588\\u2588\\u2557\\u2588\\u2588\\u2554\\u255d\\u2588\\u2588\\u2551\\u2591\\u2591\\u2588\\u2588\\u2551\\u2588\\u2588\\u2554\\u2588\\u2588\\u2557\\u2588\\u2588\\u2551\\u2588\\u2588\\u2551\\u2591\\u2591\\u2588\\u2588\\u2551\\u2588\\u2588\\u2588\\u2588\\u2588\\u2557\\u2591\\u2591\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2554\\u255d\\u2588\\u2588\\u2551\\u2591\\u2591\\u2591\\u2591\\u2591\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2551\\u2588\\u2588\\u2554\\u2588\\u2588\\u2557\\u2588\\u2588\\u2551\\u2588\\u2588\\u2551\\u2591\\u2591\\u2588\\u2588\\u2551\\n\\u2588\\u2588\\u2551\\u2591\\u2591\\u2588\\u2588\\u2551\\u2588\\u2588\\u2554\\u2550\\u2550\\u255d\\u2591\\u2591\\u2588\\u2588\\u2554\\u2550\\u2550\\u255d\\u2591\\u2591\\u2588\\u2588\\u2551\\u2003\\u2003\\u2591\\u2591\\u2588\\u2588\\u2588\\u2588\\u2554\\u2550\\u2588\\u2588\\u2588\\u2588\\u2551\\u2591\\u2588\\u2588\\u2551\\u2591\\u2591\\u2588\\u2588\\u2551\\u2588\\u2588\\u2551\\u255a\\u2588\\u2588\\u2588\\u2588\\u2551\\u2588\\u2588\\u2551\\u2591\\u2591\\u2588\\u2588\\u2551\\u2588\\u2588\\u2554\\u2550\\u2550\\u255d\\u2591\\u2591\\u2588\\u2588\\u2554\\u2550\\u2550\\u2588\\u2588\\u2557\\u2588\\u2588\\u2551\\u2591\\u2591\\u2591\\u2591\\u2591\\u2588\\u2588\\u2554\\u2550\\u2550\\u2588\\u2588\\u2551\\u2588\\u2588\\u2551\\u255a\\u2588\\u2588\\u2588\\u2588\\u2551\\u2588\\u2588\\u2551\\u2591\\u2591\\u2588\\u2588\\u2551\\n\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2554\\u255d\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2557\\u2588\\u2588\\u2551\\u2591\\u2591\\u2591\\u2591\\u2591\\u2588\\u2588\\u2551\\u2003\\u2003\\u2591\\u2591\\u255a\\u2588\\u2588\\u2554\\u255d\\u2591\\u255a\\u2588\\u2588\\u2554\\u255d\\u2591\\u255a\\u2588\\u2588\\u2588\\u2588\\u2588\\u2554\\u255d\\u2588\\u2588\\u2551\\u2591\\u255a\\u2588\\u2588\\u2588\\u2551\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2554\\u255d\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2557\\u2588\\u2588\\u2551\\u2591\\u2591\\u2588\\u2588\\u2551\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2557\\u2588\\u2588\\u2551\\u2591\\u2591\\u2588\\u2588\\u2551\\u2588\\u2588\\u2551\\u2591\\u255a\\u2588\\u2588\\u2588\\u2551\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2554\\u255d\\n\\u255a\\u2550\\u2550\\u2550\\u2550\\u2550\\u255d\\u2591\\u255a\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u255d\\u255a\\u2550\\u255d\\u2591\\u2591\\u2591\\u2591\\u2591\\u255a\\u2550\\u255d\\u2003\\u2003\\u2591\\u2591\\u2591\\u255a\\u2550\\u255d\\u2591\\u2591\\u2591\\u255a\\u2550\\u255d\\u2591\\u2591\\u2591\\u255a\\u2550\\u2550\\u2550\\u2550\\u255d\\u2591\\u255a\\u2550\\u255d\\u2591\\u2591\\u255a\\u2550\\u2550\\u255d\\u255a\\u2550\\u2550\\u2550\\u2550\\u2550\\u255d\\u2591\\u255a\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u255d\\u255a\\u2550\\u255d\\u2591\\u2591\\u255a\\u2550\\u255d\\u255a\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u255d\\u255a\\u2550\\u255d\\u2591\\u2591\\u255a\\u2550\\u255d\\u255a\\u2550\\u255d\\u2591\\u2591\\u255a\\u2550\\u2550\\u255d\\u255a\\u2550\\u2550\\u2550\\u2550\\u2550\\u255d\\u2591\\n\\nhttps://defi.sucks\\n\\n*/\\n\\npragma solidity >=0.8.4 <0.9.0;\\n\\nimport '@openzeppelin/contracts/token/ERC20/ERC20.sol';\\nimport '@uniswap/v3-core/contracts/interfaces/IUniswapV3Pool.sol';\\n\\nimport './libraries/LiquidityAmounts.sol';\\nimport './libraries/PoolAddress.sol';\\nimport './libraries/FixedPoint96.sol';\\nimport './libraries/FullMath.sol';\\nimport './libraries/TickMath.sol';\\n\\nimport '../interfaces/external/IWeth9.sol';\\nimport '../interfaces/IUniV3PairManager.sol';\\n\\nimport './peripherals/Governable.sol';\\n\\ncontract UniV3PairManager is IUniV3PairManager, Governable {\\n /// @inheritdoc IERC20Metadata\\n string public override name;\\n\\n /// @inheritdoc IERC20Metadata\\n string public override symbol;\\n\\n /// @inheritdoc IERC20\\n uint256 public override totalSupply;\\n\\n /// @inheritdoc IPairManager\\n address public immutable override factory;\\n\\n /// @inheritdoc IPairManager\\n address public immutable override token0;\\n\\n /// @inheritdoc IPairManager\\n address public immutable override token1;\\n\\n /// @inheritdoc IPairManager\\n address public immutable override pool;\\n\\n /// @inheritdoc IUniV3PairManager\\n uint24 public immutable override fee;\\n\\n /// @inheritdoc IUniV3PairManager\\n uint160 public immutable override sqrtRatioAX96;\\n\\n /// @inheritdoc IUniV3PairManager\\n uint160 public immutable override sqrtRatioBX96;\\n\\n /// @inheritdoc IUniV3PairManager\\n int24 public immutable override tickLower;\\n\\n /// @inheritdoc IUniV3PairManager\\n int24 public immutable override tickUpper;\\n\\n /// @inheritdoc IUniV3PairManager\\n int24 public immutable override tickSpacing;\\n\\n /// @notice Uniswap's maximum tick\\n /// @dev Due to tick spacing, pools with different fees may have differences between _MAX_TICK and tickUpper. Use tickUpper to find the max tick of the pool.\\n int24 private constant _MAX_TICK = 887272;\\n\\n /// @inheritdoc IERC20Metadata\\n //solhint-disable-next-line const-name-snakecase\\n uint8 public constant override decimals = 18;\\n\\n /// @inheritdoc IERC20\\n mapping(address => mapping(address => uint256)) public override allowance;\\n\\n /// @inheritdoc IERC20\\n mapping(address => uint256) public override balanceOf;\\n\\n /// @notice Struct that contains token0, token1, and fee of the Uniswap pool\\n PoolAddress.PoolKey private _poolKey;\\n\\n constructor(address _pool, address _governance) Governable(_governance) {\\n uint24 _fee = IUniswapV3Pool(_pool).fee();\\n address _token0 = IUniswapV3Pool(_pool).token0();\\n address _token1 = IUniswapV3Pool(_pool).token1();\\n int24 _tickSpacing = IUniswapV3Pool(_pool).tickSpacing();\\n int24 _tickUpper = _MAX_TICK - (_MAX_TICK % _tickSpacing);\\n int24 _tickLower = -_tickUpper;\\n\\n factory = msg.sender;\\n pool = _pool;\\n fee = _fee;\\n tickSpacing = _tickSpacing;\\n tickUpper = _tickUpper;\\n tickLower = _tickLower;\\n token0 = _token0;\\n token1 = _token1;\\n name = string(abi.encodePacked('Keep3rLP - ', ERC20(_token0).symbol(), '/', ERC20(_token1).symbol()));\\n symbol = string(abi.encodePacked('kLP-', ERC20(_token0).symbol(), '/', ERC20(_token1).symbol()));\\n\\n sqrtRatioAX96 = TickMath.getSqrtRatioAtTick(_tickLower);\\n sqrtRatioBX96 = TickMath.getSqrtRatioAtTick(_tickUpper);\\n _poolKey = PoolAddress.PoolKey({token0: _token0, token1: _token1, fee: _fee});\\n }\\n\\n // This low-level function should be called from a contract which performs important safety checks\\n /// @inheritdoc IUniV3PairManager\\n function mint(\\n uint256 amount0Desired,\\n uint256 amount1Desired,\\n uint256 amount0Min,\\n uint256 amount1Min,\\n address to\\n ) external override returns (uint128 liquidity) {\\n (liquidity, , ) = _addLiquidity(amount0Desired, amount1Desired, amount0Min, amount1Min);\\n _mint(to, liquidity);\\n }\\n\\n /// @inheritdoc IUniV3PairManager\\n function uniswapV3MintCallback(\\n uint256 amount0Owed,\\n uint256 amount1Owed,\\n bytes calldata data\\n ) external override {\\n MintCallbackData memory decoded = abi.decode(data, (MintCallbackData));\\n if (msg.sender != pool) revert OnlyPool();\\n if (amount0Owed > 0) _pay(decoded._poolKey.token0, decoded.payer, pool, amount0Owed);\\n if (amount1Owed > 0) _pay(decoded._poolKey.token1, decoded.payer, pool, amount1Owed);\\n }\\n\\n /// @inheritdoc IUniV3PairManager\\n function burn(\\n uint128 liquidity,\\n uint256 amount0Min,\\n uint256 amount1Min,\\n address to\\n ) external override returns (uint256 amount0, uint256 amount1) {\\n (amount0, amount1) = IUniswapV3Pool(pool).burn(tickLower, tickUpper, liquidity);\\n\\n if (amount0 < amount0Min || amount1 < amount1Min) revert ExcessiveSlippage();\\n\\n IUniswapV3Pool(pool).collect(to, tickLower, tickUpper, uint128(amount0), uint128(amount1));\\n _burn(msg.sender, liquidity);\\n }\\n\\n /// @inheritdoc IUniV3PairManager\\n function collect() external override onlyGovernance returns (uint256 amount0, uint256 amount1) {\\n (, , , uint128 tokensOwed0, uint128 tokensOwed1) = IUniswapV3Pool(pool).positions(\\n keccak256(abi.encodePacked(address(this), tickLower, tickUpper))\\n );\\n (amount0, amount1) = IUniswapV3Pool(pool).collect(governance, tickLower, tickUpper, tokensOwed0, tokensOwed1);\\n }\\n\\n /// @inheritdoc IUniV3PairManager\\n function position()\\n external\\n view\\n override\\n returns (\\n uint128 liquidity,\\n uint256 feeGrowthInside0LastX128,\\n uint256 feeGrowthInside1LastX128,\\n uint128 tokensOwed0,\\n uint128 tokensOwed1\\n )\\n {\\n (liquidity, feeGrowthInside0LastX128, feeGrowthInside1LastX128, tokensOwed0, tokensOwed1) = IUniswapV3Pool(pool).positions(\\n keccak256(abi.encodePacked(address(this), tickLower, tickUpper))\\n );\\n }\\n\\n /// @inheritdoc IERC20\\n function approve(address spender, uint256 amount) external override returns (bool) {\\n allowance[msg.sender][spender] = amount;\\n\\n emit Approval(msg.sender, spender, amount);\\n return true;\\n }\\n\\n /// @inheritdoc IERC20\\n function transfer(address to, uint256 amount) external override returns (bool) {\\n _transferTokens(msg.sender, to, amount);\\n return true;\\n }\\n\\n /// @inheritdoc IERC20\\n function transferFrom(\\n address from,\\n address to,\\n uint256 amount\\n ) external override returns (bool) {\\n address spender = msg.sender;\\n uint256 spenderAllowance = allowance[from][spender];\\n\\n if (spender != from && spenderAllowance != type(uint256).max) {\\n uint256 newAllowance = spenderAllowance - amount;\\n allowance[from][spender] = newAllowance;\\n\\n emit Approval(from, spender, newAllowance);\\n }\\n\\n _transferTokens(from, to, amount);\\n return true;\\n }\\n\\n /// @notice Adds liquidity to an initialized pool\\n /// @dev Reverts if the returned amount0 is less than amount0Min or if amount1 is less than amount1Min\\n /// @dev This function calls the mint function of the corresponding Uniswap pool, which in turn calls UniswapV3Callback\\n /// @param amount0Desired The amount of token0 we would like to provide\\n /// @param amount1Desired The amount of token1 we would like to provide\\n /// @param amount0Min The minimum amount of token0 we want to provide\\n /// @param amount1Min The minimum amount of token1 we want to provide\\n /// @return liquidity The calculated liquidity we get for the token amounts we provided\\n /// @return amount0 The amount of token0 we ended up providing\\n /// @return amount1 The amount of token1 we ended up providing\\n function _addLiquidity(\\n uint256 amount0Desired,\\n uint256 amount1Desired,\\n uint256 amount0Min,\\n uint256 amount1Min\\n )\\n internal\\n returns (\\n uint128 liquidity,\\n uint256 amount0,\\n uint256 amount1\\n )\\n {\\n (uint160 sqrtPriceX96, , , , , , ) = IUniswapV3Pool(pool).slot0();\\n\\n liquidity = LiquidityAmounts.getLiquidityForAmounts(sqrtPriceX96, sqrtRatioAX96, sqrtRatioBX96, amount0Desired, amount1Desired);\\n\\n (amount0, amount1) = IUniswapV3Pool(pool).mint(\\n address(this),\\n tickLower,\\n tickUpper,\\n liquidity,\\n abi.encode(MintCallbackData({_poolKey: _poolKey, payer: msg.sender}))\\n );\\n\\n if (amount0 < amount0Min || amount1 < amount1Min) revert ExcessiveSlippage();\\n }\\n\\n /// @notice Transfers the passed-in token from the payer to the recipient for the corresponding value\\n /// @param token The token to be transferred to the recipient\\n /// @param from The address of the payer\\n /// @param to The address of the passed-in tokens recipient\\n /// @param value How much of that token to be transferred from payer to the recipient\\n function _pay(\\n address token,\\n address from,\\n address to,\\n uint256 value\\n ) internal {\\n _safeTransferFrom(token, from, to, value);\\n }\\n\\n /// @notice Mints Keep3r credits to the passed-in address of recipient and increases total supply of Keep3r credits by the corresponding amount\\n /// @param to The recipient of the Keep3r credits\\n /// @param amount The amount Keep3r credits to be minted to the recipient\\n function _mint(address to, uint256 amount) internal {\\n totalSupply += amount;\\n balanceOf[to] += amount;\\n emit Transfer(address(0), to, amount);\\n }\\n\\n /// @notice Burns Keep3r credits to the passed-in address of recipient and reduces total supply of Keep3r credits by the corresponding amount\\n /// @param to The address that will get its Keep3r credits burned\\n /// @param amount The amount Keep3r credits to be burned from the recipient/recipient\\n function _burn(address to, uint256 amount) internal {\\n totalSupply -= amount;\\n balanceOf[to] -= amount;\\n emit Transfer(to, address(0), amount);\\n }\\n\\n /// @notice Transfers amount of Keep3r credits between two addresses\\n /// @param from The user that transfers the Keep3r credits\\n /// @param to The user that receives the Keep3r credits\\n /// @param amount The amount of Keep3r credits to be transferred\\n function _transferTokens(\\n address from,\\n address to,\\n uint256 amount\\n ) internal {\\n balanceOf[from] -= amount;\\n balanceOf[to] += amount;\\n\\n emit Transfer(from, to, amount);\\n }\\n\\n /// @notice Transfers the passed-in token from the specified \\\"from\\\" to the specified \\\"to\\\" for the corresponding value\\n /// @dev Reverts with IUniV3PairManager#UnsuccessfulTransfer if the transfer was not successful,\\n /// or if the passed data length is different than 0 and the decoded data is not a boolean\\n /// @param token The token to be transferred to the specified \\\"to\\\"\\n /// @param from The address which is going to transfer the tokens\\n /// @param value How much of that token to be transferred from \\\"from\\\" to \\\"to\\\"\\n function _safeTransferFrom(\\n address token,\\n address from,\\n address to,\\n uint256 value\\n ) internal {\\n // solhint-disable-next-line avoid-low-level-calls\\n (bool success, bytes memory data) = token.call(abi.encodeWithSelector(IERC20.transferFrom.selector, from, to, value));\\n if (!success || (data.length != 0 && !abi.decode(data, (bool)))) revert UnsuccessfulTransfer();\\n }\\n}\\n\",\"keccak256\":\"0xcae7fbc99cb2f267f34894b47f02fde1c58cb22600afe4eb328d7492a9dbb396\",\"license\":\"MIT\"},\"solidity/contracts/libraries/FixedPoint96.sol\":{\"content\":\"// SPDX-License-Identifier: GPL-2.0-or-later\\npragma solidity >=0.8.4 <0.9.0;\\n\\nlibrary FixedPoint96 {\\n // solhint-disable\\n uint8 internal constant RESOLUTION = 96;\\n uint256 internal constant Q96 = 0x1000000000000000000000000;\\n}\\n\",\"keccak256\":\"0x32a5c51474a7a83b902ffd6f54f8407e2b98d1142c9b06914fb75d50dd9c573c\",\"license\":\"GPL-2.0-or-later\"},\"solidity/contracts/libraries/FullMath.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4 <0.9.0;\\n\\n/// @title Contains 512-bit math functions\\n/// @notice Facilitates multiplication and division that can have overflow of an intermediate value without any loss of precision\\n/// @dev Handles \\\"phantom overflow\\\" i.e., allows multiplication and division where an intermediate value overflows 256 bits\\nlibrary FullMath {\\n /// @notice Calculates floor(a\\u00d7b\\u00f7denominator) with full precision. Throws if result overflows a uint256 or denominator == 0\\n /// @param a The multiplicand\\n /// @param b The multiplier\\n /// @param denominator The divisor\\n /// @return result The 256-bit result\\n /// @dev Credit to Remco Bloemen under MIT license https://xn--2-umb.com/21/muldiv\\n function mulDiv(\\n uint256 a,\\n uint256 b,\\n uint256 denominator\\n ) internal pure returns (uint256 result) {\\n unchecked {\\n // 512-bit multiply [prod1 prod0] = a * b\\n // Compute the product mod 2**256 and mod 2**256 - 1\\n // then use the Chinese Remainder Theorem to reconstruct\\n // the 512 bit result. The result is stored in two 256\\n // variables such that product = prod1 * 2**256 + prod0\\n uint256 prod0; // Least significant 256 bits of the product\\n uint256 prod1; // Most significant 256 bits of the product\\n assembly {\\n let mm := mulmod(a, b, not(0))\\n prod0 := mul(a, b)\\n prod1 := sub(sub(mm, prod0), lt(mm, prod0))\\n }\\n\\n // Handle non-overflow cases, 256 by 256 division\\n if (prod1 == 0) {\\n require(denominator > 0);\\n assembly {\\n result := div(prod0, denominator)\\n }\\n return result;\\n }\\n\\n // Make sure the result is less than 2**256.\\n // Also prevents denominator == 0\\n require(denominator > prod1);\\n\\n ///////////////////////////////////////////////\\n // 512 by 256 division.\\n ///////////////////////////////////////////////\\n\\n // Make division exact by subtracting the remainder from [prod1 prod0]\\n // Compute remainder using mulmod\\n uint256 remainder;\\n assembly {\\n remainder := mulmod(a, b, denominator)\\n }\\n // Subtract 256 bit number from 512 bit number\\n assembly {\\n prod1 := sub(prod1, gt(remainder, prod0))\\n prod0 := sub(prod0, remainder)\\n }\\n\\n // Factor powers of two out of denominator\\n // Compute largest power of two divisor of denominator.\\n // Always >= 1.\\n uint256 twos = (~denominator + 1) & denominator;\\n // Divide denominator by power of two\\n assembly {\\n denominator := div(denominator, twos)\\n }\\n\\n // Divide [prod1 prod0] by the factors of two\\n assembly {\\n prod0 := div(prod0, twos)\\n }\\n // Shift in bits from prod1 into prod0. For this we need\\n // to flip `twos` such that it is 2**256 / twos.\\n // If twos is zero, then it becomes one\\n assembly {\\n twos := add(div(sub(0, twos), twos), 1)\\n }\\n prod0 |= prod1 * twos;\\n\\n // Invert denominator mod 2**256\\n // Now that denominator is an odd number, it has an inverse\\n // modulo 2**256 such that denominator * inv = 1 mod 2**256.\\n // Compute the inverse by starting with a seed that is correct\\n // correct for four bits. That is, denominator * inv = 1 mod 2**4\\n uint256 inv = (3 * denominator) ^ 2;\\n // Now use Newton-Raphson iteration to improve the precision.\\n // Thanks to Hensel's lifting lemma, this also works in modular\\n // arithmetic, doubling the correct bits in each step.\\n inv *= 2 - denominator * inv; // inverse mod 2**8\\n inv *= 2 - denominator * inv; // inverse mod 2**16\\n inv *= 2 - denominator * inv; // inverse mod 2**32\\n inv *= 2 - denominator * inv; // inverse mod 2**64\\n inv *= 2 - denominator * inv; // inverse mod 2**128\\n inv *= 2 - denominator * inv; // inverse mod 2**256\\n\\n // Because the division is now exact we can divide by multiplying\\n // with the modular inverse of denominator. This will give us the\\n // correct result modulo 2**256. Since the precoditions guarantee\\n // that the outcome is less than 2**256, this is the final result.\\n // We don't need to compute the high bits of the result and prod1\\n // is no longer required.\\n result = prod0 * inv;\\n return result;\\n }\\n }\\n\\n /// @notice Calculates ceil(a\\u00d7b\\u00f7denominator) with full precision. Throws if result overflows a uint256 or denominator == 0\\n /// @param a The multiplicand\\n /// @param b The multiplier\\n /// @param denominator The divisor\\n /// @return result The 256-bit result\\n function mulDivRoundingUp(\\n uint256 a,\\n uint256 b,\\n uint256 denominator\\n ) internal pure returns (uint256 result) {\\n unchecked {\\n result = mulDiv(a, b, denominator);\\n if (mulmod(a, b, denominator) > 0) {\\n require(result < type(uint256).max);\\n result++;\\n }\\n }\\n }\\n}\\n\",\"keccak256\":\"0xe1c595da02adf8ba2ae74ac579b9b3c966d1ecb2a99c25081a62ee8550f26569\",\"license\":\"MIT\"},\"solidity/contracts/libraries/LiquidityAmounts.sol\":{\"content\":\"// SPDX-License-Identifier: GPL-2.0-or-later\\npragma solidity >=0.8.4 <0.9.0;\\n\\nimport './FullMath.sol';\\nimport './FixedPoint96.sol';\\n\\n// solhint-disable\\nlibrary LiquidityAmounts {\\n function toUint128(uint256 x) private pure returns (uint128 y) {\\n require((y = uint128(x)) == x);\\n }\\n\\n function getLiquidityForAmount0(\\n uint160 sqrtRatioAX96,\\n uint160 sqrtRatioBX96,\\n uint256 amount0\\n ) internal pure returns (uint128 liquidity) {\\n if (sqrtRatioAX96 > sqrtRatioBX96) (sqrtRatioAX96, sqrtRatioBX96) = (sqrtRatioBX96, sqrtRatioAX96);\\n uint256 intermediate = FullMath.mulDiv(sqrtRatioAX96, sqrtRatioBX96, FixedPoint96.Q96);\\n return toUint128(FullMath.mulDiv(amount0, intermediate, sqrtRatioBX96 - sqrtRatioAX96));\\n }\\n\\n function getLiquidityForAmount1(\\n uint160 sqrtRatioAX96,\\n uint160 sqrtRatioBX96,\\n uint256 amount1\\n ) internal pure returns (uint128 liquidity) {\\n if (sqrtRatioAX96 > sqrtRatioBX96) (sqrtRatioAX96, sqrtRatioBX96) = (sqrtRatioBX96, sqrtRatioAX96);\\n return toUint128(FullMath.mulDiv(amount1, FixedPoint96.Q96, sqrtRatioBX96 - sqrtRatioAX96));\\n }\\n\\n function getLiquidityForAmounts(\\n uint160 sqrtRatioX96,\\n uint160 sqrtRatioAX96,\\n uint160 sqrtRatioBX96,\\n uint256 amount0,\\n uint256 amount1\\n ) internal pure returns (uint128 liquidity) {\\n if (sqrtRatioAX96 > sqrtRatioBX96) (sqrtRatioAX96, sqrtRatioBX96) = (sqrtRatioBX96, sqrtRatioAX96);\\n\\n if (sqrtRatioX96 <= sqrtRatioAX96) {\\n liquidity = getLiquidityForAmount0(sqrtRatioAX96, sqrtRatioBX96, amount0);\\n } else if (sqrtRatioX96 < sqrtRatioBX96) {\\n uint128 liquidity0 = getLiquidityForAmount0(sqrtRatioX96, sqrtRatioBX96, amount0);\\n uint128 liquidity1 = getLiquidityForAmount1(sqrtRatioAX96, sqrtRatioX96, amount1);\\n\\n liquidity = liquidity0 < liquidity1 ? liquidity0 : liquidity1;\\n } else {\\n liquidity = getLiquidityForAmount1(sqrtRatioAX96, sqrtRatioBX96, amount1);\\n }\\n }\\n\\n function getAmount0ForLiquidity(\\n uint160 sqrtRatioAX96,\\n uint160 sqrtRatioBX96,\\n uint128 liquidity\\n ) internal pure returns (uint256 amount0) {\\n if (sqrtRatioAX96 > sqrtRatioBX96) (sqrtRatioAX96, sqrtRatioBX96) = (sqrtRatioBX96, sqrtRatioAX96);\\n\\n return FullMath.mulDiv(uint256(liquidity) << FixedPoint96.RESOLUTION, sqrtRatioBX96 - sqrtRatioAX96, sqrtRatioBX96) / sqrtRatioAX96;\\n }\\n\\n function getAmount1ForLiquidity(\\n uint160 sqrtRatioAX96,\\n uint160 sqrtRatioBX96,\\n uint128 liquidity\\n ) internal pure returns (uint256 amount1) {\\n if (sqrtRatioAX96 > sqrtRatioBX96) (sqrtRatioAX96, sqrtRatioBX96) = (sqrtRatioBX96, sqrtRatioAX96);\\n\\n return FullMath.mulDiv(liquidity, sqrtRatioBX96 - sqrtRatioAX96, FixedPoint96.Q96);\\n }\\n\\n function getAmountsForLiquidity(\\n uint160 sqrtRatioX96,\\n uint160 sqrtRatioAX96,\\n uint160 sqrtRatioBX96,\\n uint128 liquidity\\n ) internal pure returns (uint256 amount0, uint256 amount1) {\\n if (sqrtRatioAX96 > sqrtRatioBX96) (sqrtRatioAX96, sqrtRatioBX96) = (sqrtRatioBX96, sqrtRatioAX96);\\n\\n if (sqrtRatioX96 <= sqrtRatioAX96) {\\n amount0 = getAmount0ForLiquidity(sqrtRatioAX96, sqrtRatioBX96, liquidity);\\n } else if (sqrtRatioX96 < sqrtRatioBX96) {\\n amount0 = getAmount0ForLiquidity(sqrtRatioX96, sqrtRatioBX96, liquidity);\\n amount1 = getAmount1ForLiquidity(sqrtRatioAX96, sqrtRatioX96, liquidity);\\n } else {\\n amount1 = getAmount1ForLiquidity(sqrtRatioAX96, sqrtRatioBX96, liquidity);\\n }\\n }\\n}\\n\",\"keccak256\":\"0x33666cfb046e29d6a9539e552b7aace75daab08f0449fec13de7282bac84f786\",\"license\":\"GPL-2.0-or-later\"},\"solidity/contracts/libraries/PoolAddress.sol\":{\"content\":\"// SPDX-License-Identifier: GPL-2.0-or-later\\npragma solidity >=0.8.4 <0.9.0;\\n\\nlibrary PoolAddress {\\n struct PoolKey {\\n address token0;\\n address token1;\\n uint24 fee;\\n }\\n}\\n\",\"keccak256\":\"0x68b07a437302c14ff93ebaabfb49f4fa70263cfbb19bf15446ddfcb91eb5a5e6\",\"license\":\"GPL-2.0-or-later\"},\"solidity/contracts/libraries/TickMath.sol\":{\"content\":\"// SPDX-License-Identifier: GPL-2.0-or-later\\npragma solidity >=0.5.0;\\n\\n// solhint-disable\\n\\n/// @title Math library for computing sqrt prices from ticks and vice versa\\n/// @notice Computes sqrt price for ticks of size 1.0001, i.e. sqrt(1.0001^tick) as fixed point Q64.96 numbers. Supports\\n/// prices between 2**-128 and 2**128\\nlibrary TickMath {\\n /// @dev The minimum tick that may be passed to #getSqrtRatioAtTick computed from log base 1.0001 of 2**-128\\n int24 internal constant MIN_TICK = -887272;\\n /// @dev The maximum tick that may be passed to #getSqrtRatioAtTick computed from log base 1.0001 of 2**128\\n int24 internal constant MAX_TICK = -MIN_TICK;\\n\\n /// @dev The minimum value that can be returned from #getSqrtRatioAtTick. Equivalent to getSqrtRatioAtTick(MIN_TICK)\\n uint160 internal constant MIN_SQRT_RATIO = 4295128739;\\n /// @dev The maximum value that can be returned from #getSqrtRatioAtTick. Equivalent to getSqrtRatioAtTick(MAX_TICK)\\n uint160 internal constant MAX_SQRT_RATIO = 1461446703485210103287273052203988822378723970342;\\n\\n /// @notice Calculates sqrt(1.0001^tick) * 2^96\\n /// @dev Throws if |tick| > max tick\\n /// @param tick The input tick for the above formula\\n /// @return sqrtPriceX96 A Fixed point Q64.96 number representing the sqrt of the ratio of the two assets (token1/token0)\\n /// at the given tick\\n function getSqrtRatioAtTick(int24 tick) internal pure returns (uint160 sqrtPriceX96) {\\n uint256 absTick = tick < 0 ? uint256(-int256(tick)) : uint256(int256(tick));\\n require(absTick <= uint256(int256(MAX_TICK)), 'T');\\n\\n uint256 ratio = absTick & 0x1 != 0 ? 0xfffcb933bd6fad37aa2d162d1a594001 : 0x100000000000000000000000000000000;\\n if (absTick & 0x2 != 0) ratio = (ratio * 0xfff97272373d413259a46990580e213a) >> 128;\\n if (absTick & 0x4 != 0) ratio = (ratio * 0xfff2e50f5f656932ef12357cf3c7fdcc) >> 128;\\n if (absTick & 0x8 != 0) ratio = (ratio * 0xffe5caca7e10e4e61c3624eaa0941cd0) >> 128;\\n if (absTick & 0x10 != 0) ratio = (ratio * 0xffcb9843d60f6159c9db58835c926644) >> 128;\\n if (absTick & 0x20 != 0) ratio = (ratio * 0xff973b41fa98c081472e6896dfb254c0) >> 128;\\n if (absTick & 0x40 != 0) ratio = (ratio * 0xff2ea16466c96a3843ec78b326b52861) >> 128;\\n if (absTick & 0x80 != 0) ratio = (ratio * 0xfe5dee046a99a2a811c461f1969c3053) >> 128;\\n if (absTick & 0x100 != 0) ratio = (ratio * 0xfcbe86c7900a88aedcffc83b479aa3a4) >> 128;\\n if (absTick & 0x200 != 0) ratio = (ratio * 0xf987a7253ac413176f2b074cf7815e54) >> 128;\\n if (absTick & 0x400 != 0) ratio = (ratio * 0xf3392b0822b70005940c7a398e4b70f3) >> 128;\\n if (absTick & 0x800 != 0) ratio = (ratio * 0xe7159475a2c29b7443b29c7fa6e889d9) >> 128;\\n if (absTick & 0x1000 != 0) ratio = (ratio * 0xd097f3bdfd2022b8845ad8f792aa5825) >> 128;\\n if (absTick & 0x2000 != 0) ratio = (ratio * 0xa9f746462d870fdf8a65dc1f90e061e5) >> 128;\\n if (absTick & 0x4000 != 0) ratio = (ratio * 0x70d869a156d2a1b890bb3df62baf32f7) >> 128;\\n if (absTick & 0x8000 != 0) ratio = (ratio * 0x31be135f97d08fd981231505542fcfa6) >> 128;\\n if (absTick & 0x10000 != 0) ratio = (ratio * 0x9aa508b5b7a84e1c677de54f3e99bc9) >> 128;\\n if (absTick & 0x20000 != 0) ratio = (ratio * 0x5d6af8dedb81196699c329225ee604) >> 128;\\n if (absTick & 0x40000 != 0) ratio = (ratio * 0x2216e584f5fa1ea926041bedfe98) >> 128;\\n if (absTick & 0x80000 != 0) ratio = (ratio * 0x48a170391f7dc42444e8fa2) >> 128;\\n\\n if (tick > 0) ratio = type(uint256).max / ratio;\\n\\n // Divides by 1<<32 rounding up to go from a Q128.128 to a Q128.96.\\n // we then downcast because we know the result always fits within 160 bits due to our tick input constraint\\n // we round up in the division so getTickAtSqrtRatio of the output price is always consistent\\n sqrtPriceX96 = uint160((ratio >> 32) + (ratio % (1 << 32) == 0 ? 0 : 1));\\n }\\n\\n /// @notice Calculates the greatest tick value such that getRatioAtTick(tick) <= ratio\\n /// @dev Throws in case sqrtPriceX96 < MIN_SQRT_RATIO, as MIN_SQRT_RATIO is the lowest value getRatioAtTick may ever return.\\n /// @param sqrtPriceX96 The sqrt ratio for which to compute the tick as a Q64.96\\n /// @return tick The greatest tick for which the ratio is less than or equal to the input ratio\\n function getTickAtSqrtRatio(uint160 sqrtPriceX96) internal pure returns (int24 tick) {\\n // Second inequality must be < because the price can never reach the price at the max tick\\n require(sqrtPriceX96 >= MIN_SQRT_RATIO && sqrtPriceX96 < MAX_SQRT_RATIO, 'R');\\n uint256 ratio = uint256(sqrtPriceX96) << 32;\\n\\n uint256 r = ratio;\\n uint256 msb = 0;\\n\\n assembly {\\n let f := shl(7, gt(r, 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF))\\n msb := or(msb, f)\\n r := shr(f, r)\\n }\\n assembly {\\n let f := shl(6, gt(r, 0xFFFFFFFFFFFFFFFF))\\n msb := or(msb, f)\\n r := shr(f, r)\\n }\\n assembly {\\n let f := shl(5, gt(r, 0xFFFFFFFF))\\n msb := or(msb, f)\\n r := shr(f, r)\\n }\\n assembly {\\n let f := shl(4, gt(r, 0xFFFF))\\n msb := or(msb, f)\\n r := shr(f, r)\\n }\\n assembly {\\n let f := shl(3, gt(r, 0xFF))\\n msb := or(msb, f)\\n r := shr(f, r)\\n }\\n assembly {\\n let f := shl(2, gt(r, 0xF))\\n msb := or(msb, f)\\n r := shr(f, r)\\n }\\n assembly {\\n let f := shl(1, gt(r, 0x3))\\n msb := or(msb, f)\\n r := shr(f, r)\\n }\\n assembly {\\n let f := gt(r, 0x1)\\n msb := or(msb, f)\\n }\\n\\n if (msb >= 128) r = ratio >> (msb - 127);\\n else r = ratio << (127 - msb);\\n\\n int256 log_2 = (int256(msb) - 128) << 64;\\n\\n assembly {\\n r := shr(127, mul(r, r))\\n let f := shr(128, r)\\n log_2 := or(log_2, shl(63, f))\\n r := shr(f, r)\\n }\\n assembly {\\n r := shr(127, mul(r, r))\\n let f := shr(128, r)\\n log_2 := or(log_2, shl(62, f))\\n r := shr(f, r)\\n }\\n assembly {\\n r := shr(127, mul(r, r))\\n let f := shr(128, r)\\n log_2 := or(log_2, shl(61, f))\\n r := shr(f, r)\\n }\\n assembly {\\n r := shr(127, mul(r, r))\\n let f := shr(128, r)\\n log_2 := or(log_2, shl(60, f))\\n r := shr(f, r)\\n }\\n assembly {\\n r := shr(127, mul(r, r))\\n let f := shr(128, r)\\n log_2 := or(log_2, shl(59, f))\\n r := shr(f, r)\\n }\\n assembly {\\n r := shr(127, mul(r, r))\\n let f := shr(128, r)\\n log_2 := or(log_2, shl(58, f))\\n r := shr(f, r)\\n }\\n assembly {\\n r := shr(127, mul(r, r))\\n let f := shr(128, r)\\n log_2 := or(log_2, shl(57, f))\\n r := shr(f, r)\\n }\\n assembly {\\n r := shr(127, mul(r, r))\\n let f := shr(128, r)\\n log_2 := or(log_2, shl(56, f))\\n r := shr(f, r)\\n }\\n assembly {\\n r := shr(127, mul(r, r))\\n let f := shr(128, r)\\n log_2 := or(log_2, shl(55, f))\\n r := shr(f, r)\\n }\\n assembly {\\n r := shr(127, mul(r, r))\\n let f := shr(128, r)\\n log_2 := or(log_2, shl(54, f))\\n r := shr(f, r)\\n }\\n assembly {\\n r := shr(127, mul(r, r))\\n let f := shr(128, r)\\n log_2 := or(log_2, shl(53, f))\\n r := shr(f, r)\\n }\\n assembly {\\n r := shr(127, mul(r, r))\\n let f := shr(128, r)\\n log_2 := or(log_2, shl(52, f))\\n r := shr(f, r)\\n }\\n assembly {\\n r := shr(127, mul(r, r))\\n let f := shr(128, r)\\n log_2 := or(log_2, shl(51, f))\\n r := shr(f, r)\\n }\\n assembly {\\n r := shr(127, mul(r, r))\\n let f := shr(128, r)\\n log_2 := or(log_2, shl(50, f))\\n }\\n\\n int256 log_sqrt10001 = log_2 * 255738958999603826347141; // 128.128 number\\n\\n int24 tickLow = int24((log_sqrt10001 - 3402992956809132418596140100660247210) >> 128);\\n int24 tickHi = int24((log_sqrt10001 + 291339464771989622907027621153398088495) >> 128);\\n\\n tick = tickLow == tickHi ? tickLow : getSqrtRatioAtTick(tickHi) <= sqrtPriceX96 ? tickHi : tickLow;\\n }\\n}\\n\",\"keccak256\":\"0x11b965ba576ff91b4a6e9533c0f334f2b7b6024ee1c54e36d21799de5580899d\",\"license\":\"GPL-2.0-or-later\"},\"solidity/contracts/peripherals/Governable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4 <0.9.0;\\n\\nimport '../../interfaces/peripherals/IGovernable.sol';\\n\\nabstract contract Governable is IGovernable {\\n /// @inheritdoc IGovernable\\n address public override governance;\\n\\n /// @inheritdoc IGovernable\\n address public override pendingGovernance;\\n\\n constructor(address _governance) {\\n if (_governance == address(0)) revert NoGovernanceZeroAddress();\\n governance = _governance;\\n }\\n\\n /// @inheritdoc IGovernable\\n function setGovernance(address _governance) external override onlyGovernance {\\n pendingGovernance = _governance;\\n emit GovernanceProposal(_governance);\\n }\\n\\n /// @inheritdoc IGovernable\\n function acceptGovernance() external override onlyPendingGovernance {\\n governance = pendingGovernance;\\n delete pendingGovernance;\\n emit GovernanceSet(governance);\\n }\\n\\n /// @notice Functions with this modifier can only be called by governance\\n modifier onlyGovernance {\\n if (msg.sender != governance) revert OnlyGovernance();\\n _;\\n }\\n\\n /// @notice Functions with this modifier can only be called by pendingGovernance\\n modifier onlyPendingGovernance {\\n if (msg.sender != pendingGovernance) revert OnlyPendingGovernance();\\n _;\\n }\\n}\\n\",\"keccak256\":\"0x5b6d7601a42d2229657a7f60021c7e2bfe890c3541ab0003f7d88e20a28d722b\",\"license\":\"MIT\"},\"solidity/interfaces/IPairManager.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4 <0.9.0;\\n\\nimport '@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol';\\n\\n/// @title Pair Manager interface\\n/// @notice Generic interface for Keep3r liquidity pools (kLP)\\ninterface IPairManager is IERC20Metadata {\\n /// @notice Address of the factory from which the pair manager was created\\n /// @return _factory The address of the PairManager Factory\\n function factory() external view returns (address _factory);\\n\\n /// @notice Address of the pool from which the Keep3r pair manager will interact with\\n /// @return _pool The address of the pool\\n function pool() external view returns (address _pool);\\n\\n /// @notice Token0 of the pool\\n /// @return _token0 The address of token0\\n function token0() external view returns (address _token0);\\n\\n /// @notice Token1 of the pool\\n /// @return _token1 The address of token1\\n function token1() external view returns (address _token1);\\n}\\n\",\"keccak256\":\"0x345c312b340c5775fb8f68d89ce851c7f75522940bd9bc64f2301a3f8312636a\",\"license\":\"MIT\"},\"solidity/interfaces/IUniV3PairManager.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4 <0.9.0;\\n\\nimport './IPairManager.sol';\\nimport '../contracts/libraries/PoolAddress.sol';\\nimport '@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol';\\nimport './peripherals/IGovernable.sol';\\n\\n/// @title Pair Manager contract\\n/// @notice Creates a UniswapV3 position, and tokenizes in an ERC20 manner\\n/// so that the user can use it as liquidity for a Keep3rJob\\ninterface IUniV3PairManager is IGovernable, IPairManager {\\n // Structs\\n\\n /// @notice The data to be decoded by the UniswapV3MintCallback function\\n struct MintCallbackData {\\n PoolAddress.PoolKey _poolKey; // Struct that contains token0, token1, and fee of the pool passed into the constructor\\n address payer; // The address of the payer, which will be the msg.sender of the mint function\\n }\\n\\n // Variables\\n\\n /// @notice The fee of the Uniswap pool passed into the constructor\\n /// @return _fee The fee of the Uniswap pool passed into the constructor\\n function fee() external view returns (uint24 _fee);\\n\\n /// @notice Highest tick in the Uniswap's curve\\n /// @return _tickUpper The highest tick in the Uniswap's curve\\n function tickUpper() external view returns (int24 _tickUpper);\\n\\n /// @notice Lowest tick in the Uniswap's curve\\n /// @return _tickLower The lower tick in the Uniswap's curve\\n function tickLower() external view returns (int24 _tickLower);\\n\\n /// @notice The pair tick spacing\\n /// @return _tickSpacing The pair tick spacing\\n function tickSpacing() external view returns (int24 _tickSpacing);\\n\\n /// @notice The sqrtRatioAX96 at the lowest tick (-887200) of the Uniswap pool\\n /// @return _sqrtPriceA96 A Fixed point Q64.96 number representing the sqrt of the ratio of the two assets (token1/token0)\\n /// at the lowest tick\\n function sqrtRatioAX96() external view returns (uint160 _sqrtPriceA96);\\n\\n /// @notice The sqrtRatioBX96 at the highest tick (887200) of the Uniswap pool\\n /// @return _sqrtPriceBX96 A Fixed point Q64.96 number representing the sqrt of the ratio of the two assets (token1/token0)\\n /// at the highest tick\\n function sqrtRatioBX96() external view returns (uint160 _sqrtPriceBX96);\\n\\n // Errors\\n\\n /// @notice Throws when the caller of the function is not the pool\\n error OnlyPool();\\n\\n /// @notice Throws when the slippage exceeds what the user is comfortable with\\n error ExcessiveSlippage();\\n\\n /// @notice Throws when a transfer is unsuccessful\\n error UnsuccessfulTransfer();\\n\\n // Methods\\n\\n /// @notice This function is called after a user calls IUniV3PairManager#mint function\\n /// It ensures that any tokens owed to the pool are paid by the msg.sender of IUniV3PairManager#mint function\\n /// @param amount0Owed The amount of token0 due to the pool for the minted liquidity\\n /// @param amount1Owed The amount of token1 due to the pool for the minted liquidity\\n /// @param data The encoded token0, token1, fee (_poolKey) and the payer (msg.sender) of the IUniV3PairManager#mint function\\n function uniswapV3MintCallback(\\n uint256 amount0Owed,\\n uint256 amount1Owed,\\n bytes calldata data\\n ) external;\\n\\n /// @notice Mints kLP tokens to an address according to the liquidity the msg.sender provides to the UniswapV3 pool\\n /// @dev Triggers UniV3PairManager#uniswapV3MintCallback\\n /// @param amount0Desired The amount of token0 we would like to provide\\n /// @param amount1Desired The amount of token1 we would like to provide\\n /// @param amount0Min The minimum amount of token0 we want to provide\\n /// @param amount1Min The minimum amount of token1 we want to provide\\n /// @param to The address to which the kLP tokens are going to be minted to\\n /// @return liquidity kLP tokens sent in exchange for the provision of tokens\\n function mint(\\n uint256 amount0Desired,\\n uint256 amount1Desired,\\n uint256 amount0Min,\\n uint256 amount1Min,\\n address to\\n ) external returns (uint128 liquidity);\\n\\n /// @notice Returns the pair manager's position in the corresponding UniswapV3 pool\\n /// @return liquidity The amount of liquidity provided to the UniswapV3 pool by the pair manager\\n /// @return feeGrowthInside0LastX128 The fee growth of token0 as of the last action on the individual position\\n /// @return feeGrowthInside1LastX128 The fee growth of token1 as of the last action on the individual position\\n /// @return tokensOwed0 The uncollected amount of token0 owed to the position as of the last computation\\n /// @return tokensOwed1 The uncollected amount of token1 owed to the position as of the last computation\\n function position()\\n external\\n view\\n returns (\\n uint128 liquidity,\\n uint256 feeGrowthInside0LastX128,\\n uint256 feeGrowthInside1LastX128,\\n uint128 tokensOwed0,\\n uint128 tokensOwed1\\n );\\n\\n /// @notice Calls the UniswapV3 pool's collect function, which collects up to a maximum amount of fees\\n // owed to a specific position to the recipient, in this case, that recipient is the pair manager\\n /// @dev The collected fees will be sent to governance\\n /// @return amount0 The amount of fees collected in token0\\n /// @return amount1 The amount of fees collected in token1\\n function collect() external returns (uint256 amount0, uint256 amount1);\\n\\n /// @notice Burns the corresponding amount of kLP tokens from the msg.sender and withdraws the specified liquidity\\n // in the entire range\\n /// @param liquidity The amount of liquidity to be burned\\n /// @param amount0Min The minimum amount of token0 we want to send to the recipient (to)\\n /// @param amount1Min The minimum amount of token1 we want to send to the recipient (to)\\n /// @param to The address that will receive the due fees\\n /// @return amount0 The calculated amount of token0 that will be sent to the recipient\\n /// @return amount1 The calculated amount of token1 that will be sent to the recipient\\n function burn(\\n uint128 liquidity,\\n uint256 amount0Min,\\n uint256 amount1Min,\\n address to\\n ) external returns (uint256 amount0, uint256 amount1);\\n}\\n\",\"keccak256\":\"0x5d5793eaa4ed95d51d6185af159921fca68a3020b151bde710e1a6f58f288cfe\",\"license\":\"MIT\"},\"solidity/interfaces/external/IWeth9.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4 <0.9.0;\\n\\nimport '@openzeppelin/contracts/token/ERC20/IERC20.sol';\\n\\ninterface IWeth9 is IERC20 {\\n function deposit() external payable;\\n\\n function withdraw(uint256) external;\\n}\\n\",\"keccak256\":\"0x62b6fd021e9fef703f5c77705d8da9ee1967e34e00a0c8a827ee3c0f973399a5\",\"license\":\"MIT\"},\"solidity/interfaces/peripherals/IGovernable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4 <0.9.0;\\n\\n/// @title Governable contract\\n/// @notice Manages the governance role\\ninterface IGovernable {\\n // Events\\n\\n /// @notice Emitted when pendingGovernance accepts to be governance\\n /// @param _governance Address of the new governance\\n event GovernanceSet(address _governance);\\n\\n /// @notice Emitted when a new governance is proposed\\n /// @param _pendingGovernance Address that is proposed to be the new governance\\n event GovernanceProposal(address _pendingGovernance);\\n\\n // Errors\\n\\n /// @notice Throws if the caller of the function is not governance\\n error OnlyGovernance();\\n\\n /// @notice Throws if the caller of the function is not pendingGovernance\\n error OnlyPendingGovernance();\\n\\n /// @notice Throws if trying to set governance to zero address\\n error NoGovernanceZeroAddress();\\n\\n // Variables\\n\\n /// @notice Stores the governance address\\n /// @return _governance The governance addresss\\n function governance() external view returns (address _governance);\\n\\n /// @notice Stores the pendingGovernance address\\n /// @return _pendingGovernance The pendingGovernance addresss\\n function pendingGovernance() external view returns (address _pendingGovernance);\\n\\n // Methods\\n\\n /// @notice Proposes a new address to be governance\\n /// @param _governance The address being proposed as the new governance\\n function setGovernance(address _governance) external;\\n\\n /// @notice Changes the governance from the current governance to the previously proposed address\\n function acceptGovernance() external;\\n}\\n\",\"keccak256\":\"0x3284624b2479bbf97c821f37c93a096dcb869b30bbf9b20d30d1800f9535452c\",\"license\":\"MIT\"}},\"version\":1}", - "bytecode": "0x6101c06040523480156200001257600080fd5b50604051620031a2380380620031a2833981016040819052620000359162000b61565b806001600160a01b0381166200005d5760405162b293ed60e81b815260040160405180910390fd5b600080546001600160a01b0319166001600160a01b039283161781556040805163ddca3f4360e01b81529051919285169163ddca3f4391600480820192602092909190829003018186803b158015620000b557600080fd5b505afa158015620000ca573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190620000f0919062000c76565b90506000836001600160a01b0316630dfe16816040518163ffffffff1660e01b815260040160206040518083038186803b1580156200012e57600080fd5b505afa15801562000143573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019062000169919062000b3c565b90506000846001600160a01b031663d21220a76040518163ffffffff1660e01b815260040160206040518083038186803b158015620001a757600080fd5b505afa158015620001bc573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190620001e2919062000b3c565b90506000856001600160a01b031663d0c93a7c6040518163ffffffff1660e01b815260040160206040518083038186803b1580156200022057600080fd5b505afa15801562000235573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906200025b919062000b99565b905060006200026e82620d89e862000e56565b6200027d90620d89e862000d98565b905060006200028c8262000e92565b33606090811b60805289811b6001600160601b031990811660e05260e889811b6001600160e81b03191661010052600287810b810b821b6101a05286810b810b821b6101805284810b900b901b6101605287821b811660a0529086901b1660c052604080516395d89b4160e01b815290519192506001600160a01b038716916395d89b4191600480820192600092909190829003018186803b1580156200033257600080fd5b505afa15801562000347573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f1916820160405262000371919081019062000bbe565b846001600160a01b03166395d89b416040518163ffffffff1660e01b815260040160006040518083038186803b158015620003ab57600080fd5b505afa158015620003c0573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052620003ea919081019062000bbe565b604051602001620003fd92919062000ced565b604051602081830303815290604052600290805190602001906200042392919062000a79565b50846001600160a01b03166395d89b416040518163ffffffff1660e01b815260040160006040518083038186803b1580156200045e57600080fd5b505afa15801562000473573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526200049d919081019062000bbe565b846001600160a01b03166395d89b416040518163ffffffff1660e01b815260040160006040518083038186803b158015620004d757600080fd5b505afa158015620004ec573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f1916820160405262000516919081019062000bbe565b6040516020016200052992919062000c9d565b604051602081830303815290604052600390805190602001906200054f92919062000a79565b5062000566816200061760201b62000e861760201c565b6001600160a01b0316610120816001600160a01b031660601b8152505062000599826200061760201b62000e861760201c565b606090811b6001600160601b031916610140526040805191820181526001600160a01b03968716808352959096166020820181905262ffffff9790971695018590525050600780546001600160a01b03191690921790915550600880546001600160b81b031916909217600160a01b9091021790555062000f1a9050565b60008060008360020b1262000630578260020b6200063f565b8260020b6200063f9062000eb8565b905062000650620d89e71962000e92565b60020b8111156200068b5760405162461bcd60e51b81526020600482015260016024820152601560fa1b604482015260640160405180910390fd5b600060018216620006a157600160801b620006b3565b6ffffcb933bd6fad37aa2d162d1a5940015b6001600160881b031690506002821615620006eb576080620006e6826ffff97272373d413259a46990580e213a62000d76565b901c90505b60048216156200071857608062000713826ffff2e50f5f656932ef12357cf3c7fdcc62000d76565b901c90505b60088216156200074557608062000740826fffe5caca7e10e4e61c3624eaa0941cd062000d76565b901c90505b6010821615620007725760806200076d826fffcb9843d60f6159c9db58835c92664462000d76565b901c90505b60208216156200079f5760806200079a826fff973b41fa98c081472e6896dfb254c062000d76565b901c90505b6040821615620007cc576080620007c7826fff2ea16466c96a3843ec78b326b5286162000d76565b901c90505b6080821615620007f9576080620007f4826ffe5dee046a99a2a811c461f1969c305362000d76565b901c90505b6101008216156200082757608062000822826ffcbe86c7900a88aedcffc83b479aa3a462000d76565b901c90505b6102008216156200085557608062000850826ff987a7253ac413176f2b074cf7815e5462000d76565b901c90505b610400821615620008835760806200087e826ff3392b0822b70005940c7a398e4b70f362000d76565b901c90505b610800821615620008b1576080620008ac826fe7159475a2c29b7443b29c7fa6e889d962000d76565b901c90505b611000821615620008df576080620008da826fd097f3bdfd2022b8845ad8f792aa582562000d76565b901c90505b6120008216156200090d57608062000908826fa9f746462d870fdf8a65dc1f90e061e562000d76565b901c90505b6140008216156200093b57608062000936826f70d869a156d2a1b890bb3df62baf32f762000d76565b901c90505b6180008216156200096957608062000964826f31be135f97d08fd981231505542fcfa662000d76565b901c90505b620100008216156200099857608062000993826f09aa508b5b7a84e1c677de54f3e99bc962000d76565b901c90505b62020000821615620009c6576080620009c1826e5d6af8dedb81196699c329225ee60462000d76565b901c90505b62040000821615620009f3576080620009ee826d2216e584f5fa1ea926041bedfe9862000d76565b901c90505b6208000082161562000a1e57608062000a19826b048a170391f7dc42444e8fa262000d76565b901c90505b60008460020b131562000a3c5762000a398160001962000d5f565b90505b62000a4d6401000000008262000e7b565b1562000a5b57600162000a5e565b60005b62000a719060ff16602083901c62000d44565b949350505050565b82805462000a879062000e19565b90600052602060002090601f01602090048101928262000aab576000855562000af6565b82601f1062000ac657805160ff191683800117855562000af6565b8280016001018555821562000af6579182015b8281111562000af657825182559160200191906001019062000ad9565b5062000b0492915062000b08565b5090565b5b8082111562000b04576000815560010162000b09565b80516001600160a01b038116811462000b3757600080fd5b919050565b60006020828403121562000b4f57600080fd5b62000b5a8262000b1f565b9392505050565b6000806040838503121562000b7557600080fd5b62000b808362000b1f565b915062000b906020840162000b1f565b90509250929050565b60006020828403121562000bac57600080fd5b81518060020b811462000b5a57600080fd5b60006020828403121562000bd157600080fd5b81516001600160401b038082111562000be957600080fd5b818401915084601f83011262000bfe57600080fd5b81518181111562000c135762000c1362000f04565b604051601f8201601f19908116603f0116810190838211818310171562000c3e5762000c3e62000f04565b8160405282815287602084870101111562000c5857600080fd5b62000c6b83602083016020880162000de6565b979650505050505050565b60006020828403121562000c8957600080fd5b815162ffffff8116811462000b5a57600080fd5b636b4c502d60e01b81526000835162000cbe81600485016020880162000de6565b602f60f81b600491840191820152835162000ce181600584016020880162000de6565b01600501949350505050565b6a025b2b2b819b926281016960ad1b81526000835162000d1581600b85016020880162000de6565b602f60f81b600b91840191820152835162000d3881600c84016020880162000de6565b01600c01949350505050565b6000821982111562000d5a5762000d5a62000ed8565b500190565b60008262000d715762000d7162000eee565b500490565b600081600019048311821515161562000d935762000d9362000ed8565b500290565b60008160020b8360020b6000811281627fffff190183128115161562000dc25762000dc262000ed8565b81627fffff01831381161562000ddc5762000ddc62000ed8565b5090039392505050565b60005b8381101562000e0357818101518382015260200162000de9565b8381111562000e13576000848401525b50505050565b600181811c9082168062000e2e57607f821691505b6020821081141562000e5057634e487b7160e01b600052602260045260246000fd5b50919050565b60008260020b8062000e6c5762000e6c62000eee565b808360020b0791505092915050565b60008262000e8d5762000e8d62000eee565b500690565b60008160020b627fffff1981141562000eaf5762000eaf62000ed8565b60000392915050565b6000600160ff1b82141562000ed15762000ed162000ed8565b5060000390565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052601260045260246000fd5b634e487b7160e01b600052604160045260246000fd5b60805160601c60a05160601c60c05160601c60e05160601c6101005160e81c6101205160601c6101405160601c6101605160e81c6101805160e81c6101a05160e81c6121466200105c60003960006104200152600081816102bd015281816105e60152818161097b01528181610ad201528181610cc901528181610df301526115080152600081816102f7015281816105c50152818161095001528181610ab001528181610ca801528181610dd101526114e60152600081816103d101526113fe01526000818161027c01526113dd015260006104ac01526000818161022101528181610595015281816109bf01528181610a8101528181610b8801528181610bdb01528181610c1901528181610c7801528181610d9e0152818161134001526114b501526000610447015260006101ed015260006103aa01526121466000f3fe608060405234801561001057600080fd5b50600436106101645760003560e01c806395d89b41116100c957806395d89b411461034c578063a3e6dc2814610354578063a9059cbb1461037f578063ab033ea914610392578063c45a0155146103a5578063c6275261146103cc578063cf51148d146103f3578063d0c93a7c1461041b578063d21220a714610442578063d348799714610469578063dd62ed3e1461047c578063ddca3f43146104a7578063e5225381146104e2578063f39c38a0146104ea57600080fd5b806306fdde031461016957806309218e9114610187578063095ea7b3146101c55780630dfe1681146101e857806316f0115b1461021c57806318160ddd14610243578063238efcbc1461025a57806323b872dd146102645780632ea28f5b14610277578063313ce5671461029e57806355b812a8146102b857806359c4f905146102f25780635aa6e6751461031957806370a082311461032c575b600080fd5b6101716104fd565b60405161017e9190611f09565b60405180910390f35b61018f61058b565b604080516001600160801b039687168152602081019590955284019290925283166060830152909116608082015260a00161017e565b6101d86101d3366004611a98565b6106ac565b604051901515815260200161017e565b61020f7f000000000000000000000000000000000000000000000000000000000000000081565b60405161017e9190611e68565b61020f7f000000000000000000000000000000000000000000000000000000000000000081565b61024c60045481565b60405190815260200161017e565b610262610718565b005b6101d8610272366004611a57565b6107a4565b61020f7f000000000000000000000000000000000000000000000000000000000000000081565b6102a6601281565b60405160ff909116815260200161017e565b6102df7f000000000000000000000000000000000000000000000000000000000000000081565b60405160029190910b815260200161017e565b6102df7f000000000000000000000000000000000000000000000000000000000000000081565b60005461020f906001600160a01b031681565b61024c61033a366004611a01565b60066020526000908152604090205481565b61017161086d565b610367610362366004611db1565b61087a565b6040516001600160801b03909116815260200161017e565b6101d861038d366004611a98565b6108aa565b6102626103a0366004611a01565b6108c0565b61020f7f000000000000000000000000000000000000000000000000000000000000000081565b61020f7f000000000000000000000000000000000000000000000000000000000000000081565b610406610401366004611bc8565b610941565b6040805192835260208301919091520161017e565b6102df7f000000000000000000000000000000000000000000000000000000000000000081565b61020f7f000000000000000000000000000000000000000000000000000000000000000081565b610262610477366004611d32565b610b6d565b61024c61048a366004611a1e565b600560209081526000928352604080842090915290825290205481565b6104ce7f000000000000000000000000000000000000000000000000000000000000000081565b60405162ffffff909116815260200161017e565b610406610c45565b60015461020f906001600160a01b031681565b6002805461050a90612008565b80601f016020809104026020016040519081016040528092919081815260200182805461053690612008565b80156105835780601f1061055857610100808354040283529160200191610583565b820191906000526020600020905b81548152906001019060200180831161056657829003601f168201915b505050505081565b60008060008060007f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031663514ea4bf307f00000000000000000000000000000000000000000000000000000000000000007f000000000000000000000000000000000000000000000000000000000000000060405160200161061793929190611e1c565b604051602081830303815290604052805190602001206040518263ffffffff1660e01b815260040161064b91815260200190565b60a06040518083038186803b15801561066357600080fd5b505afa158015610677573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061069b9190611c12565b939992985090965094509092509050565b3360008181526005602090815260408083206001600160a01b038716808552925280832085905551919290917f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925906107079086815260200190565b60405180910390a350600192915050565b6001546001600160a01b0316331461074357604051637ef5703160e11b815260040160405180910390fd5b60018054600080546001600160a01b0383166001600160a01b031991821681179092559091169091556040517fc73be659241aade67e9a059bcf21494955018b213dbd1179054ccf928b13f3b69161079a91611e68565b60405180910390a1565b6001600160a01b0383166000818152600560209081526040808320338085529252822054919290919082148015906107de57506000198114155b156108545760006107ef8583611fc5565b6001600160a01b038881166000818152600560209081526040808320948916808452948252918290208590559051848152939450919290917f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505b61085f86868661129c565b6001925050505b9392505050565b6003805461050a90612008565b600061088886868686611338565b509091506108a19050826001600160801b0383166115bf565b95945050505050565b60006108b733848461129c565b50600192915050565b6000546001600160a01b031633146108eb576040516354348f0360e01b815260040160405180910390fd5b600180546001600160a01b0319166001600160a01b0383161790556040517fe987aaedf9d279143bdf1eee16cf1d0feb47742867d81083df8d6cd0a5ac857f90610936908390611e68565b60405180910390a150565b60405163a34123a760e01b81527f0000000000000000000000000000000000000000000000000000000000000000600290810b60048301527f0000000000000000000000000000000000000000000000000000000000000000900b60248201526001600160801b038516604482015260009081906001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000169063a34123a7906064016040805180830381600087803b158015610a0257600080fd5b505af1158015610a16573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a3a9190611d0e565b909250905084821080610a4c57508381105b15610a6a576040516397c7f53760e01b815260040160405180910390fd5b6040516309e3d67b60e31b81526001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001690634f1eb3d890610afe9086907f0000000000000000000000000000000000000000000000000000000000000000907f00000000000000000000000000000000000000000000000000000000000000009088908890600401611ecc565b6040805180830381600087803b158015610b1757600080fd5b505af1158015610b2b573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610b4f9190611b99565b5050610b6433876001600160801b0316611637565b94509492505050565b6000610b7b82840184611adf565b9050336001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001614610bc657604051634b60273560e01b815260040160405180910390fd5b8415610c00578051516020820151610c0091907f0000000000000000000000000000000000000000000000000000000000000000886116a7565b8315610c3e57610c3e81600001516020015182602001517f0000000000000000000000000000000000000000000000000000000000000000876116a7565b5050505050565b6000805481906001600160a01b03163314610c73576040516354348f0360e01b815260040160405180910390fd5b6000807f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031663514ea4bf307f00000000000000000000000000000000000000000000000000000000000000007f0000000000000000000000000000000000000000000000000000000000000000604051602001610cfa93929190611e1c565b604051602081830303815290604052805190602001206040518263ffffffff1660e01b8152600401610d2e91815260200190565b60a06040518083038186803b158015610d4657600080fd5b505afa158015610d5a573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d7e9190611c12565b6000546040516309e3d67b60e31b81529297509095506001600160a01b037f000000000000000000000000000000000000000000000000000000000000000081169550634f1eb3d89450610e1f935016907f0000000000000000000000000000000000000000000000000000000000000000907f00000000000000000000000000000000000000000000000000000000000000009088908890600401611ecc565b6040805180830381600087803b158015610e3857600080fd5b505af1158015610e4c573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e709190611b99565b6001600160801b03918216969116945092505050565b60008060008360020b12610e9d578260020b610eaa565b8260020b610eaa9061207a565b9050610eb9620d89e719612057565b60020b811115610ef35760405162461bcd60e51b81526020600482015260016024820152601560fa1b604482015260640160405180910390fd5b600060018216610f0757600160801b610f19565b6ffffcb933bd6fad37aa2d162d1a5940015b6001600160881b031690506002821615610f4e576080610f49826ffff97272373d413259a46990580e213a611f7e565b901c90505b6004821615610f78576080610f73826ffff2e50f5f656932ef12357cf3c7fdcc611f7e565b901c90505b6008821615610fa2576080610f9d826fffe5caca7e10e4e61c3624eaa0941cd0611f7e565b901c90505b6010821615610fcc576080610fc7826fffcb9843d60f6159c9db58835c926644611f7e565b901c90505b6020821615610ff6576080610ff1826fff973b41fa98c081472e6896dfb254c0611f7e565b901c90505b604082161561102057608061101b826fff2ea16466c96a3843ec78b326b52861611f7e565b901c90505b608082161561104a576080611045826ffe5dee046a99a2a811c461f1969c3053611f7e565b901c90505b610100821615611075576080611070826ffcbe86c7900a88aedcffc83b479aa3a4611f7e565b901c90505b6102008216156110a057608061109b826ff987a7253ac413176f2b074cf7815e54611f7e565b901c90505b6104008216156110cb5760806110c6826ff3392b0822b70005940c7a398e4b70f3611f7e565b901c90505b6108008216156110f65760806110f1826fe7159475a2c29b7443b29c7fa6e889d9611f7e565b901c90505b61100082161561112157608061111c826fd097f3bdfd2022b8845ad8f792aa5825611f7e565b901c90505b61200082161561114c576080611147826fa9f746462d870fdf8a65dc1f90e061e5611f7e565b901c90505b614000821615611177576080611172826f70d869a156d2a1b890bb3df62baf32f7611f7e565b901c90505b6180008216156111a257608061119d826f31be135f97d08fd981231505542fcfa6611f7e565b901c90505b620100008216156111ce5760806111c9826f09aa508b5b7a84e1c677de54f3e99bc9611f7e565b901c90505b620200008216156111f95760806111f4826e5d6af8dedb81196699c329225ee604611f7e565b901c90505b6204000082161561122357608061121e826d2216e584f5fa1ea926041bedfe98611f7e565b901c90505b6208000082161561124b576080611246826b048a170391f7dc42444e8fa2611f7e565b901c90505b60008460020b13156112665761126381600019611f6a565b90505b611274600160201b82612043565b15611280576001611283565b60005b6112949060ff16602083901c611f52565b949350505050565b6001600160a01b038316600090815260066020526040812080548392906112c4908490611fc5565b90915550506001600160a01b038216600090815260066020526040812080548392906112f1908490611f52565b92505081905550816001600160a01b0316836001600160a01b03166000805160206120f18339815191528360405161132b91815260200190565b60405180910390a3505050565b6000806000807f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316633850c7bd6040518163ffffffff1660e01b815260040160e06040518083038186803b15801561139757600080fd5b505afa1580156113ab573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906113cf9190611c74565b5050505050509050611424817f00000000000000000000000000000000000000000000000000000000000000007f00000000000000000000000000000000000000000000000000000000000000008b8b6116b9565b6040805160a080820183526007546001600160a01b039081168385018181526008548084166060808801918252600160a01b90920462ffffff9081166080808a01918252948952336020998a019081528a51998a019690965291518616888a01529051169086015290518216848201528451808503909101815291830193849052633c8a7d8d60e01b9093529296507f000000000000000000000000000000000000000000000000000000000000000090911691633c8a7d8d916115339130917f0000000000000000000000000000000000000000000000000000000000000000917f0000000000000000000000000000000000000000000000000000000000000000918b919060a401611e7c565b6040805180830381600087803b15801561154c57600080fd5b505af1158015611560573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906115849190611d0e565b90935091508583108061159657508482105b156115b4576040516397c7f53760e01b815260040160405180910390fd5b509450945094915050565b80600460008282546115d19190611f52565b90915550506001600160a01b038216600090815260066020526040812080548392906115fe908490611f52565b90915550506040518181526001600160a01b038316906000906000805160206120f1833981519152906020015b60405180910390a35050565b80600460008282546116499190611fc5565b90915550506001600160a01b03821660009081526006602052604081208054839290611676908490611fc5565b90915550506040518181526000906001600160a01b038416906000805160206120f18339815191529060200161162b565b6116b38484848461177b565b50505050565b6000836001600160a01b0316856001600160a01b031611156116d9579293925b846001600160a01b0316866001600160a01b031611611704576116fd858585611875565b90506108a1565b836001600160a01b0316866001600160a01b0316101561176657600061172b878686611875565b9050600061173a8789866118df565b9050806001600160801b0316826001600160801b03161061175b578061175d565b815b925050506108a1565b6117718585846118df565b9695505050505050565b604080516001600160a01b0385811660248301528481166044830152606480830185905283518084039091018152608490920183526020820180516001600160e01b03166323b872dd60e01b17905291516000928392908816916117df9190611e4c565b6000604051808303816000865af19150503d806000811461181c576040519150601f19603f3d011682016040523d82523d6000602084013e611821565b606091505b509150915081158061184f575080511580159061184f57508080602001905181019061184d9190611ac4565b155b1561186d576040516316369daf60e31b815260040160405180910390fd5b505050505050565b6000826001600160a01b0316846001600160a01b03161115611895579192915b60006118b8856001600160a01b0316856001600160a01b0316600160601b611915565b90506108a16118da84836118cc8989611f9d565b6001600160a01b0316611915565b6119c4565b6000826001600160a01b0316846001600160a01b031611156118ff579192915b6112946118da83600160601b6118cc8888611f9d565b60008080600019858709858702925082811083820303915050806000141561194f576000841161194457600080fd5b508290049050610866565b80841161195b57600080fd5b60008486880960026001871981018816978890046003810283188082028403028082028403028082028403028082028403028082028403029081029092039091026000889003889004909101858311909403939093029303949094049190911702949350505050565b806001600160801b03811681146119da57600080fd5b919050565b805180151581146119da57600080fd5b805161ffff811681146119da57600080fd5b600060208284031215611a1357600080fd5b8135610866816120c3565b60008060408385031215611a3157600080fd5b8235611a3c816120c3565b91506020830135611a4c816120c3565b809150509250929050565b600080600060608486031215611a6c57600080fd5b8335611a77816120c3565b92506020840135611a87816120c3565b929592945050506040919091013590565b60008060408385031215611aab57600080fd5b8235611ab6816120c3565b946020939093013593505050565b600060208284031215611ad657600080fd5b610866826119df565b60008183036080811215611af257600080fd5b604051604081018181106001600160401b0382111715611b2257634e487b7160e01b600052604160045260246000fd5b6040526060821215611b3357600080fd5b611b3b611f1c565b91508335611b48816120c3565b82526020840135611b58816120c3565b6020830152604084013562ffffff81168114611b7357600080fd5b6040830152908152606083013590611b8a826120c3565b60208101919091529392505050565b60008060408385031215611bac57600080fd5b8251611bb7816120db565b6020840151909250611a4c816120db565b60008060008060808587031215611bde57600080fd5b8435611be9816120db565b935060208501359250604085013591506060850135611c07816120c3565b939692955090935050565b600080600080600060a08688031215611c2a57600080fd5b8551611c35816120db565b8095505060208601519350604086015192506060860151611c55816120db565b6080870151909250611c66816120db565b809150509295509295909350565b600080600080600080600060e0888a031215611c8f57600080fd5b8751611c9a816120c3565b8097505060208801518060020b8114611cb257600080fd5b9550611cc0604089016119ef565b9450611cce606089016119ef565b9350611cdc608089016119ef565b925060a088015160ff81168114611cf257600080fd5b9150611d0060c089016119df565b905092959891949750929550565b60008060408385031215611d2157600080fd5b505080516020909101519092909150565b60008060008060608587031215611d4857600080fd5b843593506020850135925060408501356001600160401b0380821115611d6d57600080fd5b818701915087601f830112611d8157600080fd5b813581811115611d9057600080fd5b886020828501011115611da257600080fd5b95989497505060200194505050565b600080600080600060a08688031215611dc957600080fd5b853594506020860135935060408601359250606086013591506080860135611c66816120c3565b60008151808452611e08816020860160208601611fdc565b601f01601f19169290920160200192915050565b60609390931b6001600160601b0319168352600291820b60e890811b6014850152910b901b6017820152601a0190565b60008251611e5e818460208701611fdc565b9190910192915050565b6001600160a01b0391909116815260200190565b6001600160a01b0386168152600285810b602083015284900b60408201526001600160801b038316606082015260a060808201819052600090611ec190830184611df0565b979650505050505050565b6001600160a01b03959095168552600293840b60208601529190920b60408401526001600160801b03918216606084015216608082015260a00190565b6020815260006108666020830184611df0565b604051606081016001600160401b0381118282101715611f4c57634e487b7160e01b600052604160045260246000fd5b60405290565b60008219821115611f6557611f65612097565b500190565b600082611f7957611f796120ad565b500490565b6000816000190483118215151615611f9857611f98612097565b500290565b60006001600160a01b0383811690831681811015611fbd57611fbd612097565b039392505050565b600082821015611fd757611fd7612097565b500390565b60005b83811015611ff7578181015183820152602001611fdf565b838111156116b35750506000910152565b600181811c9082168061201c57607f821691505b6020821081141561203d57634e487b7160e01b600052602260045260246000fd5b50919050565b600082612052576120526120ad565b500690565b60008160020b627fffff1981141561207157612071612097565b60000392915050565b6000600160ff1b82141561209057612090612097565b5060000390565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052601260045260246000fd5b6001600160a01b03811681146120d857600080fd5b50565b6001600160801b03811681146120d857600080fdfeddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3efa2646970667358221220c47c847a056b43ea25f6e31593da6f02c7cd6f9bd76f5baf77f89646b59a4e6964736f6c63430008070033", - "deployedBytecode": "0x608060405234801561001057600080fd5b50600436106101645760003560e01c806395d89b41116100c957806395d89b411461034c578063a3e6dc2814610354578063a9059cbb1461037f578063ab033ea914610392578063c45a0155146103a5578063c6275261146103cc578063cf51148d146103f3578063d0c93a7c1461041b578063d21220a714610442578063d348799714610469578063dd62ed3e1461047c578063ddca3f43146104a7578063e5225381146104e2578063f39c38a0146104ea57600080fd5b806306fdde031461016957806309218e9114610187578063095ea7b3146101c55780630dfe1681146101e857806316f0115b1461021c57806318160ddd14610243578063238efcbc1461025a57806323b872dd146102645780632ea28f5b14610277578063313ce5671461029e57806355b812a8146102b857806359c4f905146102f25780635aa6e6751461031957806370a082311461032c575b600080fd5b6101716104fd565b60405161017e9190611f09565b60405180910390f35b61018f61058b565b604080516001600160801b039687168152602081019590955284019290925283166060830152909116608082015260a00161017e565b6101d86101d3366004611a98565b6106ac565b604051901515815260200161017e565b61020f7f000000000000000000000000000000000000000000000000000000000000000081565b60405161017e9190611e68565b61020f7f000000000000000000000000000000000000000000000000000000000000000081565b61024c60045481565b60405190815260200161017e565b610262610718565b005b6101d8610272366004611a57565b6107a4565b61020f7f000000000000000000000000000000000000000000000000000000000000000081565b6102a6601281565b60405160ff909116815260200161017e565b6102df7f000000000000000000000000000000000000000000000000000000000000000081565b60405160029190910b815260200161017e565b6102df7f000000000000000000000000000000000000000000000000000000000000000081565b60005461020f906001600160a01b031681565b61024c61033a366004611a01565b60066020526000908152604090205481565b61017161086d565b610367610362366004611db1565b61087a565b6040516001600160801b03909116815260200161017e565b6101d861038d366004611a98565b6108aa565b6102626103a0366004611a01565b6108c0565b61020f7f000000000000000000000000000000000000000000000000000000000000000081565b61020f7f000000000000000000000000000000000000000000000000000000000000000081565b610406610401366004611bc8565b610941565b6040805192835260208301919091520161017e565b6102df7f000000000000000000000000000000000000000000000000000000000000000081565b61020f7f000000000000000000000000000000000000000000000000000000000000000081565b610262610477366004611d32565b610b6d565b61024c61048a366004611a1e565b600560209081526000928352604080842090915290825290205481565b6104ce7f000000000000000000000000000000000000000000000000000000000000000081565b60405162ffffff909116815260200161017e565b610406610c45565b60015461020f906001600160a01b031681565b6002805461050a90612008565b80601f016020809104026020016040519081016040528092919081815260200182805461053690612008565b80156105835780601f1061055857610100808354040283529160200191610583565b820191906000526020600020905b81548152906001019060200180831161056657829003601f168201915b505050505081565b60008060008060007f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031663514ea4bf307f00000000000000000000000000000000000000000000000000000000000000007f000000000000000000000000000000000000000000000000000000000000000060405160200161061793929190611e1c565b604051602081830303815290604052805190602001206040518263ffffffff1660e01b815260040161064b91815260200190565b60a06040518083038186803b15801561066357600080fd5b505afa158015610677573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061069b9190611c12565b939992985090965094509092509050565b3360008181526005602090815260408083206001600160a01b038716808552925280832085905551919290917f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925906107079086815260200190565b60405180910390a350600192915050565b6001546001600160a01b0316331461074357604051637ef5703160e11b815260040160405180910390fd5b60018054600080546001600160a01b0383166001600160a01b031991821681179092559091169091556040517fc73be659241aade67e9a059bcf21494955018b213dbd1179054ccf928b13f3b69161079a91611e68565b60405180910390a1565b6001600160a01b0383166000818152600560209081526040808320338085529252822054919290919082148015906107de57506000198114155b156108545760006107ef8583611fc5565b6001600160a01b038881166000818152600560209081526040808320948916808452948252918290208590559051848152939450919290917f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505b61085f86868661129c565b6001925050505b9392505050565b6003805461050a90612008565b600061088886868686611338565b509091506108a19050826001600160801b0383166115bf565b95945050505050565b60006108b733848461129c565b50600192915050565b6000546001600160a01b031633146108eb576040516354348f0360e01b815260040160405180910390fd5b600180546001600160a01b0319166001600160a01b0383161790556040517fe987aaedf9d279143bdf1eee16cf1d0feb47742867d81083df8d6cd0a5ac857f90610936908390611e68565b60405180910390a150565b60405163a34123a760e01b81527f0000000000000000000000000000000000000000000000000000000000000000600290810b60048301527f0000000000000000000000000000000000000000000000000000000000000000900b60248201526001600160801b038516604482015260009081906001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000169063a34123a7906064016040805180830381600087803b158015610a0257600080fd5b505af1158015610a16573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a3a9190611d0e565b909250905084821080610a4c57508381105b15610a6a576040516397c7f53760e01b815260040160405180910390fd5b6040516309e3d67b60e31b81526001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001690634f1eb3d890610afe9086907f0000000000000000000000000000000000000000000000000000000000000000907f00000000000000000000000000000000000000000000000000000000000000009088908890600401611ecc565b6040805180830381600087803b158015610b1757600080fd5b505af1158015610b2b573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610b4f9190611b99565b5050610b6433876001600160801b0316611637565b94509492505050565b6000610b7b82840184611adf565b9050336001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001614610bc657604051634b60273560e01b815260040160405180910390fd5b8415610c00578051516020820151610c0091907f0000000000000000000000000000000000000000000000000000000000000000886116a7565b8315610c3e57610c3e81600001516020015182602001517f0000000000000000000000000000000000000000000000000000000000000000876116a7565b5050505050565b6000805481906001600160a01b03163314610c73576040516354348f0360e01b815260040160405180910390fd5b6000807f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031663514ea4bf307f00000000000000000000000000000000000000000000000000000000000000007f0000000000000000000000000000000000000000000000000000000000000000604051602001610cfa93929190611e1c565b604051602081830303815290604052805190602001206040518263ffffffff1660e01b8152600401610d2e91815260200190565b60a06040518083038186803b158015610d4657600080fd5b505afa158015610d5a573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d7e9190611c12565b6000546040516309e3d67b60e31b81529297509095506001600160a01b037f000000000000000000000000000000000000000000000000000000000000000081169550634f1eb3d89450610e1f935016907f0000000000000000000000000000000000000000000000000000000000000000907f00000000000000000000000000000000000000000000000000000000000000009088908890600401611ecc565b6040805180830381600087803b158015610e3857600080fd5b505af1158015610e4c573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e709190611b99565b6001600160801b03918216969116945092505050565b60008060008360020b12610e9d578260020b610eaa565b8260020b610eaa9061207a565b9050610eb9620d89e719612057565b60020b811115610ef35760405162461bcd60e51b81526020600482015260016024820152601560fa1b604482015260640160405180910390fd5b600060018216610f0757600160801b610f19565b6ffffcb933bd6fad37aa2d162d1a5940015b6001600160881b031690506002821615610f4e576080610f49826ffff97272373d413259a46990580e213a611f7e565b901c90505b6004821615610f78576080610f73826ffff2e50f5f656932ef12357cf3c7fdcc611f7e565b901c90505b6008821615610fa2576080610f9d826fffe5caca7e10e4e61c3624eaa0941cd0611f7e565b901c90505b6010821615610fcc576080610fc7826fffcb9843d60f6159c9db58835c926644611f7e565b901c90505b6020821615610ff6576080610ff1826fff973b41fa98c081472e6896dfb254c0611f7e565b901c90505b604082161561102057608061101b826fff2ea16466c96a3843ec78b326b52861611f7e565b901c90505b608082161561104a576080611045826ffe5dee046a99a2a811c461f1969c3053611f7e565b901c90505b610100821615611075576080611070826ffcbe86c7900a88aedcffc83b479aa3a4611f7e565b901c90505b6102008216156110a057608061109b826ff987a7253ac413176f2b074cf7815e54611f7e565b901c90505b6104008216156110cb5760806110c6826ff3392b0822b70005940c7a398e4b70f3611f7e565b901c90505b6108008216156110f65760806110f1826fe7159475a2c29b7443b29c7fa6e889d9611f7e565b901c90505b61100082161561112157608061111c826fd097f3bdfd2022b8845ad8f792aa5825611f7e565b901c90505b61200082161561114c576080611147826fa9f746462d870fdf8a65dc1f90e061e5611f7e565b901c90505b614000821615611177576080611172826f70d869a156d2a1b890bb3df62baf32f7611f7e565b901c90505b6180008216156111a257608061119d826f31be135f97d08fd981231505542fcfa6611f7e565b901c90505b620100008216156111ce5760806111c9826f09aa508b5b7a84e1c677de54f3e99bc9611f7e565b901c90505b620200008216156111f95760806111f4826e5d6af8dedb81196699c329225ee604611f7e565b901c90505b6204000082161561122357608061121e826d2216e584f5fa1ea926041bedfe98611f7e565b901c90505b6208000082161561124b576080611246826b048a170391f7dc42444e8fa2611f7e565b901c90505b60008460020b13156112665761126381600019611f6a565b90505b611274600160201b82612043565b15611280576001611283565b60005b6112949060ff16602083901c611f52565b949350505050565b6001600160a01b038316600090815260066020526040812080548392906112c4908490611fc5565b90915550506001600160a01b038216600090815260066020526040812080548392906112f1908490611f52565b92505081905550816001600160a01b0316836001600160a01b03166000805160206120f18339815191528360405161132b91815260200190565b60405180910390a3505050565b6000806000807f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316633850c7bd6040518163ffffffff1660e01b815260040160e06040518083038186803b15801561139757600080fd5b505afa1580156113ab573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906113cf9190611c74565b5050505050509050611424817f00000000000000000000000000000000000000000000000000000000000000007f00000000000000000000000000000000000000000000000000000000000000008b8b6116b9565b6040805160a080820183526007546001600160a01b039081168385018181526008548084166060808801918252600160a01b90920462ffffff9081166080808a01918252948952336020998a019081528a51998a019690965291518616888a01529051169086015290518216848201528451808503909101815291830193849052633c8a7d8d60e01b9093529296507f000000000000000000000000000000000000000000000000000000000000000090911691633c8a7d8d916115339130917f0000000000000000000000000000000000000000000000000000000000000000917f0000000000000000000000000000000000000000000000000000000000000000918b919060a401611e7c565b6040805180830381600087803b15801561154c57600080fd5b505af1158015611560573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906115849190611d0e565b90935091508583108061159657508482105b156115b4576040516397c7f53760e01b815260040160405180910390fd5b509450945094915050565b80600460008282546115d19190611f52565b90915550506001600160a01b038216600090815260066020526040812080548392906115fe908490611f52565b90915550506040518181526001600160a01b038316906000906000805160206120f1833981519152906020015b60405180910390a35050565b80600460008282546116499190611fc5565b90915550506001600160a01b03821660009081526006602052604081208054839290611676908490611fc5565b90915550506040518181526000906001600160a01b038416906000805160206120f18339815191529060200161162b565b6116b38484848461177b565b50505050565b6000836001600160a01b0316856001600160a01b031611156116d9579293925b846001600160a01b0316866001600160a01b031611611704576116fd858585611875565b90506108a1565b836001600160a01b0316866001600160a01b0316101561176657600061172b878686611875565b9050600061173a8789866118df565b9050806001600160801b0316826001600160801b03161061175b578061175d565b815b925050506108a1565b6117718585846118df565b9695505050505050565b604080516001600160a01b0385811660248301528481166044830152606480830185905283518084039091018152608490920183526020820180516001600160e01b03166323b872dd60e01b17905291516000928392908816916117df9190611e4c565b6000604051808303816000865af19150503d806000811461181c576040519150601f19603f3d011682016040523d82523d6000602084013e611821565b606091505b509150915081158061184f575080511580159061184f57508080602001905181019061184d9190611ac4565b155b1561186d576040516316369daf60e31b815260040160405180910390fd5b505050505050565b6000826001600160a01b0316846001600160a01b03161115611895579192915b60006118b8856001600160a01b0316856001600160a01b0316600160601b611915565b90506108a16118da84836118cc8989611f9d565b6001600160a01b0316611915565b6119c4565b6000826001600160a01b0316846001600160a01b031611156118ff579192915b6112946118da83600160601b6118cc8888611f9d565b60008080600019858709858702925082811083820303915050806000141561194f576000841161194457600080fd5b508290049050610866565b80841161195b57600080fd5b60008486880960026001871981018816978890046003810283188082028403028082028403028082028403028082028403028082028403029081029092039091026000889003889004909101858311909403939093029303949094049190911702949350505050565b806001600160801b03811681146119da57600080fd5b919050565b805180151581146119da57600080fd5b805161ffff811681146119da57600080fd5b600060208284031215611a1357600080fd5b8135610866816120c3565b60008060408385031215611a3157600080fd5b8235611a3c816120c3565b91506020830135611a4c816120c3565b809150509250929050565b600080600060608486031215611a6c57600080fd5b8335611a77816120c3565b92506020840135611a87816120c3565b929592945050506040919091013590565b60008060408385031215611aab57600080fd5b8235611ab6816120c3565b946020939093013593505050565b600060208284031215611ad657600080fd5b610866826119df565b60008183036080811215611af257600080fd5b604051604081018181106001600160401b0382111715611b2257634e487b7160e01b600052604160045260246000fd5b6040526060821215611b3357600080fd5b611b3b611f1c565b91508335611b48816120c3565b82526020840135611b58816120c3565b6020830152604084013562ffffff81168114611b7357600080fd5b6040830152908152606083013590611b8a826120c3565b60208101919091529392505050565b60008060408385031215611bac57600080fd5b8251611bb7816120db565b6020840151909250611a4c816120db565b60008060008060808587031215611bde57600080fd5b8435611be9816120db565b935060208501359250604085013591506060850135611c07816120c3565b939692955090935050565b600080600080600060a08688031215611c2a57600080fd5b8551611c35816120db565b8095505060208601519350604086015192506060860151611c55816120db565b6080870151909250611c66816120db565b809150509295509295909350565b600080600080600080600060e0888a031215611c8f57600080fd5b8751611c9a816120c3565b8097505060208801518060020b8114611cb257600080fd5b9550611cc0604089016119ef565b9450611cce606089016119ef565b9350611cdc608089016119ef565b925060a088015160ff81168114611cf257600080fd5b9150611d0060c089016119df565b905092959891949750929550565b60008060408385031215611d2157600080fd5b505080516020909101519092909150565b60008060008060608587031215611d4857600080fd5b843593506020850135925060408501356001600160401b0380821115611d6d57600080fd5b818701915087601f830112611d8157600080fd5b813581811115611d9057600080fd5b886020828501011115611da257600080fd5b95989497505060200194505050565b600080600080600060a08688031215611dc957600080fd5b853594506020860135935060408601359250606086013591506080860135611c66816120c3565b60008151808452611e08816020860160208601611fdc565b601f01601f19169290920160200192915050565b60609390931b6001600160601b0319168352600291820b60e890811b6014850152910b901b6017820152601a0190565b60008251611e5e818460208701611fdc565b9190910192915050565b6001600160a01b0391909116815260200190565b6001600160a01b0386168152600285810b602083015284900b60408201526001600160801b038316606082015260a060808201819052600090611ec190830184611df0565b979650505050505050565b6001600160a01b03959095168552600293840b60208601529190920b60408401526001600160801b03918216606084015216608082015260a00190565b6020815260006108666020830184611df0565b604051606081016001600160401b0381118282101715611f4c57634e487b7160e01b600052604160045260246000fd5b60405290565b60008219821115611f6557611f65612097565b500190565b600082611f7957611f796120ad565b500490565b6000816000190483118215151615611f9857611f98612097565b500290565b60006001600160a01b0383811690831681811015611fbd57611fbd612097565b039392505050565b600082821015611fd757611fd7612097565b500390565b60005b83811015611ff7578181015183820152602001611fdf565b838111156116b35750506000910152565b600181811c9082168061201c57607f821691505b6020821081141561203d57634e487b7160e01b600052602260045260246000fd5b50919050565b600082612052576120526120ad565b500690565b60008160020b627fffff1981141561207157612071612097565b60000392915050565b6000600160ff1b82141561209057612090612097565b5060000390565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052601260045260246000fd5b6001600160a01b03811681146120d857600080fd5b50565b6001600160801b03811681146120d857600080fdfeddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3efa2646970667358221220c47c847a056b43ea25f6e31593da6f02c7cd6f9bd76f5baf77f89646b59a4e6964736f6c63430008070033", - "devdoc": { - "kind": "dev", - "methods": { - "approve(address,uint256)": { - "details": "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." - }, - "burn(uint128,uint256,uint256,address)": { - "params": { - "amount0Min": "The minimum amount of token0 we want to send to the recipient (to)", - "amount1Min": "The minimum amount of token1 we want to send to the recipient (to)", - "liquidity": "The amount of liquidity to be burned", - "to": "The address that will receive the due fees" - }, - "returns": { - "amount0": "The calculated amount of token0 that will be sent to the recipient", - "amount1": "The calculated amount of token1 that will be sent to the recipient" - } - }, - "collect()": { - "details": "The collected fees will be sent to governance", - "returns": { - "amount0": "The amount of fees collected in token0", - "amount1": "The amount of fees collected in token1" - } - }, - "mint(uint256,uint256,uint256,uint256,address)": { - "details": "Triggers UniV3PairManager#uniswapV3MintCallback", - "params": { - "amount0Desired": "The amount of token0 we would like to provide", - "amount0Min": "The minimum amount of token0 we want to provide", - "amount1Desired": "The amount of token1 we would like to provide", - "amount1Min": "The minimum amount of token1 we want to provide", - "to": "The address to which the kLP tokens are going to be minted to" - }, - "returns": { - "liquidity": "kLP tokens sent in exchange for the provision of tokens" - } - }, - "position()": { - "returns": { - "feeGrowthInside0LastX128": "The fee growth of token0 as of the last action on the individual position", - "feeGrowthInside1LastX128": "The fee growth of token1 as of the last action on the individual position", - "liquidity": "The amount of liquidity provided to the UniswapV3 pool by the pair manager", - "tokensOwed0": "The uncollected amount of token0 owed to the position as of the last computation", - "tokensOwed1": "The uncollected amount of token1 owed to the position as of the last computation" - } - }, - "setGovernance(address)": { - "params": { - "_governance": "The address being proposed as the new governance" - } - }, - "transfer(address,uint256)": { - "details": "Moves `amount` tokens from the caller's account to `recipient`. Returns a boolean value indicating whether the operation succeeded. Emits a {Transfer} event." - }, - "transferFrom(address,address,uint256)": { - "details": "Moves `amount` tokens from `sender` to `recipient` 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." - }, - "uniswapV3MintCallback(uint256,uint256,bytes)": { - "params": { - "amount0Owed": "The amount of token0 due to the pool for the minted liquidity", - "amount1Owed": "The amount of token1 due to the pool for the minted liquidity", - "data": "The encoded token0, token1, fee (_poolKey) and the payer (msg.sender) of the IUniV3PairManager#mint function" - } - } - }, - "stateVariables": { - "_MAX_TICK": { - "details": "Due to tick spacing, pools with different fees may have differences between _MAX_TICK and tickUpper. Use tickUpper to find the max tick of the pool." - }, - "allowance": { - "details": "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." - }, - "balanceOf": { - "details": "Returns the amount of tokens owned by `account`." - }, - "decimals": { - "details": "Returns the decimals places of the token." - }, - "factory": { - "return": "_factory The address of the PairManager Factory", - "returns": { - "_0": "_factory The address of the PairManager Factory" - } - }, - "fee": { - "return": "_fee The fee of the Uniswap pool passed into the constructor", - "returns": { - "_0": "_fee The fee of the Uniswap pool passed into the constructor" - } - }, - "name": { - "details": "Returns the name of the token." - }, - "pool": { - "return": "_pool The address of the pool", - "returns": { - "_0": "_pool The address of the pool" - } - }, - "sqrtRatioAX96": { - "return": "_sqrtPriceA96 A Fixed point Q64.96 number representing the sqrt of the ratio of the two assets (token1/token0) at the lowest tick", - "returns": { - "_0": "_sqrtPriceA96 A Fixed point Q64.96 number representing the sqrt of the ratio of the two assets (token1/token0) at the lowest tick" - } - }, - "sqrtRatioBX96": { - "return": "_sqrtPriceBX96 A Fixed point Q64.96 number representing the sqrt of the ratio of the two assets (token1/token0) at the highest tick", - "returns": { - "_0": "_sqrtPriceBX96 A Fixed point Q64.96 number representing the sqrt of the ratio of the two assets (token1/token0) at the highest tick" - } - }, - "symbol": { - "details": "Returns the symbol of the token." - }, - "tickLower": { - "return": "_tickLower The lower tick in the Uniswap's curve", - "returns": { - "_0": "_tickLower The lower tick in the Uniswap's curve" - } - }, - "tickSpacing": { - "return": "_tickSpacing The pair tick spacing", - "returns": { - "_0": "_tickSpacing The pair tick spacing" - } - }, - "tickUpper": { - "return": "_tickUpper The highest tick in the Uniswap's curve", - "returns": { - "_0": "_tickUpper The highest tick in the Uniswap's curve" - } - }, - "token0": { - "return": "_token0 The address of token0", - "returns": { - "_0": "_token0 The address of token0" - } - }, - "token1": { - "return": "_token1 The address of token1", - "returns": { - "_0": "_token1 The address of token1" - } - }, - "totalSupply": { - "details": "Returns the amount of tokens in existence." - } - }, - "version": 1 - }, - "userdoc": { - "errors": { - "ExcessiveSlippage()": [ - { - "notice": "Throws when the slippage exceeds what the user is comfortable with" - } - ], - "NoGovernanceZeroAddress()": [ - { - "notice": "Throws if trying to set governance to zero address" - } - ], - "OnlyGovernance()": [ - { - "notice": "Throws if the caller of the function is not governance" - } - ], - "OnlyPendingGovernance()": [ - { - "notice": "Throws if the caller of the function is not pendingGovernance" - } - ], - "OnlyPool()": [ - { - "notice": "Throws when the caller of the function is not the pool" - } - ], - "UnsuccessfulTransfer()": [ - { - "notice": "Throws when a transfer is unsuccessful" - } - ] - }, - "events": { - "GovernanceProposal(address)": { - "notice": "Emitted when a new governance is proposed" - }, - "GovernanceSet(address)": { - "notice": "Emitted when pendingGovernance accepts to be governance" - } - }, - "kind": "user", - "methods": { - "acceptGovernance()": { - "notice": "Changes the governance from the current governance to the previously proposed address" - }, - "factory()": { - "notice": "Address of the factory from which the pair manager was created" - }, - "fee()": { - "notice": "The fee of the Uniswap pool passed into the constructor" - }, - "governance()": { - "notice": "Stores the governance address" - }, - "mint(uint256,uint256,uint256,uint256,address)": { - "notice": "Mints kLP tokens to an address according to the liquidity the msg.sender provides to the UniswapV3 pool" - }, - "pendingGovernance()": { - "notice": "Stores the pendingGovernance address" - }, - "pool()": { - "notice": "Address of the pool from which the Keep3r pair manager will interact with" - }, - "position()": { - "notice": "Returns the pair manager's position in the corresponding UniswapV3 pool" - }, - "setGovernance(address)": { - "notice": "Proposes a new address to be governance" - }, - "sqrtRatioAX96()": { - "notice": "The sqrtRatioAX96 at the lowest tick (-887200) of the Uniswap pool" - }, - "sqrtRatioBX96()": { - "notice": "The sqrtRatioBX96 at the highest tick (887200) of the Uniswap pool" - }, - "tickLower()": { - "notice": "Lowest tick in the Uniswap's curve" - }, - "tickSpacing()": { - "notice": "The pair tick spacing" - }, - "tickUpper()": { - "notice": "Highest tick in the Uniswap's curve" - }, - "token0()": { - "notice": "Token0 of the pool" - }, - "token1()": { - "notice": "Token1 of the pool" - }, - "uniswapV3MintCallback(uint256,uint256,bytes)": { - "notice": "This function is called after a user calls IUniV3PairManager#mint function It ensures that any tokens owed to the pool are paid by the msg.sender of IUniV3PairManager#mint function" - } - }, - "version": 1 - }, - "storageLayout": { - "storage": [ - { - "astId": 5374, - "contract": "solidity/contracts/UniV3PairManager.sol:UniV3PairManager", - "label": "governance", - "offset": 0, - "slot": "0", - "type": "t_address" - }, - { - "astId": 5378, - "contract": "solidity/contracts/UniV3PairManager.sol:UniV3PairManager", - "label": "pendingGovernance", - "offset": 0, - "slot": "1", - "type": "t_address" - }, - { - "astId": 3335, - "contract": "solidity/contracts/UniV3PairManager.sol:UniV3PairManager", - "label": "name", - "offset": 0, - "slot": "2", - "type": "t_string_storage" - }, - { - "astId": 3339, - "contract": "solidity/contracts/UniV3PairManager.sol:UniV3PairManager", - "label": "symbol", - "offset": 0, - "slot": "3", - "type": "t_string_storage" - }, - { - "astId": 3343, - "contract": "solidity/contracts/UniV3PairManager.sol:UniV3PairManager", - "label": "totalSupply", - "offset": 0, - "slot": "4", - "type": "t_uint256" - }, - { - "astId": 3400, - "contract": "solidity/contracts/UniV3PairManager.sol:UniV3PairManager", - "label": "allowance", - "offset": 0, - "slot": "5", - "type": "t_mapping(t_address,t_mapping(t_address,t_uint256))" - }, - { - "astId": 3406, - "contract": "solidity/contracts/UniV3PairManager.sol:UniV3PairManager", - "label": "balanceOf", - "offset": 0, - "slot": "6", - "type": "t_mapping(t_address,t_uint256)" - }, - { - "astId": 3410, - "contract": "solidity/contracts/UniV3PairManager.sol:UniV3PairManager", - "label": "_poolKey", - "offset": 0, - "slot": "7", - "type": "t_struct(PoolKey)4757_storage" - } - ], - "types": { - "t_address": { - "encoding": "inplace", - "label": "address", - "numberOfBytes": "20" - }, - "t_mapping(t_address,t_mapping(t_address,t_uint256))": { - "encoding": "mapping", - "key": "t_address", - "label": "mapping(address => mapping(address => uint256))", - "numberOfBytes": "32", - "value": "t_mapping(t_address,t_uint256)" - }, - "t_mapping(t_address,t_uint256)": { - "encoding": "mapping", - "key": "t_address", - "label": "mapping(address => uint256)", - "numberOfBytes": "32", - "value": "t_uint256" - }, - "t_string_storage": { - "encoding": "bytes", - "label": "string", - "numberOfBytes": "32" - }, - "t_struct(PoolKey)4757_storage": { - "encoding": "inplace", - "label": "struct PoolAddress.PoolKey", - "members": [ - { - "astId": 4752, - "contract": "solidity/contracts/UniV3PairManager.sol:UniV3PairManager", - "label": "token0", - "offset": 0, - "slot": "0", - "type": "t_address" - }, - { - "astId": 4754, - "contract": "solidity/contracts/UniV3PairManager.sol:UniV3PairManager", - "label": "token1", - "offset": 0, - "slot": "1", - "type": "t_address" - }, - { - "astId": 4756, - "contract": "solidity/contracts/UniV3PairManager.sol:UniV3PairManager", - "label": "fee", - "offset": 20, - "slot": "1", - "type": "t_uint24" - } - ], - "numberOfBytes": "64" - }, - "t_uint24": { - "encoding": "inplace", - "label": "uint24", - "numberOfBytes": "3" - }, - "t_uint256": { - "encoding": "inplace", - "label": "uint256", - "numberOfBytes": "32" - } - } - } -} \ No newline at end of file diff --git a/deployments/goerli/solcInputs/0100086ed88435cb002327f6c69d11e5.json b/deployments/goerli/solcInputs/0100086ed88435cb002327f6c69d11e5.json deleted file mode 100644 index 1f9c5fc..0000000 --- a/deployments/goerli/solcInputs/0100086ed88435cb002327f6c69d11e5.json +++ /dev/null @@ -1,334 +0,0 @@ -{ - "language": "Solidity", - "sources": { - "solidity/contracts/Keep3r.sol": { - "content": "// SPDX-License-Identifier: MIT\n\n/*\n\nCoded for The Keep3r Network with ♥ by\n\n██████╗░███████╗███████╗██╗░░░██╗░░░░░░░██╗░█████╗░███╗░░██╗██████╗░███████╗██████╗░██╗░░░░░░█████╗░███╗░░██╗██████╗░\n██╔══██╗██╔════╝██╔════╝██║░░░██║░░██╗░░██║██╔══██╗████╗░██║██╔══██╗██╔════╝██╔══██╗██║░░░░░██╔══██╗████╗░██║██╔══██╗\n██║░░██║█████╗░░█████╗░░██║░░░╚██╗████╗██╔╝██║░░██║██╔██╗██║██║░░██║█████╗░░██████╔╝██║░░░░░███████║██╔██╗██║██║░░██║\n██║░░██║██╔══╝░░██╔══╝░░██║░░░░████╔═████║░██║░░██║██║╚████║██║░░██║██╔══╝░░██╔══██╗██║░░░░░██╔══██║██║╚████║██║░░██║\n██████╔╝███████╗██║░░░░░██║░░░░╚██╔╝░╚██╔╝░╚█████╔╝██║░╚███║██████╔╝███████╗██║░░██║███████╗██║░░██║██║░╚███║██████╔╝\n╚═════╝░╚══════╝╚═╝░░░░░╚═╝░░░░░╚═╝░░░╚═╝░░░╚════╝░╚═╝░░╚══╝╚═════╝░╚══════╝╚═╝░░╚═╝╚══════╝╚═╝░░╚═╝╚═╝░░╚══╝╚═════╝░\n\nhttps://defi.sucks\n\n*/\n\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../interfaces/IKeep3r.sol';\nimport './peripherals/jobs/Keep3rJobs.sol';\nimport './peripherals/keepers/Keep3rKeepers.sol';\nimport './peripherals/DustCollector.sol';\n\ncontract Keep3r is IKeep3r, Keep3rJobs, Keep3rKeepers {\n constructor(\n address _governance,\n address _keep3rHelper,\n address _keep3rV1,\n address _keep3rV1Proxy\n ) Keep3rParameters(_keep3rHelper, _keep3rV1, _keep3rV1Proxy) Keep3rRoles(_governance) {}\n}\n" - }, - "solidity/interfaces/IKeep3r.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport './peripherals/IKeep3rJobs.sol';\nimport './peripherals/IKeep3rKeepers.sol';\nimport './peripherals/IKeep3rParameters.sol';\n\n// solhint-disable-next-line no-empty-blocks\n\n/// @title Keep3rV2 contract\n/// @notice This contract inherits all the functionality of Keep3rV2\ninterface IKeep3r is IKeep3rJobs, IKeep3rKeepers, IKeep3rParameters {\n\n}\n" - }, - "solidity/contracts/peripherals/jobs/Keep3rJobs.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../../../interfaces/peripherals/IKeep3rJobs.sol';\nimport './Keep3rJobManager.sol';\nimport './Keep3rJobWorkable.sol';\nimport './Keep3rJobDisputable.sol';\n\nabstract contract Keep3rJobs is IKeep3rJobs, Keep3rJobManager, Keep3rJobWorkable, Keep3rJobDisputable {}\n" - }, - "solidity/contracts/peripherals/keepers/Keep3rKeepers.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../../../interfaces/peripherals/IKeep3rKeepers.sol';\nimport './Keep3rKeeperDisputable.sol';\n\nabstract contract Keep3rKeepers is IKeep3rKeepers, Keep3rKeeperDisputable {}\n" - }, - "solidity/contracts/peripherals/DustCollector.sol": { - "content": "// SPDX-License-Identifier: MIT\n\npragma solidity >=0.8.4 <0.9.0;\n\nimport '@openzeppelin/contracts/token/ERC20/IERC20.sol';\nimport '@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol';\nimport '../../contracts/peripherals/Governable.sol';\nimport '../../interfaces/peripherals/IDustCollector.sol';\n\nabstract contract DustCollector is IDustCollector, Governable {\n using SafeERC20 for IERC20;\n\n address internal constant _ETH_ADDRESS = 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE;\n\n function sendDust(\n address _token,\n uint256 _amount,\n address _to\n ) external override onlyGovernance {\n if (_to == address(0)) revert ZeroAddress();\n if (_token == _ETH_ADDRESS) {\n payable(_to).transfer(_amount);\n } else {\n IERC20(_token).safeTransfer(_to, _amount);\n }\n emit DustSent(_token, _amount, _to);\n }\n}\n" - }, - "solidity/interfaces/peripherals/IKeep3rJobs.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport './IKeep3rDisputable.sol';\n\n/// @title Keep3rJobOwnership contract\n/// @notice Handles the ownership of the jobs\ninterface IKeep3rJobOwnership {\n // Events\n\n /// @notice Emitted when Keep3rJobOwnership#changeJobOwnership is called\n /// @param _job The address of the job proposed to have a change of owner\n /// @param _owner The current owner of the job\n /// @param _pendingOwner The new address proposed to be the owner of the job\n event JobOwnershipChange(address indexed _job, address indexed _owner, address indexed _pendingOwner);\n\n /// @notice Emitted when Keep3rJobOwnership#JobOwnershipAssent is called\n /// @param _job The address of the job which the proposed owner will now own\n /// @param _previousOwner The previous owner of the job\n /// @param _newOwner The new owner of the job\n event JobOwnershipAssent(address indexed _job, address indexed _previousOwner, address indexed _newOwner);\n\n // Errors\n\n /// @notice Throws when the caller of the function is not the job owner\n error OnlyJobOwner();\n\n /// @notice Throws when the caller of the function is not the pending job owner\n error OnlyPendingJobOwner();\n\n // Variables\n\n /// @notice Maps the job to the owner of the job\n /// @param _job The address of the job\n /// @return _owner The address of the owner of the job\n function jobOwner(address _job) external view returns (address _owner);\n\n /// @notice Maps the job to its pending owner\n /// @param _job The address of the job\n /// @return _pendingOwner The address of the pending owner of the job\n function jobPendingOwner(address _job) external view returns (address _pendingOwner);\n\n // Methods\n\n /// @notice Proposes a new address to be the owner of the job\n /// @param _job The address of the job\n /// @param _newOwner The address of the proposed new owner\n function changeJobOwnership(address _job, address _newOwner) external;\n\n /// @notice The proposed address accepts to be the owner of the job\n /// @param _job The address of the job\n function acceptJobOwnership(address _job) external;\n}\n\n/// @title Keep3rJobManager contract\n/// @notice Handles the addition and withdrawal of credits from a job\ninterface IKeep3rJobManager is IKeep3rJobOwnership {\n // Events\n\n /// @notice Emitted when Keep3rJobManager#addJob is called\n /// @param _job The address of the job to add\n /// @param _jobOwner The job's owner\n event JobAddition(address indexed _job, address indexed _jobOwner);\n\n // Errors\n\n /// @notice Throws when trying to add a job that has already been added\n error JobAlreadyAdded();\n\n /// @notice Throws when the address that is trying to register as a keeper is already a keeper\n error AlreadyAKeeper();\n\n // Methods\n\n /// @notice Allows any caller to add a new job\n /// @param _job Address of the contract for which work should be performed\n function addJob(address _job) external;\n}\n\n/// @title Keep3rJobFundableCredits contract\n/// @notice Handles the addition and withdrawal of credits from a job\ninterface IKeep3rJobFundableCredits is IKeep3rJobOwnership {\n // Events\n\n /// @notice Emitted when Keep3rJobFundableCredits#addTokenCreditsToJob is called\n /// @param _job The address of the job being credited\n /// @param _token The address of the token being provided\n /// @param _provider The user that calls the function\n /// @param _amount The amount of credit being added to the job\n event TokenCreditAddition(address indexed _job, address indexed _token, address indexed _provider, uint256 _amount);\n\n /// @notice Emitted when Keep3rJobFundableCredits#withdrawTokenCreditsFromJob is called\n /// @param _job The address of the job from which the credits are withdrawn\n /// @param _token The credit being withdrawn from the job\n /// @param _receiver The user that receives the tokens\n /// @param _amount The amount of credit withdrawn\n event TokenCreditWithdrawal(address indexed _job, address indexed _token, address indexed _receiver, uint256 _amount);\n\n // Errors\n\n /// @notice Throws when the token is KP3R, as it should not be used for direct token payments\n error TokenUnallowed();\n\n /// @notice Throws when the token withdraw cooldown has not yet passed\n error JobTokenCreditsLocked();\n\n /// @notice Throws when the user tries to withdraw more tokens than it has\n error InsufficientJobTokenCredits();\n\n // Variables\n\n /// @notice Last block where tokens were added to the job\n /// @param _job The address of the job credited\n /// @param _token The address of the token credited\n /// @return _timestamp The last block where tokens were added to the job\n function jobTokenCreditsAddedAt(address _job, address _token) external view returns (uint256 _timestamp);\n\n // Methods\n\n /// @notice Add credit to a job to be paid out for work\n /// @param _job The address of the job being credited\n /// @param _token The address of the token being credited\n /// @param _amount The amount of credit being added\n function addTokenCreditsToJob(\n address _job,\n address _token,\n uint256 _amount\n ) external;\n\n /// @notice Withdraw credit from a job\n /// @param _job The address of the job from which the credits are withdrawn\n /// @param _token The address of the token being withdrawn\n /// @param _amount The amount of token to be withdrawn\n /// @param _receiver The user that will receive tokens\n function withdrawTokenCreditsFromJob(\n address _job,\n address _token,\n uint256 _amount,\n address _receiver\n ) external;\n}\n\n/// @title Keep3rJobFundableLiquidity contract\n/// @notice Handles the funding of jobs through specific liquidity pairs\ninterface IKeep3rJobFundableLiquidity is IKeep3rJobOwnership {\n // Events\n\n /// @notice Emitted when Keep3rJobFundableLiquidity#approveLiquidity function is called\n /// @param _liquidity The address of the liquidity pair being approved\n event LiquidityApproval(address _liquidity);\n\n /// @notice Emitted when Keep3rJobFundableLiquidity#revokeLiquidity function is called\n /// @param _liquidity The address of the liquidity pair being revoked\n event LiquidityRevocation(address _liquidity);\n\n /// @notice Emitted when IKeep3rJobFundableLiquidity#addLiquidityToJob function is called\n /// @param _job The address of the job to which liquidity will be added\n /// @param _liquidity The address of the liquidity being added\n /// @param _provider The user that calls the function\n /// @param _amount The amount of liquidity being added\n event LiquidityAddition(address indexed _job, address indexed _liquidity, address indexed _provider, uint256 _amount);\n\n /// @notice Emitted when IKeep3rJobFundableLiquidity#withdrawLiquidityFromJob function is called\n /// @param _job The address of the job of which liquidity will be withdrawn from\n /// @param _liquidity The address of the liquidity being withdrawn\n /// @param _receiver The receiver of the liquidity tokens\n /// @param _amount The amount of liquidity being withdrawn from the job\n event LiquidityWithdrawal(address indexed _job, address indexed _liquidity, address indexed _receiver, uint256 _amount);\n\n /// @notice Emitted when Keep3rJobFundableLiquidity#addLiquidityToJob function is called\n /// @param _job The address of the job whose credits will be updated\n /// @param _rewardedAt The time at which the job was last rewarded\n /// @param _currentCredits The current credits of the job\n /// @param _periodCredits The credits of the job for the current period\n event LiquidityCreditsReward(address indexed _job, uint256 _rewardedAt, uint256 _currentCredits, uint256 _periodCredits);\n\n /// @notice Emitted when Keep3rJobFundableLiquidity#forceLiquidityCreditsToJob function is called\n /// @param _job The address of the job whose credits will be updated\n /// @param _rewardedAt The time at which the job was last rewarded\n /// @param _currentCredits The current credits of the job\n event LiquidityCreditsForced(address indexed _job, uint256 _rewardedAt, uint256 _currentCredits);\n\n // Errors\n\n /// @notice Throws when the liquidity being approved has already been approved\n error LiquidityPairApproved();\n\n /// @notice Throws when the liquidity being removed has not been approved\n error LiquidityPairUnexistent();\n\n /// @notice Throws when trying to add liquidity to an unapproved pool\n error LiquidityPairUnapproved();\n\n /// @notice Throws when the job doesn't have the requested liquidity\n error JobLiquidityUnexistent();\n\n /// @notice Throws when trying to remove more liquidity than the job has\n error JobLiquidityInsufficient();\n\n /// @notice Throws when trying to add less liquidity than the minimum liquidity required\n error JobLiquidityLessThanMin();\n\n // Structs\n\n /// @notice Stores the tick information of the different liquidity pairs\n struct TickCache {\n int56 current; // Tracks the current tick\n int56 difference; // Stores the difference between the current tick and the last tick\n uint256 period; // Stores the period at which the last observation was made\n }\n\n // Variables\n\n /// @notice Lists liquidity pairs\n /// @return _list An array of addresses with all the approved liquidity pairs\n function approvedLiquidities() external view returns (address[] memory _list);\n\n /// @notice Amount of liquidity in a specified job\n /// @param _job The address of the job being checked\n /// @param _liquidity The address of the liquidity we are checking\n /// @return _amount Amount of liquidity in the specified job\n function liquidityAmount(address _job, address _liquidity) external view returns (uint256 _amount);\n\n /// @notice Last time the job was rewarded liquidity credits\n /// @param _job The address of the job being checked\n /// @return _timestamp Timestamp of the last time the job was rewarded liquidity credits\n function rewardedAt(address _job) external view returns (uint256 _timestamp);\n\n /// @notice Last time the job was worked\n /// @param _job The address of the job being checked\n /// @return _timestamp Timestamp of the last time the job was worked\n function workedAt(address _job) external view returns (uint256 _timestamp);\n\n // Methods\n\n /// @notice Returns the liquidity credits of a given job\n /// @param _job The address of the job of which we want to know the liquidity credits\n /// @return _amount The liquidity credits of a given job\n function jobLiquidityCredits(address _job) external view returns (uint256 _amount);\n\n /// @notice Returns the credits of a given job for the current period\n /// @param _job The address of the job of which we want to know the period credits\n /// @return _amount The credits the given job has at the current period\n function jobPeriodCredits(address _job) external view returns (uint256 _amount);\n\n /// @notice Calculates the total credits of a given job\n /// @param _job The address of the job of which we want to know the total credits\n /// @return _amount The total credits of the given job\n function totalJobCredits(address _job) external view returns (uint256 _amount);\n\n /// @notice Calculates how many credits should be rewarded periodically for a given liquidity amount\n /// @dev _periodCredits = underlying KP3Rs for given liquidity amount * rewardPeriod / inflationPeriod\n /// @param _liquidity The address of the liquidity to provide\n /// @param _amount The amount of liquidity to provide\n /// @return _periodCredits The amount of KP3R periodically minted for the given liquidity\n function quoteLiquidity(address _liquidity, uint256 _amount) external view returns (uint256 _periodCredits);\n\n /// @notice Observes the current state of the liquidity pair being observed and updates TickCache with the information\n /// @param _liquidity The address of the liquidity pair being observed\n /// @return _tickCache The updated TickCache\n function observeLiquidity(address _liquidity) external view returns (TickCache memory _tickCache);\n\n /// @notice Gifts liquidity credits to the specified job\n /// @param _job The address of the job being credited\n /// @param _amount The amount of liquidity credits to gift\n function forceLiquidityCreditsToJob(address _job, uint256 _amount) external;\n\n /// @notice Approve a liquidity pair for being accepted in future\n /// @param _liquidity The address of the liquidity accepted\n function approveLiquidity(address _liquidity) external;\n\n /// @notice Revoke a liquidity pair from being accepted in future\n /// @param _liquidity The liquidity no longer accepted\n function revokeLiquidity(address _liquidity) external;\n\n /// @notice Allows anyone to fund a job with liquidity\n /// @param _job The address of the job to assign liquidity to\n /// @param _liquidity The liquidity being added\n /// @param _amount The amount of liquidity tokens to add\n function addLiquidityToJob(\n address _job,\n address _liquidity,\n uint256 _amount\n ) external;\n\n /// @notice Unbond liquidity for a job\n /// @dev Can only be called by the job's owner\n /// @param _job The address of the job being unbonded from\n /// @param _liquidity The liquidity being unbonded\n /// @param _amount The amount of liquidity being removed\n function unbondLiquidityFromJob(\n address _job,\n address _liquidity,\n uint256 _amount\n ) external;\n\n /// @notice Withdraw liquidity from a job\n /// @param _job The address of the job being withdrawn from\n /// @param _liquidity The liquidity being withdrawn\n /// @param _receiver The address that will receive the withdrawn liquidity\n function withdrawLiquidityFromJob(\n address _job,\n address _liquidity,\n address _receiver\n ) external;\n}\n\n/// @title Keep3rJobMigration contract\n/// @notice Handles the migration process of jobs to different addresses\ninterface IKeep3rJobMigration is IKeep3rJobFundableCredits, IKeep3rJobFundableLiquidity {\n // Events\n\n /// @notice Emitted when Keep3rJobMigration#migrateJob function is called\n /// @param _fromJob The address of the job that requests to migrate\n /// @param _toJob The address at which the job requests to migrate\n event JobMigrationRequested(address indexed _fromJob, address _toJob);\n\n /// @notice Emitted when Keep3rJobMigration#acceptJobMigration function is called\n /// @param _fromJob The address of the job that requested to migrate\n /// @param _toJob The address at which the job had requested to migrate\n event JobMigrationSuccessful(address _fromJob, address indexed _toJob);\n\n // Errors\n\n /// @notice Throws when the address of the job that requests to migrate wants to migrate to its same address\n error JobMigrationImpossible();\n\n /// @notice Throws when the _toJob address differs from the address being tracked in the pendingJobMigrations mapping\n error JobMigrationUnavailable();\n\n /// @notice Throws when cooldown between migrations has not yet passed\n error JobMigrationLocked();\n\n // Variables\n\n /// @notice Maps the jobs that have requested a migration to the address they have requested to migrate to\n /// @return _toJob The address to which the job has requested to migrate to\n function pendingJobMigrations(address _fromJob) external view returns (address _toJob);\n\n // Methods\n\n /// @notice Initializes the migration process for a job by adding the request to the pendingJobMigrations mapping\n /// @param _fromJob The address of the job that is requesting to migrate\n /// @param _toJob The address at which the job is requesting to migrate\n function migrateJob(address _fromJob, address _toJob) external;\n\n /// @notice Completes the migration process for a job\n /// @dev Unbond/withdraw process doesn't get migrated\n /// @param _fromJob The address of the job that requested to migrate\n /// @param _toJob The address to which the job wants to migrate to\n function acceptJobMigration(address _fromJob, address _toJob) external;\n}\n\n/// @title Keep3rJobWorkable contract\n/// @notice Handles the mechanisms jobs can pay keepers with along with the restrictions jobs can put on keepers before they can work on jobs\ninterface IKeep3rJobWorkable is IKeep3rJobMigration {\n // Events\n\n /// @notice Emitted when a keeper is validated before a job\n /// @param _gasLeft The amount of gas that the transaction has left at the moment of keeper validation\n event KeeperValidation(uint256 _gasLeft);\n\n /// @notice Emitted when a keeper works a job\n /// @param _credit The address of the asset in which the keeper is paid\n /// @param _job The address of the job the keeper has worked\n /// @param _keeper The address of the keeper that has worked the job\n /// @param _payment The amount that has been paid out to the keeper in exchange for working the job\n /// @param _gasLeft The amount of gas that the transaction has left at the moment of payment\n event KeeperWork(address indexed _credit, address indexed _job, address indexed _keeper, uint256 _payment, uint256 _gasLeft);\n\n // Errors\n\n /// @notice Throws if work method was called without calling isKeeper or isBondedKeeper\n error GasNotInitialized();\n\n /// @notice Throws if the address claiming to be a job is not in the list of approved jobs\n error JobUnapproved();\n\n /// @notice Throws if the amount of funds in the job is less than the payment that must be paid to the keeper that works that job\n error InsufficientFunds();\n\n // Methods\n\n /// @notice Confirms if the current keeper is registered\n /// @dev Can be used for general (non critical) functions\n /// @param _keeper The keeper being investigated\n /// @return _isKeeper Whether the address passed as a parameter is a keeper or not\n function isKeeper(address _keeper) external returns (bool _isKeeper);\n\n /// @notice Confirms if the current keeper is registered and has a minimum bond of any asset.\n /// @dev Should be used for protected functions\n /// @param _keeper The keeper to check\n /// @param _bond The bond token being evaluated\n /// @param _minBond The minimum amount of bonded tokens\n /// @param _earned The minimum funds earned in the keepers lifetime\n /// @param _age The minimum keeper age required\n /// @return _isBondedKeeper Whether the `_keeper` meets the given requirements\n function isBondedKeeper(\n address _keeper,\n address _bond,\n uint256 _minBond,\n uint256 _earned,\n uint256 _age\n ) external returns (bool _isBondedKeeper);\n\n /// @notice Implemented by jobs to show that a keeper performed work\n /// @dev Automatically calculates the payment for the keeper and pays the keeper with bonded KP3R\n /// @param _keeper Address of the keeper that performed the work\n function worked(address _keeper) external;\n\n /// @notice Implemented by jobs to show that a keeper performed work\n /// @dev Pays the keeper that performs the work with KP3R\n /// @param _keeper Address of the keeper that performed the work\n /// @param _payment The reward that should be allocated for the job\n function bondedPayment(address _keeper, uint256 _payment) external;\n\n /// @notice Implemented by jobs to show that a keeper performed work\n /// @dev Pays the keeper that performs the work with a specific token\n /// @param _token The asset being awarded to the keeper\n /// @param _keeper Address of the keeper that performed the work\n /// @param _amount The reward that should be allocated\n function directTokenPayment(\n address _token,\n address _keeper,\n uint256 _amount\n ) external;\n}\n\n/// @title Keep3rJobDisputable contract\n/// @notice Handles the actions that can be taken on a disputed job\ninterface IKeep3rJobDisputable is IKeep3rDisputable, IKeep3rJobFundableCredits, IKeep3rJobFundableLiquidity {\n // Events\n\n /// @notice Emitted when Keep3rJobDisputable#slashTokenFromJob is called\n /// @param _job The address of the job from which the token will be slashed\n /// @param _token The address of the token being slashed\n /// @param _slasher The user that slashes the token\n /// @param _amount The amount of the token being slashed\n event JobSlashToken(address indexed _job, address _token, address indexed _slasher, uint256 _amount);\n\n /// @notice Emitted when Keep3rJobDisputable#slashLiquidityFromJob is called\n /// @param _job The address of the job from which the liquidity will be slashed\n /// @param _liquidity The address of the liquidity being slashed\n /// @param _slasher The user that slashes the liquidity\n /// @param _amount The amount of the liquidity being slashed\n event JobSlashLiquidity(address indexed _job, address _liquidity, address indexed _slasher, uint256 _amount);\n\n // Errors\n\n /// @notice Throws when the token trying to be slashed doesn't exist\n error JobTokenUnexistent();\n\n /// @notice Throws when someone tries to slash more tokens than the job has\n error JobTokenInsufficient();\n\n // Methods\n\n /// @notice Allows governance or slasher to slash a job specific token\n /// @param _job The address of the job from which the token will be slashed\n /// @param _token The address of the token that will be slashed\n /// @param _amount The amount of the token that will be slashed\n function slashTokenFromJob(\n address _job,\n address _token,\n uint256 _amount\n ) external;\n\n /// @notice Allows governance or a slasher to slash liquidity from a job\n /// @param _job The address being slashed\n /// @param _liquidity The address of the liquidity that will be slashed\n /// @param _amount The amount of liquidity that will be slashed\n function slashLiquidityFromJob(\n address _job,\n address _liquidity,\n uint256 _amount\n ) external;\n}\n\n// solhint-disable-next-line no-empty-blocks\ninterface IKeep3rJobs is IKeep3rJobWorkable, IKeep3rJobManager, IKeep3rJobDisputable {\n\n}\n" - }, - "solidity/interfaces/peripherals/IKeep3rKeepers.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport './IKeep3rDisputable.sol';\n\n/// @title Keep3rKeeperFundable contract\n/// @notice Handles the actions required to become a keeper\ninterface IKeep3rKeeperFundable {\n // Events\n\n /// @notice Emitted when Keep3rKeeperFundable#activate is called\n /// @param _keeper The keeper that has been activated\n /// @param _bond The asset the keeper has bonded\n /// @param _amount The amount of the asset the keeper has bonded\n event Activation(address indexed _keeper, address indexed _bond, uint256 _amount);\n\n /// @notice Emitted when Keep3rKeeperFundable#withdraw is called\n /// @param _keeper The caller of Keep3rKeeperFundable#withdraw function\n /// @param _bond The asset to withdraw from the bonding pool\n /// @param _amount The amount of funds withdrawn\n event Withdrawal(address indexed _keeper, address indexed _bond, uint256 _amount);\n\n // Errors\n\n /// @notice Throws when the address that is trying to register as a job is already a job\n error AlreadyAJob();\n\n // Methods\n\n /// @notice Beginning of the bonding process\n /// @param _bonding The asset being bonded\n /// @param _amount The amount of bonding asset being bonded\n function bond(address _bonding, uint256 _amount) external;\n\n /// @notice Beginning of the unbonding process\n /// @param _bonding The asset being unbonded\n /// @param _amount Allows for partial unbonding\n function unbond(address _bonding, uint256 _amount) external;\n\n /// @notice End of the bonding process after bonding time has passed\n /// @param _bonding The asset being activated as bond collateral\n function activate(address _bonding) external;\n\n /// @notice Withdraw funds after unbonding has finished\n /// @param _bonding The asset to withdraw from the bonding pool\n function withdraw(address _bonding) external;\n}\n\n/// @title Keep3rKeeperDisputable contract\n/// @notice Handles the actions that can be taken on a disputed keeper\ninterface IKeep3rKeeperDisputable is IKeep3rDisputable, IKeep3rKeeperFundable {\n // Events\n\n /// @notice Emitted when Keep3rKeeperDisputable#slash is called\n /// @param _keeper The address of the slashed keeper\n /// @param _slasher The user that called Keep3rKeeperDisputable#slash\n /// @param _amount The amount of credits slashed from the keeper\n event KeeperSlash(address indexed _keeper, address indexed _slasher, uint256 _amount);\n\n /// @notice Emitted when Keep3rKeeperDisputable#revoke is called\n /// @param _keeper The address of the revoked keeper\n /// @param _slasher The user that called Keep3rKeeperDisputable#revoke\n event KeeperRevoke(address indexed _keeper, address indexed _slasher);\n\n // Methods\n\n /// @notice Allows governance to slash a keeper based on a dispute\n /// @param _keeper The address being slashed\n /// @param _bonded The asset being slashed\n /// @param _bondAmount The bonded amount being slashed\n /// @param _unbondAmount The pending unbond amount being slashed\n function slash(\n address _keeper,\n address _bonded,\n uint256 _bondAmount,\n uint256 _unbondAmount\n ) external;\n\n /// @notice Blacklists a keeper from participating in the network\n /// @param _keeper The address being slashed\n function revoke(address _keeper) external;\n}\n\n// solhint-disable-next-line no-empty-blocks\n\n/// @title Keep3rKeepers contract\ninterface IKeep3rKeepers is IKeep3rKeeperDisputable {\n\n}\n" - }, - "solidity/interfaces/peripherals/IKeep3rParameters.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport './IKeep3rAccountance.sol';\n\n/// @title Keep3rParameters contract\n/// @notice Handles and sets all the required parameters for Keep3r\ninterface IKeep3rParameters is IKeep3rAccountance {\n // Events\n\n /// @notice Emitted when the Keep3rHelper address is changed\n /// @param _keep3rHelper The address of Keep3rHelper's contract\n event Keep3rHelperChange(address _keep3rHelper);\n\n /// @notice Emitted when the Keep3rV1 address is changed\n /// @param _keep3rV1 The address of Keep3rV1's contract\n event Keep3rV1Change(address _keep3rV1);\n\n /// @notice Emitted when the Keep3rV1Proxy address is changed\n /// @param _keep3rV1Proxy The address of Keep3rV1Proxy's contract\n event Keep3rV1ProxyChange(address _keep3rV1Proxy);\n\n /// @notice Emitted when bondTime is changed\n /// @param _bondTime The new bondTime\n event BondTimeChange(uint256 _bondTime);\n\n /// @notice Emitted when _liquidityMinimum is changed\n /// @param _liquidityMinimum The new _liquidityMinimum\n event LiquidityMinimumChange(uint256 _liquidityMinimum);\n\n /// @notice Emitted when _unbondTime is changed\n /// @param _unbondTime The new _unbondTime\n event UnbondTimeChange(uint256 _unbondTime);\n\n /// @notice Emitted when _rewardPeriodTime is changed\n /// @param _rewardPeriodTime The new _rewardPeriodTime\n event RewardPeriodTimeChange(uint256 _rewardPeriodTime);\n\n /// @notice Emitted when the inflationPeriod is changed\n /// @param _inflationPeriod The new inflationPeriod\n event InflationPeriodChange(uint256 _inflationPeriod);\n\n /// @notice Emitted when the fee is changed\n /// @param _fee The new token credits fee\n event FeeChange(uint256 _fee);\n\n // Variables\n\n /// @notice Address of Keep3rHelper's contract\n /// @return _keep3rHelper The address of Keep3rHelper's contract\n function keep3rHelper() external view returns (address _keep3rHelper);\n\n /// @notice Address of Keep3rV1's contract\n /// @return _keep3rV1 The address of Keep3rV1's contract\n function keep3rV1() external view returns (address _keep3rV1);\n\n /// @notice Address of Keep3rV1Proxy's contract\n /// @return _keep3rV1Proxy The address of Keep3rV1Proxy's contract\n function keep3rV1Proxy() external view returns (address _keep3rV1Proxy);\n\n /// @notice The amount of time required to pass after a keeper has bonded assets for it to be able to activate\n /// @return _days The required bondTime in days\n function bondTime() external view returns (uint256 _days);\n\n /// @notice The amount of time required to pass before a keeper can unbond what he has bonded\n /// @return _days The required unbondTime in days\n function unbondTime() external view returns (uint256 _days);\n\n /// @notice The minimum amount of liquidity required to fund a job per liquidity\n /// @return _amount The minimum amount of liquidity in KP3R\n function liquidityMinimum() external view returns (uint256 _amount);\n\n /// @notice The amount of time between each scheduled credits reward given to a job\n /// @return _days The reward period in days\n function rewardPeriodTime() external view returns (uint256 _days);\n\n /// @notice The inflation period is the denominator used to regulate the emission of KP3R\n /// @return _period The denominator used to regulate the emission of KP3R\n function inflationPeriod() external view returns (uint256 _period);\n\n /// @notice The fee to be sent to governance when a user adds liquidity to a job\n /// @return _amount The fee amount to be sent to governance when a user adds liquidity to a job\n function fee() external view returns (uint256 _amount);\n\n // Errors\n\n /// @notice Throws if the reward period is less than the minimum reward period time\n error MinRewardPeriod();\n\n /// @notice Throws if either a job or a keeper is disputed\n error Disputed();\n\n /// @notice Throws if there are no bonded assets\n error BondsUnexistent();\n\n /// @notice Throws if the time required to bond an asset has not passed yet\n error BondsLocked();\n\n /// @notice Throws if there are no bonds to withdraw\n error UnbondsUnexistent();\n\n /// @notice Throws if the time required to withdraw the bonds has not passed yet\n error UnbondsLocked();\n\n // Methods\n\n /// @notice Sets the Keep3rHelper address\n /// @param _keep3rHelper The Keep3rHelper address\n function setKeep3rHelper(address _keep3rHelper) external;\n\n /// @notice Sets the Keep3rV1 address\n /// @param _keep3rV1 The Keep3rV1 address\n function setKeep3rV1(address _keep3rV1) external;\n\n /// @notice Sets the Keep3rV1Proxy address\n /// @param _keep3rV1Proxy The Keep3rV1Proxy address\n function setKeep3rV1Proxy(address _keep3rV1Proxy) external;\n\n /// @notice Sets the bond time required to activate as a keeper\n /// @param _bond The new bond time\n function setBondTime(uint256 _bond) external;\n\n /// @notice Sets the unbond time required unbond what has been bonded\n /// @param _unbond The new unbond time\n function setUnbondTime(uint256 _unbond) external;\n\n /// @notice Sets the minimum amount of liquidity required to fund a job\n /// @param _liquidityMinimum The new minimum amount of liquidity\n function setLiquidityMinimum(uint256 _liquidityMinimum) external;\n\n /// @notice Sets the time required to pass between rewards for jobs\n /// @param _rewardPeriodTime The new amount of time required to pass between rewards\n function setRewardPeriodTime(uint256 _rewardPeriodTime) external;\n\n /// @notice Sets the new inflation period\n /// @param _inflationPeriod The new inflation period\n function setInflationPeriod(uint256 _inflationPeriod) external;\n\n /// @notice Sets the new fee\n /// @param _fee The new fee\n function setFee(uint256 _fee) external;\n}\n" - }, - "solidity/interfaces/peripherals/IKeep3rDisputable.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\n/// @title Keep3rDisputable contract\n/// @notice Creates/resolves disputes for jobs or keepers\n/// A disputed keeper is slashable and is not able to bond, activate, withdraw or receive direct payments\n/// A disputed job is slashable and is not able to pay the keepers, withdraw tokens or to migrate\ninterface IKeep3rDisputable {\n /// @notice Emitted when a keeper or a job is disputed\n /// @param _jobOrKeeper The address of the disputed keeper/job\n /// @param _disputer The user that called the function and disputed the keeper\n event Dispute(address indexed _jobOrKeeper, address indexed _disputer);\n\n /// @notice Emitted when a dispute is resolved\n /// @param _jobOrKeeper The address of the disputed keeper/job\n /// @param _resolver The user that called the function and resolved the dispute\n event Resolve(address indexed _jobOrKeeper, address indexed _resolver);\n\n /// @notice Throws when a job or keeper is already disputed\n error AlreadyDisputed();\n\n /// @notice Throws when a job or keeper is not disputed and someone tries to resolve the dispute\n error NotDisputed();\n\n /// @notice Allows governance to create a dispute for a given keeper/job\n /// @param _jobOrKeeper The address in dispute\n function dispute(address _jobOrKeeper) external;\n\n /// @notice Allows governance to resolve a dispute on a keeper/job\n /// @param _jobOrKeeper The address cleared\n function resolve(address _jobOrKeeper) external;\n}\n" - }, - "solidity/interfaces/peripherals/IKeep3rAccountance.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport './IKeep3rRoles.sol';\n\n/// @title Keep3rDisputable contract\n/// @notice Disputes keepers, or if they're already disputed, it can resolve the case\n/// @dev Argument `bonding` can be the address of either a token or a liquidity\ninterface IKeep3rAccountance is IKeep3rRoles {\n // Events\n\n /// @notice Emitted when the bonding process of a new keeper begins\n /// @param _keeper The caller of Keep3rKeeperFundable#bond function\n /// @param _bonding The asset the keeper has bonded\n /// @param _amount The amount the keeper has bonded\n event Bonding(address indexed _keeper, address indexed _bonding, uint256 _amount);\n\n /// @notice Emitted when a keeper or job begins the unbonding process to withdraw the funds\n /// @param _keeperOrJob The keeper or job that began the unbonding process\n /// @param _unbonding The liquidity pair or asset being unbonded\n /// @param _amount The amount being unbonded\n event Unbonding(address indexed _keeperOrJob, address indexed _unbonding, uint256 _amount);\n\n // Variables\n\n /// @notice Tracks the total amount of bonded KP3Rs in the contract\n /// @return _totalBonds The total amount of bonded KP3Rs in the contract\n function totalBonds() external view returns (uint256 _totalBonds);\n\n /// @notice Tracks the total KP3R earnings of a keeper since it started working\n /// @param _keeper The address of the keeper\n /// @return _workCompleted Total KP3R earnings of a keeper since it started working\n function workCompleted(address _keeper) external view returns (uint256 _workCompleted);\n\n /// @notice Tracks when a keeper was first registered\n /// @param _keeper The address of the keeper\n /// @return timestamp The time at which the keeper was first registered\n function firstSeen(address _keeper) external view returns (uint256 timestamp);\n\n /// @notice Tracks if a keeper or job has a pending dispute\n /// @param _keeperOrJob The address of the keeper or job\n /// @return _disputed Whether a keeper or job has a pending dispute\n function disputes(address _keeperOrJob) external view returns (bool _disputed);\n\n /// @notice Tracks how much a keeper has bonded of a certain token\n /// @param _keeper The address of the keeper\n /// @param _bond The address of the token being bonded\n /// @return _bonds Amount of a certain token that a keeper has bonded\n function bonds(address _keeper, address _bond) external view returns (uint256 _bonds);\n\n /// @notice The current token credits available for a job\n /// @param _job The address of the job\n /// @param _token The address of the token bonded\n /// @return _amount The amount of token credits available for a job\n function jobTokenCredits(address _job, address _token) external view returns (uint256 _amount);\n\n /// @notice Tracks the amount of assets deposited in pending bonds\n /// @param _keeper The address of the keeper\n /// @param _bonding The address of the token being bonded\n /// @return _pendingBonds Amount of a certain asset a keeper has unbonding\n function pendingBonds(address _keeper, address _bonding) external view returns (uint256 _pendingBonds);\n\n /// @notice Tracks when a bonding for a keeper can be activated\n /// @param _keeper The address of the keeper\n /// @param _bonding The address of the token being bonded\n /// @return _timestamp Time at which the bonding for a keeper can be activated\n function canActivateAfter(address _keeper, address _bonding) external view returns (uint256 _timestamp);\n\n /// @notice Tracks when keeper bonds are ready to be withdrawn\n /// @param _keeper The address of the keeper\n /// @param _bonding The address of the token being unbonded\n /// @return _timestamp Time at which the keeper bonds are ready to be withdrawn\n function canWithdrawAfter(address _keeper, address _bonding) external view returns (uint256 _timestamp);\n\n /// @notice Tracks how much keeper bonds are to be withdrawn\n /// @param _keeper The address of the keeper\n /// @param _bonding The address of the token being unbonded\n /// @return _pendingUnbonds The amount of keeper bonds that are to be withdrawn\n function pendingUnbonds(address _keeper, address _bonding) external view returns (uint256 _pendingUnbonds);\n\n /// @notice Checks whether the address has ever bonded an asset\n /// @param _keeper The address of the keeper\n /// @return _hasBonded Whether the address has ever bonded an asset\n function hasBonded(address _keeper) external view returns (bool _hasBonded);\n\n // Methods\n\n /// @notice Lists all jobs\n /// @return _jobList Array with all the jobs in _jobs\n function jobs() external view returns (address[] memory _jobList);\n\n /// @notice Lists all keepers\n /// @return _keeperList Array with all the keepers in _keepers\n function keepers() external view returns (address[] memory _keeperList);\n\n // Errors\n\n /// @notice Throws when an address is passed as a job, but that address is not a job\n error JobUnavailable();\n\n /// @notice Throws when an action that requires an undisputed job is applied on a disputed job\n error JobDisputed();\n}\n" - }, - "solidity/interfaces/peripherals/IKeep3rRoles.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport './IBaseErrors.sol';\nimport './IGovernable.sol';\nimport './IDustCollector.sol';\n\n/// @title Keep3rRoles contract\n/// @notice Manages the Keep3r specific roles\ninterface IKeep3rRoles is IBaseErrors, IDustCollector, IGovernable {\n // Events\n\n /// @notice Emitted when a slasher is added\n /// @param _slasher Address of the added slasher\n event SlasherAdded(address _slasher);\n\n /// @notice Emitted when a slasher is removed\n /// @param _slasher Address of the removed slasher\n event SlasherRemoved(address _slasher);\n\n /// @notice Emitted when a disputer is added\n /// @param _disputer Address of the added disputer\n event DisputerAdded(address _disputer);\n\n /// @notice Emitted when a disputer is removed\n /// @param _disputer Address of the removed disputer\n event DisputerRemoved(address _disputer);\n\n // Variables\n\n /// @notice Tracks whether the address is a slasher or not\n /// @param _slasher Address being checked as a slasher\n /// @return _isSlasher Whether the address is a slasher or not\n function slashers(address _slasher) external view returns (bool _isSlasher);\n\n /// @notice Tracks whether the address is a disputer or not\n /// @param _disputer Address being checked as a disputer\n /// @return _isDisputer Whether the address is a disputer or not\n function disputers(address _disputer) external view returns (bool _isDisputer);\n\n // Errors\n\n /// @notice Throws if the address is already a registered slasher\n error SlasherExistent();\n\n /// @notice Throws if caller is not a registered slasher\n error SlasherUnexistent();\n\n /// @notice Throws if the address is already a registered disputer\n error DisputerExistent();\n\n /// @notice Throws if caller is not a registered disputer\n error DisputerUnexistent();\n\n /// @notice Throws if the msg.sender is not a slasher or is not a part of governance\n error OnlySlasher();\n\n /// @notice Throws if the msg.sender is not a disputer or is not a part of governance\n error OnlyDisputer();\n\n // Methods\n\n /// @notice Registers a slasher by updating the slashers mapping\n function addSlasher(address _slasher) external;\n\n /// @notice Removes a slasher by updating the slashers mapping\n function removeSlasher(address _slasher) external;\n\n /// @notice Registers a disputer by updating the disputers mapping\n function addDisputer(address _disputer) external;\n\n /// @notice Removes a disputer by updating the disputers mapping\n function removeDisputer(address _disputer) external;\n}\n" - }, - "solidity/interfaces/peripherals/IBaseErrors.sol": { - "content": "// SPDX-License-Identifier: MIT\n\npragma solidity >=0.8.4 <0.9.0;\n\ninterface IBaseErrors {\n /// @notice Throws if a variable is assigned to the zero address\n error ZeroAddress();\n}\n" - }, - "solidity/interfaces/peripherals/IGovernable.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\n/// @title Governable contract\n/// @notice Manages the governance role\ninterface IGovernable {\n // Events\n\n /// @notice Emitted when pendingGovernance accepts to be governance\n /// @param _governance Address of the new governance\n event GovernanceSet(address _governance);\n\n /// @notice Emitted when a new governance is proposed\n /// @param _pendingGovernance Address that is proposed to be the new governance\n event GovernanceProposal(address _pendingGovernance);\n\n // Errors\n\n /// @notice Throws if the caller of the function is not governance\n error OnlyGovernance();\n\n /// @notice Throws if the caller of the function is not pendingGovernance\n error OnlyPendingGovernance();\n\n /// @notice Throws if trying to set governance to zero address\n error NoGovernanceZeroAddress();\n\n // Variables\n\n /// @notice Stores the governance address\n /// @return _governance The governance addresss\n function governance() external view returns (address _governance);\n\n /// @notice Stores the pendingGovernance address\n /// @return _pendingGovernance The pendingGovernance addresss\n function pendingGovernance() external view returns (address _pendingGovernance);\n\n // Methods\n\n /// @notice Proposes a new address to be governance\n /// @param _governance The address being proposed as the new governance\n function setGovernance(address _governance) external;\n\n /// @notice Changes the governance from the current governance to the previously proposed address\n function acceptGovernance() external;\n}\n" - }, - "solidity/interfaces/peripherals/IDustCollector.sol": { - "content": "// SPDX-License-Identifier: MIT\n\npragma solidity >=0.8.4 <0.9.0;\n\nimport './IBaseErrors.sol';\n\ninterface IDustCollector is IBaseErrors {\n /// @notice Emitted when dust is sent\n /// @param _token The token that will be transferred\n /// @param _amount The amount of the token that will be transferred\n /// @param _to The address which will receive the funds\n event DustSent(address _token, uint256 _amount, address _to);\n\n /// @notice Allows an authorized user to transfer the tokens or eth that may have been left in a contract\n /// @param _token The token that will be transferred\n /// @param _amount The amount of the token that will be transferred\n /// @param _to The address that will receive the idle funds\n function sendDust(\n address _token,\n uint256 _amount,\n address _to\n ) external;\n}\n" - }, - "solidity/contracts/peripherals/jobs/Keep3rJobManager.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport './Keep3rJobOwnership.sol';\nimport '../Keep3rAccountance.sol';\nimport '../../../interfaces/peripherals/IKeep3rJobs.sol';\n\nabstract contract Keep3rJobManager is IKeep3rJobManager, Keep3rJobOwnership, Keep3rAccountance {\n using EnumerableSet for EnumerableSet.AddressSet;\n\n /// @inheritdoc IKeep3rJobManager\n function addJob(address _job) external override {\n if (_jobs.contains(_job)) revert JobAlreadyAdded();\n if (hasBonded[_job]) revert AlreadyAKeeper();\n _jobs.add(_job);\n jobOwner[_job] = msg.sender;\n emit JobAddition(_job, msg.sender);\n }\n}\n" - }, - "solidity/contracts/peripherals/jobs/Keep3rJobWorkable.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport './Keep3rJobMigration.sol';\nimport '../../../interfaces/IKeep3rHelper.sol';\nimport '../../../interfaces/peripherals/IKeep3rJobs.sol';\n\nimport '@openzeppelin/contracts/token/ERC20/IERC20.sol';\nimport '@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol';\n\nabstract contract Keep3rJobWorkable is IKeep3rJobWorkable, Keep3rJobMigration {\n using EnumerableSet for EnumerableSet.AddressSet;\n using SafeERC20 for IERC20;\n\n uint256 internal _initialGas;\n\n /// @inheritdoc IKeep3rJobWorkable\n function isKeeper(address _keeper) external override returns (bool _isKeeper) {\n _initialGas = _getGasLeft();\n if (_keepers.contains(_keeper)) {\n emit KeeperValidation(_initialGas);\n return true;\n }\n }\n\n /// @inheritdoc IKeep3rJobWorkable\n function isBondedKeeper(\n address _keeper,\n address _bond,\n uint256 _minBond,\n uint256 _earned,\n uint256 _age\n ) external override returns (bool _isBondedKeeper) {\n _initialGas = _getGasLeft();\n if (\n _keepers.contains(_keeper) &&\n bonds[_keeper][_bond] >= _minBond &&\n workCompleted[_keeper] >= _earned &&\n block.timestamp - firstSeen[_keeper] >= _age\n ) {\n emit KeeperValidation(_initialGas);\n return true;\n }\n }\n\n /// @inheritdoc IKeep3rJobWorkable\n function worked(address _keeper) external virtual override {\n if (_initialGas == 0) revert GasNotInitialized();\n address _job = msg.sender;\n if (disputes[_job]) revert JobDisputed();\n if (!_jobs.contains(_job)) revert JobUnapproved();\n\n if (_updateJobCreditsIfNeeded(_job)) {\n emit LiquidityCreditsReward(_job, rewardedAt[_job], _jobLiquidityCredits[_job], _jobPeriodCredits[_job]);\n }\n\n (uint256 _boost, uint256 _oneEthQuote, uint256 _extraGas) = IKeep3rHelper(keep3rHelper).getPaymentParams(bonds[_keeper][keep3rV1]);\n\n uint256 _gasLeft = _getGasLeft();\n uint256 _payment = _calculatePayment(_gasLeft, _extraGas, _oneEthQuote, _boost);\n\n if (_payment > _jobLiquidityCredits[_job]) {\n _rewardJobCredits(_job);\n emit LiquidityCreditsReward(_job, rewardedAt[_job], _jobLiquidityCredits[_job], _jobPeriodCredits[_job]);\n\n _gasLeft = _getGasLeft();\n _payment = _calculatePayment(_gasLeft, _extraGas, _oneEthQuote, _boost);\n }\n\n _bondedPayment(_job, _keeper, _payment);\n delete _initialGas;\n\n emit KeeperWork(keep3rV1, _job, _keeper, _payment, _gasLeft);\n }\n\n /// @inheritdoc IKeep3rJobWorkable\n function bondedPayment(address _keeper, uint256 _payment) external override {\n address _job = msg.sender;\n\n if (disputes[_job]) revert JobDisputed();\n if (!_jobs.contains(_job)) revert JobUnapproved();\n\n if (_updateJobCreditsIfNeeded(_job)) {\n emit LiquidityCreditsReward(_job, rewardedAt[_job], _jobLiquidityCredits[_job], _jobPeriodCredits[_job]);\n }\n\n if (_payment > _jobLiquidityCredits[_job]) {\n _rewardJobCredits(_job);\n emit LiquidityCreditsReward(_job, rewardedAt[_job], _jobLiquidityCredits[_job], _jobPeriodCredits[_job]);\n }\n\n _bondedPayment(_job, _keeper, _payment);\n emit KeeperWork(keep3rV1, _job, _keeper, _payment, _getGasLeft());\n }\n\n /// @inheritdoc IKeep3rJobWorkable\n function directTokenPayment(\n address _token,\n address _keeper,\n uint256 _amount\n ) external override {\n address _job = msg.sender;\n\n if (disputes[_job]) revert JobDisputed();\n if (disputes[_keeper]) revert Disputed();\n if (!_jobs.contains(_job)) revert JobUnapproved();\n if (jobTokenCredits[_job][_token] < _amount) revert InsufficientFunds();\n jobTokenCredits[_job][_token] -= _amount;\n IERC20(_token).safeTransfer(_keeper, _amount);\n emit KeeperWork(_token, _job, _keeper, _amount, _getGasLeft());\n }\n\n function _bondedPayment(\n address _job,\n address _keeper,\n uint256 _payment\n ) internal {\n if (_payment > _jobLiquidityCredits[_job]) revert InsufficientFunds();\n\n workedAt[_job] = block.timestamp;\n _jobLiquidityCredits[_job] -= _payment;\n bonds[_keeper][keep3rV1] += _payment;\n workCompleted[_keeper] += _payment;\n totalBonds += _payment;\n }\n\n /// @notice Calculate amount to be payed in KP3R, taking into account multiple parameters\n /// @param _gasLeft Amount of gas left after working the job\n /// @param _extraGas Amount of expected unaccounted gas\n /// @param _oneEthQuote Amount of KP3R equivalent to 1 ETH\n /// @param _boost Reward given to the keeper for having bonded KP3R tokens\n /// @return _payment Amount to be payed in KP3R tokens\n function _calculatePayment(\n uint256 _gasLeft,\n uint256 _extraGas,\n uint256 _oneEthQuote,\n uint256 _boost\n ) internal view returns (uint256 _payment) {\n uint256 _accountedGas = _initialGas - _gasLeft + _extraGas;\n _payment = (((_accountedGas * _boost) / _BASE) * _oneEthQuote) / 1 ether;\n }\n\n /// @notice Return the gas left and add 1/64 in order to match real gas left at first level of depth (EIP-150)\n /// @return _gasLeft Amount of gas left recording taking into account EIP-150\n function _getGasLeft() internal view returns (uint256 _gasLeft) {\n _gasLeft = (gasleft() * 64) / 63;\n }\n}\n" - }, - "solidity/contracts/peripherals/jobs/Keep3rJobDisputable.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport './Keep3rJobFundableCredits.sol';\nimport './Keep3rJobFundableLiquidity.sol';\nimport '../Keep3rDisputable.sol';\n\nabstract contract Keep3rJobDisputable is IKeep3rJobDisputable, Keep3rDisputable, Keep3rJobFundableCredits, Keep3rJobFundableLiquidity {\n using EnumerableSet for EnumerableSet.AddressSet;\n using SafeERC20 for IERC20;\n\n /// @inheritdoc IKeep3rJobDisputable\n function slashTokenFromJob(\n address _job,\n address _token,\n uint256 _amount\n ) external override onlySlasher {\n if (!disputes[_job]) revert NotDisputed();\n if (!_jobTokens[_job].contains(_token)) revert JobTokenUnexistent();\n if (jobTokenCredits[_job][_token] < _amount) revert JobTokenInsufficient();\n\n try IERC20(_token).transfer(governance, _amount) {} catch {}\n jobTokenCredits[_job][_token] -= _amount;\n if (jobTokenCredits[_job][_token] == 0) {\n _jobTokens[_job].remove(_token);\n }\n\n emit JobSlashToken(_job, _token, msg.sender, _amount);\n }\n\n /// @inheritdoc IKeep3rJobDisputable\n function slashLiquidityFromJob(\n address _job,\n address _liquidity,\n uint256 _amount\n ) external override onlySlasher {\n if (!disputes[_job]) revert NotDisputed();\n\n _unbondLiquidityFromJob(_job, _liquidity, _amount);\n try IERC20(_liquidity).transfer(governance, _amount) {} catch {}\n emit JobSlashLiquidity(_job, _liquidity, msg.sender, _amount);\n }\n}\n" - }, - "solidity/contracts/peripherals/jobs/Keep3rJobOwnership.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../../../interfaces/peripherals/IKeep3rJobs.sol';\n\nabstract contract Keep3rJobOwnership is IKeep3rJobOwnership {\n /// @inheritdoc IKeep3rJobOwnership\n mapping(address => address) public override jobOwner;\n\n /// @inheritdoc IKeep3rJobOwnership\n mapping(address => address) public override jobPendingOwner;\n\n /// @inheritdoc IKeep3rJobOwnership\n function changeJobOwnership(address _job, address _newOwner) external override onlyJobOwner(_job) {\n jobPendingOwner[_job] = _newOwner;\n emit JobOwnershipChange(_job, jobOwner[_job], _newOwner);\n }\n\n /// @inheritdoc IKeep3rJobOwnership\n function acceptJobOwnership(address _job) external override onlyPendingJobOwner(_job) {\n address _previousOwner = jobOwner[_job];\n\n jobOwner[_job] = jobPendingOwner[_job];\n delete jobPendingOwner[_job];\n\n emit JobOwnershipAssent(msg.sender, _job, _previousOwner);\n }\n\n modifier onlyJobOwner(address _job) {\n if (msg.sender != jobOwner[_job]) revert OnlyJobOwner();\n _;\n }\n\n modifier onlyPendingJobOwner(address _job) {\n if (msg.sender != jobPendingOwner[_job]) revert OnlyPendingJobOwner();\n _;\n }\n}\n" - }, - "solidity/contracts/peripherals/Keep3rAccountance.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '@openzeppelin/contracts/utils/structs/EnumerableSet.sol';\nimport '../../interfaces/peripherals/IKeep3rAccountance.sol';\nimport './Keep3rRoles.sol';\n\nabstract contract Keep3rAccountance is IKeep3rAccountance, Keep3rRoles {\n using EnumerableSet for EnumerableSet.AddressSet;\n\n /// @notice List of all enabled keepers\n EnumerableSet.AddressSet internal _keepers;\n\n /// @inheritdoc IKeep3rAccountance\n uint256 public override totalBonds;\n\n /// @inheritdoc IKeep3rAccountance\n mapping(address => uint256) public override workCompleted;\n\n /// @inheritdoc IKeep3rAccountance\n mapping(address => uint256) public override firstSeen;\n\n /// @inheritdoc IKeep3rAccountance\n mapping(address => bool) public override disputes;\n\n /// @inheritdoc IKeep3rAccountance\n /// @notice Mapping (job => bonding => amount)\n mapping(address => mapping(address => uint256)) public override bonds;\n\n /// @inheritdoc IKeep3rAccountance\n mapping(address => mapping(address => uint256)) public override jobTokenCredits;\n\n /// @notice The current liquidity credits available for a job\n mapping(address => uint256) internal _jobLiquidityCredits;\n\n /// @notice Map the address of a job to its correspondent periodCredits\n mapping(address => uint256) internal _jobPeriodCredits;\n\n /// @notice Enumerable array of Job Tokens for Credits\n mapping(address => EnumerableSet.AddressSet) internal _jobTokens;\n\n /// @notice List of liquidities that a job has (job => liquidities)\n mapping(address => EnumerableSet.AddressSet) internal _jobLiquidities;\n\n /// @notice Liquidity pool to observe\n mapping(address => address) internal _liquidityPool;\n\n /// @notice Tracks if a pool has KP3R as token0\n mapping(address => bool) internal _isKP3RToken0;\n\n /// @inheritdoc IKeep3rAccountance\n mapping(address => mapping(address => uint256)) public override pendingBonds;\n\n /// @inheritdoc IKeep3rAccountance\n mapping(address => mapping(address => uint256)) public override canActivateAfter;\n\n /// @inheritdoc IKeep3rAccountance\n mapping(address => mapping(address => uint256)) public override canWithdrawAfter;\n\n /// @inheritdoc IKeep3rAccountance\n mapping(address => mapping(address => uint256)) public override pendingUnbonds;\n\n /// @inheritdoc IKeep3rAccountance\n mapping(address => bool) public override hasBonded;\n\n /// @notice List of all enabled jobs\n EnumerableSet.AddressSet internal _jobs;\n\n /// @inheritdoc IKeep3rAccountance\n function jobs() external view override returns (address[] memory _list) {\n _list = _jobs.values();\n }\n\n /// @inheritdoc IKeep3rAccountance\n function keepers() external view override returns (address[] memory _list) {\n _list = _keepers.values();\n }\n}\n" - }, - "@openzeppelin/contracts/utils/structs/EnumerableSet.sol": { - "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Library for managing\n * https://en.wikipedia.org/wiki/Set_(abstract_data_type)[sets] of primitive\n * types.\n *\n * Sets have the following properties:\n *\n * - Elements are added, removed, and checked for existence in constant time\n * (O(1)).\n * - Elements are enumerated in O(n). No guarantees are made on the ordering.\n *\n * ```\n * contract Example {\n * // Add the library methods\n * using EnumerableSet for EnumerableSet.AddressSet;\n *\n * // Declare a set state variable\n * EnumerableSet.AddressSet private mySet;\n * }\n * ```\n *\n * As of v3.3.0, sets of type `bytes32` (`Bytes32Set`), `address` (`AddressSet`)\n * and `uint256` (`UintSet`) are supported.\n */\nlibrary EnumerableSet {\n // To implement this library for multiple types with as little code\n // repetition as possible, we write it in terms of a generic Set type with\n // bytes32 values.\n // The Set implementation uses private functions, and user-facing\n // implementations (such as AddressSet) are just wrappers around the\n // underlying Set.\n // This means that we can only create new EnumerableSets for types that fit\n // in bytes32.\n\n struct Set {\n // Storage of set values\n bytes32[] _values;\n // Position of the value in the `values` array, plus 1 because index 0\n // means a value is not in the set.\n mapping(bytes32 => uint256) _indexes;\n }\n\n /**\n * @dev Add a value to a set. O(1).\n *\n * Returns true if the value was added to the set, that is if it was not\n * already present.\n */\n function _add(Set storage set, bytes32 value) private returns (bool) {\n if (!_contains(set, value)) {\n set._values.push(value);\n // The value is stored at length-1, but we add 1 to all indexes\n // and use 0 as a sentinel value\n set._indexes[value] = set._values.length;\n return true;\n } else {\n return false;\n }\n }\n\n /**\n * @dev Removes a value from a set. O(1).\n *\n * Returns true if the value was removed from the set, that is if it was\n * present.\n */\n function _remove(Set storage set, bytes32 value) private returns (bool) {\n // We read and store the value's index to prevent multiple reads from the same storage slot\n uint256 valueIndex = set._indexes[value];\n\n if (valueIndex != 0) {\n // Equivalent to contains(set, value)\n // To delete an element from the _values array in O(1), we swap the element to delete with the last one in\n // the array, and then remove the last element (sometimes called as 'swap and pop').\n // This modifies the order of the array, as noted in {at}.\n\n uint256 toDeleteIndex = valueIndex - 1;\n uint256 lastIndex = set._values.length - 1;\n\n if (lastIndex != toDeleteIndex) {\n bytes32 lastvalue = set._values[lastIndex];\n\n // Move the last value to the index where the value to delete is\n set._values[toDeleteIndex] = lastvalue;\n // Update the index for the moved value\n set._indexes[lastvalue] = valueIndex; // Replace lastvalue's index to valueIndex\n }\n\n // Delete the slot where the moved value was stored\n set._values.pop();\n\n // Delete the index for the deleted slot\n delete set._indexes[value];\n\n return true;\n } else {\n return false;\n }\n }\n\n /**\n * @dev Returns true if the value is in the set. O(1).\n */\n function _contains(Set storage set, bytes32 value) private view returns (bool) {\n return set._indexes[value] != 0;\n }\n\n /**\n * @dev Returns the number of values on the set. O(1).\n */\n function _length(Set storage set) private view returns (uint256) {\n return set._values.length;\n }\n\n /**\n * @dev Returns the value stored at position `index` in the set. O(1).\n *\n * Note that there are no guarantees on the ordering of values inside the\n * array, and it may change when more values are added or removed.\n *\n * Requirements:\n *\n * - `index` must be strictly less than {length}.\n */\n function _at(Set storage set, uint256 index) private view returns (bytes32) {\n return set._values[index];\n }\n\n /**\n * @dev Return the entire set in an array\n *\n * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed\n * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that\n * this function has an unbounded cost, and using it as part of a state-changing function may render the function\n * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.\n */\n function _values(Set storage set) private view returns (bytes32[] memory) {\n return set._values;\n }\n\n // Bytes32Set\n\n struct Bytes32Set {\n Set _inner;\n }\n\n /**\n * @dev Add a value to a set. O(1).\n *\n * Returns true if the value was added to the set, that is if it was not\n * already present.\n */\n function add(Bytes32Set storage set, bytes32 value) internal returns (bool) {\n return _add(set._inner, value);\n }\n\n /**\n * @dev Removes a value from a set. O(1).\n *\n * Returns true if the value was removed from the set, that is if it was\n * present.\n */\n function remove(Bytes32Set storage set, bytes32 value) internal returns (bool) {\n return _remove(set._inner, value);\n }\n\n /**\n * @dev Returns true if the value is in the set. O(1).\n */\n function contains(Bytes32Set storage set, bytes32 value) internal view returns (bool) {\n return _contains(set._inner, value);\n }\n\n /**\n * @dev Returns the number of values in the set. O(1).\n */\n function length(Bytes32Set storage set) internal view returns (uint256) {\n return _length(set._inner);\n }\n\n /**\n * @dev Returns the value stored at position `index` in the set. O(1).\n *\n * Note that there are no guarantees on the ordering of values inside the\n * array, and it may change when more values are added or removed.\n *\n * Requirements:\n *\n * - `index` must be strictly less than {length}.\n */\n function at(Bytes32Set storage set, uint256 index) internal view returns (bytes32) {\n return _at(set._inner, index);\n }\n\n /**\n * @dev Return the entire set in an array\n *\n * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed\n * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that\n * this function has an unbounded cost, and using it as part of a state-changing function may render the function\n * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.\n */\n function values(Bytes32Set storage set) internal view returns (bytes32[] memory) {\n return _values(set._inner);\n }\n\n // AddressSet\n\n struct AddressSet {\n Set _inner;\n }\n\n /**\n * @dev Add a value to a set. O(1).\n *\n * Returns true if the value was added to the set, that is if it was not\n * already present.\n */\n function add(AddressSet storage set, address value) internal returns (bool) {\n return _add(set._inner, bytes32(uint256(uint160(value))));\n }\n\n /**\n * @dev Removes a value from a set. O(1).\n *\n * Returns true if the value was removed from the set, that is if it was\n * present.\n */\n function remove(AddressSet storage set, address value) internal returns (bool) {\n return _remove(set._inner, bytes32(uint256(uint160(value))));\n }\n\n /**\n * @dev Returns true if the value is in the set. O(1).\n */\n function contains(AddressSet storage set, address value) internal view returns (bool) {\n return _contains(set._inner, bytes32(uint256(uint160(value))));\n }\n\n /**\n * @dev Returns the number of values in the set. O(1).\n */\n function length(AddressSet storage set) internal view returns (uint256) {\n return _length(set._inner);\n }\n\n /**\n * @dev Returns the value stored at position `index` in the set. O(1).\n *\n * Note that there are no guarantees on the ordering of values inside the\n * array, and it may change when more values are added or removed.\n *\n * Requirements:\n *\n * - `index` must be strictly less than {length}.\n */\n function at(AddressSet storage set, uint256 index) internal view returns (address) {\n return address(uint160(uint256(_at(set._inner, index))));\n }\n\n /**\n * @dev Return the entire set in an array\n *\n * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed\n * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that\n * this function has an unbounded cost, and using it as part of a state-changing function may render the function\n * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.\n */\n function values(AddressSet storage set) internal view returns (address[] memory) {\n bytes32[] memory store = _values(set._inner);\n address[] memory result;\n\n assembly {\n result := store\n }\n\n return result;\n }\n\n // UintSet\n\n struct UintSet {\n Set _inner;\n }\n\n /**\n * @dev Add a value to a set. O(1).\n *\n * Returns true if the value was added to the set, that is if it was not\n * already present.\n */\n function add(UintSet storage set, uint256 value) internal returns (bool) {\n return _add(set._inner, bytes32(value));\n }\n\n /**\n * @dev Removes a value from a set. O(1).\n *\n * Returns true if the value was removed from the set, that is if it was\n * present.\n */\n function remove(UintSet storage set, uint256 value) internal returns (bool) {\n return _remove(set._inner, bytes32(value));\n }\n\n /**\n * @dev Returns true if the value is in the set. O(1).\n */\n function contains(UintSet storage set, uint256 value) internal view returns (bool) {\n return _contains(set._inner, bytes32(value));\n }\n\n /**\n * @dev Returns the number of values on the set. O(1).\n */\n function length(UintSet storage set) internal view returns (uint256) {\n return _length(set._inner);\n }\n\n /**\n * @dev Returns the value stored at position `index` in the set. O(1).\n *\n * Note that there are no guarantees on the ordering of values inside the\n * array, and it may change when more values are added or removed.\n *\n * Requirements:\n *\n * - `index` must be strictly less than {length}.\n */\n function at(UintSet storage set, uint256 index) internal view returns (uint256) {\n return uint256(_at(set._inner, index));\n }\n\n /**\n * @dev Return the entire set in an array\n *\n * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed\n * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that\n * this function has an unbounded cost, and using it as part of a state-changing function may render the function\n * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.\n */\n function values(UintSet storage set) internal view returns (uint256[] memory) {\n bytes32[] memory store = _values(set._inner);\n uint256[] memory result;\n\n assembly {\n result := store\n }\n\n return result;\n }\n}\n" - }, - "solidity/contracts/peripherals/Keep3rRoles.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../../interfaces/peripherals/IKeep3rRoles.sol';\nimport '@openzeppelin/contracts/utils/structs/EnumerableSet.sol';\nimport './DustCollector.sol';\nimport './Governable.sol';\n\ncontract Keep3rRoles is IKeep3rRoles, Governable, DustCollector {\n /// @inheritdoc IKeep3rRoles\n mapping(address => bool) public override slashers;\n\n /// @inheritdoc IKeep3rRoles\n mapping(address => bool) public override disputers;\n\n constructor(address _governance) Governable(_governance) DustCollector() {}\n\n /// @inheritdoc IKeep3rRoles\n function addSlasher(address _slasher) external override onlyGovernance {\n if (_slasher == address(0)) revert ZeroAddress();\n if (slashers[_slasher]) revert SlasherExistent();\n slashers[_slasher] = true;\n emit SlasherAdded(_slasher);\n }\n\n /// @inheritdoc IKeep3rRoles\n function removeSlasher(address _slasher) external override onlyGovernance {\n if (!slashers[_slasher]) revert SlasherUnexistent();\n delete slashers[_slasher];\n emit SlasherRemoved(_slasher);\n }\n\n /// @inheritdoc IKeep3rRoles\n function addDisputer(address _disputer) external override onlyGovernance {\n if (_disputer == address(0)) revert ZeroAddress();\n if (disputers[_disputer]) revert DisputerExistent();\n disputers[_disputer] = true;\n emit DisputerAdded(_disputer);\n }\n\n /// @inheritdoc IKeep3rRoles\n function removeDisputer(address _disputer) external override onlyGovernance {\n if (!disputers[_disputer]) revert DisputerUnexistent();\n delete disputers[_disputer];\n emit DisputerRemoved(_disputer);\n }\n\n /// @notice Functions with this modifier can only be called by either a slasher or governance\n modifier onlySlasher {\n if (!slashers[msg.sender]) revert OnlySlasher();\n _;\n }\n\n /// @notice Functions with this modifier can only be called by either a disputer or governance\n modifier onlyDisputer {\n if (!disputers[msg.sender]) revert OnlyDisputer();\n _;\n }\n}\n" - }, - "solidity/contracts/peripherals/Governable.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../../interfaces/peripherals/IGovernable.sol';\n\nabstract contract Governable is IGovernable {\n /// @inheritdoc IGovernable\n address public override governance;\n\n /// @inheritdoc IGovernable\n address public override pendingGovernance;\n\n constructor(address _governance) {\n if (_governance == address(0)) revert NoGovernanceZeroAddress();\n governance = _governance;\n }\n\n /// @inheritdoc IGovernable\n function setGovernance(address _governance) external override onlyGovernance {\n pendingGovernance = _governance;\n emit GovernanceProposal(_governance);\n }\n\n /// @inheritdoc IGovernable\n function acceptGovernance() external override onlyPendingGovernance {\n governance = pendingGovernance;\n delete pendingGovernance;\n emit GovernanceSet(governance);\n }\n\n /// @notice Functions with this modifier can only be called by governance\n modifier onlyGovernance {\n if (msg.sender != governance) revert OnlyGovernance();\n _;\n }\n\n /// @notice Functions with this modifier can only be called by pendingGovernance\n modifier onlyPendingGovernance {\n if (msg.sender != pendingGovernance) revert OnlyPendingGovernance();\n _;\n }\n}\n" - }, - "@openzeppelin/contracts/token/ERC20/IERC20.sol": { - "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Interface of the ERC20 standard as defined in the EIP.\n */\ninterface IERC20 {\n /**\n * @dev Returns the amount of tokens in existence.\n */\n function totalSupply() external view returns (uint256);\n\n /**\n * @dev Returns the amount of tokens owned by `account`.\n */\n function balanceOf(address account) external view returns (uint256);\n\n /**\n * @dev Moves `amount` tokens from the caller's account to `recipient`.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * Emits a {Transfer} event.\n */\n function transfer(address recipient, uint256 amount) external returns (bool);\n\n /**\n * @dev Returns the remaining number of tokens that `spender` will be\n * allowed to spend on behalf of `owner` through {transferFrom}. This is\n * zero by default.\n *\n * This value changes when {approve} or {transferFrom} are called.\n */\n function allowance(address owner, address spender) external view returns (uint256);\n\n /**\n * @dev Sets `amount` as the allowance of `spender` over the caller's tokens.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * IMPORTANT: Beware that changing an allowance with this method brings the risk\n * that someone may use both the old and the new allowance by unfortunate\n * transaction ordering. One possible solution to mitigate this race\n * condition is to first reduce the spender's allowance to 0 and set the\n * desired value afterwards:\n * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729\n *\n * Emits an {Approval} event.\n */\n function approve(address spender, uint256 amount) external returns (bool);\n\n /**\n * @dev Moves `amount` tokens from `sender` to `recipient` using the\n * allowance mechanism. `amount` is then deducted from the caller's\n * allowance.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * Emits a {Transfer} event.\n */\n function transferFrom(\n address sender,\n address recipient,\n uint256 amount\n ) external returns (bool);\n\n /**\n * @dev Emitted when `value` tokens are moved from one account (`from`) to\n * another (`to`).\n *\n * Note that `value` may be zero.\n */\n event Transfer(address indexed from, address indexed to, uint256 value);\n\n /**\n * @dev Emitted when the allowance of a `spender` for an `owner` is set by\n * a call to {approve}. `value` is the new allowance.\n */\n event Approval(address indexed owner, address indexed spender, uint256 value);\n}\n" - }, - "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol": { - "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\nimport \"../IERC20.sol\";\nimport \"../../../utils/Address.sol\";\n\n/**\n * @title SafeERC20\n * @dev Wrappers around ERC20 operations that throw on failure (when the token\n * contract returns false). Tokens that return no value (and instead revert or\n * throw on failure) are also supported, non-reverting calls are assumed to be\n * successful.\n * To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract,\n * which allows you to call the safe operations as `token.safeTransfer(...)`, etc.\n */\nlibrary SafeERC20 {\n using Address for address;\n\n function safeTransfer(\n IERC20 token,\n address to,\n uint256 value\n ) internal {\n _callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value));\n }\n\n function safeTransferFrom(\n IERC20 token,\n address from,\n address to,\n uint256 value\n ) internal {\n _callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value));\n }\n\n /**\n * @dev Deprecated. This function has issues similar to the ones found in\n * {IERC20-approve}, and its usage is discouraged.\n *\n * Whenever possible, use {safeIncreaseAllowance} and\n * {safeDecreaseAllowance} instead.\n */\n function safeApprove(\n IERC20 token,\n address spender,\n uint256 value\n ) internal {\n // safeApprove should only be called when setting an initial allowance,\n // or when resetting it to zero. To increase and decrease it, use\n // 'safeIncreaseAllowance' and 'safeDecreaseAllowance'\n require(\n (value == 0) || (token.allowance(address(this), spender) == 0),\n \"SafeERC20: approve from non-zero to non-zero allowance\"\n );\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value));\n }\n\n function safeIncreaseAllowance(\n IERC20 token,\n address spender,\n uint256 value\n ) internal {\n uint256 newAllowance = token.allowance(address(this), spender) + value;\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));\n }\n\n function safeDecreaseAllowance(\n IERC20 token,\n address spender,\n uint256 value\n ) internal {\n unchecked {\n uint256 oldAllowance = token.allowance(address(this), spender);\n require(oldAllowance >= value, \"SafeERC20: decreased allowance below zero\");\n uint256 newAllowance = oldAllowance - value;\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));\n }\n }\n\n /**\n * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement\n * on the return value: the return value is optional (but if data is returned, it must not be false).\n * @param token The token targeted by the call.\n * @param data The call data (encoded using abi.encode or one of its variants).\n */\n function _callOptionalReturn(IERC20 token, bytes memory data) private {\n // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since\n // we're implementing it ourselves. We use {Address.functionCall} to perform this call, which verifies that\n // the target address contains contract code and also asserts for success in the low-level call.\n\n bytes memory returndata = address(token).functionCall(data, \"SafeERC20: low-level call failed\");\n if (returndata.length > 0) {\n // Return data is optional\n require(abi.decode(returndata, (bool)), \"SafeERC20: ERC20 operation did not succeed\");\n }\n }\n}\n" - }, - "@openzeppelin/contracts/utils/Address.sol": { - "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Collection of functions related to the address type\n */\nlibrary Address {\n /**\n * @dev Returns true if `account` is a contract.\n *\n * [IMPORTANT]\n * ====\n * It is unsafe to assume that an address for which this function returns\n * false is an externally-owned account (EOA) and not a contract.\n *\n * Among others, `isContract` will return false for the following\n * types of addresses:\n *\n * - an externally-owned account\n * - a contract in construction\n * - an address where a contract will be created\n * - an address where a contract lived, but was destroyed\n * ====\n */\n function isContract(address account) internal view returns (bool) {\n // This method relies on extcodesize, which returns 0 for contracts in\n // construction, since the code is only stored at the end of the\n // constructor execution.\n\n uint256 size;\n assembly {\n size := extcodesize(account)\n }\n return size > 0;\n }\n\n /**\n * @dev Replacement for Solidity's `transfer`: sends `amount` wei to\n * `recipient`, forwarding all available gas and reverting on errors.\n *\n * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost\n * of certain opcodes, possibly making contracts go over the 2300 gas limit\n * imposed by `transfer`, making them unable to receive funds via\n * `transfer`. {sendValue} removes this limitation.\n *\n * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].\n *\n * IMPORTANT: because control is transferred to `recipient`, care must be\n * taken to not create reentrancy vulnerabilities. Consider using\n * {ReentrancyGuard} or the\n * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].\n */\n function sendValue(address payable recipient, uint256 amount) internal {\n require(address(this).balance >= amount, \"Address: insufficient balance\");\n\n (bool success, ) = recipient.call{value: amount}(\"\");\n require(success, \"Address: unable to send value, recipient may have reverted\");\n }\n\n /**\n * @dev Performs a Solidity function call using a low level `call`. A\n * plain `call` is an unsafe replacement for a function call: use this\n * function instead.\n *\n * If `target` reverts with a revert reason, it is bubbled up by this\n * function (like regular Solidity function calls).\n *\n * Returns the raw returned data. To convert to the expected return value,\n * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\n *\n * Requirements:\n *\n * - `target` must be a contract.\n * - calling `target` with `data` must not revert.\n *\n * _Available since v3.1._\n */\n function functionCall(address target, bytes memory data) internal returns (bytes memory) {\n return functionCall(target, data, \"Address: low-level call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with\n * `errorMessage` as a fallback revert reason when `target` reverts.\n *\n * _Available since v3.1._\n */\n function functionCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal returns (bytes memory) {\n return functionCallWithValue(target, data, 0, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but also transferring `value` wei to `target`.\n *\n * Requirements:\n *\n * - the calling contract must have an ETH balance of at least `value`.\n * - the called Solidity function must be `payable`.\n *\n * _Available since v3.1._\n */\n function functionCallWithValue(\n address target,\n bytes memory data,\n uint256 value\n ) internal returns (bytes memory) {\n return functionCallWithValue(target, data, value, \"Address: low-level call with value failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but\n * with `errorMessage` as a fallback revert reason when `target` reverts.\n *\n * _Available since v3.1._\n */\n function functionCallWithValue(\n address target,\n bytes memory data,\n uint256 value,\n string memory errorMessage\n ) internal returns (bytes memory) {\n require(address(this).balance >= value, \"Address: insufficient balance for call\");\n require(isContract(target), \"Address: call to non-contract\");\n\n (bool success, bytes memory returndata) = target.call{value: value}(data);\n return verifyCallResult(success, returndata, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but performing a static call.\n *\n * _Available since v3.3._\n */\n function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\n return functionStaticCall(target, data, \"Address: low-level static call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\n * but performing a static call.\n *\n * _Available since v3.3._\n */\n function functionStaticCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal view returns (bytes memory) {\n require(isContract(target), \"Address: static call to non-contract\");\n\n (bool success, bytes memory returndata) = target.staticcall(data);\n return verifyCallResult(success, returndata, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but performing a delegate call.\n *\n * _Available since v3.4._\n */\n function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {\n return functionDelegateCall(target, data, \"Address: low-level delegate call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\n * but performing a delegate call.\n *\n * _Available since v3.4._\n */\n function functionDelegateCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal returns (bytes memory) {\n require(isContract(target), \"Address: delegate call to non-contract\");\n\n (bool success, bytes memory returndata) = target.delegatecall(data);\n return verifyCallResult(success, returndata, errorMessage);\n }\n\n /**\n * @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the\n * revert reason using the provided one.\n *\n * _Available since v4.3._\n */\n function verifyCallResult(\n bool success,\n bytes memory returndata,\n string memory errorMessage\n ) internal pure returns (bytes memory) {\n if (success) {\n return returndata;\n } else {\n // Look for revert reason and bubble it up if present\n if (returndata.length > 0) {\n // The easiest way to bubble the revert reason is using memory via assembly\n\n assembly {\n let returndata_size := mload(returndata)\n revert(add(32, returndata), returndata_size)\n }\n } else {\n revert(errorMessage);\n }\n }\n }\n}\n" - }, - "solidity/contracts/peripherals/jobs/Keep3rJobMigration.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../../../interfaces/peripherals/IKeep3rJobs.sol';\nimport './Keep3rJobFundableCredits.sol';\nimport './Keep3rJobFundableLiquidity.sol';\n\nabstract contract Keep3rJobMigration is IKeep3rJobMigration, Keep3rJobFundableCredits, Keep3rJobFundableLiquidity {\n using EnumerableSet for EnumerableSet.AddressSet;\n\n uint256 internal constant _MIGRATION_COOLDOWN = 1 minutes;\n\n /// @inheritdoc IKeep3rJobMigration\n mapping(address => address) public override pendingJobMigrations;\n mapping(address => mapping(address => uint256)) internal _migrationCreatedAt;\n\n /// @inheritdoc IKeep3rJobMigration\n function migrateJob(address _fromJob, address _toJob) external override onlyJobOwner(_fromJob) {\n if (_fromJob == _toJob) revert JobMigrationImpossible();\n\n pendingJobMigrations[_fromJob] = _toJob;\n _migrationCreatedAt[_fromJob][_toJob] = block.timestamp;\n\n emit JobMigrationRequested(_fromJob, _toJob);\n }\n\n /// @inheritdoc IKeep3rJobMigration\n function acceptJobMigration(address _fromJob, address _toJob) external override onlyJobOwner(_toJob) {\n if (disputes[_fromJob] || disputes[_toJob]) revert JobDisputed();\n if (pendingJobMigrations[_fromJob] != _toJob) revert JobMigrationUnavailable();\n if (block.timestamp < _migrationCreatedAt[_fromJob][_toJob] + _MIGRATION_COOLDOWN) revert JobMigrationLocked();\n\n // force job credits update for both jobs\n _settleJobAccountance(_fromJob);\n _settleJobAccountance(_toJob);\n\n // migrate tokens\n while (_jobTokens[_fromJob].length() > 0) {\n address _tokenToMigrate = _jobTokens[_fromJob].at(0);\n jobTokenCredits[_toJob][_tokenToMigrate] += jobTokenCredits[_fromJob][_tokenToMigrate];\n delete jobTokenCredits[_fromJob][_tokenToMigrate];\n _jobTokens[_fromJob].remove(_tokenToMigrate);\n _jobTokens[_toJob].add(_tokenToMigrate);\n }\n\n // migrate liquidities\n while (_jobLiquidities[_fromJob].length() > 0) {\n address _liquidity = _jobLiquidities[_fromJob].at(0);\n\n liquidityAmount[_toJob][_liquidity] += liquidityAmount[_fromJob][_liquidity];\n delete liquidityAmount[_fromJob][_liquidity];\n\n _jobLiquidities[_toJob].add(_liquidity);\n _jobLiquidities[_fromJob].remove(_liquidity);\n }\n\n // migrate job balances\n _jobPeriodCredits[_toJob] += _jobPeriodCredits[_fromJob];\n delete _jobPeriodCredits[_fromJob];\n\n _jobLiquidityCredits[_toJob] += _jobLiquidityCredits[_fromJob];\n delete _jobLiquidityCredits[_fromJob];\n\n // stop _fromJob from being a job\n delete rewardedAt[_fromJob];\n _jobs.remove(_fromJob);\n\n // delete unused data slots\n delete jobOwner[_fromJob];\n delete jobPendingOwner[_fromJob];\n delete _migrationCreatedAt[_fromJob][_toJob];\n delete pendingJobMigrations[_fromJob];\n\n emit JobMigrationSuccessful(_fromJob, _toJob);\n }\n}\n" - }, - "solidity/interfaces/IKeep3rHelper.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport './IKeep3rHelperParameters.sol';\n\n/// @title Keep3rHelper contract\n/// @notice Contains all the helper functions used throughout the different files.\ninterface IKeep3rHelper is IKeep3rHelperParameters {\n // Errors\n\n /// @notice Throws when none of the tokens in the liquidity pair is KP3R\n error LiquidityPairInvalid();\n\n // Methods\n // solhint-enable func-name-mixedcase\n\n /// @notice Calculates the amount of KP3R that corresponds to the ETH passed into the function\n /// @dev This function allows us to calculate how much KP3R we should pay to a keeper for things expressed in ETH, like gas\n /// @param _eth The amount of ETH\n /// @return _amountOut The amount of KP3R\n function quote(uint256 _eth) external view returns (uint256 _amountOut);\n\n /// @notice Returns the amount of KP3R the keeper has bonded\n /// @param _keeper The address of the keeper to check\n /// @return _amountBonded The amount of KP3R the keeper has bonded\n function bonds(address _keeper) external view returns (uint256 _amountBonded);\n\n /// @notice Calculates the reward (in KP3R) that corresponds to a keeper for using gas\n /// @param _keeper The address of the keeper to check\n /// @param _gasUsed The amount of gas used that will be rewarded\n /// @return _kp3r The amount of KP3R that should be awarded to the keeper\n function getRewardAmountFor(address _keeper, uint256 _gasUsed) external view returns (uint256 _kp3r);\n\n /// @notice Calculates the boost in the reward given to a keeper based on the amount of KP3R that keeper has bonded\n /// @dev If the keeper has no bonds, boost should be +10% of gas cost, if keeper has max bonds, +20%\n /// @param _bonds The amount of KP3R tokens bonded by the keeper\n /// @return _rewardBoost The reward boost that corresponds to the keeper\n function getRewardBoostFor(uint256 _bonds) external view returns (uint256 _rewardBoost);\n\n /// @notice Calculates the reward (in KP3R) that corresponds to tx.origin for using gas\n /// @param _gasUsed The amount of gas used that will be rewarded\n /// @return _amount The amount of KP3R that should be awarded to tx.origin\n function getRewardAmount(uint256 _gasUsed) external view returns (uint256 _amount);\n\n /// @notice Given a pool address, returns the underlying tokens of the pair\n /// @param _pool Address of the correspondant pool\n /// @return _token0 Address of the first token of the pair\n /// @return _token1 Address of the second token of the pair\n function getPoolTokens(address _pool) external view returns (address _token0, address _token1);\n\n /// @notice Defines the order of the tokens in the pair for twap calculations\n /// @param _pool Address of the correspondant pool\n /// @return _isKP3RToken0 Boolean indicating the order of the tokens in the pair\n function isKP3RToken0(address _pool) external view returns (bool _isKP3RToken0);\n\n /// @notice Given an array of secondsAgo, returns UniswapV3 pool cumulatives at that moment\n /// @param _pool Address of the pool to observe\n /// @param _secondsAgo Array with time references to observe\n /// @return _tickCumulative1 Cumulative sum of ticks until first time reference\n /// @return _tickCumulative2 Cumulative sum of ticks until second time reference\n /// @return _success Boolean indicating if the observe call was succesfull\n function observe(address _pool, uint32[] memory _secondsAgo)\n external\n view\n returns (\n int56 _tickCumulative1,\n int56 _tickCumulative2,\n bool _success\n );\n\n /// @notice Get multiplier, quote, and extra, in order to calculate keeper payment\n /// @param _bonds Amount of bonded KP3R owned by the keeper\n /// @return _boost Multiplier per gas unit. Takes into account the base fee and the amount of bonded KP3R\n /// @return _oneEthQuote Amount of KP3R tokens equivalent to 1 ETH\n /// @return _extra Amount of extra gas that should be added to the gas spent\n function getPaymentParams(uint256 _bonds)\n external\n view\n returns (\n uint256 _boost,\n uint256 _oneEthQuote,\n uint256 _extra\n );\n\n /// @notice Given a tick and a liquidity amount, calculates the underlying KP3R tokens\n /// @param _liquidityAmount Amount of liquidity to be converted\n /// @param _tickDifference Tick value used to calculate the quote\n /// @param _timeInterval Time value used to calculate the quote\n /// @return _kp3rAmount Amount of KP3R tokens underlying on the given liquidity\n function getKP3RsAtTick(\n uint256 _liquidityAmount,\n int56 _tickDifference,\n uint256 _timeInterval\n ) external pure returns (uint256 _kp3rAmount);\n\n /// @notice Given a tick and a token amount, calculates the output in correspondant token\n /// @param _baseAmount Amount of token to be converted\n /// @param _tickDifference Tick value used to calculate the quote\n /// @param _timeInterval Time value used to calculate the quote\n /// @return _quoteAmount Amount of credits deserved for the baseAmount at the tick value\n function getQuoteAtTick(\n uint128 _baseAmount,\n int56 _tickDifference,\n uint256 _timeInterval\n ) external pure returns (uint256 _quoteAmount);\n}\n" - }, - "solidity/contracts/peripherals/jobs/Keep3rJobFundableCredits.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport './Keep3rJobOwnership.sol';\nimport '../Keep3rAccountance.sol';\nimport '../Keep3rParameters.sol';\nimport '../../../interfaces/peripherals/IKeep3rJobs.sol';\n\nimport '@openzeppelin/contracts/security/ReentrancyGuard.sol';\nimport '@openzeppelin/contracts/token/ERC20/IERC20.sol';\nimport '@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol';\nimport '@openzeppelin/contracts/utils/math/Math.sol';\n\nabstract contract Keep3rJobFundableCredits is IKeep3rJobFundableCredits, ReentrancyGuard, Keep3rJobOwnership, Keep3rParameters {\n using EnumerableSet for EnumerableSet.AddressSet;\n using SafeERC20 for IERC20;\n\n /// @notice Cooldown between withdrawals\n uint256 internal constant _WITHDRAW_TOKENS_COOLDOWN = 1 minutes;\n\n /// @inheritdoc IKeep3rJobFundableCredits\n mapping(address => mapping(address => uint256)) public override jobTokenCreditsAddedAt;\n\n /// @inheritdoc IKeep3rJobFundableCredits\n function addTokenCreditsToJob(\n address _job,\n address _token,\n uint256 _amount\n ) external override nonReentrant {\n if (!_jobs.contains(_job)) revert JobUnavailable();\n // KP3R shouldn't be used for direct token payments\n if (_token == keep3rV1) revert TokenUnallowed();\n uint256 _before = IERC20(_token).balanceOf(address(this));\n IERC20(_token).safeTransferFrom(msg.sender, address(this), _amount);\n uint256 _received = IERC20(_token).balanceOf(address(this)) - _before;\n uint256 _tokenFee = (_received * fee) / _BASE;\n jobTokenCredits[_job][_token] += _received - _tokenFee;\n jobTokenCreditsAddedAt[_job][_token] = block.timestamp;\n IERC20(_token).safeTransfer(governance, _tokenFee);\n _jobTokens[_job].add(_token);\n\n emit TokenCreditAddition(_job, _token, msg.sender, _received);\n }\n\n /// @inheritdoc IKeep3rJobFundableCredits\n function withdrawTokenCreditsFromJob(\n address _job,\n address _token,\n uint256 _amount,\n address _receiver\n ) external override nonReentrant onlyJobOwner(_job) {\n if (block.timestamp <= jobTokenCreditsAddedAt[_job][_token] + _WITHDRAW_TOKENS_COOLDOWN) revert JobTokenCreditsLocked();\n if (jobTokenCredits[_job][_token] < _amount) revert InsufficientJobTokenCredits();\n if (disputes[_job]) revert JobDisputed();\n\n jobTokenCredits[_job][_token] -= _amount;\n IERC20(_token).safeTransfer(_receiver, _amount);\n\n if (jobTokenCredits[_job][_token] == 0) {\n _jobTokens[_job].remove(_token);\n }\n\n emit TokenCreditWithdrawal(_job, _token, _receiver, _amount);\n }\n}\n" - }, - "solidity/contracts/peripherals/jobs/Keep3rJobFundableLiquidity.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport './Keep3rJobOwnership.sol';\nimport '../Keep3rAccountance.sol';\nimport '../Keep3rParameters.sol';\nimport '../../../interfaces/IPairManager.sol';\nimport '../../../interfaces/peripherals/IKeep3rJobs.sol';\n\nimport '../../libraries/FullMath.sol';\n\nimport '@openzeppelin/contracts/security/ReentrancyGuard.sol';\nimport '@openzeppelin/contracts/token/ERC20/IERC20.sol';\nimport '@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol';\nimport '@openzeppelin/contracts/utils/math/Math.sol';\n\nabstract contract Keep3rJobFundableLiquidity is IKeep3rJobFundableLiquidity, ReentrancyGuard, Keep3rJobOwnership, Keep3rParameters {\n using EnumerableSet for EnumerableSet.AddressSet;\n using SafeERC20 for IERC20;\n\n /// @notice List of liquidities that are accepted in the system\n EnumerableSet.AddressSet internal _approvedLiquidities;\n\n /// @inheritdoc IKeep3rJobFundableLiquidity\n mapping(address => mapping(address => uint256)) public override liquidityAmount;\n\n /// @inheritdoc IKeep3rJobFundableLiquidity\n mapping(address => uint256) public override rewardedAt;\n\n /// @inheritdoc IKeep3rJobFundableLiquidity\n mapping(address => uint256) public override workedAt;\n\n /// @notice Tracks an address and returns its TickCache\n mapping(address => TickCache) internal _tick;\n\n // Views\n\n /// @inheritdoc IKeep3rJobFundableLiquidity\n function approvedLiquidities() external view override returns (address[] memory _list) {\n _list = _approvedLiquidities.values();\n }\n\n /// @inheritdoc IKeep3rJobFundableLiquidity\n function jobPeriodCredits(address _job) public view override returns (uint256 _periodCredits) {\n for (uint256 i; i < _jobLiquidities[_job].length(); i++) {\n address _liquidity = _jobLiquidities[_job].at(i);\n if (_approvedLiquidities.contains(_liquidity)) {\n TickCache memory _tickCache = observeLiquidity(_liquidity);\n if (_tickCache.period != 0) {\n int56 _tickDifference = _isKP3RToken0[_liquidity] ? _tickCache.difference : -_tickCache.difference;\n _periodCredits += _getReward(\n IKeep3rHelper(keep3rHelper).getKP3RsAtTick(liquidityAmount[_job][_liquidity], _tickDifference, rewardPeriodTime)\n );\n }\n }\n }\n }\n\n /// @inheritdoc IKeep3rJobFundableLiquidity\n function jobLiquidityCredits(address _job) public view override returns (uint256 _liquidityCredits) {\n uint256 _periodCredits = jobPeriodCredits(_job);\n\n // If the job was rewarded in the past 1 period time\n if ((block.timestamp - rewardedAt[_job]) < rewardPeriodTime) {\n // If the job has period credits, update minted job credits to new twap\n _liquidityCredits = _periodCredits > 0\n ? (_jobLiquidityCredits[_job] * _periodCredits) / _jobPeriodCredits[_job] // If the job has period credits, return remaining job credits updated to new twap\n : _jobLiquidityCredits[_job]; // If not, return remaining credits, forced credits should not be updated\n } else {\n // Else return a full period worth of credits if current credits have expired\n _liquidityCredits = _periodCredits;\n }\n }\n\n /// @inheritdoc IKeep3rJobFundableLiquidity\n function totalJobCredits(address _job) external view override returns (uint256 _credits) {\n uint256 _periodCredits = jobPeriodCredits(_job);\n uint256 _cooldown = block.timestamp;\n\n if ((rewardedAt[_job] > _period(block.timestamp - rewardPeriodTime))) {\n // Will calculate cooldown if it outdated\n if ((block.timestamp - rewardedAt[_job]) >= rewardPeriodTime) {\n // Will calculate cooldown from last reward reference in this period\n _cooldown -= (rewardedAt[_job] + rewardPeriodTime);\n } else {\n // Will calculate cooldown from last reward timestamp\n _cooldown -= rewardedAt[_job];\n }\n } else {\n // Will calculate cooldown from period start if expired\n _cooldown -= _period(block.timestamp);\n }\n _credits = jobLiquidityCredits(_job) + _phase(_cooldown, _periodCredits);\n }\n\n /// @inheritdoc IKeep3rJobFundableLiquidity\n function quoteLiquidity(address _liquidity, uint256 _amount) external view override returns (uint256 _periodCredits) {\n if (_approvedLiquidities.contains(_liquidity)) {\n TickCache memory _tickCache = observeLiquidity(_liquidity);\n if (_tickCache.period != 0) {\n int56 _tickDifference = _isKP3RToken0[_liquidity] ? _tickCache.difference : -_tickCache.difference;\n return _getReward(IKeep3rHelper(keep3rHelper).getKP3RsAtTick(_amount, _tickDifference, rewardPeriodTime));\n }\n }\n }\n\n /// @inheritdoc IKeep3rJobFundableLiquidity\n function observeLiquidity(address _liquidity) public view virtual override returns (TickCache memory _tickCache) {\n if (_tick[_liquidity].period == _period(block.timestamp)) {\n // Will return cached twaps if liquidity is updated\n _tickCache = _tick[_liquidity];\n } else {\n bool success;\n uint256 lastPeriod = _period(block.timestamp - rewardPeriodTime);\n\n if (_tick[_liquidity].period == lastPeriod) {\n // Will only ask for current period accumulator if liquidity is outdated\n uint32[] memory _secondsAgo = new uint32[](1);\n int56 previousTick = _tick[_liquidity].current;\n\n _secondsAgo[0] = uint32(block.timestamp - _period(block.timestamp));\n\n (_tickCache.current, , success) = IKeep3rHelper(keep3rHelper).observe(_liquidityPool[_liquidity], _secondsAgo);\n\n _tickCache.difference = _tickCache.current - previousTick;\n } else if (_tick[_liquidity].period < lastPeriod) {\n // Will ask for 2 accumulators if liquidity is expired\n uint32[] memory _secondsAgo = new uint32[](2);\n\n _secondsAgo[0] = uint32(block.timestamp - _period(block.timestamp));\n _secondsAgo[1] = uint32(block.timestamp - _period(block.timestamp) + rewardPeriodTime);\n\n int56 _tickCumulative2;\n (_tickCache.current, _tickCumulative2, success) = IKeep3rHelper(keep3rHelper).observe(_liquidityPool[_liquidity], _secondsAgo);\n\n _tickCache.difference = _tickCache.current - _tickCumulative2;\n }\n if (success) {\n _tickCache.period = _period(block.timestamp);\n } else {\n delete _tickCache.period;\n }\n }\n }\n\n // Methods\n\n /// @inheritdoc IKeep3rJobFundableLiquidity\n function forceLiquidityCreditsToJob(address _job, uint256 _amount) external override onlyGovernance {\n if (!_jobs.contains(_job)) revert JobUnavailable();\n _settleJobAccountance(_job);\n _jobLiquidityCredits[_job] += _amount;\n emit LiquidityCreditsForced(_job, rewardedAt[_job], _jobLiquidityCredits[_job]);\n }\n\n /// @inheritdoc IKeep3rJobFundableLiquidity\n function approveLiquidity(address _liquidity) external virtual override onlyGovernance {\n if (!_approvedLiquidities.add(_liquidity)) revert LiquidityPairApproved();\n _liquidityPool[_liquidity] = IPairManager(_liquidity).pool();\n _isKP3RToken0[_liquidity] = IKeep3rHelper(keep3rHelper).isKP3RToken0(_liquidityPool[_liquidity]);\n _tick[_liquidity] = observeLiquidity(_liquidity);\n emit LiquidityApproval(_liquidity);\n }\n\n /// @inheritdoc IKeep3rJobFundableLiquidity\n function revokeLiquidity(address _liquidity) external override onlyGovernance {\n if (!_approvedLiquidities.remove(_liquidity)) revert LiquidityPairUnexistent();\n delete _liquidityPool[_liquidity];\n delete _isKP3RToken0[_liquidity];\n delete _tick[_liquidity];\n\n emit LiquidityRevocation(_liquidity);\n }\n\n /// @inheritdoc IKeep3rJobFundableLiquidity\n function addLiquidityToJob(\n address _job,\n address _liquidity,\n uint256 _amount\n ) external override nonReentrant {\n if (!_approvedLiquidities.contains(_liquidity)) revert LiquidityPairUnapproved();\n if (!_jobs.contains(_job)) revert JobUnavailable();\n\n _jobLiquidities[_job].add(_liquidity);\n\n _settleJobAccountance(_job);\n\n if (_quoteLiquidity(liquidityAmount[_job][_liquidity] + _amount, _liquidity) < liquidityMinimum) revert JobLiquidityLessThanMin();\n\n emit LiquidityCreditsReward(_job, rewardedAt[_job], _jobLiquidityCredits[_job], _jobPeriodCredits[_job]);\n\n IERC20(_liquidity).safeTransferFrom(msg.sender, address(this), _amount);\n liquidityAmount[_job][_liquidity] += _amount;\n _jobPeriodCredits[_job] += _getReward(_quoteLiquidity(_amount, _liquidity));\n emit LiquidityAddition(_job, _liquidity, msg.sender, _amount);\n }\n\n /// @inheritdoc IKeep3rJobFundableLiquidity\n function unbondLiquidityFromJob(\n address _job,\n address _liquidity,\n uint256 _amount\n ) external override onlyJobOwner(_job) {\n canWithdrawAfter[_job][_liquidity] = block.timestamp + unbondTime;\n pendingUnbonds[_job][_liquidity] += _amount;\n _unbondLiquidityFromJob(_job, _liquidity, _amount);\n\n uint256 _remainingLiquidity = liquidityAmount[_job][_liquidity];\n if (_remainingLiquidity > 0 && _quoteLiquidity(_remainingLiquidity, _liquidity) < liquidityMinimum) revert JobLiquidityLessThanMin();\n\n emit Unbonding(_job, _liquidity, _amount);\n }\n\n /// @inheritdoc IKeep3rJobFundableLiquidity\n function withdrawLiquidityFromJob(\n address _job,\n address _liquidity,\n address _receiver\n ) external override onlyJobOwner(_job) {\n if (_receiver == address(0)) revert ZeroAddress();\n if (pendingUnbonds[_job][_liquidity] == 0) revert UnbondsUnexistent();\n if (canWithdrawAfter[_job][_liquidity] >= block.timestamp) revert UnbondsLocked();\n if (disputes[_job]) revert Disputed();\n\n uint256 _amount = pendingUnbonds[_job][_liquidity];\n\n delete pendingUnbonds[_job][_liquidity];\n delete canWithdrawAfter[_job][_liquidity];\n\n IERC20(_liquidity).safeTransfer(_receiver, _amount);\n emit LiquidityWithdrawal(_job, _liquidity, _receiver, _amount);\n }\n\n // Internal functions\n\n /// @notice Updates or rewards job liquidity credits depending on time since last job reward\n function _updateJobCreditsIfNeeded(address _job) internal returns (bool _rewarded) {\n if (rewardedAt[_job] < _period(block.timestamp)) {\n // Will exit function if job has been rewarded in current period\n if (rewardedAt[_job] <= _period(block.timestamp - rewardPeriodTime)) {\n // Will reset job to period syncronicity if a full period passed without rewards\n _updateJobPeriod(_job);\n _jobLiquidityCredits[_job] = _jobPeriodCredits[_job];\n rewardedAt[_job] = _period(block.timestamp);\n _rewarded = true;\n } else if ((block.timestamp - rewardedAt[_job]) >= rewardPeriodTime) {\n // Will reset job's syncronicity if last reward was more than epoch ago\n _updateJobPeriod(_job);\n _jobLiquidityCredits[_job] = _jobPeriodCredits[_job];\n rewardedAt[_job] += rewardPeriodTime;\n _rewarded = true;\n } else if (workedAt[_job] < _period(block.timestamp)) {\n // First keeper on period has to update job accountance to current twaps\n uint256 previousPeriodCredits = _jobPeriodCredits[_job];\n _updateJobPeriod(_job);\n _jobLiquidityCredits[_job] = (_jobLiquidityCredits[_job] * _jobPeriodCredits[_job]) / previousPeriodCredits;\n // Updating job accountance does not reward job\n }\n }\n }\n\n /// @notice Only called if _jobLiquidityCredits < payment\n function _rewardJobCredits(address _job) internal {\n /// @notice Only way to += jobLiquidityCredits is when keeper rewarding (cannot pay work)\n /* WARNING: this allows to top up _jobLiquidityCredits to a max of 1.99 but have to spend at least 1 */\n _jobLiquidityCredits[_job] += _phase(block.timestamp - rewardedAt[_job], _jobPeriodCredits[_job]);\n rewardedAt[_job] = block.timestamp;\n }\n\n /// @notice Updates accountance for _jobPeriodCredits\n function _updateJobPeriod(address _job) internal {\n _jobPeriodCredits[_job] = _calculateJobPeriodCredits(_job);\n }\n\n /// @notice Quotes the outdated job liquidities and calculates _periodCredits\n /// @dev This function is also responsible for keeping the KP3R/WETH quote updated\n function _calculateJobPeriodCredits(address _job) internal returns (uint256 _periodCredits) {\n for (uint256 i; i < _jobLiquidities[_job].length(); i++) {\n address _liquidity = _jobLiquidities[_job].at(i);\n if (_approvedLiquidities.contains(_liquidity)) {\n if (_tick[_liquidity].period != _period(block.timestamp)) {\n // Updates liquidity cache only if needed\n _tick[_liquidity] = observeLiquidity(_liquidity);\n }\n _periodCredits += _getReward(_quoteLiquidity(liquidityAmount[_job][_liquidity], _liquidity));\n }\n }\n }\n\n /// @notice Updates job accountance calculating the impact of the unbonded liquidity amount\n function _unbondLiquidityFromJob(\n address _job,\n address _liquidity,\n uint256 _amount\n ) internal nonReentrant {\n if (!_jobLiquidities[_job].contains(_liquidity)) revert JobLiquidityUnexistent();\n if (liquidityAmount[_job][_liquidity] < _amount) revert JobLiquidityInsufficient();\n\n // Ensures current twaps in job liquidities\n _updateJobPeriod(_job);\n uint256 _periodCreditsToRemove = _getReward(_quoteLiquidity(_amount, _liquidity));\n\n // A liquidity can be revoked causing a job to have 0 periodCredits\n if (_jobPeriodCredits[_job] > 0) {\n // Removes a % correspondant to a full rewardPeriodTime for the liquidity withdrawn vs all of the liquidities\n _jobLiquidityCredits[_job] -= (_jobLiquidityCredits[_job] * _periodCreditsToRemove) / _jobPeriodCredits[_job];\n _jobPeriodCredits[_job] -= _periodCreditsToRemove;\n }\n\n liquidityAmount[_job][_liquidity] -= _amount;\n if (liquidityAmount[_job][_liquidity] == 0) {\n _jobLiquidities[_job].remove(_liquidity);\n }\n }\n\n /// @notice Returns a fraction of the multiplier or the whole multiplier if equal or more than a rewardPeriodTime has passed\n function _phase(uint256 _timePassed, uint256 _multiplier) internal view returns (uint256 _result) {\n if (_timePassed < rewardPeriodTime) {\n _result = (_timePassed * _multiplier) / rewardPeriodTime;\n } else _result = _multiplier;\n }\n\n /// @notice Returns the start of the period of the provided timestamp\n function _period(uint256 _timestamp) internal view returns (uint256 _periodTimestamp) {\n return _timestamp - (_timestamp % rewardPeriodTime);\n }\n\n /// @notice Calculates relation between rewardPeriod and inflationPeriod\n function _getReward(uint256 _baseAmount) internal view returns (uint256 _credits) {\n return FullMath.mulDiv(_baseAmount, rewardPeriodTime, inflationPeriod);\n }\n\n /// @notice Returns underlying KP3R amount for a given liquidity amount\n function _quoteLiquidity(uint256 _amount, address _liquidity) internal view returns (uint256 _quote) {\n if (_tick[_liquidity].period != 0) {\n int56 _tickDifference = _isKP3RToken0[_liquidity] ? _tick[_liquidity].difference : -_tick[_liquidity].difference;\n _quote = IKeep3rHelper(keep3rHelper).getKP3RsAtTick(_amount, _tickDifference, rewardPeriodTime);\n }\n }\n\n /// @notice Updates job credits to current quotes and rewards job's pending minted credits\n /// @dev Ensures a maximum of 1 period of credits\n function _settleJobAccountance(address _job) internal virtual {\n _updateJobCreditsIfNeeded(_job);\n _rewardJobCredits(_job);\n _jobLiquidityCredits[_job] = Math.min(_jobLiquidityCredits[_job], _jobPeriodCredits[_job]);\n }\n}\n" - }, - "solidity/contracts/peripherals/Keep3rParameters.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../../interfaces/IKeep3rHelper.sol';\nimport '../../interfaces/peripherals/IKeep3rParameters.sol';\nimport '../../interfaces/external/IKeep3rV1Proxy.sol';\nimport './Keep3rAccountance.sol';\n\nabstract contract Keep3rParameters is IKeep3rParameters, Keep3rAccountance {\n /// @inheritdoc IKeep3rParameters\n address public override keep3rV1;\n\n /// @inheritdoc IKeep3rParameters\n address public override keep3rV1Proxy;\n\n /// @inheritdoc IKeep3rParameters\n address public override keep3rHelper;\n\n /// @inheritdoc IKeep3rParameters\n uint256 public override bondTime = 3 days;\n\n /// @inheritdoc IKeep3rParameters\n uint256 public override unbondTime = 14 days;\n\n /// @inheritdoc IKeep3rParameters\n uint256 public override liquidityMinimum = 3 ether;\n\n /// @inheritdoc IKeep3rParameters\n uint256 public override rewardPeriodTime = 5 days;\n\n /// @inheritdoc IKeep3rParameters\n uint256 public override inflationPeriod = 34 days;\n\n /// @inheritdoc IKeep3rParameters\n uint256 public override fee = 30;\n\n /// @notice The base that will be used to calculate the fee\n uint256 internal constant _BASE = 10_000;\n\n /// @notice The minimum reward period\n uint256 internal constant _MIN_REWARD_PERIOD_TIME = 1 days;\n\n constructor(\n address _keep3rHelper,\n address _keep3rV1,\n address _keep3rV1Proxy\n ) {\n keep3rHelper = _keep3rHelper;\n keep3rV1 = _keep3rV1;\n keep3rV1Proxy = _keep3rV1Proxy;\n }\n\n /// @inheritdoc IKeep3rParameters\n function setKeep3rHelper(address _keep3rHelper) external override onlyGovernance {\n if (_keep3rHelper == address(0)) revert ZeroAddress();\n keep3rHelper = _keep3rHelper;\n emit Keep3rHelperChange(_keep3rHelper);\n }\n\n /// @inheritdoc IKeep3rParameters\n function setKeep3rV1(address _keep3rV1) public virtual override onlyGovernance {\n if (_keep3rV1 == address(0)) revert ZeroAddress();\n _mint(totalBonds);\n\n keep3rV1 = _keep3rV1;\n emit Keep3rV1Change(_keep3rV1);\n }\n\n /// @inheritdoc IKeep3rParameters\n function setKeep3rV1Proxy(address _keep3rV1Proxy) external override onlyGovernance {\n if (_keep3rV1Proxy == address(0)) revert ZeroAddress();\n keep3rV1Proxy = _keep3rV1Proxy;\n emit Keep3rV1ProxyChange(_keep3rV1Proxy);\n }\n\n /// @inheritdoc IKeep3rParameters\n function setBondTime(uint256 _bondTime) external override onlyGovernance {\n bondTime = _bondTime;\n emit BondTimeChange(_bondTime);\n }\n\n /// @inheritdoc IKeep3rParameters\n function setUnbondTime(uint256 _unbondTime) external override onlyGovernance {\n unbondTime = _unbondTime;\n emit UnbondTimeChange(_unbondTime);\n }\n\n /// @inheritdoc IKeep3rParameters\n function setLiquidityMinimum(uint256 _liquidityMinimum) external override onlyGovernance {\n liquidityMinimum = _liquidityMinimum;\n emit LiquidityMinimumChange(_liquidityMinimum);\n }\n\n /// @inheritdoc IKeep3rParameters\n function setRewardPeriodTime(uint256 _rewardPeriodTime) external override onlyGovernance {\n if (_rewardPeriodTime < _MIN_REWARD_PERIOD_TIME) revert MinRewardPeriod();\n rewardPeriodTime = _rewardPeriodTime;\n emit RewardPeriodTimeChange(_rewardPeriodTime);\n }\n\n /// @inheritdoc IKeep3rParameters\n function setInflationPeriod(uint256 _inflationPeriod) external override onlyGovernance {\n inflationPeriod = _inflationPeriod;\n emit InflationPeriodChange(_inflationPeriod);\n }\n\n /// @inheritdoc IKeep3rParameters\n function setFee(uint256 _fee) external override onlyGovernance {\n fee = _fee;\n emit FeeChange(_fee);\n }\n\n function _mint(uint256 _amount) internal {\n totalBonds -= _amount;\n IKeep3rV1Proxy(keep3rV1Proxy).mint(_amount);\n }\n}\n" - }, - "@openzeppelin/contracts/security/ReentrancyGuard.sol": { - "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Contract module that helps prevent reentrant calls to a function.\n *\n * Inheriting from `ReentrancyGuard` will make the {nonReentrant} modifier\n * available, which can be applied to functions to make sure there are no nested\n * (reentrant) calls to them.\n *\n * Note that because there is a single `nonReentrant` guard, functions marked as\n * `nonReentrant` may not call one another. This can be worked around by making\n * those functions `private`, and then adding `external` `nonReentrant` entry\n * points to them.\n *\n * TIP: If you would like to learn more about reentrancy and alternative ways\n * to protect against it, check out our blog post\n * https://blog.openzeppelin.com/reentrancy-after-istanbul/[Reentrancy After Istanbul].\n */\nabstract contract ReentrancyGuard {\n // Booleans are more expensive than uint256 or any type that takes up a full\n // word because each write operation emits an extra SLOAD to first read the\n // slot's contents, replace the bits taken up by the boolean, and then write\n // back. This is the compiler's defense against contract upgrades and\n // pointer aliasing, and it cannot be disabled.\n\n // The values being non-zero value makes deployment a bit more expensive,\n // but in exchange the refund on every call to nonReentrant will be lower in\n // amount. Since refunds are capped to a percentage of the total\n // transaction's gas, it is best to keep them low in cases like this one, to\n // increase the likelihood of the full refund coming into effect.\n uint256 private constant _NOT_ENTERED = 1;\n uint256 private constant _ENTERED = 2;\n\n uint256 private _status;\n\n constructor() {\n _status = _NOT_ENTERED;\n }\n\n /**\n * @dev Prevents a contract from calling itself, directly or indirectly.\n * Calling a `nonReentrant` function from another `nonReentrant`\n * function is not supported. It is possible to prevent this from happening\n * by making the `nonReentrant` function external, and make it call a\n * `private` function that does the actual work.\n */\n modifier nonReentrant() {\n // On the first call to nonReentrant, _notEntered will be true\n require(_status != _ENTERED, \"ReentrancyGuard: reentrant call\");\n\n // Any calls to nonReentrant after this point will fail\n _status = _ENTERED;\n\n _;\n\n // By storing the original value once again, a refund is triggered (see\n // https://eips.ethereum.org/EIPS/eip-2200)\n _status = _NOT_ENTERED;\n }\n}\n" - }, - "@openzeppelin/contracts/utils/math/Math.sol": { - "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Standard math utilities missing in the Solidity language.\n */\nlibrary Math {\n /**\n * @dev Returns the largest of two numbers.\n */\n function max(uint256 a, uint256 b) internal pure returns (uint256) {\n return a >= b ? a : b;\n }\n\n /**\n * @dev Returns the smallest of two numbers.\n */\n function min(uint256 a, uint256 b) internal pure returns (uint256) {\n return a < b ? a : b;\n }\n\n /**\n * @dev Returns the average of two numbers. The result is rounded towards\n * zero.\n */\n function average(uint256 a, uint256 b) internal pure returns (uint256) {\n // (a + b) / 2 can overflow.\n return (a & b) + (a ^ b) / 2;\n }\n\n /**\n * @dev Returns the ceiling of the division of two numbers.\n *\n * This differs from standard division with `/` in that it rounds up instead\n * of rounding down.\n */\n function ceilDiv(uint256 a, uint256 b) internal pure returns (uint256) {\n // (a + b - 1) / b can overflow on addition, so we distribute.\n return a / b + (a % b == 0 ? 0 : 1);\n }\n}\n" - }, - "solidity/interfaces/external/IKeep3rV1Proxy.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../peripherals/IGovernable.sol';\n\ninterface IKeep3rV1Proxy is IGovernable {\n // Structs\n struct Recipient {\n address recipient;\n uint256 caps;\n }\n\n // Variables\n function keep3rV1() external view returns (address);\n\n function minter() external view returns (address);\n\n function next(address) external view returns (uint256);\n\n function caps(address) external view returns (uint256);\n\n function recipients() external view returns (address[] memory);\n\n function recipientsCaps() external view returns (Recipient[] memory);\n\n // Errors\n error Cooldown();\n error NoDrawableAmount();\n error ZeroAddress();\n error OnlyMinter();\n\n // Methods\n function addRecipient(address recipient, uint256 amount) external;\n\n function removeRecipient(address recipient) external;\n\n function draw() external returns (uint256 _amount);\n\n function setKeep3rV1(address _keep3rV1) external;\n\n function setMinter(address _minter) external;\n\n function mint(uint256 _amount) external;\n\n function mint(address _account, uint256 _amount) external;\n\n function setKeep3rV1Governance(address _governance) external;\n\n function acceptKeep3rV1Governance() external;\n\n function dispute(address _keeper) external;\n\n function slash(\n address _bonded,\n address _keeper,\n uint256 _amount\n ) external;\n\n function revoke(address _keeper) external;\n\n function resolve(address _keeper) external;\n\n function addJob(address _job) external;\n\n function removeJob(address _job) external;\n\n function addKPRCredit(address _job, uint256 _amount) external;\n\n function approveLiquidity(address _liquidity) external;\n\n function revokeLiquidity(address _liquidity) external;\n\n function setKeep3rHelper(address _keep3rHelper) external;\n\n function addVotes(address _voter, uint256 _amount) external;\n\n function removeVotes(address _voter, uint256 _amount) external;\n}\n" - }, - "solidity/interfaces/IKeep3rHelperParameters.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\n/// @title Keep3rHelperParameters contract\n/// @notice Contains all the helper functions used throughout the different files.\ninterface IKeep3rHelperParameters {\n // Structs\n\n /// @dev KP3R-WETH Pool address and isKP3RToken0\n /// @dev Created in order to save gas by avoiding calls to pool's token0 method\n struct TokenOraclePool {\n address poolAddress;\n bool isTKNToken0;\n }\n\n // Errors\n\n /// @notice Throws when pool does not have KP3R as token0 nor token1\n error InvalidOraclePool();\n\n // Events\n\n /// @notice Emitted when the kp3r weth pool is changed\n /// @param _address Address of the new kp3r weth pool\n /// @param _isKP3RToken0 True if calling the token0 method of the pool returns the KP3R token address\n event Kp3rWethPoolChange(address _address, bool _isKP3RToken0);\n\n /// @notice Emitted when the minimum boost multiplier is changed\n /// @param _minBoost The minimum boost multiplier\n event MinBoostChange(uint256 _minBoost);\n\n /// @notice Emitted when the maximum boost multiplier is changed\n /// @param _maxBoost The maximum boost multiplier\n event MaxBoostChange(uint256 _maxBoost);\n\n /// @notice Emitted when the target bond amount is changed\n /// @param _targetBond The target bond amount\n event TargetBondChange(uint256 _targetBond);\n\n /// @notice Emitted when the Keep3r V2 address is changed\n /// @param _keep3rV2 The address of Keep3r V2\n event Keep3rV2Change(address _keep3rV2);\n\n /// @notice Emitted when the work extra gas amount is changed\n /// @param _workExtraGas The work extra gas\n event WorkExtraGasChange(uint256 _workExtraGas);\n\n /// @notice Emitted when the quote twap time is changed\n /// @param _quoteTwapTime The twap time for quoting\n event QuoteTwapTimeChange(uint32 _quoteTwapTime);\n\n /// @notice Emitted when minimum rewarded gas fee is changed\n /// @param _minBaseFee The minimum rewarded gas fee\n event MinBaseFeeChange(uint256 _minBaseFee);\n\n /// @notice Emitted when minimum rewarded priority fee is changed\n /// @param _minPriorityFee The minimum expected fee that the keeper should pay\n event MinPriorityFeeChange(uint256 _minPriorityFee);\n\n // Variables\n\n /// @notice Address of KP3R token\n /// @return _kp3r Address of KP3R token\n // solhint-disable func-name-mixedcase\n function KP3R() external view returns (address _kp3r);\n\n /// @notice The boost base used to calculate the boost rewards for the keeper\n /// @return _base The boost base number\n function BOOST_BASE() external view returns (uint256 _base);\n\n /// @notice KP3R-WETH pool that is being used as oracle\n /// @return poolAddress Address of the pool\n /// @return isTKNToken0 True if calling the token0 method of the pool returns the KP3R token address\n function kp3rWethPool() external view returns (address poolAddress, bool isTKNToken0);\n\n /// @notice The minimum multiplier used to calculate the amount of gas paid to the Keeper for the gas used to perform a job\n /// For example: if the quoted gas used is 1000, then the minimum amount to be paid will be 1000 * minBoost / BOOST_BASE\n /// @return _multiplier The minimum boost multiplier\n function minBoost() external view returns (uint256 _multiplier);\n\n /// @notice The maximum multiplier used to calculate the amount of gas paid to the Keeper for the gas used to perform a job\n /// For example: if the quoted gas used is 1000, then the maximum amount to be paid will be 1000 * maxBoost / BOOST_BASE\n /// @return _multiplier The maximum boost multiplier\n function maxBoost() external view returns (uint256 _multiplier);\n\n /// @notice The targeted amount of bonded KP3Rs to max-up reward multiplier\n /// For example: if the amount of KP3R the keeper has bonded is targetBond or more, then the keeper will get\n /// the maximum boost possible in his rewards, if it's less, the reward boost will be proportional\n /// @return _target The amount of KP3R that comforms the targetBond\n function targetBond() external view returns (uint256 _target);\n\n /// @notice The amount of unaccounted gas that is going to be added to keeper payments\n /// @return _workExtraGas The work unaccounted gas amount\n function workExtraGas() external view returns (uint256 _workExtraGas);\n\n /// @notice The twap time for quoting\n /// @return _quoteTwapTime The twap time\n function quoteTwapTime() external view returns (uint32 _quoteTwapTime);\n\n /// @notice The minimum base fee that is used to calculate keeper rewards\n /// @return _minBaseFee The minimum rewarded gas fee\n function minBaseFee() external view returns (uint256 _minBaseFee);\n\n /// @notice The minimum priority fee that is also rewarded for keepers\n /// @return _minPriorityFee The minimum rewarded priority fee\n function minPriorityFee() external view returns (uint256 _minPriorityFee);\n\n /// @notice Address of Keep3r V2\n /// @return _keep3rV2 Address of Keep3r V2\n function keep3rV2() external view returns (address _keep3rV2);\n\n // Methods\n\n /// @notice Sets KP3R-WETH pool\n /// @param _poolAddress The address of the KP3R-WETH pool\n function setKp3rWethPool(address _poolAddress) external;\n\n /// @notice Sets the minimum boost multiplier\n /// @param _minBoost The minimum boost multiplier\n function setMinBoost(uint256 _minBoost) external;\n\n /// @notice Sets the maximum boost multiplier\n /// @param _maxBoost The maximum boost multiplier\n function setMaxBoost(uint256 _maxBoost) external;\n\n /// @notice Sets the target bond amount\n /// @param _targetBond The target bond amount\n function setTargetBond(uint256 _targetBond) external;\n\n /// @notice Sets the Keep3r V2 address\n /// @param _keep3rV2 The address of Keep3r V2\n function setKeep3rV2(address _keep3rV2) external;\n\n /// @notice Sets the work extra gas amount\n /// @param _workExtraGas The work extra gas\n function setWorkExtraGas(uint256 _workExtraGas) external;\n\n /// @notice Sets the quote twap time\n /// @param _quoteTwapTime The twap time for quoting\n function setQuoteTwapTime(uint32 _quoteTwapTime) external;\n\n /// @notice Sets the minimum rewarded gas fee\n /// @param _minBaseFee The minimum rewarded gas fee\n function setMinBaseFee(uint256 _minBaseFee) external;\n\n /// @notice Sets the minimum rewarded gas priority fee\n /// @param _minPriorityFee The minimum rewarded priority fee\n function setMinPriorityFee(uint256 _minPriorityFee) external;\n}\n" - }, - "solidity/interfaces/IPairManager.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol';\n\n/// @title Pair Manager interface\n/// @notice Generic interface for Keep3r liquidity pools (kLP)\ninterface IPairManager is IERC20Metadata {\n /// @notice Address of the factory from which the pair manager was created\n /// @return _factory The address of the PairManager Factory\n function factory() external view returns (address _factory);\n\n /// @notice Address of the pool from which the Keep3r pair manager will interact with\n /// @return _pool The address of the pool\n function pool() external view returns (address _pool);\n\n /// @notice Token0 of the pool\n /// @return _token0 The address of token0\n function token0() external view returns (address _token0);\n\n /// @notice Token1 of the pool\n /// @return _token1 The address of token1\n function token1() external view returns (address _token1);\n}\n" - }, - "solidity/contracts/libraries/FullMath.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\n/// @title Contains 512-bit math functions\n/// @notice Facilitates multiplication and division that can have overflow of an intermediate value without any loss of precision\n/// @dev Handles \"phantom overflow\" i.e., allows multiplication and division where an intermediate value overflows 256 bits\nlibrary FullMath {\n /// @notice Calculates floor(a×b÷denominator) with full precision. Throws if result overflows a uint256 or denominator == 0\n /// @param a The multiplicand\n /// @param b The multiplier\n /// @param denominator The divisor\n /// @return result The 256-bit result\n /// @dev Credit to Remco Bloemen under MIT license https://xn--2-umb.com/21/muldiv\n function mulDiv(\n uint256 a,\n uint256 b,\n uint256 denominator\n ) internal pure returns (uint256 result) {\n unchecked {\n // 512-bit multiply [prod1 prod0] = a * b\n // Compute the product mod 2**256 and mod 2**256 - 1\n // then use the Chinese Remainder Theorem to reconstruct\n // the 512 bit result. The result is stored in two 256\n // variables such that product = prod1 * 2**256 + prod0\n uint256 prod0; // Least significant 256 bits of the product\n uint256 prod1; // Most significant 256 bits of the product\n assembly {\n let mm := mulmod(a, b, not(0))\n prod0 := mul(a, b)\n prod1 := sub(sub(mm, prod0), lt(mm, prod0))\n }\n\n // Handle non-overflow cases, 256 by 256 division\n if (prod1 == 0) {\n require(denominator > 0);\n assembly {\n result := div(prod0, denominator)\n }\n return result;\n }\n\n // Make sure the result is less than 2**256.\n // Also prevents denominator == 0\n require(denominator > prod1);\n\n ///////////////////////////////////////////////\n // 512 by 256 division.\n ///////////////////////////////////////////////\n\n // Make division exact by subtracting the remainder from [prod1 prod0]\n // Compute remainder using mulmod\n uint256 remainder;\n assembly {\n remainder := mulmod(a, b, denominator)\n }\n // Subtract 256 bit number from 512 bit number\n assembly {\n prod1 := sub(prod1, gt(remainder, prod0))\n prod0 := sub(prod0, remainder)\n }\n\n // Factor powers of two out of denominator\n // Compute largest power of two divisor of denominator.\n // Always >= 1.\n uint256 twos = (~denominator + 1) & denominator;\n // Divide denominator by power of two\n assembly {\n denominator := div(denominator, twos)\n }\n\n // Divide [prod1 prod0] by the factors of two\n assembly {\n prod0 := div(prod0, twos)\n }\n // Shift in bits from prod1 into prod0. For this we need\n // to flip `twos` such that it is 2**256 / twos.\n // If twos is zero, then it becomes one\n assembly {\n twos := add(div(sub(0, twos), twos), 1)\n }\n prod0 |= prod1 * twos;\n\n // Invert denominator mod 2**256\n // Now that denominator is an odd number, it has an inverse\n // modulo 2**256 such that denominator * inv = 1 mod 2**256.\n // Compute the inverse by starting with a seed that is correct\n // correct for four bits. That is, denominator * inv = 1 mod 2**4\n uint256 inv = (3 * denominator) ^ 2;\n // Now use Newton-Raphson iteration to improve the precision.\n // Thanks to Hensel's lifting lemma, this also works in modular\n // arithmetic, doubling the correct bits in each step.\n inv *= 2 - denominator * inv; // inverse mod 2**8\n inv *= 2 - denominator * inv; // inverse mod 2**16\n inv *= 2 - denominator * inv; // inverse mod 2**32\n inv *= 2 - denominator * inv; // inverse mod 2**64\n inv *= 2 - denominator * inv; // inverse mod 2**128\n inv *= 2 - denominator * inv; // inverse mod 2**256\n\n // Because the division is now exact we can divide by multiplying\n // with the modular inverse of denominator. This will give us the\n // correct result modulo 2**256. Since the precoditions guarantee\n // that the outcome is less than 2**256, this is the final result.\n // We don't need to compute the high bits of the result and prod1\n // is no longer required.\n result = prod0 * inv;\n return result;\n }\n }\n\n /// @notice Calculates ceil(a×b÷denominator) with full precision. Throws if result overflows a uint256 or denominator == 0\n /// @param a The multiplicand\n /// @param b The multiplier\n /// @param denominator The divisor\n /// @return result The 256-bit result\n function mulDivRoundingUp(\n uint256 a,\n uint256 b,\n uint256 denominator\n ) internal pure returns (uint256 result) {\n unchecked {\n result = mulDiv(a, b, denominator);\n if (mulmod(a, b, denominator) > 0) {\n require(result < type(uint256).max);\n result++;\n }\n }\n }\n}\n" - }, - "@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol": { - "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\nimport \"../IERC20.sol\";\n\n/**\n * @dev Interface for the optional metadata functions from the ERC20 standard.\n *\n * _Available since v4.1._\n */\ninterface IERC20Metadata is IERC20 {\n /**\n * @dev Returns the name of the token.\n */\n function name() external view returns (string memory);\n\n /**\n * @dev Returns the symbol of the token.\n */\n function symbol() external view returns (string memory);\n\n /**\n * @dev Returns the decimals places of the token.\n */\n function decimals() external view returns (uint8);\n}\n" - }, - "solidity/contracts/peripherals/Keep3rDisputable.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport './Keep3rParameters.sol';\nimport '../../interfaces/peripherals/IKeep3rDisputable.sol';\n\nabstract contract Keep3rDisputable is IKeep3rDisputable, Keep3rParameters {\n /// @inheritdoc IKeep3rDisputable\n function dispute(address _jobOrKeeper) external override onlyDisputer {\n if (disputes[_jobOrKeeper]) revert AlreadyDisputed();\n disputes[_jobOrKeeper] = true;\n emit Dispute(_jobOrKeeper, msg.sender);\n }\n\n /// @inheritdoc IKeep3rDisputable\n function resolve(address _jobOrKeeper) external override onlyDisputer {\n if (!disputes[_jobOrKeeper]) revert NotDisputed();\n disputes[_jobOrKeeper] = false;\n emit Resolve(_jobOrKeeper, msg.sender);\n }\n}\n" - }, - "solidity/contracts/peripherals/keepers/Keep3rKeeperDisputable.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport './Keep3rKeeperFundable.sol';\nimport '../Keep3rDisputable.sol';\nimport '../../../interfaces/external/IKeep3rV1.sol';\nimport '../../../interfaces/peripherals/IKeep3rKeepers.sol';\n\nabstract contract Keep3rKeeperDisputable is IKeep3rKeeperDisputable, Keep3rDisputable, Keep3rKeeperFundable {\n using EnumerableSet for EnumerableSet.AddressSet;\n using SafeERC20 for IERC20;\n\n /// @inheritdoc IKeep3rKeeperDisputable\n function slash(\n address _keeper,\n address _bonded,\n uint256 _bondAmount,\n uint256 _unbondAmount\n ) external override onlySlasher {\n if (!disputes[_keeper]) revert NotDisputed();\n _slash(_keeper, _bonded, _bondAmount, _unbondAmount);\n emit KeeperSlash(_keeper, msg.sender, _bondAmount + _unbondAmount);\n }\n\n /// @inheritdoc IKeep3rKeeperDisputable\n function revoke(address _keeper) external override onlySlasher {\n if (!disputes[_keeper]) revert NotDisputed();\n _keepers.remove(_keeper);\n _slash(_keeper, keep3rV1, bonds[_keeper][keep3rV1], pendingUnbonds[_keeper][keep3rV1]);\n emit KeeperRevoke(_keeper, msg.sender);\n }\n\n function _slash(\n address _keeper,\n address _bonded,\n uint256 _bondAmount,\n uint256 _unbondAmount\n ) internal {\n if (_bonded != keep3rV1) {\n try IERC20(_bonded).transfer(governance, _bondAmount + _unbondAmount) returns (bool) {} catch (bytes memory) {}\n }\n bonds[_keeper][_bonded] -= _bondAmount;\n pendingUnbonds[_keeper][_bonded] -= _unbondAmount;\n }\n}\n" - }, - "solidity/contracts/peripherals/keepers/Keep3rKeeperFundable.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../Keep3rAccountance.sol';\nimport '../Keep3rParameters.sol';\nimport '../../../interfaces/peripherals/IKeep3rKeepers.sol';\n\nimport '../../../interfaces/external/IKeep3rV1.sol';\n\nimport '@openzeppelin/contracts/security/ReentrancyGuard.sol';\nimport '@openzeppelin/contracts/token/ERC20/IERC20.sol';\nimport '@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol';\n\nabstract contract Keep3rKeeperFundable is IKeep3rKeeperFundable, ReentrancyGuard, Keep3rParameters {\n using EnumerableSet for EnumerableSet.AddressSet;\n using SafeERC20 for IERC20;\n\n /// @inheritdoc IKeep3rKeeperFundable\n function bond(address _bonding, uint256 _amount) external override nonReentrant {\n if (disputes[msg.sender]) revert Disputed();\n if (_jobs.contains(msg.sender)) revert AlreadyAJob();\n canActivateAfter[msg.sender][_bonding] = block.timestamp + bondTime;\n\n uint256 _before = IERC20(_bonding).balanceOf(address(this));\n IERC20(_bonding).safeTransferFrom(msg.sender, address(this), _amount);\n _amount = IERC20(_bonding).balanceOf(address(this)) - _before;\n\n hasBonded[msg.sender] = true;\n pendingBonds[msg.sender][_bonding] += _amount;\n\n emit Bonding(msg.sender, _bonding, _amount);\n }\n\n /// @inheritdoc IKeep3rKeeperFundable\n function activate(address _bonding) external override {\n address _keeper = msg.sender;\n if (disputes[_keeper]) revert Disputed();\n uint256 _canActivateAfter = canActivateAfter[_keeper][_bonding];\n if (_canActivateAfter == 0) revert BondsUnexistent();\n if (_canActivateAfter >= block.timestamp) revert BondsLocked();\n\n if (firstSeen[_keeper] == 0) {\n firstSeen[_keeper] = block.timestamp;\n }\n _keepers.add(_keeper);\n\n uint256 _amount = pendingBonds[_keeper][_bonding];\n delete pendingBonds[_keeper][_bonding];\n\n // bond provided tokens\n bonds[_keeper][_bonding] += _amount;\n if (_bonding == keep3rV1) {\n totalBonds += _amount;\n _depositBonds(_amount);\n }\n\n emit Activation(_keeper, _bonding, _amount);\n }\n\n /// @inheritdoc IKeep3rKeeperFundable\n function unbond(address _bonding, uint256 _amount) external override {\n canWithdrawAfter[msg.sender][_bonding] = block.timestamp + unbondTime;\n bonds[msg.sender][_bonding] -= _amount;\n pendingUnbonds[msg.sender][_bonding] += _amount;\n\n emit Unbonding(msg.sender, _bonding, _amount);\n }\n\n /// @inheritdoc IKeep3rKeeperFundable\n function withdraw(address _bonding) external override nonReentrant {\n if (pendingUnbonds[msg.sender][_bonding] == 0) revert UnbondsUnexistent();\n if (canWithdrawAfter[msg.sender][_bonding] >= block.timestamp) revert UnbondsLocked();\n if (disputes[msg.sender]) revert Disputed();\n\n uint256 _amount = pendingUnbonds[msg.sender][_bonding];\n\n delete pendingUnbonds[msg.sender][_bonding];\n delete canWithdrawAfter[msg.sender][_bonding];\n\n if (_bonding == keep3rV1) _mint(_amount);\n IERC20(_bonding).safeTransfer(msg.sender, _amount);\n\n emit Withdrawal(msg.sender, _bonding, _amount);\n }\n\n function _depositBonds(uint256 _amount) internal virtual {\n IKeep3rV1(keep3rV1).burn(_amount);\n }\n}\n" - }, - "solidity/interfaces/external/IKeep3rV1.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '@openzeppelin/contracts/token/ERC20/IERC20.sol';\nimport '@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol';\n\n// solhint-disable func-name-mixedcase\ninterface IKeep3rV1 is IERC20, IERC20Metadata {\n // Structs\n struct Checkpoint {\n uint32 fromBlock;\n uint256 votes;\n }\n\n // Events\n event DelegateChanged(address indexed _delegator, address indexed _fromDelegate, address indexed _toDelegate);\n event DelegateVotesChanged(address indexed _delegate, uint256 _previousBalance, uint256 _newBalance);\n event SubmitJob(address indexed _job, address indexed _liquidity, address indexed _provider, uint256 _block, uint256 _credit);\n event ApplyCredit(address indexed _job, address indexed _liquidity, address indexed _provider, uint256 _block, uint256 _credit);\n event RemoveJob(address indexed _job, address indexed _liquidity, address indexed _provider, uint256 _block, uint256 _credit);\n event UnbondJob(address indexed _job, address indexed _liquidity, address indexed _provider, uint256 _block, uint256 _credit);\n event JobAdded(address indexed _job, uint256 _block, address _governance);\n event JobRemoved(address indexed _job, uint256 _block, address _governance);\n event KeeperWorked(address indexed _credit, address indexed _job, address indexed _keeper, uint256 _block, uint256 _amount);\n event KeeperBonding(address indexed _keeper, uint256 _block, uint256 _active, uint256 _bond);\n event KeeperBonded(address indexed _keeper, uint256 _block, uint256 _activated, uint256 _bond);\n event KeeperUnbonding(address indexed _keeper, uint256 _block, uint256 _deactive, uint256 _bond);\n event KeeperUnbound(address indexed _keeper, uint256 _block, uint256 _deactivated, uint256 _bond);\n event KeeperSlashed(address indexed _keeper, address indexed _slasher, uint256 _block, uint256 _slash);\n event KeeperDispute(address indexed _keeper, uint256 _block);\n event KeeperResolved(address indexed _keeper, uint256 _block);\n event TokenCreditAddition(address indexed _credit, address indexed _job, address indexed _creditor, uint256 _block, uint256 _amount);\n\n // Variables\n function KPRH() external returns (address);\n\n function delegates(address _delegator) external view returns (address);\n\n function checkpoints(address _account, uint32 _checkpoint) external view returns (Checkpoint memory);\n\n function numCheckpoints(address _account) external view returns (uint32);\n\n function DOMAIN_TYPEHASH() external returns (bytes32);\n\n function DOMAINSEPARATOR() external returns (bytes32);\n\n function DELEGATION_TYPEHASH() external returns (bytes32);\n\n function PERMIT_TYPEHASH() external returns (bytes32);\n\n function nonces(address _user) external view returns (uint256);\n\n function BOND() external returns (uint256);\n\n function UNBOND() external returns (uint256);\n\n function LIQUIDITYBOND() external returns (uint256);\n\n function FEE() external returns (uint256);\n\n function BASE() external returns (uint256);\n\n function ETH() external returns (address);\n\n function bondings(address _user, address _bonding) external view returns (uint256);\n\n function canWithdrawAfter(address _user, address _bonding) external view returns (uint256);\n\n function pendingUnbonds(address _keeper, address _bonding) external view returns (uint256);\n\n function pendingbonds(address _keeper, address _bonding) external view returns (uint256);\n\n function bonds(address _keeper, address _bonding) external view returns (uint256);\n\n function votes(address _delegator) external view returns (uint256);\n\n function firstSeen(address _keeper) external view returns (uint256);\n\n function disputes(address _keeper) external view returns (bool);\n\n function lastJob(address _keeper) external view returns (uint256);\n\n function workCompleted(address _keeper) external view returns (uint256);\n\n function jobs(address _job) external view returns (bool);\n\n function credits(address _job, address _credit) external view returns (uint256);\n\n function liquidityProvided(\n address _provider,\n address _liquidity,\n address _job\n ) external view returns (uint256);\n\n function liquidityUnbonding(\n address _provider,\n address _liquidity,\n address _job\n ) external view returns (uint256);\n\n function liquidityAmountsUnbonding(\n address _provider,\n address _liquidity,\n address _job\n ) external view returns (uint256);\n\n function jobProposalDelay(address _job) external view returns (uint256);\n\n function liquidityApplied(\n address _provider,\n address _liquidity,\n address _job\n ) external view returns (uint256);\n\n function liquidityAmount(\n address _provider,\n address _liquidity,\n address _job\n ) external view returns (uint256);\n\n function keepers(address _keeper) external view returns (bool);\n\n function blacklist(address _keeper) external view returns (bool);\n\n function keeperList(uint256 _index) external view returns (address);\n\n function jobList(uint256 _index) external view returns (address);\n\n function governance() external returns (address);\n\n function pendingGovernance() external returns (address);\n\n function liquidityAccepted(address _liquidity) external view returns (bool);\n\n function liquidityPairs(uint256 _index) external view returns (address);\n\n // Methods\n function getCurrentVotes(address _account) external view returns (uint256);\n\n function addCreditETH(address _job) external payable;\n\n function addCredit(\n address _credit,\n address _job,\n uint256 _amount\n ) external;\n\n function addVotes(address _voter, uint256 _amount) external;\n\n function removeVotes(address _voter, uint256 _amount) external;\n\n function addKPRCredit(address _job, uint256 _amount) external;\n\n function approveLiquidity(address _liquidity) external;\n\n function revokeLiquidity(address _liquidity) external;\n\n function pairs() external view returns (address[] memory);\n\n function addLiquidityToJob(\n address _liquidity,\n address _job,\n uint256 _amount\n ) external;\n\n function applyCreditToJob(\n address _provider,\n address _liquidity,\n address _job\n ) external;\n\n function unbondLiquidityFromJob(\n address _liquidity,\n address _job,\n uint256 _amount\n ) external;\n\n function removeLiquidityFromJob(address _liquidity, address _job) external;\n\n function mint(uint256 _amount) external;\n\n function burn(uint256 _amount) external;\n\n function worked(address _keeper) external;\n\n function receipt(\n address _credit,\n address _keeper,\n uint256 _amount\n ) external;\n\n function receiptETH(address _keeper, uint256 _amount) external;\n\n function addJob(address _job) external;\n\n function getJobs() external view returns (address[] memory);\n\n function removeJob(address _job) external;\n\n function setKeep3rHelper(address _keep3rHelper) external;\n\n function setGovernance(address _governance) external;\n\n function acceptGovernance() external;\n\n function isKeeper(address _keeper) external returns (bool);\n\n function isMinKeeper(\n address _keeper,\n uint256 _minBond,\n uint256 _earned,\n uint256 _age\n ) external returns (bool);\n\n function isBondedKeeper(\n address _keeper,\n address _bond,\n uint256 _minBond,\n uint256 _earned,\n uint256 _age\n ) external returns (bool);\n\n function bond(address _bonding, uint256 _amount) external;\n\n function getKeepers() external view returns (address[] memory);\n\n function activate(address _bonding) external;\n\n function unbond(address _bonding, uint256 _amount) external;\n\n function slash(\n address _bonded,\n address _keeper,\n uint256 _amount\n ) external;\n\n function withdraw(address _bonding) external;\n\n function dispute(address _keeper) external;\n\n function revoke(address _keeper) external;\n\n function resolve(address _keeper) external;\n\n function permit(\n address _owner,\n address _spender,\n uint256 _amount,\n uint256 _deadline,\n uint8 _v,\n bytes32 _r,\n bytes32 _s\n ) external;\n}\n" - }, - "solidity/for-test/testnet/Keep3rForTestnet.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../../contracts/Keep3r.sol';\n\ncontract Keep3rForTestnet is Keep3r {\n constructor(\n address _governance,\n address _keep3rHelper,\n address _keep3rV1,\n address _keep3rV1Proxy\n ) Keep3r(_governance, _keep3rHelper, _keep3rV1, _keep3rV1Proxy) {\n bondTime = 0; // allows keepers to instantly register\n unbondTime = 0; // allows keepers & jobOwners to instantly withdraw funds\n liquidityMinimum = 1; // allows job providers to add low liquidity\n rewardPeriodTime = 1 days; // reduces twap calculation period\n inflationPeriod = 5 days; // increases credit minting\n }\n}\n" - }, - "solidity/for-test/Keep3rForTest.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../contracts/Keep3r.sol';\n\ncontract Keep3rForTest is Keep3r {\n constructor(\n address _governance,\n address _keep3rHelper,\n address _keep3rV1,\n address _keep3rV1Proxy\n ) Keep3r(_governance, _keep3rHelper, _keep3rV1, _keep3rV1Proxy) {}\n}\n" - }, - "solidity/contracts/sidechain/Keep3rSidechain.sol": { - "content": "// SPDX-License-Identifier: MIT\n\n/*\n\nCoded for The Keep3r Network with ♥ by\n\n██████╗░███████╗███████╗██╗░░░██╗░░░░░░░██╗░█████╗░███╗░░██╗██████╗░███████╗██████╗░██╗░░░░░░█████╗░███╗░░██╗██████╗░\n██╔══██╗██╔════╝██╔════╝██║░░░██║░░██╗░░██║██╔══██╗████╗░██║██╔══██╗██╔════╝██╔══██╗██║░░░░░██╔══██╗████╗░██║██╔══██╗\n██║░░██║█████╗░░█████╗░░██║░░░╚██╗████╗██╔╝██║░░██║██╔██╗██║██║░░██║█████╗░░██████╔╝██║░░░░░███████║██╔██╗██║██║░░██║\n██║░░██║██╔══╝░░██╔══╝░░██║░░░░████╔═████║░██║░░██║██║╚████║██║░░██║██╔══╝░░██╔══██╗██║░░░░░██╔══██║██║╚████║██║░░██║\n██████╔╝███████╗██║░░░░░██║░░░░╚██╔╝░╚██╔╝░╚█████╔╝██║░╚███║██████╔╝███████╗██║░░██║███████╗██║░░██║██║░╚███║██████╔╝\n╚═════╝░╚══════╝╚═╝░░░░░╚═╝░░░░░╚═╝░░░╚═╝░░░╚════╝░╚═╝░░╚══╝╚═════╝░╚══════╝╚═╝░░╚═╝╚══════╝╚═╝░░╚═╝╚═╝░░╚══╝╚═════╝░\n\nhttps://defi.sucks\n\n*/\n\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../Keep3r.sol';\nimport '../../interfaces/sidechain/IKeep3rEscrow.sol';\nimport '../../interfaces/sidechain/IKeep3rHelperSidechain.sol';\nimport '../../interfaces/sidechain/IKeep3rJobWorkableRated.sol';\nimport '../../interfaces/sidechain/IKeep3rSidechainAccountance.sol';\n\ncontract Keep3rSidechain is Keep3r, IKeep3rJobWorkableRated, IKeep3rSidechainAccountance {\n using EnumerableSet for EnumerableSet.AddressSet;\n\n /// @param _governance Address of governance\n /// @param _keep3rHelperSidechain Address of sidechain Keep3rHelper\n /// @param _wrappedKP3R Address of wrapped KP3R implementation\n /// @param _keep3rEscrow Address of sidechain Keep3rEscrow\n constructor(\n address _governance, // governance\n address _keep3rHelperSidechain, // helper\n address _wrappedKP3R, // keep3rV1\n address _keep3rEscrow // keep3rV1Proxy\n ) Keep3r(_governance, _keep3rHelperSidechain, _wrappedKP3R, _keep3rEscrow) {}\n\n // Keep3rSidechainAccountance\n\n /// @inheritdoc IKeep3rSidechainAccountance\n function virtualReserves() external view override returns (int256 _virtualReserves) {\n // Queries wKP3R balanceOf escrow contract minus the totalBonds\n return int256(IERC20(keep3rV1).balanceOf(keep3rV1Proxy)) - int256(totalBonds);\n }\n\n // Keep3rJobFundableLiquidity\n\n /// @notice Sidechain implementation asks the Helper for an oracle, instead of reading it from the ERC-20\n /// @dev Function should be called after setting an oracle in Keep3rHelperSidechain\n /// @param _liquidity Address of the liquidity token being approved\n function approveLiquidity(address _liquidity) external virtual override onlyGovernance {\n if (!_approvedLiquidities.add(_liquidity)) revert LiquidityPairApproved();\n _liquidityPool[_liquidity] = IKeep3rHelperSidechain(keep3rHelper).oracle(_liquidity);\n if (_liquidityPool[_liquidity] == address(0)) revert ZeroAddress();\n _isKP3RToken0[_liquidity] = IKeep3rHelper(keep3rHelper).isKP3RToken0(_liquidityPool[_liquidity]);\n _tick[_liquidity] = observeLiquidity(_liquidity);\n emit LiquidityApproval(_liquidity);\n }\n\n /// @notice Sidechain implementation will always ask for 2 tickCumulatives instead of cacheing\n /// @param _liquidity Address of the liquidity token being observed\n function observeLiquidity(address _liquidity) public view virtual override returns (TickCache memory _tickCache) {\n if (_tick[_liquidity].period == _period(block.timestamp)) {\n // Will return cached twaps if liquidity is updated\n _tickCache = _tick[_liquidity];\n } else {\n bool success;\n\n // Will always ask for 2 accumulators in sidechain\n uint32[] memory _secondsAgo = new uint32[](2);\n\n _secondsAgo[0] = uint32(block.timestamp - _period(block.timestamp));\n _secondsAgo[1] = uint32(block.timestamp - _period(block.timestamp) + rewardPeriodTime);\n\n int56 _tickCumulative2;\n (_tickCache.current, _tickCumulative2, success) = IKeep3rHelper(keep3rHelper).observe(_liquidityPool[_liquidity], _secondsAgo);\n\n _tickCache.difference = _tickCache.current - _tickCumulative2;\n\n if (success) {\n _tickCache.period = _period(block.timestamp);\n } else {\n delete _tickCache.period;\n }\n }\n }\n\n // Keep3rJobsWorkable\n\n /// @dev Sidechain implementation deprecates worked(address) as it should come with a usdPerGasUnit parameter\n function worked(address) external pure override {\n revert Deprecated();\n }\n\n /// @notice Implemented by jobs to show that a keeper performed work\n /// @dev Uses a USD per gas unit payment mechanism\n /// @param _keeper Address of the keeper that performed the work\n /// @param _usdPerGasUnit Units of USD (in wei) per gas unit that should be rewarded to the keeper\n function worked(address _keeper, uint256 _usdPerGasUnit) external override {\n if (_initialGas == 0) revert GasNotInitialized();\n // Gas used for quote calculations & payment is not rewarded\n uint256 _gasLeft = _getGasLeft();\n\n address _job = msg.sender;\n if (disputes[_job]) revert JobDisputed();\n if (!_jobs.contains(_job)) revert JobUnapproved();\n\n if (_updateJobCreditsIfNeeded(_job)) {\n emit LiquidityCreditsReward(_job, rewardedAt[_job], _jobLiquidityCredits[_job], _jobPeriodCredits[_job]);\n }\n\n (uint256 _boost, uint256 _oneUsdQuote, uint256 _extraGas) = IKeep3rHelper(keep3rHelper).getPaymentParams(bonds[_keeper][keep3rV1]);\n\n uint256 _kp3rPayment = _calculatePayment(_gasLeft, _extraGas, _oneUsdQuote * _usdPerGasUnit, _boost);\n\n if (_kp3rPayment > _jobLiquidityCredits[_job]) {\n _rewardJobCredits(_job);\n emit LiquidityCreditsReward(_job, rewardedAt[_job], _jobLiquidityCredits[_job], _jobPeriodCredits[_job]);\n }\n\n _bondedPayment(_job, _keeper, _kp3rPayment);\n delete _initialGas;\n\n emit KeeperWork(keep3rV1, _job, _keeper, _kp3rPayment, _gasLeft);\n }\n\n // Keep3rKeeperFundable\n\n /// @dev Sidechain implementation doesn't burn tokens, but deposit them in Keep3rEscrow\n function _depositBonds(uint256 _amount) internal virtual override {\n IKeep3rV1(keep3rV1).approve(keep3rV1Proxy, _amount);\n IKeep3rEscrow(keep3rV1Proxy).deposit(_amount);\n }\n}\n" - }, - "solidity/interfaces/sidechain/IKeep3rEscrow.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\n// solhint-disable-next-line no-empty-blocks\n\nimport '../peripherals/IMintable.sol';\n\n/// @title Keep3rEscrow contract\n/// @notice This contract acts as an escrow contract for wKP3R tokens on sidechains and L2s\n/// @dev Can be used as a replacement for keep3rV1Proxy in keep3r sidechain implementations\ninterface IKeep3rEscrow is IMintable {\n /// @notice Emitted when Keep3rEscrow#deposit function is called\n /// @param _wKP3R The addess of the wrapped KP3R token\n /// @param _sender The address that called the function\n /// @param _amount The amount of wKP3R the user deposited\n event wKP3RDeposited(address _wKP3R, address _sender, uint256 _amount);\n\n /// @notice Emitted when Keep3rEscrow#mint function is called\n /// @param _wKP3R The addess of the wrapped KP3R token\n /// @param _recipient The address that will received the newly minted wKP3R\n /// @param _amount The amount of wKP3R minted to the recipient\n event wKP3RMinted(address _wKP3R, address _recipient, uint256 _amount);\n\n /// @notice Emitted when Keep3rEscrow#setWKP3R function is called\n /// @param _newWKP3R The address of the wKP3R contract\n event wKP3RSet(address _newWKP3R);\n\n /// @notice Throws when minter attempts to withdraw more wKP3R than the escrow has in its balance\n error InsufficientBalance();\n\n /// @notice Lists the address of the wKP3R contract\n /// @return _wKP3RAddress The address of wKP3R\n function wKP3R() external view returns (address _wKP3RAddress);\n\n /// @notice Deposits wKP3R into the contract\n /// @param _amount The amount of wKP3R to deposit\n function deposit(uint256 _amount) external;\n\n /// @notice mints wKP3R to the recipient\n /// @param _amount The amount of wKP3R to mint\n function mint(uint256 _amount) external;\n\n /// @notice sets the wKP3R address\n /// @param _wKP3R the wKP3R address\n function setWKP3R(address _wKP3R) external;\n}\n" - }, - "solidity/interfaces/sidechain/IKeep3rHelperSidechain.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../IKeep3rHelper.sol';\n\n/// @title Keep3rHelperSidechain contract\n/// @notice Contains all the helper functions for sidechain keep3r implementations\ninterface IKeep3rHelperSidechain is IKeep3rHelper {\n // Events\n\n /// @notice The oracle for a liquidity has been saved\n /// @param _liquidity The address of the given liquidity\n /// @param _oraclePool The address of the oracle pool\n event OracleSet(address _liquidity, address _oraclePool);\n\n /// @notice Emitted when the WETH USD pool is changed\n /// @param _address Address of the new WETH USD pool\n /// @param _isWETHToken0 True if calling the token0 method of the pool returns the WETH token address\n event WethUSDPoolChange(address _address, bool _isWETHToken0);\n\n /// Variables\n\n /// @notice Ethereum mainnet WETH address used for quoting references\n /// @return _weth Address of WETH token\n // solhint-disable func-name-mixedcase\n function WETH() external view returns (address _weth);\n\n /// @return _oracle The address of the observable pool for given liquidity\n function oracle(address _liquidity) external view returns (address _oracle);\n\n /// @notice WETH-USD pool that is being used as oracle\n /// @return poolAddress Address of the pool\n /// @return isTKNToken0 True if calling the token0 method of the pool returns the WETH token address\n function wethUSDPool() external view returns (address poolAddress, bool isTKNToken0);\n\n /// @notice Quotes USD to ETH\n /// @dev Used to know how much ETH should be paid to keepers before converting it from ETH to KP3R\n /// @param _usd The amount of USD to quote to ETH\n /// @return _eth The resulting amount of ETH after quoting the USD\n function quoteUsdToEth(uint256 _usd) external returns (uint256 _eth);\n\n /// Methods\n\n /// @notice Sets an oracle for a given liquidity\n /// @param _liquidity The address of the liquidity\n /// @param _oracle The address of the pool used to quote the liquidity from\n /// @dev The oracle must contain KP3R as either token0 or token1\n function setOracle(address _liquidity, address _oracle) external;\n\n /// @notice Sets an oracle for querying WETH/USD quote\n /// @param _poolAddress The address of the pool used as oracle\n /// @dev The oracle must contain WETH as either token0 or token1\n function setWethUsdPool(address _poolAddress) external;\n}\n" - }, - "solidity/interfaces/sidechain/IKeep3rJobWorkableRated.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../peripherals/IKeep3rJobs.sol';\n\n/// @title Keep3rJobWorkableRated contract\n/// @notice Implements a quoting in USD per gas unit for Keep3r jobs\ninterface IKeep3rJobWorkableRated is IKeep3rJobs {\n /// @notice Throws when job contract calls deprecated worked(address) function\n error Deprecated();\n\n /// @notice Implemented by jobs to show that a keeper performed work and reward in stable USD quote\n /// @dev Automatically calculates the payment for the keeper and pays the keeper with bonded KP3R\n /// @param _keeper Address of the keeper that performed the work\n /// @param _usdPerGasUnit Amount of USD in wei rewarded for gas unit worked by the keeper\n function worked(address _keeper, uint256 _usdPerGasUnit) external;\n}\n" - }, - "solidity/interfaces/sidechain/IKeep3rSidechainAccountance.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\n/// @title IKeep3rSidechainAccountance interface\n/// @notice Implements a view to get the amount of credits that can be withdrawn\ninterface IKeep3rSidechainAccountance {\n /// @notice The surplus amount of wKP3Rs in escrow contract\n /// @return _virtualReserves The surplus amount of wKP3Rs in escrow contract\n function virtualReserves() external view returns (int256 _virtualReserves);\n}\n" - }, - "solidity/interfaces/peripherals/IMintable.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport './IGovernable.sol';\nimport './IBaseErrors.sol';\n\n/// @title Mintable contract\n/// @notice Manages the minter role\ninterface IMintable is IBaseErrors, IGovernable {\n // Events\n\n /// @notice Emitted when governance sets a new minter\n /// @param _minter Address of the new minter\n event MinterSet(address _minter);\n\n // Errors\n\n /// @notice Throws if the caller of the function is not the minter\n error OnlyMinter();\n\n // Variables\n\n /// @notice Stores the minter address\n /// @return _minter The minter addresss\n function minter() external view returns (address _minter);\n\n // Methods\n\n /// @notice Sets a new address to be the minter\n /// @param _minter The address set as the minter\n function setMinter(address _minter) external;\n}\n" - }, - "solidity/for-test/testnet/Keep3rSidechainForTestnet.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../../contracts/sidechain/Keep3rSidechain.sol';\n\ncontract Keep3rSidechainForTestnet is Keep3rSidechain {\n constructor(\n address _governance,\n address _keep3rHelper,\n address _keep3rV1,\n address _keep3rV1Proxy\n ) Keep3rSidechain(_governance, _keep3rHelper, _keep3rV1, _keep3rV1Proxy) {\n bondTime = 0; // allows keepers to instantly register\n unbondTime = 0; // allows keepers & jobOwners to instantly withdraw funds\n liquidityMinimum = 1; // allows job providers to add low liquidity\n rewardPeriodTime = 1 days; // reduces twap calculation period\n inflationPeriod = 5 days; // increases credit minting\n }\n}\n" - }, - "solidity/for-test/Keep3rSidechainForTest.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../contracts/sidechain/Keep3rSidechain.sol';\n\ncontract Keep3rSidechainForTest is Keep3rSidechain {\n using EnumerableSet for EnumerableSet.AddressSet;\n\n constructor(\n address _governance,\n address _keep3rHelper,\n address _wrappedKP3R,\n address _keep3rEscrow\n ) Keep3rSidechain(_governance, _keep3rHelper, _wrappedKP3R, _keep3rEscrow) {}\n\n function setJobLiquidity(address _job, address _liquidity) external {\n _jobLiquidities[_job].add(_liquidity);\n }\n}\n" - }, - "solidity/for-test/JobRatedForTest.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../interfaces/IKeep3r.sol';\nimport '../interfaces/sidechain/IKeep3rJobWorkableRated.sol';\n\ncontract JobRatedForTest {\n error InvalidKeeper();\n address public keep3r;\n uint256 public nonce;\n uint256 public usdPerGasUnit = 1_000e9;\n\n constructor(address _keep3r) {\n keep3r = _keep3r;\n }\n\n function work() external {\n if (!IKeep3r(keep3r).isKeeper(msg.sender)) revert InvalidKeeper();\n\n for (uint256 i = 0; i < 1000; i++) {\n nonce++;\n }\n\n IKeep3rJobWorkableRated(keep3r).worked(msg.sender, usdPerGasUnit);\n }\n\n function workHard(uint256 _factor) external {\n if (!IKeep3r(keep3r).isKeeper(msg.sender)) revert InvalidKeeper();\n\n for (uint256 i = 0; i < 1000 * _factor; i++) {\n nonce++;\n }\n\n IKeep3rJobWorkableRated(keep3r).worked(msg.sender, usdPerGasUnit);\n }\n}\n" - }, - "solidity/for-test/JobForTest.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../interfaces/IKeep3r.sol';\n\ncontract JobForTest {\n error InvalidKeeper();\n address public keep3r;\n uint256 public nonce;\n\n constructor(address _keep3r) {\n keep3r = _keep3r;\n }\n\n function work() external {\n if (!IKeep3r(keep3r).isKeeper(msg.sender)) revert InvalidKeeper();\n\n for (uint256 i; i < 1000; i++) {\n nonce++;\n }\n\n IKeep3r(keep3r).worked(msg.sender);\n }\n\n function workHard(uint256 _factor) external {\n if (!IKeep3r(keep3r).isKeeper(msg.sender)) revert InvalidKeeper();\n\n for (uint256 i; i < 1000 * _factor; i++) {\n nonce++;\n }\n\n IKeep3r(keep3r).worked(msg.sender);\n }\n}\n" - }, - "solidity/for-test/BasicJob.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../interfaces/IKeep3r.sol';\n\ncontract BasicJob {\n error KeeperNotValid();\n\n address public keep3r;\n uint256 public nonce;\n uint256[] public array;\n\n constructor(address _keep3r) {\n keep3r = _keep3r;\n }\n\n function work() external upkeep {}\n\n function workHard(uint256 _howHard) external upkeep {\n for (uint256 i = nonce; i < _howHard; i++) {\n nonce++;\n }\n }\n\n function workRefund(uint256 _howHard) external upkeep {\n for (uint256 i; i < _howHard; i++) {\n array.push(i);\n }\n\n while (array.length > 0) {\n array.pop();\n }\n }\n\n modifier upkeep() {\n if (!IKeep3r(keep3r).isKeeper(msg.sender)) revert KeeperNotValid();\n _;\n IKeep3r(keep3r).worked(msg.sender);\n }\n}\n" - }, - "solidity/contracts/Keep3rHelperParameters.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.7 <0.9.0;\n\nimport './libraries/FullMath.sol';\nimport './libraries/TickMath.sol';\nimport '../interfaces/peripherals/IBaseErrors.sol';\nimport '../interfaces/IKeep3r.sol';\nimport '../interfaces/external/IKeep3rV1.sol';\nimport '../interfaces/IKeep3rHelperParameters.sol';\nimport './peripherals/Governable.sol';\nimport './Keep3rHelperParameters.sol';\n\nimport '@openzeppelin/contracts/utils/math/Math.sol';\nimport '@uniswap/v3-core/contracts/interfaces/IUniswapV3Pool.sol';\n\ncontract Keep3rHelperParameters is IKeep3rHelperParameters, IBaseErrors, Governable {\n /// @inheritdoc IKeep3rHelperParameters\n address public immutable override KP3R;\n\n /// @inheritdoc IKeep3rHelperParameters\n uint256 public constant override BOOST_BASE = 10_000;\n\n /// @inheritdoc IKeep3rHelperParameters\n uint256 public override minBoost = 11_000;\n\n /// @inheritdoc IKeep3rHelperParameters\n uint256 public override maxBoost = 12_000;\n\n /// @inheritdoc IKeep3rHelperParameters\n uint256 public override targetBond = 200 ether;\n\n /// @inheritdoc IKeep3rHelperParameters\n uint256 public override workExtraGas = 34_000;\n\n /// @inheritdoc IKeep3rHelperParameters\n uint32 public override quoteTwapTime = 10 minutes;\n\n /// @inheritdoc IKeep3rHelperParameters\n uint256 public override minBaseFee = 15e9;\n\n /// @inheritdoc IKeep3rHelperParameters\n uint256 public override minPriorityFee = 2e9;\n\n /// @inheritdoc IKeep3rHelperParameters\n address public override keep3rV2;\n\n /// @inheritdoc IKeep3rHelperParameters\n IKeep3rHelperParameters.TokenOraclePool public override kp3rWethPool;\n\n constructor(\n address _kp3r,\n address _keep3rV2,\n address _governance,\n address _kp3rWethPool\n ) Governable(_governance) {\n KP3R = _kp3r;\n keep3rV2 = _keep3rV2;\n\n // Immutable variables [KP3R] cannot be read during contract creation time [_setKp3rWethPool]\n kp3rWethPool = _validateOraclePool(_kp3rWethPool, _kp3r);\n emit Kp3rWethPoolChange(kp3rWethPool.poolAddress, kp3rWethPool.isTKNToken0);\n }\n\n /// @inheritdoc IKeep3rHelperParameters\n function setKp3rWethPool(address _poolAddress) external override onlyGovernance {\n if (_poolAddress == address(0)) revert ZeroAddress();\n _setKp3rWethPool(_poolAddress);\n }\n\n /// @inheritdoc IKeep3rHelperParameters\n function setMinBoost(uint256 _minBoost) external override onlyGovernance {\n minBoost = _minBoost;\n emit MinBoostChange(minBoost);\n }\n\n /// @inheritdoc IKeep3rHelperParameters\n function setMaxBoost(uint256 _maxBoost) external override onlyGovernance {\n maxBoost = _maxBoost;\n emit MaxBoostChange(maxBoost);\n }\n\n /// @inheritdoc IKeep3rHelperParameters\n function setTargetBond(uint256 _targetBond) external override onlyGovernance {\n targetBond = _targetBond;\n emit TargetBondChange(targetBond);\n }\n\n /// @inheritdoc IKeep3rHelperParameters\n function setKeep3rV2(address _keep3rV2) external override onlyGovernance {\n if (_keep3rV2 == address(0)) revert ZeroAddress();\n keep3rV2 = _keep3rV2;\n emit Keep3rV2Change(keep3rV2);\n }\n\n /// @inheritdoc IKeep3rHelperParameters\n function setWorkExtraGas(uint256 _workExtraGas) external override onlyGovernance {\n workExtraGas = _workExtraGas;\n emit WorkExtraGasChange(workExtraGas);\n }\n\n /// @inheritdoc IKeep3rHelperParameters\n function setQuoteTwapTime(uint32 _quoteTwapTime) external override onlyGovernance {\n _setQuoteTwapTime(_quoteTwapTime);\n }\n\n function _setQuoteTwapTime(uint32 _quoteTwapTime) internal {\n quoteTwapTime = _quoteTwapTime;\n emit QuoteTwapTimeChange(quoteTwapTime);\n }\n\n /// @inheritdoc IKeep3rHelperParameters\n function setMinBaseFee(uint256 _minBaseFee) external override onlyGovernance {\n minBaseFee = _minBaseFee;\n emit MinBaseFeeChange(minBaseFee);\n }\n\n /// @inheritdoc IKeep3rHelperParameters\n function setMinPriorityFee(uint256 _minPriorityFee) external override onlyGovernance {\n minPriorityFee = _minPriorityFee;\n emit MinPriorityFeeChange(minPriorityFee);\n }\n\n /// @notice Sets KP3R-WETH pool\n /// @param _poolAddress The address of the KP3R-WETH pool\n function _setKp3rWethPool(address _poolAddress) internal {\n kp3rWethPool = _validateOraclePool(_poolAddress, KP3R);\n emit Kp3rWethPoolChange(kp3rWethPool.poolAddress, kp3rWethPool.isTKNToken0);\n }\n\n function _validateOraclePool(address _poolAddress, address _token) internal view virtual returns (TokenOraclePool memory _oraclePool) {\n bool _isTKNToken0 = IUniswapV3Pool(_poolAddress).token0() == _token;\n\n if (!_isTKNToken0 && IUniswapV3Pool(_poolAddress).token1() != _token) revert InvalidOraclePool();\n\n return TokenOraclePool(_poolAddress, _isTKNToken0);\n }\n}\n" - }, - "solidity/contracts/libraries/TickMath.sol": { - "content": "// SPDX-License-Identifier: GPL-2.0-or-later\npragma solidity >=0.5.0;\n\n// solhint-disable\n\n/// @title Math library for computing sqrt prices from ticks and vice versa\n/// @notice Computes sqrt price for ticks of size 1.0001, i.e. sqrt(1.0001^tick) as fixed point Q64.96 numbers. Supports\n/// prices between 2**-128 and 2**128\nlibrary TickMath {\n /// @dev The minimum tick that may be passed to #getSqrtRatioAtTick computed from log base 1.0001 of 2**-128\n int24 internal constant MIN_TICK = -887272;\n /// @dev The maximum tick that may be passed to #getSqrtRatioAtTick computed from log base 1.0001 of 2**128\n int24 internal constant MAX_TICK = -MIN_TICK;\n\n /// @dev The minimum value that can be returned from #getSqrtRatioAtTick. Equivalent to getSqrtRatioAtTick(MIN_TICK)\n uint160 internal constant MIN_SQRT_RATIO = 4295128739;\n /// @dev The maximum value that can be returned from #getSqrtRatioAtTick. Equivalent to getSqrtRatioAtTick(MAX_TICK)\n uint160 internal constant MAX_SQRT_RATIO = 1461446703485210103287273052203988822378723970342;\n\n /// @notice Calculates sqrt(1.0001^tick) * 2^96\n /// @dev Throws if |tick| > max tick\n /// @param tick The input tick for the above formula\n /// @return sqrtPriceX96 A Fixed point Q64.96 number representing the sqrt of the ratio of the two assets (token1/token0)\n /// at the given tick\n function getSqrtRatioAtTick(int24 tick) internal pure returns (uint160 sqrtPriceX96) {\n uint256 absTick = tick < 0 ? uint256(-int256(tick)) : uint256(int256(tick));\n require(absTick <= uint256(int256(MAX_TICK)), 'T');\n\n uint256 ratio = absTick & 0x1 != 0 ? 0xfffcb933bd6fad37aa2d162d1a594001 : 0x100000000000000000000000000000000;\n if (absTick & 0x2 != 0) ratio = (ratio * 0xfff97272373d413259a46990580e213a) >> 128;\n if (absTick & 0x4 != 0) ratio = (ratio * 0xfff2e50f5f656932ef12357cf3c7fdcc) >> 128;\n if (absTick & 0x8 != 0) ratio = (ratio * 0xffe5caca7e10e4e61c3624eaa0941cd0) >> 128;\n if (absTick & 0x10 != 0) ratio = (ratio * 0xffcb9843d60f6159c9db58835c926644) >> 128;\n if (absTick & 0x20 != 0) ratio = (ratio * 0xff973b41fa98c081472e6896dfb254c0) >> 128;\n if (absTick & 0x40 != 0) ratio = (ratio * 0xff2ea16466c96a3843ec78b326b52861) >> 128;\n if (absTick & 0x80 != 0) ratio = (ratio * 0xfe5dee046a99a2a811c461f1969c3053) >> 128;\n if (absTick & 0x100 != 0) ratio = (ratio * 0xfcbe86c7900a88aedcffc83b479aa3a4) >> 128;\n if (absTick & 0x200 != 0) ratio = (ratio * 0xf987a7253ac413176f2b074cf7815e54) >> 128;\n if (absTick & 0x400 != 0) ratio = (ratio * 0xf3392b0822b70005940c7a398e4b70f3) >> 128;\n if (absTick & 0x800 != 0) ratio = (ratio * 0xe7159475a2c29b7443b29c7fa6e889d9) >> 128;\n if (absTick & 0x1000 != 0) ratio = (ratio * 0xd097f3bdfd2022b8845ad8f792aa5825) >> 128;\n if (absTick & 0x2000 != 0) ratio = (ratio * 0xa9f746462d870fdf8a65dc1f90e061e5) >> 128;\n if (absTick & 0x4000 != 0) ratio = (ratio * 0x70d869a156d2a1b890bb3df62baf32f7) >> 128;\n if (absTick & 0x8000 != 0) ratio = (ratio * 0x31be135f97d08fd981231505542fcfa6) >> 128;\n if (absTick & 0x10000 != 0) ratio = (ratio * 0x9aa508b5b7a84e1c677de54f3e99bc9) >> 128;\n if (absTick & 0x20000 != 0) ratio = (ratio * 0x5d6af8dedb81196699c329225ee604) >> 128;\n if (absTick & 0x40000 != 0) ratio = (ratio * 0x2216e584f5fa1ea926041bedfe98) >> 128;\n if (absTick & 0x80000 != 0) ratio = (ratio * 0x48a170391f7dc42444e8fa2) >> 128;\n\n if (tick > 0) ratio = type(uint256).max / ratio;\n\n // Divides by 1<<32 rounding up to go from a Q128.128 to a Q128.96.\n // we then downcast because we know the result always fits within 160 bits due to our tick input constraint\n // we round up in the division so getTickAtSqrtRatio of the output price is always consistent\n sqrtPriceX96 = uint160((ratio >> 32) + (ratio % (1 << 32) == 0 ? 0 : 1));\n }\n\n /// @notice Calculates the greatest tick value such that getRatioAtTick(tick) <= ratio\n /// @dev Throws in case sqrtPriceX96 < MIN_SQRT_RATIO, as MIN_SQRT_RATIO is the lowest value getRatioAtTick may ever return.\n /// @param sqrtPriceX96 The sqrt ratio for which to compute the tick as a Q64.96\n /// @return tick The greatest tick for which the ratio is less than or equal to the input ratio\n function getTickAtSqrtRatio(uint160 sqrtPriceX96) internal pure returns (int24 tick) {\n // Second inequality must be < because the price can never reach the price at the max tick\n require(sqrtPriceX96 >= MIN_SQRT_RATIO && sqrtPriceX96 < MAX_SQRT_RATIO, 'R');\n uint256 ratio = uint256(sqrtPriceX96) << 32;\n\n uint256 r = ratio;\n uint256 msb = 0;\n\n assembly {\n let f := shl(7, gt(r, 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF))\n msb := or(msb, f)\n r := shr(f, r)\n }\n assembly {\n let f := shl(6, gt(r, 0xFFFFFFFFFFFFFFFF))\n msb := or(msb, f)\n r := shr(f, r)\n }\n assembly {\n let f := shl(5, gt(r, 0xFFFFFFFF))\n msb := or(msb, f)\n r := shr(f, r)\n }\n assembly {\n let f := shl(4, gt(r, 0xFFFF))\n msb := or(msb, f)\n r := shr(f, r)\n }\n assembly {\n let f := shl(3, gt(r, 0xFF))\n msb := or(msb, f)\n r := shr(f, r)\n }\n assembly {\n let f := shl(2, gt(r, 0xF))\n msb := or(msb, f)\n r := shr(f, r)\n }\n assembly {\n let f := shl(1, gt(r, 0x3))\n msb := or(msb, f)\n r := shr(f, r)\n }\n assembly {\n let f := gt(r, 0x1)\n msb := or(msb, f)\n }\n\n if (msb >= 128) r = ratio >> (msb - 127);\n else r = ratio << (127 - msb);\n\n int256 log_2 = (int256(msb) - 128) << 64;\n\n assembly {\n r := shr(127, mul(r, r))\n let f := shr(128, r)\n log_2 := or(log_2, shl(63, f))\n r := shr(f, r)\n }\n assembly {\n r := shr(127, mul(r, r))\n let f := shr(128, r)\n log_2 := or(log_2, shl(62, f))\n r := shr(f, r)\n }\n assembly {\n r := shr(127, mul(r, r))\n let f := shr(128, r)\n log_2 := or(log_2, shl(61, f))\n r := shr(f, r)\n }\n assembly {\n r := shr(127, mul(r, r))\n let f := shr(128, r)\n log_2 := or(log_2, shl(60, f))\n r := shr(f, r)\n }\n assembly {\n r := shr(127, mul(r, r))\n let f := shr(128, r)\n log_2 := or(log_2, shl(59, f))\n r := shr(f, r)\n }\n assembly {\n r := shr(127, mul(r, r))\n let f := shr(128, r)\n log_2 := or(log_2, shl(58, f))\n r := shr(f, r)\n }\n assembly {\n r := shr(127, mul(r, r))\n let f := shr(128, r)\n log_2 := or(log_2, shl(57, f))\n r := shr(f, r)\n }\n assembly {\n r := shr(127, mul(r, r))\n let f := shr(128, r)\n log_2 := or(log_2, shl(56, f))\n r := shr(f, r)\n }\n assembly {\n r := shr(127, mul(r, r))\n let f := shr(128, r)\n log_2 := or(log_2, shl(55, f))\n r := shr(f, r)\n }\n assembly {\n r := shr(127, mul(r, r))\n let f := shr(128, r)\n log_2 := or(log_2, shl(54, f))\n r := shr(f, r)\n }\n assembly {\n r := shr(127, mul(r, r))\n let f := shr(128, r)\n log_2 := or(log_2, shl(53, f))\n r := shr(f, r)\n }\n assembly {\n r := shr(127, mul(r, r))\n let f := shr(128, r)\n log_2 := or(log_2, shl(52, f))\n r := shr(f, r)\n }\n assembly {\n r := shr(127, mul(r, r))\n let f := shr(128, r)\n log_2 := or(log_2, shl(51, f))\n r := shr(f, r)\n }\n assembly {\n r := shr(127, mul(r, r))\n let f := shr(128, r)\n log_2 := or(log_2, shl(50, f))\n }\n\n int256 log_sqrt10001 = log_2 * 255738958999603826347141; // 128.128 number\n\n int24 tickLow = int24((log_sqrt10001 - 3402992956809132418596140100660247210) >> 128);\n int24 tickHi = int24((log_sqrt10001 + 291339464771989622907027621153398088495) >> 128);\n\n tick = tickLow == tickHi ? tickLow : getSqrtRatioAtTick(tickHi) <= sqrtPriceX96 ? tickHi : tickLow;\n }\n}\n" - }, - "@uniswap/v3-core/contracts/interfaces/IUniswapV3Pool.sol": { - "content": "// SPDX-License-Identifier: GPL-2.0-or-later\npragma solidity >=0.5.0;\n\nimport './pool/IUniswapV3PoolImmutables.sol';\nimport './pool/IUniswapV3PoolState.sol';\nimport './pool/IUniswapV3PoolDerivedState.sol';\nimport './pool/IUniswapV3PoolActions.sol';\nimport './pool/IUniswapV3PoolOwnerActions.sol';\nimport './pool/IUniswapV3PoolEvents.sol';\n\n/// @title The interface for a Uniswap V3 Pool\n/// @notice A Uniswap pool facilitates swapping and automated market making between any two assets that strictly conform\n/// to the ERC20 specification\n/// @dev The pool interface is broken up into many smaller pieces\ninterface IUniswapV3Pool is\n IUniswapV3PoolImmutables,\n IUniswapV3PoolState,\n IUniswapV3PoolDerivedState,\n IUniswapV3PoolActions,\n IUniswapV3PoolOwnerActions,\n IUniswapV3PoolEvents\n{\n\n}\n" - }, - "@uniswap/v3-core/contracts/interfaces/pool/IUniswapV3PoolImmutables.sol": { - "content": "// SPDX-License-Identifier: GPL-2.0-or-later\npragma solidity >=0.5.0;\n\n/// @title Pool state that never changes\n/// @notice These parameters are fixed for a pool forever, i.e., the methods will always return the same values\ninterface IUniswapV3PoolImmutables {\n /// @notice The contract that deployed the pool, which must adhere to the IUniswapV3Factory interface\n /// @return The contract address\n function factory() external view returns (address);\n\n /// @notice The first of the two tokens of the pool, sorted by address\n /// @return The token contract address\n function token0() external view returns (address);\n\n /// @notice The second of the two tokens of the pool, sorted by address\n /// @return The token contract address\n function token1() external view returns (address);\n\n /// @notice The pool's fee in hundredths of a bip, i.e. 1e-6\n /// @return The fee\n function fee() external view returns (uint24);\n\n /// @notice The pool tick spacing\n /// @dev Ticks can only be used at multiples of this value, minimum of 1 and always positive\n /// e.g.: a tickSpacing of 3 means ticks can be initialized every 3rd tick, i.e., ..., -6, -3, 0, 3, 6, ...\n /// This value is an int24 to avoid casting even though it is always positive.\n /// @return The tick spacing\n function tickSpacing() external view returns (int24);\n\n /// @notice The maximum amount of position liquidity that can use any tick in the range\n /// @dev This parameter is enforced per tick to prevent liquidity from overflowing a uint128 at any point, and\n /// also prevents out-of-range liquidity from being used to prevent adding in-range liquidity to a pool\n /// @return The max amount of liquidity per tick\n function maxLiquidityPerTick() external view returns (uint128);\n}\n" - }, - "@uniswap/v3-core/contracts/interfaces/pool/IUniswapV3PoolState.sol": { - "content": "// SPDX-License-Identifier: GPL-2.0-or-later\npragma solidity >=0.5.0;\n\n/// @title Pool state that can change\n/// @notice These methods compose the pool's state, and can change with any frequency including multiple times\n/// per transaction\ninterface IUniswapV3PoolState {\n /// @notice The 0th storage slot in the pool stores many values, and is exposed as a single method to save gas\n /// when accessed externally.\n /// @return sqrtPriceX96 The current price of the pool as a sqrt(token1/token0) Q64.96 value\n /// tick The current tick of the pool, i.e. according to the last tick transition that was run.\n /// This value may not always be equal to SqrtTickMath.getTickAtSqrtRatio(sqrtPriceX96) if the price is on a tick\n /// boundary.\n /// observationIndex The index of the last oracle observation that was written,\n /// observationCardinality The current maximum number of observations stored in the pool,\n /// observationCardinalityNext The next maximum number of observations, to be updated when the observation.\n /// feeProtocol The protocol fee for both tokens of the pool.\n /// Encoded as two 4 bit values, where the protocol fee of token1 is shifted 4 bits and the protocol fee of token0\n /// is the lower 4 bits. Used as the denominator of a fraction of the swap fee, e.g. 4 means 1/4th of the swap fee.\n /// unlocked Whether the pool is currently locked to reentrancy\n function slot0()\n external\n view\n returns (\n uint160 sqrtPriceX96,\n int24 tick,\n uint16 observationIndex,\n uint16 observationCardinality,\n uint16 observationCardinalityNext,\n uint8 feeProtocol,\n bool unlocked\n );\n\n /// @notice The fee growth as a Q128.128 fees of token0 collected per unit of liquidity for the entire life of the pool\n /// @dev This value can overflow the uint256\n function feeGrowthGlobal0X128() external view returns (uint256);\n\n /// @notice The fee growth as a Q128.128 fees of token1 collected per unit of liquidity for the entire life of the pool\n /// @dev This value can overflow the uint256\n function feeGrowthGlobal1X128() external view returns (uint256);\n\n /// @notice The amounts of token0 and token1 that are owed to the protocol\n /// @dev Protocol fees will never exceed uint128 max in either token\n function protocolFees() external view returns (uint128 token0, uint128 token1);\n\n /// @notice The currently in range liquidity available to the pool\n /// @dev This value has no relationship to the total liquidity across all ticks\n function liquidity() external view returns (uint128);\n\n /// @notice Look up information about a specific tick in the pool\n /// @param tick The tick to look up\n /// @return liquidityGross the total amount of position liquidity that uses the pool either as tick lower or\n /// tick upper,\n /// liquidityNet how much liquidity changes when the pool price crosses the tick,\n /// feeGrowthOutside0X128 the fee growth on the other side of the tick from the current tick in token0,\n /// feeGrowthOutside1X128 the fee growth on the other side of the tick from the current tick in token1,\n /// tickCumulativeOutside the cumulative tick value on the other side of the tick from the current tick\n /// secondsPerLiquidityOutsideX128 the seconds spent per liquidity on the other side of the tick from the current tick,\n /// secondsOutside the seconds spent on the other side of the tick from the current tick,\n /// initialized Set to true if the tick is initialized, i.e. liquidityGross is greater than 0, otherwise equal to false.\n /// Outside values can only be used if the tick is initialized, i.e. if liquidityGross is greater than 0.\n /// In addition, these values are only relative and must be used only in comparison to previous snapshots for\n /// a specific position.\n function ticks(int24 tick)\n external\n view\n returns (\n uint128 liquidityGross,\n int128 liquidityNet,\n uint256 feeGrowthOutside0X128,\n uint256 feeGrowthOutside1X128,\n int56 tickCumulativeOutside,\n uint160 secondsPerLiquidityOutsideX128,\n uint32 secondsOutside,\n bool initialized\n );\n\n /// @notice Returns 256 packed tick initialized boolean values. See TickBitmap for more information\n function tickBitmap(int16 wordPosition) external view returns (uint256);\n\n /// @notice Returns the information about a position by the position's key\n /// @param key The position's key is a hash of a preimage composed by the owner, tickLower and tickUpper\n /// @return _liquidity The amount of liquidity in the position,\n /// Returns feeGrowthInside0LastX128 fee growth of token0 inside the tick range as of the last mint/burn/poke,\n /// Returns feeGrowthInside1LastX128 fee growth of token1 inside the tick range as of the last mint/burn/poke,\n /// Returns tokensOwed0 the computed amount of token0 owed to the position as of the last mint/burn/poke,\n /// Returns tokensOwed1 the computed amount of token1 owed to the position as of the last mint/burn/poke\n function positions(bytes32 key)\n external\n view\n returns (\n uint128 _liquidity,\n uint256 feeGrowthInside0LastX128,\n uint256 feeGrowthInside1LastX128,\n uint128 tokensOwed0,\n uint128 tokensOwed1\n );\n\n /// @notice Returns data about a specific observation index\n /// @param index The element of the observations array to fetch\n /// @dev You most likely want to use #observe() instead of this method to get an observation as of some amount of time\n /// ago, rather than at a specific index in the array.\n /// @return blockTimestamp The timestamp of the observation,\n /// Returns tickCumulative the tick multiplied by seconds elapsed for the life of the pool as of the observation timestamp,\n /// Returns secondsPerLiquidityCumulativeX128 the seconds per in range liquidity for the life of the pool as of the observation timestamp,\n /// Returns initialized whether the observation has been initialized and the values are safe to use\n function observations(uint256 index)\n external\n view\n returns (\n uint32 blockTimestamp,\n int56 tickCumulative,\n uint160 secondsPerLiquidityCumulativeX128,\n bool initialized\n );\n}\n" - }, - "@uniswap/v3-core/contracts/interfaces/pool/IUniswapV3PoolDerivedState.sol": { - "content": "// SPDX-License-Identifier: GPL-2.0-or-later\npragma solidity >=0.5.0;\n\n/// @title Pool state that is not stored\n/// @notice Contains view functions to provide information about the pool that is computed rather than stored on the\n/// blockchain. The functions here may have variable gas costs.\ninterface IUniswapV3PoolDerivedState {\n /// @notice Returns the cumulative tick and liquidity as of each timestamp `secondsAgo` from the current block timestamp\n /// @dev To get a time weighted average tick or liquidity-in-range, you must call this with two values, one representing\n /// the beginning of the period and another for the end of the period. E.g., to get the last hour time-weighted average tick,\n /// you must call it with secondsAgos = [3600, 0].\n /// @dev The time weighted average tick represents the geometric time weighted average price of the pool, in\n /// log base sqrt(1.0001) of token1 / token0. The TickMath library can be used to go from a tick value to a ratio.\n /// @param secondsAgos From how long ago each cumulative tick and liquidity value should be returned\n /// @return tickCumulatives Cumulative tick values as of each `secondsAgos` from the current block timestamp\n /// @return secondsPerLiquidityCumulativeX128s Cumulative seconds per liquidity-in-range value as of each `secondsAgos` from the current block\n /// timestamp\n function observe(uint32[] calldata secondsAgos)\n external\n view\n returns (int56[] memory tickCumulatives, uint160[] memory secondsPerLiquidityCumulativeX128s);\n\n /// @notice Returns a snapshot of the tick cumulative, seconds per liquidity and seconds inside a tick range\n /// @dev Snapshots must only be compared to other snapshots, taken over a period for which a position existed.\n /// I.e., snapshots cannot be compared if a position is not held for the entire period between when the first\n /// snapshot is taken and the second snapshot is taken.\n /// @param tickLower The lower tick of the range\n /// @param tickUpper The upper tick of the range\n /// @return tickCumulativeInside The snapshot of the tick accumulator for the range\n /// @return secondsPerLiquidityInsideX128 The snapshot of seconds per liquidity for the range\n /// @return secondsInside The snapshot of seconds per liquidity for the range\n function snapshotCumulativesInside(int24 tickLower, int24 tickUpper)\n external\n view\n returns (\n int56 tickCumulativeInside,\n uint160 secondsPerLiquidityInsideX128,\n uint32 secondsInside\n );\n}\n" - }, - "@uniswap/v3-core/contracts/interfaces/pool/IUniswapV3PoolActions.sol": { - "content": "// SPDX-License-Identifier: GPL-2.0-or-later\npragma solidity >=0.5.0;\n\n/// @title Permissionless pool actions\n/// @notice Contains pool methods that can be called by anyone\ninterface IUniswapV3PoolActions {\n /// @notice Sets the initial price for the pool\n /// @dev Price is represented as a sqrt(amountToken1/amountToken0) Q64.96 value\n /// @param sqrtPriceX96 the initial sqrt price of the pool as a Q64.96\n function initialize(uint160 sqrtPriceX96) external;\n\n /// @notice Adds liquidity for the given recipient/tickLower/tickUpper position\n /// @dev The caller of this method receives a callback in the form of IUniswapV3MintCallback#uniswapV3MintCallback\n /// in which they must pay any token0 or token1 owed for the liquidity. The amount of token0/token1 due depends\n /// on tickLower, tickUpper, the amount of liquidity, and the current price.\n /// @param recipient The address for which the liquidity will be created\n /// @param tickLower The lower tick of the position in which to add liquidity\n /// @param tickUpper The upper tick of the position in which to add liquidity\n /// @param amount The amount of liquidity to mint\n /// @param data Any data that should be passed through to the callback\n /// @return amount0 The amount of token0 that was paid to mint the given amount of liquidity. Matches the value in the callback\n /// @return amount1 The amount of token1 that was paid to mint the given amount of liquidity. Matches the value in the callback\n function mint(\n address recipient,\n int24 tickLower,\n int24 tickUpper,\n uint128 amount,\n bytes calldata data\n ) external returns (uint256 amount0, uint256 amount1);\n\n /// @notice Collects tokens owed to a position\n /// @dev Does not recompute fees earned, which must be done either via mint or burn of any amount of liquidity.\n /// Collect must be called by the position owner. To withdraw only token0 or only token1, amount0Requested or\n /// amount1Requested may be set to zero. To withdraw all tokens owed, caller may pass any value greater than the\n /// actual tokens owed, e.g. type(uint128).max. Tokens owed may be from accumulated swap fees or burned liquidity.\n /// @param recipient The address which should receive the fees collected\n /// @param tickLower The lower tick of the position for which to collect fees\n /// @param tickUpper The upper tick of the position for which to collect fees\n /// @param amount0Requested How much token0 should be withdrawn from the fees owed\n /// @param amount1Requested How much token1 should be withdrawn from the fees owed\n /// @return amount0 The amount of fees collected in token0\n /// @return amount1 The amount of fees collected in token1\n function collect(\n address recipient,\n int24 tickLower,\n int24 tickUpper,\n uint128 amount0Requested,\n uint128 amount1Requested\n ) external returns (uint128 amount0, uint128 amount1);\n\n /// @notice Burn liquidity from the sender and account tokens owed for the liquidity to the position\n /// @dev Can be used to trigger a recalculation of fees owed to a position by calling with an amount of 0\n /// @dev Fees must be collected separately via a call to #collect\n /// @param tickLower The lower tick of the position for which to burn liquidity\n /// @param tickUpper The upper tick of the position for which to burn liquidity\n /// @param amount How much liquidity to burn\n /// @return amount0 The amount of token0 sent to the recipient\n /// @return amount1 The amount of token1 sent to the recipient\n function burn(\n int24 tickLower,\n int24 tickUpper,\n uint128 amount\n ) external returns (uint256 amount0, uint256 amount1);\n\n /// @notice Swap token0 for token1, or token1 for token0\n /// @dev The caller of this method receives a callback in the form of IUniswapV3SwapCallback#uniswapV3SwapCallback\n /// @param recipient The address to receive the output of the swap\n /// @param zeroForOne The direction of the swap, true for token0 to token1, false for token1 to token0\n /// @param amountSpecified The amount of the swap, which implicitly configures the swap as exact input (positive), or exact output (negative)\n /// @param sqrtPriceLimitX96 The Q64.96 sqrt price limit. If zero for one, the price cannot be less than this\n /// value after the swap. If one for zero, the price cannot be greater than this value after the swap\n /// @param data Any data to be passed through to the callback\n /// @return amount0 The delta of the balance of token0 of the pool, exact when negative, minimum when positive\n /// @return amount1 The delta of the balance of token1 of the pool, exact when negative, minimum when positive\n function swap(\n address recipient,\n bool zeroForOne,\n int256 amountSpecified,\n uint160 sqrtPriceLimitX96,\n bytes calldata data\n ) external returns (int256 amount0, int256 amount1);\n\n /// @notice Receive token0 and/or token1 and pay it back, plus a fee, in the callback\n /// @dev The caller of this method receives a callback in the form of IUniswapV3FlashCallback#uniswapV3FlashCallback\n /// @dev Can be used to donate underlying tokens pro-rata to currently in-range liquidity providers by calling\n /// with 0 amount{0,1} and sending the donation amount(s) from the callback\n /// @param recipient The address which will receive the token0 and token1 amounts\n /// @param amount0 The amount of token0 to send\n /// @param amount1 The amount of token1 to send\n /// @param data Any data to be passed through to the callback\n function flash(\n address recipient,\n uint256 amount0,\n uint256 amount1,\n bytes calldata data\n ) external;\n\n /// @notice Increase the maximum number of price and liquidity observations that this pool will store\n /// @dev This method is no-op if the pool already has an observationCardinalityNext greater than or equal to\n /// the input observationCardinalityNext.\n /// @param observationCardinalityNext The desired minimum number of observations for the pool to store\n function increaseObservationCardinalityNext(uint16 observationCardinalityNext) external;\n}\n" - }, - "@uniswap/v3-core/contracts/interfaces/pool/IUniswapV3PoolOwnerActions.sol": { - "content": "// SPDX-License-Identifier: GPL-2.0-or-later\npragma solidity >=0.5.0;\n\n/// @title Permissioned pool actions\n/// @notice Contains pool methods that may only be called by the factory owner\ninterface IUniswapV3PoolOwnerActions {\n /// @notice Set the denominator of the protocol's % share of the fees\n /// @param feeProtocol0 new protocol fee for token0 of the pool\n /// @param feeProtocol1 new protocol fee for token1 of the pool\n function setFeeProtocol(uint8 feeProtocol0, uint8 feeProtocol1) external;\n\n /// @notice Collect the protocol fee accrued to the pool\n /// @param recipient The address to which collected protocol fees should be sent\n /// @param amount0Requested The maximum amount of token0 to send, can be 0 to collect fees in only token1\n /// @param amount1Requested The maximum amount of token1 to send, can be 0 to collect fees in only token0\n /// @return amount0 The protocol fee collected in token0\n /// @return amount1 The protocol fee collected in token1\n function collectProtocol(\n address recipient,\n uint128 amount0Requested,\n uint128 amount1Requested\n ) external returns (uint128 amount0, uint128 amount1);\n}\n" - }, - "@uniswap/v3-core/contracts/interfaces/pool/IUniswapV3PoolEvents.sol": { - "content": "// SPDX-License-Identifier: GPL-2.0-or-later\npragma solidity >=0.5.0;\n\n/// @title Events emitted by a pool\n/// @notice Contains all events emitted by the pool\ninterface IUniswapV3PoolEvents {\n /// @notice Emitted exactly once by a pool when #initialize is first called on the pool\n /// @dev Mint/Burn/Swap cannot be emitted by the pool before Initialize\n /// @param sqrtPriceX96 The initial sqrt price of the pool, as a Q64.96\n /// @param tick The initial tick of the pool, i.e. log base 1.0001 of the starting price of the pool\n event Initialize(uint160 sqrtPriceX96, int24 tick);\n\n /// @notice Emitted when liquidity is minted for a given position\n /// @param sender The address that minted the liquidity\n /// @param owner The owner of the position and recipient of any minted liquidity\n /// @param tickLower The lower tick of the position\n /// @param tickUpper The upper tick of the position\n /// @param amount The amount of liquidity minted to the position range\n /// @param amount0 How much token0 was required for the minted liquidity\n /// @param amount1 How much token1 was required for the minted liquidity\n event Mint(\n address sender,\n address indexed owner,\n int24 indexed tickLower,\n int24 indexed tickUpper,\n uint128 amount,\n uint256 amount0,\n uint256 amount1\n );\n\n /// @notice Emitted when fees are collected by the owner of a position\n /// @dev Collect events may be emitted with zero amount0 and amount1 when the caller chooses not to collect fees\n /// @param owner The owner of the position for which fees are collected\n /// @param tickLower The lower tick of the position\n /// @param tickUpper The upper tick of the position\n /// @param amount0 The amount of token0 fees collected\n /// @param amount1 The amount of token1 fees collected\n event Collect(\n address indexed owner,\n address recipient,\n int24 indexed tickLower,\n int24 indexed tickUpper,\n uint128 amount0,\n uint128 amount1\n );\n\n /// @notice Emitted when a position's liquidity is removed\n /// @dev Does not withdraw any fees earned by the liquidity position, which must be withdrawn via #collect\n /// @param owner The owner of the position for which liquidity is removed\n /// @param tickLower The lower tick of the position\n /// @param tickUpper The upper tick of the position\n /// @param amount The amount of liquidity to remove\n /// @param amount0 The amount of token0 withdrawn\n /// @param amount1 The amount of token1 withdrawn\n event Burn(\n address indexed owner,\n int24 indexed tickLower,\n int24 indexed tickUpper,\n uint128 amount,\n uint256 amount0,\n uint256 amount1\n );\n\n /// @notice Emitted by the pool for any swaps between token0 and token1\n /// @param sender The address that initiated the swap call, and that received the callback\n /// @param recipient The address that received the output of the swap\n /// @param amount0 The delta of the token0 balance of the pool\n /// @param amount1 The delta of the token1 balance of the pool\n /// @param sqrtPriceX96 The sqrt(price) of the pool after the swap, as a Q64.96\n /// @param liquidity The liquidity of the pool after the swap\n /// @param tick The log base 1.0001 of price of the pool after the swap\n event Swap(\n address indexed sender,\n address indexed recipient,\n int256 amount0,\n int256 amount1,\n uint160 sqrtPriceX96,\n uint128 liquidity,\n int24 tick\n );\n\n /// @notice Emitted by the pool for any flashes of token0/token1\n /// @param sender The address that initiated the swap call, and that received the callback\n /// @param recipient The address that received the tokens from flash\n /// @param amount0 The amount of token0 that was flashed\n /// @param amount1 The amount of token1 that was flashed\n /// @param paid0 The amount of token0 paid for the flash, which can exceed the amount0 plus the fee\n /// @param paid1 The amount of token1 paid for the flash, which can exceed the amount1 plus the fee\n event Flash(\n address indexed sender,\n address indexed recipient,\n uint256 amount0,\n uint256 amount1,\n uint256 paid0,\n uint256 paid1\n );\n\n /// @notice Emitted by the pool for increases to the number of observations that can be stored\n /// @dev observationCardinalityNext is not the observation cardinality until an observation is written at the index\n /// just before a mint/swap/burn.\n /// @param observationCardinalityNextOld The previous value of the next observation cardinality\n /// @param observationCardinalityNextNew The updated value of the next observation cardinality\n event IncreaseObservationCardinalityNext(\n uint16 observationCardinalityNextOld,\n uint16 observationCardinalityNextNew\n );\n\n /// @notice Emitted when the protocol fee is changed by the pool\n /// @param feeProtocol0Old The previous value of the token0 protocol fee\n /// @param feeProtocol1Old The previous value of the token1 protocol fee\n /// @param feeProtocol0New The updated value of the token0 protocol fee\n /// @param feeProtocol1New The updated value of the token1 protocol fee\n event SetFeeProtocol(uint8 feeProtocol0Old, uint8 feeProtocol1Old, uint8 feeProtocol0New, uint8 feeProtocol1New);\n\n /// @notice Emitted when the collected protocol fees are withdrawn by the factory owner\n /// @param sender The address that collects the protocol fees\n /// @param recipient The address that receives the collected protocol fees\n /// @param amount0 The amount of token0 protocol fees that is withdrawn\n /// @param amount0 The amount of token1 protocol fees that is withdrawn\n event CollectProtocol(address indexed sender, address indexed recipient, uint128 amount0, uint128 amount1);\n}\n" - }, - "solidity/for-test/UniV3PairManagerForTest.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '@openzeppelin/contracts/token/ERC20/ERC20.sol';\nimport '@uniswap/v3-core/contracts/interfaces/IUniswapV3Pool.sol';\n\nimport '../contracts/libraries/LiquidityAmounts.sol';\nimport '../contracts/libraries/FixedPoint96.sol';\nimport '../contracts/libraries/FullMath.sol';\nimport '../contracts/libraries/TickMath.sol';\nimport '../contracts/UniV3PairManager.sol';\nimport '../interfaces/external/IWeth9.sol';\nimport '../interfaces/IUniV3PairManager.sol';\n\ncontract UniV3PairManagerForTest is UniV3PairManager {\n constructor(address _pool, address _governance) UniV3PairManager(_pool, _governance) {}\n\n function internalAddLiquidity(\n uint256 amount0Desired,\n uint256 amount1Desired,\n uint256 amount0Min,\n uint256 amount1Min\n )\n external\n returns (\n uint128 liquidity,\n uint256 amount0,\n uint256 amount1\n )\n {\n return _addLiquidity(amount0Desired, amount1Desired, amount0Min, amount1Min);\n }\n\n function internalPay(\n address token,\n address payer,\n address recipient,\n uint256 value\n ) external {\n return _pay(token, payer, recipient, value);\n }\n\n function internalMint(address dst, uint256 amount) external {\n return _mint(dst, amount);\n }\n\n function internalBurn(address dst, uint256 amount) external {\n return _burn(dst, amount);\n }\n\n function internalTransferTokens(\n address src,\n address dst,\n uint256 amount\n ) external {\n _transferTokens(src, dst, amount);\n }\n\n function internalSafeTransferFrom(\n address token,\n address from,\n address to,\n uint256 value\n ) external {\n _safeTransferFrom(token, from, to, value);\n }\n\n receive() external payable {}\n}\n" - }, - "@openzeppelin/contracts/token/ERC20/ERC20.sol": { - "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\nimport \"./IERC20.sol\";\nimport \"./extensions/IERC20Metadata.sol\";\nimport \"../../utils/Context.sol\";\n\n/**\n * @dev Implementation of the {IERC20} interface.\n *\n * This implementation is agnostic to the way tokens are created. This means\n * that a supply mechanism has to be added in a derived contract using {_mint}.\n * For a generic mechanism see {ERC20PresetMinterPauser}.\n *\n * TIP: For a detailed writeup see our guide\n * https://forum.zeppelin.solutions/t/how-to-implement-erc20-supply-mechanisms/226[How\n * to implement supply mechanisms].\n *\n * We have followed general OpenZeppelin Contracts guidelines: functions revert\n * instead returning `false` on failure. This behavior is nonetheless\n * conventional and does not conflict with the expectations of ERC20\n * applications.\n *\n * Additionally, an {Approval} event is emitted on calls to {transferFrom}.\n * This allows applications to reconstruct the allowance for all accounts just\n * by listening to said events. Other implementations of the EIP may not emit\n * these events, as it isn't required by the specification.\n *\n * Finally, the non-standard {decreaseAllowance} and {increaseAllowance}\n * functions have been added to mitigate the well-known issues around setting\n * allowances. See {IERC20-approve}.\n */\ncontract ERC20 is Context, IERC20, IERC20Metadata {\n mapping(address => uint256) private _balances;\n\n mapping(address => mapping(address => uint256)) private _allowances;\n\n uint256 private _totalSupply;\n\n string private _name;\n string private _symbol;\n\n /**\n * @dev Sets the values for {name} and {symbol}.\n *\n * The default value of {decimals} is 18. To select a different value for\n * {decimals} you should overload it.\n *\n * All two of these values are immutable: they can only be set once during\n * construction.\n */\n constructor(string memory name_, string memory symbol_) {\n _name = name_;\n _symbol = symbol_;\n }\n\n /**\n * @dev Returns the name of the token.\n */\n function name() public view virtual override returns (string memory) {\n return _name;\n }\n\n /**\n * @dev Returns the symbol of the token, usually a shorter version of the\n * name.\n */\n function symbol() public view virtual override returns (string memory) {\n return _symbol;\n }\n\n /**\n * @dev Returns the number of decimals used to get its user representation.\n * For example, if `decimals` equals `2`, a balance of `505` tokens should\n * be displayed to a user as `5.05` (`505 / 10 ** 2`).\n *\n * Tokens usually opt for a value of 18, imitating the relationship between\n * Ether and Wei. This is the value {ERC20} uses, unless this function is\n * overridden;\n *\n * NOTE: This information is only used for _display_ purposes: it in\n * no way affects any of the arithmetic of the contract, including\n * {IERC20-balanceOf} and {IERC20-transfer}.\n */\n function decimals() public view virtual override returns (uint8) {\n return 18;\n }\n\n /**\n * @dev See {IERC20-totalSupply}.\n */\n function totalSupply() public view virtual override returns (uint256) {\n return _totalSupply;\n }\n\n /**\n * @dev See {IERC20-balanceOf}.\n */\n function balanceOf(address account) public view virtual override returns (uint256) {\n return _balances[account];\n }\n\n /**\n * @dev See {IERC20-transfer}.\n *\n * Requirements:\n *\n * - `recipient` cannot be the zero address.\n * - the caller must have a balance of at least `amount`.\n */\n function transfer(address recipient, uint256 amount) public virtual override returns (bool) {\n _transfer(_msgSender(), recipient, amount);\n return true;\n }\n\n /**\n * @dev See {IERC20-allowance}.\n */\n function allowance(address owner, address spender) public view virtual override returns (uint256) {\n return _allowances[owner][spender];\n }\n\n /**\n * @dev See {IERC20-approve}.\n *\n * Requirements:\n *\n * - `spender` cannot be the zero address.\n */\n function approve(address spender, uint256 amount) public virtual override returns (bool) {\n _approve(_msgSender(), spender, amount);\n return true;\n }\n\n /**\n * @dev See {IERC20-transferFrom}.\n *\n * Emits an {Approval} event indicating the updated allowance. This is not\n * required by the EIP. See the note at the beginning of {ERC20}.\n *\n * Requirements:\n *\n * - `sender` and `recipient` cannot be the zero address.\n * - `sender` must have a balance of at least `amount`.\n * - the caller must have allowance for ``sender``'s tokens of at least\n * `amount`.\n */\n function transferFrom(\n address sender,\n address recipient,\n uint256 amount\n ) public virtual override returns (bool) {\n _transfer(sender, recipient, amount);\n\n uint256 currentAllowance = _allowances[sender][_msgSender()];\n require(currentAllowance >= amount, \"ERC20: transfer amount exceeds allowance\");\n unchecked {\n _approve(sender, _msgSender(), currentAllowance - amount);\n }\n\n return true;\n }\n\n /**\n * @dev Atomically increases the allowance granted to `spender` by the caller.\n *\n * This is an alternative to {approve} that can be used as a mitigation for\n * problems described in {IERC20-approve}.\n *\n * Emits an {Approval} event indicating the updated allowance.\n *\n * Requirements:\n *\n * - `spender` cannot be the zero address.\n */\n function increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool) {\n _approve(_msgSender(), spender, _allowances[_msgSender()][spender] + addedValue);\n return true;\n }\n\n /**\n * @dev Atomically decreases the allowance granted to `spender` by the caller.\n *\n * This is an alternative to {approve} that can be used as a mitigation for\n * problems described in {IERC20-approve}.\n *\n * Emits an {Approval} event indicating the updated allowance.\n *\n * Requirements:\n *\n * - `spender` cannot be the zero address.\n * - `spender` must have allowance for the caller of at least\n * `subtractedValue`.\n */\n function decreaseAllowance(address spender, uint256 subtractedValue) public virtual returns (bool) {\n uint256 currentAllowance = _allowances[_msgSender()][spender];\n require(currentAllowance >= subtractedValue, \"ERC20: decreased allowance below zero\");\n unchecked {\n _approve(_msgSender(), spender, currentAllowance - subtractedValue);\n }\n\n return true;\n }\n\n /**\n * @dev Moves `amount` of tokens from `sender` to `recipient`.\n *\n * This internal function is equivalent to {transfer}, and can be used to\n * e.g. implement automatic token fees, slashing mechanisms, etc.\n *\n * Emits a {Transfer} event.\n *\n * Requirements:\n *\n * - `sender` cannot be the zero address.\n * - `recipient` cannot be the zero address.\n * - `sender` must have a balance of at least `amount`.\n */\n function _transfer(\n address sender,\n address recipient,\n uint256 amount\n ) internal virtual {\n require(sender != address(0), \"ERC20: transfer from the zero address\");\n require(recipient != address(0), \"ERC20: transfer to the zero address\");\n\n _beforeTokenTransfer(sender, recipient, amount);\n\n uint256 senderBalance = _balances[sender];\n require(senderBalance >= amount, \"ERC20: transfer amount exceeds balance\");\n unchecked {\n _balances[sender] = senderBalance - amount;\n }\n _balances[recipient] += amount;\n\n emit Transfer(sender, recipient, amount);\n\n _afterTokenTransfer(sender, recipient, amount);\n }\n\n /** @dev Creates `amount` tokens and assigns them to `account`, increasing\n * the total supply.\n *\n * Emits a {Transfer} event with `from` set to the zero address.\n *\n * Requirements:\n *\n * - `account` cannot be the zero address.\n */\n function _mint(address account, uint256 amount) internal virtual {\n require(account != address(0), \"ERC20: mint to the zero address\");\n\n _beforeTokenTransfer(address(0), account, amount);\n\n _totalSupply += amount;\n _balances[account] += amount;\n emit Transfer(address(0), account, amount);\n\n _afterTokenTransfer(address(0), account, amount);\n }\n\n /**\n * @dev Destroys `amount` tokens from `account`, reducing the\n * total supply.\n *\n * Emits a {Transfer} event with `to` set to the zero address.\n *\n * Requirements:\n *\n * - `account` cannot be the zero address.\n * - `account` must have at least `amount` tokens.\n */\n function _burn(address account, uint256 amount) internal virtual {\n require(account != address(0), \"ERC20: burn from the zero address\");\n\n _beforeTokenTransfer(account, address(0), amount);\n\n uint256 accountBalance = _balances[account];\n require(accountBalance >= amount, \"ERC20: burn amount exceeds balance\");\n unchecked {\n _balances[account] = accountBalance - amount;\n }\n _totalSupply -= amount;\n\n emit Transfer(account, address(0), amount);\n\n _afterTokenTransfer(account, address(0), amount);\n }\n\n /**\n * @dev Sets `amount` as the allowance of `spender` over the `owner` s tokens.\n *\n * This internal function is equivalent to `approve`, and can be used to\n * e.g. set automatic allowances for certain subsystems, etc.\n *\n * Emits an {Approval} event.\n *\n * Requirements:\n *\n * - `owner` cannot be the zero address.\n * - `spender` cannot be the zero address.\n */\n function _approve(\n address owner,\n address spender,\n uint256 amount\n ) internal virtual {\n require(owner != address(0), \"ERC20: approve from the zero address\");\n require(spender != address(0), \"ERC20: approve to the zero address\");\n\n _allowances[owner][spender] = amount;\n emit Approval(owner, spender, amount);\n }\n\n /**\n * @dev Hook that is called before any transfer of tokens. This includes\n * minting and burning.\n *\n * Calling conditions:\n *\n * - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens\n * will be transferred to `to`.\n * - when `from` is zero, `amount` tokens will be minted for `to`.\n * - when `to` is zero, `amount` of ``from``'s tokens will be burned.\n * - `from` and `to` are never both zero.\n *\n * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].\n */\n function _beforeTokenTransfer(\n address from,\n address to,\n uint256 amount\n ) internal virtual {}\n\n /**\n * @dev Hook that is called after any transfer of tokens. This includes\n * minting and burning.\n *\n * Calling conditions:\n *\n * - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens\n * has been transferred to `to`.\n * - when `from` is zero, `amount` tokens have been minted for `to`.\n * - when `to` is zero, `amount` of ``from``'s tokens have been burned.\n * - `from` and `to` are never both zero.\n *\n * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].\n */\n function _afterTokenTransfer(\n address from,\n address to,\n uint256 amount\n ) internal virtual {}\n}\n" - }, - "solidity/contracts/libraries/LiquidityAmounts.sol": { - "content": "// SPDX-License-Identifier: GPL-2.0-or-later\npragma solidity >=0.8.4 <0.9.0;\n\nimport './FullMath.sol';\nimport './FixedPoint96.sol';\n\n// solhint-disable\nlibrary LiquidityAmounts {\n function toUint128(uint256 x) private pure returns (uint128 y) {\n require((y = uint128(x)) == x);\n }\n\n function getLiquidityForAmount0(\n uint160 sqrtRatioAX96,\n uint160 sqrtRatioBX96,\n uint256 amount0\n ) internal pure returns (uint128 liquidity) {\n if (sqrtRatioAX96 > sqrtRatioBX96) (sqrtRatioAX96, sqrtRatioBX96) = (sqrtRatioBX96, sqrtRatioAX96);\n uint256 intermediate = FullMath.mulDiv(sqrtRatioAX96, sqrtRatioBX96, FixedPoint96.Q96);\n return toUint128(FullMath.mulDiv(amount0, intermediate, sqrtRatioBX96 - sqrtRatioAX96));\n }\n\n function getLiquidityForAmount1(\n uint160 sqrtRatioAX96,\n uint160 sqrtRatioBX96,\n uint256 amount1\n ) internal pure returns (uint128 liquidity) {\n if (sqrtRatioAX96 > sqrtRatioBX96) (sqrtRatioAX96, sqrtRatioBX96) = (sqrtRatioBX96, sqrtRatioAX96);\n return toUint128(FullMath.mulDiv(amount1, FixedPoint96.Q96, sqrtRatioBX96 - sqrtRatioAX96));\n }\n\n function getLiquidityForAmounts(\n uint160 sqrtRatioX96,\n uint160 sqrtRatioAX96,\n uint160 sqrtRatioBX96,\n uint256 amount0,\n uint256 amount1\n ) internal pure returns (uint128 liquidity) {\n if (sqrtRatioAX96 > sqrtRatioBX96) (sqrtRatioAX96, sqrtRatioBX96) = (sqrtRatioBX96, sqrtRatioAX96);\n\n if (sqrtRatioX96 <= sqrtRatioAX96) {\n liquidity = getLiquidityForAmount0(sqrtRatioAX96, sqrtRatioBX96, amount0);\n } else if (sqrtRatioX96 < sqrtRatioBX96) {\n uint128 liquidity0 = getLiquidityForAmount0(sqrtRatioX96, sqrtRatioBX96, amount0);\n uint128 liquidity1 = getLiquidityForAmount1(sqrtRatioAX96, sqrtRatioX96, amount1);\n\n liquidity = liquidity0 < liquidity1 ? liquidity0 : liquidity1;\n } else {\n liquidity = getLiquidityForAmount1(sqrtRatioAX96, sqrtRatioBX96, amount1);\n }\n }\n\n function getAmount0ForLiquidity(\n uint160 sqrtRatioAX96,\n uint160 sqrtRatioBX96,\n uint128 liquidity\n ) internal pure returns (uint256 amount0) {\n if (sqrtRatioAX96 > sqrtRatioBX96) (sqrtRatioAX96, sqrtRatioBX96) = (sqrtRatioBX96, sqrtRatioAX96);\n\n return FullMath.mulDiv(uint256(liquidity) << FixedPoint96.RESOLUTION, sqrtRatioBX96 - sqrtRatioAX96, sqrtRatioBX96) / sqrtRatioAX96;\n }\n\n function getAmount1ForLiquidity(\n uint160 sqrtRatioAX96,\n uint160 sqrtRatioBX96,\n uint128 liquidity\n ) internal pure returns (uint256 amount1) {\n if (sqrtRatioAX96 > sqrtRatioBX96) (sqrtRatioAX96, sqrtRatioBX96) = (sqrtRatioBX96, sqrtRatioAX96);\n\n return FullMath.mulDiv(liquidity, sqrtRatioBX96 - sqrtRatioAX96, FixedPoint96.Q96);\n }\n\n function getAmountsForLiquidity(\n uint160 sqrtRatioX96,\n uint160 sqrtRatioAX96,\n uint160 sqrtRatioBX96,\n uint128 liquidity\n ) internal pure returns (uint256 amount0, uint256 amount1) {\n if (sqrtRatioAX96 > sqrtRatioBX96) (sqrtRatioAX96, sqrtRatioBX96) = (sqrtRatioBX96, sqrtRatioAX96);\n\n if (sqrtRatioX96 <= sqrtRatioAX96) {\n amount0 = getAmount0ForLiquidity(sqrtRatioAX96, sqrtRatioBX96, liquidity);\n } else if (sqrtRatioX96 < sqrtRatioBX96) {\n amount0 = getAmount0ForLiquidity(sqrtRatioX96, sqrtRatioBX96, liquidity);\n amount1 = getAmount1ForLiquidity(sqrtRatioAX96, sqrtRatioX96, liquidity);\n } else {\n amount1 = getAmount1ForLiquidity(sqrtRatioAX96, sqrtRatioBX96, liquidity);\n }\n }\n}\n" - }, - "solidity/contracts/libraries/FixedPoint96.sol": { - "content": "// SPDX-License-Identifier: GPL-2.0-or-later\npragma solidity >=0.8.4 <0.9.0;\n\nlibrary FixedPoint96 {\n // solhint-disable\n uint8 internal constant RESOLUTION = 96;\n uint256 internal constant Q96 = 0x1000000000000000000000000;\n}\n" - }, - "solidity/contracts/UniV3PairManager.sol": { - "content": "// SPDX-License-Identifier: MIT\n\n/*\n\nCoded for The Keep3r Network with ♥ by\n\n██████╗░███████╗███████╗██╗  ░██╗░░░░░░░██╗░█████╗░███╗░░██╗██████╗░███████╗██████╗░██╗░░░░░░█████╗░███╗░░██╗██████╗░\n██╔══██╗██╔════╝██╔════╝██║  ░██║░░██╗░░██║██╔══██╗████╗░██║██╔══██╗██╔════╝██╔══██╗██║░░░░░██╔══██╗████╗░██║██╔══██╗\n██║░░██║█████╗░░█████╗░░██║  ░╚██╗████╗██╔╝██║░░██║██╔██╗██║██║░░██║█████╗░░██████╔╝██║░░░░░███████║██╔██╗██║██║░░██║\n██║░░██║██╔══╝░░██╔══╝░░██║  ░░████╔═████║░██║░░██║██║╚████║██║░░██║██╔══╝░░██╔══██╗██║░░░░░██╔══██║██║╚████║██║░░██║\n██████╔╝███████╗██║░░░░░██║  ░░╚██╔╝░╚██╔╝░╚█████╔╝██║░╚███║██████╔╝███████╗██║░░██║███████╗██║░░██║██║░╚███║██████╔╝\n╚═════╝░╚══════╝╚═╝░░░░░╚═╝  ░░░╚═╝░░░╚═╝░░░╚════╝░╚═╝░░╚══╝╚═════╝░╚══════╝╚═╝░░╚═╝╚══════╝╚═╝░░╚═╝╚═╝░░╚══╝╚═════╝░\n\nhttps://defi.sucks\n\n*/\n\npragma solidity >=0.8.4 <0.9.0;\n\nimport '@openzeppelin/contracts/token/ERC20/ERC20.sol';\nimport '@uniswap/v3-core/contracts/interfaces/IUniswapV3Pool.sol';\n\nimport './libraries/LiquidityAmounts.sol';\nimport './libraries/FixedPoint96.sol';\nimport './libraries/FullMath.sol';\nimport './libraries/TickMath.sol';\n\nimport '../interfaces/external/IWeth9.sol';\nimport '../interfaces/IUniV3PairManager.sol';\n\nimport './peripherals/Governable.sol';\n\ncontract UniV3PairManager is IUniV3PairManager, Governable {\n /// @inheritdoc IERC20Metadata\n string public override name;\n\n /// @inheritdoc IERC20Metadata\n string public override symbol;\n\n /// @inheritdoc IERC20\n uint256 public override totalSupply;\n\n /// @inheritdoc IPairManager\n address public immutable override factory;\n\n /// @inheritdoc IPairManager\n address public immutable override token0;\n\n /// @inheritdoc IPairManager\n address public immutable override token1;\n\n /// @inheritdoc IPairManager\n address public immutable override pool;\n\n /// @inheritdoc IUniV3PairManager\n uint24 public immutable override fee;\n\n /// @inheritdoc IUniV3PairManager\n uint160 public immutable override sqrtRatioAX96;\n\n /// @inheritdoc IUniV3PairManager\n uint160 public immutable override sqrtRatioBX96;\n\n /// @inheritdoc IUniV3PairManager\n int24 public immutable override tickLower;\n\n /// @inheritdoc IUniV3PairManager\n int24 public immutable override tickUpper;\n\n /// @inheritdoc IUniV3PairManager\n int24 public immutable override tickSpacing;\n\n /// @notice Uniswap's maximum tick\n /// @dev Due to tick spacing, pools with different fees may have differences between _MAX_TICK and tickUpper. Use tickUpper to find the max tick of the pool.\n int24 private constant _MAX_TICK = 887272;\n\n /// @inheritdoc IERC20Metadata\n //solhint-disable-next-line const-name-snakecase\n uint8 public constant override decimals = 18;\n\n /// @inheritdoc IERC20\n mapping(address => mapping(address => uint256)) public override allowance;\n\n /// @inheritdoc IERC20\n mapping(address => uint256) public override balanceOf;\n\n /// @notice Struct that contains token0, token1, and fee of the Uniswap pool\n PoolKey private _poolKey;\n\n constructor(address _pool, address _governance) Governable(_governance) {\n uint24 _fee = IUniswapV3Pool(_pool).fee();\n address _token0 = IUniswapV3Pool(_pool).token0();\n address _token1 = IUniswapV3Pool(_pool).token1();\n int24 _tickSpacing = IUniswapV3Pool(_pool).tickSpacing();\n int24 _tickUpper = _MAX_TICK - (_MAX_TICK % _tickSpacing);\n int24 _tickLower = -_tickUpper;\n\n factory = msg.sender;\n pool = _pool;\n fee = _fee;\n tickSpacing = _tickSpacing;\n tickUpper = _tickUpper;\n tickLower = _tickLower;\n token0 = _token0;\n token1 = _token1;\n name = string(abi.encodePacked('Keep3rLP - ', ERC20(_token0).symbol(), '/', ERC20(_token1).symbol()));\n symbol = string(abi.encodePacked('kLP-', ERC20(_token0).symbol(), '/', ERC20(_token1).symbol()));\n\n sqrtRatioAX96 = TickMath.getSqrtRatioAtTick(_tickLower);\n sqrtRatioBX96 = TickMath.getSqrtRatioAtTick(_tickUpper);\n _poolKey = PoolKey({token0: _token0, token1: _token1, fee: _fee});\n }\n\n // This low-level function should be called from a contract which performs important safety checks\n /// @inheritdoc IUniV3PairManager\n function mint(\n uint256 amount0Desired,\n uint256 amount1Desired,\n uint256 amount0Min,\n uint256 amount1Min,\n address to\n ) external override returns (uint128 liquidity) {\n (liquidity, , ) = _addLiquidity(amount0Desired, amount1Desired, amount0Min, amount1Min);\n _mint(to, liquidity);\n }\n\n /// @inheritdoc IUniV3PairManager\n function uniswapV3MintCallback(\n uint256 amount0Owed,\n uint256 amount1Owed,\n bytes calldata data\n ) external override {\n MintCallbackData memory decoded = abi.decode(data, (MintCallbackData));\n if (msg.sender != pool) revert OnlyPool();\n if (amount0Owed > 0) _pay(decoded._poolKey.token0, decoded.payer, pool, amount0Owed);\n if (amount1Owed > 0) _pay(decoded._poolKey.token1, decoded.payer, pool, amount1Owed);\n }\n\n /// @inheritdoc IUniV3PairManager\n function burn(\n uint128 liquidity,\n uint256 amount0Min,\n uint256 amount1Min,\n address to\n ) external override returns (uint256 amount0, uint256 amount1) {\n (amount0, amount1) = IUniswapV3Pool(pool).burn(tickLower, tickUpper, liquidity);\n\n if (amount0 < amount0Min || amount1 < amount1Min) revert ExcessiveSlippage();\n\n IUniswapV3Pool(pool).collect(to, tickLower, tickUpper, uint128(amount0), uint128(amount1));\n _burn(msg.sender, liquidity);\n }\n\n /// @inheritdoc IUniV3PairManager\n function collect() external override onlyGovernance returns (uint256 amount0, uint256 amount1) {\n (, , , uint128 tokensOwed0, uint128 tokensOwed1) = IUniswapV3Pool(pool).positions(\n keccak256(abi.encodePacked(address(this), tickLower, tickUpper))\n );\n (amount0, amount1) = IUniswapV3Pool(pool).collect(governance, tickLower, tickUpper, tokensOwed0, tokensOwed1);\n }\n\n /// @inheritdoc IUniV3PairManager\n function position()\n external\n view\n override\n returns (\n uint128 liquidity,\n uint256 feeGrowthInside0LastX128,\n uint256 feeGrowthInside1LastX128,\n uint128 tokensOwed0,\n uint128 tokensOwed1\n )\n {\n (liquidity, feeGrowthInside0LastX128, feeGrowthInside1LastX128, tokensOwed0, tokensOwed1) = IUniswapV3Pool(pool).positions(\n keccak256(abi.encodePacked(address(this), tickLower, tickUpper))\n );\n }\n\n /// @inheritdoc IERC20\n function approve(address spender, uint256 amount) external override returns (bool) {\n allowance[msg.sender][spender] = amount;\n\n emit Approval(msg.sender, spender, amount);\n return true;\n }\n\n /// @inheritdoc IERC20\n function transfer(address to, uint256 amount) external override returns (bool) {\n _transferTokens(msg.sender, to, amount);\n return true;\n }\n\n /// @inheritdoc IERC20\n function transferFrom(\n address from,\n address to,\n uint256 amount\n ) external override returns (bool) {\n address spender = msg.sender;\n uint256 spenderAllowance = allowance[from][spender];\n\n if (spender != from && spenderAllowance != type(uint256).max) {\n uint256 newAllowance = spenderAllowance - amount;\n allowance[from][spender] = newAllowance;\n\n emit Approval(from, spender, newAllowance);\n }\n\n _transferTokens(from, to, amount);\n return true;\n }\n\n /// @notice Adds liquidity to an initialized pool\n /// @dev Reverts if the returned amount0 is less than amount0Min or if amount1 is less than amount1Min\n /// @dev This function calls the mint function of the corresponding Uniswap pool, which in turn calls UniswapV3Callback\n /// @param amount0Desired The amount of token0 we would like to provide\n /// @param amount1Desired The amount of token1 we would like to provide\n /// @param amount0Min The minimum amount of token0 we want to provide\n /// @param amount1Min The minimum amount of token1 we want to provide\n /// @return liquidity The calculated liquidity we get for the token amounts we provided\n /// @return amount0 The amount of token0 we ended up providing\n /// @return amount1 The amount of token1 we ended up providing\n function _addLiquidity(\n uint256 amount0Desired,\n uint256 amount1Desired,\n uint256 amount0Min,\n uint256 amount1Min\n )\n internal\n returns (\n uint128 liquidity,\n uint256 amount0,\n uint256 amount1\n )\n {\n (uint160 sqrtPriceX96, , , , , , ) = IUniswapV3Pool(pool).slot0();\n\n liquidity = LiquidityAmounts.getLiquidityForAmounts(sqrtPriceX96, sqrtRatioAX96, sqrtRatioBX96, amount0Desired, amount1Desired);\n\n (amount0, amount1) = IUniswapV3Pool(pool).mint(\n address(this),\n tickLower,\n tickUpper,\n liquidity,\n abi.encode(MintCallbackData({_poolKey: _poolKey, payer: msg.sender}))\n );\n\n if (amount0 < amount0Min || amount1 < amount1Min) revert ExcessiveSlippage();\n }\n\n /// @notice Transfers the passed-in token from the payer to the recipient for the corresponding value\n /// @param token The token to be transferred to the recipient\n /// @param from The address of the payer\n /// @param to The address of the passed-in tokens recipient\n /// @param value How much of that token to be transferred from payer to the recipient\n function _pay(\n address token,\n address from,\n address to,\n uint256 value\n ) internal {\n _safeTransferFrom(token, from, to, value);\n }\n\n /// @notice Mints Keep3r credits to the passed-in address of recipient and increases total supply of Keep3r credits by the corresponding amount\n /// @param to The recipient of the Keep3r credits\n /// @param amount The amount Keep3r credits to be minted to the recipient\n function _mint(address to, uint256 amount) internal {\n totalSupply += amount;\n balanceOf[to] += amount;\n emit Transfer(address(0), to, amount);\n }\n\n /// @notice Burns Keep3r credits to the passed-in address of recipient and reduces total supply of Keep3r credits by the corresponding amount\n /// @param to The address that will get its Keep3r credits burned\n /// @param amount The amount Keep3r credits to be burned from the recipient/recipient\n function _burn(address to, uint256 amount) internal {\n totalSupply -= amount;\n balanceOf[to] -= amount;\n emit Transfer(to, address(0), amount);\n }\n\n /// @notice Transfers amount of Keep3r credits between two addresses\n /// @param from The user that transfers the Keep3r credits\n /// @param to The user that receives the Keep3r credits\n /// @param amount The amount of Keep3r credits to be transferred\n function _transferTokens(\n address from,\n address to,\n uint256 amount\n ) internal {\n balanceOf[from] -= amount;\n balanceOf[to] += amount;\n\n emit Transfer(from, to, amount);\n }\n\n /// @notice Transfers the passed-in token from the specified \"from\" to the specified \"to\" for the corresponding value\n /// @dev Reverts with IUniV3PairManager#UnsuccessfulTransfer if the transfer was not successful,\n /// or if the passed data length is different than 0 and the decoded data is not a boolean\n /// @param token The token to be transferred to the specified \"to\"\n /// @param from The address which is going to transfer the tokens\n /// @param value How much of that token to be transferred from \"from\" to \"to\"\n function _safeTransferFrom(\n address token,\n address from,\n address to,\n uint256 value\n ) internal {\n // solhint-disable-next-line avoid-low-level-calls\n (bool success, bytes memory data) = token.call(abi.encodeWithSelector(IERC20.transferFrom.selector, from, to, value));\n if (!success || (data.length != 0 && !abi.decode(data, (bool)))) revert UnsuccessfulTransfer();\n }\n}\n" - }, - "solidity/interfaces/external/IWeth9.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '@openzeppelin/contracts/token/ERC20/IERC20.sol';\n\ninterface IWeth9 is IERC20 {\n function deposit() external payable;\n\n function withdraw(uint256) external;\n}\n" - }, - "solidity/interfaces/IUniV3PairManager.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport './IPairManager.sol';\nimport '@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol';\nimport './peripherals/IGovernable.sol';\n\n/// @title Pair Manager contract\n/// @notice Creates a UniswapV3 position, and tokenizes in an ERC20 manner\n/// so that the user can use it as liquidity for a Keep3rJob\ninterface IUniV3PairManager is IGovernable, IPairManager {\n // Structs\n struct PoolKey {\n address token0;\n address token1;\n uint24 fee;\n }\n\n /// @notice The data to be decoded by the UniswapV3MintCallback function\n struct MintCallbackData {\n PoolKey _poolKey; // Struct that contains token0, token1, and fee of the pool passed into the constructor\n address payer; // The address of the payer, which will be the msg.sender of the mint function\n }\n\n // Variables\n\n /// @notice The fee of the Uniswap pool passed into the constructor\n /// @return _fee The fee of the Uniswap pool passed into the constructor\n function fee() external view returns (uint24 _fee);\n\n /// @notice Highest tick in the Uniswap's curve\n /// @return _tickUpper The highest tick in the Uniswap's curve\n function tickUpper() external view returns (int24 _tickUpper);\n\n /// @notice Lowest tick in the Uniswap's curve\n /// @return _tickLower The lower tick in the Uniswap's curve\n function tickLower() external view returns (int24 _tickLower);\n\n /// @notice The pair tick spacing\n /// @return _tickSpacing The pair tick spacing\n function tickSpacing() external view returns (int24 _tickSpacing);\n\n /// @notice The sqrtRatioAX96 at the lowest tick (-887200) of the Uniswap pool\n /// @return _sqrtPriceA96 A Fixed point Q64.96 number representing the sqrt of the ratio of the two assets (token1/token0)\n /// at the lowest tick\n function sqrtRatioAX96() external view returns (uint160 _sqrtPriceA96);\n\n /// @notice The sqrtRatioBX96 at the highest tick (887200) of the Uniswap pool\n /// @return _sqrtPriceBX96 A Fixed point Q64.96 number representing the sqrt of the ratio of the two assets (token1/token0)\n /// at the highest tick\n function sqrtRatioBX96() external view returns (uint160 _sqrtPriceBX96);\n\n // Errors\n\n /// @notice Throws when the caller of the function is not the pool\n error OnlyPool();\n\n /// @notice Throws when the slippage exceeds what the user is comfortable with\n error ExcessiveSlippage();\n\n /// @notice Throws when a transfer is unsuccessful\n error UnsuccessfulTransfer();\n\n // Methods\n\n /// @notice This function is called after a user calls IUniV3PairManager#mint function\n /// It ensures that any tokens owed to the pool are paid by the msg.sender of IUniV3PairManager#mint function\n /// @param amount0Owed The amount of token0 due to the pool for the minted liquidity\n /// @param amount1Owed The amount of token1 due to the pool for the minted liquidity\n /// @param data The encoded token0, token1, fee (_poolKey) and the payer (msg.sender) of the IUniV3PairManager#mint function\n function uniswapV3MintCallback(\n uint256 amount0Owed,\n uint256 amount1Owed,\n bytes calldata data\n ) external;\n\n /// @notice Mints kLP tokens to an address according to the liquidity the msg.sender provides to the UniswapV3 pool\n /// @dev Triggers UniV3PairManager#uniswapV3MintCallback\n /// @param amount0Desired The amount of token0 we would like to provide\n /// @param amount1Desired The amount of token1 we would like to provide\n /// @param amount0Min The minimum amount of token0 we want to provide\n /// @param amount1Min The minimum amount of token1 we want to provide\n /// @param to The address to which the kLP tokens are going to be minted to\n /// @return liquidity kLP tokens sent in exchange for the provision of tokens\n function mint(\n uint256 amount0Desired,\n uint256 amount1Desired,\n uint256 amount0Min,\n uint256 amount1Min,\n address to\n ) external returns (uint128 liquidity);\n\n /// @notice Returns the pair manager's position in the corresponding UniswapV3 pool\n /// @return liquidity The amount of liquidity provided to the UniswapV3 pool by the pair manager\n /// @return feeGrowthInside0LastX128 The fee growth of token0 as of the last action on the individual position\n /// @return feeGrowthInside1LastX128 The fee growth of token1 as of the last action on the individual position\n /// @return tokensOwed0 The uncollected amount of token0 owed to the position as of the last computation\n /// @return tokensOwed1 The uncollected amount of token1 owed to the position as of the last computation\n function position()\n external\n view\n returns (\n uint128 liquidity,\n uint256 feeGrowthInside0LastX128,\n uint256 feeGrowthInside1LastX128,\n uint128 tokensOwed0,\n uint128 tokensOwed1\n );\n\n /// @notice Calls the UniswapV3 pool's collect function, which collects up to a maximum amount of fees\n // owed to a specific position to the recipient, in this case, that recipient is the pair manager\n /// @dev The collected fees will be sent to governance\n /// @return amount0 The amount of fees collected in token0\n /// @return amount1 The amount of fees collected in token1\n function collect() external returns (uint256 amount0, uint256 amount1);\n\n /// @notice Burns the corresponding amount of kLP tokens from the msg.sender and withdraws the specified liquidity\n // in the entire range\n /// @param liquidity The amount of liquidity to be burned\n /// @param amount0Min The minimum amount of token0 we want to send to the recipient (to)\n /// @param amount1Min The minimum amount of token1 we want to send to the recipient (to)\n /// @param to The address that will receive the due fees\n /// @return amount0 The calculated amount of token0 that will be sent to the recipient\n /// @return amount1 The calculated amount of token1 that will be sent to the recipient\n function burn(\n uint128 liquidity,\n uint256 amount0Min,\n uint256 amount1Min,\n address to\n ) external returns (uint256 amount0, uint256 amount1);\n}\n" - }, - "@openzeppelin/contracts/utils/Context.sol": { - "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Provides information about the current execution context, including the\n * sender of the transaction and its data. While these are generally available\n * via msg.sender and msg.data, they should not be accessed in such a direct\n * manner, since when dealing with meta-transactions the account sending and\n * paying for execution may not be the actual sender (as far as an application\n * is concerned).\n *\n * This contract is only required for intermediate, library-like contracts.\n */\nabstract contract Context {\n function _msgSender() internal view virtual returns (address) {\n return msg.sender;\n }\n\n function _msgData() internal view virtual returns (bytes calldata) {\n return msg.data;\n }\n}\n" - }, - "solidity/interfaces/IPairManagerFactory.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport './peripherals/IGovernable.sol';\n\n/// @title Factory of Pair Managers\n/// @notice This contract creates new pair managers\ninterface IPairManagerFactory is IGovernable {\n // Variables\n\n /// @notice Maps the address of a Uniswap pool, to the address of the corresponding PairManager\n /// For example, the uniswap address of DAI-WETH, will return the Keep3r/DAI-WETH pair manager address\n /// @param _pool The address of the Uniswap pool\n /// @return _pairManager The address of the corresponding pair manager\n function pairManagers(address _pool) external view returns (address _pairManager);\n\n // Events\n\n /// @notice Emitted when a new pair manager is created\n /// @param _pool The address of the corresponding Uniswap pool\n /// @param _pairManager The address of the just-created pair manager\n event PairCreated(address _pool, address _pairManager);\n\n // Errors\n\n /// @notice Throws an error if the pair manager is already initialized\n error AlreadyInitialized();\n\n /// @notice Throws an error if the caller is not the owner\n error OnlyOwner();\n\n // Methods\n\n /// @notice Creates a new pair manager based on the address of a Uniswap pool\n /// For example, the uniswap address of DAI-WETH, will create the Keep3r/DAI-WETH pool\n /// @param _pool The address of the Uniswap pool the pair manager will be based of\n /// @return _pairManager The address of the just-created pair manager\n function createPairManager(address _pool) external returns (address _pairManager);\n}\n" - }, - "solidity/contracts/UniV3PairManagerFactory.sol": { - "content": "// SPDX-License-Identifier: MIT\n\n/*\n\nCoded for The Keep3r Network with ♥ by\n\n██████╗░███████╗███████╗██╗  ░██╗░░░░░░░██╗░█████╗░███╗░░██╗██████╗░███████╗██████╗░██╗░░░░░░█████╗░███╗░░██╗██████╗░\n██╔══██╗██╔════╝██╔════╝██║  ░██║░░██╗░░██║██╔══██╗████╗░██║██╔══██╗██╔════╝██╔══██╗██║░░░░░██╔══██╗████╗░██║██╔══██╗\n██║░░██║█████╗░░█████╗░░██║  ░╚██╗████╗██╔╝██║░░██║██╔██╗██║██║░░██║█████╗░░██████╔╝██║░░░░░███████║██╔██╗██║██║░░██║\n██║░░██║██╔══╝░░██╔══╝░░██║  ░░████╔═████║░██║░░██║██║╚████║██║░░██║██╔══╝░░██╔══██╗██║░░░░░██╔══██║██║╚████║██║░░██║\n██████╔╝███████╗██║░░░░░██║  ░░╚██╔╝░╚██╔╝░╚█████╔╝██║░╚███║██████╔╝███████╗██║░░██║███████╗██║░░██║██║░╚███║██████╔╝\n╚═════╝░╚══════╝╚═╝░░░░░╚═╝  ░░░╚═╝░░░╚═╝░░░╚════╝░╚═╝░░╚══╝╚═════╝░╚══════╝╚═╝░░╚═╝╚══════╝╚═╝░░╚═╝╚═╝░░╚══╝╚═════╝░\n\nhttps://defi.sucks\n\n*/\n\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../interfaces/IPairManagerFactory.sol';\nimport './UniV3PairManager.sol';\nimport './peripherals/Governable.sol';\n\n/// @title Factory of Pair Managers\n/// @notice This contract creates new pair managers\ncontract UniV3PairManagerFactory is IPairManagerFactory, Governable {\n mapping(address => address) public override pairManagers;\n\n constructor(address _governance) Governable(_governance) {}\n\n ///@inheritdoc IPairManagerFactory\n function createPairManager(address _pool) external override returns (address _pairManager) {\n if (pairManagers[_pool] != address(0)) revert AlreadyInitialized();\n _pairManager = address(new UniV3PairManager(_pool, governance));\n pairManagers[_pool] = _pairManager;\n emit PairCreated(_pool, _pairManager);\n }\n}\n" - }, - "solidity/for-test/peripherals/GovernableForTest.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../../contracts/peripherals/Governable.sol';\n\ncontract GovernableForTest is Governable {\n constructor(address _governor) Governable(_governor) {}\n}\n" - }, - "solidity/for-test/BridgeForTest.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.0 <0.9.0;\n\nimport '@openzeppelin/contracts/token/ERC20/ERC20.sol';\nimport '@openzeppelin/contracts/token/ERC20/IERC20.sol';\n\ncontract BridgeForTest is ERC20 {\n address public immutable kp3r;\n\n constructor(address _kp3r) ERC20('Wrapped KP3R', 'wKP3R') {\n kp3r = _kp3r;\n }\n\n function bridge(uint256 _amount) external {\n IERC20(kp3r).transferFrom(msg.sender, address(this), _amount);\n _mint(msg.sender, _amount);\n }\n\n function bridgeBack(uint256 _amount) external {\n _burn(msg.sender, _amount);\n IERC20(kp3r).transfer(msg.sender, _amount);\n }\n}\n" - }, - "solidity/for-test/ERC20ForTest.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '@openzeppelin/contracts/token/ERC20/ERC20.sol';\n\ncontract ERC20ForTest is ERC20 {\n constructor(\n string memory _name,\n string memory _symbol,\n address _initialAccount,\n uint256 _initialBalance\n ) ERC20(_name, _symbol) {\n _mint(_initialAccount, _initialBalance);\n }\n\n function mint(uint256 _amount) public {\n _mint(msg.sender, _amount);\n }\n\n function mint(address _account, uint256 _amount) public {\n _mint(_account, _amount);\n }\n\n function burn(uint256 _amount) public {\n _burn(msg.sender, _amount);\n }\n\n function burn(address _account, uint256 _amount) public {\n _burn(_account, _amount);\n }\n\n function transferInternal(\n address _from,\n address _to,\n uint256 _value\n ) public {\n _transfer(_from, _to, _value);\n }\n\n function approveInternal(\n address _owner,\n address _spender,\n uint256 _value\n ) public {\n _approve(_owner, _spender, _value);\n }\n\n function deposit() external payable {\n // Function added for compatibility with WETH\n }\n}\n" - }, - "solidity/for-test/peripherals/keepers/Keep3rKeeperFundableForTest.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../../../contracts/peripherals/keepers/Keep3rKeeperFundable.sol';\n\ncontract Keep3rKeeperFundableForTest is Keep3rKeeperFundable {\n using EnumerableSet for EnumerableSet.AddressSet;\n\n constructor(\n address _kph,\n address _keep3rV1,\n address _keep3rV1Proxy\n ) Keep3rParameters(_kph, _keep3rV1, _keep3rV1Proxy) Keep3rRoles(msg.sender) {}\n\n function isKeeper(address _keeper) external view returns (bool) {\n return _keepers.contains(_keeper);\n }\n\n function setJob(address job) external {\n _jobs.add(job);\n }\n}\n" - }, - "solidity/contracts/sidechain/Keep3rEscrow.sol": { - "content": "// SPDX-License-Identifier: MIT\n\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../peripherals/Mintable.sol';\nimport '../peripherals/DustCollector.sol';\nimport '../../interfaces/sidechain/IKeep3rEscrow.sol';\nimport '@openzeppelin/contracts/token/ERC20/IERC20.sol';\nimport '@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol';\n\ncontract Keep3rEscrow is Mintable, DustCollector, IKeep3rEscrow {\n using SafeERC20 for IERC20;\n\n /// @inheritdoc IKeep3rEscrow\n address public override wKP3R;\n\n /// @param _governance Address of governance\n /// @param _wKP3R Address of wrapped KP3R implementation\n constructor(address _governance, address _wKP3R) Mintable(_governance) {\n wKP3R = _wKP3R;\n }\n\n /// @inheritdoc IKeep3rEscrow\n function deposit(uint256 _amount) external override {\n IERC20(wKP3R).safeTransferFrom(msg.sender, address(this), _amount);\n emit wKP3RDeposited(wKP3R, msg.sender, _amount);\n }\n\n /// @inheritdoc IKeep3rEscrow\n function mint(uint256 _amount) external override onlyMinter {\n IERC20(wKP3R).safeTransfer(msg.sender, _amount);\n emit wKP3RMinted(wKP3R, msg.sender, _amount);\n }\n\n /// @inheritdoc IKeep3rEscrow\n function setWKP3R(address _wKP3R) external override onlyGovernance {\n if (_wKP3R == address(0)) revert ZeroAddress();\n wKP3R = _wKP3R;\n emit wKP3RSet(wKP3R);\n }\n}\n" - }, - "solidity/contracts/peripherals/Mintable.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../../interfaces/peripherals/IMintable.sol';\nimport './Governable.sol';\n\nabstract contract Mintable is Governable, IMintable {\n /// @inheritdoc IMintable\n address public override minter;\n\n constructor(address _governance) Governable(_governance) {}\n\n /// @inheritdoc IMintable\n function setMinter(address _minter) external override onlyGovernance {\n if (_minter == address(0)) revert ZeroAddress();\n minter = _minter;\n emit MinterSet(_minter);\n }\n\n /// @notice Functions with this modifier can only be called by the minter;\n modifier onlyMinter() {\n if (msg.sender != minter) revert OnlyMinter();\n _;\n }\n}\n" - }, - "solidity/for-test/peripherals/DustCollectorForTest.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../../contracts/peripherals/DustCollector.sol';\n\ncontract DustCollectorForTest is DustCollector {\n constructor() DustCollector() Governable(msg.sender) {}\n}\n" - }, - "solidity/for-test/peripherals/Keep3rAccountanceForTest.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../../contracts/peripherals/Keep3rAccountance.sol';\n\ncontract Keep3rAccountanceForTest is Keep3rAccountance {\n using EnumerableSet for EnumerableSet.AddressSet;\n\n constructor() Keep3rRoles(msg.sender) {}\n\n function setJob(address job) external {\n _jobs.add(job);\n }\n\n function setKeeper(address keeper) external {\n _keepers.add(keeper);\n }\n}\n" - }, - "solidity/for-test/peripherals/jobs/Keep3rJobFundableLiquidityForTest.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../../../contracts/peripherals/jobs/Keep3rJobFundableLiquidity.sol';\n\ncontract Keep3rJobFundableLiquidityForTest is Keep3rJobFundableLiquidity {\n using EnumerableSet for EnumerableSet.AddressSet;\n\n constructor(\n address _kph,\n address _keep3rV1,\n address _keep3rV1Proxy\n ) Keep3rParameters(_kph, _keep3rV1, _keep3rV1Proxy) Keep3rRoles(msg.sender) {}\n\n function setJob(address _job) external {\n _jobs.add(_job);\n }\n\n function setJobLiquidity(address _job, address _liquidity) external returns (bool) {\n return _jobLiquidities[_job].add(_liquidity);\n }\n\n function setApprovedLiquidity(address _liquidity) external {\n _approvedLiquidities.add(_liquidity);\n }\n\n function setRevokedLiquidity(address _liquidity) external {\n _approvedLiquidities.remove(_liquidity);\n }\n\n function viewTickCache(address _liquidity) external view returns (TickCache memory _tickCache) {\n _tickCache = _tick[_liquidity];\n }\n\n function viewTickOrder(address _liquidity) external view returns (bool) {\n return _isKP3RToken0[_liquidity];\n }\n\n function internalJobLiquidities(address _job) external view returns (address[] memory _list) {\n _list = _jobLiquidities[_job].values();\n }\n\n function internalSettleJobAccountance(address _job) external {\n _settleJobAccountance(_job);\n }\n}\n" - }, - "solidity/for-test/peripherals/jobs/Keep3rJobDisputableForTest.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../../../contracts/peripherals/jobs/Keep3rJobDisputable.sol';\n\ncontract Keep3rJobDisputableForTest is Keep3rJobDisputable {\n using EnumerableSet for EnumerableSet.AddressSet;\n\n constructor(\n address _kph,\n address _keep3rV1,\n address _keep3rV1Proxy\n ) Keep3rParameters(_kph, _keep3rV1, _keep3rV1Proxy) Keep3rRoles(msg.sender) {}\n\n function setJobLiquidity(address _job, address _liquidity) external {\n _jobLiquidities[_job].add(_liquidity);\n }\n\n function setJobToken(address _job, address _token) external {\n _jobTokens[_job].add(_token);\n }\n\n function setApprovedLiquidity(address _liquidity) external {\n _approvedLiquidities.add(_liquidity);\n }\n\n function setRevokedLiquidity(address _liquidity) external {\n _approvedLiquidities.remove(_liquidity);\n }\n\n function internalJobLiquidityCredits(address _job) external view returns (uint256 _credits) {\n _credits = _jobLiquidityCredits[_job];\n }\n\n function internalJobPeriodCredits(address _job) external view returns (uint256 _credits) {\n _credits = _jobPeriodCredits[_job];\n }\n\n function internalJobTokens(address _job) external view returns (address[] memory _tokens) {\n _tokens = new address[](_jobTokens[_job].length());\n for (uint256 i; i < _jobTokens[_job].length(); i++) {\n _tokens[i] = _jobTokens[_job].at(i);\n }\n }\n\n function internalJobLiquidities(address _job) external view returns (address[] memory _tokens) {\n _tokens = new address[](_jobLiquidities[_job].length());\n for (uint256 i; i < _jobLiquidities[_job].length(); i++) {\n _tokens[i] = _jobLiquidities[_job].at(i);\n }\n }\n}\n" - }, - "solidity/for-test/peripherals/Keep3rDisputableForTest.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../../contracts/peripherals/Keep3rDisputable.sol';\n\ncontract Keep3rDisputableForTest is Keep3rDisputable {\n constructor() Keep3rParameters(address(0), address(0), address(0)) Keep3rRoles(msg.sender) {}\n}\n" - }, - "solidity/for-test/peripherals/keepers/Keep3rKeeperDisputableForTest.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../../../contracts/peripherals/keepers/Keep3rKeeperDisputable.sol';\n\ncontract Keep3rKeeperDisputableForTest is Keep3rKeeperDisputable {\n using EnumerableSet for EnumerableSet.AddressSet;\n\n constructor(\n address _kph,\n address _keep3rV1,\n address _keep3rV1Proxy\n ) Keep3rParameters(_kph, _keep3rV1, _keep3rV1Proxy) Keep3rRoles(msg.sender) {}\n\n function setKeeper(address _keeper) external {\n _keepers.add(_keeper);\n }\n\n function internalSlash(\n address _bonded,\n address _keeper,\n uint256 _bondAmount,\n uint256 _unbondAmount\n ) external {\n _slash(_bonded, _keeper, _bondAmount, _unbondAmount);\n }\n\n function isKeeper(address _address) external view returns (bool _isKeeper) {\n _isKeeper = _keepers.contains(_address);\n }\n}\n" - }, - "solidity/for-test/peripherals/jobs/Keep3rJobFundableCreditsForTest.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../../../contracts/peripherals/jobs/Keep3rJobFundableCredits.sol';\n\ncontract Keep3rJobFundableCreditsForTest is Keep3rJobFundableCredits {\n using EnumerableSet for EnumerableSet.AddressSet;\n\n constructor(\n address _kph,\n address _keep3rV1,\n address _keep3rV1Proxy\n ) Keep3rParameters(_kph, _keep3rV1, _keep3rV1Proxy) Keep3rRoles(msg.sender) {}\n\n function setJob(address _job, address _jobOwner) external {\n _jobs.add(_job);\n jobOwner[_job] = _jobOwner;\n }\n\n function setJobToken(address _job, address _token) external {\n _jobTokens[_job].add(_token);\n }\n\n function isJobToken(address _job, address _token) external view returns (bool _contains) {\n _contains = _jobTokens[_job].contains(_token);\n }\n}\n" - }, - "solidity/contracts/Keep3rHelper.sol": { - "content": "// SPDX-License-Identifier: MIT\n\n/*\n\nCoded for The Keep3r Network with ♥ by\n\n██████╗░███████╗███████╗██╗  ░██╗░░░░░░░██╗░█████╗░███╗░░██╗██████╗░███████╗██████╗░██╗░░░░░░█████╗░███╗░░██╗██████╗░\n██╔══██╗██╔════╝██╔════╝██║  ░██║░░██╗░░██║██╔══██╗████╗░██║██╔══██╗██╔════╝██╔══██╗██║░░░░░██╔══██╗████╗░██║██╔══██╗\n██║░░██║█████╗░░█████╗░░██║  ░╚██╗████╗██╔╝██║░░██║██╔██╗██║██║░░██║█████╗░░██████╔╝██║░░░░░███████║██╔██╗██║██║░░██║\n██║░░██║██╔══╝░░██╔══╝░░██║  ░░████╔═████║░██║░░██║██║╚████║██║░░██║██╔══╝░░██╔══██╗██║░░░░░██╔══██║██║╚████║██║░░██║\n██████╔╝███████╗██║░░░░░██║  ░░╚██╔╝░╚██╔╝░╚█████╔╝██║░╚███║██████╔╝███████╗██║░░██║███████╗██║░░██║██║░╚███║██████╔╝\n╚═════╝░╚══════╝╚═╝░░░░░╚═╝  ░░░╚═╝░░░╚═╝░░░╚════╝░╚═╝░░╚══╝╚═════╝░╚══════╝╚═╝░░╚═╝╚══════╝╚═╝░░╚═╝╚═╝░░╚══╝╚═════╝░\n\nhttps://defi.sucks\n\n*/\n\npragma solidity >=0.8.7 <0.9.0;\n\nimport './libraries/FullMath.sol';\nimport './libraries/TickMath.sol';\nimport '../interfaces/IKeep3r.sol';\nimport '../interfaces/IKeep3rHelper.sol';\nimport './Keep3rHelperParameters.sol';\n\nimport '@openzeppelin/contracts/utils/math/Math.sol';\nimport '@uniswap/v3-core/contracts/interfaces/IUniswapV3Pool.sol';\n\ncontract Keep3rHelper is IKeep3rHelper, Keep3rHelperParameters {\n constructor(\n address _kp3r,\n address _keep3rV2,\n address _governance,\n address _kp3rWethPool\n ) Keep3rHelperParameters(_kp3r, _keep3rV2, _governance, _kp3rWethPool) {}\n\n /// @inheritdoc IKeep3rHelper\n function quote(uint256 _eth) public view override returns (uint256 _amountOut) {\n uint32[] memory _secondsAgos = new uint32[](2);\n _secondsAgos[1] = quoteTwapTime;\n\n (int56[] memory _tickCumulatives, ) = IUniswapV3Pool(kp3rWethPool.poolAddress).observe(_secondsAgos);\n int56 _difference = _tickCumulatives[0] - _tickCumulatives[1];\n _amountOut = getQuoteAtTick(uint128(_eth), kp3rWethPool.isTKNToken0 ? _difference : -_difference, quoteTwapTime);\n }\n\n /// @inheritdoc IKeep3rHelper\n function bonds(address _keeper) public view virtual override returns (uint256 _amountBonded) {\n return IKeep3r(keep3rV2).bonds(_keeper, KP3R);\n }\n\n /// @inheritdoc IKeep3rHelper\n function getRewardAmountFor(address _keeper, uint256 _gasUsed) public view override returns (uint256 _kp3r) {\n uint256 _boost = getRewardBoostFor(bonds(_keeper));\n _kp3r = quote((_gasUsed * _boost) / BOOST_BASE);\n }\n\n /// @inheritdoc IKeep3rHelper\n function getRewardAmount(uint256 _gasUsed) external view override returns (uint256 _amount) {\n // solhint-disable-next-line avoid-tx-origin\n return getRewardAmountFor(tx.origin, _gasUsed);\n }\n\n /// @inheritdoc IKeep3rHelper\n function getRewardBoostFor(uint256 _bonds) public view override returns (uint256 _rewardBoost) {\n _bonds = Math.min(_bonds, targetBond);\n uint256 _cap = minBoost + ((maxBoost - minBoost) * _bonds) / targetBond;\n _rewardBoost = _cap * _getBasefee();\n }\n\n /// @inheritdoc IKeep3rHelper\n function getPoolTokens(address _pool) public view override returns (address _token0, address _token1) {\n return (IUniswapV3Pool(_pool).token0(), IUniswapV3Pool(_pool).token1());\n }\n\n /// @inheritdoc IKeep3rHelper\n function isKP3RToken0(address _pool) external view virtual override returns (bool _isKP3RToken0) {\n address _token0;\n address _token1;\n (_token0, _token1) = getPoolTokens(_pool);\n if (_token0 == KP3R) {\n return true;\n } else if (_token1 != KP3R) {\n revert LiquidityPairInvalid();\n }\n }\n\n /// @inheritdoc IKeep3rHelper\n function observe(address _pool, uint32[] memory _secondsAgo)\n external\n view\n override\n returns (\n int56 _tickCumulative1,\n int56 _tickCumulative2,\n bool _success\n )\n {\n try IUniswapV3Pool(_pool).observe(_secondsAgo) returns (int56[] memory _uniswapResponse, uint160[] memory) {\n _tickCumulative1 = _uniswapResponse[0];\n if (_uniswapResponse.length > 1) {\n _tickCumulative2 = _uniswapResponse[1];\n }\n _success = true;\n } catch (bytes memory) {}\n }\n\n /// @inheritdoc IKeep3rHelper\n function getPaymentParams(uint256 _bonds)\n external\n view\n virtual\n override\n returns (\n uint256 _boost,\n uint256 _oneEthQuote,\n uint256 _extra\n )\n {\n _oneEthQuote = quote(1 ether);\n _boost = getRewardBoostFor(_bonds);\n _extra = workExtraGas;\n }\n\n /// @inheritdoc IKeep3rHelper\n function getKP3RsAtTick(\n uint256 _liquidityAmount,\n int56 _tickDifference,\n uint256 _timeInterval\n ) external pure override returns (uint256 _kp3rAmount) {\n uint160 sqrtRatioX96 = TickMath.getSqrtRatioAtTick(int24(_tickDifference / int256(_timeInterval)));\n _kp3rAmount = FullMath.mulDiv(1 << 96, _liquidityAmount, sqrtRatioX96);\n }\n\n /// @inheritdoc IKeep3rHelper\n function getQuoteAtTick(\n uint128 _baseAmount,\n int56 _tickDifference,\n uint256 _timeInterval\n ) public pure override returns (uint256 _quoteAmount) {\n uint160 sqrtRatioX96 = TickMath.getSqrtRatioAtTick(int24(_tickDifference / int256(_timeInterval)));\n\n if (sqrtRatioX96 <= type(uint128).max) {\n uint256 ratioX192 = uint256(sqrtRatioX96) * sqrtRatioX96;\n _quoteAmount = FullMath.mulDiv(1 << 192, _baseAmount, ratioX192);\n } else {\n uint256 ratioX128 = FullMath.mulDiv(sqrtRatioX96, sqrtRatioX96, 1 << 64);\n _quoteAmount = FullMath.mulDiv(1 << 128, _baseAmount, ratioX128);\n }\n }\n\n /// @notice Gets the gas basefee cost to calculate keeper rewards\n /// @dev Keepers are required to pay a priority fee to be included, this function recognizes a minimum priority fee\n /// @return _baseFee The block's basefee + a minimum priority fee, or a preset minimum gas fee\n function _getBasefee() internal view virtual returns (uint256 _baseFee) {\n return Math.max(minBaseFee, block.basefee + minPriorityFee);\n }\n}\n" - }, - "solidity/for-test/testnet/Keep3rHelperForTestnet.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../../contracts/Keep3rHelper.sol';\n\ncontract Keep3rHelperForTestnet is Keep3rHelper {\n constructor(\n address _kp3r,\n address _keep3rV2,\n address _governance,\n address _kp3rWethPool\n ) Keep3rHelper(_kp3r, _keep3rV2, _governance, _kp3rWethPool) {}\n\n function _getBasefee() internal pure override returns (uint256) {\n return 1;\n }\n}\n" - }, - "solidity/for-test/Keep3rHelperForTest.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../contracts/Keep3rHelper.sol';\n\ncontract Keep3rHelperForTest is Keep3rHelper {\n uint256 public basefee;\n\n constructor(\n address _kp3r,\n address _keep3rV2,\n address _governance,\n address _kp3rWethPool\n ) Keep3rHelper(_kp3r, _keep3rV2, _governance, _kp3rWethPool) {}\n\n function _getBasefee() internal view override returns (uint256) {\n return basefee != 0 ? (basefee + minPriorityFee) : super._getBasefee();\n }\n\n function setBaseFee(uint256 _baseFee) external {\n basefee = _baseFee;\n }\n}\n" - }, - "solidity/contracts/sidechain/Keep3rHelperSidechain.sol": { - "content": "// SPDX-License-Identifier: MIT\n\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../Keep3rHelper.sol';\nimport '../../interfaces/sidechain/IKeep3rHelperSidechain.sol';\n\ncontract Keep3rHelperSidechain is IKeep3rHelperSidechain, Keep3rHelper {\n /// @inheritdoc IKeep3rHelperSidechain\n mapping(address => address) public override oracle;\n /// @inheritdoc IKeep3rHelperSidechain\n IKeep3rHelperParameters.TokenOraclePool public override wethUSDPool;\n\n /// @notice Ethereum mainnet WETH address used for quoting references\n address public immutable override WETH;\n\n /// @param _keep3rV2 Address of sidechain Keep3r implementation\n /// @param _governance Address of governance\n /// @param _kp3rWethOracle Address of oracle used for KP3R/WETH quote\n /// @param _wethUsdOracle Address of oracle used for WETH/USD quote\n /// @dev Oracle pools should use 18 decimals tokens\n constructor(\n address _keep3rV2,\n address _governance,\n address _kp3r,\n address _weth,\n address _kp3rWethOracle,\n address _wethUsdOracle\n ) Keep3rHelper(_kp3r, _keep3rV2, _governance, _kp3rWethOracle) {\n WETH = _weth;\n wethUSDPool = _validateOraclePool(_wethUsdOracle, _weth);\n _setQuoteTwapTime(1 days);\n workExtraGas = 0;\n }\n\n /// @inheritdoc IKeep3rHelper\n /// @notice Uses valid wKP3R address from Keep3rSidechain to query keeper bonds\n function bonds(address _keeper) public view override(Keep3rHelper, IKeep3rHelper) returns (uint256 _amountBonded) {\n address wKP3R = IKeep3r(keep3rV2).keep3rV1();\n return IKeep3r(keep3rV2).bonds(_keeper, wKP3R);\n }\n\n /// @inheritdoc IKeep3rHelperSidechain\n function setOracle(address _liquidity, address _oracle) external override onlyGovernance {\n if (_liquidity == address(0) || _oracle == address(0)) revert ZeroAddress();\n oracle[_liquidity] = _oracle;\n emit OracleSet(_liquidity, _oracle);\n }\n\n /// @inheritdoc IKeep3rHelperSidechain\n function quoteUsdToEth(uint256 _usd) public view virtual override returns (uint256 _amountOut) {\n uint32[] memory _secondsAgos = new uint32[](2);\n _secondsAgos[1] = quoteTwapTime;\n\n /// @dev Oracle is compatible with IUniswapV3Pool\n (int56[] memory _tickCumulatives, ) = IUniswapV3Pool(wethUSDPool.poolAddress).observe(_secondsAgos);\n int56 _difference = _tickCumulatives[0] - _tickCumulatives[1];\n _amountOut = getQuoteAtTick(uint128(_usd), wethUSDPool.isTKNToken0 ? _difference : -_difference, quoteTwapTime);\n }\n\n /// @inheritdoc IKeep3rHelperSidechain\n function setWethUsdPool(address _poolAddress) external override onlyGovernance {\n if (_poolAddress == address(0)) revert ZeroAddress();\n _setWethUsdPool(_poolAddress);\n }\n\n /// @inheritdoc IKeep3rHelper\n function getPaymentParams(uint256 _bonds)\n external\n view\n virtual\n override(Keep3rHelper, IKeep3rHelper)\n returns (\n uint256 _boost,\n uint256 _oneUsdQuote,\n uint256 _extraGas\n )\n {\n _oneUsdQuote = quote(quoteUsdToEth(1 ether));\n _boost = getRewardBoostFor(_bonds);\n _extraGas = workExtraGas;\n }\n\n function _setWethUsdPool(address _poolAddress) internal {\n wethUSDPool = _validateOraclePool(_poolAddress, WETH);\n emit WethUSDPoolChange(wethUSDPool.poolAddress, wethUSDPool.isTKNToken0);\n }\n\n /// @dev Sidechain jobs are quoted by USD/gasUnit, baseFee is set to 1\n function _getBasefee() internal view virtual override returns (uint256 _baseFee) {\n return 1;\n }\n}\n" - }, - "solidity/for-test/testnet/Keep3rHelperSidechainForTestnet.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../../contracts/sidechain/Keep3rHelperSidechain.sol';\n\ncontract Keep3rHelperSidechainForTestnet is Keep3rHelperSidechain {\n constructor(\n address _keep3rV2,\n address _governance,\n address _kp3r,\n address _weth,\n address _kp3rWethOracle,\n address _wethUsdOracle\n ) Keep3rHelperSidechain(_keep3rV2, _governance, _kp3r, _weth, _kp3rWethOracle, _wethUsdOracle) {}\n\n /// @dev Overrides oracle validation that uses KP3R and WETH addresses\n function _validateOraclePool(address _poolAddress, address) internal view virtual override returns (TokenOraclePool memory _oraclePool) {\n return TokenOraclePool(_poolAddress, true);\n }\n\n /// @dev Overrides token comparison with KP3R address\n function isKP3RToken0(address) public view virtual override returns (bool) {\n return true;\n }\n\n function quoteUsdToEth(uint256 _usd) public view virtual override returns (uint256) {\n return _usd / 1000;\n }\n}\n" - }, - "solidity/for-test/peripherals/Keep3rParametersForTest.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../../contracts/peripherals/Keep3rParameters.sol';\n\ncontract Keep3rParametersForTest is Keep3rParameters {\n constructor(\n address _keep3rHelper,\n address _keep3rV1,\n address _keep3rV1Proxy\n ) Keep3rParameters(_keep3rHelper, _keep3rV1, _keep3rV1Proxy) Keep3rRoles(msg.sender) {}\n}\n" - }, - "solidity/for-test/peripherals/jobs/Keep3rJobWorkableForTest.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../../../contracts/peripherals/jobs/Keep3rJobWorkable.sol';\n\ncontract Keep3rJobWorkableForTest is Keep3rJobWorkable {\n using EnumerableSet for EnumerableSet.AddressSet;\n\n constructor(\n address _keep3rHelper,\n address _keep3rV1,\n address _keep3rV1Proxy\n ) Keep3rParameters(_keep3rHelper, _keep3rV1, _keep3rV1Proxy) Keep3rRoles(msg.sender) {}\n\n function setJob(address _job) external {\n _jobs.add(_job);\n }\n\n function setKeeper(address _keeper) external {\n _keepers.add(_keeper);\n }\n\n function setApprovedLiquidity(address _liquidity) external {\n _approvedLiquidities.add(_liquidity);\n }\n\n function setJobLiquidity(address _job, address _liquidity) external {\n _jobLiquidities[_job].add(_liquidity);\n }\n\n function viewJobLiquidityCredits(address _job) external view returns (uint256) {\n return _jobLiquidityCredits[_job];\n }\n\n function viewJobPeriodCredits(address _job) external view returns (uint256) {\n return _jobPeriodCredits[_job];\n }\n\n function viewTickCache(address _liquidity) external view returns (TickCache memory _tickCache) {\n _tickCache = _tick[_liquidity];\n }\n\n function viewGas() external view returns (uint256) {\n return _initialGas;\n }\n}\n" - }, - "solidity/for-test/peripherals/jobs/Keep3rJobMigrationForTest.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../../../contracts/peripherals/jobs/Keep3rJobMigration.sol';\n\ncontract Keep3rJobMigrationForTest is Keep3rJobMigration {\n using EnumerableSet for EnumerableSet.AddressSet;\n\n mapping(address => uint256) public settleJobAccountanceCallCount;\n\n constructor(\n address _kph,\n address _keep3rV1,\n address _keep3rV1Proxy\n ) Keep3rParameters(_kph, _keep3rV1, _keep3rV1Proxy) Keep3rRoles(msg.sender) {}\n\n function setJobToken(address _job, address _token) external {\n _jobTokens[_job].add(_token);\n }\n\n function setJobLiquidity(address _job, address _liquidity) external {\n _jobLiquidities[_job].add(_liquidity);\n }\n\n function viewJobTokenListLength(address _job) external view returns (uint256) {\n return _jobTokens[_job].length();\n }\n\n function viewJobLiquidityList(address _job) external view returns (address[] memory _list) {\n _list = _jobLiquidities[_job].values();\n }\n\n function viewJobPeriodCredits(address _job) external view returns (uint256) {\n return _jobPeriodCredits[_job];\n }\n\n function viewJobLiquidityCredits(address _job) external view returns (uint256) {\n return _jobLiquidityCredits[_job];\n }\n\n function viewMigrationCreatedAt(address _fromJob, address _toJob) external view returns (uint256) {\n return _migrationCreatedAt[_fromJob][_toJob];\n }\n\n function isJob(address _job) external view returns (bool) {\n return _jobs.contains(_job);\n }\n\n function _settleJobAccountance(address _job) internal override {\n settleJobAccountanceCallCount[_job]++;\n }\n}\n" - }, - "solidity/for-test/peripherals/jobs/Keep3rJobManagerForTest.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../../../contracts/peripherals/jobs/Keep3rJobManager.sol';\n\ncontract Keep3rJobManagerForTest is Keep3rJobManager {\n using EnumerableSet for EnumerableSet.AddressSet;\n\n constructor(\n address _keep3rHelper,\n address _keep3rV1,\n address _keep3rV1Proxy\n ) Keep3rRoles(msg.sender) {}\n\n function isJob(address _job) external view returns (bool _isJob) {\n _isJob = _jobs.contains(_job);\n }\n}\n" - }, - "solidity/for-test/peripherals/jobs/Keep3rJobOwnershipForTest.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../../../contracts/peripherals/jobs/Keep3rJobOwnership.sol';\n\ncontract Keep3rJobOwnershipForTest is Keep3rJobOwnership {}\n" - }, - "solidity/for-test/libraries/LiquidityAmountsForTest.sol": { - "content": "// SPDX-License-Identifier: GPL-2.0-or-later\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../../contracts/libraries/FullMath.sol';\nimport '../../contracts/libraries/FixedPoint96.sol';\n\n/// @dev Made this library into a contract to be able to calculate liquidity more precisely for tests\n\n// solhint-disable\ncontract LiquidityAmountsForTest {\n function toUint128(uint256 x) private pure returns (uint128 y) {\n require((y = uint128(x)) == x);\n }\n\n function getLiquidityForAmount0(\n uint160 sqrtRatioAX96,\n uint160 sqrtRatioBX96,\n uint256 amount0\n ) public pure returns (uint128 liquidity) {\n if (sqrtRatioAX96 > sqrtRatioBX96) (sqrtRatioAX96, sqrtRatioBX96) = (sqrtRatioBX96, sqrtRatioAX96);\n uint256 intermediate = FullMath.mulDiv(sqrtRatioAX96, sqrtRatioBX96, FixedPoint96.Q96);\n return toUint128(FullMath.mulDiv(amount0, intermediate, sqrtRatioBX96 - sqrtRatioAX96));\n }\n\n function getLiquidityForAmount1(\n uint160 sqrtRatioAX96,\n uint160 sqrtRatioBX96,\n uint256 amount1\n ) public pure returns (uint128 liquidity) {\n if (sqrtRatioAX96 > sqrtRatioBX96) (sqrtRatioAX96, sqrtRatioBX96) = (sqrtRatioBX96, sqrtRatioAX96);\n return toUint128(FullMath.mulDiv(amount1, FixedPoint96.Q96, sqrtRatioBX96 - sqrtRatioAX96));\n }\n\n function getLiquidityForAmounts(\n uint160 sqrtRatioX96,\n uint160 sqrtRatioAX96,\n uint160 sqrtRatioBX96,\n uint256 amount0,\n uint256 amount1\n ) external pure returns (uint128 liquidity) {\n if (sqrtRatioAX96 > sqrtRatioBX96) (sqrtRatioAX96, sqrtRatioBX96) = (sqrtRatioBX96, sqrtRatioAX96);\n\n if (sqrtRatioX96 <= sqrtRatioAX96) {\n liquidity = getLiquidityForAmount0(sqrtRatioAX96, sqrtRatioBX96, amount0);\n } else if (sqrtRatioX96 < sqrtRatioBX96) {\n uint128 liquidity0 = getLiquidityForAmount0(sqrtRatioX96, sqrtRatioBX96, amount0);\n uint128 liquidity1 = getLiquidityForAmount1(sqrtRatioAX96, sqrtRatioX96, amount1);\n\n liquidity = liquidity0 < liquidity1 ? liquidity0 : liquidity1;\n } else {\n liquidity = getLiquidityForAmount1(sqrtRatioAX96, sqrtRatioBX96, amount1);\n }\n }\n\n function getAmount0ForLiquidity(\n uint160 sqrtRatioAX96,\n uint160 sqrtRatioBX96,\n uint128 liquidity\n ) public pure returns (uint256 amount0) {\n if (sqrtRatioAX96 > sqrtRatioBX96) (sqrtRatioAX96, sqrtRatioBX96) = (sqrtRatioBX96, sqrtRatioAX96);\n\n return FullMath.mulDiv(uint256(liquidity) << FixedPoint96.RESOLUTION, sqrtRatioBX96 - sqrtRatioAX96, sqrtRatioBX96) / sqrtRatioAX96;\n }\n\n function getAmount1ForLiquidity(\n uint160 sqrtRatioAX96,\n uint160 sqrtRatioBX96,\n uint128 liquidity\n ) public pure returns (uint256 amount1) {\n if (sqrtRatioAX96 > sqrtRatioBX96) (sqrtRatioAX96, sqrtRatioBX96) = (sqrtRatioBX96, sqrtRatioAX96);\n\n return FullMath.mulDiv(liquidity, sqrtRatioBX96 - sqrtRatioAX96, FixedPoint96.Q96);\n }\n\n function getAmountsForLiquidity(\n uint160 sqrtRatioX96,\n uint160 sqrtRatioAX96,\n uint160 sqrtRatioBX96,\n uint128 liquidity\n ) external pure returns (uint256 amount0, uint256 amount1) {\n if (sqrtRatioAX96 > sqrtRatioBX96) (sqrtRatioAX96, sqrtRatioBX96) = (sqrtRatioBX96, sqrtRatioAX96);\n\n if (sqrtRatioX96 <= sqrtRatioAX96) {\n amount0 = getAmount0ForLiquidity(sqrtRatioAX96, sqrtRatioBX96, liquidity);\n } else if (sqrtRatioX96 < sqrtRatioBX96) {\n amount0 = getAmount0ForLiquidity(sqrtRatioX96, sqrtRatioBX96, liquidity);\n amount1 = getAmount1ForLiquidity(sqrtRatioAX96, sqrtRatioX96, liquidity);\n } else {\n amount1 = getAmount1ForLiquidity(sqrtRatioAX96, sqrtRatioBX96, liquidity);\n }\n }\n}\n" - }, - "solidity/for-test/IUniswapV3PoolForTest.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '@uniswap/v3-core/contracts/interfaces/IERC20Minimal.sol';\nimport '@uniswap/v3-core/contracts/interfaces/IUniswapV3Pool.sol';\n\n// solhint-disable-next-line no-empty-blocks\ninterface IUniswapV3PoolForTest is IERC20Minimal, IUniswapV3Pool {\n\n}\n" - }, - "@uniswap/v3-core/contracts/interfaces/IERC20Minimal.sol": { - "content": "// SPDX-License-Identifier: GPL-2.0-or-later\npragma solidity >=0.5.0;\n\n/// @title Minimal ERC20 interface for Uniswap\n/// @notice Contains a subset of the full ERC20 interface that is used in Uniswap V3\ninterface IERC20Minimal {\n /// @notice Returns the balance of a token\n /// @param account The account for which to look up the number of tokens it has, i.e. its balance\n /// @return The number of tokens held by the account\n function balanceOf(address account) external view returns (uint256);\n\n /// @notice Transfers the amount of token from the `msg.sender` to the recipient\n /// @param recipient The account that will receive the amount transferred\n /// @param amount The number of tokens to send from the sender to the recipient\n /// @return Returns true for a successful transfer, false for an unsuccessful transfer\n function transfer(address recipient, uint256 amount) external returns (bool);\n\n /// @notice Returns the current allowance given to a spender by an owner\n /// @param owner The account of the token owner\n /// @param spender The account of the token spender\n /// @return The current allowance granted by `owner` to `spender`\n function allowance(address owner, address spender) external view returns (uint256);\n\n /// @notice Sets the allowance of a spender from the `msg.sender` to the value `amount`\n /// @param spender The account which will be allowed to spend a given amount of the owners tokens\n /// @param amount The amount of tokens allowed to be used by `spender`\n /// @return Returns true for a successful approval, false for unsuccessful\n function approve(address spender, uint256 amount) external returns (bool);\n\n /// @notice Transfers `amount` tokens from `sender` to `recipient` up to the allowance given to the `msg.sender`\n /// @param sender The account from which the transfer will be initiated\n /// @param recipient The recipient of the transfer\n /// @param amount The amount of the transfer\n /// @return Returns true for a successful transfer, false for unsuccessful\n function transferFrom(\n address sender,\n address recipient,\n uint256 amount\n ) external returns (bool);\n\n /// @notice Event emitted when tokens are transferred from one address to another, either via `#transfer` or `#transferFrom`.\n /// @param from The account from which the tokens were sent, i.e. the balance decreased\n /// @param to The account to which the tokens were sent, i.e. the balance increased\n /// @param value The amount of tokens that were transferred\n event Transfer(address indexed from, address indexed to, uint256 value);\n\n /// @notice Event emitted when the approval amount for the spender of a given owner's tokens changes.\n /// @param owner The account that approved spending of its tokens\n /// @param spender The account for which the spending allowance was modified\n /// @param value The new allowance from the owner to the spender\n event Approval(address indexed owner, address indexed spender, uint256 value);\n}\n" - } - }, - "settings": { - "optimizer": { - "enabled": true, - "runs": 33 - }, - "outputSelection": { - "*": { - "*": [ - "storageLayout", - "abi", - "evm.bytecode", - "evm.deployedBytecode", - "evm.methodIdentifiers", - "metadata", - "devdoc", - "userdoc", - "evm.gasEstimates" - ], - "": [ - "ast" - ] - } - }, - "metadata": { - "useLiteralContent": true - }, - "libraries": { - "": { - "__CACHE_BREAKER__": "0x00000000d41867734bbee4c6863d9255b2b06ac1" - } - } - } -} \ No newline at end of file diff --git a/deployments/goerli/solcInputs/0d224f905ebe4be6830f2d07ee9fcf58.json b/deployments/goerli/solcInputs/0d224f905ebe4be6830f2d07ee9fcf58.json deleted file mode 100644 index 78d4b61..0000000 --- a/deployments/goerli/solcInputs/0d224f905ebe4be6830f2d07ee9fcf58.json +++ /dev/null @@ -1,331 +0,0 @@ -{ - "language": "Solidity", - "sources": { - "solidity/contracts/Keep3r.sol": { - "content": "// SPDX-License-Identifier: MIT\n\n/*\n\nCoded for The Keep3r Network with ♥ by\n\n██████╗░███████╗███████╗██╗░░░██╗░░░░░░░██╗░█████╗░███╗░░██╗██████╗░███████╗██████╗░██╗░░░░░░█████╗░███╗░░██╗██████╗░\n██╔══██╗██╔════╝██╔════╝██║░░░██║░░██╗░░██║██╔══██╗████╗░██║██╔══██╗██╔════╝██╔══██╗██║░░░░░██╔══██╗████╗░██║██╔══██╗\n██║░░██║█████╗░░█████╗░░██║░░░╚██╗████╗██╔╝██║░░██║██╔██╗██║██║░░██║█████╗░░██████╔╝██║░░░░░███████║██╔██╗██║██║░░██║\n██║░░██║██╔══╝░░██╔══╝░░██║░░░░████╔═████║░██║░░██║██║╚████║██║░░██║██╔══╝░░██╔══██╗██║░░░░░██╔══██║██║╚████║██║░░██║\n██████╔╝███████╗██║░░░░░██║░░░░╚██╔╝░╚██╔╝░╚█████╔╝██║░╚███║██████╔╝███████╗██║░░██║███████╗██║░░██║██║░╚███║██████╔╝\n╚═════╝░╚══════╝╚═╝░░░░░╚═╝░░░░░╚═╝░░░╚═╝░░░╚════╝░╚═╝░░╚══╝╚═════╝░╚══════╝╚═╝░░╚═╝╚══════╝╚═╝░░╚═╝╚═╝░░╚══╝╚═════╝░\n\nhttps://defi.sucks\n\n*/\n\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../interfaces/IKeep3r.sol';\nimport './peripherals/jobs/Keep3rJobs.sol';\nimport './peripherals/keepers/Keep3rKeepers.sol';\nimport './peripherals/DustCollector.sol';\n\ncontract Keep3r is IKeep3r, Keep3rJobs, Keep3rKeepers {\n constructor(\n address _governance,\n address _keep3rHelper,\n address _keep3rV1,\n address _keep3rV1Proxy\n ) Keep3rParameters(_keep3rHelper, _keep3rV1, _keep3rV1Proxy) Keep3rRoles(_governance) {}\n}\n" - }, - "solidity/interfaces/IKeep3r.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport './peripherals/IKeep3rJobs.sol';\nimport './peripherals/IKeep3rKeepers.sol';\nimport './peripherals/IKeep3rParameters.sol';\n\n// solhint-disable-next-line no-empty-blocks\n\n/// @title Keep3rV2 contract\n/// @notice This contract inherits all the functionality of Keep3rV2\ninterface IKeep3r is IKeep3rJobs, IKeep3rKeepers, IKeep3rParameters {\n\n}\n" - }, - "solidity/contracts/peripherals/jobs/Keep3rJobs.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../../../interfaces/peripherals/IKeep3rJobs.sol';\nimport './Keep3rJobManager.sol';\nimport './Keep3rJobWorkable.sol';\nimport './Keep3rJobDisputable.sol';\n\nabstract contract Keep3rJobs is IKeep3rJobs, Keep3rJobManager, Keep3rJobWorkable, Keep3rJobDisputable {}\n" - }, - "solidity/contracts/peripherals/keepers/Keep3rKeepers.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../../../interfaces/peripherals/IKeep3rKeepers.sol';\nimport './Keep3rKeeperDisputable.sol';\n\nabstract contract Keep3rKeepers is IKeep3rKeepers, Keep3rKeeperDisputable {}\n" - }, - "solidity/contracts/peripherals/DustCollector.sol": { - "content": "// SPDX-License-Identifier: MIT\n\npragma solidity >=0.8.4 <0.9.0;\n\nimport '@openzeppelin/contracts/token/ERC20/IERC20.sol';\nimport '@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol';\nimport '../../contracts/peripherals/Governable.sol';\nimport '../../interfaces/peripherals/IDustCollector.sol';\n\nabstract contract DustCollector is IDustCollector, Governable {\n using SafeERC20 for IERC20;\n\n address internal constant _ETH_ADDRESS = 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE;\n\n function sendDust(\n address _token,\n uint256 _amount,\n address _to\n ) external override onlyGovernance {\n if (_to == address(0)) revert ZeroAddress();\n if (_token == _ETH_ADDRESS) {\n payable(_to).transfer(_amount);\n } else {\n IERC20(_token).safeTransfer(_to, _amount);\n }\n emit DustSent(_token, _amount, _to);\n }\n}\n" - }, - "solidity/interfaces/peripherals/IKeep3rJobs.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport './IKeep3rDisputable.sol';\n\n/// @title Keep3rJobOwnership contract\n/// @notice Handles the ownership of the jobs\ninterface IKeep3rJobOwnership {\n // Events\n\n /// @notice Emitted when Keep3rJobOwnership#changeJobOwnership is called\n /// @param _job The address of the job proposed to have a change of owner\n /// @param _owner The current owner of the job\n /// @param _pendingOwner The new address proposed to be the owner of the job\n event JobOwnershipChange(address indexed _job, address indexed _owner, address indexed _pendingOwner);\n\n /// @notice Emitted when Keep3rJobOwnership#JobOwnershipAssent is called\n /// @param _job The address of the job which the proposed owner will now own\n /// @param _previousOwner The previous owner of the job\n /// @param _newOwner The new owner of the job\n event JobOwnershipAssent(address indexed _job, address indexed _previousOwner, address indexed _newOwner);\n\n // Errors\n\n /// @notice Throws when the caller of the function is not the job owner\n error OnlyJobOwner();\n\n /// @notice Throws when the caller of the function is not the pending job owner\n error OnlyPendingJobOwner();\n\n // Variables\n\n /// @notice Maps the job to the owner of the job\n /// @param _job The address of the job\n /// @return _owner The address of the owner of the job\n function jobOwner(address _job) external view returns (address _owner);\n\n /// @notice Maps the job to its pending owner\n /// @param _job The address of the job\n /// @return _pendingOwner The address of the pending owner of the job\n function jobPendingOwner(address _job) external view returns (address _pendingOwner);\n\n // Methods\n\n /// @notice Proposes a new address to be the owner of the job\n /// @param _job The address of the job\n /// @param _newOwner The address of the proposed new owner\n function changeJobOwnership(address _job, address _newOwner) external;\n\n /// @notice The proposed address accepts to be the owner of the job\n /// @param _job The address of the job\n function acceptJobOwnership(address _job) external;\n}\n\n/// @title Keep3rJobManager contract\n/// @notice Handles the addition and withdrawal of credits from a job\ninterface IKeep3rJobManager is IKeep3rJobOwnership {\n // Events\n\n /// @notice Emitted when Keep3rJobManager#addJob is called\n /// @param _job The address of the job to add\n /// @param _jobOwner The job's owner\n event JobAddition(address indexed _job, address indexed _jobOwner);\n\n // Errors\n\n /// @notice Throws when trying to add a job that has already been added\n error JobAlreadyAdded();\n\n /// @notice Throws when the address that is trying to register as a keeper is already a keeper\n error AlreadyAKeeper();\n\n // Methods\n\n /// @notice Allows any caller to add a new job\n /// @param _job Address of the contract for which work should be performed\n function addJob(address _job) external;\n}\n\n/// @title Keep3rJobFundableCredits contract\n/// @notice Handles the addition and withdrawal of credits from a job\ninterface IKeep3rJobFundableCredits is IKeep3rJobOwnership {\n // Events\n\n /// @notice Emitted when Keep3rJobFundableCredits#addTokenCreditsToJob is called\n /// @param _job The address of the job being credited\n /// @param _token The address of the token being provided\n /// @param _provider The user that calls the function\n /// @param _amount The amount of credit being added to the job\n event TokenCreditAddition(address indexed _job, address indexed _token, address indexed _provider, uint256 _amount);\n\n /// @notice Emitted when Keep3rJobFundableCredits#withdrawTokenCreditsFromJob is called\n /// @param _job The address of the job from which the credits are withdrawn\n /// @param _token The credit being withdrawn from the job\n /// @param _receiver The user that receives the tokens\n /// @param _amount The amount of credit withdrawn\n event TokenCreditWithdrawal(address indexed _job, address indexed _token, address indexed _receiver, uint256 _amount);\n\n // Errors\n\n /// @notice Throws when the token is KP3R, as it should not be used for direct token payments\n error TokenUnallowed();\n\n /// @notice Throws when the token withdraw cooldown has not yet passed\n error JobTokenCreditsLocked();\n\n /// @notice Throws when the user tries to withdraw more tokens than it has\n error InsufficientJobTokenCredits();\n\n // Variables\n\n /// @notice Last block where tokens were added to the job\n /// @param _job The address of the job credited\n /// @param _token The address of the token credited\n /// @return _timestamp The last block where tokens were added to the job\n function jobTokenCreditsAddedAt(address _job, address _token) external view returns (uint256 _timestamp);\n\n // Methods\n\n /// @notice Add credit to a job to be paid out for work\n /// @param _job The address of the job being credited\n /// @param _token The address of the token being credited\n /// @param _amount The amount of credit being added\n function addTokenCreditsToJob(\n address _job,\n address _token,\n uint256 _amount\n ) external;\n\n /// @notice Withdraw credit from a job\n /// @param _job The address of the job from which the credits are withdrawn\n /// @param _token The address of the token being withdrawn\n /// @param _amount The amount of token to be withdrawn\n /// @param _receiver The user that will receive tokens\n function withdrawTokenCreditsFromJob(\n address _job,\n address _token,\n uint256 _amount,\n address _receiver\n ) external;\n}\n\n/// @title Keep3rJobFundableLiquidity contract\n/// @notice Handles the funding of jobs through specific liquidity pairs\ninterface IKeep3rJobFundableLiquidity is IKeep3rJobOwnership {\n // Events\n\n /// @notice Emitted when Keep3rJobFundableLiquidity#approveLiquidity function is called\n /// @param _liquidity The address of the liquidity pair being approved\n event LiquidityApproval(address _liquidity);\n\n /// @notice Emitted when Keep3rJobFundableLiquidity#revokeLiquidity function is called\n /// @param _liquidity The address of the liquidity pair being revoked\n event LiquidityRevocation(address _liquidity);\n\n /// @notice Emitted when IKeep3rJobFundableLiquidity#addLiquidityToJob function is called\n /// @param _job The address of the job to which liquidity will be added\n /// @param _liquidity The address of the liquidity being added\n /// @param _provider The user that calls the function\n /// @param _amount The amount of liquidity being added\n event LiquidityAddition(address indexed _job, address indexed _liquidity, address indexed _provider, uint256 _amount);\n\n /// @notice Emitted when IKeep3rJobFundableLiquidity#withdrawLiquidityFromJob function is called\n /// @param _job The address of the job of which liquidity will be withdrawn from\n /// @param _liquidity The address of the liquidity being withdrawn\n /// @param _receiver The receiver of the liquidity tokens\n /// @param _amount The amount of liquidity being withdrawn from the job\n event LiquidityWithdrawal(address indexed _job, address indexed _liquidity, address indexed _receiver, uint256 _amount);\n\n /// @notice Emitted when Keep3rJobFundableLiquidity#addLiquidityToJob function is called\n /// @param _job The address of the job whose credits will be updated\n /// @param _rewardedAt The time at which the job was last rewarded\n /// @param _currentCredits The current credits of the job\n /// @param _periodCredits The credits of the job for the current period\n event LiquidityCreditsReward(address indexed _job, uint256 _rewardedAt, uint256 _currentCredits, uint256 _periodCredits);\n\n /// @notice Emitted when Keep3rJobFundableLiquidity#forceLiquidityCreditsToJob function is called\n /// @param _job The address of the job whose credits will be updated\n /// @param _rewardedAt The time at which the job was last rewarded\n /// @param _currentCredits The current credits of the job\n event LiquidityCreditsForced(address indexed _job, uint256 _rewardedAt, uint256 _currentCredits);\n\n // Errors\n\n /// @notice Throws when the liquidity being approved has already been approved\n error LiquidityPairApproved();\n\n /// @notice Throws when the liquidity being removed has not been approved\n error LiquidityPairUnexistent();\n\n /// @notice Throws when trying to add liquidity to an unapproved pool\n error LiquidityPairUnapproved();\n\n /// @notice Throws when the job doesn't have the requested liquidity\n error JobLiquidityUnexistent();\n\n /// @notice Throws when trying to remove more liquidity than the job has\n error JobLiquidityInsufficient();\n\n /// @notice Throws when trying to add less liquidity than the minimum liquidity required\n error JobLiquidityLessThanMin();\n\n // Structs\n\n /// @notice Stores the tick information of the different liquidity pairs\n struct TickCache {\n int56 current; // Tracks the current tick\n int56 difference; // Stores the difference between the current tick and the last tick\n uint256 period; // Stores the period at which the last observation was made\n }\n\n // Variables\n\n /// @notice Lists liquidity pairs\n /// @return _list An array of addresses with all the approved liquidity pairs\n function approvedLiquidities() external view returns (address[] memory _list);\n\n /// @notice Amount of liquidity in a specified job\n /// @param _job The address of the job being checked\n /// @param _liquidity The address of the liquidity we are checking\n /// @return _amount Amount of liquidity in the specified job\n function liquidityAmount(address _job, address _liquidity) external view returns (uint256 _amount);\n\n /// @notice Last time the job was rewarded liquidity credits\n /// @param _job The address of the job being checked\n /// @return _timestamp Timestamp of the last time the job was rewarded liquidity credits\n function rewardedAt(address _job) external view returns (uint256 _timestamp);\n\n /// @notice Last time the job was worked\n /// @param _job The address of the job being checked\n /// @return _timestamp Timestamp of the last time the job was worked\n function workedAt(address _job) external view returns (uint256 _timestamp);\n\n // Methods\n\n /// @notice Returns the liquidity credits of a given job\n /// @param _job The address of the job of which we want to know the liquidity credits\n /// @return _amount The liquidity credits of a given job\n function jobLiquidityCredits(address _job) external view returns (uint256 _amount);\n\n /// @notice Returns the credits of a given job for the current period\n /// @param _job The address of the job of which we want to know the period credits\n /// @return _amount The credits the given job has at the current period\n function jobPeriodCredits(address _job) external view returns (uint256 _amount);\n\n /// @notice Calculates the total credits of a given job\n /// @param _job The address of the job of which we want to know the total credits\n /// @return _amount The total credits of the given job\n function totalJobCredits(address _job) external view returns (uint256 _amount);\n\n /// @notice Calculates how many credits should be rewarded periodically for a given liquidity amount\n /// @dev _periodCredits = underlying KP3Rs for given liquidity amount * rewardPeriod / inflationPeriod\n /// @param _liquidity The address of the liquidity to provide\n /// @param _amount The amount of liquidity to provide\n /// @return _periodCredits The amount of KP3R periodically minted for the given liquidity\n function quoteLiquidity(address _liquidity, uint256 _amount) external view returns (uint256 _periodCredits);\n\n /// @notice Observes the current state of the liquidity pair being observed and updates TickCache with the information\n /// @param _liquidity The address of the liquidity pair being observed\n /// @return _tickCache The updated TickCache\n function observeLiquidity(address _liquidity) external view returns (TickCache memory _tickCache);\n\n /// @notice Gifts liquidity credits to the specified job\n /// @param _job The address of the job being credited\n /// @param _amount The amount of liquidity credits to gift\n function forceLiquidityCreditsToJob(address _job, uint256 _amount) external;\n\n /// @notice Approve a liquidity pair for being accepted in future\n /// @param _liquidity The address of the liquidity accepted\n function approveLiquidity(address _liquidity) external;\n\n /// @notice Revoke a liquidity pair from being accepted in future\n /// @param _liquidity The liquidity no longer accepted\n function revokeLiquidity(address _liquidity) external;\n\n /// @notice Allows anyone to fund a job with liquidity\n /// @param _job The address of the job to assign liquidity to\n /// @param _liquidity The liquidity being added\n /// @param _amount The amount of liquidity tokens to add\n function addLiquidityToJob(\n address _job,\n address _liquidity,\n uint256 _amount\n ) external;\n\n /// @notice Unbond liquidity for a job\n /// @dev Can only be called by the job's owner\n /// @param _job The address of the job being unbonded from\n /// @param _liquidity The liquidity being unbonded\n /// @param _amount The amount of liquidity being removed\n function unbondLiquidityFromJob(\n address _job,\n address _liquidity,\n uint256 _amount\n ) external;\n\n /// @notice Withdraw liquidity from a job\n /// @param _job The address of the job being withdrawn from\n /// @param _liquidity The liquidity being withdrawn\n /// @param _receiver The address that will receive the withdrawn liquidity\n function withdrawLiquidityFromJob(\n address _job,\n address _liquidity,\n address _receiver\n ) external;\n}\n\n/// @title Keep3rJobMigration contract\n/// @notice Handles the migration process of jobs to different addresses\ninterface IKeep3rJobMigration is IKeep3rJobFundableCredits, IKeep3rJobFundableLiquidity {\n // Events\n\n /// @notice Emitted when Keep3rJobMigration#migrateJob function is called\n /// @param _fromJob The address of the job that requests to migrate\n /// @param _toJob The address at which the job requests to migrate\n event JobMigrationRequested(address indexed _fromJob, address _toJob);\n\n /// @notice Emitted when Keep3rJobMigration#acceptJobMigration function is called\n /// @param _fromJob The address of the job that requested to migrate\n /// @param _toJob The address at which the job had requested to migrate\n event JobMigrationSuccessful(address _fromJob, address indexed _toJob);\n\n // Errors\n\n /// @notice Throws when the address of the job that requests to migrate wants to migrate to its same address\n error JobMigrationImpossible();\n\n /// @notice Throws when the _toJob address differs from the address being tracked in the pendingJobMigrations mapping\n error JobMigrationUnavailable();\n\n /// @notice Throws when cooldown between migrations has not yet passed\n error JobMigrationLocked();\n\n // Variables\n\n /// @notice Maps the jobs that have requested a migration to the address they have requested to migrate to\n /// @return _toJob The address to which the job has requested to migrate to\n function pendingJobMigrations(address _fromJob) external view returns (address _toJob);\n\n // Methods\n\n /// @notice Initializes the migration process for a job by adding the request to the pendingJobMigrations mapping\n /// @param _fromJob The address of the job that is requesting to migrate\n /// @param _toJob The address at which the job is requesting to migrate\n function migrateJob(address _fromJob, address _toJob) external;\n\n /// @notice Completes the migration process for a job\n /// @dev Unbond/withdraw process doesn't get migrated\n /// @param _fromJob The address of the job that requested to migrate\n /// @param _toJob The address to which the job wants to migrate to\n function acceptJobMigration(address _fromJob, address _toJob) external;\n}\n\n/// @title Keep3rJobWorkable contract\n/// @notice Handles the mechanisms jobs can pay keepers with along with the restrictions jobs can put on keepers before they can work on jobs\ninterface IKeep3rJobWorkable is IKeep3rJobMigration {\n // Events\n\n /// @notice Emitted when a keeper is validated before a job\n /// @param _gasLeft The amount of gas that the transaction has left at the moment of keeper validation\n event KeeperValidation(uint256 _gasLeft);\n\n /// @notice Emitted when a keeper works a job\n /// @param _credit The address of the asset in which the keeper is paid\n /// @param _job The address of the job the keeper has worked\n /// @param _keeper The address of the keeper that has worked the job\n /// @param _payment The amount that has been paid out to the keeper in exchange for working the job\n /// @param _gasLeft The amount of gas that the transaction has left at the moment of payment\n event KeeperWork(address indexed _credit, address indexed _job, address indexed _keeper, uint256 _payment, uint256 _gasLeft);\n\n // Errors\n\n /// @notice Throws if work method was called without calling isKeeper or isBondedKeeper\n error GasNotInitialized();\n\n /// @notice Throws if the address claiming to be a job is not in the list of approved jobs\n error JobUnapproved();\n\n /// @notice Throws if the amount of funds in the job is less than the payment that must be paid to the keeper that works that job\n error InsufficientFunds();\n\n // Methods\n\n /// @notice Confirms if the current keeper is registered\n /// @dev Can be used for general (non critical) functions\n /// @param _keeper The keeper being investigated\n /// @return _isKeeper Whether the address passed as a parameter is a keeper or not\n function isKeeper(address _keeper) external returns (bool _isKeeper);\n\n /// @notice Confirms if the current keeper is registered and has a minimum bond of any asset.\n /// @dev Should be used for protected functions\n /// @param _keeper The keeper to check\n /// @param _bond The bond token being evaluated\n /// @param _minBond The minimum amount of bonded tokens\n /// @param _earned The minimum funds earned in the keepers lifetime\n /// @param _age The minimum keeper age required\n /// @return _isBondedKeeper Whether the `_keeper` meets the given requirements\n function isBondedKeeper(\n address _keeper,\n address _bond,\n uint256 _minBond,\n uint256 _earned,\n uint256 _age\n ) external returns (bool _isBondedKeeper);\n\n /// @notice Implemented by jobs to show that a keeper performed work\n /// @dev Automatically calculates the payment for the keeper and pays the keeper with bonded KP3R\n /// @param _keeper Address of the keeper that performed the work\n function worked(address _keeper) external;\n\n /// @notice Implemented by jobs to show that a keeper performed work\n /// @dev Pays the keeper that performs the work with KP3R\n /// @param _keeper Address of the keeper that performed the work\n /// @param _payment The reward that should be allocated for the job\n function bondedPayment(address _keeper, uint256 _payment) external;\n\n /// @notice Implemented by jobs to show that a keeper performed work\n /// @dev Pays the keeper that performs the work with a specific token\n /// @param _token The asset being awarded to the keeper\n /// @param _keeper Address of the keeper that performed the work\n /// @param _amount The reward that should be allocated\n function directTokenPayment(\n address _token,\n address _keeper,\n uint256 _amount\n ) external;\n}\n\n/// @title Keep3rJobDisputable contract\n/// @notice Handles the actions that can be taken on a disputed job\ninterface IKeep3rJobDisputable is IKeep3rDisputable, IKeep3rJobFundableCredits, IKeep3rJobFundableLiquidity {\n // Events\n\n /// @notice Emitted when Keep3rJobDisputable#slashTokenFromJob is called\n /// @param _job The address of the job from which the token will be slashed\n /// @param _token The address of the token being slashed\n /// @param _slasher The user that slashes the token\n /// @param _amount The amount of the token being slashed\n event JobSlashToken(address indexed _job, address _token, address indexed _slasher, uint256 _amount);\n\n /// @notice Emitted when Keep3rJobDisputable#slashLiquidityFromJob is called\n /// @param _job The address of the job from which the liquidity will be slashed\n /// @param _liquidity The address of the liquidity being slashed\n /// @param _slasher The user that slashes the liquidity\n /// @param _amount The amount of the liquidity being slashed\n event JobSlashLiquidity(address indexed _job, address _liquidity, address indexed _slasher, uint256 _amount);\n\n // Errors\n\n /// @notice Throws when the token trying to be slashed doesn't exist\n error JobTokenUnexistent();\n\n /// @notice Throws when someone tries to slash more tokens than the job has\n error JobTokenInsufficient();\n\n // Methods\n\n /// @notice Allows governance or slasher to slash a job specific token\n /// @param _job The address of the job from which the token will be slashed\n /// @param _token The address of the token that will be slashed\n /// @param _amount The amount of the token that will be slashed\n function slashTokenFromJob(\n address _job,\n address _token,\n uint256 _amount\n ) external;\n\n /// @notice Allows governance or a slasher to slash liquidity from a job\n /// @param _job The address being slashed\n /// @param _liquidity The address of the liquidity that will be slashed\n /// @param _amount The amount of liquidity that will be slashed\n function slashLiquidityFromJob(\n address _job,\n address _liquidity,\n uint256 _amount\n ) external;\n}\n\n// solhint-disable-next-line no-empty-blocks\ninterface IKeep3rJobs is IKeep3rJobWorkable, IKeep3rJobManager, IKeep3rJobDisputable {\n\n}\n" - }, - "solidity/interfaces/peripherals/IKeep3rKeepers.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport './IKeep3rDisputable.sol';\n\n/// @title Keep3rKeeperFundable contract\n/// @notice Handles the actions required to become a keeper\ninterface IKeep3rKeeperFundable {\n // Events\n\n /// @notice Emitted when Keep3rKeeperFundable#activate is called\n /// @param _keeper The keeper that has been activated\n /// @param _bond The asset the keeper has bonded\n /// @param _amount The amount of the asset the keeper has bonded\n event Activation(address indexed _keeper, address indexed _bond, uint256 _amount);\n\n /// @notice Emitted when Keep3rKeeperFundable#withdraw is called\n /// @param _keeper The caller of Keep3rKeeperFundable#withdraw function\n /// @param _bond The asset to withdraw from the bonding pool\n /// @param _amount The amount of funds withdrawn\n event Withdrawal(address indexed _keeper, address indexed _bond, uint256 _amount);\n\n // Errors\n\n /// @notice Throws when the address that is trying to register as a job is already a job\n error AlreadyAJob();\n\n // Methods\n\n /// @notice Beginning of the bonding process\n /// @param _bonding The asset being bonded\n /// @param _amount The amount of bonding asset being bonded\n function bond(address _bonding, uint256 _amount) external;\n\n /// @notice Beginning of the unbonding process\n /// @param _bonding The asset being unbonded\n /// @param _amount Allows for partial unbonding\n function unbond(address _bonding, uint256 _amount) external;\n\n /// @notice End of the bonding process after bonding time has passed\n /// @param _bonding The asset being activated as bond collateral\n function activate(address _bonding) external;\n\n /// @notice Withdraw funds after unbonding has finished\n /// @param _bonding The asset to withdraw from the bonding pool\n function withdraw(address _bonding) external;\n}\n\n/// @title Keep3rKeeperDisputable contract\n/// @notice Handles the actions that can be taken on a disputed keeper\ninterface IKeep3rKeeperDisputable is IKeep3rDisputable, IKeep3rKeeperFundable {\n // Events\n\n /// @notice Emitted when Keep3rKeeperDisputable#slash is called\n /// @param _keeper The address of the slashed keeper\n /// @param _slasher The user that called Keep3rKeeperDisputable#slash\n /// @param _amount The amount of credits slashed from the keeper\n event KeeperSlash(address indexed _keeper, address indexed _slasher, uint256 _amount);\n\n /// @notice Emitted when Keep3rKeeperDisputable#revoke is called\n /// @param _keeper The address of the revoked keeper\n /// @param _slasher The user that called Keep3rKeeperDisputable#revoke\n event KeeperRevoke(address indexed _keeper, address indexed _slasher);\n\n // Methods\n\n /// @notice Allows governance to slash a keeper based on a dispute\n /// @param _keeper The address being slashed\n /// @param _bonded The asset being slashed\n /// @param _bondAmount The bonded amount being slashed\n /// @param _unbondAmount The pending unbond amount being slashed\n function slash(\n address _keeper,\n address _bonded,\n uint256 _bondAmount,\n uint256 _unbondAmount\n ) external;\n\n /// @notice Blacklists a keeper from participating in the network\n /// @param _keeper The address being slashed\n function revoke(address _keeper) external;\n}\n\n// solhint-disable-next-line no-empty-blocks\n\n/// @title Keep3rKeepers contract\ninterface IKeep3rKeepers is IKeep3rKeeperDisputable {\n\n}\n" - }, - "solidity/interfaces/peripherals/IKeep3rParameters.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport './IKeep3rAccountance.sol';\n\n/// @title Keep3rParameters contract\n/// @notice Handles and sets all the required parameters for Keep3r\ninterface IKeep3rParameters is IKeep3rAccountance {\n // Events\n\n /// @notice Emitted when the Keep3rHelper address is changed\n /// @param _keep3rHelper The address of Keep3rHelper's contract\n event Keep3rHelperChange(address _keep3rHelper);\n\n /// @notice Emitted when the Keep3rV1 address is changed\n /// @param _keep3rV1 The address of Keep3rV1's contract\n event Keep3rV1Change(address _keep3rV1);\n\n /// @notice Emitted when the Keep3rV1Proxy address is changed\n /// @param _keep3rV1Proxy The address of Keep3rV1Proxy's contract\n event Keep3rV1ProxyChange(address _keep3rV1Proxy);\n\n /// @notice Emitted when bondTime is changed\n /// @param _bondTime The new bondTime\n event BondTimeChange(uint256 _bondTime);\n\n /// @notice Emitted when _liquidityMinimum is changed\n /// @param _liquidityMinimum The new _liquidityMinimum\n event LiquidityMinimumChange(uint256 _liquidityMinimum);\n\n /// @notice Emitted when _unbondTime is changed\n /// @param _unbondTime The new _unbondTime\n event UnbondTimeChange(uint256 _unbondTime);\n\n /// @notice Emitted when _rewardPeriodTime is changed\n /// @param _rewardPeriodTime The new _rewardPeriodTime\n event RewardPeriodTimeChange(uint256 _rewardPeriodTime);\n\n /// @notice Emitted when the inflationPeriod is changed\n /// @param _inflationPeriod The new inflationPeriod\n event InflationPeriodChange(uint256 _inflationPeriod);\n\n /// @notice Emitted when the fee is changed\n /// @param _fee The new token credits fee\n event FeeChange(uint256 _fee);\n\n // Variables\n\n /// @notice Address of Keep3rHelper's contract\n /// @return _keep3rHelper The address of Keep3rHelper's contract\n function keep3rHelper() external view returns (address _keep3rHelper);\n\n /// @notice Address of Keep3rV1's contract\n /// @return _keep3rV1 The address of Keep3rV1's contract\n function keep3rV1() external view returns (address _keep3rV1);\n\n /// @notice Address of Keep3rV1Proxy's contract\n /// @return _keep3rV1Proxy The address of Keep3rV1Proxy's contract\n function keep3rV1Proxy() external view returns (address _keep3rV1Proxy);\n\n /// @notice The amount of time required to pass after a keeper has bonded assets for it to be able to activate\n /// @return _days The required bondTime in days\n function bondTime() external view returns (uint256 _days);\n\n /// @notice The amount of time required to pass before a keeper can unbond what he has bonded\n /// @return _days The required unbondTime in days\n function unbondTime() external view returns (uint256 _days);\n\n /// @notice The minimum amount of liquidity required to fund a job per liquidity\n /// @return _amount The minimum amount of liquidity in KP3R\n function liquidityMinimum() external view returns (uint256 _amount);\n\n /// @notice The amount of time between each scheduled credits reward given to a job\n /// @return _days The reward period in days\n function rewardPeriodTime() external view returns (uint256 _days);\n\n /// @notice The inflation period is the denominator used to regulate the emission of KP3R\n /// @return _period The denominator used to regulate the emission of KP3R\n function inflationPeriod() external view returns (uint256 _period);\n\n /// @notice The fee to be sent to governance when a user adds liquidity to a job\n /// @return _amount The fee amount to be sent to governance when a user adds liquidity to a job\n function fee() external view returns (uint256 _amount);\n\n // Errors\n\n /// @notice Throws if the reward period is less than the minimum reward period time\n error MinRewardPeriod();\n\n /// @notice Throws if either a job or a keeper is disputed\n error Disputed();\n\n /// @notice Throws if there are no bonded assets\n error BondsUnexistent();\n\n /// @notice Throws if the time required to bond an asset has not passed yet\n error BondsLocked();\n\n /// @notice Throws if there are no bonds to withdraw\n error UnbondsUnexistent();\n\n /// @notice Throws if the time required to withdraw the bonds has not passed yet\n error UnbondsLocked();\n\n // Methods\n\n /// @notice Sets the Keep3rHelper address\n /// @param _keep3rHelper The Keep3rHelper address\n function setKeep3rHelper(address _keep3rHelper) external;\n\n /// @notice Sets the Keep3rV1 address\n /// @param _keep3rV1 The Keep3rV1 address\n function setKeep3rV1(address _keep3rV1) external;\n\n /// @notice Sets the Keep3rV1Proxy address\n /// @param _keep3rV1Proxy The Keep3rV1Proxy address\n function setKeep3rV1Proxy(address _keep3rV1Proxy) external;\n\n /// @notice Sets the bond time required to activate as a keeper\n /// @param _bond The new bond time\n function setBondTime(uint256 _bond) external;\n\n /// @notice Sets the unbond time required unbond what has been bonded\n /// @param _unbond The new unbond time\n function setUnbondTime(uint256 _unbond) external;\n\n /// @notice Sets the minimum amount of liquidity required to fund a job\n /// @param _liquidityMinimum The new minimum amount of liquidity\n function setLiquidityMinimum(uint256 _liquidityMinimum) external;\n\n /// @notice Sets the time required to pass between rewards for jobs\n /// @param _rewardPeriodTime The new amount of time required to pass between rewards\n function setRewardPeriodTime(uint256 _rewardPeriodTime) external;\n\n /// @notice Sets the new inflation period\n /// @param _inflationPeriod The new inflation period\n function setInflationPeriod(uint256 _inflationPeriod) external;\n\n /// @notice Sets the new fee\n /// @param _fee The new fee\n function setFee(uint256 _fee) external;\n}\n" - }, - "solidity/interfaces/peripherals/IKeep3rDisputable.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\n/// @title Keep3rDisputable contract\n/// @notice Creates/resolves disputes for jobs or keepers\n/// A disputed keeper is slashable and is not able to bond, activate, withdraw or receive direct payments\n/// A disputed job is slashable and is not able to pay the keepers, withdraw tokens or to migrate\ninterface IKeep3rDisputable {\n /// @notice Emitted when a keeper or a job is disputed\n /// @param _jobOrKeeper The address of the disputed keeper/job\n /// @param _disputer The user that called the function and disputed the keeper\n event Dispute(address indexed _jobOrKeeper, address indexed _disputer);\n\n /// @notice Emitted when a dispute is resolved\n /// @param _jobOrKeeper The address of the disputed keeper/job\n /// @param _resolver The user that called the function and resolved the dispute\n event Resolve(address indexed _jobOrKeeper, address indexed _resolver);\n\n /// @notice Throws when a job or keeper is already disputed\n error AlreadyDisputed();\n\n /// @notice Throws when a job or keeper is not disputed and someone tries to resolve the dispute\n error NotDisputed();\n\n /// @notice Allows governance to create a dispute for a given keeper/job\n /// @param _jobOrKeeper The address in dispute\n function dispute(address _jobOrKeeper) external;\n\n /// @notice Allows governance to resolve a dispute on a keeper/job\n /// @param _jobOrKeeper The address cleared\n function resolve(address _jobOrKeeper) external;\n}\n" - }, - "solidity/interfaces/peripherals/IKeep3rAccountance.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport './IKeep3rRoles.sol';\n\n/// @title Keep3rDisputable contract\n/// @notice Disputes keepers, or if they're already disputed, it can resolve the case\n/// @dev Argument `bonding` can be the address of either a token or a liquidity\ninterface IKeep3rAccountance is IKeep3rRoles {\n // Events\n\n /// @notice Emitted when the bonding process of a new keeper begins\n /// @param _keeper The caller of Keep3rKeeperFundable#bond function\n /// @param _bonding The asset the keeper has bonded\n /// @param _amount The amount the keeper has bonded\n event Bonding(address indexed _keeper, address indexed _bonding, uint256 _amount);\n\n /// @notice Emitted when a keeper or job begins the unbonding process to withdraw the funds\n /// @param _keeperOrJob The keeper or job that began the unbonding process\n /// @param _unbonding The liquidity pair or asset being unbonded\n /// @param _amount The amount being unbonded\n event Unbonding(address indexed _keeperOrJob, address indexed _unbonding, uint256 _amount);\n\n // Variables\n\n /// @notice Tracks the total amount of bonded KP3Rs in the contract\n /// @return _totalBonds The total amount of bonded KP3Rs in the contract\n function totalBonds() external view returns (uint256 _totalBonds);\n\n /// @notice Tracks the total KP3R earnings of a keeper since it started working\n /// @param _keeper The address of the keeper\n /// @return _workCompleted Total KP3R earnings of a keeper since it started working\n function workCompleted(address _keeper) external view returns (uint256 _workCompleted);\n\n /// @notice Tracks when a keeper was first registered\n /// @param _keeper The address of the keeper\n /// @return timestamp The time at which the keeper was first registered\n function firstSeen(address _keeper) external view returns (uint256 timestamp);\n\n /// @notice Tracks if a keeper or job has a pending dispute\n /// @param _keeperOrJob The address of the keeper or job\n /// @return _disputed Whether a keeper or job has a pending dispute\n function disputes(address _keeperOrJob) external view returns (bool _disputed);\n\n /// @notice Tracks how much a keeper has bonded of a certain token\n /// @param _keeper The address of the keeper\n /// @param _bond The address of the token being bonded\n /// @return _bonds Amount of a certain token that a keeper has bonded\n function bonds(address _keeper, address _bond) external view returns (uint256 _bonds);\n\n /// @notice The current token credits available for a job\n /// @param _job The address of the job\n /// @param _token The address of the token bonded\n /// @return _amount The amount of token credits available for a job\n function jobTokenCredits(address _job, address _token) external view returns (uint256 _amount);\n\n /// @notice Tracks the amount of assets deposited in pending bonds\n /// @param _keeper The address of the keeper\n /// @param _bonding The address of the token being bonded\n /// @return _pendingBonds Amount of a certain asset a keeper has unbonding\n function pendingBonds(address _keeper, address _bonding) external view returns (uint256 _pendingBonds);\n\n /// @notice Tracks when a bonding for a keeper can be activated\n /// @param _keeper The address of the keeper\n /// @param _bonding The address of the token being bonded\n /// @return _timestamp Time at which the bonding for a keeper can be activated\n function canActivateAfter(address _keeper, address _bonding) external view returns (uint256 _timestamp);\n\n /// @notice Tracks when keeper bonds are ready to be withdrawn\n /// @param _keeper The address of the keeper\n /// @param _bonding The address of the token being unbonded\n /// @return _timestamp Time at which the keeper bonds are ready to be withdrawn\n function canWithdrawAfter(address _keeper, address _bonding) external view returns (uint256 _timestamp);\n\n /// @notice Tracks how much keeper bonds are to be withdrawn\n /// @param _keeper The address of the keeper\n /// @param _bonding The address of the token being unbonded\n /// @return _pendingUnbonds The amount of keeper bonds that are to be withdrawn\n function pendingUnbonds(address _keeper, address _bonding) external view returns (uint256 _pendingUnbonds);\n\n /// @notice Checks whether the address has ever bonded an asset\n /// @param _keeper The address of the keeper\n /// @return _hasBonded Whether the address has ever bonded an asset\n function hasBonded(address _keeper) external view returns (bool _hasBonded);\n\n // Methods\n\n /// @notice Lists all jobs\n /// @return _jobList Array with all the jobs in _jobs\n function jobs() external view returns (address[] memory _jobList);\n\n /// @notice Lists all keepers\n /// @return _keeperList Array with all the keepers in _keepers\n function keepers() external view returns (address[] memory _keeperList);\n\n // Errors\n\n /// @notice Throws when an address is passed as a job, but that address is not a job\n error JobUnavailable();\n\n /// @notice Throws when an action that requires an undisputed job is applied on a disputed job\n error JobDisputed();\n}\n" - }, - "solidity/interfaces/peripherals/IKeep3rRoles.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport './IBaseErrors.sol';\nimport './IGovernable.sol';\nimport './IDustCollector.sol';\n\n/// @title Keep3rRoles contract\n/// @notice Manages the Keep3r specific roles\ninterface IKeep3rRoles is IBaseErrors, IDustCollector, IGovernable {\n // Events\n\n /// @notice Emitted when a slasher is added\n /// @param _slasher Address of the added slasher\n event SlasherAdded(address _slasher);\n\n /// @notice Emitted when a slasher is removed\n /// @param _slasher Address of the removed slasher\n event SlasherRemoved(address _slasher);\n\n /// @notice Emitted when a disputer is added\n /// @param _disputer Address of the added disputer\n event DisputerAdded(address _disputer);\n\n /// @notice Emitted when a disputer is removed\n /// @param _disputer Address of the removed disputer\n event DisputerRemoved(address _disputer);\n\n // Variables\n\n /// @notice Tracks whether the address is a slasher or not\n /// @param _slasher Address being checked as a slasher\n /// @return _isSlasher Whether the address is a slasher or not\n function slashers(address _slasher) external view returns (bool _isSlasher);\n\n /// @notice Tracks whether the address is a disputer or not\n /// @param _disputer Address being checked as a disputer\n /// @return _isDisputer Whether the address is a disputer or not\n function disputers(address _disputer) external view returns (bool _isDisputer);\n\n // Errors\n\n /// @notice Throws if the address is already a registered slasher\n error SlasherExistent();\n\n /// @notice Throws if caller is not a registered slasher\n error SlasherUnexistent();\n\n /// @notice Throws if the address is already a registered disputer\n error DisputerExistent();\n\n /// @notice Throws if caller is not a registered disputer\n error DisputerUnexistent();\n\n /// @notice Throws if the msg.sender is not a slasher or is not a part of governance\n error OnlySlasher();\n\n /// @notice Throws if the msg.sender is not a disputer or is not a part of governance\n error OnlyDisputer();\n\n // Methods\n\n /// @notice Registers a slasher by updating the slashers mapping\n function addSlasher(address _slasher) external;\n\n /// @notice Removes a slasher by updating the slashers mapping\n function removeSlasher(address _slasher) external;\n\n /// @notice Registers a disputer by updating the disputers mapping\n function addDisputer(address _disputer) external;\n\n /// @notice Removes a disputer by updating the disputers mapping\n function removeDisputer(address _disputer) external;\n}\n" - }, - "solidity/interfaces/peripherals/IBaseErrors.sol": { - "content": "// SPDX-License-Identifier: MIT\n\npragma solidity >=0.8.4 <0.9.0;\n\ninterface IBaseErrors {\n /// @notice Throws if a variable is assigned to the zero address\n error ZeroAddress();\n}\n" - }, - "solidity/interfaces/peripherals/IGovernable.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\n/// @title Governable contract\n/// @notice Manages the governance role\ninterface IGovernable {\n // Events\n\n /// @notice Emitted when pendingGovernance accepts to be governance\n /// @param _governance Address of the new governance\n event GovernanceSet(address _governance);\n\n /// @notice Emitted when a new governance is proposed\n /// @param _pendingGovernance Address that is proposed to be the new governance\n event GovernanceProposal(address _pendingGovernance);\n\n // Errors\n\n /// @notice Throws if the caller of the function is not governance\n error OnlyGovernance();\n\n /// @notice Throws if the caller of the function is not pendingGovernance\n error OnlyPendingGovernance();\n\n /// @notice Throws if trying to set governance to zero address\n error NoGovernanceZeroAddress();\n\n // Variables\n\n /// @notice Stores the governance address\n /// @return _governance The governance addresss\n function governance() external view returns (address _governance);\n\n /// @notice Stores the pendingGovernance address\n /// @return _pendingGovernance The pendingGovernance addresss\n function pendingGovernance() external view returns (address _pendingGovernance);\n\n // Methods\n\n /// @notice Proposes a new address to be governance\n /// @param _governance The address being proposed as the new governance\n function setGovernance(address _governance) external;\n\n /// @notice Changes the governance from the current governance to the previously proposed address\n function acceptGovernance() external;\n}\n" - }, - "solidity/interfaces/peripherals/IDustCollector.sol": { - "content": "// SPDX-License-Identifier: MIT\n\npragma solidity >=0.8.4 <0.9.0;\n\nimport './IBaseErrors.sol';\n\ninterface IDustCollector is IBaseErrors {\n /// @notice Emitted when dust is sent\n /// @param _token The token that will be transferred\n /// @param _amount The amount of the token that will be transferred\n /// @param _to The address which will receive the funds\n event DustSent(address _token, uint256 _amount, address _to);\n\n /// @notice Allows an authorized user to transfer the tokens or eth that may have been left in a contract\n /// @param _token The token that will be transferred\n /// @param _amount The amount of the token that will be transferred\n /// @param _to The address that will receive the idle funds\n function sendDust(\n address _token,\n uint256 _amount,\n address _to\n ) external;\n}\n" - }, - "solidity/contracts/peripherals/jobs/Keep3rJobManager.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport './Keep3rJobOwnership.sol';\nimport '../Keep3rAccountance.sol';\nimport '../../../interfaces/peripherals/IKeep3rJobs.sol';\n\nabstract contract Keep3rJobManager is IKeep3rJobManager, Keep3rJobOwnership, Keep3rAccountance {\n using EnumerableSet for EnumerableSet.AddressSet;\n\n /// @inheritdoc IKeep3rJobManager\n function addJob(address _job) external override {\n if (_jobs.contains(_job)) revert JobAlreadyAdded();\n if (hasBonded[_job]) revert AlreadyAKeeper();\n _jobs.add(_job);\n jobOwner[_job] = msg.sender;\n emit JobAddition(_job, msg.sender);\n }\n}\n" - }, - "solidity/contracts/peripherals/jobs/Keep3rJobWorkable.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport './Keep3rJobMigration.sol';\nimport '../../../interfaces/IKeep3rHelper.sol';\nimport '../../../interfaces/peripherals/IKeep3rJobs.sol';\n\nimport '@openzeppelin/contracts/token/ERC20/IERC20.sol';\nimport '@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol';\n\nabstract contract Keep3rJobWorkable is IKeep3rJobWorkable, Keep3rJobMigration {\n using EnumerableSet for EnumerableSet.AddressSet;\n using SafeERC20 for IERC20;\n\n uint256 internal _initialGas;\n\n /// @inheritdoc IKeep3rJobWorkable\n function isKeeper(address _keeper) external override returns (bool _isKeeper) {\n _initialGas = _getGasLeft();\n if (_keepers.contains(_keeper)) {\n emit KeeperValidation(_initialGas);\n return true;\n }\n }\n\n /// @inheritdoc IKeep3rJobWorkable\n function isBondedKeeper(\n address _keeper,\n address _bond,\n uint256 _minBond,\n uint256 _earned,\n uint256 _age\n ) external override returns (bool _isBondedKeeper) {\n _initialGas = _getGasLeft();\n if (\n _keepers.contains(_keeper) &&\n bonds[_keeper][_bond] >= _minBond &&\n workCompleted[_keeper] >= _earned &&\n block.timestamp - firstSeen[_keeper] >= _age\n ) {\n emit KeeperValidation(_initialGas);\n return true;\n }\n }\n\n /// @inheritdoc IKeep3rJobWorkable\n function worked(address _keeper) external virtual override {\n if (_initialGas == 0) revert GasNotInitialized();\n address _job = msg.sender;\n if (disputes[_job]) revert JobDisputed();\n if (!_jobs.contains(_job)) revert JobUnapproved();\n\n if (_updateJobCreditsIfNeeded(_job)) {\n emit LiquidityCreditsReward(_job, rewardedAt[_job], _jobLiquidityCredits[_job], _jobPeriodCredits[_job]);\n }\n\n (uint256 _boost, uint256 _oneEthQuote, uint256 _extraGas) = IKeep3rHelper(keep3rHelper).getPaymentParams(bonds[_keeper][keep3rV1]);\n\n uint256 _gasLeft = _getGasLeft();\n uint256 _payment = _calculatePayment(_gasLeft, _extraGas, _oneEthQuote, _boost);\n\n if (_payment > _jobLiquidityCredits[_job]) {\n _rewardJobCredits(_job);\n emit LiquidityCreditsReward(_job, rewardedAt[_job], _jobLiquidityCredits[_job], _jobPeriodCredits[_job]);\n\n _gasLeft = _getGasLeft();\n _payment = _calculatePayment(_gasLeft, _extraGas, _oneEthQuote, _boost);\n }\n\n _bondedPayment(_job, _keeper, _payment);\n delete _initialGas;\n\n emit KeeperWork(keep3rV1, _job, _keeper, _payment, _gasLeft);\n }\n\n /// @inheritdoc IKeep3rJobWorkable\n function bondedPayment(address _keeper, uint256 _payment) external override {\n address _job = msg.sender;\n\n if (disputes[_job]) revert JobDisputed();\n if (!_jobs.contains(_job)) revert JobUnapproved();\n\n if (_updateJobCreditsIfNeeded(_job)) {\n emit LiquidityCreditsReward(_job, rewardedAt[_job], _jobLiquidityCredits[_job], _jobPeriodCredits[_job]);\n }\n\n if (_payment > _jobLiquidityCredits[_job]) {\n _rewardJobCredits(_job);\n emit LiquidityCreditsReward(_job, rewardedAt[_job], _jobLiquidityCredits[_job], _jobPeriodCredits[_job]);\n }\n\n _bondedPayment(_job, _keeper, _payment);\n emit KeeperWork(keep3rV1, _job, _keeper, _payment, _getGasLeft());\n }\n\n /// @inheritdoc IKeep3rJobWorkable\n function directTokenPayment(\n address _token,\n address _keeper,\n uint256 _amount\n ) external override {\n address _job = msg.sender;\n\n if (disputes[_job]) revert JobDisputed();\n if (disputes[_keeper]) revert Disputed();\n if (!_jobs.contains(_job)) revert JobUnapproved();\n if (jobTokenCredits[_job][_token] < _amount) revert InsufficientFunds();\n jobTokenCredits[_job][_token] -= _amount;\n IERC20(_token).safeTransfer(_keeper, _amount);\n emit KeeperWork(_token, _job, _keeper, _amount, _getGasLeft());\n }\n\n function _bondedPayment(\n address _job,\n address _keeper,\n uint256 _payment\n ) internal {\n if (_payment > _jobLiquidityCredits[_job]) revert InsufficientFunds();\n\n workedAt[_job] = block.timestamp;\n _jobLiquidityCredits[_job] -= _payment;\n bonds[_keeper][keep3rV1] += _payment;\n workCompleted[_keeper] += _payment;\n totalBonds += _payment;\n }\n\n /// @notice Calculate amount to be payed in KP3R, taking into account multiple parameters\n /// @param _gasLeft Amount of gas left after working the job\n /// @param _extraGas Amount of expected unaccounted gas\n /// @param _oneEthQuote Amount of KP3R equivalent to 1 ETH\n /// @param _boost Reward given to the keeper for having bonded KP3R tokens\n /// @return _payment Amount to be payed in KP3R tokens\n function _calculatePayment(\n uint256 _gasLeft,\n uint256 _extraGas,\n uint256 _oneEthQuote,\n uint256 _boost\n ) internal view returns (uint256 _payment) {\n uint256 _accountedGas = _initialGas - _gasLeft + _extraGas;\n _payment = (((_accountedGas * _boost) / _BASE) * _oneEthQuote) / 1 ether;\n }\n\n /// @notice Return the gas left and add 1/64 in order to match real gas left at first level of depth (EIP-150)\n /// @return _gasLeft Amount of gas left recording taking into account EIP-150\n function _getGasLeft() internal view returns (uint256 _gasLeft) {\n _gasLeft = (gasleft() * 64) / 63;\n }\n}\n" - }, - "solidity/contracts/peripherals/jobs/Keep3rJobDisputable.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport './Keep3rJobFundableCredits.sol';\nimport './Keep3rJobFundableLiquidity.sol';\nimport '../Keep3rDisputable.sol';\n\nabstract contract Keep3rJobDisputable is IKeep3rJobDisputable, Keep3rDisputable, Keep3rJobFundableCredits, Keep3rJobFundableLiquidity {\n using EnumerableSet for EnumerableSet.AddressSet;\n using SafeERC20 for IERC20;\n\n /// @inheritdoc IKeep3rJobDisputable\n function slashTokenFromJob(\n address _job,\n address _token,\n uint256 _amount\n ) external override onlySlasher {\n if (!disputes[_job]) revert NotDisputed();\n if (!_jobTokens[_job].contains(_token)) revert JobTokenUnexistent();\n if (jobTokenCredits[_job][_token] < _amount) revert JobTokenInsufficient();\n\n try IERC20(_token).transfer(governance, _amount) {} catch {}\n jobTokenCredits[_job][_token] -= _amount;\n if (jobTokenCredits[_job][_token] == 0) {\n _jobTokens[_job].remove(_token);\n }\n\n emit JobSlashToken(_job, _token, msg.sender, _amount);\n }\n\n /// @inheritdoc IKeep3rJobDisputable\n function slashLiquidityFromJob(\n address _job,\n address _liquidity,\n uint256 _amount\n ) external override onlySlasher {\n if (!disputes[_job]) revert NotDisputed();\n\n _unbondLiquidityFromJob(_job, _liquidity, _amount);\n try IERC20(_liquidity).transfer(governance, _amount) {} catch {}\n emit JobSlashLiquidity(_job, _liquidity, msg.sender, _amount);\n }\n}\n" - }, - "solidity/contracts/peripherals/jobs/Keep3rJobOwnership.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../../../interfaces/peripherals/IKeep3rJobs.sol';\n\nabstract contract Keep3rJobOwnership is IKeep3rJobOwnership {\n /// @inheritdoc IKeep3rJobOwnership\n mapping(address => address) public override jobOwner;\n\n /// @inheritdoc IKeep3rJobOwnership\n mapping(address => address) public override jobPendingOwner;\n\n /// @inheritdoc IKeep3rJobOwnership\n function changeJobOwnership(address _job, address _newOwner) external override onlyJobOwner(_job) {\n jobPendingOwner[_job] = _newOwner;\n emit JobOwnershipChange(_job, jobOwner[_job], _newOwner);\n }\n\n /// @inheritdoc IKeep3rJobOwnership\n function acceptJobOwnership(address _job) external override onlyPendingJobOwner(_job) {\n address _previousOwner = jobOwner[_job];\n\n jobOwner[_job] = jobPendingOwner[_job];\n delete jobPendingOwner[_job];\n\n emit JobOwnershipAssent(msg.sender, _job, _previousOwner);\n }\n\n modifier onlyJobOwner(address _job) {\n if (msg.sender != jobOwner[_job]) revert OnlyJobOwner();\n _;\n }\n\n modifier onlyPendingJobOwner(address _job) {\n if (msg.sender != jobPendingOwner[_job]) revert OnlyPendingJobOwner();\n _;\n }\n}\n" - }, - "solidity/contracts/peripherals/Keep3rAccountance.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '@openzeppelin/contracts/utils/structs/EnumerableSet.sol';\nimport '../../interfaces/peripherals/IKeep3rAccountance.sol';\nimport './Keep3rRoles.sol';\n\nabstract contract Keep3rAccountance is IKeep3rAccountance, Keep3rRoles {\n using EnumerableSet for EnumerableSet.AddressSet;\n\n /// @notice List of all enabled keepers\n EnumerableSet.AddressSet internal _keepers;\n\n /// @inheritdoc IKeep3rAccountance\n uint256 public override totalBonds;\n\n /// @inheritdoc IKeep3rAccountance\n mapping(address => uint256) public override workCompleted;\n\n /// @inheritdoc IKeep3rAccountance\n mapping(address => uint256) public override firstSeen;\n\n /// @inheritdoc IKeep3rAccountance\n mapping(address => bool) public override disputes;\n\n /// @inheritdoc IKeep3rAccountance\n /// @notice Mapping (job => bonding => amount)\n mapping(address => mapping(address => uint256)) public override bonds;\n\n /// @inheritdoc IKeep3rAccountance\n mapping(address => mapping(address => uint256)) public override jobTokenCredits;\n\n /// @notice The current liquidity credits available for a job\n mapping(address => uint256) internal _jobLiquidityCredits;\n\n /// @notice Map the address of a job to its correspondent periodCredits\n mapping(address => uint256) internal _jobPeriodCredits;\n\n /// @notice Enumerable array of Job Tokens for Credits\n mapping(address => EnumerableSet.AddressSet) internal _jobTokens;\n\n /// @notice List of liquidities that a job has (job => liquidities)\n mapping(address => EnumerableSet.AddressSet) internal _jobLiquidities;\n\n /// @notice Liquidity pool to observe\n mapping(address => address) internal _liquidityPool;\n\n /// @notice Tracks if a pool has KP3R as token0\n mapping(address => bool) internal _isKP3RToken0;\n\n /// @inheritdoc IKeep3rAccountance\n mapping(address => mapping(address => uint256)) public override pendingBonds;\n\n /// @inheritdoc IKeep3rAccountance\n mapping(address => mapping(address => uint256)) public override canActivateAfter;\n\n /// @inheritdoc IKeep3rAccountance\n mapping(address => mapping(address => uint256)) public override canWithdrawAfter;\n\n /// @inheritdoc IKeep3rAccountance\n mapping(address => mapping(address => uint256)) public override pendingUnbonds;\n\n /// @inheritdoc IKeep3rAccountance\n mapping(address => bool) public override hasBonded;\n\n /// @notice List of all enabled jobs\n EnumerableSet.AddressSet internal _jobs;\n\n /// @inheritdoc IKeep3rAccountance\n function jobs() external view override returns (address[] memory _list) {\n _list = _jobs.values();\n }\n\n /// @inheritdoc IKeep3rAccountance\n function keepers() external view override returns (address[] memory _list) {\n _list = _keepers.values();\n }\n}\n" - }, - "@openzeppelin/contracts/utils/structs/EnumerableSet.sol": { - "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Library for managing\n * https://en.wikipedia.org/wiki/Set_(abstract_data_type)[sets] of primitive\n * types.\n *\n * Sets have the following properties:\n *\n * - Elements are added, removed, and checked for existence in constant time\n * (O(1)).\n * - Elements are enumerated in O(n). No guarantees are made on the ordering.\n *\n * ```\n * contract Example {\n * // Add the library methods\n * using EnumerableSet for EnumerableSet.AddressSet;\n *\n * // Declare a set state variable\n * EnumerableSet.AddressSet private mySet;\n * }\n * ```\n *\n * As of v3.3.0, sets of type `bytes32` (`Bytes32Set`), `address` (`AddressSet`)\n * and `uint256` (`UintSet`) are supported.\n */\nlibrary EnumerableSet {\n // To implement this library for multiple types with as little code\n // repetition as possible, we write it in terms of a generic Set type with\n // bytes32 values.\n // The Set implementation uses private functions, and user-facing\n // implementations (such as AddressSet) are just wrappers around the\n // underlying Set.\n // This means that we can only create new EnumerableSets for types that fit\n // in bytes32.\n\n struct Set {\n // Storage of set values\n bytes32[] _values;\n // Position of the value in the `values` array, plus 1 because index 0\n // means a value is not in the set.\n mapping(bytes32 => uint256) _indexes;\n }\n\n /**\n * @dev Add a value to a set. O(1).\n *\n * Returns true if the value was added to the set, that is if it was not\n * already present.\n */\n function _add(Set storage set, bytes32 value) private returns (bool) {\n if (!_contains(set, value)) {\n set._values.push(value);\n // The value is stored at length-1, but we add 1 to all indexes\n // and use 0 as a sentinel value\n set._indexes[value] = set._values.length;\n return true;\n } else {\n return false;\n }\n }\n\n /**\n * @dev Removes a value from a set. O(1).\n *\n * Returns true if the value was removed from the set, that is if it was\n * present.\n */\n function _remove(Set storage set, bytes32 value) private returns (bool) {\n // We read and store the value's index to prevent multiple reads from the same storage slot\n uint256 valueIndex = set._indexes[value];\n\n if (valueIndex != 0) {\n // Equivalent to contains(set, value)\n // To delete an element from the _values array in O(1), we swap the element to delete with the last one in\n // the array, and then remove the last element (sometimes called as 'swap and pop').\n // This modifies the order of the array, as noted in {at}.\n\n uint256 toDeleteIndex = valueIndex - 1;\n uint256 lastIndex = set._values.length - 1;\n\n if (lastIndex != toDeleteIndex) {\n bytes32 lastvalue = set._values[lastIndex];\n\n // Move the last value to the index where the value to delete is\n set._values[toDeleteIndex] = lastvalue;\n // Update the index for the moved value\n set._indexes[lastvalue] = valueIndex; // Replace lastvalue's index to valueIndex\n }\n\n // Delete the slot where the moved value was stored\n set._values.pop();\n\n // Delete the index for the deleted slot\n delete set._indexes[value];\n\n return true;\n } else {\n return false;\n }\n }\n\n /**\n * @dev Returns true if the value is in the set. O(1).\n */\n function _contains(Set storage set, bytes32 value) private view returns (bool) {\n return set._indexes[value] != 0;\n }\n\n /**\n * @dev Returns the number of values on the set. O(1).\n */\n function _length(Set storage set) private view returns (uint256) {\n return set._values.length;\n }\n\n /**\n * @dev Returns the value stored at position `index` in the set. O(1).\n *\n * Note that there are no guarantees on the ordering of values inside the\n * array, and it may change when more values are added or removed.\n *\n * Requirements:\n *\n * - `index` must be strictly less than {length}.\n */\n function _at(Set storage set, uint256 index) private view returns (bytes32) {\n return set._values[index];\n }\n\n /**\n * @dev Return the entire set in an array\n *\n * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed\n * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that\n * this function has an unbounded cost, and using it as part of a state-changing function may render the function\n * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.\n */\n function _values(Set storage set) private view returns (bytes32[] memory) {\n return set._values;\n }\n\n // Bytes32Set\n\n struct Bytes32Set {\n Set _inner;\n }\n\n /**\n * @dev Add a value to a set. O(1).\n *\n * Returns true if the value was added to the set, that is if it was not\n * already present.\n */\n function add(Bytes32Set storage set, bytes32 value) internal returns (bool) {\n return _add(set._inner, value);\n }\n\n /**\n * @dev Removes a value from a set. O(1).\n *\n * Returns true if the value was removed from the set, that is if it was\n * present.\n */\n function remove(Bytes32Set storage set, bytes32 value) internal returns (bool) {\n return _remove(set._inner, value);\n }\n\n /**\n * @dev Returns true if the value is in the set. O(1).\n */\n function contains(Bytes32Set storage set, bytes32 value) internal view returns (bool) {\n return _contains(set._inner, value);\n }\n\n /**\n * @dev Returns the number of values in the set. O(1).\n */\n function length(Bytes32Set storage set) internal view returns (uint256) {\n return _length(set._inner);\n }\n\n /**\n * @dev Returns the value stored at position `index` in the set. O(1).\n *\n * Note that there are no guarantees on the ordering of values inside the\n * array, and it may change when more values are added or removed.\n *\n * Requirements:\n *\n * - `index` must be strictly less than {length}.\n */\n function at(Bytes32Set storage set, uint256 index) internal view returns (bytes32) {\n return _at(set._inner, index);\n }\n\n /**\n * @dev Return the entire set in an array\n *\n * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed\n * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that\n * this function has an unbounded cost, and using it as part of a state-changing function may render the function\n * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.\n */\n function values(Bytes32Set storage set) internal view returns (bytes32[] memory) {\n return _values(set._inner);\n }\n\n // AddressSet\n\n struct AddressSet {\n Set _inner;\n }\n\n /**\n * @dev Add a value to a set. O(1).\n *\n * Returns true if the value was added to the set, that is if it was not\n * already present.\n */\n function add(AddressSet storage set, address value) internal returns (bool) {\n return _add(set._inner, bytes32(uint256(uint160(value))));\n }\n\n /**\n * @dev Removes a value from a set. O(1).\n *\n * Returns true if the value was removed from the set, that is if it was\n * present.\n */\n function remove(AddressSet storage set, address value) internal returns (bool) {\n return _remove(set._inner, bytes32(uint256(uint160(value))));\n }\n\n /**\n * @dev Returns true if the value is in the set. O(1).\n */\n function contains(AddressSet storage set, address value) internal view returns (bool) {\n return _contains(set._inner, bytes32(uint256(uint160(value))));\n }\n\n /**\n * @dev Returns the number of values in the set. O(1).\n */\n function length(AddressSet storage set) internal view returns (uint256) {\n return _length(set._inner);\n }\n\n /**\n * @dev Returns the value stored at position `index` in the set. O(1).\n *\n * Note that there are no guarantees on the ordering of values inside the\n * array, and it may change when more values are added or removed.\n *\n * Requirements:\n *\n * - `index` must be strictly less than {length}.\n */\n function at(AddressSet storage set, uint256 index) internal view returns (address) {\n return address(uint160(uint256(_at(set._inner, index))));\n }\n\n /**\n * @dev Return the entire set in an array\n *\n * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed\n * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that\n * this function has an unbounded cost, and using it as part of a state-changing function may render the function\n * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.\n */\n function values(AddressSet storage set) internal view returns (address[] memory) {\n bytes32[] memory store = _values(set._inner);\n address[] memory result;\n\n assembly {\n result := store\n }\n\n return result;\n }\n\n // UintSet\n\n struct UintSet {\n Set _inner;\n }\n\n /**\n * @dev Add a value to a set. O(1).\n *\n * Returns true if the value was added to the set, that is if it was not\n * already present.\n */\n function add(UintSet storage set, uint256 value) internal returns (bool) {\n return _add(set._inner, bytes32(value));\n }\n\n /**\n * @dev Removes a value from a set. O(1).\n *\n * Returns true if the value was removed from the set, that is if it was\n * present.\n */\n function remove(UintSet storage set, uint256 value) internal returns (bool) {\n return _remove(set._inner, bytes32(value));\n }\n\n /**\n * @dev Returns true if the value is in the set. O(1).\n */\n function contains(UintSet storage set, uint256 value) internal view returns (bool) {\n return _contains(set._inner, bytes32(value));\n }\n\n /**\n * @dev Returns the number of values on the set. O(1).\n */\n function length(UintSet storage set) internal view returns (uint256) {\n return _length(set._inner);\n }\n\n /**\n * @dev Returns the value stored at position `index` in the set. O(1).\n *\n * Note that there are no guarantees on the ordering of values inside the\n * array, and it may change when more values are added or removed.\n *\n * Requirements:\n *\n * - `index` must be strictly less than {length}.\n */\n function at(UintSet storage set, uint256 index) internal view returns (uint256) {\n return uint256(_at(set._inner, index));\n }\n\n /**\n * @dev Return the entire set in an array\n *\n * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed\n * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that\n * this function has an unbounded cost, and using it as part of a state-changing function may render the function\n * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.\n */\n function values(UintSet storage set) internal view returns (uint256[] memory) {\n bytes32[] memory store = _values(set._inner);\n uint256[] memory result;\n\n assembly {\n result := store\n }\n\n return result;\n }\n}\n" - }, - "solidity/contracts/peripherals/Keep3rRoles.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../../interfaces/peripherals/IKeep3rRoles.sol';\nimport '@openzeppelin/contracts/utils/structs/EnumerableSet.sol';\nimport './DustCollector.sol';\nimport './Governable.sol';\n\ncontract Keep3rRoles is IKeep3rRoles, Governable, DustCollector {\n /// @inheritdoc IKeep3rRoles\n mapping(address => bool) public override slashers;\n\n /// @inheritdoc IKeep3rRoles\n mapping(address => bool) public override disputers;\n\n constructor(address _governance) Governable(_governance) DustCollector() {}\n\n /// @inheritdoc IKeep3rRoles\n function addSlasher(address _slasher) external override onlyGovernance {\n if (_slasher == address(0)) revert ZeroAddress();\n if (slashers[_slasher]) revert SlasherExistent();\n slashers[_slasher] = true;\n emit SlasherAdded(_slasher);\n }\n\n /// @inheritdoc IKeep3rRoles\n function removeSlasher(address _slasher) external override onlyGovernance {\n if (!slashers[_slasher]) revert SlasherUnexistent();\n delete slashers[_slasher];\n emit SlasherRemoved(_slasher);\n }\n\n /// @inheritdoc IKeep3rRoles\n function addDisputer(address _disputer) external override onlyGovernance {\n if (_disputer == address(0)) revert ZeroAddress();\n if (disputers[_disputer]) revert DisputerExistent();\n disputers[_disputer] = true;\n emit DisputerAdded(_disputer);\n }\n\n /// @inheritdoc IKeep3rRoles\n function removeDisputer(address _disputer) external override onlyGovernance {\n if (!disputers[_disputer]) revert DisputerUnexistent();\n delete disputers[_disputer];\n emit DisputerRemoved(_disputer);\n }\n\n /// @notice Functions with this modifier can only be called by either a slasher or governance\n modifier onlySlasher {\n if (!slashers[msg.sender]) revert OnlySlasher();\n _;\n }\n\n /// @notice Functions with this modifier can only be called by either a disputer or governance\n modifier onlyDisputer {\n if (!disputers[msg.sender]) revert OnlyDisputer();\n _;\n }\n}\n" - }, - "solidity/contracts/peripherals/Governable.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../../interfaces/peripherals/IGovernable.sol';\n\nabstract contract Governable is IGovernable {\n /// @inheritdoc IGovernable\n address public override governance;\n\n /// @inheritdoc IGovernable\n address public override pendingGovernance;\n\n constructor(address _governance) {\n if (_governance == address(0)) revert NoGovernanceZeroAddress();\n governance = _governance;\n }\n\n /// @inheritdoc IGovernable\n function setGovernance(address _governance) external override onlyGovernance {\n pendingGovernance = _governance;\n emit GovernanceProposal(_governance);\n }\n\n /// @inheritdoc IGovernable\n function acceptGovernance() external override onlyPendingGovernance {\n governance = pendingGovernance;\n delete pendingGovernance;\n emit GovernanceSet(governance);\n }\n\n /// @notice Functions with this modifier can only be called by governance\n modifier onlyGovernance {\n if (msg.sender != governance) revert OnlyGovernance();\n _;\n }\n\n /// @notice Functions with this modifier can only be called by pendingGovernance\n modifier onlyPendingGovernance {\n if (msg.sender != pendingGovernance) revert OnlyPendingGovernance();\n _;\n }\n}\n" - }, - "@openzeppelin/contracts/token/ERC20/IERC20.sol": { - "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Interface of the ERC20 standard as defined in the EIP.\n */\ninterface IERC20 {\n /**\n * @dev Returns the amount of tokens in existence.\n */\n function totalSupply() external view returns (uint256);\n\n /**\n * @dev Returns the amount of tokens owned by `account`.\n */\n function balanceOf(address account) external view returns (uint256);\n\n /**\n * @dev Moves `amount` tokens from the caller's account to `recipient`.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * Emits a {Transfer} event.\n */\n function transfer(address recipient, uint256 amount) external returns (bool);\n\n /**\n * @dev Returns the remaining number of tokens that `spender` will be\n * allowed to spend on behalf of `owner` through {transferFrom}. This is\n * zero by default.\n *\n * This value changes when {approve} or {transferFrom} are called.\n */\n function allowance(address owner, address spender) external view returns (uint256);\n\n /**\n * @dev Sets `amount` as the allowance of `spender` over the caller's tokens.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * IMPORTANT: Beware that changing an allowance with this method brings the risk\n * that someone may use both the old and the new allowance by unfortunate\n * transaction ordering. One possible solution to mitigate this race\n * condition is to first reduce the spender's allowance to 0 and set the\n * desired value afterwards:\n * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729\n *\n * Emits an {Approval} event.\n */\n function approve(address spender, uint256 amount) external returns (bool);\n\n /**\n * @dev Moves `amount` tokens from `sender` to `recipient` using the\n * allowance mechanism. `amount` is then deducted from the caller's\n * allowance.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * Emits a {Transfer} event.\n */\n function transferFrom(\n address sender,\n address recipient,\n uint256 amount\n ) external returns (bool);\n\n /**\n * @dev Emitted when `value` tokens are moved from one account (`from`) to\n * another (`to`).\n *\n * Note that `value` may be zero.\n */\n event Transfer(address indexed from, address indexed to, uint256 value);\n\n /**\n * @dev Emitted when the allowance of a `spender` for an `owner` is set by\n * a call to {approve}. `value` is the new allowance.\n */\n event Approval(address indexed owner, address indexed spender, uint256 value);\n}\n" - }, - "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol": { - "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\nimport \"../IERC20.sol\";\nimport \"../../../utils/Address.sol\";\n\n/**\n * @title SafeERC20\n * @dev Wrappers around ERC20 operations that throw on failure (when the token\n * contract returns false). Tokens that return no value (and instead revert or\n * throw on failure) are also supported, non-reverting calls are assumed to be\n * successful.\n * To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract,\n * which allows you to call the safe operations as `token.safeTransfer(...)`, etc.\n */\nlibrary SafeERC20 {\n using Address for address;\n\n function safeTransfer(\n IERC20 token,\n address to,\n uint256 value\n ) internal {\n _callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value));\n }\n\n function safeTransferFrom(\n IERC20 token,\n address from,\n address to,\n uint256 value\n ) internal {\n _callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value));\n }\n\n /**\n * @dev Deprecated. This function has issues similar to the ones found in\n * {IERC20-approve}, and its usage is discouraged.\n *\n * Whenever possible, use {safeIncreaseAllowance} and\n * {safeDecreaseAllowance} instead.\n */\n function safeApprove(\n IERC20 token,\n address spender,\n uint256 value\n ) internal {\n // safeApprove should only be called when setting an initial allowance,\n // or when resetting it to zero. To increase and decrease it, use\n // 'safeIncreaseAllowance' and 'safeDecreaseAllowance'\n require(\n (value == 0) || (token.allowance(address(this), spender) == 0),\n \"SafeERC20: approve from non-zero to non-zero allowance\"\n );\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value));\n }\n\n function safeIncreaseAllowance(\n IERC20 token,\n address spender,\n uint256 value\n ) internal {\n uint256 newAllowance = token.allowance(address(this), spender) + value;\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));\n }\n\n function safeDecreaseAllowance(\n IERC20 token,\n address spender,\n uint256 value\n ) internal {\n unchecked {\n uint256 oldAllowance = token.allowance(address(this), spender);\n require(oldAllowance >= value, \"SafeERC20: decreased allowance below zero\");\n uint256 newAllowance = oldAllowance - value;\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));\n }\n }\n\n /**\n * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement\n * on the return value: the return value is optional (but if data is returned, it must not be false).\n * @param token The token targeted by the call.\n * @param data The call data (encoded using abi.encode or one of its variants).\n */\n function _callOptionalReturn(IERC20 token, bytes memory data) private {\n // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since\n // we're implementing it ourselves. We use {Address.functionCall} to perform this call, which verifies that\n // the target address contains contract code and also asserts for success in the low-level call.\n\n bytes memory returndata = address(token).functionCall(data, \"SafeERC20: low-level call failed\");\n if (returndata.length > 0) {\n // Return data is optional\n require(abi.decode(returndata, (bool)), \"SafeERC20: ERC20 operation did not succeed\");\n }\n }\n}\n" - }, - "@openzeppelin/contracts/utils/Address.sol": { - "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Collection of functions related to the address type\n */\nlibrary Address {\n /**\n * @dev Returns true if `account` is a contract.\n *\n * [IMPORTANT]\n * ====\n * It is unsafe to assume that an address for which this function returns\n * false is an externally-owned account (EOA) and not a contract.\n *\n * Among others, `isContract` will return false for the following\n * types of addresses:\n *\n * - an externally-owned account\n * - a contract in construction\n * - an address where a contract will be created\n * - an address where a contract lived, but was destroyed\n * ====\n */\n function isContract(address account) internal view returns (bool) {\n // This method relies on extcodesize, which returns 0 for contracts in\n // construction, since the code is only stored at the end of the\n // constructor execution.\n\n uint256 size;\n assembly {\n size := extcodesize(account)\n }\n return size > 0;\n }\n\n /**\n * @dev Replacement for Solidity's `transfer`: sends `amount` wei to\n * `recipient`, forwarding all available gas and reverting on errors.\n *\n * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost\n * of certain opcodes, possibly making contracts go over the 2300 gas limit\n * imposed by `transfer`, making them unable to receive funds via\n * `transfer`. {sendValue} removes this limitation.\n *\n * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].\n *\n * IMPORTANT: because control is transferred to `recipient`, care must be\n * taken to not create reentrancy vulnerabilities. Consider using\n * {ReentrancyGuard} or the\n * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].\n */\n function sendValue(address payable recipient, uint256 amount) internal {\n require(address(this).balance >= amount, \"Address: insufficient balance\");\n\n (bool success, ) = recipient.call{value: amount}(\"\");\n require(success, \"Address: unable to send value, recipient may have reverted\");\n }\n\n /**\n * @dev Performs a Solidity function call using a low level `call`. A\n * plain `call` is an unsafe replacement for a function call: use this\n * function instead.\n *\n * If `target` reverts with a revert reason, it is bubbled up by this\n * function (like regular Solidity function calls).\n *\n * Returns the raw returned data. To convert to the expected return value,\n * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\n *\n * Requirements:\n *\n * - `target` must be a contract.\n * - calling `target` with `data` must not revert.\n *\n * _Available since v3.1._\n */\n function functionCall(address target, bytes memory data) internal returns (bytes memory) {\n return functionCall(target, data, \"Address: low-level call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with\n * `errorMessage` as a fallback revert reason when `target` reverts.\n *\n * _Available since v3.1._\n */\n function functionCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal returns (bytes memory) {\n return functionCallWithValue(target, data, 0, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but also transferring `value` wei to `target`.\n *\n * Requirements:\n *\n * - the calling contract must have an ETH balance of at least `value`.\n * - the called Solidity function must be `payable`.\n *\n * _Available since v3.1._\n */\n function functionCallWithValue(\n address target,\n bytes memory data,\n uint256 value\n ) internal returns (bytes memory) {\n return functionCallWithValue(target, data, value, \"Address: low-level call with value failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but\n * with `errorMessage` as a fallback revert reason when `target` reverts.\n *\n * _Available since v3.1._\n */\n function functionCallWithValue(\n address target,\n bytes memory data,\n uint256 value,\n string memory errorMessage\n ) internal returns (bytes memory) {\n require(address(this).balance >= value, \"Address: insufficient balance for call\");\n require(isContract(target), \"Address: call to non-contract\");\n\n (bool success, bytes memory returndata) = target.call{value: value}(data);\n return verifyCallResult(success, returndata, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but performing a static call.\n *\n * _Available since v3.3._\n */\n function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\n return functionStaticCall(target, data, \"Address: low-level static call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\n * but performing a static call.\n *\n * _Available since v3.3._\n */\n function functionStaticCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal view returns (bytes memory) {\n require(isContract(target), \"Address: static call to non-contract\");\n\n (bool success, bytes memory returndata) = target.staticcall(data);\n return verifyCallResult(success, returndata, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but performing a delegate call.\n *\n * _Available since v3.4._\n */\n function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {\n return functionDelegateCall(target, data, \"Address: low-level delegate call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\n * but performing a delegate call.\n *\n * _Available since v3.4._\n */\n function functionDelegateCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal returns (bytes memory) {\n require(isContract(target), \"Address: delegate call to non-contract\");\n\n (bool success, bytes memory returndata) = target.delegatecall(data);\n return verifyCallResult(success, returndata, errorMessage);\n }\n\n /**\n * @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the\n * revert reason using the provided one.\n *\n * _Available since v4.3._\n */\n function verifyCallResult(\n bool success,\n bytes memory returndata,\n string memory errorMessage\n ) internal pure returns (bytes memory) {\n if (success) {\n return returndata;\n } else {\n // Look for revert reason and bubble it up if present\n if (returndata.length > 0) {\n // The easiest way to bubble the revert reason is using memory via assembly\n\n assembly {\n let returndata_size := mload(returndata)\n revert(add(32, returndata), returndata_size)\n }\n } else {\n revert(errorMessage);\n }\n }\n }\n}\n" - }, - "solidity/contracts/peripherals/jobs/Keep3rJobMigration.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../../../interfaces/peripherals/IKeep3rJobs.sol';\nimport './Keep3rJobFundableCredits.sol';\nimport './Keep3rJobFundableLiquidity.sol';\n\nabstract contract Keep3rJobMigration is IKeep3rJobMigration, Keep3rJobFundableCredits, Keep3rJobFundableLiquidity {\n using EnumerableSet for EnumerableSet.AddressSet;\n\n uint256 internal constant _MIGRATION_COOLDOWN = 1 minutes;\n\n /// @inheritdoc IKeep3rJobMigration\n mapping(address => address) public override pendingJobMigrations;\n mapping(address => mapping(address => uint256)) internal _migrationCreatedAt;\n\n /// @inheritdoc IKeep3rJobMigration\n function migrateJob(address _fromJob, address _toJob) external override onlyJobOwner(_fromJob) {\n if (_fromJob == _toJob) revert JobMigrationImpossible();\n\n pendingJobMigrations[_fromJob] = _toJob;\n _migrationCreatedAt[_fromJob][_toJob] = block.timestamp;\n\n emit JobMigrationRequested(_fromJob, _toJob);\n }\n\n /// @inheritdoc IKeep3rJobMigration\n function acceptJobMigration(address _fromJob, address _toJob) external override onlyJobOwner(_toJob) {\n if (disputes[_fromJob] || disputes[_toJob]) revert JobDisputed();\n if (pendingJobMigrations[_fromJob] != _toJob) revert JobMigrationUnavailable();\n if (block.timestamp < _migrationCreatedAt[_fromJob][_toJob] + _MIGRATION_COOLDOWN) revert JobMigrationLocked();\n\n // force job credits update for both jobs\n _settleJobAccountance(_fromJob);\n _settleJobAccountance(_toJob);\n\n // migrate tokens\n while (_jobTokens[_fromJob].length() > 0) {\n address _tokenToMigrate = _jobTokens[_fromJob].at(0);\n jobTokenCredits[_toJob][_tokenToMigrate] += jobTokenCredits[_fromJob][_tokenToMigrate];\n delete jobTokenCredits[_fromJob][_tokenToMigrate];\n _jobTokens[_fromJob].remove(_tokenToMigrate);\n _jobTokens[_toJob].add(_tokenToMigrate);\n }\n\n // migrate liquidities\n while (_jobLiquidities[_fromJob].length() > 0) {\n address _liquidity = _jobLiquidities[_fromJob].at(0);\n\n liquidityAmount[_toJob][_liquidity] += liquidityAmount[_fromJob][_liquidity];\n delete liquidityAmount[_fromJob][_liquidity];\n\n _jobLiquidities[_toJob].add(_liquidity);\n _jobLiquidities[_fromJob].remove(_liquidity);\n }\n\n // migrate job balances\n _jobPeriodCredits[_toJob] += _jobPeriodCredits[_fromJob];\n delete _jobPeriodCredits[_fromJob];\n\n _jobLiquidityCredits[_toJob] += _jobLiquidityCredits[_fromJob];\n delete _jobLiquidityCredits[_fromJob];\n\n // stop _fromJob from being a job\n delete rewardedAt[_fromJob];\n _jobs.remove(_fromJob);\n\n // delete unused data slots\n delete jobOwner[_fromJob];\n delete jobPendingOwner[_fromJob];\n delete _migrationCreatedAt[_fromJob][_toJob];\n delete pendingJobMigrations[_fromJob];\n\n emit JobMigrationSuccessful(_fromJob, _toJob);\n }\n}\n" - }, - "solidity/interfaces/IKeep3rHelper.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport './IKeep3rHelperParameters.sol';\n\n/// @title Keep3rHelper contract\n/// @notice Contains all the helper functions used throughout the different files.\ninterface IKeep3rHelper is IKeep3rHelperParameters {\n // Errors\n\n /// @notice Throws when none of the tokens in the liquidity pair is KP3R\n error LiquidityPairInvalid();\n\n // Methods\n // solhint-enable func-name-mixedcase\n\n /// @notice Calculates the amount of KP3R that corresponds to the ETH passed into the function\n /// @dev This function allows us to calculate how much KP3R we should pay to a keeper for things expressed in ETH, like gas\n /// @param _eth The amount of ETH\n /// @return _amountOut The amount of KP3R\n function quote(uint256 _eth) external view returns (uint256 _amountOut);\n\n /// @notice Returns the amount of KP3R the keeper has bonded\n /// @param _keeper The address of the keeper to check\n /// @return _amountBonded The amount of KP3R the keeper has bonded\n function bonds(address _keeper) external view returns (uint256 _amountBonded);\n\n /// @notice Calculates the reward (in KP3R) that corresponds to a keeper for using gas\n /// @param _keeper The address of the keeper to check\n /// @param _gasUsed The amount of gas used that will be rewarded\n /// @return _kp3r The amount of KP3R that should be awarded to the keeper\n function getRewardAmountFor(address _keeper, uint256 _gasUsed) external view returns (uint256 _kp3r);\n\n /// @notice Calculates the boost in the reward given to a keeper based on the amount of KP3R that keeper has bonded\n /// @dev If the keeper has no bonds, boost should be +10% of gas cost, if keeper has max bonds, +20%\n /// @param _bonds The amount of KP3R tokens bonded by the keeper\n /// @return _rewardBoost The reward boost that corresponds to the keeper\n function getRewardBoostFor(uint256 _bonds) external view returns (uint256 _rewardBoost);\n\n /// @notice Calculates the reward (in KP3R) that corresponds to tx.origin for using gas\n /// @param _gasUsed The amount of gas used that will be rewarded\n /// @return _amount The amount of KP3R that should be awarded to tx.origin\n function getRewardAmount(uint256 _gasUsed) external view returns (uint256 _amount);\n\n /// @notice Given a pool address, returns the underlying tokens of the pair\n /// @param _pool Address of the correspondant pool\n /// @return _token0 Address of the first token of the pair\n /// @return _token1 Address of the second token of the pair\n function getPoolTokens(address _pool) external view returns (address _token0, address _token1);\n\n /// @notice Defines the order of the tokens in the pair for twap calculations\n /// @param _pool Address of the correspondant pool\n /// @return _isKP3RToken0 Boolean indicating the order of the tokens in the pair\n function isKP3RToken0(address _pool) external view returns (bool _isKP3RToken0);\n\n /// @notice Given an array of secondsAgo, returns UniswapV3 pool cumulatives at that moment\n /// @param _pool Address of the pool to observe\n /// @param _secondsAgo Array with time references to observe\n /// @return _tickCumulative1 Cumulative sum of ticks until first time reference\n /// @return _tickCumulative2 Cumulative sum of ticks until second time reference\n /// @return _success Boolean indicating if the observe call was succesfull\n function observe(address _pool, uint32[] memory _secondsAgo)\n external\n view\n returns (\n int56 _tickCumulative1,\n int56 _tickCumulative2,\n bool _success\n );\n\n /// @notice Get multiplier, quote, and extra, in order to calculate keeper payment\n /// @param _bonds Amount of bonded KP3R owned by the keeper\n /// @return _boost Multiplier per gas unit. Takes into account the base fee and the amount of bonded KP3R\n /// @return _oneEthQuote Amount of KP3R tokens equivalent to 1 ETH\n /// @return _extra Amount of extra gas that should be added to the gas spent\n function getPaymentParams(uint256 _bonds)\n external\n view\n returns (\n uint256 _boost,\n uint256 _oneEthQuote,\n uint256 _extra\n );\n\n /// @notice Given a tick and a liquidity amount, calculates the underlying KP3R tokens\n /// @param _liquidityAmount Amount of liquidity to be converted\n /// @param _tickDifference Tick value used to calculate the quote\n /// @param _timeInterval Time value used to calculate the quote\n /// @return _kp3rAmount Amount of KP3R tokens underlying on the given liquidity\n function getKP3RsAtTick(\n uint256 _liquidityAmount,\n int56 _tickDifference,\n uint256 _timeInterval\n ) external pure returns (uint256 _kp3rAmount);\n\n /// @notice Given a tick and a token amount, calculates the output in correspondant token\n /// @param _baseAmount Amount of token to be converted\n /// @param _tickDifference Tick value used to calculate the quote\n /// @param _timeInterval Time value used to calculate the quote\n /// @return _quoteAmount Amount of credits deserved for the baseAmount at the tick value\n function getQuoteAtTick(\n uint128 _baseAmount,\n int56 _tickDifference,\n uint256 _timeInterval\n ) external pure returns (uint256 _quoteAmount);\n}\n" - }, - "solidity/contracts/peripherals/jobs/Keep3rJobFundableCredits.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport './Keep3rJobOwnership.sol';\nimport '../Keep3rAccountance.sol';\nimport '../Keep3rParameters.sol';\nimport '../../../interfaces/peripherals/IKeep3rJobs.sol';\n\nimport '@openzeppelin/contracts/security/ReentrancyGuard.sol';\nimport '@openzeppelin/contracts/token/ERC20/IERC20.sol';\nimport '@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol';\nimport '@openzeppelin/contracts/utils/math/Math.sol';\n\nabstract contract Keep3rJobFundableCredits is IKeep3rJobFundableCredits, ReentrancyGuard, Keep3rJobOwnership, Keep3rParameters {\n using EnumerableSet for EnumerableSet.AddressSet;\n using SafeERC20 for IERC20;\n\n /// @notice Cooldown between withdrawals\n uint256 internal constant _WITHDRAW_TOKENS_COOLDOWN = 1 minutes;\n\n /// @inheritdoc IKeep3rJobFundableCredits\n mapping(address => mapping(address => uint256)) public override jobTokenCreditsAddedAt;\n\n /// @inheritdoc IKeep3rJobFundableCredits\n function addTokenCreditsToJob(\n address _job,\n address _token,\n uint256 _amount\n ) external override nonReentrant {\n if (!_jobs.contains(_job)) revert JobUnavailable();\n // KP3R shouldn't be used for direct token payments\n if (_token == keep3rV1) revert TokenUnallowed();\n uint256 _before = IERC20(_token).balanceOf(address(this));\n IERC20(_token).safeTransferFrom(msg.sender, address(this), _amount);\n uint256 _received = IERC20(_token).balanceOf(address(this)) - _before;\n uint256 _tokenFee = (_received * fee) / _BASE;\n jobTokenCredits[_job][_token] += _received - _tokenFee;\n jobTokenCreditsAddedAt[_job][_token] = block.timestamp;\n IERC20(_token).safeTransfer(governance, _tokenFee);\n _jobTokens[_job].add(_token);\n\n emit TokenCreditAddition(_job, _token, msg.sender, _received);\n }\n\n /// @inheritdoc IKeep3rJobFundableCredits\n function withdrawTokenCreditsFromJob(\n address _job,\n address _token,\n uint256 _amount,\n address _receiver\n ) external override nonReentrant onlyJobOwner(_job) {\n if (block.timestamp <= jobTokenCreditsAddedAt[_job][_token] + _WITHDRAW_TOKENS_COOLDOWN) revert JobTokenCreditsLocked();\n if (jobTokenCredits[_job][_token] < _amount) revert InsufficientJobTokenCredits();\n if (disputes[_job]) revert JobDisputed();\n\n jobTokenCredits[_job][_token] -= _amount;\n IERC20(_token).safeTransfer(_receiver, _amount);\n\n if (jobTokenCredits[_job][_token] == 0) {\n _jobTokens[_job].remove(_token);\n }\n\n emit TokenCreditWithdrawal(_job, _token, _receiver, _amount);\n }\n}\n" - }, - "solidity/contracts/peripherals/jobs/Keep3rJobFundableLiquidity.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport './Keep3rJobOwnership.sol';\nimport '../Keep3rAccountance.sol';\nimport '../Keep3rParameters.sol';\nimport '../../../interfaces/IPairManager.sol';\nimport '../../../interfaces/peripherals/IKeep3rJobs.sol';\n\nimport '../../libraries/FullMath.sol';\n\nimport '@openzeppelin/contracts/security/ReentrancyGuard.sol';\nimport '@openzeppelin/contracts/token/ERC20/IERC20.sol';\nimport '@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol';\nimport '@openzeppelin/contracts/utils/math/Math.sol';\n\nabstract contract Keep3rJobFundableLiquidity is IKeep3rJobFundableLiquidity, ReentrancyGuard, Keep3rJobOwnership, Keep3rParameters {\n using EnumerableSet for EnumerableSet.AddressSet;\n using SafeERC20 for IERC20;\n\n /// @notice List of liquidities that are accepted in the system\n EnumerableSet.AddressSet internal _approvedLiquidities;\n\n /// @inheritdoc IKeep3rJobFundableLiquidity\n mapping(address => mapping(address => uint256)) public override liquidityAmount;\n\n /// @inheritdoc IKeep3rJobFundableLiquidity\n mapping(address => uint256) public override rewardedAt;\n\n /// @inheritdoc IKeep3rJobFundableLiquidity\n mapping(address => uint256) public override workedAt;\n\n /// @notice Tracks an address and returns its TickCache\n mapping(address => TickCache) internal _tick;\n\n // Views\n\n /// @inheritdoc IKeep3rJobFundableLiquidity\n function approvedLiquidities() external view override returns (address[] memory _list) {\n _list = _approvedLiquidities.values();\n }\n\n /// @inheritdoc IKeep3rJobFundableLiquidity\n function jobPeriodCredits(address _job) public view override returns (uint256 _periodCredits) {\n for (uint256 i; i < _jobLiquidities[_job].length(); i++) {\n address _liquidity = _jobLiquidities[_job].at(i);\n if (_approvedLiquidities.contains(_liquidity)) {\n TickCache memory _tickCache = observeLiquidity(_liquidity);\n if (_tickCache.period != 0) {\n int56 _tickDifference = _isKP3RToken0[_liquidity] ? _tickCache.difference : -_tickCache.difference;\n _periodCredits += _getReward(\n IKeep3rHelper(keep3rHelper).getKP3RsAtTick(liquidityAmount[_job][_liquidity], _tickDifference, rewardPeriodTime)\n );\n }\n }\n }\n }\n\n /// @inheritdoc IKeep3rJobFundableLiquidity\n function jobLiquidityCredits(address _job) public view override returns (uint256 _liquidityCredits) {\n uint256 _periodCredits = jobPeriodCredits(_job);\n\n // If the job was rewarded in the past 1 period time\n if ((block.timestamp - rewardedAt[_job]) < rewardPeriodTime) {\n // If the job has period credits, update minted job credits to new twap\n _liquidityCredits = _periodCredits > 0\n ? (_jobLiquidityCredits[_job] * _periodCredits) / _jobPeriodCredits[_job] // If the job has period credits, return remaining job credits updated to new twap\n : _jobLiquidityCredits[_job]; // If not, return remaining credits, forced credits should not be updated\n } else {\n // Else return a full period worth of credits if current credits have expired\n _liquidityCredits = _periodCredits;\n }\n }\n\n /// @inheritdoc IKeep3rJobFundableLiquidity\n function totalJobCredits(address _job) external view override returns (uint256 _credits) {\n uint256 _periodCredits = jobPeriodCredits(_job);\n uint256 _cooldown = block.timestamp;\n\n if ((rewardedAt[_job] > _period(block.timestamp - rewardPeriodTime))) {\n // Will calculate cooldown if it outdated\n if ((block.timestamp - rewardedAt[_job]) >= rewardPeriodTime) {\n // Will calculate cooldown from last reward reference in this period\n _cooldown -= (rewardedAt[_job] + rewardPeriodTime);\n } else {\n // Will calculate cooldown from last reward timestamp\n _cooldown -= rewardedAt[_job];\n }\n } else {\n // Will calculate cooldown from period start if expired\n _cooldown -= _period(block.timestamp);\n }\n _credits = jobLiquidityCredits(_job) + _phase(_cooldown, _periodCredits);\n }\n\n /// @inheritdoc IKeep3rJobFundableLiquidity\n function quoteLiquidity(address _liquidity, uint256 _amount) external view override returns (uint256 _periodCredits) {\n if (_approvedLiquidities.contains(_liquidity)) {\n TickCache memory _tickCache = observeLiquidity(_liquidity);\n if (_tickCache.period != 0) {\n int56 _tickDifference = _isKP3RToken0[_liquidity] ? _tickCache.difference : -_tickCache.difference;\n return _getReward(IKeep3rHelper(keep3rHelper).getKP3RsAtTick(_amount, _tickDifference, rewardPeriodTime));\n }\n }\n }\n\n /// @inheritdoc IKeep3rJobFundableLiquidity\n function observeLiquidity(address _liquidity) public view virtual override returns (TickCache memory _tickCache) {\n if (_tick[_liquidity].period == _period(block.timestamp)) {\n // Will return cached twaps if liquidity is updated\n _tickCache = _tick[_liquidity];\n } else {\n bool success;\n uint256 lastPeriod = _period(block.timestamp - rewardPeriodTime);\n\n if (_tick[_liquidity].period == lastPeriod) {\n // Will only ask for current period accumulator if liquidity is outdated\n uint32[] memory _secondsAgo = new uint32[](1);\n int56 previousTick = _tick[_liquidity].current;\n\n _secondsAgo[0] = uint32(block.timestamp - _period(block.timestamp));\n\n (_tickCache.current, , success) = IKeep3rHelper(keep3rHelper).observe(_liquidityPool[_liquidity], _secondsAgo);\n\n _tickCache.difference = _tickCache.current - previousTick;\n } else if (_tick[_liquidity].period < lastPeriod) {\n // Will ask for 2 accumulators if liquidity is expired\n uint32[] memory _secondsAgo = new uint32[](2);\n\n _secondsAgo[0] = uint32(block.timestamp - _period(block.timestamp));\n _secondsAgo[1] = uint32(block.timestamp - _period(block.timestamp) + rewardPeriodTime);\n\n int56 _tickCumulative2;\n (_tickCache.current, _tickCumulative2, success) = IKeep3rHelper(keep3rHelper).observe(_liquidityPool[_liquidity], _secondsAgo);\n\n _tickCache.difference = _tickCache.current - _tickCumulative2;\n }\n if (success) {\n _tickCache.period = _period(block.timestamp);\n } else {\n delete _tickCache.period;\n }\n }\n }\n\n // Methods\n\n /// @inheritdoc IKeep3rJobFundableLiquidity\n function forceLiquidityCreditsToJob(address _job, uint256 _amount) external override onlyGovernance {\n if (!_jobs.contains(_job)) revert JobUnavailable();\n _settleJobAccountance(_job);\n _jobLiquidityCredits[_job] += _amount;\n emit LiquidityCreditsForced(_job, rewardedAt[_job], _jobLiquidityCredits[_job]);\n }\n\n /// @inheritdoc IKeep3rJobFundableLiquidity\n function approveLiquidity(address _liquidity) external virtual override onlyGovernance {\n if (!_approvedLiquidities.add(_liquidity)) revert LiquidityPairApproved();\n _liquidityPool[_liquidity] = IPairManager(_liquidity).pool();\n _isKP3RToken0[_liquidity] = IKeep3rHelper(keep3rHelper).isKP3RToken0(_liquidityPool[_liquidity]);\n _tick[_liquidity] = observeLiquidity(_liquidity);\n emit LiquidityApproval(_liquidity);\n }\n\n /// @inheritdoc IKeep3rJobFundableLiquidity\n function revokeLiquidity(address _liquidity) external override onlyGovernance {\n if (!_approvedLiquidities.remove(_liquidity)) revert LiquidityPairUnexistent();\n delete _liquidityPool[_liquidity];\n delete _isKP3RToken0[_liquidity];\n delete _tick[_liquidity];\n\n emit LiquidityRevocation(_liquidity);\n }\n\n /// @inheritdoc IKeep3rJobFundableLiquidity\n function addLiquidityToJob(\n address _job,\n address _liquidity,\n uint256 _amount\n ) external override nonReentrant {\n if (!_approvedLiquidities.contains(_liquidity)) revert LiquidityPairUnapproved();\n if (!_jobs.contains(_job)) revert JobUnavailable();\n\n _jobLiquidities[_job].add(_liquidity);\n\n _settleJobAccountance(_job);\n\n if (_quoteLiquidity(liquidityAmount[_job][_liquidity] + _amount, _liquidity) < liquidityMinimum) revert JobLiquidityLessThanMin();\n\n emit LiquidityCreditsReward(_job, rewardedAt[_job], _jobLiquidityCredits[_job], _jobPeriodCredits[_job]);\n\n IERC20(_liquidity).safeTransferFrom(msg.sender, address(this), _amount);\n liquidityAmount[_job][_liquidity] += _amount;\n _jobPeriodCredits[_job] += _getReward(_quoteLiquidity(_amount, _liquidity));\n emit LiquidityAddition(_job, _liquidity, msg.sender, _amount);\n }\n\n /// @inheritdoc IKeep3rJobFundableLiquidity\n function unbondLiquidityFromJob(\n address _job,\n address _liquidity,\n uint256 _amount\n ) external override onlyJobOwner(_job) {\n canWithdrawAfter[_job][_liquidity] = block.timestamp + unbondTime;\n pendingUnbonds[_job][_liquidity] += _amount;\n _unbondLiquidityFromJob(_job, _liquidity, _amount);\n\n uint256 _remainingLiquidity = liquidityAmount[_job][_liquidity];\n if (_remainingLiquidity > 0 && _quoteLiquidity(_remainingLiquidity, _liquidity) < liquidityMinimum) revert JobLiquidityLessThanMin();\n\n emit Unbonding(_job, _liquidity, _amount);\n }\n\n /// @inheritdoc IKeep3rJobFundableLiquidity\n function withdrawLiquidityFromJob(\n address _job,\n address _liquidity,\n address _receiver\n ) external override onlyJobOwner(_job) {\n if (_receiver == address(0)) revert ZeroAddress();\n if (pendingUnbonds[_job][_liquidity] == 0) revert UnbondsUnexistent();\n if (canWithdrawAfter[_job][_liquidity] >= block.timestamp) revert UnbondsLocked();\n if (disputes[_job]) revert Disputed();\n\n uint256 _amount = pendingUnbonds[_job][_liquidity];\n\n delete pendingUnbonds[_job][_liquidity];\n delete canWithdrawAfter[_job][_liquidity];\n\n IERC20(_liquidity).safeTransfer(_receiver, _amount);\n emit LiquidityWithdrawal(_job, _liquidity, _receiver, _amount);\n }\n\n // Internal functions\n\n /// @notice Updates or rewards job liquidity credits depending on time since last job reward\n function _updateJobCreditsIfNeeded(address _job) internal returns (bool _rewarded) {\n if (rewardedAt[_job] < _period(block.timestamp)) {\n // Will exit function if job has been rewarded in current period\n if (rewardedAt[_job] <= _period(block.timestamp - rewardPeriodTime)) {\n // Will reset job to period syncronicity if a full period passed without rewards\n _updateJobPeriod(_job);\n _jobLiquidityCredits[_job] = _jobPeriodCredits[_job];\n rewardedAt[_job] = _period(block.timestamp);\n _rewarded = true;\n } else if ((block.timestamp - rewardedAt[_job]) >= rewardPeriodTime) {\n // Will reset job's syncronicity if last reward was more than epoch ago\n _updateJobPeriod(_job);\n _jobLiquidityCredits[_job] = _jobPeriodCredits[_job];\n rewardedAt[_job] += rewardPeriodTime;\n _rewarded = true;\n } else if (workedAt[_job] < _period(block.timestamp)) {\n // First keeper on period has to update job accountance to current twaps\n uint256 previousPeriodCredits = _jobPeriodCredits[_job];\n _updateJobPeriod(_job);\n _jobLiquidityCredits[_job] = (_jobLiquidityCredits[_job] * _jobPeriodCredits[_job]) / previousPeriodCredits;\n // Updating job accountance does not reward job\n }\n }\n }\n\n /// @notice Only called if _jobLiquidityCredits < payment\n function _rewardJobCredits(address _job) internal {\n /// @notice Only way to += jobLiquidityCredits is when keeper rewarding (cannot pay work)\n /* WARNING: this allows to top up _jobLiquidityCredits to a max of 1.99 but have to spend at least 1 */\n _jobLiquidityCredits[_job] += _phase(block.timestamp - rewardedAt[_job], _jobPeriodCredits[_job]);\n rewardedAt[_job] = block.timestamp;\n }\n\n /// @notice Updates accountance for _jobPeriodCredits\n function _updateJobPeriod(address _job) internal {\n _jobPeriodCredits[_job] = _calculateJobPeriodCredits(_job);\n }\n\n /// @notice Quotes the outdated job liquidities and calculates _periodCredits\n /// @dev This function is also responsible for keeping the KP3R/WETH quote updated\n function _calculateJobPeriodCredits(address _job) internal returns (uint256 _periodCredits) {\n for (uint256 i; i < _jobLiquidities[_job].length(); i++) {\n address _liquidity = _jobLiquidities[_job].at(i);\n if (_approvedLiquidities.contains(_liquidity)) {\n if (_tick[_liquidity].period != _period(block.timestamp)) {\n // Updates liquidity cache only if needed\n _tick[_liquidity] = observeLiquidity(_liquidity);\n }\n _periodCredits += _getReward(_quoteLiquidity(liquidityAmount[_job][_liquidity], _liquidity));\n }\n }\n }\n\n /// @notice Updates job accountance calculating the impact of the unbonded liquidity amount\n function _unbondLiquidityFromJob(\n address _job,\n address _liquidity,\n uint256 _amount\n ) internal nonReentrant {\n if (!_jobLiquidities[_job].contains(_liquidity)) revert JobLiquidityUnexistent();\n if (liquidityAmount[_job][_liquidity] < _amount) revert JobLiquidityInsufficient();\n\n // Ensures current twaps in job liquidities\n _updateJobPeriod(_job);\n uint256 _periodCreditsToRemove = _getReward(_quoteLiquidity(_amount, _liquidity));\n\n // A liquidity can be revoked causing a job to have 0 periodCredits\n if (_jobPeriodCredits[_job] > 0) {\n // Removes a % correspondant to a full rewardPeriodTime for the liquidity withdrawn vs all of the liquidities\n _jobLiquidityCredits[_job] -= (_jobLiquidityCredits[_job] * _periodCreditsToRemove) / _jobPeriodCredits[_job];\n _jobPeriodCredits[_job] -= _periodCreditsToRemove;\n }\n\n liquidityAmount[_job][_liquidity] -= _amount;\n if (liquidityAmount[_job][_liquidity] == 0) {\n _jobLiquidities[_job].remove(_liquidity);\n }\n }\n\n /// @notice Returns a fraction of the multiplier or the whole multiplier if equal or more than a rewardPeriodTime has passed\n function _phase(uint256 _timePassed, uint256 _multiplier) internal view returns (uint256 _result) {\n if (_timePassed < rewardPeriodTime) {\n _result = (_timePassed * _multiplier) / rewardPeriodTime;\n } else _result = _multiplier;\n }\n\n /// @notice Returns the start of the period of the provided timestamp\n function _period(uint256 _timestamp) internal view returns (uint256 _periodTimestamp) {\n return _timestamp - (_timestamp % rewardPeriodTime);\n }\n\n /// @notice Calculates relation between rewardPeriod and inflationPeriod\n function _getReward(uint256 _baseAmount) internal view returns (uint256 _credits) {\n return FullMath.mulDiv(_baseAmount, rewardPeriodTime, inflationPeriod);\n }\n\n /// @notice Returns underlying KP3R amount for a given liquidity amount\n function _quoteLiquidity(uint256 _amount, address _liquidity) internal view returns (uint256 _quote) {\n if (_tick[_liquidity].period != 0) {\n int56 _tickDifference = _isKP3RToken0[_liquidity] ? _tick[_liquidity].difference : -_tick[_liquidity].difference;\n _quote = IKeep3rHelper(keep3rHelper).getKP3RsAtTick(_amount, _tickDifference, rewardPeriodTime);\n }\n }\n\n /// @notice Updates job credits to current quotes and rewards job's pending minted credits\n /// @dev Ensures a maximum of 1 period of credits\n function _settleJobAccountance(address _job) internal virtual {\n _updateJobCreditsIfNeeded(_job);\n _rewardJobCredits(_job);\n _jobLiquidityCredits[_job] = Math.min(_jobLiquidityCredits[_job], _jobPeriodCredits[_job]);\n }\n}\n" - }, - "solidity/contracts/peripherals/Keep3rParameters.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../../interfaces/IKeep3rHelper.sol';\nimport '../../interfaces/peripherals/IKeep3rParameters.sol';\nimport '../../interfaces/external/IKeep3rV1Proxy.sol';\nimport './Keep3rAccountance.sol';\n\nabstract contract Keep3rParameters is IKeep3rParameters, Keep3rAccountance {\n /// @inheritdoc IKeep3rParameters\n address public override keep3rV1;\n\n /// @inheritdoc IKeep3rParameters\n address public override keep3rV1Proxy;\n\n /// @inheritdoc IKeep3rParameters\n address public override keep3rHelper;\n\n /// @inheritdoc IKeep3rParameters\n uint256 public override bondTime = 3 days;\n\n /// @inheritdoc IKeep3rParameters\n uint256 public override unbondTime = 14 days;\n\n /// @inheritdoc IKeep3rParameters\n uint256 public override liquidityMinimum = 3 ether;\n\n /// @inheritdoc IKeep3rParameters\n uint256 public override rewardPeriodTime = 5 days;\n\n /// @inheritdoc IKeep3rParameters\n uint256 public override inflationPeriod = 34 days;\n\n /// @inheritdoc IKeep3rParameters\n uint256 public override fee = 30;\n\n /// @notice The base that will be used to calculate the fee\n uint256 internal constant _BASE = 10_000;\n\n /// @notice The minimum reward period\n uint256 internal constant _MIN_REWARD_PERIOD_TIME = 1 days;\n\n constructor(\n address _keep3rHelper,\n address _keep3rV1,\n address _keep3rV1Proxy\n ) {\n keep3rHelper = _keep3rHelper;\n keep3rV1 = _keep3rV1;\n keep3rV1Proxy = _keep3rV1Proxy;\n }\n\n /// @inheritdoc IKeep3rParameters\n function setKeep3rHelper(address _keep3rHelper) external override onlyGovernance {\n if (_keep3rHelper == address(0)) revert ZeroAddress();\n keep3rHelper = _keep3rHelper;\n emit Keep3rHelperChange(_keep3rHelper);\n }\n\n /// @inheritdoc IKeep3rParameters\n function setKeep3rV1(address _keep3rV1) public virtual override onlyGovernance {\n if (_keep3rV1 == address(0)) revert ZeroAddress();\n _mint(totalBonds);\n\n keep3rV1 = _keep3rV1;\n emit Keep3rV1Change(_keep3rV1);\n }\n\n /// @inheritdoc IKeep3rParameters\n function setKeep3rV1Proxy(address _keep3rV1Proxy) external override onlyGovernance {\n if (_keep3rV1Proxy == address(0)) revert ZeroAddress();\n keep3rV1Proxy = _keep3rV1Proxy;\n emit Keep3rV1ProxyChange(_keep3rV1Proxy);\n }\n\n /// @inheritdoc IKeep3rParameters\n function setBondTime(uint256 _bondTime) external override onlyGovernance {\n bondTime = _bondTime;\n emit BondTimeChange(_bondTime);\n }\n\n /// @inheritdoc IKeep3rParameters\n function setUnbondTime(uint256 _unbondTime) external override onlyGovernance {\n unbondTime = _unbondTime;\n emit UnbondTimeChange(_unbondTime);\n }\n\n /// @inheritdoc IKeep3rParameters\n function setLiquidityMinimum(uint256 _liquidityMinimum) external override onlyGovernance {\n liquidityMinimum = _liquidityMinimum;\n emit LiquidityMinimumChange(_liquidityMinimum);\n }\n\n /// @inheritdoc IKeep3rParameters\n function setRewardPeriodTime(uint256 _rewardPeriodTime) external override onlyGovernance {\n if (_rewardPeriodTime < _MIN_REWARD_PERIOD_TIME) revert MinRewardPeriod();\n rewardPeriodTime = _rewardPeriodTime;\n emit RewardPeriodTimeChange(_rewardPeriodTime);\n }\n\n /// @inheritdoc IKeep3rParameters\n function setInflationPeriod(uint256 _inflationPeriod) external override onlyGovernance {\n inflationPeriod = _inflationPeriod;\n emit InflationPeriodChange(_inflationPeriod);\n }\n\n /// @inheritdoc IKeep3rParameters\n function setFee(uint256 _fee) external override onlyGovernance {\n fee = _fee;\n emit FeeChange(_fee);\n }\n\n function _mint(uint256 _amount) internal {\n totalBonds -= _amount;\n IKeep3rV1Proxy(keep3rV1Proxy).mint(_amount);\n }\n}\n" - }, - "@openzeppelin/contracts/security/ReentrancyGuard.sol": { - "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Contract module that helps prevent reentrant calls to a function.\n *\n * Inheriting from `ReentrancyGuard` will make the {nonReentrant} modifier\n * available, which can be applied to functions to make sure there are no nested\n * (reentrant) calls to them.\n *\n * Note that because there is a single `nonReentrant` guard, functions marked as\n * `nonReentrant` may not call one another. This can be worked around by making\n * those functions `private`, and then adding `external` `nonReentrant` entry\n * points to them.\n *\n * TIP: If you would like to learn more about reentrancy and alternative ways\n * to protect against it, check out our blog post\n * https://blog.openzeppelin.com/reentrancy-after-istanbul/[Reentrancy After Istanbul].\n */\nabstract contract ReentrancyGuard {\n // Booleans are more expensive than uint256 or any type that takes up a full\n // word because each write operation emits an extra SLOAD to first read the\n // slot's contents, replace the bits taken up by the boolean, and then write\n // back. This is the compiler's defense against contract upgrades and\n // pointer aliasing, and it cannot be disabled.\n\n // The values being non-zero value makes deployment a bit more expensive,\n // but in exchange the refund on every call to nonReentrant will be lower in\n // amount. Since refunds are capped to a percentage of the total\n // transaction's gas, it is best to keep them low in cases like this one, to\n // increase the likelihood of the full refund coming into effect.\n uint256 private constant _NOT_ENTERED = 1;\n uint256 private constant _ENTERED = 2;\n\n uint256 private _status;\n\n constructor() {\n _status = _NOT_ENTERED;\n }\n\n /**\n * @dev Prevents a contract from calling itself, directly or indirectly.\n * Calling a `nonReentrant` function from another `nonReentrant`\n * function is not supported. It is possible to prevent this from happening\n * by making the `nonReentrant` function external, and make it call a\n * `private` function that does the actual work.\n */\n modifier nonReentrant() {\n // On the first call to nonReentrant, _notEntered will be true\n require(_status != _ENTERED, \"ReentrancyGuard: reentrant call\");\n\n // Any calls to nonReentrant after this point will fail\n _status = _ENTERED;\n\n _;\n\n // By storing the original value once again, a refund is triggered (see\n // https://eips.ethereum.org/EIPS/eip-2200)\n _status = _NOT_ENTERED;\n }\n}\n" - }, - "@openzeppelin/contracts/utils/math/Math.sol": { - "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Standard math utilities missing in the Solidity language.\n */\nlibrary Math {\n /**\n * @dev Returns the largest of two numbers.\n */\n function max(uint256 a, uint256 b) internal pure returns (uint256) {\n return a >= b ? a : b;\n }\n\n /**\n * @dev Returns the smallest of two numbers.\n */\n function min(uint256 a, uint256 b) internal pure returns (uint256) {\n return a < b ? a : b;\n }\n\n /**\n * @dev Returns the average of two numbers. The result is rounded towards\n * zero.\n */\n function average(uint256 a, uint256 b) internal pure returns (uint256) {\n // (a + b) / 2 can overflow.\n return (a & b) + (a ^ b) / 2;\n }\n\n /**\n * @dev Returns the ceiling of the division of two numbers.\n *\n * This differs from standard division with `/` in that it rounds up instead\n * of rounding down.\n */\n function ceilDiv(uint256 a, uint256 b) internal pure returns (uint256) {\n // (a + b - 1) / b can overflow on addition, so we distribute.\n return a / b + (a % b == 0 ? 0 : 1);\n }\n}\n" - }, - "solidity/interfaces/external/IKeep3rV1Proxy.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../peripherals/IGovernable.sol';\n\ninterface IKeep3rV1Proxy is IGovernable {\n // Structs\n struct Recipient {\n address recipient;\n uint256 caps;\n }\n\n // Variables\n function keep3rV1() external view returns (address);\n\n function minter() external view returns (address);\n\n function next(address) external view returns (uint256);\n\n function caps(address) external view returns (uint256);\n\n function recipients() external view returns (address[] memory);\n\n function recipientsCaps() external view returns (Recipient[] memory);\n\n // Errors\n error Cooldown();\n error NoDrawableAmount();\n error ZeroAddress();\n error OnlyMinter();\n\n // Methods\n function addRecipient(address recipient, uint256 amount) external;\n\n function removeRecipient(address recipient) external;\n\n function draw() external returns (uint256 _amount);\n\n function setKeep3rV1(address _keep3rV1) external;\n\n function setMinter(address _minter) external;\n\n function mint(uint256 _amount) external;\n\n function mint(address _account, uint256 _amount) external;\n\n function setKeep3rV1Governance(address _governance) external;\n\n function acceptKeep3rV1Governance() external;\n\n function dispute(address _keeper) external;\n\n function slash(\n address _bonded,\n address _keeper,\n uint256 _amount\n ) external;\n\n function revoke(address _keeper) external;\n\n function resolve(address _keeper) external;\n\n function addJob(address _job) external;\n\n function removeJob(address _job) external;\n\n function addKPRCredit(address _job, uint256 _amount) external;\n\n function approveLiquidity(address _liquidity) external;\n\n function revokeLiquidity(address _liquidity) external;\n\n function setKeep3rHelper(address _keep3rHelper) external;\n\n function addVotes(address _voter, uint256 _amount) external;\n\n function removeVotes(address _voter, uint256 _amount) external;\n}\n" - }, - "solidity/interfaces/IKeep3rHelperParameters.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\n/// @title Keep3rHelperParameters contract\n/// @notice Contains all the helper functions used throughout the different files.\ninterface IKeep3rHelperParameters {\n // Structs\n\n /// @dev KP3R-WETH Pool address and isKP3RToken0\n /// @dev Created in order to save gas by avoiding calls to pool's token0 method\n struct TokenOraclePool {\n address poolAddress;\n bool isTKNToken0;\n }\n\n // Errors\n\n /// @notice Throws when pool does not have KP3R as token0 nor token1\n error InvalidOraclePool();\n\n // Events\n\n /// @notice Emitted when the kp3r weth pool is changed\n /// @param _address Address of the new kp3r weth pool\n /// @param _isKP3RToken0 True if calling the token0 method of the pool returns the KP3R token address\n event Kp3rWethPoolChange(address _address, bool _isKP3RToken0);\n\n /// @notice Emitted when the minimum boost multiplier is changed\n /// @param _minBoost The minimum boost multiplier\n event MinBoostChange(uint256 _minBoost);\n\n /// @notice Emitted when the maximum boost multiplier is changed\n /// @param _maxBoost The maximum boost multiplier\n event MaxBoostChange(uint256 _maxBoost);\n\n /// @notice Emitted when the target bond amount is changed\n /// @param _targetBond The target bond amount\n event TargetBondChange(uint256 _targetBond);\n\n /// @notice Emitted when the Keep3r V2 address is changed\n /// @param _keep3rV2 The address of Keep3r V2\n event Keep3rV2Change(address _keep3rV2);\n\n /// @notice Emitted when the work extra gas amount is changed\n /// @param _workExtraGas The work extra gas\n event WorkExtraGasChange(uint256 _workExtraGas);\n\n /// @notice Emitted when the quote twap time is changed\n /// @param _quoteTwapTime The twap time for quoting\n event QuoteTwapTimeChange(uint32 _quoteTwapTime);\n\n /// @notice Emitted when minimum rewarded gas fee is changed\n /// @param _minBaseFee The minimum rewarded gas fee\n event MinBaseFeeChange(uint256 _minBaseFee);\n\n /// @notice Emitted when minimum rewarded priority fee is changed\n /// @param _minPriorityFee The minimum expected fee that the keeper should pay\n event MinPriorityFeeChange(uint256 _minPriorityFee);\n\n // Variables\n\n /// @notice Address of KP3R token\n /// @return _kp3r Address of KP3R token\n // solhint-disable func-name-mixedcase\n function KP3R() external view returns (address _kp3r);\n\n /// @notice The boost base used to calculate the boost rewards for the keeper\n /// @return _base The boost base number\n function BOOST_BASE() external view returns (uint256 _base);\n\n /// @notice KP3R-WETH pool that is being used as oracle\n /// @return poolAddress Address of the pool\n /// @return isTKNToken0 True if calling the token0 method of the pool returns the KP3R token address\n function kp3rWethPool() external view returns (address poolAddress, bool isTKNToken0);\n\n /// @notice The minimum multiplier used to calculate the amount of gas paid to the Keeper for the gas used to perform a job\n /// For example: if the quoted gas used is 1000, then the minimum amount to be paid will be 1000 * minBoost / BOOST_BASE\n /// @return _multiplier The minimum boost multiplier\n function minBoost() external view returns (uint256 _multiplier);\n\n /// @notice The maximum multiplier used to calculate the amount of gas paid to the Keeper for the gas used to perform a job\n /// For example: if the quoted gas used is 1000, then the maximum amount to be paid will be 1000 * maxBoost / BOOST_BASE\n /// @return _multiplier The maximum boost multiplier\n function maxBoost() external view returns (uint256 _multiplier);\n\n /// @notice The targeted amount of bonded KP3Rs to max-up reward multiplier\n /// For example: if the amount of KP3R the keeper has bonded is targetBond or more, then the keeper will get\n /// the maximum boost possible in his rewards, if it's less, the reward boost will be proportional\n /// @return _target The amount of KP3R that comforms the targetBond\n function targetBond() external view returns (uint256 _target);\n\n /// @notice The amount of unaccounted gas that is going to be added to keeper payments\n /// @return _workExtraGas The work unaccounted gas amount\n function workExtraGas() external view returns (uint256 _workExtraGas);\n\n /// @notice The twap time for quoting\n /// @return _quoteTwapTime The twap time\n function quoteTwapTime() external view returns (uint32 _quoteTwapTime);\n\n /// @notice The minimum base fee that is used to calculate keeper rewards\n /// @return _minBaseFee The minimum rewarded gas fee\n function minBaseFee() external view returns (uint256 _minBaseFee);\n\n /// @notice The minimum priority fee that is also rewarded for keepers\n /// @return _minPriorityFee The minimum rewarded priority fee\n function minPriorityFee() external view returns (uint256 _minPriorityFee);\n\n /// @notice Address of Keep3r V2\n /// @return _keep3rV2 Address of Keep3r V2\n function keep3rV2() external view returns (address _keep3rV2);\n\n // Methods\n\n /// @notice Sets KP3R-WETH pool\n /// @param _poolAddress The address of the KP3R-WETH pool\n function setKp3rWethPool(address _poolAddress) external;\n\n /// @notice Sets the minimum boost multiplier\n /// @param _minBoost The minimum boost multiplier\n function setMinBoost(uint256 _minBoost) external;\n\n /// @notice Sets the maximum boost multiplier\n /// @param _maxBoost The maximum boost multiplier\n function setMaxBoost(uint256 _maxBoost) external;\n\n /// @notice Sets the target bond amount\n /// @param _targetBond The target bond amount\n function setTargetBond(uint256 _targetBond) external;\n\n /// @notice Sets the Keep3r V2 address\n /// @param _keep3rV2 The address of Keep3r V2\n function setKeep3rV2(address _keep3rV2) external;\n\n /// @notice Sets the work extra gas amount\n /// @param _workExtraGas The work extra gas\n function setWorkExtraGas(uint256 _workExtraGas) external;\n\n /// @notice Sets the quote twap time\n /// @param _quoteTwapTime The twap time for quoting\n function setQuoteTwapTime(uint32 _quoteTwapTime) external;\n\n /// @notice Sets the minimum rewarded gas fee\n /// @param _minBaseFee The minimum rewarded gas fee\n function setMinBaseFee(uint256 _minBaseFee) external;\n\n /// @notice Sets the minimum rewarded gas priority fee\n /// @param _minPriorityFee The minimum rewarded priority fee\n function setMinPriorityFee(uint256 _minPriorityFee) external;\n}\n" - }, - "solidity/interfaces/IPairManager.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol';\n\n/// @title Pair Manager interface\n/// @notice Generic interface for Keep3r liquidity pools (kLP)\ninterface IPairManager is IERC20Metadata {\n /// @notice Address of the factory from which the pair manager was created\n /// @return _factory The address of the PairManager Factory\n function factory() external view returns (address _factory);\n\n /// @notice Address of the pool from which the Keep3r pair manager will interact with\n /// @return _pool The address of the pool\n function pool() external view returns (address _pool);\n\n /// @notice Token0 of the pool\n /// @return _token0 The address of token0\n function token0() external view returns (address _token0);\n\n /// @notice Token1 of the pool\n /// @return _token1 The address of token1\n function token1() external view returns (address _token1);\n}\n" - }, - "solidity/contracts/libraries/FullMath.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\n/// @title Contains 512-bit math functions\n/// @notice Facilitates multiplication and division that can have overflow of an intermediate value without any loss of precision\n/// @dev Handles \"phantom overflow\" i.e., allows multiplication and division where an intermediate value overflows 256 bits\nlibrary FullMath {\n /// @notice Calculates floor(a×b÷denominator) with full precision. Throws if result overflows a uint256 or denominator == 0\n /// @param a The multiplicand\n /// @param b The multiplier\n /// @param denominator The divisor\n /// @return result The 256-bit result\n /// @dev Credit to Remco Bloemen under MIT license https://xn--2-umb.com/21/muldiv\n function mulDiv(\n uint256 a,\n uint256 b,\n uint256 denominator\n ) internal pure returns (uint256 result) {\n unchecked {\n // 512-bit multiply [prod1 prod0] = a * b\n // Compute the product mod 2**256 and mod 2**256 - 1\n // then use the Chinese Remainder Theorem to reconstruct\n // the 512 bit result. The result is stored in two 256\n // variables such that product = prod1 * 2**256 + prod0\n uint256 prod0; // Least significant 256 bits of the product\n uint256 prod1; // Most significant 256 bits of the product\n assembly {\n let mm := mulmod(a, b, not(0))\n prod0 := mul(a, b)\n prod1 := sub(sub(mm, prod0), lt(mm, prod0))\n }\n\n // Handle non-overflow cases, 256 by 256 division\n if (prod1 == 0) {\n require(denominator > 0);\n assembly {\n result := div(prod0, denominator)\n }\n return result;\n }\n\n // Make sure the result is less than 2**256.\n // Also prevents denominator == 0\n require(denominator > prod1);\n\n ///////////////////////////////////////////////\n // 512 by 256 division.\n ///////////////////////////////////////////////\n\n // Make division exact by subtracting the remainder from [prod1 prod0]\n // Compute remainder using mulmod\n uint256 remainder;\n assembly {\n remainder := mulmod(a, b, denominator)\n }\n // Subtract 256 bit number from 512 bit number\n assembly {\n prod1 := sub(prod1, gt(remainder, prod0))\n prod0 := sub(prod0, remainder)\n }\n\n // Factor powers of two out of denominator\n // Compute largest power of two divisor of denominator.\n // Always >= 1.\n uint256 twos = (~denominator + 1) & denominator;\n // Divide denominator by power of two\n assembly {\n denominator := div(denominator, twos)\n }\n\n // Divide [prod1 prod0] by the factors of two\n assembly {\n prod0 := div(prod0, twos)\n }\n // Shift in bits from prod1 into prod0. For this we need\n // to flip `twos` such that it is 2**256 / twos.\n // If twos is zero, then it becomes one\n assembly {\n twos := add(div(sub(0, twos), twos), 1)\n }\n prod0 |= prod1 * twos;\n\n // Invert denominator mod 2**256\n // Now that denominator is an odd number, it has an inverse\n // modulo 2**256 such that denominator * inv = 1 mod 2**256.\n // Compute the inverse by starting with a seed that is correct\n // correct for four bits. That is, denominator * inv = 1 mod 2**4\n uint256 inv = (3 * denominator) ^ 2;\n // Now use Newton-Raphson iteration to improve the precision.\n // Thanks to Hensel's lifting lemma, this also works in modular\n // arithmetic, doubling the correct bits in each step.\n inv *= 2 - denominator * inv; // inverse mod 2**8\n inv *= 2 - denominator * inv; // inverse mod 2**16\n inv *= 2 - denominator * inv; // inverse mod 2**32\n inv *= 2 - denominator * inv; // inverse mod 2**64\n inv *= 2 - denominator * inv; // inverse mod 2**128\n inv *= 2 - denominator * inv; // inverse mod 2**256\n\n // Because the division is now exact we can divide by multiplying\n // with the modular inverse of denominator. This will give us the\n // correct result modulo 2**256. Since the precoditions guarantee\n // that the outcome is less than 2**256, this is the final result.\n // We don't need to compute the high bits of the result and prod1\n // is no longer required.\n result = prod0 * inv;\n return result;\n }\n }\n\n /// @notice Calculates ceil(a×b÷denominator) with full precision. Throws if result overflows a uint256 or denominator == 0\n /// @param a The multiplicand\n /// @param b The multiplier\n /// @param denominator The divisor\n /// @return result The 256-bit result\n function mulDivRoundingUp(\n uint256 a,\n uint256 b,\n uint256 denominator\n ) internal pure returns (uint256 result) {\n unchecked {\n result = mulDiv(a, b, denominator);\n if (mulmod(a, b, denominator) > 0) {\n require(result < type(uint256).max);\n result++;\n }\n }\n }\n}\n" - }, - "@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol": { - "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\nimport \"../IERC20.sol\";\n\n/**\n * @dev Interface for the optional metadata functions from the ERC20 standard.\n *\n * _Available since v4.1._\n */\ninterface IERC20Metadata is IERC20 {\n /**\n * @dev Returns the name of the token.\n */\n function name() external view returns (string memory);\n\n /**\n * @dev Returns the symbol of the token.\n */\n function symbol() external view returns (string memory);\n\n /**\n * @dev Returns the decimals places of the token.\n */\n function decimals() external view returns (uint8);\n}\n" - }, - "solidity/contracts/peripherals/Keep3rDisputable.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport './Keep3rParameters.sol';\nimport '../../interfaces/peripherals/IKeep3rDisputable.sol';\n\nabstract contract Keep3rDisputable is IKeep3rDisputable, Keep3rParameters {\n /// @inheritdoc IKeep3rDisputable\n function dispute(address _jobOrKeeper) external override onlyDisputer {\n if (disputes[_jobOrKeeper]) revert AlreadyDisputed();\n disputes[_jobOrKeeper] = true;\n emit Dispute(_jobOrKeeper, msg.sender);\n }\n\n /// @inheritdoc IKeep3rDisputable\n function resolve(address _jobOrKeeper) external override onlyDisputer {\n if (!disputes[_jobOrKeeper]) revert NotDisputed();\n disputes[_jobOrKeeper] = false;\n emit Resolve(_jobOrKeeper, msg.sender);\n }\n}\n" - }, - "solidity/contracts/peripherals/keepers/Keep3rKeeperDisputable.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport './Keep3rKeeperFundable.sol';\nimport '../Keep3rDisputable.sol';\nimport '../../../interfaces/external/IKeep3rV1.sol';\nimport '../../../interfaces/peripherals/IKeep3rKeepers.sol';\n\nabstract contract Keep3rKeeperDisputable is IKeep3rKeeperDisputable, Keep3rDisputable, Keep3rKeeperFundable {\n using EnumerableSet for EnumerableSet.AddressSet;\n using SafeERC20 for IERC20;\n\n /// @inheritdoc IKeep3rKeeperDisputable\n function slash(\n address _keeper,\n address _bonded,\n uint256 _bondAmount,\n uint256 _unbondAmount\n ) external override onlySlasher {\n if (!disputes[_keeper]) revert NotDisputed();\n _slash(_keeper, _bonded, _bondAmount, _unbondAmount);\n emit KeeperSlash(_keeper, msg.sender, _bondAmount + _unbondAmount);\n }\n\n /// @inheritdoc IKeep3rKeeperDisputable\n function revoke(address _keeper) external override onlySlasher {\n if (!disputes[_keeper]) revert NotDisputed();\n _keepers.remove(_keeper);\n _slash(_keeper, keep3rV1, bonds[_keeper][keep3rV1], pendingUnbonds[_keeper][keep3rV1]);\n emit KeeperRevoke(_keeper, msg.sender);\n }\n\n function _slash(\n address _keeper,\n address _bonded,\n uint256 _bondAmount,\n uint256 _unbondAmount\n ) internal {\n if (_bonded != keep3rV1) {\n try IERC20(_bonded).transfer(governance, _bondAmount + _unbondAmount) returns (bool) {} catch (bytes memory) {}\n }\n bonds[_keeper][_bonded] -= _bondAmount;\n pendingUnbonds[_keeper][_bonded] -= _unbondAmount;\n }\n}\n" - }, - "solidity/contracts/peripherals/keepers/Keep3rKeeperFundable.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../Keep3rAccountance.sol';\nimport '../Keep3rParameters.sol';\nimport '../../../interfaces/peripherals/IKeep3rKeepers.sol';\n\nimport '../../../interfaces/external/IKeep3rV1.sol';\n\nimport '@openzeppelin/contracts/security/ReentrancyGuard.sol';\nimport '@openzeppelin/contracts/token/ERC20/IERC20.sol';\nimport '@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol';\n\nabstract contract Keep3rKeeperFundable is IKeep3rKeeperFundable, ReentrancyGuard, Keep3rParameters {\n using EnumerableSet for EnumerableSet.AddressSet;\n using SafeERC20 for IERC20;\n\n /// @inheritdoc IKeep3rKeeperFundable\n function bond(address _bonding, uint256 _amount) external override nonReentrant {\n if (disputes[msg.sender]) revert Disputed();\n if (_jobs.contains(msg.sender)) revert AlreadyAJob();\n canActivateAfter[msg.sender][_bonding] = block.timestamp + bondTime;\n\n uint256 _before = IERC20(_bonding).balanceOf(address(this));\n IERC20(_bonding).safeTransferFrom(msg.sender, address(this), _amount);\n _amount = IERC20(_bonding).balanceOf(address(this)) - _before;\n\n hasBonded[msg.sender] = true;\n pendingBonds[msg.sender][_bonding] += _amount;\n\n emit Bonding(msg.sender, _bonding, _amount);\n }\n\n /// @inheritdoc IKeep3rKeeperFundable\n function activate(address _bonding) external override {\n address _keeper = msg.sender;\n if (disputes[_keeper]) revert Disputed();\n uint256 _canActivateAfter = canActivateAfter[_keeper][_bonding];\n if (_canActivateAfter == 0) revert BondsUnexistent();\n if (_canActivateAfter >= block.timestamp) revert BondsLocked();\n\n if (firstSeen[_keeper] == 0) {\n firstSeen[_keeper] = block.timestamp;\n }\n _keepers.add(_keeper);\n\n uint256 _amount = pendingBonds[_keeper][_bonding];\n delete pendingBonds[_keeper][_bonding];\n\n // bond provided tokens\n bonds[_keeper][_bonding] += _amount;\n if (_bonding == keep3rV1) {\n totalBonds += _amount;\n _depositBonds(_amount);\n }\n\n emit Activation(_keeper, _bonding, _amount);\n }\n\n /// @inheritdoc IKeep3rKeeperFundable\n function unbond(address _bonding, uint256 _amount) external override {\n canWithdrawAfter[msg.sender][_bonding] = block.timestamp + unbondTime;\n bonds[msg.sender][_bonding] -= _amount;\n pendingUnbonds[msg.sender][_bonding] += _amount;\n\n emit Unbonding(msg.sender, _bonding, _amount);\n }\n\n /// @inheritdoc IKeep3rKeeperFundable\n function withdraw(address _bonding) external override nonReentrant {\n if (pendingUnbonds[msg.sender][_bonding] == 0) revert UnbondsUnexistent();\n if (canWithdrawAfter[msg.sender][_bonding] >= block.timestamp) revert UnbondsLocked();\n if (disputes[msg.sender]) revert Disputed();\n\n uint256 _amount = pendingUnbonds[msg.sender][_bonding];\n\n delete pendingUnbonds[msg.sender][_bonding];\n delete canWithdrawAfter[msg.sender][_bonding];\n\n if (_bonding == keep3rV1) _mint(_amount);\n IERC20(_bonding).safeTransfer(msg.sender, _amount);\n\n emit Withdrawal(msg.sender, _bonding, _amount);\n }\n\n function _depositBonds(uint256 _amount) internal virtual {\n IKeep3rV1(keep3rV1).burn(_amount);\n }\n}\n" - }, - "solidity/interfaces/external/IKeep3rV1.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '@openzeppelin/contracts/token/ERC20/IERC20.sol';\nimport '@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol';\n\n// solhint-disable func-name-mixedcase\ninterface IKeep3rV1 is IERC20, IERC20Metadata {\n // Structs\n struct Checkpoint {\n uint32 fromBlock;\n uint256 votes;\n }\n\n // Events\n event DelegateChanged(address indexed _delegator, address indexed _fromDelegate, address indexed _toDelegate);\n event DelegateVotesChanged(address indexed _delegate, uint256 _previousBalance, uint256 _newBalance);\n event SubmitJob(address indexed _job, address indexed _liquidity, address indexed _provider, uint256 _block, uint256 _credit);\n event ApplyCredit(address indexed _job, address indexed _liquidity, address indexed _provider, uint256 _block, uint256 _credit);\n event RemoveJob(address indexed _job, address indexed _liquidity, address indexed _provider, uint256 _block, uint256 _credit);\n event UnbondJob(address indexed _job, address indexed _liquidity, address indexed _provider, uint256 _block, uint256 _credit);\n event JobAdded(address indexed _job, uint256 _block, address _governance);\n event JobRemoved(address indexed _job, uint256 _block, address _governance);\n event KeeperWorked(address indexed _credit, address indexed _job, address indexed _keeper, uint256 _block, uint256 _amount);\n event KeeperBonding(address indexed _keeper, uint256 _block, uint256 _active, uint256 _bond);\n event KeeperBonded(address indexed _keeper, uint256 _block, uint256 _activated, uint256 _bond);\n event KeeperUnbonding(address indexed _keeper, uint256 _block, uint256 _deactive, uint256 _bond);\n event KeeperUnbound(address indexed _keeper, uint256 _block, uint256 _deactivated, uint256 _bond);\n event KeeperSlashed(address indexed _keeper, address indexed _slasher, uint256 _block, uint256 _slash);\n event KeeperDispute(address indexed _keeper, uint256 _block);\n event KeeperResolved(address indexed _keeper, uint256 _block);\n event TokenCreditAddition(address indexed _credit, address indexed _job, address indexed _creditor, uint256 _block, uint256 _amount);\n\n // Variables\n function KPRH() external returns (address);\n\n function delegates(address _delegator) external view returns (address);\n\n function checkpoints(address _account, uint32 _checkpoint) external view returns (Checkpoint memory);\n\n function numCheckpoints(address _account) external view returns (uint32);\n\n function DOMAIN_TYPEHASH() external returns (bytes32);\n\n function DOMAINSEPARATOR() external returns (bytes32);\n\n function DELEGATION_TYPEHASH() external returns (bytes32);\n\n function PERMIT_TYPEHASH() external returns (bytes32);\n\n function nonces(address _user) external view returns (uint256);\n\n function BOND() external returns (uint256);\n\n function UNBOND() external returns (uint256);\n\n function LIQUIDITYBOND() external returns (uint256);\n\n function FEE() external returns (uint256);\n\n function BASE() external returns (uint256);\n\n function ETH() external returns (address);\n\n function bondings(address _user, address _bonding) external view returns (uint256);\n\n function canWithdrawAfter(address _user, address _bonding) external view returns (uint256);\n\n function pendingUnbonds(address _keeper, address _bonding) external view returns (uint256);\n\n function pendingbonds(address _keeper, address _bonding) external view returns (uint256);\n\n function bonds(address _keeper, address _bonding) external view returns (uint256);\n\n function votes(address _delegator) external view returns (uint256);\n\n function firstSeen(address _keeper) external view returns (uint256);\n\n function disputes(address _keeper) external view returns (bool);\n\n function lastJob(address _keeper) external view returns (uint256);\n\n function workCompleted(address _keeper) external view returns (uint256);\n\n function jobs(address _job) external view returns (bool);\n\n function credits(address _job, address _credit) external view returns (uint256);\n\n function liquidityProvided(\n address _provider,\n address _liquidity,\n address _job\n ) external view returns (uint256);\n\n function liquidityUnbonding(\n address _provider,\n address _liquidity,\n address _job\n ) external view returns (uint256);\n\n function liquidityAmountsUnbonding(\n address _provider,\n address _liquidity,\n address _job\n ) external view returns (uint256);\n\n function jobProposalDelay(address _job) external view returns (uint256);\n\n function liquidityApplied(\n address _provider,\n address _liquidity,\n address _job\n ) external view returns (uint256);\n\n function liquidityAmount(\n address _provider,\n address _liquidity,\n address _job\n ) external view returns (uint256);\n\n function keepers(address _keeper) external view returns (bool);\n\n function blacklist(address _keeper) external view returns (bool);\n\n function keeperList(uint256 _index) external view returns (address);\n\n function jobList(uint256 _index) external view returns (address);\n\n function governance() external returns (address);\n\n function pendingGovernance() external returns (address);\n\n function liquidityAccepted(address _liquidity) external view returns (bool);\n\n function liquidityPairs(uint256 _index) external view returns (address);\n\n // Methods\n function getCurrentVotes(address _account) external view returns (uint256);\n\n function addCreditETH(address _job) external payable;\n\n function addCredit(\n address _credit,\n address _job,\n uint256 _amount\n ) external;\n\n function addVotes(address _voter, uint256 _amount) external;\n\n function removeVotes(address _voter, uint256 _amount) external;\n\n function addKPRCredit(address _job, uint256 _amount) external;\n\n function approveLiquidity(address _liquidity) external;\n\n function revokeLiquidity(address _liquidity) external;\n\n function pairs() external view returns (address[] memory);\n\n function addLiquidityToJob(\n address _liquidity,\n address _job,\n uint256 _amount\n ) external;\n\n function applyCreditToJob(\n address _provider,\n address _liquidity,\n address _job\n ) external;\n\n function unbondLiquidityFromJob(\n address _liquidity,\n address _job,\n uint256 _amount\n ) external;\n\n function removeLiquidityFromJob(address _liquidity, address _job) external;\n\n function mint(uint256 _amount) external;\n\n function burn(uint256 _amount) external;\n\n function worked(address _keeper) external;\n\n function receipt(\n address _credit,\n address _keeper,\n uint256 _amount\n ) external;\n\n function receiptETH(address _keeper, uint256 _amount) external;\n\n function addJob(address _job) external;\n\n function getJobs() external view returns (address[] memory);\n\n function removeJob(address _job) external;\n\n function setKeep3rHelper(address _keep3rHelper) external;\n\n function setGovernance(address _governance) external;\n\n function acceptGovernance() external;\n\n function isKeeper(address _keeper) external returns (bool);\n\n function isMinKeeper(\n address _keeper,\n uint256 _minBond,\n uint256 _earned,\n uint256 _age\n ) external returns (bool);\n\n function isBondedKeeper(\n address _keeper,\n address _bond,\n uint256 _minBond,\n uint256 _earned,\n uint256 _age\n ) external returns (bool);\n\n function bond(address _bonding, uint256 _amount) external;\n\n function getKeepers() external view returns (address[] memory);\n\n function activate(address _bonding) external;\n\n function unbond(address _bonding, uint256 _amount) external;\n\n function slash(\n address _bonded,\n address _keeper,\n uint256 _amount\n ) external;\n\n function withdraw(address _bonding) external;\n\n function dispute(address _keeper) external;\n\n function revoke(address _keeper) external;\n\n function resolve(address _keeper) external;\n\n function permit(\n address _owner,\n address _spender,\n uint256 _amount,\n uint256 _deadline,\n uint8 _v,\n bytes32 _r,\n bytes32 _s\n ) external;\n}\n" - }, - "solidity/for-test/testnet/Keep3rForTestnet.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../../contracts/Keep3r.sol';\n\ncontract Keep3rForTestnet is Keep3r {\n constructor(\n address _governance,\n address _keep3rHelper,\n address _keep3rV1,\n address _keep3rV1Proxy\n ) Keep3r(_governance, _keep3rHelper, _keep3rV1, _keep3rV1Proxy) {\n bondTime = 0; // allows keepers to instantly register\n unbondTime = 0; // allows keepers & jobOwners to instantly withdraw funds\n liquidityMinimum = 1; // allows job providers to add low liquidity\n rewardPeriodTime = 1 days; // reduces twap calculation period\n inflationPeriod = 5 days; // increases credit minting\n }\n}\n" - }, - "solidity/for-test/Keep3rForTest.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../contracts/Keep3r.sol';\n\ncontract Keep3rForTest is Keep3r {\n constructor(\n address _governance,\n address _keep3rHelper,\n address _keep3rV1,\n address _keep3rV1Proxy\n ) Keep3r(_governance, _keep3rHelper, _keep3rV1, _keep3rV1Proxy) {}\n}\n" - }, - "solidity/contracts/sidechain/Keep3rSidechain.sol": { - "content": "// SPDX-License-Identifier: MIT\n\n/*\n\nCoded for The Keep3r Network with ♥ by\n\n██████╗░███████╗███████╗██╗░░░██╗░░░░░░░██╗░█████╗░███╗░░██╗██████╗░███████╗██████╗░██╗░░░░░░█████╗░███╗░░██╗██████╗░\n██╔══██╗██╔════╝██╔════╝██║░░░██║░░██╗░░██║██╔══██╗████╗░██║██╔══██╗██╔════╝██╔══██╗██║░░░░░██╔══██╗████╗░██║██╔══██╗\n██║░░██║█████╗░░█████╗░░██║░░░╚██╗████╗██╔╝██║░░██║██╔██╗██║██║░░██║█████╗░░██████╔╝██║░░░░░███████║██╔██╗██║██║░░██║\n██║░░██║██╔══╝░░██╔══╝░░██║░░░░████╔═████║░██║░░██║██║╚████║██║░░██║██╔══╝░░██╔══██╗██║░░░░░██╔══██║██║╚████║██║░░██║\n██████╔╝███████╗██║░░░░░██║░░░░╚██╔╝░╚██╔╝░╚█████╔╝██║░╚███║██████╔╝███████╗██║░░██║███████╗██║░░██║██║░╚███║██████╔╝\n╚═════╝░╚══════╝╚═╝░░░░░╚═╝░░░░░╚═╝░░░╚═╝░░░╚════╝░╚═╝░░╚══╝╚═════╝░╚══════╝╚═╝░░╚═╝╚══════╝╚═╝░░╚═╝╚═╝░░╚══╝╚═════╝░\n\nhttps://defi.sucks\n\n*/\n\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../Keep3r.sol';\nimport '../../interfaces/sidechain/IKeep3rEscrow.sol';\nimport '../../interfaces/sidechain/IKeep3rHelperSidechain.sol';\nimport '../../interfaces/sidechain/IKeep3rJobWorkableRated.sol';\nimport '../../interfaces/sidechain/IKeep3rSidechainAccountance.sol';\n\ncontract Keep3rSidechain is Keep3r, IKeep3rJobWorkableRated, IKeep3rSidechainAccountance {\n using EnumerableSet for EnumerableSet.AddressSet;\n\n /// @param _governance Address of governance\n /// @param _keep3rHelperSidechain Address of sidechain Keep3rHelper\n /// @param _wrappedKP3R Address of wrapped KP3R implementation\n /// @param _keep3rEscrow Address of sidechain Keep3rEscrow\n constructor(\n address _governance, // governance\n address _keep3rHelperSidechain, // helper\n address _wrappedKP3R, // keep3rV1\n address _keep3rEscrow // keep3rV1Proxy\n ) Keep3r(_governance, _keep3rHelperSidechain, _wrappedKP3R, _keep3rEscrow) {}\n\n // Keep3rSidechainAccountance\n\n /// @inheritdoc IKeep3rSidechainAccountance\n function virtualReserves() external view override returns (int256 _virtualReserves) {\n // Queries wKP3R balanceOf escrow contract minus the totalBonds\n return int256(IERC20(keep3rV1).balanceOf(keep3rV1Proxy)) - int256(totalBonds);\n }\n\n // Keep3rJobFundableLiquidity\n\n /// @notice Sidechain implementation asks the Helper for an oracle, instead of reading it from the ERC-20\n /// @dev Function should be called after setting an oracle in Keep3rHelperSidechain\n /// @param _liquidity Address of the liquidity token being approved\n function approveLiquidity(address _liquidity) external virtual override onlyGovernance {\n if (!_approvedLiquidities.add(_liquidity)) revert LiquidityPairApproved();\n _liquidityPool[_liquidity] = IKeep3rHelperSidechain(keep3rHelper).oracle(_liquidity);\n if (_liquidityPool[_liquidity] == address(0)) revert ZeroAddress();\n _isKP3RToken0[_liquidity] = IKeep3rHelper(keep3rHelper).isKP3RToken0(_liquidityPool[_liquidity]);\n _tick[_liquidity] = observeLiquidity(_liquidity);\n emit LiquidityApproval(_liquidity);\n }\n\n /// @notice Sidechain implementation will always ask for 2 tickCumulatives instead of cacheing\n /// @param _liquidity Address of the liquidity token being observed\n function observeLiquidity(address _liquidity) public view virtual override returns (TickCache memory _tickCache) {\n if (_tick[_liquidity].period == _period(block.timestamp)) {\n // Will return cached twaps if liquidity is updated\n _tickCache = _tick[_liquidity];\n } else {\n bool success;\n\n // Will always ask for 2 accumulators in sidechain\n uint32[] memory _secondsAgo = new uint32[](2);\n\n _secondsAgo[0] = uint32(block.timestamp - _period(block.timestamp));\n _secondsAgo[1] = uint32(block.timestamp - _period(block.timestamp) + rewardPeriodTime);\n\n int56 _tickCumulative2;\n (_tickCache.current, _tickCumulative2, success) = IKeep3rHelper(keep3rHelper).observe(_liquidityPool[_liquidity], _secondsAgo);\n\n _tickCache.difference = _tickCache.current - _tickCumulative2;\n\n if (success) {\n _tickCache.period = _period(block.timestamp);\n } else {\n delete _tickCache.period;\n }\n }\n }\n\n // Keep3rJobsWorkable\n\n /// @dev Sidechain implementation deprecates worked(address) as it should come with a usdPerGasUnit parameter\n function worked(address) external pure override {\n revert Deprecated();\n }\n\n /// @notice Implemented by jobs to show that a keeper performed work\n /// @dev Uses a USD per gas unit payment mechanism\n /// @param _keeper Address of the keeper that performed the work\n /// @param _usdPerGasUnit Units of USD (in wei) per gas unit that should be rewarded to the keeper\n function worked(address _keeper, uint256 _usdPerGasUnit) external override {\n if (_initialGas == 0) revert GasNotInitialized();\n // Gas used for quote calculations & payment is not rewarded\n uint256 _gasLeft = _getGasLeft();\n\n address _job = msg.sender;\n if (disputes[_job]) revert JobDisputed();\n if (!_jobs.contains(_job)) revert JobUnapproved();\n\n if (_updateJobCreditsIfNeeded(_job)) {\n emit LiquidityCreditsReward(_job, rewardedAt[_job], _jobLiquidityCredits[_job], _jobPeriodCredits[_job]);\n }\n\n (uint256 _boost, uint256 _oneUsdQuote, uint256 _extraGas) = IKeep3rHelper(keep3rHelper).getPaymentParams(bonds[_keeper][keep3rV1]);\n\n uint256 _kp3rPayment = _calculatePayment(_gasLeft, _extraGas, _oneUsdQuote * _usdPerGasUnit, _boost);\n\n if (_kp3rPayment > _jobLiquidityCredits[_job]) {\n _rewardJobCredits(_job);\n emit LiquidityCreditsReward(_job, rewardedAt[_job], _jobLiquidityCredits[_job], _jobPeriodCredits[_job]);\n }\n\n _bondedPayment(_job, _keeper, _kp3rPayment);\n delete _initialGas;\n\n emit KeeperWork(keep3rV1, _job, _keeper, _kp3rPayment, _gasLeft);\n }\n\n // Keep3rKeeperFundable\n\n /// @dev Sidechain implementation doesn't burn tokens, but deposit them in Keep3rEscrow\n function _depositBonds(uint256 _amount) internal virtual override {\n IKeep3rV1(keep3rV1).approve(keep3rV1Proxy, _amount);\n IKeep3rEscrow(keep3rV1Proxy).deposit(_amount);\n }\n}\n" - }, - "solidity/interfaces/sidechain/IKeep3rEscrow.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\n// solhint-disable-next-line no-empty-blocks\n\nimport '../peripherals/IMintable.sol';\n\n/// @title Keep3rEscrow contract\n/// @notice This contract acts as an escrow contract for wKP3R tokens on sidechains and L2s\n/// @dev Can be used as a replacement for keep3rV1Proxy in keep3r sidechain implementations\ninterface IKeep3rEscrow is IMintable {\n /// @notice Emitted when Keep3rEscrow#deposit function is called\n /// @param _wKP3R The addess of the wrapped KP3R token\n /// @param _sender The address that called the function\n /// @param _amount The amount of wKP3R the user deposited\n event wKP3RDeposited(address _wKP3R, address _sender, uint256 _amount);\n\n /// @notice Emitted when Keep3rEscrow#mint function is called\n /// @param _wKP3R The addess of the wrapped KP3R token\n /// @param _recipient The address that will received the newly minted wKP3R\n /// @param _amount The amount of wKP3R minted to the recipient\n event wKP3RMinted(address _wKP3R, address _recipient, uint256 _amount);\n\n /// @notice Emitted when Keep3rEscrow#setWKP3R function is called\n /// @param _newWKP3R The address of the wKP3R contract\n event wKP3RSet(address _newWKP3R);\n\n /// @notice Throws when minter attempts to withdraw more wKP3R than the escrow has in its balance\n error InsufficientBalance();\n\n /// @notice Lists the address of the wKP3R contract\n /// @return _wKP3RAddress The address of wKP3R\n function wKP3R() external view returns (address _wKP3RAddress);\n\n /// @notice Deposits wKP3R into the contract\n /// @param _amount The amount of wKP3R to deposit\n function deposit(uint256 _amount) external;\n\n /// @notice mints wKP3R to the recipient\n /// @param _amount The amount of wKP3R to mint\n function mint(uint256 _amount) external;\n\n /// @notice sets the wKP3R address\n /// @param _wKP3R the wKP3R address\n function setWKP3R(address _wKP3R) external;\n}\n" - }, - "solidity/interfaces/sidechain/IKeep3rHelperSidechain.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../IKeep3rHelper.sol';\n\n/// @title Keep3rHelperSidechain contract\n/// @notice Contains all the helper functions for sidechain keep3r implementations\ninterface IKeep3rHelperSidechain is IKeep3rHelper {\n // Events\n\n /// @notice The oracle for a liquidity has been saved\n /// @param _liquidity The address of the given liquidity\n /// @param _oraclePool The address of the oracle pool\n event OracleSet(address _liquidity, address _oraclePool);\n\n /// @notice Emitted when the WETH USD pool is changed\n /// @param _address Address of the new WETH USD pool\n /// @param _isWETHToken0 True if calling the token0 method of the pool returns the WETH token address\n event WethUSDPoolChange(address _address, bool _isWETHToken0);\n\n /// Variables\n\n /// @notice Ethereum mainnet WETH address used for quoting references\n /// @return _weth Address of WETH token\n // solhint-disable func-name-mixedcase\n function WETH() external view returns (address _weth);\n\n /// @return _oracle The address of the observable pool for given liquidity\n function oracle(address _liquidity) external view returns (address _oracle);\n\n /// @notice WETH-USD pool that is being used as oracle\n /// @return poolAddress Address of the pool\n /// @return isTKNToken0 True if calling the token0 method of the pool returns the WETH token address\n function wethUSDPool() external view returns (address poolAddress, bool isTKNToken0);\n\n /// @notice Quotes USD to ETH\n /// @dev Used to know how much ETH should be paid to keepers before converting it from ETH to KP3R\n /// @param _usd The amount of USD to quote to ETH\n /// @return _eth The resulting amount of ETH after quoting the USD\n function quoteUsdToEth(uint256 _usd) external returns (uint256 _eth);\n\n /// Methods\n\n /// @notice Sets an oracle for a given liquidity\n /// @param _liquidity The address of the liquidity\n /// @param _oracle The address of the pool used to quote the liquidity from\n /// @dev The oracle must contain KP3R as either token0 or token1\n function setOracle(address _liquidity, address _oracle) external;\n\n /// @notice Sets an oracle for querying WETH/USD quote\n /// @param _poolAddress The address of the pool used as oracle\n /// @dev The oracle must contain WETH as either token0 or token1\n function setWethUsdPool(address _poolAddress) external;\n}\n" - }, - "solidity/interfaces/sidechain/IKeep3rJobWorkableRated.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../peripherals/IKeep3rJobs.sol';\n\n/// @title Keep3rJobWorkableRated contract\n/// @notice Implements a quoting in USD per gas unit for Keep3r jobs\ninterface IKeep3rJobWorkableRated is IKeep3rJobs {\n /// @notice Throws when job contract calls deprecated worked(address) function\n error Deprecated();\n\n /// @notice Implemented by jobs to show that a keeper performed work and reward in stable USD quote\n /// @dev Automatically calculates the payment for the keeper and pays the keeper with bonded KP3R\n /// @param _keeper Address of the keeper that performed the work\n /// @param _usdPerGasUnit Amount of USD in wei rewarded for gas unit worked by the keeper\n function worked(address _keeper, uint256 _usdPerGasUnit) external;\n}\n" - }, - "solidity/interfaces/sidechain/IKeep3rSidechainAccountance.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\n/// @title IKeep3rSidechainAccountance interface\n/// @notice Implements a view to get the amount of credits that can be withdrawn\ninterface IKeep3rSidechainAccountance {\n /// @notice The surplus amount of wKP3Rs in escrow contract\n /// @return _virtualReserves The surplus amount of wKP3Rs in escrow contract\n function virtualReserves() external view returns (int256 _virtualReserves);\n}\n" - }, - "solidity/interfaces/peripherals/IMintable.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport './IGovernable.sol';\nimport './IBaseErrors.sol';\n\n/// @title Mintable contract\n/// @notice Manages the minter role\ninterface IMintable is IBaseErrors, IGovernable {\n // Events\n\n /// @notice Emitted when governance sets a new minter\n /// @param _minter Address of the new minter\n event MinterSet(address _minter);\n\n // Errors\n\n /// @notice Throws if the caller of the function is not the minter\n error OnlyMinter();\n\n // Variables\n\n /// @notice Stores the minter address\n /// @return _minter The minter addresss\n function minter() external view returns (address _minter);\n\n // Methods\n\n /// @notice Sets a new address to be the minter\n /// @param _minter The address set as the minter\n function setMinter(address _minter) external;\n}\n" - }, - "solidity/for-test/testnet/Keep3rSidechainForTestnet.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../../contracts/sidechain/Keep3rSidechain.sol';\n\ncontract Keep3rSidechainForTestnet is Keep3rSidechain {\n constructor(\n address _governance,\n address _keep3rHelper,\n address _keep3rV1,\n address _keep3rV1Proxy\n ) Keep3rSidechain(_governance, _keep3rHelper, _keep3rV1, _keep3rV1Proxy) {\n bondTime = 0; // allows keepers to instantly register\n unbondTime = 0; // allows keepers & jobOwners to instantly withdraw funds\n liquidityMinimum = 1; // allows job providers to add low liquidity\n rewardPeriodTime = 1 days; // reduces twap calculation period\n inflationPeriod = 5 days; // increases credit minting\n }\n}\n" - }, - "solidity/for-test/Keep3rSidechainForTest.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../contracts/sidechain/Keep3rSidechain.sol';\n\ncontract Keep3rSidechainForTest is Keep3rSidechain {\n using EnumerableSet for EnumerableSet.AddressSet;\n\n constructor(\n address _governance,\n address _keep3rHelper,\n address _wrappedKP3R,\n address _keep3rEscrow\n ) Keep3rSidechain(_governance, _keep3rHelper, _wrappedKP3R, _keep3rEscrow) {}\n\n function setJobLiquidity(address _job, address _liquidity) external {\n _jobLiquidities[_job].add(_liquidity);\n }\n}\n" - }, - "solidity/for-test/JobRatedForTest.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../interfaces/IKeep3r.sol';\nimport '../interfaces/sidechain/IKeep3rJobWorkableRated.sol';\n\ncontract JobRatedForTest {\n error InvalidKeeper();\n address public keep3r;\n uint256 public nonce;\n uint256 public usdPerGasUnit = 1;\n\n constructor(address _keep3r) {\n keep3r = _keep3r;\n }\n\n function work() external {\n if (!IKeep3r(keep3r).isKeeper(msg.sender)) revert InvalidKeeper();\n\n for (uint256 i = 0; i < 1000; i++) {\n nonce++;\n }\n\n IKeep3rJobWorkableRated(keep3r).worked(msg.sender, usdPerGasUnit);\n }\n\n function workHard(uint256 _factor) external {\n if (!IKeep3r(keep3r).isKeeper(msg.sender)) revert InvalidKeeper();\n\n for (uint256 i = 0; i < 1000 * _factor; i++) {\n nonce++;\n }\n\n IKeep3rJobWorkableRated(keep3r).worked(msg.sender, usdPerGasUnit);\n }\n}\n" - }, - "solidity/for-test/JobForTest.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../interfaces/IKeep3r.sol';\n\ncontract JobForTest {\n error InvalidKeeper();\n address public keep3r;\n uint256 public nonce;\n\n constructor(address _keep3r) {\n keep3r = _keep3r;\n }\n\n function work() external {\n if (!IKeep3r(keep3r).isKeeper(msg.sender)) revert InvalidKeeper();\n\n for (uint256 i; i < 1000; i++) {\n nonce++;\n }\n\n IKeep3r(keep3r).worked(msg.sender);\n }\n\n function workHard(uint256 _factor) external {\n if (!IKeep3r(keep3r).isKeeper(msg.sender)) revert InvalidKeeper();\n\n for (uint256 i; i < 1000 * _factor; i++) {\n nonce++;\n }\n\n IKeep3r(keep3r).worked(msg.sender);\n }\n}\n" - }, - "solidity/for-test/BasicJob.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../interfaces/IKeep3r.sol';\n\ncontract BasicJob {\n error KeeperNotValid();\n\n address public keep3r;\n uint256 public nonce;\n uint256[] public array;\n\n constructor(address _keep3r) {\n keep3r = _keep3r;\n }\n\n function work() external upkeep {}\n\n function workHard(uint256 _howHard) external upkeep {\n for (uint256 i = nonce; i < _howHard; i++) {\n nonce++;\n }\n }\n\n function workRefund(uint256 _howHard) external upkeep {\n for (uint256 i; i < _howHard; i++) {\n array.push(i);\n }\n\n while (array.length > 0) {\n array.pop();\n }\n }\n\n modifier upkeep() {\n if (!IKeep3r(keep3r).isKeeper(msg.sender)) revert KeeperNotValid();\n _;\n IKeep3r(keep3r).worked(msg.sender);\n }\n}\n" - }, - "solidity/contracts/Keep3rHelperParameters.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.7 <0.9.0;\n\nimport './libraries/FullMath.sol';\nimport './libraries/TickMath.sol';\nimport '../interfaces/peripherals/IBaseErrors.sol';\nimport '../interfaces/IKeep3r.sol';\nimport '../interfaces/external/IKeep3rV1.sol';\nimport '../interfaces/IKeep3rHelperParameters.sol';\nimport './peripherals/Governable.sol';\nimport './Keep3rHelperParameters.sol';\n\nimport '@openzeppelin/contracts/utils/math/Math.sol';\nimport '@uniswap/v3-core/contracts/interfaces/IUniswapV3Pool.sol';\n\ncontract Keep3rHelperParameters is IKeep3rHelperParameters, IBaseErrors, Governable {\n /// @inheritdoc IKeep3rHelperParameters\n address public immutable override KP3R;\n\n /// @inheritdoc IKeep3rHelperParameters\n uint256 public constant override BOOST_BASE = 10_000;\n\n /// @inheritdoc IKeep3rHelperParameters\n uint256 public override minBoost = 11_000;\n\n /// @inheritdoc IKeep3rHelperParameters\n uint256 public override maxBoost = 12_000;\n\n /// @inheritdoc IKeep3rHelperParameters\n uint256 public override targetBond = 200 ether;\n\n /// @inheritdoc IKeep3rHelperParameters\n uint256 public override workExtraGas = 34_000;\n\n /// @inheritdoc IKeep3rHelperParameters\n uint32 public override quoteTwapTime = 10 minutes;\n\n /// @inheritdoc IKeep3rHelperParameters\n uint256 public override minBaseFee = 15e9;\n\n /// @inheritdoc IKeep3rHelperParameters\n uint256 public override minPriorityFee = 2e9;\n\n /// @inheritdoc IKeep3rHelperParameters\n address public override keep3rV2;\n\n /// @inheritdoc IKeep3rHelperParameters\n IKeep3rHelperParameters.TokenOraclePool public override kp3rWethPool;\n\n constructor(\n address _kp3r,\n address _keep3rV2,\n address _governance,\n address _kp3rWethPool\n ) Governable(_governance) {\n KP3R = _kp3r;\n keep3rV2 = _keep3rV2;\n\n // Immutable variables [KP3R] cannot be read during contract creation time [_setKp3rWethPool]\n kp3rWethPool = _validateOraclePool(_kp3rWethPool, _kp3r);\n emit Kp3rWethPoolChange(kp3rWethPool.poolAddress, kp3rWethPool.isTKNToken0);\n }\n\n /// @inheritdoc IKeep3rHelperParameters\n function setKp3rWethPool(address _poolAddress) external override onlyGovernance {\n if (_poolAddress == address(0)) revert ZeroAddress();\n _setKp3rWethPool(_poolAddress);\n }\n\n /// @inheritdoc IKeep3rHelperParameters\n function setMinBoost(uint256 _minBoost) external override onlyGovernance {\n minBoost = _minBoost;\n emit MinBoostChange(minBoost);\n }\n\n /// @inheritdoc IKeep3rHelperParameters\n function setMaxBoost(uint256 _maxBoost) external override onlyGovernance {\n maxBoost = _maxBoost;\n emit MaxBoostChange(maxBoost);\n }\n\n /// @inheritdoc IKeep3rHelperParameters\n function setTargetBond(uint256 _targetBond) external override onlyGovernance {\n targetBond = _targetBond;\n emit TargetBondChange(targetBond);\n }\n\n /// @inheritdoc IKeep3rHelperParameters\n function setKeep3rV2(address _keep3rV2) external override onlyGovernance {\n if (_keep3rV2 == address(0)) revert ZeroAddress();\n keep3rV2 = _keep3rV2;\n emit Keep3rV2Change(keep3rV2);\n }\n\n /// @inheritdoc IKeep3rHelperParameters\n function setWorkExtraGas(uint256 _workExtraGas) external override onlyGovernance {\n workExtraGas = _workExtraGas;\n emit WorkExtraGasChange(workExtraGas);\n }\n\n /// @inheritdoc IKeep3rHelperParameters\n function setQuoteTwapTime(uint32 _quoteTwapTime) external override onlyGovernance {\n _setQuoteTwapTime(_quoteTwapTime);\n }\n\n function _setQuoteTwapTime(uint32 _quoteTwapTime) internal {\n quoteTwapTime = _quoteTwapTime;\n emit QuoteTwapTimeChange(quoteTwapTime);\n }\n\n /// @inheritdoc IKeep3rHelperParameters\n function setMinBaseFee(uint256 _minBaseFee) external override onlyGovernance {\n minBaseFee = _minBaseFee;\n emit MinBaseFeeChange(minBaseFee);\n }\n\n /// @inheritdoc IKeep3rHelperParameters\n function setMinPriorityFee(uint256 _minPriorityFee) external override onlyGovernance {\n minPriorityFee = _minPriorityFee;\n emit MinPriorityFeeChange(minPriorityFee);\n }\n\n /// @notice Sets KP3R-WETH pool\n /// @param _poolAddress The address of the KP3R-WETH pool\n function _setKp3rWethPool(address _poolAddress) internal {\n kp3rWethPool = _validateOraclePool(_poolAddress, KP3R);\n emit Kp3rWethPoolChange(kp3rWethPool.poolAddress, kp3rWethPool.isTKNToken0);\n }\n\n function _validateOraclePool(address _poolAddress, address _token) internal view virtual returns (TokenOraclePool memory _oraclePool) {\n bool _isTKNToken0 = IUniswapV3Pool(_poolAddress).token0() == _token;\n\n if (!_isTKNToken0 && IUniswapV3Pool(_poolAddress).token1() != _token) revert InvalidOraclePool();\n\n return TokenOraclePool(_poolAddress, _isTKNToken0);\n }\n}\n" - }, - "solidity/contracts/libraries/TickMath.sol": { - "content": "// SPDX-License-Identifier: GPL-2.0-or-later\npragma solidity >=0.5.0;\n\n// solhint-disable\n\n/// @title Math library for computing sqrt prices from ticks and vice versa\n/// @notice Computes sqrt price for ticks of size 1.0001, i.e. sqrt(1.0001^tick) as fixed point Q64.96 numbers. Supports\n/// prices between 2**-128 and 2**128\nlibrary TickMath {\n /// @dev The minimum tick that may be passed to #getSqrtRatioAtTick computed from log base 1.0001 of 2**-128\n int24 internal constant MIN_TICK = -887272;\n /// @dev The maximum tick that may be passed to #getSqrtRatioAtTick computed from log base 1.0001 of 2**128\n int24 internal constant MAX_TICK = -MIN_TICK;\n\n /// @dev The minimum value that can be returned from #getSqrtRatioAtTick. Equivalent to getSqrtRatioAtTick(MIN_TICK)\n uint160 internal constant MIN_SQRT_RATIO = 4295128739;\n /// @dev The maximum value that can be returned from #getSqrtRatioAtTick. Equivalent to getSqrtRatioAtTick(MAX_TICK)\n uint160 internal constant MAX_SQRT_RATIO = 1461446703485210103287273052203988822378723970342;\n\n /// @notice Calculates sqrt(1.0001^tick) * 2^96\n /// @dev Throws if |tick| > max tick\n /// @param tick The input tick for the above formula\n /// @return sqrtPriceX96 A Fixed point Q64.96 number representing the sqrt of the ratio of the two assets (token1/token0)\n /// at the given tick\n function getSqrtRatioAtTick(int24 tick) internal pure returns (uint160 sqrtPriceX96) {\n uint256 absTick = tick < 0 ? uint256(-int256(tick)) : uint256(int256(tick));\n require(absTick <= uint256(int256(MAX_TICK)), 'T');\n\n uint256 ratio = absTick & 0x1 != 0 ? 0xfffcb933bd6fad37aa2d162d1a594001 : 0x100000000000000000000000000000000;\n if (absTick & 0x2 != 0) ratio = (ratio * 0xfff97272373d413259a46990580e213a) >> 128;\n if (absTick & 0x4 != 0) ratio = (ratio * 0xfff2e50f5f656932ef12357cf3c7fdcc) >> 128;\n if (absTick & 0x8 != 0) ratio = (ratio * 0xffe5caca7e10e4e61c3624eaa0941cd0) >> 128;\n if (absTick & 0x10 != 0) ratio = (ratio * 0xffcb9843d60f6159c9db58835c926644) >> 128;\n if (absTick & 0x20 != 0) ratio = (ratio * 0xff973b41fa98c081472e6896dfb254c0) >> 128;\n if (absTick & 0x40 != 0) ratio = (ratio * 0xff2ea16466c96a3843ec78b326b52861) >> 128;\n if (absTick & 0x80 != 0) ratio = (ratio * 0xfe5dee046a99a2a811c461f1969c3053) >> 128;\n if (absTick & 0x100 != 0) ratio = (ratio * 0xfcbe86c7900a88aedcffc83b479aa3a4) >> 128;\n if (absTick & 0x200 != 0) ratio = (ratio * 0xf987a7253ac413176f2b074cf7815e54) >> 128;\n if (absTick & 0x400 != 0) ratio = (ratio * 0xf3392b0822b70005940c7a398e4b70f3) >> 128;\n if (absTick & 0x800 != 0) ratio = (ratio * 0xe7159475a2c29b7443b29c7fa6e889d9) >> 128;\n if (absTick & 0x1000 != 0) ratio = (ratio * 0xd097f3bdfd2022b8845ad8f792aa5825) >> 128;\n if (absTick & 0x2000 != 0) ratio = (ratio * 0xa9f746462d870fdf8a65dc1f90e061e5) >> 128;\n if (absTick & 0x4000 != 0) ratio = (ratio * 0x70d869a156d2a1b890bb3df62baf32f7) >> 128;\n if (absTick & 0x8000 != 0) ratio = (ratio * 0x31be135f97d08fd981231505542fcfa6) >> 128;\n if (absTick & 0x10000 != 0) ratio = (ratio * 0x9aa508b5b7a84e1c677de54f3e99bc9) >> 128;\n if (absTick & 0x20000 != 0) ratio = (ratio * 0x5d6af8dedb81196699c329225ee604) >> 128;\n if (absTick & 0x40000 != 0) ratio = (ratio * 0x2216e584f5fa1ea926041bedfe98) >> 128;\n if (absTick & 0x80000 != 0) ratio = (ratio * 0x48a170391f7dc42444e8fa2) >> 128;\n\n if (tick > 0) ratio = type(uint256).max / ratio;\n\n // Divides by 1<<32 rounding up to go from a Q128.128 to a Q128.96.\n // we then downcast because we know the result always fits within 160 bits due to our tick input constraint\n // we round up in the division so getTickAtSqrtRatio of the output price is always consistent\n sqrtPriceX96 = uint160((ratio >> 32) + (ratio % (1 << 32) == 0 ? 0 : 1));\n }\n\n /// @notice Calculates the greatest tick value such that getRatioAtTick(tick) <= ratio\n /// @dev Throws in case sqrtPriceX96 < MIN_SQRT_RATIO, as MIN_SQRT_RATIO is the lowest value getRatioAtTick may ever return.\n /// @param sqrtPriceX96 The sqrt ratio for which to compute the tick as a Q64.96\n /// @return tick The greatest tick for which the ratio is less than or equal to the input ratio\n function getTickAtSqrtRatio(uint160 sqrtPriceX96) internal pure returns (int24 tick) {\n // Second inequality must be < because the price can never reach the price at the max tick\n require(sqrtPriceX96 >= MIN_SQRT_RATIO && sqrtPriceX96 < MAX_SQRT_RATIO, 'R');\n uint256 ratio = uint256(sqrtPriceX96) << 32;\n\n uint256 r = ratio;\n uint256 msb = 0;\n\n assembly {\n let f := shl(7, gt(r, 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF))\n msb := or(msb, f)\n r := shr(f, r)\n }\n assembly {\n let f := shl(6, gt(r, 0xFFFFFFFFFFFFFFFF))\n msb := or(msb, f)\n r := shr(f, r)\n }\n assembly {\n let f := shl(5, gt(r, 0xFFFFFFFF))\n msb := or(msb, f)\n r := shr(f, r)\n }\n assembly {\n let f := shl(4, gt(r, 0xFFFF))\n msb := or(msb, f)\n r := shr(f, r)\n }\n assembly {\n let f := shl(3, gt(r, 0xFF))\n msb := or(msb, f)\n r := shr(f, r)\n }\n assembly {\n let f := shl(2, gt(r, 0xF))\n msb := or(msb, f)\n r := shr(f, r)\n }\n assembly {\n let f := shl(1, gt(r, 0x3))\n msb := or(msb, f)\n r := shr(f, r)\n }\n assembly {\n let f := gt(r, 0x1)\n msb := or(msb, f)\n }\n\n if (msb >= 128) r = ratio >> (msb - 127);\n else r = ratio << (127 - msb);\n\n int256 log_2 = (int256(msb) - 128) << 64;\n\n assembly {\n r := shr(127, mul(r, r))\n let f := shr(128, r)\n log_2 := or(log_2, shl(63, f))\n r := shr(f, r)\n }\n assembly {\n r := shr(127, mul(r, r))\n let f := shr(128, r)\n log_2 := or(log_2, shl(62, f))\n r := shr(f, r)\n }\n assembly {\n r := shr(127, mul(r, r))\n let f := shr(128, r)\n log_2 := or(log_2, shl(61, f))\n r := shr(f, r)\n }\n assembly {\n r := shr(127, mul(r, r))\n let f := shr(128, r)\n log_2 := or(log_2, shl(60, f))\n r := shr(f, r)\n }\n assembly {\n r := shr(127, mul(r, r))\n let f := shr(128, r)\n log_2 := or(log_2, shl(59, f))\n r := shr(f, r)\n }\n assembly {\n r := shr(127, mul(r, r))\n let f := shr(128, r)\n log_2 := or(log_2, shl(58, f))\n r := shr(f, r)\n }\n assembly {\n r := shr(127, mul(r, r))\n let f := shr(128, r)\n log_2 := or(log_2, shl(57, f))\n r := shr(f, r)\n }\n assembly {\n r := shr(127, mul(r, r))\n let f := shr(128, r)\n log_2 := or(log_2, shl(56, f))\n r := shr(f, r)\n }\n assembly {\n r := shr(127, mul(r, r))\n let f := shr(128, r)\n log_2 := or(log_2, shl(55, f))\n r := shr(f, r)\n }\n assembly {\n r := shr(127, mul(r, r))\n let f := shr(128, r)\n log_2 := or(log_2, shl(54, f))\n r := shr(f, r)\n }\n assembly {\n r := shr(127, mul(r, r))\n let f := shr(128, r)\n log_2 := or(log_2, shl(53, f))\n r := shr(f, r)\n }\n assembly {\n r := shr(127, mul(r, r))\n let f := shr(128, r)\n log_2 := or(log_2, shl(52, f))\n r := shr(f, r)\n }\n assembly {\n r := shr(127, mul(r, r))\n let f := shr(128, r)\n log_2 := or(log_2, shl(51, f))\n r := shr(f, r)\n }\n assembly {\n r := shr(127, mul(r, r))\n let f := shr(128, r)\n log_2 := or(log_2, shl(50, f))\n }\n\n int256 log_sqrt10001 = log_2 * 255738958999603826347141; // 128.128 number\n\n int24 tickLow = int24((log_sqrt10001 - 3402992956809132418596140100660247210) >> 128);\n int24 tickHi = int24((log_sqrt10001 + 291339464771989622907027621153398088495) >> 128);\n\n tick = tickLow == tickHi ? tickLow : getSqrtRatioAtTick(tickHi) <= sqrtPriceX96 ? tickHi : tickLow;\n }\n}\n" - }, - "@uniswap/v3-core/contracts/interfaces/IUniswapV3Pool.sol": { - "content": "// SPDX-License-Identifier: GPL-2.0-or-later\npragma solidity >=0.5.0;\n\nimport './pool/IUniswapV3PoolImmutables.sol';\nimport './pool/IUniswapV3PoolState.sol';\nimport './pool/IUniswapV3PoolDerivedState.sol';\nimport './pool/IUniswapV3PoolActions.sol';\nimport './pool/IUniswapV3PoolOwnerActions.sol';\nimport './pool/IUniswapV3PoolEvents.sol';\n\n/// @title The interface for a Uniswap V3 Pool\n/// @notice A Uniswap pool facilitates swapping and automated market making between any two assets that strictly conform\n/// to the ERC20 specification\n/// @dev The pool interface is broken up into many smaller pieces\ninterface IUniswapV3Pool is\n IUniswapV3PoolImmutables,\n IUniswapV3PoolState,\n IUniswapV3PoolDerivedState,\n IUniswapV3PoolActions,\n IUniswapV3PoolOwnerActions,\n IUniswapV3PoolEvents\n{\n\n}\n" - }, - "@uniswap/v3-core/contracts/interfaces/pool/IUniswapV3PoolImmutables.sol": { - "content": "// SPDX-License-Identifier: GPL-2.0-or-later\npragma solidity >=0.5.0;\n\n/// @title Pool state that never changes\n/// @notice These parameters are fixed for a pool forever, i.e., the methods will always return the same values\ninterface IUniswapV3PoolImmutables {\n /// @notice The contract that deployed the pool, which must adhere to the IUniswapV3Factory interface\n /// @return The contract address\n function factory() external view returns (address);\n\n /// @notice The first of the two tokens of the pool, sorted by address\n /// @return The token contract address\n function token0() external view returns (address);\n\n /// @notice The second of the two tokens of the pool, sorted by address\n /// @return The token contract address\n function token1() external view returns (address);\n\n /// @notice The pool's fee in hundredths of a bip, i.e. 1e-6\n /// @return The fee\n function fee() external view returns (uint24);\n\n /// @notice The pool tick spacing\n /// @dev Ticks can only be used at multiples of this value, minimum of 1 and always positive\n /// e.g.: a tickSpacing of 3 means ticks can be initialized every 3rd tick, i.e., ..., -6, -3, 0, 3, 6, ...\n /// This value is an int24 to avoid casting even though it is always positive.\n /// @return The tick spacing\n function tickSpacing() external view returns (int24);\n\n /// @notice The maximum amount of position liquidity that can use any tick in the range\n /// @dev This parameter is enforced per tick to prevent liquidity from overflowing a uint128 at any point, and\n /// also prevents out-of-range liquidity from being used to prevent adding in-range liquidity to a pool\n /// @return The max amount of liquidity per tick\n function maxLiquidityPerTick() external view returns (uint128);\n}\n" - }, - "@uniswap/v3-core/contracts/interfaces/pool/IUniswapV3PoolState.sol": { - "content": "// SPDX-License-Identifier: GPL-2.0-or-later\npragma solidity >=0.5.0;\n\n/// @title Pool state that can change\n/// @notice These methods compose the pool's state, and can change with any frequency including multiple times\n/// per transaction\ninterface IUniswapV3PoolState {\n /// @notice The 0th storage slot in the pool stores many values, and is exposed as a single method to save gas\n /// when accessed externally.\n /// @return sqrtPriceX96 The current price of the pool as a sqrt(token1/token0) Q64.96 value\n /// tick The current tick of the pool, i.e. according to the last tick transition that was run.\n /// This value may not always be equal to SqrtTickMath.getTickAtSqrtRatio(sqrtPriceX96) if the price is on a tick\n /// boundary.\n /// observationIndex The index of the last oracle observation that was written,\n /// observationCardinality The current maximum number of observations stored in the pool,\n /// observationCardinalityNext The next maximum number of observations, to be updated when the observation.\n /// feeProtocol The protocol fee for both tokens of the pool.\n /// Encoded as two 4 bit values, where the protocol fee of token1 is shifted 4 bits and the protocol fee of token0\n /// is the lower 4 bits. Used as the denominator of a fraction of the swap fee, e.g. 4 means 1/4th of the swap fee.\n /// unlocked Whether the pool is currently locked to reentrancy\n function slot0()\n external\n view\n returns (\n uint160 sqrtPriceX96,\n int24 tick,\n uint16 observationIndex,\n uint16 observationCardinality,\n uint16 observationCardinalityNext,\n uint8 feeProtocol,\n bool unlocked\n );\n\n /// @notice The fee growth as a Q128.128 fees of token0 collected per unit of liquidity for the entire life of the pool\n /// @dev This value can overflow the uint256\n function feeGrowthGlobal0X128() external view returns (uint256);\n\n /// @notice The fee growth as a Q128.128 fees of token1 collected per unit of liquidity for the entire life of the pool\n /// @dev This value can overflow the uint256\n function feeGrowthGlobal1X128() external view returns (uint256);\n\n /// @notice The amounts of token0 and token1 that are owed to the protocol\n /// @dev Protocol fees will never exceed uint128 max in either token\n function protocolFees() external view returns (uint128 token0, uint128 token1);\n\n /// @notice The currently in range liquidity available to the pool\n /// @dev This value has no relationship to the total liquidity across all ticks\n function liquidity() external view returns (uint128);\n\n /// @notice Look up information about a specific tick in the pool\n /// @param tick The tick to look up\n /// @return liquidityGross the total amount of position liquidity that uses the pool either as tick lower or\n /// tick upper,\n /// liquidityNet how much liquidity changes when the pool price crosses the tick,\n /// feeGrowthOutside0X128 the fee growth on the other side of the tick from the current tick in token0,\n /// feeGrowthOutside1X128 the fee growth on the other side of the tick from the current tick in token1,\n /// tickCumulativeOutside the cumulative tick value on the other side of the tick from the current tick\n /// secondsPerLiquidityOutsideX128 the seconds spent per liquidity on the other side of the tick from the current tick,\n /// secondsOutside the seconds spent on the other side of the tick from the current tick,\n /// initialized Set to true if the tick is initialized, i.e. liquidityGross is greater than 0, otherwise equal to false.\n /// Outside values can only be used if the tick is initialized, i.e. if liquidityGross is greater than 0.\n /// In addition, these values are only relative and must be used only in comparison to previous snapshots for\n /// a specific position.\n function ticks(int24 tick)\n external\n view\n returns (\n uint128 liquidityGross,\n int128 liquidityNet,\n uint256 feeGrowthOutside0X128,\n uint256 feeGrowthOutside1X128,\n int56 tickCumulativeOutside,\n uint160 secondsPerLiquidityOutsideX128,\n uint32 secondsOutside,\n bool initialized\n );\n\n /// @notice Returns 256 packed tick initialized boolean values. See TickBitmap for more information\n function tickBitmap(int16 wordPosition) external view returns (uint256);\n\n /// @notice Returns the information about a position by the position's key\n /// @param key The position's key is a hash of a preimage composed by the owner, tickLower and tickUpper\n /// @return _liquidity The amount of liquidity in the position,\n /// Returns feeGrowthInside0LastX128 fee growth of token0 inside the tick range as of the last mint/burn/poke,\n /// Returns feeGrowthInside1LastX128 fee growth of token1 inside the tick range as of the last mint/burn/poke,\n /// Returns tokensOwed0 the computed amount of token0 owed to the position as of the last mint/burn/poke,\n /// Returns tokensOwed1 the computed amount of token1 owed to the position as of the last mint/burn/poke\n function positions(bytes32 key)\n external\n view\n returns (\n uint128 _liquidity,\n uint256 feeGrowthInside0LastX128,\n uint256 feeGrowthInside1LastX128,\n uint128 tokensOwed0,\n uint128 tokensOwed1\n );\n\n /// @notice Returns data about a specific observation index\n /// @param index The element of the observations array to fetch\n /// @dev You most likely want to use #observe() instead of this method to get an observation as of some amount of time\n /// ago, rather than at a specific index in the array.\n /// @return blockTimestamp The timestamp of the observation,\n /// Returns tickCumulative the tick multiplied by seconds elapsed for the life of the pool as of the observation timestamp,\n /// Returns secondsPerLiquidityCumulativeX128 the seconds per in range liquidity for the life of the pool as of the observation timestamp,\n /// Returns initialized whether the observation has been initialized and the values are safe to use\n function observations(uint256 index)\n external\n view\n returns (\n uint32 blockTimestamp,\n int56 tickCumulative,\n uint160 secondsPerLiquidityCumulativeX128,\n bool initialized\n );\n}\n" - }, - "@uniswap/v3-core/contracts/interfaces/pool/IUniswapV3PoolDerivedState.sol": { - "content": "// SPDX-License-Identifier: GPL-2.0-or-later\npragma solidity >=0.5.0;\n\n/// @title Pool state that is not stored\n/// @notice Contains view functions to provide information about the pool that is computed rather than stored on the\n/// blockchain. The functions here may have variable gas costs.\ninterface IUniswapV3PoolDerivedState {\n /// @notice Returns the cumulative tick and liquidity as of each timestamp `secondsAgo` from the current block timestamp\n /// @dev To get a time weighted average tick or liquidity-in-range, you must call this with two values, one representing\n /// the beginning of the period and another for the end of the period. E.g., to get the last hour time-weighted average tick,\n /// you must call it with secondsAgos = [3600, 0].\n /// @dev The time weighted average tick represents the geometric time weighted average price of the pool, in\n /// log base sqrt(1.0001) of token1 / token0. The TickMath library can be used to go from a tick value to a ratio.\n /// @param secondsAgos From how long ago each cumulative tick and liquidity value should be returned\n /// @return tickCumulatives Cumulative tick values as of each `secondsAgos` from the current block timestamp\n /// @return secondsPerLiquidityCumulativeX128s Cumulative seconds per liquidity-in-range value as of each `secondsAgos` from the current block\n /// timestamp\n function observe(uint32[] calldata secondsAgos)\n external\n view\n returns (int56[] memory tickCumulatives, uint160[] memory secondsPerLiquidityCumulativeX128s);\n\n /// @notice Returns a snapshot of the tick cumulative, seconds per liquidity and seconds inside a tick range\n /// @dev Snapshots must only be compared to other snapshots, taken over a period for which a position existed.\n /// I.e., snapshots cannot be compared if a position is not held for the entire period between when the first\n /// snapshot is taken and the second snapshot is taken.\n /// @param tickLower The lower tick of the range\n /// @param tickUpper The upper tick of the range\n /// @return tickCumulativeInside The snapshot of the tick accumulator for the range\n /// @return secondsPerLiquidityInsideX128 The snapshot of seconds per liquidity for the range\n /// @return secondsInside The snapshot of seconds per liquidity for the range\n function snapshotCumulativesInside(int24 tickLower, int24 tickUpper)\n external\n view\n returns (\n int56 tickCumulativeInside,\n uint160 secondsPerLiquidityInsideX128,\n uint32 secondsInside\n );\n}\n" - }, - "@uniswap/v3-core/contracts/interfaces/pool/IUniswapV3PoolActions.sol": { - "content": "// SPDX-License-Identifier: GPL-2.0-or-later\npragma solidity >=0.5.0;\n\n/// @title Permissionless pool actions\n/// @notice Contains pool methods that can be called by anyone\ninterface IUniswapV3PoolActions {\n /// @notice Sets the initial price for the pool\n /// @dev Price is represented as a sqrt(amountToken1/amountToken0) Q64.96 value\n /// @param sqrtPriceX96 the initial sqrt price of the pool as a Q64.96\n function initialize(uint160 sqrtPriceX96) external;\n\n /// @notice Adds liquidity for the given recipient/tickLower/tickUpper position\n /// @dev The caller of this method receives a callback in the form of IUniswapV3MintCallback#uniswapV3MintCallback\n /// in which they must pay any token0 or token1 owed for the liquidity. The amount of token0/token1 due depends\n /// on tickLower, tickUpper, the amount of liquidity, and the current price.\n /// @param recipient The address for which the liquidity will be created\n /// @param tickLower The lower tick of the position in which to add liquidity\n /// @param tickUpper The upper tick of the position in which to add liquidity\n /// @param amount The amount of liquidity to mint\n /// @param data Any data that should be passed through to the callback\n /// @return amount0 The amount of token0 that was paid to mint the given amount of liquidity. Matches the value in the callback\n /// @return amount1 The amount of token1 that was paid to mint the given amount of liquidity. Matches the value in the callback\n function mint(\n address recipient,\n int24 tickLower,\n int24 tickUpper,\n uint128 amount,\n bytes calldata data\n ) external returns (uint256 amount0, uint256 amount1);\n\n /// @notice Collects tokens owed to a position\n /// @dev Does not recompute fees earned, which must be done either via mint or burn of any amount of liquidity.\n /// Collect must be called by the position owner. To withdraw only token0 or only token1, amount0Requested or\n /// amount1Requested may be set to zero. To withdraw all tokens owed, caller may pass any value greater than the\n /// actual tokens owed, e.g. type(uint128).max. Tokens owed may be from accumulated swap fees or burned liquidity.\n /// @param recipient The address which should receive the fees collected\n /// @param tickLower The lower tick of the position for which to collect fees\n /// @param tickUpper The upper tick of the position for which to collect fees\n /// @param amount0Requested How much token0 should be withdrawn from the fees owed\n /// @param amount1Requested How much token1 should be withdrawn from the fees owed\n /// @return amount0 The amount of fees collected in token0\n /// @return amount1 The amount of fees collected in token1\n function collect(\n address recipient,\n int24 tickLower,\n int24 tickUpper,\n uint128 amount0Requested,\n uint128 amount1Requested\n ) external returns (uint128 amount0, uint128 amount1);\n\n /// @notice Burn liquidity from the sender and account tokens owed for the liquidity to the position\n /// @dev Can be used to trigger a recalculation of fees owed to a position by calling with an amount of 0\n /// @dev Fees must be collected separately via a call to #collect\n /// @param tickLower The lower tick of the position for which to burn liquidity\n /// @param tickUpper The upper tick of the position for which to burn liquidity\n /// @param amount How much liquidity to burn\n /// @return amount0 The amount of token0 sent to the recipient\n /// @return amount1 The amount of token1 sent to the recipient\n function burn(\n int24 tickLower,\n int24 tickUpper,\n uint128 amount\n ) external returns (uint256 amount0, uint256 amount1);\n\n /// @notice Swap token0 for token1, or token1 for token0\n /// @dev The caller of this method receives a callback in the form of IUniswapV3SwapCallback#uniswapV3SwapCallback\n /// @param recipient The address to receive the output of the swap\n /// @param zeroForOne The direction of the swap, true for token0 to token1, false for token1 to token0\n /// @param amountSpecified The amount of the swap, which implicitly configures the swap as exact input (positive), or exact output (negative)\n /// @param sqrtPriceLimitX96 The Q64.96 sqrt price limit. If zero for one, the price cannot be less than this\n /// value after the swap. If one for zero, the price cannot be greater than this value after the swap\n /// @param data Any data to be passed through to the callback\n /// @return amount0 The delta of the balance of token0 of the pool, exact when negative, minimum when positive\n /// @return amount1 The delta of the balance of token1 of the pool, exact when negative, minimum when positive\n function swap(\n address recipient,\n bool zeroForOne,\n int256 amountSpecified,\n uint160 sqrtPriceLimitX96,\n bytes calldata data\n ) external returns (int256 amount0, int256 amount1);\n\n /// @notice Receive token0 and/or token1 and pay it back, plus a fee, in the callback\n /// @dev The caller of this method receives a callback in the form of IUniswapV3FlashCallback#uniswapV3FlashCallback\n /// @dev Can be used to donate underlying tokens pro-rata to currently in-range liquidity providers by calling\n /// with 0 amount{0,1} and sending the donation amount(s) from the callback\n /// @param recipient The address which will receive the token0 and token1 amounts\n /// @param amount0 The amount of token0 to send\n /// @param amount1 The amount of token1 to send\n /// @param data Any data to be passed through to the callback\n function flash(\n address recipient,\n uint256 amount0,\n uint256 amount1,\n bytes calldata data\n ) external;\n\n /// @notice Increase the maximum number of price and liquidity observations that this pool will store\n /// @dev This method is no-op if the pool already has an observationCardinalityNext greater than or equal to\n /// the input observationCardinalityNext.\n /// @param observationCardinalityNext The desired minimum number of observations for the pool to store\n function increaseObservationCardinalityNext(uint16 observationCardinalityNext) external;\n}\n" - }, - "@uniswap/v3-core/contracts/interfaces/pool/IUniswapV3PoolOwnerActions.sol": { - "content": "// SPDX-License-Identifier: GPL-2.0-or-later\npragma solidity >=0.5.0;\n\n/// @title Permissioned pool actions\n/// @notice Contains pool methods that may only be called by the factory owner\ninterface IUniswapV3PoolOwnerActions {\n /// @notice Set the denominator of the protocol's % share of the fees\n /// @param feeProtocol0 new protocol fee for token0 of the pool\n /// @param feeProtocol1 new protocol fee for token1 of the pool\n function setFeeProtocol(uint8 feeProtocol0, uint8 feeProtocol1) external;\n\n /// @notice Collect the protocol fee accrued to the pool\n /// @param recipient The address to which collected protocol fees should be sent\n /// @param amount0Requested The maximum amount of token0 to send, can be 0 to collect fees in only token1\n /// @param amount1Requested The maximum amount of token1 to send, can be 0 to collect fees in only token0\n /// @return amount0 The protocol fee collected in token0\n /// @return amount1 The protocol fee collected in token1\n function collectProtocol(\n address recipient,\n uint128 amount0Requested,\n uint128 amount1Requested\n ) external returns (uint128 amount0, uint128 amount1);\n}\n" - }, - "@uniswap/v3-core/contracts/interfaces/pool/IUniswapV3PoolEvents.sol": { - "content": "// SPDX-License-Identifier: GPL-2.0-or-later\npragma solidity >=0.5.0;\n\n/// @title Events emitted by a pool\n/// @notice Contains all events emitted by the pool\ninterface IUniswapV3PoolEvents {\n /// @notice Emitted exactly once by a pool when #initialize is first called on the pool\n /// @dev Mint/Burn/Swap cannot be emitted by the pool before Initialize\n /// @param sqrtPriceX96 The initial sqrt price of the pool, as a Q64.96\n /// @param tick The initial tick of the pool, i.e. log base 1.0001 of the starting price of the pool\n event Initialize(uint160 sqrtPriceX96, int24 tick);\n\n /// @notice Emitted when liquidity is minted for a given position\n /// @param sender The address that minted the liquidity\n /// @param owner The owner of the position and recipient of any minted liquidity\n /// @param tickLower The lower tick of the position\n /// @param tickUpper The upper tick of the position\n /// @param amount The amount of liquidity minted to the position range\n /// @param amount0 How much token0 was required for the minted liquidity\n /// @param amount1 How much token1 was required for the minted liquidity\n event Mint(\n address sender,\n address indexed owner,\n int24 indexed tickLower,\n int24 indexed tickUpper,\n uint128 amount,\n uint256 amount0,\n uint256 amount1\n );\n\n /// @notice Emitted when fees are collected by the owner of a position\n /// @dev Collect events may be emitted with zero amount0 and amount1 when the caller chooses not to collect fees\n /// @param owner The owner of the position for which fees are collected\n /// @param tickLower The lower tick of the position\n /// @param tickUpper The upper tick of the position\n /// @param amount0 The amount of token0 fees collected\n /// @param amount1 The amount of token1 fees collected\n event Collect(\n address indexed owner,\n address recipient,\n int24 indexed tickLower,\n int24 indexed tickUpper,\n uint128 amount0,\n uint128 amount1\n );\n\n /// @notice Emitted when a position's liquidity is removed\n /// @dev Does not withdraw any fees earned by the liquidity position, which must be withdrawn via #collect\n /// @param owner The owner of the position for which liquidity is removed\n /// @param tickLower The lower tick of the position\n /// @param tickUpper The upper tick of the position\n /// @param amount The amount of liquidity to remove\n /// @param amount0 The amount of token0 withdrawn\n /// @param amount1 The amount of token1 withdrawn\n event Burn(\n address indexed owner,\n int24 indexed tickLower,\n int24 indexed tickUpper,\n uint128 amount,\n uint256 amount0,\n uint256 amount1\n );\n\n /// @notice Emitted by the pool for any swaps between token0 and token1\n /// @param sender The address that initiated the swap call, and that received the callback\n /// @param recipient The address that received the output of the swap\n /// @param amount0 The delta of the token0 balance of the pool\n /// @param amount1 The delta of the token1 balance of the pool\n /// @param sqrtPriceX96 The sqrt(price) of the pool after the swap, as a Q64.96\n /// @param liquidity The liquidity of the pool after the swap\n /// @param tick The log base 1.0001 of price of the pool after the swap\n event Swap(\n address indexed sender,\n address indexed recipient,\n int256 amount0,\n int256 amount1,\n uint160 sqrtPriceX96,\n uint128 liquidity,\n int24 tick\n );\n\n /// @notice Emitted by the pool for any flashes of token0/token1\n /// @param sender The address that initiated the swap call, and that received the callback\n /// @param recipient The address that received the tokens from flash\n /// @param amount0 The amount of token0 that was flashed\n /// @param amount1 The amount of token1 that was flashed\n /// @param paid0 The amount of token0 paid for the flash, which can exceed the amount0 plus the fee\n /// @param paid1 The amount of token1 paid for the flash, which can exceed the amount1 plus the fee\n event Flash(\n address indexed sender,\n address indexed recipient,\n uint256 amount0,\n uint256 amount1,\n uint256 paid0,\n uint256 paid1\n );\n\n /// @notice Emitted by the pool for increases to the number of observations that can be stored\n /// @dev observationCardinalityNext is not the observation cardinality until an observation is written at the index\n /// just before a mint/swap/burn.\n /// @param observationCardinalityNextOld The previous value of the next observation cardinality\n /// @param observationCardinalityNextNew The updated value of the next observation cardinality\n event IncreaseObservationCardinalityNext(\n uint16 observationCardinalityNextOld,\n uint16 observationCardinalityNextNew\n );\n\n /// @notice Emitted when the protocol fee is changed by the pool\n /// @param feeProtocol0Old The previous value of the token0 protocol fee\n /// @param feeProtocol1Old The previous value of the token1 protocol fee\n /// @param feeProtocol0New The updated value of the token0 protocol fee\n /// @param feeProtocol1New The updated value of the token1 protocol fee\n event SetFeeProtocol(uint8 feeProtocol0Old, uint8 feeProtocol1Old, uint8 feeProtocol0New, uint8 feeProtocol1New);\n\n /// @notice Emitted when the collected protocol fees are withdrawn by the factory owner\n /// @param sender The address that collects the protocol fees\n /// @param recipient The address that receives the collected protocol fees\n /// @param amount0 The amount of token0 protocol fees that is withdrawn\n /// @param amount0 The amount of token1 protocol fees that is withdrawn\n event CollectProtocol(address indexed sender, address indexed recipient, uint128 amount0, uint128 amount1);\n}\n" - }, - "solidity/for-test/UniV3PairManagerForTest.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '@openzeppelin/contracts/token/ERC20/ERC20.sol';\nimport '@uniswap/v3-core/contracts/interfaces/IUniswapV3Pool.sol';\n\nimport '../contracts/libraries/LiquidityAmounts.sol';\nimport '../contracts/libraries/FixedPoint96.sol';\nimport '../contracts/libraries/FullMath.sol';\nimport '../contracts/libraries/TickMath.sol';\nimport '../contracts/UniV3PairManager.sol';\nimport '../interfaces/external/IWeth9.sol';\nimport '../interfaces/IUniV3PairManager.sol';\n\ncontract UniV3PairManagerForTest is UniV3PairManager {\n constructor(address _pool, address _governance) UniV3PairManager(_pool, _governance) {}\n\n function internalAddLiquidity(\n uint256 amount0Desired,\n uint256 amount1Desired,\n uint256 amount0Min,\n uint256 amount1Min\n )\n external\n returns (\n uint128 liquidity,\n uint256 amount0,\n uint256 amount1\n )\n {\n return _addLiquidity(amount0Desired, amount1Desired, amount0Min, amount1Min);\n }\n\n function internalPay(\n address token,\n address payer,\n address recipient,\n uint256 value\n ) external {\n return _pay(token, payer, recipient, value);\n }\n\n function internalMint(address dst, uint256 amount) external {\n return _mint(dst, amount);\n }\n\n function internalBurn(address dst, uint256 amount) external {\n return _burn(dst, amount);\n }\n\n function internalTransferTokens(\n address src,\n address dst,\n uint256 amount\n ) external {\n _transferTokens(src, dst, amount);\n }\n\n function internalSafeTransferFrom(\n address token,\n address from,\n address to,\n uint256 value\n ) external {\n _safeTransferFrom(token, from, to, value);\n }\n\n receive() external payable {}\n}\n" - }, - "@openzeppelin/contracts/token/ERC20/ERC20.sol": { - "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\nimport \"./IERC20.sol\";\nimport \"./extensions/IERC20Metadata.sol\";\nimport \"../../utils/Context.sol\";\n\n/**\n * @dev Implementation of the {IERC20} interface.\n *\n * This implementation is agnostic to the way tokens are created. This means\n * that a supply mechanism has to be added in a derived contract using {_mint}.\n * For a generic mechanism see {ERC20PresetMinterPauser}.\n *\n * TIP: For a detailed writeup see our guide\n * https://forum.zeppelin.solutions/t/how-to-implement-erc20-supply-mechanisms/226[How\n * to implement supply mechanisms].\n *\n * We have followed general OpenZeppelin Contracts guidelines: functions revert\n * instead returning `false` on failure. This behavior is nonetheless\n * conventional and does not conflict with the expectations of ERC20\n * applications.\n *\n * Additionally, an {Approval} event is emitted on calls to {transferFrom}.\n * This allows applications to reconstruct the allowance for all accounts just\n * by listening to said events. Other implementations of the EIP may not emit\n * these events, as it isn't required by the specification.\n *\n * Finally, the non-standard {decreaseAllowance} and {increaseAllowance}\n * functions have been added to mitigate the well-known issues around setting\n * allowances. See {IERC20-approve}.\n */\ncontract ERC20 is Context, IERC20, IERC20Metadata {\n mapping(address => uint256) private _balances;\n\n mapping(address => mapping(address => uint256)) private _allowances;\n\n uint256 private _totalSupply;\n\n string private _name;\n string private _symbol;\n\n /**\n * @dev Sets the values for {name} and {symbol}.\n *\n * The default value of {decimals} is 18. To select a different value for\n * {decimals} you should overload it.\n *\n * All two of these values are immutable: they can only be set once during\n * construction.\n */\n constructor(string memory name_, string memory symbol_) {\n _name = name_;\n _symbol = symbol_;\n }\n\n /**\n * @dev Returns the name of the token.\n */\n function name() public view virtual override returns (string memory) {\n return _name;\n }\n\n /**\n * @dev Returns the symbol of the token, usually a shorter version of the\n * name.\n */\n function symbol() public view virtual override returns (string memory) {\n return _symbol;\n }\n\n /**\n * @dev Returns the number of decimals used to get its user representation.\n * For example, if `decimals` equals `2`, a balance of `505` tokens should\n * be displayed to a user as `5.05` (`505 / 10 ** 2`).\n *\n * Tokens usually opt for a value of 18, imitating the relationship between\n * Ether and Wei. This is the value {ERC20} uses, unless this function is\n * overridden;\n *\n * NOTE: This information is only used for _display_ purposes: it in\n * no way affects any of the arithmetic of the contract, including\n * {IERC20-balanceOf} and {IERC20-transfer}.\n */\n function decimals() public view virtual override returns (uint8) {\n return 18;\n }\n\n /**\n * @dev See {IERC20-totalSupply}.\n */\n function totalSupply() public view virtual override returns (uint256) {\n return _totalSupply;\n }\n\n /**\n * @dev See {IERC20-balanceOf}.\n */\n function balanceOf(address account) public view virtual override returns (uint256) {\n return _balances[account];\n }\n\n /**\n * @dev See {IERC20-transfer}.\n *\n * Requirements:\n *\n * - `recipient` cannot be the zero address.\n * - the caller must have a balance of at least `amount`.\n */\n function transfer(address recipient, uint256 amount) public virtual override returns (bool) {\n _transfer(_msgSender(), recipient, amount);\n return true;\n }\n\n /**\n * @dev See {IERC20-allowance}.\n */\n function allowance(address owner, address spender) public view virtual override returns (uint256) {\n return _allowances[owner][spender];\n }\n\n /**\n * @dev See {IERC20-approve}.\n *\n * Requirements:\n *\n * - `spender` cannot be the zero address.\n */\n function approve(address spender, uint256 amount) public virtual override returns (bool) {\n _approve(_msgSender(), spender, amount);\n return true;\n }\n\n /**\n * @dev See {IERC20-transferFrom}.\n *\n * Emits an {Approval} event indicating the updated allowance. This is not\n * required by the EIP. See the note at the beginning of {ERC20}.\n *\n * Requirements:\n *\n * - `sender` and `recipient` cannot be the zero address.\n * - `sender` must have a balance of at least `amount`.\n * - the caller must have allowance for ``sender``'s tokens of at least\n * `amount`.\n */\n function transferFrom(\n address sender,\n address recipient,\n uint256 amount\n ) public virtual override returns (bool) {\n _transfer(sender, recipient, amount);\n\n uint256 currentAllowance = _allowances[sender][_msgSender()];\n require(currentAllowance >= amount, \"ERC20: transfer amount exceeds allowance\");\n unchecked {\n _approve(sender, _msgSender(), currentAllowance - amount);\n }\n\n return true;\n }\n\n /**\n * @dev Atomically increases the allowance granted to `spender` by the caller.\n *\n * This is an alternative to {approve} that can be used as a mitigation for\n * problems described in {IERC20-approve}.\n *\n * Emits an {Approval} event indicating the updated allowance.\n *\n * Requirements:\n *\n * - `spender` cannot be the zero address.\n */\n function increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool) {\n _approve(_msgSender(), spender, _allowances[_msgSender()][spender] + addedValue);\n return true;\n }\n\n /**\n * @dev Atomically decreases the allowance granted to `spender` by the caller.\n *\n * This is an alternative to {approve} that can be used as a mitigation for\n * problems described in {IERC20-approve}.\n *\n * Emits an {Approval} event indicating the updated allowance.\n *\n * Requirements:\n *\n * - `spender` cannot be the zero address.\n * - `spender` must have allowance for the caller of at least\n * `subtractedValue`.\n */\n function decreaseAllowance(address spender, uint256 subtractedValue) public virtual returns (bool) {\n uint256 currentAllowance = _allowances[_msgSender()][spender];\n require(currentAllowance >= subtractedValue, \"ERC20: decreased allowance below zero\");\n unchecked {\n _approve(_msgSender(), spender, currentAllowance - subtractedValue);\n }\n\n return true;\n }\n\n /**\n * @dev Moves `amount` of tokens from `sender` to `recipient`.\n *\n * This internal function is equivalent to {transfer}, and can be used to\n * e.g. implement automatic token fees, slashing mechanisms, etc.\n *\n * Emits a {Transfer} event.\n *\n * Requirements:\n *\n * - `sender` cannot be the zero address.\n * - `recipient` cannot be the zero address.\n * - `sender` must have a balance of at least `amount`.\n */\n function _transfer(\n address sender,\n address recipient,\n uint256 amount\n ) internal virtual {\n require(sender != address(0), \"ERC20: transfer from the zero address\");\n require(recipient != address(0), \"ERC20: transfer to the zero address\");\n\n _beforeTokenTransfer(sender, recipient, amount);\n\n uint256 senderBalance = _balances[sender];\n require(senderBalance >= amount, \"ERC20: transfer amount exceeds balance\");\n unchecked {\n _balances[sender] = senderBalance - amount;\n }\n _balances[recipient] += amount;\n\n emit Transfer(sender, recipient, amount);\n\n _afterTokenTransfer(sender, recipient, amount);\n }\n\n /** @dev Creates `amount` tokens and assigns them to `account`, increasing\n * the total supply.\n *\n * Emits a {Transfer} event with `from` set to the zero address.\n *\n * Requirements:\n *\n * - `account` cannot be the zero address.\n */\n function _mint(address account, uint256 amount) internal virtual {\n require(account != address(0), \"ERC20: mint to the zero address\");\n\n _beforeTokenTransfer(address(0), account, amount);\n\n _totalSupply += amount;\n _balances[account] += amount;\n emit Transfer(address(0), account, amount);\n\n _afterTokenTransfer(address(0), account, amount);\n }\n\n /**\n * @dev Destroys `amount` tokens from `account`, reducing the\n * total supply.\n *\n * Emits a {Transfer} event with `to` set to the zero address.\n *\n * Requirements:\n *\n * - `account` cannot be the zero address.\n * - `account` must have at least `amount` tokens.\n */\n function _burn(address account, uint256 amount) internal virtual {\n require(account != address(0), \"ERC20: burn from the zero address\");\n\n _beforeTokenTransfer(account, address(0), amount);\n\n uint256 accountBalance = _balances[account];\n require(accountBalance >= amount, \"ERC20: burn amount exceeds balance\");\n unchecked {\n _balances[account] = accountBalance - amount;\n }\n _totalSupply -= amount;\n\n emit Transfer(account, address(0), amount);\n\n _afterTokenTransfer(account, address(0), amount);\n }\n\n /**\n * @dev Sets `amount` as the allowance of `spender` over the `owner` s tokens.\n *\n * This internal function is equivalent to `approve`, and can be used to\n * e.g. set automatic allowances for certain subsystems, etc.\n *\n * Emits an {Approval} event.\n *\n * Requirements:\n *\n * - `owner` cannot be the zero address.\n * - `spender` cannot be the zero address.\n */\n function _approve(\n address owner,\n address spender,\n uint256 amount\n ) internal virtual {\n require(owner != address(0), \"ERC20: approve from the zero address\");\n require(spender != address(0), \"ERC20: approve to the zero address\");\n\n _allowances[owner][spender] = amount;\n emit Approval(owner, spender, amount);\n }\n\n /**\n * @dev Hook that is called before any transfer of tokens. This includes\n * minting and burning.\n *\n * Calling conditions:\n *\n * - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens\n * will be transferred to `to`.\n * - when `from` is zero, `amount` tokens will be minted for `to`.\n * - when `to` is zero, `amount` of ``from``'s tokens will be burned.\n * - `from` and `to` are never both zero.\n *\n * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].\n */\n function _beforeTokenTransfer(\n address from,\n address to,\n uint256 amount\n ) internal virtual {}\n\n /**\n * @dev Hook that is called after any transfer of tokens. This includes\n * minting and burning.\n *\n * Calling conditions:\n *\n * - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens\n * has been transferred to `to`.\n * - when `from` is zero, `amount` tokens have been minted for `to`.\n * - when `to` is zero, `amount` of ``from``'s tokens have been burned.\n * - `from` and `to` are never both zero.\n *\n * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].\n */\n function _afterTokenTransfer(\n address from,\n address to,\n uint256 amount\n ) internal virtual {}\n}\n" - }, - "solidity/contracts/libraries/LiquidityAmounts.sol": { - "content": "// SPDX-License-Identifier: GPL-2.0-or-later\npragma solidity >=0.8.4 <0.9.0;\n\nimport './FullMath.sol';\nimport './FixedPoint96.sol';\n\n// solhint-disable\nlibrary LiquidityAmounts {\n function toUint128(uint256 x) private pure returns (uint128 y) {\n require((y = uint128(x)) == x);\n }\n\n function getLiquidityForAmount0(\n uint160 sqrtRatioAX96,\n uint160 sqrtRatioBX96,\n uint256 amount0\n ) internal pure returns (uint128 liquidity) {\n if (sqrtRatioAX96 > sqrtRatioBX96) (sqrtRatioAX96, sqrtRatioBX96) = (sqrtRatioBX96, sqrtRatioAX96);\n uint256 intermediate = FullMath.mulDiv(sqrtRatioAX96, sqrtRatioBX96, FixedPoint96.Q96);\n return toUint128(FullMath.mulDiv(amount0, intermediate, sqrtRatioBX96 - sqrtRatioAX96));\n }\n\n function getLiquidityForAmount1(\n uint160 sqrtRatioAX96,\n uint160 sqrtRatioBX96,\n uint256 amount1\n ) internal pure returns (uint128 liquidity) {\n if (sqrtRatioAX96 > sqrtRatioBX96) (sqrtRatioAX96, sqrtRatioBX96) = (sqrtRatioBX96, sqrtRatioAX96);\n return toUint128(FullMath.mulDiv(amount1, FixedPoint96.Q96, sqrtRatioBX96 - sqrtRatioAX96));\n }\n\n function getLiquidityForAmounts(\n uint160 sqrtRatioX96,\n uint160 sqrtRatioAX96,\n uint160 sqrtRatioBX96,\n uint256 amount0,\n uint256 amount1\n ) internal pure returns (uint128 liquidity) {\n if (sqrtRatioAX96 > sqrtRatioBX96) (sqrtRatioAX96, sqrtRatioBX96) = (sqrtRatioBX96, sqrtRatioAX96);\n\n if (sqrtRatioX96 <= sqrtRatioAX96) {\n liquidity = getLiquidityForAmount0(sqrtRatioAX96, sqrtRatioBX96, amount0);\n } else if (sqrtRatioX96 < sqrtRatioBX96) {\n uint128 liquidity0 = getLiquidityForAmount0(sqrtRatioX96, sqrtRatioBX96, amount0);\n uint128 liquidity1 = getLiquidityForAmount1(sqrtRatioAX96, sqrtRatioX96, amount1);\n\n liquidity = liquidity0 < liquidity1 ? liquidity0 : liquidity1;\n } else {\n liquidity = getLiquidityForAmount1(sqrtRatioAX96, sqrtRatioBX96, amount1);\n }\n }\n\n function getAmount0ForLiquidity(\n uint160 sqrtRatioAX96,\n uint160 sqrtRatioBX96,\n uint128 liquidity\n ) internal pure returns (uint256 amount0) {\n if (sqrtRatioAX96 > sqrtRatioBX96) (sqrtRatioAX96, sqrtRatioBX96) = (sqrtRatioBX96, sqrtRatioAX96);\n\n return FullMath.mulDiv(uint256(liquidity) << FixedPoint96.RESOLUTION, sqrtRatioBX96 - sqrtRatioAX96, sqrtRatioBX96) / sqrtRatioAX96;\n }\n\n function getAmount1ForLiquidity(\n uint160 sqrtRatioAX96,\n uint160 sqrtRatioBX96,\n uint128 liquidity\n ) internal pure returns (uint256 amount1) {\n if (sqrtRatioAX96 > sqrtRatioBX96) (sqrtRatioAX96, sqrtRatioBX96) = (sqrtRatioBX96, sqrtRatioAX96);\n\n return FullMath.mulDiv(liquidity, sqrtRatioBX96 - sqrtRatioAX96, FixedPoint96.Q96);\n }\n\n function getAmountsForLiquidity(\n uint160 sqrtRatioX96,\n uint160 sqrtRatioAX96,\n uint160 sqrtRatioBX96,\n uint128 liquidity\n ) internal pure returns (uint256 amount0, uint256 amount1) {\n if (sqrtRatioAX96 > sqrtRatioBX96) (sqrtRatioAX96, sqrtRatioBX96) = (sqrtRatioBX96, sqrtRatioAX96);\n\n if (sqrtRatioX96 <= sqrtRatioAX96) {\n amount0 = getAmount0ForLiquidity(sqrtRatioAX96, sqrtRatioBX96, liquidity);\n } else if (sqrtRatioX96 < sqrtRatioBX96) {\n amount0 = getAmount0ForLiquidity(sqrtRatioX96, sqrtRatioBX96, liquidity);\n amount1 = getAmount1ForLiquidity(sqrtRatioAX96, sqrtRatioX96, liquidity);\n } else {\n amount1 = getAmount1ForLiquidity(sqrtRatioAX96, sqrtRatioBX96, liquidity);\n }\n }\n}\n" - }, - "solidity/contracts/libraries/FixedPoint96.sol": { - "content": "// SPDX-License-Identifier: GPL-2.0-or-later\npragma solidity >=0.8.4 <0.9.0;\n\nlibrary FixedPoint96 {\n // solhint-disable\n uint8 internal constant RESOLUTION = 96;\n uint256 internal constant Q96 = 0x1000000000000000000000000;\n}\n" - }, - "solidity/contracts/UniV3PairManager.sol": { - "content": "// SPDX-License-Identifier: MIT\n\n/*\n\nCoded for The Keep3r Network with ♥ by\n\n██████╗░███████╗███████╗██╗  ░██╗░░░░░░░██╗░█████╗░███╗░░██╗██████╗░███████╗██████╗░██╗░░░░░░█████╗░███╗░░██╗██████╗░\n██╔══██╗██╔════╝██╔════╝██║  ░██║░░██╗░░██║██╔══██╗████╗░██║██╔══██╗██╔════╝██╔══██╗██║░░░░░██╔══██╗████╗░██║██╔══██╗\n██║░░██║█████╗░░█████╗░░██║  ░╚██╗████╗██╔╝██║░░██║██╔██╗██║██║░░██║█████╗░░██████╔╝██║░░░░░███████║██╔██╗██║██║░░██║\n██║░░██║██╔══╝░░██╔══╝░░██║  ░░████╔═████║░██║░░██║██║╚████║██║░░██║██╔══╝░░██╔══██╗██║░░░░░██╔══██║██║╚████║██║░░██║\n██████╔╝███████╗██║░░░░░██║  ░░╚██╔╝░╚██╔╝░╚█████╔╝██║░╚███║██████╔╝███████╗██║░░██║███████╗██║░░██║██║░╚███║██████╔╝\n╚═════╝░╚══════╝╚═╝░░░░░╚═╝  ░░░╚═╝░░░╚═╝░░░╚════╝░╚═╝░░╚══╝╚═════╝░╚══════╝╚═╝░░╚═╝╚══════╝╚═╝░░╚═╝╚═╝░░╚══╝╚═════╝░\n\nhttps://defi.sucks\n\n*/\n\npragma solidity >=0.8.4 <0.9.0;\n\nimport '@openzeppelin/contracts/token/ERC20/ERC20.sol';\nimport '@uniswap/v3-core/contracts/interfaces/IUniswapV3Pool.sol';\n\nimport './libraries/LiquidityAmounts.sol';\nimport './libraries/FixedPoint96.sol';\nimport './libraries/FullMath.sol';\nimport './libraries/TickMath.sol';\n\nimport '../interfaces/external/IWeth9.sol';\nimport '../interfaces/IUniV3PairManager.sol';\n\nimport './peripherals/Governable.sol';\n\ncontract UniV3PairManager is IUniV3PairManager, Governable {\n /// @inheritdoc IERC20Metadata\n string public override name;\n\n /// @inheritdoc IERC20Metadata\n string public override symbol;\n\n /// @inheritdoc IERC20\n uint256 public override totalSupply;\n\n /// @inheritdoc IPairManager\n address public immutable override factory;\n\n /// @inheritdoc IPairManager\n address public immutable override token0;\n\n /// @inheritdoc IPairManager\n address public immutable override token1;\n\n /// @inheritdoc IPairManager\n address public immutable override pool;\n\n /// @inheritdoc IUniV3PairManager\n uint24 public immutable override fee;\n\n /// @inheritdoc IUniV3PairManager\n uint160 public immutable override sqrtRatioAX96;\n\n /// @inheritdoc IUniV3PairManager\n uint160 public immutable override sqrtRatioBX96;\n\n /// @inheritdoc IUniV3PairManager\n int24 public immutable override tickLower;\n\n /// @inheritdoc IUniV3PairManager\n int24 public immutable override tickUpper;\n\n /// @inheritdoc IUniV3PairManager\n int24 public immutable override tickSpacing;\n\n /// @notice Uniswap's maximum tick\n /// @dev Due to tick spacing, pools with different fees may have differences between _MAX_TICK and tickUpper. Use tickUpper to find the max tick of the pool.\n int24 private constant _MAX_TICK = 887272;\n\n /// @inheritdoc IERC20Metadata\n //solhint-disable-next-line const-name-snakecase\n uint8 public constant override decimals = 18;\n\n /// @inheritdoc IERC20\n mapping(address => mapping(address => uint256)) public override allowance;\n\n /// @inheritdoc IERC20\n mapping(address => uint256) public override balanceOf;\n\n /// @notice Struct that contains token0, token1, and fee of the Uniswap pool\n PoolKey private _poolKey;\n\n constructor(address _pool, address _governance) Governable(_governance) {\n uint24 _fee = IUniswapV3Pool(_pool).fee();\n address _token0 = IUniswapV3Pool(_pool).token0();\n address _token1 = IUniswapV3Pool(_pool).token1();\n int24 _tickSpacing = IUniswapV3Pool(_pool).tickSpacing();\n int24 _tickUpper = _MAX_TICK - (_MAX_TICK % _tickSpacing);\n int24 _tickLower = -_tickUpper;\n\n factory = msg.sender;\n pool = _pool;\n fee = _fee;\n tickSpacing = _tickSpacing;\n tickUpper = _tickUpper;\n tickLower = _tickLower;\n token0 = _token0;\n token1 = _token1;\n name = string(abi.encodePacked('Keep3rLP - ', ERC20(_token0).symbol(), '/', ERC20(_token1).symbol()));\n symbol = string(abi.encodePacked('kLP-', ERC20(_token0).symbol(), '/', ERC20(_token1).symbol()));\n\n sqrtRatioAX96 = TickMath.getSqrtRatioAtTick(_tickLower);\n sqrtRatioBX96 = TickMath.getSqrtRatioAtTick(_tickUpper);\n _poolKey = PoolKey({token0: _token0, token1: _token1, fee: _fee});\n }\n\n // This low-level function should be called from a contract which performs important safety checks\n /// @inheritdoc IUniV3PairManager\n function mint(\n uint256 amount0Desired,\n uint256 amount1Desired,\n uint256 amount0Min,\n uint256 amount1Min,\n address to\n ) external override returns (uint128 liquidity) {\n (liquidity, , ) = _addLiquidity(amount0Desired, amount1Desired, amount0Min, amount1Min);\n _mint(to, liquidity);\n }\n\n /// @inheritdoc IUniV3PairManager\n function uniswapV3MintCallback(\n uint256 amount0Owed,\n uint256 amount1Owed,\n bytes calldata data\n ) external override {\n MintCallbackData memory decoded = abi.decode(data, (MintCallbackData));\n if (msg.sender != pool) revert OnlyPool();\n if (amount0Owed > 0) _pay(decoded._poolKey.token0, decoded.payer, pool, amount0Owed);\n if (amount1Owed > 0) _pay(decoded._poolKey.token1, decoded.payer, pool, amount1Owed);\n }\n\n /// @inheritdoc IUniV3PairManager\n function burn(\n uint128 liquidity,\n uint256 amount0Min,\n uint256 amount1Min,\n address to\n ) external override returns (uint256 amount0, uint256 amount1) {\n (amount0, amount1) = IUniswapV3Pool(pool).burn(tickLower, tickUpper, liquidity);\n\n if (amount0 < amount0Min || amount1 < amount1Min) revert ExcessiveSlippage();\n\n IUniswapV3Pool(pool).collect(to, tickLower, tickUpper, uint128(amount0), uint128(amount1));\n _burn(msg.sender, liquidity);\n }\n\n /// @inheritdoc IUniV3PairManager\n function collect() external override onlyGovernance returns (uint256 amount0, uint256 amount1) {\n (, , , uint128 tokensOwed0, uint128 tokensOwed1) = IUniswapV3Pool(pool).positions(\n keccak256(abi.encodePacked(address(this), tickLower, tickUpper))\n );\n (amount0, amount1) = IUniswapV3Pool(pool).collect(governance, tickLower, tickUpper, tokensOwed0, tokensOwed1);\n }\n\n /// @inheritdoc IUniV3PairManager\n function position()\n external\n view\n override\n returns (\n uint128 liquidity,\n uint256 feeGrowthInside0LastX128,\n uint256 feeGrowthInside1LastX128,\n uint128 tokensOwed0,\n uint128 tokensOwed1\n )\n {\n (liquidity, feeGrowthInside0LastX128, feeGrowthInside1LastX128, tokensOwed0, tokensOwed1) = IUniswapV3Pool(pool).positions(\n keccak256(abi.encodePacked(address(this), tickLower, tickUpper))\n );\n }\n\n /// @inheritdoc IERC20\n function approve(address spender, uint256 amount) external override returns (bool) {\n allowance[msg.sender][spender] = amount;\n\n emit Approval(msg.sender, spender, amount);\n return true;\n }\n\n /// @inheritdoc IERC20\n function transfer(address to, uint256 amount) external override returns (bool) {\n _transferTokens(msg.sender, to, amount);\n return true;\n }\n\n /// @inheritdoc IERC20\n function transferFrom(\n address from,\n address to,\n uint256 amount\n ) external override returns (bool) {\n address spender = msg.sender;\n uint256 spenderAllowance = allowance[from][spender];\n\n if (spender != from && spenderAllowance != type(uint256).max) {\n uint256 newAllowance = spenderAllowance - amount;\n allowance[from][spender] = newAllowance;\n\n emit Approval(from, spender, newAllowance);\n }\n\n _transferTokens(from, to, amount);\n return true;\n }\n\n /// @notice Adds liquidity to an initialized pool\n /// @dev Reverts if the returned amount0 is less than amount0Min or if amount1 is less than amount1Min\n /// @dev This function calls the mint function of the corresponding Uniswap pool, which in turn calls UniswapV3Callback\n /// @param amount0Desired The amount of token0 we would like to provide\n /// @param amount1Desired The amount of token1 we would like to provide\n /// @param amount0Min The minimum amount of token0 we want to provide\n /// @param amount1Min The minimum amount of token1 we want to provide\n /// @return liquidity The calculated liquidity we get for the token amounts we provided\n /// @return amount0 The amount of token0 we ended up providing\n /// @return amount1 The amount of token1 we ended up providing\n function _addLiquidity(\n uint256 amount0Desired,\n uint256 amount1Desired,\n uint256 amount0Min,\n uint256 amount1Min\n )\n internal\n returns (\n uint128 liquidity,\n uint256 amount0,\n uint256 amount1\n )\n {\n (uint160 sqrtPriceX96, , , , , , ) = IUniswapV3Pool(pool).slot0();\n\n liquidity = LiquidityAmounts.getLiquidityForAmounts(sqrtPriceX96, sqrtRatioAX96, sqrtRatioBX96, amount0Desired, amount1Desired);\n\n (amount0, amount1) = IUniswapV3Pool(pool).mint(\n address(this),\n tickLower,\n tickUpper,\n liquidity,\n abi.encode(MintCallbackData({_poolKey: _poolKey, payer: msg.sender}))\n );\n\n if (amount0 < amount0Min || amount1 < amount1Min) revert ExcessiveSlippage();\n }\n\n /// @notice Transfers the passed-in token from the payer to the recipient for the corresponding value\n /// @param token The token to be transferred to the recipient\n /// @param from The address of the payer\n /// @param to The address of the passed-in tokens recipient\n /// @param value How much of that token to be transferred from payer to the recipient\n function _pay(\n address token,\n address from,\n address to,\n uint256 value\n ) internal {\n _safeTransferFrom(token, from, to, value);\n }\n\n /// @notice Mints Keep3r credits to the passed-in address of recipient and increases total supply of Keep3r credits by the corresponding amount\n /// @param to The recipient of the Keep3r credits\n /// @param amount The amount Keep3r credits to be minted to the recipient\n function _mint(address to, uint256 amount) internal {\n totalSupply += amount;\n balanceOf[to] += amount;\n emit Transfer(address(0), to, amount);\n }\n\n /// @notice Burns Keep3r credits to the passed-in address of recipient and reduces total supply of Keep3r credits by the corresponding amount\n /// @param to The address that will get its Keep3r credits burned\n /// @param amount The amount Keep3r credits to be burned from the recipient/recipient\n function _burn(address to, uint256 amount) internal {\n totalSupply -= amount;\n balanceOf[to] -= amount;\n emit Transfer(to, address(0), amount);\n }\n\n /// @notice Transfers amount of Keep3r credits between two addresses\n /// @param from The user that transfers the Keep3r credits\n /// @param to The user that receives the Keep3r credits\n /// @param amount The amount of Keep3r credits to be transferred\n function _transferTokens(\n address from,\n address to,\n uint256 amount\n ) internal {\n balanceOf[from] -= amount;\n balanceOf[to] += amount;\n\n emit Transfer(from, to, amount);\n }\n\n /// @notice Transfers the passed-in token from the specified \"from\" to the specified \"to\" for the corresponding value\n /// @dev Reverts with IUniV3PairManager#UnsuccessfulTransfer if the transfer was not successful,\n /// or if the passed data length is different than 0 and the decoded data is not a boolean\n /// @param token The token to be transferred to the specified \"to\"\n /// @param from The address which is going to transfer the tokens\n /// @param value How much of that token to be transferred from \"from\" to \"to\"\n function _safeTransferFrom(\n address token,\n address from,\n address to,\n uint256 value\n ) internal {\n // solhint-disable-next-line avoid-low-level-calls\n (bool success, bytes memory data) = token.call(abi.encodeWithSelector(IERC20.transferFrom.selector, from, to, value));\n if (!success || (data.length != 0 && !abi.decode(data, (bool)))) revert UnsuccessfulTransfer();\n }\n}\n" - }, - "solidity/interfaces/external/IWeth9.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '@openzeppelin/contracts/token/ERC20/IERC20.sol';\n\ninterface IWeth9 is IERC20 {\n function deposit() external payable;\n\n function withdraw(uint256) external;\n}\n" - }, - "solidity/interfaces/IUniV3PairManager.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport './IPairManager.sol';\nimport '@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol';\nimport './peripherals/IGovernable.sol';\n\n/// @title Pair Manager contract\n/// @notice Creates a UniswapV3 position, and tokenizes in an ERC20 manner\n/// so that the user can use it as liquidity for a Keep3rJob\ninterface IUniV3PairManager is IGovernable, IPairManager {\n // Structs\n struct PoolKey {\n address token0;\n address token1;\n uint24 fee;\n }\n\n /// @notice The data to be decoded by the UniswapV3MintCallback function\n struct MintCallbackData {\n PoolKey _poolKey; // Struct that contains token0, token1, and fee of the pool passed into the constructor\n address payer; // The address of the payer, which will be the msg.sender of the mint function\n }\n\n // Variables\n\n /// @notice The fee of the Uniswap pool passed into the constructor\n /// @return _fee The fee of the Uniswap pool passed into the constructor\n function fee() external view returns (uint24 _fee);\n\n /// @notice Highest tick in the Uniswap's curve\n /// @return _tickUpper The highest tick in the Uniswap's curve\n function tickUpper() external view returns (int24 _tickUpper);\n\n /// @notice Lowest tick in the Uniswap's curve\n /// @return _tickLower The lower tick in the Uniswap's curve\n function tickLower() external view returns (int24 _tickLower);\n\n /// @notice The pair tick spacing\n /// @return _tickSpacing The pair tick spacing\n function tickSpacing() external view returns (int24 _tickSpacing);\n\n /// @notice The sqrtRatioAX96 at the lowest tick (-887200) of the Uniswap pool\n /// @return _sqrtPriceA96 A Fixed point Q64.96 number representing the sqrt of the ratio of the two assets (token1/token0)\n /// at the lowest tick\n function sqrtRatioAX96() external view returns (uint160 _sqrtPriceA96);\n\n /// @notice The sqrtRatioBX96 at the highest tick (887200) of the Uniswap pool\n /// @return _sqrtPriceBX96 A Fixed point Q64.96 number representing the sqrt of the ratio of the two assets (token1/token0)\n /// at the highest tick\n function sqrtRatioBX96() external view returns (uint160 _sqrtPriceBX96);\n\n // Errors\n\n /// @notice Throws when the caller of the function is not the pool\n error OnlyPool();\n\n /// @notice Throws when the slippage exceeds what the user is comfortable with\n error ExcessiveSlippage();\n\n /// @notice Throws when a transfer is unsuccessful\n error UnsuccessfulTransfer();\n\n // Methods\n\n /// @notice This function is called after a user calls IUniV3PairManager#mint function\n /// It ensures that any tokens owed to the pool are paid by the msg.sender of IUniV3PairManager#mint function\n /// @param amount0Owed The amount of token0 due to the pool for the minted liquidity\n /// @param amount1Owed The amount of token1 due to the pool for the minted liquidity\n /// @param data The encoded token0, token1, fee (_poolKey) and the payer (msg.sender) of the IUniV3PairManager#mint function\n function uniswapV3MintCallback(\n uint256 amount0Owed,\n uint256 amount1Owed,\n bytes calldata data\n ) external;\n\n /// @notice Mints kLP tokens to an address according to the liquidity the msg.sender provides to the UniswapV3 pool\n /// @dev Triggers UniV3PairManager#uniswapV3MintCallback\n /// @param amount0Desired The amount of token0 we would like to provide\n /// @param amount1Desired The amount of token1 we would like to provide\n /// @param amount0Min The minimum amount of token0 we want to provide\n /// @param amount1Min The minimum amount of token1 we want to provide\n /// @param to The address to which the kLP tokens are going to be minted to\n /// @return liquidity kLP tokens sent in exchange for the provision of tokens\n function mint(\n uint256 amount0Desired,\n uint256 amount1Desired,\n uint256 amount0Min,\n uint256 amount1Min,\n address to\n ) external returns (uint128 liquidity);\n\n /// @notice Returns the pair manager's position in the corresponding UniswapV3 pool\n /// @return liquidity The amount of liquidity provided to the UniswapV3 pool by the pair manager\n /// @return feeGrowthInside0LastX128 The fee growth of token0 as of the last action on the individual position\n /// @return feeGrowthInside1LastX128 The fee growth of token1 as of the last action on the individual position\n /// @return tokensOwed0 The uncollected amount of token0 owed to the position as of the last computation\n /// @return tokensOwed1 The uncollected amount of token1 owed to the position as of the last computation\n function position()\n external\n view\n returns (\n uint128 liquidity,\n uint256 feeGrowthInside0LastX128,\n uint256 feeGrowthInside1LastX128,\n uint128 tokensOwed0,\n uint128 tokensOwed1\n );\n\n /// @notice Calls the UniswapV3 pool's collect function, which collects up to a maximum amount of fees\n // owed to a specific position to the recipient, in this case, that recipient is the pair manager\n /// @dev The collected fees will be sent to governance\n /// @return amount0 The amount of fees collected in token0\n /// @return amount1 The amount of fees collected in token1\n function collect() external returns (uint256 amount0, uint256 amount1);\n\n /// @notice Burns the corresponding amount of kLP tokens from the msg.sender and withdraws the specified liquidity\n // in the entire range\n /// @param liquidity The amount of liquidity to be burned\n /// @param amount0Min The minimum amount of token0 we want to send to the recipient (to)\n /// @param amount1Min The minimum amount of token1 we want to send to the recipient (to)\n /// @param to The address that will receive the due fees\n /// @return amount0 The calculated amount of token0 that will be sent to the recipient\n /// @return amount1 The calculated amount of token1 that will be sent to the recipient\n function burn(\n uint128 liquidity,\n uint256 amount0Min,\n uint256 amount1Min,\n address to\n ) external returns (uint256 amount0, uint256 amount1);\n}\n" - }, - "@openzeppelin/contracts/utils/Context.sol": { - "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Provides information about the current execution context, including the\n * sender of the transaction and its data. While these are generally available\n * via msg.sender and msg.data, they should not be accessed in such a direct\n * manner, since when dealing with meta-transactions the account sending and\n * paying for execution may not be the actual sender (as far as an application\n * is concerned).\n *\n * This contract is only required for intermediate, library-like contracts.\n */\nabstract contract Context {\n function _msgSender() internal view virtual returns (address) {\n return msg.sender;\n }\n\n function _msgData() internal view virtual returns (bytes calldata) {\n return msg.data;\n }\n}\n" - }, - "solidity/interfaces/IPairManagerFactory.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport './peripherals/IGovernable.sol';\n\n/// @title Factory of Pair Managers\n/// @notice This contract creates new pair managers\ninterface IPairManagerFactory is IGovernable {\n // Variables\n\n /// @notice Maps the address of a Uniswap pool, to the address of the corresponding PairManager\n /// For example, the uniswap address of DAI-WETH, will return the Keep3r/DAI-WETH pair manager address\n /// @param _pool The address of the Uniswap pool\n /// @return _pairManager The address of the corresponding pair manager\n function pairManagers(address _pool) external view returns (address _pairManager);\n\n // Events\n\n /// @notice Emitted when a new pair manager is created\n /// @param _pool The address of the corresponding Uniswap pool\n /// @param _pairManager The address of the just-created pair manager\n event PairCreated(address _pool, address _pairManager);\n\n // Errors\n\n /// @notice Throws an error if the pair manager is already initialized\n error AlreadyInitialized();\n\n /// @notice Throws an error if the caller is not the owner\n error OnlyOwner();\n\n // Methods\n\n /// @notice Creates a new pair manager based on the address of a Uniswap pool\n /// For example, the uniswap address of DAI-WETH, will create the Keep3r/DAI-WETH pool\n /// @param _pool The address of the Uniswap pool the pair manager will be based of\n /// @return _pairManager The address of the just-created pair manager\n function createPairManager(address _pool) external returns (address _pairManager);\n}\n" - }, - "solidity/contracts/UniV3PairManagerFactory.sol": { - "content": "// SPDX-License-Identifier: MIT\n\n/*\n\nCoded for The Keep3r Network with ♥ by\n\n██████╗░███████╗███████╗██╗  ░██╗░░░░░░░██╗░█████╗░███╗░░██╗██████╗░███████╗██████╗░██╗░░░░░░█████╗░███╗░░██╗██████╗░\n██╔══██╗██╔════╝██╔════╝██║  ░██║░░██╗░░██║██╔══██╗████╗░██║██╔══██╗██╔════╝██╔══██╗██║░░░░░██╔══██╗████╗░██║██╔══██╗\n██║░░██║█████╗░░█████╗░░██║  ░╚██╗████╗██╔╝██║░░██║██╔██╗██║██║░░██║█████╗░░██████╔╝██║░░░░░███████║██╔██╗██║██║░░██║\n██║░░██║██╔══╝░░██╔══╝░░██║  ░░████╔═████║░██║░░██║██║╚████║██║░░██║██╔══╝░░██╔══██╗██║░░░░░██╔══██║██║╚████║██║░░██║\n██████╔╝███████╗██║░░░░░██║  ░░╚██╔╝░╚██╔╝░╚█████╔╝██║░╚███║██████╔╝███████╗██║░░██║███████╗██║░░██║██║░╚███║██████╔╝\n╚═════╝░╚══════╝╚═╝░░░░░╚═╝  ░░░╚═╝░░░╚═╝░░░╚════╝░╚═╝░░╚══╝╚═════╝░╚══════╝╚═╝░░╚═╝╚══════╝╚═╝░░╚═╝╚═╝░░╚══╝╚═════╝░\n\nhttps://defi.sucks\n\n*/\n\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../interfaces/IPairManagerFactory.sol';\nimport './UniV3PairManager.sol';\nimport './peripherals/Governable.sol';\n\n/// @title Factory of Pair Managers\n/// @notice This contract creates new pair managers\ncontract UniV3PairManagerFactory is IPairManagerFactory, Governable {\n mapping(address => address) public override pairManagers;\n\n constructor(address _governance) Governable(_governance) {}\n\n ///@inheritdoc IPairManagerFactory\n function createPairManager(address _pool) external override returns (address _pairManager) {\n if (pairManagers[_pool] != address(0)) revert AlreadyInitialized();\n _pairManager = address(new UniV3PairManager(_pool, governance));\n pairManagers[_pool] = _pairManager;\n emit PairCreated(_pool, _pairManager);\n }\n}\n" - }, - "solidity/for-test/peripherals/GovernableForTest.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../../contracts/peripherals/Governable.sol';\n\ncontract GovernableForTest is Governable {\n constructor(address _governor) Governable(_governor) {}\n}\n" - }, - "solidity/for-test/BridgeForTest.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.0 <0.9.0;\n\nimport '@openzeppelin/contracts/token/ERC20/ERC20.sol';\nimport '@openzeppelin/contracts/token/ERC20/IERC20.sol';\n\ncontract BridgeForTest is ERC20 {\n address public immutable kp3r;\n\n constructor(address _kp3r) ERC20('Wrapped KP3R', 'wKP3R') {\n kp3r = _kp3r;\n }\n\n function bridge(uint256 _amount) external {\n IERC20(kp3r).transferFrom(msg.sender, address(this), _amount);\n _mint(msg.sender, _amount);\n }\n\n function bridgeBack(uint256 _amount) external {\n _burn(msg.sender, _amount);\n IERC20(kp3r).transfer(msg.sender, _amount);\n }\n}\n" - }, - "solidity/for-test/ERC20ForTest.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '@openzeppelin/contracts/token/ERC20/ERC20.sol';\n\ncontract ERC20ForTest is ERC20 {\n constructor(\n string memory _name,\n string memory _symbol,\n address _initialAccount,\n uint256 _initialBalance\n ) ERC20(_name, _symbol) {\n _mint(_initialAccount, _initialBalance);\n }\n\n function mint(uint256 _amount) public {\n _mint(msg.sender, _amount);\n }\n\n function mint(address _account, uint256 _amount) public {\n _mint(_account, _amount);\n }\n\n function burn(uint256 _amount) public {\n _burn(msg.sender, _amount);\n }\n\n function burn(address _account, uint256 _amount) public {\n _burn(_account, _amount);\n }\n\n function transferInternal(\n address _from,\n address _to,\n uint256 _value\n ) public {\n _transfer(_from, _to, _value);\n }\n\n function approveInternal(\n address _owner,\n address _spender,\n uint256 _value\n ) public {\n _approve(_owner, _spender, _value);\n }\n\n function deposit() external payable {\n // Function added for compatibility with WETH\n }\n}\n" - }, - "solidity/for-test/peripherals/keepers/Keep3rKeeperFundableForTest.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../../../contracts/peripherals/keepers/Keep3rKeeperFundable.sol';\n\ncontract Keep3rKeeperFundableForTest is Keep3rKeeperFundable {\n using EnumerableSet for EnumerableSet.AddressSet;\n\n constructor(\n address _kph,\n address _keep3rV1,\n address _keep3rV1Proxy\n ) Keep3rParameters(_kph, _keep3rV1, _keep3rV1Proxy) Keep3rRoles(msg.sender) {}\n\n function isKeeper(address _keeper) external view returns (bool) {\n return _keepers.contains(_keeper);\n }\n\n function setJob(address job) external {\n _jobs.add(job);\n }\n}\n" - }, - "solidity/contracts/sidechain/Keep3rEscrow.sol": { - "content": "// SPDX-License-Identifier: MIT\n\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../peripherals/Mintable.sol';\nimport '../peripherals/DustCollector.sol';\nimport '../../interfaces/sidechain/IKeep3rEscrow.sol';\nimport '@openzeppelin/contracts/token/ERC20/IERC20.sol';\nimport '@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol';\n\ncontract Keep3rEscrow is Mintable, DustCollector, IKeep3rEscrow {\n using SafeERC20 for IERC20;\n\n /// @inheritdoc IKeep3rEscrow\n address public override wKP3R;\n\n /// @param _governance Address of governance\n /// @param _wKP3R Address of wrapped KP3R implementation\n constructor(address _governance, address _wKP3R) Mintable(_governance) {\n wKP3R = _wKP3R;\n }\n\n /// @inheritdoc IKeep3rEscrow\n function deposit(uint256 _amount) external override {\n IERC20(wKP3R).safeTransferFrom(msg.sender, address(this), _amount);\n emit wKP3RDeposited(wKP3R, msg.sender, _amount);\n }\n\n /// @inheritdoc IKeep3rEscrow\n function mint(uint256 _amount) external override onlyMinter {\n IERC20(wKP3R).safeTransfer(msg.sender, _amount);\n emit wKP3RMinted(wKP3R, msg.sender, _amount);\n }\n\n /// @inheritdoc IKeep3rEscrow\n function setWKP3R(address _wKP3R) external override onlyGovernance {\n if (_wKP3R == address(0)) revert ZeroAddress();\n wKP3R = _wKP3R;\n emit wKP3RSet(wKP3R);\n }\n}\n" - }, - "solidity/contracts/peripherals/Mintable.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../../interfaces/peripherals/IMintable.sol';\nimport './Governable.sol';\n\nabstract contract Mintable is Governable, IMintable {\n /// @inheritdoc IMintable\n address public override minter;\n\n constructor(address _governance) Governable(_governance) {}\n\n /// @inheritdoc IMintable\n function setMinter(address _minter) external override onlyGovernance {\n if (_minter == address(0)) revert ZeroAddress();\n minter = _minter;\n emit MinterSet(_minter);\n }\n\n /// @notice Functions with this modifier can only be called by the minter;\n modifier onlyMinter() {\n if (msg.sender != minter) revert OnlyMinter();\n _;\n }\n}\n" - }, - "solidity/for-test/peripherals/DustCollectorForTest.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../../contracts/peripherals/DustCollector.sol';\n\ncontract DustCollectorForTest is DustCollector {\n constructor() DustCollector() Governable(msg.sender) {}\n}\n" - }, - "solidity/for-test/peripherals/Keep3rAccountanceForTest.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../../contracts/peripherals/Keep3rAccountance.sol';\n\ncontract Keep3rAccountanceForTest is Keep3rAccountance {\n using EnumerableSet for EnumerableSet.AddressSet;\n\n constructor() Keep3rRoles(msg.sender) {}\n\n function setJob(address job) external {\n _jobs.add(job);\n }\n\n function setKeeper(address keeper) external {\n _keepers.add(keeper);\n }\n}\n" - }, - "solidity/for-test/peripherals/jobs/Keep3rJobFundableLiquidityForTest.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../../../contracts/peripherals/jobs/Keep3rJobFundableLiquidity.sol';\n\ncontract Keep3rJobFundableLiquidityForTest is Keep3rJobFundableLiquidity {\n using EnumerableSet for EnumerableSet.AddressSet;\n\n constructor(\n address _kph,\n address _keep3rV1,\n address _keep3rV1Proxy\n ) Keep3rParameters(_kph, _keep3rV1, _keep3rV1Proxy) Keep3rRoles(msg.sender) {}\n\n function setJob(address _job) external {\n _jobs.add(_job);\n }\n\n function setJobLiquidity(address _job, address _liquidity) external returns (bool) {\n return _jobLiquidities[_job].add(_liquidity);\n }\n\n function setApprovedLiquidity(address _liquidity) external {\n _approvedLiquidities.add(_liquidity);\n }\n\n function setRevokedLiquidity(address _liquidity) external {\n _approvedLiquidities.remove(_liquidity);\n }\n\n function viewTickCache(address _liquidity) external view returns (TickCache memory _tickCache) {\n _tickCache = _tick[_liquidity];\n }\n\n function viewTickOrder(address _liquidity) external view returns (bool) {\n return _isKP3RToken0[_liquidity];\n }\n\n function internalJobLiquidities(address _job) external view returns (address[] memory _list) {\n _list = _jobLiquidities[_job].values();\n }\n\n function internalSettleJobAccountance(address _job) external {\n _settleJobAccountance(_job);\n }\n}\n" - }, - "solidity/for-test/peripherals/jobs/Keep3rJobDisputableForTest.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../../../contracts/peripherals/jobs/Keep3rJobDisputable.sol';\n\ncontract Keep3rJobDisputableForTest is Keep3rJobDisputable {\n using EnumerableSet for EnumerableSet.AddressSet;\n\n constructor(\n address _kph,\n address _keep3rV1,\n address _keep3rV1Proxy\n ) Keep3rParameters(_kph, _keep3rV1, _keep3rV1Proxy) Keep3rRoles(msg.sender) {}\n\n function setJobLiquidity(address _job, address _liquidity) external {\n _jobLiquidities[_job].add(_liquidity);\n }\n\n function setJobToken(address _job, address _token) external {\n _jobTokens[_job].add(_token);\n }\n\n function setApprovedLiquidity(address _liquidity) external {\n _approvedLiquidities.add(_liquidity);\n }\n\n function setRevokedLiquidity(address _liquidity) external {\n _approvedLiquidities.remove(_liquidity);\n }\n\n function internalJobLiquidityCredits(address _job) external view returns (uint256 _credits) {\n _credits = _jobLiquidityCredits[_job];\n }\n\n function internalJobPeriodCredits(address _job) external view returns (uint256 _credits) {\n _credits = _jobPeriodCredits[_job];\n }\n\n function internalJobTokens(address _job) external view returns (address[] memory _tokens) {\n _tokens = new address[](_jobTokens[_job].length());\n for (uint256 i; i < _jobTokens[_job].length(); i++) {\n _tokens[i] = _jobTokens[_job].at(i);\n }\n }\n\n function internalJobLiquidities(address _job) external view returns (address[] memory _tokens) {\n _tokens = new address[](_jobLiquidities[_job].length());\n for (uint256 i; i < _jobLiquidities[_job].length(); i++) {\n _tokens[i] = _jobLiquidities[_job].at(i);\n }\n }\n}\n" - }, - "solidity/for-test/peripherals/Keep3rDisputableForTest.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../../contracts/peripherals/Keep3rDisputable.sol';\n\ncontract Keep3rDisputableForTest is Keep3rDisputable {\n constructor() Keep3rParameters(address(0), address(0), address(0)) Keep3rRoles(msg.sender) {}\n}\n" - }, - "solidity/for-test/peripherals/keepers/Keep3rKeeperDisputableForTest.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../../../contracts/peripherals/keepers/Keep3rKeeperDisputable.sol';\n\ncontract Keep3rKeeperDisputableForTest is Keep3rKeeperDisputable {\n using EnumerableSet for EnumerableSet.AddressSet;\n\n constructor(\n address _kph,\n address _keep3rV1,\n address _keep3rV1Proxy\n ) Keep3rParameters(_kph, _keep3rV1, _keep3rV1Proxy) Keep3rRoles(msg.sender) {}\n\n function setKeeper(address _keeper) external {\n _keepers.add(_keeper);\n }\n\n function internalSlash(\n address _bonded,\n address _keeper,\n uint256 _bondAmount,\n uint256 _unbondAmount\n ) external {\n _slash(_bonded, _keeper, _bondAmount, _unbondAmount);\n }\n\n function isKeeper(address _address) external view returns (bool _isKeeper) {\n _isKeeper = _keepers.contains(_address);\n }\n}\n" - }, - "solidity/for-test/peripherals/jobs/Keep3rJobFundableCreditsForTest.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../../../contracts/peripherals/jobs/Keep3rJobFundableCredits.sol';\n\ncontract Keep3rJobFundableCreditsForTest is Keep3rJobFundableCredits {\n using EnumerableSet for EnumerableSet.AddressSet;\n\n constructor(\n address _kph,\n address _keep3rV1,\n address _keep3rV1Proxy\n ) Keep3rParameters(_kph, _keep3rV1, _keep3rV1Proxy) Keep3rRoles(msg.sender) {}\n\n function setJob(address _job, address _jobOwner) external {\n _jobs.add(_job);\n jobOwner[_job] = _jobOwner;\n }\n\n function setJobToken(address _job, address _token) external {\n _jobTokens[_job].add(_token);\n }\n\n function isJobToken(address _job, address _token) external view returns (bool _contains) {\n _contains = _jobTokens[_job].contains(_token);\n }\n}\n" - }, - "solidity/contracts/Keep3rHelper.sol": { - "content": "// SPDX-License-Identifier: MIT\n\n/*\n\nCoded for The Keep3r Network with ♥ by\n\n██████╗░███████╗███████╗██╗  ░██╗░░░░░░░██╗░█████╗░███╗░░██╗██████╗░███████╗██████╗░██╗░░░░░░█████╗░███╗░░██╗██████╗░\n██╔══██╗██╔════╝██╔════╝██║  ░██║░░██╗░░██║██╔══██╗████╗░██║██╔══██╗██╔════╝██╔══██╗██║░░░░░██╔══██╗████╗░██║██╔══██╗\n██║░░██║█████╗░░█████╗░░██║  ░╚██╗████╗██╔╝██║░░██║██╔██╗██║██║░░██║█████╗░░██████╔╝██║░░░░░███████║██╔██╗██║██║░░██║\n██║░░██║██╔══╝░░██╔══╝░░██║  ░░████╔═████║░██║░░██║██║╚████║██║░░██║██╔══╝░░██╔══██╗██║░░░░░██╔══██║██║╚████║██║░░██║\n██████╔╝███████╗██║░░░░░██║  ░░╚██╔╝░╚██╔╝░╚█████╔╝██║░╚███║██████╔╝███████╗██║░░██║███████╗██║░░██║██║░╚███║██████╔╝\n╚═════╝░╚══════╝╚═╝░░░░░╚═╝  ░░░╚═╝░░░╚═╝░░░╚════╝░╚═╝░░╚══╝╚═════╝░╚══════╝╚═╝░░╚═╝╚══════╝╚═╝░░╚═╝╚═╝░░╚══╝╚═════╝░\n\nhttps://defi.sucks\n\n*/\n\npragma solidity >=0.8.7 <0.9.0;\n\nimport './libraries/FullMath.sol';\nimport './libraries/TickMath.sol';\nimport '../interfaces/IKeep3r.sol';\nimport '../interfaces/IKeep3rHelper.sol';\nimport './Keep3rHelperParameters.sol';\n\nimport '@openzeppelin/contracts/utils/math/Math.sol';\nimport '@uniswap/v3-core/contracts/interfaces/IUniswapV3Pool.sol';\n\ncontract Keep3rHelper is IKeep3rHelper, Keep3rHelperParameters {\n constructor(\n address _kp3r,\n address _keep3rV2,\n address _governance,\n address _kp3rWethPool\n ) Keep3rHelperParameters(_kp3r, _keep3rV2, _governance, _kp3rWethPool) {}\n\n /// @inheritdoc IKeep3rHelper\n function quote(uint256 _eth) public view override returns (uint256 _amountOut) {\n uint32[] memory _secondsAgos = new uint32[](2);\n _secondsAgos[1] = quoteTwapTime;\n\n (int56[] memory _tickCumulatives, ) = IUniswapV3Pool(kp3rWethPool.poolAddress).observe(_secondsAgos);\n int56 _difference = _tickCumulatives[0] - _tickCumulatives[1];\n _amountOut = getQuoteAtTick(uint128(_eth), kp3rWethPool.isTKNToken0 ? _difference : -_difference, quoteTwapTime);\n }\n\n /// @inheritdoc IKeep3rHelper\n function bonds(address _keeper) public view virtual override returns (uint256 _amountBonded) {\n return IKeep3r(keep3rV2).bonds(_keeper, KP3R);\n }\n\n /// @inheritdoc IKeep3rHelper\n function getRewardAmountFor(address _keeper, uint256 _gasUsed) public view override returns (uint256 _kp3r) {\n uint256 _boost = getRewardBoostFor(bonds(_keeper));\n _kp3r = quote((_gasUsed * _boost) / BOOST_BASE);\n }\n\n /// @inheritdoc IKeep3rHelper\n function getRewardAmount(uint256 _gasUsed) external view override returns (uint256 _amount) {\n // solhint-disable-next-line avoid-tx-origin\n return getRewardAmountFor(tx.origin, _gasUsed);\n }\n\n /// @inheritdoc IKeep3rHelper\n function getRewardBoostFor(uint256 _bonds) public view override returns (uint256 _rewardBoost) {\n _bonds = Math.min(_bonds, targetBond);\n uint256 _cap = minBoost + ((maxBoost - minBoost) * _bonds) / targetBond;\n _rewardBoost = _cap * _getBasefee();\n }\n\n /// @inheritdoc IKeep3rHelper\n function getPoolTokens(address _pool) public view override returns (address _token0, address _token1) {\n return (IUniswapV3Pool(_pool).token0(), IUniswapV3Pool(_pool).token1());\n }\n\n /// @inheritdoc IKeep3rHelper\n function isKP3RToken0(address _pool) external view virtual override returns (bool _isKP3RToken0) {\n address _token0;\n address _token1;\n (_token0, _token1) = getPoolTokens(_pool);\n if (_token0 == KP3R) {\n return true;\n } else if (_token1 != KP3R) {\n revert LiquidityPairInvalid();\n }\n }\n\n /// @inheritdoc IKeep3rHelper\n function observe(address _pool, uint32[] memory _secondsAgo)\n external\n view\n override\n returns (\n int56 _tickCumulative1,\n int56 _tickCumulative2,\n bool _success\n )\n {\n try IUniswapV3Pool(_pool).observe(_secondsAgo) returns (int56[] memory _uniswapResponse, uint160[] memory) {\n _tickCumulative1 = _uniswapResponse[0];\n if (_uniswapResponse.length > 1) {\n _tickCumulative2 = _uniswapResponse[1];\n }\n _success = true;\n } catch (bytes memory) {}\n }\n\n /// @inheritdoc IKeep3rHelper\n function getPaymentParams(uint256 _bonds)\n external\n view\n virtual\n override\n returns (\n uint256 _boost,\n uint256 _oneEthQuote,\n uint256 _extra\n )\n {\n _oneEthQuote = quote(1 ether);\n _boost = getRewardBoostFor(_bonds);\n _extra = workExtraGas;\n }\n\n /// @inheritdoc IKeep3rHelper\n function getKP3RsAtTick(\n uint256 _liquidityAmount,\n int56 _tickDifference,\n uint256 _timeInterval\n ) external pure override returns (uint256 _kp3rAmount) {\n uint160 sqrtRatioX96 = TickMath.getSqrtRatioAtTick(int24(_tickDifference / int256(_timeInterval)));\n _kp3rAmount = FullMath.mulDiv(1 << 96, _liquidityAmount, sqrtRatioX96);\n }\n\n /// @inheritdoc IKeep3rHelper\n function getQuoteAtTick(\n uint128 _baseAmount,\n int56 _tickDifference,\n uint256 _timeInterval\n ) public pure override returns (uint256 _quoteAmount) {\n uint160 sqrtRatioX96 = TickMath.getSqrtRatioAtTick(int24(_tickDifference / int256(_timeInterval)));\n\n if (sqrtRatioX96 <= type(uint128).max) {\n uint256 ratioX192 = uint256(sqrtRatioX96) * sqrtRatioX96;\n _quoteAmount = FullMath.mulDiv(1 << 192, _baseAmount, ratioX192);\n } else {\n uint256 ratioX128 = FullMath.mulDiv(sqrtRatioX96, sqrtRatioX96, 1 << 64);\n _quoteAmount = FullMath.mulDiv(1 << 128, _baseAmount, ratioX128);\n }\n }\n\n /// @notice Gets the gas basefee cost to calculate keeper rewards\n /// @dev Keepers are required to pay a priority fee to be included, this function recognizes a minimum priority fee\n /// @return _baseFee The block's basefee + a minimum priority fee, or a preset minimum gas fee\n function _getBasefee() internal view virtual returns (uint256 _baseFee) {\n return Math.max(minBaseFee, block.basefee + minPriorityFee);\n }\n}\n" - }, - "solidity/for-test/testnet/Keep3rHelperForTestnet.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../../contracts/Keep3rHelper.sol';\n\ncontract Keep3rHelperForTestnet is Keep3rHelper {\n constructor(\n address _kp3r,\n address _keep3rV2,\n address _governance,\n address _kp3rWethPool\n ) Keep3rHelper(_kp3r, _keep3rV2, _governance, _kp3rWethPool) {}\n\n function _getBasefee() internal pure override returns (uint256) {\n return 1;\n }\n}\n" - }, - "solidity/for-test/Keep3rHelperForTest.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../contracts/Keep3rHelper.sol';\n\ncontract Keep3rHelperForTest is Keep3rHelper {\n uint256 public basefee;\n\n constructor(\n address _kp3r,\n address _keep3rV2,\n address _governance,\n address _kp3rWethPool\n ) Keep3rHelper(_kp3r, _keep3rV2, _governance, _kp3rWethPool) {}\n\n function _getBasefee() internal view override returns (uint256) {\n return basefee != 0 ? (basefee + minPriorityFee) : super._getBasefee();\n }\n\n function setBaseFee(uint256 _baseFee) external {\n basefee = _baseFee;\n }\n}\n" - }, - "solidity/contracts/sidechain/Keep3rHelperSidechain.sol": { - "content": "// SPDX-License-Identifier: MIT\n\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../Keep3rHelper.sol';\nimport '../../interfaces/sidechain/IKeep3rHelperSidechain.sol';\n\ncontract Keep3rHelperSidechain is IKeep3rHelperSidechain, Keep3rHelper {\n /// @inheritdoc IKeep3rHelperSidechain\n mapping(address => address) public override oracle;\n /// @inheritdoc IKeep3rHelperSidechain\n IKeep3rHelperParameters.TokenOraclePool public override wethUSDPool;\n\n /// @notice Ethereum mainnet WETH address used for quoting references\n address public immutable override WETH;\n\n /// @param _keep3rV2 Address of sidechain Keep3r implementation\n /// @param _governance Address of governance\n /// @param _kp3rWethOracle Address of oracle used for KP3R/WETH quote\n /// @param _wethUsdOracle Address of oracle used for WETH/USD quote\n /// @dev Oracle pools should use 18 decimals tokens\n constructor(\n address _keep3rV2,\n address _governance,\n address _kp3r,\n address _weth,\n address _kp3rWethOracle,\n address _wethUsdOracle\n ) Keep3rHelper(_kp3r, _keep3rV2, _governance, _kp3rWethOracle) {\n WETH = _weth;\n wethUSDPool = _validateOraclePool(_wethUsdOracle, _weth);\n _setQuoteTwapTime(1 days);\n workExtraGas = 0;\n }\n\n /// @inheritdoc IKeep3rHelper\n /// @notice Uses valid wKP3R address from Keep3rSidechain to query keeper bonds\n function bonds(address _keeper) public view override(Keep3rHelper, IKeep3rHelper) returns (uint256 _amountBonded) {\n address wKP3R = IKeep3r(keep3rV2).keep3rV1();\n return IKeep3r(keep3rV2).bonds(_keeper, wKP3R);\n }\n\n /// @inheritdoc IKeep3rHelperSidechain\n function setOracle(address _liquidity, address _oracle) external override onlyGovernance {\n if (_liquidity == address(0) || _oracle == address(0)) revert ZeroAddress();\n oracle[_liquidity] = _oracle;\n emit OracleSet(_liquidity, _oracle);\n }\n\n /// @inheritdoc IKeep3rHelperSidechain\n function quoteUsdToEth(uint256 _usd) public view virtual override returns (uint256 _amountOut) {\n uint32[] memory _secondsAgos = new uint32[](2);\n _secondsAgos[1] = quoteTwapTime;\n\n /// @dev Oracle is compatible with IUniswapV3Pool\n (int56[] memory _tickCumulatives, ) = IUniswapV3Pool(wethUSDPool.poolAddress).observe(_secondsAgos);\n int56 _difference = _tickCumulatives[0] - _tickCumulatives[1];\n _amountOut = getQuoteAtTick(uint128(_usd), wethUSDPool.isTKNToken0 ? _difference : -_difference, quoteTwapTime);\n }\n\n /// @inheritdoc IKeep3rHelperSidechain\n function setWethUsdPool(address _poolAddress) external override onlyGovernance {\n if (_poolAddress == address(0)) revert ZeroAddress();\n _setWethUsdPool(_poolAddress);\n }\n\n /// @inheritdoc IKeep3rHelper\n function getPaymentParams(uint256 _bonds)\n external\n view\n virtual\n override(Keep3rHelper, IKeep3rHelper)\n returns (\n uint256 _boost,\n uint256 _oneUsdQuote,\n uint256 _extraGas\n )\n {\n _oneUsdQuote = quote(quoteUsdToEth(1 ether));\n _boost = getRewardBoostFor(_bonds);\n _extraGas = workExtraGas;\n }\n\n function _setWethUsdPool(address _poolAddress) internal {\n wethUSDPool = _validateOraclePool(_poolAddress, WETH);\n emit WethUSDPoolChange(wethUSDPool.poolAddress, wethUSDPool.isTKNToken0);\n }\n\n /// @dev Sidechain jobs are quoted by USD/gasUnit, baseFee is set to 1\n function _getBasefee() internal view virtual override returns (uint256 _baseFee) {\n return 1;\n }\n}\n" - }, - "solidity/for-test/peripherals/Keep3rParametersForTest.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../../contracts/peripherals/Keep3rParameters.sol';\n\ncontract Keep3rParametersForTest is Keep3rParameters {\n constructor(\n address _keep3rHelper,\n address _keep3rV1,\n address _keep3rV1Proxy\n ) Keep3rParameters(_keep3rHelper, _keep3rV1, _keep3rV1Proxy) Keep3rRoles(msg.sender) {}\n}\n" - }, - "solidity/for-test/peripherals/jobs/Keep3rJobWorkableForTest.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../../../contracts/peripherals/jobs/Keep3rJobWorkable.sol';\n\ncontract Keep3rJobWorkableForTest is Keep3rJobWorkable {\n using EnumerableSet for EnumerableSet.AddressSet;\n\n constructor(\n address _keep3rHelper,\n address _keep3rV1,\n address _keep3rV1Proxy\n ) Keep3rParameters(_keep3rHelper, _keep3rV1, _keep3rV1Proxy) Keep3rRoles(msg.sender) {}\n\n function setJob(address _job) external {\n _jobs.add(_job);\n }\n\n function setKeeper(address _keeper) external {\n _keepers.add(_keeper);\n }\n\n function setApprovedLiquidity(address _liquidity) external {\n _approvedLiquidities.add(_liquidity);\n }\n\n function setJobLiquidity(address _job, address _liquidity) external {\n _jobLiquidities[_job].add(_liquidity);\n }\n\n function viewJobLiquidityCredits(address _job) external view returns (uint256) {\n return _jobLiquidityCredits[_job];\n }\n\n function viewJobPeriodCredits(address _job) external view returns (uint256) {\n return _jobPeriodCredits[_job];\n }\n\n function viewTickCache(address _liquidity) external view returns (TickCache memory _tickCache) {\n _tickCache = _tick[_liquidity];\n }\n\n function viewGas() external view returns (uint256) {\n return _initialGas;\n }\n}\n" - }, - "solidity/for-test/peripherals/jobs/Keep3rJobMigrationForTest.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../../../contracts/peripherals/jobs/Keep3rJobMigration.sol';\n\ncontract Keep3rJobMigrationForTest is Keep3rJobMigration {\n using EnumerableSet for EnumerableSet.AddressSet;\n\n mapping(address => uint256) public settleJobAccountanceCallCount;\n\n constructor(\n address _kph,\n address _keep3rV1,\n address _keep3rV1Proxy\n ) Keep3rParameters(_kph, _keep3rV1, _keep3rV1Proxy) Keep3rRoles(msg.sender) {}\n\n function setJobToken(address _job, address _token) external {\n _jobTokens[_job].add(_token);\n }\n\n function setJobLiquidity(address _job, address _liquidity) external {\n _jobLiquidities[_job].add(_liquidity);\n }\n\n function viewJobTokenListLength(address _job) external view returns (uint256) {\n return _jobTokens[_job].length();\n }\n\n function viewJobLiquidityList(address _job) external view returns (address[] memory _list) {\n _list = _jobLiquidities[_job].values();\n }\n\n function viewJobPeriodCredits(address _job) external view returns (uint256) {\n return _jobPeriodCredits[_job];\n }\n\n function viewJobLiquidityCredits(address _job) external view returns (uint256) {\n return _jobLiquidityCredits[_job];\n }\n\n function viewMigrationCreatedAt(address _fromJob, address _toJob) external view returns (uint256) {\n return _migrationCreatedAt[_fromJob][_toJob];\n }\n\n function isJob(address _job) external view returns (bool) {\n return _jobs.contains(_job);\n }\n\n function _settleJobAccountance(address _job) internal override {\n settleJobAccountanceCallCount[_job]++;\n }\n}\n" - }, - "solidity/for-test/peripherals/jobs/Keep3rJobManagerForTest.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../../../contracts/peripherals/jobs/Keep3rJobManager.sol';\n\ncontract Keep3rJobManagerForTest is Keep3rJobManager {\n using EnumerableSet for EnumerableSet.AddressSet;\n\n constructor(\n address _keep3rHelper,\n address _keep3rV1,\n address _keep3rV1Proxy\n ) Keep3rRoles(msg.sender) {}\n\n function isJob(address _job) external view returns (bool _isJob) {\n _isJob = _jobs.contains(_job);\n }\n}\n" - }, - "solidity/for-test/peripherals/jobs/Keep3rJobOwnershipForTest.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../../../contracts/peripherals/jobs/Keep3rJobOwnership.sol';\n\ncontract Keep3rJobOwnershipForTest is Keep3rJobOwnership {}\n" - }, - "solidity/for-test/libraries/LiquidityAmountsForTest.sol": { - "content": "// SPDX-License-Identifier: GPL-2.0-or-later\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../../contracts/libraries/FullMath.sol';\nimport '../../contracts/libraries/FixedPoint96.sol';\n\n/// @dev Made this library into a contract to be able to calculate liquidity more precisely for tests\n\n// solhint-disable\ncontract LiquidityAmountsForTest {\n function toUint128(uint256 x) private pure returns (uint128 y) {\n require((y = uint128(x)) == x);\n }\n\n function getLiquidityForAmount0(\n uint160 sqrtRatioAX96,\n uint160 sqrtRatioBX96,\n uint256 amount0\n ) public pure returns (uint128 liquidity) {\n if (sqrtRatioAX96 > sqrtRatioBX96) (sqrtRatioAX96, sqrtRatioBX96) = (sqrtRatioBX96, sqrtRatioAX96);\n uint256 intermediate = FullMath.mulDiv(sqrtRatioAX96, sqrtRatioBX96, FixedPoint96.Q96);\n return toUint128(FullMath.mulDiv(amount0, intermediate, sqrtRatioBX96 - sqrtRatioAX96));\n }\n\n function getLiquidityForAmount1(\n uint160 sqrtRatioAX96,\n uint160 sqrtRatioBX96,\n uint256 amount1\n ) public pure returns (uint128 liquidity) {\n if (sqrtRatioAX96 > sqrtRatioBX96) (sqrtRatioAX96, sqrtRatioBX96) = (sqrtRatioBX96, sqrtRatioAX96);\n return toUint128(FullMath.mulDiv(amount1, FixedPoint96.Q96, sqrtRatioBX96 - sqrtRatioAX96));\n }\n\n function getLiquidityForAmounts(\n uint160 sqrtRatioX96,\n uint160 sqrtRatioAX96,\n uint160 sqrtRatioBX96,\n uint256 amount0,\n uint256 amount1\n ) external pure returns (uint128 liquidity) {\n if (sqrtRatioAX96 > sqrtRatioBX96) (sqrtRatioAX96, sqrtRatioBX96) = (sqrtRatioBX96, sqrtRatioAX96);\n\n if (sqrtRatioX96 <= sqrtRatioAX96) {\n liquidity = getLiquidityForAmount0(sqrtRatioAX96, sqrtRatioBX96, amount0);\n } else if (sqrtRatioX96 < sqrtRatioBX96) {\n uint128 liquidity0 = getLiquidityForAmount0(sqrtRatioX96, sqrtRatioBX96, amount0);\n uint128 liquidity1 = getLiquidityForAmount1(sqrtRatioAX96, sqrtRatioX96, amount1);\n\n liquidity = liquidity0 < liquidity1 ? liquidity0 : liquidity1;\n } else {\n liquidity = getLiquidityForAmount1(sqrtRatioAX96, sqrtRatioBX96, amount1);\n }\n }\n\n function getAmount0ForLiquidity(\n uint160 sqrtRatioAX96,\n uint160 sqrtRatioBX96,\n uint128 liquidity\n ) public pure returns (uint256 amount0) {\n if (sqrtRatioAX96 > sqrtRatioBX96) (sqrtRatioAX96, sqrtRatioBX96) = (sqrtRatioBX96, sqrtRatioAX96);\n\n return FullMath.mulDiv(uint256(liquidity) << FixedPoint96.RESOLUTION, sqrtRatioBX96 - sqrtRatioAX96, sqrtRatioBX96) / sqrtRatioAX96;\n }\n\n function getAmount1ForLiquidity(\n uint160 sqrtRatioAX96,\n uint160 sqrtRatioBX96,\n uint128 liquidity\n ) public pure returns (uint256 amount1) {\n if (sqrtRatioAX96 > sqrtRatioBX96) (sqrtRatioAX96, sqrtRatioBX96) = (sqrtRatioBX96, sqrtRatioAX96);\n\n return FullMath.mulDiv(liquidity, sqrtRatioBX96 - sqrtRatioAX96, FixedPoint96.Q96);\n }\n\n function getAmountsForLiquidity(\n uint160 sqrtRatioX96,\n uint160 sqrtRatioAX96,\n uint160 sqrtRatioBX96,\n uint128 liquidity\n ) external pure returns (uint256 amount0, uint256 amount1) {\n if (sqrtRatioAX96 > sqrtRatioBX96) (sqrtRatioAX96, sqrtRatioBX96) = (sqrtRatioBX96, sqrtRatioAX96);\n\n if (sqrtRatioX96 <= sqrtRatioAX96) {\n amount0 = getAmount0ForLiquidity(sqrtRatioAX96, sqrtRatioBX96, liquidity);\n } else if (sqrtRatioX96 < sqrtRatioBX96) {\n amount0 = getAmount0ForLiquidity(sqrtRatioX96, sqrtRatioBX96, liquidity);\n amount1 = getAmount1ForLiquidity(sqrtRatioAX96, sqrtRatioX96, liquidity);\n } else {\n amount1 = getAmount1ForLiquidity(sqrtRatioAX96, sqrtRatioBX96, liquidity);\n }\n }\n}\n" - }, - "solidity/for-test/IUniswapV3PoolForTest.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '@uniswap/v3-core/contracts/interfaces/IERC20Minimal.sol';\nimport '@uniswap/v3-core/contracts/interfaces/IUniswapV3Pool.sol';\n\n// solhint-disable-next-line no-empty-blocks\ninterface IUniswapV3PoolForTest is IERC20Minimal, IUniswapV3Pool {\n\n}\n" - }, - "@uniswap/v3-core/contracts/interfaces/IERC20Minimal.sol": { - "content": "// SPDX-License-Identifier: GPL-2.0-or-later\npragma solidity >=0.5.0;\n\n/// @title Minimal ERC20 interface for Uniswap\n/// @notice Contains a subset of the full ERC20 interface that is used in Uniswap V3\ninterface IERC20Minimal {\n /// @notice Returns the balance of a token\n /// @param account The account for which to look up the number of tokens it has, i.e. its balance\n /// @return The number of tokens held by the account\n function balanceOf(address account) external view returns (uint256);\n\n /// @notice Transfers the amount of token from the `msg.sender` to the recipient\n /// @param recipient The account that will receive the amount transferred\n /// @param amount The number of tokens to send from the sender to the recipient\n /// @return Returns true for a successful transfer, false for an unsuccessful transfer\n function transfer(address recipient, uint256 amount) external returns (bool);\n\n /// @notice Returns the current allowance given to a spender by an owner\n /// @param owner The account of the token owner\n /// @param spender The account of the token spender\n /// @return The current allowance granted by `owner` to `spender`\n function allowance(address owner, address spender) external view returns (uint256);\n\n /// @notice Sets the allowance of a spender from the `msg.sender` to the value `amount`\n /// @param spender The account which will be allowed to spend a given amount of the owners tokens\n /// @param amount The amount of tokens allowed to be used by `spender`\n /// @return Returns true for a successful approval, false for unsuccessful\n function approve(address spender, uint256 amount) external returns (bool);\n\n /// @notice Transfers `amount` tokens from `sender` to `recipient` up to the allowance given to the `msg.sender`\n /// @param sender The account from which the transfer will be initiated\n /// @param recipient The recipient of the transfer\n /// @param amount The amount of the transfer\n /// @return Returns true for a successful transfer, false for unsuccessful\n function transferFrom(\n address sender,\n address recipient,\n uint256 amount\n ) external returns (bool);\n\n /// @notice Event emitted when tokens are transferred from one address to another, either via `#transfer` or `#transferFrom`.\n /// @param from The account from which the tokens were sent, i.e. the balance decreased\n /// @param to The account to which the tokens were sent, i.e. the balance increased\n /// @param value The amount of tokens that were transferred\n event Transfer(address indexed from, address indexed to, uint256 value);\n\n /// @notice Event emitted when the approval amount for the spender of a given owner's tokens changes.\n /// @param owner The account that approved spending of its tokens\n /// @param spender The account for which the spending allowance was modified\n /// @param value The new allowance from the owner to the spender\n event Approval(address indexed owner, address indexed spender, uint256 value);\n}\n" - } - }, - "settings": { - "optimizer": { - "enabled": true, - "runs": 33 - }, - "outputSelection": { - "*": { - "*": [ - "storageLayout", - "abi", - "evm.bytecode", - "evm.deployedBytecode", - "evm.methodIdentifiers", - "metadata", - "devdoc", - "userdoc", - "evm.gasEstimates" - ], - "": [ - "ast" - ] - } - }, - "metadata": { - "useLiteralContent": true - }, - "libraries": { - "": { - "__CACHE_BREAKER__": "0x00000000d41867734bbee4c6863d9255b2b06ac1" - } - } - } -} \ No newline at end of file diff --git a/deployments/goerli/solcInputs/259e7f97a1eed25cd7581cf27ad6df4e.json b/deployments/goerli/solcInputs/259e7f97a1eed25cd7581cf27ad6df4e.json deleted file mode 100644 index e0d184c..0000000 --- a/deployments/goerli/solcInputs/259e7f97a1eed25cd7581cf27ad6df4e.json +++ /dev/null @@ -1,328 +0,0 @@ -{ - "language": "Solidity", - "sources": { - "solidity/contracts/Keep3r.sol": { - "content": "// SPDX-License-Identifier: MIT\n\n/*\n\nCoded for The Keep3r Network with ♥ by\n\n██████╗░███████╗███████╗██╗  ░██╗░░░░░░░██╗░█████╗░███╗░░██╗██████╗░███████╗██████╗░██╗░░░░░░█████╗░███╗░░██╗██████╗░\n██╔══██╗██╔════╝██╔════╝██║  ░██║░░██╗░░██║██╔══██╗████╗░██║██╔══██╗██╔════╝██╔══██╗██║░░░░░██╔══██╗████╗░██║██╔══██╗\n██║░░██║█████╗░░█████╗░░██║  ░╚██╗████╗██╔╝██║░░██║██╔██╗██║██║░░██║█████╗░░██████╔╝██║░░░░░███████║██╔██╗██║██║░░██║\n██║░░██║██╔══╝░░██╔══╝░░██║  ░░████╔═████║░██║░░██║██║╚████║██║░░██║██╔══╝░░██╔══██╗██║░░░░░██╔══██║██║╚████║██║░░██║\n██████╔╝███████╗██║░░░░░██║  ░░╚██╔╝░╚██╔╝░╚█████╔╝██║░╚███║██████╔╝███████╗██║░░██║███████╗██║░░██║██║░╚███║██████╔╝\n╚═════╝░╚══════╝╚═╝░░░░░╚═╝  ░░░╚═╝░░░╚═╝░░░╚════╝░╚═╝░░╚══╝╚═════╝░╚══════╝╚═╝░░╚═╝╚══════╝╚═╝░░╚═╝╚═╝░░╚══╝╚═════╝░\n\nhttps://defi.sucks\n\n*/\n\npragma solidity >=0.8.4 <0.9.0;\n\nimport './peripherals/jobs/Keep3rJobs.sol';\nimport './peripherals/keepers/Keep3rKeepers.sol';\nimport './peripherals/Keep3rAccountance.sol';\nimport './peripherals/Keep3rRoles.sol';\nimport './peripherals/Keep3rParameters.sol';\nimport './peripherals/DustCollector.sol';\n\ncontract Keep3r is DustCollector, Keep3rJobs, Keep3rKeepers {\n constructor(\n address _governance,\n address _keep3rHelper,\n address _keep3rV1,\n address _keep3rV1Proxy\n ) Keep3rParameters(_keep3rHelper, _keep3rV1, _keep3rV1Proxy) Keep3rRoles(_governance) DustCollector() {}\n}\n" - }, - "solidity/contracts/peripherals/jobs/Keep3rJobs.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport './Keep3rJobDisputable.sol';\nimport './Keep3rJobWorkable.sol';\nimport './Keep3rJobManager.sol';\n\nabstract contract Keep3rJobs is Keep3rJobDisputable, Keep3rJobManager, Keep3rJobWorkable {}\n" - }, - "solidity/contracts/peripherals/keepers/Keep3rKeepers.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport './Keep3rKeeperDisputable.sol';\n\nabstract contract Keep3rKeepers is Keep3rKeeperDisputable {}\n" - }, - "solidity/contracts/peripherals/Keep3rAccountance.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '@openzeppelin/contracts/utils/structs/EnumerableSet.sol';\nimport '../../interfaces/peripherals/IKeep3rAccountance.sol';\n\nabstract contract Keep3rAccountance is IKeep3rAccountance {\n using EnumerableSet for EnumerableSet.AddressSet;\n\n /// @notice List of all enabled keepers\n EnumerableSet.AddressSet internal _keepers;\n\n /// @inheritdoc IKeep3rAccountance\n mapping(address => uint256) public override workCompleted;\n\n /// @inheritdoc IKeep3rAccountance\n mapping(address => uint256) public override firstSeen;\n\n /// @inheritdoc IKeep3rAccountance\n mapping(address => bool) public override disputes;\n\n /// @inheritdoc IKeep3rAccountance\n /// @notice Mapping (job => bonding => amount)\n mapping(address => mapping(address => uint256)) public override bonds;\n\n /// @inheritdoc IKeep3rAccountance\n mapping(address => mapping(address => uint256)) public override jobTokenCredits;\n\n /// @notice The current liquidity credits available for a job\n mapping(address => uint256) internal _jobLiquidityCredits;\n\n /// @notice Map the address of a job to its correspondent periodCredits\n mapping(address => uint256) internal _jobPeriodCredits;\n\n /// @notice Enumerable array of Job Tokens for Credits\n mapping(address => EnumerableSet.AddressSet) internal _jobTokens;\n\n /// @notice List of liquidities that a job has (job => liquidities)\n mapping(address => EnumerableSet.AddressSet) internal _jobLiquidities;\n\n /// @notice Liquidity pool to observe\n mapping(address => address) internal _liquidityPool;\n\n /// @notice Tracks if a pool has KP3R as token0\n mapping(address => bool) internal _isKP3RToken0;\n\n /// @inheritdoc IKeep3rAccountance\n mapping(address => mapping(address => uint256)) public override pendingBonds;\n\n /// @inheritdoc IKeep3rAccountance\n mapping(address => mapping(address => uint256)) public override canActivateAfter;\n\n /// @inheritdoc IKeep3rAccountance\n mapping(address => mapping(address => uint256)) public override canWithdrawAfter;\n\n /// @inheritdoc IKeep3rAccountance\n mapping(address => mapping(address => uint256)) public override pendingUnbonds;\n\n /// @inheritdoc IKeep3rAccountance\n mapping(address => bool) public override hasBonded;\n\n /// @notice List of all enabled jobs\n EnumerableSet.AddressSet internal _jobs;\n\n /// @inheritdoc IKeep3rAccountance\n function jobs() external view override returns (address[] memory _list) {\n _list = _jobs.values();\n }\n\n /// @inheritdoc IKeep3rAccountance\n function keepers() external view override returns (address[] memory _list) {\n _list = _keepers.values();\n }\n}\n" - }, - "solidity/contracts/peripherals/Keep3rRoles.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../../interfaces/peripherals/IKeep3rRoles.sol';\nimport '@openzeppelin/contracts/utils/structs/EnumerableSet.sol';\nimport './Governable.sol';\n\ncontract Keep3rRoles is IKeep3rRoles, Governable {\n /// @inheritdoc IKeep3rRoles\n mapping(address => bool) public override slashers;\n\n /// @inheritdoc IKeep3rRoles\n mapping(address => bool) public override disputers;\n\n constructor(address _governance) Governable(_governance) {}\n\n /// @inheritdoc IKeep3rRoles\n function addSlasher(address _slasher) external override onlyGovernance {\n if (slashers[_slasher]) revert SlasherExistent();\n slashers[_slasher] = true;\n emit SlasherAdded(_slasher);\n }\n\n /// @inheritdoc IKeep3rRoles\n function removeSlasher(address _slasher) external override onlyGovernance {\n if (!slashers[_slasher]) revert SlasherUnexistent();\n delete slashers[_slasher];\n emit SlasherRemoved(_slasher);\n }\n\n /// @inheritdoc IKeep3rRoles\n function addDisputer(address _disputer) external override onlyGovernance {\n if (disputers[_disputer]) revert DisputerExistent();\n disputers[_disputer] = true;\n emit DisputerAdded(_disputer);\n }\n\n /// @inheritdoc IKeep3rRoles\n function removeDisputer(address _disputer) external override onlyGovernance {\n if (!disputers[_disputer]) revert DisputerUnexistent();\n delete disputers[_disputer];\n emit DisputerRemoved(_disputer);\n }\n\n /// @notice Functions with this modifier can only be called by either a slasher or governance\n modifier onlySlasher {\n if (!slashers[msg.sender]) revert OnlySlasher();\n _;\n }\n\n /// @notice Functions with this modifier can only be called by either a disputer or governance\n modifier onlyDisputer {\n if (!disputers[msg.sender]) revert OnlyDisputer();\n _;\n }\n}\n" - }, - "solidity/contracts/peripherals/Keep3rParameters.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../../interfaces/IKeep3rHelper.sol';\nimport '../../interfaces/peripherals/IKeep3rParameters.sol';\nimport './Keep3rAccountance.sol';\nimport './Keep3rRoles.sol';\n\nabstract contract Keep3rParameters is IKeep3rParameters, Keep3rAccountance, Keep3rRoles {\n /// @inheritdoc IKeep3rParameters\n address public override keep3rV1;\n\n /// @inheritdoc IKeep3rParameters\n address public override keep3rV1Proxy;\n\n /// @inheritdoc IKeep3rParameters\n address public override keep3rHelper;\n\n /// @inheritdoc IKeep3rParameters\n uint256 public override bondTime = 3 days;\n\n /// @inheritdoc IKeep3rParameters\n uint256 public override unbondTime = 14 days;\n\n /// @inheritdoc IKeep3rParameters\n uint256 public override liquidityMinimum = 3 ether;\n\n /// @inheritdoc IKeep3rParameters\n uint256 public override rewardPeriodTime = 5 days;\n\n /// @inheritdoc IKeep3rParameters\n uint256 public override inflationPeriod = 34 days;\n\n /// @inheritdoc IKeep3rParameters\n uint256 public override fee = 30;\n\n /// @notice The base that will be used to calculate the fee\n uint256 internal constant _BASE = 10_000;\n\n /// @notice The minimum reward period\n uint256 internal constant _MIN_REWARD_PERIOD_TIME = 1 days;\n\n constructor(\n address _keep3rHelper,\n address _keep3rV1,\n address _keep3rV1Proxy\n ) {\n keep3rHelper = _keep3rHelper;\n keep3rV1 = _keep3rV1;\n keep3rV1Proxy = _keep3rV1Proxy;\n }\n\n /// @inheritdoc IKeep3rParameters\n function setKeep3rHelper(address _keep3rHelper) external override onlyGovernance {\n if (_keep3rHelper == address(0)) revert ZeroAddress();\n keep3rHelper = _keep3rHelper;\n emit Keep3rHelperChange(_keep3rHelper);\n }\n\n /// @inheritdoc IKeep3rParameters\n function setKeep3rV1(address _keep3rV1) external override onlyGovernance {\n if (_keep3rV1 == address(0)) revert ZeroAddress();\n keep3rV1 = _keep3rV1;\n emit Keep3rV1Change(_keep3rV1);\n }\n\n /// @inheritdoc IKeep3rParameters\n function setKeep3rV1Proxy(address _keep3rV1Proxy) external override onlyGovernance {\n if (_keep3rV1Proxy == address(0)) revert ZeroAddress();\n keep3rV1Proxy = _keep3rV1Proxy;\n emit Keep3rV1ProxyChange(_keep3rV1Proxy);\n }\n\n /// @inheritdoc IKeep3rParameters\n function setBondTime(uint256 _bondTime) external override onlyGovernance {\n bondTime = _bondTime;\n emit BondTimeChange(_bondTime);\n }\n\n /// @inheritdoc IKeep3rParameters\n function setUnbondTime(uint256 _unbondTime) external override onlyGovernance {\n unbondTime = _unbondTime;\n emit UnbondTimeChange(_unbondTime);\n }\n\n /// @inheritdoc IKeep3rParameters\n function setLiquidityMinimum(uint256 _liquidityMinimum) external override onlyGovernance {\n liquidityMinimum = _liquidityMinimum;\n emit LiquidityMinimumChange(_liquidityMinimum);\n }\n\n /// @inheritdoc IKeep3rParameters\n // TODO: check what happens to credit minting when changing this. Shouldn't we update the cached ticks?\n function setRewardPeriodTime(uint256 _rewardPeriodTime) external override onlyGovernance {\n if (_rewardPeriodTime < _MIN_REWARD_PERIOD_TIME) revert MinRewardPeriod();\n rewardPeriodTime = _rewardPeriodTime;\n emit RewardPeriodTimeChange(_rewardPeriodTime);\n }\n\n /// @inheritdoc IKeep3rParameters\n function setInflationPeriod(uint256 _inflationPeriod) external override onlyGovernance {\n inflationPeriod = _inflationPeriod;\n emit InflationPeriodChange(_inflationPeriod);\n }\n\n /// @inheritdoc IKeep3rParameters\n function setFee(uint256 _fee) external override onlyGovernance {\n fee = _fee;\n emit FeeChange(_fee);\n }\n}\n" - }, - "solidity/contracts/peripherals/DustCollector.sol": { - "content": "// SPDX-License-Identifier: MIT\n\npragma solidity >=0.8.4 <0.9.0;\n\nimport '@openzeppelin/contracts/token/ERC20/IERC20.sol';\nimport '@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol';\nimport '../../contracts/peripherals/Governable.sol';\nimport '../../interfaces/peripherals/IDustCollector.sol';\n\nabstract contract DustCollector is IDustCollector, Governable {\n using SafeERC20 for IERC20;\n\n address internal constant _ETH_ADDRESS = 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE;\n\n function sendDust(\n address _token,\n uint256 _amount,\n address _to\n ) external override onlyGovernance {\n if (_to == address(0)) revert ZeroAddress();\n if (_token == _ETH_ADDRESS) {\n payable(_to).transfer(_amount);\n } else {\n IERC20(_token).safeTransfer(_to, _amount);\n }\n emit DustSent(_token, _amount, _to);\n }\n}\n" - }, - "solidity/contracts/peripherals/jobs/Keep3rJobDisputable.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport './Keep3rJobFundableCredits.sol';\nimport './Keep3rJobFundableLiquidity.sol';\nimport '../Keep3rDisputable.sol';\n\nabstract contract Keep3rJobDisputable is IKeep3rJobDisputable, Keep3rDisputable, Keep3rJobFundableCredits, Keep3rJobFundableLiquidity {\n using EnumerableSet for EnumerableSet.AddressSet;\n using SafeERC20 for IERC20;\n\n /// @inheritdoc IKeep3rJobDisputable\n function slashTokenFromJob(\n address _job,\n address _token,\n uint256 _amount\n ) external override onlySlasher {\n if (!disputes[_job]) revert NotDisputed();\n if (!_jobTokens[_job].contains(_token)) revert JobTokenUnexistent();\n if (jobTokenCredits[_job][_token] < _amount) revert JobTokenInsufficient();\n\n try IERC20(_token).transfer(governance, _amount) {} catch {}\n jobTokenCredits[_job][_token] -= _amount;\n if (jobTokenCredits[_job][_token] == 0) {\n _jobTokens[_job].remove(_token);\n }\n\n emit JobSlashToken(_job, _token, msg.sender, _amount);\n }\n\n /// @inheritdoc IKeep3rJobDisputable\n function slashLiquidityFromJob(\n address _job,\n address _liquidity,\n uint256 _amount\n ) external override onlySlasher {\n if (!disputes[_job]) revert NotDisputed();\n\n _unbondLiquidityFromJob(_job, _liquidity, _amount);\n try IERC20(_liquidity).transfer(governance, _amount) {} catch {}\n emit JobSlashLiquidity(_job, _liquidity, msg.sender, _amount);\n }\n}\n" - }, - "solidity/contracts/peripherals/jobs/Keep3rJobWorkable.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport './Keep3rJobMigration.sol';\nimport '../../../interfaces/IKeep3rHelper.sol';\nimport '../../../interfaces/peripherals/IKeep3rJobs.sol';\n\nimport '@openzeppelin/contracts/token/ERC20/IERC20.sol';\nimport '@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol';\n\nabstract contract Keep3rJobWorkable is IKeep3rJobWorkable, Keep3rJobMigration {\n using EnumerableSet for EnumerableSet.AddressSet;\n using SafeERC20 for IERC20;\n\n uint256 internal _initialGas;\n\n /// @inheritdoc IKeep3rJobWorkable\n function isKeeper(address _keeper) external override returns (bool _isKeeper) {\n _initialGas = _getGasLeft();\n if (_keepers.contains(_keeper)) {\n emit KeeperValidation(_initialGas);\n return true;\n }\n }\n\n /// @inheritdoc IKeep3rJobWorkable\n function isBondedKeeper(\n address _keeper,\n address _bond,\n uint256 _minBond,\n uint256 _earned,\n uint256 _age\n ) public override returns (bool _isBondedKeeper) {\n _initialGas = _getGasLeft();\n if (\n _keepers.contains(_keeper) &&\n bonds[_keeper][_bond] >= _minBond &&\n workCompleted[_keeper] >= _earned &&\n block.timestamp - firstSeen[_keeper] >= _age\n ) {\n emit KeeperValidation(_initialGas);\n return true;\n }\n }\n\n /// @inheritdoc IKeep3rJobWorkable\n function worked(address _keeper) external virtual override {\n address _job = msg.sender;\n if (disputes[_job]) revert JobDisputed();\n if (!_jobs.contains(_job)) revert JobUnapproved();\n\n if (_updateJobCreditsIfNeeded(_job)) {\n emit LiquidityCreditsReward(_job, rewardedAt[_job], _jobLiquidityCredits[_job], _jobPeriodCredits[_job]);\n }\n\n (uint256 _boost, uint256 _oneEthQuote, uint256 _extraGas) = IKeep3rHelper(keep3rHelper).getPaymentParams(bonds[_keeper][keep3rV1]);\n\n uint256 _gasLeft = _getGasLeft();\n uint256 _payment = _calculatePayment(_gasLeft, _extraGas, _oneEthQuote, _boost);\n\n if (_payment > _jobLiquidityCredits[_job]) {\n _rewardJobCredits(_job);\n emit LiquidityCreditsReward(_job, rewardedAt[_job], _jobLiquidityCredits[_job], _jobPeriodCredits[_job]);\n\n _gasLeft = _getGasLeft();\n _payment = _calculatePayment(_gasLeft, _extraGas, _oneEthQuote, _boost);\n }\n\n _bondedPayment(_job, _keeper, _payment);\n emit KeeperWork(keep3rV1, _job, _keeper, _payment, _gasLeft);\n }\n\n /// @inheritdoc IKeep3rJobWorkable\n function bondedPayment(address _keeper, uint256 _payment) public override {\n address _job = msg.sender;\n\n if (disputes[_job]) revert JobDisputed();\n if (!_jobs.contains(_job)) revert JobUnapproved();\n\n if (_updateJobCreditsIfNeeded(_job)) {\n emit LiquidityCreditsReward(_job, rewardedAt[_job], _jobLiquidityCredits[_job], _jobPeriodCredits[_job]);\n }\n\n if (_payment > _jobLiquidityCredits[_job]) {\n _rewardJobCredits(_job);\n emit LiquidityCreditsReward(_job, rewardedAt[_job], _jobLiquidityCredits[_job], _jobPeriodCredits[_job]);\n }\n\n _bondedPayment(_job, _keeper, _payment);\n emit KeeperWork(keep3rV1, _job, _keeper, _payment, _getGasLeft());\n }\n\n /// @inheritdoc IKeep3rJobWorkable\n function directTokenPayment(\n address _token,\n address _keeper,\n uint256 _amount\n ) external override {\n address _job = msg.sender;\n\n if (disputes[_job]) revert JobDisputed();\n if (disputes[_keeper]) revert Disputed();\n if (!_jobs.contains(_job)) revert JobUnapproved();\n if (jobTokenCredits[_job][_token] < _amount) revert InsufficientFunds();\n jobTokenCredits[_job][_token] -= _amount;\n IERC20(_token).safeTransfer(_keeper, _amount);\n emit KeeperWork(_token, _job, _keeper, _amount, _getGasLeft());\n }\n\n function _bondedPayment(\n address _job,\n address _keeper,\n uint256 _payment\n ) internal {\n if (_payment > _jobLiquidityCredits[_job]) revert InsufficientFunds();\n\n workedAt[_job] = block.timestamp;\n _jobLiquidityCredits[_job] -= _payment;\n bonds[_keeper][keep3rV1] += _payment;\n workCompleted[_keeper] += _payment;\n }\n\n /// @notice Calculate amount to be payed in KP3R, taking into account multiple parameters\n /// @param _gasLeft Amount of gas left after working the job\n /// @param _extraGas Amount of expected unaccounted gas\n /// @param _oneEthQuote Amount of KP3R equivalent to 1 ETH\n /// @param _boost Reward given to the keeper for having bonded KP3R tokens\n /// @return _payment Amount to be payed in KP3R tokens\n function _calculatePayment(\n uint256 _gasLeft,\n uint256 _extraGas,\n uint256 _oneEthQuote,\n uint256 _boost\n ) internal view returns (uint256 _payment) {\n uint256 _accountedGas = _initialGas - _gasLeft + _extraGas;\n _payment = (((_accountedGas * _boost) / _BASE) * _oneEthQuote) / 1 ether;\n }\n\n /// @notice Return the gas left and add 1/64 in order to match real gas left at first level of depth (EIP-150)\n /// @return _gasLeft Amount of gas left recording taking into account EIP-150\n function _getGasLeft() internal view returns (uint256 _gasLeft) {\n _gasLeft = (gasleft() * 64) / 63;\n }\n}\n" - }, - "solidity/contracts/peripherals/jobs/Keep3rJobManager.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport './Keep3rJobOwnership.sol';\nimport '../Keep3rRoles.sol';\nimport '../Keep3rParameters.sol';\nimport '../../../interfaces/peripherals/IKeep3rJobs.sol';\n\nabstract contract Keep3rJobManager is IKeep3rJobManager, Keep3rJobOwnership, Keep3rRoles, Keep3rParameters {\n using EnumerableSet for EnumerableSet.AddressSet;\n\n /// @inheritdoc IKeep3rJobManager\n function addJob(address _job) external override {\n if (_jobs.contains(_job)) revert JobAlreadyAdded();\n if (hasBonded[_job]) revert AlreadyAKeeper();\n _jobs.add(_job);\n jobOwner[_job] = msg.sender;\n emit JobAddition(_job, msg.sender);\n }\n}\n" - }, - "solidity/contracts/peripherals/jobs/Keep3rJobFundableCredits.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport './Keep3rJobOwnership.sol';\nimport '../Keep3rAccountance.sol';\nimport '../Keep3rParameters.sol';\nimport '../../../interfaces/peripherals/IKeep3rJobs.sol';\n\nimport '@openzeppelin/contracts/security/ReentrancyGuard.sol';\nimport '@openzeppelin/contracts/token/ERC20/IERC20.sol';\nimport '@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol';\nimport '@openzeppelin/contracts/utils/math/Math.sol';\n\nabstract contract Keep3rJobFundableCredits is IKeep3rJobFundableCredits, ReentrancyGuard, Keep3rJobOwnership, Keep3rParameters {\n using EnumerableSet for EnumerableSet.AddressSet;\n using SafeERC20 for IERC20;\n\n /// @notice Cooldown between withdrawals\n uint256 internal constant _WITHDRAW_TOKENS_COOLDOWN = 1 minutes;\n\n /// @inheritdoc IKeep3rJobFundableCredits\n mapping(address => mapping(address => uint256)) public override jobTokenCreditsAddedAt;\n\n /// @inheritdoc IKeep3rJobFundableCredits\n function addTokenCreditsToJob(\n address _job,\n address _token,\n uint256 _amount\n ) external override nonReentrant {\n if (!_jobs.contains(_job)) revert JobUnavailable();\n // KP3R shouldn't be used for direct token payments\n if (_token == keep3rV1) revert TokenUnallowed();\n uint256 _before = IERC20(_token).balanceOf(address(this));\n IERC20(_token).safeTransferFrom(msg.sender, address(this), _amount);\n uint256 _received = IERC20(_token).balanceOf(address(this)) - _before;\n uint256 _tokenFee = (_received * fee) / _BASE;\n jobTokenCredits[_job][_token] += _received - _tokenFee;\n jobTokenCreditsAddedAt[_job][_token] = block.timestamp;\n IERC20(_token).safeTransfer(governance, _tokenFee);\n _jobTokens[_job].add(_token);\n\n emit TokenCreditAddition(_job, _token, msg.sender, _received);\n }\n\n /// @inheritdoc IKeep3rJobFundableCredits\n function withdrawTokenCreditsFromJob(\n address _job,\n address _token,\n uint256 _amount,\n address _receiver\n ) external override nonReentrant onlyJobOwner(_job) {\n if (block.timestamp <= jobTokenCreditsAddedAt[_job][_token] + _WITHDRAW_TOKENS_COOLDOWN) revert JobTokenCreditsLocked();\n if (jobTokenCredits[_job][_token] < _amount) revert InsufficientJobTokenCredits();\n if (disputes[_job]) revert JobDisputed();\n\n jobTokenCredits[_job][_token] -= _amount;\n IERC20(_token).safeTransfer(_receiver, _amount);\n\n if (jobTokenCredits[_job][_token] == 0) {\n _jobTokens[_job].remove(_token);\n }\n\n emit TokenCreditWithdrawal(_job, _token, _receiver, _amount);\n }\n}\n" - }, - "solidity/contracts/peripherals/jobs/Keep3rJobFundableLiquidity.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport './Keep3rJobOwnership.sol';\nimport '../Keep3rAccountance.sol';\nimport '../Keep3rParameters.sol';\nimport '../../../interfaces/IPairManager.sol';\nimport '../../../interfaces/peripherals/IKeep3rJobs.sol';\n\nimport '../../libraries/FullMath.sol';\n\nimport '@openzeppelin/contracts/security/ReentrancyGuard.sol';\nimport '@openzeppelin/contracts/token/ERC20/IERC20.sol';\nimport '@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol';\nimport '@openzeppelin/contracts/utils/math/Math.sol';\n\nabstract contract Keep3rJobFundableLiquidity is IKeep3rJobFundableLiquidity, ReentrancyGuard, Keep3rJobOwnership, Keep3rParameters {\n using EnumerableSet for EnumerableSet.AddressSet;\n using SafeERC20 for IERC20;\n\n /// @notice List of liquidities that are accepted in the system\n EnumerableSet.AddressSet internal _approvedLiquidities;\n\n /// @inheritdoc IKeep3rJobFundableLiquidity\n mapping(address => mapping(address => uint256)) public override liquidityAmount;\n\n /// @inheritdoc IKeep3rJobFundableLiquidity\n mapping(address => uint256) public override rewardedAt;\n\n /// @inheritdoc IKeep3rJobFundableLiquidity\n mapping(address => uint256) public override workedAt;\n\n /// @notice Tracks an address and returns its TickCache\n mapping(address => TickCache) internal _tick;\n\n // Views\n\n /// @inheritdoc IKeep3rJobFundableLiquidity\n function approvedLiquidities() external view override returns (address[] memory _list) {\n _list = _approvedLiquidities.values();\n }\n\n /// @inheritdoc IKeep3rJobFundableLiquidity\n function jobPeriodCredits(address _job) public view override returns (uint256 _periodCredits) {\n for (uint256 i; i < _jobLiquidities[_job].length(); i++) {\n address _liquidity = _jobLiquidities[_job].at(i);\n if (_approvedLiquidities.contains(_liquidity)) {\n TickCache memory _tickCache = observeLiquidity(_liquidity);\n if (_tickCache.period != 0) {\n int56 _tickDifference = _isKP3RToken0[_liquidity] ? _tickCache.difference : -_tickCache.difference;\n _periodCredits += _getReward(\n IKeep3rHelper(keep3rHelper).getKP3RsAtTick(liquidityAmount[_job][_liquidity], _tickDifference, rewardPeriodTime)\n );\n }\n }\n }\n }\n\n /// @inheritdoc IKeep3rJobFundableLiquidity\n function jobLiquidityCredits(address _job) public view override returns (uint256 _liquidityCredits) {\n uint256 _periodCredits = jobPeriodCredits(_job);\n\n // If the job was rewarded in the past 1 period time\n if ((block.timestamp - rewardedAt[_job]) < rewardPeriodTime) {\n // If the job has period credits, update minted job credits to new twap\n _liquidityCredits = _periodCredits > 0\n ? (_jobLiquidityCredits[_job] * _periodCredits) / _jobPeriodCredits[_job] // If the job has period credits, return remaining job credits updated to new twap\n : _jobLiquidityCredits[_job]; // If not, return remaining credits, forced credits should not be updated\n } else {\n // Else return a full period worth of credits if current credits have expired\n _liquidityCredits = _periodCredits;\n }\n }\n\n /// @inheritdoc IKeep3rJobFundableLiquidity\n function totalJobCredits(address _job) external view override returns (uint256 _credits) {\n uint256 _periodCredits = jobPeriodCredits(_job);\n uint256 _cooldown = block.timestamp;\n\n if ((rewardedAt[_job] > _period(block.timestamp - rewardPeriodTime))) {\n // Will calculate cooldown if it outdated\n if ((block.timestamp - rewardedAt[_job]) >= rewardPeriodTime) {\n // Will calculate cooldown from last reward reference in this period\n _cooldown -= (rewardedAt[_job] + rewardPeriodTime);\n } else {\n // Will calculate cooldown from last reward timestamp\n _cooldown -= rewardedAt[_job];\n }\n } else {\n // Will calculate cooldown from period start if expired\n _cooldown -= _period(block.timestamp);\n }\n _credits = jobLiquidityCredits(_job) + _phase(_cooldown, _periodCredits);\n }\n\n /// @inheritdoc IKeep3rJobFundableLiquidity\n function quoteLiquidity(address _liquidity, uint256 _amount) external view override returns (uint256 _periodCredits) {\n if (_approvedLiquidities.contains(_liquidity)) {\n TickCache memory _tickCache = observeLiquidity(_liquidity);\n if (_tickCache.period != 0) {\n int56 _tickDifference = _isKP3RToken0[_liquidity] ? _tickCache.difference : -_tickCache.difference;\n return _getReward(IKeep3rHelper(keep3rHelper).getKP3RsAtTick(_amount, _tickDifference, rewardPeriodTime));\n }\n }\n }\n\n /// @inheritdoc IKeep3rJobFundableLiquidity\n function observeLiquidity(address _liquidity) public view virtual override returns (TickCache memory _tickCache) {\n if (_tick[_liquidity].period == _period(block.timestamp)) {\n // Will return cached twaps if liquidity is updated\n _tickCache = _tick[_liquidity];\n } else {\n bool success;\n uint256 lastPeriod = _period(block.timestamp - rewardPeriodTime);\n\n if (_tick[_liquidity].period == lastPeriod) {\n // Will only ask for current period accumulator if liquidity is outdated\n uint32[] memory _secondsAgo = new uint32[](1);\n int56 previousTick = _tick[_liquidity].current;\n\n _secondsAgo[0] = uint32(block.timestamp - _period(block.timestamp));\n\n (_tickCache.current, , success) = IKeep3rHelper(keep3rHelper).observe(_liquidityPool[_liquidity], _secondsAgo);\n\n _tickCache.difference = _tickCache.current - previousTick;\n } else if (_tick[_liquidity].period < lastPeriod) {\n // Will ask for 2 accumulators if liquidity is expired\n uint32[] memory _secondsAgo = new uint32[](2);\n\n _secondsAgo[0] = uint32(block.timestamp - _period(block.timestamp));\n _secondsAgo[1] = uint32(block.timestamp - _period(block.timestamp) + rewardPeriodTime);\n\n int56 _tickCumulative2;\n (_tickCache.current, _tickCumulative2, success) = IKeep3rHelper(keep3rHelper).observe(_liquidityPool[_liquidity], _secondsAgo);\n\n _tickCache.difference = _tickCache.current - _tickCumulative2;\n }\n if (success) {\n _tickCache.period = _period(block.timestamp);\n } else {\n delete _tickCache.period;\n }\n }\n }\n\n // Methods\n\n /// @inheritdoc IKeep3rJobFundableLiquidity\n function forceLiquidityCreditsToJob(address _job, uint256 _amount) external override onlyGovernance {\n if (!_jobs.contains(_job)) revert JobUnavailable();\n _settleJobAccountance(_job);\n _jobLiquidityCredits[_job] += _amount;\n emit LiquidityCreditsForced(_job, rewardedAt[_job], _jobLiquidityCredits[_job]);\n }\n\n /// @inheritdoc IKeep3rJobFundableLiquidity\n function approveLiquidity(address _liquidity) external virtual override onlyGovernance {\n if (!_approvedLiquidities.add(_liquidity)) revert LiquidityPairApproved();\n _liquidityPool[_liquidity] = IPairManager(_liquidity).pool();\n _isKP3RToken0[_liquidity] = IKeep3rHelper(keep3rHelper).isKP3RToken0(_liquidityPool[_liquidity]);\n _tick[_liquidity] = observeLiquidity(_liquidity);\n emit LiquidityApproval(_liquidity);\n }\n\n /// @inheritdoc IKeep3rJobFundableLiquidity\n function revokeLiquidity(address _liquidity) external override onlyGovernance {\n if (!_approvedLiquidities.remove(_liquidity)) revert LiquidityPairUnexistent();\n emit LiquidityRevocation(_liquidity);\n }\n\n /// @inheritdoc IKeep3rJobFundableLiquidity\n function addLiquidityToJob(\n address _job,\n address _liquidity,\n uint256 _amount\n ) external override nonReentrant {\n if (!_approvedLiquidities.contains(_liquidity)) revert LiquidityPairUnapproved();\n if (!_jobs.contains(_job)) revert JobUnavailable();\n\n _jobLiquidities[_job].add(_liquidity);\n\n _settleJobAccountance(_job);\n\n if (_quoteLiquidity(liquidityAmount[_job][_liquidity] + _amount, _liquidity) < liquidityMinimum) revert JobLiquidityLessThanMin();\n\n emit LiquidityCreditsReward(_job, rewardedAt[_job], _jobLiquidityCredits[_job], _jobPeriodCredits[_job]);\n\n IERC20(_liquidity).safeTransferFrom(msg.sender, address(this), _amount);\n liquidityAmount[_job][_liquidity] += _amount;\n _jobPeriodCredits[_job] += _getReward(_quoteLiquidity(_amount, _liquidity));\n emit LiquidityAddition(_job, _liquidity, msg.sender, _amount);\n }\n\n /// @inheritdoc IKeep3rJobFundableLiquidity\n function unbondLiquidityFromJob(\n address _job,\n address _liquidity,\n uint256 _amount\n ) external override onlyJobOwner(_job) {\n canWithdrawAfter[_job][_liquidity] = block.timestamp + unbondTime;\n pendingUnbonds[_job][_liquidity] += _amount;\n _unbondLiquidityFromJob(_job, _liquidity, _amount);\n\n uint256 _remainingLiquidity = liquidityAmount[_job][_liquidity];\n if (_remainingLiquidity > 0 && _quoteLiquidity(_remainingLiquidity, _liquidity) < liquidityMinimum) revert JobLiquidityLessThanMin();\n\n emit Unbonding(_job, _liquidity, _amount);\n }\n\n /// @inheritdoc IKeep3rJobFundableLiquidity\n function withdrawLiquidityFromJob(\n address _job,\n address _liquidity,\n address _receiver\n ) external override onlyJobOwner(_job) {\n if (_receiver == address(0)) revert ZeroAddress();\n if (pendingUnbonds[_job][_liquidity] == 0) revert UnbondsUnexistent();\n if (canWithdrawAfter[_job][_liquidity] >= block.timestamp) revert UnbondsLocked();\n if (disputes[_job]) revert Disputed();\n\n uint256 _amount = pendingUnbonds[_job][_liquidity];\n\n delete pendingUnbonds[_job][_liquidity];\n delete canWithdrawAfter[_job][_liquidity];\n\n IERC20(_liquidity).safeTransfer(_receiver, _amount);\n emit LiquidityWithdrawal(_job, _liquidity, _receiver, _amount);\n }\n\n // Internal functions\n\n /// @notice Updates or rewards job liquidity credits depending on time since last job reward\n function _updateJobCreditsIfNeeded(address _job) internal returns (bool _rewarded) {\n if (rewardedAt[_job] < _period(block.timestamp)) {\n // Will exit function if job has been rewarded in current period\n if (rewardedAt[_job] <= _period(block.timestamp - rewardPeriodTime)) {\n // Will reset job to period syncronicity if a full period passed without rewards\n _updateJobPeriod(_job);\n _jobLiquidityCredits[_job] = _jobPeriodCredits[_job];\n rewardedAt[_job] = _period(block.timestamp);\n _rewarded = true;\n } else if ((block.timestamp - rewardedAt[_job]) >= rewardPeriodTime) {\n // Will reset job's syncronicity if last reward was more than epoch ago\n _updateJobPeriod(_job);\n _jobLiquidityCredits[_job] = _jobPeriodCredits[_job];\n rewardedAt[_job] += rewardPeriodTime;\n _rewarded = true;\n } else if (workedAt[_job] < _period(block.timestamp)) {\n // First keeper on period has to update job accountance to current twaps\n uint256 previousPeriodCredits = _jobPeriodCredits[_job];\n _updateJobPeriod(_job);\n _jobLiquidityCredits[_job] = (_jobLiquidityCredits[_job] * _jobPeriodCredits[_job]) / previousPeriodCredits;\n // Updating job accountance does not reward job\n }\n }\n }\n\n /// @notice Only called if _jobLiquidityCredits < payment\n function _rewardJobCredits(address _job) internal {\n /// @notice Only way to += jobLiquidityCredits is when keeper rewarding (cannot pay work)\n /* WARNING: this allows to top up _jobLiquidityCredits to a max of 1.99 but have to spend at least 1 */\n _jobLiquidityCredits[_job] += _phase(block.timestamp - rewardedAt[_job], _jobPeriodCredits[_job]);\n rewardedAt[_job] = block.timestamp;\n }\n\n /// @notice Updates accountance for _jobPeriodCredits\n function _updateJobPeriod(address _job) internal {\n _jobPeriodCredits[_job] = _calculateJobPeriodCredits(_job);\n }\n\n /// @notice Quotes the outdated job liquidities and calculates _periodCredits\n /// @dev This function is also responsible for keeping the KP3R/WETH quote updated\n function _calculateJobPeriodCredits(address _job) internal returns (uint256 _periodCredits) {\n for (uint256 i; i < _jobLiquidities[_job].length(); i++) {\n address _liquidity = _jobLiquidities[_job].at(i);\n if (_approvedLiquidities.contains(_liquidity)) {\n if (_tick[_liquidity].period != _period(block.timestamp)) {\n // Updates liquidity cache only if needed\n _tick[_liquidity] = observeLiquidity(_liquidity);\n }\n _periodCredits += _getReward(_quoteLiquidity(liquidityAmount[_job][_liquidity], _liquidity));\n }\n }\n }\n\n /// @notice Updates job accountance calculating the impact of the unbonded liquidity amount\n function _unbondLiquidityFromJob(\n address _job,\n address _liquidity,\n uint256 _amount\n ) internal nonReentrant {\n if (!_jobLiquidities[_job].contains(_liquidity)) revert JobLiquidityUnexistent();\n if (liquidityAmount[_job][_liquidity] < _amount) revert JobLiquidityInsufficient();\n\n // Ensures current twaps in job liquidities\n _updateJobPeriod(_job);\n uint256 _periodCreditsToRemove = _getReward(_quoteLiquidity(_amount, _liquidity));\n\n // A liquidity can be revoked causing a job to have 0 periodCredits\n if (_jobPeriodCredits[_job] > 0) {\n // Removes a % correspondant to a full rewardPeriodTime for the liquidity withdrawn vs all of the liquidities\n _jobLiquidityCredits[_job] -= (_jobLiquidityCredits[_job] * _periodCreditsToRemove) / _jobPeriodCredits[_job];\n _jobPeriodCredits[_job] -= _periodCreditsToRemove;\n }\n\n liquidityAmount[_job][_liquidity] -= _amount;\n if (liquidityAmount[_job][_liquidity] == 0) {\n _jobLiquidities[_job].remove(_liquidity);\n }\n }\n\n /// @notice Returns a fraction of the multiplier or the whole multiplier if equal or more than a rewardPeriodTime has passed\n function _phase(uint256 _timePassed, uint256 _multiplier) internal view returns (uint256 _result) {\n if (_timePassed < rewardPeriodTime) {\n _result = (_timePassed * _multiplier) / rewardPeriodTime;\n } else _result = _multiplier;\n }\n\n /// @notice Returns the start of the period of the provided timestamp\n function _period(uint256 _timestamp) internal view returns (uint256 _periodTimestamp) {\n return _timestamp - (_timestamp % rewardPeriodTime);\n }\n\n /// @notice Calculates relation between rewardPeriod and inflationPeriod\n function _getReward(uint256 _baseAmount) internal view returns (uint256 _credits) {\n return FullMath.mulDiv(_baseAmount, rewardPeriodTime, inflationPeriod);\n }\n\n /// @notice Returns underlying KP3R amount for a given liquidity amount\n function _quoteLiquidity(uint256 _amount, address _liquidity) internal view returns (uint256 _quote) {\n if (_tick[_liquidity].period != 0) {\n int56 _tickDifference = _isKP3RToken0[_liquidity] ? _tick[_liquidity].difference : -_tick[_liquidity].difference;\n _quote = IKeep3rHelper(keep3rHelper).getKP3RsAtTick(_amount, _tickDifference, rewardPeriodTime);\n }\n }\n\n /// @notice Updates job credits to current quotes and rewards job's pending minted credits\n /// @dev Ensures a maximum of 1 period of credits\n function _settleJobAccountance(address _job) internal virtual {\n _updateJobCreditsIfNeeded(_job);\n _rewardJobCredits(_job);\n _jobLiquidityCredits[_job] = Math.min(_jobLiquidityCredits[_job], _jobPeriodCredits[_job]);\n }\n}\n" - }, - "solidity/contracts/peripherals/Keep3rDisputable.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport './Keep3rParameters.sol';\nimport './Keep3rRoles.sol';\nimport '../../interfaces/peripherals/IKeep3rDisputable.sol';\n\nabstract contract Keep3rDisputable is IKeep3rDisputable, Keep3rAccountance, Keep3rRoles {\n /// @inheritdoc IKeep3rDisputable\n function dispute(address _jobOrKeeper) external override onlyDisputer {\n if (disputes[_jobOrKeeper]) revert AlreadyDisputed();\n disputes[_jobOrKeeper] = true;\n emit Dispute(_jobOrKeeper, msg.sender);\n }\n\n /// @inheritdoc IKeep3rDisputable\n function resolve(address _jobOrKeeper) external override onlyDisputer {\n if (!disputes[_jobOrKeeper]) revert NotDisputed();\n disputes[_jobOrKeeper] = false;\n emit Resolve(_jobOrKeeper, msg.sender);\n }\n}\n" - }, - "solidity/contracts/peripherals/jobs/Keep3rJobOwnership.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../../../interfaces/peripherals/IKeep3rJobs.sol';\n\nabstract contract Keep3rJobOwnership is IKeep3rJobOwnership {\n /// @inheritdoc IKeep3rJobOwnership\n mapping(address => address) public override jobOwner;\n\n /// @inheritdoc IKeep3rJobOwnership\n mapping(address => address) public override jobPendingOwner;\n\n /// @inheritdoc IKeep3rJobOwnership\n function changeJobOwnership(address _job, address _newOwner) external override onlyJobOwner(_job) {\n jobPendingOwner[_job] = _newOwner;\n emit JobOwnershipChange(_job, jobOwner[_job], _newOwner);\n }\n\n /// @inheritdoc IKeep3rJobOwnership\n function acceptJobOwnership(address _job) external override onlyPendingJobOwner(_job) {\n address _previousOwner = jobOwner[_job];\n\n jobOwner[_job] = jobPendingOwner[_job];\n delete jobPendingOwner[_job];\n\n emit JobOwnershipAssent(msg.sender, _job, _previousOwner);\n }\n\n modifier onlyJobOwner(address _job) {\n if (msg.sender != jobOwner[_job]) revert OnlyJobOwner();\n _;\n }\n\n modifier onlyPendingJobOwner(address _job) {\n if (msg.sender != jobPendingOwner[_job]) revert OnlyPendingJobOwner();\n _;\n }\n}\n" - }, - "solidity/interfaces/peripherals/IKeep3rJobs.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\n/// @title Keep3rJobFundableCredits contract\n/// @notice Handles the addition and withdrawal of credits from a job\ninterface IKeep3rJobFundableCredits {\n // Events\n\n /// @notice Emitted when Keep3rJobFundableCredits#addTokenCreditsToJob is called\n /// @param _job The address of the job being credited\n /// @param _token The address of the token being provided\n /// @param _provider The user that calls the function\n /// @param _amount The amount of credit being added to the job\n event TokenCreditAddition(address indexed _job, address indexed _token, address indexed _provider, uint256 _amount);\n\n /// @notice Emitted when Keep3rJobFundableCredits#withdrawTokenCreditsFromJob is called\n /// @param _job The address of the job from which the credits are withdrawn\n /// @param _token The credit being withdrawn from the job\n /// @param _receiver The user that receives the tokens\n /// @param _amount The amount of credit withdrawn\n event TokenCreditWithdrawal(address indexed _job, address indexed _token, address indexed _receiver, uint256 _amount);\n\n // Errors\n\n /// @notice Throws when the token is KP3R, as it should not be used for direct token payments\n error TokenUnallowed();\n\n /// @notice Throws when the token withdraw cooldown has not yet passed\n error JobTokenCreditsLocked();\n\n /// @notice Throws when the user tries to withdraw more tokens than it has\n error InsufficientJobTokenCredits();\n\n // Variables\n\n /// @notice Last block where tokens were added to the job\n /// @param _job The address of the job credited\n /// @param _token The address of the token credited\n /// @return _timestamp The last block where tokens were added to the job\n function jobTokenCreditsAddedAt(address _job, address _token) external view returns (uint256 _timestamp);\n\n // Methods\n\n /// @notice Add credit to a job to be paid out for work\n /// @param _job The address of the job being credited\n /// @param _token The address of the token being credited\n /// @param _amount The amount of credit being added\n function addTokenCreditsToJob(\n address _job,\n address _token,\n uint256 _amount\n ) external;\n\n /// @notice Withdraw credit from a job\n /// @param _job The address of the job from which the credits are withdrawn\n /// @param _token The address of the token being withdrawn\n /// @param _amount The amount of token to be withdrawn\n /// @param _receiver The user that will receive tokens\n function withdrawTokenCreditsFromJob(\n address _job,\n address _token,\n uint256 _amount,\n address _receiver\n ) external;\n}\n\n/// @title Keep3rJobFundableLiquidity contract\n/// @notice Handles the funding of jobs through specific liquidity pairs\ninterface IKeep3rJobFundableLiquidity {\n // Events\n\n /// @notice Emitted when Keep3rJobFundableLiquidity#approveLiquidity function is called\n /// @param _liquidity The address of the liquidity pair being approved\n event LiquidityApproval(address _liquidity);\n\n /// @notice Emitted when Keep3rJobFundableLiquidity#revokeLiquidity function is called\n /// @param _liquidity The address of the liquidity pair being revoked\n event LiquidityRevocation(address _liquidity);\n\n /// @notice Emitted when IKeep3rJobFundableLiquidity#addLiquidityToJob function is called\n /// @param _job The address of the job to which liquidity will be added\n /// @param _liquidity The address of the liquidity being added\n /// @param _provider The user that calls the function\n /// @param _amount The amount of liquidity being added\n event LiquidityAddition(address indexed _job, address indexed _liquidity, address indexed _provider, uint256 _amount);\n\n /// @notice Emitted when IKeep3rJobFundableLiquidity#withdrawLiquidityFromJob function is called\n /// @param _job The address of the job of which liquidity will be withdrawn from\n /// @param _liquidity The address of the liquidity being withdrawn\n /// @param _receiver The receiver of the liquidity tokens\n /// @param _amount The amount of liquidity being withdrawn from the job\n event LiquidityWithdrawal(address indexed _job, address indexed _liquidity, address indexed _receiver, uint256 _amount);\n\n /// @notice Emitted when Keep3rJobFundableLiquidity#addLiquidityToJob function is called\n /// @param _job The address of the job whose credits will be updated\n /// @param _rewardedAt The time at which the job was last rewarded\n /// @param _currentCredits The current credits of the job\n /// @param _periodCredits The credits of the job for the current period\n event LiquidityCreditsReward(address indexed _job, uint256 _rewardedAt, uint256 _currentCredits, uint256 _periodCredits);\n\n /// @notice Emitted when Keep3rJobFundableLiquidity#forceLiquidityCreditsToJob function is called\n /// @param _job The address of the job whose credits will be updated\n /// @param _rewardedAt The time at which the job was last rewarded\n /// @param _currentCredits The current credits of the job\n event LiquidityCreditsForced(address indexed _job, uint256 _rewardedAt, uint256 _currentCredits);\n\n // Errors\n\n /// @notice Throws when the liquidity being approved has already been approved\n error LiquidityPairApproved();\n\n /// @notice Throws when the liquidity being removed has not been approved\n error LiquidityPairUnexistent();\n\n /// @notice Throws when trying to add liquidity to an unapproved pool\n error LiquidityPairUnapproved();\n\n /// @notice Throws when the job doesn't have the requested liquidity\n error JobLiquidityUnexistent();\n\n /// @notice Throws when trying to remove more liquidity than the job has\n error JobLiquidityInsufficient();\n\n /// @notice Throws when trying to add less liquidity than the minimum liquidity required\n error JobLiquidityLessThanMin();\n\n // Structs\n\n /// @notice Stores the tick information of the different liquidity pairs\n struct TickCache {\n int56 current; // Tracks the current tick\n int56 difference; // Stores the difference between the current tick and the last tick\n uint256 period; // Stores the period at which the last observation was made\n }\n\n // Variables\n\n /// @notice Lists liquidity pairs\n /// @return _list An array of addresses with all the approved liquidity pairs\n function approvedLiquidities() external view returns (address[] memory _list);\n\n /// @notice Amount of liquidity in a specified job\n /// @param _job The address of the job being checked\n /// @param _liquidity The address of the liquidity we are checking\n /// @return _amount Amount of liquidity in the specified job\n function liquidityAmount(address _job, address _liquidity) external view returns (uint256 _amount);\n\n /// @notice Last time the job was rewarded liquidity credits\n /// @param _job The address of the job being checked\n /// @return _timestamp Timestamp of the last time the job was rewarded liquidity credits\n function rewardedAt(address _job) external view returns (uint256 _timestamp);\n\n /// @notice Last time the job was worked\n /// @param _job The address of the job being checked\n /// @return _timestamp Timestamp of the last time the job was worked\n function workedAt(address _job) external view returns (uint256 _timestamp);\n\n // Methods\n\n /// @notice Returns the liquidity credits of a given job\n /// @param _job The address of the job of which we want to know the liquidity credits\n /// @return _amount The liquidity credits of a given job\n function jobLiquidityCredits(address _job) external view returns (uint256 _amount);\n\n /// @notice Returns the credits of a given job for the current period\n /// @param _job The address of the job of which we want to know the period credits\n /// @return _amount The credits the given job has at the current period\n function jobPeriodCredits(address _job) external view returns (uint256 _amount);\n\n /// @notice Calculates the total credits of a given job\n /// @param _job The address of the job of which we want to know the total credits\n /// @return _amount The total credits of the given job\n function totalJobCredits(address _job) external view returns (uint256 _amount);\n\n /// @notice Calculates how many credits should be rewarded periodically for a given liquidity amount\n /// @dev _periodCredits = underlying KP3Rs for given liquidity amount * rewardPeriod / inflationPeriod\n /// @param _liquidity The address of the liquidity to provide\n /// @param _amount The amount of liquidity to provide\n /// @return _periodCredits The amount of KP3R periodically minted for the given liquidity\n function quoteLiquidity(address _liquidity, uint256 _amount) external view returns (uint256 _periodCredits);\n\n /// @notice Observes the current state of the liquidity pair being observed and updates TickCache with the information\n /// @param _liquidity The address of the liquidity pair being observed\n /// @return _tickCache The updated TickCache\n function observeLiquidity(address _liquidity) external view returns (TickCache memory _tickCache);\n\n /// @notice Gifts liquidity credits to the specified job\n /// @param _job The address of the job being credited\n /// @param _amount The amount of liquidity credits to gift\n function forceLiquidityCreditsToJob(address _job, uint256 _amount) external;\n\n /// @notice Approve a liquidity pair for being accepted in future\n /// @param _liquidity The address of the liquidity accepted\n function approveLiquidity(address _liquidity) external;\n\n /// @notice Revoke a liquidity pair from being accepted in future\n /// @param _liquidity The liquidity no longer accepted\n function revokeLiquidity(address _liquidity) external;\n\n /// @notice Allows anyone to fund a job with liquidity\n /// @param _job The address of the job to assign liquidity to\n /// @param _liquidity The liquidity being added\n /// @param _amount The amount of liquidity tokens to add\n function addLiquidityToJob(\n address _job,\n address _liquidity,\n uint256 _amount\n ) external;\n\n /// @notice Unbond liquidity for a job\n /// @dev Can only be called by the job's owner\n /// @param _job The address of the job being unbonded from\n /// @param _liquidity The liquidity being unbonded\n /// @param _amount The amount of liquidity being removed\n function unbondLiquidityFromJob(\n address _job,\n address _liquidity,\n uint256 _amount\n ) external;\n\n /// @notice Withdraw liquidity from a job\n /// @param _job The address of the job being withdrawn from\n /// @param _liquidity The liquidity being withdrawn\n /// @param _receiver The address that will receive the withdrawn liquidity\n function withdrawLiquidityFromJob(\n address _job,\n address _liquidity,\n address _receiver\n ) external;\n}\n\n/// @title Keep3rJobManager contract\n/// @notice Handles the addition and withdrawal of credits from a job\ninterface IKeep3rJobManager {\n // Events\n\n /// @notice Emitted when Keep3rJobManager#addJob is called\n /// @param _job The address of the job to add\n /// @param _jobOwner The job's owner\n event JobAddition(address indexed _job, address indexed _jobOwner);\n\n // Errors\n\n /// @notice Throws when trying to add a job that has already been added\n error JobAlreadyAdded();\n\n /// @notice Throws when the address that is trying to register as a keeper is already a keeper\n error AlreadyAKeeper();\n\n // Methods\n\n /// @notice Allows any caller to add a new job\n /// @param _job Address of the contract for which work should be performed\n function addJob(address _job) external;\n}\n\n/// @title Keep3rJobWorkable contract\n/// @notice Handles the mechanisms jobs can pay keepers with along with the restrictions jobs can put on keepers before they can work on jobs\ninterface IKeep3rJobWorkable {\n // Events\n\n /// @notice Emitted when a keeper is validated before a job\n /// @param _gasLeft The amount of gas that the transaction has left at the moment of keeper validation\n event KeeperValidation(uint256 _gasLeft);\n\n /// @notice Emitted when a keeper works a job\n /// @param _credit The address of the asset in which the keeper is paid\n /// @param _job The address of the job the keeper has worked\n /// @param _keeper The address of the keeper that has worked the job\n /// @param _payment The amount that has been paid out to the keeper in exchange for working the job\n /// @param _gasLeft The amount of gas that the transaction has left at the moment of payment\n event KeeperWork(address indexed _credit, address indexed _job, address indexed _keeper, uint256 _payment, uint256 _gasLeft);\n\n // Errors\n\n /// @notice Throws if the address claiming to be a job is not in the list of approved jobs\n error JobUnapproved();\n\n /// @notice Throws if the amount of funds in the job is less than the payment that must be paid to the keeper that works that job\n error InsufficientFunds();\n\n // Methods\n\n /// @notice Confirms if the current keeper is registered\n /// @dev Can be used for general (non critical) functions\n /// @param _keeper The keeper being investigated\n /// @return _isKeeper Whether the address passed as a parameter is a keeper or not\n function isKeeper(address _keeper) external returns (bool _isKeeper);\n\n /// @notice Confirms if the current keeper is registered and has a minimum bond of any asset.\n /// @dev Should be used for protected functions\n /// @param _keeper The keeper to check\n /// @param _bond The bond token being evaluated\n /// @param _minBond The minimum amount of bonded tokens\n /// @param _earned The minimum funds earned in the keepers lifetime\n /// @param _age The minimum keeper age required\n /// @return _isBondedKeeper Whether the `_keeper` meets the given requirements\n function isBondedKeeper(\n address _keeper,\n address _bond,\n uint256 _minBond,\n uint256 _earned,\n uint256 _age\n ) external returns (bool _isBondedKeeper);\n\n /// @notice Implemented by jobs to show that a keeper performed work\n /// @dev Automatically calculates the payment for the keeper and pays the keeper with bonded KP3R\n /// @param _keeper Address of the keeper that performed the work\n function worked(address _keeper) external;\n\n /// @notice Implemented by jobs to show that a keeper performed work\n /// @dev Pays the keeper that performs the work with KP3R\n /// @param _keeper Address of the keeper that performed the work\n /// @param _payment The reward that should be allocated for the job\n function bondedPayment(address _keeper, uint256 _payment) external;\n\n /// @notice Implemented by jobs to show that a keeper performed work\n /// @dev Pays the keeper that performs the work with a specific token\n /// @param _token The asset being awarded to the keeper\n /// @param _keeper Address of the keeper that performed the work\n /// @param _amount The reward that should be allocated\n function directTokenPayment(\n address _token,\n address _keeper,\n uint256 _amount\n ) external;\n}\n\n/// @title Keep3rJobOwnership contract\n/// @notice Handles the ownership of the jobs\ninterface IKeep3rJobOwnership {\n // Events\n\n /// @notice Emitted when Keep3rJobOwnership#changeJobOwnership is called\n /// @param _job The address of the job proposed to have a change of owner\n /// @param _owner The current owner of the job\n /// @param _pendingOwner The new address proposed to be the owner of the job\n event JobOwnershipChange(address indexed _job, address indexed _owner, address indexed _pendingOwner);\n\n /// @notice Emitted when Keep3rJobOwnership#JobOwnershipAssent is called\n /// @param _job The address of the job which the proposed owner will now own\n /// @param _previousOwner The previous owner of the job\n /// @param _newOwner The new owner of the job\n event JobOwnershipAssent(address indexed _job, address indexed _previousOwner, address indexed _newOwner);\n\n // Errors\n\n /// @notice Throws when the caller of the function is not the job owner\n error OnlyJobOwner();\n\n /// @notice Throws when the caller of the function is not the pending job owner\n error OnlyPendingJobOwner();\n\n // Variables\n\n /// @notice Maps the job to the owner of the job\n /// @param _job The address of the job\n /// @return _owner The address of the owner of the job\n function jobOwner(address _job) external view returns (address _owner);\n\n /// @notice Maps the job to its pending owner\n /// @param _job The address of the job\n /// @return _pendingOwner The address of the pending owner of the job\n function jobPendingOwner(address _job) external view returns (address _pendingOwner);\n\n // Methods\n\n /// @notice Proposes a new address to be the owner of the job\n /// @param _job The address of the job\n /// @param _newOwner The address of the proposed new owner\n function changeJobOwnership(address _job, address _newOwner) external;\n\n /// @notice The proposed address accepts to be the owner of the job\n /// @param _job The address of the job\n function acceptJobOwnership(address _job) external;\n}\n\n/// @title Keep3rJobMigration contract\n/// @notice Handles the migration process of jobs to different addresses\ninterface IKeep3rJobMigration {\n // Events\n\n /// @notice Emitted when Keep3rJobMigration#migrateJob function is called\n /// @param _fromJob The address of the job that requests to migrate\n /// @param _toJob The address at which the job requests to migrate\n event JobMigrationRequested(address indexed _fromJob, address _toJob);\n\n /// @notice Emitted when Keep3rJobMigration#acceptJobMigration function is called\n /// @param _fromJob The address of the job that requested to migrate\n /// @param _toJob The address at which the job had requested to migrate\n event JobMigrationSuccessful(address _fromJob, address indexed _toJob);\n\n // Errors\n\n /// @notice Throws when the address of the job that requests to migrate wants to migrate to its same address\n error JobMigrationImpossible();\n\n /// @notice Throws when the _toJob address differs from the address being tracked in the pendingJobMigrations mapping\n error JobMigrationUnavailable();\n\n /// @notice Throws when cooldown between migrations has not yet passed\n error JobMigrationLocked();\n\n // Variables\n\n /// @notice Maps the jobs that have requested a migration to the address they have requested to migrate to\n /// @return _toJob The address to which the job has requested to migrate to\n function pendingJobMigrations(address _fromJob) external view returns (address _toJob);\n\n // Methods\n\n /// @notice Initializes the migration process for a job by adding the request to the pendingJobMigrations mapping\n /// @param _fromJob The address of the job that is requesting to migrate\n /// @param _toJob The address at which the job is requesting to migrate\n function migrateJob(address _fromJob, address _toJob) external;\n\n /// @notice Completes the migration process for a job\n /// @dev Unbond/withdraw process doesn't get migrated\n /// @param _fromJob The address of the job that requested to migrate\n /// @param _toJob The address to which the job wants to migrate to\n function acceptJobMigration(address _fromJob, address _toJob) external;\n}\n\n/// @title Keep3rJobDisputable contract\n/// @notice Handles the actions that can be taken on a disputed job\ninterface IKeep3rJobDisputable is IKeep3rJobFundableCredits, IKeep3rJobFundableLiquidity {\n // Events\n\n /// @notice Emitted when Keep3rJobDisputable#slashTokenFromJob is called\n /// @param _job The address of the job from which the token will be slashed\n /// @param _token The address of the token being slashed\n /// @param _slasher The user that slashes the token\n /// @param _amount The amount of the token being slashed\n event JobSlashToken(address indexed _job, address _token, address indexed _slasher, uint256 _amount);\n\n /// @notice Emitted when Keep3rJobDisputable#slashLiquidityFromJob is called\n /// @param _job The address of the job from which the liquidity will be slashed\n /// @param _liquidity The address of the liquidity being slashed\n /// @param _slasher The user that slashes the liquidity\n /// @param _amount The amount of the liquidity being slashed\n event JobSlashLiquidity(address indexed _job, address _liquidity, address indexed _slasher, uint256 _amount);\n\n // Errors\n\n /// @notice Throws when the token trying to be slashed doesn't exist\n error JobTokenUnexistent();\n\n /// @notice Throws when someone tries to slash more tokens than the job has\n error JobTokenInsufficient();\n\n // Methods\n\n /// @notice Allows governance or slasher to slash a job specific token\n /// @param _job The address of the job from which the token will be slashed\n /// @param _token The address of the token that will be slashed\n /// @param _amount The amount of the token that will be slashed\n function slashTokenFromJob(\n address _job,\n address _token,\n uint256 _amount\n ) external;\n\n /// @notice Allows governance or a slasher to slash liquidity from a job\n /// @param _job The address being slashed\n /// @param _liquidity The address of the liquidity that will be slashed\n /// @param _amount The amount of liquidity that will be slashed\n function slashLiquidityFromJob(\n address _job,\n address _liquidity,\n uint256 _amount\n ) external;\n}\n\n// solhint-disable-next-line no-empty-blocks\ninterface IKeep3rJobs is IKeep3rJobOwnership, IKeep3rJobDisputable, IKeep3rJobMigration, IKeep3rJobManager, IKeep3rJobWorkable {\n\n}\n" - }, - "@openzeppelin/contracts/security/ReentrancyGuard.sol": { - "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Contract module that helps prevent reentrant calls to a function.\n *\n * Inheriting from `ReentrancyGuard` will make the {nonReentrant} modifier\n * available, which can be applied to functions to make sure there are no nested\n * (reentrant) calls to them.\n *\n * Note that because there is a single `nonReentrant` guard, functions marked as\n * `nonReentrant` may not call one another. This can be worked around by making\n * those functions `private`, and then adding `external` `nonReentrant` entry\n * points to them.\n *\n * TIP: If you would like to learn more about reentrancy and alternative ways\n * to protect against it, check out our blog post\n * https://blog.openzeppelin.com/reentrancy-after-istanbul/[Reentrancy After Istanbul].\n */\nabstract contract ReentrancyGuard {\n // Booleans are more expensive than uint256 or any type that takes up a full\n // word because each write operation emits an extra SLOAD to first read the\n // slot's contents, replace the bits taken up by the boolean, and then write\n // back. This is the compiler's defense against contract upgrades and\n // pointer aliasing, and it cannot be disabled.\n\n // The values being non-zero value makes deployment a bit more expensive,\n // but in exchange the refund on every call to nonReentrant will be lower in\n // amount. Since refunds are capped to a percentage of the total\n // transaction's gas, it is best to keep them low in cases like this one, to\n // increase the likelihood of the full refund coming into effect.\n uint256 private constant _NOT_ENTERED = 1;\n uint256 private constant _ENTERED = 2;\n\n uint256 private _status;\n\n constructor() {\n _status = _NOT_ENTERED;\n }\n\n /**\n * @dev Prevents a contract from calling itself, directly or indirectly.\n * Calling a `nonReentrant` function from another `nonReentrant`\n * function is not supported. It is possible to prevent this from happening\n * by making the `nonReentrant` function external, and make it call a\n * `private` function that does the actual work.\n */\n modifier nonReentrant() {\n // On the first call to nonReentrant, _notEntered will be true\n require(_status != _ENTERED, \"ReentrancyGuard: reentrant call\");\n\n // Any calls to nonReentrant after this point will fail\n _status = _ENTERED;\n\n _;\n\n // By storing the original value once again, a refund is triggered (see\n // https://eips.ethereum.org/EIPS/eip-2200)\n _status = _NOT_ENTERED;\n }\n}\n" - }, - "@openzeppelin/contracts/token/ERC20/IERC20.sol": { - "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Interface of the ERC20 standard as defined in the EIP.\n */\ninterface IERC20 {\n /**\n * @dev Returns the amount of tokens in existence.\n */\n function totalSupply() external view returns (uint256);\n\n /**\n * @dev Returns the amount of tokens owned by `account`.\n */\n function balanceOf(address account) external view returns (uint256);\n\n /**\n * @dev Moves `amount` tokens from the caller's account to `recipient`.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * Emits a {Transfer} event.\n */\n function transfer(address recipient, uint256 amount) external returns (bool);\n\n /**\n * @dev Returns the remaining number of tokens that `spender` will be\n * allowed to spend on behalf of `owner` through {transferFrom}. This is\n * zero by default.\n *\n * This value changes when {approve} or {transferFrom} are called.\n */\n function allowance(address owner, address spender) external view returns (uint256);\n\n /**\n * @dev Sets `amount` as the allowance of `spender` over the caller's tokens.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * IMPORTANT: Beware that changing an allowance with this method brings the risk\n * that someone may use both the old and the new allowance by unfortunate\n * transaction ordering. One possible solution to mitigate this race\n * condition is to first reduce the spender's allowance to 0 and set the\n * desired value afterwards:\n * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729\n *\n * Emits an {Approval} event.\n */\n function approve(address spender, uint256 amount) external returns (bool);\n\n /**\n * @dev Moves `amount` tokens from `sender` to `recipient` using the\n * allowance mechanism. `amount` is then deducted from the caller's\n * allowance.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * Emits a {Transfer} event.\n */\n function transferFrom(\n address sender,\n address recipient,\n uint256 amount\n ) external returns (bool);\n\n /**\n * @dev Emitted when `value` tokens are moved from one account (`from`) to\n * another (`to`).\n *\n * Note that `value` may be zero.\n */\n event Transfer(address indexed from, address indexed to, uint256 value);\n\n /**\n * @dev Emitted when the allowance of a `spender` for an `owner` is set by\n * a call to {approve}. `value` is the new allowance.\n */\n event Approval(address indexed owner, address indexed spender, uint256 value);\n}\n" - }, - "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol": { - "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\nimport \"../IERC20.sol\";\nimport \"../../../utils/Address.sol\";\n\n/**\n * @title SafeERC20\n * @dev Wrappers around ERC20 operations that throw on failure (when the token\n * contract returns false). Tokens that return no value (and instead revert or\n * throw on failure) are also supported, non-reverting calls are assumed to be\n * successful.\n * To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract,\n * which allows you to call the safe operations as `token.safeTransfer(...)`, etc.\n */\nlibrary SafeERC20 {\n using Address for address;\n\n function safeTransfer(\n IERC20 token,\n address to,\n uint256 value\n ) internal {\n _callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value));\n }\n\n function safeTransferFrom(\n IERC20 token,\n address from,\n address to,\n uint256 value\n ) internal {\n _callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value));\n }\n\n /**\n * @dev Deprecated. This function has issues similar to the ones found in\n * {IERC20-approve}, and its usage is discouraged.\n *\n * Whenever possible, use {safeIncreaseAllowance} and\n * {safeDecreaseAllowance} instead.\n */\n function safeApprove(\n IERC20 token,\n address spender,\n uint256 value\n ) internal {\n // safeApprove should only be called when setting an initial allowance,\n // or when resetting it to zero. To increase and decrease it, use\n // 'safeIncreaseAllowance' and 'safeDecreaseAllowance'\n require(\n (value == 0) || (token.allowance(address(this), spender) == 0),\n \"SafeERC20: approve from non-zero to non-zero allowance\"\n );\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value));\n }\n\n function safeIncreaseAllowance(\n IERC20 token,\n address spender,\n uint256 value\n ) internal {\n uint256 newAllowance = token.allowance(address(this), spender) + value;\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));\n }\n\n function safeDecreaseAllowance(\n IERC20 token,\n address spender,\n uint256 value\n ) internal {\n unchecked {\n uint256 oldAllowance = token.allowance(address(this), spender);\n require(oldAllowance >= value, \"SafeERC20: decreased allowance below zero\");\n uint256 newAllowance = oldAllowance - value;\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));\n }\n }\n\n /**\n * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement\n * on the return value: the return value is optional (but if data is returned, it must not be false).\n * @param token The token targeted by the call.\n * @param data The call data (encoded using abi.encode or one of its variants).\n */\n function _callOptionalReturn(IERC20 token, bytes memory data) private {\n // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since\n // we're implementing it ourselves. We use {Address.functionCall} to perform this call, which verifies that\n // the target address contains contract code and also asserts for success in the low-level call.\n\n bytes memory returndata = address(token).functionCall(data, \"SafeERC20: low-level call failed\");\n if (returndata.length > 0) {\n // Return data is optional\n require(abi.decode(returndata, (bool)), \"SafeERC20: ERC20 operation did not succeed\");\n }\n }\n}\n" - }, - "@openzeppelin/contracts/utils/math/Math.sol": { - "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Standard math utilities missing in the Solidity language.\n */\nlibrary Math {\n /**\n * @dev Returns the largest of two numbers.\n */\n function max(uint256 a, uint256 b) internal pure returns (uint256) {\n return a >= b ? a : b;\n }\n\n /**\n * @dev Returns the smallest of two numbers.\n */\n function min(uint256 a, uint256 b) internal pure returns (uint256) {\n return a < b ? a : b;\n }\n\n /**\n * @dev Returns the average of two numbers. The result is rounded towards\n * zero.\n */\n function average(uint256 a, uint256 b) internal pure returns (uint256) {\n // (a + b) / 2 can overflow.\n return (a & b) + (a ^ b) / 2;\n }\n\n /**\n * @dev Returns the ceiling of the division of two numbers.\n *\n * This differs from standard division with `/` in that it rounds up instead\n * of rounding down.\n */\n function ceilDiv(uint256 a, uint256 b) internal pure returns (uint256) {\n // (a + b - 1) / b can overflow on addition, so we distribute.\n return a / b + (a % b == 0 ? 0 : 1);\n }\n}\n" - }, - "@openzeppelin/contracts/utils/structs/EnumerableSet.sol": { - "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Library for managing\n * https://en.wikipedia.org/wiki/Set_(abstract_data_type)[sets] of primitive\n * types.\n *\n * Sets have the following properties:\n *\n * - Elements are added, removed, and checked for existence in constant time\n * (O(1)).\n * - Elements are enumerated in O(n). No guarantees are made on the ordering.\n *\n * ```\n * contract Example {\n * // Add the library methods\n * using EnumerableSet for EnumerableSet.AddressSet;\n *\n * // Declare a set state variable\n * EnumerableSet.AddressSet private mySet;\n * }\n * ```\n *\n * As of v3.3.0, sets of type `bytes32` (`Bytes32Set`), `address` (`AddressSet`)\n * and `uint256` (`UintSet`) are supported.\n */\nlibrary EnumerableSet {\n // To implement this library for multiple types with as little code\n // repetition as possible, we write it in terms of a generic Set type with\n // bytes32 values.\n // The Set implementation uses private functions, and user-facing\n // implementations (such as AddressSet) are just wrappers around the\n // underlying Set.\n // This means that we can only create new EnumerableSets for types that fit\n // in bytes32.\n\n struct Set {\n // Storage of set values\n bytes32[] _values;\n // Position of the value in the `values` array, plus 1 because index 0\n // means a value is not in the set.\n mapping(bytes32 => uint256) _indexes;\n }\n\n /**\n * @dev Add a value to a set. O(1).\n *\n * Returns true if the value was added to the set, that is if it was not\n * already present.\n */\n function _add(Set storage set, bytes32 value) private returns (bool) {\n if (!_contains(set, value)) {\n set._values.push(value);\n // The value is stored at length-1, but we add 1 to all indexes\n // and use 0 as a sentinel value\n set._indexes[value] = set._values.length;\n return true;\n } else {\n return false;\n }\n }\n\n /**\n * @dev Removes a value from a set. O(1).\n *\n * Returns true if the value was removed from the set, that is if it was\n * present.\n */\n function _remove(Set storage set, bytes32 value) private returns (bool) {\n // We read and store the value's index to prevent multiple reads from the same storage slot\n uint256 valueIndex = set._indexes[value];\n\n if (valueIndex != 0) {\n // Equivalent to contains(set, value)\n // To delete an element from the _values array in O(1), we swap the element to delete with the last one in\n // the array, and then remove the last element (sometimes called as 'swap and pop').\n // This modifies the order of the array, as noted in {at}.\n\n uint256 toDeleteIndex = valueIndex - 1;\n uint256 lastIndex = set._values.length - 1;\n\n if (lastIndex != toDeleteIndex) {\n bytes32 lastvalue = set._values[lastIndex];\n\n // Move the last value to the index where the value to delete is\n set._values[toDeleteIndex] = lastvalue;\n // Update the index for the moved value\n set._indexes[lastvalue] = valueIndex; // Replace lastvalue's index to valueIndex\n }\n\n // Delete the slot where the moved value was stored\n set._values.pop();\n\n // Delete the index for the deleted slot\n delete set._indexes[value];\n\n return true;\n } else {\n return false;\n }\n }\n\n /**\n * @dev Returns true if the value is in the set. O(1).\n */\n function _contains(Set storage set, bytes32 value) private view returns (bool) {\n return set._indexes[value] != 0;\n }\n\n /**\n * @dev Returns the number of values on the set. O(1).\n */\n function _length(Set storage set) private view returns (uint256) {\n return set._values.length;\n }\n\n /**\n * @dev Returns the value stored at position `index` in the set. O(1).\n *\n * Note that there are no guarantees on the ordering of values inside the\n * array, and it may change when more values are added or removed.\n *\n * Requirements:\n *\n * - `index` must be strictly less than {length}.\n */\n function _at(Set storage set, uint256 index) private view returns (bytes32) {\n return set._values[index];\n }\n\n /**\n * @dev Return the entire set in an array\n *\n * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed\n * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that\n * this function has an unbounded cost, and using it as part of a state-changing function may render the function\n * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.\n */\n function _values(Set storage set) private view returns (bytes32[] memory) {\n return set._values;\n }\n\n // Bytes32Set\n\n struct Bytes32Set {\n Set _inner;\n }\n\n /**\n * @dev Add a value to a set. O(1).\n *\n * Returns true if the value was added to the set, that is if it was not\n * already present.\n */\n function add(Bytes32Set storage set, bytes32 value) internal returns (bool) {\n return _add(set._inner, value);\n }\n\n /**\n * @dev Removes a value from a set. O(1).\n *\n * Returns true if the value was removed from the set, that is if it was\n * present.\n */\n function remove(Bytes32Set storage set, bytes32 value) internal returns (bool) {\n return _remove(set._inner, value);\n }\n\n /**\n * @dev Returns true if the value is in the set. O(1).\n */\n function contains(Bytes32Set storage set, bytes32 value) internal view returns (bool) {\n return _contains(set._inner, value);\n }\n\n /**\n * @dev Returns the number of values in the set. O(1).\n */\n function length(Bytes32Set storage set) internal view returns (uint256) {\n return _length(set._inner);\n }\n\n /**\n * @dev Returns the value stored at position `index` in the set. O(1).\n *\n * Note that there are no guarantees on the ordering of values inside the\n * array, and it may change when more values are added or removed.\n *\n * Requirements:\n *\n * - `index` must be strictly less than {length}.\n */\n function at(Bytes32Set storage set, uint256 index) internal view returns (bytes32) {\n return _at(set._inner, index);\n }\n\n /**\n * @dev Return the entire set in an array\n *\n * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed\n * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that\n * this function has an unbounded cost, and using it as part of a state-changing function may render the function\n * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.\n */\n function values(Bytes32Set storage set) internal view returns (bytes32[] memory) {\n return _values(set._inner);\n }\n\n // AddressSet\n\n struct AddressSet {\n Set _inner;\n }\n\n /**\n * @dev Add a value to a set. O(1).\n *\n * Returns true if the value was added to the set, that is if it was not\n * already present.\n */\n function add(AddressSet storage set, address value) internal returns (bool) {\n return _add(set._inner, bytes32(uint256(uint160(value))));\n }\n\n /**\n * @dev Removes a value from a set. O(1).\n *\n * Returns true if the value was removed from the set, that is if it was\n * present.\n */\n function remove(AddressSet storage set, address value) internal returns (bool) {\n return _remove(set._inner, bytes32(uint256(uint160(value))));\n }\n\n /**\n * @dev Returns true if the value is in the set. O(1).\n */\n function contains(AddressSet storage set, address value) internal view returns (bool) {\n return _contains(set._inner, bytes32(uint256(uint160(value))));\n }\n\n /**\n * @dev Returns the number of values in the set. O(1).\n */\n function length(AddressSet storage set) internal view returns (uint256) {\n return _length(set._inner);\n }\n\n /**\n * @dev Returns the value stored at position `index` in the set. O(1).\n *\n * Note that there are no guarantees on the ordering of values inside the\n * array, and it may change when more values are added or removed.\n *\n * Requirements:\n *\n * - `index` must be strictly less than {length}.\n */\n function at(AddressSet storage set, uint256 index) internal view returns (address) {\n return address(uint160(uint256(_at(set._inner, index))));\n }\n\n /**\n * @dev Return the entire set in an array\n *\n * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed\n * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that\n * this function has an unbounded cost, and using it as part of a state-changing function may render the function\n * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.\n */\n function values(AddressSet storage set) internal view returns (address[] memory) {\n bytes32[] memory store = _values(set._inner);\n address[] memory result;\n\n assembly {\n result := store\n }\n\n return result;\n }\n\n // UintSet\n\n struct UintSet {\n Set _inner;\n }\n\n /**\n * @dev Add a value to a set. O(1).\n *\n * Returns true if the value was added to the set, that is if it was not\n * already present.\n */\n function add(UintSet storage set, uint256 value) internal returns (bool) {\n return _add(set._inner, bytes32(value));\n }\n\n /**\n * @dev Removes a value from a set. O(1).\n *\n * Returns true if the value was removed from the set, that is if it was\n * present.\n */\n function remove(UintSet storage set, uint256 value) internal returns (bool) {\n return _remove(set._inner, bytes32(value));\n }\n\n /**\n * @dev Returns true if the value is in the set. O(1).\n */\n function contains(UintSet storage set, uint256 value) internal view returns (bool) {\n return _contains(set._inner, bytes32(value));\n }\n\n /**\n * @dev Returns the number of values on the set. O(1).\n */\n function length(UintSet storage set) internal view returns (uint256) {\n return _length(set._inner);\n }\n\n /**\n * @dev Returns the value stored at position `index` in the set. O(1).\n *\n * Note that there are no guarantees on the ordering of values inside the\n * array, and it may change when more values are added or removed.\n *\n * Requirements:\n *\n * - `index` must be strictly less than {length}.\n */\n function at(UintSet storage set, uint256 index) internal view returns (uint256) {\n return uint256(_at(set._inner, index));\n }\n\n /**\n * @dev Return the entire set in an array\n *\n * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed\n * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that\n * this function has an unbounded cost, and using it as part of a state-changing function may render the function\n * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.\n */\n function values(UintSet storage set) internal view returns (uint256[] memory) {\n bytes32[] memory store = _values(set._inner);\n uint256[] memory result;\n\n assembly {\n result := store\n }\n\n return result;\n }\n}\n" - }, - "solidity/interfaces/peripherals/IKeep3rAccountance.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\n/// @title Keep3rDisputable contract\n/// @notice Disputes keepers, or if they're already disputed, it can resolve the case\n/// @dev Argument `bonding` can be the address of either a token or a liquidity\ninterface IKeep3rAccountance {\n // Events\n\n /// @notice Emitted when the bonding process of a new keeper begins\n /// @param _keeper The caller of Keep3rKeeperFundable#bond function\n /// @param _bonding The asset the keeper has bonded\n /// @param _amount The amount the keeper has bonded\n event Bonding(address indexed _keeper, address indexed _bonding, uint256 _amount);\n\n /// @notice Emitted when a keeper or job begins the unbonding process to withdraw the funds\n /// @param _keeperOrJob The keeper or job that began the unbonding process\n /// @param _unbonding The liquidity pair or asset being unbonded\n /// @param _amount The amount being unbonded\n event Unbonding(address indexed _keeperOrJob, address indexed _unbonding, uint256 _amount);\n\n // Variables\n\n /// @notice Tracks the total KP3R earnings of a keeper since it started working\n /// @param _keeper The address of the keeper\n /// @return _workCompleted Total KP3R earnings of a keeper since it started working\n function workCompleted(address _keeper) external view returns (uint256 _workCompleted);\n\n /// @notice Tracks when a keeper was first registered\n /// @param _keeper The address of the keeper\n /// @return timestamp The time at which the keeper was first registered\n function firstSeen(address _keeper) external view returns (uint256 timestamp);\n\n /// @notice Tracks if a keeper or job has a pending dispute\n /// @param _keeperOrJob The address of the keeper or job\n /// @return _disputed Whether a keeper or job has a pending dispute\n function disputes(address _keeperOrJob) external view returns (bool _disputed);\n\n /// @notice Tracks how much a keeper has bonded of a certain token\n /// @param _keeper The address of the keeper\n /// @param _bond The address of the token being bonded\n /// @return _bonds Amount of a certain token that a keeper has bonded\n function bonds(address _keeper, address _bond) external view returns (uint256 _bonds);\n\n /// @notice The current token credits available for a job\n /// @param _job The address of the job\n /// @param _token The address of the token bonded\n /// @return _amount The amount of token credits available for a job\n function jobTokenCredits(address _job, address _token) external view returns (uint256 _amount);\n\n /// @notice Tracks the amount of assets deposited in pending bonds\n /// @param _keeper The address of the keeper\n /// @param _bonding The address of the token being bonded\n /// @return _pendingBonds Amount of a certain asset a keeper has unbonding\n function pendingBonds(address _keeper, address _bonding) external view returns (uint256 _pendingBonds);\n\n /// @notice Tracks when a bonding for a keeper can be activated\n /// @param _keeper The address of the keeper\n /// @param _bonding The address of the token being bonded\n /// @return _timestamp Time at which the bonding for a keeper can be activated\n function canActivateAfter(address _keeper, address _bonding) external view returns (uint256 _timestamp);\n\n /// @notice Tracks when keeper bonds are ready to be withdrawn\n /// @param _keeper The address of the keeper\n /// @param _bonding The address of the token being unbonded\n /// @return _timestamp Time at which the keeper bonds are ready to be withdrawn\n function canWithdrawAfter(address _keeper, address _bonding) external view returns (uint256 _timestamp);\n\n /// @notice Tracks how much keeper bonds are to be withdrawn\n /// @param _keeper The address of the keeper\n /// @param _bonding The address of the token being unbonded\n /// @return _pendingUnbonds The amount of keeper bonds that are to be withdrawn\n function pendingUnbonds(address _keeper, address _bonding) external view returns (uint256 _pendingUnbonds);\n\n /// @notice Checks whether the address has ever bonded an asset\n /// @param _keeper The address of the keeper\n /// @return _hasBonded Whether the address has ever bonded an asset\n function hasBonded(address _keeper) external view returns (bool _hasBonded);\n\n // Methods\n\n /// @notice Lists all jobs\n /// @return _jobList Array with all the jobs in _jobs\n function jobs() external view returns (address[] memory _jobList);\n\n /// @notice Lists all keepers\n /// @return _keeperList Array with all the keepers in _keepers\n function keepers() external view returns (address[] memory _keeperList);\n\n // Errors\n\n /// @notice Throws when an address is passed as a job, but that address is not a job\n error JobUnavailable();\n\n /// @notice Throws when an action that requires an undisputed job is applied on a disputed job\n error JobDisputed();\n}\n" - }, - "solidity/interfaces/IKeep3rHelper.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\n/// @title Keep3rHelper contract\n/// @notice Contains all the helper functions used throughout the different files.\n\ninterface IKeep3rHelper {\n // Errors\n\n /// @notice Throws when none of the tokens in the liquidity pair is KP3R\n error LiquidityPairInvalid();\n\n // Methods\n // solhint-enable func-name-mixedcase\n\n /// @notice Calculates the amount of KP3R that corresponds to the ETH passed into the function\n /// @dev This function allows us to calculate how much KP3R we should pay to a keeper for things expressed in ETH, like gas\n /// @param _eth The amount of ETH\n /// @return _amountOut The amount of KP3R\n function quote(uint256 _eth) external view returns (uint256 _amountOut);\n\n /// @notice Returns the amount of KP3R the keeper has bonded\n /// @param _keeper The address of the keeper to check\n /// @return _amountBonded The amount of KP3R the keeper has bonded\n function bonds(address _keeper) external view returns (uint256 _amountBonded);\n\n /// @notice Calculates the reward (in KP3R) that corresponds to a keeper for using gas\n /// @param _keeper The address of the keeper to check\n /// @param _gasUsed The amount of gas used that will be rewarded\n /// @return _kp3r The amount of KP3R that should be awarded to the keeper\n function getRewardAmountFor(address _keeper, uint256 _gasUsed) external view returns (uint256 _kp3r);\n\n /// @notice Calculates the boost in the reward given to a keeper based on the amount of KP3R that keeper has bonded\n /// @param _bonds The amount of KP3R tokens bonded by the keeper\n /// @return _rewardBoost The reward boost that corresponds to the keeper\n function getRewardBoostFor(uint256 _bonds) external view returns (uint256 _rewardBoost);\n\n /// @notice Calculates the reward (in KP3R) that corresponds to tx.origin for using gas\n /// @param _gasUsed The amount of gas used that will be rewarded\n /// @return _amount The amount of KP3R that should be awarded to tx.origin\n function getRewardAmount(uint256 _gasUsed) external view returns (uint256 _amount);\n\n /// @notice Given a pool address, returns the underlying tokens of the pair\n /// @param _pool Address of the correspondant pool\n /// @return _token0 Address of the first token of the pair\n /// @return _token1 Address of the second token of the pair\n function getPoolTokens(address _pool) external view returns (address _token0, address _token1);\n\n /// @notice Defines the order of the tokens in the pair for twap calculations\n /// @param _pool Address of the correspondant pool\n /// @return _isKP3RToken0 Boolean indicating the order of the tokens in the pair\n function isKP3RToken0(address _pool) external view returns (bool _isKP3RToken0);\n\n /// @notice Given an array of secondsAgo, returns UniswapV3 pool cumulatives at that moment\n /// @param _pool Address of the pool to observe\n /// @param _secondsAgo Array with time references to observe\n /// @return _tickCumulative1 Cumulative sum of ticks until first time reference\n /// @return _tickCumulative2 Cumulative sum of ticks until second time reference\n /// @return _success Boolean indicating if the observe call was succesfull\n function observe(address _pool, uint32[] memory _secondsAgo)\n external\n view\n returns (\n int56 _tickCumulative1,\n int56 _tickCumulative2,\n bool _success\n );\n\n /// @notice Get multiplier, quote, and extra, in order to calculate keeper payment\n /// @param _bonds Amount of bonded KP3R owned by the keeper\n /// @return _boost Multiplier per gas unit. Takes into account the base fee and the amount of bonded KP3R\n /// @return _oneEthQuote Amount of KP3R tokens equivalent to 1 ETH\n /// @return _extra Amount of extra gas that should be added to the gas spent\n function getPaymentParams(uint256 _bonds)\n external\n view\n returns (\n uint256 _boost,\n uint256 _oneEthQuote,\n uint256 _extra\n );\n\n /// @notice Given a tick and a liquidity amount, calculates the underlying KP3R tokens\n /// @param _liquidityAmount Amount of liquidity to be converted\n /// @param _tickDifference Tick value used to calculate the quote\n /// @param _timeInterval Time value used to calculate the quote\n /// @return _kp3rAmount Amount of KP3R tokens underlying on the given liquidity\n function getKP3RsAtTick(\n uint256 _liquidityAmount,\n int56 _tickDifference,\n uint256 _timeInterval\n ) external pure returns (uint256 _kp3rAmount);\n\n /// @notice Given a tick and a token amount, calculates the output in correspondant token\n /// @param _baseAmount Amount of token to be converted\n /// @param _tickDifference Tick value used to calculate the quote\n /// @param _timeInterval Time value used to calculate the quote\n /// @return _quoteAmount Amount of credits deserved for the baseAmount at the tick value\n function getQuoteAtTick(\n uint128 _baseAmount,\n int56 _tickDifference,\n uint256 _timeInterval\n ) external pure returns (uint256 _quoteAmount);\n}\n" - }, - "solidity/interfaces/peripherals/IKeep3rParameters.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport './IBaseErrors.sol';\n\n/// @title Keep3rParameters contract\n/// @notice Handles and sets all the required parameters for Keep3r\n\ninterface IKeep3rParameters is IBaseErrors {\n // Events\n\n /// @notice Emitted when the Keep3rHelper address is changed\n /// @param _keep3rHelper The address of Keep3rHelper's contract\n event Keep3rHelperChange(address _keep3rHelper);\n\n /// @notice Emitted when the Keep3rV1 address is changed\n /// @param _keep3rV1 The address of Keep3rV1's contract\n event Keep3rV1Change(address _keep3rV1);\n\n /// @notice Emitted when the Keep3rV1Proxy address is changed\n /// @param _keep3rV1Proxy The address of Keep3rV1Proxy's contract\n event Keep3rV1ProxyChange(address _keep3rV1Proxy);\n\n /// @notice Emitted when bondTime is changed\n /// @param _bondTime The new bondTime\n event BondTimeChange(uint256 _bondTime);\n\n /// @notice Emitted when _liquidityMinimum is changed\n /// @param _liquidityMinimum The new _liquidityMinimum\n event LiquidityMinimumChange(uint256 _liquidityMinimum);\n\n /// @notice Emitted when _unbondTime is changed\n /// @param _unbondTime The new _unbondTime\n event UnbondTimeChange(uint256 _unbondTime);\n\n /// @notice Emitted when _rewardPeriodTime is changed\n /// @param _rewardPeriodTime The new _rewardPeriodTime\n event RewardPeriodTimeChange(uint256 _rewardPeriodTime);\n\n /// @notice Emitted when the inflationPeriod is changed\n /// @param _inflationPeriod The new inflationPeriod\n event InflationPeriodChange(uint256 _inflationPeriod);\n\n /// @notice Emitted when the fee is changed\n /// @param _fee The new token credits fee\n event FeeChange(uint256 _fee);\n\n // Variables\n\n /// @notice Address of Keep3rHelper's contract\n /// @return _keep3rHelper The address of Keep3rHelper's contract\n function keep3rHelper() external view returns (address _keep3rHelper);\n\n /// @notice Address of Keep3rV1's contract\n /// @return _keep3rV1 The address of Keep3rV1's contract\n function keep3rV1() external view returns (address _keep3rV1);\n\n /// @notice Address of Keep3rV1Proxy's contract\n /// @return _keep3rV1Proxy The address of Keep3rV1Proxy's contract\n function keep3rV1Proxy() external view returns (address _keep3rV1Proxy);\n\n /// @notice The amount of time required to pass after a keeper has bonded assets for it to be able to activate\n /// @return _days The required bondTime in days\n function bondTime() external view returns (uint256 _days);\n\n /// @notice The amount of time required to pass before a keeper can unbond what he has bonded\n /// @return _days The required unbondTime in days\n function unbondTime() external view returns (uint256 _days);\n\n /// @notice The minimum amount of liquidity required to fund a job per liquidity\n /// @return _amount The minimum amount of liquidity in KP3R\n function liquidityMinimum() external view returns (uint256 _amount);\n\n /// @notice The amount of time between each scheduled credits reward given to a job\n /// @return _days The reward period in days\n function rewardPeriodTime() external view returns (uint256 _days);\n\n /// @notice The inflation period is the denominator used to regulate the emission of KP3R\n /// @return _period The denominator used to regulate the emission of KP3R\n function inflationPeriod() external view returns (uint256 _period);\n\n /// @notice The fee to be sent to governance when a user adds liquidity to a job\n /// @return _amount The fee amount to be sent to governance when a user adds liquidity to a job\n function fee() external view returns (uint256 _amount);\n\n // Errors\n\n /// @notice Throws if the reward period is less than the minimum reward period time\n error MinRewardPeriod();\n\n /// @notice Throws if either a job or a keeper is disputed\n error Disputed();\n\n /// @notice Throws if there are no bonded assets\n error BondsUnexistent();\n\n /// @notice Throws if the time required to bond an asset has not passed yet\n error BondsLocked();\n\n /// @notice Throws if there are no bonds to withdraw\n error UnbondsUnexistent();\n\n /// @notice Throws if the time required to withdraw the bonds has not passed yet\n error UnbondsLocked();\n\n // Methods\n\n /// @notice Sets the Keep3rHelper address\n /// @param _keep3rHelper The Keep3rHelper address\n function setKeep3rHelper(address _keep3rHelper) external;\n\n /// @notice Sets the Keep3rV1 address\n /// @param _keep3rV1 The Keep3rV1 address\n function setKeep3rV1(address _keep3rV1) external;\n\n /// @notice Sets the Keep3rV1Proxy address\n /// @param _keep3rV1Proxy The Keep3rV1Proxy address\n function setKeep3rV1Proxy(address _keep3rV1Proxy) external;\n\n /// @notice Sets the bond time required to activate as a keeper\n /// @param _bond The new bond time\n function setBondTime(uint256 _bond) external;\n\n /// @notice Sets the unbond time required unbond what has been bonded\n /// @param _unbond The new unbond time\n function setUnbondTime(uint256 _unbond) external;\n\n /// @notice Sets the minimum amount of liquidity required to fund a job\n /// @param _liquidityMinimum The new minimum amount of liquidity\n function setLiquidityMinimum(uint256 _liquidityMinimum) external;\n\n /// @notice Sets the time required to pass between rewards for jobs\n /// @param _rewardPeriodTime The new amount of time required to pass between rewards\n function setRewardPeriodTime(uint256 _rewardPeriodTime) external;\n\n /// @notice Sets the new inflation period\n /// @param _inflationPeriod The new inflation period\n function setInflationPeriod(uint256 _inflationPeriod) external;\n\n /// @notice Sets the new fee\n /// @param _fee The new fee\n function setFee(uint256 _fee) external;\n}\n" - }, - "solidity/interfaces/peripherals/IBaseErrors.sol": { - "content": "// SPDX-License-Identifier: MIT\n\npragma solidity >=0.8.4 <0.9.0;\n\ninterface IBaseErrors {\n /// @notice Throws if a variable is assigned to the zero address\n error ZeroAddress();\n}\n" - }, - "solidity/interfaces/peripherals/IKeep3rRoles.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\n/// @title Keep3rRoles contract\n/// @notice Manages the Keep3r specific roles\ninterface IKeep3rRoles {\n // Events\n\n /// @notice Emitted when a slasher is added\n /// @param _slasher Address of the added slasher\n event SlasherAdded(address _slasher);\n\n /// @notice Emitted when a slasher is removed\n /// @param _slasher Address of the removed slasher\n event SlasherRemoved(address _slasher);\n\n /// @notice Emitted when a disputer is added\n /// @param _disputer Address of the added disputer\n event DisputerAdded(address _disputer);\n\n /// @notice Emitted when a disputer is removed\n /// @param _disputer Address of the removed disputer\n event DisputerRemoved(address _disputer);\n\n // Variables\n\n /// @notice Tracks whether the address is a slasher or not\n /// @param _slasher Address being checked as a slasher\n /// @return _isSlasher Whether the address is a slasher or not\n function slashers(address _slasher) external view returns (bool _isSlasher);\n\n /// @notice Tracks whether the address is a disputer or not\n /// @param _disputer Address being checked as a disputer\n /// @return _isDisputer Whether the address is a disputer or not\n function disputers(address _disputer) external view returns (bool _isDisputer);\n\n // Errors\n\n /// @notice Throws if the address is already a registered slasher\n error SlasherExistent();\n\n /// @notice Throws if caller is not a registered slasher\n error SlasherUnexistent();\n\n /// @notice Throws if the address is already a registered disputer\n error DisputerExistent();\n\n /// @notice Throws if caller is not a registered disputer\n error DisputerUnexistent();\n\n /// @notice Throws if the msg.sender is not a slasher or is not a part of governance\n error OnlySlasher();\n\n /// @notice Throws if the msg.sender is not a disputer or is not a part of governance\n error OnlyDisputer();\n\n // Methods\n\n /// @notice Registers a slasher by updating the slashers mapping\n function addSlasher(address _slasher) external;\n\n /// @notice Removes a slasher by updating the slashers mapping\n function removeSlasher(address _slasher) external;\n\n /// @notice Registers a disputer by updating the disputers mapping\n function addDisputer(address _disputer) external;\n\n /// @notice Removes a disputer by updating the disputers mapping\n function removeDisputer(address _disputer) external;\n}\n" - }, - "solidity/contracts/peripherals/Governable.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../../interfaces/peripherals/IGovernable.sol';\n\nabstract contract Governable is IGovernable {\n /// @inheritdoc IGovernable\n address public override governance;\n\n /// @inheritdoc IGovernable\n address public override pendingGovernance;\n\n constructor(address _governance) {\n if (_governance == address(0)) revert NoGovernanceZeroAddress();\n governance = _governance;\n }\n\n /// @inheritdoc IGovernable\n function setGovernance(address _governance) external override onlyGovernance {\n pendingGovernance = _governance;\n emit GovernanceProposal(_governance);\n }\n\n /// @inheritdoc IGovernable\n function acceptGovernance() external override onlyPendingGovernance {\n governance = pendingGovernance;\n delete pendingGovernance;\n emit GovernanceSet(governance);\n }\n\n /// @notice Functions with this modifier can only be called by governance\n modifier onlyGovernance {\n if (msg.sender != governance) revert OnlyGovernance();\n _;\n }\n\n /// @notice Functions with this modifier can only be called by pendingGovernance\n modifier onlyPendingGovernance {\n if (msg.sender != pendingGovernance) revert OnlyPendingGovernance();\n _;\n }\n}\n" - }, - "solidity/interfaces/peripherals/IGovernable.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\n/// @title Governable contract\n/// @notice Manages the governance role\ninterface IGovernable {\n // Events\n\n /// @notice Emitted when pendingGovernance accepts to be governance\n /// @param _governance Address of the new governance\n event GovernanceSet(address _governance);\n\n /// @notice Emitted when a new governance is proposed\n /// @param _pendingGovernance Address that is proposed to be the new governance\n event GovernanceProposal(address _pendingGovernance);\n\n // Errors\n\n /// @notice Throws if the caller of the function is not governance\n error OnlyGovernance();\n\n /// @notice Throws if the caller of the function is not pendingGovernance\n error OnlyPendingGovernance();\n\n /// @notice Throws if trying to set governance to zero address\n error NoGovernanceZeroAddress();\n\n // Variables\n\n /// @notice Stores the governance address\n /// @return _governance The governance addresss\n function governance() external view returns (address _governance);\n\n /// @notice Stores the pendingGovernance address\n /// @return _pendingGovernance The pendingGovernance addresss\n function pendingGovernance() external view returns (address _pendingGovernance);\n\n // Methods\n\n /// @notice Proposes a new address to be governance\n /// @param _governance The address being proposed as the new governance\n function setGovernance(address _governance) external;\n\n /// @notice Changes the governance from the current governance to the previously proposed address\n function acceptGovernance() external;\n}\n" - }, - "@openzeppelin/contracts/utils/Address.sol": { - "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Collection of functions related to the address type\n */\nlibrary Address {\n /**\n * @dev Returns true if `account` is a contract.\n *\n * [IMPORTANT]\n * ====\n * It is unsafe to assume that an address for which this function returns\n * false is an externally-owned account (EOA) and not a contract.\n *\n * Among others, `isContract` will return false for the following\n * types of addresses:\n *\n * - an externally-owned account\n * - a contract in construction\n * - an address where a contract will be created\n * - an address where a contract lived, but was destroyed\n * ====\n */\n function isContract(address account) internal view returns (bool) {\n // This method relies on extcodesize, which returns 0 for contracts in\n // construction, since the code is only stored at the end of the\n // constructor execution.\n\n uint256 size;\n assembly {\n size := extcodesize(account)\n }\n return size > 0;\n }\n\n /**\n * @dev Replacement for Solidity's `transfer`: sends `amount` wei to\n * `recipient`, forwarding all available gas and reverting on errors.\n *\n * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost\n * of certain opcodes, possibly making contracts go over the 2300 gas limit\n * imposed by `transfer`, making them unable to receive funds via\n * `transfer`. {sendValue} removes this limitation.\n *\n * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].\n *\n * IMPORTANT: because control is transferred to `recipient`, care must be\n * taken to not create reentrancy vulnerabilities. Consider using\n * {ReentrancyGuard} or the\n * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].\n */\n function sendValue(address payable recipient, uint256 amount) internal {\n require(address(this).balance >= amount, \"Address: insufficient balance\");\n\n (bool success, ) = recipient.call{value: amount}(\"\");\n require(success, \"Address: unable to send value, recipient may have reverted\");\n }\n\n /**\n * @dev Performs a Solidity function call using a low level `call`. A\n * plain `call` is an unsafe replacement for a function call: use this\n * function instead.\n *\n * If `target` reverts with a revert reason, it is bubbled up by this\n * function (like regular Solidity function calls).\n *\n * Returns the raw returned data. To convert to the expected return value,\n * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\n *\n * Requirements:\n *\n * - `target` must be a contract.\n * - calling `target` with `data` must not revert.\n *\n * _Available since v3.1._\n */\n function functionCall(address target, bytes memory data) internal returns (bytes memory) {\n return functionCall(target, data, \"Address: low-level call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with\n * `errorMessage` as a fallback revert reason when `target` reverts.\n *\n * _Available since v3.1._\n */\n function functionCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal returns (bytes memory) {\n return functionCallWithValue(target, data, 0, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but also transferring `value` wei to `target`.\n *\n * Requirements:\n *\n * - the calling contract must have an ETH balance of at least `value`.\n * - the called Solidity function must be `payable`.\n *\n * _Available since v3.1._\n */\n function functionCallWithValue(\n address target,\n bytes memory data,\n uint256 value\n ) internal returns (bytes memory) {\n return functionCallWithValue(target, data, value, \"Address: low-level call with value failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but\n * with `errorMessage` as a fallback revert reason when `target` reverts.\n *\n * _Available since v3.1._\n */\n function functionCallWithValue(\n address target,\n bytes memory data,\n uint256 value,\n string memory errorMessage\n ) internal returns (bytes memory) {\n require(address(this).balance >= value, \"Address: insufficient balance for call\");\n require(isContract(target), \"Address: call to non-contract\");\n\n (bool success, bytes memory returndata) = target.call{value: value}(data);\n return verifyCallResult(success, returndata, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but performing a static call.\n *\n * _Available since v3.3._\n */\n function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\n return functionStaticCall(target, data, \"Address: low-level static call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\n * but performing a static call.\n *\n * _Available since v3.3._\n */\n function functionStaticCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal view returns (bytes memory) {\n require(isContract(target), \"Address: static call to non-contract\");\n\n (bool success, bytes memory returndata) = target.staticcall(data);\n return verifyCallResult(success, returndata, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but performing a delegate call.\n *\n * _Available since v3.4._\n */\n function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {\n return functionDelegateCall(target, data, \"Address: low-level delegate call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\n * but performing a delegate call.\n *\n * _Available since v3.4._\n */\n function functionDelegateCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal returns (bytes memory) {\n require(isContract(target), \"Address: delegate call to non-contract\");\n\n (bool success, bytes memory returndata) = target.delegatecall(data);\n return verifyCallResult(success, returndata, errorMessage);\n }\n\n /**\n * @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the\n * revert reason using the provided one.\n *\n * _Available since v4.3._\n */\n function verifyCallResult(\n bool success,\n bytes memory returndata,\n string memory errorMessage\n ) internal pure returns (bytes memory) {\n if (success) {\n return returndata;\n } else {\n // Look for revert reason and bubble it up if present\n if (returndata.length > 0) {\n // The easiest way to bubble the revert reason is using memory via assembly\n\n assembly {\n let returndata_size := mload(returndata)\n revert(add(32, returndata), returndata_size)\n }\n } else {\n revert(errorMessage);\n }\n }\n }\n}\n" - }, - "solidity/interfaces/IPairManager.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol';\n\n/// @title Pair Manager interface\n/// @notice Generic interface for Keep3r liquidity pools (kLP)\ninterface IPairManager is IERC20Metadata {\n /// @notice Address of the factory from which the pair manager was created\n /// @return _factory The address of the PairManager Factory\n function factory() external view returns (address _factory);\n\n /// @notice Address of the pool from which the Keep3r pair manager will interact with\n /// @return _pool The address of the pool\n function pool() external view returns (address _pool);\n\n /// @notice Token0 of the pool\n /// @return _token0 The address of token0\n function token0() external view returns (address _token0);\n\n /// @notice Token1 of the pool\n /// @return _token1 The address of token1\n function token1() external view returns (address _token1);\n}\n" - }, - "solidity/contracts/libraries/FullMath.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\n/// @title Contains 512-bit math functions\n/// @notice Facilitates multiplication and division that can have overflow of an intermediate value without any loss of precision\n/// @dev Handles \"phantom overflow\" i.e., allows multiplication and division where an intermediate value overflows 256 bits\nlibrary FullMath {\n /// @notice Calculates floor(a×b÷denominator) with full precision. Throws if result overflows a uint256 or denominator == 0\n /// @param a The multiplicand\n /// @param b The multiplier\n /// @param denominator The divisor\n /// @return result The 256-bit result\n /// @dev Credit to Remco Bloemen under MIT license https://xn--2-umb.com/21/muldiv\n function mulDiv(\n uint256 a,\n uint256 b,\n uint256 denominator\n ) internal pure returns (uint256 result) {\n unchecked {\n // 512-bit multiply [prod1 prod0] = a * b\n // Compute the product mod 2**256 and mod 2**256 - 1\n // then use the Chinese Remainder Theorem to reconstruct\n // the 512 bit result. The result is stored in two 256\n // variables such that product = prod1 * 2**256 + prod0\n uint256 prod0; // Least significant 256 bits of the product\n uint256 prod1; // Most significant 256 bits of the product\n assembly {\n let mm := mulmod(a, b, not(0))\n prod0 := mul(a, b)\n prod1 := sub(sub(mm, prod0), lt(mm, prod0))\n }\n\n // Handle non-overflow cases, 256 by 256 division\n if (prod1 == 0) {\n require(denominator > 0);\n assembly {\n result := div(prod0, denominator)\n }\n return result;\n }\n\n // Make sure the result is less than 2**256.\n // Also prevents denominator == 0\n require(denominator > prod1);\n\n ///////////////////////////////////////////////\n // 512 by 256 division.\n ///////////////////////////////////////////////\n\n // Make division exact by subtracting the remainder from [prod1 prod0]\n // Compute remainder using mulmod\n uint256 remainder;\n assembly {\n remainder := mulmod(a, b, denominator)\n }\n // Subtract 256 bit number from 512 bit number\n assembly {\n prod1 := sub(prod1, gt(remainder, prod0))\n prod0 := sub(prod0, remainder)\n }\n\n // Factor powers of two out of denominator\n // Compute largest power of two divisor of denominator.\n // Always >= 1.\n uint256 twos = (~denominator + 1) & denominator;\n // Divide denominator by power of two\n assembly {\n denominator := div(denominator, twos)\n }\n\n // Divide [prod1 prod0] by the factors of two\n assembly {\n prod0 := div(prod0, twos)\n }\n // Shift in bits from prod1 into prod0. For this we need\n // to flip `twos` such that it is 2**256 / twos.\n // If twos is zero, then it becomes one\n assembly {\n twos := add(div(sub(0, twos), twos), 1)\n }\n prod0 |= prod1 * twos;\n\n // Invert denominator mod 2**256\n // Now that denominator is an odd number, it has an inverse\n // modulo 2**256 such that denominator * inv = 1 mod 2**256.\n // Compute the inverse by starting with a seed that is correct\n // correct for four bits. That is, denominator * inv = 1 mod 2**4\n uint256 inv = (3 * denominator) ^ 2;\n // Now use Newton-Raphson iteration to improve the precision.\n // Thanks to Hensel's lifting lemma, this also works in modular\n // arithmetic, doubling the correct bits in each step.\n inv *= 2 - denominator * inv; // inverse mod 2**8\n inv *= 2 - denominator * inv; // inverse mod 2**16\n inv *= 2 - denominator * inv; // inverse mod 2**32\n inv *= 2 - denominator * inv; // inverse mod 2**64\n inv *= 2 - denominator * inv; // inverse mod 2**128\n inv *= 2 - denominator * inv; // inverse mod 2**256\n\n // Because the division is now exact we can divide by multiplying\n // with the modular inverse of denominator. This will give us the\n // correct result modulo 2**256. Since the precoditions guarantee\n // that the outcome is less than 2**256, this is the final result.\n // We don't need to compute the high bits of the result and prod1\n // is no longer required.\n result = prod0 * inv;\n return result;\n }\n }\n\n /// @notice Calculates ceil(a×b÷denominator) with full precision. Throws if result overflows a uint256 or denominator == 0\n /// @param a The multiplicand\n /// @param b The multiplier\n /// @param denominator The divisor\n /// @return result The 256-bit result\n function mulDivRoundingUp(\n uint256 a,\n uint256 b,\n uint256 denominator\n ) internal pure returns (uint256 result) {\n unchecked {\n result = mulDiv(a, b, denominator);\n if (mulmod(a, b, denominator) > 0) {\n require(result < type(uint256).max);\n result++;\n }\n }\n }\n}\n" - }, - "@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol": { - "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\nimport \"../IERC20.sol\";\n\n/**\n * @dev Interface for the optional metadata functions from the ERC20 standard.\n *\n * _Available since v4.1._\n */\ninterface IERC20Metadata is IERC20 {\n /**\n * @dev Returns the name of the token.\n */\n function name() external view returns (string memory);\n\n /**\n * @dev Returns the symbol of the token.\n */\n function symbol() external view returns (string memory);\n\n /**\n * @dev Returns the decimals places of the token.\n */\n function decimals() external view returns (uint8);\n}\n" - }, - "solidity/interfaces/peripherals/IKeep3rDisputable.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\n/// @title Keep3rDisputable contract\n/// @notice Creates/resolves disputes for jobs or keepers\n/// A disputed keeper is slashable and is not able to bond, activate, withdraw or receive direct payments\n/// A disputed job is slashable and is not able to pay the keepers, withdraw tokens or to migrate\ninterface IKeep3rDisputable {\n /// @notice Emitted when a keeper or a job is disputed\n /// @param _jobOrKeeper The address of the disputed keeper/job\n /// @param _disputer The user that called the function and disputed the keeper\n event Dispute(address indexed _jobOrKeeper, address indexed _disputer);\n\n /// @notice Emitted when a dispute is resolved\n /// @param _jobOrKeeper The address of the disputed keeper/job\n /// @param _resolver The user that called the function and resolved the dispute\n event Resolve(address indexed _jobOrKeeper, address indexed _resolver);\n\n /// @notice Throws when a job or keeper is already disputed\n error AlreadyDisputed();\n\n /// @notice Throws when a job or keeper is not disputed and someone tries to resolve the dispute\n error NotDisputed();\n\n /// @notice Allows governance to create a dispute for a given keeper/job\n /// @param _jobOrKeeper The address in dispute\n function dispute(address _jobOrKeeper) external;\n\n /// @notice Allows governance to resolve a dispute on a keeper/job\n /// @param _jobOrKeeper The address cleared\n function resolve(address _jobOrKeeper) external;\n}\n" - }, - "solidity/contracts/peripherals/jobs/Keep3rJobMigration.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../../../interfaces/peripherals/IKeep3rJobs.sol';\nimport './Keep3rJobFundableCredits.sol';\nimport './Keep3rJobFundableLiquidity.sol';\n\nabstract contract Keep3rJobMigration is IKeep3rJobMigration, Keep3rJobFundableCredits, Keep3rJobFundableLiquidity {\n using EnumerableSet for EnumerableSet.AddressSet;\n\n uint256 internal constant _MIGRATION_COOLDOWN = 1 minutes;\n\n /// @inheritdoc IKeep3rJobMigration\n mapping(address => address) public override pendingJobMigrations;\n mapping(address => mapping(address => uint256)) internal _migrationCreatedAt;\n\n /// @inheritdoc IKeep3rJobMigration\n function migrateJob(address _fromJob, address _toJob) external override onlyJobOwner(_fromJob) {\n if (_fromJob == _toJob) revert JobMigrationImpossible();\n\n pendingJobMigrations[_fromJob] = _toJob;\n _migrationCreatedAt[_fromJob][_toJob] = block.timestamp;\n\n emit JobMigrationRequested(_fromJob, _toJob);\n }\n\n /// @inheritdoc IKeep3rJobMigration\n function acceptJobMigration(address _fromJob, address _toJob) external override onlyJobOwner(_toJob) {\n if (disputes[_fromJob] || disputes[_toJob]) revert JobDisputed();\n if (pendingJobMigrations[_fromJob] != _toJob) revert JobMigrationUnavailable();\n if (block.timestamp < _migrationCreatedAt[_fromJob][_toJob] + _MIGRATION_COOLDOWN) revert JobMigrationLocked();\n\n // force job credits update for both jobs\n _settleJobAccountance(_fromJob);\n _settleJobAccountance(_toJob);\n\n // migrate tokens\n while (_jobTokens[_fromJob].length() > 0) {\n address _tokenToMigrate = _jobTokens[_fromJob].at(0);\n jobTokenCredits[_toJob][_tokenToMigrate] += jobTokenCredits[_fromJob][_tokenToMigrate];\n delete jobTokenCredits[_fromJob][_tokenToMigrate];\n _jobTokens[_fromJob].remove(_tokenToMigrate);\n _jobTokens[_toJob].add(_tokenToMigrate);\n }\n\n // migrate liquidities\n while (_jobLiquidities[_fromJob].length() > 0) {\n address _liquidity = _jobLiquidities[_fromJob].at(0);\n\n liquidityAmount[_toJob][_liquidity] += liquidityAmount[_fromJob][_liquidity];\n delete liquidityAmount[_fromJob][_liquidity];\n\n _jobLiquidities[_toJob].add(_liquidity);\n _jobLiquidities[_fromJob].remove(_liquidity);\n }\n\n // migrate job balances\n _jobPeriodCredits[_toJob] += _jobPeriodCredits[_fromJob];\n delete _jobPeriodCredits[_fromJob];\n\n _jobLiquidityCredits[_toJob] += _jobLiquidityCredits[_fromJob];\n delete _jobLiquidityCredits[_fromJob];\n\n // stop _fromJob from being a job\n delete rewardedAt[_fromJob];\n _jobs.remove(_fromJob);\n\n // delete unused data slots\n delete jobOwner[_fromJob];\n delete jobPendingOwner[_fromJob];\n delete _migrationCreatedAt[_fromJob][_toJob];\n delete pendingJobMigrations[_fromJob];\n\n emit JobMigrationSuccessful(_fromJob, _toJob);\n }\n}\n" - }, - "solidity/contracts/peripherals/keepers/Keep3rKeeperDisputable.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport './Keep3rKeeperFundable.sol';\nimport '../Keep3rDisputable.sol';\nimport '../../../interfaces/external/IKeep3rV1.sol';\nimport '../../../interfaces/peripherals/IKeep3rKeepers.sol';\n\nabstract contract Keep3rKeeperDisputable is IKeep3rKeeperDisputable, Keep3rDisputable, Keep3rKeeperFundable {\n using EnumerableSet for EnumerableSet.AddressSet;\n using SafeERC20 for IERC20;\n\n /// @inheritdoc IKeep3rKeeperDisputable\n function slash(\n address _keeper,\n address _bonded,\n uint256 _bondAmount,\n uint256 _unbondAmount\n ) public override onlySlasher {\n if (!disputes[_keeper]) revert NotDisputed();\n _slash(_keeper, _bonded, _bondAmount, _unbondAmount);\n emit KeeperSlash(_keeper, msg.sender, _bondAmount + _unbondAmount);\n }\n\n /// @inheritdoc IKeep3rKeeperDisputable\n function revoke(address _keeper) external override onlySlasher {\n if (!disputes[_keeper]) revert NotDisputed();\n _keepers.remove(_keeper);\n _slash(_keeper, keep3rV1, bonds[_keeper][keep3rV1], pendingUnbonds[_keeper][keep3rV1]);\n emit KeeperRevoke(_keeper, msg.sender);\n }\n\n function _slash(\n address _keeper,\n address _bonded,\n uint256 _bondAmount,\n uint256 _unbondAmount\n ) internal {\n if (_bonded != keep3rV1) {\n try IERC20(_bonded).transfer(governance, _bondAmount + _unbondAmount) returns (bool) {} catch (bytes memory) {}\n }\n bonds[_keeper][_bonded] -= _bondAmount;\n pendingUnbonds[_keeper][_bonded] -= _unbondAmount;\n }\n}\n" - }, - "solidity/contracts/peripherals/keepers/Keep3rKeeperFundable.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../Keep3rAccountance.sol';\nimport '../Keep3rParameters.sol';\nimport '../../../interfaces/peripherals/IKeep3rKeepers.sol';\n\nimport '../../../interfaces/external/IKeep3rV1.sol';\nimport '../../../interfaces/external/IKeep3rV1Proxy.sol';\n\nimport '@openzeppelin/contracts/security/ReentrancyGuard.sol';\nimport '@openzeppelin/contracts/token/ERC20/IERC20.sol';\nimport '@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol';\n\nabstract contract Keep3rKeeperFundable is IKeep3rKeeperFundable, ReentrancyGuard, Keep3rParameters {\n using EnumerableSet for EnumerableSet.AddressSet;\n using SafeERC20 for IERC20;\n\n /// @inheritdoc IKeep3rKeeperFundable\n function bond(address _bonding, uint256 _amount) external override nonReentrant {\n if (disputes[msg.sender]) revert Disputed();\n if (_jobs.contains(msg.sender)) revert AlreadyAJob();\n canActivateAfter[msg.sender][_bonding] = block.timestamp + bondTime;\n\n uint256 _before = IERC20(_bonding).balanceOf(address(this));\n IERC20(_bonding).safeTransferFrom(msg.sender, address(this), _amount);\n _amount = IERC20(_bonding).balanceOf(address(this)) - _before;\n\n hasBonded[msg.sender] = true;\n pendingBonds[msg.sender][_bonding] += _amount;\n\n emit Bonding(msg.sender, _bonding, _amount);\n }\n\n /// @inheritdoc IKeep3rKeeperFundable\n function activate(address _bonding) external override {\n address _keeper = msg.sender;\n if (disputes[_keeper]) revert Disputed();\n uint256 _canActivateAfter = canActivateAfter[_keeper][_bonding];\n if (_canActivateAfter == 0) revert BondsUnexistent();\n if (_canActivateAfter >= block.timestamp) revert BondsLocked();\n\n if (firstSeen[_keeper] == 0) {\n firstSeen[_keeper] = block.timestamp;\n }\n _keepers.add(_keeper);\n\n uint256 _amount = pendingBonds[_keeper][_bonding];\n delete pendingBonds[_keeper][_bonding];\n\n _activate(_keeper, _bonding, _amount);\n emit Activation(_keeper, _bonding, _amount);\n }\n\n /// @inheritdoc IKeep3rKeeperFundable\n function unbond(address _bonding, uint256 _amount) external override {\n canWithdrawAfter[msg.sender][_bonding] = block.timestamp + unbondTime;\n bonds[msg.sender][_bonding] -= _amount;\n pendingUnbonds[msg.sender][_bonding] += _amount;\n\n emit Unbonding(msg.sender, _bonding, _amount);\n }\n\n /// @inheritdoc IKeep3rKeeperFundable\n function withdraw(address _bonding) external override nonReentrant {\n if (pendingUnbonds[msg.sender][_bonding] == 0) revert UnbondsUnexistent();\n if (canWithdrawAfter[msg.sender][_bonding] >= block.timestamp) revert UnbondsLocked();\n if (disputes[msg.sender]) revert Disputed();\n\n uint256 _amount = pendingUnbonds[msg.sender][_bonding];\n\n if (_bonding == keep3rV1) {\n IKeep3rV1Proxy(keep3rV1Proxy).mint(_amount);\n }\n\n delete pendingUnbonds[msg.sender][_bonding];\n delete canWithdrawAfter[msg.sender][_bonding];\n\n IERC20(_bonding).safeTransfer(msg.sender, _amount);\n\n emit Withdrawal(msg.sender, _bonding, _amount);\n }\n\n function _activate(\n address _keeper,\n address _bonding,\n uint256 _amount\n ) internal virtual {\n // bond provided tokens\n bonds[_keeper][_bonding] += _amount;\n if (_bonding == keep3rV1) {\n IKeep3rV1(keep3rV1).burn(_amount);\n }\n }\n}\n" - }, - "solidity/interfaces/external/IKeep3rV1.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '@openzeppelin/contracts/token/ERC20/IERC20.sol';\nimport '@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol';\n\n// solhint-disable func-name-mixedcase\ninterface IKeep3rV1 is IERC20, IERC20Metadata {\n // Structs\n struct Checkpoint {\n uint32 fromBlock;\n uint256 votes;\n }\n\n // Events\n event DelegateChanged(address indexed _delegator, address indexed _fromDelegate, address indexed _toDelegate);\n event DelegateVotesChanged(address indexed _delegate, uint256 _previousBalance, uint256 _newBalance);\n event SubmitJob(address indexed _job, address indexed _liquidity, address indexed _provider, uint256 _block, uint256 _credit);\n event ApplyCredit(address indexed _job, address indexed _liquidity, address indexed _provider, uint256 _block, uint256 _credit);\n event RemoveJob(address indexed _job, address indexed _liquidity, address indexed _provider, uint256 _block, uint256 _credit);\n event UnbondJob(address indexed _job, address indexed _liquidity, address indexed _provider, uint256 _block, uint256 _credit);\n event JobAdded(address indexed _job, uint256 _block, address _governance);\n event JobRemoved(address indexed _job, uint256 _block, address _governance);\n event KeeperWorked(address indexed _credit, address indexed _job, address indexed _keeper, uint256 _block, uint256 _amount);\n event KeeperBonding(address indexed _keeper, uint256 _block, uint256 _active, uint256 _bond);\n event KeeperBonded(address indexed _keeper, uint256 _block, uint256 _activated, uint256 _bond);\n event KeeperUnbonding(address indexed _keeper, uint256 _block, uint256 _deactive, uint256 _bond);\n event KeeperUnbound(address indexed _keeper, uint256 _block, uint256 _deactivated, uint256 _bond);\n event KeeperSlashed(address indexed _keeper, address indexed _slasher, uint256 _block, uint256 _slash);\n event KeeperDispute(address indexed _keeper, uint256 _block);\n event KeeperResolved(address indexed _keeper, uint256 _block);\n event TokenCreditAddition(address indexed _credit, address indexed _job, address indexed _creditor, uint256 _block, uint256 _amount);\n\n // Variables\n function KPRH() external returns (address);\n\n function delegates(address _delegator) external view returns (address);\n\n function checkpoints(address _account, uint32 _checkpoint) external view returns (Checkpoint memory);\n\n function numCheckpoints(address _account) external view returns (uint32);\n\n function DOMAIN_TYPEHASH() external returns (bytes32);\n\n function DOMAINSEPARATOR() external returns (bytes32);\n\n function DELEGATION_TYPEHASH() external returns (bytes32);\n\n function PERMIT_TYPEHASH() external returns (bytes32);\n\n function nonces(address _user) external view returns (uint256);\n\n function BOND() external returns (uint256);\n\n function UNBOND() external returns (uint256);\n\n function LIQUIDITYBOND() external returns (uint256);\n\n function FEE() external returns (uint256);\n\n function BASE() external returns (uint256);\n\n function ETH() external returns (address);\n\n function bondings(address _user, address _bonding) external view returns (uint256);\n\n function canWithdrawAfter(address _user, address _bonding) external view returns (uint256);\n\n function pendingUnbonds(address _keeper, address _bonding) external view returns (uint256);\n\n function pendingbonds(address _keeper, address _bonding) external view returns (uint256);\n\n function bonds(address _keeper, address _bonding) external view returns (uint256);\n\n function votes(address _delegator) external view returns (uint256);\n\n function firstSeen(address _keeper) external view returns (uint256);\n\n function disputes(address _keeper) external view returns (bool);\n\n function lastJob(address _keeper) external view returns (uint256);\n\n function workCompleted(address _keeper) external view returns (uint256);\n\n function jobs(address _job) external view returns (bool);\n\n function credits(address _job, address _credit) external view returns (uint256);\n\n function liquidityProvided(\n address _provider,\n address _liquidity,\n address _job\n ) external view returns (uint256);\n\n function liquidityUnbonding(\n address _provider,\n address _liquidity,\n address _job\n ) external view returns (uint256);\n\n function liquidityAmountsUnbonding(\n address _provider,\n address _liquidity,\n address _job\n ) external view returns (uint256);\n\n function jobProposalDelay(address _job) external view returns (uint256);\n\n function liquidityApplied(\n address _provider,\n address _liquidity,\n address _job\n ) external view returns (uint256);\n\n function liquidityAmount(\n address _provider,\n address _liquidity,\n address _job\n ) external view returns (uint256);\n\n function keepers(address _keeper) external view returns (bool);\n\n function blacklist(address _keeper) external view returns (bool);\n\n function keeperList(uint256 _index) external view returns (address);\n\n function jobList(uint256 _index) external view returns (address);\n\n function governance() external returns (address);\n\n function pendingGovernance() external returns (address);\n\n function liquidityAccepted(address _liquidity) external view returns (bool);\n\n function liquidityPairs(uint256 _index) external view returns (address);\n\n // Methods\n function getCurrentVotes(address _account) external view returns (uint256);\n\n function addCreditETH(address _job) external payable;\n\n function addCredit(\n address _credit,\n address _job,\n uint256 _amount\n ) external;\n\n function addVotes(address _voter, uint256 _amount) external;\n\n function removeVotes(address _voter, uint256 _amount) external;\n\n function addKPRCredit(address _job, uint256 _amount) external;\n\n function approveLiquidity(address _liquidity) external;\n\n function revokeLiquidity(address _liquidity) external;\n\n function pairs() external view returns (address[] memory);\n\n function addLiquidityToJob(\n address _liquidity,\n address _job,\n uint256 _amount\n ) external;\n\n function applyCreditToJob(\n address _provider,\n address _liquidity,\n address _job\n ) external;\n\n function unbondLiquidityFromJob(\n address _liquidity,\n address _job,\n uint256 _amount\n ) external;\n\n function removeLiquidityFromJob(address _liquidity, address _job) external;\n\n function mint(uint256 _amount) external;\n\n function burn(uint256 _amount) external;\n\n function worked(address _keeper) external;\n\n function receipt(\n address _credit,\n address _keeper,\n uint256 _amount\n ) external;\n\n function receiptETH(address _keeper, uint256 _amount) external;\n\n function addJob(address _job) external;\n\n function getJobs() external view returns (address[] memory);\n\n function removeJob(address _job) external;\n\n function setKeep3rHelper(address _keep3rHelper) external;\n\n function setGovernance(address _governance) external;\n\n function acceptGovernance() external;\n\n function isKeeper(address _keeper) external returns (bool);\n\n function isMinKeeper(\n address _keeper,\n uint256 _minBond,\n uint256 _earned,\n uint256 _age\n ) external returns (bool);\n\n function isBondedKeeper(\n address _keeper,\n address _bond,\n uint256 _minBond,\n uint256 _earned,\n uint256 _age\n ) external returns (bool);\n\n function bond(address _bonding, uint256 _amount) external;\n\n function getKeepers() external view returns (address[] memory);\n\n function activate(address _bonding) external;\n\n function unbond(address _bonding, uint256 _amount) external;\n\n function slash(\n address _bonded,\n address _keeper,\n uint256 _amount\n ) external;\n\n function withdraw(address _bonding) external;\n\n function dispute(address _keeper) external;\n\n function revoke(address _keeper) external;\n\n function resolve(address _keeper) external;\n\n function permit(\n address _owner,\n address _spender,\n uint256 _amount,\n uint256 _deadline,\n uint8 _v,\n bytes32 _r,\n bytes32 _s\n ) external;\n}\n" - }, - "solidity/interfaces/peripherals/IKeep3rKeepers.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\n/// @title Keep3rKeeperFundable contract\n/// @notice Handles the actions required to become a keeper\ninterface IKeep3rKeeperFundable {\n // Events\n\n /// @notice Emitted when Keep3rKeeperFundable#activate is called\n /// @param _keeper The keeper that has been activated\n /// @param _bond The asset the keeper has bonded\n /// @param _amount The amount of the asset the keeper has bonded\n event Activation(address indexed _keeper, address indexed _bond, uint256 _amount);\n\n /// @notice Emitted when Keep3rKeeperFundable#withdraw is called\n /// @param _keeper The caller of Keep3rKeeperFundable#withdraw function\n /// @param _bond The asset to withdraw from the bonding pool\n /// @param _amount The amount of funds withdrawn\n event Withdrawal(address indexed _keeper, address indexed _bond, uint256 _amount);\n\n // Errors\n\n /// @notice Throws when the address that is trying to register as a job is already a job\n error AlreadyAJob();\n\n // Methods\n\n /// @notice Beginning of the bonding process\n /// @param _bonding The asset being bonded\n /// @param _amount The amount of bonding asset being bonded\n function bond(address _bonding, uint256 _amount) external;\n\n /// @notice Beginning of the unbonding process\n /// @param _bonding The asset being unbonded\n /// @param _amount Allows for partial unbonding\n function unbond(address _bonding, uint256 _amount) external;\n\n /// @notice End of the bonding process after bonding time has passed\n /// @param _bonding The asset being activated as bond collateral\n function activate(address _bonding) external;\n\n /// @notice Withdraw funds after unbonding has finished\n /// @param _bonding The asset to withdraw from the bonding pool\n function withdraw(address _bonding) external;\n}\n\n/// @title Keep3rKeeperDisputable contract\n/// @notice Handles the actions that can be taken on a disputed keeper\ninterface IKeep3rKeeperDisputable {\n // Events\n\n /// @notice Emitted when Keep3rKeeperDisputable#slash is called\n /// @param _keeper The address of the slashed keeper\n /// @param _slasher The user that called Keep3rKeeperDisputable#slash\n /// @param _amount The amount of credits slashed from the keeper\n event KeeperSlash(address indexed _keeper, address indexed _slasher, uint256 _amount);\n\n /// @notice Emitted when Keep3rKeeperDisputable#revoke is called\n /// @param _keeper The address of the revoked keeper\n /// @param _slasher The user that called Keep3rKeeperDisputable#revoke\n event KeeperRevoke(address indexed _keeper, address indexed _slasher);\n\n // Methods\n\n /// @notice Allows governance to slash a keeper based on a dispute\n /// @param _keeper The address being slashed\n /// @param _bonded The asset being slashed\n /// @param _bondAmount The bonded amount being slashed\n /// @param _unbondAmount The pending unbond amount being slashed\n function slash(\n address _keeper,\n address _bonded,\n uint256 _bondAmount,\n uint256 _unbondAmount\n ) external;\n\n /// @notice Blacklists a keeper from participating in the network\n /// @param _keeper The address being slashed\n function revoke(address _keeper) external;\n}\n\n// solhint-disable-next-line no-empty-blocks\n\n/// @title Keep3rKeepers contract\ninterface IKeep3rKeepers is IKeep3rKeeperDisputable {\n\n}\n" - }, - "solidity/interfaces/external/IKeep3rV1Proxy.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../peripherals/IGovernable.sol';\n\ninterface IKeep3rV1Proxy is IGovernable {\n // Structs\n struct Recipient {\n address recipient;\n uint256 caps;\n }\n\n // Variables\n function keep3rV1() external view returns (address);\n\n function minter() external view returns (address);\n\n function next(address) external view returns (uint256);\n\n function caps(address) external view returns (uint256);\n\n function recipients() external view returns (address[] memory);\n\n function recipientsCaps() external view returns (Recipient[] memory);\n\n // Errors\n error Cooldown();\n error NoDrawableAmount();\n error ZeroAddress();\n error OnlyMinter();\n\n // Methods\n function addRecipient(address recipient, uint256 amount) external;\n\n function removeRecipient(address recipient) external;\n\n function draw() external returns (uint256 _amount);\n\n function setKeep3rV1(address _keep3rV1) external;\n\n function setMinter(address _minter) external;\n\n function mint(uint256 _amount) external;\n\n function mint(address _account, uint256 _amount) external;\n\n function setKeep3rV1Governance(address _governance) external;\n\n function acceptKeep3rV1Governance() external;\n\n function dispute(address _keeper) external;\n\n function slash(\n address _bonded,\n address _keeper,\n uint256 _amount\n ) external;\n\n function revoke(address _keeper) external;\n\n function resolve(address _keeper) external;\n\n function addJob(address _job) external;\n\n function removeJob(address _job) external;\n\n function addKPRCredit(address _job, uint256 _amount) external;\n\n function approveLiquidity(address _liquidity) external;\n\n function revokeLiquidity(address _liquidity) external;\n\n function setKeep3rHelper(address _keep3rHelper) external;\n\n function addVotes(address _voter, uint256 _amount) external;\n\n function removeVotes(address _voter, uint256 _amount) external;\n}\n" - }, - "solidity/interfaces/peripherals/IDustCollector.sol": { - "content": "// SPDX-License-Identifier: MIT\n\npragma solidity >=0.8.4 <0.9.0;\n\nimport './IBaseErrors.sol';\n\ninterface IDustCollector is IBaseErrors {\n /// @notice Emitted when dust is sent\n /// @param _token The token that will be transferred\n /// @param _amount The amount of the token that will be transferred\n /// @param _to The address which will receive the funds\n event DustSent(address _token, uint256 _amount, address _to);\n\n /// @notice Allows an authorized user to transfer the tokens or eth that may have been left in a contract\n /// @param _token The token that will be transferred\n /// @param _amount The amount of the token that will be transferred\n /// @param _to The address that will receive the idle funds\n function sendDust(\n address _token,\n uint256 _amount,\n address _to\n ) external;\n}\n" - }, - "solidity/for-test/testnet/Keep3rForTestnet.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../../contracts/Keep3r.sol';\n\ncontract Keep3rForTestnet is Keep3r {\n constructor(\n address _governance,\n address _keep3rHelper,\n address _keep3rV1,\n address _keep3rV1Proxy\n ) Keep3r(_governance, _keep3rHelper, _keep3rV1, _keep3rV1Proxy) {\n bondTime = 0; // allows keepers to instantly register\n liquidityMinimum = 0; // allows job providers to add low liquidity\n rewardPeriodTime = 15 seconds; // reduces twap calculation period\n inflationPeriod = 5 days; // increases credit mintint\n }\n}\n" - }, - "solidity/for-test/Keep3rForTest.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../contracts/Keep3r.sol';\n\ncontract Keep3rForTest is Keep3r {\n constructor(\n address _governance,\n address _keep3rHelper,\n address _keep3rV1,\n address _keep3rV1Proxy\n ) Keep3r(_governance, _keep3rHelper, _keep3rV1, _keep3rV1Proxy) {}\n}\n" - }, - "solidity/contracts/sidechain/Keep3rSidechain.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../Keep3r.sol';\nimport '../../interfaces/sidechain/IKeep3rEscrow.sol';\nimport '../../interfaces/sidechain/IKeep3rHelperSidechain.sol';\nimport '../../interfaces/sidechain/IKeep3rJobWorkableRated.sol';\n\ncontract Keep3rSidechain is Keep3r, IKeep3rJobWorkableRated {\n using EnumerableSet for EnumerableSet.AddressSet;\n\n /// @param _governance Address of governance\n /// @param _keep3rHelperSidechain Address of sidechain Keep3rHelper\n /// @param _wrappedKP3R Address of wrapped KP3R implementation\n /// @param _keep3rEscrow Address of sidechain Keep3rEscrow\n constructor(\n address _governance, // governance\n address _keep3rHelperSidechain, // helper\n address _wrappedKP3R, // keep3rV1\n address _keep3rEscrow // keep3rV1Proxy\n ) Keep3r(_governance, _keep3rHelperSidechain, _wrappedKP3R, _keep3rEscrow) {}\n\n // Keep3rJobFundableLiquidity\n\n /// @notice Sidechain implementation asks the Helper for an oracle, instead of reading it from the ERC-20\n /// @dev Function should be called after setting an oracle in Keep3rHelperSidechain\n /// @param _liquidity Address of the liquidity token being approved\n function approveLiquidity(address _liquidity) external virtual override onlyGovernance {\n if (!_approvedLiquidities.add(_liquidity)) revert LiquidityPairApproved();\n _liquidityPool[_liquidity] = IKeep3rHelperSidechain(keep3rHelper).oracle(_liquidity);\n if (_liquidityPool[_liquidity] == address(0)) revert ZeroAddress();\n _isKP3RToken0[_liquidity] = IKeep3rHelper(keep3rHelper).isKP3RToken0(_liquidityPool[_liquidity]);\n _tick[_liquidity] = observeLiquidity(_liquidity);\n emit LiquidityApproval(_liquidity);\n }\n\n /// @notice Sidechain implementation will always ask for 2 tickCumulatives instead of cacheing\n /// @param _liquidity Address of the liquidity token being observed\n function observeLiquidity(address _liquidity) public view virtual override returns (TickCache memory _tickCache) {\n if (_tick[_liquidity].period == _period(block.timestamp)) {\n // Will return cached twaps if liquidity is updated\n _tickCache = _tick[_liquidity];\n } else {\n bool success;\n\n // Will always ask for 2 accumulators in sidechain\n uint32[] memory _secondsAgo = new uint32[](2);\n\n _secondsAgo[0] = uint32(block.timestamp - _period(block.timestamp));\n _secondsAgo[1] = uint32(block.timestamp - _period(block.timestamp) + rewardPeriodTime);\n\n int56 _tickCumulative2;\n (_tickCache.current, _tickCumulative2, success) = IKeep3rHelper(keep3rHelper).observe(_liquidityPool[_liquidity], _secondsAgo);\n\n _tickCache.difference = _tickCache.current - _tickCumulative2;\n\n if (success) {\n _tickCache.period = _period(block.timestamp);\n } else {\n delete _tickCache.period;\n }\n }\n }\n\n // Keep3rJobsWorkable\n\n /// @dev Sidechain implementation deprecates worked(address) as it should come with a usdPerGasUnit parameter\n function worked(address) external pure override {\n revert Deprecated();\n }\n\n /// @notice Implemented by jobs to show that a keeper performed work\n /// @dev Uses a USD per gas unit payment mechanism\n /// @param _keeper Address of the keeper that performed the work\n /// @param _usdPerGasUnit Units of USD (in wei) per gas unit that should be rewarded to the keeper\n function worked(address _keeper, uint256 _usdPerGasUnit) external override {\n // Gas used for quote calculations & payment is not rewarded\n uint256 _gasRecord = gasleft();\n\n address _job = msg.sender;\n if (disputes[_job]) revert JobDisputed();\n if (!_jobs.contains(_job)) revert JobUnapproved();\n\n if (_updateJobCreditsIfNeeded(_job)) {\n emit LiquidityCreditsReward(_job, rewardedAt[_job], _jobLiquidityCredits[_job], _jobPeriodCredits[_job]);\n }\n\n uint256 _boost = IKeep3rHelper(keep3rHelper).getRewardBoostFor(bonds[_keeper][keep3rV1]);\n uint256 _ratedPayment = (_usdPerGasUnit * (_initialGas - _gasRecord) * _boost) / _BASE;\n\n uint256 _ethPayment = IKeep3rHelperSidechain(keep3rHelper).quoteUsdToEth(_ratedPayment);\n uint256 _kp3rPayment = IKeep3rHelper(keep3rHelper).quote(_ethPayment);\n\n if (_kp3rPayment > _jobLiquidityCredits[_job]) {\n _rewardJobCredits(_job);\n emit LiquidityCreditsReward(_job, rewardedAt[_job], _jobLiquidityCredits[_job], _jobPeriodCredits[_job]);\n }\n\n _bondedPayment(_job, _keeper, _kp3rPayment);\n\n emit KeeperWork(keep3rV1, _job, _keeper, _kp3rPayment, _gasRecord);\n }\n\n // Keep3rKeeperFundable\n\n /// @dev Sidechain implementation doesn't burn tokens, but deposit them in Keep3rEscrow\n function _activate(\n address _keeper,\n address _bonding,\n uint256 _amount\n ) internal virtual override {\n // bond provided tokens\n bonds[_keeper][_bonding] += _amount;\n if (_bonding == keep3rV1) {\n IKeep3rV1(keep3rV1).approve(keep3rV1Proxy, _amount);\n IKeep3rEscrow(keep3rV1Proxy).deposit(_amount);\n }\n }\n}\n" - }, - "solidity/interfaces/sidechain/IKeep3rEscrow.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\n// solhint-disable-next-line no-empty-blocks\n\nimport '../peripherals/IMintable.sol';\n\n/// @title Keep3rEscrow contract\n/// @notice This contract acts as an escrow contract for wKP3R tokens on sidechains and L2s\n/// @dev Can be used as a replacement for keep3rV1Proxy in keep3r sidechain implementations\ninterface IKeep3rEscrow is IMintable {\n /// @notice Emitted when Keep3rEscrow#deposit function is called\n /// @param _wKP3R The addess of the wrapped KP3R token\n /// @param _sender The address that called the function\n /// @param _amount The amount of wKP3R the user deposited\n event wKP3RDeposited(address _wKP3R, address _sender, uint256 _amount);\n\n /// @notice Emitted when Keep3rEscrow#mint function is called\n /// @param _wKP3R The addess of the wrapped KP3R token\n /// @param _recipient The address that will received the newly minted wKP3R\n /// @param _amount The amount of wKP3R minted to the recipient\n event wKP3RMinted(address _wKP3R, address _recipient, uint256 _amount);\n\n /// @notice Emitted when Keep3rEscrow#setWKP3R function is called\n /// @param _newWKP3R The address of the wKP3R contract\n event wKP3RSet(address _newWKP3R);\n\n /// @notice Throws when minter attempts to withdraw more wKP3R than the escrow has in its balance\n error InsufficientBalance();\n\n /// @notice Lists the address of the wKP3R contract\n /// @return _wKP3RAddress The address of wKP3R\n function wKP3R() external view returns (address _wKP3RAddress);\n\n /// @notice Deposits wKP3R into the contract\n /// @param _amount The amount of wKP3R to deposit\n function deposit(uint256 _amount) external;\n\n /// @notice mints wKP3R to the recipient\n /// @param _amount The amount of wKP3R to mint\n function mint(uint256 _amount) external;\n\n /// @notice sets the wKP3R address\n /// @param _wKP3R the wKP3R address\n function setWKP3R(address _wKP3R) external;\n}\n" - }, - "solidity/interfaces/sidechain/IKeep3rHelperSidechain.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../IKeep3rHelper.sol';\n\n/// @title Keep3rHelperSidechain contract\n/// @notice Contains all the helper functions for sidechain keep3r implementations\ninterface IKeep3rHelperSidechain is IKeep3rHelper {\n // Events\n\n /// @notice The oracle for a liquidity has been saved\n /// @param _liquidity The address of the given liquidity\n /// @param _oraclePool The address of the oracle pool\n event OracleSet(address _liquidity, address _oraclePool);\n\n /// @notice Emitted when the WETH USD pool is changed\n /// @param _address Address of the new WETH USD pool\n /// @param _isWETHToken0 True if calling the token0 method of the pool returns the WETH token address\n event WethUSDPoolChange(address _address, bool _isWETHToken0);\n\n /// Variables\n\n /// @notice Ethereum mainnet WETH address used for quoting references\n /// @return _weth Address of WETH token\n // solhint-disable func-name-mixedcase\n function WETH() external view returns (address _weth);\n\n /// @return _oracle The address of the observable pool for given liquidity\n function oracle(address _liquidity) external view returns (address _oracle);\n\n /// @notice WETH-USD pool that is being used as oracle\n /// @return poolAddress Address of the pool\n /// @return isTKNToken0 True if calling the token0 method of the pool returns the WETH token address\n function wethUSDPool() external view returns (address poolAddress, bool isTKNToken0);\n\n /// @notice Quotes USD to ETH\n /// @dev Used to know how much ETH should be paid to keepers before converting it from ETH to KP3R\n /// @param _usd The amount of USD to quote to ETH\n /// @return _eth The resulting amount of ETH after quoting the USD\n function quoteUsdToEth(uint256 _usd) external returns (uint256 _eth);\n\n /// Methods\n\n /// @notice Sets an oracle for a given liquidity\n /// @param _liquidity The address of the liquidity\n /// @param _oracle The address of the pool used to quote the liquidity from\n /// @dev The oracle must contain KP3R as either token0 or token1\n function setOracle(address _liquidity, address _oracle) external;\n\n /// @notice Sets an oracle for querying WETH/USD quote\n /// @param _poolAddress The address of the pool used as oracle\n /// @dev The oracle must contain WETH as either token0 or token1\n function setWethUsdPool(address _poolAddress) external;\n}\n" - }, - "solidity/interfaces/sidechain/IKeep3rJobWorkableRated.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\n/// @title Keep3rJobWorkableRated contract\n/// @notice Implements a quoting in USD per gas unit for Keep3r jobs\ninterface IKeep3rJobWorkableRated {\n /// @notice Throws when job contract calls deprecated worked(address) function\n error Deprecated();\n\n /// @notice Implemented by jobs to show that a keeper performed work and reward in stable USD quote\n /// @dev Automatically calculates the payment for the keeper and pays the keeper with bonded KP3R\n /// @param _keeper Address of the keeper that performed the work\n /// @param _usdPerGasUnit Amount of USD in wei rewarded for gas unit worked by the keeper\n function worked(address _keeper, uint256 _usdPerGasUnit) external;\n}\n" - }, - "solidity/interfaces/peripherals/IMintable.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport './IGovernable.sol';\n\n/// @title Mintable contract\n/// @notice Manages the minter role\ninterface IMintable is IGovernable {\n // Events\n\n /// @notice Emitted when governance sets a new minter\n /// @param _minter Address of the new minter\n event MinterSet(address _minter);\n\n // Errors\n\n /// @notice Throws if the caller of the function is not the minter\n error OnlyMinter();\n\n // Variables\n\n /// @notice Stores the minter address\n /// @return _minter The minter addresss\n function minter() external view returns (address _minter);\n\n // Methods\n\n /// @notice Sets a new address to be the minter\n /// @param _minter The address set as the minter\n function setMinter(address _minter) external;\n}\n" - }, - "solidity/for-test/Keep3rSidechainForTest.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../contracts/sidechain/Keep3rSidechain.sol';\n\ncontract Keep3rSidechainForTest is Keep3rSidechain {\n using EnumerableSet for EnumerableSet.AddressSet;\n\n constructor(\n address _governance,\n address _keep3rHelper,\n address _wrappedKP3R,\n address _keep3rEscrow\n ) Keep3rSidechain(_governance, _keep3rHelper, _wrappedKP3R, _keep3rEscrow) {}\n\n function setJobLiquidity(address _job, address _liquidity) external {\n _jobLiquidities[_job].add(_liquidity);\n }\n}\n" - }, - "solidity/for-test/JobRatedForTest.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../interfaces/IKeep3r.sol';\nimport '../interfaces/sidechain/IKeep3rJobWorkableRated.sol';\n\ncontract JobRatedForTest {\n error InvalidKeeper();\n address public keep3r;\n uint256 public nonce;\n uint256 public usdPerGasUnit = 1_000e9;\n\n constructor(address _keep3r) {\n keep3r = _keep3r;\n }\n\n function work() external {\n if (!IKeep3r(keep3r).isKeeper(msg.sender)) revert InvalidKeeper();\n\n for (uint256 i = 0; i < 1000; i++) {\n nonce++;\n }\n\n IKeep3rJobWorkableRated(keep3r).worked(msg.sender, usdPerGasUnit);\n }\n\n function workHard(uint256 _factor) external {\n if (!IKeep3r(keep3r).isKeeper(msg.sender)) revert InvalidKeeper();\n\n for (uint256 i = 0; i < 1000 * _factor; i++) {\n nonce++;\n }\n\n IKeep3rJobWorkableRated(keep3r).worked(msg.sender, usdPerGasUnit);\n }\n}\n" - }, - "solidity/interfaces/IKeep3r.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport './peripherals/IKeep3rJobs.sol';\nimport './peripherals/IKeep3rKeepers.sol';\nimport './peripherals/IKeep3rAccountance.sol';\nimport './peripherals/IKeep3rRoles.sol';\nimport './peripherals/IKeep3rParameters.sol';\n\n// solhint-disable-next-line no-empty-blocks\n\n/// @title Keep3rV2 contract\n/// @notice This contract inherits all the functionality of Keep3rV2\ninterface IKeep3r is IKeep3rJobs, IKeep3rKeepers, IKeep3rAccountance, IKeep3rRoles, IKeep3rParameters {\n\n}\n" - }, - "solidity/for-test/JobForTest.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../interfaces/IKeep3r.sol';\n\ncontract JobForTest {\n error InvalidKeeper();\n address public keep3r;\n uint256 public nonce;\n\n constructor(address _keep3r) {\n keep3r = _keep3r;\n }\n\n function work() external {\n if (!IKeep3r(keep3r).isKeeper(msg.sender)) revert InvalidKeeper();\n\n for (uint256 i; i < 1000; i++) {\n nonce++;\n }\n\n IKeep3r(keep3r).worked(msg.sender);\n }\n\n function workHard(uint256 _factor) external {\n if (!IKeep3r(keep3r).isKeeper(msg.sender)) revert InvalidKeeper();\n\n for (uint256 i; i < 1000 * _factor; i++) {\n nonce++;\n }\n\n IKeep3r(keep3r).worked(msg.sender);\n }\n}\n" - }, - "solidity/for-test/BasicJob.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../interfaces/IKeep3r.sol';\n\ncontract BasicJob {\n error KeeperNotValid();\n\n address public keep3r;\n uint256 public nonce;\n uint256[] public array;\n\n constructor(address _keep3r) {\n keep3r = _keep3r;\n }\n\n function work() external upkeep {}\n\n function workHard(uint256 _howHard) external upkeep {\n for (uint256 i = nonce; i < _howHard; i++) {\n nonce++;\n }\n }\n\n function workRefund(uint256 _howHard) external upkeep {\n for (uint256 i; i < _howHard; i++) {\n array.push(i);\n }\n\n while (array.length > 0) {\n array.pop();\n }\n }\n\n modifier upkeep() {\n if (!IKeep3r(keep3r).isKeeper(msg.sender)) revert KeeperNotValid();\n _;\n IKeep3r(keep3r).worked(msg.sender);\n }\n}\n" - }, - "solidity/contracts/Keep3rHelperParameters.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.7 <0.9.0;\n\nimport './libraries/FullMath.sol';\nimport './libraries/TickMath.sol';\nimport '../interfaces/IKeep3r.sol';\nimport '../interfaces/external/IKeep3rV1.sol';\nimport '../interfaces/IKeep3rHelperParameters.sol';\nimport './peripherals/Governable.sol';\nimport './Keep3rHelperParameters.sol';\n\nimport '@openzeppelin/contracts/utils/math/Math.sol';\nimport '@uniswap/v3-core/contracts/interfaces/IUniswapV3Pool.sol';\n\ncontract Keep3rHelperParameters is IKeep3rHelperParameters, Governable {\n /// @inheritdoc IKeep3rHelperParameters\n address public constant override KP3R = 0x1cEB5cB57C4D4E2b2433641b95Dd330A33185A44;\n\n /// @inheritdoc IKeep3rHelperParameters\n uint256 public constant override BOOST_BASE = 10_000;\n\n /// @inheritdoc IKeep3rHelperParameters\n uint256 public override minBoost = 11_000;\n\n /// @inheritdoc IKeep3rHelperParameters\n uint256 public override maxBoost = 12_000;\n\n /// @inheritdoc IKeep3rHelperParameters\n uint256 public override targetBond = 200 ether;\n\n /// @inheritdoc IKeep3rHelperParameters\n uint256 public override workExtraGas = 50_000;\n\n /// @inheritdoc IKeep3rHelperParameters\n uint32 public override quoteTwapTime = 10 minutes;\n\n /// @inheritdoc IKeep3rHelperParameters\n uint256 public override minBaseFee = 15e9;\n\n /// @inheritdoc IKeep3rHelperParameters\n uint256 public override minPriorityFee = 2e9;\n\n /// @inheritdoc IKeep3rHelperParameters\n address public override keep3rV2;\n\n /// @inheritdoc IKeep3rHelperParameters\n IKeep3rHelperParameters.TokenOraclePool public override kp3rWethPool;\n\n constructor(\n address _keep3rV2,\n address _governance,\n address _kp3rWethPool\n ) Governable(_governance) {\n keep3rV2 = _keep3rV2;\n _setKp3rWethPool(_kp3rWethPool);\n }\n\n /// @inheritdoc IKeep3rHelperParameters\n function setKp3rWethPool(address _poolAddress) external override onlyGovernance {\n _setKp3rWethPool(_poolAddress);\n }\n\n /// @inheritdoc IKeep3rHelperParameters\n function setMinBoost(uint256 _minBoost) external override onlyGovernance {\n minBoost = _minBoost;\n emit MinBoostChange(minBoost);\n }\n\n /// @inheritdoc IKeep3rHelperParameters\n function setMaxBoost(uint256 _maxBoost) external override onlyGovernance {\n maxBoost = _maxBoost;\n emit MaxBoostChange(maxBoost);\n }\n\n /// @inheritdoc IKeep3rHelperParameters\n function setTargetBond(uint256 _targetBond) external override onlyGovernance {\n targetBond = _targetBond;\n emit TargetBondChange(targetBond);\n }\n\n /// @inheritdoc IKeep3rHelperParameters\n function setKeep3rV2(address _keep3rV2) external override onlyGovernance {\n keep3rV2 = _keep3rV2;\n emit Keep3rV2Change(keep3rV2);\n }\n\n /// @inheritdoc IKeep3rHelperParameters\n function setWorkExtraGas(uint256 _workExtraGas) external override onlyGovernance {\n workExtraGas = _workExtraGas;\n emit WorkExtraGasChange(workExtraGas);\n }\n\n /// @inheritdoc IKeep3rHelperParameters\n function setQuoteTwapTime(uint32 _quoteTwapTime) external override onlyGovernance {\n _setQuoteTwapTime(_quoteTwapTime);\n }\n\n function _setQuoteTwapTime(uint32 _quoteTwapTime) internal {\n quoteTwapTime = _quoteTwapTime;\n emit QuoteTwapTimeChange(quoteTwapTime);\n }\n\n /// @inheritdoc IKeep3rHelperParameters\n function setMinBaseFee(uint256 _minBaseFee) external override onlyGovernance {\n minBaseFee = _minBaseFee;\n emit MinBaseFeeChange(minBaseFee);\n }\n\n /// @inheritdoc IKeep3rHelperParameters\n function setMinPriorityFee(uint256 _minPriorityFee) external override onlyGovernance {\n minPriorityFee = _minPriorityFee;\n emit MinPriorityFeeChange(minPriorityFee);\n }\n\n /// @notice Sets KP3R-WETH pool\n /// @param _poolAddress The address of the KP3R-WETH pool\n function _setKp3rWethPool(address _poolAddress) internal {\n kp3rWethPool = _validateOraclePool(_poolAddress, KP3R);\n emit Kp3rWethPoolChange(kp3rWethPool.poolAddress, kp3rWethPool.isTKNToken0);\n }\n\n function _validateOraclePool(address _poolAddress, address _token) internal view virtual returns (TokenOraclePool memory _oraclePool) {\n bool _isTKNToken0 = IUniswapV3Pool(_poolAddress).token0() == _token;\n bool _isTKNToken1 = IUniswapV3Pool(_poolAddress).token1() == _token;\n\n if (!_isTKNToken0 && !_isTKNToken1) revert InvalidOraclePool();\n\n return TokenOraclePool(_poolAddress, _isTKNToken0);\n }\n}\n" - }, - "solidity/contracts/libraries/TickMath.sol": { - "content": "// SPDX-License-Identifier: GPL-2.0-or-later\npragma solidity >=0.5.0;\n\n// solhint-disable\n\n/// @title Math library for computing sqrt prices from ticks and vice versa\n/// @notice Computes sqrt price for ticks of size 1.0001, i.e. sqrt(1.0001^tick) as fixed point Q64.96 numbers. Supports\n/// prices between 2**-128 and 2**128\nlibrary TickMath {\n /// @dev The minimum tick that may be passed to #getSqrtRatioAtTick computed from log base 1.0001 of 2**-128\n int24 internal constant MIN_TICK = -887272;\n /// @dev The maximum tick that may be passed to #getSqrtRatioAtTick computed from log base 1.0001 of 2**128\n int24 internal constant MAX_TICK = -MIN_TICK;\n\n /// @dev The minimum value that can be returned from #getSqrtRatioAtTick. Equivalent to getSqrtRatioAtTick(MIN_TICK)\n uint160 internal constant MIN_SQRT_RATIO = 4295128739;\n /// @dev The maximum value that can be returned from #getSqrtRatioAtTick. Equivalent to getSqrtRatioAtTick(MAX_TICK)\n uint160 internal constant MAX_SQRT_RATIO = 1461446703485210103287273052203988822378723970342;\n\n /// @notice Calculates sqrt(1.0001^tick) * 2^96\n /// @dev Throws if |tick| > max tick\n /// @param tick The input tick for the above formula\n /// @return sqrtPriceX96 A Fixed point Q64.96 number representing the sqrt of the ratio of the two assets (token1/token0)\n /// at the given tick\n function getSqrtRatioAtTick(int24 tick) internal pure returns (uint160 sqrtPriceX96) {\n uint256 absTick = tick < 0 ? uint256(-int256(tick)) : uint256(int256(tick));\n require(absTick <= uint256(int256(MAX_TICK)), 'T');\n\n uint256 ratio = absTick & 0x1 != 0 ? 0xfffcb933bd6fad37aa2d162d1a594001 : 0x100000000000000000000000000000000;\n if (absTick & 0x2 != 0) ratio = (ratio * 0xfff97272373d413259a46990580e213a) >> 128;\n if (absTick & 0x4 != 0) ratio = (ratio * 0xfff2e50f5f656932ef12357cf3c7fdcc) >> 128;\n if (absTick & 0x8 != 0) ratio = (ratio * 0xffe5caca7e10e4e61c3624eaa0941cd0) >> 128;\n if (absTick & 0x10 != 0) ratio = (ratio * 0xffcb9843d60f6159c9db58835c926644) >> 128;\n if (absTick & 0x20 != 0) ratio = (ratio * 0xff973b41fa98c081472e6896dfb254c0) >> 128;\n if (absTick & 0x40 != 0) ratio = (ratio * 0xff2ea16466c96a3843ec78b326b52861) >> 128;\n if (absTick & 0x80 != 0) ratio = (ratio * 0xfe5dee046a99a2a811c461f1969c3053) >> 128;\n if (absTick & 0x100 != 0) ratio = (ratio * 0xfcbe86c7900a88aedcffc83b479aa3a4) >> 128;\n if (absTick & 0x200 != 0) ratio = (ratio * 0xf987a7253ac413176f2b074cf7815e54) >> 128;\n if (absTick & 0x400 != 0) ratio = (ratio * 0xf3392b0822b70005940c7a398e4b70f3) >> 128;\n if (absTick & 0x800 != 0) ratio = (ratio * 0xe7159475a2c29b7443b29c7fa6e889d9) >> 128;\n if (absTick & 0x1000 != 0) ratio = (ratio * 0xd097f3bdfd2022b8845ad8f792aa5825) >> 128;\n if (absTick & 0x2000 != 0) ratio = (ratio * 0xa9f746462d870fdf8a65dc1f90e061e5) >> 128;\n if (absTick & 0x4000 != 0) ratio = (ratio * 0x70d869a156d2a1b890bb3df62baf32f7) >> 128;\n if (absTick & 0x8000 != 0) ratio = (ratio * 0x31be135f97d08fd981231505542fcfa6) >> 128;\n if (absTick & 0x10000 != 0) ratio = (ratio * 0x9aa508b5b7a84e1c677de54f3e99bc9) >> 128;\n if (absTick & 0x20000 != 0) ratio = (ratio * 0x5d6af8dedb81196699c329225ee604) >> 128;\n if (absTick & 0x40000 != 0) ratio = (ratio * 0x2216e584f5fa1ea926041bedfe98) >> 128;\n if (absTick & 0x80000 != 0) ratio = (ratio * 0x48a170391f7dc42444e8fa2) >> 128;\n\n if (tick > 0) ratio = type(uint256).max / ratio;\n\n // Divides by 1<<32 rounding up to go from a Q128.128 to a Q128.96.\n // we then downcast because we know the result always fits within 160 bits due to our tick input constraint\n // we round up in the division so getTickAtSqrtRatio of the output price is always consistent\n sqrtPriceX96 = uint160((ratio >> 32) + (ratio % (1 << 32) == 0 ? 0 : 1));\n }\n\n /// @notice Calculates the greatest tick value such that getRatioAtTick(tick) <= ratio\n /// @dev Throws in case sqrtPriceX96 < MIN_SQRT_RATIO, as MIN_SQRT_RATIO is the lowest value getRatioAtTick may ever return.\n /// @param sqrtPriceX96 The sqrt ratio for which to compute the tick as a Q64.96\n /// @return tick The greatest tick for which the ratio is less than or equal to the input ratio\n function getTickAtSqrtRatio(uint160 sqrtPriceX96) internal pure returns (int24 tick) {\n // Second inequality must be < because the price can never reach the price at the max tick\n require(sqrtPriceX96 >= MIN_SQRT_RATIO && sqrtPriceX96 < MAX_SQRT_RATIO, 'R');\n uint256 ratio = uint256(sqrtPriceX96) << 32;\n\n uint256 r = ratio;\n uint256 msb = 0;\n\n assembly {\n let f := shl(7, gt(r, 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF))\n msb := or(msb, f)\n r := shr(f, r)\n }\n assembly {\n let f := shl(6, gt(r, 0xFFFFFFFFFFFFFFFF))\n msb := or(msb, f)\n r := shr(f, r)\n }\n assembly {\n let f := shl(5, gt(r, 0xFFFFFFFF))\n msb := or(msb, f)\n r := shr(f, r)\n }\n assembly {\n let f := shl(4, gt(r, 0xFFFF))\n msb := or(msb, f)\n r := shr(f, r)\n }\n assembly {\n let f := shl(3, gt(r, 0xFF))\n msb := or(msb, f)\n r := shr(f, r)\n }\n assembly {\n let f := shl(2, gt(r, 0xF))\n msb := or(msb, f)\n r := shr(f, r)\n }\n assembly {\n let f := shl(1, gt(r, 0x3))\n msb := or(msb, f)\n r := shr(f, r)\n }\n assembly {\n let f := gt(r, 0x1)\n msb := or(msb, f)\n }\n\n if (msb >= 128) r = ratio >> (msb - 127);\n else r = ratio << (127 - msb);\n\n int256 log_2 = (int256(msb) - 128) << 64;\n\n assembly {\n r := shr(127, mul(r, r))\n let f := shr(128, r)\n log_2 := or(log_2, shl(63, f))\n r := shr(f, r)\n }\n assembly {\n r := shr(127, mul(r, r))\n let f := shr(128, r)\n log_2 := or(log_2, shl(62, f))\n r := shr(f, r)\n }\n assembly {\n r := shr(127, mul(r, r))\n let f := shr(128, r)\n log_2 := or(log_2, shl(61, f))\n r := shr(f, r)\n }\n assembly {\n r := shr(127, mul(r, r))\n let f := shr(128, r)\n log_2 := or(log_2, shl(60, f))\n r := shr(f, r)\n }\n assembly {\n r := shr(127, mul(r, r))\n let f := shr(128, r)\n log_2 := or(log_2, shl(59, f))\n r := shr(f, r)\n }\n assembly {\n r := shr(127, mul(r, r))\n let f := shr(128, r)\n log_2 := or(log_2, shl(58, f))\n r := shr(f, r)\n }\n assembly {\n r := shr(127, mul(r, r))\n let f := shr(128, r)\n log_2 := or(log_2, shl(57, f))\n r := shr(f, r)\n }\n assembly {\n r := shr(127, mul(r, r))\n let f := shr(128, r)\n log_2 := or(log_2, shl(56, f))\n r := shr(f, r)\n }\n assembly {\n r := shr(127, mul(r, r))\n let f := shr(128, r)\n log_2 := or(log_2, shl(55, f))\n r := shr(f, r)\n }\n assembly {\n r := shr(127, mul(r, r))\n let f := shr(128, r)\n log_2 := or(log_2, shl(54, f))\n r := shr(f, r)\n }\n assembly {\n r := shr(127, mul(r, r))\n let f := shr(128, r)\n log_2 := or(log_2, shl(53, f))\n r := shr(f, r)\n }\n assembly {\n r := shr(127, mul(r, r))\n let f := shr(128, r)\n log_2 := or(log_2, shl(52, f))\n r := shr(f, r)\n }\n assembly {\n r := shr(127, mul(r, r))\n let f := shr(128, r)\n log_2 := or(log_2, shl(51, f))\n r := shr(f, r)\n }\n assembly {\n r := shr(127, mul(r, r))\n let f := shr(128, r)\n log_2 := or(log_2, shl(50, f))\n }\n\n int256 log_sqrt10001 = log_2 * 255738958999603826347141; // 128.128 number\n\n int24 tickLow = int24((log_sqrt10001 - 3402992956809132418596140100660247210) >> 128);\n int24 tickHi = int24((log_sqrt10001 + 291339464771989622907027621153398088495) >> 128);\n\n tick = tickLow == tickHi ? tickLow : getSqrtRatioAtTick(tickHi) <= sqrtPriceX96 ? tickHi : tickLow;\n }\n}\n" - }, - "solidity/interfaces/IKeep3rHelperParameters.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\n/// @title Keep3rHelperParameters contract\n/// @notice Contains all the helper functions used throughout the different files.\ninterface IKeep3rHelperParameters {\n // Structs\n\n /// @dev KP3R-WETH Pool address and isKP3RToken0\n /// @dev Created in order to save gas by avoiding calls to pool's token0 method\n struct TokenOraclePool {\n address poolAddress;\n bool isTKNToken0;\n }\n\n // Errors\n\n /// @notice Throws when pool does not have KP3R as token0 nor token1\n error InvalidOraclePool();\n\n // Events\n\n /// @notice Emitted when the kp3r weth pool is changed\n /// @param _address Address of the new kp3r weth pool\n /// @param _isKP3RToken0 True if calling the token0 method of the pool returns the KP3R token address\n event Kp3rWethPoolChange(address _address, bool _isKP3RToken0);\n\n /// @notice Emitted when the minimum boost multiplier is changed\n /// @param _minBoost The minimum boost multiplier\n event MinBoostChange(uint256 _minBoost);\n\n /// @notice Emitted when the maximum boost multiplier is changed\n /// @param _maxBoost The maximum boost multiplier\n event MaxBoostChange(uint256 _maxBoost);\n\n /// @notice Emitted when the target bond amount is changed\n /// @param _targetBond The target bond amount\n event TargetBondChange(uint256 _targetBond);\n\n /// @notice Emitted when the Keep3r V2 address is changed\n /// @param _keep3rV2 The address of Keep3r V2\n event Keep3rV2Change(address _keep3rV2);\n\n /// @notice Emitted when the work extra gas amount is changed\n /// @param _workExtraGas The work extra gas\n event WorkExtraGasChange(uint256 _workExtraGas);\n\n /// @notice Emitted when the quote twap time is changed\n /// @param _quoteTwapTime The twap time for quoting\n event QuoteTwapTimeChange(uint32 _quoteTwapTime);\n\n /// @notice Emitted when minimum rewarded gas fee is changed\n /// @param _minBaseFee The minimum rewarded gas fee\n event MinBaseFeeChange(uint256 _minBaseFee);\n\n /// @notice Emitted when minimum rewarded priority fee is changed\n /// @param _minPriorityFee The minimum expected fee that the keeper should pay\n event MinPriorityFeeChange(uint256 _minPriorityFee);\n\n // Variables\n\n /// @notice Address of KP3R token\n /// @return _kp3r Address of KP3R token\n // solhint-disable func-name-mixedcase\n function KP3R() external view returns (address _kp3r);\n\n /// @notice The boost base used to calculate the boost rewards for the keeper\n /// @return _base The boost base number\n function BOOST_BASE() external view returns (uint256 _base);\n\n /// @notice KP3R-WETH pool that is being used as oracle\n /// @return poolAddress Address of the pool\n /// @return isTKNToken0 True if calling the token0 method of the pool returns the KP3R token address\n function kp3rWethPool() external view returns (address poolAddress, bool isTKNToken0);\n\n /// @notice The minimum multiplier used to calculate the amount of gas paid to the Keeper for the gas used to perform a job\n /// For example: if the quoted gas used is 1000, then the minimum amount to be paid will be 1000 * minBoost / BOOST_BASE\n /// @return _multiplier The minimum boost multiplier\n function minBoost() external view returns (uint256 _multiplier);\n\n /// @notice The maximum multiplier used to calculate the amount of gas paid to the Keeper for the gas used to perform a job\n /// For example: if the quoted gas used is 1000, then the maximum amount to be paid will be 1000 * maxBoost / BOOST_BASE\n /// @return _multiplier The maximum boost multiplier\n function maxBoost() external view returns (uint256 _multiplier);\n\n /// @notice The targeted amount of bonded KP3Rs to max-up reward multiplier\n /// For example: if the amount of KP3R the keeper has bonded is targetBond or more, then the keeper will get\n /// the maximum boost possible in his rewards, if it's less, the reward boost will be proportional\n /// @return _target The amount of KP3R that comforms the targetBond\n function targetBond() external view returns (uint256 _target);\n\n /// @notice The amount of unaccounted gas that is going to be added to keeper payments\n /// @return _workExtraGas The work unaccounted gas amount\n function workExtraGas() external view returns (uint256 _workExtraGas);\n\n /// @notice The twap time for quoting\n /// @return _quoteTwapTime The twap time\n function quoteTwapTime() external view returns (uint32 _quoteTwapTime);\n\n /// @notice The minimum base fee that is used to calculate keeper rewards\n /// @return _minBaseFee The minimum rewarded gas fee\n function minBaseFee() external view returns (uint256 _minBaseFee);\n\n /// @notice The minimum priority fee that is also rewarded for keepers\n /// @return _minPriorityFee The minimum rewarded priority fee\n function minPriorityFee() external view returns (uint256 _minPriorityFee);\n\n /// @notice Address of Keep3r V2\n /// @return _keep3rV2 Address of Keep3r V2\n function keep3rV2() external view returns (address _keep3rV2);\n\n // Methods\n\n /// @notice Sets KP3R-WETH pool\n /// @param _poolAddress The address of the KP3R-WETH pool\n function setKp3rWethPool(address _poolAddress) external;\n\n /// @notice Sets the minimum boost multiplier\n /// @param _minBoost The minimum boost multiplier\n function setMinBoost(uint256 _minBoost) external;\n\n /// @notice Sets the maximum boost multiplier\n /// @param _maxBoost The maximum boost multiplier\n function setMaxBoost(uint256 _maxBoost) external;\n\n /// @notice Sets the target bond amount\n /// @param _targetBond The target bond amount\n function setTargetBond(uint256 _targetBond) external;\n\n /// @notice Sets the Keep3r V2 address\n /// @param _keep3rV2 The address of Keep3r V2\n function setKeep3rV2(address _keep3rV2) external;\n\n /// @notice Sets the work extra gas amount\n /// @param _workExtraGas The work extra gas\n function setWorkExtraGas(uint256 _workExtraGas) external;\n\n /// @notice Sets the quote twap time\n /// @param _quoteTwapTime The twap time for quoting\n function setQuoteTwapTime(uint32 _quoteTwapTime) external;\n\n /// @notice Sets the minimum rewarded gas fee\n /// @param _minBaseFee The minimum rewarded gas fee\n function setMinBaseFee(uint256 _minBaseFee) external;\n\n /// @notice Sets the minimum rewarded gas priority fee\n /// @param _minPriorityFee The minimum rewarded priority fee\n function setMinPriorityFee(uint256 _minPriorityFee) external;\n}\n" - }, - "@uniswap/v3-core/contracts/interfaces/IUniswapV3Pool.sol": { - "content": "// SPDX-License-Identifier: GPL-2.0-or-later\npragma solidity >=0.5.0;\n\nimport './pool/IUniswapV3PoolImmutables.sol';\nimport './pool/IUniswapV3PoolState.sol';\nimport './pool/IUniswapV3PoolDerivedState.sol';\nimport './pool/IUniswapV3PoolActions.sol';\nimport './pool/IUniswapV3PoolOwnerActions.sol';\nimport './pool/IUniswapV3PoolEvents.sol';\n\n/// @title The interface for a Uniswap V3 Pool\n/// @notice A Uniswap pool facilitates swapping and automated market making between any two assets that strictly conform\n/// to the ERC20 specification\n/// @dev The pool interface is broken up into many smaller pieces\ninterface IUniswapV3Pool is\n IUniswapV3PoolImmutables,\n IUniswapV3PoolState,\n IUniswapV3PoolDerivedState,\n IUniswapV3PoolActions,\n IUniswapV3PoolOwnerActions,\n IUniswapV3PoolEvents\n{\n\n}\n" - }, - "@uniswap/v3-core/contracts/interfaces/pool/IUniswapV3PoolImmutables.sol": { - "content": "// SPDX-License-Identifier: GPL-2.0-or-later\npragma solidity >=0.5.0;\n\n/// @title Pool state that never changes\n/// @notice These parameters are fixed for a pool forever, i.e., the methods will always return the same values\ninterface IUniswapV3PoolImmutables {\n /// @notice The contract that deployed the pool, which must adhere to the IUniswapV3Factory interface\n /// @return The contract address\n function factory() external view returns (address);\n\n /// @notice The first of the two tokens of the pool, sorted by address\n /// @return The token contract address\n function token0() external view returns (address);\n\n /// @notice The second of the two tokens of the pool, sorted by address\n /// @return The token contract address\n function token1() external view returns (address);\n\n /// @notice The pool's fee in hundredths of a bip, i.e. 1e-6\n /// @return The fee\n function fee() external view returns (uint24);\n\n /// @notice The pool tick spacing\n /// @dev Ticks can only be used at multiples of this value, minimum of 1 and always positive\n /// e.g.: a tickSpacing of 3 means ticks can be initialized every 3rd tick, i.e., ..., -6, -3, 0, 3, 6, ...\n /// This value is an int24 to avoid casting even though it is always positive.\n /// @return The tick spacing\n function tickSpacing() external view returns (int24);\n\n /// @notice The maximum amount of position liquidity that can use any tick in the range\n /// @dev This parameter is enforced per tick to prevent liquidity from overflowing a uint128 at any point, and\n /// also prevents out-of-range liquidity from being used to prevent adding in-range liquidity to a pool\n /// @return The max amount of liquidity per tick\n function maxLiquidityPerTick() external view returns (uint128);\n}\n" - }, - "@uniswap/v3-core/contracts/interfaces/pool/IUniswapV3PoolState.sol": { - "content": "// SPDX-License-Identifier: GPL-2.0-or-later\npragma solidity >=0.5.0;\n\n/// @title Pool state that can change\n/// @notice These methods compose the pool's state, and can change with any frequency including multiple times\n/// per transaction\ninterface IUniswapV3PoolState {\n /// @notice The 0th storage slot in the pool stores many values, and is exposed as a single method to save gas\n /// when accessed externally.\n /// @return sqrtPriceX96 The current price of the pool as a sqrt(token1/token0) Q64.96 value\n /// tick The current tick of the pool, i.e. according to the last tick transition that was run.\n /// This value may not always be equal to SqrtTickMath.getTickAtSqrtRatio(sqrtPriceX96) if the price is on a tick\n /// boundary.\n /// observationIndex The index of the last oracle observation that was written,\n /// observationCardinality The current maximum number of observations stored in the pool,\n /// observationCardinalityNext The next maximum number of observations, to be updated when the observation.\n /// feeProtocol The protocol fee for both tokens of the pool.\n /// Encoded as two 4 bit values, where the protocol fee of token1 is shifted 4 bits and the protocol fee of token0\n /// is the lower 4 bits. Used as the denominator of a fraction of the swap fee, e.g. 4 means 1/4th of the swap fee.\n /// unlocked Whether the pool is currently locked to reentrancy\n function slot0()\n external\n view\n returns (\n uint160 sqrtPriceX96,\n int24 tick,\n uint16 observationIndex,\n uint16 observationCardinality,\n uint16 observationCardinalityNext,\n uint8 feeProtocol,\n bool unlocked\n );\n\n /// @notice The fee growth as a Q128.128 fees of token0 collected per unit of liquidity for the entire life of the pool\n /// @dev This value can overflow the uint256\n function feeGrowthGlobal0X128() external view returns (uint256);\n\n /// @notice The fee growth as a Q128.128 fees of token1 collected per unit of liquidity for the entire life of the pool\n /// @dev This value can overflow the uint256\n function feeGrowthGlobal1X128() external view returns (uint256);\n\n /// @notice The amounts of token0 and token1 that are owed to the protocol\n /// @dev Protocol fees will never exceed uint128 max in either token\n function protocolFees() external view returns (uint128 token0, uint128 token1);\n\n /// @notice The currently in range liquidity available to the pool\n /// @dev This value has no relationship to the total liquidity across all ticks\n function liquidity() external view returns (uint128);\n\n /// @notice Look up information about a specific tick in the pool\n /// @param tick The tick to look up\n /// @return liquidityGross the total amount of position liquidity that uses the pool either as tick lower or\n /// tick upper,\n /// liquidityNet how much liquidity changes when the pool price crosses the tick,\n /// feeGrowthOutside0X128 the fee growth on the other side of the tick from the current tick in token0,\n /// feeGrowthOutside1X128 the fee growth on the other side of the tick from the current tick in token1,\n /// tickCumulativeOutside the cumulative tick value on the other side of the tick from the current tick\n /// secondsPerLiquidityOutsideX128 the seconds spent per liquidity on the other side of the tick from the current tick,\n /// secondsOutside the seconds spent on the other side of the tick from the current tick,\n /// initialized Set to true if the tick is initialized, i.e. liquidityGross is greater than 0, otherwise equal to false.\n /// Outside values can only be used if the tick is initialized, i.e. if liquidityGross is greater than 0.\n /// In addition, these values are only relative and must be used only in comparison to previous snapshots for\n /// a specific position.\n function ticks(int24 tick)\n external\n view\n returns (\n uint128 liquidityGross,\n int128 liquidityNet,\n uint256 feeGrowthOutside0X128,\n uint256 feeGrowthOutside1X128,\n int56 tickCumulativeOutside,\n uint160 secondsPerLiquidityOutsideX128,\n uint32 secondsOutside,\n bool initialized\n );\n\n /// @notice Returns 256 packed tick initialized boolean values. See TickBitmap for more information\n function tickBitmap(int16 wordPosition) external view returns (uint256);\n\n /// @notice Returns the information about a position by the position's key\n /// @param key The position's key is a hash of a preimage composed by the owner, tickLower and tickUpper\n /// @return _liquidity The amount of liquidity in the position,\n /// Returns feeGrowthInside0LastX128 fee growth of token0 inside the tick range as of the last mint/burn/poke,\n /// Returns feeGrowthInside1LastX128 fee growth of token1 inside the tick range as of the last mint/burn/poke,\n /// Returns tokensOwed0 the computed amount of token0 owed to the position as of the last mint/burn/poke,\n /// Returns tokensOwed1 the computed amount of token1 owed to the position as of the last mint/burn/poke\n function positions(bytes32 key)\n external\n view\n returns (\n uint128 _liquidity,\n uint256 feeGrowthInside0LastX128,\n uint256 feeGrowthInside1LastX128,\n uint128 tokensOwed0,\n uint128 tokensOwed1\n );\n\n /// @notice Returns data about a specific observation index\n /// @param index The element of the observations array to fetch\n /// @dev You most likely want to use #observe() instead of this method to get an observation as of some amount of time\n /// ago, rather than at a specific index in the array.\n /// @return blockTimestamp The timestamp of the observation,\n /// Returns tickCumulative the tick multiplied by seconds elapsed for the life of the pool as of the observation timestamp,\n /// Returns secondsPerLiquidityCumulativeX128 the seconds per in range liquidity for the life of the pool as of the observation timestamp,\n /// Returns initialized whether the observation has been initialized and the values are safe to use\n function observations(uint256 index)\n external\n view\n returns (\n uint32 blockTimestamp,\n int56 tickCumulative,\n uint160 secondsPerLiquidityCumulativeX128,\n bool initialized\n );\n}\n" - }, - "@uniswap/v3-core/contracts/interfaces/pool/IUniswapV3PoolDerivedState.sol": { - "content": "// SPDX-License-Identifier: GPL-2.0-or-later\npragma solidity >=0.5.0;\n\n/// @title Pool state that is not stored\n/// @notice Contains view functions to provide information about the pool that is computed rather than stored on the\n/// blockchain. The functions here may have variable gas costs.\ninterface IUniswapV3PoolDerivedState {\n /// @notice Returns the cumulative tick and liquidity as of each timestamp `secondsAgo` from the current block timestamp\n /// @dev To get a time weighted average tick or liquidity-in-range, you must call this with two values, one representing\n /// the beginning of the period and another for the end of the period. E.g., to get the last hour time-weighted average tick,\n /// you must call it with secondsAgos = [3600, 0].\n /// @dev The time weighted average tick represents the geometric time weighted average price of the pool, in\n /// log base sqrt(1.0001) of token1 / token0. The TickMath library can be used to go from a tick value to a ratio.\n /// @param secondsAgos From how long ago each cumulative tick and liquidity value should be returned\n /// @return tickCumulatives Cumulative tick values as of each `secondsAgos` from the current block timestamp\n /// @return secondsPerLiquidityCumulativeX128s Cumulative seconds per liquidity-in-range value as of each `secondsAgos` from the current block\n /// timestamp\n function observe(uint32[] calldata secondsAgos)\n external\n view\n returns (int56[] memory tickCumulatives, uint160[] memory secondsPerLiquidityCumulativeX128s);\n\n /// @notice Returns a snapshot of the tick cumulative, seconds per liquidity and seconds inside a tick range\n /// @dev Snapshots must only be compared to other snapshots, taken over a period for which a position existed.\n /// I.e., snapshots cannot be compared if a position is not held for the entire period between when the first\n /// snapshot is taken and the second snapshot is taken.\n /// @param tickLower The lower tick of the range\n /// @param tickUpper The upper tick of the range\n /// @return tickCumulativeInside The snapshot of the tick accumulator for the range\n /// @return secondsPerLiquidityInsideX128 The snapshot of seconds per liquidity for the range\n /// @return secondsInside The snapshot of seconds per liquidity for the range\n function snapshotCumulativesInside(int24 tickLower, int24 tickUpper)\n external\n view\n returns (\n int56 tickCumulativeInside,\n uint160 secondsPerLiquidityInsideX128,\n uint32 secondsInside\n );\n}\n" - }, - "@uniswap/v3-core/contracts/interfaces/pool/IUniswapV3PoolActions.sol": { - "content": "// SPDX-License-Identifier: GPL-2.0-or-later\npragma solidity >=0.5.0;\n\n/// @title Permissionless pool actions\n/// @notice Contains pool methods that can be called by anyone\ninterface IUniswapV3PoolActions {\n /// @notice Sets the initial price for the pool\n /// @dev Price is represented as a sqrt(amountToken1/amountToken0) Q64.96 value\n /// @param sqrtPriceX96 the initial sqrt price of the pool as a Q64.96\n function initialize(uint160 sqrtPriceX96) external;\n\n /// @notice Adds liquidity for the given recipient/tickLower/tickUpper position\n /// @dev The caller of this method receives a callback in the form of IUniswapV3MintCallback#uniswapV3MintCallback\n /// in which they must pay any token0 or token1 owed for the liquidity. The amount of token0/token1 due depends\n /// on tickLower, tickUpper, the amount of liquidity, and the current price.\n /// @param recipient The address for which the liquidity will be created\n /// @param tickLower The lower tick of the position in which to add liquidity\n /// @param tickUpper The upper tick of the position in which to add liquidity\n /// @param amount The amount of liquidity to mint\n /// @param data Any data that should be passed through to the callback\n /// @return amount0 The amount of token0 that was paid to mint the given amount of liquidity. Matches the value in the callback\n /// @return amount1 The amount of token1 that was paid to mint the given amount of liquidity. Matches the value in the callback\n function mint(\n address recipient,\n int24 tickLower,\n int24 tickUpper,\n uint128 amount,\n bytes calldata data\n ) external returns (uint256 amount0, uint256 amount1);\n\n /// @notice Collects tokens owed to a position\n /// @dev Does not recompute fees earned, which must be done either via mint or burn of any amount of liquidity.\n /// Collect must be called by the position owner. To withdraw only token0 or only token1, amount0Requested or\n /// amount1Requested may be set to zero. To withdraw all tokens owed, caller may pass any value greater than the\n /// actual tokens owed, e.g. type(uint128).max. Tokens owed may be from accumulated swap fees or burned liquidity.\n /// @param recipient The address which should receive the fees collected\n /// @param tickLower The lower tick of the position for which to collect fees\n /// @param tickUpper The upper tick of the position for which to collect fees\n /// @param amount0Requested How much token0 should be withdrawn from the fees owed\n /// @param amount1Requested How much token1 should be withdrawn from the fees owed\n /// @return amount0 The amount of fees collected in token0\n /// @return amount1 The amount of fees collected in token1\n function collect(\n address recipient,\n int24 tickLower,\n int24 tickUpper,\n uint128 amount0Requested,\n uint128 amount1Requested\n ) external returns (uint128 amount0, uint128 amount1);\n\n /// @notice Burn liquidity from the sender and account tokens owed for the liquidity to the position\n /// @dev Can be used to trigger a recalculation of fees owed to a position by calling with an amount of 0\n /// @dev Fees must be collected separately via a call to #collect\n /// @param tickLower The lower tick of the position for which to burn liquidity\n /// @param tickUpper The upper tick of the position for which to burn liquidity\n /// @param amount How much liquidity to burn\n /// @return amount0 The amount of token0 sent to the recipient\n /// @return amount1 The amount of token1 sent to the recipient\n function burn(\n int24 tickLower,\n int24 tickUpper,\n uint128 amount\n ) external returns (uint256 amount0, uint256 amount1);\n\n /// @notice Swap token0 for token1, or token1 for token0\n /// @dev The caller of this method receives a callback in the form of IUniswapV3SwapCallback#uniswapV3SwapCallback\n /// @param recipient The address to receive the output of the swap\n /// @param zeroForOne The direction of the swap, true for token0 to token1, false for token1 to token0\n /// @param amountSpecified The amount of the swap, which implicitly configures the swap as exact input (positive), or exact output (negative)\n /// @param sqrtPriceLimitX96 The Q64.96 sqrt price limit. If zero for one, the price cannot be less than this\n /// value after the swap. If one for zero, the price cannot be greater than this value after the swap\n /// @param data Any data to be passed through to the callback\n /// @return amount0 The delta of the balance of token0 of the pool, exact when negative, minimum when positive\n /// @return amount1 The delta of the balance of token1 of the pool, exact when negative, minimum when positive\n function swap(\n address recipient,\n bool zeroForOne,\n int256 amountSpecified,\n uint160 sqrtPriceLimitX96,\n bytes calldata data\n ) external returns (int256 amount0, int256 amount1);\n\n /// @notice Receive token0 and/or token1 and pay it back, plus a fee, in the callback\n /// @dev The caller of this method receives a callback in the form of IUniswapV3FlashCallback#uniswapV3FlashCallback\n /// @dev Can be used to donate underlying tokens pro-rata to currently in-range liquidity providers by calling\n /// with 0 amount{0,1} and sending the donation amount(s) from the callback\n /// @param recipient The address which will receive the token0 and token1 amounts\n /// @param amount0 The amount of token0 to send\n /// @param amount1 The amount of token1 to send\n /// @param data Any data to be passed through to the callback\n function flash(\n address recipient,\n uint256 amount0,\n uint256 amount1,\n bytes calldata data\n ) external;\n\n /// @notice Increase the maximum number of price and liquidity observations that this pool will store\n /// @dev This method is no-op if the pool already has an observationCardinalityNext greater than or equal to\n /// the input observationCardinalityNext.\n /// @param observationCardinalityNext The desired minimum number of observations for the pool to store\n function increaseObservationCardinalityNext(uint16 observationCardinalityNext) external;\n}\n" - }, - "@uniswap/v3-core/contracts/interfaces/pool/IUniswapV3PoolOwnerActions.sol": { - "content": "// SPDX-License-Identifier: GPL-2.0-or-later\npragma solidity >=0.5.0;\n\n/// @title Permissioned pool actions\n/// @notice Contains pool methods that may only be called by the factory owner\ninterface IUniswapV3PoolOwnerActions {\n /// @notice Set the denominator of the protocol's % share of the fees\n /// @param feeProtocol0 new protocol fee for token0 of the pool\n /// @param feeProtocol1 new protocol fee for token1 of the pool\n function setFeeProtocol(uint8 feeProtocol0, uint8 feeProtocol1) external;\n\n /// @notice Collect the protocol fee accrued to the pool\n /// @param recipient The address to which collected protocol fees should be sent\n /// @param amount0Requested The maximum amount of token0 to send, can be 0 to collect fees in only token1\n /// @param amount1Requested The maximum amount of token1 to send, can be 0 to collect fees in only token0\n /// @return amount0 The protocol fee collected in token0\n /// @return amount1 The protocol fee collected in token1\n function collectProtocol(\n address recipient,\n uint128 amount0Requested,\n uint128 amount1Requested\n ) external returns (uint128 amount0, uint128 amount1);\n}\n" - }, - "@uniswap/v3-core/contracts/interfaces/pool/IUniswapV3PoolEvents.sol": { - "content": "// SPDX-License-Identifier: GPL-2.0-or-later\npragma solidity >=0.5.0;\n\n/// @title Events emitted by a pool\n/// @notice Contains all events emitted by the pool\ninterface IUniswapV3PoolEvents {\n /// @notice Emitted exactly once by a pool when #initialize is first called on the pool\n /// @dev Mint/Burn/Swap cannot be emitted by the pool before Initialize\n /// @param sqrtPriceX96 The initial sqrt price of the pool, as a Q64.96\n /// @param tick The initial tick of the pool, i.e. log base 1.0001 of the starting price of the pool\n event Initialize(uint160 sqrtPriceX96, int24 tick);\n\n /// @notice Emitted when liquidity is minted for a given position\n /// @param sender The address that minted the liquidity\n /// @param owner The owner of the position and recipient of any minted liquidity\n /// @param tickLower The lower tick of the position\n /// @param tickUpper The upper tick of the position\n /// @param amount The amount of liquidity minted to the position range\n /// @param amount0 How much token0 was required for the minted liquidity\n /// @param amount1 How much token1 was required for the minted liquidity\n event Mint(\n address sender,\n address indexed owner,\n int24 indexed tickLower,\n int24 indexed tickUpper,\n uint128 amount,\n uint256 amount0,\n uint256 amount1\n );\n\n /// @notice Emitted when fees are collected by the owner of a position\n /// @dev Collect events may be emitted with zero amount0 and amount1 when the caller chooses not to collect fees\n /// @param owner The owner of the position for which fees are collected\n /// @param tickLower The lower tick of the position\n /// @param tickUpper The upper tick of the position\n /// @param amount0 The amount of token0 fees collected\n /// @param amount1 The amount of token1 fees collected\n event Collect(\n address indexed owner,\n address recipient,\n int24 indexed tickLower,\n int24 indexed tickUpper,\n uint128 amount0,\n uint128 amount1\n );\n\n /// @notice Emitted when a position's liquidity is removed\n /// @dev Does not withdraw any fees earned by the liquidity position, which must be withdrawn via #collect\n /// @param owner The owner of the position for which liquidity is removed\n /// @param tickLower The lower tick of the position\n /// @param tickUpper The upper tick of the position\n /// @param amount The amount of liquidity to remove\n /// @param amount0 The amount of token0 withdrawn\n /// @param amount1 The amount of token1 withdrawn\n event Burn(\n address indexed owner,\n int24 indexed tickLower,\n int24 indexed tickUpper,\n uint128 amount,\n uint256 amount0,\n uint256 amount1\n );\n\n /// @notice Emitted by the pool for any swaps between token0 and token1\n /// @param sender The address that initiated the swap call, and that received the callback\n /// @param recipient The address that received the output of the swap\n /// @param amount0 The delta of the token0 balance of the pool\n /// @param amount1 The delta of the token1 balance of the pool\n /// @param sqrtPriceX96 The sqrt(price) of the pool after the swap, as a Q64.96\n /// @param liquidity The liquidity of the pool after the swap\n /// @param tick The log base 1.0001 of price of the pool after the swap\n event Swap(\n address indexed sender,\n address indexed recipient,\n int256 amount0,\n int256 amount1,\n uint160 sqrtPriceX96,\n uint128 liquidity,\n int24 tick\n );\n\n /// @notice Emitted by the pool for any flashes of token0/token1\n /// @param sender The address that initiated the swap call, and that received the callback\n /// @param recipient The address that received the tokens from flash\n /// @param amount0 The amount of token0 that was flashed\n /// @param amount1 The amount of token1 that was flashed\n /// @param paid0 The amount of token0 paid for the flash, which can exceed the amount0 plus the fee\n /// @param paid1 The amount of token1 paid for the flash, which can exceed the amount1 plus the fee\n event Flash(\n address indexed sender,\n address indexed recipient,\n uint256 amount0,\n uint256 amount1,\n uint256 paid0,\n uint256 paid1\n );\n\n /// @notice Emitted by the pool for increases to the number of observations that can be stored\n /// @dev observationCardinalityNext is not the observation cardinality until an observation is written at the index\n /// just before a mint/swap/burn.\n /// @param observationCardinalityNextOld The previous value of the next observation cardinality\n /// @param observationCardinalityNextNew The updated value of the next observation cardinality\n event IncreaseObservationCardinalityNext(\n uint16 observationCardinalityNextOld,\n uint16 observationCardinalityNextNew\n );\n\n /// @notice Emitted when the protocol fee is changed by the pool\n /// @param feeProtocol0Old The previous value of the token0 protocol fee\n /// @param feeProtocol1Old The previous value of the token1 protocol fee\n /// @param feeProtocol0New The updated value of the token0 protocol fee\n /// @param feeProtocol1New The updated value of the token1 protocol fee\n event SetFeeProtocol(uint8 feeProtocol0Old, uint8 feeProtocol1Old, uint8 feeProtocol0New, uint8 feeProtocol1New);\n\n /// @notice Emitted when the collected protocol fees are withdrawn by the factory owner\n /// @param sender The address that collects the protocol fees\n /// @param recipient The address that receives the collected protocol fees\n /// @param amount0 The amount of token0 protocol fees that is withdrawn\n /// @param amount0 The amount of token1 protocol fees that is withdrawn\n event CollectProtocol(address indexed sender, address indexed recipient, uint128 amount0, uint128 amount1);\n}\n" - }, - "solidity/for-test/UniV3PairManagerForTest.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '@openzeppelin/contracts/token/ERC20/ERC20.sol';\nimport '@uniswap/v3-core/contracts/interfaces/IUniswapV3Pool.sol';\n\nimport '../contracts/libraries/LiquidityAmounts.sol';\nimport '../contracts/libraries/PoolAddress.sol';\nimport '../contracts/libraries/FixedPoint96.sol';\nimport '../contracts/libraries/FullMath.sol';\nimport '../contracts/libraries/TickMath.sol';\nimport '../contracts/UniV3PairManager.sol';\nimport '../interfaces/external/IWeth9.sol';\nimport '../interfaces/IUniV3PairManager.sol';\n\ncontract UniV3PairManagerForTest is UniV3PairManager {\n constructor(address _pool, address _governance) UniV3PairManager(_pool, _governance) {}\n\n function internalAddLiquidity(\n uint256 amount0Desired,\n uint256 amount1Desired,\n uint256 amount0Min,\n uint256 amount1Min\n )\n external\n returns (\n uint128 liquidity,\n uint256 amount0,\n uint256 amount1\n )\n {\n return _addLiquidity(amount0Desired, amount1Desired, amount0Min, amount1Min);\n }\n\n function internalPay(\n address token,\n address payer,\n address recipient,\n uint256 value\n ) external {\n return _pay(token, payer, recipient, value);\n }\n\n function internalMint(address dst, uint256 amount) external {\n return _mint(dst, amount);\n }\n\n function internalBurn(address dst, uint256 amount) external {\n return _burn(dst, amount);\n }\n\n function internalTransferTokens(\n address src,\n address dst,\n uint256 amount\n ) external {\n _transferTokens(src, dst, amount);\n }\n\n function internalSafeTransferFrom(\n address token,\n address from,\n address to,\n uint256 value\n ) external {\n _safeTransferFrom(token, from, to, value);\n }\n\n receive() external payable {}\n}\n" - }, - "@openzeppelin/contracts/token/ERC20/ERC20.sol": { - "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\nimport \"./IERC20.sol\";\nimport \"./extensions/IERC20Metadata.sol\";\nimport \"../../utils/Context.sol\";\n\n/**\n * @dev Implementation of the {IERC20} interface.\n *\n * This implementation is agnostic to the way tokens are created. This means\n * that a supply mechanism has to be added in a derived contract using {_mint}.\n * For a generic mechanism see {ERC20PresetMinterPauser}.\n *\n * TIP: For a detailed writeup see our guide\n * https://forum.zeppelin.solutions/t/how-to-implement-erc20-supply-mechanisms/226[How\n * to implement supply mechanisms].\n *\n * We have followed general OpenZeppelin Contracts guidelines: functions revert\n * instead returning `false` on failure. This behavior is nonetheless\n * conventional and does not conflict with the expectations of ERC20\n * applications.\n *\n * Additionally, an {Approval} event is emitted on calls to {transferFrom}.\n * This allows applications to reconstruct the allowance for all accounts just\n * by listening to said events. Other implementations of the EIP may not emit\n * these events, as it isn't required by the specification.\n *\n * Finally, the non-standard {decreaseAllowance} and {increaseAllowance}\n * functions have been added to mitigate the well-known issues around setting\n * allowances. See {IERC20-approve}.\n */\ncontract ERC20 is Context, IERC20, IERC20Metadata {\n mapping(address => uint256) private _balances;\n\n mapping(address => mapping(address => uint256)) private _allowances;\n\n uint256 private _totalSupply;\n\n string private _name;\n string private _symbol;\n\n /**\n * @dev Sets the values for {name} and {symbol}.\n *\n * The default value of {decimals} is 18. To select a different value for\n * {decimals} you should overload it.\n *\n * All two of these values are immutable: they can only be set once during\n * construction.\n */\n constructor(string memory name_, string memory symbol_) {\n _name = name_;\n _symbol = symbol_;\n }\n\n /**\n * @dev Returns the name of the token.\n */\n function name() public view virtual override returns (string memory) {\n return _name;\n }\n\n /**\n * @dev Returns the symbol of the token, usually a shorter version of the\n * name.\n */\n function symbol() public view virtual override returns (string memory) {\n return _symbol;\n }\n\n /**\n * @dev Returns the number of decimals used to get its user representation.\n * For example, if `decimals` equals `2`, a balance of `505` tokens should\n * be displayed to a user as `5.05` (`505 / 10 ** 2`).\n *\n * Tokens usually opt for a value of 18, imitating the relationship between\n * Ether and Wei. This is the value {ERC20} uses, unless this function is\n * overridden;\n *\n * NOTE: This information is only used for _display_ purposes: it in\n * no way affects any of the arithmetic of the contract, including\n * {IERC20-balanceOf} and {IERC20-transfer}.\n */\n function decimals() public view virtual override returns (uint8) {\n return 18;\n }\n\n /**\n * @dev See {IERC20-totalSupply}.\n */\n function totalSupply() public view virtual override returns (uint256) {\n return _totalSupply;\n }\n\n /**\n * @dev See {IERC20-balanceOf}.\n */\n function balanceOf(address account) public view virtual override returns (uint256) {\n return _balances[account];\n }\n\n /**\n * @dev See {IERC20-transfer}.\n *\n * Requirements:\n *\n * - `recipient` cannot be the zero address.\n * - the caller must have a balance of at least `amount`.\n */\n function transfer(address recipient, uint256 amount) public virtual override returns (bool) {\n _transfer(_msgSender(), recipient, amount);\n return true;\n }\n\n /**\n * @dev See {IERC20-allowance}.\n */\n function allowance(address owner, address spender) public view virtual override returns (uint256) {\n return _allowances[owner][spender];\n }\n\n /**\n * @dev See {IERC20-approve}.\n *\n * Requirements:\n *\n * - `spender` cannot be the zero address.\n */\n function approve(address spender, uint256 amount) public virtual override returns (bool) {\n _approve(_msgSender(), spender, amount);\n return true;\n }\n\n /**\n * @dev See {IERC20-transferFrom}.\n *\n * Emits an {Approval} event indicating the updated allowance. This is not\n * required by the EIP. See the note at the beginning of {ERC20}.\n *\n * Requirements:\n *\n * - `sender` and `recipient` cannot be the zero address.\n * - `sender` must have a balance of at least `amount`.\n * - the caller must have allowance for ``sender``'s tokens of at least\n * `amount`.\n */\n function transferFrom(\n address sender,\n address recipient,\n uint256 amount\n ) public virtual override returns (bool) {\n _transfer(sender, recipient, amount);\n\n uint256 currentAllowance = _allowances[sender][_msgSender()];\n require(currentAllowance >= amount, \"ERC20: transfer amount exceeds allowance\");\n unchecked {\n _approve(sender, _msgSender(), currentAllowance - amount);\n }\n\n return true;\n }\n\n /**\n * @dev Atomically increases the allowance granted to `spender` by the caller.\n *\n * This is an alternative to {approve} that can be used as a mitigation for\n * problems described in {IERC20-approve}.\n *\n * Emits an {Approval} event indicating the updated allowance.\n *\n * Requirements:\n *\n * - `spender` cannot be the zero address.\n */\n function increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool) {\n _approve(_msgSender(), spender, _allowances[_msgSender()][spender] + addedValue);\n return true;\n }\n\n /**\n * @dev Atomically decreases the allowance granted to `spender` by the caller.\n *\n * This is an alternative to {approve} that can be used as a mitigation for\n * problems described in {IERC20-approve}.\n *\n * Emits an {Approval} event indicating the updated allowance.\n *\n * Requirements:\n *\n * - `spender` cannot be the zero address.\n * - `spender` must have allowance for the caller of at least\n * `subtractedValue`.\n */\n function decreaseAllowance(address spender, uint256 subtractedValue) public virtual returns (bool) {\n uint256 currentAllowance = _allowances[_msgSender()][spender];\n require(currentAllowance >= subtractedValue, \"ERC20: decreased allowance below zero\");\n unchecked {\n _approve(_msgSender(), spender, currentAllowance - subtractedValue);\n }\n\n return true;\n }\n\n /**\n * @dev Moves `amount` of tokens from `sender` to `recipient`.\n *\n * This internal function is equivalent to {transfer}, and can be used to\n * e.g. implement automatic token fees, slashing mechanisms, etc.\n *\n * Emits a {Transfer} event.\n *\n * Requirements:\n *\n * - `sender` cannot be the zero address.\n * - `recipient` cannot be the zero address.\n * - `sender` must have a balance of at least `amount`.\n */\n function _transfer(\n address sender,\n address recipient,\n uint256 amount\n ) internal virtual {\n require(sender != address(0), \"ERC20: transfer from the zero address\");\n require(recipient != address(0), \"ERC20: transfer to the zero address\");\n\n _beforeTokenTransfer(sender, recipient, amount);\n\n uint256 senderBalance = _balances[sender];\n require(senderBalance >= amount, \"ERC20: transfer amount exceeds balance\");\n unchecked {\n _balances[sender] = senderBalance - amount;\n }\n _balances[recipient] += amount;\n\n emit Transfer(sender, recipient, amount);\n\n _afterTokenTransfer(sender, recipient, amount);\n }\n\n /** @dev Creates `amount` tokens and assigns them to `account`, increasing\n * the total supply.\n *\n * Emits a {Transfer} event with `from` set to the zero address.\n *\n * Requirements:\n *\n * - `account` cannot be the zero address.\n */\n function _mint(address account, uint256 amount) internal virtual {\n require(account != address(0), \"ERC20: mint to the zero address\");\n\n _beforeTokenTransfer(address(0), account, amount);\n\n _totalSupply += amount;\n _balances[account] += amount;\n emit Transfer(address(0), account, amount);\n\n _afterTokenTransfer(address(0), account, amount);\n }\n\n /**\n * @dev Destroys `amount` tokens from `account`, reducing the\n * total supply.\n *\n * Emits a {Transfer} event with `to` set to the zero address.\n *\n * Requirements:\n *\n * - `account` cannot be the zero address.\n * - `account` must have at least `amount` tokens.\n */\n function _burn(address account, uint256 amount) internal virtual {\n require(account != address(0), \"ERC20: burn from the zero address\");\n\n _beforeTokenTransfer(account, address(0), amount);\n\n uint256 accountBalance = _balances[account];\n require(accountBalance >= amount, \"ERC20: burn amount exceeds balance\");\n unchecked {\n _balances[account] = accountBalance - amount;\n }\n _totalSupply -= amount;\n\n emit Transfer(account, address(0), amount);\n\n _afterTokenTransfer(account, address(0), amount);\n }\n\n /**\n * @dev Sets `amount` as the allowance of `spender` over the `owner` s tokens.\n *\n * This internal function is equivalent to `approve`, and can be used to\n * e.g. set automatic allowances for certain subsystems, etc.\n *\n * Emits an {Approval} event.\n *\n * Requirements:\n *\n * - `owner` cannot be the zero address.\n * - `spender` cannot be the zero address.\n */\n function _approve(\n address owner,\n address spender,\n uint256 amount\n ) internal virtual {\n require(owner != address(0), \"ERC20: approve from the zero address\");\n require(spender != address(0), \"ERC20: approve to the zero address\");\n\n _allowances[owner][spender] = amount;\n emit Approval(owner, spender, amount);\n }\n\n /**\n * @dev Hook that is called before any transfer of tokens. This includes\n * minting and burning.\n *\n * Calling conditions:\n *\n * - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens\n * will be transferred to `to`.\n * - when `from` is zero, `amount` tokens will be minted for `to`.\n * - when `to` is zero, `amount` of ``from``'s tokens will be burned.\n * - `from` and `to` are never both zero.\n *\n * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].\n */\n function _beforeTokenTransfer(\n address from,\n address to,\n uint256 amount\n ) internal virtual {}\n\n /**\n * @dev Hook that is called after any transfer of tokens. This includes\n * minting and burning.\n *\n * Calling conditions:\n *\n * - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens\n * has been transferred to `to`.\n * - when `from` is zero, `amount` tokens have been minted for `to`.\n * - when `to` is zero, `amount` of ``from``'s tokens have been burned.\n * - `from` and `to` are never both zero.\n *\n * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].\n */\n function _afterTokenTransfer(\n address from,\n address to,\n uint256 amount\n ) internal virtual {}\n}\n" - }, - "solidity/contracts/libraries/LiquidityAmounts.sol": { - "content": "// SPDX-License-Identifier: GPL-2.0-or-later\npragma solidity >=0.8.4 <0.9.0;\n\nimport './FullMath.sol';\nimport './FixedPoint96.sol';\n\n// solhint-disable\nlibrary LiquidityAmounts {\n function toUint128(uint256 x) private pure returns (uint128 y) {\n require((y = uint128(x)) == x);\n }\n\n function getLiquidityForAmount0(\n uint160 sqrtRatioAX96,\n uint160 sqrtRatioBX96,\n uint256 amount0\n ) internal pure returns (uint128 liquidity) {\n if (sqrtRatioAX96 > sqrtRatioBX96) (sqrtRatioAX96, sqrtRatioBX96) = (sqrtRatioBX96, sqrtRatioAX96);\n uint256 intermediate = FullMath.mulDiv(sqrtRatioAX96, sqrtRatioBX96, FixedPoint96.Q96);\n return toUint128(FullMath.mulDiv(amount0, intermediate, sqrtRatioBX96 - sqrtRatioAX96));\n }\n\n function getLiquidityForAmount1(\n uint160 sqrtRatioAX96,\n uint160 sqrtRatioBX96,\n uint256 amount1\n ) internal pure returns (uint128 liquidity) {\n if (sqrtRatioAX96 > sqrtRatioBX96) (sqrtRatioAX96, sqrtRatioBX96) = (sqrtRatioBX96, sqrtRatioAX96);\n return toUint128(FullMath.mulDiv(amount1, FixedPoint96.Q96, sqrtRatioBX96 - sqrtRatioAX96));\n }\n\n function getLiquidityForAmounts(\n uint160 sqrtRatioX96,\n uint160 sqrtRatioAX96,\n uint160 sqrtRatioBX96,\n uint256 amount0,\n uint256 amount1\n ) internal pure returns (uint128 liquidity) {\n if (sqrtRatioAX96 > sqrtRatioBX96) (sqrtRatioAX96, sqrtRatioBX96) = (sqrtRatioBX96, sqrtRatioAX96);\n\n if (sqrtRatioX96 <= sqrtRatioAX96) {\n liquidity = getLiquidityForAmount0(sqrtRatioAX96, sqrtRatioBX96, amount0);\n } else if (sqrtRatioX96 < sqrtRatioBX96) {\n uint128 liquidity0 = getLiquidityForAmount0(sqrtRatioX96, sqrtRatioBX96, amount0);\n uint128 liquidity1 = getLiquidityForAmount1(sqrtRatioAX96, sqrtRatioX96, amount1);\n\n liquidity = liquidity0 < liquidity1 ? liquidity0 : liquidity1;\n } else {\n liquidity = getLiquidityForAmount1(sqrtRatioAX96, sqrtRatioBX96, amount1);\n }\n }\n\n function getAmount0ForLiquidity(\n uint160 sqrtRatioAX96,\n uint160 sqrtRatioBX96,\n uint128 liquidity\n ) internal pure returns (uint256 amount0) {\n if (sqrtRatioAX96 > sqrtRatioBX96) (sqrtRatioAX96, sqrtRatioBX96) = (sqrtRatioBX96, sqrtRatioAX96);\n\n return FullMath.mulDiv(uint256(liquidity) << FixedPoint96.RESOLUTION, sqrtRatioBX96 - sqrtRatioAX96, sqrtRatioBX96) / sqrtRatioAX96;\n }\n\n function getAmount1ForLiquidity(\n uint160 sqrtRatioAX96,\n uint160 sqrtRatioBX96,\n uint128 liquidity\n ) internal pure returns (uint256 amount1) {\n if (sqrtRatioAX96 > sqrtRatioBX96) (sqrtRatioAX96, sqrtRatioBX96) = (sqrtRatioBX96, sqrtRatioAX96);\n\n return FullMath.mulDiv(liquidity, sqrtRatioBX96 - sqrtRatioAX96, FixedPoint96.Q96);\n }\n\n function getAmountsForLiquidity(\n uint160 sqrtRatioX96,\n uint160 sqrtRatioAX96,\n uint160 sqrtRatioBX96,\n uint128 liquidity\n ) internal pure returns (uint256 amount0, uint256 amount1) {\n if (sqrtRatioAX96 > sqrtRatioBX96) (sqrtRatioAX96, sqrtRatioBX96) = (sqrtRatioBX96, sqrtRatioAX96);\n\n if (sqrtRatioX96 <= sqrtRatioAX96) {\n amount0 = getAmount0ForLiquidity(sqrtRatioAX96, sqrtRatioBX96, liquidity);\n } else if (sqrtRatioX96 < sqrtRatioBX96) {\n amount0 = getAmount0ForLiquidity(sqrtRatioX96, sqrtRatioBX96, liquidity);\n amount1 = getAmount1ForLiquidity(sqrtRatioAX96, sqrtRatioX96, liquidity);\n } else {\n amount1 = getAmount1ForLiquidity(sqrtRatioAX96, sqrtRatioBX96, liquidity);\n }\n }\n}\n" - }, - "solidity/contracts/libraries/PoolAddress.sol": { - "content": "// SPDX-License-Identifier: GPL-2.0-or-later\npragma solidity >=0.8.4 <0.9.0;\n\nlibrary PoolAddress {\n struct PoolKey {\n address token0;\n address token1;\n uint24 fee;\n }\n}\n" - }, - "solidity/contracts/libraries/FixedPoint96.sol": { - "content": "// SPDX-License-Identifier: GPL-2.0-or-later\npragma solidity >=0.8.4 <0.9.0;\n\nlibrary FixedPoint96 {\n // solhint-disable\n uint8 internal constant RESOLUTION = 96;\n uint256 internal constant Q96 = 0x1000000000000000000000000;\n}\n" - }, - "solidity/contracts/UniV3PairManager.sol": { - "content": "// SPDX-License-Identifier: MIT\n\n/*\n\nCoded for The Keep3r Network with ♥ by\n\n██████╗░███████╗███████╗██╗  ░██╗░░░░░░░██╗░█████╗░███╗░░██╗██████╗░███████╗██████╗░██╗░░░░░░█████╗░███╗░░██╗██████╗░\n██╔══██╗██╔════╝██╔════╝██║  ░██║░░██╗░░██║██╔══██╗████╗░██║██╔══██╗██╔════╝██╔══██╗██║░░░░░██╔══██╗████╗░██║██╔══██╗\n██║░░██║█████╗░░█████╗░░██║  ░╚██╗████╗██╔╝██║░░██║██╔██╗██║██║░░██║█████╗░░██████╔╝██║░░░░░███████║██╔██╗██║██║░░██║\n██║░░██║██╔══╝░░██╔══╝░░██║  ░░████╔═████║░██║░░██║██║╚████║██║░░██║██╔══╝░░██╔══██╗██║░░░░░██╔══██║██║╚████║██║░░██║\n██████╔╝███████╗██║░░░░░██║  ░░╚██╔╝░╚██╔╝░╚█████╔╝██║░╚███║██████╔╝███████╗██║░░██║███████╗██║░░██║██║░╚███║██████╔╝\n╚═════╝░╚══════╝╚═╝░░░░░╚═╝  ░░░╚═╝░░░╚═╝░░░╚════╝░╚═╝░░╚══╝╚═════╝░╚══════╝╚═╝░░╚═╝╚══════╝╚═╝░░╚═╝╚═╝░░╚══╝╚═════╝░\n\nhttps://defi.sucks\n\n*/\n\npragma solidity >=0.8.4 <0.9.0;\n\nimport '@openzeppelin/contracts/token/ERC20/ERC20.sol';\nimport '@uniswap/v3-core/contracts/interfaces/IUniswapV3Pool.sol';\n\nimport './libraries/LiquidityAmounts.sol';\nimport './libraries/PoolAddress.sol';\nimport './libraries/FixedPoint96.sol';\nimport './libraries/FullMath.sol';\nimport './libraries/TickMath.sol';\n\nimport '../interfaces/external/IWeth9.sol';\nimport '../interfaces/IUniV3PairManager.sol';\n\nimport './peripherals/Governable.sol';\n\ncontract UniV3PairManager is IUniV3PairManager, Governable {\n /// @inheritdoc IERC20Metadata\n string public override name;\n\n /// @inheritdoc IERC20Metadata\n string public override symbol;\n\n /// @inheritdoc IERC20\n uint256 public override totalSupply;\n\n /// @inheritdoc IPairManager\n address public immutable override factory;\n\n /// @inheritdoc IPairManager\n address public immutable override token0;\n\n /// @inheritdoc IPairManager\n address public immutable override token1;\n\n /// @inheritdoc IPairManager\n address public immutable override pool;\n\n /// @inheritdoc IUniV3PairManager\n uint24 public immutable override fee;\n\n /// @inheritdoc IUniV3PairManager\n uint160 public immutable override sqrtRatioAX96;\n\n /// @inheritdoc IUniV3PairManager\n uint160 public immutable override sqrtRatioBX96;\n\n /// @inheritdoc IUniV3PairManager\n int24 public immutable override tickLower;\n\n /// @inheritdoc IUniV3PairManager\n int24 public immutable override tickUpper;\n\n /// @inheritdoc IUniV3PairManager\n int24 public immutable override tickSpacing;\n\n /// @notice Uniswap's maximum tick\n /// @dev Due to tick spacing, pools with different fees may have differences between _MAX_TICK and tickUpper. Use tickUpper to find the max tick of the pool.\n int24 private constant _MAX_TICK = 887272;\n\n /// @inheritdoc IERC20Metadata\n //solhint-disable-next-line const-name-snakecase\n uint8 public constant override decimals = 18;\n\n /// @inheritdoc IERC20\n mapping(address => mapping(address => uint256)) public override allowance;\n\n /// @inheritdoc IERC20\n mapping(address => uint256) public override balanceOf;\n\n /// @notice Struct that contains token0, token1, and fee of the Uniswap pool\n PoolAddress.PoolKey private _poolKey;\n\n constructor(address _pool, address _governance) Governable(_governance) {\n uint24 _fee = IUniswapV3Pool(_pool).fee();\n address _token0 = IUniswapV3Pool(_pool).token0();\n address _token1 = IUniswapV3Pool(_pool).token1();\n int24 _tickSpacing = IUniswapV3Pool(_pool).tickSpacing();\n int24 _tickUpper = _MAX_TICK - (_MAX_TICK % _tickSpacing);\n int24 _tickLower = -_tickUpper;\n\n factory = msg.sender;\n pool = _pool;\n fee = _fee;\n tickSpacing = _tickSpacing;\n tickUpper = _tickUpper;\n tickLower = _tickLower;\n token0 = _token0;\n token1 = _token1;\n name = string(abi.encodePacked('Keep3rLP - ', ERC20(_token0).symbol(), '/', ERC20(_token1).symbol()));\n symbol = string(abi.encodePacked('kLP-', ERC20(_token0).symbol(), '/', ERC20(_token1).symbol()));\n\n sqrtRatioAX96 = TickMath.getSqrtRatioAtTick(_tickLower);\n sqrtRatioBX96 = TickMath.getSqrtRatioAtTick(_tickUpper);\n _poolKey = PoolAddress.PoolKey({token0: _token0, token1: _token1, fee: _fee});\n }\n\n // This low-level function should be called from a contract which performs important safety checks\n /// @inheritdoc IUniV3PairManager\n function mint(\n uint256 amount0Desired,\n uint256 amount1Desired,\n uint256 amount0Min,\n uint256 amount1Min,\n address to\n ) external override returns (uint128 liquidity) {\n (liquidity, , ) = _addLiquidity(amount0Desired, amount1Desired, amount0Min, amount1Min);\n _mint(to, liquidity);\n }\n\n /// @inheritdoc IUniV3PairManager\n function uniswapV3MintCallback(\n uint256 amount0Owed,\n uint256 amount1Owed,\n bytes calldata data\n ) external override {\n MintCallbackData memory decoded = abi.decode(data, (MintCallbackData));\n if (msg.sender != pool) revert OnlyPool();\n if (amount0Owed > 0) _pay(decoded._poolKey.token0, decoded.payer, pool, amount0Owed);\n if (amount1Owed > 0) _pay(decoded._poolKey.token1, decoded.payer, pool, amount1Owed);\n }\n\n /// @inheritdoc IUniV3PairManager\n function burn(\n uint128 liquidity,\n uint256 amount0Min,\n uint256 amount1Min,\n address to\n ) external override returns (uint256 amount0, uint256 amount1) {\n (amount0, amount1) = IUniswapV3Pool(pool).burn(tickLower, tickUpper, liquidity);\n\n if (amount0 < amount0Min || amount1 < amount1Min) revert ExcessiveSlippage();\n\n IUniswapV3Pool(pool).collect(to, tickLower, tickUpper, uint128(amount0), uint128(amount1));\n _burn(msg.sender, liquidity);\n }\n\n /// @inheritdoc IUniV3PairManager\n function collect() external override onlyGovernance returns (uint256 amount0, uint256 amount1) {\n (, , , uint128 tokensOwed0, uint128 tokensOwed1) = IUniswapV3Pool(pool).positions(\n keccak256(abi.encodePacked(address(this), tickLower, tickUpper))\n );\n (amount0, amount1) = IUniswapV3Pool(pool).collect(governance, tickLower, tickUpper, tokensOwed0, tokensOwed1);\n }\n\n /// @inheritdoc IUniV3PairManager\n function position()\n external\n view\n override\n returns (\n uint128 liquidity,\n uint256 feeGrowthInside0LastX128,\n uint256 feeGrowthInside1LastX128,\n uint128 tokensOwed0,\n uint128 tokensOwed1\n )\n {\n (liquidity, feeGrowthInside0LastX128, feeGrowthInside1LastX128, tokensOwed0, tokensOwed1) = IUniswapV3Pool(pool).positions(\n keccak256(abi.encodePacked(address(this), tickLower, tickUpper))\n );\n }\n\n /// @inheritdoc IERC20\n function approve(address spender, uint256 amount) external override returns (bool) {\n allowance[msg.sender][spender] = amount;\n\n emit Approval(msg.sender, spender, amount);\n return true;\n }\n\n /// @inheritdoc IERC20\n function transfer(address to, uint256 amount) external override returns (bool) {\n _transferTokens(msg.sender, to, amount);\n return true;\n }\n\n /// @inheritdoc IERC20\n function transferFrom(\n address from,\n address to,\n uint256 amount\n ) external override returns (bool) {\n address spender = msg.sender;\n uint256 spenderAllowance = allowance[from][spender];\n\n if (spender != from && spenderAllowance != type(uint256).max) {\n uint256 newAllowance = spenderAllowance - amount;\n allowance[from][spender] = newAllowance;\n\n emit Approval(from, spender, newAllowance);\n }\n\n _transferTokens(from, to, amount);\n return true;\n }\n\n /// @notice Adds liquidity to an initialized pool\n /// @dev Reverts if the returned amount0 is less than amount0Min or if amount1 is less than amount1Min\n /// @dev This function calls the mint function of the corresponding Uniswap pool, which in turn calls UniswapV3Callback\n /// @param amount0Desired The amount of token0 we would like to provide\n /// @param amount1Desired The amount of token1 we would like to provide\n /// @param amount0Min The minimum amount of token0 we want to provide\n /// @param amount1Min The minimum amount of token1 we want to provide\n /// @return liquidity The calculated liquidity we get for the token amounts we provided\n /// @return amount0 The amount of token0 we ended up providing\n /// @return amount1 The amount of token1 we ended up providing\n function _addLiquidity(\n uint256 amount0Desired,\n uint256 amount1Desired,\n uint256 amount0Min,\n uint256 amount1Min\n )\n internal\n returns (\n uint128 liquidity,\n uint256 amount0,\n uint256 amount1\n )\n {\n (uint160 sqrtPriceX96, , , , , , ) = IUniswapV3Pool(pool).slot0();\n\n liquidity = LiquidityAmounts.getLiquidityForAmounts(sqrtPriceX96, sqrtRatioAX96, sqrtRatioBX96, amount0Desired, amount1Desired);\n\n (amount0, amount1) = IUniswapV3Pool(pool).mint(\n address(this),\n tickLower,\n tickUpper,\n liquidity,\n abi.encode(MintCallbackData({_poolKey: _poolKey, payer: msg.sender}))\n );\n\n if (amount0 < amount0Min || amount1 < amount1Min) revert ExcessiveSlippage();\n }\n\n /// @notice Transfers the passed-in token from the payer to the recipient for the corresponding value\n /// @param token The token to be transferred to the recipient\n /// @param from The address of the payer\n /// @param to The address of the passed-in tokens recipient\n /// @param value How much of that token to be transferred from payer to the recipient\n function _pay(\n address token,\n address from,\n address to,\n uint256 value\n ) internal {\n _safeTransferFrom(token, from, to, value);\n }\n\n /// @notice Mints Keep3r credits to the passed-in address of recipient and increases total supply of Keep3r credits by the corresponding amount\n /// @param to The recipient of the Keep3r credits\n /// @param amount The amount Keep3r credits to be minted to the recipient\n function _mint(address to, uint256 amount) internal {\n totalSupply += amount;\n balanceOf[to] += amount;\n emit Transfer(address(0), to, amount);\n }\n\n /// @notice Burns Keep3r credits to the passed-in address of recipient and reduces total supply of Keep3r credits by the corresponding amount\n /// @param to The address that will get its Keep3r credits burned\n /// @param amount The amount Keep3r credits to be burned from the recipient/recipient\n function _burn(address to, uint256 amount) internal {\n totalSupply -= amount;\n balanceOf[to] -= amount;\n emit Transfer(to, address(0), amount);\n }\n\n /// @notice Transfers amount of Keep3r credits between two addresses\n /// @param from The user that transfers the Keep3r credits\n /// @param to The user that receives the Keep3r credits\n /// @param amount The amount of Keep3r credits to be transferred\n function _transferTokens(\n address from,\n address to,\n uint256 amount\n ) internal {\n balanceOf[from] -= amount;\n balanceOf[to] += amount;\n\n emit Transfer(from, to, amount);\n }\n\n /// @notice Transfers the passed-in token from the specified \"from\" to the specified \"to\" for the corresponding value\n /// @dev Reverts with IUniV3PairManager#UnsuccessfulTransfer if the transfer was not successful,\n /// or if the passed data length is different than 0 and the decoded data is not a boolean\n /// @param token The token to be transferred to the specified \"to\"\n /// @param from The address which is going to transfer the tokens\n /// @param value How much of that token to be transferred from \"from\" to \"to\"\n function _safeTransferFrom(\n address token,\n address from,\n address to,\n uint256 value\n ) internal {\n // solhint-disable-next-line avoid-low-level-calls\n (bool success, bytes memory data) = token.call(abi.encodeWithSelector(IERC20.transferFrom.selector, from, to, value));\n if (!success || (data.length != 0 && !abi.decode(data, (bool)))) revert UnsuccessfulTransfer();\n }\n}\n" - }, - "solidity/interfaces/external/IWeth9.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '@openzeppelin/contracts/token/ERC20/IERC20.sol';\n\ninterface IWeth9 is IERC20 {\n function deposit() external payable;\n\n function withdraw(uint256) external;\n}\n" - }, - "solidity/interfaces/IUniV3PairManager.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport './IPairManager.sol';\nimport '../contracts/libraries/PoolAddress.sol';\nimport '@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol';\nimport './peripherals/IGovernable.sol';\n\n/// @title Pair Manager contract\n/// @notice Creates a UniswapV3 position, and tokenizes in an ERC20 manner\n/// so that the user can use it as liquidity for a Keep3rJob\ninterface IUniV3PairManager is IGovernable, IPairManager {\n // Structs\n\n /// @notice The data to be decoded by the UniswapV3MintCallback function\n struct MintCallbackData {\n PoolAddress.PoolKey _poolKey; // Struct that contains token0, token1, and fee of the pool passed into the constructor\n address payer; // The address of the payer, which will be the msg.sender of the mint function\n }\n\n // Variables\n\n /// @notice The fee of the Uniswap pool passed into the constructor\n /// @return _fee The fee of the Uniswap pool passed into the constructor\n function fee() external view returns (uint24 _fee);\n\n /// @notice Highest tick in the Uniswap's curve\n /// @return _tickUpper The highest tick in the Uniswap's curve\n function tickUpper() external view returns (int24 _tickUpper);\n\n /// @notice Lowest tick in the Uniswap's curve\n /// @return _tickLower The lower tick in the Uniswap's curve\n function tickLower() external view returns (int24 _tickLower);\n\n /// @notice The pair tick spacing\n /// @return _tickSpacing The pair tick spacing\n function tickSpacing() external view returns (int24 _tickSpacing);\n\n /// @notice The sqrtRatioAX96 at the lowest tick (-887200) of the Uniswap pool\n /// @return _sqrtPriceA96 A Fixed point Q64.96 number representing the sqrt of the ratio of the two assets (token1/token0)\n /// at the lowest tick\n function sqrtRatioAX96() external view returns (uint160 _sqrtPriceA96);\n\n /// @notice The sqrtRatioBX96 at the highest tick (887200) of the Uniswap pool\n /// @return _sqrtPriceBX96 A Fixed point Q64.96 number representing the sqrt of the ratio of the two assets (token1/token0)\n /// at the highest tick\n function sqrtRatioBX96() external view returns (uint160 _sqrtPriceBX96);\n\n // Errors\n\n /// @notice Throws when the caller of the function is not the pool\n error OnlyPool();\n\n /// @notice Throws when the slippage exceeds what the user is comfortable with\n error ExcessiveSlippage();\n\n /// @notice Throws when a transfer is unsuccessful\n error UnsuccessfulTransfer();\n\n // Methods\n\n /// @notice This function is called after a user calls IUniV3PairManager#mint function\n /// It ensures that any tokens owed to the pool are paid by the msg.sender of IUniV3PairManager#mint function\n /// @param amount0Owed The amount of token0 due to the pool for the minted liquidity\n /// @param amount1Owed The amount of token1 due to the pool for the minted liquidity\n /// @param data The encoded token0, token1, fee (_poolKey) and the payer (msg.sender) of the IUniV3PairManager#mint function\n function uniswapV3MintCallback(\n uint256 amount0Owed,\n uint256 amount1Owed,\n bytes calldata data\n ) external;\n\n /// @notice Mints kLP tokens to an address according to the liquidity the msg.sender provides to the UniswapV3 pool\n /// @dev Triggers UniV3PairManager#uniswapV3MintCallback\n /// @param amount0Desired The amount of token0 we would like to provide\n /// @param amount1Desired The amount of token1 we would like to provide\n /// @param amount0Min The minimum amount of token0 we want to provide\n /// @param amount1Min The minimum amount of token1 we want to provide\n /// @param to The address to which the kLP tokens are going to be minted to\n /// @return liquidity kLP tokens sent in exchange for the provision of tokens\n function mint(\n uint256 amount0Desired,\n uint256 amount1Desired,\n uint256 amount0Min,\n uint256 amount1Min,\n address to\n ) external returns (uint128 liquidity);\n\n /// @notice Returns the pair manager's position in the corresponding UniswapV3 pool\n /// @return liquidity The amount of liquidity provided to the UniswapV3 pool by the pair manager\n /// @return feeGrowthInside0LastX128 The fee growth of token0 as of the last action on the individual position\n /// @return feeGrowthInside1LastX128 The fee growth of token1 as of the last action on the individual position\n /// @return tokensOwed0 The uncollected amount of token0 owed to the position as of the last computation\n /// @return tokensOwed1 The uncollected amount of token1 owed to the position as of the last computation\n function position()\n external\n view\n returns (\n uint128 liquidity,\n uint256 feeGrowthInside0LastX128,\n uint256 feeGrowthInside1LastX128,\n uint128 tokensOwed0,\n uint128 tokensOwed1\n );\n\n /// @notice Calls the UniswapV3 pool's collect function, which collects up to a maximum amount of fees\n // owed to a specific position to the recipient, in this case, that recipient is the pair manager\n /// @dev The collected fees will be sent to governance\n /// @return amount0 The amount of fees collected in token0\n /// @return amount1 The amount of fees collected in token1\n function collect() external returns (uint256 amount0, uint256 amount1);\n\n /// @notice Burns the corresponding amount of kLP tokens from the msg.sender and withdraws the specified liquidity\n // in the entire range\n /// @param liquidity The amount of liquidity to be burned\n /// @param amount0Min The minimum amount of token0 we want to send to the recipient (to)\n /// @param amount1Min The minimum amount of token1 we want to send to the recipient (to)\n /// @param to The address that will receive the due fees\n /// @return amount0 The calculated amount of token0 that will be sent to the recipient\n /// @return amount1 The calculated amount of token1 that will be sent to the recipient\n function burn(\n uint128 liquidity,\n uint256 amount0Min,\n uint256 amount1Min,\n address to\n ) external returns (uint256 amount0, uint256 amount1);\n}\n" - }, - "@openzeppelin/contracts/utils/Context.sol": { - "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Provides information about the current execution context, including the\n * sender of the transaction and its data. While these are generally available\n * via msg.sender and msg.data, they should not be accessed in such a direct\n * manner, since when dealing with meta-transactions the account sending and\n * paying for execution may not be the actual sender (as far as an application\n * is concerned).\n *\n * This contract is only required for intermediate, library-like contracts.\n */\nabstract contract Context {\n function _msgSender() internal view virtual returns (address) {\n return msg.sender;\n }\n\n function _msgData() internal view virtual returns (bytes calldata) {\n return msg.data;\n }\n}\n" - }, - "solidity/interfaces/IPairManagerFactory.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport './peripherals/IGovernable.sol';\n\n/// @title Factory of Pair Managers\n/// @notice This contract creates new pair managers\ninterface IPairManagerFactory is IGovernable {\n // Variables\n\n /// @notice Maps the address of a Uniswap pool, to the address of the corresponding PairManager\n /// For example, the uniswap address of DAI-WETH, will return the Keep3r/DAI-WETH pair manager address\n /// @param _pool The address of the Uniswap pool\n /// @return _pairManager The address of the corresponding pair manager\n function pairManagers(address _pool) external view returns (address _pairManager);\n\n // Events\n\n /// @notice Emitted when a new pair manager is created\n /// @param _pool The address of the corresponding Uniswap pool\n /// @param _pairManager The address of the just-created pair manager\n event PairCreated(address _pool, address _pairManager);\n\n // Errors\n\n /// @notice Throws an error if the pair manager is already initialized\n error AlreadyInitialized();\n\n /// @notice Throws an error if the caller is not the owner\n error OnlyOwner();\n\n // Methods\n\n /// @notice Creates a new pair manager based on the address of a Uniswap pool\n /// For example, the uniswap address of DAI-WETH, will create the Keep3r/DAI-WETH pool\n /// @param _pool The address of the Uniswap pool the pair manager will be based of\n /// @return _pairManager The address of the just-created pair manager\n function createPairManager(address _pool) external returns (address _pairManager);\n}\n" - }, - "solidity/contracts/UniV3PairManagerFactory.sol": { - "content": "// SPDX-License-Identifier: MIT\n\n/*\n\nCoded for The Keep3r Network with ♥ by\n\n██████╗░███████╗███████╗██╗  ░██╗░░░░░░░██╗░█████╗░███╗░░██╗██████╗░███████╗██████╗░██╗░░░░░░█████╗░███╗░░██╗██████╗░\n██╔══██╗██╔════╝██╔════╝██║  ░██║░░██╗░░██║██╔══██╗████╗░██║██╔══██╗██╔════╝██╔══██╗██║░░░░░██╔══██╗████╗░██║██╔══██╗\n██║░░██║█████╗░░█████╗░░██║  ░╚██╗████╗██╔╝██║░░██║██╔██╗██║██║░░██║█████╗░░██████╔╝██║░░░░░███████║██╔██╗██║██║░░██║\n██║░░██║██╔══╝░░██╔══╝░░██║  ░░████╔═████║░██║░░██║██║╚████║██║░░██║██╔══╝░░██╔══██╗██║░░░░░██╔══██║██║╚████║██║░░██║\n██████╔╝███████╗██║░░░░░██║  ░░╚██╔╝░╚██╔╝░╚█████╔╝██║░╚███║██████╔╝███████╗██║░░██║███████╗██║░░██║██║░╚███║██████╔╝\n╚═════╝░╚══════╝╚═╝░░░░░╚═╝  ░░░╚═╝░░░╚═╝░░░╚════╝░╚═╝░░╚══╝╚═════╝░╚══════╝╚═╝░░╚═╝╚══════╝╚═╝░░╚═╝╚═╝░░╚══╝╚═════╝░\n\nhttps://defi.sucks\n\n*/\n\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../interfaces/IPairManagerFactory.sol';\nimport './UniV3PairManager.sol';\nimport './peripherals/Governable.sol';\n\n/// @title Factory of Pair Managers\n/// @notice This contract creates new pair managers\ncontract UniV3PairManagerFactory is IPairManagerFactory, Governable {\n mapping(address => address) public override pairManagers;\n\n constructor(address _governance) Governable(_governance) {}\n\n ///@inheritdoc IPairManagerFactory\n function createPairManager(address _pool) external override returns (address _pairManager) {\n if (pairManagers[_pool] != address(0)) revert AlreadyInitialized();\n _pairManager = address(new UniV3PairManager(_pool, governance));\n pairManagers[_pool] = _pairManager;\n emit PairCreated(_pool, _pairManager);\n }\n}\n" - }, - "solidity/for-test/peripherals/GovernableForTest.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../../contracts/peripherals/Governable.sol';\n\ncontract GovernableForTest is Governable {\n constructor(address _governor) Governable(_governor) {}\n}\n" - }, - "solidity/for-test/BridgeForTest.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.0 <0.9.0;\n\nimport '@openzeppelin/contracts/token/ERC20/ERC20.sol';\nimport '@openzeppelin/contracts/token/ERC20/IERC20.sol';\n\ncontract BridgeForTest is ERC20 {\n address public immutable kp3r;\n\n constructor(address _kp3r) ERC20('Wrapped KP3R', 'wKP3R') {\n kp3r = _kp3r;\n }\n\n function bridge(uint256 _amount) external {\n IERC20(kp3r).transferFrom(msg.sender, address(this), _amount);\n _mint(msg.sender, _amount);\n }\n\n function bridgeBack(uint256 _amount) external {\n _burn(msg.sender, _amount);\n IERC20(kp3r).transfer(msg.sender, _amount);\n }\n}\n" - }, - "solidity/for-test/ERC20ForTest.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '@openzeppelin/contracts/token/ERC20/ERC20.sol';\n\ncontract ERC20ForTest is ERC20 {\n constructor(\n string memory _name,\n string memory _symbol,\n address _initialAccount,\n uint256 _initialBalance\n ) ERC20(_name, _symbol) {\n _mint(_initialAccount, _initialBalance);\n }\n\n function mint(uint256 _amount) public {\n _mint(msg.sender, _amount);\n }\n\n function mint(address _account, uint256 _amount) public {\n _mint(_account, _amount);\n }\n\n function burn(uint256 _amount) public {\n _burn(msg.sender, _amount);\n }\n\n function burn(address _account, uint256 _amount) public {\n _burn(_account, _amount);\n }\n\n function transferInternal(\n address _from,\n address _to,\n uint256 _value\n ) public {\n _transfer(_from, _to, _value);\n }\n\n function approveInternal(\n address _owner,\n address _spender,\n uint256 _value\n ) public {\n _approve(_owner, _spender, _value);\n }\n\n function deposit() external payable {\n // Function added for compatibility with WETH\n }\n}\n" - }, - "solidity/for-test/peripherals/keepers/Keep3rKeeperFundableForTest.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../../../contracts/peripherals/keepers/Keep3rKeeperFundable.sol';\n\ncontract Keep3rKeeperFundableForTest is Keep3rKeeperFundable {\n using EnumerableSet for EnumerableSet.AddressSet;\n\n constructor(\n address _kph,\n address _keep3rV1,\n address _keep3rV1Proxy\n ) Keep3rParameters(_kph, _keep3rV1, _keep3rV1Proxy) Keep3rRoles(msg.sender) {}\n\n function isKeeper(address _keeper) external view returns (bool) {\n return _keepers.contains(_keeper);\n }\n\n function setJob(address job) external {\n _jobs.add(job);\n }\n}\n" - }, - "solidity/contracts/sidechain/Keep3rEscrow.sol": { - "content": "// SPDX-License-Identifier: MIT\n\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../peripherals/Mintable.sol';\nimport '../peripherals/DustCollector.sol';\nimport '../../interfaces/sidechain/IKeep3rEscrow.sol';\nimport '@openzeppelin/contracts/token/ERC20/IERC20.sol';\nimport '@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol';\n\ncontract Keep3rEscrow is Mintable, DustCollector, IKeep3rEscrow {\n using SafeERC20 for IERC20;\n\n /// @inheritdoc IKeep3rEscrow\n address public override wKP3R;\n\n /// @param _governance Address of governance\n /// @param _wKP3R Address of wrapped KP3R implementation\n constructor(address _governance, address _wKP3R) Mintable(_governance) {\n wKP3R = _wKP3R;\n }\n\n /// @inheritdoc IKeep3rEscrow\n function deposit(uint256 _amount) external override {\n IERC20(wKP3R).safeTransferFrom(msg.sender, address(this), _amount);\n emit wKP3RDeposited(wKP3R, msg.sender, _amount);\n }\n\n /// @inheritdoc IKeep3rEscrow\n function mint(uint256 _amount) external override onlyMinter {\n IERC20(wKP3R).safeTransfer(msg.sender, _amount);\n emit wKP3RMinted(wKP3R, msg.sender, _amount);\n }\n\n /// @inheritdoc IKeep3rEscrow\n function setWKP3R(address _wKP3R) external override onlyGovernance {\n wKP3R = _wKP3R;\n emit wKP3RSet(wKP3R);\n }\n}\n" - }, - "solidity/contracts/peripherals/Mintable.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../../interfaces/peripherals/IMintable.sol';\nimport './Governable.sol';\n\nabstract contract Mintable is Governable, IMintable {\n /// @inheritdoc IMintable\n address public override minter;\n\n constructor(address _governance) Governable(_governance) {}\n\n /// @inheritdoc IMintable\n function setMinter(address _minter) external override onlyGovernance {\n minter = _minter;\n emit MinterSet(_minter);\n }\n\n /// @notice Functions with this modifier can only be called by the minter;\n modifier onlyMinter() {\n if (msg.sender != minter) revert OnlyMinter();\n _;\n }\n}\n" - }, - "solidity/for-test/peripherals/DustCollectorForTest.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../../contracts/peripherals/DustCollector.sol';\n\ncontract DustCollectorForTest is DustCollector {\n constructor() DustCollector() Governable(msg.sender) {}\n}\n" - }, - "solidity/for-test/peripherals/Keep3rParametersForTest.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../../contracts/peripherals/Keep3rParameters.sol';\n\ncontract Keep3rParametersForTest is Keep3rParameters {\n constructor(\n address _keep3rHelper,\n address _keep3rV1,\n address _keep3rV1Proxy\n ) Keep3rParameters(_keep3rHelper, _keep3rV1, _keep3rV1Proxy) Keep3rRoles(msg.sender) {}\n\n function viewLiquidityPool(address _pool) public view returns (address) {\n return _liquidityPool[_pool];\n }\n\n function viewIsKP3RToken0(address _pool) public view returns (bool) {\n return _isKP3RToken0[_pool];\n }\n}\n" - }, - "solidity/for-test/peripherals/jobs/Keep3rJobManagerForTest.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../../../contracts/peripherals/jobs/Keep3rJobManager.sol';\n\ncontract Keep3rJobManagerForTest is Keep3rJobManager {\n using EnumerableSet for EnumerableSet.AddressSet;\n\n constructor(\n address _keep3rHelper,\n address _keep3rV1,\n address _keep3rV1Proxy\n ) Keep3rParameters(_keep3rHelper, _keep3rV1, _keep3rV1Proxy) Keep3rRoles(msg.sender) {}\n\n function isJob(address _job) external view returns (bool _isJob) {\n _isJob = _jobs.contains(_job);\n }\n}\n" - }, - "solidity/for-test/peripherals/jobs/Keep3rJobMigrationForTest.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../../../contracts/peripherals/jobs/Keep3rJobMigration.sol';\n\ncontract Keep3rJobMigrationForTest is Keep3rJobMigration {\n using EnumerableSet for EnumerableSet.AddressSet;\n\n mapping(address => uint256) public settleJobAccountanceCallCount;\n\n constructor(\n address _kph,\n address _keep3rV1,\n address _keep3rV1Proxy\n ) Keep3rParameters(_kph, _keep3rV1, _keep3rV1Proxy) Keep3rRoles(msg.sender) {}\n\n function setJobToken(address _job, address _token) external {\n _jobTokens[_job].add(_token);\n }\n\n function setJobLiquidity(address _job, address _liquidity) external {\n _jobLiquidities[_job].add(_liquidity);\n }\n\n function viewJobTokenListLength(address _job) external view returns (uint256) {\n return _jobTokens[_job].length();\n }\n\n function viewJobLiquidityList(address _job) external view returns (address[] memory _list) {\n _list = _jobLiquidities[_job].values();\n }\n\n function viewJobPeriodCredits(address _job) external view returns (uint256) {\n return _jobPeriodCredits[_job];\n }\n\n function viewJobLiquidityCredits(address _job) external view returns (uint256) {\n return _jobLiquidityCredits[_job];\n }\n\n function viewMigrationCreatedAt(address _fromJob, address _toJob) external view returns (uint256) {\n return _migrationCreatedAt[_fromJob][_toJob];\n }\n\n function isJob(address _job) external view returns (bool) {\n return _jobs.contains(_job);\n }\n\n function _settleJobAccountance(address _job) internal override {\n settleJobAccountanceCallCount[_job]++;\n }\n}\n" - }, - "solidity/for-test/peripherals/jobs/Keep3rJobFundableLiquidityForTest.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../../../contracts/peripherals/jobs/Keep3rJobFundableLiquidity.sol';\n\ncontract Keep3rJobFundableLiquidityForTest is Keep3rJobFundableLiquidity {\n using EnumerableSet for EnumerableSet.AddressSet;\n\n constructor(\n address _kph,\n address _keep3rV1,\n address _keep3rV1Proxy\n ) Keep3rParameters(_kph, _keep3rV1, _keep3rV1Proxy) Keep3rRoles(msg.sender) {}\n\n function setJob(address _job) external {\n _jobs.add(_job);\n }\n\n function setJobLiquidity(address _job, address _liquidity) external returns (bool) {\n return _jobLiquidities[_job].add(_liquidity);\n }\n\n function setApprovedLiquidity(address _liquidity) external {\n _approvedLiquidities.add(_liquidity);\n }\n\n function setRevokedLiquidity(address _liquidity) external {\n _approvedLiquidities.remove(_liquidity);\n }\n\n function viewTickCache(address _liquidity) external view returns (TickCache memory _tickCache) {\n _tickCache = _tick[_liquidity];\n }\n\n function viewTickOrder(address _liquidity) external view returns (bool) {\n return _isKP3RToken0[_liquidity];\n }\n\n function internalJobLiquidities(address _job) external view returns (address[] memory _list) {\n _list = _jobLiquidities[_job].values();\n }\n\n function internalSettleJobAccountance(address _job) external {\n _settleJobAccountance(_job);\n }\n}\n" - }, - "solidity/contracts/Keep3rHelper.sol": { - "content": "// SPDX-License-Identifier: MIT\n\n/*\n\nCoded for The Keep3r Network with ♥ by\n\n██████╗░███████╗███████╗██╗  ░██╗░░░░░░░██╗░█████╗░███╗░░██╗██████╗░███████╗██████╗░██╗░░░░░░█████╗░███╗░░██╗██████╗░\n██╔══██╗██╔════╝██╔════╝██║  ░██║░░██╗░░██║██╔══██╗████╗░██║██╔══██╗██╔════╝██╔══██╗██║░░░░░██╔══██╗████╗░██║██╔══██╗\n██║░░██║█████╗░░█████╗░░██║  ░╚██╗████╗██╔╝██║░░██║██╔██╗██║██║░░██║█████╗░░██████╔╝██║░░░░░███████║██╔██╗██║██║░░██║\n██║░░██║██╔══╝░░██╔══╝░░██║  ░░████╔═████║░██║░░██║██║╚████║██║░░██║██╔══╝░░██╔══██╗██║░░░░░██╔══██║██║╚████║██║░░██║\n██████╔╝███████╗██║░░░░░██║  ░░╚██╔╝░╚██╔╝░╚█████╔╝██║░╚███║██████╔╝███████╗██║░░██║███████╗██║░░██║██║░╚███║██████╔╝\n╚═════╝░╚══════╝╚═╝░░░░░╚═╝  ░░░╚═╝░░░╚═╝░░░╚════╝░╚═╝░░╚══╝╚═════╝░╚══════╝╚═╝░░╚═╝╚══════╝╚═╝░░╚═╝╚═╝░░╚══╝╚═════╝░\n\nhttps://defi.sucks\n\n*/\n\npragma solidity >=0.8.7 <0.9.0;\n\nimport './libraries/FullMath.sol';\nimport './libraries/TickMath.sol';\nimport '../interfaces/IKeep3r.sol';\nimport '../interfaces/IKeep3rHelper.sol';\nimport './Keep3rHelperParameters.sol';\n\nimport '@openzeppelin/contracts/utils/math/Math.sol';\nimport '@uniswap/v3-core/contracts/interfaces/IUniswapV3Pool.sol';\n\ncontract Keep3rHelper is IKeep3rHelper, Keep3rHelperParameters {\n constructor(\n address _keep3rV2,\n address _governance,\n address _kp3rWethPool\n ) Keep3rHelperParameters(_keep3rV2, _governance, _kp3rWethPool) {}\n\n /// @inheritdoc IKeep3rHelper\n function quote(uint256 _eth) public view override returns (uint256 _amountOut) {\n uint32[] memory _secondsAgos = new uint32[](2);\n _secondsAgos[1] = quoteTwapTime;\n\n (int56[] memory _tickCumulatives, ) = IUniswapV3Pool(kp3rWethPool.poolAddress).observe(_secondsAgos);\n int56 _difference = _tickCumulatives[0] - _tickCumulatives[1];\n _amountOut = getQuoteAtTick(uint128(_eth), kp3rWethPool.isTKNToken0 ? _difference : -_difference, quoteTwapTime);\n }\n\n /// @inheritdoc IKeep3rHelper\n function bonds(address _keeper) public view virtual override returns (uint256 _amountBonded) {\n return IKeep3r(keep3rV2).bonds(_keeper, KP3R);\n }\n\n /// @inheritdoc IKeep3rHelper\n function getRewardAmountFor(address _keeper, uint256 _gasUsed) public view override returns (uint256 _kp3r) {\n uint256 _boost = getRewardBoostFor(bonds(_keeper));\n _kp3r = quote((_gasUsed * _boost) / BOOST_BASE);\n }\n\n /// @inheritdoc IKeep3rHelper\n function getRewardAmount(uint256 _gasUsed) external view override returns (uint256 _amount) {\n // solhint-disable-next-line avoid-tx-origin\n return getRewardAmountFor(tx.origin, _gasUsed);\n }\n\n /// @inheritdoc IKeep3rHelper\n function getRewardBoostFor(uint256 _bonds) public view override returns (uint256 _rewardBoost) {\n _bonds = Math.min(_bonds, targetBond);\n uint256 _cap = Math.max(minBoost, minBoost + ((maxBoost - minBoost) * _bonds) / targetBond);\n _rewardBoost = _cap * _getBasefee();\n }\n\n /// @inheritdoc IKeep3rHelper\n function getPoolTokens(address _pool) public view override returns (address _token0, address _token1) {\n return (IUniswapV3Pool(_pool).token0(), IUniswapV3Pool(_pool).token1());\n }\n\n /// @inheritdoc IKeep3rHelper\n function isKP3RToken0(address _pool) public view virtual override returns (bool _isKP3RToken0) {\n address _token0;\n address _token1;\n (_token0, _token1) = getPoolTokens(_pool);\n if (_token0 == KP3R) {\n return true;\n } else if (_token1 != KP3R) {\n revert LiquidityPairInvalid();\n }\n }\n\n /// @inheritdoc IKeep3rHelper\n function observe(address _pool, uint32[] memory _secondsAgo)\n public\n view\n override\n returns (\n int56 _tickCumulative1,\n int56 _tickCumulative2,\n bool _success\n )\n {\n try IUniswapV3Pool(_pool).observe(_secondsAgo) returns (int56[] memory _uniswapResponse, uint160[] memory) {\n _tickCumulative1 = _uniswapResponse[0];\n if (_uniswapResponse.length > 1) {\n _tickCumulative2 = _uniswapResponse[1];\n }\n _success = true;\n } catch (bytes memory) {}\n }\n\n /// @inheritdoc IKeep3rHelper\n function getPaymentParams(uint256 _bonds)\n external\n view\n override\n returns (\n uint256 _boost,\n uint256 _oneEthQuote,\n uint256 _extra\n )\n {\n _oneEthQuote = quote(1 ether);\n _boost = getRewardBoostFor(_bonds);\n _extra = workExtraGas;\n }\n\n /// @inheritdoc IKeep3rHelper\n function getKP3RsAtTick(\n uint256 _liquidityAmount,\n int56 _tickDifference,\n uint256 _timeInterval\n ) public pure override returns (uint256 _kp3rAmount) {\n uint160 sqrtRatioX96 = TickMath.getSqrtRatioAtTick(int24(_tickDifference / int256(_timeInterval)));\n _kp3rAmount = FullMath.mulDiv(1 << 96, _liquidityAmount, sqrtRatioX96);\n }\n\n /// @inheritdoc IKeep3rHelper\n function getQuoteAtTick(\n uint128 _baseAmount,\n int56 _tickDifference,\n uint256 _timeInterval\n ) public pure override returns (uint256 _quoteAmount) {\n uint160 sqrtRatioX96 = TickMath.getSqrtRatioAtTick(int24(_tickDifference / int256(_timeInterval)));\n\n if (sqrtRatioX96 <= type(uint128).max) {\n uint256 ratioX192 = uint256(sqrtRatioX96) * sqrtRatioX96;\n _quoteAmount = FullMath.mulDiv(1 << 192, _baseAmount, ratioX192);\n } else {\n uint256 ratioX128 = FullMath.mulDiv(sqrtRatioX96, sqrtRatioX96, 1 << 64);\n _quoteAmount = FullMath.mulDiv(1 << 128, _baseAmount, ratioX128);\n }\n }\n\n /// @notice Gets the gas basefee cost to calculate keeper rewards\n /// @dev Keepers are required to pay a priority fee to be included, this function recognizes a minimum priority fee\n /// @return _baseFee The block's basefee + a minimum priority fee, or a preset minimum gas fee\n function _getBasefee() internal view virtual returns (uint256 _baseFee) {\n return Math.max(minBaseFee, block.basefee + minPriorityFee);\n }\n}\n" - }, - "solidity/for-test/testnet/Keep3rHelperForTestnet.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../../contracts/Keep3rHelper.sol';\n\ncontract Keep3rHelperForTestnet is Keep3rHelper {\n constructor(\n address _keep3rV2,\n address _governance,\n address _kp3rWethPool\n ) Keep3rHelper(_keep3rV2, _governance, _kp3rWethPool) {}\n\n function _getBasefee() internal view override returns (uint256) {\n return 1;\n }\n\n /// @dev Overrides oracle validation that uses KP3R and WETH addresses\n function _validateOraclePool(address _poolAddress, address) internal view virtual override returns (TokenOraclePool memory _oraclePool) {\n return TokenOraclePool(_poolAddress, true);\n }\n\n /// @dev Overrides token comparison with KP3R address\n function isKP3RToken0(address) public view virtual override returns (bool) {\n return true;\n }\n}\n" - }, - "solidity/for-test/Keep3rHelperForTest.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../contracts/Keep3rHelper.sol';\n\ncontract Keep3rHelperForTest is Keep3rHelper {\n uint256 public basefee;\n\n constructor(\n address _keep3rV2,\n address _governance,\n address _kp3rWethPool\n ) Keep3rHelper(_keep3rV2, _governance, _kp3rWethPool) {}\n\n function _getBasefee() internal view override returns (uint256) {\n return basefee != 0 ? (basefee + minPriorityFee) : super._getBasefee();\n }\n\n function setBaseFee(uint256 _baseFee) external {\n basefee = _baseFee;\n }\n}\n" - }, - "solidity/contracts/sidechain/Keep3rHelperSidechain.sol": { - "content": "// SPDX-License-Identifier: MIT\n\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../Keep3rHelper.sol';\nimport '../../interfaces/sidechain/IKeep3rHelperSidechain.sol';\n\ncontract Keep3rHelperSidechain is IKeep3rHelperSidechain, Keep3rHelper {\n /// @inheritdoc IKeep3rHelperSidechain\n mapping(address => address) public override oracle;\n /// @inheritdoc IKeep3rHelperSidechain\n IKeep3rHelperParameters.TokenOraclePool public override wethUSDPool;\n\n /// @notice Ethereum mainnet WETH address used for quoting references\n address public constant override WETH = 0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2;\n\n /// @param _keep3rV2 Address of sidechain Keep3r implementation\n /// @param _governance Address of governance\n /// @param _kp3rWethOracle Address of oracle used for KP3R/WETH quote\n /// @param _wethUsdOracle Address of oracle used for WETH/USD quote\n /// @dev Oracle pools should use 18 decimals tokens\n constructor(\n address _keep3rV2,\n address _governance,\n address _kp3rWethOracle,\n address _wethUsdOracle\n ) Keep3rHelper(_keep3rV2, _governance, _kp3rWethOracle) {\n _setWethUsdPool(_wethUsdOracle);\n _setQuoteTwapTime(1 days);\n }\n\n /// @inheritdoc IKeep3rHelper\n /// @notice Uses valid wKP3R address from Keep3rSidechain to query keeper bonds\n function bonds(address _keeper) public view override(Keep3rHelper, IKeep3rHelper) returns (uint256 _amountBonded) {\n address wKP3R = IKeep3r(keep3rV2).keep3rV1();\n return IKeep3r(keep3rV2).bonds(_keeper, wKP3R);\n }\n\n /// @inheritdoc IKeep3rHelperSidechain\n function setOracle(address _liquidity, address _oracle) external override onlyGovernance {\n oracle[_liquidity] = _oracle;\n emit OracleSet(_liquidity, _oracle);\n }\n\n /// @inheritdoc IKeep3rHelperSidechain\n function quoteUsdToEth(uint256 _usd) public view override returns (uint256 _amountOut) {\n uint32[] memory _secondsAgos = new uint32[](2);\n _secondsAgos[1] = quoteTwapTime;\n\n /// @dev Oracle is compatible with IUniswapV3Pool\n (int56[] memory _tickCumulatives, ) = IUniswapV3Pool(wethUSDPool.poolAddress).observe(_secondsAgos);\n int56 _difference = _tickCumulatives[0] - _tickCumulatives[1];\n _amountOut = getQuoteAtTick(uint128(_usd), wethUSDPool.isTKNToken0 ? _difference : -_difference, quoteTwapTime);\n }\n\n /// @inheritdoc IKeep3rHelperSidechain\n function setWethUsdPool(address _poolAddress) external override onlyGovernance {\n _setWethUsdPool(_poolAddress);\n }\n\n function _setWethUsdPool(address _poolAddress) internal {\n wethUSDPool = _validateOraclePool(_poolAddress, WETH);\n emit WethUSDPoolChange(wethUSDPool.poolAddress, wethUSDPool.isTKNToken0);\n }\n\n /// @dev Sidechain jobs are quoted by USD/gasUnit, baseFee is set to 1\n function _getBasefee() internal view virtual override returns (uint256 _baseFee) {\n return 1;\n }\n}\n" - }, - "solidity/for-test/peripherals/jobs/Keep3rJobWorkableForTest.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../../../contracts/peripherals/jobs/Keep3rJobWorkable.sol';\n\ncontract Keep3rJobWorkableForTest is Keep3rJobWorkable {\n using EnumerableSet for EnumerableSet.AddressSet;\n\n constructor(\n address _keep3rHelper,\n address _keep3rV1,\n address _keep3rV1Proxy\n ) Keep3rParameters(_keep3rHelper, _keep3rV1, _keep3rV1Proxy) Keep3rRoles(msg.sender) {}\n\n function setJob(address _job) external {\n _jobs.add(_job);\n }\n\n function setKeeper(address _keeper) external {\n _keepers.add(_keeper);\n }\n\n function setApprovedLiquidity(address _liquidity) external {\n _approvedLiquidities.add(_liquidity);\n }\n\n function setJobLiquidity(address _job, address _liquidity) external {\n _jobLiquidities[_job].add(_liquidity);\n }\n\n function viewJobLiquidityCredits(address _job) external view returns (uint256) {\n return _jobLiquidityCredits[_job];\n }\n\n function viewJobPeriodCredits(address _job) external view returns (uint256) {\n return _jobPeriodCredits[_job];\n }\n\n function viewTickCache(address _liquidity) external view returns (TickCache memory _tickCache) {\n _tickCache = _tick[_liquidity];\n }\n\n function viewGas() external view returns (uint256) {\n return _initialGas;\n }\n\n receive() external payable {}\n}\n" - }, - "solidity/for-test/peripherals/jobs/Keep3rJobDisputableForTest.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../../../contracts/peripherals/jobs/Keep3rJobDisputable.sol';\n\ncontract Keep3rJobDisputableForTest is Keep3rJobDisputable {\n using EnumerableSet for EnumerableSet.AddressSet;\n\n constructor(\n address _kph,\n address _keep3rV1,\n address _keep3rV1Proxy\n ) Keep3rParameters(_kph, _keep3rV1, _keep3rV1Proxy) Keep3rRoles(msg.sender) {}\n\n function setJobLiquidity(address _job, address _liquidity) external {\n _jobLiquidities[_job].add(_liquidity);\n }\n\n function setJobToken(address _job, address _token) external {\n _jobTokens[_job].add(_token);\n }\n\n function setApprovedLiquidity(address _liquidity) external {\n _approvedLiquidities.add(_liquidity);\n }\n\n function setRevokedLiquidity(address _liquidity) external {\n _approvedLiquidities.remove(_liquidity);\n }\n\n function internalJobLiquidityCredits(address _job) external view returns (uint256 _credits) {\n _credits = _jobLiquidityCredits[_job];\n }\n\n function internalJobPeriodCredits(address _job) external view returns (uint256 _credits) {\n _credits = _jobPeriodCredits[_job];\n }\n\n function internalJobTokens(address _job) external view returns (address[] memory _tokens) {\n _tokens = new address[](_jobTokens[_job].length());\n for (uint256 i; i < _jobTokens[_job].length(); i++) {\n _tokens[i] = _jobTokens[_job].at(i);\n }\n }\n\n function internalJobLiquidities(address _job) external view returns (address[] memory _tokens) {\n _tokens = new address[](_jobLiquidities[_job].length());\n for (uint256 i; i < _jobLiquidities[_job].length(); i++) {\n _tokens[i] = _jobLiquidities[_job].at(i);\n }\n }\n}\n" - }, - "solidity/for-test/peripherals/Keep3rDisputableForTest.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../../contracts/peripherals/Keep3rDisputable.sol';\n\ncontract Keep3rDisputableForTest is Keep3rDisputable {\n constructor() Keep3rRoles(msg.sender) {}\n}\n" - }, - "solidity/for-test/peripherals/keepers/Keep3rKeeperDisputableForTest.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../../../contracts/peripherals/keepers/Keep3rKeeperDisputable.sol';\n\ncontract Keep3rKeeperDisputableForTest is Keep3rKeeperDisputable {\n using EnumerableSet for EnumerableSet.AddressSet;\n\n constructor(\n address _kph,\n address _keep3rV1,\n address _keep3rV1Proxy\n ) Keep3rParameters(_kph, _keep3rV1, _keep3rV1Proxy) Keep3rRoles(msg.sender) {}\n\n function setKeeper(address _keeper) external {\n _keepers.add(_keeper);\n }\n\n function internalSlash(\n address _bonded,\n address _keeper,\n uint256 _bondAmount,\n uint256 _unbondAmount\n ) external {\n _slash(_bonded, _keeper, _bondAmount, _unbondAmount);\n }\n\n function isKeeper(address _address) external view returns (bool _isKeeper) {\n _isKeeper = _keepers.contains(_address);\n }\n}\n" - }, - "solidity/for-test/peripherals/Keep3rAccountanceForTest.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../../contracts/peripherals/Keep3rAccountance.sol';\n\ncontract Keep3rAccountanceForTest is Keep3rAccountance {\n using EnumerableSet for EnumerableSet.AddressSet;\n\n function setJob(address job) external {\n _jobs.add(job);\n }\n\n function setKeeper(address keeper) external {\n _keepers.add(keeper);\n }\n}\n" - }, - "solidity/for-test/peripherals/jobs/Keep3rJobFundableCreditsForTest.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../../../contracts/peripherals/jobs/Keep3rJobFundableCredits.sol';\n\ncontract Keep3rJobFundableCreditsForTest is Keep3rJobFundableCredits {\n using EnumerableSet for EnumerableSet.AddressSet;\n\n constructor(\n address _kph,\n address _keep3rV1,\n address _keep3rV1Proxy\n ) Keep3rParameters(_kph, _keep3rV1, _keep3rV1Proxy) Keep3rRoles(msg.sender) {}\n\n function setJob(address _job, address _jobOwner) external {\n _jobs.add(_job);\n jobOwner[_job] = _jobOwner;\n }\n\n function setJobToken(address _job, address _token) external {\n _jobTokens[_job].add(_token);\n }\n\n function isJobToken(address _job, address _token) external view returns (bool _contains) {\n _contains = _jobTokens[_job].contains(_token);\n }\n}\n" - }, - "solidity/for-test/peripherals/jobs/Keep3rJobOwnershipForTest.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../../../contracts/peripherals/jobs/Keep3rJobOwnership.sol';\n\ncontract Keep3rJobOwnershipForTest is Keep3rJobOwnership {}\n" - }, - "solidity/for-test/libraries/LiquidityAmountsForTest.sol": { - "content": "// SPDX-License-Identifier: GPL-2.0-or-later\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../../contracts/libraries/FullMath.sol';\nimport '../../contracts/libraries/FixedPoint96.sol';\n\n/// @dev Made this library into a contract to be able to calculate liquidity more precisely for tests\n\n// solhint-disable\ncontract LiquidityAmountsForTest {\n function toUint128(uint256 x) private pure returns (uint128 y) {\n require((y = uint128(x)) == x);\n }\n\n function getLiquidityForAmount0(\n uint160 sqrtRatioAX96,\n uint160 sqrtRatioBX96,\n uint256 amount0\n ) public pure returns (uint128 liquidity) {\n if (sqrtRatioAX96 > sqrtRatioBX96) (sqrtRatioAX96, sqrtRatioBX96) = (sqrtRatioBX96, sqrtRatioAX96);\n uint256 intermediate = FullMath.mulDiv(sqrtRatioAX96, sqrtRatioBX96, FixedPoint96.Q96);\n return toUint128(FullMath.mulDiv(amount0, intermediate, sqrtRatioBX96 - sqrtRatioAX96));\n }\n\n function getLiquidityForAmount1(\n uint160 sqrtRatioAX96,\n uint160 sqrtRatioBX96,\n uint256 amount1\n ) public pure returns (uint128 liquidity) {\n if (sqrtRatioAX96 > sqrtRatioBX96) (sqrtRatioAX96, sqrtRatioBX96) = (sqrtRatioBX96, sqrtRatioAX96);\n return toUint128(FullMath.mulDiv(amount1, FixedPoint96.Q96, sqrtRatioBX96 - sqrtRatioAX96));\n }\n\n function getLiquidityForAmounts(\n uint160 sqrtRatioX96,\n uint160 sqrtRatioAX96,\n uint160 sqrtRatioBX96,\n uint256 amount0,\n uint256 amount1\n ) external pure returns (uint128 liquidity) {\n if (sqrtRatioAX96 > sqrtRatioBX96) (sqrtRatioAX96, sqrtRatioBX96) = (sqrtRatioBX96, sqrtRatioAX96);\n\n if (sqrtRatioX96 <= sqrtRatioAX96) {\n liquidity = getLiquidityForAmount0(sqrtRatioAX96, sqrtRatioBX96, amount0);\n } else if (sqrtRatioX96 < sqrtRatioBX96) {\n uint128 liquidity0 = getLiquidityForAmount0(sqrtRatioX96, sqrtRatioBX96, amount0);\n uint128 liquidity1 = getLiquidityForAmount1(sqrtRatioAX96, sqrtRatioX96, amount1);\n\n liquidity = liquidity0 < liquidity1 ? liquidity0 : liquidity1;\n } else {\n liquidity = getLiquidityForAmount1(sqrtRatioAX96, sqrtRatioBX96, amount1);\n }\n }\n\n function getAmount0ForLiquidity(\n uint160 sqrtRatioAX96,\n uint160 sqrtRatioBX96,\n uint128 liquidity\n ) public pure returns (uint256 amount0) {\n if (sqrtRatioAX96 > sqrtRatioBX96) (sqrtRatioAX96, sqrtRatioBX96) = (sqrtRatioBX96, sqrtRatioAX96);\n\n return FullMath.mulDiv(uint256(liquidity) << FixedPoint96.RESOLUTION, sqrtRatioBX96 - sqrtRatioAX96, sqrtRatioBX96) / sqrtRatioAX96;\n }\n\n function getAmount1ForLiquidity(\n uint160 sqrtRatioAX96,\n uint160 sqrtRatioBX96,\n uint128 liquidity\n ) public pure returns (uint256 amount1) {\n if (sqrtRatioAX96 > sqrtRatioBX96) (sqrtRatioAX96, sqrtRatioBX96) = (sqrtRatioBX96, sqrtRatioAX96);\n\n return FullMath.mulDiv(liquidity, sqrtRatioBX96 - sqrtRatioAX96, FixedPoint96.Q96);\n }\n\n function getAmountsForLiquidity(\n uint160 sqrtRatioX96,\n uint160 sqrtRatioAX96,\n uint160 sqrtRatioBX96,\n uint128 liquidity\n ) external pure returns (uint256 amount0, uint256 amount1) {\n if (sqrtRatioAX96 > sqrtRatioBX96) (sqrtRatioAX96, sqrtRatioBX96) = (sqrtRatioBX96, sqrtRatioAX96);\n\n if (sqrtRatioX96 <= sqrtRatioAX96) {\n amount0 = getAmount0ForLiquidity(sqrtRatioAX96, sqrtRatioBX96, liquidity);\n } else if (sqrtRatioX96 < sqrtRatioBX96) {\n amount0 = getAmount0ForLiquidity(sqrtRatioX96, sqrtRatioBX96, liquidity);\n amount1 = getAmount1ForLiquidity(sqrtRatioAX96, sqrtRatioX96, liquidity);\n } else {\n amount1 = getAmount1ForLiquidity(sqrtRatioAX96, sqrtRatioBX96, liquidity);\n }\n }\n}\n" - }, - "solidity/for-test/IUniswapV3PoolForTest.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '@uniswap/v3-core/contracts/interfaces/IERC20Minimal.sol';\nimport '@uniswap/v3-core/contracts/interfaces/IUniswapV3Pool.sol';\n\n// solhint-disable-next-line no-empty-blocks\ninterface IUniswapV3PoolForTest is IERC20Minimal, IUniswapV3Pool {\n\n}\n" - }, - "@uniswap/v3-core/contracts/interfaces/IERC20Minimal.sol": { - "content": "// SPDX-License-Identifier: GPL-2.0-or-later\npragma solidity >=0.5.0;\n\n/// @title Minimal ERC20 interface for Uniswap\n/// @notice Contains a subset of the full ERC20 interface that is used in Uniswap V3\ninterface IERC20Minimal {\n /// @notice Returns the balance of a token\n /// @param account The account for which to look up the number of tokens it has, i.e. its balance\n /// @return The number of tokens held by the account\n function balanceOf(address account) external view returns (uint256);\n\n /// @notice Transfers the amount of token from the `msg.sender` to the recipient\n /// @param recipient The account that will receive the amount transferred\n /// @param amount The number of tokens to send from the sender to the recipient\n /// @return Returns true for a successful transfer, false for an unsuccessful transfer\n function transfer(address recipient, uint256 amount) external returns (bool);\n\n /// @notice Returns the current allowance given to a spender by an owner\n /// @param owner The account of the token owner\n /// @param spender The account of the token spender\n /// @return The current allowance granted by `owner` to `spender`\n function allowance(address owner, address spender) external view returns (uint256);\n\n /// @notice Sets the allowance of a spender from the `msg.sender` to the value `amount`\n /// @param spender The account which will be allowed to spend a given amount of the owners tokens\n /// @param amount The amount of tokens allowed to be used by `spender`\n /// @return Returns true for a successful approval, false for unsuccessful\n function approve(address spender, uint256 amount) external returns (bool);\n\n /// @notice Transfers `amount` tokens from `sender` to `recipient` up to the allowance given to the `msg.sender`\n /// @param sender The account from which the transfer will be initiated\n /// @param recipient The recipient of the transfer\n /// @param amount The amount of the transfer\n /// @return Returns true for a successful transfer, false for unsuccessful\n function transferFrom(\n address sender,\n address recipient,\n uint256 amount\n ) external returns (bool);\n\n /// @notice Event emitted when tokens are transferred from one address to another, either via `#transfer` or `#transferFrom`.\n /// @param from The account from which the tokens were sent, i.e. the balance decreased\n /// @param to The account to which the tokens were sent, i.e. the balance increased\n /// @param value The amount of tokens that were transferred\n event Transfer(address indexed from, address indexed to, uint256 value);\n\n /// @notice Event emitted when the approval amount for the spender of a given owner's tokens changes.\n /// @param owner The account that approved spending of its tokens\n /// @param spender The account for which the spending allowance was modified\n /// @param value The new allowance from the owner to the spender\n event Approval(address indexed owner, address indexed spender, uint256 value);\n}\n" - } - }, - "settings": { - "optimizer": { - "enabled": true, - "runs": 33 - }, - "outputSelection": { - "*": { - "*": [ - "storageLayout", - "abi", - "evm.bytecode", - "evm.deployedBytecode", - "evm.methodIdentifiers", - "metadata", - "devdoc", - "userdoc", - "evm.gasEstimates" - ], - "": [ - "ast" - ] - } - }, - "metadata": { - "useLiteralContent": true - }, - "libraries": { - "": { - "__CACHE_BREAKER__": "0x00000000d41867734bbee4c6863d9255b2b06ac1" - } - } - } -} \ No newline at end of file diff --git a/deployments/goerli/solcInputs/7120622b6fa82f1fde1bb178c8155d0d.json b/deployments/goerli/solcInputs/7120622b6fa82f1fde1bb178c8155d0d.json deleted file mode 100644 index bbcdded..0000000 --- a/deployments/goerli/solcInputs/7120622b6fa82f1fde1bb178c8155d0d.json +++ /dev/null @@ -1,328 +0,0 @@ -{ - "language": "Solidity", - "sources": { - "solidity/contracts/Keep3r.sol": { - "content": "// SPDX-License-Identifier: MIT\n\n/*\n\nCoded for The Keep3r Network with ♥ by\n\n██████╗░███████╗███████╗██╗░░░██╗░░░░░░░██╗░█████╗░███╗░░██╗██████╗░███████╗██████╗░██╗░░░░░░█████╗░███╗░░██╗██████╗░\n██╔══██╗██╔════╝██╔════╝██║░░░██║░░██╗░░██║██╔══██╗████╗░██║██╔══██╗██╔════╝██╔══██╗██║░░░░░██╔══██╗████╗░██║██╔══██╗\n██║░░██║█████╗░░█████╗░░██║░░░╚██╗████╗██╔╝██║░░██║██╔██╗██║██║░░██║█████╗░░██████╔╝██║░░░░░███████║██╔██╗██║██║░░██║\n██║░░██║██╔══╝░░██╔══╝░░██║░░░░████╔═████║░██║░░██║██║╚████║██║░░██║██╔══╝░░██╔══██╗██║░░░░░██╔══██║██║╚████║██║░░██║\n██████╔╝███████╗██║░░░░░██║░░░░╚██╔╝░╚██╔╝░╚█████╔╝██║░╚███║██████╔╝███████╗██║░░██║███████╗██║░░██║██║░╚███║██████╔╝\n╚═════╝░╚══════╝╚═╝░░░░░╚═╝░░░░░╚═╝░░░╚═╝░░░╚════╝░╚═╝░░╚══╝╚═════╝░╚══════╝╚═╝░░╚═╝╚══════╝╚═╝░░╚═╝╚═╝░░╚══╝╚═════╝░\n\nhttps://defi.sucks\n\n*/\n\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../interfaces/IKeep3r.sol';\nimport './peripherals/jobs/Keep3rJobs.sol';\nimport './peripherals/keepers/Keep3rKeepers.sol';\nimport './peripherals/DustCollector.sol';\n\ncontract Keep3r is IKeep3r, Keep3rJobs, Keep3rKeepers {\n constructor(\n address _governance,\n address _keep3rHelper,\n address _keep3rV1,\n address _keep3rV1Proxy\n ) Keep3rParameters(_keep3rHelper, _keep3rV1, _keep3rV1Proxy) Keep3rRoles(_governance) {}\n}\n" - }, - "solidity/interfaces/IKeep3r.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport './peripherals/IKeep3rJobs.sol';\nimport './peripherals/IKeep3rKeepers.sol';\nimport './peripherals/IKeep3rParameters.sol';\n\n// solhint-disable-next-line no-empty-blocks\n\n/// @title Keep3rV2 contract\n/// @notice This contract inherits all the functionality of Keep3rV2\ninterface IKeep3r is IKeep3rJobs, IKeep3rKeepers, IKeep3rParameters {\n\n}\n" - }, - "solidity/contracts/peripherals/jobs/Keep3rJobs.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../../../interfaces/peripherals/IKeep3rJobs.sol';\nimport './Keep3rJobManager.sol';\nimport './Keep3rJobWorkable.sol';\nimport './Keep3rJobDisputable.sol';\n\nabstract contract Keep3rJobs is IKeep3rJobs, Keep3rJobManager, Keep3rJobWorkable, Keep3rJobDisputable {}\n" - }, - "solidity/contracts/peripherals/keepers/Keep3rKeepers.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../../../interfaces/peripherals/IKeep3rKeepers.sol';\nimport './Keep3rKeeperDisputable.sol';\n\nabstract contract Keep3rKeepers is IKeep3rKeepers, Keep3rKeeperDisputable {}\n" - }, - "solidity/contracts/peripherals/DustCollector.sol": { - "content": "// SPDX-License-Identifier: MIT\n\npragma solidity >=0.8.4 <0.9.0;\n\nimport '@openzeppelin/contracts/token/ERC20/IERC20.sol';\nimport '@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol';\nimport '../../contracts/peripherals/Governable.sol';\nimport '../../interfaces/peripherals/IDustCollector.sol';\n\nabstract contract DustCollector is IDustCollector, Governable {\n using SafeERC20 for IERC20;\n\n address internal constant _ETH_ADDRESS = 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE;\n\n function sendDust(\n address _token,\n uint256 _amount,\n address _to\n ) external override onlyGovernance {\n if (_to == address(0)) revert ZeroAddress();\n if (_token == _ETH_ADDRESS) {\n payable(_to).transfer(_amount);\n } else {\n IERC20(_token).safeTransfer(_to, _amount);\n }\n emit DustSent(_token, _amount, _to);\n }\n}\n" - }, - "solidity/interfaces/peripherals/IKeep3rJobs.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport './IKeep3rDisputable.sol';\n\n/// @title Keep3rJobOwnership contract\n/// @notice Handles the ownership of the jobs\ninterface IKeep3rJobOwnership {\n // Events\n\n /// @notice Emitted when Keep3rJobOwnership#changeJobOwnership is called\n /// @param _job The address of the job proposed to have a change of owner\n /// @param _owner The current owner of the job\n /// @param _pendingOwner The new address proposed to be the owner of the job\n event JobOwnershipChange(address indexed _job, address indexed _owner, address indexed _pendingOwner);\n\n /// @notice Emitted when Keep3rJobOwnership#JobOwnershipAssent is called\n /// @param _job The address of the job which the proposed owner will now own\n /// @param _previousOwner The previous owner of the job\n /// @param _newOwner The new owner of the job\n event JobOwnershipAssent(address indexed _job, address indexed _previousOwner, address indexed _newOwner);\n\n // Errors\n\n /// @notice Throws when the caller of the function is not the job owner\n error OnlyJobOwner();\n\n /// @notice Throws when the caller of the function is not the pending job owner\n error OnlyPendingJobOwner();\n\n // Variables\n\n /// @notice Maps the job to the owner of the job\n /// @param _job The address of the job\n /// @return _owner The address of the owner of the job\n function jobOwner(address _job) external view returns (address _owner);\n\n /// @notice Maps the job to its pending owner\n /// @param _job The address of the job\n /// @return _pendingOwner The address of the pending owner of the job\n function jobPendingOwner(address _job) external view returns (address _pendingOwner);\n\n // Methods\n\n /// @notice Proposes a new address to be the owner of the job\n /// @param _job The address of the job\n /// @param _newOwner The address of the proposed new owner\n function changeJobOwnership(address _job, address _newOwner) external;\n\n /// @notice The proposed address accepts to be the owner of the job\n /// @param _job The address of the job\n function acceptJobOwnership(address _job) external;\n}\n\n/// @title Keep3rJobManager contract\n/// @notice Handles the addition and withdrawal of credits from a job\ninterface IKeep3rJobManager is IKeep3rJobOwnership {\n // Events\n\n /// @notice Emitted when Keep3rJobManager#addJob is called\n /// @param _job The address of the job to add\n /// @param _jobOwner The job's owner\n event JobAddition(address indexed _job, address indexed _jobOwner);\n\n // Errors\n\n /// @notice Throws when trying to add a job that has already been added\n error JobAlreadyAdded();\n\n /// @notice Throws when the address that is trying to register as a keeper is already a keeper\n error AlreadyAKeeper();\n\n // Methods\n\n /// @notice Allows any caller to add a new job\n /// @param _job Address of the contract for which work should be performed\n function addJob(address _job) external;\n}\n\n/// @title Keep3rJobFundableCredits contract\n/// @notice Handles the addition and withdrawal of credits from a job\ninterface IKeep3rJobFundableCredits is IKeep3rJobOwnership {\n // Events\n\n /// @notice Emitted when Keep3rJobFundableCredits#addTokenCreditsToJob is called\n /// @param _job The address of the job being credited\n /// @param _token The address of the token being provided\n /// @param _provider The user that calls the function\n /// @param _amount The amount of credit being added to the job\n event TokenCreditAddition(address indexed _job, address indexed _token, address indexed _provider, uint256 _amount);\n\n /// @notice Emitted when Keep3rJobFundableCredits#withdrawTokenCreditsFromJob is called\n /// @param _job The address of the job from which the credits are withdrawn\n /// @param _token The credit being withdrawn from the job\n /// @param _receiver The user that receives the tokens\n /// @param _amount The amount of credit withdrawn\n event TokenCreditWithdrawal(address indexed _job, address indexed _token, address indexed _receiver, uint256 _amount);\n\n // Errors\n\n /// @notice Throws when the token is KP3R, as it should not be used for direct token payments\n error TokenUnallowed();\n\n /// @notice Throws when the token withdraw cooldown has not yet passed\n error JobTokenCreditsLocked();\n\n /// @notice Throws when the user tries to withdraw more tokens than it has\n error InsufficientJobTokenCredits();\n\n // Variables\n\n /// @notice Last block where tokens were added to the job\n /// @param _job The address of the job credited\n /// @param _token The address of the token credited\n /// @return _timestamp The last block where tokens were added to the job\n function jobTokenCreditsAddedAt(address _job, address _token) external view returns (uint256 _timestamp);\n\n // Methods\n\n /// @notice Add credit to a job to be paid out for work\n /// @param _job The address of the job being credited\n /// @param _token The address of the token being credited\n /// @param _amount The amount of credit being added\n function addTokenCreditsToJob(\n address _job,\n address _token,\n uint256 _amount\n ) external;\n\n /// @notice Withdraw credit from a job\n /// @param _job The address of the job from which the credits are withdrawn\n /// @param _token The address of the token being withdrawn\n /// @param _amount The amount of token to be withdrawn\n /// @param _receiver The user that will receive tokens\n function withdrawTokenCreditsFromJob(\n address _job,\n address _token,\n uint256 _amount,\n address _receiver\n ) external;\n}\n\n/// @title Keep3rJobFundableLiquidity contract\n/// @notice Handles the funding of jobs through specific liquidity pairs\ninterface IKeep3rJobFundableLiquidity is IKeep3rJobOwnership {\n // Events\n\n /// @notice Emitted when Keep3rJobFundableLiquidity#approveLiquidity function is called\n /// @param _liquidity The address of the liquidity pair being approved\n event LiquidityApproval(address _liquidity);\n\n /// @notice Emitted when Keep3rJobFundableLiquidity#revokeLiquidity function is called\n /// @param _liquidity The address of the liquidity pair being revoked\n event LiquidityRevocation(address _liquidity);\n\n /// @notice Emitted when IKeep3rJobFundableLiquidity#addLiquidityToJob function is called\n /// @param _job The address of the job to which liquidity will be added\n /// @param _liquidity The address of the liquidity being added\n /// @param _provider The user that calls the function\n /// @param _amount The amount of liquidity being added\n event LiquidityAddition(address indexed _job, address indexed _liquidity, address indexed _provider, uint256 _amount);\n\n /// @notice Emitted when IKeep3rJobFundableLiquidity#withdrawLiquidityFromJob function is called\n /// @param _job The address of the job of which liquidity will be withdrawn from\n /// @param _liquidity The address of the liquidity being withdrawn\n /// @param _receiver The receiver of the liquidity tokens\n /// @param _amount The amount of liquidity being withdrawn from the job\n event LiquidityWithdrawal(address indexed _job, address indexed _liquidity, address indexed _receiver, uint256 _amount);\n\n /// @notice Emitted when Keep3rJobFundableLiquidity#addLiquidityToJob function is called\n /// @param _job The address of the job whose credits will be updated\n /// @param _rewardedAt The time at which the job was last rewarded\n /// @param _currentCredits The current credits of the job\n /// @param _periodCredits The credits of the job for the current period\n event LiquidityCreditsReward(address indexed _job, uint256 _rewardedAt, uint256 _currentCredits, uint256 _periodCredits);\n\n /// @notice Emitted when Keep3rJobFundableLiquidity#forceLiquidityCreditsToJob function is called\n /// @param _job The address of the job whose credits will be updated\n /// @param _rewardedAt The time at which the job was last rewarded\n /// @param _currentCredits The current credits of the job\n event LiquidityCreditsForced(address indexed _job, uint256 _rewardedAt, uint256 _currentCredits);\n\n // Errors\n\n /// @notice Throws when the liquidity being approved has already been approved\n error LiquidityPairApproved();\n\n /// @notice Throws when the liquidity being removed has not been approved\n error LiquidityPairUnexistent();\n\n /// @notice Throws when trying to add liquidity to an unapproved pool\n error LiquidityPairUnapproved();\n\n /// @notice Throws when the job doesn't have the requested liquidity\n error JobLiquidityUnexistent();\n\n /// @notice Throws when trying to remove more liquidity than the job has\n error JobLiquidityInsufficient();\n\n /// @notice Throws when trying to add less liquidity than the minimum liquidity required\n error JobLiquidityLessThanMin();\n\n // Structs\n\n /// @notice Stores the tick information of the different liquidity pairs\n struct TickCache {\n int56 current; // Tracks the current tick\n int56 difference; // Stores the difference between the current tick and the last tick\n uint256 period; // Stores the period at which the last observation was made\n }\n\n // Variables\n\n /// @notice Lists liquidity pairs\n /// @return _list An array of addresses with all the approved liquidity pairs\n function approvedLiquidities() external view returns (address[] memory _list);\n\n /// @notice Amount of liquidity in a specified job\n /// @param _job The address of the job being checked\n /// @param _liquidity The address of the liquidity we are checking\n /// @return _amount Amount of liquidity in the specified job\n function liquidityAmount(address _job, address _liquidity) external view returns (uint256 _amount);\n\n /// @notice Last time the job was rewarded liquidity credits\n /// @param _job The address of the job being checked\n /// @return _timestamp Timestamp of the last time the job was rewarded liquidity credits\n function rewardedAt(address _job) external view returns (uint256 _timestamp);\n\n /// @notice Last time the job was worked\n /// @param _job The address of the job being checked\n /// @return _timestamp Timestamp of the last time the job was worked\n function workedAt(address _job) external view returns (uint256 _timestamp);\n\n // Methods\n\n /// @notice Returns the liquidity credits of a given job\n /// @param _job The address of the job of which we want to know the liquidity credits\n /// @return _amount The liquidity credits of a given job\n function jobLiquidityCredits(address _job) external view returns (uint256 _amount);\n\n /// @notice Returns the credits of a given job for the current period\n /// @param _job The address of the job of which we want to know the period credits\n /// @return _amount The credits the given job has at the current period\n function jobPeriodCredits(address _job) external view returns (uint256 _amount);\n\n /// @notice Calculates the total credits of a given job\n /// @param _job The address of the job of which we want to know the total credits\n /// @return _amount The total credits of the given job\n function totalJobCredits(address _job) external view returns (uint256 _amount);\n\n /// @notice Calculates how many credits should be rewarded periodically for a given liquidity amount\n /// @dev _periodCredits = underlying KP3Rs for given liquidity amount * rewardPeriod / inflationPeriod\n /// @param _liquidity The address of the liquidity to provide\n /// @param _amount The amount of liquidity to provide\n /// @return _periodCredits The amount of KP3R periodically minted for the given liquidity\n function quoteLiquidity(address _liquidity, uint256 _amount) external view returns (uint256 _periodCredits);\n\n /// @notice Observes the current state of the liquidity pair being observed and updates TickCache with the information\n /// @param _liquidity The address of the liquidity pair being observed\n /// @return _tickCache The updated TickCache\n function observeLiquidity(address _liquidity) external view returns (TickCache memory _tickCache);\n\n /// @notice Gifts liquidity credits to the specified job\n /// @param _job The address of the job being credited\n /// @param _amount The amount of liquidity credits to gift\n function forceLiquidityCreditsToJob(address _job, uint256 _amount) external;\n\n /// @notice Approve a liquidity pair for being accepted in future\n /// @param _liquidity The address of the liquidity accepted\n function approveLiquidity(address _liquidity) external;\n\n /// @notice Revoke a liquidity pair from being accepted in future\n /// @param _liquidity The liquidity no longer accepted\n function revokeLiquidity(address _liquidity) external;\n\n /// @notice Allows anyone to fund a job with liquidity\n /// @param _job The address of the job to assign liquidity to\n /// @param _liquidity The liquidity being added\n /// @param _amount The amount of liquidity tokens to add\n function addLiquidityToJob(\n address _job,\n address _liquidity,\n uint256 _amount\n ) external;\n\n /// @notice Unbond liquidity for a job\n /// @dev Can only be called by the job's owner\n /// @param _job The address of the job being unbonded from\n /// @param _liquidity The liquidity being unbonded\n /// @param _amount The amount of liquidity being removed\n function unbondLiquidityFromJob(\n address _job,\n address _liquidity,\n uint256 _amount\n ) external;\n\n /// @notice Withdraw liquidity from a job\n /// @param _job The address of the job being withdrawn from\n /// @param _liquidity The liquidity being withdrawn\n /// @param _receiver The address that will receive the withdrawn liquidity\n function withdrawLiquidityFromJob(\n address _job,\n address _liquidity,\n address _receiver\n ) external;\n}\n\n/// @title Keep3rJobMigration contract\n/// @notice Handles the migration process of jobs to different addresses\ninterface IKeep3rJobMigration is IKeep3rJobFundableCredits, IKeep3rJobFundableLiquidity {\n // Events\n\n /// @notice Emitted when Keep3rJobMigration#migrateJob function is called\n /// @param _fromJob The address of the job that requests to migrate\n /// @param _toJob The address at which the job requests to migrate\n event JobMigrationRequested(address indexed _fromJob, address _toJob);\n\n /// @notice Emitted when Keep3rJobMigration#acceptJobMigration function is called\n /// @param _fromJob The address of the job that requested to migrate\n /// @param _toJob The address at which the job had requested to migrate\n event JobMigrationSuccessful(address _fromJob, address indexed _toJob);\n\n // Errors\n\n /// @notice Throws when the address of the job that requests to migrate wants to migrate to its same address\n error JobMigrationImpossible();\n\n /// @notice Throws when the _toJob address differs from the address being tracked in the pendingJobMigrations mapping\n error JobMigrationUnavailable();\n\n /// @notice Throws when cooldown between migrations has not yet passed\n error JobMigrationLocked();\n\n // Variables\n\n /// @notice Maps the jobs that have requested a migration to the address they have requested to migrate to\n /// @return _toJob The address to which the job has requested to migrate to\n function pendingJobMigrations(address _fromJob) external view returns (address _toJob);\n\n // Methods\n\n /// @notice Initializes the migration process for a job by adding the request to the pendingJobMigrations mapping\n /// @param _fromJob The address of the job that is requesting to migrate\n /// @param _toJob The address at which the job is requesting to migrate\n function migrateJob(address _fromJob, address _toJob) external;\n\n /// @notice Completes the migration process for a job\n /// @dev Unbond/withdraw process doesn't get migrated\n /// @param _fromJob The address of the job that requested to migrate\n /// @param _toJob The address to which the job wants to migrate to\n function acceptJobMigration(address _fromJob, address _toJob) external;\n}\n\n/// @title Keep3rJobWorkable contract\n/// @notice Handles the mechanisms jobs can pay keepers with along with the restrictions jobs can put on keepers before they can work on jobs\ninterface IKeep3rJobWorkable is IKeep3rJobMigration {\n // Events\n\n /// @notice Emitted when a keeper is validated before a job\n /// @param _gasLeft The amount of gas that the transaction has left at the moment of keeper validation\n event KeeperValidation(uint256 _gasLeft);\n\n /// @notice Emitted when a keeper works a job\n /// @param _credit The address of the asset in which the keeper is paid\n /// @param _job The address of the job the keeper has worked\n /// @param _keeper The address of the keeper that has worked the job\n /// @param _payment The amount that has been paid out to the keeper in exchange for working the job\n /// @param _gasLeft The amount of gas that the transaction has left at the moment of payment\n event KeeperWork(address indexed _credit, address indexed _job, address indexed _keeper, uint256 _payment, uint256 _gasLeft);\n\n // Errors\n\n /// @notice Throws if work method was called without calling isKeeper or isBondedKeeper\n error GasNotInitialized();\n\n /// @notice Throws if the address claiming to be a job is not in the list of approved jobs\n error JobUnapproved();\n\n /// @notice Throws if the amount of funds in the job is less than the payment that must be paid to the keeper that works that job\n error InsufficientFunds();\n\n // Methods\n\n /// @notice Confirms if the current keeper is registered\n /// @dev Can be used for general (non critical) functions\n /// @param _keeper The keeper being investigated\n /// @return _isKeeper Whether the address passed as a parameter is a keeper or not\n function isKeeper(address _keeper) external returns (bool _isKeeper);\n\n /// @notice Confirms if the current keeper is registered and has a minimum bond of any asset.\n /// @dev Should be used for protected functions\n /// @param _keeper The keeper to check\n /// @param _bond The bond token being evaluated\n /// @param _minBond The minimum amount of bonded tokens\n /// @param _earned The minimum funds earned in the keepers lifetime\n /// @param _age The minimum keeper age required\n /// @return _isBondedKeeper Whether the `_keeper` meets the given requirements\n function isBondedKeeper(\n address _keeper,\n address _bond,\n uint256 _minBond,\n uint256 _earned,\n uint256 _age\n ) external returns (bool _isBondedKeeper);\n\n /// @notice Implemented by jobs to show that a keeper performed work\n /// @dev Automatically calculates the payment for the keeper and pays the keeper with bonded KP3R\n /// @param _keeper Address of the keeper that performed the work\n function worked(address _keeper) external;\n\n /// @notice Implemented by jobs to show that a keeper performed work\n /// @dev Pays the keeper that performs the work with KP3R\n /// @param _keeper Address of the keeper that performed the work\n /// @param _payment The reward that should be allocated for the job\n function bondedPayment(address _keeper, uint256 _payment) external;\n\n /// @notice Implemented by jobs to show that a keeper performed work\n /// @dev Pays the keeper that performs the work with a specific token\n /// @param _token The asset being awarded to the keeper\n /// @param _keeper Address of the keeper that performed the work\n /// @param _amount The reward that should be allocated\n function directTokenPayment(\n address _token,\n address _keeper,\n uint256 _amount\n ) external;\n}\n\n/// @title Keep3rJobDisputable contract\n/// @notice Handles the actions that can be taken on a disputed job\ninterface IKeep3rJobDisputable is IKeep3rDisputable, IKeep3rJobFundableCredits, IKeep3rJobFundableLiquidity {\n // Events\n\n /// @notice Emitted when Keep3rJobDisputable#slashTokenFromJob is called\n /// @param _job The address of the job from which the token will be slashed\n /// @param _token The address of the token being slashed\n /// @param _slasher The user that slashes the token\n /// @param _amount The amount of the token being slashed\n event JobSlashToken(address indexed _job, address _token, address indexed _slasher, uint256 _amount);\n\n /// @notice Emitted when Keep3rJobDisputable#slashLiquidityFromJob is called\n /// @param _job The address of the job from which the liquidity will be slashed\n /// @param _liquidity The address of the liquidity being slashed\n /// @param _slasher The user that slashes the liquidity\n /// @param _amount The amount of the liquidity being slashed\n event JobSlashLiquidity(address indexed _job, address _liquidity, address indexed _slasher, uint256 _amount);\n\n // Errors\n\n /// @notice Throws when the token trying to be slashed doesn't exist\n error JobTokenUnexistent();\n\n /// @notice Throws when someone tries to slash more tokens than the job has\n error JobTokenInsufficient();\n\n // Methods\n\n /// @notice Allows governance or slasher to slash a job specific token\n /// @param _job The address of the job from which the token will be slashed\n /// @param _token The address of the token that will be slashed\n /// @param _amount The amount of the token that will be slashed\n function slashTokenFromJob(\n address _job,\n address _token,\n uint256 _amount\n ) external;\n\n /// @notice Allows governance or a slasher to slash liquidity from a job\n /// @param _job The address being slashed\n /// @param _liquidity The address of the liquidity that will be slashed\n /// @param _amount The amount of liquidity that will be slashed\n function slashLiquidityFromJob(\n address _job,\n address _liquidity,\n uint256 _amount\n ) external;\n}\n\n// solhint-disable-next-line no-empty-blocks\ninterface IKeep3rJobs is IKeep3rJobWorkable, IKeep3rJobManager, IKeep3rJobDisputable {\n\n}\n" - }, - "solidity/interfaces/peripherals/IKeep3rKeepers.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport './IKeep3rDisputable.sol';\n\n/// @title Keep3rKeeperFundable contract\n/// @notice Handles the actions required to become a keeper\ninterface IKeep3rKeeperFundable {\n // Events\n\n /// @notice Emitted when Keep3rKeeperFundable#activate is called\n /// @param _keeper The keeper that has been activated\n /// @param _bond The asset the keeper has bonded\n /// @param _amount The amount of the asset the keeper has bonded\n event Activation(address indexed _keeper, address indexed _bond, uint256 _amount);\n\n /// @notice Emitted when Keep3rKeeperFundable#withdraw is called\n /// @param _keeper The caller of Keep3rKeeperFundable#withdraw function\n /// @param _bond The asset to withdraw from the bonding pool\n /// @param _amount The amount of funds withdrawn\n event Withdrawal(address indexed _keeper, address indexed _bond, uint256 _amount);\n\n // Errors\n\n /// @notice Throws when the address that is trying to register as a job is already a job\n error AlreadyAJob();\n\n // Methods\n\n /// @notice Beginning of the bonding process\n /// @param _bonding The asset being bonded\n /// @param _amount The amount of bonding asset being bonded\n function bond(address _bonding, uint256 _amount) external;\n\n /// @notice Beginning of the unbonding process\n /// @param _bonding The asset being unbonded\n /// @param _amount Allows for partial unbonding\n function unbond(address _bonding, uint256 _amount) external;\n\n /// @notice End of the bonding process after bonding time has passed\n /// @param _bonding The asset being activated as bond collateral\n function activate(address _bonding) external;\n\n /// @notice Withdraw funds after unbonding has finished\n /// @param _bonding The asset to withdraw from the bonding pool\n function withdraw(address _bonding) external;\n}\n\n/// @title Keep3rKeeperDisputable contract\n/// @notice Handles the actions that can be taken on a disputed keeper\ninterface IKeep3rKeeperDisputable is IKeep3rDisputable, IKeep3rKeeperFundable {\n // Events\n\n /// @notice Emitted when Keep3rKeeperDisputable#slash is called\n /// @param _keeper The address of the slashed keeper\n /// @param _slasher The user that called Keep3rKeeperDisputable#slash\n /// @param _amount The amount of credits slashed from the keeper\n event KeeperSlash(address indexed _keeper, address indexed _slasher, uint256 _amount);\n\n /// @notice Emitted when Keep3rKeeperDisputable#revoke is called\n /// @param _keeper The address of the revoked keeper\n /// @param _slasher The user that called Keep3rKeeperDisputable#revoke\n event KeeperRevoke(address indexed _keeper, address indexed _slasher);\n\n // Methods\n\n /// @notice Allows governance to slash a keeper based on a dispute\n /// @param _keeper The address being slashed\n /// @param _bonded The asset being slashed\n /// @param _bondAmount The bonded amount being slashed\n /// @param _unbondAmount The pending unbond amount being slashed\n function slash(\n address _keeper,\n address _bonded,\n uint256 _bondAmount,\n uint256 _unbondAmount\n ) external;\n\n /// @notice Blacklists a keeper from participating in the network\n /// @param _keeper The address being slashed\n function revoke(address _keeper) external;\n}\n\n// solhint-disable-next-line no-empty-blocks\n\n/// @title Keep3rKeepers contract\ninterface IKeep3rKeepers is IKeep3rKeeperDisputable {\n\n}\n" - }, - "solidity/interfaces/peripherals/IKeep3rParameters.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport './IKeep3rAccountance.sol';\n\n/// @title Keep3rParameters contract\n/// @notice Handles and sets all the required parameters for Keep3r\ninterface IKeep3rParameters is IKeep3rAccountance {\n // Events\n\n /// @notice Emitted when the Keep3rHelper address is changed\n /// @param _keep3rHelper The address of Keep3rHelper's contract\n event Keep3rHelperChange(address _keep3rHelper);\n\n /// @notice Emitted when the Keep3rV1 address is changed\n /// @param _keep3rV1 The address of Keep3rV1's contract\n event Keep3rV1Change(address _keep3rV1);\n\n /// @notice Emitted when the Keep3rV1Proxy address is changed\n /// @param _keep3rV1Proxy The address of Keep3rV1Proxy's contract\n event Keep3rV1ProxyChange(address _keep3rV1Proxy);\n\n /// @notice Emitted when bondTime is changed\n /// @param _bondTime The new bondTime\n event BondTimeChange(uint256 _bondTime);\n\n /// @notice Emitted when _liquidityMinimum is changed\n /// @param _liquidityMinimum The new _liquidityMinimum\n event LiquidityMinimumChange(uint256 _liquidityMinimum);\n\n /// @notice Emitted when _unbondTime is changed\n /// @param _unbondTime The new _unbondTime\n event UnbondTimeChange(uint256 _unbondTime);\n\n /// @notice Emitted when _rewardPeriodTime is changed\n /// @param _rewardPeriodTime The new _rewardPeriodTime\n event RewardPeriodTimeChange(uint256 _rewardPeriodTime);\n\n /// @notice Emitted when the inflationPeriod is changed\n /// @param _inflationPeriod The new inflationPeriod\n event InflationPeriodChange(uint256 _inflationPeriod);\n\n /// @notice Emitted when the fee is changed\n /// @param _fee The new token credits fee\n event FeeChange(uint256 _fee);\n\n // Variables\n\n /// @notice Address of Keep3rHelper's contract\n /// @return _keep3rHelper The address of Keep3rHelper's contract\n function keep3rHelper() external view returns (address _keep3rHelper);\n\n /// @notice Address of Keep3rV1's contract\n /// @return _keep3rV1 The address of Keep3rV1's contract\n function keep3rV1() external view returns (address _keep3rV1);\n\n /// @notice Address of Keep3rV1Proxy's contract\n /// @return _keep3rV1Proxy The address of Keep3rV1Proxy's contract\n function keep3rV1Proxy() external view returns (address _keep3rV1Proxy);\n\n /// @notice The amount of time required to pass after a keeper has bonded assets for it to be able to activate\n /// @return _days The required bondTime in days\n function bondTime() external view returns (uint256 _days);\n\n /// @notice The amount of time required to pass before a keeper can unbond what he has bonded\n /// @return _days The required unbondTime in days\n function unbondTime() external view returns (uint256 _days);\n\n /// @notice The minimum amount of liquidity required to fund a job per liquidity\n /// @return _amount The minimum amount of liquidity in KP3R\n function liquidityMinimum() external view returns (uint256 _amount);\n\n /// @notice The amount of time between each scheduled credits reward given to a job\n /// @return _days The reward period in days\n function rewardPeriodTime() external view returns (uint256 _days);\n\n /// @notice The inflation period is the denominator used to regulate the emission of KP3R\n /// @return _period The denominator used to regulate the emission of KP3R\n function inflationPeriod() external view returns (uint256 _period);\n\n /// @notice The fee to be sent to governance when a user adds liquidity to a job\n /// @return _amount The fee amount to be sent to governance when a user adds liquidity to a job\n function fee() external view returns (uint256 _amount);\n\n // Errors\n\n /// @notice Throws if the reward period is less than the minimum reward period time\n error MinRewardPeriod();\n\n /// @notice Throws if either a job or a keeper is disputed\n error Disputed();\n\n /// @notice Throws if there are no bonded assets\n error BondsUnexistent();\n\n /// @notice Throws if the time required to bond an asset has not passed yet\n error BondsLocked();\n\n /// @notice Throws if there are no bonds to withdraw\n error UnbondsUnexistent();\n\n /// @notice Throws if the time required to withdraw the bonds has not passed yet\n error UnbondsLocked();\n\n // Methods\n\n /// @notice Sets the Keep3rHelper address\n /// @param _keep3rHelper The Keep3rHelper address\n function setKeep3rHelper(address _keep3rHelper) external;\n\n /// @notice Sets the Keep3rV1 address\n /// @param _keep3rV1 The Keep3rV1 address\n function setKeep3rV1(address _keep3rV1) external;\n\n /// @notice Sets the Keep3rV1Proxy address\n /// @param _keep3rV1Proxy The Keep3rV1Proxy address\n function setKeep3rV1Proxy(address _keep3rV1Proxy) external;\n\n /// @notice Sets the bond time required to activate as a keeper\n /// @param _bond The new bond time\n function setBondTime(uint256 _bond) external;\n\n /// @notice Sets the unbond time required unbond what has been bonded\n /// @param _unbond The new unbond time\n function setUnbondTime(uint256 _unbond) external;\n\n /// @notice Sets the minimum amount of liquidity required to fund a job\n /// @param _liquidityMinimum The new minimum amount of liquidity\n function setLiquidityMinimum(uint256 _liquidityMinimum) external;\n\n /// @notice Sets the time required to pass between rewards for jobs\n /// @param _rewardPeriodTime The new amount of time required to pass between rewards\n function setRewardPeriodTime(uint256 _rewardPeriodTime) external;\n\n /// @notice Sets the new inflation period\n /// @param _inflationPeriod The new inflation period\n function setInflationPeriod(uint256 _inflationPeriod) external;\n\n /// @notice Sets the new fee\n /// @param _fee The new fee\n function setFee(uint256 _fee) external;\n}\n" - }, - "solidity/interfaces/peripherals/IKeep3rDisputable.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\n/// @title Keep3rDisputable contract\n/// @notice Creates/resolves disputes for jobs or keepers\n/// A disputed keeper is slashable and is not able to bond, activate, withdraw or receive direct payments\n/// A disputed job is slashable and is not able to pay the keepers, withdraw tokens or to migrate\ninterface IKeep3rDisputable {\n /// @notice Emitted when a keeper or a job is disputed\n /// @param _jobOrKeeper The address of the disputed keeper/job\n /// @param _disputer The user that called the function and disputed the keeper\n event Dispute(address indexed _jobOrKeeper, address indexed _disputer);\n\n /// @notice Emitted when a dispute is resolved\n /// @param _jobOrKeeper The address of the disputed keeper/job\n /// @param _resolver The user that called the function and resolved the dispute\n event Resolve(address indexed _jobOrKeeper, address indexed _resolver);\n\n /// @notice Throws when a job or keeper is already disputed\n error AlreadyDisputed();\n\n /// @notice Throws when a job or keeper is not disputed and someone tries to resolve the dispute\n error NotDisputed();\n\n /// @notice Allows governance to create a dispute for a given keeper/job\n /// @param _jobOrKeeper The address in dispute\n function dispute(address _jobOrKeeper) external;\n\n /// @notice Allows governance to resolve a dispute on a keeper/job\n /// @param _jobOrKeeper The address cleared\n function resolve(address _jobOrKeeper) external;\n}\n" - }, - "solidity/interfaces/peripherals/IKeep3rAccountance.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport './IKeep3rRoles.sol';\n\n/// @title Keep3rDisputable contract\n/// @notice Disputes keepers, or if they're already disputed, it can resolve the case\n/// @dev Argument `bonding` can be the address of either a token or a liquidity\ninterface IKeep3rAccountance is IKeep3rRoles {\n // Events\n\n /// @notice Emitted when the bonding process of a new keeper begins\n /// @param _keeper The caller of Keep3rKeeperFundable#bond function\n /// @param _bonding The asset the keeper has bonded\n /// @param _amount The amount the keeper has bonded\n event Bonding(address indexed _keeper, address indexed _bonding, uint256 _amount);\n\n /// @notice Emitted when a keeper or job begins the unbonding process to withdraw the funds\n /// @param _keeperOrJob The keeper or job that began the unbonding process\n /// @param _unbonding The liquidity pair or asset being unbonded\n /// @param _amount The amount being unbonded\n event Unbonding(address indexed _keeperOrJob, address indexed _unbonding, uint256 _amount);\n\n // Variables\n\n /// @notice Tracks the total amount of bonded KP3Rs in the contract\n /// @return _totalBonds The total amount of bonded KP3Rs in the contract\n function totalBonds() external view returns (uint256 _totalBonds);\n\n /// @notice Tracks the total KP3R earnings of a keeper since it started working\n /// @param _keeper The address of the keeper\n /// @return _workCompleted Total KP3R earnings of a keeper since it started working\n function workCompleted(address _keeper) external view returns (uint256 _workCompleted);\n\n /// @notice Tracks when a keeper was first registered\n /// @param _keeper The address of the keeper\n /// @return timestamp The time at which the keeper was first registered\n function firstSeen(address _keeper) external view returns (uint256 timestamp);\n\n /// @notice Tracks if a keeper or job has a pending dispute\n /// @param _keeperOrJob The address of the keeper or job\n /// @return _disputed Whether a keeper or job has a pending dispute\n function disputes(address _keeperOrJob) external view returns (bool _disputed);\n\n /// @notice Tracks how much a keeper has bonded of a certain token\n /// @param _keeper The address of the keeper\n /// @param _bond The address of the token being bonded\n /// @return _bonds Amount of a certain token that a keeper has bonded\n function bonds(address _keeper, address _bond) external view returns (uint256 _bonds);\n\n /// @notice The current token credits available for a job\n /// @param _job The address of the job\n /// @param _token The address of the token bonded\n /// @return _amount The amount of token credits available for a job\n function jobTokenCredits(address _job, address _token) external view returns (uint256 _amount);\n\n /// @notice Tracks the amount of assets deposited in pending bonds\n /// @param _keeper The address of the keeper\n /// @param _bonding The address of the token being bonded\n /// @return _pendingBonds Amount of a certain asset a keeper has unbonding\n function pendingBonds(address _keeper, address _bonding) external view returns (uint256 _pendingBonds);\n\n /// @notice Tracks when a bonding for a keeper can be activated\n /// @param _keeper The address of the keeper\n /// @param _bonding The address of the token being bonded\n /// @return _timestamp Time at which the bonding for a keeper can be activated\n function canActivateAfter(address _keeper, address _bonding) external view returns (uint256 _timestamp);\n\n /// @notice Tracks when keeper bonds are ready to be withdrawn\n /// @param _keeper The address of the keeper\n /// @param _bonding The address of the token being unbonded\n /// @return _timestamp Time at which the keeper bonds are ready to be withdrawn\n function canWithdrawAfter(address _keeper, address _bonding) external view returns (uint256 _timestamp);\n\n /// @notice Tracks how much keeper bonds are to be withdrawn\n /// @param _keeper The address of the keeper\n /// @param _bonding The address of the token being unbonded\n /// @return _pendingUnbonds The amount of keeper bonds that are to be withdrawn\n function pendingUnbonds(address _keeper, address _bonding) external view returns (uint256 _pendingUnbonds);\n\n /// @notice Checks whether the address has ever bonded an asset\n /// @param _keeper The address of the keeper\n /// @return _hasBonded Whether the address has ever bonded an asset\n function hasBonded(address _keeper) external view returns (bool _hasBonded);\n\n // Methods\n\n /// @notice Lists all jobs\n /// @return _jobList Array with all the jobs in _jobs\n function jobs() external view returns (address[] memory _jobList);\n\n /// @notice Lists all keepers\n /// @return _keeperList Array with all the keepers in _keepers\n function keepers() external view returns (address[] memory _keeperList);\n\n // Errors\n\n /// @notice Throws when an address is passed as a job, but that address is not a job\n error JobUnavailable();\n\n /// @notice Throws when an action that requires an undisputed job is applied on a disputed job\n error JobDisputed();\n}\n" - }, - "solidity/interfaces/peripherals/IKeep3rRoles.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport './IBaseErrors.sol';\nimport './IGovernable.sol';\nimport './IDustCollector.sol';\n\n/// @title Keep3rRoles contract\n/// @notice Manages the Keep3r specific roles\ninterface IKeep3rRoles is IBaseErrors, IDustCollector, IGovernable {\n // Events\n\n /// @notice Emitted when a slasher is added\n /// @param _slasher Address of the added slasher\n event SlasherAdded(address _slasher);\n\n /// @notice Emitted when a slasher is removed\n /// @param _slasher Address of the removed slasher\n event SlasherRemoved(address _slasher);\n\n /// @notice Emitted when a disputer is added\n /// @param _disputer Address of the added disputer\n event DisputerAdded(address _disputer);\n\n /// @notice Emitted when a disputer is removed\n /// @param _disputer Address of the removed disputer\n event DisputerRemoved(address _disputer);\n\n // Variables\n\n /// @notice Tracks whether the address is a slasher or not\n /// @param _slasher Address being checked as a slasher\n /// @return _isSlasher Whether the address is a slasher or not\n function slashers(address _slasher) external view returns (bool _isSlasher);\n\n /// @notice Tracks whether the address is a disputer or not\n /// @param _disputer Address being checked as a disputer\n /// @return _isDisputer Whether the address is a disputer or not\n function disputers(address _disputer) external view returns (bool _isDisputer);\n\n // Errors\n\n /// @notice Throws if the address is already a registered slasher\n error SlasherExistent();\n\n /// @notice Throws if caller is not a registered slasher\n error SlasherUnexistent();\n\n /// @notice Throws if the address is already a registered disputer\n error DisputerExistent();\n\n /// @notice Throws if caller is not a registered disputer\n error DisputerUnexistent();\n\n /// @notice Throws if the msg.sender is not a slasher or is not a part of governance\n error OnlySlasher();\n\n /// @notice Throws if the msg.sender is not a disputer or is not a part of governance\n error OnlyDisputer();\n\n // Methods\n\n /// @notice Registers a slasher by updating the slashers mapping\n function addSlasher(address _slasher) external;\n\n /// @notice Removes a slasher by updating the slashers mapping\n function removeSlasher(address _slasher) external;\n\n /// @notice Registers a disputer by updating the disputers mapping\n function addDisputer(address _disputer) external;\n\n /// @notice Removes a disputer by updating the disputers mapping\n function removeDisputer(address _disputer) external;\n}\n" - }, - "solidity/interfaces/peripherals/IBaseErrors.sol": { - "content": "// SPDX-License-Identifier: MIT\n\npragma solidity >=0.8.4 <0.9.0;\n\ninterface IBaseErrors {\n /// @notice Throws if a variable is assigned to the zero address\n error ZeroAddress();\n}\n" - }, - "solidity/interfaces/peripherals/IGovernable.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\n/// @title Governable contract\n/// @notice Manages the governance role\ninterface IGovernable {\n // Events\n\n /// @notice Emitted when pendingGovernance accepts to be governance\n /// @param _governance Address of the new governance\n event GovernanceSet(address _governance);\n\n /// @notice Emitted when a new governance is proposed\n /// @param _pendingGovernance Address that is proposed to be the new governance\n event GovernanceProposal(address _pendingGovernance);\n\n // Errors\n\n /// @notice Throws if the caller of the function is not governance\n error OnlyGovernance();\n\n /// @notice Throws if the caller of the function is not pendingGovernance\n error OnlyPendingGovernance();\n\n /// @notice Throws if trying to set governance to zero address\n error NoGovernanceZeroAddress();\n\n // Variables\n\n /// @notice Stores the governance address\n /// @return _governance The governance addresss\n function governance() external view returns (address _governance);\n\n /// @notice Stores the pendingGovernance address\n /// @return _pendingGovernance The pendingGovernance addresss\n function pendingGovernance() external view returns (address _pendingGovernance);\n\n // Methods\n\n /// @notice Proposes a new address to be governance\n /// @param _governance The address being proposed as the new governance\n function setGovernance(address _governance) external;\n\n /// @notice Changes the governance from the current governance to the previously proposed address\n function acceptGovernance() external;\n}\n" - }, - "solidity/interfaces/peripherals/IDustCollector.sol": { - "content": "// SPDX-License-Identifier: MIT\n\npragma solidity >=0.8.4 <0.9.0;\n\nimport './IBaseErrors.sol';\n\ninterface IDustCollector is IBaseErrors {\n /// @notice Emitted when dust is sent\n /// @param _token The token that will be transferred\n /// @param _amount The amount of the token that will be transferred\n /// @param _to The address which will receive the funds\n event DustSent(address _token, uint256 _amount, address _to);\n\n /// @notice Allows an authorized user to transfer the tokens or eth that may have been left in a contract\n /// @param _token The token that will be transferred\n /// @param _amount The amount of the token that will be transferred\n /// @param _to The address that will receive the idle funds\n function sendDust(\n address _token,\n uint256 _amount,\n address _to\n ) external;\n}\n" - }, - "solidity/contracts/peripherals/jobs/Keep3rJobManager.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport './Keep3rJobOwnership.sol';\nimport '../Keep3rAccountance.sol';\nimport '../../../interfaces/peripherals/IKeep3rJobs.sol';\n\nabstract contract Keep3rJobManager is IKeep3rJobManager, Keep3rJobOwnership, Keep3rAccountance {\n using EnumerableSet for EnumerableSet.AddressSet;\n\n /// @inheritdoc IKeep3rJobManager\n function addJob(address _job) external override {\n if (_jobs.contains(_job)) revert JobAlreadyAdded();\n if (hasBonded[_job]) revert AlreadyAKeeper();\n _jobs.add(_job);\n jobOwner[_job] = msg.sender;\n emit JobAddition(_job, msg.sender);\n }\n}\n" - }, - "solidity/contracts/peripherals/jobs/Keep3rJobWorkable.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport './Keep3rJobMigration.sol';\nimport '../../../interfaces/IKeep3rHelper.sol';\nimport '../../../interfaces/peripherals/IKeep3rJobs.sol';\n\nimport '@openzeppelin/contracts/token/ERC20/IERC20.sol';\nimport '@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol';\n\nabstract contract Keep3rJobWorkable is IKeep3rJobWorkable, Keep3rJobMigration {\n using EnumerableSet for EnumerableSet.AddressSet;\n using SafeERC20 for IERC20;\n\n uint256 internal _initialGas;\n\n /// @inheritdoc IKeep3rJobWorkable\n function isKeeper(address _keeper) external override returns (bool _isKeeper) {\n _initialGas = _getGasLeft();\n if (_keepers.contains(_keeper)) {\n emit KeeperValidation(_initialGas);\n return true;\n }\n }\n\n /// @inheritdoc IKeep3rJobWorkable\n function isBondedKeeper(\n address _keeper,\n address _bond,\n uint256 _minBond,\n uint256 _earned,\n uint256 _age\n ) external override returns (bool _isBondedKeeper) {\n _initialGas = _getGasLeft();\n if (\n _keepers.contains(_keeper) &&\n bonds[_keeper][_bond] >= _minBond &&\n workCompleted[_keeper] >= _earned &&\n block.timestamp - firstSeen[_keeper] >= _age\n ) {\n emit KeeperValidation(_initialGas);\n return true;\n }\n }\n\n /// @inheritdoc IKeep3rJobWorkable\n function worked(address _keeper) external virtual override {\n if (_initialGas == 0) revert GasNotInitialized();\n address _job = msg.sender;\n if (disputes[_job]) revert JobDisputed();\n if (!_jobs.contains(_job)) revert JobUnapproved();\n\n if (_updateJobCreditsIfNeeded(_job)) {\n emit LiquidityCreditsReward(_job, rewardedAt[_job], _jobLiquidityCredits[_job], _jobPeriodCredits[_job]);\n }\n\n (uint256 _boost, uint256 _oneEthQuote, uint256 _extraGas) = IKeep3rHelper(keep3rHelper).getPaymentParams(bonds[_keeper][keep3rV1]);\n\n uint256 _gasLeft = _getGasLeft();\n uint256 _payment = _calculatePayment(_gasLeft, _extraGas, _oneEthQuote, _boost);\n\n if (_payment > _jobLiquidityCredits[_job]) {\n _rewardJobCredits(_job);\n emit LiquidityCreditsReward(_job, rewardedAt[_job], _jobLiquidityCredits[_job], _jobPeriodCredits[_job]);\n\n _gasLeft = _getGasLeft();\n _payment = _calculatePayment(_gasLeft, _extraGas, _oneEthQuote, _boost);\n }\n\n _bondedPayment(_job, _keeper, _payment);\n delete _initialGas;\n\n emit KeeperWork(keep3rV1, _job, _keeper, _payment, _gasLeft);\n }\n\n /// @inheritdoc IKeep3rJobWorkable\n function bondedPayment(address _keeper, uint256 _payment) external override {\n address _job = msg.sender;\n\n if (disputes[_job]) revert JobDisputed();\n if (!_jobs.contains(_job)) revert JobUnapproved();\n\n if (_updateJobCreditsIfNeeded(_job)) {\n emit LiquidityCreditsReward(_job, rewardedAt[_job], _jobLiquidityCredits[_job], _jobPeriodCredits[_job]);\n }\n\n if (_payment > _jobLiquidityCredits[_job]) {\n _rewardJobCredits(_job);\n emit LiquidityCreditsReward(_job, rewardedAt[_job], _jobLiquidityCredits[_job], _jobPeriodCredits[_job]);\n }\n\n _bondedPayment(_job, _keeper, _payment);\n emit KeeperWork(keep3rV1, _job, _keeper, _payment, _getGasLeft());\n }\n\n /// @inheritdoc IKeep3rJobWorkable\n function directTokenPayment(\n address _token,\n address _keeper,\n uint256 _amount\n ) external override {\n address _job = msg.sender;\n\n if (disputes[_job]) revert JobDisputed();\n if (disputes[_keeper]) revert Disputed();\n if (!_jobs.contains(_job)) revert JobUnapproved();\n if (jobTokenCredits[_job][_token] < _amount) revert InsufficientFunds();\n jobTokenCredits[_job][_token] -= _amount;\n IERC20(_token).safeTransfer(_keeper, _amount);\n emit KeeperWork(_token, _job, _keeper, _amount, _getGasLeft());\n }\n\n function _bondedPayment(\n address _job,\n address _keeper,\n uint256 _payment\n ) internal {\n if (_payment > _jobLiquidityCredits[_job]) revert InsufficientFunds();\n\n workedAt[_job] = block.timestamp;\n _jobLiquidityCredits[_job] -= _payment;\n bonds[_keeper][keep3rV1] += _payment;\n workCompleted[_keeper] += _payment;\n totalBonds += _payment;\n }\n\n /// @notice Calculate amount to be payed in KP3R, taking into account multiple parameters\n /// @param _gasLeft Amount of gas left after working the job\n /// @param _extraGas Amount of expected unaccounted gas\n /// @param _oneEthQuote Amount of KP3R equivalent to 1 ETH\n /// @param _boost Reward given to the keeper for having bonded KP3R tokens\n /// @return _payment Amount to be payed in KP3R tokens\n function _calculatePayment(\n uint256 _gasLeft,\n uint256 _extraGas,\n uint256 _oneEthQuote,\n uint256 _boost\n ) internal view returns (uint256 _payment) {\n uint256 _accountedGas = _initialGas - _gasLeft + _extraGas;\n _payment = (((_accountedGas * _boost) / _BASE) * _oneEthQuote) / 1 ether;\n }\n\n /// @notice Return the gas left and add 1/64 in order to match real gas left at first level of depth (EIP-150)\n /// @return _gasLeft Amount of gas left recording taking into account EIP-150\n function _getGasLeft() internal view returns (uint256 _gasLeft) {\n _gasLeft = (gasleft() * 64) / 63;\n }\n}\n" - }, - "solidity/contracts/peripherals/jobs/Keep3rJobDisputable.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport './Keep3rJobFundableCredits.sol';\nimport './Keep3rJobFundableLiquidity.sol';\nimport '../Keep3rDisputable.sol';\n\nabstract contract Keep3rJobDisputable is IKeep3rJobDisputable, Keep3rDisputable, Keep3rJobFundableCredits, Keep3rJobFundableLiquidity {\n using EnumerableSet for EnumerableSet.AddressSet;\n using SafeERC20 for IERC20;\n\n /// @inheritdoc IKeep3rJobDisputable\n function slashTokenFromJob(\n address _job,\n address _token,\n uint256 _amount\n ) external override onlySlasher {\n if (!disputes[_job]) revert NotDisputed();\n if (!_jobTokens[_job].contains(_token)) revert JobTokenUnexistent();\n if (jobTokenCredits[_job][_token] < _amount) revert JobTokenInsufficient();\n\n try IERC20(_token).transfer(governance, _amount) {} catch {}\n jobTokenCredits[_job][_token] -= _amount;\n if (jobTokenCredits[_job][_token] == 0) {\n _jobTokens[_job].remove(_token);\n }\n\n emit JobSlashToken(_job, _token, msg.sender, _amount);\n }\n\n /// @inheritdoc IKeep3rJobDisputable\n function slashLiquidityFromJob(\n address _job,\n address _liquidity,\n uint256 _amount\n ) external override onlySlasher {\n if (!disputes[_job]) revert NotDisputed();\n\n _unbondLiquidityFromJob(_job, _liquidity, _amount);\n try IERC20(_liquidity).transfer(governance, _amount) {} catch {}\n emit JobSlashLiquidity(_job, _liquidity, msg.sender, _amount);\n }\n}\n" - }, - "solidity/contracts/peripherals/jobs/Keep3rJobOwnership.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../../../interfaces/peripherals/IKeep3rJobs.sol';\n\nabstract contract Keep3rJobOwnership is IKeep3rJobOwnership {\n /// @inheritdoc IKeep3rJobOwnership\n mapping(address => address) public override jobOwner;\n\n /// @inheritdoc IKeep3rJobOwnership\n mapping(address => address) public override jobPendingOwner;\n\n /// @inheritdoc IKeep3rJobOwnership\n function changeJobOwnership(address _job, address _newOwner) external override onlyJobOwner(_job) {\n jobPendingOwner[_job] = _newOwner;\n emit JobOwnershipChange(_job, jobOwner[_job], _newOwner);\n }\n\n /// @inheritdoc IKeep3rJobOwnership\n function acceptJobOwnership(address _job) external override onlyPendingJobOwner(_job) {\n address _previousOwner = jobOwner[_job];\n\n jobOwner[_job] = jobPendingOwner[_job];\n delete jobPendingOwner[_job];\n\n emit JobOwnershipAssent(msg.sender, _job, _previousOwner);\n }\n\n modifier onlyJobOwner(address _job) {\n if (msg.sender != jobOwner[_job]) revert OnlyJobOwner();\n _;\n }\n\n modifier onlyPendingJobOwner(address _job) {\n if (msg.sender != jobPendingOwner[_job]) revert OnlyPendingJobOwner();\n _;\n }\n}\n" - }, - "solidity/contracts/peripherals/Keep3rAccountance.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '@openzeppelin/contracts/utils/structs/EnumerableSet.sol';\nimport '../../interfaces/peripherals/IKeep3rAccountance.sol';\nimport './Keep3rRoles.sol';\n\nabstract contract Keep3rAccountance is IKeep3rAccountance, Keep3rRoles {\n using EnumerableSet for EnumerableSet.AddressSet;\n\n /// @notice List of all enabled keepers\n EnumerableSet.AddressSet internal _keepers;\n\n /// @inheritdoc IKeep3rAccountance\n uint256 public override totalBonds;\n\n /// @inheritdoc IKeep3rAccountance\n mapping(address => uint256) public override workCompleted;\n\n /// @inheritdoc IKeep3rAccountance\n mapping(address => uint256) public override firstSeen;\n\n /// @inheritdoc IKeep3rAccountance\n mapping(address => bool) public override disputes;\n\n /// @inheritdoc IKeep3rAccountance\n /// @notice Mapping (job => bonding => amount)\n mapping(address => mapping(address => uint256)) public override bonds;\n\n /// @inheritdoc IKeep3rAccountance\n mapping(address => mapping(address => uint256)) public override jobTokenCredits;\n\n /// @notice The current liquidity credits available for a job\n mapping(address => uint256) internal _jobLiquidityCredits;\n\n /// @notice Map the address of a job to its correspondent periodCredits\n mapping(address => uint256) internal _jobPeriodCredits;\n\n /// @notice Enumerable array of Job Tokens for Credits\n mapping(address => EnumerableSet.AddressSet) internal _jobTokens;\n\n /// @notice List of liquidities that a job has (job => liquidities)\n mapping(address => EnumerableSet.AddressSet) internal _jobLiquidities;\n\n /// @notice Liquidity pool to observe\n mapping(address => address) internal _liquidityPool;\n\n /// @notice Tracks if a pool has KP3R as token0\n mapping(address => bool) internal _isKP3RToken0;\n\n /// @inheritdoc IKeep3rAccountance\n mapping(address => mapping(address => uint256)) public override pendingBonds;\n\n /// @inheritdoc IKeep3rAccountance\n mapping(address => mapping(address => uint256)) public override canActivateAfter;\n\n /// @inheritdoc IKeep3rAccountance\n mapping(address => mapping(address => uint256)) public override canWithdrawAfter;\n\n /// @inheritdoc IKeep3rAccountance\n mapping(address => mapping(address => uint256)) public override pendingUnbonds;\n\n /// @inheritdoc IKeep3rAccountance\n mapping(address => bool) public override hasBonded;\n\n /// @notice List of all enabled jobs\n EnumerableSet.AddressSet internal _jobs;\n\n /// @inheritdoc IKeep3rAccountance\n function jobs() external view override returns (address[] memory _list) {\n _list = _jobs.values();\n }\n\n /// @inheritdoc IKeep3rAccountance\n function keepers() external view override returns (address[] memory _list) {\n _list = _keepers.values();\n }\n}\n" - }, - "@openzeppelin/contracts/utils/structs/EnumerableSet.sol": { - "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Library for managing\n * https://en.wikipedia.org/wiki/Set_(abstract_data_type)[sets] of primitive\n * types.\n *\n * Sets have the following properties:\n *\n * - Elements are added, removed, and checked for existence in constant time\n * (O(1)).\n * - Elements are enumerated in O(n). No guarantees are made on the ordering.\n *\n * ```\n * contract Example {\n * // Add the library methods\n * using EnumerableSet for EnumerableSet.AddressSet;\n *\n * // Declare a set state variable\n * EnumerableSet.AddressSet private mySet;\n * }\n * ```\n *\n * As of v3.3.0, sets of type `bytes32` (`Bytes32Set`), `address` (`AddressSet`)\n * and `uint256` (`UintSet`) are supported.\n */\nlibrary EnumerableSet {\n // To implement this library for multiple types with as little code\n // repetition as possible, we write it in terms of a generic Set type with\n // bytes32 values.\n // The Set implementation uses private functions, and user-facing\n // implementations (such as AddressSet) are just wrappers around the\n // underlying Set.\n // This means that we can only create new EnumerableSets for types that fit\n // in bytes32.\n\n struct Set {\n // Storage of set values\n bytes32[] _values;\n // Position of the value in the `values` array, plus 1 because index 0\n // means a value is not in the set.\n mapping(bytes32 => uint256) _indexes;\n }\n\n /**\n * @dev Add a value to a set. O(1).\n *\n * Returns true if the value was added to the set, that is if it was not\n * already present.\n */\n function _add(Set storage set, bytes32 value) private returns (bool) {\n if (!_contains(set, value)) {\n set._values.push(value);\n // The value is stored at length-1, but we add 1 to all indexes\n // and use 0 as a sentinel value\n set._indexes[value] = set._values.length;\n return true;\n } else {\n return false;\n }\n }\n\n /**\n * @dev Removes a value from a set. O(1).\n *\n * Returns true if the value was removed from the set, that is if it was\n * present.\n */\n function _remove(Set storage set, bytes32 value) private returns (bool) {\n // We read and store the value's index to prevent multiple reads from the same storage slot\n uint256 valueIndex = set._indexes[value];\n\n if (valueIndex != 0) {\n // Equivalent to contains(set, value)\n // To delete an element from the _values array in O(1), we swap the element to delete with the last one in\n // the array, and then remove the last element (sometimes called as 'swap and pop').\n // This modifies the order of the array, as noted in {at}.\n\n uint256 toDeleteIndex = valueIndex - 1;\n uint256 lastIndex = set._values.length - 1;\n\n if (lastIndex != toDeleteIndex) {\n bytes32 lastvalue = set._values[lastIndex];\n\n // Move the last value to the index where the value to delete is\n set._values[toDeleteIndex] = lastvalue;\n // Update the index for the moved value\n set._indexes[lastvalue] = valueIndex; // Replace lastvalue's index to valueIndex\n }\n\n // Delete the slot where the moved value was stored\n set._values.pop();\n\n // Delete the index for the deleted slot\n delete set._indexes[value];\n\n return true;\n } else {\n return false;\n }\n }\n\n /**\n * @dev Returns true if the value is in the set. O(1).\n */\n function _contains(Set storage set, bytes32 value) private view returns (bool) {\n return set._indexes[value] != 0;\n }\n\n /**\n * @dev Returns the number of values on the set. O(1).\n */\n function _length(Set storage set) private view returns (uint256) {\n return set._values.length;\n }\n\n /**\n * @dev Returns the value stored at position `index` in the set. O(1).\n *\n * Note that there are no guarantees on the ordering of values inside the\n * array, and it may change when more values are added or removed.\n *\n * Requirements:\n *\n * - `index` must be strictly less than {length}.\n */\n function _at(Set storage set, uint256 index) private view returns (bytes32) {\n return set._values[index];\n }\n\n /**\n * @dev Return the entire set in an array\n *\n * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed\n * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that\n * this function has an unbounded cost, and using it as part of a state-changing function may render the function\n * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.\n */\n function _values(Set storage set) private view returns (bytes32[] memory) {\n return set._values;\n }\n\n // Bytes32Set\n\n struct Bytes32Set {\n Set _inner;\n }\n\n /**\n * @dev Add a value to a set. O(1).\n *\n * Returns true if the value was added to the set, that is if it was not\n * already present.\n */\n function add(Bytes32Set storage set, bytes32 value) internal returns (bool) {\n return _add(set._inner, value);\n }\n\n /**\n * @dev Removes a value from a set. O(1).\n *\n * Returns true if the value was removed from the set, that is if it was\n * present.\n */\n function remove(Bytes32Set storage set, bytes32 value) internal returns (bool) {\n return _remove(set._inner, value);\n }\n\n /**\n * @dev Returns true if the value is in the set. O(1).\n */\n function contains(Bytes32Set storage set, bytes32 value) internal view returns (bool) {\n return _contains(set._inner, value);\n }\n\n /**\n * @dev Returns the number of values in the set. O(1).\n */\n function length(Bytes32Set storage set) internal view returns (uint256) {\n return _length(set._inner);\n }\n\n /**\n * @dev Returns the value stored at position `index` in the set. O(1).\n *\n * Note that there are no guarantees on the ordering of values inside the\n * array, and it may change when more values are added or removed.\n *\n * Requirements:\n *\n * - `index` must be strictly less than {length}.\n */\n function at(Bytes32Set storage set, uint256 index) internal view returns (bytes32) {\n return _at(set._inner, index);\n }\n\n /**\n * @dev Return the entire set in an array\n *\n * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed\n * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that\n * this function has an unbounded cost, and using it as part of a state-changing function may render the function\n * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.\n */\n function values(Bytes32Set storage set) internal view returns (bytes32[] memory) {\n return _values(set._inner);\n }\n\n // AddressSet\n\n struct AddressSet {\n Set _inner;\n }\n\n /**\n * @dev Add a value to a set. O(1).\n *\n * Returns true if the value was added to the set, that is if it was not\n * already present.\n */\n function add(AddressSet storage set, address value) internal returns (bool) {\n return _add(set._inner, bytes32(uint256(uint160(value))));\n }\n\n /**\n * @dev Removes a value from a set. O(1).\n *\n * Returns true if the value was removed from the set, that is if it was\n * present.\n */\n function remove(AddressSet storage set, address value) internal returns (bool) {\n return _remove(set._inner, bytes32(uint256(uint160(value))));\n }\n\n /**\n * @dev Returns true if the value is in the set. O(1).\n */\n function contains(AddressSet storage set, address value) internal view returns (bool) {\n return _contains(set._inner, bytes32(uint256(uint160(value))));\n }\n\n /**\n * @dev Returns the number of values in the set. O(1).\n */\n function length(AddressSet storage set) internal view returns (uint256) {\n return _length(set._inner);\n }\n\n /**\n * @dev Returns the value stored at position `index` in the set. O(1).\n *\n * Note that there are no guarantees on the ordering of values inside the\n * array, and it may change when more values are added or removed.\n *\n * Requirements:\n *\n * - `index` must be strictly less than {length}.\n */\n function at(AddressSet storage set, uint256 index) internal view returns (address) {\n return address(uint160(uint256(_at(set._inner, index))));\n }\n\n /**\n * @dev Return the entire set in an array\n *\n * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed\n * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that\n * this function has an unbounded cost, and using it as part of a state-changing function may render the function\n * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.\n */\n function values(AddressSet storage set) internal view returns (address[] memory) {\n bytes32[] memory store = _values(set._inner);\n address[] memory result;\n\n assembly {\n result := store\n }\n\n return result;\n }\n\n // UintSet\n\n struct UintSet {\n Set _inner;\n }\n\n /**\n * @dev Add a value to a set. O(1).\n *\n * Returns true if the value was added to the set, that is if it was not\n * already present.\n */\n function add(UintSet storage set, uint256 value) internal returns (bool) {\n return _add(set._inner, bytes32(value));\n }\n\n /**\n * @dev Removes a value from a set. O(1).\n *\n * Returns true if the value was removed from the set, that is if it was\n * present.\n */\n function remove(UintSet storage set, uint256 value) internal returns (bool) {\n return _remove(set._inner, bytes32(value));\n }\n\n /**\n * @dev Returns true if the value is in the set. O(1).\n */\n function contains(UintSet storage set, uint256 value) internal view returns (bool) {\n return _contains(set._inner, bytes32(value));\n }\n\n /**\n * @dev Returns the number of values on the set. O(1).\n */\n function length(UintSet storage set) internal view returns (uint256) {\n return _length(set._inner);\n }\n\n /**\n * @dev Returns the value stored at position `index` in the set. O(1).\n *\n * Note that there are no guarantees on the ordering of values inside the\n * array, and it may change when more values are added or removed.\n *\n * Requirements:\n *\n * - `index` must be strictly less than {length}.\n */\n function at(UintSet storage set, uint256 index) internal view returns (uint256) {\n return uint256(_at(set._inner, index));\n }\n\n /**\n * @dev Return the entire set in an array\n *\n * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed\n * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that\n * this function has an unbounded cost, and using it as part of a state-changing function may render the function\n * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.\n */\n function values(UintSet storage set) internal view returns (uint256[] memory) {\n bytes32[] memory store = _values(set._inner);\n uint256[] memory result;\n\n assembly {\n result := store\n }\n\n return result;\n }\n}\n" - }, - "solidity/contracts/peripherals/Keep3rRoles.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../../interfaces/peripherals/IKeep3rRoles.sol';\nimport '@openzeppelin/contracts/utils/structs/EnumerableSet.sol';\nimport './DustCollector.sol';\nimport './Governable.sol';\n\ncontract Keep3rRoles is IKeep3rRoles, Governable, DustCollector {\n /// @inheritdoc IKeep3rRoles\n mapping(address => bool) public override slashers;\n\n /// @inheritdoc IKeep3rRoles\n mapping(address => bool) public override disputers;\n\n constructor(address _governance) Governable(_governance) DustCollector() {}\n\n /// @inheritdoc IKeep3rRoles\n function addSlasher(address _slasher) external override onlyGovernance {\n if (_slasher == address(0)) revert ZeroAddress();\n if (slashers[_slasher]) revert SlasherExistent();\n slashers[_slasher] = true;\n emit SlasherAdded(_slasher);\n }\n\n /// @inheritdoc IKeep3rRoles\n function removeSlasher(address _slasher) external override onlyGovernance {\n if (!slashers[_slasher]) revert SlasherUnexistent();\n delete slashers[_slasher];\n emit SlasherRemoved(_slasher);\n }\n\n /// @inheritdoc IKeep3rRoles\n function addDisputer(address _disputer) external override onlyGovernance {\n if (_disputer == address(0)) revert ZeroAddress();\n if (disputers[_disputer]) revert DisputerExistent();\n disputers[_disputer] = true;\n emit DisputerAdded(_disputer);\n }\n\n /// @inheritdoc IKeep3rRoles\n function removeDisputer(address _disputer) external override onlyGovernance {\n if (!disputers[_disputer]) revert DisputerUnexistent();\n delete disputers[_disputer];\n emit DisputerRemoved(_disputer);\n }\n\n /// @notice Functions with this modifier can only be called by either a slasher or governance\n modifier onlySlasher {\n if (!slashers[msg.sender]) revert OnlySlasher();\n _;\n }\n\n /// @notice Functions with this modifier can only be called by either a disputer or governance\n modifier onlyDisputer {\n if (!disputers[msg.sender]) revert OnlyDisputer();\n _;\n }\n}\n" - }, - "solidity/contracts/peripherals/Governable.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../../interfaces/peripherals/IGovernable.sol';\n\nabstract contract Governable is IGovernable {\n /// @inheritdoc IGovernable\n address public override governance;\n\n /// @inheritdoc IGovernable\n address public override pendingGovernance;\n\n constructor(address _governance) {\n if (_governance == address(0)) revert NoGovernanceZeroAddress();\n governance = _governance;\n }\n\n /// @inheritdoc IGovernable\n function setGovernance(address _governance) external override onlyGovernance {\n pendingGovernance = _governance;\n emit GovernanceProposal(_governance);\n }\n\n /// @inheritdoc IGovernable\n function acceptGovernance() external override onlyPendingGovernance {\n governance = pendingGovernance;\n delete pendingGovernance;\n emit GovernanceSet(governance);\n }\n\n /// @notice Functions with this modifier can only be called by governance\n modifier onlyGovernance {\n if (msg.sender != governance) revert OnlyGovernance();\n _;\n }\n\n /// @notice Functions with this modifier can only be called by pendingGovernance\n modifier onlyPendingGovernance {\n if (msg.sender != pendingGovernance) revert OnlyPendingGovernance();\n _;\n }\n}\n" - }, - "@openzeppelin/contracts/token/ERC20/IERC20.sol": { - "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Interface of the ERC20 standard as defined in the EIP.\n */\ninterface IERC20 {\n /**\n * @dev Returns the amount of tokens in existence.\n */\n function totalSupply() external view returns (uint256);\n\n /**\n * @dev Returns the amount of tokens owned by `account`.\n */\n function balanceOf(address account) external view returns (uint256);\n\n /**\n * @dev Moves `amount` tokens from the caller's account to `recipient`.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * Emits a {Transfer} event.\n */\n function transfer(address recipient, uint256 amount) external returns (bool);\n\n /**\n * @dev Returns the remaining number of tokens that `spender` will be\n * allowed to spend on behalf of `owner` through {transferFrom}. This is\n * zero by default.\n *\n * This value changes when {approve} or {transferFrom} are called.\n */\n function allowance(address owner, address spender) external view returns (uint256);\n\n /**\n * @dev Sets `amount` as the allowance of `spender` over the caller's tokens.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * IMPORTANT: Beware that changing an allowance with this method brings the risk\n * that someone may use both the old and the new allowance by unfortunate\n * transaction ordering. One possible solution to mitigate this race\n * condition is to first reduce the spender's allowance to 0 and set the\n * desired value afterwards:\n * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729\n *\n * Emits an {Approval} event.\n */\n function approve(address spender, uint256 amount) external returns (bool);\n\n /**\n * @dev Moves `amount` tokens from `sender` to `recipient` using the\n * allowance mechanism. `amount` is then deducted from the caller's\n * allowance.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * Emits a {Transfer} event.\n */\n function transferFrom(\n address sender,\n address recipient,\n uint256 amount\n ) external returns (bool);\n\n /**\n * @dev Emitted when `value` tokens are moved from one account (`from`) to\n * another (`to`).\n *\n * Note that `value` may be zero.\n */\n event Transfer(address indexed from, address indexed to, uint256 value);\n\n /**\n * @dev Emitted when the allowance of a `spender` for an `owner` is set by\n * a call to {approve}. `value` is the new allowance.\n */\n event Approval(address indexed owner, address indexed spender, uint256 value);\n}\n" - }, - "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol": { - "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\nimport \"../IERC20.sol\";\nimport \"../../../utils/Address.sol\";\n\n/**\n * @title SafeERC20\n * @dev Wrappers around ERC20 operations that throw on failure (when the token\n * contract returns false). Tokens that return no value (and instead revert or\n * throw on failure) are also supported, non-reverting calls are assumed to be\n * successful.\n * To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract,\n * which allows you to call the safe operations as `token.safeTransfer(...)`, etc.\n */\nlibrary SafeERC20 {\n using Address for address;\n\n function safeTransfer(\n IERC20 token,\n address to,\n uint256 value\n ) internal {\n _callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value));\n }\n\n function safeTransferFrom(\n IERC20 token,\n address from,\n address to,\n uint256 value\n ) internal {\n _callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value));\n }\n\n /**\n * @dev Deprecated. This function has issues similar to the ones found in\n * {IERC20-approve}, and its usage is discouraged.\n *\n * Whenever possible, use {safeIncreaseAllowance} and\n * {safeDecreaseAllowance} instead.\n */\n function safeApprove(\n IERC20 token,\n address spender,\n uint256 value\n ) internal {\n // safeApprove should only be called when setting an initial allowance,\n // or when resetting it to zero. To increase and decrease it, use\n // 'safeIncreaseAllowance' and 'safeDecreaseAllowance'\n require(\n (value == 0) || (token.allowance(address(this), spender) == 0),\n \"SafeERC20: approve from non-zero to non-zero allowance\"\n );\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value));\n }\n\n function safeIncreaseAllowance(\n IERC20 token,\n address spender,\n uint256 value\n ) internal {\n uint256 newAllowance = token.allowance(address(this), spender) + value;\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));\n }\n\n function safeDecreaseAllowance(\n IERC20 token,\n address spender,\n uint256 value\n ) internal {\n unchecked {\n uint256 oldAllowance = token.allowance(address(this), spender);\n require(oldAllowance >= value, \"SafeERC20: decreased allowance below zero\");\n uint256 newAllowance = oldAllowance - value;\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));\n }\n }\n\n /**\n * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement\n * on the return value: the return value is optional (but if data is returned, it must not be false).\n * @param token The token targeted by the call.\n * @param data The call data (encoded using abi.encode or one of its variants).\n */\n function _callOptionalReturn(IERC20 token, bytes memory data) private {\n // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since\n // we're implementing it ourselves. We use {Address.functionCall} to perform this call, which verifies that\n // the target address contains contract code and also asserts for success in the low-level call.\n\n bytes memory returndata = address(token).functionCall(data, \"SafeERC20: low-level call failed\");\n if (returndata.length > 0) {\n // Return data is optional\n require(abi.decode(returndata, (bool)), \"SafeERC20: ERC20 operation did not succeed\");\n }\n }\n}\n" - }, - "@openzeppelin/contracts/utils/Address.sol": { - "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Collection of functions related to the address type\n */\nlibrary Address {\n /**\n * @dev Returns true if `account` is a contract.\n *\n * [IMPORTANT]\n * ====\n * It is unsafe to assume that an address for which this function returns\n * false is an externally-owned account (EOA) and not a contract.\n *\n * Among others, `isContract` will return false for the following\n * types of addresses:\n *\n * - an externally-owned account\n * - a contract in construction\n * - an address where a contract will be created\n * - an address where a contract lived, but was destroyed\n * ====\n */\n function isContract(address account) internal view returns (bool) {\n // This method relies on extcodesize, which returns 0 for contracts in\n // construction, since the code is only stored at the end of the\n // constructor execution.\n\n uint256 size;\n assembly {\n size := extcodesize(account)\n }\n return size > 0;\n }\n\n /**\n * @dev Replacement for Solidity's `transfer`: sends `amount` wei to\n * `recipient`, forwarding all available gas and reverting on errors.\n *\n * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost\n * of certain opcodes, possibly making contracts go over the 2300 gas limit\n * imposed by `transfer`, making them unable to receive funds via\n * `transfer`. {sendValue} removes this limitation.\n *\n * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].\n *\n * IMPORTANT: because control is transferred to `recipient`, care must be\n * taken to not create reentrancy vulnerabilities. Consider using\n * {ReentrancyGuard} or the\n * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].\n */\n function sendValue(address payable recipient, uint256 amount) internal {\n require(address(this).balance >= amount, \"Address: insufficient balance\");\n\n (bool success, ) = recipient.call{value: amount}(\"\");\n require(success, \"Address: unable to send value, recipient may have reverted\");\n }\n\n /**\n * @dev Performs a Solidity function call using a low level `call`. A\n * plain `call` is an unsafe replacement for a function call: use this\n * function instead.\n *\n * If `target` reverts with a revert reason, it is bubbled up by this\n * function (like regular Solidity function calls).\n *\n * Returns the raw returned data. To convert to the expected return value,\n * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\n *\n * Requirements:\n *\n * - `target` must be a contract.\n * - calling `target` with `data` must not revert.\n *\n * _Available since v3.1._\n */\n function functionCall(address target, bytes memory data) internal returns (bytes memory) {\n return functionCall(target, data, \"Address: low-level call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with\n * `errorMessage` as a fallback revert reason when `target` reverts.\n *\n * _Available since v3.1._\n */\n function functionCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal returns (bytes memory) {\n return functionCallWithValue(target, data, 0, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but also transferring `value` wei to `target`.\n *\n * Requirements:\n *\n * - the calling contract must have an ETH balance of at least `value`.\n * - the called Solidity function must be `payable`.\n *\n * _Available since v3.1._\n */\n function functionCallWithValue(\n address target,\n bytes memory data,\n uint256 value\n ) internal returns (bytes memory) {\n return functionCallWithValue(target, data, value, \"Address: low-level call with value failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but\n * with `errorMessage` as a fallback revert reason when `target` reverts.\n *\n * _Available since v3.1._\n */\n function functionCallWithValue(\n address target,\n bytes memory data,\n uint256 value,\n string memory errorMessage\n ) internal returns (bytes memory) {\n require(address(this).balance >= value, \"Address: insufficient balance for call\");\n require(isContract(target), \"Address: call to non-contract\");\n\n (bool success, bytes memory returndata) = target.call{value: value}(data);\n return verifyCallResult(success, returndata, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but performing a static call.\n *\n * _Available since v3.3._\n */\n function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\n return functionStaticCall(target, data, \"Address: low-level static call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\n * but performing a static call.\n *\n * _Available since v3.3._\n */\n function functionStaticCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal view returns (bytes memory) {\n require(isContract(target), \"Address: static call to non-contract\");\n\n (bool success, bytes memory returndata) = target.staticcall(data);\n return verifyCallResult(success, returndata, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but performing a delegate call.\n *\n * _Available since v3.4._\n */\n function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {\n return functionDelegateCall(target, data, \"Address: low-level delegate call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\n * but performing a delegate call.\n *\n * _Available since v3.4._\n */\n function functionDelegateCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal returns (bytes memory) {\n require(isContract(target), \"Address: delegate call to non-contract\");\n\n (bool success, bytes memory returndata) = target.delegatecall(data);\n return verifyCallResult(success, returndata, errorMessage);\n }\n\n /**\n * @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the\n * revert reason using the provided one.\n *\n * _Available since v4.3._\n */\n function verifyCallResult(\n bool success,\n bytes memory returndata,\n string memory errorMessage\n ) internal pure returns (bytes memory) {\n if (success) {\n return returndata;\n } else {\n // Look for revert reason and bubble it up if present\n if (returndata.length > 0) {\n // The easiest way to bubble the revert reason is using memory via assembly\n\n assembly {\n let returndata_size := mload(returndata)\n revert(add(32, returndata), returndata_size)\n }\n } else {\n revert(errorMessage);\n }\n }\n }\n}\n" - }, - "solidity/contracts/peripherals/jobs/Keep3rJobMigration.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../../../interfaces/peripherals/IKeep3rJobs.sol';\nimport './Keep3rJobFundableCredits.sol';\nimport './Keep3rJobFundableLiquidity.sol';\n\nabstract contract Keep3rJobMigration is IKeep3rJobMigration, Keep3rJobFundableCredits, Keep3rJobFundableLiquidity {\n using EnumerableSet for EnumerableSet.AddressSet;\n\n uint256 internal constant _MIGRATION_COOLDOWN = 1 minutes;\n\n /// @inheritdoc IKeep3rJobMigration\n mapping(address => address) public override pendingJobMigrations;\n mapping(address => mapping(address => uint256)) internal _migrationCreatedAt;\n\n /// @inheritdoc IKeep3rJobMigration\n function migrateJob(address _fromJob, address _toJob) external override onlyJobOwner(_fromJob) {\n if (_fromJob == _toJob) revert JobMigrationImpossible();\n\n pendingJobMigrations[_fromJob] = _toJob;\n _migrationCreatedAt[_fromJob][_toJob] = block.timestamp;\n\n emit JobMigrationRequested(_fromJob, _toJob);\n }\n\n /// @inheritdoc IKeep3rJobMigration\n function acceptJobMigration(address _fromJob, address _toJob) external override onlyJobOwner(_toJob) {\n if (disputes[_fromJob] || disputes[_toJob]) revert JobDisputed();\n if (pendingJobMigrations[_fromJob] != _toJob) revert JobMigrationUnavailable();\n if (block.timestamp < _migrationCreatedAt[_fromJob][_toJob] + _MIGRATION_COOLDOWN) revert JobMigrationLocked();\n\n // force job credits update for both jobs\n _settleJobAccountance(_fromJob);\n _settleJobAccountance(_toJob);\n\n // migrate tokens\n while (_jobTokens[_fromJob].length() > 0) {\n address _tokenToMigrate = _jobTokens[_fromJob].at(0);\n jobTokenCredits[_toJob][_tokenToMigrate] += jobTokenCredits[_fromJob][_tokenToMigrate];\n delete jobTokenCredits[_fromJob][_tokenToMigrate];\n _jobTokens[_fromJob].remove(_tokenToMigrate);\n _jobTokens[_toJob].add(_tokenToMigrate);\n }\n\n // migrate liquidities\n while (_jobLiquidities[_fromJob].length() > 0) {\n address _liquidity = _jobLiquidities[_fromJob].at(0);\n\n liquidityAmount[_toJob][_liquidity] += liquidityAmount[_fromJob][_liquidity];\n delete liquidityAmount[_fromJob][_liquidity];\n\n _jobLiquidities[_toJob].add(_liquidity);\n _jobLiquidities[_fromJob].remove(_liquidity);\n }\n\n // migrate job balances\n _jobPeriodCredits[_toJob] += _jobPeriodCredits[_fromJob];\n delete _jobPeriodCredits[_fromJob];\n\n _jobLiquidityCredits[_toJob] += _jobLiquidityCredits[_fromJob];\n delete _jobLiquidityCredits[_fromJob];\n\n // stop _fromJob from being a job\n delete rewardedAt[_fromJob];\n _jobs.remove(_fromJob);\n\n // delete unused data slots\n delete jobOwner[_fromJob];\n delete jobPendingOwner[_fromJob];\n delete _migrationCreatedAt[_fromJob][_toJob];\n delete pendingJobMigrations[_fromJob];\n\n emit JobMigrationSuccessful(_fromJob, _toJob);\n }\n}\n" - }, - "solidity/interfaces/IKeep3rHelper.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport './IKeep3rHelperParameters.sol';\n\n/// @title Keep3rHelper contract\n/// @notice Contains all the helper functions used throughout the different files.\ninterface IKeep3rHelper is IKeep3rHelperParameters {\n // Errors\n\n /// @notice Throws when none of the tokens in the liquidity pair is KP3R\n error LiquidityPairInvalid();\n\n // Methods\n // solhint-enable func-name-mixedcase\n\n /// @notice Calculates the amount of KP3R that corresponds to the ETH passed into the function\n /// @dev This function allows us to calculate how much KP3R we should pay to a keeper for things expressed in ETH, like gas\n /// @param _eth The amount of ETH\n /// @return _amountOut The amount of KP3R\n function quote(uint256 _eth) external view returns (uint256 _amountOut);\n\n /// @notice Returns the amount of KP3R the keeper has bonded\n /// @param _keeper The address of the keeper to check\n /// @return _amountBonded The amount of KP3R the keeper has bonded\n function bonds(address _keeper) external view returns (uint256 _amountBonded);\n\n /// @notice Calculates the reward (in KP3R) that corresponds to a keeper for using gas\n /// @param _keeper The address of the keeper to check\n /// @param _gasUsed The amount of gas used that will be rewarded\n /// @return _kp3r The amount of KP3R that should be awarded to the keeper\n function getRewardAmountFor(address _keeper, uint256 _gasUsed) external view returns (uint256 _kp3r);\n\n /// @notice Calculates the boost in the reward given to a keeper based on the amount of KP3R that keeper has bonded\n /// @dev If the keeper has no bonds, boost should be +10% of gas cost, if keeper has max bonds, +20%\n /// @param _bonds The amount of KP3R tokens bonded by the keeper\n /// @return _rewardBoost The reward boost that corresponds to the keeper\n function getRewardBoostFor(uint256 _bonds) external view returns (uint256 _rewardBoost);\n\n /// @notice Calculates the reward (in KP3R) that corresponds to tx.origin for using gas\n /// @param _gasUsed The amount of gas used that will be rewarded\n /// @return _amount The amount of KP3R that should be awarded to tx.origin\n function getRewardAmount(uint256 _gasUsed) external view returns (uint256 _amount);\n\n /// @notice Given a pool address, returns the underlying tokens of the pair\n /// @param _pool Address of the correspondant pool\n /// @return _token0 Address of the first token of the pair\n /// @return _token1 Address of the second token of the pair\n function getPoolTokens(address _pool) external view returns (address _token0, address _token1);\n\n /// @notice Defines the order of the tokens in the pair for twap calculations\n /// @param _pool Address of the correspondant pool\n /// @return _isKP3RToken0 Boolean indicating the order of the tokens in the pair\n function isKP3RToken0(address _pool) external view returns (bool _isKP3RToken0);\n\n /// @notice Given an array of secondsAgo, returns UniswapV3 pool cumulatives at that moment\n /// @param _pool Address of the pool to observe\n /// @param _secondsAgo Array with time references to observe\n /// @return _tickCumulative1 Cumulative sum of ticks until first time reference\n /// @return _tickCumulative2 Cumulative sum of ticks until second time reference\n /// @return _success Boolean indicating if the observe call was succesfull\n function observe(address _pool, uint32[] memory _secondsAgo)\n external\n view\n returns (\n int56 _tickCumulative1,\n int56 _tickCumulative2,\n bool _success\n );\n\n /// @notice Get multiplier, quote, and extra, in order to calculate keeper payment\n /// @param _bonds Amount of bonded KP3R owned by the keeper\n /// @return _boost Multiplier per gas unit. Takes into account the base fee and the amount of bonded KP3R\n /// @return _oneEthQuote Amount of KP3R tokens equivalent to 1 ETH\n /// @return _extra Amount of extra gas that should be added to the gas spent\n function getPaymentParams(uint256 _bonds)\n external\n view\n returns (\n uint256 _boost,\n uint256 _oneEthQuote,\n uint256 _extra\n );\n\n /// @notice Given a tick and a liquidity amount, calculates the underlying KP3R tokens\n /// @param _liquidityAmount Amount of liquidity to be converted\n /// @param _tickDifference Tick value used to calculate the quote\n /// @param _timeInterval Time value used to calculate the quote\n /// @return _kp3rAmount Amount of KP3R tokens underlying on the given liquidity\n function getKP3RsAtTick(\n uint256 _liquidityAmount,\n int56 _tickDifference,\n uint256 _timeInterval\n ) external pure returns (uint256 _kp3rAmount);\n\n /// @notice Given a tick and a token amount, calculates the output in correspondant token\n /// @param _baseAmount Amount of token to be converted\n /// @param _tickDifference Tick value used to calculate the quote\n /// @param _timeInterval Time value used to calculate the quote\n /// @return _quoteAmount Amount of credits deserved for the baseAmount at the tick value\n function getQuoteAtTick(\n uint128 _baseAmount,\n int56 _tickDifference,\n uint256 _timeInterval\n ) external pure returns (uint256 _quoteAmount);\n}\n" - }, - "solidity/contracts/peripherals/jobs/Keep3rJobFundableCredits.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport './Keep3rJobOwnership.sol';\nimport '../Keep3rAccountance.sol';\nimport '../Keep3rParameters.sol';\nimport '../../../interfaces/peripherals/IKeep3rJobs.sol';\n\nimport '@openzeppelin/contracts/security/ReentrancyGuard.sol';\nimport '@openzeppelin/contracts/token/ERC20/IERC20.sol';\nimport '@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol';\nimport '@openzeppelin/contracts/utils/math/Math.sol';\n\nabstract contract Keep3rJobFundableCredits is IKeep3rJobFundableCredits, ReentrancyGuard, Keep3rJobOwnership, Keep3rParameters {\n using EnumerableSet for EnumerableSet.AddressSet;\n using SafeERC20 for IERC20;\n\n /// @notice Cooldown between withdrawals\n uint256 internal constant _WITHDRAW_TOKENS_COOLDOWN = 1 minutes;\n\n /// @inheritdoc IKeep3rJobFundableCredits\n mapping(address => mapping(address => uint256)) public override jobTokenCreditsAddedAt;\n\n /// @inheritdoc IKeep3rJobFundableCredits\n function addTokenCreditsToJob(\n address _job,\n address _token,\n uint256 _amount\n ) external override nonReentrant {\n if (!_jobs.contains(_job)) revert JobUnavailable();\n // KP3R shouldn't be used for direct token payments\n if (_token == keep3rV1) revert TokenUnallowed();\n uint256 _before = IERC20(_token).balanceOf(address(this));\n IERC20(_token).safeTransferFrom(msg.sender, address(this), _amount);\n uint256 _received = IERC20(_token).balanceOf(address(this)) - _before;\n uint256 _tokenFee = (_received * fee) / _BASE;\n jobTokenCredits[_job][_token] += _received - _tokenFee;\n jobTokenCreditsAddedAt[_job][_token] = block.timestamp;\n IERC20(_token).safeTransfer(governance, _tokenFee);\n _jobTokens[_job].add(_token);\n\n emit TokenCreditAddition(_job, _token, msg.sender, _received);\n }\n\n /// @inheritdoc IKeep3rJobFundableCredits\n function withdrawTokenCreditsFromJob(\n address _job,\n address _token,\n uint256 _amount,\n address _receiver\n ) external override nonReentrant onlyJobOwner(_job) {\n if (block.timestamp <= jobTokenCreditsAddedAt[_job][_token] + _WITHDRAW_TOKENS_COOLDOWN) revert JobTokenCreditsLocked();\n if (jobTokenCredits[_job][_token] < _amount) revert InsufficientJobTokenCredits();\n if (disputes[_job]) revert JobDisputed();\n\n jobTokenCredits[_job][_token] -= _amount;\n IERC20(_token).safeTransfer(_receiver, _amount);\n\n if (jobTokenCredits[_job][_token] == 0) {\n _jobTokens[_job].remove(_token);\n }\n\n emit TokenCreditWithdrawal(_job, _token, _receiver, _amount);\n }\n}\n" - }, - "solidity/contracts/peripherals/jobs/Keep3rJobFundableLiquidity.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport './Keep3rJobOwnership.sol';\nimport '../Keep3rAccountance.sol';\nimport '../Keep3rParameters.sol';\nimport '../../../interfaces/IPairManager.sol';\nimport '../../../interfaces/peripherals/IKeep3rJobs.sol';\n\nimport '../../libraries/FullMath.sol';\n\nimport '@openzeppelin/contracts/security/ReentrancyGuard.sol';\nimport '@openzeppelin/contracts/token/ERC20/IERC20.sol';\nimport '@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol';\nimport '@openzeppelin/contracts/utils/math/Math.sol';\n\nabstract contract Keep3rJobFundableLiquidity is IKeep3rJobFundableLiquidity, ReentrancyGuard, Keep3rJobOwnership, Keep3rParameters {\n using EnumerableSet for EnumerableSet.AddressSet;\n using SafeERC20 for IERC20;\n\n /// @notice List of liquidities that are accepted in the system\n EnumerableSet.AddressSet internal _approvedLiquidities;\n\n /// @inheritdoc IKeep3rJobFundableLiquidity\n mapping(address => mapping(address => uint256)) public override liquidityAmount;\n\n /// @inheritdoc IKeep3rJobFundableLiquidity\n mapping(address => uint256) public override rewardedAt;\n\n /// @inheritdoc IKeep3rJobFundableLiquidity\n mapping(address => uint256) public override workedAt;\n\n /// @notice Tracks an address and returns its TickCache\n mapping(address => TickCache) internal _tick;\n\n // Views\n\n /// @inheritdoc IKeep3rJobFundableLiquidity\n function approvedLiquidities() external view override returns (address[] memory _list) {\n _list = _approvedLiquidities.values();\n }\n\n /// @inheritdoc IKeep3rJobFundableLiquidity\n function jobPeriodCredits(address _job) public view override returns (uint256 _periodCredits) {\n for (uint256 i; i < _jobLiquidities[_job].length(); i++) {\n address _liquidity = _jobLiquidities[_job].at(i);\n if (_approvedLiquidities.contains(_liquidity)) {\n TickCache memory _tickCache = observeLiquidity(_liquidity);\n if (_tickCache.period != 0) {\n int56 _tickDifference = _isKP3RToken0[_liquidity] ? _tickCache.difference : -_tickCache.difference;\n _periodCredits += _getReward(\n IKeep3rHelper(keep3rHelper).getKP3RsAtTick(liquidityAmount[_job][_liquidity], _tickDifference, rewardPeriodTime)\n );\n }\n }\n }\n }\n\n /// @inheritdoc IKeep3rJobFundableLiquidity\n function jobLiquidityCredits(address _job) public view override returns (uint256 _liquidityCredits) {\n uint256 _periodCredits = jobPeriodCredits(_job);\n\n // If the job was rewarded in the past 1 period time\n if ((block.timestamp - rewardedAt[_job]) < rewardPeriodTime) {\n // If the job has period credits, update minted job credits to new twap\n _liquidityCredits = _periodCredits > 0\n ? (_jobLiquidityCredits[_job] * _periodCredits) / _jobPeriodCredits[_job] // If the job has period credits, return remaining job credits updated to new twap\n : _jobLiquidityCredits[_job]; // If not, return remaining credits, forced credits should not be updated\n } else {\n // Else return a full period worth of credits if current credits have expired\n _liquidityCredits = _periodCredits;\n }\n }\n\n /// @inheritdoc IKeep3rJobFundableLiquidity\n function totalJobCredits(address _job) external view override returns (uint256 _credits) {\n uint256 _periodCredits = jobPeriodCredits(_job);\n uint256 _cooldown = block.timestamp;\n\n if ((rewardedAt[_job] > _period(block.timestamp - rewardPeriodTime))) {\n // Will calculate cooldown if it outdated\n if ((block.timestamp - rewardedAt[_job]) >= rewardPeriodTime) {\n // Will calculate cooldown from last reward reference in this period\n _cooldown -= (rewardedAt[_job] + rewardPeriodTime);\n } else {\n // Will calculate cooldown from last reward timestamp\n _cooldown -= rewardedAt[_job];\n }\n } else {\n // Will calculate cooldown from period start if expired\n _cooldown -= _period(block.timestamp);\n }\n _credits = jobLiquidityCredits(_job) + _phase(_cooldown, _periodCredits);\n }\n\n /// @inheritdoc IKeep3rJobFundableLiquidity\n function quoteLiquidity(address _liquidity, uint256 _amount) external view override returns (uint256 _periodCredits) {\n if (_approvedLiquidities.contains(_liquidity)) {\n TickCache memory _tickCache = observeLiquidity(_liquidity);\n if (_tickCache.period != 0) {\n int56 _tickDifference = _isKP3RToken0[_liquidity] ? _tickCache.difference : -_tickCache.difference;\n return _getReward(IKeep3rHelper(keep3rHelper).getKP3RsAtTick(_amount, _tickDifference, rewardPeriodTime));\n }\n }\n }\n\n /// @inheritdoc IKeep3rJobFundableLiquidity\n function observeLiquidity(address _liquidity) public view virtual override returns (TickCache memory _tickCache) {\n if (_tick[_liquidity].period == _period(block.timestamp)) {\n // Will return cached twaps if liquidity is updated\n _tickCache = _tick[_liquidity];\n } else {\n bool success;\n uint256 lastPeriod = _period(block.timestamp - rewardPeriodTime);\n\n if (_tick[_liquidity].period == lastPeriod) {\n // Will only ask for current period accumulator if liquidity is outdated\n uint32[] memory _secondsAgo = new uint32[](1);\n int56 previousTick = _tick[_liquidity].current;\n\n _secondsAgo[0] = uint32(block.timestamp - _period(block.timestamp));\n\n (_tickCache.current, , success) = IKeep3rHelper(keep3rHelper).observe(_liquidityPool[_liquidity], _secondsAgo);\n\n _tickCache.difference = _tickCache.current - previousTick;\n } else if (_tick[_liquidity].period < lastPeriod) {\n // Will ask for 2 accumulators if liquidity is expired\n uint32[] memory _secondsAgo = new uint32[](2);\n\n _secondsAgo[0] = uint32(block.timestamp - _period(block.timestamp));\n _secondsAgo[1] = uint32(block.timestamp - _period(block.timestamp) + rewardPeriodTime);\n\n int56 _tickCumulative2;\n (_tickCache.current, _tickCumulative2, success) = IKeep3rHelper(keep3rHelper).observe(_liquidityPool[_liquidity], _secondsAgo);\n\n _tickCache.difference = _tickCache.current - _tickCumulative2;\n }\n if (success) {\n _tickCache.period = _period(block.timestamp);\n } else {\n delete _tickCache.period;\n }\n }\n }\n\n // Methods\n\n /// @inheritdoc IKeep3rJobFundableLiquidity\n function forceLiquidityCreditsToJob(address _job, uint256 _amount) external override onlyGovernance {\n if (!_jobs.contains(_job)) revert JobUnavailable();\n _settleJobAccountance(_job);\n _jobLiquidityCredits[_job] += _amount;\n emit LiquidityCreditsForced(_job, rewardedAt[_job], _jobLiquidityCredits[_job]);\n }\n\n /// @inheritdoc IKeep3rJobFundableLiquidity\n function approveLiquidity(address _liquidity) external virtual override onlyGovernance {\n if (!_approvedLiquidities.add(_liquidity)) revert LiquidityPairApproved();\n _liquidityPool[_liquidity] = IPairManager(_liquidity).pool();\n _isKP3RToken0[_liquidity] = IKeep3rHelper(keep3rHelper).isKP3RToken0(_liquidityPool[_liquidity]);\n _tick[_liquidity] = observeLiquidity(_liquidity);\n emit LiquidityApproval(_liquidity);\n }\n\n /// @inheritdoc IKeep3rJobFundableLiquidity\n function revokeLiquidity(address _liquidity) external override onlyGovernance {\n if (!_approvedLiquidities.remove(_liquidity)) revert LiquidityPairUnexistent();\n delete _liquidityPool[_liquidity];\n delete _isKP3RToken0[_liquidity];\n delete _tick[_liquidity];\n\n emit LiquidityRevocation(_liquidity);\n }\n\n /// @inheritdoc IKeep3rJobFundableLiquidity\n function addLiquidityToJob(\n address _job,\n address _liquidity,\n uint256 _amount\n ) external override nonReentrant {\n if (!_approvedLiquidities.contains(_liquidity)) revert LiquidityPairUnapproved();\n if (!_jobs.contains(_job)) revert JobUnavailable();\n\n _jobLiquidities[_job].add(_liquidity);\n\n _settleJobAccountance(_job);\n\n if (_quoteLiquidity(liquidityAmount[_job][_liquidity] + _amount, _liquidity) < liquidityMinimum) revert JobLiquidityLessThanMin();\n\n emit LiquidityCreditsReward(_job, rewardedAt[_job], _jobLiquidityCredits[_job], _jobPeriodCredits[_job]);\n\n IERC20(_liquidity).safeTransferFrom(msg.sender, address(this), _amount);\n liquidityAmount[_job][_liquidity] += _amount;\n _jobPeriodCredits[_job] += _getReward(_quoteLiquidity(_amount, _liquidity));\n emit LiquidityAddition(_job, _liquidity, msg.sender, _amount);\n }\n\n /// @inheritdoc IKeep3rJobFundableLiquidity\n function unbondLiquidityFromJob(\n address _job,\n address _liquidity,\n uint256 _amount\n ) external override onlyJobOwner(_job) {\n canWithdrawAfter[_job][_liquidity] = block.timestamp + unbondTime;\n pendingUnbonds[_job][_liquidity] += _amount;\n _unbondLiquidityFromJob(_job, _liquidity, _amount);\n\n uint256 _remainingLiquidity = liquidityAmount[_job][_liquidity];\n if (_remainingLiquidity > 0 && _quoteLiquidity(_remainingLiquidity, _liquidity) < liquidityMinimum) revert JobLiquidityLessThanMin();\n\n emit Unbonding(_job, _liquidity, _amount);\n }\n\n /// @inheritdoc IKeep3rJobFundableLiquidity\n function withdrawLiquidityFromJob(\n address _job,\n address _liquidity,\n address _receiver\n ) external override onlyJobOwner(_job) {\n if (_receiver == address(0)) revert ZeroAddress();\n if (pendingUnbonds[_job][_liquidity] == 0) revert UnbondsUnexistent();\n if (canWithdrawAfter[_job][_liquidity] >= block.timestamp) revert UnbondsLocked();\n if (disputes[_job]) revert Disputed();\n\n uint256 _amount = pendingUnbonds[_job][_liquidity];\n\n delete pendingUnbonds[_job][_liquidity];\n delete canWithdrawAfter[_job][_liquidity];\n\n IERC20(_liquidity).safeTransfer(_receiver, _amount);\n emit LiquidityWithdrawal(_job, _liquidity, _receiver, _amount);\n }\n\n // Internal functions\n\n /// @notice Updates or rewards job liquidity credits depending on time since last job reward\n function _updateJobCreditsIfNeeded(address _job) internal returns (bool _rewarded) {\n if (rewardedAt[_job] < _period(block.timestamp)) {\n // Will exit function if job has been rewarded in current period\n if (rewardedAt[_job] <= _period(block.timestamp - rewardPeriodTime)) {\n // Will reset job to period syncronicity if a full period passed without rewards\n _updateJobPeriod(_job);\n _jobLiquidityCredits[_job] = _jobPeriodCredits[_job];\n rewardedAt[_job] = _period(block.timestamp);\n _rewarded = true;\n } else if ((block.timestamp - rewardedAt[_job]) >= rewardPeriodTime) {\n // Will reset job's syncronicity if last reward was more than epoch ago\n _updateJobPeriod(_job);\n _jobLiquidityCredits[_job] = _jobPeriodCredits[_job];\n rewardedAt[_job] += rewardPeriodTime;\n _rewarded = true;\n } else if (workedAt[_job] < _period(block.timestamp)) {\n // First keeper on period has to update job accountance to current twaps\n uint256 previousPeriodCredits = _jobPeriodCredits[_job];\n _updateJobPeriod(_job);\n _jobLiquidityCredits[_job] = (_jobLiquidityCredits[_job] * _jobPeriodCredits[_job]) / previousPeriodCredits;\n // Updating job accountance does not reward job\n }\n }\n }\n\n /// @notice Only called if _jobLiquidityCredits < payment\n function _rewardJobCredits(address _job) internal {\n /// @notice Only way to += jobLiquidityCredits is when keeper rewarding (cannot pay work)\n /* WARNING: this allows to top up _jobLiquidityCredits to a max of 1.99 but have to spend at least 1 */\n _jobLiquidityCredits[_job] += _phase(block.timestamp - rewardedAt[_job], _jobPeriodCredits[_job]);\n rewardedAt[_job] = block.timestamp;\n }\n\n /// @notice Updates accountance for _jobPeriodCredits\n function _updateJobPeriod(address _job) internal {\n _jobPeriodCredits[_job] = _calculateJobPeriodCredits(_job);\n }\n\n /// @notice Quotes the outdated job liquidities and calculates _periodCredits\n /// @dev This function is also responsible for keeping the KP3R/WETH quote updated\n function _calculateJobPeriodCredits(address _job) internal returns (uint256 _periodCredits) {\n for (uint256 i; i < _jobLiquidities[_job].length(); i++) {\n address _liquidity = _jobLiquidities[_job].at(i);\n if (_approvedLiquidities.contains(_liquidity)) {\n if (_tick[_liquidity].period != _period(block.timestamp)) {\n // Updates liquidity cache only if needed\n _tick[_liquidity] = observeLiquidity(_liquidity);\n }\n _periodCredits += _getReward(_quoteLiquidity(liquidityAmount[_job][_liquidity], _liquidity));\n }\n }\n }\n\n /// @notice Updates job accountance calculating the impact of the unbonded liquidity amount\n function _unbondLiquidityFromJob(\n address _job,\n address _liquidity,\n uint256 _amount\n ) internal nonReentrant {\n if (!_jobLiquidities[_job].contains(_liquidity)) revert JobLiquidityUnexistent();\n if (liquidityAmount[_job][_liquidity] < _amount) revert JobLiquidityInsufficient();\n\n // Ensures current twaps in job liquidities\n _updateJobPeriod(_job);\n uint256 _periodCreditsToRemove = _getReward(_quoteLiquidity(_amount, _liquidity));\n\n // A liquidity can be revoked causing a job to have 0 periodCredits\n if (_jobPeriodCredits[_job] > 0) {\n // Removes a % correspondant to a full rewardPeriodTime for the liquidity withdrawn vs all of the liquidities\n _jobLiquidityCredits[_job] -= (_jobLiquidityCredits[_job] * _periodCreditsToRemove) / _jobPeriodCredits[_job];\n _jobPeriodCredits[_job] -= _periodCreditsToRemove;\n }\n\n liquidityAmount[_job][_liquidity] -= _amount;\n if (liquidityAmount[_job][_liquidity] == 0) {\n _jobLiquidities[_job].remove(_liquidity);\n }\n }\n\n /// @notice Returns a fraction of the multiplier or the whole multiplier if equal or more than a rewardPeriodTime has passed\n function _phase(uint256 _timePassed, uint256 _multiplier) internal view returns (uint256 _result) {\n if (_timePassed < rewardPeriodTime) {\n _result = (_timePassed * _multiplier) / rewardPeriodTime;\n } else _result = _multiplier;\n }\n\n /// @notice Returns the start of the period of the provided timestamp\n function _period(uint256 _timestamp) internal view returns (uint256 _periodTimestamp) {\n return _timestamp - (_timestamp % rewardPeriodTime);\n }\n\n /// @notice Calculates relation between rewardPeriod and inflationPeriod\n function _getReward(uint256 _baseAmount) internal view returns (uint256 _credits) {\n return FullMath.mulDiv(_baseAmount, rewardPeriodTime, inflationPeriod);\n }\n\n /// @notice Returns underlying KP3R amount for a given liquidity amount\n function _quoteLiquidity(uint256 _amount, address _liquidity) internal view returns (uint256 _quote) {\n if (_tick[_liquidity].period != 0) {\n int56 _tickDifference = _isKP3RToken0[_liquidity] ? _tick[_liquidity].difference : -_tick[_liquidity].difference;\n _quote = IKeep3rHelper(keep3rHelper).getKP3RsAtTick(_amount, _tickDifference, rewardPeriodTime);\n }\n }\n\n /// @notice Updates job credits to current quotes and rewards job's pending minted credits\n /// @dev Ensures a maximum of 1 period of credits\n function _settleJobAccountance(address _job) internal virtual {\n _updateJobCreditsIfNeeded(_job);\n _rewardJobCredits(_job);\n _jobLiquidityCredits[_job] = Math.min(_jobLiquidityCredits[_job], _jobPeriodCredits[_job]);\n }\n}\n" - }, - "solidity/contracts/peripherals/Keep3rParameters.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../../interfaces/IKeep3rHelper.sol';\nimport '../../interfaces/peripherals/IKeep3rParameters.sol';\nimport '../../interfaces/external/IKeep3rV1Proxy.sol';\nimport './Keep3rAccountance.sol';\n\nabstract contract Keep3rParameters is IKeep3rParameters, Keep3rAccountance {\n /// @inheritdoc IKeep3rParameters\n address public override keep3rV1;\n\n /// @inheritdoc IKeep3rParameters\n address public override keep3rV1Proxy;\n\n /// @inheritdoc IKeep3rParameters\n address public override keep3rHelper;\n\n /// @inheritdoc IKeep3rParameters\n uint256 public override bondTime = 3 days;\n\n /// @inheritdoc IKeep3rParameters\n uint256 public override unbondTime = 14 days;\n\n /// @inheritdoc IKeep3rParameters\n uint256 public override liquidityMinimum = 3 ether;\n\n /// @inheritdoc IKeep3rParameters\n uint256 public override rewardPeriodTime = 5 days;\n\n /// @inheritdoc IKeep3rParameters\n uint256 public override inflationPeriod = 34 days;\n\n /// @inheritdoc IKeep3rParameters\n uint256 public override fee = 30;\n\n /// @notice The base that will be used to calculate the fee\n uint256 internal constant _BASE = 10_000;\n\n /// @notice The minimum reward period\n uint256 internal constant _MIN_REWARD_PERIOD_TIME = 1 days;\n\n constructor(\n address _keep3rHelper,\n address _keep3rV1,\n address _keep3rV1Proxy\n ) {\n keep3rHelper = _keep3rHelper;\n keep3rV1 = _keep3rV1;\n keep3rV1Proxy = _keep3rV1Proxy;\n }\n\n /// @inheritdoc IKeep3rParameters\n function setKeep3rHelper(address _keep3rHelper) external override onlyGovernance {\n if (_keep3rHelper == address(0)) revert ZeroAddress();\n keep3rHelper = _keep3rHelper;\n emit Keep3rHelperChange(_keep3rHelper);\n }\n\n /// @inheritdoc IKeep3rParameters\n function setKeep3rV1(address _keep3rV1) public virtual override onlyGovernance {\n if (_keep3rV1 == address(0)) revert ZeroAddress();\n _mint(totalBonds);\n\n keep3rV1 = _keep3rV1;\n emit Keep3rV1Change(_keep3rV1);\n }\n\n /// @inheritdoc IKeep3rParameters\n function setKeep3rV1Proxy(address _keep3rV1Proxy) external override onlyGovernance {\n if (_keep3rV1Proxy == address(0)) revert ZeroAddress();\n keep3rV1Proxy = _keep3rV1Proxy;\n emit Keep3rV1ProxyChange(_keep3rV1Proxy);\n }\n\n /// @inheritdoc IKeep3rParameters\n function setBondTime(uint256 _bondTime) external override onlyGovernance {\n bondTime = _bondTime;\n emit BondTimeChange(_bondTime);\n }\n\n /// @inheritdoc IKeep3rParameters\n function setUnbondTime(uint256 _unbondTime) external override onlyGovernance {\n unbondTime = _unbondTime;\n emit UnbondTimeChange(_unbondTime);\n }\n\n /// @inheritdoc IKeep3rParameters\n function setLiquidityMinimum(uint256 _liquidityMinimum) external override onlyGovernance {\n liquidityMinimum = _liquidityMinimum;\n emit LiquidityMinimumChange(_liquidityMinimum);\n }\n\n /// @inheritdoc IKeep3rParameters\n function setRewardPeriodTime(uint256 _rewardPeriodTime) external override onlyGovernance {\n if (_rewardPeriodTime < _MIN_REWARD_PERIOD_TIME) revert MinRewardPeriod();\n rewardPeriodTime = _rewardPeriodTime;\n emit RewardPeriodTimeChange(_rewardPeriodTime);\n }\n\n /// @inheritdoc IKeep3rParameters\n function setInflationPeriod(uint256 _inflationPeriod) external override onlyGovernance {\n inflationPeriod = _inflationPeriod;\n emit InflationPeriodChange(_inflationPeriod);\n }\n\n /// @inheritdoc IKeep3rParameters\n function setFee(uint256 _fee) external override onlyGovernance {\n fee = _fee;\n emit FeeChange(_fee);\n }\n\n function _mint(uint256 _amount) internal {\n totalBonds -= _amount;\n IKeep3rV1Proxy(keep3rV1Proxy).mint(_amount);\n }\n}\n" - }, - "@openzeppelin/contracts/security/ReentrancyGuard.sol": { - "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Contract module that helps prevent reentrant calls to a function.\n *\n * Inheriting from `ReentrancyGuard` will make the {nonReentrant} modifier\n * available, which can be applied to functions to make sure there are no nested\n * (reentrant) calls to them.\n *\n * Note that because there is a single `nonReentrant` guard, functions marked as\n * `nonReentrant` may not call one another. This can be worked around by making\n * those functions `private`, and then adding `external` `nonReentrant` entry\n * points to them.\n *\n * TIP: If you would like to learn more about reentrancy and alternative ways\n * to protect against it, check out our blog post\n * https://blog.openzeppelin.com/reentrancy-after-istanbul/[Reentrancy After Istanbul].\n */\nabstract contract ReentrancyGuard {\n // Booleans are more expensive than uint256 or any type that takes up a full\n // word because each write operation emits an extra SLOAD to first read the\n // slot's contents, replace the bits taken up by the boolean, and then write\n // back. This is the compiler's defense against contract upgrades and\n // pointer aliasing, and it cannot be disabled.\n\n // The values being non-zero value makes deployment a bit more expensive,\n // but in exchange the refund on every call to nonReentrant will be lower in\n // amount. Since refunds are capped to a percentage of the total\n // transaction's gas, it is best to keep them low in cases like this one, to\n // increase the likelihood of the full refund coming into effect.\n uint256 private constant _NOT_ENTERED = 1;\n uint256 private constant _ENTERED = 2;\n\n uint256 private _status;\n\n constructor() {\n _status = _NOT_ENTERED;\n }\n\n /**\n * @dev Prevents a contract from calling itself, directly or indirectly.\n * Calling a `nonReentrant` function from another `nonReentrant`\n * function is not supported. It is possible to prevent this from happening\n * by making the `nonReentrant` function external, and make it call a\n * `private` function that does the actual work.\n */\n modifier nonReentrant() {\n // On the first call to nonReentrant, _notEntered will be true\n require(_status != _ENTERED, \"ReentrancyGuard: reentrant call\");\n\n // Any calls to nonReentrant after this point will fail\n _status = _ENTERED;\n\n _;\n\n // By storing the original value once again, a refund is triggered (see\n // https://eips.ethereum.org/EIPS/eip-2200)\n _status = _NOT_ENTERED;\n }\n}\n" - }, - "@openzeppelin/contracts/utils/math/Math.sol": { - "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Standard math utilities missing in the Solidity language.\n */\nlibrary Math {\n /**\n * @dev Returns the largest of two numbers.\n */\n function max(uint256 a, uint256 b) internal pure returns (uint256) {\n return a >= b ? a : b;\n }\n\n /**\n * @dev Returns the smallest of two numbers.\n */\n function min(uint256 a, uint256 b) internal pure returns (uint256) {\n return a < b ? a : b;\n }\n\n /**\n * @dev Returns the average of two numbers. The result is rounded towards\n * zero.\n */\n function average(uint256 a, uint256 b) internal pure returns (uint256) {\n // (a + b) / 2 can overflow.\n return (a & b) + (a ^ b) / 2;\n }\n\n /**\n * @dev Returns the ceiling of the division of two numbers.\n *\n * This differs from standard division with `/` in that it rounds up instead\n * of rounding down.\n */\n function ceilDiv(uint256 a, uint256 b) internal pure returns (uint256) {\n // (a + b - 1) / b can overflow on addition, so we distribute.\n return a / b + (a % b == 0 ? 0 : 1);\n }\n}\n" - }, - "solidity/interfaces/external/IKeep3rV1Proxy.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../peripherals/IGovernable.sol';\n\ninterface IKeep3rV1Proxy is IGovernable {\n // Structs\n struct Recipient {\n address recipient;\n uint256 caps;\n }\n\n // Variables\n function keep3rV1() external view returns (address);\n\n function minter() external view returns (address);\n\n function next(address) external view returns (uint256);\n\n function caps(address) external view returns (uint256);\n\n function recipients() external view returns (address[] memory);\n\n function recipientsCaps() external view returns (Recipient[] memory);\n\n // Errors\n error Cooldown();\n error NoDrawableAmount();\n error ZeroAddress();\n error OnlyMinter();\n\n // Methods\n function addRecipient(address recipient, uint256 amount) external;\n\n function removeRecipient(address recipient) external;\n\n function draw() external returns (uint256 _amount);\n\n function setKeep3rV1(address _keep3rV1) external;\n\n function setMinter(address _minter) external;\n\n function mint(uint256 _amount) external;\n\n function mint(address _account, uint256 _amount) external;\n\n function setKeep3rV1Governance(address _governance) external;\n\n function acceptKeep3rV1Governance() external;\n\n function dispute(address _keeper) external;\n\n function slash(\n address _bonded,\n address _keeper,\n uint256 _amount\n ) external;\n\n function revoke(address _keeper) external;\n\n function resolve(address _keeper) external;\n\n function addJob(address _job) external;\n\n function removeJob(address _job) external;\n\n function addKPRCredit(address _job, uint256 _amount) external;\n\n function approveLiquidity(address _liquidity) external;\n\n function revokeLiquidity(address _liquidity) external;\n\n function setKeep3rHelper(address _keep3rHelper) external;\n\n function addVotes(address _voter, uint256 _amount) external;\n\n function removeVotes(address _voter, uint256 _amount) external;\n}\n" - }, - "solidity/interfaces/IKeep3rHelperParameters.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\n/// @title Keep3rHelperParameters contract\n/// @notice Contains all the helper functions used throughout the different files.\ninterface IKeep3rHelperParameters {\n // Structs\n\n /// @dev KP3R-WETH Pool address and isKP3RToken0\n /// @dev Created in order to save gas by avoiding calls to pool's token0 method\n struct TokenOraclePool {\n address poolAddress;\n bool isTKNToken0;\n }\n\n // Errors\n\n /// @notice Throws when pool does not have KP3R as token0 nor token1\n error InvalidOraclePool();\n\n // Events\n\n /// @notice Emitted when the kp3r weth pool is changed\n /// @param _address Address of the new kp3r weth pool\n /// @param _isKP3RToken0 True if calling the token0 method of the pool returns the KP3R token address\n event Kp3rWethPoolChange(address _address, bool _isKP3RToken0);\n\n /// @notice Emitted when the minimum boost multiplier is changed\n /// @param _minBoost The minimum boost multiplier\n event MinBoostChange(uint256 _minBoost);\n\n /// @notice Emitted when the maximum boost multiplier is changed\n /// @param _maxBoost The maximum boost multiplier\n event MaxBoostChange(uint256 _maxBoost);\n\n /// @notice Emitted when the target bond amount is changed\n /// @param _targetBond The target bond amount\n event TargetBondChange(uint256 _targetBond);\n\n /// @notice Emitted when the Keep3r V2 address is changed\n /// @param _keep3rV2 The address of Keep3r V2\n event Keep3rV2Change(address _keep3rV2);\n\n /// @notice Emitted when the work extra gas amount is changed\n /// @param _workExtraGas The work extra gas\n event WorkExtraGasChange(uint256 _workExtraGas);\n\n /// @notice Emitted when the quote twap time is changed\n /// @param _quoteTwapTime The twap time for quoting\n event QuoteTwapTimeChange(uint32 _quoteTwapTime);\n\n /// @notice Emitted when minimum rewarded gas fee is changed\n /// @param _minBaseFee The minimum rewarded gas fee\n event MinBaseFeeChange(uint256 _minBaseFee);\n\n /// @notice Emitted when minimum rewarded priority fee is changed\n /// @param _minPriorityFee The minimum expected fee that the keeper should pay\n event MinPriorityFeeChange(uint256 _minPriorityFee);\n\n // Variables\n\n /// @notice Address of KP3R token\n /// @return _kp3r Address of KP3R token\n // solhint-disable func-name-mixedcase\n function KP3R() external view returns (address _kp3r);\n\n /// @notice The boost base used to calculate the boost rewards for the keeper\n /// @return _base The boost base number\n function BOOST_BASE() external view returns (uint256 _base);\n\n /// @notice KP3R-WETH pool that is being used as oracle\n /// @return poolAddress Address of the pool\n /// @return isTKNToken0 True if calling the token0 method of the pool returns the KP3R token address\n function kp3rWethPool() external view returns (address poolAddress, bool isTKNToken0);\n\n /// @notice The minimum multiplier used to calculate the amount of gas paid to the Keeper for the gas used to perform a job\n /// For example: if the quoted gas used is 1000, then the minimum amount to be paid will be 1000 * minBoost / BOOST_BASE\n /// @return _multiplier The minimum boost multiplier\n function minBoost() external view returns (uint256 _multiplier);\n\n /// @notice The maximum multiplier used to calculate the amount of gas paid to the Keeper for the gas used to perform a job\n /// For example: if the quoted gas used is 1000, then the maximum amount to be paid will be 1000 * maxBoost / BOOST_BASE\n /// @return _multiplier The maximum boost multiplier\n function maxBoost() external view returns (uint256 _multiplier);\n\n /// @notice The targeted amount of bonded KP3Rs to max-up reward multiplier\n /// For example: if the amount of KP3R the keeper has bonded is targetBond or more, then the keeper will get\n /// the maximum boost possible in his rewards, if it's less, the reward boost will be proportional\n /// @return _target The amount of KP3R that comforms the targetBond\n function targetBond() external view returns (uint256 _target);\n\n /// @notice The amount of unaccounted gas that is going to be added to keeper payments\n /// @return _workExtraGas The work unaccounted gas amount\n function workExtraGas() external view returns (uint256 _workExtraGas);\n\n /// @notice The twap time for quoting\n /// @return _quoteTwapTime The twap time\n function quoteTwapTime() external view returns (uint32 _quoteTwapTime);\n\n /// @notice The minimum base fee that is used to calculate keeper rewards\n /// @return _minBaseFee The minimum rewarded gas fee\n function minBaseFee() external view returns (uint256 _minBaseFee);\n\n /// @notice The minimum priority fee that is also rewarded for keepers\n /// @return _minPriorityFee The minimum rewarded priority fee\n function minPriorityFee() external view returns (uint256 _minPriorityFee);\n\n /// @notice Address of Keep3r V2\n /// @return _keep3rV2 Address of Keep3r V2\n function keep3rV2() external view returns (address _keep3rV2);\n\n // Methods\n\n /// @notice Sets KP3R-WETH pool\n /// @param _poolAddress The address of the KP3R-WETH pool\n function setKp3rWethPool(address _poolAddress) external;\n\n /// @notice Sets the minimum boost multiplier\n /// @param _minBoost The minimum boost multiplier\n function setMinBoost(uint256 _minBoost) external;\n\n /// @notice Sets the maximum boost multiplier\n /// @param _maxBoost The maximum boost multiplier\n function setMaxBoost(uint256 _maxBoost) external;\n\n /// @notice Sets the target bond amount\n /// @param _targetBond The target bond amount\n function setTargetBond(uint256 _targetBond) external;\n\n /// @notice Sets the Keep3r V2 address\n /// @param _keep3rV2 The address of Keep3r V2\n function setKeep3rV2(address _keep3rV2) external;\n\n /// @notice Sets the work extra gas amount\n /// @param _workExtraGas The work extra gas\n function setWorkExtraGas(uint256 _workExtraGas) external;\n\n /// @notice Sets the quote twap time\n /// @param _quoteTwapTime The twap time for quoting\n function setQuoteTwapTime(uint32 _quoteTwapTime) external;\n\n /// @notice Sets the minimum rewarded gas fee\n /// @param _minBaseFee The minimum rewarded gas fee\n function setMinBaseFee(uint256 _minBaseFee) external;\n\n /// @notice Sets the minimum rewarded gas priority fee\n /// @param _minPriorityFee The minimum rewarded priority fee\n function setMinPriorityFee(uint256 _minPriorityFee) external;\n}\n" - }, - "solidity/interfaces/IPairManager.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol';\n\n/// @title Pair Manager interface\n/// @notice Generic interface for Keep3r liquidity pools (kLP)\ninterface IPairManager is IERC20Metadata {\n /// @notice Address of the factory from which the pair manager was created\n /// @return _factory The address of the PairManager Factory\n function factory() external view returns (address _factory);\n\n /// @notice Address of the pool from which the Keep3r pair manager will interact with\n /// @return _pool The address of the pool\n function pool() external view returns (address _pool);\n\n /// @notice Token0 of the pool\n /// @return _token0 The address of token0\n function token0() external view returns (address _token0);\n\n /// @notice Token1 of the pool\n /// @return _token1 The address of token1\n function token1() external view returns (address _token1);\n}\n" - }, - "solidity/contracts/libraries/FullMath.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\n/// @title Contains 512-bit math functions\n/// @notice Facilitates multiplication and division that can have overflow of an intermediate value without any loss of precision\n/// @dev Handles \"phantom overflow\" i.e., allows multiplication and division where an intermediate value overflows 256 bits\nlibrary FullMath {\n /// @notice Calculates floor(a×b÷denominator) with full precision. Throws if result overflows a uint256 or denominator == 0\n /// @param a The multiplicand\n /// @param b The multiplier\n /// @param denominator The divisor\n /// @return result The 256-bit result\n /// @dev Credit to Remco Bloemen under MIT license https://xn--2-umb.com/21/muldiv\n function mulDiv(\n uint256 a,\n uint256 b,\n uint256 denominator\n ) internal pure returns (uint256 result) {\n unchecked {\n // 512-bit multiply [prod1 prod0] = a * b\n // Compute the product mod 2**256 and mod 2**256 - 1\n // then use the Chinese Remainder Theorem to reconstruct\n // the 512 bit result. The result is stored in two 256\n // variables such that product = prod1 * 2**256 + prod0\n uint256 prod0; // Least significant 256 bits of the product\n uint256 prod1; // Most significant 256 bits of the product\n assembly {\n let mm := mulmod(a, b, not(0))\n prod0 := mul(a, b)\n prod1 := sub(sub(mm, prod0), lt(mm, prod0))\n }\n\n // Handle non-overflow cases, 256 by 256 division\n if (prod1 == 0) {\n require(denominator > 0);\n assembly {\n result := div(prod0, denominator)\n }\n return result;\n }\n\n // Make sure the result is less than 2**256.\n // Also prevents denominator == 0\n require(denominator > prod1);\n\n ///////////////////////////////////////////////\n // 512 by 256 division.\n ///////////////////////////////////////////////\n\n // Make division exact by subtracting the remainder from [prod1 prod0]\n // Compute remainder using mulmod\n uint256 remainder;\n assembly {\n remainder := mulmod(a, b, denominator)\n }\n // Subtract 256 bit number from 512 bit number\n assembly {\n prod1 := sub(prod1, gt(remainder, prod0))\n prod0 := sub(prod0, remainder)\n }\n\n // Factor powers of two out of denominator\n // Compute largest power of two divisor of denominator.\n // Always >= 1.\n uint256 twos = (~denominator + 1) & denominator;\n // Divide denominator by power of two\n assembly {\n denominator := div(denominator, twos)\n }\n\n // Divide [prod1 prod0] by the factors of two\n assembly {\n prod0 := div(prod0, twos)\n }\n // Shift in bits from prod1 into prod0. For this we need\n // to flip `twos` such that it is 2**256 / twos.\n // If twos is zero, then it becomes one\n assembly {\n twos := add(div(sub(0, twos), twos), 1)\n }\n prod0 |= prod1 * twos;\n\n // Invert denominator mod 2**256\n // Now that denominator is an odd number, it has an inverse\n // modulo 2**256 such that denominator * inv = 1 mod 2**256.\n // Compute the inverse by starting with a seed that is correct\n // correct for four bits. That is, denominator * inv = 1 mod 2**4\n uint256 inv = (3 * denominator) ^ 2;\n // Now use Newton-Raphson iteration to improve the precision.\n // Thanks to Hensel's lifting lemma, this also works in modular\n // arithmetic, doubling the correct bits in each step.\n inv *= 2 - denominator * inv; // inverse mod 2**8\n inv *= 2 - denominator * inv; // inverse mod 2**16\n inv *= 2 - denominator * inv; // inverse mod 2**32\n inv *= 2 - denominator * inv; // inverse mod 2**64\n inv *= 2 - denominator * inv; // inverse mod 2**128\n inv *= 2 - denominator * inv; // inverse mod 2**256\n\n // Because the division is now exact we can divide by multiplying\n // with the modular inverse of denominator. This will give us the\n // correct result modulo 2**256. Since the precoditions guarantee\n // that the outcome is less than 2**256, this is the final result.\n // We don't need to compute the high bits of the result and prod1\n // is no longer required.\n result = prod0 * inv;\n return result;\n }\n }\n\n /// @notice Calculates ceil(a×b÷denominator) with full precision. Throws if result overflows a uint256 or denominator == 0\n /// @param a The multiplicand\n /// @param b The multiplier\n /// @param denominator The divisor\n /// @return result The 256-bit result\n function mulDivRoundingUp(\n uint256 a,\n uint256 b,\n uint256 denominator\n ) internal pure returns (uint256 result) {\n unchecked {\n result = mulDiv(a, b, denominator);\n if (mulmod(a, b, denominator) > 0) {\n require(result < type(uint256).max);\n result++;\n }\n }\n }\n}\n" - }, - "@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol": { - "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\nimport \"../IERC20.sol\";\n\n/**\n * @dev Interface for the optional metadata functions from the ERC20 standard.\n *\n * _Available since v4.1._\n */\ninterface IERC20Metadata is IERC20 {\n /**\n * @dev Returns the name of the token.\n */\n function name() external view returns (string memory);\n\n /**\n * @dev Returns the symbol of the token.\n */\n function symbol() external view returns (string memory);\n\n /**\n * @dev Returns the decimals places of the token.\n */\n function decimals() external view returns (uint8);\n}\n" - }, - "solidity/contracts/peripherals/Keep3rDisputable.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport './Keep3rParameters.sol';\nimport '../../interfaces/peripherals/IKeep3rDisputable.sol';\n\nabstract contract Keep3rDisputable is IKeep3rDisputable, Keep3rParameters {\n /// @inheritdoc IKeep3rDisputable\n function dispute(address _jobOrKeeper) external override onlyDisputer {\n if (disputes[_jobOrKeeper]) revert AlreadyDisputed();\n disputes[_jobOrKeeper] = true;\n emit Dispute(_jobOrKeeper, msg.sender);\n }\n\n /// @inheritdoc IKeep3rDisputable\n function resolve(address _jobOrKeeper) external override onlyDisputer {\n if (!disputes[_jobOrKeeper]) revert NotDisputed();\n disputes[_jobOrKeeper] = false;\n emit Resolve(_jobOrKeeper, msg.sender);\n }\n}\n" - }, - "solidity/contracts/peripherals/keepers/Keep3rKeeperDisputable.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport './Keep3rKeeperFundable.sol';\nimport '../Keep3rDisputable.sol';\nimport '../../../interfaces/external/IKeep3rV1.sol';\nimport '../../../interfaces/peripherals/IKeep3rKeepers.sol';\n\nabstract contract Keep3rKeeperDisputable is IKeep3rKeeperDisputable, Keep3rDisputable, Keep3rKeeperFundable {\n using EnumerableSet for EnumerableSet.AddressSet;\n using SafeERC20 for IERC20;\n\n /// @inheritdoc IKeep3rKeeperDisputable\n function slash(\n address _keeper,\n address _bonded,\n uint256 _bondAmount,\n uint256 _unbondAmount\n ) external override onlySlasher {\n if (!disputes[_keeper]) revert NotDisputed();\n _slash(_keeper, _bonded, _bondAmount, _unbondAmount);\n emit KeeperSlash(_keeper, msg.sender, _bondAmount + _unbondAmount);\n }\n\n /// @inheritdoc IKeep3rKeeperDisputable\n function revoke(address _keeper) external override onlySlasher {\n if (!disputes[_keeper]) revert NotDisputed();\n _keepers.remove(_keeper);\n _slash(_keeper, keep3rV1, bonds[_keeper][keep3rV1], pendingUnbonds[_keeper][keep3rV1]);\n emit KeeperRevoke(_keeper, msg.sender);\n }\n\n function _slash(\n address _keeper,\n address _bonded,\n uint256 _bondAmount,\n uint256 _unbondAmount\n ) internal {\n if (_bonded != keep3rV1) {\n try IERC20(_bonded).transfer(governance, _bondAmount + _unbondAmount) returns (bool) {} catch (bytes memory) {}\n }\n bonds[_keeper][_bonded] -= _bondAmount;\n pendingUnbonds[_keeper][_bonded] -= _unbondAmount;\n }\n}\n" - }, - "solidity/contracts/peripherals/keepers/Keep3rKeeperFundable.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../Keep3rAccountance.sol';\nimport '../Keep3rParameters.sol';\nimport '../../../interfaces/peripherals/IKeep3rKeepers.sol';\n\nimport '../../../interfaces/external/IKeep3rV1.sol';\n\nimport '@openzeppelin/contracts/security/ReentrancyGuard.sol';\nimport '@openzeppelin/contracts/token/ERC20/IERC20.sol';\nimport '@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol';\n\nabstract contract Keep3rKeeperFundable is IKeep3rKeeperFundable, ReentrancyGuard, Keep3rParameters {\n using EnumerableSet for EnumerableSet.AddressSet;\n using SafeERC20 for IERC20;\n\n /// @inheritdoc IKeep3rKeeperFundable\n function bond(address _bonding, uint256 _amount) external override nonReentrant {\n if (disputes[msg.sender]) revert Disputed();\n if (_jobs.contains(msg.sender)) revert AlreadyAJob();\n canActivateAfter[msg.sender][_bonding] = block.timestamp + bondTime;\n\n uint256 _before = IERC20(_bonding).balanceOf(address(this));\n IERC20(_bonding).safeTransferFrom(msg.sender, address(this), _amount);\n _amount = IERC20(_bonding).balanceOf(address(this)) - _before;\n\n hasBonded[msg.sender] = true;\n pendingBonds[msg.sender][_bonding] += _amount;\n\n emit Bonding(msg.sender, _bonding, _amount);\n }\n\n /// @inheritdoc IKeep3rKeeperFundable\n function activate(address _bonding) external override {\n address _keeper = msg.sender;\n if (disputes[_keeper]) revert Disputed();\n uint256 _canActivateAfter = canActivateAfter[_keeper][_bonding];\n if (_canActivateAfter == 0) revert BondsUnexistent();\n if (_canActivateAfter >= block.timestamp) revert BondsLocked();\n\n if (firstSeen[_keeper] == 0) {\n firstSeen[_keeper] = block.timestamp;\n }\n _keepers.add(_keeper);\n\n uint256 _amount = pendingBonds[_keeper][_bonding];\n delete pendingBonds[_keeper][_bonding];\n\n // bond provided tokens\n bonds[_keeper][_bonding] += _amount;\n if (_bonding == keep3rV1) {\n totalBonds += _amount;\n _depositBonds(_amount);\n }\n\n emit Activation(_keeper, _bonding, _amount);\n }\n\n /// @inheritdoc IKeep3rKeeperFundable\n function unbond(address _bonding, uint256 _amount) external override {\n canWithdrawAfter[msg.sender][_bonding] = block.timestamp + unbondTime;\n bonds[msg.sender][_bonding] -= _amount;\n pendingUnbonds[msg.sender][_bonding] += _amount;\n\n emit Unbonding(msg.sender, _bonding, _amount);\n }\n\n /// @inheritdoc IKeep3rKeeperFundable\n function withdraw(address _bonding) external override nonReentrant {\n if (pendingUnbonds[msg.sender][_bonding] == 0) revert UnbondsUnexistent();\n if (canWithdrawAfter[msg.sender][_bonding] >= block.timestamp) revert UnbondsLocked();\n if (disputes[msg.sender]) revert Disputed();\n\n uint256 _amount = pendingUnbonds[msg.sender][_bonding];\n\n delete pendingUnbonds[msg.sender][_bonding];\n delete canWithdrawAfter[msg.sender][_bonding];\n\n if (_bonding == keep3rV1) _mint(_amount);\n IERC20(_bonding).safeTransfer(msg.sender, _amount);\n\n emit Withdrawal(msg.sender, _bonding, _amount);\n }\n\n function _depositBonds(uint256 _amount) internal virtual {\n IKeep3rV1(keep3rV1).burn(_amount);\n }\n}\n" - }, - "solidity/interfaces/external/IKeep3rV1.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '@openzeppelin/contracts/token/ERC20/IERC20.sol';\nimport '@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol';\n\n// solhint-disable func-name-mixedcase\ninterface IKeep3rV1 is IERC20, IERC20Metadata {\n // Structs\n struct Checkpoint {\n uint32 fromBlock;\n uint256 votes;\n }\n\n // Events\n event DelegateChanged(address indexed _delegator, address indexed _fromDelegate, address indexed _toDelegate);\n event DelegateVotesChanged(address indexed _delegate, uint256 _previousBalance, uint256 _newBalance);\n event SubmitJob(address indexed _job, address indexed _liquidity, address indexed _provider, uint256 _block, uint256 _credit);\n event ApplyCredit(address indexed _job, address indexed _liquidity, address indexed _provider, uint256 _block, uint256 _credit);\n event RemoveJob(address indexed _job, address indexed _liquidity, address indexed _provider, uint256 _block, uint256 _credit);\n event UnbondJob(address indexed _job, address indexed _liquidity, address indexed _provider, uint256 _block, uint256 _credit);\n event JobAdded(address indexed _job, uint256 _block, address _governance);\n event JobRemoved(address indexed _job, uint256 _block, address _governance);\n event KeeperWorked(address indexed _credit, address indexed _job, address indexed _keeper, uint256 _block, uint256 _amount);\n event KeeperBonding(address indexed _keeper, uint256 _block, uint256 _active, uint256 _bond);\n event KeeperBonded(address indexed _keeper, uint256 _block, uint256 _activated, uint256 _bond);\n event KeeperUnbonding(address indexed _keeper, uint256 _block, uint256 _deactive, uint256 _bond);\n event KeeperUnbound(address indexed _keeper, uint256 _block, uint256 _deactivated, uint256 _bond);\n event KeeperSlashed(address indexed _keeper, address indexed _slasher, uint256 _block, uint256 _slash);\n event KeeperDispute(address indexed _keeper, uint256 _block);\n event KeeperResolved(address indexed _keeper, uint256 _block);\n event TokenCreditAddition(address indexed _credit, address indexed _job, address indexed _creditor, uint256 _block, uint256 _amount);\n\n // Variables\n function KPRH() external returns (address);\n\n function delegates(address _delegator) external view returns (address);\n\n function checkpoints(address _account, uint32 _checkpoint) external view returns (Checkpoint memory);\n\n function numCheckpoints(address _account) external view returns (uint32);\n\n function DOMAIN_TYPEHASH() external returns (bytes32);\n\n function DOMAINSEPARATOR() external returns (bytes32);\n\n function DELEGATION_TYPEHASH() external returns (bytes32);\n\n function PERMIT_TYPEHASH() external returns (bytes32);\n\n function nonces(address _user) external view returns (uint256);\n\n function BOND() external returns (uint256);\n\n function UNBOND() external returns (uint256);\n\n function LIQUIDITYBOND() external returns (uint256);\n\n function FEE() external returns (uint256);\n\n function BASE() external returns (uint256);\n\n function ETH() external returns (address);\n\n function bondings(address _user, address _bonding) external view returns (uint256);\n\n function canWithdrawAfter(address _user, address _bonding) external view returns (uint256);\n\n function pendingUnbonds(address _keeper, address _bonding) external view returns (uint256);\n\n function pendingbonds(address _keeper, address _bonding) external view returns (uint256);\n\n function bonds(address _keeper, address _bonding) external view returns (uint256);\n\n function votes(address _delegator) external view returns (uint256);\n\n function firstSeen(address _keeper) external view returns (uint256);\n\n function disputes(address _keeper) external view returns (bool);\n\n function lastJob(address _keeper) external view returns (uint256);\n\n function workCompleted(address _keeper) external view returns (uint256);\n\n function jobs(address _job) external view returns (bool);\n\n function credits(address _job, address _credit) external view returns (uint256);\n\n function liquidityProvided(\n address _provider,\n address _liquidity,\n address _job\n ) external view returns (uint256);\n\n function liquidityUnbonding(\n address _provider,\n address _liquidity,\n address _job\n ) external view returns (uint256);\n\n function liquidityAmountsUnbonding(\n address _provider,\n address _liquidity,\n address _job\n ) external view returns (uint256);\n\n function jobProposalDelay(address _job) external view returns (uint256);\n\n function liquidityApplied(\n address _provider,\n address _liquidity,\n address _job\n ) external view returns (uint256);\n\n function liquidityAmount(\n address _provider,\n address _liquidity,\n address _job\n ) external view returns (uint256);\n\n function keepers(address _keeper) external view returns (bool);\n\n function blacklist(address _keeper) external view returns (bool);\n\n function keeperList(uint256 _index) external view returns (address);\n\n function jobList(uint256 _index) external view returns (address);\n\n function governance() external returns (address);\n\n function pendingGovernance() external returns (address);\n\n function liquidityAccepted(address _liquidity) external view returns (bool);\n\n function liquidityPairs(uint256 _index) external view returns (address);\n\n // Methods\n function getCurrentVotes(address _account) external view returns (uint256);\n\n function addCreditETH(address _job) external payable;\n\n function addCredit(\n address _credit,\n address _job,\n uint256 _amount\n ) external;\n\n function addVotes(address _voter, uint256 _amount) external;\n\n function removeVotes(address _voter, uint256 _amount) external;\n\n function addKPRCredit(address _job, uint256 _amount) external;\n\n function approveLiquidity(address _liquidity) external;\n\n function revokeLiquidity(address _liquidity) external;\n\n function pairs() external view returns (address[] memory);\n\n function addLiquidityToJob(\n address _liquidity,\n address _job,\n uint256 _amount\n ) external;\n\n function applyCreditToJob(\n address _provider,\n address _liquidity,\n address _job\n ) external;\n\n function unbondLiquidityFromJob(\n address _liquidity,\n address _job,\n uint256 _amount\n ) external;\n\n function removeLiquidityFromJob(address _liquidity, address _job) external;\n\n function mint(uint256 _amount) external;\n\n function burn(uint256 _amount) external;\n\n function worked(address _keeper) external;\n\n function receipt(\n address _credit,\n address _keeper,\n uint256 _amount\n ) external;\n\n function receiptETH(address _keeper, uint256 _amount) external;\n\n function addJob(address _job) external;\n\n function getJobs() external view returns (address[] memory);\n\n function removeJob(address _job) external;\n\n function setKeep3rHelper(address _keep3rHelper) external;\n\n function setGovernance(address _governance) external;\n\n function acceptGovernance() external;\n\n function isKeeper(address _keeper) external returns (bool);\n\n function isMinKeeper(\n address _keeper,\n uint256 _minBond,\n uint256 _earned,\n uint256 _age\n ) external returns (bool);\n\n function isBondedKeeper(\n address _keeper,\n address _bond,\n uint256 _minBond,\n uint256 _earned,\n uint256 _age\n ) external returns (bool);\n\n function bond(address _bonding, uint256 _amount) external;\n\n function getKeepers() external view returns (address[] memory);\n\n function activate(address _bonding) external;\n\n function unbond(address _bonding, uint256 _amount) external;\n\n function slash(\n address _bonded,\n address _keeper,\n uint256 _amount\n ) external;\n\n function withdraw(address _bonding) external;\n\n function dispute(address _keeper) external;\n\n function revoke(address _keeper) external;\n\n function resolve(address _keeper) external;\n\n function permit(\n address _owner,\n address _spender,\n uint256 _amount,\n uint256 _deadline,\n uint8 _v,\n bytes32 _r,\n bytes32 _s\n ) external;\n}\n" - }, - "solidity/for-test/testnet/Keep3rForTestnet.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../../contracts/Keep3r.sol';\n\ncontract Keep3rForTestnet is Keep3r {\n constructor(\n address _governance,\n address _keep3rHelper,\n address _keep3rV1,\n address _keep3rV1Proxy\n ) Keep3r(_governance, _keep3rHelper, _keep3rV1, _keep3rV1Proxy) {\n bondTime = 0; // allows keepers to instantly register\n unbondTime = 0; // allows keepers & jobOwners to instantly withdraw funds\n liquidityMinimum = 1; // allows job providers to add low liquidity\n rewardPeriodTime = 1 days; // reduces twap calculation period\n inflationPeriod = 5 days; // increases credit minting\n }\n}\n" - }, - "solidity/for-test/Keep3rForTest.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../contracts/Keep3r.sol';\n\ncontract Keep3rForTest is Keep3r {\n constructor(\n address _governance,\n address _keep3rHelper,\n address _keep3rV1,\n address _keep3rV1Proxy\n ) Keep3r(_governance, _keep3rHelper, _keep3rV1, _keep3rV1Proxy) {}\n}\n" - }, - "solidity/contracts/sidechain/Keep3rSidechain.sol": { - "content": "// SPDX-License-Identifier: MIT\n\n/*\n\nCoded for The Keep3r Network with ♥ by\n\n██████╗░███████╗███████╗██╗░░░██╗░░░░░░░██╗░█████╗░███╗░░██╗██████╗░███████╗██████╗░██╗░░░░░░█████╗░███╗░░██╗██████╗░\n██╔══██╗██╔════╝██╔════╝██║░░░██║░░██╗░░██║██╔══██╗████╗░██║██╔══██╗██╔════╝██╔══██╗██║░░░░░██╔══██╗████╗░██║██╔══██╗\n██║░░██║█████╗░░█████╗░░██║░░░╚██╗████╗██╔╝██║░░██║██╔██╗██║██║░░██║█████╗░░██████╔╝██║░░░░░███████║██╔██╗██║██║░░██║\n██║░░██║██╔══╝░░██╔══╝░░██║░░░░████╔═████║░██║░░██║██║╚████║██║░░██║██╔══╝░░██╔══██╗██║░░░░░██╔══██║██║╚████║██║░░██║\n██████╔╝███████╗██║░░░░░██║░░░░╚██╔╝░╚██╔╝░╚█████╔╝██║░╚███║██████╔╝███████╗██║░░██║███████╗██║░░██║██║░╚███║██████╔╝\n╚═════╝░╚══════╝╚═╝░░░░░╚═╝░░░░░╚═╝░░░╚═╝░░░╚════╝░╚═╝░░╚══╝╚═════╝░╚══════╝╚═╝░░╚═╝╚══════╝╚═╝░░╚═╝╚═╝░░╚══╝╚═════╝░\n\nhttps://defi.sucks\n\n*/\n\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../Keep3r.sol';\nimport '../../interfaces/sidechain/IKeep3rEscrow.sol';\nimport '../../interfaces/sidechain/IKeep3rHelperSidechain.sol';\nimport '../../interfaces/sidechain/IKeep3rJobWorkableRated.sol';\nimport '../../interfaces/sidechain/IKeep3rSidechainAccountance.sol';\n\ncontract Keep3rSidechain is Keep3r, IKeep3rJobWorkableRated, IKeep3rSidechainAccountance {\n using EnumerableSet for EnumerableSet.AddressSet;\n\n /// @param _governance Address of governance\n /// @param _keep3rHelperSidechain Address of sidechain Keep3rHelper\n /// @param _wrappedKP3R Address of wrapped KP3R implementation\n /// @param _keep3rEscrow Address of sidechain Keep3rEscrow\n constructor(\n address _governance, // governance\n address _keep3rHelperSidechain, // helper\n address _wrappedKP3R, // keep3rV1\n address _keep3rEscrow // keep3rV1Proxy\n ) Keep3r(_governance, _keep3rHelperSidechain, _wrappedKP3R, _keep3rEscrow) {}\n\n // Keep3rSidechainAccountance\n\n /// @inheritdoc IKeep3rSidechainAccountance\n function virtualReserves() external view override returns (int256 _virtualReserves) {\n // Queries wKP3R balanceOf escrow contract minus the totalBonds\n return int256(IERC20(keep3rV1).balanceOf(keep3rV1Proxy)) - int256(totalBonds);\n }\n\n // Keep3rJobFundableLiquidity\n\n /// @notice Sidechain implementation asks the Helper for an oracle, instead of reading it from the ERC-20\n /// @dev Function should be called after setting an oracle in Keep3rHelperSidechain\n /// @param _liquidity Address of the liquidity token being approved\n function approveLiquidity(address _liquidity) external virtual override onlyGovernance {\n if (!_approvedLiquidities.add(_liquidity)) revert LiquidityPairApproved();\n _liquidityPool[_liquidity] = IKeep3rHelperSidechain(keep3rHelper).oracle(_liquidity);\n if (_liquidityPool[_liquidity] == address(0)) revert ZeroAddress();\n _isKP3RToken0[_liquidity] = IKeep3rHelper(keep3rHelper).isKP3RToken0(_liquidityPool[_liquidity]);\n _tick[_liquidity] = observeLiquidity(_liquidity);\n emit LiquidityApproval(_liquidity);\n }\n\n /// @notice Sidechain implementation will always ask for 2 tickCumulatives instead of cacheing\n /// @param _liquidity Address of the liquidity token being observed\n function observeLiquidity(address _liquidity) public view virtual override returns (TickCache memory _tickCache) {\n if (_tick[_liquidity].period == _period(block.timestamp)) {\n // Will return cached twaps if liquidity is updated\n _tickCache = _tick[_liquidity];\n } else {\n bool success;\n\n // Will always ask for 2 accumulators in sidechain\n uint32[] memory _secondsAgo = new uint32[](2);\n\n _secondsAgo[0] = uint32(block.timestamp - _period(block.timestamp));\n _secondsAgo[1] = uint32(block.timestamp - _period(block.timestamp) + rewardPeriodTime);\n\n int56 _tickCumulative2;\n (_tickCache.current, _tickCumulative2, success) = IKeep3rHelper(keep3rHelper).observe(_liquidityPool[_liquidity], _secondsAgo);\n\n _tickCache.difference = _tickCache.current - _tickCumulative2;\n\n if (success) {\n _tickCache.period = _period(block.timestamp);\n } else {\n delete _tickCache.period;\n }\n }\n }\n\n // Keep3rJobsWorkable\n\n /// @dev Sidechain implementation deprecates worked(address) as it should come with a usdPerGasUnit parameter\n function worked(address) external pure override {\n revert Deprecated();\n }\n\n /// @notice Implemented by jobs to show that a keeper performed work\n /// @dev Uses a USD per gas unit payment mechanism\n /// @param _keeper Address of the keeper that performed the work\n /// @param _usdPerGasUnit Units of USD (in wei) per gas unit that should be rewarded to the keeper\n function worked(address _keeper, uint256 _usdPerGasUnit) external override {\n if (_initialGas == 0) revert GasNotInitialized();\n // Gas used for quote calculations & payment is not rewarded\n uint256 _gasLeft = _getGasLeft();\n\n address _job = msg.sender;\n if (disputes[_job]) revert JobDisputed();\n if (!_jobs.contains(_job)) revert JobUnapproved();\n\n if (_updateJobCreditsIfNeeded(_job)) {\n emit LiquidityCreditsReward(_job, rewardedAt[_job], _jobLiquidityCredits[_job], _jobPeriodCredits[_job]);\n }\n\n (uint256 _boost, uint256 _oneUsdQuote, uint256 _extraGas) = IKeep3rHelper(keep3rHelper).getPaymentParams(bonds[_keeper][keep3rV1]);\n\n uint256 _kp3rPayment = _calculatePayment(_gasLeft, _extraGas, _oneUsdQuote * _usdPerGasUnit, _boost);\n\n if (_kp3rPayment > _jobLiquidityCredits[_job]) {\n _rewardJobCredits(_job);\n emit LiquidityCreditsReward(_job, rewardedAt[_job], _jobLiquidityCredits[_job], _jobPeriodCredits[_job]);\n }\n\n _bondedPayment(_job, _keeper, _kp3rPayment);\n delete _initialGas;\n\n emit KeeperWork(keep3rV1, _job, _keeper, _kp3rPayment, _gasLeft);\n }\n\n // Keep3rKeeperFundable\n\n /// @dev Sidechain implementation doesn't burn tokens, but deposit them in Keep3rEscrow\n function _depositBonds(uint256 _amount) internal virtual override {\n IKeep3rV1(keep3rV1).approve(keep3rV1Proxy, _amount);\n IKeep3rEscrow(keep3rV1Proxy).deposit(_amount);\n }\n}\n" - }, - "solidity/interfaces/sidechain/IKeep3rEscrow.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\n// solhint-disable-next-line no-empty-blocks\n\nimport '../peripherals/IMintable.sol';\n\n/// @title Keep3rEscrow contract\n/// @notice This contract acts as an escrow contract for wKP3R tokens on sidechains and L2s\n/// @dev Can be used as a replacement for keep3rV1Proxy in keep3r sidechain implementations\ninterface IKeep3rEscrow is IMintable {\n /// @notice Emitted when Keep3rEscrow#deposit function is called\n /// @param _wKP3R The addess of the wrapped KP3R token\n /// @param _sender The address that called the function\n /// @param _amount The amount of wKP3R the user deposited\n event wKP3RDeposited(address _wKP3R, address _sender, uint256 _amount);\n\n /// @notice Emitted when Keep3rEscrow#mint function is called\n /// @param _wKP3R The addess of the wrapped KP3R token\n /// @param _recipient The address that will received the newly minted wKP3R\n /// @param _amount The amount of wKP3R minted to the recipient\n event wKP3RMinted(address _wKP3R, address _recipient, uint256 _amount);\n\n /// @notice Emitted when Keep3rEscrow#setWKP3R function is called\n /// @param _newWKP3R The address of the wKP3R contract\n event wKP3RSet(address _newWKP3R);\n\n /// @notice Throws when minter attempts to withdraw more wKP3R than the escrow has in its balance\n error InsufficientBalance();\n\n /// @notice Lists the address of the wKP3R contract\n /// @return _wKP3RAddress The address of wKP3R\n function wKP3R() external view returns (address _wKP3RAddress);\n\n /// @notice Deposits wKP3R into the contract\n /// @param _amount The amount of wKP3R to deposit\n function deposit(uint256 _amount) external;\n\n /// @notice mints wKP3R to the recipient\n /// @param _amount The amount of wKP3R to mint\n function mint(uint256 _amount) external;\n\n /// @notice sets the wKP3R address\n /// @param _wKP3R the wKP3R address\n function setWKP3R(address _wKP3R) external;\n}\n" - }, - "solidity/interfaces/sidechain/IKeep3rHelperSidechain.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../IKeep3rHelper.sol';\n\n/// @title Keep3rHelperSidechain contract\n/// @notice Contains all the helper functions for sidechain keep3r implementations\ninterface IKeep3rHelperSidechain is IKeep3rHelper {\n // Events\n\n /// @notice The oracle for a liquidity has been saved\n /// @param _liquidity The address of the given liquidity\n /// @param _oraclePool The address of the oracle pool\n event OracleSet(address _liquidity, address _oraclePool);\n\n /// @notice Emitted when the WETH USD pool is changed\n /// @param _address Address of the new WETH USD pool\n /// @param _isWETHToken0 True if calling the token0 method of the pool returns the WETH token address\n event WethUSDPoolChange(address _address, bool _isWETHToken0);\n\n /// Variables\n\n /// @notice Ethereum mainnet WETH address used for quoting references\n /// @return _weth Address of WETH token\n // solhint-disable func-name-mixedcase\n function WETH() external view returns (address _weth);\n\n /// @return _oracle The address of the observable pool for given liquidity\n function oracle(address _liquidity) external view returns (address _oracle);\n\n /// @notice WETH-USD pool that is being used as oracle\n /// @return poolAddress Address of the pool\n /// @return isTKNToken0 True if calling the token0 method of the pool returns the WETH token address\n function wethUSDPool() external view returns (address poolAddress, bool isTKNToken0);\n\n /// @notice Quotes USD to ETH\n /// @dev Used to know how much ETH should be paid to keepers before converting it from ETH to KP3R\n /// @param _usd The amount of USD to quote to ETH\n /// @return _eth The resulting amount of ETH after quoting the USD\n function quoteUsdToEth(uint256 _usd) external returns (uint256 _eth);\n\n /// Methods\n\n /// @notice Sets an oracle for a given liquidity\n /// @param _liquidity The address of the liquidity\n /// @param _oracle The address of the pool used to quote the liquidity from\n /// @dev The oracle must contain KP3R as either token0 or token1\n function setOracle(address _liquidity, address _oracle) external;\n\n /// @notice Sets an oracle for querying WETH/USD quote\n /// @param _poolAddress The address of the pool used as oracle\n /// @dev The oracle must contain WETH as either token0 or token1\n function setWethUsdPool(address _poolAddress) external;\n}\n" - }, - "solidity/interfaces/sidechain/IKeep3rJobWorkableRated.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../peripherals/IKeep3rJobs.sol';\n\n/// @title Keep3rJobWorkableRated contract\n/// @notice Implements a quoting in USD per gas unit for Keep3r jobs\ninterface IKeep3rJobWorkableRated is IKeep3rJobs {\n /// @notice Throws when job contract calls deprecated worked(address) function\n error Deprecated();\n\n /// @notice Implemented by jobs to show that a keeper performed work and reward in stable USD quote\n /// @dev Automatically calculates the payment for the keeper and pays the keeper with bonded KP3R\n /// @param _keeper Address of the keeper that performed the work\n /// @param _usdPerGasUnit Amount of USD in wei rewarded for gas unit worked by the keeper\n function worked(address _keeper, uint256 _usdPerGasUnit) external;\n}\n" - }, - "solidity/interfaces/sidechain/IKeep3rSidechainAccountance.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\n/// @title IKeep3rSidechainAccountance interface\n/// @notice Implements a view to get the amount of credits that can be withdrawn\ninterface IKeep3rSidechainAccountance {\n /// @notice The surplus amount of wKP3Rs in escrow contract\n /// @return _virtualReserves The surplus amount of wKP3Rs in escrow contract\n function virtualReserves() external view returns (int256 _virtualReserves);\n}\n" - }, - "solidity/interfaces/peripherals/IMintable.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport './IGovernable.sol';\nimport './IBaseErrors.sol';\n\n/// @title Mintable contract\n/// @notice Manages the minter role\ninterface IMintable is IBaseErrors, IGovernable {\n // Events\n\n /// @notice Emitted when governance sets a new minter\n /// @param _minter Address of the new minter\n event MinterSet(address _minter);\n\n // Errors\n\n /// @notice Throws if the caller of the function is not the minter\n error OnlyMinter();\n\n // Variables\n\n /// @notice Stores the minter address\n /// @return _minter The minter addresss\n function minter() external view returns (address _minter);\n\n // Methods\n\n /// @notice Sets a new address to be the minter\n /// @param _minter The address set as the minter\n function setMinter(address _minter) external;\n}\n" - }, - "solidity/for-test/testnet/Keep3rSidechainForTestnet.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../../contracts/sidechain/Keep3rSidechain.sol';\n\ncontract Keep3rSidechainForTestnet is Keep3rSidechain {\n constructor(\n address _governance,\n address _keep3rHelper,\n address _keep3rV1,\n address _keep3rV1Proxy\n ) Keep3rSidechain(_governance, _keep3rHelper, _keep3rV1, _keep3rV1Proxy) {\n bondTime = 0; // allows keepers to instantly register\n unbondTime = 0; // allows keepers & jobOwners to instantly withdraw funds\n liquidityMinimum = 1; // allows job providers to add low liquidity\n rewardPeriodTime = 1 days; // reduces twap calculation period\n inflationPeriod = 5 days; // increases credit minting\n }\n}\n" - }, - "solidity/for-test/Keep3rSidechainForTest.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../contracts/sidechain/Keep3rSidechain.sol';\n\ncontract Keep3rSidechainForTest is Keep3rSidechain {\n using EnumerableSet for EnumerableSet.AddressSet;\n\n constructor(\n address _governance,\n address _keep3rHelper,\n address _wrappedKP3R,\n address _keep3rEscrow\n ) Keep3rSidechain(_governance, _keep3rHelper, _wrappedKP3R, _keep3rEscrow) {}\n\n function setJobLiquidity(address _job, address _liquidity) external {\n _jobLiquidities[_job].add(_liquidity);\n }\n}\n" - }, - "solidity/for-test/JobRatedForTest.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../interfaces/IKeep3r.sol';\nimport '../interfaces/sidechain/IKeep3rJobWorkableRated.sol';\n\ncontract JobRatedForTest {\n error InvalidKeeper();\n address public keep3r;\n uint256 public nonce;\n uint256 public usdPerGasUnit = 1;\n\n constructor(address _keep3r) {\n keep3r = _keep3r;\n }\n\n function work() external {\n if (!IKeep3r(keep3r).isKeeper(msg.sender)) revert InvalidKeeper();\n\n for (uint256 i = 0; i < 1000; i++) {\n nonce++;\n }\n\n IKeep3rJobWorkableRated(keep3r).worked(msg.sender, usdPerGasUnit);\n }\n\n function workHard(uint256 _factor) external {\n if (!IKeep3r(keep3r).isKeeper(msg.sender)) revert InvalidKeeper();\n\n for (uint256 i = 0; i < 1000 * _factor; i++) {\n nonce++;\n }\n\n IKeep3rJobWorkableRated(keep3r).worked(msg.sender, usdPerGasUnit);\n }\n}\n" - }, - "solidity/for-test/JobForTest.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../interfaces/IKeep3r.sol';\n\ncontract JobForTest {\n error InvalidKeeper();\n address public keep3r;\n uint256 public nonce;\n\n constructor(address _keep3r) {\n keep3r = _keep3r;\n }\n\n function work() external {\n if (!IKeep3r(keep3r).isKeeper(msg.sender)) revert InvalidKeeper();\n\n for (uint256 i; i < 1000; i++) {\n nonce++;\n }\n\n IKeep3r(keep3r).worked(msg.sender);\n }\n\n function workHard(uint256 _factor) external {\n if (!IKeep3r(keep3r).isKeeper(msg.sender)) revert InvalidKeeper();\n\n for (uint256 i; i < 1000 * _factor; i++) {\n nonce++;\n }\n\n IKeep3r(keep3r).worked(msg.sender);\n }\n}\n" - }, - "solidity/for-test/BasicJob.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../interfaces/IKeep3r.sol';\n\ncontract BasicJob {\n error KeeperNotValid();\n\n address public keep3r;\n uint256 public nonce;\n uint256[] public array;\n\n constructor(address _keep3r) {\n keep3r = _keep3r;\n }\n\n function work() external upkeep {}\n\n function workHard(uint256 _howHard) external upkeep {\n for (uint256 i = nonce; i < _howHard; i++) {\n nonce++;\n }\n }\n\n function workRefund(uint256 _howHard) external upkeep {\n for (uint256 i; i < _howHard; i++) {\n array.push(i);\n }\n\n while (array.length > 0) {\n array.pop();\n }\n }\n\n modifier upkeep() {\n if (!IKeep3r(keep3r).isKeeper(msg.sender)) revert KeeperNotValid();\n _;\n IKeep3r(keep3r).worked(msg.sender);\n }\n}\n" - }, - "solidity/contracts/Keep3rHelperParameters.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.7 <0.9.0;\n\nimport './libraries/FullMath.sol';\nimport './libraries/TickMath.sol';\nimport '../interfaces/peripherals/IBaseErrors.sol';\nimport '../interfaces/IKeep3r.sol';\nimport '../interfaces/external/IKeep3rV1.sol';\nimport '../interfaces/IKeep3rHelperParameters.sol';\nimport './peripherals/Governable.sol';\nimport './Keep3rHelperParameters.sol';\n\nimport '@openzeppelin/contracts/utils/math/Math.sol';\nimport '@uniswap/v3-core/contracts/interfaces/IUniswapV3Pool.sol';\n\ncontract Keep3rHelperParameters is IKeep3rHelperParameters, IBaseErrors, Governable {\n /// @inheritdoc IKeep3rHelperParameters\n address public immutable override KP3R;\n\n /// @inheritdoc IKeep3rHelperParameters\n uint256 public constant override BOOST_BASE = 10_000;\n\n /// @inheritdoc IKeep3rHelperParameters\n uint256 public override minBoost = 11_000;\n\n /// @inheritdoc IKeep3rHelperParameters\n uint256 public override maxBoost = 12_000;\n\n /// @inheritdoc IKeep3rHelperParameters\n uint256 public override targetBond = 200 ether;\n\n /// @inheritdoc IKeep3rHelperParameters\n uint256 public override workExtraGas = 34_000;\n\n /// @inheritdoc IKeep3rHelperParameters\n uint32 public override quoteTwapTime = 10 minutes;\n\n /// @inheritdoc IKeep3rHelperParameters\n uint256 public override minBaseFee = 15e9;\n\n /// @inheritdoc IKeep3rHelperParameters\n uint256 public override minPriorityFee = 2e9;\n\n /// @inheritdoc IKeep3rHelperParameters\n address public override keep3rV2;\n\n /// @inheritdoc IKeep3rHelperParameters\n IKeep3rHelperParameters.TokenOraclePool public override kp3rWethPool;\n\n constructor(\n address _kp3r,\n address _keep3rV2,\n address _governance,\n address _kp3rWethPool\n ) Governable(_governance) {\n KP3R = _kp3r;\n keep3rV2 = _keep3rV2;\n\n // Immutable variables [KP3R] cannot be read during contract creation time [_setKp3rWethPool]\n kp3rWethPool = _validateOraclePool(_kp3rWethPool, _kp3r);\n emit Kp3rWethPoolChange(kp3rWethPool.poolAddress, kp3rWethPool.isTKNToken0);\n }\n\n /// @inheritdoc IKeep3rHelperParameters\n function setKp3rWethPool(address _poolAddress) external override onlyGovernance {\n if (_poolAddress == address(0)) revert ZeroAddress();\n _setKp3rWethPool(_poolAddress);\n }\n\n /// @inheritdoc IKeep3rHelperParameters\n function setMinBoost(uint256 _minBoost) external override onlyGovernance {\n minBoost = _minBoost;\n emit MinBoostChange(minBoost);\n }\n\n /// @inheritdoc IKeep3rHelperParameters\n function setMaxBoost(uint256 _maxBoost) external override onlyGovernance {\n maxBoost = _maxBoost;\n emit MaxBoostChange(maxBoost);\n }\n\n /// @inheritdoc IKeep3rHelperParameters\n function setTargetBond(uint256 _targetBond) external override onlyGovernance {\n targetBond = _targetBond;\n emit TargetBondChange(targetBond);\n }\n\n /// @inheritdoc IKeep3rHelperParameters\n function setKeep3rV2(address _keep3rV2) external override onlyGovernance {\n if (_keep3rV2 == address(0)) revert ZeroAddress();\n keep3rV2 = _keep3rV2;\n emit Keep3rV2Change(keep3rV2);\n }\n\n /// @inheritdoc IKeep3rHelperParameters\n function setWorkExtraGas(uint256 _workExtraGas) external override onlyGovernance {\n workExtraGas = _workExtraGas;\n emit WorkExtraGasChange(workExtraGas);\n }\n\n /// @inheritdoc IKeep3rHelperParameters\n function setQuoteTwapTime(uint32 _quoteTwapTime) external override onlyGovernance {\n _setQuoteTwapTime(_quoteTwapTime);\n }\n\n function _setQuoteTwapTime(uint32 _quoteTwapTime) internal {\n quoteTwapTime = _quoteTwapTime;\n emit QuoteTwapTimeChange(quoteTwapTime);\n }\n\n /// @inheritdoc IKeep3rHelperParameters\n function setMinBaseFee(uint256 _minBaseFee) external override onlyGovernance {\n minBaseFee = _minBaseFee;\n emit MinBaseFeeChange(minBaseFee);\n }\n\n /// @inheritdoc IKeep3rHelperParameters\n function setMinPriorityFee(uint256 _minPriorityFee) external override onlyGovernance {\n minPriorityFee = _minPriorityFee;\n emit MinPriorityFeeChange(minPriorityFee);\n }\n\n /// @notice Sets KP3R-WETH pool\n /// @param _poolAddress The address of the KP3R-WETH pool\n function _setKp3rWethPool(address _poolAddress) internal {\n kp3rWethPool = _validateOraclePool(_poolAddress, KP3R);\n emit Kp3rWethPoolChange(kp3rWethPool.poolAddress, kp3rWethPool.isTKNToken0);\n }\n\n function _validateOraclePool(address _poolAddress, address _token) internal view virtual returns (TokenOraclePool memory _oraclePool) {\n bool _isTKNToken0 = IUniswapV3Pool(_poolAddress).token0() == _token;\n\n if (!_isTKNToken0 && IUniswapV3Pool(_poolAddress).token1() != _token) revert InvalidOraclePool();\n\n return TokenOraclePool(_poolAddress, _isTKNToken0);\n }\n}\n" - }, - "solidity/contracts/libraries/TickMath.sol": { - "content": "// SPDX-License-Identifier: GPL-2.0-or-later\npragma solidity >=0.5.0;\n\n// solhint-disable\n\n/// @title Math library for computing sqrt prices from ticks and vice versa\n/// @notice Computes sqrt price for ticks of size 1.0001, i.e. sqrt(1.0001^tick) as fixed point Q64.96 numbers. Supports\n/// prices between 2**-128 and 2**128\nlibrary TickMath {\n /// @dev The minimum tick that may be passed to #getSqrtRatioAtTick computed from log base 1.0001 of 2**-128\n int24 internal constant MIN_TICK = -887272;\n /// @dev The maximum tick that may be passed to #getSqrtRatioAtTick computed from log base 1.0001 of 2**128\n int24 internal constant MAX_TICK = -MIN_TICK;\n\n /// @dev The minimum value that can be returned from #getSqrtRatioAtTick. Equivalent to getSqrtRatioAtTick(MIN_TICK)\n uint160 internal constant MIN_SQRT_RATIO = 4295128739;\n /// @dev The maximum value that can be returned from #getSqrtRatioAtTick. Equivalent to getSqrtRatioAtTick(MAX_TICK)\n uint160 internal constant MAX_SQRT_RATIO = 1461446703485210103287273052203988822378723970342;\n\n /// @notice Calculates sqrt(1.0001^tick) * 2^96\n /// @dev Throws if |tick| > max tick\n /// @param tick The input tick for the above formula\n /// @return sqrtPriceX96 A Fixed point Q64.96 number representing the sqrt of the ratio of the two assets (token1/token0)\n /// at the given tick\n function getSqrtRatioAtTick(int24 tick) internal pure returns (uint160 sqrtPriceX96) {\n uint256 absTick = tick < 0 ? uint256(-int256(tick)) : uint256(int256(tick));\n require(absTick <= uint256(int256(MAX_TICK)), 'T');\n\n uint256 ratio = absTick & 0x1 != 0 ? 0xfffcb933bd6fad37aa2d162d1a594001 : 0x100000000000000000000000000000000;\n if (absTick & 0x2 != 0) ratio = (ratio * 0xfff97272373d413259a46990580e213a) >> 128;\n if (absTick & 0x4 != 0) ratio = (ratio * 0xfff2e50f5f656932ef12357cf3c7fdcc) >> 128;\n if (absTick & 0x8 != 0) ratio = (ratio * 0xffe5caca7e10e4e61c3624eaa0941cd0) >> 128;\n if (absTick & 0x10 != 0) ratio = (ratio * 0xffcb9843d60f6159c9db58835c926644) >> 128;\n if (absTick & 0x20 != 0) ratio = (ratio * 0xff973b41fa98c081472e6896dfb254c0) >> 128;\n if (absTick & 0x40 != 0) ratio = (ratio * 0xff2ea16466c96a3843ec78b326b52861) >> 128;\n if (absTick & 0x80 != 0) ratio = (ratio * 0xfe5dee046a99a2a811c461f1969c3053) >> 128;\n if (absTick & 0x100 != 0) ratio = (ratio * 0xfcbe86c7900a88aedcffc83b479aa3a4) >> 128;\n if (absTick & 0x200 != 0) ratio = (ratio * 0xf987a7253ac413176f2b074cf7815e54) >> 128;\n if (absTick & 0x400 != 0) ratio = (ratio * 0xf3392b0822b70005940c7a398e4b70f3) >> 128;\n if (absTick & 0x800 != 0) ratio = (ratio * 0xe7159475a2c29b7443b29c7fa6e889d9) >> 128;\n if (absTick & 0x1000 != 0) ratio = (ratio * 0xd097f3bdfd2022b8845ad8f792aa5825) >> 128;\n if (absTick & 0x2000 != 0) ratio = (ratio * 0xa9f746462d870fdf8a65dc1f90e061e5) >> 128;\n if (absTick & 0x4000 != 0) ratio = (ratio * 0x70d869a156d2a1b890bb3df62baf32f7) >> 128;\n if (absTick & 0x8000 != 0) ratio = (ratio * 0x31be135f97d08fd981231505542fcfa6) >> 128;\n if (absTick & 0x10000 != 0) ratio = (ratio * 0x9aa508b5b7a84e1c677de54f3e99bc9) >> 128;\n if (absTick & 0x20000 != 0) ratio = (ratio * 0x5d6af8dedb81196699c329225ee604) >> 128;\n if (absTick & 0x40000 != 0) ratio = (ratio * 0x2216e584f5fa1ea926041bedfe98) >> 128;\n if (absTick & 0x80000 != 0) ratio = (ratio * 0x48a170391f7dc42444e8fa2) >> 128;\n\n if (tick > 0) ratio = type(uint256).max / ratio;\n\n // Divides by 1<<32 rounding up to go from a Q128.128 to a Q128.96.\n // we then downcast because we know the result always fits within 160 bits due to our tick input constraint\n // we round up in the division so getTickAtSqrtRatio of the output price is always consistent\n sqrtPriceX96 = uint160((ratio >> 32) + (ratio % (1 << 32) == 0 ? 0 : 1));\n }\n\n /// @notice Calculates the greatest tick value such that getRatioAtTick(tick) <= ratio\n /// @dev Throws in case sqrtPriceX96 < MIN_SQRT_RATIO, as MIN_SQRT_RATIO is the lowest value getRatioAtTick may ever return.\n /// @param sqrtPriceX96 The sqrt ratio for which to compute the tick as a Q64.96\n /// @return tick The greatest tick for which the ratio is less than or equal to the input ratio\n function getTickAtSqrtRatio(uint160 sqrtPriceX96) internal pure returns (int24 tick) {\n // Second inequality must be < because the price can never reach the price at the max tick\n require(sqrtPriceX96 >= MIN_SQRT_RATIO && sqrtPriceX96 < MAX_SQRT_RATIO, 'R');\n uint256 ratio = uint256(sqrtPriceX96) << 32;\n\n uint256 r = ratio;\n uint256 msb = 0;\n\n assembly {\n let f := shl(7, gt(r, 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF))\n msb := or(msb, f)\n r := shr(f, r)\n }\n assembly {\n let f := shl(6, gt(r, 0xFFFFFFFFFFFFFFFF))\n msb := or(msb, f)\n r := shr(f, r)\n }\n assembly {\n let f := shl(5, gt(r, 0xFFFFFFFF))\n msb := or(msb, f)\n r := shr(f, r)\n }\n assembly {\n let f := shl(4, gt(r, 0xFFFF))\n msb := or(msb, f)\n r := shr(f, r)\n }\n assembly {\n let f := shl(3, gt(r, 0xFF))\n msb := or(msb, f)\n r := shr(f, r)\n }\n assembly {\n let f := shl(2, gt(r, 0xF))\n msb := or(msb, f)\n r := shr(f, r)\n }\n assembly {\n let f := shl(1, gt(r, 0x3))\n msb := or(msb, f)\n r := shr(f, r)\n }\n assembly {\n let f := gt(r, 0x1)\n msb := or(msb, f)\n }\n\n if (msb >= 128) r = ratio >> (msb - 127);\n else r = ratio << (127 - msb);\n\n int256 log_2 = (int256(msb) - 128) << 64;\n\n assembly {\n r := shr(127, mul(r, r))\n let f := shr(128, r)\n log_2 := or(log_2, shl(63, f))\n r := shr(f, r)\n }\n assembly {\n r := shr(127, mul(r, r))\n let f := shr(128, r)\n log_2 := or(log_2, shl(62, f))\n r := shr(f, r)\n }\n assembly {\n r := shr(127, mul(r, r))\n let f := shr(128, r)\n log_2 := or(log_2, shl(61, f))\n r := shr(f, r)\n }\n assembly {\n r := shr(127, mul(r, r))\n let f := shr(128, r)\n log_2 := or(log_2, shl(60, f))\n r := shr(f, r)\n }\n assembly {\n r := shr(127, mul(r, r))\n let f := shr(128, r)\n log_2 := or(log_2, shl(59, f))\n r := shr(f, r)\n }\n assembly {\n r := shr(127, mul(r, r))\n let f := shr(128, r)\n log_2 := or(log_2, shl(58, f))\n r := shr(f, r)\n }\n assembly {\n r := shr(127, mul(r, r))\n let f := shr(128, r)\n log_2 := or(log_2, shl(57, f))\n r := shr(f, r)\n }\n assembly {\n r := shr(127, mul(r, r))\n let f := shr(128, r)\n log_2 := or(log_2, shl(56, f))\n r := shr(f, r)\n }\n assembly {\n r := shr(127, mul(r, r))\n let f := shr(128, r)\n log_2 := or(log_2, shl(55, f))\n r := shr(f, r)\n }\n assembly {\n r := shr(127, mul(r, r))\n let f := shr(128, r)\n log_2 := or(log_2, shl(54, f))\n r := shr(f, r)\n }\n assembly {\n r := shr(127, mul(r, r))\n let f := shr(128, r)\n log_2 := or(log_2, shl(53, f))\n r := shr(f, r)\n }\n assembly {\n r := shr(127, mul(r, r))\n let f := shr(128, r)\n log_2 := or(log_2, shl(52, f))\n r := shr(f, r)\n }\n assembly {\n r := shr(127, mul(r, r))\n let f := shr(128, r)\n log_2 := or(log_2, shl(51, f))\n r := shr(f, r)\n }\n assembly {\n r := shr(127, mul(r, r))\n let f := shr(128, r)\n log_2 := or(log_2, shl(50, f))\n }\n\n int256 log_sqrt10001 = log_2 * 255738958999603826347141; // 128.128 number\n\n int24 tickLow = int24((log_sqrt10001 - 3402992956809132418596140100660247210) >> 128);\n int24 tickHi = int24((log_sqrt10001 + 291339464771989622907027621153398088495) >> 128);\n\n tick = tickLow == tickHi ? tickLow : getSqrtRatioAtTick(tickHi) <= sqrtPriceX96 ? tickHi : tickLow;\n }\n}\n" - }, - "@uniswap/v3-core/contracts/interfaces/IUniswapV3Pool.sol": { - "content": "// SPDX-License-Identifier: GPL-2.0-or-later\npragma solidity >=0.5.0;\n\nimport './pool/IUniswapV3PoolImmutables.sol';\nimport './pool/IUniswapV3PoolState.sol';\nimport './pool/IUniswapV3PoolDerivedState.sol';\nimport './pool/IUniswapV3PoolActions.sol';\nimport './pool/IUniswapV3PoolOwnerActions.sol';\nimport './pool/IUniswapV3PoolEvents.sol';\n\n/// @title The interface for a Uniswap V3 Pool\n/// @notice A Uniswap pool facilitates swapping and automated market making between any two assets that strictly conform\n/// to the ERC20 specification\n/// @dev The pool interface is broken up into many smaller pieces\ninterface IUniswapV3Pool is\n IUniswapV3PoolImmutables,\n IUniswapV3PoolState,\n IUniswapV3PoolDerivedState,\n IUniswapV3PoolActions,\n IUniswapV3PoolOwnerActions,\n IUniswapV3PoolEvents\n{\n\n}\n" - }, - "@uniswap/v3-core/contracts/interfaces/pool/IUniswapV3PoolImmutables.sol": { - "content": "// SPDX-License-Identifier: GPL-2.0-or-later\npragma solidity >=0.5.0;\n\n/// @title Pool state that never changes\n/// @notice These parameters are fixed for a pool forever, i.e., the methods will always return the same values\ninterface IUniswapV3PoolImmutables {\n /// @notice The contract that deployed the pool, which must adhere to the IUniswapV3Factory interface\n /// @return The contract address\n function factory() external view returns (address);\n\n /// @notice The first of the two tokens of the pool, sorted by address\n /// @return The token contract address\n function token0() external view returns (address);\n\n /// @notice The second of the two tokens of the pool, sorted by address\n /// @return The token contract address\n function token1() external view returns (address);\n\n /// @notice The pool's fee in hundredths of a bip, i.e. 1e-6\n /// @return The fee\n function fee() external view returns (uint24);\n\n /// @notice The pool tick spacing\n /// @dev Ticks can only be used at multiples of this value, minimum of 1 and always positive\n /// e.g.: a tickSpacing of 3 means ticks can be initialized every 3rd tick, i.e., ..., -6, -3, 0, 3, 6, ...\n /// This value is an int24 to avoid casting even though it is always positive.\n /// @return The tick spacing\n function tickSpacing() external view returns (int24);\n\n /// @notice The maximum amount of position liquidity that can use any tick in the range\n /// @dev This parameter is enforced per tick to prevent liquidity from overflowing a uint128 at any point, and\n /// also prevents out-of-range liquidity from being used to prevent adding in-range liquidity to a pool\n /// @return The max amount of liquidity per tick\n function maxLiquidityPerTick() external view returns (uint128);\n}\n" - }, - "@uniswap/v3-core/contracts/interfaces/pool/IUniswapV3PoolState.sol": { - "content": "// SPDX-License-Identifier: GPL-2.0-or-later\npragma solidity >=0.5.0;\n\n/// @title Pool state that can change\n/// @notice These methods compose the pool's state, and can change with any frequency including multiple times\n/// per transaction\ninterface IUniswapV3PoolState {\n /// @notice The 0th storage slot in the pool stores many values, and is exposed as a single method to save gas\n /// when accessed externally.\n /// @return sqrtPriceX96 The current price of the pool as a sqrt(token1/token0) Q64.96 value\n /// tick The current tick of the pool, i.e. according to the last tick transition that was run.\n /// This value may not always be equal to SqrtTickMath.getTickAtSqrtRatio(sqrtPriceX96) if the price is on a tick\n /// boundary.\n /// observationIndex The index of the last oracle observation that was written,\n /// observationCardinality The current maximum number of observations stored in the pool,\n /// observationCardinalityNext The next maximum number of observations, to be updated when the observation.\n /// feeProtocol The protocol fee for both tokens of the pool.\n /// Encoded as two 4 bit values, where the protocol fee of token1 is shifted 4 bits and the protocol fee of token0\n /// is the lower 4 bits. Used as the denominator of a fraction of the swap fee, e.g. 4 means 1/4th of the swap fee.\n /// unlocked Whether the pool is currently locked to reentrancy\n function slot0()\n external\n view\n returns (\n uint160 sqrtPriceX96,\n int24 tick,\n uint16 observationIndex,\n uint16 observationCardinality,\n uint16 observationCardinalityNext,\n uint8 feeProtocol,\n bool unlocked\n );\n\n /// @notice The fee growth as a Q128.128 fees of token0 collected per unit of liquidity for the entire life of the pool\n /// @dev This value can overflow the uint256\n function feeGrowthGlobal0X128() external view returns (uint256);\n\n /// @notice The fee growth as a Q128.128 fees of token1 collected per unit of liquidity for the entire life of the pool\n /// @dev This value can overflow the uint256\n function feeGrowthGlobal1X128() external view returns (uint256);\n\n /// @notice The amounts of token0 and token1 that are owed to the protocol\n /// @dev Protocol fees will never exceed uint128 max in either token\n function protocolFees() external view returns (uint128 token0, uint128 token1);\n\n /// @notice The currently in range liquidity available to the pool\n /// @dev This value has no relationship to the total liquidity across all ticks\n function liquidity() external view returns (uint128);\n\n /// @notice Look up information about a specific tick in the pool\n /// @param tick The tick to look up\n /// @return liquidityGross the total amount of position liquidity that uses the pool either as tick lower or\n /// tick upper,\n /// liquidityNet how much liquidity changes when the pool price crosses the tick,\n /// feeGrowthOutside0X128 the fee growth on the other side of the tick from the current tick in token0,\n /// feeGrowthOutside1X128 the fee growth on the other side of the tick from the current tick in token1,\n /// tickCumulativeOutside the cumulative tick value on the other side of the tick from the current tick\n /// secondsPerLiquidityOutsideX128 the seconds spent per liquidity on the other side of the tick from the current tick,\n /// secondsOutside the seconds spent on the other side of the tick from the current tick,\n /// initialized Set to true if the tick is initialized, i.e. liquidityGross is greater than 0, otherwise equal to false.\n /// Outside values can only be used if the tick is initialized, i.e. if liquidityGross is greater than 0.\n /// In addition, these values are only relative and must be used only in comparison to previous snapshots for\n /// a specific position.\n function ticks(int24 tick)\n external\n view\n returns (\n uint128 liquidityGross,\n int128 liquidityNet,\n uint256 feeGrowthOutside0X128,\n uint256 feeGrowthOutside1X128,\n int56 tickCumulativeOutside,\n uint160 secondsPerLiquidityOutsideX128,\n uint32 secondsOutside,\n bool initialized\n );\n\n /// @notice Returns 256 packed tick initialized boolean values. See TickBitmap for more information\n function tickBitmap(int16 wordPosition) external view returns (uint256);\n\n /// @notice Returns the information about a position by the position's key\n /// @param key The position's key is a hash of a preimage composed by the owner, tickLower and tickUpper\n /// @return _liquidity The amount of liquidity in the position,\n /// Returns feeGrowthInside0LastX128 fee growth of token0 inside the tick range as of the last mint/burn/poke,\n /// Returns feeGrowthInside1LastX128 fee growth of token1 inside the tick range as of the last mint/burn/poke,\n /// Returns tokensOwed0 the computed amount of token0 owed to the position as of the last mint/burn/poke,\n /// Returns tokensOwed1 the computed amount of token1 owed to the position as of the last mint/burn/poke\n function positions(bytes32 key)\n external\n view\n returns (\n uint128 _liquidity,\n uint256 feeGrowthInside0LastX128,\n uint256 feeGrowthInside1LastX128,\n uint128 tokensOwed0,\n uint128 tokensOwed1\n );\n\n /// @notice Returns data about a specific observation index\n /// @param index The element of the observations array to fetch\n /// @dev You most likely want to use #observe() instead of this method to get an observation as of some amount of time\n /// ago, rather than at a specific index in the array.\n /// @return blockTimestamp The timestamp of the observation,\n /// Returns tickCumulative the tick multiplied by seconds elapsed for the life of the pool as of the observation timestamp,\n /// Returns secondsPerLiquidityCumulativeX128 the seconds per in range liquidity for the life of the pool as of the observation timestamp,\n /// Returns initialized whether the observation has been initialized and the values are safe to use\n function observations(uint256 index)\n external\n view\n returns (\n uint32 blockTimestamp,\n int56 tickCumulative,\n uint160 secondsPerLiquidityCumulativeX128,\n bool initialized\n );\n}\n" - }, - "@uniswap/v3-core/contracts/interfaces/pool/IUniswapV3PoolDerivedState.sol": { - "content": "// SPDX-License-Identifier: GPL-2.0-or-later\npragma solidity >=0.5.0;\n\n/// @title Pool state that is not stored\n/// @notice Contains view functions to provide information about the pool that is computed rather than stored on the\n/// blockchain. The functions here may have variable gas costs.\ninterface IUniswapV3PoolDerivedState {\n /// @notice Returns the cumulative tick and liquidity as of each timestamp `secondsAgo` from the current block timestamp\n /// @dev To get a time weighted average tick or liquidity-in-range, you must call this with two values, one representing\n /// the beginning of the period and another for the end of the period. E.g., to get the last hour time-weighted average tick,\n /// you must call it with secondsAgos = [3600, 0].\n /// @dev The time weighted average tick represents the geometric time weighted average price of the pool, in\n /// log base sqrt(1.0001) of token1 / token0. The TickMath library can be used to go from a tick value to a ratio.\n /// @param secondsAgos From how long ago each cumulative tick and liquidity value should be returned\n /// @return tickCumulatives Cumulative tick values as of each `secondsAgos` from the current block timestamp\n /// @return secondsPerLiquidityCumulativeX128s Cumulative seconds per liquidity-in-range value as of each `secondsAgos` from the current block\n /// timestamp\n function observe(uint32[] calldata secondsAgos)\n external\n view\n returns (int56[] memory tickCumulatives, uint160[] memory secondsPerLiquidityCumulativeX128s);\n\n /// @notice Returns a snapshot of the tick cumulative, seconds per liquidity and seconds inside a tick range\n /// @dev Snapshots must only be compared to other snapshots, taken over a period for which a position existed.\n /// I.e., snapshots cannot be compared if a position is not held for the entire period between when the first\n /// snapshot is taken and the second snapshot is taken.\n /// @param tickLower The lower tick of the range\n /// @param tickUpper The upper tick of the range\n /// @return tickCumulativeInside The snapshot of the tick accumulator for the range\n /// @return secondsPerLiquidityInsideX128 The snapshot of seconds per liquidity for the range\n /// @return secondsInside The snapshot of seconds per liquidity for the range\n function snapshotCumulativesInside(int24 tickLower, int24 tickUpper)\n external\n view\n returns (\n int56 tickCumulativeInside,\n uint160 secondsPerLiquidityInsideX128,\n uint32 secondsInside\n );\n}\n" - }, - "@uniswap/v3-core/contracts/interfaces/pool/IUniswapV3PoolActions.sol": { - "content": "// SPDX-License-Identifier: GPL-2.0-or-later\npragma solidity >=0.5.0;\n\n/// @title Permissionless pool actions\n/// @notice Contains pool methods that can be called by anyone\ninterface IUniswapV3PoolActions {\n /// @notice Sets the initial price for the pool\n /// @dev Price is represented as a sqrt(amountToken1/amountToken0) Q64.96 value\n /// @param sqrtPriceX96 the initial sqrt price of the pool as a Q64.96\n function initialize(uint160 sqrtPriceX96) external;\n\n /// @notice Adds liquidity for the given recipient/tickLower/tickUpper position\n /// @dev The caller of this method receives a callback in the form of IUniswapV3MintCallback#uniswapV3MintCallback\n /// in which they must pay any token0 or token1 owed for the liquidity. The amount of token0/token1 due depends\n /// on tickLower, tickUpper, the amount of liquidity, and the current price.\n /// @param recipient The address for which the liquidity will be created\n /// @param tickLower The lower tick of the position in which to add liquidity\n /// @param tickUpper The upper tick of the position in which to add liquidity\n /// @param amount The amount of liquidity to mint\n /// @param data Any data that should be passed through to the callback\n /// @return amount0 The amount of token0 that was paid to mint the given amount of liquidity. Matches the value in the callback\n /// @return amount1 The amount of token1 that was paid to mint the given amount of liquidity. Matches the value in the callback\n function mint(\n address recipient,\n int24 tickLower,\n int24 tickUpper,\n uint128 amount,\n bytes calldata data\n ) external returns (uint256 amount0, uint256 amount1);\n\n /// @notice Collects tokens owed to a position\n /// @dev Does not recompute fees earned, which must be done either via mint or burn of any amount of liquidity.\n /// Collect must be called by the position owner. To withdraw only token0 or only token1, amount0Requested or\n /// amount1Requested may be set to zero. To withdraw all tokens owed, caller may pass any value greater than the\n /// actual tokens owed, e.g. type(uint128).max. Tokens owed may be from accumulated swap fees or burned liquidity.\n /// @param recipient The address which should receive the fees collected\n /// @param tickLower The lower tick of the position for which to collect fees\n /// @param tickUpper The upper tick of the position for which to collect fees\n /// @param amount0Requested How much token0 should be withdrawn from the fees owed\n /// @param amount1Requested How much token1 should be withdrawn from the fees owed\n /// @return amount0 The amount of fees collected in token0\n /// @return amount1 The amount of fees collected in token1\n function collect(\n address recipient,\n int24 tickLower,\n int24 tickUpper,\n uint128 amount0Requested,\n uint128 amount1Requested\n ) external returns (uint128 amount0, uint128 amount1);\n\n /// @notice Burn liquidity from the sender and account tokens owed for the liquidity to the position\n /// @dev Can be used to trigger a recalculation of fees owed to a position by calling with an amount of 0\n /// @dev Fees must be collected separately via a call to #collect\n /// @param tickLower The lower tick of the position for which to burn liquidity\n /// @param tickUpper The upper tick of the position for which to burn liquidity\n /// @param amount How much liquidity to burn\n /// @return amount0 The amount of token0 sent to the recipient\n /// @return amount1 The amount of token1 sent to the recipient\n function burn(\n int24 tickLower,\n int24 tickUpper,\n uint128 amount\n ) external returns (uint256 amount0, uint256 amount1);\n\n /// @notice Swap token0 for token1, or token1 for token0\n /// @dev The caller of this method receives a callback in the form of IUniswapV3SwapCallback#uniswapV3SwapCallback\n /// @param recipient The address to receive the output of the swap\n /// @param zeroForOne The direction of the swap, true for token0 to token1, false for token1 to token0\n /// @param amountSpecified The amount of the swap, which implicitly configures the swap as exact input (positive), or exact output (negative)\n /// @param sqrtPriceLimitX96 The Q64.96 sqrt price limit. If zero for one, the price cannot be less than this\n /// value after the swap. If one for zero, the price cannot be greater than this value after the swap\n /// @param data Any data to be passed through to the callback\n /// @return amount0 The delta of the balance of token0 of the pool, exact when negative, minimum when positive\n /// @return amount1 The delta of the balance of token1 of the pool, exact when negative, minimum when positive\n function swap(\n address recipient,\n bool zeroForOne,\n int256 amountSpecified,\n uint160 sqrtPriceLimitX96,\n bytes calldata data\n ) external returns (int256 amount0, int256 amount1);\n\n /// @notice Receive token0 and/or token1 and pay it back, plus a fee, in the callback\n /// @dev The caller of this method receives a callback in the form of IUniswapV3FlashCallback#uniswapV3FlashCallback\n /// @dev Can be used to donate underlying tokens pro-rata to currently in-range liquidity providers by calling\n /// with 0 amount{0,1} and sending the donation amount(s) from the callback\n /// @param recipient The address which will receive the token0 and token1 amounts\n /// @param amount0 The amount of token0 to send\n /// @param amount1 The amount of token1 to send\n /// @param data Any data to be passed through to the callback\n function flash(\n address recipient,\n uint256 amount0,\n uint256 amount1,\n bytes calldata data\n ) external;\n\n /// @notice Increase the maximum number of price and liquidity observations that this pool will store\n /// @dev This method is no-op if the pool already has an observationCardinalityNext greater than or equal to\n /// the input observationCardinalityNext.\n /// @param observationCardinalityNext The desired minimum number of observations for the pool to store\n function increaseObservationCardinalityNext(uint16 observationCardinalityNext) external;\n}\n" - }, - "@uniswap/v3-core/contracts/interfaces/pool/IUniswapV3PoolOwnerActions.sol": { - "content": "// SPDX-License-Identifier: GPL-2.0-or-later\npragma solidity >=0.5.0;\n\n/// @title Permissioned pool actions\n/// @notice Contains pool methods that may only be called by the factory owner\ninterface IUniswapV3PoolOwnerActions {\n /// @notice Set the denominator of the protocol's % share of the fees\n /// @param feeProtocol0 new protocol fee for token0 of the pool\n /// @param feeProtocol1 new protocol fee for token1 of the pool\n function setFeeProtocol(uint8 feeProtocol0, uint8 feeProtocol1) external;\n\n /// @notice Collect the protocol fee accrued to the pool\n /// @param recipient The address to which collected protocol fees should be sent\n /// @param amount0Requested The maximum amount of token0 to send, can be 0 to collect fees in only token1\n /// @param amount1Requested The maximum amount of token1 to send, can be 0 to collect fees in only token0\n /// @return amount0 The protocol fee collected in token0\n /// @return amount1 The protocol fee collected in token1\n function collectProtocol(\n address recipient,\n uint128 amount0Requested,\n uint128 amount1Requested\n ) external returns (uint128 amount0, uint128 amount1);\n}\n" - }, - "@uniswap/v3-core/contracts/interfaces/pool/IUniswapV3PoolEvents.sol": { - "content": "// SPDX-License-Identifier: GPL-2.0-or-later\npragma solidity >=0.5.0;\n\n/// @title Events emitted by a pool\n/// @notice Contains all events emitted by the pool\ninterface IUniswapV3PoolEvents {\n /// @notice Emitted exactly once by a pool when #initialize is first called on the pool\n /// @dev Mint/Burn/Swap cannot be emitted by the pool before Initialize\n /// @param sqrtPriceX96 The initial sqrt price of the pool, as a Q64.96\n /// @param tick The initial tick of the pool, i.e. log base 1.0001 of the starting price of the pool\n event Initialize(uint160 sqrtPriceX96, int24 tick);\n\n /// @notice Emitted when liquidity is minted for a given position\n /// @param sender The address that minted the liquidity\n /// @param owner The owner of the position and recipient of any minted liquidity\n /// @param tickLower The lower tick of the position\n /// @param tickUpper The upper tick of the position\n /// @param amount The amount of liquidity minted to the position range\n /// @param amount0 How much token0 was required for the minted liquidity\n /// @param amount1 How much token1 was required for the minted liquidity\n event Mint(\n address sender,\n address indexed owner,\n int24 indexed tickLower,\n int24 indexed tickUpper,\n uint128 amount,\n uint256 amount0,\n uint256 amount1\n );\n\n /// @notice Emitted when fees are collected by the owner of a position\n /// @dev Collect events may be emitted with zero amount0 and amount1 when the caller chooses not to collect fees\n /// @param owner The owner of the position for which fees are collected\n /// @param tickLower The lower tick of the position\n /// @param tickUpper The upper tick of the position\n /// @param amount0 The amount of token0 fees collected\n /// @param amount1 The amount of token1 fees collected\n event Collect(\n address indexed owner,\n address recipient,\n int24 indexed tickLower,\n int24 indexed tickUpper,\n uint128 amount0,\n uint128 amount1\n );\n\n /// @notice Emitted when a position's liquidity is removed\n /// @dev Does not withdraw any fees earned by the liquidity position, which must be withdrawn via #collect\n /// @param owner The owner of the position for which liquidity is removed\n /// @param tickLower The lower tick of the position\n /// @param tickUpper The upper tick of the position\n /// @param amount The amount of liquidity to remove\n /// @param amount0 The amount of token0 withdrawn\n /// @param amount1 The amount of token1 withdrawn\n event Burn(\n address indexed owner,\n int24 indexed tickLower,\n int24 indexed tickUpper,\n uint128 amount,\n uint256 amount0,\n uint256 amount1\n );\n\n /// @notice Emitted by the pool for any swaps between token0 and token1\n /// @param sender The address that initiated the swap call, and that received the callback\n /// @param recipient The address that received the output of the swap\n /// @param amount0 The delta of the token0 balance of the pool\n /// @param amount1 The delta of the token1 balance of the pool\n /// @param sqrtPriceX96 The sqrt(price) of the pool after the swap, as a Q64.96\n /// @param liquidity The liquidity of the pool after the swap\n /// @param tick The log base 1.0001 of price of the pool after the swap\n event Swap(\n address indexed sender,\n address indexed recipient,\n int256 amount0,\n int256 amount1,\n uint160 sqrtPriceX96,\n uint128 liquidity,\n int24 tick\n );\n\n /// @notice Emitted by the pool for any flashes of token0/token1\n /// @param sender The address that initiated the swap call, and that received the callback\n /// @param recipient The address that received the tokens from flash\n /// @param amount0 The amount of token0 that was flashed\n /// @param amount1 The amount of token1 that was flashed\n /// @param paid0 The amount of token0 paid for the flash, which can exceed the amount0 plus the fee\n /// @param paid1 The amount of token1 paid for the flash, which can exceed the amount1 plus the fee\n event Flash(\n address indexed sender,\n address indexed recipient,\n uint256 amount0,\n uint256 amount1,\n uint256 paid0,\n uint256 paid1\n );\n\n /// @notice Emitted by the pool for increases to the number of observations that can be stored\n /// @dev observationCardinalityNext is not the observation cardinality until an observation is written at the index\n /// just before a mint/swap/burn.\n /// @param observationCardinalityNextOld The previous value of the next observation cardinality\n /// @param observationCardinalityNextNew The updated value of the next observation cardinality\n event IncreaseObservationCardinalityNext(\n uint16 observationCardinalityNextOld,\n uint16 observationCardinalityNextNew\n );\n\n /// @notice Emitted when the protocol fee is changed by the pool\n /// @param feeProtocol0Old The previous value of the token0 protocol fee\n /// @param feeProtocol1Old The previous value of the token1 protocol fee\n /// @param feeProtocol0New The updated value of the token0 protocol fee\n /// @param feeProtocol1New The updated value of the token1 protocol fee\n event SetFeeProtocol(uint8 feeProtocol0Old, uint8 feeProtocol1Old, uint8 feeProtocol0New, uint8 feeProtocol1New);\n\n /// @notice Emitted when the collected protocol fees are withdrawn by the factory owner\n /// @param sender The address that collects the protocol fees\n /// @param recipient The address that receives the collected protocol fees\n /// @param amount0 The amount of token0 protocol fees that is withdrawn\n /// @param amount0 The amount of token1 protocol fees that is withdrawn\n event CollectProtocol(address indexed sender, address indexed recipient, uint128 amount0, uint128 amount1);\n}\n" - }, - "solidity/for-test/UniV3PairManagerForTest.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '@openzeppelin/contracts/token/ERC20/ERC20.sol';\nimport '@uniswap/v3-core/contracts/interfaces/IUniswapV3Pool.sol';\n\nimport '../contracts/libraries/LiquidityAmounts.sol';\nimport '../contracts/libraries/FixedPoint96.sol';\nimport '../contracts/libraries/FullMath.sol';\nimport '../contracts/libraries/TickMath.sol';\nimport '../contracts/UniV3PairManager.sol';\nimport '../interfaces/external/IWeth9.sol';\nimport '../interfaces/IUniV3PairManager.sol';\n\ncontract UniV3PairManagerForTest is UniV3PairManager {\n constructor(address _pool, address _governance) UniV3PairManager(_pool, _governance) {}\n\n function internalAddLiquidity(\n uint256 amount0Desired,\n uint256 amount1Desired,\n uint256 amount0Min,\n uint256 amount1Min\n )\n external\n returns (\n uint128 liquidity,\n uint256 amount0,\n uint256 amount1\n )\n {\n return _addLiquidity(amount0Desired, amount1Desired, amount0Min, amount1Min);\n }\n\n function internalPay(\n address token,\n address payer,\n address recipient,\n uint256 value\n ) external {\n return _pay(token, payer, recipient, value);\n }\n\n function internalMint(address dst, uint256 amount) external {\n return _mint(dst, amount);\n }\n\n function internalBurn(address dst, uint256 amount) external {\n return _burn(dst, amount);\n }\n\n function internalTransferTokens(\n address src,\n address dst,\n uint256 amount\n ) external {\n _transferTokens(src, dst, amount);\n }\n\n function internalSafeTransferFrom(\n address token,\n address from,\n address to,\n uint256 value\n ) external {\n _safeTransferFrom(token, from, to, value);\n }\n\n receive() external payable {}\n}\n" - }, - "@openzeppelin/contracts/token/ERC20/ERC20.sol": { - "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\nimport \"./IERC20.sol\";\nimport \"./extensions/IERC20Metadata.sol\";\nimport \"../../utils/Context.sol\";\n\n/**\n * @dev Implementation of the {IERC20} interface.\n *\n * This implementation is agnostic to the way tokens are created. This means\n * that a supply mechanism has to be added in a derived contract using {_mint}.\n * For a generic mechanism see {ERC20PresetMinterPauser}.\n *\n * TIP: For a detailed writeup see our guide\n * https://forum.zeppelin.solutions/t/how-to-implement-erc20-supply-mechanisms/226[How\n * to implement supply mechanisms].\n *\n * We have followed general OpenZeppelin Contracts guidelines: functions revert\n * instead returning `false` on failure. This behavior is nonetheless\n * conventional and does not conflict with the expectations of ERC20\n * applications.\n *\n * Additionally, an {Approval} event is emitted on calls to {transferFrom}.\n * This allows applications to reconstruct the allowance for all accounts just\n * by listening to said events. Other implementations of the EIP may not emit\n * these events, as it isn't required by the specification.\n *\n * Finally, the non-standard {decreaseAllowance} and {increaseAllowance}\n * functions have been added to mitigate the well-known issues around setting\n * allowances. See {IERC20-approve}.\n */\ncontract ERC20 is Context, IERC20, IERC20Metadata {\n mapping(address => uint256) private _balances;\n\n mapping(address => mapping(address => uint256)) private _allowances;\n\n uint256 private _totalSupply;\n\n string private _name;\n string private _symbol;\n\n /**\n * @dev Sets the values for {name} and {symbol}.\n *\n * The default value of {decimals} is 18. To select a different value for\n * {decimals} you should overload it.\n *\n * All two of these values are immutable: they can only be set once during\n * construction.\n */\n constructor(string memory name_, string memory symbol_) {\n _name = name_;\n _symbol = symbol_;\n }\n\n /**\n * @dev Returns the name of the token.\n */\n function name() public view virtual override returns (string memory) {\n return _name;\n }\n\n /**\n * @dev Returns the symbol of the token, usually a shorter version of the\n * name.\n */\n function symbol() public view virtual override returns (string memory) {\n return _symbol;\n }\n\n /**\n * @dev Returns the number of decimals used to get its user representation.\n * For example, if `decimals` equals `2`, a balance of `505` tokens should\n * be displayed to a user as `5.05` (`505 / 10 ** 2`).\n *\n * Tokens usually opt for a value of 18, imitating the relationship between\n * Ether and Wei. This is the value {ERC20} uses, unless this function is\n * overridden;\n *\n * NOTE: This information is only used for _display_ purposes: it in\n * no way affects any of the arithmetic of the contract, including\n * {IERC20-balanceOf} and {IERC20-transfer}.\n */\n function decimals() public view virtual override returns (uint8) {\n return 18;\n }\n\n /**\n * @dev See {IERC20-totalSupply}.\n */\n function totalSupply() public view virtual override returns (uint256) {\n return _totalSupply;\n }\n\n /**\n * @dev See {IERC20-balanceOf}.\n */\n function balanceOf(address account) public view virtual override returns (uint256) {\n return _balances[account];\n }\n\n /**\n * @dev See {IERC20-transfer}.\n *\n * Requirements:\n *\n * - `recipient` cannot be the zero address.\n * - the caller must have a balance of at least `amount`.\n */\n function transfer(address recipient, uint256 amount) public virtual override returns (bool) {\n _transfer(_msgSender(), recipient, amount);\n return true;\n }\n\n /**\n * @dev See {IERC20-allowance}.\n */\n function allowance(address owner, address spender) public view virtual override returns (uint256) {\n return _allowances[owner][spender];\n }\n\n /**\n * @dev See {IERC20-approve}.\n *\n * Requirements:\n *\n * - `spender` cannot be the zero address.\n */\n function approve(address spender, uint256 amount) public virtual override returns (bool) {\n _approve(_msgSender(), spender, amount);\n return true;\n }\n\n /**\n * @dev See {IERC20-transferFrom}.\n *\n * Emits an {Approval} event indicating the updated allowance. This is not\n * required by the EIP. See the note at the beginning of {ERC20}.\n *\n * Requirements:\n *\n * - `sender` and `recipient` cannot be the zero address.\n * - `sender` must have a balance of at least `amount`.\n * - the caller must have allowance for ``sender``'s tokens of at least\n * `amount`.\n */\n function transferFrom(\n address sender,\n address recipient,\n uint256 amount\n ) public virtual override returns (bool) {\n _transfer(sender, recipient, amount);\n\n uint256 currentAllowance = _allowances[sender][_msgSender()];\n require(currentAllowance >= amount, \"ERC20: transfer amount exceeds allowance\");\n unchecked {\n _approve(sender, _msgSender(), currentAllowance - amount);\n }\n\n return true;\n }\n\n /**\n * @dev Atomically increases the allowance granted to `spender` by the caller.\n *\n * This is an alternative to {approve} that can be used as a mitigation for\n * problems described in {IERC20-approve}.\n *\n * Emits an {Approval} event indicating the updated allowance.\n *\n * Requirements:\n *\n * - `spender` cannot be the zero address.\n */\n function increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool) {\n _approve(_msgSender(), spender, _allowances[_msgSender()][spender] + addedValue);\n return true;\n }\n\n /**\n * @dev Atomically decreases the allowance granted to `spender` by the caller.\n *\n * This is an alternative to {approve} that can be used as a mitigation for\n * problems described in {IERC20-approve}.\n *\n * Emits an {Approval} event indicating the updated allowance.\n *\n * Requirements:\n *\n * - `spender` cannot be the zero address.\n * - `spender` must have allowance for the caller of at least\n * `subtractedValue`.\n */\n function decreaseAllowance(address spender, uint256 subtractedValue) public virtual returns (bool) {\n uint256 currentAllowance = _allowances[_msgSender()][spender];\n require(currentAllowance >= subtractedValue, \"ERC20: decreased allowance below zero\");\n unchecked {\n _approve(_msgSender(), spender, currentAllowance - subtractedValue);\n }\n\n return true;\n }\n\n /**\n * @dev Moves `amount` of tokens from `sender` to `recipient`.\n *\n * This internal function is equivalent to {transfer}, and can be used to\n * e.g. implement automatic token fees, slashing mechanisms, etc.\n *\n * Emits a {Transfer} event.\n *\n * Requirements:\n *\n * - `sender` cannot be the zero address.\n * - `recipient` cannot be the zero address.\n * - `sender` must have a balance of at least `amount`.\n */\n function _transfer(\n address sender,\n address recipient,\n uint256 amount\n ) internal virtual {\n require(sender != address(0), \"ERC20: transfer from the zero address\");\n require(recipient != address(0), \"ERC20: transfer to the zero address\");\n\n _beforeTokenTransfer(sender, recipient, amount);\n\n uint256 senderBalance = _balances[sender];\n require(senderBalance >= amount, \"ERC20: transfer amount exceeds balance\");\n unchecked {\n _balances[sender] = senderBalance - amount;\n }\n _balances[recipient] += amount;\n\n emit Transfer(sender, recipient, amount);\n\n _afterTokenTransfer(sender, recipient, amount);\n }\n\n /** @dev Creates `amount` tokens and assigns them to `account`, increasing\n * the total supply.\n *\n * Emits a {Transfer} event with `from` set to the zero address.\n *\n * Requirements:\n *\n * - `account` cannot be the zero address.\n */\n function _mint(address account, uint256 amount) internal virtual {\n require(account != address(0), \"ERC20: mint to the zero address\");\n\n _beforeTokenTransfer(address(0), account, amount);\n\n _totalSupply += amount;\n _balances[account] += amount;\n emit Transfer(address(0), account, amount);\n\n _afterTokenTransfer(address(0), account, amount);\n }\n\n /**\n * @dev Destroys `amount` tokens from `account`, reducing the\n * total supply.\n *\n * Emits a {Transfer} event with `to` set to the zero address.\n *\n * Requirements:\n *\n * - `account` cannot be the zero address.\n * - `account` must have at least `amount` tokens.\n */\n function _burn(address account, uint256 amount) internal virtual {\n require(account != address(0), \"ERC20: burn from the zero address\");\n\n _beforeTokenTransfer(account, address(0), amount);\n\n uint256 accountBalance = _balances[account];\n require(accountBalance >= amount, \"ERC20: burn amount exceeds balance\");\n unchecked {\n _balances[account] = accountBalance - amount;\n }\n _totalSupply -= amount;\n\n emit Transfer(account, address(0), amount);\n\n _afterTokenTransfer(account, address(0), amount);\n }\n\n /**\n * @dev Sets `amount` as the allowance of `spender` over the `owner` s tokens.\n *\n * This internal function is equivalent to `approve`, and can be used to\n * e.g. set automatic allowances for certain subsystems, etc.\n *\n * Emits an {Approval} event.\n *\n * Requirements:\n *\n * - `owner` cannot be the zero address.\n * - `spender` cannot be the zero address.\n */\n function _approve(\n address owner,\n address spender,\n uint256 amount\n ) internal virtual {\n require(owner != address(0), \"ERC20: approve from the zero address\");\n require(spender != address(0), \"ERC20: approve to the zero address\");\n\n _allowances[owner][spender] = amount;\n emit Approval(owner, spender, amount);\n }\n\n /**\n * @dev Hook that is called before any transfer of tokens. This includes\n * minting and burning.\n *\n * Calling conditions:\n *\n * - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens\n * will be transferred to `to`.\n * - when `from` is zero, `amount` tokens will be minted for `to`.\n * - when `to` is zero, `amount` of ``from``'s tokens will be burned.\n * - `from` and `to` are never both zero.\n *\n * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].\n */\n function _beforeTokenTransfer(\n address from,\n address to,\n uint256 amount\n ) internal virtual {}\n\n /**\n * @dev Hook that is called after any transfer of tokens. This includes\n * minting and burning.\n *\n * Calling conditions:\n *\n * - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens\n * has been transferred to `to`.\n * - when `from` is zero, `amount` tokens have been minted for `to`.\n * - when `to` is zero, `amount` of ``from``'s tokens have been burned.\n * - `from` and `to` are never both zero.\n *\n * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].\n */\n function _afterTokenTransfer(\n address from,\n address to,\n uint256 amount\n ) internal virtual {}\n}\n" - }, - "solidity/contracts/libraries/LiquidityAmounts.sol": { - "content": "// SPDX-License-Identifier: GPL-2.0-or-later\npragma solidity >=0.8.4 <0.9.0;\n\nimport './FullMath.sol';\nimport './FixedPoint96.sol';\n\n// solhint-disable\nlibrary LiquidityAmounts {\n function toUint128(uint256 x) private pure returns (uint128 y) {\n require((y = uint128(x)) == x);\n }\n\n function getLiquidityForAmount0(\n uint160 sqrtRatioAX96,\n uint160 sqrtRatioBX96,\n uint256 amount0\n ) internal pure returns (uint128 liquidity) {\n if (sqrtRatioAX96 > sqrtRatioBX96) (sqrtRatioAX96, sqrtRatioBX96) = (sqrtRatioBX96, sqrtRatioAX96);\n uint256 intermediate = FullMath.mulDiv(sqrtRatioAX96, sqrtRatioBX96, FixedPoint96.Q96);\n return toUint128(FullMath.mulDiv(amount0, intermediate, sqrtRatioBX96 - sqrtRatioAX96));\n }\n\n function getLiquidityForAmount1(\n uint160 sqrtRatioAX96,\n uint160 sqrtRatioBX96,\n uint256 amount1\n ) internal pure returns (uint128 liquidity) {\n if (sqrtRatioAX96 > sqrtRatioBX96) (sqrtRatioAX96, sqrtRatioBX96) = (sqrtRatioBX96, sqrtRatioAX96);\n return toUint128(FullMath.mulDiv(amount1, FixedPoint96.Q96, sqrtRatioBX96 - sqrtRatioAX96));\n }\n\n function getLiquidityForAmounts(\n uint160 sqrtRatioX96,\n uint160 sqrtRatioAX96,\n uint160 sqrtRatioBX96,\n uint256 amount0,\n uint256 amount1\n ) internal pure returns (uint128 liquidity) {\n if (sqrtRatioAX96 > sqrtRatioBX96) (sqrtRatioAX96, sqrtRatioBX96) = (sqrtRatioBX96, sqrtRatioAX96);\n\n if (sqrtRatioX96 <= sqrtRatioAX96) {\n liquidity = getLiquidityForAmount0(sqrtRatioAX96, sqrtRatioBX96, amount0);\n } else if (sqrtRatioX96 < sqrtRatioBX96) {\n uint128 liquidity0 = getLiquidityForAmount0(sqrtRatioX96, sqrtRatioBX96, amount0);\n uint128 liquidity1 = getLiquidityForAmount1(sqrtRatioAX96, sqrtRatioX96, amount1);\n\n liquidity = liquidity0 < liquidity1 ? liquidity0 : liquidity1;\n } else {\n liquidity = getLiquidityForAmount1(sqrtRatioAX96, sqrtRatioBX96, amount1);\n }\n }\n\n function getAmount0ForLiquidity(\n uint160 sqrtRatioAX96,\n uint160 sqrtRatioBX96,\n uint128 liquidity\n ) internal pure returns (uint256 amount0) {\n if (sqrtRatioAX96 > sqrtRatioBX96) (sqrtRatioAX96, sqrtRatioBX96) = (sqrtRatioBX96, sqrtRatioAX96);\n\n return FullMath.mulDiv(uint256(liquidity) << FixedPoint96.RESOLUTION, sqrtRatioBX96 - sqrtRatioAX96, sqrtRatioBX96) / sqrtRatioAX96;\n }\n\n function getAmount1ForLiquidity(\n uint160 sqrtRatioAX96,\n uint160 sqrtRatioBX96,\n uint128 liquidity\n ) internal pure returns (uint256 amount1) {\n if (sqrtRatioAX96 > sqrtRatioBX96) (sqrtRatioAX96, sqrtRatioBX96) = (sqrtRatioBX96, sqrtRatioAX96);\n\n return FullMath.mulDiv(liquidity, sqrtRatioBX96 - sqrtRatioAX96, FixedPoint96.Q96);\n }\n\n function getAmountsForLiquidity(\n uint160 sqrtRatioX96,\n uint160 sqrtRatioAX96,\n uint160 sqrtRatioBX96,\n uint128 liquidity\n ) internal pure returns (uint256 amount0, uint256 amount1) {\n if (sqrtRatioAX96 > sqrtRatioBX96) (sqrtRatioAX96, sqrtRatioBX96) = (sqrtRatioBX96, sqrtRatioAX96);\n\n if (sqrtRatioX96 <= sqrtRatioAX96) {\n amount0 = getAmount0ForLiquidity(sqrtRatioAX96, sqrtRatioBX96, liquidity);\n } else if (sqrtRatioX96 < sqrtRatioBX96) {\n amount0 = getAmount0ForLiquidity(sqrtRatioX96, sqrtRatioBX96, liquidity);\n amount1 = getAmount1ForLiquidity(sqrtRatioAX96, sqrtRatioX96, liquidity);\n } else {\n amount1 = getAmount1ForLiquidity(sqrtRatioAX96, sqrtRatioBX96, liquidity);\n }\n }\n}\n" - }, - "solidity/contracts/libraries/FixedPoint96.sol": { - "content": "// SPDX-License-Identifier: GPL-2.0-or-later\npragma solidity >=0.8.4 <0.9.0;\n\nlibrary FixedPoint96 {\n // solhint-disable\n uint8 internal constant RESOLUTION = 96;\n uint256 internal constant Q96 = 0x1000000000000000000000000;\n}\n" - }, - "solidity/contracts/UniV3PairManager.sol": { - "content": "// SPDX-License-Identifier: MIT\n\n/*\n\nCoded for The Keep3r Network with ♥ by\n\n██████╗░███████╗███████╗██╗  ░██╗░░░░░░░██╗░█████╗░███╗░░██╗██████╗░███████╗██████╗░██╗░░░░░░█████╗░███╗░░██╗██████╗░\n██╔══██╗██╔════╝██╔════╝██║  ░██║░░██╗░░██║██╔══██╗████╗░██║██╔══██╗██╔════╝██╔══██╗██║░░░░░██╔══██╗████╗░██║██╔══██╗\n██║░░██║█████╗░░█████╗░░██║  ░╚██╗████╗██╔╝██║░░██║██╔██╗██║██║░░██║█████╗░░██████╔╝██║░░░░░███████║██╔██╗██║██║░░██║\n██║░░██║██╔══╝░░██╔══╝░░██║  ░░████╔═████║░██║░░██║██║╚████║██║░░██║██╔══╝░░██╔══██╗██║░░░░░██╔══██║██║╚████║██║░░██║\n██████╔╝███████╗██║░░░░░██║  ░░╚██╔╝░╚██╔╝░╚█████╔╝██║░╚███║██████╔╝███████╗██║░░██║███████╗██║░░██║██║░╚███║██████╔╝\n╚═════╝░╚══════╝╚═╝░░░░░╚═╝  ░░░╚═╝░░░╚═╝░░░╚════╝░╚═╝░░╚══╝╚═════╝░╚══════╝╚═╝░░╚═╝╚══════╝╚═╝░░╚═╝╚═╝░░╚══╝╚═════╝░\n\nhttps://defi.sucks\n\n*/\n\npragma solidity >=0.8.4 <0.9.0;\n\nimport '@openzeppelin/contracts/token/ERC20/ERC20.sol';\nimport '@uniswap/v3-core/contracts/interfaces/IUniswapV3Pool.sol';\n\nimport './libraries/LiquidityAmounts.sol';\nimport './libraries/FixedPoint96.sol';\nimport './libraries/FullMath.sol';\nimport './libraries/TickMath.sol';\n\nimport '../interfaces/external/IWeth9.sol';\nimport '../interfaces/IUniV3PairManager.sol';\n\nimport './peripherals/Governable.sol';\n\ncontract UniV3PairManager is IUniV3PairManager, Governable {\n /// @inheritdoc IERC20Metadata\n string public override name;\n\n /// @inheritdoc IERC20Metadata\n string public override symbol;\n\n /// @inheritdoc IERC20\n uint256 public override totalSupply;\n\n /// @inheritdoc IPairManager\n address public immutable override factory;\n\n /// @inheritdoc IPairManager\n address public immutable override token0;\n\n /// @inheritdoc IPairManager\n address public immutable override token1;\n\n /// @inheritdoc IPairManager\n address public immutable override pool;\n\n /// @inheritdoc IUniV3PairManager\n uint24 public immutable override fee;\n\n /// @inheritdoc IUniV3PairManager\n uint160 public immutable override sqrtRatioAX96;\n\n /// @inheritdoc IUniV3PairManager\n uint160 public immutable override sqrtRatioBX96;\n\n /// @inheritdoc IUniV3PairManager\n int24 public immutable override tickLower;\n\n /// @inheritdoc IUniV3PairManager\n int24 public immutable override tickUpper;\n\n /// @inheritdoc IUniV3PairManager\n int24 public immutable override tickSpacing;\n\n /// @notice Uniswap's maximum tick\n /// @dev Due to tick spacing, pools with different fees may have differences between _MAX_TICK and tickUpper. Use tickUpper to find the max tick of the pool.\n int24 private constant _MAX_TICK = 887272;\n\n /// @inheritdoc IERC20Metadata\n //solhint-disable-next-line const-name-snakecase\n uint8 public constant override decimals = 18;\n\n /// @inheritdoc IERC20\n mapping(address => mapping(address => uint256)) public override allowance;\n\n /// @inheritdoc IERC20\n mapping(address => uint256) public override balanceOf;\n\n /// @notice Struct that contains token0, token1, and fee of the Uniswap pool\n PoolKey private _poolKey;\n\n constructor(address _pool, address _governance) Governable(_governance) {\n uint24 _fee = IUniswapV3Pool(_pool).fee();\n address _token0 = IUniswapV3Pool(_pool).token0();\n address _token1 = IUniswapV3Pool(_pool).token1();\n int24 _tickSpacing = IUniswapV3Pool(_pool).tickSpacing();\n int24 _tickUpper = _MAX_TICK - (_MAX_TICK % _tickSpacing);\n int24 _tickLower = -_tickUpper;\n\n factory = msg.sender;\n pool = _pool;\n fee = _fee;\n tickSpacing = _tickSpacing;\n tickUpper = _tickUpper;\n tickLower = _tickLower;\n token0 = _token0;\n token1 = _token1;\n name = string(abi.encodePacked('Keep3rLP - ', ERC20(_token0).symbol(), '/', ERC20(_token1).symbol()));\n symbol = string(abi.encodePacked('kLP-', ERC20(_token0).symbol(), '/', ERC20(_token1).symbol()));\n\n sqrtRatioAX96 = TickMath.getSqrtRatioAtTick(_tickLower);\n sqrtRatioBX96 = TickMath.getSqrtRatioAtTick(_tickUpper);\n _poolKey = PoolKey({token0: _token0, token1: _token1, fee: _fee});\n }\n\n // This low-level function should be called from a contract which performs important safety checks\n /// @inheritdoc IUniV3PairManager\n function mint(\n uint256 amount0Desired,\n uint256 amount1Desired,\n uint256 amount0Min,\n uint256 amount1Min,\n address to\n ) external override returns (uint128 liquidity) {\n (liquidity, , ) = _addLiquidity(amount0Desired, amount1Desired, amount0Min, amount1Min);\n _mint(to, liquidity);\n }\n\n /// @inheritdoc IUniV3PairManager\n function uniswapV3MintCallback(\n uint256 amount0Owed,\n uint256 amount1Owed,\n bytes calldata data\n ) external override {\n MintCallbackData memory decoded = abi.decode(data, (MintCallbackData));\n if (msg.sender != pool) revert OnlyPool();\n if (amount0Owed > 0) _pay(decoded._poolKey.token0, decoded.payer, pool, amount0Owed);\n if (amount1Owed > 0) _pay(decoded._poolKey.token1, decoded.payer, pool, amount1Owed);\n }\n\n /// @inheritdoc IUniV3PairManager\n function burn(\n uint128 liquidity,\n uint256 amount0Min,\n uint256 amount1Min,\n address to\n ) external override returns (uint256 amount0, uint256 amount1) {\n (amount0, amount1) = IUniswapV3Pool(pool).burn(tickLower, tickUpper, liquidity);\n\n if (amount0 < amount0Min || amount1 < amount1Min) revert ExcessiveSlippage();\n\n IUniswapV3Pool(pool).collect(to, tickLower, tickUpper, uint128(amount0), uint128(amount1));\n _burn(msg.sender, liquidity);\n }\n\n /// @inheritdoc IUniV3PairManager\n function collect() external override onlyGovernance returns (uint256 amount0, uint256 amount1) {\n (, , , uint128 tokensOwed0, uint128 tokensOwed1) = IUniswapV3Pool(pool).positions(\n keccak256(abi.encodePacked(address(this), tickLower, tickUpper))\n );\n (amount0, amount1) = IUniswapV3Pool(pool).collect(governance, tickLower, tickUpper, tokensOwed0, tokensOwed1);\n }\n\n /// @inheritdoc IUniV3PairManager\n function position()\n external\n view\n override\n returns (\n uint128 liquidity,\n uint256 feeGrowthInside0LastX128,\n uint256 feeGrowthInside1LastX128,\n uint128 tokensOwed0,\n uint128 tokensOwed1\n )\n {\n (liquidity, feeGrowthInside0LastX128, feeGrowthInside1LastX128, tokensOwed0, tokensOwed1) = IUniswapV3Pool(pool).positions(\n keccak256(abi.encodePacked(address(this), tickLower, tickUpper))\n );\n }\n\n /// @inheritdoc IERC20\n function approve(address spender, uint256 amount) external override returns (bool) {\n allowance[msg.sender][spender] = amount;\n\n emit Approval(msg.sender, spender, amount);\n return true;\n }\n\n /// @inheritdoc IERC20\n function transfer(address to, uint256 amount) external override returns (bool) {\n _transferTokens(msg.sender, to, amount);\n return true;\n }\n\n /// @inheritdoc IERC20\n function transferFrom(\n address from,\n address to,\n uint256 amount\n ) external override returns (bool) {\n address spender = msg.sender;\n uint256 spenderAllowance = allowance[from][spender];\n\n if (spender != from && spenderAllowance != type(uint256).max) {\n uint256 newAllowance = spenderAllowance - amount;\n allowance[from][spender] = newAllowance;\n\n emit Approval(from, spender, newAllowance);\n }\n\n _transferTokens(from, to, amount);\n return true;\n }\n\n /// @notice Adds liquidity to an initialized pool\n /// @dev Reverts if the returned amount0 is less than amount0Min or if amount1 is less than amount1Min\n /// @dev This function calls the mint function of the corresponding Uniswap pool, which in turn calls UniswapV3Callback\n /// @param amount0Desired The amount of token0 we would like to provide\n /// @param amount1Desired The amount of token1 we would like to provide\n /// @param amount0Min The minimum amount of token0 we want to provide\n /// @param amount1Min The minimum amount of token1 we want to provide\n /// @return liquidity The calculated liquidity we get for the token amounts we provided\n /// @return amount0 The amount of token0 we ended up providing\n /// @return amount1 The amount of token1 we ended up providing\n function _addLiquidity(\n uint256 amount0Desired,\n uint256 amount1Desired,\n uint256 amount0Min,\n uint256 amount1Min\n )\n internal\n returns (\n uint128 liquidity,\n uint256 amount0,\n uint256 amount1\n )\n {\n (uint160 sqrtPriceX96, , , , , , ) = IUniswapV3Pool(pool).slot0();\n\n liquidity = LiquidityAmounts.getLiquidityForAmounts(sqrtPriceX96, sqrtRatioAX96, sqrtRatioBX96, amount0Desired, amount1Desired);\n\n (amount0, amount1) = IUniswapV3Pool(pool).mint(\n address(this),\n tickLower,\n tickUpper,\n liquidity,\n abi.encode(MintCallbackData({_poolKey: _poolKey, payer: msg.sender}))\n );\n\n if (amount0 < amount0Min || amount1 < amount1Min) revert ExcessiveSlippage();\n }\n\n /// @notice Transfers the passed-in token from the payer to the recipient for the corresponding value\n /// @param token The token to be transferred to the recipient\n /// @param from The address of the payer\n /// @param to The address of the passed-in tokens recipient\n /// @param value How much of that token to be transferred from payer to the recipient\n function _pay(\n address token,\n address from,\n address to,\n uint256 value\n ) internal {\n _safeTransferFrom(token, from, to, value);\n }\n\n /// @notice Mints Keep3r credits to the passed-in address of recipient and increases total supply of Keep3r credits by the corresponding amount\n /// @param to The recipient of the Keep3r credits\n /// @param amount The amount Keep3r credits to be minted to the recipient\n function _mint(address to, uint256 amount) internal {\n totalSupply += amount;\n balanceOf[to] += amount;\n emit Transfer(address(0), to, amount);\n }\n\n /// @notice Burns Keep3r credits to the passed-in address of recipient and reduces total supply of Keep3r credits by the corresponding amount\n /// @param to The address that will get its Keep3r credits burned\n /// @param amount The amount Keep3r credits to be burned from the recipient/recipient\n function _burn(address to, uint256 amount) internal {\n totalSupply -= amount;\n balanceOf[to] -= amount;\n emit Transfer(to, address(0), amount);\n }\n\n /// @notice Transfers amount of Keep3r credits between two addresses\n /// @param from The user that transfers the Keep3r credits\n /// @param to The user that receives the Keep3r credits\n /// @param amount The amount of Keep3r credits to be transferred\n function _transferTokens(\n address from,\n address to,\n uint256 amount\n ) internal {\n balanceOf[from] -= amount;\n balanceOf[to] += amount;\n\n emit Transfer(from, to, amount);\n }\n\n /// @notice Transfers the passed-in token from the specified \"from\" to the specified \"to\" for the corresponding value\n /// @dev Reverts with IUniV3PairManager#UnsuccessfulTransfer if the transfer was not successful,\n /// or if the passed data length is different than 0 and the decoded data is not a boolean\n /// @param token The token to be transferred to the specified \"to\"\n /// @param from The address which is going to transfer the tokens\n /// @param value How much of that token to be transferred from \"from\" to \"to\"\n function _safeTransferFrom(\n address token,\n address from,\n address to,\n uint256 value\n ) internal {\n // solhint-disable-next-line avoid-low-level-calls\n (bool success, bytes memory data) = token.call(abi.encodeWithSelector(IERC20.transferFrom.selector, from, to, value));\n if (!success || (data.length != 0 && !abi.decode(data, (bool)))) revert UnsuccessfulTransfer();\n }\n}\n" - }, - "solidity/interfaces/external/IWeth9.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '@openzeppelin/contracts/token/ERC20/IERC20.sol';\n\ninterface IWeth9 is IERC20 {\n function deposit() external payable;\n\n function withdraw(uint256) external;\n}\n" - }, - "solidity/interfaces/IUniV3PairManager.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport './IPairManager.sol';\nimport '@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol';\nimport './peripherals/IGovernable.sol';\n\n/// @title Pair Manager contract\n/// @notice Creates a UniswapV3 position, and tokenizes in an ERC20 manner\n/// so that the user can use it as liquidity for a Keep3rJob\ninterface IUniV3PairManager is IGovernable, IPairManager {\n // Structs\n struct PoolKey {\n address token0;\n address token1;\n uint24 fee;\n }\n\n /// @notice The data to be decoded by the UniswapV3MintCallback function\n struct MintCallbackData {\n PoolKey _poolKey; // Struct that contains token0, token1, and fee of the pool passed into the constructor\n address payer; // The address of the payer, which will be the msg.sender of the mint function\n }\n\n // Variables\n\n /// @notice The fee of the Uniswap pool passed into the constructor\n /// @return _fee The fee of the Uniswap pool passed into the constructor\n function fee() external view returns (uint24 _fee);\n\n /// @notice Highest tick in the Uniswap's curve\n /// @return _tickUpper The highest tick in the Uniswap's curve\n function tickUpper() external view returns (int24 _tickUpper);\n\n /// @notice Lowest tick in the Uniswap's curve\n /// @return _tickLower The lower tick in the Uniswap's curve\n function tickLower() external view returns (int24 _tickLower);\n\n /// @notice The pair tick spacing\n /// @return _tickSpacing The pair tick spacing\n function tickSpacing() external view returns (int24 _tickSpacing);\n\n /// @notice The sqrtRatioAX96 at the lowest tick (-887200) of the Uniswap pool\n /// @return _sqrtPriceA96 A Fixed point Q64.96 number representing the sqrt of the ratio of the two assets (token1/token0)\n /// at the lowest tick\n function sqrtRatioAX96() external view returns (uint160 _sqrtPriceA96);\n\n /// @notice The sqrtRatioBX96 at the highest tick (887200) of the Uniswap pool\n /// @return _sqrtPriceBX96 A Fixed point Q64.96 number representing the sqrt of the ratio of the two assets (token1/token0)\n /// at the highest tick\n function sqrtRatioBX96() external view returns (uint160 _sqrtPriceBX96);\n\n // Errors\n\n /// @notice Throws when the caller of the function is not the pool\n error OnlyPool();\n\n /// @notice Throws when the slippage exceeds what the user is comfortable with\n error ExcessiveSlippage();\n\n /// @notice Throws when a transfer is unsuccessful\n error UnsuccessfulTransfer();\n\n // Methods\n\n /// @notice This function is called after a user calls IUniV3PairManager#mint function\n /// It ensures that any tokens owed to the pool are paid by the msg.sender of IUniV3PairManager#mint function\n /// @param amount0Owed The amount of token0 due to the pool for the minted liquidity\n /// @param amount1Owed The amount of token1 due to the pool for the minted liquidity\n /// @param data The encoded token0, token1, fee (_poolKey) and the payer (msg.sender) of the IUniV3PairManager#mint function\n function uniswapV3MintCallback(\n uint256 amount0Owed,\n uint256 amount1Owed,\n bytes calldata data\n ) external;\n\n /// @notice Mints kLP tokens to an address according to the liquidity the msg.sender provides to the UniswapV3 pool\n /// @dev Triggers UniV3PairManager#uniswapV3MintCallback\n /// @param amount0Desired The amount of token0 we would like to provide\n /// @param amount1Desired The amount of token1 we would like to provide\n /// @param amount0Min The minimum amount of token0 we want to provide\n /// @param amount1Min The minimum amount of token1 we want to provide\n /// @param to The address to which the kLP tokens are going to be minted to\n /// @return liquidity kLP tokens sent in exchange for the provision of tokens\n function mint(\n uint256 amount0Desired,\n uint256 amount1Desired,\n uint256 amount0Min,\n uint256 amount1Min,\n address to\n ) external returns (uint128 liquidity);\n\n /// @notice Returns the pair manager's position in the corresponding UniswapV3 pool\n /// @return liquidity The amount of liquidity provided to the UniswapV3 pool by the pair manager\n /// @return feeGrowthInside0LastX128 The fee growth of token0 as of the last action on the individual position\n /// @return feeGrowthInside1LastX128 The fee growth of token1 as of the last action on the individual position\n /// @return tokensOwed0 The uncollected amount of token0 owed to the position as of the last computation\n /// @return tokensOwed1 The uncollected amount of token1 owed to the position as of the last computation\n function position()\n external\n view\n returns (\n uint128 liquidity,\n uint256 feeGrowthInside0LastX128,\n uint256 feeGrowthInside1LastX128,\n uint128 tokensOwed0,\n uint128 tokensOwed1\n );\n\n /// @notice Calls the UniswapV3 pool's collect function, which collects up to a maximum amount of fees\n // owed to a specific position to the recipient, in this case, that recipient is the pair manager\n /// @dev The collected fees will be sent to governance\n /// @return amount0 The amount of fees collected in token0\n /// @return amount1 The amount of fees collected in token1\n function collect() external returns (uint256 amount0, uint256 amount1);\n\n /// @notice Burns the corresponding amount of kLP tokens from the msg.sender and withdraws the specified liquidity\n // in the entire range\n /// @param liquidity The amount of liquidity to be burned\n /// @param amount0Min The minimum amount of token0 we want to send to the recipient (to)\n /// @param amount1Min The minimum amount of token1 we want to send to the recipient (to)\n /// @param to The address that will receive the due fees\n /// @return amount0 The calculated amount of token0 that will be sent to the recipient\n /// @return amount1 The calculated amount of token1 that will be sent to the recipient\n function burn(\n uint128 liquidity,\n uint256 amount0Min,\n uint256 amount1Min,\n address to\n ) external returns (uint256 amount0, uint256 amount1);\n}\n" - }, - "@openzeppelin/contracts/utils/Context.sol": { - "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Provides information about the current execution context, including the\n * sender of the transaction and its data. While these are generally available\n * via msg.sender and msg.data, they should not be accessed in such a direct\n * manner, since when dealing with meta-transactions the account sending and\n * paying for execution may not be the actual sender (as far as an application\n * is concerned).\n *\n * This contract is only required for intermediate, library-like contracts.\n */\nabstract contract Context {\n function _msgSender() internal view virtual returns (address) {\n return msg.sender;\n }\n\n function _msgData() internal view virtual returns (bytes calldata) {\n return msg.data;\n }\n}\n" - }, - "solidity/interfaces/IPairManagerFactory.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport './peripherals/IGovernable.sol';\n\n/// @title Factory of Pair Managers\n/// @notice This contract creates new pair managers\ninterface IPairManagerFactory is IGovernable {\n // Variables\n\n /// @notice Maps the address of a Uniswap pool, to the address of the corresponding PairManager\n /// For example, the uniswap address of DAI-WETH, will return the Keep3r/DAI-WETH pair manager address\n /// @param _pool The address of the Uniswap pool\n /// @return _pairManager The address of the corresponding pair manager\n function pairManagers(address _pool) external view returns (address _pairManager);\n\n // Events\n\n /// @notice Emitted when a new pair manager is created\n /// @param _pool The address of the corresponding Uniswap pool\n /// @param _pairManager The address of the just-created pair manager\n event PairCreated(address _pool, address _pairManager);\n\n // Errors\n\n /// @notice Throws an error if the pair manager is already initialized\n error AlreadyInitialized();\n\n /// @notice Throws an error if the caller is not the owner\n error OnlyOwner();\n\n // Methods\n\n /// @notice Creates a new pair manager based on the address of a Uniswap pool\n /// For example, the uniswap address of DAI-WETH, will create the Keep3r/DAI-WETH pool\n /// @param _pool The address of the Uniswap pool the pair manager will be based of\n /// @return _pairManager The address of the just-created pair manager\n function createPairManager(address _pool) external returns (address _pairManager);\n}\n" - }, - "solidity/contracts/UniV3PairManagerFactory.sol": { - "content": "// SPDX-License-Identifier: MIT\n\n/*\n\nCoded for The Keep3r Network with ♥ by\n\n██████╗░███████╗███████╗██╗  ░██╗░░░░░░░██╗░█████╗░███╗░░██╗██████╗░███████╗██████╗░██╗░░░░░░█████╗░███╗░░██╗██████╗░\n██╔══██╗██╔════╝██╔════╝██║  ░██║░░██╗░░██║██╔══██╗████╗░██║██╔══██╗██╔════╝██╔══██╗██║░░░░░██╔══██╗████╗░██║██╔══██╗\n██║░░██║█████╗░░█████╗░░██║  ░╚██╗████╗██╔╝██║░░██║██╔██╗██║██║░░██║█████╗░░██████╔╝██║░░░░░███████║██╔██╗██║██║░░██║\n██║░░██║██╔══╝░░██╔══╝░░██║  ░░████╔═████║░██║░░██║██║╚████║██║░░██║██╔══╝░░██╔══██╗██║░░░░░██╔══██║██║╚████║██║░░██║\n██████╔╝███████╗██║░░░░░██║  ░░╚██╔╝░╚██╔╝░╚█████╔╝██║░╚███║██████╔╝███████╗██║░░██║███████╗██║░░██║██║░╚███║██████╔╝\n╚═════╝░╚══════╝╚═╝░░░░░╚═╝  ░░░╚═╝░░░╚═╝░░░╚════╝░╚═╝░░╚══╝╚═════╝░╚══════╝╚═╝░░╚═╝╚══════╝╚═╝░░╚═╝╚═╝░░╚══╝╚═════╝░\n\nhttps://defi.sucks\n\n*/\n\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../interfaces/IPairManagerFactory.sol';\nimport './UniV3PairManager.sol';\nimport './peripherals/Governable.sol';\n\n/// @title Factory of Pair Managers\n/// @notice This contract creates new pair managers\ncontract UniV3PairManagerFactory is IPairManagerFactory, Governable {\n mapping(address => address) public override pairManagers;\n\n constructor(address _governance) Governable(_governance) {}\n\n ///@inheritdoc IPairManagerFactory\n function createPairManager(address _pool) external override returns (address _pairManager) {\n if (pairManagers[_pool] != address(0)) revert AlreadyInitialized();\n _pairManager = address(new UniV3PairManager(_pool, governance));\n pairManagers[_pool] = _pairManager;\n emit PairCreated(_pool, _pairManager);\n }\n}\n" - }, - "solidity/for-test/peripherals/GovernableForTest.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../../contracts/peripherals/Governable.sol';\n\ncontract GovernableForTest is Governable {\n constructor(address _governor) Governable(_governor) {}\n}\n" - }, - "solidity/for-test/BridgeForTest.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.0 <0.9.0;\n\nimport '@openzeppelin/contracts/token/ERC20/ERC20.sol';\nimport '@openzeppelin/contracts/token/ERC20/IERC20.sol';\n\ncontract BridgeForTest is ERC20 {\n address public immutable kp3r;\n\n constructor(address _kp3r) ERC20('Wrapped KP3R', 'wKP3R') {\n kp3r = _kp3r;\n }\n\n function bridge(uint256 _amount) external {\n IERC20(kp3r).transferFrom(msg.sender, address(this), _amount);\n _mint(msg.sender, _amount);\n }\n\n function bridgeBack(uint256 _amount) external {\n _burn(msg.sender, _amount);\n IERC20(kp3r).transfer(msg.sender, _amount);\n }\n}\n" - }, - "solidity/for-test/ERC20ForTest.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '@openzeppelin/contracts/token/ERC20/ERC20.sol';\n\ncontract ERC20ForTest is ERC20 {\n constructor(\n string memory _name,\n string memory _symbol,\n address _initialAccount,\n uint256 _initialBalance\n ) ERC20(_name, _symbol) {\n _mint(_initialAccount, _initialBalance);\n }\n\n function mint(uint256 _amount) public {\n _mint(msg.sender, _amount);\n }\n\n function mint(address _account, uint256 _amount) public {\n _mint(_account, _amount);\n }\n\n function burn(uint256 _amount) public {\n _burn(msg.sender, _amount);\n }\n\n function burn(address _account, uint256 _amount) public {\n _burn(_account, _amount);\n }\n\n function transferInternal(\n address _from,\n address _to,\n uint256 _value\n ) public {\n _transfer(_from, _to, _value);\n }\n\n function approveInternal(\n address _owner,\n address _spender,\n uint256 _value\n ) public {\n _approve(_owner, _spender, _value);\n }\n\n function deposit() external payable {\n // Function added for compatibility with WETH\n }\n}\n" - }, - "solidity/for-test/peripherals/keepers/Keep3rKeeperFundableForTest.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../../../contracts/peripherals/keepers/Keep3rKeeperFundable.sol';\n\ncontract Keep3rKeeperFundableForTest is Keep3rKeeperFundable {\n using EnumerableSet for EnumerableSet.AddressSet;\n\n constructor(\n address _kph,\n address _keep3rV1,\n address _keep3rV1Proxy\n ) Keep3rParameters(_kph, _keep3rV1, _keep3rV1Proxy) Keep3rRoles(msg.sender) {}\n\n function isKeeper(address _keeper) external view returns (bool) {\n return _keepers.contains(_keeper);\n }\n\n function setJob(address job) external {\n _jobs.add(job);\n }\n}\n" - }, - "solidity/contracts/sidechain/Keep3rEscrow.sol": { - "content": "// SPDX-License-Identifier: MIT\n\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../peripherals/Mintable.sol';\nimport '../peripherals/DustCollector.sol';\nimport '../../interfaces/sidechain/IKeep3rEscrow.sol';\nimport '@openzeppelin/contracts/token/ERC20/IERC20.sol';\nimport '@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol';\n\ncontract Keep3rEscrow is Mintable, DustCollector, IKeep3rEscrow {\n using SafeERC20 for IERC20;\n\n /// @inheritdoc IKeep3rEscrow\n address public override wKP3R;\n\n /// @param _governance Address of governance\n /// @param _wKP3R Address of wrapped KP3R implementation\n constructor(address _governance, address _wKP3R) Mintable(_governance) {\n wKP3R = _wKP3R;\n }\n\n /// @inheritdoc IKeep3rEscrow\n function deposit(uint256 _amount) external override {\n IERC20(wKP3R).safeTransferFrom(msg.sender, address(this), _amount);\n emit wKP3RDeposited(wKP3R, msg.sender, _amount);\n }\n\n /// @inheritdoc IKeep3rEscrow\n function mint(uint256 _amount) external override onlyMinter {\n IERC20(wKP3R).safeTransfer(msg.sender, _amount);\n emit wKP3RMinted(wKP3R, msg.sender, _amount);\n }\n\n /// @inheritdoc IKeep3rEscrow\n function setWKP3R(address _wKP3R) external override onlyGovernance {\n if (_wKP3R == address(0)) revert ZeroAddress();\n wKP3R = _wKP3R;\n emit wKP3RSet(wKP3R);\n }\n}\n" - }, - "solidity/contracts/peripherals/Mintable.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../../interfaces/peripherals/IMintable.sol';\nimport './Governable.sol';\n\nabstract contract Mintable is Governable, IMintable {\n /// @inheritdoc IMintable\n address public override minter;\n\n constructor(address _governance) Governable(_governance) {}\n\n /// @inheritdoc IMintable\n function setMinter(address _minter) external override onlyGovernance {\n if (_minter == address(0)) revert ZeroAddress();\n minter = _minter;\n emit MinterSet(_minter);\n }\n\n /// @notice Functions with this modifier can only be called by the minter;\n modifier onlyMinter() {\n if (msg.sender != minter) revert OnlyMinter();\n _;\n }\n}\n" - }, - "solidity/for-test/peripherals/DustCollectorForTest.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../../contracts/peripherals/DustCollector.sol';\n\ncontract DustCollectorForTest is DustCollector {\n constructor() DustCollector() Governable(msg.sender) {}\n}\n" - }, - "solidity/for-test/peripherals/Keep3rAccountanceForTest.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../../contracts/peripherals/Keep3rAccountance.sol';\n\ncontract Keep3rAccountanceForTest is Keep3rAccountance {\n using EnumerableSet for EnumerableSet.AddressSet;\n\n constructor() Keep3rRoles(msg.sender) {}\n\n function setJob(address job) external {\n _jobs.add(job);\n }\n\n function setKeeper(address keeper) external {\n _keepers.add(keeper);\n }\n}\n" - }, - "solidity/for-test/peripherals/jobs/Keep3rJobFundableLiquidityForTest.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../../../contracts/peripherals/jobs/Keep3rJobFundableLiquidity.sol';\n\ncontract Keep3rJobFundableLiquidityForTest is Keep3rJobFundableLiquidity {\n using EnumerableSet for EnumerableSet.AddressSet;\n\n constructor(\n address _kph,\n address _keep3rV1,\n address _keep3rV1Proxy\n ) Keep3rParameters(_kph, _keep3rV1, _keep3rV1Proxy) Keep3rRoles(msg.sender) {}\n\n function setJob(address _job) external {\n _jobs.add(_job);\n }\n\n function setJobLiquidity(address _job, address _liquidity) external returns (bool) {\n return _jobLiquidities[_job].add(_liquidity);\n }\n\n function setApprovedLiquidity(address _liquidity) external {\n _approvedLiquidities.add(_liquidity);\n }\n\n function setRevokedLiquidity(address _liquidity) external {\n _approvedLiquidities.remove(_liquidity);\n }\n\n function viewTickCache(address _liquidity) external view returns (TickCache memory _tickCache) {\n _tickCache = _tick[_liquidity];\n }\n\n function viewTickOrder(address _liquidity) external view returns (bool) {\n return _isKP3RToken0[_liquidity];\n }\n\n function internalJobLiquidities(address _job) external view returns (address[] memory _list) {\n _list = _jobLiquidities[_job].values();\n }\n\n function internalSettleJobAccountance(address _job) external {\n _settleJobAccountance(_job);\n }\n}\n" - }, - "solidity/for-test/peripherals/jobs/Keep3rJobDisputableForTest.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../../../contracts/peripherals/jobs/Keep3rJobDisputable.sol';\n\ncontract Keep3rJobDisputableForTest is Keep3rJobDisputable {\n using EnumerableSet for EnumerableSet.AddressSet;\n\n constructor(\n address _kph,\n address _keep3rV1,\n address _keep3rV1Proxy\n ) Keep3rParameters(_kph, _keep3rV1, _keep3rV1Proxy) Keep3rRoles(msg.sender) {}\n\n function setJobLiquidity(address _job, address _liquidity) external {\n _jobLiquidities[_job].add(_liquidity);\n }\n\n function setJobToken(address _job, address _token) external {\n _jobTokens[_job].add(_token);\n }\n\n function setApprovedLiquidity(address _liquidity) external {\n _approvedLiquidities.add(_liquidity);\n }\n\n function setRevokedLiquidity(address _liquidity) external {\n _approvedLiquidities.remove(_liquidity);\n }\n\n function internalJobLiquidityCredits(address _job) external view returns (uint256 _credits) {\n _credits = _jobLiquidityCredits[_job];\n }\n\n function internalJobPeriodCredits(address _job) external view returns (uint256 _credits) {\n _credits = _jobPeriodCredits[_job];\n }\n\n function internalJobTokens(address _job) external view returns (address[] memory _tokens) {\n _tokens = new address[](_jobTokens[_job].length());\n for (uint256 i; i < _jobTokens[_job].length(); i++) {\n _tokens[i] = _jobTokens[_job].at(i);\n }\n }\n\n function internalJobLiquidities(address _job) external view returns (address[] memory _tokens) {\n _tokens = new address[](_jobLiquidities[_job].length());\n for (uint256 i; i < _jobLiquidities[_job].length(); i++) {\n _tokens[i] = _jobLiquidities[_job].at(i);\n }\n }\n}\n" - }, - "solidity/for-test/peripherals/Keep3rDisputableForTest.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../../contracts/peripherals/Keep3rDisputable.sol';\n\ncontract Keep3rDisputableForTest is Keep3rDisputable {\n constructor() Keep3rParameters(address(0), address(0), address(0)) Keep3rRoles(msg.sender) {}\n}\n" - }, - "solidity/for-test/peripherals/keepers/Keep3rKeeperDisputableForTest.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../../../contracts/peripherals/keepers/Keep3rKeeperDisputable.sol';\n\ncontract Keep3rKeeperDisputableForTest is Keep3rKeeperDisputable {\n using EnumerableSet for EnumerableSet.AddressSet;\n\n constructor(\n address _kph,\n address _keep3rV1,\n address _keep3rV1Proxy\n ) Keep3rParameters(_kph, _keep3rV1, _keep3rV1Proxy) Keep3rRoles(msg.sender) {}\n\n function setKeeper(address _keeper) external {\n _keepers.add(_keeper);\n }\n\n function internalSlash(\n address _bonded,\n address _keeper,\n uint256 _bondAmount,\n uint256 _unbondAmount\n ) external {\n _slash(_bonded, _keeper, _bondAmount, _unbondAmount);\n }\n\n function isKeeper(address _address) external view returns (bool _isKeeper) {\n _isKeeper = _keepers.contains(_address);\n }\n}\n" - }, - "solidity/for-test/peripherals/jobs/Keep3rJobFundableCreditsForTest.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../../../contracts/peripherals/jobs/Keep3rJobFundableCredits.sol';\n\ncontract Keep3rJobFundableCreditsForTest is Keep3rJobFundableCredits {\n using EnumerableSet for EnumerableSet.AddressSet;\n\n constructor(\n address _kph,\n address _keep3rV1,\n address _keep3rV1Proxy\n ) Keep3rParameters(_kph, _keep3rV1, _keep3rV1Proxy) Keep3rRoles(msg.sender) {}\n\n function setJob(address _job, address _jobOwner) external {\n _jobs.add(_job);\n jobOwner[_job] = _jobOwner;\n }\n\n function setJobToken(address _job, address _token) external {\n _jobTokens[_job].add(_token);\n }\n\n function isJobToken(address _job, address _token) external view returns (bool _contains) {\n _contains = _jobTokens[_job].contains(_token);\n }\n}\n" - }, - "solidity/contracts/Keep3rHelper.sol": { - "content": "// SPDX-License-Identifier: MIT\n\n/*\n\nCoded for The Keep3r Network with ♥ by\n\n██████╗░███████╗███████╗██╗  ░██╗░░░░░░░██╗░█████╗░███╗░░██╗██████╗░███████╗██████╗░██╗░░░░░░█████╗░███╗░░██╗██████╗░\n██╔══██╗██╔════╝██╔════╝██║  ░██║░░██╗░░██║██╔══██╗████╗░██║██╔══██╗██╔════╝██╔══██╗██║░░░░░██╔══██╗████╗░██║██╔══██╗\n██║░░██║█████╗░░█████╗░░██║  ░╚██╗████╗██╔╝██║░░██║██╔██╗██║██║░░██║█████╗░░██████╔╝██║░░░░░███████║██╔██╗██║██║░░██║\n██║░░██║██╔══╝░░██╔══╝░░██║  ░░████╔═████║░██║░░██║██║╚████║██║░░██║██╔══╝░░██╔══██╗██║░░░░░██╔══██║██║╚████║██║░░██║\n██████╔╝███████╗██║░░░░░██║  ░░╚██╔╝░╚██╔╝░╚█████╔╝██║░╚███║██████╔╝███████╗██║░░██║███████╗██║░░██║██║░╚███║██████╔╝\n╚═════╝░╚══════╝╚═╝░░░░░╚═╝  ░░░╚═╝░░░╚═╝░░░╚════╝░╚═╝░░╚══╝╚═════╝░╚══════╝╚═╝░░╚═╝╚══════╝╚═╝░░╚═╝╚═╝░░╚══╝╚═════╝░\n\nhttps://defi.sucks\n\n*/\n\npragma solidity >=0.8.7 <0.9.0;\n\nimport './libraries/FullMath.sol';\nimport './libraries/TickMath.sol';\nimport '../interfaces/IKeep3r.sol';\nimport '../interfaces/IKeep3rHelper.sol';\nimport './Keep3rHelperParameters.sol';\n\nimport '@openzeppelin/contracts/utils/math/Math.sol';\nimport '@uniswap/v3-core/contracts/interfaces/IUniswapV3Pool.sol';\n\ncontract Keep3rHelper is IKeep3rHelper, Keep3rHelperParameters {\n constructor(\n address _kp3r,\n address _keep3rV2,\n address _governance,\n address _kp3rWethPool\n ) Keep3rHelperParameters(_kp3r, _keep3rV2, _governance, _kp3rWethPool) {}\n\n /// @inheritdoc IKeep3rHelper\n function quote(uint256 _eth) public view override returns (uint256 _amountOut) {\n uint32[] memory _secondsAgos = new uint32[](2);\n _secondsAgos[1] = quoteTwapTime;\n\n (int56[] memory _tickCumulatives, ) = IUniswapV3Pool(kp3rWethPool.poolAddress).observe(_secondsAgos);\n int56 _difference = _tickCumulatives[0] - _tickCumulatives[1];\n _amountOut = getQuoteAtTick(uint128(_eth), kp3rWethPool.isTKNToken0 ? _difference : -_difference, quoteTwapTime);\n }\n\n /// @inheritdoc IKeep3rHelper\n function bonds(address _keeper) public view virtual override returns (uint256 _amountBonded) {\n return IKeep3r(keep3rV2).bonds(_keeper, KP3R);\n }\n\n /// @inheritdoc IKeep3rHelper\n function getRewardAmountFor(address _keeper, uint256 _gasUsed) public view override returns (uint256 _kp3r) {\n uint256 _boost = getRewardBoostFor(bonds(_keeper));\n _kp3r = quote((_gasUsed * _boost) / BOOST_BASE);\n }\n\n /// @inheritdoc IKeep3rHelper\n function getRewardAmount(uint256 _gasUsed) external view override returns (uint256 _amount) {\n // solhint-disable-next-line avoid-tx-origin\n return getRewardAmountFor(tx.origin, _gasUsed);\n }\n\n /// @inheritdoc IKeep3rHelper\n function getRewardBoostFor(uint256 _bonds) public view override returns (uint256 _rewardBoost) {\n _bonds = Math.min(_bonds, targetBond);\n uint256 _cap = minBoost + ((maxBoost - minBoost) * _bonds) / targetBond;\n _rewardBoost = _cap * _getBasefee();\n }\n\n /// @inheritdoc IKeep3rHelper\n function getPoolTokens(address _pool) public view override returns (address _token0, address _token1) {\n return (IUniswapV3Pool(_pool).token0(), IUniswapV3Pool(_pool).token1());\n }\n\n /// @inheritdoc IKeep3rHelper\n function isKP3RToken0(address _pool) external view virtual override returns (bool _isKP3RToken0) {\n address _token0;\n address _token1;\n (_token0, _token1) = getPoolTokens(_pool);\n if (_token0 == KP3R) {\n return true;\n } else if (_token1 != KP3R) {\n revert LiquidityPairInvalid();\n }\n }\n\n /// @inheritdoc IKeep3rHelper\n function observe(address _pool, uint32[] memory _secondsAgo)\n external\n view\n override\n returns (\n int56 _tickCumulative1,\n int56 _tickCumulative2,\n bool _success\n )\n {\n try IUniswapV3Pool(_pool).observe(_secondsAgo) returns (int56[] memory _uniswapResponse, uint160[] memory) {\n _tickCumulative1 = _uniswapResponse[0];\n if (_uniswapResponse.length > 1) {\n _tickCumulative2 = _uniswapResponse[1];\n }\n _success = true;\n } catch (bytes memory) {}\n }\n\n /// @inheritdoc IKeep3rHelper\n function getPaymentParams(uint256 _bonds)\n external\n view\n virtual\n override\n returns (\n uint256 _boost,\n uint256 _oneEthQuote,\n uint256 _extra\n )\n {\n _oneEthQuote = quote(1 ether);\n _boost = getRewardBoostFor(_bonds);\n _extra = workExtraGas;\n }\n\n /// @inheritdoc IKeep3rHelper\n function getKP3RsAtTick(\n uint256 _liquidityAmount,\n int56 _tickDifference,\n uint256 _timeInterval\n ) external pure override returns (uint256 _kp3rAmount) {\n uint160 sqrtRatioX96 = TickMath.getSqrtRatioAtTick(int24(_tickDifference / int256(_timeInterval)));\n _kp3rAmount = FullMath.mulDiv(1 << 96, _liquidityAmount, sqrtRatioX96);\n }\n\n /// @inheritdoc IKeep3rHelper\n function getQuoteAtTick(\n uint128 _baseAmount,\n int56 _tickDifference,\n uint256 _timeInterval\n ) public pure override returns (uint256 _quoteAmount) {\n uint160 sqrtRatioX96 = TickMath.getSqrtRatioAtTick(int24(_tickDifference / int256(_timeInterval)));\n\n if (sqrtRatioX96 <= type(uint128).max) {\n uint256 ratioX192 = uint256(sqrtRatioX96) * sqrtRatioX96;\n _quoteAmount = FullMath.mulDiv(1 << 192, _baseAmount, ratioX192);\n } else {\n uint256 ratioX128 = FullMath.mulDiv(sqrtRatioX96, sqrtRatioX96, 1 << 64);\n _quoteAmount = FullMath.mulDiv(1 << 128, _baseAmount, ratioX128);\n }\n }\n\n /// @notice Gets the gas basefee cost to calculate keeper rewards\n /// @dev Keepers are required to pay a priority fee to be included, this function recognizes a minimum priority fee\n /// @return _baseFee The block's basefee + a minimum priority fee, or a preset minimum gas fee\n function _getBasefee() internal view virtual returns (uint256 _baseFee) {\n return Math.max(minBaseFee, block.basefee + minPriorityFee);\n }\n}\n" - }, - "solidity/for-test/Keep3rHelperForTest.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../contracts/Keep3rHelper.sol';\n\ncontract Keep3rHelperForTest is Keep3rHelper {\n uint256 public basefee;\n\n constructor(\n address _kp3r,\n address _keep3rV2,\n address _governance,\n address _kp3rWethPool\n ) Keep3rHelper(_kp3r, _keep3rV2, _governance, _kp3rWethPool) {}\n\n function _getBasefee() internal view override returns (uint256) {\n return basefee != 0 ? (basefee + minPriorityFee) : super._getBasefee();\n }\n\n function setBaseFee(uint256 _baseFee) external {\n basefee = _baseFee;\n }\n}\n" - }, - "solidity/contracts/sidechain/Keep3rHelperSidechain.sol": { - "content": "// SPDX-License-Identifier: MIT\n\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../Keep3rHelper.sol';\nimport '../../interfaces/sidechain/IKeep3rHelperSidechain.sol';\n\ncontract Keep3rHelperSidechain is IKeep3rHelperSidechain, Keep3rHelper {\n /// @inheritdoc IKeep3rHelperSidechain\n mapping(address => address) public override oracle;\n /// @inheritdoc IKeep3rHelperSidechain\n IKeep3rHelperParameters.TokenOraclePool public override wethUSDPool;\n\n /// @notice Ethereum mainnet WETH address used for quoting references\n address public immutable override WETH;\n\n /// @param _keep3rV2 Address of sidechain Keep3r implementation\n /// @param _governance Address of governance\n /// @param _kp3rWethOracle Address of oracle used for KP3R/WETH quote\n /// @param _wethUsdOracle Address of oracle used for WETH/USD quote\n /// @dev Oracle pools should use 18 decimals tokens\n constructor(\n address _keep3rV2,\n address _governance,\n address _kp3r,\n address _weth,\n address _kp3rWethOracle,\n address _wethUsdOracle\n ) Keep3rHelper(_kp3r, _keep3rV2, _governance, _kp3rWethOracle) {\n WETH = _weth;\n wethUSDPool = _validateOraclePool(_wethUsdOracle, _weth);\n _setQuoteTwapTime(1 days);\n workExtraGas = 0;\n }\n\n /// @inheritdoc IKeep3rHelper\n /// @notice Uses valid wKP3R address from Keep3rSidechain to query keeper bonds\n function bonds(address _keeper) public view override(Keep3rHelper, IKeep3rHelper) returns (uint256 _amountBonded) {\n address wKP3R = IKeep3r(keep3rV2).keep3rV1();\n return IKeep3r(keep3rV2).bonds(_keeper, wKP3R);\n }\n\n /// @inheritdoc IKeep3rHelperSidechain\n function setOracle(address _liquidity, address _oracle) external override onlyGovernance {\n if (_liquidity == address(0) || _oracle == address(0)) revert ZeroAddress();\n oracle[_liquidity] = _oracle;\n emit OracleSet(_liquidity, _oracle);\n }\n\n /// @inheritdoc IKeep3rHelperSidechain\n function quoteUsdToEth(uint256 _usd) public view virtual override returns (uint256 _amountOut) {\n uint32[] memory _secondsAgos = new uint32[](2);\n _secondsAgos[1] = quoteTwapTime;\n\n /// @dev Oracle is compatible with IUniswapV3Pool\n (int56[] memory _tickCumulatives, ) = IUniswapV3Pool(wethUSDPool.poolAddress).observe(_secondsAgos);\n int56 _difference = _tickCumulatives[0] - _tickCumulatives[1];\n _amountOut = getQuoteAtTick(uint128(_usd), wethUSDPool.isTKNToken0 ? _difference : -_difference, quoteTwapTime);\n }\n\n /// @inheritdoc IKeep3rHelperSidechain\n function setWethUsdPool(address _poolAddress) external override onlyGovernance {\n if (_poolAddress == address(0)) revert ZeroAddress();\n _setWethUsdPool(_poolAddress);\n }\n\n /// @inheritdoc IKeep3rHelper\n function getPaymentParams(uint256 _bonds)\n external\n view\n virtual\n override(Keep3rHelper, IKeep3rHelper)\n returns (\n uint256 _boost,\n uint256 _oneUsdQuote,\n uint256 _extraGas\n )\n {\n _oneUsdQuote = quote(quoteUsdToEth(1 ether));\n _boost = getRewardBoostFor(_bonds);\n _extraGas = workExtraGas;\n }\n\n function _setWethUsdPool(address _poolAddress) internal {\n wethUSDPool = _validateOraclePool(_poolAddress, WETH);\n emit WethUSDPoolChange(wethUSDPool.poolAddress, wethUSDPool.isTKNToken0);\n }\n\n /// @dev Sidechain jobs are quoted by USD/gasUnit, baseFee is set to 1\n function _getBasefee() internal view virtual override returns (uint256 _baseFee) {\n return 1;\n }\n}\n" - }, - "solidity/for-test/peripherals/Keep3rParametersForTest.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../../contracts/peripherals/Keep3rParameters.sol';\n\ncontract Keep3rParametersForTest is Keep3rParameters {\n constructor(\n address _keep3rHelper,\n address _keep3rV1,\n address _keep3rV1Proxy\n ) Keep3rParameters(_keep3rHelper, _keep3rV1, _keep3rV1Proxy) Keep3rRoles(msg.sender) {}\n}\n" - }, - "solidity/for-test/peripherals/jobs/Keep3rJobWorkableForTest.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../../../contracts/peripherals/jobs/Keep3rJobWorkable.sol';\n\ncontract Keep3rJobWorkableForTest is Keep3rJobWorkable {\n using EnumerableSet for EnumerableSet.AddressSet;\n\n constructor(\n address _keep3rHelper,\n address _keep3rV1,\n address _keep3rV1Proxy\n ) Keep3rParameters(_keep3rHelper, _keep3rV1, _keep3rV1Proxy) Keep3rRoles(msg.sender) {}\n\n function setJob(address _job) external {\n _jobs.add(_job);\n }\n\n function setKeeper(address _keeper) external {\n _keepers.add(_keeper);\n }\n\n function setApprovedLiquidity(address _liquidity) external {\n _approvedLiquidities.add(_liquidity);\n }\n\n function setJobLiquidity(address _job, address _liquidity) external {\n _jobLiquidities[_job].add(_liquidity);\n }\n\n function viewJobLiquidityCredits(address _job) external view returns (uint256) {\n return _jobLiquidityCredits[_job];\n }\n\n function viewJobPeriodCredits(address _job) external view returns (uint256) {\n return _jobPeriodCredits[_job];\n }\n\n function viewTickCache(address _liquidity) external view returns (TickCache memory _tickCache) {\n _tickCache = _tick[_liquidity];\n }\n\n function viewGas() external view returns (uint256) {\n return _initialGas;\n }\n}\n" - }, - "solidity/for-test/peripherals/jobs/Keep3rJobMigrationForTest.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../../../contracts/peripherals/jobs/Keep3rJobMigration.sol';\n\ncontract Keep3rJobMigrationForTest is Keep3rJobMigration {\n using EnumerableSet for EnumerableSet.AddressSet;\n\n mapping(address => uint256) public settleJobAccountanceCallCount;\n\n constructor(\n address _kph,\n address _keep3rV1,\n address _keep3rV1Proxy\n ) Keep3rParameters(_kph, _keep3rV1, _keep3rV1Proxy) Keep3rRoles(msg.sender) {}\n\n function setJobToken(address _job, address _token) external {\n _jobTokens[_job].add(_token);\n }\n\n function setJobLiquidity(address _job, address _liquidity) external {\n _jobLiquidities[_job].add(_liquidity);\n }\n\n function viewJobTokenListLength(address _job) external view returns (uint256) {\n return _jobTokens[_job].length();\n }\n\n function viewJobLiquidityList(address _job) external view returns (address[] memory _list) {\n _list = _jobLiquidities[_job].values();\n }\n\n function viewJobPeriodCredits(address _job) external view returns (uint256) {\n return _jobPeriodCredits[_job];\n }\n\n function viewJobLiquidityCredits(address _job) external view returns (uint256) {\n return _jobLiquidityCredits[_job];\n }\n\n function viewMigrationCreatedAt(address _fromJob, address _toJob) external view returns (uint256) {\n return _migrationCreatedAt[_fromJob][_toJob];\n }\n\n function isJob(address _job) external view returns (bool) {\n return _jobs.contains(_job);\n }\n\n function _settleJobAccountance(address _job) internal override {\n settleJobAccountanceCallCount[_job]++;\n }\n}\n" - }, - "solidity/for-test/peripherals/jobs/Keep3rJobManagerForTest.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../../../contracts/peripherals/jobs/Keep3rJobManager.sol';\n\ncontract Keep3rJobManagerForTest is Keep3rJobManager {\n using EnumerableSet for EnumerableSet.AddressSet;\n\n constructor(\n address _keep3rHelper,\n address _keep3rV1,\n address _keep3rV1Proxy\n ) Keep3rRoles(msg.sender) {}\n\n function isJob(address _job) external view returns (bool _isJob) {\n _isJob = _jobs.contains(_job);\n }\n}\n" - }, - "solidity/for-test/peripherals/jobs/Keep3rJobOwnershipForTest.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../../../contracts/peripherals/jobs/Keep3rJobOwnership.sol';\n\ncontract Keep3rJobOwnershipForTest is Keep3rJobOwnership {}\n" - }, - "solidity/for-test/libraries/LiquidityAmountsForTest.sol": { - "content": "// SPDX-License-Identifier: GPL-2.0-or-later\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../../contracts/libraries/FullMath.sol';\nimport '../../contracts/libraries/FixedPoint96.sol';\n\n/// @dev Made this library into a contract to be able to calculate liquidity more precisely for tests\n\n// solhint-disable\ncontract LiquidityAmountsForTest {\n function toUint128(uint256 x) private pure returns (uint128 y) {\n require((y = uint128(x)) == x);\n }\n\n function getLiquidityForAmount0(\n uint160 sqrtRatioAX96,\n uint160 sqrtRatioBX96,\n uint256 amount0\n ) public pure returns (uint128 liquidity) {\n if (sqrtRatioAX96 > sqrtRatioBX96) (sqrtRatioAX96, sqrtRatioBX96) = (sqrtRatioBX96, sqrtRatioAX96);\n uint256 intermediate = FullMath.mulDiv(sqrtRatioAX96, sqrtRatioBX96, FixedPoint96.Q96);\n return toUint128(FullMath.mulDiv(amount0, intermediate, sqrtRatioBX96 - sqrtRatioAX96));\n }\n\n function getLiquidityForAmount1(\n uint160 sqrtRatioAX96,\n uint160 sqrtRatioBX96,\n uint256 amount1\n ) public pure returns (uint128 liquidity) {\n if (sqrtRatioAX96 > sqrtRatioBX96) (sqrtRatioAX96, sqrtRatioBX96) = (sqrtRatioBX96, sqrtRatioAX96);\n return toUint128(FullMath.mulDiv(amount1, FixedPoint96.Q96, sqrtRatioBX96 - sqrtRatioAX96));\n }\n\n function getLiquidityForAmounts(\n uint160 sqrtRatioX96,\n uint160 sqrtRatioAX96,\n uint160 sqrtRatioBX96,\n uint256 amount0,\n uint256 amount1\n ) external pure returns (uint128 liquidity) {\n if (sqrtRatioAX96 > sqrtRatioBX96) (sqrtRatioAX96, sqrtRatioBX96) = (sqrtRatioBX96, sqrtRatioAX96);\n\n if (sqrtRatioX96 <= sqrtRatioAX96) {\n liquidity = getLiquidityForAmount0(sqrtRatioAX96, sqrtRatioBX96, amount0);\n } else if (sqrtRatioX96 < sqrtRatioBX96) {\n uint128 liquidity0 = getLiquidityForAmount0(sqrtRatioX96, sqrtRatioBX96, amount0);\n uint128 liquidity1 = getLiquidityForAmount1(sqrtRatioAX96, sqrtRatioX96, amount1);\n\n liquidity = liquidity0 < liquidity1 ? liquidity0 : liquidity1;\n } else {\n liquidity = getLiquidityForAmount1(sqrtRatioAX96, sqrtRatioBX96, amount1);\n }\n }\n\n function getAmount0ForLiquidity(\n uint160 sqrtRatioAX96,\n uint160 sqrtRatioBX96,\n uint128 liquidity\n ) public pure returns (uint256 amount0) {\n if (sqrtRatioAX96 > sqrtRatioBX96) (sqrtRatioAX96, sqrtRatioBX96) = (sqrtRatioBX96, sqrtRatioAX96);\n\n return FullMath.mulDiv(uint256(liquidity) << FixedPoint96.RESOLUTION, sqrtRatioBX96 - sqrtRatioAX96, sqrtRatioBX96) / sqrtRatioAX96;\n }\n\n function getAmount1ForLiquidity(\n uint160 sqrtRatioAX96,\n uint160 sqrtRatioBX96,\n uint128 liquidity\n ) public pure returns (uint256 amount1) {\n if (sqrtRatioAX96 > sqrtRatioBX96) (sqrtRatioAX96, sqrtRatioBX96) = (sqrtRatioBX96, sqrtRatioAX96);\n\n return FullMath.mulDiv(liquidity, sqrtRatioBX96 - sqrtRatioAX96, FixedPoint96.Q96);\n }\n\n function getAmountsForLiquidity(\n uint160 sqrtRatioX96,\n uint160 sqrtRatioAX96,\n uint160 sqrtRatioBX96,\n uint128 liquidity\n ) external pure returns (uint256 amount0, uint256 amount1) {\n if (sqrtRatioAX96 > sqrtRatioBX96) (sqrtRatioAX96, sqrtRatioBX96) = (sqrtRatioBX96, sqrtRatioAX96);\n\n if (sqrtRatioX96 <= sqrtRatioAX96) {\n amount0 = getAmount0ForLiquidity(sqrtRatioAX96, sqrtRatioBX96, liquidity);\n } else if (sqrtRatioX96 < sqrtRatioBX96) {\n amount0 = getAmount0ForLiquidity(sqrtRatioX96, sqrtRatioBX96, liquidity);\n amount1 = getAmount1ForLiquidity(sqrtRatioAX96, sqrtRatioX96, liquidity);\n } else {\n amount1 = getAmount1ForLiquidity(sqrtRatioAX96, sqrtRatioBX96, liquidity);\n }\n }\n}\n" - }, - "solidity/for-test/IUniswapV3PoolForTest.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '@uniswap/v3-core/contracts/interfaces/IERC20Minimal.sol';\nimport '@uniswap/v3-core/contracts/interfaces/IUniswapV3Pool.sol';\n\n// solhint-disable-next-line no-empty-blocks\ninterface IUniswapV3PoolForTest is IERC20Minimal, IUniswapV3Pool {\n\n}\n" - }, - "@uniswap/v3-core/contracts/interfaces/IERC20Minimal.sol": { - "content": "// SPDX-License-Identifier: GPL-2.0-or-later\npragma solidity >=0.5.0;\n\n/// @title Minimal ERC20 interface for Uniswap\n/// @notice Contains a subset of the full ERC20 interface that is used in Uniswap V3\ninterface IERC20Minimal {\n /// @notice Returns the balance of a token\n /// @param account The account for which to look up the number of tokens it has, i.e. its balance\n /// @return The number of tokens held by the account\n function balanceOf(address account) external view returns (uint256);\n\n /// @notice Transfers the amount of token from the `msg.sender` to the recipient\n /// @param recipient The account that will receive the amount transferred\n /// @param amount The number of tokens to send from the sender to the recipient\n /// @return Returns true for a successful transfer, false for an unsuccessful transfer\n function transfer(address recipient, uint256 amount) external returns (bool);\n\n /// @notice Returns the current allowance given to a spender by an owner\n /// @param owner The account of the token owner\n /// @param spender The account of the token spender\n /// @return The current allowance granted by `owner` to `spender`\n function allowance(address owner, address spender) external view returns (uint256);\n\n /// @notice Sets the allowance of a spender from the `msg.sender` to the value `amount`\n /// @param spender The account which will be allowed to spend a given amount of the owners tokens\n /// @param amount The amount of tokens allowed to be used by `spender`\n /// @return Returns true for a successful approval, false for unsuccessful\n function approve(address spender, uint256 amount) external returns (bool);\n\n /// @notice Transfers `amount` tokens from `sender` to `recipient` up to the allowance given to the `msg.sender`\n /// @param sender The account from which the transfer will be initiated\n /// @param recipient The recipient of the transfer\n /// @param amount The amount of the transfer\n /// @return Returns true for a successful transfer, false for unsuccessful\n function transferFrom(\n address sender,\n address recipient,\n uint256 amount\n ) external returns (bool);\n\n /// @notice Event emitted when tokens are transferred from one address to another, either via `#transfer` or `#transferFrom`.\n /// @param from The account from which the tokens were sent, i.e. the balance decreased\n /// @param to The account to which the tokens were sent, i.e. the balance increased\n /// @param value The amount of tokens that were transferred\n event Transfer(address indexed from, address indexed to, uint256 value);\n\n /// @notice Event emitted when the approval amount for the spender of a given owner's tokens changes.\n /// @param owner The account that approved spending of its tokens\n /// @param spender The account for which the spending allowance was modified\n /// @param value The new allowance from the owner to the spender\n event Approval(address indexed owner, address indexed spender, uint256 value);\n}\n" - } - }, - "settings": { - "optimizer": { - "enabled": true, - "runs": 33 - }, - "outputSelection": { - "*": { - "*": [ - "storageLayout", - "abi", - "evm.bytecode", - "evm.deployedBytecode", - "evm.methodIdentifiers", - "metadata", - "devdoc", - "userdoc", - "evm.gasEstimates" - ], - "": [ - "ast" - ] - } - }, - "metadata": { - "useLiteralContent": true - }, - "libraries": { - "": { - "__CACHE_BREAKER__": "0x00000000d41867734bbee4c6863d9255b2b06ac1" - } - } - } -} \ No newline at end of file diff --git a/deployments/goerli/solcInputs/8c968687fa7312972c014a5aac38beba.json b/deployments/goerli/solcInputs/8c968687fa7312972c014a5aac38beba.json deleted file mode 100644 index a83b63d..0000000 --- a/deployments/goerli/solcInputs/8c968687fa7312972c014a5aac38beba.json +++ /dev/null @@ -1,334 +0,0 @@ -{ - "language": "Solidity", - "sources": { - "solidity/contracts/Keep3r.sol": { - "content": "// SPDX-License-Identifier: MIT\n\n/*\n\nCoded for The Keep3r Network with ♥ by\n\n██████╗░███████╗███████╗██╗░░░██╗░░░░░░░██╗░█████╗░███╗░░██╗██████╗░███████╗██████╗░██╗░░░░░░█████╗░███╗░░██╗██████╗░\n██╔══██╗██╔════╝██╔════╝██║░░░██║░░██╗░░██║██╔══██╗████╗░██║██╔══██╗██╔════╝██╔══██╗██║░░░░░██╔══██╗████╗░██║██╔══██╗\n██║░░██║█████╗░░█████╗░░██║░░░╚██╗████╗██╔╝██║░░██║██╔██╗██║██║░░██║█████╗░░██████╔╝██║░░░░░███████║██╔██╗██║██║░░██║\n██║░░██║██╔══╝░░██╔══╝░░██║░░░░████╔═████║░██║░░██║██║╚████║██║░░██║██╔══╝░░██╔══██╗██║░░░░░██╔══██║██║╚████║██║░░██║\n██████╔╝███████╗██║░░░░░██║░░░░╚██╔╝░╚██╔╝░╚█████╔╝██║░╚███║██████╔╝███████╗██║░░██║███████╗██║░░██║██║░╚███║██████╔╝\n╚═════╝░╚══════╝╚═╝░░░░░╚═╝░░░░░╚═╝░░░╚═╝░░░╚════╝░╚═╝░░╚══╝╚═════╝░╚══════╝╚═╝░░╚═╝╚══════╝╚═╝░░╚═╝╚═╝░░╚══╝╚═════╝░\n\nhttps://defi.sucks\n\n*/\n\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../interfaces/IKeep3r.sol';\nimport './peripherals/jobs/Keep3rJobs.sol';\nimport './peripherals/keepers/Keep3rKeepers.sol';\nimport './peripherals/DustCollector.sol';\n\ncontract Keep3r is IKeep3r, Keep3rJobs, Keep3rKeepers {\n constructor(\n address _governance,\n address _keep3rHelper,\n address _keep3rV1,\n address _keep3rV1Proxy\n ) Keep3rParameters(_keep3rHelper, _keep3rV1, _keep3rV1Proxy) Keep3rRoles(_governance) {}\n}\n" - }, - "solidity/interfaces/IKeep3r.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport './peripherals/IKeep3rJobs.sol';\nimport './peripherals/IKeep3rKeepers.sol';\nimport './peripherals/IKeep3rParameters.sol';\n\n// solhint-disable-next-line no-empty-blocks\n\n/// @title Keep3rV2 contract\n/// @notice This contract inherits all the functionality of Keep3rV2\ninterface IKeep3r is IKeep3rJobs, IKeep3rKeepers, IKeep3rParameters {\n\n}\n" - }, - "solidity/contracts/peripherals/jobs/Keep3rJobs.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../../../interfaces/peripherals/IKeep3rJobs.sol';\nimport './Keep3rJobManager.sol';\nimport './Keep3rJobWorkable.sol';\nimport './Keep3rJobDisputable.sol';\n\nabstract contract Keep3rJobs is IKeep3rJobs, Keep3rJobManager, Keep3rJobWorkable, Keep3rJobDisputable {}\n" - }, - "solidity/contracts/peripherals/keepers/Keep3rKeepers.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../../../interfaces/peripherals/IKeep3rKeepers.sol';\nimport './Keep3rKeeperDisputable.sol';\n\nabstract contract Keep3rKeepers is IKeep3rKeepers, Keep3rKeeperDisputable {}\n" - }, - "solidity/contracts/peripherals/DustCollector.sol": { - "content": "// SPDX-License-Identifier: MIT\n\npragma solidity >=0.8.4 <0.9.0;\n\nimport '@openzeppelin/contracts/token/ERC20/IERC20.sol';\nimport '@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol';\nimport '../../contracts/peripherals/Governable.sol';\nimport '../../interfaces/peripherals/IDustCollector.sol';\n\nabstract contract DustCollector is IDustCollector, Governable {\n using SafeERC20 for IERC20;\n\n address internal constant _ETH_ADDRESS = 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE;\n\n function sendDust(\n address _token,\n uint256 _amount,\n address _to\n ) external override onlyGovernance {\n if (_to == address(0)) revert ZeroAddress();\n if (_token == _ETH_ADDRESS) {\n payable(_to).transfer(_amount);\n } else {\n IERC20(_token).safeTransfer(_to, _amount);\n }\n emit DustSent(_token, _amount, _to);\n }\n}\n" - }, - "solidity/interfaces/peripherals/IKeep3rJobs.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport './IKeep3rDisputable.sol';\n\n/// @title Keep3rJobOwnership contract\n/// @notice Handles the ownership of the jobs\ninterface IKeep3rJobOwnership {\n // Events\n\n /// @notice Emitted when Keep3rJobOwnership#changeJobOwnership is called\n /// @param _job The address of the job proposed to have a change of owner\n /// @param _owner The current owner of the job\n /// @param _pendingOwner The new address proposed to be the owner of the job\n event JobOwnershipChange(address indexed _job, address indexed _owner, address indexed _pendingOwner);\n\n /// @notice Emitted when Keep3rJobOwnership#JobOwnershipAssent is called\n /// @param _job The address of the job which the proposed owner will now own\n /// @param _previousOwner The previous owner of the job\n /// @param _newOwner The new owner of the job\n event JobOwnershipAssent(address indexed _job, address indexed _previousOwner, address indexed _newOwner);\n\n // Errors\n\n /// @notice Throws when the caller of the function is not the job owner\n error OnlyJobOwner();\n\n /// @notice Throws when the caller of the function is not the pending job owner\n error OnlyPendingJobOwner();\n\n // Variables\n\n /// @notice Maps the job to the owner of the job\n /// @param _job The address of the job\n /// @return _owner The address of the owner of the job\n function jobOwner(address _job) external view returns (address _owner);\n\n /// @notice Maps the job to its pending owner\n /// @param _job The address of the job\n /// @return _pendingOwner The address of the pending owner of the job\n function jobPendingOwner(address _job) external view returns (address _pendingOwner);\n\n // Methods\n\n /// @notice Proposes a new address to be the owner of the job\n /// @param _job The address of the job\n /// @param _newOwner The address of the proposed new owner\n function changeJobOwnership(address _job, address _newOwner) external;\n\n /// @notice The proposed address accepts to be the owner of the job\n /// @param _job The address of the job\n function acceptJobOwnership(address _job) external;\n}\n\n/// @title Keep3rJobManager contract\n/// @notice Handles the addition and withdrawal of credits from a job\ninterface IKeep3rJobManager is IKeep3rJobOwnership {\n // Events\n\n /// @notice Emitted when Keep3rJobManager#addJob is called\n /// @param _job The address of the job to add\n /// @param _jobOwner The job's owner\n event JobAddition(address indexed _job, address indexed _jobOwner);\n\n // Errors\n\n /// @notice Throws when trying to add a job that has already been added\n error JobAlreadyAdded();\n\n /// @notice Throws when the address that is trying to register as a keeper is already a keeper\n error AlreadyAKeeper();\n\n // Methods\n\n /// @notice Allows any caller to add a new job\n /// @param _job Address of the contract for which work should be performed\n function addJob(address _job) external;\n}\n\n/// @title Keep3rJobFundableCredits contract\n/// @notice Handles the addition and withdrawal of credits from a job\ninterface IKeep3rJobFundableCredits is IKeep3rJobOwnership {\n // Events\n\n /// @notice Emitted when Keep3rJobFundableCredits#addTokenCreditsToJob is called\n /// @param _job The address of the job being credited\n /// @param _token The address of the token being provided\n /// @param _provider The user that calls the function\n /// @param _amount The amount of credit being added to the job\n event TokenCreditAddition(address indexed _job, address indexed _token, address indexed _provider, uint256 _amount);\n\n /// @notice Emitted when Keep3rJobFundableCredits#withdrawTokenCreditsFromJob is called\n /// @param _job The address of the job from which the credits are withdrawn\n /// @param _token The credit being withdrawn from the job\n /// @param _receiver The user that receives the tokens\n /// @param _amount The amount of credit withdrawn\n event TokenCreditWithdrawal(address indexed _job, address indexed _token, address indexed _receiver, uint256 _amount);\n\n // Errors\n\n /// @notice Throws when the token is KP3R, as it should not be used for direct token payments\n error TokenUnallowed();\n\n /// @notice Throws when the token withdraw cooldown has not yet passed\n error JobTokenCreditsLocked();\n\n /// @notice Throws when the user tries to withdraw more tokens than it has\n error InsufficientJobTokenCredits();\n\n // Variables\n\n /// @notice Last block where tokens were added to the job\n /// @param _job The address of the job credited\n /// @param _token The address of the token credited\n /// @return _timestamp The last block where tokens were added to the job\n function jobTokenCreditsAddedAt(address _job, address _token) external view returns (uint256 _timestamp);\n\n // Methods\n\n /// @notice Add credit to a job to be paid out for work\n /// @param _job The address of the job being credited\n /// @param _token The address of the token being credited\n /// @param _amount The amount of credit being added\n function addTokenCreditsToJob(\n address _job,\n address _token,\n uint256 _amount\n ) external;\n\n /// @notice Withdraw credit from a job\n /// @param _job The address of the job from which the credits are withdrawn\n /// @param _token The address of the token being withdrawn\n /// @param _amount The amount of token to be withdrawn\n /// @param _receiver The user that will receive tokens\n function withdrawTokenCreditsFromJob(\n address _job,\n address _token,\n uint256 _amount,\n address _receiver\n ) external;\n}\n\n/// @title Keep3rJobFundableLiquidity contract\n/// @notice Handles the funding of jobs through specific liquidity pairs\ninterface IKeep3rJobFundableLiquidity is IKeep3rJobOwnership {\n // Events\n\n /// @notice Emitted when Keep3rJobFundableLiquidity#approveLiquidity function is called\n /// @param _liquidity The address of the liquidity pair being approved\n event LiquidityApproval(address _liquidity);\n\n /// @notice Emitted when Keep3rJobFundableLiquidity#revokeLiquidity function is called\n /// @param _liquidity The address of the liquidity pair being revoked\n event LiquidityRevocation(address _liquidity);\n\n /// @notice Emitted when IKeep3rJobFundableLiquidity#addLiquidityToJob function is called\n /// @param _job The address of the job to which liquidity will be added\n /// @param _liquidity The address of the liquidity being added\n /// @param _provider The user that calls the function\n /// @param _amount The amount of liquidity being added\n event LiquidityAddition(address indexed _job, address indexed _liquidity, address indexed _provider, uint256 _amount);\n\n /// @notice Emitted when IKeep3rJobFundableLiquidity#withdrawLiquidityFromJob function is called\n /// @param _job The address of the job of which liquidity will be withdrawn from\n /// @param _liquidity The address of the liquidity being withdrawn\n /// @param _receiver The receiver of the liquidity tokens\n /// @param _amount The amount of liquidity being withdrawn from the job\n event LiquidityWithdrawal(address indexed _job, address indexed _liquidity, address indexed _receiver, uint256 _amount);\n\n /// @notice Emitted when Keep3rJobFundableLiquidity#addLiquidityToJob function is called\n /// @param _job The address of the job whose credits will be updated\n /// @param _rewardedAt The time at which the job was last rewarded\n /// @param _currentCredits The current credits of the job\n /// @param _periodCredits The credits of the job for the current period\n event LiquidityCreditsReward(address indexed _job, uint256 _rewardedAt, uint256 _currentCredits, uint256 _periodCredits);\n\n /// @notice Emitted when Keep3rJobFundableLiquidity#forceLiquidityCreditsToJob function is called\n /// @param _job The address of the job whose credits will be updated\n /// @param _rewardedAt The time at which the job was last rewarded\n /// @param _currentCredits The current credits of the job\n event LiquidityCreditsForced(address indexed _job, uint256 _rewardedAt, uint256 _currentCredits);\n\n // Errors\n\n /// @notice Throws when the liquidity being approved has already been approved\n error LiquidityPairApproved();\n\n /// @notice Throws when the liquidity being removed has not been approved\n error LiquidityPairUnexistent();\n\n /// @notice Throws when trying to add liquidity to an unapproved pool\n error LiquidityPairUnapproved();\n\n /// @notice Throws when the job doesn't have the requested liquidity\n error JobLiquidityUnexistent();\n\n /// @notice Throws when trying to remove more liquidity than the job has\n error JobLiquidityInsufficient();\n\n /// @notice Throws when trying to add less liquidity than the minimum liquidity required\n error JobLiquidityLessThanMin();\n\n // Structs\n\n /// @notice Stores the tick information of the different liquidity pairs\n struct TickCache {\n int56 current; // Tracks the current tick\n int56 difference; // Stores the difference between the current tick and the last tick\n uint256 period; // Stores the period at which the last observation was made\n }\n\n // Variables\n\n /// @notice Lists liquidity pairs\n /// @return _list An array of addresses with all the approved liquidity pairs\n function approvedLiquidities() external view returns (address[] memory _list);\n\n /// @notice Amount of liquidity in a specified job\n /// @param _job The address of the job being checked\n /// @param _liquidity The address of the liquidity we are checking\n /// @return _amount Amount of liquidity in the specified job\n function liquidityAmount(address _job, address _liquidity) external view returns (uint256 _amount);\n\n /// @notice Last time the job was rewarded liquidity credits\n /// @param _job The address of the job being checked\n /// @return _timestamp Timestamp of the last time the job was rewarded liquidity credits\n function rewardedAt(address _job) external view returns (uint256 _timestamp);\n\n /// @notice Last time the job was worked\n /// @param _job The address of the job being checked\n /// @return _timestamp Timestamp of the last time the job was worked\n function workedAt(address _job) external view returns (uint256 _timestamp);\n\n // Methods\n\n /// @notice Returns the liquidity credits of a given job\n /// @param _job The address of the job of which we want to know the liquidity credits\n /// @return _amount The liquidity credits of a given job\n function jobLiquidityCredits(address _job) external view returns (uint256 _amount);\n\n /// @notice Returns the credits of a given job for the current period\n /// @param _job The address of the job of which we want to know the period credits\n /// @return _amount The credits the given job has at the current period\n function jobPeriodCredits(address _job) external view returns (uint256 _amount);\n\n /// @notice Calculates the total credits of a given job\n /// @param _job The address of the job of which we want to know the total credits\n /// @return _amount The total credits of the given job\n function totalJobCredits(address _job) external view returns (uint256 _amount);\n\n /// @notice Calculates how many credits should be rewarded periodically for a given liquidity amount\n /// @dev _periodCredits = underlying KP3Rs for given liquidity amount * rewardPeriod / inflationPeriod\n /// @param _liquidity The address of the liquidity to provide\n /// @param _amount The amount of liquidity to provide\n /// @return _periodCredits The amount of KP3R periodically minted for the given liquidity\n function quoteLiquidity(address _liquidity, uint256 _amount) external view returns (uint256 _periodCredits);\n\n /// @notice Observes the current state of the liquidity pair being observed and updates TickCache with the information\n /// @param _liquidity The address of the liquidity pair being observed\n /// @return _tickCache The updated TickCache\n function observeLiquidity(address _liquidity) external view returns (TickCache memory _tickCache);\n\n /// @notice Gifts liquidity credits to the specified job\n /// @param _job The address of the job being credited\n /// @param _amount The amount of liquidity credits to gift\n function forceLiquidityCreditsToJob(address _job, uint256 _amount) external;\n\n /// @notice Approve a liquidity pair for being accepted in future\n /// @param _liquidity The address of the liquidity accepted\n function approveLiquidity(address _liquidity) external;\n\n /// @notice Revoke a liquidity pair from being accepted in future\n /// @param _liquidity The liquidity no longer accepted\n function revokeLiquidity(address _liquidity) external;\n\n /// @notice Allows anyone to fund a job with liquidity\n /// @param _job The address of the job to assign liquidity to\n /// @param _liquidity The liquidity being added\n /// @param _amount The amount of liquidity tokens to add\n function addLiquidityToJob(\n address _job,\n address _liquidity,\n uint256 _amount\n ) external;\n\n /// @notice Unbond liquidity for a job\n /// @dev Can only be called by the job's owner\n /// @param _job The address of the job being unbonded from\n /// @param _liquidity The liquidity being unbonded\n /// @param _amount The amount of liquidity being removed\n function unbondLiquidityFromJob(\n address _job,\n address _liquidity,\n uint256 _amount\n ) external;\n\n /// @notice Withdraw liquidity from a job\n /// @param _job The address of the job being withdrawn from\n /// @param _liquidity The liquidity being withdrawn\n /// @param _receiver The address that will receive the withdrawn liquidity\n function withdrawLiquidityFromJob(\n address _job,\n address _liquidity,\n address _receiver\n ) external;\n}\n\n/// @title Keep3rJobMigration contract\n/// @notice Handles the migration process of jobs to different addresses\ninterface IKeep3rJobMigration is IKeep3rJobFundableCredits, IKeep3rJobFundableLiquidity {\n // Events\n\n /// @notice Emitted when Keep3rJobMigration#migrateJob function is called\n /// @param _fromJob The address of the job that requests to migrate\n /// @param _toJob The address at which the job requests to migrate\n event JobMigrationRequested(address indexed _fromJob, address _toJob);\n\n /// @notice Emitted when Keep3rJobMigration#acceptJobMigration function is called\n /// @param _fromJob The address of the job that requested to migrate\n /// @param _toJob The address at which the job had requested to migrate\n event JobMigrationSuccessful(address _fromJob, address indexed _toJob);\n\n // Errors\n\n /// @notice Throws when the address of the job that requests to migrate wants to migrate to its same address\n error JobMigrationImpossible();\n\n /// @notice Throws when the _toJob address differs from the address being tracked in the pendingJobMigrations mapping\n error JobMigrationUnavailable();\n\n /// @notice Throws when cooldown between migrations has not yet passed\n error JobMigrationLocked();\n\n // Variables\n\n /// @notice Maps the jobs that have requested a migration to the address they have requested to migrate to\n /// @return _toJob The address to which the job has requested to migrate to\n function pendingJobMigrations(address _fromJob) external view returns (address _toJob);\n\n // Methods\n\n /// @notice Initializes the migration process for a job by adding the request to the pendingJobMigrations mapping\n /// @param _fromJob The address of the job that is requesting to migrate\n /// @param _toJob The address at which the job is requesting to migrate\n function migrateJob(address _fromJob, address _toJob) external;\n\n /// @notice Completes the migration process for a job\n /// @dev Unbond/withdraw process doesn't get migrated\n /// @param _fromJob The address of the job that requested to migrate\n /// @param _toJob The address to which the job wants to migrate to\n function acceptJobMigration(address _fromJob, address _toJob) external;\n}\n\n/// @title Keep3rJobWorkable contract\n/// @notice Handles the mechanisms jobs can pay keepers with along with the restrictions jobs can put on keepers before they can work on jobs\ninterface IKeep3rJobWorkable is IKeep3rJobMigration {\n // Events\n\n /// @notice Emitted when a keeper is validated before a job\n /// @param _gasLeft The amount of gas that the transaction has left at the moment of keeper validation\n event KeeperValidation(uint256 _gasLeft);\n\n /// @notice Emitted when a keeper works a job\n /// @param _credit The address of the asset in which the keeper is paid\n /// @param _job The address of the job the keeper has worked\n /// @param _keeper The address of the keeper that has worked the job\n /// @param _payment The amount that has been paid out to the keeper in exchange for working the job\n /// @param _gasLeft The amount of gas that the transaction has left at the moment of payment\n event KeeperWork(address indexed _credit, address indexed _job, address indexed _keeper, uint256 _payment, uint256 _gasLeft);\n\n // Errors\n\n /// @notice Throws if work method was called without calling isKeeper or isBondedKeeper\n error GasNotInitialized();\n\n /// @notice Throws if the address claiming to be a job is not in the list of approved jobs\n error JobUnapproved();\n\n /// @notice Throws if the amount of funds in the job is less than the payment that must be paid to the keeper that works that job\n error InsufficientFunds();\n\n // Methods\n\n /// @notice Confirms if the current keeper is registered\n /// @dev Can be used for general (non critical) functions\n /// @param _keeper The keeper being investigated\n /// @return _isKeeper Whether the address passed as a parameter is a keeper or not\n function isKeeper(address _keeper) external returns (bool _isKeeper);\n\n /// @notice Confirms if the current keeper is registered and has a minimum bond of any asset.\n /// @dev Should be used for protected functions\n /// @param _keeper The keeper to check\n /// @param _bond The bond token being evaluated\n /// @param _minBond The minimum amount of bonded tokens\n /// @param _earned The minimum funds earned in the keepers lifetime\n /// @param _age The minimum keeper age required\n /// @return _isBondedKeeper Whether the `_keeper` meets the given requirements\n function isBondedKeeper(\n address _keeper,\n address _bond,\n uint256 _minBond,\n uint256 _earned,\n uint256 _age\n ) external returns (bool _isBondedKeeper);\n\n /// @notice Implemented by jobs to show that a keeper performed work\n /// @dev Automatically calculates the payment for the keeper and pays the keeper with bonded KP3R\n /// @param _keeper Address of the keeper that performed the work\n function worked(address _keeper) external;\n\n /// @notice Implemented by jobs to show that a keeper performed work\n /// @dev Pays the keeper that performs the work with KP3R\n /// @param _keeper Address of the keeper that performed the work\n /// @param _payment The reward that should be allocated for the job\n function bondedPayment(address _keeper, uint256 _payment) external;\n\n /// @notice Implemented by jobs to show that a keeper performed work\n /// @dev Pays the keeper that performs the work with a specific token\n /// @param _token The asset being awarded to the keeper\n /// @param _keeper Address of the keeper that performed the work\n /// @param _amount The reward that should be allocated\n function directTokenPayment(\n address _token,\n address _keeper,\n uint256 _amount\n ) external;\n}\n\n/// @title Keep3rJobDisputable contract\n/// @notice Handles the actions that can be taken on a disputed job\ninterface IKeep3rJobDisputable is IKeep3rDisputable, IKeep3rJobFundableCredits, IKeep3rJobFundableLiquidity {\n // Events\n\n /// @notice Emitted when Keep3rJobDisputable#slashTokenFromJob is called\n /// @param _job The address of the job from which the token will be slashed\n /// @param _token The address of the token being slashed\n /// @param _slasher The user that slashes the token\n /// @param _amount The amount of the token being slashed\n event JobSlashToken(address indexed _job, address _token, address indexed _slasher, uint256 _amount);\n\n /// @notice Emitted when Keep3rJobDisputable#slashLiquidityFromJob is called\n /// @param _job The address of the job from which the liquidity will be slashed\n /// @param _liquidity The address of the liquidity being slashed\n /// @param _slasher The user that slashes the liquidity\n /// @param _amount The amount of the liquidity being slashed\n event JobSlashLiquidity(address indexed _job, address _liquidity, address indexed _slasher, uint256 _amount);\n\n // Errors\n\n /// @notice Throws when the token trying to be slashed doesn't exist\n error JobTokenUnexistent();\n\n /// @notice Throws when someone tries to slash more tokens than the job has\n error JobTokenInsufficient();\n\n // Methods\n\n /// @notice Allows governance or slasher to slash a job specific token\n /// @param _job The address of the job from which the token will be slashed\n /// @param _token The address of the token that will be slashed\n /// @param _amount The amount of the token that will be slashed\n function slashTokenFromJob(\n address _job,\n address _token,\n uint256 _amount\n ) external;\n\n /// @notice Allows governance or a slasher to slash liquidity from a job\n /// @param _job The address being slashed\n /// @param _liquidity The address of the liquidity that will be slashed\n /// @param _amount The amount of liquidity that will be slashed\n function slashLiquidityFromJob(\n address _job,\n address _liquidity,\n uint256 _amount\n ) external;\n}\n\n// solhint-disable-next-line no-empty-blocks\ninterface IKeep3rJobs is IKeep3rJobWorkable, IKeep3rJobManager, IKeep3rJobDisputable {\n\n}\n" - }, - "solidity/interfaces/peripherals/IKeep3rKeepers.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport './IKeep3rDisputable.sol';\n\n/// @title Keep3rKeeperFundable contract\n/// @notice Handles the actions required to become a keeper\ninterface IKeep3rKeeperFundable {\n // Events\n\n /// @notice Emitted when Keep3rKeeperFundable#activate is called\n /// @param _keeper The keeper that has been activated\n /// @param _bond The asset the keeper has bonded\n /// @param _amount The amount of the asset the keeper has bonded\n event Activation(address indexed _keeper, address indexed _bond, uint256 _amount);\n\n /// @notice Emitted when Keep3rKeeperFundable#withdraw is called\n /// @param _keeper The caller of Keep3rKeeperFundable#withdraw function\n /// @param _bond The asset to withdraw from the bonding pool\n /// @param _amount The amount of funds withdrawn\n event Withdrawal(address indexed _keeper, address indexed _bond, uint256 _amount);\n\n // Errors\n\n /// @notice Throws when the address that is trying to register as a job is already a job\n error AlreadyAJob();\n\n // Methods\n\n /// @notice Beginning of the bonding process\n /// @param _bonding The asset being bonded\n /// @param _amount The amount of bonding asset being bonded\n function bond(address _bonding, uint256 _amount) external;\n\n /// @notice Beginning of the unbonding process\n /// @param _bonding The asset being unbonded\n /// @param _amount Allows for partial unbonding\n function unbond(address _bonding, uint256 _amount) external;\n\n /// @notice End of the bonding process after bonding time has passed\n /// @param _bonding The asset being activated as bond collateral\n function activate(address _bonding) external;\n\n /// @notice Withdraw funds after unbonding has finished\n /// @param _bonding The asset to withdraw from the bonding pool\n function withdraw(address _bonding) external;\n}\n\n/// @title Keep3rKeeperDisputable contract\n/// @notice Handles the actions that can be taken on a disputed keeper\ninterface IKeep3rKeeperDisputable is IKeep3rDisputable, IKeep3rKeeperFundable {\n // Events\n\n /// @notice Emitted when Keep3rKeeperDisputable#slash is called\n /// @param _keeper The address of the slashed keeper\n /// @param _slasher The user that called Keep3rKeeperDisputable#slash\n /// @param _amount The amount of credits slashed from the keeper\n event KeeperSlash(address indexed _keeper, address indexed _slasher, uint256 _amount);\n\n /// @notice Emitted when Keep3rKeeperDisputable#revoke is called\n /// @param _keeper The address of the revoked keeper\n /// @param _slasher The user that called Keep3rKeeperDisputable#revoke\n event KeeperRevoke(address indexed _keeper, address indexed _slasher);\n\n // Methods\n\n /// @notice Allows governance to slash a keeper based on a dispute\n /// @param _keeper The address being slashed\n /// @param _bonded The asset being slashed\n /// @param _bondAmount The bonded amount being slashed\n /// @param _unbondAmount The pending unbond amount being slashed\n function slash(\n address _keeper,\n address _bonded,\n uint256 _bondAmount,\n uint256 _unbondAmount\n ) external;\n\n /// @notice Blacklists a keeper from participating in the network\n /// @param _keeper The address being slashed\n function revoke(address _keeper) external;\n}\n\n// solhint-disable-next-line no-empty-blocks\n\n/// @title Keep3rKeepers contract\ninterface IKeep3rKeepers is IKeep3rKeeperDisputable {\n\n}\n" - }, - "solidity/interfaces/peripherals/IKeep3rParameters.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport './IKeep3rAccountance.sol';\n\n/// @title Keep3rParameters contract\n/// @notice Handles and sets all the required parameters for Keep3r\ninterface IKeep3rParameters is IKeep3rAccountance {\n // Events\n\n /// @notice Emitted when the Keep3rHelper address is changed\n /// @param _keep3rHelper The address of Keep3rHelper's contract\n event Keep3rHelperChange(address _keep3rHelper);\n\n /// @notice Emitted when the Keep3rV1 address is changed\n /// @param _keep3rV1 The address of Keep3rV1's contract\n event Keep3rV1Change(address _keep3rV1);\n\n /// @notice Emitted when the Keep3rV1Proxy address is changed\n /// @param _keep3rV1Proxy The address of Keep3rV1Proxy's contract\n event Keep3rV1ProxyChange(address _keep3rV1Proxy);\n\n /// @notice Emitted when bondTime is changed\n /// @param _bondTime The new bondTime\n event BondTimeChange(uint256 _bondTime);\n\n /// @notice Emitted when _liquidityMinimum is changed\n /// @param _liquidityMinimum The new _liquidityMinimum\n event LiquidityMinimumChange(uint256 _liquidityMinimum);\n\n /// @notice Emitted when _unbondTime is changed\n /// @param _unbondTime The new _unbondTime\n event UnbondTimeChange(uint256 _unbondTime);\n\n /// @notice Emitted when _rewardPeriodTime is changed\n /// @param _rewardPeriodTime The new _rewardPeriodTime\n event RewardPeriodTimeChange(uint256 _rewardPeriodTime);\n\n /// @notice Emitted when the inflationPeriod is changed\n /// @param _inflationPeriod The new inflationPeriod\n event InflationPeriodChange(uint256 _inflationPeriod);\n\n /// @notice Emitted when the fee is changed\n /// @param _fee The new token credits fee\n event FeeChange(uint256 _fee);\n\n // Variables\n\n /// @notice Address of Keep3rHelper's contract\n /// @return _keep3rHelper The address of Keep3rHelper's contract\n function keep3rHelper() external view returns (address _keep3rHelper);\n\n /// @notice Address of Keep3rV1's contract\n /// @return _keep3rV1 The address of Keep3rV1's contract\n function keep3rV1() external view returns (address _keep3rV1);\n\n /// @notice Address of Keep3rV1Proxy's contract\n /// @return _keep3rV1Proxy The address of Keep3rV1Proxy's contract\n function keep3rV1Proxy() external view returns (address _keep3rV1Proxy);\n\n /// @notice The amount of time required to pass after a keeper has bonded assets for it to be able to activate\n /// @return _days The required bondTime in days\n function bondTime() external view returns (uint256 _days);\n\n /// @notice The amount of time required to pass before a keeper can unbond what he has bonded\n /// @return _days The required unbondTime in days\n function unbondTime() external view returns (uint256 _days);\n\n /// @notice The minimum amount of liquidity required to fund a job per liquidity\n /// @return _amount The minimum amount of liquidity in KP3R\n function liquidityMinimum() external view returns (uint256 _amount);\n\n /// @notice The amount of time between each scheduled credits reward given to a job\n /// @return _days The reward period in days\n function rewardPeriodTime() external view returns (uint256 _days);\n\n /// @notice The inflation period is the denominator used to regulate the emission of KP3R\n /// @return _period The denominator used to regulate the emission of KP3R\n function inflationPeriod() external view returns (uint256 _period);\n\n /// @notice The fee to be sent to governance when a user adds liquidity to a job\n /// @return _amount The fee amount to be sent to governance when a user adds liquidity to a job\n function fee() external view returns (uint256 _amount);\n\n // Errors\n\n /// @notice Throws if the reward period is less than the minimum reward period time\n error MinRewardPeriod();\n\n /// @notice Throws if either a job or a keeper is disputed\n error Disputed();\n\n /// @notice Throws if there are no bonded assets\n error BondsUnexistent();\n\n /// @notice Throws if the time required to bond an asset has not passed yet\n error BondsLocked();\n\n /// @notice Throws if there are no bonds to withdraw\n error UnbondsUnexistent();\n\n /// @notice Throws if the time required to withdraw the bonds has not passed yet\n error UnbondsLocked();\n\n // Methods\n\n /// @notice Sets the Keep3rHelper address\n /// @param _keep3rHelper The Keep3rHelper address\n function setKeep3rHelper(address _keep3rHelper) external;\n\n /// @notice Sets the Keep3rV1 address\n /// @param _keep3rV1 The Keep3rV1 address\n function setKeep3rV1(address _keep3rV1) external;\n\n /// @notice Sets the Keep3rV1Proxy address\n /// @param _keep3rV1Proxy The Keep3rV1Proxy address\n function setKeep3rV1Proxy(address _keep3rV1Proxy) external;\n\n /// @notice Sets the bond time required to activate as a keeper\n /// @param _bond The new bond time\n function setBondTime(uint256 _bond) external;\n\n /// @notice Sets the unbond time required unbond what has been bonded\n /// @param _unbond The new unbond time\n function setUnbondTime(uint256 _unbond) external;\n\n /// @notice Sets the minimum amount of liquidity required to fund a job\n /// @param _liquidityMinimum The new minimum amount of liquidity\n function setLiquidityMinimum(uint256 _liquidityMinimum) external;\n\n /// @notice Sets the time required to pass between rewards for jobs\n /// @param _rewardPeriodTime The new amount of time required to pass between rewards\n function setRewardPeriodTime(uint256 _rewardPeriodTime) external;\n\n /// @notice Sets the new inflation period\n /// @param _inflationPeriod The new inflation period\n function setInflationPeriod(uint256 _inflationPeriod) external;\n\n /// @notice Sets the new fee\n /// @param _fee The new fee\n function setFee(uint256 _fee) external;\n}\n" - }, - "solidity/interfaces/peripherals/IKeep3rDisputable.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\n/// @title Keep3rDisputable contract\n/// @notice Creates/resolves disputes for jobs or keepers\n/// A disputed keeper is slashable and is not able to bond, activate, withdraw or receive direct payments\n/// A disputed job is slashable and is not able to pay the keepers, withdraw tokens or to migrate\ninterface IKeep3rDisputable {\n /// @notice Emitted when a keeper or a job is disputed\n /// @param _jobOrKeeper The address of the disputed keeper/job\n /// @param _disputer The user that called the function and disputed the keeper\n event Dispute(address indexed _jobOrKeeper, address indexed _disputer);\n\n /// @notice Emitted when a dispute is resolved\n /// @param _jobOrKeeper The address of the disputed keeper/job\n /// @param _resolver The user that called the function and resolved the dispute\n event Resolve(address indexed _jobOrKeeper, address indexed _resolver);\n\n /// @notice Throws when a job or keeper is already disputed\n error AlreadyDisputed();\n\n /// @notice Throws when a job or keeper is not disputed and someone tries to resolve the dispute\n error NotDisputed();\n\n /// @notice Allows governance to create a dispute for a given keeper/job\n /// @param _jobOrKeeper The address in dispute\n function dispute(address _jobOrKeeper) external;\n\n /// @notice Allows governance to resolve a dispute on a keeper/job\n /// @param _jobOrKeeper The address cleared\n function resolve(address _jobOrKeeper) external;\n}\n" - }, - "solidity/interfaces/peripherals/IKeep3rAccountance.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport './IKeep3rRoles.sol';\n\n/// @title Keep3rDisputable contract\n/// @notice Disputes keepers, or if they're already disputed, it can resolve the case\n/// @dev Argument `bonding` can be the address of either a token or a liquidity\ninterface IKeep3rAccountance is IKeep3rRoles {\n // Events\n\n /// @notice Emitted when the bonding process of a new keeper begins\n /// @param _keeper The caller of Keep3rKeeperFundable#bond function\n /// @param _bonding The asset the keeper has bonded\n /// @param _amount The amount the keeper has bonded\n event Bonding(address indexed _keeper, address indexed _bonding, uint256 _amount);\n\n /// @notice Emitted when a keeper or job begins the unbonding process to withdraw the funds\n /// @param _keeperOrJob The keeper or job that began the unbonding process\n /// @param _unbonding The liquidity pair or asset being unbonded\n /// @param _amount The amount being unbonded\n event Unbonding(address indexed _keeperOrJob, address indexed _unbonding, uint256 _amount);\n\n // Variables\n\n /// @notice Tracks the total amount of bonded KP3Rs in the contract\n /// @return _totalBonds The total amount of bonded KP3Rs in the contract\n function totalBonds() external view returns (uint256 _totalBonds);\n\n /// @notice Tracks the total KP3R earnings of a keeper since it started working\n /// @param _keeper The address of the keeper\n /// @return _workCompleted Total KP3R earnings of a keeper since it started working\n function workCompleted(address _keeper) external view returns (uint256 _workCompleted);\n\n /// @notice Tracks when a keeper was first registered\n /// @param _keeper The address of the keeper\n /// @return timestamp The time at which the keeper was first registered\n function firstSeen(address _keeper) external view returns (uint256 timestamp);\n\n /// @notice Tracks if a keeper or job has a pending dispute\n /// @param _keeperOrJob The address of the keeper or job\n /// @return _disputed Whether a keeper or job has a pending dispute\n function disputes(address _keeperOrJob) external view returns (bool _disputed);\n\n /// @notice Tracks how much a keeper has bonded of a certain token\n /// @param _keeper The address of the keeper\n /// @param _bond The address of the token being bonded\n /// @return _bonds Amount of a certain token that a keeper has bonded\n function bonds(address _keeper, address _bond) external view returns (uint256 _bonds);\n\n /// @notice The current token credits available for a job\n /// @param _job The address of the job\n /// @param _token The address of the token bonded\n /// @return _amount The amount of token credits available for a job\n function jobTokenCredits(address _job, address _token) external view returns (uint256 _amount);\n\n /// @notice Tracks the amount of assets deposited in pending bonds\n /// @param _keeper The address of the keeper\n /// @param _bonding The address of the token being bonded\n /// @return _pendingBonds Amount of a certain asset a keeper has unbonding\n function pendingBonds(address _keeper, address _bonding) external view returns (uint256 _pendingBonds);\n\n /// @notice Tracks when a bonding for a keeper can be activated\n /// @param _keeper The address of the keeper\n /// @param _bonding The address of the token being bonded\n /// @return _timestamp Time at which the bonding for a keeper can be activated\n function canActivateAfter(address _keeper, address _bonding) external view returns (uint256 _timestamp);\n\n /// @notice Tracks when keeper bonds are ready to be withdrawn\n /// @param _keeper The address of the keeper\n /// @param _bonding The address of the token being unbonded\n /// @return _timestamp Time at which the keeper bonds are ready to be withdrawn\n function canWithdrawAfter(address _keeper, address _bonding) external view returns (uint256 _timestamp);\n\n /// @notice Tracks how much keeper bonds are to be withdrawn\n /// @param _keeper The address of the keeper\n /// @param _bonding The address of the token being unbonded\n /// @return _pendingUnbonds The amount of keeper bonds that are to be withdrawn\n function pendingUnbonds(address _keeper, address _bonding) external view returns (uint256 _pendingUnbonds);\n\n /// @notice Checks whether the address has ever bonded an asset\n /// @param _keeper The address of the keeper\n /// @return _hasBonded Whether the address has ever bonded an asset\n function hasBonded(address _keeper) external view returns (bool _hasBonded);\n\n // Methods\n\n /// @notice Lists all jobs\n /// @return _jobList Array with all the jobs in _jobs\n function jobs() external view returns (address[] memory _jobList);\n\n /// @notice Lists all keepers\n /// @return _keeperList Array with all the keepers in _keepers\n function keepers() external view returns (address[] memory _keeperList);\n\n // Errors\n\n /// @notice Throws when an address is passed as a job, but that address is not a job\n error JobUnavailable();\n\n /// @notice Throws when an action that requires an undisputed job is applied on a disputed job\n error JobDisputed();\n}\n" - }, - "solidity/interfaces/peripherals/IKeep3rRoles.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport './IBaseErrors.sol';\nimport './IGovernable.sol';\nimport './IDustCollector.sol';\n\n/// @title Keep3rRoles contract\n/// @notice Manages the Keep3r specific roles\ninterface IKeep3rRoles is IBaseErrors, IDustCollector, IGovernable {\n // Events\n\n /// @notice Emitted when a slasher is added\n /// @param _slasher Address of the added slasher\n event SlasherAdded(address _slasher);\n\n /// @notice Emitted when a slasher is removed\n /// @param _slasher Address of the removed slasher\n event SlasherRemoved(address _slasher);\n\n /// @notice Emitted when a disputer is added\n /// @param _disputer Address of the added disputer\n event DisputerAdded(address _disputer);\n\n /// @notice Emitted when a disputer is removed\n /// @param _disputer Address of the removed disputer\n event DisputerRemoved(address _disputer);\n\n // Variables\n\n /// @notice Tracks whether the address is a slasher or not\n /// @param _slasher Address being checked as a slasher\n /// @return _isSlasher Whether the address is a slasher or not\n function slashers(address _slasher) external view returns (bool _isSlasher);\n\n /// @notice Tracks whether the address is a disputer or not\n /// @param _disputer Address being checked as a disputer\n /// @return _isDisputer Whether the address is a disputer or not\n function disputers(address _disputer) external view returns (bool _isDisputer);\n\n // Errors\n\n /// @notice Throws if the address is already a registered slasher\n error SlasherExistent();\n\n /// @notice Throws if caller is not a registered slasher\n error SlasherUnexistent();\n\n /// @notice Throws if the address is already a registered disputer\n error DisputerExistent();\n\n /// @notice Throws if caller is not a registered disputer\n error DisputerUnexistent();\n\n /// @notice Throws if the msg.sender is not a slasher or is not a part of governance\n error OnlySlasher();\n\n /// @notice Throws if the msg.sender is not a disputer or is not a part of governance\n error OnlyDisputer();\n\n // Methods\n\n /// @notice Registers a slasher by updating the slashers mapping\n function addSlasher(address _slasher) external;\n\n /// @notice Removes a slasher by updating the slashers mapping\n function removeSlasher(address _slasher) external;\n\n /// @notice Registers a disputer by updating the disputers mapping\n function addDisputer(address _disputer) external;\n\n /// @notice Removes a disputer by updating the disputers mapping\n function removeDisputer(address _disputer) external;\n}\n" - }, - "solidity/interfaces/peripherals/IBaseErrors.sol": { - "content": "// SPDX-License-Identifier: MIT\n\npragma solidity >=0.8.4 <0.9.0;\n\ninterface IBaseErrors {\n /// @notice Throws if a variable is assigned to the zero address\n error ZeroAddress();\n}\n" - }, - "solidity/interfaces/peripherals/IGovernable.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\n/// @title Governable contract\n/// @notice Manages the governance role\ninterface IGovernable {\n // Events\n\n /// @notice Emitted when pendingGovernance accepts to be governance\n /// @param _governance Address of the new governance\n event GovernanceSet(address _governance);\n\n /// @notice Emitted when a new governance is proposed\n /// @param _pendingGovernance Address that is proposed to be the new governance\n event GovernanceProposal(address _pendingGovernance);\n\n // Errors\n\n /// @notice Throws if the caller of the function is not governance\n error OnlyGovernance();\n\n /// @notice Throws if the caller of the function is not pendingGovernance\n error OnlyPendingGovernance();\n\n /// @notice Throws if trying to set governance to zero address\n error NoGovernanceZeroAddress();\n\n // Variables\n\n /// @notice Stores the governance address\n /// @return _governance The governance addresss\n function governance() external view returns (address _governance);\n\n /// @notice Stores the pendingGovernance address\n /// @return _pendingGovernance The pendingGovernance addresss\n function pendingGovernance() external view returns (address _pendingGovernance);\n\n // Methods\n\n /// @notice Proposes a new address to be governance\n /// @param _governance The address being proposed as the new governance\n function setGovernance(address _governance) external;\n\n /// @notice Changes the governance from the current governance to the previously proposed address\n function acceptGovernance() external;\n}\n" - }, - "solidity/interfaces/peripherals/IDustCollector.sol": { - "content": "// SPDX-License-Identifier: MIT\n\npragma solidity >=0.8.4 <0.9.0;\n\nimport './IBaseErrors.sol';\n\ninterface IDustCollector is IBaseErrors {\n /// @notice Emitted when dust is sent\n /// @param _token The token that will be transferred\n /// @param _amount The amount of the token that will be transferred\n /// @param _to The address which will receive the funds\n event DustSent(address _token, uint256 _amount, address _to);\n\n /// @notice Allows an authorized user to transfer the tokens or eth that may have been left in a contract\n /// @param _token The token that will be transferred\n /// @param _amount The amount of the token that will be transferred\n /// @param _to The address that will receive the idle funds\n function sendDust(\n address _token,\n uint256 _amount,\n address _to\n ) external;\n}\n" - }, - "solidity/contracts/peripherals/jobs/Keep3rJobManager.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport './Keep3rJobOwnership.sol';\nimport '../Keep3rAccountance.sol';\nimport '../../../interfaces/peripherals/IKeep3rJobs.sol';\n\nabstract contract Keep3rJobManager is IKeep3rJobManager, Keep3rJobOwnership, Keep3rAccountance {\n using EnumerableSet for EnumerableSet.AddressSet;\n\n /// @inheritdoc IKeep3rJobManager\n function addJob(address _job) external override {\n if (_jobs.contains(_job)) revert JobAlreadyAdded();\n if (hasBonded[_job]) revert AlreadyAKeeper();\n _jobs.add(_job);\n jobOwner[_job] = msg.sender;\n emit JobAddition(_job, msg.sender);\n }\n}\n" - }, - "solidity/contracts/peripherals/jobs/Keep3rJobWorkable.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport './Keep3rJobMigration.sol';\nimport '../../../interfaces/IKeep3rHelper.sol';\nimport '../../../interfaces/peripherals/IKeep3rJobs.sol';\n\nimport '@openzeppelin/contracts/token/ERC20/IERC20.sol';\nimport '@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol';\n\nabstract contract Keep3rJobWorkable is IKeep3rJobWorkable, Keep3rJobMigration {\n using EnumerableSet for EnumerableSet.AddressSet;\n using SafeERC20 for IERC20;\n\n uint256 internal _initialGas;\n\n /// @inheritdoc IKeep3rJobWorkable\n function isKeeper(address _keeper) external override returns (bool _isKeeper) {\n _initialGas = _getGasLeft();\n if (_keepers.contains(_keeper)) {\n emit KeeperValidation(_initialGas);\n return true;\n }\n }\n\n /// @inheritdoc IKeep3rJobWorkable\n function isBondedKeeper(\n address _keeper,\n address _bond,\n uint256 _minBond,\n uint256 _earned,\n uint256 _age\n ) external override returns (bool _isBondedKeeper) {\n _initialGas = _getGasLeft();\n if (\n _keepers.contains(_keeper) &&\n bonds[_keeper][_bond] >= _minBond &&\n workCompleted[_keeper] >= _earned &&\n block.timestamp - firstSeen[_keeper] >= _age\n ) {\n emit KeeperValidation(_initialGas);\n return true;\n }\n }\n\n /// @inheritdoc IKeep3rJobWorkable\n function worked(address _keeper) external virtual override {\n if (_initialGas == 0) revert GasNotInitialized();\n address _job = msg.sender;\n if (disputes[_job]) revert JobDisputed();\n if (!_jobs.contains(_job)) revert JobUnapproved();\n\n if (_updateJobCreditsIfNeeded(_job)) {\n emit LiquidityCreditsReward(_job, rewardedAt[_job], _jobLiquidityCredits[_job], _jobPeriodCredits[_job]);\n }\n\n (uint256 _boost, uint256 _oneEthQuote, uint256 _extraGas) = IKeep3rHelper(keep3rHelper).getPaymentParams(bonds[_keeper][keep3rV1]);\n\n uint256 _gasLeft = _getGasLeft();\n uint256 _payment = _calculatePayment(_gasLeft, _extraGas, _oneEthQuote, _boost);\n\n if (_payment > _jobLiquidityCredits[_job]) {\n _rewardJobCredits(_job);\n emit LiquidityCreditsReward(_job, rewardedAt[_job], _jobLiquidityCredits[_job], _jobPeriodCredits[_job]);\n\n _gasLeft = _getGasLeft();\n _payment = _calculatePayment(_gasLeft, _extraGas, _oneEthQuote, _boost);\n }\n\n _bondedPayment(_job, _keeper, _payment);\n delete _initialGas;\n\n emit KeeperWork(keep3rV1, _job, _keeper, _payment, _gasLeft);\n }\n\n /// @inheritdoc IKeep3rJobWorkable\n function bondedPayment(address _keeper, uint256 _payment) external override {\n address _job = msg.sender;\n\n if (disputes[_job]) revert JobDisputed();\n if (!_jobs.contains(_job)) revert JobUnapproved();\n\n if (_updateJobCreditsIfNeeded(_job)) {\n emit LiquidityCreditsReward(_job, rewardedAt[_job], _jobLiquidityCredits[_job], _jobPeriodCredits[_job]);\n }\n\n if (_payment > _jobLiquidityCredits[_job]) {\n _rewardJobCredits(_job);\n emit LiquidityCreditsReward(_job, rewardedAt[_job], _jobLiquidityCredits[_job], _jobPeriodCredits[_job]);\n }\n\n _bondedPayment(_job, _keeper, _payment);\n emit KeeperWork(keep3rV1, _job, _keeper, _payment, _getGasLeft());\n }\n\n /// @inheritdoc IKeep3rJobWorkable\n function directTokenPayment(\n address _token,\n address _keeper,\n uint256 _amount\n ) external override {\n address _job = msg.sender;\n\n if (disputes[_job]) revert JobDisputed();\n if (disputes[_keeper]) revert Disputed();\n if (!_jobs.contains(_job)) revert JobUnapproved();\n if (jobTokenCredits[_job][_token] < _amount) revert InsufficientFunds();\n jobTokenCredits[_job][_token] -= _amount;\n IERC20(_token).safeTransfer(_keeper, _amount);\n emit KeeperWork(_token, _job, _keeper, _amount, _getGasLeft());\n }\n\n function _bondedPayment(\n address _job,\n address _keeper,\n uint256 _payment\n ) internal {\n if (_payment > _jobLiquidityCredits[_job]) revert InsufficientFunds();\n\n workedAt[_job] = block.timestamp;\n _jobLiquidityCredits[_job] -= _payment;\n bonds[_keeper][keep3rV1] += _payment;\n workCompleted[_keeper] += _payment;\n totalBonds += _payment;\n }\n\n /// @notice Calculate amount to be payed in KP3R, taking into account multiple parameters\n /// @param _gasLeft Amount of gas left after working the job\n /// @param _extraGas Amount of expected unaccounted gas\n /// @param _oneEthQuote Amount of KP3R equivalent to 1 ETH\n /// @param _boost Reward given to the keeper for having bonded KP3R tokens\n /// @return _payment Amount to be payed in KP3R tokens\n function _calculatePayment(\n uint256 _gasLeft,\n uint256 _extraGas,\n uint256 _oneEthQuote,\n uint256 _boost\n ) internal view returns (uint256 _payment) {\n uint256 _accountedGas = _initialGas - _gasLeft + _extraGas;\n _payment = (((_accountedGas * _boost) / _BASE) * _oneEthQuote) / 1 ether;\n }\n\n /// @notice Return the gas left and add 1/64 in order to match real gas left at first level of depth (EIP-150)\n /// @return _gasLeft Amount of gas left recording taking into account EIP-150\n function _getGasLeft() internal view returns (uint256 _gasLeft) {\n _gasLeft = (gasleft() * 64) / 63;\n }\n}\n" - }, - "solidity/contracts/peripherals/jobs/Keep3rJobDisputable.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport './Keep3rJobFundableCredits.sol';\nimport './Keep3rJobFundableLiquidity.sol';\nimport '../Keep3rDisputable.sol';\n\nabstract contract Keep3rJobDisputable is IKeep3rJobDisputable, Keep3rDisputable, Keep3rJobFundableCredits, Keep3rJobFundableLiquidity {\n using EnumerableSet for EnumerableSet.AddressSet;\n using SafeERC20 for IERC20;\n\n /// @inheritdoc IKeep3rJobDisputable\n function slashTokenFromJob(\n address _job,\n address _token,\n uint256 _amount\n ) external override onlySlasher {\n if (!disputes[_job]) revert NotDisputed();\n if (!_jobTokens[_job].contains(_token)) revert JobTokenUnexistent();\n if (jobTokenCredits[_job][_token] < _amount) revert JobTokenInsufficient();\n\n try IERC20(_token).transfer(governance, _amount) {} catch {}\n jobTokenCredits[_job][_token] -= _amount;\n if (jobTokenCredits[_job][_token] == 0) {\n _jobTokens[_job].remove(_token);\n }\n\n emit JobSlashToken(_job, _token, msg.sender, _amount);\n }\n\n /// @inheritdoc IKeep3rJobDisputable\n function slashLiquidityFromJob(\n address _job,\n address _liquidity,\n uint256 _amount\n ) external override onlySlasher {\n if (!disputes[_job]) revert NotDisputed();\n\n _unbondLiquidityFromJob(_job, _liquidity, _amount);\n try IERC20(_liquidity).transfer(governance, _amount) {} catch {}\n emit JobSlashLiquidity(_job, _liquidity, msg.sender, _amount);\n }\n}\n" - }, - "solidity/contracts/peripherals/jobs/Keep3rJobOwnership.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../../../interfaces/peripherals/IKeep3rJobs.sol';\n\nabstract contract Keep3rJobOwnership is IKeep3rJobOwnership {\n /// @inheritdoc IKeep3rJobOwnership\n mapping(address => address) public override jobOwner;\n\n /// @inheritdoc IKeep3rJobOwnership\n mapping(address => address) public override jobPendingOwner;\n\n /// @inheritdoc IKeep3rJobOwnership\n function changeJobOwnership(address _job, address _newOwner) external override onlyJobOwner(_job) {\n jobPendingOwner[_job] = _newOwner;\n emit JobOwnershipChange(_job, jobOwner[_job], _newOwner);\n }\n\n /// @inheritdoc IKeep3rJobOwnership\n function acceptJobOwnership(address _job) external override onlyPendingJobOwner(_job) {\n address _previousOwner = jobOwner[_job];\n\n jobOwner[_job] = jobPendingOwner[_job];\n delete jobPendingOwner[_job];\n\n emit JobOwnershipAssent(msg.sender, _job, _previousOwner);\n }\n\n modifier onlyJobOwner(address _job) {\n if (msg.sender != jobOwner[_job]) revert OnlyJobOwner();\n _;\n }\n\n modifier onlyPendingJobOwner(address _job) {\n if (msg.sender != jobPendingOwner[_job]) revert OnlyPendingJobOwner();\n _;\n }\n}\n" - }, - "solidity/contracts/peripherals/Keep3rAccountance.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '@openzeppelin/contracts/utils/structs/EnumerableSet.sol';\nimport '../../interfaces/peripherals/IKeep3rAccountance.sol';\nimport './Keep3rRoles.sol';\n\nabstract contract Keep3rAccountance is IKeep3rAccountance, Keep3rRoles {\n using EnumerableSet for EnumerableSet.AddressSet;\n\n /// @notice List of all enabled keepers\n EnumerableSet.AddressSet internal _keepers;\n\n /// @inheritdoc IKeep3rAccountance\n uint256 public override totalBonds;\n\n /// @inheritdoc IKeep3rAccountance\n mapping(address => uint256) public override workCompleted;\n\n /// @inheritdoc IKeep3rAccountance\n mapping(address => uint256) public override firstSeen;\n\n /// @inheritdoc IKeep3rAccountance\n mapping(address => bool) public override disputes;\n\n /// @inheritdoc IKeep3rAccountance\n /// @notice Mapping (job => bonding => amount)\n mapping(address => mapping(address => uint256)) public override bonds;\n\n /// @inheritdoc IKeep3rAccountance\n mapping(address => mapping(address => uint256)) public override jobTokenCredits;\n\n /// @notice The current liquidity credits available for a job\n mapping(address => uint256) internal _jobLiquidityCredits;\n\n /// @notice Map the address of a job to its correspondent periodCredits\n mapping(address => uint256) internal _jobPeriodCredits;\n\n /// @notice Enumerable array of Job Tokens for Credits\n mapping(address => EnumerableSet.AddressSet) internal _jobTokens;\n\n /// @notice List of liquidities that a job has (job => liquidities)\n mapping(address => EnumerableSet.AddressSet) internal _jobLiquidities;\n\n /// @notice Liquidity pool to observe\n mapping(address => address) internal _liquidityPool;\n\n /// @notice Tracks if a pool has KP3R as token0\n mapping(address => bool) internal _isKP3RToken0;\n\n /// @inheritdoc IKeep3rAccountance\n mapping(address => mapping(address => uint256)) public override pendingBonds;\n\n /// @inheritdoc IKeep3rAccountance\n mapping(address => mapping(address => uint256)) public override canActivateAfter;\n\n /// @inheritdoc IKeep3rAccountance\n mapping(address => mapping(address => uint256)) public override canWithdrawAfter;\n\n /// @inheritdoc IKeep3rAccountance\n mapping(address => mapping(address => uint256)) public override pendingUnbonds;\n\n /// @inheritdoc IKeep3rAccountance\n mapping(address => bool) public override hasBonded;\n\n /// @notice List of all enabled jobs\n EnumerableSet.AddressSet internal _jobs;\n\n /// @inheritdoc IKeep3rAccountance\n function jobs() external view override returns (address[] memory _list) {\n _list = _jobs.values();\n }\n\n /// @inheritdoc IKeep3rAccountance\n function keepers() external view override returns (address[] memory _list) {\n _list = _keepers.values();\n }\n}\n" - }, - "@openzeppelin/contracts/utils/structs/EnumerableSet.sol": { - "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Library for managing\n * https://en.wikipedia.org/wiki/Set_(abstract_data_type)[sets] of primitive\n * types.\n *\n * Sets have the following properties:\n *\n * - Elements are added, removed, and checked for existence in constant time\n * (O(1)).\n * - Elements are enumerated in O(n). No guarantees are made on the ordering.\n *\n * ```\n * contract Example {\n * // Add the library methods\n * using EnumerableSet for EnumerableSet.AddressSet;\n *\n * // Declare a set state variable\n * EnumerableSet.AddressSet private mySet;\n * }\n * ```\n *\n * As of v3.3.0, sets of type `bytes32` (`Bytes32Set`), `address` (`AddressSet`)\n * and `uint256` (`UintSet`) are supported.\n */\nlibrary EnumerableSet {\n // To implement this library for multiple types with as little code\n // repetition as possible, we write it in terms of a generic Set type with\n // bytes32 values.\n // The Set implementation uses private functions, and user-facing\n // implementations (such as AddressSet) are just wrappers around the\n // underlying Set.\n // This means that we can only create new EnumerableSets for types that fit\n // in bytes32.\n\n struct Set {\n // Storage of set values\n bytes32[] _values;\n // Position of the value in the `values` array, plus 1 because index 0\n // means a value is not in the set.\n mapping(bytes32 => uint256) _indexes;\n }\n\n /**\n * @dev Add a value to a set. O(1).\n *\n * Returns true if the value was added to the set, that is if it was not\n * already present.\n */\n function _add(Set storage set, bytes32 value) private returns (bool) {\n if (!_contains(set, value)) {\n set._values.push(value);\n // The value is stored at length-1, but we add 1 to all indexes\n // and use 0 as a sentinel value\n set._indexes[value] = set._values.length;\n return true;\n } else {\n return false;\n }\n }\n\n /**\n * @dev Removes a value from a set. O(1).\n *\n * Returns true if the value was removed from the set, that is if it was\n * present.\n */\n function _remove(Set storage set, bytes32 value) private returns (bool) {\n // We read and store the value's index to prevent multiple reads from the same storage slot\n uint256 valueIndex = set._indexes[value];\n\n if (valueIndex != 0) {\n // Equivalent to contains(set, value)\n // To delete an element from the _values array in O(1), we swap the element to delete with the last one in\n // the array, and then remove the last element (sometimes called as 'swap and pop').\n // This modifies the order of the array, as noted in {at}.\n\n uint256 toDeleteIndex = valueIndex - 1;\n uint256 lastIndex = set._values.length - 1;\n\n if (lastIndex != toDeleteIndex) {\n bytes32 lastvalue = set._values[lastIndex];\n\n // Move the last value to the index where the value to delete is\n set._values[toDeleteIndex] = lastvalue;\n // Update the index for the moved value\n set._indexes[lastvalue] = valueIndex; // Replace lastvalue's index to valueIndex\n }\n\n // Delete the slot where the moved value was stored\n set._values.pop();\n\n // Delete the index for the deleted slot\n delete set._indexes[value];\n\n return true;\n } else {\n return false;\n }\n }\n\n /**\n * @dev Returns true if the value is in the set. O(1).\n */\n function _contains(Set storage set, bytes32 value) private view returns (bool) {\n return set._indexes[value] != 0;\n }\n\n /**\n * @dev Returns the number of values on the set. O(1).\n */\n function _length(Set storage set) private view returns (uint256) {\n return set._values.length;\n }\n\n /**\n * @dev Returns the value stored at position `index` in the set. O(1).\n *\n * Note that there are no guarantees on the ordering of values inside the\n * array, and it may change when more values are added or removed.\n *\n * Requirements:\n *\n * - `index` must be strictly less than {length}.\n */\n function _at(Set storage set, uint256 index) private view returns (bytes32) {\n return set._values[index];\n }\n\n /**\n * @dev Return the entire set in an array\n *\n * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed\n * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that\n * this function has an unbounded cost, and using it as part of a state-changing function may render the function\n * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.\n */\n function _values(Set storage set) private view returns (bytes32[] memory) {\n return set._values;\n }\n\n // Bytes32Set\n\n struct Bytes32Set {\n Set _inner;\n }\n\n /**\n * @dev Add a value to a set. O(1).\n *\n * Returns true if the value was added to the set, that is if it was not\n * already present.\n */\n function add(Bytes32Set storage set, bytes32 value) internal returns (bool) {\n return _add(set._inner, value);\n }\n\n /**\n * @dev Removes a value from a set. O(1).\n *\n * Returns true if the value was removed from the set, that is if it was\n * present.\n */\n function remove(Bytes32Set storage set, bytes32 value) internal returns (bool) {\n return _remove(set._inner, value);\n }\n\n /**\n * @dev Returns true if the value is in the set. O(1).\n */\n function contains(Bytes32Set storage set, bytes32 value) internal view returns (bool) {\n return _contains(set._inner, value);\n }\n\n /**\n * @dev Returns the number of values in the set. O(1).\n */\n function length(Bytes32Set storage set) internal view returns (uint256) {\n return _length(set._inner);\n }\n\n /**\n * @dev Returns the value stored at position `index` in the set. O(1).\n *\n * Note that there are no guarantees on the ordering of values inside the\n * array, and it may change when more values are added or removed.\n *\n * Requirements:\n *\n * - `index` must be strictly less than {length}.\n */\n function at(Bytes32Set storage set, uint256 index) internal view returns (bytes32) {\n return _at(set._inner, index);\n }\n\n /**\n * @dev Return the entire set in an array\n *\n * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed\n * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that\n * this function has an unbounded cost, and using it as part of a state-changing function may render the function\n * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.\n */\n function values(Bytes32Set storage set) internal view returns (bytes32[] memory) {\n return _values(set._inner);\n }\n\n // AddressSet\n\n struct AddressSet {\n Set _inner;\n }\n\n /**\n * @dev Add a value to a set. O(1).\n *\n * Returns true if the value was added to the set, that is if it was not\n * already present.\n */\n function add(AddressSet storage set, address value) internal returns (bool) {\n return _add(set._inner, bytes32(uint256(uint160(value))));\n }\n\n /**\n * @dev Removes a value from a set. O(1).\n *\n * Returns true if the value was removed from the set, that is if it was\n * present.\n */\n function remove(AddressSet storage set, address value) internal returns (bool) {\n return _remove(set._inner, bytes32(uint256(uint160(value))));\n }\n\n /**\n * @dev Returns true if the value is in the set. O(1).\n */\n function contains(AddressSet storage set, address value) internal view returns (bool) {\n return _contains(set._inner, bytes32(uint256(uint160(value))));\n }\n\n /**\n * @dev Returns the number of values in the set. O(1).\n */\n function length(AddressSet storage set) internal view returns (uint256) {\n return _length(set._inner);\n }\n\n /**\n * @dev Returns the value stored at position `index` in the set. O(1).\n *\n * Note that there are no guarantees on the ordering of values inside the\n * array, and it may change when more values are added or removed.\n *\n * Requirements:\n *\n * - `index` must be strictly less than {length}.\n */\n function at(AddressSet storage set, uint256 index) internal view returns (address) {\n return address(uint160(uint256(_at(set._inner, index))));\n }\n\n /**\n * @dev Return the entire set in an array\n *\n * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed\n * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that\n * this function has an unbounded cost, and using it as part of a state-changing function may render the function\n * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.\n */\n function values(AddressSet storage set) internal view returns (address[] memory) {\n bytes32[] memory store = _values(set._inner);\n address[] memory result;\n\n assembly {\n result := store\n }\n\n return result;\n }\n\n // UintSet\n\n struct UintSet {\n Set _inner;\n }\n\n /**\n * @dev Add a value to a set. O(1).\n *\n * Returns true if the value was added to the set, that is if it was not\n * already present.\n */\n function add(UintSet storage set, uint256 value) internal returns (bool) {\n return _add(set._inner, bytes32(value));\n }\n\n /**\n * @dev Removes a value from a set. O(1).\n *\n * Returns true if the value was removed from the set, that is if it was\n * present.\n */\n function remove(UintSet storage set, uint256 value) internal returns (bool) {\n return _remove(set._inner, bytes32(value));\n }\n\n /**\n * @dev Returns true if the value is in the set. O(1).\n */\n function contains(UintSet storage set, uint256 value) internal view returns (bool) {\n return _contains(set._inner, bytes32(value));\n }\n\n /**\n * @dev Returns the number of values on the set. O(1).\n */\n function length(UintSet storage set) internal view returns (uint256) {\n return _length(set._inner);\n }\n\n /**\n * @dev Returns the value stored at position `index` in the set. O(1).\n *\n * Note that there are no guarantees on the ordering of values inside the\n * array, and it may change when more values are added or removed.\n *\n * Requirements:\n *\n * - `index` must be strictly less than {length}.\n */\n function at(UintSet storage set, uint256 index) internal view returns (uint256) {\n return uint256(_at(set._inner, index));\n }\n\n /**\n * @dev Return the entire set in an array\n *\n * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed\n * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that\n * this function has an unbounded cost, and using it as part of a state-changing function may render the function\n * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.\n */\n function values(UintSet storage set) internal view returns (uint256[] memory) {\n bytes32[] memory store = _values(set._inner);\n uint256[] memory result;\n\n assembly {\n result := store\n }\n\n return result;\n }\n}\n" - }, - "solidity/contracts/peripherals/Keep3rRoles.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../../interfaces/peripherals/IKeep3rRoles.sol';\nimport '@openzeppelin/contracts/utils/structs/EnumerableSet.sol';\nimport './DustCollector.sol';\nimport './Governable.sol';\n\ncontract Keep3rRoles is IKeep3rRoles, Governable, DustCollector {\n /// @inheritdoc IKeep3rRoles\n mapping(address => bool) public override slashers;\n\n /// @inheritdoc IKeep3rRoles\n mapping(address => bool) public override disputers;\n\n constructor(address _governance) Governable(_governance) DustCollector() {}\n\n /// @inheritdoc IKeep3rRoles\n function addSlasher(address _slasher) external override onlyGovernance {\n if (_slasher == address(0)) revert ZeroAddress();\n if (slashers[_slasher]) revert SlasherExistent();\n slashers[_slasher] = true;\n emit SlasherAdded(_slasher);\n }\n\n /// @inheritdoc IKeep3rRoles\n function removeSlasher(address _slasher) external override onlyGovernance {\n if (!slashers[_slasher]) revert SlasherUnexistent();\n delete slashers[_slasher];\n emit SlasherRemoved(_slasher);\n }\n\n /// @inheritdoc IKeep3rRoles\n function addDisputer(address _disputer) external override onlyGovernance {\n if (_disputer == address(0)) revert ZeroAddress();\n if (disputers[_disputer]) revert DisputerExistent();\n disputers[_disputer] = true;\n emit DisputerAdded(_disputer);\n }\n\n /// @inheritdoc IKeep3rRoles\n function removeDisputer(address _disputer) external override onlyGovernance {\n if (!disputers[_disputer]) revert DisputerUnexistent();\n delete disputers[_disputer];\n emit DisputerRemoved(_disputer);\n }\n\n /// @notice Functions with this modifier can only be called by either a slasher or governance\n modifier onlySlasher {\n if (!slashers[msg.sender]) revert OnlySlasher();\n _;\n }\n\n /// @notice Functions with this modifier can only be called by either a disputer or governance\n modifier onlyDisputer {\n if (!disputers[msg.sender]) revert OnlyDisputer();\n _;\n }\n}\n" - }, - "solidity/contracts/peripherals/Governable.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../../interfaces/peripherals/IGovernable.sol';\n\nabstract contract Governable is IGovernable {\n /// @inheritdoc IGovernable\n address public override governance;\n\n /// @inheritdoc IGovernable\n address public override pendingGovernance;\n\n constructor(address _governance) {\n if (_governance == address(0)) revert NoGovernanceZeroAddress();\n governance = _governance;\n }\n\n /// @inheritdoc IGovernable\n function setGovernance(address _governance) external override onlyGovernance {\n pendingGovernance = _governance;\n emit GovernanceProposal(_governance);\n }\n\n /// @inheritdoc IGovernable\n function acceptGovernance() external override onlyPendingGovernance {\n governance = pendingGovernance;\n delete pendingGovernance;\n emit GovernanceSet(governance);\n }\n\n /// @notice Functions with this modifier can only be called by governance\n modifier onlyGovernance {\n if (msg.sender != governance) revert OnlyGovernance();\n _;\n }\n\n /// @notice Functions with this modifier can only be called by pendingGovernance\n modifier onlyPendingGovernance {\n if (msg.sender != pendingGovernance) revert OnlyPendingGovernance();\n _;\n }\n}\n" - }, - "@openzeppelin/contracts/token/ERC20/IERC20.sol": { - "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Interface of the ERC20 standard as defined in the EIP.\n */\ninterface IERC20 {\n /**\n * @dev Returns the amount of tokens in existence.\n */\n function totalSupply() external view returns (uint256);\n\n /**\n * @dev Returns the amount of tokens owned by `account`.\n */\n function balanceOf(address account) external view returns (uint256);\n\n /**\n * @dev Moves `amount` tokens from the caller's account to `recipient`.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * Emits a {Transfer} event.\n */\n function transfer(address recipient, uint256 amount) external returns (bool);\n\n /**\n * @dev Returns the remaining number of tokens that `spender` will be\n * allowed to spend on behalf of `owner` through {transferFrom}. This is\n * zero by default.\n *\n * This value changes when {approve} or {transferFrom} are called.\n */\n function allowance(address owner, address spender) external view returns (uint256);\n\n /**\n * @dev Sets `amount` as the allowance of `spender` over the caller's tokens.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * IMPORTANT: Beware that changing an allowance with this method brings the risk\n * that someone may use both the old and the new allowance by unfortunate\n * transaction ordering. One possible solution to mitigate this race\n * condition is to first reduce the spender's allowance to 0 and set the\n * desired value afterwards:\n * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729\n *\n * Emits an {Approval} event.\n */\n function approve(address spender, uint256 amount) external returns (bool);\n\n /**\n * @dev Moves `amount` tokens from `sender` to `recipient` using the\n * allowance mechanism. `amount` is then deducted from the caller's\n * allowance.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * Emits a {Transfer} event.\n */\n function transferFrom(\n address sender,\n address recipient,\n uint256 amount\n ) external returns (bool);\n\n /**\n * @dev Emitted when `value` tokens are moved from one account (`from`) to\n * another (`to`).\n *\n * Note that `value` may be zero.\n */\n event Transfer(address indexed from, address indexed to, uint256 value);\n\n /**\n * @dev Emitted when the allowance of a `spender` for an `owner` is set by\n * a call to {approve}. `value` is the new allowance.\n */\n event Approval(address indexed owner, address indexed spender, uint256 value);\n}\n" - }, - "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol": { - "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\nimport \"../IERC20.sol\";\nimport \"../../../utils/Address.sol\";\n\n/**\n * @title SafeERC20\n * @dev Wrappers around ERC20 operations that throw on failure (when the token\n * contract returns false). Tokens that return no value (and instead revert or\n * throw on failure) are also supported, non-reverting calls are assumed to be\n * successful.\n * To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract,\n * which allows you to call the safe operations as `token.safeTransfer(...)`, etc.\n */\nlibrary SafeERC20 {\n using Address for address;\n\n function safeTransfer(\n IERC20 token,\n address to,\n uint256 value\n ) internal {\n _callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value));\n }\n\n function safeTransferFrom(\n IERC20 token,\n address from,\n address to,\n uint256 value\n ) internal {\n _callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value));\n }\n\n /**\n * @dev Deprecated. This function has issues similar to the ones found in\n * {IERC20-approve}, and its usage is discouraged.\n *\n * Whenever possible, use {safeIncreaseAllowance} and\n * {safeDecreaseAllowance} instead.\n */\n function safeApprove(\n IERC20 token,\n address spender,\n uint256 value\n ) internal {\n // safeApprove should only be called when setting an initial allowance,\n // or when resetting it to zero. To increase and decrease it, use\n // 'safeIncreaseAllowance' and 'safeDecreaseAllowance'\n require(\n (value == 0) || (token.allowance(address(this), spender) == 0),\n \"SafeERC20: approve from non-zero to non-zero allowance\"\n );\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value));\n }\n\n function safeIncreaseAllowance(\n IERC20 token,\n address spender,\n uint256 value\n ) internal {\n uint256 newAllowance = token.allowance(address(this), spender) + value;\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));\n }\n\n function safeDecreaseAllowance(\n IERC20 token,\n address spender,\n uint256 value\n ) internal {\n unchecked {\n uint256 oldAllowance = token.allowance(address(this), spender);\n require(oldAllowance >= value, \"SafeERC20: decreased allowance below zero\");\n uint256 newAllowance = oldAllowance - value;\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));\n }\n }\n\n /**\n * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement\n * on the return value: the return value is optional (but if data is returned, it must not be false).\n * @param token The token targeted by the call.\n * @param data The call data (encoded using abi.encode or one of its variants).\n */\n function _callOptionalReturn(IERC20 token, bytes memory data) private {\n // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since\n // we're implementing it ourselves. We use {Address.functionCall} to perform this call, which verifies that\n // the target address contains contract code and also asserts for success in the low-level call.\n\n bytes memory returndata = address(token).functionCall(data, \"SafeERC20: low-level call failed\");\n if (returndata.length > 0) {\n // Return data is optional\n require(abi.decode(returndata, (bool)), \"SafeERC20: ERC20 operation did not succeed\");\n }\n }\n}\n" - }, - "@openzeppelin/contracts/utils/Address.sol": { - "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Collection of functions related to the address type\n */\nlibrary Address {\n /**\n * @dev Returns true if `account` is a contract.\n *\n * [IMPORTANT]\n * ====\n * It is unsafe to assume that an address for which this function returns\n * false is an externally-owned account (EOA) and not a contract.\n *\n * Among others, `isContract` will return false for the following\n * types of addresses:\n *\n * - an externally-owned account\n * - a contract in construction\n * - an address where a contract will be created\n * - an address where a contract lived, but was destroyed\n * ====\n */\n function isContract(address account) internal view returns (bool) {\n // This method relies on extcodesize, which returns 0 for contracts in\n // construction, since the code is only stored at the end of the\n // constructor execution.\n\n uint256 size;\n assembly {\n size := extcodesize(account)\n }\n return size > 0;\n }\n\n /**\n * @dev Replacement for Solidity's `transfer`: sends `amount` wei to\n * `recipient`, forwarding all available gas and reverting on errors.\n *\n * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost\n * of certain opcodes, possibly making contracts go over the 2300 gas limit\n * imposed by `transfer`, making them unable to receive funds via\n * `transfer`. {sendValue} removes this limitation.\n *\n * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].\n *\n * IMPORTANT: because control is transferred to `recipient`, care must be\n * taken to not create reentrancy vulnerabilities. Consider using\n * {ReentrancyGuard} or the\n * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].\n */\n function sendValue(address payable recipient, uint256 amount) internal {\n require(address(this).balance >= amount, \"Address: insufficient balance\");\n\n (bool success, ) = recipient.call{value: amount}(\"\");\n require(success, \"Address: unable to send value, recipient may have reverted\");\n }\n\n /**\n * @dev Performs a Solidity function call using a low level `call`. A\n * plain `call` is an unsafe replacement for a function call: use this\n * function instead.\n *\n * If `target` reverts with a revert reason, it is bubbled up by this\n * function (like regular Solidity function calls).\n *\n * Returns the raw returned data. To convert to the expected return value,\n * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\n *\n * Requirements:\n *\n * - `target` must be a contract.\n * - calling `target` with `data` must not revert.\n *\n * _Available since v3.1._\n */\n function functionCall(address target, bytes memory data) internal returns (bytes memory) {\n return functionCall(target, data, \"Address: low-level call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with\n * `errorMessage` as a fallback revert reason when `target` reverts.\n *\n * _Available since v3.1._\n */\n function functionCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal returns (bytes memory) {\n return functionCallWithValue(target, data, 0, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but also transferring `value` wei to `target`.\n *\n * Requirements:\n *\n * - the calling contract must have an ETH balance of at least `value`.\n * - the called Solidity function must be `payable`.\n *\n * _Available since v3.1._\n */\n function functionCallWithValue(\n address target,\n bytes memory data,\n uint256 value\n ) internal returns (bytes memory) {\n return functionCallWithValue(target, data, value, \"Address: low-level call with value failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but\n * with `errorMessage` as a fallback revert reason when `target` reverts.\n *\n * _Available since v3.1._\n */\n function functionCallWithValue(\n address target,\n bytes memory data,\n uint256 value,\n string memory errorMessage\n ) internal returns (bytes memory) {\n require(address(this).balance >= value, \"Address: insufficient balance for call\");\n require(isContract(target), \"Address: call to non-contract\");\n\n (bool success, bytes memory returndata) = target.call{value: value}(data);\n return verifyCallResult(success, returndata, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but performing a static call.\n *\n * _Available since v3.3._\n */\n function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\n return functionStaticCall(target, data, \"Address: low-level static call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\n * but performing a static call.\n *\n * _Available since v3.3._\n */\n function functionStaticCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal view returns (bytes memory) {\n require(isContract(target), \"Address: static call to non-contract\");\n\n (bool success, bytes memory returndata) = target.staticcall(data);\n return verifyCallResult(success, returndata, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but performing a delegate call.\n *\n * _Available since v3.4._\n */\n function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {\n return functionDelegateCall(target, data, \"Address: low-level delegate call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\n * but performing a delegate call.\n *\n * _Available since v3.4._\n */\n function functionDelegateCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal returns (bytes memory) {\n require(isContract(target), \"Address: delegate call to non-contract\");\n\n (bool success, bytes memory returndata) = target.delegatecall(data);\n return verifyCallResult(success, returndata, errorMessage);\n }\n\n /**\n * @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the\n * revert reason using the provided one.\n *\n * _Available since v4.3._\n */\n function verifyCallResult(\n bool success,\n bytes memory returndata,\n string memory errorMessage\n ) internal pure returns (bytes memory) {\n if (success) {\n return returndata;\n } else {\n // Look for revert reason and bubble it up if present\n if (returndata.length > 0) {\n // The easiest way to bubble the revert reason is using memory via assembly\n\n assembly {\n let returndata_size := mload(returndata)\n revert(add(32, returndata), returndata_size)\n }\n } else {\n revert(errorMessage);\n }\n }\n }\n}\n" - }, - "solidity/contracts/peripherals/jobs/Keep3rJobMigration.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../../../interfaces/peripherals/IKeep3rJobs.sol';\nimport './Keep3rJobFundableCredits.sol';\nimport './Keep3rJobFundableLiquidity.sol';\n\nabstract contract Keep3rJobMigration is IKeep3rJobMigration, Keep3rJobFundableCredits, Keep3rJobFundableLiquidity {\n using EnumerableSet for EnumerableSet.AddressSet;\n\n uint256 internal constant _MIGRATION_COOLDOWN = 1 minutes;\n\n /// @inheritdoc IKeep3rJobMigration\n mapping(address => address) public override pendingJobMigrations;\n mapping(address => mapping(address => uint256)) internal _migrationCreatedAt;\n\n /// @inheritdoc IKeep3rJobMigration\n function migrateJob(address _fromJob, address _toJob) external override onlyJobOwner(_fromJob) {\n if (_fromJob == _toJob) revert JobMigrationImpossible();\n\n pendingJobMigrations[_fromJob] = _toJob;\n _migrationCreatedAt[_fromJob][_toJob] = block.timestamp;\n\n emit JobMigrationRequested(_fromJob, _toJob);\n }\n\n /// @inheritdoc IKeep3rJobMigration\n function acceptJobMigration(address _fromJob, address _toJob) external override onlyJobOwner(_toJob) {\n if (disputes[_fromJob] || disputes[_toJob]) revert JobDisputed();\n if (pendingJobMigrations[_fromJob] != _toJob) revert JobMigrationUnavailable();\n if (block.timestamp < _migrationCreatedAt[_fromJob][_toJob] + _MIGRATION_COOLDOWN) revert JobMigrationLocked();\n\n // force job credits update for both jobs\n _settleJobAccountance(_fromJob);\n _settleJobAccountance(_toJob);\n\n // migrate tokens\n while (_jobTokens[_fromJob].length() > 0) {\n address _tokenToMigrate = _jobTokens[_fromJob].at(0);\n jobTokenCredits[_toJob][_tokenToMigrate] += jobTokenCredits[_fromJob][_tokenToMigrate];\n delete jobTokenCredits[_fromJob][_tokenToMigrate];\n _jobTokens[_fromJob].remove(_tokenToMigrate);\n _jobTokens[_toJob].add(_tokenToMigrate);\n }\n\n // migrate liquidities\n while (_jobLiquidities[_fromJob].length() > 0) {\n address _liquidity = _jobLiquidities[_fromJob].at(0);\n\n liquidityAmount[_toJob][_liquidity] += liquidityAmount[_fromJob][_liquidity];\n delete liquidityAmount[_fromJob][_liquidity];\n\n _jobLiquidities[_toJob].add(_liquidity);\n _jobLiquidities[_fromJob].remove(_liquidity);\n }\n\n // migrate job balances\n _jobPeriodCredits[_toJob] += _jobPeriodCredits[_fromJob];\n delete _jobPeriodCredits[_fromJob];\n\n _jobLiquidityCredits[_toJob] += _jobLiquidityCredits[_fromJob];\n delete _jobLiquidityCredits[_fromJob];\n\n // stop _fromJob from being a job\n delete rewardedAt[_fromJob];\n _jobs.remove(_fromJob);\n\n // delete unused data slots\n delete jobOwner[_fromJob];\n delete jobPendingOwner[_fromJob];\n delete _migrationCreatedAt[_fromJob][_toJob];\n delete pendingJobMigrations[_fromJob];\n\n emit JobMigrationSuccessful(_fromJob, _toJob);\n }\n}\n" - }, - "solidity/interfaces/IKeep3rHelper.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport './IKeep3rHelperParameters.sol';\n\n/// @title Keep3rHelper contract\n/// @notice Contains all the helper functions used throughout the different files.\ninterface IKeep3rHelper is IKeep3rHelperParameters {\n // Errors\n\n /// @notice Throws when none of the tokens in the liquidity pair is KP3R\n error LiquidityPairInvalid();\n\n // Methods\n // solhint-enable func-name-mixedcase\n\n /// @notice Calculates the amount of KP3R that corresponds to the ETH passed into the function\n /// @dev This function allows us to calculate how much KP3R we should pay to a keeper for things expressed in ETH, like gas\n /// @param _eth The amount of ETH\n /// @return _amountOut The amount of KP3R\n function quote(uint256 _eth) external view returns (uint256 _amountOut);\n\n /// @notice Returns the amount of KP3R the keeper has bonded\n /// @param _keeper The address of the keeper to check\n /// @return _amountBonded The amount of KP3R the keeper has bonded\n function bonds(address _keeper) external view returns (uint256 _amountBonded);\n\n /// @notice Calculates the reward (in KP3R) that corresponds to a keeper for using gas\n /// @param _keeper The address of the keeper to check\n /// @param _gasUsed The amount of gas used that will be rewarded\n /// @return _kp3r The amount of KP3R that should be awarded to the keeper\n function getRewardAmountFor(address _keeper, uint256 _gasUsed) external view returns (uint256 _kp3r);\n\n /// @notice Calculates the boost in the reward given to a keeper based on the amount of KP3R that keeper has bonded\n /// @dev If the keeper has no bonds, boost should be +10% of gas cost, if keeper has max bonds, +20%\n /// @param _bonds The amount of KP3R tokens bonded by the keeper\n /// @return _rewardBoost The reward boost that corresponds to the keeper\n function getRewardBoostFor(uint256 _bonds) external view returns (uint256 _rewardBoost);\n\n /// @notice Calculates the reward (in KP3R) that corresponds to tx.origin for using gas\n /// @param _gasUsed The amount of gas used that will be rewarded\n /// @return _amount The amount of KP3R that should be awarded to tx.origin\n function getRewardAmount(uint256 _gasUsed) external view returns (uint256 _amount);\n\n /// @notice Given a pool address, returns the underlying tokens of the pair\n /// @param _pool Address of the correspondant pool\n /// @return _token0 Address of the first token of the pair\n /// @return _token1 Address of the second token of the pair\n function getPoolTokens(address _pool) external view returns (address _token0, address _token1);\n\n /// @notice Defines the order of the tokens in the pair for twap calculations\n /// @param _pool Address of the correspondant pool\n /// @return _isKP3RToken0 Boolean indicating the order of the tokens in the pair\n function isKP3RToken0(address _pool) external view returns (bool _isKP3RToken0);\n\n /// @notice Given an array of secondsAgo, returns UniswapV3 pool cumulatives at that moment\n /// @param _pool Address of the pool to observe\n /// @param _secondsAgo Array with time references to observe\n /// @return _tickCumulative1 Cumulative sum of ticks until first time reference\n /// @return _tickCumulative2 Cumulative sum of ticks until second time reference\n /// @return _success Boolean indicating if the observe call was succesfull\n function observe(address _pool, uint32[] memory _secondsAgo)\n external\n view\n returns (\n int56 _tickCumulative1,\n int56 _tickCumulative2,\n bool _success\n );\n\n /// @notice Get multiplier, quote, and extra, in order to calculate keeper payment\n /// @param _bonds Amount of bonded KP3R owned by the keeper\n /// @return _boost Multiplier per gas unit. Takes into account the base fee and the amount of bonded KP3R\n /// @return _oneEthQuote Amount of KP3R tokens equivalent to 1 ETH\n /// @return _extra Amount of extra gas that should be added to the gas spent\n function getPaymentParams(uint256 _bonds)\n external\n view\n returns (\n uint256 _boost,\n uint256 _oneEthQuote,\n uint256 _extra\n );\n\n /// @notice Given a tick and a liquidity amount, calculates the underlying KP3R tokens\n /// @param _liquidityAmount Amount of liquidity to be converted\n /// @param _tickDifference Tick value used to calculate the quote\n /// @param _timeInterval Time value used to calculate the quote\n /// @return _kp3rAmount Amount of KP3R tokens underlying on the given liquidity\n function getKP3RsAtTick(\n uint256 _liquidityAmount,\n int56 _tickDifference,\n uint256 _timeInterval\n ) external pure returns (uint256 _kp3rAmount);\n\n /// @notice Given a tick and a token amount, calculates the output in correspondant token\n /// @param _baseAmount Amount of token to be converted\n /// @param _tickDifference Tick value used to calculate the quote\n /// @param _timeInterval Time value used to calculate the quote\n /// @return _quoteAmount Amount of credits deserved for the baseAmount at the tick value\n function getQuoteAtTick(\n uint128 _baseAmount,\n int56 _tickDifference,\n uint256 _timeInterval\n ) external pure returns (uint256 _quoteAmount);\n}\n" - }, - "solidity/contracts/peripherals/jobs/Keep3rJobFundableCredits.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport './Keep3rJobOwnership.sol';\nimport '../Keep3rAccountance.sol';\nimport '../Keep3rParameters.sol';\nimport '../../../interfaces/peripherals/IKeep3rJobs.sol';\n\nimport '@openzeppelin/contracts/security/ReentrancyGuard.sol';\nimport '@openzeppelin/contracts/token/ERC20/IERC20.sol';\nimport '@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol';\nimport '@openzeppelin/contracts/utils/math/Math.sol';\n\nabstract contract Keep3rJobFundableCredits is IKeep3rJobFundableCredits, ReentrancyGuard, Keep3rJobOwnership, Keep3rParameters {\n using EnumerableSet for EnumerableSet.AddressSet;\n using SafeERC20 for IERC20;\n\n /// @notice Cooldown between withdrawals\n uint256 internal constant _WITHDRAW_TOKENS_COOLDOWN = 1 minutes;\n\n /// @inheritdoc IKeep3rJobFundableCredits\n mapping(address => mapping(address => uint256)) public override jobTokenCreditsAddedAt;\n\n /// @inheritdoc IKeep3rJobFundableCredits\n function addTokenCreditsToJob(\n address _job,\n address _token,\n uint256 _amount\n ) external override nonReentrant {\n if (!_jobs.contains(_job)) revert JobUnavailable();\n // KP3R shouldn't be used for direct token payments\n if (_token == keep3rV1) revert TokenUnallowed();\n uint256 _before = IERC20(_token).balanceOf(address(this));\n IERC20(_token).safeTransferFrom(msg.sender, address(this), _amount);\n uint256 _received = IERC20(_token).balanceOf(address(this)) - _before;\n uint256 _tokenFee = (_received * fee) / _BASE;\n jobTokenCredits[_job][_token] += _received - _tokenFee;\n jobTokenCreditsAddedAt[_job][_token] = block.timestamp;\n IERC20(_token).safeTransfer(governance, _tokenFee);\n _jobTokens[_job].add(_token);\n\n emit TokenCreditAddition(_job, _token, msg.sender, _received);\n }\n\n /// @inheritdoc IKeep3rJobFundableCredits\n function withdrawTokenCreditsFromJob(\n address _job,\n address _token,\n uint256 _amount,\n address _receiver\n ) external override nonReentrant onlyJobOwner(_job) {\n if (block.timestamp <= jobTokenCreditsAddedAt[_job][_token] + _WITHDRAW_TOKENS_COOLDOWN) revert JobTokenCreditsLocked();\n if (jobTokenCredits[_job][_token] < _amount) revert InsufficientJobTokenCredits();\n if (disputes[_job]) revert JobDisputed();\n\n jobTokenCredits[_job][_token] -= _amount;\n IERC20(_token).safeTransfer(_receiver, _amount);\n\n if (jobTokenCredits[_job][_token] == 0) {\n _jobTokens[_job].remove(_token);\n }\n\n emit TokenCreditWithdrawal(_job, _token, _receiver, _amount);\n }\n}\n" - }, - "solidity/contracts/peripherals/jobs/Keep3rJobFundableLiquidity.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport './Keep3rJobOwnership.sol';\nimport '../Keep3rAccountance.sol';\nimport '../Keep3rParameters.sol';\nimport '../../../interfaces/IPairManager.sol';\nimport '../../../interfaces/peripherals/IKeep3rJobs.sol';\n\nimport '../../libraries/FullMath.sol';\n\nimport '@openzeppelin/contracts/security/ReentrancyGuard.sol';\nimport '@openzeppelin/contracts/token/ERC20/IERC20.sol';\nimport '@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol';\nimport '@openzeppelin/contracts/utils/math/Math.sol';\n\nabstract contract Keep3rJobFundableLiquidity is IKeep3rJobFundableLiquidity, ReentrancyGuard, Keep3rJobOwnership, Keep3rParameters {\n using EnumerableSet for EnumerableSet.AddressSet;\n using SafeERC20 for IERC20;\n\n /// @notice List of liquidities that are accepted in the system\n EnumerableSet.AddressSet internal _approvedLiquidities;\n\n /// @inheritdoc IKeep3rJobFundableLiquidity\n mapping(address => mapping(address => uint256)) public override liquidityAmount;\n\n /// @inheritdoc IKeep3rJobFundableLiquidity\n mapping(address => uint256) public override rewardedAt;\n\n /// @inheritdoc IKeep3rJobFundableLiquidity\n mapping(address => uint256) public override workedAt;\n\n /// @notice Tracks an address and returns its TickCache\n mapping(address => TickCache) internal _tick;\n\n // Views\n\n /// @inheritdoc IKeep3rJobFundableLiquidity\n function approvedLiquidities() external view override returns (address[] memory _list) {\n _list = _approvedLiquidities.values();\n }\n\n /// @inheritdoc IKeep3rJobFundableLiquidity\n function jobPeriodCredits(address _job) public view override returns (uint256 _periodCredits) {\n for (uint256 i; i < _jobLiquidities[_job].length(); i++) {\n address _liquidity = _jobLiquidities[_job].at(i);\n if (_approvedLiquidities.contains(_liquidity)) {\n TickCache memory _tickCache = observeLiquidity(_liquidity);\n if (_tickCache.period != 0) {\n int56 _tickDifference = _isKP3RToken0[_liquidity] ? _tickCache.difference : -_tickCache.difference;\n _periodCredits += _getReward(\n IKeep3rHelper(keep3rHelper).getKP3RsAtTick(liquidityAmount[_job][_liquidity], _tickDifference, rewardPeriodTime)\n );\n }\n }\n }\n }\n\n /// @inheritdoc IKeep3rJobFundableLiquidity\n function jobLiquidityCredits(address _job) public view override returns (uint256 _liquidityCredits) {\n uint256 _periodCredits = jobPeriodCredits(_job);\n\n // If the job was rewarded in the past 1 period time\n if ((block.timestamp - rewardedAt[_job]) < rewardPeriodTime) {\n // If the job has period credits, update minted job credits to new twap\n _liquidityCredits = _periodCredits > 0\n ? (_jobLiquidityCredits[_job] * _periodCredits) / _jobPeriodCredits[_job] // If the job has period credits, return remaining job credits updated to new twap\n : _jobLiquidityCredits[_job]; // If not, return remaining credits, forced credits should not be updated\n } else {\n // Else return a full period worth of credits if current credits have expired\n _liquidityCredits = _periodCredits;\n }\n }\n\n /// @inheritdoc IKeep3rJobFundableLiquidity\n function totalJobCredits(address _job) external view override returns (uint256 _credits) {\n uint256 _periodCredits = jobPeriodCredits(_job);\n uint256 _cooldown = block.timestamp;\n\n if ((rewardedAt[_job] > _period(block.timestamp - rewardPeriodTime))) {\n // Will calculate cooldown if it outdated\n if ((block.timestamp - rewardedAt[_job]) >= rewardPeriodTime) {\n // Will calculate cooldown from last reward reference in this period\n _cooldown -= (rewardedAt[_job] + rewardPeriodTime);\n } else {\n // Will calculate cooldown from last reward timestamp\n _cooldown -= rewardedAt[_job];\n }\n } else {\n // Will calculate cooldown from period start if expired\n _cooldown -= _period(block.timestamp);\n }\n _credits = jobLiquidityCredits(_job) + _phase(_cooldown, _periodCredits);\n }\n\n /// @inheritdoc IKeep3rJobFundableLiquidity\n function quoteLiquidity(address _liquidity, uint256 _amount) external view override returns (uint256 _periodCredits) {\n if (_approvedLiquidities.contains(_liquidity)) {\n TickCache memory _tickCache = observeLiquidity(_liquidity);\n if (_tickCache.period != 0) {\n int56 _tickDifference = _isKP3RToken0[_liquidity] ? _tickCache.difference : -_tickCache.difference;\n return _getReward(IKeep3rHelper(keep3rHelper).getKP3RsAtTick(_amount, _tickDifference, rewardPeriodTime));\n }\n }\n }\n\n /// @inheritdoc IKeep3rJobFundableLiquidity\n function observeLiquidity(address _liquidity) public view virtual override returns (TickCache memory _tickCache) {\n if (_tick[_liquidity].period == _period(block.timestamp)) {\n // Will return cached twaps if liquidity is updated\n _tickCache = _tick[_liquidity];\n } else {\n bool success;\n uint256 lastPeriod = _period(block.timestamp - rewardPeriodTime);\n\n if (_tick[_liquidity].period == lastPeriod) {\n // Will only ask for current period accumulator if liquidity is outdated\n uint32[] memory _secondsAgo = new uint32[](1);\n int56 previousTick = _tick[_liquidity].current;\n\n _secondsAgo[0] = uint32(block.timestamp - _period(block.timestamp));\n\n (_tickCache.current, , success) = IKeep3rHelper(keep3rHelper).observe(_liquidityPool[_liquidity], _secondsAgo);\n\n _tickCache.difference = _tickCache.current - previousTick;\n } else if (_tick[_liquidity].period < lastPeriod) {\n // Will ask for 2 accumulators if liquidity is expired\n uint32[] memory _secondsAgo = new uint32[](2);\n\n _secondsAgo[0] = uint32(block.timestamp - _period(block.timestamp));\n _secondsAgo[1] = uint32(block.timestamp - _period(block.timestamp) + rewardPeriodTime);\n\n int56 _tickCumulative2;\n (_tickCache.current, _tickCumulative2, success) = IKeep3rHelper(keep3rHelper).observe(_liquidityPool[_liquidity], _secondsAgo);\n\n _tickCache.difference = _tickCache.current - _tickCumulative2;\n }\n if (success) {\n _tickCache.period = _period(block.timestamp);\n } else {\n delete _tickCache.period;\n }\n }\n }\n\n // Methods\n\n /// @inheritdoc IKeep3rJobFundableLiquidity\n function forceLiquidityCreditsToJob(address _job, uint256 _amount) external override onlyGovernance {\n if (!_jobs.contains(_job)) revert JobUnavailable();\n _settleJobAccountance(_job);\n _jobLiquidityCredits[_job] += _amount;\n emit LiquidityCreditsForced(_job, rewardedAt[_job], _jobLiquidityCredits[_job]);\n }\n\n /// @inheritdoc IKeep3rJobFundableLiquidity\n function approveLiquidity(address _liquidity) external virtual override onlyGovernance {\n if (!_approvedLiquidities.add(_liquidity)) revert LiquidityPairApproved();\n _liquidityPool[_liquidity] = IPairManager(_liquidity).pool();\n _isKP3RToken0[_liquidity] = IKeep3rHelper(keep3rHelper).isKP3RToken0(_liquidityPool[_liquidity]);\n _tick[_liquidity] = observeLiquidity(_liquidity);\n emit LiquidityApproval(_liquidity);\n }\n\n /// @inheritdoc IKeep3rJobFundableLiquidity\n function revokeLiquidity(address _liquidity) external override onlyGovernance {\n if (!_approvedLiquidities.remove(_liquidity)) revert LiquidityPairUnexistent();\n delete _liquidityPool[_liquidity];\n delete _isKP3RToken0[_liquidity];\n delete _tick[_liquidity];\n\n emit LiquidityRevocation(_liquidity);\n }\n\n /// @inheritdoc IKeep3rJobFundableLiquidity\n function addLiquidityToJob(\n address _job,\n address _liquidity,\n uint256 _amount\n ) external override nonReentrant {\n if (!_approvedLiquidities.contains(_liquidity)) revert LiquidityPairUnapproved();\n if (!_jobs.contains(_job)) revert JobUnavailable();\n\n _jobLiquidities[_job].add(_liquidity);\n\n _settleJobAccountance(_job);\n\n if (_quoteLiquidity(liquidityAmount[_job][_liquidity] + _amount, _liquidity) < liquidityMinimum) revert JobLiquidityLessThanMin();\n\n emit LiquidityCreditsReward(_job, rewardedAt[_job], _jobLiquidityCredits[_job], _jobPeriodCredits[_job]);\n\n IERC20(_liquidity).safeTransferFrom(msg.sender, address(this), _amount);\n liquidityAmount[_job][_liquidity] += _amount;\n _jobPeriodCredits[_job] += _getReward(_quoteLiquidity(_amount, _liquidity));\n emit LiquidityAddition(_job, _liquidity, msg.sender, _amount);\n }\n\n /// @inheritdoc IKeep3rJobFundableLiquidity\n function unbondLiquidityFromJob(\n address _job,\n address _liquidity,\n uint256 _amount\n ) external override onlyJobOwner(_job) {\n canWithdrawAfter[_job][_liquidity] = block.timestamp + unbondTime;\n pendingUnbonds[_job][_liquidity] += _amount;\n _unbondLiquidityFromJob(_job, _liquidity, _amount);\n\n uint256 _remainingLiquidity = liquidityAmount[_job][_liquidity];\n if (_remainingLiquidity > 0 && _quoteLiquidity(_remainingLiquidity, _liquidity) < liquidityMinimum) revert JobLiquidityLessThanMin();\n\n emit Unbonding(_job, _liquidity, _amount);\n }\n\n /// @inheritdoc IKeep3rJobFundableLiquidity\n function withdrawLiquidityFromJob(\n address _job,\n address _liquidity,\n address _receiver\n ) external override onlyJobOwner(_job) {\n if (_receiver == address(0)) revert ZeroAddress();\n if (pendingUnbonds[_job][_liquidity] == 0) revert UnbondsUnexistent();\n if (canWithdrawAfter[_job][_liquidity] >= block.timestamp) revert UnbondsLocked();\n if (disputes[_job]) revert Disputed();\n\n uint256 _amount = pendingUnbonds[_job][_liquidity];\n\n delete pendingUnbonds[_job][_liquidity];\n delete canWithdrawAfter[_job][_liquidity];\n\n IERC20(_liquidity).safeTransfer(_receiver, _amount);\n emit LiquidityWithdrawal(_job, _liquidity, _receiver, _amount);\n }\n\n // Internal functions\n\n /// @notice Updates or rewards job liquidity credits depending on time since last job reward\n function _updateJobCreditsIfNeeded(address _job) internal returns (bool _rewarded) {\n if (rewardedAt[_job] < _period(block.timestamp)) {\n // Will exit function if job has been rewarded in current period\n if (rewardedAt[_job] <= _period(block.timestamp - rewardPeriodTime)) {\n // Will reset job to period syncronicity if a full period passed without rewards\n _updateJobPeriod(_job);\n _jobLiquidityCredits[_job] = _jobPeriodCredits[_job];\n rewardedAt[_job] = _period(block.timestamp);\n _rewarded = true;\n } else if ((block.timestamp - rewardedAt[_job]) >= rewardPeriodTime) {\n // Will reset job's syncronicity if last reward was more than epoch ago\n _updateJobPeriod(_job);\n _jobLiquidityCredits[_job] = _jobPeriodCredits[_job];\n rewardedAt[_job] += rewardPeriodTime;\n _rewarded = true;\n } else if (workedAt[_job] < _period(block.timestamp)) {\n // First keeper on period has to update job accountance to current twaps\n uint256 previousPeriodCredits = _jobPeriodCredits[_job];\n _updateJobPeriod(_job);\n _jobLiquidityCredits[_job] = (_jobLiquidityCredits[_job] * _jobPeriodCredits[_job]) / previousPeriodCredits;\n // Updating job accountance does not reward job\n }\n }\n }\n\n /// @notice Only called if _jobLiquidityCredits < payment\n function _rewardJobCredits(address _job) internal {\n /// @notice Only way to += jobLiquidityCredits is when keeper rewarding (cannot pay work)\n /* WARNING: this allows to top up _jobLiquidityCredits to a max of 1.99 but have to spend at least 1 */\n _jobLiquidityCredits[_job] += _phase(block.timestamp - rewardedAt[_job], _jobPeriodCredits[_job]);\n rewardedAt[_job] = block.timestamp;\n }\n\n /// @notice Updates accountance for _jobPeriodCredits\n function _updateJobPeriod(address _job) internal {\n _jobPeriodCredits[_job] = _calculateJobPeriodCredits(_job);\n }\n\n /// @notice Quotes the outdated job liquidities and calculates _periodCredits\n /// @dev This function is also responsible for keeping the KP3R/WETH quote updated\n function _calculateJobPeriodCredits(address _job) internal returns (uint256 _periodCredits) {\n for (uint256 i; i < _jobLiquidities[_job].length(); i++) {\n address _liquidity = _jobLiquidities[_job].at(i);\n if (_approvedLiquidities.contains(_liquidity)) {\n if (_tick[_liquidity].period != _period(block.timestamp)) {\n // Updates liquidity cache only if needed\n _tick[_liquidity] = observeLiquidity(_liquidity);\n }\n _periodCredits += _getReward(_quoteLiquidity(liquidityAmount[_job][_liquidity], _liquidity));\n }\n }\n }\n\n /// @notice Updates job accountance calculating the impact of the unbonded liquidity amount\n function _unbondLiquidityFromJob(\n address _job,\n address _liquidity,\n uint256 _amount\n ) internal nonReentrant {\n if (!_jobLiquidities[_job].contains(_liquidity)) revert JobLiquidityUnexistent();\n if (liquidityAmount[_job][_liquidity] < _amount) revert JobLiquidityInsufficient();\n\n // Ensures current twaps in job liquidities\n _updateJobPeriod(_job);\n uint256 _periodCreditsToRemove = _getReward(_quoteLiquidity(_amount, _liquidity));\n\n // A liquidity can be revoked causing a job to have 0 periodCredits\n if (_jobPeriodCredits[_job] > 0) {\n // Removes a % correspondant to a full rewardPeriodTime for the liquidity withdrawn vs all of the liquidities\n _jobLiquidityCredits[_job] -= (_jobLiquidityCredits[_job] * _periodCreditsToRemove) / _jobPeriodCredits[_job];\n _jobPeriodCredits[_job] -= _periodCreditsToRemove;\n }\n\n liquidityAmount[_job][_liquidity] -= _amount;\n if (liquidityAmount[_job][_liquidity] == 0) {\n _jobLiquidities[_job].remove(_liquidity);\n }\n }\n\n /// @notice Returns a fraction of the multiplier or the whole multiplier if equal or more than a rewardPeriodTime has passed\n function _phase(uint256 _timePassed, uint256 _multiplier) internal view returns (uint256 _result) {\n if (_timePassed < rewardPeriodTime) {\n _result = (_timePassed * _multiplier) / rewardPeriodTime;\n } else _result = _multiplier;\n }\n\n /// @notice Returns the start of the period of the provided timestamp\n function _period(uint256 _timestamp) internal view returns (uint256 _periodTimestamp) {\n return _timestamp - (_timestamp % rewardPeriodTime);\n }\n\n /// @notice Calculates relation between rewardPeriod and inflationPeriod\n function _getReward(uint256 _baseAmount) internal view returns (uint256 _credits) {\n return FullMath.mulDiv(_baseAmount, rewardPeriodTime, inflationPeriod);\n }\n\n /// @notice Returns underlying KP3R amount for a given liquidity amount\n function _quoteLiquidity(uint256 _amount, address _liquidity) internal view returns (uint256 _quote) {\n if (_tick[_liquidity].period != 0) {\n int56 _tickDifference = _isKP3RToken0[_liquidity] ? _tick[_liquidity].difference : -_tick[_liquidity].difference;\n _quote = IKeep3rHelper(keep3rHelper).getKP3RsAtTick(_amount, _tickDifference, rewardPeriodTime);\n }\n }\n\n /// @notice Updates job credits to current quotes and rewards job's pending minted credits\n /// @dev Ensures a maximum of 1 period of credits\n function _settleJobAccountance(address _job) internal virtual {\n _updateJobCreditsIfNeeded(_job);\n _rewardJobCredits(_job);\n _jobLiquidityCredits[_job] = Math.min(_jobLiquidityCredits[_job], _jobPeriodCredits[_job]);\n }\n}\n" - }, - "solidity/contracts/peripherals/Keep3rParameters.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../../interfaces/IKeep3rHelper.sol';\nimport '../../interfaces/peripherals/IKeep3rParameters.sol';\nimport '../../interfaces/external/IKeep3rV1Proxy.sol';\nimport './Keep3rAccountance.sol';\n\nabstract contract Keep3rParameters is IKeep3rParameters, Keep3rAccountance {\n /// @inheritdoc IKeep3rParameters\n address public override keep3rV1;\n\n /// @inheritdoc IKeep3rParameters\n address public override keep3rV1Proxy;\n\n /// @inheritdoc IKeep3rParameters\n address public override keep3rHelper;\n\n /// @inheritdoc IKeep3rParameters\n uint256 public override bondTime = 3 days;\n\n /// @inheritdoc IKeep3rParameters\n uint256 public override unbondTime = 14 days;\n\n /// @inheritdoc IKeep3rParameters\n uint256 public override liquidityMinimum = 3 ether;\n\n /// @inheritdoc IKeep3rParameters\n uint256 public override rewardPeriodTime = 5 days;\n\n /// @inheritdoc IKeep3rParameters\n uint256 public override inflationPeriod = 34 days;\n\n /// @inheritdoc IKeep3rParameters\n uint256 public override fee = 30;\n\n /// @notice The base that will be used to calculate the fee\n uint256 internal constant _BASE = 10_000;\n\n /// @notice The minimum reward period\n uint256 internal constant _MIN_REWARD_PERIOD_TIME = 1 days;\n\n constructor(\n address _keep3rHelper,\n address _keep3rV1,\n address _keep3rV1Proxy\n ) {\n keep3rHelper = _keep3rHelper;\n keep3rV1 = _keep3rV1;\n keep3rV1Proxy = _keep3rV1Proxy;\n }\n\n /// @inheritdoc IKeep3rParameters\n function setKeep3rHelper(address _keep3rHelper) external override onlyGovernance {\n if (_keep3rHelper == address(0)) revert ZeroAddress();\n keep3rHelper = _keep3rHelper;\n emit Keep3rHelperChange(_keep3rHelper);\n }\n\n /// @inheritdoc IKeep3rParameters\n function setKeep3rV1(address _keep3rV1) public virtual override onlyGovernance {\n if (_keep3rV1 == address(0)) revert ZeroAddress();\n _mint(totalBonds);\n\n keep3rV1 = _keep3rV1;\n emit Keep3rV1Change(_keep3rV1);\n }\n\n /// @inheritdoc IKeep3rParameters\n function setKeep3rV1Proxy(address _keep3rV1Proxy) external override onlyGovernance {\n if (_keep3rV1Proxy == address(0)) revert ZeroAddress();\n keep3rV1Proxy = _keep3rV1Proxy;\n emit Keep3rV1ProxyChange(_keep3rV1Proxy);\n }\n\n /// @inheritdoc IKeep3rParameters\n function setBondTime(uint256 _bondTime) external override onlyGovernance {\n bondTime = _bondTime;\n emit BondTimeChange(_bondTime);\n }\n\n /// @inheritdoc IKeep3rParameters\n function setUnbondTime(uint256 _unbondTime) external override onlyGovernance {\n unbondTime = _unbondTime;\n emit UnbondTimeChange(_unbondTime);\n }\n\n /// @inheritdoc IKeep3rParameters\n function setLiquidityMinimum(uint256 _liquidityMinimum) external override onlyGovernance {\n liquidityMinimum = _liquidityMinimum;\n emit LiquidityMinimumChange(_liquidityMinimum);\n }\n\n /// @inheritdoc IKeep3rParameters\n function setRewardPeriodTime(uint256 _rewardPeriodTime) external override onlyGovernance {\n if (_rewardPeriodTime < _MIN_REWARD_PERIOD_TIME) revert MinRewardPeriod();\n rewardPeriodTime = _rewardPeriodTime;\n emit RewardPeriodTimeChange(_rewardPeriodTime);\n }\n\n /// @inheritdoc IKeep3rParameters\n function setInflationPeriod(uint256 _inflationPeriod) external override onlyGovernance {\n inflationPeriod = _inflationPeriod;\n emit InflationPeriodChange(_inflationPeriod);\n }\n\n /// @inheritdoc IKeep3rParameters\n function setFee(uint256 _fee) external override onlyGovernance {\n fee = _fee;\n emit FeeChange(_fee);\n }\n\n function _mint(uint256 _amount) internal {\n totalBonds -= _amount;\n IKeep3rV1Proxy(keep3rV1Proxy).mint(_amount);\n }\n}\n" - }, - "@openzeppelin/contracts/security/ReentrancyGuard.sol": { - "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Contract module that helps prevent reentrant calls to a function.\n *\n * Inheriting from `ReentrancyGuard` will make the {nonReentrant} modifier\n * available, which can be applied to functions to make sure there are no nested\n * (reentrant) calls to them.\n *\n * Note that because there is a single `nonReentrant` guard, functions marked as\n * `nonReentrant` may not call one another. This can be worked around by making\n * those functions `private`, and then adding `external` `nonReentrant` entry\n * points to them.\n *\n * TIP: If you would like to learn more about reentrancy and alternative ways\n * to protect against it, check out our blog post\n * https://blog.openzeppelin.com/reentrancy-after-istanbul/[Reentrancy After Istanbul].\n */\nabstract contract ReentrancyGuard {\n // Booleans are more expensive than uint256 or any type that takes up a full\n // word because each write operation emits an extra SLOAD to first read the\n // slot's contents, replace the bits taken up by the boolean, and then write\n // back. This is the compiler's defense against contract upgrades and\n // pointer aliasing, and it cannot be disabled.\n\n // The values being non-zero value makes deployment a bit more expensive,\n // but in exchange the refund on every call to nonReentrant will be lower in\n // amount. Since refunds are capped to a percentage of the total\n // transaction's gas, it is best to keep them low in cases like this one, to\n // increase the likelihood of the full refund coming into effect.\n uint256 private constant _NOT_ENTERED = 1;\n uint256 private constant _ENTERED = 2;\n\n uint256 private _status;\n\n constructor() {\n _status = _NOT_ENTERED;\n }\n\n /**\n * @dev Prevents a contract from calling itself, directly or indirectly.\n * Calling a `nonReentrant` function from another `nonReentrant`\n * function is not supported. It is possible to prevent this from happening\n * by making the `nonReentrant` function external, and make it call a\n * `private` function that does the actual work.\n */\n modifier nonReentrant() {\n // On the first call to nonReentrant, _notEntered will be true\n require(_status != _ENTERED, \"ReentrancyGuard: reentrant call\");\n\n // Any calls to nonReentrant after this point will fail\n _status = _ENTERED;\n\n _;\n\n // By storing the original value once again, a refund is triggered (see\n // https://eips.ethereum.org/EIPS/eip-2200)\n _status = _NOT_ENTERED;\n }\n}\n" - }, - "@openzeppelin/contracts/utils/math/Math.sol": { - "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Standard math utilities missing in the Solidity language.\n */\nlibrary Math {\n /**\n * @dev Returns the largest of two numbers.\n */\n function max(uint256 a, uint256 b) internal pure returns (uint256) {\n return a >= b ? a : b;\n }\n\n /**\n * @dev Returns the smallest of two numbers.\n */\n function min(uint256 a, uint256 b) internal pure returns (uint256) {\n return a < b ? a : b;\n }\n\n /**\n * @dev Returns the average of two numbers. The result is rounded towards\n * zero.\n */\n function average(uint256 a, uint256 b) internal pure returns (uint256) {\n // (a + b) / 2 can overflow.\n return (a & b) + (a ^ b) / 2;\n }\n\n /**\n * @dev Returns the ceiling of the division of two numbers.\n *\n * This differs from standard division with `/` in that it rounds up instead\n * of rounding down.\n */\n function ceilDiv(uint256 a, uint256 b) internal pure returns (uint256) {\n // (a + b - 1) / b can overflow on addition, so we distribute.\n return a / b + (a % b == 0 ? 0 : 1);\n }\n}\n" - }, - "solidity/interfaces/external/IKeep3rV1Proxy.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../peripherals/IGovernable.sol';\n\ninterface IKeep3rV1Proxy is IGovernable {\n // Structs\n struct Recipient {\n address recipient;\n uint256 caps;\n }\n\n // Variables\n function keep3rV1() external view returns (address);\n\n function minter() external view returns (address);\n\n function next(address) external view returns (uint256);\n\n function caps(address) external view returns (uint256);\n\n function recipients() external view returns (address[] memory);\n\n function recipientsCaps() external view returns (Recipient[] memory);\n\n // Errors\n error Cooldown();\n error NoDrawableAmount();\n error ZeroAddress();\n error OnlyMinter();\n\n // Methods\n function addRecipient(address recipient, uint256 amount) external;\n\n function removeRecipient(address recipient) external;\n\n function draw() external returns (uint256 _amount);\n\n function setKeep3rV1(address _keep3rV1) external;\n\n function setMinter(address _minter) external;\n\n function mint(uint256 _amount) external;\n\n function mint(address _account, uint256 _amount) external;\n\n function setKeep3rV1Governance(address _governance) external;\n\n function acceptKeep3rV1Governance() external;\n\n function dispute(address _keeper) external;\n\n function slash(\n address _bonded,\n address _keeper,\n uint256 _amount\n ) external;\n\n function revoke(address _keeper) external;\n\n function resolve(address _keeper) external;\n\n function addJob(address _job) external;\n\n function removeJob(address _job) external;\n\n function addKPRCredit(address _job, uint256 _amount) external;\n\n function approveLiquidity(address _liquidity) external;\n\n function revokeLiquidity(address _liquidity) external;\n\n function setKeep3rHelper(address _keep3rHelper) external;\n\n function addVotes(address _voter, uint256 _amount) external;\n\n function removeVotes(address _voter, uint256 _amount) external;\n}\n" - }, - "solidity/interfaces/IKeep3rHelperParameters.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\n/// @title Keep3rHelperParameters contract\n/// @notice Contains all the helper functions used throughout the different files.\ninterface IKeep3rHelperParameters {\n // Structs\n\n /// @dev KP3R-WETH Pool address and isKP3RToken0\n /// @dev Created in order to save gas by avoiding calls to pool's token0 method\n struct TokenOraclePool {\n address poolAddress;\n bool isTKNToken0;\n }\n\n // Errors\n\n /// @notice Throws when pool does not have KP3R as token0 nor token1\n error InvalidOraclePool();\n\n // Events\n\n /// @notice Emitted when the kp3r weth pool is changed\n /// @param _address Address of the new kp3r weth pool\n /// @param _isKP3RToken0 True if calling the token0 method of the pool returns the KP3R token address\n event Kp3rWethPoolChange(address _address, bool _isKP3RToken0);\n\n /// @notice Emitted when the minimum boost multiplier is changed\n /// @param _minBoost The minimum boost multiplier\n event MinBoostChange(uint256 _minBoost);\n\n /// @notice Emitted when the maximum boost multiplier is changed\n /// @param _maxBoost The maximum boost multiplier\n event MaxBoostChange(uint256 _maxBoost);\n\n /// @notice Emitted when the target bond amount is changed\n /// @param _targetBond The target bond amount\n event TargetBondChange(uint256 _targetBond);\n\n /// @notice Emitted when the Keep3r V2 address is changed\n /// @param _keep3rV2 The address of Keep3r V2\n event Keep3rV2Change(address _keep3rV2);\n\n /// @notice Emitted when the work extra gas amount is changed\n /// @param _workExtraGas The work extra gas\n event WorkExtraGasChange(uint256 _workExtraGas);\n\n /// @notice Emitted when the quote twap time is changed\n /// @param _quoteTwapTime The twap time for quoting\n event QuoteTwapTimeChange(uint32 _quoteTwapTime);\n\n /// @notice Emitted when minimum rewarded gas fee is changed\n /// @param _minBaseFee The minimum rewarded gas fee\n event MinBaseFeeChange(uint256 _minBaseFee);\n\n /// @notice Emitted when minimum rewarded priority fee is changed\n /// @param _minPriorityFee The minimum expected fee that the keeper should pay\n event MinPriorityFeeChange(uint256 _minPriorityFee);\n\n // Variables\n\n /// @notice Address of KP3R token\n /// @return _kp3r Address of KP3R token\n // solhint-disable func-name-mixedcase\n function KP3R() external view returns (address _kp3r);\n\n /// @notice The boost base used to calculate the boost rewards for the keeper\n /// @return _base The boost base number\n function BOOST_BASE() external view returns (uint256 _base);\n\n /// @notice KP3R-WETH pool that is being used as oracle\n /// @return poolAddress Address of the pool\n /// @return isTKNToken0 True if calling the token0 method of the pool returns the KP3R token address\n function kp3rWethPool() external view returns (address poolAddress, bool isTKNToken0);\n\n /// @notice The minimum multiplier used to calculate the amount of gas paid to the Keeper for the gas used to perform a job\n /// For example: if the quoted gas used is 1000, then the minimum amount to be paid will be 1000 * minBoost / BOOST_BASE\n /// @return _multiplier The minimum boost multiplier\n function minBoost() external view returns (uint256 _multiplier);\n\n /// @notice The maximum multiplier used to calculate the amount of gas paid to the Keeper for the gas used to perform a job\n /// For example: if the quoted gas used is 1000, then the maximum amount to be paid will be 1000 * maxBoost / BOOST_BASE\n /// @return _multiplier The maximum boost multiplier\n function maxBoost() external view returns (uint256 _multiplier);\n\n /// @notice The targeted amount of bonded KP3Rs to max-up reward multiplier\n /// For example: if the amount of KP3R the keeper has bonded is targetBond or more, then the keeper will get\n /// the maximum boost possible in his rewards, if it's less, the reward boost will be proportional\n /// @return _target The amount of KP3R that comforms the targetBond\n function targetBond() external view returns (uint256 _target);\n\n /// @notice The amount of unaccounted gas that is going to be added to keeper payments\n /// @return _workExtraGas The work unaccounted gas amount\n function workExtraGas() external view returns (uint256 _workExtraGas);\n\n /// @notice The twap time for quoting\n /// @return _quoteTwapTime The twap time\n function quoteTwapTime() external view returns (uint32 _quoteTwapTime);\n\n /// @notice The minimum base fee that is used to calculate keeper rewards\n /// @return _minBaseFee The minimum rewarded gas fee\n function minBaseFee() external view returns (uint256 _minBaseFee);\n\n /// @notice The minimum priority fee that is also rewarded for keepers\n /// @return _minPriorityFee The minimum rewarded priority fee\n function minPriorityFee() external view returns (uint256 _minPriorityFee);\n\n /// @notice Address of Keep3r V2\n /// @return _keep3rV2 Address of Keep3r V2\n function keep3rV2() external view returns (address _keep3rV2);\n\n // Methods\n\n /// @notice Sets KP3R-WETH pool\n /// @param _poolAddress The address of the KP3R-WETH pool\n function setKp3rWethPool(address _poolAddress) external;\n\n /// @notice Sets the minimum boost multiplier\n /// @param _minBoost The minimum boost multiplier\n function setMinBoost(uint256 _minBoost) external;\n\n /// @notice Sets the maximum boost multiplier\n /// @param _maxBoost The maximum boost multiplier\n function setMaxBoost(uint256 _maxBoost) external;\n\n /// @notice Sets the target bond amount\n /// @param _targetBond The target bond amount\n function setTargetBond(uint256 _targetBond) external;\n\n /// @notice Sets the Keep3r V2 address\n /// @param _keep3rV2 The address of Keep3r V2\n function setKeep3rV2(address _keep3rV2) external;\n\n /// @notice Sets the work extra gas amount\n /// @param _workExtraGas The work extra gas\n function setWorkExtraGas(uint256 _workExtraGas) external;\n\n /// @notice Sets the quote twap time\n /// @param _quoteTwapTime The twap time for quoting\n function setQuoteTwapTime(uint32 _quoteTwapTime) external;\n\n /// @notice Sets the minimum rewarded gas fee\n /// @param _minBaseFee The minimum rewarded gas fee\n function setMinBaseFee(uint256 _minBaseFee) external;\n\n /// @notice Sets the minimum rewarded gas priority fee\n /// @param _minPriorityFee The minimum rewarded priority fee\n function setMinPriorityFee(uint256 _minPriorityFee) external;\n}\n" - }, - "solidity/interfaces/IPairManager.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol';\n\n/// @title Pair Manager interface\n/// @notice Generic interface for Keep3r liquidity pools (kLP)\ninterface IPairManager is IERC20Metadata {\n /// @notice Address of the factory from which the pair manager was created\n /// @return _factory The address of the PairManager Factory\n function factory() external view returns (address _factory);\n\n /// @notice Address of the pool from which the Keep3r pair manager will interact with\n /// @return _pool The address of the pool\n function pool() external view returns (address _pool);\n\n /// @notice Token0 of the pool\n /// @return _token0 The address of token0\n function token0() external view returns (address _token0);\n\n /// @notice Token1 of the pool\n /// @return _token1 The address of token1\n function token1() external view returns (address _token1);\n}\n" - }, - "solidity/contracts/libraries/FullMath.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\n/// @title Contains 512-bit math functions\n/// @notice Facilitates multiplication and division that can have overflow of an intermediate value without any loss of precision\n/// @dev Handles \"phantom overflow\" i.e., allows multiplication and division where an intermediate value overflows 256 bits\nlibrary FullMath {\n /// @notice Calculates floor(a×b÷denominator) with full precision. Throws if result overflows a uint256 or denominator == 0\n /// @param a The multiplicand\n /// @param b The multiplier\n /// @param denominator The divisor\n /// @return result The 256-bit result\n /// @dev Credit to Remco Bloemen under MIT license https://xn--2-umb.com/21/muldiv\n function mulDiv(\n uint256 a,\n uint256 b,\n uint256 denominator\n ) internal pure returns (uint256 result) {\n unchecked {\n // 512-bit multiply [prod1 prod0] = a * b\n // Compute the product mod 2**256 and mod 2**256 - 1\n // then use the Chinese Remainder Theorem to reconstruct\n // the 512 bit result. The result is stored in two 256\n // variables such that product = prod1 * 2**256 + prod0\n uint256 prod0; // Least significant 256 bits of the product\n uint256 prod1; // Most significant 256 bits of the product\n assembly {\n let mm := mulmod(a, b, not(0))\n prod0 := mul(a, b)\n prod1 := sub(sub(mm, prod0), lt(mm, prod0))\n }\n\n // Handle non-overflow cases, 256 by 256 division\n if (prod1 == 0) {\n require(denominator > 0);\n assembly {\n result := div(prod0, denominator)\n }\n return result;\n }\n\n // Make sure the result is less than 2**256.\n // Also prevents denominator == 0\n require(denominator > prod1);\n\n ///////////////////////////////////////////////\n // 512 by 256 division.\n ///////////////////////////////////////////////\n\n // Make division exact by subtracting the remainder from [prod1 prod0]\n // Compute remainder using mulmod\n uint256 remainder;\n assembly {\n remainder := mulmod(a, b, denominator)\n }\n // Subtract 256 bit number from 512 bit number\n assembly {\n prod1 := sub(prod1, gt(remainder, prod0))\n prod0 := sub(prod0, remainder)\n }\n\n // Factor powers of two out of denominator\n // Compute largest power of two divisor of denominator.\n // Always >= 1.\n uint256 twos = (~denominator + 1) & denominator;\n // Divide denominator by power of two\n assembly {\n denominator := div(denominator, twos)\n }\n\n // Divide [prod1 prod0] by the factors of two\n assembly {\n prod0 := div(prod0, twos)\n }\n // Shift in bits from prod1 into prod0. For this we need\n // to flip `twos` such that it is 2**256 / twos.\n // If twos is zero, then it becomes one\n assembly {\n twos := add(div(sub(0, twos), twos), 1)\n }\n prod0 |= prod1 * twos;\n\n // Invert denominator mod 2**256\n // Now that denominator is an odd number, it has an inverse\n // modulo 2**256 such that denominator * inv = 1 mod 2**256.\n // Compute the inverse by starting with a seed that is correct\n // correct for four bits. That is, denominator * inv = 1 mod 2**4\n uint256 inv = (3 * denominator) ^ 2;\n // Now use Newton-Raphson iteration to improve the precision.\n // Thanks to Hensel's lifting lemma, this also works in modular\n // arithmetic, doubling the correct bits in each step.\n inv *= 2 - denominator * inv; // inverse mod 2**8\n inv *= 2 - denominator * inv; // inverse mod 2**16\n inv *= 2 - denominator * inv; // inverse mod 2**32\n inv *= 2 - denominator * inv; // inverse mod 2**64\n inv *= 2 - denominator * inv; // inverse mod 2**128\n inv *= 2 - denominator * inv; // inverse mod 2**256\n\n // Because the division is now exact we can divide by multiplying\n // with the modular inverse of denominator. This will give us the\n // correct result modulo 2**256. Since the precoditions guarantee\n // that the outcome is less than 2**256, this is the final result.\n // We don't need to compute the high bits of the result and prod1\n // is no longer required.\n result = prod0 * inv;\n return result;\n }\n }\n\n /// @notice Calculates ceil(a×b÷denominator) with full precision. Throws if result overflows a uint256 or denominator == 0\n /// @param a The multiplicand\n /// @param b The multiplier\n /// @param denominator The divisor\n /// @return result The 256-bit result\n function mulDivRoundingUp(\n uint256 a,\n uint256 b,\n uint256 denominator\n ) internal pure returns (uint256 result) {\n unchecked {\n result = mulDiv(a, b, denominator);\n if (mulmod(a, b, denominator) > 0) {\n require(result < type(uint256).max);\n result++;\n }\n }\n }\n}\n" - }, - "@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol": { - "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\nimport \"../IERC20.sol\";\n\n/**\n * @dev Interface for the optional metadata functions from the ERC20 standard.\n *\n * _Available since v4.1._\n */\ninterface IERC20Metadata is IERC20 {\n /**\n * @dev Returns the name of the token.\n */\n function name() external view returns (string memory);\n\n /**\n * @dev Returns the symbol of the token.\n */\n function symbol() external view returns (string memory);\n\n /**\n * @dev Returns the decimals places of the token.\n */\n function decimals() external view returns (uint8);\n}\n" - }, - "solidity/contracts/peripherals/Keep3rDisputable.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport './Keep3rParameters.sol';\nimport '../../interfaces/peripherals/IKeep3rDisputable.sol';\n\nabstract contract Keep3rDisputable is IKeep3rDisputable, Keep3rParameters {\n /// @inheritdoc IKeep3rDisputable\n function dispute(address _jobOrKeeper) external override onlyDisputer {\n if (disputes[_jobOrKeeper]) revert AlreadyDisputed();\n disputes[_jobOrKeeper] = true;\n emit Dispute(_jobOrKeeper, msg.sender);\n }\n\n /// @inheritdoc IKeep3rDisputable\n function resolve(address _jobOrKeeper) external override onlyDisputer {\n if (!disputes[_jobOrKeeper]) revert NotDisputed();\n disputes[_jobOrKeeper] = false;\n emit Resolve(_jobOrKeeper, msg.sender);\n }\n}\n" - }, - "solidity/contracts/peripherals/keepers/Keep3rKeeperDisputable.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport './Keep3rKeeperFundable.sol';\nimport '../Keep3rDisputable.sol';\nimport '../../../interfaces/external/IKeep3rV1.sol';\nimport '../../../interfaces/peripherals/IKeep3rKeepers.sol';\n\nabstract contract Keep3rKeeperDisputable is IKeep3rKeeperDisputable, Keep3rDisputable, Keep3rKeeperFundable {\n using EnumerableSet for EnumerableSet.AddressSet;\n using SafeERC20 for IERC20;\n\n /// @inheritdoc IKeep3rKeeperDisputable\n function slash(\n address _keeper,\n address _bonded,\n uint256 _bondAmount,\n uint256 _unbondAmount\n ) external override onlySlasher {\n if (!disputes[_keeper]) revert NotDisputed();\n _slash(_keeper, _bonded, _bondAmount, _unbondAmount);\n emit KeeperSlash(_keeper, msg.sender, _bondAmount + _unbondAmount);\n }\n\n /// @inheritdoc IKeep3rKeeperDisputable\n function revoke(address _keeper) external override onlySlasher {\n if (!disputes[_keeper]) revert NotDisputed();\n _keepers.remove(_keeper);\n _slash(_keeper, keep3rV1, bonds[_keeper][keep3rV1], pendingUnbonds[_keeper][keep3rV1]);\n emit KeeperRevoke(_keeper, msg.sender);\n }\n\n function _slash(\n address _keeper,\n address _bonded,\n uint256 _bondAmount,\n uint256 _unbondAmount\n ) internal {\n if (_bonded != keep3rV1) {\n try IERC20(_bonded).transfer(governance, _bondAmount + _unbondAmount) returns (bool) {} catch (bytes memory) {}\n }\n bonds[_keeper][_bonded] -= _bondAmount;\n pendingUnbonds[_keeper][_bonded] -= _unbondAmount;\n }\n}\n" - }, - "solidity/contracts/peripherals/keepers/Keep3rKeeperFundable.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../Keep3rAccountance.sol';\nimport '../Keep3rParameters.sol';\nimport '../../../interfaces/peripherals/IKeep3rKeepers.sol';\n\nimport '../../../interfaces/external/IKeep3rV1.sol';\n\nimport '@openzeppelin/contracts/security/ReentrancyGuard.sol';\nimport '@openzeppelin/contracts/token/ERC20/IERC20.sol';\nimport '@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol';\n\nabstract contract Keep3rKeeperFundable is IKeep3rKeeperFundable, ReentrancyGuard, Keep3rParameters {\n using EnumerableSet for EnumerableSet.AddressSet;\n using SafeERC20 for IERC20;\n\n /// @inheritdoc IKeep3rKeeperFundable\n function bond(address _bonding, uint256 _amount) external override nonReentrant {\n if (disputes[msg.sender]) revert Disputed();\n if (_jobs.contains(msg.sender)) revert AlreadyAJob();\n canActivateAfter[msg.sender][_bonding] = block.timestamp + bondTime;\n\n uint256 _before = IERC20(_bonding).balanceOf(address(this));\n IERC20(_bonding).safeTransferFrom(msg.sender, address(this), _amount);\n _amount = IERC20(_bonding).balanceOf(address(this)) - _before;\n\n hasBonded[msg.sender] = true;\n pendingBonds[msg.sender][_bonding] += _amount;\n\n emit Bonding(msg.sender, _bonding, _amount);\n }\n\n /// @inheritdoc IKeep3rKeeperFundable\n function activate(address _bonding) external override {\n address _keeper = msg.sender;\n if (disputes[_keeper]) revert Disputed();\n uint256 _canActivateAfter = canActivateAfter[_keeper][_bonding];\n if (_canActivateAfter == 0) revert BondsUnexistent();\n if (_canActivateAfter >= block.timestamp) revert BondsLocked();\n\n if (firstSeen[_keeper] == 0) {\n firstSeen[_keeper] = block.timestamp;\n }\n _keepers.add(_keeper);\n\n uint256 _amount = pendingBonds[_keeper][_bonding];\n delete pendingBonds[_keeper][_bonding];\n\n // bond provided tokens\n bonds[_keeper][_bonding] += _amount;\n if (_bonding == keep3rV1) {\n totalBonds += _amount;\n _depositBonds(_amount);\n }\n\n emit Activation(_keeper, _bonding, _amount);\n }\n\n /// @inheritdoc IKeep3rKeeperFundable\n function unbond(address _bonding, uint256 _amount) external override {\n canWithdrawAfter[msg.sender][_bonding] = block.timestamp + unbondTime;\n bonds[msg.sender][_bonding] -= _amount;\n pendingUnbonds[msg.sender][_bonding] += _amount;\n\n emit Unbonding(msg.sender, _bonding, _amount);\n }\n\n /// @inheritdoc IKeep3rKeeperFundable\n function withdraw(address _bonding) external override nonReentrant {\n if (pendingUnbonds[msg.sender][_bonding] == 0) revert UnbondsUnexistent();\n if (canWithdrawAfter[msg.sender][_bonding] >= block.timestamp) revert UnbondsLocked();\n if (disputes[msg.sender]) revert Disputed();\n\n uint256 _amount = pendingUnbonds[msg.sender][_bonding];\n\n delete pendingUnbonds[msg.sender][_bonding];\n delete canWithdrawAfter[msg.sender][_bonding];\n\n if (_bonding == keep3rV1) _mint(_amount);\n IERC20(_bonding).safeTransfer(msg.sender, _amount);\n\n emit Withdrawal(msg.sender, _bonding, _amount);\n }\n\n function _depositBonds(uint256 _amount) internal virtual {\n IKeep3rV1(keep3rV1).burn(_amount);\n }\n}\n" - }, - "solidity/interfaces/external/IKeep3rV1.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '@openzeppelin/contracts/token/ERC20/IERC20.sol';\nimport '@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol';\n\n// solhint-disable func-name-mixedcase\ninterface IKeep3rV1 is IERC20, IERC20Metadata {\n // Structs\n struct Checkpoint {\n uint32 fromBlock;\n uint256 votes;\n }\n\n // Events\n event DelegateChanged(address indexed _delegator, address indexed _fromDelegate, address indexed _toDelegate);\n event DelegateVotesChanged(address indexed _delegate, uint256 _previousBalance, uint256 _newBalance);\n event SubmitJob(address indexed _job, address indexed _liquidity, address indexed _provider, uint256 _block, uint256 _credit);\n event ApplyCredit(address indexed _job, address indexed _liquidity, address indexed _provider, uint256 _block, uint256 _credit);\n event RemoveJob(address indexed _job, address indexed _liquidity, address indexed _provider, uint256 _block, uint256 _credit);\n event UnbondJob(address indexed _job, address indexed _liquidity, address indexed _provider, uint256 _block, uint256 _credit);\n event JobAdded(address indexed _job, uint256 _block, address _governance);\n event JobRemoved(address indexed _job, uint256 _block, address _governance);\n event KeeperWorked(address indexed _credit, address indexed _job, address indexed _keeper, uint256 _block, uint256 _amount);\n event KeeperBonding(address indexed _keeper, uint256 _block, uint256 _active, uint256 _bond);\n event KeeperBonded(address indexed _keeper, uint256 _block, uint256 _activated, uint256 _bond);\n event KeeperUnbonding(address indexed _keeper, uint256 _block, uint256 _deactive, uint256 _bond);\n event KeeperUnbound(address indexed _keeper, uint256 _block, uint256 _deactivated, uint256 _bond);\n event KeeperSlashed(address indexed _keeper, address indexed _slasher, uint256 _block, uint256 _slash);\n event KeeperDispute(address indexed _keeper, uint256 _block);\n event KeeperResolved(address indexed _keeper, uint256 _block);\n event TokenCreditAddition(address indexed _credit, address indexed _job, address indexed _creditor, uint256 _block, uint256 _amount);\n\n // Variables\n function KPRH() external returns (address);\n\n function delegates(address _delegator) external view returns (address);\n\n function checkpoints(address _account, uint32 _checkpoint) external view returns (Checkpoint memory);\n\n function numCheckpoints(address _account) external view returns (uint32);\n\n function DOMAIN_TYPEHASH() external returns (bytes32);\n\n function DOMAINSEPARATOR() external returns (bytes32);\n\n function DELEGATION_TYPEHASH() external returns (bytes32);\n\n function PERMIT_TYPEHASH() external returns (bytes32);\n\n function nonces(address _user) external view returns (uint256);\n\n function BOND() external returns (uint256);\n\n function UNBOND() external returns (uint256);\n\n function LIQUIDITYBOND() external returns (uint256);\n\n function FEE() external returns (uint256);\n\n function BASE() external returns (uint256);\n\n function ETH() external returns (address);\n\n function bondings(address _user, address _bonding) external view returns (uint256);\n\n function canWithdrawAfter(address _user, address _bonding) external view returns (uint256);\n\n function pendingUnbonds(address _keeper, address _bonding) external view returns (uint256);\n\n function pendingbonds(address _keeper, address _bonding) external view returns (uint256);\n\n function bonds(address _keeper, address _bonding) external view returns (uint256);\n\n function votes(address _delegator) external view returns (uint256);\n\n function firstSeen(address _keeper) external view returns (uint256);\n\n function disputes(address _keeper) external view returns (bool);\n\n function lastJob(address _keeper) external view returns (uint256);\n\n function workCompleted(address _keeper) external view returns (uint256);\n\n function jobs(address _job) external view returns (bool);\n\n function credits(address _job, address _credit) external view returns (uint256);\n\n function liquidityProvided(\n address _provider,\n address _liquidity,\n address _job\n ) external view returns (uint256);\n\n function liquidityUnbonding(\n address _provider,\n address _liquidity,\n address _job\n ) external view returns (uint256);\n\n function liquidityAmountsUnbonding(\n address _provider,\n address _liquidity,\n address _job\n ) external view returns (uint256);\n\n function jobProposalDelay(address _job) external view returns (uint256);\n\n function liquidityApplied(\n address _provider,\n address _liquidity,\n address _job\n ) external view returns (uint256);\n\n function liquidityAmount(\n address _provider,\n address _liquidity,\n address _job\n ) external view returns (uint256);\n\n function keepers(address _keeper) external view returns (bool);\n\n function blacklist(address _keeper) external view returns (bool);\n\n function keeperList(uint256 _index) external view returns (address);\n\n function jobList(uint256 _index) external view returns (address);\n\n function governance() external returns (address);\n\n function pendingGovernance() external returns (address);\n\n function liquidityAccepted(address _liquidity) external view returns (bool);\n\n function liquidityPairs(uint256 _index) external view returns (address);\n\n // Methods\n function getCurrentVotes(address _account) external view returns (uint256);\n\n function addCreditETH(address _job) external payable;\n\n function addCredit(\n address _credit,\n address _job,\n uint256 _amount\n ) external;\n\n function addVotes(address _voter, uint256 _amount) external;\n\n function removeVotes(address _voter, uint256 _amount) external;\n\n function addKPRCredit(address _job, uint256 _amount) external;\n\n function approveLiquidity(address _liquidity) external;\n\n function revokeLiquidity(address _liquidity) external;\n\n function pairs() external view returns (address[] memory);\n\n function addLiquidityToJob(\n address _liquidity,\n address _job,\n uint256 _amount\n ) external;\n\n function applyCreditToJob(\n address _provider,\n address _liquidity,\n address _job\n ) external;\n\n function unbondLiquidityFromJob(\n address _liquidity,\n address _job,\n uint256 _amount\n ) external;\n\n function removeLiquidityFromJob(address _liquidity, address _job) external;\n\n function mint(uint256 _amount) external;\n\n function burn(uint256 _amount) external;\n\n function worked(address _keeper) external;\n\n function receipt(\n address _credit,\n address _keeper,\n uint256 _amount\n ) external;\n\n function receiptETH(address _keeper, uint256 _amount) external;\n\n function addJob(address _job) external;\n\n function getJobs() external view returns (address[] memory);\n\n function removeJob(address _job) external;\n\n function setKeep3rHelper(address _keep3rHelper) external;\n\n function setGovernance(address _governance) external;\n\n function acceptGovernance() external;\n\n function isKeeper(address _keeper) external returns (bool);\n\n function isMinKeeper(\n address _keeper,\n uint256 _minBond,\n uint256 _earned,\n uint256 _age\n ) external returns (bool);\n\n function isBondedKeeper(\n address _keeper,\n address _bond,\n uint256 _minBond,\n uint256 _earned,\n uint256 _age\n ) external returns (bool);\n\n function bond(address _bonding, uint256 _amount) external;\n\n function getKeepers() external view returns (address[] memory);\n\n function activate(address _bonding) external;\n\n function unbond(address _bonding, uint256 _amount) external;\n\n function slash(\n address _bonded,\n address _keeper,\n uint256 _amount\n ) external;\n\n function withdraw(address _bonding) external;\n\n function dispute(address _keeper) external;\n\n function revoke(address _keeper) external;\n\n function resolve(address _keeper) external;\n\n function permit(\n address _owner,\n address _spender,\n uint256 _amount,\n uint256 _deadline,\n uint8 _v,\n bytes32 _r,\n bytes32 _s\n ) external;\n}\n" - }, - "solidity/for-test/testnet/Keep3rForTestnet.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../../contracts/Keep3r.sol';\n\ncontract Keep3rForTestnet is Keep3r {\n constructor(\n address _governance,\n address _keep3rHelper,\n address _keep3rV1,\n address _keep3rV1Proxy\n ) Keep3r(_governance, _keep3rHelper, _keep3rV1, _keep3rV1Proxy) {\n bondTime = 0; // allows keepers to instantly register\n unbondTime = 0; // allows keepers & jobOwners to instantly withdraw funds\n liquidityMinimum = 1; // allows job providers to add low liquidity\n rewardPeriodTime = 1 days; // reduces twap calculation period\n inflationPeriod = 5 days; // increases credit minting\n }\n}\n" - }, - "solidity/for-test/Keep3rForTest.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../contracts/Keep3r.sol';\n\ncontract Keep3rForTest is Keep3r {\n constructor(\n address _governance,\n address _keep3rHelper,\n address _keep3rV1,\n address _keep3rV1Proxy\n ) Keep3r(_governance, _keep3rHelper, _keep3rV1, _keep3rV1Proxy) {}\n}\n" - }, - "solidity/contracts/sidechain/Keep3rSidechain.sol": { - "content": "// SPDX-License-Identifier: MIT\n\n/*\n\nCoded for The Keep3r Network with ♥ by\n\n██████╗░███████╗███████╗██╗░░░██╗░░░░░░░██╗░█████╗░███╗░░██╗██████╗░███████╗██████╗░██╗░░░░░░█████╗░███╗░░██╗██████╗░\n██╔══██╗██╔════╝██╔════╝██║░░░██║░░██╗░░██║██╔══██╗████╗░██║██╔══██╗██╔════╝██╔══██╗██║░░░░░██╔══██╗████╗░██║██╔══██╗\n██║░░██║█████╗░░█████╗░░██║░░░╚██╗████╗██╔╝██║░░██║██╔██╗██║██║░░██║█████╗░░██████╔╝██║░░░░░███████║██╔██╗██║██║░░██║\n██║░░██║██╔══╝░░██╔══╝░░██║░░░░████╔═████║░██║░░██║██║╚████║██║░░██║██╔══╝░░██╔══██╗██║░░░░░██╔══██║██║╚████║██║░░██║\n██████╔╝███████╗██║░░░░░██║░░░░╚██╔╝░╚██╔╝░╚█████╔╝██║░╚███║██████╔╝███████╗██║░░██║███████╗██║░░██║██║░╚███║██████╔╝\n╚═════╝░╚══════╝╚═╝░░░░░╚═╝░░░░░╚═╝░░░╚═╝░░░╚════╝░╚═╝░░╚══╝╚═════╝░╚══════╝╚═╝░░╚═╝╚══════╝╚═╝░░╚═╝╚═╝░░╚══╝╚═════╝░\n\nhttps://defi.sucks\n\n*/\n\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../Keep3r.sol';\nimport '../../interfaces/sidechain/IKeep3rEscrow.sol';\nimport '../../interfaces/sidechain/IKeep3rHelperSidechain.sol';\nimport '../../interfaces/sidechain/IKeep3rJobWorkableRated.sol';\nimport '../../interfaces/sidechain/IKeep3rSidechainAccountance.sol';\n\ncontract Keep3rSidechain is Keep3r, IKeep3rJobWorkableRated, IKeep3rSidechainAccountance {\n using EnumerableSet for EnumerableSet.AddressSet;\n\n /// @param _governance Address of governance\n /// @param _keep3rHelperSidechain Address of sidechain Keep3rHelper\n /// @param _wrappedKP3R Address of wrapped KP3R implementation\n /// @param _keep3rEscrow Address of sidechain Keep3rEscrow\n constructor(\n address _governance, // governance\n address _keep3rHelperSidechain, // helper\n address _wrappedKP3R, // keep3rV1\n address _keep3rEscrow // keep3rV1Proxy\n ) Keep3r(_governance, _keep3rHelperSidechain, _wrappedKP3R, _keep3rEscrow) {}\n\n // Keep3rSidechainAccountance\n\n /// @inheritdoc IKeep3rSidechainAccountance\n function virtualReserves() external view override returns (int256 _virtualReserves) {\n // Queries wKP3R balanceOf escrow contract minus the totalBonds\n return int256(IERC20(keep3rV1).balanceOf(keep3rV1Proxy)) - int256(totalBonds);\n }\n\n // Keep3rJobFundableLiquidity\n\n /// @notice Sidechain implementation asks the Helper for an oracle, instead of reading it from the ERC-20\n /// @dev Function should be called after setting an oracle in Keep3rHelperSidechain\n /// @param _liquidity Address of the liquidity token being approved\n function approveLiquidity(address _liquidity) external virtual override onlyGovernance {\n if (!_approvedLiquidities.add(_liquidity)) revert LiquidityPairApproved();\n _liquidityPool[_liquidity] = IKeep3rHelperSidechain(keep3rHelper).oracle(_liquidity);\n if (_liquidityPool[_liquidity] == address(0)) revert ZeroAddress();\n _isKP3RToken0[_liquidity] = IKeep3rHelper(keep3rHelper).isKP3RToken0(_liquidityPool[_liquidity]);\n _tick[_liquidity] = observeLiquidity(_liquidity);\n emit LiquidityApproval(_liquidity);\n }\n\n /// @notice Sidechain implementation will always ask for 2 tickCumulatives instead of cacheing\n /// @param _liquidity Address of the liquidity token being observed\n function observeLiquidity(address _liquidity) public view virtual override returns (TickCache memory _tickCache) {\n if (_tick[_liquidity].period == _period(block.timestamp)) {\n // Will return cached twaps if liquidity is updated\n _tickCache = _tick[_liquidity];\n } else {\n bool success;\n\n // Will always ask for 2 accumulators in sidechain\n uint32[] memory _secondsAgo = new uint32[](2);\n\n _secondsAgo[0] = uint32(block.timestamp - _period(block.timestamp));\n _secondsAgo[1] = uint32(block.timestamp - _period(block.timestamp) + rewardPeriodTime);\n\n int56 _tickCumulative2;\n (_tickCache.current, _tickCumulative2, success) = IKeep3rHelper(keep3rHelper).observe(_liquidityPool[_liquidity], _secondsAgo);\n\n _tickCache.difference = _tickCache.current - _tickCumulative2;\n\n if (success) {\n _tickCache.period = _period(block.timestamp);\n } else {\n delete _tickCache.period;\n }\n }\n }\n\n // Keep3rJobsWorkable\n\n /// @dev Sidechain implementation deprecates worked(address) as it should come with a usdPerGasUnit parameter\n function worked(address) external pure override {\n revert Deprecated();\n }\n\n /// @notice Implemented by jobs to show that a keeper performed work\n /// @dev Uses a USD per gas unit payment mechanism\n /// @param _keeper Address of the keeper that performed the work\n /// @param _usdPerGasUnit Units of USD (in wei) per gas unit that should be rewarded to the keeper\n function worked(address _keeper, uint256 _usdPerGasUnit) external override {\n if (_initialGas == 0) revert GasNotInitialized();\n // Gas used for quote calculations & payment is not rewarded\n uint256 _gasLeft = _getGasLeft();\n\n address _job = msg.sender;\n if (disputes[_job]) revert JobDisputed();\n if (!_jobs.contains(_job)) revert JobUnapproved();\n\n if (_updateJobCreditsIfNeeded(_job)) {\n emit LiquidityCreditsReward(_job, rewardedAt[_job], _jobLiquidityCredits[_job], _jobPeriodCredits[_job]);\n }\n\n (uint256 _boost, uint256 _oneUsdQuote, uint256 _extraGas) = IKeep3rHelper(keep3rHelper).getPaymentParams(bonds[_keeper][keep3rV1]);\n\n uint256 _kp3rPayment = _calculatePayment(_gasLeft, _extraGas, _oneUsdQuote * _usdPerGasUnit, _boost);\n\n if (_kp3rPayment > _jobLiquidityCredits[_job]) {\n _rewardJobCredits(_job);\n emit LiquidityCreditsReward(_job, rewardedAt[_job], _jobLiquidityCredits[_job], _jobPeriodCredits[_job]);\n }\n\n _bondedPayment(_job, _keeper, _kp3rPayment);\n delete _initialGas;\n\n emit KeeperWork(keep3rV1, _job, _keeper, _kp3rPayment, _gasLeft);\n }\n\n // Keep3rKeeperFundable\n\n /// @dev Sidechain implementation doesn't burn tokens, but deposit them in Keep3rEscrow\n function _depositBonds(uint256 _amount) internal virtual override {\n IKeep3rV1(keep3rV1).approve(keep3rV1Proxy, _amount);\n IKeep3rEscrow(keep3rV1Proxy).deposit(_amount);\n }\n}\n" - }, - "solidity/interfaces/sidechain/IKeep3rEscrow.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\n// solhint-disable-next-line no-empty-blocks\n\nimport '../peripherals/IMintable.sol';\n\n/// @title Keep3rEscrow contract\n/// @notice This contract acts as an escrow contract for wKP3R tokens on sidechains and L2s\n/// @dev Can be used as a replacement for keep3rV1Proxy in keep3r sidechain implementations\ninterface IKeep3rEscrow is IMintable {\n /// @notice Emitted when Keep3rEscrow#deposit function is called\n /// @param _wKP3R The addess of the wrapped KP3R token\n /// @param _sender The address that called the function\n /// @param _amount The amount of wKP3R the user deposited\n event wKP3RDeposited(address _wKP3R, address _sender, uint256 _amount);\n\n /// @notice Emitted when Keep3rEscrow#mint function is called\n /// @param _wKP3R The addess of the wrapped KP3R token\n /// @param _recipient The address that will received the newly minted wKP3R\n /// @param _amount The amount of wKP3R minted to the recipient\n event wKP3RMinted(address _wKP3R, address _recipient, uint256 _amount);\n\n /// @notice Emitted when Keep3rEscrow#setWKP3R function is called\n /// @param _newWKP3R The address of the wKP3R contract\n event wKP3RSet(address _newWKP3R);\n\n /// @notice Throws when minter attempts to withdraw more wKP3R than the escrow has in its balance\n error InsufficientBalance();\n\n /// @notice Lists the address of the wKP3R contract\n /// @return _wKP3RAddress The address of wKP3R\n function wKP3R() external view returns (address _wKP3RAddress);\n\n /// @notice Deposits wKP3R into the contract\n /// @param _amount The amount of wKP3R to deposit\n function deposit(uint256 _amount) external;\n\n /// @notice mints wKP3R to the recipient\n /// @param _amount The amount of wKP3R to mint\n function mint(uint256 _amount) external;\n\n /// @notice sets the wKP3R address\n /// @param _wKP3R the wKP3R address\n function setWKP3R(address _wKP3R) external;\n}\n" - }, - "solidity/interfaces/sidechain/IKeep3rHelperSidechain.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../IKeep3rHelper.sol';\n\n/// @title Keep3rHelperSidechain contract\n/// @notice Contains all the helper functions for sidechain keep3r implementations\ninterface IKeep3rHelperSidechain is IKeep3rHelper {\n // Events\n\n /// @notice The oracle for a liquidity has been saved\n /// @param _liquidity The address of the given liquidity\n /// @param _oraclePool The address of the oracle pool\n event OracleSet(address _liquidity, address _oraclePool);\n\n /// @notice Emitted when the WETH USD pool is changed\n /// @param _address Address of the new WETH USD pool\n /// @param _isWETHToken0 True if calling the token0 method of the pool returns the WETH token address\n event WethUSDPoolChange(address _address, bool _isWETHToken0);\n\n /// Variables\n\n /// @notice Ethereum mainnet WETH address used for quoting references\n /// @return _weth Address of WETH token\n // solhint-disable func-name-mixedcase\n function WETH() external view returns (address _weth);\n\n /// @return _oracle The address of the observable pool for given liquidity\n function oracle(address _liquidity) external view returns (address _oracle);\n\n /// @notice WETH-USD pool that is being used as oracle\n /// @return poolAddress Address of the pool\n /// @return isTKNToken0 True if calling the token0 method of the pool returns the WETH token address\n function wethUSDPool() external view returns (address poolAddress, bool isTKNToken0);\n\n /// @notice Quotes USD to ETH\n /// @dev Used to know how much ETH should be paid to keepers before converting it from ETH to KP3R\n /// @param _usd The amount of USD to quote to ETH\n /// @return _eth The resulting amount of ETH after quoting the USD\n function quoteUsdToEth(uint256 _usd) external returns (uint256 _eth);\n\n /// Methods\n\n /// @notice Sets an oracle for a given liquidity\n /// @param _liquidity The address of the liquidity\n /// @param _oracle The address of the pool used to quote the liquidity from\n /// @dev The oracle must contain KP3R as either token0 or token1\n function setOracle(address _liquidity, address _oracle) external;\n\n /// @notice Sets an oracle for querying WETH/USD quote\n /// @param _poolAddress The address of the pool used as oracle\n /// @dev The oracle must contain WETH as either token0 or token1\n function setWethUsdPool(address _poolAddress) external;\n}\n" - }, - "solidity/interfaces/sidechain/IKeep3rJobWorkableRated.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../peripherals/IKeep3rJobs.sol';\n\n/// @title Keep3rJobWorkableRated contract\n/// @notice Implements a quoting in USD per gas unit for Keep3r jobs\ninterface IKeep3rJobWorkableRated is IKeep3rJobs {\n /// @notice Throws when job contract calls deprecated worked(address) function\n error Deprecated();\n\n /// @notice Implemented by jobs to show that a keeper performed work and reward in stable USD quote\n /// @dev Automatically calculates the payment for the keeper and pays the keeper with bonded KP3R\n /// @param _keeper Address of the keeper that performed the work\n /// @param _usdPerGasUnit Amount of USD in wei rewarded for gas unit worked by the keeper\n function worked(address _keeper, uint256 _usdPerGasUnit) external;\n}\n" - }, - "solidity/interfaces/sidechain/IKeep3rSidechainAccountance.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\n/// @title IKeep3rSidechainAccountance interface\n/// @notice Implements a view to get the amount of credits that can be withdrawn\ninterface IKeep3rSidechainAccountance {\n /// @notice The surplus amount of wKP3Rs in escrow contract\n /// @return _virtualReserves The surplus amount of wKP3Rs in escrow contract\n function virtualReserves() external view returns (int256 _virtualReserves);\n}\n" - }, - "solidity/interfaces/peripherals/IMintable.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport './IGovernable.sol';\nimport './IBaseErrors.sol';\n\n/// @title Mintable contract\n/// @notice Manages the minter role\ninterface IMintable is IBaseErrors, IGovernable {\n // Events\n\n /// @notice Emitted when governance sets a new minter\n /// @param _minter Address of the new minter\n event MinterSet(address _minter);\n\n // Errors\n\n /// @notice Throws if the caller of the function is not the minter\n error OnlyMinter();\n\n // Variables\n\n /// @notice Stores the minter address\n /// @return _minter The minter addresss\n function minter() external view returns (address _minter);\n\n // Methods\n\n /// @notice Sets a new address to be the minter\n /// @param _minter The address set as the minter\n function setMinter(address _minter) external;\n}\n" - }, - "solidity/for-test/testnet/Keep3rSidechainForTestnet.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../../contracts/sidechain/Keep3rSidechain.sol';\n\ncontract Keep3rSidechainForTestnet is Keep3rSidechain {\n constructor(\n address _governance,\n address _keep3rHelper,\n address _keep3rV1,\n address _keep3rV1Proxy\n ) Keep3rSidechain(_governance, _keep3rHelper, _keep3rV1, _keep3rV1Proxy) {\n bondTime = 0; // allows keepers to instantly register\n unbondTime = 0; // allows keepers & jobOwners to instantly withdraw funds\n liquidityMinimum = 1; // allows job providers to add low liquidity\n rewardPeriodTime = 1 days; // reduces twap calculation period\n inflationPeriod = 5 days; // increases credit minting\n }\n}\n" - }, - "solidity/for-test/Keep3rSidechainForTest.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../contracts/sidechain/Keep3rSidechain.sol';\n\ncontract Keep3rSidechainForTest is Keep3rSidechain {\n using EnumerableSet for EnumerableSet.AddressSet;\n\n constructor(\n address _governance,\n address _keep3rHelper,\n address _wrappedKP3R,\n address _keep3rEscrow\n ) Keep3rSidechain(_governance, _keep3rHelper, _wrappedKP3R, _keep3rEscrow) {}\n\n function setJobLiquidity(address _job, address _liquidity) external {\n _jobLiquidities[_job].add(_liquidity);\n }\n}\n" - }, - "solidity/for-test/JobRatedForTest.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../interfaces/IKeep3r.sol';\nimport '../interfaces/sidechain/IKeep3rJobWorkableRated.sol';\n\ncontract JobRatedForTest {\n error InvalidKeeper();\n address public keep3r;\n uint256 public nonce;\n uint256 public usdPerGasUnit = 1_000e9;\n\n constructor(address _keep3r) {\n keep3r = _keep3r;\n }\n\n function work() external {\n if (!IKeep3r(keep3r).isKeeper(msg.sender)) revert InvalidKeeper();\n\n for (uint256 i = 0; i < 1000; i++) {\n nonce++;\n }\n\n IKeep3rJobWorkableRated(keep3r).worked(msg.sender, usdPerGasUnit);\n }\n\n function workHard(uint256 _factor) external {\n if (!IKeep3r(keep3r).isKeeper(msg.sender)) revert InvalidKeeper();\n\n for (uint256 i = 0; i < 1000 * _factor; i++) {\n nonce++;\n }\n\n IKeep3rJobWorkableRated(keep3r).worked(msg.sender, usdPerGasUnit);\n }\n}\n" - }, - "solidity/for-test/JobForTest.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../interfaces/IKeep3r.sol';\n\ncontract JobForTest {\n error InvalidKeeper();\n address public keep3r;\n uint256 public nonce;\n\n constructor(address _keep3r) {\n keep3r = _keep3r;\n }\n\n function work() external {\n if (!IKeep3r(keep3r).isKeeper(msg.sender)) revert InvalidKeeper();\n\n for (uint256 i; i < 1000; i++) {\n nonce++;\n }\n\n IKeep3r(keep3r).worked(msg.sender);\n }\n\n function workHard(uint256 _factor) external {\n if (!IKeep3r(keep3r).isKeeper(msg.sender)) revert InvalidKeeper();\n\n for (uint256 i; i < 1000 * _factor; i++) {\n nonce++;\n }\n\n IKeep3r(keep3r).worked(msg.sender);\n }\n}\n" - }, - "solidity/for-test/BasicJob.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../interfaces/IKeep3r.sol';\n\ncontract BasicJob {\n error KeeperNotValid();\n\n address public keep3r;\n uint256 public nonce;\n uint256[] public array;\n\n constructor(address _keep3r) {\n keep3r = _keep3r;\n }\n\n function work() external upkeep {}\n\n function workHard(uint256 _howHard) external upkeep {\n for (uint256 i = nonce; i < _howHard; i++) {\n nonce++;\n }\n }\n\n function workRefund(uint256 _howHard) external upkeep {\n for (uint256 i; i < _howHard; i++) {\n array.push(i);\n }\n\n while (array.length > 0) {\n array.pop();\n }\n }\n\n modifier upkeep() {\n if (!IKeep3r(keep3r).isKeeper(msg.sender)) revert KeeperNotValid();\n _;\n IKeep3r(keep3r).worked(msg.sender);\n }\n}\n" - }, - "solidity/contracts/Keep3rHelperParameters.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.7 <0.9.0;\n\nimport './libraries/FullMath.sol';\nimport './libraries/TickMath.sol';\nimport '../interfaces/peripherals/IBaseErrors.sol';\nimport '../interfaces/IKeep3r.sol';\nimport '../interfaces/external/IKeep3rV1.sol';\nimport '../interfaces/IKeep3rHelperParameters.sol';\nimport './peripherals/Governable.sol';\nimport './Keep3rHelperParameters.sol';\n\nimport '@openzeppelin/contracts/utils/math/Math.sol';\nimport '@uniswap/v3-core/contracts/interfaces/IUniswapV3Pool.sol';\n\ncontract Keep3rHelperParameters is IKeep3rHelperParameters, IBaseErrors, Governable {\n /// @inheritdoc IKeep3rHelperParameters\n address public immutable override KP3R;\n\n /// @inheritdoc IKeep3rHelperParameters\n uint256 public constant override BOOST_BASE = 10_000;\n\n /// @inheritdoc IKeep3rHelperParameters\n uint256 public override minBoost = 11_000;\n\n /// @inheritdoc IKeep3rHelperParameters\n uint256 public override maxBoost = 12_000;\n\n /// @inheritdoc IKeep3rHelperParameters\n uint256 public override targetBond = 200 ether;\n\n /// @inheritdoc IKeep3rHelperParameters\n uint256 public override workExtraGas = 34_000;\n\n /// @inheritdoc IKeep3rHelperParameters\n uint32 public override quoteTwapTime = 10 minutes;\n\n /// @inheritdoc IKeep3rHelperParameters\n uint256 public override minBaseFee = 15e9;\n\n /// @inheritdoc IKeep3rHelperParameters\n uint256 public override minPriorityFee = 2e9;\n\n /// @inheritdoc IKeep3rHelperParameters\n address public override keep3rV2;\n\n /// @inheritdoc IKeep3rHelperParameters\n IKeep3rHelperParameters.TokenOraclePool public override kp3rWethPool;\n\n constructor(\n address _kp3r,\n address _keep3rV2,\n address _governance,\n address _kp3rWethPool\n ) Governable(_governance) {\n KP3R = _kp3r;\n keep3rV2 = _keep3rV2;\n\n // Immutable variables [KP3R] cannot be read during contract creation time [_setKp3rWethPool]\n kp3rWethPool = _validateOraclePool(_kp3rWethPool, _kp3r);\n emit Kp3rWethPoolChange(kp3rWethPool.poolAddress, kp3rWethPool.isTKNToken0);\n }\n\n /// @inheritdoc IKeep3rHelperParameters\n function setKp3rWethPool(address _poolAddress) external override onlyGovernance {\n if (_poolAddress == address(0)) revert ZeroAddress();\n _setKp3rWethPool(_poolAddress);\n }\n\n /// @inheritdoc IKeep3rHelperParameters\n function setMinBoost(uint256 _minBoost) external override onlyGovernance {\n minBoost = _minBoost;\n emit MinBoostChange(minBoost);\n }\n\n /// @inheritdoc IKeep3rHelperParameters\n function setMaxBoost(uint256 _maxBoost) external override onlyGovernance {\n maxBoost = _maxBoost;\n emit MaxBoostChange(maxBoost);\n }\n\n /// @inheritdoc IKeep3rHelperParameters\n function setTargetBond(uint256 _targetBond) external override onlyGovernance {\n targetBond = _targetBond;\n emit TargetBondChange(targetBond);\n }\n\n /// @inheritdoc IKeep3rHelperParameters\n function setKeep3rV2(address _keep3rV2) external override onlyGovernance {\n if (_keep3rV2 == address(0)) revert ZeroAddress();\n keep3rV2 = _keep3rV2;\n emit Keep3rV2Change(keep3rV2);\n }\n\n /// @inheritdoc IKeep3rHelperParameters\n function setWorkExtraGas(uint256 _workExtraGas) external override onlyGovernance {\n workExtraGas = _workExtraGas;\n emit WorkExtraGasChange(workExtraGas);\n }\n\n /// @inheritdoc IKeep3rHelperParameters\n function setQuoteTwapTime(uint32 _quoteTwapTime) external override onlyGovernance {\n _setQuoteTwapTime(_quoteTwapTime);\n }\n\n function _setQuoteTwapTime(uint32 _quoteTwapTime) internal {\n quoteTwapTime = _quoteTwapTime;\n emit QuoteTwapTimeChange(quoteTwapTime);\n }\n\n /// @inheritdoc IKeep3rHelperParameters\n function setMinBaseFee(uint256 _minBaseFee) external override onlyGovernance {\n minBaseFee = _minBaseFee;\n emit MinBaseFeeChange(minBaseFee);\n }\n\n /// @inheritdoc IKeep3rHelperParameters\n function setMinPriorityFee(uint256 _minPriorityFee) external override onlyGovernance {\n minPriorityFee = _minPriorityFee;\n emit MinPriorityFeeChange(minPriorityFee);\n }\n\n /// @notice Sets KP3R-WETH pool\n /// @param _poolAddress The address of the KP3R-WETH pool\n function _setKp3rWethPool(address _poolAddress) internal {\n kp3rWethPool = _validateOraclePool(_poolAddress, KP3R);\n emit Kp3rWethPoolChange(kp3rWethPool.poolAddress, kp3rWethPool.isTKNToken0);\n }\n\n function _validateOraclePool(address _poolAddress, address _token) internal view virtual returns (TokenOraclePool memory _oraclePool) {\n bool _isTKNToken0 = IUniswapV3Pool(_poolAddress).token0() == _token;\n\n if (!_isTKNToken0 && IUniswapV3Pool(_poolAddress).token1() != _token) revert InvalidOraclePool();\n\n return TokenOraclePool(_poolAddress, _isTKNToken0);\n }\n}\n" - }, - "solidity/contracts/libraries/TickMath.sol": { - "content": "// SPDX-License-Identifier: GPL-2.0-or-later\npragma solidity >=0.5.0;\n\n// solhint-disable\n\n/// @title Math library for computing sqrt prices from ticks and vice versa\n/// @notice Computes sqrt price for ticks of size 1.0001, i.e. sqrt(1.0001^tick) as fixed point Q64.96 numbers. Supports\n/// prices between 2**-128 and 2**128\nlibrary TickMath {\n /// @dev The minimum tick that may be passed to #getSqrtRatioAtTick computed from log base 1.0001 of 2**-128\n int24 internal constant MIN_TICK = -887272;\n /// @dev The maximum tick that may be passed to #getSqrtRatioAtTick computed from log base 1.0001 of 2**128\n int24 internal constant MAX_TICK = -MIN_TICK;\n\n /// @dev The minimum value that can be returned from #getSqrtRatioAtTick. Equivalent to getSqrtRatioAtTick(MIN_TICK)\n uint160 internal constant MIN_SQRT_RATIO = 4295128739;\n /// @dev The maximum value that can be returned from #getSqrtRatioAtTick. Equivalent to getSqrtRatioAtTick(MAX_TICK)\n uint160 internal constant MAX_SQRT_RATIO = 1461446703485210103287273052203988822378723970342;\n\n /// @notice Calculates sqrt(1.0001^tick) * 2^96\n /// @dev Throws if |tick| > max tick\n /// @param tick The input tick for the above formula\n /// @return sqrtPriceX96 A Fixed point Q64.96 number representing the sqrt of the ratio of the two assets (token1/token0)\n /// at the given tick\n function getSqrtRatioAtTick(int24 tick) internal pure returns (uint160 sqrtPriceX96) {\n uint256 absTick = tick < 0 ? uint256(-int256(tick)) : uint256(int256(tick));\n require(absTick <= uint256(int256(MAX_TICK)), 'T');\n\n uint256 ratio = absTick & 0x1 != 0 ? 0xfffcb933bd6fad37aa2d162d1a594001 : 0x100000000000000000000000000000000;\n if (absTick & 0x2 != 0) ratio = (ratio * 0xfff97272373d413259a46990580e213a) >> 128;\n if (absTick & 0x4 != 0) ratio = (ratio * 0xfff2e50f5f656932ef12357cf3c7fdcc) >> 128;\n if (absTick & 0x8 != 0) ratio = (ratio * 0xffe5caca7e10e4e61c3624eaa0941cd0) >> 128;\n if (absTick & 0x10 != 0) ratio = (ratio * 0xffcb9843d60f6159c9db58835c926644) >> 128;\n if (absTick & 0x20 != 0) ratio = (ratio * 0xff973b41fa98c081472e6896dfb254c0) >> 128;\n if (absTick & 0x40 != 0) ratio = (ratio * 0xff2ea16466c96a3843ec78b326b52861) >> 128;\n if (absTick & 0x80 != 0) ratio = (ratio * 0xfe5dee046a99a2a811c461f1969c3053) >> 128;\n if (absTick & 0x100 != 0) ratio = (ratio * 0xfcbe86c7900a88aedcffc83b479aa3a4) >> 128;\n if (absTick & 0x200 != 0) ratio = (ratio * 0xf987a7253ac413176f2b074cf7815e54) >> 128;\n if (absTick & 0x400 != 0) ratio = (ratio * 0xf3392b0822b70005940c7a398e4b70f3) >> 128;\n if (absTick & 0x800 != 0) ratio = (ratio * 0xe7159475a2c29b7443b29c7fa6e889d9) >> 128;\n if (absTick & 0x1000 != 0) ratio = (ratio * 0xd097f3bdfd2022b8845ad8f792aa5825) >> 128;\n if (absTick & 0x2000 != 0) ratio = (ratio * 0xa9f746462d870fdf8a65dc1f90e061e5) >> 128;\n if (absTick & 0x4000 != 0) ratio = (ratio * 0x70d869a156d2a1b890bb3df62baf32f7) >> 128;\n if (absTick & 0x8000 != 0) ratio = (ratio * 0x31be135f97d08fd981231505542fcfa6) >> 128;\n if (absTick & 0x10000 != 0) ratio = (ratio * 0x9aa508b5b7a84e1c677de54f3e99bc9) >> 128;\n if (absTick & 0x20000 != 0) ratio = (ratio * 0x5d6af8dedb81196699c329225ee604) >> 128;\n if (absTick & 0x40000 != 0) ratio = (ratio * 0x2216e584f5fa1ea926041bedfe98) >> 128;\n if (absTick & 0x80000 != 0) ratio = (ratio * 0x48a170391f7dc42444e8fa2) >> 128;\n\n if (tick > 0) ratio = type(uint256).max / ratio;\n\n // Divides by 1<<32 rounding up to go from a Q128.128 to a Q128.96.\n // we then downcast because we know the result always fits within 160 bits due to our tick input constraint\n // we round up in the division so getTickAtSqrtRatio of the output price is always consistent\n sqrtPriceX96 = uint160((ratio >> 32) + (ratio % (1 << 32) == 0 ? 0 : 1));\n }\n\n /// @notice Calculates the greatest tick value such that getRatioAtTick(tick) <= ratio\n /// @dev Throws in case sqrtPriceX96 < MIN_SQRT_RATIO, as MIN_SQRT_RATIO is the lowest value getRatioAtTick may ever return.\n /// @param sqrtPriceX96 The sqrt ratio for which to compute the tick as a Q64.96\n /// @return tick The greatest tick for which the ratio is less than or equal to the input ratio\n function getTickAtSqrtRatio(uint160 sqrtPriceX96) internal pure returns (int24 tick) {\n // Second inequality must be < because the price can never reach the price at the max tick\n require(sqrtPriceX96 >= MIN_SQRT_RATIO && sqrtPriceX96 < MAX_SQRT_RATIO, 'R');\n uint256 ratio = uint256(sqrtPriceX96) << 32;\n\n uint256 r = ratio;\n uint256 msb = 0;\n\n assembly {\n let f := shl(7, gt(r, 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF))\n msb := or(msb, f)\n r := shr(f, r)\n }\n assembly {\n let f := shl(6, gt(r, 0xFFFFFFFFFFFFFFFF))\n msb := or(msb, f)\n r := shr(f, r)\n }\n assembly {\n let f := shl(5, gt(r, 0xFFFFFFFF))\n msb := or(msb, f)\n r := shr(f, r)\n }\n assembly {\n let f := shl(4, gt(r, 0xFFFF))\n msb := or(msb, f)\n r := shr(f, r)\n }\n assembly {\n let f := shl(3, gt(r, 0xFF))\n msb := or(msb, f)\n r := shr(f, r)\n }\n assembly {\n let f := shl(2, gt(r, 0xF))\n msb := or(msb, f)\n r := shr(f, r)\n }\n assembly {\n let f := shl(1, gt(r, 0x3))\n msb := or(msb, f)\n r := shr(f, r)\n }\n assembly {\n let f := gt(r, 0x1)\n msb := or(msb, f)\n }\n\n if (msb >= 128) r = ratio >> (msb - 127);\n else r = ratio << (127 - msb);\n\n int256 log_2 = (int256(msb) - 128) << 64;\n\n assembly {\n r := shr(127, mul(r, r))\n let f := shr(128, r)\n log_2 := or(log_2, shl(63, f))\n r := shr(f, r)\n }\n assembly {\n r := shr(127, mul(r, r))\n let f := shr(128, r)\n log_2 := or(log_2, shl(62, f))\n r := shr(f, r)\n }\n assembly {\n r := shr(127, mul(r, r))\n let f := shr(128, r)\n log_2 := or(log_2, shl(61, f))\n r := shr(f, r)\n }\n assembly {\n r := shr(127, mul(r, r))\n let f := shr(128, r)\n log_2 := or(log_2, shl(60, f))\n r := shr(f, r)\n }\n assembly {\n r := shr(127, mul(r, r))\n let f := shr(128, r)\n log_2 := or(log_2, shl(59, f))\n r := shr(f, r)\n }\n assembly {\n r := shr(127, mul(r, r))\n let f := shr(128, r)\n log_2 := or(log_2, shl(58, f))\n r := shr(f, r)\n }\n assembly {\n r := shr(127, mul(r, r))\n let f := shr(128, r)\n log_2 := or(log_2, shl(57, f))\n r := shr(f, r)\n }\n assembly {\n r := shr(127, mul(r, r))\n let f := shr(128, r)\n log_2 := or(log_2, shl(56, f))\n r := shr(f, r)\n }\n assembly {\n r := shr(127, mul(r, r))\n let f := shr(128, r)\n log_2 := or(log_2, shl(55, f))\n r := shr(f, r)\n }\n assembly {\n r := shr(127, mul(r, r))\n let f := shr(128, r)\n log_2 := or(log_2, shl(54, f))\n r := shr(f, r)\n }\n assembly {\n r := shr(127, mul(r, r))\n let f := shr(128, r)\n log_2 := or(log_2, shl(53, f))\n r := shr(f, r)\n }\n assembly {\n r := shr(127, mul(r, r))\n let f := shr(128, r)\n log_2 := or(log_2, shl(52, f))\n r := shr(f, r)\n }\n assembly {\n r := shr(127, mul(r, r))\n let f := shr(128, r)\n log_2 := or(log_2, shl(51, f))\n r := shr(f, r)\n }\n assembly {\n r := shr(127, mul(r, r))\n let f := shr(128, r)\n log_2 := or(log_2, shl(50, f))\n }\n\n int256 log_sqrt10001 = log_2 * 255738958999603826347141; // 128.128 number\n\n int24 tickLow = int24((log_sqrt10001 - 3402992956809132418596140100660247210) >> 128);\n int24 tickHi = int24((log_sqrt10001 + 291339464771989622907027621153398088495) >> 128);\n\n tick = tickLow == tickHi ? tickLow : getSqrtRatioAtTick(tickHi) <= sqrtPriceX96 ? tickHi : tickLow;\n }\n}\n" - }, - "@uniswap/v3-core/contracts/interfaces/IUniswapV3Pool.sol": { - "content": "// SPDX-License-Identifier: GPL-2.0-or-later\npragma solidity >=0.5.0;\n\nimport './pool/IUniswapV3PoolImmutables.sol';\nimport './pool/IUniswapV3PoolState.sol';\nimport './pool/IUniswapV3PoolDerivedState.sol';\nimport './pool/IUniswapV3PoolActions.sol';\nimport './pool/IUniswapV3PoolOwnerActions.sol';\nimport './pool/IUniswapV3PoolEvents.sol';\n\n/// @title The interface for a Uniswap V3 Pool\n/// @notice A Uniswap pool facilitates swapping and automated market making between any two assets that strictly conform\n/// to the ERC20 specification\n/// @dev The pool interface is broken up into many smaller pieces\ninterface IUniswapV3Pool is\n IUniswapV3PoolImmutables,\n IUniswapV3PoolState,\n IUniswapV3PoolDerivedState,\n IUniswapV3PoolActions,\n IUniswapV3PoolOwnerActions,\n IUniswapV3PoolEvents\n{\n\n}\n" - }, - "@uniswap/v3-core/contracts/interfaces/pool/IUniswapV3PoolImmutables.sol": { - "content": "// SPDX-License-Identifier: GPL-2.0-or-later\npragma solidity >=0.5.0;\n\n/// @title Pool state that never changes\n/// @notice These parameters are fixed for a pool forever, i.e., the methods will always return the same values\ninterface IUniswapV3PoolImmutables {\n /// @notice The contract that deployed the pool, which must adhere to the IUniswapV3Factory interface\n /// @return The contract address\n function factory() external view returns (address);\n\n /// @notice The first of the two tokens of the pool, sorted by address\n /// @return The token contract address\n function token0() external view returns (address);\n\n /// @notice The second of the two tokens of the pool, sorted by address\n /// @return The token contract address\n function token1() external view returns (address);\n\n /// @notice The pool's fee in hundredths of a bip, i.e. 1e-6\n /// @return The fee\n function fee() external view returns (uint24);\n\n /// @notice The pool tick spacing\n /// @dev Ticks can only be used at multiples of this value, minimum of 1 and always positive\n /// e.g.: a tickSpacing of 3 means ticks can be initialized every 3rd tick, i.e., ..., -6, -3, 0, 3, 6, ...\n /// This value is an int24 to avoid casting even though it is always positive.\n /// @return The tick spacing\n function tickSpacing() external view returns (int24);\n\n /// @notice The maximum amount of position liquidity that can use any tick in the range\n /// @dev This parameter is enforced per tick to prevent liquidity from overflowing a uint128 at any point, and\n /// also prevents out-of-range liquidity from being used to prevent adding in-range liquidity to a pool\n /// @return The max amount of liquidity per tick\n function maxLiquidityPerTick() external view returns (uint128);\n}\n" - }, - "@uniswap/v3-core/contracts/interfaces/pool/IUniswapV3PoolState.sol": { - "content": "// SPDX-License-Identifier: GPL-2.0-or-later\npragma solidity >=0.5.0;\n\n/// @title Pool state that can change\n/// @notice These methods compose the pool's state, and can change with any frequency including multiple times\n/// per transaction\ninterface IUniswapV3PoolState {\n /// @notice The 0th storage slot in the pool stores many values, and is exposed as a single method to save gas\n /// when accessed externally.\n /// @return sqrtPriceX96 The current price of the pool as a sqrt(token1/token0) Q64.96 value\n /// tick The current tick of the pool, i.e. according to the last tick transition that was run.\n /// This value may not always be equal to SqrtTickMath.getTickAtSqrtRatio(sqrtPriceX96) if the price is on a tick\n /// boundary.\n /// observationIndex The index of the last oracle observation that was written,\n /// observationCardinality The current maximum number of observations stored in the pool,\n /// observationCardinalityNext The next maximum number of observations, to be updated when the observation.\n /// feeProtocol The protocol fee for both tokens of the pool.\n /// Encoded as two 4 bit values, where the protocol fee of token1 is shifted 4 bits and the protocol fee of token0\n /// is the lower 4 bits. Used as the denominator of a fraction of the swap fee, e.g. 4 means 1/4th of the swap fee.\n /// unlocked Whether the pool is currently locked to reentrancy\n function slot0()\n external\n view\n returns (\n uint160 sqrtPriceX96,\n int24 tick,\n uint16 observationIndex,\n uint16 observationCardinality,\n uint16 observationCardinalityNext,\n uint8 feeProtocol,\n bool unlocked\n );\n\n /// @notice The fee growth as a Q128.128 fees of token0 collected per unit of liquidity for the entire life of the pool\n /// @dev This value can overflow the uint256\n function feeGrowthGlobal0X128() external view returns (uint256);\n\n /// @notice The fee growth as a Q128.128 fees of token1 collected per unit of liquidity for the entire life of the pool\n /// @dev This value can overflow the uint256\n function feeGrowthGlobal1X128() external view returns (uint256);\n\n /// @notice The amounts of token0 and token1 that are owed to the protocol\n /// @dev Protocol fees will never exceed uint128 max in either token\n function protocolFees() external view returns (uint128 token0, uint128 token1);\n\n /// @notice The currently in range liquidity available to the pool\n /// @dev This value has no relationship to the total liquidity across all ticks\n function liquidity() external view returns (uint128);\n\n /// @notice Look up information about a specific tick in the pool\n /// @param tick The tick to look up\n /// @return liquidityGross the total amount of position liquidity that uses the pool either as tick lower or\n /// tick upper,\n /// liquidityNet how much liquidity changes when the pool price crosses the tick,\n /// feeGrowthOutside0X128 the fee growth on the other side of the tick from the current tick in token0,\n /// feeGrowthOutside1X128 the fee growth on the other side of the tick from the current tick in token1,\n /// tickCumulativeOutside the cumulative tick value on the other side of the tick from the current tick\n /// secondsPerLiquidityOutsideX128 the seconds spent per liquidity on the other side of the tick from the current tick,\n /// secondsOutside the seconds spent on the other side of the tick from the current tick,\n /// initialized Set to true if the tick is initialized, i.e. liquidityGross is greater than 0, otherwise equal to false.\n /// Outside values can only be used if the tick is initialized, i.e. if liquidityGross is greater than 0.\n /// In addition, these values are only relative and must be used only in comparison to previous snapshots for\n /// a specific position.\n function ticks(int24 tick)\n external\n view\n returns (\n uint128 liquidityGross,\n int128 liquidityNet,\n uint256 feeGrowthOutside0X128,\n uint256 feeGrowthOutside1X128,\n int56 tickCumulativeOutside,\n uint160 secondsPerLiquidityOutsideX128,\n uint32 secondsOutside,\n bool initialized\n );\n\n /// @notice Returns 256 packed tick initialized boolean values. See TickBitmap for more information\n function tickBitmap(int16 wordPosition) external view returns (uint256);\n\n /// @notice Returns the information about a position by the position's key\n /// @param key The position's key is a hash of a preimage composed by the owner, tickLower and tickUpper\n /// @return _liquidity The amount of liquidity in the position,\n /// Returns feeGrowthInside0LastX128 fee growth of token0 inside the tick range as of the last mint/burn/poke,\n /// Returns feeGrowthInside1LastX128 fee growth of token1 inside the tick range as of the last mint/burn/poke,\n /// Returns tokensOwed0 the computed amount of token0 owed to the position as of the last mint/burn/poke,\n /// Returns tokensOwed1 the computed amount of token1 owed to the position as of the last mint/burn/poke\n function positions(bytes32 key)\n external\n view\n returns (\n uint128 _liquidity,\n uint256 feeGrowthInside0LastX128,\n uint256 feeGrowthInside1LastX128,\n uint128 tokensOwed0,\n uint128 tokensOwed1\n );\n\n /// @notice Returns data about a specific observation index\n /// @param index The element of the observations array to fetch\n /// @dev You most likely want to use #observe() instead of this method to get an observation as of some amount of time\n /// ago, rather than at a specific index in the array.\n /// @return blockTimestamp The timestamp of the observation,\n /// Returns tickCumulative the tick multiplied by seconds elapsed for the life of the pool as of the observation timestamp,\n /// Returns secondsPerLiquidityCumulativeX128 the seconds per in range liquidity for the life of the pool as of the observation timestamp,\n /// Returns initialized whether the observation has been initialized and the values are safe to use\n function observations(uint256 index)\n external\n view\n returns (\n uint32 blockTimestamp,\n int56 tickCumulative,\n uint160 secondsPerLiquidityCumulativeX128,\n bool initialized\n );\n}\n" - }, - "@uniswap/v3-core/contracts/interfaces/pool/IUniswapV3PoolDerivedState.sol": { - "content": "// SPDX-License-Identifier: GPL-2.0-or-later\npragma solidity >=0.5.0;\n\n/// @title Pool state that is not stored\n/// @notice Contains view functions to provide information about the pool that is computed rather than stored on the\n/// blockchain. The functions here may have variable gas costs.\ninterface IUniswapV3PoolDerivedState {\n /// @notice Returns the cumulative tick and liquidity as of each timestamp `secondsAgo` from the current block timestamp\n /// @dev To get a time weighted average tick or liquidity-in-range, you must call this with two values, one representing\n /// the beginning of the period and another for the end of the period. E.g., to get the last hour time-weighted average tick,\n /// you must call it with secondsAgos = [3600, 0].\n /// @dev The time weighted average tick represents the geometric time weighted average price of the pool, in\n /// log base sqrt(1.0001) of token1 / token0. The TickMath library can be used to go from a tick value to a ratio.\n /// @param secondsAgos From how long ago each cumulative tick and liquidity value should be returned\n /// @return tickCumulatives Cumulative tick values as of each `secondsAgos` from the current block timestamp\n /// @return secondsPerLiquidityCumulativeX128s Cumulative seconds per liquidity-in-range value as of each `secondsAgos` from the current block\n /// timestamp\n function observe(uint32[] calldata secondsAgos)\n external\n view\n returns (int56[] memory tickCumulatives, uint160[] memory secondsPerLiquidityCumulativeX128s);\n\n /// @notice Returns a snapshot of the tick cumulative, seconds per liquidity and seconds inside a tick range\n /// @dev Snapshots must only be compared to other snapshots, taken over a period for which a position existed.\n /// I.e., snapshots cannot be compared if a position is not held for the entire period between when the first\n /// snapshot is taken and the second snapshot is taken.\n /// @param tickLower The lower tick of the range\n /// @param tickUpper The upper tick of the range\n /// @return tickCumulativeInside The snapshot of the tick accumulator for the range\n /// @return secondsPerLiquidityInsideX128 The snapshot of seconds per liquidity for the range\n /// @return secondsInside The snapshot of seconds per liquidity for the range\n function snapshotCumulativesInside(int24 tickLower, int24 tickUpper)\n external\n view\n returns (\n int56 tickCumulativeInside,\n uint160 secondsPerLiquidityInsideX128,\n uint32 secondsInside\n );\n}\n" - }, - "@uniswap/v3-core/contracts/interfaces/pool/IUniswapV3PoolActions.sol": { - "content": "// SPDX-License-Identifier: GPL-2.0-or-later\npragma solidity >=0.5.0;\n\n/// @title Permissionless pool actions\n/// @notice Contains pool methods that can be called by anyone\ninterface IUniswapV3PoolActions {\n /// @notice Sets the initial price for the pool\n /// @dev Price is represented as a sqrt(amountToken1/amountToken0) Q64.96 value\n /// @param sqrtPriceX96 the initial sqrt price of the pool as a Q64.96\n function initialize(uint160 sqrtPriceX96) external;\n\n /// @notice Adds liquidity for the given recipient/tickLower/tickUpper position\n /// @dev The caller of this method receives a callback in the form of IUniswapV3MintCallback#uniswapV3MintCallback\n /// in which they must pay any token0 or token1 owed for the liquidity. The amount of token0/token1 due depends\n /// on tickLower, tickUpper, the amount of liquidity, and the current price.\n /// @param recipient The address for which the liquidity will be created\n /// @param tickLower The lower tick of the position in which to add liquidity\n /// @param tickUpper The upper tick of the position in which to add liquidity\n /// @param amount The amount of liquidity to mint\n /// @param data Any data that should be passed through to the callback\n /// @return amount0 The amount of token0 that was paid to mint the given amount of liquidity. Matches the value in the callback\n /// @return amount1 The amount of token1 that was paid to mint the given amount of liquidity. Matches the value in the callback\n function mint(\n address recipient,\n int24 tickLower,\n int24 tickUpper,\n uint128 amount,\n bytes calldata data\n ) external returns (uint256 amount0, uint256 amount1);\n\n /// @notice Collects tokens owed to a position\n /// @dev Does not recompute fees earned, which must be done either via mint or burn of any amount of liquidity.\n /// Collect must be called by the position owner. To withdraw only token0 or only token1, amount0Requested or\n /// amount1Requested may be set to zero. To withdraw all tokens owed, caller may pass any value greater than the\n /// actual tokens owed, e.g. type(uint128).max. Tokens owed may be from accumulated swap fees or burned liquidity.\n /// @param recipient The address which should receive the fees collected\n /// @param tickLower The lower tick of the position for which to collect fees\n /// @param tickUpper The upper tick of the position for which to collect fees\n /// @param amount0Requested How much token0 should be withdrawn from the fees owed\n /// @param amount1Requested How much token1 should be withdrawn from the fees owed\n /// @return amount0 The amount of fees collected in token0\n /// @return amount1 The amount of fees collected in token1\n function collect(\n address recipient,\n int24 tickLower,\n int24 tickUpper,\n uint128 amount0Requested,\n uint128 amount1Requested\n ) external returns (uint128 amount0, uint128 amount1);\n\n /// @notice Burn liquidity from the sender and account tokens owed for the liquidity to the position\n /// @dev Can be used to trigger a recalculation of fees owed to a position by calling with an amount of 0\n /// @dev Fees must be collected separately via a call to #collect\n /// @param tickLower The lower tick of the position for which to burn liquidity\n /// @param tickUpper The upper tick of the position for which to burn liquidity\n /// @param amount How much liquidity to burn\n /// @return amount0 The amount of token0 sent to the recipient\n /// @return amount1 The amount of token1 sent to the recipient\n function burn(\n int24 tickLower,\n int24 tickUpper,\n uint128 amount\n ) external returns (uint256 amount0, uint256 amount1);\n\n /// @notice Swap token0 for token1, or token1 for token0\n /// @dev The caller of this method receives a callback in the form of IUniswapV3SwapCallback#uniswapV3SwapCallback\n /// @param recipient The address to receive the output of the swap\n /// @param zeroForOne The direction of the swap, true for token0 to token1, false for token1 to token0\n /// @param amountSpecified The amount of the swap, which implicitly configures the swap as exact input (positive), or exact output (negative)\n /// @param sqrtPriceLimitX96 The Q64.96 sqrt price limit. If zero for one, the price cannot be less than this\n /// value after the swap. If one for zero, the price cannot be greater than this value after the swap\n /// @param data Any data to be passed through to the callback\n /// @return amount0 The delta of the balance of token0 of the pool, exact when negative, minimum when positive\n /// @return amount1 The delta of the balance of token1 of the pool, exact when negative, minimum when positive\n function swap(\n address recipient,\n bool zeroForOne,\n int256 amountSpecified,\n uint160 sqrtPriceLimitX96,\n bytes calldata data\n ) external returns (int256 amount0, int256 amount1);\n\n /// @notice Receive token0 and/or token1 and pay it back, plus a fee, in the callback\n /// @dev The caller of this method receives a callback in the form of IUniswapV3FlashCallback#uniswapV3FlashCallback\n /// @dev Can be used to donate underlying tokens pro-rata to currently in-range liquidity providers by calling\n /// with 0 amount{0,1} and sending the donation amount(s) from the callback\n /// @param recipient The address which will receive the token0 and token1 amounts\n /// @param amount0 The amount of token0 to send\n /// @param amount1 The amount of token1 to send\n /// @param data Any data to be passed through to the callback\n function flash(\n address recipient,\n uint256 amount0,\n uint256 amount1,\n bytes calldata data\n ) external;\n\n /// @notice Increase the maximum number of price and liquidity observations that this pool will store\n /// @dev This method is no-op if the pool already has an observationCardinalityNext greater than or equal to\n /// the input observationCardinalityNext.\n /// @param observationCardinalityNext The desired minimum number of observations for the pool to store\n function increaseObservationCardinalityNext(uint16 observationCardinalityNext) external;\n}\n" - }, - "@uniswap/v3-core/contracts/interfaces/pool/IUniswapV3PoolOwnerActions.sol": { - "content": "// SPDX-License-Identifier: GPL-2.0-or-later\npragma solidity >=0.5.0;\n\n/// @title Permissioned pool actions\n/// @notice Contains pool methods that may only be called by the factory owner\ninterface IUniswapV3PoolOwnerActions {\n /// @notice Set the denominator of the protocol's % share of the fees\n /// @param feeProtocol0 new protocol fee for token0 of the pool\n /// @param feeProtocol1 new protocol fee for token1 of the pool\n function setFeeProtocol(uint8 feeProtocol0, uint8 feeProtocol1) external;\n\n /// @notice Collect the protocol fee accrued to the pool\n /// @param recipient The address to which collected protocol fees should be sent\n /// @param amount0Requested The maximum amount of token0 to send, can be 0 to collect fees in only token1\n /// @param amount1Requested The maximum amount of token1 to send, can be 0 to collect fees in only token0\n /// @return amount0 The protocol fee collected in token0\n /// @return amount1 The protocol fee collected in token1\n function collectProtocol(\n address recipient,\n uint128 amount0Requested,\n uint128 amount1Requested\n ) external returns (uint128 amount0, uint128 amount1);\n}\n" - }, - "@uniswap/v3-core/contracts/interfaces/pool/IUniswapV3PoolEvents.sol": { - "content": "// SPDX-License-Identifier: GPL-2.0-or-later\npragma solidity >=0.5.0;\n\n/// @title Events emitted by a pool\n/// @notice Contains all events emitted by the pool\ninterface IUniswapV3PoolEvents {\n /// @notice Emitted exactly once by a pool when #initialize is first called on the pool\n /// @dev Mint/Burn/Swap cannot be emitted by the pool before Initialize\n /// @param sqrtPriceX96 The initial sqrt price of the pool, as a Q64.96\n /// @param tick The initial tick of the pool, i.e. log base 1.0001 of the starting price of the pool\n event Initialize(uint160 sqrtPriceX96, int24 tick);\n\n /// @notice Emitted when liquidity is minted for a given position\n /// @param sender The address that minted the liquidity\n /// @param owner The owner of the position and recipient of any minted liquidity\n /// @param tickLower The lower tick of the position\n /// @param tickUpper The upper tick of the position\n /// @param amount The amount of liquidity minted to the position range\n /// @param amount0 How much token0 was required for the minted liquidity\n /// @param amount1 How much token1 was required for the minted liquidity\n event Mint(\n address sender,\n address indexed owner,\n int24 indexed tickLower,\n int24 indexed tickUpper,\n uint128 amount,\n uint256 amount0,\n uint256 amount1\n );\n\n /// @notice Emitted when fees are collected by the owner of a position\n /// @dev Collect events may be emitted with zero amount0 and amount1 when the caller chooses not to collect fees\n /// @param owner The owner of the position for which fees are collected\n /// @param tickLower The lower tick of the position\n /// @param tickUpper The upper tick of the position\n /// @param amount0 The amount of token0 fees collected\n /// @param amount1 The amount of token1 fees collected\n event Collect(\n address indexed owner,\n address recipient,\n int24 indexed tickLower,\n int24 indexed tickUpper,\n uint128 amount0,\n uint128 amount1\n );\n\n /// @notice Emitted when a position's liquidity is removed\n /// @dev Does not withdraw any fees earned by the liquidity position, which must be withdrawn via #collect\n /// @param owner The owner of the position for which liquidity is removed\n /// @param tickLower The lower tick of the position\n /// @param tickUpper The upper tick of the position\n /// @param amount The amount of liquidity to remove\n /// @param amount0 The amount of token0 withdrawn\n /// @param amount1 The amount of token1 withdrawn\n event Burn(\n address indexed owner,\n int24 indexed tickLower,\n int24 indexed tickUpper,\n uint128 amount,\n uint256 amount0,\n uint256 amount1\n );\n\n /// @notice Emitted by the pool for any swaps between token0 and token1\n /// @param sender The address that initiated the swap call, and that received the callback\n /// @param recipient The address that received the output of the swap\n /// @param amount0 The delta of the token0 balance of the pool\n /// @param amount1 The delta of the token1 balance of the pool\n /// @param sqrtPriceX96 The sqrt(price) of the pool after the swap, as a Q64.96\n /// @param liquidity The liquidity of the pool after the swap\n /// @param tick The log base 1.0001 of price of the pool after the swap\n event Swap(\n address indexed sender,\n address indexed recipient,\n int256 amount0,\n int256 amount1,\n uint160 sqrtPriceX96,\n uint128 liquidity,\n int24 tick\n );\n\n /// @notice Emitted by the pool for any flashes of token0/token1\n /// @param sender The address that initiated the swap call, and that received the callback\n /// @param recipient The address that received the tokens from flash\n /// @param amount0 The amount of token0 that was flashed\n /// @param amount1 The amount of token1 that was flashed\n /// @param paid0 The amount of token0 paid for the flash, which can exceed the amount0 plus the fee\n /// @param paid1 The amount of token1 paid for the flash, which can exceed the amount1 plus the fee\n event Flash(\n address indexed sender,\n address indexed recipient,\n uint256 amount0,\n uint256 amount1,\n uint256 paid0,\n uint256 paid1\n );\n\n /// @notice Emitted by the pool for increases to the number of observations that can be stored\n /// @dev observationCardinalityNext is not the observation cardinality until an observation is written at the index\n /// just before a mint/swap/burn.\n /// @param observationCardinalityNextOld The previous value of the next observation cardinality\n /// @param observationCardinalityNextNew The updated value of the next observation cardinality\n event IncreaseObservationCardinalityNext(\n uint16 observationCardinalityNextOld,\n uint16 observationCardinalityNextNew\n );\n\n /// @notice Emitted when the protocol fee is changed by the pool\n /// @param feeProtocol0Old The previous value of the token0 protocol fee\n /// @param feeProtocol1Old The previous value of the token1 protocol fee\n /// @param feeProtocol0New The updated value of the token0 protocol fee\n /// @param feeProtocol1New The updated value of the token1 protocol fee\n event SetFeeProtocol(uint8 feeProtocol0Old, uint8 feeProtocol1Old, uint8 feeProtocol0New, uint8 feeProtocol1New);\n\n /// @notice Emitted when the collected protocol fees are withdrawn by the factory owner\n /// @param sender The address that collects the protocol fees\n /// @param recipient The address that receives the collected protocol fees\n /// @param amount0 The amount of token0 protocol fees that is withdrawn\n /// @param amount0 The amount of token1 protocol fees that is withdrawn\n event CollectProtocol(address indexed sender, address indexed recipient, uint128 amount0, uint128 amount1);\n}\n" - }, - "solidity/for-test/UniV3PairManagerForTest.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '@openzeppelin/contracts/token/ERC20/ERC20.sol';\nimport '@uniswap/v3-core/contracts/interfaces/IUniswapV3Pool.sol';\n\nimport '../contracts/libraries/LiquidityAmounts.sol';\nimport '../contracts/libraries/FixedPoint96.sol';\nimport '../contracts/libraries/FullMath.sol';\nimport '../contracts/libraries/TickMath.sol';\nimport '../contracts/UniV3PairManager.sol';\nimport '../interfaces/external/IWeth9.sol';\nimport '../interfaces/IUniV3PairManager.sol';\n\ncontract UniV3PairManagerForTest is UniV3PairManager {\n constructor(address _pool, address _governance) UniV3PairManager(_pool, _governance) {}\n\n function internalAddLiquidity(\n uint256 amount0Desired,\n uint256 amount1Desired,\n uint256 amount0Min,\n uint256 amount1Min\n )\n external\n returns (\n uint128 liquidity,\n uint256 amount0,\n uint256 amount1\n )\n {\n return _addLiquidity(amount0Desired, amount1Desired, amount0Min, amount1Min);\n }\n\n function internalPay(\n address token,\n address payer,\n address recipient,\n uint256 value\n ) external {\n return _pay(token, payer, recipient, value);\n }\n\n function internalMint(address dst, uint256 amount) external {\n return _mint(dst, amount);\n }\n\n function internalBurn(address dst, uint256 amount) external {\n return _burn(dst, amount);\n }\n\n function internalTransferTokens(\n address src,\n address dst,\n uint256 amount\n ) external {\n _transferTokens(src, dst, amount);\n }\n\n function internalSafeTransferFrom(\n address token,\n address from,\n address to,\n uint256 value\n ) external {\n _safeTransferFrom(token, from, to, value);\n }\n\n receive() external payable {}\n}\n" - }, - "@openzeppelin/contracts/token/ERC20/ERC20.sol": { - "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\nimport \"./IERC20.sol\";\nimport \"./extensions/IERC20Metadata.sol\";\nimport \"../../utils/Context.sol\";\n\n/**\n * @dev Implementation of the {IERC20} interface.\n *\n * This implementation is agnostic to the way tokens are created. This means\n * that a supply mechanism has to be added in a derived contract using {_mint}.\n * For a generic mechanism see {ERC20PresetMinterPauser}.\n *\n * TIP: For a detailed writeup see our guide\n * https://forum.zeppelin.solutions/t/how-to-implement-erc20-supply-mechanisms/226[How\n * to implement supply mechanisms].\n *\n * We have followed general OpenZeppelin Contracts guidelines: functions revert\n * instead returning `false` on failure. This behavior is nonetheless\n * conventional and does not conflict with the expectations of ERC20\n * applications.\n *\n * Additionally, an {Approval} event is emitted on calls to {transferFrom}.\n * This allows applications to reconstruct the allowance for all accounts just\n * by listening to said events. Other implementations of the EIP may not emit\n * these events, as it isn't required by the specification.\n *\n * Finally, the non-standard {decreaseAllowance} and {increaseAllowance}\n * functions have been added to mitigate the well-known issues around setting\n * allowances. See {IERC20-approve}.\n */\ncontract ERC20 is Context, IERC20, IERC20Metadata {\n mapping(address => uint256) private _balances;\n\n mapping(address => mapping(address => uint256)) private _allowances;\n\n uint256 private _totalSupply;\n\n string private _name;\n string private _symbol;\n\n /**\n * @dev Sets the values for {name} and {symbol}.\n *\n * The default value of {decimals} is 18. To select a different value for\n * {decimals} you should overload it.\n *\n * All two of these values are immutable: they can only be set once during\n * construction.\n */\n constructor(string memory name_, string memory symbol_) {\n _name = name_;\n _symbol = symbol_;\n }\n\n /**\n * @dev Returns the name of the token.\n */\n function name() public view virtual override returns (string memory) {\n return _name;\n }\n\n /**\n * @dev Returns the symbol of the token, usually a shorter version of the\n * name.\n */\n function symbol() public view virtual override returns (string memory) {\n return _symbol;\n }\n\n /**\n * @dev Returns the number of decimals used to get its user representation.\n * For example, if `decimals` equals `2`, a balance of `505` tokens should\n * be displayed to a user as `5.05` (`505 / 10 ** 2`).\n *\n * Tokens usually opt for a value of 18, imitating the relationship between\n * Ether and Wei. This is the value {ERC20} uses, unless this function is\n * overridden;\n *\n * NOTE: This information is only used for _display_ purposes: it in\n * no way affects any of the arithmetic of the contract, including\n * {IERC20-balanceOf} and {IERC20-transfer}.\n */\n function decimals() public view virtual override returns (uint8) {\n return 18;\n }\n\n /**\n * @dev See {IERC20-totalSupply}.\n */\n function totalSupply() public view virtual override returns (uint256) {\n return _totalSupply;\n }\n\n /**\n * @dev See {IERC20-balanceOf}.\n */\n function balanceOf(address account) public view virtual override returns (uint256) {\n return _balances[account];\n }\n\n /**\n * @dev See {IERC20-transfer}.\n *\n * Requirements:\n *\n * - `recipient` cannot be the zero address.\n * - the caller must have a balance of at least `amount`.\n */\n function transfer(address recipient, uint256 amount) public virtual override returns (bool) {\n _transfer(_msgSender(), recipient, amount);\n return true;\n }\n\n /**\n * @dev See {IERC20-allowance}.\n */\n function allowance(address owner, address spender) public view virtual override returns (uint256) {\n return _allowances[owner][spender];\n }\n\n /**\n * @dev See {IERC20-approve}.\n *\n * Requirements:\n *\n * - `spender` cannot be the zero address.\n */\n function approve(address spender, uint256 amount) public virtual override returns (bool) {\n _approve(_msgSender(), spender, amount);\n return true;\n }\n\n /**\n * @dev See {IERC20-transferFrom}.\n *\n * Emits an {Approval} event indicating the updated allowance. This is not\n * required by the EIP. See the note at the beginning of {ERC20}.\n *\n * Requirements:\n *\n * - `sender` and `recipient` cannot be the zero address.\n * - `sender` must have a balance of at least `amount`.\n * - the caller must have allowance for ``sender``'s tokens of at least\n * `amount`.\n */\n function transferFrom(\n address sender,\n address recipient,\n uint256 amount\n ) public virtual override returns (bool) {\n _transfer(sender, recipient, amount);\n\n uint256 currentAllowance = _allowances[sender][_msgSender()];\n require(currentAllowance >= amount, \"ERC20: transfer amount exceeds allowance\");\n unchecked {\n _approve(sender, _msgSender(), currentAllowance - amount);\n }\n\n return true;\n }\n\n /**\n * @dev Atomically increases the allowance granted to `spender` by the caller.\n *\n * This is an alternative to {approve} that can be used as a mitigation for\n * problems described in {IERC20-approve}.\n *\n * Emits an {Approval} event indicating the updated allowance.\n *\n * Requirements:\n *\n * - `spender` cannot be the zero address.\n */\n function increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool) {\n _approve(_msgSender(), spender, _allowances[_msgSender()][spender] + addedValue);\n return true;\n }\n\n /**\n * @dev Atomically decreases the allowance granted to `spender` by the caller.\n *\n * This is an alternative to {approve} that can be used as a mitigation for\n * problems described in {IERC20-approve}.\n *\n * Emits an {Approval} event indicating the updated allowance.\n *\n * Requirements:\n *\n * - `spender` cannot be the zero address.\n * - `spender` must have allowance for the caller of at least\n * `subtractedValue`.\n */\n function decreaseAllowance(address spender, uint256 subtractedValue) public virtual returns (bool) {\n uint256 currentAllowance = _allowances[_msgSender()][spender];\n require(currentAllowance >= subtractedValue, \"ERC20: decreased allowance below zero\");\n unchecked {\n _approve(_msgSender(), spender, currentAllowance - subtractedValue);\n }\n\n return true;\n }\n\n /**\n * @dev Moves `amount` of tokens from `sender` to `recipient`.\n *\n * This internal function is equivalent to {transfer}, and can be used to\n * e.g. implement automatic token fees, slashing mechanisms, etc.\n *\n * Emits a {Transfer} event.\n *\n * Requirements:\n *\n * - `sender` cannot be the zero address.\n * - `recipient` cannot be the zero address.\n * - `sender` must have a balance of at least `amount`.\n */\n function _transfer(\n address sender,\n address recipient,\n uint256 amount\n ) internal virtual {\n require(sender != address(0), \"ERC20: transfer from the zero address\");\n require(recipient != address(0), \"ERC20: transfer to the zero address\");\n\n _beforeTokenTransfer(sender, recipient, amount);\n\n uint256 senderBalance = _balances[sender];\n require(senderBalance >= amount, \"ERC20: transfer amount exceeds balance\");\n unchecked {\n _balances[sender] = senderBalance - amount;\n }\n _balances[recipient] += amount;\n\n emit Transfer(sender, recipient, amount);\n\n _afterTokenTransfer(sender, recipient, amount);\n }\n\n /** @dev Creates `amount` tokens and assigns them to `account`, increasing\n * the total supply.\n *\n * Emits a {Transfer} event with `from` set to the zero address.\n *\n * Requirements:\n *\n * - `account` cannot be the zero address.\n */\n function _mint(address account, uint256 amount) internal virtual {\n require(account != address(0), \"ERC20: mint to the zero address\");\n\n _beforeTokenTransfer(address(0), account, amount);\n\n _totalSupply += amount;\n _balances[account] += amount;\n emit Transfer(address(0), account, amount);\n\n _afterTokenTransfer(address(0), account, amount);\n }\n\n /**\n * @dev Destroys `amount` tokens from `account`, reducing the\n * total supply.\n *\n * Emits a {Transfer} event with `to` set to the zero address.\n *\n * Requirements:\n *\n * - `account` cannot be the zero address.\n * - `account` must have at least `amount` tokens.\n */\n function _burn(address account, uint256 amount) internal virtual {\n require(account != address(0), \"ERC20: burn from the zero address\");\n\n _beforeTokenTransfer(account, address(0), amount);\n\n uint256 accountBalance = _balances[account];\n require(accountBalance >= amount, \"ERC20: burn amount exceeds balance\");\n unchecked {\n _balances[account] = accountBalance - amount;\n }\n _totalSupply -= amount;\n\n emit Transfer(account, address(0), amount);\n\n _afterTokenTransfer(account, address(0), amount);\n }\n\n /**\n * @dev Sets `amount` as the allowance of `spender` over the `owner` s tokens.\n *\n * This internal function is equivalent to `approve`, and can be used to\n * e.g. set automatic allowances for certain subsystems, etc.\n *\n * Emits an {Approval} event.\n *\n * Requirements:\n *\n * - `owner` cannot be the zero address.\n * - `spender` cannot be the zero address.\n */\n function _approve(\n address owner,\n address spender,\n uint256 amount\n ) internal virtual {\n require(owner != address(0), \"ERC20: approve from the zero address\");\n require(spender != address(0), \"ERC20: approve to the zero address\");\n\n _allowances[owner][spender] = amount;\n emit Approval(owner, spender, amount);\n }\n\n /**\n * @dev Hook that is called before any transfer of tokens. This includes\n * minting and burning.\n *\n * Calling conditions:\n *\n * - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens\n * will be transferred to `to`.\n * - when `from` is zero, `amount` tokens will be minted for `to`.\n * - when `to` is zero, `amount` of ``from``'s tokens will be burned.\n * - `from` and `to` are never both zero.\n *\n * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].\n */\n function _beforeTokenTransfer(\n address from,\n address to,\n uint256 amount\n ) internal virtual {}\n\n /**\n * @dev Hook that is called after any transfer of tokens. This includes\n * minting and burning.\n *\n * Calling conditions:\n *\n * - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens\n * has been transferred to `to`.\n * - when `from` is zero, `amount` tokens have been minted for `to`.\n * - when `to` is zero, `amount` of ``from``'s tokens have been burned.\n * - `from` and `to` are never both zero.\n *\n * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].\n */\n function _afterTokenTransfer(\n address from,\n address to,\n uint256 amount\n ) internal virtual {}\n}\n" - }, - "solidity/contracts/libraries/LiquidityAmounts.sol": { - "content": "// SPDX-License-Identifier: GPL-2.0-or-later\npragma solidity >=0.8.4 <0.9.0;\n\nimport './FullMath.sol';\nimport './FixedPoint96.sol';\n\n// solhint-disable\nlibrary LiquidityAmounts {\n function toUint128(uint256 x) private pure returns (uint128 y) {\n require((y = uint128(x)) == x);\n }\n\n function getLiquidityForAmount0(\n uint160 sqrtRatioAX96,\n uint160 sqrtRatioBX96,\n uint256 amount0\n ) internal pure returns (uint128 liquidity) {\n if (sqrtRatioAX96 > sqrtRatioBX96) (sqrtRatioAX96, sqrtRatioBX96) = (sqrtRatioBX96, sqrtRatioAX96);\n uint256 intermediate = FullMath.mulDiv(sqrtRatioAX96, sqrtRatioBX96, FixedPoint96.Q96);\n return toUint128(FullMath.mulDiv(amount0, intermediate, sqrtRatioBX96 - sqrtRatioAX96));\n }\n\n function getLiquidityForAmount1(\n uint160 sqrtRatioAX96,\n uint160 sqrtRatioBX96,\n uint256 amount1\n ) internal pure returns (uint128 liquidity) {\n if (sqrtRatioAX96 > sqrtRatioBX96) (sqrtRatioAX96, sqrtRatioBX96) = (sqrtRatioBX96, sqrtRatioAX96);\n return toUint128(FullMath.mulDiv(amount1, FixedPoint96.Q96, sqrtRatioBX96 - sqrtRatioAX96));\n }\n\n function getLiquidityForAmounts(\n uint160 sqrtRatioX96,\n uint160 sqrtRatioAX96,\n uint160 sqrtRatioBX96,\n uint256 amount0,\n uint256 amount1\n ) internal pure returns (uint128 liquidity) {\n if (sqrtRatioAX96 > sqrtRatioBX96) (sqrtRatioAX96, sqrtRatioBX96) = (sqrtRatioBX96, sqrtRatioAX96);\n\n if (sqrtRatioX96 <= sqrtRatioAX96) {\n liquidity = getLiquidityForAmount0(sqrtRatioAX96, sqrtRatioBX96, amount0);\n } else if (sqrtRatioX96 < sqrtRatioBX96) {\n uint128 liquidity0 = getLiquidityForAmount0(sqrtRatioX96, sqrtRatioBX96, amount0);\n uint128 liquidity1 = getLiquidityForAmount1(sqrtRatioAX96, sqrtRatioX96, amount1);\n\n liquidity = liquidity0 < liquidity1 ? liquidity0 : liquidity1;\n } else {\n liquidity = getLiquidityForAmount1(sqrtRatioAX96, sqrtRatioBX96, amount1);\n }\n }\n\n function getAmount0ForLiquidity(\n uint160 sqrtRatioAX96,\n uint160 sqrtRatioBX96,\n uint128 liquidity\n ) internal pure returns (uint256 amount0) {\n if (sqrtRatioAX96 > sqrtRatioBX96) (sqrtRatioAX96, sqrtRatioBX96) = (sqrtRatioBX96, sqrtRatioAX96);\n\n return FullMath.mulDiv(uint256(liquidity) << FixedPoint96.RESOLUTION, sqrtRatioBX96 - sqrtRatioAX96, sqrtRatioBX96) / sqrtRatioAX96;\n }\n\n function getAmount1ForLiquidity(\n uint160 sqrtRatioAX96,\n uint160 sqrtRatioBX96,\n uint128 liquidity\n ) internal pure returns (uint256 amount1) {\n if (sqrtRatioAX96 > sqrtRatioBX96) (sqrtRatioAX96, sqrtRatioBX96) = (sqrtRatioBX96, sqrtRatioAX96);\n\n return FullMath.mulDiv(liquidity, sqrtRatioBX96 - sqrtRatioAX96, FixedPoint96.Q96);\n }\n\n function getAmountsForLiquidity(\n uint160 sqrtRatioX96,\n uint160 sqrtRatioAX96,\n uint160 sqrtRatioBX96,\n uint128 liquidity\n ) internal pure returns (uint256 amount0, uint256 amount1) {\n if (sqrtRatioAX96 > sqrtRatioBX96) (sqrtRatioAX96, sqrtRatioBX96) = (sqrtRatioBX96, sqrtRatioAX96);\n\n if (sqrtRatioX96 <= sqrtRatioAX96) {\n amount0 = getAmount0ForLiquidity(sqrtRatioAX96, sqrtRatioBX96, liquidity);\n } else if (sqrtRatioX96 < sqrtRatioBX96) {\n amount0 = getAmount0ForLiquidity(sqrtRatioX96, sqrtRatioBX96, liquidity);\n amount1 = getAmount1ForLiquidity(sqrtRatioAX96, sqrtRatioX96, liquidity);\n } else {\n amount1 = getAmount1ForLiquidity(sqrtRatioAX96, sqrtRatioBX96, liquidity);\n }\n }\n}\n" - }, - "solidity/contracts/libraries/FixedPoint96.sol": { - "content": "// SPDX-License-Identifier: GPL-2.0-or-later\npragma solidity >=0.8.4 <0.9.0;\n\nlibrary FixedPoint96 {\n // solhint-disable\n uint8 internal constant RESOLUTION = 96;\n uint256 internal constant Q96 = 0x1000000000000000000000000;\n}\n" - }, - "solidity/contracts/UniV3PairManager.sol": { - "content": "// SPDX-License-Identifier: MIT\n\n/*\n\nCoded for The Keep3r Network with ♥ by\n\n██████╗░███████╗███████╗██╗  ░██╗░░░░░░░██╗░█████╗░███╗░░██╗██████╗░███████╗██████╗░██╗░░░░░░█████╗░███╗░░██╗██████╗░\n██╔══██╗██╔════╝██╔════╝██║  ░██║░░██╗░░██║██╔══██╗████╗░██║██╔══██╗██╔════╝██╔══██╗██║░░░░░██╔══██╗████╗░██║██╔══██╗\n██║░░██║█████╗░░█████╗░░██║  ░╚██╗████╗██╔╝██║░░██║██╔██╗██║██║░░██║█████╗░░██████╔╝██║░░░░░███████║██╔██╗██║██║░░██║\n██║░░██║██╔══╝░░██╔══╝░░██║  ░░████╔═████║░██║░░██║██║╚████║██║░░██║██╔══╝░░██╔══██╗██║░░░░░██╔══██║██║╚████║██║░░██║\n██████╔╝███████╗██║░░░░░██║  ░░╚██╔╝░╚██╔╝░╚█████╔╝██║░╚███║██████╔╝███████╗██║░░██║███████╗██║░░██║██║░╚███║██████╔╝\n╚═════╝░╚══════╝╚═╝░░░░░╚═╝  ░░░╚═╝░░░╚═╝░░░╚════╝░╚═╝░░╚══╝╚═════╝░╚══════╝╚═╝░░╚═╝╚══════╝╚═╝░░╚═╝╚═╝░░╚══╝╚═════╝░\n\nhttps://defi.sucks\n\n*/\n\npragma solidity >=0.8.4 <0.9.0;\n\nimport '@openzeppelin/contracts/token/ERC20/ERC20.sol';\nimport '@uniswap/v3-core/contracts/interfaces/IUniswapV3Pool.sol';\n\nimport './libraries/LiquidityAmounts.sol';\nimport './libraries/FixedPoint96.sol';\nimport './libraries/FullMath.sol';\nimport './libraries/TickMath.sol';\n\nimport '../interfaces/external/IWeth9.sol';\nimport '../interfaces/IUniV3PairManager.sol';\n\nimport './peripherals/Governable.sol';\n\ncontract UniV3PairManager is IUniV3PairManager, Governable {\n /// @inheritdoc IERC20Metadata\n string public override name;\n\n /// @inheritdoc IERC20Metadata\n string public override symbol;\n\n /// @inheritdoc IERC20\n uint256 public override totalSupply;\n\n /// @inheritdoc IPairManager\n address public immutable override factory;\n\n /// @inheritdoc IPairManager\n address public immutable override token0;\n\n /// @inheritdoc IPairManager\n address public immutable override token1;\n\n /// @inheritdoc IPairManager\n address public immutable override pool;\n\n /// @inheritdoc IUniV3PairManager\n uint24 public immutable override fee;\n\n /// @inheritdoc IUniV3PairManager\n uint160 public immutable override sqrtRatioAX96;\n\n /// @inheritdoc IUniV3PairManager\n uint160 public immutable override sqrtRatioBX96;\n\n /// @inheritdoc IUniV3PairManager\n int24 public immutable override tickLower;\n\n /// @inheritdoc IUniV3PairManager\n int24 public immutable override tickUpper;\n\n /// @inheritdoc IUniV3PairManager\n int24 public immutable override tickSpacing;\n\n /// @notice Uniswap's maximum tick\n /// @dev Due to tick spacing, pools with different fees may have differences between _MAX_TICK and tickUpper. Use tickUpper to find the max tick of the pool.\n int24 private constant _MAX_TICK = 887272;\n\n /// @inheritdoc IERC20Metadata\n //solhint-disable-next-line const-name-snakecase\n uint8 public constant override decimals = 18;\n\n /// @inheritdoc IERC20\n mapping(address => mapping(address => uint256)) public override allowance;\n\n /// @inheritdoc IERC20\n mapping(address => uint256) public override balanceOf;\n\n /// @notice Struct that contains token0, token1, and fee of the Uniswap pool\n PoolKey private _poolKey;\n\n constructor(address _pool, address _governance) Governable(_governance) {\n uint24 _fee = IUniswapV3Pool(_pool).fee();\n address _token0 = IUniswapV3Pool(_pool).token0();\n address _token1 = IUniswapV3Pool(_pool).token1();\n int24 _tickSpacing = IUniswapV3Pool(_pool).tickSpacing();\n int24 _tickUpper = _MAX_TICK - (_MAX_TICK % _tickSpacing);\n int24 _tickLower = -_tickUpper;\n\n factory = msg.sender;\n pool = _pool;\n fee = _fee;\n tickSpacing = _tickSpacing;\n tickUpper = _tickUpper;\n tickLower = _tickLower;\n token0 = _token0;\n token1 = _token1;\n name = string(abi.encodePacked('Keep3rLP - ', ERC20(_token0).symbol(), '/', ERC20(_token1).symbol()));\n symbol = string(abi.encodePacked('kLP-', ERC20(_token0).symbol(), '/', ERC20(_token1).symbol()));\n\n sqrtRatioAX96 = TickMath.getSqrtRatioAtTick(_tickLower);\n sqrtRatioBX96 = TickMath.getSqrtRatioAtTick(_tickUpper);\n _poolKey = PoolKey({token0: _token0, token1: _token1, fee: _fee});\n }\n\n // This low-level function should be called from a contract which performs important safety checks\n /// @inheritdoc IUniV3PairManager\n function mint(\n uint256 amount0Desired,\n uint256 amount1Desired,\n uint256 amount0Min,\n uint256 amount1Min,\n address to\n ) external override returns (uint128 liquidity) {\n (liquidity, , ) = _addLiquidity(amount0Desired, amount1Desired, amount0Min, amount1Min);\n _mint(to, liquidity);\n }\n\n /// @inheritdoc IUniV3PairManager\n function uniswapV3MintCallback(\n uint256 amount0Owed,\n uint256 amount1Owed,\n bytes calldata data\n ) external override {\n MintCallbackData memory decoded = abi.decode(data, (MintCallbackData));\n if (msg.sender != pool) revert OnlyPool();\n if (amount0Owed > 0) _pay(decoded._poolKey.token0, decoded.payer, pool, amount0Owed);\n if (amount1Owed > 0) _pay(decoded._poolKey.token1, decoded.payer, pool, amount1Owed);\n }\n\n /// @inheritdoc IUniV3PairManager\n function burn(\n uint128 liquidity,\n uint256 amount0Min,\n uint256 amount1Min,\n address to\n ) external override returns (uint256 amount0, uint256 amount1) {\n (amount0, amount1) = IUniswapV3Pool(pool).burn(tickLower, tickUpper, liquidity);\n\n if (amount0 < amount0Min || amount1 < amount1Min) revert ExcessiveSlippage();\n\n IUniswapV3Pool(pool).collect(to, tickLower, tickUpper, uint128(amount0), uint128(amount1));\n _burn(msg.sender, liquidity);\n }\n\n /// @inheritdoc IUniV3PairManager\n function collect() external override onlyGovernance returns (uint256 amount0, uint256 amount1) {\n (, , , uint128 tokensOwed0, uint128 tokensOwed1) = IUniswapV3Pool(pool).positions(\n keccak256(abi.encodePacked(address(this), tickLower, tickUpper))\n );\n (amount0, amount1) = IUniswapV3Pool(pool).collect(governance, tickLower, tickUpper, tokensOwed0, tokensOwed1);\n }\n\n /// @inheritdoc IUniV3PairManager\n function position()\n external\n view\n override\n returns (\n uint128 liquidity,\n uint256 feeGrowthInside0LastX128,\n uint256 feeGrowthInside1LastX128,\n uint128 tokensOwed0,\n uint128 tokensOwed1\n )\n {\n (liquidity, feeGrowthInside0LastX128, feeGrowthInside1LastX128, tokensOwed0, tokensOwed1) = IUniswapV3Pool(pool).positions(\n keccak256(abi.encodePacked(address(this), tickLower, tickUpper))\n );\n }\n\n /// @inheritdoc IERC20\n function approve(address spender, uint256 amount) external override returns (bool) {\n allowance[msg.sender][spender] = amount;\n\n emit Approval(msg.sender, spender, amount);\n return true;\n }\n\n /// @inheritdoc IERC20\n function transfer(address to, uint256 amount) external override returns (bool) {\n _transferTokens(msg.sender, to, amount);\n return true;\n }\n\n /// @inheritdoc IERC20\n function transferFrom(\n address from,\n address to,\n uint256 amount\n ) external override returns (bool) {\n address spender = msg.sender;\n uint256 spenderAllowance = allowance[from][spender];\n\n if (spender != from && spenderAllowance != type(uint256).max) {\n uint256 newAllowance = spenderAllowance - amount;\n allowance[from][spender] = newAllowance;\n\n emit Approval(from, spender, newAllowance);\n }\n\n _transferTokens(from, to, amount);\n return true;\n }\n\n /// @notice Adds liquidity to an initialized pool\n /// @dev Reverts if the returned amount0 is less than amount0Min or if amount1 is less than amount1Min\n /// @dev This function calls the mint function of the corresponding Uniswap pool, which in turn calls UniswapV3Callback\n /// @param amount0Desired The amount of token0 we would like to provide\n /// @param amount1Desired The amount of token1 we would like to provide\n /// @param amount0Min The minimum amount of token0 we want to provide\n /// @param amount1Min The minimum amount of token1 we want to provide\n /// @return liquidity The calculated liquidity we get for the token amounts we provided\n /// @return amount0 The amount of token0 we ended up providing\n /// @return amount1 The amount of token1 we ended up providing\n function _addLiquidity(\n uint256 amount0Desired,\n uint256 amount1Desired,\n uint256 amount0Min,\n uint256 amount1Min\n )\n internal\n returns (\n uint128 liquidity,\n uint256 amount0,\n uint256 amount1\n )\n {\n (uint160 sqrtPriceX96, , , , , , ) = IUniswapV3Pool(pool).slot0();\n\n liquidity = LiquidityAmounts.getLiquidityForAmounts(sqrtPriceX96, sqrtRatioAX96, sqrtRatioBX96, amount0Desired, amount1Desired);\n\n (amount0, amount1) = IUniswapV3Pool(pool).mint(\n address(this),\n tickLower,\n tickUpper,\n liquidity,\n abi.encode(MintCallbackData({_poolKey: _poolKey, payer: msg.sender}))\n );\n\n if (amount0 < amount0Min || amount1 < amount1Min) revert ExcessiveSlippage();\n }\n\n /// @notice Transfers the passed-in token from the payer to the recipient for the corresponding value\n /// @param token The token to be transferred to the recipient\n /// @param from The address of the payer\n /// @param to The address of the passed-in tokens recipient\n /// @param value How much of that token to be transferred from payer to the recipient\n function _pay(\n address token,\n address from,\n address to,\n uint256 value\n ) internal {\n _safeTransferFrom(token, from, to, value);\n }\n\n /// @notice Mints Keep3r credits to the passed-in address of recipient and increases total supply of Keep3r credits by the corresponding amount\n /// @param to The recipient of the Keep3r credits\n /// @param amount The amount Keep3r credits to be minted to the recipient\n function _mint(address to, uint256 amount) internal {\n totalSupply += amount;\n balanceOf[to] += amount;\n emit Transfer(address(0), to, amount);\n }\n\n /// @notice Burns Keep3r credits to the passed-in address of recipient and reduces total supply of Keep3r credits by the corresponding amount\n /// @param to The address that will get its Keep3r credits burned\n /// @param amount The amount Keep3r credits to be burned from the recipient/recipient\n function _burn(address to, uint256 amount) internal {\n totalSupply -= amount;\n balanceOf[to] -= amount;\n emit Transfer(to, address(0), amount);\n }\n\n /// @notice Transfers amount of Keep3r credits between two addresses\n /// @param from The user that transfers the Keep3r credits\n /// @param to The user that receives the Keep3r credits\n /// @param amount The amount of Keep3r credits to be transferred\n function _transferTokens(\n address from,\n address to,\n uint256 amount\n ) internal {\n balanceOf[from] -= amount;\n balanceOf[to] += amount;\n\n emit Transfer(from, to, amount);\n }\n\n /// @notice Transfers the passed-in token from the specified \"from\" to the specified \"to\" for the corresponding value\n /// @dev Reverts with IUniV3PairManager#UnsuccessfulTransfer if the transfer was not successful,\n /// or if the passed data length is different than 0 and the decoded data is not a boolean\n /// @param token The token to be transferred to the specified \"to\"\n /// @param from The address which is going to transfer the tokens\n /// @param value How much of that token to be transferred from \"from\" to \"to\"\n function _safeTransferFrom(\n address token,\n address from,\n address to,\n uint256 value\n ) internal {\n // solhint-disable-next-line avoid-low-level-calls\n (bool success, bytes memory data) = token.call(abi.encodeWithSelector(IERC20.transferFrom.selector, from, to, value));\n if (!success || (data.length != 0 && !abi.decode(data, (bool)))) revert UnsuccessfulTransfer();\n }\n}\n" - }, - "solidity/interfaces/external/IWeth9.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '@openzeppelin/contracts/token/ERC20/IERC20.sol';\n\ninterface IWeth9 is IERC20 {\n function deposit() external payable;\n\n function withdraw(uint256) external;\n}\n" - }, - "solidity/interfaces/IUniV3PairManager.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport './IPairManager.sol';\nimport '@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol';\nimport './peripherals/IGovernable.sol';\n\n/// @title Pair Manager contract\n/// @notice Creates a UniswapV3 position, and tokenizes in an ERC20 manner\n/// so that the user can use it as liquidity for a Keep3rJob\ninterface IUniV3PairManager is IGovernable, IPairManager {\n // Structs\n struct PoolKey {\n address token0;\n address token1;\n uint24 fee;\n }\n\n /// @notice The data to be decoded by the UniswapV3MintCallback function\n struct MintCallbackData {\n PoolKey _poolKey; // Struct that contains token0, token1, and fee of the pool passed into the constructor\n address payer; // The address of the payer, which will be the msg.sender of the mint function\n }\n\n // Variables\n\n /// @notice The fee of the Uniswap pool passed into the constructor\n /// @return _fee The fee of the Uniswap pool passed into the constructor\n function fee() external view returns (uint24 _fee);\n\n /// @notice Highest tick in the Uniswap's curve\n /// @return _tickUpper The highest tick in the Uniswap's curve\n function tickUpper() external view returns (int24 _tickUpper);\n\n /// @notice Lowest tick in the Uniswap's curve\n /// @return _tickLower The lower tick in the Uniswap's curve\n function tickLower() external view returns (int24 _tickLower);\n\n /// @notice The pair tick spacing\n /// @return _tickSpacing The pair tick spacing\n function tickSpacing() external view returns (int24 _tickSpacing);\n\n /// @notice The sqrtRatioAX96 at the lowest tick (-887200) of the Uniswap pool\n /// @return _sqrtPriceA96 A Fixed point Q64.96 number representing the sqrt of the ratio of the two assets (token1/token0)\n /// at the lowest tick\n function sqrtRatioAX96() external view returns (uint160 _sqrtPriceA96);\n\n /// @notice The sqrtRatioBX96 at the highest tick (887200) of the Uniswap pool\n /// @return _sqrtPriceBX96 A Fixed point Q64.96 number representing the sqrt of the ratio of the two assets (token1/token0)\n /// at the highest tick\n function sqrtRatioBX96() external view returns (uint160 _sqrtPriceBX96);\n\n // Errors\n\n /// @notice Throws when the caller of the function is not the pool\n error OnlyPool();\n\n /// @notice Throws when the slippage exceeds what the user is comfortable with\n error ExcessiveSlippage();\n\n /// @notice Throws when a transfer is unsuccessful\n error UnsuccessfulTransfer();\n\n // Methods\n\n /// @notice This function is called after a user calls IUniV3PairManager#mint function\n /// It ensures that any tokens owed to the pool are paid by the msg.sender of IUniV3PairManager#mint function\n /// @param amount0Owed The amount of token0 due to the pool for the minted liquidity\n /// @param amount1Owed The amount of token1 due to the pool for the minted liquidity\n /// @param data The encoded token0, token1, fee (_poolKey) and the payer (msg.sender) of the IUniV3PairManager#mint function\n function uniswapV3MintCallback(\n uint256 amount0Owed,\n uint256 amount1Owed,\n bytes calldata data\n ) external;\n\n /// @notice Mints kLP tokens to an address according to the liquidity the msg.sender provides to the UniswapV3 pool\n /// @dev Triggers UniV3PairManager#uniswapV3MintCallback\n /// @param amount0Desired The amount of token0 we would like to provide\n /// @param amount1Desired The amount of token1 we would like to provide\n /// @param amount0Min The minimum amount of token0 we want to provide\n /// @param amount1Min The minimum amount of token1 we want to provide\n /// @param to The address to which the kLP tokens are going to be minted to\n /// @return liquidity kLP tokens sent in exchange for the provision of tokens\n function mint(\n uint256 amount0Desired,\n uint256 amount1Desired,\n uint256 amount0Min,\n uint256 amount1Min,\n address to\n ) external returns (uint128 liquidity);\n\n /// @notice Returns the pair manager's position in the corresponding UniswapV3 pool\n /// @return liquidity The amount of liquidity provided to the UniswapV3 pool by the pair manager\n /// @return feeGrowthInside0LastX128 The fee growth of token0 as of the last action on the individual position\n /// @return feeGrowthInside1LastX128 The fee growth of token1 as of the last action on the individual position\n /// @return tokensOwed0 The uncollected amount of token0 owed to the position as of the last computation\n /// @return tokensOwed1 The uncollected amount of token1 owed to the position as of the last computation\n function position()\n external\n view\n returns (\n uint128 liquidity,\n uint256 feeGrowthInside0LastX128,\n uint256 feeGrowthInside1LastX128,\n uint128 tokensOwed0,\n uint128 tokensOwed1\n );\n\n /// @notice Calls the UniswapV3 pool's collect function, which collects up to a maximum amount of fees\n // owed to a specific position to the recipient, in this case, that recipient is the pair manager\n /// @dev The collected fees will be sent to governance\n /// @return amount0 The amount of fees collected in token0\n /// @return amount1 The amount of fees collected in token1\n function collect() external returns (uint256 amount0, uint256 amount1);\n\n /// @notice Burns the corresponding amount of kLP tokens from the msg.sender and withdraws the specified liquidity\n // in the entire range\n /// @param liquidity The amount of liquidity to be burned\n /// @param amount0Min The minimum amount of token0 we want to send to the recipient (to)\n /// @param amount1Min The minimum amount of token1 we want to send to the recipient (to)\n /// @param to The address that will receive the due fees\n /// @return amount0 The calculated amount of token0 that will be sent to the recipient\n /// @return amount1 The calculated amount of token1 that will be sent to the recipient\n function burn(\n uint128 liquidity,\n uint256 amount0Min,\n uint256 amount1Min,\n address to\n ) external returns (uint256 amount0, uint256 amount1);\n}\n" - }, - "@openzeppelin/contracts/utils/Context.sol": { - "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Provides information about the current execution context, including the\n * sender of the transaction and its data. While these are generally available\n * via msg.sender and msg.data, they should not be accessed in such a direct\n * manner, since when dealing with meta-transactions the account sending and\n * paying for execution may not be the actual sender (as far as an application\n * is concerned).\n *\n * This contract is only required for intermediate, library-like contracts.\n */\nabstract contract Context {\n function _msgSender() internal view virtual returns (address) {\n return msg.sender;\n }\n\n function _msgData() internal view virtual returns (bytes calldata) {\n return msg.data;\n }\n}\n" - }, - "solidity/interfaces/IPairManagerFactory.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport './peripherals/IGovernable.sol';\n\n/// @title Factory of Pair Managers\n/// @notice This contract creates new pair managers\ninterface IPairManagerFactory is IGovernable {\n // Variables\n\n /// @notice Maps the address of a Uniswap pool, to the address of the corresponding PairManager\n /// For example, the uniswap address of DAI-WETH, will return the Keep3r/DAI-WETH pair manager address\n /// @param _pool The address of the Uniswap pool\n /// @return _pairManager The address of the corresponding pair manager\n function pairManagers(address _pool) external view returns (address _pairManager);\n\n // Events\n\n /// @notice Emitted when a new pair manager is created\n /// @param _pool The address of the corresponding Uniswap pool\n /// @param _pairManager The address of the just-created pair manager\n event PairCreated(address _pool, address _pairManager);\n\n // Errors\n\n /// @notice Throws an error if the pair manager is already initialized\n error AlreadyInitialized();\n\n /// @notice Throws an error if the caller is not the owner\n error OnlyOwner();\n\n // Methods\n\n /// @notice Creates a new pair manager based on the address of a Uniswap pool\n /// For example, the uniswap address of DAI-WETH, will create the Keep3r/DAI-WETH pool\n /// @param _pool The address of the Uniswap pool the pair manager will be based of\n /// @return _pairManager The address of the just-created pair manager\n function createPairManager(address _pool) external returns (address _pairManager);\n}\n" - }, - "solidity/contracts/UniV3PairManagerFactory.sol": { - "content": "// SPDX-License-Identifier: MIT\n\n/*\n\nCoded for The Keep3r Network with ♥ by\n\n██████╗░███████╗███████╗██╗  ░██╗░░░░░░░██╗░█████╗░███╗░░██╗██████╗░███████╗██████╗░██╗░░░░░░█████╗░███╗░░██╗██████╗░\n██╔══██╗██╔════╝██╔════╝██║  ░██║░░██╗░░██║██╔══██╗████╗░██║██╔══██╗██╔════╝██╔══██╗██║░░░░░██╔══██╗████╗░██║██╔══██╗\n██║░░██║█████╗░░█████╗░░██║  ░╚██╗████╗██╔╝██║░░██║██╔██╗██║██║░░██║█████╗░░██████╔╝██║░░░░░███████║██╔██╗██║██║░░██║\n██║░░██║██╔══╝░░██╔══╝░░██║  ░░████╔═████║░██║░░██║██║╚████║██║░░██║██╔══╝░░██╔══██╗██║░░░░░██╔══██║██║╚████║██║░░██║\n██████╔╝███████╗██║░░░░░██║  ░░╚██╔╝░╚██╔╝░╚█████╔╝██║░╚███║██████╔╝███████╗██║░░██║███████╗██║░░██║██║░╚███║██████╔╝\n╚═════╝░╚══════╝╚═╝░░░░░╚═╝  ░░░╚═╝░░░╚═╝░░░╚════╝░╚═╝░░╚══╝╚═════╝░╚══════╝╚═╝░░╚═╝╚══════╝╚═╝░░╚═╝╚═╝░░╚══╝╚═════╝░\n\nhttps://defi.sucks\n\n*/\n\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../interfaces/IPairManagerFactory.sol';\nimport './UniV3PairManager.sol';\nimport './peripherals/Governable.sol';\n\n/// @title Factory of Pair Managers\n/// @notice This contract creates new pair managers\ncontract UniV3PairManagerFactory is IPairManagerFactory, Governable {\n mapping(address => address) public override pairManagers;\n\n constructor(address _governance) Governable(_governance) {}\n\n ///@inheritdoc IPairManagerFactory\n function createPairManager(address _pool) external override returns (address _pairManager) {\n if (pairManagers[_pool] != address(0)) revert AlreadyInitialized();\n _pairManager = address(new UniV3PairManager(_pool, governance));\n pairManagers[_pool] = _pairManager;\n emit PairCreated(_pool, _pairManager);\n }\n}\n" - }, - "solidity/for-test/peripherals/GovernableForTest.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../../contracts/peripherals/Governable.sol';\n\ncontract GovernableForTest is Governable {\n constructor(address _governor) Governable(_governor) {}\n}\n" - }, - "solidity/for-test/BridgeForTest.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.0 <0.9.0;\n\nimport '@openzeppelin/contracts/token/ERC20/ERC20.sol';\nimport '@openzeppelin/contracts/token/ERC20/IERC20.sol';\n\ncontract BridgeForTest is ERC20 {\n address public immutable kp3r;\n\n constructor(address _kp3r) ERC20('Wrapped KP3R', 'wKP3R') {\n kp3r = _kp3r;\n }\n\n function bridge(uint256 _amount) external {\n IERC20(kp3r).transferFrom(msg.sender, address(this), _amount);\n _mint(msg.sender, _amount);\n }\n\n function bridgeBack(uint256 _amount) external {\n _burn(msg.sender, _amount);\n IERC20(kp3r).transfer(msg.sender, _amount);\n }\n}\n" - }, - "solidity/for-test/ERC20ForTest.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '@openzeppelin/contracts/token/ERC20/ERC20.sol';\n\ncontract ERC20ForTest is ERC20 {\n constructor(\n string memory _name,\n string memory _symbol,\n address _initialAccount,\n uint256 _initialBalance\n ) ERC20(_name, _symbol) {\n _mint(_initialAccount, _initialBalance);\n }\n\n function mint(uint256 _amount) public {\n _mint(msg.sender, _amount);\n }\n\n function mint(address _account, uint256 _amount) public {\n _mint(_account, _amount);\n }\n\n function burn(uint256 _amount) public {\n _burn(msg.sender, _amount);\n }\n\n function burn(address _account, uint256 _amount) public {\n _burn(_account, _amount);\n }\n\n function transferInternal(\n address _from,\n address _to,\n uint256 _value\n ) public {\n _transfer(_from, _to, _value);\n }\n\n function approveInternal(\n address _owner,\n address _spender,\n uint256 _value\n ) public {\n _approve(_owner, _spender, _value);\n }\n\n function deposit() external payable {\n // Function added for compatibility with WETH\n }\n}\n" - }, - "solidity/for-test/peripherals/keepers/Keep3rKeeperFundableForTest.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../../../contracts/peripherals/keepers/Keep3rKeeperFundable.sol';\n\ncontract Keep3rKeeperFundableForTest is Keep3rKeeperFundable {\n using EnumerableSet for EnumerableSet.AddressSet;\n\n constructor(\n address _kph,\n address _keep3rV1,\n address _keep3rV1Proxy\n ) Keep3rParameters(_kph, _keep3rV1, _keep3rV1Proxy) Keep3rRoles(msg.sender) {}\n\n function isKeeper(address _keeper) external view returns (bool) {\n return _keepers.contains(_keeper);\n }\n\n function setJob(address job) external {\n _jobs.add(job);\n }\n}\n" - }, - "solidity/contracts/sidechain/Keep3rEscrow.sol": { - "content": "// SPDX-License-Identifier: MIT\n\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../peripherals/Mintable.sol';\nimport '../peripherals/DustCollector.sol';\nimport '../../interfaces/sidechain/IKeep3rEscrow.sol';\nimport '@openzeppelin/contracts/token/ERC20/IERC20.sol';\nimport '@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol';\n\ncontract Keep3rEscrow is Mintable, DustCollector, IKeep3rEscrow {\n using SafeERC20 for IERC20;\n\n /// @inheritdoc IKeep3rEscrow\n address public override wKP3R;\n\n /// @param _governance Address of governance\n /// @param _wKP3R Address of wrapped KP3R implementation\n constructor(address _governance, address _wKP3R) Mintable(_governance) {\n wKP3R = _wKP3R;\n }\n\n /// @inheritdoc IKeep3rEscrow\n function deposit(uint256 _amount) external override {\n IERC20(wKP3R).safeTransferFrom(msg.sender, address(this), _amount);\n emit wKP3RDeposited(wKP3R, msg.sender, _amount);\n }\n\n /// @inheritdoc IKeep3rEscrow\n function mint(uint256 _amount) external override onlyMinter {\n IERC20(wKP3R).safeTransfer(msg.sender, _amount);\n emit wKP3RMinted(wKP3R, msg.sender, _amount);\n }\n\n /// @inheritdoc IKeep3rEscrow\n function setWKP3R(address _wKP3R) external override onlyGovernance {\n if (_wKP3R == address(0)) revert ZeroAddress();\n wKP3R = _wKP3R;\n emit wKP3RSet(wKP3R);\n }\n}\n" - }, - "solidity/contracts/peripherals/Mintable.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../../interfaces/peripherals/IMintable.sol';\nimport './Governable.sol';\n\nabstract contract Mintable is Governable, IMintable {\n /// @inheritdoc IMintable\n address public override minter;\n\n constructor(address _governance) Governable(_governance) {}\n\n /// @inheritdoc IMintable\n function setMinter(address _minter) external override onlyGovernance {\n if (_minter == address(0)) revert ZeroAddress();\n minter = _minter;\n emit MinterSet(_minter);\n }\n\n /// @notice Functions with this modifier can only be called by the minter;\n modifier onlyMinter() {\n if (msg.sender != minter) revert OnlyMinter();\n _;\n }\n}\n" - }, - "solidity/for-test/peripherals/DustCollectorForTest.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../../contracts/peripherals/DustCollector.sol';\n\ncontract DustCollectorForTest is DustCollector {\n constructor() DustCollector() Governable(msg.sender) {}\n}\n" - }, - "solidity/for-test/peripherals/Keep3rAccountanceForTest.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../../contracts/peripherals/Keep3rAccountance.sol';\n\ncontract Keep3rAccountanceForTest is Keep3rAccountance {\n using EnumerableSet for EnumerableSet.AddressSet;\n\n constructor() Keep3rRoles(msg.sender) {}\n\n function setJob(address job) external {\n _jobs.add(job);\n }\n\n function setKeeper(address keeper) external {\n _keepers.add(keeper);\n }\n}\n" - }, - "solidity/for-test/peripherals/jobs/Keep3rJobFundableLiquidityForTest.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../../../contracts/peripherals/jobs/Keep3rJobFundableLiquidity.sol';\n\ncontract Keep3rJobFundableLiquidityForTest is Keep3rJobFundableLiquidity {\n using EnumerableSet for EnumerableSet.AddressSet;\n\n constructor(\n address _kph,\n address _keep3rV1,\n address _keep3rV1Proxy\n ) Keep3rParameters(_kph, _keep3rV1, _keep3rV1Proxy) Keep3rRoles(msg.sender) {}\n\n function setJob(address _job) external {\n _jobs.add(_job);\n }\n\n function setJobLiquidity(address _job, address _liquidity) external returns (bool) {\n return _jobLiquidities[_job].add(_liquidity);\n }\n\n function setApprovedLiquidity(address _liquidity) external {\n _approvedLiquidities.add(_liquidity);\n }\n\n function setRevokedLiquidity(address _liquidity) external {\n _approvedLiquidities.remove(_liquidity);\n }\n\n function viewTickCache(address _liquidity) external view returns (TickCache memory _tickCache) {\n _tickCache = _tick[_liquidity];\n }\n\n function viewTickOrder(address _liquidity) external view returns (bool) {\n return _isKP3RToken0[_liquidity];\n }\n\n function internalJobLiquidities(address _job) external view returns (address[] memory _list) {\n _list = _jobLiquidities[_job].values();\n }\n\n function internalSettleJobAccountance(address _job) external {\n _settleJobAccountance(_job);\n }\n}\n" - }, - "solidity/for-test/peripherals/jobs/Keep3rJobDisputableForTest.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../../../contracts/peripherals/jobs/Keep3rJobDisputable.sol';\n\ncontract Keep3rJobDisputableForTest is Keep3rJobDisputable {\n using EnumerableSet for EnumerableSet.AddressSet;\n\n constructor(\n address _kph,\n address _keep3rV1,\n address _keep3rV1Proxy\n ) Keep3rParameters(_kph, _keep3rV1, _keep3rV1Proxy) Keep3rRoles(msg.sender) {}\n\n function setJobLiquidity(address _job, address _liquidity) external {\n _jobLiquidities[_job].add(_liquidity);\n }\n\n function setJobToken(address _job, address _token) external {\n _jobTokens[_job].add(_token);\n }\n\n function setApprovedLiquidity(address _liquidity) external {\n _approvedLiquidities.add(_liquidity);\n }\n\n function setRevokedLiquidity(address _liquidity) external {\n _approvedLiquidities.remove(_liquidity);\n }\n\n function internalJobLiquidityCredits(address _job) external view returns (uint256 _credits) {\n _credits = _jobLiquidityCredits[_job];\n }\n\n function internalJobPeriodCredits(address _job) external view returns (uint256 _credits) {\n _credits = _jobPeriodCredits[_job];\n }\n\n function internalJobTokens(address _job) external view returns (address[] memory _tokens) {\n _tokens = new address[](_jobTokens[_job].length());\n for (uint256 i; i < _jobTokens[_job].length(); i++) {\n _tokens[i] = _jobTokens[_job].at(i);\n }\n }\n\n function internalJobLiquidities(address _job) external view returns (address[] memory _tokens) {\n _tokens = new address[](_jobLiquidities[_job].length());\n for (uint256 i; i < _jobLiquidities[_job].length(); i++) {\n _tokens[i] = _jobLiquidities[_job].at(i);\n }\n }\n}\n" - }, - "solidity/for-test/peripherals/Keep3rDisputableForTest.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../../contracts/peripherals/Keep3rDisputable.sol';\n\ncontract Keep3rDisputableForTest is Keep3rDisputable {\n constructor() Keep3rParameters(address(0), address(0), address(0)) Keep3rRoles(msg.sender) {}\n}\n" - }, - "solidity/for-test/peripherals/keepers/Keep3rKeeperDisputableForTest.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../../../contracts/peripherals/keepers/Keep3rKeeperDisputable.sol';\n\ncontract Keep3rKeeperDisputableForTest is Keep3rKeeperDisputable {\n using EnumerableSet for EnumerableSet.AddressSet;\n\n constructor(\n address _kph,\n address _keep3rV1,\n address _keep3rV1Proxy\n ) Keep3rParameters(_kph, _keep3rV1, _keep3rV1Proxy) Keep3rRoles(msg.sender) {}\n\n function setKeeper(address _keeper) external {\n _keepers.add(_keeper);\n }\n\n function internalSlash(\n address _bonded,\n address _keeper,\n uint256 _bondAmount,\n uint256 _unbondAmount\n ) external {\n _slash(_bonded, _keeper, _bondAmount, _unbondAmount);\n }\n\n function isKeeper(address _address) external view returns (bool _isKeeper) {\n _isKeeper = _keepers.contains(_address);\n }\n}\n" - }, - "solidity/for-test/peripherals/jobs/Keep3rJobFundableCreditsForTest.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../../../contracts/peripherals/jobs/Keep3rJobFundableCredits.sol';\n\ncontract Keep3rJobFundableCreditsForTest is Keep3rJobFundableCredits {\n using EnumerableSet for EnumerableSet.AddressSet;\n\n constructor(\n address _kph,\n address _keep3rV1,\n address _keep3rV1Proxy\n ) Keep3rParameters(_kph, _keep3rV1, _keep3rV1Proxy) Keep3rRoles(msg.sender) {}\n\n function setJob(address _job, address _jobOwner) external {\n _jobs.add(_job);\n jobOwner[_job] = _jobOwner;\n }\n\n function setJobToken(address _job, address _token) external {\n _jobTokens[_job].add(_token);\n }\n\n function isJobToken(address _job, address _token) external view returns (bool _contains) {\n _contains = _jobTokens[_job].contains(_token);\n }\n}\n" - }, - "solidity/contracts/Keep3rHelper.sol": { - "content": "// SPDX-License-Identifier: MIT\n\n/*\n\nCoded for The Keep3r Network with ♥ by\n\n██████╗░███████╗███████╗██╗  ░██╗░░░░░░░██╗░█████╗░███╗░░██╗██████╗░███████╗██████╗░██╗░░░░░░█████╗░███╗░░██╗██████╗░\n██╔══██╗██╔════╝██╔════╝██║  ░██║░░██╗░░██║██╔══██╗████╗░██║██╔══██╗██╔════╝██╔══██╗██║░░░░░██╔══██╗████╗░██║██╔══██╗\n██║░░██║█████╗░░█████╗░░██║  ░╚██╗████╗██╔╝██║░░██║██╔██╗██║██║░░██║█████╗░░██████╔╝██║░░░░░███████║██╔██╗██║██║░░██║\n██║░░██║██╔══╝░░██╔══╝░░██║  ░░████╔═████║░██║░░██║██║╚████║██║░░██║██╔══╝░░██╔══██╗██║░░░░░██╔══██║██║╚████║██║░░██║\n██████╔╝███████╗██║░░░░░██║  ░░╚██╔╝░╚██╔╝░╚█████╔╝██║░╚███║██████╔╝███████╗██║░░██║███████╗██║░░██║██║░╚███║██████╔╝\n╚═════╝░╚══════╝╚═╝░░░░░╚═╝  ░░░╚═╝░░░╚═╝░░░╚════╝░╚═╝░░╚══╝╚═════╝░╚══════╝╚═╝░░╚═╝╚══════╝╚═╝░░╚═╝╚═╝░░╚══╝╚═════╝░\n\nhttps://defi.sucks\n\n*/\n\npragma solidity >=0.8.7 <0.9.0;\n\nimport './libraries/FullMath.sol';\nimport './libraries/TickMath.sol';\nimport '../interfaces/IKeep3r.sol';\nimport '../interfaces/IKeep3rHelper.sol';\nimport './Keep3rHelperParameters.sol';\n\nimport '@openzeppelin/contracts/utils/math/Math.sol';\nimport '@uniswap/v3-core/contracts/interfaces/IUniswapV3Pool.sol';\n\ncontract Keep3rHelper is IKeep3rHelper, Keep3rHelperParameters {\n constructor(\n address _kp3r,\n address _keep3rV2,\n address _governance,\n address _kp3rWethPool\n ) Keep3rHelperParameters(_kp3r, _keep3rV2, _governance, _kp3rWethPool) {}\n\n /// @inheritdoc IKeep3rHelper\n function quote(uint256 _eth) public view override returns (uint256 _amountOut) {\n uint32[] memory _secondsAgos = new uint32[](2);\n _secondsAgos[1] = quoteTwapTime;\n\n (int56[] memory _tickCumulatives, ) = IUniswapV3Pool(kp3rWethPool.poolAddress).observe(_secondsAgos);\n int56 _difference = _tickCumulatives[0] - _tickCumulatives[1];\n _amountOut = getQuoteAtTick(uint128(_eth), kp3rWethPool.isTKNToken0 ? _difference : -_difference, quoteTwapTime);\n }\n\n /// @inheritdoc IKeep3rHelper\n function bonds(address _keeper) public view virtual override returns (uint256 _amountBonded) {\n return IKeep3r(keep3rV2).bonds(_keeper, KP3R);\n }\n\n /// @inheritdoc IKeep3rHelper\n function getRewardAmountFor(address _keeper, uint256 _gasUsed) public view override returns (uint256 _kp3r) {\n uint256 _boost = getRewardBoostFor(bonds(_keeper));\n _kp3r = quote((_gasUsed * _boost) / BOOST_BASE);\n }\n\n /// @inheritdoc IKeep3rHelper\n function getRewardAmount(uint256 _gasUsed) external view override returns (uint256 _amount) {\n // solhint-disable-next-line avoid-tx-origin\n return getRewardAmountFor(tx.origin, _gasUsed);\n }\n\n /// @inheritdoc IKeep3rHelper\n function getRewardBoostFor(uint256 _bonds) public view override returns (uint256 _rewardBoost) {\n _bonds = Math.min(_bonds, targetBond);\n uint256 _cap = minBoost + ((maxBoost - minBoost) * _bonds) / targetBond;\n _rewardBoost = _cap * _getBasefee();\n }\n\n /// @inheritdoc IKeep3rHelper\n function getPoolTokens(address _pool) public view override returns (address _token0, address _token1) {\n return (IUniswapV3Pool(_pool).token0(), IUniswapV3Pool(_pool).token1());\n }\n\n /// @inheritdoc IKeep3rHelper\n function isKP3RToken0(address _pool) external view virtual override returns (bool _isKP3RToken0) {\n address _token0;\n address _token1;\n (_token0, _token1) = getPoolTokens(_pool);\n if (_token0 == KP3R) {\n return true;\n } else if (_token1 != KP3R) {\n revert LiquidityPairInvalid();\n }\n }\n\n /// @inheritdoc IKeep3rHelper\n function observe(address _pool, uint32[] memory _secondsAgo)\n external\n view\n override\n returns (\n int56 _tickCumulative1,\n int56 _tickCumulative2,\n bool _success\n )\n {\n try IUniswapV3Pool(_pool).observe(_secondsAgo) returns (int56[] memory _uniswapResponse, uint160[] memory) {\n _tickCumulative1 = _uniswapResponse[0];\n if (_uniswapResponse.length > 1) {\n _tickCumulative2 = _uniswapResponse[1];\n }\n _success = true;\n } catch (bytes memory) {}\n }\n\n /// @inheritdoc IKeep3rHelper\n function getPaymentParams(uint256 _bonds)\n external\n view\n virtual\n override\n returns (\n uint256 _boost,\n uint256 _oneEthQuote,\n uint256 _extra\n )\n {\n _oneEthQuote = quote(1 ether);\n _boost = getRewardBoostFor(_bonds);\n _extra = workExtraGas;\n }\n\n /// @inheritdoc IKeep3rHelper\n function getKP3RsAtTick(\n uint256 _liquidityAmount,\n int56 _tickDifference,\n uint256 _timeInterval\n ) external pure override returns (uint256 _kp3rAmount) {\n uint160 sqrtRatioX96 = TickMath.getSqrtRatioAtTick(int24(_tickDifference / int256(_timeInterval)));\n _kp3rAmount = FullMath.mulDiv(1 << 96, _liquidityAmount, sqrtRatioX96);\n }\n\n /// @inheritdoc IKeep3rHelper\n function getQuoteAtTick(\n uint128 _baseAmount,\n int56 _tickDifference,\n uint256 _timeInterval\n ) public pure override returns (uint256 _quoteAmount) {\n uint160 sqrtRatioX96 = TickMath.getSqrtRatioAtTick(int24(_tickDifference / int256(_timeInterval)));\n\n if (sqrtRatioX96 <= type(uint128).max) {\n uint256 ratioX192 = uint256(sqrtRatioX96) * sqrtRatioX96;\n _quoteAmount = FullMath.mulDiv(1 << 192, _baseAmount, ratioX192);\n } else {\n uint256 ratioX128 = FullMath.mulDiv(sqrtRatioX96, sqrtRatioX96, 1 << 64);\n _quoteAmount = FullMath.mulDiv(1 << 128, _baseAmount, ratioX128);\n }\n }\n\n /// @notice Gets the gas basefee cost to calculate keeper rewards\n /// @dev Keepers are required to pay a priority fee to be included, this function recognizes a minimum priority fee\n /// @return _baseFee The block's basefee + a minimum priority fee, or a preset minimum gas fee\n function _getBasefee() internal view virtual returns (uint256 _baseFee) {\n return Math.max(minBaseFee, block.basefee + minPriorityFee);\n }\n}\n" - }, - "solidity/for-test/testnet/Keep3rHelperForTestnet.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../../contracts/Keep3rHelper.sol';\n\ncontract Keep3rHelperForTestnet is Keep3rHelper {\n constructor(\n address _kp3r,\n address _keep3rV2,\n address _governance,\n address _kp3rWethPool\n ) Keep3rHelper(_kp3r, _keep3rV2, _governance, _kp3rWethPool) {}\n\n function _getBasefee() internal pure override returns (uint256) {\n return 1;\n }\n\n /// @dev Overrides oracle validation that uses KP3R and WETH addresses\n function _validateOraclePool(address _poolAddress, address) internal view virtual override returns (TokenOraclePool memory _oraclePool) {\n return TokenOraclePool(_poolAddress, true);\n }\n\n /// @dev Overrides token comparison with KP3R address\n function isKP3RToken0(address) public view virtual override returns (bool) {\n return true;\n }\n}\n" - }, - "solidity/for-test/Keep3rHelperForTest.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../contracts/Keep3rHelper.sol';\n\ncontract Keep3rHelperForTest is Keep3rHelper {\n uint256 public basefee;\n\n constructor(\n address _kp3r,\n address _keep3rV2,\n address _governance,\n address _kp3rWethPool\n ) Keep3rHelper(_kp3r, _keep3rV2, _governance, _kp3rWethPool) {}\n\n function _getBasefee() internal view override returns (uint256) {\n return basefee != 0 ? (basefee + minPriorityFee) : super._getBasefee();\n }\n\n function setBaseFee(uint256 _baseFee) external {\n basefee = _baseFee;\n }\n}\n" - }, - "solidity/contracts/sidechain/Keep3rHelperSidechain.sol": { - "content": "// SPDX-License-Identifier: MIT\n\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../Keep3rHelper.sol';\nimport '../../interfaces/sidechain/IKeep3rHelperSidechain.sol';\n\ncontract Keep3rHelperSidechain is IKeep3rHelperSidechain, Keep3rHelper {\n /// @inheritdoc IKeep3rHelperSidechain\n mapping(address => address) public override oracle;\n /// @inheritdoc IKeep3rHelperSidechain\n IKeep3rHelperParameters.TokenOraclePool public override wethUSDPool;\n\n /// @notice Ethereum mainnet WETH address used for quoting references\n address public immutable override WETH;\n\n /// @param _keep3rV2 Address of sidechain Keep3r implementation\n /// @param _governance Address of governance\n /// @param _kp3rWethOracle Address of oracle used for KP3R/WETH quote\n /// @param _wethUsdOracle Address of oracle used for WETH/USD quote\n /// @dev Oracle pools should use 18 decimals tokens\n constructor(\n address _keep3rV2,\n address _governance,\n address _kp3r,\n address _weth,\n address _kp3rWethOracle,\n address _wethUsdOracle\n ) Keep3rHelper(_kp3r, _keep3rV2, _governance, _kp3rWethOracle) {\n WETH = _weth;\n wethUSDPool = _validateOraclePool(_wethUsdOracle, _weth);\n _setQuoteTwapTime(1 days);\n workExtraGas = 0;\n }\n\n /// @inheritdoc IKeep3rHelper\n /// @notice Uses valid wKP3R address from Keep3rSidechain to query keeper bonds\n function bonds(address _keeper) public view override(Keep3rHelper, IKeep3rHelper) returns (uint256 _amountBonded) {\n address wKP3R = IKeep3r(keep3rV2).keep3rV1();\n return IKeep3r(keep3rV2).bonds(_keeper, wKP3R);\n }\n\n /// @inheritdoc IKeep3rHelperSidechain\n function setOracle(address _liquidity, address _oracle) external override onlyGovernance {\n if (_liquidity == address(0) || _oracle == address(0)) revert ZeroAddress();\n oracle[_liquidity] = _oracle;\n emit OracleSet(_liquidity, _oracle);\n }\n\n /// @inheritdoc IKeep3rHelperSidechain\n function quoteUsdToEth(uint256 _usd) public view virtual override returns (uint256 _amountOut) {\n uint32[] memory _secondsAgos = new uint32[](2);\n _secondsAgos[1] = quoteTwapTime;\n\n /// @dev Oracle is compatible with IUniswapV3Pool\n (int56[] memory _tickCumulatives, ) = IUniswapV3Pool(wethUSDPool.poolAddress).observe(_secondsAgos);\n int56 _difference = _tickCumulatives[0] - _tickCumulatives[1];\n _amountOut = getQuoteAtTick(uint128(_usd), wethUSDPool.isTKNToken0 ? _difference : -_difference, quoteTwapTime);\n }\n\n /// @inheritdoc IKeep3rHelperSidechain\n function setWethUsdPool(address _poolAddress) external override onlyGovernance {\n if (_poolAddress == address(0)) revert ZeroAddress();\n _setWethUsdPool(_poolAddress);\n }\n\n /// @inheritdoc IKeep3rHelper\n function getPaymentParams(uint256 _bonds)\n external\n view\n virtual\n override(Keep3rHelper, IKeep3rHelper)\n returns (\n uint256 _boost,\n uint256 _oneUsdQuote,\n uint256 _extraGas\n )\n {\n _oneUsdQuote = quote(quoteUsdToEth(1 ether));\n _boost = getRewardBoostFor(_bonds);\n _extraGas = workExtraGas;\n }\n\n function _setWethUsdPool(address _poolAddress) internal {\n wethUSDPool = _validateOraclePool(_poolAddress, WETH);\n emit WethUSDPoolChange(wethUSDPool.poolAddress, wethUSDPool.isTKNToken0);\n }\n\n /// @dev Sidechain jobs are quoted by USD/gasUnit, baseFee is set to 1\n function _getBasefee() internal view virtual override returns (uint256 _baseFee) {\n return 1;\n }\n}\n" - }, - "solidity/for-test/testnet/Keep3rHelperSidechainForTestnet.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../../contracts/sidechain/Keep3rHelperSidechain.sol';\n\ncontract Keep3rHelperSidechainForTestnet is Keep3rHelperSidechain {\n constructor(\n address _keep3rV2,\n address _governance,\n address _kp3r,\n address _weth,\n address _kp3rWethOracle,\n address _wethUsdOracle\n ) Keep3rHelperSidechain(_keep3rV2, _governance, _kp3r, _weth, _kp3rWethOracle, _wethUsdOracle) {}\n\n /// @dev Overrides oracle validation that uses KP3R and WETH addresses\n function _validateOraclePool(address _poolAddress, address) internal view virtual override returns (TokenOraclePool memory _oraclePool) {\n return TokenOraclePool(_poolAddress, true);\n }\n\n /// @dev Overrides token comparison with KP3R address\n function isKP3RToken0(address) public view virtual override returns (bool) {\n return true;\n }\n\n function quoteUsdToEth(uint256 _usd) public view virtual override returns (uint256) {\n return _usd / 1000;\n }\n}\n" - }, - "solidity/for-test/peripherals/Keep3rParametersForTest.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../../contracts/peripherals/Keep3rParameters.sol';\n\ncontract Keep3rParametersForTest is Keep3rParameters {\n constructor(\n address _keep3rHelper,\n address _keep3rV1,\n address _keep3rV1Proxy\n ) Keep3rParameters(_keep3rHelper, _keep3rV1, _keep3rV1Proxy) Keep3rRoles(msg.sender) {}\n}\n" - }, - "solidity/for-test/peripherals/jobs/Keep3rJobWorkableForTest.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../../../contracts/peripherals/jobs/Keep3rJobWorkable.sol';\n\ncontract Keep3rJobWorkableForTest is Keep3rJobWorkable {\n using EnumerableSet for EnumerableSet.AddressSet;\n\n constructor(\n address _keep3rHelper,\n address _keep3rV1,\n address _keep3rV1Proxy\n ) Keep3rParameters(_keep3rHelper, _keep3rV1, _keep3rV1Proxy) Keep3rRoles(msg.sender) {}\n\n function setJob(address _job) external {\n _jobs.add(_job);\n }\n\n function setKeeper(address _keeper) external {\n _keepers.add(_keeper);\n }\n\n function setApprovedLiquidity(address _liquidity) external {\n _approvedLiquidities.add(_liquidity);\n }\n\n function setJobLiquidity(address _job, address _liquidity) external {\n _jobLiquidities[_job].add(_liquidity);\n }\n\n function viewJobLiquidityCredits(address _job) external view returns (uint256) {\n return _jobLiquidityCredits[_job];\n }\n\n function viewJobPeriodCredits(address _job) external view returns (uint256) {\n return _jobPeriodCredits[_job];\n }\n\n function viewTickCache(address _liquidity) external view returns (TickCache memory _tickCache) {\n _tickCache = _tick[_liquidity];\n }\n\n function viewGas() external view returns (uint256) {\n return _initialGas;\n }\n}\n" - }, - "solidity/for-test/peripherals/jobs/Keep3rJobMigrationForTest.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../../../contracts/peripherals/jobs/Keep3rJobMigration.sol';\n\ncontract Keep3rJobMigrationForTest is Keep3rJobMigration {\n using EnumerableSet for EnumerableSet.AddressSet;\n\n mapping(address => uint256) public settleJobAccountanceCallCount;\n\n constructor(\n address _kph,\n address _keep3rV1,\n address _keep3rV1Proxy\n ) Keep3rParameters(_kph, _keep3rV1, _keep3rV1Proxy) Keep3rRoles(msg.sender) {}\n\n function setJobToken(address _job, address _token) external {\n _jobTokens[_job].add(_token);\n }\n\n function setJobLiquidity(address _job, address _liquidity) external {\n _jobLiquidities[_job].add(_liquidity);\n }\n\n function viewJobTokenListLength(address _job) external view returns (uint256) {\n return _jobTokens[_job].length();\n }\n\n function viewJobLiquidityList(address _job) external view returns (address[] memory _list) {\n _list = _jobLiquidities[_job].values();\n }\n\n function viewJobPeriodCredits(address _job) external view returns (uint256) {\n return _jobPeriodCredits[_job];\n }\n\n function viewJobLiquidityCredits(address _job) external view returns (uint256) {\n return _jobLiquidityCredits[_job];\n }\n\n function viewMigrationCreatedAt(address _fromJob, address _toJob) external view returns (uint256) {\n return _migrationCreatedAt[_fromJob][_toJob];\n }\n\n function isJob(address _job) external view returns (bool) {\n return _jobs.contains(_job);\n }\n\n function _settleJobAccountance(address _job) internal override {\n settleJobAccountanceCallCount[_job]++;\n }\n}\n" - }, - "solidity/for-test/peripherals/jobs/Keep3rJobManagerForTest.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../../../contracts/peripherals/jobs/Keep3rJobManager.sol';\n\ncontract Keep3rJobManagerForTest is Keep3rJobManager {\n using EnumerableSet for EnumerableSet.AddressSet;\n\n constructor(\n address _keep3rHelper,\n address _keep3rV1,\n address _keep3rV1Proxy\n ) Keep3rRoles(msg.sender) {}\n\n function isJob(address _job) external view returns (bool _isJob) {\n _isJob = _jobs.contains(_job);\n }\n}\n" - }, - "solidity/for-test/peripherals/jobs/Keep3rJobOwnershipForTest.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../../../contracts/peripherals/jobs/Keep3rJobOwnership.sol';\n\ncontract Keep3rJobOwnershipForTest is Keep3rJobOwnership {}\n" - }, - "solidity/for-test/libraries/LiquidityAmountsForTest.sol": { - "content": "// SPDX-License-Identifier: GPL-2.0-or-later\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../../contracts/libraries/FullMath.sol';\nimport '../../contracts/libraries/FixedPoint96.sol';\n\n/// @dev Made this library into a contract to be able to calculate liquidity more precisely for tests\n\n// solhint-disable\ncontract LiquidityAmountsForTest {\n function toUint128(uint256 x) private pure returns (uint128 y) {\n require((y = uint128(x)) == x);\n }\n\n function getLiquidityForAmount0(\n uint160 sqrtRatioAX96,\n uint160 sqrtRatioBX96,\n uint256 amount0\n ) public pure returns (uint128 liquidity) {\n if (sqrtRatioAX96 > sqrtRatioBX96) (sqrtRatioAX96, sqrtRatioBX96) = (sqrtRatioBX96, sqrtRatioAX96);\n uint256 intermediate = FullMath.mulDiv(sqrtRatioAX96, sqrtRatioBX96, FixedPoint96.Q96);\n return toUint128(FullMath.mulDiv(amount0, intermediate, sqrtRatioBX96 - sqrtRatioAX96));\n }\n\n function getLiquidityForAmount1(\n uint160 sqrtRatioAX96,\n uint160 sqrtRatioBX96,\n uint256 amount1\n ) public pure returns (uint128 liquidity) {\n if (sqrtRatioAX96 > sqrtRatioBX96) (sqrtRatioAX96, sqrtRatioBX96) = (sqrtRatioBX96, sqrtRatioAX96);\n return toUint128(FullMath.mulDiv(amount1, FixedPoint96.Q96, sqrtRatioBX96 - sqrtRatioAX96));\n }\n\n function getLiquidityForAmounts(\n uint160 sqrtRatioX96,\n uint160 sqrtRatioAX96,\n uint160 sqrtRatioBX96,\n uint256 amount0,\n uint256 amount1\n ) external pure returns (uint128 liquidity) {\n if (sqrtRatioAX96 > sqrtRatioBX96) (sqrtRatioAX96, sqrtRatioBX96) = (sqrtRatioBX96, sqrtRatioAX96);\n\n if (sqrtRatioX96 <= sqrtRatioAX96) {\n liquidity = getLiquidityForAmount0(sqrtRatioAX96, sqrtRatioBX96, amount0);\n } else if (sqrtRatioX96 < sqrtRatioBX96) {\n uint128 liquidity0 = getLiquidityForAmount0(sqrtRatioX96, sqrtRatioBX96, amount0);\n uint128 liquidity1 = getLiquidityForAmount1(sqrtRatioAX96, sqrtRatioX96, amount1);\n\n liquidity = liquidity0 < liquidity1 ? liquidity0 : liquidity1;\n } else {\n liquidity = getLiquidityForAmount1(sqrtRatioAX96, sqrtRatioBX96, amount1);\n }\n }\n\n function getAmount0ForLiquidity(\n uint160 sqrtRatioAX96,\n uint160 sqrtRatioBX96,\n uint128 liquidity\n ) public pure returns (uint256 amount0) {\n if (sqrtRatioAX96 > sqrtRatioBX96) (sqrtRatioAX96, sqrtRatioBX96) = (sqrtRatioBX96, sqrtRatioAX96);\n\n return FullMath.mulDiv(uint256(liquidity) << FixedPoint96.RESOLUTION, sqrtRatioBX96 - sqrtRatioAX96, sqrtRatioBX96) / sqrtRatioAX96;\n }\n\n function getAmount1ForLiquidity(\n uint160 sqrtRatioAX96,\n uint160 sqrtRatioBX96,\n uint128 liquidity\n ) public pure returns (uint256 amount1) {\n if (sqrtRatioAX96 > sqrtRatioBX96) (sqrtRatioAX96, sqrtRatioBX96) = (sqrtRatioBX96, sqrtRatioAX96);\n\n return FullMath.mulDiv(liquidity, sqrtRatioBX96 - sqrtRatioAX96, FixedPoint96.Q96);\n }\n\n function getAmountsForLiquidity(\n uint160 sqrtRatioX96,\n uint160 sqrtRatioAX96,\n uint160 sqrtRatioBX96,\n uint128 liquidity\n ) external pure returns (uint256 amount0, uint256 amount1) {\n if (sqrtRatioAX96 > sqrtRatioBX96) (sqrtRatioAX96, sqrtRatioBX96) = (sqrtRatioBX96, sqrtRatioAX96);\n\n if (sqrtRatioX96 <= sqrtRatioAX96) {\n amount0 = getAmount0ForLiquidity(sqrtRatioAX96, sqrtRatioBX96, liquidity);\n } else if (sqrtRatioX96 < sqrtRatioBX96) {\n amount0 = getAmount0ForLiquidity(sqrtRatioX96, sqrtRatioBX96, liquidity);\n amount1 = getAmount1ForLiquidity(sqrtRatioAX96, sqrtRatioX96, liquidity);\n } else {\n amount1 = getAmount1ForLiquidity(sqrtRatioAX96, sqrtRatioBX96, liquidity);\n }\n }\n}\n" - }, - "solidity/for-test/IUniswapV3PoolForTest.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '@uniswap/v3-core/contracts/interfaces/IERC20Minimal.sol';\nimport '@uniswap/v3-core/contracts/interfaces/IUniswapV3Pool.sol';\n\n// solhint-disable-next-line no-empty-blocks\ninterface IUniswapV3PoolForTest is IERC20Minimal, IUniswapV3Pool {\n\n}\n" - }, - "@uniswap/v3-core/contracts/interfaces/IERC20Minimal.sol": { - "content": "// SPDX-License-Identifier: GPL-2.0-or-later\npragma solidity >=0.5.0;\n\n/// @title Minimal ERC20 interface for Uniswap\n/// @notice Contains a subset of the full ERC20 interface that is used in Uniswap V3\ninterface IERC20Minimal {\n /// @notice Returns the balance of a token\n /// @param account The account for which to look up the number of tokens it has, i.e. its balance\n /// @return The number of tokens held by the account\n function balanceOf(address account) external view returns (uint256);\n\n /// @notice Transfers the amount of token from the `msg.sender` to the recipient\n /// @param recipient The account that will receive the amount transferred\n /// @param amount The number of tokens to send from the sender to the recipient\n /// @return Returns true for a successful transfer, false for an unsuccessful transfer\n function transfer(address recipient, uint256 amount) external returns (bool);\n\n /// @notice Returns the current allowance given to a spender by an owner\n /// @param owner The account of the token owner\n /// @param spender The account of the token spender\n /// @return The current allowance granted by `owner` to `spender`\n function allowance(address owner, address spender) external view returns (uint256);\n\n /// @notice Sets the allowance of a spender from the `msg.sender` to the value `amount`\n /// @param spender The account which will be allowed to spend a given amount of the owners tokens\n /// @param amount The amount of tokens allowed to be used by `spender`\n /// @return Returns true for a successful approval, false for unsuccessful\n function approve(address spender, uint256 amount) external returns (bool);\n\n /// @notice Transfers `amount` tokens from `sender` to `recipient` up to the allowance given to the `msg.sender`\n /// @param sender The account from which the transfer will be initiated\n /// @param recipient The recipient of the transfer\n /// @param amount The amount of the transfer\n /// @return Returns true for a successful transfer, false for unsuccessful\n function transferFrom(\n address sender,\n address recipient,\n uint256 amount\n ) external returns (bool);\n\n /// @notice Event emitted when tokens are transferred from one address to another, either via `#transfer` or `#transferFrom`.\n /// @param from The account from which the tokens were sent, i.e. the balance decreased\n /// @param to The account to which the tokens were sent, i.e. the balance increased\n /// @param value The amount of tokens that were transferred\n event Transfer(address indexed from, address indexed to, uint256 value);\n\n /// @notice Event emitted when the approval amount for the spender of a given owner's tokens changes.\n /// @param owner The account that approved spending of its tokens\n /// @param spender The account for which the spending allowance was modified\n /// @param value The new allowance from the owner to the spender\n event Approval(address indexed owner, address indexed spender, uint256 value);\n}\n" - } - }, - "settings": { - "optimizer": { - "enabled": true, - "runs": 33 - }, - "outputSelection": { - "*": { - "*": [ - "storageLayout", - "abi", - "evm.bytecode", - "evm.deployedBytecode", - "evm.methodIdentifiers", - "metadata", - "devdoc", - "userdoc", - "evm.gasEstimates" - ], - "": [ - "ast" - ] - } - }, - "metadata": { - "useLiteralContent": true - }, - "libraries": { - "": { - "__CACHE_BREAKER__": "0x00000000d41867734bbee4c6863d9255b2b06ac1" - } - } - } -} \ No newline at end of file diff --git a/deployments/goerli/solcInputs/a2dd8c00aab95ba5d841446478d867fa.json b/deployments/goerli/solcInputs/a2dd8c00aab95ba5d841446478d867fa.json deleted file mode 100644 index c8e151f..0000000 --- a/deployments/goerli/solcInputs/a2dd8c00aab95ba5d841446478d867fa.json +++ /dev/null @@ -1,337 +0,0 @@ -{ - "language": "Solidity", - "sources": { - "solidity/contracts/Keep3r.sol": { - "content": "// SPDX-License-Identifier: MIT\n\n/*\n\nCoded for The Keep3r Network with ♥ by\n\n██████╗░███████╗███████╗██╗  ░██╗░░░░░░░██╗░█████╗░███╗░░██╗██████╗░███████╗██████╗░██╗░░░░░░█████╗░███╗░░██╗██████╗░\n██╔══██╗██╔════╝██╔════╝██║  ░██║░░██╗░░██║██╔══██╗████╗░██║██╔══██╗██╔════╝██╔══██╗██║░░░░░██╔══██╗████╗░██║██╔══██╗\n██║░░██║█████╗░░█████╗░░██║  ░╚██╗████╗██╔╝██║░░██║██╔██╗██║██║░░██║█████╗░░██████╔╝██║░░░░░███████║██╔██╗██║██║░░██║\n██║░░██║██╔══╝░░██╔══╝░░██║  ░░████╔═████║░██║░░██║██║╚████║██║░░██║██╔══╝░░██╔══██╗██║░░░░░██╔══██║██║╚████║██║░░██║\n██████╔╝███████╗██║░░░░░██║  ░░╚██╔╝░╚██╔╝░╚█████╔╝██║░╚███║██████╔╝███████╗██║░░██║███████╗██║░░██║██║░╚███║██████╔╝\n╚═════╝░╚══════╝╚═╝░░░░░╚═╝  ░░░╚═╝░░░╚═╝░░░╚════╝░╚═╝░░╚══╝╚═════╝░╚══════╝╚═╝░░╚═╝╚══════╝╚═╝░░╚═╝╚═╝░░╚══╝╚═════╝░\n\nhttps://defi.sucks\n\n*/\n\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../interfaces/IKeep3r.sol';\nimport './peripherals/jobs/Keep3rJobs.sol';\nimport './peripherals/keepers/Keep3rKeepers.sol';\nimport './peripherals/DustCollector.sol';\n\ncontract Keep3r is IKeep3r, Keep3rJobs, Keep3rKeepers {\n constructor(\n address _governance,\n address _keep3rHelper,\n address _keep3rV1,\n address _keep3rV1Proxy\n ) Keep3rParameters(_keep3rHelper, _keep3rV1, _keep3rV1Proxy) Keep3rRoles(_governance) {}\n}\n" - }, - "solidity/interfaces/IKeep3r.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport './peripherals/IKeep3rJobs.sol';\nimport './peripherals/IKeep3rKeepers.sol';\nimport './peripherals/IKeep3rParameters.sol';\n\n// solhint-disable-next-line no-empty-blocks\n\n/// @title Keep3rV2 contract\n/// @notice This contract inherits all the functionality of Keep3rV2\ninterface IKeep3r is IKeep3rJobs, IKeep3rKeepers, IKeep3rParameters {\n\n}\n" - }, - "solidity/contracts/peripherals/jobs/Keep3rJobs.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../../../interfaces/peripherals/IKeep3rJobs.sol';\nimport './Keep3rJobManager.sol';\nimport './Keep3rJobWorkable.sol';\nimport './Keep3rJobDisputable.sol';\n\nabstract contract Keep3rJobs is IKeep3rJobs, Keep3rJobManager, Keep3rJobWorkable, Keep3rJobDisputable {}\n" - }, - "solidity/contracts/peripherals/keepers/Keep3rKeepers.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../../../interfaces/peripherals/IKeep3rKeepers.sol';\nimport './Keep3rKeeperDisputable.sol';\n\nabstract contract Keep3rKeepers is IKeep3rKeepers, Keep3rKeeperDisputable {}\n" - }, - "solidity/contracts/peripherals/DustCollector.sol": { - "content": "// SPDX-License-Identifier: MIT\n\npragma solidity >=0.8.4 <0.9.0;\n\nimport '@openzeppelin/contracts/token/ERC20/IERC20.sol';\nimport '@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol';\nimport '../../contracts/peripherals/Governable.sol';\nimport '../../interfaces/peripherals/IDustCollector.sol';\n\nabstract contract DustCollector is IDustCollector, Governable {\n using SafeERC20 for IERC20;\n\n address internal constant _ETH_ADDRESS = 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE;\n\n function sendDust(\n address _token,\n uint256 _amount,\n address _to\n ) external override onlyGovernance {\n if (_to == address(0)) revert ZeroAddress();\n if (_token == _ETH_ADDRESS) {\n payable(_to).transfer(_amount);\n } else {\n IERC20(_token).safeTransfer(_to, _amount);\n }\n emit DustSent(_token, _amount, _to);\n }\n}\n" - }, - "solidity/interfaces/peripherals/IKeep3rJobs.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport './IKeep3rDisputable.sol';\n\n/// @title Keep3rJobOwnership contract\n/// @notice Handles the ownership of the jobs\ninterface IKeep3rJobOwnership {\n // Events\n\n /// @notice Emitted when Keep3rJobOwnership#changeJobOwnership is called\n /// @param _job The address of the job proposed to have a change of owner\n /// @param _owner The current owner of the job\n /// @param _pendingOwner The new address proposed to be the owner of the job\n event JobOwnershipChange(address indexed _job, address indexed _owner, address indexed _pendingOwner);\n\n /// @notice Emitted when Keep3rJobOwnership#JobOwnershipAssent is called\n /// @param _job The address of the job which the proposed owner will now own\n /// @param _previousOwner The previous owner of the job\n /// @param _newOwner The new owner of the job\n event JobOwnershipAssent(address indexed _job, address indexed _previousOwner, address indexed _newOwner);\n\n // Errors\n\n /// @notice Throws when the caller of the function is not the job owner\n error OnlyJobOwner();\n\n /// @notice Throws when the caller of the function is not the pending job owner\n error OnlyPendingJobOwner();\n\n // Variables\n\n /// @notice Maps the job to the owner of the job\n /// @param _job The address of the job\n /// @return _owner The address of the owner of the job\n function jobOwner(address _job) external view returns (address _owner);\n\n /// @notice Maps the job to its pending owner\n /// @param _job The address of the job\n /// @return _pendingOwner The address of the pending owner of the job\n function jobPendingOwner(address _job) external view returns (address _pendingOwner);\n\n // Methods\n\n /// @notice Proposes a new address to be the owner of the job\n /// @param _job The address of the job\n /// @param _newOwner The address of the proposed new owner\n function changeJobOwnership(address _job, address _newOwner) external;\n\n /// @notice The proposed address accepts to be the owner of the job\n /// @param _job The address of the job\n function acceptJobOwnership(address _job) external;\n}\n\n/// @title Keep3rJobManager contract\n/// @notice Handles the addition and withdrawal of credits from a job\ninterface IKeep3rJobManager is IKeep3rJobOwnership {\n // Events\n\n /// @notice Emitted when Keep3rJobManager#addJob is called\n /// @param _job The address of the job to add\n /// @param _jobOwner The job's owner\n event JobAddition(address indexed _job, address indexed _jobOwner);\n\n // Errors\n\n /// @notice Throws when trying to add a job that has already been added\n error JobAlreadyAdded();\n\n /// @notice Throws when the address that is trying to register as a keeper is already a keeper\n error AlreadyAKeeper();\n\n // Methods\n\n /// @notice Allows any caller to add a new job\n /// @param _job Address of the contract for which work should be performed\n function addJob(address _job) external;\n}\n\n/// @title Keep3rJobFundableCredits contract\n/// @notice Handles the addition and withdrawal of credits from a job\ninterface IKeep3rJobFundableCredits is IKeep3rJobOwnership {\n // Events\n\n /// @notice Emitted when Keep3rJobFundableCredits#addTokenCreditsToJob is called\n /// @param _job The address of the job being credited\n /// @param _token The address of the token being provided\n /// @param _provider The user that calls the function\n /// @param _amount The amount of credit being added to the job\n event TokenCreditAddition(address indexed _job, address indexed _token, address indexed _provider, uint256 _amount);\n\n /// @notice Emitted when Keep3rJobFundableCredits#withdrawTokenCreditsFromJob is called\n /// @param _job The address of the job from which the credits are withdrawn\n /// @param _token The credit being withdrawn from the job\n /// @param _receiver The user that receives the tokens\n /// @param _amount The amount of credit withdrawn\n event TokenCreditWithdrawal(address indexed _job, address indexed _token, address indexed _receiver, uint256 _amount);\n\n // Errors\n\n /// @notice Throws when the token is KP3R, as it should not be used for direct token payments\n error TokenUnallowed();\n\n /// @notice Throws when the token withdraw cooldown has not yet passed\n error JobTokenCreditsLocked();\n\n /// @notice Throws when the user tries to withdraw more tokens than it has\n error InsufficientJobTokenCredits();\n\n // Variables\n\n /// @notice Last block where tokens were added to the job\n /// @param _job The address of the job credited\n /// @param _token The address of the token credited\n /// @return _timestamp The last block where tokens were added to the job\n function jobTokenCreditsAddedAt(address _job, address _token) external view returns (uint256 _timestamp);\n\n // Methods\n\n /// @notice Add credit to a job to be paid out for work\n /// @param _job The address of the job being credited\n /// @param _token The address of the token being credited\n /// @param _amount The amount of credit being added\n function addTokenCreditsToJob(\n address _job,\n address _token,\n uint256 _amount\n ) external;\n\n /// @notice Withdraw credit from a job\n /// @param _job The address of the job from which the credits are withdrawn\n /// @param _token The address of the token being withdrawn\n /// @param _amount The amount of token to be withdrawn\n /// @param _receiver The user that will receive tokens\n function withdrawTokenCreditsFromJob(\n address _job,\n address _token,\n uint256 _amount,\n address _receiver\n ) external;\n}\n\n/// @title Keep3rJobFundableLiquidity contract\n/// @notice Handles the funding of jobs through specific liquidity pairs\ninterface IKeep3rJobFundableLiquidity is IKeep3rJobOwnership {\n // Events\n\n /// @notice Emitted when Keep3rJobFundableLiquidity#approveLiquidity function is called\n /// @param _liquidity The address of the liquidity pair being approved\n event LiquidityApproval(address _liquidity);\n\n /// @notice Emitted when Keep3rJobFundableLiquidity#revokeLiquidity function is called\n /// @param _liquidity The address of the liquidity pair being revoked\n event LiquidityRevocation(address _liquidity);\n\n /// @notice Emitted when IKeep3rJobFundableLiquidity#addLiquidityToJob function is called\n /// @param _job The address of the job to which liquidity will be added\n /// @param _liquidity The address of the liquidity being added\n /// @param _provider The user that calls the function\n /// @param _amount The amount of liquidity being added\n event LiquidityAddition(address indexed _job, address indexed _liquidity, address indexed _provider, uint256 _amount);\n\n /// @notice Emitted when IKeep3rJobFundableLiquidity#withdrawLiquidityFromJob function is called\n /// @param _job The address of the job of which liquidity will be withdrawn from\n /// @param _liquidity The address of the liquidity being withdrawn\n /// @param _receiver The receiver of the liquidity tokens\n /// @param _amount The amount of liquidity being withdrawn from the job\n event LiquidityWithdrawal(address indexed _job, address indexed _liquidity, address indexed _receiver, uint256 _amount);\n\n /// @notice Emitted when Keep3rJobFundableLiquidity#addLiquidityToJob function is called\n /// @param _job The address of the job whose credits will be updated\n /// @param _rewardedAt The time at which the job was last rewarded\n /// @param _currentCredits The current credits of the job\n /// @param _periodCredits The credits of the job for the current period\n event LiquidityCreditsReward(address indexed _job, uint256 _rewardedAt, uint256 _currentCredits, uint256 _periodCredits);\n\n /// @notice Emitted when Keep3rJobFundableLiquidity#forceLiquidityCreditsToJob function is called\n /// @param _job The address of the job whose credits will be updated\n /// @param _rewardedAt The time at which the job was last rewarded\n /// @param _currentCredits The current credits of the job\n event LiquidityCreditsForced(address indexed _job, uint256 _rewardedAt, uint256 _currentCredits);\n\n // Errors\n\n /// @notice Throws when the liquidity being approved has already been approved\n error LiquidityPairApproved();\n\n /// @notice Throws when the liquidity being removed has not been approved\n error LiquidityPairUnexistent();\n\n /// @notice Throws when trying to add liquidity to an unapproved pool\n error LiquidityPairUnapproved();\n\n /// @notice Throws when the job doesn't have the requested liquidity\n error JobLiquidityUnexistent();\n\n /// @notice Throws when trying to remove more liquidity than the job has\n error JobLiquidityInsufficient();\n\n /// @notice Throws when trying to add less liquidity than the minimum liquidity required\n error JobLiquidityLessThanMin();\n\n // Structs\n\n /// @notice Stores the tick information of the different liquidity pairs\n struct TickCache {\n int56 current; // Tracks the current tick\n int56 difference; // Stores the difference between the current tick and the last tick\n uint256 period; // Stores the period at which the last observation was made\n }\n\n // Variables\n\n /// @notice Lists liquidity pairs\n /// @return _list An array of addresses with all the approved liquidity pairs\n function approvedLiquidities() external view returns (address[] memory _list);\n\n /// @notice Amount of liquidity in a specified job\n /// @param _job The address of the job being checked\n /// @param _liquidity The address of the liquidity we are checking\n /// @return _amount Amount of liquidity in the specified job\n function liquidityAmount(address _job, address _liquidity) external view returns (uint256 _amount);\n\n /// @notice Last time the job was rewarded liquidity credits\n /// @param _job The address of the job being checked\n /// @return _timestamp Timestamp of the last time the job was rewarded liquidity credits\n function rewardedAt(address _job) external view returns (uint256 _timestamp);\n\n /// @notice Last time the job was worked\n /// @param _job The address of the job being checked\n /// @return _timestamp Timestamp of the last time the job was worked\n function workedAt(address _job) external view returns (uint256 _timestamp);\n\n // Methods\n\n /// @notice Returns the liquidity credits of a given job\n /// @param _job The address of the job of which we want to know the liquidity credits\n /// @return _amount The liquidity credits of a given job\n function jobLiquidityCredits(address _job) external view returns (uint256 _amount);\n\n /// @notice Returns the credits of a given job for the current period\n /// @param _job The address of the job of which we want to know the period credits\n /// @return _amount The credits the given job has at the current period\n function jobPeriodCredits(address _job) external view returns (uint256 _amount);\n\n /// @notice Calculates the total credits of a given job\n /// @param _job The address of the job of which we want to know the total credits\n /// @return _amount The total credits of the given job\n function totalJobCredits(address _job) external view returns (uint256 _amount);\n\n /// @notice Calculates how many credits should be rewarded periodically for a given liquidity amount\n /// @dev _periodCredits = underlying KP3Rs for given liquidity amount * rewardPeriod / inflationPeriod\n /// @param _liquidity The address of the liquidity to provide\n /// @param _amount The amount of liquidity to provide\n /// @return _periodCredits The amount of KP3R periodically minted for the given liquidity\n function quoteLiquidity(address _liquidity, uint256 _amount) external view returns (uint256 _periodCredits);\n\n /// @notice Observes the current state of the liquidity pair being observed and updates TickCache with the information\n /// @param _liquidity The address of the liquidity pair being observed\n /// @return _tickCache The updated TickCache\n function observeLiquidity(address _liquidity) external view returns (TickCache memory _tickCache);\n\n /// @notice Gifts liquidity credits to the specified job\n /// @param _job The address of the job being credited\n /// @param _amount The amount of liquidity credits to gift\n function forceLiquidityCreditsToJob(address _job, uint256 _amount) external;\n\n /// @notice Approve a liquidity pair for being accepted in future\n /// @param _liquidity The address of the liquidity accepted\n function approveLiquidity(address _liquidity) external;\n\n /// @notice Revoke a liquidity pair from being accepted in future\n /// @param _liquidity The liquidity no longer accepted\n function revokeLiquidity(address _liquidity) external;\n\n /// @notice Allows anyone to fund a job with liquidity\n /// @param _job The address of the job to assign liquidity to\n /// @param _liquidity The liquidity being added\n /// @param _amount The amount of liquidity tokens to add\n function addLiquidityToJob(\n address _job,\n address _liquidity,\n uint256 _amount\n ) external;\n\n /// @notice Unbond liquidity for a job\n /// @dev Can only be called by the job's owner\n /// @param _job The address of the job being unbonded from\n /// @param _liquidity The liquidity being unbonded\n /// @param _amount The amount of liquidity being removed\n function unbondLiquidityFromJob(\n address _job,\n address _liquidity,\n uint256 _amount\n ) external;\n\n /// @notice Withdraw liquidity from a job\n /// @param _job The address of the job being withdrawn from\n /// @param _liquidity The liquidity being withdrawn\n /// @param _receiver The address that will receive the withdrawn liquidity\n function withdrawLiquidityFromJob(\n address _job,\n address _liquidity,\n address _receiver\n ) external;\n}\n\n/// @title Keep3rJobMigration contract\n/// @notice Handles the migration process of jobs to different addresses\ninterface IKeep3rJobMigration is IKeep3rJobFundableCredits, IKeep3rJobFundableLiquidity {\n // Events\n\n /// @notice Emitted when Keep3rJobMigration#migrateJob function is called\n /// @param _fromJob The address of the job that requests to migrate\n /// @param _toJob The address at which the job requests to migrate\n event JobMigrationRequested(address indexed _fromJob, address _toJob);\n\n /// @notice Emitted when Keep3rJobMigration#acceptJobMigration function is called\n /// @param _fromJob The address of the job that requested to migrate\n /// @param _toJob The address at which the job had requested to migrate\n event JobMigrationSuccessful(address _fromJob, address indexed _toJob);\n\n // Errors\n\n /// @notice Throws when the address of the job that requests to migrate wants to migrate to its same address\n error JobMigrationImpossible();\n\n /// @notice Throws when the _toJob address differs from the address being tracked in the pendingJobMigrations mapping\n error JobMigrationUnavailable();\n\n /// @notice Throws when cooldown between migrations has not yet passed\n error JobMigrationLocked();\n\n // Variables\n\n /// @notice Maps the jobs that have requested a migration to the address they have requested to migrate to\n /// @return _toJob The address to which the job has requested to migrate to\n function pendingJobMigrations(address _fromJob) external view returns (address _toJob);\n\n // Methods\n\n /// @notice Initializes the migration process for a job by adding the request to the pendingJobMigrations mapping\n /// @param _fromJob The address of the job that is requesting to migrate\n /// @param _toJob The address at which the job is requesting to migrate\n function migrateJob(address _fromJob, address _toJob) external;\n\n /// @notice Completes the migration process for a job\n /// @dev Unbond/withdraw process doesn't get migrated\n /// @param _fromJob The address of the job that requested to migrate\n /// @param _toJob The address to which the job wants to migrate to\n function acceptJobMigration(address _fromJob, address _toJob) external;\n}\n\n/// @title Keep3rJobWorkable contract\n/// @notice Handles the mechanisms jobs can pay keepers with along with the restrictions jobs can put on keepers before they can work on jobs\ninterface IKeep3rJobWorkable is IKeep3rJobMigration {\n // Events\n\n /// @notice Emitted when a keeper is validated before a job\n /// @param _gasLeft The amount of gas that the transaction has left at the moment of keeper validation\n event KeeperValidation(uint256 _gasLeft);\n\n /// @notice Emitted when a keeper works a job\n /// @param _credit The address of the asset in which the keeper is paid\n /// @param _job The address of the job the keeper has worked\n /// @param _keeper The address of the keeper that has worked the job\n /// @param _payment The amount that has been paid out to the keeper in exchange for working the job\n /// @param _gasLeft The amount of gas that the transaction has left at the moment of payment\n event KeeperWork(address indexed _credit, address indexed _job, address indexed _keeper, uint256 _payment, uint256 _gasLeft);\n\n // Errors\n\n /// @notice Throws if work method was called without calling isKeeper or isBondedKeeper\n error GasNotInitialized();\n\n /// @notice Throws if the address claiming to be a job is not in the list of approved jobs\n error JobUnapproved();\n\n /// @notice Throws if the amount of funds in the job is less than the payment that must be paid to the keeper that works that job\n error InsufficientFunds();\n\n // Methods\n\n /// @notice Confirms if the current keeper is registered\n /// @dev Can be used for general (non critical) functions\n /// @param _keeper The keeper being investigated\n /// @return _isKeeper Whether the address passed as a parameter is a keeper or not\n function isKeeper(address _keeper) external returns (bool _isKeeper);\n\n /// @notice Confirms if the current keeper is registered and has a minimum bond of any asset.\n /// @dev Should be used for protected functions\n /// @param _keeper The keeper to check\n /// @param _bond The bond token being evaluated\n /// @param _minBond The minimum amount of bonded tokens\n /// @param _earned The minimum funds earned in the keepers lifetime\n /// @param _age The minimum keeper age required\n /// @return _isBondedKeeper Whether the `_keeper` meets the given requirements\n function isBondedKeeper(\n address _keeper,\n address _bond,\n uint256 _minBond,\n uint256 _earned,\n uint256 _age\n ) external returns (bool _isBondedKeeper);\n\n /// @notice Implemented by jobs to show that a keeper performed work\n /// @dev Automatically calculates the payment for the keeper and pays the keeper with bonded KP3R\n /// @param _keeper Address of the keeper that performed the work\n function worked(address _keeper) external;\n\n /// @notice Implemented by jobs to show that a keeper performed work\n /// @dev Pays the keeper that performs the work with KP3R\n /// @param _keeper Address of the keeper that performed the work\n /// @param _payment The reward that should be allocated for the job\n function bondedPayment(address _keeper, uint256 _payment) external;\n\n /// @notice Implemented by jobs to show that a keeper performed work\n /// @dev Pays the keeper that performs the work with a specific token\n /// @param _token The asset being awarded to the keeper\n /// @param _keeper Address of the keeper that performed the work\n /// @param _amount The reward that should be allocated\n function directTokenPayment(\n address _token,\n address _keeper,\n uint256 _amount\n ) external;\n}\n\n/// @title Keep3rJobDisputable contract\n/// @notice Handles the actions that can be taken on a disputed job\ninterface IKeep3rJobDisputable is IKeep3rDisputable, IKeep3rJobFundableCredits, IKeep3rJobFundableLiquidity {\n // Events\n\n /// @notice Emitted when Keep3rJobDisputable#slashTokenFromJob is called\n /// @param _job The address of the job from which the token will be slashed\n /// @param _token The address of the token being slashed\n /// @param _slasher The user that slashes the token\n /// @param _amount The amount of the token being slashed\n event JobSlashToken(address indexed _job, address _token, address indexed _slasher, uint256 _amount);\n\n /// @notice Emitted when Keep3rJobDisputable#slashLiquidityFromJob is called\n /// @param _job The address of the job from which the liquidity will be slashed\n /// @param _liquidity The address of the liquidity being slashed\n /// @param _slasher The user that slashes the liquidity\n /// @param _amount The amount of the liquidity being slashed\n event JobSlashLiquidity(address indexed _job, address _liquidity, address indexed _slasher, uint256 _amount);\n\n // Errors\n\n /// @notice Throws when the token trying to be slashed doesn't exist\n error JobTokenUnexistent();\n\n /// @notice Throws when someone tries to slash more tokens than the job has\n error JobTokenInsufficient();\n\n // Methods\n\n /// @notice Allows governance or slasher to slash a job specific token\n /// @param _job The address of the job from which the token will be slashed\n /// @param _token The address of the token that will be slashed\n /// @param _amount The amount of the token that will be slashed\n function slashTokenFromJob(\n address _job,\n address _token,\n uint256 _amount\n ) external;\n\n /// @notice Allows governance or a slasher to slash liquidity from a job\n /// @param _job The address being slashed\n /// @param _liquidity The address of the liquidity that will be slashed\n /// @param _amount The amount of liquidity that will be slashed\n function slashLiquidityFromJob(\n address _job,\n address _liquidity,\n uint256 _amount\n ) external;\n}\n\n// solhint-disable-next-line no-empty-blocks\ninterface IKeep3rJobs is IKeep3rJobWorkable, IKeep3rJobManager, IKeep3rJobDisputable {\n\n}\n" - }, - "solidity/interfaces/peripherals/IKeep3rKeepers.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport './IKeep3rDisputable.sol';\n\n/// @title Keep3rKeeperFundable contract\n/// @notice Handles the actions required to become a keeper\ninterface IKeep3rKeeperFundable {\n // Events\n\n /// @notice Emitted when Keep3rKeeperFundable#activate is called\n /// @param _keeper The keeper that has been activated\n /// @param _bond The asset the keeper has bonded\n /// @param _amount The amount of the asset the keeper has bonded\n event Activation(address indexed _keeper, address indexed _bond, uint256 _amount);\n\n /// @notice Emitted when Keep3rKeeperFundable#withdraw is called\n /// @param _keeper The caller of Keep3rKeeperFundable#withdraw function\n /// @param _bond The asset to withdraw from the bonding pool\n /// @param _amount The amount of funds withdrawn\n event Withdrawal(address indexed _keeper, address indexed _bond, uint256 _amount);\n\n // Errors\n\n /// @notice Throws when the address that is trying to register as a job is already a job\n error AlreadyAJob();\n\n // Methods\n\n /// @notice Beginning of the bonding process\n /// @param _bonding The asset being bonded\n /// @param _amount The amount of bonding asset being bonded\n function bond(address _bonding, uint256 _amount) external;\n\n /// @notice Beginning of the unbonding process\n /// @param _bonding The asset being unbonded\n /// @param _amount Allows for partial unbonding\n function unbond(address _bonding, uint256 _amount) external;\n\n /// @notice End of the bonding process after bonding time has passed\n /// @param _bonding The asset being activated as bond collateral\n function activate(address _bonding) external;\n\n /// @notice Withdraw funds after unbonding has finished\n /// @param _bonding The asset to withdraw from the bonding pool\n function withdraw(address _bonding) external;\n}\n\n/// @title Keep3rKeeperDisputable contract\n/// @notice Handles the actions that can be taken on a disputed keeper\ninterface IKeep3rKeeperDisputable is IKeep3rDisputable, IKeep3rKeeperFundable {\n // Events\n\n /// @notice Emitted when Keep3rKeeperDisputable#slash is called\n /// @param _keeper The address of the slashed keeper\n /// @param _slasher The user that called Keep3rKeeperDisputable#slash\n /// @param _amount The amount of credits slashed from the keeper\n event KeeperSlash(address indexed _keeper, address indexed _slasher, uint256 _amount);\n\n /// @notice Emitted when Keep3rKeeperDisputable#revoke is called\n /// @param _keeper The address of the revoked keeper\n /// @param _slasher The user that called Keep3rKeeperDisputable#revoke\n event KeeperRevoke(address indexed _keeper, address indexed _slasher);\n\n // Methods\n\n /// @notice Allows governance to slash a keeper based on a dispute\n /// @param _keeper The address being slashed\n /// @param _bonded The asset being slashed\n /// @param _bondAmount The bonded amount being slashed\n /// @param _unbondAmount The pending unbond amount being slashed\n function slash(\n address _keeper,\n address _bonded,\n uint256 _bondAmount,\n uint256 _unbondAmount\n ) external;\n\n /// @notice Blacklists a keeper from participating in the network\n /// @param _keeper The address being slashed\n function revoke(address _keeper) external;\n}\n\n// solhint-disable-next-line no-empty-blocks\n\n/// @title Keep3rKeepers contract\ninterface IKeep3rKeepers is IKeep3rKeeperDisputable {\n\n}\n" - }, - "solidity/interfaces/peripherals/IKeep3rParameters.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport './IKeep3rAccountance.sol';\n\n/// @title Keep3rParameters contract\n/// @notice Handles and sets all the required parameters for Keep3r\ninterface IKeep3rParameters is IKeep3rAccountance {\n // Events\n\n /// @notice Emitted when the Keep3rHelper address is changed\n /// @param _keep3rHelper The address of Keep3rHelper's contract\n event Keep3rHelperChange(address _keep3rHelper);\n\n /// @notice Emitted when the Keep3rV1 address is changed\n /// @param _keep3rV1 The address of Keep3rV1's contract\n event Keep3rV1Change(address _keep3rV1);\n\n /// @notice Emitted when the Keep3rV1Proxy address is changed\n /// @param _keep3rV1Proxy The address of Keep3rV1Proxy's contract\n event Keep3rV1ProxyChange(address _keep3rV1Proxy);\n\n /// @notice Emitted when bondTime is changed\n /// @param _bondTime The new bondTime\n event BondTimeChange(uint256 _bondTime);\n\n /// @notice Emitted when _liquidityMinimum is changed\n /// @param _liquidityMinimum The new _liquidityMinimum\n event LiquidityMinimumChange(uint256 _liquidityMinimum);\n\n /// @notice Emitted when _unbondTime is changed\n /// @param _unbondTime The new _unbondTime\n event UnbondTimeChange(uint256 _unbondTime);\n\n /// @notice Emitted when _rewardPeriodTime is changed\n /// @param _rewardPeriodTime The new _rewardPeriodTime\n event RewardPeriodTimeChange(uint256 _rewardPeriodTime);\n\n /// @notice Emitted when the inflationPeriod is changed\n /// @param _inflationPeriod The new inflationPeriod\n event InflationPeriodChange(uint256 _inflationPeriod);\n\n /// @notice Emitted when the fee is changed\n /// @param _fee The new token credits fee\n event FeeChange(uint256 _fee);\n\n // Variables\n\n /// @notice Address of Keep3rHelper's contract\n /// @return _keep3rHelper The address of Keep3rHelper's contract\n function keep3rHelper() external view returns (address _keep3rHelper);\n\n /// @notice Address of Keep3rV1's contract\n /// @return _keep3rV1 The address of Keep3rV1's contract\n function keep3rV1() external view returns (address _keep3rV1);\n\n /// @notice Address of Keep3rV1Proxy's contract\n /// @return _keep3rV1Proxy The address of Keep3rV1Proxy's contract\n function keep3rV1Proxy() external view returns (address _keep3rV1Proxy);\n\n /// @notice The amount of time required to pass after a keeper has bonded assets for it to be able to activate\n /// @return _days The required bondTime in days\n function bondTime() external view returns (uint256 _days);\n\n /// @notice The amount of time required to pass before a keeper can unbond what he has bonded\n /// @return _days The required unbondTime in days\n function unbondTime() external view returns (uint256 _days);\n\n /// @notice The minimum amount of liquidity required to fund a job per liquidity\n /// @return _amount The minimum amount of liquidity in KP3R\n function liquidityMinimum() external view returns (uint256 _amount);\n\n /// @notice The amount of time between each scheduled credits reward given to a job\n /// @return _days The reward period in days\n function rewardPeriodTime() external view returns (uint256 _days);\n\n /// @notice The inflation period is the denominator used to regulate the emission of KP3R\n /// @return _period The denominator used to regulate the emission of KP3R\n function inflationPeriod() external view returns (uint256 _period);\n\n /// @notice The fee to be sent to governance when a user adds liquidity to a job\n /// @return _amount The fee amount to be sent to governance when a user adds liquidity to a job\n function fee() external view returns (uint256 _amount);\n\n // Errors\n\n /// @notice Throws if the reward period is less than the minimum reward period time\n error MinRewardPeriod();\n\n /// @notice Throws if either a job or a keeper is disputed\n error Disputed();\n\n /// @notice Throws if there are no bonded assets\n error BondsUnexistent();\n\n /// @notice Throws if the time required to bond an asset has not passed yet\n error BondsLocked();\n\n /// @notice Throws if there are no bonds to withdraw\n error UnbondsUnexistent();\n\n /// @notice Throws if the time required to withdraw the bonds has not passed yet\n error UnbondsLocked();\n\n // Methods\n\n /// @notice Sets the Keep3rHelper address\n /// @param _keep3rHelper The Keep3rHelper address\n function setKeep3rHelper(address _keep3rHelper) external;\n\n /// @notice Sets the Keep3rV1 address\n /// @param _keep3rV1 The Keep3rV1 address\n function setKeep3rV1(address _keep3rV1) external;\n\n /// @notice Sets the Keep3rV1Proxy address\n /// @param _keep3rV1Proxy The Keep3rV1Proxy address\n function setKeep3rV1Proxy(address _keep3rV1Proxy) external;\n\n /// @notice Sets the bond time required to activate as a keeper\n /// @param _bond The new bond time\n function setBondTime(uint256 _bond) external;\n\n /// @notice Sets the unbond time required unbond what has been bonded\n /// @param _unbond The new unbond time\n function setUnbondTime(uint256 _unbond) external;\n\n /// @notice Sets the minimum amount of liquidity required to fund a job\n /// @param _liquidityMinimum The new minimum amount of liquidity\n function setLiquidityMinimum(uint256 _liquidityMinimum) external;\n\n /// @notice Sets the time required to pass between rewards for jobs\n /// @param _rewardPeriodTime The new amount of time required to pass between rewards\n function setRewardPeriodTime(uint256 _rewardPeriodTime) external;\n\n /// @notice Sets the new inflation period\n /// @param _inflationPeriod The new inflation period\n function setInflationPeriod(uint256 _inflationPeriod) external;\n\n /// @notice Sets the new fee\n /// @param _fee The new fee\n function setFee(uint256 _fee) external;\n}\n" - }, - "solidity/interfaces/peripherals/IKeep3rDisputable.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\n/// @title Keep3rDisputable contract\n/// @notice Creates/resolves disputes for jobs or keepers\n/// A disputed keeper is slashable and is not able to bond, activate, withdraw or receive direct payments\n/// A disputed job is slashable and is not able to pay the keepers, withdraw tokens or to migrate\ninterface IKeep3rDisputable {\n /// @notice Emitted when a keeper or a job is disputed\n /// @param _jobOrKeeper The address of the disputed keeper/job\n /// @param _disputer The user that called the function and disputed the keeper\n event Dispute(address indexed _jobOrKeeper, address indexed _disputer);\n\n /// @notice Emitted when a dispute is resolved\n /// @param _jobOrKeeper The address of the disputed keeper/job\n /// @param _resolver The user that called the function and resolved the dispute\n event Resolve(address indexed _jobOrKeeper, address indexed _resolver);\n\n /// @notice Throws when a job or keeper is already disputed\n error AlreadyDisputed();\n\n /// @notice Throws when a job or keeper is not disputed and someone tries to resolve the dispute\n error NotDisputed();\n\n /// @notice Allows governance to create a dispute for a given keeper/job\n /// @param _jobOrKeeper The address in dispute\n function dispute(address _jobOrKeeper) external;\n\n /// @notice Allows governance to resolve a dispute on a keeper/job\n /// @param _jobOrKeeper The address cleared\n function resolve(address _jobOrKeeper) external;\n}\n" - }, - "solidity/interfaces/peripherals/IKeep3rAccountance.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport './IKeep3rRoles.sol';\n\n/// @title Keep3rDisputable contract\n/// @notice Disputes keepers, or if they're already disputed, it can resolve the case\n/// @dev Argument `bonding` can be the address of either a token or a liquidity\ninterface IKeep3rAccountance is IKeep3rRoles {\n // Events\n\n /// @notice Emitted when the bonding process of a new keeper begins\n /// @param _keeper The caller of Keep3rKeeperFundable#bond function\n /// @param _bonding The asset the keeper has bonded\n /// @param _amount The amount the keeper has bonded\n event Bonding(address indexed _keeper, address indexed _bonding, uint256 _amount);\n\n /// @notice Emitted when a keeper or job begins the unbonding process to withdraw the funds\n /// @param _keeperOrJob The keeper or job that began the unbonding process\n /// @param _unbonding The liquidity pair or asset being unbonded\n /// @param _amount The amount being unbonded\n event Unbonding(address indexed _keeperOrJob, address indexed _unbonding, uint256 _amount);\n\n // Variables\n\n /// @notice Tracks the total KP3R earnings of a keeper since it started working\n /// @param _keeper The address of the keeper\n /// @return _workCompleted Total KP3R earnings of a keeper since it started working\n function workCompleted(address _keeper) external view returns (uint256 _workCompleted);\n\n /// @notice Tracks when a keeper was first registered\n /// @param _keeper The address of the keeper\n /// @return timestamp The time at which the keeper was first registered\n function firstSeen(address _keeper) external view returns (uint256 timestamp);\n\n /// @notice Tracks if a keeper or job has a pending dispute\n /// @param _keeperOrJob The address of the keeper or job\n /// @return _disputed Whether a keeper or job has a pending dispute\n function disputes(address _keeperOrJob) external view returns (bool _disputed);\n\n /// @notice Tracks how much a keeper has bonded of a certain token\n /// @param _keeper The address of the keeper\n /// @param _bond The address of the token being bonded\n /// @return _bonds Amount of a certain token that a keeper has bonded\n function bonds(address _keeper, address _bond) external view returns (uint256 _bonds);\n\n /// @notice The current token credits available for a job\n /// @param _job The address of the job\n /// @param _token The address of the token bonded\n /// @return _amount The amount of token credits available for a job\n function jobTokenCredits(address _job, address _token) external view returns (uint256 _amount);\n\n /// @notice Tracks the amount of assets deposited in pending bonds\n /// @param _keeper The address of the keeper\n /// @param _bonding The address of the token being bonded\n /// @return _pendingBonds Amount of a certain asset a keeper has unbonding\n function pendingBonds(address _keeper, address _bonding) external view returns (uint256 _pendingBonds);\n\n /// @notice Tracks when a bonding for a keeper can be activated\n /// @param _keeper The address of the keeper\n /// @param _bonding The address of the token being bonded\n /// @return _timestamp Time at which the bonding for a keeper can be activated\n function canActivateAfter(address _keeper, address _bonding) external view returns (uint256 _timestamp);\n\n /// @notice Tracks when keeper bonds are ready to be withdrawn\n /// @param _keeper The address of the keeper\n /// @param _bonding The address of the token being unbonded\n /// @return _timestamp Time at which the keeper bonds are ready to be withdrawn\n function canWithdrawAfter(address _keeper, address _bonding) external view returns (uint256 _timestamp);\n\n /// @notice Tracks how much keeper bonds are to be withdrawn\n /// @param _keeper The address of the keeper\n /// @param _bonding The address of the token being unbonded\n /// @return _pendingUnbonds The amount of keeper bonds that are to be withdrawn\n function pendingUnbonds(address _keeper, address _bonding) external view returns (uint256 _pendingUnbonds);\n\n /// @notice Checks whether the address has ever bonded an asset\n /// @param _keeper The address of the keeper\n /// @return _hasBonded Whether the address has ever bonded an asset\n function hasBonded(address _keeper) external view returns (bool _hasBonded);\n\n // Methods\n\n /// @notice Lists all jobs\n /// @return _jobList Array with all the jobs in _jobs\n function jobs() external view returns (address[] memory _jobList);\n\n /// @notice Lists all keepers\n /// @return _keeperList Array with all the keepers in _keepers\n function keepers() external view returns (address[] memory _keeperList);\n\n // Errors\n\n /// @notice Throws when an address is passed as a job, but that address is not a job\n error JobUnavailable();\n\n /// @notice Throws when an action that requires an undisputed job is applied on a disputed job\n error JobDisputed();\n}\n" - }, - "solidity/interfaces/peripherals/IKeep3rRoles.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport './IBaseErrors.sol';\nimport './IGovernable.sol';\nimport './IDustCollector.sol';\n\n/// @title Keep3rRoles contract\n/// @notice Manages the Keep3r specific roles\ninterface IKeep3rRoles is IBaseErrors, IDustCollector, IGovernable {\n // Events\n\n /// @notice Emitted when a slasher is added\n /// @param _slasher Address of the added slasher\n event SlasherAdded(address _slasher);\n\n /// @notice Emitted when a slasher is removed\n /// @param _slasher Address of the removed slasher\n event SlasherRemoved(address _slasher);\n\n /// @notice Emitted when a disputer is added\n /// @param _disputer Address of the added disputer\n event DisputerAdded(address _disputer);\n\n /// @notice Emitted when a disputer is removed\n /// @param _disputer Address of the removed disputer\n event DisputerRemoved(address _disputer);\n\n // Variables\n\n /// @notice Tracks whether the address is a slasher or not\n /// @param _slasher Address being checked as a slasher\n /// @return _isSlasher Whether the address is a slasher or not\n function slashers(address _slasher) external view returns (bool _isSlasher);\n\n /// @notice Tracks whether the address is a disputer or not\n /// @param _disputer Address being checked as a disputer\n /// @return _isDisputer Whether the address is a disputer or not\n function disputers(address _disputer) external view returns (bool _isDisputer);\n\n // Errors\n\n /// @notice Throws if the address is already a registered slasher\n error SlasherExistent();\n\n /// @notice Throws if caller is not a registered slasher\n error SlasherUnexistent();\n\n /// @notice Throws if the address is already a registered disputer\n error DisputerExistent();\n\n /// @notice Throws if caller is not a registered disputer\n error DisputerUnexistent();\n\n /// @notice Throws if the msg.sender is not a slasher or is not a part of governance\n error OnlySlasher();\n\n /// @notice Throws if the msg.sender is not a disputer or is not a part of governance\n error OnlyDisputer();\n\n // Methods\n\n /// @notice Registers a slasher by updating the slashers mapping\n function addSlasher(address _slasher) external;\n\n /// @notice Removes a slasher by updating the slashers mapping\n function removeSlasher(address _slasher) external;\n\n /// @notice Registers a disputer by updating the disputers mapping\n function addDisputer(address _disputer) external;\n\n /// @notice Removes a disputer by updating the disputers mapping\n function removeDisputer(address _disputer) external;\n}\n" - }, - "solidity/interfaces/peripherals/IBaseErrors.sol": { - "content": "// SPDX-License-Identifier: MIT\n\npragma solidity >=0.8.4 <0.9.0;\n\ninterface IBaseErrors {\n /// @notice Throws if a variable is assigned to the zero address\n error ZeroAddress();\n}\n" - }, - "solidity/interfaces/peripherals/IGovernable.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\n/// @title Governable contract\n/// @notice Manages the governance role\ninterface IGovernable {\n // Events\n\n /// @notice Emitted when pendingGovernance accepts to be governance\n /// @param _governance Address of the new governance\n event GovernanceSet(address _governance);\n\n /// @notice Emitted when a new governance is proposed\n /// @param _pendingGovernance Address that is proposed to be the new governance\n event GovernanceProposal(address _pendingGovernance);\n\n // Errors\n\n /// @notice Throws if the caller of the function is not governance\n error OnlyGovernance();\n\n /// @notice Throws if the caller of the function is not pendingGovernance\n error OnlyPendingGovernance();\n\n /// @notice Throws if trying to set governance to zero address\n error NoGovernanceZeroAddress();\n\n // Variables\n\n /// @notice Stores the governance address\n /// @return _governance The governance addresss\n function governance() external view returns (address _governance);\n\n /// @notice Stores the pendingGovernance address\n /// @return _pendingGovernance The pendingGovernance addresss\n function pendingGovernance() external view returns (address _pendingGovernance);\n\n // Methods\n\n /// @notice Proposes a new address to be governance\n /// @param _governance The address being proposed as the new governance\n function setGovernance(address _governance) external;\n\n /// @notice Changes the governance from the current governance to the previously proposed address\n function acceptGovernance() external;\n}\n" - }, - "solidity/interfaces/peripherals/IDustCollector.sol": { - "content": "// SPDX-License-Identifier: MIT\n\npragma solidity >=0.8.4 <0.9.0;\n\nimport './IBaseErrors.sol';\n\ninterface IDustCollector is IBaseErrors {\n /// @notice Emitted when dust is sent\n /// @param _token The token that will be transferred\n /// @param _amount The amount of the token that will be transferred\n /// @param _to The address which will receive the funds\n event DustSent(address _token, uint256 _amount, address _to);\n\n /// @notice Allows an authorized user to transfer the tokens or eth that may have been left in a contract\n /// @param _token The token that will be transferred\n /// @param _amount The amount of the token that will be transferred\n /// @param _to The address that will receive the idle funds\n function sendDust(\n address _token,\n uint256 _amount,\n address _to\n ) external;\n}\n" - }, - "solidity/contracts/peripherals/jobs/Keep3rJobManager.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport './Keep3rJobOwnership.sol';\nimport '../Keep3rAccountance.sol';\nimport '../../../interfaces/peripherals/IKeep3rJobs.sol';\n\nabstract contract Keep3rJobManager is IKeep3rJobManager, Keep3rJobOwnership, Keep3rAccountance {\n using EnumerableSet for EnumerableSet.AddressSet;\n\n /// @inheritdoc IKeep3rJobManager\n function addJob(address _job) external override {\n if (_jobs.contains(_job)) revert JobAlreadyAdded();\n if (hasBonded[_job]) revert AlreadyAKeeper();\n _jobs.add(_job);\n jobOwner[_job] = msg.sender;\n emit JobAddition(_job, msg.sender);\n }\n}\n" - }, - "solidity/contracts/peripherals/jobs/Keep3rJobWorkable.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport './Keep3rJobMigration.sol';\nimport '../../../interfaces/IKeep3rHelper.sol';\nimport '../../../interfaces/peripherals/IKeep3rJobs.sol';\n\nimport '@openzeppelin/contracts/token/ERC20/IERC20.sol';\nimport '@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol';\n\nabstract contract Keep3rJobWorkable is IKeep3rJobWorkable, Keep3rJobMigration {\n using EnumerableSet for EnumerableSet.AddressSet;\n using SafeERC20 for IERC20;\n\n uint256 internal _initialGas;\n\n /// @inheritdoc IKeep3rJobWorkable\n function isKeeper(address _keeper) external override returns (bool _isKeeper) {\n _initialGas = _getGasLeft();\n if (_keepers.contains(_keeper)) {\n emit KeeperValidation(_initialGas);\n return true;\n }\n }\n\n /// @inheritdoc IKeep3rJobWorkable\n function isBondedKeeper(\n address _keeper,\n address _bond,\n uint256 _minBond,\n uint256 _earned,\n uint256 _age\n ) external override returns (bool _isBondedKeeper) {\n _initialGas = _getGasLeft();\n if (\n _keepers.contains(_keeper) &&\n bonds[_keeper][_bond] >= _minBond &&\n workCompleted[_keeper] >= _earned &&\n block.timestamp - firstSeen[_keeper] >= _age\n ) {\n emit KeeperValidation(_initialGas);\n return true;\n }\n }\n\n /// @inheritdoc IKeep3rJobWorkable\n function worked(address _keeper) external virtual override {\n if (_initialGas == 0) revert GasNotInitialized();\n address _job = msg.sender;\n if (disputes[_job]) revert JobDisputed();\n if (!_jobs.contains(_job)) revert JobUnapproved();\n\n if (_updateJobCreditsIfNeeded(_job)) {\n emit LiquidityCreditsReward(_job, rewardedAt[_job], _jobLiquidityCredits[_job], _jobPeriodCredits[_job]);\n }\n\n (uint256 _boost, uint256 _oneEthQuote, uint256 _extraGas) = IKeep3rHelper(keep3rHelper).getPaymentParams(bonds[_keeper][keep3rV1]);\n\n uint256 _gasLeft = _getGasLeft();\n uint256 _payment = _calculatePayment(_gasLeft, _extraGas, _oneEthQuote, _boost);\n\n if (_payment > _jobLiquidityCredits[_job]) {\n _rewardJobCredits(_job);\n emit LiquidityCreditsReward(_job, rewardedAt[_job], _jobLiquidityCredits[_job], _jobPeriodCredits[_job]);\n\n _gasLeft = _getGasLeft();\n _payment = _calculatePayment(_gasLeft, _extraGas, _oneEthQuote, _boost);\n }\n\n _bondedPayment(_job, _keeper, _payment);\n delete _initialGas;\n\n emit KeeperWork(keep3rV1, _job, _keeper, _payment, _gasLeft);\n }\n\n /// @inheritdoc IKeep3rJobWorkable\n function bondedPayment(address _keeper, uint256 _payment) external override {\n address _job = msg.sender;\n\n if (disputes[_job]) revert JobDisputed();\n if (!_jobs.contains(_job)) revert JobUnapproved();\n\n if (_updateJobCreditsIfNeeded(_job)) {\n emit LiquidityCreditsReward(_job, rewardedAt[_job], _jobLiquidityCredits[_job], _jobPeriodCredits[_job]);\n }\n\n if (_payment > _jobLiquidityCredits[_job]) {\n _rewardJobCredits(_job);\n emit LiquidityCreditsReward(_job, rewardedAt[_job], _jobLiquidityCredits[_job], _jobPeriodCredits[_job]);\n }\n\n _bondedPayment(_job, _keeper, _payment);\n emit KeeperWork(keep3rV1, _job, _keeper, _payment, _getGasLeft());\n }\n\n /// @inheritdoc IKeep3rJobWorkable\n function directTokenPayment(\n address _token,\n address _keeper,\n uint256 _amount\n ) external override {\n address _job = msg.sender;\n\n if (disputes[_job]) revert JobDisputed();\n if (disputes[_keeper]) revert Disputed();\n if (!_jobs.contains(_job)) revert JobUnapproved();\n if (jobTokenCredits[_job][_token] < _amount) revert InsufficientFunds();\n jobTokenCredits[_job][_token] -= _amount;\n IERC20(_token).safeTransfer(_keeper, _amount);\n emit KeeperWork(_token, _job, _keeper, _amount, _getGasLeft());\n }\n\n function _bondedPayment(\n address _job,\n address _keeper,\n uint256 _payment\n ) internal {\n if (_payment > _jobLiquidityCredits[_job]) revert InsufficientFunds();\n\n workedAt[_job] = block.timestamp;\n _jobLiquidityCredits[_job] -= _payment;\n bonds[_keeper][keep3rV1] += _payment;\n workCompleted[_keeper] += _payment;\n }\n\n /// @notice Calculate amount to be payed in KP3R, taking into account multiple parameters\n /// @param _gasLeft Amount of gas left after working the job\n /// @param _extraGas Amount of expected unaccounted gas\n /// @param _oneEthQuote Amount of KP3R equivalent to 1 ETH\n /// @param _boost Reward given to the keeper for having bonded KP3R tokens\n /// @return _payment Amount to be payed in KP3R tokens\n function _calculatePayment(\n uint256 _gasLeft,\n uint256 _extraGas,\n uint256 _oneEthQuote,\n uint256 _boost\n ) internal view returns (uint256 _payment) {\n uint256 _accountedGas = _initialGas - _gasLeft + _extraGas;\n _payment = (((_accountedGas * _boost) / _BASE) * _oneEthQuote) / 1 ether;\n }\n\n /// @notice Return the gas left and add 1/64 in order to match real gas left at first level of depth (EIP-150)\n /// @return _gasLeft Amount of gas left recording taking into account EIP-150\n function _getGasLeft() internal view returns (uint256 _gasLeft) {\n _gasLeft = (gasleft() * 64) / 63;\n }\n}\n" - }, - "solidity/contracts/peripherals/jobs/Keep3rJobDisputable.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport './Keep3rJobFundableCredits.sol';\nimport './Keep3rJobFundableLiquidity.sol';\nimport '../Keep3rDisputable.sol';\n\nabstract contract Keep3rJobDisputable is IKeep3rJobDisputable, Keep3rDisputable, Keep3rJobFundableCredits, Keep3rJobFundableLiquidity {\n using EnumerableSet for EnumerableSet.AddressSet;\n using SafeERC20 for IERC20;\n\n /// @inheritdoc IKeep3rJobDisputable\n function slashTokenFromJob(\n address _job,\n address _token,\n uint256 _amount\n ) external override onlySlasher {\n if (!disputes[_job]) revert NotDisputed();\n if (!_jobTokens[_job].contains(_token)) revert JobTokenUnexistent();\n if (jobTokenCredits[_job][_token] < _amount) revert JobTokenInsufficient();\n\n try IERC20(_token).transfer(governance, _amount) {} catch {}\n jobTokenCredits[_job][_token] -= _amount;\n if (jobTokenCredits[_job][_token] == 0) {\n _jobTokens[_job].remove(_token);\n }\n\n emit JobSlashToken(_job, _token, msg.sender, _amount);\n }\n\n /// @inheritdoc IKeep3rJobDisputable\n function slashLiquidityFromJob(\n address _job,\n address _liquidity,\n uint256 _amount\n ) external override onlySlasher {\n if (!disputes[_job]) revert NotDisputed();\n\n _unbondLiquidityFromJob(_job, _liquidity, _amount);\n try IERC20(_liquidity).transfer(governance, _amount) {} catch {}\n emit JobSlashLiquidity(_job, _liquidity, msg.sender, _amount);\n }\n}\n" - }, - "solidity/contracts/peripherals/jobs/Keep3rJobOwnership.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../../../interfaces/peripherals/IKeep3rJobs.sol';\n\nabstract contract Keep3rJobOwnership is IKeep3rJobOwnership {\n /// @inheritdoc IKeep3rJobOwnership\n mapping(address => address) public override jobOwner;\n\n /// @inheritdoc IKeep3rJobOwnership\n mapping(address => address) public override jobPendingOwner;\n\n /// @inheritdoc IKeep3rJobOwnership\n function changeJobOwnership(address _job, address _newOwner) external override onlyJobOwner(_job) {\n jobPendingOwner[_job] = _newOwner;\n emit JobOwnershipChange(_job, jobOwner[_job], _newOwner);\n }\n\n /// @inheritdoc IKeep3rJobOwnership\n function acceptJobOwnership(address _job) external override onlyPendingJobOwner(_job) {\n address _previousOwner = jobOwner[_job];\n\n jobOwner[_job] = jobPendingOwner[_job];\n delete jobPendingOwner[_job];\n\n emit JobOwnershipAssent(msg.sender, _job, _previousOwner);\n }\n\n modifier onlyJobOwner(address _job) {\n if (msg.sender != jobOwner[_job]) revert OnlyJobOwner();\n _;\n }\n\n modifier onlyPendingJobOwner(address _job) {\n if (msg.sender != jobPendingOwner[_job]) revert OnlyPendingJobOwner();\n _;\n }\n}\n" - }, - "solidity/contracts/peripherals/Keep3rAccountance.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '@openzeppelin/contracts/utils/structs/EnumerableSet.sol';\nimport '../../interfaces/peripherals/IKeep3rAccountance.sol';\nimport './Keep3rRoles.sol';\n\nabstract contract Keep3rAccountance is IKeep3rAccountance, Keep3rRoles {\n using EnumerableSet for EnumerableSet.AddressSet;\n\n /// @notice List of all enabled keepers\n EnumerableSet.AddressSet internal _keepers;\n\n /// @inheritdoc IKeep3rAccountance\n mapping(address => uint256) public override workCompleted;\n\n /// @inheritdoc IKeep3rAccountance\n mapping(address => uint256) public override firstSeen;\n\n /// @inheritdoc IKeep3rAccountance\n mapping(address => bool) public override disputes;\n\n /// @inheritdoc IKeep3rAccountance\n /// @notice Mapping (job => bonding => amount)\n mapping(address => mapping(address => uint256)) public override bonds;\n\n /// @inheritdoc IKeep3rAccountance\n mapping(address => mapping(address => uint256)) public override jobTokenCredits;\n\n /// @notice The current liquidity credits available for a job\n mapping(address => uint256) internal _jobLiquidityCredits;\n\n /// @notice Map the address of a job to its correspondent periodCredits\n mapping(address => uint256) internal _jobPeriodCredits;\n\n /// @notice Enumerable array of Job Tokens for Credits\n mapping(address => EnumerableSet.AddressSet) internal _jobTokens;\n\n /// @notice List of liquidities that a job has (job => liquidities)\n mapping(address => EnumerableSet.AddressSet) internal _jobLiquidities;\n\n /// @notice Liquidity pool to observe\n mapping(address => address) internal _liquidityPool;\n\n /// @notice Tracks if a pool has KP3R as token0\n mapping(address => bool) internal _isKP3RToken0;\n\n /// @inheritdoc IKeep3rAccountance\n mapping(address => mapping(address => uint256)) public override pendingBonds;\n\n /// @inheritdoc IKeep3rAccountance\n mapping(address => mapping(address => uint256)) public override canActivateAfter;\n\n /// @inheritdoc IKeep3rAccountance\n mapping(address => mapping(address => uint256)) public override canWithdrawAfter;\n\n /// @inheritdoc IKeep3rAccountance\n mapping(address => mapping(address => uint256)) public override pendingUnbonds;\n\n /// @inheritdoc IKeep3rAccountance\n mapping(address => bool) public override hasBonded;\n\n /// @notice List of all enabled jobs\n EnumerableSet.AddressSet internal _jobs;\n\n /// @inheritdoc IKeep3rAccountance\n function jobs() external view override returns (address[] memory _list) {\n _list = _jobs.values();\n }\n\n /// @inheritdoc IKeep3rAccountance\n function keepers() external view override returns (address[] memory _list) {\n _list = _keepers.values();\n }\n}\n" - }, - "@openzeppelin/contracts/utils/structs/EnumerableSet.sol": { - "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Library for managing\n * https://en.wikipedia.org/wiki/Set_(abstract_data_type)[sets] of primitive\n * types.\n *\n * Sets have the following properties:\n *\n * - Elements are added, removed, and checked for existence in constant time\n * (O(1)).\n * - Elements are enumerated in O(n). No guarantees are made on the ordering.\n *\n * ```\n * contract Example {\n * // Add the library methods\n * using EnumerableSet for EnumerableSet.AddressSet;\n *\n * // Declare a set state variable\n * EnumerableSet.AddressSet private mySet;\n * }\n * ```\n *\n * As of v3.3.0, sets of type `bytes32` (`Bytes32Set`), `address` (`AddressSet`)\n * and `uint256` (`UintSet`) are supported.\n */\nlibrary EnumerableSet {\n // To implement this library for multiple types with as little code\n // repetition as possible, we write it in terms of a generic Set type with\n // bytes32 values.\n // The Set implementation uses private functions, and user-facing\n // implementations (such as AddressSet) are just wrappers around the\n // underlying Set.\n // This means that we can only create new EnumerableSets for types that fit\n // in bytes32.\n\n struct Set {\n // Storage of set values\n bytes32[] _values;\n // Position of the value in the `values` array, plus 1 because index 0\n // means a value is not in the set.\n mapping(bytes32 => uint256) _indexes;\n }\n\n /**\n * @dev Add a value to a set. O(1).\n *\n * Returns true if the value was added to the set, that is if it was not\n * already present.\n */\n function _add(Set storage set, bytes32 value) private returns (bool) {\n if (!_contains(set, value)) {\n set._values.push(value);\n // The value is stored at length-1, but we add 1 to all indexes\n // and use 0 as a sentinel value\n set._indexes[value] = set._values.length;\n return true;\n } else {\n return false;\n }\n }\n\n /**\n * @dev Removes a value from a set. O(1).\n *\n * Returns true if the value was removed from the set, that is if it was\n * present.\n */\n function _remove(Set storage set, bytes32 value) private returns (bool) {\n // We read and store the value's index to prevent multiple reads from the same storage slot\n uint256 valueIndex = set._indexes[value];\n\n if (valueIndex != 0) {\n // Equivalent to contains(set, value)\n // To delete an element from the _values array in O(1), we swap the element to delete with the last one in\n // the array, and then remove the last element (sometimes called as 'swap and pop').\n // This modifies the order of the array, as noted in {at}.\n\n uint256 toDeleteIndex = valueIndex - 1;\n uint256 lastIndex = set._values.length - 1;\n\n if (lastIndex != toDeleteIndex) {\n bytes32 lastvalue = set._values[lastIndex];\n\n // Move the last value to the index where the value to delete is\n set._values[toDeleteIndex] = lastvalue;\n // Update the index for the moved value\n set._indexes[lastvalue] = valueIndex; // Replace lastvalue's index to valueIndex\n }\n\n // Delete the slot where the moved value was stored\n set._values.pop();\n\n // Delete the index for the deleted slot\n delete set._indexes[value];\n\n return true;\n } else {\n return false;\n }\n }\n\n /**\n * @dev Returns true if the value is in the set. O(1).\n */\n function _contains(Set storage set, bytes32 value) private view returns (bool) {\n return set._indexes[value] != 0;\n }\n\n /**\n * @dev Returns the number of values on the set. O(1).\n */\n function _length(Set storage set) private view returns (uint256) {\n return set._values.length;\n }\n\n /**\n * @dev Returns the value stored at position `index` in the set. O(1).\n *\n * Note that there are no guarantees on the ordering of values inside the\n * array, and it may change when more values are added or removed.\n *\n * Requirements:\n *\n * - `index` must be strictly less than {length}.\n */\n function _at(Set storage set, uint256 index) private view returns (bytes32) {\n return set._values[index];\n }\n\n /**\n * @dev Return the entire set in an array\n *\n * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed\n * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that\n * this function has an unbounded cost, and using it as part of a state-changing function may render the function\n * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.\n */\n function _values(Set storage set) private view returns (bytes32[] memory) {\n return set._values;\n }\n\n // Bytes32Set\n\n struct Bytes32Set {\n Set _inner;\n }\n\n /**\n * @dev Add a value to a set. O(1).\n *\n * Returns true if the value was added to the set, that is if it was not\n * already present.\n */\n function add(Bytes32Set storage set, bytes32 value) internal returns (bool) {\n return _add(set._inner, value);\n }\n\n /**\n * @dev Removes a value from a set. O(1).\n *\n * Returns true if the value was removed from the set, that is if it was\n * present.\n */\n function remove(Bytes32Set storage set, bytes32 value) internal returns (bool) {\n return _remove(set._inner, value);\n }\n\n /**\n * @dev Returns true if the value is in the set. O(1).\n */\n function contains(Bytes32Set storage set, bytes32 value) internal view returns (bool) {\n return _contains(set._inner, value);\n }\n\n /**\n * @dev Returns the number of values in the set. O(1).\n */\n function length(Bytes32Set storage set) internal view returns (uint256) {\n return _length(set._inner);\n }\n\n /**\n * @dev Returns the value stored at position `index` in the set. O(1).\n *\n * Note that there are no guarantees on the ordering of values inside the\n * array, and it may change when more values are added or removed.\n *\n * Requirements:\n *\n * - `index` must be strictly less than {length}.\n */\n function at(Bytes32Set storage set, uint256 index) internal view returns (bytes32) {\n return _at(set._inner, index);\n }\n\n /**\n * @dev Return the entire set in an array\n *\n * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed\n * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that\n * this function has an unbounded cost, and using it as part of a state-changing function may render the function\n * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.\n */\n function values(Bytes32Set storage set) internal view returns (bytes32[] memory) {\n return _values(set._inner);\n }\n\n // AddressSet\n\n struct AddressSet {\n Set _inner;\n }\n\n /**\n * @dev Add a value to a set. O(1).\n *\n * Returns true if the value was added to the set, that is if it was not\n * already present.\n */\n function add(AddressSet storage set, address value) internal returns (bool) {\n return _add(set._inner, bytes32(uint256(uint160(value))));\n }\n\n /**\n * @dev Removes a value from a set. O(1).\n *\n * Returns true if the value was removed from the set, that is if it was\n * present.\n */\n function remove(AddressSet storage set, address value) internal returns (bool) {\n return _remove(set._inner, bytes32(uint256(uint160(value))));\n }\n\n /**\n * @dev Returns true if the value is in the set. O(1).\n */\n function contains(AddressSet storage set, address value) internal view returns (bool) {\n return _contains(set._inner, bytes32(uint256(uint160(value))));\n }\n\n /**\n * @dev Returns the number of values in the set. O(1).\n */\n function length(AddressSet storage set) internal view returns (uint256) {\n return _length(set._inner);\n }\n\n /**\n * @dev Returns the value stored at position `index` in the set. O(1).\n *\n * Note that there are no guarantees on the ordering of values inside the\n * array, and it may change when more values are added or removed.\n *\n * Requirements:\n *\n * - `index` must be strictly less than {length}.\n */\n function at(AddressSet storage set, uint256 index) internal view returns (address) {\n return address(uint160(uint256(_at(set._inner, index))));\n }\n\n /**\n * @dev Return the entire set in an array\n *\n * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed\n * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that\n * this function has an unbounded cost, and using it as part of a state-changing function may render the function\n * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.\n */\n function values(AddressSet storage set) internal view returns (address[] memory) {\n bytes32[] memory store = _values(set._inner);\n address[] memory result;\n\n assembly {\n result := store\n }\n\n return result;\n }\n\n // UintSet\n\n struct UintSet {\n Set _inner;\n }\n\n /**\n * @dev Add a value to a set. O(1).\n *\n * Returns true if the value was added to the set, that is if it was not\n * already present.\n */\n function add(UintSet storage set, uint256 value) internal returns (bool) {\n return _add(set._inner, bytes32(value));\n }\n\n /**\n * @dev Removes a value from a set. O(1).\n *\n * Returns true if the value was removed from the set, that is if it was\n * present.\n */\n function remove(UintSet storage set, uint256 value) internal returns (bool) {\n return _remove(set._inner, bytes32(value));\n }\n\n /**\n * @dev Returns true if the value is in the set. O(1).\n */\n function contains(UintSet storage set, uint256 value) internal view returns (bool) {\n return _contains(set._inner, bytes32(value));\n }\n\n /**\n * @dev Returns the number of values on the set. O(1).\n */\n function length(UintSet storage set) internal view returns (uint256) {\n return _length(set._inner);\n }\n\n /**\n * @dev Returns the value stored at position `index` in the set. O(1).\n *\n * Note that there are no guarantees on the ordering of values inside the\n * array, and it may change when more values are added or removed.\n *\n * Requirements:\n *\n * - `index` must be strictly less than {length}.\n */\n function at(UintSet storage set, uint256 index) internal view returns (uint256) {\n return uint256(_at(set._inner, index));\n }\n\n /**\n * @dev Return the entire set in an array\n *\n * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed\n * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that\n * this function has an unbounded cost, and using it as part of a state-changing function may render the function\n * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.\n */\n function values(UintSet storage set) internal view returns (uint256[] memory) {\n bytes32[] memory store = _values(set._inner);\n uint256[] memory result;\n\n assembly {\n result := store\n }\n\n return result;\n }\n}\n" - }, - "solidity/contracts/peripherals/Keep3rRoles.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../../interfaces/peripherals/IKeep3rRoles.sol';\nimport '@openzeppelin/contracts/utils/structs/EnumerableSet.sol';\nimport './DustCollector.sol';\nimport './Governable.sol';\n\ncontract Keep3rRoles is IKeep3rRoles, Governable, DustCollector {\n /// @inheritdoc IKeep3rRoles\n mapping(address => bool) public override slashers;\n\n /// @inheritdoc IKeep3rRoles\n mapping(address => bool) public override disputers;\n\n constructor(address _governance) Governable(_governance) DustCollector() {}\n\n /// @inheritdoc IKeep3rRoles\n function addSlasher(address _slasher) external override onlyGovernance {\n if (_slasher == address(0)) revert ZeroAddress();\n if (slashers[_slasher]) revert SlasherExistent();\n slashers[_slasher] = true;\n emit SlasherAdded(_slasher);\n }\n\n /// @inheritdoc IKeep3rRoles\n function removeSlasher(address _slasher) external override onlyGovernance {\n if (!slashers[_slasher]) revert SlasherUnexistent();\n delete slashers[_slasher];\n emit SlasherRemoved(_slasher);\n }\n\n /// @inheritdoc IKeep3rRoles\n function addDisputer(address _disputer) external override onlyGovernance {\n if (_disputer == address(0)) revert ZeroAddress();\n if (disputers[_disputer]) revert DisputerExistent();\n disputers[_disputer] = true;\n emit DisputerAdded(_disputer);\n }\n\n /// @inheritdoc IKeep3rRoles\n function removeDisputer(address _disputer) external override onlyGovernance {\n if (!disputers[_disputer]) revert DisputerUnexistent();\n delete disputers[_disputer];\n emit DisputerRemoved(_disputer);\n }\n\n /// @notice Functions with this modifier can only be called by either a slasher or governance\n modifier onlySlasher {\n if (!slashers[msg.sender]) revert OnlySlasher();\n _;\n }\n\n /// @notice Functions with this modifier can only be called by either a disputer or governance\n modifier onlyDisputer {\n if (!disputers[msg.sender]) revert OnlyDisputer();\n _;\n }\n}\n" - }, - "solidity/contracts/peripherals/Governable.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../../interfaces/peripherals/IGovernable.sol';\n\nabstract contract Governable is IGovernable {\n /// @inheritdoc IGovernable\n address public override governance;\n\n /// @inheritdoc IGovernable\n address public override pendingGovernance;\n\n constructor(address _governance) {\n if (_governance == address(0)) revert NoGovernanceZeroAddress();\n governance = _governance;\n }\n\n /// @inheritdoc IGovernable\n function setGovernance(address _governance) external override onlyGovernance {\n pendingGovernance = _governance;\n emit GovernanceProposal(_governance);\n }\n\n /// @inheritdoc IGovernable\n function acceptGovernance() external override onlyPendingGovernance {\n governance = pendingGovernance;\n delete pendingGovernance;\n emit GovernanceSet(governance);\n }\n\n /// @notice Functions with this modifier can only be called by governance\n modifier onlyGovernance {\n if (msg.sender != governance) revert OnlyGovernance();\n _;\n }\n\n /// @notice Functions with this modifier can only be called by pendingGovernance\n modifier onlyPendingGovernance {\n if (msg.sender != pendingGovernance) revert OnlyPendingGovernance();\n _;\n }\n}\n" - }, - "@openzeppelin/contracts/token/ERC20/IERC20.sol": { - "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Interface of the ERC20 standard as defined in the EIP.\n */\ninterface IERC20 {\n /**\n * @dev Returns the amount of tokens in existence.\n */\n function totalSupply() external view returns (uint256);\n\n /**\n * @dev Returns the amount of tokens owned by `account`.\n */\n function balanceOf(address account) external view returns (uint256);\n\n /**\n * @dev Moves `amount` tokens from the caller's account to `recipient`.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * Emits a {Transfer} event.\n */\n function transfer(address recipient, uint256 amount) external returns (bool);\n\n /**\n * @dev Returns the remaining number of tokens that `spender` will be\n * allowed to spend on behalf of `owner` through {transferFrom}. This is\n * zero by default.\n *\n * This value changes when {approve} or {transferFrom} are called.\n */\n function allowance(address owner, address spender) external view returns (uint256);\n\n /**\n * @dev Sets `amount` as the allowance of `spender` over the caller's tokens.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * IMPORTANT: Beware that changing an allowance with this method brings the risk\n * that someone may use both the old and the new allowance by unfortunate\n * transaction ordering. One possible solution to mitigate this race\n * condition is to first reduce the spender's allowance to 0 and set the\n * desired value afterwards:\n * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729\n *\n * Emits an {Approval} event.\n */\n function approve(address spender, uint256 amount) external returns (bool);\n\n /**\n * @dev Moves `amount` tokens from `sender` to `recipient` using the\n * allowance mechanism. `amount` is then deducted from the caller's\n * allowance.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * Emits a {Transfer} event.\n */\n function transferFrom(\n address sender,\n address recipient,\n uint256 amount\n ) external returns (bool);\n\n /**\n * @dev Emitted when `value` tokens are moved from one account (`from`) to\n * another (`to`).\n *\n * Note that `value` may be zero.\n */\n event Transfer(address indexed from, address indexed to, uint256 value);\n\n /**\n * @dev Emitted when the allowance of a `spender` for an `owner` is set by\n * a call to {approve}. `value` is the new allowance.\n */\n event Approval(address indexed owner, address indexed spender, uint256 value);\n}\n" - }, - "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol": { - "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\nimport \"../IERC20.sol\";\nimport \"../../../utils/Address.sol\";\n\n/**\n * @title SafeERC20\n * @dev Wrappers around ERC20 operations that throw on failure (when the token\n * contract returns false). Tokens that return no value (and instead revert or\n * throw on failure) are also supported, non-reverting calls are assumed to be\n * successful.\n * To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract,\n * which allows you to call the safe operations as `token.safeTransfer(...)`, etc.\n */\nlibrary SafeERC20 {\n using Address for address;\n\n function safeTransfer(\n IERC20 token,\n address to,\n uint256 value\n ) internal {\n _callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value));\n }\n\n function safeTransferFrom(\n IERC20 token,\n address from,\n address to,\n uint256 value\n ) internal {\n _callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value));\n }\n\n /**\n * @dev Deprecated. This function has issues similar to the ones found in\n * {IERC20-approve}, and its usage is discouraged.\n *\n * Whenever possible, use {safeIncreaseAllowance} and\n * {safeDecreaseAllowance} instead.\n */\n function safeApprove(\n IERC20 token,\n address spender,\n uint256 value\n ) internal {\n // safeApprove should only be called when setting an initial allowance,\n // or when resetting it to zero. To increase and decrease it, use\n // 'safeIncreaseAllowance' and 'safeDecreaseAllowance'\n require(\n (value == 0) || (token.allowance(address(this), spender) == 0),\n \"SafeERC20: approve from non-zero to non-zero allowance\"\n );\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value));\n }\n\n function safeIncreaseAllowance(\n IERC20 token,\n address spender,\n uint256 value\n ) internal {\n uint256 newAllowance = token.allowance(address(this), spender) + value;\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));\n }\n\n function safeDecreaseAllowance(\n IERC20 token,\n address spender,\n uint256 value\n ) internal {\n unchecked {\n uint256 oldAllowance = token.allowance(address(this), spender);\n require(oldAllowance >= value, \"SafeERC20: decreased allowance below zero\");\n uint256 newAllowance = oldAllowance - value;\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));\n }\n }\n\n /**\n * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement\n * on the return value: the return value is optional (but if data is returned, it must not be false).\n * @param token The token targeted by the call.\n * @param data The call data (encoded using abi.encode or one of its variants).\n */\n function _callOptionalReturn(IERC20 token, bytes memory data) private {\n // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since\n // we're implementing it ourselves. We use {Address.functionCall} to perform this call, which verifies that\n // the target address contains contract code and also asserts for success in the low-level call.\n\n bytes memory returndata = address(token).functionCall(data, \"SafeERC20: low-level call failed\");\n if (returndata.length > 0) {\n // Return data is optional\n require(abi.decode(returndata, (bool)), \"SafeERC20: ERC20 operation did not succeed\");\n }\n }\n}\n" - }, - "@openzeppelin/contracts/utils/Address.sol": { - "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Collection of functions related to the address type\n */\nlibrary Address {\n /**\n * @dev Returns true if `account` is a contract.\n *\n * [IMPORTANT]\n * ====\n * It is unsafe to assume that an address for which this function returns\n * false is an externally-owned account (EOA) and not a contract.\n *\n * Among others, `isContract` will return false for the following\n * types of addresses:\n *\n * - an externally-owned account\n * - a contract in construction\n * - an address where a contract will be created\n * - an address where a contract lived, but was destroyed\n * ====\n */\n function isContract(address account) internal view returns (bool) {\n // This method relies on extcodesize, which returns 0 for contracts in\n // construction, since the code is only stored at the end of the\n // constructor execution.\n\n uint256 size;\n assembly {\n size := extcodesize(account)\n }\n return size > 0;\n }\n\n /**\n * @dev Replacement for Solidity's `transfer`: sends `amount` wei to\n * `recipient`, forwarding all available gas and reverting on errors.\n *\n * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost\n * of certain opcodes, possibly making contracts go over the 2300 gas limit\n * imposed by `transfer`, making them unable to receive funds via\n * `transfer`. {sendValue} removes this limitation.\n *\n * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].\n *\n * IMPORTANT: because control is transferred to `recipient`, care must be\n * taken to not create reentrancy vulnerabilities. Consider using\n * {ReentrancyGuard} or the\n * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].\n */\n function sendValue(address payable recipient, uint256 amount) internal {\n require(address(this).balance >= amount, \"Address: insufficient balance\");\n\n (bool success, ) = recipient.call{value: amount}(\"\");\n require(success, \"Address: unable to send value, recipient may have reverted\");\n }\n\n /**\n * @dev Performs a Solidity function call using a low level `call`. A\n * plain `call` is an unsafe replacement for a function call: use this\n * function instead.\n *\n * If `target` reverts with a revert reason, it is bubbled up by this\n * function (like regular Solidity function calls).\n *\n * Returns the raw returned data. To convert to the expected return value,\n * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\n *\n * Requirements:\n *\n * - `target` must be a contract.\n * - calling `target` with `data` must not revert.\n *\n * _Available since v3.1._\n */\n function functionCall(address target, bytes memory data) internal returns (bytes memory) {\n return functionCall(target, data, \"Address: low-level call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with\n * `errorMessage` as a fallback revert reason when `target` reverts.\n *\n * _Available since v3.1._\n */\n function functionCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal returns (bytes memory) {\n return functionCallWithValue(target, data, 0, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but also transferring `value` wei to `target`.\n *\n * Requirements:\n *\n * - the calling contract must have an ETH balance of at least `value`.\n * - the called Solidity function must be `payable`.\n *\n * _Available since v3.1._\n */\n function functionCallWithValue(\n address target,\n bytes memory data,\n uint256 value\n ) internal returns (bytes memory) {\n return functionCallWithValue(target, data, value, \"Address: low-level call with value failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but\n * with `errorMessage` as a fallback revert reason when `target` reverts.\n *\n * _Available since v3.1._\n */\n function functionCallWithValue(\n address target,\n bytes memory data,\n uint256 value,\n string memory errorMessage\n ) internal returns (bytes memory) {\n require(address(this).balance >= value, \"Address: insufficient balance for call\");\n require(isContract(target), \"Address: call to non-contract\");\n\n (bool success, bytes memory returndata) = target.call{value: value}(data);\n return verifyCallResult(success, returndata, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but performing a static call.\n *\n * _Available since v3.3._\n */\n function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\n return functionStaticCall(target, data, \"Address: low-level static call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\n * but performing a static call.\n *\n * _Available since v3.3._\n */\n function functionStaticCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal view returns (bytes memory) {\n require(isContract(target), \"Address: static call to non-contract\");\n\n (bool success, bytes memory returndata) = target.staticcall(data);\n return verifyCallResult(success, returndata, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but performing a delegate call.\n *\n * _Available since v3.4._\n */\n function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {\n return functionDelegateCall(target, data, \"Address: low-level delegate call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\n * but performing a delegate call.\n *\n * _Available since v3.4._\n */\n function functionDelegateCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal returns (bytes memory) {\n require(isContract(target), \"Address: delegate call to non-contract\");\n\n (bool success, bytes memory returndata) = target.delegatecall(data);\n return verifyCallResult(success, returndata, errorMessage);\n }\n\n /**\n * @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the\n * revert reason using the provided one.\n *\n * _Available since v4.3._\n */\n function verifyCallResult(\n bool success,\n bytes memory returndata,\n string memory errorMessage\n ) internal pure returns (bytes memory) {\n if (success) {\n return returndata;\n } else {\n // Look for revert reason and bubble it up if present\n if (returndata.length > 0) {\n // The easiest way to bubble the revert reason is using memory via assembly\n\n assembly {\n let returndata_size := mload(returndata)\n revert(add(32, returndata), returndata_size)\n }\n } else {\n revert(errorMessage);\n }\n }\n }\n}\n" - }, - "solidity/contracts/peripherals/jobs/Keep3rJobMigration.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../../../interfaces/peripherals/IKeep3rJobs.sol';\nimport './Keep3rJobFundableCredits.sol';\nimport './Keep3rJobFundableLiquidity.sol';\n\nabstract contract Keep3rJobMigration is IKeep3rJobMigration, Keep3rJobFundableCredits, Keep3rJobFundableLiquidity {\n using EnumerableSet for EnumerableSet.AddressSet;\n\n uint256 internal constant _MIGRATION_COOLDOWN = 1 minutes;\n\n /// @inheritdoc IKeep3rJobMigration\n mapping(address => address) public override pendingJobMigrations;\n mapping(address => mapping(address => uint256)) internal _migrationCreatedAt;\n\n /// @inheritdoc IKeep3rJobMigration\n function migrateJob(address _fromJob, address _toJob) external override onlyJobOwner(_fromJob) {\n if (_fromJob == _toJob) revert JobMigrationImpossible();\n\n pendingJobMigrations[_fromJob] = _toJob;\n _migrationCreatedAt[_fromJob][_toJob] = block.timestamp;\n\n emit JobMigrationRequested(_fromJob, _toJob);\n }\n\n /// @inheritdoc IKeep3rJobMigration\n function acceptJobMigration(address _fromJob, address _toJob) external override onlyJobOwner(_toJob) {\n if (disputes[_fromJob] || disputes[_toJob]) revert JobDisputed();\n if (pendingJobMigrations[_fromJob] != _toJob) revert JobMigrationUnavailable();\n if (block.timestamp < _migrationCreatedAt[_fromJob][_toJob] + _MIGRATION_COOLDOWN) revert JobMigrationLocked();\n\n // force job credits update for both jobs\n _settleJobAccountance(_fromJob);\n _settleJobAccountance(_toJob);\n\n // migrate tokens\n while (_jobTokens[_fromJob].length() > 0) {\n address _tokenToMigrate = _jobTokens[_fromJob].at(0);\n jobTokenCredits[_toJob][_tokenToMigrate] += jobTokenCredits[_fromJob][_tokenToMigrate];\n delete jobTokenCredits[_fromJob][_tokenToMigrate];\n _jobTokens[_fromJob].remove(_tokenToMigrate);\n _jobTokens[_toJob].add(_tokenToMigrate);\n }\n\n // migrate liquidities\n while (_jobLiquidities[_fromJob].length() > 0) {\n address _liquidity = _jobLiquidities[_fromJob].at(0);\n\n liquidityAmount[_toJob][_liquidity] += liquidityAmount[_fromJob][_liquidity];\n delete liquidityAmount[_fromJob][_liquidity];\n\n _jobLiquidities[_toJob].add(_liquidity);\n _jobLiquidities[_fromJob].remove(_liquidity);\n }\n\n // migrate job balances\n _jobPeriodCredits[_toJob] += _jobPeriodCredits[_fromJob];\n delete _jobPeriodCredits[_fromJob];\n\n _jobLiquidityCredits[_toJob] += _jobLiquidityCredits[_fromJob];\n delete _jobLiquidityCredits[_fromJob];\n\n // stop _fromJob from being a job\n delete rewardedAt[_fromJob];\n _jobs.remove(_fromJob);\n\n // delete unused data slots\n delete jobOwner[_fromJob];\n delete jobPendingOwner[_fromJob];\n delete _migrationCreatedAt[_fromJob][_toJob];\n delete pendingJobMigrations[_fromJob];\n\n emit JobMigrationSuccessful(_fromJob, _toJob);\n }\n}\n" - }, - "solidity/interfaces/IKeep3rHelper.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport './IKeep3rHelperParameters.sol';\n\n/// @title Keep3rHelper contract\n/// @notice Contains all the helper functions used throughout the different files.\ninterface IKeep3rHelper is IKeep3rHelperParameters {\n // Errors\n\n /// @notice Throws when none of the tokens in the liquidity pair is KP3R\n error LiquidityPairInvalid();\n\n // Methods\n // solhint-enable func-name-mixedcase\n\n /// @notice Calculates the amount of KP3R that corresponds to the ETH passed into the function\n /// @dev This function allows us to calculate how much KP3R we should pay to a keeper for things expressed in ETH, like gas\n /// @param _eth The amount of ETH\n /// @return _amountOut The amount of KP3R\n function quote(uint256 _eth) external view returns (uint256 _amountOut);\n\n /// @notice Returns the amount of KP3R the keeper has bonded\n /// @param _keeper The address of the keeper to check\n /// @return _amountBonded The amount of KP3R the keeper has bonded\n function bonds(address _keeper) external view returns (uint256 _amountBonded);\n\n /// @notice Calculates the reward (in KP3R) that corresponds to a keeper for using gas\n /// @param _keeper The address of the keeper to check\n /// @param _gasUsed The amount of gas used that will be rewarded\n /// @return _kp3r The amount of KP3R that should be awarded to the keeper\n function getRewardAmountFor(address _keeper, uint256 _gasUsed) external view returns (uint256 _kp3r);\n\n /// @notice Calculates the boost in the reward given to a keeper based on the amount of KP3R that keeper has bonded\n /// @dev If the keeper has no bonds, boost should be +10% of gas cost, if keeper has max bonds, +20%\n /// @param _bonds The amount of KP3R tokens bonded by the keeper\n /// @return _rewardBoost The reward boost that corresponds to the keeper\n function getRewardBoostFor(uint256 _bonds) external view returns (uint256 _rewardBoost);\n\n /// @notice Calculates the reward (in KP3R) that corresponds to tx.origin for using gas\n /// @param _gasUsed The amount of gas used that will be rewarded\n /// @return _amount The amount of KP3R that should be awarded to tx.origin\n function getRewardAmount(uint256 _gasUsed) external view returns (uint256 _amount);\n\n /// @notice Given a pool address, returns the underlying tokens of the pair\n /// @param _pool Address of the correspondant pool\n /// @return _token0 Address of the first token of the pair\n /// @return _token1 Address of the second token of the pair\n function getPoolTokens(address _pool) external view returns (address _token0, address _token1);\n\n /// @notice Defines the order of the tokens in the pair for twap calculations\n /// @param _pool Address of the correspondant pool\n /// @return _isKP3RToken0 Boolean indicating the order of the tokens in the pair\n function isKP3RToken0(address _pool) external view returns (bool _isKP3RToken0);\n\n /// @notice Given an array of secondsAgo, returns UniswapV3 pool cumulatives at that moment\n /// @param _pool Address of the pool to observe\n /// @param _secondsAgo Array with time references to observe\n /// @return _tickCumulative1 Cumulative sum of ticks until first time reference\n /// @return _tickCumulative2 Cumulative sum of ticks until second time reference\n /// @return _success Boolean indicating if the observe call was succesfull\n function observe(address _pool, uint32[] memory _secondsAgo)\n external\n view\n returns (\n int56 _tickCumulative1,\n int56 _tickCumulative2,\n bool _success\n );\n\n /// @notice Get multiplier, quote, and extra, in order to calculate keeper payment\n /// @param _bonds Amount of bonded KP3R owned by the keeper\n /// @return _boost Multiplier per gas unit. Takes into account the base fee and the amount of bonded KP3R\n /// @return _oneEthQuote Amount of KP3R tokens equivalent to 1 ETH\n /// @return _extra Amount of extra gas that should be added to the gas spent\n function getPaymentParams(uint256 _bonds)\n external\n view\n returns (\n uint256 _boost,\n uint256 _oneEthQuote,\n uint256 _extra\n );\n\n /// @notice Given a tick and a liquidity amount, calculates the underlying KP3R tokens\n /// @param _liquidityAmount Amount of liquidity to be converted\n /// @param _tickDifference Tick value used to calculate the quote\n /// @param _timeInterval Time value used to calculate the quote\n /// @return _kp3rAmount Amount of KP3R tokens underlying on the given liquidity\n function getKP3RsAtTick(\n uint256 _liquidityAmount,\n int56 _tickDifference,\n uint256 _timeInterval\n ) external pure returns (uint256 _kp3rAmount);\n\n /// @notice Given a tick and a token amount, calculates the output in correspondant token\n /// @param _baseAmount Amount of token to be converted\n /// @param _tickDifference Tick value used to calculate the quote\n /// @param _timeInterval Time value used to calculate the quote\n /// @return _quoteAmount Amount of credits deserved for the baseAmount at the tick value\n function getQuoteAtTick(\n uint128 _baseAmount,\n int56 _tickDifference,\n uint256 _timeInterval\n ) external pure returns (uint256 _quoteAmount);\n}\n" - }, - "solidity/contracts/peripherals/jobs/Keep3rJobFundableCredits.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport './Keep3rJobOwnership.sol';\nimport '../Keep3rAccountance.sol';\nimport '../Keep3rParameters.sol';\nimport '../../../interfaces/peripherals/IKeep3rJobs.sol';\n\nimport '@openzeppelin/contracts/security/ReentrancyGuard.sol';\nimport '@openzeppelin/contracts/token/ERC20/IERC20.sol';\nimport '@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol';\nimport '@openzeppelin/contracts/utils/math/Math.sol';\n\nabstract contract Keep3rJobFundableCredits is IKeep3rJobFundableCredits, ReentrancyGuard, Keep3rJobOwnership, Keep3rParameters {\n using EnumerableSet for EnumerableSet.AddressSet;\n using SafeERC20 for IERC20;\n\n /// @notice Cooldown between withdrawals\n uint256 internal constant _WITHDRAW_TOKENS_COOLDOWN = 1 minutes;\n\n /// @inheritdoc IKeep3rJobFundableCredits\n mapping(address => mapping(address => uint256)) public override jobTokenCreditsAddedAt;\n\n /// @inheritdoc IKeep3rJobFundableCredits\n function addTokenCreditsToJob(\n address _job,\n address _token,\n uint256 _amount\n ) external override nonReentrant {\n if (!_jobs.contains(_job)) revert JobUnavailable();\n // KP3R shouldn't be used for direct token payments\n if (_token == keep3rV1) revert TokenUnallowed();\n uint256 _before = IERC20(_token).balanceOf(address(this));\n IERC20(_token).safeTransferFrom(msg.sender, address(this), _amount);\n uint256 _received = IERC20(_token).balanceOf(address(this)) - _before;\n uint256 _tokenFee = (_received * fee) / _BASE;\n jobTokenCredits[_job][_token] += _received - _tokenFee;\n jobTokenCreditsAddedAt[_job][_token] = block.timestamp;\n IERC20(_token).safeTransfer(governance, _tokenFee);\n _jobTokens[_job].add(_token);\n\n emit TokenCreditAddition(_job, _token, msg.sender, _received);\n }\n\n /// @inheritdoc IKeep3rJobFundableCredits\n function withdrawTokenCreditsFromJob(\n address _job,\n address _token,\n uint256 _amount,\n address _receiver\n ) external override nonReentrant onlyJobOwner(_job) {\n if (block.timestamp <= jobTokenCreditsAddedAt[_job][_token] + _WITHDRAW_TOKENS_COOLDOWN) revert JobTokenCreditsLocked();\n if (jobTokenCredits[_job][_token] < _amount) revert InsufficientJobTokenCredits();\n if (disputes[_job]) revert JobDisputed();\n\n jobTokenCredits[_job][_token] -= _amount;\n IERC20(_token).safeTransfer(_receiver, _amount);\n\n if (jobTokenCredits[_job][_token] == 0) {\n _jobTokens[_job].remove(_token);\n }\n\n emit TokenCreditWithdrawal(_job, _token, _receiver, _amount);\n }\n}\n" - }, - "solidity/contracts/peripherals/jobs/Keep3rJobFundableLiquidity.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport './Keep3rJobOwnership.sol';\nimport '../Keep3rAccountance.sol';\nimport '../Keep3rParameters.sol';\nimport '../../../interfaces/IPairManager.sol';\nimport '../../../interfaces/peripherals/IKeep3rJobs.sol';\n\nimport '../../libraries/FullMath.sol';\n\nimport '@openzeppelin/contracts/security/ReentrancyGuard.sol';\nimport '@openzeppelin/contracts/token/ERC20/IERC20.sol';\nimport '@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol';\nimport '@openzeppelin/contracts/utils/math/Math.sol';\n\nabstract contract Keep3rJobFundableLiquidity is IKeep3rJobFundableLiquidity, ReentrancyGuard, Keep3rJobOwnership, Keep3rParameters {\n using EnumerableSet for EnumerableSet.AddressSet;\n using SafeERC20 for IERC20;\n\n /// @notice List of liquidities that are accepted in the system\n EnumerableSet.AddressSet internal _approvedLiquidities;\n\n /// @inheritdoc IKeep3rJobFundableLiquidity\n mapping(address => mapping(address => uint256)) public override liquidityAmount;\n\n /// @inheritdoc IKeep3rJobFundableLiquidity\n mapping(address => uint256) public override rewardedAt;\n\n /// @inheritdoc IKeep3rJobFundableLiquidity\n mapping(address => uint256) public override workedAt;\n\n /// @notice Tracks an address and returns its TickCache\n mapping(address => TickCache) internal _tick;\n\n // Views\n\n /// @inheritdoc IKeep3rJobFundableLiquidity\n function approvedLiquidities() external view override returns (address[] memory _list) {\n _list = _approvedLiquidities.values();\n }\n\n /// @inheritdoc IKeep3rJobFundableLiquidity\n function jobPeriodCredits(address _job) public view override returns (uint256 _periodCredits) {\n for (uint256 i; i < _jobLiquidities[_job].length(); i++) {\n address _liquidity = _jobLiquidities[_job].at(i);\n if (_approvedLiquidities.contains(_liquidity)) {\n TickCache memory _tickCache = observeLiquidity(_liquidity);\n if (_tickCache.period != 0) {\n int56 _tickDifference = _isKP3RToken0[_liquidity] ? _tickCache.difference : -_tickCache.difference;\n _periodCredits += _getReward(\n IKeep3rHelper(keep3rHelper).getKP3RsAtTick(liquidityAmount[_job][_liquidity], _tickDifference, rewardPeriodTime)\n );\n }\n }\n }\n }\n\n /// @inheritdoc IKeep3rJobFundableLiquidity\n function jobLiquidityCredits(address _job) public view override returns (uint256 _liquidityCredits) {\n uint256 _periodCredits = jobPeriodCredits(_job);\n\n // If the job was rewarded in the past 1 period time\n if ((block.timestamp - rewardedAt[_job]) < rewardPeriodTime) {\n // If the job has period credits, update minted job credits to new twap\n _liquidityCredits = _periodCredits > 0\n ? (_jobLiquidityCredits[_job] * _periodCredits) / _jobPeriodCredits[_job] // If the job has period credits, return remaining job credits updated to new twap\n : _jobLiquidityCredits[_job]; // If not, return remaining credits, forced credits should not be updated\n } else {\n // Else return a full period worth of credits if current credits have expired\n _liquidityCredits = _periodCredits;\n }\n }\n\n /// @inheritdoc IKeep3rJobFundableLiquidity\n function totalJobCredits(address _job) external view override returns (uint256 _credits) {\n uint256 _periodCredits = jobPeriodCredits(_job);\n uint256 _cooldown = block.timestamp;\n\n if ((rewardedAt[_job] > _period(block.timestamp - rewardPeriodTime))) {\n // Will calculate cooldown if it outdated\n if ((block.timestamp - rewardedAt[_job]) >= rewardPeriodTime) {\n // Will calculate cooldown from last reward reference in this period\n _cooldown -= (rewardedAt[_job] + rewardPeriodTime);\n } else {\n // Will calculate cooldown from last reward timestamp\n _cooldown -= rewardedAt[_job];\n }\n } else {\n // Will calculate cooldown from period start if expired\n _cooldown -= _period(block.timestamp);\n }\n _credits = jobLiquidityCredits(_job) + _phase(_cooldown, _periodCredits);\n }\n\n /// @inheritdoc IKeep3rJobFundableLiquidity\n function quoteLiquidity(address _liquidity, uint256 _amount) external view override returns (uint256 _periodCredits) {\n if (_approvedLiquidities.contains(_liquidity)) {\n TickCache memory _tickCache = observeLiquidity(_liquidity);\n if (_tickCache.period != 0) {\n int56 _tickDifference = _isKP3RToken0[_liquidity] ? _tickCache.difference : -_tickCache.difference;\n return _getReward(IKeep3rHelper(keep3rHelper).getKP3RsAtTick(_amount, _tickDifference, rewardPeriodTime));\n }\n }\n }\n\n /// @inheritdoc IKeep3rJobFundableLiquidity\n function observeLiquidity(address _liquidity) public view virtual override returns (TickCache memory _tickCache) {\n if (_tick[_liquidity].period == _period(block.timestamp)) {\n // Will return cached twaps if liquidity is updated\n _tickCache = _tick[_liquidity];\n } else {\n bool success;\n uint256 lastPeriod = _period(block.timestamp - rewardPeriodTime);\n\n if (_tick[_liquidity].period == lastPeriod) {\n // Will only ask for current period accumulator if liquidity is outdated\n uint32[] memory _secondsAgo = new uint32[](1);\n int56 previousTick = _tick[_liquidity].current;\n\n _secondsAgo[0] = uint32(block.timestamp - _period(block.timestamp));\n\n (_tickCache.current, , success) = IKeep3rHelper(keep3rHelper).observe(_liquidityPool[_liquidity], _secondsAgo);\n\n _tickCache.difference = _tickCache.current - previousTick;\n } else if (_tick[_liquidity].period < lastPeriod) {\n // Will ask for 2 accumulators if liquidity is expired\n uint32[] memory _secondsAgo = new uint32[](2);\n\n _secondsAgo[0] = uint32(block.timestamp - _period(block.timestamp));\n _secondsAgo[1] = uint32(block.timestamp - _period(block.timestamp) + rewardPeriodTime);\n\n int56 _tickCumulative2;\n (_tickCache.current, _tickCumulative2, success) = IKeep3rHelper(keep3rHelper).observe(_liquidityPool[_liquidity], _secondsAgo);\n\n _tickCache.difference = _tickCache.current - _tickCumulative2;\n }\n if (success) {\n _tickCache.period = _period(block.timestamp);\n } else {\n delete _tickCache.period;\n }\n }\n }\n\n // Methods\n\n /// @inheritdoc IKeep3rJobFundableLiquidity\n function forceLiquidityCreditsToJob(address _job, uint256 _amount) external override onlyGovernance {\n if (!_jobs.contains(_job)) revert JobUnavailable();\n _settleJobAccountance(_job);\n _jobLiquidityCredits[_job] += _amount;\n emit LiquidityCreditsForced(_job, rewardedAt[_job], _jobLiquidityCredits[_job]);\n }\n\n /// @inheritdoc IKeep3rJobFundableLiquidity\n function approveLiquidity(address _liquidity) external virtual override onlyGovernance {\n if (!_approvedLiquidities.add(_liquidity)) revert LiquidityPairApproved();\n _liquidityPool[_liquidity] = IPairManager(_liquidity).pool();\n _isKP3RToken0[_liquidity] = IKeep3rHelper(keep3rHelper).isKP3RToken0(_liquidityPool[_liquidity]);\n _tick[_liquidity] = observeLiquidity(_liquidity);\n emit LiquidityApproval(_liquidity);\n }\n\n /// @inheritdoc IKeep3rJobFundableLiquidity\n function revokeLiquidity(address _liquidity) external override onlyGovernance {\n if (!_approvedLiquidities.remove(_liquidity)) revert LiquidityPairUnexistent();\n delete _liquidityPool[_liquidity];\n delete _isKP3RToken0[_liquidity];\n delete _tick[_liquidity];\n\n emit LiquidityRevocation(_liquidity);\n }\n\n /// @inheritdoc IKeep3rJobFundableLiquidity\n function addLiquidityToJob(\n address _job,\n address _liquidity,\n uint256 _amount\n ) external override nonReentrant {\n if (!_approvedLiquidities.contains(_liquidity)) revert LiquidityPairUnapproved();\n if (!_jobs.contains(_job)) revert JobUnavailable();\n\n _jobLiquidities[_job].add(_liquidity);\n\n _settleJobAccountance(_job);\n\n if (_quoteLiquidity(liquidityAmount[_job][_liquidity] + _amount, _liquidity) < liquidityMinimum) revert JobLiquidityLessThanMin();\n\n emit LiquidityCreditsReward(_job, rewardedAt[_job], _jobLiquidityCredits[_job], _jobPeriodCredits[_job]);\n\n IERC20(_liquidity).safeTransferFrom(msg.sender, address(this), _amount);\n liquidityAmount[_job][_liquidity] += _amount;\n _jobPeriodCredits[_job] += _getReward(_quoteLiquidity(_amount, _liquidity));\n emit LiquidityAddition(_job, _liquidity, msg.sender, _amount);\n }\n\n /// @inheritdoc IKeep3rJobFundableLiquidity\n function unbondLiquidityFromJob(\n address _job,\n address _liquidity,\n uint256 _amount\n ) external override onlyJobOwner(_job) {\n canWithdrawAfter[_job][_liquidity] = block.timestamp + unbondTime;\n pendingUnbonds[_job][_liquidity] += _amount;\n _unbondLiquidityFromJob(_job, _liquidity, _amount);\n\n uint256 _remainingLiquidity = liquidityAmount[_job][_liquidity];\n if (_remainingLiquidity > 0 && _quoteLiquidity(_remainingLiquidity, _liquidity) < liquidityMinimum) revert JobLiquidityLessThanMin();\n\n emit Unbonding(_job, _liquidity, _amount);\n }\n\n /// @inheritdoc IKeep3rJobFundableLiquidity\n function withdrawLiquidityFromJob(\n address _job,\n address _liquidity,\n address _receiver\n ) external override onlyJobOwner(_job) {\n if (_receiver == address(0)) revert ZeroAddress();\n if (pendingUnbonds[_job][_liquidity] == 0) revert UnbondsUnexistent();\n if (canWithdrawAfter[_job][_liquidity] >= block.timestamp) revert UnbondsLocked();\n if (disputes[_job]) revert Disputed();\n\n uint256 _amount = pendingUnbonds[_job][_liquidity];\n\n delete pendingUnbonds[_job][_liquidity];\n delete canWithdrawAfter[_job][_liquidity];\n\n IERC20(_liquidity).safeTransfer(_receiver, _amount);\n emit LiquidityWithdrawal(_job, _liquidity, _receiver, _amount);\n }\n\n // Internal functions\n\n /// @notice Updates or rewards job liquidity credits depending on time since last job reward\n function _updateJobCreditsIfNeeded(address _job) internal returns (bool _rewarded) {\n if (rewardedAt[_job] < _period(block.timestamp)) {\n // Will exit function if job has been rewarded in current period\n if (rewardedAt[_job] <= _period(block.timestamp - rewardPeriodTime)) {\n // Will reset job to period syncronicity if a full period passed without rewards\n _updateJobPeriod(_job);\n _jobLiquidityCredits[_job] = _jobPeriodCredits[_job];\n rewardedAt[_job] = _period(block.timestamp);\n _rewarded = true;\n } else if ((block.timestamp - rewardedAt[_job]) >= rewardPeriodTime) {\n // Will reset job's syncronicity if last reward was more than epoch ago\n _updateJobPeriod(_job);\n _jobLiquidityCredits[_job] = _jobPeriodCredits[_job];\n rewardedAt[_job] += rewardPeriodTime;\n _rewarded = true;\n } else if (workedAt[_job] < _period(block.timestamp)) {\n // First keeper on period has to update job accountance to current twaps\n uint256 previousPeriodCredits = _jobPeriodCredits[_job];\n _updateJobPeriod(_job);\n _jobLiquidityCredits[_job] = (_jobLiquidityCredits[_job] * _jobPeriodCredits[_job]) / previousPeriodCredits;\n // Updating job accountance does not reward job\n }\n }\n }\n\n /// @notice Only called if _jobLiquidityCredits < payment\n function _rewardJobCredits(address _job) internal {\n /// @notice Only way to += jobLiquidityCredits is when keeper rewarding (cannot pay work)\n /* WARNING: this allows to top up _jobLiquidityCredits to a max of 1.99 but have to spend at least 1 */\n _jobLiquidityCredits[_job] += _phase(block.timestamp - rewardedAt[_job], _jobPeriodCredits[_job]);\n rewardedAt[_job] = block.timestamp;\n }\n\n /// @notice Updates accountance for _jobPeriodCredits\n function _updateJobPeriod(address _job) internal {\n _jobPeriodCredits[_job] = _calculateJobPeriodCredits(_job);\n }\n\n /// @notice Quotes the outdated job liquidities and calculates _periodCredits\n /// @dev This function is also responsible for keeping the KP3R/WETH quote updated\n function _calculateJobPeriodCredits(address _job) internal returns (uint256 _periodCredits) {\n for (uint256 i; i < _jobLiquidities[_job].length(); i++) {\n address _liquidity = _jobLiquidities[_job].at(i);\n if (_approvedLiquidities.contains(_liquidity)) {\n if (_tick[_liquidity].period != _period(block.timestamp)) {\n // Updates liquidity cache only if needed\n _tick[_liquidity] = observeLiquidity(_liquidity);\n }\n _periodCredits += _getReward(_quoteLiquidity(liquidityAmount[_job][_liquidity], _liquidity));\n }\n }\n }\n\n /// @notice Updates job accountance calculating the impact of the unbonded liquidity amount\n function _unbondLiquidityFromJob(\n address _job,\n address _liquidity,\n uint256 _amount\n ) internal nonReentrant {\n if (!_jobLiquidities[_job].contains(_liquidity)) revert JobLiquidityUnexistent();\n if (liquidityAmount[_job][_liquidity] < _amount) revert JobLiquidityInsufficient();\n\n // Ensures current twaps in job liquidities\n _updateJobPeriod(_job);\n uint256 _periodCreditsToRemove = _getReward(_quoteLiquidity(_amount, _liquidity));\n\n // A liquidity can be revoked causing a job to have 0 periodCredits\n if (_jobPeriodCredits[_job] > 0) {\n // Removes a % correspondant to a full rewardPeriodTime for the liquidity withdrawn vs all of the liquidities\n _jobLiquidityCredits[_job] -= (_jobLiquidityCredits[_job] * _periodCreditsToRemove) / _jobPeriodCredits[_job];\n _jobPeriodCredits[_job] -= _periodCreditsToRemove;\n }\n\n liquidityAmount[_job][_liquidity] -= _amount;\n if (liquidityAmount[_job][_liquidity] == 0) {\n _jobLiquidities[_job].remove(_liquidity);\n }\n }\n\n /// @notice Returns a fraction of the multiplier or the whole multiplier if equal or more than a rewardPeriodTime has passed\n function _phase(uint256 _timePassed, uint256 _multiplier) internal view returns (uint256 _result) {\n if (_timePassed < rewardPeriodTime) {\n _result = (_timePassed * _multiplier) / rewardPeriodTime;\n } else _result = _multiplier;\n }\n\n /// @notice Returns the start of the period of the provided timestamp\n function _period(uint256 _timestamp) internal view returns (uint256 _periodTimestamp) {\n return _timestamp - (_timestamp % rewardPeriodTime);\n }\n\n /// @notice Calculates relation between rewardPeriod and inflationPeriod\n function _getReward(uint256 _baseAmount) internal view returns (uint256 _credits) {\n return FullMath.mulDiv(_baseAmount, rewardPeriodTime, inflationPeriod);\n }\n\n /// @notice Returns underlying KP3R amount for a given liquidity amount\n function _quoteLiquidity(uint256 _amount, address _liquidity) internal view returns (uint256 _quote) {\n if (_tick[_liquidity].period != 0) {\n int56 _tickDifference = _isKP3RToken0[_liquidity] ? _tick[_liquidity].difference : -_tick[_liquidity].difference;\n _quote = IKeep3rHelper(keep3rHelper).getKP3RsAtTick(_amount, _tickDifference, rewardPeriodTime);\n }\n }\n\n /// @notice Updates job credits to current quotes and rewards job's pending minted credits\n /// @dev Ensures a maximum of 1 period of credits\n function _settleJobAccountance(address _job) internal virtual {\n _updateJobCreditsIfNeeded(_job);\n _rewardJobCredits(_job);\n _jobLiquidityCredits[_job] = Math.min(_jobLiquidityCredits[_job], _jobPeriodCredits[_job]);\n }\n}\n" - }, - "solidity/contracts/peripherals/Keep3rParameters.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../../interfaces/IKeep3rHelper.sol';\nimport '../../interfaces/peripherals/IKeep3rParameters.sol';\nimport './Keep3rAccountance.sol';\n\nabstract contract Keep3rParameters is IKeep3rParameters, Keep3rAccountance {\n /// @inheritdoc IKeep3rParameters\n address public override keep3rV1;\n\n /// @inheritdoc IKeep3rParameters\n address public override keep3rV1Proxy;\n\n /// @inheritdoc IKeep3rParameters\n address public override keep3rHelper;\n\n /// @inheritdoc IKeep3rParameters\n uint256 public override bondTime = 3 days;\n\n /// @inheritdoc IKeep3rParameters\n uint256 public override unbondTime = 14 days;\n\n /// @inheritdoc IKeep3rParameters\n uint256 public override liquidityMinimum = 3 ether;\n\n /// @inheritdoc IKeep3rParameters\n uint256 public override rewardPeriodTime = 5 days;\n\n /// @inheritdoc IKeep3rParameters\n uint256 public override inflationPeriod = 34 days;\n\n /// @inheritdoc IKeep3rParameters\n uint256 public override fee = 30;\n\n /// @notice The base that will be used to calculate the fee\n uint256 internal constant _BASE = 10_000;\n\n /// @notice The minimum reward period\n uint256 internal constant _MIN_REWARD_PERIOD_TIME = 1 days;\n\n constructor(\n address _keep3rHelper,\n address _keep3rV1,\n address _keep3rV1Proxy\n ) {\n keep3rHelper = _keep3rHelper;\n keep3rV1 = _keep3rV1;\n keep3rV1Proxy = _keep3rV1Proxy;\n }\n\n /// @inheritdoc IKeep3rParameters\n function setKeep3rHelper(address _keep3rHelper) external override onlyGovernance {\n if (_keep3rHelper == address(0)) revert ZeroAddress();\n keep3rHelper = _keep3rHelper;\n emit Keep3rHelperChange(_keep3rHelper);\n }\n\n /// @inheritdoc IKeep3rParameters\n function setKeep3rV1(address _keep3rV1) external override onlyGovernance {\n if (_keep3rV1 == address(0)) revert ZeroAddress();\n keep3rV1 = _keep3rV1;\n emit Keep3rV1Change(_keep3rV1);\n }\n\n /// @inheritdoc IKeep3rParameters\n function setKeep3rV1Proxy(address _keep3rV1Proxy) external override onlyGovernance {\n if (_keep3rV1Proxy == address(0)) revert ZeroAddress();\n keep3rV1Proxy = _keep3rV1Proxy;\n emit Keep3rV1ProxyChange(_keep3rV1Proxy);\n }\n\n /// @inheritdoc IKeep3rParameters\n function setBondTime(uint256 _bondTime) external override onlyGovernance {\n bondTime = _bondTime;\n emit BondTimeChange(_bondTime);\n }\n\n /// @inheritdoc IKeep3rParameters\n function setUnbondTime(uint256 _unbondTime) external override onlyGovernance {\n unbondTime = _unbondTime;\n emit UnbondTimeChange(_unbondTime);\n }\n\n /// @inheritdoc IKeep3rParameters\n function setLiquidityMinimum(uint256 _liquidityMinimum) external override onlyGovernance {\n liquidityMinimum = _liquidityMinimum;\n emit LiquidityMinimumChange(_liquidityMinimum);\n }\n\n /// @inheritdoc IKeep3rParameters\n // TODO: check what happens to credit minting when changing this. Shouldn't we update the cached ticks?\n function setRewardPeriodTime(uint256 _rewardPeriodTime) external override onlyGovernance {\n if (_rewardPeriodTime < _MIN_REWARD_PERIOD_TIME) revert MinRewardPeriod();\n rewardPeriodTime = _rewardPeriodTime;\n emit RewardPeriodTimeChange(_rewardPeriodTime);\n }\n\n /// @inheritdoc IKeep3rParameters\n function setInflationPeriod(uint256 _inflationPeriod) external override onlyGovernance {\n inflationPeriod = _inflationPeriod;\n emit InflationPeriodChange(_inflationPeriod);\n }\n\n /// @inheritdoc IKeep3rParameters\n function setFee(uint256 _fee) external override onlyGovernance {\n fee = _fee;\n emit FeeChange(_fee);\n }\n}\n" - }, - "@openzeppelin/contracts/security/ReentrancyGuard.sol": { - "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Contract module that helps prevent reentrant calls to a function.\n *\n * Inheriting from `ReentrancyGuard` will make the {nonReentrant} modifier\n * available, which can be applied to functions to make sure there are no nested\n * (reentrant) calls to them.\n *\n * Note that because there is a single `nonReentrant` guard, functions marked as\n * `nonReentrant` may not call one another. This can be worked around by making\n * those functions `private`, and then adding `external` `nonReentrant` entry\n * points to them.\n *\n * TIP: If you would like to learn more about reentrancy and alternative ways\n * to protect against it, check out our blog post\n * https://blog.openzeppelin.com/reentrancy-after-istanbul/[Reentrancy After Istanbul].\n */\nabstract contract ReentrancyGuard {\n // Booleans are more expensive than uint256 or any type that takes up a full\n // word because each write operation emits an extra SLOAD to first read the\n // slot's contents, replace the bits taken up by the boolean, and then write\n // back. This is the compiler's defense against contract upgrades and\n // pointer aliasing, and it cannot be disabled.\n\n // The values being non-zero value makes deployment a bit more expensive,\n // but in exchange the refund on every call to nonReentrant will be lower in\n // amount. Since refunds are capped to a percentage of the total\n // transaction's gas, it is best to keep them low in cases like this one, to\n // increase the likelihood of the full refund coming into effect.\n uint256 private constant _NOT_ENTERED = 1;\n uint256 private constant _ENTERED = 2;\n\n uint256 private _status;\n\n constructor() {\n _status = _NOT_ENTERED;\n }\n\n /**\n * @dev Prevents a contract from calling itself, directly or indirectly.\n * Calling a `nonReentrant` function from another `nonReentrant`\n * function is not supported. It is possible to prevent this from happening\n * by making the `nonReentrant` function external, and make it call a\n * `private` function that does the actual work.\n */\n modifier nonReentrant() {\n // On the first call to nonReentrant, _notEntered will be true\n require(_status != _ENTERED, \"ReentrancyGuard: reentrant call\");\n\n // Any calls to nonReentrant after this point will fail\n _status = _ENTERED;\n\n _;\n\n // By storing the original value once again, a refund is triggered (see\n // https://eips.ethereum.org/EIPS/eip-2200)\n _status = _NOT_ENTERED;\n }\n}\n" - }, - "@openzeppelin/contracts/utils/math/Math.sol": { - "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Standard math utilities missing in the Solidity language.\n */\nlibrary Math {\n /**\n * @dev Returns the largest of two numbers.\n */\n function max(uint256 a, uint256 b) internal pure returns (uint256) {\n return a >= b ? a : b;\n }\n\n /**\n * @dev Returns the smallest of two numbers.\n */\n function min(uint256 a, uint256 b) internal pure returns (uint256) {\n return a < b ? a : b;\n }\n\n /**\n * @dev Returns the average of two numbers. The result is rounded towards\n * zero.\n */\n function average(uint256 a, uint256 b) internal pure returns (uint256) {\n // (a + b) / 2 can overflow.\n return (a & b) + (a ^ b) / 2;\n }\n\n /**\n * @dev Returns the ceiling of the division of two numbers.\n *\n * This differs from standard division with `/` in that it rounds up instead\n * of rounding down.\n */\n function ceilDiv(uint256 a, uint256 b) internal pure returns (uint256) {\n // (a + b - 1) / b can overflow on addition, so we distribute.\n return a / b + (a % b == 0 ? 0 : 1);\n }\n}\n" - }, - "solidity/interfaces/IKeep3rHelperParameters.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\n/// @title Keep3rHelperParameters contract\n/// @notice Contains all the helper functions used throughout the different files.\ninterface IKeep3rHelperParameters {\n // Structs\n\n /// @dev KP3R-WETH Pool address and isKP3RToken0\n /// @dev Created in order to save gas by avoiding calls to pool's token0 method\n struct TokenOraclePool {\n address poolAddress;\n bool isTKNToken0;\n }\n\n // Errors\n\n /// @notice Throws when pool does not have KP3R as token0 nor token1\n error InvalidOraclePool();\n\n // Events\n\n /// @notice Emitted when the kp3r weth pool is changed\n /// @param _address Address of the new kp3r weth pool\n /// @param _isKP3RToken0 True if calling the token0 method of the pool returns the KP3R token address\n event Kp3rWethPoolChange(address _address, bool _isKP3RToken0);\n\n /// @notice Emitted when the minimum boost multiplier is changed\n /// @param _minBoost The minimum boost multiplier\n event MinBoostChange(uint256 _minBoost);\n\n /// @notice Emitted when the maximum boost multiplier is changed\n /// @param _maxBoost The maximum boost multiplier\n event MaxBoostChange(uint256 _maxBoost);\n\n /// @notice Emitted when the target bond amount is changed\n /// @param _targetBond The target bond amount\n event TargetBondChange(uint256 _targetBond);\n\n /// @notice Emitted when the Keep3r V2 address is changed\n /// @param _keep3rV2 The address of Keep3r V2\n event Keep3rV2Change(address _keep3rV2);\n\n /// @notice Emitted when the work extra gas amount is changed\n /// @param _workExtraGas The work extra gas\n event WorkExtraGasChange(uint256 _workExtraGas);\n\n /// @notice Emitted when the quote twap time is changed\n /// @param _quoteTwapTime The twap time for quoting\n event QuoteTwapTimeChange(uint32 _quoteTwapTime);\n\n /// @notice Emitted when minimum rewarded gas fee is changed\n /// @param _minBaseFee The minimum rewarded gas fee\n event MinBaseFeeChange(uint256 _minBaseFee);\n\n /// @notice Emitted when minimum rewarded priority fee is changed\n /// @param _minPriorityFee The minimum expected fee that the keeper should pay\n event MinPriorityFeeChange(uint256 _minPriorityFee);\n\n // Variables\n\n /// @notice Address of KP3R token\n /// @return _kp3r Address of KP3R token\n // solhint-disable func-name-mixedcase\n function KP3R() external view returns (address _kp3r);\n\n /// @notice The boost base used to calculate the boost rewards for the keeper\n /// @return _base The boost base number\n function BOOST_BASE() external view returns (uint256 _base);\n\n /// @notice KP3R-WETH pool that is being used as oracle\n /// @return poolAddress Address of the pool\n /// @return isTKNToken0 True if calling the token0 method of the pool returns the KP3R token address\n function kp3rWethPool() external view returns (address poolAddress, bool isTKNToken0);\n\n /// @notice The minimum multiplier used to calculate the amount of gas paid to the Keeper for the gas used to perform a job\n /// For example: if the quoted gas used is 1000, then the minimum amount to be paid will be 1000 * minBoost / BOOST_BASE\n /// @return _multiplier The minimum boost multiplier\n function minBoost() external view returns (uint256 _multiplier);\n\n /// @notice The maximum multiplier used to calculate the amount of gas paid to the Keeper for the gas used to perform a job\n /// For example: if the quoted gas used is 1000, then the maximum amount to be paid will be 1000 * maxBoost / BOOST_BASE\n /// @return _multiplier The maximum boost multiplier\n function maxBoost() external view returns (uint256 _multiplier);\n\n /// @notice The targeted amount of bonded KP3Rs to max-up reward multiplier\n /// For example: if the amount of KP3R the keeper has bonded is targetBond or more, then the keeper will get\n /// the maximum boost possible in his rewards, if it's less, the reward boost will be proportional\n /// @return _target The amount of KP3R that comforms the targetBond\n function targetBond() external view returns (uint256 _target);\n\n /// @notice The amount of unaccounted gas that is going to be added to keeper payments\n /// @return _workExtraGas The work unaccounted gas amount\n function workExtraGas() external view returns (uint256 _workExtraGas);\n\n /// @notice The twap time for quoting\n /// @return _quoteTwapTime The twap time\n function quoteTwapTime() external view returns (uint32 _quoteTwapTime);\n\n /// @notice The minimum base fee that is used to calculate keeper rewards\n /// @return _minBaseFee The minimum rewarded gas fee\n function minBaseFee() external view returns (uint256 _minBaseFee);\n\n /// @notice The minimum priority fee that is also rewarded for keepers\n /// @return _minPriorityFee The minimum rewarded priority fee\n function minPriorityFee() external view returns (uint256 _minPriorityFee);\n\n /// @notice Address of Keep3r V2\n /// @return _keep3rV2 Address of Keep3r V2\n function keep3rV2() external view returns (address _keep3rV2);\n\n // Methods\n\n /// @notice Sets KP3R-WETH pool\n /// @param _poolAddress The address of the KP3R-WETH pool\n function setKp3rWethPool(address _poolAddress) external;\n\n /// @notice Sets the minimum boost multiplier\n /// @param _minBoost The minimum boost multiplier\n function setMinBoost(uint256 _minBoost) external;\n\n /// @notice Sets the maximum boost multiplier\n /// @param _maxBoost The maximum boost multiplier\n function setMaxBoost(uint256 _maxBoost) external;\n\n /// @notice Sets the target bond amount\n /// @param _targetBond The target bond amount\n function setTargetBond(uint256 _targetBond) external;\n\n /// @notice Sets the Keep3r V2 address\n /// @param _keep3rV2 The address of Keep3r V2\n function setKeep3rV2(address _keep3rV2) external;\n\n /// @notice Sets the work extra gas amount\n /// @param _workExtraGas The work extra gas\n function setWorkExtraGas(uint256 _workExtraGas) external;\n\n /// @notice Sets the quote twap time\n /// @param _quoteTwapTime The twap time for quoting\n function setQuoteTwapTime(uint32 _quoteTwapTime) external;\n\n /// @notice Sets the minimum rewarded gas fee\n /// @param _minBaseFee The minimum rewarded gas fee\n function setMinBaseFee(uint256 _minBaseFee) external;\n\n /// @notice Sets the minimum rewarded gas priority fee\n /// @param _minPriorityFee The minimum rewarded priority fee\n function setMinPriorityFee(uint256 _minPriorityFee) external;\n}\n" - }, - "solidity/interfaces/IPairManager.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol';\n\n/// @title Pair Manager interface\n/// @notice Generic interface for Keep3r liquidity pools (kLP)\ninterface IPairManager is IERC20Metadata {\n /// @notice Address of the factory from which the pair manager was created\n /// @return _factory The address of the PairManager Factory\n function factory() external view returns (address _factory);\n\n /// @notice Address of the pool from which the Keep3r pair manager will interact with\n /// @return _pool The address of the pool\n function pool() external view returns (address _pool);\n\n /// @notice Token0 of the pool\n /// @return _token0 The address of token0\n function token0() external view returns (address _token0);\n\n /// @notice Token1 of the pool\n /// @return _token1 The address of token1\n function token1() external view returns (address _token1);\n}\n" - }, - "solidity/contracts/libraries/FullMath.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\n/// @title Contains 512-bit math functions\n/// @notice Facilitates multiplication and division that can have overflow of an intermediate value without any loss of precision\n/// @dev Handles \"phantom overflow\" i.e., allows multiplication and division where an intermediate value overflows 256 bits\nlibrary FullMath {\n /// @notice Calculates floor(a×b÷denominator) with full precision. Throws if result overflows a uint256 or denominator == 0\n /// @param a The multiplicand\n /// @param b The multiplier\n /// @param denominator The divisor\n /// @return result The 256-bit result\n /// @dev Credit to Remco Bloemen under MIT license https://xn--2-umb.com/21/muldiv\n function mulDiv(\n uint256 a,\n uint256 b,\n uint256 denominator\n ) internal pure returns (uint256 result) {\n unchecked {\n // 512-bit multiply [prod1 prod0] = a * b\n // Compute the product mod 2**256 and mod 2**256 - 1\n // then use the Chinese Remainder Theorem to reconstruct\n // the 512 bit result. The result is stored in two 256\n // variables such that product = prod1 * 2**256 + prod0\n uint256 prod0; // Least significant 256 bits of the product\n uint256 prod1; // Most significant 256 bits of the product\n assembly {\n let mm := mulmod(a, b, not(0))\n prod0 := mul(a, b)\n prod1 := sub(sub(mm, prod0), lt(mm, prod0))\n }\n\n // Handle non-overflow cases, 256 by 256 division\n if (prod1 == 0) {\n require(denominator > 0);\n assembly {\n result := div(prod0, denominator)\n }\n return result;\n }\n\n // Make sure the result is less than 2**256.\n // Also prevents denominator == 0\n require(denominator > prod1);\n\n ///////////////////////////////////////////////\n // 512 by 256 division.\n ///////////////////////////////////////////////\n\n // Make division exact by subtracting the remainder from [prod1 prod0]\n // Compute remainder using mulmod\n uint256 remainder;\n assembly {\n remainder := mulmod(a, b, denominator)\n }\n // Subtract 256 bit number from 512 bit number\n assembly {\n prod1 := sub(prod1, gt(remainder, prod0))\n prod0 := sub(prod0, remainder)\n }\n\n // Factor powers of two out of denominator\n // Compute largest power of two divisor of denominator.\n // Always >= 1.\n uint256 twos = (~denominator + 1) & denominator;\n // Divide denominator by power of two\n assembly {\n denominator := div(denominator, twos)\n }\n\n // Divide [prod1 prod0] by the factors of two\n assembly {\n prod0 := div(prod0, twos)\n }\n // Shift in bits from prod1 into prod0. For this we need\n // to flip `twos` such that it is 2**256 / twos.\n // If twos is zero, then it becomes one\n assembly {\n twos := add(div(sub(0, twos), twos), 1)\n }\n prod0 |= prod1 * twos;\n\n // Invert denominator mod 2**256\n // Now that denominator is an odd number, it has an inverse\n // modulo 2**256 such that denominator * inv = 1 mod 2**256.\n // Compute the inverse by starting with a seed that is correct\n // correct for four bits. That is, denominator * inv = 1 mod 2**4\n uint256 inv = (3 * denominator) ^ 2;\n // Now use Newton-Raphson iteration to improve the precision.\n // Thanks to Hensel's lifting lemma, this also works in modular\n // arithmetic, doubling the correct bits in each step.\n inv *= 2 - denominator * inv; // inverse mod 2**8\n inv *= 2 - denominator * inv; // inverse mod 2**16\n inv *= 2 - denominator * inv; // inverse mod 2**32\n inv *= 2 - denominator * inv; // inverse mod 2**64\n inv *= 2 - denominator * inv; // inverse mod 2**128\n inv *= 2 - denominator * inv; // inverse mod 2**256\n\n // Because the division is now exact we can divide by multiplying\n // with the modular inverse of denominator. This will give us the\n // correct result modulo 2**256. Since the precoditions guarantee\n // that the outcome is less than 2**256, this is the final result.\n // We don't need to compute the high bits of the result and prod1\n // is no longer required.\n result = prod0 * inv;\n return result;\n }\n }\n\n /// @notice Calculates ceil(a×b÷denominator) with full precision. Throws if result overflows a uint256 or denominator == 0\n /// @param a The multiplicand\n /// @param b The multiplier\n /// @param denominator The divisor\n /// @return result The 256-bit result\n function mulDivRoundingUp(\n uint256 a,\n uint256 b,\n uint256 denominator\n ) internal pure returns (uint256 result) {\n unchecked {\n result = mulDiv(a, b, denominator);\n if (mulmod(a, b, denominator) > 0) {\n require(result < type(uint256).max);\n result++;\n }\n }\n }\n}\n" - }, - "@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol": { - "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\nimport \"../IERC20.sol\";\n\n/**\n * @dev Interface for the optional metadata functions from the ERC20 standard.\n *\n * _Available since v4.1._\n */\ninterface IERC20Metadata is IERC20 {\n /**\n * @dev Returns the name of the token.\n */\n function name() external view returns (string memory);\n\n /**\n * @dev Returns the symbol of the token.\n */\n function symbol() external view returns (string memory);\n\n /**\n * @dev Returns the decimals places of the token.\n */\n function decimals() external view returns (uint8);\n}\n" - }, - "solidity/contracts/peripherals/Keep3rDisputable.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport './Keep3rParameters.sol';\nimport '../../interfaces/peripherals/IKeep3rDisputable.sol';\n\nabstract contract Keep3rDisputable is IKeep3rDisputable, Keep3rParameters {\n /// @inheritdoc IKeep3rDisputable\n function dispute(address _jobOrKeeper) external override onlyDisputer {\n if (disputes[_jobOrKeeper]) revert AlreadyDisputed();\n disputes[_jobOrKeeper] = true;\n emit Dispute(_jobOrKeeper, msg.sender);\n }\n\n /// @inheritdoc IKeep3rDisputable\n function resolve(address _jobOrKeeper) external override onlyDisputer {\n if (!disputes[_jobOrKeeper]) revert NotDisputed();\n disputes[_jobOrKeeper] = false;\n emit Resolve(_jobOrKeeper, msg.sender);\n }\n}\n" - }, - "solidity/contracts/peripherals/keepers/Keep3rKeeperDisputable.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport './Keep3rKeeperFundable.sol';\nimport '../Keep3rDisputable.sol';\nimport '../../../interfaces/external/IKeep3rV1.sol';\nimport '../../../interfaces/peripherals/IKeep3rKeepers.sol';\n\nabstract contract Keep3rKeeperDisputable is IKeep3rKeeperDisputable, Keep3rDisputable, Keep3rKeeperFundable {\n using EnumerableSet for EnumerableSet.AddressSet;\n using SafeERC20 for IERC20;\n\n /// @inheritdoc IKeep3rKeeperDisputable\n function slash(\n address _keeper,\n address _bonded,\n uint256 _bondAmount,\n uint256 _unbondAmount\n ) external override onlySlasher {\n if (!disputes[_keeper]) revert NotDisputed();\n _slash(_keeper, _bonded, _bondAmount, _unbondAmount);\n emit KeeperSlash(_keeper, msg.sender, _bondAmount + _unbondAmount);\n }\n\n /// @inheritdoc IKeep3rKeeperDisputable\n function revoke(address _keeper) external override onlySlasher {\n if (!disputes[_keeper]) revert NotDisputed();\n _keepers.remove(_keeper);\n _slash(_keeper, keep3rV1, bonds[_keeper][keep3rV1], pendingUnbonds[_keeper][keep3rV1]);\n emit KeeperRevoke(_keeper, msg.sender);\n }\n\n function _slash(\n address _keeper,\n address _bonded,\n uint256 _bondAmount,\n uint256 _unbondAmount\n ) internal {\n if (_bonded != keep3rV1) {\n try IERC20(_bonded).transfer(governance, _bondAmount + _unbondAmount) returns (bool) {} catch (bytes memory) {}\n }\n bonds[_keeper][_bonded] -= _bondAmount;\n pendingUnbonds[_keeper][_bonded] -= _unbondAmount;\n }\n}\n" - }, - "solidity/contracts/peripherals/keepers/Keep3rKeeperFundable.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../Keep3rAccountance.sol';\nimport '../Keep3rParameters.sol';\nimport '../../../interfaces/peripherals/IKeep3rKeepers.sol';\n\nimport '../../../interfaces/external/IKeep3rV1.sol';\nimport '../../../interfaces/external/IKeep3rV1Proxy.sol';\n\nimport '@openzeppelin/contracts/security/ReentrancyGuard.sol';\nimport '@openzeppelin/contracts/token/ERC20/IERC20.sol';\nimport '@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol';\n\nabstract contract Keep3rKeeperFundable is IKeep3rKeeperFundable, ReentrancyGuard, Keep3rParameters {\n using EnumerableSet for EnumerableSet.AddressSet;\n using SafeERC20 for IERC20;\n\n /// @inheritdoc IKeep3rKeeperFundable\n function bond(address _bonding, uint256 _amount) external override nonReentrant {\n if (disputes[msg.sender]) revert Disputed();\n if (_jobs.contains(msg.sender)) revert AlreadyAJob();\n canActivateAfter[msg.sender][_bonding] = block.timestamp + bondTime;\n\n uint256 _before = IERC20(_bonding).balanceOf(address(this));\n IERC20(_bonding).safeTransferFrom(msg.sender, address(this), _amount);\n _amount = IERC20(_bonding).balanceOf(address(this)) - _before;\n\n hasBonded[msg.sender] = true;\n pendingBonds[msg.sender][_bonding] += _amount;\n\n emit Bonding(msg.sender, _bonding, _amount);\n }\n\n /// @inheritdoc IKeep3rKeeperFundable\n function activate(address _bonding) external override {\n address _keeper = msg.sender;\n if (disputes[_keeper]) revert Disputed();\n uint256 _canActivateAfter = canActivateAfter[_keeper][_bonding];\n if (_canActivateAfter == 0) revert BondsUnexistent();\n if (_canActivateAfter >= block.timestamp) revert BondsLocked();\n\n if (firstSeen[_keeper] == 0) {\n firstSeen[_keeper] = block.timestamp;\n }\n _keepers.add(_keeper);\n\n uint256 _amount = pendingBonds[_keeper][_bonding];\n delete pendingBonds[_keeper][_bonding];\n\n _activate(_keeper, _bonding, _amount);\n emit Activation(_keeper, _bonding, _amount);\n }\n\n /// @inheritdoc IKeep3rKeeperFundable\n function unbond(address _bonding, uint256 _amount) external override {\n canWithdrawAfter[msg.sender][_bonding] = block.timestamp + unbondTime;\n bonds[msg.sender][_bonding] -= _amount;\n pendingUnbonds[msg.sender][_bonding] += _amount;\n\n emit Unbonding(msg.sender, _bonding, _amount);\n }\n\n /// @inheritdoc IKeep3rKeeperFundable\n function withdraw(address _bonding) external override nonReentrant {\n if (pendingUnbonds[msg.sender][_bonding] == 0) revert UnbondsUnexistent();\n if (canWithdrawAfter[msg.sender][_bonding] >= block.timestamp) revert UnbondsLocked();\n if (disputes[msg.sender]) revert Disputed();\n\n uint256 _amount = pendingUnbonds[msg.sender][_bonding];\n\n delete pendingUnbonds[msg.sender][_bonding];\n delete canWithdrawAfter[msg.sender][_bonding];\n\n if (_bonding == keep3rV1) _mint(_amount);\n IERC20(_bonding).safeTransfer(msg.sender, _amount);\n\n emit Withdrawal(msg.sender, _bonding, _amount);\n }\n\n function _mint(uint256 _amount) internal virtual {\n IKeep3rV1Proxy(keep3rV1Proxy).mint(_amount);\n }\n\n function _activate(\n address _keeper,\n address _bonding,\n uint256 _amount\n ) internal virtual {\n // bond provided tokens\n bonds[_keeper][_bonding] += _amount;\n if (_bonding == keep3rV1) {\n IKeep3rV1(keep3rV1).burn(_amount);\n }\n }\n}\n" - }, - "solidity/interfaces/external/IKeep3rV1.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '@openzeppelin/contracts/token/ERC20/IERC20.sol';\nimport '@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol';\n\n// solhint-disable func-name-mixedcase\ninterface IKeep3rV1 is IERC20, IERC20Metadata {\n // Structs\n struct Checkpoint {\n uint32 fromBlock;\n uint256 votes;\n }\n\n // Events\n event DelegateChanged(address indexed _delegator, address indexed _fromDelegate, address indexed _toDelegate);\n event DelegateVotesChanged(address indexed _delegate, uint256 _previousBalance, uint256 _newBalance);\n event SubmitJob(address indexed _job, address indexed _liquidity, address indexed _provider, uint256 _block, uint256 _credit);\n event ApplyCredit(address indexed _job, address indexed _liquidity, address indexed _provider, uint256 _block, uint256 _credit);\n event RemoveJob(address indexed _job, address indexed _liquidity, address indexed _provider, uint256 _block, uint256 _credit);\n event UnbondJob(address indexed _job, address indexed _liquidity, address indexed _provider, uint256 _block, uint256 _credit);\n event JobAdded(address indexed _job, uint256 _block, address _governance);\n event JobRemoved(address indexed _job, uint256 _block, address _governance);\n event KeeperWorked(address indexed _credit, address indexed _job, address indexed _keeper, uint256 _block, uint256 _amount);\n event KeeperBonding(address indexed _keeper, uint256 _block, uint256 _active, uint256 _bond);\n event KeeperBonded(address indexed _keeper, uint256 _block, uint256 _activated, uint256 _bond);\n event KeeperUnbonding(address indexed _keeper, uint256 _block, uint256 _deactive, uint256 _bond);\n event KeeperUnbound(address indexed _keeper, uint256 _block, uint256 _deactivated, uint256 _bond);\n event KeeperSlashed(address indexed _keeper, address indexed _slasher, uint256 _block, uint256 _slash);\n event KeeperDispute(address indexed _keeper, uint256 _block);\n event KeeperResolved(address indexed _keeper, uint256 _block);\n event TokenCreditAddition(address indexed _credit, address indexed _job, address indexed _creditor, uint256 _block, uint256 _amount);\n\n // Variables\n function KPRH() external returns (address);\n\n function delegates(address _delegator) external view returns (address);\n\n function checkpoints(address _account, uint32 _checkpoint) external view returns (Checkpoint memory);\n\n function numCheckpoints(address _account) external view returns (uint32);\n\n function DOMAIN_TYPEHASH() external returns (bytes32);\n\n function DOMAINSEPARATOR() external returns (bytes32);\n\n function DELEGATION_TYPEHASH() external returns (bytes32);\n\n function PERMIT_TYPEHASH() external returns (bytes32);\n\n function nonces(address _user) external view returns (uint256);\n\n function BOND() external returns (uint256);\n\n function UNBOND() external returns (uint256);\n\n function LIQUIDITYBOND() external returns (uint256);\n\n function FEE() external returns (uint256);\n\n function BASE() external returns (uint256);\n\n function ETH() external returns (address);\n\n function bondings(address _user, address _bonding) external view returns (uint256);\n\n function canWithdrawAfter(address _user, address _bonding) external view returns (uint256);\n\n function pendingUnbonds(address _keeper, address _bonding) external view returns (uint256);\n\n function pendingbonds(address _keeper, address _bonding) external view returns (uint256);\n\n function bonds(address _keeper, address _bonding) external view returns (uint256);\n\n function votes(address _delegator) external view returns (uint256);\n\n function firstSeen(address _keeper) external view returns (uint256);\n\n function disputes(address _keeper) external view returns (bool);\n\n function lastJob(address _keeper) external view returns (uint256);\n\n function workCompleted(address _keeper) external view returns (uint256);\n\n function jobs(address _job) external view returns (bool);\n\n function credits(address _job, address _credit) external view returns (uint256);\n\n function liquidityProvided(\n address _provider,\n address _liquidity,\n address _job\n ) external view returns (uint256);\n\n function liquidityUnbonding(\n address _provider,\n address _liquidity,\n address _job\n ) external view returns (uint256);\n\n function liquidityAmountsUnbonding(\n address _provider,\n address _liquidity,\n address _job\n ) external view returns (uint256);\n\n function jobProposalDelay(address _job) external view returns (uint256);\n\n function liquidityApplied(\n address _provider,\n address _liquidity,\n address _job\n ) external view returns (uint256);\n\n function liquidityAmount(\n address _provider,\n address _liquidity,\n address _job\n ) external view returns (uint256);\n\n function keepers(address _keeper) external view returns (bool);\n\n function blacklist(address _keeper) external view returns (bool);\n\n function keeperList(uint256 _index) external view returns (address);\n\n function jobList(uint256 _index) external view returns (address);\n\n function governance() external returns (address);\n\n function pendingGovernance() external returns (address);\n\n function liquidityAccepted(address _liquidity) external view returns (bool);\n\n function liquidityPairs(uint256 _index) external view returns (address);\n\n // Methods\n function getCurrentVotes(address _account) external view returns (uint256);\n\n function addCreditETH(address _job) external payable;\n\n function addCredit(\n address _credit,\n address _job,\n uint256 _amount\n ) external;\n\n function addVotes(address _voter, uint256 _amount) external;\n\n function removeVotes(address _voter, uint256 _amount) external;\n\n function addKPRCredit(address _job, uint256 _amount) external;\n\n function approveLiquidity(address _liquidity) external;\n\n function revokeLiquidity(address _liquidity) external;\n\n function pairs() external view returns (address[] memory);\n\n function addLiquidityToJob(\n address _liquidity,\n address _job,\n uint256 _amount\n ) external;\n\n function applyCreditToJob(\n address _provider,\n address _liquidity,\n address _job\n ) external;\n\n function unbondLiquidityFromJob(\n address _liquidity,\n address _job,\n uint256 _amount\n ) external;\n\n function removeLiquidityFromJob(address _liquidity, address _job) external;\n\n function mint(uint256 _amount) external;\n\n function burn(uint256 _amount) external;\n\n function worked(address _keeper) external;\n\n function receipt(\n address _credit,\n address _keeper,\n uint256 _amount\n ) external;\n\n function receiptETH(address _keeper, uint256 _amount) external;\n\n function addJob(address _job) external;\n\n function getJobs() external view returns (address[] memory);\n\n function removeJob(address _job) external;\n\n function setKeep3rHelper(address _keep3rHelper) external;\n\n function setGovernance(address _governance) external;\n\n function acceptGovernance() external;\n\n function isKeeper(address _keeper) external returns (bool);\n\n function isMinKeeper(\n address _keeper,\n uint256 _minBond,\n uint256 _earned,\n uint256 _age\n ) external returns (bool);\n\n function isBondedKeeper(\n address _keeper,\n address _bond,\n uint256 _minBond,\n uint256 _earned,\n uint256 _age\n ) external returns (bool);\n\n function bond(address _bonding, uint256 _amount) external;\n\n function getKeepers() external view returns (address[] memory);\n\n function activate(address _bonding) external;\n\n function unbond(address _bonding, uint256 _amount) external;\n\n function slash(\n address _bonded,\n address _keeper,\n uint256 _amount\n ) external;\n\n function withdraw(address _bonding) external;\n\n function dispute(address _keeper) external;\n\n function revoke(address _keeper) external;\n\n function resolve(address _keeper) external;\n\n function permit(\n address _owner,\n address _spender,\n uint256 _amount,\n uint256 _deadline,\n uint8 _v,\n bytes32 _r,\n bytes32 _s\n ) external;\n}\n" - }, - "solidity/interfaces/external/IKeep3rV1Proxy.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../peripherals/IGovernable.sol';\n\ninterface IKeep3rV1Proxy is IGovernable {\n // Structs\n struct Recipient {\n address recipient;\n uint256 caps;\n }\n\n // Variables\n function keep3rV1() external view returns (address);\n\n function minter() external view returns (address);\n\n function next(address) external view returns (uint256);\n\n function caps(address) external view returns (uint256);\n\n function recipients() external view returns (address[] memory);\n\n function recipientsCaps() external view returns (Recipient[] memory);\n\n // Errors\n error Cooldown();\n error NoDrawableAmount();\n error ZeroAddress();\n error OnlyMinter();\n\n // Methods\n function addRecipient(address recipient, uint256 amount) external;\n\n function removeRecipient(address recipient) external;\n\n function draw() external returns (uint256 _amount);\n\n function setKeep3rV1(address _keep3rV1) external;\n\n function setMinter(address _minter) external;\n\n function mint(uint256 _amount) external;\n\n function mint(address _account, uint256 _amount) external;\n\n function setKeep3rV1Governance(address _governance) external;\n\n function acceptKeep3rV1Governance() external;\n\n function dispute(address _keeper) external;\n\n function slash(\n address _bonded,\n address _keeper,\n uint256 _amount\n ) external;\n\n function revoke(address _keeper) external;\n\n function resolve(address _keeper) external;\n\n function addJob(address _job) external;\n\n function removeJob(address _job) external;\n\n function addKPRCredit(address _job, uint256 _amount) external;\n\n function approveLiquidity(address _liquidity) external;\n\n function revokeLiquidity(address _liquidity) external;\n\n function setKeep3rHelper(address _keep3rHelper) external;\n\n function addVotes(address _voter, uint256 _amount) external;\n\n function removeVotes(address _voter, uint256 _amount) external;\n}\n" - }, - "solidity/for-test/testnet/Keep3rForTestnet.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../../contracts/Keep3r.sol';\n\ncontract Keep3rForTestnet is Keep3r {\n constructor(\n address _governance,\n address _keep3rHelper,\n address _keep3rV1,\n address _keep3rV1Proxy\n ) Keep3r(_governance, _keep3rHelper, _keep3rV1, _keep3rV1Proxy) {\n bondTime = 0; // allows keepers to instantly register\n unbondTime = 0; // allows keepers & jobOwners to instantly withdraw funds\n liquidityMinimum = 1; // allows job providers to add low liquidity\n rewardPeriodTime = 1 days; // reduces twap calculation period\n inflationPeriod = 5 days; // increases credit mintint\n }\n}\n" - }, - "solidity/for-test/Keep3rForTest.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../contracts/Keep3r.sol';\n\ncontract Keep3rForTest is Keep3r {\n constructor(\n address _governance,\n address _keep3rHelper,\n address _keep3rV1,\n address _keep3rV1Proxy\n ) Keep3r(_governance, _keep3rHelper, _keep3rV1, _keep3rV1Proxy) {}\n}\n" - }, - "solidity/contracts/sidechain/Keep3rSidechain.sol": { - "content": "// SPDX-License-Identifier: MIT\n\n/*\n\nCoded for The Keep3r Network with ♥ by\n\n██████╗░███████╗███████╗██╗  ░██╗░░░░░░░██╗░█████╗░███╗░░██╗██████╗░███████╗██████╗░██╗░░░░░░█████╗░███╗░░██╗██████╗░\n██╔══██╗██╔════╝██╔════╝██║  ░██║░░██╗░░██║██╔══██╗████╗░██║██╔══██╗██╔════╝██╔══██╗██║░░░░░██╔══██╗████╗░██║██╔══██╗\n██║░░██║█████╗░░█████╗░░██║  ░╚██╗████╗██╔╝██║░░██║██╔██╗██║██║░░██║█████╗░░██████╔╝██║░░░░░███████║██╔██╗██║██║░░██║\n██║░░██║██╔══╝░░██╔══╝░░██║  ░░████╔═████║░██║░░██║██║╚████║██║░░██║██╔══╝░░██╔══██╗██║░░░░░██╔══██║██║╚████║██║░░██║\n██████╔╝███████╗██║░░░░░██║  ░░╚██╔╝░╚██╔╝░╚█████╔╝██║░╚███║██████╔╝███████╗██║░░██║███████╗██║░░██║██║░╚███║██████╔╝\n╚═════╝░╚══════╝╚═╝░░░░░╚═╝  ░░░╚═╝░░░╚═╝░░░╚════╝░╚═╝░░╚══╝╚═════╝░╚══════╝╚═╝░░╚═╝╚══════╝╚═╝░░╚═╝╚═╝░░╚══╝╚═════╝░\n\nhttps://defi.sucks\n\n*/\n\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../Keep3r.sol';\nimport '../../interfaces/sidechain/IKeep3rEscrow.sol';\nimport '../../interfaces/sidechain/IKeep3rHelperSidechain.sol';\nimport '../../interfaces/sidechain/IKeep3rJobWorkableRated.sol';\nimport '../../interfaces/sidechain/IKeep3rSidechainAccountance.sol';\n\ncontract Keep3rSidechain is Keep3r, IKeep3rJobWorkableRated, IKeep3rSidechainAccountance {\n using EnumerableSet for EnumerableSet.AddressSet;\n\n /// @param _governance Address of governance\n /// @param _keep3rHelperSidechain Address of sidechain Keep3rHelper\n /// @param _wrappedKP3R Address of wrapped KP3R implementation\n /// @param _keep3rEscrow Address of sidechain Keep3rEscrow\n constructor(\n address _governance, // governance\n address _keep3rHelperSidechain, // helper\n address _wrappedKP3R, // keep3rV1\n address _keep3rEscrow // keep3rV1Proxy\n ) Keep3r(_governance, _keep3rHelperSidechain, _wrappedKP3R, _keep3rEscrow) {}\n\n // Keep3rSidechainAccountance\n\n /// @inheritdoc IKeep3rSidechainAccountance\n uint256 public override totalBonds;\n\n /// @inheritdoc IKeep3rSidechainAccountance\n function virtualReserves() external view override returns (uint256 _virtualReserves) {\n // Queries wKP3R balanceOf escrow contract minus the totalBonds\n return IERC20(keep3rV1).balanceOf(keep3rV1Proxy) - totalBonds;\n }\n\n // Keep3rJobFundableLiquidity\n\n /// @notice Sidechain implementation asks the Helper for an oracle, instead of reading it from the ERC-20\n /// @dev Function should be called after setting an oracle in Keep3rHelperSidechain\n /// @param _liquidity Address of the liquidity token being approved\n function approveLiquidity(address _liquidity) external virtual override onlyGovernance {\n if (!_approvedLiquidities.add(_liquidity)) revert LiquidityPairApproved();\n _liquidityPool[_liquidity] = IKeep3rHelperSidechain(keep3rHelper).oracle(_liquidity);\n if (_liquidityPool[_liquidity] == address(0)) revert ZeroAddress();\n _isKP3RToken0[_liquidity] = IKeep3rHelper(keep3rHelper).isKP3RToken0(_liquidityPool[_liquidity]);\n _tick[_liquidity] = observeLiquidity(_liquidity);\n emit LiquidityApproval(_liquidity);\n }\n\n /// @notice Sidechain implementation will always ask for 2 tickCumulatives instead of cacheing\n /// @param _liquidity Address of the liquidity token being observed\n function observeLiquidity(address _liquidity) public view virtual override returns (TickCache memory _tickCache) {\n if (_tick[_liquidity].period == _period(block.timestamp)) {\n // Will return cached twaps if liquidity is updated\n _tickCache = _tick[_liquidity];\n } else {\n bool success;\n\n // Will always ask for 2 accumulators in sidechain\n uint32[] memory _secondsAgo = new uint32[](2);\n\n _secondsAgo[0] = uint32(block.timestamp - _period(block.timestamp));\n _secondsAgo[1] = uint32(block.timestamp - _period(block.timestamp) + rewardPeriodTime);\n\n int56 _tickCumulative2;\n (_tickCache.current, _tickCumulative2, success) = IKeep3rHelper(keep3rHelper).observe(_liquidityPool[_liquidity], _secondsAgo);\n\n _tickCache.difference = _tickCache.current - _tickCumulative2;\n\n if (success) {\n _tickCache.period = _period(block.timestamp);\n } else {\n delete _tickCache.period;\n }\n }\n }\n\n // Keep3rJobsWorkable\n\n /// @dev Sidechain implementation deprecates worked(address) as it should come with a usdPerGasUnit parameter\n function worked(address) external pure override {\n revert Deprecated();\n }\n\n /// @notice Implemented by jobs to show that a keeper performed work\n /// @dev Uses a USD per gas unit payment mechanism\n /// @param _keeper Address of the keeper that performed the work\n /// @param _usdPerGasUnit Units of USD (in wei) per gas unit that should be rewarded to the keeper\n function worked(address _keeper, uint256 _usdPerGasUnit) external override {\n if (_initialGas == 0) revert GasNotInitialized();\n // Gas used for quote calculations & payment is not rewarded\n uint256 _gasRecord = _getGasLeft();\n\n address _job = msg.sender;\n if (disputes[_job]) revert JobDisputed();\n if (!_jobs.contains(_job)) revert JobUnapproved();\n\n if (_updateJobCreditsIfNeeded(_job)) {\n emit LiquidityCreditsReward(_job, rewardedAt[_job], _jobLiquidityCredits[_job], _jobPeriodCredits[_job]);\n }\n\n uint256 _boost = IKeep3rHelper(keep3rHelper).getRewardBoostFor(bonds[_keeper][keep3rV1]);\n uint256 _ratedPayment = (_usdPerGasUnit * (_initialGas - _gasRecord) * _boost) / _BASE;\n\n uint256 _ethPayment = IKeep3rHelperSidechain(keep3rHelper).quoteUsdToEth(_ratedPayment);\n uint256 _kp3rPayment = IKeep3rHelper(keep3rHelper).quote(_ethPayment);\n\n if (_kp3rPayment > _jobLiquidityCredits[_job]) {\n _rewardJobCredits(_job);\n emit LiquidityCreditsReward(_job, rewardedAt[_job], _jobLiquidityCredits[_job], _jobPeriodCredits[_job]);\n }\n\n totalBonds += _kp3rPayment;\n _bondedPayment(_job, _keeper, _kp3rPayment);\n delete _initialGas;\n\n emit KeeperWork(keep3rV1, _job, _keeper, _kp3rPayment, _gasRecord);\n }\n\n // Keep3rKeeperFundable\n\n /// @dev Sidechain implementation doesn't burn tokens, but deposit them in Keep3rEscrow\n function _activate(\n address _keeper,\n address _bonding,\n uint256 _amount\n ) internal virtual override {\n // bond provided tokens\n bonds[_keeper][_bonding] += _amount;\n if (_bonding == keep3rV1) {\n totalBonds += _amount;\n IKeep3rV1(keep3rV1).approve(keep3rV1Proxy, _amount);\n IKeep3rEscrow(keep3rV1Proxy).deposit(_amount);\n }\n }\n\n function _mint(uint256 _amount) internal virtual override {\n totalBonds -= _amount;\n super._mint(_amount);\n }\n}\n" - }, - "solidity/interfaces/sidechain/IKeep3rEscrow.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\n// solhint-disable-next-line no-empty-blocks\n\nimport '../peripherals/IMintable.sol';\n\n/// @title Keep3rEscrow contract\n/// @notice This contract acts as an escrow contract for wKP3R tokens on sidechains and L2s\n/// @dev Can be used as a replacement for keep3rV1Proxy in keep3r sidechain implementations\ninterface IKeep3rEscrow is IMintable {\n /// @notice Emitted when Keep3rEscrow#deposit function is called\n /// @param _wKP3R The addess of the wrapped KP3R token\n /// @param _sender The address that called the function\n /// @param _amount The amount of wKP3R the user deposited\n event wKP3RDeposited(address _wKP3R, address _sender, uint256 _amount);\n\n /// @notice Emitted when Keep3rEscrow#mint function is called\n /// @param _wKP3R The addess of the wrapped KP3R token\n /// @param _recipient The address that will received the newly minted wKP3R\n /// @param _amount The amount of wKP3R minted to the recipient\n event wKP3RMinted(address _wKP3R, address _recipient, uint256 _amount);\n\n /// @notice Emitted when Keep3rEscrow#setWKP3R function is called\n /// @param _newWKP3R The address of the wKP3R contract\n event wKP3RSet(address _newWKP3R);\n\n /// @notice Throws when minter attempts to withdraw more wKP3R than the escrow has in its balance\n error InsufficientBalance();\n\n /// @notice Lists the address of the wKP3R contract\n /// @return _wKP3RAddress The address of wKP3R\n function wKP3R() external view returns (address _wKP3RAddress);\n\n /// @notice Deposits wKP3R into the contract\n /// @param _amount The amount of wKP3R to deposit\n function deposit(uint256 _amount) external;\n\n /// @notice mints wKP3R to the recipient\n /// @param _amount The amount of wKP3R to mint\n function mint(uint256 _amount) external;\n\n /// @notice sets the wKP3R address\n /// @param _wKP3R the wKP3R address\n function setWKP3R(address _wKP3R) external;\n}\n" - }, - "solidity/interfaces/sidechain/IKeep3rHelperSidechain.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../IKeep3rHelper.sol';\n\n/// @title Keep3rHelperSidechain contract\n/// @notice Contains all the helper functions for sidechain keep3r implementations\ninterface IKeep3rHelperSidechain is IKeep3rHelper {\n // Events\n\n /// @notice The oracle for a liquidity has been saved\n /// @param _liquidity The address of the given liquidity\n /// @param _oraclePool The address of the oracle pool\n event OracleSet(address _liquidity, address _oraclePool);\n\n /// @notice Emitted when the WETH USD pool is changed\n /// @param _address Address of the new WETH USD pool\n /// @param _isWETHToken0 True if calling the token0 method of the pool returns the WETH token address\n event WethUSDPoolChange(address _address, bool _isWETHToken0);\n\n /// Variables\n\n /// @notice Ethereum mainnet WETH address used for quoting references\n /// @return _weth Address of WETH token\n // solhint-disable func-name-mixedcase\n function WETH() external view returns (address _weth);\n\n /// @return _oracle The address of the observable pool for given liquidity\n function oracle(address _liquidity) external view returns (address _oracle);\n\n /// @notice WETH-USD pool that is being used as oracle\n /// @return poolAddress Address of the pool\n /// @return isTKNToken0 True if calling the token0 method of the pool returns the WETH token address\n function wethUSDPool() external view returns (address poolAddress, bool isTKNToken0);\n\n /// @notice Quotes USD to ETH\n /// @dev Used to know how much ETH should be paid to keepers before converting it from ETH to KP3R\n /// @param _usd The amount of USD to quote to ETH\n /// @return _eth The resulting amount of ETH after quoting the USD\n function quoteUsdToEth(uint256 _usd) external returns (uint256 _eth);\n\n /// Methods\n\n /// @notice Sets an oracle for a given liquidity\n /// @param _liquidity The address of the liquidity\n /// @param _oracle The address of the pool used to quote the liquidity from\n /// @dev The oracle must contain KP3R as either token0 or token1\n function setOracle(address _liquidity, address _oracle) external;\n\n /// @notice Sets an oracle for querying WETH/USD quote\n /// @param _poolAddress The address of the pool used as oracle\n /// @dev The oracle must contain WETH as either token0 or token1\n function setWethUsdPool(address _poolAddress) external;\n}\n" - }, - "solidity/interfaces/sidechain/IKeep3rJobWorkableRated.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../peripherals/IKeep3rJobs.sol';\n\n/// @title Keep3rJobWorkableRated contract\n/// @notice Implements a quoting in USD per gas unit for Keep3r jobs\ninterface IKeep3rJobWorkableRated is IKeep3rJobs {\n /// @notice Throws when job contract calls deprecated worked(address) function\n error Deprecated();\n\n /// @notice Implemented by jobs to show that a keeper performed work and reward in stable USD quote\n /// @dev Automatically calculates the payment for the keeper and pays the keeper with bonded KP3R\n /// @param _keeper Address of the keeper that performed the work\n /// @param _usdPerGasUnit Amount of USD in wei rewarded for gas unit worked by the keeper\n function worked(address _keeper, uint256 _usdPerGasUnit) external;\n}\n" - }, - "solidity/interfaces/sidechain/IKeep3rSidechainAccountance.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\n/// @title IKeep3rSidechainAccountance interface\n/// @notice Implements a view to get the amount of credits that can be withdrawn\ninterface IKeep3rSidechainAccountance {\n /// @return _totalBonds The total amount of bonded wKP3Rs in the contract\n function totalBonds() external view returns (uint256 _totalBonds);\n\n /// @return _virtualReserves The surplus amount of wKP3Rs in escrow contract\n function virtualReserves() external view returns (uint256 _virtualReserves);\n}\n" - }, - "solidity/interfaces/peripherals/IMintable.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport './IGovernable.sol';\nimport './IBaseErrors.sol';\n\n/// @title Mintable contract\n/// @notice Manages the minter role\ninterface IMintable is IBaseErrors, IGovernable {\n // Events\n\n /// @notice Emitted when governance sets a new minter\n /// @param _minter Address of the new minter\n event MinterSet(address _minter);\n\n // Errors\n\n /// @notice Throws if the caller of the function is not the minter\n error OnlyMinter();\n\n // Variables\n\n /// @notice Stores the minter address\n /// @return _minter The minter addresss\n function minter() external view returns (address _minter);\n\n // Methods\n\n /// @notice Sets a new address to be the minter\n /// @param _minter The address set as the minter\n function setMinter(address _minter) external;\n}\n" - }, - "solidity/for-test/testnet/Keep3rSidechainForTestnet.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../../contracts/sidechain/Keep3rSidechain.sol';\n\ncontract Keep3rSidechainForTestnet is Keep3rSidechain {\n constructor(\n address _governance,\n address _keep3rHelper,\n address _keep3rV1,\n address _keep3rV1Proxy\n ) Keep3rSidechain(_governance, _keep3rHelper, _keep3rV1, _keep3rV1Proxy) {\n bondTime = 0; // allows keepers to instantly register\n unbondTime = 0; // allows keepers & jobOwners to instantly withdraw funds\n liquidityMinimum = 1; // allows job providers to add low liquidity\n rewardPeriodTime = 1 days; // reduces twap calculation period\n inflationPeriod = 5 days; // increases credit mintint\n }\n}\n" - }, - "solidity/for-test/Keep3rSidechainForTest.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../contracts/sidechain/Keep3rSidechain.sol';\n\ncontract Keep3rSidechainForTest is Keep3rSidechain {\n using EnumerableSet for EnumerableSet.AddressSet;\n\n constructor(\n address _governance,\n address _keep3rHelper,\n address _wrappedKP3R,\n address _keep3rEscrow\n ) Keep3rSidechain(_governance, _keep3rHelper, _wrappedKP3R, _keep3rEscrow) {}\n\n function setJobLiquidity(address _job, address _liquidity) external {\n _jobLiquidities[_job].add(_liquidity);\n }\n}\n" - }, - "solidity/for-test/JobRatedForTest.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../interfaces/IKeep3r.sol';\nimport '../interfaces/sidechain/IKeep3rJobWorkableRated.sol';\n\ncontract JobRatedForTest {\n error InvalidKeeper();\n address public keep3r;\n uint256 public nonce;\n uint256 public usdPerGasUnit = 1_000e9;\n\n constructor(address _keep3r) {\n keep3r = _keep3r;\n }\n\n function work() external {\n if (!IKeep3r(keep3r).isKeeper(msg.sender)) revert InvalidKeeper();\n\n for (uint256 i = 0; i < 1000; i++) {\n nonce++;\n }\n\n IKeep3rJobWorkableRated(keep3r).worked(msg.sender, usdPerGasUnit);\n }\n\n function workHard(uint256 _factor) external {\n if (!IKeep3r(keep3r).isKeeper(msg.sender)) revert InvalidKeeper();\n\n for (uint256 i = 0; i < 1000 * _factor; i++) {\n nonce++;\n }\n\n IKeep3rJobWorkableRated(keep3r).worked(msg.sender, usdPerGasUnit);\n }\n}\n" - }, - "solidity/for-test/JobForTest.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../interfaces/IKeep3r.sol';\n\ncontract JobForTest {\n error InvalidKeeper();\n address public keep3r;\n uint256 public nonce;\n\n constructor(address _keep3r) {\n keep3r = _keep3r;\n }\n\n function work() external {\n if (!IKeep3r(keep3r).isKeeper(msg.sender)) revert InvalidKeeper();\n\n for (uint256 i; i < 1000; i++) {\n nonce++;\n }\n\n IKeep3r(keep3r).worked(msg.sender);\n }\n\n function workHard(uint256 _factor) external {\n if (!IKeep3r(keep3r).isKeeper(msg.sender)) revert InvalidKeeper();\n\n for (uint256 i; i < 1000 * _factor; i++) {\n nonce++;\n }\n\n IKeep3r(keep3r).worked(msg.sender);\n }\n}\n" - }, - "solidity/for-test/BasicJob.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../interfaces/IKeep3r.sol';\n\ncontract BasicJob {\n error KeeperNotValid();\n\n address public keep3r;\n uint256 public nonce;\n uint256[] public array;\n\n constructor(address _keep3r) {\n keep3r = _keep3r;\n }\n\n function work() external upkeep {}\n\n function workHard(uint256 _howHard) external upkeep {\n for (uint256 i = nonce; i < _howHard; i++) {\n nonce++;\n }\n }\n\n function workRefund(uint256 _howHard) external upkeep {\n for (uint256 i; i < _howHard; i++) {\n array.push(i);\n }\n\n while (array.length > 0) {\n array.pop();\n }\n }\n\n modifier upkeep() {\n if (!IKeep3r(keep3r).isKeeper(msg.sender)) revert KeeperNotValid();\n _;\n IKeep3r(keep3r).worked(msg.sender);\n }\n}\n" - }, - "solidity/contracts/Keep3rHelperParameters.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.7 <0.9.0;\n\nimport './libraries/FullMath.sol';\nimport './libraries/TickMath.sol';\nimport '../interfaces/peripherals/IBaseErrors.sol';\nimport '../interfaces/IKeep3r.sol';\nimport '../interfaces/external/IKeep3rV1.sol';\nimport '../interfaces/IKeep3rHelperParameters.sol';\nimport './peripherals/Governable.sol';\nimport './Keep3rHelperParameters.sol';\n\nimport '@openzeppelin/contracts/utils/math/Math.sol';\nimport '@uniswap/v3-core/contracts/interfaces/IUniswapV3Pool.sol';\n\ncontract Keep3rHelperParameters is IKeep3rHelperParameters, IBaseErrors, Governable {\n /// @inheritdoc IKeep3rHelperParameters\n address public immutable override KP3R;\n\n /// @inheritdoc IKeep3rHelperParameters\n uint256 public constant override BOOST_BASE = 10_000;\n\n /// @inheritdoc IKeep3rHelperParameters\n uint256 public override minBoost = 11_000;\n\n /// @inheritdoc IKeep3rHelperParameters\n uint256 public override maxBoost = 12_000;\n\n /// @inheritdoc IKeep3rHelperParameters\n uint256 public override targetBond = 200 ether;\n\n /// @inheritdoc IKeep3rHelperParameters\n uint256 public override workExtraGas = 30_000;\n\n /// @inheritdoc IKeep3rHelperParameters\n uint32 public override quoteTwapTime = 10 minutes;\n\n /// @inheritdoc IKeep3rHelperParameters\n uint256 public override minBaseFee = 15e9;\n\n /// @inheritdoc IKeep3rHelperParameters\n uint256 public override minPriorityFee = 2e9;\n\n /// @inheritdoc IKeep3rHelperParameters\n address public override keep3rV2;\n\n /// @inheritdoc IKeep3rHelperParameters\n IKeep3rHelperParameters.TokenOraclePool public override kp3rWethPool;\n\n constructor(\n address _kp3r,\n address _keep3rV2,\n address _governance,\n address _kp3rWethPool\n ) Governable(_governance) {\n KP3R = _kp3r;\n keep3rV2 = _keep3rV2;\n\n // Immutable variables [KP3R] cannot be read during contract creation time [_setKp3rWethPool]\n kp3rWethPool = _validateOraclePool(_kp3rWethPool, _kp3r);\n emit Kp3rWethPoolChange(kp3rWethPool.poolAddress, kp3rWethPool.isTKNToken0);\n }\n\n /// @inheritdoc IKeep3rHelperParameters\n function setKp3rWethPool(address _poolAddress) external override onlyGovernance {\n if (_poolAddress == address(0)) revert ZeroAddress();\n _setKp3rWethPool(_poolAddress);\n }\n\n /// @inheritdoc IKeep3rHelperParameters\n function setMinBoost(uint256 _minBoost) external override onlyGovernance {\n minBoost = _minBoost;\n emit MinBoostChange(minBoost);\n }\n\n /// @inheritdoc IKeep3rHelperParameters\n function setMaxBoost(uint256 _maxBoost) external override onlyGovernance {\n maxBoost = _maxBoost;\n emit MaxBoostChange(maxBoost);\n }\n\n /// @inheritdoc IKeep3rHelperParameters\n function setTargetBond(uint256 _targetBond) external override onlyGovernance {\n targetBond = _targetBond;\n emit TargetBondChange(targetBond);\n }\n\n /// @inheritdoc IKeep3rHelperParameters\n function setKeep3rV2(address _keep3rV2) external override onlyGovernance {\n if (_keep3rV2 == address(0)) revert ZeroAddress();\n keep3rV2 = _keep3rV2;\n emit Keep3rV2Change(keep3rV2);\n }\n\n /// @inheritdoc IKeep3rHelperParameters\n function setWorkExtraGas(uint256 _workExtraGas) external override onlyGovernance {\n workExtraGas = _workExtraGas;\n emit WorkExtraGasChange(workExtraGas);\n }\n\n /// @inheritdoc IKeep3rHelperParameters\n function setQuoteTwapTime(uint32 _quoteTwapTime) external override onlyGovernance {\n _setQuoteTwapTime(_quoteTwapTime);\n }\n\n function _setQuoteTwapTime(uint32 _quoteTwapTime) internal {\n quoteTwapTime = _quoteTwapTime;\n emit QuoteTwapTimeChange(quoteTwapTime);\n }\n\n /// @inheritdoc IKeep3rHelperParameters\n function setMinBaseFee(uint256 _minBaseFee) external override onlyGovernance {\n minBaseFee = _minBaseFee;\n emit MinBaseFeeChange(minBaseFee);\n }\n\n /// @inheritdoc IKeep3rHelperParameters\n function setMinPriorityFee(uint256 _minPriorityFee) external override onlyGovernance {\n minPriorityFee = _minPriorityFee;\n emit MinPriorityFeeChange(minPriorityFee);\n }\n\n /// @notice Sets KP3R-WETH pool\n /// @param _poolAddress The address of the KP3R-WETH pool\n function _setKp3rWethPool(address _poolAddress) internal {\n kp3rWethPool = _validateOraclePool(_poolAddress, KP3R);\n emit Kp3rWethPoolChange(kp3rWethPool.poolAddress, kp3rWethPool.isTKNToken0);\n }\n\n function _validateOraclePool(address _poolAddress, address _token) internal view virtual returns (TokenOraclePool memory _oraclePool) {\n bool _isTKNToken0 = IUniswapV3Pool(_poolAddress).token0() == _token;\n\n if (!_isTKNToken0 && IUniswapV3Pool(_poolAddress).token1() != _token) revert InvalidOraclePool();\n\n return TokenOraclePool(_poolAddress, _isTKNToken0);\n }\n}\n" - }, - "solidity/contracts/libraries/TickMath.sol": { - "content": "// SPDX-License-Identifier: GPL-2.0-or-later\npragma solidity >=0.5.0;\n\n// solhint-disable\n\n/// @title Math library for computing sqrt prices from ticks and vice versa\n/// @notice Computes sqrt price for ticks of size 1.0001, i.e. sqrt(1.0001^tick) as fixed point Q64.96 numbers. Supports\n/// prices between 2**-128 and 2**128\nlibrary TickMath {\n /// @dev The minimum tick that may be passed to #getSqrtRatioAtTick computed from log base 1.0001 of 2**-128\n int24 internal constant MIN_TICK = -887272;\n /// @dev The maximum tick that may be passed to #getSqrtRatioAtTick computed from log base 1.0001 of 2**128\n int24 internal constant MAX_TICK = -MIN_TICK;\n\n /// @dev The minimum value that can be returned from #getSqrtRatioAtTick. Equivalent to getSqrtRatioAtTick(MIN_TICK)\n uint160 internal constant MIN_SQRT_RATIO = 4295128739;\n /// @dev The maximum value that can be returned from #getSqrtRatioAtTick. Equivalent to getSqrtRatioAtTick(MAX_TICK)\n uint160 internal constant MAX_SQRT_RATIO = 1461446703485210103287273052203988822378723970342;\n\n /// @notice Calculates sqrt(1.0001^tick) * 2^96\n /// @dev Throws if |tick| > max tick\n /// @param tick The input tick for the above formula\n /// @return sqrtPriceX96 A Fixed point Q64.96 number representing the sqrt of the ratio of the two assets (token1/token0)\n /// at the given tick\n function getSqrtRatioAtTick(int24 tick) internal pure returns (uint160 sqrtPriceX96) {\n uint256 absTick = tick < 0 ? uint256(-int256(tick)) : uint256(int256(tick));\n require(absTick <= uint256(int256(MAX_TICK)), 'T');\n\n uint256 ratio = absTick & 0x1 != 0 ? 0xfffcb933bd6fad37aa2d162d1a594001 : 0x100000000000000000000000000000000;\n if (absTick & 0x2 != 0) ratio = (ratio * 0xfff97272373d413259a46990580e213a) >> 128;\n if (absTick & 0x4 != 0) ratio = (ratio * 0xfff2e50f5f656932ef12357cf3c7fdcc) >> 128;\n if (absTick & 0x8 != 0) ratio = (ratio * 0xffe5caca7e10e4e61c3624eaa0941cd0) >> 128;\n if (absTick & 0x10 != 0) ratio = (ratio * 0xffcb9843d60f6159c9db58835c926644) >> 128;\n if (absTick & 0x20 != 0) ratio = (ratio * 0xff973b41fa98c081472e6896dfb254c0) >> 128;\n if (absTick & 0x40 != 0) ratio = (ratio * 0xff2ea16466c96a3843ec78b326b52861) >> 128;\n if (absTick & 0x80 != 0) ratio = (ratio * 0xfe5dee046a99a2a811c461f1969c3053) >> 128;\n if (absTick & 0x100 != 0) ratio = (ratio * 0xfcbe86c7900a88aedcffc83b479aa3a4) >> 128;\n if (absTick & 0x200 != 0) ratio = (ratio * 0xf987a7253ac413176f2b074cf7815e54) >> 128;\n if (absTick & 0x400 != 0) ratio = (ratio * 0xf3392b0822b70005940c7a398e4b70f3) >> 128;\n if (absTick & 0x800 != 0) ratio = (ratio * 0xe7159475a2c29b7443b29c7fa6e889d9) >> 128;\n if (absTick & 0x1000 != 0) ratio = (ratio * 0xd097f3bdfd2022b8845ad8f792aa5825) >> 128;\n if (absTick & 0x2000 != 0) ratio = (ratio * 0xa9f746462d870fdf8a65dc1f90e061e5) >> 128;\n if (absTick & 0x4000 != 0) ratio = (ratio * 0x70d869a156d2a1b890bb3df62baf32f7) >> 128;\n if (absTick & 0x8000 != 0) ratio = (ratio * 0x31be135f97d08fd981231505542fcfa6) >> 128;\n if (absTick & 0x10000 != 0) ratio = (ratio * 0x9aa508b5b7a84e1c677de54f3e99bc9) >> 128;\n if (absTick & 0x20000 != 0) ratio = (ratio * 0x5d6af8dedb81196699c329225ee604) >> 128;\n if (absTick & 0x40000 != 0) ratio = (ratio * 0x2216e584f5fa1ea926041bedfe98) >> 128;\n if (absTick & 0x80000 != 0) ratio = (ratio * 0x48a170391f7dc42444e8fa2) >> 128;\n\n if (tick > 0) ratio = type(uint256).max / ratio;\n\n // Divides by 1<<32 rounding up to go from a Q128.128 to a Q128.96.\n // we then downcast because we know the result always fits within 160 bits due to our tick input constraint\n // we round up in the division so getTickAtSqrtRatio of the output price is always consistent\n sqrtPriceX96 = uint160((ratio >> 32) + (ratio % (1 << 32) == 0 ? 0 : 1));\n }\n\n /// @notice Calculates the greatest tick value such that getRatioAtTick(tick) <= ratio\n /// @dev Throws in case sqrtPriceX96 < MIN_SQRT_RATIO, as MIN_SQRT_RATIO is the lowest value getRatioAtTick may ever return.\n /// @param sqrtPriceX96 The sqrt ratio for which to compute the tick as a Q64.96\n /// @return tick The greatest tick for which the ratio is less than or equal to the input ratio\n function getTickAtSqrtRatio(uint160 sqrtPriceX96) internal pure returns (int24 tick) {\n // Second inequality must be < because the price can never reach the price at the max tick\n require(sqrtPriceX96 >= MIN_SQRT_RATIO && sqrtPriceX96 < MAX_SQRT_RATIO, 'R');\n uint256 ratio = uint256(sqrtPriceX96) << 32;\n\n uint256 r = ratio;\n uint256 msb = 0;\n\n assembly {\n let f := shl(7, gt(r, 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF))\n msb := or(msb, f)\n r := shr(f, r)\n }\n assembly {\n let f := shl(6, gt(r, 0xFFFFFFFFFFFFFFFF))\n msb := or(msb, f)\n r := shr(f, r)\n }\n assembly {\n let f := shl(5, gt(r, 0xFFFFFFFF))\n msb := or(msb, f)\n r := shr(f, r)\n }\n assembly {\n let f := shl(4, gt(r, 0xFFFF))\n msb := or(msb, f)\n r := shr(f, r)\n }\n assembly {\n let f := shl(3, gt(r, 0xFF))\n msb := or(msb, f)\n r := shr(f, r)\n }\n assembly {\n let f := shl(2, gt(r, 0xF))\n msb := or(msb, f)\n r := shr(f, r)\n }\n assembly {\n let f := shl(1, gt(r, 0x3))\n msb := or(msb, f)\n r := shr(f, r)\n }\n assembly {\n let f := gt(r, 0x1)\n msb := or(msb, f)\n }\n\n if (msb >= 128) r = ratio >> (msb - 127);\n else r = ratio << (127 - msb);\n\n int256 log_2 = (int256(msb) - 128) << 64;\n\n assembly {\n r := shr(127, mul(r, r))\n let f := shr(128, r)\n log_2 := or(log_2, shl(63, f))\n r := shr(f, r)\n }\n assembly {\n r := shr(127, mul(r, r))\n let f := shr(128, r)\n log_2 := or(log_2, shl(62, f))\n r := shr(f, r)\n }\n assembly {\n r := shr(127, mul(r, r))\n let f := shr(128, r)\n log_2 := or(log_2, shl(61, f))\n r := shr(f, r)\n }\n assembly {\n r := shr(127, mul(r, r))\n let f := shr(128, r)\n log_2 := or(log_2, shl(60, f))\n r := shr(f, r)\n }\n assembly {\n r := shr(127, mul(r, r))\n let f := shr(128, r)\n log_2 := or(log_2, shl(59, f))\n r := shr(f, r)\n }\n assembly {\n r := shr(127, mul(r, r))\n let f := shr(128, r)\n log_2 := or(log_2, shl(58, f))\n r := shr(f, r)\n }\n assembly {\n r := shr(127, mul(r, r))\n let f := shr(128, r)\n log_2 := or(log_2, shl(57, f))\n r := shr(f, r)\n }\n assembly {\n r := shr(127, mul(r, r))\n let f := shr(128, r)\n log_2 := or(log_2, shl(56, f))\n r := shr(f, r)\n }\n assembly {\n r := shr(127, mul(r, r))\n let f := shr(128, r)\n log_2 := or(log_2, shl(55, f))\n r := shr(f, r)\n }\n assembly {\n r := shr(127, mul(r, r))\n let f := shr(128, r)\n log_2 := or(log_2, shl(54, f))\n r := shr(f, r)\n }\n assembly {\n r := shr(127, mul(r, r))\n let f := shr(128, r)\n log_2 := or(log_2, shl(53, f))\n r := shr(f, r)\n }\n assembly {\n r := shr(127, mul(r, r))\n let f := shr(128, r)\n log_2 := or(log_2, shl(52, f))\n r := shr(f, r)\n }\n assembly {\n r := shr(127, mul(r, r))\n let f := shr(128, r)\n log_2 := or(log_2, shl(51, f))\n r := shr(f, r)\n }\n assembly {\n r := shr(127, mul(r, r))\n let f := shr(128, r)\n log_2 := or(log_2, shl(50, f))\n }\n\n int256 log_sqrt10001 = log_2 * 255738958999603826347141; // 128.128 number\n\n int24 tickLow = int24((log_sqrt10001 - 3402992956809132418596140100660247210) >> 128);\n int24 tickHi = int24((log_sqrt10001 + 291339464771989622907027621153398088495) >> 128);\n\n tick = tickLow == tickHi ? tickLow : getSqrtRatioAtTick(tickHi) <= sqrtPriceX96 ? tickHi : tickLow;\n }\n}\n" - }, - "@uniswap/v3-core/contracts/interfaces/IUniswapV3Pool.sol": { - "content": "// SPDX-License-Identifier: GPL-2.0-or-later\npragma solidity >=0.5.0;\n\nimport './pool/IUniswapV3PoolImmutables.sol';\nimport './pool/IUniswapV3PoolState.sol';\nimport './pool/IUniswapV3PoolDerivedState.sol';\nimport './pool/IUniswapV3PoolActions.sol';\nimport './pool/IUniswapV3PoolOwnerActions.sol';\nimport './pool/IUniswapV3PoolEvents.sol';\n\n/// @title The interface for a Uniswap V3 Pool\n/// @notice A Uniswap pool facilitates swapping and automated market making between any two assets that strictly conform\n/// to the ERC20 specification\n/// @dev The pool interface is broken up into many smaller pieces\ninterface IUniswapV3Pool is\n IUniswapV3PoolImmutables,\n IUniswapV3PoolState,\n IUniswapV3PoolDerivedState,\n IUniswapV3PoolActions,\n IUniswapV3PoolOwnerActions,\n IUniswapV3PoolEvents\n{\n\n}\n" - }, - "@uniswap/v3-core/contracts/interfaces/pool/IUniswapV3PoolImmutables.sol": { - "content": "// SPDX-License-Identifier: GPL-2.0-or-later\npragma solidity >=0.5.0;\n\n/// @title Pool state that never changes\n/// @notice These parameters are fixed for a pool forever, i.e., the methods will always return the same values\ninterface IUniswapV3PoolImmutables {\n /// @notice The contract that deployed the pool, which must adhere to the IUniswapV3Factory interface\n /// @return The contract address\n function factory() external view returns (address);\n\n /// @notice The first of the two tokens of the pool, sorted by address\n /// @return The token contract address\n function token0() external view returns (address);\n\n /// @notice The second of the two tokens of the pool, sorted by address\n /// @return The token contract address\n function token1() external view returns (address);\n\n /// @notice The pool's fee in hundredths of a bip, i.e. 1e-6\n /// @return The fee\n function fee() external view returns (uint24);\n\n /// @notice The pool tick spacing\n /// @dev Ticks can only be used at multiples of this value, minimum of 1 and always positive\n /// e.g.: a tickSpacing of 3 means ticks can be initialized every 3rd tick, i.e., ..., -6, -3, 0, 3, 6, ...\n /// This value is an int24 to avoid casting even though it is always positive.\n /// @return The tick spacing\n function tickSpacing() external view returns (int24);\n\n /// @notice The maximum amount of position liquidity that can use any tick in the range\n /// @dev This parameter is enforced per tick to prevent liquidity from overflowing a uint128 at any point, and\n /// also prevents out-of-range liquidity from being used to prevent adding in-range liquidity to a pool\n /// @return The max amount of liquidity per tick\n function maxLiquidityPerTick() external view returns (uint128);\n}\n" - }, - "@uniswap/v3-core/contracts/interfaces/pool/IUniswapV3PoolState.sol": { - "content": "// SPDX-License-Identifier: GPL-2.0-or-later\npragma solidity >=0.5.0;\n\n/// @title Pool state that can change\n/// @notice These methods compose the pool's state, and can change with any frequency including multiple times\n/// per transaction\ninterface IUniswapV3PoolState {\n /// @notice The 0th storage slot in the pool stores many values, and is exposed as a single method to save gas\n /// when accessed externally.\n /// @return sqrtPriceX96 The current price of the pool as a sqrt(token1/token0) Q64.96 value\n /// tick The current tick of the pool, i.e. according to the last tick transition that was run.\n /// This value may not always be equal to SqrtTickMath.getTickAtSqrtRatio(sqrtPriceX96) if the price is on a tick\n /// boundary.\n /// observationIndex The index of the last oracle observation that was written,\n /// observationCardinality The current maximum number of observations stored in the pool,\n /// observationCardinalityNext The next maximum number of observations, to be updated when the observation.\n /// feeProtocol The protocol fee for both tokens of the pool.\n /// Encoded as two 4 bit values, where the protocol fee of token1 is shifted 4 bits and the protocol fee of token0\n /// is the lower 4 bits. Used as the denominator of a fraction of the swap fee, e.g. 4 means 1/4th of the swap fee.\n /// unlocked Whether the pool is currently locked to reentrancy\n function slot0()\n external\n view\n returns (\n uint160 sqrtPriceX96,\n int24 tick,\n uint16 observationIndex,\n uint16 observationCardinality,\n uint16 observationCardinalityNext,\n uint8 feeProtocol,\n bool unlocked\n );\n\n /// @notice The fee growth as a Q128.128 fees of token0 collected per unit of liquidity for the entire life of the pool\n /// @dev This value can overflow the uint256\n function feeGrowthGlobal0X128() external view returns (uint256);\n\n /// @notice The fee growth as a Q128.128 fees of token1 collected per unit of liquidity for the entire life of the pool\n /// @dev This value can overflow the uint256\n function feeGrowthGlobal1X128() external view returns (uint256);\n\n /// @notice The amounts of token0 and token1 that are owed to the protocol\n /// @dev Protocol fees will never exceed uint128 max in either token\n function protocolFees() external view returns (uint128 token0, uint128 token1);\n\n /// @notice The currently in range liquidity available to the pool\n /// @dev This value has no relationship to the total liquidity across all ticks\n function liquidity() external view returns (uint128);\n\n /// @notice Look up information about a specific tick in the pool\n /// @param tick The tick to look up\n /// @return liquidityGross the total amount of position liquidity that uses the pool either as tick lower or\n /// tick upper,\n /// liquidityNet how much liquidity changes when the pool price crosses the tick,\n /// feeGrowthOutside0X128 the fee growth on the other side of the tick from the current tick in token0,\n /// feeGrowthOutside1X128 the fee growth on the other side of the tick from the current tick in token1,\n /// tickCumulativeOutside the cumulative tick value on the other side of the tick from the current tick\n /// secondsPerLiquidityOutsideX128 the seconds spent per liquidity on the other side of the tick from the current tick,\n /// secondsOutside the seconds spent on the other side of the tick from the current tick,\n /// initialized Set to true if the tick is initialized, i.e. liquidityGross is greater than 0, otherwise equal to false.\n /// Outside values can only be used if the tick is initialized, i.e. if liquidityGross is greater than 0.\n /// In addition, these values are only relative and must be used only in comparison to previous snapshots for\n /// a specific position.\n function ticks(int24 tick)\n external\n view\n returns (\n uint128 liquidityGross,\n int128 liquidityNet,\n uint256 feeGrowthOutside0X128,\n uint256 feeGrowthOutside1X128,\n int56 tickCumulativeOutside,\n uint160 secondsPerLiquidityOutsideX128,\n uint32 secondsOutside,\n bool initialized\n );\n\n /// @notice Returns 256 packed tick initialized boolean values. See TickBitmap for more information\n function tickBitmap(int16 wordPosition) external view returns (uint256);\n\n /// @notice Returns the information about a position by the position's key\n /// @param key The position's key is a hash of a preimage composed by the owner, tickLower and tickUpper\n /// @return _liquidity The amount of liquidity in the position,\n /// Returns feeGrowthInside0LastX128 fee growth of token0 inside the tick range as of the last mint/burn/poke,\n /// Returns feeGrowthInside1LastX128 fee growth of token1 inside the tick range as of the last mint/burn/poke,\n /// Returns tokensOwed0 the computed amount of token0 owed to the position as of the last mint/burn/poke,\n /// Returns tokensOwed1 the computed amount of token1 owed to the position as of the last mint/burn/poke\n function positions(bytes32 key)\n external\n view\n returns (\n uint128 _liquidity,\n uint256 feeGrowthInside0LastX128,\n uint256 feeGrowthInside1LastX128,\n uint128 tokensOwed0,\n uint128 tokensOwed1\n );\n\n /// @notice Returns data about a specific observation index\n /// @param index The element of the observations array to fetch\n /// @dev You most likely want to use #observe() instead of this method to get an observation as of some amount of time\n /// ago, rather than at a specific index in the array.\n /// @return blockTimestamp The timestamp of the observation,\n /// Returns tickCumulative the tick multiplied by seconds elapsed for the life of the pool as of the observation timestamp,\n /// Returns secondsPerLiquidityCumulativeX128 the seconds per in range liquidity for the life of the pool as of the observation timestamp,\n /// Returns initialized whether the observation has been initialized and the values are safe to use\n function observations(uint256 index)\n external\n view\n returns (\n uint32 blockTimestamp,\n int56 tickCumulative,\n uint160 secondsPerLiquidityCumulativeX128,\n bool initialized\n );\n}\n" - }, - "@uniswap/v3-core/contracts/interfaces/pool/IUniswapV3PoolDerivedState.sol": { - "content": "// SPDX-License-Identifier: GPL-2.0-or-later\npragma solidity >=0.5.0;\n\n/// @title Pool state that is not stored\n/// @notice Contains view functions to provide information about the pool that is computed rather than stored on the\n/// blockchain. The functions here may have variable gas costs.\ninterface IUniswapV3PoolDerivedState {\n /// @notice Returns the cumulative tick and liquidity as of each timestamp `secondsAgo` from the current block timestamp\n /// @dev To get a time weighted average tick or liquidity-in-range, you must call this with two values, one representing\n /// the beginning of the period and another for the end of the period. E.g., to get the last hour time-weighted average tick,\n /// you must call it with secondsAgos = [3600, 0].\n /// @dev The time weighted average tick represents the geometric time weighted average price of the pool, in\n /// log base sqrt(1.0001) of token1 / token0. The TickMath library can be used to go from a tick value to a ratio.\n /// @param secondsAgos From how long ago each cumulative tick and liquidity value should be returned\n /// @return tickCumulatives Cumulative tick values as of each `secondsAgos` from the current block timestamp\n /// @return secondsPerLiquidityCumulativeX128s Cumulative seconds per liquidity-in-range value as of each `secondsAgos` from the current block\n /// timestamp\n function observe(uint32[] calldata secondsAgos)\n external\n view\n returns (int56[] memory tickCumulatives, uint160[] memory secondsPerLiquidityCumulativeX128s);\n\n /// @notice Returns a snapshot of the tick cumulative, seconds per liquidity and seconds inside a tick range\n /// @dev Snapshots must only be compared to other snapshots, taken over a period for which a position existed.\n /// I.e., snapshots cannot be compared if a position is not held for the entire period between when the first\n /// snapshot is taken and the second snapshot is taken.\n /// @param tickLower The lower tick of the range\n /// @param tickUpper The upper tick of the range\n /// @return tickCumulativeInside The snapshot of the tick accumulator for the range\n /// @return secondsPerLiquidityInsideX128 The snapshot of seconds per liquidity for the range\n /// @return secondsInside The snapshot of seconds per liquidity for the range\n function snapshotCumulativesInside(int24 tickLower, int24 tickUpper)\n external\n view\n returns (\n int56 tickCumulativeInside,\n uint160 secondsPerLiquidityInsideX128,\n uint32 secondsInside\n );\n}\n" - }, - "@uniswap/v3-core/contracts/interfaces/pool/IUniswapV3PoolActions.sol": { - "content": "// SPDX-License-Identifier: GPL-2.0-or-later\npragma solidity >=0.5.0;\n\n/// @title Permissionless pool actions\n/// @notice Contains pool methods that can be called by anyone\ninterface IUniswapV3PoolActions {\n /// @notice Sets the initial price for the pool\n /// @dev Price is represented as a sqrt(amountToken1/amountToken0) Q64.96 value\n /// @param sqrtPriceX96 the initial sqrt price of the pool as a Q64.96\n function initialize(uint160 sqrtPriceX96) external;\n\n /// @notice Adds liquidity for the given recipient/tickLower/tickUpper position\n /// @dev The caller of this method receives a callback in the form of IUniswapV3MintCallback#uniswapV3MintCallback\n /// in which they must pay any token0 or token1 owed for the liquidity. The amount of token0/token1 due depends\n /// on tickLower, tickUpper, the amount of liquidity, and the current price.\n /// @param recipient The address for which the liquidity will be created\n /// @param tickLower The lower tick of the position in which to add liquidity\n /// @param tickUpper The upper tick of the position in which to add liquidity\n /// @param amount The amount of liquidity to mint\n /// @param data Any data that should be passed through to the callback\n /// @return amount0 The amount of token0 that was paid to mint the given amount of liquidity. Matches the value in the callback\n /// @return amount1 The amount of token1 that was paid to mint the given amount of liquidity. Matches the value in the callback\n function mint(\n address recipient,\n int24 tickLower,\n int24 tickUpper,\n uint128 amount,\n bytes calldata data\n ) external returns (uint256 amount0, uint256 amount1);\n\n /// @notice Collects tokens owed to a position\n /// @dev Does not recompute fees earned, which must be done either via mint or burn of any amount of liquidity.\n /// Collect must be called by the position owner. To withdraw only token0 or only token1, amount0Requested or\n /// amount1Requested may be set to zero. To withdraw all tokens owed, caller may pass any value greater than the\n /// actual tokens owed, e.g. type(uint128).max. Tokens owed may be from accumulated swap fees or burned liquidity.\n /// @param recipient The address which should receive the fees collected\n /// @param tickLower The lower tick of the position for which to collect fees\n /// @param tickUpper The upper tick of the position for which to collect fees\n /// @param amount0Requested How much token0 should be withdrawn from the fees owed\n /// @param amount1Requested How much token1 should be withdrawn from the fees owed\n /// @return amount0 The amount of fees collected in token0\n /// @return amount1 The amount of fees collected in token1\n function collect(\n address recipient,\n int24 tickLower,\n int24 tickUpper,\n uint128 amount0Requested,\n uint128 amount1Requested\n ) external returns (uint128 amount0, uint128 amount1);\n\n /// @notice Burn liquidity from the sender and account tokens owed for the liquidity to the position\n /// @dev Can be used to trigger a recalculation of fees owed to a position by calling with an amount of 0\n /// @dev Fees must be collected separately via a call to #collect\n /// @param tickLower The lower tick of the position for which to burn liquidity\n /// @param tickUpper The upper tick of the position for which to burn liquidity\n /// @param amount How much liquidity to burn\n /// @return amount0 The amount of token0 sent to the recipient\n /// @return amount1 The amount of token1 sent to the recipient\n function burn(\n int24 tickLower,\n int24 tickUpper,\n uint128 amount\n ) external returns (uint256 amount0, uint256 amount1);\n\n /// @notice Swap token0 for token1, or token1 for token0\n /// @dev The caller of this method receives a callback in the form of IUniswapV3SwapCallback#uniswapV3SwapCallback\n /// @param recipient The address to receive the output of the swap\n /// @param zeroForOne The direction of the swap, true for token0 to token1, false for token1 to token0\n /// @param amountSpecified The amount of the swap, which implicitly configures the swap as exact input (positive), or exact output (negative)\n /// @param sqrtPriceLimitX96 The Q64.96 sqrt price limit. If zero for one, the price cannot be less than this\n /// value after the swap. If one for zero, the price cannot be greater than this value after the swap\n /// @param data Any data to be passed through to the callback\n /// @return amount0 The delta of the balance of token0 of the pool, exact when negative, minimum when positive\n /// @return amount1 The delta of the balance of token1 of the pool, exact when negative, minimum when positive\n function swap(\n address recipient,\n bool zeroForOne,\n int256 amountSpecified,\n uint160 sqrtPriceLimitX96,\n bytes calldata data\n ) external returns (int256 amount0, int256 amount1);\n\n /// @notice Receive token0 and/or token1 and pay it back, plus a fee, in the callback\n /// @dev The caller of this method receives a callback in the form of IUniswapV3FlashCallback#uniswapV3FlashCallback\n /// @dev Can be used to donate underlying tokens pro-rata to currently in-range liquidity providers by calling\n /// with 0 amount{0,1} and sending the donation amount(s) from the callback\n /// @param recipient The address which will receive the token0 and token1 amounts\n /// @param amount0 The amount of token0 to send\n /// @param amount1 The amount of token1 to send\n /// @param data Any data to be passed through to the callback\n function flash(\n address recipient,\n uint256 amount0,\n uint256 amount1,\n bytes calldata data\n ) external;\n\n /// @notice Increase the maximum number of price and liquidity observations that this pool will store\n /// @dev This method is no-op if the pool already has an observationCardinalityNext greater than or equal to\n /// the input observationCardinalityNext.\n /// @param observationCardinalityNext The desired minimum number of observations for the pool to store\n function increaseObservationCardinalityNext(uint16 observationCardinalityNext) external;\n}\n" - }, - "@uniswap/v3-core/contracts/interfaces/pool/IUniswapV3PoolOwnerActions.sol": { - "content": "// SPDX-License-Identifier: GPL-2.0-or-later\npragma solidity >=0.5.0;\n\n/// @title Permissioned pool actions\n/// @notice Contains pool methods that may only be called by the factory owner\ninterface IUniswapV3PoolOwnerActions {\n /// @notice Set the denominator of the protocol's % share of the fees\n /// @param feeProtocol0 new protocol fee for token0 of the pool\n /// @param feeProtocol1 new protocol fee for token1 of the pool\n function setFeeProtocol(uint8 feeProtocol0, uint8 feeProtocol1) external;\n\n /// @notice Collect the protocol fee accrued to the pool\n /// @param recipient The address to which collected protocol fees should be sent\n /// @param amount0Requested The maximum amount of token0 to send, can be 0 to collect fees in only token1\n /// @param amount1Requested The maximum amount of token1 to send, can be 0 to collect fees in only token0\n /// @return amount0 The protocol fee collected in token0\n /// @return amount1 The protocol fee collected in token1\n function collectProtocol(\n address recipient,\n uint128 amount0Requested,\n uint128 amount1Requested\n ) external returns (uint128 amount0, uint128 amount1);\n}\n" - }, - "@uniswap/v3-core/contracts/interfaces/pool/IUniswapV3PoolEvents.sol": { - "content": "// SPDX-License-Identifier: GPL-2.0-or-later\npragma solidity >=0.5.0;\n\n/// @title Events emitted by a pool\n/// @notice Contains all events emitted by the pool\ninterface IUniswapV3PoolEvents {\n /// @notice Emitted exactly once by a pool when #initialize is first called on the pool\n /// @dev Mint/Burn/Swap cannot be emitted by the pool before Initialize\n /// @param sqrtPriceX96 The initial sqrt price of the pool, as a Q64.96\n /// @param tick The initial tick of the pool, i.e. log base 1.0001 of the starting price of the pool\n event Initialize(uint160 sqrtPriceX96, int24 tick);\n\n /// @notice Emitted when liquidity is minted for a given position\n /// @param sender The address that minted the liquidity\n /// @param owner The owner of the position and recipient of any minted liquidity\n /// @param tickLower The lower tick of the position\n /// @param tickUpper The upper tick of the position\n /// @param amount The amount of liquidity minted to the position range\n /// @param amount0 How much token0 was required for the minted liquidity\n /// @param amount1 How much token1 was required for the minted liquidity\n event Mint(\n address sender,\n address indexed owner,\n int24 indexed tickLower,\n int24 indexed tickUpper,\n uint128 amount,\n uint256 amount0,\n uint256 amount1\n );\n\n /// @notice Emitted when fees are collected by the owner of a position\n /// @dev Collect events may be emitted with zero amount0 and amount1 when the caller chooses not to collect fees\n /// @param owner The owner of the position for which fees are collected\n /// @param tickLower The lower tick of the position\n /// @param tickUpper The upper tick of the position\n /// @param amount0 The amount of token0 fees collected\n /// @param amount1 The amount of token1 fees collected\n event Collect(\n address indexed owner,\n address recipient,\n int24 indexed tickLower,\n int24 indexed tickUpper,\n uint128 amount0,\n uint128 amount1\n );\n\n /// @notice Emitted when a position's liquidity is removed\n /// @dev Does not withdraw any fees earned by the liquidity position, which must be withdrawn via #collect\n /// @param owner The owner of the position for which liquidity is removed\n /// @param tickLower The lower tick of the position\n /// @param tickUpper The upper tick of the position\n /// @param amount The amount of liquidity to remove\n /// @param amount0 The amount of token0 withdrawn\n /// @param amount1 The amount of token1 withdrawn\n event Burn(\n address indexed owner,\n int24 indexed tickLower,\n int24 indexed tickUpper,\n uint128 amount,\n uint256 amount0,\n uint256 amount1\n );\n\n /// @notice Emitted by the pool for any swaps between token0 and token1\n /// @param sender The address that initiated the swap call, and that received the callback\n /// @param recipient The address that received the output of the swap\n /// @param amount0 The delta of the token0 balance of the pool\n /// @param amount1 The delta of the token1 balance of the pool\n /// @param sqrtPriceX96 The sqrt(price) of the pool after the swap, as a Q64.96\n /// @param liquidity The liquidity of the pool after the swap\n /// @param tick The log base 1.0001 of price of the pool after the swap\n event Swap(\n address indexed sender,\n address indexed recipient,\n int256 amount0,\n int256 amount1,\n uint160 sqrtPriceX96,\n uint128 liquidity,\n int24 tick\n );\n\n /// @notice Emitted by the pool for any flashes of token0/token1\n /// @param sender The address that initiated the swap call, and that received the callback\n /// @param recipient The address that received the tokens from flash\n /// @param amount0 The amount of token0 that was flashed\n /// @param amount1 The amount of token1 that was flashed\n /// @param paid0 The amount of token0 paid for the flash, which can exceed the amount0 plus the fee\n /// @param paid1 The amount of token1 paid for the flash, which can exceed the amount1 plus the fee\n event Flash(\n address indexed sender,\n address indexed recipient,\n uint256 amount0,\n uint256 amount1,\n uint256 paid0,\n uint256 paid1\n );\n\n /// @notice Emitted by the pool for increases to the number of observations that can be stored\n /// @dev observationCardinalityNext is not the observation cardinality until an observation is written at the index\n /// just before a mint/swap/burn.\n /// @param observationCardinalityNextOld The previous value of the next observation cardinality\n /// @param observationCardinalityNextNew The updated value of the next observation cardinality\n event IncreaseObservationCardinalityNext(\n uint16 observationCardinalityNextOld,\n uint16 observationCardinalityNextNew\n );\n\n /// @notice Emitted when the protocol fee is changed by the pool\n /// @param feeProtocol0Old The previous value of the token0 protocol fee\n /// @param feeProtocol1Old The previous value of the token1 protocol fee\n /// @param feeProtocol0New The updated value of the token0 protocol fee\n /// @param feeProtocol1New The updated value of the token1 protocol fee\n event SetFeeProtocol(uint8 feeProtocol0Old, uint8 feeProtocol1Old, uint8 feeProtocol0New, uint8 feeProtocol1New);\n\n /// @notice Emitted when the collected protocol fees are withdrawn by the factory owner\n /// @param sender The address that collects the protocol fees\n /// @param recipient The address that receives the collected protocol fees\n /// @param amount0 The amount of token0 protocol fees that is withdrawn\n /// @param amount0 The amount of token1 protocol fees that is withdrawn\n event CollectProtocol(address indexed sender, address indexed recipient, uint128 amount0, uint128 amount1);\n}\n" - }, - "solidity/for-test/UniV3PairManagerForTest.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '@openzeppelin/contracts/token/ERC20/ERC20.sol';\nimport '@uniswap/v3-core/contracts/interfaces/IUniswapV3Pool.sol';\n\nimport '../contracts/libraries/LiquidityAmounts.sol';\nimport '../contracts/libraries/PoolAddress.sol';\nimport '../contracts/libraries/FixedPoint96.sol';\nimport '../contracts/libraries/FullMath.sol';\nimport '../contracts/libraries/TickMath.sol';\nimport '../contracts/UniV3PairManager.sol';\nimport '../interfaces/external/IWeth9.sol';\nimport '../interfaces/IUniV3PairManager.sol';\n\ncontract UniV3PairManagerForTest is UniV3PairManager {\n constructor(address _pool, address _governance) UniV3PairManager(_pool, _governance) {}\n\n function internalAddLiquidity(\n uint256 amount0Desired,\n uint256 amount1Desired,\n uint256 amount0Min,\n uint256 amount1Min\n )\n external\n returns (\n uint128 liquidity,\n uint256 amount0,\n uint256 amount1\n )\n {\n return _addLiquidity(amount0Desired, amount1Desired, amount0Min, amount1Min);\n }\n\n function internalPay(\n address token,\n address payer,\n address recipient,\n uint256 value\n ) external {\n return _pay(token, payer, recipient, value);\n }\n\n function internalMint(address dst, uint256 amount) external {\n return _mint(dst, amount);\n }\n\n function internalBurn(address dst, uint256 amount) external {\n return _burn(dst, amount);\n }\n\n function internalTransferTokens(\n address src,\n address dst,\n uint256 amount\n ) external {\n _transferTokens(src, dst, amount);\n }\n\n function internalSafeTransferFrom(\n address token,\n address from,\n address to,\n uint256 value\n ) external {\n _safeTransferFrom(token, from, to, value);\n }\n\n receive() external payable {}\n}\n" - }, - "@openzeppelin/contracts/token/ERC20/ERC20.sol": { - "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\nimport \"./IERC20.sol\";\nimport \"./extensions/IERC20Metadata.sol\";\nimport \"../../utils/Context.sol\";\n\n/**\n * @dev Implementation of the {IERC20} interface.\n *\n * This implementation is agnostic to the way tokens are created. This means\n * that a supply mechanism has to be added in a derived contract using {_mint}.\n * For a generic mechanism see {ERC20PresetMinterPauser}.\n *\n * TIP: For a detailed writeup see our guide\n * https://forum.zeppelin.solutions/t/how-to-implement-erc20-supply-mechanisms/226[How\n * to implement supply mechanisms].\n *\n * We have followed general OpenZeppelin Contracts guidelines: functions revert\n * instead returning `false` on failure. This behavior is nonetheless\n * conventional and does not conflict with the expectations of ERC20\n * applications.\n *\n * Additionally, an {Approval} event is emitted on calls to {transferFrom}.\n * This allows applications to reconstruct the allowance for all accounts just\n * by listening to said events. Other implementations of the EIP may not emit\n * these events, as it isn't required by the specification.\n *\n * Finally, the non-standard {decreaseAllowance} and {increaseAllowance}\n * functions have been added to mitigate the well-known issues around setting\n * allowances. See {IERC20-approve}.\n */\ncontract ERC20 is Context, IERC20, IERC20Metadata {\n mapping(address => uint256) private _balances;\n\n mapping(address => mapping(address => uint256)) private _allowances;\n\n uint256 private _totalSupply;\n\n string private _name;\n string private _symbol;\n\n /**\n * @dev Sets the values for {name} and {symbol}.\n *\n * The default value of {decimals} is 18. To select a different value for\n * {decimals} you should overload it.\n *\n * All two of these values are immutable: they can only be set once during\n * construction.\n */\n constructor(string memory name_, string memory symbol_) {\n _name = name_;\n _symbol = symbol_;\n }\n\n /**\n * @dev Returns the name of the token.\n */\n function name() public view virtual override returns (string memory) {\n return _name;\n }\n\n /**\n * @dev Returns the symbol of the token, usually a shorter version of the\n * name.\n */\n function symbol() public view virtual override returns (string memory) {\n return _symbol;\n }\n\n /**\n * @dev Returns the number of decimals used to get its user representation.\n * For example, if `decimals` equals `2`, a balance of `505` tokens should\n * be displayed to a user as `5.05` (`505 / 10 ** 2`).\n *\n * Tokens usually opt for a value of 18, imitating the relationship between\n * Ether and Wei. This is the value {ERC20} uses, unless this function is\n * overridden;\n *\n * NOTE: This information is only used for _display_ purposes: it in\n * no way affects any of the arithmetic of the contract, including\n * {IERC20-balanceOf} and {IERC20-transfer}.\n */\n function decimals() public view virtual override returns (uint8) {\n return 18;\n }\n\n /**\n * @dev See {IERC20-totalSupply}.\n */\n function totalSupply() public view virtual override returns (uint256) {\n return _totalSupply;\n }\n\n /**\n * @dev See {IERC20-balanceOf}.\n */\n function balanceOf(address account) public view virtual override returns (uint256) {\n return _balances[account];\n }\n\n /**\n * @dev See {IERC20-transfer}.\n *\n * Requirements:\n *\n * - `recipient` cannot be the zero address.\n * - the caller must have a balance of at least `amount`.\n */\n function transfer(address recipient, uint256 amount) public virtual override returns (bool) {\n _transfer(_msgSender(), recipient, amount);\n return true;\n }\n\n /**\n * @dev See {IERC20-allowance}.\n */\n function allowance(address owner, address spender) public view virtual override returns (uint256) {\n return _allowances[owner][spender];\n }\n\n /**\n * @dev See {IERC20-approve}.\n *\n * Requirements:\n *\n * - `spender` cannot be the zero address.\n */\n function approve(address spender, uint256 amount) public virtual override returns (bool) {\n _approve(_msgSender(), spender, amount);\n return true;\n }\n\n /**\n * @dev See {IERC20-transferFrom}.\n *\n * Emits an {Approval} event indicating the updated allowance. This is not\n * required by the EIP. See the note at the beginning of {ERC20}.\n *\n * Requirements:\n *\n * - `sender` and `recipient` cannot be the zero address.\n * - `sender` must have a balance of at least `amount`.\n * - the caller must have allowance for ``sender``'s tokens of at least\n * `amount`.\n */\n function transferFrom(\n address sender,\n address recipient,\n uint256 amount\n ) public virtual override returns (bool) {\n _transfer(sender, recipient, amount);\n\n uint256 currentAllowance = _allowances[sender][_msgSender()];\n require(currentAllowance >= amount, \"ERC20: transfer amount exceeds allowance\");\n unchecked {\n _approve(sender, _msgSender(), currentAllowance - amount);\n }\n\n return true;\n }\n\n /**\n * @dev Atomically increases the allowance granted to `spender` by the caller.\n *\n * This is an alternative to {approve} that can be used as a mitigation for\n * problems described in {IERC20-approve}.\n *\n * Emits an {Approval} event indicating the updated allowance.\n *\n * Requirements:\n *\n * - `spender` cannot be the zero address.\n */\n function increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool) {\n _approve(_msgSender(), spender, _allowances[_msgSender()][spender] + addedValue);\n return true;\n }\n\n /**\n * @dev Atomically decreases the allowance granted to `spender` by the caller.\n *\n * This is an alternative to {approve} that can be used as a mitigation for\n * problems described in {IERC20-approve}.\n *\n * Emits an {Approval} event indicating the updated allowance.\n *\n * Requirements:\n *\n * - `spender` cannot be the zero address.\n * - `spender` must have allowance for the caller of at least\n * `subtractedValue`.\n */\n function decreaseAllowance(address spender, uint256 subtractedValue) public virtual returns (bool) {\n uint256 currentAllowance = _allowances[_msgSender()][spender];\n require(currentAllowance >= subtractedValue, \"ERC20: decreased allowance below zero\");\n unchecked {\n _approve(_msgSender(), spender, currentAllowance - subtractedValue);\n }\n\n return true;\n }\n\n /**\n * @dev Moves `amount` of tokens from `sender` to `recipient`.\n *\n * This internal function is equivalent to {transfer}, and can be used to\n * e.g. implement automatic token fees, slashing mechanisms, etc.\n *\n * Emits a {Transfer} event.\n *\n * Requirements:\n *\n * - `sender` cannot be the zero address.\n * - `recipient` cannot be the zero address.\n * - `sender` must have a balance of at least `amount`.\n */\n function _transfer(\n address sender,\n address recipient,\n uint256 amount\n ) internal virtual {\n require(sender != address(0), \"ERC20: transfer from the zero address\");\n require(recipient != address(0), \"ERC20: transfer to the zero address\");\n\n _beforeTokenTransfer(sender, recipient, amount);\n\n uint256 senderBalance = _balances[sender];\n require(senderBalance >= amount, \"ERC20: transfer amount exceeds balance\");\n unchecked {\n _balances[sender] = senderBalance - amount;\n }\n _balances[recipient] += amount;\n\n emit Transfer(sender, recipient, amount);\n\n _afterTokenTransfer(sender, recipient, amount);\n }\n\n /** @dev Creates `amount` tokens and assigns them to `account`, increasing\n * the total supply.\n *\n * Emits a {Transfer} event with `from` set to the zero address.\n *\n * Requirements:\n *\n * - `account` cannot be the zero address.\n */\n function _mint(address account, uint256 amount) internal virtual {\n require(account != address(0), \"ERC20: mint to the zero address\");\n\n _beforeTokenTransfer(address(0), account, amount);\n\n _totalSupply += amount;\n _balances[account] += amount;\n emit Transfer(address(0), account, amount);\n\n _afterTokenTransfer(address(0), account, amount);\n }\n\n /**\n * @dev Destroys `amount` tokens from `account`, reducing the\n * total supply.\n *\n * Emits a {Transfer} event with `to` set to the zero address.\n *\n * Requirements:\n *\n * - `account` cannot be the zero address.\n * - `account` must have at least `amount` tokens.\n */\n function _burn(address account, uint256 amount) internal virtual {\n require(account != address(0), \"ERC20: burn from the zero address\");\n\n _beforeTokenTransfer(account, address(0), amount);\n\n uint256 accountBalance = _balances[account];\n require(accountBalance >= amount, \"ERC20: burn amount exceeds balance\");\n unchecked {\n _balances[account] = accountBalance - amount;\n }\n _totalSupply -= amount;\n\n emit Transfer(account, address(0), amount);\n\n _afterTokenTransfer(account, address(0), amount);\n }\n\n /**\n * @dev Sets `amount` as the allowance of `spender` over the `owner` s tokens.\n *\n * This internal function is equivalent to `approve`, and can be used to\n * e.g. set automatic allowances for certain subsystems, etc.\n *\n * Emits an {Approval} event.\n *\n * Requirements:\n *\n * - `owner` cannot be the zero address.\n * - `spender` cannot be the zero address.\n */\n function _approve(\n address owner,\n address spender,\n uint256 amount\n ) internal virtual {\n require(owner != address(0), \"ERC20: approve from the zero address\");\n require(spender != address(0), \"ERC20: approve to the zero address\");\n\n _allowances[owner][spender] = amount;\n emit Approval(owner, spender, amount);\n }\n\n /**\n * @dev Hook that is called before any transfer of tokens. This includes\n * minting and burning.\n *\n * Calling conditions:\n *\n * - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens\n * will be transferred to `to`.\n * - when `from` is zero, `amount` tokens will be minted for `to`.\n * - when `to` is zero, `amount` of ``from``'s tokens will be burned.\n * - `from` and `to` are never both zero.\n *\n * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].\n */\n function _beforeTokenTransfer(\n address from,\n address to,\n uint256 amount\n ) internal virtual {}\n\n /**\n * @dev Hook that is called after any transfer of tokens. This includes\n * minting and burning.\n *\n * Calling conditions:\n *\n * - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens\n * has been transferred to `to`.\n * - when `from` is zero, `amount` tokens have been minted for `to`.\n * - when `to` is zero, `amount` of ``from``'s tokens have been burned.\n * - `from` and `to` are never both zero.\n *\n * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].\n */\n function _afterTokenTransfer(\n address from,\n address to,\n uint256 amount\n ) internal virtual {}\n}\n" - }, - "solidity/contracts/libraries/LiquidityAmounts.sol": { - "content": "// SPDX-License-Identifier: GPL-2.0-or-later\npragma solidity >=0.8.4 <0.9.0;\n\nimport './FullMath.sol';\nimport './FixedPoint96.sol';\n\n// solhint-disable\nlibrary LiquidityAmounts {\n function toUint128(uint256 x) private pure returns (uint128 y) {\n require((y = uint128(x)) == x);\n }\n\n function getLiquidityForAmount0(\n uint160 sqrtRatioAX96,\n uint160 sqrtRatioBX96,\n uint256 amount0\n ) internal pure returns (uint128 liquidity) {\n if (sqrtRatioAX96 > sqrtRatioBX96) (sqrtRatioAX96, sqrtRatioBX96) = (sqrtRatioBX96, sqrtRatioAX96);\n uint256 intermediate = FullMath.mulDiv(sqrtRatioAX96, sqrtRatioBX96, FixedPoint96.Q96);\n return toUint128(FullMath.mulDiv(amount0, intermediate, sqrtRatioBX96 - sqrtRatioAX96));\n }\n\n function getLiquidityForAmount1(\n uint160 sqrtRatioAX96,\n uint160 sqrtRatioBX96,\n uint256 amount1\n ) internal pure returns (uint128 liquidity) {\n if (sqrtRatioAX96 > sqrtRatioBX96) (sqrtRatioAX96, sqrtRatioBX96) = (sqrtRatioBX96, sqrtRatioAX96);\n return toUint128(FullMath.mulDiv(amount1, FixedPoint96.Q96, sqrtRatioBX96 - sqrtRatioAX96));\n }\n\n function getLiquidityForAmounts(\n uint160 sqrtRatioX96,\n uint160 sqrtRatioAX96,\n uint160 sqrtRatioBX96,\n uint256 amount0,\n uint256 amount1\n ) internal pure returns (uint128 liquidity) {\n if (sqrtRatioAX96 > sqrtRatioBX96) (sqrtRatioAX96, sqrtRatioBX96) = (sqrtRatioBX96, sqrtRatioAX96);\n\n if (sqrtRatioX96 <= sqrtRatioAX96) {\n liquidity = getLiquidityForAmount0(sqrtRatioAX96, sqrtRatioBX96, amount0);\n } else if (sqrtRatioX96 < sqrtRatioBX96) {\n uint128 liquidity0 = getLiquidityForAmount0(sqrtRatioX96, sqrtRatioBX96, amount0);\n uint128 liquidity1 = getLiquidityForAmount1(sqrtRatioAX96, sqrtRatioX96, amount1);\n\n liquidity = liquidity0 < liquidity1 ? liquidity0 : liquidity1;\n } else {\n liquidity = getLiquidityForAmount1(sqrtRatioAX96, sqrtRatioBX96, amount1);\n }\n }\n\n function getAmount0ForLiquidity(\n uint160 sqrtRatioAX96,\n uint160 sqrtRatioBX96,\n uint128 liquidity\n ) internal pure returns (uint256 amount0) {\n if (sqrtRatioAX96 > sqrtRatioBX96) (sqrtRatioAX96, sqrtRatioBX96) = (sqrtRatioBX96, sqrtRatioAX96);\n\n return FullMath.mulDiv(uint256(liquidity) << FixedPoint96.RESOLUTION, sqrtRatioBX96 - sqrtRatioAX96, sqrtRatioBX96) / sqrtRatioAX96;\n }\n\n function getAmount1ForLiquidity(\n uint160 sqrtRatioAX96,\n uint160 sqrtRatioBX96,\n uint128 liquidity\n ) internal pure returns (uint256 amount1) {\n if (sqrtRatioAX96 > sqrtRatioBX96) (sqrtRatioAX96, sqrtRatioBX96) = (sqrtRatioBX96, sqrtRatioAX96);\n\n return FullMath.mulDiv(liquidity, sqrtRatioBX96 - sqrtRatioAX96, FixedPoint96.Q96);\n }\n\n function getAmountsForLiquidity(\n uint160 sqrtRatioX96,\n uint160 sqrtRatioAX96,\n uint160 sqrtRatioBX96,\n uint128 liquidity\n ) internal pure returns (uint256 amount0, uint256 amount1) {\n if (sqrtRatioAX96 > sqrtRatioBX96) (sqrtRatioAX96, sqrtRatioBX96) = (sqrtRatioBX96, sqrtRatioAX96);\n\n if (sqrtRatioX96 <= sqrtRatioAX96) {\n amount0 = getAmount0ForLiquidity(sqrtRatioAX96, sqrtRatioBX96, liquidity);\n } else if (sqrtRatioX96 < sqrtRatioBX96) {\n amount0 = getAmount0ForLiquidity(sqrtRatioX96, sqrtRatioBX96, liquidity);\n amount1 = getAmount1ForLiquidity(sqrtRatioAX96, sqrtRatioX96, liquidity);\n } else {\n amount1 = getAmount1ForLiquidity(sqrtRatioAX96, sqrtRatioBX96, liquidity);\n }\n }\n}\n" - }, - "solidity/contracts/libraries/PoolAddress.sol": { - "content": "// SPDX-License-Identifier: GPL-2.0-or-later\npragma solidity >=0.8.4 <0.9.0;\n\nlibrary PoolAddress {\n struct PoolKey {\n address token0;\n address token1;\n uint24 fee;\n }\n}\n" - }, - "solidity/contracts/libraries/FixedPoint96.sol": { - "content": "// SPDX-License-Identifier: GPL-2.0-or-later\npragma solidity >=0.8.4 <0.9.0;\n\nlibrary FixedPoint96 {\n // solhint-disable\n uint8 internal constant RESOLUTION = 96;\n uint256 internal constant Q96 = 0x1000000000000000000000000;\n}\n" - }, - "solidity/contracts/UniV3PairManager.sol": { - "content": "// SPDX-License-Identifier: MIT\n\n/*\n\nCoded for The Keep3r Network with ♥ by\n\n██████╗░███████╗███████╗██╗  ░██╗░░░░░░░██╗░█████╗░███╗░░██╗██████╗░███████╗██████╗░██╗░░░░░░█████╗░███╗░░██╗██████╗░\n██╔══██╗██╔════╝██╔════╝██║  ░██║░░██╗░░██║██╔══██╗████╗░██║██╔══██╗██╔════╝██╔══██╗██║░░░░░██╔══██╗████╗░██║██╔══██╗\n██║░░██║█████╗░░█████╗░░██║  ░╚██╗████╗██╔╝██║░░██║██╔██╗██║██║░░██║█████╗░░██████╔╝██║░░░░░███████║██╔██╗██║██║░░██║\n██║░░██║██╔══╝░░██╔══╝░░██║  ░░████╔═████║░██║░░██║██║╚████║██║░░██║██╔══╝░░██╔══██╗██║░░░░░██╔══██║██║╚████║██║░░██║\n██████╔╝███████╗██║░░░░░██║  ░░╚██╔╝░╚██╔╝░╚█████╔╝██║░╚███║██████╔╝███████╗██║░░██║███████╗██║░░██║██║░╚███║██████╔╝\n╚═════╝░╚══════╝╚═╝░░░░░╚═╝  ░░░╚═╝░░░╚═╝░░░╚════╝░╚═╝░░╚══╝╚═════╝░╚══════╝╚═╝░░╚═╝╚══════╝╚═╝░░╚═╝╚═╝░░╚══╝╚═════╝░\n\nhttps://defi.sucks\n\n*/\n\npragma solidity >=0.8.4 <0.9.0;\n\nimport '@openzeppelin/contracts/token/ERC20/ERC20.sol';\nimport '@uniswap/v3-core/contracts/interfaces/IUniswapV3Pool.sol';\n\nimport './libraries/LiquidityAmounts.sol';\nimport './libraries/PoolAddress.sol';\nimport './libraries/FixedPoint96.sol';\nimport './libraries/FullMath.sol';\nimport './libraries/TickMath.sol';\n\nimport '../interfaces/external/IWeth9.sol';\nimport '../interfaces/IUniV3PairManager.sol';\n\nimport './peripherals/Governable.sol';\n\ncontract UniV3PairManager is IUniV3PairManager, Governable {\n /// @inheritdoc IERC20Metadata\n string public override name;\n\n /// @inheritdoc IERC20Metadata\n string public override symbol;\n\n /// @inheritdoc IERC20\n uint256 public override totalSupply;\n\n /// @inheritdoc IPairManager\n address public immutable override factory;\n\n /// @inheritdoc IPairManager\n address public immutable override token0;\n\n /// @inheritdoc IPairManager\n address public immutable override token1;\n\n /// @inheritdoc IPairManager\n address public immutable override pool;\n\n /// @inheritdoc IUniV3PairManager\n uint24 public immutable override fee;\n\n /// @inheritdoc IUniV3PairManager\n uint160 public immutable override sqrtRatioAX96;\n\n /// @inheritdoc IUniV3PairManager\n uint160 public immutable override sqrtRatioBX96;\n\n /// @inheritdoc IUniV3PairManager\n int24 public immutable override tickLower;\n\n /// @inheritdoc IUniV3PairManager\n int24 public immutable override tickUpper;\n\n /// @inheritdoc IUniV3PairManager\n int24 public immutable override tickSpacing;\n\n /// @notice Uniswap's maximum tick\n /// @dev Due to tick spacing, pools with different fees may have differences between _MAX_TICK and tickUpper. Use tickUpper to find the max tick of the pool.\n int24 private constant _MAX_TICK = 887272;\n\n /// @inheritdoc IERC20Metadata\n //solhint-disable-next-line const-name-snakecase\n uint8 public constant override decimals = 18;\n\n /// @inheritdoc IERC20\n mapping(address => mapping(address => uint256)) public override allowance;\n\n /// @inheritdoc IERC20\n mapping(address => uint256) public override balanceOf;\n\n /// @notice Struct that contains token0, token1, and fee of the Uniswap pool\n PoolAddress.PoolKey private _poolKey;\n\n constructor(address _pool, address _governance) Governable(_governance) {\n uint24 _fee = IUniswapV3Pool(_pool).fee();\n address _token0 = IUniswapV3Pool(_pool).token0();\n address _token1 = IUniswapV3Pool(_pool).token1();\n int24 _tickSpacing = IUniswapV3Pool(_pool).tickSpacing();\n int24 _tickUpper = _MAX_TICK - (_MAX_TICK % _tickSpacing);\n int24 _tickLower = -_tickUpper;\n\n factory = msg.sender;\n pool = _pool;\n fee = _fee;\n tickSpacing = _tickSpacing;\n tickUpper = _tickUpper;\n tickLower = _tickLower;\n token0 = _token0;\n token1 = _token1;\n name = string(abi.encodePacked('Keep3rLP - ', ERC20(_token0).symbol(), '/', ERC20(_token1).symbol()));\n symbol = string(abi.encodePacked('kLP-', ERC20(_token0).symbol(), '/', ERC20(_token1).symbol()));\n\n sqrtRatioAX96 = TickMath.getSqrtRatioAtTick(_tickLower);\n sqrtRatioBX96 = TickMath.getSqrtRatioAtTick(_tickUpper);\n _poolKey = PoolAddress.PoolKey({token0: _token0, token1: _token1, fee: _fee});\n }\n\n // This low-level function should be called from a contract which performs important safety checks\n /// @inheritdoc IUniV3PairManager\n function mint(\n uint256 amount0Desired,\n uint256 amount1Desired,\n uint256 amount0Min,\n uint256 amount1Min,\n address to\n ) external override returns (uint128 liquidity) {\n (liquidity, , ) = _addLiquidity(amount0Desired, amount1Desired, amount0Min, amount1Min);\n _mint(to, liquidity);\n }\n\n /// @inheritdoc IUniV3PairManager\n function uniswapV3MintCallback(\n uint256 amount0Owed,\n uint256 amount1Owed,\n bytes calldata data\n ) external override {\n MintCallbackData memory decoded = abi.decode(data, (MintCallbackData));\n if (msg.sender != pool) revert OnlyPool();\n if (amount0Owed > 0) _pay(decoded._poolKey.token0, decoded.payer, pool, amount0Owed);\n if (amount1Owed > 0) _pay(decoded._poolKey.token1, decoded.payer, pool, amount1Owed);\n }\n\n /// @inheritdoc IUniV3PairManager\n function burn(\n uint128 liquidity,\n uint256 amount0Min,\n uint256 amount1Min,\n address to\n ) external override returns (uint256 amount0, uint256 amount1) {\n (amount0, amount1) = IUniswapV3Pool(pool).burn(tickLower, tickUpper, liquidity);\n\n if (amount0 < amount0Min || amount1 < amount1Min) revert ExcessiveSlippage();\n\n IUniswapV3Pool(pool).collect(to, tickLower, tickUpper, uint128(amount0), uint128(amount1));\n _burn(msg.sender, liquidity);\n }\n\n /// @inheritdoc IUniV3PairManager\n function collect() external override onlyGovernance returns (uint256 amount0, uint256 amount1) {\n (, , , uint128 tokensOwed0, uint128 tokensOwed1) = IUniswapV3Pool(pool).positions(\n keccak256(abi.encodePacked(address(this), tickLower, tickUpper))\n );\n (amount0, amount1) = IUniswapV3Pool(pool).collect(governance, tickLower, tickUpper, tokensOwed0, tokensOwed1);\n }\n\n /// @inheritdoc IUniV3PairManager\n function position()\n external\n view\n override\n returns (\n uint128 liquidity,\n uint256 feeGrowthInside0LastX128,\n uint256 feeGrowthInside1LastX128,\n uint128 tokensOwed0,\n uint128 tokensOwed1\n )\n {\n (liquidity, feeGrowthInside0LastX128, feeGrowthInside1LastX128, tokensOwed0, tokensOwed1) = IUniswapV3Pool(pool).positions(\n keccak256(abi.encodePacked(address(this), tickLower, tickUpper))\n );\n }\n\n /// @inheritdoc IERC20\n function approve(address spender, uint256 amount) external override returns (bool) {\n allowance[msg.sender][spender] = amount;\n\n emit Approval(msg.sender, spender, amount);\n return true;\n }\n\n /// @inheritdoc IERC20\n function transfer(address to, uint256 amount) external override returns (bool) {\n _transferTokens(msg.sender, to, amount);\n return true;\n }\n\n /// @inheritdoc IERC20\n function transferFrom(\n address from,\n address to,\n uint256 amount\n ) external override returns (bool) {\n address spender = msg.sender;\n uint256 spenderAllowance = allowance[from][spender];\n\n if (spender != from && spenderAllowance != type(uint256).max) {\n uint256 newAllowance = spenderAllowance - amount;\n allowance[from][spender] = newAllowance;\n\n emit Approval(from, spender, newAllowance);\n }\n\n _transferTokens(from, to, amount);\n return true;\n }\n\n /// @notice Adds liquidity to an initialized pool\n /// @dev Reverts if the returned amount0 is less than amount0Min or if amount1 is less than amount1Min\n /// @dev This function calls the mint function of the corresponding Uniswap pool, which in turn calls UniswapV3Callback\n /// @param amount0Desired The amount of token0 we would like to provide\n /// @param amount1Desired The amount of token1 we would like to provide\n /// @param amount0Min The minimum amount of token0 we want to provide\n /// @param amount1Min The minimum amount of token1 we want to provide\n /// @return liquidity The calculated liquidity we get for the token amounts we provided\n /// @return amount0 The amount of token0 we ended up providing\n /// @return amount1 The amount of token1 we ended up providing\n function _addLiquidity(\n uint256 amount0Desired,\n uint256 amount1Desired,\n uint256 amount0Min,\n uint256 amount1Min\n )\n internal\n returns (\n uint128 liquidity,\n uint256 amount0,\n uint256 amount1\n )\n {\n (uint160 sqrtPriceX96, , , , , , ) = IUniswapV3Pool(pool).slot0();\n\n liquidity = LiquidityAmounts.getLiquidityForAmounts(sqrtPriceX96, sqrtRatioAX96, sqrtRatioBX96, amount0Desired, amount1Desired);\n\n (amount0, amount1) = IUniswapV3Pool(pool).mint(\n address(this),\n tickLower,\n tickUpper,\n liquidity,\n abi.encode(MintCallbackData({_poolKey: _poolKey, payer: msg.sender}))\n );\n\n if (amount0 < amount0Min || amount1 < amount1Min) revert ExcessiveSlippage();\n }\n\n /// @notice Transfers the passed-in token from the payer to the recipient for the corresponding value\n /// @param token The token to be transferred to the recipient\n /// @param from The address of the payer\n /// @param to The address of the passed-in tokens recipient\n /// @param value How much of that token to be transferred from payer to the recipient\n function _pay(\n address token,\n address from,\n address to,\n uint256 value\n ) internal {\n _safeTransferFrom(token, from, to, value);\n }\n\n /// @notice Mints Keep3r credits to the passed-in address of recipient and increases total supply of Keep3r credits by the corresponding amount\n /// @param to The recipient of the Keep3r credits\n /// @param amount The amount Keep3r credits to be minted to the recipient\n function _mint(address to, uint256 amount) internal {\n totalSupply += amount;\n balanceOf[to] += amount;\n emit Transfer(address(0), to, amount);\n }\n\n /// @notice Burns Keep3r credits to the passed-in address of recipient and reduces total supply of Keep3r credits by the corresponding amount\n /// @param to The address that will get its Keep3r credits burned\n /// @param amount The amount Keep3r credits to be burned from the recipient/recipient\n function _burn(address to, uint256 amount) internal {\n totalSupply -= amount;\n balanceOf[to] -= amount;\n emit Transfer(to, address(0), amount);\n }\n\n /// @notice Transfers amount of Keep3r credits between two addresses\n /// @param from The user that transfers the Keep3r credits\n /// @param to The user that receives the Keep3r credits\n /// @param amount The amount of Keep3r credits to be transferred\n function _transferTokens(\n address from,\n address to,\n uint256 amount\n ) internal {\n balanceOf[from] -= amount;\n balanceOf[to] += amount;\n\n emit Transfer(from, to, amount);\n }\n\n /// @notice Transfers the passed-in token from the specified \"from\" to the specified \"to\" for the corresponding value\n /// @dev Reverts with IUniV3PairManager#UnsuccessfulTransfer if the transfer was not successful,\n /// or if the passed data length is different than 0 and the decoded data is not a boolean\n /// @param token The token to be transferred to the specified \"to\"\n /// @param from The address which is going to transfer the tokens\n /// @param value How much of that token to be transferred from \"from\" to \"to\"\n function _safeTransferFrom(\n address token,\n address from,\n address to,\n uint256 value\n ) internal {\n // solhint-disable-next-line avoid-low-level-calls\n (bool success, bytes memory data) = token.call(abi.encodeWithSelector(IERC20.transferFrom.selector, from, to, value));\n if (!success || (data.length != 0 && !abi.decode(data, (bool)))) revert UnsuccessfulTransfer();\n }\n}\n" - }, - "solidity/interfaces/external/IWeth9.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '@openzeppelin/contracts/token/ERC20/IERC20.sol';\n\ninterface IWeth9 is IERC20 {\n function deposit() external payable;\n\n function withdraw(uint256) external;\n}\n" - }, - "solidity/interfaces/IUniV3PairManager.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport './IPairManager.sol';\nimport '../contracts/libraries/PoolAddress.sol';\nimport '@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol';\nimport './peripherals/IGovernable.sol';\n\n/// @title Pair Manager contract\n/// @notice Creates a UniswapV3 position, and tokenizes in an ERC20 manner\n/// so that the user can use it as liquidity for a Keep3rJob\ninterface IUniV3PairManager is IGovernable, IPairManager {\n // Structs\n\n /// @notice The data to be decoded by the UniswapV3MintCallback function\n struct MintCallbackData {\n PoolAddress.PoolKey _poolKey; // Struct that contains token0, token1, and fee of the pool passed into the constructor\n address payer; // The address of the payer, which will be the msg.sender of the mint function\n }\n\n // Variables\n\n /// @notice The fee of the Uniswap pool passed into the constructor\n /// @return _fee The fee of the Uniswap pool passed into the constructor\n function fee() external view returns (uint24 _fee);\n\n /// @notice Highest tick in the Uniswap's curve\n /// @return _tickUpper The highest tick in the Uniswap's curve\n function tickUpper() external view returns (int24 _tickUpper);\n\n /// @notice Lowest tick in the Uniswap's curve\n /// @return _tickLower The lower tick in the Uniswap's curve\n function tickLower() external view returns (int24 _tickLower);\n\n /// @notice The pair tick spacing\n /// @return _tickSpacing The pair tick spacing\n function tickSpacing() external view returns (int24 _tickSpacing);\n\n /// @notice The sqrtRatioAX96 at the lowest tick (-887200) of the Uniswap pool\n /// @return _sqrtPriceA96 A Fixed point Q64.96 number representing the sqrt of the ratio of the two assets (token1/token0)\n /// at the lowest tick\n function sqrtRatioAX96() external view returns (uint160 _sqrtPriceA96);\n\n /// @notice The sqrtRatioBX96 at the highest tick (887200) of the Uniswap pool\n /// @return _sqrtPriceBX96 A Fixed point Q64.96 number representing the sqrt of the ratio of the two assets (token1/token0)\n /// at the highest tick\n function sqrtRatioBX96() external view returns (uint160 _sqrtPriceBX96);\n\n // Errors\n\n /// @notice Throws when the caller of the function is not the pool\n error OnlyPool();\n\n /// @notice Throws when the slippage exceeds what the user is comfortable with\n error ExcessiveSlippage();\n\n /// @notice Throws when a transfer is unsuccessful\n error UnsuccessfulTransfer();\n\n // Methods\n\n /// @notice This function is called after a user calls IUniV3PairManager#mint function\n /// It ensures that any tokens owed to the pool are paid by the msg.sender of IUniV3PairManager#mint function\n /// @param amount0Owed The amount of token0 due to the pool for the minted liquidity\n /// @param amount1Owed The amount of token1 due to the pool for the minted liquidity\n /// @param data The encoded token0, token1, fee (_poolKey) and the payer (msg.sender) of the IUniV3PairManager#mint function\n function uniswapV3MintCallback(\n uint256 amount0Owed,\n uint256 amount1Owed,\n bytes calldata data\n ) external;\n\n /// @notice Mints kLP tokens to an address according to the liquidity the msg.sender provides to the UniswapV3 pool\n /// @dev Triggers UniV3PairManager#uniswapV3MintCallback\n /// @param amount0Desired The amount of token0 we would like to provide\n /// @param amount1Desired The amount of token1 we would like to provide\n /// @param amount0Min The minimum amount of token0 we want to provide\n /// @param amount1Min The minimum amount of token1 we want to provide\n /// @param to The address to which the kLP tokens are going to be minted to\n /// @return liquidity kLP tokens sent in exchange for the provision of tokens\n function mint(\n uint256 amount0Desired,\n uint256 amount1Desired,\n uint256 amount0Min,\n uint256 amount1Min,\n address to\n ) external returns (uint128 liquidity);\n\n /// @notice Returns the pair manager's position in the corresponding UniswapV3 pool\n /// @return liquidity The amount of liquidity provided to the UniswapV3 pool by the pair manager\n /// @return feeGrowthInside0LastX128 The fee growth of token0 as of the last action on the individual position\n /// @return feeGrowthInside1LastX128 The fee growth of token1 as of the last action on the individual position\n /// @return tokensOwed0 The uncollected amount of token0 owed to the position as of the last computation\n /// @return tokensOwed1 The uncollected amount of token1 owed to the position as of the last computation\n function position()\n external\n view\n returns (\n uint128 liquidity,\n uint256 feeGrowthInside0LastX128,\n uint256 feeGrowthInside1LastX128,\n uint128 tokensOwed0,\n uint128 tokensOwed1\n );\n\n /// @notice Calls the UniswapV3 pool's collect function, which collects up to a maximum amount of fees\n // owed to a specific position to the recipient, in this case, that recipient is the pair manager\n /// @dev The collected fees will be sent to governance\n /// @return amount0 The amount of fees collected in token0\n /// @return amount1 The amount of fees collected in token1\n function collect() external returns (uint256 amount0, uint256 amount1);\n\n /// @notice Burns the corresponding amount of kLP tokens from the msg.sender and withdraws the specified liquidity\n // in the entire range\n /// @param liquidity The amount of liquidity to be burned\n /// @param amount0Min The minimum amount of token0 we want to send to the recipient (to)\n /// @param amount1Min The minimum amount of token1 we want to send to the recipient (to)\n /// @param to The address that will receive the due fees\n /// @return amount0 The calculated amount of token0 that will be sent to the recipient\n /// @return amount1 The calculated amount of token1 that will be sent to the recipient\n function burn(\n uint128 liquidity,\n uint256 amount0Min,\n uint256 amount1Min,\n address to\n ) external returns (uint256 amount0, uint256 amount1);\n}\n" - }, - "@openzeppelin/contracts/utils/Context.sol": { - "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Provides information about the current execution context, including the\n * sender of the transaction and its data. While these are generally available\n * via msg.sender and msg.data, they should not be accessed in such a direct\n * manner, since when dealing with meta-transactions the account sending and\n * paying for execution may not be the actual sender (as far as an application\n * is concerned).\n *\n * This contract is only required for intermediate, library-like contracts.\n */\nabstract contract Context {\n function _msgSender() internal view virtual returns (address) {\n return msg.sender;\n }\n\n function _msgData() internal view virtual returns (bytes calldata) {\n return msg.data;\n }\n}\n" - }, - "solidity/interfaces/IPairManagerFactory.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport './peripherals/IGovernable.sol';\n\n/// @title Factory of Pair Managers\n/// @notice This contract creates new pair managers\ninterface IPairManagerFactory is IGovernable {\n // Variables\n\n /// @notice Maps the address of a Uniswap pool, to the address of the corresponding PairManager\n /// For example, the uniswap address of DAI-WETH, will return the Keep3r/DAI-WETH pair manager address\n /// @param _pool The address of the Uniswap pool\n /// @return _pairManager The address of the corresponding pair manager\n function pairManagers(address _pool) external view returns (address _pairManager);\n\n // Events\n\n /// @notice Emitted when a new pair manager is created\n /// @param _pool The address of the corresponding Uniswap pool\n /// @param _pairManager The address of the just-created pair manager\n event PairCreated(address _pool, address _pairManager);\n\n // Errors\n\n /// @notice Throws an error if the pair manager is already initialized\n error AlreadyInitialized();\n\n /// @notice Throws an error if the caller is not the owner\n error OnlyOwner();\n\n // Methods\n\n /// @notice Creates a new pair manager based on the address of a Uniswap pool\n /// For example, the uniswap address of DAI-WETH, will create the Keep3r/DAI-WETH pool\n /// @param _pool The address of the Uniswap pool the pair manager will be based of\n /// @return _pairManager The address of the just-created pair manager\n function createPairManager(address _pool) external returns (address _pairManager);\n}\n" - }, - "solidity/contracts/UniV3PairManagerFactory.sol": { - "content": "// SPDX-License-Identifier: MIT\n\n/*\n\nCoded for The Keep3r Network with ♥ by\n\n██████╗░███████╗███████╗██╗  ░██╗░░░░░░░██╗░█████╗░███╗░░██╗██████╗░███████╗██████╗░██╗░░░░░░█████╗░███╗░░██╗██████╗░\n██╔══██╗██╔════╝██╔════╝██║  ░██║░░██╗░░██║██╔══██╗████╗░██║██╔══██╗██╔════╝██╔══██╗██║░░░░░██╔══██╗████╗░██║██╔══██╗\n██║░░██║█████╗░░█████╗░░██║  ░╚██╗████╗██╔╝██║░░██║██╔██╗██║██║░░██║█████╗░░██████╔╝██║░░░░░███████║██╔██╗██║██║░░██║\n██║░░██║██╔══╝░░██╔══╝░░██║  ░░████╔═████║░██║░░██║██║╚████║██║░░██║██╔══╝░░██╔══██╗██║░░░░░██╔══██║██║╚████║██║░░██║\n██████╔╝███████╗██║░░░░░██║  ░░╚██╔╝░╚██╔╝░╚█████╔╝██║░╚███║██████╔╝███████╗██║░░██║███████╗██║░░██║██║░╚███║██████╔╝\n╚═════╝░╚══════╝╚═╝░░░░░╚═╝  ░░░╚═╝░░░╚═╝░░░╚════╝░╚═╝░░╚══╝╚═════╝░╚══════╝╚═╝░░╚═╝╚══════╝╚═╝░░╚═╝╚═╝░░╚══╝╚═════╝░\n\nhttps://defi.sucks\n\n*/\n\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../interfaces/IPairManagerFactory.sol';\nimport './UniV3PairManager.sol';\nimport './peripherals/Governable.sol';\n\n/// @title Factory of Pair Managers\n/// @notice This contract creates new pair managers\ncontract UniV3PairManagerFactory is IPairManagerFactory, Governable {\n mapping(address => address) public override pairManagers;\n\n constructor(address _governance) Governable(_governance) {}\n\n ///@inheritdoc IPairManagerFactory\n function createPairManager(address _pool) external override returns (address _pairManager) {\n if (pairManagers[_pool] != address(0)) revert AlreadyInitialized();\n _pairManager = address(new UniV3PairManager(_pool, governance));\n pairManagers[_pool] = _pairManager;\n emit PairCreated(_pool, _pairManager);\n }\n}\n" - }, - "solidity/for-test/peripherals/GovernableForTest.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../../contracts/peripherals/Governable.sol';\n\ncontract GovernableForTest is Governable {\n constructor(address _governor) Governable(_governor) {}\n}\n" - }, - "solidity/for-test/BridgeForTest.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.0 <0.9.0;\n\nimport '@openzeppelin/contracts/token/ERC20/ERC20.sol';\nimport '@openzeppelin/contracts/token/ERC20/IERC20.sol';\n\ncontract BridgeForTest is ERC20 {\n address public immutable kp3r;\n\n constructor(address _kp3r) ERC20('Wrapped KP3R', 'wKP3R') {\n kp3r = _kp3r;\n }\n\n function bridge(uint256 _amount) external {\n IERC20(kp3r).transferFrom(msg.sender, address(this), _amount);\n _mint(msg.sender, _amount);\n }\n\n function bridgeBack(uint256 _amount) external {\n _burn(msg.sender, _amount);\n IERC20(kp3r).transfer(msg.sender, _amount);\n }\n}\n" - }, - "solidity/for-test/ERC20ForTest.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '@openzeppelin/contracts/token/ERC20/ERC20.sol';\n\ncontract ERC20ForTest is ERC20 {\n constructor(\n string memory _name,\n string memory _symbol,\n address _initialAccount,\n uint256 _initialBalance\n ) ERC20(_name, _symbol) {\n _mint(_initialAccount, _initialBalance);\n }\n\n function mint(uint256 _amount) public {\n _mint(msg.sender, _amount);\n }\n\n function mint(address _account, uint256 _amount) public {\n _mint(_account, _amount);\n }\n\n function burn(uint256 _amount) public {\n _burn(msg.sender, _amount);\n }\n\n function burn(address _account, uint256 _amount) public {\n _burn(_account, _amount);\n }\n\n function transferInternal(\n address _from,\n address _to,\n uint256 _value\n ) public {\n _transfer(_from, _to, _value);\n }\n\n function approveInternal(\n address _owner,\n address _spender,\n uint256 _value\n ) public {\n _approve(_owner, _spender, _value);\n }\n\n function deposit() external payable {\n // Function added for compatibility with WETH\n }\n}\n" - }, - "solidity/for-test/peripherals/keepers/Keep3rKeeperFundableForTest.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../../../contracts/peripherals/keepers/Keep3rKeeperFundable.sol';\n\ncontract Keep3rKeeperFundableForTest is Keep3rKeeperFundable {\n using EnumerableSet for EnumerableSet.AddressSet;\n\n constructor(\n address _kph,\n address _keep3rV1,\n address _keep3rV1Proxy\n ) Keep3rParameters(_kph, _keep3rV1, _keep3rV1Proxy) Keep3rRoles(msg.sender) {}\n\n function isKeeper(address _keeper) external view returns (bool) {\n return _keepers.contains(_keeper);\n }\n\n function setJob(address job) external {\n _jobs.add(job);\n }\n}\n" - }, - "solidity/contracts/sidechain/Keep3rEscrow.sol": { - "content": "// SPDX-License-Identifier: MIT\n\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../peripherals/Mintable.sol';\nimport '../peripherals/DustCollector.sol';\nimport '../../interfaces/sidechain/IKeep3rEscrow.sol';\nimport '@openzeppelin/contracts/token/ERC20/IERC20.sol';\nimport '@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol';\n\ncontract Keep3rEscrow is Mintable, DustCollector, IKeep3rEscrow {\n using SafeERC20 for IERC20;\n\n /// @inheritdoc IKeep3rEscrow\n address public override wKP3R;\n\n /// @param _governance Address of governance\n /// @param _wKP3R Address of wrapped KP3R implementation\n constructor(address _governance, address _wKP3R) Mintable(_governance) {\n wKP3R = _wKP3R;\n }\n\n /// @inheritdoc IKeep3rEscrow\n function deposit(uint256 _amount) external override {\n IERC20(wKP3R).safeTransferFrom(msg.sender, address(this), _amount);\n emit wKP3RDeposited(wKP3R, msg.sender, _amount);\n }\n\n /// @inheritdoc IKeep3rEscrow\n function mint(uint256 _amount) external override onlyMinter {\n IERC20(wKP3R).safeTransfer(msg.sender, _amount);\n emit wKP3RMinted(wKP3R, msg.sender, _amount);\n }\n\n /// @inheritdoc IKeep3rEscrow\n function setWKP3R(address _wKP3R) external override onlyGovernance {\n if (_wKP3R == address(0)) revert ZeroAddress();\n wKP3R = _wKP3R;\n emit wKP3RSet(wKP3R);\n }\n}\n" - }, - "solidity/contracts/peripherals/Mintable.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../../interfaces/peripherals/IMintable.sol';\nimport './Governable.sol';\n\nabstract contract Mintable is Governable, IMintable {\n /// @inheritdoc IMintable\n address public override minter;\n\n constructor(address _governance) Governable(_governance) {}\n\n /// @inheritdoc IMintable\n function setMinter(address _minter) external override onlyGovernance {\n if (_minter == address(0)) revert ZeroAddress();\n minter = _minter;\n emit MinterSet(_minter);\n }\n\n /// @notice Functions with this modifier can only be called by the minter;\n modifier onlyMinter() {\n if (msg.sender != minter) revert OnlyMinter();\n _;\n }\n}\n" - }, - "solidity/for-test/peripherals/DustCollectorForTest.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../../contracts/peripherals/DustCollector.sol';\n\ncontract DustCollectorForTest is DustCollector {\n constructor() DustCollector() Governable(msg.sender) {}\n}\n" - }, - "solidity/for-test/peripherals/Keep3rAccountanceForTest.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../../contracts/peripherals/Keep3rAccountance.sol';\n\ncontract Keep3rAccountanceForTest is Keep3rAccountance {\n using EnumerableSet for EnumerableSet.AddressSet;\n\n constructor() Keep3rRoles(msg.sender) {}\n\n function setJob(address job) external {\n _jobs.add(job);\n }\n\n function setKeeper(address keeper) external {\n _keepers.add(keeper);\n }\n}\n" - }, - "solidity/for-test/peripherals/jobs/Keep3rJobFundableLiquidityForTest.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../../../contracts/peripherals/jobs/Keep3rJobFundableLiquidity.sol';\n\ncontract Keep3rJobFundableLiquidityForTest is Keep3rJobFundableLiquidity {\n using EnumerableSet for EnumerableSet.AddressSet;\n\n constructor(\n address _kph,\n address _keep3rV1,\n address _keep3rV1Proxy\n ) Keep3rParameters(_kph, _keep3rV1, _keep3rV1Proxy) Keep3rRoles(msg.sender) {}\n\n function setJob(address _job) external {\n _jobs.add(_job);\n }\n\n function setJobLiquidity(address _job, address _liquidity) external returns (bool) {\n return _jobLiquidities[_job].add(_liquidity);\n }\n\n function setApprovedLiquidity(address _liquidity) external {\n _approvedLiquidities.add(_liquidity);\n }\n\n function setRevokedLiquidity(address _liquidity) external {\n _approvedLiquidities.remove(_liquidity);\n }\n\n function viewTickCache(address _liquidity) external view returns (TickCache memory _tickCache) {\n _tickCache = _tick[_liquidity];\n }\n\n function viewTickOrder(address _liquidity) external view returns (bool) {\n return _isKP3RToken0[_liquidity];\n }\n\n function internalJobLiquidities(address _job) external view returns (address[] memory _list) {\n _list = _jobLiquidities[_job].values();\n }\n\n function internalSettleJobAccountance(address _job) external {\n _settleJobAccountance(_job);\n }\n}\n" - }, - "solidity/for-test/peripherals/jobs/Keep3rJobDisputableForTest.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../../../contracts/peripherals/jobs/Keep3rJobDisputable.sol';\n\ncontract Keep3rJobDisputableForTest is Keep3rJobDisputable {\n using EnumerableSet for EnumerableSet.AddressSet;\n\n constructor(\n address _kph,\n address _keep3rV1,\n address _keep3rV1Proxy\n ) Keep3rParameters(_kph, _keep3rV1, _keep3rV1Proxy) Keep3rRoles(msg.sender) {}\n\n function setJobLiquidity(address _job, address _liquidity) external {\n _jobLiquidities[_job].add(_liquidity);\n }\n\n function setJobToken(address _job, address _token) external {\n _jobTokens[_job].add(_token);\n }\n\n function setApprovedLiquidity(address _liquidity) external {\n _approvedLiquidities.add(_liquidity);\n }\n\n function setRevokedLiquidity(address _liquidity) external {\n _approvedLiquidities.remove(_liquidity);\n }\n\n function internalJobLiquidityCredits(address _job) external view returns (uint256 _credits) {\n _credits = _jobLiquidityCredits[_job];\n }\n\n function internalJobPeriodCredits(address _job) external view returns (uint256 _credits) {\n _credits = _jobPeriodCredits[_job];\n }\n\n function internalJobTokens(address _job) external view returns (address[] memory _tokens) {\n _tokens = new address[](_jobTokens[_job].length());\n for (uint256 i; i < _jobTokens[_job].length(); i++) {\n _tokens[i] = _jobTokens[_job].at(i);\n }\n }\n\n function internalJobLiquidities(address _job) external view returns (address[] memory _tokens) {\n _tokens = new address[](_jobLiquidities[_job].length());\n for (uint256 i; i < _jobLiquidities[_job].length(); i++) {\n _tokens[i] = _jobLiquidities[_job].at(i);\n }\n }\n}\n" - }, - "solidity/for-test/peripherals/Keep3rDisputableForTest.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../../contracts/peripherals/Keep3rDisputable.sol';\n\ncontract Keep3rDisputableForTest is Keep3rDisputable {\n constructor() Keep3rParameters(address(0), address(0), address(0)) Keep3rRoles(msg.sender) {}\n}\n" - }, - "solidity/for-test/peripherals/keepers/Keep3rKeeperDisputableForTest.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../../../contracts/peripherals/keepers/Keep3rKeeperDisputable.sol';\n\ncontract Keep3rKeeperDisputableForTest is Keep3rKeeperDisputable {\n using EnumerableSet for EnumerableSet.AddressSet;\n\n constructor(\n address _kph,\n address _keep3rV1,\n address _keep3rV1Proxy\n ) Keep3rParameters(_kph, _keep3rV1, _keep3rV1Proxy) Keep3rRoles(msg.sender) {}\n\n function setKeeper(address _keeper) external {\n _keepers.add(_keeper);\n }\n\n function internalSlash(\n address _bonded,\n address _keeper,\n uint256 _bondAmount,\n uint256 _unbondAmount\n ) external {\n _slash(_bonded, _keeper, _bondAmount, _unbondAmount);\n }\n\n function isKeeper(address _address) external view returns (bool _isKeeper) {\n _isKeeper = _keepers.contains(_address);\n }\n}\n" - }, - "solidity/for-test/peripherals/jobs/Keep3rJobFundableCreditsForTest.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../../../contracts/peripherals/jobs/Keep3rJobFundableCredits.sol';\n\ncontract Keep3rJobFundableCreditsForTest is Keep3rJobFundableCredits {\n using EnumerableSet for EnumerableSet.AddressSet;\n\n constructor(\n address _kph,\n address _keep3rV1,\n address _keep3rV1Proxy\n ) Keep3rParameters(_kph, _keep3rV1, _keep3rV1Proxy) Keep3rRoles(msg.sender) {}\n\n function setJob(address _job, address _jobOwner) external {\n _jobs.add(_job);\n jobOwner[_job] = _jobOwner;\n }\n\n function setJobToken(address _job, address _token) external {\n _jobTokens[_job].add(_token);\n }\n\n function isJobToken(address _job, address _token) external view returns (bool _contains) {\n _contains = _jobTokens[_job].contains(_token);\n }\n}\n" - }, - "solidity/contracts/Keep3rHelper.sol": { - "content": "// SPDX-License-Identifier: MIT\n\n/*\n\nCoded for The Keep3r Network with ♥ by\n\n██████╗░███████╗███████╗██╗  ░██╗░░░░░░░██╗░█████╗░███╗░░██╗██████╗░███████╗██████╗░██╗░░░░░░█████╗░███╗░░██╗██████╗░\n██╔══██╗██╔════╝██╔════╝██║  ░██║░░██╗░░██║██╔══██╗████╗░██║██╔══██╗██╔════╝██╔══██╗██║░░░░░██╔══██╗████╗░██║██╔══██╗\n██║░░██║█████╗░░█████╗░░██║  ░╚██╗████╗██╔╝██║░░██║██╔██╗██║██║░░██║█████╗░░██████╔╝██║░░░░░███████║██╔██╗██║██║░░██║\n██║░░██║██╔══╝░░██╔══╝░░██║  ░░████╔═████║░██║░░██║██║╚████║██║░░██║██╔══╝░░██╔══██╗██║░░░░░██╔══██║██║╚████║██║░░██║\n██████╔╝███████╗██║░░░░░██║  ░░╚██╔╝░╚██╔╝░╚█████╔╝██║░╚███║██████╔╝███████╗██║░░██║███████╗██║░░██║██║░╚███║██████╔╝\n╚═════╝░╚══════╝╚═╝░░░░░╚═╝  ░░░╚═╝░░░╚═╝░░░╚════╝░╚═╝░░╚══╝╚═════╝░╚══════╝╚═╝░░╚═╝╚══════╝╚═╝░░╚═╝╚═╝░░╚══╝╚═════╝░\n\nhttps://defi.sucks\n\n*/\n\npragma solidity >=0.8.7 <0.9.0;\n\nimport './libraries/FullMath.sol';\nimport './libraries/TickMath.sol';\nimport '../interfaces/IKeep3r.sol';\nimport '../interfaces/IKeep3rHelper.sol';\nimport './Keep3rHelperParameters.sol';\n\nimport '@openzeppelin/contracts/utils/math/Math.sol';\nimport '@uniswap/v3-core/contracts/interfaces/IUniswapV3Pool.sol';\n\ncontract Keep3rHelper is IKeep3rHelper, Keep3rHelperParameters {\n constructor(\n address _kp3r,\n address _keep3rV2,\n address _governance,\n address _kp3rWethPool\n ) Keep3rHelperParameters(_kp3r, _keep3rV2, _governance, _kp3rWethPool) {}\n\n /// @inheritdoc IKeep3rHelper\n function quote(uint256 _eth) public view override returns (uint256 _amountOut) {\n uint32[] memory _secondsAgos = new uint32[](2);\n _secondsAgos[1] = quoteTwapTime;\n\n (int56[] memory _tickCumulatives, ) = IUniswapV3Pool(kp3rWethPool.poolAddress).observe(_secondsAgos);\n int56 _difference = _tickCumulatives[0] - _tickCumulatives[1];\n _amountOut = getQuoteAtTick(uint128(_eth), kp3rWethPool.isTKNToken0 ? _difference : -_difference, quoteTwapTime);\n }\n\n /// @inheritdoc IKeep3rHelper\n function bonds(address _keeper) public view virtual override returns (uint256 _amountBonded) {\n return IKeep3r(keep3rV2).bonds(_keeper, KP3R);\n }\n\n /// @inheritdoc IKeep3rHelper\n function getRewardAmountFor(address _keeper, uint256 _gasUsed) public view override returns (uint256 _kp3r) {\n uint256 _boost = getRewardBoostFor(bonds(_keeper));\n _kp3r = quote((_gasUsed * _boost) / BOOST_BASE);\n }\n\n /// @inheritdoc IKeep3rHelper\n function getRewardAmount(uint256 _gasUsed) external view override returns (uint256 _amount) {\n // solhint-disable-next-line avoid-tx-origin\n return getRewardAmountFor(tx.origin, _gasUsed);\n }\n\n /// @inheritdoc IKeep3rHelper\n function getRewardBoostFor(uint256 _bonds) public view override returns (uint256 _rewardBoost) {\n _bonds = Math.min(_bonds, targetBond);\n uint256 _cap = minBoost + ((maxBoost - minBoost) * _bonds) / targetBond;\n _rewardBoost = _cap * _getBasefee();\n }\n\n /// @inheritdoc IKeep3rHelper\n function getPoolTokens(address _pool) public view override returns (address _token0, address _token1) {\n return (IUniswapV3Pool(_pool).token0(), IUniswapV3Pool(_pool).token1());\n }\n\n /// @inheritdoc IKeep3rHelper\n function isKP3RToken0(address _pool) external view virtual override returns (bool _isKP3RToken0) {\n address _token0;\n address _token1;\n (_token0, _token1) = getPoolTokens(_pool);\n if (_token0 == KP3R) {\n return true;\n } else if (_token1 != KP3R) {\n revert LiquidityPairInvalid();\n }\n }\n\n /// @inheritdoc IKeep3rHelper\n function observe(address _pool, uint32[] memory _secondsAgo)\n external\n view\n override\n returns (\n int56 _tickCumulative1,\n int56 _tickCumulative2,\n bool _success\n )\n {\n try IUniswapV3Pool(_pool).observe(_secondsAgo) returns (int56[] memory _uniswapResponse, uint160[] memory) {\n _tickCumulative1 = _uniswapResponse[0];\n if (_uniswapResponse.length > 1) {\n _tickCumulative2 = _uniswapResponse[1];\n }\n _success = true;\n } catch (bytes memory) {}\n }\n\n /// @inheritdoc IKeep3rHelper\n function getPaymentParams(uint256 _bonds)\n external\n view\n override\n returns (\n uint256 _boost,\n uint256 _oneEthQuote,\n uint256 _extra\n )\n {\n _oneEthQuote = quote(1 ether);\n _boost = getRewardBoostFor(_bonds);\n _extra = workExtraGas;\n }\n\n /// @inheritdoc IKeep3rHelper\n function getKP3RsAtTick(\n uint256 _liquidityAmount,\n int56 _tickDifference,\n uint256 _timeInterval\n ) external pure override returns (uint256 _kp3rAmount) {\n uint160 sqrtRatioX96 = TickMath.getSqrtRatioAtTick(int24(_tickDifference / int256(_timeInterval)));\n _kp3rAmount = FullMath.mulDiv(1 << 96, _liquidityAmount, sqrtRatioX96);\n }\n\n /// @inheritdoc IKeep3rHelper\n function getQuoteAtTick(\n uint128 _baseAmount,\n int56 _tickDifference,\n uint256 _timeInterval\n ) public pure override returns (uint256 _quoteAmount) {\n uint160 sqrtRatioX96 = TickMath.getSqrtRatioAtTick(int24(_tickDifference / int256(_timeInterval)));\n\n if (sqrtRatioX96 <= type(uint128).max) {\n uint256 ratioX192 = uint256(sqrtRatioX96) * sqrtRatioX96;\n _quoteAmount = FullMath.mulDiv(1 << 192, _baseAmount, ratioX192);\n } else {\n uint256 ratioX128 = FullMath.mulDiv(sqrtRatioX96, sqrtRatioX96, 1 << 64);\n _quoteAmount = FullMath.mulDiv(1 << 128, _baseAmount, ratioX128);\n }\n }\n\n /// @notice Gets the gas basefee cost to calculate keeper rewards\n /// @dev Keepers are required to pay a priority fee to be included, this function recognizes a minimum priority fee\n /// @return _baseFee The block's basefee + a minimum priority fee, or a preset minimum gas fee\n function _getBasefee() internal view virtual returns (uint256 _baseFee) {\n return Math.max(minBaseFee, block.basefee + minPriorityFee);\n }\n}\n" - }, - "solidity/for-test/testnet/Keep3rHelperForTestnet.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../../contracts/Keep3rHelper.sol';\n\ncontract Keep3rHelperForTestnet is Keep3rHelper {\n constructor(\n address _kp3r,\n address _keep3rV2,\n address _governance,\n address _kp3rWethPool\n ) Keep3rHelper(_kp3r, _keep3rV2, _governance, _kp3rWethPool) {}\n\n function _getBasefee() internal view override returns (uint256) {\n return 1;\n }\n\n /// @dev Overrides oracle validation that uses KP3R and WETH addresses\n function _validateOraclePool(address _poolAddress, address) internal view virtual override returns (TokenOraclePool memory _oraclePool) {\n return TokenOraclePool(_poolAddress, true);\n }\n\n /// @dev Overrides token comparison with KP3R address\n function isKP3RToken0(address) public view virtual override returns (bool) {\n return true;\n }\n}\n" - }, - "solidity/for-test/Keep3rHelperForTest.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../contracts/Keep3rHelper.sol';\n\ncontract Keep3rHelperForTest is Keep3rHelper {\n uint256 public basefee;\n\n constructor(\n address _kp3r,\n address _keep3rV2,\n address _governance,\n address _kp3rWethPool\n ) Keep3rHelper(_kp3r, _keep3rV2, _governance, _kp3rWethPool) {}\n\n function _getBasefee() internal view override returns (uint256) {\n return basefee != 0 ? (basefee + minPriorityFee) : super._getBasefee();\n }\n\n function setBaseFee(uint256 _baseFee) external {\n basefee = _baseFee;\n }\n}\n" - }, - "solidity/contracts/sidechain/Keep3rHelperSidechain.sol": { - "content": "// SPDX-License-Identifier: MIT\n\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../Keep3rHelper.sol';\nimport '../../interfaces/sidechain/IKeep3rHelperSidechain.sol';\n\ncontract Keep3rHelperSidechain is IKeep3rHelperSidechain, Keep3rHelper {\n /// @inheritdoc IKeep3rHelperSidechain\n mapping(address => address) public override oracle;\n /// @inheritdoc IKeep3rHelperSidechain\n IKeep3rHelperParameters.TokenOraclePool public override wethUSDPool;\n\n /// @notice Ethereum mainnet WETH address used for quoting references\n address public immutable override WETH;\n\n /// @param _keep3rV2 Address of sidechain Keep3r implementation\n /// @param _governance Address of governance\n /// @param _kp3rWethOracle Address of oracle used for KP3R/WETH quote\n /// @param _wethUsdOracle Address of oracle used for WETH/USD quote\n /// @dev Oracle pools should use 18 decimals tokens\n constructor(\n address _keep3rV2,\n address _governance,\n address _kp3r,\n address _weth,\n address _kp3rWethOracle,\n address _wethUsdOracle\n ) Keep3rHelper(_kp3r, _keep3rV2, _governance, _kp3rWethOracle) {\n WETH = _weth;\n wethUSDPool = _validateOraclePool(_wethUsdOracle, _weth);\n _setQuoteTwapTime(1 days);\n }\n\n /// @inheritdoc IKeep3rHelper\n /// @notice Uses valid wKP3R address from Keep3rSidechain to query keeper bonds\n function bonds(address _keeper) public view override(Keep3rHelper, IKeep3rHelper) returns (uint256 _amountBonded) {\n address wKP3R = IKeep3r(keep3rV2).keep3rV1();\n return IKeep3r(keep3rV2).bonds(_keeper, wKP3R);\n }\n\n /// @inheritdoc IKeep3rHelperSidechain\n function setOracle(address _liquidity, address _oracle) external override onlyGovernance {\n if (_liquidity == address(0) || _oracle == address(0)) revert ZeroAddress();\n oracle[_liquidity] = _oracle;\n emit OracleSet(_liquidity, _oracle);\n }\n\n /// @inheritdoc IKeep3rHelperSidechain\n function quoteUsdToEth(uint256 _usd) public view virtual override returns (uint256 _amountOut) {\n uint32[] memory _secondsAgos = new uint32[](2);\n _secondsAgos[1] = quoteTwapTime;\n\n /// @dev Oracle is compatible with IUniswapV3Pool\n (int56[] memory _tickCumulatives, ) = IUniswapV3Pool(wethUSDPool.poolAddress).observe(_secondsAgos);\n int56 _difference = _tickCumulatives[0] - _tickCumulatives[1];\n _amountOut = getQuoteAtTick(uint128(_usd), wethUSDPool.isTKNToken0 ? _difference : -_difference, quoteTwapTime);\n }\n\n /// @inheritdoc IKeep3rHelperSidechain\n function setWethUsdPool(address _poolAddress) external override onlyGovernance {\n if (_poolAddress == address(0)) revert ZeroAddress();\n _setWethUsdPool(_poolAddress);\n }\n\n function _setWethUsdPool(address _poolAddress) internal {\n wethUSDPool = _validateOraclePool(_poolAddress, WETH);\n emit WethUSDPoolChange(wethUSDPool.poolAddress, wethUSDPool.isTKNToken0);\n }\n\n /// @dev Sidechain jobs are quoted by USD/gasUnit, baseFee is set to 1\n function _getBasefee() internal view virtual override returns (uint256 _baseFee) {\n return 1;\n }\n}\n" - }, - "solidity/for-test/testnet/Keep3rHelperSidechainForTestnet.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../../contracts/sidechain/Keep3rHelperSidechain.sol';\n\ncontract Keep3rHelperSidechainForTestnet is Keep3rHelperSidechain {\n constructor(\n address _keep3rV2,\n address _governance,\n address _kp3r,\n address _weth,\n address _kp3rWethOracle,\n address _wethUsdOracle\n ) Keep3rHelperSidechain(_keep3rV2, _governance, _kp3r, _weth, _kp3rWethOracle, _wethUsdOracle) {}\n\n /// @dev Overrides oracle validation that uses KP3R and WETH addresses\n function _validateOraclePool(address _poolAddress, address) internal view virtual override returns (TokenOraclePool memory _oraclePool) {\n return TokenOraclePool(_poolAddress, true);\n }\n\n /// @dev Overrides token comparison with KP3R address\n function isKP3RToken0(address) public view virtual override returns (bool) {\n return true;\n }\n\n function quoteUsdToEth(uint256 _usd) public view virtual override returns (uint256) {\n return _usd;\n }\n}\n" - }, - "solidity/for-test/peripherals/Keep3rParametersForTest.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../../contracts/peripherals/Keep3rParameters.sol';\n\ncontract Keep3rParametersForTest is Keep3rParameters {\n constructor(\n address _keep3rHelper,\n address _keep3rV1,\n address _keep3rV1Proxy\n ) Keep3rParameters(_keep3rHelper, _keep3rV1, _keep3rV1Proxy) Keep3rRoles(msg.sender) {}\n\n function viewLiquidityPool(address _pool) public view returns (address) {\n return _liquidityPool[_pool];\n }\n\n function viewIsKP3RToken0(address _pool) public view returns (bool) {\n return _isKP3RToken0[_pool];\n }\n}\n" - }, - "solidity/for-test/peripherals/jobs/Keep3rJobWorkableForTest.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../../../contracts/peripherals/jobs/Keep3rJobWorkable.sol';\n\ncontract Keep3rJobWorkableForTest is Keep3rJobWorkable {\n using EnumerableSet for EnumerableSet.AddressSet;\n\n constructor(\n address _keep3rHelper,\n address _keep3rV1,\n address _keep3rV1Proxy\n ) Keep3rParameters(_keep3rHelper, _keep3rV1, _keep3rV1Proxy) Keep3rRoles(msg.sender) {}\n\n function setJob(address _job) external {\n _jobs.add(_job);\n }\n\n function setKeeper(address _keeper) external {\n _keepers.add(_keeper);\n }\n\n function setApprovedLiquidity(address _liquidity) external {\n _approvedLiquidities.add(_liquidity);\n }\n\n function setJobLiquidity(address _job, address _liquidity) external {\n _jobLiquidities[_job].add(_liquidity);\n }\n\n function viewJobLiquidityCredits(address _job) external view returns (uint256) {\n return _jobLiquidityCredits[_job];\n }\n\n function viewJobPeriodCredits(address _job) external view returns (uint256) {\n return _jobPeriodCredits[_job];\n }\n\n function viewTickCache(address _liquidity) external view returns (TickCache memory _tickCache) {\n _tickCache = _tick[_liquidity];\n }\n\n function viewGas() external view returns (uint256) {\n return _initialGas;\n }\n\n receive() external payable {}\n}\n" - }, - "solidity/for-test/peripherals/jobs/Keep3rJobMigrationForTest.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../../../contracts/peripherals/jobs/Keep3rJobMigration.sol';\n\ncontract Keep3rJobMigrationForTest is Keep3rJobMigration {\n using EnumerableSet for EnumerableSet.AddressSet;\n\n mapping(address => uint256) public settleJobAccountanceCallCount;\n\n constructor(\n address _kph,\n address _keep3rV1,\n address _keep3rV1Proxy\n ) Keep3rParameters(_kph, _keep3rV1, _keep3rV1Proxy) Keep3rRoles(msg.sender) {}\n\n function setJobToken(address _job, address _token) external {\n _jobTokens[_job].add(_token);\n }\n\n function setJobLiquidity(address _job, address _liquidity) external {\n _jobLiquidities[_job].add(_liquidity);\n }\n\n function viewJobTokenListLength(address _job) external view returns (uint256) {\n return _jobTokens[_job].length();\n }\n\n function viewJobLiquidityList(address _job) external view returns (address[] memory _list) {\n _list = _jobLiquidities[_job].values();\n }\n\n function viewJobPeriodCredits(address _job) external view returns (uint256) {\n return _jobPeriodCredits[_job];\n }\n\n function viewJobLiquidityCredits(address _job) external view returns (uint256) {\n return _jobLiquidityCredits[_job];\n }\n\n function viewMigrationCreatedAt(address _fromJob, address _toJob) external view returns (uint256) {\n return _migrationCreatedAt[_fromJob][_toJob];\n }\n\n function isJob(address _job) external view returns (bool) {\n return _jobs.contains(_job);\n }\n\n function _settleJobAccountance(address _job) internal override {\n settleJobAccountanceCallCount[_job]++;\n }\n}\n" - }, - "solidity/for-test/peripherals/jobs/Keep3rJobManagerForTest.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../../../contracts/peripherals/jobs/Keep3rJobManager.sol';\n\ncontract Keep3rJobManagerForTest is Keep3rJobManager {\n using EnumerableSet for EnumerableSet.AddressSet;\n\n constructor(\n address _keep3rHelper,\n address _keep3rV1,\n address _keep3rV1Proxy\n ) Keep3rRoles(msg.sender) {}\n\n function isJob(address _job) external view returns (bool _isJob) {\n _isJob = _jobs.contains(_job);\n }\n}\n" - }, - "solidity/for-test/peripherals/jobs/Keep3rJobOwnershipForTest.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../../../contracts/peripherals/jobs/Keep3rJobOwnership.sol';\n\ncontract Keep3rJobOwnershipForTest is Keep3rJobOwnership {}\n" - }, - "solidity/for-test/libraries/LiquidityAmountsForTest.sol": { - "content": "// SPDX-License-Identifier: GPL-2.0-or-later\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../../contracts/libraries/FullMath.sol';\nimport '../../contracts/libraries/FixedPoint96.sol';\n\n/// @dev Made this library into a contract to be able to calculate liquidity more precisely for tests\n\n// solhint-disable\ncontract LiquidityAmountsForTest {\n function toUint128(uint256 x) private pure returns (uint128 y) {\n require((y = uint128(x)) == x);\n }\n\n function getLiquidityForAmount0(\n uint160 sqrtRatioAX96,\n uint160 sqrtRatioBX96,\n uint256 amount0\n ) public pure returns (uint128 liquidity) {\n if (sqrtRatioAX96 > sqrtRatioBX96) (sqrtRatioAX96, sqrtRatioBX96) = (sqrtRatioBX96, sqrtRatioAX96);\n uint256 intermediate = FullMath.mulDiv(sqrtRatioAX96, sqrtRatioBX96, FixedPoint96.Q96);\n return toUint128(FullMath.mulDiv(amount0, intermediate, sqrtRatioBX96 - sqrtRatioAX96));\n }\n\n function getLiquidityForAmount1(\n uint160 sqrtRatioAX96,\n uint160 sqrtRatioBX96,\n uint256 amount1\n ) public pure returns (uint128 liquidity) {\n if (sqrtRatioAX96 > sqrtRatioBX96) (sqrtRatioAX96, sqrtRatioBX96) = (sqrtRatioBX96, sqrtRatioAX96);\n return toUint128(FullMath.mulDiv(amount1, FixedPoint96.Q96, sqrtRatioBX96 - sqrtRatioAX96));\n }\n\n function getLiquidityForAmounts(\n uint160 sqrtRatioX96,\n uint160 sqrtRatioAX96,\n uint160 sqrtRatioBX96,\n uint256 amount0,\n uint256 amount1\n ) external pure returns (uint128 liquidity) {\n if (sqrtRatioAX96 > sqrtRatioBX96) (sqrtRatioAX96, sqrtRatioBX96) = (sqrtRatioBX96, sqrtRatioAX96);\n\n if (sqrtRatioX96 <= sqrtRatioAX96) {\n liquidity = getLiquidityForAmount0(sqrtRatioAX96, sqrtRatioBX96, amount0);\n } else if (sqrtRatioX96 < sqrtRatioBX96) {\n uint128 liquidity0 = getLiquidityForAmount0(sqrtRatioX96, sqrtRatioBX96, amount0);\n uint128 liquidity1 = getLiquidityForAmount1(sqrtRatioAX96, sqrtRatioX96, amount1);\n\n liquidity = liquidity0 < liquidity1 ? liquidity0 : liquidity1;\n } else {\n liquidity = getLiquidityForAmount1(sqrtRatioAX96, sqrtRatioBX96, amount1);\n }\n }\n\n function getAmount0ForLiquidity(\n uint160 sqrtRatioAX96,\n uint160 sqrtRatioBX96,\n uint128 liquidity\n ) public pure returns (uint256 amount0) {\n if (sqrtRatioAX96 > sqrtRatioBX96) (sqrtRatioAX96, sqrtRatioBX96) = (sqrtRatioBX96, sqrtRatioAX96);\n\n return FullMath.mulDiv(uint256(liquidity) << FixedPoint96.RESOLUTION, sqrtRatioBX96 - sqrtRatioAX96, sqrtRatioBX96) / sqrtRatioAX96;\n }\n\n function getAmount1ForLiquidity(\n uint160 sqrtRatioAX96,\n uint160 sqrtRatioBX96,\n uint128 liquidity\n ) public pure returns (uint256 amount1) {\n if (sqrtRatioAX96 > sqrtRatioBX96) (sqrtRatioAX96, sqrtRatioBX96) = (sqrtRatioBX96, sqrtRatioAX96);\n\n return FullMath.mulDiv(liquidity, sqrtRatioBX96 - sqrtRatioAX96, FixedPoint96.Q96);\n }\n\n function getAmountsForLiquidity(\n uint160 sqrtRatioX96,\n uint160 sqrtRatioAX96,\n uint160 sqrtRatioBX96,\n uint128 liquidity\n ) external pure returns (uint256 amount0, uint256 amount1) {\n if (sqrtRatioAX96 > sqrtRatioBX96) (sqrtRatioAX96, sqrtRatioBX96) = (sqrtRatioBX96, sqrtRatioAX96);\n\n if (sqrtRatioX96 <= sqrtRatioAX96) {\n amount0 = getAmount0ForLiquidity(sqrtRatioAX96, sqrtRatioBX96, liquidity);\n } else if (sqrtRatioX96 < sqrtRatioBX96) {\n amount0 = getAmount0ForLiquidity(sqrtRatioX96, sqrtRatioBX96, liquidity);\n amount1 = getAmount1ForLiquidity(sqrtRatioAX96, sqrtRatioX96, liquidity);\n } else {\n amount1 = getAmount1ForLiquidity(sqrtRatioAX96, sqrtRatioBX96, liquidity);\n }\n }\n}\n" - }, - "solidity/for-test/IUniswapV3PoolForTest.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '@uniswap/v3-core/contracts/interfaces/IERC20Minimal.sol';\nimport '@uniswap/v3-core/contracts/interfaces/IUniswapV3Pool.sol';\n\n// solhint-disable-next-line no-empty-blocks\ninterface IUniswapV3PoolForTest is IERC20Minimal, IUniswapV3Pool {\n\n}\n" - }, - "@uniswap/v3-core/contracts/interfaces/IERC20Minimal.sol": { - "content": "// SPDX-License-Identifier: GPL-2.0-or-later\npragma solidity >=0.5.0;\n\n/// @title Minimal ERC20 interface for Uniswap\n/// @notice Contains a subset of the full ERC20 interface that is used in Uniswap V3\ninterface IERC20Minimal {\n /// @notice Returns the balance of a token\n /// @param account The account for which to look up the number of tokens it has, i.e. its balance\n /// @return The number of tokens held by the account\n function balanceOf(address account) external view returns (uint256);\n\n /// @notice Transfers the amount of token from the `msg.sender` to the recipient\n /// @param recipient The account that will receive the amount transferred\n /// @param amount The number of tokens to send from the sender to the recipient\n /// @return Returns true for a successful transfer, false for an unsuccessful transfer\n function transfer(address recipient, uint256 amount) external returns (bool);\n\n /// @notice Returns the current allowance given to a spender by an owner\n /// @param owner The account of the token owner\n /// @param spender The account of the token spender\n /// @return The current allowance granted by `owner` to `spender`\n function allowance(address owner, address spender) external view returns (uint256);\n\n /// @notice Sets the allowance of a spender from the `msg.sender` to the value `amount`\n /// @param spender The account which will be allowed to spend a given amount of the owners tokens\n /// @param amount The amount of tokens allowed to be used by `spender`\n /// @return Returns true for a successful approval, false for unsuccessful\n function approve(address spender, uint256 amount) external returns (bool);\n\n /// @notice Transfers `amount` tokens from `sender` to `recipient` up to the allowance given to the `msg.sender`\n /// @param sender The account from which the transfer will be initiated\n /// @param recipient The recipient of the transfer\n /// @param amount The amount of the transfer\n /// @return Returns true for a successful transfer, false for unsuccessful\n function transferFrom(\n address sender,\n address recipient,\n uint256 amount\n ) external returns (bool);\n\n /// @notice Event emitted when tokens are transferred from one address to another, either via `#transfer` or `#transferFrom`.\n /// @param from The account from which the tokens were sent, i.e. the balance decreased\n /// @param to The account to which the tokens were sent, i.e. the balance increased\n /// @param value The amount of tokens that were transferred\n event Transfer(address indexed from, address indexed to, uint256 value);\n\n /// @notice Event emitted when the approval amount for the spender of a given owner's tokens changes.\n /// @param owner The account that approved spending of its tokens\n /// @param spender The account for which the spending allowance was modified\n /// @param value The new allowance from the owner to the spender\n event Approval(address indexed owner, address indexed spender, uint256 value);\n}\n" - } - }, - "settings": { - "optimizer": { - "enabled": true, - "runs": 33 - }, - "outputSelection": { - "*": { - "*": [ - "storageLayout", - "abi", - "evm.bytecode", - "evm.deployedBytecode", - "evm.methodIdentifiers", - "metadata", - "devdoc", - "userdoc", - "evm.gasEstimates" - ], - "": [ - "ast" - ] - } - }, - "metadata": { - "useLiteralContent": true - }, - "libraries": { - "": { - "__CACHE_BREAKER__": "0x00000000d41867734bbee4c6863d9255b2b06ac1" - } - } - } -} \ No newline at end of file diff --git a/deployments/mainnet/solcInputs/128b239e58e270b88e71a55cf65c8c91.json b/deployments/mainnet/solcInputs/128b239e58e270b88e71a55cf65c8c91.json deleted file mode 100644 index 3c0a79f..0000000 --- a/deployments/mainnet/solcInputs/128b239e58e270b88e71a55cf65c8c91.json +++ /dev/null @@ -1,289 +0,0 @@ -{ - "language": "Solidity", - "sources": { - "solidity/contracts/Keep3r.sol": { - "content": "// SPDX-License-Identifier: MIT\n\n/*\n\nCoded for The Keep3r Network with ♥ by\n\n██████╗░███████╗███████╗██╗  ░██╗░░░░░░░██╗░█████╗░███╗░░██╗██████╗░███████╗██████╗░██╗░░░░░░█████╗░███╗░░██╗██████╗░\n██╔══██╗██╔════╝██╔════╝██║  ░██║░░██╗░░██║██╔══██╗████╗░██║██╔══██╗██╔════╝██╔══██╗██║░░░░░██╔══██╗████╗░██║██╔══██╗\n██║░░██║█████╗░░█████╗░░██║  ░╚██╗████╗██╔╝██║░░██║██╔██╗██║██║░░██║█████╗░░██████╔╝██║░░░░░███████║██╔██╗██║██║░░██║\n██║░░██║██╔══╝░░██╔══╝░░██║  ░░████╔═████║░██║░░██║██║╚████║██║░░██║██╔══╝░░██╔══██╗██║░░░░░██╔══██║██║╚████║██║░░██║\n██████╔╝███████╗██║░░░░░██║  ░░╚██╔╝░╚██╔╝░╚█████╔╝██║░╚███║██████╔╝███████╗██║░░██║███████╗██║░░██║██║░╚███║██████╔╝\n╚═════╝░╚══════╝╚═╝░░░░░╚═╝  ░░░╚═╝░░░╚═╝░░░╚════╝░╚═╝░░╚══╝╚═════╝░╚══════╝╚═╝░░╚═╝╚══════╝╚═╝░░╚═╝╚═╝░░╚══╝╚═════╝░\n\nhttps://defi.sucks\n\n*/\n\npragma solidity >=0.8.4 <0.9.0;\n\nimport './peripherals/jobs/Keep3rJobs.sol';\nimport './peripherals/keepers/Keep3rKeepers.sol';\nimport './peripherals/Keep3rAccountance.sol';\nimport './peripherals/Keep3rRoles.sol';\nimport './peripherals/Keep3rParameters.sol';\nimport './peripherals/DustCollector.sol';\n\ncontract Keep3r is DustCollector, Keep3rJobs, Keep3rKeepers {\n constructor(\n address _governance,\n address _keep3rHelper,\n address _keep3rV1,\n address _keep3rV1Proxy,\n address _kp3rWethPool\n ) Keep3rParameters(_keep3rHelper, _keep3rV1, _keep3rV1Proxy, _kp3rWethPool) Keep3rRoles(_governance) DustCollector() {}\n}\n" - }, - "solidity/contracts/peripherals/jobs/Keep3rJobs.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport './Keep3rJobDisputable.sol';\nimport './Keep3rJobWorkable.sol';\nimport './Keep3rJobManager.sol';\n\nabstract contract Keep3rJobs is Keep3rJobDisputable, Keep3rJobManager, Keep3rJobWorkable {}\n" - }, - "solidity/contracts/peripherals/keepers/Keep3rKeepers.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport './Keep3rKeeperDisputable.sol';\n\nabstract contract Keep3rKeepers is Keep3rKeeperDisputable {}\n" - }, - "solidity/contracts/peripherals/Keep3rAccountance.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '@openzeppelin/contracts/utils/structs/EnumerableSet.sol';\nimport '../../interfaces/peripherals/IKeep3rAccountance.sol';\n\nabstract contract Keep3rAccountance is IKeep3rAccountance {\n using EnumerableSet for EnumerableSet.AddressSet;\n\n /// @notice List of all enabled keepers\n EnumerableSet.AddressSet internal _keepers;\n\n /// @inheritdoc IKeep3rAccountance\n mapping(address => uint256) public override workCompleted;\n\n /// @inheritdoc IKeep3rAccountance\n mapping(address => uint256) public override firstSeen;\n\n /// @inheritdoc IKeep3rAccountance\n mapping(address => bool) public override disputes;\n\n /// @inheritdoc IKeep3rAccountance\n /// @notice Mapping (job => bonding => amount)\n mapping(address => mapping(address => uint256)) public override bonds;\n\n /// @inheritdoc IKeep3rAccountance\n mapping(address => mapping(address => uint256)) public override jobTokenCredits;\n\n /// @notice The current liquidity credits available for a job\n mapping(address => uint256) internal _jobLiquidityCredits;\n\n /// @notice Map the address of a job to its correspondent periodCredits\n mapping(address => uint256) internal _jobPeriodCredits;\n\n /// @notice Enumerable array of Job Tokens for Credits\n mapping(address => EnumerableSet.AddressSet) internal _jobTokens;\n\n /// @notice List of liquidities that a job has (job => liquidities)\n mapping(address => EnumerableSet.AddressSet) internal _jobLiquidities;\n\n /// @notice Liquidity pool to observe\n mapping(address => address) internal _liquidityPool;\n\n /// @notice Tracks if a pool has KP3R as token0\n mapping(address => bool) internal _isKP3RToken0;\n\n /// @inheritdoc IKeep3rAccountance\n mapping(address => mapping(address => uint256)) public override pendingBonds;\n\n /// @inheritdoc IKeep3rAccountance\n mapping(address => mapping(address => uint256)) public override canActivateAfter;\n\n /// @inheritdoc IKeep3rAccountance\n mapping(address => mapping(address => uint256)) public override canWithdrawAfter;\n\n /// @inheritdoc IKeep3rAccountance\n mapping(address => mapping(address => uint256)) public override pendingUnbonds;\n\n /// @inheritdoc IKeep3rAccountance\n mapping(address => bool) public override hasBonded;\n\n /// @notice List of all enabled jobs\n EnumerableSet.AddressSet internal _jobs;\n\n /// @inheritdoc IKeep3rAccountance\n function jobs() external view override returns (address[] memory _list) {\n _list = _jobs.values();\n }\n\n /// @inheritdoc IKeep3rAccountance\n function keepers() external view override returns (address[] memory _list) {\n _list = _keepers.values();\n }\n}\n" - }, - "solidity/contracts/peripherals/Keep3rRoles.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../../interfaces/peripherals/IKeep3rRoles.sol';\nimport '@openzeppelin/contracts/utils/structs/EnumerableSet.sol';\nimport './Governable.sol';\n\ncontract Keep3rRoles is IKeep3rRoles, Governable {\n /// @inheritdoc IKeep3rRoles\n mapping(address => bool) public override slashers;\n\n /// @inheritdoc IKeep3rRoles\n mapping(address => bool) public override disputers;\n\n constructor(address _governance) Governable(_governance) {}\n\n /// @inheritdoc IKeep3rRoles\n function addSlasher(address _slasher) external override onlyGovernance {\n if (slashers[_slasher]) revert SlasherExistent();\n slashers[_slasher] = true;\n emit SlasherAdded(_slasher);\n }\n\n /// @inheritdoc IKeep3rRoles\n function removeSlasher(address _slasher) external override onlyGovernance {\n if (!slashers[_slasher]) revert SlasherUnexistent();\n delete slashers[_slasher];\n emit SlasherRemoved(_slasher);\n }\n\n /// @inheritdoc IKeep3rRoles\n function addDisputer(address _disputer) external override onlyGovernance {\n if (disputers[_disputer]) revert DisputerExistent();\n disputers[_disputer] = true;\n emit DisputerAdded(_disputer);\n }\n\n /// @inheritdoc IKeep3rRoles\n function removeDisputer(address _disputer) external override onlyGovernance {\n if (!disputers[_disputer]) revert DisputerUnexistent();\n delete disputers[_disputer];\n emit DisputerRemoved(_disputer);\n }\n\n /// @notice Functions with this modifier can only be called by either a slasher or governance\n modifier onlySlasher {\n if (!slashers[msg.sender]) revert OnlySlasher();\n _;\n }\n\n /// @notice Functions with this modifier can only be called by either a disputer or governance\n modifier onlyDisputer {\n if (!disputers[msg.sender]) revert OnlyDisputer();\n _;\n }\n}\n" - }, - "solidity/contracts/peripherals/Keep3rParameters.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../../interfaces/IKeep3rHelper.sol';\nimport '../../interfaces/peripherals/IKeep3rParameters.sol';\nimport './Keep3rAccountance.sol';\nimport './Keep3rRoles.sol';\n\nabstract contract Keep3rParameters is IKeep3rParameters, Keep3rAccountance, Keep3rRoles {\n /// @inheritdoc IKeep3rParameters\n address public override keep3rV1;\n\n /// @inheritdoc IKeep3rParameters\n address public override keep3rV1Proxy;\n\n /// @inheritdoc IKeep3rParameters\n address public override keep3rHelper;\n\n /// @inheritdoc IKeep3rParameters\n address public override kp3rWethPool;\n\n /// @inheritdoc IKeep3rParameters\n uint256 public override bondTime = 3 days;\n\n /// @inheritdoc IKeep3rParameters\n uint256 public override unbondTime = 14 days;\n\n /// @inheritdoc IKeep3rParameters\n uint256 public override liquidityMinimum = 3 ether;\n\n /// @inheritdoc IKeep3rParameters\n uint256 public override rewardPeriodTime = 5 days;\n\n /// @inheritdoc IKeep3rParameters\n uint256 public override inflationPeriod = 34 days;\n\n /// @inheritdoc IKeep3rParameters\n uint256 public override fee = 30;\n\n /// @notice The base that will be used to calculate the fee\n uint256 internal constant _BASE = 10_000;\n\n /// @notice The minimum reward period\n uint256 internal constant _MIN_REWARD_PERIOD_TIME = 1 days;\n\n constructor(\n address _keep3rHelper,\n address _keep3rV1,\n address _keep3rV1Proxy,\n address _kp3rWethPool\n ) {\n keep3rHelper = _keep3rHelper;\n keep3rV1 = _keep3rV1;\n keep3rV1Proxy = _keep3rV1Proxy;\n kp3rWethPool = _kp3rWethPool;\n _liquidityPool[kp3rWethPool] = kp3rWethPool;\n _isKP3RToken0[_kp3rWethPool] = IKeep3rHelper(keep3rHelper).isKP3RToken0(kp3rWethPool);\n }\n\n /// @inheritdoc IKeep3rParameters\n function setKeep3rHelper(address _keep3rHelper) external override onlyGovernance {\n if (_keep3rHelper == address(0)) revert ZeroAddress();\n keep3rHelper = _keep3rHelper;\n emit Keep3rHelperChange(_keep3rHelper);\n }\n\n /// @inheritdoc IKeep3rParameters\n function setKeep3rV1(address _keep3rV1) external override onlyGovernance {\n if (_keep3rV1 == address(0)) revert ZeroAddress();\n keep3rV1 = _keep3rV1;\n emit Keep3rV1Change(_keep3rV1);\n }\n\n /// @inheritdoc IKeep3rParameters\n function setKeep3rV1Proxy(address _keep3rV1Proxy) external override onlyGovernance {\n if (_keep3rV1Proxy == address(0)) revert ZeroAddress();\n keep3rV1Proxy = _keep3rV1Proxy;\n emit Keep3rV1ProxyChange(_keep3rV1Proxy);\n }\n\n /// @inheritdoc IKeep3rParameters\n function setKp3rWethPool(address _kp3rWethPool) external override onlyGovernance {\n if (_kp3rWethPool == address(0)) revert ZeroAddress();\n kp3rWethPool = _kp3rWethPool;\n _liquidityPool[kp3rWethPool] = kp3rWethPool;\n _isKP3RToken0[_kp3rWethPool] = IKeep3rHelper(keep3rHelper).isKP3RToken0(_kp3rWethPool);\n emit Kp3rWethPoolChange(_kp3rWethPool);\n }\n\n /// @inheritdoc IKeep3rParameters\n function setBondTime(uint256 _bondTime) external override onlyGovernance {\n bondTime = _bondTime;\n emit BondTimeChange(_bondTime);\n }\n\n /// @inheritdoc IKeep3rParameters\n function setUnbondTime(uint256 _unbondTime) external override onlyGovernance {\n unbondTime = _unbondTime;\n emit UnbondTimeChange(_unbondTime);\n }\n\n /// @inheritdoc IKeep3rParameters\n function setLiquidityMinimum(uint256 _liquidityMinimum) external override onlyGovernance {\n liquidityMinimum = _liquidityMinimum;\n emit LiquidityMinimumChange(_liquidityMinimum);\n }\n\n /// @inheritdoc IKeep3rParameters\n // TODO: check what happens to credit minting when changing this. Shouldn't we update the cached ticks?\n function setRewardPeriodTime(uint256 _rewardPeriodTime) external override onlyGovernance {\n if (_rewardPeriodTime < _MIN_REWARD_PERIOD_TIME) revert MinRewardPeriod();\n rewardPeriodTime = _rewardPeriodTime;\n emit RewardPeriodTimeChange(_rewardPeriodTime);\n }\n\n /// @inheritdoc IKeep3rParameters\n function setInflationPeriod(uint256 _inflationPeriod) external override onlyGovernance {\n inflationPeriod = _inflationPeriod;\n emit InflationPeriodChange(_inflationPeriod);\n }\n\n /// @inheritdoc IKeep3rParameters\n function setFee(uint256 _fee) external override onlyGovernance {\n fee = _fee;\n emit FeeChange(_fee);\n }\n}\n" - }, - "solidity/contracts/peripherals/DustCollector.sol": { - "content": "// SPDX-License-Identifier: MIT\n\npragma solidity >=0.8.4 <0.9.0;\n\nimport '@openzeppelin/contracts/token/ERC20/IERC20.sol';\nimport '@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol';\nimport '../../contracts/peripherals/Governable.sol';\nimport '../../interfaces/peripherals/IDustCollector.sol';\n\nabstract contract DustCollector is IDustCollector, Governable {\n using SafeERC20 for IERC20;\n\n address internal constant _ETH_ADDRESS = 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE;\n\n function sendDust(\n address _token,\n uint256 _amount,\n address _to\n ) external override onlyGovernance {\n if (_to == address(0)) revert ZeroAddress();\n if (_token == _ETH_ADDRESS) {\n payable(_to).transfer(_amount);\n } else {\n IERC20(_token).safeTransfer(_to, _amount);\n }\n emit DustSent(_token, _amount, _to);\n }\n}\n" - }, - "solidity/contracts/peripherals/jobs/Keep3rJobDisputable.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport './Keep3rJobFundableCredits.sol';\nimport './Keep3rJobFundableLiquidity.sol';\nimport '../Keep3rDisputable.sol';\n\nabstract contract Keep3rJobDisputable is IKeep3rJobDisputable, Keep3rDisputable, Keep3rJobFundableCredits, Keep3rJobFundableLiquidity {\n using EnumerableSet for EnumerableSet.AddressSet;\n using SafeERC20 for IERC20;\n\n /// @inheritdoc IKeep3rJobDisputable\n function slashTokenFromJob(\n address _job,\n address _token,\n uint256 _amount\n ) external override onlySlasher {\n if (!disputes[_job]) revert NotDisputed();\n if (!_jobTokens[_job].contains(_token)) revert JobTokenUnexistent();\n if (jobTokenCredits[_job][_token] < _amount) revert JobTokenInsufficient();\n\n try IERC20(_token).transfer(governance, _amount) {} catch {}\n jobTokenCredits[_job][_token] -= _amount;\n if (jobTokenCredits[_job][_token] == 0) {\n _jobTokens[_job].remove(_token);\n }\n\n emit JobSlashToken(_job, _token, msg.sender, _amount);\n }\n\n /// @inheritdoc IKeep3rJobDisputable\n function slashLiquidityFromJob(\n address _job,\n address _liquidity,\n uint256 _amount\n ) external override onlySlasher {\n if (!disputes[_job]) revert NotDisputed();\n\n _unbondLiquidityFromJob(_job, _liquidity, _amount);\n try IERC20(_liquidity).transfer(governance, _amount) {} catch {}\n emit JobSlashLiquidity(_job, _liquidity, msg.sender, _amount);\n }\n}\n" - }, - "solidity/contracts/peripherals/jobs/Keep3rJobWorkable.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport './Keep3rJobMigration.sol';\nimport '../../../interfaces/IKeep3rHelper.sol';\nimport '../../../interfaces/peripherals/IKeep3rJobs.sol';\n\nimport '@openzeppelin/contracts/token/ERC20/IERC20.sol';\nimport '@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol';\n\nabstract contract Keep3rJobWorkable is IKeep3rJobWorkable, Keep3rJobMigration {\n using EnumerableSet for EnumerableSet.AddressSet;\n using SafeERC20 for IERC20;\n\n uint256 internal _initialGas;\n\n /// @inheritdoc IKeep3rJobWorkable\n function isKeeper(address _keeper) external override returns (bool _isKeeper) {\n _initialGas = _getGasLeft();\n if (_keepers.contains(_keeper)) {\n emit KeeperValidation(_initialGas);\n return true;\n }\n }\n\n /// @inheritdoc IKeep3rJobWorkable\n function isBondedKeeper(\n address _keeper,\n address _bond,\n uint256 _minBond,\n uint256 _earned,\n uint256 _age\n ) public override returns (bool _isBondedKeeper) {\n _initialGas = _getGasLeft();\n if (\n _keepers.contains(_keeper) &&\n bonds[_keeper][_bond] >= _minBond &&\n workCompleted[_keeper] >= _earned &&\n block.timestamp - firstSeen[_keeper] >= _age\n ) {\n emit KeeperValidation(_initialGas);\n return true;\n }\n }\n\n /// @inheritdoc IKeep3rJobWorkable\n function worked(address _keeper) external override {\n address _job = msg.sender;\n if (disputes[_job]) revert JobDisputed();\n if (!_jobs.contains(_job)) revert JobUnapproved();\n\n if (_updateJobCreditsIfNeeded(_job)) {\n emit LiquidityCreditsReward(_job, rewardedAt[_job], _jobLiquidityCredits[_job], _jobPeriodCredits[_job]);\n }\n\n (uint256 _boost, uint256 _oneEthQuote, uint256 _extraGas) = IKeep3rHelper(keep3rHelper).getPaymentParams(bonds[_keeper][keep3rV1]);\n\n uint256 _gasLeft = _getGasLeft();\n uint256 _payment = _calculatePayment(_gasLeft, _extraGas, _oneEthQuote, _boost);\n\n if (_payment > _jobLiquidityCredits[_job]) {\n _rewardJobCredits(_job);\n emit LiquidityCreditsReward(_job, rewardedAt[_job], _jobLiquidityCredits[_job], _jobPeriodCredits[_job]);\n\n _gasLeft = _getGasLeft();\n _payment = _calculatePayment(_gasLeft, _extraGas, _oneEthQuote, _boost);\n }\n\n _bondedPayment(_job, _keeper, _payment);\n emit KeeperWork(keep3rV1, _job, _keeper, _payment, _gasLeft);\n }\n\n /// @inheritdoc IKeep3rJobWorkable\n function bondedPayment(address _keeper, uint256 _payment) public override {\n address _job = msg.sender;\n\n if (disputes[_job]) revert JobDisputed();\n if (!_jobs.contains(_job)) revert JobUnapproved();\n\n if (_updateJobCreditsIfNeeded(_job)) {\n emit LiquidityCreditsReward(_job, rewardedAt[_job], _jobLiquidityCredits[_job], _jobPeriodCredits[_job]);\n }\n\n if (_payment > _jobLiquidityCredits[_job]) {\n _rewardJobCredits(_job);\n emit LiquidityCreditsReward(_job, rewardedAt[_job], _jobLiquidityCredits[_job], _jobPeriodCredits[_job]);\n }\n\n _bondedPayment(_job, _keeper, _payment);\n emit KeeperWork(keep3rV1, _job, _keeper, _payment, _getGasLeft());\n }\n\n /// @inheritdoc IKeep3rJobWorkable\n function directTokenPayment(\n address _token,\n address _keeper,\n uint256 _amount\n ) external override {\n address _job = msg.sender;\n\n if (disputes[_job]) revert JobDisputed();\n if (disputes[_keeper]) revert Disputed();\n if (!_jobs.contains(_job)) revert JobUnapproved();\n if (jobTokenCredits[_job][_token] < _amount) revert InsufficientFunds();\n jobTokenCredits[_job][_token] -= _amount;\n IERC20(_token).safeTransfer(_keeper, _amount);\n emit KeeperWork(_token, _job, _keeper, _amount, _getGasLeft());\n }\n\n function _bondedPayment(\n address _job,\n address _keeper,\n uint256 _payment\n ) internal {\n if (_payment > _jobLiquidityCredits[_job]) revert InsufficientFunds();\n\n workedAt[_job] = block.timestamp;\n _jobLiquidityCredits[_job] -= _payment;\n bonds[_keeper][keep3rV1] += _payment;\n workCompleted[_keeper] += _payment;\n }\n\n /// @notice Calculate amount to be payed in KP3R, taking into account multiple parameters\n /// @param _gasLeft Amount of gas left after working the job\n /// @param _extraGas Amount of expected unaccounted gas\n /// @param _oneEthQuote Amount of KP3R equivalent to 1 ETH\n /// @param _boost Reward given to the keeper for having bonded KP3R tokens\n /// @return _payment Amount to be payed in KP3R tokens\n function _calculatePayment(\n uint256 _gasLeft,\n uint256 _extraGas,\n uint256 _oneEthQuote,\n uint256 _boost\n ) internal view returns (uint256 _payment) {\n uint256 _accountedGas = _initialGas - _gasLeft + _extraGas;\n _payment = (((_accountedGas * _boost) / _BASE) * _oneEthQuote) / 1 ether;\n }\n\n /// @notice Return the gas left and add 1/64 in order to match real gas left at first level of depth (EIP-150)\n /// @return _gasLeft Amount of gas left recording taking into account EIP-150\n function _getGasLeft() internal view returns (uint256 _gasLeft) {\n _gasLeft = (gasleft() * 64) / 63;\n }\n}\n" - }, - "solidity/contracts/peripherals/jobs/Keep3rJobManager.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport './Keep3rJobOwnership.sol';\nimport '../Keep3rRoles.sol';\nimport '../Keep3rParameters.sol';\nimport '../../../interfaces/peripherals/IKeep3rJobs.sol';\n\nabstract contract Keep3rJobManager is IKeep3rJobManager, Keep3rJobOwnership, Keep3rRoles, Keep3rParameters {\n using EnumerableSet for EnumerableSet.AddressSet;\n\n /// @inheritdoc IKeep3rJobManager\n function addJob(address _job) external override {\n if (_jobs.contains(_job)) revert JobAlreadyAdded();\n if (hasBonded[_job]) revert AlreadyAKeeper();\n _jobs.add(_job);\n jobOwner[_job] = msg.sender;\n emit JobAddition(msg.sender, _job);\n }\n}\n" - }, - "solidity/contracts/peripherals/jobs/Keep3rJobFundableCredits.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport './Keep3rJobOwnership.sol';\nimport '../Keep3rAccountance.sol';\nimport '../Keep3rParameters.sol';\nimport '../../../interfaces/peripherals/IKeep3rJobs.sol';\n\nimport '@openzeppelin/contracts/security/ReentrancyGuard.sol';\nimport '@openzeppelin/contracts/token/ERC20/IERC20.sol';\nimport '@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol';\nimport '@openzeppelin/contracts/utils/math/Math.sol';\n\nabstract contract Keep3rJobFundableCredits is IKeep3rJobFundableCredits, ReentrancyGuard, Keep3rJobOwnership, Keep3rParameters {\n using EnumerableSet for EnumerableSet.AddressSet;\n using SafeERC20 for IERC20;\n\n /// @notice Cooldown between withdrawals\n uint256 internal constant _WITHDRAW_TOKENS_COOLDOWN = 1 minutes;\n\n /// @inheritdoc IKeep3rJobFundableCredits\n mapping(address => mapping(address => uint256)) public override jobTokenCreditsAddedAt;\n\n /// @inheritdoc IKeep3rJobFundableCredits\n function addTokenCreditsToJob(\n address _job,\n address _token,\n uint256 _amount\n ) external override nonReentrant {\n if (!_jobs.contains(_job)) revert JobUnavailable();\n // KP3R shouldn't be used for direct token payments\n if (_token == keep3rV1) revert TokenUnallowed();\n uint256 _before = IERC20(_token).balanceOf(address(this));\n IERC20(_token).safeTransferFrom(msg.sender, address(this), _amount);\n uint256 _received = IERC20(_token).balanceOf(address(this)) - _before;\n uint256 _tokenFee = (_received * fee) / _BASE;\n jobTokenCredits[_job][_token] += _received - _tokenFee;\n jobTokenCreditsAddedAt[_job][_token] = block.timestamp;\n IERC20(_token).safeTransfer(governance, _tokenFee);\n _jobTokens[_job].add(_token);\n\n emit TokenCreditAddition(_job, _token, msg.sender, _received);\n }\n\n /// @inheritdoc IKeep3rJobFundableCredits\n function withdrawTokenCreditsFromJob(\n address _job,\n address _token,\n uint256 _amount,\n address _receiver\n ) external override nonReentrant onlyJobOwner(_job) {\n if (block.timestamp <= jobTokenCreditsAddedAt[_job][_token] + _WITHDRAW_TOKENS_COOLDOWN) revert JobTokenCreditsLocked();\n if (jobTokenCredits[_job][_token] < _amount) revert InsufficientJobTokenCredits();\n if (disputes[_job]) revert JobDisputed();\n\n jobTokenCredits[_job][_token] -= _amount;\n IERC20(_token).safeTransfer(_receiver, _amount);\n\n if (jobTokenCredits[_job][_token] == 0) {\n _jobTokens[_job].remove(_token);\n }\n\n emit TokenCreditWithdrawal(_job, _token, _receiver, _amount);\n }\n}\n" - }, - "solidity/contracts/peripherals/jobs/Keep3rJobFundableLiquidity.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport './Keep3rJobOwnership.sol';\nimport '../Keep3rAccountance.sol';\nimport '../Keep3rParameters.sol';\nimport '../../../interfaces/IPairManager.sol';\nimport '../../../interfaces/peripherals/IKeep3rJobs.sol';\n\nimport '../../libraries/FullMath.sol';\n\nimport '@openzeppelin/contracts/security/ReentrancyGuard.sol';\nimport '@openzeppelin/contracts/token/ERC20/IERC20.sol';\nimport '@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol';\nimport '@openzeppelin/contracts/utils/math/Math.sol';\n\nabstract contract Keep3rJobFundableLiquidity is IKeep3rJobFundableLiquidity, ReentrancyGuard, Keep3rJobOwnership, Keep3rParameters {\n using EnumerableSet for EnumerableSet.AddressSet;\n using SafeERC20 for IERC20;\n\n /// @notice List of liquidities that are accepted in the system\n EnumerableSet.AddressSet internal _approvedLiquidities;\n\n /// @inheritdoc IKeep3rJobFundableLiquidity\n mapping(address => mapping(address => uint256)) public override liquidityAmount;\n\n /// @inheritdoc IKeep3rJobFundableLiquidity\n mapping(address => uint256) public override rewardedAt;\n\n /// @inheritdoc IKeep3rJobFundableLiquidity\n mapping(address => uint256) public override workedAt;\n\n /// @notice Tracks an address and returns its TickCache\n mapping(address => TickCache) internal _tick;\n\n // Views\n\n /// @inheritdoc IKeep3rJobFundableLiquidity\n function approvedLiquidities() external view override returns (address[] memory _list) {\n _list = _approvedLiquidities.values();\n }\n\n /// @inheritdoc IKeep3rJobFundableLiquidity\n function jobPeriodCredits(address _job) public view override returns (uint256 _periodCredits) {\n for (uint256 i; i < _jobLiquidities[_job].length(); i++) {\n address _liquidity = _jobLiquidities[_job].at(i);\n if (_approvedLiquidities.contains(_liquidity)) {\n TickCache memory _tickCache = observeLiquidity(_liquidity);\n if (_tickCache.period != 0) {\n int56 _tickDifference = _isKP3RToken0[_liquidity] ? _tickCache.difference : -_tickCache.difference;\n _periodCredits += _getReward(\n IKeep3rHelper(keep3rHelper).getKP3RsAtTick(liquidityAmount[_job][_liquidity], _tickDifference, rewardPeriodTime)\n );\n }\n }\n }\n }\n\n /// @inheritdoc IKeep3rJobFundableLiquidity\n function jobLiquidityCredits(address _job) public view override returns (uint256 _liquidityCredits) {\n uint256 _periodCredits = jobPeriodCredits(_job);\n\n // If the job was rewarded in the past 1 period time\n if ((block.timestamp - rewardedAt[_job]) < rewardPeriodTime) {\n // If the job has period credits, update minted job credits to new twap\n _liquidityCredits = _periodCredits > 0\n ? (_jobLiquidityCredits[_job] * _periodCredits) / _jobPeriodCredits[_job] // If the job has period credits, return remaining job credits updated to new twap\n : _jobLiquidityCredits[_job]; // If not, return remaining credits, forced credits should not be updated\n } else {\n // Else return a full period worth of credits if current credits have expired\n _liquidityCredits = _periodCredits;\n }\n }\n\n /// @inheritdoc IKeep3rJobFundableLiquidity\n function totalJobCredits(address _job) external view override returns (uint256 _credits) {\n uint256 _periodCredits = jobPeriodCredits(_job);\n uint256 _cooldown = block.timestamp;\n\n if ((rewardedAt[_job] > _period(block.timestamp - rewardPeriodTime))) {\n // Will calculate cooldown if it outdated\n if ((block.timestamp - rewardedAt[_job]) >= rewardPeriodTime) {\n // Will calculate cooldown from last reward reference in this period\n _cooldown -= (rewardedAt[_job] + rewardPeriodTime);\n } else {\n // Will calculate cooldown from last reward timestamp\n _cooldown -= rewardedAt[_job];\n }\n } else {\n // Will calculate cooldown from period start if expired\n _cooldown -= _period(block.timestamp);\n }\n _credits = jobLiquidityCredits(_job) + _phase(_cooldown, _periodCredits);\n }\n\n /// @inheritdoc IKeep3rJobFundableLiquidity\n function quoteLiquidity(address _liquidity, uint256 _amount) external view override returns (uint256 _periodCredits) {\n if (_approvedLiquidities.contains(_liquidity)) {\n TickCache memory _tickCache = observeLiquidity(_liquidity);\n if (_tickCache.period != 0) {\n int56 _tickDifference = _isKP3RToken0[_liquidity] ? _tickCache.difference : -_tickCache.difference;\n return _getReward(IKeep3rHelper(keep3rHelper).getKP3RsAtTick(_amount, _tickDifference, rewardPeriodTime));\n }\n }\n }\n\n /// @inheritdoc IKeep3rJobFundableLiquidity\n function observeLiquidity(address _liquidity) public view override returns (TickCache memory _tickCache) {\n if (_tick[_liquidity].period == _period(block.timestamp)) {\n // Will return cached twaps if liquidity is updated\n _tickCache = _tick[_liquidity];\n } else {\n bool success;\n uint256 lastPeriod = _period(block.timestamp - rewardPeriodTime);\n\n if (_tick[_liquidity].period == lastPeriod) {\n // Will only ask for current period accumulator if liquidity is outdated\n uint32[] memory _secondsAgo = new uint32[](1);\n int56 previousTick = _tick[_liquidity].current;\n\n _secondsAgo[0] = uint32(block.timestamp - _period(block.timestamp));\n\n (_tickCache.current, , success) = IKeep3rHelper(keep3rHelper).observe(_liquidityPool[_liquidity], _secondsAgo);\n\n _tickCache.difference = _tickCache.current - previousTick;\n } else if (_tick[_liquidity].period < lastPeriod) {\n // Will ask for 2 accumulators if liquidity is expired\n uint32[] memory _secondsAgo = new uint32[](2);\n\n _secondsAgo[0] = uint32(block.timestamp - _period(block.timestamp));\n _secondsAgo[1] = uint32(block.timestamp - _period(block.timestamp) + rewardPeriodTime);\n\n int56 _tickCumulative2;\n (_tickCache.current, _tickCumulative2, success) = IKeep3rHelper(keep3rHelper).observe(_liquidityPool[_liquidity], _secondsAgo);\n\n _tickCache.difference = _tickCache.current - _tickCumulative2;\n }\n if (success) {\n _tickCache.period = _period(block.timestamp);\n } else {\n delete _tickCache.period;\n }\n }\n }\n\n // Methods\n\n /// @inheritdoc IKeep3rJobFundableLiquidity\n function forceLiquidityCreditsToJob(address _job, uint256 _amount) external override onlyGovernance {\n if (!_jobs.contains(_job)) revert JobUnavailable();\n _settleJobAccountance(_job);\n _jobLiquidityCredits[_job] += _amount;\n emit LiquidityCreditsForced(_job, rewardedAt[_job], _jobLiquidityCredits[_job]);\n }\n\n /// @inheritdoc IKeep3rJobFundableLiquidity\n function approveLiquidity(address _liquidity) external override onlyGovernance {\n if (!_approvedLiquidities.add(_liquidity)) revert LiquidityPairApproved();\n _liquidityPool[_liquidity] = IPairManager(_liquidity).pool();\n _isKP3RToken0[_liquidity] = IKeep3rHelper(keep3rHelper).isKP3RToken0(_liquidityPool[_liquidity]);\n _tick[_liquidity] = observeLiquidity(_liquidity);\n emit LiquidityApproval(_liquidity);\n }\n\n /// @inheritdoc IKeep3rJobFundableLiquidity\n function revokeLiquidity(address _liquidity) external override onlyGovernance {\n if (!_approvedLiquidities.remove(_liquidity)) revert LiquidityPairUnexistent();\n emit LiquidityRevocation(_liquidity);\n }\n\n /// @inheritdoc IKeep3rJobFundableLiquidity\n function addLiquidityToJob(\n address _job,\n address _liquidity,\n uint256 _amount\n ) external override nonReentrant {\n if (!_approvedLiquidities.contains(_liquidity)) revert LiquidityPairUnapproved();\n if (!_jobs.contains(_job)) revert JobUnavailable();\n\n _jobLiquidities[_job].add(_liquidity);\n\n _settleJobAccountance(_job);\n\n if (_quoteLiquidity(liquidityAmount[_job][_liquidity] + _amount, _liquidity) < liquidityMinimum) revert JobLiquidityLessThanMin();\n\n emit LiquidityCreditsReward(_job, rewardedAt[_job], _jobLiquidityCredits[_job], _jobPeriodCredits[_job]);\n\n IERC20(_liquidity).safeTransferFrom(msg.sender, address(this), _amount);\n liquidityAmount[_job][_liquidity] += _amount;\n _jobPeriodCredits[_job] += _getReward(_quoteLiquidity(_amount, _liquidity));\n emit LiquidityAddition(_job, _liquidity, msg.sender, _amount);\n }\n\n /// @inheritdoc IKeep3rJobFundableLiquidity\n function unbondLiquidityFromJob(\n address _job,\n address _liquidity,\n uint256 _amount\n ) external override onlyJobOwner(_job) {\n canWithdrawAfter[_job][_liquidity] = block.timestamp + unbondTime;\n pendingUnbonds[_job][_liquidity] += _amount;\n _unbondLiquidityFromJob(_job, _liquidity, _amount);\n\n uint256 _remainingLiquidity = liquidityAmount[_job][_liquidity];\n if (_remainingLiquidity > 0 && _quoteLiquidity(_remainingLiquidity, _liquidity) < liquidityMinimum) revert JobLiquidityLessThanMin();\n\n emit Unbonding(_job, _liquidity, _amount);\n }\n\n /// @inheritdoc IKeep3rJobFundableLiquidity\n function withdrawLiquidityFromJob(\n address _job,\n address _liquidity,\n address _receiver\n ) external override onlyJobOwner(_job) {\n if (_receiver == address(0)) revert ZeroAddress();\n if (pendingUnbonds[_job][_liquidity] == 0) revert UnbondsUnexistent();\n if (canWithdrawAfter[_job][_liquidity] >= block.timestamp) revert UnbondsLocked();\n if (disputes[_job]) revert Disputed();\n\n uint256 _amount = pendingUnbonds[_job][_liquidity];\n\n delete pendingUnbonds[_job][_liquidity];\n delete canWithdrawAfter[_job][_liquidity];\n\n IERC20(_liquidity).safeTransfer(_receiver, _amount);\n emit LiquidityWithdrawal(_job, _liquidity, _receiver, _amount);\n }\n\n // Internal functions\n\n /// @notice Updates or rewards job liquidity credits depending on time since last job reward\n function _updateJobCreditsIfNeeded(address _job) internal returns (bool _rewarded) {\n if (rewardedAt[_job] < _period(block.timestamp)) {\n // Will exit function if job has been rewarded in current period\n if (rewardedAt[_job] <= _period(block.timestamp - rewardPeriodTime)) {\n // Will reset job to period syncronicity if a full period passed without rewards\n _updateJobPeriod(_job);\n _jobLiquidityCredits[_job] = _jobPeriodCredits[_job];\n rewardedAt[_job] = _period(block.timestamp);\n _rewarded = true;\n } else if ((block.timestamp - rewardedAt[_job]) >= rewardPeriodTime) {\n // Will reset job's syncronicity if last reward was more than epoch ago\n _updateJobPeriod(_job);\n _jobLiquidityCredits[_job] = _jobPeriodCredits[_job];\n rewardedAt[_job] += rewardPeriodTime;\n _rewarded = true;\n } else if (workedAt[_job] < _period(block.timestamp)) {\n // First keeper on period has to update job accountance to current twaps\n uint256 previousPeriodCredits = _jobPeriodCredits[_job];\n _updateJobPeriod(_job);\n _jobLiquidityCredits[_job] = (_jobLiquidityCredits[_job] * _jobPeriodCredits[_job]) / previousPeriodCredits;\n // Updating job accountance does not reward job\n }\n }\n }\n\n /// @notice Only called if _jobLiquidityCredits < payment\n function _rewardJobCredits(address _job) internal {\n /// @notice Only way to += jobLiquidityCredits is when keeper rewarding (cannot pay work)\n /* WARNING: this allows to top up _jobLiquidityCredits to a max of 1.99 but have to spend at least 1 */\n _jobLiquidityCredits[_job] += _phase(block.timestamp - rewardedAt[_job], _jobPeriodCredits[_job]);\n rewardedAt[_job] = block.timestamp;\n }\n\n /// @notice Updates accountance for _jobPeriodCredits\n function _updateJobPeriod(address _job) internal {\n _jobPeriodCredits[_job] = _calculateJobPeriodCredits(_job);\n }\n\n /// @notice Quotes the outdated job liquidities and calculates _periodCredits\n /// @dev This function is also responsible for keeping the KP3R/WETH quote updated\n function _calculateJobPeriodCredits(address _job) internal returns (uint256 _periodCredits) {\n if (_tick[kp3rWethPool].period != _period(block.timestamp)) {\n // Updates KP3R/WETH quote if needed\n _tick[kp3rWethPool] = observeLiquidity(kp3rWethPool);\n }\n\n for (uint256 i; i < _jobLiquidities[_job].length(); i++) {\n address _liquidity = _jobLiquidities[_job].at(i);\n if (_approvedLiquidities.contains(_liquidity)) {\n if (_tick[_liquidity].period != _period(block.timestamp)) {\n // Updates liquidity cache only if needed\n _tick[_liquidity] = observeLiquidity(_liquidity);\n }\n _periodCredits += _getReward(_quoteLiquidity(liquidityAmount[_job][_liquidity], _liquidity));\n }\n }\n }\n\n /// @notice Updates job accountance calculating the impact of the unbonded liquidity amount\n function _unbondLiquidityFromJob(\n address _job,\n address _liquidity,\n uint256 _amount\n ) internal nonReentrant {\n if (!_jobLiquidities[_job].contains(_liquidity)) revert JobLiquidityUnexistent();\n if (liquidityAmount[_job][_liquidity] < _amount) revert JobLiquidityInsufficient();\n\n // Ensures current twaps in job liquidities\n _updateJobPeriod(_job);\n uint256 _periodCreditsToRemove = _getReward(_quoteLiquidity(_amount, _liquidity));\n\n // A liquidity can be revoked causing a job to have 0 periodCredits\n if (_jobPeriodCredits[_job] > 0) {\n // Removes a % correspondant to a full rewardPeriodTime for the liquidity withdrawn vs all of the liquidities\n _jobLiquidityCredits[_job] -= (_jobLiquidityCredits[_job] * _periodCreditsToRemove) / _jobPeriodCredits[_job];\n _jobPeriodCredits[_job] -= _periodCreditsToRemove;\n }\n\n liquidityAmount[_job][_liquidity] -= _amount;\n if (liquidityAmount[_job][_liquidity] == 0) {\n _jobLiquidities[_job].remove(_liquidity);\n }\n }\n\n /// @notice Returns a fraction of the multiplier or the whole multiplier if equal or more than a rewardPeriodTime has passed\n function _phase(uint256 _timePassed, uint256 _multiplier) internal view returns (uint256 _result) {\n if (_timePassed < rewardPeriodTime) {\n _result = (_timePassed * _multiplier) / rewardPeriodTime;\n } else _result = _multiplier;\n }\n\n /// @notice Returns the start of the period of the provided timestamp\n function _period(uint256 _timestamp) internal view returns (uint256 _periodTimestamp) {\n return _timestamp - (_timestamp % rewardPeriodTime);\n }\n\n /// @notice Calculates relation between rewardPeriod and inflationPeriod\n function _getReward(uint256 _baseAmount) internal view returns (uint256 _credits) {\n return FullMath.mulDiv(_baseAmount, rewardPeriodTime, inflationPeriod);\n }\n\n /// @notice Returns underlying KP3R amount for a given liquidity amount\n function _quoteLiquidity(uint256 _amount, address _liquidity) internal view returns (uint256 _quote) {\n if (_tick[_liquidity].period != 0) {\n int56 _tickDifference = _isKP3RToken0[_liquidity] ? _tick[_liquidity].difference : -_tick[_liquidity].difference;\n _quote = IKeep3rHelper(keep3rHelper).getKP3RsAtTick(_amount, _tickDifference, rewardPeriodTime);\n }\n }\n\n /// @notice Updates job credits to current quotes and rewards job's pending minted credits\n /// @dev Ensures a maximum of 1 period of credits\n function _settleJobAccountance(address _job) internal virtual {\n _updateJobCreditsIfNeeded(_job);\n _rewardJobCredits(_job);\n _jobLiquidityCredits[_job] = Math.min(_jobLiquidityCredits[_job], _jobPeriodCredits[_job]);\n }\n}\n" - }, - "solidity/contracts/peripherals/Keep3rDisputable.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport './Keep3rParameters.sol';\nimport './Keep3rRoles.sol';\nimport '../../interfaces/peripherals/IKeep3rDisputable.sol';\n\nabstract contract Keep3rDisputable is IKeep3rDisputable, Keep3rAccountance, Keep3rRoles {\n /// @inheritdoc IKeep3rDisputable\n function dispute(address _jobOrKeeper) external override onlyDisputer {\n if (disputes[_jobOrKeeper]) revert AlreadyDisputed();\n disputes[_jobOrKeeper] = true;\n emit Dispute(_jobOrKeeper, msg.sender);\n }\n\n /// @inheritdoc IKeep3rDisputable\n function resolve(address _jobOrKeeper) external override onlyDisputer {\n if (!disputes[_jobOrKeeper]) revert NotDisputed();\n disputes[_jobOrKeeper] = false;\n emit Resolve(_jobOrKeeper, msg.sender);\n }\n}\n" - }, - "solidity/contracts/peripherals/jobs/Keep3rJobOwnership.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../../../interfaces/peripherals/IKeep3rJobs.sol';\n\nabstract contract Keep3rJobOwnership is IKeep3rJobOwnership {\n /// @inheritdoc IKeep3rJobOwnership\n mapping(address => address) public override jobOwner;\n\n /// @inheritdoc IKeep3rJobOwnership\n mapping(address => address) public override jobPendingOwner;\n\n /// @inheritdoc IKeep3rJobOwnership\n function changeJobOwnership(address _job, address _newOwner) external override onlyJobOwner(_job) {\n jobPendingOwner[_job] = _newOwner;\n emit JobOwnershipChange(_job, jobOwner[_job], _newOwner);\n }\n\n /// @inheritdoc IKeep3rJobOwnership\n function acceptJobOwnership(address _job) external override onlyPendingJobOwner(_job) {\n address _previousOwner = jobOwner[_job];\n\n jobOwner[_job] = jobPendingOwner[_job];\n delete jobPendingOwner[_job];\n\n emit JobOwnershipAssent(msg.sender, _job, _previousOwner);\n }\n\n modifier onlyJobOwner(address _job) {\n if (msg.sender != jobOwner[_job]) revert OnlyJobOwner();\n _;\n }\n\n modifier onlyPendingJobOwner(address _job) {\n if (msg.sender != jobPendingOwner[_job]) revert OnlyPendingJobOwner();\n _;\n }\n}\n" - }, - "solidity/interfaces/peripherals/IKeep3rJobs.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\n/// @title Keep3rJobFundableCredits contract\n/// @notice Handles the addition and withdrawal of credits from a job\ninterface IKeep3rJobFundableCredits {\n // Events\n\n /// @notice Emitted when Keep3rJobFundableCredits#addTokenCreditsToJob is called\n /// @param _job The address of the job being credited\n /// @param _token The address of the token being provided\n /// @param _provider The user that calls the function\n /// @param _amount The amount of credit being added to the job\n event TokenCreditAddition(address indexed _job, address indexed _token, address indexed _provider, uint256 _amount);\n\n /// @notice Emitted when Keep3rJobFundableCredits#withdrawTokenCreditsFromJob is called\n /// @param _job The address of the job from which the credits are withdrawn\n /// @param _token The credit being withdrawn from the job\n /// @param _receiver The user that receives the tokens\n /// @param _amount The amount of credit withdrawn\n event TokenCreditWithdrawal(address indexed _job, address indexed _token, address indexed _receiver, uint256 _amount);\n\n // Errors\n\n /// @notice Throws when the token is KP3R, as it should not be used for direct token payments\n error TokenUnallowed();\n\n /// @notice Throws when the token withdraw cooldown has not yet passed\n error JobTokenCreditsLocked();\n\n /// @notice Throws when the user tries to withdraw more tokens than it has\n error InsufficientJobTokenCredits();\n\n // Variables\n\n /// @notice Last block where tokens were added to the job\n /// @param _job The address of the job credited\n /// @param _token The address of the token credited\n /// @return _timestamp The last block where tokens were added to the job\n function jobTokenCreditsAddedAt(address _job, address _token) external view returns (uint256 _timestamp);\n\n // Methods\n\n /// @notice Add credit to a job to be paid out for work\n /// @param _job The address of the job being credited\n /// @param _token The address of the token being credited\n /// @param _amount The amount of credit being added\n function addTokenCreditsToJob(\n address _job,\n address _token,\n uint256 _amount\n ) external;\n\n /// @notice Withdraw credit from a job\n /// @param _job The address of the job from which the credits are withdrawn\n /// @param _token The address of the token being withdrawn\n /// @param _amount The amount of token to be withdrawn\n /// @param _receiver The user that will receive tokens\n function withdrawTokenCreditsFromJob(\n address _job,\n address _token,\n uint256 _amount,\n address _receiver\n ) external;\n}\n\n/// @title Keep3rJobFundableLiquidity contract\n/// @notice Handles the funding of jobs through specific liquidity pairs\ninterface IKeep3rJobFundableLiquidity {\n // Events\n\n /// @notice Emitted when Keep3rJobFundableLiquidity#approveLiquidity function is called\n /// @param _liquidity The address of the liquidity pair being approved\n event LiquidityApproval(address _liquidity);\n\n /// @notice Emitted when Keep3rJobFundableLiquidity#revokeLiquidity function is called\n /// @param _liquidity The address of the liquidity pair being revoked\n event LiquidityRevocation(address _liquidity);\n\n /// @notice Emitted when IKeep3rJobFundableLiquidity#addLiquidityToJob function is called\n /// @param _job The address of the job to which liquidity will be added\n /// @param _liquidity The address of the liquidity being added\n /// @param _provider The user that calls the function\n /// @param _amount The amount of liquidity being added\n event LiquidityAddition(address indexed _job, address indexed _liquidity, address indexed _provider, uint256 _amount);\n\n /// @notice Emitted when IKeep3rJobFundableLiquidity#withdrawLiquidityFromJob function is called\n /// @param _job The address of the job of which liquidity will be withdrawn from\n /// @param _liquidity The address of the liquidity being withdrawn\n /// @param _receiver The receiver of the liquidity tokens\n /// @param _amount The amount of liquidity being withdrawn from the job\n event LiquidityWithdrawal(address indexed _job, address indexed _liquidity, address indexed _receiver, uint256 _amount);\n\n /// @notice Emitted when Keep3rJobFundableLiquidity#addLiquidityToJob function is called\n /// @param _job The address of the job whose credits will be updated\n /// @param _rewardedAt The time at which the job was last rewarded\n /// @param _currentCredits The current credits of the job\n /// @param _periodCredits The credits of the job for the current period\n event LiquidityCreditsReward(address indexed _job, uint256 _rewardedAt, uint256 _currentCredits, uint256 _periodCredits);\n\n /// @notice Emitted when Keep3rJobFundableLiquidity#forceLiquidityCreditsToJob function is called\n /// @param _job The address of the job whose credits will be updated\n /// @param _rewardedAt The time at which the job was last rewarded\n /// @param _currentCredits The current credits of the job\n event LiquidityCreditsForced(address indexed _job, uint256 _rewardedAt, uint256 _currentCredits);\n\n // Errors\n\n /// @notice Throws when the liquidity being approved has already been approved\n error LiquidityPairApproved();\n\n /// @notice Throws when the liquidity being removed has not been approved\n error LiquidityPairUnexistent();\n\n /// @notice Throws when trying to add liquidity to an unapproved pool\n error LiquidityPairUnapproved();\n\n /// @notice Throws when the job doesn't have the requested liquidity\n error JobLiquidityUnexistent();\n\n /// @notice Throws when trying to remove more liquidity than the job has\n error JobLiquidityInsufficient();\n\n /// @notice Throws when trying to add less liquidity than the minimum liquidity required\n error JobLiquidityLessThanMin();\n\n // Structs\n\n /// @notice Stores the tick information of the different liquidity pairs\n struct TickCache {\n int56 current; // Tracks the current tick\n int56 difference; // Stores the difference between the current tick and the last tick\n uint256 period; // Stores the period at which the last observation was made\n }\n\n // Variables\n\n /// @notice Lists liquidity pairs\n /// @return _list An array of addresses with all the approved liquidity pairs\n function approvedLiquidities() external view returns (address[] memory _list);\n\n /// @notice Amount of liquidity in a specified job\n /// @param _job The address of the job being checked\n /// @param _liquidity The address of the liquidity we are checking\n /// @return _amount Amount of liquidity in the specified job\n function liquidityAmount(address _job, address _liquidity) external view returns (uint256 _amount);\n\n /// @notice Last time the job was rewarded liquidity credits\n /// @param _job The address of the job being checked\n /// @return _timestamp Timestamp of the last time the job was rewarded liquidity credits\n function rewardedAt(address _job) external view returns (uint256 _timestamp);\n\n /// @notice Last time the job was worked\n /// @param _job The address of the job being checked\n /// @return _timestamp Timestamp of the last time the job was worked\n function workedAt(address _job) external view returns (uint256 _timestamp);\n\n // Methods\n\n /// @notice Returns the liquidity credits of a given job\n /// @param _job The address of the job of which we want to know the liquidity credits\n /// @return _amount The liquidity credits of a given job\n function jobLiquidityCredits(address _job) external view returns (uint256 _amount);\n\n /// @notice Returns the credits of a given job for the current period\n /// @param _job The address of the job of which we want to know the period credits\n /// @return _amount The credits the given job has at the current period\n function jobPeriodCredits(address _job) external view returns (uint256 _amount);\n\n /// @notice Calculates the total credits of a given job\n /// @param _job The address of the job of which we want to know the total credits\n /// @return _amount The total credits of the given job\n function totalJobCredits(address _job) external view returns (uint256 _amount);\n\n /// @notice Calculates how many credits should be rewarded periodically for a given liquidity amount\n /// @dev _periodCredits = underlying KP3Rs for given liquidity amount * rewardPeriod / inflationPeriod\n /// @param _liquidity The address of the liquidity to provide\n /// @param _amount The amount of liquidity to provide\n /// @return _periodCredits The amount of KP3R periodically minted for the given liquidity\n function quoteLiquidity(address _liquidity, uint256 _amount) external view returns (uint256 _periodCredits);\n\n /// @notice Observes the current state of the liquidity pair being observed and updates TickCache with the information\n /// @param _liquidity The address of the liquidity pair being observed\n /// @return _tickCache The updated TickCache\n function observeLiquidity(address _liquidity) external view returns (TickCache memory _tickCache);\n\n /// @notice Gifts liquidity credits to the specified job\n /// @param _job The address of the job being credited\n /// @param _amount The amount of liquidity credits to gift\n function forceLiquidityCreditsToJob(address _job, uint256 _amount) external;\n\n /// @notice Approve a liquidity pair for being accepted in future\n /// @param _liquidity The address of the liquidity accepted\n function approveLiquidity(address _liquidity) external;\n\n /// @notice Revoke a liquidity pair from being accepted in future\n /// @param _liquidity The liquidity no longer accepted\n function revokeLiquidity(address _liquidity) external;\n\n /// @notice Allows anyone to fund a job with liquidity\n /// @param _job The address of the job to assign liquidity to\n /// @param _liquidity The liquidity being added\n /// @param _amount The amount of liquidity tokens to add\n function addLiquidityToJob(\n address _job,\n address _liquidity,\n uint256 _amount\n ) external;\n\n /// @notice Unbond liquidity for a job\n /// @dev Can only be called by the job's owner\n /// @param _job The address of the job being unbonded from\n /// @param _liquidity The liquidity being unbonded\n /// @param _amount The amount of liquidity being removed\n function unbondLiquidityFromJob(\n address _job,\n address _liquidity,\n uint256 _amount\n ) external;\n\n /// @notice Withdraw liquidity from a job\n /// @param _job The address of the job being withdrawn from\n /// @param _liquidity The liquidity being withdrawn\n /// @param _receiver The address that will receive the withdrawn liquidity\n function withdrawLiquidityFromJob(\n address _job,\n address _liquidity,\n address _receiver\n ) external;\n}\n\n/// @title Keep3rJobManager contract\n/// @notice Handles the addition and withdrawal of credits from a job\ninterface IKeep3rJobManager {\n // Events\n\n /// @notice Emitted when Keep3rJobManager#addJob is called\n /// @param _job The address of the job to add\n /// @param _jobOwner The job's owner\n event JobAddition(address indexed _job, address indexed _jobOwner);\n\n // Errors\n\n /// @notice Throws when trying to add a job that has already been added\n error JobAlreadyAdded();\n\n /// @notice Throws when the address that is trying to register as a keeper is already a keeper\n error AlreadyAKeeper();\n\n // Methods\n\n /// @notice Allows any caller to add a new job\n /// @param _job Address of the contract for which work should be performed\n function addJob(address _job) external;\n}\n\n/// @title Keep3rJobWorkable contract\n/// @notice Handles the mechanisms jobs can pay keepers with along with the restrictions jobs can put on keepers before they can work on jobs\ninterface IKeep3rJobWorkable {\n // Events\n\n /// @notice Emitted when a keeper is validated before a job\n /// @param _gasLeft The amount of gas that the transaction has left at the moment of keeper validation\n event KeeperValidation(uint256 _gasLeft);\n\n /// @notice Emitted when a keeper works a job\n /// @param _credit The address of the asset in which the keeper is paid\n /// @param _job The address of the job the keeper has worked\n /// @param _keeper The address of the keeper that has worked the job\n /// @param _payment The amount that has been paid out to the keeper in exchange for working the job\n /// @param _gasLeft The amount of gas that the transaction has left at the moment of payment\n event KeeperWork(address indexed _credit, address indexed _job, address indexed _keeper, uint256 _payment, uint256 _gasLeft);\n\n // Errors\n\n /// @notice Throws if the address claiming to be a job is not in the list of approved jobs\n error JobUnapproved();\n\n /// @notice Throws if the amount of funds in the job is less than the payment that must be paid to the keeper that works that job\n error InsufficientFunds();\n\n // Methods\n\n /// @notice Confirms if the current keeper is registered\n /// @dev Can be used for general (non critical) functions\n /// @param _keeper The keeper being investigated\n /// @return _isKeeper Whether the address passed as a parameter is a keeper or not\n function isKeeper(address _keeper) external returns (bool _isKeeper);\n\n /// @notice Confirms if the current keeper is registered and has a minimum bond of any asset.\n /// @dev Should be used for protected functions\n /// @param _keeper The keeper to check\n /// @param _bond The bond token being evaluated\n /// @param _minBond The minimum amount of bonded tokens\n /// @param _earned The minimum funds earned in the keepers lifetime\n /// @param _age The minimum keeper age required\n /// @return _isBondedKeeper Whether the `_keeper` meets the given requirements\n function isBondedKeeper(\n address _keeper,\n address _bond,\n uint256 _minBond,\n uint256 _earned,\n uint256 _age\n ) external returns (bool _isBondedKeeper);\n\n /// @notice Implemented by jobs to show that a keeper performed work\n /// @dev Automatically calculates the payment for the keeper and pays the keeper with bonded KP3R\n /// @param _keeper Address of the keeper that performed the work\n function worked(address _keeper) external;\n\n /// @notice Implemented by jobs to show that a keeper performed work\n /// @dev Pays the keeper that performs the work with KP3R\n /// @param _keeper Address of the keeper that performed the work\n /// @param _payment The reward that should be allocated for the job\n function bondedPayment(address _keeper, uint256 _payment) external;\n\n /// @notice Implemented by jobs to show that a keeper performed work\n /// @dev Pays the keeper that performs the work with a specific token\n /// @param _token The asset being awarded to the keeper\n /// @param _keeper Address of the keeper that performed the work\n /// @param _amount The reward that should be allocated\n function directTokenPayment(\n address _token,\n address _keeper,\n uint256 _amount\n ) external;\n}\n\n/// @title Keep3rJobOwnership contract\n/// @notice Handles the ownership of the jobs\ninterface IKeep3rJobOwnership {\n // Events\n\n /// @notice Emitted when Keep3rJobOwnership#changeJobOwnership is called\n /// @param _job The address of the job proposed to have a change of owner\n /// @param _owner The current owner of the job\n /// @param _pendingOwner The new address proposed to be the owner of the job\n event JobOwnershipChange(address indexed _job, address indexed _owner, address indexed _pendingOwner);\n\n /// @notice Emitted when Keep3rJobOwnership#JobOwnershipAssent is called\n /// @param _job The address of the job which the proposed owner will now own\n /// @param _previousOwner The previous owner of the job\n /// @param _newOwner The new owner of the job\n event JobOwnershipAssent(address indexed _job, address indexed _previousOwner, address indexed _newOwner);\n\n // Errors\n\n /// @notice Throws when the caller of the function is not the job owner\n error OnlyJobOwner();\n\n /// @notice Throws when the caller of the function is not the pending job owner\n error OnlyPendingJobOwner();\n\n // Variables\n\n /// @notice Maps the job to the owner of the job\n /// @param _job The address of the job\n /// @return _owner The address of the owner of the job\n function jobOwner(address _job) external view returns (address _owner);\n\n /// @notice Maps the job to its pending owner\n /// @param _job The address of the job\n /// @return _pendingOwner The address of the pending owner of the job\n function jobPendingOwner(address _job) external view returns (address _pendingOwner);\n\n // Methods\n\n /// @notice Proposes a new address to be the owner of the job\n /// @param _job The address of the job\n /// @param _newOwner The address of the proposed new owner\n function changeJobOwnership(address _job, address _newOwner) external;\n\n /// @notice The proposed address accepts to be the owner of the job\n /// @param _job The address of the job\n function acceptJobOwnership(address _job) external;\n}\n\n/// @title Keep3rJobMigration contract\n/// @notice Handles the migration process of jobs to different addresses\ninterface IKeep3rJobMigration {\n // Events\n\n /// @notice Emitted when Keep3rJobMigration#migrateJob function is called\n /// @param _fromJob The address of the job that requests to migrate\n /// @param _toJob The address at which the job requests to migrate\n event JobMigrationRequested(address indexed _fromJob, address _toJob);\n\n /// @notice Emitted when Keep3rJobMigration#acceptJobMigration function is called\n /// @param _fromJob The address of the job that requested to migrate\n /// @param _toJob The address at which the job had requested to migrate\n event JobMigrationSuccessful(address _fromJob, address indexed _toJob);\n\n // Errors\n\n /// @notice Throws when the address of the job that requests to migrate wants to migrate to its same address\n error JobMigrationImpossible();\n\n /// @notice Throws when the _toJob address differs from the address being tracked in the pendingJobMigrations mapping\n error JobMigrationUnavailable();\n\n /// @notice Throws when cooldown between migrations has not yet passed\n error JobMigrationLocked();\n\n // Variables\n\n /// @notice Maps the jobs that have requested a migration to the address they have requested to migrate to\n /// @return _toJob The address to which the job has requested to migrate to\n function pendingJobMigrations(address _fromJob) external view returns (address _toJob);\n\n // Methods\n\n /// @notice Initializes the migration process for a job by adding the request to the pendingJobMigrations mapping\n /// @param _fromJob The address of the job that is requesting to migrate\n /// @param _toJob The address at which the job is requesting to migrate\n function migrateJob(address _fromJob, address _toJob) external;\n\n /// @notice Completes the migration process for a job\n /// @dev Unbond/withdraw process doesn't get migrated\n /// @param _fromJob The address of the job that requested to migrate\n /// @param _toJob The address to which the job wants to migrate to\n function acceptJobMigration(address _fromJob, address _toJob) external;\n}\n\n/// @title Keep3rJobDisputable contract\n/// @notice Handles the actions that can be taken on a disputed job\ninterface IKeep3rJobDisputable is IKeep3rJobFundableCredits, IKeep3rJobFundableLiquidity {\n // Events\n\n /// @notice Emitted when Keep3rJobDisputable#slashTokenFromJob is called\n /// @param _job The address of the job from which the token will be slashed\n /// @param _token The address of the token being slashed\n /// @param _slasher The user that slashes the token\n /// @param _amount The amount of the token being slashed\n event JobSlashToken(address indexed _job, address _token, address indexed _slasher, uint256 _amount);\n\n /// @notice Emitted when Keep3rJobDisputable#slashLiquidityFromJob is called\n /// @param _job The address of the job from which the liquidity will be slashed\n /// @param _liquidity The address of the liquidity being slashed\n /// @param _slasher The user that slashes the liquidity\n /// @param _amount The amount of the liquidity being slashed\n event JobSlashLiquidity(address indexed _job, address _liquidity, address indexed _slasher, uint256 _amount);\n\n // Errors\n\n /// @notice Throws when the token trying to be slashed doesn't exist\n error JobTokenUnexistent();\n\n /// @notice Throws when someone tries to slash more tokens than the job has\n error JobTokenInsufficient();\n\n // Methods\n\n /// @notice Allows governance or slasher to slash a job specific token\n /// @param _job The address of the job from which the token will be slashed\n /// @param _token The address of the token that will be slashed\n /// @param _amount The amount of the token that will be slashed\n function slashTokenFromJob(\n address _job,\n address _token,\n uint256 _amount\n ) external;\n\n /// @notice Allows governance or a slasher to slash liquidity from a job\n /// @param _job The address being slashed\n /// @param _liquidity The address of the liquidity that will be slashed\n /// @param _amount The amount of liquidity that will be slashed\n function slashLiquidityFromJob(\n address _job,\n address _liquidity,\n uint256 _amount\n ) external;\n}\n\n// solhint-disable-next-line no-empty-blocks\ninterface IKeep3rJobs is IKeep3rJobOwnership, IKeep3rJobDisputable, IKeep3rJobMigration, IKeep3rJobManager, IKeep3rJobWorkable {\n\n}\n" - }, - "@openzeppelin/contracts/security/ReentrancyGuard.sol": { - "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Contract module that helps prevent reentrant calls to a function.\n *\n * Inheriting from `ReentrancyGuard` will make the {nonReentrant} modifier\n * available, which can be applied to functions to make sure there are no nested\n * (reentrant) calls to them.\n *\n * Note that because there is a single `nonReentrant` guard, functions marked as\n * `nonReentrant` may not call one another. This can be worked around by making\n * those functions `private`, and then adding `external` `nonReentrant` entry\n * points to them.\n *\n * TIP: If you would like to learn more about reentrancy and alternative ways\n * to protect against it, check out our blog post\n * https://blog.openzeppelin.com/reentrancy-after-istanbul/[Reentrancy After Istanbul].\n */\nabstract contract ReentrancyGuard {\n // Booleans are more expensive than uint256 or any type that takes up a full\n // word because each write operation emits an extra SLOAD to first read the\n // slot's contents, replace the bits taken up by the boolean, and then write\n // back. This is the compiler's defense against contract upgrades and\n // pointer aliasing, and it cannot be disabled.\n\n // The values being non-zero value makes deployment a bit more expensive,\n // but in exchange the refund on every call to nonReentrant will be lower in\n // amount. Since refunds are capped to a percentage of the total\n // transaction's gas, it is best to keep them low in cases like this one, to\n // increase the likelihood of the full refund coming into effect.\n uint256 private constant _NOT_ENTERED = 1;\n uint256 private constant _ENTERED = 2;\n\n uint256 private _status;\n\n constructor() {\n _status = _NOT_ENTERED;\n }\n\n /**\n * @dev Prevents a contract from calling itself, directly or indirectly.\n * Calling a `nonReentrant` function from another `nonReentrant`\n * function is not supported. It is possible to prevent this from happening\n * by making the `nonReentrant` function external, and make it call a\n * `private` function that does the actual work.\n */\n modifier nonReentrant() {\n // On the first call to nonReentrant, _notEntered will be true\n require(_status != _ENTERED, \"ReentrancyGuard: reentrant call\");\n\n // Any calls to nonReentrant after this point will fail\n _status = _ENTERED;\n\n _;\n\n // By storing the original value once again, a refund is triggered (see\n // https://eips.ethereum.org/EIPS/eip-2200)\n _status = _NOT_ENTERED;\n }\n}\n" - }, - "@openzeppelin/contracts/token/ERC20/IERC20.sol": { - "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Interface of the ERC20 standard as defined in the EIP.\n */\ninterface IERC20 {\n /**\n * @dev Returns the amount of tokens in existence.\n */\n function totalSupply() external view returns (uint256);\n\n /**\n * @dev Returns the amount of tokens owned by `account`.\n */\n function balanceOf(address account) external view returns (uint256);\n\n /**\n * @dev Moves `amount` tokens from the caller's account to `recipient`.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * Emits a {Transfer} event.\n */\n function transfer(address recipient, uint256 amount) external returns (bool);\n\n /**\n * @dev Returns the remaining number of tokens that `spender` will be\n * allowed to spend on behalf of `owner` through {transferFrom}. This is\n * zero by default.\n *\n * This value changes when {approve} or {transferFrom} are called.\n */\n function allowance(address owner, address spender) external view returns (uint256);\n\n /**\n * @dev Sets `amount` as the allowance of `spender` over the caller's tokens.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * IMPORTANT: Beware that changing an allowance with this method brings the risk\n * that someone may use both the old and the new allowance by unfortunate\n * transaction ordering. One possible solution to mitigate this race\n * condition is to first reduce the spender's allowance to 0 and set the\n * desired value afterwards:\n * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729\n *\n * Emits an {Approval} event.\n */\n function approve(address spender, uint256 amount) external returns (bool);\n\n /**\n * @dev Moves `amount` tokens from `sender` to `recipient` using the\n * allowance mechanism. `amount` is then deducted from the caller's\n * allowance.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * Emits a {Transfer} event.\n */\n function transferFrom(\n address sender,\n address recipient,\n uint256 amount\n ) external returns (bool);\n\n /**\n * @dev Emitted when `value` tokens are moved from one account (`from`) to\n * another (`to`).\n *\n * Note that `value` may be zero.\n */\n event Transfer(address indexed from, address indexed to, uint256 value);\n\n /**\n * @dev Emitted when the allowance of a `spender` for an `owner` is set by\n * a call to {approve}. `value` is the new allowance.\n */\n event Approval(address indexed owner, address indexed spender, uint256 value);\n}\n" - }, - "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol": { - "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\nimport \"../IERC20.sol\";\nimport \"../../../utils/Address.sol\";\n\n/**\n * @title SafeERC20\n * @dev Wrappers around ERC20 operations that throw on failure (when the token\n * contract returns false). Tokens that return no value (and instead revert or\n * throw on failure) are also supported, non-reverting calls are assumed to be\n * successful.\n * To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract,\n * which allows you to call the safe operations as `token.safeTransfer(...)`, etc.\n */\nlibrary SafeERC20 {\n using Address for address;\n\n function safeTransfer(\n IERC20 token,\n address to,\n uint256 value\n ) internal {\n _callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value));\n }\n\n function safeTransferFrom(\n IERC20 token,\n address from,\n address to,\n uint256 value\n ) internal {\n _callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value));\n }\n\n /**\n * @dev Deprecated. This function has issues similar to the ones found in\n * {IERC20-approve}, and its usage is discouraged.\n *\n * Whenever possible, use {safeIncreaseAllowance} and\n * {safeDecreaseAllowance} instead.\n */\n function safeApprove(\n IERC20 token,\n address spender,\n uint256 value\n ) internal {\n // safeApprove should only be called when setting an initial allowance,\n // or when resetting it to zero. To increase and decrease it, use\n // 'safeIncreaseAllowance' and 'safeDecreaseAllowance'\n require(\n (value == 0) || (token.allowance(address(this), spender) == 0),\n \"SafeERC20: approve from non-zero to non-zero allowance\"\n );\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value));\n }\n\n function safeIncreaseAllowance(\n IERC20 token,\n address spender,\n uint256 value\n ) internal {\n uint256 newAllowance = token.allowance(address(this), spender) + value;\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));\n }\n\n function safeDecreaseAllowance(\n IERC20 token,\n address spender,\n uint256 value\n ) internal {\n unchecked {\n uint256 oldAllowance = token.allowance(address(this), spender);\n require(oldAllowance >= value, \"SafeERC20: decreased allowance below zero\");\n uint256 newAllowance = oldAllowance - value;\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));\n }\n }\n\n /**\n * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement\n * on the return value: the return value is optional (but if data is returned, it must not be false).\n * @param token The token targeted by the call.\n * @param data The call data (encoded using abi.encode or one of its variants).\n */\n function _callOptionalReturn(IERC20 token, bytes memory data) private {\n // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since\n // we're implementing it ourselves. We use {Address.functionCall} to perform this call, which verifies that\n // the target address contains contract code and also asserts for success in the low-level call.\n\n bytes memory returndata = address(token).functionCall(data, \"SafeERC20: low-level call failed\");\n if (returndata.length > 0) {\n // Return data is optional\n require(abi.decode(returndata, (bool)), \"SafeERC20: ERC20 operation did not succeed\");\n }\n }\n}\n" - }, - "@openzeppelin/contracts/utils/math/Math.sol": { - "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Standard math utilities missing in the Solidity language.\n */\nlibrary Math {\n /**\n * @dev Returns the largest of two numbers.\n */\n function max(uint256 a, uint256 b) internal pure returns (uint256) {\n return a >= b ? a : b;\n }\n\n /**\n * @dev Returns the smallest of two numbers.\n */\n function min(uint256 a, uint256 b) internal pure returns (uint256) {\n return a < b ? a : b;\n }\n\n /**\n * @dev Returns the average of two numbers. The result is rounded towards\n * zero.\n */\n function average(uint256 a, uint256 b) internal pure returns (uint256) {\n // (a + b) / 2 can overflow.\n return (a & b) + (a ^ b) / 2;\n }\n\n /**\n * @dev Returns the ceiling of the division of two numbers.\n *\n * This differs from standard division with `/` in that it rounds up instead\n * of rounding down.\n */\n function ceilDiv(uint256 a, uint256 b) internal pure returns (uint256) {\n // (a + b - 1) / b can overflow on addition, so we distribute.\n return a / b + (a % b == 0 ? 0 : 1);\n }\n}\n" - }, - "@openzeppelin/contracts/utils/structs/EnumerableSet.sol": { - "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Library for managing\n * https://en.wikipedia.org/wiki/Set_(abstract_data_type)[sets] of primitive\n * types.\n *\n * Sets have the following properties:\n *\n * - Elements are added, removed, and checked for existence in constant time\n * (O(1)).\n * - Elements are enumerated in O(n). No guarantees are made on the ordering.\n *\n * ```\n * contract Example {\n * // Add the library methods\n * using EnumerableSet for EnumerableSet.AddressSet;\n *\n * // Declare a set state variable\n * EnumerableSet.AddressSet private mySet;\n * }\n * ```\n *\n * As of v3.3.0, sets of type `bytes32` (`Bytes32Set`), `address` (`AddressSet`)\n * and `uint256` (`UintSet`) are supported.\n */\nlibrary EnumerableSet {\n // To implement this library for multiple types with as little code\n // repetition as possible, we write it in terms of a generic Set type with\n // bytes32 values.\n // The Set implementation uses private functions, and user-facing\n // implementations (such as AddressSet) are just wrappers around the\n // underlying Set.\n // This means that we can only create new EnumerableSets for types that fit\n // in bytes32.\n\n struct Set {\n // Storage of set values\n bytes32[] _values;\n // Position of the value in the `values` array, plus 1 because index 0\n // means a value is not in the set.\n mapping(bytes32 => uint256) _indexes;\n }\n\n /**\n * @dev Add a value to a set. O(1).\n *\n * Returns true if the value was added to the set, that is if it was not\n * already present.\n */\n function _add(Set storage set, bytes32 value) private returns (bool) {\n if (!_contains(set, value)) {\n set._values.push(value);\n // The value is stored at length-1, but we add 1 to all indexes\n // and use 0 as a sentinel value\n set._indexes[value] = set._values.length;\n return true;\n } else {\n return false;\n }\n }\n\n /**\n * @dev Removes a value from a set. O(1).\n *\n * Returns true if the value was removed from the set, that is if it was\n * present.\n */\n function _remove(Set storage set, bytes32 value) private returns (bool) {\n // We read and store the value's index to prevent multiple reads from the same storage slot\n uint256 valueIndex = set._indexes[value];\n\n if (valueIndex != 0) {\n // Equivalent to contains(set, value)\n // To delete an element from the _values array in O(1), we swap the element to delete with the last one in\n // the array, and then remove the last element (sometimes called as 'swap and pop').\n // This modifies the order of the array, as noted in {at}.\n\n uint256 toDeleteIndex = valueIndex - 1;\n uint256 lastIndex = set._values.length - 1;\n\n if (lastIndex != toDeleteIndex) {\n bytes32 lastvalue = set._values[lastIndex];\n\n // Move the last value to the index where the value to delete is\n set._values[toDeleteIndex] = lastvalue;\n // Update the index for the moved value\n set._indexes[lastvalue] = valueIndex; // Replace lastvalue's index to valueIndex\n }\n\n // Delete the slot where the moved value was stored\n set._values.pop();\n\n // Delete the index for the deleted slot\n delete set._indexes[value];\n\n return true;\n } else {\n return false;\n }\n }\n\n /**\n * @dev Returns true if the value is in the set. O(1).\n */\n function _contains(Set storage set, bytes32 value) private view returns (bool) {\n return set._indexes[value] != 0;\n }\n\n /**\n * @dev Returns the number of values on the set. O(1).\n */\n function _length(Set storage set) private view returns (uint256) {\n return set._values.length;\n }\n\n /**\n * @dev Returns the value stored at position `index` in the set. O(1).\n *\n * Note that there are no guarantees on the ordering of values inside the\n * array, and it may change when more values are added or removed.\n *\n * Requirements:\n *\n * - `index` must be strictly less than {length}.\n */\n function _at(Set storage set, uint256 index) private view returns (bytes32) {\n return set._values[index];\n }\n\n /**\n * @dev Return the entire set in an array\n *\n * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed\n * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that\n * this function has an unbounded cost, and using it as part of a state-changing function may render the function\n * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.\n */\n function _values(Set storage set) private view returns (bytes32[] memory) {\n return set._values;\n }\n\n // Bytes32Set\n\n struct Bytes32Set {\n Set _inner;\n }\n\n /**\n * @dev Add a value to a set. O(1).\n *\n * Returns true if the value was added to the set, that is if it was not\n * already present.\n */\n function add(Bytes32Set storage set, bytes32 value) internal returns (bool) {\n return _add(set._inner, value);\n }\n\n /**\n * @dev Removes a value from a set. O(1).\n *\n * Returns true if the value was removed from the set, that is if it was\n * present.\n */\n function remove(Bytes32Set storage set, bytes32 value) internal returns (bool) {\n return _remove(set._inner, value);\n }\n\n /**\n * @dev Returns true if the value is in the set. O(1).\n */\n function contains(Bytes32Set storage set, bytes32 value) internal view returns (bool) {\n return _contains(set._inner, value);\n }\n\n /**\n * @dev Returns the number of values in the set. O(1).\n */\n function length(Bytes32Set storage set) internal view returns (uint256) {\n return _length(set._inner);\n }\n\n /**\n * @dev Returns the value stored at position `index` in the set. O(1).\n *\n * Note that there are no guarantees on the ordering of values inside the\n * array, and it may change when more values are added or removed.\n *\n * Requirements:\n *\n * - `index` must be strictly less than {length}.\n */\n function at(Bytes32Set storage set, uint256 index) internal view returns (bytes32) {\n return _at(set._inner, index);\n }\n\n /**\n * @dev Return the entire set in an array\n *\n * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed\n * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that\n * this function has an unbounded cost, and using it as part of a state-changing function may render the function\n * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.\n */\n function values(Bytes32Set storage set) internal view returns (bytes32[] memory) {\n return _values(set._inner);\n }\n\n // AddressSet\n\n struct AddressSet {\n Set _inner;\n }\n\n /**\n * @dev Add a value to a set. O(1).\n *\n * Returns true if the value was added to the set, that is if it was not\n * already present.\n */\n function add(AddressSet storage set, address value) internal returns (bool) {\n return _add(set._inner, bytes32(uint256(uint160(value))));\n }\n\n /**\n * @dev Removes a value from a set. O(1).\n *\n * Returns true if the value was removed from the set, that is if it was\n * present.\n */\n function remove(AddressSet storage set, address value) internal returns (bool) {\n return _remove(set._inner, bytes32(uint256(uint160(value))));\n }\n\n /**\n * @dev Returns true if the value is in the set. O(1).\n */\n function contains(AddressSet storage set, address value) internal view returns (bool) {\n return _contains(set._inner, bytes32(uint256(uint160(value))));\n }\n\n /**\n * @dev Returns the number of values in the set. O(1).\n */\n function length(AddressSet storage set) internal view returns (uint256) {\n return _length(set._inner);\n }\n\n /**\n * @dev Returns the value stored at position `index` in the set. O(1).\n *\n * Note that there are no guarantees on the ordering of values inside the\n * array, and it may change when more values are added or removed.\n *\n * Requirements:\n *\n * - `index` must be strictly less than {length}.\n */\n function at(AddressSet storage set, uint256 index) internal view returns (address) {\n return address(uint160(uint256(_at(set._inner, index))));\n }\n\n /**\n * @dev Return the entire set in an array\n *\n * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed\n * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that\n * this function has an unbounded cost, and using it as part of a state-changing function may render the function\n * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.\n */\n function values(AddressSet storage set) internal view returns (address[] memory) {\n bytes32[] memory store = _values(set._inner);\n address[] memory result;\n\n assembly {\n result := store\n }\n\n return result;\n }\n\n // UintSet\n\n struct UintSet {\n Set _inner;\n }\n\n /**\n * @dev Add a value to a set. O(1).\n *\n * Returns true if the value was added to the set, that is if it was not\n * already present.\n */\n function add(UintSet storage set, uint256 value) internal returns (bool) {\n return _add(set._inner, bytes32(value));\n }\n\n /**\n * @dev Removes a value from a set. O(1).\n *\n * Returns true if the value was removed from the set, that is if it was\n * present.\n */\n function remove(UintSet storage set, uint256 value) internal returns (bool) {\n return _remove(set._inner, bytes32(value));\n }\n\n /**\n * @dev Returns true if the value is in the set. O(1).\n */\n function contains(UintSet storage set, uint256 value) internal view returns (bool) {\n return _contains(set._inner, bytes32(value));\n }\n\n /**\n * @dev Returns the number of values on the set. O(1).\n */\n function length(UintSet storage set) internal view returns (uint256) {\n return _length(set._inner);\n }\n\n /**\n * @dev Returns the value stored at position `index` in the set. O(1).\n *\n * Note that there are no guarantees on the ordering of values inside the\n * array, and it may change when more values are added or removed.\n *\n * Requirements:\n *\n * - `index` must be strictly less than {length}.\n */\n function at(UintSet storage set, uint256 index) internal view returns (uint256) {\n return uint256(_at(set._inner, index));\n }\n\n /**\n * @dev Return the entire set in an array\n *\n * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed\n * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that\n * this function has an unbounded cost, and using it as part of a state-changing function may render the function\n * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.\n */\n function values(UintSet storage set) internal view returns (uint256[] memory) {\n bytes32[] memory store = _values(set._inner);\n uint256[] memory result;\n\n assembly {\n result := store\n }\n\n return result;\n }\n}\n" - }, - "solidity/interfaces/peripherals/IKeep3rAccountance.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\n/// @title Keep3rDisputable contract\n/// @notice Disputes keepers, or if they're already disputed, it can resolve the case\n/// @dev Argument `bonding` can be the address of either a token or a liquidity\ninterface IKeep3rAccountance {\n // Events\n\n /// @notice Emitted when the bonding process of a new keeper begins\n /// @param _keeper The caller of Keep3rKeeperFundable#bond function\n /// @param _bonding The asset the keeper has bonded\n /// @param _amount The amount the keeper has bonded\n event Bonding(address indexed _keeper, address indexed _bonding, uint256 _amount);\n\n /// @notice Emitted when a keeper or job begins the unbonding process to withdraw the funds\n /// @param _keeperOrJob The keeper or job that began the unbonding process\n /// @param _unbonding The liquidity pair or asset being unbonded\n /// @param _amount The amount being unbonded\n event Unbonding(address indexed _keeperOrJob, address indexed _unbonding, uint256 _amount);\n\n // Variables\n\n /// @notice Tracks the total KP3R earnings of a keeper since it started working\n /// @param _keeper The address of the keeper\n /// @return _workCompleted Total KP3R earnings of a keeper since it started working\n function workCompleted(address _keeper) external view returns (uint256 _workCompleted);\n\n /// @notice Tracks when a keeper was first registered\n /// @param _keeper The address of the keeper\n /// @return timestamp The time at which the keeper was first registered\n function firstSeen(address _keeper) external view returns (uint256 timestamp);\n\n /// @notice Tracks if a keeper or job has a pending dispute\n /// @param _keeperOrJob The address of the keeper or job\n /// @return _disputed Whether a keeper or job has a pending dispute\n function disputes(address _keeperOrJob) external view returns (bool _disputed);\n\n /// @notice Tracks how much a keeper has bonded of a certain token\n /// @param _keeper The address of the keeper\n /// @param _bond The address of the token being bonded\n /// @return _bonds Amount of a certain token that a keeper has bonded\n function bonds(address _keeper, address _bond) external view returns (uint256 _bonds);\n\n /// @notice The current token credits available for a job\n /// @param _job The address of the job\n /// @param _token The address of the token bonded\n /// @return _amount The amount of token credits available for a job\n function jobTokenCredits(address _job, address _token) external view returns (uint256 _amount);\n\n /// @notice Tracks the amount of assets deposited in pending bonds\n /// @param _keeper The address of the keeper\n /// @param _bonding The address of the token being bonded\n /// @return _pendingBonds Amount of a certain asset a keeper has unbonding\n function pendingBonds(address _keeper, address _bonding) external view returns (uint256 _pendingBonds);\n\n /// @notice Tracks when a bonding for a keeper can be activated\n /// @param _keeper The address of the keeper\n /// @param _bonding The address of the token being bonded\n /// @return _timestamp Time at which the bonding for a keeper can be activated\n function canActivateAfter(address _keeper, address _bonding) external view returns (uint256 _timestamp);\n\n /// @notice Tracks when keeper bonds are ready to be withdrawn\n /// @param _keeper The address of the keeper\n /// @param _bonding The address of the token being unbonded\n /// @return _timestamp Time at which the keeper bonds are ready to be withdrawn\n function canWithdrawAfter(address _keeper, address _bonding) external view returns (uint256 _timestamp);\n\n /// @notice Tracks how much keeper bonds are to be withdrawn\n /// @param _keeper The address of the keeper\n /// @param _bonding The address of the token being unbonded\n /// @return _pendingUnbonds The amount of keeper bonds that are to be withdrawn\n function pendingUnbonds(address _keeper, address _bonding) external view returns (uint256 _pendingUnbonds);\n\n /// @notice Checks whether the address has ever bonded an asset\n /// @param _keeper The address of the keeper\n /// @return _hasBonded Whether the address has ever bonded an asset\n function hasBonded(address _keeper) external view returns (bool _hasBonded);\n\n // Methods\n\n /// @notice Lists all jobs\n /// @return _jobList Array with all the jobs in _jobs\n function jobs() external view returns (address[] memory _jobList);\n\n /// @notice Lists all keepers\n /// @return _keeperList Array with all the keepers in _keepers\n function keepers() external view returns (address[] memory _keeperList);\n\n // Errors\n\n /// @notice Throws when an address is passed as a job, but that address is not a job\n error JobUnavailable();\n\n /// @notice Throws when an action that requires an undisputed job is applied on a disputed job\n error JobDisputed();\n}\n" - }, - "solidity/interfaces/IKeep3rHelper.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\n/// @title Keep3rHelper contract\n/// @notice Contains all the helper functions used throughout the different files.\n\ninterface IKeep3rHelper {\n // Errors\n\n /// @notice Throws when none of the tokens in the liquidity pair is KP3R\n error LiquidityPairInvalid();\n\n // Methods\n // solhint-enable func-name-mixedcase\n\n /// @notice Calculates the amount of KP3R that corresponds to the ETH passed into the function\n /// @dev This function allows us to calculate how much KP3R we should pay to a keeper for things expressed in ETH, like gas\n /// @param _eth The amount of ETH\n /// @return _amountOut The amount of KP3R\n function quote(uint256 _eth) external view returns (uint256 _amountOut);\n\n /// @notice Returns the amount of KP3R the keeper has bonded\n /// @param _keeper The address of the keeper to check\n /// @return _amountBonded The amount of KP3R the keeper has bonded\n function bonds(address _keeper) external view returns (uint256 _amountBonded);\n\n /// @notice Calculates the reward (in KP3R) that corresponds to a keeper for using gas\n /// @param _keeper The address of the keeper to check\n /// @param _gasUsed The amount of gas used that will be rewarded\n /// @return _kp3r The amount of KP3R that should be awarded to the keeper\n function getRewardAmountFor(address _keeper, uint256 _gasUsed) external view returns (uint256 _kp3r);\n\n /// @notice Calculates the boost in the reward given to a keeper based on the amount of KP3R that keeper has bonded\n /// @param _bonds The amount of KP3R tokens bonded by the keeper\n /// @return _rewardBoost The reward boost that corresponds to the keeper\n function getRewardBoostFor(uint256 _bonds) external view returns (uint256 _rewardBoost);\n\n /// @notice Calculates the reward (in KP3R) that corresponds to tx.origin for using gas\n /// @param _gasUsed The amount of gas used that will be rewarded\n /// @return _amount The amount of KP3R that should be awarded to tx.origin\n function getRewardAmount(uint256 _gasUsed) external view returns (uint256 _amount);\n\n /// @notice Given a pool address, returns the underlying tokens of the pair\n /// @param _pool Address of the correspondant pool\n /// @return _token0 Address of the first token of the pair\n /// @return _token1 Address of the second token of the pair\n function getPoolTokens(address _pool) external view returns (address _token0, address _token1);\n\n /// @notice Defines the order of the tokens in the pair for twap calculations\n /// @param _pool Address of the correspondant pool\n /// @return _isKP3RToken0 Boolean indicating the order of the tokens in the pair\n function isKP3RToken0(address _pool) external view returns (bool _isKP3RToken0);\n\n /// @notice Given an array of secondsAgo, returns UniswapV3 pool cumulatives at that moment\n /// @param _pool Address of the pool to observe\n /// @param _secondsAgo Array with time references to observe\n /// @return _tickCumulative1 Cummulative sum of ticks until first time reference\n /// @return _tickCumulative2 Cummulative sum of ticks until second time reference\n /// @return _success Boolean indicating if the observe call was succesfull\n function observe(address _pool, uint32[] memory _secondsAgo)\n external\n view\n returns (\n int56 _tickCumulative1,\n int56 _tickCumulative2,\n bool _success\n );\n\n /// @notice Get multiplier, quote, and extra, in order to calculate keeper payment\n /// @param _bonds Amount of bonded KP3R owned by the keeper\n /// @return _boost Multiplier per gas unit. Takes into account the base fee and the amount of bonded KP3R\n /// @return _oneEthQuote Amount of KP3R tokens equivalent to 1 ETH\n /// @return _extra Amount of extra gas that should be added to the gas spent\n function getPaymentParams(uint256 _bonds)\n external\n view\n returns (\n uint256 _boost,\n uint256 _oneEthQuote,\n uint256 _extra\n );\n\n /// @notice Given a tick and a liquidity amount, calculates the underlying KP3R tokens\n /// @param _liquidityAmount Amount of liquidity to be converted\n /// @param _tickDifference Tick value used to calculate the quote\n /// @param _timeInterval Time value used to calculate the quote\n /// @return _kp3rAmount Amount of KP3R tokens underlying on the given liquidity\n function getKP3RsAtTick(\n uint256 _liquidityAmount,\n int56 _tickDifference,\n uint256 _timeInterval\n ) external pure returns (uint256 _kp3rAmount);\n\n /// @notice Given a tick and a token amount, calculates the output in correspondant token\n /// @param _baseAmount Amount of token to be converted\n /// @param _tickDifference Tick value used to calculate the quote\n /// @param _timeInterval Time value used to calculate the quote\n /// @return _quoteAmount Amount of credits deserved for the baseAmount at the tick value\n function getQuoteAtTick(\n uint128 _baseAmount,\n int56 _tickDifference,\n uint256 _timeInterval\n ) external pure returns (uint256 _quoteAmount);\n}\n" - }, - "solidity/interfaces/peripherals/IKeep3rParameters.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport './IBaseErrors.sol';\n\n/// @title Keep3rParameters contract\n/// @notice Handles and sets all the required parameters for Keep3r\n\ninterface IKeep3rParameters is IBaseErrors {\n // Events\n\n /// @notice Emitted when the Keep3rHelper address is changed\n /// @param _keep3rHelper The address of Keep3rHelper's contract\n event Keep3rHelperChange(address _keep3rHelper);\n\n /// @notice Emitted when the Keep3rV1 address is changed\n /// @param _keep3rV1 The address of Keep3rV1's contract\n event Keep3rV1Change(address _keep3rV1);\n\n /// @notice Emitted when the Keep3rV1Proxy address is changed\n /// @param _keep3rV1Proxy The address of Keep3rV1Proxy's contract\n event Keep3rV1ProxyChange(address _keep3rV1Proxy);\n\n /// @notice Emitted when the KP3R-WETH pool address is changed\n /// @param _kp3rWethPool The address of the KP3R-WETH pool\n event Kp3rWethPoolChange(address _kp3rWethPool);\n\n /// @notice Emitted when bondTime is changed\n /// @param _bondTime The new bondTime\n event BondTimeChange(uint256 _bondTime);\n\n /// @notice Emitted when _liquidityMinimum is changed\n /// @param _liquidityMinimum The new _liquidityMinimum\n event LiquidityMinimumChange(uint256 _liquidityMinimum);\n\n /// @notice Emitted when _unbondTime is changed\n /// @param _unbondTime The new _unbondTime\n event UnbondTimeChange(uint256 _unbondTime);\n\n /// @notice Emitted when _rewardPeriodTime is changed\n /// @param _rewardPeriodTime The new _rewardPeriodTime\n event RewardPeriodTimeChange(uint256 _rewardPeriodTime);\n\n /// @notice Emitted when the inflationPeriod is changed\n /// @param _inflationPeriod The new inflationPeriod\n event InflationPeriodChange(uint256 _inflationPeriod);\n\n /// @notice Emitted when the fee is changed\n /// @param _fee The new token credits fee\n event FeeChange(uint256 _fee);\n\n // Variables\n\n /// @notice Address of Keep3rHelper's contract\n /// @return _keep3rHelper The address of Keep3rHelper's contract\n function keep3rHelper() external view returns (address _keep3rHelper);\n\n /// @notice Address of Keep3rV1's contract\n /// @return _keep3rV1 The address of Keep3rV1's contract\n function keep3rV1() external view returns (address _keep3rV1);\n\n /// @notice Address of Keep3rV1Proxy's contract\n /// @return _keep3rV1Proxy The address of Keep3rV1Proxy's contract\n function keep3rV1Proxy() external view returns (address _keep3rV1Proxy);\n\n /// @notice Address of the KP3R-WETH pool\n /// @return _kp3rWethPool The address of KP3R-WETH pool\n function kp3rWethPool() external view returns (address _kp3rWethPool);\n\n /// @notice The amount of time required to pass after a keeper has bonded assets for it to be able to activate\n /// @return _days The required bondTime in days\n function bondTime() external view returns (uint256 _days);\n\n /// @notice The amount of time required to pass before a keeper can unbond what he has bonded\n /// @return _days The required unbondTime in days\n function unbondTime() external view returns (uint256 _days);\n\n /// @notice The minimum amount of liquidity required to fund a job per liquidity\n /// @return _amount The minimum amount of liquidity in KP3R\n function liquidityMinimum() external view returns (uint256 _amount);\n\n /// @notice The amount of time between each scheduled credits reward given to a job\n /// @return _days The reward period in days\n function rewardPeriodTime() external view returns (uint256 _days);\n\n /// @notice The inflation period is the denominator used to regulate the emission of KP3R\n /// @return _period The denominator used to regulate the emission of KP3R\n function inflationPeriod() external view returns (uint256 _period);\n\n /// @notice The fee to be sent to governance when a user adds liquidity to a job\n /// @return _amount The fee amount to be sent to governance when a user adds liquidity to a job\n function fee() external view returns (uint256 _amount);\n\n // Errors\n\n /// @notice Throws if the reward period is less than the minimum reward period time\n error MinRewardPeriod();\n\n /// @notice Throws if either a job or a keeper is disputed\n error Disputed();\n\n /// @notice Throws if there are no bonded assets\n error BondsUnexistent();\n\n /// @notice Throws if the time required to bond an asset has not passed yet\n error BondsLocked();\n\n /// @notice Throws if there are no bonds to withdraw\n error UnbondsUnexistent();\n\n /// @notice Throws if the time required to withdraw the bonds has not passed yet\n error UnbondsLocked();\n\n // Methods\n\n /// @notice Sets the Keep3rHelper address\n /// @param _keep3rHelper The Keep3rHelper address\n function setKeep3rHelper(address _keep3rHelper) external;\n\n /// @notice Sets the Keep3rV1 address\n /// @param _keep3rV1 The Keep3rV1 address\n function setKeep3rV1(address _keep3rV1) external;\n\n /// @notice Sets the Keep3rV1Proxy address\n /// @param _keep3rV1Proxy The Keep3rV1Proxy address\n function setKeep3rV1Proxy(address _keep3rV1Proxy) external;\n\n /// @notice Sets the KP3R-WETH pool address\n /// @param _kp3rWethPool The KP3R-WETH pool address\n function setKp3rWethPool(address _kp3rWethPool) external;\n\n /// @notice Sets the bond time required to activate as a keeper\n /// @param _bond The new bond time\n function setBondTime(uint256 _bond) external;\n\n /// @notice Sets the unbond time required unbond what has been bonded\n /// @param _unbond The new unbond time\n function setUnbondTime(uint256 _unbond) external;\n\n /// @notice Sets the minimum amount of liquidity required to fund a job\n /// @param _liquidityMinimum The new minimum amount of liquidity\n function setLiquidityMinimum(uint256 _liquidityMinimum) external;\n\n /// @notice Sets the time required to pass between rewards for jobs\n /// @param _rewardPeriodTime The new amount of time required to pass between rewards\n function setRewardPeriodTime(uint256 _rewardPeriodTime) external;\n\n /// @notice Sets the new inflation period\n /// @param _inflationPeriod The new inflation period\n function setInflationPeriod(uint256 _inflationPeriod) external;\n\n /// @notice Sets the new fee\n /// @param _fee The new fee\n function setFee(uint256 _fee) external;\n}\n" - }, - "solidity/interfaces/peripherals/IBaseErrors.sol": { - "content": "// SPDX-License-Identifier: MIT\n\npragma solidity >=0.8.4 <0.9.0;\n\ninterface IBaseErrors {\n /// @notice Throws if a variable is assigned to the zero address\n error ZeroAddress();\n}\n" - }, - "solidity/interfaces/peripherals/IKeep3rRoles.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\n/// @title Keep3rRoles contract\n/// @notice Manages the Keep3r specific roles\ninterface IKeep3rRoles {\n // Events\n\n /// @notice Emitted when a slasher is added\n /// @param _slasher Address of the added slasher\n event SlasherAdded(address _slasher);\n\n /// @notice Emitted when a slasher is removed\n /// @param _slasher Address of the removed slasher\n event SlasherRemoved(address _slasher);\n\n /// @notice Emitted when a disputer is added\n /// @param _disputer Address of the added disputer\n event DisputerAdded(address _disputer);\n\n /// @notice Emitted when a disputer is removed\n /// @param _disputer Address of the removed disputer\n event DisputerRemoved(address _disputer);\n\n // Variables\n\n /// @notice Tracks whether the address is a slasher or not\n /// @param _slasher Address being checked as a slasher\n /// @return _isSlasher Whether the address is a slasher or not\n function slashers(address _slasher) external view returns (bool _isSlasher);\n\n /// @notice Tracks whether the address is a disputer or not\n /// @param _disputer Address being checked as a disputer\n /// @return _isDisputer Whether the address is a disputer or not\n function disputers(address _disputer) external view returns (bool _isDisputer);\n\n // Errors\n\n /// @notice Throws if the address is already a registered slasher\n error SlasherExistent();\n\n /// @notice Throws if caller is not a registered slasher\n error SlasherUnexistent();\n\n /// @notice Throws if the address is already a registered disputer\n error DisputerExistent();\n\n /// @notice Throws if caller is not a registered disputer\n error DisputerUnexistent();\n\n /// @notice Throws if the msg.sender is not a slasher or is not a part of governance\n error OnlySlasher();\n\n /// @notice Throws if the msg.sender is not a disputer or is not a part of governance\n error OnlyDisputer();\n\n // Methods\n\n /// @notice Registers a slasher by updating the slashers mapping\n function addSlasher(address _slasher) external;\n\n /// @notice Removes a slasher by updating the slashers mapping\n function removeSlasher(address _slasher) external;\n\n /// @notice Registers a disputer by updating the disputers mapping\n function addDisputer(address _disputer) external;\n\n /// @notice Removes a disputer by updating the disputers mapping\n function removeDisputer(address _disputer) external;\n}\n" - }, - "solidity/contracts/peripherals/Governable.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../../interfaces/peripherals/IGovernable.sol';\n\nabstract contract Governable is IGovernable {\n /// @inheritdoc IGovernable\n address public override governance;\n\n /// @inheritdoc IGovernable\n address public override pendingGovernance;\n\n constructor(address _governance) {\n if (_governance == address(0)) revert NoGovernanceZeroAddress();\n governance = _governance;\n }\n\n /// @inheritdoc IGovernable\n function setGovernance(address _governance) external override onlyGovernance {\n pendingGovernance = _governance;\n emit GovernanceProposal(_governance);\n }\n\n /// @inheritdoc IGovernable\n function acceptGovernance() external override onlyPendingGovernance {\n governance = pendingGovernance;\n delete pendingGovernance;\n emit GovernanceSet(governance);\n }\n\n /// @notice Functions with this modifier can only be called by governance\n modifier onlyGovernance {\n if (msg.sender != governance) revert OnlyGovernance();\n _;\n }\n\n /// @notice Functions with this modifier can only be called by pendingGovernance\n modifier onlyPendingGovernance {\n if (msg.sender != pendingGovernance) revert OnlyPendingGovernance();\n _;\n }\n}\n" - }, - "solidity/interfaces/peripherals/IGovernable.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\n/// @title Governable contract\n/// @notice Manages the governance role\ninterface IGovernable {\n // Events\n\n /// @notice Emitted when pendingGovernance accepts to be governance\n /// @param _governance Address of the new governance\n event GovernanceSet(address _governance);\n\n /// @notice Emitted when a new governance is proposed\n /// @param _pendingGovernance Address that is proposed to be the new governance\n event GovernanceProposal(address _pendingGovernance);\n\n // Errors\n\n /// @notice Throws if the caller of the function is not governance\n error OnlyGovernance();\n\n /// @notice Throws if the caller of the function is not pendingGovernance\n error OnlyPendingGovernance();\n\n /// @notice Throws if trying to set governance to zero address\n error NoGovernanceZeroAddress();\n\n // Variables\n\n /// @notice Stores the governance address\n /// @return _governance The governance addresss\n function governance() external view returns (address _governance);\n\n /// @notice Stores the pendingGovernance address\n /// @return _pendingGovernance The pendingGovernance addresss\n function pendingGovernance() external view returns (address _pendingGovernance);\n\n // Methods\n\n /// @notice Proposes a new address to be governance\n /// @param _governance The address being proposed as the new governance\n function setGovernance(address _governance) external;\n\n /// @notice Changes the governance from the current governance to the previously proposed address\n function acceptGovernance() external;\n}\n" - }, - "@openzeppelin/contracts/utils/Address.sol": { - "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Collection of functions related to the address type\n */\nlibrary Address {\n /**\n * @dev Returns true if `account` is a contract.\n *\n * [IMPORTANT]\n * ====\n * It is unsafe to assume that an address for which this function returns\n * false is an externally-owned account (EOA) and not a contract.\n *\n * Among others, `isContract` will return false for the following\n * types of addresses:\n *\n * - an externally-owned account\n * - a contract in construction\n * - an address where a contract will be created\n * - an address where a contract lived, but was destroyed\n * ====\n */\n function isContract(address account) internal view returns (bool) {\n // This method relies on extcodesize, which returns 0 for contracts in\n // construction, since the code is only stored at the end of the\n // constructor execution.\n\n uint256 size;\n assembly {\n size := extcodesize(account)\n }\n return size > 0;\n }\n\n /**\n * @dev Replacement for Solidity's `transfer`: sends `amount` wei to\n * `recipient`, forwarding all available gas and reverting on errors.\n *\n * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost\n * of certain opcodes, possibly making contracts go over the 2300 gas limit\n * imposed by `transfer`, making them unable to receive funds via\n * `transfer`. {sendValue} removes this limitation.\n *\n * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].\n *\n * IMPORTANT: because control is transferred to `recipient`, care must be\n * taken to not create reentrancy vulnerabilities. Consider using\n * {ReentrancyGuard} or the\n * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].\n */\n function sendValue(address payable recipient, uint256 amount) internal {\n require(address(this).balance >= amount, \"Address: insufficient balance\");\n\n (bool success, ) = recipient.call{value: amount}(\"\");\n require(success, \"Address: unable to send value, recipient may have reverted\");\n }\n\n /**\n * @dev Performs a Solidity function call using a low level `call`. A\n * plain `call` is an unsafe replacement for a function call: use this\n * function instead.\n *\n * If `target` reverts with a revert reason, it is bubbled up by this\n * function (like regular Solidity function calls).\n *\n * Returns the raw returned data. To convert to the expected return value,\n * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\n *\n * Requirements:\n *\n * - `target` must be a contract.\n * - calling `target` with `data` must not revert.\n *\n * _Available since v3.1._\n */\n function functionCall(address target, bytes memory data) internal returns (bytes memory) {\n return functionCall(target, data, \"Address: low-level call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with\n * `errorMessage` as a fallback revert reason when `target` reverts.\n *\n * _Available since v3.1._\n */\n function functionCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal returns (bytes memory) {\n return functionCallWithValue(target, data, 0, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but also transferring `value` wei to `target`.\n *\n * Requirements:\n *\n * - the calling contract must have an ETH balance of at least `value`.\n * - the called Solidity function must be `payable`.\n *\n * _Available since v3.1._\n */\n function functionCallWithValue(\n address target,\n bytes memory data,\n uint256 value\n ) internal returns (bytes memory) {\n return functionCallWithValue(target, data, value, \"Address: low-level call with value failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but\n * with `errorMessage` as a fallback revert reason when `target` reverts.\n *\n * _Available since v3.1._\n */\n function functionCallWithValue(\n address target,\n bytes memory data,\n uint256 value,\n string memory errorMessage\n ) internal returns (bytes memory) {\n require(address(this).balance >= value, \"Address: insufficient balance for call\");\n require(isContract(target), \"Address: call to non-contract\");\n\n (bool success, bytes memory returndata) = target.call{value: value}(data);\n return verifyCallResult(success, returndata, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but performing a static call.\n *\n * _Available since v3.3._\n */\n function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\n return functionStaticCall(target, data, \"Address: low-level static call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\n * but performing a static call.\n *\n * _Available since v3.3._\n */\n function functionStaticCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal view returns (bytes memory) {\n require(isContract(target), \"Address: static call to non-contract\");\n\n (bool success, bytes memory returndata) = target.staticcall(data);\n return verifyCallResult(success, returndata, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but performing a delegate call.\n *\n * _Available since v3.4._\n */\n function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {\n return functionDelegateCall(target, data, \"Address: low-level delegate call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\n * but performing a delegate call.\n *\n * _Available since v3.4._\n */\n function functionDelegateCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal returns (bytes memory) {\n require(isContract(target), \"Address: delegate call to non-contract\");\n\n (bool success, bytes memory returndata) = target.delegatecall(data);\n return verifyCallResult(success, returndata, errorMessage);\n }\n\n /**\n * @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the\n * revert reason using the provided one.\n *\n * _Available since v4.3._\n */\n function verifyCallResult(\n bool success,\n bytes memory returndata,\n string memory errorMessage\n ) internal pure returns (bytes memory) {\n if (success) {\n return returndata;\n } else {\n // Look for revert reason and bubble it up if present\n if (returndata.length > 0) {\n // The easiest way to bubble the revert reason is using memory via assembly\n\n assembly {\n let returndata_size := mload(returndata)\n revert(add(32, returndata), returndata_size)\n }\n } else {\n revert(errorMessage);\n }\n }\n }\n}\n" - }, - "solidity/interfaces/IPairManager.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol';\n\n/// @title Pair Manager interface\n/// @notice Generic interface for Keep3r liquidity pools (kLP)\ninterface IPairManager is IERC20Metadata {\n /// @notice Address of the factory from which the pair manager was created\n /// @return _factory The address of the PairManager Factory\n function factory() external view returns (address _factory);\n\n /// @notice Address of the pool from which the Keep3r pair manager will interact with\n /// @return _pool The address of the pool\n function pool() external view returns (address _pool);\n\n /// @notice Token0 of the pool\n /// @return _token0 The address of token0\n function token0() external view returns (address _token0);\n\n /// @notice Token1 of the pool\n /// @return _token1 The address of token1\n function token1() external view returns (address _token1);\n}\n" - }, - "solidity/contracts/libraries/FullMath.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\n/// @title Contains 512-bit math functions\n/// @notice Facilitates multiplication and division that can have overflow of an intermediate value without any loss of precision\n/// @dev Handles \"phantom overflow\" i.e., allows multiplication and division where an intermediate value overflows 256 bits\nlibrary FullMath {\n /// @notice Calculates floor(a×b÷denominator) with full precision. Throws if result overflows a uint256 or denominator == 0\n /// @param a The multiplicand\n /// @param b The multiplier\n /// @param denominator The divisor\n /// @return result The 256-bit result\n /// @dev Credit to Remco Bloemen under MIT license https://xn--2-umb.com/21/muldiv\n function mulDiv(\n uint256 a,\n uint256 b,\n uint256 denominator\n ) internal pure returns (uint256 result) {\n unchecked {\n // 512-bit multiply [prod1 prod0] = a * b\n // Compute the product mod 2**256 and mod 2**256 - 1\n // then use the Chinese Remainder Theorem to reconstruct\n // the 512 bit result. The result is stored in two 256\n // variables such that product = prod1 * 2**256 + prod0\n uint256 prod0; // Least significant 256 bits of the product\n uint256 prod1; // Most significant 256 bits of the product\n assembly {\n let mm := mulmod(a, b, not(0))\n prod0 := mul(a, b)\n prod1 := sub(sub(mm, prod0), lt(mm, prod0))\n }\n\n // Handle non-overflow cases, 256 by 256 division\n if (prod1 == 0) {\n require(denominator > 0);\n assembly {\n result := div(prod0, denominator)\n }\n return result;\n }\n\n // Make sure the result is less than 2**256.\n // Also prevents denominator == 0\n require(denominator > prod1);\n\n ///////////////////////////////////////////////\n // 512 by 256 division.\n ///////////////////////////////////////////////\n\n // Make division exact by subtracting the remainder from [prod1 prod0]\n // Compute remainder using mulmod\n uint256 remainder;\n assembly {\n remainder := mulmod(a, b, denominator)\n }\n // Subtract 256 bit number from 512 bit number\n assembly {\n prod1 := sub(prod1, gt(remainder, prod0))\n prod0 := sub(prod0, remainder)\n }\n\n // Factor powers of two out of denominator\n // Compute largest power of two divisor of denominator.\n // Always >= 1.\n uint256 twos = (~denominator + 1) & denominator;\n // Divide denominator by power of two\n assembly {\n denominator := div(denominator, twos)\n }\n\n // Divide [prod1 prod0] by the factors of two\n assembly {\n prod0 := div(prod0, twos)\n }\n // Shift in bits from prod1 into prod0. For this we need\n // to flip `twos` such that it is 2**256 / twos.\n // If twos is zero, then it becomes one\n assembly {\n twos := add(div(sub(0, twos), twos), 1)\n }\n prod0 |= prod1 * twos;\n\n // Invert denominator mod 2**256\n // Now that denominator is an odd number, it has an inverse\n // modulo 2**256 such that denominator * inv = 1 mod 2**256.\n // Compute the inverse by starting with a seed that is correct\n // correct for four bits. That is, denominator * inv = 1 mod 2**4\n uint256 inv = (3 * denominator) ^ 2;\n // Now use Newton-Raphson iteration to improve the precision.\n // Thanks to Hensel's lifting lemma, this also works in modular\n // arithmetic, doubling the correct bits in each step.\n inv *= 2 - denominator * inv; // inverse mod 2**8\n inv *= 2 - denominator * inv; // inverse mod 2**16\n inv *= 2 - denominator * inv; // inverse mod 2**32\n inv *= 2 - denominator * inv; // inverse mod 2**64\n inv *= 2 - denominator * inv; // inverse mod 2**128\n inv *= 2 - denominator * inv; // inverse mod 2**256\n\n // Because the division is now exact we can divide by multiplying\n // with the modular inverse of denominator. This will give us the\n // correct result modulo 2**256. Since the precoditions guarantee\n // that the outcome is less than 2**256, this is the final result.\n // We don't need to compute the high bits of the result and prod1\n // is no longer required.\n result = prod0 * inv;\n return result;\n }\n }\n\n /// @notice Calculates ceil(a×b÷denominator) with full precision. Throws if result overflows a uint256 or denominator == 0\n /// @param a The multiplicand\n /// @param b The multiplier\n /// @param denominator The divisor\n /// @return result The 256-bit result\n function mulDivRoundingUp(\n uint256 a,\n uint256 b,\n uint256 denominator\n ) internal pure returns (uint256 result) {\n unchecked {\n result = mulDiv(a, b, denominator);\n if (mulmod(a, b, denominator) > 0) {\n require(result < type(uint256).max);\n result++;\n }\n }\n }\n}\n" - }, - "@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol": { - "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\nimport \"../IERC20.sol\";\n\n/**\n * @dev Interface for the optional metadata functions from the ERC20 standard.\n *\n * _Available since v4.1._\n */\ninterface IERC20Metadata is IERC20 {\n /**\n * @dev Returns the name of the token.\n */\n function name() external view returns (string memory);\n\n /**\n * @dev Returns the symbol of the token.\n */\n function symbol() external view returns (string memory);\n\n /**\n * @dev Returns the decimals places of the token.\n */\n function decimals() external view returns (uint8);\n}\n" - }, - "solidity/interfaces/peripherals/IKeep3rDisputable.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\n/// @title Keep3rDisputable contract\n/// @notice Creates/resolves disputes for jobs or keepers\n/// A disputed keeper is slashable and is not able to bond, activate, withdraw or receive direct payments\n/// A disputed job is slashable and is not able to pay the keepers, withdraw tokens or to migrate\ninterface IKeep3rDisputable {\n /// @notice Emitted when a keeper or a job is disputed\n /// @param _jobOrKeeper The address of the disputed keeper/job\n /// @param _disputer The user that called the function and disputed the keeper\n event Dispute(address indexed _jobOrKeeper, address indexed _disputer);\n\n /// @notice Emitted when a dispute is resolved\n /// @param _jobOrKeeper The address of the disputed keeper/job\n /// @param _resolver The user that called the function and resolved the dispute\n event Resolve(address indexed _jobOrKeeper, address indexed _resolver);\n\n /// @notice Throws when a job or keeper is already disputed\n error AlreadyDisputed();\n\n /// @notice Throws when a job or keeper is not disputed and someone tries to resolve the dispute\n error NotDisputed();\n\n /// @notice Allows governance to create a dispute for a given keeper/job\n /// @param _jobOrKeeper The address in dispute\n function dispute(address _jobOrKeeper) external;\n\n /// @notice Allows governance to resolve a dispute on a keeper/job\n /// @param _jobOrKeeper The address cleared\n function resolve(address _jobOrKeeper) external;\n}\n" - }, - "solidity/contracts/peripherals/jobs/Keep3rJobMigration.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../../../interfaces/peripherals/IKeep3rJobs.sol';\nimport './Keep3rJobFundableCredits.sol';\nimport './Keep3rJobFundableLiquidity.sol';\n\nabstract contract Keep3rJobMigration is IKeep3rJobMigration, Keep3rJobFundableCredits, Keep3rJobFundableLiquidity {\n using EnumerableSet for EnumerableSet.AddressSet;\n\n uint256 internal constant _MIGRATION_COOLDOWN = 1 minutes;\n\n /// @inheritdoc IKeep3rJobMigration\n mapping(address => address) public override pendingJobMigrations;\n mapping(address => mapping(address => uint256)) internal _migrationCreatedAt;\n\n /// @inheritdoc IKeep3rJobMigration\n function migrateJob(address _fromJob, address _toJob) external override onlyJobOwner(_fromJob) {\n if (_fromJob == _toJob) revert JobMigrationImpossible();\n\n pendingJobMigrations[_fromJob] = _toJob;\n _migrationCreatedAt[_fromJob][_toJob] = block.timestamp;\n\n emit JobMigrationRequested(_fromJob, _toJob);\n }\n\n /// @inheritdoc IKeep3rJobMigration\n function acceptJobMigration(address _fromJob, address _toJob) external override onlyJobOwner(_toJob) {\n if (disputes[_fromJob] || disputes[_toJob]) revert JobDisputed();\n if (pendingJobMigrations[_fromJob] != _toJob) revert JobMigrationUnavailable();\n if (block.timestamp < _migrationCreatedAt[_fromJob][_toJob] + _MIGRATION_COOLDOWN) revert JobMigrationLocked();\n\n // force job credits update for both jobs\n _settleJobAccountance(_fromJob);\n _settleJobAccountance(_toJob);\n\n // migrate tokens\n while (_jobTokens[_fromJob].length() > 0) {\n address _tokenToMigrate = _jobTokens[_fromJob].at(0);\n jobTokenCredits[_toJob][_tokenToMigrate] += jobTokenCredits[_fromJob][_tokenToMigrate];\n delete jobTokenCredits[_fromJob][_tokenToMigrate];\n _jobTokens[_fromJob].remove(_tokenToMigrate);\n _jobTokens[_toJob].add(_tokenToMigrate);\n }\n\n // migrate liquidities\n while (_jobLiquidities[_fromJob].length() > 0) {\n address _liquidity = _jobLiquidities[_fromJob].at(0);\n\n liquidityAmount[_toJob][_liquidity] += liquidityAmount[_fromJob][_liquidity];\n delete liquidityAmount[_fromJob][_liquidity];\n\n _jobLiquidities[_toJob].add(_liquidity);\n _jobLiquidities[_fromJob].remove(_liquidity);\n }\n\n // migrate job balances\n _jobPeriodCredits[_toJob] += _jobPeriodCredits[_fromJob];\n delete _jobPeriodCredits[_fromJob];\n\n _jobLiquidityCredits[_toJob] += _jobLiquidityCredits[_fromJob];\n delete _jobLiquidityCredits[_fromJob];\n\n // stop _fromJob from being a job\n delete rewardedAt[_fromJob];\n _jobs.remove(_fromJob);\n\n // delete unused data slots\n delete jobOwner[_fromJob];\n delete jobPendingOwner[_fromJob];\n delete _migrationCreatedAt[_fromJob][_toJob];\n delete pendingJobMigrations[_fromJob];\n\n emit JobMigrationSuccessful(_fromJob, _toJob);\n }\n}\n" - }, - "solidity/contracts/peripherals/keepers/Keep3rKeeperDisputable.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport './Keep3rKeeperFundable.sol';\nimport '../Keep3rDisputable.sol';\nimport '../../../interfaces/external/IKeep3rV1.sol';\nimport '../../../interfaces/peripherals/IKeep3rKeepers.sol';\n\nabstract contract Keep3rKeeperDisputable is IKeep3rKeeperDisputable, Keep3rDisputable, Keep3rKeeperFundable {\n using EnumerableSet for EnumerableSet.AddressSet;\n using SafeERC20 for IERC20;\n\n /// @inheritdoc IKeep3rKeeperDisputable\n function slash(\n address _keeper,\n address _bonded,\n uint256 _bondAmount,\n uint256 _unbondAmount\n ) public override onlySlasher {\n if (!disputes[_keeper]) revert NotDisputed();\n _slash(_keeper, _bonded, _bondAmount, _unbondAmount);\n emit KeeperSlash(_keeper, msg.sender, _bondAmount + _unbondAmount);\n }\n\n /// @inheritdoc IKeep3rKeeperDisputable\n function revoke(address _keeper) external override onlySlasher {\n if (!disputes[_keeper]) revert NotDisputed();\n _keepers.remove(_keeper);\n _slash(_keeper, keep3rV1, bonds[_keeper][keep3rV1], pendingUnbonds[_keeper][keep3rV1]);\n emit KeeperRevoke(_keeper, msg.sender);\n }\n\n function _slash(\n address _keeper,\n address _bonded,\n uint256 _bondAmount,\n uint256 _unbondAmount\n ) internal {\n if (_bonded != keep3rV1) {\n try IERC20(_bonded).transfer(governance, _bondAmount + _unbondAmount) returns (bool) {} catch (bytes memory) {}\n }\n bonds[_keeper][_bonded] -= _bondAmount;\n pendingUnbonds[_keeper][_bonded] -= _unbondAmount;\n }\n}\n" - }, - "solidity/contracts/peripherals/keepers/Keep3rKeeperFundable.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../Keep3rAccountance.sol';\nimport '../Keep3rParameters.sol';\nimport '../../../interfaces/peripherals/IKeep3rKeepers.sol';\n\nimport '../../../interfaces/external/IKeep3rV1.sol';\nimport '../../../interfaces/external/IKeep3rV1Proxy.sol';\n\nimport '@openzeppelin/contracts/security/ReentrancyGuard.sol';\nimport '@openzeppelin/contracts/token/ERC20/IERC20.sol';\nimport '@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol';\n\nabstract contract Keep3rKeeperFundable is IKeep3rKeeperFundable, ReentrancyGuard, Keep3rParameters {\n using EnumerableSet for EnumerableSet.AddressSet;\n using SafeERC20 for IERC20;\n\n /// @inheritdoc IKeep3rKeeperFundable\n function bond(address _bonding, uint256 _amount) external override nonReentrant {\n if (disputes[msg.sender]) revert Disputed();\n if (_jobs.contains(msg.sender)) revert AlreadyAJob();\n canActivateAfter[msg.sender][_bonding] = block.timestamp + bondTime;\n\n uint256 _before = IERC20(_bonding).balanceOf(address(this));\n IERC20(_bonding).safeTransferFrom(msg.sender, address(this), _amount);\n _amount = IERC20(_bonding).balanceOf(address(this)) - _before;\n\n hasBonded[msg.sender] = true;\n pendingBonds[msg.sender][_bonding] += _amount;\n\n emit Bonding(msg.sender, _bonding, _amount);\n }\n\n /// @inheritdoc IKeep3rKeeperFundable\n function activate(address _bonding) external override {\n if (disputes[msg.sender]) revert Disputed();\n if (canActivateAfter[msg.sender][_bonding] == 0) revert BondsUnexistent();\n if (canActivateAfter[msg.sender][_bonding] >= block.timestamp) revert BondsLocked();\n\n delete canActivateAfter[msg.sender][_bonding];\n\n uint256 _amount = _activate(msg.sender, _bonding);\n emit Activation(msg.sender, _bonding, _amount);\n }\n\n /// @inheritdoc IKeep3rKeeperFundable\n function unbond(address _bonding, uint256 _amount) external override {\n canWithdrawAfter[msg.sender][_bonding] = block.timestamp + unbondTime;\n bonds[msg.sender][_bonding] -= _amount;\n pendingUnbonds[msg.sender][_bonding] += _amount;\n\n emit Unbonding(msg.sender, _bonding, _amount);\n }\n\n /// @inheritdoc IKeep3rKeeperFundable\n function withdraw(address _bonding) external override nonReentrant {\n if (pendingUnbonds[msg.sender][_bonding] == 0) revert UnbondsUnexistent();\n if (canWithdrawAfter[msg.sender][_bonding] >= block.timestamp) revert UnbondsLocked();\n if (disputes[msg.sender]) revert Disputed();\n\n uint256 _amount = pendingUnbonds[msg.sender][_bonding];\n\n if (_bonding == keep3rV1) {\n IKeep3rV1Proxy(keep3rV1Proxy).mint(_amount);\n }\n\n delete pendingUnbonds[msg.sender][_bonding];\n delete canWithdrawAfter[msg.sender][_bonding];\n\n IERC20(_bonding).safeTransfer(msg.sender, _amount);\n\n emit Withdrawal(msg.sender, _bonding, _amount);\n }\n\n function _activate(address _keeper, address _bonding) internal returns (uint256 _amount) {\n if (firstSeen[_keeper] == 0) {\n firstSeen[_keeper] = block.timestamp;\n }\n _keepers.add(_keeper);\n _amount = pendingBonds[_keeper][_bonding];\n delete pendingBonds[_keeper][_bonding];\n\n // bond provided tokens\n bonds[_keeper][_bonding] += _amount;\n if (_bonding == keep3rV1) {\n IKeep3rV1(keep3rV1).burn(_amount);\n }\n }\n}\n" - }, - "solidity/interfaces/external/IKeep3rV1.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '@openzeppelin/contracts/token/ERC20/IERC20.sol';\nimport '@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol';\n\n// solhint-disable func-name-mixedcase\ninterface IKeep3rV1 is IERC20, IERC20Metadata {\n // Structs\n struct Checkpoint {\n uint32 fromBlock;\n uint256 votes;\n }\n\n // Events\n event DelegateChanged(address indexed _delegator, address indexed _fromDelegate, address indexed _toDelegate);\n event DelegateVotesChanged(address indexed _delegate, uint256 _previousBalance, uint256 _newBalance);\n event SubmitJob(address indexed _job, address indexed _liquidity, address indexed _provider, uint256 _block, uint256 _credit);\n event ApplyCredit(address indexed _job, address indexed _liquidity, address indexed _provider, uint256 _block, uint256 _credit);\n event RemoveJob(address indexed _job, address indexed _liquidity, address indexed _provider, uint256 _block, uint256 _credit);\n event UnbondJob(address indexed _job, address indexed _liquidity, address indexed _provider, uint256 _block, uint256 _credit);\n event JobAdded(address indexed _job, uint256 _block, address _governance);\n event JobRemoved(address indexed _job, uint256 _block, address _governance);\n event KeeperWorked(address indexed _credit, address indexed _job, address indexed _keeper, uint256 _block, uint256 _amount);\n event KeeperBonding(address indexed _keeper, uint256 _block, uint256 _active, uint256 _bond);\n event KeeperBonded(address indexed _keeper, uint256 _block, uint256 _activated, uint256 _bond);\n event KeeperUnbonding(address indexed _keeper, uint256 _block, uint256 _deactive, uint256 _bond);\n event KeeperUnbound(address indexed _keeper, uint256 _block, uint256 _deactivated, uint256 _bond);\n event KeeperSlashed(address indexed _keeper, address indexed _slasher, uint256 _block, uint256 _slash);\n event KeeperDispute(address indexed _keeper, uint256 _block);\n event KeeperResolved(address indexed _keeper, uint256 _block);\n event TokenCreditAddition(address indexed _credit, address indexed _job, address indexed _creditor, uint256 _block, uint256 _amount);\n\n // Variables\n function KPRH() external returns (address);\n\n function delegates(address _delegator) external view returns (address);\n\n function checkpoints(address _account, uint32 _checkpoint) external view returns (Checkpoint memory);\n\n function numCheckpoints(address _account) external view returns (uint32);\n\n function DOMAIN_TYPEHASH() external returns (bytes32);\n\n function DOMAINSEPARATOR() external returns (bytes32);\n\n function DELEGATION_TYPEHASH() external returns (bytes32);\n\n function PERMIT_TYPEHASH() external returns (bytes32);\n\n function nonces(address _user) external view returns (uint256);\n\n function BOND() external returns (uint256);\n\n function UNBOND() external returns (uint256);\n\n function LIQUIDITYBOND() external returns (uint256);\n\n function FEE() external returns (uint256);\n\n function BASE() external returns (uint256);\n\n function ETH() external returns (address);\n\n function bondings(address _user, address _bonding) external view returns (uint256);\n\n function canWithdrawAfter(address _user, address _bonding) external view returns (uint256);\n\n function pendingUnbonds(address _keeper, address _bonding) external view returns (uint256);\n\n function pendingbonds(address _keeper, address _bonding) external view returns (uint256);\n\n function bonds(address _keeper, address _bonding) external view returns (uint256);\n\n function votes(address _delegator) external view returns (uint256);\n\n function firstSeen(address _keeper) external view returns (uint256);\n\n function disputes(address _keeper) external view returns (bool);\n\n function lastJob(address _keeper) external view returns (uint256);\n\n function workCompleted(address _keeper) external view returns (uint256);\n\n function jobs(address _job) external view returns (bool);\n\n function credits(address _job, address _credit) external view returns (uint256);\n\n function liquidityProvided(\n address _provider,\n address _liquidity,\n address _job\n ) external view returns (uint256);\n\n function liquidityUnbonding(\n address _provider,\n address _liquidity,\n address _job\n ) external view returns (uint256);\n\n function liquidityAmountsUnbonding(\n address _provider,\n address _liquidity,\n address _job\n ) external view returns (uint256);\n\n function jobProposalDelay(address _job) external view returns (uint256);\n\n function liquidityApplied(\n address _provider,\n address _liquidity,\n address _job\n ) external view returns (uint256);\n\n function liquidityAmount(\n address _provider,\n address _liquidity,\n address _job\n ) external view returns (uint256);\n\n function keepers(address _keeper) external view returns (bool);\n\n function blacklist(address _keeper) external view returns (bool);\n\n function keeperList(uint256 _index) external view returns (address);\n\n function jobList(uint256 _index) external view returns (address);\n\n function governance() external returns (address);\n\n function pendingGovernance() external returns (address);\n\n function liquidityAccepted(address _liquidity) external view returns (bool);\n\n function liquidityPairs(uint256 _index) external view returns (address);\n\n // Methods\n function getCurrentVotes(address _account) external view returns (uint256);\n\n function addCreditETH(address _job) external payable;\n\n function addCredit(\n address _credit,\n address _job,\n uint256 _amount\n ) external;\n\n function addVotes(address _voter, uint256 _amount) external;\n\n function removeVotes(address _voter, uint256 _amount) external;\n\n function addKPRCredit(address _job, uint256 _amount) external;\n\n function approveLiquidity(address _liquidity) external;\n\n function revokeLiquidity(address _liquidity) external;\n\n function pairs() external view returns (address[] memory);\n\n function addLiquidityToJob(\n address _liquidity,\n address _job,\n uint256 _amount\n ) external;\n\n function applyCreditToJob(\n address _provider,\n address _liquidity,\n address _job\n ) external;\n\n function unbondLiquidityFromJob(\n address _liquidity,\n address _job,\n uint256 _amount\n ) external;\n\n function removeLiquidityFromJob(address _liquidity, address _job) external;\n\n function mint(uint256 _amount) external;\n\n function burn(uint256 _amount) external;\n\n function worked(address _keeper) external;\n\n function receipt(\n address _credit,\n address _keeper,\n uint256 _amount\n ) external;\n\n function receiptETH(address _keeper, uint256 _amount) external;\n\n function addJob(address _job) external;\n\n function getJobs() external view returns (address[] memory);\n\n function removeJob(address _job) external;\n\n function setKeep3rHelper(address _keep3rHelper) external;\n\n function setGovernance(address _governance) external;\n\n function acceptGovernance() external;\n\n function isKeeper(address _keeper) external returns (bool);\n\n function isMinKeeper(\n address _keeper,\n uint256 _minBond,\n uint256 _earned,\n uint256 _age\n ) external returns (bool);\n\n function isBondedKeeper(\n address _keeper,\n address _bond,\n uint256 _minBond,\n uint256 _earned,\n uint256 _age\n ) external returns (bool);\n\n function bond(address _bonding, uint256 _amount) external;\n\n function getKeepers() external view returns (address[] memory);\n\n function activate(address _bonding) external;\n\n function unbond(address _bonding, uint256 _amount) external;\n\n function slash(\n address _bonded,\n address _keeper,\n uint256 _amount\n ) external;\n\n function withdraw(address _bonding) external;\n\n function dispute(address _keeper) external;\n\n function revoke(address _keeper) external;\n\n function resolve(address _keeper) external;\n\n function permit(\n address _owner,\n address _spender,\n uint256 _amount,\n uint256 _deadline,\n uint8 _v,\n bytes32 _r,\n bytes32 _s\n ) external;\n}\n" - }, - "solidity/interfaces/peripherals/IKeep3rKeepers.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\n/// @title Keep3rKeeperFundable contract\n/// @notice Handles the actions required to become a keeper\ninterface IKeep3rKeeperFundable {\n // Events\n\n /// @notice Emitted when Keep3rKeeperFundable#activate is called\n /// @param _keeper The keeper that has been activated\n /// @param _bond The asset the keeper has bonded\n /// @param _amount The amount of the asset the keeper has bonded\n event Activation(address indexed _keeper, address indexed _bond, uint256 _amount);\n\n /// @notice Emitted when Keep3rKeeperFundable#withdraw is called\n /// @param _keeper The caller of Keep3rKeeperFundable#withdraw function\n /// @param _bond The asset to withdraw from the bonding pool\n /// @param _amount The amount of funds withdrawn\n event Withdrawal(address indexed _keeper, address indexed _bond, uint256 _amount);\n\n // Errors\n\n /// @notice Throws when the address that is trying to register as a job is already a job\n error AlreadyAJob();\n\n // Methods\n\n /// @notice Beginning of the bonding process\n /// @param _bonding The asset being bonded\n /// @param _amount The amount of bonding asset being bonded\n function bond(address _bonding, uint256 _amount) external;\n\n /// @notice Beginning of the unbonding process\n /// @param _bonding The asset being unbonded\n /// @param _amount Allows for partial unbonding\n function unbond(address _bonding, uint256 _amount) external;\n\n /// @notice End of the bonding process after bonding time has passed\n /// @param _bonding The asset being activated as bond collateral\n function activate(address _bonding) external;\n\n /// @notice Withdraw funds after unbonding has finished\n /// @param _bonding The asset to withdraw from the bonding pool\n function withdraw(address _bonding) external;\n}\n\n/// @title Keep3rKeeperDisputable contract\n/// @notice Handles the actions that can be taken on a disputed keeper\ninterface IKeep3rKeeperDisputable {\n // Events\n\n /// @notice Emitted when Keep3rKeeperDisputable#slash is called\n /// @param _keeper The address of the slashed keeper\n /// @param _slasher The user that called Keep3rKeeperDisputable#slash\n /// @param _amount The amount of credits slashed from the keeper\n event KeeperSlash(address indexed _keeper, address indexed _slasher, uint256 _amount);\n\n /// @notice Emitted when Keep3rKeeperDisputable#revoke is called\n /// @param _keeper The address of the revoked keeper\n /// @param _slasher The user that called Keep3rKeeperDisputable#revoke\n event KeeperRevoke(address indexed _keeper, address indexed _slasher);\n\n // Methods\n\n /// @notice Allows governance to slash a keeper based on a dispute\n /// @param _keeper The address being slashed\n /// @param _bonded The asset being slashed\n /// @param _bondAmount The bonded amount being slashed\n /// @param _unbondAmount The pending unbond amount being slashed\n function slash(\n address _keeper,\n address _bonded,\n uint256 _bondAmount,\n uint256 _unbondAmount\n ) external;\n\n /// @notice Blacklists a keeper from participating in the network\n /// @param _keeper The address being slashed\n function revoke(address _keeper) external;\n}\n\n// solhint-disable-next-line no-empty-blocks\n\n/// @title Keep3rKeepers contract\ninterface IKeep3rKeepers is IKeep3rKeeperDisputable {\n\n}\n" - }, - "solidity/interfaces/external/IKeep3rV1Proxy.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../peripherals/IGovernable.sol';\n\ninterface IKeep3rV1Proxy is IGovernable {\n // Structs\n struct Recipient {\n address recipient;\n uint256 caps;\n }\n\n // Variables\n function keep3rV1() external view returns (address);\n\n function minter() external view returns (address);\n\n function next(address) external view returns (uint256);\n\n function caps(address) external view returns (uint256);\n\n function recipients() external view returns (address[] memory);\n\n function recipientsCaps() external view returns (Recipient[] memory);\n\n // Errors\n error Cooldown();\n error NoDrawableAmount();\n error ZeroAddress();\n error OnlyMinter();\n\n // Methods\n function addRecipient(address recipient, uint256 amount) external;\n\n function removeRecipient(address recipient) external;\n\n function draw() external returns (uint256 _amount);\n\n function setKeep3rV1(address _keep3rV1) external;\n\n function setMinter(address _minter) external;\n\n function mint(uint256 _amount) external;\n\n function mint(address _account, uint256 _amount) external;\n\n function setKeep3rV1Governance(address _governance) external;\n\n function acceptKeep3rV1Governance() external;\n\n function dispute(address _keeper) external;\n\n function slash(\n address _bonded,\n address _keeper,\n uint256 _amount\n ) external;\n\n function revoke(address _keeper) external;\n\n function resolve(address _keeper) external;\n\n function addJob(address _job) external;\n\n function removeJob(address _job) external;\n\n function addKPRCredit(address _job, uint256 _amount) external;\n\n function approveLiquidity(address _liquidity) external;\n\n function revokeLiquidity(address _liquidity) external;\n\n function setKeep3rHelper(address _keep3rHelper) external;\n\n function addVotes(address _voter, uint256 _amount) external;\n\n function removeVotes(address _voter, uint256 _amount) external;\n}\n" - }, - "solidity/interfaces/peripherals/IDustCollector.sol": { - "content": "// SPDX-License-Identifier: MIT\n\npragma solidity >=0.8.4 <0.9.0;\n\nimport './IBaseErrors.sol';\n\ninterface IDustCollector is IBaseErrors {\n /// @notice Emitted when dust is sent\n /// @param _token The token that will be transferred\n /// @param _amount The amount of the token that will be transferred\n /// @param _to The address which will receive the funds\n event DustSent(address _token, uint256 _amount, address _to);\n\n /// @notice Allows an authorized user to transfer the tokens or eth that may have been left in a contract\n /// @param _token The token that will be transferred\n /// @param _amount The amount of the token that will be transferred\n /// @param _to The address that will receive the idle funds\n function sendDust(\n address _token,\n uint256 _amount,\n address _to\n ) external;\n}\n" - }, - "solidity/for-test/Keep3rForTest.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../contracts/Keep3r.sol';\n\ncontract Keep3rForTest is Keep3r {\n constructor(\n address _governance,\n address _keep3rHelper,\n address _keep3rV1,\n address _keep3rV1Proxy,\n address _kp3rWethPool\n ) Keep3r(_governance, _keep3rHelper, _keep3rV1, _keep3rV1Proxy, _kp3rWethPool) {}\n\n function viewTickOrder(address _liquidity) external view returns (bool) {\n return _isKP3RToken0[_liquidity];\n }\n}\n" - }, - "solidity/for-test/peripherals/DustCollectorForTest.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../../contracts/peripherals/DustCollector.sol';\n\ncontract DustCollectorForTest is DustCollector {\n constructor() DustCollector() Governable(msg.sender) {}\n}\n" - }, - "solidity/interfaces/IKeep3r.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport './peripherals/IKeep3rJobs.sol';\nimport './peripherals/IKeep3rKeepers.sol';\nimport './peripherals/IKeep3rAccountance.sol';\nimport './peripherals/IKeep3rRoles.sol';\nimport './peripherals/IKeep3rParameters.sol';\n\n// solhint-disable-next-line no-empty-blocks\n\n/// @title Keep3rV2 contract\n/// @notice This contract inherits all the functionality of Keep3rV2\ninterface IKeep3r is IKeep3rJobs, IKeep3rKeepers, IKeep3rAccountance, IKeep3rRoles, IKeep3rParameters {\n\n}\n" - }, - "solidity/for-test/JobForTest.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../interfaces/IKeep3r.sol';\n\ncontract JobForTest {\n error InvalidKeeper();\n address public keep3r;\n uint256 public nonce;\n\n constructor(address _keep3r) {\n keep3r = _keep3r;\n }\n\n function work() external {\n if (!IKeep3r(keep3r).isKeeper(msg.sender)) revert InvalidKeeper();\n\n for (uint256 i; i < 1000; i++) {\n nonce++;\n }\n\n IKeep3r(keep3r).worked(msg.sender);\n }\n\n function workHard(uint256 _factor) external {\n if (!IKeep3r(keep3r).isKeeper(msg.sender)) revert InvalidKeeper();\n\n for (uint256 i; i < 1000 * _factor; i++) {\n nonce++;\n }\n\n IKeep3r(keep3r).worked(msg.sender);\n }\n}\n" - }, - "solidity/for-test/BasicJob.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../interfaces/IKeep3r.sol';\n\ncontract BasicJob {\n error KeeperNotValid();\n\n address public keep3r;\n uint256 public nonce;\n uint256[] public array;\n\n constructor(address _keep3r) {\n keep3r = _keep3r;\n }\n\n function work() external upkeep {}\n\n function workHard(uint256 _howHard) external upkeep {\n for (uint256 i = nonce; i < _howHard; i++) {\n nonce++;\n }\n }\n\n function workRefund(uint256 _howHard) external upkeep {\n for (uint256 i; i < _howHard; i++) {\n array.push(i);\n }\n\n while (array.length > 0) {\n array.pop();\n }\n }\n\n modifier upkeep() {\n IKeep3r(keep3r).isKeeper(msg.sender);\n _;\n IKeep3r(keep3r).worked(msg.sender);\n }\n}\n" - }, - "solidity/contracts/Keep3rHelperParameters.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.7 <0.9.0;\n\nimport './libraries/FullMath.sol';\nimport './libraries/TickMath.sol';\nimport '../interfaces/IKeep3r.sol';\nimport '../interfaces/external/IKeep3rV1.sol';\nimport '../interfaces/IKeep3rHelperParameters.sol';\nimport './peripherals/Governable.sol';\nimport './Keep3rHelperParameters.sol';\n\nimport '@openzeppelin/contracts/utils/math/Math.sol';\nimport '@uniswap/v3-core/contracts/interfaces/IUniswapV3Pool.sol';\n\ncontract Keep3rHelperParameters is IKeep3rHelperParameters, Governable {\n /// @inheritdoc IKeep3rHelperParameters\n address public constant override KP3R = 0x1cEB5cB57C4D4E2b2433641b95Dd330A33185A44;\n\n /// @inheritdoc IKeep3rHelperParameters\n uint256 public constant override BOOST_BASE = 10_000;\n\n /// @inheritdoc IKeep3rHelperParameters\n uint256 public override minBoost = 11_000;\n\n /// @inheritdoc IKeep3rHelperParameters\n uint256 public override maxBoost = 12_000;\n\n /// @inheritdoc IKeep3rHelperParameters\n uint256 public override targetBond = 200 ether;\n\n /// @inheritdoc IKeep3rHelperParameters\n uint256 public override workExtraGas = 50_000;\n\n /// @inheritdoc IKeep3rHelperParameters\n uint32 public override quoteTwapTime = 10 minutes;\n\n /// @inheritdoc IKeep3rHelperParameters\n uint256 public override minBaseFee = 15e9;\n\n /// @inheritdoc IKeep3rHelperParameters\n uint256 public override minPriorityFee = 2e9;\n\n /// @inheritdoc IKeep3rHelperParameters\n address public override keep3rV2;\n\n /// @inheritdoc IKeep3rHelperParameters\n IKeep3rHelperParameters.Kp3rWethPool public override kp3rWethPool;\n\n constructor(address _keep3rV2, address _governance) Governable(_governance) {\n keep3rV2 = _keep3rV2;\n _setKp3rWethPool(0x11B7a6bc0259ed6Cf9DB8F499988F9eCc7167bf5);\n }\n\n /// @inheritdoc IKeep3rHelperParameters\n function setKp3rWethPool(address _poolAddress) external override onlyGovernance {\n _setKp3rWethPool(_poolAddress);\n emit Kp3rWethPoolChange(kp3rWethPool.poolAddress, kp3rWethPool.isKP3RToken0);\n }\n\n /// @inheritdoc IKeep3rHelperParameters\n function setMinBoost(uint256 _minBoost) external override onlyGovernance {\n minBoost = _minBoost;\n emit MinBoostChange(minBoost);\n }\n\n /// @inheritdoc IKeep3rHelperParameters\n function setMaxBoost(uint256 _maxBoost) external override onlyGovernance {\n maxBoost = _maxBoost;\n emit MaxBoostChange(maxBoost);\n }\n\n /// @inheritdoc IKeep3rHelperParameters\n function setTargetBond(uint256 _targetBond) external override onlyGovernance {\n targetBond = _targetBond;\n emit TargetBondChange(targetBond);\n }\n\n /// @inheritdoc IKeep3rHelperParameters\n function setKeep3rV2(address _keep3rV2) external override onlyGovernance {\n keep3rV2 = _keep3rV2;\n emit Keep3rV2Change(keep3rV2);\n }\n\n /// @inheritdoc IKeep3rHelperParameters\n function setWorkExtraGas(uint256 _workExtraGas) external override onlyGovernance {\n workExtraGas = _workExtraGas;\n emit WorkExtraGasChange(workExtraGas);\n }\n\n /// @inheritdoc IKeep3rHelperParameters\n function setQuoteTwapTime(uint32 _quoteTwapTime) external override onlyGovernance {\n quoteTwapTime = _quoteTwapTime;\n emit QuoteTwapTimeChange(quoteTwapTime);\n }\n\n /// @inheritdoc IKeep3rHelperParameters\n function setMinBaseFee(uint256 _minBaseFee) external override onlyGovernance {\n minBaseFee = _minBaseFee;\n emit MinBaseFeeChange(minBaseFee);\n }\n\n /// @inheritdoc IKeep3rHelperParameters\n function setMinPriorityFee(uint256 _minPriorityFee) external override onlyGovernance {\n minPriorityFee = _minPriorityFee;\n emit MinPriorityFeeChange(minPriorityFee);\n }\n\n /// @notice Sets KP3R-WETH pool\n /// @param _poolAddress The address of the KP3R-WETH pool\n function _setKp3rWethPool(address _poolAddress) internal {\n bool _isKP3RToken0 = IUniswapV3Pool(_poolAddress).token0() == KP3R;\n bool _isKP3RToken1 = IUniswapV3Pool(_poolAddress).token1() == KP3R;\n\n if (!_isKP3RToken0 && !_isKP3RToken1) revert InvalidKp3rPool();\n\n kp3rWethPool = Kp3rWethPool(_poolAddress, _isKP3RToken0);\n }\n}\n" - }, - "solidity/contracts/libraries/TickMath.sol": { - "content": "// SPDX-License-Identifier: GPL-2.0-or-later\npragma solidity >=0.5.0;\n\n// solhint-disable\n\n/// @title Math library for computing sqrt prices from ticks and vice versa\n/// @notice Computes sqrt price for ticks of size 1.0001, i.e. sqrt(1.0001^tick) as fixed point Q64.96 numbers. Supports\n/// prices between 2**-128 and 2**128\nlibrary TickMath {\n /// @dev The minimum tick that may be passed to #getSqrtRatioAtTick computed from log base 1.0001 of 2**-128\n int24 internal constant MIN_TICK = -887272;\n /// @dev The maximum tick that may be passed to #getSqrtRatioAtTick computed from log base 1.0001 of 2**128\n int24 internal constant MAX_TICK = -MIN_TICK;\n\n /// @dev The minimum value that can be returned from #getSqrtRatioAtTick. Equivalent to getSqrtRatioAtTick(MIN_TICK)\n uint160 internal constant MIN_SQRT_RATIO = 4295128739;\n /// @dev The maximum value that can be returned from #getSqrtRatioAtTick. Equivalent to getSqrtRatioAtTick(MAX_TICK)\n uint160 internal constant MAX_SQRT_RATIO = 1461446703485210103287273052203988822378723970342;\n\n /// @notice Calculates sqrt(1.0001^tick) * 2^96\n /// @dev Throws if |tick| > max tick\n /// @param tick The input tick for the above formula\n /// @return sqrtPriceX96 A Fixed point Q64.96 number representing the sqrt of the ratio of the two assets (token1/token0)\n /// at the given tick\n function getSqrtRatioAtTick(int24 tick) internal pure returns (uint160 sqrtPriceX96) {\n uint256 absTick = tick < 0 ? uint256(-int256(tick)) : uint256(int256(tick));\n require(absTick <= uint256(int256(MAX_TICK)), 'T');\n\n uint256 ratio = absTick & 0x1 != 0 ? 0xfffcb933bd6fad37aa2d162d1a594001 : 0x100000000000000000000000000000000;\n if (absTick & 0x2 != 0) ratio = (ratio * 0xfff97272373d413259a46990580e213a) >> 128;\n if (absTick & 0x4 != 0) ratio = (ratio * 0xfff2e50f5f656932ef12357cf3c7fdcc) >> 128;\n if (absTick & 0x8 != 0) ratio = (ratio * 0xffe5caca7e10e4e61c3624eaa0941cd0) >> 128;\n if (absTick & 0x10 != 0) ratio = (ratio * 0xffcb9843d60f6159c9db58835c926644) >> 128;\n if (absTick & 0x20 != 0) ratio = (ratio * 0xff973b41fa98c081472e6896dfb254c0) >> 128;\n if (absTick & 0x40 != 0) ratio = (ratio * 0xff2ea16466c96a3843ec78b326b52861) >> 128;\n if (absTick & 0x80 != 0) ratio = (ratio * 0xfe5dee046a99a2a811c461f1969c3053) >> 128;\n if (absTick & 0x100 != 0) ratio = (ratio * 0xfcbe86c7900a88aedcffc83b479aa3a4) >> 128;\n if (absTick & 0x200 != 0) ratio = (ratio * 0xf987a7253ac413176f2b074cf7815e54) >> 128;\n if (absTick & 0x400 != 0) ratio = (ratio * 0xf3392b0822b70005940c7a398e4b70f3) >> 128;\n if (absTick & 0x800 != 0) ratio = (ratio * 0xe7159475a2c29b7443b29c7fa6e889d9) >> 128;\n if (absTick & 0x1000 != 0) ratio = (ratio * 0xd097f3bdfd2022b8845ad8f792aa5825) >> 128;\n if (absTick & 0x2000 != 0) ratio = (ratio * 0xa9f746462d870fdf8a65dc1f90e061e5) >> 128;\n if (absTick & 0x4000 != 0) ratio = (ratio * 0x70d869a156d2a1b890bb3df62baf32f7) >> 128;\n if (absTick & 0x8000 != 0) ratio = (ratio * 0x31be135f97d08fd981231505542fcfa6) >> 128;\n if (absTick & 0x10000 != 0) ratio = (ratio * 0x9aa508b5b7a84e1c677de54f3e99bc9) >> 128;\n if (absTick & 0x20000 != 0) ratio = (ratio * 0x5d6af8dedb81196699c329225ee604) >> 128;\n if (absTick & 0x40000 != 0) ratio = (ratio * 0x2216e584f5fa1ea926041bedfe98) >> 128;\n if (absTick & 0x80000 != 0) ratio = (ratio * 0x48a170391f7dc42444e8fa2) >> 128;\n\n if (tick > 0) ratio = type(uint256).max / ratio;\n\n // Divides by 1<<32 rounding up to go from a Q128.128 to a Q128.96.\n // we then downcast because we know the result always fits within 160 bits due to our tick input constraint\n // we round up in the division so getTickAtSqrtRatio of the output price is always consistent\n sqrtPriceX96 = uint160((ratio >> 32) + (ratio % (1 << 32) == 0 ? 0 : 1));\n }\n\n /// @notice Calculates the greatest tick value such that getRatioAtTick(tick) <= ratio\n /// @dev Throws in case sqrtPriceX96 < MIN_SQRT_RATIO, as MIN_SQRT_RATIO is the lowest value getRatioAtTick may ever return.\n /// @param sqrtPriceX96 The sqrt ratio for which to compute the tick as a Q64.96\n /// @return tick The greatest tick for which the ratio is less than or equal to the input ratio\n function getTickAtSqrtRatio(uint160 sqrtPriceX96) internal pure returns (int24 tick) {\n // Second inequality must be < because the price can never reach the price at the max tick\n require(sqrtPriceX96 >= MIN_SQRT_RATIO && sqrtPriceX96 < MAX_SQRT_RATIO, 'R');\n uint256 ratio = uint256(sqrtPriceX96) << 32;\n\n uint256 r = ratio;\n uint256 msb = 0;\n\n assembly {\n let f := shl(7, gt(r, 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF))\n msb := or(msb, f)\n r := shr(f, r)\n }\n assembly {\n let f := shl(6, gt(r, 0xFFFFFFFFFFFFFFFF))\n msb := or(msb, f)\n r := shr(f, r)\n }\n assembly {\n let f := shl(5, gt(r, 0xFFFFFFFF))\n msb := or(msb, f)\n r := shr(f, r)\n }\n assembly {\n let f := shl(4, gt(r, 0xFFFF))\n msb := or(msb, f)\n r := shr(f, r)\n }\n assembly {\n let f := shl(3, gt(r, 0xFF))\n msb := or(msb, f)\n r := shr(f, r)\n }\n assembly {\n let f := shl(2, gt(r, 0xF))\n msb := or(msb, f)\n r := shr(f, r)\n }\n assembly {\n let f := shl(1, gt(r, 0x3))\n msb := or(msb, f)\n r := shr(f, r)\n }\n assembly {\n let f := gt(r, 0x1)\n msb := or(msb, f)\n }\n\n if (msb >= 128) r = ratio >> (msb - 127);\n else r = ratio << (127 - msb);\n\n int256 log_2 = (int256(msb) - 128) << 64;\n\n assembly {\n r := shr(127, mul(r, r))\n let f := shr(128, r)\n log_2 := or(log_2, shl(63, f))\n r := shr(f, r)\n }\n assembly {\n r := shr(127, mul(r, r))\n let f := shr(128, r)\n log_2 := or(log_2, shl(62, f))\n r := shr(f, r)\n }\n assembly {\n r := shr(127, mul(r, r))\n let f := shr(128, r)\n log_2 := or(log_2, shl(61, f))\n r := shr(f, r)\n }\n assembly {\n r := shr(127, mul(r, r))\n let f := shr(128, r)\n log_2 := or(log_2, shl(60, f))\n r := shr(f, r)\n }\n assembly {\n r := shr(127, mul(r, r))\n let f := shr(128, r)\n log_2 := or(log_2, shl(59, f))\n r := shr(f, r)\n }\n assembly {\n r := shr(127, mul(r, r))\n let f := shr(128, r)\n log_2 := or(log_2, shl(58, f))\n r := shr(f, r)\n }\n assembly {\n r := shr(127, mul(r, r))\n let f := shr(128, r)\n log_2 := or(log_2, shl(57, f))\n r := shr(f, r)\n }\n assembly {\n r := shr(127, mul(r, r))\n let f := shr(128, r)\n log_2 := or(log_2, shl(56, f))\n r := shr(f, r)\n }\n assembly {\n r := shr(127, mul(r, r))\n let f := shr(128, r)\n log_2 := or(log_2, shl(55, f))\n r := shr(f, r)\n }\n assembly {\n r := shr(127, mul(r, r))\n let f := shr(128, r)\n log_2 := or(log_2, shl(54, f))\n r := shr(f, r)\n }\n assembly {\n r := shr(127, mul(r, r))\n let f := shr(128, r)\n log_2 := or(log_2, shl(53, f))\n r := shr(f, r)\n }\n assembly {\n r := shr(127, mul(r, r))\n let f := shr(128, r)\n log_2 := or(log_2, shl(52, f))\n r := shr(f, r)\n }\n assembly {\n r := shr(127, mul(r, r))\n let f := shr(128, r)\n log_2 := or(log_2, shl(51, f))\n r := shr(f, r)\n }\n assembly {\n r := shr(127, mul(r, r))\n let f := shr(128, r)\n log_2 := or(log_2, shl(50, f))\n }\n\n int256 log_sqrt10001 = log_2 * 255738958999603826347141; // 128.128 number\n\n int24 tickLow = int24((log_sqrt10001 - 3402992956809132418596140100660247210) >> 128);\n int24 tickHi = int24((log_sqrt10001 + 291339464771989622907027621153398088495) >> 128);\n\n tick = tickLow == tickHi ? tickLow : getSqrtRatioAtTick(tickHi) <= sqrtPriceX96 ? tickHi : tickLow;\n }\n}\n" - }, - "solidity/interfaces/IKeep3rHelperParameters.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\n/// @title Keep3rHelperParameters contract\n/// @notice Contains all the helper functions used throughout the different files.\ninterface IKeep3rHelperParameters {\n // Structs\n\n /// @dev KP3R-WETH Pool address and isKP3RToken0\n /// @dev Created in order to save gas by avoiding calls to pool's token0 method\n struct Kp3rWethPool {\n address poolAddress;\n bool isKP3RToken0;\n }\n\n // Errors\n\n /// @notice Throws when pool does not have KP3R as token0 nor token1\n error InvalidKp3rPool();\n\n // Events\n\n /// @notice Emitted when the kp3r weth pool is changed\n /// @param _address Address of the new kp3r weth pool\n /// @param _isKP3RToken0 True if calling the token0 method of the pool returns the KP3R token address\n event Kp3rWethPoolChange(address _address, bool _isKP3RToken0);\n\n /// @notice Emitted when the minimum boost multiplier is changed\n /// @param _minBoost The minimum boost multiplier\n event MinBoostChange(uint256 _minBoost);\n\n /// @notice Emitted when the maximum boost multiplier is changed\n /// @param _maxBoost The maximum boost multiplier\n event MaxBoostChange(uint256 _maxBoost);\n\n /// @notice Emitted when the target bond amount is changed\n /// @param _targetBond The target bond amount\n event TargetBondChange(uint256 _targetBond);\n\n /// @notice Emitted when the Keep3r V2 address is changed\n /// @param _keep3rV2 The address of Keep3r V2\n event Keep3rV2Change(address _keep3rV2);\n\n /// @notice Emitted when the work extra gas amount is changed\n /// @param _workExtraGas The work extra gas\n event WorkExtraGasChange(uint256 _workExtraGas);\n\n /// @notice Emitted when the quote twap time is changed\n /// @param _quoteTwapTime The twap time for quoting\n event QuoteTwapTimeChange(uint32 _quoteTwapTime);\n\n /// @notice Emitted when minimum rewarded gas fee is changed\n /// @param _minBaseFee The minimum rewarded gas fee\n event MinBaseFeeChange(uint256 _minBaseFee);\n\n /// @notice Emitted when minimum rewarded priority fee is changed\n /// @param _minPriorityFee The minimum expected fee that the keeper should pay\n event MinPriorityFeeChange(uint256 _minPriorityFee);\n\n // Variables\n\n /// @notice Address of KP3R token\n /// @return _kp3r Address of KP3R token\n // solhint-disable func-name-mixedcase\n function KP3R() external view returns (address _kp3r);\n\n /// @notice The boost base used to calculate the boost rewards for the keeper\n /// @return _base The boost base number\n function BOOST_BASE() external view returns (uint256 _base);\n\n /// @notice KP3R-WETH pool that is being used as oracle\n /// @return poolAddress Address of the pool\n /// @return isKP3RToken0 True if calling the token0 method of the pool returns the KP3R token address\n function kp3rWethPool() external view returns (address poolAddress, bool isKP3RToken0);\n\n /// @notice The minimum multiplier used to calculate the amount of gas paid to the Keeper for the gas used to perform a job\n /// For example: if the quoted gas used is 1000, then the minimum amount to be paid will be 1000 * minBoost / BOOST_BASE\n /// @return _multiplier The minimum boost multiplier\n function minBoost() external view returns (uint256 _multiplier);\n\n /// @notice The maximum multiplier used to calculate the amount of gas paid to the Keeper for the gas used to perform a job\n /// For example: if the quoted gas used is 1000, then the maximum amount to be paid will be 1000 * maxBoost / BOOST_BASE\n /// @return _multiplier The maximum boost multiplier\n function maxBoost() external view returns (uint256 _multiplier);\n\n /// @notice The targeted amount of bonded KP3Rs to max-up reward multiplier\n /// For example: if the amount of KP3R the keeper has bonded is targetBond or more, then the keeper will get\n /// the maximum boost possible in his rewards, if it's less, the reward boost will be proportional\n /// @return _target The amount of KP3R that comforms the targetBond\n function targetBond() external view returns (uint256 _target);\n\n /// @notice The amount of unaccounted gas that is going to be added to keeper payments\n /// @return _workExtraGas The work unaccounted gas amount\n function workExtraGas() external view returns (uint256 _workExtraGas);\n\n /// @notice The twap time for quoting\n /// @return _quoteTwapTime The twap time\n function quoteTwapTime() external view returns (uint32 _quoteTwapTime);\n\n /// @notice The minimum base fee that is used to calculate keeper rewards\n /// @return _minBaseFee The minimum rewarded gas fee\n function minBaseFee() external view returns (uint256 _minBaseFee);\n\n /// @notice The minimum priority fee that is also rewarded for keepers\n /// @return _minPriorityFee The minimum rewarded priority fee\n function minPriorityFee() external view returns (uint256 _minPriorityFee);\n\n /// @notice Address of Keep3r V2\n /// @return _keep3rV2 Address of Keep3r V2\n function keep3rV2() external view returns (address _keep3rV2);\n\n // Methods\n\n /// @notice Sets KP3R-WETH pool\n /// @param _poolAddress The address of the KP3R-WETH pool\n function setKp3rWethPool(address _poolAddress) external;\n\n /// @notice Sets the minimum boost multiplier\n /// @param _minBoost The minimum boost multiplier\n function setMinBoost(uint256 _minBoost) external;\n\n /// @notice Sets the maximum boost multiplier\n /// @param _maxBoost The maximum boost multiplier\n function setMaxBoost(uint256 _maxBoost) external;\n\n /// @notice Sets the target bond amount\n /// @param _targetBond The target bond amount\n function setTargetBond(uint256 _targetBond) external;\n\n /// @notice Sets the Keep3r V2 address\n /// @param _keep3rV2 The address of Keep3r V2\n function setKeep3rV2(address _keep3rV2) external;\n\n /// @notice Sets the work extra gas amount\n /// @param _workExtraGas The work extra gas\n function setWorkExtraGas(uint256 _workExtraGas) external;\n\n /// @notice Sets the quote twap time\n /// @param _quoteTwapTime The twap time for quoting\n function setQuoteTwapTime(uint32 _quoteTwapTime) external;\n\n /// @notice Sets the minimum rewarded gas fee\n /// @param _minBaseFee The minimum rewarded gas fee\n function setMinBaseFee(uint256 _minBaseFee) external;\n\n /// @notice Sets the minimum rewarded gas priority fee\n /// @param _minPriorityFee The minimum rewarded priority fee\n function setMinPriorityFee(uint256 _minPriorityFee) external;\n}\n" - }, - "@uniswap/v3-core/contracts/interfaces/IUniswapV3Pool.sol": { - "content": "// SPDX-License-Identifier: GPL-2.0-or-later\npragma solidity >=0.5.0;\n\nimport './pool/IUniswapV3PoolImmutables.sol';\nimport './pool/IUniswapV3PoolState.sol';\nimport './pool/IUniswapV3PoolDerivedState.sol';\nimport './pool/IUniswapV3PoolActions.sol';\nimport './pool/IUniswapV3PoolOwnerActions.sol';\nimport './pool/IUniswapV3PoolEvents.sol';\n\n/// @title The interface for a Uniswap V3 Pool\n/// @notice A Uniswap pool facilitates swapping and automated market making between any two assets that strictly conform\n/// to the ERC20 specification\n/// @dev The pool interface is broken up into many smaller pieces\ninterface IUniswapV3Pool is\n IUniswapV3PoolImmutables,\n IUniswapV3PoolState,\n IUniswapV3PoolDerivedState,\n IUniswapV3PoolActions,\n IUniswapV3PoolOwnerActions,\n IUniswapV3PoolEvents\n{\n\n}\n" - }, - "@uniswap/v3-core/contracts/interfaces/pool/IUniswapV3PoolImmutables.sol": { - "content": "// SPDX-License-Identifier: GPL-2.0-or-later\npragma solidity >=0.5.0;\n\n/// @title Pool state that never changes\n/// @notice These parameters are fixed for a pool forever, i.e., the methods will always return the same values\ninterface IUniswapV3PoolImmutables {\n /// @notice The contract that deployed the pool, which must adhere to the IUniswapV3Factory interface\n /// @return The contract address\n function factory() external view returns (address);\n\n /// @notice The first of the two tokens of the pool, sorted by address\n /// @return The token contract address\n function token0() external view returns (address);\n\n /// @notice The second of the two tokens of the pool, sorted by address\n /// @return The token contract address\n function token1() external view returns (address);\n\n /// @notice The pool's fee in hundredths of a bip, i.e. 1e-6\n /// @return The fee\n function fee() external view returns (uint24);\n\n /// @notice The pool tick spacing\n /// @dev Ticks can only be used at multiples of this value, minimum of 1 and always positive\n /// e.g.: a tickSpacing of 3 means ticks can be initialized every 3rd tick, i.e., ..., -6, -3, 0, 3, 6, ...\n /// This value is an int24 to avoid casting even though it is always positive.\n /// @return The tick spacing\n function tickSpacing() external view returns (int24);\n\n /// @notice The maximum amount of position liquidity that can use any tick in the range\n /// @dev This parameter is enforced per tick to prevent liquidity from overflowing a uint128 at any point, and\n /// also prevents out-of-range liquidity from being used to prevent adding in-range liquidity to a pool\n /// @return The max amount of liquidity per tick\n function maxLiquidityPerTick() external view returns (uint128);\n}\n" - }, - "@uniswap/v3-core/contracts/interfaces/pool/IUniswapV3PoolState.sol": { - "content": "// SPDX-License-Identifier: GPL-2.0-or-later\npragma solidity >=0.5.0;\n\n/// @title Pool state that can change\n/// @notice These methods compose the pool's state, and can change with any frequency including multiple times\n/// per transaction\ninterface IUniswapV3PoolState {\n /// @notice The 0th storage slot in the pool stores many values, and is exposed as a single method to save gas\n /// when accessed externally.\n /// @return sqrtPriceX96 The current price of the pool as a sqrt(token1/token0) Q64.96 value\n /// tick The current tick of the pool, i.e. according to the last tick transition that was run.\n /// This value may not always be equal to SqrtTickMath.getTickAtSqrtRatio(sqrtPriceX96) if the price is on a tick\n /// boundary.\n /// observationIndex The index of the last oracle observation that was written,\n /// observationCardinality The current maximum number of observations stored in the pool,\n /// observationCardinalityNext The next maximum number of observations, to be updated when the observation.\n /// feeProtocol The protocol fee for both tokens of the pool.\n /// Encoded as two 4 bit values, where the protocol fee of token1 is shifted 4 bits and the protocol fee of token0\n /// is the lower 4 bits. Used as the denominator of a fraction of the swap fee, e.g. 4 means 1/4th of the swap fee.\n /// unlocked Whether the pool is currently locked to reentrancy\n function slot0()\n external\n view\n returns (\n uint160 sqrtPriceX96,\n int24 tick,\n uint16 observationIndex,\n uint16 observationCardinality,\n uint16 observationCardinalityNext,\n uint8 feeProtocol,\n bool unlocked\n );\n\n /// @notice The fee growth as a Q128.128 fees of token0 collected per unit of liquidity for the entire life of the pool\n /// @dev This value can overflow the uint256\n function feeGrowthGlobal0X128() external view returns (uint256);\n\n /// @notice The fee growth as a Q128.128 fees of token1 collected per unit of liquidity for the entire life of the pool\n /// @dev This value can overflow the uint256\n function feeGrowthGlobal1X128() external view returns (uint256);\n\n /// @notice The amounts of token0 and token1 that are owed to the protocol\n /// @dev Protocol fees will never exceed uint128 max in either token\n function protocolFees() external view returns (uint128 token0, uint128 token1);\n\n /// @notice The currently in range liquidity available to the pool\n /// @dev This value has no relationship to the total liquidity across all ticks\n function liquidity() external view returns (uint128);\n\n /// @notice Look up information about a specific tick in the pool\n /// @param tick The tick to look up\n /// @return liquidityGross the total amount of position liquidity that uses the pool either as tick lower or\n /// tick upper,\n /// liquidityNet how much liquidity changes when the pool price crosses the tick,\n /// feeGrowthOutside0X128 the fee growth on the other side of the tick from the current tick in token0,\n /// feeGrowthOutside1X128 the fee growth on the other side of the tick from the current tick in token1,\n /// tickCumulativeOutside the cumulative tick value on the other side of the tick from the current tick\n /// secondsPerLiquidityOutsideX128 the seconds spent per liquidity on the other side of the tick from the current tick,\n /// secondsOutside the seconds spent on the other side of the tick from the current tick,\n /// initialized Set to true if the tick is initialized, i.e. liquidityGross is greater than 0, otherwise equal to false.\n /// Outside values can only be used if the tick is initialized, i.e. if liquidityGross is greater than 0.\n /// In addition, these values are only relative and must be used only in comparison to previous snapshots for\n /// a specific position.\n function ticks(int24 tick)\n external\n view\n returns (\n uint128 liquidityGross,\n int128 liquidityNet,\n uint256 feeGrowthOutside0X128,\n uint256 feeGrowthOutside1X128,\n int56 tickCumulativeOutside,\n uint160 secondsPerLiquidityOutsideX128,\n uint32 secondsOutside,\n bool initialized\n );\n\n /// @notice Returns 256 packed tick initialized boolean values. See TickBitmap for more information\n function tickBitmap(int16 wordPosition) external view returns (uint256);\n\n /// @notice Returns the information about a position by the position's key\n /// @param key The position's key is a hash of a preimage composed by the owner, tickLower and tickUpper\n /// @return _liquidity The amount of liquidity in the position,\n /// Returns feeGrowthInside0LastX128 fee growth of token0 inside the tick range as of the last mint/burn/poke,\n /// Returns feeGrowthInside1LastX128 fee growth of token1 inside the tick range as of the last mint/burn/poke,\n /// Returns tokensOwed0 the computed amount of token0 owed to the position as of the last mint/burn/poke,\n /// Returns tokensOwed1 the computed amount of token1 owed to the position as of the last mint/burn/poke\n function positions(bytes32 key)\n external\n view\n returns (\n uint128 _liquidity,\n uint256 feeGrowthInside0LastX128,\n uint256 feeGrowthInside1LastX128,\n uint128 tokensOwed0,\n uint128 tokensOwed1\n );\n\n /// @notice Returns data about a specific observation index\n /// @param index The element of the observations array to fetch\n /// @dev You most likely want to use #observe() instead of this method to get an observation as of some amount of time\n /// ago, rather than at a specific index in the array.\n /// @return blockTimestamp The timestamp of the observation,\n /// Returns tickCumulative the tick multiplied by seconds elapsed for the life of the pool as of the observation timestamp,\n /// Returns secondsPerLiquidityCumulativeX128 the seconds per in range liquidity for the life of the pool as of the observation timestamp,\n /// Returns initialized whether the observation has been initialized and the values are safe to use\n function observations(uint256 index)\n external\n view\n returns (\n uint32 blockTimestamp,\n int56 tickCumulative,\n uint160 secondsPerLiquidityCumulativeX128,\n bool initialized\n );\n}\n" - }, - "@uniswap/v3-core/contracts/interfaces/pool/IUniswapV3PoolDerivedState.sol": { - "content": "// SPDX-License-Identifier: GPL-2.0-or-later\npragma solidity >=0.5.0;\n\n/// @title Pool state that is not stored\n/// @notice Contains view functions to provide information about the pool that is computed rather than stored on the\n/// blockchain. The functions here may have variable gas costs.\ninterface IUniswapV3PoolDerivedState {\n /// @notice Returns the cumulative tick and liquidity as of each timestamp `secondsAgo` from the current block timestamp\n /// @dev To get a time weighted average tick or liquidity-in-range, you must call this with two values, one representing\n /// the beginning of the period and another for the end of the period. E.g., to get the last hour time-weighted average tick,\n /// you must call it with secondsAgos = [3600, 0].\n /// @dev The time weighted average tick represents the geometric time weighted average price of the pool, in\n /// log base sqrt(1.0001) of token1 / token0. The TickMath library can be used to go from a tick value to a ratio.\n /// @param secondsAgos From how long ago each cumulative tick and liquidity value should be returned\n /// @return tickCumulatives Cumulative tick values as of each `secondsAgos` from the current block timestamp\n /// @return secondsPerLiquidityCumulativeX128s Cumulative seconds per liquidity-in-range value as of each `secondsAgos` from the current block\n /// timestamp\n function observe(uint32[] calldata secondsAgos)\n external\n view\n returns (int56[] memory tickCumulatives, uint160[] memory secondsPerLiquidityCumulativeX128s);\n\n /// @notice Returns a snapshot of the tick cumulative, seconds per liquidity and seconds inside a tick range\n /// @dev Snapshots must only be compared to other snapshots, taken over a period for which a position existed.\n /// I.e., snapshots cannot be compared if a position is not held for the entire period between when the first\n /// snapshot is taken and the second snapshot is taken.\n /// @param tickLower The lower tick of the range\n /// @param tickUpper The upper tick of the range\n /// @return tickCumulativeInside The snapshot of the tick accumulator for the range\n /// @return secondsPerLiquidityInsideX128 The snapshot of seconds per liquidity for the range\n /// @return secondsInside The snapshot of seconds per liquidity for the range\n function snapshotCumulativesInside(int24 tickLower, int24 tickUpper)\n external\n view\n returns (\n int56 tickCumulativeInside,\n uint160 secondsPerLiquidityInsideX128,\n uint32 secondsInside\n );\n}\n" - }, - "@uniswap/v3-core/contracts/interfaces/pool/IUniswapV3PoolActions.sol": { - "content": "// SPDX-License-Identifier: GPL-2.0-or-later\npragma solidity >=0.5.0;\n\n/// @title Permissionless pool actions\n/// @notice Contains pool methods that can be called by anyone\ninterface IUniswapV3PoolActions {\n /// @notice Sets the initial price for the pool\n /// @dev Price is represented as a sqrt(amountToken1/amountToken0) Q64.96 value\n /// @param sqrtPriceX96 the initial sqrt price of the pool as a Q64.96\n function initialize(uint160 sqrtPriceX96) external;\n\n /// @notice Adds liquidity for the given recipient/tickLower/tickUpper position\n /// @dev The caller of this method receives a callback in the form of IUniswapV3MintCallback#uniswapV3MintCallback\n /// in which they must pay any token0 or token1 owed for the liquidity. The amount of token0/token1 due depends\n /// on tickLower, tickUpper, the amount of liquidity, and the current price.\n /// @param recipient The address for which the liquidity will be created\n /// @param tickLower The lower tick of the position in which to add liquidity\n /// @param tickUpper The upper tick of the position in which to add liquidity\n /// @param amount The amount of liquidity to mint\n /// @param data Any data that should be passed through to the callback\n /// @return amount0 The amount of token0 that was paid to mint the given amount of liquidity. Matches the value in the callback\n /// @return amount1 The amount of token1 that was paid to mint the given amount of liquidity. Matches the value in the callback\n function mint(\n address recipient,\n int24 tickLower,\n int24 tickUpper,\n uint128 amount,\n bytes calldata data\n ) external returns (uint256 amount0, uint256 amount1);\n\n /// @notice Collects tokens owed to a position\n /// @dev Does not recompute fees earned, which must be done either via mint or burn of any amount of liquidity.\n /// Collect must be called by the position owner. To withdraw only token0 or only token1, amount0Requested or\n /// amount1Requested may be set to zero. To withdraw all tokens owed, caller may pass any value greater than the\n /// actual tokens owed, e.g. type(uint128).max. Tokens owed may be from accumulated swap fees or burned liquidity.\n /// @param recipient The address which should receive the fees collected\n /// @param tickLower The lower tick of the position for which to collect fees\n /// @param tickUpper The upper tick of the position for which to collect fees\n /// @param amount0Requested How much token0 should be withdrawn from the fees owed\n /// @param amount1Requested How much token1 should be withdrawn from the fees owed\n /// @return amount0 The amount of fees collected in token0\n /// @return amount1 The amount of fees collected in token1\n function collect(\n address recipient,\n int24 tickLower,\n int24 tickUpper,\n uint128 amount0Requested,\n uint128 amount1Requested\n ) external returns (uint128 amount0, uint128 amount1);\n\n /// @notice Burn liquidity from the sender and account tokens owed for the liquidity to the position\n /// @dev Can be used to trigger a recalculation of fees owed to a position by calling with an amount of 0\n /// @dev Fees must be collected separately via a call to #collect\n /// @param tickLower The lower tick of the position for which to burn liquidity\n /// @param tickUpper The upper tick of the position for which to burn liquidity\n /// @param amount How much liquidity to burn\n /// @return amount0 The amount of token0 sent to the recipient\n /// @return amount1 The amount of token1 sent to the recipient\n function burn(\n int24 tickLower,\n int24 tickUpper,\n uint128 amount\n ) external returns (uint256 amount0, uint256 amount1);\n\n /// @notice Swap token0 for token1, or token1 for token0\n /// @dev The caller of this method receives a callback in the form of IUniswapV3SwapCallback#uniswapV3SwapCallback\n /// @param recipient The address to receive the output of the swap\n /// @param zeroForOne The direction of the swap, true for token0 to token1, false for token1 to token0\n /// @param amountSpecified The amount of the swap, which implicitly configures the swap as exact input (positive), or exact output (negative)\n /// @param sqrtPriceLimitX96 The Q64.96 sqrt price limit. If zero for one, the price cannot be less than this\n /// value after the swap. If one for zero, the price cannot be greater than this value after the swap\n /// @param data Any data to be passed through to the callback\n /// @return amount0 The delta of the balance of token0 of the pool, exact when negative, minimum when positive\n /// @return amount1 The delta of the balance of token1 of the pool, exact when negative, minimum when positive\n function swap(\n address recipient,\n bool zeroForOne,\n int256 amountSpecified,\n uint160 sqrtPriceLimitX96,\n bytes calldata data\n ) external returns (int256 amount0, int256 amount1);\n\n /// @notice Receive token0 and/or token1 and pay it back, plus a fee, in the callback\n /// @dev The caller of this method receives a callback in the form of IUniswapV3FlashCallback#uniswapV3FlashCallback\n /// @dev Can be used to donate underlying tokens pro-rata to currently in-range liquidity providers by calling\n /// with 0 amount{0,1} and sending the donation amount(s) from the callback\n /// @param recipient The address which will receive the token0 and token1 amounts\n /// @param amount0 The amount of token0 to send\n /// @param amount1 The amount of token1 to send\n /// @param data Any data to be passed through to the callback\n function flash(\n address recipient,\n uint256 amount0,\n uint256 amount1,\n bytes calldata data\n ) external;\n\n /// @notice Increase the maximum number of price and liquidity observations that this pool will store\n /// @dev This method is no-op if the pool already has an observationCardinalityNext greater than or equal to\n /// the input observationCardinalityNext.\n /// @param observationCardinalityNext The desired minimum number of observations for the pool to store\n function increaseObservationCardinalityNext(uint16 observationCardinalityNext) external;\n}\n" - }, - "@uniswap/v3-core/contracts/interfaces/pool/IUniswapV3PoolOwnerActions.sol": { - "content": "// SPDX-License-Identifier: GPL-2.0-or-later\npragma solidity >=0.5.0;\n\n/// @title Permissioned pool actions\n/// @notice Contains pool methods that may only be called by the factory owner\ninterface IUniswapV3PoolOwnerActions {\n /// @notice Set the denominator of the protocol's % share of the fees\n /// @param feeProtocol0 new protocol fee for token0 of the pool\n /// @param feeProtocol1 new protocol fee for token1 of the pool\n function setFeeProtocol(uint8 feeProtocol0, uint8 feeProtocol1) external;\n\n /// @notice Collect the protocol fee accrued to the pool\n /// @param recipient The address to which collected protocol fees should be sent\n /// @param amount0Requested The maximum amount of token0 to send, can be 0 to collect fees in only token1\n /// @param amount1Requested The maximum amount of token1 to send, can be 0 to collect fees in only token0\n /// @return amount0 The protocol fee collected in token0\n /// @return amount1 The protocol fee collected in token1\n function collectProtocol(\n address recipient,\n uint128 amount0Requested,\n uint128 amount1Requested\n ) external returns (uint128 amount0, uint128 amount1);\n}\n" - }, - "@uniswap/v3-core/contracts/interfaces/pool/IUniswapV3PoolEvents.sol": { - "content": "// SPDX-License-Identifier: GPL-2.0-or-later\npragma solidity >=0.5.0;\n\n/// @title Events emitted by a pool\n/// @notice Contains all events emitted by the pool\ninterface IUniswapV3PoolEvents {\n /// @notice Emitted exactly once by a pool when #initialize is first called on the pool\n /// @dev Mint/Burn/Swap cannot be emitted by the pool before Initialize\n /// @param sqrtPriceX96 The initial sqrt price of the pool, as a Q64.96\n /// @param tick The initial tick of the pool, i.e. log base 1.0001 of the starting price of the pool\n event Initialize(uint160 sqrtPriceX96, int24 tick);\n\n /// @notice Emitted when liquidity is minted for a given position\n /// @param sender The address that minted the liquidity\n /// @param owner The owner of the position and recipient of any minted liquidity\n /// @param tickLower The lower tick of the position\n /// @param tickUpper The upper tick of the position\n /// @param amount The amount of liquidity minted to the position range\n /// @param amount0 How much token0 was required for the minted liquidity\n /// @param amount1 How much token1 was required for the minted liquidity\n event Mint(\n address sender,\n address indexed owner,\n int24 indexed tickLower,\n int24 indexed tickUpper,\n uint128 amount,\n uint256 amount0,\n uint256 amount1\n );\n\n /// @notice Emitted when fees are collected by the owner of a position\n /// @dev Collect events may be emitted with zero amount0 and amount1 when the caller chooses not to collect fees\n /// @param owner The owner of the position for which fees are collected\n /// @param tickLower The lower tick of the position\n /// @param tickUpper The upper tick of the position\n /// @param amount0 The amount of token0 fees collected\n /// @param amount1 The amount of token1 fees collected\n event Collect(\n address indexed owner,\n address recipient,\n int24 indexed tickLower,\n int24 indexed tickUpper,\n uint128 amount0,\n uint128 amount1\n );\n\n /// @notice Emitted when a position's liquidity is removed\n /// @dev Does not withdraw any fees earned by the liquidity position, which must be withdrawn via #collect\n /// @param owner The owner of the position for which liquidity is removed\n /// @param tickLower The lower tick of the position\n /// @param tickUpper The upper tick of the position\n /// @param amount The amount of liquidity to remove\n /// @param amount0 The amount of token0 withdrawn\n /// @param amount1 The amount of token1 withdrawn\n event Burn(\n address indexed owner,\n int24 indexed tickLower,\n int24 indexed tickUpper,\n uint128 amount,\n uint256 amount0,\n uint256 amount1\n );\n\n /// @notice Emitted by the pool for any swaps between token0 and token1\n /// @param sender The address that initiated the swap call, and that received the callback\n /// @param recipient The address that received the output of the swap\n /// @param amount0 The delta of the token0 balance of the pool\n /// @param amount1 The delta of the token1 balance of the pool\n /// @param sqrtPriceX96 The sqrt(price) of the pool after the swap, as a Q64.96\n /// @param liquidity The liquidity of the pool after the swap\n /// @param tick The log base 1.0001 of price of the pool after the swap\n event Swap(\n address indexed sender,\n address indexed recipient,\n int256 amount0,\n int256 amount1,\n uint160 sqrtPriceX96,\n uint128 liquidity,\n int24 tick\n );\n\n /// @notice Emitted by the pool for any flashes of token0/token1\n /// @param sender The address that initiated the swap call, and that received the callback\n /// @param recipient The address that received the tokens from flash\n /// @param amount0 The amount of token0 that was flashed\n /// @param amount1 The amount of token1 that was flashed\n /// @param paid0 The amount of token0 paid for the flash, which can exceed the amount0 plus the fee\n /// @param paid1 The amount of token1 paid for the flash, which can exceed the amount1 plus the fee\n event Flash(\n address indexed sender,\n address indexed recipient,\n uint256 amount0,\n uint256 amount1,\n uint256 paid0,\n uint256 paid1\n );\n\n /// @notice Emitted by the pool for increases to the number of observations that can be stored\n /// @dev observationCardinalityNext is not the observation cardinality until an observation is written at the index\n /// just before a mint/swap/burn.\n /// @param observationCardinalityNextOld The previous value of the next observation cardinality\n /// @param observationCardinalityNextNew The updated value of the next observation cardinality\n event IncreaseObservationCardinalityNext(\n uint16 observationCardinalityNextOld,\n uint16 observationCardinalityNextNew\n );\n\n /// @notice Emitted when the protocol fee is changed by the pool\n /// @param feeProtocol0Old The previous value of the token0 protocol fee\n /// @param feeProtocol1Old The previous value of the token1 protocol fee\n /// @param feeProtocol0New The updated value of the token0 protocol fee\n /// @param feeProtocol1New The updated value of the token1 protocol fee\n event SetFeeProtocol(uint8 feeProtocol0Old, uint8 feeProtocol1Old, uint8 feeProtocol0New, uint8 feeProtocol1New);\n\n /// @notice Emitted when the collected protocol fees are withdrawn by the factory owner\n /// @param sender The address that collects the protocol fees\n /// @param recipient The address that receives the collected protocol fees\n /// @param amount0 The amount of token0 protocol fees that is withdrawn\n /// @param amount0 The amount of token1 protocol fees that is withdrawn\n event CollectProtocol(address indexed sender, address indexed recipient, uint128 amount0, uint128 amount1);\n}\n" - }, - "solidity/for-test/UniV3PairManagerForTest.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '@openzeppelin/contracts/token/ERC20/ERC20.sol';\nimport '@uniswap/v3-core/contracts/interfaces/IUniswapV3Pool.sol';\n\nimport '../contracts/libraries/LiquidityAmounts.sol';\nimport '../contracts/libraries/PoolAddress.sol';\nimport '../contracts/libraries/FixedPoint96.sol';\nimport '../contracts/libraries/FullMath.sol';\nimport '../contracts/libraries/TickMath.sol';\nimport '../contracts/UniV3PairManager.sol';\nimport '../interfaces/external/IWeth9.sol';\nimport '../interfaces/IUniV3PairManager.sol';\n\ncontract UniV3PairManagerForTest is UniV3PairManager {\n constructor(address _pool, address _governance) UniV3PairManager(_pool, _governance) {}\n\n function internalAddLiquidity(\n uint256 amount0Desired,\n uint256 amount1Desired,\n uint256 amount0Min,\n uint256 amount1Min\n )\n external\n returns (\n uint128 liquidity,\n uint256 amount0,\n uint256 amount1\n )\n {\n return _addLiquidity(amount0Desired, amount1Desired, amount0Min, amount1Min);\n }\n\n function internalPay(\n address token,\n address payer,\n address recipient,\n uint256 value\n ) external {\n return _pay(token, payer, recipient, value);\n }\n\n function internalMint(address dst, uint256 amount) external {\n return _mint(dst, amount);\n }\n\n function internalBurn(address dst, uint256 amount) external {\n return _burn(dst, amount);\n }\n\n function internalTransferTokens(\n address src,\n address dst,\n uint256 amount\n ) external {\n _transferTokens(src, dst, amount);\n }\n\n function internalSafeTransferFrom(\n address token,\n address from,\n address to,\n uint256 value\n ) external {\n _safeTransferFrom(token, from, to, value);\n }\n\n receive() external payable {}\n}\n" - }, - "@openzeppelin/contracts/token/ERC20/ERC20.sol": { - "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\nimport \"./IERC20.sol\";\nimport \"./extensions/IERC20Metadata.sol\";\nimport \"../../utils/Context.sol\";\n\n/**\n * @dev Implementation of the {IERC20} interface.\n *\n * This implementation is agnostic to the way tokens are created. This means\n * that a supply mechanism has to be added in a derived contract using {_mint}.\n * For a generic mechanism see {ERC20PresetMinterPauser}.\n *\n * TIP: For a detailed writeup see our guide\n * https://forum.zeppelin.solutions/t/how-to-implement-erc20-supply-mechanisms/226[How\n * to implement supply mechanisms].\n *\n * We have followed general OpenZeppelin Contracts guidelines: functions revert\n * instead returning `false` on failure. This behavior is nonetheless\n * conventional and does not conflict with the expectations of ERC20\n * applications.\n *\n * Additionally, an {Approval} event is emitted on calls to {transferFrom}.\n * This allows applications to reconstruct the allowance for all accounts just\n * by listening to said events. Other implementations of the EIP may not emit\n * these events, as it isn't required by the specification.\n *\n * Finally, the non-standard {decreaseAllowance} and {increaseAllowance}\n * functions have been added to mitigate the well-known issues around setting\n * allowances. See {IERC20-approve}.\n */\ncontract ERC20 is Context, IERC20, IERC20Metadata {\n mapping(address => uint256) private _balances;\n\n mapping(address => mapping(address => uint256)) private _allowances;\n\n uint256 private _totalSupply;\n\n string private _name;\n string private _symbol;\n\n /**\n * @dev Sets the values for {name} and {symbol}.\n *\n * The default value of {decimals} is 18. To select a different value for\n * {decimals} you should overload it.\n *\n * All two of these values are immutable: they can only be set once during\n * construction.\n */\n constructor(string memory name_, string memory symbol_) {\n _name = name_;\n _symbol = symbol_;\n }\n\n /**\n * @dev Returns the name of the token.\n */\n function name() public view virtual override returns (string memory) {\n return _name;\n }\n\n /**\n * @dev Returns the symbol of the token, usually a shorter version of the\n * name.\n */\n function symbol() public view virtual override returns (string memory) {\n return _symbol;\n }\n\n /**\n * @dev Returns the number of decimals used to get its user representation.\n * For example, if `decimals` equals `2`, a balance of `505` tokens should\n * be displayed to a user as `5.05` (`505 / 10 ** 2`).\n *\n * Tokens usually opt for a value of 18, imitating the relationship between\n * Ether and Wei. This is the value {ERC20} uses, unless this function is\n * overridden;\n *\n * NOTE: This information is only used for _display_ purposes: it in\n * no way affects any of the arithmetic of the contract, including\n * {IERC20-balanceOf} and {IERC20-transfer}.\n */\n function decimals() public view virtual override returns (uint8) {\n return 18;\n }\n\n /**\n * @dev See {IERC20-totalSupply}.\n */\n function totalSupply() public view virtual override returns (uint256) {\n return _totalSupply;\n }\n\n /**\n * @dev See {IERC20-balanceOf}.\n */\n function balanceOf(address account) public view virtual override returns (uint256) {\n return _balances[account];\n }\n\n /**\n * @dev See {IERC20-transfer}.\n *\n * Requirements:\n *\n * - `recipient` cannot be the zero address.\n * - the caller must have a balance of at least `amount`.\n */\n function transfer(address recipient, uint256 amount) public virtual override returns (bool) {\n _transfer(_msgSender(), recipient, amount);\n return true;\n }\n\n /**\n * @dev See {IERC20-allowance}.\n */\n function allowance(address owner, address spender) public view virtual override returns (uint256) {\n return _allowances[owner][spender];\n }\n\n /**\n * @dev See {IERC20-approve}.\n *\n * Requirements:\n *\n * - `spender` cannot be the zero address.\n */\n function approve(address spender, uint256 amount) public virtual override returns (bool) {\n _approve(_msgSender(), spender, amount);\n return true;\n }\n\n /**\n * @dev See {IERC20-transferFrom}.\n *\n * Emits an {Approval} event indicating the updated allowance. This is not\n * required by the EIP. See the note at the beginning of {ERC20}.\n *\n * Requirements:\n *\n * - `sender` and `recipient` cannot be the zero address.\n * - `sender` must have a balance of at least `amount`.\n * - the caller must have allowance for ``sender``'s tokens of at least\n * `amount`.\n */\n function transferFrom(\n address sender,\n address recipient,\n uint256 amount\n ) public virtual override returns (bool) {\n _transfer(sender, recipient, amount);\n\n uint256 currentAllowance = _allowances[sender][_msgSender()];\n require(currentAllowance >= amount, \"ERC20: transfer amount exceeds allowance\");\n unchecked {\n _approve(sender, _msgSender(), currentAllowance - amount);\n }\n\n return true;\n }\n\n /**\n * @dev Atomically increases the allowance granted to `spender` by the caller.\n *\n * This is an alternative to {approve} that can be used as a mitigation for\n * problems described in {IERC20-approve}.\n *\n * Emits an {Approval} event indicating the updated allowance.\n *\n * Requirements:\n *\n * - `spender` cannot be the zero address.\n */\n function increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool) {\n _approve(_msgSender(), spender, _allowances[_msgSender()][spender] + addedValue);\n return true;\n }\n\n /**\n * @dev Atomically decreases the allowance granted to `spender` by the caller.\n *\n * This is an alternative to {approve} that can be used as a mitigation for\n * problems described in {IERC20-approve}.\n *\n * Emits an {Approval} event indicating the updated allowance.\n *\n * Requirements:\n *\n * - `spender` cannot be the zero address.\n * - `spender` must have allowance for the caller of at least\n * `subtractedValue`.\n */\n function decreaseAllowance(address spender, uint256 subtractedValue) public virtual returns (bool) {\n uint256 currentAllowance = _allowances[_msgSender()][spender];\n require(currentAllowance >= subtractedValue, \"ERC20: decreased allowance below zero\");\n unchecked {\n _approve(_msgSender(), spender, currentAllowance - subtractedValue);\n }\n\n return true;\n }\n\n /**\n * @dev Moves `amount` of tokens from `sender` to `recipient`.\n *\n * This internal function is equivalent to {transfer}, and can be used to\n * e.g. implement automatic token fees, slashing mechanisms, etc.\n *\n * Emits a {Transfer} event.\n *\n * Requirements:\n *\n * - `sender` cannot be the zero address.\n * - `recipient` cannot be the zero address.\n * - `sender` must have a balance of at least `amount`.\n */\n function _transfer(\n address sender,\n address recipient,\n uint256 amount\n ) internal virtual {\n require(sender != address(0), \"ERC20: transfer from the zero address\");\n require(recipient != address(0), \"ERC20: transfer to the zero address\");\n\n _beforeTokenTransfer(sender, recipient, amount);\n\n uint256 senderBalance = _balances[sender];\n require(senderBalance >= amount, \"ERC20: transfer amount exceeds balance\");\n unchecked {\n _balances[sender] = senderBalance - amount;\n }\n _balances[recipient] += amount;\n\n emit Transfer(sender, recipient, amount);\n\n _afterTokenTransfer(sender, recipient, amount);\n }\n\n /** @dev Creates `amount` tokens and assigns them to `account`, increasing\n * the total supply.\n *\n * Emits a {Transfer} event with `from` set to the zero address.\n *\n * Requirements:\n *\n * - `account` cannot be the zero address.\n */\n function _mint(address account, uint256 amount) internal virtual {\n require(account != address(0), \"ERC20: mint to the zero address\");\n\n _beforeTokenTransfer(address(0), account, amount);\n\n _totalSupply += amount;\n _balances[account] += amount;\n emit Transfer(address(0), account, amount);\n\n _afterTokenTransfer(address(0), account, amount);\n }\n\n /**\n * @dev Destroys `amount` tokens from `account`, reducing the\n * total supply.\n *\n * Emits a {Transfer} event with `to` set to the zero address.\n *\n * Requirements:\n *\n * - `account` cannot be the zero address.\n * - `account` must have at least `amount` tokens.\n */\n function _burn(address account, uint256 amount) internal virtual {\n require(account != address(0), \"ERC20: burn from the zero address\");\n\n _beforeTokenTransfer(account, address(0), amount);\n\n uint256 accountBalance = _balances[account];\n require(accountBalance >= amount, \"ERC20: burn amount exceeds balance\");\n unchecked {\n _balances[account] = accountBalance - amount;\n }\n _totalSupply -= amount;\n\n emit Transfer(account, address(0), amount);\n\n _afterTokenTransfer(account, address(0), amount);\n }\n\n /**\n * @dev Sets `amount` as the allowance of `spender` over the `owner` s tokens.\n *\n * This internal function is equivalent to `approve`, and can be used to\n * e.g. set automatic allowances for certain subsystems, etc.\n *\n * Emits an {Approval} event.\n *\n * Requirements:\n *\n * - `owner` cannot be the zero address.\n * - `spender` cannot be the zero address.\n */\n function _approve(\n address owner,\n address spender,\n uint256 amount\n ) internal virtual {\n require(owner != address(0), \"ERC20: approve from the zero address\");\n require(spender != address(0), \"ERC20: approve to the zero address\");\n\n _allowances[owner][spender] = amount;\n emit Approval(owner, spender, amount);\n }\n\n /**\n * @dev Hook that is called before any transfer of tokens. This includes\n * minting and burning.\n *\n * Calling conditions:\n *\n * - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens\n * will be transferred to `to`.\n * - when `from` is zero, `amount` tokens will be minted for `to`.\n * - when `to` is zero, `amount` of ``from``'s tokens will be burned.\n * - `from` and `to` are never both zero.\n *\n * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].\n */\n function _beforeTokenTransfer(\n address from,\n address to,\n uint256 amount\n ) internal virtual {}\n\n /**\n * @dev Hook that is called after any transfer of tokens. This includes\n * minting and burning.\n *\n * Calling conditions:\n *\n * - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens\n * has been transferred to `to`.\n * - when `from` is zero, `amount` tokens have been minted for `to`.\n * - when `to` is zero, `amount` of ``from``'s tokens have been burned.\n * - `from` and `to` are never both zero.\n *\n * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].\n */\n function _afterTokenTransfer(\n address from,\n address to,\n uint256 amount\n ) internal virtual {}\n}\n" - }, - "solidity/contracts/libraries/LiquidityAmounts.sol": { - "content": "// SPDX-License-Identifier: GPL-2.0-or-later\npragma solidity >=0.8.4 <0.9.0;\n\nimport './FullMath.sol';\nimport './FixedPoint96.sol';\n\n// solhint-disable\nlibrary LiquidityAmounts {\n function toUint128(uint256 x) private pure returns (uint128 y) {\n require((y = uint128(x)) == x);\n }\n\n function getLiquidityForAmount0(\n uint160 sqrtRatioAX96,\n uint160 sqrtRatioBX96,\n uint256 amount0\n ) internal pure returns (uint128 liquidity) {\n if (sqrtRatioAX96 > sqrtRatioBX96) (sqrtRatioAX96, sqrtRatioBX96) = (sqrtRatioBX96, sqrtRatioAX96);\n uint256 intermediate = FullMath.mulDiv(sqrtRatioAX96, sqrtRatioBX96, FixedPoint96.Q96);\n return toUint128(FullMath.mulDiv(amount0, intermediate, sqrtRatioBX96 - sqrtRatioAX96));\n }\n\n function getLiquidityForAmount1(\n uint160 sqrtRatioAX96,\n uint160 sqrtRatioBX96,\n uint256 amount1\n ) internal pure returns (uint128 liquidity) {\n if (sqrtRatioAX96 > sqrtRatioBX96) (sqrtRatioAX96, sqrtRatioBX96) = (sqrtRatioBX96, sqrtRatioAX96);\n return toUint128(FullMath.mulDiv(amount1, FixedPoint96.Q96, sqrtRatioBX96 - sqrtRatioAX96));\n }\n\n function getLiquidityForAmounts(\n uint160 sqrtRatioX96,\n uint160 sqrtRatioAX96,\n uint160 sqrtRatioBX96,\n uint256 amount0,\n uint256 amount1\n ) internal pure returns (uint128 liquidity) {\n if (sqrtRatioAX96 > sqrtRatioBX96) (sqrtRatioAX96, sqrtRatioBX96) = (sqrtRatioBX96, sqrtRatioAX96);\n\n if (sqrtRatioX96 <= sqrtRatioAX96) {\n liquidity = getLiquidityForAmount0(sqrtRatioAX96, sqrtRatioBX96, amount0);\n } else if (sqrtRatioX96 < sqrtRatioBX96) {\n uint128 liquidity0 = getLiquidityForAmount0(sqrtRatioX96, sqrtRatioBX96, amount0);\n uint128 liquidity1 = getLiquidityForAmount1(sqrtRatioAX96, sqrtRatioX96, amount1);\n\n liquidity = liquidity0 < liquidity1 ? liquidity0 : liquidity1;\n } else {\n liquidity = getLiquidityForAmount1(sqrtRatioAX96, sqrtRatioBX96, amount1);\n }\n }\n\n function getAmount0ForLiquidity(\n uint160 sqrtRatioAX96,\n uint160 sqrtRatioBX96,\n uint128 liquidity\n ) internal pure returns (uint256 amount0) {\n if (sqrtRatioAX96 > sqrtRatioBX96) (sqrtRatioAX96, sqrtRatioBX96) = (sqrtRatioBX96, sqrtRatioAX96);\n\n return FullMath.mulDiv(uint256(liquidity) << FixedPoint96.RESOLUTION, sqrtRatioBX96 - sqrtRatioAX96, sqrtRatioBX96) / sqrtRatioAX96;\n }\n\n function getAmount1ForLiquidity(\n uint160 sqrtRatioAX96,\n uint160 sqrtRatioBX96,\n uint128 liquidity\n ) internal pure returns (uint256 amount1) {\n if (sqrtRatioAX96 > sqrtRatioBX96) (sqrtRatioAX96, sqrtRatioBX96) = (sqrtRatioBX96, sqrtRatioAX96);\n\n return FullMath.mulDiv(liquidity, sqrtRatioBX96 - sqrtRatioAX96, FixedPoint96.Q96);\n }\n\n function getAmountsForLiquidity(\n uint160 sqrtRatioX96,\n uint160 sqrtRatioAX96,\n uint160 sqrtRatioBX96,\n uint128 liquidity\n ) internal pure returns (uint256 amount0, uint256 amount1) {\n if (sqrtRatioAX96 > sqrtRatioBX96) (sqrtRatioAX96, sqrtRatioBX96) = (sqrtRatioBX96, sqrtRatioAX96);\n\n if (sqrtRatioX96 <= sqrtRatioAX96) {\n amount0 = getAmount0ForLiquidity(sqrtRatioAX96, sqrtRatioBX96, liquidity);\n } else if (sqrtRatioX96 < sqrtRatioBX96) {\n amount0 = getAmount0ForLiquidity(sqrtRatioX96, sqrtRatioBX96, liquidity);\n amount1 = getAmount1ForLiquidity(sqrtRatioAX96, sqrtRatioX96, liquidity);\n } else {\n amount1 = getAmount1ForLiquidity(sqrtRatioAX96, sqrtRatioBX96, liquidity);\n }\n }\n}\n" - }, - "solidity/contracts/libraries/PoolAddress.sol": { - "content": "// SPDX-License-Identifier: GPL-2.0-or-later\npragma solidity >=0.8.4 <0.9.0;\n\nlibrary PoolAddress {\n struct PoolKey {\n address token0;\n address token1;\n uint24 fee;\n }\n}\n" - }, - "solidity/contracts/libraries/FixedPoint96.sol": { - "content": "// SPDX-License-Identifier: GPL-2.0-or-later\npragma solidity >=0.8.4 <0.9.0;\n\nlibrary FixedPoint96 {\n // solhint-disable\n uint8 internal constant RESOLUTION = 96;\n uint256 internal constant Q96 = 0x1000000000000000000000000;\n}\n" - }, - "solidity/contracts/UniV3PairManager.sol": { - "content": "// SPDX-License-Identifier: MIT\n\n/*\n\nCoded for The Keep3r Network with ♥ by\n\n██████╗░███████╗███████╗██╗  ░██╗░░░░░░░██╗░█████╗░███╗░░██╗██████╗░███████╗██████╗░██╗░░░░░░█████╗░███╗░░██╗██████╗░\n██╔══██╗██╔════╝██╔════╝██║  ░██║░░██╗░░██║██╔══██╗████╗░██║██╔══██╗██╔════╝██╔══██╗██║░░░░░██╔══██╗████╗░██║██╔══██╗\n██║░░██║█████╗░░█████╗░░██║  ░╚██╗████╗██╔╝██║░░██║██╔██╗██║██║░░██║█████╗░░██████╔╝██║░░░░░███████║██╔██╗██║██║░░██║\n██║░░██║██╔══╝░░██╔══╝░░██║  ░░████╔═████║░██║░░██║██║╚████║██║░░██║██╔══╝░░██╔══██╗██║░░░░░██╔══██║██║╚████║██║░░██║\n██████╔╝███████╗██║░░░░░██║  ░░╚██╔╝░╚██╔╝░╚█████╔╝██║░╚███║██████╔╝███████╗██║░░██║███████╗██║░░██║██║░╚███║██████╔╝\n╚═════╝░╚══════╝╚═╝░░░░░╚═╝  ░░░╚═╝░░░╚═╝░░░╚════╝░╚═╝░░╚══╝╚═════╝░╚══════╝╚═╝░░╚═╝╚══════╝╚═╝░░╚═╝╚═╝░░╚══╝╚═════╝░\n\nhttps://defi.sucks\n\n*/\n\npragma solidity >=0.8.4 <0.9.0;\n\nimport '@openzeppelin/contracts/token/ERC20/ERC20.sol';\nimport '@uniswap/v3-core/contracts/interfaces/IUniswapV3Pool.sol';\n\nimport './libraries/LiquidityAmounts.sol';\nimport './libraries/PoolAddress.sol';\nimport './libraries/FixedPoint96.sol';\nimport './libraries/FullMath.sol';\nimport './libraries/TickMath.sol';\n\nimport '../interfaces/external/IWeth9.sol';\nimport '../interfaces/IUniV3PairManager.sol';\n\nimport './peripherals/Governable.sol';\n\ncontract UniV3PairManager is IUniV3PairManager, Governable {\n /// @inheritdoc IERC20Metadata\n string public override name;\n\n /// @inheritdoc IERC20Metadata\n string public override symbol;\n\n /// @inheritdoc IERC20\n uint256 public override totalSupply;\n\n /// @inheritdoc IPairManager\n address public immutable override factory;\n\n /// @inheritdoc IPairManager\n address public immutable override token0;\n\n /// @inheritdoc IPairManager\n address public immutable override token1;\n\n /// @inheritdoc IPairManager\n address public immutable override pool;\n\n /// @inheritdoc IUniV3PairManager\n uint24 public immutable override fee;\n\n /// @inheritdoc IUniV3PairManager\n uint160 public immutable override sqrtRatioAX96;\n\n /// @inheritdoc IUniV3PairManager\n uint160 public immutable override sqrtRatioBX96;\n\n /// @inheritdoc IUniV3PairManager\n int24 public immutable override tickLower;\n\n /// @inheritdoc IUniV3PairManager\n int24 public immutable override tickUpper;\n\n /// @inheritdoc IUniV3PairManager\n int24 public immutable override tickSpacing;\n\n /// @notice Uniswap's maximum tick\n /// @dev Due to tick spacing, pools with different fees may have differences between _MAX_TICK and tickUpper. Use tickUpper to find the max tick of the pool.\n int24 private constant _MAX_TICK = 887272;\n\n /// @inheritdoc IERC20Metadata\n //solhint-disable-next-line const-name-snakecase\n uint8 public constant override decimals = 18;\n\n /// @inheritdoc IERC20\n mapping(address => mapping(address => uint256)) public override allowance;\n\n /// @inheritdoc IERC20\n mapping(address => uint256) public override balanceOf;\n\n /// @notice Struct that contains token0, token1, and fee of the Uniswap pool\n PoolAddress.PoolKey private _poolKey;\n\n constructor(address _pool, address _governance) Governable(_governance) {\n uint24 _fee = IUniswapV3Pool(_pool).fee();\n address _token0 = IUniswapV3Pool(_pool).token0();\n address _token1 = IUniswapV3Pool(_pool).token1();\n int24 _tickSpacing = IUniswapV3Pool(_pool).tickSpacing();\n int24 _tickUpper = _MAX_TICK - (_MAX_TICK % _tickSpacing);\n int24 _tickLower = -_tickUpper;\n\n factory = msg.sender;\n pool = _pool;\n fee = _fee;\n tickSpacing = _tickSpacing;\n tickUpper = _tickUpper;\n tickLower = _tickLower;\n token0 = _token0;\n token1 = _token1;\n name = string(abi.encodePacked('Keep3rLP - ', ERC20(_token0).symbol(), '/', ERC20(_token1).symbol()));\n symbol = string(abi.encodePacked('kLP-', ERC20(_token0).symbol(), '/', ERC20(_token1).symbol()));\n\n sqrtRatioAX96 = TickMath.getSqrtRatioAtTick(_tickLower);\n sqrtRatioBX96 = TickMath.getSqrtRatioAtTick(_tickUpper);\n _poolKey = PoolAddress.PoolKey({token0: _token0, token1: _token1, fee: _fee});\n }\n\n // This low-level function should be called from a contract which performs important safety checks\n /// @inheritdoc IUniV3PairManager\n function mint(\n uint256 amount0Desired,\n uint256 amount1Desired,\n uint256 amount0Min,\n uint256 amount1Min,\n address to\n ) external override returns (uint128 liquidity) {\n (liquidity, , ) = _addLiquidity(amount0Desired, amount1Desired, amount0Min, amount1Min);\n _mint(to, liquidity);\n }\n\n /// @inheritdoc IUniV3PairManager\n function uniswapV3MintCallback(\n uint256 amount0Owed,\n uint256 amount1Owed,\n bytes calldata data\n ) external override {\n MintCallbackData memory decoded = abi.decode(data, (MintCallbackData));\n if (msg.sender != pool) revert OnlyPool();\n if (amount0Owed > 0) _pay(decoded._poolKey.token0, decoded.payer, pool, amount0Owed);\n if (amount1Owed > 0) _pay(decoded._poolKey.token1, decoded.payer, pool, amount1Owed);\n }\n\n /// @inheritdoc IUniV3PairManager\n function burn(\n uint128 liquidity,\n uint256 amount0Min,\n uint256 amount1Min,\n address to\n ) external override returns (uint256 amount0, uint256 amount1) {\n (amount0, amount1) = IUniswapV3Pool(pool).burn(tickLower, tickUpper, liquidity);\n\n if (amount0 < amount0Min || amount1 < amount1Min) revert ExcessiveSlippage();\n\n IUniswapV3Pool(pool).collect(to, tickLower, tickUpper, uint128(amount0), uint128(amount1));\n _burn(msg.sender, liquidity);\n }\n\n /// @inheritdoc IUniV3PairManager\n function collect() external override onlyGovernance returns (uint256 amount0, uint256 amount1) {\n (, , , uint128 tokensOwed0, uint128 tokensOwed1) = IUniswapV3Pool(pool).positions(\n keccak256(abi.encodePacked(address(this), tickLower, tickUpper))\n );\n (amount0, amount1) = IUniswapV3Pool(pool).collect(governance, tickLower, tickUpper, tokensOwed0, tokensOwed1);\n }\n\n /// @inheritdoc IUniV3PairManager\n function position()\n external\n view\n override\n returns (\n uint128 liquidity,\n uint256 feeGrowthInside0LastX128,\n uint256 feeGrowthInside1LastX128,\n uint128 tokensOwed0,\n uint128 tokensOwed1\n )\n {\n (liquidity, feeGrowthInside0LastX128, feeGrowthInside1LastX128, tokensOwed0, tokensOwed1) = IUniswapV3Pool(pool).positions(\n keccak256(abi.encodePacked(address(this), tickLower, tickUpper))\n );\n }\n\n /// @inheritdoc IERC20\n function approve(address spender, uint256 amount) external override returns (bool) {\n allowance[msg.sender][spender] = amount;\n\n emit Approval(msg.sender, spender, amount);\n return true;\n }\n\n /// @inheritdoc IERC20\n function transfer(address to, uint256 amount) external override returns (bool) {\n _transferTokens(msg.sender, to, amount);\n return true;\n }\n\n /// @inheritdoc IERC20\n function transferFrom(\n address from,\n address to,\n uint256 amount\n ) external override returns (bool) {\n address spender = msg.sender;\n uint256 spenderAllowance = allowance[from][spender];\n\n if (spender != from && spenderAllowance != type(uint256).max) {\n uint256 newAllowance = spenderAllowance - amount;\n allowance[from][spender] = newAllowance;\n\n emit Approval(from, spender, newAllowance);\n }\n\n _transferTokens(from, to, amount);\n return true;\n }\n\n /// @notice Adds liquidity to an initialized pool\n /// @dev Reverts if the returned amount0 is less than amount0Min or if amount1 is less than amount1Min\n /// @dev This function calls the mint function of the corresponding Uniswap pool, which in turn calls UniswapV3Callback\n /// @param amount0Desired The amount of token0 we would like to provide\n /// @param amount1Desired The amount of token1 we would like to provide\n /// @param amount0Min The minimum amount of token0 we want to provide\n /// @param amount1Min The minimum amount of token1 we want to provide\n /// @return liquidity The calculated liquidity we get for the token amounts we provided\n /// @return amount0 The amount of token0 we ended up providing\n /// @return amount1 The amount of token1 we ended up providing\n function _addLiquidity(\n uint256 amount0Desired,\n uint256 amount1Desired,\n uint256 amount0Min,\n uint256 amount1Min\n )\n internal\n returns (\n uint128 liquidity,\n uint256 amount0,\n uint256 amount1\n )\n {\n (uint160 sqrtPriceX96, , , , , , ) = IUniswapV3Pool(pool).slot0();\n\n liquidity = LiquidityAmounts.getLiquidityForAmounts(sqrtPriceX96, sqrtRatioAX96, sqrtRatioBX96, amount0Desired, amount1Desired);\n\n (amount0, amount1) = IUniswapV3Pool(pool).mint(\n address(this),\n tickLower,\n tickUpper,\n liquidity,\n abi.encode(MintCallbackData({_poolKey: _poolKey, payer: msg.sender}))\n );\n\n if (amount0 < amount0Min || amount1 < amount1Min) revert ExcessiveSlippage();\n }\n\n /// @notice Transfers the passed-in token from the payer to the recipient for the corresponding value\n /// @param token The token to be transferred to the recipient\n /// @param from The address of the payer\n /// @param to The address of the passed-in tokens recipient\n /// @param value How much of that token to be transferred from payer to the recipient\n function _pay(\n address token,\n address from,\n address to,\n uint256 value\n ) internal {\n _safeTransferFrom(token, from, to, value);\n }\n\n /// @notice Mints Keep3r credits to the passed-in address of recipient and increases total supply of Keep3r credits by the corresponding amount\n /// @param to The recipient of the Keep3r credits\n /// @param amount The amount Keep3r credits to be minted to the recipient\n function _mint(address to, uint256 amount) internal {\n totalSupply += amount;\n balanceOf[to] += amount;\n emit Transfer(address(0), to, amount);\n }\n\n /// @notice Burns Keep3r credits to the passed-in address of recipient and reduces total supply of Keep3r credits by the corresponding amount\n /// @param to The address that will get its Keep3r credits burned\n /// @param amount The amount Keep3r credits to be burned from the recipient/recipient\n function _burn(address to, uint256 amount) internal {\n totalSupply -= amount;\n balanceOf[to] -= amount;\n emit Transfer(to, address(0), amount);\n }\n\n /// @notice Transfers amount of Keep3r credits between two addresses\n /// @param from The user that transfers the Keep3r credits\n /// @param to The user that receives the Keep3r credits\n /// @param amount The amount of Keep3r credits to be transferred\n function _transferTokens(\n address from,\n address to,\n uint256 amount\n ) internal {\n balanceOf[from] -= amount;\n balanceOf[to] += amount;\n\n emit Transfer(from, to, amount);\n }\n\n /// @notice Transfers the passed-in token from the specified \"from\" to the specified \"to\" for the corresponding value\n /// @dev Reverts with IUniV3PairManager#UnsuccessfulTransfer if the transfer was not successful,\n /// or if the passed data length is different than 0 and the decoded data is not a boolean\n /// @param token The token to be transferred to the specified \"to\"\n /// @param from The address which is going to transfer the tokens\n /// @param value How much of that token to be transferred from \"from\" to \"to\"\n function _safeTransferFrom(\n address token,\n address from,\n address to,\n uint256 value\n ) internal {\n // solhint-disable-next-line avoid-low-level-calls\n (bool success, bytes memory data) = token.call(abi.encodeWithSelector(IERC20.transferFrom.selector, from, to, value));\n if (!success || (data.length != 0 && !abi.decode(data, (bool)))) revert UnsuccessfulTransfer();\n }\n}\n" - }, - "solidity/interfaces/external/IWeth9.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '@openzeppelin/contracts/token/ERC20/IERC20.sol';\n\ninterface IWeth9 is IERC20 {\n function deposit() external payable;\n\n function withdraw(uint256) external;\n}\n" - }, - "solidity/interfaces/IUniV3PairManager.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport './IPairManager.sol';\nimport '../contracts/libraries/PoolAddress.sol';\nimport '@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol';\nimport './peripherals/IGovernable.sol';\n\n/// @title Pair Manager contract\n/// @notice Creates a UniswapV3 position, and tokenizes in an ERC20 manner\n/// so that the user can use it as liquidity for a Keep3rJob\ninterface IUniV3PairManager is IGovernable, IPairManager {\n // Structs\n\n /// @notice The data to be decoded by the UniswapV3MintCallback function\n struct MintCallbackData {\n PoolAddress.PoolKey _poolKey; // Struct that contains token0, token1, and fee of the pool passed into the constructor\n address payer; // The address of the payer, which will be the msg.sender of the mint function\n }\n\n // Variables\n\n /// @notice The fee of the Uniswap pool passed into the constructor\n /// @return _fee The fee of the Uniswap pool passed into the constructor\n function fee() external view returns (uint24 _fee);\n\n /// @notice Highest tick in the Uniswap's curve\n /// @return _tickUpper The highest tick in the Uniswap's curve\n function tickUpper() external view returns (int24 _tickUpper);\n\n /// @notice Lowest tick in the Uniswap's curve\n /// @return _tickLower The lower tick in the Uniswap's curve\n function tickLower() external view returns (int24 _tickLower);\n\n /// @notice The pair tick spacing\n /// @return _tickSpacing The pair tick spacing\n function tickSpacing() external view returns (int24 _tickSpacing);\n\n /// @notice The sqrtRatioAX96 at the lowest tick (-887200) of the Uniswap pool\n /// @return _sqrtPriceA96 A Fixed point Q64.96 number representing the sqrt of the ratio of the two assets (token1/token0)\n /// at the lowest tick\n function sqrtRatioAX96() external view returns (uint160 _sqrtPriceA96);\n\n /// @notice The sqrtRatioBX96 at the highest tick (887200) of the Uniswap pool\n /// @return _sqrtPriceBX96 A Fixed point Q64.96 number representing the sqrt of the ratio of the two assets (token1/token0)\n /// at the highest tick\n function sqrtRatioBX96() external view returns (uint160 _sqrtPriceBX96);\n\n // Errors\n\n /// @notice Throws when the caller of the function is not the pool\n error OnlyPool();\n\n /// @notice Throws when the slippage exceeds what the user is comfortable with\n error ExcessiveSlippage();\n\n /// @notice Throws when a transfer is unsuccessful\n error UnsuccessfulTransfer();\n\n // Methods\n\n /// @notice This function is called after a user calls IUniV3PairManager#mint function\n /// It ensures that any tokens owed to the pool are paid by the msg.sender of IUniV3PairManager#mint function\n /// @param amount0Owed The amount of token0 due to the pool for the minted liquidity\n /// @param amount1Owed The amount of token1 due to the pool for the minted liquidity\n /// @param data The encoded token0, token1, fee (_poolKey) and the payer (msg.sender) of the IUniV3PairManager#mint function\n function uniswapV3MintCallback(\n uint256 amount0Owed,\n uint256 amount1Owed,\n bytes calldata data\n ) external;\n\n /// @notice Mints kLP tokens to an address according to the liquidity the msg.sender provides to the UniswapV3 pool\n /// @dev Triggers UniV3PairManager#uniswapV3MintCallback\n /// @param amount0Desired The amount of token0 we would like to provide\n /// @param amount1Desired The amount of token1 we would like to provide\n /// @param amount0Min The minimum amount of token0 we want to provide\n /// @param amount1Min The minimum amount of token1 we want to provide\n /// @param to The address to which the kLP tokens are going to be minted to\n /// @return liquidity kLP tokens sent in exchange for the provision of tokens\n function mint(\n uint256 amount0Desired,\n uint256 amount1Desired,\n uint256 amount0Min,\n uint256 amount1Min,\n address to\n ) external returns (uint128 liquidity);\n\n /// @notice Returns the pair manager's position in the corresponding UniswapV3 pool\n /// @return liquidity The amount of liquidity provided to the UniswapV3 pool by the pair manager\n /// @return feeGrowthInside0LastX128 The fee growth of token0 as of the last action on the individual position\n /// @return feeGrowthInside1LastX128 The fee growth of token1 as of the last action on the individual position\n /// @return tokensOwed0 The uncollected amount of token0 owed to the position as of the last computation\n /// @return tokensOwed1 The uncollected amount of token1 owed to the position as of the last computation\n function position()\n external\n view\n returns (\n uint128 liquidity,\n uint256 feeGrowthInside0LastX128,\n uint256 feeGrowthInside1LastX128,\n uint128 tokensOwed0,\n uint128 tokensOwed1\n );\n\n /// @notice Calls the UniswapV3 pool's collect function, which collects up to a maximum amount of fees\n // owed to a specific position to the recipient, in this case, that recipient is the pair manager\n /// @dev The collected fees will be sent to governance\n /// @return amount0 The amount of fees collected in token0\n /// @return amount1 The amount of fees collected in token1\n function collect() external returns (uint256 amount0, uint256 amount1);\n\n /// @notice Burns the corresponding amount of kLP tokens from the msg.sender and withdraws the specified liquidity\n // in the entire range\n /// @param liquidity The amount of liquidity to be burned\n /// @param amount0Min The minimum amount of token0 we want to send to the recipient (to)\n /// @param amount1Min The minimum amount of token1 we want to send to the recipient (to)\n /// @param to The address that will receive the due fees\n /// @return amount0 The calculated amount of token0 that will be sent to the recipient\n /// @return amount1 The calculated amount of token1 that will be sent to the recipient\n function burn(\n uint128 liquidity,\n uint256 amount0Min,\n uint256 amount1Min,\n address to\n ) external returns (uint256 amount0, uint256 amount1);\n}\n" - }, - "@openzeppelin/contracts/utils/Context.sol": { - "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Provides information about the current execution context, including the\n * sender of the transaction and its data. While these are generally available\n * via msg.sender and msg.data, they should not be accessed in such a direct\n * manner, since when dealing with meta-transactions the account sending and\n * paying for execution may not be the actual sender (as far as an application\n * is concerned).\n *\n * This contract is only required for intermediate, library-like contracts.\n */\nabstract contract Context {\n function _msgSender() internal view virtual returns (address) {\n return msg.sender;\n }\n\n function _msgData() internal view virtual returns (bytes calldata) {\n return msg.data;\n }\n}\n" - }, - "solidity/interfaces/IPairManagerFactory.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport './peripherals/IGovernable.sol';\n\n/// @title Factory of Pair Managers\n/// @notice This contract creates new pair managers\ninterface IPairManagerFactory is IGovernable {\n // Variables\n\n /// @notice Maps the address of a Uniswap pool, to the address of the corresponding PairManager\n /// For example, the uniswap address of DAI-WETH, will return the Keep3r/DAI-WETH pair manager address\n /// @param _pool The address of the Uniswap pool\n /// @return _pairManager The address of the corresponding pair manager\n function pairManagers(address _pool) external view returns (address _pairManager);\n\n // Events\n\n /// @notice Emitted when a new pair manager is created\n /// @param _pool The address of the corresponding Uniswap pool\n /// @param _pairManager The address of the just-created pair manager\n event PairCreated(address _pool, address _pairManager);\n\n // Errors\n\n /// @notice Throws an error if the pair manager is already initialized\n error AlreadyInitialized();\n\n /// @notice Throws an error if the caller is not the owner\n error OnlyOwner();\n\n // Methods\n\n /// @notice Creates a new pair manager based on the address of a Uniswap pool\n /// For example, the uniswap address of DAI-WETH, will create the Keep3r/DAI-WETH pool\n /// @param _pool The address of the Uniswap pool the pair manager will be based of\n /// @return _pairManager The address of the just-created pair manager\n function createPairManager(address _pool) external returns (address _pairManager);\n}\n" - }, - "solidity/contracts/UniV3PairManagerFactory.sol": { - "content": "// SPDX-License-Identifier: MIT\n\n/*\n\nCoded for The Keep3r Network with ♥ by\n\n██████╗░███████╗███████╗██╗  ░██╗░░░░░░░██╗░█████╗░███╗░░██╗██████╗░███████╗██████╗░██╗░░░░░░█████╗░███╗░░██╗██████╗░\n██╔══██╗██╔════╝██╔════╝██║  ░██║░░██╗░░██║██╔══██╗████╗░██║██╔══██╗██╔════╝██╔══██╗██║░░░░░██╔══██╗████╗░██║██╔══██╗\n██║░░██║█████╗░░█████╗░░██║  ░╚██╗████╗██╔╝██║░░██║██╔██╗██║██║░░██║█████╗░░██████╔╝██║░░░░░███████║██╔██╗██║██║░░██║\n██║░░██║██╔══╝░░██╔══╝░░██║  ░░████╔═████║░██║░░██║██║╚████║██║░░██║██╔══╝░░██╔══██╗██║░░░░░██╔══██║██║╚████║██║░░██║\n██████╔╝███████╗██║░░░░░██║  ░░╚██╔╝░╚██╔╝░╚█████╔╝██║░╚███║██████╔╝███████╗██║░░██║███████╗██║░░██║██║░╚███║██████╔╝\n╚═════╝░╚══════╝╚═╝░░░░░╚═╝  ░░░╚═╝░░░╚═╝░░░╚════╝░╚═╝░░╚══╝╚═════╝░╚══════╝╚═╝░░╚═╝╚══════╝╚═╝░░╚═╝╚═╝░░╚══╝╚═════╝░\n\nhttps://defi.sucks\n\n*/\n\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../interfaces/IPairManagerFactory.sol';\nimport './UniV3PairManager.sol';\nimport './peripherals/Governable.sol';\n\n/// @title Factory of Pair Managers\n/// @notice This contract creates new pair managers\ncontract UniV3PairManagerFactory is IPairManagerFactory, Governable {\n mapping(address => address) public override pairManagers;\n\n constructor(address _governance) Governable(_governance) {}\n\n ///@inheritdoc IPairManagerFactory\n function createPairManager(address _pool) external override returns (address _pairManager) {\n if (pairManagers[_pool] != address(0)) revert AlreadyInitialized();\n _pairManager = address(new UniV3PairManager(_pool, governance));\n pairManagers[_pool] = _pairManager;\n emit PairCreated(_pool, _pairManager);\n }\n}\n" - }, - "solidity/for-test/peripherals/GovernableForTest.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../../contracts/peripherals/Governable.sol';\n\ncontract GovernableForTest is Governable {\n constructor(address _governor) Governable(_governor) {}\n}\n" - }, - "solidity/for-test/ERC20ForTest.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '@openzeppelin/contracts/token/ERC20/ERC20.sol';\n\ncontract ERC20ForTest is ERC20 {\n constructor(\n string memory _name,\n string memory _symbol,\n address _initialAccount,\n uint256 _initialBalance\n ) ERC20(_name, _symbol) {\n _mint(_initialAccount, _initialBalance);\n }\n\n function mint(address _account, uint256 _amount) public {\n _mint(_account, _amount);\n }\n\n function burn(address _account, uint256 _amount) public {\n _burn(_account, _amount);\n }\n\n function transferInternal(\n address _from,\n address _to,\n uint256 _value\n ) public {\n _transfer(_from, _to, _value);\n }\n\n function approveInternal(\n address _owner,\n address _spender,\n uint256 _value\n ) public {\n _approve(_owner, _spender, _value);\n }\n\n function deposit(uint256 _amount) external payable {\n // Function added for compatibility with WETH\n }\n}\n" - }, - "solidity/for-test/peripherals/keepers/Keep3rKeeperFundableForTest.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../../../contracts/peripherals/keepers/Keep3rKeeperFundable.sol';\n\ncontract Keep3rKeeperFundableForTest is Keep3rKeeperFundable {\n using EnumerableSet for EnumerableSet.AddressSet;\n\n constructor(\n address _kph,\n address _keep3rV1,\n address _keep3rV1Proxy,\n address _kp3rWethPool\n ) Keep3rParameters(_kph, _keep3rV1, _keep3rV1Proxy, _kp3rWethPool) Keep3rRoles(msg.sender) {}\n\n function isKeeper(address _keeper) external view returns (bool) {\n return _keepers.contains(_keeper);\n }\n\n function setJob(address job) external {\n _jobs.add(job);\n }\n}\n" - }, - "solidity/for-test/peripherals/jobs/Keep3rJobWorkableForTest.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../../../contracts/peripherals/jobs/Keep3rJobWorkable.sol';\n\ncontract Keep3rJobWorkableForTest is Keep3rJobWorkable {\n using EnumerableSet for EnumerableSet.AddressSet;\n\n constructor(\n address _keep3rHelper,\n address _keep3rV1,\n address _keep3rV1Proxy,\n address _kp3rWethPool\n ) Keep3rParameters(_keep3rHelper, _keep3rV1, _keep3rV1Proxy, _kp3rWethPool) Keep3rRoles(msg.sender) {}\n\n function setJob(address _job) external {\n _jobs.add(_job);\n }\n\n function setKeeper(address _keeper) external {\n _keepers.add(_keeper);\n }\n\n function setApprovedLiquidity(address _liquidity) external {\n _approvedLiquidities.add(_liquidity);\n }\n\n function setJobLiquidity(address _job, address _liquidity) external {\n _jobLiquidities[_job].add(_liquidity);\n }\n\n function viewJobLiquidityCredits(address _job) external view returns (uint256) {\n return _jobLiquidityCredits[_job];\n }\n\n function viewJobPeriodCredits(address _job) external view returns (uint256) {\n return _jobPeriodCredits[_job];\n }\n\n function viewTickCache(address _liquidity) external view returns (TickCache memory _tickCache) {\n _tickCache = _tick[_liquidity];\n }\n\n function viewGas() external view returns (uint256) {\n return _initialGas;\n }\n\n receive() external payable {}\n}\n" - }, - "solidity/for-test/peripherals/jobs/Keep3rJobManagerForTest.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../../../contracts/peripherals/jobs/Keep3rJobManager.sol';\n\ncontract Keep3rJobManagerForTest is Keep3rJobManager {\n using EnumerableSet for EnumerableSet.AddressSet;\n\n constructor(\n address _keep3rHelper,\n address _keep3rV1,\n address _keep3rV1Proxy,\n address _kp3rWethPool\n ) Keep3rParameters(_keep3rHelper, _keep3rV1, _keep3rV1Proxy, _kp3rWethPool) Keep3rRoles(msg.sender) {}\n\n function isJob(address _job) external view returns (bool _isJob) {\n _isJob = _jobs.contains(_job);\n }\n}\n" - }, - "solidity/for-test/peripherals/Keep3rParametersForTest.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../../contracts/peripherals/Keep3rParameters.sol';\n\ncontract Keep3rParametersForTest is Keep3rParameters {\n constructor(\n address _keep3rHelper,\n address _keep3rV1,\n address _keep3rV1Proxy,\n address _kp3rWethPool\n ) Keep3rParameters(_keep3rHelper, _keep3rV1, _keep3rV1Proxy, _kp3rWethPool) Keep3rRoles(msg.sender) {}\n\n function viewLiquidityPool(address _pool) public view returns (address) {\n return _liquidityPool[_pool];\n }\n\n function viewIsKP3RToken0(address _pool) public view returns (bool) {\n return _isKP3RToken0[_pool];\n }\n}\n" - }, - "solidity/for-test/peripherals/Keep3rDisputableForTest.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../../contracts/peripherals/Keep3rDisputable.sol';\n\ncontract Keep3rDisputableForTest is Keep3rDisputable {\n constructor() Keep3rRoles(msg.sender) {}\n}\n" - }, - "solidity/for-test/peripherals/keepers/Keep3rKeeperDisputableForTest.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../../../contracts/peripherals/keepers/Keep3rKeeperDisputable.sol';\n\ncontract Keep3rKeeperDisputableForTest is Keep3rKeeperDisputable {\n using EnumerableSet for EnumerableSet.AddressSet;\n\n constructor(\n address _kph,\n address _keep3rV1,\n address _keep3rV1Proxy,\n address _kp3rWethPool\n ) Keep3rParameters(_kph, _keep3rV1, _keep3rV1Proxy, _kp3rWethPool) Keep3rRoles(msg.sender) {}\n\n function setKeeper(address _keeper) external {\n _keepers.add(_keeper);\n }\n\n function internalSlash(\n address _bonded,\n address _keeper,\n uint256 _bondAmount,\n uint256 _unbondAmount\n ) external {\n _slash(_bonded, _keeper, _bondAmount, _unbondAmount);\n }\n\n function isKeeper(address _address) external view returns (bool _isKeeper) {\n _isKeeper = _keepers.contains(_address);\n }\n}\n" - }, - "solidity/for-test/peripherals/Keep3rAccountanceForTest.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../../contracts/peripherals/Keep3rAccountance.sol';\n\ncontract Keep3rAccountanceForTest is Keep3rAccountance {\n using EnumerableSet for EnumerableSet.AddressSet;\n\n function setJob(address job) external {\n _jobs.add(job);\n }\n\n function setKeeper(address keeper) external {\n _keepers.add(keeper);\n }\n}\n" - }, - "solidity/for-test/peripherals/jobs/Keep3rJobFundableLiquidityForTest.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../../../contracts/peripherals/jobs/Keep3rJobFundableLiquidity.sol';\n\ncontract Keep3rJobFundableLiquidityForTest is Keep3rJobFundableLiquidity {\n using EnumerableSet for EnumerableSet.AddressSet;\n\n constructor(\n address _kph,\n address _keep3rV1,\n address _keep3rV1Proxy,\n address _kp3rWethPool\n ) Keep3rParameters(_kph, _keep3rV1, _keep3rV1Proxy, _kp3rWethPool) Keep3rRoles(msg.sender) {}\n\n function setJob(address _job) external {\n _jobs.add(_job);\n }\n\n function setJobLiquidity(address _job, address _liquidity) external returns (bool) {\n return _jobLiquidities[_job].add(_liquidity);\n }\n\n function setApprovedLiquidity(address _liquidity) external {\n _approvedLiquidities.add(_liquidity);\n }\n\n function setRevokedLiquidity(address _liquidity) external {\n _approvedLiquidities.remove(_liquidity);\n }\n\n function viewTickCache(address _liquidity) external view returns (TickCache memory _tickCache) {\n _tickCache = _tick[_liquidity];\n }\n\n function viewTickOrder(address _liquidity) external view returns (bool) {\n return _isKP3RToken0[_liquidity];\n }\n\n function internalJobLiquidities(address _job) external view returns (address[] memory _list) {\n _list = _jobLiquidities[_job].values();\n }\n\n function internalSettleJobAccountance(address _job) external {\n _settleJobAccountance(_job);\n }\n}\n" - }, - "solidity/for-test/peripherals/jobs/Keep3rJobMigrationForTest.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../../../contracts/peripherals/jobs/Keep3rJobMigration.sol';\n\ncontract Keep3rJobMigrationForTest is Keep3rJobMigration {\n using EnumerableSet for EnumerableSet.AddressSet;\n\n mapping(address => uint256) public settleJobAccountanceCallCount;\n\n constructor(\n address _kph,\n address _keep3rV1,\n address _keep3rV1Proxy,\n address _kp3rWethPool\n ) Keep3rParameters(_kph, _keep3rV1, _keep3rV1Proxy, _kp3rWethPool) Keep3rRoles(msg.sender) {}\n\n function setJobToken(address _job, address _token) external {\n _jobTokens[_job].add(_token);\n }\n\n function setJobLiquidity(address _job, address _liquidity) external {\n _jobLiquidities[_job].add(_liquidity);\n }\n\n function viewJobTokenListLength(address _job) external view returns (uint256) {\n return _jobTokens[_job].length();\n }\n\n function viewJobLiquidityList(address _job) external view returns (address[] memory _list) {\n _list = _jobLiquidities[_job].values();\n }\n\n function viewJobPeriodCredits(address _job) external view returns (uint256) {\n return _jobPeriodCredits[_job];\n }\n\n function viewJobLiquidityCredits(address _job) external view returns (uint256) {\n return _jobLiquidityCredits[_job];\n }\n\n function viewMigrationCreatedAt(address _fromJob, address _toJob) external view returns (uint256) {\n return _migrationCreatedAt[_fromJob][_toJob];\n }\n\n function isJob(address _job) external view returns (bool) {\n return _jobs.contains(_job);\n }\n\n function _settleJobAccountance(address _job) internal override {\n settleJobAccountanceCallCount[_job]++;\n }\n}\n" - }, - "solidity/for-test/peripherals/jobs/Keep3rJobFundableCreditsForTest.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../../../contracts/peripherals/jobs/Keep3rJobFundableCredits.sol';\n\ncontract Keep3rJobFundableCreditsForTest is Keep3rJobFundableCredits {\n using EnumerableSet for EnumerableSet.AddressSet;\n\n constructor(\n address _kph,\n address _keep3rV1,\n address _keep3rV1Proxy,\n address _kp3rWethPool\n ) Keep3rParameters(_kph, _keep3rV1, _keep3rV1Proxy, _kp3rWethPool) Keep3rRoles(msg.sender) {}\n\n function setJob(address _job, address _jobOwner) external {\n _jobs.add(_job);\n jobOwner[_job] = _jobOwner;\n }\n\n function setJobToken(address _job, address _token) external {\n _jobTokens[_job].add(_token);\n }\n\n function isJobToken(address _job, address _token) external view returns (bool _contains) {\n _contains = _jobTokens[_job].contains(_token);\n }\n}\n" - }, - "solidity/contracts/Keep3rHelper.sol": { - "content": "// SPDX-License-Identifier: MIT\n\n/*\n\nCoded for The Keep3r Network with ♥ by\n\n██████╗░███████╗███████╗██╗  ░██╗░░░░░░░██╗░█████╗░███╗░░██╗██████╗░███████╗██████╗░██╗░░░░░░█████╗░███╗░░██╗██████╗░\n██╔══██╗██╔════╝██╔════╝██║  ░██║░░██╗░░██║██╔══██╗████╗░██║██╔══██╗██╔════╝██╔══██╗██║░░░░░██╔══██╗████╗░██║██╔══██╗\n██║░░██║█████╗░░█████╗░░██║  ░╚██╗████╗██╔╝██║░░██║██╔██╗██║██║░░██║█████╗░░██████╔╝██║░░░░░███████║██╔██╗██║██║░░██║\n██║░░██║██╔══╝░░██╔══╝░░██║  ░░████╔═████║░██║░░██║██║╚████║██║░░██║██╔══╝░░██╔══██╗██║░░░░░██╔══██║██║╚████║██║░░██║\n██████╔╝███████╗██║░░░░░██║  ░░╚██╔╝░╚██╔╝░╚█████╔╝██║░╚███║██████╔╝███████╗██║░░██║███████╗██║░░██║██║░╚███║██████╔╝\n╚═════╝░╚══════╝╚═╝░░░░░╚═╝  ░░░╚═╝░░░╚═╝░░░╚════╝░╚═╝░░╚══╝╚═════╝░╚══════╝╚═╝░░╚═╝╚══════╝╚═╝░░╚═╝╚═╝░░╚══╝╚═════╝░\n\nhttps://defi.sucks\n\n*/\n\npragma solidity >=0.8.7 <0.9.0;\n\nimport './libraries/FullMath.sol';\nimport './libraries/TickMath.sol';\nimport '../interfaces/IKeep3r.sol';\nimport '../interfaces/IKeep3rHelper.sol';\nimport './Keep3rHelperParameters.sol';\n\nimport '@openzeppelin/contracts/utils/math/Math.sol';\nimport '@uniswap/v3-core/contracts/interfaces/IUniswapV3Pool.sol';\n\ncontract Keep3rHelper is IKeep3rHelper, Keep3rHelperParameters {\n constructor(address _keep3rV2, address _governance) Keep3rHelperParameters(_keep3rV2, _governance) {}\n\n /// @inheritdoc IKeep3rHelper\n function quote(uint256 _eth) public view override returns (uint256 _amountOut) {\n uint32[] memory _secondsAgos = new uint32[](2);\n _secondsAgos[1] = quoteTwapTime;\n\n (int56[] memory _tickCumulatives, ) = IUniswapV3Pool(kp3rWethPool.poolAddress).observe(_secondsAgos);\n int56 _difference = _tickCumulatives[0] - _tickCumulatives[1];\n _amountOut = getQuoteAtTick(uint128(_eth), kp3rWethPool.isKP3RToken0 ? _difference : -_difference, quoteTwapTime);\n }\n\n /// @inheritdoc IKeep3rHelper\n function bonds(address _keeper) public view override returns (uint256 _amountBonded) {\n return IKeep3r(keep3rV2).bonds(_keeper, KP3R);\n }\n\n /// @inheritdoc IKeep3rHelper\n function getRewardAmountFor(address _keeper, uint256 _gasUsed) public view override returns (uint256 _kp3r) {\n uint256 _boost = getRewardBoostFor(bonds(_keeper));\n _kp3r = quote((_gasUsed * _boost) / BOOST_BASE);\n }\n\n /// @inheritdoc IKeep3rHelper\n function getRewardAmount(uint256 _gasUsed) external view override returns (uint256 _amount) {\n // solhint-disable-next-line avoid-tx-origin\n return getRewardAmountFor(tx.origin, _gasUsed);\n }\n\n /// @inheritdoc IKeep3rHelper\n function getRewardBoostFor(uint256 _bonds) public view override returns (uint256 _rewardBoost) {\n _bonds = Math.min(_bonds, targetBond);\n uint256 _cap = Math.max(minBoost, minBoost + ((maxBoost - minBoost) * _bonds) / targetBond);\n _rewardBoost = _cap * _getBasefee();\n }\n\n /// @inheritdoc IKeep3rHelper\n function getPoolTokens(address _pool) public view override returns (address _token0, address _token1) {\n return (IUniswapV3Pool(_pool).token0(), IUniswapV3Pool(_pool).token1());\n }\n\n /// @inheritdoc IKeep3rHelper\n function isKP3RToken0(address _pool) public view override returns (bool _isKP3RToken0) {\n address _token0;\n address _token1;\n (_token0, _token1) = getPoolTokens(_pool);\n if (_token0 == KP3R) {\n return true;\n } else if (_token1 != KP3R) {\n revert LiquidityPairInvalid();\n }\n }\n\n /// @inheritdoc IKeep3rHelper\n function observe(address _pool, uint32[] memory _secondsAgo)\n public\n view\n override\n returns (\n int56 _tickCumulative1,\n int56 _tickCumulative2,\n bool _success\n )\n {\n try IUniswapV3Pool(_pool).observe(_secondsAgo) returns (int56[] memory _uniswapResponse, uint160[] memory) {\n _tickCumulative1 = _uniswapResponse[0];\n if (_uniswapResponse.length > 1) {\n _tickCumulative2 = _uniswapResponse[1];\n }\n _success = true;\n } catch (bytes memory) {}\n }\n\n /// @inheritdoc IKeep3rHelper\n function getPaymentParams(uint256 _bonds)\n external\n view\n override\n returns (\n uint256 _boost,\n uint256 _oneEthQuote,\n uint256 _extra\n )\n {\n _oneEthQuote = quote(1 ether);\n _boost = getRewardBoostFor(_bonds);\n _extra = workExtraGas;\n }\n\n /// @inheritdoc IKeep3rHelper\n function getKP3RsAtTick(\n uint256 _liquidityAmount,\n int56 _tickDifference,\n uint256 _timeInterval\n ) public pure override returns (uint256 _kp3rAmount) {\n uint160 sqrtRatioX96 = TickMath.getSqrtRatioAtTick(int24(_tickDifference / int256(_timeInterval)));\n _kp3rAmount = FullMath.mulDiv(1 << 96, _liquidityAmount, sqrtRatioX96);\n }\n\n /// @inheritdoc IKeep3rHelper\n function getQuoteAtTick(\n uint128 _baseAmount,\n int56 _tickDifference,\n uint256 _timeInterval\n ) public pure override returns (uint256 _quoteAmount) {\n uint160 sqrtRatioX96 = TickMath.getSqrtRatioAtTick(int24(_tickDifference / int256(_timeInterval)));\n\n if (sqrtRatioX96 <= type(uint128).max) {\n uint256 ratioX192 = uint256(sqrtRatioX96) * sqrtRatioX96;\n _quoteAmount = FullMath.mulDiv(1 << 192, _baseAmount, ratioX192);\n } else {\n uint256 ratioX128 = FullMath.mulDiv(sqrtRatioX96, sqrtRatioX96, 1 << 64);\n _quoteAmount = FullMath.mulDiv(1 << 128, _baseAmount, ratioX128);\n }\n }\n\n /// @notice Gets the gas basefee cost to calculate keeper rewards\n /// @dev Keepers are required to pay a priority fee to be included, this function recognizes a minimum priority fee\n /// @return _baseFee The block's basefee + a minimum priority fee, or a preset minimum gas fee\n function _getBasefee() internal view virtual returns (uint256 _baseFee) {\n return Math.max(minBaseFee, block.basefee + minPriorityFee);\n }\n}\n" - }, - "solidity/for-test/Keep3rHelperForTest.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../contracts/Keep3rHelper.sol';\n\ncontract Keep3rHelperForTest is Keep3rHelper {\n uint256 public basefee;\n\n constructor(address _keep3rV2, address _governance) Keep3rHelper(_keep3rV2, _governance) {}\n\n function _getBasefee() internal view override returns (uint256) {\n return basefee != 0 ? (basefee + minPriorityFee) : super._getBasefee();\n }\n\n function setBaseFee(uint256 _baseFee) external {\n basefee = _baseFee;\n }\n}\n" - }, - "solidity/for-test/libraries/LiquidityAmountsForTest.sol": { - "content": "// SPDX-License-Identifier: GPL-2.0-or-later\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../../contracts/libraries/FullMath.sol';\nimport '../../contracts/libraries/FixedPoint96.sol';\n\n/// @dev Made this library into a contract to be able to calculate liquidity more precisely for tests\n\n// solhint-disable\ncontract LiquidityAmountsForTest {\n function toUint128(uint256 x) private pure returns (uint128 y) {\n require((y = uint128(x)) == x);\n }\n\n function getLiquidityForAmount0(\n uint160 sqrtRatioAX96,\n uint160 sqrtRatioBX96,\n uint256 amount0\n ) public pure returns (uint128 liquidity) {\n if (sqrtRatioAX96 > sqrtRatioBX96) (sqrtRatioAX96, sqrtRatioBX96) = (sqrtRatioBX96, sqrtRatioAX96);\n uint256 intermediate = FullMath.mulDiv(sqrtRatioAX96, sqrtRatioBX96, FixedPoint96.Q96);\n return toUint128(FullMath.mulDiv(amount0, intermediate, sqrtRatioBX96 - sqrtRatioAX96));\n }\n\n function getLiquidityForAmount1(\n uint160 sqrtRatioAX96,\n uint160 sqrtRatioBX96,\n uint256 amount1\n ) public pure returns (uint128 liquidity) {\n if (sqrtRatioAX96 > sqrtRatioBX96) (sqrtRatioAX96, sqrtRatioBX96) = (sqrtRatioBX96, sqrtRatioAX96);\n return toUint128(FullMath.mulDiv(amount1, FixedPoint96.Q96, sqrtRatioBX96 - sqrtRatioAX96));\n }\n\n function getLiquidityForAmounts(\n uint160 sqrtRatioX96,\n uint160 sqrtRatioAX96,\n uint160 sqrtRatioBX96,\n uint256 amount0,\n uint256 amount1\n ) external pure returns (uint128 liquidity) {\n if (sqrtRatioAX96 > sqrtRatioBX96) (sqrtRatioAX96, sqrtRatioBX96) = (sqrtRatioBX96, sqrtRatioAX96);\n\n if (sqrtRatioX96 <= sqrtRatioAX96) {\n liquidity = getLiquidityForAmount0(sqrtRatioAX96, sqrtRatioBX96, amount0);\n } else if (sqrtRatioX96 < sqrtRatioBX96) {\n uint128 liquidity0 = getLiquidityForAmount0(sqrtRatioX96, sqrtRatioBX96, amount0);\n uint128 liquidity1 = getLiquidityForAmount1(sqrtRatioAX96, sqrtRatioX96, amount1);\n\n liquidity = liquidity0 < liquidity1 ? liquidity0 : liquidity1;\n } else {\n liquidity = getLiquidityForAmount1(sqrtRatioAX96, sqrtRatioBX96, amount1);\n }\n }\n\n function getAmount0ForLiquidity(\n uint160 sqrtRatioAX96,\n uint160 sqrtRatioBX96,\n uint128 liquidity\n ) public pure returns (uint256 amount0) {\n if (sqrtRatioAX96 > sqrtRatioBX96) (sqrtRatioAX96, sqrtRatioBX96) = (sqrtRatioBX96, sqrtRatioAX96);\n\n return FullMath.mulDiv(uint256(liquidity) << FixedPoint96.RESOLUTION, sqrtRatioBX96 - sqrtRatioAX96, sqrtRatioBX96) / sqrtRatioAX96;\n }\n\n function getAmount1ForLiquidity(\n uint160 sqrtRatioAX96,\n uint160 sqrtRatioBX96,\n uint128 liquidity\n ) public pure returns (uint256 amount1) {\n if (sqrtRatioAX96 > sqrtRatioBX96) (sqrtRatioAX96, sqrtRatioBX96) = (sqrtRatioBX96, sqrtRatioAX96);\n\n return FullMath.mulDiv(liquidity, sqrtRatioBX96 - sqrtRatioAX96, FixedPoint96.Q96);\n }\n\n function getAmountsForLiquidity(\n uint160 sqrtRatioX96,\n uint160 sqrtRatioAX96,\n uint160 sqrtRatioBX96,\n uint128 liquidity\n ) external pure returns (uint256 amount0, uint256 amount1) {\n if (sqrtRatioAX96 > sqrtRatioBX96) (sqrtRatioAX96, sqrtRatioBX96) = (sqrtRatioBX96, sqrtRatioAX96);\n\n if (sqrtRatioX96 <= sqrtRatioAX96) {\n amount0 = getAmount0ForLiquidity(sqrtRatioAX96, sqrtRatioBX96, liquidity);\n } else if (sqrtRatioX96 < sqrtRatioBX96) {\n amount0 = getAmount0ForLiquidity(sqrtRatioX96, sqrtRatioBX96, liquidity);\n amount1 = getAmount1ForLiquidity(sqrtRatioAX96, sqrtRatioX96, liquidity);\n } else {\n amount1 = getAmount1ForLiquidity(sqrtRatioAX96, sqrtRatioBX96, liquidity);\n }\n }\n}\n" - }, - "solidity/for-test/peripherals/jobs/Keep3rJobOwnershipForTest.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../../../contracts/peripherals/jobs/Keep3rJobOwnership.sol';\n\ncontract Keep3rJobOwnershipForTest is Keep3rJobOwnership {}\n" - }, - "solidity/for-test/peripherals/jobs/Keep3rJobDisputableForTest.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../../../contracts/peripherals/jobs/Keep3rJobDisputable.sol';\n\ncontract Keep3rJobDisputableForTest is Keep3rJobDisputable {\n using EnumerableSet for EnumerableSet.AddressSet;\n\n constructor(\n address _kph,\n address _keep3rV1,\n address _keep3rV1Proxy,\n address _kp3rWethPool\n ) Keep3rParameters(_kph, _keep3rV1, _keep3rV1Proxy, _kp3rWethPool) Keep3rRoles(msg.sender) {}\n\n function setJobLiquidity(address _job, address _liquidity) external {\n _jobLiquidities[_job].add(_liquidity);\n }\n\n function setJobToken(address _job, address _token) external {\n _jobTokens[_job].add(_token);\n }\n\n function setApprovedLiquidity(address _liquidity) external {\n _approvedLiquidities.add(_liquidity);\n }\n\n function setRevokedLiquidity(address _liquidity) external {\n _approvedLiquidities.remove(_liquidity);\n }\n\n function internalJobLiquidityCredits(address _job) external view returns (uint256 _credits) {\n _credits = _jobLiquidityCredits[_job];\n }\n\n function internalJobPeriodCredits(address _job) external view returns (uint256 _credits) {\n _credits = _jobPeriodCredits[_job];\n }\n\n function internalJobTokens(address _job) external view returns (address[] memory _tokens) {\n _tokens = new address[](_jobTokens[_job].length());\n for (uint256 i; i < _jobTokens[_job].length(); i++) {\n _tokens[i] = _jobTokens[_job].at(i);\n }\n }\n\n function internalJobLiquidities(address _job) external view returns (address[] memory _tokens) {\n _tokens = new address[](_jobLiquidities[_job].length());\n for (uint256 i; i < _jobLiquidities[_job].length(); i++) {\n _tokens[i] = _jobLiquidities[_job].at(i);\n }\n }\n}\n" - }, - "solidity/for-test/IUniswapV3PoolForTest.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '@uniswap/v3-core/contracts/interfaces/IERC20Minimal.sol';\nimport '@uniswap/v3-core/contracts/interfaces/IUniswapV3Pool.sol';\n\n// solhint-disable-next-line no-empty-blocks\ninterface IUniswapV3PoolForTest is IERC20Minimal, IUniswapV3Pool {\n\n}\n" - }, - "@uniswap/v3-core/contracts/interfaces/IERC20Minimal.sol": { - "content": "// SPDX-License-Identifier: GPL-2.0-or-later\npragma solidity >=0.5.0;\n\n/// @title Minimal ERC20 interface for Uniswap\n/// @notice Contains a subset of the full ERC20 interface that is used in Uniswap V3\ninterface IERC20Minimal {\n /// @notice Returns the balance of a token\n /// @param account The account for which to look up the number of tokens it has, i.e. its balance\n /// @return The number of tokens held by the account\n function balanceOf(address account) external view returns (uint256);\n\n /// @notice Transfers the amount of token from the `msg.sender` to the recipient\n /// @param recipient The account that will receive the amount transferred\n /// @param amount The number of tokens to send from the sender to the recipient\n /// @return Returns true for a successful transfer, false for an unsuccessful transfer\n function transfer(address recipient, uint256 amount) external returns (bool);\n\n /// @notice Returns the current allowance given to a spender by an owner\n /// @param owner The account of the token owner\n /// @param spender The account of the token spender\n /// @return The current allowance granted by `owner` to `spender`\n function allowance(address owner, address spender) external view returns (uint256);\n\n /// @notice Sets the allowance of a spender from the `msg.sender` to the value `amount`\n /// @param spender The account which will be allowed to spend a given amount of the owners tokens\n /// @param amount The amount of tokens allowed to be used by `spender`\n /// @return Returns true for a successful approval, false for unsuccessful\n function approve(address spender, uint256 amount) external returns (bool);\n\n /// @notice Transfers `amount` tokens from `sender` to `recipient` up to the allowance given to the `msg.sender`\n /// @param sender The account from which the transfer will be initiated\n /// @param recipient The recipient of the transfer\n /// @param amount The amount of the transfer\n /// @return Returns true for a successful transfer, false for unsuccessful\n function transferFrom(\n address sender,\n address recipient,\n uint256 amount\n ) external returns (bool);\n\n /// @notice Event emitted when tokens are transferred from one address to another, either via `#transfer` or `#transferFrom`.\n /// @param from The account from which the tokens were sent, i.e. the balance decreased\n /// @param to The account to which the tokens were sent, i.e. the balance increased\n /// @param value The amount of tokens that were transferred\n event Transfer(address indexed from, address indexed to, uint256 value);\n\n /// @notice Event emitted when the approval amount for the spender of a given owner's tokens changes.\n /// @param owner The account that approved spending of its tokens\n /// @param spender The account for which the spending allowance was modified\n /// @param value The new allowance from the owner to the spender\n event Approval(address indexed owner, address indexed spender, uint256 value);\n}\n" - } - }, - "settings": { - "optimizer": { - "enabled": true, - "runs": 33 - }, - "outputSelection": { - "*": { - "*": [ - "storageLayout", - "abi", - "evm.bytecode", - "evm.deployedBytecode", - "evm.methodIdentifiers", - "metadata", - "devdoc", - "userdoc", - "evm.gasEstimates" - ], - "": [ - "ast" - ] - } - }, - "metadata": { - "useLiteralContent": true - }, - "libraries": { - "": { - "__CACHE_BREAKER__": "0x00000000d41867734bbee4c6863d9255b2b06ac1" - } - } - } -} \ No newline at end of file diff --git a/deployments/mainnet/solcInputs/8290f557128ca60da3e16e49b50f213f.json b/deployments/mainnet/solcInputs/8290f557128ca60da3e16e49b50f213f.json deleted file mode 100644 index 4e3b8a5..0000000 --- a/deployments/mainnet/solcInputs/8290f557128ca60da3e16e49b50f213f.json +++ /dev/null @@ -1,280 +0,0 @@ -{ - "language": "Solidity", - "sources": { - "solidity/contracts/Keep3r.sol": { - "content": "// SPDX-License-Identifier: MIT\n\n/*\n\nCoded for The Keep3r Network with ♥ by\n\n██████╗░███████╗███████╗██╗  ░██╗░░░░░░░██╗░█████╗░███╗░░██╗██████╗░███████╗██████╗░██╗░░░░░░█████╗░███╗░░██╗██████╗░\n██╔══██╗██╔════╝██╔════╝██║  ░██║░░██╗░░██║██╔══██╗████╗░██║██╔══██╗██╔════╝██╔══██╗██║░░░░░██╔══██╗████╗░██║██╔══██╗\n██║░░██║█████╗░░█████╗░░██║  ░╚██╗████╗██╔╝██║░░██║██╔██╗██║██║░░██║█████╗░░██████╔╝██║░░░░░███████║██╔██╗██║██║░░██║\n██║░░██║██╔══╝░░██╔══╝░░██║  ░░████╔═████║░██║░░██║██║╚████║██║░░██║██╔══╝░░██╔══██╗██║░░░░░██╔══██║██║╚████║██║░░██║\n██████╔╝███████╗██║░░░░░██║  ░░╚██╔╝░╚██╔╝░╚█████╔╝██║░╚███║██████╔╝███████╗██║░░██║███████╗██║░░██║██║░╚███║██████╔╝\n╚═════╝░╚══════╝╚═╝░░░░░╚═╝  ░░░╚═╝░░░╚═╝░░░╚════╝░╚═╝░░╚══╝╚═════╝░╚══════╝╚═╝░░╚═╝╚══════╝╚═╝░░╚═╝╚═╝░░╚══╝╚═════╝░\n\nhttps://defi.sucks\n\n*/\n\npragma solidity >=0.8.4 <0.9.0;\n\nimport './peripherals/jobs/Keep3rJobs.sol';\nimport './peripherals/keepers/Keep3rKeepers.sol';\nimport './peripherals/Keep3rAccountance.sol';\nimport './peripherals/Keep3rRoles.sol';\nimport './peripherals/Keep3rParameters.sol';\nimport './peripherals/DustCollector.sol';\n\ncontract Keep3r is DustCollector, Keep3rJobs, Keep3rKeepers {\n constructor(\n address _governance,\n address _keep3rHelper,\n address _keep3rV1,\n address _keep3rV1Proxy,\n address _kp3rWethPool\n ) Keep3rParameters(_keep3rHelper, _keep3rV1, _keep3rV1Proxy, _kp3rWethPool) Keep3rRoles(_governance) DustCollector() {}\n}\n" - }, - "solidity/contracts/peripherals/jobs/Keep3rJobs.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport './Keep3rJobDisputable.sol';\nimport './Keep3rJobWorkable.sol';\nimport './Keep3rJobManager.sol';\n\nabstract contract Keep3rJobs is Keep3rJobDisputable, Keep3rJobManager, Keep3rJobWorkable {}\n" - }, - "solidity/contracts/peripherals/keepers/Keep3rKeepers.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport './Keep3rKeeperDisputable.sol';\n\nabstract contract Keep3rKeepers is Keep3rKeeperDisputable {}\n" - }, - "solidity/contracts/peripherals/Keep3rAccountance.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '@openzeppelin/contracts/utils/structs/EnumerableSet.sol';\nimport '../../interfaces/peripherals/IKeep3rAccountance.sol';\n\nabstract contract Keep3rAccountance is IKeep3rAccountance {\n using EnumerableSet for EnumerableSet.AddressSet;\n\n /// @notice List of all enabled keepers\n EnumerableSet.AddressSet internal _keepers;\n\n /// @inheritdoc IKeep3rAccountance\n mapping(address => uint256) public override workCompleted;\n\n /// @inheritdoc IKeep3rAccountance\n mapping(address => uint256) public override firstSeen;\n\n /// @inheritdoc IKeep3rAccountance\n mapping(address => bool) public override disputes;\n\n /// @inheritdoc IKeep3rAccountance\n /// @notice Mapping (job => bonding => amount)\n mapping(address => mapping(address => uint256)) public override bonds;\n\n /// @inheritdoc IKeep3rAccountance\n mapping(address => mapping(address => uint256)) public override jobTokenCredits;\n\n /// @notice The current liquidity credits available for a job\n mapping(address => uint256) internal _jobLiquidityCredits;\n\n /// @notice Map the address of a job to its correspondent periodCredits\n mapping(address => uint256) internal _jobPeriodCredits;\n\n /// @notice Enumerable array of Job Tokens for Credits\n mapping(address => EnumerableSet.AddressSet) internal _jobTokens;\n\n /// @notice List of liquidities that a job has (job => liquidities)\n mapping(address => EnumerableSet.AddressSet) internal _jobLiquidities;\n\n /// @notice Liquidity pool to observe\n mapping(address => address) internal _liquidityPool;\n\n /// @notice Tracks if a pool has KP3R as token0\n mapping(address => bool) internal _isKP3RToken0;\n\n /// @inheritdoc IKeep3rAccountance\n mapping(address => mapping(address => uint256)) public override pendingBonds;\n\n /// @inheritdoc IKeep3rAccountance\n mapping(address => mapping(address => uint256)) public override canActivateAfter;\n\n /// @inheritdoc IKeep3rAccountance\n mapping(address => mapping(address => uint256)) public override canWithdrawAfter;\n\n /// @inheritdoc IKeep3rAccountance\n mapping(address => mapping(address => uint256)) public override pendingUnbonds;\n\n /// @inheritdoc IKeep3rAccountance\n mapping(address => bool) public override hasBonded;\n\n /// @notice List of all enabled jobs\n EnumerableSet.AddressSet internal _jobs;\n\n /// @inheritdoc IKeep3rAccountance\n function jobs() external view override returns (address[] memory _list) {\n _list = _jobs.values();\n }\n\n /// @inheritdoc IKeep3rAccountance\n function keepers() external view override returns (address[] memory _list) {\n _list = _keepers.values();\n }\n}\n" - }, - "solidity/contracts/peripherals/Keep3rRoles.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../../interfaces/peripherals/IKeep3rRoles.sol';\nimport '@openzeppelin/contracts/utils/structs/EnumerableSet.sol';\nimport './Governable.sol';\n\ncontract Keep3rRoles is IKeep3rRoles, Governable {\n /// @inheritdoc IKeep3rRoles\n mapping(address => bool) public override slashers;\n\n /// @inheritdoc IKeep3rRoles\n mapping(address => bool) public override disputers;\n\n constructor(address _governance) Governable(_governance) {}\n\n /// @inheritdoc IKeep3rRoles\n function addSlasher(address _slasher) external override onlyGovernance {\n if (slashers[_slasher]) revert SlasherExistent();\n slashers[_slasher] = true;\n emit SlasherAdded(_slasher);\n }\n\n /// @inheritdoc IKeep3rRoles\n function removeSlasher(address _slasher) external override onlyGovernance {\n if (!slashers[_slasher]) revert SlasherUnexistent();\n delete slashers[_slasher];\n emit SlasherRemoved(_slasher);\n }\n\n /// @inheritdoc IKeep3rRoles\n function addDisputer(address _disputer) external override onlyGovernance {\n if (disputers[_disputer]) revert DisputerExistent();\n disputers[_disputer] = true;\n emit DisputerAdded(_disputer);\n }\n\n /// @inheritdoc IKeep3rRoles\n function removeDisputer(address _disputer) external override onlyGovernance {\n if (!disputers[_disputer]) revert DisputerUnexistent();\n delete disputers[_disputer];\n emit DisputerRemoved(_disputer);\n }\n\n /// @notice Functions with this modifier can only be called by either a slasher or governance\n modifier onlySlasher {\n if (!slashers[msg.sender]) revert OnlySlasher();\n _;\n }\n\n /// @notice Functions with this modifier can only be called by either a disputer or governance\n modifier onlyDisputer {\n if (!disputers[msg.sender]) revert OnlyDisputer();\n _;\n }\n}\n" - }, - "solidity/contracts/peripherals/Keep3rParameters.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../../interfaces/IKeep3rHelper.sol';\nimport '../../interfaces/peripherals/IKeep3rParameters.sol';\nimport './Keep3rAccountance.sol';\nimport './Keep3rRoles.sol';\n\nabstract contract Keep3rParameters is IKeep3rParameters, Keep3rAccountance, Keep3rRoles {\n /// @inheritdoc IKeep3rParameters\n address public override keep3rV1;\n\n /// @inheritdoc IKeep3rParameters\n address public override keep3rV1Proxy;\n\n /// @inheritdoc IKeep3rParameters\n address public override keep3rHelper;\n\n /// @inheritdoc IKeep3rParameters\n address public override kp3rWethPool;\n\n /// @inheritdoc IKeep3rParameters\n uint256 public override bondTime = 3 days;\n\n /// @inheritdoc IKeep3rParameters\n uint256 public override unbondTime = 14 days;\n\n /// @inheritdoc IKeep3rParameters\n uint256 public override liquidityMinimum = 3 ether;\n\n /// @inheritdoc IKeep3rParameters\n uint256 public override rewardPeriodTime = 5 days;\n\n /// @inheritdoc IKeep3rParameters\n uint256 public override inflationPeriod = 34 days;\n\n /// @inheritdoc IKeep3rParameters\n uint256 public override fee = 30;\n\n /// @notice The base that will be used to calculate the fee\n uint256 internal constant _BASE = 10000;\n\n /// @notice The minimum reward period\n uint256 internal constant _MIN_REWARD_PERIOD_TIME = 1 days;\n\n constructor(\n address _keep3rHelper,\n address _keep3rV1,\n address _keep3rV1Proxy,\n address _kp3rWethPool\n ) {\n keep3rHelper = _keep3rHelper;\n keep3rV1 = _keep3rV1;\n keep3rV1Proxy = _keep3rV1Proxy;\n kp3rWethPool = _kp3rWethPool;\n _liquidityPool[kp3rWethPool] = kp3rWethPool;\n _isKP3RToken0[_kp3rWethPool] = IKeep3rHelper(keep3rHelper).isKP3RToken0(kp3rWethPool);\n }\n\n /// @inheritdoc IKeep3rParameters\n function setKeep3rHelper(address _keep3rHelper) external override onlyGovernance {\n if (_keep3rHelper == address(0)) revert ZeroAddress();\n keep3rHelper = _keep3rHelper;\n emit Keep3rHelperChange(_keep3rHelper);\n }\n\n /// @inheritdoc IKeep3rParameters\n function setKeep3rV1(address _keep3rV1) external override onlyGovernance {\n if (_keep3rV1 == address(0)) revert ZeroAddress();\n keep3rV1 = _keep3rV1;\n emit Keep3rV1Change(_keep3rV1);\n }\n\n /// @inheritdoc IKeep3rParameters\n function setKeep3rV1Proxy(address _keep3rV1Proxy) external override onlyGovernance {\n if (_keep3rV1Proxy == address(0)) revert ZeroAddress();\n keep3rV1Proxy = _keep3rV1Proxy;\n emit Keep3rV1ProxyChange(_keep3rV1Proxy);\n }\n\n /// @inheritdoc IKeep3rParameters\n function setKp3rWethPool(address _kp3rWethPool) external override onlyGovernance {\n if (_kp3rWethPool == address(0)) revert ZeroAddress();\n kp3rWethPool = _kp3rWethPool;\n _liquidityPool[kp3rWethPool] = kp3rWethPool;\n _isKP3RToken0[_kp3rWethPool] = IKeep3rHelper(keep3rHelper).isKP3RToken0(_kp3rWethPool);\n emit Kp3rWethPoolChange(_kp3rWethPool);\n }\n\n /// @inheritdoc IKeep3rParameters\n function setBondTime(uint256 _bondTime) external override onlyGovernance {\n bondTime = _bondTime;\n emit BondTimeChange(_bondTime);\n }\n\n /// @inheritdoc IKeep3rParameters\n function setUnbondTime(uint256 _unbondTime) external override onlyGovernance {\n unbondTime = _unbondTime;\n emit UnbondTimeChange(_unbondTime);\n }\n\n /// @inheritdoc IKeep3rParameters\n function setLiquidityMinimum(uint256 _liquidityMinimum) external override onlyGovernance {\n liquidityMinimum = _liquidityMinimum;\n emit LiquidityMinimumChange(_liquidityMinimum);\n }\n\n /// @inheritdoc IKeep3rParameters\n function setRewardPeriodTime(uint256 _rewardPeriodTime) external override onlyGovernance {\n if (_rewardPeriodTime < _MIN_REWARD_PERIOD_TIME) revert MinRewardPeriod();\n rewardPeriodTime = _rewardPeriodTime;\n emit RewardPeriodTimeChange(_rewardPeriodTime);\n }\n\n /// @inheritdoc IKeep3rParameters\n function setInflationPeriod(uint256 _inflationPeriod) external override onlyGovernance {\n inflationPeriod = _inflationPeriod;\n emit InflationPeriodChange(_inflationPeriod);\n }\n\n /// @inheritdoc IKeep3rParameters\n function setFee(uint256 _fee) external override onlyGovernance {\n fee = _fee;\n emit FeeChange(_fee);\n }\n}\n" - }, - "solidity/contracts/peripherals/DustCollector.sol": { - "content": "// SPDX-License-Identifier: MIT\n\npragma solidity >=0.8.4 <0.9.0;\n\nimport '@openzeppelin/contracts/token/ERC20/IERC20.sol';\nimport '@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol';\nimport '../../contracts/peripherals/Governable.sol';\nimport '../../interfaces/peripherals/IDustCollector.sol';\n\nabstract contract DustCollector is IDustCollector, Governable {\n using SafeERC20 for IERC20;\n\n address internal constant _ETH_ADDRESS = 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE;\n\n function sendDust(\n address _token,\n uint256 _amount,\n address _to\n ) external override onlyGovernance {\n if (_to == address(0)) revert ZeroAddress();\n if (_token == _ETH_ADDRESS) {\n payable(_to).transfer(_amount);\n } else {\n IERC20(_token).safeTransfer(_to, _amount);\n }\n emit DustSent(_token, _amount, _to);\n }\n}\n" - }, - "solidity/contracts/peripherals/jobs/Keep3rJobDisputable.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport './Keep3rJobFundableCredits.sol';\nimport './Keep3rJobFundableLiquidity.sol';\nimport '../Keep3rDisputable.sol';\n\nabstract contract Keep3rJobDisputable is IKeep3rJobDisputable, Keep3rDisputable, Keep3rJobFundableCredits, Keep3rJobFundableLiquidity {\n using EnumerableSet for EnumerableSet.AddressSet;\n using SafeERC20 for IERC20;\n\n /// @inheritdoc IKeep3rJobDisputable\n function slashTokenFromJob(\n address _job,\n address _token,\n uint256 _amount\n ) external override onlySlasher {\n if (!disputes[_job]) revert NotDisputed();\n if (!_jobTokens[_job].contains(_token)) revert JobTokenUnexistent();\n if (jobTokenCredits[_job][_token] < _amount) revert JobTokenInsufficient();\n\n try IERC20(_token).transfer(governance, _amount) {} catch {}\n jobTokenCredits[_job][_token] -= _amount;\n if (jobTokenCredits[_job][_token] == 0) {\n _jobTokens[_job].remove(_token);\n }\n\n emit JobSlashToken(_job, _token, msg.sender, _amount);\n }\n\n /// @inheritdoc IKeep3rJobDisputable\n function slashLiquidityFromJob(\n address _job,\n address _liquidity,\n uint256 _amount\n ) external override onlySlasher {\n if (!disputes[_job]) revert NotDisputed();\n\n _unbondLiquidityFromJob(_job, _liquidity, _amount);\n try IERC20(_liquidity).transfer(governance, _amount) {} catch {}\n emit JobSlashLiquidity(_job, _liquidity, msg.sender, _amount);\n }\n}\n" - }, - "solidity/contracts/peripherals/jobs/Keep3rJobWorkable.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport './Keep3rJobMigration.sol';\nimport '../../../interfaces/IKeep3rHelper.sol';\nimport '../../../interfaces/peripherals/IKeep3rJobs.sol';\n\nimport '@openzeppelin/contracts/token/ERC20/IERC20.sol';\nimport '@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol';\n\nabstract contract Keep3rJobWorkable is IKeep3rJobWorkable, Keep3rJobMigration {\n using EnumerableSet for EnumerableSet.AddressSet;\n using SafeERC20 for IERC20;\n\n uint256 internal _initialGas;\n\n /// @inheritdoc IKeep3rJobWorkable\n function isKeeper(address _keeper) external override returns (bool _isKeeper) {\n _initialGas = gasleft();\n if (_keepers.contains(_keeper)) {\n emit KeeperValidation(_initialGas);\n return true;\n }\n }\n\n /// @inheritdoc IKeep3rJobWorkable\n function isBondedKeeper(\n address _keeper,\n address _bond,\n uint256 _minBond,\n uint256 _earned,\n uint256 _age\n ) public override returns (bool _isBondedKeeper) {\n _initialGas = gasleft();\n if (\n _keepers.contains(_keeper) &&\n bonds[_keeper][_bond] >= _minBond &&\n workCompleted[_keeper] >= _earned &&\n block.timestamp - firstSeen[_keeper] >= _age\n ) {\n emit KeeperValidation(_initialGas);\n return true;\n }\n }\n\n /// @inheritdoc IKeep3rJobWorkable\n function worked(address _keeper) external override {\n address _job = msg.sender;\n if (disputes[_job]) revert JobDisputed();\n if (!_jobs.contains(_job)) revert JobUnapproved();\n\n if (_updateJobCreditsIfNeeded(_job)) {\n emit LiquidityCreditsReward(_job, rewardedAt[_job], _jobLiquidityCredits[_job], _jobPeriodCredits[_job]);\n }\n\n uint256 _gasRecord = gasleft();\n uint256 _boost = IKeep3rHelper(keep3rHelper).getRewardBoostFor(bonds[_keeper][keep3rV1]);\n\n uint256 _payment = _quoteKp3rs(((_initialGas - _gasRecord) * _boost) / _BASE);\n\n if (_payment > _jobLiquidityCredits[_job]) {\n _rewardJobCredits(_job);\n emit LiquidityCreditsReward(_job, rewardedAt[_job], _jobLiquidityCredits[_job], _jobPeriodCredits[_job]);\n }\n\n uint256 _gasLeft = gasleft();\n _payment = ((_initialGas - _gasLeft) * _payment) / (_initialGas - _gasRecord);\n\n _bondedPayment(_job, _keeper, _payment);\n emit KeeperWork(keep3rV1, _job, _keeper, _payment, _gasLeft);\n }\n\n /// @inheritdoc IKeep3rJobWorkable\n function bondedPayment(address _keeper, uint256 _payment) public override {\n address _job = msg.sender;\n\n if (disputes[_job]) revert JobDisputed();\n if (!_jobs.contains(_job)) revert JobUnapproved();\n\n if (_updateJobCreditsIfNeeded(_job)) {\n emit LiquidityCreditsReward(_job, rewardedAt[_job], _jobLiquidityCredits[_job], _jobPeriodCredits[_job]);\n }\n\n if (_payment > _jobLiquidityCredits[_job]) {\n _rewardJobCredits(_job);\n emit LiquidityCreditsReward(_job, rewardedAt[_job], _jobLiquidityCredits[_job], _jobPeriodCredits[_job]);\n }\n\n _bondedPayment(_job, _keeper, _payment);\n emit KeeperWork(keep3rV1, _job, _keeper, _payment, gasleft());\n }\n\n function _bondedPayment(\n address _job,\n address _keeper,\n uint256 _payment\n ) internal {\n if (_payment > _jobLiquidityCredits[_job]) revert InsufficientFunds();\n\n workedAt[_job] = block.timestamp;\n _jobLiquidityCredits[_job] -= _payment;\n bonds[_keeper][keep3rV1] += _payment;\n workCompleted[_keeper] += _payment;\n }\n\n /// @inheritdoc IKeep3rJobWorkable\n function directTokenPayment(\n address _token,\n address _keeper,\n uint256 _amount\n ) external override {\n address _job = msg.sender;\n\n if (disputes[_job]) revert JobDisputed();\n if (disputes[_keeper]) revert Disputed();\n if (!_jobs.contains(_job)) revert JobUnapproved();\n if (jobTokenCredits[_job][_token] < _amount) revert InsufficientFunds();\n jobTokenCredits[_job][_token] -= _amount;\n IERC20(_token).safeTransfer(_keeper, _amount);\n emit KeeperWork(_token, _job, _keeper, _amount, gasleft());\n }\n}\n" - }, - "solidity/contracts/peripherals/jobs/Keep3rJobManager.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport './Keep3rJobOwnership.sol';\nimport '../Keep3rRoles.sol';\nimport '../Keep3rParameters.sol';\nimport '../../../interfaces/peripherals/IKeep3rJobs.sol';\n\nabstract contract Keep3rJobManager is IKeep3rJobManager, Keep3rJobOwnership, Keep3rRoles, Keep3rParameters {\n using EnumerableSet for EnumerableSet.AddressSet;\n\n /// @inheritdoc IKeep3rJobManager\n function addJob(address _job) external override {\n if (_jobs.contains(_job)) revert JobAlreadyAdded();\n if (hasBonded[_job]) revert AlreadyAKeeper();\n _jobs.add(_job);\n jobOwner[_job] = msg.sender;\n emit JobAddition(msg.sender, _job);\n }\n}\n" - }, - "solidity/contracts/peripherals/jobs/Keep3rJobFundableCredits.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport './Keep3rJobOwnership.sol';\nimport '../Keep3rAccountance.sol';\nimport '../Keep3rParameters.sol';\nimport '../../../interfaces/peripherals/IKeep3rJobs.sol';\n\nimport '@openzeppelin/contracts/security/ReentrancyGuard.sol';\nimport '@openzeppelin/contracts/token/ERC20/IERC20.sol';\nimport '@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol';\nimport '@openzeppelin/contracts/utils/math/Math.sol';\n\nabstract contract Keep3rJobFundableCredits is IKeep3rJobFundableCredits, ReentrancyGuard, Keep3rJobOwnership, Keep3rParameters {\n using EnumerableSet for EnumerableSet.AddressSet;\n using SafeERC20 for IERC20;\n\n /// @notice Cooldown between withdrawals\n uint256 internal constant _WITHDRAW_TOKENS_COOLDOWN = 1 minutes;\n\n /// @inheritdoc IKeep3rJobFundableCredits\n mapping(address => mapping(address => uint256)) public override jobTokenCreditsAddedAt;\n\n /// @inheritdoc IKeep3rJobFundableCredits\n function addTokenCreditsToJob(\n address _job,\n address _token,\n uint256 _amount\n ) external override nonReentrant {\n if (!_jobs.contains(_job)) revert JobUnavailable();\n // KP3R shouldn't be used for direct token payments\n if (_token == keep3rV1) revert TokenUnallowed();\n uint256 _before = IERC20(_token).balanceOf(address(this));\n IERC20(_token).safeTransferFrom(msg.sender, address(this), _amount);\n uint256 _received = IERC20(_token).balanceOf(address(this)) - _before;\n uint256 _tokenFee = (_received * fee) / _BASE;\n jobTokenCredits[_job][_token] += _received - _tokenFee;\n jobTokenCreditsAddedAt[_job][_token] = block.timestamp;\n IERC20(_token).safeTransfer(governance, _tokenFee);\n _jobTokens[_job].add(_token);\n\n emit TokenCreditAddition(_job, _token, msg.sender, _received);\n }\n\n /// @inheritdoc IKeep3rJobFundableCredits\n function withdrawTokenCreditsFromJob(\n address _job,\n address _token,\n uint256 _amount,\n address _receiver\n ) external override nonReentrant onlyJobOwner(_job) {\n if (block.timestamp <= jobTokenCreditsAddedAt[_job][_token] + _WITHDRAW_TOKENS_COOLDOWN) revert JobTokenCreditsLocked();\n if (jobTokenCredits[_job][_token] < _amount) revert InsufficientJobTokenCredits();\n if (disputes[_job]) revert JobDisputed();\n\n jobTokenCredits[_job][_token] -= _amount;\n IERC20(_token).safeTransfer(_receiver, _amount);\n\n if (jobTokenCredits[_job][_token] == 0) {\n _jobTokens[_job].remove(_token);\n }\n\n emit TokenCreditWithdrawal(_job, _token, _receiver, _amount);\n }\n}\n" - }, - "solidity/contracts/peripherals/jobs/Keep3rJobFundableLiquidity.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport './Keep3rJobOwnership.sol';\nimport '../Keep3rAccountance.sol';\nimport '../Keep3rParameters.sol';\nimport '../../../interfaces/IPairManager.sol';\nimport '../../../interfaces/peripherals/IKeep3rJobs.sol';\n\nimport '../../libraries/FullMath.sol';\n\nimport '@openzeppelin/contracts/security/ReentrancyGuard.sol';\nimport '@openzeppelin/contracts/token/ERC20/IERC20.sol';\nimport '@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol';\nimport '@openzeppelin/contracts/utils/math/Math.sol';\n\nabstract contract Keep3rJobFundableLiquidity is IKeep3rJobFundableLiquidity, ReentrancyGuard, Keep3rJobOwnership, Keep3rParameters {\n using EnumerableSet for EnumerableSet.AddressSet;\n using SafeERC20 for IERC20;\n\n /// @notice List of liquidities that are accepted in the system\n EnumerableSet.AddressSet internal _approvedLiquidities;\n\n /// @inheritdoc IKeep3rJobFundableLiquidity\n mapping(address => mapping(address => uint256)) public override liquidityAmount;\n\n /// @inheritdoc IKeep3rJobFundableLiquidity\n mapping(address => uint256) public override rewardedAt;\n\n /// @inheritdoc IKeep3rJobFundableLiquidity\n mapping(address => uint256) public override workedAt;\n\n /// @notice Tracks an address and returns its TickCache\n mapping(address => TickCache) internal _tick;\n\n // Views\n\n /// @inheritdoc IKeep3rJobFundableLiquidity\n function approvedLiquidities() external view override returns (address[] memory _list) {\n _list = _approvedLiquidities.values();\n }\n\n /// @inheritdoc IKeep3rJobFundableLiquidity\n function jobPeriodCredits(address _job) public view override returns (uint256 _periodCredits) {\n for (uint256 i; i < _jobLiquidities[_job].length(); i++) {\n address _liquidity = _jobLiquidities[_job].at(i);\n if (_approvedLiquidities.contains(_liquidity)) {\n TickCache memory _tickCache = observeLiquidity(_liquidity);\n if (_tickCache.period != 0) {\n int56 _tickDifference = _isKP3RToken0[_liquidity] ? _tickCache.difference : -_tickCache.difference;\n _periodCredits += _getReward(\n IKeep3rHelper(keep3rHelper).getKP3RsAtTick(liquidityAmount[_job][_liquidity], _tickDifference, rewardPeriodTime)\n );\n }\n }\n }\n }\n\n /// @inheritdoc IKeep3rJobFundableLiquidity\n function jobLiquidityCredits(address _job) public view override returns (uint256 _liquidityCredits) {\n uint256 _periodCredits = jobPeriodCredits(_job);\n\n // A job can have liquidityCredits without periodCredits (forced by Governance)\n if (rewardedAt[_job] > _period(block.timestamp - rewardPeriodTime)) {\n // Will calculate job credits only if it was rewarded later than last period\n if ((block.timestamp - rewardedAt[_job]) >= rewardPeriodTime) {\n // Will return a full period if job was rewarded more than a period ago\n _liquidityCredits = _periodCredits;\n } else {\n // Will update minted job credits (not forced) to new twaps if credits are outdated\n _liquidityCredits = _periodCredits > 0\n ? (_jobLiquidityCredits[_job] * _periodCredits) / _jobPeriodCredits[_job]\n : _jobLiquidityCredits[_job];\n }\n } else {\n // Will return a full period if job credits are expired\n _liquidityCredits = _periodCredits;\n }\n }\n\n /// @inheritdoc IKeep3rJobFundableLiquidity\n function totalJobCredits(address _job) external view override returns (uint256 _credits) {\n uint256 _periodCredits = jobPeriodCredits(_job);\n uint256 _cooldown;\n\n if ((rewardedAt[_job] > _period(block.timestamp - rewardPeriodTime))) {\n // Will calculate cooldown if it outdated\n if ((block.timestamp - rewardedAt[_job]) >= rewardPeriodTime) {\n // Will calculate cooldown from last reward reference in this period\n _cooldown = block.timestamp - (rewardedAt[_job] + rewardPeriodTime);\n } else {\n // Will calculate cooldown from last reward timestamp\n _cooldown = block.timestamp - rewardedAt[_job];\n }\n } else {\n // Will calculate cooldown from period start if expired\n _cooldown = block.timestamp - _period(block.timestamp);\n }\n _credits = jobLiquidityCredits(_job) + _phase(_cooldown, _periodCredits);\n }\n\n /// @inheritdoc IKeep3rJobFundableLiquidity\n function quoteLiquidity(address _liquidity, uint256 _amount) external view override returns (uint256 _periodCredits) {\n if (_approvedLiquidities.contains(_liquidity)) {\n TickCache memory _tickCache = observeLiquidity(_liquidity);\n if (_tickCache.period != 0) {\n int56 _tickDifference = _isKP3RToken0[_liquidity] ? _tickCache.difference : -_tickCache.difference;\n return _getReward(IKeep3rHelper(keep3rHelper).getKP3RsAtTick(_amount, _tickDifference, rewardPeriodTime));\n }\n }\n }\n\n /// @inheritdoc IKeep3rJobFundableLiquidity\n function observeLiquidity(address _liquidity) public view override returns (TickCache memory _tickCache) {\n if (_tick[_liquidity].period == _period(block.timestamp)) {\n // Will return cached twaps if liquidity is updated\n _tickCache = _tick[_liquidity];\n } else {\n bool success;\n uint256 lastPeriod = _period(block.timestamp - rewardPeriodTime);\n\n if (_tick[_liquidity].period == lastPeriod) {\n // Will only ask for current period accumulator if liquidity is outdated\n uint32[] memory _secondsAgo = new uint32[](1);\n int56 previousTick = _tick[_liquidity].current;\n\n _secondsAgo[0] = uint32(block.timestamp - _period(block.timestamp));\n\n (_tickCache.current, , success) = IKeep3rHelper(keep3rHelper).observe(_liquidityPool[_liquidity], _secondsAgo);\n\n _tickCache.difference = _tickCache.current - previousTick;\n } else if (_tick[_liquidity].period < lastPeriod) {\n // Will ask for 2 accumulators if liquidity is expired\n uint32[] memory _secondsAgo = new uint32[](2);\n\n _secondsAgo[0] = uint32(block.timestamp - _period(block.timestamp));\n _secondsAgo[1] = uint32(block.timestamp - _period(block.timestamp) + rewardPeriodTime);\n\n int56 _tickCumulative2;\n (_tickCache.current, _tickCumulative2, success) = IKeep3rHelper(keep3rHelper).observe(_liquidityPool[_liquidity], _secondsAgo);\n\n _tickCache.difference = _tickCache.current - _tickCumulative2;\n }\n if (success) {\n _tickCache.period = _period(block.timestamp);\n } else {\n _tickCache.period = 0;\n }\n }\n }\n\n // Methods\n\n /// @inheritdoc IKeep3rJobFundableLiquidity\n function forceLiquidityCreditsToJob(address _job, uint256 _amount) external override onlyGovernance {\n if (!_jobs.contains(_job)) revert JobUnavailable();\n _settleJobAccountance(_job);\n _jobLiquidityCredits[_job] += _amount;\n emit LiquidityCreditsForced(_job, rewardedAt[_job], _jobLiquidityCredits[_job]);\n }\n\n /// @inheritdoc IKeep3rJobFundableLiquidity\n function approveLiquidity(address _liquidity) external override onlyGovernance {\n if (!_approvedLiquidities.add(_liquidity)) revert LiquidityPairApproved();\n _liquidityPool[_liquidity] = IPairManager(_liquidity).pool();\n _isKP3RToken0[_liquidity] = IKeep3rHelper(keep3rHelper).isKP3RToken0(_liquidityPool[_liquidity]);\n _tick[_liquidity] = observeLiquidity(_liquidity);\n emit LiquidityApproval(_liquidity);\n }\n\n /// @inheritdoc IKeep3rJobFundableLiquidity\n function revokeLiquidity(address _liquidity) external override onlyGovernance {\n if (!_approvedLiquidities.remove(_liquidity)) revert LiquidityPairUnexistent();\n emit LiquidityRevocation(_liquidity);\n }\n\n /// @inheritdoc IKeep3rJobFundableLiquidity\n function addLiquidityToJob(\n address _job,\n address _liquidity,\n uint256 _amount\n ) external override nonReentrant {\n if (!_approvedLiquidities.contains(_liquidity)) revert LiquidityPairUnapproved();\n if (!_jobs.contains(_job)) revert JobUnavailable();\n\n _jobLiquidities[_job].add(_liquidity);\n\n _settleJobAccountance(_job);\n\n if (_quoteLiquidity(liquidityAmount[_job][_liquidity] + _amount, _liquidity) < liquidityMinimum) revert JobLiquidityLessThanMin();\n\n emit LiquidityCreditsReward(_job, rewardedAt[_job], _jobLiquidityCredits[_job], _jobPeriodCredits[_job]);\n\n IERC20(_liquidity).safeTransferFrom(msg.sender, address(this), _amount);\n liquidityAmount[_job][_liquidity] += _amount;\n _jobPeriodCredits[_job] += _getReward(_quoteLiquidity(_amount, _liquidity));\n emit LiquidityAddition(_job, _liquidity, msg.sender, _amount);\n }\n\n /// @inheritdoc IKeep3rJobFundableLiquidity\n function unbondLiquidityFromJob(\n address _job,\n address _liquidity,\n uint256 _amount\n ) external override onlyJobOwner(_job) {\n canWithdrawAfter[_job][_liquidity] = block.timestamp + unbondTime;\n pendingUnbonds[_job][_liquidity] += _amount;\n _unbondLiquidityFromJob(_job, _liquidity, _amount);\n\n uint256 _remainingLiquidity = liquidityAmount[_job][_liquidity];\n if (_remainingLiquidity > 0 && _quoteLiquidity(_remainingLiquidity, _liquidity) < liquidityMinimum) revert JobLiquidityLessThanMin();\n\n emit Unbonding(_job, _liquidity, _amount);\n }\n\n /// @inheritdoc IKeep3rJobFundableLiquidity\n function withdrawLiquidityFromJob(\n address _job,\n address _liquidity,\n address _receiver\n ) external override onlyJobOwner(_job) {\n if (_receiver == address(0)) revert ZeroAddress();\n if (canWithdrawAfter[_job][_liquidity] == 0) revert UnbondsUnexistent();\n if (canWithdrawAfter[_job][_liquidity] >= block.timestamp) revert UnbondsLocked();\n if (disputes[_job]) revert Disputed();\n\n uint256 _amount = pendingUnbonds[_job][_liquidity];\n IERC20(_liquidity).safeTransfer(_receiver, _amount);\n emit LiquidityWithdrawal(_job, _liquidity, _receiver, _amount);\n\n pendingUnbonds[_job][_liquidity] = 0;\n }\n\n // Internal functions\n\n /// @notice Updates or rewards job liquidity credits depending on time since last job reward\n function _updateJobCreditsIfNeeded(address _job) internal returns (bool _rewarded) {\n if (rewardedAt[_job] < _period(block.timestamp)) {\n // Will exit function if job has been rewarded in current period\n if (rewardedAt[_job] <= _period(block.timestamp - rewardPeriodTime)) {\n // Will reset job to period syncronicity if a full period passed without rewards\n _updateJobPeriod(_job);\n _jobLiquidityCredits[_job] = _jobPeriodCredits[_job];\n rewardedAt[_job] = _period(block.timestamp);\n _rewarded = true;\n } else if ((block.timestamp - rewardedAt[_job]) >= rewardPeriodTime) {\n // Will reset job's syncronicity if last reward was more than epoch ago\n _updateJobPeriod(_job);\n _jobLiquidityCredits[_job] = _jobPeriodCredits[_job];\n rewardedAt[_job] += rewardPeriodTime;\n _rewarded = true;\n } else if (workedAt[_job] < _period(block.timestamp)) {\n // First keeper on period has to update job accountance to current twaps\n uint256 previousPeriodCredits = _jobPeriodCredits[_job];\n _updateJobPeriod(_job);\n _jobLiquidityCredits[_job] = (_jobLiquidityCredits[_job] * _jobPeriodCredits[_job]) / previousPeriodCredits;\n // Updating job accountance does not reward job\n }\n }\n }\n\n /// @notice Only called if _jobLiquidityCredits < payment\n function _rewardJobCredits(address _job) internal {\n /// @notice Only way to += jobLiquidityCredits is when keeper rewarding (cannot pay work)\n /* WARNING: this allows to top up _jobLiquidityCredits to a max of 1.99 but have to spend at least 1 */\n _jobLiquidityCredits[_job] += _phase(block.timestamp - rewardedAt[_job], _jobPeriodCredits[_job]);\n rewardedAt[_job] = block.timestamp;\n }\n\n /// @notice Updates accountance for _jobPeriodCredits\n function _updateJobPeriod(address _job) internal {\n _jobPeriodCredits[_job] = _calculateJobPeriodCredits(_job);\n }\n\n /// @notice Quotes the outdated job liquidities and calculates _periodCredits\n /// @dev This function is also responsible for keeping the KP3R/WETH quote updated\n function _calculateJobPeriodCredits(address _job) internal returns (uint256 _periodCredits) {\n if (_tick[kp3rWethPool].period != _period(block.timestamp)) {\n // Updates KP3R/WETH quote if needed\n _tick[kp3rWethPool] = observeLiquidity(kp3rWethPool);\n }\n\n for (uint256 i; i < _jobLiquidities[_job].length(); i++) {\n address _liquidity = _jobLiquidities[_job].at(i);\n if (_approvedLiquidities.contains(_liquidity)) {\n if (_tick[_liquidity].period != _period(block.timestamp)) {\n // Updates liquidity cache only if needed\n _tick[_liquidity] = observeLiquidity(_liquidity);\n }\n _periodCredits += _getReward(_quoteLiquidity(liquidityAmount[_job][_liquidity], _liquidity));\n }\n }\n }\n\n /// @notice Updates job accountance calculating the impact of the unbonded liquidity amount\n function _unbondLiquidityFromJob(\n address _job,\n address _liquidity,\n uint256 _amount\n ) internal nonReentrant {\n if (!_jobLiquidities[_job].contains(_liquidity)) revert JobLiquidityUnexistent();\n if (liquidityAmount[_job][_liquidity] < _amount) revert JobLiquidityInsufficient();\n\n // Ensures current twaps in job liquidities\n _updateJobPeriod(_job);\n uint256 _periodCreditsToRemove = _getReward(_quoteLiquidity(_amount, _liquidity));\n\n // A liquidity can be revoked causing a job to have 0 periodCredits\n if (_jobPeriodCredits[_job] > 0) {\n // Removes a % correspondant to a full rewardPeriodTime for the liquidity withdrawn vs all of the liquidities\n _jobLiquidityCredits[_job] -= (_jobLiquidityCredits[_job] * _periodCreditsToRemove) / _jobPeriodCredits[_job];\n _jobPeriodCredits[_job] -= _periodCreditsToRemove;\n }\n\n liquidityAmount[_job][_liquidity] -= _amount;\n if (liquidityAmount[_job][_liquidity] == 0) {\n _jobLiquidities[_job].remove(_liquidity);\n }\n }\n\n /// @notice Returns a fraction of the multiplier or the whole multiplier if equal or more than a rewardPeriodTime has passed\n function _phase(uint256 _timePassed, uint256 _multiplier) internal view returns (uint256 _result) {\n if (_timePassed < rewardPeriodTime) {\n _result = (_timePassed * _multiplier) / rewardPeriodTime;\n } else _result = _multiplier;\n }\n\n /// @notice Returns the start of the period of the provided timestamp\n function _period(uint256 _timestamp) internal view returns (uint256 _periodTimestamp) {\n return _timestamp - (_timestamp % rewardPeriodTime);\n }\n\n /// @notice Calculates relation between rewardPeriod and inflationPeriod\n function _getReward(uint256 _baseAmount) internal view returns (uint256 _credits) {\n return FullMath.mulDiv(_baseAmount, rewardPeriodTime, inflationPeriod);\n }\n\n /// @notice Returns underlying KP3R amount for a given liquidity amount\n function _quoteLiquidity(uint256 _amount, address _liquidity) internal view returns (uint256 _quote) {\n if (_tick[_liquidity].period != 0) {\n int56 _tickDifference = _isKP3RToken0[_liquidity] ? _tick[_liquidity].difference : -_tick[_liquidity].difference;\n _quote = IKeep3rHelper(keep3rHelper).getKP3RsAtTick(_amount, _tickDifference, rewardPeriodTime);\n }\n }\n\n /// @notice Returns KP3R amount for a given ETH amount\n function _quoteKp3rs(uint256 _eth) internal view returns (uint256 _amountOut) {\n int56 _tickDifference = _isKP3RToken0[kp3rWethPool] ? _tick[kp3rWethPool].difference : -_tick[kp3rWethPool].difference;\n _amountOut = IKeep3rHelper(keep3rHelper).getQuoteAtTick(uint128(_eth), _tickDifference, rewardPeriodTime);\n }\n\n /// @notice Updates job credits to current quotes and rewards job's pending minted credits\n /// @dev Ensures a maximum of 1 period of credits\n function _settleJobAccountance(address _job) internal virtual {\n _updateJobCreditsIfNeeded(_job);\n _rewardJobCredits(_job);\n _jobLiquidityCredits[_job] = Math.min(_jobLiquidityCredits[_job], _jobPeriodCredits[_job]);\n }\n}\n" - }, - "solidity/contracts/peripherals/Keep3rDisputable.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport './Keep3rParameters.sol';\nimport './Keep3rRoles.sol';\nimport '../../interfaces/peripherals/IKeep3rDisputable.sol';\n\nabstract contract Keep3rDisputable is IKeep3rDisputable, Keep3rAccountance, Keep3rRoles {\n /// @inheritdoc IKeep3rDisputable\n function dispute(address _jobOrKeeper) external override onlyDisputer {\n if (disputes[_jobOrKeeper]) revert AlreadyDisputed();\n disputes[_jobOrKeeper] = true;\n emit Dispute(_jobOrKeeper, msg.sender);\n }\n\n /// @inheritdoc IKeep3rDisputable\n function resolve(address _jobOrKeeper) external override onlyDisputer {\n if (!disputes[_jobOrKeeper]) revert NotDisputed();\n disputes[_jobOrKeeper] = false;\n emit Resolve(_jobOrKeeper, msg.sender);\n }\n}\n" - }, - "solidity/contracts/peripherals/jobs/Keep3rJobOwnership.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../../../interfaces/peripherals/IKeep3rJobs.sol';\n\nabstract contract Keep3rJobOwnership is IKeep3rJobOwnership {\n /// @inheritdoc IKeep3rJobOwnership\n mapping(address => address) public override jobOwner;\n\n /// @inheritdoc IKeep3rJobOwnership\n mapping(address => address) public override jobPendingOwner;\n\n /// @inheritdoc IKeep3rJobOwnership\n function changeJobOwnership(address _job, address _newOwner) external override onlyJobOwner(_job) {\n jobPendingOwner[_job] = _newOwner;\n emit JobOwnershipChange(_job, jobOwner[_job], _newOwner);\n }\n\n /// @inheritdoc IKeep3rJobOwnership\n function acceptJobOwnership(address _job) external override onlyPendingJobOwner(_job) {\n address _previousOwner = jobOwner[_job];\n\n jobOwner[_job] = jobPendingOwner[_job];\n delete jobPendingOwner[_job];\n\n emit JobOwnershipAssent(msg.sender, _job, _previousOwner);\n }\n\n modifier onlyJobOwner(address _job) {\n if (msg.sender != jobOwner[_job]) revert OnlyJobOwner();\n _;\n }\n\n modifier onlyPendingJobOwner(address _job) {\n if (msg.sender != jobPendingOwner[_job]) revert OnlyPendingJobOwner();\n _;\n }\n}\n" - }, - "solidity/interfaces/peripherals/IKeep3rJobs.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\n/// @title Keep3rJobFundableCredits contract\n/// @notice Handles the addition and withdrawal of credits from a job\ninterface IKeep3rJobFundableCredits {\n // Events\n\n /// @notice Emitted when Keep3rJobFundableCredits#addTokenCreditsToJob is called\n /// @param _job The address of the job being credited\n /// @param _token The address of the token being provided\n /// @param _provider The user that calls the function\n /// @param _amount The amount of credit being added to the job\n event TokenCreditAddition(address indexed _job, address indexed _token, address indexed _provider, uint256 _amount);\n\n /// @notice Emitted when Keep3rJobFundableCredits#withdrawTokenCreditsFromJob is called\n /// @param _job The address of the job from which the credits are withdrawn\n /// @param _token The credit being withdrawn from the job\n /// @param _receiver The user that receives the tokens\n /// @param _amount The amount of credit withdrawn\n event TokenCreditWithdrawal(address indexed _job, address indexed _token, address indexed _receiver, uint256 _amount);\n\n // Errors\n\n /// @notice Throws when the token is KP3R, as it should not be used for direct token payments\n error TokenUnallowed();\n\n /// @notice Throws when the token withdraw cooldown has not yet passed\n error JobTokenCreditsLocked();\n\n /// @notice Throws when the user tries to withdraw more tokens than it has\n error InsufficientJobTokenCredits();\n\n // Variables\n\n /// @notice Last block where tokens were added to the job\n /// @param _job The address of the job credited\n /// @param _token The address of the token credited\n /// @return _timestamp The last block where tokens were added to the job\n function jobTokenCreditsAddedAt(address _job, address _token) external view returns (uint256 _timestamp);\n\n // Methods\n\n /// @notice Add credit to a job to be paid out for work\n /// @param _job The address of the job being credited\n /// @param _token The address of the token being credited\n /// @param _amount The amount of credit being added\n function addTokenCreditsToJob(\n address _job,\n address _token,\n uint256 _amount\n ) external;\n\n /// @notice Withdraw credit from a job\n /// @param _job The address of the job from which the credits are withdrawn\n /// @param _token The address of the token being withdrawn\n /// @param _amount The amount of token to be withdrawn\n /// @param _receiver The user that will receive tokens\n function withdrawTokenCreditsFromJob(\n address _job,\n address _token,\n uint256 _amount,\n address _receiver\n ) external;\n}\n\n/// @title Keep3rJobFundableLiquidity contract\n/// @notice Handles the funding of jobs through specific liquidity pairs\ninterface IKeep3rJobFundableLiquidity {\n // Events\n\n /// @notice Emitted when Keep3rJobFundableLiquidity#approveLiquidity function is called\n /// @param _liquidity The address of the liquidity pair being approved\n event LiquidityApproval(address _liquidity);\n\n /// @notice Emitted when Keep3rJobFundableLiquidity#revokeLiquidity function is called\n /// @param _liquidity The address of the liquidity pair being revoked\n event LiquidityRevocation(address _liquidity);\n\n /// @notice Emitted when IKeep3rJobFundableLiquidity#addLiquidityToJob function is called\n /// @param _job The address of the job to which liquidity will be added\n /// @param _liquidity The address of the liquidity being added\n /// @param _provider The user that calls the function\n /// @param _amount The amount of liquidity being added\n event LiquidityAddition(address indexed _job, address indexed _liquidity, address indexed _provider, uint256 _amount);\n\n /// @notice Emitted when IKeep3rJobFundableLiquidity#withdrawLiquidityFromJob function is called\n /// @param _job The address of the job of which liquidity will be withdrawn from\n /// @param _liquidity The address of the liquidity being withdrawn\n /// @param _receiver The receiver of the liquidity tokens\n /// @param _amount The amount of liquidity being withdrawn from the job\n event LiquidityWithdrawal(address indexed _job, address indexed _liquidity, address indexed _receiver, uint256 _amount);\n\n /// @notice Emitted when Keep3rJobFundableLiquidity#addLiquidityToJob function is called\n /// @param _job The address of the job whose credits will be updated\n /// @param _rewardedAt The time at which the job was last rewarded\n /// @param _currentCredits The current credits of the job\n /// @param _periodCredits The credits of the job for the current period\n event LiquidityCreditsReward(address indexed _job, uint256 _rewardedAt, uint256 _currentCredits, uint256 _periodCredits);\n\n /// @notice Emitted when Keep3rJobFundableLiquidity#forceLiquidityCreditsToJob function is called\n /// @param _job The address of the job whose credits will be updated\n /// @param _rewardedAt The time at which the job was last rewarded\n /// @param _currentCredits The current credits of the job\n event LiquidityCreditsForced(address indexed _job, uint256 _rewardedAt, uint256 _currentCredits);\n\n // Errors\n\n /// @notice Throws when the liquidity being approved has already been approved\n error LiquidityPairApproved();\n\n /// @notice Throws when the liquidity being removed has not been approved\n error LiquidityPairUnexistent();\n\n /// @notice Throws when trying to add liquidity to an unapproved pool\n error LiquidityPairUnapproved();\n\n /// @notice Throws when the job doesn't have the requested liquidity\n error JobLiquidityUnexistent();\n\n /// @notice Throws when trying to remove more liquidity than the job has\n error JobLiquidityInsufficient();\n\n /// @notice Throws when trying to add less liquidity than the minimum liquidity required\n error JobLiquidityLessThanMin();\n\n // Structs\n\n /// @notice Stores the tick information of the different liquidity pairs\n struct TickCache {\n int56 current; // Tracks the current tick\n int56 difference; // Stores the difference between the current tick and the last tick\n uint256 period; // Stores the period at which the last observation was made\n }\n\n // Variables\n\n /// @notice Lists liquidity pairs\n /// @return _list An array of addresses with all the approved liquidity pairs\n function approvedLiquidities() external view returns (address[] memory _list);\n\n /// @notice Amount of liquidity in a specified job\n /// @param _job The address of the job being checked\n /// @param _liquidity The address of the liquidity we are checking\n /// @return _amount Amount of liquidity in the specified job\n function liquidityAmount(address _job, address _liquidity) external view returns (uint256 _amount);\n\n /// @notice Last time the job was rewarded liquidity credits\n /// @param _job The address of the job being checked\n /// @return _timestamp Timestamp of the last time the job was rewarded liquidity credits\n function rewardedAt(address _job) external view returns (uint256 _timestamp);\n\n /// @notice Last time the job was worked\n /// @param _job The address of the job being checked\n /// @return _timestamp Timestamp of the last time the job was worked\n function workedAt(address _job) external view returns (uint256 _timestamp);\n\n // Methods\n\n /// @notice Returns the liquidity credits of a given job\n /// @param _job The address of the job of which we want to know the liquidity credits\n /// @return _amount The liquidity credits of a given job\n function jobLiquidityCredits(address _job) external view returns (uint256 _amount);\n\n /// @notice Returns the credits of a given job for the current period\n /// @param _job The address of the job of which we want to know the period credits\n /// @return _amount The credits the given job has at the current period\n function jobPeriodCredits(address _job) external view returns (uint256 _amount);\n\n /// @notice Calculates the total credits of a given job\n /// @param _job The address of the job of which we want to know the total credits\n /// @return _amount The total credits of the given job\n function totalJobCredits(address _job) external view returns (uint256 _amount);\n\n /// @notice Calculates how many credits should be rewarded periodically for a given liquidity amount\n /// @dev _periodCredits = underlying KP3Rs for given liquidity amount * rewardPeriod / inflationPeriod\n /// @param _liquidity The address of the liquidity to provide\n /// @param _amount The amount of liquidity to provide\n /// @return _periodCredits The amount of KP3R periodically minted for the given liquidity\n function quoteLiquidity(address _liquidity, uint256 _amount) external view returns (uint256 _periodCredits);\n\n /// @notice Observes the current state of the liquidity pair being observed and updates TickCache with the information\n /// @param _liquidity The address of the liquidity pair being observed\n /// @return _tickCache The updated TickCache\n function observeLiquidity(address _liquidity) external view returns (TickCache memory _tickCache);\n\n /// @notice Gifts liquidity credits to the specified job\n /// @param _job The address of the job being credited\n /// @param _amount The amount of liquidity credits to gift\n function forceLiquidityCreditsToJob(address _job, uint256 _amount) external;\n\n /// @notice Approve a liquidity pair for being accepted in future\n /// @param _liquidity The address of the liquidity accepted\n function approveLiquidity(address _liquidity) external;\n\n /// @notice Revoke a liquidity pair from being accepted in future\n /// @param _liquidity The liquidity no longer accepted\n function revokeLiquidity(address _liquidity) external;\n\n /// @notice Allows anyone to fund a job with liquidity\n /// @param _job The address of the job to assign liquidity to\n /// @param _liquidity The liquidity being added\n /// @param _amount The amount of liquidity tokens to add\n function addLiquidityToJob(\n address _job,\n address _liquidity,\n uint256 _amount\n ) external;\n\n /// @notice Unbond liquidity for a job\n /// @dev Can only be called by the job's owner\n /// @param _job The address of the job being unbonded from\n /// @param _liquidity The liquidity being unbonded\n /// @param _amount The amount of liquidity being removed\n function unbondLiquidityFromJob(\n address _job,\n address _liquidity,\n uint256 _amount\n ) external;\n\n /// @notice Withdraw liquidity from a job\n /// @param _job The address of the job being withdrawn from\n /// @param _liquidity The liquidity being withdrawn\n /// @param _receiver The address that will receive the withdrawn liquidity\n function withdrawLiquidityFromJob(\n address _job,\n address _liquidity,\n address _receiver\n ) external;\n}\n\n/// @title Keep3rJobManager contract\n/// @notice Handles the addition and withdrawal of credits from a job\ninterface IKeep3rJobManager {\n // Events\n\n /// @notice Emitted when Keep3rJobManager#addJob is called\n /// @param _job The address of the job to add\n /// @param _jobOwner The job's owner\n event JobAddition(address indexed _job, address indexed _jobOwner);\n\n // Errors\n\n /// @notice Throws when trying to add a job that has already been added\n error JobAlreadyAdded();\n\n /// @notice Throws when the address that is trying to register as a keeper is already a keeper\n error AlreadyAKeeper();\n\n // Methods\n\n /// @notice Allows any caller to add a new job\n /// @param _job Address of the contract for which work should be performed\n function addJob(address _job) external;\n}\n\n/// @title Keep3rJobWorkable contract\n/// @notice Handles the mechanisms jobs can pay keepers with along with the restrictions jobs can put on keepers before they can work on jobs\ninterface IKeep3rJobWorkable {\n // Events\n\n /// @notice Emitted when a keeper is validated before a job\n /// @param _gasLeft The amount of gas that the transaction has left at the moment of keeper validation\n event KeeperValidation(uint256 _gasLeft);\n\n /// @notice Emitted when a keeper works a job\n /// @param _credit The address of the asset in which the keeper is paid\n /// @param _job The address of the job the keeper has worked\n /// @param _keeper The address of the keeper that has worked the job\n /// @param _amount The amount that has been paid out to the keeper in exchange for working the job\n /// @param _gasLeft The amount of gas that the transaction has left at the moment of payment\n event KeeperWork(address indexed _credit, address indexed _job, address indexed _keeper, uint256 _amount, uint256 _gasLeft);\n\n // Errors\n\n /// @notice Throws if the address claiming to be a job is not in the list of approved jobs\n error JobUnapproved();\n\n /// @notice Throws if the amount of funds in the job is less than the payment that must be paid to the keeper that works that job\n error InsufficientFunds();\n\n // Methods\n\n /// @notice Confirms if the current keeper is registered\n /// @dev Can be used for general (non critical) functions\n /// @param _keeper The keeper being investigated\n /// @return _isKeeper Whether the address passed as a parameter is a keeper or not\n function isKeeper(address _keeper) external returns (bool _isKeeper);\n\n /// @notice Confirms if the current keeper is registered and has a minimum bond of any asset.\n /// @dev Should be used for protected functions\n /// @param _keeper The keeper to check\n /// @param _bond The bond token being evaluated\n /// @param _minBond The minimum amount of bonded tokens\n /// @param _earned The minimum funds earned in the keepers lifetime\n /// @param _age The minimum keeper age required\n /// @return _isBondedKeeper Whether the `_keeper` meets the given requirements\n function isBondedKeeper(\n address _keeper,\n address _bond,\n uint256 _minBond,\n uint256 _earned,\n uint256 _age\n ) external returns (bool _isBondedKeeper);\n\n /// @notice Implemented by jobs to show that a keeper performed work\n /// @dev Automatically calculates the payment for the keeper and pays the keeper with bonded KP3R\n /// @param _keeper Address of the keeper that performed the work\n function worked(address _keeper) external;\n\n /// @notice Implemented by jobs to show that a keeper performed work\n /// @dev Pays the keeper that performs the work with KP3R\n /// @param _keeper Address of the keeper that performed the work\n /// @param _payment The reward that should be allocated for the job\n function bondedPayment(address _keeper, uint256 _payment) external;\n\n /// @notice Implemented by jobs to show that a keeper performed work\n /// @dev Pays the keeper that performs the work with a specific token\n /// @param _token The asset being awarded to the keeper\n /// @param _keeper Address of the keeper that performed the work\n /// @param _amount The reward that should be allocated\n function directTokenPayment(\n address _token,\n address _keeper,\n uint256 _amount\n ) external;\n}\n\n/// @title Keep3rJobOwnership contract\n/// @notice Handles the ownership of the jobs\ninterface IKeep3rJobOwnership {\n // Events\n\n /// @notice Emitted when Keep3rJobOwnership#changeJobOwnership is called\n /// @param _job The address of the job proposed to have a change of owner\n /// @param _owner The current owner of the job\n /// @param _pendingOwner The new address proposed to be the owner of the job\n event JobOwnershipChange(address indexed _job, address indexed _owner, address indexed _pendingOwner);\n\n /// @notice Emitted when Keep3rJobOwnership#JobOwnershipAssent is called\n /// @param _job The address of the job which the proposed owner will now own\n /// @param _previousOwner The previous owner of the job\n /// @param _newOwner The new owner of the job\n event JobOwnershipAssent(address indexed _job, address indexed _previousOwner, address indexed _newOwner);\n\n // Errors\n\n /// @notice Throws when the caller of the function is not the job owner\n error OnlyJobOwner();\n\n /// @notice Throws when the caller of the function is not the pending job owner\n error OnlyPendingJobOwner();\n\n // Variables\n\n /// @notice Maps the job to the owner of the job\n /// @param _job The address of the job\n /// @return _owner The address of the owner of the job\n function jobOwner(address _job) external view returns (address _owner);\n\n /// @notice Maps the job to its pending owner\n /// @param _job The address of the job\n /// @return _pendingOwner The address of the pending owner of the job\n function jobPendingOwner(address _job) external view returns (address _pendingOwner);\n\n // Methods\n\n /// @notice Proposes a new address to be the owner of the job\n /// @param _job The address of the job\n /// @param _newOwner The address of the proposed new owner\n function changeJobOwnership(address _job, address _newOwner) external;\n\n /// @notice The proposed address accepts to be the owner of the job\n /// @param _job The address of the job\n function acceptJobOwnership(address _job) external;\n}\n\n/// @title Keep3rJobMigration contract\n/// @notice Handles the migration process of jobs to different addresses\ninterface IKeep3rJobMigration {\n // Events\n\n /// @notice Emitted when Keep3rJobMigration#migrateJob function is called\n /// @param _fromJob The address of the job that requests to migrate\n /// @param _toJob The address at which the job requests to migrate\n event JobMigrationRequested(address indexed _fromJob, address _toJob);\n\n /// @notice Emitted when Keep3rJobMigration#acceptJobMigration function is called\n /// @param _fromJob The address of the job that requested to migrate\n /// @param _toJob The address at which the job had requested to migrate\n event JobMigrationSuccessful(address _fromJob, address indexed _toJob);\n\n // Errors\n\n /// @notice Throws when the address of the job that requests to migrate wants to migrate to its same address\n error JobMigrationImpossible();\n\n /// @notice Throws when the _toJob address differs from the address being tracked in the pendingJobMigrations mapping\n error JobMigrationUnavailable();\n\n /// @notice Throws when cooldown between migrations has not yet passed\n error JobMigrationLocked();\n\n // Variables\n\n /// @notice Maps the jobs that have requested a migration to the address they have requested to migrate to\n /// @return _toJob The address to which the job has requested to migrate to\n function pendingJobMigrations(address _fromJob) external view returns (address _toJob);\n\n // Methods\n\n /// @notice Initializes the migration process for a job by adding the request to the pendingJobMigrations mapping\n /// @param _fromJob The address of the job that is requesting to migrate\n /// @param _toJob The address at which the job is requesting to migrate\n function migrateJob(address _fromJob, address _toJob) external;\n\n /// @notice Completes the migration process for a job\n /// @dev Unbond/withdraw process doesn't get migrated\n /// @param _fromJob The address of the job that requested to migrate\n /// @param _toJob The address to which the job wants to migrate to\n function acceptJobMigration(address _fromJob, address _toJob) external;\n}\n\n/// @title Keep3rJobDisputable contract\n/// @notice Handles the actions that can be taken on a disputed job\ninterface IKeep3rJobDisputable is IKeep3rJobFundableCredits, IKeep3rJobFundableLiquidity {\n // Events\n\n /// @notice Emitted when Keep3rJobDisputable#slashTokenFromJob is called\n /// @param _job The address of the job from which the token will be slashed\n /// @param _token The address of the token being slashed\n /// @param _slasher The user that slashes the token\n /// @param _amount The amount of the token being slashed\n event JobSlashToken(address indexed _job, address _token, address indexed _slasher, uint256 _amount);\n\n /// @notice Emitted when Keep3rJobDisputable#slashLiquidityFromJob is called\n /// @param _job The address of the job from which the liquidity will be slashed\n /// @param _liquidity The address of the liquidity being slashed\n /// @param _slasher The user that slashes the liquidity\n /// @param _amount The amount of the liquidity being slashed\n event JobSlashLiquidity(address indexed _job, address _liquidity, address indexed _slasher, uint256 _amount);\n\n // Errors\n\n /// @notice Throws when the token trying to be slashed doesn't exist\n error JobTokenUnexistent();\n\n /// @notice Throws when someone tries to slash more tokens than the job has\n error JobTokenInsufficient();\n\n // Methods\n\n /// @notice Allows governance or slasher to slash a job specific token\n /// @param _job The address of the job from which the token will be slashed\n /// @param _token The address of the token that will be slashed\n /// @param _amount The amount of the token that will be slashed\n function slashTokenFromJob(\n address _job,\n address _token,\n uint256 _amount\n ) external;\n\n /// @notice Allows governance or a slasher to slash liquidity from a job\n /// @param _job The address being slashed\n /// @param _liquidity The address of the liquidity that will be slashed\n /// @param _amount The amount of liquidity that will be slashed\n function slashLiquidityFromJob(\n address _job,\n address _liquidity,\n uint256 _amount\n ) external;\n}\n\n// solhint-disable-next-line no-empty-blocks\ninterface IKeep3rJobs is IKeep3rJobOwnership, IKeep3rJobDisputable, IKeep3rJobMigration, IKeep3rJobManager, IKeep3rJobWorkable {\n\n}\n" - }, - "@openzeppelin/contracts/security/ReentrancyGuard.sol": { - "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Contract module that helps prevent reentrant calls to a function.\n *\n * Inheriting from `ReentrancyGuard` will make the {nonReentrant} modifier\n * available, which can be applied to functions to make sure there are no nested\n * (reentrant) calls to them.\n *\n * Note that because there is a single `nonReentrant` guard, functions marked as\n * `nonReentrant` may not call one another. This can be worked around by making\n * those functions `private`, and then adding `external` `nonReentrant` entry\n * points to them.\n *\n * TIP: If you would like to learn more about reentrancy and alternative ways\n * to protect against it, check out our blog post\n * https://blog.openzeppelin.com/reentrancy-after-istanbul/[Reentrancy After Istanbul].\n */\nabstract contract ReentrancyGuard {\n // Booleans are more expensive than uint256 or any type that takes up a full\n // word because each write operation emits an extra SLOAD to first read the\n // slot's contents, replace the bits taken up by the boolean, and then write\n // back. This is the compiler's defense against contract upgrades and\n // pointer aliasing, and it cannot be disabled.\n\n // The values being non-zero value makes deployment a bit more expensive,\n // but in exchange the refund on every call to nonReentrant will be lower in\n // amount. Since refunds are capped to a percentage of the total\n // transaction's gas, it is best to keep them low in cases like this one, to\n // increase the likelihood of the full refund coming into effect.\n uint256 private constant _NOT_ENTERED = 1;\n uint256 private constant _ENTERED = 2;\n\n uint256 private _status;\n\n constructor() {\n _status = _NOT_ENTERED;\n }\n\n /**\n * @dev Prevents a contract from calling itself, directly or indirectly.\n * Calling a `nonReentrant` function from another `nonReentrant`\n * function is not supported. It is possible to prevent this from happening\n * by making the `nonReentrant` function external, and make it call a\n * `private` function that does the actual work.\n */\n modifier nonReentrant() {\n // On the first call to nonReentrant, _notEntered will be true\n require(_status != _ENTERED, \"ReentrancyGuard: reentrant call\");\n\n // Any calls to nonReentrant after this point will fail\n _status = _ENTERED;\n\n _;\n\n // By storing the original value once again, a refund is triggered (see\n // https://eips.ethereum.org/EIPS/eip-2200)\n _status = _NOT_ENTERED;\n }\n}\n" - }, - "@openzeppelin/contracts/token/ERC20/IERC20.sol": { - "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Interface of the ERC20 standard as defined in the EIP.\n */\ninterface IERC20 {\n /**\n * @dev Returns the amount of tokens in existence.\n */\n function totalSupply() external view returns (uint256);\n\n /**\n * @dev Returns the amount of tokens owned by `account`.\n */\n function balanceOf(address account) external view returns (uint256);\n\n /**\n * @dev Moves `amount` tokens from the caller's account to `recipient`.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * Emits a {Transfer} event.\n */\n function transfer(address recipient, uint256 amount) external returns (bool);\n\n /**\n * @dev Returns the remaining number of tokens that `spender` will be\n * allowed to spend on behalf of `owner` through {transferFrom}. This is\n * zero by default.\n *\n * This value changes when {approve} or {transferFrom} are called.\n */\n function allowance(address owner, address spender) external view returns (uint256);\n\n /**\n * @dev Sets `amount` as the allowance of `spender` over the caller's tokens.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * IMPORTANT: Beware that changing an allowance with this method brings the risk\n * that someone may use both the old and the new allowance by unfortunate\n * transaction ordering. One possible solution to mitigate this race\n * condition is to first reduce the spender's allowance to 0 and set the\n * desired value afterwards:\n * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729\n *\n * Emits an {Approval} event.\n */\n function approve(address spender, uint256 amount) external returns (bool);\n\n /**\n * @dev Moves `amount` tokens from `sender` to `recipient` using the\n * allowance mechanism. `amount` is then deducted from the caller's\n * allowance.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * Emits a {Transfer} event.\n */\n function transferFrom(\n address sender,\n address recipient,\n uint256 amount\n ) external returns (bool);\n\n /**\n * @dev Emitted when `value` tokens are moved from one account (`from`) to\n * another (`to`).\n *\n * Note that `value` may be zero.\n */\n event Transfer(address indexed from, address indexed to, uint256 value);\n\n /**\n * @dev Emitted when the allowance of a `spender` for an `owner` is set by\n * a call to {approve}. `value` is the new allowance.\n */\n event Approval(address indexed owner, address indexed spender, uint256 value);\n}\n" - }, - "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol": { - "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\nimport \"../IERC20.sol\";\nimport \"../../../utils/Address.sol\";\n\n/**\n * @title SafeERC20\n * @dev Wrappers around ERC20 operations that throw on failure (when the token\n * contract returns false). Tokens that return no value (and instead revert or\n * throw on failure) are also supported, non-reverting calls are assumed to be\n * successful.\n * To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract,\n * which allows you to call the safe operations as `token.safeTransfer(...)`, etc.\n */\nlibrary SafeERC20 {\n using Address for address;\n\n function safeTransfer(\n IERC20 token,\n address to,\n uint256 value\n ) internal {\n _callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value));\n }\n\n function safeTransferFrom(\n IERC20 token,\n address from,\n address to,\n uint256 value\n ) internal {\n _callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value));\n }\n\n /**\n * @dev Deprecated. This function has issues similar to the ones found in\n * {IERC20-approve}, and its usage is discouraged.\n *\n * Whenever possible, use {safeIncreaseAllowance} and\n * {safeDecreaseAllowance} instead.\n */\n function safeApprove(\n IERC20 token,\n address spender,\n uint256 value\n ) internal {\n // safeApprove should only be called when setting an initial allowance,\n // or when resetting it to zero. To increase and decrease it, use\n // 'safeIncreaseAllowance' and 'safeDecreaseAllowance'\n require(\n (value == 0) || (token.allowance(address(this), spender) == 0),\n \"SafeERC20: approve from non-zero to non-zero allowance\"\n );\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value));\n }\n\n function safeIncreaseAllowance(\n IERC20 token,\n address spender,\n uint256 value\n ) internal {\n uint256 newAllowance = token.allowance(address(this), spender) + value;\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));\n }\n\n function safeDecreaseAllowance(\n IERC20 token,\n address spender,\n uint256 value\n ) internal {\n unchecked {\n uint256 oldAllowance = token.allowance(address(this), spender);\n require(oldAllowance >= value, \"SafeERC20: decreased allowance below zero\");\n uint256 newAllowance = oldAllowance - value;\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));\n }\n }\n\n /**\n * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement\n * on the return value: the return value is optional (but if data is returned, it must not be false).\n * @param token The token targeted by the call.\n * @param data The call data (encoded using abi.encode or one of its variants).\n */\n function _callOptionalReturn(IERC20 token, bytes memory data) private {\n // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since\n // we're implementing it ourselves. We use {Address.functionCall} to perform this call, which verifies that\n // the target address contains contract code and also asserts for success in the low-level call.\n\n bytes memory returndata = address(token).functionCall(data, \"SafeERC20: low-level call failed\");\n if (returndata.length > 0) {\n // Return data is optional\n require(abi.decode(returndata, (bool)), \"SafeERC20: ERC20 operation did not succeed\");\n }\n }\n}\n" - }, - "@openzeppelin/contracts/utils/math/Math.sol": { - "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Standard math utilities missing in the Solidity language.\n */\nlibrary Math {\n /**\n * @dev Returns the largest of two numbers.\n */\n function max(uint256 a, uint256 b) internal pure returns (uint256) {\n return a >= b ? a : b;\n }\n\n /**\n * @dev Returns the smallest of two numbers.\n */\n function min(uint256 a, uint256 b) internal pure returns (uint256) {\n return a < b ? a : b;\n }\n\n /**\n * @dev Returns the average of two numbers. The result is rounded towards\n * zero.\n */\n function average(uint256 a, uint256 b) internal pure returns (uint256) {\n // (a + b) / 2 can overflow.\n return (a & b) + (a ^ b) / 2;\n }\n\n /**\n * @dev Returns the ceiling of the division of two numbers.\n *\n * This differs from standard division with `/` in that it rounds up instead\n * of rounding down.\n */\n function ceilDiv(uint256 a, uint256 b) internal pure returns (uint256) {\n // (a + b - 1) / b can overflow on addition, so we distribute.\n return a / b + (a % b == 0 ? 0 : 1);\n }\n}\n" - }, - "@openzeppelin/contracts/utils/structs/EnumerableSet.sol": { - "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Library for managing\n * https://en.wikipedia.org/wiki/Set_(abstract_data_type)[sets] of primitive\n * types.\n *\n * Sets have the following properties:\n *\n * - Elements are added, removed, and checked for existence in constant time\n * (O(1)).\n * - Elements are enumerated in O(n). No guarantees are made on the ordering.\n *\n * ```\n * contract Example {\n * // Add the library methods\n * using EnumerableSet for EnumerableSet.AddressSet;\n *\n * // Declare a set state variable\n * EnumerableSet.AddressSet private mySet;\n * }\n * ```\n *\n * As of v3.3.0, sets of type `bytes32` (`Bytes32Set`), `address` (`AddressSet`)\n * and `uint256` (`UintSet`) are supported.\n */\nlibrary EnumerableSet {\n // To implement this library for multiple types with as little code\n // repetition as possible, we write it in terms of a generic Set type with\n // bytes32 values.\n // The Set implementation uses private functions, and user-facing\n // implementations (such as AddressSet) are just wrappers around the\n // underlying Set.\n // This means that we can only create new EnumerableSets for types that fit\n // in bytes32.\n\n struct Set {\n // Storage of set values\n bytes32[] _values;\n // Position of the value in the `values` array, plus 1 because index 0\n // means a value is not in the set.\n mapping(bytes32 => uint256) _indexes;\n }\n\n /**\n * @dev Add a value to a set. O(1).\n *\n * Returns true if the value was added to the set, that is if it was not\n * already present.\n */\n function _add(Set storage set, bytes32 value) private returns (bool) {\n if (!_contains(set, value)) {\n set._values.push(value);\n // The value is stored at length-1, but we add 1 to all indexes\n // and use 0 as a sentinel value\n set._indexes[value] = set._values.length;\n return true;\n } else {\n return false;\n }\n }\n\n /**\n * @dev Removes a value from a set. O(1).\n *\n * Returns true if the value was removed from the set, that is if it was\n * present.\n */\n function _remove(Set storage set, bytes32 value) private returns (bool) {\n // We read and store the value's index to prevent multiple reads from the same storage slot\n uint256 valueIndex = set._indexes[value];\n\n if (valueIndex != 0) {\n // Equivalent to contains(set, value)\n // To delete an element from the _values array in O(1), we swap the element to delete with the last one in\n // the array, and then remove the last element (sometimes called as 'swap and pop').\n // This modifies the order of the array, as noted in {at}.\n\n uint256 toDeleteIndex = valueIndex - 1;\n uint256 lastIndex = set._values.length - 1;\n\n if (lastIndex != toDeleteIndex) {\n bytes32 lastvalue = set._values[lastIndex];\n\n // Move the last value to the index where the value to delete is\n set._values[toDeleteIndex] = lastvalue;\n // Update the index for the moved value\n set._indexes[lastvalue] = valueIndex; // Replace lastvalue's index to valueIndex\n }\n\n // Delete the slot where the moved value was stored\n set._values.pop();\n\n // Delete the index for the deleted slot\n delete set._indexes[value];\n\n return true;\n } else {\n return false;\n }\n }\n\n /**\n * @dev Returns true if the value is in the set. O(1).\n */\n function _contains(Set storage set, bytes32 value) private view returns (bool) {\n return set._indexes[value] != 0;\n }\n\n /**\n * @dev Returns the number of values on the set. O(1).\n */\n function _length(Set storage set) private view returns (uint256) {\n return set._values.length;\n }\n\n /**\n * @dev Returns the value stored at position `index` in the set. O(1).\n *\n * Note that there are no guarantees on the ordering of values inside the\n * array, and it may change when more values are added or removed.\n *\n * Requirements:\n *\n * - `index` must be strictly less than {length}.\n */\n function _at(Set storage set, uint256 index) private view returns (bytes32) {\n return set._values[index];\n }\n\n /**\n * @dev Return the entire set in an array\n *\n * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed\n * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that\n * this function has an unbounded cost, and using it as part of a state-changing function may render the function\n * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.\n */\n function _values(Set storage set) private view returns (bytes32[] memory) {\n return set._values;\n }\n\n // Bytes32Set\n\n struct Bytes32Set {\n Set _inner;\n }\n\n /**\n * @dev Add a value to a set. O(1).\n *\n * Returns true if the value was added to the set, that is if it was not\n * already present.\n */\n function add(Bytes32Set storage set, bytes32 value) internal returns (bool) {\n return _add(set._inner, value);\n }\n\n /**\n * @dev Removes a value from a set. O(1).\n *\n * Returns true if the value was removed from the set, that is if it was\n * present.\n */\n function remove(Bytes32Set storage set, bytes32 value) internal returns (bool) {\n return _remove(set._inner, value);\n }\n\n /**\n * @dev Returns true if the value is in the set. O(1).\n */\n function contains(Bytes32Set storage set, bytes32 value) internal view returns (bool) {\n return _contains(set._inner, value);\n }\n\n /**\n * @dev Returns the number of values in the set. O(1).\n */\n function length(Bytes32Set storage set) internal view returns (uint256) {\n return _length(set._inner);\n }\n\n /**\n * @dev Returns the value stored at position `index` in the set. O(1).\n *\n * Note that there are no guarantees on the ordering of values inside the\n * array, and it may change when more values are added or removed.\n *\n * Requirements:\n *\n * - `index` must be strictly less than {length}.\n */\n function at(Bytes32Set storage set, uint256 index) internal view returns (bytes32) {\n return _at(set._inner, index);\n }\n\n /**\n * @dev Return the entire set in an array\n *\n * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed\n * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that\n * this function has an unbounded cost, and using it as part of a state-changing function may render the function\n * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.\n */\n function values(Bytes32Set storage set) internal view returns (bytes32[] memory) {\n return _values(set._inner);\n }\n\n // AddressSet\n\n struct AddressSet {\n Set _inner;\n }\n\n /**\n * @dev Add a value to a set. O(1).\n *\n * Returns true if the value was added to the set, that is if it was not\n * already present.\n */\n function add(AddressSet storage set, address value) internal returns (bool) {\n return _add(set._inner, bytes32(uint256(uint160(value))));\n }\n\n /**\n * @dev Removes a value from a set. O(1).\n *\n * Returns true if the value was removed from the set, that is if it was\n * present.\n */\n function remove(AddressSet storage set, address value) internal returns (bool) {\n return _remove(set._inner, bytes32(uint256(uint160(value))));\n }\n\n /**\n * @dev Returns true if the value is in the set. O(1).\n */\n function contains(AddressSet storage set, address value) internal view returns (bool) {\n return _contains(set._inner, bytes32(uint256(uint160(value))));\n }\n\n /**\n * @dev Returns the number of values in the set. O(1).\n */\n function length(AddressSet storage set) internal view returns (uint256) {\n return _length(set._inner);\n }\n\n /**\n * @dev Returns the value stored at position `index` in the set. O(1).\n *\n * Note that there are no guarantees on the ordering of values inside the\n * array, and it may change when more values are added or removed.\n *\n * Requirements:\n *\n * - `index` must be strictly less than {length}.\n */\n function at(AddressSet storage set, uint256 index) internal view returns (address) {\n return address(uint160(uint256(_at(set._inner, index))));\n }\n\n /**\n * @dev Return the entire set in an array\n *\n * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed\n * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that\n * this function has an unbounded cost, and using it as part of a state-changing function may render the function\n * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.\n */\n function values(AddressSet storage set) internal view returns (address[] memory) {\n bytes32[] memory store = _values(set._inner);\n address[] memory result;\n\n assembly {\n result := store\n }\n\n return result;\n }\n\n // UintSet\n\n struct UintSet {\n Set _inner;\n }\n\n /**\n * @dev Add a value to a set. O(1).\n *\n * Returns true if the value was added to the set, that is if it was not\n * already present.\n */\n function add(UintSet storage set, uint256 value) internal returns (bool) {\n return _add(set._inner, bytes32(value));\n }\n\n /**\n * @dev Removes a value from a set. O(1).\n *\n * Returns true if the value was removed from the set, that is if it was\n * present.\n */\n function remove(UintSet storage set, uint256 value) internal returns (bool) {\n return _remove(set._inner, bytes32(value));\n }\n\n /**\n * @dev Returns true if the value is in the set. O(1).\n */\n function contains(UintSet storage set, uint256 value) internal view returns (bool) {\n return _contains(set._inner, bytes32(value));\n }\n\n /**\n * @dev Returns the number of values on the set. O(1).\n */\n function length(UintSet storage set) internal view returns (uint256) {\n return _length(set._inner);\n }\n\n /**\n * @dev Returns the value stored at position `index` in the set. O(1).\n *\n * Note that there are no guarantees on the ordering of values inside the\n * array, and it may change when more values are added or removed.\n *\n * Requirements:\n *\n * - `index` must be strictly less than {length}.\n */\n function at(UintSet storage set, uint256 index) internal view returns (uint256) {\n return uint256(_at(set._inner, index));\n }\n\n /**\n * @dev Return the entire set in an array\n *\n * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed\n * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that\n * this function has an unbounded cost, and using it as part of a state-changing function may render the function\n * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.\n */\n function values(UintSet storage set) internal view returns (uint256[] memory) {\n bytes32[] memory store = _values(set._inner);\n uint256[] memory result;\n\n assembly {\n result := store\n }\n\n return result;\n }\n}\n" - }, - "solidity/interfaces/peripherals/IKeep3rAccountance.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\n/// @title Keep3rDisputable contract\n/// @notice Disputes keepers, or if they're already disputed, it can resolve the case\n/// @dev Argument `bonding` can be the address of either a token or a liquidity\ninterface IKeep3rAccountance {\n // Events\n\n /// @notice Emitted when the bonding process of a new keeper begins\n /// @param _keeper The caller of Keep3rKeeperFundable#bond function\n /// @param _bonding The asset the keeper has bonded\n /// @param _amount The amount the keeper has bonded\n event Bonding(address indexed _keeper, address indexed _bonding, uint256 _amount);\n\n /// @notice Emitted when a keeper or job begins the unbonding process to withdraw the funds\n /// @param _keeperOrJob The keeper or job that began the unbonding process\n /// @param _unbonding The liquidity pair or asset being unbonded\n /// @param _amount The amount being unbonded\n event Unbonding(address indexed _keeperOrJob, address indexed _unbonding, uint256 _amount);\n\n // Variables\n\n /// @notice Tracks the total KP3R earnings of a keeper since it started working\n /// @param _keeper The address of the keeper\n /// @return _workCompleted Total KP3R earnings of a keeper since it started working\n function workCompleted(address _keeper) external view returns (uint256 _workCompleted);\n\n /// @notice Tracks when a keeper was first registered\n /// @param _keeper The address of the keeper\n /// @return timestamp The time at which the keeper was first registered\n function firstSeen(address _keeper) external view returns (uint256 timestamp);\n\n /// @notice Tracks if a keeper or job has a pending dispute\n /// @param _keeperOrJob The address of the keeper or job\n /// @return _disputed Whether a keeper or job has a pending dispute\n function disputes(address _keeperOrJob) external view returns (bool _disputed);\n\n /// @notice Tracks how much a keeper has bonded of a certain token\n /// @param _keeper The address of the keeper\n /// @param _bond The address of the token being bonded\n /// @return _bonds Amount of a certain token that a keeper has bonded\n function bonds(address _keeper, address _bond) external view returns (uint256 _bonds);\n\n /// @notice The current token credits available for a job\n /// @param _job The address of the job\n /// @param _token The address of the token bonded\n /// @return _amount The amount of token credits available for a job\n function jobTokenCredits(address _job, address _token) external view returns (uint256 _amount);\n\n /// @notice Tracks the amount of assets deposited in pending bonds\n /// @param _keeper The address of the keeper\n /// @param _bonding The address of the token being bonded\n /// @return _pendingBonds Amount of a certain asset a keeper has unbonding\n function pendingBonds(address _keeper, address _bonding) external view returns (uint256 _pendingBonds);\n\n /// @notice Tracks when a bonding for a keeper can be activated\n /// @param _keeper The address of the keeper\n /// @param _bonding The address of the token being bonded\n /// @return _timestamp Time at which the bonding for a keeper can be activated\n function canActivateAfter(address _keeper, address _bonding) external view returns (uint256 _timestamp);\n\n /// @notice Tracks when keeper bonds are ready to be withdrawn\n /// @param _keeper The address of the keeper\n /// @param _bonding The address of the token being unbonded\n /// @return _timestamp Time at which the keeper bonds are ready to be withdrawn\n function canWithdrawAfter(address _keeper, address _bonding) external view returns (uint256 _timestamp);\n\n /// @notice Tracks how much keeper bonds are to be withdrawn\n /// @param _keeper The address of the keeper\n /// @param _bonding The address of the token being unbonded\n /// @return _pendingUnbonds The amount of keeper bonds that are to be withdrawn\n function pendingUnbonds(address _keeper, address _bonding) external view returns (uint256 _pendingUnbonds);\n\n /// @notice Checks whether the address has ever bonded an asset\n /// @param _keeper The address of the keeper\n /// @return _hasBonded Whether the address has ever bonded an asset\n function hasBonded(address _keeper) external view returns (bool _hasBonded);\n\n // Methods\n\n /// @notice Lists all jobs\n /// @return _jobList Array with all the jobs in _jobs\n function jobs() external view returns (address[] memory _jobList);\n\n /// @notice Lists all keepers\n /// @return _keeperList Array with all the keepers in _keepers\n function keepers() external view returns (address[] memory _keeperList);\n\n // Errors\n\n /// @notice Throws when an address is passed as a job, but that address is not a job\n error JobUnavailable();\n\n /// @notice Throws when an action that requires an undisputed job is applied on a disputed job\n error JobDisputed();\n}\n" - }, - "solidity/interfaces/IKeep3rHelper.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.0 <0.9.0;\n\n/// @title Keep3rHelper contract\n/// @notice Contains all the helper functions used throughout the different files.\ninterface IKeep3rHelper {\n // Errors\n\n /// @notice Throws when none of the tokens in the liquidity pair is KP3R\n error LiquidityPairInvalid();\n\n // Variables\n\n /// @notice Address of KP3R token\n /// @return _kp3r Address of KP3R token\n // solhint-disable func-name-mixedcase\n function KP3R() external view returns (address _kp3r);\n\n /// @notice Address of KP3R-WETH pool to use as oracle\n /// @return _kp3rWeth Address of KP3R-WETH pool to use as oracle\n function KP3R_WETH_POOL() external view returns (address _kp3rWeth);\n\n /// @notice The minimum multiplier used to calculate the amount of gas paid to the Keeper for the gas used to perform a job\n /// For example: if the quoted gas used is 1000, then the minimum amount to be paid will be 1000 * MIN / BOOST_BASE\n /// @return _multiplier The MIN multiplier\n function MIN() external view returns (uint256 _multiplier);\n\n /// @notice The maximum multiplier used to calculate the amount of gas paid to the Keeper for the gas used to perform a job\n /// For example: if the quoted gas used is 1000, then the maximum amount to be paid will be 1000 * MAX / BOOST_BASE\n /// @return _multiplier The MAX multiplier\n function MAX() external view returns (uint256 _multiplier);\n\n /// @notice The boost base used to calculate the boost rewards for the keeper\n /// @return _base The boost base number\n function BOOST_BASE() external view returns (uint256 _base);\n\n /// @notice The targeted amount of bonded KP3Rs to max-up reward multiplier\n /// For example: if the amount of KP3R the keeper has bonded is TARGETBOND or more, then the keeper will get\n /// the maximum boost possible in his rewards, if it's less, the reward boost will be proportional\n /// @return _target The amount of KP3R that comforms the TARGETBOND\n function TARGETBOND() external view returns (uint256 _target);\n\n // Methods\n // solhint-enable func-name-mixedcase\n\n /// @notice Calculates the amount of KP3R that corresponds to the ETH passed into the function\n /// @dev This function allows us to calculate how much KP3R we should pay to a keeper for things expressed in ETH, like gas\n /// @param _eth The amount of ETH\n /// @return _amountOut The amount of KP3R\n function quote(uint256 _eth) external view returns (uint256 _amountOut);\n\n /// @notice Returns the amount of KP3R the keeper has bonded\n /// @param _keeper The address of the keeper to check\n /// @return _amountBonded The amount of KP3R the keeper has bonded\n function bonds(address _keeper) external view returns (uint256 _amountBonded);\n\n /// @notice Calculates the reward (in KP3R) that corresponds to a keeper for using gas\n /// @param _keeper The address of the keeper to check\n /// @param _gasUsed The amount of gas used that will be rewarded\n /// @return _kp3r The amount of KP3R that should be awarded to the keeper\n function getRewardAmountFor(address _keeper, uint256 _gasUsed) external view returns (uint256 _kp3r);\n\n /// @notice Calculates the boost in the reward given to a keeper based on the amount of KP3R that keeper has bonded\n /// @param _bonds The amount of KP3R tokens bonded by the keeper\n /// @return _rewardBoost The reward boost that corresponds to the keeper\n function getRewardBoostFor(uint256 _bonds) external view returns (uint256 _rewardBoost);\n\n /// @notice Calculates the reward (in KP3R) that corresponds to tx.origin for using gas\n /// @param _gasUsed The amount of gas used that will be rewarded\n /// @return _amount The amount of KP3R that should be awarded to tx.origin\n function getRewardAmount(uint256 _gasUsed) external view returns (uint256 _amount);\n\n /// @notice Given a pool address, returns the underlying tokens of the pair\n /// @param _pool Address of the correspondant pool\n /// @return _token0 Address of the first token of the pair\n /// @return _token1 Address of the second token of the pair\n function getPoolTokens(address _pool) external view returns (address _token0, address _token1);\n\n /// @notice Defines the order of the tokens in the pair for twap calculations\n /// @param _pool Address of the correspondant pool\n /// @return _isKP3RToken0 Boolean indicating the order of the tokens in the pair\n function isKP3RToken0(address _pool) external view returns (bool _isKP3RToken0);\n\n /// @notice Given an array of secondsAgo, returns UniswapV3 pool cumulatives at that moment\n /// @param _pool Address of the pool to observe\n /// @param _secondsAgo Array with time references to observe\n /// @return _tickCumulative1 Cumulative sum of ticks until first time reference\n /// @return _tickCumulative2 Cumulative sum of ticks until second time reference\n /// @return _success Boolean indicating if the observe call was succesfull\n function observe(address _pool, uint32[] memory _secondsAgo)\n external\n view\n returns (\n int56 _tickCumulative1,\n int56 _tickCumulative2,\n bool _success\n );\n\n /// @notice Given a tick and a liquidity amount, calculates the underlying KP3R tokens\n /// @param _liquidityAmount Amount of liquidity to be converted\n /// @param _tickDifference Tick value used to calculate the quote\n /// @param _timeInterval Time value used to calculate the quote\n /// @return _kp3rAmount Amount of KP3R tokens underlying on the given liquidity\n function getKP3RsAtTick(\n uint256 _liquidityAmount,\n int56 _tickDifference,\n uint256 _timeInterval\n ) external pure returns (uint256 _kp3rAmount);\n\n /// @notice Given a tick and a token amount, calculates the output in correspondant token\n /// @param _baseAmount Amount of token to be converted\n /// @param _tickDifference Tick value used to calculate the quote\n /// @param _timeInterval Time value used to calculate the quote\n /// @return _quoteAmount Amount of credits deserved for the baseAmount at the tick value\n function getQuoteAtTick(\n uint128 _baseAmount,\n int56 _tickDifference,\n uint256 _timeInterval\n ) external pure returns (uint256 _quoteAmount);\n}\n" - }, - "solidity/interfaces/peripherals/IKeep3rParameters.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport './IBaseErrors.sol';\n\n/// @title Keep3rParameters contract\n/// @notice Handles and sets all the required parameters for Keep3r\n\ninterface IKeep3rParameters is IBaseErrors {\n // Events\n\n /// @notice Emitted when the Keep3rHelper address is changed\n /// @param _keep3rHelper The address of Keep3rHelper's contract\n event Keep3rHelperChange(address _keep3rHelper);\n\n /// @notice Emitted when the Keep3rV1 address is changed\n /// @param _keep3rV1 The address of Keep3rV1's contract\n event Keep3rV1Change(address _keep3rV1);\n\n /// @notice Emitted when the Keep3rV1Proxy address is changed\n /// @param _keep3rV1Proxy The address of Keep3rV1Proxy's contract\n event Keep3rV1ProxyChange(address _keep3rV1Proxy);\n\n /// @notice Emitted when the KP3R-WETH pool address is changed\n /// @param _kp3rWethPool The address of the KP3R-WETH pool\n event Kp3rWethPoolChange(address _kp3rWethPool);\n\n /// @notice Emitted when bondTime is changed\n /// @param _bondTime The new bondTime\n event BondTimeChange(uint256 _bondTime);\n\n /// @notice Emitted when _liquidityMinimum is changed\n /// @param _liquidityMinimum The new _liquidityMinimum\n event LiquidityMinimumChange(uint256 _liquidityMinimum);\n\n /// @notice Emitted when _unbondTime is changed\n /// @param _unbondTime The new _unbondTime\n event UnbondTimeChange(uint256 _unbondTime);\n\n /// @notice Emitted when _rewardPeriodTime is changed\n /// @param _rewardPeriodTime The new _rewardPeriodTime\n event RewardPeriodTimeChange(uint256 _rewardPeriodTime);\n\n /// @notice Emitted when the inflationPeriod is changed\n /// @param _inflationPeriod The new inflationPeriod\n event InflationPeriodChange(uint256 _inflationPeriod);\n\n /// @notice Emitted when the fee is changed\n /// @param _fee The new token credits fee\n event FeeChange(uint256 _fee);\n\n // Variables\n\n /// @notice Address of Keep3rHelper's contract\n /// @return _keep3rHelper The address of Keep3rHelper's contract\n function keep3rHelper() external view returns (address _keep3rHelper);\n\n /// @notice Address of Keep3rV1's contract\n /// @return _keep3rV1 The address of Keep3rV1's contract\n function keep3rV1() external view returns (address _keep3rV1);\n\n /// @notice Address of Keep3rV1Proxy's contract\n /// @return _keep3rV1Proxy The address of Keep3rV1Proxy's contract\n function keep3rV1Proxy() external view returns (address _keep3rV1Proxy);\n\n /// @notice Address of the KP3R-WETH pool\n /// @return _kp3rWethPool The address of KP3R-WETH pool\n function kp3rWethPool() external view returns (address _kp3rWethPool);\n\n /// @notice The amount of time required to pass after a keeper has bonded assets for it to be able to activate\n /// @return _days The required bondTime in days\n function bondTime() external view returns (uint256 _days);\n\n /// @notice The amount of time required to pass before a keeper can unbond what he has bonded\n /// @return _days The required unbondTime in days\n function unbondTime() external view returns (uint256 _days);\n\n /// @notice The minimum amount of liquidity required to fund a job per liquidity\n /// @return _amount The minimum amount of liquidity in KP3R\n function liquidityMinimum() external view returns (uint256 _amount);\n\n /// @notice The amount of time between each scheduled credits reward given to a job\n /// @return _days The reward period in days\n function rewardPeriodTime() external view returns (uint256 _days);\n\n /// @notice The inflation period is the denominator used to regulate the emission of KP3R\n /// @return _period The denominator used to regulate the emission of KP3R\n function inflationPeriod() external view returns (uint256 _period);\n\n /// @notice The fee to be sent to governance when a user adds liquidity to a job\n /// @return _amount The fee amount to be sent to governance when a user adds liquidity to a job\n function fee() external view returns (uint256 _amount);\n\n // Errors\n\n /// @notice Throws if the reward period is less than the minimum reward period time\n error MinRewardPeriod();\n\n /// @notice Throws if either a job or a keeper is disputed\n error Disputed();\n\n /// @notice Throws if there are no bonded assets\n error BondsUnexistent();\n\n /// @notice Throws if the time required to bond an asset has not passed yet\n error BondsLocked();\n\n /// @notice Throws if there are no bonds to withdraw\n error UnbondsUnexistent();\n\n /// @notice Throws if the time required to withdraw the bonds has not passed yet\n error UnbondsLocked();\n\n // Methods\n\n /// @notice Sets the Keep3rHelper address\n /// @param _keep3rHelper The Keep3rHelper address\n function setKeep3rHelper(address _keep3rHelper) external;\n\n /// @notice Sets the Keep3rV1 address\n /// @param _keep3rV1 The Keep3rV1 address\n function setKeep3rV1(address _keep3rV1) external;\n\n /// @notice Sets the Keep3rV1Proxy address\n /// @param _keep3rV1Proxy The Keep3rV1Proxy address\n function setKeep3rV1Proxy(address _keep3rV1Proxy) external;\n\n /// @notice Sets the KP3R-WETH pool address\n /// @param _kp3rWethPool The KP3R-WETH pool address\n function setKp3rWethPool(address _kp3rWethPool) external;\n\n /// @notice Sets the bond time required to activate as a keeper\n /// @param _bond The new bond time\n function setBondTime(uint256 _bond) external;\n\n /// @notice Sets the unbond time required unbond what has been bonded\n /// @param _unbond The new unbond time\n function setUnbondTime(uint256 _unbond) external;\n\n /// @notice Sets the minimum amount of liquidity required to fund a job\n /// @param _liquidityMinimum The new minimum amount of liquidity\n function setLiquidityMinimum(uint256 _liquidityMinimum) external;\n\n /// @notice Sets the time required to pass between rewards for jobs\n /// @param _rewardPeriodTime The new amount of time required to pass between rewards\n function setRewardPeriodTime(uint256 _rewardPeriodTime) external;\n\n /// @notice Sets the new inflation period\n /// @param _inflationPeriod The new inflation period\n function setInflationPeriod(uint256 _inflationPeriod) external;\n\n /// @notice Sets the new fee\n /// @param _fee The new fee\n function setFee(uint256 _fee) external;\n}\n" - }, - "solidity/interfaces/peripherals/IBaseErrors.sol": { - "content": "// SPDX-License-Identifier: MIT\n\npragma solidity >=0.8.4 <0.9.0;\n\ninterface IBaseErrors {\n /// @notice Throws if a variable is assigned to the zero address\n error ZeroAddress();\n}\n" - }, - "solidity/interfaces/peripherals/IKeep3rRoles.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\n/// @title Keep3rRoles contract\n/// @notice Manages the Keep3r specific roles\ninterface IKeep3rRoles {\n // Events\n\n /// @notice Emitted when a slasher is added\n /// @param _slasher Address of the added slasher\n event SlasherAdded(address _slasher);\n\n /// @notice Emitted when a slasher is removed\n /// @param _slasher Address of the removed slasher\n event SlasherRemoved(address _slasher);\n\n /// @notice Emitted when a disputer is added\n /// @param _disputer Address of the added disputer\n event DisputerAdded(address _disputer);\n\n /// @notice Emitted when a disputer is removed\n /// @param _disputer Address of the removed disputer\n event DisputerRemoved(address _disputer);\n\n // Variables\n\n /// @notice Tracks whether the address is a slasher or not\n /// @param _slasher Address being checked as a slasher\n /// @return _isSlasher Whether the address is a slasher or not\n function slashers(address _slasher) external view returns (bool _isSlasher);\n\n /// @notice Tracks whether the address is a disputer or not\n /// @param _disputer Address being checked as a disputer\n /// @return _isDisputer Whether the address is a disputer or not\n function disputers(address _disputer) external view returns (bool _isDisputer);\n\n // Errors\n\n /// @notice Throws if the address is already a registered slasher\n error SlasherExistent();\n\n /// @notice Throws if caller is not a registered slasher\n error SlasherUnexistent();\n\n /// @notice Throws if the address is already a registered disputer\n error DisputerExistent();\n\n /// @notice Throws if caller is not a registered disputer\n error DisputerUnexistent();\n\n /// @notice Throws if the msg.sender is not a slasher or is not a part of governance\n error OnlySlasher();\n\n /// @notice Throws if the msg.sender is not a disputer or is not a part of governance\n error OnlyDisputer();\n\n // Methods\n\n /// @notice Registers a slasher by updating the slashers mapping\n function addSlasher(address _slasher) external;\n\n /// @notice Removes a slasher by updating the slashers mapping\n function removeSlasher(address _slasher) external;\n\n /// @notice Registers a disputer by updating the disputers mapping\n function addDisputer(address _disputer) external;\n\n /// @notice Removes a disputer by updating the disputers mapping\n function removeDisputer(address _disputer) external;\n}\n" - }, - "solidity/contracts/peripherals/Governable.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../../interfaces/peripherals/IGovernable.sol';\n\nabstract contract Governable is IGovernable {\n /// @inheritdoc IGovernable\n address public override governance;\n\n /// @inheritdoc IGovernable\n address public override pendingGovernance;\n\n constructor(address _governance) {\n if (_governance == address(0)) revert NoGovernanceZeroAddress();\n governance = _governance;\n }\n\n /// @inheritdoc IGovernable\n function setGovernance(address _governance) external override onlyGovernance {\n pendingGovernance = _governance;\n emit GovernanceProposal(_governance);\n }\n\n /// @inheritdoc IGovernable\n function acceptGovernance() external override onlyPendingGovernance {\n governance = pendingGovernance;\n delete pendingGovernance;\n emit GovernanceSet(governance);\n }\n\n /// @notice Functions with this modifier can only be called by governance\n modifier onlyGovernance {\n if (msg.sender != governance) revert OnlyGovernance();\n _;\n }\n\n /// @notice Functions with this modifier can only be called by pendingGovernance\n modifier onlyPendingGovernance {\n if (msg.sender != pendingGovernance) revert OnlyPendingGovernance();\n _;\n }\n}\n" - }, - "solidity/interfaces/peripherals/IGovernable.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\n/// @title Governable contract\n/// @notice Manages the governance role\ninterface IGovernable {\n // Events\n\n /// @notice Emitted when pendingGovernance accepts to be governance\n /// @param _governance Address of the new governance\n event GovernanceSet(address _governance);\n\n /// @notice Emitted when a new governance is proposed\n /// @param _pendingGovernance Address that is proposed to be the new governance\n event GovernanceProposal(address _pendingGovernance);\n\n // Errors\n\n /// @notice Throws if the caller of the function is not governance\n error OnlyGovernance();\n\n /// @notice Throws if the caller of the function is not pendingGovernance\n error OnlyPendingGovernance();\n\n /// @notice Throws if trying to set governance to zero address\n error NoGovernanceZeroAddress();\n\n // Variables\n\n /// @notice Stores the governance address\n /// @return _governance The governance addresss\n function governance() external view returns (address _governance);\n\n /// @notice Stores the pendingGovernance address\n /// @return _pendingGovernance The pendingGovernance addresss\n function pendingGovernance() external view returns (address _pendingGovernance);\n\n // Methods\n\n /// @notice Proposes a new address to be governance\n /// @param _governance The address being proposed as the new governance\n function setGovernance(address _governance) external;\n\n /// @notice Changes the governance from the current governance to the previously proposed address\n function acceptGovernance() external;\n}\n" - }, - "@openzeppelin/contracts/utils/Address.sol": { - "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Collection of functions related to the address type\n */\nlibrary Address {\n /**\n * @dev Returns true if `account` is a contract.\n *\n * [IMPORTANT]\n * ====\n * It is unsafe to assume that an address for which this function returns\n * false is an externally-owned account (EOA) and not a contract.\n *\n * Among others, `isContract` will return false for the following\n * types of addresses:\n *\n * - an externally-owned account\n * - a contract in construction\n * - an address where a contract will be created\n * - an address where a contract lived, but was destroyed\n * ====\n */\n function isContract(address account) internal view returns (bool) {\n // This method relies on extcodesize, which returns 0 for contracts in\n // construction, since the code is only stored at the end of the\n // constructor execution.\n\n uint256 size;\n assembly {\n size := extcodesize(account)\n }\n return size > 0;\n }\n\n /**\n * @dev Replacement for Solidity's `transfer`: sends `amount` wei to\n * `recipient`, forwarding all available gas and reverting on errors.\n *\n * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost\n * of certain opcodes, possibly making contracts go over the 2300 gas limit\n * imposed by `transfer`, making them unable to receive funds via\n * `transfer`. {sendValue} removes this limitation.\n *\n * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].\n *\n * IMPORTANT: because control is transferred to `recipient`, care must be\n * taken to not create reentrancy vulnerabilities. Consider using\n * {ReentrancyGuard} or the\n * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].\n */\n function sendValue(address payable recipient, uint256 amount) internal {\n require(address(this).balance >= amount, \"Address: insufficient balance\");\n\n (bool success, ) = recipient.call{value: amount}(\"\");\n require(success, \"Address: unable to send value, recipient may have reverted\");\n }\n\n /**\n * @dev Performs a Solidity function call using a low level `call`. A\n * plain `call` is an unsafe replacement for a function call: use this\n * function instead.\n *\n * If `target` reverts with a revert reason, it is bubbled up by this\n * function (like regular Solidity function calls).\n *\n * Returns the raw returned data. To convert to the expected return value,\n * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\n *\n * Requirements:\n *\n * - `target` must be a contract.\n * - calling `target` with `data` must not revert.\n *\n * _Available since v3.1._\n */\n function functionCall(address target, bytes memory data) internal returns (bytes memory) {\n return functionCall(target, data, \"Address: low-level call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with\n * `errorMessage` as a fallback revert reason when `target` reverts.\n *\n * _Available since v3.1._\n */\n function functionCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal returns (bytes memory) {\n return functionCallWithValue(target, data, 0, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but also transferring `value` wei to `target`.\n *\n * Requirements:\n *\n * - the calling contract must have an ETH balance of at least `value`.\n * - the called Solidity function must be `payable`.\n *\n * _Available since v3.1._\n */\n function functionCallWithValue(\n address target,\n bytes memory data,\n uint256 value\n ) internal returns (bytes memory) {\n return functionCallWithValue(target, data, value, \"Address: low-level call with value failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but\n * with `errorMessage` as a fallback revert reason when `target` reverts.\n *\n * _Available since v3.1._\n */\n function functionCallWithValue(\n address target,\n bytes memory data,\n uint256 value,\n string memory errorMessage\n ) internal returns (bytes memory) {\n require(address(this).balance >= value, \"Address: insufficient balance for call\");\n require(isContract(target), \"Address: call to non-contract\");\n\n (bool success, bytes memory returndata) = target.call{value: value}(data);\n return verifyCallResult(success, returndata, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but performing a static call.\n *\n * _Available since v3.3._\n */\n function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\n return functionStaticCall(target, data, \"Address: low-level static call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\n * but performing a static call.\n *\n * _Available since v3.3._\n */\n function functionStaticCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal view returns (bytes memory) {\n require(isContract(target), \"Address: static call to non-contract\");\n\n (bool success, bytes memory returndata) = target.staticcall(data);\n return verifyCallResult(success, returndata, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but performing a delegate call.\n *\n * _Available since v3.4._\n */\n function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {\n return functionDelegateCall(target, data, \"Address: low-level delegate call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\n * but performing a delegate call.\n *\n * _Available since v3.4._\n */\n function functionDelegateCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal returns (bytes memory) {\n require(isContract(target), \"Address: delegate call to non-contract\");\n\n (bool success, bytes memory returndata) = target.delegatecall(data);\n return verifyCallResult(success, returndata, errorMessage);\n }\n\n /**\n * @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the\n * revert reason using the provided one.\n *\n * _Available since v4.3._\n */\n function verifyCallResult(\n bool success,\n bytes memory returndata,\n string memory errorMessage\n ) internal pure returns (bytes memory) {\n if (success) {\n return returndata;\n } else {\n // Look for revert reason and bubble it up if present\n if (returndata.length > 0) {\n // The easiest way to bubble the revert reason is using memory via assembly\n\n assembly {\n let returndata_size := mload(returndata)\n revert(add(32, returndata), returndata_size)\n }\n } else {\n revert(errorMessage);\n }\n }\n }\n}\n" - }, - "solidity/interfaces/IPairManager.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.0 <0.9.0;\n\nimport '@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol';\n\n/// @title Pair Manager interface\n/// @notice Generic interface for Keep3r liquidity pools (kLP)\ninterface IPairManager is IERC20Metadata {\n /// @notice Address of the pool from which the Keep3r pair manager will interact with\n /// @return _pool The pool's address\n function pool() external view returns (address _pool);\n\n /// @notice Token0 of the pool\n /// @return _token0 The address of token0\n function token0() external view returns (address _token0);\n\n /// @notice Token1 of the pool\n /// @return _token1 The address of token1\n function token1() external view returns (address _token1);\n}\n" - }, - "solidity/contracts/libraries/FullMath.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\n/// @title Contains 512-bit math functions\n/// @notice Facilitates multiplication and division that can have overflow of an intermediate value without any loss of precision\n/// @dev Handles \"phantom overflow\" i.e., allows multiplication and division where an intermediate value overflows 256 bits\nlibrary FullMath {\n /// @notice Calculates floor(a×b÷denominator) with full precision. Throws if result overflows a uint256 or denominator == 0\n /// @param a The multiplicand\n /// @param b The multiplier\n /// @param denominator The divisor\n /// @return result The 256-bit result\n /// @dev Credit to Remco Bloemen under MIT license https://xn--2-umb.com/21/muldiv\n function mulDiv(\n uint256 a,\n uint256 b,\n uint256 denominator\n ) internal pure returns (uint256 result) {\n unchecked {\n // 512-bit multiply [prod1 prod0] = a * b\n // Compute the product mod 2**256 and mod 2**256 - 1\n // then use the Chinese Remainder Theorem to reconstruct\n // the 512 bit result. The result is stored in two 256\n // variables such that product = prod1 * 2**256 + prod0\n uint256 prod0; // Least significant 256 bits of the product\n uint256 prod1; // Most significant 256 bits of the product\n assembly {\n let mm := mulmod(a, b, not(0))\n prod0 := mul(a, b)\n prod1 := sub(sub(mm, prod0), lt(mm, prod0))\n }\n\n // Handle non-overflow cases, 256 by 256 division\n if (prod1 == 0) {\n require(denominator > 0);\n assembly {\n result := div(prod0, denominator)\n }\n return result;\n }\n\n // Make sure the result is less than 2**256.\n // Also prevents denominator == 0\n require(denominator > prod1);\n\n ///////////////////////////////////////////////\n // 512 by 256 division.\n ///////////////////////////////////////////////\n\n // Make division exact by subtracting the remainder from [prod1 prod0]\n // Compute remainder using mulmod\n uint256 remainder;\n assembly {\n remainder := mulmod(a, b, denominator)\n }\n // Subtract 256 bit number from 512 bit number\n assembly {\n prod1 := sub(prod1, gt(remainder, prod0))\n prod0 := sub(prod0, remainder)\n }\n\n // Factor powers of two out of denominator\n // Compute largest power of two divisor of denominator.\n // Always >= 1.\n uint256 twos = (~denominator + 1) & denominator;\n // Divide denominator by power of two\n assembly {\n denominator := div(denominator, twos)\n }\n\n // Divide [prod1 prod0] by the factors of two\n assembly {\n prod0 := div(prod0, twos)\n }\n // Shift in bits from prod1 into prod0. For this we need\n // to flip `twos` such that it is 2**256 / twos.\n // If twos is zero, then it becomes one\n assembly {\n twos := add(div(sub(0, twos), twos), 1)\n }\n prod0 |= prod1 * twos;\n\n // Invert denominator mod 2**256\n // Now that denominator is an odd number, it has an inverse\n // modulo 2**256 such that denominator * inv = 1 mod 2**256.\n // Compute the inverse by starting with a seed that is correct\n // correct for four bits. That is, denominator * inv = 1 mod 2**4\n uint256 inv = (3 * denominator) ^ 2;\n // Now use Newton-Raphson iteration to improve the precision.\n // Thanks to Hensel's lifting lemma, this also works in modular\n // arithmetic, doubling the correct bits in each step.\n inv *= 2 - denominator * inv; // inverse mod 2**8\n inv *= 2 - denominator * inv; // inverse mod 2**16\n inv *= 2 - denominator * inv; // inverse mod 2**32\n inv *= 2 - denominator * inv; // inverse mod 2**64\n inv *= 2 - denominator * inv; // inverse mod 2**128\n inv *= 2 - denominator * inv; // inverse mod 2**256\n\n // Because the division is now exact we can divide by multiplying\n // with the modular inverse of denominator. This will give us the\n // correct result modulo 2**256. Since the precoditions guarantee\n // that the outcome is less than 2**256, this is the final result.\n // We don't need to compute the high bits of the result and prod1\n // is no longer required.\n result = prod0 * inv;\n return result;\n }\n }\n\n /// @notice Calculates ceil(a×b÷denominator) with full precision. Throws if result overflows a uint256 or denominator == 0\n /// @param a The multiplicand\n /// @param b The multiplier\n /// @param denominator The divisor\n /// @return result The 256-bit result\n function mulDivRoundingUp(\n uint256 a,\n uint256 b,\n uint256 denominator\n ) internal pure returns (uint256 result) {\n unchecked {\n result = mulDiv(a, b, denominator);\n if (mulmod(a, b, denominator) > 0) {\n require(result < type(uint256).max);\n result++;\n }\n }\n }\n}\n" - }, - "@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol": { - "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\nimport \"../IERC20.sol\";\n\n/**\n * @dev Interface for the optional metadata functions from the ERC20 standard.\n *\n * _Available since v4.1._\n */\ninterface IERC20Metadata is IERC20 {\n /**\n * @dev Returns the name of the token.\n */\n function name() external view returns (string memory);\n\n /**\n * @dev Returns the symbol of the token.\n */\n function symbol() external view returns (string memory);\n\n /**\n * @dev Returns the decimals places of the token.\n */\n function decimals() external view returns (uint8);\n}\n" - }, - "solidity/interfaces/peripherals/IKeep3rDisputable.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\n/// @title Keep3rDisputable contract\n/// @notice Creates/resolves disputes for jobs or keepers\n/// A disputed keeper is slashable and is not able to bond, activate, withdraw or receive direct payments\n/// A disputed job is slashable and is not able to pay the keepers, withdraw tokens or to migrate\ninterface IKeep3rDisputable {\n /// @notice Emitted when a keeper or a job is disputed\n /// @param _jobOrKeeper The address of the disputed keeper/job\n /// @param _disputer The user that called the function and disputed the keeper\n event Dispute(address indexed _jobOrKeeper, address indexed _disputer);\n\n /// @notice Emitted when a dispute is resolved\n /// @param _jobOrKeeper The address of the disputed keeper/job\n /// @param _resolver The user that called the function and resolved the dispute\n event Resolve(address indexed _jobOrKeeper, address indexed _resolver);\n\n /// @notice Throws when a job or keeper is already disputed\n error AlreadyDisputed();\n\n /// @notice Throws when a job or keeper is not disputed and someone tries to resolve the dispute\n error NotDisputed();\n\n /// @notice Allows governance to create a dispute for a given keeper/job\n /// @param _jobOrKeeper The address in dispute\n function dispute(address _jobOrKeeper) external;\n\n /// @notice Allows governance to resolve a dispute on a keeper/job\n /// @param _jobOrKeeper The address cleared\n function resolve(address _jobOrKeeper) external;\n}\n" - }, - "solidity/contracts/peripherals/jobs/Keep3rJobMigration.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../../../interfaces/peripherals/IKeep3rJobs.sol';\nimport './Keep3rJobFundableCredits.sol';\nimport './Keep3rJobFundableLiquidity.sol';\n\nabstract contract Keep3rJobMigration is IKeep3rJobMigration, Keep3rJobFundableCredits, Keep3rJobFundableLiquidity {\n using EnumerableSet for EnumerableSet.AddressSet;\n\n uint256 internal constant _MIGRATION_COOLDOWN = 1 minutes;\n\n /// @inheritdoc IKeep3rJobMigration\n mapping(address => address) public override pendingJobMigrations;\n mapping(address => mapping(address => uint256)) internal _migrationCreatedAt;\n\n /// @inheritdoc IKeep3rJobMigration\n function migrateJob(address _fromJob, address _toJob) external override onlyJobOwner(_fromJob) {\n if (_fromJob == _toJob) revert JobMigrationImpossible();\n\n pendingJobMigrations[_fromJob] = _toJob;\n _migrationCreatedAt[_fromJob][_toJob] = block.timestamp;\n\n emit JobMigrationRequested(_fromJob, _toJob);\n }\n\n /// @inheritdoc IKeep3rJobMigration\n function acceptJobMigration(address _fromJob, address _toJob) external override onlyJobOwner(_toJob) {\n if (disputes[_fromJob] || disputes[_toJob]) revert JobDisputed();\n if (pendingJobMigrations[_fromJob] != _toJob) revert JobMigrationUnavailable();\n if (block.timestamp < _migrationCreatedAt[_fromJob][_toJob] + _MIGRATION_COOLDOWN) revert JobMigrationLocked();\n\n // force job credits update for both jobs\n _settleJobAccountance(_fromJob);\n _settleJobAccountance(_toJob);\n\n // migrate tokens\n while (_jobTokens[_fromJob].length() > 0) {\n address _tokenToMigrate = _jobTokens[_fromJob].at(0);\n jobTokenCredits[_toJob][_tokenToMigrate] += jobTokenCredits[_fromJob][_tokenToMigrate];\n jobTokenCredits[_fromJob][_tokenToMigrate] = 0;\n _jobTokens[_fromJob].remove(_tokenToMigrate);\n _jobTokens[_toJob].add(_tokenToMigrate);\n }\n\n // migrate liquidities\n while (_jobLiquidities[_fromJob].length() > 0) {\n address _liquidity = _jobLiquidities[_fromJob].at(0);\n\n liquidityAmount[_toJob][_liquidity] += liquidityAmount[_fromJob][_liquidity];\n delete liquidityAmount[_fromJob][_liquidity];\n\n _jobLiquidities[_toJob].add(_liquidity);\n _jobLiquidities[_fromJob].remove(_liquidity);\n }\n\n // migrate job balances\n _jobPeriodCredits[_toJob] += _jobPeriodCredits[_fromJob];\n delete _jobPeriodCredits[_fromJob];\n\n _jobLiquidityCredits[_toJob] += _jobLiquidityCredits[_fromJob];\n delete _jobLiquidityCredits[_fromJob];\n\n // stop _fromJob from being a job\n delete rewardedAt[_fromJob];\n _jobs.remove(_fromJob);\n\n // delete unused data slots\n delete jobOwner[_fromJob];\n delete jobPendingOwner[_fromJob];\n delete _migrationCreatedAt[_fromJob][_toJob];\n delete pendingJobMigrations[_fromJob];\n\n emit JobMigrationSuccessful(_fromJob, _toJob);\n }\n}\n" - }, - "solidity/contracts/peripherals/keepers/Keep3rKeeperDisputable.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport './Keep3rKeeperFundable.sol';\nimport '../Keep3rDisputable.sol';\nimport '../../../interfaces/external/IKeep3rV1.sol';\nimport '../../../interfaces/peripherals/IKeep3rKeepers.sol';\n\nabstract contract Keep3rKeeperDisputable is IKeep3rKeeperDisputable, Keep3rDisputable, Keep3rKeeperFundable {\n using EnumerableSet for EnumerableSet.AddressSet;\n using SafeERC20 for IERC20;\n\n /// @inheritdoc IKeep3rKeeperDisputable\n function slash(\n address _keeper,\n address _bonded,\n uint256 _amount\n ) public override onlySlasher {\n if (!disputes[_keeper]) revert NotDisputed();\n _slash(_keeper, _bonded, _amount);\n emit KeeperSlash(_keeper, msg.sender, _amount);\n }\n\n /// @inheritdoc IKeep3rKeeperDisputable\n function revoke(address _keeper) external override onlySlasher {\n if (!disputes[_keeper]) revert NotDisputed();\n _keepers.remove(_keeper);\n _slash(_keeper, keep3rV1, bonds[_keeper][keep3rV1]);\n emit KeeperRevoke(_keeper, msg.sender);\n }\n\n function _slash(\n address _keeper,\n address _bonded,\n uint256 _amount\n ) internal {\n if (_bonded != keep3rV1) {\n try IERC20(_bonded).transfer(governance, _amount) returns (bool) {} catch (bytes memory) {}\n }\n bonds[_keeper][_bonded] -= _amount;\n }\n}\n" - }, - "solidity/contracts/peripherals/keepers/Keep3rKeeperFundable.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../Keep3rAccountance.sol';\nimport '../Keep3rParameters.sol';\nimport '../../../interfaces/peripherals/IKeep3rKeepers.sol';\n\nimport '../../../interfaces/external/IKeep3rV1.sol';\nimport '../../../interfaces/external/IKeep3rV1Proxy.sol';\n\nimport '@openzeppelin/contracts/security/ReentrancyGuard.sol';\nimport '@openzeppelin/contracts/token/ERC20/IERC20.sol';\nimport '@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol';\n\nabstract contract Keep3rKeeperFundable is IKeep3rKeeperFundable, ReentrancyGuard, Keep3rParameters {\n using EnumerableSet for EnumerableSet.AddressSet;\n using SafeERC20 for IERC20;\n\n /// @inheritdoc IKeep3rKeeperFundable\n function bond(address _bonding, uint256 _amount) external override nonReentrant {\n if (disputes[msg.sender]) revert Disputed();\n if (_jobs.contains(msg.sender)) revert AlreadyAJob();\n canActivateAfter[msg.sender][_bonding] = block.timestamp + bondTime;\n\n uint256 _before = IERC20(_bonding).balanceOf(address(this));\n IERC20(_bonding).safeTransferFrom(msg.sender, address(this), _amount);\n _amount = IERC20(_bonding).balanceOf(address(this)) - _before;\n\n hasBonded[msg.sender] = true;\n pendingBonds[msg.sender][_bonding] += _amount;\n\n emit Bonding(msg.sender, _bonding, _amount);\n }\n\n /// @inheritdoc IKeep3rKeeperFundable\n function activate(address _bonding) external override {\n if (disputes[msg.sender]) revert Disputed();\n if (canActivateAfter[msg.sender][_bonding] == 0) revert BondsUnexistent();\n if (canActivateAfter[msg.sender][_bonding] >= block.timestamp) revert BondsLocked();\n\n _activate(msg.sender, _bonding);\n }\n\n /// @inheritdoc IKeep3rKeeperFundable\n function unbond(address _bonding, uint256 _amount) external override {\n canWithdrawAfter[msg.sender][_bonding] = block.timestamp + unbondTime;\n bonds[msg.sender][_bonding] -= _amount;\n pendingUnbonds[msg.sender][_bonding] += _amount;\n\n emit Unbonding(msg.sender, _bonding, _amount);\n }\n\n /// @inheritdoc IKeep3rKeeperFundable\n function withdraw(address _bonding) external override nonReentrant {\n if (canWithdrawAfter[msg.sender][_bonding] == 0) revert UnbondsUnexistent();\n if (canWithdrawAfter[msg.sender][_bonding] >= block.timestamp) revert UnbondsLocked();\n if (disputes[msg.sender]) revert Disputed();\n\n uint256 _amount = pendingUnbonds[msg.sender][_bonding];\n\n if (_bonding == keep3rV1) {\n IKeep3rV1Proxy(keep3rV1Proxy).mint(_amount);\n }\n\n pendingUnbonds[msg.sender][_bonding] = 0;\n IERC20(_bonding).safeTransfer(msg.sender, _amount);\n\n emit Withdrawal(msg.sender, _bonding, _amount);\n }\n\n function _bond(\n address _bonding,\n address _from,\n uint256 _amount\n ) internal {\n bonds[_from][_bonding] += _amount;\n if (_bonding == keep3rV1) {\n IKeep3rV1(keep3rV1).burn(_amount);\n }\n }\n\n function _activate(address _keeper, address _bonding) internal {\n if (firstSeen[_keeper] == 0) {\n firstSeen[_keeper] = block.timestamp;\n }\n _keepers.add(_keeper);\n uint256 _amount = pendingBonds[_keeper][_bonding];\n pendingBonds[_keeper][_bonding] = 0;\n _bond(_bonding, _keeper, _amount);\n\n emit Activation(_keeper, _bonding, _amount);\n }\n}\n" - }, - "solidity/interfaces/external/IKeep3rV1.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.0 <0.9.0;\n\nimport '@openzeppelin/contracts/token/ERC20/IERC20.sol';\nimport '@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol';\n\n// solhint-disable func-name-mixedcase\ninterface IKeep3rV1 is IERC20, IERC20Metadata {\n // Structs\n struct Checkpoint {\n uint32 fromBlock;\n uint256 votes;\n }\n\n // Events\n event DelegateChanged(address indexed _delegator, address indexed _fromDelegate, address indexed _toDelegate);\n event DelegateVotesChanged(address indexed _delegate, uint256 _previousBalance, uint256 _newBalance);\n event SubmitJob(address indexed _job, address indexed _liquidity, address indexed _provider, uint256 _block, uint256 _credit);\n event ApplyCredit(address indexed _job, address indexed _liquidity, address indexed _provider, uint256 _block, uint256 _credit);\n event RemoveJob(address indexed _job, address indexed _liquidity, address indexed _provider, uint256 _block, uint256 _credit);\n event UnbondJob(address indexed _job, address indexed _liquidity, address indexed _provider, uint256 _block, uint256 _credit);\n event JobAdded(address indexed _job, uint256 _block, address _governance);\n event JobRemoved(address indexed _job, uint256 _block, address _governance);\n event KeeperWorked(address indexed _credit, address indexed _job, address indexed _keeper, uint256 _block, uint256 _amount);\n event KeeperBonding(address indexed _keeper, uint256 _block, uint256 _active, uint256 _bond);\n event KeeperBonded(address indexed _keeper, uint256 _block, uint256 _activated, uint256 _bond);\n event KeeperUnbonding(address indexed _keeper, uint256 _block, uint256 _deactive, uint256 _bond);\n event KeeperUnbond(address indexed _keeper, uint256 _block, uint256 _deactivated, uint256 _bond);\n event KeeperSlashed(address indexed _keeper, address indexed _slasher, uint256 _block, uint256 _slash);\n event KeeperDispute(address indexed _keeper, uint256 _block);\n event KeeperResolved(address indexed _keeper, uint256 _block);\n event TokenCreditAddition(address indexed _credit, address indexed _job, address indexed _creditor, uint256 _block, uint256 _amount);\n\n // Variables\n function KPRH() external returns (address);\n\n function delegates(address _delegator) external view returns (address);\n\n function checkpoints(address _account, uint32 _checkpoint) external view returns (Checkpoint memory);\n\n function numCheckpoints(address _account) external view returns (uint32);\n\n function DOMAIN_TYPEHASH() external returns (bytes32);\n\n function DOMAINSEPARATOR() external returns (bytes32);\n\n function DELEGATION_TYPEHASH() external returns (bytes32);\n\n function PERMIT_TYPEHASH() external returns (bytes32);\n\n function nonces(address _user) external view returns (uint256);\n\n function BOND() external returns (uint256);\n\n function UNBOND() external returns (uint256);\n\n function LIQUIDITYBOND() external returns (uint256);\n\n function FEE() external returns (uint256);\n\n function BASE() external returns (uint256);\n\n function ETH() external returns (address);\n\n function bondings(address _user, address _bonding) external view returns (uint256);\n\n function canWithdrawAfter(address _user, address _bonding) external view returns (uint256);\n\n function pendingUnbonds(address _keeper, address _bonding) external view returns (uint256);\n\n function pendingbonds(address _keeper, address _bonding) external view returns (uint256);\n\n function bonds(address _keeper, address _bonding) external view returns (uint256);\n\n function votes(address _delegator) external view returns (uint256);\n\n function firstSeen(address _keeper) external view returns (uint256);\n\n function disputes(address _keeper) external view returns (bool);\n\n function lastJob(address _keeper) external view returns (uint256);\n\n function workCompleted(address _keeper) external view returns (uint256);\n\n function jobs(address _job) external view returns (bool);\n\n function credits(address _job, address _credit) external view returns (uint256);\n\n function liquidityProvided(\n address _provider,\n address _liquidity,\n address _job\n ) external view returns (uint256);\n\n function liquidityUnbonding(\n address _provider,\n address _liquidity,\n address _job\n ) external view returns (uint256);\n\n function liquidityAmountsUnbonding(\n address _provider,\n address _liquidity,\n address _job\n ) external view returns (uint256);\n\n function jobProposalDelay(address _job) external view returns (uint256);\n\n function liquidityApplied(\n address _provider,\n address _liquidity,\n address _job\n ) external view returns (uint256);\n\n function liquidityAmount(\n address _provider,\n address _liquidity,\n address _job\n ) external view returns (uint256);\n\n function keepers(address _keeper) external view returns (bool);\n\n function blacklist(address _keeper) external view returns (bool);\n\n function keeperList(uint256 _index) external view returns (address);\n\n function jobList(uint256 _index) external view returns (address);\n\n function governance() external returns (address);\n\n function pendingGovernance() external returns (address);\n\n function liquidityAccepted(address _liquidity) external view returns (bool);\n\n function liquidityPairs(uint256 _index) external view returns (address);\n\n // Methods\n function getCurrentVotes(address _account) external view returns (uint256);\n\n function addCreditETH(address _job) external payable;\n\n function addCredit(\n address _credit,\n address _job,\n uint256 _amount\n ) external;\n\n function addVotes(address _voter, uint256 _amount) external;\n\n function removeVotes(address _voter, uint256 _amount) external;\n\n function addKPRCredit(address _job, uint256 _amount) external;\n\n function approveLiquidity(address _liquidity) external;\n\n function revokeLiquidity(address _liquidity) external;\n\n function pairs() external view returns (address[] memory);\n\n function addLiquidityToJob(\n address _liquidity,\n address _job,\n uint256 _amount\n ) external;\n\n function applyCreditToJob(\n address _provider,\n address _liquidity,\n address _job\n ) external;\n\n function unbondLiquidityFromJob(\n address _liquidity,\n address _job,\n uint256 _amount\n ) external;\n\n function removeLiquidityFromJob(address _liquidity, address _job) external;\n\n function mint(uint256 _amount) external;\n\n function burn(uint256 _amount) external;\n\n function worked(address _keeper) external;\n\n function receipt(\n address _credit,\n address _keeper,\n uint256 _amount\n ) external;\n\n function receiptETH(address _keeper, uint256 _amount) external;\n\n function addJob(address _job) external;\n\n function getJobs() external view returns (address[] memory);\n\n function removeJob(address _job) external;\n\n function setKeep3rHelper(address _keep3rHelper) external;\n\n function setGovernance(address _governance) external;\n\n function acceptGovernance() external;\n\n function isKeeper(address _keeper) external returns (bool);\n\n function isMinKeeper(\n address _keeper,\n uint256 _minBond,\n uint256 _earned,\n uint256 _age\n ) external returns (bool);\n\n function isBondedKeeper(\n address _keeper,\n address _bond,\n uint256 _minBond,\n uint256 _earned,\n uint256 _age\n ) external returns (bool);\n\n function bond(address _bonding, uint256 _amount) external;\n\n function getKeepers() external view returns (address[] memory);\n\n function activate(address _bonding) external;\n\n function unbond(address _bonding, uint256 _amount) external;\n\n function slash(\n address _bonded,\n address _keeper,\n uint256 _amount\n ) external;\n\n function withdraw(address _bonding) external;\n\n function dispute(address _keeper) external;\n\n function revoke(address _keeper) external;\n\n function resolve(address _keeper) external;\n\n function permit(\n address _owner,\n address _spender,\n uint256 _amount,\n uint256 _deadline,\n uint8 _v,\n bytes32 _r,\n bytes32 _s\n ) external;\n}\n" - }, - "solidity/interfaces/peripherals/IKeep3rKeepers.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\n/// @title Keep3rKeeperFundable contract\n/// @notice Handles the actions required to become a keeper\ninterface IKeep3rKeeperFundable {\n // Events\n\n /// @notice Emitted when Keep3rKeeperFundable#activate is called\n /// @param _keeper The keeper that has been activated\n /// @param _bond The asset the keeper has bonded\n /// @param _amount The amount of the asset the keeper has bonded\n event Activation(address indexed _keeper, address indexed _bond, uint256 _amount);\n\n /// @notice Emitted when Keep3rKeeperFundable#withdraw is called\n /// @param _keeper The caller of Keep3rKeeperFundable#withdraw function\n /// @param _bond The asset to withdraw from the bonding pool\n /// @param _amount The amount of funds withdrawn\n event Withdrawal(address indexed _keeper, address indexed _bond, uint256 _amount);\n\n // Errors\n\n /// @notice Throws when the address that is trying to register as a job is already a job\n error AlreadyAJob();\n\n // Methods\n\n /// @notice Beginning of the bonding process\n /// @param _bonding The asset being bonded\n /// @param _amount The amount of bonding asset being bonded\n function bond(address _bonding, uint256 _amount) external;\n\n /// @notice Beginning of the unbonding process\n /// @param _bonding The asset being unbonded\n /// @param _amount Allows for partial unbonding\n function unbond(address _bonding, uint256 _amount) external;\n\n /// @notice End of the bonding process after bonding time has passed\n /// @param _bonding The asset being activated as bond collateral\n function activate(address _bonding) external;\n\n /// @notice Withdraw funds after unbonding has finished\n /// @param _bonding The asset to withdraw from the bonding pool\n function withdraw(address _bonding) external;\n}\n\n/// @title Keep3rKeeperDisputable contract\n/// @notice Handles the actions that can be taken on a disputed keeper\ninterface IKeep3rKeeperDisputable {\n // Events\n\n /// @notice Emitted when Keep3rKeeperDisputable#slash is called\n /// @param _keeper The address of the slashed keeper\n /// @param _slasher The user that called Keep3rKeeperDisputable#slash\n /// @param _amount The amount of credits slashed from the keeper\n event KeeperSlash(address indexed _keeper, address indexed _slasher, uint256 _amount);\n\n /// @notice Emitted when Keep3rKeeperDisputable#revoke is called\n /// @param _keeper The address of the revoked keeper\n /// @param _slasher The user that called Keep3rKeeperDisputable#revoke\n event KeeperRevoke(address indexed _keeper, address indexed _slasher);\n\n // Methods\n\n /// @notice Allows governance to slash a keeper based on a dispute\n /// @param _keeper The address being slashed\n /// @param _bonded The asset being slashed\n /// @param _amount The amount being slashed\n function slash(\n address _keeper,\n address _bonded,\n uint256 _amount\n ) external;\n\n /// @notice Blacklists a keeper from participating in the network\n /// @param _keeper The address being slashed\n function revoke(address _keeper) external;\n}\n\n// solhint-disable-next-line no-empty-blocks\n\n/// @title Keep3rKeepers contract\ninterface IKeep3rKeepers is IKeep3rKeeperDisputable {\n\n}\n" - }, - "solidity/interfaces/external/IKeep3rV1Proxy.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../peripherals/IGovernable.sol';\n\ninterface IKeep3rV1Proxy is IGovernable {\n // Structs\n struct Recipient {\n address recipient;\n uint256 caps;\n }\n\n // Variables\n function keep3rV1() external view returns (address);\n\n function minter() external view returns (address);\n\n function next(address) external view returns (uint256);\n\n function caps(address) external view returns (uint256);\n\n function recipients() external view returns (address[] memory);\n\n function recipientsCaps() external view returns (Recipient[] memory);\n\n // Errors\n error Cooldown();\n error NoDrawableAmount();\n error ZeroAddress();\n error OnlyMinter();\n\n // Methods\n function addRecipient(address recipient, uint256 amount) external;\n\n function removeRecipient(address recipient) external;\n\n function draw() external returns (uint256 _amount);\n\n function setKeep3rV1(address _keep3rV1) external;\n\n function setMinter(address _minter) external;\n\n function mint(uint256 _amount) external;\n\n function mint(address _account, uint256 _amount) external;\n\n function setKeep3rV1Governance(address _governance) external;\n\n function acceptKeep3rV1Governance() external;\n\n function dispute(address _keeper) external;\n\n function slash(\n address _bonded,\n address _keeper,\n uint256 _amount\n ) external;\n\n function revoke(address _keeper) external;\n\n function resolve(address _keeper) external;\n\n function addJob(address _job) external;\n\n function removeJob(address _job) external;\n\n function addKPRCredit(address _job, uint256 _amount) external;\n\n function approveLiquidity(address _liquidity) external;\n\n function revokeLiquidity(address _liquidity) external;\n\n function setKeep3rHelper(address _keep3rHelper) external;\n\n function addVotes(address _voter, uint256 _amount) external;\n\n function removeVotes(address _voter, uint256 _amount) external;\n}\n" - }, - "solidity/interfaces/peripherals/IDustCollector.sol": { - "content": "// SPDX-License-Identifier: MIT\n\npragma solidity >=0.8.4 <0.9.0;\n\nimport './IBaseErrors.sol';\n\ninterface IDustCollector is IBaseErrors {\n /// @notice Emitted when dust is sent\n /// @param _token The token that will be transferred\n /// @param _amount The amount of the token that will be transferred\n /// @param _to The address which will receive the funds\n event DustSent(address _token, uint256 _amount, address _to);\n\n /// @notice Allows an authorized user to transfer the tokens or eth that may have been left in a contract\n /// @param _token The token that will be transferred\n /// @param _amount The amount of the token that will be transferred\n /// @param _to The address that will receive the idle funds\n function sendDust(\n address _token,\n uint256 _amount,\n address _to\n ) external;\n}\n" - }, - "solidity/for-test/Keep3rForTest.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../contracts/Keep3r.sol';\n\ncontract Keep3rForTest is Keep3r {\n constructor(\n address _governance,\n address _keep3rHelper,\n address _keep3rV1,\n address _keep3rV1Proxy,\n address _kp3rWethPool\n ) Keep3r(_governance, _keep3rHelper, _keep3rV1, _keep3rV1Proxy, _kp3rWethPool) {}\n\n function viewTickOrder(address _liquidity) external view returns (bool) {\n return _isKP3RToken0[_liquidity];\n }\n}\n" - }, - "solidity/for-test/peripherals/DustCollectorForTest.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../../contracts/peripherals/DustCollector.sol';\n\ncontract DustCollectorForTest is DustCollector {\n constructor() DustCollector() Governable(msg.sender) {}\n}\n" - }, - "solidity/interfaces/IKeep3r.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport './peripherals/IKeep3rJobs.sol';\nimport './peripherals/IKeep3rKeepers.sol';\nimport './peripherals/IKeep3rAccountance.sol';\nimport './peripherals/IKeep3rRoles.sol';\nimport './peripherals/IKeep3rParameters.sol';\n\n// solhint-disable-next-line no-empty-blocks\n\n/// @title Keep3rV2 contract\n/// @notice This contract inherits all the functionality of Keep3rV2\ninterface IKeep3r is IKeep3rJobs, IKeep3rKeepers, IKeep3rAccountance, IKeep3rRoles, IKeep3rParameters {\n\n}\n" - }, - "solidity/for-test/JobForTest.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.0 <0.9.0;\n\nimport '../interfaces/IKeep3r.sol';\n\ncontract JobForTest {\n error InvalidKeeper();\n address public keep3r;\n uint256 public nonce;\n\n constructor(address _keep3r) {\n keep3r = _keep3r;\n }\n\n function work() external {\n if (!IKeep3r(keep3r).isKeeper(msg.sender)) revert InvalidKeeper();\n\n for (uint256 i = 0; i < 1000; i++) {\n nonce++;\n }\n\n IKeep3r(keep3r).worked(msg.sender);\n }\n\n function workHard(uint256 _factor) external {\n if (!IKeep3r(keep3r).isKeeper(msg.sender)) revert InvalidKeeper();\n\n for (uint256 i = 0; i < 1000 * _factor; i++) {\n nonce++;\n }\n\n IKeep3r(keep3r).worked(msg.sender);\n }\n}\n" - }, - "solidity/for-test/peripherals/jobs/Keep3rJobManagerForTest.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../../../contracts/peripherals/jobs/Keep3rJobManager.sol';\n\ncontract Keep3rJobManagerForTest is Keep3rJobManager {\n using EnumerableSet for EnumerableSet.AddressSet;\n\n constructor(\n address _keep3rHelper,\n address _keep3rV1,\n address _keep3rV1Proxy,\n address _kp3rWethPool\n ) Keep3rParameters(_keep3rHelper, _keep3rV1, _keep3rV1Proxy, _kp3rWethPool) Keep3rRoles(msg.sender) {}\n\n function isJob(address _job) external view returns (bool _isJob) {\n _isJob = _jobs.contains(_job);\n }\n}\n" - }, - "solidity/for-test/peripherals/jobs/Keep3rJobMigrationForTest.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../../../contracts/peripherals/jobs/Keep3rJobMigration.sol';\n\ncontract Keep3rJobMigrationForTest is Keep3rJobMigration {\n using EnumerableSet for EnumerableSet.AddressSet;\n\n mapping(address => uint256) public settleJobAccountanceCallCount;\n\n constructor(\n address _kph,\n address _keep3rV1,\n address _keep3rV1Proxy,\n address _kp3rWethPool\n ) Keep3rParameters(_kph, _keep3rV1, _keep3rV1Proxy, _kp3rWethPool) Keep3rRoles(msg.sender) {}\n\n function setJobToken(address _job, address _token) external {\n _jobTokens[_job].add(_token);\n }\n\n function setJobLiquidity(address _job, address _liquidity) external {\n _jobLiquidities[_job].add(_liquidity);\n }\n\n function viewJobTokenListLength(address _job) external view returns (uint256) {\n return _jobTokens[_job].length();\n }\n\n function viewJobLiquidityList(address _job) external view returns (address[] memory _list) {\n _list = _jobLiquidities[_job].values();\n }\n\n function viewJobPeriodCredits(address _job) external view returns (uint256) {\n return _jobPeriodCredits[_job];\n }\n\n function viewJobLiquidityCredits(address _job) external view returns (uint256) {\n return _jobLiquidityCredits[_job];\n }\n\n function viewMigrationCreatedAt(address _fromJob, address _toJob) external view returns (uint256) {\n return _migrationCreatedAt[_fromJob][_toJob];\n }\n\n function isJob(address _job) external view returns (bool) {\n return _jobs.contains(_job);\n }\n\n function _settleJobAccountance(address _job) internal override {\n settleJobAccountanceCallCount[_job]++;\n }\n}\n" - }, - "solidity/for-test/peripherals/jobs/Keep3rJobFundableLiquidityForTest.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../../../contracts/peripherals/jobs/Keep3rJobFundableLiquidity.sol';\n\ncontract Keep3rJobFundableLiquidityForTest is Keep3rJobFundableLiquidity {\n using EnumerableSet for EnumerableSet.AddressSet;\n\n constructor(\n address _kph,\n address _keep3rV1,\n address _keep3rV1Proxy,\n address _kp3rWethPool\n ) Keep3rParameters(_kph, _keep3rV1, _keep3rV1Proxy, _kp3rWethPool) Keep3rRoles(msg.sender) {}\n\n function setJob(address _job) external {\n _jobs.add(_job);\n }\n\n function setJobLiquidity(address _job, address _liquidity) external returns (bool) {\n return _jobLiquidities[_job].add(_liquidity);\n }\n\n function setApprovedLiquidity(address _liquidity) external {\n _approvedLiquidities.add(_liquidity);\n }\n\n function setRevokedLiquidity(address _liquidity) external {\n _approvedLiquidities.remove(_liquidity);\n }\n\n function viewTickCache(address _liquidity) external view returns (TickCache memory _tickCache) {\n _tickCache = _tick[_liquidity];\n }\n\n function viewTickOrder(address _liquidity) external view returns (bool) {\n return _isKP3RToken0[_liquidity];\n }\n\n function internalJobLiquidities(address _job) external view returns (address[] memory _list) {\n _list = _jobLiquidities[_job].values();\n }\n\n function internalSettleJobAccountance(address _job) external {\n _settleJobAccountance(_job);\n }\n}\n" - }, - "solidity/contracts/Keep3rHelper.sol": { - "content": "// SPDX-License-Identifier: MIT\n\n/*\n\nCoded for The Keep3r Network with ♥ by\n\n██████╗░███████╗███████╗██╗  ░██╗░░░░░░░██╗░█████╗░███╗░░██╗██████╗░███████╗██████╗░██╗░░░░░░█████╗░███╗░░██╗██████╗░\n██╔══██╗██╔════╝██╔════╝██║  ░██║░░██╗░░██║██╔══██╗████╗░██║██╔══██╗██╔════╝██╔══██╗██║░░░░░██╔══██╗████╗░██║██╔══██╗\n██║░░██║█████╗░░█████╗░░██║  ░╚██╗████╗██╔╝██║░░██║██╔██╗██║██║░░██║█████╗░░██████╔╝██║░░░░░███████║██╔██╗██║██║░░██║\n██║░░██║██╔══╝░░██╔══╝░░██║  ░░████╔═████║░██║░░██║██║╚████║██║░░██║██╔══╝░░██╔══██╗██║░░░░░██╔══██║██║╚████║██║░░██║\n██████╔╝███████╗██║░░░░░██║  ░░╚██╔╝░╚██╔╝░╚█████╔╝██║░╚███║██████╔╝███████╗██║░░██║███████╗██║░░██║██║░╚███║██████╔╝\n╚═════╝░╚══════╝╚═╝░░░░░╚═╝  ░░░╚═╝░░░╚═╝░░░╚════╝░╚═╝░░╚══╝╚═════╝░╚══════╝╚═╝░░╚═╝╚══════╝╚═╝░░╚═╝╚═╝░░╚══╝╚═════╝░\n\nhttps://defi.sucks\n\n*/\n\npragma solidity >=0.8.7 <0.9.0;\n\nimport './libraries/FullMath.sol';\nimport './libraries/TickMath.sol';\nimport '../interfaces/IKeep3r.sol';\nimport '../interfaces/external/IKeep3rV1.sol';\nimport '../interfaces/IKeep3rHelper.sol';\n\nimport '@openzeppelin/contracts/utils/math/Math.sol';\nimport '@uniswap/v3-core/contracts/interfaces/IUniswapV3Pool.sol';\n\ncontract Keep3rHelper is IKeep3rHelper {\n address public immutable keep3rV2;\n\n constructor(address _keep3rV2) {\n keep3rV2 = _keep3rV2;\n }\n\n /// @inheritdoc IKeep3rHelper\n address public constant override KP3R = 0x1cEB5cB57C4D4E2b2433641b95Dd330A33185A44;\n\n /// @inheritdoc IKeep3rHelper\n address public constant override KP3R_WETH_POOL = 0x11B7a6bc0259ed6Cf9DB8F499988F9eCc7167bf5;\n\n /// @inheritdoc IKeep3rHelper\n uint256 public constant override MIN = 11_000;\n\n /// @inheritdoc IKeep3rHelper\n uint256 public constant override MAX = 12_000;\n\n /// @inheritdoc IKeep3rHelper\n uint256 public constant override BOOST_BASE = 10_000;\n\n /// @inheritdoc IKeep3rHelper\n uint256 public constant override TARGETBOND = 200 ether;\n\n /// @inheritdoc IKeep3rHelper\n function quote(uint256 _eth) public view override returns (uint256 _amountOut) {\n bool _isKP3RToken0 = isKP3RToken0(KP3R_WETH_POOL);\n int56 _tickDifference = IKeep3r(keep3rV2).observeLiquidity(KP3R_WETH_POOL).difference;\n _tickDifference = _isKP3RToken0 ? _tickDifference : -_tickDifference;\n uint256 _tickInterval = IKeep3r(keep3rV2).rewardPeriodTime();\n _amountOut = getQuoteAtTick(uint128(_eth), _tickDifference, _tickInterval);\n }\n\n /// @inheritdoc IKeep3rHelper\n function bonds(address _keeper) public view override returns (uint256 _amountBonded) {\n return IKeep3r(keep3rV2).bonds(_keeper, KP3R);\n }\n\n /// @inheritdoc IKeep3rHelper\n function getRewardAmountFor(address _keeper, uint256 _gasUsed) public view override returns (uint256 _kp3r) {\n uint256 _boost = getRewardBoostFor(bonds(_keeper));\n _kp3r = quote((_gasUsed * _boost) / BOOST_BASE);\n }\n\n /// @inheritdoc IKeep3rHelper\n function getRewardAmount(uint256 _gasUsed) external view override returns (uint256 _amount) {\n // solhint-disable-next-line avoid-tx-origin\n return getRewardAmountFor(tx.origin, _gasUsed);\n }\n\n /// @inheritdoc IKeep3rHelper\n function getRewardBoostFor(uint256 _bonds) public view override returns (uint256 _rewardBoost) {\n _bonds = Math.min(_bonds, TARGETBOND);\n uint256 _cap = Math.max(MIN, MIN + ((MAX - MIN) * _bonds) / TARGETBOND);\n _rewardBoost = _cap * _getBasefee();\n }\n\n /// @inheritdoc IKeep3rHelper\n function getPoolTokens(address _pool) public view override returns (address _token0, address _token1) {\n return (IUniswapV3Pool(_pool).token0(), IUniswapV3Pool(_pool).token1());\n }\n\n /// @inheritdoc IKeep3rHelper\n function isKP3RToken0(address _pool) public view override returns (bool _isKP3RToken0) {\n address _token0;\n address _token1;\n (_token0, _token1) = getPoolTokens(_pool);\n if (_token0 == KP3R) {\n return true;\n } else if (_token1 != KP3R) {\n revert LiquidityPairInvalid();\n }\n }\n\n /// @inheritdoc IKeep3rHelper\n function observe(address _pool, uint32[] memory _secondsAgo)\n public\n view\n override\n returns (\n int56 _tickCumulative1,\n int56 _tickCumulative2,\n bool _success\n )\n {\n try IUniswapV3Pool(_pool).observe(_secondsAgo) returns (int56[] memory _uniswapResponse, uint160[] memory) {\n _tickCumulative1 = _uniswapResponse[0];\n if (_uniswapResponse.length > 1) {\n _tickCumulative2 = _uniswapResponse[1];\n }\n _success = true;\n } catch (bytes memory) {}\n }\n\n /// @inheritdoc IKeep3rHelper\n function getKP3RsAtTick(\n uint256 _liquidityAmount,\n int56 _tickDifference,\n uint256 _timeInterval\n ) public pure override returns (uint256 _kp3rAmount) {\n uint160 sqrtRatioX96 = TickMath.getSqrtRatioAtTick(int24(_tickDifference / int256(_timeInterval)));\n _kp3rAmount = FullMath.mulDiv(1 << 96, _liquidityAmount, sqrtRatioX96);\n }\n\n /// @inheritdoc IKeep3rHelper\n function getQuoteAtTick(\n uint128 _baseAmount,\n int56 _tickDifference,\n uint256 _timeInterval\n ) public pure override returns (uint256 _quoteAmount) {\n uint160 sqrtRatioX96 = TickMath.getSqrtRatioAtTick(int24(_tickDifference / int256(_timeInterval)));\n\n if (sqrtRatioX96 <= type(uint128).max) {\n uint256 ratioX192 = uint256(sqrtRatioX96) * sqrtRatioX96;\n _quoteAmount = FullMath.mulDiv(1 << 192, _baseAmount, ratioX192);\n } else {\n uint256 ratioX128 = FullMath.mulDiv(sqrtRatioX96, sqrtRatioX96, 1 << 64);\n _quoteAmount = FullMath.mulDiv(1 << 128, _baseAmount, ratioX128);\n }\n }\n\n /// @notice Gets the block's base fee\n /// @return _baseFee The block's basefee\n function _getBasefee() internal view virtual returns (uint256 _baseFee) {\n return block.basefee;\n }\n}\n" - }, - "solidity/contracts/libraries/TickMath.sol": { - "content": "// SPDX-License-Identifier: GPL-2.0-or-later\npragma solidity >=0.5.0;\n\n// solhint-disable\n\n/// @title Math library for computing sqrt prices from ticks and vice versa\n/// @notice Computes sqrt price for ticks of size 1.0001, i.e. sqrt(1.0001^tick) as fixed point Q64.96 numbers. Supports\n/// prices between 2**-128 and 2**128\nlibrary TickMath {\n /// @dev The minimum tick that may be passed to #getSqrtRatioAtTick computed from log base 1.0001 of 2**-128\n int24 internal constant MIN_TICK = -887272;\n /// @dev The maximum tick that may be passed to #getSqrtRatioAtTick computed from log base 1.0001 of 2**128\n int24 internal constant MAX_TICK = -MIN_TICK;\n\n /// @dev The minimum value that can be returned from #getSqrtRatioAtTick. Equivalent to getSqrtRatioAtTick(MIN_TICK)\n uint160 internal constant MIN_SQRT_RATIO = 4295128739;\n /// @dev The maximum value that can be returned from #getSqrtRatioAtTick. Equivalent to getSqrtRatioAtTick(MAX_TICK)\n uint160 internal constant MAX_SQRT_RATIO = 1461446703485210103287273052203988822378723970342;\n\n /// @notice Calculates sqrt(1.0001^tick) * 2^96\n /// @dev Throws if |tick| > max tick\n /// @param tick The input tick for the above formula\n /// @return sqrtPriceX96 A Fixed point Q64.96 number representing the sqrt of the ratio of the two assets (token1/token0)\n /// at the given tick\n function getSqrtRatioAtTick(int24 tick) internal pure returns (uint160 sqrtPriceX96) {\n uint256 absTick = tick < 0 ? uint256(-int256(tick)) : uint256(int256(tick));\n require(absTick <= uint256(int256(MAX_TICK)), 'T');\n\n uint256 ratio = absTick & 0x1 != 0 ? 0xfffcb933bd6fad37aa2d162d1a594001 : 0x100000000000000000000000000000000;\n if (absTick & 0x2 != 0) ratio = (ratio * 0xfff97272373d413259a46990580e213a) >> 128;\n if (absTick & 0x4 != 0) ratio = (ratio * 0xfff2e50f5f656932ef12357cf3c7fdcc) >> 128;\n if (absTick & 0x8 != 0) ratio = (ratio * 0xffe5caca7e10e4e61c3624eaa0941cd0) >> 128;\n if (absTick & 0x10 != 0) ratio = (ratio * 0xffcb9843d60f6159c9db58835c926644) >> 128;\n if (absTick & 0x20 != 0) ratio = (ratio * 0xff973b41fa98c081472e6896dfb254c0) >> 128;\n if (absTick & 0x40 != 0) ratio = (ratio * 0xff2ea16466c96a3843ec78b326b52861) >> 128;\n if (absTick & 0x80 != 0) ratio = (ratio * 0xfe5dee046a99a2a811c461f1969c3053) >> 128;\n if (absTick & 0x100 != 0) ratio = (ratio * 0xfcbe86c7900a88aedcffc83b479aa3a4) >> 128;\n if (absTick & 0x200 != 0) ratio = (ratio * 0xf987a7253ac413176f2b074cf7815e54) >> 128;\n if (absTick & 0x400 != 0) ratio = (ratio * 0xf3392b0822b70005940c7a398e4b70f3) >> 128;\n if (absTick & 0x800 != 0) ratio = (ratio * 0xe7159475a2c29b7443b29c7fa6e889d9) >> 128;\n if (absTick & 0x1000 != 0) ratio = (ratio * 0xd097f3bdfd2022b8845ad8f792aa5825) >> 128;\n if (absTick & 0x2000 != 0) ratio = (ratio * 0xa9f746462d870fdf8a65dc1f90e061e5) >> 128;\n if (absTick & 0x4000 != 0) ratio = (ratio * 0x70d869a156d2a1b890bb3df62baf32f7) >> 128;\n if (absTick & 0x8000 != 0) ratio = (ratio * 0x31be135f97d08fd981231505542fcfa6) >> 128;\n if (absTick & 0x10000 != 0) ratio = (ratio * 0x9aa508b5b7a84e1c677de54f3e99bc9) >> 128;\n if (absTick & 0x20000 != 0) ratio = (ratio * 0x5d6af8dedb81196699c329225ee604) >> 128;\n if (absTick & 0x40000 != 0) ratio = (ratio * 0x2216e584f5fa1ea926041bedfe98) >> 128;\n if (absTick & 0x80000 != 0) ratio = (ratio * 0x48a170391f7dc42444e8fa2) >> 128;\n\n if (tick > 0) ratio = type(uint256).max / ratio;\n\n // Divides by 1<<32 rounding up to go from a Q128.128 to a Q128.96.\n // we then downcast because we know the result always fits within 160 bits due to our tick input constraint\n // we round up in the division so getTickAtSqrtRatio of the output price is always consistent\n sqrtPriceX96 = uint160((ratio >> 32) + (ratio % (1 << 32) == 0 ? 0 : 1));\n }\n\n /// @notice Calculates the greatest tick value such that getRatioAtTick(tick) <= ratio\n /// @dev Throws in case sqrtPriceX96 < MIN_SQRT_RATIO, as MIN_SQRT_RATIO is the lowest value getRatioAtTick may ever return.\n /// @param sqrtPriceX96 The sqrt ratio for which to compute the tick as a Q64.96\n /// @return tick The greatest tick for which the ratio is less than or equal to the input ratio\n function getTickAtSqrtRatio(uint160 sqrtPriceX96) internal pure returns (int24 tick) {\n // Second inequality must be < because the price can never reach the price at the max tick\n require(sqrtPriceX96 >= MIN_SQRT_RATIO && sqrtPriceX96 < MAX_SQRT_RATIO, 'R');\n uint256 ratio = uint256(sqrtPriceX96) << 32;\n\n uint256 r = ratio;\n uint256 msb = 0;\n\n assembly {\n let f := shl(7, gt(r, 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF))\n msb := or(msb, f)\n r := shr(f, r)\n }\n assembly {\n let f := shl(6, gt(r, 0xFFFFFFFFFFFFFFFF))\n msb := or(msb, f)\n r := shr(f, r)\n }\n assembly {\n let f := shl(5, gt(r, 0xFFFFFFFF))\n msb := or(msb, f)\n r := shr(f, r)\n }\n assembly {\n let f := shl(4, gt(r, 0xFFFF))\n msb := or(msb, f)\n r := shr(f, r)\n }\n assembly {\n let f := shl(3, gt(r, 0xFF))\n msb := or(msb, f)\n r := shr(f, r)\n }\n assembly {\n let f := shl(2, gt(r, 0xF))\n msb := or(msb, f)\n r := shr(f, r)\n }\n assembly {\n let f := shl(1, gt(r, 0x3))\n msb := or(msb, f)\n r := shr(f, r)\n }\n assembly {\n let f := gt(r, 0x1)\n msb := or(msb, f)\n }\n\n if (msb >= 128) r = ratio >> (msb - 127);\n else r = ratio << (127 - msb);\n\n int256 log_2 = (int256(msb) - 128) << 64;\n\n assembly {\n r := shr(127, mul(r, r))\n let f := shr(128, r)\n log_2 := or(log_2, shl(63, f))\n r := shr(f, r)\n }\n assembly {\n r := shr(127, mul(r, r))\n let f := shr(128, r)\n log_2 := or(log_2, shl(62, f))\n r := shr(f, r)\n }\n assembly {\n r := shr(127, mul(r, r))\n let f := shr(128, r)\n log_2 := or(log_2, shl(61, f))\n r := shr(f, r)\n }\n assembly {\n r := shr(127, mul(r, r))\n let f := shr(128, r)\n log_2 := or(log_2, shl(60, f))\n r := shr(f, r)\n }\n assembly {\n r := shr(127, mul(r, r))\n let f := shr(128, r)\n log_2 := or(log_2, shl(59, f))\n r := shr(f, r)\n }\n assembly {\n r := shr(127, mul(r, r))\n let f := shr(128, r)\n log_2 := or(log_2, shl(58, f))\n r := shr(f, r)\n }\n assembly {\n r := shr(127, mul(r, r))\n let f := shr(128, r)\n log_2 := or(log_2, shl(57, f))\n r := shr(f, r)\n }\n assembly {\n r := shr(127, mul(r, r))\n let f := shr(128, r)\n log_2 := or(log_2, shl(56, f))\n r := shr(f, r)\n }\n assembly {\n r := shr(127, mul(r, r))\n let f := shr(128, r)\n log_2 := or(log_2, shl(55, f))\n r := shr(f, r)\n }\n assembly {\n r := shr(127, mul(r, r))\n let f := shr(128, r)\n log_2 := or(log_2, shl(54, f))\n r := shr(f, r)\n }\n assembly {\n r := shr(127, mul(r, r))\n let f := shr(128, r)\n log_2 := or(log_2, shl(53, f))\n r := shr(f, r)\n }\n assembly {\n r := shr(127, mul(r, r))\n let f := shr(128, r)\n log_2 := or(log_2, shl(52, f))\n r := shr(f, r)\n }\n assembly {\n r := shr(127, mul(r, r))\n let f := shr(128, r)\n log_2 := or(log_2, shl(51, f))\n r := shr(f, r)\n }\n assembly {\n r := shr(127, mul(r, r))\n let f := shr(128, r)\n log_2 := or(log_2, shl(50, f))\n }\n\n int256 log_sqrt10001 = log_2 * 255738958999603826347141; // 128.128 number\n\n int24 tickLow = int24((log_sqrt10001 - 3402992956809132418596140100660247210) >> 128);\n int24 tickHi = int24((log_sqrt10001 + 291339464771989622907027621153398088495) >> 128);\n\n tick = tickLow == tickHi ? tickLow : getSqrtRatioAtTick(tickHi) <= sqrtPriceX96 ? tickHi : tickLow;\n }\n}\n" - }, - "@uniswap/v3-core/contracts/interfaces/IUniswapV3Pool.sol": { - "content": "// SPDX-License-Identifier: GPL-2.0-or-later\npragma solidity >=0.5.0;\n\nimport './pool/IUniswapV3PoolImmutables.sol';\nimport './pool/IUniswapV3PoolState.sol';\nimport './pool/IUniswapV3PoolDerivedState.sol';\nimport './pool/IUniswapV3PoolActions.sol';\nimport './pool/IUniswapV3PoolOwnerActions.sol';\nimport './pool/IUniswapV3PoolEvents.sol';\n\n/// @title The interface for a Uniswap V3 Pool\n/// @notice A Uniswap pool facilitates swapping and automated market making between any two assets that strictly conform\n/// to the ERC20 specification\n/// @dev The pool interface is broken up into many smaller pieces\ninterface IUniswapV3Pool is\n IUniswapV3PoolImmutables,\n IUniswapV3PoolState,\n IUniswapV3PoolDerivedState,\n IUniswapV3PoolActions,\n IUniswapV3PoolOwnerActions,\n IUniswapV3PoolEvents\n{\n\n}\n" - }, - "@uniswap/v3-core/contracts/interfaces/pool/IUniswapV3PoolImmutables.sol": { - "content": "// SPDX-License-Identifier: GPL-2.0-or-later\npragma solidity >=0.5.0;\n\n/// @title Pool state that never changes\n/// @notice These parameters are fixed for a pool forever, i.e., the methods will always return the same values\ninterface IUniswapV3PoolImmutables {\n /// @notice The contract that deployed the pool, which must adhere to the IUniswapV3Factory interface\n /// @return The contract address\n function factory() external view returns (address);\n\n /// @notice The first of the two tokens of the pool, sorted by address\n /// @return The token contract address\n function token0() external view returns (address);\n\n /// @notice The second of the two tokens of the pool, sorted by address\n /// @return The token contract address\n function token1() external view returns (address);\n\n /// @notice The pool's fee in hundredths of a bip, i.e. 1e-6\n /// @return The fee\n function fee() external view returns (uint24);\n\n /// @notice The pool tick spacing\n /// @dev Ticks can only be used at multiples of this value, minimum of 1 and always positive\n /// e.g.: a tickSpacing of 3 means ticks can be initialized every 3rd tick, i.e., ..., -6, -3, 0, 3, 6, ...\n /// This value is an int24 to avoid casting even though it is always positive.\n /// @return The tick spacing\n function tickSpacing() external view returns (int24);\n\n /// @notice The maximum amount of position liquidity that can use any tick in the range\n /// @dev This parameter is enforced per tick to prevent liquidity from overflowing a uint128 at any point, and\n /// also prevents out-of-range liquidity from being used to prevent adding in-range liquidity to a pool\n /// @return The max amount of liquidity per tick\n function maxLiquidityPerTick() external view returns (uint128);\n}\n" - }, - "@uniswap/v3-core/contracts/interfaces/pool/IUniswapV3PoolState.sol": { - "content": "// SPDX-License-Identifier: GPL-2.0-or-later\npragma solidity >=0.5.0;\n\n/// @title Pool state that can change\n/// @notice These methods compose the pool's state, and can change with any frequency including multiple times\n/// per transaction\ninterface IUniswapV3PoolState {\n /// @notice The 0th storage slot in the pool stores many values, and is exposed as a single method to save gas\n /// when accessed externally.\n /// @return sqrtPriceX96 The current price of the pool as a sqrt(token1/token0) Q64.96 value\n /// tick The current tick of the pool, i.e. according to the last tick transition that was run.\n /// This value may not always be equal to SqrtTickMath.getTickAtSqrtRatio(sqrtPriceX96) if the price is on a tick\n /// boundary.\n /// observationIndex The index of the last oracle observation that was written,\n /// observationCardinality The current maximum number of observations stored in the pool,\n /// observationCardinalityNext The next maximum number of observations, to be updated when the observation.\n /// feeProtocol The protocol fee for both tokens of the pool.\n /// Encoded as two 4 bit values, where the protocol fee of token1 is shifted 4 bits and the protocol fee of token0\n /// is the lower 4 bits. Used as the denominator of a fraction of the swap fee, e.g. 4 means 1/4th of the swap fee.\n /// unlocked Whether the pool is currently locked to reentrancy\n function slot0()\n external\n view\n returns (\n uint160 sqrtPriceX96,\n int24 tick,\n uint16 observationIndex,\n uint16 observationCardinality,\n uint16 observationCardinalityNext,\n uint8 feeProtocol,\n bool unlocked\n );\n\n /// @notice The fee growth as a Q128.128 fees of token0 collected per unit of liquidity for the entire life of the pool\n /// @dev This value can overflow the uint256\n function feeGrowthGlobal0X128() external view returns (uint256);\n\n /// @notice The fee growth as a Q128.128 fees of token1 collected per unit of liquidity for the entire life of the pool\n /// @dev This value can overflow the uint256\n function feeGrowthGlobal1X128() external view returns (uint256);\n\n /// @notice The amounts of token0 and token1 that are owed to the protocol\n /// @dev Protocol fees will never exceed uint128 max in either token\n function protocolFees() external view returns (uint128 token0, uint128 token1);\n\n /// @notice The currently in range liquidity available to the pool\n /// @dev This value has no relationship to the total liquidity across all ticks\n function liquidity() external view returns (uint128);\n\n /// @notice Look up information about a specific tick in the pool\n /// @param tick The tick to look up\n /// @return liquidityGross the total amount of position liquidity that uses the pool either as tick lower or\n /// tick upper,\n /// liquidityNet how much liquidity changes when the pool price crosses the tick,\n /// feeGrowthOutside0X128 the fee growth on the other side of the tick from the current tick in token0,\n /// feeGrowthOutside1X128 the fee growth on the other side of the tick from the current tick in token1,\n /// tickCumulativeOutside the cumulative tick value on the other side of the tick from the current tick\n /// secondsPerLiquidityOutsideX128 the seconds spent per liquidity on the other side of the tick from the current tick,\n /// secondsOutside the seconds spent on the other side of the tick from the current tick,\n /// initialized Set to true if the tick is initialized, i.e. liquidityGross is greater than 0, otherwise equal to false.\n /// Outside values can only be used if the tick is initialized, i.e. if liquidityGross is greater than 0.\n /// In addition, these values are only relative and must be used only in comparison to previous snapshots for\n /// a specific position.\n function ticks(int24 tick)\n external\n view\n returns (\n uint128 liquidityGross,\n int128 liquidityNet,\n uint256 feeGrowthOutside0X128,\n uint256 feeGrowthOutside1X128,\n int56 tickCumulativeOutside,\n uint160 secondsPerLiquidityOutsideX128,\n uint32 secondsOutside,\n bool initialized\n );\n\n /// @notice Returns 256 packed tick initialized boolean values. See TickBitmap for more information\n function tickBitmap(int16 wordPosition) external view returns (uint256);\n\n /// @notice Returns the information about a position by the position's key\n /// @param key The position's key is a hash of a preimage composed by the owner, tickLower and tickUpper\n /// @return _liquidity The amount of liquidity in the position,\n /// Returns feeGrowthInside0LastX128 fee growth of token0 inside the tick range as of the last mint/burn/poke,\n /// Returns feeGrowthInside1LastX128 fee growth of token1 inside the tick range as of the last mint/burn/poke,\n /// Returns tokensOwed0 the computed amount of token0 owed to the position as of the last mint/burn/poke,\n /// Returns tokensOwed1 the computed amount of token1 owed to the position as of the last mint/burn/poke\n function positions(bytes32 key)\n external\n view\n returns (\n uint128 _liquidity,\n uint256 feeGrowthInside0LastX128,\n uint256 feeGrowthInside1LastX128,\n uint128 tokensOwed0,\n uint128 tokensOwed1\n );\n\n /// @notice Returns data about a specific observation index\n /// @param index The element of the observations array to fetch\n /// @dev You most likely want to use #observe() instead of this method to get an observation as of some amount of time\n /// ago, rather than at a specific index in the array.\n /// @return blockTimestamp The timestamp of the observation,\n /// Returns tickCumulative the tick multiplied by seconds elapsed for the life of the pool as of the observation timestamp,\n /// Returns secondsPerLiquidityCumulativeX128 the seconds per in range liquidity for the life of the pool as of the observation timestamp,\n /// Returns initialized whether the observation has been initialized and the values are safe to use\n function observations(uint256 index)\n external\n view\n returns (\n uint32 blockTimestamp,\n int56 tickCumulative,\n uint160 secondsPerLiquidityCumulativeX128,\n bool initialized\n );\n}\n" - }, - "@uniswap/v3-core/contracts/interfaces/pool/IUniswapV3PoolDerivedState.sol": { - "content": "// SPDX-License-Identifier: GPL-2.0-or-later\npragma solidity >=0.5.0;\n\n/// @title Pool state that is not stored\n/// @notice Contains view functions to provide information about the pool that is computed rather than stored on the\n/// blockchain. The functions here may have variable gas costs.\ninterface IUniswapV3PoolDerivedState {\n /// @notice Returns the cumulative tick and liquidity as of each timestamp `secondsAgo` from the current block timestamp\n /// @dev To get a time weighted average tick or liquidity-in-range, you must call this with two values, one representing\n /// the beginning of the period and another for the end of the period. E.g., to get the last hour time-weighted average tick,\n /// you must call it with secondsAgos = [3600, 0].\n /// @dev The time weighted average tick represents the geometric time weighted average price of the pool, in\n /// log base sqrt(1.0001) of token1 / token0. The TickMath library can be used to go from a tick value to a ratio.\n /// @param secondsAgos From how long ago each cumulative tick and liquidity value should be returned\n /// @return tickCumulatives Cumulative tick values as of each `secondsAgos` from the current block timestamp\n /// @return secondsPerLiquidityCumulativeX128s Cumulative seconds per liquidity-in-range value as of each `secondsAgos` from the current block\n /// timestamp\n function observe(uint32[] calldata secondsAgos)\n external\n view\n returns (int56[] memory tickCumulatives, uint160[] memory secondsPerLiquidityCumulativeX128s);\n\n /// @notice Returns a snapshot of the tick cumulative, seconds per liquidity and seconds inside a tick range\n /// @dev Snapshots must only be compared to other snapshots, taken over a period for which a position existed.\n /// I.e., snapshots cannot be compared if a position is not held for the entire period between when the first\n /// snapshot is taken and the second snapshot is taken.\n /// @param tickLower The lower tick of the range\n /// @param tickUpper The upper tick of the range\n /// @return tickCumulativeInside The snapshot of the tick accumulator for the range\n /// @return secondsPerLiquidityInsideX128 The snapshot of seconds per liquidity for the range\n /// @return secondsInside The snapshot of seconds per liquidity for the range\n function snapshotCumulativesInside(int24 tickLower, int24 tickUpper)\n external\n view\n returns (\n int56 tickCumulativeInside,\n uint160 secondsPerLiquidityInsideX128,\n uint32 secondsInside\n );\n}\n" - }, - "@uniswap/v3-core/contracts/interfaces/pool/IUniswapV3PoolActions.sol": { - "content": "// SPDX-License-Identifier: GPL-2.0-or-later\npragma solidity >=0.5.0;\n\n/// @title Permissionless pool actions\n/// @notice Contains pool methods that can be called by anyone\ninterface IUniswapV3PoolActions {\n /// @notice Sets the initial price for the pool\n /// @dev Price is represented as a sqrt(amountToken1/amountToken0) Q64.96 value\n /// @param sqrtPriceX96 the initial sqrt price of the pool as a Q64.96\n function initialize(uint160 sqrtPriceX96) external;\n\n /// @notice Adds liquidity for the given recipient/tickLower/tickUpper position\n /// @dev The caller of this method receives a callback in the form of IUniswapV3MintCallback#uniswapV3MintCallback\n /// in which they must pay any token0 or token1 owed for the liquidity. The amount of token0/token1 due depends\n /// on tickLower, tickUpper, the amount of liquidity, and the current price.\n /// @param recipient The address for which the liquidity will be created\n /// @param tickLower The lower tick of the position in which to add liquidity\n /// @param tickUpper The upper tick of the position in which to add liquidity\n /// @param amount The amount of liquidity to mint\n /// @param data Any data that should be passed through to the callback\n /// @return amount0 The amount of token0 that was paid to mint the given amount of liquidity. Matches the value in the callback\n /// @return amount1 The amount of token1 that was paid to mint the given amount of liquidity. Matches the value in the callback\n function mint(\n address recipient,\n int24 tickLower,\n int24 tickUpper,\n uint128 amount,\n bytes calldata data\n ) external returns (uint256 amount0, uint256 amount1);\n\n /// @notice Collects tokens owed to a position\n /// @dev Does not recompute fees earned, which must be done either via mint or burn of any amount of liquidity.\n /// Collect must be called by the position owner. To withdraw only token0 or only token1, amount0Requested or\n /// amount1Requested may be set to zero. To withdraw all tokens owed, caller may pass any value greater than the\n /// actual tokens owed, e.g. type(uint128).max. Tokens owed may be from accumulated swap fees or burned liquidity.\n /// @param recipient The address which should receive the fees collected\n /// @param tickLower The lower tick of the position for which to collect fees\n /// @param tickUpper The upper tick of the position for which to collect fees\n /// @param amount0Requested How much token0 should be withdrawn from the fees owed\n /// @param amount1Requested How much token1 should be withdrawn from the fees owed\n /// @return amount0 The amount of fees collected in token0\n /// @return amount1 The amount of fees collected in token1\n function collect(\n address recipient,\n int24 tickLower,\n int24 tickUpper,\n uint128 amount0Requested,\n uint128 amount1Requested\n ) external returns (uint128 amount0, uint128 amount1);\n\n /// @notice Burn liquidity from the sender and account tokens owed for the liquidity to the position\n /// @dev Can be used to trigger a recalculation of fees owed to a position by calling with an amount of 0\n /// @dev Fees must be collected separately via a call to #collect\n /// @param tickLower The lower tick of the position for which to burn liquidity\n /// @param tickUpper The upper tick of the position for which to burn liquidity\n /// @param amount How much liquidity to burn\n /// @return amount0 The amount of token0 sent to the recipient\n /// @return amount1 The amount of token1 sent to the recipient\n function burn(\n int24 tickLower,\n int24 tickUpper,\n uint128 amount\n ) external returns (uint256 amount0, uint256 amount1);\n\n /// @notice Swap token0 for token1, or token1 for token0\n /// @dev The caller of this method receives a callback in the form of IUniswapV3SwapCallback#uniswapV3SwapCallback\n /// @param recipient The address to receive the output of the swap\n /// @param zeroForOne The direction of the swap, true for token0 to token1, false for token1 to token0\n /// @param amountSpecified The amount of the swap, which implicitly configures the swap as exact input (positive), or exact output (negative)\n /// @param sqrtPriceLimitX96 The Q64.96 sqrt price limit. If zero for one, the price cannot be less than this\n /// value after the swap. If one for zero, the price cannot be greater than this value after the swap\n /// @param data Any data to be passed through to the callback\n /// @return amount0 The delta of the balance of token0 of the pool, exact when negative, minimum when positive\n /// @return amount1 The delta of the balance of token1 of the pool, exact when negative, minimum when positive\n function swap(\n address recipient,\n bool zeroForOne,\n int256 amountSpecified,\n uint160 sqrtPriceLimitX96,\n bytes calldata data\n ) external returns (int256 amount0, int256 amount1);\n\n /// @notice Receive token0 and/or token1 and pay it back, plus a fee, in the callback\n /// @dev The caller of this method receives a callback in the form of IUniswapV3FlashCallback#uniswapV3FlashCallback\n /// @dev Can be used to donate underlying tokens pro-rata to currently in-range liquidity providers by calling\n /// with 0 amount{0,1} and sending the donation amount(s) from the callback\n /// @param recipient The address which will receive the token0 and token1 amounts\n /// @param amount0 The amount of token0 to send\n /// @param amount1 The amount of token1 to send\n /// @param data Any data to be passed through to the callback\n function flash(\n address recipient,\n uint256 amount0,\n uint256 amount1,\n bytes calldata data\n ) external;\n\n /// @notice Increase the maximum number of price and liquidity observations that this pool will store\n /// @dev This method is no-op if the pool already has an observationCardinalityNext greater than or equal to\n /// the input observationCardinalityNext.\n /// @param observationCardinalityNext The desired minimum number of observations for the pool to store\n function increaseObservationCardinalityNext(uint16 observationCardinalityNext) external;\n}\n" - }, - "@uniswap/v3-core/contracts/interfaces/pool/IUniswapV3PoolOwnerActions.sol": { - "content": "// SPDX-License-Identifier: GPL-2.0-or-later\npragma solidity >=0.5.0;\n\n/// @title Permissioned pool actions\n/// @notice Contains pool methods that may only be called by the factory owner\ninterface IUniswapV3PoolOwnerActions {\n /// @notice Set the denominator of the protocol's % share of the fees\n /// @param feeProtocol0 new protocol fee for token0 of the pool\n /// @param feeProtocol1 new protocol fee for token1 of the pool\n function setFeeProtocol(uint8 feeProtocol0, uint8 feeProtocol1) external;\n\n /// @notice Collect the protocol fee accrued to the pool\n /// @param recipient The address to which collected protocol fees should be sent\n /// @param amount0Requested The maximum amount of token0 to send, can be 0 to collect fees in only token1\n /// @param amount1Requested The maximum amount of token1 to send, can be 0 to collect fees in only token0\n /// @return amount0 The protocol fee collected in token0\n /// @return amount1 The protocol fee collected in token1\n function collectProtocol(\n address recipient,\n uint128 amount0Requested,\n uint128 amount1Requested\n ) external returns (uint128 amount0, uint128 amount1);\n}\n" - }, - "@uniswap/v3-core/contracts/interfaces/pool/IUniswapV3PoolEvents.sol": { - "content": "// SPDX-License-Identifier: GPL-2.0-or-later\npragma solidity >=0.5.0;\n\n/// @title Events emitted by a pool\n/// @notice Contains all events emitted by the pool\ninterface IUniswapV3PoolEvents {\n /// @notice Emitted exactly once by a pool when #initialize is first called on the pool\n /// @dev Mint/Burn/Swap cannot be emitted by the pool before Initialize\n /// @param sqrtPriceX96 The initial sqrt price of the pool, as a Q64.96\n /// @param tick The initial tick of the pool, i.e. log base 1.0001 of the starting price of the pool\n event Initialize(uint160 sqrtPriceX96, int24 tick);\n\n /// @notice Emitted when liquidity is minted for a given position\n /// @param sender The address that minted the liquidity\n /// @param owner The owner of the position and recipient of any minted liquidity\n /// @param tickLower The lower tick of the position\n /// @param tickUpper The upper tick of the position\n /// @param amount The amount of liquidity minted to the position range\n /// @param amount0 How much token0 was required for the minted liquidity\n /// @param amount1 How much token1 was required for the minted liquidity\n event Mint(\n address sender,\n address indexed owner,\n int24 indexed tickLower,\n int24 indexed tickUpper,\n uint128 amount,\n uint256 amount0,\n uint256 amount1\n );\n\n /// @notice Emitted when fees are collected by the owner of a position\n /// @dev Collect events may be emitted with zero amount0 and amount1 when the caller chooses not to collect fees\n /// @param owner The owner of the position for which fees are collected\n /// @param tickLower The lower tick of the position\n /// @param tickUpper The upper tick of the position\n /// @param amount0 The amount of token0 fees collected\n /// @param amount1 The amount of token1 fees collected\n event Collect(\n address indexed owner,\n address recipient,\n int24 indexed tickLower,\n int24 indexed tickUpper,\n uint128 amount0,\n uint128 amount1\n );\n\n /// @notice Emitted when a position's liquidity is removed\n /// @dev Does not withdraw any fees earned by the liquidity position, which must be withdrawn via #collect\n /// @param owner The owner of the position for which liquidity is removed\n /// @param tickLower The lower tick of the position\n /// @param tickUpper The upper tick of the position\n /// @param amount The amount of liquidity to remove\n /// @param amount0 The amount of token0 withdrawn\n /// @param amount1 The amount of token1 withdrawn\n event Burn(\n address indexed owner,\n int24 indexed tickLower,\n int24 indexed tickUpper,\n uint128 amount,\n uint256 amount0,\n uint256 amount1\n );\n\n /// @notice Emitted by the pool for any swaps between token0 and token1\n /// @param sender The address that initiated the swap call, and that received the callback\n /// @param recipient The address that received the output of the swap\n /// @param amount0 The delta of the token0 balance of the pool\n /// @param amount1 The delta of the token1 balance of the pool\n /// @param sqrtPriceX96 The sqrt(price) of the pool after the swap, as a Q64.96\n /// @param liquidity The liquidity of the pool after the swap\n /// @param tick The log base 1.0001 of price of the pool after the swap\n event Swap(\n address indexed sender,\n address indexed recipient,\n int256 amount0,\n int256 amount1,\n uint160 sqrtPriceX96,\n uint128 liquidity,\n int24 tick\n );\n\n /// @notice Emitted by the pool for any flashes of token0/token1\n /// @param sender The address that initiated the swap call, and that received the callback\n /// @param recipient The address that received the tokens from flash\n /// @param amount0 The amount of token0 that was flashed\n /// @param amount1 The amount of token1 that was flashed\n /// @param paid0 The amount of token0 paid for the flash, which can exceed the amount0 plus the fee\n /// @param paid1 The amount of token1 paid for the flash, which can exceed the amount1 plus the fee\n event Flash(\n address indexed sender,\n address indexed recipient,\n uint256 amount0,\n uint256 amount1,\n uint256 paid0,\n uint256 paid1\n );\n\n /// @notice Emitted by the pool for increases to the number of observations that can be stored\n /// @dev observationCardinalityNext is not the observation cardinality until an observation is written at the index\n /// just before a mint/swap/burn.\n /// @param observationCardinalityNextOld The previous value of the next observation cardinality\n /// @param observationCardinalityNextNew The updated value of the next observation cardinality\n event IncreaseObservationCardinalityNext(\n uint16 observationCardinalityNextOld,\n uint16 observationCardinalityNextNew\n );\n\n /// @notice Emitted when the protocol fee is changed by the pool\n /// @param feeProtocol0Old The previous value of the token0 protocol fee\n /// @param feeProtocol1Old The previous value of the token1 protocol fee\n /// @param feeProtocol0New The updated value of the token0 protocol fee\n /// @param feeProtocol1New The updated value of the token1 protocol fee\n event SetFeeProtocol(uint8 feeProtocol0Old, uint8 feeProtocol1Old, uint8 feeProtocol0New, uint8 feeProtocol1New);\n\n /// @notice Emitted when the collected protocol fees are withdrawn by the factory owner\n /// @param sender The address that collects the protocol fees\n /// @param recipient The address that receives the collected protocol fees\n /// @param amount0 The amount of token0 protocol fees that is withdrawn\n /// @param amount0 The amount of token1 protocol fees that is withdrawn\n event CollectProtocol(address indexed sender, address indexed recipient, uint128 amount0, uint128 amount1);\n}\n" - }, - "solidity/for-test/Keep3rHelperForTest.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.0 <0.9.0;\n\nimport '../contracts/Keep3rHelper.sol';\n\ncontract Keep3rHelperForTest is Keep3rHelper {\n uint256 public basefee;\n\n constructor(address _keep3rV2) Keep3rHelper(_keep3rV2) {}\n\n function _getBasefee() internal view override returns (uint256) {\n return basefee;\n }\n\n function setBaseFee(uint256 _baseFee) external {\n basefee = _baseFee;\n }\n}\n" - }, - "solidity/for-test/UniV3PairManagerForTest.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '@openzeppelin/contracts/token/ERC20/ERC20.sol';\nimport '@uniswap/v3-core/contracts/interfaces/IUniswapV3Pool.sol';\n\nimport '../contracts/libraries/LiquidityAmounts.sol';\nimport '../contracts/libraries/PoolAddress.sol';\nimport '../contracts/libraries/FixedPoint96.sol';\nimport '../contracts/libraries/FullMath.sol';\nimport '../contracts/libraries/TickMath.sol';\nimport '../contracts/UniV3PairManager.sol';\nimport '../interfaces/external/IWeth9.sol';\nimport '../interfaces/IUniV3PairManager.sol';\n\ncontract UniV3PairManagerForTest is UniV3PairManager {\n constructor(address _pool, address _governance) UniV3PairManager(_pool, _governance) {}\n\n function internalAddLiquidity(\n uint256 amount0Desired,\n uint256 amount1Desired,\n uint256 amount0Min,\n uint256 amount1Min\n )\n external\n returns (\n uint128 liquidity,\n uint256 amount0,\n uint256 amount1\n )\n {\n return _addLiquidity(amount0Desired, amount1Desired, amount0Min, amount1Min);\n }\n\n function internalPay(\n address token,\n address payer,\n address recipient,\n uint256 value\n ) external {\n return _pay(token, payer, recipient, value);\n }\n\n function internalMint(address dst, uint256 amount) external {\n return _mint(dst, amount);\n }\n\n function internalBurn(address dst, uint256 amount) external {\n return _burn(dst, amount);\n }\n\n function internalTransferTokens(\n address src,\n address dst,\n uint256 amount\n ) external {\n _transferTokens(src, dst, amount);\n }\n\n function internalSafeTransferFrom(\n address token,\n address from,\n address to,\n uint256 value\n ) external {\n _safeTransferFrom(token, from, to, value);\n }\n\n receive() external payable {}\n}\n" - }, - "@openzeppelin/contracts/token/ERC20/ERC20.sol": { - "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\nimport \"./IERC20.sol\";\nimport \"./extensions/IERC20Metadata.sol\";\nimport \"../../utils/Context.sol\";\n\n/**\n * @dev Implementation of the {IERC20} interface.\n *\n * This implementation is agnostic to the way tokens are created. This means\n * that a supply mechanism has to be added in a derived contract using {_mint}.\n * For a generic mechanism see {ERC20PresetMinterPauser}.\n *\n * TIP: For a detailed writeup see our guide\n * https://forum.zeppelin.solutions/t/how-to-implement-erc20-supply-mechanisms/226[How\n * to implement supply mechanisms].\n *\n * We have followed general OpenZeppelin Contracts guidelines: functions revert\n * instead returning `false` on failure. This behavior is nonetheless\n * conventional and does not conflict with the expectations of ERC20\n * applications.\n *\n * Additionally, an {Approval} event is emitted on calls to {transferFrom}.\n * This allows applications to reconstruct the allowance for all accounts just\n * by listening to said events. Other implementations of the EIP may not emit\n * these events, as it isn't required by the specification.\n *\n * Finally, the non-standard {decreaseAllowance} and {increaseAllowance}\n * functions have been added to mitigate the well-known issues around setting\n * allowances. See {IERC20-approve}.\n */\ncontract ERC20 is Context, IERC20, IERC20Metadata {\n mapping(address => uint256) private _balances;\n\n mapping(address => mapping(address => uint256)) private _allowances;\n\n uint256 private _totalSupply;\n\n string private _name;\n string private _symbol;\n\n /**\n * @dev Sets the values for {name} and {symbol}.\n *\n * The default value of {decimals} is 18. To select a different value for\n * {decimals} you should overload it.\n *\n * All two of these values are immutable: they can only be set once during\n * construction.\n */\n constructor(string memory name_, string memory symbol_) {\n _name = name_;\n _symbol = symbol_;\n }\n\n /**\n * @dev Returns the name of the token.\n */\n function name() public view virtual override returns (string memory) {\n return _name;\n }\n\n /**\n * @dev Returns the symbol of the token, usually a shorter version of the\n * name.\n */\n function symbol() public view virtual override returns (string memory) {\n return _symbol;\n }\n\n /**\n * @dev Returns the number of decimals used to get its user representation.\n * For example, if `decimals` equals `2`, a balance of `505` tokens should\n * be displayed to a user as `5.05` (`505 / 10 ** 2`).\n *\n * Tokens usually opt for a value of 18, imitating the relationship between\n * Ether and Wei. This is the value {ERC20} uses, unless this function is\n * overridden;\n *\n * NOTE: This information is only used for _display_ purposes: it in\n * no way affects any of the arithmetic of the contract, including\n * {IERC20-balanceOf} and {IERC20-transfer}.\n */\n function decimals() public view virtual override returns (uint8) {\n return 18;\n }\n\n /**\n * @dev See {IERC20-totalSupply}.\n */\n function totalSupply() public view virtual override returns (uint256) {\n return _totalSupply;\n }\n\n /**\n * @dev See {IERC20-balanceOf}.\n */\n function balanceOf(address account) public view virtual override returns (uint256) {\n return _balances[account];\n }\n\n /**\n * @dev See {IERC20-transfer}.\n *\n * Requirements:\n *\n * - `recipient` cannot be the zero address.\n * - the caller must have a balance of at least `amount`.\n */\n function transfer(address recipient, uint256 amount) public virtual override returns (bool) {\n _transfer(_msgSender(), recipient, amount);\n return true;\n }\n\n /**\n * @dev See {IERC20-allowance}.\n */\n function allowance(address owner, address spender) public view virtual override returns (uint256) {\n return _allowances[owner][spender];\n }\n\n /**\n * @dev See {IERC20-approve}.\n *\n * Requirements:\n *\n * - `spender` cannot be the zero address.\n */\n function approve(address spender, uint256 amount) public virtual override returns (bool) {\n _approve(_msgSender(), spender, amount);\n return true;\n }\n\n /**\n * @dev See {IERC20-transferFrom}.\n *\n * Emits an {Approval} event indicating the updated allowance. This is not\n * required by the EIP. See the note at the beginning of {ERC20}.\n *\n * Requirements:\n *\n * - `sender` and `recipient` cannot be the zero address.\n * - `sender` must have a balance of at least `amount`.\n * - the caller must have allowance for ``sender``'s tokens of at least\n * `amount`.\n */\n function transferFrom(\n address sender,\n address recipient,\n uint256 amount\n ) public virtual override returns (bool) {\n _transfer(sender, recipient, amount);\n\n uint256 currentAllowance = _allowances[sender][_msgSender()];\n require(currentAllowance >= amount, \"ERC20: transfer amount exceeds allowance\");\n unchecked {\n _approve(sender, _msgSender(), currentAllowance - amount);\n }\n\n return true;\n }\n\n /**\n * @dev Atomically increases the allowance granted to `spender` by the caller.\n *\n * This is an alternative to {approve} that can be used as a mitigation for\n * problems described in {IERC20-approve}.\n *\n * Emits an {Approval} event indicating the updated allowance.\n *\n * Requirements:\n *\n * - `spender` cannot be the zero address.\n */\n function increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool) {\n _approve(_msgSender(), spender, _allowances[_msgSender()][spender] + addedValue);\n return true;\n }\n\n /**\n * @dev Atomically decreases the allowance granted to `spender` by the caller.\n *\n * This is an alternative to {approve} that can be used as a mitigation for\n * problems described in {IERC20-approve}.\n *\n * Emits an {Approval} event indicating the updated allowance.\n *\n * Requirements:\n *\n * - `spender` cannot be the zero address.\n * - `spender` must have allowance for the caller of at least\n * `subtractedValue`.\n */\n function decreaseAllowance(address spender, uint256 subtractedValue) public virtual returns (bool) {\n uint256 currentAllowance = _allowances[_msgSender()][spender];\n require(currentAllowance >= subtractedValue, \"ERC20: decreased allowance below zero\");\n unchecked {\n _approve(_msgSender(), spender, currentAllowance - subtractedValue);\n }\n\n return true;\n }\n\n /**\n * @dev Moves `amount` of tokens from `sender` to `recipient`.\n *\n * This internal function is equivalent to {transfer}, and can be used to\n * e.g. implement automatic token fees, slashing mechanisms, etc.\n *\n * Emits a {Transfer} event.\n *\n * Requirements:\n *\n * - `sender` cannot be the zero address.\n * - `recipient` cannot be the zero address.\n * - `sender` must have a balance of at least `amount`.\n */\n function _transfer(\n address sender,\n address recipient,\n uint256 amount\n ) internal virtual {\n require(sender != address(0), \"ERC20: transfer from the zero address\");\n require(recipient != address(0), \"ERC20: transfer to the zero address\");\n\n _beforeTokenTransfer(sender, recipient, amount);\n\n uint256 senderBalance = _balances[sender];\n require(senderBalance >= amount, \"ERC20: transfer amount exceeds balance\");\n unchecked {\n _balances[sender] = senderBalance - amount;\n }\n _balances[recipient] += amount;\n\n emit Transfer(sender, recipient, amount);\n\n _afterTokenTransfer(sender, recipient, amount);\n }\n\n /** @dev Creates `amount` tokens and assigns them to `account`, increasing\n * the total supply.\n *\n * Emits a {Transfer} event with `from` set to the zero address.\n *\n * Requirements:\n *\n * - `account` cannot be the zero address.\n */\n function _mint(address account, uint256 amount) internal virtual {\n require(account != address(0), \"ERC20: mint to the zero address\");\n\n _beforeTokenTransfer(address(0), account, amount);\n\n _totalSupply += amount;\n _balances[account] += amount;\n emit Transfer(address(0), account, amount);\n\n _afterTokenTransfer(address(0), account, amount);\n }\n\n /**\n * @dev Destroys `amount` tokens from `account`, reducing the\n * total supply.\n *\n * Emits a {Transfer} event with `to` set to the zero address.\n *\n * Requirements:\n *\n * - `account` cannot be the zero address.\n * - `account` must have at least `amount` tokens.\n */\n function _burn(address account, uint256 amount) internal virtual {\n require(account != address(0), \"ERC20: burn from the zero address\");\n\n _beforeTokenTransfer(account, address(0), amount);\n\n uint256 accountBalance = _balances[account];\n require(accountBalance >= amount, \"ERC20: burn amount exceeds balance\");\n unchecked {\n _balances[account] = accountBalance - amount;\n }\n _totalSupply -= amount;\n\n emit Transfer(account, address(0), amount);\n\n _afterTokenTransfer(account, address(0), amount);\n }\n\n /**\n * @dev Sets `amount` as the allowance of `spender` over the `owner` s tokens.\n *\n * This internal function is equivalent to `approve`, and can be used to\n * e.g. set automatic allowances for certain subsystems, etc.\n *\n * Emits an {Approval} event.\n *\n * Requirements:\n *\n * - `owner` cannot be the zero address.\n * - `spender` cannot be the zero address.\n */\n function _approve(\n address owner,\n address spender,\n uint256 amount\n ) internal virtual {\n require(owner != address(0), \"ERC20: approve from the zero address\");\n require(spender != address(0), \"ERC20: approve to the zero address\");\n\n _allowances[owner][spender] = amount;\n emit Approval(owner, spender, amount);\n }\n\n /**\n * @dev Hook that is called before any transfer of tokens. This includes\n * minting and burning.\n *\n * Calling conditions:\n *\n * - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens\n * will be transferred to `to`.\n * - when `from` is zero, `amount` tokens will be minted for `to`.\n * - when `to` is zero, `amount` of ``from``'s tokens will be burned.\n * - `from` and `to` are never both zero.\n *\n * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].\n */\n function _beforeTokenTransfer(\n address from,\n address to,\n uint256 amount\n ) internal virtual {}\n\n /**\n * @dev Hook that is called after any transfer of tokens. This includes\n * minting and burning.\n *\n * Calling conditions:\n *\n * - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens\n * has been transferred to `to`.\n * - when `from` is zero, `amount` tokens have been minted for `to`.\n * - when `to` is zero, `amount` of ``from``'s tokens have been burned.\n * - `from` and `to` are never both zero.\n *\n * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].\n */\n function _afterTokenTransfer(\n address from,\n address to,\n uint256 amount\n ) internal virtual {}\n}\n" - }, - "solidity/contracts/libraries/LiquidityAmounts.sol": { - "content": "// SPDX-License-Identifier: GPL-2.0-or-later\npragma solidity >=0.8.4 <0.9.0;\n\nimport './FullMath.sol';\nimport './FixedPoint96.sol';\n\n// solhint-disable\nlibrary LiquidityAmounts {\n function toUint128(uint256 x) private pure returns (uint128 y) {\n require((y = uint128(x)) == x);\n }\n\n function getLiquidityForAmount0(\n uint160 sqrtRatioAX96,\n uint160 sqrtRatioBX96,\n uint256 amount0\n ) internal pure returns (uint128 liquidity) {\n if (sqrtRatioAX96 > sqrtRatioBX96) (sqrtRatioAX96, sqrtRatioBX96) = (sqrtRatioBX96, sqrtRatioAX96);\n uint256 intermediate = FullMath.mulDiv(sqrtRatioAX96, sqrtRatioBX96, FixedPoint96.Q96);\n return toUint128(FullMath.mulDiv(amount0, intermediate, sqrtRatioBX96 - sqrtRatioAX96));\n }\n\n function getLiquidityForAmount1(\n uint160 sqrtRatioAX96,\n uint160 sqrtRatioBX96,\n uint256 amount1\n ) internal pure returns (uint128 liquidity) {\n if (sqrtRatioAX96 > sqrtRatioBX96) (sqrtRatioAX96, sqrtRatioBX96) = (sqrtRatioBX96, sqrtRatioAX96);\n return toUint128(FullMath.mulDiv(amount1, FixedPoint96.Q96, sqrtRatioBX96 - sqrtRatioAX96));\n }\n\n function getLiquidityForAmounts(\n uint160 sqrtRatioX96,\n uint160 sqrtRatioAX96,\n uint160 sqrtRatioBX96,\n uint256 amount0,\n uint256 amount1\n ) internal pure returns (uint128 liquidity) {\n if (sqrtRatioAX96 > sqrtRatioBX96) (sqrtRatioAX96, sqrtRatioBX96) = (sqrtRatioBX96, sqrtRatioAX96);\n\n if (sqrtRatioX96 <= sqrtRatioAX96) {\n liquidity = getLiquidityForAmount0(sqrtRatioAX96, sqrtRatioBX96, amount0);\n } else if (sqrtRatioX96 < sqrtRatioBX96) {\n uint128 liquidity0 = getLiquidityForAmount0(sqrtRatioX96, sqrtRatioBX96, amount0);\n uint128 liquidity1 = getLiquidityForAmount1(sqrtRatioAX96, sqrtRatioX96, amount1);\n\n liquidity = liquidity0 < liquidity1 ? liquidity0 : liquidity1;\n } else {\n liquidity = getLiquidityForAmount1(sqrtRatioAX96, sqrtRatioBX96, amount1);\n }\n }\n\n function getAmount0ForLiquidity(\n uint160 sqrtRatioAX96,\n uint160 sqrtRatioBX96,\n uint128 liquidity\n ) internal pure returns (uint256 amount0) {\n if (sqrtRatioAX96 > sqrtRatioBX96) (sqrtRatioAX96, sqrtRatioBX96) = (sqrtRatioBX96, sqrtRatioAX96);\n\n return FullMath.mulDiv(uint256(liquidity) << FixedPoint96.RESOLUTION, sqrtRatioBX96 - sqrtRatioAX96, sqrtRatioBX96) / sqrtRatioAX96;\n }\n\n function getAmount1ForLiquidity(\n uint160 sqrtRatioAX96,\n uint160 sqrtRatioBX96,\n uint128 liquidity\n ) internal pure returns (uint256 amount1) {\n if (sqrtRatioAX96 > sqrtRatioBX96) (sqrtRatioAX96, sqrtRatioBX96) = (sqrtRatioBX96, sqrtRatioAX96);\n\n return FullMath.mulDiv(liquidity, sqrtRatioBX96 - sqrtRatioAX96, FixedPoint96.Q96);\n }\n\n function getAmountsForLiquidity(\n uint160 sqrtRatioX96,\n uint160 sqrtRatioAX96,\n uint160 sqrtRatioBX96,\n uint128 liquidity\n ) internal pure returns (uint256 amount0, uint256 amount1) {\n if (sqrtRatioAX96 > sqrtRatioBX96) (sqrtRatioAX96, sqrtRatioBX96) = (sqrtRatioBX96, sqrtRatioAX96);\n\n if (sqrtRatioX96 <= sqrtRatioAX96) {\n amount0 = getAmount0ForLiquidity(sqrtRatioAX96, sqrtRatioBX96, liquidity);\n } else if (sqrtRatioX96 < sqrtRatioBX96) {\n amount0 = getAmount0ForLiquidity(sqrtRatioX96, sqrtRatioBX96, liquidity);\n amount1 = getAmount1ForLiquidity(sqrtRatioAX96, sqrtRatioX96, liquidity);\n } else {\n amount1 = getAmount1ForLiquidity(sqrtRatioAX96, sqrtRatioBX96, liquidity);\n }\n }\n}\n" - }, - "solidity/contracts/libraries/PoolAddress.sol": { - "content": "// SPDX-License-Identifier: GPL-2.0-or-later\npragma solidity >=0.8.4 <0.9.0;\n\nlibrary PoolAddress {\n struct PoolKey {\n address token0;\n address token1;\n uint24 fee;\n }\n}\n" - }, - "solidity/contracts/libraries/FixedPoint96.sol": { - "content": "// SPDX-License-Identifier: GPL-2.0-or-later\npragma solidity >=0.8.4 <0.9.0;\n\nlibrary FixedPoint96 {\n // solhint-disable\n uint8 internal constant RESOLUTION = 96;\n uint256 internal constant Q96 = 0x1000000000000000000000000;\n}\n" - }, - "solidity/contracts/UniV3PairManager.sol": { - "content": "// SPDX-License-Identifier: MIT\n\n/*\n\nCoded for The Keep3r Network with ♥ by\n\n██████╗░███████╗███████╗██╗  ░██╗░░░░░░░██╗░█████╗░███╗░░██╗██████╗░███████╗██████╗░██╗░░░░░░█████╗░███╗░░██╗██████╗░\n██╔══██╗██╔════╝██╔════╝██║  ░██║░░██╗░░██║██╔══██╗████╗░██║██╔══██╗██╔════╝██╔══██╗██║░░░░░██╔══██╗████╗░██║██╔══██╗\n██║░░██║█████╗░░█████╗░░██║  ░╚██╗████╗██╔╝██║░░██║██╔██╗██║██║░░██║█████╗░░██████╔╝██║░░░░░███████║██╔██╗██║██║░░██║\n██║░░██║██╔══╝░░██╔══╝░░██║  ░░████╔═████║░██║░░██║██║╚████║██║░░██║██╔══╝░░██╔══██╗██║░░░░░██╔══██║██║╚████║██║░░██║\n██████╔╝███████╗██║░░░░░██║  ░░╚██╔╝░╚██╔╝░╚█████╔╝██║░╚███║██████╔╝███████╗██║░░██║███████╗██║░░██║██║░╚███║██████╔╝\n╚═════╝░╚══════╝╚═╝░░░░░╚═╝  ░░░╚═╝░░░╚═╝░░░╚════╝░╚═╝░░╚══╝╚═════╝░╚══════╝╚═╝░░╚═╝╚══════╝╚═╝░░╚═╝╚═╝░░╚══╝╚═════╝░\n\nhttps://defi.sucks\n\n*/\n\npragma solidity >=0.8.4 <0.9.0;\n\nimport '@openzeppelin/contracts/token/ERC20/ERC20.sol';\nimport '@uniswap/v3-core/contracts/interfaces/IUniswapV3Pool.sol';\n\nimport './libraries/LiquidityAmounts.sol';\nimport './libraries/PoolAddress.sol';\nimport './libraries/FixedPoint96.sol';\nimport './libraries/FullMath.sol';\nimport './libraries/TickMath.sol';\n\nimport '../interfaces/external/IWeth9.sol';\nimport '../interfaces/IUniV3PairManager.sol';\n\nimport './peripherals/Governable.sol';\n\ncontract UniV3PairManager is IUniV3PairManager, Governable {\n /// @inheritdoc IERC20Metadata\n string public override name;\n\n /// @inheritdoc IERC20Metadata\n string public override symbol;\n\n /// @inheritdoc IERC20\n uint256 public override totalSupply = 0;\n\n /// @inheritdoc IPairManager\n address public immutable override token0;\n\n /// @inheritdoc IPairManager\n address public immutable override token1;\n\n /// @inheritdoc IPairManager\n address public immutable override pool;\n\n /// @inheritdoc IUniV3PairManager\n uint24 public immutable override fee;\n\n /// @inheritdoc IUniV3PairManager\n uint160 public immutable override sqrtRatioAX96;\n\n /// @inheritdoc IUniV3PairManager\n uint160 public immutable override sqrtRatioBX96;\n\n /// @notice Lowest possible tick in the Uniswap's curve\n int24 private constant _TICK_LOWER = -887200;\n\n /// @notice Highest possible tick in the Uniswap's curve\n int24 private constant _TICK_UPPER = 887200;\n\n /// @inheritdoc IERC20Metadata\n //solhint-disable-next-line const-name-snakecase\n uint8 public constant override decimals = 18;\n\n /// @inheritdoc IERC20\n mapping(address => mapping(address => uint256)) public override allowance;\n\n /// @inheritdoc IERC20\n mapping(address => uint256) public override balanceOf;\n\n /// @notice Struct that contains token0, token1, and fee of the Uniswap pool\n PoolAddress.PoolKey private _poolKey;\n\n constructor(address _pool, address _governance) Governable(_governance) {\n pool = _pool;\n uint24 _fee = IUniswapV3Pool(_pool).fee();\n fee = _fee;\n address _token0 = IUniswapV3Pool(_pool).token0();\n address _token1 = IUniswapV3Pool(_pool).token1();\n token0 = _token0;\n token1 = _token1;\n name = string(abi.encodePacked('Keep3rLP - ', ERC20(_token0).symbol(), '/', ERC20(_token1).symbol()));\n symbol = string(abi.encodePacked('kLP-', ERC20(_token0).symbol(), '/', ERC20(_token1).symbol()));\n sqrtRatioAX96 = TickMath.getSqrtRatioAtTick(_TICK_LOWER);\n sqrtRatioBX96 = TickMath.getSqrtRatioAtTick(_TICK_UPPER);\n _poolKey = PoolAddress.PoolKey({token0: _token0, token1: _token1, fee: _fee});\n }\n\n // This low-level function should be called from a contract which performs important safety checks\n /// @inheritdoc IUniV3PairManager\n function mint(\n uint256 amount0Desired,\n uint256 amount1Desired,\n uint256 amount0Min,\n uint256 amount1Min,\n address to\n ) external override returns (uint128 liquidity) {\n (liquidity, , ) = _addLiquidity(amount0Desired, amount1Desired, amount0Min, amount1Min);\n _mint(to, liquidity);\n }\n\n /// @inheritdoc IUniV3PairManager\n function uniswapV3MintCallback(\n uint256 amount0Owed,\n uint256 amount1Owed,\n bytes calldata data\n ) external override {\n MintCallbackData memory decoded = abi.decode(data, (MintCallbackData));\n if (msg.sender != pool) revert OnlyPool();\n if (amount0Owed > 0) _pay(decoded._poolKey.token0, decoded.payer, pool, amount0Owed);\n if (amount1Owed > 0) _pay(decoded._poolKey.token1, decoded.payer, pool, amount1Owed);\n }\n\n /// @inheritdoc IUniV3PairManager\n function burn(\n uint128 liquidity,\n uint256 amount0Min,\n uint256 amount1Min,\n address to\n ) external override returns (uint256 amount0, uint256 amount1) {\n (amount0, amount1) = IUniswapV3Pool(pool).burn(_TICK_LOWER, _TICK_UPPER, liquidity);\n\n if (amount0 < amount0Min || amount1 < amount1Min) revert ExcessiveSlippage();\n\n IUniswapV3Pool(pool).collect(to, _TICK_LOWER, _TICK_UPPER, uint128(amount0), uint128(amount1));\n _burn(msg.sender, liquidity);\n }\n\n /// @inheritdoc IUniV3PairManager\n function collect() external override onlyGovernance returns (uint256 amount0, uint256 amount1) {\n (, , , uint128 tokensOwed0, uint128 tokensOwed1) = IUniswapV3Pool(pool).positions(\n keccak256(abi.encodePacked(address(this), _TICK_LOWER, _TICK_UPPER))\n );\n (amount0, amount1) = IUniswapV3Pool(pool).collect(governance, _TICK_LOWER, _TICK_UPPER, tokensOwed0, tokensOwed1);\n }\n\n /// @inheritdoc IUniV3PairManager\n function position()\n external\n view\n override\n returns (\n uint128 liquidity,\n uint256 feeGrowthInside0LastX128,\n uint256 feeGrowthInside1LastX128,\n uint128 tokensOwed0,\n uint128 tokensOwed1\n )\n {\n (liquidity, feeGrowthInside0LastX128, feeGrowthInside1LastX128, tokensOwed0, tokensOwed1) = IUniswapV3Pool(pool).positions(\n keccak256(abi.encodePacked(address(this), _TICK_LOWER, _TICK_UPPER))\n );\n }\n\n /// @inheritdoc IERC20\n function approve(address spender, uint256 amount) external override returns (bool) {\n allowance[msg.sender][spender] = amount;\n\n emit Approval(msg.sender, spender, amount);\n return true;\n }\n\n /// @inheritdoc IERC20\n function transfer(address to, uint256 amount) external override returns (bool) {\n _transferTokens(msg.sender, to, amount);\n return true;\n }\n\n /// @inheritdoc IERC20\n function transferFrom(\n address from,\n address to,\n uint256 amount\n ) external override returns (bool) {\n address spender = msg.sender;\n uint256 spenderAllowance = allowance[from][spender];\n\n if (spender != from && spenderAllowance != type(uint256).max) {\n uint256 newAllowance = spenderAllowance - amount;\n allowance[from][spender] = newAllowance;\n\n emit Approval(from, spender, newAllowance);\n }\n\n _transferTokens(from, to, amount);\n return true;\n }\n\n /// @notice Adds liquidity to an initialized pool\n /// @dev Reverts if the returned amount0 is less than amount0Min or if amount1 is less than amount1Min\n /// @dev This function calls the mint function of the corresponding Uniswap pool, which in turn calls UniswapV3Callback\n /// @param amount0Desired The amount of token0 we would like to provide\n /// @param amount1Desired The amount of token1 we would like to provide\n /// @param amount0Min The minimum amount of token0 we want to provide\n /// @param amount1Min The minimum amount of token1 we want to provide\n /// @return liquidity The calculated liquidity we get for the token amounts we provided\n /// @return amount0 The amount of token0 we ended up providing\n /// @return amount1 The amount of token1 we ended up providing\n function _addLiquidity(\n uint256 amount0Desired,\n uint256 amount1Desired,\n uint256 amount0Min,\n uint256 amount1Min\n )\n internal\n returns (\n uint128 liquidity,\n uint256 amount0,\n uint256 amount1\n )\n {\n (uint160 sqrtPriceX96, , , , , , ) = IUniswapV3Pool(pool).slot0();\n\n liquidity = LiquidityAmounts.getLiquidityForAmounts(sqrtPriceX96, sqrtRatioAX96, sqrtRatioBX96, amount0Desired, amount1Desired);\n\n (amount0, amount1) = IUniswapV3Pool(pool).mint(\n address(this),\n _TICK_LOWER,\n _TICK_UPPER,\n liquidity,\n abi.encode(MintCallbackData({_poolKey: _poolKey, payer: msg.sender}))\n );\n\n if (amount0 < amount0Min || amount1 < amount1Min) revert ExcessiveSlippage();\n }\n\n /// @notice Transfers the passed-in token from the payer to the recipient for the corresponding value\n /// @param token The token to be transferred to the recipient\n /// @param from The address of the payer\n /// @param to The address of the passed-in tokens recipient\n /// @param value How much of that token to be transferred from payer to the recipient\n function _pay(\n address token,\n address from,\n address to,\n uint256 value\n ) internal {\n _safeTransferFrom(token, from, to, value);\n }\n\n /// @notice Mints Keep3r credits to the passed-in address of recipient and increases total supply of Keep3r credits by the corresponding amount\n /// @param to The recipient of the Keep3r credits\n /// @param amount The amount Keep3r credits to be minted to the recipient\n function _mint(address to, uint256 amount) internal {\n totalSupply += amount;\n balanceOf[to] += amount;\n emit Transfer(address(0), to, amount);\n }\n\n /// @notice Burns Keep3r credits to the passed-in address of recipient and reduces total supply of Keep3r credits by the corresponding amount\n /// @param to The address that will get its Keep3r credits burned\n /// @param amount The amount Keep3r credits to be burned from the recipient/recipient\n function _burn(address to, uint256 amount) internal {\n totalSupply -= amount;\n balanceOf[to] -= amount;\n emit Transfer(to, address(0), amount);\n }\n\n /// @notice Transfers amount of Keep3r credits between two addresses\n /// @param from The user that transfers the Keep3r credits\n /// @param to The user that receives the Keep3r credits\n /// @param amount The amount of Keep3r credits to be transferred\n function _transferTokens(\n address from,\n address to,\n uint256 amount\n ) internal {\n balanceOf[from] -= amount;\n balanceOf[to] += amount;\n\n emit Transfer(from, to, amount);\n }\n\n /// @notice Transfers the passed-in token from the specified \"from\" to the specified \"to\" for the corresponding value\n /// @dev Reverts with IUniV3PairManager#UnsuccessfulTransfer if the transfer was not successful,\n /// or if the passed data length is different than 0 and the decoded data is not a boolean\n /// @param token The token to be transferred to the specified \"to\"\n /// @param from The address which is going to transfer the tokens\n /// @param value How much of that token to be transferred from \"from\" to \"to\"\n function _safeTransferFrom(\n address token,\n address from,\n address to,\n uint256 value\n ) internal {\n // solhint-disable-next-line avoid-low-level-calls\n (bool success, bytes memory data) = token.call(abi.encodeWithSelector(IERC20.transferFrom.selector, from, to, value));\n if (!success || (data.length != 0 && !abi.decode(data, (bool)))) revert UnsuccessfulTransfer();\n }\n}\n" - }, - "solidity/interfaces/external/IWeth9.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '@openzeppelin/contracts/token/ERC20/IERC20.sol';\n\ninterface IWeth9 is IERC20 {\n function deposit() external payable;\n\n function withdraw(uint256) external;\n}\n" - }, - "solidity/interfaces/IUniV3PairManager.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.0 <0.9.0;\n\nimport './IPairManager.sol';\nimport '../contracts/libraries/PoolAddress.sol';\nimport '@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol';\nimport './peripherals/IGovernable.sol';\n\n/// @title Pair Manager contract\n/// @notice Creates a UniswapV3 position, and tokenizes in an ERC20 manner\n/// so that the user can use it as liquidity for a Keep3rJob\ninterface IUniV3PairManager is IGovernable, IPairManager {\n // Structs\n\n /// @notice The data to be decoded by the UniswapV3MintCallback function\n struct MintCallbackData {\n PoolAddress.PoolKey _poolKey; // Struct that contains token0, token1, and fee of the pool passed into the constructor\n address payer; // The address of the payer, which will be the msg.sender of the mint function\n }\n\n // Variables\n\n /// @notice The fee of the Uniswap pool passed into the constructor\n /// @return _fee The fee of the Uniswap pool passed into the constructor\n function fee() external view returns (uint24 _fee);\n\n /// @notice The sqrtRatioAX96 at the lowest tick (-887200) of the Uniswap pool\n /// @return _sqrtPriceA96 A Fixed point Q64.96 number representing the sqrt of the ratio of the two assets (token1/token0)\n /// at the lowest tick\n function sqrtRatioAX96() external view returns (uint160 _sqrtPriceA96);\n\n /// @notice The sqrtRatioBX96 at the highest tick (887200) of the Uniswap pool\n /// @return _sqrtPriceBX96 A Fixed point Q64.96 number representing the sqrt of the ratio of the two assets (token1/token0)\n /// at the highest tick\n function sqrtRatioBX96() external view returns (uint160 _sqrtPriceBX96);\n\n // Errors\n\n /// @notice Throws when the caller of the function is not the pool\n error OnlyPool();\n\n /// @notice Throws when the slippage exceeds what the user is comfortable with\n error ExcessiveSlippage();\n\n /// @notice Throws when a transfer is unsuccessful\n error UnsuccessfulTransfer();\n\n // Methods\n\n /// @notice This function is called after a user calls IUniV3PairManager#mint function\n /// It ensures that any tokens owed to the pool are paid by the msg.sender of IUniV3PairManager#mint function\n /// @param amount0Owed The amount of token0 due to the pool for the minted liquidity\n /// @param amount1Owed The amount of token1 due to the pool for the minted liquidity\n /// @param data The encoded token0, token1, fee (_poolKey) and the payer (msg.sender) of the IUniV3PairManager#mint function\n function uniswapV3MintCallback(\n uint256 amount0Owed,\n uint256 amount1Owed,\n bytes calldata data\n ) external;\n\n /// @notice Mints kLP tokens to an address according to the liquidity the msg.sender provides to the UniswapV3 pool\n /// @dev Triggers UniV3PairManager#uniswapV3MintCallback\n /// @param amount0Desired The amount of token0 we would like to provide\n /// @param amount1Desired The amount of token1 we would like to provide\n /// @param amount0Min The minimum amount of token0 we want to provide\n /// @param amount1Min The minimum amount of token1 we want to provide\n /// @param to The address to which the kLP tokens are going to be minted to\n /// @return liquidity kLP tokens sent in exchange for the provision of tokens\n function mint(\n uint256 amount0Desired,\n uint256 amount1Desired,\n uint256 amount0Min,\n uint256 amount1Min,\n address to\n ) external returns (uint128 liquidity);\n\n /// @notice Returns the pair manager's position in the corresponding UniswapV3 pool\n /// @return liquidity The amount of liquidity provided to the UniswapV3 pool by the pair manager\n /// @return feeGrowthInside0LastX128 The fee growth of token0 as of the last action on the individual position\n /// @return feeGrowthInside1LastX128 The fee growth of token1 as of the last action on the individual position\n /// @return tokensOwed0 The uncollected amount of token0 owed to the position as of the last computation\n /// @return tokensOwed1 The uncollected amount of token1 owed to the position as of the last computation\n function position()\n external\n view\n returns (\n uint128 liquidity,\n uint256 feeGrowthInside0LastX128,\n uint256 feeGrowthInside1LastX128,\n uint128 tokensOwed0,\n uint128 tokensOwed1\n );\n\n /// @notice Calls the UniswapV3 pool's collect function, which collects up to a maximum amount of fees\n // owed to a specific position to the recipient, in this case, that recipient is the pair manager\n /// @dev The collected fees will be sent to governance\n /// @return amount0 The amount of fees collected in token0\n /// @return amount1 The amount of fees collected in token1\n function collect() external returns (uint256 amount0, uint256 amount1);\n\n /// @notice Burns the corresponding amount of kLP tokens from the msg.sender and withdraws the specified liquidity\n // in the entire range\n /// @param liquidity The amount of liquidity to be burned\n /// @param amount0Min The minimum amount of token0 we want to send to the recipient (to)\n /// @param amount1Min The minimum amount of token1 we want to send to the recipient (to)\n /// @param to The address that will receive the due fees\n /// @return amount0 The calculated amount of token0 that will be sent to the recipient\n /// @return amount1 The calculated amount of token1 that will be sent to the recipient\n function burn(\n uint128 liquidity,\n uint256 amount0Min,\n uint256 amount1Min,\n address to\n ) external returns (uint256 amount0, uint256 amount1);\n}\n" - }, - "@openzeppelin/contracts/utils/Context.sol": { - "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Provides information about the current execution context, including the\n * sender of the transaction and its data. While these are generally available\n * via msg.sender and msg.data, they should not be accessed in such a direct\n * manner, since when dealing with meta-transactions the account sending and\n * paying for execution may not be the actual sender (as far as an application\n * is concerned).\n *\n * This contract is only required for intermediate, library-like contracts.\n */\nabstract contract Context {\n function _msgSender() internal view virtual returns (address) {\n return msg.sender;\n }\n\n function _msgData() internal view virtual returns (bytes calldata) {\n return msg.data;\n }\n}\n" - }, - "solidity/interfaces/IPairManagerFactory.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.0 <0.9.0;\n\nimport './peripherals/IGovernable.sol';\n\n/// @title Factory of Pair Managers\n/// @notice This contract creates new pair managers\ninterface IPairManagerFactory is IGovernable {\n // Variables\n\n /// @notice Maps the address of a Uniswap pool, to the address of the corresponding PairManager\n /// For example, the uniswap address of DAI-WETH, will return the Keep3r/DAI-WETH pair manager address\n /// @param _pool The address of the Uniswap pool\n /// @return _pairManager The address of the corresponding pair manager\n function pairManagers(address _pool) external view returns (address _pairManager);\n\n // Events\n\n /// @notice Emitted when a new pair manager is created\n /// @param _pool The address of the corresponding Uniswap pool\n /// @param _pairManager The address of the just-created pair manager\n event PairCreated(address _pool, address _pairManager);\n\n // Errors\n\n /// @notice Throws an error if the pair manager is already initialized\n error AlreadyInitialized();\n\n /// @notice Throws an error if the caller is not the owner\n error OnlyOwner();\n\n // Methods\n\n /// @notice Creates a new pair manager based on the address of a Uniswap pool\n /// For example, the uniswap address of DAI-WETH, will create the Keep3r/DAI-WETH pool\n /// @param _pool The address of the Uniswap pool the pair manager will be based of\n /// @return _pairManager The address of the just-created pair manager\n function createPairManager(address _pool) external returns (address _pairManager);\n}\n" - }, - "solidity/contracts/UniV3PairManagerFactory.sol": { - "content": "// SPDX-License-Identifier: MIT\n\n/*\n\nCoded for The Keep3r Network with ♥ by\n\n██████╗░███████╗███████╗██╗  ░██╗░░░░░░░██╗░█████╗░███╗░░██╗██████╗░███████╗██████╗░██╗░░░░░░█████╗░███╗░░██╗██████╗░\n██╔══██╗██╔════╝██╔════╝██║  ░██║░░██╗░░██║██╔══██╗████╗░██║██╔══██╗██╔════╝██╔══██╗██║░░░░░██╔══██╗████╗░██║██╔══██╗\n██║░░██║█████╗░░█████╗░░██║  ░╚██╗████╗██╔╝██║░░██║██╔██╗██║██║░░██║█████╗░░██████╔╝██║░░░░░███████║██╔██╗██║██║░░██║\n██║░░██║██╔══╝░░██╔══╝░░██║  ░░████╔═████║░██║░░██║██║╚████║██║░░██║██╔══╝░░██╔══██╗██║░░░░░██╔══██║██║╚████║██║░░██║\n██████╔╝███████╗██║░░░░░██║  ░░╚██╔╝░╚██╔╝░╚█████╔╝██║░╚███║██████╔╝███████╗██║░░██║███████╗██║░░██║██║░╚███║██████╔╝\n╚═════╝░╚══════╝╚═╝░░░░░╚═╝  ░░░╚═╝░░░╚═╝░░░╚════╝░╚═╝░░╚══╝╚═════╝░╚══════╝╚═╝░░╚═╝╚══════╝╚═╝░░╚═╝╚═╝░░╚══╝╚═════╝░\n\nhttps://defi.sucks\n\n*/\n\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../interfaces/IPairManagerFactory.sol';\nimport './UniV3PairManager.sol';\nimport './peripherals/Governable.sol';\n\n/// @title Factory of Pair Managers\n/// @notice This contract creates new pair managers\ncontract UniV3PairManagerFactory is IPairManagerFactory, Governable {\n mapping(address => address) public override pairManagers;\n\n constructor() Governable(msg.sender) {}\n\n ///@inheritdoc IPairManagerFactory\n function createPairManager(address _pool) external override returns (address _pairManager) {\n if (pairManagers[_pool] != address(0)) revert AlreadyInitialized();\n _pairManager = address(new UniV3PairManager(_pool, governance));\n pairManagers[_pool] = _pairManager;\n emit PairCreated(_pool, _pairManager);\n }\n}\n" - }, - "solidity/for-test/peripherals/GovernableForTest.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../../contracts/peripherals/Governable.sol';\n\ncontract GovernableForTest is Governable {\n constructor(address _governor) Governable(_governor) {}\n}\n" - }, - "solidity/for-test/ERC20ForTest.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.0 <0.9.0;\n\nimport '@openzeppelin/contracts/token/ERC20/ERC20.sol';\n\ncontract ERC20ForTest is ERC20 {\n constructor(\n string memory _name,\n string memory _symbol,\n address _initialAccount,\n uint256 _initialBalance\n ) ERC20(_name, _symbol) {\n _mint(_initialAccount, _initialBalance);\n }\n\n function mint(address _account, uint256 _amount) public {\n _mint(_account, _amount);\n }\n\n function burn(address _account, uint256 _amount) public {\n _burn(_account, _amount);\n }\n\n function transferInternal(\n address _from,\n address _to,\n uint256 _value\n ) public {\n _transfer(_from, _to, _value);\n }\n\n function approveInternal(\n address _owner,\n address _spender,\n uint256 _value\n ) public {\n _approve(_owner, _spender, _value);\n }\n\n function deposit(uint256 _amount) external payable {\n // Function added for compatibility with WETH\n }\n}\n" - }, - "solidity/for-test/peripherals/keepers/Keep3rKeeperFundableForTest.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../../../contracts/peripherals/keepers/Keep3rKeeperFundable.sol';\n\ncontract Keep3rKeeperFundableForTest is Keep3rKeeperFundable {\n using EnumerableSet for EnumerableSet.AddressSet;\n\n constructor(\n address _kph,\n address _keep3rV1,\n address _keep3rV1Proxy,\n address _kp3rWethPool\n ) Keep3rParameters(_kph, _keep3rV1, _keep3rV1Proxy, _kp3rWethPool) Keep3rRoles(msg.sender) {}\n\n function isKeeper(address _keeper) external view returns (bool) {\n return _keepers.contains(_keeper);\n }\n\n function setJob(address job) external {\n _jobs.add(job);\n }\n}\n" - }, - "solidity/for-test/peripherals/jobs/Keep3rJobWorkableForTest.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../../../contracts/peripherals/jobs/Keep3rJobWorkable.sol';\n\ncontract Keep3rJobWorkableForTest is Keep3rJobWorkable {\n using EnumerableSet for EnumerableSet.AddressSet;\n\n constructor(\n address _keep3rHelper,\n address _keep3rV1,\n address _keep3rV1Proxy,\n address _kp3rWethPool\n ) Keep3rParameters(_keep3rHelper, _keep3rV1, _keep3rV1Proxy, _kp3rWethPool) Keep3rRoles(msg.sender) {}\n\n function setJob(address _job) external {\n _jobs.add(_job);\n }\n\n function setKeeper(address _keeper) external {\n _keepers.add(_keeper);\n }\n\n function setApprovedLiquidity(address _liquidity) external {\n _approvedLiquidities.add(_liquidity);\n }\n\n function setJobLiquidity(address _job, address _liquidity) external {\n _jobLiquidities[_job].add(_liquidity);\n }\n\n function viewJobLiquidityCredits(address _job) external view returns (uint256) {\n return _jobLiquidityCredits[_job];\n }\n\n function viewJobPeriodCredits(address _job) external view returns (uint256) {\n return _jobPeriodCredits[_job];\n }\n\n function viewTickCache(address _liquidity) external view returns (TickCache memory _tickCache) {\n _tickCache = _tick[_liquidity];\n }\n\n function viewGas() external view returns (uint256) {\n return _initialGas;\n }\n\n receive() external payable {}\n}\n" - }, - "solidity/for-test/peripherals/Keep3rParametersForTest.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../../contracts/peripherals/Keep3rParameters.sol';\n\ncontract Keep3rParametersForTest is Keep3rParameters {\n constructor(\n address _keep3rHelper,\n address _keep3rV1,\n address _keep3rV1Proxy,\n address _kp3rWethPool\n ) Keep3rParameters(_keep3rHelper, _keep3rV1, _keep3rV1Proxy, _kp3rWethPool) Keep3rRoles(msg.sender) {}\n\n function viewLiquidityPool(address _pool) public view returns (address) {\n return _liquidityPool[_pool];\n }\n\n function viewIsKP3RToken0(address _pool) public view returns (bool) {\n return _isKP3RToken0[_pool];\n }\n}\n" - }, - "solidity/for-test/peripherals/Keep3rDisputableForTest.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../../contracts/peripherals/Keep3rDisputable.sol';\n\ncontract Keep3rDisputableForTest is Keep3rDisputable {\n constructor() Keep3rRoles(msg.sender) {}\n}\n" - }, - "solidity/for-test/peripherals/keepers/Keep3rKeeperDisputableForTest.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../../../contracts/peripherals/keepers/Keep3rKeeperDisputable.sol';\n\ncontract Keep3rKeeperDisputableForTest is Keep3rKeeperDisputable {\n using EnumerableSet for EnumerableSet.AddressSet;\n\n constructor(\n address _kph,\n address _keep3rV1,\n address _keep3rV1Proxy,\n address _kp3rWethPool\n ) Keep3rParameters(_kph, _keep3rV1, _keep3rV1Proxy, _kp3rWethPool) Keep3rRoles(msg.sender) {}\n\n function setKeeper(address _keeper) external {\n _keepers.add(_keeper);\n }\n\n function internalSlash(\n address _bonded,\n address _keeper,\n uint256 _amount\n ) external {\n _slash(_bonded, _keeper, _amount);\n }\n\n function isKeeper(address _address) external view returns (bool _isKeeper) {\n _isKeeper = _keepers.contains(_address);\n }\n}\n" - }, - "solidity/for-test/peripherals/jobs/Keep3rJobDisputableForTest.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../../../contracts/peripherals/jobs/Keep3rJobDisputable.sol';\n\ncontract Keep3rJobDisputableForTest is Keep3rJobDisputable {\n using EnumerableSet for EnumerableSet.AddressSet;\n\n constructor(\n address _kph,\n address _keep3rV1,\n address _keep3rV1Proxy,\n address _kp3rWethPool\n ) Keep3rParameters(_kph, _keep3rV1, _keep3rV1Proxy, _kp3rWethPool) Keep3rRoles(msg.sender) {}\n\n function setJobLiquidity(address _job, address _liquidity) external {\n _jobLiquidities[_job].add(_liquidity);\n }\n\n function setJobToken(address _job, address _token) external {\n _jobTokens[_job].add(_token);\n }\n\n function setApprovedLiquidity(address _liquidity) external {\n _approvedLiquidities.add(_liquidity);\n }\n\n function setRevokedLiquidity(address _liquidity) external {\n _approvedLiquidities.remove(_liquidity);\n }\n\n function internalJobLiquidityCredits(address _job) external view returns (uint256 _credits) {\n _credits = _jobLiquidityCredits[_job];\n }\n\n function internalJobPeriodCredits(address _job) external view returns (uint256 _credits) {\n _credits = _jobPeriodCredits[_job];\n }\n\n function internalJobTokens(address _job) external view returns (address[] memory _tokens) {\n _tokens = new address[](_jobTokens[_job].length());\n for (uint256 i; i < _jobTokens[_job].length(); i++) {\n _tokens[i] = _jobTokens[_job].at(i);\n }\n }\n\n function internalJobLiquidities(address _job) external view returns (address[] memory _tokens) {\n _tokens = new address[](_jobLiquidities[_job].length());\n for (uint256 i; i < _jobLiquidities[_job].length(); i++) {\n _tokens[i] = _jobLiquidities[_job].at(i);\n }\n }\n}\n" - }, - "solidity/for-test/peripherals/jobs/Keep3rJobFundableCreditsForTest.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../../../contracts/peripherals/jobs/Keep3rJobFundableCredits.sol';\n\ncontract Keep3rJobFundableCreditsForTest is Keep3rJobFundableCredits {\n using EnumerableSet for EnumerableSet.AddressSet;\n\n constructor(\n address _kph,\n address _keep3rV1,\n address _keep3rV1Proxy,\n address _kp3rWethPool\n ) Keep3rParameters(_kph, _keep3rV1, _keep3rV1Proxy, _kp3rWethPool) Keep3rRoles(msg.sender) {}\n\n function setJob(address _job, address _jobOwner) external {\n _jobs.add(_job);\n jobOwner[_job] = _jobOwner;\n }\n\n function setJobToken(address _job, address _token) external {\n _jobTokens[_job].add(_token);\n }\n\n function isJobToken(address _job, address _token) external view returns (bool _contains) {\n _contains = _jobTokens[_job].contains(_token);\n }\n}\n" - }, - "solidity/for-test/peripherals/Keep3rAccountanceForTest.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../../contracts/peripherals/Keep3rAccountance.sol';\n\ncontract Keep3rAccountanceForTest is Keep3rAccountance {\n using EnumerableSet for EnumerableSet.AddressSet;\n\n function setJob(address job) external {\n _jobs.add(job);\n }\n\n function setKeeper(address keeper) external {\n _keepers.add(keeper);\n }\n}\n" - }, - "solidity/for-test/peripherals/jobs/Keep3rJobOwnershipForTest.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../../../contracts/peripherals/jobs/Keep3rJobOwnership.sol';\n\ncontract Keep3rJobOwnershipForTest is Keep3rJobOwnership {}\n" - }, - "solidity/for-test/libraries/LiquidityAmountsForTest.sol": { - "content": "// SPDX-License-Identifier: GPL-2.0-or-later\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../../contracts/libraries/FullMath.sol';\nimport '../../contracts/libraries/FixedPoint96.sol';\n\n/// @dev Made this library into a contract to be able to calculate liquidity more precisely for tests\n\n// solhint-disable\ncontract LiquidityAmountsForTest {\n function toUint128(uint256 x) private pure returns (uint128 y) {\n require((y = uint128(x)) == x);\n }\n\n function getLiquidityForAmount0(\n uint160 sqrtRatioAX96,\n uint160 sqrtRatioBX96,\n uint256 amount0\n ) public pure returns (uint128 liquidity) {\n if (sqrtRatioAX96 > sqrtRatioBX96) (sqrtRatioAX96, sqrtRatioBX96) = (sqrtRatioBX96, sqrtRatioAX96);\n uint256 intermediate = FullMath.mulDiv(sqrtRatioAX96, sqrtRatioBX96, FixedPoint96.Q96);\n return toUint128(FullMath.mulDiv(amount0, intermediate, sqrtRatioBX96 - sqrtRatioAX96));\n }\n\n function getLiquidityForAmount1(\n uint160 sqrtRatioAX96,\n uint160 sqrtRatioBX96,\n uint256 amount1\n ) public pure returns (uint128 liquidity) {\n if (sqrtRatioAX96 > sqrtRatioBX96) (sqrtRatioAX96, sqrtRatioBX96) = (sqrtRatioBX96, sqrtRatioAX96);\n return toUint128(FullMath.mulDiv(amount1, FixedPoint96.Q96, sqrtRatioBX96 - sqrtRatioAX96));\n }\n\n function getLiquidityForAmounts(\n uint160 sqrtRatioX96,\n uint160 sqrtRatioAX96,\n uint160 sqrtRatioBX96,\n uint256 amount0,\n uint256 amount1\n ) external pure returns (uint128 liquidity) {\n if (sqrtRatioAX96 > sqrtRatioBX96) (sqrtRatioAX96, sqrtRatioBX96) = (sqrtRatioBX96, sqrtRatioAX96);\n\n if (sqrtRatioX96 <= sqrtRatioAX96) {\n liquidity = getLiquidityForAmount0(sqrtRatioAX96, sqrtRatioBX96, amount0);\n } else if (sqrtRatioX96 < sqrtRatioBX96) {\n uint128 liquidity0 = getLiquidityForAmount0(sqrtRatioX96, sqrtRatioBX96, amount0);\n uint128 liquidity1 = getLiquidityForAmount1(sqrtRatioAX96, sqrtRatioX96, amount1);\n\n liquidity = liquidity0 < liquidity1 ? liquidity0 : liquidity1;\n } else {\n liquidity = getLiquidityForAmount1(sqrtRatioAX96, sqrtRatioBX96, amount1);\n }\n }\n\n function getAmount0ForLiquidity(\n uint160 sqrtRatioAX96,\n uint160 sqrtRatioBX96,\n uint128 liquidity\n ) public pure returns (uint256 amount0) {\n if (sqrtRatioAX96 > sqrtRatioBX96) (sqrtRatioAX96, sqrtRatioBX96) = (sqrtRatioBX96, sqrtRatioAX96);\n\n return FullMath.mulDiv(uint256(liquidity) << FixedPoint96.RESOLUTION, sqrtRatioBX96 - sqrtRatioAX96, sqrtRatioBX96) / sqrtRatioAX96;\n }\n\n function getAmount1ForLiquidity(\n uint160 sqrtRatioAX96,\n uint160 sqrtRatioBX96,\n uint128 liquidity\n ) public pure returns (uint256 amount1) {\n if (sqrtRatioAX96 > sqrtRatioBX96) (sqrtRatioAX96, sqrtRatioBX96) = (sqrtRatioBX96, sqrtRatioAX96);\n\n return FullMath.mulDiv(liquidity, sqrtRatioBX96 - sqrtRatioAX96, FixedPoint96.Q96);\n }\n\n function getAmountsForLiquidity(\n uint160 sqrtRatioX96,\n uint160 sqrtRatioAX96,\n uint160 sqrtRatioBX96,\n uint128 liquidity\n ) external pure returns (uint256 amount0, uint256 amount1) {\n if (sqrtRatioAX96 > sqrtRatioBX96) (sqrtRatioAX96, sqrtRatioBX96) = (sqrtRatioBX96, sqrtRatioAX96);\n\n if (sqrtRatioX96 <= sqrtRatioAX96) {\n amount0 = getAmount0ForLiquidity(sqrtRatioAX96, sqrtRatioBX96, liquidity);\n } else if (sqrtRatioX96 < sqrtRatioBX96) {\n amount0 = getAmount0ForLiquidity(sqrtRatioX96, sqrtRatioBX96, liquidity);\n amount1 = getAmount1ForLiquidity(sqrtRatioAX96, sqrtRatioX96, liquidity);\n } else {\n amount1 = getAmount1ForLiquidity(sqrtRatioAX96, sqrtRatioBX96, liquidity);\n }\n }\n}\n" - }, - "solidity/for-test/IUniswapV3PoolForTest.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '@uniswap/v3-core/contracts/interfaces/IERC20Minimal.sol';\nimport '@uniswap/v3-core/contracts/interfaces/IUniswapV3Pool.sol';\n\n// solhint-disable-next-line no-empty-blocks\ninterface IUniswapV3PoolForTest is IERC20Minimal, IUniswapV3Pool {\n\n}\n" - }, - "@uniswap/v3-core/contracts/interfaces/IERC20Minimal.sol": { - "content": "// SPDX-License-Identifier: GPL-2.0-or-later\npragma solidity >=0.5.0;\n\n/// @title Minimal ERC20 interface for Uniswap\n/// @notice Contains a subset of the full ERC20 interface that is used in Uniswap V3\ninterface IERC20Minimal {\n /// @notice Returns the balance of a token\n /// @param account The account for which to look up the number of tokens it has, i.e. its balance\n /// @return The number of tokens held by the account\n function balanceOf(address account) external view returns (uint256);\n\n /// @notice Transfers the amount of token from the `msg.sender` to the recipient\n /// @param recipient The account that will receive the amount transferred\n /// @param amount The number of tokens to send from the sender to the recipient\n /// @return Returns true for a successful transfer, false for an unsuccessful transfer\n function transfer(address recipient, uint256 amount) external returns (bool);\n\n /// @notice Returns the current allowance given to a spender by an owner\n /// @param owner The account of the token owner\n /// @param spender The account of the token spender\n /// @return The current allowance granted by `owner` to `spender`\n function allowance(address owner, address spender) external view returns (uint256);\n\n /// @notice Sets the allowance of a spender from the `msg.sender` to the value `amount`\n /// @param spender The account which will be allowed to spend a given amount of the owners tokens\n /// @param amount The amount of tokens allowed to be used by `spender`\n /// @return Returns true for a successful approval, false for unsuccessful\n function approve(address spender, uint256 amount) external returns (bool);\n\n /// @notice Transfers `amount` tokens from `sender` to `recipient` up to the allowance given to the `msg.sender`\n /// @param sender The account from which the transfer will be initiated\n /// @param recipient The recipient of the transfer\n /// @param amount The amount of the transfer\n /// @return Returns true for a successful transfer, false for unsuccessful\n function transferFrom(\n address sender,\n address recipient,\n uint256 amount\n ) external returns (bool);\n\n /// @notice Event emitted when tokens are transferred from one address to another, either via `#transfer` or `#transferFrom`.\n /// @param from The account from which the tokens were sent, i.e. the balance decreased\n /// @param to The account to which the tokens were sent, i.e. the balance increased\n /// @param value The amount of tokens that were transferred\n event Transfer(address indexed from, address indexed to, uint256 value);\n\n /// @notice Event emitted when the approval amount for the spender of a given owner's tokens changes.\n /// @param owner The account that approved spending of its tokens\n /// @param spender The account for which the spending allowance was modified\n /// @param value The new allowance from the owner to the spender\n event Approval(address indexed owner, address indexed spender, uint256 value);\n}\n" - } - }, - "settings": { - "optimizer": { - "enabled": true, - "runs": 50 - }, - "outputSelection": { - "*": { - "*": [ - "storageLayout", - "abi", - "evm.bytecode", - "evm.deployedBytecode", - "evm.methodIdentifiers", - "metadata", - "devdoc", - "userdoc", - "evm.gasEstimates" - ], - "": [ - "ast" - ] - } - }, - "metadata": { - "useLiteralContent": true - }, - "libraries": { - "": { - "__CACHE_BREAKER__": "0x00000000d41867734bbee4c6863d9255b2b06ac1" - } - } - } -} \ No newline at end of file diff --git a/deployments/mainnet/solcInputs/b8876691210a06f2046b37f0b14142fa.json b/deployments/mainnet/solcInputs/b8876691210a06f2046b37f0b14142fa.json deleted file mode 100644 index 1eb4b03..0000000 --- a/deployments/mainnet/solcInputs/b8876691210a06f2046b37f0b14142fa.json +++ /dev/null @@ -1,289 +0,0 @@ -{ - "language": "Solidity", - "sources": { - "solidity/contracts/Keep3r.sol": { - "content": "// SPDX-License-Identifier: MIT\n\n/*\n\nCoded for The Keep3r Network with ♥ by\n\n██████╗░███████╗███████╗██╗  ░██╗░░░░░░░██╗░█████╗░███╗░░██╗██████╗░███████╗██████╗░██╗░░░░░░█████╗░███╗░░██╗██████╗░\n██╔══██╗██╔════╝██╔════╝██║  ░██║░░██╗░░██║██╔══██╗████╗░██║██╔══██╗██╔════╝██╔══██╗██║░░░░░██╔══██╗████╗░██║██╔══██╗\n██║░░██║█████╗░░█████╗░░██║  ░╚██╗████╗██╔╝██║░░██║██╔██╗██║██║░░██║█████╗░░██████╔╝██║░░░░░███████║██╔██╗██║██║░░██║\n██║░░██║██╔══╝░░██╔══╝░░██║  ░░████╔═████║░██║░░██║██║╚████║██║░░██║██╔══╝░░██╔══██╗██║░░░░░██╔══██║██║╚████║██║░░██║\n██████╔╝███████╗██║░░░░░██║  ░░╚██╔╝░╚██╔╝░╚█████╔╝██║░╚███║██████╔╝███████╗██║░░██║███████╗██║░░██║██║░╚███║██████╔╝\n╚═════╝░╚══════╝╚═╝░░░░░╚═╝  ░░░╚═╝░░░╚═╝░░░╚════╝░╚═╝░░╚══╝╚═════╝░╚══════╝╚═╝░░╚═╝╚══════╝╚═╝░░╚═╝╚═╝░░╚══╝╚═════╝░\n\nhttps://defi.sucks\n\n*/\n\npragma solidity >=0.8.4 <0.9.0;\n\nimport './peripherals/jobs/Keep3rJobs.sol';\nimport './peripherals/keepers/Keep3rKeepers.sol';\nimport './peripherals/Keep3rAccountance.sol';\nimport './peripherals/Keep3rRoles.sol';\nimport './peripherals/Keep3rParameters.sol';\nimport './peripherals/DustCollector.sol';\n\ncontract Keep3r is DustCollector, Keep3rJobs, Keep3rKeepers {\n constructor(\n address _governance,\n address _keep3rHelper,\n address _keep3rV1,\n address _keep3rV1Proxy,\n address _kp3rWethPool\n ) Keep3rParameters(_keep3rHelper, _keep3rV1, _keep3rV1Proxy, _kp3rWethPool) Keep3rRoles(_governance) DustCollector() {}\n}\n" - }, - "solidity/contracts/peripherals/jobs/Keep3rJobs.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport './Keep3rJobDisputable.sol';\nimport './Keep3rJobWorkable.sol';\nimport './Keep3rJobManager.sol';\n\nabstract contract Keep3rJobs is Keep3rJobDisputable, Keep3rJobManager, Keep3rJobWorkable {}\n" - }, - "solidity/contracts/peripherals/keepers/Keep3rKeepers.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport './Keep3rKeeperDisputable.sol';\n\nabstract contract Keep3rKeepers is Keep3rKeeperDisputable {}\n" - }, - "solidity/contracts/peripherals/Keep3rAccountance.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '@openzeppelin/contracts/utils/structs/EnumerableSet.sol';\nimport '../../interfaces/peripherals/IKeep3rAccountance.sol';\n\nabstract contract Keep3rAccountance is IKeep3rAccountance {\n using EnumerableSet for EnumerableSet.AddressSet;\n\n /// @notice List of all enabled keepers\n EnumerableSet.AddressSet internal _keepers;\n\n /// @inheritdoc IKeep3rAccountance\n mapping(address => uint256) public override workCompleted;\n\n /// @inheritdoc IKeep3rAccountance\n mapping(address => uint256) public override firstSeen;\n\n /// @inheritdoc IKeep3rAccountance\n mapping(address => bool) public override disputes;\n\n /// @inheritdoc IKeep3rAccountance\n /// @notice Mapping (job => bonding => amount)\n mapping(address => mapping(address => uint256)) public override bonds;\n\n /// @inheritdoc IKeep3rAccountance\n mapping(address => mapping(address => uint256)) public override jobTokenCredits;\n\n /// @notice The current liquidity credits available for a job\n mapping(address => uint256) internal _jobLiquidityCredits;\n\n /// @notice Map the address of a job to its correspondent periodCredits\n mapping(address => uint256) internal _jobPeriodCredits;\n\n /// @notice Enumerable array of Job Tokens for Credits\n mapping(address => EnumerableSet.AddressSet) internal _jobTokens;\n\n /// @notice List of liquidities that a job has (job => liquidities)\n mapping(address => EnumerableSet.AddressSet) internal _jobLiquidities;\n\n /// @notice Liquidity pool to observe\n mapping(address => address) internal _liquidityPool;\n\n /// @notice Tracks if a pool has KP3R as token0\n mapping(address => bool) internal _isKP3RToken0;\n\n /// @inheritdoc IKeep3rAccountance\n mapping(address => mapping(address => uint256)) public override pendingBonds;\n\n /// @inheritdoc IKeep3rAccountance\n mapping(address => mapping(address => uint256)) public override canActivateAfter;\n\n /// @inheritdoc IKeep3rAccountance\n mapping(address => mapping(address => uint256)) public override canWithdrawAfter;\n\n /// @inheritdoc IKeep3rAccountance\n mapping(address => mapping(address => uint256)) public override pendingUnbonds;\n\n /// @inheritdoc IKeep3rAccountance\n mapping(address => bool) public override hasBonded;\n\n /// @notice List of all enabled jobs\n EnumerableSet.AddressSet internal _jobs;\n\n /// @inheritdoc IKeep3rAccountance\n function jobs() external view override returns (address[] memory _list) {\n _list = _jobs.values();\n }\n\n /// @inheritdoc IKeep3rAccountance\n function keepers() external view override returns (address[] memory _list) {\n _list = _keepers.values();\n }\n}\n" - }, - "solidity/contracts/peripherals/Keep3rRoles.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../../interfaces/peripherals/IKeep3rRoles.sol';\nimport '@openzeppelin/contracts/utils/structs/EnumerableSet.sol';\nimport './Governable.sol';\n\ncontract Keep3rRoles is IKeep3rRoles, Governable {\n /// @inheritdoc IKeep3rRoles\n mapping(address => bool) public override slashers;\n\n /// @inheritdoc IKeep3rRoles\n mapping(address => bool) public override disputers;\n\n constructor(address _governance) Governable(_governance) {}\n\n /// @inheritdoc IKeep3rRoles\n function addSlasher(address _slasher) external override onlyGovernance {\n if (slashers[_slasher]) revert SlasherExistent();\n slashers[_slasher] = true;\n emit SlasherAdded(_slasher);\n }\n\n /// @inheritdoc IKeep3rRoles\n function removeSlasher(address _slasher) external override onlyGovernance {\n if (!slashers[_slasher]) revert SlasherUnexistent();\n delete slashers[_slasher];\n emit SlasherRemoved(_slasher);\n }\n\n /// @inheritdoc IKeep3rRoles\n function addDisputer(address _disputer) external override onlyGovernance {\n if (disputers[_disputer]) revert DisputerExistent();\n disputers[_disputer] = true;\n emit DisputerAdded(_disputer);\n }\n\n /// @inheritdoc IKeep3rRoles\n function removeDisputer(address _disputer) external override onlyGovernance {\n if (!disputers[_disputer]) revert DisputerUnexistent();\n delete disputers[_disputer];\n emit DisputerRemoved(_disputer);\n }\n\n /// @notice Functions with this modifier can only be called by either a slasher or governance\n modifier onlySlasher {\n if (!slashers[msg.sender]) revert OnlySlasher();\n _;\n }\n\n /// @notice Functions with this modifier can only be called by either a disputer or governance\n modifier onlyDisputer {\n if (!disputers[msg.sender]) revert OnlyDisputer();\n _;\n }\n}\n" - }, - "solidity/contracts/peripherals/Keep3rParameters.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../../interfaces/IKeep3rHelper.sol';\nimport '../../interfaces/peripherals/IKeep3rParameters.sol';\nimport './Keep3rAccountance.sol';\nimport './Keep3rRoles.sol';\n\nabstract contract Keep3rParameters is IKeep3rParameters, Keep3rAccountance, Keep3rRoles {\n /// @inheritdoc IKeep3rParameters\n address public override keep3rV1;\n\n /// @inheritdoc IKeep3rParameters\n address public override keep3rV1Proxy;\n\n /// @inheritdoc IKeep3rParameters\n address public override keep3rHelper;\n\n /// @inheritdoc IKeep3rParameters\n address public override kp3rWethPool;\n\n /// @inheritdoc IKeep3rParameters\n uint256 public override bondTime = 3 days;\n\n /// @inheritdoc IKeep3rParameters\n uint256 public override unbondTime = 14 days;\n\n /// @inheritdoc IKeep3rParameters\n uint256 public override liquidityMinimum = 3 ether;\n\n /// @inheritdoc IKeep3rParameters\n uint256 public override rewardPeriodTime = 5 days;\n\n /// @inheritdoc IKeep3rParameters\n uint256 public override inflationPeriod = 34 days;\n\n /// @inheritdoc IKeep3rParameters\n uint256 public override fee = 30;\n\n /// @notice The base that will be used to calculate the fee\n uint256 internal constant _BASE = 10_000;\n\n /// @notice The minimum reward period\n uint256 internal constant _MIN_REWARD_PERIOD_TIME = 1 days;\n\n constructor(\n address _keep3rHelper,\n address _keep3rV1,\n address _keep3rV1Proxy,\n address _kp3rWethPool\n ) {\n keep3rHelper = _keep3rHelper;\n keep3rV1 = _keep3rV1;\n keep3rV1Proxy = _keep3rV1Proxy;\n kp3rWethPool = _kp3rWethPool;\n _liquidityPool[kp3rWethPool] = kp3rWethPool;\n _isKP3RToken0[_kp3rWethPool] = IKeep3rHelper(keep3rHelper).isKP3RToken0(kp3rWethPool);\n }\n\n /// @inheritdoc IKeep3rParameters\n function setKeep3rHelper(address _keep3rHelper) external override onlyGovernance {\n if (_keep3rHelper == address(0)) revert ZeroAddress();\n keep3rHelper = _keep3rHelper;\n emit Keep3rHelperChange(_keep3rHelper);\n }\n\n /// @inheritdoc IKeep3rParameters\n function setKeep3rV1(address _keep3rV1) external override onlyGovernance {\n if (_keep3rV1 == address(0)) revert ZeroAddress();\n keep3rV1 = _keep3rV1;\n emit Keep3rV1Change(_keep3rV1);\n }\n\n /// @inheritdoc IKeep3rParameters\n function setKeep3rV1Proxy(address _keep3rV1Proxy) external override onlyGovernance {\n if (_keep3rV1Proxy == address(0)) revert ZeroAddress();\n keep3rV1Proxy = _keep3rV1Proxy;\n emit Keep3rV1ProxyChange(_keep3rV1Proxy);\n }\n\n /// @inheritdoc IKeep3rParameters\n function setKp3rWethPool(address _kp3rWethPool) external override onlyGovernance {\n if (_kp3rWethPool == address(0)) revert ZeroAddress();\n kp3rWethPool = _kp3rWethPool;\n _liquidityPool[kp3rWethPool] = kp3rWethPool;\n _isKP3RToken0[_kp3rWethPool] = IKeep3rHelper(keep3rHelper).isKP3RToken0(_kp3rWethPool);\n emit Kp3rWethPoolChange(_kp3rWethPool);\n }\n\n /// @inheritdoc IKeep3rParameters\n function setBondTime(uint256 _bondTime) external override onlyGovernance {\n bondTime = _bondTime;\n emit BondTimeChange(_bondTime);\n }\n\n /// @inheritdoc IKeep3rParameters\n function setUnbondTime(uint256 _unbondTime) external override onlyGovernance {\n unbondTime = _unbondTime;\n emit UnbondTimeChange(_unbondTime);\n }\n\n /// @inheritdoc IKeep3rParameters\n function setLiquidityMinimum(uint256 _liquidityMinimum) external override onlyGovernance {\n liquidityMinimum = _liquidityMinimum;\n emit LiquidityMinimumChange(_liquidityMinimum);\n }\n\n /// @inheritdoc IKeep3rParameters\n // TODO: check what happens to credit minting when changing this. Shouldn't we update the cached ticks?\n function setRewardPeriodTime(uint256 _rewardPeriodTime) external override onlyGovernance {\n if (_rewardPeriodTime < _MIN_REWARD_PERIOD_TIME) revert MinRewardPeriod();\n rewardPeriodTime = _rewardPeriodTime;\n emit RewardPeriodTimeChange(_rewardPeriodTime);\n }\n\n /// @inheritdoc IKeep3rParameters\n function setInflationPeriod(uint256 _inflationPeriod) external override onlyGovernance {\n inflationPeriod = _inflationPeriod;\n emit InflationPeriodChange(_inflationPeriod);\n }\n\n /// @inheritdoc IKeep3rParameters\n function setFee(uint256 _fee) external override onlyGovernance {\n fee = _fee;\n emit FeeChange(_fee);\n }\n}\n" - }, - "solidity/contracts/peripherals/DustCollector.sol": { - "content": "// SPDX-License-Identifier: MIT\n\npragma solidity >=0.8.4 <0.9.0;\n\nimport '@openzeppelin/contracts/token/ERC20/IERC20.sol';\nimport '@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol';\nimport '../../contracts/peripherals/Governable.sol';\nimport '../../interfaces/peripherals/IDustCollector.sol';\n\nabstract contract DustCollector is IDustCollector, Governable {\n using SafeERC20 for IERC20;\n\n address internal constant _ETH_ADDRESS = 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE;\n\n function sendDust(\n address _token,\n uint256 _amount,\n address _to\n ) external override onlyGovernance {\n if (_to == address(0)) revert ZeroAddress();\n if (_token == _ETH_ADDRESS) {\n payable(_to).transfer(_amount);\n } else {\n IERC20(_token).safeTransfer(_to, _amount);\n }\n emit DustSent(_token, _amount, _to);\n }\n}\n" - }, - "solidity/contracts/peripherals/jobs/Keep3rJobDisputable.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport './Keep3rJobFundableCredits.sol';\nimport './Keep3rJobFundableLiquidity.sol';\nimport '../Keep3rDisputable.sol';\n\nabstract contract Keep3rJobDisputable is IKeep3rJobDisputable, Keep3rDisputable, Keep3rJobFundableCredits, Keep3rJobFundableLiquidity {\n using EnumerableSet for EnumerableSet.AddressSet;\n using SafeERC20 for IERC20;\n\n /// @inheritdoc IKeep3rJobDisputable\n function slashTokenFromJob(\n address _job,\n address _token,\n uint256 _amount\n ) external override onlySlasher {\n if (!disputes[_job]) revert NotDisputed();\n if (!_jobTokens[_job].contains(_token)) revert JobTokenUnexistent();\n if (jobTokenCredits[_job][_token] < _amount) revert JobTokenInsufficient();\n\n try IERC20(_token).transfer(governance, _amount) {} catch {}\n jobTokenCredits[_job][_token] -= _amount;\n if (jobTokenCredits[_job][_token] == 0) {\n _jobTokens[_job].remove(_token);\n }\n\n emit JobSlashToken(_job, _token, msg.sender, _amount);\n }\n\n /// @inheritdoc IKeep3rJobDisputable\n function slashLiquidityFromJob(\n address _job,\n address _liquidity,\n uint256 _amount\n ) external override onlySlasher {\n if (!disputes[_job]) revert NotDisputed();\n\n _unbondLiquidityFromJob(_job, _liquidity, _amount);\n try IERC20(_liquidity).transfer(governance, _amount) {} catch {}\n emit JobSlashLiquidity(_job, _liquidity, msg.sender, _amount);\n }\n}\n" - }, - "solidity/contracts/peripherals/jobs/Keep3rJobWorkable.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport './Keep3rJobMigration.sol';\nimport '../../../interfaces/IKeep3rHelper.sol';\nimport '../../../interfaces/peripherals/IKeep3rJobs.sol';\n\nimport '@openzeppelin/contracts/token/ERC20/IERC20.sol';\nimport '@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol';\n\nabstract contract Keep3rJobWorkable is IKeep3rJobWorkable, Keep3rJobMigration {\n using EnumerableSet for EnumerableSet.AddressSet;\n using SafeERC20 for IERC20;\n\n uint256 internal _initialGas;\n\n /// @inheritdoc IKeep3rJobWorkable\n function isKeeper(address _keeper) external override returns (bool _isKeeper) {\n _initialGas = _getGasLeft();\n if (_keepers.contains(_keeper)) {\n emit KeeperValidation(_initialGas);\n return true;\n }\n }\n\n /// @inheritdoc IKeep3rJobWorkable\n function isBondedKeeper(\n address _keeper,\n address _bond,\n uint256 _minBond,\n uint256 _earned,\n uint256 _age\n ) public override returns (bool _isBondedKeeper) {\n _initialGas = _getGasLeft();\n if (\n _keepers.contains(_keeper) &&\n bonds[_keeper][_bond] >= _minBond &&\n workCompleted[_keeper] >= _earned &&\n block.timestamp - firstSeen[_keeper] >= _age\n ) {\n emit KeeperValidation(_initialGas);\n return true;\n }\n }\n\n /// @inheritdoc IKeep3rJobWorkable\n function worked(address _keeper) external override {\n address _job = msg.sender;\n if (disputes[_job]) revert JobDisputed();\n if (!_jobs.contains(_job)) revert JobUnapproved();\n\n if (_updateJobCreditsIfNeeded(_job)) {\n emit LiquidityCreditsReward(_job, rewardedAt[_job], _jobLiquidityCredits[_job], _jobPeriodCredits[_job]);\n }\n\n (uint256 _boost, uint256 _oneEthQuote, uint256 _extraGas) = IKeep3rHelper(keep3rHelper).getPaymentParams(bonds[_keeper][keep3rV1]);\n\n uint256 _gasLeft = _getGasLeft();\n uint256 _payment = _calculatePayment(_gasLeft, _extraGas, _oneEthQuote, _boost);\n\n if (_payment > _jobLiquidityCredits[_job]) {\n _rewardJobCredits(_job);\n emit LiquidityCreditsReward(_job, rewardedAt[_job], _jobLiquidityCredits[_job], _jobPeriodCredits[_job]);\n\n _gasLeft = _getGasLeft();\n _payment = _calculatePayment(_gasLeft, _extraGas, _oneEthQuote, _boost);\n }\n\n _bondedPayment(_job, _keeper, _payment);\n emit KeeperWork(keep3rV1, _job, _keeper, _payment, _gasLeft);\n }\n\n /// @inheritdoc IKeep3rJobWorkable\n function bondedPayment(address _keeper, uint256 _payment) public override {\n address _job = msg.sender;\n\n if (disputes[_job]) revert JobDisputed();\n if (!_jobs.contains(_job)) revert JobUnapproved();\n\n if (_updateJobCreditsIfNeeded(_job)) {\n emit LiquidityCreditsReward(_job, rewardedAt[_job], _jobLiquidityCredits[_job], _jobPeriodCredits[_job]);\n }\n\n if (_payment > _jobLiquidityCredits[_job]) {\n _rewardJobCredits(_job);\n emit LiquidityCreditsReward(_job, rewardedAt[_job], _jobLiquidityCredits[_job], _jobPeriodCredits[_job]);\n }\n\n _bondedPayment(_job, _keeper, _payment);\n emit KeeperWork(keep3rV1, _job, _keeper, _payment, _getGasLeft());\n }\n\n /// @inheritdoc IKeep3rJobWorkable\n function directTokenPayment(\n address _token,\n address _keeper,\n uint256 _amount\n ) external override {\n address _job = msg.sender;\n\n if (disputes[_job]) revert JobDisputed();\n if (disputes[_keeper]) revert Disputed();\n if (!_jobs.contains(_job)) revert JobUnapproved();\n if (jobTokenCredits[_job][_token] < _amount) revert InsufficientFunds();\n jobTokenCredits[_job][_token] -= _amount;\n IERC20(_token).safeTransfer(_keeper, _amount);\n emit KeeperWork(_token, _job, _keeper, _amount, _getGasLeft());\n }\n\n function _bondedPayment(\n address _job,\n address _keeper,\n uint256 _payment\n ) internal {\n if (_payment > _jobLiquidityCredits[_job]) revert InsufficientFunds();\n\n workedAt[_job] = block.timestamp;\n _jobLiquidityCredits[_job] -= _payment;\n bonds[_keeper][keep3rV1] += _payment;\n workCompleted[_keeper] += _payment;\n }\n\n /// @notice Calculate amount to be payed in KP3R, taking into account multiple parameters\n /// @param _gasLeft Amount of gas left after working the job\n /// @param _extraGas Amount of expected unaccounted gas\n /// @param _oneEthQuote Amount of KP3R equivalent to 1 ETH\n /// @param _boost Reward given to the keeper for having bonded KP3R tokens\n /// @return _payment Amount to be payed in KP3R tokens\n function _calculatePayment(\n uint256 _gasLeft,\n uint256 _extraGas,\n uint256 _oneEthQuote,\n uint256 _boost\n ) internal view returns (uint256 _payment) {\n uint256 _accountedGas = _initialGas - _gasLeft + _extraGas;\n _payment = (((_accountedGas * _boost) / _BASE) * _oneEthQuote) / 1 ether;\n }\n\n /// @notice Return the gas left and add 1/64 in order to match real gas left at first level of depth (EIP-150)\n /// @return _gasLeft Amount of gas left recording taking into account EIP-150\n function _getGasLeft() internal view returns (uint256 _gasLeft) {\n _gasLeft = (gasleft() * 64) / 63;\n }\n}\n" - }, - "solidity/contracts/peripherals/jobs/Keep3rJobManager.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport './Keep3rJobOwnership.sol';\nimport '../Keep3rRoles.sol';\nimport '../Keep3rParameters.sol';\nimport '../../../interfaces/peripherals/IKeep3rJobs.sol';\n\nabstract contract Keep3rJobManager is IKeep3rJobManager, Keep3rJobOwnership, Keep3rRoles, Keep3rParameters {\n using EnumerableSet for EnumerableSet.AddressSet;\n\n /// @inheritdoc IKeep3rJobManager\n function addJob(address _job) external override {\n if (_jobs.contains(_job)) revert JobAlreadyAdded();\n if (hasBonded[_job]) revert AlreadyAKeeper();\n _jobs.add(_job);\n jobOwner[_job] = msg.sender;\n emit JobAddition(msg.sender, _job);\n }\n}\n" - }, - "solidity/contracts/peripherals/jobs/Keep3rJobFundableCredits.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport './Keep3rJobOwnership.sol';\nimport '../Keep3rAccountance.sol';\nimport '../Keep3rParameters.sol';\nimport '../../../interfaces/peripherals/IKeep3rJobs.sol';\n\nimport '@openzeppelin/contracts/security/ReentrancyGuard.sol';\nimport '@openzeppelin/contracts/token/ERC20/IERC20.sol';\nimport '@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol';\nimport '@openzeppelin/contracts/utils/math/Math.sol';\n\nabstract contract Keep3rJobFundableCredits is IKeep3rJobFundableCredits, ReentrancyGuard, Keep3rJobOwnership, Keep3rParameters {\n using EnumerableSet for EnumerableSet.AddressSet;\n using SafeERC20 for IERC20;\n\n /// @notice Cooldown between withdrawals\n uint256 internal constant _WITHDRAW_TOKENS_COOLDOWN = 1 minutes;\n\n /// @inheritdoc IKeep3rJobFundableCredits\n mapping(address => mapping(address => uint256)) public override jobTokenCreditsAddedAt;\n\n /// @inheritdoc IKeep3rJobFundableCredits\n function addTokenCreditsToJob(\n address _job,\n address _token,\n uint256 _amount\n ) external override nonReentrant {\n if (!_jobs.contains(_job)) revert JobUnavailable();\n // KP3R shouldn't be used for direct token payments\n if (_token == keep3rV1) revert TokenUnallowed();\n uint256 _before = IERC20(_token).balanceOf(address(this));\n IERC20(_token).safeTransferFrom(msg.sender, address(this), _amount);\n uint256 _received = IERC20(_token).balanceOf(address(this)) - _before;\n uint256 _tokenFee = (_received * fee) / _BASE;\n jobTokenCredits[_job][_token] += _received - _tokenFee;\n jobTokenCreditsAddedAt[_job][_token] = block.timestamp;\n IERC20(_token).safeTransfer(governance, _tokenFee);\n _jobTokens[_job].add(_token);\n\n emit TokenCreditAddition(_job, _token, msg.sender, _received);\n }\n\n /// @inheritdoc IKeep3rJobFundableCredits\n function withdrawTokenCreditsFromJob(\n address _job,\n address _token,\n uint256 _amount,\n address _receiver\n ) external override nonReentrant onlyJobOwner(_job) {\n if (block.timestamp <= jobTokenCreditsAddedAt[_job][_token] + _WITHDRAW_TOKENS_COOLDOWN) revert JobTokenCreditsLocked();\n if (jobTokenCredits[_job][_token] < _amount) revert InsufficientJobTokenCredits();\n if (disputes[_job]) revert JobDisputed();\n\n jobTokenCredits[_job][_token] -= _amount;\n IERC20(_token).safeTransfer(_receiver, _amount);\n\n if (jobTokenCredits[_job][_token] == 0) {\n _jobTokens[_job].remove(_token);\n }\n\n emit TokenCreditWithdrawal(_job, _token, _receiver, _amount);\n }\n}\n" - }, - "solidity/contracts/peripherals/jobs/Keep3rJobFundableLiquidity.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport './Keep3rJobOwnership.sol';\nimport '../Keep3rAccountance.sol';\nimport '../Keep3rParameters.sol';\nimport '../../../interfaces/IPairManager.sol';\nimport '../../../interfaces/peripherals/IKeep3rJobs.sol';\n\nimport '../../libraries/FullMath.sol';\n\nimport '@openzeppelin/contracts/security/ReentrancyGuard.sol';\nimport '@openzeppelin/contracts/token/ERC20/IERC20.sol';\nimport '@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol';\nimport '@openzeppelin/contracts/utils/math/Math.sol';\n\nabstract contract Keep3rJobFundableLiquidity is IKeep3rJobFundableLiquidity, ReentrancyGuard, Keep3rJobOwnership, Keep3rParameters {\n using EnumerableSet for EnumerableSet.AddressSet;\n using SafeERC20 for IERC20;\n\n /// @notice List of liquidities that are accepted in the system\n EnumerableSet.AddressSet internal _approvedLiquidities;\n\n /// @inheritdoc IKeep3rJobFundableLiquidity\n mapping(address => mapping(address => uint256)) public override liquidityAmount;\n\n /// @inheritdoc IKeep3rJobFundableLiquidity\n mapping(address => uint256) public override rewardedAt;\n\n /// @inheritdoc IKeep3rJobFundableLiquidity\n mapping(address => uint256) public override workedAt;\n\n /// @notice Tracks an address and returns its TickCache\n mapping(address => TickCache) internal _tick;\n\n // Views\n\n /// @inheritdoc IKeep3rJobFundableLiquidity\n function approvedLiquidities() external view override returns (address[] memory _list) {\n _list = _approvedLiquidities.values();\n }\n\n /// @inheritdoc IKeep3rJobFundableLiquidity\n function jobPeriodCredits(address _job) public view override returns (uint256 _periodCredits) {\n for (uint256 i; i < _jobLiquidities[_job].length(); i++) {\n address _liquidity = _jobLiquidities[_job].at(i);\n if (_approvedLiquidities.contains(_liquidity)) {\n TickCache memory _tickCache = observeLiquidity(_liquidity);\n if (_tickCache.period != 0) {\n int56 _tickDifference = _isKP3RToken0[_liquidity] ? _tickCache.difference : -_tickCache.difference;\n _periodCredits += _getReward(\n IKeep3rHelper(keep3rHelper).getKP3RsAtTick(liquidityAmount[_job][_liquidity], _tickDifference, rewardPeriodTime)\n );\n }\n }\n }\n }\n\n /// @inheritdoc IKeep3rJobFundableLiquidity\n function jobLiquidityCredits(address _job) public view override returns (uint256 _liquidityCredits) {\n uint256 _periodCredits = jobPeriodCredits(_job);\n\n // If the job was rewarded in the past 1 period time\n if ((block.timestamp - rewardedAt[_job]) < rewardPeriodTime) {\n // If the job has period credits, update minted job credits to new twap\n _liquidityCredits = _periodCredits > 0\n ? (_jobLiquidityCredits[_job] * _periodCredits) / _jobPeriodCredits[_job] // If the job has period credits, return remaining job credits updated to new twap\n : _jobLiquidityCredits[_job]; // If not, return remaining credits, forced credits should not be updated\n } else {\n // Else return a full period worth of credits if current credits have expired\n _liquidityCredits = _periodCredits;\n }\n }\n\n /// @inheritdoc IKeep3rJobFundableLiquidity\n function totalJobCredits(address _job) external view override returns (uint256 _credits) {\n uint256 _periodCredits = jobPeriodCredits(_job);\n uint256 _cooldown = block.timestamp;\n\n if ((rewardedAt[_job] > _period(block.timestamp - rewardPeriodTime))) {\n // Will calculate cooldown if it outdated\n if ((block.timestamp - rewardedAt[_job]) >= rewardPeriodTime) {\n // Will calculate cooldown from last reward reference in this period\n _cooldown -= (rewardedAt[_job] + rewardPeriodTime);\n } else {\n // Will calculate cooldown from last reward timestamp\n _cooldown -= rewardedAt[_job];\n }\n } else {\n // Will calculate cooldown from period start if expired\n _cooldown -= _period(block.timestamp);\n }\n _credits = jobLiquidityCredits(_job) + _phase(_cooldown, _periodCredits);\n }\n\n /// @inheritdoc IKeep3rJobFundableLiquidity\n function quoteLiquidity(address _liquidity, uint256 _amount) external view override returns (uint256 _periodCredits) {\n if (_approvedLiquidities.contains(_liquidity)) {\n TickCache memory _tickCache = observeLiquidity(_liquidity);\n if (_tickCache.period != 0) {\n int56 _tickDifference = _isKP3RToken0[_liquidity] ? _tickCache.difference : -_tickCache.difference;\n return _getReward(IKeep3rHelper(keep3rHelper).getKP3RsAtTick(_amount, _tickDifference, rewardPeriodTime));\n }\n }\n }\n\n /// @inheritdoc IKeep3rJobFundableLiquidity\n function observeLiquidity(address _liquidity) public view override returns (TickCache memory _tickCache) {\n if (_tick[_liquidity].period == _period(block.timestamp)) {\n // Will return cached twaps if liquidity is updated\n _tickCache = _tick[_liquidity];\n } else {\n bool success;\n uint256 lastPeriod = _period(block.timestamp - rewardPeriodTime);\n\n if (_tick[_liquidity].period == lastPeriod) {\n // Will only ask for current period accumulator if liquidity is outdated\n uint32[] memory _secondsAgo = new uint32[](1);\n int56 previousTick = _tick[_liquidity].current;\n\n _secondsAgo[0] = uint32(block.timestamp - _period(block.timestamp));\n\n (_tickCache.current, , success) = IKeep3rHelper(keep3rHelper).observe(_liquidityPool[_liquidity], _secondsAgo);\n\n _tickCache.difference = _tickCache.current - previousTick;\n } else if (_tick[_liquidity].period < lastPeriod) {\n // Will ask for 2 accumulators if liquidity is expired\n uint32[] memory _secondsAgo = new uint32[](2);\n\n _secondsAgo[0] = uint32(block.timestamp - _period(block.timestamp));\n _secondsAgo[1] = uint32(block.timestamp - _period(block.timestamp) + rewardPeriodTime);\n\n int56 _tickCumulative2;\n (_tickCache.current, _tickCumulative2, success) = IKeep3rHelper(keep3rHelper).observe(_liquidityPool[_liquidity], _secondsAgo);\n\n _tickCache.difference = _tickCache.current - _tickCumulative2;\n }\n if (success) {\n _tickCache.period = _period(block.timestamp);\n } else {\n delete _tickCache.period;\n }\n }\n }\n\n // Methods\n\n /// @inheritdoc IKeep3rJobFundableLiquidity\n function forceLiquidityCreditsToJob(address _job, uint256 _amount) external override onlyGovernance {\n if (!_jobs.contains(_job)) revert JobUnavailable();\n _settleJobAccountance(_job);\n _jobLiquidityCredits[_job] += _amount;\n emit LiquidityCreditsForced(_job, rewardedAt[_job], _jobLiquidityCredits[_job]);\n }\n\n /// @inheritdoc IKeep3rJobFundableLiquidity\n function approveLiquidity(address _liquidity) external override onlyGovernance {\n if (!_approvedLiquidities.add(_liquidity)) revert LiquidityPairApproved();\n _liquidityPool[_liquidity] = IPairManager(_liquidity).pool();\n _isKP3RToken0[_liquidity] = IKeep3rHelper(keep3rHelper).isKP3RToken0(_liquidityPool[_liquidity]);\n _tick[_liquidity] = observeLiquidity(_liquidity);\n emit LiquidityApproval(_liquidity);\n }\n\n /// @inheritdoc IKeep3rJobFundableLiquidity\n function revokeLiquidity(address _liquidity) external override onlyGovernance {\n if (!_approvedLiquidities.remove(_liquidity)) revert LiquidityPairUnexistent();\n emit LiquidityRevocation(_liquidity);\n }\n\n /// @inheritdoc IKeep3rJobFundableLiquidity\n function addLiquidityToJob(\n address _job,\n address _liquidity,\n uint256 _amount\n ) external override nonReentrant {\n if (!_approvedLiquidities.contains(_liquidity)) revert LiquidityPairUnapproved();\n if (!_jobs.contains(_job)) revert JobUnavailable();\n\n _jobLiquidities[_job].add(_liquidity);\n\n _settleJobAccountance(_job);\n\n if (_quoteLiquidity(liquidityAmount[_job][_liquidity] + _amount, _liquidity) < liquidityMinimum) revert JobLiquidityLessThanMin();\n\n emit LiquidityCreditsReward(_job, rewardedAt[_job], _jobLiquidityCredits[_job], _jobPeriodCredits[_job]);\n\n IERC20(_liquidity).safeTransferFrom(msg.sender, address(this), _amount);\n liquidityAmount[_job][_liquidity] += _amount;\n _jobPeriodCredits[_job] += _getReward(_quoteLiquidity(_amount, _liquidity));\n emit LiquidityAddition(_job, _liquidity, msg.sender, _amount);\n }\n\n /// @inheritdoc IKeep3rJobFundableLiquidity\n function unbondLiquidityFromJob(\n address _job,\n address _liquidity,\n uint256 _amount\n ) external override onlyJobOwner(_job) {\n canWithdrawAfter[_job][_liquidity] = block.timestamp + unbondTime;\n pendingUnbonds[_job][_liquidity] += _amount;\n _unbondLiquidityFromJob(_job, _liquidity, _amount);\n\n uint256 _remainingLiquidity = liquidityAmount[_job][_liquidity];\n if (_remainingLiquidity > 0 && _quoteLiquidity(_remainingLiquidity, _liquidity) < liquidityMinimum) revert JobLiquidityLessThanMin();\n\n emit Unbonding(_job, _liquidity, _amount);\n }\n\n /// @inheritdoc IKeep3rJobFundableLiquidity\n function withdrawLiquidityFromJob(\n address _job,\n address _liquidity,\n address _receiver\n ) external override onlyJobOwner(_job) {\n if (_receiver == address(0)) revert ZeroAddress();\n if (pendingUnbonds[_job][_liquidity] == 0) revert UnbondsUnexistent();\n if (canWithdrawAfter[_job][_liquidity] >= block.timestamp) revert UnbondsLocked();\n if (disputes[_job]) revert Disputed();\n\n uint256 _amount = pendingUnbonds[_job][_liquidity];\n\n delete pendingUnbonds[_job][_liquidity];\n delete canWithdrawAfter[_job][_liquidity];\n\n IERC20(_liquidity).safeTransfer(_receiver, _amount);\n emit LiquidityWithdrawal(_job, _liquidity, _receiver, _amount);\n }\n\n // Internal functions\n\n /// @notice Updates or rewards job liquidity credits depending on time since last job reward\n function _updateJobCreditsIfNeeded(address _job) internal returns (bool _rewarded) {\n if (rewardedAt[_job] < _period(block.timestamp)) {\n // Will exit function if job has been rewarded in current period\n if (rewardedAt[_job] <= _period(block.timestamp - rewardPeriodTime)) {\n // Will reset job to period syncronicity if a full period passed without rewards\n _updateJobPeriod(_job);\n _jobLiquidityCredits[_job] = _jobPeriodCredits[_job];\n rewardedAt[_job] = _period(block.timestamp);\n _rewarded = true;\n } else if ((block.timestamp - rewardedAt[_job]) >= rewardPeriodTime) {\n // Will reset job's syncronicity if last reward was more than epoch ago\n _updateJobPeriod(_job);\n _jobLiquidityCredits[_job] = _jobPeriodCredits[_job];\n rewardedAt[_job] += rewardPeriodTime;\n _rewarded = true;\n } else if (workedAt[_job] < _period(block.timestamp)) {\n // First keeper on period has to update job accountance to current twaps\n uint256 previousPeriodCredits = _jobPeriodCredits[_job];\n _updateJobPeriod(_job);\n _jobLiquidityCredits[_job] = (_jobLiquidityCredits[_job] * _jobPeriodCredits[_job]) / previousPeriodCredits;\n // Updating job accountance does not reward job\n }\n }\n }\n\n /// @notice Only called if _jobLiquidityCredits < payment\n function _rewardJobCredits(address _job) internal {\n /// @notice Only way to += jobLiquidityCredits is when keeper rewarding (cannot pay work)\n /* WARNING: this allows to top up _jobLiquidityCredits to a max of 1.99 but have to spend at least 1 */\n _jobLiquidityCredits[_job] += _phase(block.timestamp - rewardedAt[_job], _jobPeriodCredits[_job]);\n rewardedAt[_job] = block.timestamp;\n }\n\n /// @notice Updates accountance for _jobPeriodCredits\n function _updateJobPeriod(address _job) internal {\n _jobPeriodCredits[_job] = _calculateJobPeriodCredits(_job);\n }\n\n /// @notice Quotes the outdated job liquidities and calculates _periodCredits\n /// @dev This function is also responsible for keeping the KP3R/WETH quote updated\n function _calculateJobPeriodCredits(address _job) internal returns (uint256 _periodCredits) {\n if (_tick[kp3rWethPool].period != _period(block.timestamp)) {\n // Updates KP3R/WETH quote if needed\n _tick[kp3rWethPool] = observeLiquidity(kp3rWethPool);\n }\n\n for (uint256 i; i < _jobLiquidities[_job].length(); i++) {\n address _liquidity = _jobLiquidities[_job].at(i);\n if (_approvedLiquidities.contains(_liquidity)) {\n if (_tick[_liquidity].period != _period(block.timestamp)) {\n // Updates liquidity cache only if needed\n _tick[_liquidity] = observeLiquidity(_liquidity);\n }\n _periodCredits += _getReward(_quoteLiquidity(liquidityAmount[_job][_liquidity], _liquidity));\n }\n }\n }\n\n /// @notice Updates job accountance calculating the impact of the unbonded liquidity amount\n function _unbondLiquidityFromJob(\n address _job,\n address _liquidity,\n uint256 _amount\n ) internal nonReentrant {\n if (!_jobLiquidities[_job].contains(_liquidity)) revert JobLiquidityUnexistent();\n if (liquidityAmount[_job][_liquidity] < _amount) revert JobLiquidityInsufficient();\n\n // Ensures current twaps in job liquidities\n _updateJobPeriod(_job);\n uint256 _periodCreditsToRemove = _getReward(_quoteLiquidity(_amount, _liquidity));\n\n // A liquidity can be revoked causing a job to have 0 periodCredits\n if (_jobPeriodCredits[_job] > 0) {\n // Removes a % correspondant to a full rewardPeriodTime for the liquidity withdrawn vs all of the liquidities\n _jobLiquidityCredits[_job] -= (_jobLiquidityCredits[_job] * _periodCreditsToRemove) / _jobPeriodCredits[_job];\n _jobPeriodCredits[_job] -= _periodCreditsToRemove;\n }\n\n liquidityAmount[_job][_liquidity] -= _amount;\n if (liquidityAmount[_job][_liquidity] == 0) {\n _jobLiquidities[_job].remove(_liquidity);\n }\n }\n\n /// @notice Returns a fraction of the multiplier or the whole multiplier if equal or more than a rewardPeriodTime has passed\n function _phase(uint256 _timePassed, uint256 _multiplier) internal view returns (uint256 _result) {\n if (_timePassed < rewardPeriodTime) {\n _result = (_timePassed * _multiplier) / rewardPeriodTime;\n } else _result = _multiplier;\n }\n\n /// @notice Returns the start of the period of the provided timestamp\n function _period(uint256 _timestamp) internal view returns (uint256 _periodTimestamp) {\n return _timestamp - (_timestamp % rewardPeriodTime);\n }\n\n /// @notice Calculates relation between rewardPeriod and inflationPeriod\n function _getReward(uint256 _baseAmount) internal view returns (uint256 _credits) {\n return FullMath.mulDiv(_baseAmount, rewardPeriodTime, inflationPeriod);\n }\n\n /// @notice Returns underlying KP3R amount for a given liquidity amount\n function _quoteLiquidity(uint256 _amount, address _liquidity) internal view returns (uint256 _quote) {\n if (_tick[_liquidity].period != 0) {\n int56 _tickDifference = _isKP3RToken0[_liquidity] ? _tick[_liquidity].difference : -_tick[_liquidity].difference;\n _quote = IKeep3rHelper(keep3rHelper).getKP3RsAtTick(_amount, _tickDifference, rewardPeriodTime);\n }\n }\n\n /// @notice Updates job credits to current quotes and rewards job's pending minted credits\n /// @dev Ensures a maximum of 1 period of credits\n function _settleJobAccountance(address _job) internal virtual {\n _updateJobCreditsIfNeeded(_job);\n _rewardJobCredits(_job);\n _jobLiquidityCredits[_job] = Math.min(_jobLiquidityCredits[_job], _jobPeriodCredits[_job]);\n }\n}\n" - }, - "solidity/contracts/peripherals/Keep3rDisputable.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport './Keep3rParameters.sol';\nimport './Keep3rRoles.sol';\nimport '../../interfaces/peripherals/IKeep3rDisputable.sol';\n\nabstract contract Keep3rDisputable is IKeep3rDisputable, Keep3rAccountance, Keep3rRoles {\n /// @inheritdoc IKeep3rDisputable\n function dispute(address _jobOrKeeper) external override onlyDisputer {\n if (disputes[_jobOrKeeper]) revert AlreadyDisputed();\n disputes[_jobOrKeeper] = true;\n emit Dispute(_jobOrKeeper, msg.sender);\n }\n\n /// @inheritdoc IKeep3rDisputable\n function resolve(address _jobOrKeeper) external override onlyDisputer {\n if (!disputes[_jobOrKeeper]) revert NotDisputed();\n disputes[_jobOrKeeper] = false;\n emit Resolve(_jobOrKeeper, msg.sender);\n }\n}\n" - }, - "solidity/contracts/peripherals/jobs/Keep3rJobOwnership.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../../../interfaces/peripherals/IKeep3rJobs.sol';\n\nabstract contract Keep3rJobOwnership is IKeep3rJobOwnership {\n /// @inheritdoc IKeep3rJobOwnership\n mapping(address => address) public override jobOwner;\n\n /// @inheritdoc IKeep3rJobOwnership\n mapping(address => address) public override jobPendingOwner;\n\n /// @inheritdoc IKeep3rJobOwnership\n function changeJobOwnership(address _job, address _newOwner) external override onlyJobOwner(_job) {\n jobPendingOwner[_job] = _newOwner;\n emit JobOwnershipChange(_job, jobOwner[_job], _newOwner);\n }\n\n /// @inheritdoc IKeep3rJobOwnership\n function acceptJobOwnership(address _job) external override onlyPendingJobOwner(_job) {\n address _previousOwner = jobOwner[_job];\n\n jobOwner[_job] = jobPendingOwner[_job];\n delete jobPendingOwner[_job];\n\n emit JobOwnershipAssent(msg.sender, _job, _previousOwner);\n }\n\n modifier onlyJobOwner(address _job) {\n if (msg.sender != jobOwner[_job]) revert OnlyJobOwner();\n _;\n }\n\n modifier onlyPendingJobOwner(address _job) {\n if (msg.sender != jobPendingOwner[_job]) revert OnlyPendingJobOwner();\n _;\n }\n}\n" - }, - "solidity/interfaces/peripherals/IKeep3rJobs.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\n/// @title Keep3rJobFundableCredits contract\n/// @notice Handles the addition and withdrawal of credits from a job\ninterface IKeep3rJobFundableCredits {\n // Events\n\n /// @notice Emitted when Keep3rJobFundableCredits#addTokenCreditsToJob is called\n /// @param _job The address of the job being credited\n /// @param _token The address of the token being provided\n /// @param _provider The user that calls the function\n /// @param _amount The amount of credit being added to the job\n event TokenCreditAddition(address indexed _job, address indexed _token, address indexed _provider, uint256 _amount);\n\n /// @notice Emitted when Keep3rJobFundableCredits#withdrawTokenCreditsFromJob is called\n /// @param _job The address of the job from which the credits are withdrawn\n /// @param _token The credit being withdrawn from the job\n /// @param _receiver The user that receives the tokens\n /// @param _amount The amount of credit withdrawn\n event TokenCreditWithdrawal(address indexed _job, address indexed _token, address indexed _receiver, uint256 _amount);\n\n // Errors\n\n /// @notice Throws when the token is KP3R, as it should not be used for direct token payments\n error TokenUnallowed();\n\n /// @notice Throws when the token withdraw cooldown has not yet passed\n error JobTokenCreditsLocked();\n\n /// @notice Throws when the user tries to withdraw more tokens than it has\n error InsufficientJobTokenCredits();\n\n // Variables\n\n /// @notice Last block where tokens were added to the job\n /// @param _job The address of the job credited\n /// @param _token The address of the token credited\n /// @return _timestamp The last block where tokens were added to the job\n function jobTokenCreditsAddedAt(address _job, address _token) external view returns (uint256 _timestamp);\n\n // Methods\n\n /// @notice Add credit to a job to be paid out for work\n /// @param _job The address of the job being credited\n /// @param _token The address of the token being credited\n /// @param _amount The amount of credit being added\n function addTokenCreditsToJob(\n address _job,\n address _token,\n uint256 _amount\n ) external;\n\n /// @notice Withdraw credit from a job\n /// @param _job The address of the job from which the credits are withdrawn\n /// @param _token The address of the token being withdrawn\n /// @param _amount The amount of token to be withdrawn\n /// @param _receiver The user that will receive tokens\n function withdrawTokenCreditsFromJob(\n address _job,\n address _token,\n uint256 _amount,\n address _receiver\n ) external;\n}\n\n/// @title Keep3rJobFundableLiquidity contract\n/// @notice Handles the funding of jobs through specific liquidity pairs\ninterface IKeep3rJobFundableLiquidity {\n // Events\n\n /// @notice Emitted when Keep3rJobFundableLiquidity#approveLiquidity function is called\n /// @param _liquidity The address of the liquidity pair being approved\n event LiquidityApproval(address _liquidity);\n\n /// @notice Emitted when Keep3rJobFundableLiquidity#revokeLiquidity function is called\n /// @param _liquidity The address of the liquidity pair being revoked\n event LiquidityRevocation(address _liquidity);\n\n /// @notice Emitted when IKeep3rJobFundableLiquidity#addLiquidityToJob function is called\n /// @param _job The address of the job to which liquidity will be added\n /// @param _liquidity The address of the liquidity being added\n /// @param _provider The user that calls the function\n /// @param _amount The amount of liquidity being added\n event LiquidityAddition(address indexed _job, address indexed _liquidity, address indexed _provider, uint256 _amount);\n\n /// @notice Emitted when IKeep3rJobFundableLiquidity#withdrawLiquidityFromJob function is called\n /// @param _job The address of the job of which liquidity will be withdrawn from\n /// @param _liquidity The address of the liquidity being withdrawn\n /// @param _receiver The receiver of the liquidity tokens\n /// @param _amount The amount of liquidity being withdrawn from the job\n event LiquidityWithdrawal(address indexed _job, address indexed _liquidity, address indexed _receiver, uint256 _amount);\n\n /// @notice Emitted when Keep3rJobFundableLiquidity#addLiquidityToJob function is called\n /// @param _job The address of the job whose credits will be updated\n /// @param _rewardedAt The time at which the job was last rewarded\n /// @param _currentCredits The current credits of the job\n /// @param _periodCredits The credits of the job for the current period\n event LiquidityCreditsReward(address indexed _job, uint256 _rewardedAt, uint256 _currentCredits, uint256 _periodCredits);\n\n /// @notice Emitted when Keep3rJobFundableLiquidity#forceLiquidityCreditsToJob function is called\n /// @param _job The address of the job whose credits will be updated\n /// @param _rewardedAt The time at which the job was last rewarded\n /// @param _currentCredits The current credits of the job\n event LiquidityCreditsForced(address indexed _job, uint256 _rewardedAt, uint256 _currentCredits);\n\n // Errors\n\n /// @notice Throws when the liquidity being approved has already been approved\n error LiquidityPairApproved();\n\n /// @notice Throws when the liquidity being removed has not been approved\n error LiquidityPairUnexistent();\n\n /// @notice Throws when trying to add liquidity to an unapproved pool\n error LiquidityPairUnapproved();\n\n /// @notice Throws when the job doesn't have the requested liquidity\n error JobLiquidityUnexistent();\n\n /// @notice Throws when trying to remove more liquidity than the job has\n error JobLiquidityInsufficient();\n\n /// @notice Throws when trying to add less liquidity than the minimum liquidity required\n error JobLiquidityLessThanMin();\n\n // Structs\n\n /// @notice Stores the tick information of the different liquidity pairs\n struct TickCache {\n int56 current; // Tracks the current tick\n int56 difference; // Stores the difference between the current tick and the last tick\n uint256 period; // Stores the period at which the last observation was made\n }\n\n // Variables\n\n /// @notice Lists liquidity pairs\n /// @return _list An array of addresses with all the approved liquidity pairs\n function approvedLiquidities() external view returns (address[] memory _list);\n\n /// @notice Amount of liquidity in a specified job\n /// @param _job The address of the job being checked\n /// @param _liquidity The address of the liquidity we are checking\n /// @return _amount Amount of liquidity in the specified job\n function liquidityAmount(address _job, address _liquidity) external view returns (uint256 _amount);\n\n /// @notice Last time the job was rewarded liquidity credits\n /// @param _job The address of the job being checked\n /// @return _timestamp Timestamp of the last time the job was rewarded liquidity credits\n function rewardedAt(address _job) external view returns (uint256 _timestamp);\n\n /// @notice Last time the job was worked\n /// @param _job The address of the job being checked\n /// @return _timestamp Timestamp of the last time the job was worked\n function workedAt(address _job) external view returns (uint256 _timestamp);\n\n // Methods\n\n /// @notice Returns the liquidity credits of a given job\n /// @param _job The address of the job of which we want to know the liquidity credits\n /// @return _amount The liquidity credits of a given job\n function jobLiquidityCredits(address _job) external view returns (uint256 _amount);\n\n /// @notice Returns the credits of a given job for the current period\n /// @param _job The address of the job of which we want to know the period credits\n /// @return _amount The credits the given job has at the current period\n function jobPeriodCredits(address _job) external view returns (uint256 _amount);\n\n /// @notice Calculates the total credits of a given job\n /// @param _job The address of the job of which we want to know the total credits\n /// @return _amount The total credits of the given job\n function totalJobCredits(address _job) external view returns (uint256 _amount);\n\n /// @notice Calculates how many credits should be rewarded periodically for a given liquidity amount\n /// @dev _periodCredits = underlying KP3Rs for given liquidity amount * rewardPeriod / inflationPeriod\n /// @param _liquidity The address of the liquidity to provide\n /// @param _amount The amount of liquidity to provide\n /// @return _periodCredits The amount of KP3R periodically minted for the given liquidity\n function quoteLiquidity(address _liquidity, uint256 _amount) external view returns (uint256 _periodCredits);\n\n /// @notice Observes the current state of the liquidity pair being observed and updates TickCache with the information\n /// @param _liquidity The address of the liquidity pair being observed\n /// @return _tickCache The updated TickCache\n function observeLiquidity(address _liquidity) external view returns (TickCache memory _tickCache);\n\n /// @notice Gifts liquidity credits to the specified job\n /// @param _job The address of the job being credited\n /// @param _amount The amount of liquidity credits to gift\n function forceLiquidityCreditsToJob(address _job, uint256 _amount) external;\n\n /// @notice Approve a liquidity pair for being accepted in future\n /// @param _liquidity The address of the liquidity accepted\n function approveLiquidity(address _liquidity) external;\n\n /// @notice Revoke a liquidity pair from being accepted in future\n /// @param _liquidity The liquidity no longer accepted\n function revokeLiquidity(address _liquidity) external;\n\n /// @notice Allows anyone to fund a job with liquidity\n /// @param _job The address of the job to assign liquidity to\n /// @param _liquidity The liquidity being added\n /// @param _amount The amount of liquidity tokens to add\n function addLiquidityToJob(\n address _job,\n address _liquidity,\n uint256 _amount\n ) external;\n\n /// @notice Unbond liquidity for a job\n /// @dev Can only be called by the job's owner\n /// @param _job The address of the job being unbonded from\n /// @param _liquidity The liquidity being unbonded\n /// @param _amount The amount of liquidity being removed\n function unbondLiquidityFromJob(\n address _job,\n address _liquidity,\n uint256 _amount\n ) external;\n\n /// @notice Withdraw liquidity from a job\n /// @param _job The address of the job being withdrawn from\n /// @param _liquidity The liquidity being withdrawn\n /// @param _receiver The address that will receive the withdrawn liquidity\n function withdrawLiquidityFromJob(\n address _job,\n address _liquidity,\n address _receiver\n ) external;\n}\n\n/// @title Keep3rJobManager contract\n/// @notice Handles the addition and withdrawal of credits from a job\ninterface IKeep3rJobManager {\n // Events\n\n /// @notice Emitted when Keep3rJobManager#addJob is called\n /// @param _job The address of the job to add\n /// @param _jobOwner The job's owner\n event JobAddition(address indexed _job, address indexed _jobOwner);\n\n // Errors\n\n /// @notice Throws when trying to add a job that has already been added\n error JobAlreadyAdded();\n\n /// @notice Throws when the address that is trying to register as a keeper is already a keeper\n error AlreadyAKeeper();\n\n // Methods\n\n /// @notice Allows any caller to add a new job\n /// @param _job Address of the contract for which work should be performed\n function addJob(address _job) external;\n}\n\n/// @title Keep3rJobWorkable contract\n/// @notice Handles the mechanisms jobs can pay keepers with along with the restrictions jobs can put on keepers before they can work on jobs\ninterface IKeep3rJobWorkable {\n // Events\n\n /// @notice Emitted when a keeper is validated before a job\n /// @param _gasLeft The amount of gas that the transaction has left at the moment of keeper validation\n event KeeperValidation(uint256 _gasLeft);\n\n /// @notice Emitted when a keeper works a job\n /// @param _credit The address of the asset in which the keeper is paid\n /// @param _job The address of the job the keeper has worked\n /// @param _keeper The address of the keeper that has worked the job\n /// @param _payment The amount that has been paid out to the keeper in exchange for working the job\n /// @param _gasLeft The amount of gas that the transaction has left at the moment of payment\n event KeeperWork(address indexed _credit, address indexed _job, address indexed _keeper, uint256 _payment, uint256 _gasLeft);\n\n // Errors\n\n /// @notice Throws if the address claiming to be a job is not in the list of approved jobs\n error JobUnapproved();\n\n /// @notice Throws if the amount of funds in the job is less than the payment that must be paid to the keeper that works that job\n error InsufficientFunds();\n\n // Methods\n\n /// @notice Confirms if the current keeper is registered\n /// @dev Can be used for general (non critical) functions\n /// @param _keeper The keeper being investigated\n /// @return _isKeeper Whether the address passed as a parameter is a keeper or not\n function isKeeper(address _keeper) external returns (bool _isKeeper);\n\n /// @notice Confirms if the current keeper is registered and has a minimum bond of any asset.\n /// @dev Should be used for protected functions\n /// @param _keeper The keeper to check\n /// @param _bond The bond token being evaluated\n /// @param _minBond The minimum amount of bonded tokens\n /// @param _earned The minimum funds earned in the keepers lifetime\n /// @param _age The minimum keeper age required\n /// @return _isBondedKeeper Whether the `_keeper` meets the given requirements\n function isBondedKeeper(\n address _keeper,\n address _bond,\n uint256 _minBond,\n uint256 _earned,\n uint256 _age\n ) external returns (bool _isBondedKeeper);\n\n /// @notice Implemented by jobs to show that a keeper performed work\n /// @dev Automatically calculates the payment for the keeper and pays the keeper with bonded KP3R\n /// @param _keeper Address of the keeper that performed the work\n function worked(address _keeper) external;\n\n /// @notice Implemented by jobs to show that a keeper performed work\n /// @dev Pays the keeper that performs the work with KP3R\n /// @param _keeper Address of the keeper that performed the work\n /// @param _payment The reward that should be allocated for the job\n function bondedPayment(address _keeper, uint256 _payment) external;\n\n /// @notice Implemented by jobs to show that a keeper performed work\n /// @dev Pays the keeper that performs the work with a specific token\n /// @param _token The asset being awarded to the keeper\n /// @param _keeper Address of the keeper that performed the work\n /// @param _amount The reward that should be allocated\n function directTokenPayment(\n address _token,\n address _keeper,\n uint256 _amount\n ) external;\n}\n\n/// @title Keep3rJobOwnership contract\n/// @notice Handles the ownership of the jobs\ninterface IKeep3rJobOwnership {\n // Events\n\n /// @notice Emitted when Keep3rJobOwnership#changeJobOwnership is called\n /// @param _job The address of the job proposed to have a change of owner\n /// @param _owner The current owner of the job\n /// @param _pendingOwner The new address proposed to be the owner of the job\n event JobOwnershipChange(address indexed _job, address indexed _owner, address indexed _pendingOwner);\n\n /// @notice Emitted when Keep3rJobOwnership#JobOwnershipAssent is called\n /// @param _job The address of the job which the proposed owner will now own\n /// @param _previousOwner The previous owner of the job\n /// @param _newOwner The new owner of the job\n event JobOwnershipAssent(address indexed _job, address indexed _previousOwner, address indexed _newOwner);\n\n // Errors\n\n /// @notice Throws when the caller of the function is not the job owner\n error OnlyJobOwner();\n\n /// @notice Throws when the caller of the function is not the pending job owner\n error OnlyPendingJobOwner();\n\n // Variables\n\n /// @notice Maps the job to the owner of the job\n /// @param _job The address of the job\n /// @return _owner The address of the owner of the job\n function jobOwner(address _job) external view returns (address _owner);\n\n /// @notice Maps the job to its pending owner\n /// @param _job The address of the job\n /// @return _pendingOwner The address of the pending owner of the job\n function jobPendingOwner(address _job) external view returns (address _pendingOwner);\n\n // Methods\n\n /// @notice Proposes a new address to be the owner of the job\n /// @param _job The address of the job\n /// @param _newOwner The address of the proposed new owner\n function changeJobOwnership(address _job, address _newOwner) external;\n\n /// @notice The proposed address accepts to be the owner of the job\n /// @param _job The address of the job\n function acceptJobOwnership(address _job) external;\n}\n\n/// @title Keep3rJobMigration contract\n/// @notice Handles the migration process of jobs to different addresses\ninterface IKeep3rJobMigration {\n // Events\n\n /// @notice Emitted when Keep3rJobMigration#migrateJob function is called\n /// @param _fromJob The address of the job that requests to migrate\n /// @param _toJob The address at which the job requests to migrate\n event JobMigrationRequested(address indexed _fromJob, address _toJob);\n\n /// @notice Emitted when Keep3rJobMigration#acceptJobMigration function is called\n /// @param _fromJob The address of the job that requested to migrate\n /// @param _toJob The address at which the job had requested to migrate\n event JobMigrationSuccessful(address _fromJob, address indexed _toJob);\n\n // Errors\n\n /// @notice Throws when the address of the job that requests to migrate wants to migrate to its same address\n error JobMigrationImpossible();\n\n /// @notice Throws when the _toJob address differs from the address being tracked in the pendingJobMigrations mapping\n error JobMigrationUnavailable();\n\n /// @notice Throws when cooldown between migrations has not yet passed\n error JobMigrationLocked();\n\n // Variables\n\n /// @notice Maps the jobs that have requested a migration to the address they have requested to migrate to\n /// @return _toJob The address to which the job has requested to migrate to\n function pendingJobMigrations(address _fromJob) external view returns (address _toJob);\n\n // Methods\n\n /// @notice Initializes the migration process for a job by adding the request to the pendingJobMigrations mapping\n /// @param _fromJob The address of the job that is requesting to migrate\n /// @param _toJob The address at which the job is requesting to migrate\n function migrateJob(address _fromJob, address _toJob) external;\n\n /// @notice Completes the migration process for a job\n /// @dev Unbond/withdraw process doesn't get migrated\n /// @param _fromJob The address of the job that requested to migrate\n /// @param _toJob The address to which the job wants to migrate to\n function acceptJobMigration(address _fromJob, address _toJob) external;\n}\n\n/// @title Keep3rJobDisputable contract\n/// @notice Handles the actions that can be taken on a disputed job\ninterface IKeep3rJobDisputable is IKeep3rJobFundableCredits, IKeep3rJobFundableLiquidity {\n // Events\n\n /// @notice Emitted when Keep3rJobDisputable#slashTokenFromJob is called\n /// @param _job The address of the job from which the token will be slashed\n /// @param _token The address of the token being slashed\n /// @param _slasher The user that slashes the token\n /// @param _amount The amount of the token being slashed\n event JobSlashToken(address indexed _job, address _token, address indexed _slasher, uint256 _amount);\n\n /// @notice Emitted when Keep3rJobDisputable#slashLiquidityFromJob is called\n /// @param _job The address of the job from which the liquidity will be slashed\n /// @param _liquidity The address of the liquidity being slashed\n /// @param _slasher The user that slashes the liquidity\n /// @param _amount The amount of the liquidity being slashed\n event JobSlashLiquidity(address indexed _job, address _liquidity, address indexed _slasher, uint256 _amount);\n\n // Errors\n\n /// @notice Throws when the token trying to be slashed doesn't exist\n error JobTokenUnexistent();\n\n /// @notice Throws when someone tries to slash more tokens than the job has\n error JobTokenInsufficient();\n\n // Methods\n\n /// @notice Allows governance or slasher to slash a job specific token\n /// @param _job The address of the job from which the token will be slashed\n /// @param _token The address of the token that will be slashed\n /// @param _amount The amount of the token that will be slashed\n function slashTokenFromJob(\n address _job,\n address _token,\n uint256 _amount\n ) external;\n\n /// @notice Allows governance or a slasher to slash liquidity from a job\n /// @param _job The address being slashed\n /// @param _liquidity The address of the liquidity that will be slashed\n /// @param _amount The amount of liquidity that will be slashed\n function slashLiquidityFromJob(\n address _job,\n address _liquidity,\n uint256 _amount\n ) external;\n}\n\n// solhint-disable-next-line no-empty-blocks\ninterface IKeep3rJobs is IKeep3rJobOwnership, IKeep3rJobDisputable, IKeep3rJobMigration, IKeep3rJobManager, IKeep3rJobWorkable {\n\n}\n" - }, - "@openzeppelin/contracts/security/ReentrancyGuard.sol": { - "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Contract module that helps prevent reentrant calls to a function.\n *\n * Inheriting from `ReentrancyGuard` will make the {nonReentrant} modifier\n * available, which can be applied to functions to make sure there are no nested\n * (reentrant) calls to them.\n *\n * Note that because there is a single `nonReentrant` guard, functions marked as\n * `nonReentrant` may not call one another. This can be worked around by making\n * those functions `private`, and then adding `external` `nonReentrant` entry\n * points to them.\n *\n * TIP: If you would like to learn more about reentrancy and alternative ways\n * to protect against it, check out our blog post\n * https://blog.openzeppelin.com/reentrancy-after-istanbul/[Reentrancy After Istanbul].\n */\nabstract contract ReentrancyGuard {\n // Booleans are more expensive than uint256 or any type that takes up a full\n // word because each write operation emits an extra SLOAD to first read the\n // slot's contents, replace the bits taken up by the boolean, and then write\n // back. This is the compiler's defense against contract upgrades and\n // pointer aliasing, and it cannot be disabled.\n\n // The values being non-zero value makes deployment a bit more expensive,\n // but in exchange the refund on every call to nonReentrant will be lower in\n // amount. Since refunds are capped to a percentage of the total\n // transaction's gas, it is best to keep them low in cases like this one, to\n // increase the likelihood of the full refund coming into effect.\n uint256 private constant _NOT_ENTERED = 1;\n uint256 private constant _ENTERED = 2;\n\n uint256 private _status;\n\n constructor() {\n _status = _NOT_ENTERED;\n }\n\n /**\n * @dev Prevents a contract from calling itself, directly or indirectly.\n * Calling a `nonReentrant` function from another `nonReentrant`\n * function is not supported. It is possible to prevent this from happening\n * by making the `nonReentrant` function external, and make it call a\n * `private` function that does the actual work.\n */\n modifier nonReentrant() {\n // On the first call to nonReentrant, _notEntered will be true\n require(_status != _ENTERED, \"ReentrancyGuard: reentrant call\");\n\n // Any calls to nonReentrant after this point will fail\n _status = _ENTERED;\n\n _;\n\n // By storing the original value once again, a refund is triggered (see\n // https://eips.ethereum.org/EIPS/eip-2200)\n _status = _NOT_ENTERED;\n }\n}\n" - }, - "@openzeppelin/contracts/token/ERC20/IERC20.sol": { - "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Interface of the ERC20 standard as defined in the EIP.\n */\ninterface IERC20 {\n /**\n * @dev Returns the amount of tokens in existence.\n */\n function totalSupply() external view returns (uint256);\n\n /**\n * @dev Returns the amount of tokens owned by `account`.\n */\n function balanceOf(address account) external view returns (uint256);\n\n /**\n * @dev Moves `amount` tokens from the caller's account to `recipient`.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * Emits a {Transfer} event.\n */\n function transfer(address recipient, uint256 amount) external returns (bool);\n\n /**\n * @dev Returns the remaining number of tokens that `spender` will be\n * allowed to spend on behalf of `owner` through {transferFrom}. This is\n * zero by default.\n *\n * This value changes when {approve} or {transferFrom} are called.\n */\n function allowance(address owner, address spender) external view returns (uint256);\n\n /**\n * @dev Sets `amount` as the allowance of `spender` over the caller's tokens.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * IMPORTANT: Beware that changing an allowance with this method brings the risk\n * that someone may use both the old and the new allowance by unfortunate\n * transaction ordering. One possible solution to mitigate this race\n * condition is to first reduce the spender's allowance to 0 and set the\n * desired value afterwards:\n * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729\n *\n * Emits an {Approval} event.\n */\n function approve(address spender, uint256 amount) external returns (bool);\n\n /**\n * @dev Moves `amount` tokens from `sender` to `recipient` using the\n * allowance mechanism. `amount` is then deducted from the caller's\n * allowance.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * Emits a {Transfer} event.\n */\n function transferFrom(\n address sender,\n address recipient,\n uint256 amount\n ) external returns (bool);\n\n /**\n * @dev Emitted when `value` tokens are moved from one account (`from`) to\n * another (`to`).\n *\n * Note that `value` may be zero.\n */\n event Transfer(address indexed from, address indexed to, uint256 value);\n\n /**\n * @dev Emitted when the allowance of a `spender` for an `owner` is set by\n * a call to {approve}. `value` is the new allowance.\n */\n event Approval(address indexed owner, address indexed spender, uint256 value);\n}\n" - }, - "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol": { - "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\nimport \"../IERC20.sol\";\nimport \"../../../utils/Address.sol\";\n\n/**\n * @title SafeERC20\n * @dev Wrappers around ERC20 operations that throw on failure (when the token\n * contract returns false). Tokens that return no value (and instead revert or\n * throw on failure) are also supported, non-reverting calls are assumed to be\n * successful.\n * To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract,\n * which allows you to call the safe operations as `token.safeTransfer(...)`, etc.\n */\nlibrary SafeERC20 {\n using Address for address;\n\n function safeTransfer(\n IERC20 token,\n address to,\n uint256 value\n ) internal {\n _callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value));\n }\n\n function safeTransferFrom(\n IERC20 token,\n address from,\n address to,\n uint256 value\n ) internal {\n _callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value));\n }\n\n /**\n * @dev Deprecated. This function has issues similar to the ones found in\n * {IERC20-approve}, and its usage is discouraged.\n *\n * Whenever possible, use {safeIncreaseAllowance} and\n * {safeDecreaseAllowance} instead.\n */\n function safeApprove(\n IERC20 token,\n address spender,\n uint256 value\n ) internal {\n // safeApprove should only be called when setting an initial allowance,\n // or when resetting it to zero. To increase and decrease it, use\n // 'safeIncreaseAllowance' and 'safeDecreaseAllowance'\n require(\n (value == 0) || (token.allowance(address(this), spender) == 0),\n \"SafeERC20: approve from non-zero to non-zero allowance\"\n );\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value));\n }\n\n function safeIncreaseAllowance(\n IERC20 token,\n address spender,\n uint256 value\n ) internal {\n uint256 newAllowance = token.allowance(address(this), spender) + value;\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));\n }\n\n function safeDecreaseAllowance(\n IERC20 token,\n address spender,\n uint256 value\n ) internal {\n unchecked {\n uint256 oldAllowance = token.allowance(address(this), spender);\n require(oldAllowance >= value, \"SafeERC20: decreased allowance below zero\");\n uint256 newAllowance = oldAllowance - value;\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));\n }\n }\n\n /**\n * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement\n * on the return value: the return value is optional (but if data is returned, it must not be false).\n * @param token The token targeted by the call.\n * @param data The call data (encoded using abi.encode or one of its variants).\n */\n function _callOptionalReturn(IERC20 token, bytes memory data) private {\n // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since\n // we're implementing it ourselves. We use {Address.functionCall} to perform this call, which verifies that\n // the target address contains contract code and also asserts for success in the low-level call.\n\n bytes memory returndata = address(token).functionCall(data, \"SafeERC20: low-level call failed\");\n if (returndata.length > 0) {\n // Return data is optional\n require(abi.decode(returndata, (bool)), \"SafeERC20: ERC20 operation did not succeed\");\n }\n }\n}\n" - }, - "@openzeppelin/contracts/utils/math/Math.sol": { - "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Standard math utilities missing in the Solidity language.\n */\nlibrary Math {\n /**\n * @dev Returns the largest of two numbers.\n */\n function max(uint256 a, uint256 b) internal pure returns (uint256) {\n return a >= b ? a : b;\n }\n\n /**\n * @dev Returns the smallest of two numbers.\n */\n function min(uint256 a, uint256 b) internal pure returns (uint256) {\n return a < b ? a : b;\n }\n\n /**\n * @dev Returns the average of two numbers. The result is rounded towards\n * zero.\n */\n function average(uint256 a, uint256 b) internal pure returns (uint256) {\n // (a + b) / 2 can overflow.\n return (a & b) + (a ^ b) / 2;\n }\n\n /**\n * @dev Returns the ceiling of the division of two numbers.\n *\n * This differs from standard division with `/` in that it rounds up instead\n * of rounding down.\n */\n function ceilDiv(uint256 a, uint256 b) internal pure returns (uint256) {\n // (a + b - 1) / b can overflow on addition, so we distribute.\n return a / b + (a % b == 0 ? 0 : 1);\n }\n}\n" - }, - "@openzeppelin/contracts/utils/structs/EnumerableSet.sol": { - "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Library for managing\n * https://en.wikipedia.org/wiki/Set_(abstract_data_type)[sets] of primitive\n * types.\n *\n * Sets have the following properties:\n *\n * - Elements are added, removed, and checked for existence in constant time\n * (O(1)).\n * - Elements are enumerated in O(n). No guarantees are made on the ordering.\n *\n * ```\n * contract Example {\n * // Add the library methods\n * using EnumerableSet for EnumerableSet.AddressSet;\n *\n * // Declare a set state variable\n * EnumerableSet.AddressSet private mySet;\n * }\n * ```\n *\n * As of v3.3.0, sets of type `bytes32` (`Bytes32Set`), `address` (`AddressSet`)\n * and `uint256` (`UintSet`) are supported.\n */\nlibrary EnumerableSet {\n // To implement this library for multiple types with as little code\n // repetition as possible, we write it in terms of a generic Set type with\n // bytes32 values.\n // The Set implementation uses private functions, and user-facing\n // implementations (such as AddressSet) are just wrappers around the\n // underlying Set.\n // This means that we can only create new EnumerableSets for types that fit\n // in bytes32.\n\n struct Set {\n // Storage of set values\n bytes32[] _values;\n // Position of the value in the `values` array, plus 1 because index 0\n // means a value is not in the set.\n mapping(bytes32 => uint256) _indexes;\n }\n\n /**\n * @dev Add a value to a set. O(1).\n *\n * Returns true if the value was added to the set, that is if it was not\n * already present.\n */\n function _add(Set storage set, bytes32 value) private returns (bool) {\n if (!_contains(set, value)) {\n set._values.push(value);\n // The value is stored at length-1, but we add 1 to all indexes\n // and use 0 as a sentinel value\n set._indexes[value] = set._values.length;\n return true;\n } else {\n return false;\n }\n }\n\n /**\n * @dev Removes a value from a set. O(1).\n *\n * Returns true if the value was removed from the set, that is if it was\n * present.\n */\n function _remove(Set storage set, bytes32 value) private returns (bool) {\n // We read and store the value's index to prevent multiple reads from the same storage slot\n uint256 valueIndex = set._indexes[value];\n\n if (valueIndex != 0) {\n // Equivalent to contains(set, value)\n // To delete an element from the _values array in O(1), we swap the element to delete with the last one in\n // the array, and then remove the last element (sometimes called as 'swap and pop').\n // This modifies the order of the array, as noted in {at}.\n\n uint256 toDeleteIndex = valueIndex - 1;\n uint256 lastIndex = set._values.length - 1;\n\n if (lastIndex != toDeleteIndex) {\n bytes32 lastvalue = set._values[lastIndex];\n\n // Move the last value to the index where the value to delete is\n set._values[toDeleteIndex] = lastvalue;\n // Update the index for the moved value\n set._indexes[lastvalue] = valueIndex; // Replace lastvalue's index to valueIndex\n }\n\n // Delete the slot where the moved value was stored\n set._values.pop();\n\n // Delete the index for the deleted slot\n delete set._indexes[value];\n\n return true;\n } else {\n return false;\n }\n }\n\n /**\n * @dev Returns true if the value is in the set. O(1).\n */\n function _contains(Set storage set, bytes32 value) private view returns (bool) {\n return set._indexes[value] != 0;\n }\n\n /**\n * @dev Returns the number of values on the set. O(1).\n */\n function _length(Set storage set) private view returns (uint256) {\n return set._values.length;\n }\n\n /**\n * @dev Returns the value stored at position `index` in the set. O(1).\n *\n * Note that there are no guarantees on the ordering of values inside the\n * array, and it may change when more values are added or removed.\n *\n * Requirements:\n *\n * - `index` must be strictly less than {length}.\n */\n function _at(Set storage set, uint256 index) private view returns (bytes32) {\n return set._values[index];\n }\n\n /**\n * @dev Return the entire set in an array\n *\n * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed\n * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that\n * this function has an unbounded cost, and using it as part of a state-changing function may render the function\n * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.\n */\n function _values(Set storage set) private view returns (bytes32[] memory) {\n return set._values;\n }\n\n // Bytes32Set\n\n struct Bytes32Set {\n Set _inner;\n }\n\n /**\n * @dev Add a value to a set. O(1).\n *\n * Returns true if the value was added to the set, that is if it was not\n * already present.\n */\n function add(Bytes32Set storage set, bytes32 value) internal returns (bool) {\n return _add(set._inner, value);\n }\n\n /**\n * @dev Removes a value from a set. O(1).\n *\n * Returns true if the value was removed from the set, that is if it was\n * present.\n */\n function remove(Bytes32Set storage set, bytes32 value) internal returns (bool) {\n return _remove(set._inner, value);\n }\n\n /**\n * @dev Returns true if the value is in the set. O(1).\n */\n function contains(Bytes32Set storage set, bytes32 value) internal view returns (bool) {\n return _contains(set._inner, value);\n }\n\n /**\n * @dev Returns the number of values in the set. O(1).\n */\n function length(Bytes32Set storage set) internal view returns (uint256) {\n return _length(set._inner);\n }\n\n /**\n * @dev Returns the value stored at position `index` in the set. O(1).\n *\n * Note that there are no guarantees on the ordering of values inside the\n * array, and it may change when more values are added or removed.\n *\n * Requirements:\n *\n * - `index` must be strictly less than {length}.\n */\n function at(Bytes32Set storage set, uint256 index) internal view returns (bytes32) {\n return _at(set._inner, index);\n }\n\n /**\n * @dev Return the entire set in an array\n *\n * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed\n * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that\n * this function has an unbounded cost, and using it as part of a state-changing function may render the function\n * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.\n */\n function values(Bytes32Set storage set) internal view returns (bytes32[] memory) {\n return _values(set._inner);\n }\n\n // AddressSet\n\n struct AddressSet {\n Set _inner;\n }\n\n /**\n * @dev Add a value to a set. O(1).\n *\n * Returns true if the value was added to the set, that is if it was not\n * already present.\n */\n function add(AddressSet storage set, address value) internal returns (bool) {\n return _add(set._inner, bytes32(uint256(uint160(value))));\n }\n\n /**\n * @dev Removes a value from a set. O(1).\n *\n * Returns true if the value was removed from the set, that is if it was\n * present.\n */\n function remove(AddressSet storage set, address value) internal returns (bool) {\n return _remove(set._inner, bytes32(uint256(uint160(value))));\n }\n\n /**\n * @dev Returns true if the value is in the set. O(1).\n */\n function contains(AddressSet storage set, address value) internal view returns (bool) {\n return _contains(set._inner, bytes32(uint256(uint160(value))));\n }\n\n /**\n * @dev Returns the number of values in the set. O(1).\n */\n function length(AddressSet storage set) internal view returns (uint256) {\n return _length(set._inner);\n }\n\n /**\n * @dev Returns the value stored at position `index` in the set. O(1).\n *\n * Note that there are no guarantees on the ordering of values inside the\n * array, and it may change when more values are added or removed.\n *\n * Requirements:\n *\n * - `index` must be strictly less than {length}.\n */\n function at(AddressSet storage set, uint256 index) internal view returns (address) {\n return address(uint160(uint256(_at(set._inner, index))));\n }\n\n /**\n * @dev Return the entire set in an array\n *\n * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed\n * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that\n * this function has an unbounded cost, and using it as part of a state-changing function may render the function\n * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.\n */\n function values(AddressSet storage set) internal view returns (address[] memory) {\n bytes32[] memory store = _values(set._inner);\n address[] memory result;\n\n assembly {\n result := store\n }\n\n return result;\n }\n\n // UintSet\n\n struct UintSet {\n Set _inner;\n }\n\n /**\n * @dev Add a value to a set. O(1).\n *\n * Returns true if the value was added to the set, that is if it was not\n * already present.\n */\n function add(UintSet storage set, uint256 value) internal returns (bool) {\n return _add(set._inner, bytes32(value));\n }\n\n /**\n * @dev Removes a value from a set. O(1).\n *\n * Returns true if the value was removed from the set, that is if it was\n * present.\n */\n function remove(UintSet storage set, uint256 value) internal returns (bool) {\n return _remove(set._inner, bytes32(value));\n }\n\n /**\n * @dev Returns true if the value is in the set. O(1).\n */\n function contains(UintSet storage set, uint256 value) internal view returns (bool) {\n return _contains(set._inner, bytes32(value));\n }\n\n /**\n * @dev Returns the number of values on the set. O(1).\n */\n function length(UintSet storage set) internal view returns (uint256) {\n return _length(set._inner);\n }\n\n /**\n * @dev Returns the value stored at position `index` in the set. O(1).\n *\n * Note that there are no guarantees on the ordering of values inside the\n * array, and it may change when more values are added or removed.\n *\n * Requirements:\n *\n * - `index` must be strictly less than {length}.\n */\n function at(UintSet storage set, uint256 index) internal view returns (uint256) {\n return uint256(_at(set._inner, index));\n }\n\n /**\n * @dev Return the entire set in an array\n *\n * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed\n * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that\n * this function has an unbounded cost, and using it as part of a state-changing function may render the function\n * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.\n */\n function values(UintSet storage set) internal view returns (uint256[] memory) {\n bytes32[] memory store = _values(set._inner);\n uint256[] memory result;\n\n assembly {\n result := store\n }\n\n return result;\n }\n}\n" - }, - "solidity/interfaces/peripherals/IKeep3rAccountance.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\n/// @title Keep3rDisputable contract\n/// @notice Disputes keepers, or if they're already disputed, it can resolve the case\n/// @dev Argument `bonding` can be the address of either a token or a liquidity\ninterface IKeep3rAccountance {\n // Events\n\n /// @notice Emitted when the bonding process of a new keeper begins\n /// @param _keeper The caller of Keep3rKeeperFundable#bond function\n /// @param _bonding The asset the keeper has bonded\n /// @param _amount The amount the keeper has bonded\n event Bonding(address indexed _keeper, address indexed _bonding, uint256 _amount);\n\n /// @notice Emitted when a keeper or job begins the unbonding process to withdraw the funds\n /// @param _keeperOrJob The keeper or job that began the unbonding process\n /// @param _unbonding The liquidity pair or asset being unbonded\n /// @param _amount The amount being unbonded\n event Unbonding(address indexed _keeperOrJob, address indexed _unbonding, uint256 _amount);\n\n // Variables\n\n /// @notice Tracks the total KP3R earnings of a keeper since it started working\n /// @param _keeper The address of the keeper\n /// @return _workCompleted Total KP3R earnings of a keeper since it started working\n function workCompleted(address _keeper) external view returns (uint256 _workCompleted);\n\n /// @notice Tracks when a keeper was first registered\n /// @param _keeper The address of the keeper\n /// @return timestamp The time at which the keeper was first registered\n function firstSeen(address _keeper) external view returns (uint256 timestamp);\n\n /// @notice Tracks if a keeper or job has a pending dispute\n /// @param _keeperOrJob The address of the keeper or job\n /// @return _disputed Whether a keeper or job has a pending dispute\n function disputes(address _keeperOrJob) external view returns (bool _disputed);\n\n /// @notice Tracks how much a keeper has bonded of a certain token\n /// @param _keeper The address of the keeper\n /// @param _bond The address of the token being bonded\n /// @return _bonds Amount of a certain token that a keeper has bonded\n function bonds(address _keeper, address _bond) external view returns (uint256 _bonds);\n\n /// @notice The current token credits available for a job\n /// @param _job The address of the job\n /// @param _token The address of the token bonded\n /// @return _amount The amount of token credits available for a job\n function jobTokenCredits(address _job, address _token) external view returns (uint256 _amount);\n\n /// @notice Tracks the amount of assets deposited in pending bonds\n /// @param _keeper The address of the keeper\n /// @param _bonding The address of the token being bonded\n /// @return _pendingBonds Amount of a certain asset a keeper has unbonding\n function pendingBonds(address _keeper, address _bonding) external view returns (uint256 _pendingBonds);\n\n /// @notice Tracks when a bonding for a keeper can be activated\n /// @param _keeper The address of the keeper\n /// @param _bonding The address of the token being bonded\n /// @return _timestamp Time at which the bonding for a keeper can be activated\n function canActivateAfter(address _keeper, address _bonding) external view returns (uint256 _timestamp);\n\n /// @notice Tracks when keeper bonds are ready to be withdrawn\n /// @param _keeper The address of the keeper\n /// @param _bonding The address of the token being unbonded\n /// @return _timestamp Time at which the keeper bonds are ready to be withdrawn\n function canWithdrawAfter(address _keeper, address _bonding) external view returns (uint256 _timestamp);\n\n /// @notice Tracks how much keeper bonds are to be withdrawn\n /// @param _keeper The address of the keeper\n /// @param _bonding The address of the token being unbonded\n /// @return _pendingUnbonds The amount of keeper bonds that are to be withdrawn\n function pendingUnbonds(address _keeper, address _bonding) external view returns (uint256 _pendingUnbonds);\n\n /// @notice Checks whether the address has ever bonded an asset\n /// @param _keeper The address of the keeper\n /// @return _hasBonded Whether the address has ever bonded an asset\n function hasBonded(address _keeper) external view returns (bool _hasBonded);\n\n // Methods\n\n /// @notice Lists all jobs\n /// @return _jobList Array with all the jobs in _jobs\n function jobs() external view returns (address[] memory _jobList);\n\n /// @notice Lists all keepers\n /// @return _keeperList Array with all the keepers in _keepers\n function keepers() external view returns (address[] memory _keeperList);\n\n // Errors\n\n /// @notice Throws when an address is passed as a job, but that address is not a job\n error JobUnavailable();\n\n /// @notice Throws when an action that requires an undisputed job is applied on a disputed job\n error JobDisputed();\n}\n" - }, - "solidity/interfaces/IKeep3rHelper.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\n/// @title Keep3rHelper contract\n/// @notice Contains all the helper functions used throughout the different files.\n\ninterface IKeep3rHelper {\n // Errors\n\n /// @notice Throws when none of the tokens in the liquidity pair is KP3R\n error LiquidityPairInvalid();\n\n // Methods\n // solhint-enable func-name-mixedcase\n\n /// @notice Calculates the amount of KP3R that corresponds to the ETH passed into the function\n /// @dev This function allows us to calculate how much KP3R we should pay to a keeper for things expressed in ETH, like gas\n /// @param _eth The amount of ETH\n /// @return _amountOut The amount of KP3R\n function quote(uint256 _eth) external view returns (uint256 _amountOut);\n\n /// @notice Returns the amount of KP3R the keeper has bonded\n /// @param _keeper The address of the keeper to check\n /// @return _amountBonded The amount of KP3R the keeper has bonded\n function bonds(address _keeper) external view returns (uint256 _amountBonded);\n\n /// @notice Calculates the reward (in KP3R) that corresponds to a keeper for using gas\n /// @param _keeper The address of the keeper to check\n /// @param _gasUsed The amount of gas used that will be rewarded\n /// @return _kp3r The amount of KP3R that should be awarded to the keeper\n function getRewardAmountFor(address _keeper, uint256 _gasUsed) external view returns (uint256 _kp3r);\n\n /// @notice Calculates the boost in the reward given to a keeper based on the amount of KP3R that keeper has bonded\n /// @param _bonds The amount of KP3R tokens bonded by the keeper\n /// @return _rewardBoost The reward boost that corresponds to the keeper\n function getRewardBoostFor(uint256 _bonds) external view returns (uint256 _rewardBoost);\n\n /// @notice Calculates the reward (in KP3R) that corresponds to tx.origin for using gas\n /// @param _gasUsed The amount of gas used that will be rewarded\n /// @return _amount The amount of KP3R that should be awarded to tx.origin\n function getRewardAmount(uint256 _gasUsed) external view returns (uint256 _amount);\n\n /// @notice Given a pool address, returns the underlying tokens of the pair\n /// @param _pool Address of the correspondant pool\n /// @return _token0 Address of the first token of the pair\n /// @return _token1 Address of the second token of the pair\n function getPoolTokens(address _pool) external view returns (address _token0, address _token1);\n\n /// @notice Defines the order of the tokens in the pair for twap calculations\n /// @param _pool Address of the correspondant pool\n /// @return _isKP3RToken0 Boolean indicating the order of the tokens in the pair\n function isKP3RToken0(address _pool) external view returns (bool _isKP3RToken0);\n\n /// @notice Given an array of secondsAgo, returns UniswapV3 pool cumulatives at that moment\n /// @param _pool Address of the pool to observe\n /// @param _secondsAgo Array with time references to observe\n /// @return _tickCumulative1 Cumulative sum of ticks until first time reference\n /// @return _tickCumulative2 Cumulative sum of ticks until second time reference\n /// @return _success Boolean indicating if the observe call was succesfull\n function observe(address _pool, uint32[] memory _secondsAgo)\n external\n view\n returns (\n int56 _tickCumulative1,\n int56 _tickCumulative2,\n bool _success\n );\n\n /// @notice Get multiplier, quote, and extra, in order to calculate keeper payment\n /// @param _bonds Amount of bonded KP3R owned by the keeper\n /// @return _boost Multiplier per gas unit. Takes into account the base fee and the amount of bonded KP3R\n /// @return _oneEthQuote Amount of KP3R tokens equivalent to 1 ETH\n /// @return _extra Amount of extra gas that should be added to the gas spent\n function getPaymentParams(uint256 _bonds)\n external\n view\n returns (\n uint256 _boost,\n uint256 _oneEthQuote,\n uint256 _extra\n );\n\n /// @notice Given a tick and a liquidity amount, calculates the underlying KP3R tokens\n /// @param _liquidityAmount Amount of liquidity to be converted\n /// @param _tickDifference Tick value used to calculate the quote\n /// @param _timeInterval Time value used to calculate the quote\n /// @return _kp3rAmount Amount of KP3R tokens underlying on the given liquidity\n function getKP3RsAtTick(\n uint256 _liquidityAmount,\n int56 _tickDifference,\n uint256 _timeInterval\n ) external pure returns (uint256 _kp3rAmount);\n\n /// @notice Given a tick and a token amount, calculates the output in correspondant token\n /// @param _baseAmount Amount of token to be converted\n /// @param _tickDifference Tick value used to calculate the quote\n /// @param _timeInterval Time value used to calculate the quote\n /// @return _quoteAmount Amount of credits deserved for the baseAmount at the tick value\n function getQuoteAtTick(\n uint128 _baseAmount,\n int56 _tickDifference,\n uint256 _timeInterval\n ) external pure returns (uint256 _quoteAmount);\n}\n" - }, - "solidity/interfaces/peripherals/IKeep3rParameters.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport './IBaseErrors.sol';\n\n/// @title Keep3rParameters contract\n/// @notice Handles and sets all the required parameters for Keep3r\n\ninterface IKeep3rParameters is IBaseErrors {\n // Events\n\n /// @notice Emitted when the Keep3rHelper address is changed\n /// @param _keep3rHelper The address of Keep3rHelper's contract\n event Keep3rHelperChange(address _keep3rHelper);\n\n /// @notice Emitted when the Keep3rV1 address is changed\n /// @param _keep3rV1 The address of Keep3rV1's contract\n event Keep3rV1Change(address _keep3rV1);\n\n /// @notice Emitted when the Keep3rV1Proxy address is changed\n /// @param _keep3rV1Proxy The address of Keep3rV1Proxy's contract\n event Keep3rV1ProxyChange(address _keep3rV1Proxy);\n\n /// @notice Emitted when the KP3R-WETH pool address is changed\n /// @param _kp3rWethPool The address of the KP3R-WETH pool\n event Kp3rWethPoolChange(address _kp3rWethPool);\n\n /// @notice Emitted when bondTime is changed\n /// @param _bondTime The new bondTime\n event BondTimeChange(uint256 _bondTime);\n\n /// @notice Emitted when _liquidityMinimum is changed\n /// @param _liquidityMinimum The new _liquidityMinimum\n event LiquidityMinimumChange(uint256 _liquidityMinimum);\n\n /// @notice Emitted when _unbondTime is changed\n /// @param _unbondTime The new _unbondTime\n event UnbondTimeChange(uint256 _unbondTime);\n\n /// @notice Emitted when _rewardPeriodTime is changed\n /// @param _rewardPeriodTime The new _rewardPeriodTime\n event RewardPeriodTimeChange(uint256 _rewardPeriodTime);\n\n /// @notice Emitted when the inflationPeriod is changed\n /// @param _inflationPeriod The new inflationPeriod\n event InflationPeriodChange(uint256 _inflationPeriod);\n\n /// @notice Emitted when the fee is changed\n /// @param _fee The new token credits fee\n event FeeChange(uint256 _fee);\n\n // Variables\n\n /// @notice Address of Keep3rHelper's contract\n /// @return _keep3rHelper The address of Keep3rHelper's contract\n function keep3rHelper() external view returns (address _keep3rHelper);\n\n /// @notice Address of Keep3rV1's contract\n /// @return _keep3rV1 The address of Keep3rV1's contract\n function keep3rV1() external view returns (address _keep3rV1);\n\n /// @notice Address of Keep3rV1Proxy's contract\n /// @return _keep3rV1Proxy The address of Keep3rV1Proxy's contract\n function keep3rV1Proxy() external view returns (address _keep3rV1Proxy);\n\n /// @notice Address of the KP3R-WETH pool\n /// @return _kp3rWethPool The address of KP3R-WETH pool\n function kp3rWethPool() external view returns (address _kp3rWethPool);\n\n /// @notice The amount of time required to pass after a keeper has bonded assets for it to be able to activate\n /// @return _days The required bondTime in days\n function bondTime() external view returns (uint256 _days);\n\n /// @notice The amount of time required to pass before a keeper can unbond what he has bonded\n /// @return _days The required unbondTime in days\n function unbondTime() external view returns (uint256 _days);\n\n /// @notice The minimum amount of liquidity required to fund a job per liquidity\n /// @return _amount The minimum amount of liquidity in KP3R\n function liquidityMinimum() external view returns (uint256 _amount);\n\n /// @notice The amount of time between each scheduled credits reward given to a job\n /// @return _days The reward period in days\n function rewardPeriodTime() external view returns (uint256 _days);\n\n /// @notice The inflation period is the denominator used to regulate the emission of KP3R\n /// @return _period The denominator used to regulate the emission of KP3R\n function inflationPeriod() external view returns (uint256 _period);\n\n /// @notice The fee to be sent to governance when a user adds liquidity to a job\n /// @return _amount The fee amount to be sent to governance when a user adds liquidity to a job\n function fee() external view returns (uint256 _amount);\n\n // Errors\n\n /// @notice Throws if the reward period is less than the minimum reward period time\n error MinRewardPeriod();\n\n /// @notice Throws if either a job or a keeper is disputed\n error Disputed();\n\n /// @notice Throws if there are no bonded assets\n error BondsUnexistent();\n\n /// @notice Throws if the time required to bond an asset has not passed yet\n error BondsLocked();\n\n /// @notice Throws if there are no bonds to withdraw\n error UnbondsUnexistent();\n\n /// @notice Throws if the time required to withdraw the bonds has not passed yet\n error UnbondsLocked();\n\n // Methods\n\n /// @notice Sets the Keep3rHelper address\n /// @param _keep3rHelper The Keep3rHelper address\n function setKeep3rHelper(address _keep3rHelper) external;\n\n /// @notice Sets the Keep3rV1 address\n /// @param _keep3rV1 The Keep3rV1 address\n function setKeep3rV1(address _keep3rV1) external;\n\n /// @notice Sets the Keep3rV1Proxy address\n /// @param _keep3rV1Proxy The Keep3rV1Proxy address\n function setKeep3rV1Proxy(address _keep3rV1Proxy) external;\n\n /// @notice Sets the KP3R-WETH pool address\n /// @param _kp3rWethPool The KP3R-WETH pool address\n function setKp3rWethPool(address _kp3rWethPool) external;\n\n /// @notice Sets the bond time required to activate as a keeper\n /// @param _bond The new bond time\n function setBondTime(uint256 _bond) external;\n\n /// @notice Sets the unbond time required unbond what has been bonded\n /// @param _unbond The new unbond time\n function setUnbondTime(uint256 _unbond) external;\n\n /// @notice Sets the minimum amount of liquidity required to fund a job\n /// @param _liquidityMinimum The new minimum amount of liquidity\n function setLiquidityMinimum(uint256 _liquidityMinimum) external;\n\n /// @notice Sets the time required to pass between rewards for jobs\n /// @param _rewardPeriodTime The new amount of time required to pass between rewards\n function setRewardPeriodTime(uint256 _rewardPeriodTime) external;\n\n /// @notice Sets the new inflation period\n /// @param _inflationPeriod The new inflation period\n function setInflationPeriod(uint256 _inflationPeriod) external;\n\n /// @notice Sets the new fee\n /// @param _fee The new fee\n function setFee(uint256 _fee) external;\n}\n" - }, - "solidity/interfaces/peripherals/IBaseErrors.sol": { - "content": "// SPDX-License-Identifier: MIT\n\npragma solidity >=0.8.4 <0.9.0;\n\ninterface IBaseErrors {\n /// @notice Throws if a variable is assigned to the zero address\n error ZeroAddress();\n}\n" - }, - "solidity/interfaces/peripherals/IKeep3rRoles.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\n/// @title Keep3rRoles contract\n/// @notice Manages the Keep3r specific roles\ninterface IKeep3rRoles {\n // Events\n\n /// @notice Emitted when a slasher is added\n /// @param _slasher Address of the added slasher\n event SlasherAdded(address _slasher);\n\n /// @notice Emitted when a slasher is removed\n /// @param _slasher Address of the removed slasher\n event SlasherRemoved(address _slasher);\n\n /// @notice Emitted when a disputer is added\n /// @param _disputer Address of the added disputer\n event DisputerAdded(address _disputer);\n\n /// @notice Emitted when a disputer is removed\n /// @param _disputer Address of the removed disputer\n event DisputerRemoved(address _disputer);\n\n // Variables\n\n /// @notice Tracks whether the address is a slasher or not\n /// @param _slasher Address being checked as a slasher\n /// @return _isSlasher Whether the address is a slasher or not\n function slashers(address _slasher) external view returns (bool _isSlasher);\n\n /// @notice Tracks whether the address is a disputer or not\n /// @param _disputer Address being checked as a disputer\n /// @return _isDisputer Whether the address is a disputer or not\n function disputers(address _disputer) external view returns (bool _isDisputer);\n\n // Errors\n\n /// @notice Throws if the address is already a registered slasher\n error SlasherExistent();\n\n /// @notice Throws if caller is not a registered slasher\n error SlasherUnexistent();\n\n /// @notice Throws if the address is already a registered disputer\n error DisputerExistent();\n\n /// @notice Throws if caller is not a registered disputer\n error DisputerUnexistent();\n\n /// @notice Throws if the msg.sender is not a slasher or is not a part of governance\n error OnlySlasher();\n\n /// @notice Throws if the msg.sender is not a disputer or is not a part of governance\n error OnlyDisputer();\n\n // Methods\n\n /// @notice Registers a slasher by updating the slashers mapping\n function addSlasher(address _slasher) external;\n\n /// @notice Removes a slasher by updating the slashers mapping\n function removeSlasher(address _slasher) external;\n\n /// @notice Registers a disputer by updating the disputers mapping\n function addDisputer(address _disputer) external;\n\n /// @notice Removes a disputer by updating the disputers mapping\n function removeDisputer(address _disputer) external;\n}\n" - }, - "solidity/contracts/peripherals/Governable.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../../interfaces/peripherals/IGovernable.sol';\n\nabstract contract Governable is IGovernable {\n /// @inheritdoc IGovernable\n address public override governance;\n\n /// @inheritdoc IGovernable\n address public override pendingGovernance;\n\n constructor(address _governance) {\n if (_governance == address(0)) revert NoGovernanceZeroAddress();\n governance = _governance;\n }\n\n /// @inheritdoc IGovernable\n function setGovernance(address _governance) external override onlyGovernance {\n pendingGovernance = _governance;\n emit GovernanceProposal(_governance);\n }\n\n /// @inheritdoc IGovernable\n function acceptGovernance() external override onlyPendingGovernance {\n governance = pendingGovernance;\n delete pendingGovernance;\n emit GovernanceSet(governance);\n }\n\n /// @notice Functions with this modifier can only be called by governance\n modifier onlyGovernance {\n if (msg.sender != governance) revert OnlyGovernance();\n _;\n }\n\n /// @notice Functions with this modifier can only be called by pendingGovernance\n modifier onlyPendingGovernance {\n if (msg.sender != pendingGovernance) revert OnlyPendingGovernance();\n _;\n }\n}\n" - }, - "solidity/interfaces/peripherals/IGovernable.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\n/// @title Governable contract\n/// @notice Manages the governance role\ninterface IGovernable {\n // Events\n\n /// @notice Emitted when pendingGovernance accepts to be governance\n /// @param _governance Address of the new governance\n event GovernanceSet(address _governance);\n\n /// @notice Emitted when a new governance is proposed\n /// @param _pendingGovernance Address that is proposed to be the new governance\n event GovernanceProposal(address _pendingGovernance);\n\n // Errors\n\n /// @notice Throws if the caller of the function is not governance\n error OnlyGovernance();\n\n /// @notice Throws if the caller of the function is not pendingGovernance\n error OnlyPendingGovernance();\n\n /// @notice Throws if trying to set governance to zero address\n error NoGovernanceZeroAddress();\n\n // Variables\n\n /// @notice Stores the governance address\n /// @return _governance The governance addresss\n function governance() external view returns (address _governance);\n\n /// @notice Stores the pendingGovernance address\n /// @return _pendingGovernance The pendingGovernance addresss\n function pendingGovernance() external view returns (address _pendingGovernance);\n\n // Methods\n\n /// @notice Proposes a new address to be governance\n /// @param _governance The address being proposed as the new governance\n function setGovernance(address _governance) external;\n\n /// @notice Changes the governance from the current governance to the previously proposed address\n function acceptGovernance() external;\n}\n" - }, - "@openzeppelin/contracts/utils/Address.sol": { - "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Collection of functions related to the address type\n */\nlibrary Address {\n /**\n * @dev Returns true if `account` is a contract.\n *\n * [IMPORTANT]\n * ====\n * It is unsafe to assume that an address for which this function returns\n * false is an externally-owned account (EOA) and not a contract.\n *\n * Among others, `isContract` will return false for the following\n * types of addresses:\n *\n * - an externally-owned account\n * - a contract in construction\n * - an address where a contract will be created\n * - an address where a contract lived, but was destroyed\n * ====\n */\n function isContract(address account) internal view returns (bool) {\n // This method relies on extcodesize, which returns 0 for contracts in\n // construction, since the code is only stored at the end of the\n // constructor execution.\n\n uint256 size;\n assembly {\n size := extcodesize(account)\n }\n return size > 0;\n }\n\n /**\n * @dev Replacement for Solidity's `transfer`: sends `amount` wei to\n * `recipient`, forwarding all available gas and reverting on errors.\n *\n * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost\n * of certain opcodes, possibly making contracts go over the 2300 gas limit\n * imposed by `transfer`, making them unable to receive funds via\n * `transfer`. {sendValue} removes this limitation.\n *\n * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].\n *\n * IMPORTANT: because control is transferred to `recipient`, care must be\n * taken to not create reentrancy vulnerabilities. Consider using\n * {ReentrancyGuard} or the\n * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].\n */\n function sendValue(address payable recipient, uint256 amount) internal {\n require(address(this).balance >= amount, \"Address: insufficient balance\");\n\n (bool success, ) = recipient.call{value: amount}(\"\");\n require(success, \"Address: unable to send value, recipient may have reverted\");\n }\n\n /**\n * @dev Performs a Solidity function call using a low level `call`. A\n * plain `call` is an unsafe replacement for a function call: use this\n * function instead.\n *\n * If `target` reverts with a revert reason, it is bubbled up by this\n * function (like regular Solidity function calls).\n *\n * Returns the raw returned data. To convert to the expected return value,\n * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\n *\n * Requirements:\n *\n * - `target` must be a contract.\n * - calling `target` with `data` must not revert.\n *\n * _Available since v3.1._\n */\n function functionCall(address target, bytes memory data) internal returns (bytes memory) {\n return functionCall(target, data, \"Address: low-level call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with\n * `errorMessage` as a fallback revert reason when `target` reverts.\n *\n * _Available since v3.1._\n */\n function functionCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal returns (bytes memory) {\n return functionCallWithValue(target, data, 0, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but also transferring `value` wei to `target`.\n *\n * Requirements:\n *\n * - the calling contract must have an ETH balance of at least `value`.\n * - the called Solidity function must be `payable`.\n *\n * _Available since v3.1._\n */\n function functionCallWithValue(\n address target,\n bytes memory data,\n uint256 value\n ) internal returns (bytes memory) {\n return functionCallWithValue(target, data, value, \"Address: low-level call with value failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but\n * with `errorMessage` as a fallback revert reason when `target` reverts.\n *\n * _Available since v3.1._\n */\n function functionCallWithValue(\n address target,\n bytes memory data,\n uint256 value,\n string memory errorMessage\n ) internal returns (bytes memory) {\n require(address(this).balance >= value, \"Address: insufficient balance for call\");\n require(isContract(target), \"Address: call to non-contract\");\n\n (bool success, bytes memory returndata) = target.call{value: value}(data);\n return verifyCallResult(success, returndata, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but performing a static call.\n *\n * _Available since v3.3._\n */\n function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\n return functionStaticCall(target, data, \"Address: low-level static call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\n * but performing a static call.\n *\n * _Available since v3.3._\n */\n function functionStaticCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal view returns (bytes memory) {\n require(isContract(target), \"Address: static call to non-contract\");\n\n (bool success, bytes memory returndata) = target.staticcall(data);\n return verifyCallResult(success, returndata, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but performing a delegate call.\n *\n * _Available since v3.4._\n */\n function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {\n return functionDelegateCall(target, data, \"Address: low-level delegate call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\n * but performing a delegate call.\n *\n * _Available since v3.4._\n */\n function functionDelegateCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal returns (bytes memory) {\n require(isContract(target), \"Address: delegate call to non-contract\");\n\n (bool success, bytes memory returndata) = target.delegatecall(data);\n return verifyCallResult(success, returndata, errorMessage);\n }\n\n /**\n * @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the\n * revert reason using the provided one.\n *\n * _Available since v4.3._\n */\n function verifyCallResult(\n bool success,\n bytes memory returndata,\n string memory errorMessage\n ) internal pure returns (bytes memory) {\n if (success) {\n return returndata;\n } else {\n // Look for revert reason and bubble it up if present\n if (returndata.length > 0) {\n // The easiest way to bubble the revert reason is using memory via assembly\n\n assembly {\n let returndata_size := mload(returndata)\n revert(add(32, returndata), returndata_size)\n }\n } else {\n revert(errorMessage);\n }\n }\n }\n}\n" - }, - "solidity/interfaces/IPairManager.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol';\n\n/// @title Pair Manager interface\n/// @notice Generic interface for Keep3r liquidity pools (kLP)\ninterface IPairManager is IERC20Metadata {\n /// @notice Address of the factory from which the pair manager was created\n /// @return _factory The address of the PairManager Factory\n function factory() external view returns (address _factory);\n\n /// @notice Address of the pool from which the Keep3r pair manager will interact with\n /// @return _pool The address of the pool\n function pool() external view returns (address _pool);\n\n /// @notice Token0 of the pool\n /// @return _token0 The address of token0\n function token0() external view returns (address _token0);\n\n /// @notice Token1 of the pool\n /// @return _token1 The address of token1\n function token1() external view returns (address _token1);\n}\n" - }, - "solidity/contracts/libraries/FullMath.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\n/// @title Contains 512-bit math functions\n/// @notice Facilitates multiplication and division that can have overflow of an intermediate value without any loss of precision\n/// @dev Handles \"phantom overflow\" i.e., allows multiplication and division where an intermediate value overflows 256 bits\nlibrary FullMath {\n /// @notice Calculates floor(a×b÷denominator) with full precision. Throws if result overflows a uint256 or denominator == 0\n /// @param a The multiplicand\n /// @param b The multiplier\n /// @param denominator The divisor\n /// @return result The 256-bit result\n /// @dev Credit to Remco Bloemen under MIT license https://xn--2-umb.com/21/muldiv\n function mulDiv(\n uint256 a,\n uint256 b,\n uint256 denominator\n ) internal pure returns (uint256 result) {\n unchecked {\n // 512-bit multiply [prod1 prod0] = a * b\n // Compute the product mod 2**256 and mod 2**256 - 1\n // then use the Chinese Remainder Theorem to reconstruct\n // the 512 bit result. The result is stored in two 256\n // variables such that product = prod1 * 2**256 + prod0\n uint256 prod0; // Least significant 256 bits of the product\n uint256 prod1; // Most significant 256 bits of the product\n assembly {\n let mm := mulmod(a, b, not(0))\n prod0 := mul(a, b)\n prod1 := sub(sub(mm, prod0), lt(mm, prod0))\n }\n\n // Handle non-overflow cases, 256 by 256 division\n if (prod1 == 0) {\n require(denominator > 0);\n assembly {\n result := div(prod0, denominator)\n }\n return result;\n }\n\n // Make sure the result is less than 2**256.\n // Also prevents denominator == 0\n require(denominator > prod1);\n\n ///////////////////////////////////////////////\n // 512 by 256 division.\n ///////////////////////////////////////////////\n\n // Make division exact by subtracting the remainder from [prod1 prod0]\n // Compute remainder using mulmod\n uint256 remainder;\n assembly {\n remainder := mulmod(a, b, denominator)\n }\n // Subtract 256 bit number from 512 bit number\n assembly {\n prod1 := sub(prod1, gt(remainder, prod0))\n prod0 := sub(prod0, remainder)\n }\n\n // Factor powers of two out of denominator\n // Compute largest power of two divisor of denominator.\n // Always >= 1.\n uint256 twos = (~denominator + 1) & denominator;\n // Divide denominator by power of two\n assembly {\n denominator := div(denominator, twos)\n }\n\n // Divide [prod1 prod0] by the factors of two\n assembly {\n prod0 := div(prod0, twos)\n }\n // Shift in bits from prod1 into prod0. For this we need\n // to flip `twos` such that it is 2**256 / twos.\n // If twos is zero, then it becomes one\n assembly {\n twos := add(div(sub(0, twos), twos), 1)\n }\n prod0 |= prod1 * twos;\n\n // Invert denominator mod 2**256\n // Now that denominator is an odd number, it has an inverse\n // modulo 2**256 such that denominator * inv = 1 mod 2**256.\n // Compute the inverse by starting with a seed that is correct\n // correct for four bits. That is, denominator * inv = 1 mod 2**4\n uint256 inv = (3 * denominator) ^ 2;\n // Now use Newton-Raphson iteration to improve the precision.\n // Thanks to Hensel's lifting lemma, this also works in modular\n // arithmetic, doubling the correct bits in each step.\n inv *= 2 - denominator * inv; // inverse mod 2**8\n inv *= 2 - denominator * inv; // inverse mod 2**16\n inv *= 2 - denominator * inv; // inverse mod 2**32\n inv *= 2 - denominator * inv; // inverse mod 2**64\n inv *= 2 - denominator * inv; // inverse mod 2**128\n inv *= 2 - denominator * inv; // inverse mod 2**256\n\n // Because the division is now exact we can divide by multiplying\n // with the modular inverse of denominator. This will give us the\n // correct result modulo 2**256. Since the precoditions guarantee\n // that the outcome is less than 2**256, this is the final result.\n // We don't need to compute the high bits of the result and prod1\n // is no longer required.\n result = prod0 * inv;\n return result;\n }\n }\n\n /// @notice Calculates ceil(a×b÷denominator) with full precision. Throws if result overflows a uint256 or denominator == 0\n /// @param a The multiplicand\n /// @param b The multiplier\n /// @param denominator The divisor\n /// @return result The 256-bit result\n function mulDivRoundingUp(\n uint256 a,\n uint256 b,\n uint256 denominator\n ) internal pure returns (uint256 result) {\n unchecked {\n result = mulDiv(a, b, denominator);\n if (mulmod(a, b, denominator) > 0) {\n require(result < type(uint256).max);\n result++;\n }\n }\n }\n}\n" - }, - "@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol": { - "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\nimport \"../IERC20.sol\";\n\n/**\n * @dev Interface for the optional metadata functions from the ERC20 standard.\n *\n * _Available since v4.1._\n */\ninterface IERC20Metadata is IERC20 {\n /**\n * @dev Returns the name of the token.\n */\n function name() external view returns (string memory);\n\n /**\n * @dev Returns the symbol of the token.\n */\n function symbol() external view returns (string memory);\n\n /**\n * @dev Returns the decimals places of the token.\n */\n function decimals() external view returns (uint8);\n}\n" - }, - "solidity/interfaces/peripherals/IKeep3rDisputable.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\n/// @title Keep3rDisputable contract\n/// @notice Creates/resolves disputes for jobs or keepers\n/// A disputed keeper is slashable and is not able to bond, activate, withdraw or receive direct payments\n/// A disputed job is slashable and is not able to pay the keepers, withdraw tokens or to migrate\ninterface IKeep3rDisputable {\n /// @notice Emitted when a keeper or a job is disputed\n /// @param _jobOrKeeper The address of the disputed keeper/job\n /// @param _disputer The user that called the function and disputed the keeper\n event Dispute(address indexed _jobOrKeeper, address indexed _disputer);\n\n /// @notice Emitted when a dispute is resolved\n /// @param _jobOrKeeper The address of the disputed keeper/job\n /// @param _resolver The user that called the function and resolved the dispute\n event Resolve(address indexed _jobOrKeeper, address indexed _resolver);\n\n /// @notice Throws when a job or keeper is already disputed\n error AlreadyDisputed();\n\n /// @notice Throws when a job or keeper is not disputed and someone tries to resolve the dispute\n error NotDisputed();\n\n /// @notice Allows governance to create a dispute for a given keeper/job\n /// @param _jobOrKeeper The address in dispute\n function dispute(address _jobOrKeeper) external;\n\n /// @notice Allows governance to resolve a dispute on a keeper/job\n /// @param _jobOrKeeper The address cleared\n function resolve(address _jobOrKeeper) external;\n}\n" - }, - "solidity/contracts/peripherals/jobs/Keep3rJobMigration.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../../../interfaces/peripherals/IKeep3rJobs.sol';\nimport './Keep3rJobFundableCredits.sol';\nimport './Keep3rJobFundableLiquidity.sol';\n\nabstract contract Keep3rJobMigration is IKeep3rJobMigration, Keep3rJobFundableCredits, Keep3rJobFundableLiquidity {\n using EnumerableSet for EnumerableSet.AddressSet;\n\n uint256 internal constant _MIGRATION_COOLDOWN = 1 minutes;\n\n /// @inheritdoc IKeep3rJobMigration\n mapping(address => address) public override pendingJobMigrations;\n mapping(address => mapping(address => uint256)) internal _migrationCreatedAt;\n\n /// @inheritdoc IKeep3rJobMigration\n function migrateJob(address _fromJob, address _toJob) external override onlyJobOwner(_fromJob) {\n if (_fromJob == _toJob) revert JobMigrationImpossible();\n\n pendingJobMigrations[_fromJob] = _toJob;\n _migrationCreatedAt[_fromJob][_toJob] = block.timestamp;\n\n emit JobMigrationRequested(_fromJob, _toJob);\n }\n\n /// @inheritdoc IKeep3rJobMigration\n function acceptJobMigration(address _fromJob, address _toJob) external override onlyJobOwner(_toJob) {\n if (disputes[_fromJob] || disputes[_toJob]) revert JobDisputed();\n if (pendingJobMigrations[_fromJob] != _toJob) revert JobMigrationUnavailable();\n if (block.timestamp < _migrationCreatedAt[_fromJob][_toJob] + _MIGRATION_COOLDOWN) revert JobMigrationLocked();\n\n // force job credits update for both jobs\n _settleJobAccountance(_fromJob);\n _settleJobAccountance(_toJob);\n\n // migrate tokens\n while (_jobTokens[_fromJob].length() > 0) {\n address _tokenToMigrate = _jobTokens[_fromJob].at(0);\n jobTokenCredits[_toJob][_tokenToMigrate] += jobTokenCredits[_fromJob][_tokenToMigrate];\n delete jobTokenCredits[_fromJob][_tokenToMigrate];\n _jobTokens[_fromJob].remove(_tokenToMigrate);\n _jobTokens[_toJob].add(_tokenToMigrate);\n }\n\n // migrate liquidities\n while (_jobLiquidities[_fromJob].length() > 0) {\n address _liquidity = _jobLiquidities[_fromJob].at(0);\n\n liquidityAmount[_toJob][_liquidity] += liquidityAmount[_fromJob][_liquidity];\n delete liquidityAmount[_fromJob][_liquidity];\n\n _jobLiquidities[_toJob].add(_liquidity);\n _jobLiquidities[_fromJob].remove(_liquidity);\n }\n\n // migrate job balances\n _jobPeriodCredits[_toJob] += _jobPeriodCredits[_fromJob];\n delete _jobPeriodCredits[_fromJob];\n\n _jobLiquidityCredits[_toJob] += _jobLiquidityCredits[_fromJob];\n delete _jobLiquidityCredits[_fromJob];\n\n // stop _fromJob from being a job\n delete rewardedAt[_fromJob];\n _jobs.remove(_fromJob);\n\n // delete unused data slots\n delete jobOwner[_fromJob];\n delete jobPendingOwner[_fromJob];\n delete _migrationCreatedAt[_fromJob][_toJob];\n delete pendingJobMigrations[_fromJob];\n\n emit JobMigrationSuccessful(_fromJob, _toJob);\n }\n}\n" - }, - "solidity/contracts/peripherals/keepers/Keep3rKeeperDisputable.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport './Keep3rKeeperFundable.sol';\nimport '../Keep3rDisputable.sol';\nimport '../../../interfaces/external/IKeep3rV1.sol';\nimport '../../../interfaces/peripherals/IKeep3rKeepers.sol';\n\nabstract contract Keep3rKeeperDisputable is IKeep3rKeeperDisputable, Keep3rDisputable, Keep3rKeeperFundable {\n using EnumerableSet for EnumerableSet.AddressSet;\n using SafeERC20 for IERC20;\n\n /// @inheritdoc IKeep3rKeeperDisputable\n function slash(\n address _keeper,\n address _bonded,\n uint256 _bondAmount,\n uint256 _unbondAmount\n ) public override onlySlasher {\n if (!disputes[_keeper]) revert NotDisputed();\n _slash(_keeper, _bonded, _bondAmount, _unbondAmount);\n emit KeeperSlash(_keeper, msg.sender, _bondAmount + _unbondAmount);\n }\n\n /// @inheritdoc IKeep3rKeeperDisputable\n function revoke(address _keeper) external override onlySlasher {\n if (!disputes[_keeper]) revert NotDisputed();\n _keepers.remove(_keeper);\n _slash(_keeper, keep3rV1, bonds[_keeper][keep3rV1], pendingUnbonds[_keeper][keep3rV1]);\n emit KeeperRevoke(_keeper, msg.sender);\n }\n\n function _slash(\n address _keeper,\n address _bonded,\n uint256 _bondAmount,\n uint256 _unbondAmount\n ) internal {\n if (_bonded != keep3rV1) {\n try IERC20(_bonded).transfer(governance, _bondAmount + _unbondAmount) returns (bool) {} catch (bytes memory) {}\n }\n bonds[_keeper][_bonded] -= _bondAmount;\n pendingUnbonds[_keeper][_bonded] -= _unbondAmount;\n }\n}\n" - }, - "solidity/contracts/peripherals/keepers/Keep3rKeeperFundable.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../Keep3rAccountance.sol';\nimport '../Keep3rParameters.sol';\nimport '../../../interfaces/peripherals/IKeep3rKeepers.sol';\n\nimport '../../../interfaces/external/IKeep3rV1.sol';\nimport '../../../interfaces/external/IKeep3rV1Proxy.sol';\n\nimport '@openzeppelin/contracts/security/ReentrancyGuard.sol';\nimport '@openzeppelin/contracts/token/ERC20/IERC20.sol';\nimport '@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol';\n\nabstract contract Keep3rKeeperFundable is IKeep3rKeeperFundable, ReentrancyGuard, Keep3rParameters {\n using EnumerableSet for EnumerableSet.AddressSet;\n using SafeERC20 for IERC20;\n\n /// @inheritdoc IKeep3rKeeperFundable\n function bond(address _bonding, uint256 _amount) external override nonReentrant {\n if (disputes[msg.sender]) revert Disputed();\n if (_jobs.contains(msg.sender)) revert AlreadyAJob();\n canActivateAfter[msg.sender][_bonding] = block.timestamp + bondTime;\n\n uint256 _before = IERC20(_bonding).balanceOf(address(this));\n IERC20(_bonding).safeTransferFrom(msg.sender, address(this), _amount);\n _amount = IERC20(_bonding).balanceOf(address(this)) - _before;\n\n hasBonded[msg.sender] = true;\n pendingBonds[msg.sender][_bonding] += _amount;\n\n emit Bonding(msg.sender, _bonding, _amount);\n }\n\n /// @inheritdoc IKeep3rKeeperFundable\n function activate(address _bonding) external override {\n if (disputes[msg.sender]) revert Disputed();\n if (canActivateAfter[msg.sender][_bonding] == 0) revert BondsUnexistent();\n if (canActivateAfter[msg.sender][_bonding] >= block.timestamp) revert BondsLocked();\n\n delete canActivateAfter[msg.sender][_bonding];\n\n uint256 _amount = _activate(msg.sender, _bonding);\n emit Activation(msg.sender, _bonding, _amount);\n }\n\n /// @inheritdoc IKeep3rKeeperFundable\n function unbond(address _bonding, uint256 _amount) external override {\n canWithdrawAfter[msg.sender][_bonding] = block.timestamp + unbondTime;\n bonds[msg.sender][_bonding] -= _amount;\n pendingUnbonds[msg.sender][_bonding] += _amount;\n\n emit Unbonding(msg.sender, _bonding, _amount);\n }\n\n /// @inheritdoc IKeep3rKeeperFundable\n function withdraw(address _bonding) external override nonReentrant {\n if (pendingUnbonds[msg.sender][_bonding] == 0) revert UnbondsUnexistent();\n if (canWithdrawAfter[msg.sender][_bonding] >= block.timestamp) revert UnbondsLocked();\n if (disputes[msg.sender]) revert Disputed();\n\n uint256 _amount = pendingUnbonds[msg.sender][_bonding];\n\n if (_bonding == keep3rV1) {\n IKeep3rV1Proxy(keep3rV1Proxy).mint(_amount);\n }\n\n delete pendingUnbonds[msg.sender][_bonding];\n delete canWithdrawAfter[msg.sender][_bonding];\n\n IERC20(_bonding).safeTransfer(msg.sender, _amount);\n\n emit Withdrawal(msg.sender, _bonding, _amount);\n }\n\n function _activate(address _keeper, address _bonding) internal returns (uint256 _amount) {\n if (firstSeen[_keeper] == 0) {\n firstSeen[_keeper] = block.timestamp;\n }\n _keepers.add(_keeper);\n _amount = pendingBonds[_keeper][_bonding];\n delete pendingBonds[_keeper][_bonding];\n\n // bond provided tokens\n bonds[_keeper][_bonding] += _amount;\n if (_bonding == keep3rV1) {\n IKeep3rV1(keep3rV1).burn(_amount);\n }\n }\n}\n" - }, - "solidity/interfaces/external/IKeep3rV1.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '@openzeppelin/contracts/token/ERC20/IERC20.sol';\nimport '@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol';\n\n// solhint-disable func-name-mixedcase\ninterface IKeep3rV1 is IERC20, IERC20Metadata {\n // Structs\n struct Checkpoint {\n uint32 fromBlock;\n uint256 votes;\n }\n\n // Events\n event DelegateChanged(address indexed _delegator, address indexed _fromDelegate, address indexed _toDelegate);\n event DelegateVotesChanged(address indexed _delegate, uint256 _previousBalance, uint256 _newBalance);\n event SubmitJob(address indexed _job, address indexed _liquidity, address indexed _provider, uint256 _block, uint256 _credit);\n event ApplyCredit(address indexed _job, address indexed _liquidity, address indexed _provider, uint256 _block, uint256 _credit);\n event RemoveJob(address indexed _job, address indexed _liquidity, address indexed _provider, uint256 _block, uint256 _credit);\n event UnbondJob(address indexed _job, address indexed _liquidity, address indexed _provider, uint256 _block, uint256 _credit);\n event JobAdded(address indexed _job, uint256 _block, address _governance);\n event JobRemoved(address indexed _job, uint256 _block, address _governance);\n event KeeperWorked(address indexed _credit, address indexed _job, address indexed _keeper, uint256 _block, uint256 _amount);\n event KeeperBonding(address indexed _keeper, uint256 _block, uint256 _active, uint256 _bond);\n event KeeperBonded(address indexed _keeper, uint256 _block, uint256 _activated, uint256 _bond);\n event KeeperUnbonding(address indexed _keeper, uint256 _block, uint256 _deactive, uint256 _bond);\n event KeeperUnbound(address indexed _keeper, uint256 _block, uint256 _deactivated, uint256 _bond);\n event KeeperSlashed(address indexed _keeper, address indexed _slasher, uint256 _block, uint256 _slash);\n event KeeperDispute(address indexed _keeper, uint256 _block);\n event KeeperResolved(address indexed _keeper, uint256 _block);\n event TokenCreditAddition(address indexed _credit, address indexed _job, address indexed _creditor, uint256 _block, uint256 _amount);\n\n // Variables\n function KPRH() external returns (address);\n\n function delegates(address _delegator) external view returns (address);\n\n function checkpoints(address _account, uint32 _checkpoint) external view returns (Checkpoint memory);\n\n function numCheckpoints(address _account) external view returns (uint32);\n\n function DOMAIN_TYPEHASH() external returns (bytes32);\n\n function DOMAINSEPARATOR() external returns (bytes32);\n\n function DELEGATION_TYPEHASH() external returns (bytes32);\n\n function PERMIT_TYPEHASH() external returns (bytes32);\n\n function nonces(address _user) external view returns (uint256);\n\n function BOND() external returns (uint256);\n\n function UNBOND() external returns (uint256);\n\n function LIQUIDITYBOND() external returns (uint256);\n\n function FEE() external returns (uint256);\n\n function BASE() external returns (uint256);\n\n function ETH() external returns (address);\n\n function bondings(address _user, address _bonding) external view returns (uint256);\n\n function canWithdrawAfter(address _user, address _bonding) external view returns (uint256);\n\n function pendingUnbonds(address _keeper, address _bonding) external view returns (uint256);\n\n function pendingbonds(address _keeper, address _bonding) external view returns (uint256);\n\n function bonds(address _keeper, address _bonding) external view returns (uint256);\n\n function votes(address _delegator) external view returns (uint256);\n\n function firstSeen(address _keeper) external view returns (uint256);\n\n function disputes(address _keeper) external view returns (bool);\n\n function lastJob(address _keeper) external view returns (uint256);\n\n function workCompleted(address _keeper) external view returns (uint256);\n\n function jobs(address _job) external view returns (bool);\n\n function credits(address _job, address _credit) external view returns (uint256);\n\n function liquidityProvided(\n address _provider,\n address _liquidity,\n address _job\n ) external view returns (uint256);\n\n function liquidityUnbonding(\n address _provider,\n address _liquidity,\n address _job\n ) external view returns (uint256);\n\n function liquidityAmountsUnbonding(\n address _provider,\n address _liquidity,\n address _job\n ) external view returns (uint256);\n\n function jobProposalDelay(address _job) external view returns (uint256);\n\n function liquidityApplied(\n address _provider,\n address _liquidity,\n address _job\n ) external view returns (uint256);\n\n function liquidityAmount(\n address _provider,\n address _liquidity,\n address _job\n ) external view returns (uint256);\n\n function keepers(address _keeper) external view returns (bool);\n\n function blacklist(address _keeper) external view returns (bool);\n\n function keeperList(uint256 _index) external view returns (address);\n\n function jobList(uint256 _index) external view returns (address);\n\n function governance() external returns (address);\n\n function pendingGovernance() external returns (address);\n\n function liquidityAccepted(address _liquidity) external view returns (bool);\n\n function liquidityPairs(uint256 _index) external view returns (address);\n\n // Methods\n function getCurrentVotes(address _account) external view returns (uint256);\n\n function addCreditETH(address _job) external payable;\n\n function addCredit(\n address _credit,\n address _job,\n uint256 _amount\n ) external;\n\n function addVotes(address _voter, uint256 _amount) external;\n\n function removeVotes(address _voter, uint256 _amount) external;\n\n function addKPRCredit(address _job, uint256 _amount) external;\n\n function approveLiquidity(address _liquidity) external;\n\n function revokeLiquidity(address _liquidity) external;\n\n function pairs() external view returns (address[] memory);\n\n function addLiquidityToJob(\n address _liquidity,\n address _job,\n uint256 _amount\n ) external;\n\n function applyCreditToJob(\n address _provider,\n address _liquidity,\n address _job\n ) external;\n\n function unbondLiquidityFromJob(\n address _liquidity,\n address _job,\n uint256 _amount\n ) external;\n\n function removeLiquidityFromJob(address _liquidity, address _job) external;\n\n function mint(uint256 _amount) external;\n\n function burn(uint256 _amount) external;\n\n function worked(address _keeper) external;\n\n function receipt(\n address _credit,\n address _keeper,\n uint256 _amount\n ) external;\n\n function receiptETH(address _keeper, uint256 _amount) external;\n\n function addJob(address _job) external;\n\n function getJobs() external view returns (address[] memory);\n\n function removeJob(address _job) external;\n\n function setKeep3rHelper(address _keep3rHelper) external;\n\n function setGovernance(address _governance) external;\n\n function acceptGovernance() external;\n\n function isKeeper(address _keeper) external returns (bool);\n\n function isMinKeeper(\n address _keeper,\n uint256 _minBond,\n uint256 _earned,\n uint256 _age\n ) external returns (bool);\n\n function isBondedKeeper(\n address _keeper,\n address _bond,\n uint256 _minBond,\n uint256 _earned,\n uint256 _age\n ) external returns (bool);\n\n function bond(address _bonding, uint256 _amount) external;\n\n function getKeepers() external view returns (address[] memory);\n\n function activate(address _bonding) external;\n\n function unbond(address _bonding, uint256 _amount) external;\n\n function slash(\n address _bonded,\n address _keeper,\n uint256 _amount\n ) external;\n\n function withdraw(address _bonding) external;\n\n function dispute(address _keeper) external;\n\n function revoke(address _keeper) external;\n\n function resolve(address _keeper) external;\n\n function permit(\n address _owner,\n address _spender,\n uint256 _amount,\n uint256 _deadline,\n uint8 _v,\n bytes32 _r,\n bytes32 _s\n ) external;\n}\n" - }, - "solidity/interfaces/peripherals/IKeep3rKeepers.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\n/// @title Keep3rKeeperFundable contract\n/// @notice Handles the actions required to become a keeper\ninterface IKeep3rKeeperFundable {\n // Events\n\n /// @notice Emitted when Keep3rKeeperFundable#activate is called\n /// @param _keeper The keeper that has been activated\n /// @param _bond The asset the keeper has bonded\n /// @param _amount The amount of the asset the keeper has bonded\n event Activation(address indexed _keeper, address indexed _bond, uint256 _amount);\n\n /// @notice Emitted when Keep3rKeeperFundable#withdraw is called\n /// @param _keeper The caller of Keep3rKeeperFundable#withdraw function\n /// @param _bond The asset to withdraw from the bonding pool\n /// @param _amount The amount of funds withdrawn\n event Withdrawal(address indexed _keeper, address indexed _bond, uint256 _amount);\n\n // Errors\n\n /// @notice Throws when the address that is trying to register as a job is already a job\n error AlreadyAJob();\n\n // Methods\n\n /// @notice Beginning of the bonding process\n /// @param _bonding The asset being bonded\n /// @param _amount The amount of bonding asset being bonded\n function bond(address _bonding, uint256 _amount) external;\n\n /// @notice Beginning of the unbonding process\n /// @param _bonding The asset being unbonded\n /// @param _amount Allows for partial unbonding\n function unbond(address _bonding, uint256 _amount) external;\n\n /// @notice End of the bonding process after bonding time has passed\n /// @param _bonding The asset being activated as bond collateral\n function activate(address _bonding) external;\n\n /// @notice Withdraw funds after unbonding has finished\n /// @param _bonding The asset to withdraw from the bonding pool\n function withdraw(address _bonding) external;\n}\n\n/// @title Keep3rKeeperDisputable contract\n/// @notice Handles the actions that can be taken on a disputed keeper\ninterface IKeep3rKeeperDisputable {\n // Events\n\n /// @notice Emitted when Keep3rKeeperDisputable#slash is called\n /// @param _keeper The address of the slashed keeper\n /// @param _slasher The user that called Keep3rKeeperDisputable#slash\n /// @param _amount The amount of credits slashed from the keeper\n event KeeperSlash(address indexed _keeper, address indexed _slasher, uint256 _amount);\n\n /// @notice Emitted when Keep3rKeeperDisputable#revoke is called\n /// @param _keeper The address of the revoked keeper\n /// @param _slasher The user that called Keep3rKeeperDisputable#revoke\n event KeeperRevoke(address indexed _keeper, address indexed _slasher);\n\n // Methods\n\n /// @notice Allows governance to slash a keeper based on a dispute\n /// @param _keeper The address being slashed\n /// @param _bonded The asset being slashed\n /// @param _bondAmount The bonded amount being slashed\n /// @param _unbondAmount The pending unbond amount being slashed\n function slash(\n address _keeper,\n address _bonded,\n uint256 _bondAmount,\n uint256 _unbondAmount\n ) external;\n\n /// @notice Blacklists a keeper from participating in the network\n /// @param _keeper The address being slashed\n function revoke(address _keeper) external;\n}\n\n// solhint-disable-next-line no-empty-blocks\n\n/// @title Keep3rKeepers contract\ninterface IKeep3rKeepers is IKeep3rKeeperDisputable {\n\n}\n" - }, - "solidity/interfaces/external/IKeep3rV1Proxy.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../peripherals/IGovernable.sol';\n\ninterface IKeep3rV1Proxy is IGovernable {\n // Structs\n struct Recipient {\n address recipient;\n uint256 caps;\n }\n\n // Variables\n function keep3rV1() external view returns (address);\n\n function minter() external view returns (address);\n\n function next(address) external view returns (uint256);\n\n function caps(address) external view returns (uint256);\n\n function recipients() external view returns (address[] memory);\n\n function recipientsCaps() external view returns (Recipient[] memory);\n\n // Errors\n error Cooldown();\n error NoDrawableAmount();\n error ZeroAddress();\n error OnlyMinter();\n\n // Methods\n function addRecipient(address recipient, uint256 amount) external;\n\n function removeRecipient(address recipient) external;\n\n function draw() external returns (uint256 _amount);\n\n function setKeep3rV1(address _keep3rV1) external;\n\n function setMinter(address _minter) external;\n\n function mint(uint256 _amount) external;\n\n function mint(address _account, uint256 _amount) external;\n\n function setKeep3rV1Governance(address _governance) external;\n\n function acceptKeep3rV1Governance() external;\n\n function dispute(address _keeper) external;\n\n function slash(\n address _bonded,\n address _keeper,\n uint256 _amount\n ) external;\n\n function revoke(address _keeper) external;\n\n function resolve(address _keeper) external;\n\n function addJob(address _job) external;\n\n function removeJob(address _job) external;\n\n function addKPRCredit(address _job, uint256 _amount) external;\n\n function approveLiquidity(address _liquidity) external;\n\n function revokeLiquidity(address _liquidity) external;\n\n function setKeep3rHelper(address _keep3rHelper) external;\n\n function addVotes(address _voter, uint256 _amount) external;\n\n function removeVotes(address _voter, uint256 _amount) external;\n}\n" - }, - "solidity/interfaces/peripherals/IDustCollector.sol": { - "content": "// SPDX-License-Identifier: MIT\n\npragma solidity >=0.8.4 <0.9.0;\n\nimport './IBaseErrors.sol';\n\ninterface IDustCollector is IBaseErrors {\n /// @notice Emitted when dust is sent\n /// @param _token The token that will be transferred\n /// @param _amount The amount of the token that will be transferred\n /// @param _to The address which will receive the funds\n event DustSent(address _token, uint256 _amount, address _to);\n\n /// @notice Allows an authorized user to transfer the tokens or eth that may have been left in a contract\n /// @param _token The token that will be transferred\n /// @param _amount The amount of the token that will be transferred\n /// @param _to The address that will receive the idle funds\n function sendDust(\n address _token,\n uint256 _amount,\n address _to\n ) external;\n}\n" - }, - "solidity/for-test/Keep3rForTest.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../contracts/Keep3r.sol';\n\ncontract Keep3rForTest is Keep3r {\n constructor(\n address _governance,\n address _keep3rHelper,\n address _keep3rV1,\n address _keep3rV1Proxy,\n address _kp3rWethPool\n ) Keep3r(_governance, _keep3rHelper, _keep3rV1, _keep3rV1Proxy, _kp3rWethPool) {}\n\n function viewTickOrder(address _liquidity) external view returns (bool) {\n return _isKP3RToken0[_liquidity];\n }\n}\n" - }, - "solidity/for-test/peripherals/DustCollectorForTest.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../../contracts/peripherals/DustCollector.sol';\n\ncontract DustCollectorForTest is DustCollector {\n constructor() DustCollector() Governable(msg.sender) {}\n}\n" - }, - "solidity/interfaces/IKeep3r.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport './peripherals/IKeep3rJobs.sol';\nimport './peripherals/IKeep3rKeepers.sol';\nimport './peripherals/IKeep3rAccountance.sol';\nimport './peripherals/IKeep3rRoles.sol';\nimport './peripherals/IKeep3rParameters.sol';\n\n// solhint-disable-next-line no-empty-blocks\n\n/// @title Keep3rV2 contract\n/// @notice This contract inherits all the functionality of Keep3rV2\ninterface IKeep3r is IKeep3rJobs, IKeep3rKeepers, IKeep3rAccountance, IKeep3rRoles, IKeep3rParameters {\n\n}\n" - }, - "solidity/for-test/JobForTest.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../interfaces/IKeep3r.sol';\n\ncontract JobForTest {\n error InvalidKeeper();\n address public keep3r;\n uint256 public nonce;\n\n constructor(address _keep3r) {\n keep3r = _keep3r;\n }\n\n function work() external {\n if (!IKeep3r(keep3r).isKeeper(msg.sender)) revert InvalidKeeper();\n\n for (uint256 i; i < 1000; i++) {\n nonce++;\n }\n\n IKeep3r(keep3r).worked(msg.sender);\n }\n\n function workHard(uint256 _factor) external {\n if (!IKeep3r(keep3r).isKeeper(msg.sender)) revert InvalidKeeper();\n\n for (uint256 i; i < 1000 * _factor; i++) {\n nonce++;\n }\n\n IKeep3r(keep3r).worked(msg.sender);\n }\n}\n" - }, - "solidity/for-test/BasicJob.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../interfaces/IKeep3r.sol';\n\ncontract BasicJob {\n error KeeperNotValid();\n\n address public keep3r;\n uint256 public nonce;\n uint256[] public array;\n\n constructor(address _keep3r) {\n keep3r = _keep3r;\n }\n\n function work() external upkeep {}\n\n function workHard(uint256 _howHard) external upkeep {\n for (uint256 i = nonce; i < _howHard; i++) {\n nonce++;\n }\n }\n\n function workRefund(uint256 _howHard) external upkeep {\n for (uint256 i; i < _howHard; i++) {\n array.push(i);\n }\n\n while (array.length > 0) {\n array.pop();\n }\n }\n\n modifier upkeep() {\n IKeep3r(keep3r).isKeeper(msg.sender);\n _;\n IKeep3r(keep3r).worked(msg.sender);\n }\n}\n" - }, - "solidity/contracts/Keep3rHelperParameters.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.7 <0.9.0;\n\nimport './libraries/FullMath.sol';\nimport './libraries/TickMath.sol';\nimport '../interfaces/IKeep3r.sol';\nimport '../interfaces/external/IKeep3rV1.sol';\nimport '../interfaces/IKeep3rHelperParameters.sol';\nimport './peripherals/Governable.sol';\nimport './Keep3rHelperParameters.sol';\n\nimport '@openzeppelin/contracts/utils/math/Math.sol';\nimport '@uniswap/v3-core/contracts/interfaces/IUniswapV3Pool.sol';\n\ncontract Keep3rHelperParameters is IKeep3rHelperParameters, Governable {\n /// @inheritdoc IKeep3rHelperParameters\n address public constant override KP3R = 0x1cEB5cB57C4D4E2b2433641b95Dd330A33185A44;\n\n /// @inheritdoc IKeep3rHelperParameters\n uint256 public constant override BOOST_BASE = 10_000;\n\n /// @inheritdoc IKeep3rHelperParameters\n uint256 public override minBoost = 11_000;\n\n /// @inheritdoc IKeep3rHelperParameters\n uint256 public override maxBoost = 12_000;\n\n /// @inheritdoc IKeep3rHelperParameters\n uint256 public override targetBond = 200 ether;\n\n /// @inheritdoc IKeep3rHelperParameters\n uint256 public override workExtraGas = 50_000;\n\n /// @inheritdoc IKeep3rHelperParameters\n uint32 public override quoteTwapTime = 10 minutes;\n\n /// @inheritdoc IKeep3rHelperParameters\n address public override keep3rV2;\n\n /// @inheritdoc IKeep3rHelperParameters\n IKeep3rHelperParameters.Kp3rWethPool public override kp3rWethPool;\n\n constructor(address _keep3rV2, address _governance) Governable(_governance) {\n keep3rV2 = _keep3rV2;\n _setKp3rWethPool(0x11B7a6bc0259ed6Cf9DB8F499988F9eCc7167bf5);\n }\n\n /// @inheritdoc IKeep3rHelperParameters\n function setKp3rWethPool(address _poolAddress) external override onlyGovernance {\n _setKp3rWethPool(_poolAddress);\n emit Kp3rWethPoolChange(kp3rWethPool.poolAddress, kp3rWethPool.isKP3RToken0);\n }\n\n /// @inheritdoc IKeep3rHelperParameters\n function setMinBoost(uint256 _minBoost) external override onlyGovernance {\n minBoost = _minBoost;\n emit MinBoostChange(minBoost);\n }\n\n /// @inheritdoc IKeep3rHelperParameters\n function setMaxBoost(uint256 _maxBoost) external override onlyGovernance {\n maxBoost = _maxBoost;\n emit MaxBoostChange(maxBoost);\n }\n\n /// @inheritdoc IKeep3rHelperParameters\n function setTargetBond(uint256 _targetBond) external override onlyGovernance {\n targetBond = _targetBond;\n emit TargetBondChange(targetBond);\n }\n\n /// @inheritdoc IKeep3rHelperParameters\n function setKeep3rV2(address _keep3rV2) external override onlyGovernance {\n keep3rV2 = _keep3rV2;\n emit Keep3rV2Change(keep3rV2);\n }\n\n /// @inheritdoc IKeep3rHelperParameters\n function setWorkExtraGas(uint256 _workExtraGas) external override onlyGovernance {\n workExtraGas = _workExtraGas;\n emit WorkExtraGasChange(workExtraGas);\n }\n\n /// @inheritdoc IKeep3rHelperParameters\n function setQuoteTwapTime(uint32 _quoteTwapTime) external override onlyGovernance {\n quoteTwapTime = _quoteTwapTime;\n emit QuoteTwapTimeChange(quoteTwapTime);\n }\n\n /// @notice Sets KP3R-WETH pool\n /// @param _poolAddress The address of the KP3R-WETH pool\n function _setKp3rWethPool(address _poolAddress) internal {\n bool _isKP3RToken0 = IUniswapV3Pool(_poolAddress).token0() == KP3R;\n bool _isKP3RToken1 = IUniswapV3Pool(_poolAddress).token1() == KP3R;\n\n if (!_isKP3RToken0 && !_isKP3RToken1) revert InvalidKp3rPool();\n\n kp3rWethPool = Kp3rWethPool(_poolAddress, _isKP3RToken0);\n }\n}\n" - }, - "solidity/contracts/libraries/TickMath.sol": { - "content": "// SPDX-License-Identifier: GPL-2.0-or-later\npragma solidity >=0.5.0;\n\n// solhint-disable\n\n/// @title Math library for computing sqrt prices from ticks and vice versa\n/// @notice Computes sqrt price for ticks of size 1.0001, i.e. sqrt(1.0001^tick) as fixed point Q64.96 numbers. Supports\n/// prices between 2**-128 and 2**128\nlibrary TickMath {\n /// @dev The minimum tick that may be passed to #getSqrtRatioAtTick computed from log base 1.0001 of 2**-128\n int24 internal constant MIN_TICK = -887272;\n /// @dev The maximum tick that may be passed to #getSqrtRatioAtTick computed from log base 1.0001 of 2**128\n int24 internal constant MAX_TICK = -MIN_TICK;\n\n /// @dev The minimum value that can be returned from #getSqrtRatioAtTick. Equivalent to getSqrtRatioAtTick(MIN_TICK)\n uint160 internal constant MIN_SQRT_RATIO = 4295128739;\n /// @dev The maximum value that can be returned from #getSqrtRatioAtTick. Equivalent to getSqrtRatioAtTick(MAX_TICK)\n uint160 internal constant MAX_SQRT_RATIO = 1461446703485210103287273052203988822378723970342;\n\n /// @notice Calculates sqrt(1.0001^tick) * 2^96\n /// @dev Throws if |tick| > max tick\n /// @param tick The input tick for the above formula\n /// @return sqrtPriceX96 A Fixed point Q64.96 number representing the sqrt of the ratio of the two assets (token1/token0)\n /// at the given tick\n function getSqrtRatioAtTick(int24 tick) internal pure returns (uint160 sqrtPriceX96) {\n uint256 absTick = tick < 0 ? uint256(-int256(tick)) : uint256(int256(tick));\n require(absTick <= uint256(int256(MAX_TICK)), 'T');\n\n uint256 ratio = absTick & 0x1 != 0 ? 0xfffcb933bd6fad37aa2d162d1a594001 : 0x100000000000000000000000000000000;\n if (absTick & 0x2 != 0) ratio = (ratio * 0xfff97272373d413259a46990580e213a) >> 128;\n if (absTick & 0x4 != 0) ratio = (ratio * 0xfff2e50f5f656932ef12357cf3c7fdcc) >> 128;\n if (absTick & 0x8 != 0) ratio = (ratio * 0xffe5caca7e10e4e61c3624eaa0941cd0) >> 128;\n if (absTick & 0x10 != 0) ratio = (ratio * 0xffcb9843d60f6159c9db58835c926644) >> 128;\n if (absTick & 0x20 != 0) ratio = (ratio * 0xff973b41fa98c081472e6896dfb254c0) >> 128;\n if (absTick & 0x40 != 0) ratio = (ratio * 0xff2ea16466c96a3843ec78b326b52861) >> 128;\n if (absTick & 0x80 != 0) ratio = (ratio * 0xfe5dee046a99a2a811c461f1969c3053) >> 128;\n if (absTick & 0x100 != 0) ratio = (ratio * 0xfcbe86c7900a88aedcffc83b479aa3a4) >> 128;\n if (absTick & 0x200 != 0) ratio = (ratio * 0xf987a7253ac413176f2b074cf7815e54) >> 128;\n if (absTick & 0x400 != 0) ratio = (ratio * 0xf3392b0822b70005940c7a398e4b70f3) >> 128;\n if (absTick & 0x800 != 0) ratio = (ratio * 0xe7159475a2c29b7443b29c7fa6e889d9) >> 128;\n if (absTick & 0x1000 != 0) ratio = (ratio * 0xd097f3bdfd2022b8845ad8f792aa5825) >> 128;\n if (absTick & 0x2000 != 0) ratio = (ratio * 0xa9f746462d870fdf8a65dc1f90e061e5) >> 128;\n if (absTick & 0x4000 != 0) ratio = (ratio * 0x70d869a156d2a1b890bb3df62baf32f7) >> 128;\n if (absTick & 0x8000 != 0) ratio = (ratio * 0x31be135f97d08fd981231505542fcfa6) >> 128;\n if (absTick & 0x10000 != 0) ratio = (ratio * 0x9aa508b5b7a84e1c677de54f3e99bc9) >> 128;\n if (absTick & 0x20000 != 0) ratio = (ratio * 0x5d6af8dedb81196699c329225ee604) >> 128;\n if (absTick & 0x40000 != 0) ratio = (ratio * 0x2216e584f5fa1ea926041bedfe98) >> 128;\n if (absTick & 0x80000 != 0) ratio = (ratio * 0x48a170391f7dc42444e8fa2) >> 128;\n\n if (tick > 0) ratio = type(uint256).max / ratio;\n\n // Divides by 1<<32 rounding up to go from a Q128.128 to a Q128.96.\n // we then downcast because we know the result always fits within 160 bits due to our tick input constraint\n // we round up in the division so getTickAtSqrtRatio of the output price is always consistent\n sqrtPriceX96 = uint160((ratio >> 32) + (ratio % (1 << 32) == 0 ? 0 : 1));\n }\n\n /// @notice Calculates the greatest tick value such that getRatioAtTick(tick) <= ratio\n /// @dev Throws in case sqrtPriceX96 < MIN_SQRT_RATIO, as MIN_SQRT_RATIO is the lowest value getRatioAtTick may ever return.\n /// @param sqrtPriceX96 The sqrt ratio for which to compute the tick as a Q64.96\n /// @return tick The greatest tick for which the ratio is less than or equal to the input ratio\n function getTickAtSqrtRatio(uint160 sqrtPriceX96) internal pure returns (int24 tick) {\n // Second inequality must be < because the price can never reach the price at the max tick\n require(sqrtPriceX96 >= MIN_SQRT_RATIO && sqrtPriceX96 < MAX_SQRT_RATIO, 'R');\n uint256 ratio = uint256(sqrtPriceX96) << 32;\n\n uint256 r = ratio;\n uint256 msb = 0;\n\n assembly {\n let f := shl(7, gt(r, 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF))\n msb := or(msb, f)\n r := shr(f, r)\n }\n assembly {\n let f := shl(6, gt(r, 0xFFFFFFFFFFFFFFFF))\n msb := or(msb, f)\n r := shr(f, r)\n }\n assembly {\n let f := shl(5, gt(r, 0xFFFFFFFF))\n msb := or(msb, f)\n r := shr(f, r)\n }\n assembly {\n let f := shl(4, gt(r, 0xFFFF))\n msb := or(msb, f)\n r := shr(f, r)\n }\n assembly {\n let f := shl(3, gt(r, 0xFF))\n msb := or(msb, f)\n r := shr(f, r)\n }\n assembly {\n let f := shl(2, gt(r, 0xF))\n msb := or(msb, f)\n r := shr(f, r)\n }\n assembly {\n let f := shl(1, gt(r, 0x3))\n msb := or(msb, f)\n r := shr(f, r)\n }\n assembly {\n let f := gt(r, 0x1)\n msb := or(msb, f)\n }\n\n if (msb >= 128) r = ratio >> (msb - 127);\n else r = ratio << (127 - msb);\n\n int256 log_2 = (int256(msb) - 128) << 64;\n\n assembly {\n r := shr(127, mul(r, r))\n let f := shr(128, r)\n log_2 := or(log_2, shl(63, f))\n r := shr(f, r)\n }\n assembly {\n r := shr(127, mul(r, r))\n let f := shr(128, r)\n log_2 := or(log_2, shl(62, f))\n r := shr(f, r)\n }\n assembly {\n r := shr(127, mul(r, r))\n let f := shr(128, r)\n log_2 := or(log_2, shl(61, f))\n r := shr(f, r)\n }\n assembly {\n r := shr(127, mul(r, r))\n let f := shr(128, r)\n log_2 := or(log_2, shl(60, f))\n r := shr(f, r)\n }\n assembly {\n r := shr(127, mul(r, r))\n let f := shr(128, r)\n log_2 := or(log_2, shl(59, f))\n r := shr(f, r)\n }\n assembly {\n r := shr(127, mul(r, r))\n let f := shr(128, r)\n log_2 := or(log_2, shl(58, f))\n r := shr(f, r)\n }\n assembly {\n r := shr(127, mul(r, r))\n let f := shr(128, r)\n log_2 := or(log_2, shl(57, f))\n r := shr(f, r)\n }\n assembly {\n r := shr(127, mul(r, r))\n let f := shr(128, r)\n log_2 := or(log_2, shl(56, f))\n r := shr(f, r)\n }\n assembly {\n r := shr(127, mul(r, r))\n let f := shr(128, r)\n log_2 := or(log_2, shl(55, f))\n r := shr(f, r)\n }\n assembly {\n r := shr(127, mul(r, r))\n let f := shr(128, r)\n log_2 := or(log_2, shl(54, f))\n r := shr(f, r)\n }\n assembly {\n r := shr(127, mul(r, r))\n let f := shr(128, r)\n log_2 := or(log_2, shl(53, f))\n r := shr(f, r)\n }\n assembly {\n r := shr(127, mul(r, r))\n let f := shr(128, r)\n log_2 := or(log_2, shl(52, f))\n r := shr(f, r)\n }\n assembly {\n r := shr(127, mul(r, r))\n let f := shr(128, r)\n log_2 := or(log_2, shl(51, f))\n r := shr(f, r)\n }\n assembly {\n r := shr(127, mul(r, r))\n let f := shr(128, r)\n log_2 := or(log_2, shl(50, f))\n }\n\n int256 log_sqrt10001 = log_2 * 255738958999603826347141; // 128.128 number\n\n int24 tickLow = int24((log_sqrt10001 - 3402992956809132418596140100660247210) >> 128);\n int24 tickHi = int24((log_sqrt10001 + 291339464771989622907027621153398088495) >> 128);\n\n tick = tickLow == tickHi ? tickLow : getSqrtRatioAtTick(tickHi) <= sqrtPriceX96 ? tickHi : tickLow;\n }\n}\n" - }, - "solidity/interfaces/IKeep3rHelperParameters.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\n/// @title Keep3rHelperParameters contract\n/// @notice Contains all the helper functions used throughout the different files.\ninterface IKeep3rHelperParameters {\n // Structs\n\n /// @dev KP3R-WETH Pool address and isKP3RToken0\n /// @dev Created in order to save gas by avoiding calls to pool's token0 method\n struct Kp3rWethPool {\n address poolAddress;\n bool isKP3RToken0;\n }\n\n // Errors\n\n /// @notice Throws when pool does not have KP3R as token0 nor token1\n error InvalidKp3rPool();\n\n // Events\n\n /// @notice Emitted when the kp3r weth pool is changed\n /// @param _address Address of the new kp3r weth pool\n /// @param _isKP3RToken0 True if calling the token0 method of the pool returns the KP3R token address\n event Kp3rWethPoolChange(address _address, bool _isKP3RToken0);\n\n /// @notice Emitted when the minimum boost multiplier is changed\n /// @param _minBoost The minimum boost multiplier\n event MinBoostChange(uint256 _minBoost);\n\n /// @notice Emitted when the maximum boost multiplier is changed\n /// @param _maxBoost The maximum boost multiplier\n event MaxBoostChange(uint256 _maxBoost);\n\n /// @notice Emitted when the target bond amount is changed\n /// @param _targetBond The target bond amount\n event TargetBondChange(uint256 _targetBond);\n\n /// @notice Emitted when the Keep3r V2 address is changed\n /// @param _keep3rV2 The address of Keep3r V2\n event Keep3rV2Change(address _keep3rV2);\n\n /// @notice Emitted when the work extra gas amount is changed\n /// @param _workExtraGas The work extra gas\n event WorkExtraGasChange(uint256 _workExtraGas);\n\n /// @notice Emitted when the quote twap time is changed\n /// @param _quoteTwapTime The twap time for quoting\n event QuoteTwapTimeChange(uint32 _quoteTwapTime);\n\n // Variables\n\n /// @notice Address of KP3R token\n /// @return _kp3r Address of KP3R token\n // solhint-disable func-name-mixedcase\n function KP3R() external view returns (address _kp3r);\n\n /// @notice The boost base used to calculate the boost rewards for the keeper\n /// @return _base The boost base number\n function BOOST_BASE() external view returns (uint256 _base);\n\n /// @notice KP3R-WETH pool that is being used as oracle\n /// @return poolAddress Address of the pool\n /// @return isKP3RToken0 True if calling the token0 method of the pool returns the KP3R token address\n function kp3rWethPool() external view returns (address poolAddress, bool isKP3RToken0);\n\n /// @notice The minimum multiplier used to calculate the amount of gas paid to the Keeper for the gas used to perform a job\n /// For example: if the quoted gas used is 1000, then the minimum amount to be paid will be 1000 * minBoost / BOOST_BASE\n /// @return _multiplier The minimum boost multiplier\n function minBoost() external view returns (uint256 _multiplier);\n\n /// @notice The maximum multiplier used to calculate the amount of gas paid to the Keeper for the gas used to perform a job\n /// For example: if the quoted gas used is 1000, then the maximum amount to be paid will be 1000 * maxBoost / BOOST_BASE\n /// @return _multiplier The maximum boost multiplier\n function maxBoost() external view returns (uint256 _multiplier);\n\n /// @notice The targeted amount of bonded KP3Rs to max-up reward multiplier\n /// For example: if the amount of KP3R the keeper has bonded is targetBond or more, then the keeper will get\n /// the maximum boost possible in his rewards, if it's less, the reward boost will be proportional\n /// @return _target The amount of KP3R that comforms the targetBond\n function targetBond() external view returns (uint256 _target);\n\n /// @notice The amount of unaccounted gas that is going to be added to keeper payments\n /// @return _workExtraGas The work unaccounted gas amount\n function workExtraGas() external view returns (uint256 _workExtraGas);\n\n /// @notice The twap time for quoting\n /// @return _quoteTwapTime The twap time\n function quoteTwapTime() external view returns (uint32 _quoteTwapTime);\n\n /// @notice Address of Keep3r V2\n /// @return _keep3rV2 Address of Keep3r V2\n function keep3rV2() external view returns (address _keep3rV2);\n\n // Methods\n\n /// @notice Sets KP3R-WETH pool\n /// @param _poolAddress The address of the KP3R-WETH pool\n function setKp3rWethPool(address _poolAddress) external;\n\n /// @notice Sets the minimum boost multiplier\n /// @param _minBoost The minimum boost multiplier\n function setMinBoost(uint256 _minBoost) external;\n\n /// @notice Sets the maximum boost multiplier\n /// @param _maxBoost The maximum boost multiplier\n function setMaxBoost(uint256 _maxBoost) external;\n\n /// @notice Sets the target bond amount\n /// @param _targetBond The target bond amount\n function setTargetBond(uint256 _targetBond) external;\n\n /// @notice Sets the Keep3r V2 address\n /// @param _keep3rV2 The address of Keep3r V2\n function setKeep3rV2(address _keep3rV2) external;\n\n /// @notice Sets the work extra gas amount\n /// @param _workExtraGas The work extra gas\n function setWorkExtraGas(uint256 _workExtraGas) external;\n\n /// @notice Sets the quote twap time\n /// @param _quoteTwapTime The twap time for quoting\n function setQuoteTwapTime(uint32 _quoteTwapTime) external;\n}\n" - }, - "@uniswap/v3-core/contracts/interfaces/IUniswapV3Pool.sol": { - "content": "// SPDX-License-Identifier: GPL-2.0-or-later\npragma solidity >=0.5.0;\n\nimport './pool/IUniswapV3PoolImmutables.sol';\nimport './pool/IUniswapV3PoolState.sol';\nimport './pool/IUniswapV3PoolDerivedState.sol';\nimport './pool/IUniswapV3PoolActions.sol';\nimport './pool/IUniswapV3PoolOwnerActions.sol';\nimport './pool/IUniswapV3PoolEvents.sol';\n\n/// @title The interface for a Uniswap V3 Pool\n/// @notice A Uniswap pool facilitates swapping and automated market making between any two assets that strictly conform\n/// to the ERC20 specification\n/// @dev The pool interface is broken up into many smaller pieces\ninterface IUniswapV3Pool is\n IUniswapV3PoolImmutables,\n IUniswapV3PoolState,\n IUniswapV3PoolDerivedState,\n IUniswapV3PoolActions,\n IUniswapV3PoolOwnerActions,\n IUniswapV3PoolEvents\n{\n\n}\n" - }, - "@uniswap/v3-core/contracts/interfaces/pool/IUniswapV3PoolImmutables.sol": { - "content": "// SPDX-License-Identifier: GPL-2.0-or-later\npragma solidity >=0.5.0;\n\n/// @title Pool state that never changes\n/// @notice These parameters are fixed for a pool forever, i.e., the methods will always return the same values\ninterface IUniswapV3PoolImmutables {\n /// @notice The contract that deployed the pool, which must adhere to the IUniswapV3Factory interface\n /// @return The contract address\n function factory() external view returns (address);\n\n /// @notice The first of the two tokens of the pool, sorted by address\n /// @return The token contract address\n function token0() external view returns (address);\n\n /// @notice The second of the two tokens of the pool, sorted by address\n /// @return The token contract address\n function token1() external view returns (address);\n\n /// @notice The pool's fee in hundredths of a bip, i.e. 1e-6\n /// @return The fee\n function fee() external view returns (uint24);\n\n /// @notice The pool tick spacing\n /// @dev Ticks can only be used at multiples of this value, minimum of 1 and always positive\n /// e.g.: a tickSpacing of 3 means ticks can be initialized every 3rd tick, i.e., ..., -6, -3, 0, 3, 6, ...\n /// This value is an int24 to avoid casting even though it is always positive.\n /// @return The tick spacing\n function tickSpacing() external view returns (int24);\n\n /// @notice The maximum amount of position liquidity that can use any tick in the range\n /// @dev This parameter is enforced per tick to prevent liquidity from overflowing a uint128 at any point, and\n /// also prevents out-of-range liquidity from being used to prevent adding in-range liquidity to a pool\n /// @return The max amount of liquidity per tick\n function maxLiquidityPerTick() external view returns (uint128);\n}\n" - }, - "@uniswap/v3-core/contracts/interfaces/pool/IUniswapV3PoolState.sol": { - "content": "// SPDX-License-Identifier: GPL-2.0-or-later\npragma solidity >=0.5.0;\n\n/// @title Pool state that can change\n/// @notice These methods compose the pool's state, and can change with any frequency including multiple times\n/// per transaction\ninterface IUniswapV3PoolState {\n /// @notice The 0th storage slot in the pool stores many values, and is exposed as a single method to save gas\n /// when accessed externally.\n /// @return sqrtPriceX96 The current price of the pool as a sqrt(token1/token0) Q64.96 value\n /// tick The current tick of the pool, i.e. according to the last tick transition that was run.\n /// This value may not always be equal to SqrtTickMath.getTickAtSqrtRatio(sqrtPriceX96) if the price is on a tick\n /// boundary.\n /// observationIndex The index of the last oracle observation that was written,\n /// observationCardinality The current maximum number of observations stored in the pool,\n /// observationCardinalityNext The next maximum number of observations, to be updated when the observation.\n /// feeProtocol The protocol fee for both tokens of the pool.\n /// Encoded as two 4 bit values, where the protocol fee of token1 is shifted 4 bits and the protocol fee of token0\n /// is the lower 4 bits. Used as the denominator of a fraction of the swap fee, e.g. 4 means 1/4th of the swap fee.\n /// unlocked Whether the pool is currently locked to reentrancy\n function slot0()\n external\n view\n returns (\n uint160 sqrtPriceX96,\n int24 tick,\n uint16 observationIndex,\n uint16 observationCardinality,\n uint16 observationCardinalityNext,\n uint8 feeProtocol,\n bool unlocked\n );\n\n /// @notice The fee growth as a Q128.128 fees of token0 collected per unit of liquidity for the entire life of the pool\n /// @dev This value can overflow the uint256\n function feeGrowthGlobal0X128() external view returns (uint256);\n\n /// @notice The fee growth as a Q128.128 fees of token1 collected per unit of liquidity for the entire life of the pool\n /// @dev This value can overflow the uint256\n function feeGrowthGlobal1X128() external view returns (uint256);\n\n /// @notice The amounts of token0 and token1 that are owed to the protocol\n /// @dev Protocol fees will never exceed uint128 max in either token\n function protocolFees() external view returns (uint128 token0, uint128 token1);\n\n /// @notice The currently in range liquidity available to the pool\n /// @dev This value has no relationship to the total liquidity across all ticks\n function liquidity() external view returns (uint128);\n\n /// @notice Look up information about a specific tick in the pool\n /// @param tick The tick to look up\n /// @return liquidityGross the total amount of position liquidity that uses the pool either as tick lower or\n /// tick upper,\n /// liquidityNet how much liquidity changes when the pool price crosses the tick,\n /// feeGrowthOutside0X128 the fee growth on the other side of the tick from the current tick in token0,\n /// feeGrowthOutside1X128 the fee growth on the other side of the tick from the current tick in token1,\n /// tickCumulativeOutside the cumulative tick value on the other side of the tick from the current tick\n /// secondsPerLiquidityOutsideX128 the seconds spent per liquidity on the other side of the tick from the current tick,\n /// secondsOutside the seconds spent on the other side of the tick from the current tick,\n /// initialized Set to true if the tick is initialized, i.e. liquidityGross is greater than 0, otherwise equal to false.\n /// Outside values can only be used if the tick is initialized, i.e. if liquidityGross is greater than 0.\n /// In addition, these values are only relative and must be used only in comparison to previous snapshots for\n /// a specific position.\n function ticks(int24 tick)\n external\n view\n returns (\n uint128 liquidityGross,\n int128 liquidityNet,\n uint256 feeGrowthOutside0X128,\n uint256 feeGrowthOutside1X128,\n int56 tickCumulativeOutside,\n uint160 secondsPerLiquidityOutsideX128,\n uint32 secondsOutside,\n bool initialized\n );\n\n /// @notice Returns 256 packed tick initialized boolean values. See TickBitmap for more information\n function tickBitmap(int16 wordPosition) external view returns (uint256);\n\n /// @notice Returns the information about a position by the position's key\n /// @param key The position's key is a hash of a preimage composed by the owner, tickLower and tickUpper\n /// @return _liquidity The amount of liquidity in the position,\n /// Returns feeGrowthInside0LastX128 fee growth of token0 inside the tick range as of the last mint/burn/poke,\n /// Returns feeGrowthInside1LastX128 fee growth of token1 inside the tick range as of the last mint/burn/poke,\n /// Returns tokensOwed0 the computed amount of token0 owed to the position as of the last mint/burn/poke,\n /// Returns tokensOwed1 the computed amount of token1 owed to the position as of the last mint/burn/poke\n function positions(bytes32 key)\n external\n view\n returns (\n uint128 _liquidity,\n uint256 feeGrowthInside0LastX128,\n uint256 feeGrowthInside1LastX128,\n uint128 tokensOwed0,\n uint128 tokensOwed1\n );\n\n /// @notice Returns data about a specific observation index\n /// @param index The element of the observations array to fetch\n /// @dev You most likely want to use #observe() instead of this method to get an observation as of some amount of time\n /// ago, rather than at a specific index in the array.\n /// @return blockTimestamp The timestamp of the observation,\n /// Returns tickCumulative the tick multiplied by seconds elapsed for the life of the pool as of the observation timestamp,\n /// Returns secondsPerLiquidityCumulativeX128 the seconds per in range liquidity for the life of the pool as of the observation timestamp,\n /// Returns initialized whether the observation has been initialized and the values are safe to use\n function observations(uint256 index)\n external\n view\n returns (\n uint32 blockTimestamp,\n int56 tickCumulative,\n uint160 secondsPerLiquidityCumulativeX128,\n bool initialized\n );\n}\n" - }, - "@uniswap/v3-core/contracts/interfaces/pool/IUniswapV3PoolDerivedState.sol": { - "content": "// SPDX-License-Identifier: GPL-2.0-or-later\npragma solidity >=0.5.0;\n\n/// @title Pool state that is not stored\n/// @notice Contains view functions to provide information about the pool that is computed rather than stored on the\n/// blockchain. The functions here may have variable gas costs.\ninterface IUniswapV3PoolDerivedState {\n /// @notice Returns the cumulative tick and liquidity as of each timestamp `secondsAgo` from the current block timestamp\n /// @dev To get a time weighted average tick or liquidity-in-range, you must call this with two values, one representing\n /// the beginning of the period and another for the end of the period. E.g., to get the last hour time-weighted average tick,\n /// you must call it with secondsAgos = [3600, 0].\n /// @dev The time weighted average tick represents the geometric time weighted average price of the pool, in\n /// log base sqrt(1.0001) of token1 / token0. The TickMath library can be used to go from a tick value to a ratio.\n /// @param secondsAgos From how long ago each cumulative tick and liquidity value should be returned\n /// @return tickCumulatives Cumulative tick values as of each `secondsAgos` from the current block timestamp\n /// @return secondsPerLiquidityCumulativeX128s Cumulative seconds per liquidity-in-range value as of each `secondsAgos` from the current block\n /// timestamp\n function observe(uint32[] calldata secondsAgos)\n external\n view\n returns (int56[] memory tickCumulatives, uint160[] memory secondsPerLiquidityCumulativeX128s);\n\n /// @notice Returns a snapshot of the tick cumulative, seconds per liquidity and seconds inside a tick range\n /// @dev Snapshots must only be compared to other snapshots, taken over a period for which a position existed.\n /// I.e., snapshots cannot be compared if a position is not held for the entire period between when the first\n /// snapshot is taken and the second snapshot is taken.\n /// @param tickLower The lower tick of the range\n /// @param tickUpper The upper tick of the range\n /// @return tickCumulativeInside The snapshot of the tick accumulator for the range\n /// @return secondsPerLiquidityInsideX128 The snapshot of seconds per liquidity for the range\n /// @return secondsInside The snapshot of seconds per liquidity for the range\n function snapshotCumulativesInside(int24 tickLower, int24 tickUpper)\n external\n view\n returns (\n int56 tickCumulativeInside,\n uint160 secondsPerLiquidityInsideX128,\n uint32 secondsInside\n );\n}\n" - }, - "@uniswap/v3-core/contracts/interfaces/pool/IUniswapV3PoolActions.sol": { - "content": "// SPDX-License-Identifier: GPL-2.0-or-later\npragma solidity >=0.5.0;\n\n/// @title Permissionless pool actions\n/// @notice Contains pool methods that can be called by anyone\ninterface IUniswapV3PoolActions {\n /// @notice Sets the initial price for the pool\n /// @dev Price is represented as a sqrt(amountToken1/amountToken0) Q64.96 value\n /// @param sqrtPriceX96 the initial sqrt price of the pool as a Q64.96\n function initialize(uint160 sqrtPriceX96) external;\n\n /// @notice Adds liquidity for the given recipient/tickLower/tickUpper position\n /// @dev The caller of this method receives a callback in the form of IUniswapV3MintCallback#uniswapV3MintCallback\n /// in which they must pay any token0 or token1 owed for the liquidity. The amount of token0/token1 due depends\n /// on tickLower, tickUpper, the amount of liquidity, and the current price.\n /// @param recipient The address for which the liquidity will be created\n /// @param tickLower The lower tick of the position in which to add liquidity\n /// @param tickUpper The upper tick of the position in which to add liquidity\n /// @param amount The amount of liquidity to mint\n /// @param data Any data that should be passed through to the callback\n /// @return amount0 The amount of token0 that was paid to mint the given amount of liquidity. Matches the value in the callback\n /// @return amount1 The amount of token1 that was paid to mint the given amount of liquidity. Matches the value in the callback\n function mint(\n address recipient,\n int24 tickLower,\n int24 tickUpper,\n uint128 amount,\n bytes calldata data\n ) external returns (uint256 amount0, uint256 amount1);\n\n /// @notice Collects tokens owed to a position\n /// @dev Does not recompute fees earned, which must be done either via mint or burn of any amount of liquidity.\n /// Collect must be called by the position owner. To withdraw only token0 or only token1, amount0Requested or\n /// amount1Requested may be set to zero. To withdraw all tokens owed, caller may pass any value greater than the\n /// actual tokens owed, e.g. type(uint128).max. Tokens owed may be from accumulated swap fees or burned liquidity.\n /// @param recipient The address which should receive the fees collected\n /// @param tickLower The lower tick of the position for which to collect fees\n /// @param tickUpper The upper tick of the position for which to collect fees\n /// @param amount0Requested How much token0 should be withdrawn from the fees owed\n /// @param amount1Requested How much token1 should be withdrawn from the fees owed\n /// @return amount0 The amount of fees collected in token0\n /// @return amount1 The amount of fees collected in token1\n function collect(\n address recipient,\n int24 tickLower,\n int24 tickUpper,\n uint128 amount0Requested,\n uint128 amount1Requested\n ) external returns (uint128 amount0, uint128 amount1);\n\n /// @notice Burn liquidity from the sender and account tokens owed for the liquidity to the position\n /// @dev Can be used to trigger a recalculation of fees owed to a position by calling with an amount of 0\n /// @dev Fees must be collected separately via a call to #collect\n /// @param tickLower The lower tick of the position for which to burn liquidity\n /// @param tickUpper The upper tick of the position for which to burn liquidity\n /// @param amount How much liquidity to burn\n /// @return amount0 The amount of token0 sent to the recipient\n /// @return amount1 The amount of token1 sent to the recipient\n function burn(\n int24 tickLower,\n int24 tickUpper,\n uint128 amount\n ) external returns (uint256 amount0, uint256 amount1);\n\n /// @notice Swap token0 for token1, or token1 for token0\n /// @dev The caller of this method receives a callback in the form of IUniswapV3SwapCallback#uniswapV3SwapCallback\n /// @param recipient The address to receive the output of the swap\n /// @param zeroForOne The direction of the swap, true for token0 to token1, false for token1 to token0\n /// @param amountSpecified The amount of the swap, which implicitly configures the swap as exact input (positive), or exact output (negative)\n /// @param sqrtPriceLimitX96 The Q64.96 sqrt price limit. If zero for one, the price cannot be less than this\n /// value after the swap. If one for zero, the price cannot be greater than this value after the swap\n /// @param data Any data to be passed through to the callback\n /// @return amount0 The delta of the balance of token0 of the pool, exact when negative, minimum when positive\n /// @return amount1 The delta of the balance of token1 of the pool, exact when negative, minimum when positive\n function swap(\n address recipient,\n bool zeroForOne,\n int256 amountSpecified,\n uint160 sqrtPriceLimitX96,\n bytes calldata data\n ) external returns (int256 amount0, int256 amount1);\n\n /// @notice Receive token0 and/or token1 and pay it back, plus a fee, in the callback\n /// @dev The caller of this method receives a callback in the form of IUniswapV3FlashCallback#uniswapV3FlashCallback\n /// @dev Can be used to donate underlying tokens pro-rata to currently in-range liquidity providers by calling\n /// with 0 amount{0,1} and sending the donation amount(s) from the callback\n /// @param recipient The address which will receive the token0 and token1 amounts\n /// @param amount0 The amount of token0 to send\n /// @param amount1 The amount of token1 to send\n /// @param data Any data to be passed through to the callback\n function flash(\n address recipient,\n uint256 amount0,\n uint256 amount1,\n bytes calldata data\n ) external;\n\n /// @notice Increase the maximum number of price and liquidity observations that this pool will store\n /// @dev This method is no-op if the pool already has an observationCardinalityNext greater than or equal to\n /// the input observationCardinalityNext.\n /// @param observationCardinalityNext The desired minimum number of observations for the pool to store\n function increaseObservationCardinalityNext(uint16 observationCardinalityNext) external;\n}\n" - }, - "@uniswap/v3-core/contracts/interfaces/pool/IUniswapV3PoolOwnerActions.sol": { - "content": "// SPDX-License-Identifier: GPL-2.0-or-later\npragma solidity >=0.5.0;\n\n/// @title Permissioned pool actions\n/// @notice Contains pool methods that may only be called by the factory owner\ninterface IUniswapV3PoolOwnerActions {\n /// @notice Set the denominator of the protocol's % share of the fees\n /// @param feeProtocol0 new protocol fee for token0 of the pool\n /// @param feeProtocol1 new protocol fee for token1 of the pool\n function setFeeProtocol(uint8 feeProtocol0, uint8 feeProtocol1) external;\n\n /// @notice Collect the protocol fee accrued to the pool\n /// @param recipient The address to which collected protocol fees should be sent\n /// @param amount0Requested The maximum amount of token0 to send, can be 0 to collect fees in only token1\n /// @param amount1Requested The maximum amount of token1 to send, can be 0 to collect fees in only token0\n /// @return amount0 The protocol fee collected in token0\n /// @return amount1 The protocol fee collected in token1\n function collectProtocol(\n address recipient,\n uint128 amount0Requested,\n uint128 amount1Requested\n ) external returns (uint128 amount0, uint128 amount1);\n}\n" - }, - "@uniswap/v3-core/contracts/interfaces/pool/IUniswapV3PoolEvents.sol": { - "content": "// SPDX-License-Identifier: GPL-2.0-or-later\npragma solidity >=0.5.0;\n\n/// @title Events emitted by a pool\n/// @notice Contains all events emitted by the pool\ninterface IUniswapV3PoolEvents {\n /// @notice Emitted exactly once by a pool when #initialize is first called on the pool\n /// @dev Mint/Burn/Swap cannot be emitted by the pool before Initialize\n /// @param sqrtPriceX96 The initial sqrt price of the pool, as a Q64.96\n /// @param tick The initial tick of the pool, i.e. log base 1.0001 of the starting price of the pool\n event Initialize(uint160 sqrtPriceX96, int24 tick);\n\n /// @notice Emitted when liquidity is minted for a given position\n /// @param sender The address that minted the liquidity\n /// @param owner The owner of the position and recipient of any minted liquidity\n /// @param tickLower The lower tick of the position\n /// @param tickUpper The upper tick of the position\n /// @param amount The amount of liquidity minted to the position range\n /// @param amount0 How much token0 was required for the minted liquidity\n /// @param amount1 How much token1 was required for the minted liquidity\n event Mint(\n address sender,\n address indexed owner,\n int24 indexed tickLower,\n int24 indexed tickUpper,\n uint128 amount,\n uint256 amount0,\n uint256 amount1\n );\n\n /// @notice Emitted when fees are collected by the owner of a position\n /// @dev Collect events may be emitted with zero amount0 and amount1 when the caller chooses not to collect fees\n /// @param owner The owner of the position for which fees are collected\n /// @param tickLower The lower tick of the position\n /// @param tickUpper The upper tick of the position\n /// @param amount0 The amount of token0 fees collected\n /// @param amount1 The amount of token1 fees collected\n event Collect(\n address indexed owner,\n address recipient,\n int24 indexed tickLower,\n int24 indexed tickUpper,\n uint128 amount0,\n uint128 amount1\n );\n\n /// @notice Emitted when a position's liquidity is removed\n /// @dev Does not withdraw any fees earned by the liquidity position, which must be withdrawn via #collect\n /// @param owner The owner of the position for which liquidity is removed\n /// @param tickLower The lower tick of the position\n /// @param tickUpper The upper tick of the position\n /// @param amount The amount of liquidity to remove\n /// @param amount0 The amount of token0 withdrawn\n /// @param amount1 The amount of token1 withdrawn\n event Burn(\n address indexed owner,\n int24 indexed tickLower,\n int24 indexed tickUpper,\n uint128 amount,\n uint256 amount0,\n uint256 amount1\n );\n\n /// @notice Emitted by the pool for any swaps between token0 and token1\n /// @param sender The address that initiated the swap call, and that received the callback\n /// @param recipient The address that received the output of the swap\n /// @param amount0 The delta of the token0 balance of the pool\n /// @param amount1 The delta of the token1 balance of the pool\n /// @param sqrtPriceX96 The sqrt(price) of the pool after the swap, as a Q64.96\n /// @param liquidity The liquidity of the pool after the swap\n /// @param tick The log base 1.0001 of price of the pool after the swap\n event Swap(\n address indexed sender,\n address indexed recipient,\n int256 amount0,\n int256 amount1,\n uint160 sqrtPriceX96,\n uint128 liquidity,\n int24 tick\n );\n\n /// @notice Emitted by the pool for any flashes of token0/token1\n /// @param sender The address that initiated the swap call, and that received the callback\n /// @param recipient The address that received the tokens from flash\n /// @param amount0 The amount of token0 that was flashed\n /// @param amount1 The amount of token1 that was flashed\n /// @param paid0 The amount of token0 paid for the flash, which can exceed the amount0 plus the fee\n /// @param paid1 The amount of token1 paid for the flash, which can exceed the amount1 plus the fee\n event Flash(\n address indexed sender,\n address indexed recipient,\n uint256 amount0,\n uint256 amount1,\n uint256 paid0,\n uint256 paid1\n );\n\n /// @notice Emitted by the pool for increases to the number of observations that can be stored\n /// @dev observationCardinalityNext is not the observation cardinality until an observation is written at the index\n /// just before a mint/swap/burn.\n /// @param observationCardinalityNextOld The previous value of the next observation cardinality\n /// @param observationCardinalityNextNew The updated value of the next observation cardinality\n event IncreaseObservationCardinalityNext(\n uint16 observationCardinalityNextOld,\n uint16 observationCardinalityNextNew\n );\n\n /// @notice Emitted when the protocol fee is changed by the pool\n /// @param feeProtocol0Old The previous value of the token0 protocol fee\n /// @param feeProtocol1Old The previous value of the token1 protocol fee\n /// @param feeProtocol0New The updated value of the token0 protocol fee\n /// @param feeProtocol1New The updated value of the token1 protocol fee\n event SetFeeProtocol(uint8 feeProtocol0Old, uint8 feeProtocol1Old, uint8 feeProtocol0New, uint8 feeProtocol1New);\n\n /// @notice Emitted when the collected protocol fees are withdrawn by the factory owner\n /// @param sender The address that collects the protocol fees\n /// @param recipient The address that receives the collected protocol fees\n /// @param amount0 The amount of token0 protocol fees that is withdrawn\n /// @param amount0 The amount of token1 protocol fees that is withdrawn\n event CollectProtocol(address indexed sender, address indexed recipient, uint128 amount0, uint128 amount1);\n}\n" - }, - "solidity/for-test/UniV3PairManagerForTest.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '@openzeppelin/contracts/token/ERC20/ERC20.sol';\nimport '@uniswap/v3-core/contracts/interfaces/IUniswapV3Pool.sol';\n\nimport '../contracts/libraries/LiquidityAmounts.sol';\nimport '../contracts/libraries/PoolAddress.sol';\nimport '../contracts/libraries/FixedPoint96.sol';\nimport '../contracts/libraries/FullMath.sol';\nimport '../contracts/libraries/TickMath.sol';\nimport '../contracts/UniV3PairManager.sol';\nimport '../interfaces/external/IWeth9.sol';\nimport '../interfaces/IUniV3PairManager.sol';\n\ncontract UniV3PairManagerForTest is UniV3PairManager {\n constructor(address _pool, address _governance) UniV3PairManager(_pool, _governance) {}\n\n function internalAddLiquidity(\n uint256 amount0Desired,\n uint256 amount1Desired,\n uint256 amount0Min,\n uint256 amount1Min\n )\n external\n returns (\n uint128 liquidity,\n uint256 amount0,\n uint256 amount1\n )\n {\n return _addLiquidity(amount0Desired, amount1Desired, amount0Min, amount1Min);\n }\n\n function internalPay(\n address token,\n address payer,\n address recipient,\n uint256 value\n ) external {\n return _pay(token, payer, recipient, value);\n }\n\n function internalMint(address dst, uint256 amount) external {\n return _mint(dst, amount);\n }\n\n function internalBurn(address dst, uint256 amount) external {\n return _burn(dst, amount);\n }\n\n function internalTransferTokens(\n address src,\n address dst,\n uint256 amount\n ) external {\n _transferTokens(src, dst, amount);\n }\n\n function internalSafeTransferFrom(\n address token,\n address from,\n address to,\n uint256 value\n ) external {\n _safeTransferFrom(token, from, to, value);\n }\n\n receive() external payable {}\n}\n" - }, - "@openzeppelin/contracts/token/ERC20/ERC20.sol": { - "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\nimport \"./IERC20.sol\";\nimport \"./extensions/IERC20Metadata.sol\";\nimport \"../../utils/Context.sol\";\n\n/**\n * @dev Implementation of the {IERC20} interface.\n *\n * This implementation is agnostic to the way tokens are created. This means\n * that a supply mechanism has to be added in a derived contract using {_mint}.\n * For a generic mechanism see {ERC20PresetMinterPauser}.\n *\n * TIP: For a detailed writeup see our guide\n * https://forum.zeppelin.solutions/t/how-to-implement-erc20-supply-mechanisms/226[How\n * to implement supply mechanisms].\n *\n * We have followed general OpenZeppelin Contracts guidelines: functions revert\n * instead returning `false` on failure. This behavior is nonetheless\n * conventional and does not conflict with the expectations of ERC20\n * applications.\n *\n * Additionally, an {Approval} event is emitted on calls to {transferFrom}.\n * This allows applications to reconstruct the allowance for all accounts just\n * by listening to said events. Other implementations of the EIP may not emit\n * these events, as it isn't required by the specification.\n *\n * Finally, the non-standard {decreaseAllowance} and {increaseAllowance}\n * functions have been added to mitigate the well-known issues around setting\n * allowances. See {IERC20-approve}.\n */\ncontract ERC20 is Context, IERC20, IERC20Metadata {\n mapping(address => uint256) private _balances;\n\n mapping(address => mapping(address => uint256)) private _allowances;\n\n uint256 private _totalSupply;\n\n string private _name;\n string private _symbol;\n\n /**\n * @dev Sets the values for {name} and {symbol}.\n *\n * The default value of {decimals} is 18. To select a different value for\n * {decimals} you should overload it.\n *\n * All two of these values are immutable: they can only be set once during\n * construction.\n */\n constructor(string memory name_, string memory symbol_) {\n _name = name_;\n _symbol = symbol_;\n }\n\n /**\n * @dev Returns the name of the token.\n */\n function name() public view virtual override returns (string memory) {\n return _name;\n }\n\n /**\n * @dev Returns the symbol of the token, usually a shorter version of the\n * name.\n */\n function symbol() public view virtual override returns (string memory) {\n return _symbol;\n }\n\n /**\n * @dev Returns the number of decimals used to get its user representation.\n * For example, if `decimals` equals `2`, a balance of `505` tokens should\n * be displayed to a user as `5.05` (`505 / 10 ** 2`).\n *\n * Tokens usually opt for a value of 18, imitating the relationship between\n * Ether and Wei. This is the value {ERC20} uses, unless this function is\n * overridden;\n *\n * NOTE: This information is only used for _display_ purposes: it in\n * no way affects any of the arithmetic of the contract, including\n * {IERC20-balanceOf} and {IERC20-transfer}.\n */\n function decimals() public view virtual override returns (uint8) {\n return 18;\n }\n\n /**\n * @dev See {IERC20-totalSupply}.\n */\n function totalSupply() public view virtual override returns (uint256) {\n return _totalSupply;\n }\n\n /**\n * @dev See {IERC20-balanceOf}.\n */\n function balanceOf(address account) public view virtual override returns (uint256) {\n return _balances[account];\n }\n\n /**\n * @dev See {IERC20-transfer}.\n *\n * Requirements:\n *\n * - `recipient` cannot be the zero address.\n * - the caller must have a balance of at least `amount`.\n */\n function transfer(address recipient, uint256 amount) public virtual override returns (bool) {\n _transfer(_msgSender(), recipient, amount);\n return true;\n }\n\n /**\n * @dev See {IERC20-allowance}.\n */\n function allowance(address owner, address spender) public view virtual override returns (uint256) {\n return _allowances[owner][spender];\n }\n\n /**\n * @dev See {IERC20-approve}.\n *\n * Requirements:\n *\n * - `spender` cannot be the zero address.\n */\n function approve(address spender, uint256 amount) public virtual override returns (bool) {\n _approve(_msgSender(), spender, amount);\n return true;\n }\n\n /**\n * @dev See {IERC20-transferFrom}.\n *\n * Emits an {Approval} event indicating the updated allowance. This is not\n * required by the EIP. See the note at the beginning of {ERC20}.\n *\n * Requirements:\n *\n * - `sender` and `recipient` cannot be the zero address.\n * - `sender` must have a balance of at least `amount`.\n * - the caller must have allowance for ``sender``'s tokens of at least\n * `amount`.\n */\n function transferFrom(\n address sender,\n address recipient,\n uint256 amount\n ) public virtual override returns (bool) {\n _transfer(sender, recipient, amount);\n\n uint256 currentAllowance = _allowances[sender][_msgSender()];\n require(currentAllowance >= amount, \"ERC20: transfer amount exceeds allowance\");\n unchecked {\n _approve(sender, _msgSender(), currentAllowance - amount);\n }\n\n return true;\n }\n\n /**\n * @dev Atomically increases the allowance granted to `spender` by the caller.\n *\n * This is an alternative to {approve} that can be used as a mitigation for\n * problems described in {IERC20-approve}.\n *\n * Emits an {Approval} event indicating the updated allowance.\n *\n * Requirements:\n *\n * - `spender` cannot be the zero address.\n */\n function increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool) {\n _approve(_msgSender(), spender, _allowances[_msgSender()][spender] + addedValue);\n return true;\n }\n\n /**\n * @dev Atomically decreases the allowance granted to `spender` by the caller.\n *\n * This is an alternative to {approve} that can be used as a mitigation for\n * problems described in {IERC20-approve}.\n *\n * Emits an {Approval} event indicating the updated allowance.\n *\n * Requirements:\n *\n * - `spender` cannot be the zero address.\n * - `spender` must have allowance for the caller of at least\n * `subtractedValue`.\n */\n function decreaseAllowance(address spender, uint256 subtractedValue) public virtual returns (bool) {\n uint256 currentAllowance = _allowances[_msgSender()][spender];\n require(currentAllowance >= subtractedValue, \"ERC20: decreased allowance below zero\");\n unchecked {\n _approve(_msgSender(), spender, currentAllowance - subtractedValue);\n }\n\n return true;\n }\n\n /**\n * @dev Moves `amount` of tokens from `sender` to `recipient`.\n *\n * This internal function is equivalent to {transfer}, and can be used to\n * e.g. implement automatic token fees, slashing mechanisms, etc.\n *\n * Emits a {Transfer} event.\n *\n * Requirements:\n *\n * - `sender` cannot be the zero address.\n * - `recipient` cannot be the zero address.\n * - `sender` must have a balance of at least `amount`.\n */\n function _transfer(\n address sender,\n address recipient,\n uint256 amount\n ) internal virtual {\n require(sender != address(0), \"ERC20: transfer from the zero address\");\n require(recipient != address(0), \"ERC20: transfer to the zero address\");\n\n _beforeTokenTransfer(sender, recipient, amount);\n\n uint256 senderBalance = _balances[sender];\n require(senderBalance >= amount, \"ERC20: transfer amount exceeds balance\");\n unchecked {\n _balances[sender] = senderBalance - amount;\n }\n _balances[recipient] += amount;\n\n emit Transfer(sender, recipient, amount);\n\n _afterTokenTransfer(sender, recipient, amount);\n }\n\n /** @dev Creates `amount` tokens and assigns them to `account`, increasing\n * the total supply.\n *\n * Emits a {Transfer} event with `from` set to the zero address.\n *\n * Requirements:\n *\n * - `account` cannot be the zero address.\n */\n function _mint(address account, uint256 amount) internal virtual {\n require(account != address(0), \"ERC20: mint to the zero address\");\n\n _beforeTokenTransfer(address(0), account, amount);\n\n _totalSupply += amount;\n _balances[account] += amount;\n emit Transfer(address(0), account, amount);\n\n _afterTokenTransfer(address(0), account, amount);\n }\n\n /**\n * @dev Destroys `amount` tokens from `account`, reducing the\n * total supply.\n *\n * Emits a {Transfer} event with `to` set to the zero address.\n *\n * Requirements:\n *\n * - `account` cannot be the zero address.\n * - `account` must have at least `amount` tokens.\n */\n function _burn(address account, uint256 amount) internal virtual {\n require(account != address(0), \"ERC20: burn from the zero address\");\n\n _beforeTokenTransfer(account, address(0), amount);\n\n uint256 accountBalance = _balances[account];\n require(accountBalance >= amount, \"ERC20: burn amount exceeds balance\");\n unchecked {\n _balances[account] = accountBalance - amount;\n }\n _totalSupply -= amount;\n\n emit Transfer(account, address(0), amount);\n\n _afterTokenTransfer(account, address(0), amount);\n }\n\n /**\n * @dev Sets `amount` as the allowance of `spender` over the `owner` s tokens.\n *\n * This internal function is equivalent to `approve`, and can be used to\n * e.g. set automatic allowances for certain subsystems, etc.\n *\n * Emits an {Approval} event.\n *\n * Requirements:\n *\n * - `owner` cannot be the zero address.\n * - `spender` cannot be the zero address.\n */\n function _approve(\n address owner,\n address spender,\n uint256 amount\n ) internal virtual {\n require(owner != address(0), \"ERC20: approve from the zero address\");\n require(spender != address(0), \"ERC20: approve to the zero address\");\n\n _allowances[owner][spender] = amount;\n emit Approval(owner, spender, amount);\n }\n\n /**\n * @dev Hook that is called before any transfer of tokens. This includes\n * minting and burning.\n *\n * Calling conditions:\n *\n * - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens\n * will be transferred to `to`.\n * - when `from` is zero, `amount` tokens will be minted for `to`.\n * - when `to` is zero, `amount` of ``from``'s tokens will be burned.\n * - `from` and `to` are never both zero.\n *\n * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].\n */\n function _beforeTokenTransfer(\n address from,\n address to,\n uint256 amount\n ) internal virtual {}\n\n /**\n * @dev Hook that is called after any transfer of tokens. This includes\n * minting and burning.\n *\n * Calling conditions:\n *\n * - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens\n * has been transferred to `to`.\n * - when `from` is zero, `amount` tokens have been minted for `to`.\n * - when `to` is zero, `amount` of ``from``'s tokens have been burned.\n * - `from` and `to` are never both zero.\n *\n * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].\n */\n function _afterTokenTransfer(\n address from,\n address to,\n uint256 amount\n ) internal virtual {}\n}\n" - }, - "solidity/contracts/libraries/LiquidityAmounts.sol": { - "content": "// SPDX-License-Identifier: GPL-2.0-or-later\npragma solidity >=0.8.4 <0.9.0;\n\nimport './FullMath.sol';\nimport './FixedPoint96.sol';\n\n// solhint-disable\nlibrary LiquidityAmounts {\n function toUint128(uint256 x) private pure returns (uint128 y) {\n require((y = uint128(x)) == x);\n }\n\n function getLiquidityForAmount0(\n uint160 sqrtRatioAX96,\n uint160 sqrtRatioBX96,\n uint256 amount0\n ) internal pure returns (uint128 liquidity) {\n if (sqrtRatioAX96 > sqrtRatioBX96) (sqrtRatioAX96, sqrtRatioBX96) = (sqrtRatioBX96, sqrtRatioAX96);\n uint256 intermediate = FullMath.mulDiv(sqrtRatioAX96, sqrtRatioBX96, FixedPoint96.Q96);\n return toUint128(FullMath.mulDiv(amount0, intermediate, sqrtRatioBX96 - sqrtRatioAX96));\n }\n\n function getLiquidityForAmount1(\n uint160 sqrtRatioAX96,\n uint160 sqrtRatioBX96,\n uint256 amount1\n ) internal pure returns (uint128 liquidity) {\n if (sqrtRatioAX96 > sqrtRatioBX96) (sqrtRatioAX96, sqrtRatioBX96) = (sqrtRatioBX96, sqrtRatioAX96);\n return toUint128(FullMath.mulDiv(amount1, FixedPoint96.Q96, sqrtRatioBX96 - sqrtRatioAX96));\n }\n\n function getLiquidityForAmounts(\n uint160 sqrtRatioX96,\n uint160 sqrtRatioAX96,\n uint160 sqrtRatioBX96,\n uint256 amount0,\n uint256 amount1\n ) internal pure returns (uint128 liquidity) {\n if (sqrtRatioAX96 > sqrtRatioBX96) (sqrtRatioAX96, sqrtRatioBX96) = (sqrtRatioBX96, sqrtRatioAX96);\n\n if (sqrtRatioX96 <= sqrtRatioAX96) {\n liquidity = getLiquidityForAmount0(sqrtRatioAX96, sqrtRatioBX96, amount0);\n } else if (sqrtRatioX96 < sqrtRatioBX96) {\n uint128 liquidity0 = getLiquidityForAmount0(sqrtRatioX96, sqrtRatioBX96, amount0);\n uint128 liquidity1 = getLiquidityForAmount1(sqrtRatioAX96, sqrtRatioX96, amount1);\n\n liquidity = liquidity0 < liquidity1 ? liquidity0 : liquidity1;\n } else {\n liquidity = getLiquidityForAmount1(sqrtRatioAX96, sqrtRatioBX96, amount1);\n }\n }\n\n function getAmount0ForLiquidity(\n uint160 sqrtRatioAX96,\n uint160 sqrtRatioBX96,\n uint128 liquidity\n ) internal pure returns (uint256 amount0) {\n if (sqrtRatioAX96 > sqrtRatioBX96) (sqrtRatioAX96, sqrtRatioBX96) = (sqrtRatioBX96, sqrtRatioAX96);\n\n return FullMath.mulDiv(uint256(liquidity) << FixedPoint96.RESOLUTION, sqrtRatioBX96 - sqrtRatioAX96, sqrtRatioBX96) / sqrtRatioAX96;\n }\n\n function getAmount1ForLiquidity(\n uint160 sqrtRatioAX96,\n uint160 sqrtRatioBX96,\n uint128 liquidity\n ) internal pure returns (uint256 amount1) {\n if (sqrtRatioAX96 > sqrtRatioBX96) (sqrtRatioAX96, sqrtRatioBX96) = (sqrtRatioBX96, sqrtRatioAX96);\n\n return FullMath.mulDiv(liquidity, sqrtRatioBX96 - sqrtRatioAX96, FixedPoint96.Q96);\n }\n\n function getAmountsForLiquidity(\n uint160 sqrtRatioX96,\n uint160 sqrtRatioAX96,\n uint160 sqrtRatioBX96,\n uint128 liquidity\n ) internal pure returns (uint256 amount0, uint256 amount1) {\n if (sqrtRatioAX96 > sqrtRatioBX96) (sqrtRatioAX96, sqrtRatioBX96) = (sqrtRatioBX96, sqrtRatioAX96);\n\n if (sqrtRatioX96 <= sqrtRatioAX96) {\n amount0 = getAmount0ForLiquidity(sqrtRatioAX96, sqrtRatioBX96, liquidity);\n } else if (sqrtRatioX96 < sqrtRatioBX96) {\n amount0 = getAmount0ForLiquidity(sqrtRatioX96, sqrtRatioBX96, liquidity);\n amount1 = getAmount1ForLiquidity(sqrtRatioAX96, sqrtRatioX96, liquidity);\n } else {\n amount1 = getAmount1ForLiquidity(sqrtRatioAX96, sqrtRatioBX96, liquidity);\n }\n }\n}\n" - }, - "solidity/contracts/libraries/PoolAddress.sol": { - "content": "// SPDX-License-Identifier: GPL-2.0-or-later\npragma solidity >=0.8.4 <0.9.0;\n\nlibrary PoolAddress {\n struct PoolKey {\n address token0;\n address token1;\n uint24 fee;\n }\n}\n" - }, - "solidity/contracts/libraries/FixedPoint96.sol": { - "content": "// SPDX-License-Identifier: GPL-2.0-or-later\npragma solidity >=0.8.4 <0.9.0;\n\nlibrary FixedPoint96 {\n // solhint-disable\n uint8 internal constant RESOLUTION = 96;\n uint256 internal constant Q96 = 0x1000000000000000000000000;\n}\n" - }, - "solidity/contracts/UniV3PairManager.sol": { - "content": "// SPDX-License-Identifier: MIT\n\n/*\n\nCoded for The Keep3r Network with ♥ by\n\n██████╗░███████╗███████╗██╗  ░██╗░░░░░░░██╗░█████╗░███╗░░██╗██████╗░███████╗██████╗░██╗░░░░░░█████╗░███╗░░██╗██████╗░\n██╔══██╗██╔════╝██╔════╝██║  ░██║░░██╗░░██║██╔══██╗████╗░██║██╔══██╗██╔════╝██╔══██╗██║░░░░░██╔══██╗████╗░██║██╔══██╗\n██║░░██║█████╗░░█████╗░░██║  ░╚██╗████╗██╔╝██║░░██║██╔██╗██║██║░░██║█████╗░░██████╔╝██║░░░░░███████║██╔██╗██║██║░░██║\n██║░░██║██╔══╝░░██╔══╝░░██║  ░░████╔═████║░██║░░██║██║╚████║██║░░██║██╔══╝░░██╔══██╗██║░░░░░██╔══██║██║╚████║██║░░██║\n██████╔╝███████╗██║░░░░░██║  ░░╚██╔╝░╚██╔╝░╚█████╔╝██║░╚███║██████╔╝███████╗██║░░██║███████╗██║░░██║██║░╚███║██████╔╝\n╚═════╝░╚══════╝╚═╝░░░░░╚═╝  ░░░╚═╝░░░╚═╝░░░╚════╝░╚═╝░░╚══╝╚═════╝░╚══════╝╚═╝░░╚═╝╚══════╝╚═╝░░╚═╝╚═╝░░╚══╝╚═════╝░\n\nhttps://defi.sucks\n\n*/\n\npragma solidity >=0.8.4 <0.9.0;\n\nimport '@openzeppelin/contracts/token/ERC20/ERC20.sol';\nimport '@uniswap/v3-core/contracts/interfaces/IUniswapV3Pool.sol';\n\nimport './libraries/LiquidityAmounts.sol';\nimport './libraries/PoolAddress.sol';\nimport './libraries/FixedPoint96.sol';\nimport './libraries/FullMath.sol';\nimport './libraries/TickMath.sol';\n\nimport '../interfaces/external/IWeth9.sol';\nimport '../interfaces/IUniV3PairManager.sol';\n\nimport './peripherals/Governable.sol';\n\ncontract UniV3PairManager is IUniV3PairManager, Governable {\n /// @inheritdoc IERC20Metadata\n string public override name;\n\n /// @inheritdoc IERC20Metadata\n string public override symbol;\n\n /// @inheritdoc IERC20\n uint256 public override totalSupply;\n\n /// @inheritdoc IPairManager\n address public immutable override factory;\n\n /// @inheritdoc IPairManager\n address public immutable override token0;\n\n /// @inheritdoc IPairManager\n address public immutable override token1;\n\n /// @inheritdoc IPairManager\n address public immutable override pool;\n\n /// @inheritdoc IUniV3PairManager\n uint24 public immutable override fee;\n\n /// @inheritdoc IUniV3PairManager\n uint160 public immutable override sqrtRatioAX96;\n\n /// @inheritdoc IUniV3PairManager\n uint160 public immutable override sqrtRatioBX96;\n\n /// @inheritdoc IUniV3PairManager\n int24 public immutable override tickLower;\n\n /// @inheritdoc IUniV3PairManager\n int24 public immutable override tickUpper;\n\n /// @inheritdoc IUniV3PairManager\n int24 public immutable override tickSpacing;\n\n /// @notice Uniswap's maximum tick\n /// @dev Due to tick spacing, pools with different fees may have differences between _MAX_TICK and tickUpper. Use tickUpper to find the max tick of the pool.\n int24 private constant _MAX_TICK = 887272;\n\n /// @inheritdoc IERC20Metadata\n //solhint-disable-next-line const-name-snakecase\n uint8 public constant override decimals = 18;\n\n /// @inheritdoc IERC20\n mapping(address => mapping(address => uint256)) public override allowance;\n\n /// @inheritdoc IERC20\n mapping(address => uint256) public override balanceOf;\n\n /// @notice Struct that contains token0, token1, and fee of the Uniswap pool\n PoolAddress.PoolKey private _poolKey;\n\n constructor(address _pool, address _governance) Governable(_governance) {\n uint24 _fee = IUniswapV3Pool(_pool).fee();\n address _token0 = IUniswapV3Pool(_pool).token0();\n address _token1 = IUniswapV3Pool(_pool).token1();\n int24 _tickSpacing = IUniswapV3Pool(_pool).tickSpacing();\n int24 _tickUpper = _MAX_TICK - (_MAX_TICK % _tickSpacing);\n int24 _tickLower = -_tickUpper;\n\n factory = msg.sender;\n pool = _pool;\n fee = _fee;\n tickSpacing = _tickSpacing;\n tickUpper = _tickUpper;\n tickLower = _tickLower;\n token0 = _token0;\n token1 = _token1;\n name = string(abi.encodePacked('Keep3rLP - ', ERC20(_token0).symbol(), '/', ERC20(_token1).symbol()));\n symbol = string(abi.encodePacked('kLP-', ERC20(_token0).symbol(), '/', ERC20(_token1).symbol()));\n\n sqrtRatioAX96 = TickMath.getSqrtRatioAtTick(_tickLower);\n sqrtRatioBX96 = TickMath.getSqrtRatioAtTick(_tickUpper);\n _poolKey = PoolAddress.PoolKey({token0: _token0, token1: _token1, fee: _fee});\n }\n\n // This low-level function should be called from a contract which performs important safety checks\n /// @inheritdoc IUniV3PairManager\n function mint(\n uint256 amount0Desired,\n uint256 amount1Desired,\n uint256 amount0Min,\n uint256 amount1Min,\n address to\n ) external override returns (uint128 liquidity) {\n (liquidity, , ) = _addLiquidity(amount0Desired, amount1Desired, amount0Min, amount1Min);\n _mint(to, liquidity);\n }\n\n /// @inheritdoc IUniV3PairManager\n function uniswapV3MintCallback(\n uint256 amount0Owed,\n uint256 amount1Owed,\n bytes calldata data\n ) external override {\n MintCallbackData memory decoded = abi.decode(data, (MintCallbackData));\n if (msg.sender != pool) revert OnlyPool();\n if (amount0Owed > 0) _pay(decoded._poolKey.token0, decoded.payer, pool, amount0Owed);\n if (amount1Owed > 0) _pay(decoded._poolKey.token1, decoded.payer, pool, amount1Owed);\n }\n\n /// @inheritdoc IUniV3PairManager\n function burn(\n uint128 liquidity,\n uint256 amount0Min,\n uint256 amount1Min,\n address to\n ) external override returns (uint256 amount0, uint256 amount1) {\n (amount0, amount1) = IUniswapV3Pool(pool).burn(tickLower, tickUpper, liquidity);\n\n if (amount0 < amount0Min || amount1 < amount1Min) revert ExcessiveSlippage();\n\n IUniswapV3Pool(pool).collect(to, tickLower, tickUpper, uint128(amount0), uint128(amount1));\n _burn(msg.sender, liquidity);\n }\n\n /// @inheritdoc IUniV3PairManager\n function collect() external override onlyGovernance returns (uint256 amount0, uint256 amount1) {\n (, , , uint128 tokensOwed0, uint128 tokensOwed1) = IUniswapV3Pool(pool).positions(\n keccak256(abi.encodePacked(address(this), tickLower, tickUpper))\n );\n (amount0, amount1) = IUniswapV3Pool(pool).collect(governance, tickLower, tickUpper, tokensOwed0, tokensOwed1);\n }\n\n /// @inheritdoc IUniV3PairManager\n function position()\n external\n view\n override\n returns (\n uint128 liquidity,\n uint256 feeGrowthInside0LastX128,\n uint256 feeGrowthInside1LastX128,\n uint128 tokensOwed0,\n uint128 tokensOwed1\n )\n {\n (liquidity, feeGrowthInside0LastX128, feeGrowthInside1LastX128, tokensOwed0, tokensOwed1) = IUniswapV3Pool(pool).positions(\n keccak256(abi.encodePacked(address(this), tickLower, tickUpper))\n );\n }\n\n /// @inheritdoc IERC20\n function approve(address spender, uint256 amount) external override returns (bool) {\n allowance[msg.sender][spender] = amount;\n\n emit Approval(msg.sender, spender, amount);\n return true;\n }\n\n /// @inheritdoc IERC20\n function transfer(address to, uint256 amount) external override returns (bool) {\n _transferTokens(msg.sender, to, amount);\n return true;\n }\n\n /// @inheritdoc IERC20\n function transferFrom(\n address from,\n address to,\n uint256 amount\n ) external override returns (bool) {\n address spender = msg.sender;\n uint256 spenderAllowance = allowance[from][spender];\n\n if (spender != from && spenderAllowance != type(uint256).max) {\n uint256 newAllowance = spenderAllowance - amount;\n allowance[from][spender] = newAllowance;\n\n emit Approval(from, spender, newAllowance);\n }\n\n _transferTokens(from, to, amount);\n return true;\n }\n\n /// @notice Adds liquidity to an initialized pool\n /// @dev Reverts if the returned amount0 is less than amount0Min or if amount1 is less than amount1Min\n /// @dev This function calls the mint function of the corresponding Uniswap pool, which in turn calls UniswapV3Callback\n /// @param amount0Desired The amount of token0 we would like to provide\n /// @param amount1Desired The amount of token1 we would like to provide\n /// @param amount0Min The minimum amount of token0 we want to provide\n /// @param amount1Min The minimum amount of token1 we want to provide\n /// @return liquidity The calculated liquidity we get for the token amounts we provided\n /// @return amount0 The amount of token0 we ended up providing\n /// @return amount1 The amount of token1 we ended up providing\n function _addLiquidity(\n uint256 amount0Desired,\n uint256 amount1Desired,\n uint256 amount0Min,\n uint256 amount1Min\n )\n internal\n returns (\n uint128 liquidity,\n uint256 amount0,\n uint256 amount1\n )\n {\n (uint160 sqrtPriceX96, , , , , , ) = IUniswapV3Pool(pool).slot0();\n\n liquidity = LiquidityAmounts.getLiquidityForAmounts(sqrtPriceX96, sqrtRatioAX96, sqrtRatioBX96, amount0Desired, amount1Desired);\n\n (amount0, amount1) = IUniswapV3Pool(pool).mint(\n address(this),\n tickLower,\n tickUpper,\n liquidity,\n abi.encode(MintCallbackData({_poolKey: _poolKey, payer: msg.sender}))\n );\n\n if (amount0 < amount0Min || amount1 < amount1Min) revert ExcessiveSlippage();\n }\n\n /// @notice Transfers the passed-in token from the payer to the recipient for the corresponding value\n /// @param token The token to be transferred to the recipient\n /// @param from The address of the payer\n /// @param to The address of the passed-in tokens recipient\n /// @param value How much of that token to be transferred from payer to the recipient\n function _pay(\n address token,\n address from,\n address to,\n uint256 value\n ) internal {\n _safeTransferFrom(token, from, to, value);\n }\n\n /// @notice Mints Keep3r credits to the passed-in address of recipient and increases total supply of Keep3r credits by the corresponding amount\n /// @param to The recipient of the Keep3r credits\n /// @param amount The amount Keep3r credits to be minted to the recipient\n function _mint(address to, uint256 amount) internal {\n totalSupply += amount;\n balanceOf[to] += amount;\n emit Transfer(address(0), to, amount);\n }\n\n /// @notice Burns Keep3r credits to the passed-in address of recipient and reduces total supply of Keep3r credits by the corresponding amount\n /// @param to The address that will get its Keep3r credits burned\n /// @param amount The amount Keep3r credits to be burned from the recipient/recipient\n function _burn(address to, uint256 amount) internal {\n totalSupply -= amount;\n balanceOf[to] -= amount;\n emit Transfer(to, address(0), amount);\n }\n\n /// @notice Transfers amount of Keep3r credits between two addresses\n /// @param from The user that transfers the Keep3r credits\n /// @param to The user that receives the Keep3r credits\n /// @param amount The amount of Keep3r credits to be transferred\n function _transferTokens(\n address from,\n address to,\n uint256 amount\n ) internal {\n balanceOf[from] -= amount;\n balanceOf[to] += amount;\n\n emit Transfer(from, to, amount);\n }\n\n /// @notice Transfers the passed-in token from the specified \"from\" to the specified \"to\" for the corresponding value\n /// @dev Reverts with IUniV3PairManager#UnsuccessfulTransfer if the transfer was not successful,\n /// or if the passed data length is different than 0 and the decoded data is not a boolean\n /// @param token The token to be transferred to the specified \"to\"\n /// @param from The address which is going to transfer the tokens\n /// @param value How much of that token to be transferred from \"from\" to \"to\"\n function _safeTransferFrom(\n address token,\n address from,\n address to,\n uint256 value\n ) internal {\n // solhint-disable-next-line avoid-low-level-calls\n (bool success, bytes memory data) = token.call(abi.encodeWithSelector(IERC20.transferFrom.selector, from, to, value));\n if (!success || (data.length != 0 && !abi.decode(data, (bool)))) revert UnsuccessfulTransfer();\n }\n}\n" - }, - "solidity/interfaces/external/IWeth9.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '@openzeppelin/contracts/token/ERC20/IERC20.sol';\n\ninterface IWeth9 is IERC20 {\n function deposit() external payable;\n\n function withdraw(uint256) external;\n}\n" - }, - "solidity/interfaces/IUniV3PairManager.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport './IPairManager.sol';\nimport '../contracts/libraries/PoolAddress.sol';\nimport '@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol';\nimport './peripherals/IGovernable.sol';\n\n/// @title Pair Manager contract\n/// @notice Creates a UniswapV3 position, and tokenizes in an ERC20 manner\n/// so that the user can use it as liquidity for a Keep3rJob\ninterface IUniV3PairManager is IGovernable, IPairManager {\n // Structs\n\n /// @notice The data to be decoded by the UniswapV3MintCallback function\n struct MintCallbackData {\n PoolAddress.PoolKey _poolKey; // Struct that contains token0, token1, and fee of the pool passed into the constructor\n address payer; // The address of the payer, which will be the msg.sender of the mint function\n }\n\n // Variables\n\n /// @notice The fee of the Uniswap pool passed into the constructor\n /// @return _fee The fee of the Uniswap pool passed into the constructor\n function fee() external view returns (uint24 _fee);\n\n /// @notice Highest tick in the Uniswap's curve\n /// @return _tickUpper The highest tick in the Uniswap's curve\n function tickUpper() external view returns (int24 _tickUpper);\n\n /// @notice Lowest tick in the Uniswap's curve\n /// @return _tickLower The lower tick in the Uniswap's curve\n function tickLower() external view returns (int24 _tickLower);\n\n /// @notice The pair tick spacing\n /// @return _tickSpacing The pair tick spacing\n function tickSpacing() external view returns (int24 _tickSpacing);\n\n /// @notice The sqrtRatioAX96 at the lowest tick (-887200) of the Uniswap pool\n /// @return _sqrtPriceA96 A Fixed point Q64.96 number representing the sqrt of the ratio of the two assets (token1/token0)\n /// at the lowest tick\n function sqrtRatioAX96() external view returns (uint160 _sqrtPriceA96);\n\n /// @notice The sqrtRatioBX96 at the highest tick (887200) of the Uniswap pool\n /// @return _sqrtPriceBX96 A Fixed point Q64.96 number representing the sqrt of the ratio of the two assets (token1/token0)\n /// at the highest tick\n function sqrtRatioBX96() external view returns (uint160 _sqrtPriceBX96);\n\n // Errors\n\n /// @notice Throws when the caller of the function is not the pool\n error OnlyPool();\n\n /// @notice Throws when the slippage exceeds what the user is comfortable with\n error ExcessiveSlippage();\n\n /// @notice Throws when a transfer is unsuccessful\n error UnsuccessfulTransfer();\n\n // Methods\n\n /// @notice This function is called after a user calls IUniV3PairManager#mint function\n /// It ensures that any tokens owed to the pool are paid by the msg.sender of IUniV3PairManager#mint function\n /// @param amount0Owed The amount of token0 due to the pool for the minted liquidity\n /// @param amount1Owed The amount of token1 due to the pool for the minted liquidity\n /// @param data The encoded token0, token1, fee (_poolKey) and the payer (msg.sender) of the IUniV3PairManager#mint function\n function uniswapV3MintCallback(\n uint256 amount0Owed,\n uint256 amount1Owed,\n bytes calldata data\n ) external;\n\n /// @notice Mints kLP tokens to an address according to the liquidity the msg.sender provides to the UniswapV3 pool\n /// @dev Triggers UniV3PairManager#uniswapV3MintCallback\n /// @param amount0Desired The amount of token0 we would like to provide\n /// @param amount1Desired The amount of token1 we would like to provide\n /// @param amount0Min The minimum amount of token0 we want to provide\n /// @param amount1Min The minimum amount of token1 we want to provide\n /// @param to The address to which the kLP tokens are going to be minted to\n /// @return liquidity kLP tokens sent in exchange for the provision of tokens\n function mint(\n uint256 amount0Desired,\n uint256 amount1Desired,\n uint256 amount0Min,\n uint256 amount1Min,\n address to\n ) external returns (uint128 liquidity);\n\n /// @notice Returns the pair manager's position in the corresponding UniswapV3 pool\n /// @return liquidity The amount of liquidity provided to the UniswapV3 pool by the pair manager\n /// @return feeGrowthInside0LastX128 The fee growth of token0 as of the last action on the individual position\n /// @return feeGrowthInside1LastX128 The fee growth of token1 as of the last action on the individual position\n /// @return tokensOwed0 The uncollected amount of token0 owed to the position as of the last computation\n /// @return tokensOwed1 The uncollected amount of token1 owed to the position as of the last computation\n function position()\n external\n view\n returns (\n uint128 liquidity,\n uint256 feeGrowthInside0LastX128,\n uint256 feeGrowthInside1LastX128,\n uint128 tokensOwed0,\n uint128 tokensOwed1\n );\n\n /// @notice Calls the UniswapV3 pool's collect function, which collects up to a maximum amount of fees\n // owed to a specific position to the recipient, in this case, that recipient is the pair manager\n /// @dev The collected fees will be sent to governance\n /// @return amount0 The amount of fees collected in token0\n /// @return amount1 The amount of fees collected in token1\n function collect() external returns (uint256 amount0, uint256 amount1);\n\n /// @notice Burns the corresponding amount of kLP tokens from the msg.sender and withdraws the specified liquidity\n // in the entire range\n /// @param liquidity The amount of liquidity to be burned\n /// @param amount0Min The minimum amount of token0 we want to send to the recipient (to)\n /// @param amount1Min The minimum amount of token1 we want to send to the recipient (to)\n /// @param to The address that will receive the due fees\n /// @return amount0 The calculated amount of token0 that will be sent to the recipient\n /// @return amount1 The calculated amount of token1 that will be sent to the recipient\n function burn(\n uint128 liquidity,\n uint256 amount0Min,\n uint256 amount1Min,\n address to\n ) external returns (uint256 amount0, uint256 amount1);\n}\n" - }, - "@openzeppelin/contracts/utils/Context.sol": { - "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Provides information about the current execution context, including the\n * sender of the transaction and its data. While these are generally available\n * via msg.sender and msg.data, they should not be accessed in such a direct\n * manner, since when dealing with meta-transactions the account sending and\n * paying for execution may not be the actual sender (as far as an application\n * is concerned).\n *\n * This contract is only required for intermediate, library-like contracts.\n */\nabstract contract Context {\n function _msgSender() internal view virtual returns (address) {\n return msg.sender;\n }\n\n function _msgData() internal view virtual returns (bytes calldata) {\n return msg.data;\n }\n}\n" - }, - "solidity/interfaces/IPairManagerFactory.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport './peripherals/IGovernable.sol';\n\n/// @title Factory of Pair Managers\n/// @notice This contract creates new pair managers\ninterface IPairManagerFactory is IGovernable {\n // Variables\n\n /// @notice Maps the address of a Uniswap pool, to the address of the corresponding PairManager\n /// For example, the uniswap address of DAI-WETH, will return the Keep3r/DAI-WETH pair manager address\n /// @param _pool The address of the Uniswap pool\n /// @return _pairManager The address of the corresponding pair manager\n function pairManagers(address _pool) external view returns (address _pairManager);\n\n // Events\n\n /// @notice Emitted when a new pair manager is created\n /// @param _pool The address of the corresponding Uniswap pool\n /// @param _pairManager The address of the just-created pair manager\n event PairCreated(address _pool, address _pairManager);\n\n // Errors\n\n /// @notice Throws an error if the pair manager is already initialized\n error AlreadyInitialized();\n\n /// @notice Throws an error if the caller is not the owner\n error OnlyOwner();\n\n // Methods\n\n /// @notice Creates a new pair manager based on the address of a Uniswap pool\n /// For example, the uniswap address of DAI-WETH, will create the Keep3r/DAI-WETH pool\n /// @param _pool The address of the Uniswap pool the pair manager will be based of\n /// @return _pairManager The address of the just-created pair manager\n function createPairManager(address _pool) external returns (address _pairManager);\n}\n" - }, - "solidity/contracts/UniV3PairManagerFactory.sol": { - "content": "// SPDX-License-Identifier: MIT\n\n/*\n\nCoded for The Keep3r Network with ♥ by\n\n██████╗░███████╗███████╗██╗  ░██╗░░░░░░░██╗░█████╗░███╗░░██╗██████╗░███████╗██████╗░██╗░░░░░░█████╗░███╗░░██╗██████╗░\n██╔══██╗██╔════╝██╔════╝██║  ░██║░░██╗░░██║██╔══██╗████╗░██║██╔══██╗██╔════╝██╔══██╗██║░░░░░██╔══██╗████╗░██║██╔══██╗\n██║░░██║█████╗░░█████╗░░██║  ░╚██╗████╗██╔╝██║░░██║██╔██╗██║██║░░██║█████╗░░██████╔╝██║░░░░░███████║██╔██╗██║██║░░██║\n██║░░██║██╔══╝░░██╔══╝░░██║  ░░████╔═████║░██║░░██║██║╚████║██║░░██║██╔══╝░░██╔══██╗██║░░░░░██╔══██║██║╚████║██║░░██║\n██████╔╝███████╗██║░░░░░██║  ░░╚██╔╝░╚██╔╝░╚█████╔╝██║░╚███║██████╔╝███████╗██║░░██║███████╗██║░░██║██║░╚███║██████╔╝\n╚═════╝░╚══════╝╚═╝░░░░░╚═╝  ░░░╚═╝░░░╚═╝░░░╚════╝░╚═╝░░╚══╝╚═════╝░╚══════╝╚═╝░░╚═╝╚══════╝╚═╝░░╚═╝╚═╝░░╚══╝╚═════╝░\n\nhttps://defi.sucks\n\n*/\n\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../interfaces/IPairManagerFactory.sol';\nimport './UniV3PairManager.sol';\nimport './peripherals/Governable.sol';\n\n/// @title Factory of Pair Managers\n/// @notice This contract creates new pair managers\ncontract UniV3PairManagerFactory is IPairManagerFactory, Governable {\n mapping(address => address) public override pairManagers;\n\n constructor(address _governance) Governable(_governance) {}\n\n ///@inheritdoc IPairManagerFactory\n function createPairManager(address _pool) external override returns (address _pairManager) {\n if (pairManagers[_pool] != address(0)) revert AlreadyInitialized();\n _pairManager = address(new UniV3PairManager(_pool, governance));\n pairManagers[_pool] = _pairManager;\n emit PairCreated(_pool, _pairManager);\n }\n}\n" - }, - "solidity/for-test/peripherals/GovernableForTest.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../../contracts/peripherals/Governable.sol';\n\ncontract GovernableForTest is Governable {\n constructor(address _governor) Governable(_governor) {}\n}\n" - }, - "solidity/for-test/ERC20ForTest.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '@openzeppelin/contracts/token/ERC20/ERC20.sol';\n\ncontract ERC20ForTest is ERC20 {\n constructor(\n string memory _name,\n string memory _symbol,\n address _initialAccount,\n uint256 _initialBalance\n ) ERC20(_name, _symbol) {\n _mint(_initialAccount, _initialBalance);\n }\n\n function mint(address _account, uint256 _amount) public {\n _mint(_account, _amount);\n }\n\n function burn(address _account, uint256 _amount) public {\n _burn(_account, _amount);\n }\n\n function transferInternal(\n address _from,\n address _to,\n uint256 _value\n ) public {\n _transfer(_from, _to, _value);\n }\n\n function approveInternal(\n address _owner,\n address _spender,\n uint256 _value\n ) public {\n _approve(_owner, _spender, _value);\n }\n\n function deposit(uint256 _amount) external payable {\n // Function added for compatibility with WETH\n }\n}\n" - }, - "solidity/for-test/peripherals/keepers/Keep3rKeeperFundableForTest.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../../../contracts/peripherals/keepers/Keep3rKeeperFundable.sol';\n\ncontract Keep3rKeeperFundableForTest is Keep3rKeeperFundable {\n using EnumerableSet for EnumerableSet.AddressSet;\n\n constructor(\n address _kph,\n address _keep3rV1,\n address _keep3rV1Proxy,\n address _kp3rWethPool\n ) Keep3rParameters(_kph, _keep3rV1, _keep3rV1Proxy, _kp3rWethPool) Keep3rRoles(msg.sender) {}\n\n function isKeeper(address _keeper) external view returns (bool) {\n return _keepers.contains(_keeper);\n }\n\n function setJob(address job) external {\n _jobs.add(job);\n }\n}\n" - }, - "solidity/for-test/peripherals/jobs/Keep3rJobWorkableForTest.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../../../contracts/peripherals/jobs/Keep3rJobWorkable.sol';\n\ncontract Keep3rJobWorkableForTest is Keep3rJobWorkable {\n using EnumerableSet for EnumerableSet.AddressSet;\n\n constructor(\n address _keep3rHelper,\n address _keep3rV1,\n address _keep3rV1Proxy,\n address _kp3rWethPool\n ) Keep3rParameters(_keep3rHelper, _keep3rV1, _keep3rV1Proxy, _kp3rWethPool) Keep3rRoles(msg.sender) {}\n\n function setJob(address _job) external {\n _jobs.add(_job);\n }\n\n function setKeeper(address _keeper) external {\n _keepers.add(_keeper);\n }\n\n function setApprovedLiquidity(address _liquidity) external {\n _approvedLiquidities.add(_liquidity);\n }\n\n function setJobLiquidity(address _job, address _liquidity) external {\n _jobLiquidities[_job].add(_liquidity);\n }\n\n function viewJobLiquidityCredits(address _job) external view returns (uint256) {\n return _jobLiquidityCredits[_job];\n }\n\n function viewJobPeriodCredits(address _job) external view returns (uint256) {\n return _jobPeriodCredits[_job];\n }\n\n function viewTickCache(address _liquidity) external view returns (TickCache memory _tickCache) {\n _tickCache = _tick[_liquidity];\n }\n\n function viewGas() external view returns (uint256) {\n return _initialGas;\n }\n\n receive() external payable {}\n}\n" - }, - "solidity/for-test/peripherals/jobs/Keep3rJobManagerForTest.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../../../contracts/peripherals/jobs/Keep3rJobManager.sol';\n\ncontract Keep3rJobManagerForTest is Keep3rJobManager {\n using EnumerableSet for EnumerableSet.AddressSet;\n\n constructor(\n address _keep3rHelper,\n address _keep3rV1,\n address _keep3rV1Proxy,\n address _kp3rWethPool\n ) Keep3rParameters(_keep3rHelper, _keep3rV1, _keep3rV1Proxy, _kp3rWethPool) Keep3rRoles(msg.sender) {}\n\n function isJob(address _job) external view returns (bool _isJob) {\n _isJob = _jobs.contains(_job);\n }\n}\n" - }, - "solidity/for-test/peripherals/Keep3rParametersForTest.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../../contracts/peripherals/Keep3rParameters.sol';\n\ncontract Keep3rParametersForTest is Keep3rParameters {\n constructor(\n address _keep3rHelper,\n address _keep3rV1,\n address _keep3rV1Proxy,\n address _kp3rWethPool\n ) Keep3rParameters(_keep3rHelper, _keep3rV1, _keep3rV1Proxy, _kp3rWethPool) Keep3rRoles(msg.sender) {}\n\n function viewLiquidityPool(address _pool) public view returns (address) {\n return _liquidityPool[_pool];\n }\n\n function viewIsKP3RToken0(address _pool) public view returns (bool) {\n return _isKP3RToken0[_pool];\n }\n}\n" - }, - "solidity/for-test/peripherals/Keep3rDisputableForTest.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../../contracts/peripherals/Keep3rDisputable.sol';\n\ncontract Keep3rDisputableForTest is Keep3rDisputable {\n constructor() Keep3rRoles(msg.sender) {}\n}\n" - }, - "solidity/for-test/peripherals/keepers/Keep3rKeeperDisputableForTest.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../../../contracts/peripherals/keepers/Keep3rKeeperDisputable.sol';\n\ncontract Keep3rKeeperDisputableForTest is Keep3rKeeperDisputable {\n using EnumerableSet for EnumerableSet.AddressSet;\n\n constructor(\n address _kph,\n address _keep3rV1,\n address _keep3rV1Proxy,\n address _kp3rWethPool\n ) Keep3rParameters(_kph, _keep3rV1, _keep3rV1Proxy, _kp3rWethPool) Keep3rRoles(msg.sender) {}\n\n function setKeeper(address _keeper) external {\n _keepers.add(_keeper);\n }\n\n function internalSlash(\n address _bonded,\n address _keeper,\n uint256 _bondAmount,\n uint256 _unbondAmount\n ) external {\n _slash(_bonded, _keeper, _bondAmount, _unbondAmount);\n }\n\n function isKeeper(address _address) external view returns (bool _isKeeper) {\n _isKeeper = _keepers.contains(_address);\n }\n}\n" - }, - "solidity/for-test/peripherals/Keep3rAccountanceForTest.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../../contracts/peripherals/Keep3rAccountance.sol';\n\ncontract Keep3rAccountanceForTest is Keep3rAccountance {\n using EnumerableSet for EnumerableSet.AddressSet;\n\n function setJob(address job) external {\n _jobs.add(job);\n }\n\n function setKeeper(address keeper) external {\n _keepers.add(keeper);\n }\n}\n" - }, - "solidity/for-test/peripherals/jobs/Keep3rJobFundableLiquidityForTest.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../../../contracts/peripherals/jobs/Keep3rJobFundableLiquidity.sol';\n\ncontract Keep3rJobFundableLiquidityForTest is Keep3rJobFundableLiquidity {\n using EnumerableSet for EnumerableSet.AddressSet;\n\n constructor(\n address _kph,\n address _keep3rV1,\n address _keep3rV1Proxy,\n address _kp3rWethPool\n ) Keep3rParameters(_kph, _keep3rV1, _keep3rV1Proxy, _kp3rWethPool) Keep3rRoles(msg.sender) {}\n\n function setJob(address _job) external {\n _jobs.add(_job);\n }\n\n function setJobLiquidity(address _job, address _liquidity) external returns (bool) {\n return _jobLiquidities[_job].add(_liquidity);\n }\n\n function setApprovedLiquidity(address _liquidity) external {\n _approvedLiquidities.add(_liquidity);\n }\n\n function setRevokedLiquidity(address _liquidity) external {\n _approvedLiquidities.remove(_liquidity);\n }\n\n function viewTickCache(address _liquidity) external view returns (TickCache memory _tickCache) {\n _tickCache = _tick[_liquidity];\n }\n\n function viewTickOrder(address _liquidity) external view returns (bool) {\n return _isKP3RToken0[_liquidity];\n }\n\n function internalJobLiquidities(address _job) external view returns (address[] memory _list) {\n _list = _jobLiquidities[_job].values();\n }\n\n function internalSettleJobAccountance(address _job) external {\n _settleJobAccountance(_job);\n }\n}\n" - }, - "solidity/for-test/peripherals/jobs/Keep3rJobMigrationForTest.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../../../contracts/peripherals/jobs/Keep3rJobMigration.sol';\n\ncontract Keep3rJobMigrationForTest is Keep3rJobMigration {\n using EnumerableSet for EnumerableSet.AddressSet;\n\n mapping(address => uint256) public settleJobAccountanceCallCount;\n\n constructor(\n address _kph,\n address _keep3rV1,\n address _keep3rV1Proxy,\n address _kp3rWethPool\n ) Keep3rParameters(_kph, _keep3rV1, _keep3rV1Proxy, _kp3rWethPool) Keep3rRoles(msg.sender) {}\n\n function setJobToken(address _job, address _token) external {\n _jobTokens[_job].add(_token);\n }\n\n function setJobLiquidity(address _job, address _liquidity) external {\n _jobLiquidities[_job].add(_liquidity);\n }\n\n function viewJobTokenListLength(address _job) external view returns (uint256) {\n return _jobTokens[_job].length();\n }\n\n function viewJobLiquidityList(address _job) external view returns (address[] memory _list) {\n _list = _jobLiquidities[_job].values();\n }\n\n function viewJobPeriodCredits(address _job) external view returns (uint256) {\n return _jobPeriodCredits[_job];\n }\n\n function viewJobLiquidityCredits(address _job) external view returns (uint256) {\n return _jobLiquidityCredits[_job];\n }\n\n function viewMigrationCreatedAt(address _fromJob, address _toJob) external view returns (uint256) {\n return _migrationCreatedAt[_fromJob][_toJob];\n }\n\n function isJob(address _job) external view returns (bool) {\n return _jobs.contains(_job);\n }\n\n function _settleJobAccountance(address _job) internal override {\n settleJobAccountanceCallCount[_job]++;\n }\n}\n" - }, - "solidity/for-test/peripherals/jobs/Keep3rJobFundableCreditsForTest.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../../../contracts/peripherals/jobs/Keep3rJobFundableCredits.sol';\n\ncontract Keep3rJobFundableCreditsForTest is Keep3rJobFundableCredits {\n using EnumerableSet for EnumerableSet.AddressSet;\n\n constructor(\n address _kph,\n address _keep3rV1,\n address _keep3rV1Proxy,\n address _kp3rWethPool\n ) Keep3rParameters(_kph, _keep3rV1, _keep3rV1Proxy, _kp3rWethPool) Keep3rRoles(msg.sender) {}\n\n function setJob(address _job, address _jobOwner) external {\n _jobs.add(_job);\n jobOwner[_job] = _jobOwner;\n }\n\n function setJobToken(address _job, address _token) external {\n _jobTokens[_job].add(_token);\n }\n\n function isJobToken(address _job, address _token) external view returns (bool _contains) {\n _contains = _jobTokens[_job].contains(_token);\n }\n}\n" - }, - "solidity/contracts/Keep3rHelper.sol": { - "content": "// SPDX-License-Identifier: MIT\n\n/*\n\nCoded for The Keep3r Network with ♥ by\n\n██████╗░███████╗███████╗██╗  ░██╗░░░░░░░██╗░█████╗░███╗░░██╗██████╗░███████╗██████╗░██╗░░░░░░█████╗░███╗░░██╗██████╗░\n██╔══██╗██╔════╝██╔════╝██║  ░██║░░██╗░░██║██╔══██╗████╗░██║██╔══██╗██╔════╝██╔══██╗██║░░░░░██╔══██╗████╗░██║██╔══██╗\n██║░░██║█████╗░░█████╗░░██║  ░╚██╗████╗██╔╝██║░░██║██╔██╗██║██║░░██║█████╗░░██████╔╝██║░░░░░███████║██╔██╗██║██║░░██║\n██║░░██║██╔══╝░░██╔══╝░░██║  ░░████╔═████║░██║░░██║██║╚████║██║░░██║██╔══╝░░██╔══██╗██║░░░░░██╔══██║██║╚████║██║░░██║\n██████╔╝███████╗██║░░░░░██║  ░░╚██╔╝░╚██╔╝░╚█████╔╝██║░╚███║██████╔╝███████╗██║░░██║███████╗██║░░██║██║░╚███║██████╔╝\n╚═════╝░╚══════╝╚═╝░░░░░╚═╝  ░░░╚═╝░░░╚═╝░░░╚════╝░╚═╝░░╚══╝╚═════╝░╚══════╝╚═╝░░╚═╝╚══════╝╚═╝░░╚═╝╚═╝░░╚══╝╚═════╝░\n\nhttps://defi.sucks\n\n*/\n\npragma solidity >=0.8.7 <0.9.0;\n\nimport './libraries/FullMath.sol';\nimport './libraries/TickMath.sol';\nimport '../interfaces/IKeep3r.sol';\nimport '../interfaces/IKeep3rHelper.sol';\nimport './Keep3rHelperParameters.sol';\n\nimport '@openzeppelin/contracts/utils/math/Math.sol';\nimport '@uniswap/v3-core/contracts/interfaces/IUniswapV3Pool.sol';\n\ncontract Keep3rHelper is IKeep3rHelper, Keep3rHelperParameters {\n constructor(address _keep3rV2, address _governance) Keep3rHelperParameters(_keep3rV2, _governance) {}\n\n /// @inheritdoc IKeep3rHelper\n function quote(uint256 _eth) public view override returns (uint256 _amountOut) {\n uint32[] memory _secondsAgos = new uint32[](2);\n _secondsAgos[1] = quoteTwapTime;\n\n (int56[] memory _tickCumulatives, ) = IUniswapV3Pool(kp3rWethPool.poolAddress).observe(_secondsAgos);\n int56 _difference = _tickCumulatives[0] - _tickCumulatives[1];\n _amountOut = getQuoteAtTick(uint128(_eth), kp3rWethPool.isKP3RToken0 ? _difference : -_difference, quoteTwapTime);\n }\n\n /// @inheritdoc IKeep3rHelper\n function bonds(address _keeper) public view override returns (uint256 _amountBonded) {\n return IKeep3r(keep3rV2).bonds(_keeper, KP3R);\n }\n\n /// @inheritdoc IKeep3rHelper\n function getRewardAmountFor(address _keeper, uint256 _gasUsed) public view override returns (uint256 _kp3r) {\n uint256 _boost = getRewardBoostFor(bonds(_keeper));\n _kp3r = quote((_gasUsed * _boost) / BOOST_BASE);\n }\n\n /// @inheritdoc IKeep3rHelper\n function getRewardAmount(uint256 _gasUsed) external view override returns (uint256 _amount) {\n // solhint-disable-next-line avoid-tx-origin\n return getRewardAmountFor(tx.origin, _gasUsed);\n }\n\n /// @inheritdoc IKeep3rHelper\n function getRewardBoostFor(uint256 _bonds) public view override returns (uint256 _rewardBoost) {\n _bonds = Math.min(_bonds, targetBond);\n uint256 _cap = Math.max(minBoost, minBoost + ((maxBoost - minBoost) * _bonds) / targetBond);\n _rewardBoost = _cap * _getBasefee();\n }\n\n /// @inheritdoc IKeep3rHelper\n function getPoolTokens(address _pool) public view override returns (address _token0, address _token1) {\n return (IUniswapV3Pool(_pool).token0(), IUniswapV3Pool(_pool).token1());\n }\n\n /// @inheritdoc IKeep3rHelper\n function isKP3RToken0(address _pool) public view override returns (bool _isKP3RToken0) {\n address _token0;\n address _token1;\n (_token0, _token1) = getPoolTokens(_pool);\n if (_token0 == KP3R) {\n return true;\n } else if (_token1 != KP3R) {\n revert LiquidityPairInvalid();\n }\n }\n\n /// @inheritdoc IKeep3rHelper\n function observe(address _pool, uint32[] memory _secondsAgo)\n public\n view\n override\n returns (\n int56 _tickCumulative1,\n int56 _tickCumulative2,\n bool _success\n )\n {\n try IUniswapV3Pool(_pool).observe(_secondsAgo) returns (int56[] memory _uniswapResponse, uint160[] memory) {\n _tickCumulative1 = _uniswapResponse[0];\n if (_uniswapResponse.length > 1) {\n _tickCumulative2 = _uniswapResponse[1];\n }\n _success = true;\n } catch (bytes memory) {}\n }\n\n /// @inheritdoc IKeep3rHelper\n function getPaymentParams(uint256 _bonds)\n external\n view\n override\n returns (\n uint256 _boost,\n uint256 _oneEthQuote,\n uint256 _extra\n )\n {\n _oneEthQuote = quote(1 ether);\n _boost = getRewardBoostFor(_bonds);\n _extra = workExtraGas;\n }\n\n /// @inheritdoc IKeep3rHelper\n function getKP3RsAtTick(\n uint256 _liquidityAmount,\n int56 _tickDifference,\n uint256 _timeInterval\n ) public pure override returns (uint256 _kp3rAmount) {\n uint160 sqrtRatioX96 = TickMath.getSqrtRatioAtTick(int24(_tickDifference / int256(_timeInterval)));\n _kp3rAmount = FullMath.mulDiv(1 << 96, _liquidityAmount, sqrtRatioX96);\n }\n\n /// @inheritdoc IKeep3rHelper\n function getQuoteAtTick(\n uint128 _baseAmount,\n int56 _tickDifference,\n uint256 _timeInterval\n ) public pure override returns (uint256 _quoteAmount) {\n uint160 sqrtRatioX96 = TickMath.getSqrtRatioAtTick(int24(_tickDifference / int256(_timeInterval)));\n\n if (sqrtRatioX96 <= type(uint128).max) {\n uint256 ratioX192 = uint256(sqrtRatioX96) * sqrtRatioX96;\n _quoteAmount = FullMath.mulDiv(1 << 192, _baseAmount, ratioX192);\n } else {\n uint256 ratioX128 = FullMath.mulDiv(sqrtRatioX96, sqrtRatioX96, 1 << 64);\n _quoteAmount = FullMath.mulDiv(1 << 128, _baseAmount, ratioX128);\n }\n }\n\n /// @notice Gets the block's base fee\n /// @return _baseFee The block's basefee\n function _getBasefee() internal view virtual returns (uint256 _baseFee) {\n return block.basefee;\n }\n}\n" - }, - "solidity/for-test/Keep3rHelperForTest.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../contracts/Keep3rHelper.sol';\n\ncontract Keep3rHelperForTest is Keep3rHelper {\n uint256 public basefee;\n\n constructor(address _keep3rV2, address _governance) Keep3rHelper(_keep3rV2, _governance) {}\n\n function _getBasefee() internal view override returns (uint256) {\n return basefee;\n }\n\n function setBaseFee(uint256 _baseFee) external {\n basefee = _baseFee;\n }\n}\n" - }, - "solidity/for-test/libraries/LiquidityAmountsForTest.sol": { - "content": "// SPDX-License-Identifier: GPL-2.0-or-later\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../../contracts/libraries/FullMath.sol';\nimport '../../contracts/libraries/FixedPoint96.sol';\n\n/// @dev Made this library into a contract to be able to calculate liquidity more precisely for tests\n\n// solhint-disable\ncontract LiquidityAmountsForTest {\n function toUint128(uint256 x) private pure returns (uint128 y) {\n require((y = uint128(x)) == x);\n }\n\n function getLiquidityForAmount0(\n uint160 sqrtRatioAX96,\n uint160 sqrtRatioBX96,\n uint256 amount0\n ) public pure returns (uint128 liquidity) {\n if (sqrtRatioAX96 > sqrtRatioBX96) (sqrtRatioAX96, sqrtRatioBX96) = (sqrtRatioBX96, sqrtRatioAX96);\n uint256 intermediate = FullMath.mulDiv(sqrtRatioAX96, sqrtRatioBX96, FixedPoint96.Q96);\n return toUint128(FullMath.mulDiv(amount0, intermediate, sqrtRatioBX96 - sqrtRatioAX96));\n }\n\n function getLiquidityForAmount1(\n uint160 sqrtRatioAX96,\n uint160 sqrtRatioBX96,\n uint256 amount1\n ) public pure returns (uint128 liquidity) {\n if (sqrtRatioAX96 > sqrtRatioBX96) (sqrtRatioAX96, sqrtRatioBX96) = (sqrtRatioBX96, sqrtRatioAX96);\n return toUint128(FullMath.mulDiv(amount1, FixedPoint96.Q96, sqrtRatioBX96 - sqrtRatioAX96));\n }\n\n function getLiquidityForAmounts(\n uint160 sqrtRatioX96,\n uint160 sqrtRatioAX96,\n uint160 sqrtRatioBX96,\n uint256 amount0,\n uint256 amount1\n ) external pure returns (uint128 liquidity) {\n if (sqrtRatioAX96 > sqrtRatioBX96) (sqrtRatioAX96, sqrtRatioBX96) = (sqrtRatioBX96, sqrtRatioAX96);\n\n if (sqrtRatioX96 <= sqrtRatioAX96) {\n liquidity = getLiquidityForAmount0(sqrtRatioAX96, sqrtRatioBX96, amount0);\n } else if (sqrtRatioX96 < sqrtRatioBX96) {\n uint128 liquidity0 = getLiquidityForAmount0(sqrtRatioX96, sqrtRatioBX96, amount0);\n uint128 liquidity1 = getLiquidityForAmount1(sqrtRatioAX96, sqrtRatioX96, amount1);\n\n liquidity = liquidity0 < liquidity1 ? liquidity0 : liquidity1;\n } else {\n liquidity = getLiquidityForAmount1(sqrtRatioAX96, sqrtRatioBX96, amount1);\n }\n }\n\n function getAmount0ForLiquidity(\n uint160 sqrtRatioAX96,\n uint160 sqrtRatioBX96,\n uint128 liquidity\n ) public pure returns (uint256 amount0) {\n if (sqrtRatioAX96 > sqrtRatioBX96) (sqrtRatioAX96, sqrtRatioBX96) = (sqrtRatioBX96, sqrtRatioAX96);\n\n return FullMath.mulDiv(uint256(liquidity) << FixedPoint96.RESOLUTION, sqrtRatioBX96 - sqrtRatioAX96, sqrtRatioBX96) / sqrtRatioAX96;\n }\n\n function getAmount1ForLiquidity(\n uint160 sqrtRatioAX96,\n uint160 sqrtRatioBX96,\n uint128 liquidity\n ) public pure returns (uint256 amount1) {\n if (sqrtRatioAX96 > sqrtRatioBX96) (sqrtRatioAX96, sqrtRatioBX96) = (sqrtRatioBX96, sqrtRatioAX96);\n\n return FullMath.mulDiv(liquidity, sqrtRatioBX96 - sqrtRatioAX96, FixedPoint96.Q96);\n }\n\n function getAmountsForLiquidity(\n uint160 sqrtRatioX96,\n uint160 sqrtRatioAX96,\n uint160 sqrtRatioBX96,\n uint128 liquidity\n ) external pure returns (uint256 amount0, uint256 amount1) {\n if (sqrtRatioAX96 > sqrtRatioBX96) (sqrtRatioAX96, sqrtRatioBX96) = (sqrtRatioBX96, sqrtRatioAX96);\n\n if (sqrtRatioX96 <= sqrtRatioAX96) {\n amount0 = getAmount0ForLiquidity(sqrtRatioAX96, sqrtRatioBX96, liquidity);\n } else if (sqrtRatioX96 < sqrtRatioBX96) {\n amount0 = getAmount0ForLiquidity(sqrtRatioX96, sqrtRatioBX96, liquidity);\n amount1 = getAmount1ForLiquidity(sqrtRatioAX96, sqrtRatioX96, liquidity);\n } else {\n amount1 = getAmount1ForLiquidity(sqrtRatioAX96, sqrtRatioBX96, liquidity);\n }\n }\n}\n" - }, - "solidity/for-test/peripherals/jobs/Keep3rJobOwnershipForTest.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../../../contracts/peripherals/jobs/Keep3rJobOwnership.sol';\n\ncontract Keep3rJobOwnershipForTest is Keep3rJobOwnership {}\n" - }, - "solidity/for-test/peripherals/jobs/Keep3rJobDisputableForTest.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../../../contracts/peripherals/jobs/Keep3rJobDisputable.sol';\n\ncontract Keep3rJobDisputableForTest is Keep3rJobDisputable {\n using EnumerableSet for EnumerableSet.AddressSet;\n\n constructor(\n address _kph,\n address _keep3rV1,\n address _keep3rV1Proxy,\n address _kp3rWethPool\n ) Keep3rParameters(_kph, _keep3rV1, _keep3rV1Proxy, _kp3rWethPool) Keep3rRoles(msg.sender) {}\n\n function setJobLiquidity(address _job, address _liquidity) external {\n _jobLiquidities[_job].add(_liquidity);\n }\n\n function setJobToken(address _job, address _token) external {\n _jobTokens[_job].add(_token);\n }\n\n function setApprovedLiquidity(address _liquidity) external {\n _approvedLiquidities.add(_liquidity);\n }\n\n function setRevokedLiquidity(address _liquidity) external {\n _approvedLiquidities.remove(_liquidity);\n }\n\n function internalJobLiquidityCredits(address _job) external view returns (uint256 _credits) {\n _credits = _jobLiquidityCredits[_job];\n }\n\n function internalJobPeriodCredits(address _job) external view returns (uint256 _credits) {\n _credits = _jobPeriodCredits[_job];\n }\n\n function internalJobTokens(address _job) external view returns (address[] memory _tokens) {\n _tokens = new address[](_jobTokens[_job].length());\n for (uint256 i; i < _jobTokens[_job].length(); i++) {\n _tokens[i] = _jobTokens[_job].at(i);\n }\n }\n\n function internalJobLiquidities(address _job) external view returns (address[] memory _tokens) {\n _tokens = new address[](_jobLiquidities[_job].length());\n for (uint256 i; i < _jobLiquidities[_job].length(); i++) {\n _tokens[i] = _jobLiquidities[_job].at(i);\n }\n }\n}\n" - }, - "solidity/for-test/IUniswapV3PoolForTest.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '@uniswap/v3-core/contracts/interfaces/IERC20Minimal.sol';\nimport '@uniswap/v3-core/contracts/interfaces/IUniswapV3Pool.sol';\n\n// solhint-disable-next-line no-empty-blocks\ninterface IUniswapV3PoolForTest is IERC20Minimal, IUniswapV3Pool {\n\n}\n" - }, - "@uniswap/v3-core/contracts/interfaces/IERC20Minimal.sol": { - "content": "// SPDX-License-Identifier: GPL-2.0-or-later\npragma solidity >=0.5.0;\n\n/// @title Minimal ERC20 interface for Uniswap\n/// @notice Contains a subset of the full ERC20 interface that is used in Uniswap V3\ninterface IERC20Minimal {\n /// @notice Returns the balance of a token\n /// @param account The account for which to look up the number of tokens it has, i.e. its balance\n /// @return The number of tokens held by the account\n function balanceOf(address account) external view returns (uint256);\n\n /// @notice Transfers the amount of token from the `msg.sender` to the recipient\n /// @param recipient The account that will receive the amount transferred\n /// @param amount The number of tokens to send from the sender to the recipient\n /// @return Returns true for a successful transfer, false for an unsuccessful transfer\n function transfer(address recipient, uint256 amount) external returns (bool);\n\n /// @notice Returns the current allowance given to a spender by an owner\n /// @param owner The account of the token owner\n /// @param spender The account of the token spender\n /// @return The current allowance granted by `owner` to `spender`\n function allowance(address owner, address spender) external view returns (uint256);\n\n /// @notice Sets the allowance of a spender from the `msg.sender` to the value `amount`\n /// @param spender The account which will be allowed to spend a given amount of the owners tokens\n /// @param amount The amount of tokens allowed to be used by `spender`\n /// @return Returns true for a successful approval, false for unsuccessful\n function approve(address spender, uint256 amount) external returns (bool);\n\n /// @notice Transfers `amount` tokens from `sender` to `recipient` up to the allowance given to the `msg.sender`\n /// @param sender The account from which the transfer will be initiated\n /// @param recipient The recipient of the transfer\n /// @param amount The amount of the transfer\n /// @return Returns true for a successful transfer, false for unsuccessful\n function transferFrom(\n address sender,\n address recipient,\n uint256 amount\n ) external returns (bool);\n\n /// @notice Event emitted when tokens are transferred from one address to another, either via `#transfer` or `#transferFrom`.\n /// @param from The account from which the tokens were sent, i.e. the balance decreased\n /// @param to The account to which the tokens were sent, i.e. the balance increased\n /// @param value The amount of tokens that were transferred\n event Transfer(address indexed from, address indexed to, uint256 value);\n\n /// @notice Event emitted when the approval amount for the spender of a given owner's tokens changes.\n /// @param owner The account that approved spending of its tokens\n /// @param spender The account for which the spending allowance was modified\n /// @param value The new allowance from the owner to the spender\n event Approval(address indexed owner, address indexed spender, uint256 value);\n}\n" - } - }, - "settings": { - "optimizer": { - "enabled": true, - "runs": 33 - }, - "outputSelection": { - "*": { - "*": [ - "storageLayout", - "abi", - "evm.bytecode", - "evm.deployedBytecode", - "evm.methodIdentifiers", - "metadata", - "devdoc", - "userdoc", - "evm.gasEstimates" - ], - "": [ - "ast" - ] - } - }, - "metadata": { - "useLiteralContent": true - }, - "libraries": { - "": { - "__CACHE_BREAKER__": "0x00000000d41867734bbee4c6863d9255b2b06ac1" - } - } - } -} \ No newline at end of file diff --git a/deployments/mainnet/solcInputs/f2135d1d9c1b65279853f8327888dda7.json b/deployments/mainnet/solcInputs/f2135d1d9c1b65279853f8327888dda7.json deleted file mode 100644 index 15cb6ed..0000000 --- a/deployments/mainnet/solcInputs/f2135d1d9c1b65279853f8327888dda7.json +++ /dev/null @@ -1,280 +0,0 @@ -{ - "language": "Solidity", - "sources": { - "solidity/contracts/Keep3r.sol": { - "content": "// SPDX-License-Identifier: MIT\n\n/*\n\nCoded for The Keep3r Network with ♥ by\n\n██████╗░███████╗███████╗██╗  ░██╗░░░░░░░██╗░█████╗░███╗░░██╗██████╗░███████╗██████╗░██╗░░░░░░█████╗░███╗░░██╗██████╗░\n██╔══██╗██╔════╝██╔════╝██║  ░██║░░██╗░░██║██╔══██╗████╗░██║██╔══██╗██╔════╝██╔══██╗██║░░░░░██╔══██╗████╗░██║██╔══██╗\n██║░░██║█████╗░░█████╗░░██║  ░╚██╗████╗██╔╝██║░░██║██╔██╗██║██║░░██║█████╗░░██████╔╝██║░░░░░███████║██╔██╗██║██║░░██║\n██║░░██║██╔══╝░░██╔══╝░░██║  ░░████╔═████║░██║░░██║██║╚████║██║░░██║██╔══╝░░██╔══██╗██║░░░░░██╔══██║██║╚████║██║░░██║\n██████╔╝███████╗██║░░░░░██║  ░░╚██╔╝░╚██╔╝░╚█████╔╝██║░╚███║██████╔╝███████╗██║░░██║███████╗██║░░██║██║░╚███║██████╔╝\n╚═════╝░╚══════╝╚═╝░░░░░╚═╝  ░░░╚═╝░░░╚═╝░░░╚════╝░╚═╝░░╚══╝╚═════╝░╚══════╝╚═╝░░╚═╝╚══════╝╚═╝░░╚═╝╚═╝░░╚══╝╚═════╝░\n\nhttps://defi.sucks\n\n*/\n\npragma solidity >=0.8.4 <0.9.0;\n\nimport './peripherals/jobs/Keep3rJobs.sol';\nimport './peripherals/keepers/Keep3rKeepers.sol';\nimport './peripherals/Keep3rAccountance.sol';\nimport './peripherals/Keep3rRoles.sol';\nimport './peripherals/Keep3rParameters.sol';\nimport './peripherals/DustCollector.sol';\n\ncontract Keep3r is DustCollector, Keep3rJobs, Keep3rKeepers {\n constructor(\n address _governance,\n address _keep3rHelper,\n address _keep3rV1,\n address _keep3rV1Proxy,\n address _kp3rWethPool\n ) Keep3rParameters(_keep3rHelper, _keep3rV1, _keep3rV1Proxy, _kp3rWethPool) Keep3rRoles(_governance) DustCollector() {}\n}\n" - }, - "solidity/contracts/peripherals/jobs/Keep3rJobs.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport './Keep3rJobDisputable.sol';\nimport './Keep3rJobWorkable.sol';\nimport './Keep3rJobManager.sol';\n\nabstract contract Keep3rJobs is Keep3rJobDisputable, Keep3rJobManager, Keep3rJobWorkable {}\n" - }, - "solidity/contracts/peripherals/keepers/Keep3rKeepers.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport './Keep3rKeeperDisputable.sol';\n\nabstract contract Keep3rKeepers is Keep3rKeeperDisputable {}\n" - }, - "solidity/contracts/peripherals/Keep3rAccountance.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '@openzeppelin/contracts/utils/structs/EnumerableSet.sol';\nimport '../../interfaces/peripherals/IKeep3rAccountance.sol';\n\nabstract contract Keep3rAccountance is IKeep3rAccountance {\n using EnumerableSet for EnumerableSet.AddressSet;\n\n /// @notice List of all enabled keepers\n EnumerableSet.AddressSet internal _keepers;\n\n /// @inheritdoc IKeep3rAccountance\n mapping(address => uint256) public override workCompleted;\n\n /// @inheritdoc IKeep3rAccountance\n mapping(address => uint256) public override firstSeen;\n\n /// @inheritdoc IKeep3rAccountance\n mapping(address => bool) public override disputes;\n\n /// @inheritdoc IKeep3rAccountance\n /// @notice Mapping (job => bonding => amount)\n mapping(address => mapping(address => uint256)) public override bonds;\n\n /// @inheritdoc IKeep3rAccountance\n mapping(address => mapping(address => uint256)) public override jobTokenCredits;\n\n /// @notice The current liquidity credits available for a job\n mapping(address => uint256) internal _jobLiquidityCredits;\n\n /// @notice Map the address of a job to its correspondent periodCredits\n mapping(address => uint256) internal _jobPeriodCredits;\n\n /// @notice Enumerable array of Job Tokens for Credits\n mapping(address => EnumerableSet.AddressSet) internal _jobTokens;\n\n /// @notice List of liquidities that a job has (job => liquidities)\n mapping(address => EnumerableSet.AddressSet) internal _jobLiquidities;\n\n /// @notice Liquidity pool to observe\n mapping(address => address) internal _liquidityPool;\n\n /// @notice Tracks if a pool has KP3R as token0\n mapping(address => bool) internal _isKP3RToken0;\n\n /// @inheritdoc IKeep3rAccountance\n mapping(address => mapping(address => uint256)) public override pendingBonds;\n\n /// @inheritdoc IKeep3rAccountance\n mapping(address => mapping(address => uint256)) public override canActivateAfter;\n\n /// @inheritdoc IKeep3rAccountance\n mapping(address => mapping(address => uint256)) public override canWithdrawAfter;\n\n /// @inheritdoc IKeep3rAccountance\n mapping(address => mapping(address => uint256)) public override pendingUnbonds;\n\n /// @inheritdoc IKeep3rAccountance\n mapping(address => bool) public override hasBonded;\n\n /// @notice List of all enabled jobs\n EnumerableSet.AddressSet internal _jobs;\n\n /// @inheritdoc IKeep3rAccountance\n function jobs() external view override returns (address[] memory _list) {\n _list = _jobs.values();\n }\n\n /// @inheritdoc IKeep3rAccountance\n function keepers() external view override returns (address[] memory _list) {\n _list = _keepers.values();\n }\n}\n" - }, - "solidity/contracts/peripherals/Keep3rRoles.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../../interfaces/peripherals/IKeep3rRoles.sol';\nimport '@openzeppelin/contracts/utils/structs/EnumerableSet.sol';\nimport './Governable.sol';\n\ncontract Keep3rRoles is IKeep3rRoles, Governable {\n /// @inheritdoc IKeep3rRoles\n mapping(address => bool) public override slashers;\n\n /// @inheritdoc IKeep3rRoles\n mapping(address => bool) public override disputers;\n\n constructor(address _governance) Governable(_governance) {}\n\n /// @inheritdoc IKeep3rRoles\n function addSlasher(address _slasher) external override onlyGovernance {\n if (slashers[_slasher]) revert SlasherExistent();\n slashers[_slasher] = true;\n emit SlasherAdded(_slasher);\n }\n\n /// @inheritdoc IKeep3rRoles\n function removeSlasher(address _slasher) external override onlyGovernance {\n if (!slashers[_slasher]) revert SlasherUnexistent();\n delete slashers[_slasher];\n emit SlasherRemoved(_slasher);\n }\n\n /// @inheritdoc IKeep3rRoles\n function addDisputer(address _disputer) external override onlyGovernance {\n if (disputers[_disputer]) revert DisputerExistent();\n disputers[_disputer] = true;\n emit DisputerAdded(_disputer);\n }\n\n /// @inheritdoc IKeep3rRoles\n function removeDisputer(address _disputer) external override onlyGovernance {\n if (!disputers[_disputer]) revert DisputerUnexistent();\n delete disputers[_disputer];\n emit DisputerRemoved(_disputer);\n }\n\n /// @notice Functions with this modifier can only be called by either a slasher or governance\n modifier onlySlasher {\n if (!slashers[msg.sender]) revert OnlySlasher();\n _;\n }\n\n /// @notice Functions with this modifier can only be called by either a disputer or governance\n modifier onlyDisputer {\n if (!disputers[msg.sender]) revert OnlyDisputer();\n _;\n }\n}\n" - }, - "solidity/contracts/peripherals/Keep3rParameters.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../../interfaces/IKeep3rHelper.sol';\nimport '../../interfaces/peripherals/IKeep3rParameters.sol';\nimport './Keep3rAccountance.sol';\nimport './Keep3rRoles.sol';\n\nabstract contract Keep3rParameters is IKeep3rParameters, Keep3rAccountance, Keep3rRoles {\n /// @inheritdoc IKeep3rParameters\n address public override keep3rV1;\n\n /// @inheritdoc IKeep3rParameters\n address public override keep3rV1Proxy;\n\n /// @inheritdoc IKeep3rParameters\n address public override keep3rHelper;\n\n /// @inheritdoc IKeep3rParameters\n address public override kp3rWethPool;\n\n /// @inheritdoc IKeep3rParameters\n uint256 public override bondTime = 3 days;\n\n /// @inheritdoc IKeep3rParameters\n uint256 public override unbondTime = 14 days;\n\n /// @inheritdoc IKeep3rParameters\n uint256 public override liquidityMinimum = 3 ether;\n\n /// @inheritdoc IKeep3rParameters\n uint256 public override rewardPeriodTime = 5 days;\n\n /// @inheritdoc IKeep3rParameters\n uint256 public override inflationPeriod = 34 days;\n\n /// @inheritdoc IKeep3rParameters\n uint256 public override fee = 30;\n\n /// @inheritdoc IKeep3rParameters\n uint256 public constant override BASE = 10000;\n\n /// @inheritdoc IKeep3rParameters\n uint256 public constant override MIN_REWARD_PERIOD_TIME = 1 days;\n\n constructor(\n address _keep3rHelper,\n address _keep3rV1,\n address _keep3rV1Proxy,\n address _kp3rWethPool\n ) {\n keep3rHelper = _keep3rHelper;\n keep3rV1 = _keep3rV1;\n keep3rV1Proxy = _keep3rV1Proxy;\n kp3rWethPool = _kp3rWethPool;\n _liquidityPool[kp3rWethPool] = kp3rWethPool;\n _isKP3RToken0[_kp3rWethPool] = IKeep3rHelper(keep3rHelper).isKP3RToken0(kp3rWethPool);\n }\n\n /// @inheritdoc IKeep3rParameters\n function setKeep3rHelper(address _keep3rHelper) external override onlyGovernance {\n if (_keep3rHelper == address(0)) revert ZeroAddress();\n keep3rHelper = _keep3rHelper;\n emit Keep3rHelperChange(_keep3rHelper);\n }\n\n /// @inheritdoc IKeep3rParameters\n function setKeep3rV1(address _keep3rV1) external override onlyGovernance {\n if (_keep3rV1 == address(0)) revert ZeroAddress();\n keep3rV1 = _keep3rV1;\n emit Keep3rV1Change(_keep3rV1);\n }\n\n /// @inheritdoc IKeep3rParameters\n function setKeep3rV1Proxy(address _keep3rV1Proxy) external override onlyGovernance {\n if (_keep3rV1Proxy == address(0)) revert ZeroAddress();\n keep3rV1Proxy = _keep3rV1Proxy;\n emit Keep3rV1ProxyChange(_keep3rV1Proxy);\n }\n\n /// @inheritdoc IKeep3rParameters\n function setKp3rWethPool(address _kp3rWethPool) external override onlyGovernance {\n if (_kp3rWethPool == address(0)) revert ZeroAddress();\n kp3rWethPool = _kp3rWethPool;\n _liquidityPool[kp3rWethPool] = kp3rWethPool;\n _isKP3RToken0[_kp3rWethPool] = IKeep3rHelper(keep3rHelper).isKP3RToken0(_kp3rWethPool);\n emit Kp3rWethPoolChange(_kp3rWethPool);\n }\n\n /// @inheritdoc IKeep3rParameters\n function setBondTime(uint256 _bondTime) external override onlyGovernance {\n bondTime = _bondTime;\n emit BondTimeChange(_bondTime);\n }\n\n /// @inheritdoc IKeep3rParameters\n function setUnbondTime(uint256 _unbondTime) external override onlyGovernance {\n unbondTime = _unbondTime;\n emit UnbondTimeChange(_unbondTime);\n }\n\n /// @inheritdoc IKeep3rParameters\n function setLiquidityMinimum(uint256 _liquidityMinimum) external override onlyGovernance {\n liquidityMinimum = _liquidityMinimum;\n emit LiquidityMinimumChange(_liquidityMinimum);\n }\n\n /// @inheritdoc IKeep3rParameters\n function setRewardPeriodTime(uint256 _rewardPeriodTime) external override onlyGovernance {\n if (_rewardPeriodTime < MIN_REWARD_PERIOD_TIME) revert MinRewardPeriod();\n rewardPeriodTime = _rewardPeriodTime;\n emit RewardPeriodTimeChange(_rewardPeriodTime);\n }\n\n /// @inheritdoc IKeep3rParameters\n function setInflationPeriod(uint256 _inflationPeriod) external override onlyGovernance {\n inflationPeriod = _inflationPeriod;\n emit InflationPeriodChange(_inflationPeriod);\n }\n\n /// @inheritdoc IKeep3rParameters\n function setFee(uint256 _fee) external override onlyGovernance {\n fee = _fee;\n emit FeeChange(_fee);\n }\n}\n" - }, - "solidity/contracts/peripherals/DustCollector.sol": { - "content": "// SPDX-License-Identifier: MIT\n\npragma solidity >=0.8.4 <0.9.0;\n\nimport '@openzeppelin/contracts/token/ERC20/IERC20.sol';\nimport '@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol';\nimport '../../contracts/peripherals/Governable.sol';\nimport '../../interfaces/peripherals/IDustCollector.sol';\n\nabstract contract DustCollector is IDustCollector, Governable {\n using SafeERC20 for IERC20;\n\n address public constant ETH_ADDRESS = 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE;\n\n function sendDust(\n address _token,\n uint256 _amount,\n address _to\n ) external override onlyGovernance {\n if (_to == address(0)) revert ZeroAddress();\n if (_token == ETH_ADDRESS) {\n payable(_to).transfer(_amount);\n } else {\n IERC20(_token).safeTransfer(_to, _amount);\n }\n emit DustSent(_token, _amount, _to);\n }\n}\n" - }, - "solidity/contracts/peripherals/jobs/Keep3rJobDisputable.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport './Keep3rJobFundableCredits.sol';\nimport './Keep3rJobFundableLiquidity.sol';\nimport '../Keep3rDisputable.sol';\n\nabstract contract Keep3rJobDisputable is IKeep3rJobDisputable, Keep3rDisputable, Keep3rJobFundableCredits, Keep3rJobFundableLiquidity {\n using EnumerableSet for EnumerableSet.AddressSet;\n using SafeERC20 for IERC20;\n\n /// @inheritdoc IKeep3rJobDisputable\n function slashTokenFromJob(\n address _job,\n address _token,\n uint256 _amount\n ) external override onlySlasher {\n if (!disputes[_job]) revert NotDisputed();\n if (!_jobTokens[_job].contains(_token)) revert JobTokenUnexistent();\n if (jobTokenCredits[_job][_token] < _amount) revert JobTokenInsufficient();\n\n try IERC20(_token).transfer(governance, _amount) {} catch {}\n jobTokenCredits[_job][_token] -= _amount;\n if (jobTokenCredits[_job][_token] == 0) {\n _jobTokens[_job].remove(_token);\n }\n\n // emit event\n emit JobSlashToken(_job, _token, msg.sender, _amount);\n }\n\n /// @inheritdoc IKeep3rJobDisputable\n function slashLiquidityFromJob(\n address _job,\n address _liquidity,\n uint256 _amount\n ) external override onlySlasher {\n if (!disputes[_job]) revert NotDisputed();\n\n _unbondLiquidityFromJob(_job, _liquidity, _amount);\n try IERC20(_liquidity).transfer(governance, _amount) {} catch {}\n emit JobSlashLiquidity(_job, _liquidity, msg.sender, _amount);\n }\n}\n" - }, - "solidity/contracts/peripherals/jobs/Keep3rJobWorkable.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport './Keep3rJobMigration.sol';\nimport '../../../interfaces/IKeep3rHelper.sol';\nimport '../../../interfaces/peripherals/IKeep3rJobs.sol';\n\nimport '@openzeppelin/contracts/token/ERC20/IERC20.sol';\nimport '@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol';\n\nabstract contract Keep3rJobWorkable is IKeep3rJobWorkable, Keep3rJobMigration {\n using EnumerableSet for EnumerableSet.AddressSet;\n using SafeERC20 for IERC20;\n\n uint256 internal _initialGas;\n\n /// @inheritdoc IKeep3rJobWorkable\n function isKeeper(address _keeper) external override returns (bool _isKeeper) {\n _initialGas = gasleft();\n if (_keepers.contains(_keeper)) {\n emit KeeperValidation(gasleft());\n return true;\n }\n }\n\n /// @inheritdoc IKeep3rJobWorkable\n function isBondedKeeper(\n address _keeper,\n address _bond,\n uint256 _minBond,\n uint256 _earned,\n uint256 _age\n ) public override returns (bool _isBondedKeeper) {\n _initialGas = gasleft();\n if (\n _keepers.contains(_keeper) &&\n bonds[_keeper][_bond] >= _minBond &&\n workCompleted[_keeper] >= _earned &&\n block.timestamp - firstSeen[_keeper] >= _age\n ) {\n emit KeeperValidation(gasleft());\n return true;\n }\n }\n\n /// @inheritdoc IKeep3rJobWorkable\n function worked(address _keeper) external override {\n address _job = msg.sender;\n if (disputes[_job]) revert JobDisputed();\n if (!_jobs.contains(_job)) revert JobUnapproved();\n\n if (_updateJobCreditsIfNeeded(_job)) {\n emit LiquidityCreditsReward(_job, rewardedAt[_job], _jobLiquidityCredits[_job], _jobPeriodCredits[_job]);\n }\n\n uint256 _gasRecord = gasleft();\n uint256 _boost = IKeep3rHelper(keep3rHelper).getRewardBoostFor(bonds[_keeper][keep3rV1]);\n\n uint256 _payment = (_quoteLiquidity(_initialGas - _gasRecord, kp3rWethPool) * _boost) / BASE;\n\n if (_payment > _jobLiquidityCredits[_job]) {\n _rewardJobCredits(_job);\n emit LiquidityCreditsReward(_job, rewardedAt[_job], _jobLiquidityCredits[_job], _jobPeriodCredits[_job]);\n }\n\n uint256 _gasUsed = _initialGas - gasleft();\n _payment = (_gasUsed * _payment) / (_initialGas - _gasRecord);\n\n _bondedPayment(_job, _keeper, _payment);\n emit KeeperWork(keep3rV1, _job, _keeper, _payment, gasleft());\n }\n\n /// @inheritdoc IKeep3rJobWorkable\n function bondedPayment(address _keeper, uint256 _payment) public override {\n address _job = msg.sender;\n\n if (disputes[_job]) revert JobDisputed();\n if (!_jobs.contains(_job)) revert JobUnapproved();\n\n if (_updateJobCreditsIfNeeded(_job)) {\n emit LiquidityCreditsReward(_job, rewardedAt[_job], _jobLiquidityCredits[_job], _jobPeriodCredits[_job]);\n }\n\n if (_payment > _jobLiquidityCredits[_job]) {\n _rewardJobCredits(_job);\n emit LiquidityCreditsReward(_job, rewardedAt[_job], _jobLiquidityCredits[_job], _jobPeriodCredits[_job]);\n }\n\n _bondedPayment(_job, _keeper, _payment);\n emit KeeperWork(keep3rV1, _job, _keeper, _payment, gasleft());\n }\n\n function _bondedPayment(\n address _job,\n address _keeper,\n uint256 _payment\n ) internal {\n if (_payment > _jobLiquidityCredits[_job]) revert InsufficientFunds();\n\n workedAt[_job] = block.timestamp;\n _jobLiquidityCredits[_job] -= _payment;\n bonds[_keeper][keep3rV1] += _payment;\n workCompleted[_keeper] += _payment;\n }\n\n /// @inheritdoc IKeep3rJobWorkable\n function directTokenPayment(\n address _token,\n address _keeper,\n uint256 _amount\n ) external override {\n address _job = msg.sender;\n\n if (disputes[_job]) revert JobDisputed();\n if (disputes[_keeper]) revert Disputed();\n if (!_jobs.contains(_job)) revert JobUnapproved();\n if (jobTokenCredits[_job][_token] < _amount) revert InsufficientFunds();\n jobTokenCredits[_job][_token] -= _amount;\n IERC20(_token).safeTransfer(_keeper, _amount);\n emit KeeperWork(_token, _job, _keeper, _amount, gasleft());\n }\n}\n" - }, - "solidity/contracts/peripherals/jobs/Keep3rJobManager.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport './Keep3rJobOwnership.sol';\nimport '../Keep3rRoles.sol';\nimport '../Keep3rParameters.sol';\nimport '../../../interfaces/peripherals/IKeep3rJobs.sol';\n\nabstract contract Keep3rJobManager is IKeep3rJobManager, Keep3rJobOwnership, Keep3rRoles, Keep3rParameters {\n using EnumerableSet for EnumerableSet.AddressSet;\n\n /// @inheritdoc IKeep3rJobManager\n function addJob(address _job) external override {\n if (_jobs.contains(_job)) revert JobAlreadyAdded();\n if (hasBonded[_job]) revert AlreadyAKeeper();\n _jobs.add(_job);\n jobOwner[_job] = msg.sender;\n emit JobAddition(msg.sender, _job);\n }\n}\n" - }, - "solidity/contracts/peripherals/jobs/Keep3rJobFundableCredits.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport './Keep3rJobOwnership.sol';\nimport '../Keep3rAccountance.sol';\nimport '../Keep3rParameters.sol';\nimport '../../../interfaces/peripherals/IKeep3rJobs.sol';\n\nimport '@openzeppelin/contracts/security/ReentrancyGuard.sol';\nimport '@openzeppelin/contracts/token/ERC20/IERC20.sol';\nimport '@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol';\nimport '@openzeppelin/contracts/utils/math/Math.sol';\n\nabstract contract Keep3rJobFundableCredits is IKeep3rJobFundableCredits, ReentrancyGuard, Keep3rJobOwnership, Keep3rParameters {\n using EnumerableSet for EnumerableSet.AddressSet;\n using SafeERC20 for IERC20;\n\n /// @notice Cooldown between withdrawals\n uint256 internal constant _WITHDRAW_TOKENS_COOLDOWN = 1 minutes;\n\n /// @inheritdoc IKeep3rJobFundableCredits\n mapping(address => mapping(address => uint256)) public override jobTokenCreditsAddedAt;\n\n /// @inheritdoc IKeep3rJobFundableCredits\n function addTokenCreditsToJob(\n address _job,\n address _token,\n uint256 _amount\n ) external override nonReentrant {\n if (!_jobs.contains(_job)) revert JobUnavailable();\n // KP3R shouldn't be used for direct token payments\n if (_token == keep3rV1) revert TokenUnallowed();\n uint256 _before = IERC20(_token).balanceOf(address(this));\n IERC20(_token).safeTransferFrom(msg.sender, address(this), _amount);\n uint256 _received = IERC20(_token).balanceOf(address(this)) - _before;\n uint256 _tokenFee = (_received * fee) / BASE;\n jobTokenCredits[_job][_token] += _received - _tokenFee;\n jobTokenCreditsAddedAt[_job][_token] = block.timestamp;\n IERC20(_token).safeTransfer(governance, _tokenFee);\n _jobTokens[_job].add(_token);\n\n emit TokenCreditAddition(_job, _token, msg.sender, _received);\n }\n\n /// @inheritdoc IKeep3rJobFundableCredits\n function withdrawTokenCreditsFromJob(\n address _job,\n address _token,\n uint256 _amount,\n address _receiver\n ) external override nonReentrant onlyJobOwner(_job) {\n if (block.timestamp <= jobTokenCreditsAddedAt[_job][_token] + _WITHDRAW_TOKENS_COOLDOWN) revert JobTokenCreditsLocked();\n if (jobTokenCredits[_job][_token] < _amount) revert InsufficientJobTokenCredits();\n if (disputes[_job]) revert JobDisputed();\n\n jobTokenCredits[_job][_token] -= _amount;\n IERC20(_token).safeTransfer(_receiver, _amount);\n\n if (jobTokenCredits[_job][_token] == 0) {\n _jobTokens[_job].remove(_token);\n }\n\n emit TokenCreditWithdrawal(_job, _token, _receiver, _amount);\n }\n}\n" - }, - "solidity/contracts/peripherals/jobs/Keep3rJobFundableLiquidity.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport './Keep3rJobOwnership.sol';\nimport '../Keep3rAccountance.sol';\nimport '../Keep3rParameters.sol';\nimport '../../../interfaces/IPairManager.sol';\nimport '../../../interfaces/peripherals/IKeep3rJobs.sol';\n\nimport '../../libraries/FullMath.sol';\n\nimport '@openzeppelin/contracts/security/ReentrancyGuard.sol';\nimport '@openzeppelin/contracts/token/ERC20/IERC20.sol';\nimport '@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol';\nimport '@openzeppelin/contracts/utils/math/Math.sol';\n\nabstract contract Keep3rJobFundableLiquidity is IKeep3rJobFundableLiquidity, ReentrancyGuard, Keep3rJobOwnership, Keep3rParameters {\n using EnumerableSet for EnumerableSet.AddressSet;\n using SafeERC20 for IERC20;\n\n /// @notice List of liquidities that are accepted in the system\n EnumerableSet.AddressSet internal _approvedLiquidities;\n\n /// @inheritdoc IKeep3rJobFundableLiquidity\n mapping(address => mapping(address => uint256)) public override liquidityAmount;\n\n /// @inheritdoc IKeep3rJobFundableLiquidity\n mapping(address => uint256) public override rewardedAt;\n\n /// @inheritdoc IKeep3rJobFundableLiquidity\n mapping(address => uint256) public override workedAt;\n\n /// @notice Tracks an address and returns its TickCache\n mapping(address => TickCache) internal _tick;\n\n // Views\n\n /// @inheritdoc IKeep3rJobFundableLiquidity\n function approvedLiquidities() external view override returns (address[] memory _list) {\n _list = _approvedLiquidities.values();\n }\n\n /// @inheritdoc IKeep3rJobFundableLiquidity\n function jobPeriodCredits(address _job) public view override returns (uint256 _periodCredits) {\n for (uint256 i; i < _jobLiquidities[_job].length(); i++) {\n address _liquidity = _jobLiquidities[_job].at(i);\n if (_approvedLiquidities.contains(_liquidity)) {\n TickCache memory _tickCache = observeLiquidity(_liquidity);\n if (_tickCache.period != 0) {\n int56 _tickDifference = _isKP3RToken0[_liquidity] ? _tickCache.difference : -_tickCache.difference;\n _periodCredits += _getReward(\n IKeep3rHelper(keep3rHelper).getKP3RsAtTick(liquidityAmount[_job][_liquidity], _tickDifference, rewardPeriodTime)\n );\n }\n }\n }\n }\n\n /// @inheritdoc IKeep3rJobFundableLiquidity\n function jobLiquidityCredits(address _job) public view override returns (uint256 _liquidityCredits) {\n uint256 _periodCredits = jobPeriodCredits(_job);\n\n // A job can have liquidityCredits without periodCredits (forced by Governance)\n if (rewardedAt[_job] > _period(block.timestamp - rewardPeriodTime)) {\n // Will calculate job credits only if it was rewarded later than last period\n if ((block.timestamp - rewardedAt[_job]) >= rewardPeriodTime) {\n // Will return a full period if job was rewarded more than a period ago\n _liquidityCredits = _periodCredits;\n } else {\n // Will update minted job credits (not forced) to new twaps if credits are outdated\n _liquidityCredits = _periodCredits > 0\n ? (_jobLiquidityCredits[_job] * _periodCredits) / _jobPeriodCredits[_job]\n : _jobLiquidityCredits[_job];\n }\n } else {\n // Will return a full period if job credits are expired\n _liquidityCredits = _periodCredits;\n }\n }\n\n /// @inheritdoc IKeep3rJobFundableLiquidity\n function totalJobCredits(address _job) external view override returns (uint256 _credits) {\n uint256 _periodCredits = jobPeriodCredits(_job);\n uint256 _cooldown;\n\n if ((rewardedAt[_job] > _period(block.timestamp - rewardPeriodTime))) {\n // Will calculate cooldown if it outdated\n if ((block.timestamp - rewardedAt[_job]) >= rewardPeriodTime) {\n // Will calculate cooldown from last reward reference in this period\n _cooldown = block.timestamp - (rewardedAt[_job] + rewardPeriodTime);\n } else {\n // Will calculate cooldown from last reward timestamp\n _cooldown = block.timestamp - rewardedAt[_job];\n }\n } else {\n // Will calculate cooldown from period start if expired\n _cooldown = block.timestamp - _period(block.timestamp);\n }\n _credits = jobLiquidityCredits(_job) + _phase(_cooldown, _periodCredits);\n }\n\n /// @inheritdoc IKeep3rJobFundableLiquidity\n function quoteLiquidity(address _liquidity, uint256 _amount) external view override returns (uint256 _periodCredits) {\n if (_approvedLiquidities.contains(_liquidity)) {\n TickCache memory _tickCache = observeLiquidity(_liquidity);\n if (_tickCache.period != 0) {\n int56 _tickDifference = _isKP3RToken0[_liquidity] ? _tickCache.difference : -_tickCache.difference;\n return _getReward(IKeep3rHelper(keep3rHelper).getKP3RsAtTick(_amount, _tickDifference, rewardPeriodTime));\n }\n }\n }\n\n /// @inheritdoc IKeep3rJobFundableLiquidity\n function observeLiquidity(address _liquidity) public view override returns (TickCache memory _tickCache) {\n if (_tick[_liquidity].period == _period(block.timestamp)) {\n // Will return cached twaps if liquidity is updated\n _tickCache = _tick[_liquidity];\n } else {\n bool success;\n uint256 lastPeriod = _period(block.timestamp - rewardPeriodTime);\n\n if (_tick[_liquidity].period == lastPeriod) {\n // Will only ask for current period accumulator if liquidity is outdated\n uint32[] memory _secondsAgo = new uint32[](1);\n int56 previousTick = _tick[_liquidity].current;\n\n _secondsAgo[0] = uint32(block.timestamp - _period(block.timestamp));\n\n (_tickCache.current, , success) = IKeep3rHelper(keep3rHelper).observe(_liquidityPool[_liquidity], _secondsAgo);\n\n _tickCache.difference = _tickCache.current - previousTick;\n } else if (_tick[_liquidity].period < lastPeriod) {\n // Will ask for 2 accumulators if liquidity is expired\n uint32[] memory _secondsAgo = new uint32[](2);\n\n _secondsAgo[0] = uint32(block.timestamp - _period(block.timestamp));\n _secondsAgo[1] = uint32(block.timestamp - _period(block.timestamp) + rewardPeriodTime);\n\n int56 _tickCumulative2;\n (_tickCache.current, _tickCumulative2, success) = IKeep3rHelper(keep3rHelper).observe(_liquidityPool[_liquidity], _secondsAgo);\n\n _tickCache.difference = _tickCache.current - _tickCumulative2;\n }\n if (success) {\n _tickCache.period = _period(block.timestamp);\n } else {\n _tickCache.period = 0;\n }\n }\n }\n\n // Methods\n\n /// @inheritdoc IKeep3rJobFundableLiquidity\n function forceLiquidityCreditsToJob(address _job, uint256 _amount) external override onlyGovernance {\n if (!_jobs.contains(_job)) revert JobUnavailable();\n _settleJobAccountance(_job);\n _jobLiquidityCredits[_job] += _amount;\n emit LiquidityCreditsForced(_job, rewardedAt[_job], _jobLiquidityCredits[_job]);\n }\n\n /// @inheritdoc IKeep3rJobFundableLiquidity\n function approveLiquidity(address _liquidity) external override onlyGovernance {\n if (!_approvedLiquidities.add(_liquidity)) revert LiquidityPairApproved();\n _liquidityPool[_liquidity] = IPairManager(_liquidity).pool();\n _isKP3RToken0[_liquidity] = IKeep3rHelper(keep3rHelper).isKP3RToken0(_liquidityPool[_liquidity]);\n _tick[_liquidity] = observeLiquidity(_liquidity);\n emit LiquidityApproval(_liquidity);\n }\n\n /// @inheritdoc IKeep3rJobFundableLiquidity\n function revokeLiquidity(address _liquidity) external override onlyGovernance {\n if (!_approvedLiquidities.remove(_liquidity)) revert LiquidityPairUnexistent();\n emit LiquidityRevocation(_liquidity);\n }\n\n /// @inheritdoc IKeep3rJobFundableLiquidity\n function addLiquidityToJob(\n address _job,\n address _liquidity,\n uint256 _amount\n ) external override nonReentrant {\n if (!_approvedLiquidities.contains(_liquidity)) revert LiquidityPairUnapproved();\n if (!_jobs.contains(_job)) revert JobUnavailable();\n\n _jobLiquidities[_job].add(_liquidity);\n\n _settleJobAccountance(_job);\n\n if (_quoteLiquidity(liquidityAmount[_job][_liquidity] + _amount, _liquidity) < liquidityMinimum) revert JobLiquidityLessThanMin();\n\n emit LiquidityCreditsReward(_job, rewardedAt[_job], _jobLiquidityCredits[_job], _jobPeriodCredits[_job]);\n\n IERC20(_liquidity).safeTransferFrom(msg.sender, address(this), _amount);\n liquidityAmount[_job][_liquidity] += _amount;\n _jobPeriodCredits[_job] += _getReward(_quoteLiquidity(_amount, _liquidity));\n emit LiquidityAddition(_job, _liquidity, msg.sender, _amount);\n }\n\n /// @inheritdoc IKeep3rJobFundableLiquidity\n function unbondLiquidityFromJob(\n address _job,\n address _liquidity,\n uint256 _amount\n ) external override onlyJobOwner(_job) {\n canWithdrawAfter[_job][_liquidity] = block.timestamp + unbondTime;\n pendingUnbonds[_job][_liquidity] += _amount;\n _unbondLiquidityFromJob(_job, _liquidity, _amount);\n\n uint256 _remainingLiquidity = liquidityAmount[_job][_liquidity];\n if (_remainingLiquidity > 0 && _quoteLiquidity(_remainingLiquidity, _liquidity) < liquidityMinimum) revert JobLiquidityLessThanMin();\n\n emit Unbonding(_job, _liquidity, _amount);\n }\n\n /// @inheritdoc IKeep3rJobFundableLiquidity\n function withdrawLiquidityFromJob(\n address _job,\n address _liquidity,\n address _receiver\n ) external override onlyJobOwner(_job) {\n if (_receiver == address(0)) revert ZeroAddress();\n if (canWithdrawAfter[_job][_liquidity] == 0) revert UnbondsUnexistent();\n if (canWithdrawAfter[_job][_liquidity] >= block.timestamp) revert UnbondsLocked();\n if (disputes[_job]) revert Disputed();\n\n uint256 _amount = pendingUnbonds[_job][_liquidity];\n IERC20(_liquidity).safeTransfer(_receiver, _amount);\n emit LiquidityWithdrawal(_job, _liquidity, _receiver, _amount);\n\n pendingUnbonds[_job][_liquidity] = 0;\n }\n\n // Internal functions\n\n /// @notice Updates or rewards job liquidity credits depending on time since last job reward\n function _updateJobCreditsIfNeeded(address _job) internal returns (bool _rewarded) {\n if (rewardedAt[_job] < _period(block.timestamp)) {\n // Will exit function if job has been rewarded in current period\n if (rewardedAt[_job] <= _period(block.timestamp - rewardPeriodTime)) {\n // Will reset job to period syncronicity if a full period passed without rewards\n _updateJobPeriod(_job);\n _jobLiquidityCredits[_job] = _jobPeriodCredits[_job];\n rewardedAt[_job] = _period(block.timestamp);\n _rewarded = true;\n } else if ((block.timestamp - rewardedAt[_job]) >= rewardPeriodTime) {\n // Will reset job's syncronicity if last reward was more than epoch ago\n _updateJobPeriod(_job);\n _jobLiquidityCredits[_job] = _jobPeriodCredits[_job];\n rewardedAt[_job] += rewardPeriodTime;\n _rewarded = true;\n } else if (workedAt[_job] < _period(block.timestamp)) {\n // First keeper on period has to update job accountance to current twaps\n uint256 previousPeriodCredits = _jobPeriodCredits[_job];\n _updateJobPeriod(_job);\n _jobLiquidityCredits[_job] = (_jobLiquidityCredits[_job] * _jobPeriodCredits[_job]) / previousPeriodCredits;\n // Updating job accountance does not reward job\n }\n }\n }\n\n /// @notice Only called if _jobLiquidityCredits < payment\n function _rewardJobCredits(address _job) internal {\n /// @notice Only way to += jobLiquidityCredits is when keeper rewarding (cannot pay work)\n /* WARNING: this allows to top up _jobLiquidityCredits to a max of 1.99 but have to spend at least 1 */\n _jobLiquidityCredits[_job] += _phase(block.timestamp - rewardedAt[_job], _jobPeriodCredits[_job]);\n rewardedAt[_job] = block.timestamp;\n }\n\n /// @notice Updates accountance for _jobPeriodCredits\n function _updateJobPeriod(address _job) internal {\n _jobPeriodCredits[_job] = _calculateJobPeriodCredits(_job);\n }\n\n /// @notice Quotes the outdated job liquidities and calculates _periodCredits\n /// @dev This function is also responsible for keeping the KP3R/WETH quote updated\n function _calculateJobPeriodCredits(address _job) internal returns (uint256 _periodCredits) {\n if (_tick[kp3rWethPool].period != _period(block.timestamp)) {\n // Updates KP3R/WETH quote if needed\n _tick[kp3rWethPool] = observeLiquidity(kp3rWethPool);\n }\n\n for (uint256 i; i < _jobLiquidities[_job].length(); i++) {\n address _liquidity = _jobLiquidities[_job].at(i);\n if (_approvedLiquidities.contains(_liquidity)) {\n if (_tick[_liquidity].period != _period(block.timestamp)) {\n // Updates liquidity cache only if needed\n _tick[_liquidity] = observeLiquidity(_liquidity);\n }\n _periodCredits += _getReward(_quoteLiquidity(liquidityAmount[_job][_liquidity], _liquidity));\n }\n }\n }\n\n /// @notice Updates job accountance calculating the impact of the unbonded liquidity amount\n function _unbondLiquidityFromJob(\n address _job,\n address _liquidity,\n uint256 _amount\n ) internal nonReentrant {\n if (!_jobLiquidities[_job].contains(_liquidity)) revert JobLiquidityUnexistent();\n if (liquidityAmount[_job][_liquidity] < _amount) revert JobLiquidityInsufficient();\n\n // Ensures current twaps in job liquidities\n _updateJobPeriod(_job);\n uint256 _periodCreditsToRemove = _getReward(_quoteLiquidity(_amount, _liquidity));\n\n // A liquidity can be revoked causing a job to have 0 periodCredits\n if (_jobPeriodCredits[_job] > 0) {\n // Removes a % correspondant to a full rewardPeriodTime for the liquidity withdrawn vs all of the liquidities\n _jobLiquidityCredits[_job] -= (_jobLiquidityCredits[_job] * _periodCreditsToRemove) / _jobPeriodCredits[_job];\n _jobPeriodCredits[_job] -= _periodCreditsToRemove;\n }\n\n liquidityAmount[_job][_liquidity] -= _amount;\n if (liquidityAmount[_job][_liquidity] == 0) {\n _jobLiquidities[_job].remove(_liquidity);\n }\n }\n\n /// @notice Returns a fraction of the multiplier or the whole multiplier if equal or more than a rewardPeriodTime has passed\n function _phase(uint256 _timePassed, uint256 _multiplier) internal view returns (uint256 _result) {\n if (_timePassed < rewardPeriodTime) {\n _result = (_timePassed * _multiplier) / rewardPeriodTime;\n } else _result = _multiplier;\n }\n\n /// @notice Returns the start of the period of the provided timestamp\n function _period(uint256 _timestamp) internal view returns (uint256 _periodTimestamp) {\n return _timestamp - (_timestamp % rewardPeriodTime);\n }\n\n /// @notice Calculates relation between rewardPeriod and inflationPeriod\n function _getReward(uint256 _baseAmount) internal view returns (uint256 _credits) {\n return FullMath.mulDiv(_baseAmount, rewardPeriodTime, inflationPeriod);\n }\n\n /// @notice Returns underlying KP3R amount for a given liquidity amount\n function _quoteLiquidity(uint256 _amount, address _liquidity) internal view returns (uint256 _quote) {\n if (_tick[_liquidity].period != 0) {\n int56 _tickDifference = _isKP3RToken0[_liquidity] ? _tick[_liquidity].difference : -_tick[_liquidity].difference;\n _quote = IKeep3rHelper(keep3rHelper).getKP3RsAtTick(_amount, _tickDifference, rewardPeriodTime);\n }\n }\n\n /// @notice Updates job credits to current quotes and rewards job's pending minted credits\n /// @dev Ensures a maximum of 1 period of credits\n function _settleJobAccountance(address _job) internal virtual {\n _updateJobCreditsIfNeeded(_job);\n _rewardJobCredits(_job);\n _jobLiquidityCredits[_job] = Math.min(_jobLiquidityCredits[_job], _jobPeriodCredits[_job]);\n }\n}\n" - }, - "solidity/contracts/peripherals/Keep3rDisputable.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport './Keep3rParameters.sol';\nimport './Keep3rRoles.sol';\nimport '../../interfaces/peripherals/IKeep3rDisputable.sol';\n\nabstract contract Keep3rDisputable is IKeep3rDisputable, Keep3rAccountance, Keep3rRoles {\n /// @inheritdoc IKeep3rDisputable\n function dispute(address _jobOrKeeper) external override onlyDisputer {\n if (disputes[_jobOrKeeper]) revert AlreadyDisputed();\n disputes[_jobOrKeeper] = true;\n emit Dispute(_jobOrKeeper, msg.sender);\n }\n\n /// @inheritdoc IKeep3rDisputable\n function resolve(address _jobOrKeeper) external override onlyDisputer {\n if (!disputes[_jobOrKeeper]) revert NotDisputed();\n disputes[_jobOrKeeper] = false;\n emit Resolve(_jobOrKeeper, msg.sender);\n }\n}\n" - }, - "solidity/contracts/peripherals/jobs/Keep3rJobOwnership.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../../../interfaces/peripherals/IKeep3rJobs.sol';\n\nabstract contract Keep3rJobOwnership is IKeep3rJobOwnership {\n /// @inheritdoc IKeep3rJobOwnership\n mapping(address => address) public override jobOwner;\n\n /// @inheritdoc IKeep3rJobOwnership\n mapping(address => address) public override jobPendingOwner;\n\n /// @inheritdoc IKeep3rJobOwnership\n function changeJobOwnership(address _job, address _newOwner) external override onlyJobOwner(_job) {\n jobPendingOwner[_job] = _newOwner;\n emit JobOwnershipChange(_job, jobOwner[_job], _newOwner);\n }\n\n /// @inheritdoc IKeep3rJobOwnership\n function acceptJobOwnership(address _job) external override onlyPendingJobOwner(_job) {\n address _previousOwner = jobOwner[_job];\n\n jobOwner[_job] = jobPendingOwner[_job];\n delete jobPendingOwner[_job];\n\n emit JobOwnershipAssent(msg.sender, _job, _previousOwner);\n }\n\n modifier onlyJobOwner(address _job) {\n if (msg.sender != jobOwner[_job]) revert OnlyJobOwner();\n _;\n }\n\n modifier onlyPendingJobOwner(address _job) {\n if (msg.sender != jobPendingOwner[_job]) revert OnlyPendingJobOwner();\n _;\n }\n}\n" - }, - "solidity/interfaces/peripherals/IKeep3rJobs.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\n/// @title Keep3rJobFundableCredits contract\n/// @notice Handles the addition and withdrawal of credits from a job\ninterface IKeep3rJobFundableCredits {\n // Events\n\n /// @notice Emitted when Keep3rJobFundableCredits#addTokenCreditsToJob is called\n /// @param _job The address of the job being credited\n /// @param _token The address of the token being provided\n /// @param _provider The user that calls the function\n /// @param _amount The amount of credit being added to the job\n event TokenCreditAddition(address indexed _job, address indexed _token, address indexed _provider, uint256 _amount);\n\n /// @notice Emitted when Keep3rJobFundableCredits#withdrawTokenCreditsFromJob is called\n /// @param _job The address of the job from which the credits are withdrawn\n /// @param _token The credit being withdrawn from the job\n /// @param _receiver The user that receives the tokens\n /// @param _amount The amount of credit withdrawn\n event TokenCreditWithdrawal(address indexed _job, address indexed _token, address indexed _receiver, uint256 _amount);\n\n // Errors\n\n /// @notice Throws when the token is KP3R, as it should not be used for direct token payments\n error TokenUnallowed();\n\n /// @notice Throws when the token withdraw cooldown has not yet passed\n error JobTokenCreditsLocked();\n\n /// @notice Throws when the user tries to withdraw more tokens than it has\n error InsufficientJobTokenCredits();\n\n // Variables\n\n /// @notice Last block where tokens were added to the job [job => token => timestamp]\n /// @return _timestamp The last block where tokens were added to the job\n function jobTokenCreditsAddedAt(address _job, address _token) external view returns (uint256 _timestamp);\n\n // Methods\n\n /// @notice Add credit to a job to be paid out for work\n /// @param _job The address of the job being credited\n /// @param _token The address of the token being credited\n /// @param _amount The amount of credit being added\n function addTokenCreditsToJob(\n address _job,\n address _token,\n uint256 _amount\n ) external;\n\n /// @notice Withdraw credit from a job\n /// @param _job The address of the job from which the credits are withdrawn\n /// @param _token The address of the token being withdrawn\n /// @param _amount The amount of token to be withdrawn\n /// @param _receiver The user that will receive tokens\n function withdrawTokenCreditsFromJob(\n address _job,\n address _token,\n uint256 _amount,\n address _receiver\n ) external;\n}\n\n/// @title Keep3rJobFundableLiquidity contract\n/// @notice Handles the funding of jobs through specific liquidity pairs\ninterface IKeep3rJobFundableLiquidity {\n // Events\n\n /// @notice Emitted when Keep3rJobFundableLiquidity#approveLiquidity function is called\n /// @param _liquidity The address of the liquidity pair being approved\n event LiquidityApproval(address _liquidity);\n\n /// @notice Emitted when Keep3rJobFundableLiquidity#revokeLiquidity function is called\n /// @param _liquidity The address of the liquidity pair being revoked\n event LiquidityRevocation(address _liquidity);\n\n /// @notice Emitted when IKeep3rJobFundableLiquidity#addLiquidityToJob function is called\n /// @param _job The address of the job to which liquidity will be added\n /// @param _liquidity The address of the liquidity being added\n /// @param _provider The user that calls the function\n /// @param _amount The amount of liquidity being added\n event LiquidityAddition(address indexed _job, address indexed _liquidity, address indexed _provider, uint256 _amount);\n\n /// @notice Emitted when IKeep3rJobFundableLiquidity#withdrawLiquidityFromJob function is called\n /// @param _job The address of the job of which liquidity will be withdrawn from\n /// @param _liquidity The address of the liquidity being withdrawn\n /// @param _receiver The receiver of the liquidity tokens\n /// @param _amount The amount of liquidity being withdrawn from the job\n event LiquidityWithdrawal(address indexed _job, address indexed _liquidity, address indexed _receiver, uint256 _amount);\n\n /// @notice Emitted when Keep3rJobFundableLiquidity#addLiquidityToJob function is called\n /// @param _job The address of the job whose credits will be updated\n /// @param _rewardedAt The time at which the job was last rewarded\n /// @param _currentCredits The current credits of the job\n /// @param _periodCredits The credits of the job for the current period\n event LiquidityCreditsReward(address indexed _job, uint256 _rewardedAt, uint256 _currentCredits, uint256 _periodCredits);\n\n /// @notice Emitted when Keep3rJobFundableLiquidity#forceLiquidityCreditsToJob function is called\n /// @param _job The address of the job whose credits will be updated\n /// @param _rewardedAt The time at which the job was last rewarded\n /// @param _currentCredits The current credits of the job\n event LiquidityCreditsForced(address indexed _job, uint256 _rewardedAt, uint256 _currentCredits);\n\n // Errors\n\n /// @notice Throws when the liquidity being approved has already been approved\n error LiquidityPairApproved();\n\n /// @notice Throws when the liquidity being removed has not been approved\n error LiquidityPairUnexistent();\n\n /// @notice Throws when trying to add liquidity to an unapproved pool\n error LiquidityPairUnapproved();\n\n /// @notice Throws when the job doesn't have the requested liquidity\n error JobLiquidityUnexistent();\n\n /// @notice Throws when trying to remove more liquidity than the job has\n error JobLiquidityInsufficient();\n\n /// @notice Throws when trying to add less liquidity than the minimum liquidity required\n error JobLiquidityLessThanMin();\n\n // Structs\n\n /// @notice Stores the tick information of the different liquidity pairs\n struct TickCache {\n int56 current; // Tracks the current tick\n int56 difference; // Stores the difference between the current tick and the last tick\n uint256 period; // Stores the period at which the last observation was made\n }\n\n // Variables\n\n /// @notice Lists liquidity pairs\n /// @return _list An array of addresses with all the approved liquidity pairs\n function approvedLiquidities() external view returns (address[] memory _list);\n\n /// @notice Amount of liquidity in a specified job\n /// @param _job The address of the job being checked\n /// @param _liquidity The address of the liquidity we are checking\n /// @return _amount Amount of liquidity in the specified job\n function liquidityAmount(address _job, address _liquidity) external view returns (uint256 _amount);\n\n /// @notice Last time the job was rewarded liquidity credits\n /// @param _job The address of the job being checked\n /// @return _timestamp Timestamp of the last time the job was rewarded liquidity credits\n function rewardedAt(address _job) external view returns (uint256 _timestamp);\n\n /// @notice Last time the job was worked\n /// @param _job The address of the job being checked\n /// @return _timestamp Timestamp of the last time the job was worked\n function workedAt(address _job) external view returns (uint256 _timestamp);\n\n // Methods\n\n /// @notice Returns the liquidity credits of a given job\n /// @param _job The address of the job of which we want to know the liquidity credits\n /// @return _amount The liquidity credits of a given job\n function jobLiquidityCredits(address _job) external view returns (uint256 _amount);\n\n /// @notice Returns the credits of a given job for the current period\n /// @param _job The address of the job of which we want to know the period credits\n /// @return _amount The credits the given job has at the current period\n function jobPeriodCredits(address _job) external view returns (uint256 _amount);\n\n /// @notice Calculates the total credits of a given job\n /// @param _job The address of the job of which we want to know the total credits\n /// @return _amount The total credits of the given job\n function totalJobCredits(address _job) external view returns (uint256 _amount);\n\n /// @notice Calculates how many credits should be rewarded periodically for a given liquidity amount\n /// @dev _periodCredits = underlying KP3Rs for given liquidity amount * rewardPeriod / inflationPeriod\n /// @param _liquidity The liquidity to provide\n /// @param _amount The amount of liquidity to provide\n /// @return _periodCredits The amount of KP3R periodically minted for the given liquidity\n function quoteLiquidity(address _liquidity, uint256 _amount) external view returns (uint256 _periodCredits);\n\n /// @notice Observes the current state of the liquidity pair being observed and updates TickCache with the information\n /// @param _liquidity The liquidity pair being observed\n /// @return _tickCache The updated TickCache\n function observeLiquidity(address _liquidity) external view returns (TickCache memory _tickCache);\n\n /// @notice Gifts liquidity credits to the specified job\n /// @param _job The address of the job being credited\n /// @param _amount The amount of liquidity credits to gift\n function forceLiquidityCreditsToJob(address _job, uint256 _amount) external;\n\n /// @notice Approve a liquidity pair for being accepted in future\n /// @param _liquidity The address of the liquidity accepted\n function approveLiquidity(address _liquidity) external;\n\n /// @notice Revoke a liquidity pair from being accepted in future\n /// @param _liquidity The liquidity no longer accepted\n function revokeLiquidity(address _liquidity) external;\n\n /// @notice Allows anyone to fund a job with liquidity\n /// @param _job The address of the job to assign liquidity to\n /// @param _liquidity The liquidity being added\n /// @param _amount The amount of liquidity tokens to add\n function addLiquidityToJob(\n address _job,\n address _liquidity,\n uint256 _amount\n ) external;\n\n /// @notice Unbond liquidity for a job\n /// @dev Can only be called by the job's owner\n /// @param _job The address of the job being unbound from\n /// @param _liquidity The liquidity being unbound\n /// @param _amount The amount of liquidity being removed\n function unbondLiquidityFromJob(\n address _job,\n address _liquidity,\n uint256 _amount\n ) external;\n\n /// @notice Withdraw liquidity from a job\n /// @param _job The address of the job being withdrawn from\n /// @param _liquidity The liquidity being withdrawn\n /// @param _receiver The address that will receive the withdrawn liquidity\n function withdrawLiquidityFromJob(\n address _job,\n address _liquidity,\n address _receiver\n ) external;\n}\n\n/// @title Keep3rJobManager contract\n/// @notice Handles the addition and withdrawal of credits from a job\ninterface IKeep3rJobManager {\n // Events\n\n /// @notice Emitted when Keep3rJobManager#addJob is called\n /// @param _job The address of the job to add\n /// @param _jobOwner The job's owner\n event JobAddition(address indexed _job, address indexed _jobOwner);\n\n // Errors\n\n /// @notice Throws when trying to add a job that has already been added\n error JobAlreadyAdded();\n\n /// @notice Throws when the address that is trying to register as a keeper is already a keeper\n error AlreadyAKeeper();\n\n // Methods\n\n /// @notice Allows any caller to add a new job\n /// @param _job Address of the contract for which work should be performed\n function addJob(address _job) external;\n}\n\n/// @title Keep3rJobWorkable contract\n/// @notice Handles the mechanisms jobs can pay keepers with along with the restrictions jobs can put on keepers before they can work on jobs\ninterface IKeep3rJobWorkable {\n // Events\n\n /// @notice Emitted when a keeper is validated before a job\n /// @param _gasLeft The amount of gas that the transaction has left at the moment of keeper validation\n event KeeperValidation(uint256 _gasLeft);\n\n /// @notice Emitted when a keeper works a job\n /// @param _credit The address of the asset in which the keeper is paid\n /// @param _job The address of the job the keeper has worked\n /// @param _keeper The address of the keeper that has worked the job\n /// @param _amount The amount that has been paid out to the keeper in exchange for working the job\n /// @param _gasLeft The amount of gas that the transaction has left at the moment of payment\n event KeeperWork(address indexed _credit, address indexed _job, address indexed _keeper, uint256 _amount, uint256 _gasLeft);\n\n // Errors\n\n /// @notice Throws if the address claiming to be a job is not in the list of approved jobs\n error JobUnapproved();\n\n /// @notice Throws if the amount of funds in the job is less than the payment that must be paid to the keeper that works that job\n error InsufficientFunds();\n\n // Methods\n\n /// @notice Confirms if the current keeper is registered, can be used for general (non critical) functions\n /// @param _keeper The keeper being investigated\n /// @return _isKeeper Whether the address passed as a parameter is a keeper or not\n function isKeeper(address _keeper) external returns (bool _isKeeper);\n\n /// @notice Confirms if the current keeper is registered and has a minimum bond of any asset. Should be used for protected functions\n /// @param _keeper The keeper to check\n /// @param _bond The bond token being evaluated\n /// @param _minBond The minimum amount of bonded tokens\n /// @param _earned The minimum funds earned in the keepers lifetime\n /// @param _age The minimum keeper age required\n /// @return _isBondedKeeper Whether the `_keeper` meets the given requirements\n function isBondedKeeper(\n address _keeper,\n address _bond,\n uint256 _minBond,\n uint256 _earned,\n uint256 _age\n ) external returns (bool _isBondedKeeper);\n\n /// @notice Implemented by jobs to show that a keeper performed work\n /// @dev Automatically calculates the payment for the keeper\n /// @param _keeper Address of the keeper that performed the work\n function worked(address _keeper) external;\n\n /// @notice Implemented by jobs to show that a keeper performed work\n /// @dev Pays the keeper that performs the work with KP3R\n /// @param _keeper Address of the keeper that performed the work\n /// @param _payment The reward that should be allocated for the job\n function bondedPayment(address _keeper, uint256 _payment) external;\n\n /// @notice Implemented by jobs to show that a keeper performed work\n /// @dev Pays the keeper that performs the work with a specific token\n /// @param _token The asset being awarded to the keeper\n /// @param _keeper Address of the keeper that performed the work\n /// @param _amount The reward that should be allocated\n function directTokenPayment(\n address _token,\n address _keeper,\n uint256 _amount\n ) external;\n}\n\n/// @title Keep3rJobOwnership contract\n/// @notice Handles the ownership of the jobs\ninterface IKeep3rJobOwnership {\n // Events\n\n /// @notice Emitted when Keep3rJobOwnership#changeJobOwnership is called\n /// @param _job The address of the job proposed to have a change of owner\n /// @param _owner The current owner of the job\n /// @param _pendingOwner The new address proposed to be the owner of the job\n event JobOwnershipChange(address indexed _job, address indexed _owner, address indexed _pendingOwner);\n\n /// @notice Emitted when Keep3rJobOwnership#JobOwnershipAssent is called\n /// @param _job The address of the job which the proposed owner will now own\n /// @param _previousOwner The previous owner of the job\n /// @param _newOwner The newowner of the job\n event JobOwnershipAssent(address indexed _job, address indexed _previousOwner, address indexed _newOwner);\n\n // Errors\n\n /// @notice Throws when the caller of the function is not the job owner\n error OnlyJobOwner();\n\n /// @notice Throws when the caller of the function is not the pending job owner\n error OnlyPendingJobOwner();\n\n // Variables\n\n /// @notice Maps the job to the owner of the job (job => user)\n /// @return _owner The addres of the owner of the job\n function jobOwner(address _job) external view returns (address _owner);\n\n /// @notice Maps the owner of the job to its pending owner (job => user)\n /// @return _pendingOwner The address of the pending owner of the job\n function jobPendingOwner(address _job) external view returns (address _pendingOwner);\n\n // Methods\n\n /// @notice Proposes a new address to be the owner of the job\n function changeJobOwnership(address _job, address _newOwner) external;\n\n /// @notice The proposed address accepts to be the owner of the job\n function acceptJobOwnership(address _job) external;\n}\n\n/// @title Keep3rJobMigration contract\n/// @notice Handles the migration process of jobs to different addresses\ninterface IKeep3rJobMigration {\n // Events\n\n /// @notice Emitted when Keep3rJobMigration#migrateJob function is called\n /// @param _fromJob The address of the job that requests to migrate\n /// @param _toJob The address at which the job requests to migrate\n event JobMigrationRequested(address indexed _fromJob, address _toJob);\n\n /// @notice Emitted when Keep3rJobMigration#acceptJobMigration function is called\n /// @param _fromJob The address of the job that requested to migrate\n /// @param _toJob The address at which the job had requested to migrate\n event JobMigrationSuccessful(address _fromJob, address indexed _toJob);\n\n // Errors\n\n /// @notice Throws when the address of the job that requests to migrate wants to migrate to its same address\n error JobMigrationImpossible();\n\n /// @notice Throws when the _toJob address differs from the address being tracked in the pendingJobMigrations mapping\n error JobMigrationUnavailable();\n\n /// @notice Throws when cooldown between migrations has not yet passed\n error JobMigrationLocked();\n\n // Variables\n\n /// @notice Maps the jobs that have requested a migration to the address they have requested to migrate to\n /// @return _toJob The address to which the job has requested to migrate to\n function pendingJobMigrations(address _fromJob) external view returns (address _toJob);\n\n // Methods\n\n /// @notice Initializes the migration process for a job by adding the request to the pendingJobMigrations mapping\n /// @param _fromJob The address of the job that is requesting to migrate\n /// @param _toJob The address at which the job is requesting to migrate\n function migrateJob(address _fromJob, address _toJob) external;\n\n /// @notice Completes the migration process for a job\n /// @dev Unbond/withdraw process doesn't get migrated\n /// @param _fromJob The address of the job that requested to migrate\n /// @param _toJob The address to which the job wants to migrate to\n function acceptJobMigration(address _fromJob, address _toJob) external;\n}\n\n/// @title Keep3rJobDisputable contract\n/// @notice Handles the actions that can be taken on a disputed job\ninterface IKeep3rJobDisputable is IKeep3rJobFundableCredits, IKeep3rJobFundableLiquidity {\n // Events\n\n /// @notice Emitted when Keep3rJobDisputable#slashTokenFromJob is called\n /// @param _job The address of the job from which the token will be slashed\n /// @param _token The address of the token being slashed\n /// @param _slasher The user that slashes the token\n /// @param _amount The amount of the token being slashed\n event JobSlashToken(address indexed _job, address _token, address indexed _slasher, uint256 _amount);\n\n /// @notice Emitted when Keep3rJobDisputable#slashLiquidityFromJob is called\n /// @param _job The address of the job from which the liquidity will be slashed\n /// @param _liquidity The address of the liquidity being slashed\n /// @param _slasher The user that slashes the liquidity\n /// @param _amount The amount of the liquidity being slashed\n event JobSlashLiquidity(address indexed _job, address _liquidity, address indexed _slasher, uint256 _amount);\n\n // Errors\n\n /// @notice Throws when the token trying to be slashed doesn't exist\n error JobTokenUnexistent();\n\n /// @notice Throws when someone tries to slash more tokens than the job has\n error JobTokenInsufficient();\n\n // Methods\n\n /// @notice Allows governance or slasher to slash a job specific token\n /// @param _job The address of the job from which the token will be slashed\n /// @param _token The address of the token that will be slashed\n /// @param _amount The amount of the token that will be slashed\n function slashTokenFromJob(\n address _job,\n address _token,\n uint256 _amount\n ) external;\n\n /// @notice Allows governance or a slasher to slash liquidity from a job\n /// @param _job The address being slashed\n /// @param _liquidity The address of the liquidity that will be slashed\n /// @param _amount The amount of liquidity that will be slashed\n function slashLiquidityFromJob(\n address _job,\n address _liquidity,\n uint256 _amount\n ) external;\n}\n\n// solhint-disable-next-line no-empty-blocks\ninterface IKeep3rJobs is IKeep3rJobOwnership, IKeep3rJobDisputable, IKeep3rJobMigration, IKeep3rJobManager, IKeep3rJobWorkable {\n\n}\n" - }, - "@openzeppelin/contracts/security/ReentrancyGuard.sol": { - "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Contract module that helps prevent reentrant calls to a function.\n *\n * Inheriting from `ReentrancyGuard` will make the {nonReentrant} modifier\n * available, which can be applied to functions to make sure there are no nested\n * (reentrant) calls to them.\n *\n * Note that because there is a single `nonReentrant` guard, functions marked as\n * `nonReentrant` may not call one another. This can be worked around by making\n * those functions `private`, and then adding `external` `nonReentrant` entry\n * points to them.\n *\n * TIP: If you would like to learn more about reentrancy and alternative ways\n * to protect against it, check out our blog post\n * https://blog.openzeppelin.com/reentrancy-after-istanbul/[Reentrancy After Istanbul].\n */\nabstract contract ReentrancyGuard {\n // Booleans are more expensive than uint256 or any type that takes up a full\n // word because each write operation emits an extra SLOAD to first read the\n // slot's contents, replace the bits taken up by the boolean, and then write\n // back. This is the compiler's defense against contract upgrades and\n // pointer aliasing, and it cannot be disabled.\n\n // The values being non-zero value makes deployment a bit more expensive,\n // but in exchange the refund on every call to nonReentrant will be lower in\n // amount. Since refunds are capped to a percentage of the total\n // transaction's gas, it is best to keep them low in cases like this one, to\n // increase the likelihood of the full refund coming into effect.\n uint256 private constant _NOT_ENTERED = 1;\n uint256 private constant _ENTERED = 2;\n\n uint256 private _status;\n\n constructor() {\n _status = _NOT_ENTERED;\n }\n\n /**\n * @dev Prevents a contract from calling itself, directly or indirectly.\n * Calling a `nonReentrant` function from another `nonReentrant`\n * function is not supported. It is possible to prevent this from happening\n * by making the `nonReentrant` function external, and make it call a\n * `private` function that does the actual work.\n */\n modifier nonReentrant() {\n // On the first call to nonReentrant, _notEntered will be true\n require(_status != _ENTERED, \"ReentrancyGuard: reentrant call\");\n\n // Any calls to nonReentrant after this point will fail\n _status = _ENTERED;\n\n _;\n\n // By storing the original value once again, a refund is triggered (see\n // https://eips.ethereum.org/EIPS/eip-2200)\n _status = _NOT_ENTERED;\n }\n}\n" - }, - "@openzeppelin/contracts/token/ERC20/IERC20.sol": { - "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Interface of the ERC20 standard as defined in the EIP.\n */\ninterface IERC20 {\n /**\n * @dev Returns the amount of tokens in existence.\n */\n function totalSupply() external view returns (uint256);\n\n /**\n * @dev Returns the amount of tokens owned by `account`.\n */\n function balanceOf(address account) external view returns (uint256);\n\n /**\n * @dev Moves `amount` tokens from the caller's account to `recipient`.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * Emits a {Transfer} event.\n */\n function transfer(address recipient, uint256 amount) external returns (bool);\n\n /**\n * @dev Returns the remaining number of tokens that `spender` will be\n * allowed to spend on behalf of `owner` through {transferFrom}. This is\n * zero by default.\n *\n * This value changes when {approve} or {transferFrom} are called.\n */\n function allowance(address owner, address spender) external view returns (uint256);\n\n /**\n * @dev Sets `amount` as the allowance of `spender` over the caller's tokens.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * IMPORTANT: Beware that changing an allowance with this method brings the risk\n * that someone may use both the old and the new allowance by unfortunate\n * transaction ordering. One possible solution to mitigate this race\n * condition is to first reduce the spender's allowance to 0 and set the\n * desired value afterwards:\n * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729\n *\n * Emits an {Approval} event.\n */\n function approve(address spender, uint256 amount) external returns (bool);\n\n /**\n * @dev Moves `amount` tokens from `sender` to `recipient` using the\n * allowance mechanism. `amount` is then deducted from the caller's\n * allowance.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * Emits a {Transfer} event.\n */\n function transferFrom(\n address sender,\n address recipient,\n uint256 amount\n ) external returns (bool);\n\n /**\n * @dev Emitted when `value` tokens are moved from one account (`from`) to\n * another (`to`).\n *\n * Note that `value` may be zero.\n */\n event Transfer(address indexed from, address indexed to, uint256 value);\n\n /**\n * @dev Emitted when the allowance of a `spender` for an `owner` is set by\n * a call to {approve}. `value` is the new allowance.\n */\n event Approval(address indexed owner, address indexed spender, uint256 value);\n}\n" - }, - "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol": { - "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\nimport \"../IERC20.sol\";\nimport \"../../../utils/Address.sol\";\n\n/**\n * @title SafeERC20\n * @dev Wrappers around ERC20 operations that throw on failure (when the token\n * contract returns false). Tokens that return no value (and instead revert or\n * throw on failure) are also supported, non-reverting calls are assumed to be\n * successful.\n * To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract,\n * which allows you to call the safe operations as `token.safeTransfer(...)`, etc.\n */\nlibrary SafeERC20 {\n using Address for address;\n\n function safeTransfer(\n IERC20 token,\n address to,\n uint256 value\n ) internal {\n _callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value));\n }\n\n function safeTransferFrom(\n IERC20 token,\n address from,\n address to,\n uint256 value\n ) internal {\n _callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value));\n }\n\n /**\n * @dev Deprecated. This function has issues similar to the ones found in\n * {IERC20-approve}, and its usage is discouraged.\n *\n * Whenever possible, use {safeIncreaseAllowance} and\n * {safeDecreaseAllowance} instead.\n */\n function safeApprove(\n IERC20 token,\n address spender,\n uint256 value\n ) internal {\n // safeApprove should only be called when setting an initial allowance,\n // or when resetting it to zero. To increase and decrease it, use\n // 'safeIncreaseAllowance' and 'safeDecreaseAllowance'\n require(\n (value == 0) || (token.allowance(address(this), spender) == 0),\n \"SafeERC20: approve from non-zero to non-zero allowance\"\n );\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value));\n }\n\n function safeIncreaseAllowance(\n IERC20 token,\n address spender,\n uint256 value\n ) internal {\n uint256 newAllowance = token.allowance(address(this), spender) + value;\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));\n }\n\n function safeDecreaseAllowance(\n IERC20 token,\n address spender,\n uint256 value\n ) internal {\n unchecked {\n uint256 oldAllowance = token.allowance(address(this), spender);\n require(oldAllowance >= value, \"SafeERC20: decreased allowance below zero\");\n uint256 newAllowance = oldAllowance - value;\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));\n }\n }\n\n /**\n * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement\n * on the return value: the return value is optional (but if data is returned, it must not be false).\n * @param token The token targeted by the call.\n * @param data The call data (encoded using abi.encode or one of its variants).\n */\n function _callOptionalReturn(IERC20 token, bytes memory data) private {\n // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since\n // we're implementing it ourselves. We use {Address.functionCall} to perform this call, which verifies that\n // the target address contains contract code and also asserts for success in the low-level call.\n\n bytes memory returndata = address(token).functionCall(data, \"SafeERC20: low-level call failed\");\n if (returndata.length > 0) {\n // Return data is optional\n require(abi.decode(returndata, (bool)), \"SafeERC20: ERC20 operation did not succeed\");\n }\n }\n}\n" - }, - "@openzeppelin/contracts/utils/math/Math.sol": { - "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Standard math utilities missing in the Solidity language.\n */\nlibrary Math {\n /**\n * @dev Returns the largest of two numbers.\n */\n function max(uint256 a, uint256 b) internal pure returns (uint256) {\n return a >= b ? a : b;\n }\n\n /**\n * @dev Returns the smallest of two numbers.\n */\n function min(uint256 a, uint256 b) internal pure returns (uint256) {\n return a < b ? a : b;\n }\n\n /**\n * @dev Returns the average of two numbers. The result is rounded towards\n * zero.\n */\n function average(uint256 a, uint256 b) internal pure returns (uint256) {\n // (a + b) / 2 can overflow.\n return (a & b) + (a ^ b) / 2;\n }\n\n /**\n * @dev Returns the ceiling of the division of two numbers.\n *\n * This differs from standard division with `/` in that it rounds up instead\n * of rounding down.\n */\n function ceilDiv(uint256 a, uint256 b) internal pure returns (uint256) {\n // (a + b - 1) / b can overflow on addition, so we distribute.\n return a / b + (a % b == 0 ? 0 : 1);\n }\n}\n" - }, - "@openzeppelin/contracts/utils/structs/EnumerableSet.sol": { - "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Library for managing\n * https://en.wikipedia.org/wiki/Set_(abstract_data_type)[sets] of primitive\n * types.\n *\n * Sets have the following properties:\n *\n * - Elements are added, removed, and checked for existence in constant time\n * (O(1)).\n * - Elements are enumerated in O(n). No guarantees are made on the ordering.\n *\n * ```\n * contract Example {\n * // Add the library methods\n * using EnumerableSet for EnumerableSet.AddressSet;\n *\n * // Declare a set state variable\n * EnumerableSet.AddressSet private mySet;\n * }\n * ```\n *\n * As of v3.3.0, sets of type `bytes32` (`Bytes32Set`), `address` (`AddressSet`)\n * and `uint256` (`UintSet`) are supported.\n */\nlibrary EnumerableSet {\n // To implement this library for multiple types with as little code\n // repetition as possible, we write it in terms of a generic Set type with\n // bytes32 values.\n // The Set implementation uses private functions, and user-facing\n // implementations (such as AddressSet) are just wrappers around the\n // underlying Set.\n // This means that we can only create new EnumerableSets for types that fit\n // in bytes32.\n\n struct Set {\n // Storage of set values\n bytes32[] _values;\n // Position of the value in the `values` array, plus 1 because index 0\n // means a value is not in the set.\n mapping(bytes32 => uint256) _indexes;\n }\n\n /**\n * @dev Add a value to a set. O(1).\n *\n * Returns true if the value was added to the set, that is if it was not\n * already present.\n */\n function _add(Set storage set, bytes32 value) private returns (bool) {\n if (!_contains(set, value)) {\n set._values.push(value);\n // The value is stored at length-1, but we add 1 to all indexes\n // and use 0 as a sentinel value\n set._indexes[value] = set._values.length;\n return true;\n } else {\n return false;\n }\n }\n\n /**\n * @dev Removes a value from a set. O(1).\n *\n * Returns true if the value was removed from the set, that is if it was\n * present.\n */\n function _remove(Set storage set, bytes32 value) private returns (bool) {\n // We read and store the value's index to prevent multiple reads from the same storage slot\n uint256 valueIndex = set._indexes[value];\n\n if (valueIndex != 0) {\n // Equivalent to contains(set, value)\n // To delete an element from the _values array in O(1), we swap the element to delete with the last one in\n // the array, and then remove the last element (sometimes called as 'swap and pop').\n // This modifies the order of the array, as noted in {at}.\n\n uint256 toDeleteIndex = valueIndex - 1;\n uint256 lastIndex = set._values.length - 1;\n\n if (lastIndex != toDeleteIndex) {\n bytes32 lastvalue = set._values[lastIndex];\n\n // Move the last value to the index where the value to delete is\n set._values[toDeleteIndex] = lastvalue;\n // Update the index for the moved value\n set._indexes[lastvalue] = valueIndex; // Replace lastvalue's index to valueIndex\n }\n\n // Delete the slot where the moved value was stored\n set._values.pop();\n\n // Delete the index for the deleted slot\n delete set._indexes[value];\n\n return true;\n } else {\n return false;\n }\n }\n\n /**\n * @dev Returns true if the value is in the set. O(1).\n */\n function _contains(Set storage set, bytes32 value) private view returns (bool) {\n return set._indexes[value] != 0;\n }\n\n /**\n * @dev Returns the number of values on the set. O(1).\n */\n function _length(Set storage set) private view returns (uint256) {\n return set._values.length;\n }\n\n /**\n * @dev Returns the value stored at position `index` in the set. O(1).\n *\n * Note that there are no guarantees on the ordering of values inside the\n * array, and it may change when more values are added or removed.\n *\n * Requirements:\n *\n * - `index` must be strictly less than {length}.\n */\n function _at(Set storage set, uint256 index) private view returns (bytes32) {\n return set._values[index];\n }\n\n /**\n * @dev Return the entire set in an array\n *\n * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed\n * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that\n * this function has an unbounded cost, and using it as part of a state-changing function may render the function\n * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.\n */\n function _values(Set storage set) private view returns (bytes32[] memory) {\n return set._values;\n }\n\n // Bytes32Set\n\n struct Bytes32Set {\n Set _inner;\n }\n\n /**\n * @dev Add a value to a set. O(1).\n *\n * Returns true if the value was added to the set, that is if it was not\n * already present.\n */\n function add(Bytes32Set storage set, bytes32 value) internal returns (bool) {\n return _add(set._inner, value);\n }\n\n /**\n * @dev Removes a value from a set. O(1).\n *\n * Returns true if the value was removed from the set, that is if it was\n * present.\n */\n function remove(Bytes32Set storage set, bytes32 value) internal returns (bool) {\n return _remove(set._inner, value);\n }\n\n /**\n * @dev Returns true if the value is in the set. O(1).\n */\n function contains(Bytes32Set storage set, bytes32 value) internal view returns (bool) {\n return _contains(set._inner, value);\n }\n\n /**\n * @dev Returns the number of values in the set. O(1).\n */\n function length(Bytes32Set storage set) internal view returns (uint256) {\n return _length(set._inner);\n }\n\n /**\n * @dev Returns the value stored at position `index` in the set. O(1).\n *\n * Note that there are no guarantees on the ordering of values inside the\n * array, and it may change when more values are added or removed.\n *\n * Requirements:\n *\n * - `index` must be strictly less than {length}.\n */\n function at(Bytes32Set storage set, uint256 index) internal view returns (bytes32) {\n return _at(set._inner, index);\n }\n\n /**\n * @dev Return the entire set in an array\n *\n * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed\n * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that\n * this function has an unbounded cost, and using it as part of a state-changing function may render the function\n * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.\n */\n function values(Bytes32Set storage set) internal view returns (bytes32[] memory) {\n return _values(set._inner);\n }\n\n // AddressSet\n\n struct AddressSet {\n Set _inner;\n }\n\n /**\n * @dev Add a value to a set. O(1).\n *\n * Returns true if the value was added to the set, that is if it was not\n * already present.\n */\n function add(AddressSet storage set, address value) internal returns (bool) {\n return _add(set._inner, bytes32(uint256(uint160(value))));\n }\n\n /**\n * @dev Removes a value from a set. O(1).\n *\n * Returns true if the value was removed from the set, that is if it was\n * present.\n */\n function remove(AddressSet storage set, address value) internal returns (bool) {\n return _remove(set._inner, bytes32(uint256(uint160(value))));\n }\n\n /**\n * @dev Returns true if the value is in the set. O(1).\n */\n function contains(AddressSet storage set, address value) internal view returns (bool) {\n return _contains(set._inner, bytes32(uint256(uint160(value))));\n }\n\n /**\n * @dev Returns the number of values in the set. O(1).\n */\n function length(AddressSet storage set) internal view returns (uint256) {\n return _length(set._inner);\n }\n\n /**\n * @dev Returns the value stored at position `index` in the set. O(1).\n *\n * Note that there are no guarantees on the ordering of values inside the\n * array, and it may change when more values are added or removed.\n *\n * Requirements:\n *\n * - `index` must be strictly less than {length}.\n */\n function at(AddressSet storage set, uint256 index) internal view returns (address) {\n return address(uint160(uint256(_at(set._inner, index))));\n }\n\n /**\n * @dev Return the entire set in an array\n *\n * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed\n * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that\n * this function has an unbounded cost, and using it as part of a state-changing function may render the function\n * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.\n */\n function values(AddressSet storage set) internal view returns (address[] memory) {\n bytes32[] memory store = _values(set._inner);\n address[] memory result;\n\n assembly {\n result := store\n }\n\n return result;\n }\n\n // UintSet\n\n struct UintSet {\n Set _inner;\n }\n\n /**\n * @dev Add a value to a set. O(1).\n *\n * Returns true if the value was added to the set, that is if it was not\n * already present.\n */\n function add(UintSet storage set, uint256 value) internal returns (bool) {\n return _add(set._inner, bytes32(value));\n }\n\n /**\n * @dev Removes a value from a set. O(1).\n *\n * Returns true if the value was removed from the set, that is if it was\n * present.\n */\n function remove(UintSet storage set, uint256 value) internal returns (bool) {\n return _remove(set._inner, bytes32(value));\n }\n\n /**\n * @dev Returns true if the value is in the set. O(1).\n */\n function contains(UintSet storage set, uint256 value) internal view returns (bool) {\n return _contains(set._inner, bytes32(value));\n }\n\n /**\n * @dev Returns the number of values on the set. O(1).\n */\n function length(UintSet storage set) internal view returns (uint256) {\n return _length(set._inner);\n }\n\n /**\n * @dev Returns the value stored at position `index` in the set. O(1).\n *\n * Note that there are no guarantees on the ordering of values inside the\n * array, and it may change when more values are added or removed.\n *\n * Requirements:\n *\n * - `index` must be strictly less than {length}.\n */\n function at(UintSet storage set, uint256 index) internal view returns (uint256) {\n return uint256(_at(set._inner, index));\n }\n\n /**\n * @dev Return the entire set in an array\n *\n * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed\n * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that\n * this function has an unbounded cost, and using it as part of a state-changing function may render the function\n * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.\n */\n function values(UintSet storage set) internal view returns (uint256[] memory) {\n bytes32[] memory store = _values(set._inner);\n uint256[] memory result;\n\n assembly {\n result := store\n }\n\n return result;\n }\n}\n" - }, - "solidity/interfaces/peripherals/IKeep3rAccountance.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\n/// @title Keep3rDisputable contract\n/// @notice Disputes keepers, or if they're already disputed, it can resolve the case\n/// @dev Argument `bonding` can be the address of either a token or a liquidity\ninterface IKeep3rAccountance {\n // Events\n\n /// @notice Emitted when the bonding process of a new keeper begins\n /// @param _keeper The caller of Keep3rKeeperFundable#bond function\n /// @param _bonding The asset the keeper has bonded\n /// @param _amount The amount the keeper has bonded\n event Bonding(address indexed _keeper, address indexed _bonding, uint256 _amount);\n\n /// @notice Emitted when a keeper or job begins the unbonding process to withdraw the funds\n /// @param _keeperOrJob The keeper or job that began the unbonding process\n /// @param _unbonding The liquidity pair or asset being unbonded\n /// @param _amount The amount being unbonded\n event Unbonding(address indexed _keeperOrJob, address indexed _unbonding, uint256 _amount);\n\n // Variables\n\n /// @notice Tracks the total KP3R earnings of a keeper since it started working\n /// @return _workCompleted Total KP3R earnings of a keeper since it started working\n function workCompleted(address _keeper) external view returns (uint256 _workCompleted);\n\n /// @notice Tracks when a keeper was first registered\n /// @return timestamp The time at which the keeper was first registered\n function firstSeen(address _keeper) external view returns (uint256 timestamp);\n\n /// @notice Tracks if a keeper or job has a pending dispute\n /// @return _disputed Whether a keeper or job has a pending dispute\n function disputes(address _keeperOrJob) external view returns (bool _disputed);\n\n /// @notice Tracks how much a keeper has bonded of a certain token\n /// @return _bonds Amount of a certain token that a keeper has bonded\n function bonds(address _keeper, address _bond) external view returns (uint256 _bonds);\n\n /// @notice The current token credits available for a job\n /// @return _amount The amount of token credits available for a job\n function jobTokenCredits(address _job, address _token) external view returns (uint256 _amount);\n\n /// @notice Tracks the amount of assets deposited in pending bonds\n /// @return _pendingBonds Amount of a certain asset a keeper has unbonding\n function pendingBonds(address _keeper, address _bonding) external view returns (uint256 _pendingBonds);\n\n /// @notice Tracks when a bonding for a keeper can be activated\n /// @return _timestamp Time at which the bonding for a keeper can be activated\n function canActivateAfter(address _keeper, address _bonding) external view returns (uint256 _timestamp);\n\n /// @notice Tracks when keeper bonds are ready to be withdrawn\n /// @return _timestamp Time at which the keeper bonds are ready to be withdrawn\n function canWithdrawAfter(address _keeper, address _bonding) external view returns (uint256 _timestamp);\n\n /// @notice Tracks how much keeper bonds are to be withdrawn\n /// @return _pendingUnbonds The amount of keeper bonds that are to be withdrawn\n function pendingUnbonds(address _keeper, address _bonding) external view returns (uint256 _pendingUnbonds);\n\n /// @notice Checks whether the address has ever bonded an asset\n /// @return _hasBonded Whether the address has ever bonded an asset\n function hasBonded(address _keeper) external view returns (bool _hasBonded);\n\n // Methods\n /// @notice Lists all jobs\n /// @return _jobList Array with all the jobs in _jobs\n function jobs() external view returns (address[] memory _jobList);\n\n /// @notice Lists all keepers\n /// @return _keeperList Array with all the jobs in keepers\n function keepers() external view returns (address[] memory _keeperList);\n\n // Errors\n\n /// @notice Throws when an address is passed as a job, but that address is not a job\n error JobUnavailable();\n\n /// @notice Throws when an action that requires an undisputed job is applied on a disputed job\n error JobDisputed();\n}\n" - }, - "solidity/interfaces/IKeep3rHelper.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.0 <0.9.0;\n\n/// @title Keep3rHelper contract\n/// @notice Contains all the helper functions used throughout the different files.\ninterface IKeep3rHelper {\n // Errors\n\n /// @notice Throws when none of the tokens in the liquidity pair is KP3R\n error LiquidityPairInvalid();\n\n // Variables\n\n /// @notice Address of KP3R token\n /// @return _kp3r Address of KP3R token\n // solhint-disable func-name-mixedcase\n function KP3R() external view returns (address _kp3r);\n\n /// @notice Address of KP3R-WETH pool to use as oracle\n /// @return _kp3rWeth Address of KP3R-WETH pool to use as oracle\n function KP3R_WETH_POOL() external view returns (address _kp3rWeth);\n\n /// @notice The minimum multiplier used to calculate the amount of gas paid to the Keeper for the gas used to perform a job\n /// For example: if the quoted gas used is 1000, then the minimum amount to be paid will be 1000 * MIN / BOOST_BASE\n /// @return _multiplier The MIN multiplier\n function MIN() external view returns (uint256 _multiplier);\n\n /// @notice The maximum multiplier used to calculate the amount of gas paid to the Keeper for the gas used to perform a job\n /// For example: if the quoted gas used is 1000, then the maximum amount to be paid will be 1000 * MAX / BOOST_BASE\n /// @return _multiplier The MAX multiplier\n function MAX() external view returns (uint256 _multiplier);\n\n /// @notice The boost base used to calculate the boost rewards for the keeper\n /// @return _base The boost base number\n function BOOST_BASE() external view returns (uint256 _base);\n\n /// @notice The targeted amount of bonded KP3Rs to max-up reward multiplier\n /// For example: if the amount of KP3R the keeper has bonded is TARGETBOND or more, then the keeper will get\n /// the maximum boost possible in his rewards, if it's less, the reward boost will be proportional\n /// @return _target The amount of KP3R that comforms the TARGETBOND\n function TARGETBOND() external view returns (uint256 _target);\n\n // Methods\n // solhint-enable func-name-mixedcase\n\n /// @notice Calculates the amount of KP3R that corresponds to the ETH passed into the function\n /// @dev This function allows us to calculate how much KP3R we should pay to a keeper for things expressed in ETH, like gas\n /// @param _eth The amount of ETH\n /// @return _amountOut The amount of KP3R\n function quote(uint256 _eth) external view returns (uint256 _amountOut);\n\n /// @notice Returns the amount of KP3R the keeper has bonded\n /// @param _keeper The address of the keeper to check\n /// @return _amountBonded The amount of KP3R the keeper has bonded\n function bonds(address _keeper) external view returns (uint256 _amountBonded);\n\n /// @notice Calculates the reward (in KP3R) that corresponds to a keeper for using gas\n /// @param _keeper The address of the keeper to check\n /// @param _gasUsed The amount of gas used that will be rewarded\n /// @return _kp3r The amount of KP3R that should be awarded to the keeper\n function getRewardAmountFor(address _keeper, uint256 _gasUsed) external view returns (uint256 _kp3r);\n\n /// @notice Calculates the boost in the reward given to a keeper based on the amount of KP3R that keeper has bonded\n /// @param _bonds The amount of KP3R tokens bonded by the keeper\n /// @return _rewardBoost The reward boost that corresponds to the keeper\n function getRewardBoostFor(uint256 _bonds) external view returns (uint256 _rewardBoost);\n\n /// @notice Calculates the reward (in KP3R) that corresponds to tx.origin for using gas\n /// @param _gasUsed The amount of gas used that will be rewarded\n /// @return _amount The amount of KP3R that should be awarded to tx.origin\n function getRewardAmount(uint256 _gasUsed) external view returns (uint256 _amount);\n\n /// @notice Given a pool address, returns the underlying tokens of the pair\n /// @param _pool Address of the correspondant pool\n /// @return _token0 Address of the first token of the pair\n /// @return _token1 Address of the second token of the pair\n function getPoolTokens(address _pool) external view returns (address _token0, address _token1);\n\n /// @notice Defines the order of the tokens in the pair for twap calculations\n /// @param _pool Address of the correspondant pool\n /// @return _isKP3RToken0 Boolean indicating the order of the tokens in the pair\n function isKP3RToken0(address _pool) external view returns (bool _isKP3RToken0);\n\n /// @notice Given an array of secondsAgo, returns UniswapV3 pool cumulatives at that moment\n /// @param _pool Address of the pool to observe\n /// @param _secondsAgo Array with time references to observe\n /// @return _tickCumulative1 Cumulative sum of ticks until first time reference\n /// @return _tickCumulative2 Cumulative sum of ticks until second time reference\n /// @return _success Boolean indicating if the observe call was succesfull\n function observe(address _pool, uint32[] memory _secondsAgo)\n external\n view\n returns (\n int56 _tickCumulative1,\n int56 _tickCumulative2,\n bool _success\n );\n\n /// @notice Given a tick and a liquidity amount, calculates the underlying KP3R tokens\n /// @param _liquidityAmount Amount of liquidity to be converted\n /// @param _tickDifference Tick value used to calculate the quote\n /// @param _timeInterval Time value used to calculate the quote\n /// @return _kp3rAmount Amount of KP3R tokens underlying on the given liquidity\n function getKP3RsAtTick(\n uint256 _liquidityAmount,\n int56 _tickDifference,\n uint256 _timeInterval\n ) external pure returns (uint256 _kp3rAmount);\n\n /// @notice Given a tick and a token amount, calculates the output in correspondant token\n /// @param _baseAmount Amount of token to be converted\n /// @param _tickDifference Tick value used to calculate the quote\n /// @param _timeInterval Time value used to calculate the quote\n /// @return _quoteAmount Amount of credits deserved for the baseAmount at the tick value\n function getQuoteAtTick(\n uint128 _baseAmount,\n int56 _tickDifference,\n uint256 _timeInterval\n ) external pure returns (uint256 _quoteAmount);\n}\n" - }, - "solidity/interfaces/peripherals/IKeep3rParameters.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport './IBaseErrors.sol';\n\n/// @title Keep3rParameters contract\n/// @notice Handles and sets all the required parameters for Keep3r\n\ninterface IKeep3rParameters is IBaseErrors {\n // Events\n\n /// @notice Emitted when the Keep3rHelper address is changed\n /// @param _keep3rHelper The address of Keep3rHelper's contract\n event Keep3rHelperChange(address _keep3rHelper);\n\n /// @notice Emitted when the Keep3rV1 address is changed\n /// @param _keep3rV1 The address of Keep3rV1's contract\n event Keep3rV1Change(address _keep3rV1);\n\n /// @notice Emitted when the Keep3rV1Proxy address is changed\n /// @param _keep3rV1Proxy The address of Keep3rV1Proxy's contract\n event Keep3rV1ProxyChange(address _keep3rV1Proxy);\n\n /// @notice Emitted when the KP3R-WETH pool address is changed\n /// @param _kp3rWethPool The address of the KP3R-WETH pool\n event Kp3rWethPoolChange(address _kp3rWethPool);\n\n /// @notice Emitted when bondTime is changed\n /// @param _bondTime The new bondTime\n event BondTimeChange(uint256 _bondTime);\n\n /// @notice Emitted when _liquidityMinimum is changed\n /// @param _liquidityMinimum The new _liquidityMinimum\n event LiquidityMinimumChange(uint256 _liquidityMinimum);\n\n /// @notice Emitted when _unbondTime is changed\n /// @param _unbondTime The new _unbondTime\n event UnbondTimeChange(uint256 _unbondTime);\n\n /// @notice Emitted when _rewardPeriodTime is changed\n /// @param _rewardPeriodTime The new _rewardPeriodTime\n event RewardPeriodTimeChange(uint256 _rewardPeriodTime);\n\n /// @notice Emitted when the inflationPeriod is changed\n /// @param _inflationPeriod The new inflationPeriod\n event InflationPeriodChange(uint256 _inflationPeriod);\n\n /// @notice Emitted when the fee is changed\n /// @param _fee The new token credits fee\n event FeeChange(uint256 _fee);\n\n // Variables\n\n /// @notice Address of Keep3rHelper's contract\n /// @return _keep3rHelper The address of Keep3rHelper's contract\n function keep3rHelper() external view returns (address _keep3rHelper);\n\n /// @notice Address of Keep3rV1's contract\n /// @return _keep3rV1 The address of Keep3rV1's contract\n function keep3rV1() external view returns (address _keep3rV1);\n\n /// @notice Address of Keep3rV1Proxy's contract\n /// @return _keep3rV1Proxy The address of Keep3rV1Proxy's contract\n function keep3rV1Proxy() external view returns (address _keep3rV1Proxy);\n\n /// @notice Address of the KP3R-WETH pool\n /// @return _kp3rWethPool The address of KP3R-WETH pool\n function kp3rWethPool() external view returns (address _kp3rWethPool);\n\n /// @notice The amount of time required to pass after a keeper has bonded assets for it to be able to activate\n /// @return _days The required bondTime in days\n function bondTime() external view returns (uint256 _days);\n\n /// @notice The amount of time required to pass before a keeper can unbond what he has bonded\n /// @return _days The required unbondTime in days\n function unbondTime() external view returns (uint256 _days);\n\n /// @notice The minimum amount of liquidity required to fund a job per liquidity\n /// @return _amount The minimum amount of liquidity in KP3R\n function liquidityMinimum() external view returns (uint256 _amount);\n\n /// @notice The amount of time between each scheduled credits reward given to a job\n /// @return _days The reward period in days\n function rewardPeriodTime() external view returns (uint256 _days);\n\n /// @notice The inflation period is the denominator used to regulate the emission of KP3R\n /// @return _period The denominator used to regulate the emission of KP3R\n function inflationPeriod() external view returns (uint256 _period);\n\n /// @notice The fee to be sent to governance when a user adds liquidity to a job\n /// @return _amount The fee amount to be sent to governance when a user adds liquidity to a job\n function fee() external view returns (uint256 _amount);\n\n // solhint-disable func-name-mixedcase\n /// @notice The base that will be used to calculate the fee\n /// @return _base The base that will be used to calculate the fee\n function BASE() external view returns (uint256 _base);\n\n /// @notice The minimum rewardPeriodTime value to be set\n /// @return _minPeriod The minimum reward period in seconds\n function MIN_REWARD_PERIOD_TIME() external view returns (uint256 _minPeriod);\n\n // solhint-enable func-name-mixedcase\n\n // Errors\n\n /// @notice Throws if the reward period is less than the minimum reward period time\n error MinRewardPeriod();\n\n /// @notice Throws if either a job or a keeper is disputed\n error Disputed();\n\n /// @notice Throws if there are no bonded assets\n error BondsUnexistent();\n\n /// @notice Throws if the time required to bond an asset has not passed yet\n error BondsLocked();\n\n /// @notice Throws if there are no bonds to withdraw\n error UnbondsUnexistent();\n\n /// @notice Throws if the time required to withdraw the bonds has not passed yet\n error UnbondsLocked();\n\n // Methods\n\n /// @notice Sets the Keep3rHelper address\n /// @param _keep3rHelper The Keep3rHelper address\n function setKeep3rHelper(address _keep3rHelper) external;\n\n /// @notice Sets the Keep3rV1 address\n /// @param _keep3rV1 The Keep3rV1 address\n function setKeep3rV1(address _keep3rV1) external;\n\n /// @notice Sets the Keep3rV1Proxy address\n /// @param _keep3rV1Proxy The Keep3rV1Proxy address\n function setKeep3rV1Proxy(address _keep3rV1Proxy) external;\n\n /// @notice Sets the KP3R-WETH pool address\n /// @param _kp3rWethPool The KP3R-WETH pool address\n function setKp3rWethPool(address _kp3rWethPool) external;\n\n /// @notice Sets the bond time required to activate as a keeper\n /// @param _bond The new bond time\n function setBondTime(uint256 _bond) external;\n\n /// @notice Sets the unbond time required unbond what has been bonded\n /// @param _unbond The new unbond time\n function setUnbondTime(uint256 _unbond) external;\n\n /// @notice Sets the minimum amount of liquidity required to fund a job\n /// @param _liquidityMinimum The new minimum amount of liquidity\n function setLiquidityMinimum(uint256 _liquidityMinimum) external;\n\n /// @notice Sets the time required to pass between rewards for jobs\n /// @param _rewardPeriodTime The new amount of time required to pass between rewards\n function setRewardPeriodTime(uint256 _rewardPeriodTime) external;\n\n /// @notice Sets the new inflation period\n /// @param _inflationPeriod The new inflation period\n function setInflationPeriod(uint256 _inflationPeriod) external;\n\n /// @notice Sets the new fee\n /// @param _fee The new fee\n function setFee(uint256 _fee) external;\n}\n" - }, - "solidity/interfaces/peripherals/IBaseErrors.sol": { - "content": "// SPDX-License-Identifier: MIT\n\npragma solidity >=0.8.4 <0.9.0;\n\ninterface IBaseErrors {\n /// @notice Throws if a variable is assigned to the zero address\n error ZeroAddress();\n}\n" - }, - "solidity/interfaces/peripherals/IKeep3rRoles.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\n/// @title Keep3rRoles contract\n/// @notice Manages the Keep3r specific roles\ninterface IKeep3rRoles {\n // Events\n\n /// @notice Emitted when a slasher is added\n /// @param _slasher Address of the added slasher\n event SlasherAdded(address _slasher);\n\n /// @notice Emitted when a slasher is removed\n /// @param _slasher Address of the removed slasher\n event SlasherRemoved(address _slasher);\n\n /// @notice Emitted when a disputer is added\n /// @param _disputer Address of the added disputer\n event DisputerAdded(address _disputer);\n\n /// @notice Emitted when a disputer is removed\n /// @param _disputer Address of the removed disputer\n event DisputerRemoved(address _disputer);\n\n // Variables\n\n /// @notice Maps an address to a boolean to determine whether the address is a slasher or not.\n /// @return _isSlasher Whether the address is a slasher or not\n function slashers(address _slasher) external view returns (bool _isSlasher);\n\n /// @notice Maps an address to a boolean to determine whether the address is a disputer or not.\n /// @return _isDisputer Whether the address is a disputer or not\n function disputers(address _disputer) external view returns (bool _isDisputer);\n\n // Errors\n\n /// @notice Throws if the address is already a registered slasher\n error SlasherExistent();\n\n /// @notice Throws if caller is not a registered slasher\n error SlasherUnexistent();\n\n /// @notice Throws if the address is already a registered disputer\n error DisputerExistent();\n\n /// @notice Throws if caller is not a registered disputer\n error DisputerUnexistent();\n\n /// @notice Throws if the msg.sender is not a slasher or is not a part of governance\n error OnlySlasher();\n\n /// @notice Throws if the msg.sender is not a disputer or is not a part of governance\n error OnlyDisputer();\n\n // Methods\n\n /// @notice Registers a slasher by updating the slashers mapping\n function addSlasher(address _slasher) external;\n\n /// @notice Removes a slasher by updating the slashers mapping\n function removeSlasher(address _slasher) external;\n\n /// @notice Registers a disputer by updating the disputers mapping\n function addDisputer(address _disputer) external;\n\n /// @notice Removes a disputer by updating the disputers mapping\n function removeDisputer(address _disputer) external;\n}\n" - }, - "solidity/contracts/peripherals/Governable.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../../interfaces/peripherals/IGovernable.sol';\n\nabstract contract Governable is IGovernable {\n /// @inheritdoc IGovernable\n address public override governance;\n\n /// @inheritdoc IGovernable\n address public override pendingGovernance;\n\n constructor(address _governance) {\n if (_governance == address(0)) revert NoGovernanceZeroAddress();\n governance = _governance;\n }\n\n /// @inheritdoc IGovernable\n function setGovernance(address _governance) external override onlyGovernance {\n pendingGovernance = _governance;\n emit GovernanceProposal(_governance);\n }\n\n /// @inheritdoc IGovernable\n function acceptGovernance() external override onlyPendingGovernance {\n governance = pendingGovernance;\n delete pendingGovernance;\n emit GovernanceSet(governance);\n }\n\n /// @notice Functions with this modifier can only be called by governance\n modifier onlyGovernance {\n if (msg.sender != governance) revert OnlyGovernance();\n _;\n }\n\n /// @notice Functions with this modifier can only be called by pendingGovernance\n modifier onlyPendingGovernance {\n if (msg.sender != pendingGovernance) revert OnlyPendingGovernance();\n _;\n }\n}\n" - }, - "solidity/interfaces/peripherals/IGovernable.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\n/// @title Governable contract\n/// @notice Manages the governance role\ninterface IGovernable {\n // Events\n\n /// @notice Emitted when pendingGovernance accepts to be governance\n /// @param _governance Address of the new governance\n event GovernanceSet(address _governance);\n\n /// @notice Emitted when a new governance is proposed\n /// @param _pendingGovernance Address that is proposed to be the new governance\n event GovernanceProposal(address _pendingGovernance);\n\n // Errors\n\n /// @notice Throws if the caller of the function is not governance\n error OnlyGovernance();\n\n /// @notice Throws if the caller of the function is not pendingGovernance\n error OnlyPendingGovernance();\n\n /// @notice Throws if trying to set governance to zero address\n error NoGovernanceZeroAddress();\n\n // Variables\n\n /// @notice Stores the governance address\n /// @return _governance The governance addresss\n function governance() external view returns (address _governance);\n\n /// @notice Stores the pendingGovernance address\n /// @return _pendingGovernance The pendingGovernance addresss\n function pendingGovernance() external view returns (address _pendingGovernance);\n\n // Methods\n\n /// @notice Proposes a new address to be governance\n /// @param _governance The address of the user proposed to be the new governance\n function setGovernance(address _governance) external;\n\n /// @notice Changes the governance from the current governance to the previously proposed address\n function acceptGovernance() external;\n}\n" - }, - "@openzeppelin/contracts/utils/Address.sol": { - "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Collection of functions related to the address type\n */\nlibrary Address {\n /**\n * @dev Returns true if `account` is a contract.\n *\n * [IMPORTANT]\n * ====\n * It is unsafe to assume that an address for which this function returns\n * false is an externally-owned account (EOA) and not a contract.\n *\n * Among others, `isContract` will return false for the following\n * types of addresses:\n *\n * - an externally-owned account\n * - a contract in construction\n * - an address where a contract will be created\n * - an address where a contract lived, but was destroyed\n * ====\n */\n function isContract(address account) internal view returns (bool) {\n // This method relies on extcodesize, which returns 0 for contracts in\n // construction, since the code is only stored at the end of the\n // constructor execution.\n\n uint256 size;\n assembly {\n size := extcodesize(account)\n }\n return size > 0;\n }\n\n /**\n * @dev Replacement for Solidity's `transfer`: sends `amount` wei to\n * `recipient`, forwarding all available gas and reverting on errors.\n *\n * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost\n * of certain opcodes, possibly making contracts go over the 2300 gas limit\n * imposed by `transfer`, making them unable to receive funds via\n * `transfer`. {sendValue} removes this limitation.\n *\n * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].\n *\n * IMPORTANT: because control is transferred to `recipient`, care must be\n * taken to not create reentrancy vulnerabilities. Consider using\n * {ReentrancyGuard} or the\n * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].\n */\n function sendValue(address payable recipient, uint256 amount) internal {\n require(address(this).balance >= amount, \"Address: insufficient balance\");\n\n (bool success, ) = recipient.call{value: amount}(\"\");\n require(success, \"Address: unable to send value, recipient may have reverted\");\n }\n\n /**\n * @dev Performs a Solidity function call using a low level `call`. A\n * plain `call` is an unsafe replacement for a function call: use this\n * function instead.\n *\n * If `target` reverts with a revert reason, it is bubbled up by this\n * function (like regular Solidity function calls).\n *\n * Returns the raw returned data. To convert to the expected return value,\n * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\n *\n * Requirements:\n *\n * - `target` must be a contract.\n * - calling `target` with `data` must not revert.\n *\n * _Available since v3.1._\n */\n function functionCall(address target, bytes memory data) internal returns (bytes memory) {\n return functionCall(target, data, \"Address: low-level call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with\n * `errorMessage` as a fallback revert reason when `target` reverts.\n *\n * _Available since v3.1._\n */\n function functionCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal returns (bytes memory) {\n return functionCallWithValue(target, data, 0, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but also transferring `value` wei to `target`.\n *\n * Requirements:\n *\n * - the calling contract must have an ETH balance of at least `value`.\n * - the called Solidity function must be `payable`.\n *\n * _Available since v3.1._\n */\n function functionCallWithValue(\n address target,\n bytes memory data,\n uint256 value\n ) internal returns (bytes memory) {\n return functionCallWithValue(target, data, value, \"Address: low-level call with value failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but\n * with `errorMessage` as a fallback revert reason when `target` reverts.\n *\n * _Available since v3.1._\n */\n function functionCallWithValue(\n address target,\n bytes memory data,\n uint256 value,\n string memory errorMessage\n ) internal returns (bytes memory) {\n require(address(this).balance >= value, \"Address: insufficient balance for call\");\n require(isContract(target), \"Address: call to non-contract\");\n\n (bool success, bytes memory returndata) = target.call{value: value}(data);\n return verifyCallResult(success, returndata, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but performing a static call.\n *\n * _Available since v3.3._\n */\n function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\n return functionStaticCall(target, data, \"Address: low-level static call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\n * but performing a static call.\n *\n * _Available since v3.3._\n */\n function functionStaticCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal view returns (bytes memory) {\n require(isContract(target), \"Address: static call to non-contract\");\n\n (bool success, bytes memory returndata) = target.staticcall(data);\n return verifyCallResult(success, returndata, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but performing a delegate call.\n *\n * _Available since v3.4._\n */\n function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {\n return functionDelegateCall(target, data, \"Address: low-level delegate call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\n * but performing a delegate call.\n *\n * _Available since v3.4._\n */\n function functionDelegateCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal returns (bytes memory) {\n require(isContract(target), \"Address: delegate call to non-contract\");\n\n (bool success, bytes memory returndata) = target.delegatecall(data);\n return verifyCallResult(success, returndata, errorMessage);\n }\n\n /**\n * @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the\n * revert reason using the provided one.\n *\n * _Available since v4.3._\n */\n function verifyCallResult(\n bool success,\n bytes memory returndata,\n string memory errorMessage\n ) internal pure returns (bytes memory) {\n if (success) {\n return returndata;\n } else {\n // Look for revert reason and bubble it up if present\n if (returndata.length > 0) {\n // The easiest way to bubble the revert reason is using memory via assembly\n\n assembly {\n let returndata_size := mload(returndata)\n revert(add(32, returndata), returndata_size)\n }\n } else {\n revert(errorMessage);\n }\n }\n }\n}\n" - }, - "solidity/interfaces/IPairManager.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.0 <0.9.0;\n\nimport '@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol';\n\n/// @title Pair Manager interface\n/// @notice Generic interface for Keep3r liquidity pools (kLP)\ninterface IPairManager is IERC20Metadata {\n /// @notice Address of the pool from which the Keep3r pair manager will interact with\n /// @return _pool The pool's address\n function pool() external view returns (address _pool);\n\n /// @notice Token0 of the pool\n /// @return _token0 The address of token0\n function token0() external view returns (address _token0);\n\n /// @notice Token1 of the pool\n /// @return _token1 The address of token1\n function token1() external view returns (address _token1);\n}\n" - }, - "solidity/contracts/libraries/FullMath.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\n/// @title Contains 512-bit math functions\n/// @notice Facilitates multiplication and division that can have overflow of an intermediate value without any loss of precision\n/// @dev Handles \"phantom overflow\" i.e., allows multiplication and division where an intermediate value overflows 256 bits\nlibrary FullMath {\n /// @notice Calculates floor(a×b÷denominator) with full precision. Throws if result overflows a uint256 or denominator == 0\n /// @param a The multiplicand\n /// @param b The multiplier\n /// @param denominator The divisor\n /// @return result The 256-bit result\n /// @dev Credit to Remco Bloemen under MIT license https://xn--2-umb.com/21/muldiv\n function mulDiv(\n uint256 a,\n uint256 b,\n uint256 denominator\n ) internal pure returns (uint256 result) {\n unchecked {\n // 512-bit multiply [prod1 prod0] = a * b\n // Compute the product mod 2**256 and mod 2**256 - 1\n // then use the Chinese Remainder Theorem to reconstruct\n // the 512 bit result. The result is stored in two 256\n // variables such that product = prod1 * 2**256 + prod0\n uint256 prod0; // Least significant 256 bits of the product\n uint256 prod1; // Most significant 256 bits of the product\n assembly {\n let mm := mulmod(a, b, not(0))\n prod0 := mul(a, b)\n prod1 := sub(sub(mm, prod0), lt(mm, prod0))\n }\n\n // Handle non-overflow cases, 256 by 256 division\n if (prod1 == 0) {\n require(denominator > 0);\n assembly {\n result := div(prod0, denominator)\n }\n return result;\n }\n\n // Make sure the result is less than 2**256.\n // Also prevents denominator == 0\n require(denominator > prod1);\n\n ///////////////////////////////////////////////\n // 512 by 256 division.\n ///////////////////////////////////////////////\n\n // Make division exact by subtracting the remainder from [prod1 prod0]\n // Compute remainder using mulmod\n uint256 remainder;\n assembly {\n remainder := mulmod(a, b, denominator)\n }\n // Subtract 256 bit number from 512 bit number\n assembly {\n prod1 := sub(prod1, gt(remainder, prod0))\n prod0 := sub(prod0, remainder)\n }\n\n // Factor powers of two out of denominator\n // Compute largest power of two divisor of denominator.\n // Always >= 1.\n uint256 twos = (~denominator + 1) & denominator;\n // Divide denominator by power of two\n assembly {\n denominator := div(denominator, twos)\n }\n\n // Divide [prod1 prod0] by the factors of two\n assembly {\n prod0 := div(prod0, twos)\n }\n // Shift in bits from prod1 into prod0. For this we need\n // to flip `twos` such that it is 2**256 / twos.\n // If twos is zero, then it becomes one\n assembly {\n twos := add(div(sub(0, twos), twos), 1)\n }\n prod0 |= prod1 * twos;\n\n // Invert denominator mod 2**256\n // Now that denominator is an odd number, it has an inverse\n // modulo 2**256 such that denominator * inv = 1 mod 2**256.\n // Compute the inverse by starting with a seed that is correct\n // correct for four bits. That is, denominator * inv = 1 mod 2**4\n uint256 inv = (3 * denominator) ^ 2;\n // Now use Newton-Raphson iteration to improve the precision.\n // Thanks to Hensel's lifting lemma, this also works in modular\n // arithmetic, doubling the correct bits in each step.\n inv *= 2 - denominator * inv; // inverse mod 2**8\n inv *= 2 - denominator * inv; // inverse mod 2**16\n inv *= 2 - denominator * inv; // inverse mod 2**32\n inv *= 2 - denominator * inv; // inverse mod 2**64\n inv *= 2 - denominator * inv; // inverse mod 2**128\n inv *= 2 - denominator * inv; // inverse mod 2**256\n\n // Because the division is now exact we can divide by multiplying\n // with the modular inverse of denominator. This will give us the\n // correct result modulo 2**256. Since the precoditions guarantee\n // that the outcome is less than 2**256, this is the final result.\n // We don't need to compute the high bits of the result and prod1\n // is no longer required.\n result = prod0 * inv;\n return result;\n }\n }\n\n /// @notice Calculates ceil(a×b÷denominator) with full precision. Throws if result overflows a uint256 or denominator == 0\n /// @param a The multiplicand\n /// @param b The multiplier\n /// @param denominator The divisor\n /// @return result The 256-bit result\n function mulDivRoundingUp(\n uint256 a,\n uint256 b,\n uint256 denominator\n ) internal pure returns (uint256 result) {\n unchecked {\n result = mulDiv(a, b, denominator);\n if (mulmod(a, b, denominator) > 0) {\n require(result < type(uint256).max);\n result++;\n }\n }\n }\n}\n" - }, - "@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol": { - "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\nimport \"../IERC20.sol\";\n\n/**\n * @dev Interface for the optional metadata functions from the ERC20 standard.\n *\n * _Available since v4.1._\n */\ninterface IERC20Metadata is IERC20 {\n /**\n * @dev Returns the name of the token.\n */\n function name() external view returns (string memory);\n\n /**\n * @dev Returns the symbol of the token.\n */\n function symbol() external view returns (string memory);\n\n /**\n * @dev Returns the decimals places of the token.\n */\n function decimals() external view returns (uint8);\n}\n" - }, - "solidity/interfaces/peripherals/IKeep3rDisputable.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\n/// @title Keep3rDisputable contract\n/// @notice Creates/resolves disputes for jobs or keepers\n/// A disputed keeper is slashable and is not able to bond, activate, withdraw or receive direct payments\n/// A disputed job is slashable and is not able to pay the keepers, withdraw tokens or to migrate\ninterface IKeep3rDisputable {\n /// @notice Emitted when a keeper or a job is disputed\n /// @param _jobOrKeeper The address of the disputed keeper/job\n /// @param _disputer The user that called the function and disputed the keeper\n event Dispute(address indexed _jobOrKeeper, address indexed _disputer);\n\n /// @notice Emitted when a dispute is resolved\n /// @param _jobOrKeeper The address of the disputed keeper/job\n /// @param _resolver The user that called the function and resolved the dispute\n event Resolve(address indexed _jobOrKeeper, address indexed _resolver);\n\n /// @notice Throws when a job or keeper is already disputed\n error AlreadyDisputed();\n\n /// @notice Throws when a job or keeper is not disputed and someone tries to resolve the dispute\n error NotDisputed();\n\n /// @notice Allows governance to create a dispute for a given keeper/job\n /// @param _jobOrKeeper The address in dispute\n function dispute(address _jobOrKeeper) external;\n\n /// @notice Allows governance to resolve a dispute on a keeper/job\n /// @param _jobOrKeeper The address cleared\n function resolve(address _jobOrKeeper) external;\n}\n" - }, - "solidity/contracts/peripherals/jobs/Keep3rJobMigration.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../../../interfaces/peripherals/IKeep3rJobs.sol';\nimport './Keep3rJobFundableCredits.sol';\nimport './Keep3rJobFundableLiquidity.sol';\n\nabstract contract Keep3rJobMigration is IKeep3rJobMigration, Keep3rJobFundableCredits, Keep3rJobFundableLiquidity {\n using EnumerableSet for EnumerableSet.AddressSet;\n\n uint256 internal constant _MIGRATION_COOLDOWN = 1 minutes;\n\n /// @inheritdoc IKeep3rJobMigration\n mapping(address => address) public override pendingJobMigrations;\n mapping(address => mapping(address => uint256)) internal _migrationCreatedAt;\n\n /// @inheritdoc IKeep3rJobMigration\n function migrateJob(address _fromJob, address _toJob) external override onlyJobOwner(_fromJob) {\n if (_fromJob == _toJob) revert JobMigrationImpossible();\n\n pendingJobMigrations[_fromJob] = _toJob;\n _migrationCreatedAt[_fromJob][_toJob] = block.timestamp;\n\n emit JobMigrationRequested(_fromJob, _toJob);\n }\n\n /// @inheritdoc IKeep3rJobMigration\n function acceptJobMigration(address _fromJob, address _toJob) external override onlyJobOwner(_toJob) {\n if (disputes[_fromJob] || disputes[_toJob]) revert JobDisputed();\n if (pendingJobMigrations[_fromJob] != _toJob) revert JobMigrationUnavailable();\n if (block.timestamp < _migrationCreatedAt[_fromJob][_toJob] + _MIGRATION_COOLDOWN) revert JobMigrationLocked();\n\n // force job credits update for both jobs\n _settleJobAccountance(_fromJob);\n _settleJobAccountance(_toJob);\n\n // migrate tokens\n while (_jobTokens[_fromJob].length() > 0) {\n address _tokenToMigrate = _jobTokens[_fromJob].at(0);\n jobTokenCredits[_toJob][_tokenToMigrate] += jobTokenCredits[_fromJob][_tokenToMigrate];\n jobTokenCredits[_fromJob][_tokenToMigrate] = 0;\n _jobTokens[_fromJob].remove(_tokenToMigrate);\n _jobTokens[_toJob].add(_tokenToMigrate);\n }\n\n // migrate liquidities\n while (_jobLiquidities[_fromJob].length() > 0) {\n address _liquidity = _jobLiquidities[_fromJob].at(0);\n\n liquidityAmount[_toJob][_liquidity] += liquidityAmount[_fromJob][_liquidity];\n delete liquidityAmount[_fromJob][_liquidity];\n\n _jobLiquidities[_toJob].add(_liquidity);\n _jobLiquidities[_fromJob].remove(_liquidity);\n }\n\n // migrate job balances\n _jobPeriodCredits[_toJob] += _jobPeriodCredits[_fromJob];\n delete _jobPeriodCredits[_fromJob];\n\n _jobLiquidityCredits[_toJob] += _jobLiquidityCredits[_fromJob];\n delete _jobLiquidityCredits[_fromJob];\n\n // stop _fromJob from being a job\n delete rewardedAt[_fromJob];\n _jobs.remove(_fromJob);\n\n // delete unused data slots\n delete jobOwner[_fromJob];\n delete jobPendingOwner[_fromJob];\n delete _migrationCreatedAt[_fromJob][_toJob];\n delete pendingJobMigrations[_fromJob];\n\n emit JobMigrationSuccessful(_fromJob, _toJob);\n }\n}\n" - }, - "solidity/contracts/peripherals/keepers/Keep3rKeeperDisputable.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport './Keep3rKeeperFundable.sol';\nimport '../Keep3rDisputable.sol';\nimport '../../../interfaces/external/IKeep3rV1.sol';\nimport '../../../interfaces/peripherals/IKeep3rKeepers.sol';\n\nabstract contract Keep3rKeeperDisputable is IKeep3rKeeperDisputable, Keep3rDisputable, Keep3rKeeperFundable {\n using EnumerableSet for EnumerableSet.AddressSet;\n using SafeERC20 for IERC20;\n\n /// @inheritdoc IKeep3rKeeperDisputable\n function slash(\n address _keeper,\n address _bonded,\n uint256 _amount\n ) public override onlySlasher {\n if (!disputes[_keeper]) revert NotDisputed();\n _slash(_keeper, _bonded, _amount);\n emit KeeperSlash(_keeper, msg.sender, _amount);\n }\n\n /// @inheritdoc IKeep3rKeeperDisputable\n function revoke(address _keeper) external override onlySlasher {\n if (!disputes[_keeper]) revert NotDisputed();\n _keepers.remove(_keeper);\n _slash(_keeper, keep3rV1, bonds[_keeper][keep3rV1]);\n emit KeeperRevoke(_keeper, msg.sender);\n }\n\n function _slash(\n address _keeper,\n address _bonded,\n uint256 _amount\n ) internal {\n if (_bonded != keep3rV1) {\n try IERC20(_bonded).transfer(governance, _amount) returns (bool) {} catch (bytes memory) {}\n }\n bonds[_keeper][_bonded] -= _amount;\n }\n}\n" - }, - "solidity/contracts/peripherals/keepers/Keep3rKeeperFundable.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../Keep3rAccountance.sol';\nimport '../Keep3rParameters.sol';\nimport '../../../interfaces/peripherals/IKeep3rKeepers.sol';\n\nimport '../../../interfaces/external/IKeep3rV1.sol';\nimport '../../../interfaces/external/IKeep3rV1Proxy.sol';\n\nimport '@openzeppelin/contracts/security/ReentrancyGuard.sol';\nimport '@openzeppelin/contracts/token/ERC20/IERC20.sol';\nimport '@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol';\n\nabstract contract Keep3rKeeperFundable is IKeep3rKeeperFundable, ReentrancyGuard, Keep3rParameters {\n using EnumerableSet for EnumerableSet.AddressSet;\n using SafeERC20 for IERC20;\n\n /// @inheritdoc IKeep3rKeeperFundable\n function bond(address _bonding, uint256 _amount) external override nonReentrant {\n if (disputes[msg.sender]) revert Disputed();\n if (_jobs.contains(msg.sender)) revert AlreadyAJob();\n canActivateAfter[msg.sender][_bonding] = block.timestamp + bondTime;\n\n uint256 _before = IERC20(_bonding).balanceOf(address(this));\n IERC20(_bonding).safeTransferFrom(msg.sender, address(this), _amount);\n _amount = IERC20(_bonding).balanceOf(address(this)) - _before;\n\n hasBonded[msg.sender] = true;\n pendingBonds[msg.sender][_bonding] += _amount;\n\n emit Bonding(msg.sender, _bonding, _amount);\n }\n\n /// @inheritdoc IKeep3rKeeperFundable\n function activate(address _bonding) external override {\n if (disputes[msg.sender]) revert Disputed();\n if (canActivateAfter[msg.sender][_bonding] == 0) revert BondsUnexistent();\n if (canActivateAfter[msg.sender][_bonding] >= block.timestamp) revert BondsLocked();\n\n _activate(msg.sender, _bonding);\n }\n\n /// @inheritdoc IKeep3rKeeperFundable\n function unbond(address _bonding, uint256 _amount) external override {\n canWithdrawAfter[msg.sender][_bonding] = block.timestamp + unbondTime;\n bonds[msg.sender][_bonding] -= _amount;\n pendingUnbonds[msg.sender][_bonding] += _amount;\n\n emit Unbonding(msg.sender, _bonding, _amount);\n }\n\n /// @inheritdoc IKeep3rKeeperFundable\n function withdraw(address _bonding) external override nonReentrant {\n if (canWithdrawAfter[msg.sender][_bonding] == 0) revert UnbondsUnexistent();\n if (canWithdrawAfter[msg.sender][_bonding] >= block.timestamp) revert UnbondsLocked();\n if (disputes[msg.sender]) revert Disputed();\n\n uint256 _amount = pendingUnbonds[msg.sender][_bonding];\n\n if (_bonding == keep3rV1) {\n IKeep3rV1Proxy(keep3rV1Proxy).mint(_amount);\n }\n\n pendingUnbonds[msg.sender][_bonding] = 0;\n IERC20(_bonding).safeTransfer(msg.sender, _amount);\n\n emit Withdrawal(msg.sender, _bonding, _amount);\n }\n\n function _bond(\n address _bonding,\n address _from,\n uint256 _amount\n ) internal {\n bonds[_from][_bonding] += _amount;\n if (_bonding == keep3rV1) {\n IKeep3rV1(keep3rV1).burn(_amount);\n }\n }\n\n function _activate(address _keeper, address _bonding) internal {\n if (firstSeen[_keeper] == 0) {\n firstSeen[_keeper] = block.timestamp;\n }\n _keepers.add(_keeper);\n uint256 _amount = pendingBonds[_keeper][_bonding];\n pendingBonds[_keeper][_bonding] = 0;\n _bond(_bonding, _keeper, _amount);\n\n emit Activation(_keeper, _bonding, _amount);\n }\n}\n" - }, - "solidity/interfaces/external/IKeep3rV1.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.0 <0.9.0;\n\nimport '@openzeppelin/contracts/token/ERC20/IERC20.sol';\nimport '@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol';\n\n// solhint-disable func-name-mixedcase\ninterface IKeep3rV1 is IERC20, IERC20Metadata {\n // Structs\n struct Checkpoint {\n uint32 fromBlock;\n uint256 votes;\n }\n\n // Events\n event DelegateChanged(address indexed _delegator, address indexed _fromDelegate, address indexed _toDelegate);\n event DelegateVotesChanged(address indexed _delegate, uint256 _previousBalance, uint256 _newBalance);\n event SubmitJob(address indexed _job, address indexed _liquidity, address indexed _provider, uint256 _block, uint256 _credit);\n event ApplyCredit(address indexed _job, address indexed _liquidity, address indexed _provider, uint256 _block, uint256 _credit);\n event RemoveJob(address indexed _job, address indexed _liquidity, address indexed _provider, uint256 _block, uint256 _credit);\n event UnbondJob(address indexed _job, address indexed _liquidity, address indexed _provider, uint256 _block, uint256 _credit);\n event JobAdded(address indexed _job, uint256 _block, address _governance);\n event JobRemoved(address indexed _job, uint256 _block, address _governance);\n event KeeperWorked(address indexed _credit, address indexed _job, address indexed _keeper, uint256 _block, uint256 _amount);\n event KeeperBonding(address indexed _keeper, uint256 _block, uint256 _active, uint256 _bond);\n event KeeperBonded(address indexed _keeper, uint256 _block, uint256 _activated, uint256 _bond);\n event KeeperUnbonding(address indexed _keeper, uint256 _block, uint256 _deactive, uint256 _bond);\n event KeeperUnbound(address indexed _keeper, uint256 _block, uint256 _deactivated, uint256 _bond);\n event KeeperSlashed(address indexed _keeper, address indexed _slasher, uint256 _block, uint256 _slash);\n event KeeperDispute(address indexed _keeper, uint256 _block);\n event KeeperResolved(address indexed _keeper, uint256 _block);\n event TokenCreditAddition(address indexed _credit, address indexed _job, address indexed _creditor, uint256 _block, uint256 _amount);\n\n // Variables\n function KPRH() external returns (address);\n\n function delegates(address _delegator) external view returns (address);\n\n function checkpoints(address _account, uint32 _checkpoint) external view returns (Checkpoint memory);\n\n function numCheckpoints(address _account) external view returns (uint32);\n\n function DOMAIN_TYPEHASH() external returns (bytes32);\n\n function DOMAINSEPARATOR() external returns (bytes32);\n\n function DELEGATION_TYPEHASH() external returns (bytes32);\n\n function PERMIT_TYPEHASH() external returns (bytes32);\n\n function nonces(address _user) external view returns (uint256);\n\n function BOND() external returns (uint256);\n\n function UNBOND() external returns (uint256);\n\n function LIQUIDITYBOND() external returns (uint256);\n\n function FEE() external returns (uint256);\n\n function BASE() external returns (uint256);\n\n function ETH() external returns (address);\n\n function bondings(address _user, address _bonding) external view returns (uint256);\n\n function canWithdrawAfter(address _user, address _bonding) external view returns (uint256);\n\n function pendingUnbonds(address _keeper, address _bonding) external view returns (uint256);\n\n function pendingbonds(address _keeper, address _bonding) external view returns (uint256);\n\n function bonds(address _keeper, address _bonding) external view returns (uint256);\n\n function votes(address _delegator) external view returns (uint256);\n\n function firstSeen(address _keeper) external view returns (uint256);\n\n function disputes(address _keeper) external view returns (bool);\n\n function lastJob(address _keeper) external view returns (uint256);\n\n function workCompleted(address _keeper) external view returns (uint256);\n\n function jobs(address _job) external view returns (bool);\n\n function credits(address _job, address _credit) external view returns (uint256);\n\n function liquidityProvided(\n address _provider,\n address _liquidity,\n address _job\n ) external view returns (uint256);\n\n function liquidityUnbonding(\n address _provider,\n address _liquidity,\n address _job\n ) external view returns (uint256);\n\n function liquidityAmountsUnbonding(\n address _provider,\n address _liquidity,\n address _job\n ) external view returns (uint256);\n\n function jobProposalDelay(address _job) external view returns (uint256);\n\n function liquidityApplied(\n address _provider,\n address _liquidity,\n address _job\n ) external view returns (uint256);\n\n function liquidityAmount(\n address _provider,\n address _liquidity,\n address _job\n ) external view returns (uint256);\n\n function keepers(address _keeper) external view returns (bool);\n\n function blacklist(address _keeper) external view returns (bool);\n\n function keeperList(uint256 _index) external view returns (address);\n\n function jobList(uint256 _index) external view returns (address);\n\n function governance() external returns (address);\n\n function pendingGovernance() external returns (address);\n\n function liquidityAccepted(address _liquidity) external view returns (bool);\n\n function liquidityPairs(uint256 _index) external view returns (address);\n\n // Methods\n function getCurrentVotes(address _account) external view returns (uint256);\n\n function addCreditETH(address _job) external payable;\n\n function addCredit(\n address _credit,\n address _job,\n uint256 _amount\n ) external;\n\n function addVotes(address _voter, uint256 _amount) external;\n\n function removeVotes(address _voter, uint256 _amount) external;\n\n function addKPRCredit(address _job, uint256 _amount) external;\n\n function approveLiquidity(address _liquidity) external;\n\n function revokeLiquidity(address _liquidity) external;\n\n function pairs() external view returns (address[] memory);\n\n function addLiquidityToJob(\n address _liquidity,\n address _job,\n uint256 _amount\n ) external;\n\n function applyCreditToJob(\n address _provider,\n address _liquidity,\n address _job\n ) external;\n\n function unbondLiquidityFromJob(\n address _liquidity,\n address _job,\n uint256 _amount\n ) external;\n\n function removeLiquidityFromJob(address _liquidity, address _job) external;\n\n function mint(uint256 _amount) external;\n\n function burn(uint256 _amount) external;\n\n function worked(address _keeper) external;\n\n function receipt(\n address _credit,\n address _keeper,\n uint256 _amount\n ) external;\n\n function receiptETH(address _keeper, uint256 _amount) external;\n\n function addJob(address _job) external;\n\n function getJobs() external view returns (address[] memory);\n\n function removeJob(address _job) external;\n\n function setKeep3rHelper(address _keep3rHelper) external;\n\n function setGovernance(address _governance) external;\n\n function acceptGovernance() external;\n\n function isKeeper(address _keeper) external returns (bool);\n\n function isMinKeeper(\n address _keeper,\n uint256 _minBond,\n uint256 _earned,\n uint256 _age\n ) external returns (bool);\n\n function isBondedKeeper(\n address _keeper,\n address _bond,\n uint256 _minBond,\n uint256 _earned,\n uint256 _age\n ) external returns (bool);\n\n function bond(address _bonding, uint256 _amount) external;\n\n function getKeepers() external view returns (address[] memory);\n\n function activate(address _bonding) external;\n\n function unbond(address _bonding, uint256 _amount) external;\n\n function slash(\n address _bonded,\n address _keeper,\n uint256 _amount\n ) external;\n\n function withdraw(address _bonding) external;\n\n function dispute(address _keeper) external;\n\n function revoke(address _keeper) external;\n\n function resolve(address _keeper) external;\n\n function permit(\n address _owner,\n address _spender,\n uint256 _amount,\n uint256 _deadline,\n uint8 _v,\n bytes32 _r,\n bytes32 _s\n ) external;\n}\n" - }, - "solidity/interfaces/peripherals/IKeep3rKeepers.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\n/// @title Keep3rKeeperFundable contract\n/// @notice Handles the actions required to become a keeper\ninterface IKeep3rKeeperFundable {\n // Events\n\n /// @notice Emitted when Keep3rKeeperFundable#activate is called\n /// @param _keeper The keeper that has been activated\n /// @param _bond The asset the keeper has bonded\n /// @param _amount The amount of the asset the keeper has bonded\n event Activation(address indexed _keeper, address indexed _bond, uint256 _amount);\n\n /// @notice Emitted when Keep3rKeeperFundable#withdraw is called\n /// @param _keeper The caller of Keep3rKeeperFundable#withdraw function\n /// @param _bond The asset to withdraw from the bonding pool\n /// @param _amount The amount of funds withdrawn\n event Withdrawal(address indexed _keeper, address indexed _bond, uint256 _amount);\n\n // Errors\n\n /// @notice Throws when the address that is trying to register as a job is already a job\n error AlreadyAJob();\n\n // Methods\n\n /// @notice Beginning of the bonding process\n /// @param _bonding The asset being bound\n /// @param _amount The amount of bonding asset being bound\n function bond(address _bonding, uint256 _amount) external;\n\n /// @notice Beginning of the unbonding process\n /// @param _bonding The asset being unbound\n /// @param _amount Allows for partial unbonding\n function unbond(address _bonding, uint256 _amount) external;\n\n /// @notice End of the bonding process after bonding time has passed\n /// @param _bonding The asset being activated as bond collateral\n function activate(address _bonding) external;\n\n /// @notice Withdraw funds after unbonding has finished\n /// @param _bonding The asset to withdraw from the bonding pool\n function withdraw(address _bonding) external;\n}\n\n/// @title Keep3rKeeperDisputable contract\n/// @notice Handles the actions that can be taken on a disputed keeper\ninterface IKeep3rKeeperDisputable {\n // Events\n\n /// @notice Emitted when Keep3rKeeperDisputable#slash is called\n /// @param _keeper The slashed keeper\n /// @param _slasher The user that called Keep3rKeeperDisputable#slash\n /// @param _amount The amount of credits slashed from the keeper\n event KeeperSlash(address indexed _keeper, address indexed _slasher, uint256 _amount);\n\n /// @notice Emitted when Keep3rKeeperDisputable#revoke is called\n /// @param _keeper The revoked keeper\n /// @param _slasher The user that called Keep3rKeeperDisputable#revoke\n event KeeperRevoke(address indexed _keeper, address indexed _slasher);\n\n /// @notice Keeper revoked\n\n // Methods\n\n /// @notice Allows governance to slash a keeper based on a dispute\n /// @param _keeper The address being slashed\n /// @param _bonded The asset being slashed\n /// @param _amount The amount being slashed\n function slash(\n address _keeper,\n address _bonded,\n uint256 _amount\n ) external;\n\n /// @notice Blacklists a keeper from participating in the network\n /// @param _keeper The address being slashed\n function revoke(address _keeper) external;\n}\n\n// solhint-disable-next-line no-empty-blocks\n\n/// @title Keep3rKeepers contract\ninterface IKeep3rKeepers is IKeep3rKeeperDisputable {\n\n}\n" - }, - "solidity/interfaces/external/IKeep3rV1Proxy.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../peripherals/IGovernable.sol';\n\ninterface IKeep3rV1Proxy is IGovernable {\n // Structs\n struct Recipient {\n address recipient;\n uint256 caps;\n }\n\n // Variables\n function keep3rV1() external view returns (address);\n\n function minter() external view returns (address);\n\n function next(address) external view returns (uint256);\n\n function caps(address) external view returns (uint256);\n\n function recipients() external view returns (address[] memory);\n\n function recipientsCaps() external view returns (Recipient[] memory);\n\n // Errors\n error Cooldown();\n error NoDrawableAmount();\n error ZeroAddress();\n error OnlyMinter();\n\n // Methods\n function addRecipient(address recipient, uint256 amount) external;\n\n function removeRecipient(address recipient) external;\n\n function draw() external returns (uint256 _amount);\n\n function setKeep3rV1(address _keep3rV1) external;\n\n function setMinter(address _minter) external;\n\n function mint(uint256 _amount) external;\n\n function mint(address _account, uint256 _amount) external;\n\n function setKeep3rV1Governance(address _governance) external;\n\n function acceptKeep3rV1Governance() external;\n\n function dispute(address _keeper) external;\n\n function slash(\n address _bonded,\n address _keeper,\n uint256 _amount\n ) external;\n\n function revoke(address _keeper) external;\n\n function resolve(address _keeper) external;\n\n function addJob(address _job) external;\n\n function removeJob(address _job) external;\n\n function addKPRCredit(address _job, uint256 _amount) external;\n\n function approveLiquidity(address _liquidity) external;\n\n function revokeLiquidity(address _liquidity) external;\n\n function setKeep3rHelper(address _keep3rHelper) external;\n\n function addVotes(address _voter, uint256 _amount) external;\n\n function removeVotes(address _voter, uint256 _amount) external;\n}\n" - }, - "solidity/interfaces/peripherals/IDustCollector.sol": { - "content": "// SPDX-License-Identifier: MIT\n\npragma solidity >=0.8.4 <0.9.0;\n\nimport './IBaseErrors.sol';\n\ninterface IDustCollector is IBaseErrors {\n /// @notice Emitted when dust is sent\n /// @param _to The address which wil received the funds\n /// @param _token The token that will be transferred\n /// @param _amount The amount of the token that will be transferred\n event DustSent(address _token, uint256 _amount, address _to);\n\n /// @notice Allows an authorized user to transfer the tokens or eth that may have been left in a contract\n /// @param _token The token that will be transferred\n /// @param _amount The amont of the token that will be transferred\n /// @param _to The address that will receive the idle funds\n function sendDust(\n address _token,\n uint256 _amount,\n address _to\n ) external;\n}\n" - }, - "solidity/for-test/Keep3rForTest.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../contracts/Keep3r.sol';\n\ncontract Keep3rForTest is Keep3r {\n constructor(\n address _governance,\n address _keep3rHelper,\n address _keep3rV1,\n address _keep3rV1Proxy,\n address _kp3rWethPool\n ) Keep3r(_governance, _keep3rHelper, _keep3rV1, _keep3rV1Proxy, _kp3rWethPool) {}\n\n function viewTickOrder(address _liquidity) external view returns (bool) {\n return _isKP3RToken0[_liquidity];\n }\n}\n" - }, - "solidity/for-test/peripherals/DustCollectorForTest.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../../contracts/peripherals/DustCollector.sol';\n\ncontract DustCollectorForTest is DustCollector {\n constructor() DustCollector() Governable(msg.sender) {}\n}\n" - }, - "solidity/interfaces/IKeep3r.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport './peripherals/IKeep3rJobs.sol';\nimport './peripherals/IKeep3rKeepers.sol';\nimport './peripherals/IKeep3rAccountance.sol';\nimport './peripherals/IKeep3rRoles.sol';\nimport './peripherals/IKeep3rParameters.sol';\n\n// solhint-disable-next-line no-empty-blocks\n\n/// @title Keep3rV2 contract\n/// @notice This contract inherits all the functionality of Keep3rV2\ninterface IKeep3r is IKeep3rJobs, IKeep3rKeepers, IKeep3rAccountance, IKeep3rRoles, IKeep3rParameters {\n\n}\n" - }, - "solidity/for-test/JobForTest.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.0 <0.9.0;\n\nimport '../interfaces/IKeep3r.sol';\n\ncontract JobForTest {\n error InvalidKeeper();\n address public keep3r;\n uint256 public nonce;\n\n constructor(address _keep3r) {\n keep3r = _keep3r;\n }\n\n function work() external {\n if (!IKeep3r(keep3r).isKeeper(msg.sender)) revert InvalidKeeper();\n\n for (uint256 i = 0; i < 1000; i++) {\n nonce++;\n }\n\n IKeep3r(keep3r).worked(msg.sender);\n }\n\n function workHard(uint256 _factor) external {\n if (!IKeep3r(keep3r).isKeeper(msg.sender)) revert InvalidKeeper();\n\n for (uint256 i = 0; i < 1000 * _factor; i++) {\n nonce++;\n }\n\n IKeep3r(keep3r).worked(msg.sender);\n }\n}\n" - }, - "solidity/for-test/peripherals/jobs/Keep3rJobManagerForTest.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../../../contracts/peripherals/jobs/Keep3rJobManager.sol';\n\ncontract Keep3rJobManagerForTest is Keep3rJobManager {\n using EnumerableSet for EnumerableSet.AddressSet;\n\n constructor(\n address _keep3rHelper,\n address _keep3rV1,\n address _keep3rV1Proxy,\n address _kp3rWethPool\n ) Keep3rParameters(_keep3rHelper, _keep3rV1, _keep3rV1Proxy, _kp3rWethPool) Keep3rRoles(msg.sender) {}\n\n function isJob(address _job) external view returns (bool _isJob) {\n _isJob = _jobs.contains(_job);\n }\n}\n" - }, - "solidity/for-test/peripherals/jobs/Keep3rJobMigrationForTest.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../../../contracts/peripherals/jobs/Keep3rJobMigration.sol';\n\ncontract Keep3rJobMigrationForTest is Keep3rJobMigration {\n using EnumerableSet for EnumerableSet.AddressSet;\n\n mapping(address => uint256) public settleJobAccountanceCallCount;\n\n constructor(\n address _kph,\n address _keep3rV1,\n address _keep3rV1Proxy,\n address _kp3rWethPool\n ) Keep3rParameters(_kph, _keep3rV1, _keep3rV1Proxy, _kp3rWethPool) Keep3rRoles(msg.sender) {}\n\n function setJobToken(address _job, address _token) external {\n _jobTokens[_job].add(_token);\n }\n\n function setJobLiquidity(address _job, address _liquidity) external {\n _jobLiquidities[_job].add(_liquidity);\n }\n\n function viewJobTokenListLength(address _job) external view returns (uint256) {\n return _jobTokens[_job].length();\n }\n\n function viewJobLiquidityList(address _job) external view returns (address[] memory _list) {\n _list = _jobLiquidities[_job].values();\n }\n\n function viewJobPeriodCredits(address _job) external view returns (uint256) {\n return _jobPeriodCredits[_job];\n }\n\n function viewJobLiquidityCredits(address _job) external view returns (uint256) {\n return _jobLiquidityCredits[_job];\n }\n\n function viewMigrationCreatedAt(address _fromJob, address _toJob) external view returns (uint256) {\n return _migrationCreatedAt[_fromJob][_toJob];\n }\n\n function isJob(address _job) external view returns (bool) {\n return _jobs.contains(_job);\n }\n\n function _settleJobAccountance(address _job) internal override {\n settleJobAccountanceCallCount[_job]++;\n }\n}\n" - }, - "solidity/for-test/peripherals/jobs/Keep3rJobFundableLiquidityForTest.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../../../contracts/peripherals/jobs/Keep3rJobFundableLiquidity.sol';\n\ncontract Keep3rJobFundableLiquidityForTest is Keep3rJobFundableLiquidity {\n using EnumerableSet for EnumerableSet.AddressSet;\n\n constructor(\n address _kph,\n address _keep3rV1,\n address _keep3rV1Proxy,\n address _kp3rWethPool\n ) Keep3rParameters(_kph, _keep3rV1, _keep3rV1Proxy, _kp3rWethPool) Keep3rRoles(msg.sender) {}\n\n function setJob(address _job) external {\n _jobs.add(_job);\n }\n\n function setJobLiquidity(address _job, address _liquidity) external returns (bool) {\n return _jobLiquidities[_job].add(_liquidity);\n }\n\n function setApprovedLiquidity(address _liquidity) external {\n _approvedLiquidities.add(_liquidity);\n }\n\n function setRevokedLiquidity(address _liquidity) external {\n _approvedLiquidities.remove(_liquidity);\n }\n\n function viewTickCache(address _liquidity) external view returns (TickCache memory _tickCache) {\n _tickCache = _tick[_liquidity];\n }\n\n function viewTickOrder(address _liquidity) external view returns (bool) {\n return _isKP3RToken0[_liquidity];\n }\n\n function internalJobLiquidities(address _job) external view returns (address[] memory _list) {\n _list = _jobLiquidities[_job].values();\n }\n\n function internalSettleJobAccountance(address _job) external {\n _settleJobAccountance(_job);\n }\n}\n" - }, - "solidity/contracts/Keep3rHelper.sol": { - "content": "// SPDX-License-Identifier: MIT\n\n/*\n\nCoded for The Keep3r Network with ♥ by\n\n██████╗░███████╗███████╗██╗  ░██╗░░░░░░░██╗░█████╗░███╗░░██╗██████╗░███████╗██████╗░██╗░░░░░░█████╗░███╗░░██╗██████╗░\n██╔══██╗██╔════╝██╔════╝██║  ░██║░░██╗░░██║██╔══██╗████╗░██║██╔══██╗██╔════╝██╔══██╗██║░░░░░██╔══██╗████╗░██║██╔══██╗\n██║░░██║█████╗░░█████╗░░██║  ░╚██╗████╗██╔╝██║░░██║██╔██╗██║██║░░██║█████╗░░██████╔╝██║░░░░░███████║██╔██╗██║██║░░██║\n██║░░██║██╔══╝░░██╔══╝░░██║  ░░████╔═████║░██║░░██║██║╚████║██║░░██║██╔══╝░░██╔══██╗██║░░░░░██╔══██║██║╚████║██║░░██║\n██████╔╝███████╗██║░░░░░██║  ░░╚██╔╝░╚██╔╝░╚█████╔╝██║░╚███║██████╔╝███████╗██║░░██║███████╗██║░░██║██║░╚███║██████╔╝\n╚═════╝░╚══════╝╚═╝░░░░░╚═╝  ░░░╚═╝░░░╚═╝░░░╚════╝░╚═╝░░╚══╝╚═════╝░╚══════╝╚═╝░░╚═╝╚══════╝╚═╝░░╚═╝╚═╝░░╚══╝╚═════╝░\n\nhttps://defi.sucks\n\n*/\n\npragma solidity >=0.8.7 <0.9.0;\n\nimport './libraries/FullMath.sol';\nimport './libraries/TickMath.sol';\nimport '../interfaces/IKeep3r.sol';\nimport '../interfaces/external/IKeep3rV1.sol';\nimport '../interfaces/IKeep3rHelper.sol';\n\nimport '@openzeppelin/contracts/utils/math/Math.sol';\nimport '@uniswap/v3-core/contracts/interfaces/IUniswapV3Pool.sol';\n\ncontract Keep3rHelper is IKeep3rHelper {\n address public immutable keep3rV2;\n\n constructor(address _keep3rV2) {\n keep3rV2 = _keep3rV2;\n }\n\n /// @inheritdoc IKeep3rHelper\n address public constant override KP3R = 0x1cEB5cB57C4D4E2b2433641b95Dd330A33185A44;\n\n /// @inheritdoc IKeep3rHelper\n address public constant override KP3R_WETH_POOL = 0x11B7a6bc0259ed6Cf9DB8F499988F9eCc7167bf5;\n\n /// @inheritdoc IKeep3rHelper\n uint256 public constant override MIN = 11_000;\n\n /// @inheritdoc IKeep3rHelper\n uint256 public constant override MAX = 12_000;\n\n /// @inheritdoc IKeep3rHelper\n uint256 public constant override BOOST_BASE = 10_000;\n\n /// @inheritdoc IKeep3rHelper\n uint256 public constant override TARGETBOND = 200 ether;\n\n /// @inheritdoc IKeep3rHelper\n function quote(uint256 _eth) public view override returns (uint256 _amountOut) {\n bool _isKP3RToken0 = isKP3RToken0(KP3R_WETH_POOL);\n int56 _tickDifference = IKeep3r(keep3rV2).observeLiquidity(KP3R_WETH_POOL).difference;\n _tickDifference = _isKP3RToken0 ? _tickDifference : -_tickDifference;\n uint256 _tickInterval = IKeep3r(keep3rV2).rewardPeriodTime();\n _amountOut = getQuoteAtTick(uint128(_eth), _tickDifference, _tickInterval);\n }\n\n /// @inheritdoc IKeep3rHelper\n function bonds(address _keeper) public view override returns (uint256 _amountBonded) {\n return IKeep3r(keep3rV2).bonds(_keeper, KP3R);\n }\n\n /// @inheritdoc IKeep3rHelper\n function getRewardAmountFor(address _keeper, uint256 _gasUsed) public view override returns (uint256 _kp3r) {\n uint256 _boost = getRewardBoostFor(bonds(_keeper));\n _kp3r = quote((_gasUsed * _boost) / BOOST_BASE);\n }\n\n /// @inheritdoc IKeep3rHelper\n function getRewardAmount(uint256 _gasUsed) external view override returns (uint256 _amount) {\n // solhint-disable-next-line avoid-tx-origin\n return getRewardAmountFor(tx.origin, _gasUsed);\n }\n\n /// @inheritdoc IKeep3rHelper\n function getRewardBoostFor(uint256 _bonds) public view override returns (uint256 _rewardBoost) {\n _bonds = Math.min(_bonds, TARGETBOND);\n uint256 _cap = Math.max(MIN, (MAX * _bonds) / TARGETBOND);\n _rewardBoost = _cap * _getBasefee();\n }\n\n /// @inheritdoc IKeep3rHelper\n function getPoolTokens(address _pool) public view override returns (address _token0, address _token1) {\n return (IUniswapV3Pool(_pool).token0(), IUniswapV3Pool(_pool).token1());\n }\n\n /// @inheritdoc IKeep3rHelper\n function isKP3RToken0(address _pool) public view override returns (bool _isKP3RToken0) {\n address _token0;\n address _token1;\n (_token0, _token1) = getPoolTokens(_pool);\n if (_token0 == KP3R) {\n return true;\n } else if (_token1 != KP3R) {\n revert LiquidityPairInvalid();\n }\n }\n\n /// @inheritdoc IKeep3rHelper\n function observe(address _pool, uint32[] memory _secondsAgo)\n public\n view\n override\n returns (\n int56 _tickCumulative1,\n int56 _tickCumulative2,\n bool _success\n )\n {\n try IUniswapV3Pool(_pool).observe(_secondsAgo) returns (int56[] memory _uniswapResponse, uint160[] memory) {\n _tickCumulative1 = _uniswapResponse[0];\n if (_uniswapResponse.length > 1) {\n _tickCumulative2 = _uniswapResponse[1];\n }\n _success = true;\n } catch (bytes memory) {}\n }\n\n /// @inheritdoc IKeep3rHelper\n function getKP3RsAtTick(\n uint256 _liquidityAmount,\n int56 _tickDifference,\n uint256 _timeInterval\n ) public pure override returns (uint256 _kp3rAmount) {\n uint160 sqrtRatioX96 = TickMath.getSqrtRatioAtTick(int24(_tickDifference / int256(_timeInterval)));\n _kp3rAmount = FullMath.mulDiv(1 << 96, _liquidityAmount, sqrtRatioX96);\n }\n\n /// @inheritdoc IKeep3rHelper\n function getQuoteAtTick(\n uint128 _baseAmount,\n int56 _tickDifference,\n uint256 _timeInterval\n ) public pure override returns (uint256 _quoteAmount) {\n uint160 sqrtRatioX96 = TickMath.getSqrtRatioAtTick(int24(_tickDifference / int256(_timeInterval)));\n\n if (sqrtRatioX96 <= type(uint128).max) {\n uint256 ratioX192 = uint256(sqrtRatioX96) * sqrtRatioX96;\n _quoteAmount = FullMath.mulDiv(1 << 192, _baseAmount, ratioX192);\n } else {\n uint256 ratioX128 = FullMath.mulDiv(sqrtRatioX96, sqrtRatioX96, 1 << 64);\n _quoteAmount = FullMath.mulDiv(1 << 128, _baseAmount, ratioX128);\n }\n }\n\n /// @notice Gets the block's base fee\n /// @return _baseFee The block's basefee\n function _getBasefee() internal view virtual returns (uint256 _baseFee) {\n return block.basefee;\n }\n}\n" - }, - "solidity/contracts/libraries/TickMath.sol": { - "content": "// SPDX-License-Identifier: GPL-2.0-or-later\npragma solidity >=0.5.0;\n\n// solhint-disable\n\n/// @title Math library for computing sqrt prices from ticks and vice versa\n/// @notice Computes sqrt price for ticks of size 1.0001, i.e. sqrt(1.0001^tick) as fixed point Q64.96 numbers. Supports\n/// prices between 2**-128 and 2**128\nlibrary TickMath {\n /// @dev The minimum tick that may be passed to #getSqrtRatioAtTick computed from log base 1.0001 of 2**-128\n int24 internal constant MIN_TICK = -887272;\n /// @dev The maximum tick that may be passed to #getSqrtRatioAtTick computed from log base 1.0001 of 2**128\n int24 internal constant MAX_TICK = -MIN_TICK;\n\n /// @dev The minimum value that can be returned from #getSqrtRatioAtTick. Equivalent to getSqrtRatioAtTick(MIN_TICK)\n uint160 internal constant MIN_SQRT_RATIO = 4295128739;\n /// @dev The maximum value that can be returned from #getSqrtRatioAtTick. Equivalent to getSqrtRatioAtTick(MAX_TICK)\n uint160 internal constant MAX_SQRT_RATIO = 1461446703485210103287273052203988822378723970342;\n\n /// @notice Calculates sqrt(1.0001^tick) * 2^96\n /// @dev Throws if |tick| > max tick\n /// @param tick The input tick for the above formula\n /// @return sqrtPriceX96 A Fixed point Q64.96 number representing the sqrt of the ratio of the two assets (token1/token0)\n /// at the given tick\n function getSqrtRatioAtTick(int24 tick) internal pure returns (uint160 sqrtPriceX96) {\n uint256 absTick = tick < 0 ? uint256(-int256(tick)) : uint256(int256(tick));\n require(absTick <= uint256(int256(MAX_TICK)), 'T');\n\n uint256 ratio = absTick & 0x1 != 0 ? 0xfffcb933bd6fad37aa2d162d1a594001 : 0x100000000000000000000000000000000;\n if (absTick & 0x2 != 0) ratio = (ratio * 0xfff97272373d413259a46990580e213a) >> 128;\n if (absTick & 0x4 != 0) ratio = (ratio * 0xfff2e50f5f656932ef12357cf3c7fdcc) >> 128;\n if (absTick & 0x8 != 0) ratio = (ratio * 0xffe5caca7e10e4e61c3624eaa0941cd0) >> 128;\n if (absTick & 0x10 != 0) ratio = (ratio * 0xffcb9843d60f6159c9db58835c926644) >> 128;\n if (absTick & 0x20 != 0) ratio = (ratio * 0xff973b41fa98c081472e6896dfb254c0) >> 128;\n if (absTick & 0x40 != 0) ratio = (ratio * 0xff2ea16466c96a3843ec78b326b52861) >> 128;\n if (absTick & 0x80 != 0) ratio = (ratio * 0xfe5dee046a99a2a811c461f1969c3053) >> 128;\n if (absTick & 0x100 != 0) ratio = (ratio * 0xfcbe86c7900a88aedcffc83b479aa3a4) >> 128;\n if (absTick & 0x200 != 0) ratio = (ratio * 0xf987a7253ac413176f2b074cf7815e54) >> 128;\n if (absTick & 0x400 != 0) ratio = (ratio * 0xf3392b0822b70005940c7a398e4b70f3) >> 128;\n if (absTick & 0x800 != 0) ratio = (ratio * 0xe7159475a2c29b7443b29c7fa6e889d9) >> 128;\n if (absTick & 0x1000 != 0) ratio = (ratio * 0xd097f3bdfd2022b8845ad8f792aa5825) >> 128;\n if (absTick & 0x2000 != 0) ratio = (ratio * 0xa9f746462d870fdf8a65dc1f90e061e5) >> 128;\n if (absTick & 0x4000 != 0) ratio = (ratio * 0x70d869a156d2a1b890bb3df62baf32f7) >> 128;\n if (absTick & 0x8000 != 0) ratio = (ratio * 0x31be135f97d08fd981231505542fcfa6) >> 128;\n if (absTick & 0x10000 != 0) ratio = (ratio * 0x9aa508b5b7a84e1c677de54f3e99bc9) >> 128;\n if (absTick & 0x20000 != 0) ratio = (ratio * 0x5d6af8dedb81196699c329225ee604) >> 128;\n if (absTick & 0x40000 != 0) ratio = (ratio * 0x2216e584f5fa1ea926041bedfe98) >> 128;\n if (absTick & 0x80000 != 0) ratio = (ratio * 0x48a170391f7dc42444e8fa2) >> 128;\n\n if (tick > 0) ratio = type(uint256).max / ratio;\n\n // Divides by 1<<32 rounding up to go from a Q128.128 to a Q128.96.\n // we then downcast because we know the result always fits within 160 bits due to our tick input constraint\n // we round up in the division so getTickAtSqrtRatio of the output price is always consistent\n sqrtPriceX96 = uint160((ratio >> 32) + (ratio % (1 << 32) == 0 ? 0 : 1));\n }\n\n /// @notice Calculates the greatest tick value such that getRatioAtTick(tick) <= ratio\n /// @dev Throws in case sqrtPriceX96 < MIN_SQRT_RATIO, as MIN_SQRT_RATIO is the lowest value getRatioAtTick may ever return.\n /// @param sqrtPriceX96 The sqrt ratio for which to compute the tick as a Q64.96\n /// @return tick The greatest tick for which the ratio is less than or equal to the input ratio\n function getTickAtSqrtRatio(uint160 sqrtPriceX96) internal pure returns (int24 tick) {\n // Second inequality must be < because the price can never reach the price at the max tick\n require(sqrtPriceX96 >= MIN_SQRT_RATIO && sqrtPriceX96 < MAX_SQRT_RATIO, 'R');\n uint256 ratio = uint256(sqrtPriceX96) << 32;\n\n uint256 r = ratio;\n uint256 msb = 0;\n\n assembly {\n let f := shl(7, gt(r, 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF))\n msb := or(msb, f)\n r := shr(f, r)\n }\n assembly {\n let f := shl(6, gt(r, 0xFFFFFFFFFFFFFFFF))\n msb := or(msb, f)\n r := shr(f, r)\n }\n assembly {\n let f := shl(5, gt(r, 0xFFFFFFFF))\n msb := or(msb, f)\n r := shr(f, r)\n }\n assembly {\n let f := shl(4, gt(r, 0xFFFF))\n msb := or(msb, f)\n r := shr(f, r)\n }\n assembly {\n let f := shl(3, gt(r, 0xFF))\n msb := or(msb, f)\n r := shr(f, r)\n }\n assembly {\n let f := shl(2, gt(r, 0xF))\n msb := or(msb, f)\n r := shr(f, r)\n }\n assembly {\n let f := shl(1, gt(r, 0x3))\n msb := or(msb, f)\n r := shr(f, r)\n }\n assembly {\n let f := gt(r, 0x1)\n msb := or(msb, f)\n }\n\n if (msb >= 128) r = ratio >> (msb - 127);\n else r = ratio << (127 - msb);\n\n int256 log_2 = (int256(msb) - 128) << 64;\n\n assembly {\n r := shr(127, mul(r, r))\n let f := shr(128, r)\n log_2 := or(log_2, shl(63, f))\n r := shr(f, r)\n }\n assembly {\n r := shr(127, mul(r, r))\n let f := shr(128, r)\n log_2 := or(log_2, shl(62, f))\n r := shr(f, r)\n }\n assembly {\n r := shr(127, mul(r, r))\n let f := shr(128, r)\n log_2 := or(log_2, shl(61, f))\n r := shr(f, r)\n }\n assembly {\n r := shr(127, mul(r, r))\n let f := shr(128, r)\n log_2 := or(log_2, shl(60, f))\n r := shr(f, r)\n }\n assembly {\n r := shr(127, mul(r, r))\n let f := shr(128, r)\n log_2 := or(log_2, shl(59, f))\n r := shr(f, r)\n }\n assembly {\n r := shr(127, mul(r, r))\n let f := shr(128, r)\n log_2 := or(log_2, shl(58, f))\n r := shr(f, r)\n }\n assembly {\n r := shr(127, mul(r, r))\n let f := shr(128, r)\n log_2 := or(log_2, shl(57, f))\n r := shr(f, r)\n }\n assembly {\n r := shr(127, mul(r, r))\n let f := shr(128, r)\n log_2 := or(log_2, shl(56, f))\n r := shr(f, r)\n }\n assembly {\n r := shr(127, mul(r, r))\n let f := shr(128, r)\n log_2 := or(log_2, shl(55, f))\n r := shr(f, r)\n }\n assembly {\n r := shr(127, mul(r, r))\n let f := shr(128, r)\n log_2 := or(log_2, shl(54, f))\n r := shr(f, r)\n }\n assembly {\n r := shr(127, mul(r, r))\n let f := shr(128, r)\n log_2 := or(log_2, shl(53, f))\n r := shr(f, r)\n }\n assembly {\n r := shr(127, mul(r, r))\n let f := shr(128, r)\n log_2 := or(log_2, shl(52, f))\n r := shr(f, r)\n }\n assembly {\n r := shr(127, mul(r, r))\n let f := shr(128, r)\n log_2 := or(log_2, shl(51, f))\n r := shr(f, r)\n }\n assembly {\n r := shr(127, mul(r, r))\n let f := shr(128, r)\n log_2 := or(log_2, shl(50, f))\n }\n\n int256 log_sqrt10001 = log_2 * 255738958999603826347141; // 128.128 number\n\n int24 tickLow = int24((log_sqrt10001 - 3402992956809132418596140100660247210) >> 128);\n int24 tickHi = int24((log_sqrt10001 + 291339464771989622907027621153398088495) >> 128);\n\n tick = tickLow == tickHi ? tickLow : getSqrtRatioAtTick(tickHi) <= sqrtPriceX96 ? tickHi : tickLow;\n }\n}\n" - }, - "@uniswap/v3-core/contracts/interfaces/IUniswapV3Pool.sol": { - "content": "// SPDX-License-Identifier: GPL-2.0-or-later\npragma solidity >=0.5.0;\n\nimport './pool/IUniswapV3PoolImmutables.sol';\nimport './pool/IUniswapV3PoolState.sol';\nimport './pool/IUniswapV3PoolDerivedState.sol';\nimport './pool/IUniswapV3PoolActions.sol';\nimport './pool/IUniswapV3PoolOwnerActions.sol';\nimport './pool/IUniswapV3PoolEvents.sol';\n\n/// @title The interface for a Uniswap V3 Pool\n/// @notice A Uniswap pool facilitates swapping and automated market making between any two assets that strictly conform\n/// to the ERC20 specification\n/// @dev The pool interface is broken up into many smaller pieces\ninterface IUniswapV3Pool is\n IUniswapV3PoolImmutables,\n IUniswapV3PoolState,\n IUniswapV3PoolDerivedState,\n IUniswapV3PoolActions,\n IUniswapV3PoolOwnerActions,\n IUniswapV3PoolEvents\n{\n\n}\n" - }, - "@uniswap/v3-core/contracts/interfaces/pool/IUniswapV3PoolImmutables.sol": { - "content": "// SPDX-License-Identifier: GPL-2.0-or-later\npragma solidity >=0.5.0;\n\n/// @title Pool state that never changes\n/// @notice These parameters are fixed for a pool forever, i.e., the methods will always return the same values\ninterface IUniswapV3PoolImmutables {\n /// @notice The contract that deployed the pool, which must adhere to the IUniswapV3Factory interface\n /// @return The contract address\n function factory() external view returns (address);\n\n /// @notice The first of the two tokens of the pool, sorted by address\n /// @return The token contract address\n function token0() external view returns (address);\n\n /// @notice The second of the two tokens of the pool, sorted by address\n /// @return The token contract address\n function token1() external view returns (address);\n\n /// @notice The pool's fee in hundredths of a bip, i.e. 1e-6\n /// @return The fee\n function fee() external view returns (uint24);\n\n /// @notice The pool tick spacing\n /// @dev Ticks can only be used at multiples of this value, minimum of 1 and always positive\n /// e.g.: a tickSpacing of 3 means ticks can be initialized every 3rd tick, i.e., ..., -6, -3, 0, 3, 6, ...\n /// This value is an int24 to avoid casting even though it is always positive.\n /// @return The tick spacing\n function tickSpacing() external view returns (int24);\n\n /// @notice The maximum amount of position liquidity that can use any tick in the range\n /// @dev This parameter is enforced per tick to prevent liquidity from overflowing a uint128 at any point, and\n /// also prevents out-of-range liquidity from being used to prevent adding in-range liquidity to a pool\n /// @return The max amount of liquidity per tick\n function maxLiquidityPerTick() external view returns (uint128);\n}\n" - }, - "@uniswap/v3-core/contracts/interfaces/pool/IUniswapV3PoolState.sol": { - "content": "// SPDX-License-Identifier: GPL-2.0-or-later\npragma solidity >=0.5.0;\n\n/// @title Pool state that can change\n/// @notice These methods compose the pool's state, and can change with any frequency including multiple times\n/// per transaction\ninterface IUniswapV3PoolState {\n /// @notice The 0th storage slot in the pool stores many values, and is exposed as a single method to save gas\n /// when accessed externally.\n /// @return sqrtPriceX96 The current price of the pool as a sqrt(token1/token0) Q64.96 value\n /// tick The current tick of the pool, i.e. according to the last tick transition that was run.\n /// This value may not always be equal to SqrtTickMath.getTickAtSqrtRatio(sqrtPriceX96) if the price is on a tick\n /// boundary.\n /// observationIndex The index of the last oracle observation that was written,\n /// observationCardinality The current maximum number of observations stored in the pool,\n /// observationCardinalityNext The next maximum number of observations, to be updated when the observation.\n /// feeProtocol The protocol fee for both tokens of the pool.\n /// Encoded as two 4 bit values, where the protocol fee of token1 is shifted 4 bits and the protocol fee of token0\n /// is the lower 4 bits. Used as the denominator of a fraction of the swap fee, e.g. 4 means 1/4th of the swap fee.\n /// unlocked Whether the pool is currently locked to reentrancy\n function slot0()\n external\n view\n returns (\n uint160 sqrtPriceX96,\n int24 tick,\n uint16 observationIndex,\n uint16 observationCardinality,\n uint16 observationCardinalityNext,\n uint8 feeProtocol,\n bool unlocked\n );\n\n /// @notice The fee growth as a Q128.128 fees of token0 collected per unit of liquidity for the entire life of the pool\n /// @dev This value can overflow the uint256\n function feeGrowthGlobal0X128() external view returns (uint256);\n\n /// @notice The fee growth as a Q128.128 fees of token1 collected per unit of liquidity for the entire life of the pool\n /// @dev This value can overflow the uint256\n function feeGrowthGlobal1X128() external view returns (uint256);\n\n /// @notice The amounts of token0 and token1 that are owed to the protocol\n /// @dev Protocol fees will never exceed uint128 max in either token\n function protocolFees() external view returns (uint128 token0, uint128 token1);\n\n /// @notice The currently in range liquidity available to the pool\n /// @dev This value has no relationship to the total liquidity across all ticks\n function liquidity() external view returns (uint128);\n\n /// @notice Look up information about a specific tick in the pool\n /// @param tick The tick to look up\n /// @return liquidityGross the total amount of position liquidity that uses the pool either as tick lower or\n /// tick upper,\n /// liquidityNet how much liquidity changes when the pool price crosses the tick,\n /// feeGrowthOutside0X128 the fee growth on the other side of the tick from the current tick in token0,\n /// feeGrowthOutside1X128 the fee growth on the other side of the tick from the current tick in token1,\n /// tickCumulativeOutside the cumulative tick value on the other side of the tick from the current tick\n /// secondsPerLiquidityOutsideX128 the seconds spent per liquidity on the other side of the tick from the current tick,\n /// secondsOutside the seconds spent on the other side of the tick from the current tick,\n /// initialized Set to true if the tick is initialized, i.e. liquidityGross is greater than 0, otherwise equal to false.\n /// Outside values can only be used if the tick is initialized, i.e. if liquidityGross is greater than 0.\n /// In addition, these values are only relative and must be used only in comparison to previous snapshots for\n /// a specific position.\n function ticks(int24 tick)\n external\n view\n returns (\n uint128 liquidityGross,\n int128 liquidityNet,\n uint256 feeGrowthOutside0X128,\n uint256 feeGrowthOutside1X128,\n int56 tickCumulativeOutside,\n uint160 secondsPerLiquidityOutsideX128,\n uint32 secondsOutside,\n bool initialized\n );\n\n /// @notice Returns 256 packed tick initialized boolean values. See TickBitmap for more information\n function tickBitmap(int16 wordPosition) external view returns (uint256);\n\n /// @notice Returns the information about a position by the position's key\n /// @param key The position's key is a hash of a preimage composed by the owner, tickLower and tickUpper\n /// @return _liquidity The amount of liquidity in the position,\n /// Returns feeGrowthInside0LastX128 fee growth of token0 inside the tick range as of the last mint/burn/poke,\n /// Returns feeGrowthInside1LastX128 fee growth of token1 inside the tick range as of the last mint/burn/poke,\n /// Returns tokensOwed0 the computed amount of token0 owed to the position as of the last mint/burn/poke,\n /// Returns tokensOwed1 the computed amount of token1 owed to the position as of the last mint/burn/poke\n function positions(bytes32 key)\n external\n view\n returns (\n uint128 _liquidity,\n uint256 feeGrowthInside0LastX128,\n uint256 feeGrowthInside1LastX128,\n uint128 tokensOwed0,\n uint128 tokensOwed1\n );\n\n /// @notice Returns data about a specific observation index\n /// @param index The element of the observations array to fetch\n /// @dev You most likely want to use #observe() instead of this method to get an observation as of some amount of time\n /// ago, rather than at a specific index in the array.\n /// @return blockTimestamp The timestamp of the observation,\n /// Returns tickCumulative the tick multiplied by seconds elapsed for the life of the pool as of the observation timestamp,\n /// Returns secondsPerLiquidityCumulativeX128 the seconds per in range liquidity for the life of the pool as of the observation timestamp,\n /// Returns initialized whether the observation has been initialized and the values are safe to use\n function observations(uint256 index)\n external\n view\n returns (\n uint32 blockTimestamp,\n int56 tickCumulative,\n uint160 secondsPerLiquidityCumulativeX128,\n bool initialized\n );\n}\n" - }, - "@uniswap/v3-core/contracts/interfaces/pool/IUniswapV3PoolDerivedState.sol": { - "content": "// SPDX-License-Identifier: GPL-2.0-or-later\npragma solidity >=0.5.0;\n\n/// @title Pool state that is not stored\n/// @notice Contains view functions to provide information about the pool that is computed rather than stored on the\n/// blockchain. The functions here may have variable gas costs.\ninterface IUniswapV3PoolDerivedState {\n /// @notice Returns the cumulative tick and liquidity as of each timestamp `secondsAgo` from the current block timestamp\n /// @dev To get a time weighted average tick or liquidity-in-range, you must call this with two values, one representing\n /// the beginning of the period and another for the end of the period. E.g., to get the last hour time-weighted average tick,\n /// you must call it with secondsAgos = [3600, 0].\n /// @dev The time weighted average tick represents the geometric time weighted average price of the pool, in\n /// log base sqrt(1.0001) of token1 / token0. The TickMath library can be used to go from a tick value to a ratio.\n /// @param secondsAgos From how long ago each cumulative tick and liquidity value should be returned\n /// @return tickCumulatives Cumulative tick values as of each `secondsAgos` from the current block timestamp\n /// @return secondsPerLiquidityCumulativeX128s Cumulative seconds per liquidity-in-range value as of each `secondsAgos` from the current block\n /// timestamp\n function observe(uint32[] calldata secondsAgos)\n external\n view\n returns (int56[] memory tickCumulatives, uint160[] memory secondsPerLiquidityCumulativeX128s);\n\n /// @notice Returns a snapshot of the tick cumulative, seconds per liquidity and seconds inside a tick range\n /// @dev Snapshots must only be compared to other snapshots, taken over a period for which a position existed.\n /// I.e., snapshots cannot be compared if a position is not held for the entire period between when the first\n /// snapshot is taken and the second snapshot is taken.\n /// @param tickLower The lower tick of the range\n /// @param tickUpper The upper tick of the range\n /// @return tickCumulativeInside The snapshot of the tick accumulator for the range\n /// @return secondsPerLiquidityInsideX128 The snapshot of seconds per liquidity for the range\n /// @return secondsInside The snapshot of seconds per liquidity for the range\n function snapshotCumulativesInside(int24 tickLower, int24 tickUpper)\n external\n view\n returns (\n int56 tickCumulativeInside,\n uint160 secondsPerLiquidityInsideX128,\n uint32 secondsInside\n );\n}\n" - }, - "@uniswap/v3-core/contracts/interfaces/pool/IUniswapV3PoolActions.sol": { - "content": "// SPDX-License-Identifier: GPL-2.0-or-later\npragma solidity >=0.5.0;\n\n/// @title Permissionless pool actions\n/// @notice Contains pool methods that can be called by anyone\ninterface IUniswapV3PoolActions {\n /// @notice Sets the initial price for the pool\n /// @dev Price is represented as a sqrt(amountToken1/amountToken0) Q64.96 value\n /// @param sqrtPriceX96 the initial sqrt price of the pool as a Q64.96\n function initialize(uint160 sqrtPriceX96) external;\n\n /// @notice Adds liquidity for the given recipient/tickLower/tickUpper position\n /// @dev The caller of this method receives a callback in the form of IUniswapV3MintCallback#uniswapV3MintCallback\n /// in which they must pay any token0 or token1 owed for the liquidity. The amount of token0/token1 due depends\n /// on tickLower, tickUpper, the amount of liquidity, and the current price.\n /// @param recipient The address for which the liquidity will be created\n /// @param tickLower The lower tick of the position in which to add liquidity\n /// @param tickUpper The upper tick of the position in which to add liquidity\n /// @param amount The amount of liquidity to mint\n /// @param data Any data that should be passed through to the callback\n /// @return amount0 The amount of token0 that was paid to mint the given amount of liquidity. Matches the value in the callback\n /// @return amount1 The amount of token1 that was paid to mint the given amount of liquidity. Matches the value in the callback\n function mint(\n address recipient,\n int24 tickLower,\n int24 tickUpper,\n uint128 amount,\n bytes calldata data\n ) external returns (uint256 amount0, uint256 amount1);\n\n /// @notice Collects tokens owed to a position\n /// @dev Does not recompute fees earned, which must be done either via mint or burn of any amount of liquidity.\n /// Collect must be called by the position owner. To withdraw only token0 or only token1, amount0Requested or\n /// amount1Requested may be set to zero. To withdraw all tokens owed, caller may pass any value greater than the\n /// actual tokens owed, e.g. type(uint128).max. Tokens owed may be from accumulated swap fees or burned liquidity.\n /// @param recipient The address which should receive the fees collected\n /// @param tickLower The lower tick of the position for which to collect fees\n /// @param tickUpper The upper tick of the position for which to collect fees\n /// @param amount0Requested How much token0 should be withdrawn from the fees owed\n /// @param amount1Requested How much token1 should be withdrawn from the fees owed\n /// @return amount0 The amount of fees collected in token0\n /// @return amount1 The amount of fees collected in token1\n function collect(\n address recipient,\n int24 tickLower,\n int24 tickUpper,\n uint128 amount0Requested,\n uint128 amount1Requested\n ) external returns (uint128 amount0, uint128 amount1);\n\n /// @notice Burn liquidity from the sender and account tokens owed for the liquidity to the position\n /// @dev Can be used to trigger a recalculation of fees owed to a position by calling with an amount of 0\n /// @dev Fees must be collected separately via a call to #collect\n /// @param tickLower The lower tick of the position for which to burn liquidity\n /// @param tickUpper The upper tick of the position for which to burn liquidity\n /// @param amount How much liquidity to burn\n /// @return amount0 The amount of token0 sent to the recipient\n /// @return amount1 The amount of token1 sent to the recipient\n function burn(\n int24 tickLower,\n int24 tickUpper,\n uint128 amount\n ) external returns (uint256 amount0, uint256 amount1);\n\n /// @notice Swap token0 for token1, or token1 for token0\n /// @dev The caller of this method receives a callback in the form of IUniswapV3SwapCallback#uniswapV3SwapCallback\n /// @param recipient The address to receive the output of the swap\n /// @param zeroForOne The direction of the swap, true for token0 to token1, false for token1 to token0\n /// @param amountSpecified The amount of the swap, which implicitly configures the swap as exact input (positive), or exact output (negative)\n /// @param sqrtPriceLimitX96 The Q64.96 sqrt price limit. If zero for one, the price cannot be less than this\n /// value after the swap. If one for zero, the price cannot be greater than this value after the swap\n /// @param data Any data to be passed through to the callback\n /// @return amount0 The delta of the balance of token0 of the pool, exact when negative, minimum when positive\n /// @return amount1 The delta of the balance of token1 of the pool, exact when negative, minimum when positive\n function swap(\n address recipient,\n bool zeroForOne,\n int256 amountSpecified,\n uint160 sqrtPriceLimitX96,\n bytes calldata data\n ) external returns (int256 amount0, int256 amount1);\n\n /// @notice Receive token0 and/or token1 and pay it back, plus a fee, in the callback\n /// @dev The caller of this method receives a callback in the form of IUniswapV3FlashCallback#uniswapV3FlashCallback\n /// @dev Can be used to donate underlying tokens pro-rata to currently in-range liquidity providers by calling\n /// with 0 amount{0,1} and sending the donation amount(s) from the callback\n /// @param recipient The address which will receive the token0 and token1 amounts\n /// @param amount0 The amount of token0 to send\n /// @param amount1 The amount of token1 to send\n /// @param data Any data to be passed through to the callback\n function flash(\n address recipient,\n uint256 amount0,\n uint256 amount1,\n bytes calldata data\n ) external;\n\n /// @notice Increase the maximum number of price and liquidity observations that this pool will store\n /// @dev This method is no-op if the pool already has an observationCardinalityNext greater than or equal to\n /// the input observationCardinalityNext.\n /// @param observationCardinalityNext The desired minimum number of observations for the pool to store\n function increaseObservationCardinalityNext(uint16 observationCardinalityNext) external;\n}\n" - }, - "@uniswap/v3-core/contracts/interfaces/pool/IUniswapV3PoolOwnerActions.sol": { - "content": "// SPDX-License-Identifier: GPL-2.0-or-later\npragma solidity >=0.5.0;\n\n/// @title Permissioned pool actions\n/// @notice Contains pool methods that may only be called by the factory owner\ninterface IUniswapV3PoolOwnerActions {\n /// @notice Set the denominator of the protocol's % share of the fees\n /// @param feeProtocol0 new protocol fee for token0 of the pool\n /// @param feeProtocol1 new protocol fee for token1 of the pool\n function setFeeProtocol(uint8 feeProtocol0, uint8 feeProtocol1) external;\n\n /// @notice Collect the protocol fee accrued to the pool\n /// @param recipient The address to which collected protocol fees should be sent\n /// @param amount0Requested The maximum amount of token0 to send, can be 0 to collect fees in only token1\n /// @param amount1Requested The maximum amount of token1 to send, can be 0 to collect fees in only token0\n /// @return amount0 The protocol fee collected in token0\n /// @return amount1 The protocol fee collected in token1\n function collectProtocol(\n address recipient,\n uint128 amount0Requested,\n uint128 amount1Requested\n ) external returns (uint128 amount0, uint128 amount1);\n}\n" - }, - "@uniswap/v3-core/contracts/interfaces/pool/IUniswapV3PoolEvents.sol": { - "content": "// SPDX-License-Identifier: GPL-2.0-or-later\npragma solidity >=0.5.0;\n\n/// @title Events emitted by a pool\n/// @notice Contains all events emitted by the pool\ninterface IUniswapV3PoolEvents {\n /// @notice Emitted exactly once by a pool when #initialize is first called on the pool\n /// @dev Mint/Burn/Swap cannot be emitted by the pool before Initialize\n /// @param sqrtPriceX96 The initial sqrt price of the pool, as a Q64.96\n /// @param tick The initial tick of the pool, i.e. log base 1.0001 of the starting price of the pool\n event Initialize(uint160 sqrtPriceX96, int24 tick);\n\n /// @notice Emitted when liquidity is minted for a given position\n /// @param sender The address that minted the liquidity\n /// @param owner The owner of the position and recipient of any minted liquidity\n /// @param tickLower The lower tick of the position\n /// @param tickUpper The upper tick of the position\n /// @param amount The amount of liquidity minted to the position range\n /// @param amount0 How much token0 was required for the minted liquidity\n /// @param amount1 How much token1 was required for the minted liquidity\n event Mint(\n address sender,\n address indexed owner,\n int24 indexed tickLower,\n int24 indexed tickUpper,\n uint128 amount,\n uint256 amount0,\n uint256 amount1\n );\n\n /// @notice Emitted when fees are collected by the owner of a position\n /// @dev Collect events may be emitted with zero amount0 and amount1 when the caller chooses not to collect fees\n /// @param owner The owner of the position for which fees are collected\n /// @param tickLower The lower tick of the position\n /// @param tickUpper The upper tick of the position\n /// @param amount0 The amount of token0 fees collected\n /// @param amount1 The amount of token1 fees collected\n event Collect(\n address indexed owner,\n address recipient,\n int24 indexed tickLower,\n int24 indexed tickUpper,\n uint128 amount0,\n uint128 amount1\n );\n\n /// @notice Emitted when a position's liquidity is removed\n /// @dev Does not withdraw any fees earned by the liquidity position, which must be withdrawn via #collect\n /// @param owner The owner of the position for which liquidity is removed\n /// @param tickLower The lower tick of the position\n /// @param tickUpper The upper tick of the position\n /// @param amount The amount of liquidity to remove\n /// @param amount0 The amount of token0 withdrawn\n /// @param amount1 The amount of token1 withdrawn\n event Burn(\n address indexed owner,\n int24 indexed tickLower,\n int24 indexed tickUpper,\n uint128 amount,\n uint256 amount0,\n uint256 amount1\n );\n\n /// @notice Emitted by the pool for any swaps between token0 and token1\n /// @param sender The address that initiated the swap call, and that received the callback\n /// @param recipient The address that received the output of the swap\n /// @param amount0 The delta of the token0 balance of the pool\n /// @param amount1 The delta of the token1 balance of the pool\n /// @param sqrtPriceX96 The sqrt(price) of the pool after the swap, as a Q64.96\n /// @param liquidity The liquidity of the pool after the swap\n /// @param tick The log base 1.0001 of price of the pool after the swap\n event Swap(\n address indexed sender,\n address indexed recipient,\n int256 amount0,\n int256 amount1,\n uint160 sqrtPriceX96,\n uint128 liquidity,\n int24 tick\n );\n\n /// @notice Emitted by the pool for any flashes of token0/token1\n /// @param sender The address that initiated the swap call, and that received the callback\n /// @param recipient The address that received the tokens from flash\n /// @param amount0 The amount of token0 that was flashed\n /// @param amount1 The amount of token1 that was flashed\n /// @param paid0 The amount of token0 paid for the flash, which can exceed the amount0 plus the fee\n /// @param paid1 The amount of token1 paid for the flash, which can exceed the amount1 plus the fee\n event Flash(\n address indexed sender,\n address indexed recipient,\n uint256 amount0,\n uint256 amount1,\n uint256 paid0,\n uint256 paid1\n );\n\n /// @notice Emitted by the pool for increases to the number of observations that can be stored\n /// @dev observationCardinalityNext is not the observation cardinality until an observation is written at the index\n /// just before a mint/swap/burn.\n /// @param observationCardinalityNextOld The previous value of the next observation cardinality\n /// @param observationCardinalityNextNew The updated value of the next observation cardinality\n event IncreaseObservationCardinalityNext(\n uint16 observationCardinalityNextOld,\n uint16 observationCardinalityNextNew\n );\n\n /// @notice Emitted when the protocol fee is changed by the pool\n /// @param feeProtocol0Old The previous value of the token0 protocol fee\n /// @param feeProtocol1Old The previous value of the token1 protocol fee\n /// @param feeProtocol0New The updated value of the token0 protocol fee\n /// @param feeProtocol1New The updated value of the token1 protocol fee\n event SetFeeProtocol(uint8 feeProtocol0Old, uint8 feeProtocol1Old, uint8 feeProtocol0New, uint8 feeProtocol1New);\n\n /// @notice Emitted when the collected protocol fees are withdrawn by the factory owner\n /// @param sender The address that collects the protocol fees\n /// @param recipient The address that receives the collected protocol fees\n /// @param amount0 The amount of token0 protocol fees that is withdrawn\n /// @param amount0 The amount of token1 protocol fees that is withdrawn\n event CollectProtocol(address indexed sender, address indexed recipient, uint128 amount0, uint128 amount1);\n}\n" - }, - "solidity/for-test/Keep3rHelperForTest.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.0 <0.9.0;\n\nimport '../contracts/Keep3rHelper.sol';\n\ncontract Keep3rHelperForTest is Keep3rHelper {\n uint256 public basefee;\n\n constructor(address _keep3rV2) Keep3rHelper(_keep3rV2) {}\n\n function _getBasefee() internal view override returns (uint256) {\n return basefee;\n }\n}\n" - }, - "solidity/for-test/UniV3PairManagerForTest.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '@openzeppelin/contracts/token/ERC20/ERC20.sol';\nimport '@uniswap/v3-core/contracts/interfaces/IUniswapV3Pool.sol';\n\nimport '../contracts/libraries/LiquidityAmounts.sol';\nimport '../contracts/libraries/PoolAddress.sol';\nimport '../contracts/libraries/FixedPoint96.sol';\nimport '../contracts/libraries/FullMath.sol';\nimport '../contracts/libraries/TickMath.sol';\nimport '../contracts/UniV3PairManager.sol';\nimport '../interfaces/external/IWeth9.sol';\nimport '../interfaces/IUniV3PairManager.sol';\n\ncontract UniV3PairManagerForTest is UniV3PairManager {\n constructor(address _pool, address _governance) UniV3PairManager(_pool, _governance) {}\n\n function internalAddLiquidity(\n uint256 amount0Desired,\n uint256 amount1Desired,\n uint256 amount0Min,\n uint256 amount1Min\n )\n external\n returns (\n uint128 liquidity,\n uint256 amount0,\n uint256 amount1\n )\n {\n return _addLiquidity(amount0Desired, amount1Desired, amount0Min, amount1Min);\n }\n\n function internalPay(\n address token,\n address payer,\n address recipient,\n uint256 value\n ) external {\n return _pay(token, payer, recipient, value);\n }\n\n function internalMint(address dst, uint256 amount) external {\n return _mint(dst, amount);\n }\n\n function internalBurn(address dst, uint256 amount) external {\n return _burn(dst, amount);\n }\n\n function internalTransferTokens(\n address src,\n address dst,\n uint256 amount\n ) external {\n _transferTokens(src, dst, amount);\n }\n\n function internalSafeTransferFrom(\n address token,\n address from,\n address to,\n uint256 value\n ) external {\n _safeTransferFrom(token, from, to, value);\n }\n\n receive() external payable {}\n}\n" - }, - "@openzeppelin/contracts/token/ERC20/ERC20.sol": { - "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\nimport \"./IERC20.sol\";\nimport \"./extensions/IERC20Metadata.sol\";\nimport \"../../utils/Context.sol\";\n\n/**\n * @dev Implementation of the {IERC20} interface.\n *\n * This implementation is agnostic to the way tokens are created. This means\n * that a supply mechanism has to be added in a derived contract using {_mint}.\n * For a generic mechanism see {ERC20PresetMinterPauser}.\n *\n * TIP: For a detailed writeup see our guide\n * https://forum.zeppelin.solutions/t/how-to-implement-erc20-supply-mechanisms/226[How\n * to implement supply mechanisms].\n *\n * We have followed general OpenZeppelin Contracts guidelines: functions revert\n * instead returning `false` on failure. This behavior is nonetheless\n * conventional and does not conflict with the expectations of ERC20\n * applications.\n *\n * Additionally, an {Approval} event is emitted on calls to {transferFrom}.\n * This allows applications to reconstruct the allowance for all accounts just\n * by listening to said events. Other implementations of the EIP may not emit\n * these events, as it isn't required by the specification.\n *\n * Finally, the non-standard {decreaseAllowance} and {increaseAllowance}\n * functions have been added to mitigate the well-known issues around setting\n * allowances. See {IERC20-approve}.\n */\ncontract ERC20 is Context, IERC20, IERC20Metadata {\n mapping(address => uint256) private _balances;\n\n mapping(address => mapping(address => uint256)) private _allowances;\n\n uint256 private _totalSupply;\n\n string private _name;\n string private _symbol;\n\n /**\n * @dev Sets the values for {name} and {symbol}.\n *\n * The default value of {decimals} is 18. To select a different value for\n * {decimals} you should overload it.\n *\n * All two of these values are immutable: they can only be set once during\n * construction.\n */\n constructor(string memory name_, string memory symbol_) {\n _name = name_;\n _symbol = symbol_;\n }\n\n /**\n * @dev Returns the name of the token.\n */\n function name() public view virtual override returns (string memory) {\n return _name;\n }\n\n /**\n * @dev Returns the symbol of the token, usually a shorter version of the\n * name.\n */\n function symbol() public view virtual override returns (string memory) {\n return _symbol;\n }\n\n /**\n * @dev Returns the number of decimals used to get its user representation.\n * For example, if `decimals` equals `2`, a balance of `505` tokens should\n * be displayed to a user as `5.05` (`505 / 10 ** 2`).\n *\n * Tokens usually opt for a value of 18, imitating the relationship between\n * Ether and Wei. This is the value {ERC20} uses, unless this function is\n * overridden;\n *\n * NOTE: This information is only used for _display_ purposes: it in\n * no way affects any of the arithmetic of the contract, including\n * {IERC20-balanceOf} and {IERC20-transfer}.\n */\n function decimals() public view virtual override returns (uint8) {\n return 18;\n }\n\n /**\n * @dev See {IERC20-totalSupply}.\n */\n function totalSupply() public view virtual override returns (uint256) {\n return _totalSupply;\n }\n\n /**\n * @dev See {IERC20-balanceOf}.\n */\n function balanceOf(address account) public view virtual override returns (uint256) {\n return _balances[account];\n }\n\n /**\n * @dev See {IERC20-transfer}.\n *\n * Requirements:\n *\n * - `recipient` cannot be the zero address.\n * - the caller must have a balance of at least `amount`.\n */\n function transfer(address recipient, uint256 amount) public virtual override returns (bool) {\n _transfer(_msgSender(), recipient, amount);\n return true;\n }\n\n /**\n * @dev See {IERC20-allowance}.\n */\n function allowance(address owner, address spender) public view virtual override returns (uint256) {\n return _allowances[owner][spender];\n }\n\n /**\n * @dev See {IERC20-approve}.\n *\n * Requirements:\n *\n * - `spender` cannot be the zero address.\n */\n function approve(address spender, uint256 amount) public virtual override returns (bool) {\n _approve(_msgSender(), spender, amount);\n return true;\n }\n\n /**\n * @dev See {IERC20-transferFrom}.\n *\n * Emits an {Approval} event indicating the updated allowance. This is not\n * required by the EIP. See the note at the beginning of {ERC20}.\n *\n * Requirements:\n *\n * - `sender` and `recipient` cannot be the zero address.\n * - `sender` must have a balance of at least `amount`.\n * - the caller must have allowance for ``sender``'s tokens of at least\n * `amount`.\n */\n function transferFrom(\n address sender,\n address recipient,\n uint256 amount\n ) public virtual override returns (bool) {\n _transfer(sender, recipient, amount);\n\n uint256 currentAllowance = _allowances[sender][_msgSender()];\n require(currentAllowance >= amount, \"ERC20: transfer amount exceeds allowance\");\n unchecked {\n _approve(sender, _msgSender(), currentAllowance - amount);\n }\n\n return true;\n }\n\n /**\n * @dev Atomically increases the allowance granted to `spender` by the caller.\n *\n * This is an alternative to {approve} that can be used as a mitigation for\n * problems described in {IERC20-approve}.\n *\n * Emits an {Approval} event indicating the updated allowance.\n *\n * Requirements:\n *\n * - `spender` cannot be the zero address.\n */\n function increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool) {\n _approve(_msgSender(), spender, _allowances[_msgSender()][spender] + addedValue);\n return true;\n }\n\n /**\n * @dev Atomically decreases the allowance granted to `spender` by the caller.\n *\n * This is an alternative to {approve} that can be used as a mitigation for\n * problems described in {IERC20-approve}.\n *\n * Emits an {Approval} event indicating the updated allowance.\n *\n * Requirements:\n *\n * - `spender` cannot be the zero address.\n * - `spender` must have allowance for the caller of at least\n * `subtractedValue`.\n */\n function decreaseAllowance(address spender, uint256 subtractedValue) public virtual returns (bool) {\n uint256 currentAllowance = _allowances[_msgSender()][spender];\n require(currentAllowance >= subtractedValue, \"ERC20: decreased allowance below zero\");\n unchecked {\n _approve(_msgSender(), spender, currentAllowance - subtractedValue);\n }\n\n return true;\n }\n\n /**\n * @dev Moves `amount` of tokens from `sender` to `recipient`.\n *\n * This internal function is equivalent to {transfer}, and can be used to\n * e.g. implement automatic token fees, slashing mechanisms, etc.\n *\n * Emits a {Transfer} event.\n *\n * Requirements:\n *\n * - `sender` cannot be the zero address.\n * - `recipient` cannot be the zero address.\n * - `sender` must have a balance of at least `amount`.\n */\n function _transfer(\n address sender,\n address recipient,\n uint256 amount\n ) internal virtual {\n require(sender != address(0), \"ERC20: transfer from the zero address\");\n require(recipient != address(0), \"ERC20: transfer to the zero address\");\n\n _beforeTokenTransfer(sender, recipient, amount);\n\n uint256 senderBalance = _balances[sender];\n require(senderBalance >= amount, \"ERC20: transfer amount exceeds balance\");\n unchecked {\n _balances[sender] = senderBalance - amount;\n }\n _balances[recipient] += amount;\n\n emit Transfer(sender, recipient, amount);\n\n _afterTokenTransfer(sender, recipient, amount);\n }\n\n /** @dev Creates `amount` tokens and assigns them to `account`, increasing\n * the total supply.\n *\n * Emits a {Transfer} event with `from` set to the zero address.\n *\n * Requirements:\n *\n * - `account` cannot be the zero address.\n */\n function _mint(address account, uint256 amount) internal virtual {\n require(account != address(0), \"ERC20: mint to the zero address\");\n\n _beforeTokenTransfer(address(0), account, amount);\n\n _totalSupply += amount;\n _balances[account] += amount;\n emit Transfer(address(0), account, amount);\n\n _afterTokenTransfer(address(0), account, amount);\n }\n\n /**\n * @dev Destroys `amount` tokens from `account`, reducing the\n * total supply.\n *\n * Emits a {Transfer} event with `to` set to the zero address.\n *\n * Requirements:\n *\n * - `account` cannot be the zero address.\n * - `account` must have at least `amount` tokens.\n */\n function _burn(address account, uint256 amount) internal virtual {\n require(account != address(0), \"ERC20: burn from the zero address\");\n\n _beforeTokenTransfer(account, address(0), amount);\n\n uint256 accountBalance = _balances[account];\n require(accountBalance >= amount, \"ERC20: burn amount exceeds balance\");\n unchecked {\n _balances[account] = accountBalance - amount;\n }\n _totalSupply -= amount;\n\n emit Transfer(account, address(0), amount);\n\n _afterTokenTransfer(account, address(0), amount);\n }\n\n /**\n * @dev Sets `amount` as the allowance of `spender` over the `owner` s tokens.\n *\n * This internal function is equivalent to `approve`, and can be used to\n * e.g. set automatic allowances for certain subsystems, etc.\n *\n * Emits an {Approval} event.\n *\n * Requirements:\n *\n * - `owner` cannot be the zero address.\n * - `spender` cannot be the zero address.\n */\n function _approve(\n address owner,\n address spender,\n uint256 amount\n ) internal virtual {\n require(owner != address(0), \"ERC20: approve from the zero address\");\n require(spender != address(0), \"ERC20: approve to the zero address\");\n\n _allowances[owner][spender] = amount;\n emit Approval(owner, spender, amount);\n }\n\n /**\n * @dev Hook that is called before any transfer of tokens. This includes\n * minting and burning.\n *\n * Calling conditions:\n *\n * - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens\n * will be transferred to `to`.\n * - when `from` is zero, `amount` tokens will be minted for `to`.\n * - when `to` is zero, `amount` of ``from``'s tokens will be burned.\n * - `from` and `to` are never both zero.\n *\n * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].\n */\n function _beforeTokenTransfer(\n address from,\n address to,\n uint256 amount\n ) internal virtual {}\n\n /**\n * @dev Hook that is called after any transfer of tokens. This includes\n * minting and burning.\n *\n * Calling conditions:\n *\n * - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens\n * has been transferred to `to`.\n * - when `from` is zero, `amount` tokens have been minted for `to`.\n * - when `to` is zero, `amount` of ``from``'s tokens have been burned.\n * - `from` and `to` are never both zero.\n *\n * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].\n */\n function _afterTokenTransfer(\n address from,\n address to,\n uint256 amount\n ) internal virtual {}\n}\n" - }, - "solidity/contracts/libraries/LiquidityAmounts.sol": { - "content": "// SPDX-License-Identifier: GPL-2.0-or-later\npragma solidity >=0.8.4 <0.9.0;\n\nimport './FullMath.sol';\nimport './FixedPoint96.sol';\n\n// solhint-disable\nlibrary LiquidityAmounts {\n function toUint128(uint256 x) private pure returns (uint128 y) {\n require((y = uint128(x)) == x);\n }\n\n function getLiquidityForAmount0(\n uint160 sqrtRatioAX96,\n uint160 sqrtRatioBX96,\n uint256 amount0\n ) internal pure returns (uint128 liquidity) {\n if (sqrtRatioAX96 > sqrtRatioBX96) (sqrtRatioAX96, sqrtRatioBX96) = (sqrtRatioBX96, sqrtRatioAX96);\n uint256 intermediate = FullMath.mulDiv(sqrtRatioAX96, sqrtRatioBX96, FixedPoint96.Q96);\n return toUint128(FullMath.mulDiv(amount0, intermediate, sqrtRatioBX96 - sqrtRatioAX96));\n }\n\n function getLiquidityForAmount1(\n uint160 sqrtRatioAX96,\n uint160 sqrtRatioBX96,\n uint256 amount1\n ) internal pure returns (uint128 liquidity) {\n if (sqrtRatioAX96 > sqrtRatioBX96) (sqrtRatioAX96, sqrtRatioBX96) = (sqrtRatioBX96, sqrtRatioAX96);\n return toUint128(FullMath.mulDiv(amount1, FixedPoint96.Q96, sqrtRatioBX96 - sqrtRatioAX96));\n }\n\n function getLiquidityForAmounts(\n uint160 sqrtRatioX96,\n uint160 sqrtRatioAX96,\n uint160 sqrtRatioBX96,\n uint256 amount0,\n uint256 amount1\n ) internal pure returns (uint128 liquidity) {\n if (sqrtRatioAX96 > sqrtRatioBX96) (sqrtRatioAX96, sqrtRatioBX96) = (sqrtRatioBX96, sqrtRatioAX96);\n\n if (sqrtRatioX96 <= sqrtRatioAX96) {\n liquidity = getLiquidityForAmount0(sqrtRatioAX96, sqrtRatioBX96, amount0);\n } else if (sqrtRatioX96 < sqrtRatioBX96) {\n uint128 liquidity0 = getLiquidityForAmount0(sqrtRatioX96, sqrtRatioBX96, amount0);\n uint128 liquidity1 = getLiquidityForAmount1(sqrtRatioAX96, sqrtRatioX96, amount1);\n\n liquidity = liquidity0 < liquidity1 ? liquidity0 : liquidity1;\n } else {\n liquidity = getLiquidityForAmount1(sqrtRatioAX96, sqrtRatioBX96, amount1);\n }\n }\n\n function getAmount0ForLiquidity(\n uint160 sqrtRatioAX96,\n uint160 sqrtRatioBX96,\n uint128 liquidity\n ) internal pure returns (uint256 amount0) {\n if (sqrtRatioAX96 > sqrtRatioBX96) (sqrtRatioAX96, sqrtRatioBX96) = (sqrtRatioBX96, sqrtRatioAX96);\n\n return FullMath.mulDiv(uint256(liquidity) << FixedPoint96.RESOLUTION, sqrtRatioBX96 - sqrtRatioAX96, sqrtRatioBX96) / sqrtRatioAX96;\n }\n\n function getAmount1ForLiquidity(\n uint160 sqrtRatioAX96,\n uint160 sqrtRatioBX96,\n uint128 liquidity\n ) internal pure returns (uint256 amount1) {\n if (sqrtRatioAX96 > sqrtRatioBX96) (sqrtRatioAX96, sqrtRatioBX96) = (sqrtRatioBX96, sqrtRatioAX96);\n\n return FullMath.mulDiv(liquidity, sqrtRatioBX96 - sqrtRatioAX96, FixedPoint96.Q96);\n }\n\n function getAmountsForLiquidity(\n uint160 sqrtRatioX96,\n uint160 sqrtRatioAX96,\n uint160 sqrtRatioBX96,\n uint128 liquidity\n ) internal pure returns (uint256 amount0, uint256 amount1) {\n if (sqrtRatioAX96 > sqrtRatioBX96) (sqrtRatioAX96, sqrtRatioBX96) = (sqrtRatioBX96, sqrtRatioAX96);\n\n if (sqrtRatioX96 <= sqrtRatioAX96) {\n amount0 = getAmount0ForLiquidity(sqrtRatioAX96, sqrtRatioBX96, liquidity);\n } else if (sqrtRatioX96 < sqrtRatioBX96) {\n amount0 = getAmount0ForLiquidity(sqrtRatioX96, sqrtRatioBX96, liquidity);\n amount1 = getAmount1ForLiquidity(sqrtRatioAX96, sqrtRatioX96, liquidity);\n } else {\n amount1 = getAmount1ForLiquidity(sqrtRatioAX96, sqrtRatioBX96, liquidity);\n }\n }\n}\n" - }, - "solidity/contracts/libraries/PoolAddress.sol": { - "content": "// SPDX-License-Identifier: GPL-2.0-or-later\npragma solidity >=0.8.4 <0.9.0;\n\nlibrary PoolAddress {\n struct PoolKey {\n address token0;\n address token1;\n uint24 fee;\n }\n}\n" - }, - "solidity/contracts/libraries/FixedPoint96.sol": { - "content": "// SPDX-License-Identifier: GPL-2.0-or-later\npragma solidity >=0.8.4 <0.9.0;\n\nlibrary FixedPoint96 {\n // solhint-disable\n uint8 internal constant RESOLUTION = 96;\n uint256 internal constant Q96 = 0x1000000000000000000000000;\n}\n" - }, - "solidity/contracts/UniV3PairManager.sol": { - "content": "// SPDX-License-Identifier: MIT\n\n/*\n\nCoded for The Keep3r Network with ♥ by\n\n██████╗░███████╗███████╗██╗  ░██╗░░░░░░░██╗░█████╗░███╗░░██╗██████╗░███████╗██████╗░██╗░░░░░░█████╗░███╗░░██╗██████╗░\n██╔══██╗██╔════╝██╔════╝██║  ░██║░░██╗░░██║██╔══██╗████╗░██║██╔══██╗██╔════╝██╔══██╗██║░░░░░██╔══██╗████╗░██║██╔══██╗\n██║░░██║█████╗░░█████╗░░██║  ░╚██╗████╗██╔╝██║░░██║██╔██╗██║██║░░██║█████╗░░██████╔╝██║░░░░░███████║██╔██╗██║██║░░██║\n██║░░██║██╔══╝░░██╔══╝░░██║  ░░████╔═████║░██║░░██║██║╚████║██║░░██║██╔══╝░░██╔══██╗██║░░░░░██╔══██║██║╚████║██║░░██║\n██████╔╝███████╗██║░░░░░██║  ░░╚██╔╝░╚██╔╝░╚█████╔╝██║░╚███║██████╔╝███████╗██║░░██║███████╗██║░░██║██║░╚███║██████╔╝\n╚═════╝░╚══════╝╚═╝░░░░░╚═╝  ░░░╚═╝░░░╚═╝░░░╚════╝░╚═╝░░╚══╝╚═════╝░╚══════╝╚═╝░░╚═╝╚══════╝╚═╝░░╚═╝╚═╝░░╚══╝╚═════╝░\n\nhttps://defi.sucks\n\n*/\n\npragma solidity >=0.8.4 <0.9.0;\n\nimport '@openzeppelin/contracts/token/ERC20/ERC20.sol';\nimport '@uniswap/v3-core/contracts/interfaces/IUniswapV3Pool.sol';\n\nimport './libraries/LiquidityAmounts.sol';\nimport './libraries/PoolAddress.sol';\nimport './libraries/FixedPoint96.sol';\nimport './libraries/FullMath.sol';\nimport './libraries/TickMath.sol';\n\nimport '../interfaces/external/IWeth9.sol';\nimport '../interfaces/IUniV3PairManager.sol';\n\nimport './peripherals/Governable.sol';\n\ncontract UniV3PairManager is IUniV3PairManager, Governable {\n /// @inheritdoc IERC20Metadata\n string public override name;\n\n /// @inheritdoc IERC20Metadata\n string public override symbol;\n\n /// @inheritdoc IERC20\n uint256 public override totalSupply = 0;\n\n /// @inheritdoc IPairManager\n address public immutable override token0;\n\n /// @inheritdoc IPairManager\n address public immutable override token1;\n\n /// @inheritdoc IPairManager\n address public immutable override pool;\n\n /// @inheritdoc IUniV3PairManager\n uint24 public immutable override fee;\n\n /// @inheritdoc IUniV3PairManager\n uint160 public immutable override sqrtRatioAX96;\n\n /// @inheritdoc IUniV3PairManager\n uint160 public immutable override sqrtRatioBX96;\n\n /// @notice Lowest possible tick in the Uniswap's curve\n int24 private constant _TICK_LOWER = -887200;\n\n /// @notice Highest possible tick in the Uniswap's curve\n int24 private constant _TICK_UPPER = 887200;\n\n /// @inheritdoc IERC20Metadata\n //solhint-disable-next-line const-name-snakecase\n uint8 public constant override decimals = 18;\n\n /// @inheritdoc IERC20\n mapping(address => mapping(address => uint256)) public override allowance;\n\n /// @inheritdoc IERC20\n mapping(address => uint256) public override balanceOf;\n\n /// @notice Struct that contains token0, token1, and fee of the Uniswap pool\n PoolAddress.PoolKey private _poolKey;\n\n constructor(address _pool, address _governance) Governable(_governance) {\n pool = _pool;\n uint24 _fee = IUniswapV3Pool(_pool).fee();\n fee = _fee;\n address _token0 = IUniswapV3Pool(_pool).token0();\n address _token1 = IUniswapV3Pool(_pool).token1();\n token0 = _token0;\n token1 = _token1;\n name = string(abi.encodePacked('Keep3rLP - ', ERC20(_token0).symbol(), '/', ERC20(_token1).symbol()));\n symbol = string(abi.encodePacked('kLP-', ERC20(_token0).symbol(), '/', ERC20(_token1).symbol()));\n sqrtRatioAX96 = TickMath.getSqrtRatioAtTick(_TICK_LOWER);\n sqrtRatioBX96 = TickMath.getSqrtRatioAtTick(_TICK_UPPER);\n _poolKey = PoolAddress.PoolKey({token0: _token0, token1: _token1, fee: _fee});\n }\n\n // This low-level function should be called from a contract which performs important safety checks\n /// @inheritdoc IUniV3PairManager\n function mint(\n uint256 amount0Desired,\n uint256 amount1Desired,\n uint256 amount0Min,\n uint256 amount1Min,\n address to\n ) external override returns (uint128 liquidity) {\n (liquidity, , ) = _addLiquidity(amount0Desired, amount1Desired, amount0Min, amount1Min);\n _mint(to, liquidity);\n }\n\n /// @inheritdoc IUniV3PairManager\n function uniswapV3MintCallback(\n uint256 amount0Owed,\n uint256 amount1Owed,\n bytes calldata data\n ) external override {\n MintCallbackData memory decoded = abi.decode(data, (MintCallbackData));\n if (msg.sender != pool) revert OnlyPool();\n if (amount0Owed > 0) _pay(decoded._poolKey.token0, decoded.payer, pool, amount0Owed);\n if (amount1Owed > 0) _pay(decoded._poolKey.token1, decoded.payer, pool, amount1Owed);\n }\n\n /// @inheritdoc IUniV3PairManager\n function burn(\n uint128 liquidity,\n uint256 amount0Min,\n uint256 amount1Min,\n address to\n ) external override returns (uint256 amount0, uint256 amount1) {\n (amount0, amount1) = IUniswapV3Pool(pool).burn(_TICK_LOWER, _TICK_UPPER, liquidity);\n\n if (amount0 < amount0Min || amount1 < amount1Min) revert ExcessiveSlippage();\n\n IUniswapV3Pool(pool).collect(to, _TICK_LOWER, _TICK_UPPER, uint128(amount0), uint128(amount1));\n _burn(msg.sender, liquidity);\n }\n\n /// @inheritdoc IUniV3PairManager\n function collect() external override onlyGovernance returns (uint256 amount0, uint256 amount1) {\n (, , , uint128 tokensOwed0, uint128 tokensOwed1) = IUniswapV3Pool(pool).positions(\n keccak256(abi.encodePacked(address(this), _TICK_LOWER, _TICK_UPPER))\n );\n (amount0, amount1) = IUniswapV3Pool(pool).collect(governance, _TICK_LOWER, _TICK_UPPER, tokensOwed0, tokensOwed1);\n }\n\n /// @inheritdoc IUniV3PairManager\n function position()\n external\n view\n override\n returns (\n uint128 liquidity,\n uint256 feeGrowthInside0LastX128,\n uint256 feeGrowthInside1LastX128,\n uint128 tokensOwed0,\n uint128 tokensOwed1\n )\n {\n (liquidity, feeGrowthInside0LastX128, feeGrowthInside1LastX128, tokensOwed0, tokensOwed1) = IUniswapV3Pool(pool).positions(\n keccak256(abi.encodePacked(address(this), _TICK_LOWER, _TICK_UPPER))\n );\n }\n\n /// @inheritdoc IERC20\n function approve(address spender, uint256 amount) external override returns (bool) {\n allowance[msg.sender][spender] = amount;\n\n emit Approval(msg.sender, spender, amount);\n return true;\n }\n\n /// @inheritdoc IERC20\n function transfer(address to, uint256 amount) external override returns (bool) {\n _transferTokens(msg.sender, to, amount);\n return true;\n }\n\n /// @inheritdoc IERC20\n function transferFrom(\n address from,\n address to,\n uint256 amount\n ) external override returns (bool) {\n address spender = msg.sender;\n uint256 spenderAllowance = allowance[from][spender];\n\n if (spender != from && spenderAllowance != type(uint256).max) {\n uint256 newAllowance = spenderAllowance - amount;\n allowance[from][spender] = newAllowance;\n\n emit Approval(from, spender, newAllowance);\n }\n\n _transferTokens(from, to, amount);\n return true;\n }\n\n /// @notice Adds liquidity to an initialized pool\n /// @dev Reverts if the returned amount0 is less than amount0Min or if amount1 is less than amount1Min\n /// @dev This function calls the mint function of the corresponding Uniswap pool, which in turn calls UniswapV3Callback\n /// @param amount0Desired The amount of token0 we would like to provide\n /// @param amount1Desired The amount of token1 we would like to provide\n /// @param amount0Min The minimum amount of token0 we want to provide\n /// @param amount1Min The minimum amount of token1 we want to provide\n /// @return liquidity The calculated liquidity we get for the token amounts we provided\n /// @return amount0 The amount of token0 we ended up providing\n /// @return amount1 The amount of token1 we ended up providing\n function _addLiquidity(\n uint256 amount0Desired,\n uint256 amount1Desired,\n uint256 amount0Min,\n uint256 amount1Min\n )\n internal\n returns (\n uint128 liquidity,\n uint256 amount0,\n uint256 amount1\n )\n {\n (uint160 sqrtPriceX96, , , , , , ) = IUniswapV3Pool(pool).slot0();\n\n liquidity = LiquidityAmounts.getLiquidityForAmounts(sqrtPriceX96, sqrtRatioAX96, sqrtRatioBX96, amount0Desired, amount1Desired);\n\n (amount0, amount1) = IUniswapV3Pool(pool).mint(\n address(this),\n _TICK_LOWER,\n _TICK_UPPER,\n liquidity,\n abi.encode(MintCallbackData({_poolKey: _poolKey, payer: msg.sender}))\n );\n\n if (amount0 < amount0Min || amount1 < amount1Min) revert ExcessiveSlippage();\n }\n\n /// @notice Transfers the passed-in token from the payer to the recipient for the corresponding value\n /// @param token The token to be transferred to the recipient\n /// @param from The address of the payer\n /// @param to The address of the passed-in tokens recipient\n /// @param value How much of that token to be transferred from payer to the recipient\n function _pay(\n address token,\n address from,\n address to,\n uint256 value\n ) internal {\n _safeTransferFrom(token, from, to, value);\n }\n\n /// @notice Mints Keep3r credits to the passed-in address of recipient and increases total supply of Keep3r credits by the corresponding amount\n /// @param to The recipient of the Keep3r credits\n /// @param amount The amount Keep3r credits to be minted to the recipient\n function _mint(address to, uint256 amount) internal {\n totalSupply += amount;\n balanceOf[to] += amount;\n emit Transfer(address(0), to, amount);\n }\n\n /// @notice Burns Keep3r credits to the passed-in address of recipient and reduces total supply of Keep3r credits by the corresponding amount\n /// @param to The address that will get its Keep3r credits burned\n /// @param amount The amount Keep3r credits to be burned from the recipient/recipient\n function _burn(address to, uint256 amount) internal {\n totalSupply -= amount;\n balanceOf[to] -= amount;\n emit Transfer(to, address(0), amount);\n }\n\n /// @notice Transfers amount of Keep3r credits between two addresses\n /// @param from The user that transfers the Keep3r credits\n /// @param to The user that receives the Keep3r credits\n /// @param amount The amount of Keep3r credits to be transferred\n function _transferTokens(\n address from,\n address to,\n uint256 amount\n ) internal {\n balanceOf[from] -= amount;\n balanceOf[to] += amount;\n\n emit Transfer(from, to, amount);\n }\n\n /// @notice Transfers the passed-in token from the specified \"from\" to the specified \"to\" for the corresponding value\n /// @dev Reverts with IUniV3PairManager#UnsuccessfulTransfer if the transfer was not successful,\n /// or if the passed data length is different than 0 and the decoded data is not a boolean\n /// @param token The token to be transferred to the specified \"to\"\n /// @param from The address which is going to transfer the tokens\n /// @param value How much of that token to be transferred from \"from\" to \"to\"\n function _safeTransferFrom(\n address token,\n address from,\n address to,\n uint256 value\n ) internal {\n // solhint-disable-next-line avoid-low-level-calls\n (bool success, bytes memory data) = token.call(abi.encodeWithSelector(IERC20.transferFrom.selector, from, to, value));\n if (!success || (data.length != 0 && !abi.decode(data, (bool)))) revert UnsuccessfulTransfer();\n }\n}\n" - }, - "solidity/interfaces/external/IWeth9.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '@openzeppelin/contracts/token/ERC20/IERC20.sol';\n\ninterface IWeth9 is IERC20 {\n function deposit() external payable;\n\n function withdraw(uint256) external;\n}\n" - }, - "solidity/interfaces/IUniV3PairManager.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.0 <0.9.0;\n\nimport './IPairManager.sol';\nimport '../contracts/libraries/PoolAddress.sol';\nimport '@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol';\nimport './peripherals/IGovernable.sol';\n\n/// @title Pair Manager contract\n/// @notice Creates a UniswapV3 position, and tokenizes in an ERC20 manner\n/// so that the user can use it as liquidity for a Keep3rJob\ninterface IUniV3PairManager is IGovernable, IPairManager {\n // Structs\n\n /// @notice The data to be decoded by the UniswapV3MintCallback function\n struct MintCallbackData {\n PoolAddress.PoolKey _poolKey; // Struct that contains token0, token1, and fee of the pool passed into the constructor\n address payer; // The address of the payer, which will be the msg.sender of the mint function\n }\n\n // Variables\n\n /// @notice The fee of the Uniswap pool passed into the constructor\n /// @return _fee The fee of the Uniswap pool passed into the constructor\n function fee() external view returns (uint24 _fee);\n\n /// @notice The sqrtRatioAX96 at the lowest tick (-887200) of the Uniswap pool\n /// @return _sqrtPriceA96 A Fixed point Q64.96 number representing the sqrt of the ratio of the two assets (token1/token0)\n /// at the lowest tick\n function sqrtRatioAX96() external view returns (uint160 _sqrtPriceA96);\n\n /// @notice The sqrtRatioBX96 at the highest tick (887200) of the Uniswap pool\n /// @return _sqrtPriceBX96 A Fixed point Q64.96 number representing the sqrt of the ratio of the two assets (token1/token0)\n /// at the highest tick\n function sqrtRatioBX96() external view returns (uint160 _sqrtPriceBX96);\n\n // Errors\n\n /// @notice Throws when the caller of the function is not the pool\n error OnlyPool();\n\n /// @notice Throws when the slippage exceeds what the user is comfortable with\n error ExcessiveSlippage();\n\n /// @notice Throws when a transfer is unsuccessful\n error UnsuccessfulTransfer();\n\n // Methods\n\n /// @notice This function is called after a user calls IUniV3PairManager#mint function\n /// It ensures that any tokens owed to the pool are paid by the msg.sender of IUniV3PairManager#mint function\n /// @param amount0Owed The amount of token0 due to the pool for the minted liquidity\n /// @param amount1Owed The amount of token1 due to the pool for the minted liquidity\n /// @param data The encoded token0, token1, fee (_poolKey) and the payer (msg.sender) of the IUniV3PairManager#mint function\n function uniswapV3MintCallback(\n uint256 amount0Owed,\n uint256 amount1Owed,\n bytes calldata data\n ) external;\n\n /// @notice Mints kLP tokens to an address according to the liquidity the msg.sender provides to the UniswapV3 pool\n /// @dev Triggers UniV3PairManager#uniswapV3MintCallback\n /// @param amount0Desired The amount of token0 we would like to provide\n /// @param amount1Desired The amount of token1 we would like to provide\n /// @param amount0Min The minimum amount of token0 we want to provide\n /// @param amount1Min The minimum amount of token1 we want to provide\n /// @param to The address to which the kLP tokens are going to be minted to\n /// @return liquidity kLP tokens sent in exchange for the provision of tokens\n function mint(\n uint256 amount0Desired,\n uint256 amount1Desired,\n uint256 amount0Min,\n uint256 amount1Min,\n address to\n ) external returns (uint128 liquidity);\n\n /// @notice Returns the pair manager's position in the corresponding UniswapV3 pool\n /// @return liquidity The amount of liquidity provided to the UniswapV3 pool by the pair manager\n /// @return feeGrowthInside0LastX128 The fee growth of token0 as of the last action on the individual position\n /// @return feeGrowthInside1LastX128 The fee growth of token1 as of the last action on the individual position\n /// @return tokensOwed0 The uncollected amount of token0 owed to the position as of the last computation\n /// @return tokensOwed1 The uncollected amount of token1 owed to the position as of the last computation\n function position()\n external\n view\n returns (\n uint128 liquidity,\n uint256 feeGrowthInside0LastX128,\n uint256 feeGrowthInside1LastX128,\n uint128 tokensOwed0,\n uint128 tokensOwed1\n );\n\n /// @notice Calls the UniswapV3 pool's collect function, which collects up to a maximum amount of fees\n // owed to a specific position to the recipient, in this case, that recipient is the pair manager\n /// @dev The collected fees will be sent to governance\n /// @return amount0 The amount of fees collected in token0\n /// @return amount1 The amount of fees collected in token1\n function collect() external returns (uint256 amount0, uint256 amount1);\n\n /// @notice Burns the corresponding amount of kLP tokens from the msg.sender and withdraws the specified liquidity\n // in the entire range\n /// @param liquidity The amount of liquidity to be burned\n /// @param amount0Min The minimum amount of token0 we want to send to the recipient (to)\n /// @param amount1Min The minimum amount of token1 we want to send to the recipient (to)\n /// @param to The address that will receive the due fees\n /// @return amount0 The calculated amount of token0 that will be sent to the recipient\n /// @return amount1 The calculated amount of token1 that will be sent to the recipient\n function burn(\n uint128 liquidity,\n uint256 amount0Min,\n uint256 amount1Min,\n address to\n ) external returns (uint256 amount0, uint256 amount1);\n}\n" - }, - "@openzeppelin/contracts/utils/Context.sol": { - "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Provides information about the current execution context, including the\n * sender of the transaction and its data. While these are generally available\n * via msg.sender and msg.data, they should not be accessed in such a direct\n * manner, since when dealing with meta-transactions the account sending and\n * paying for execution may not be the actual sender (as far as an application\n * is concerned).\n *\n * This contract is only required for intermediate, library-like contracts.\n */\nabstract contract Context {\n function _msgSender() internal view virtual returns (address) {\n return msg.sender;\n }\n\n function _msgData() internal view virtual returns (bytes calldata) {\n return msg.data;\n }\n}\n" - }, - "solidity/interfaces/IPairManagerFactory.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.0 <0.9.0;\n\nimport './peripherals/IGovernable.sol';\n\n/// @title Factory of Pair Managers\n/// @notice This contract creates new pair managers\ninterface IPairManagerFactory is IGovernable {\n // Variables\n\n /// @notice Maps the address of a Uniswap pool, to the address of the corresponding PairManager\n /// For example, the uniswap address of DAI-WETH, will return the Keep3r/DAI-WETH pair manager address\n /// @param _pool The address of the Uniswap pool\n /// @return _pairManager The address of the corresponding pair manager\n function pairManagers(address _pool) external view returns (address _pairManager);\n\n // Events\n\n /// @notice Emitted when a new pair manager is created\n /// @param _pool The address of the corresponding Uniswap pool\n /// @param _pairManager The address of the just-created pair manager\n event PairCreated(address _pool, address _pairManager);\n\n // Errors\n\n /// @notice Throws an error if the pair manager is already initialized\n error AlreadyInitialized();\n\n /// @notice Throws an error if the caller is not the owner\n error OnlyOwner();\n\n // Methods\n\n /// @notice Creates a new pair manager based on the address of a Uniswap pool\n /// For example, the uniswap address of DAI-WETH, will create the Keep3r/DAI-WETH pool\n /// @param _pool The address of the Uniswap pool the pair manager will be based of\n /// @return _pairManager The address of the just-created pair manager\n function createPairManager(address _pool) external returns (address _pairManager);\n}\n" - }, - "solidity/contracts/UniV3PairManagerFactory.sol": { - "content": "// SPDX-License-Identifier: MIT\n\n/*\n\nCoded for The Keep3r Network with ♥ by\n\n██████╗░███████╗███████╗██╗  ░██╗░░░░░░░██╗░█████╗░███╗░░██╗██████╗░███████╗██████╗░██╗░░░░░░█████╗░███╗░░██╗██████╗░\n██╔══██╗██╔════╝██╔════╝██║  ░██║░░██╗░░██║██╔══██╗████╗░██║██╔══██╗██╔════╝██╔══██╗██║░░░░░██╔══██╗████╗░██║██╔══██╗\n██║░░██║█████╗░░█████╗░░██║  ░╚██╗████╗██╔╝██║░░██║██╔██╗██║██║░░██║█████╗░░██████╔╝██║░░░░░███████║██╔██╗██║██║░░██║\n██║░░██║██╔══╝░░██╔══╝░░██║  ░░████╔═████║░██║░░██║██║╚████║██║░░██║██╔══╝░░██╔══██╗██║░░░░░██╔══██║██║╚████║██║░░██║\n██████╔╝███████╗██║░░░░░██║  ░░╚██╔╝░╚██╔╝░╚█████╔╝██║░╚███║██████╔╝███████╗██║░░██║███████╗██║░░██║██║░╚███║██████╔╝\n╚═════╝░╚══════╝╚═╝░░░░░╚═╝  ░░░╚═╝░░░╚═╝░░░╚════╝░╚═╝░░╚══╝╚═════╝░╚══════╝╚═╝░░╚═╝╚══════╝╚═╝░░╚═╝╚═╝░░╚══╝╚═════╝░\n\nhttps://defi.sucks\n\n*/\n\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../interfaces/IPairManagerFactory.sol';\nimport './UniV3PairManager.sol';\nimport './peripherals/Governable.sol';\n\n/// @title Factory of Pair Managers\n/// @notice This contract creates new pair managers\ncontract UniV3PairManagerFactory is IPairManagerFactory, Governable {\n mapping(address => address) public override pairManagers;\n\n constructor() Governable(msg.sender) {}\n\n ///@inheritdoc IPairManagerFactory\n function createPairManager(address _pool) external override returns (address _pairManager) {\n if (pairManagers[_pool] != address(0)) revert AlreadyInitialized();\n _pairManager = address(new UniV3PairManager(_pool, governance));\n pairManagers[_pool] = _pairManager;\n emit PairCreated(_pool, _pairManager);\n }\n}\n" - }, - "solidity/for-test/peripherals/GovernableForTest.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../../contracts/peripherals/Governable.sol';\n\ncontract GovernableForTest is Governable {\n constructor(address _governor) Governable(_governor) {}\n}\n" - }, - "solidity/for-test/ERC20ForTest.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.0 <0.9.0;\n\nimport '@openzeppelin/contracts/token/ERC20/ERC20.sol';\n\ncontract ERC20ForTest is ERC20 {\n constructor(\n string memory _name,\n string memory _symbol,\n address _initialAccount,\n uint256 _initialBalance\n ) ERC20(_name, _symbol) {\n _mint(_initialAccount, _initialBalance);\n }\n\n function mint(address _account, uint256 _amount) public {\n _mint(_account, _amount);\n }\n\n function burn(address _account, uint256 _amount) public {\n _burn(_account, _amount);\n }\n\n function transferInternal(\n address _from,\n address _to,\n uint256 _value\n ) public {\n _transfer(_from, _to, _value);\n }\n\n function approveInternal(\n address _owner,\n address _spender,\n uint256 _value\n ) public {\n _approve(_owner, _spender, _value);\n }\n\n function deposit(uint256 _amount) external payable {\n // Function added for compatibility with WETH\n }\n}\n" - }, - "solidity/for-test/peripherals/keepers/Keep3rKeeperFundableForTest.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../../../contracts/peripherals/keepers/Keep3rKeeperFundable.sol';\n\ncontract Keep3rKeeperFundableForTest is Keep3rKeeperFundable {\n using EnumerableSet for EnumerableSet.AddressSet;\n\n constructor(\n address _kph,\n address _keep3rV1,\n address _keep3rV1Proxy,\n address _kp3rWethPool\n ) Keep3rParameters(_kph, _keep3rV1, _keep3rV1Proxy, _kp3rWethPool) Keep3rRoles(msg.sender) {}\n\n function isKeeper(address _keeper) external view returns (bool) {\n return _keepers.contains(_keeper);\n }\n\n function setJob(address job) external {\n _jobs.add(job);\n }\n}\n" - }, - "solidity/for-test/peripherals/jobs/Keep3rJobWorkableForTest.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../../../contracts/peripherals/jobs/Keep3rJobWorkable.sol';\n\ncontract Keep3rJobWorkableForTest is Keep3rJobWorkable {\n using EnumerableSet for EnumerableSet.AddressSet;\n\n constructor(\n address _keep3rHelper,\n address _keep3rV1,\n address _keep3rV1Proxy,\n address _kp3rWethPool\n ) Keep3rParameters(_keep3rHelper, _keep3rV1, _keep3rV1Proxy, _kp3rWethPool) Keep3rRoles(msg.sender) {}\n\n function setJob(address _job) external {\n _jobs.add(_job);\n }\n\n function setKeeper(address _keeper) external {\n _keepers.add(_keeper);\n }\n\n function setApprovedLiquidity(address _liquidity) external {\n _approvedLiquidities.add(_liquidity);\n }\n\n function setJobLiquidity(address _job, address _liquidity) external {\n _jobLiquidities[_job].add(_liquidity);\n }\n\n function viewJobLiquidityCredits(address _job) external view returns (uint256) {\n return _jobLiquidityCredits[_job];\n }\n\n function viewJobPeriodCredits(address _job) external view returns (uint256) {\n return _jobPeriodCredits[_job];\n }\n\n function viewTickCache(address _liquidity) external view returns (TickCache memory _tickCache) {\n _tickCache = _tick[_liquidity];\n }\n\n function viewGas() external view returns (uint256) {\n return _initialGas;\n }\n\n receive() external payable {}\n}\n" - }, - "solidity/for-test/peripherals/Keep3rParametersForTest.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../../contracts/peripherals/Keep3rParameters.sol';\n\ncontract Keep3rParametersForTest is Keep3rParameters {\n constructor(\n address _keep3rHelper,\n address _keep3rV1,\n address _keep3rV1Proxy,\n address _kp3rWethPool\n ) Keep3rParameters(_keep3rHelper, _keep3rV1, _keep3rV1Proxy, _kp3rWethPool) Keep3rRoles(msg.sender) {}\n\n function viewLiquidityPool(address _pool) public view returns (address) {\n return _liquidityPool[_pool];\n }\n\n function viewIsKP3RToken0(address _pool) public view returns (bool) {\n return _isKP3RToken0[_pool];\n }\n}\n" - }, - "solidity/for-test/peripherals/Keep3rDisputableForTest.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../../contracts/peripherals/Keep3rDisputable.sol';\n\ncontract Keep3rDisputableForTest is Keep3rDisputable {\n constructor() Keep3rRoles(msg.sender) {}\n}\n" - }, - "solidity/for-test/peripherals/keepers/Keep3rKeeperDisputableForTest.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../../../contracts/peripherals/keepers/Keep3rKeeperDisputable.sol';\n\ncontract Keep3rKeeperDisputableForTest is Keep3rKeeperDisputable {\n using EnumerableSet for EnumerableSet.AddressSet;\n\n constructor(\n address _kph,\n address _keep3rV1,\n address _keep3rV1Proxy,\n address _kp3rWethPool\n ) Keep3rParameters(_kph, _keep3rV1, _keep3rV1Proxy, _kp3rWethPool) Keep3rRoles(msg.sender) {}\n\n function setKeeper(address _keeper) external {\n _keepers.add(_keeper);\n }\n\n function internalSlash(\n address _bonded,\n address _keeper,\n uint256 _amount\n ) external {\n _slash(_bonded, _keeper, _amount);\n }\n\n function isKeeper(address _address) external view returns (bool _isKeeper) {\n _isKeeper = _keepers.contains(_address);\n }\n}\n" - }, - "solidity/for-test/peripherals/jobs/Keep3rJobDisputableForTest.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../../../contracts/peripherals/jobs/Keep3rJobDisputable.sol';\n\ncontract Keep3rJobDisputableForTest is Keep3rJobDisputable {\n using EnumerableSet for EnumerableSet.AddressSet;\n\n constructor(\n address _kph,\n address _keep3rV1,\n address _keep3rV1Proxy,\n address _kp3rWethPool\n ) Keep3rParameters(_kph, _keep3rV1, _keep3rV1Proxy, _kp3rWethPool) Keep3rRoles(msg.sender) {}\n\n function setJobLiquidity(address _job, address _liquidity) external {\n _jobLiquidities[_job].add(_liquidity);\n }\n\n function setJobToken(address _job, address _token) external {\n _jobTokens[_job].add(_token);\n }\n\n function setApprovedLiquidity(address _liquidity) external {\n _approvedLiquidities.add(_liquidity);\n }\n\n function setRevokedLiquidity(address _liquidity) external {\n _approvedLiquidities.remove(_liquidity);\n }\n\n function internalJobLiquidityCredits(address _job) external view returns (uint256 _credits) {\n _credits = _jobLiquidityCredits[_job];\n }\n\n function internalJobPeriodCredits(address _job) external view returns (uint256 _credits) {\n _credits = _jobPeriodCredits[_job];\n }\n\n function internalJobTokens(address _job) external view returns (address[] memory _tokens) {\n _tokens = new address[](_jobTokens[_job].length());\n for (uint256 i; i < _jobTokens[_job].length(); i++) {\n _tokens[i] = _jobTokens[_job].at(i);\n }\n }\n\n function internalJobLiquidities(address _job) external view returns (address[] memory _tokens) {\n _tokens = new address[](_jobLiquidities[_job].length());\n for (uint256 i; i < _jobLiquidities[_job].length(); i++) {\n _tokens[i] = _jobLiquidities[_job].at(i);\n }\n }\n}\n" - }, - "solidity/for-test/peripherals/jobs/Keep3rJobFundableCreditsForTest.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../../../contracts/peripherals/jobs/Keep3rJobFundableCredits.sol';\n\ncontract Keep3rJobFundableCreditsForTest is Keep3rJobFundableCredits {\n using EnumerableSet for EnumerableSet.AddressSet;\n\n constructor(\n address _kph,\n address _keep3rV1,\n address _keep3rV1Proxy,\n address _kp3rWethPool\n ) Keep3rParameters(_kph, _keep3rV1, _keep3rV1Proxy, _kp3rWethPool) Keep3rRoles(msg.sender) {}\n\n function setJob(address _job, address _jobOwner) external {\n _jobs.add(_job);\n jobOwner[_job] = _jobOwner;\n }\n\n function setJobToken(address _job, address _token) external {\n _jobTokens[_job].add(_token);\n }\n\n function isJobToken(address _job, address _token) external view returns (bool _contains) {\n _contains = _jobTokens[_job].contains(_token);\n }\n}\n" - }, - "solidity/for-test/peripherals/Keep3rAccountanceForTest.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../../contracts/peripherals/Keep3rAccountance.sol';\n\ncontract Keep3rAccountanceForTest is Keep3rAccountance {\n using EnumerableSet for EnumerableSet.AddressSet;\n\n function setJob(address job) external {\n _jobs.add(job);\n }\n\n function setKeeper(address keeper) external {\n _keepers.add(keeper);\n }\n}\n" - }, - "solidity/for-test/peripherals/jobs/Keep3rJobOwnershipForTest.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../../../contracts/peripherals/jobs/Keep3rJobOwnership.sol';\n\ncontract Keep3rJobOwnershipForTest is Keep3rJobOwnership {}\n" - }, - "solidity/for-test/libraries/LiquidityAmountsForTest.sol": { - "content": "// SPDX-License-Identifier: GPL-2.0-or-later\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../../contracts/libraries/FullMath.sol';\nimport '../../contracts/libraries/FixedPoint96.sol';\n\n/// @dev Made this library into a contract to be able to calculate liquidity more precisely for tests\n\n// solhint-disable\ncontract LiquidityAmountsForTest {\n function toUint128(uint256 x) private pure returns (uint128 y) {\n require((y = uint128(x)) == x);\n }\n\n function getLiquidityForAmount0(\n uint160 sqrtRatioAX96,\n uint160 sqrtRatioBX96,\n uint256 amount0\n ) public pure returns (uint128 liquidity) {\n if (sqrtRatioAX96 > sqrtRatioBX96) (sqrtRatioAX96, sqrtRatioBX96) = (sqrtRatioBX96, sqrtRatioAX96);\n uint256 intermediate = FullMath.mulDiv(sqrtRatioAX96, sqrtRatioBX96, FixedPoint96.Q96);\n return toUint128(FullMath.mulDiv(amount0, intermediate, sqrtRatioBX96 - sqrtRatioAX96));\n }\n\n function getLiquidityForAmount1(\n uint160 sqrtRatioAX96,\n uint160 sqrtRatioBX96,\n uint256 amount1\n ) public pure returns (uint128 liquidity) {\n if (sqrtRatioAX96 > sqrtRatioBX96) (sqrtRatioAX96, sqrtRatioBX96) = (sqrtRatioBX96, sqrtRatioAX96);\n return toUint128(FullMath.mulDiv(amount1, FixedPoint96.Q96, sqrtRatioBX96 - sqrtRatioAX96));\n }\n\n function getLiquidityForAmounts(\n uint160 sqrtRatioX96,\n uint160 sqrtRatioAX96,\n uint160 sqrtRatioBX96,\n uint256 amount0,\n uint256 amount1\n ) external pure returns (uint128 liquidity) {\n if (sqrtRatioAX96 > sqrtRatioBX96) (sqrtRatioAX96, sqrtRatioBX96) = (sqrtRatioBX96, sqrtRatioAX96);\n\n if (sqrtRatioX96 <= sqrtRatioAX96) {\n liquidity = getLiquidityForAmount0(sqrtRatioAX96, sqrtRatioBX96, amount0);\n } else if (sqrtRatioX96 < sqrtRatioBX96) {\n uint128 liquidity0 = getLiquidityForAmount0(sqrtRatioX96, sqrtRatioBX96, amount0);\n uint128 liquidity1 = getLiquidityForAmount1(sqrtRatioAX96, sqrtRatioX96, amount1);\n\n liquidity = liquidity0 < liquidity1 ? liquidity0 : liquidity1;\n } else {\n liquidity = getLiquidityForAmount1(sqrtRatioAX96, sqrtRatioBX96, amount1);\n }\n }\n\n function getAmount0ForLiquidity(\n uint160 sqrtRatioAX96,\n uint160 sqrtRatioBX96,\n uint128 liquidity\n ) public pure returns (uint256 amount0) {\n if (sqrtRatioAX96 > sqrtRatioBX96) (sqrtRatioAX96, sqrtRatioBX96) = (sqrtRatioBX96, sqrtRatioAX96);\n\n return FullMath.mulDiv(uint256(liquidity) << FixedPoint96.RESOLUTION, sqrtRatioBX96 - sqrtRatioAX96, sqrtRatioBX96) / sqrtRatioAX96;\n }\n\n function getAmount1ForLiquidity(\n uint160 sqrtRatioAX96,\n uint160 sqrtRatioBX96,\n uint128 liquidity\n ) public pure returns (uint256 amount1) {\n if (sqrtRatioAX96 > sqrtRatioBX96) (sqrtRatioAX96, sqrtRatioBX96) = (sqrtRatioBX96, sqrtRatioAX96);\n\n return FullMath.mulDiv(liquidity, sqrtRatioBX96 - sqrtRatioAX96, FixedPoint96.Q96);\n }\n\n function getAmountsForLiquidity(\n uint160 sqrtRatioX96,\n uint160 sqrtRatioAX96,\n uint160 sqrtRatioBX96,\n uint128 liquidity\n ) external pure returns (uint256 amount0, uint256 amount1) {\n if (sqrtRatioAX96 > sqrtRatioBX96) (sqrtRatioAX96, sqrtRatioBX96) = (sqrtRatioBX96, sqrtRatioAX96);\n\n if (sqrtRatioX96 <= sqrtRatioAX96) {\n amount0 = getAmount0ForLiquidity(sqrtRatioAX96, sqrtRatioBX96, liquidity);\n } else if (sqrtRatioX96 < sqrtRatioBX96) {\n amount0 = getAmount0ForLiquidity(sqrtRatioX96, sqrtRatioBX96, liquidity);\n amount1 = getAmount1ForLiquidity(sqrtRatioAX96, sqrtRatioX96, liquidity);\n } else {\n amount1 = getAmount1ForLiquidity(sqrtRatioAX96, sqrtRatioBX96, liquidity);\n }\n }\n}\n" - }, - "solidity/for-test/IUniswapV3PoolForTest.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '@uniswap/v3-core/contracts/interfaces/IERC20Minimal.sol';\nimport '@uniswap/v3-core/contracts/interfaces/IUniswapV3Pool.sol';\n\n// solhint-disable-next-line no-empty-blocks\ninterface IUniswapV3PoolForTest is IERC20Minimal, IUniswapV3Pool {\n\n}\n" - }, - "@uniswap/v3-core/contracts/interfaces/IERC20Minimal.sol": { - "content": "// SPDX-License-Identifier: GPL-2.0-or-later\npragma solidity >=0.5.0;\n\n/// @title Minimal ERC20 interface for Uniswap\n/// @notice Contains a subset of the full ERC20 interface that is used in Uniswap V3\ninterface IERC20Minimal {\n /// @notice Returns the balance of a token\n /// @param account The account for which to look up the number of tokens it has, i.e. its balance\n /// @return The number of tokens held by the account\n function balanceOf(address account) external view returns (uint256);\n\n /// @notice Transfers the amount of token from the `msg.sender` to the recipient\n /// @param recipient The account that will receive the amount transferred\n /// @param amount The number of tokens to send from the sender to the recipient\n /// @return Returns true for a successful transfer, false for an unsuccessful transfer\n function transfer(address recipient, uint256 amount) external returns (bool);\n\n /// @notice Returns the current allowance given to a spender by an owner\n /// @param owner The account of the token owner\n /// @param spender The account of the token spender\n /// @return The current allowance granted by `owner` to `spender`\n function allowance(address owner, address spender) external view returns (uint256);\n\n /// @notice Sets the allowance of a spender from the `msg.sender` to the value `amount`\n /// @param spender The account which will be allowed to spend a given amount of the owners tokens\n /// @param amount The amount of tokens allowed to be used by `spender`\n /// @return Returns true for a successful approval, false for unsuccessful\n function approve(address spender, uint256 amount) external returns (bool);\n\n /// @notice Transfers `amount` tokens from `sender` to `recipient` up to the allowance given to the `msg.sender`\n /// @param sender The account from which the transfer will be initiated\n /// @param recipient The recipient of the transfer\n /// @param amount The amount of the transfer\n /// @return Returns true for a successful transfer, false for unsuccessful\n function transferFrom(\n address sender,\n address recipient,\n uint256 amount\n ) external returns (bool);\n\n /// @notice Event emitted when tokens are transferred from one address to another, either via `#transfer` or `#transferFrom`.\n /// @param from The account from which the tokens were sent, i.e. the balance decreased\n /// @param to The account to which the tokens were sent, i.e. the balance increased\n /// @param value The amount of tokens that were transferred\n event Transfer(address indexed from, address indexed to, uint256 value);\n\n /// @notice Event emitted when the approval amount for the spender of a given owner's tokens changes.\n /// @param owner The account that approved spending of its tokens\n /// @param spender The account for which the spending allowance was modified\n /// @param value The new allowance from the owner to the spender\n event Approval(address indexed owner, address indexed spender, uint256 value);\n}\n" - } - }, - "settings": { - "optimizer": { - "enabled": true, - "runs": 200 - }, - "outputSelection": { - "*": { - "*": [ - "storageLayout", - "abi", - "evm.bytecode", - "evm.deployedBytecode", - "evm.methodIdentifiers", - "metadata", - "devdoc", - "userdoc", - "evm.gasEstimates" - ], - "": [ - "ast" - ] - } - }, - "metadata": { - "useLiteralContent": true - }, - "libraries": { - "": { - "__CACHE_BREAKER__": "0x00000000d41867734bbee4c6863d9255b2b06ac1" - } - } - } -} \ No newline at end of file diff --git a/deployments/optimisticEthereum/solcInputs/aa1ee30f4d8e78611039940e35c6db8b.json b/deployments/optimisticEthereum/solcInputs/aa1ee30f4d8e78611039940e35c6db8b.json deleted file mode 100644 index 64ef992..0000000 --- a/deployments/optimisticEthereum/solcInputs/aa1ee30f4d8e78611039940e35c6db8b.json +++ /dev/null @@ -1,331 +0,0 @@ -{ - "language": "Solidity", - "sources": { - "solidity/contracts/Keep3r.sol": { - "content": "// SPDX-License-Identifier: MIT\n\n/*\n\nCoded for The Keep3r Network with ♥ by\n\n██████╗░███████╗███████╗██╗░░░██╗░░░░░░░██╗░█████╗░███╗░░██╗██████╗░███████╗██████╗░██╗░░░░░░█████╗░███╗░░██╗██████╗░\n██╔══██╗██╔════╝██╔════╝██║░░░██║░░██╗░░██║██╔══██╗████╗░██║██╔══██╗██╔════╝██╔══██╗██║░░░░░██╔══██╗████╗░██║██╔══██╗\n██║░░██║█████╗░░█████╗░░██║░░░╚██╗████╗██╔╝██║░░██║██╔██╗██║██║░░██║█████╗░░██████╔╝██║░░░░░███████║██╔██╗██║██║░░██║\n██║░░██║██╔══╝░░██╔══╝░░██║░░░░████╔═████║░██║░░██║██║╚████║██║░░██║██╔══╝░░██╔══██╗██║░░░░░██╔══██║██║╚████║██║░░██║\n██████╔╝███████╗██║░░░░░██║░░░░╚██╔╝░╚██╔╝░╚█████╔╝██║░╚███║██████╔╝███████╗██║░░██║███████╗██║░░██║██║░╚███║██████╔╝\n╚═════╝░╚══════╝╚═╝░░░░░╚═╝░░░░░╚═╝░░░╚═╝░░░╚════╝░╚═╝░░╚══╝╚═════╝░╚══════╝╚═╝░░╚═╝╚══════╝╚═╝░░╚═╝╚═╝░░╚══╝╚═════╝░\n\nhttps://defi.sucks\n\n*/\n\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../interfaces/IKeep3r.sol';\nimport './peripherals/jobs/Keep3rJobs.sol';\nimport './peripherals/keepers/Keep3rKeepers.sol';\nimport './peripherals/DustCollector.sol';\n\ncontract Keep3r is IKeep3r, Keep3rJobs, Keep3rKeepers {\n constructor(\n address _governance,\n address _keep3rHelper,\n address _keep3rV1,\n address _keep3rV1Proxy\n ) Keep3rParameters(_keep3rHelper, _keep3rV1, _keep3rV1Proxy) Keep3rRoles(_governance) {}\n}\n" - }, - "solidity/interfaces/IKeep3r.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport './peripherals/IKeep3rJobs.sol';\nimport './peripherals/IKeep3rKeepers.sol';\nimport './peripherals/IKeep3rParameters.sol';\n\n// solhint-disable-next-line no-empty-blocks\n\n/// @title Keep3rV2 contract\n/// @notice This contract inherits all the functionality of Keep3rV2\ninterface IKeep3r is IKeep3rJobs, IKeep3rKeepers, IKeep3rParameters {\n\n}\n" - }, - "solidity/contracts/peripherals/jobs/Keep3rJobs.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../../../interfaces/peripherals/IKeep3rJobs.sol';\nimport './Keep3rJobManager.sol';\nimport './Keep3rJobWorkable.sol';\nimport './Keep3rJobDisputable.sol';\n\nabstract contract Keep3rJobs is IKeep3rJobs, Keep3rJobManager, Keep3rJobWorkable, Keep3rJobDisputable {}\n" - }, - "solidity/contracts/peripherals/keepers/Keep3rKeepers.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../../../interfaces/peripherals/IKeep3rKeepers.sol';\nimport './Keep3rKeeperDisputable.sol';\n\nabstract contract Keep3rKeepers is IKeep3rKeepers, Keep3rKeeperDisputable {}\n" - }, - "solidity/contracts/peripherals/DustCollector.sol": { - "content": "// SPDX-License-Identifier: MIT\n\npragma solidity >=0.8.4 <0.9.0;\n\nimport '@openzeppelin/contracts/token/ERC20/IERC20.sol';\nimport '@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol';\nimport '../../contracts/peripherals/Governable.sol';\nimport '../../interfaces/peripherals/IDustCollector.sol';\n\nabstract contract DustCollector is IDustCollector, Governable {\n using SafeERC20 for IERC20;\n\n address internal constant _ETH_ADDRESS = 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE;\n\n function sendDust(\n address _token,\n uint256 _amount,\n address _to\n ) external override onlyGovernance {\n if (_to == address(0)) revert ZeroAddress();\n if (_token == _ETH_ADDRESS) {\n payable(_to).transfer(_amount);\n } else {\n IERC20(_token).safeTransfer(_to, _amount);\n }\n emit DustSent(_token, _amount, _to);\n }\n}\n" - }, - "solidity/interfaces/peripherals/IKeep3rJobs.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport './IKeep3rDisputable.sol';\n\n/// @title Keep3rJobOwnership contract\n/// @notice Handles the ownership of the jobs\ninterface IKeep3rJobOwnership {\n // Events\n\n /// @notice Emitted when Keep3rJobOwnership#changeJobOwnership is called\n /// @param _job The address of the job proposed to have a change of owner\n /// @param _owner The current owner of the job\n /// @param _pendingOwner The new address proposed to be the owner of the job\n event JobOwnershipChange(address indexed _job, address indexed _owner, address indexed _pendingOwner);\n\n /// @notice Emitted when Keep3rJobOwnership#JobOwnershipAssent is called\n /// @param _job The address of the job which the proposed owner will now own\n /// @param _previousOwner The previous owner of the job\n /// @param _newOwner The new owner of the job\n event JobOwnershipAssent(address indexed _job, address indexed _previousOwner, address indexed _newOwner);\n\n // Errors\n\n /// @notice Throws when the caller of the function is not the job owner\n error OnlyJobOwner();\n\n /// @notice Throws when the caller of the function is not the pending job owner\n error OnlyPendingJobOwner();\n\n // Variables\n\n /// @notice Maps the job to the owner of the job\n /// @param _job The address of the job\n /// @return _owner The address of the owner of the job\n function jobOwner(address _job) external view returns (address _owner);\n\n /// @notice Maps the job to its pending owner\n /// @param _job The address of the job\n /// @return _pendingOwner The address of the pending owner of the job\n function jobPendingOwner(address _job) external view returns (address _pendingOwner);\n\n // Methods\n\n /// @notice Proposes a new address to be the owner of the job\n /// @param _job The address of the job\n /// @param _newOwner The address of the proposed new owner\n function changeJobOwnership(address _job, address _newOwner) external;\n\n /// @notice The proposed address accepts to be the owner of the job\n /// @param _job The address of the job\n function acceptJobOwnership(address _job) external;\n}\n\n/// @title Keep3rJobManager contract\n/// @notice Handles the addition and withdrawal of credits from a job\ninterface IKeep3rJobManager is IKeep3rJobOwnership {\n // Events\n\n /// @notice Emitted when Keep3rJobManager#addJob is called\n /// @param _job The address of the job to add\n /// @param _jobOwner The job's owner\n event JobAddition(address indexed _job, address indexed _jobOwner);\n\n // Errors\n\n /// @notice Throws when trying to add a job that has already been added\n error JobAlreadyAdded();\n\n /// @notice Throws when the address that is trying to register as a keeper is already a keeper\n error AlreadyAKeeper();\n\n // Methods\n\n /// @notice Allows any caller to add a new job\n /// @param _job Address of the contract for which work should be performed\n function addJob(address _job) external;\n}\n\n/// @title Keep3rJobFundableCredits contract\n/// @notice Handles the addition and withdrawal of credits from a job\ninterface IKeep3rJobFundableCredits is IKeep3rJobOwnership {\n // Events\n\n /// @notice Emitted when Keep3rJobFundableCredits#addTokenCreditsToJob is called\n /// @param _job The address of the job being credited\n /// @param _token The address of the token being provided\n /// @param _provider The user that calls the function\n /// @param _amount The amount of credit being added to the job\n event TokenCreditAddition(address indexed _job, address indexed _token, address indexed _provider, uint256 _amount);\n\n /// @notice Emitted when Keep3rJobFundableCredits#withdrawTokenCreditsFromJob is called\n /// @param _job The address of the job from which the credits are withdrawn\n /// @param _token The credit being withdrawn from the job\n /// @param _receiver The user that receives the tokens\n /// @param _amount The amount of credit withdrawn\n event TokenCreditWithdrawal(address indexed _job, address indexed _token, address indexed _receiver, uint256 _amount);\n\n // Errors\n\n /// @notice Throws when the token is KP3R, as it should not be used for direct token payments\n error TokenUnallowed();\n\n /// @notice Throws when the token withdraw cooldown has not yet passed\n error JobTokenCreditsLocked();\n\n /// @notice Throws when the user tries to withdraw more tokens than it has\n error InsufficientJobTokenCredits();\n\n // Variables\n\n /// @notice Last block where tokens were added to the job\n /// @param _job The address of the job credited\n /// @param _token The address of the token credited\n /// @return _timestamp The last block where tokens were added to the job\n function jobTokenCreditsAddedAt(address _job, address _token) external view returns (uint256 _timestamp);\n\n // Methods\n\n /// @notice Add credit to a job to be paid out for work\n /// @param _job The address of the job being credited\n /// @param _token The address of the token being credited\n /// @param _amount The amount of credit being added\n function addTokenCreditsToJob(\n address _job,\n address _token,\n uint256 _amount\n ) external;\n\n /// @notice Withdraw credit from a job\n /// @param _job The address of the job from which the credits are withdrawn\n /// @param _token The address of the token being withdrawn\n /// @param _amount The amount of token to be withdrawn\n /// @param _receiver The user that will receive tokens\n function withdrawTokenCreditsFromJob(\n address _job,\n address _token,\n uint256 _amount,\n address _receiver\n ) external;\n}\n\n/// @title Keep3rJobFundableLiquidity contract\n/// @notice Handles the funding of jobs through specific liquidity pairs\ninterface IKeep3rJobFundableLiquidity is IKeep3rJobOwnership {\n // Events\n\n /// @notice Emitted when Keep3rJobFundableLiquidity#approveLiquidity function is called\n /// @param _liquidity The address of the liquidity pair being approved\n event LiquidityApproval(address _liquidity);\n\n /// @notice Emitted when Keep3rJobFundableLiquidity#revokeLiquidity function is called\n /// @param _liquidity The address of the liquidity pair being revoked\n event LiquidityRevocation(address _liquidity);\n\n /// @notice Emitted when IKeep3rJobFundableLiquidity#addLiquidityToJob function is called\n /// @param _job The address of the job to which liquidity will be added\n /// @param _liquidity The address of the liquidity being added\n /// @param _provider The user that calls the function\n /// @param _amount The amount of liquidity being added\n event LiquidityAddition(address indexed _job, address indexed _liquidity, address indexed _provider, uint256 _amount);\n\n /// @notice Emitted when IKeep3rJobFundableLiquidity#withdrawLiquidityFromJob function is called\n /// @param _job The address of the job of which liquidity will be withdrawn from\n /// @param _liquidity The address of the liquidity being withdrawn\n /// @param _receiver The receiver of the liquidity tokens\n /// @param _amount The amount of liquidity being withdrawn from the job\n event LiquidityWithdrawal(address indexed _job, address indexed _liquidity, address indexed _receiver, uint256 _amount);\n\n /// @notice Emitted when Keep3rJobFundableLiquidity#addLiquidityToJob function is called\n /// @param _job The address of the job whose credits will be updated\n /// @param _rewardedAt The time at which the job was last rewarded\n /// @param _currentCredits The current credits of the job\n /// @param _periodCredits The credits of the job for the current period\n event LiquidityCreditsReward(address indexed _job, uint256 _rewardedAt, uint256 _currentCredits, uint256 _periodCredits);\n\n /// @notice Emitted when Keep3rJobFundableLiquidity#forceLiquidityCreditsToJob function is called\n /// @param _job The address of the job whose credits will be updated\n /// @param _rewardedAt The time at which the job was last rewarded\n /// @param _currentCredits The current credits of the job\n event LiquidityCreditsForced(address indexed _job, uint256 _rewardedAt, uint256 _currentCredits);\n\n // Errors\n\n /// @notice Throws when the liquidity being approved has already been approved\n error LiquidityPairApproved();\n\n /// @notice Throws when the liquidity being removed has not been approved\n error LiquidityPairUnexistent();\n\n /// @notice Throws when trying to add liquidity to an unapproved pool\n error LiquidityPairUnapproved();\n\n /// @notice Throws when the job doesn't have the requested liquidity\n error JobLiquidityUnexistent();\n\n /// @notice Throws when trying to remove more liquidity than the job has\n error JobLiquidityInsufficient();\n\n /// @notice Throws when trying to add less liquidity than the minimum liquidity required\n error JobLiquidityLessThanMin();\n\n // Structs\n\n /// @notice Stores the tick information of the different liquidity pairs\n struct TickCache {\n int56 current; // Tracks the current tick\n int56 difference; // Stores the difference between the current tick and the last tick\n uint256 period; // Stores the period at which the last observation was made\n }\n\n // Variables\n\n /// @notice Lists liquidity pairs\n /// @return _list An array of addresses with all the approved liquidity pairs\n function approvedLiquidities() external view returns (address[] memory _list);\n\n /// @notice Amount of liquidity in a specified job\n /// @param _job The address of the job being checked\n /// @param _liquidity The address of the liquidity we are checking\n /// @return _amount Amount of liquidity in the specified job\n function liquidityAmount(address _job, address _liquidity) external view returns (uint256 _amount);\n\n /// @notice Last time the job was rewarded liquidity credits\n /// @param _job The address of the job being checked\n /// @return _timestamp Timestamp of the last time the job was rewarded liquidity credits\n function rewardedAt(address _job) external view returns (uint256 _timestamp);\n\n /// @notice Last time the job was worked\n /// @param _job The address of the job being checked\n /// @return _timestamp Timestamp of the last time the job was worked\n function workedAt(address _job) external view returns (uint256 _timestamp);\n\n // Methods\n\n /// @notice Returns the liquidity credits of a given job\n /// @param _job The address of the job of which we want to know the liquidity credits\n /// @return _amount The liquidity credits of a given job\n function jobLiquidityCredits(address _job) external view returns (uint256 _amount);\n\n /// @notice Returns the credits of a given job for the current period\n /// @param _job The address of the job of which we want to know the period credits\n /// @return _amount The credits the given job has at the current period\n function jobPeriodCredits(address _job) external view returns (uint256 _amount);\n\n /// @notice Calculates the total credits of a given job\n /// @param _job The address of the job of which we want to know the total credits\n /// @return _amount The total credits of the given job\n function totalJobCredits(address _job) external view returns (uint256 _amount);\n\n /// @notice Calculates how many credits should be rewarded periodically for a given liquidity amount\n /// @dev _periodCredits = underlying KP3Rs for given liquidity amount * rewardPeriod / inflationPeriod\n /// @param _liquidity The address of the liquidity to provide\n /// @param _amount The amount of liquidity to provide\n /// @return _periodCredits The amount of KP3R periodically minted for the given liquidity\n function quoteLiquidity(address _liquidity, uint256 _amount) external view returns (uint256 _periodCredits);\n\n /// @notice Observes the current state of the liquidity pair being observed and updates TickCache with the information\n /// @param _liquidity The address of the liquidity pair being observed\n /// @return _tickCache The updated TickCache\n function observeLiquidity(address _liquidity) external view returns (TickCache memory _tickCache);\n\n /// @notice Gifts liquidity credits to the specified job\n /// @param _job The address of the job being credited\n /// @param _amount The amount of liquidity credits to gift\n function forceLiquidityCreditsToJob(address _job, uint256 _amount) external;\n\n /// @notice Approve a liquidity pair for being accepted in future\n /// @param _liquidity The address of the liquidity accepted\n function approveLiquidity(address _liquidity) external;\n\n /// @notice Revoke a liquidity pair from being accepted in future\n /// @param _liquidity The liquidity no longer accepted\n function revokeLiquidity(address _liquidity) external;\n\n /// @notice Allows anyone to fund a job with liquidity\n /// @param _job The address of the job to assign liquidity to\n /// @param _liquidity The liquidity being added\n /// @param _amount The amount of liquidity tokens to add\n function addLiquidityToJob(\n address _job,\n address _liquidity,\n uint256 _amount\n ) external;\n\n /// @notice Unbond liquidity for a job\n /// @dev Can only be called by the job's owner\n /// @param _job The address of the job being unbonded from\n /// @param _liquidity The liquidity being unbonded\n /// @param _amount The amount of liquidity being removed\n function unbondLiquidityFromJob(\n address _job,\n address _liquidity,\n uint256 _amount\n ) external;\n\n /// @notice Withdraw liquidity from a job\n /// @param _job The address of the job being withdrawn from\n /// @param _liquidity The liquidity being withdrawn\n /// @param _receiver The address that will receive the withdrawn liquidity\n function withdrawLiquidityFromJob(\n address _job,\n address _liquidity,\n address _receiver\n ) external;\n}\n\n/// @title Keep3rJobMigration contract\n/// @notice Handles the migration process of jobs to different addresses\ninterface IKeep3rJobMigration is IKeep3rJobFundableCredits, IKeep3rJobFundableLiquidity {\n // Events\n\n /// @notice Emitted when Keep3rJobMigration#migrateJob function is called\n /// @param _fromJob The address of the job that requests to migrate\n /// @param _toJob The address at which the job requests to migrate\n event JobMigrationRequested(address indexed _fromJob, address _toJob);\n\n /// @notice Emitted when Keep3rJobMigration#acceptJobMigration function is called\n /// @param _fromJob The address of the job that requested to migrate\n /// @param _toJob The address at which the job had requested to migrate\n event JobMigrationSuccessful(address _fromJob, address indexed _toJob);\n\n // Errors\n\n /// @notice Throws when the address of the job that requests to migrate wants to migrate to its same address\n error JobMigrationImpossible();\n\n /// @notice Throws when the _toJob address differs from the address being tracked in the pendingJobMigrations mapping\n error JobMigrationUnavailable();\n\n /// @notice Throws when cooldown between migrations has not yet passed\n error JobMigrationLocked();\n\n // Variables\n\n /// @notice Maps the jobs that have requested a migration to the address they have requested to migrate to\n /// @return _toJob The address to which the job has requested to migrate to\n function pendingJobMigrations(address _fromJob) external view returns (address _toJob);\n\n // Methods\n\n /// @notice Initializes the migration process for a job by adding the request to the pendingJobMigrations mapping\n /// @param _fromJob The address of the job that is requesting to migrate\n /// @param _toJob The address at which the job is requesting to migrate\n function migrateJob(address _fromJob, address _toJob) external;\n\n /// @notice Completes the migration process for a job\n /// @dev Unbond/withdraw process doesn't get migrated\n /// @param _fromJob The address of the job that requested to migrate\n /// @param _toJob The address to which the job wants to migrate to\n function acceptJobMigration(address _fromJob, address _toJob) external;\n}\n\n/// @title Keep3rJobWorkable contract\n/// @notice Handles the mechanisms jobs can pay keepers with along with the restrictions jobs can put on keepers before they can work on jobs\ninterface IKeep3rJobWorkable is IKeep3rJobMigration {\n // Events\n\n /// @notice Emitted when a keeper is validated before a job\n /// @param _gasLeft The amount of gas that the transaction has left at the moment of keeper validation\n event KeeperValidation(uint256 _gasLeft);\n\n /// @notice Emitted when a keeper works a job\n /// @param _credit The address of the asset in which the keeper is paid\n /// @param _job The address of the job the keeper has worked\n /// @param _keeper The address of the keeper that has worked the job\n /// @param _payment The amount that has been paid out to the keeper in exchange for working the job\n /// @param _gasLeft The amount of gas that the transaction has left at the moment of payment\n event KeeperWork(address indexed _credit, address indexed _job, address indexed _keeper, uint256 _payment, uint256 _gasLeft);\n\n // Errors\n\n /// @notice Throws if work method was called without calling isKeeper or isBondedKeeper\n error GasNotInitialized();\n\n /// @notice Throws if the address claiming to be a job is not in the list of approved jobs\n error JobUnapproved();\n\n /// @notice Throws if the amount of funds in the job is less than the payment that must be paid to the keeper that works that job\n error InsufficientFunds();\n\n // Methods\n\n /// @notice Confirms if the current keeper is registered\n /// @dev Can be used for general (non critical) functions\n /// @param _keeper The keeper being investigated\n /// @return _isKeeper Whether the address passed as a parameter is a keeper or not\n function isKeeper(address _keeper) external returns (bool _isKeeper);\n\n /// @notice Confirms if the current keeper is registered and has a minimum bond of any asset.\n /// @dev Should be used for protected functions\n /// @param _keeper The keeper to check\n /// @param _bond The bond token being evaluated\n /// @param _minBond The minimum amount of bonded tokens\n /// @param _earned The minimum funds earned in the keepers lifetime\n /// @param _age The minimum keeper age required\n /// @return _isBondedKeeper Whether the `_keeper` meets the given requirements\n function isBondedKeeper(\n address _keeper,\n address _bond,\n uint256 _minBond,\n uint256 _earned,\n uint256 _age\n ) external returns (bool _isBondedKeeper);\n\n /// @notice Implemented by jobs to show that a keeper performed work\n /// @dev Automatically calculates the payment for the keeper and pays the keeper with bonded KP3R\n /// @param _keeper Address of the keeper that performed the work\n function worked(address _keeper) external;\n\n /// @notice Implemented by jobs to show that a keeper performed work\n /// @dev Pays the keeper that performs the work with KP3R\n /// @param _keeper Address of the keeper that performed the work\n /// @param _payment The reward that should be allocated for the job\n function bondedPayment(address _keeper, uint256 _payment) external;\n\n /// @notice Implemented by jobs to show that a keeper performed work\n /// @dev Pays the keeper that performs the work with a specific token\n /// @param _token The asset being awarded to the keeper\n /// @param _keeper Address of the keeper that performed the work\n /// @param _amount The reward that should be allocated\n function directTokenPayment(\n address _token,\n address _keeper,\n uint256 _amount\n ) external;\n}\n\n/// @title Keep3rJobDisputable contract\n/// @notice Handles the actions that can be taken on a disputed job\ninterface IKeep3rJobDisputable is IKeep3rDisputable, IKeep3rJobFundableCredits, IKeep3rJobFundableLiquidity {\n // Events\n\n /// @notice Emitted when Keep3rJobDisputable#slashTokenFromJob is called\n /// @param _job The address of the job from which the token will be slashed\n /// @param _token The address of the token being slashed\n /// @param _slasher The user that slashes the token\n /// @param _amount The amount of the token being slashed\n event JobSlashToken(address indexed _job, address _token, address indexed _slasher, uint256 _amount);\n\n /// @notice Emitted when Keep3rJobDisputable#slashLiquidityFromJob is called\n /// @param _job The address of the job from which the liquidity will be slashed\n /// @param _liquidity The address of the liquidity being slashed\n /// @param _slasher The user that slashes the liquidity\n /// @param _amount The amount of the liquidity being slashed\n event JobSlashLiquidity(address indexed _job, address _liquidity, address indexed _slasher, uint256 _amount);\n\n // Errors\n\n /// @notice Throws when the token trying to be slashed doesn't exist\n error JobTokenUnexistent();\n\n /// @notice Throws when someone tries to slash more tokens than the job has\n error JobTokenInsufficient();\n\n // Methods\n\n /// @notice Allows governance or slasher to slash a job specific token\n /// @param _job The address of the job from which the token will be slashed\n /// @param _token The address of the token that will be slashed\n /// @param _amount The amount of the token that will be slashed\n function slashTokenFromJob(\n address _job,\n address _token,\n uint256 _amount\n ) external;\n\n /// @notice Allows governance or a slasher to slash liquidity from a job\n /// @param _job The address being slashed\n /// @param _liquidity The address of the liquidity that will be slashed\n /// @param _amount The amount of liquidity that will be slashed\n function slashLiquidityFromJob(\n address _job,\n address _liquidity,\n uint256 _amount\n ) external;\n}\n\n// solhint-disable-next-line no-empty-blocks\ninterface IKeep3rJobs is IKeep3rJobWorkable, IKeep3rJobManager, IKeep3rJobDisputable {\n\n}\n" - }, - "solidity/interfaces/peripherals/IKeep3rKeepers.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport './IKeep3rDisputable.sol';\n\n/// @title Keep3rKeeperFundable contract\n/// @notice Handles the actions required to become a keeper\ninterface IKeep3rKeeperFundable {\n // Events\n\n /// @notice Emitted when Keep3rKeeperFundable#activate is called\n /// @param _keeper The keeper that has been activated\n /// @param _bond The asset the keeper has bonded\n /// @param _amount The amount of the asset the keeper has bonded\n event Activation(address indexed _keeper, address indexed _bond, uint256 _amount);\n\n /// @notice Emitted when Keep3rKeeperFundable#withdraw is called\n /// @param _keeper The caller of Keep3rKeeperFundable#withdraw function\n /// @param _bond The asset to withdraw from the bonding pool\n /// @param _amount The amount of funds withdrawn\n event Withdrawal(address indexed _keeper, address indexed _bond, uint256 _amount);\n\n // Errors\n\n /// @notice Throws when the address that is trying to register as a job is already a job\n error AlreadyAJob();\n\n // Methods\n\n /// @notice Beginning of the bonding process\n /// @param _bonding The asset being bonded\n /// @param _amount The amount of bonding asset being bonded\n function bond(address _bonding, uint256 _amount) external;\n\n /// @notice Beginning of the unbonding process\n /// @param _bonding The asset being unbonded\n /// @param _amount Allows for partial unbonding\n function unbond(address _bonding, uint256 _amount) external;\n\n /// @notice End of the bonding process after bonding time has passed\n /// @param _bonding The asset being activated as bond collateral\n function activate(address _bonding) external;\n\n /// @notice Withdraw funds after unbonding has finished\n /// @param _bonding The asset to withdraw from the bonding pool\n function withdraw(address _bonding) external;\n}\n\n/// @title Keep3rKeeperDisputable contract\n/// @notice Handles the actions that can be taken on a disputed keeper\ninterface IKeep3rKeeperDisputable is IKeep3rDisputable, IKeep3rKeeperFundable {\n // Events\n\n /// @notice Emitted when Keep3rKeeperDisputable#slash is called\n /// @param _keeper The address of the slashed keeper\n /// @param _slasher The user that called Keep3rKeeperDisputable#slash\n /// @param _amount The amount of credits slashed from the keeper\n event KeeperSlash(address indexed _keeper, address indexed _slasher, uint256 _amount);\n\n /// @notice Emitted when Keep3rKeeperDisputable#revoke is called\n /// @param _keeper The address of the revoked keeper\n /// @param _slasher The user that called Keep3rKeeperDisputable#revoke\n event KeeperRevoke(address indexed _keeper, address indexed _slasher);\n\n // Methods\n\n /// @notice Allows governance to slash a keeper based on a dispute\n /// @param _keeper The address being slashed\n /// @param _bonded The asset being slashed\n /// @param _bondAmount The bonded amount being slashed\n /// @param _unbondAmount The pending unbond amount being slashed\n function slash(\n address _keeper,\n address _bonded,\n uint256 _bondAmount,\n uint256 _unbondAmount\n ) external;\n\n /// @notice Blacklists a keeper from participating in the network\n /// @param _keeper The address being slashed\n function revoke(address _keeper) external;\n}\n\n// solhint-disable-next-line no-empty-blocks\n\n/// @title Keep3rKeepers contract\ninterface IKeep3rKeepers is IKeep3rKeeperDisputable {\n\n}\n" - }, - "solidity/interfaces/peripherals/IKeep3rParameters.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport './IKeep3rAccountance.sol';\n\n/// @title Keep3rParameters contract\n/// @notice Handles and sets all the required parameters for Keep3r\ninterface IKeep3rParameters is IKeep3rAccountance {\n // Events\n\n /// @notice Emitted when the Keep3rHelper address is changed\n /// @param _keep3rHelper The address of Keep3rHelper's contract\n event Keep3rHelperChange(address _keep3rHelper);\n\n /// @notice Emitted when the Keep3rV1 address is changed\n /// @param _keep3rV1 The address of Keep3rV1's contract\n event Keep3rV1Change(address _keep3rV1);\n\n /// @notice Emitted when the Keep3rV1Proxy address is changed\n /// @param _keep3rV1Proxy The address of Keep3rV1Proxy's contract\n event Keep3rV1ProxyChange(address _keep3rV1Proxy);\n\n /// @notice Emitted when bondTime is changed\n /// @param _bondTime The new bondTime\n event BondTimeChange(uint256 _bondTime);\n\n /// @notice Emitted when _liquidityMinimum is changed\n /// @param _liquidityMinimum The new _liquidityMinimum\n event LiquidityMinimumChange(uint256 _liquidityMinimum);\n\n /// @notice Emitted when _unbondTime is changed\n /// @param _unbondTime The new _unbondTime\n event UnbondTimeChange(uint256 _unbondTime);\n\n /// @notice Emitted when _rewardPeriodTime is changed\n /// @param _rewardPeriodTime The new _rewardPeriodTime\n event RewardPeriodTimeChange(uint256 _rewardPeriodTime);\n\n /// @notice Emitted when the inflationPeriod is changed\n /// @param _inflationPeriod The new inflationPeriod\n event InflationPeriodChange(uint256 _inflationPeriod);\n\n /// @notice Emitted when the fee is changed\n /// @param _fee The new token credits fee\n event FeeChange(uint256 _fee);\n\n // Variables\n\n /// @notice Address of Keep3rHelper's contract\n /// @return _keep3rHelper The address of Keep3rHelper's contract\n function keep3rHelper() external view returns (address _keep3rHelper);\n\n /// @notice Address of Keep3rV1's contract\n /// @return _keep3rV1 The address of Keep3rV1's contract\n function keep3rV1() external view returns (address _keep3rV1);\n\n /// @notice Address of Keep3rV1Proxy's contract\n /// @return _keep3rV1Proxy The address of Keep3rV1Proxy's contract\n function keep3rV1Proxy() external view returns (address _keep3rV1Proxy);\n\n /// @notice The amount of time required to pass after a keeper has bonded assets for it to be able to activate\n /// @return _days The required bondTime in days\n function bondTime() external view returns (uint256 _days);\n\n /// @notice The amount of time required to pass before a keeper can unbond what he has bonded\n /// @return _days The required unbondTime in days\n function unbondTime() external view returns (uint256 _days);\n\n /// @notice The minimum amount of liquidity required to fund a job per liquidity\n /// @return _amount The minimum amount of liquidity in KP3R\n function liquidityMinimum() external view returns (uint256 _amount);\n\n /// @notice The amount of time between each scheduled credits reward given to a job\n /// @return _days The reward period in days\n function rewardPeriodTime() external view returns (uint256 _days);\n\n /// @notice The inflation period is the denominator used to regulate the emission of KP3R\n /// @return _period The denominator used to regulate the emission of KP3R\n function inflationPeriod() external view returns (uint256 _period);\n\n /// @notice The fee to be sent to governance when a user adds liquidity to a job\n /// @return _amount The fee amount to be sent to governance when a user adds liquidity to a job\n function fee() external view returns (uint256 _amount);\n\n // Errors\n\n /// @notice Throws if the reward period is less than the minimum reward period time\n error MinRewardPeriod();\n\n /// @notice Throws if either a job or a keeper is disputed\n error Disputed();\n\n /// @notice Throws if there are no bonded assets\n error BondsUnexistent();\n\n /// @notice Throws if the time required to bond an asset has not passed yet\n error BondsLocked();\n\n /// @notice Throws if there are no bonds to withdraw\n error UnbondsUnexistent();\n\n /// @notice Throws if the time required to withdraw the bonds has not passed yet\n error UnbondsLocked();\n\n // Methods\n\n /// @notice Sets the Keep3rHelper address\n /// @param _keep3rHelper The Keep3rHelper address\n function setKeep3rHelper(address _keep3rHelper) external;\n\n /// @notice Sets the Keep3rV1 address\n /// @param _keep3rV1 The Keep3rV1 address\n function setKeep3rV1(address _keep3rV1) external;\n\n /// @notice Sets the Keep3rV1Proxy address\n /// @param _keep3rV1Proxy The Keep3rV1Proxy address\n function setKeep3rV1Proxy(address _keep3rV1Proxy) external;\n\n /// @notice Sets the bond time required to activate as a keeper\n /// @param _bond The new bond time\n function setBondTime(uint256 _bond) external;\n\n /// @notice Sets the unbond time required unbond what has been bonded\n /// @param _unbond The new unbond time\n function setUnbondTime(uint256 _unbond) external;\n\n /// @notice Sets the minimum amount of liquidity required to fund a job\n /// @param _liquidityMinimum The new minimum amount of liquidity\n function setLiquidityMinimum(uint256 _liquidityMinimum) external;\n\n /// @notice Sets the time required to pass between rewards for jobs\n /// @param _rewardPeriodTime The new amount of time required to pass between rewards\n function setRewardPeriodTime(uint256 _rewardPeriodTime) external;\n\n /// @notice Sets the new inflation period\n /// @param _inflationPeriod The new inflation period\n function setInflationPeriod(uint256 _inflationPeriod) external;\n\n /// @notice Sets the new fee\n /// @param _fee The new fee\n function setFee(uint256 _fee) external;\n}\n" - }, - "solidity/interfaces/peripherals/IKeep3rDisputable.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\n/// @title Keep3rDisputable contract\n/// @notice Creates/resolves disputes for jobs or keepers\n/// A disputed keeper is slashable and is not able to bond, activate, withdraw or receive direct payments\n/// A disputed job is slashable and is not able to pay the keepers, withdraw tokens or to migrate\ninterface IKeep3rDisputable {\n /// @notice Emitted when a keeper or a job is disputed\n /// @param _jobOrKeeper The address of the disputed keeper/job\n /// @param _disputer The user that called the function and disputed the keeper\n event Dispute(address indexed _jobOrKeeper, address indexed _disputer);\n\n /// @notice Emitted when a dispute is resolved\n /// @param _jobOrKeeper The address of the disputed keeper/job\n /// @param _resolver The user that called the function and resolved the dispute\n event Resolve(address indexed _jobOrKeeper, address indexed _resolver);\n\n /// @notice Throws when a job or keeper is already disputed\n error AlreadyDisputed();\n\n /// @notice Throws when a job or keeper is not disputed and someone tries to resolve the dispute\n error NotDisputed();\n\n /// @notice Allows governance to create a dispute for a given keeper/job\n /// @param _jobOrKeeper The address in dispute\n function dispute(address _jobOrKeeper) external;\n\n /// @notice Allows governance to resolve a dispute on a keeper/job\n /// @param _jobOrKeeper The address cleared\n function resolve(address _jobOrKeeper) external;\n}\n" - }, - "solidity/interfaces/peripherals/IKeep3rAccountance.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport './IKeep3rRoles.sol';\n\n/// @title Keep3rDisputable contract\n/// @notice Disputes keepers, or if they're already disputed, it can resolve the case\n/// @dev Argument `bonding` can be the address of either a token or a liquidity\ninterface IKeep3rAccountance is IKeep3rRoles {\n // Events\n\n /// @notice Emitted when the bonding process of a new keeper begins\n /// @param _keeper The caller of Keep3rKeeperFundable#bond function\n /// @param _bonding The asset the keeper has bonded\n /// @param _amount The amount the keeper has bonded\n event Bonding(address indexed _keeper, address indexed _bonding, uint256 _amount);\n\n /// @notice Emitted when a keeper or job begins the unbonding process to withdraw the funds\n /// @param _keeperOrJob The keeper or job that began the unbonding process\n /// @param _unbonding The liquidity pair or asset being unbonded\n /// @param _amount The amount being unbonded\n event Unbonding(address indexed _keeperOrJob, address indexed _unbonding, uint256 _amount);\n\n // Variables\n\n /// @notice Tracks the total amount of bonded KP3Rs in the contract\n /// @return _totalBonds The total amount of bonded KP3Rs in the contract\n function totalBonds() external view returns (uint256 _totalBonds);\n\n /// @notice Tracks the total KP3R earnings of a keeper since it started working\n /// @param _keeper The address of the keeper\n /// @return _workCompleted Total KP3R earnings of a keeper since it started working\n function workCompleted(address _keeper) external view returns (uint256 _workCompleted);\n\n /// @notice Tracks when a keeper was first registered\n /// @param _keeper The address of the keeper\n /// @return timestamp The time at which the keeper was first registered\n function firstSeen(address _keeper) external view returns (uint256 timestamp);\n\n /// @notice Tracks if a keeper or job has a pending dispute\n /// @param _keeperOrJob The address of the keeper or job\n /// @return _disputed Whether a keeper or job has a pending dispute\n function disputes(address _keeperOrJob) external view returns (bool _disputed);\n\n /// @notice Tracks how much a keeper has bonded of a certain token\n /// @param _keeper The address of the keeper\n /// @param _bond The address of the token being bonded\n /// @return _bonds Amount of a certain token that a keeper has bonded\n function bonds(address _keeper, address _bond) external view returns (uint256 _bonds);\n\n /// @notice The current token credits available for a job\n /// @param _job The address of the job\n /// @param _token The address of the token bonded\n /// @return _amount The amount of token credits available for a job\n function jobTokenCredits(address _job, address _token) external view returns (uint256 _amount);\n\n /// @notice Tracks the amount of assets deposited in pending bonds\n /// @param _keeper The address of the keeper\n /// @param _bonding The address of the token being bonded\n /// @return _pendingBonds Amount of a certain asset a keeper has unbonding\n function pendingBonds(address _keeper, address _bonding) external view returns (uint256 _pendingBonds);\n\n /// @notice Tracks when a bonding for a keeper can be activated\n /// @param _keeper The address of the keeper\n /// @param _bonding The address of the token being bonded\n /// @return _timestamp Time at which the bonding for a keeper can be activated\n function canActivateAfter(address _keeper, address _bonding) external view returns (uint256 _timestamp);\n\n /// @notice Tracks when keeper bonds are ready to be withdrawn\n /// @param _keeper The address of the keeper\n /// @param _bonding The address of the token being unbonded\n /// @return _timestamp Time at which the keeper bonds are ready to be withdrawn\n function canWithdrawAfter(address _keeper, address _bonding) external view returns (uint256 _timestamp);\n\n /// @notice Tracks how much keeper bonds are to be withdrawn\n /// @param _keeper The address of the keeper\n /// @param _bonding The address of the token being unbonded\n /// @return _pendingUnbonds The amount of keeper bonds that are to be withdrawn\n function pendingUnbonds(address _keeper, address _bonding) external view returns (uint256 _pendingUnbonds);\n\n /// @notice Checks whether the address has ever bonded an asset\n /// @param _keeper The address of the keeper\n /// @return _hasBonded Whether the address has ever bonded an asset\n function hasBonded(address _keeper) external view returns (bool _hasBonded);\n\n // Methods\n\n /// @notice Lists all jobs\n /// @return _jobList Array with all the jobs in _jobs\n function jobs() external view returns (address[] memory _jobList);\n\n /// @notice Lists all keepers\n /// @return _keeperList Array with all the keepers in _keepers\n function keepers() external view returns (address[] memory _keeperList);\n\n // Errors\n\n /// @notice Throws when an address is passed as a job, but that address is not a job\n error JobUnavailable();\n\n /// @notice Throws when an action that requires an undisputed job is applied on a disputed job\n error JobDisputed();\n}\n" - }, - "solidity/interfaces/peripherals/IKeep3rRoles.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport './IBaseErrors.sol';\nimport './IGovernable.sol';\nimport './IDustCollector.sol';\n\n/// @title Keep3rRoles contract\n/// @notice Manages the Keep3r specific roles\ninterface IKeep3rRoles is IBaseErrors, IDustCollector, IGovernable {\n // Events\n\n /// @notice Emitted when a slasher is added\n /// @param _slasher Address of the added slasher\n event SlasherAdded(address _slasher);\n\n /// @notice Emitted when a slasher is removed\n /// @param _slasher Address of the removed slasher\n event SlasherRemoved(address _slasher);\n\n /// @notice Emitted when a disputer is added\n /// @param _disputer Address of the added disputer\n event DisputerAdded(address _disputer);\n\n /// @notice Emitted when a disputer is removed\n /// @param _disputer Address of the removed disputer\n event DisputerRemoved(address _disputer);\n\n // Variables\n\n /// @notice Tracks whether the address is a slasher or not\n /// @param _slasher Address being checked as a slasher\n /// @return _isSlasher Whether the address is a slasher or not\n function slashers(address _slasher) external view returns (bool _isSlasher);\n\n /// @notice Tracks whether the address is a disputer or not\n /// @param _disputer Address being checked as a disputer\n /// @return _isDisputer Whether the address is a disputer or not\n function disputers(address _disputer) external view returns (bool _isDisputer);\n\n // Errors\n\n /// @notice Throws if the address is already a registered slasher\n error SlasherExistent();\n\n /// @notice Throws if caller is not a registered slasher\n error SlasherUnexistent();\n\n /// @notice Throws if the address is already a registered disputer\n error DisputerExistent();\n\n /// @notice Throws if caller is not a registered disputer\n error DisputerUnexistent();\n\n /// @notice Throws if the msg.sender is not a slasher or is not a part of governance\n error OnlySlasher();\n\n /// @notice Throws if the msg.sender is not a disputer or is not a part of governance\n error OnlyDisputer();\n\n // Methods\n\n /// @notice Registers a slasher by updating the slashers mapping\n function addSlasher(address _slasher) external;\n\n /// @notice Removes a slasher by updating the slashers mapping\n function removeSlasher(address _slasher) external;\n\n /// @notice Registers a disputer by updating the disputers mapping\n function addDisputer(address _disputer) external;\n\n /// @notice Removes a disputer by updating the disputers mapping\n function removeDisputer(address _disputer) external;\n}\n" - }, - "solidity/interfaces/peripherals/IBaseErrors.sol": { - "content": "// SPDX-License-Identifier: MIT\n\npragma solidity >=0.8.4 <0.9.0;\n\ninterface IBaseErrors {\n /// @notice Throws if a variable is assigned to the zero address\n error ZeroAddress();\n}\n" - }, - "solidity/interfaces/peripherals/IGovernable.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\n/// @title Governable contract\n/// @notice Manages the governance role\ninterface IGovernable {\n // Events\n\n /// @notice Emitted when pendingGovernance accepts to be governance\n /// @param _governance Address of the new governance\n event GovernanceSet(address _governance);\n\n /// @notice Emitted when a new governance is proposed\n /// @param _pendingGovernance Address that is proposed to be the new governance\n event GovernanceProposal(address _pendingGovernance);\n\n // Errors\n\n /// @notice Throws if the caller of the function is not governance\n error OnlyGovernance();\n\n /// @notice Throws if the caller of the function is not pendingGovernance\n error OnlyPendingGovernance();\n\n /// @notice Throws if trying to set governance to zero address\n error NoGovernanceZeroAddress();\n\n // Variables\n\n /// @notice Stores the governance address\n /// @return _governance The governance addresss\n function governance() external view returns (address _governance);\n\n /// @notice Stores the pendingGovernance address\n /// @return _pendingGovernance The pendingGovernance addresss\n function pendingGovernance() external view returns (address _pendingGovernance);\n\n // Methods\n\n /// @notice Proposes a new address to be governance\n /// @param _governance The address being proposed as the new governance\n function setGovernance(address _governance) external;\n\n /// @notice Changes the governance from the current governance to the previously proposed address\n function acceptGovernance() external;\n}\n" - }, - "solidity/interfaces/peripherals/IDustCollector.sol": { - "content": "// SPDX-License-Identifier: MIT\n\npragma solidity >=0.8.4 <0.9.0;\n\nimport './IBaseErrors.sol';\n\ninterface IDustCollector is IBaseErrors {\n /// @notice Emitted when dust is sent\n /// @param _token The token that will be transferred\n /// @param _amount The amount of the token that will be transferred\n /// @param _to The address which will receive the funds\n event DustSent(address _token, uint256 _amount, address _to);\n\n /// @notice Allows an authorized user to transfer the tokens or eth that may have been left in a contract\n /// @param _token The token that will be transferred\n /// @param _amount The amount of the token that will be transferred\n /// @param _to The address that will receive the idle funds\n function sendDust(\n address _token,\n uint256 _amount,\n address _to\n ) external;\n}\n" - }, - "solidity/contracts/peripherals/jobs/Keep3rJobManager.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport './Keep3rJobOwnership.sol';\nimport '../Keep3rAccountance.sol';\nimport '../../../interfaces/peripherals/IKeep3rJobs.sol';\n\nabstract contract Keep3rJobManager is IKeep3rJobManager, Keep3rJobOwnership, Keep3rAccountance {\n using EnumerableSet for EnumerableSet.AddressSet;\n\n /// @inheritdoc IKeep3rJobManager\n function addJob(address _job) external override {\n if (_jobs.contains(_job)) revert JobAlreadyAdded();\n if (hasBonded[_job]) revert AlreadyAKeeper();\n _jobs.add(_job);\n jobOwner[_job] = msg.sender;\n emit JobAddition(_job, msg.sender);\n }\n}\n" - }, - "solidity/contracts/peripherals/jobs/Keep3rJobWorkable.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport './Keep3rJobMigration.sol';\nimport '../../../interfaces/IKeep3rHelper.sol';\nimport '../../../interfaces/peripherals/IKeep3rJobs.sol';\n\nimport '@openzeppelin/contracts/token/ERC20/IERC20.sol';\nimport '@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol';\n\nabstract contract Keep3rJobWorkable is IKeep3rJobWorkable, Keep3rJobMigration {\n using EnumerableSet for EnumerableSet.AddressSet;\n using SafeERC20 for IERC20;\n\n uint256 internal _initialGas;\n\n /// @inheritdoc IKeep3rJobWorkable\n function isKeeper(address _keeper) external override returns (bool _isKeeper) {\n _initialGas = _getGasLeft();\n if (_keepers.contains(_keeper)) {\n emit KeeperValidation(_initialGas);\n return true;\n }\n }\n\n /// @inheritdoc IKeep3rJobWorkable\n function isBondedKeeper(\n address _keeper,\n address _bond,\n uint256 _minBond,\n uint256 _earned,\n uint256 _age\n ) external override returns (bool _isBondedKeeper) {\n _initialGas = _getGasLeft();\n if (\n _keepers.contains(_keeper) &&\n bonds[_keeper][_bond] >= _minBond &&\n workCompleted[_keeper] >= _earned &&\n block.timestamp - firstSeen[_keeper] >= _age\n ) {\n emit KeeperValidation(_initialGas);\n return true;\n }\n }\n\n /// @inheritdoc IKeep3rJobWorkable\n function worked(address _keeper) external virtual override {\n if (_initialGas == 0) revert GasNotInitialized();\n address _job = msg.sender;\n if (disputes[_job]) revert JobDisputed();\n if (!_jobs.contains(_job)) revert JobUnapproved();\n\n if (_updateJobCreditsIfNeeded(_job)) {\n emit LiquidityCreditsReward(_job, rewardedAt[_job], _jobLiquidityCredits[_job], _jobPeriodCredits[_job]);\n }\n\n (uint256 _boost, uint256 _oneEthQuote, uint256 _extraGas) = IKeep3rHelper(keep3rHelper).getPaymentParams(bonds[_keeper][keep3rV1]);\n\n uint256 _gasLeft = _getGasLeft();\n uint256 _payment = _calculatePayment(_gasLeft, _extraGas, _oneEthQuote, _boost);\n\n if (_payment > _jobLiquidityCredits[_job]) {\n _rewardJobCredits(_job);\n emit LiquidityCreditsReward(_job, rewardedAt[_job], _jobLiquidityCredits[_job], _jobPeriodCredits[_job]);\n\n _gasLeft = _getGasLeft();\n _payment = _calculatePayment(_gasLeft, _extraGas, _oneEthQuote, _boost);\n }\n\n _bondedPayment(_job, _keeper, _payment);\n delete _initialGas;\n\n emit KeeperWork(keep3rV1, _job, _keeper, _payment, _gasLeft);\n }\n\n /// @inheritdoc IKeep3rJobWorkable\n function bondedPayment(address _keeper, uint256 _payment) external override {\n address _job = msg.sender;\n\n if (disputes[_job]) revert JobDisputed();\n if (!_jobs.contains(_job)) revert JobUnapproved();\n\n if (_updateJobCreditsIfNeeded(_job)) {\n emit LiquidityCreditsReward(_job, rewardedAt[_job], _jobLiquidityCredits[_job], _jobPeriodCredits[_job]);\n }\n\n if (_payment > _jobLiquidityCredits[_job]) {\n _rewardJobCredits(_job);\n emit LiquidityCreditsReward(_job, rewardedAt[_job], _jobLiquidityCredits[_job], _jobPeriodCredits[_job]);\n }\n\n _bondedPayment(_job, _keeper, _payment);\n emit KeeperWork(keep3rV1, _job, _keeper, _payment, _getGasLeft());\n }\n\n /// @inheritdoc IKeep3rJobWorkable\n function directTokenPayment(\n address _token,\n address _keeper,\n uint256 _amount\n ) external override {\n address _job = msg.sender;\n\n if (disputes[_job]) revert JobDisputed();\n if (disputes[_keeper]) revert Disputed();\n if (!_jobs.contains(_job)) revert JobUnapproved();\n if (jobTokenCredits[_job][_token] < _amount) revert InsufficientFunds();\n jobTokenCredits[_job][_token] -= _amount;\n IERC20(_token).safeTransfer(_keeper, _amount);\n emit KeeperWork(_token, _job, _keeper, _amount, _getGasLeft());\n }\n\n function _bondedPayment(\n address _job,\n address _keeper,\n uint256 _payment\n ) internal {\n if (_payment > _jobLiquidityCredits[_job]) revert InsufficientFunds();\n\n workedAt[_job] = block.timestamp;\n _jobLiquidityCredits[_job] -= _payment;\n bonds[_keeper][keep3rV1] += _payment;\n workCompleted[_keeper] += _payment;\n totalBonds += _payment;\n }\n\n /// @notice Calculate amount to be payed in KP3R, taking into account multiple parameters\n /// @param _gasLeft Amount of gas left after working the job\n /// @param _extraGas Amount of expected unaccounted gas\n /// @param _oneEthQuote Amount of KP3R equivalent to 1 ETH\n /// @param _boost Reward given to the keeper for having bonded KP3R tokens\n /// @return _payment Amount to be payed in KP3R tokens\n function _calculatePayment(\n uint256 _gasLeft,\n uint256 _extraGas,\n uint256 _oneEthQuote,\n uint256 _boost\n ) internal view returns (uint256 _payment) {\n uint256 _accountedGas = _initialGas - _gasLeft + _extraGas;\n _payment = (((_accountedGas * _boost) / _BASE) * _oneEthQuote) / 1 ether;\n }\n\n /// @notice Return the gas left and add 1/64 in order to match real gas left at first level of depth (EIP-150)\n /// @return _gasLeft Amount of gas left recording taking into account EIP-150\n function _getGasLeft() internal view returns (uint256 _gasLeft) {\n _gasLeft = (gasleft() * 64) / 63;\n }\n}\n" - }, - "solidity/contracts/peripherals/jobs/Keep3rJobDisputable.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport './Keep3rJobFundableCredits.sol';\nimport './Keep3rJobFundableLiquidity.sol';\nimport '../Keep3rDisputable.sol';\n\nabstract contract Keep3rJobDisputable is IKeep3rJobDisputable, Keep3rDisputable, Keep3rJobFundableCredits, Keep3rJobFundableLiquidity {\n using EnumerableSet for EnumerableSet.AddressSet;\n using SafeERC20 for IERC20;\n\n /// @inheritdoc IKeep3rJobDisputable\n function slashTokenFromJob(\n address _job,\n address _token,\n uint256 _amount\n ) external override onlySlasher {\n if (!disputes[_job]) revert NotDisputed();\n if (!_jobTokens[_job].contains(_token)) revert JobTokenUnexistent();\n if (jobTokenCredits[_job][_token] < _amount) revert JobTokenInsufficient();\n\n try IERC20(_token).transfer(governance, _amount) {} catch {}\n jobTokenCredits[_job][_token] -= _amount;\n if (jobTokenCredits[_job][_token] == 0) {\n _jobTokens[_job].remove(_token);\n }\n\n emit JobSlashToken(_job, _token, msg.sender, _amount);\n }\n\n /// @inheritdoc IKeep3rJobDisputable\n function slashLiquidityFromJob(\n address _job,\n address _liquidity,\n uint256 _amount\n ) external override onlySlasher {\n if (!disputes[_job]) revert NotDisputed();\n\n _unbondLiquidityFromJob(_job, _liquidity, _amount);\n try IERC20(_liquidity).transfer(governance, _amount) {} catch {}\n emit JobSlashLiquidity(_job, _liquidity, msg.sender, _amount);\n }\n}\n" - }, - "solidity/contracts/peripherals/jobs/Keep3rJobOwnership.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../../../interfaces/peripherals/IKeep3rJobs.sol';\n\nabstract contract Keep3rJobOwnership is IKeep3rJobOwnership {\n /// @inheritdoc IKeep3rJobOwnership\n mapping(address => address) public override jobOwner;\n\n /// @inheritdoc IKeep3rJobOwnership\n mapping(address => address) public override jobPendingOwner;\n\n /// @inheritdoc IKeep3rJobOwnership\n function changeJobOwnership(address _job, address _newOwner) external override onlyJobOwner(_job) {\n jobPendingOwner[_job] = _newOwner;\n emit JobOwnershipChange(_job, jobOwner[_job], _newOwner);\n }\n\n /// @inheritdoc IKeep3rJobOwnership\n function acceptJobOwnership(address _job) external override onlyPendingJobOwner(_job) {\n address _previousOwner = jobOwner[_job];\n\n jobOwner[_job] = jobPendingOwner[_job];\n delete jobPendingOwner[_job];\n\n emit JobOwnershipAssent(msg.sender, _job, _previousOwner);\n }\n\n modifier onlyJobOwner(address _job) {\n if (msg.sender != jobOwner[_job]) revert OnlyJobOwner();\n _;\n }\n\n modifier onlyPendingJobOwner(address _job) {\n if (msg.sender != jobPendingOwner[_job]) revert OnlyPendingJobOwner();\n _;\n }\n}\n" - }, - "solidity/contracts/peripherals/Keep3rAccountance.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '@openzeppelin/contracts/utils/structs/EnumerableSet.sol';\nimport '../../interfaces/peripherals/IKeep3rAccountance.sol';\nimport './Keep3rRoles.sol';\n\nabstract contract Keep3rAccountance is IKeep3rAccountance, Keep3rRoles {\n using EnumerableSet for EnumerableSet.AddressSet;\n\n /// @notice List of all enabled keepers\n EnumerableSet.AddressSet internal _keepers;\n\n /// @inheritdoc IKeep3rAccountance\n uint256 public override totalBonds;\n\n /// @inheritdoc IKeep3rAccountance\n mapping(address => uint256) public override workCompleted;\n\n /// @inheritdoc IKeep3rAccountance\n mapping(address => uint256) public override firstSeen;\n\n /// @inheritdoc IKeep3rAccountance\n mapping(address => bool) public override disputes;\n\n /// @inheritdoc IKeep3rAccountance\n /// @notice Mapping (job => bonding => amount)\n mapping(address => mapping(address => uint256)) public override bonds;\n\n /// @inheritdoc IKeep3rAccountance\n mapping(address => mapping(address => uint256)) public override jobTokenCredits;\n\n /// @notice The current liquidity credits available for a job\n mapping(address => uint256) internal _jobLiquidityCredits;\n\n /// @notice Map the address of a job to its correspondent periodCredits\n mapping(address => uint256) internal _jobPeriodCredits;\n\n /// @notice Enumerable array of Job Tokens for Credits\n mapping(address => EnumerableSet.AddressSet) internal _jobTokens;\n\n /// @notice List of liquidities that a job has (job => liquidities)\n mapping(address => EnumerableSet.AddressSet) internal _jobLiquidities;\n\n /// @notice Liquidity pool to observe\n mapping(address => address) internal _liquidityPool;\n\n /// @notice Tracks if a pool has KP3R as token0\n mapping(address => bool) internal _isKP3RToken0;\n\n /// @inheritdoc IKeep3rAccountance\n mapping(address => mapping(address => uint256)) public override pendingBonds;\n\n /// @inheritdoc IKeep3rAccountance\n mapping(address => mapping(address => uint256)) public override canActivateAfter;\n\n /// @inheritdoc IKeep3rAccountance\n mapping(address => mapping(address => uint256)) public override canWithdrawAfter;\n\n /// @inheritdoc IKeep3rAccountance\n mapping(address => mapping(address => uint256)) public override pendingUnbonds;\n\n /// @inheritdoc IKeep3rAccountance\n mapping(address => bool) public override hasBonded;\n\n /// @notice List of all enabled jobs\n EnumerableSet.AddressSet internal _jobs;\n\n /// @inheritdoc IKeep3rAccountance\n function jobs() external view override returns (address[] memory _list) {\n _list = _jobs.values();\n }\n\n /// @inheritdoc IKeep3rAccountance\n function keepers() external view override returns (address[] memory _list) {\n _list = _keepers.values();\n }\n}\n" - }, - "@openzeppelin/contracts/utils/structs/EnumerableSet.sol": { - "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Library for managing\n * https://en.wikipedia.org/wiki/Set_(abstract_data_type)[sets] of primitive\n * types.\n *\n * Sets have the following properties:\n *\n * - Elements are added, removed, and checked for existence in constant time\n * (O(1)).\n * - Elements are enumerated in O(n). No guarantees are made on the ordering.\n *\n * ```\n * contract Example {\n * // Add the library methods\n * using EnumerableSet for EnumerableSet.AddressSet;\n *\n * // Declare a set state variable\n * EnumerableSet.AddressSet private mySet;\n * }\n * ```\n *\n * As of v3.3.0, sets of type `bytes32` (`Bytes32Set`), `address` (`AddressSet`)\n * and `uint256` (`UintSet`) are supported.\n */\nlibrary EnumerableSet {\n // To implement this library for multiple types with as little code\n // repetition as possible, we write it in terms of a generic Set type with\n // bytes32 values.\n // The Set implementation uses private functions, and user-facing\n // implementations (such as AddressSet) are just wrappers around the\n // underlying Set.\n // This means that we can only create new EnumerableSets for types that fit\n // in bytes32.\n\n struct Set {\n // Storage of set values\n bytes32[] _values;\n // Position of the value in the `values` array, plus 1 because index 0\n // means a value is not in the set.\n mapping(bytes32 => uint256) _indexes;\n }\n\n /**\n * @dev Add a value to a set. O(1).\n *\n * Returns true if the value was added to the set, that is if it was not\n * already present.\n */\n function _add(Set storage set, bytes32 value) private returns (bool) {\n if (!_contains(set, value)) {\n set._values.push(value);\n // The value is stored at length-1, but we add 1 to all indexes\n // and use 0 as a sentinel value\n set._indexes[value] = set._values.length;\n return true;\n } else {\n return false;\n }\n }\n\n /**\n * @dev Removes a value from a set. O(1).\n *\n * Returns true if the value was removed from the set, that is if it was\n * present.\n */\n function _remove(Set storage set, bytes32 value) private returns (bool) {\n // We read and store the value's index to prevent multiple reads from the same storage slot\n uint256 valueIndex = set._indexes[value];\n\n if (valueIndex != 0) {\n // Equivalent to contains(set, value)\n // To delete an element from the _values array in O(1), we swap the element to delete with the last one in\n // the array, and then remove the last element (sometimes called as 'swap and pop').\n // This modifies the order of the array, as noted in {at}.\n\n uint256 toDeleteIndex = valueIndex - 1;\n uint256 lastIndex = set._values.length - 1;\n\n if (lastIndex != toDeleteIndex) {\n bytes32 lastvalue = set._values[lastIndex];\n\n // Move the last value to the index where the value to delete is\n set._values[toDeleteIndex] = lastvalue;\n // Update the index for the moved value\n set._indexes[lastvalue] = valueIndex; // Replace lastvalue's index to valueIndex\n }\n\n // Delete the slot where the moved value was stored\n set._values.pop();\n\n // Delete the index for the deleted slot\n delete set._indexes[value];\n\n return true;\n } else {\n return false;\n }\n }\n\n /**\n * @dev Returns true if the value is in the set. O(1).\n */\n function _contains(Set storage set, bytes32 value) private view returns (bool) {\n return set._indexes[value] != 0;\n }\n\n /**\n * @dev Returns the number of values on the set. O(1).\n */\n function _length(Set storage set) private view returns (uint256) {\n return set._values.length;\n }\n\n /**\n * @dev Returns the value stored at position `index` in the set. O(1).\n *\n * Note that there are no guarantees on the ordering of values inside the\n * array, and it may change when more values are added or removed.\n *\n * Requirements:\n *\n * - `index` must be strictly less than {length}.\n */\n function _at(Set storage set, uint256 index) private view returns (bytes32) {\n return set._values[index];\n }\n\n /**\n * @dev Return the entire set in an array\n *\n * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed\n * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that\n * this function has an unbounded cost, and using it as part of a state-changing function may render the function\n * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.\n */\n function _values(Set storage set) private view returns (bytes32[] memory) {\n return set._values;\n }\n\n // Bytes32Set\n\n struct Bytes32Set {\n Set _inner;\n }\n\n /**\n * @dev Add a value to a set. O(1).\n *\n * Returns true if the value was added to the set, that is if it was not\n * already present.\n */\n function add(Bytes32Set storage set, bytes32 value) internal returns (bool) {\n return _add(set._inner, value);\n }\n\n /**\n * @dev Removes a value from a set. O(1).\n *\n * Returns true if the value was removed from the set, that is if it was\n * present.\n */\n function remove(Bytes32Set storage set, bytes32 value) internal returns (bool) {\n return _remove(set._inner, value);\n }\n\n /**\n * @dev Returns true if the value is in the set. O(1).\n */\n function contains(Bytes32Set storage set, bytes32 value) internal view returns (bool) {\n return _contains(set._inner, value);\n }\n\n /**\n * @dev Returns the number of values in the set. O(1).\n */\n function length(Bytes32Set storage set) internal view returns (uint256) {\n return _length(set._inner);\n }\n\n /**\n * @dev Returns the value stored at position `index` in the set. O(1).\n *\n * Note that there are no guarantees on the ordering of values inside the\n * array, and it may change when more values are added or removed.\n *\n * Requirements:\n *\n * - `index` must be strictly less than {length}.\n */\n function at(Bytes32Set storage set, uint256 index) internal view returns (bytes32) {\n return _at(set._inner, index);\n }\n\n /**\n * @dev Return the entire set in an array\n *\n * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed\n * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that\n * this function has an unbounded cost, and using it as part of a state-changing function may render the function\n * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.\n */\n function values(Bytes32Set storage set) internal view returns (bytes32[] memory) {\n return _values(set._inner);\n }\n\n // AddressSet\n\n struct AddressSet {\n Set _inner;\n }\n\n /**\n * @dev Add a value to a set. O(1).\n *\n * Returns true if the value was added to the set, that is if it was not\n * already present.\n */\n function add(AddressSet storage set, address value) internal returns (bool) {\n return _add(set._inner, bytes32(uint256(uint160(value))));\n }\n\n /**\n * @dev Removes a value from a set. O(1).\n *\n * Returns true if the value was removed from the set, that is if it was\n * present.\n */\n function remove(AddressSet storage set, address value) internal returns (bool) {\n return _remove(set._inner, bytes32(uint256(uint160(value))));\n }\n\n /**\n * @dev Returns true if the value is in the set. O(1).\n */\n function contains(AddressSet storage set, address value) internal view returns (bool) {\n return _contains(set._inner, bytes32(uint256(uint160(value))));\n }\n\n /**\n * @dev Returns the number of values in the set. O(1).\n */\n function length(AddressSet storage set) internal view returns (uint256) {\n return _length(set._inner);\n }\n\n /**\n * @dev Returns the value stored at position `index` in the set. O(1).\n *\n * Note that there are no guarantees on the ordering of values inside the\n * array, and it may change when more values are added or removed.\n *\n * Requirements:\n *\n * - `index` must be strictly less than {length}.\n */\n function at(AddressSet storage set, uint256 index) internal view returns (address) {\n return address(uint160(uint256(_at(set._inner, index))));\n }\n\n /**\n * @dev Return the entire set in an array\n *\n * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed\n * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that\n * this function has an unbounded cost, and using it as part of a state-changing function may render the function\n * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.\n */\n function values(AddressSet storage set) internal view returns (address[] memory) {\n bytes32[] memory store = _values(set._inner);\n address[] memory result;\n\n assembly {\n result := store\n }\n\n return result;\n }\n\n // UintSet\n\n struct UintSet {\n Set _inner;\n }\n\n /**\n * @dev Add a value to a set. O(1).\n *\n * Returns true if the value was added to the set, that is if it was not\n * already present.\n */\n function add(UintSet storage set, uint256 value) internal returns (bool) {\n return _add(set._inner, bytes32(value));\n }\n\n /**\n * @dev Removes a value from a set. O(1).\n *\n * Returns true if the value was removed from the set, that is if it was\n * present.\n */\n function remove(UintSet storage set, uint256 value) internal returns (bool) {\n return _remove(set._inner, bytes32(value));\n }\n\n /**\n * @dev Returns true if the value is in the set. O(1).\n */\n function contains(UintSet storage set, uint256 value) internal view returns (bool) {\n return _contains(set._inner, bytes32(value));\n }\n\n /**\n * @dev Returns the number of values on the set. O(1).\n */\n function length(UintSet storage set) internal view returns (uint256) {\n return _length(set._inner);\n }\n\n /**\n * @dev Returns the value stored at position `index` in the set. O(1).\n *\n * Note that there are no guarantees on the ordering of values inside the\n * array, and it may change when more values are added or removed.\n *\n * Requirements:\n *\n * - `index` must be strictly less than {length}.\n */\n function at(UintSet storage set, uint256 index) internal view returns (uint256) {\n return uint256(_at(set._inner, index));\n }\n\n /**\n * @dev Return the entire set in an array\n *\n * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed\n * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that\n * this function has an unbounded cost, and using it as part of a state-changing function may render the function\n * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.\n */\n function values(UintSet storage set) internal view returns (uint256[] memory) {\n bytes32[] memory store = _values(set._inner);\n uint256[] memory result;\n\n assembly {\n result := store\n }\n\n return result;\n }\n}\n" - }, - "solidity/contracts/peripherals/Keep3rRoles.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../../interfaces/peripherals/IKeep3rRoles.sol';\nimport '@openzeppelin/contracts/utils/structs/EnumerableSet.sol';\nimport './DustCollector.sol';\nimport './Governable.sol';\n\ncontract Keep3rRoles is IKeep3rRoles, Governable, DustCollector {\n /// @inheritdoc IKeep3rRoles\n mapping(address => bool) public override slashers;\n\n /// @inheritdoc IKeep3rRoles\n mapping(address => bool) public override disputers;\n\n constructor(address _governance) Governable(_governance) DustCollector() {}\n\n /// @inheritdoc IKeep3rRoles\n function addSlasher(address _slasher) external override onlyGovernance {\n if (_slasher == address(0)) revert ZeroAddress();\n if (slashers[_slasher]) revert SlasherExistent();\n slashers[_slasher] = true;\n emit SlasherAdded(_slasher);\n }\n\n /// @inheritdoc IKeep3rRoles\n function removeSlasher(address _slasher) external override onlyGovernance {\n if (!slashers[_slasher]) revert SlasherUnexistent();\n delete slashers[_slasher];\n emit SlasherRemoved(_slasher);\n }\n\n /// @inheritdoc IKeep3rRoles\n function addDisputer(address _disputer) external override onlyGovernance {\n if (_disputer == address(0)) revert ZeroAddress();\n if (disputers[_disputer]) revert DisputerExistent();\n disputers[_disputer] = true;\n emit DisputerAdded(_disputer);\n }\n\n /// @inheritdoc IKeep3rRoles\n function removeDisputer(address _disputer) external override onlyGovernance {\n if (!disputers[_disputer]) revert DisputerUnexistent();\n delete disputers[_disputer];\n emit DisputerRemoved(_disputer);\n }\n\n /// @notice Functions with this modifier can only be called by either a slasher or governance\n modifier onlySlasher {\n if (!slashers[msg.sender]) revert OnlySlasher();\n _;\n }\n\n /// @notice Functions with this modifier can only be called by either a disputer or governance\n modifier onlyDisputer {\n if (!disputers[msg.sender]) revert OnlyDisputer();\n _;\n }\n}\n" - }, - "solidity/contracts/peripherals/Governable.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../../interfaces/peripherals/IGovernable.sol';\n\nabstract contract Governable is IGovernable {\n /// @inheritdoc IGovernable\n address public override governance;\n\n /// @inheritdoc IGovernable\n address public override pendingGovernance;\n\n constructor(address _governance) {\n if (_governance == address(0)) revert NoGovernanceZeroAddress();\n governance = _governance;\n }\n\n /// @inheritdoc IGovernable\n function setGovernance(address _governance) external override onlyGovernance {\n pendingGovernance = _governance;\n emit GovernanceProposal(_governance);\n }\n\n /// @inheritdoc IGovernable\n function acceptGovernance() external override onlyPendingGovernance {\n governance = pendingGovernance;\n delete pendingGovernance;\n emit GovernanceSet(governance);\n }\n\n /// @notice Functions with this modifier can only be called by governance\n modifier onlyGovernance {\n if (msg.sender != governance) revert OnlyGovernance();\n _;\n }\n\n /// @notice Functions with this modifier can only be called by pendingGovernance\n modifier onlyPendingGovernance {\n if (msg.sender != pendingGovernance) revert OnlyPendingGovernance();\n _;\n }\n}\n" - }, - "@openzeppelin/contracts/token/ERC20/IERC20.sol": { - "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Interface of the ERC20 standard as defined in the EIP.\n */\ninterface IERC20 {\n /**\n * @dev Returns the amount of tokens in existence.\n */\n function totalSupply() external view returns (uint256);\n\n /**\n * @dev Returns the amount of tokens owned by `account`.\n */\n function balanceOf(address account) external view returns (uint256);\n\n /**\n * @dev Moves `amount` tokens from the caller's account to `recipient`.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * Emits a {Transfer} event.\n */\n function transfer(address recipient, uint256 amount) external returns (bool);\n\n /**\n * @dev Returns the remaining number of tokens that `spender` will be\n * allowed to spend on behalf of `owner` through {transferFrom}. This is\n * zero by default.\n *\n * This value changes when {approve} or {transferFrom} are called.\n */\n function allowance(address owner, address spender) external view returns (uint256);\n\n /**\n * @dev Sets `amount` as the allowance of `spender` over the caller's tokens.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * IMPORTANT: Beware that changing an allowance with this method brings the risk\n * that someone may use both the old and the new allowance by unfortunate\n * transaction ordering. One possible solution to mitigate this race\n * condition is to first reduce the spender's allowance to 0 and set the\n * desired value afterwards:\n * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729\n *\n * Emits an {Approval} event.\n */\n function approve(address spender, uint256 amount) external returns (bool);\n\n /**\n * @dev Moves `amount` tokens from `sender` to `recipient` using the\n * allowance mechanism. `amount` is then deducted from the caller's\n * allowance.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * Emits a {Transfer} event.\n */\n function transferFrom(\n address sender,\n address recipient,\n uint256 amount\n ) external returns (bool);\n\n /**\n * @dev Emitted when `value` tokens are moved from one account (`from`) to\n * another (`to`).\n *\n * Note that `value` may be zero.\n */\n event Transfer(address indexed from, address indexed to, uint256 value);\n\n /**\n * @dev Emitted when the allowance of a `spender` for an `owner` is set by\n * a call to {approve}. `value` is the new allowance.\n */\n event Approval(address indexed owner, address indexed spender, uint256 value);\n}\n" - }, - "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol": { - "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\nimport \"../IERC20.sol\";\nimport \"../../../utils/Address.sol\";\n\n/**\n * @title SafeERC20\n * @dev Wrappers around ERC20 operations that throw on failure (when the token\n * contract returns false). Tokens that return no value (and instead revert or\n * throw on failure) are also supported, non-reverting calls are assumed to be\n * successful.\n * To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract,\n * which allows you to call the safe operations as `token.safeTransfer(...)`, etc.\n */\nlibrary SafeERC20 {\n using Address for address;\n\n function safeTransfer(\n IERC20 token,\n address to,\n uint256 value\n ) internal {\n _callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value));\n }\n\n function safeTransferFrom(\n IERC20 token,\n address from,\n address to,\n uint256 value\n ) internal {\n _callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value));\n }\n\n /**\n * @dev Deprecated. This function has issues similar to the ones found in\n * {IERC20-approve}, and its usage is discouraged.\n *\n * Whenever possible, use {safeIncreaseAllowance} and\n * {safeDecreaseAllowance} instead.\n */\n function safeApprove(\n IERC20 token,\n address spender,\n uint256 value\n ) internal {\n // safeApprove should only be called when setting an initial allowance,\n // or when resetting it to zero. To increase and decrease it, use\n // 'safeIncreaseAllowance' and 'safeDecreaseAllowance'\n require(\n (value == 0) || (token.allowance(address(this), spender) == 0),\n \"SafeERC20: approve from non-zero to non-zero allowance\"\n );\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value));\n }\n\n function safeIncreaseAllowance(\n IERC20 token,\n address spender,\n uint256 value\n ) internal {\n uint256 newAllowance = token.allowance(address(this), spender) + value;\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));\n }\n\n function safeDecreaseAllowance(\n IERC20 token,\n address spender,\n uint256 value\n ) internal {\n unchecked {\n uint256 oldAllowance = token.allowance(address(this), spender);\n require(oldAllowance >= value, \"SafeERC20: decreased allowance below zero\");\n uint256 newAllowance = oldAllowance - value;\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));\n }\n }\n\n /**\n * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement\n * on the return value: the return value is optional (but if data is returned, it must not be false).\n * @param token The token targeted by the call.\n * @param data The call data (encoded using abi.encode or one of its variants).\n */\n function _callOptionalReturn(IERC20 token, bytes memory data) private {\n // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since\n // we're implementing it ourselves. We use {Address.functionCall} to perform this call, which verifies that\n // the target address contains contract code and also asserts for success in the low-level call.\n\n bytes memory returndata = address(token).functionCall(data, \"SafeERC20: low-level call failed\");\n if (returndata.length > 0) {\n // Return data is optional\n require(abi.decode(returndata, (bool)), \"SafeERC20: ERC20 operation did not succeed\");\n }\n }\n}\n" - }, - "@openzeppelin/contracts/utils/Address.sol": { - "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Collection of functions related to the address type\n */\nlibrary Address {\n /**\n * @dev Returns true if `account` is a contract.\n *\n * [IMPORTANT]\n * ====\n * It is unsafe to assume that an address for which this function returns\n * false is an externally-owned account (EOA) and not a contract.\n *\n * Among others, `isContract` will return false for the following\n * types of addresses:\n *\n * - an externally-owned account\n * - a contract in construction\n * - an address where a contract will be created\n * - an address where a contract lived, but was destroyed\n * ====\n */\n function isContract(address account) internal view returns (bool) {\n // This method relies on extcodesize, which returns 0 for contracts in\n // construction, since the code is only stored at the end of the\n // constructor execution.\n\n uint256 size;\n assembly {\n size := extcodesize(account)\n }\n return size > 0;\n }\n\n /**\n * @dev Replacement for Solidity's `transfer`: sends `amount` wei to\n * `recipient`, forwarding all available gas and reverting on errors.\n *\n * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost\n * of certain opcodes, possibly making contracts go over the 2300 gas limit\n * imposed by `transfer`, making them unable to receive funds via\n * `transfer`. {sendValue} removes this limitation.\n *\n * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].\n *\n * IMPORTANT: because control is transferred to `recipient`, care must be\n * taken to not create reentrancy vulnerabilities. Consider using\n * {ReentrancyGuard} or the\n * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].\n */\n function sendValue(address payable recipient, uint256 amount) internal {\n require(address(this).balance >= amount, \"Address: insufficient balance\");\n\n (bool success, ) = recipient.call{value: amount}(\"\");\n require(success, \"Address: unable to send value, recipient may have reverted\");\n }\n\n /**\n * @dev Performs a Solidity function call using a low level `call`. A\n * plain `call` is an unsafe replacement for a function call: use this\n * function instead.\n *\n * If `target` reverts with a revert reason, it is bubbled up by this\n * function (like regular Solidity function calls).\n *\n * Returns the raw returned data. To convert to the expected return value,\n * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\n *\n * Requirements:\n *\n * - `target` must be a contract.\n * - calling `target` with `data` must not revert.\n *\n * _Available since v3.1._\n */\n function functionCall(address target, bytes memory data) internal returns (bytes memory) {\n return functionCall(target, data, \"Address: low-level call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with\n * `errorMessage` as a fallback revert reason when `target` reverts.\n *\n * _Available since v3.1._\n */\n function functionCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal returns (bytes memory) {\n return functionCallWithValue(target, data, 0, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but also transferring `value` wei to `target`.\n *\n * Requirements:\n *\n * - the calling contract must have an ETH balance of at least `value`.\n * - the called Solidity function must be `payable`.\n *\n * _Available since v3.1._\n */\n function functionCallWithValue(\n address target,\n bytes memory data,\n uint256 value\n ) internal returns (bytes memory) {\n return functionCallWithValue(target, data, value, \"Address: low-level call with value failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but\n * with `errorMessage` as a fallback revert reason when `target` reverts.\n *\n * _Available since v3.1._\n */\n function functionCallWithValue(\n address target,\n bytes memory data,\n uint256 value,\n string memory errorMessage\n ) internal returns (bytes memory) {\n require(address(this).balance >= value, \"Address: insufficient balance for call\");\n require(isContract(target), \"Address: call to non-contract\");\n\n (bool success, bytes memory returndata) = target.call{value: value}(data);\n return verifyCallResult(success, returndata, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but performing a static call.\n *\n * _Available since v3.3._\n */\n function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\n return functionStaticCall(target, data, \"Address: low-level static call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\n * but performing a static call.\n *\n * _Available since v3.3._\n */\n function functionStaticCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal view returns (bytes memory) {\n require(isContract(target), \"Address: static call to non-contract\");\n\n (bool success, bytes memory returndata) = target.staticcall(data);\n return verifyCallResult(success, returndata, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but performing a delegate call.\n *\n * _Available since v3.4._\n */\n function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {\n return functionDelegateCall(target, data, \"Address: low-level delegate call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\n * but performing a delegate call.\n *\n * _Available since v3.4._\n */\n function functionDelegateCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal returns (bytes memory) {\n require(isContract(target), \"Address: delegate call to non-contract\");\n\n (bool success, bytes memory returndata) = target.delegatecall(data);\n return verifyCallResult(success, returndata, errorMessage);\n }\n\n /**\n * @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the\n * revert reason using the provided one.\n *\n * _Available since v4.3._\n */\n function verifyCallResult(\n bool success,\n bytes memory returndata,\n string memory errorMessage\n ) internal pure returns (bytes memory) {\n if (success) {\n return returndata;\n } else {\n // Look for revert reason and bubble it up if present\n if (returndata.length > 0) {\n // The easiest way to bubble the revert reason is using memory via assembly\n\n assembly {\n let returndata_size := mload(returndata)\n revert(add(32, returndata), returndata_size)\n }\n } else {\n revert(errorMessage);\n }\n }\n }\n}\n" - }, - "solidity/contracts/peripherals/jobs/Keep3rJobMigration.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../../../interfaces/peripherals/IKeep3rJobs.sol';\nimport './Keep3rJobFundableCredits.sol';\nimport './Keep3rJobFundableLiquidity.sol';\n\nabstract contract Keep3rJobMigration is IKeep3rJobMigration, Keep3rJobFundableCredits, Keep3rJobFundableLiquidity {\n using EnumerableSet for EnumerableSet.AddressSet;\n\n uint256 internal constant _MIGRATION_COOLDOWN = 1 minutes;\n\n /// @inheritdoc IKeep3rJobMigration\n mapping(address => address) public override pendingJobMigrations;\n mapping(address => mapping(address => uint256)) internal _migrationCreatedAt;\n\n /// @inheritdoc IKeep3rJobMigration\n function migrateJob(address _fromJob, address _toJob) external override onlyJobOwner(_fromJob) {\n if (_fromJob == _toJob) revert JobMigrationImpossible();\n\n pendingJobMigrations[_fromJob] = _toJob;\n _migrationCreatedAt[_fromJob][_toJob] = block.timestamp;\n\n emit JobMigrationRequested(_fromJob, _toJob);\n }\n\n /// @inheritdoc IKeep3rJobMigration\n function acceptJobMigration(address _fromJob, address _toJob) external override onlyJobOwner(_toJob) {\n if (disputes[_fromJob] || disputes[_toJob]) revert JobDisputed();\n if (pendingJobMigrations[_fromJob] != _toJob) revert JobMigrationUnavailable();\n if (block.timestamp < _migrationCreatedAt[_fromJob][_toJob] + _MIGRATION_COOLDOWN) revert JobMigrationLocked();\n\n // force job credits update for both jobs\n _settleJobAccountance(_fromJob);\n _settleJobAccountance(_toJob);\n\n // migrate tokens\n while (_jobTokens[_fromJob].length() > 0) {\n address _tokenToMigrate = _jobTokens[_fromJob].at(0);\n jobTokenCredits[_toJob][_tokenToMigrate] += jobTokenCredits[_fromJob][_tokenToMigrate];\n delete jobTokenCredits[_fromJob][_tokenToMigrate];\n _jobTokens[_fromJob].remove(_tokenToMigrate);\n _jobTokens[_toJob].add(_tokenToMigrate);\n }\n\n // migrate liquidities\n while (_jobLiquidities[_fromJob].length() > 0) {\n address _liquidity = _jobLiquidities[_fromJob].at(0);\n\n liquidityAmount[_toJob][_liquidity] += liquidityAmount[_fromJob][_liquidity];\n delete liquidityAmount[_fromJob][_liquidity];\n\n _jobLiquidities[_toJob].add(_liquidity);\n _jobLiquidities[_fromJob].remove(_liquidity);\n }\n\n // migrate job balances\n _jobPeriodCredits[_toJob] += _jobPeriodCredits[_fromJob];\n delete _jobPeriodCredits[_fromJob];\n\n _jobLiquidityCredits[_toJob] += _jobLiquidityCredits[_fromJob];\n delete _jobLiquidityCredits[_fromJob];\n\n // stop _fromJob from being a job\n delete rewardedAt[_fromJob];\n _jobs.remove(_fromJob);\n\n // delete unused data slots\n delete jobOwner[_fromJob];\n delete jobPendingOwner[_fromJob];\n delete _migrationCreatedAt[_fromJob][_toJob];\n delete pendingJobMigrations[_fromJob];\n\n emit JobMigrationSuccessful(_fromJob, _toJob);\n }\n}\n" - }, - "solidity/interfaces/IKeep3rHelper.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport './IKeep3rHelperParameters.sol';\n\n/// @title Keep3rHelper contract\n/// @notice Contains all the helper functions used throughout the different files.\ninterface IKeep3rHelper is IKeep3rHelperParameters {\n // Errors\n\n /// @notice Throws when none of the tokens in the liquidity pair is KP3R\n error LiquidityPairInvalid();\n\n // Methods\n // solhint-enable func-name-mixedcase\n\n /// @notice Calculates the amount of KP3R that corresponds to the ETH passed into the function\n /// @dev This function allows us to calculate how much KP3R we should pay to a keeper for things expressed in ETH, like gas\n /// @param _eth The amount of ETH\n /// @return _amountOut The amount of KP3R\n function quote(uint256 _eth) external view returns (uint256 _amountOut);\n\n /// @notice Returns the amount of KP3R the keeper has bonded\n /// @param _keeper The address of the keeper to check\n /// @return _amountBonded The amount of KP3R the keeper has bonded\n function bonds(address _keeper) external view returns (uint256 _amountBonded);\n\n /// @notice Calculates the reward (in KP3R) that corresponds to a keeper for using gas\n /// @param _keeper The address of the keeper to check\n /// @param _gasUsed The amount of gas used that will be rewarded\n /// @return _kp3r The amount of KP3R that should be awarded to the keeper\n function getRewardAmountFor(address _keeper, uint256 _gasUsed) external view returns (uint256 _kp3r);\n\n /// @notice Calculates the boost in the reward given to a keeper based on the amount of KP3R that keeper has bonded\n /// @dev If the keeper has no bonds, boost should be +10% of gas cost, if keeper has max bonds, +20%\n /// @param _bonds The amount of KP3R tokens bonded by the keeper\n /// @return _rewardBoost The reward boost that corresponds to the keeper\n function getRewardBoostFor(uint256 _bonds) external view returns (uint256 _rewardBoost);\n\n /// @notice Calculates the reward (in KP3R) that corresponds to tx.origin for using gas\n /// @param _gasUsed The amount of gas used that will be rewarded\n /// @return _amount The amount of KP3R that should be awarded to tx.origin\n function getRewardAmount(uint256 _gasUsed) external view returns (uint256 _amount);\n\n /// @notice Given a pool address, returns the underlying tokens of the pair\n /// @param _pool Address of the correspondant pool\n /// @return _token0 Address of the first token of the pair\n /// @return _token1 Address of the second token of the pair\n function getPoolTokens(address _pool) external view returns (address _token0, address _token1);\n\n /// @notice Defines the order of the tokens in the pair for twap calculations\n /// @param _pool Address of the correspondant pool\n /// @return _isKP3RToken0 Boolean indicating the order of the tokens in the pair\n function isKP3RToken0(address _pool) external view returns (bool _isKP3RToken0);\n\n /// @notice Given an array of secondsAgo, returns UniswapV3 pool cumulatives at that moment\n /// @param _pool Address of the pool to observe\n /// @param _secondsAgo Array with time references to observe\n /// @return _tickCumulative1 Cumulative sum of ticks until first time reference\n /// @return _tickCumulative2 Cumulative sum of ticks until second time reference\n /// @return _success Boolean indicating if the observe call was succesfull\n function observe(address _pool, uint32[] memory _secondsAgo)\n external\n view\n returns (\n int56 _tickCumulative1,\n int56 _tickCumulative2,\n bool _success\n );\n\n /// @notice Get multiplier, quote, and extra, in order to calculate keeper payment\n /// @param _bonds Amount of bonded KP3R owned by the keeper\n /// @return _boost Multiplier per gas unit. Takes into account the base fee and the amount of bonded KP3R\n /// @return _oneEthQuote Amount of KP3R tokens equivalent to 1 ETH\n /// @return _extra Amount of extra gas that should be added to the gas spent\n function getPaymentParams(uint256 _bonds)\n external\n view\n returns (\n uint256 _boost,\n uint256 _oneEthQuote,\n uint256 _extra\n );\n\n /// @notice Given a tick and a liquidity amount, calculates the underlying KP3R tokens\n /// @param _liquidityAmount Amount of liquidity to be converted\n /// @param _tickDifference Tick value used to calculate the quote\n /// @param _timeInterval Time value used to calculate the quote\n /// @return _kp3rAmount Amount of KP3R tokens underlying on the given liquidity\n function getKP3RsAtTick(\n uint256 _liquidityAmount,\n int56 _tickDifference,\n uint256 _timeInterval\n ) external pure returns (uint256 _kp3rAmount);\n\n /// @notice Given a tick and a token amount, calculates the output in correspondant token\n /// @param _baseAmount Amount of token to be converted\n /// @param _tickDifference Tick value used to calculate the quote\n /// @param _timeInterval Time value used to calculate the quote\n /// @return _quoteAmount Amount of credits deserved for the baseAmount at the tick value\n function getQuoteAtTick(\n uint128 _baseAmount,\n int56 _tickDifference,\n uint256 _timeInterval\n ) external pure returns (uint256 _quoteAmount);\n}\n" - }, - "solidity/contracts/peripherals/jobs/Keep3rJobFundableCredits.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport './Keep3rJobOwnership.sol';\nimport '../Keep3rAccountance.sol';\nimport '../Keep3rParameters.sol';\nimport '../../../interfaces/peripherals/IKeep3rJobs.sol';\n\nimport '@openzeppelin/contracts/security/ReentrancyGuard.sol';\nimport '@openzeppelin/contracts/token/ERC20/IERC20.sol';\nimport '@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol';\nimport '@openzeppelin/contracts/utils/math/Math.sol';\n\nabstract contract Keep3rJobFundableCredits is IKeep3rJobFundableCredits, ReentrancyGuard, Keep3rJobOwnership, Keep3rParameters {\n using EnumerableSet for EnumerableSet.AddressSet;\n using SafeERC20 for IERC20;\n\n /// @notice Cooldown between withdrawals\n uint256 internal constant _WITHDRAW_TOKENS_COOLDOWN = 1 minutes;\n\n /// @inheritdoc IKeep3rJobFundableCredits\n mapping(address => mapping(address => uint256)) public override jobTokenCreditsAddedAt;\n\n /// @inheritdoc IKeep3rJobFundableCredits\n function addTokenCreditsToJob(\n address _job,\n address _token,\n uint256 _amount\n ) external override nonReentrant {\n if (!_jobs.contains(_job)) revert JobUnavailable();\n // KP3R shouldn't be used for direct token payments\n if (_token == keep3rV1) revert TokenUnallowed();\n uint256 _before = IERC20(_token).balanceOf(address(this));\n IERC20(_token).safeTransferFrom(msg.sender, address(this), _amount);\n uint256 _received = IERC20(_token).balanceOf(address(this)) - _before;\n uint256 _tokenFee = (_received * fee) / _BASE;\n jobTokenCredits[_job][_token] += _received - _tokenFee;\n jobTokenCreditsAddedAt[_job][_token] = block.timestamp;\n IERC20(_token).safeTransfer(governance, _tokenFee);\n _jobTokens[_job].add(_token);\n\n emit TokenCreditAddition(_job, _token, msg.sender, _received);\n }\n\n /// @inheritdoc IKeep3rJobFundableCredits\n function withdrawTokenCreditsFromJob(\n address _job,\n address _token,\n uint256 _amount,\n address _receiver\n ) external override nonReentrant onlyJobOwner(_job) {\n if (block.timestamp <= jobTokenCreditsAddedAt[_job][_token] + _WITHDRAW_TOKENS_COOLDOWN) revert JobTokenCreditsLocked();\n if (jobTokenCredits[_job][_token] < _amount) revert InsufficientJobTokenCredits();\n if (disputes[_job]) revert JobDisputed();\n\n jobTokenCredits[_job][_token] -= _amount;\n IERC20(_token).safeTransfer(_receiver, _amount);\n\n if (jobTokenCredits[_job][_token] == 0) {\n _jobTokens[_job].remove(_token);\n }\n\n emit TokenCreditWithdrawal(_job, _token, _receiver, _amount);\n }\n}\n" - }, - "solidity/contracts/peripherals/jobs/Keep3rJobFundableLiquidity.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport './Keep3rJobOwnership.sol';\nimport '../Keep3rAccountance.sol';\nimport '../Keep3rParameters.sol';\nimport '../../../interfaces/IPairManager.sol';\nimport '../../../interfaces/peripherals/IKeep3rJobs.sol';\n\nimport '../../libraries/FullMath.sol';\n\nimport '@openzeppelin/contracts/security/ReentrancyGuard.sol';\nimport '@openzeppelin/contracts/token/ERC20/IERC20.sol';\nimport '@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol';\nimport '@openzeppelin/contracts/utils/math/Math.sol';\n\nabstract contract Keep3rJobFundableLiquidity is IKeep3rJobFundableLiquidity, ReentrancyGuard, Keep3rJobOwnership, Keep3rParameters {\n using EnumerableSet for EnumerableSet.AddressSet;\n using SafeERC20 for IERC20;\n\n /// @notice List of liquidities that are accepted in the system\n EnumerableSet.AddressSet internal _approvedLiquidities;\n\n /// @inheritdoc IKeep3rJobFundableLiquidity\n mapping(address => mapping(address => uint256)) public override liquidityAmount;\n\n /// @inheritdoc IKeep3rJobFundableLiquidity\n mapping(address => uint256) public override rewardedAt;\n\n /// @inheritdoc IKeep3rJobFundableLiquidity\n mapping(address => uint256) public override workedAt;\n\n /// @notice Tracks an address and returns its TickCache\n mapping(address => TickCache) internal _tick;\n\n // Views\n\n /// @inheritdoc IKeep3rJobFundableLiquidity\n function approvedLiquidities() external view override returns (address[] memory _list) {\n _list = _approvedLiquidities.values();\n }\n\n /// @inheritdoc IKeep3rJobFundableLiquidity\n function jobPeriodCredits(address _job) public view override returns (uint256 _periodCredits) {\n for (uint256 i; i < _jobLiquidities[_job].length(); i++) {\n address _liquidity = _jobLiquidities[_job].at(i);\n if (_approvedLiquidities.contains(_liquidity)) {\n TickCache memory _tickCache = observeLiquidity(_liquidity);\n if (_tickCache.period != 0) {\n int56 _tickDifference = _isKP3RToken0[_liquidity] ? _tickCache.difference : -_tickCache.difference;\n _periodCredits += _getReward(\n IKeep3rHelper(keep3rHelper).getKP3RsAtTick(liquidityAmount[_job][_liquidity], _tickDifference, rewardPeriodTime)\n );\n }\n }\n }\n }\n\n /// @inheritdoc IKeep3rJobFundableLiquidity\n function jobLiquidityCredits(address _job) public view override returns (uint256 _liquidityCredits) {\n uint256 _periodCredits = jobPeriodCredits(_job);\n\n // If the job was rewarded in the past 1 period time\n if ((block.timestamp - rewardedAt[_job]) < rewardPeriodTime) {\n // If the job has period credits, update minted job credits to new twap\n _liquidityCredits = _periodCredits > 0\n ? (_jobLiquidityCredits[_job] * _periodCredits) / _jobPeriodCredits[_job] // If the job has period credits, return remaining job credits updated to new twap\n : _jobLiquidityCredits[_job]; // If not, return remaining credits, forced credits should not be updated\n } else {\n // Else return a full period worth of credits if current credits have expired\n _liquidityCredits = _periodCredits;\n }\n }\n\n /// @inheritdoc IKeep3rJobFundableLiquidity\n function totalJobCredits(address _job) external view override returns (uint256 _credits) {\n uint256 _periodCredits = jobPeriodCredits(_job);\n uint256 _cooldown = block.timestamp;\n\n if ((rewardedAt[_job] > _period(block.timestamp - rewardPeriodTime))) {\n // Will calculate cooldown if it outdated\n if ((block.timestamp - rewardedAt[_job]) >= rewardPeriodTime) {\n // Will calculate cooldown from last reward reference in this period\n _cooldown -= (rewardedAt[_job] + rewardPeriodTime);\n } else {\n // Will calculate cooldown from last reward timestamp\n _cooldown -= rewardedAt[_job];\n }\n } else {\n // Will calculate cooldown from period start if expired\n _cooldown -= _period(block.timestamp);\n }\n _credits = jobLiquidityCredits(_job) + _phase(_cooldown, _periodCredits);\n }\n\n /// @inheritdoc IKeep3rJobFundableLiquidity\n function quoteLiquidity(address _liquidity, uint256 _amount) external view override returns (uint256 _periodCredits) {\n if (_approvedLiquidities.contains(_liquidity)) {\n TickCache memory _tickCache = observeLiquidity(_liquidity);\n if (_tickCache.period != 0) {\n int56 _tickDifference = _isKP3RToken0[_liquidity] ? _tickCache.difference : -_tickCache.difference;\n return _getReward(IKeep3rHelper(keep3rHelper).getKP3RsAtTick(_amount, _tickDifference, rewardPeriodTime));\n }\n }\n }\n\n /// @inheritdoc IKeep3rJobFundableLiquidity\n function observeLiquidity(address _liquidity) public view virtual override returns (TickCache memory _tickCache) {\n if (_tick[_liquidity].period == _period(block.timestamp)) {\n // Will return cached twaps if liquidity is updated\n _tickCache = _tick[_liquidity];\n } else {\n bool success;\n uint256 lastPeriod = _period(block.timestamp - rewardPeriodTime);\n\n if (_tick[_liquidity].period == lastPeriod) {\n // Will only ask for current period accumulator if liquidity is outdated\n uint32[] memory _secondsAgo = new uint32[](1);\n int56 previousTick = _tick[_liquidity].current;\n\n _secondsAgo[0] = uint32(block.timestamp - _period(block.timestamp));\n\n (_tickCache.current, , success) = IKeep3rHelper(keep3rHelper).observe(_liquidityPool[_liquidity], _secondsAgo);\n\n _tickCache.difference = _tickCache.current - previousTick;\n } else if (_tick[_liquidity].period < lastPeriod) {\n // Will ask for 2 accumulators if liquidity is expired\n uint32[] memory _secondsAgo = new uint32[](2);\n\n _secondsAgo[0] = uint32(block.timestamp - _period(block.timestamp));\n _secondsAgo[1] = uint32(block.timestamp - _period(block.timestamp) + rewardPeriodTime);\n\n int56 _tickCumulative2;\n (_tickCache.current, _tickCumulative2, success) = IKeep3rHelper(keep3rHelper).observe(_liquidityPool[_liquidity], _secondsAgo);\n\n _tickCache.difference = _tickCache.current - _tickCumulative2;\n }\n if (success) {\n _tickCache.period = _period(block.timestamp);\n } else {\n delete _tickCache.period;\n }\n }\n }\n\n // Methods\n\n /// @inheritdoc IKeep3rJobFundableLiquidity\n function forceLiquidityCreditsToJob(address _job, uint256 _amount) external override onlyGovernance {\n if (!_jobs.contains(_job)) revert JobUnavailable();\n _settleJobAccountance(_job);\n _jobLiquidityCredits[_job] += _amount;\n emit LiquidityCreditsForced(_job, rewardedAt[_job], _jobLiquidityCredits[_job]);\n }\n\n /// @inheritdoc IKeep3rJobFundableLiquidity\n function approveLiquidity(address _liquidity) external virtual override onlyGovernance {\n if (!_approvedLiquidities.add(_liquidity)) revert LiquidityPairApproved();\n _liquidityPool[_liquidity] = IPairManager(_liquidity).pool();\n _isKP3RToken0[_liquidity] = IKeep3rHelper(keep3rHelper).isKP3RToken0(_liquidityPool[_liquidity]);\n _tick[_liquidity] = observeLiquidity(_liquidity);\n emit LiquidityApproval(_liquidity);\n }\n\n /// @inheritdoc IKeep3rJobFundableLiquidity\n function revokeLiquidity(address _liquidity) external override onlyGovernance {\n if (!_approvedLiquidities.remove(_liquidity)) revert LiquidityPairUnexistent();\n delete _liquidityPool[_liquidity];\n delete _isKP3RToken0[_liquidity];\n delete _tick[_liquidity];\n\n emit LiquidityRevocation(_liquidity);\n }\n\n /// @inheritdoc IKeep3rJobFundableLiquidity\n function addLiquidityToJob(\n address _job,\n address _liquidity,\n uint256 _amount\n ) external override nonReentrant {\n if (!_approvedLiquidities.contains(_liquidity)) revert LiquidityPairUnapproved();\n if (!_jobs.contains(_job)) revert JobUnavailable();\n\n _jobLiquidities[_job].add(_liquidity);\n\n _settleJobAccountance(_job);\n\n if (_quoteLiquidity(liquidityAmount[_job][_liquidity] + _amount, _liquidity) < liquidityMinimum) revert JobLiquidityLessThanMin();\n\n emit LiquidityCreditsReward(_job, rewardedAt[_job], _jobLiquidityCredits[_job], _jobPeriodCredits[_job]);\n\n IERC20(_liquidity).safeTransferFrom(msg.sender, address(this), _amount);\n liquidityAmount[_job][_liquidity] += _amount;\n _jobPeriodCredits[_job] += _getReward(_quoteLiquidity(_amount, _liquidity));\n emit LiquidityAddition(_job, _liquidity, msg.sender, _amount);\n }\n\n /// @inheritdoc IKeep3rJobFundableLiquidity\n function unbondLiquidityFromJob(\n address _job,\n address _liquidity,\n uint256 _amount\n ) external override onlyJobOwner(_job) {\n canWithdrawAfter[_job][_liquidity] = block.timestamp + unbondTime;\n pendingUnbonds[_job][_liquidity] += _amount;\n _unbondLiquidityFromJob(_job, _liquidity, _amount);\n\n uint256 _remainingLiquidity = liquidityAmount[_job][_liquidity];\n if (_remainingLiquidity > 0 && _quoteLiquidity(_remainingLiquidity, _liquidity) < liquidityMinimum) revert JobLiquidityLessThanMin();\n\n emit Unbonding(_job, _liquidity, _amount);\n }\n\n /// @inheritdoc IKeep3rJobFundableLiquidity\n function withdrawLiquidityFromJob(\n address _job,\n address _liquidity,\n address _receiver\n ) external override onlyJobOwner(_job) {\n if (_receiver == address(0)) revert ZeroAddress();\n if (pendingUnbonds[_job][_liquidity] == 0) revert UnbondsUnexistent();\n if (canWithdrawAfter[_job][_liquidity] >= block.timestamp) revert UnbondsLocked();\n if (disputes[_job]) revert Disputed();\n\n uint256 _amount = pendingUnbonds[_job][_liquidity];\n\n delete pendingUnbonds[_job][_liquidity];\n delete canWithdrawAfter[_job][_liquidity];\n\n IERC20(_liquidity).safeTransfer(_receiver, _amount);\n emit LiquidityWithdrawal(_job, _liquidity, _receiver, _amount);\n }\n\n // Internal functions\n\n /// @notice Updates or rewards job liquidity credits depending on time since last job reward\n function _updateJobCreditsIfNeeded(address _job) internal returns (bool _rewarded) {\n if (rewardedAt[_job] < _period(block.timestamp)) {\n // Will exit function if job has been rewarded in current period\n if (rewardedAt[_job] <= _period(block.timestamp - rewardPeriodTime)) {\n // Will reset job to period syncronicity if a full period passed without rewards\n _updateJobPeriod(_job);\n _jobLiquidityCredits[_job] = _jobPeriodCredits[_job];\n rewardedAt[_job] = _period(block.timestamp);\n _rewarded = true;\n } else if ((block.timestamp - rewardedAt[_job]) >= rewardPeriodTime) {\n // Will reset job's syncronicity if last reward was more than epoch ago\n _updateJobPeriod(_job);\n _jobLiquidityCredits[_job] = _jobPeriodCredits[_job];\n rewardedAt[_job] += rewardPeriodTime;\n _rewarded = true;\n } else if (workedAt[_job] < _period(block.timestamp)) {\n // First keeper on period has to update job accountance to current twaps\n uint256 previousPeriodCredits = _jobPeriodCredits[_job];\n _updateJobPeriod(_job);\n _jobLiquidityCredits[_job] = (_jobLiquidityCredits[_job] * _jobPeriodCredits[_job]) / previousPeriodCredits;\n // Updating job accountance does not reward job\n }\n }\n }\n\n /// @notice Only called if _jobLiquidityCredits < payment\n function _rewardJobCredits(address _job) internal {\n /// @notice Only way to += jobLiquidityCredits is when keeper rewarding (cannot pay work)\n /* WARNING: this allows to top up _jobLiquidityCredits to a max of 1.99 but have to spend at least 1 */\n _jobLiquidityCredits[_job] += _phase(block.timestamp - rewardedAt[_job], _jobPeriodCredits[_job]);\n rewardedAt[_job] = block.timestamp;\n }\n\n /// @notice Updates accountance for _jobPeriodCredits\n function _updateJobPeriod(address _job) internal {\n _jobPeriodCredits[_job] = _calculateJobPeriodCredits(_job);\n }\n\n /// @notice Quotes the outdated job liquidities and calculates _periodCredits\n /// @dev This function is also responsible for keeping the KP3R/WETH quote updated\n function _calculateJobPeriodCredits(address _job) internal returns (uint256 _periodCredits) {\n for (uint256 i; i < _jobLiquidities[_job].length(); i++) {\n address _liquidity = _jobLiquidities[_job].at(i);\n if (_approvedLiquidities.contains(_liquidity)) {\n if (_tick[_liquidity].period != _period(block.timestamp)) {\n // Updates liquidity cache only if needed\n _tick[_liquidity] = observeLiquidity(_liquidity);\n }\n _periodCredits += _getReward(_quoteLiquidity(liquidityAmount[_job][_liquidity], _liquidity));\n }\n }\n }\n\n /// @notice Updates job accountance calculating the impact of the unbonded liquidity amount\n function _unbondLiquidityFromJob(\n address _job,\n address _liquidity,\n uint256 _amount\n ) internal nonReentrant {\n if (!_jobLiquidities[_job].contains(_liquidity)) revert JobLiquidityUnexistent();\n if (liquidityAmount[_job][_liquidity] < _amount) revert JobLiquidityInsufficient();\n\n // Ensures current twaps in job liquidities\n _updateJobPeriod(_job);\n uint256 _periodCreditsToRemove = _getReward(_quoteLiquidity(_amount, _liquidity));\n\n // A liquidity can be revoked causing a job to have 0 periodCredits\n if (_jobPeriodCredits[_job] > 0) {\n // Removes a % correspondant to a full rewardPeriodTime for the liquidity withdrawn vs all of the liquidities\n _jobLiquidityCredits[_job] -= (_jobLiquidityCredits[_job] * _periodCreditsToRemove) / _jobPeriodCredits[_job];\n _jobPeriodCredits[_job] -= _periodCreditsToRemove;\n }\n\n liquidityAmount[_job][_liquidity] -= _amount;\n if (liquidityAmount[_job][_liquidity] == 0) {\n _jobLiquidities[_job].remove(_liquidity);\n }\n }\n\n /// @notice Returns a fraction of the multiplier or the whole multiplier if equal or more than a rewardPeriodTime has passed\n function _phase(uint256 _timePassed, uint256 _multiplier) internal view returns (uint256 _result) {\n if (_timePassed < rewardPeriodTime) {\n _result = (_timePassed * _multiplier) / rewardPeriodTime;\n } else _result = _multiplier;\n }\n\n /// @notice Returns the start of the period of the provided timestamp\n function _period(uint256 _timestamp) internal view returns (uint256 _periodTimestamp) {\n return _timestamp - (_timestamp % rewardPeriodTime);\n }\n\n /// @notice Calculates relation between rewardPeriod and inflationPeriod\n function _getReward(uint256 _baseAmount) internal view returns (uint256 _credits) {\n return FullMath.mulDiv(_baseAmount, rewardPeriodTime, inflationPeriod);\n }\n\n /// @notice Returns underlying KP3R amount for a given liquidity amount\n function _quoteLiquidity(uint256 _amount, address _liquidity) internal view returns (uint256 _quote) {\n if (_tick[_liquidity].period != 0) {\n int56 _tickDifference = _isKP3RToken0[_liquidity] ? _tick[_liquidity].difference : -_tick[_liquidity].difference;\n _quote = IKeep3rHelper(keep3rHelper).getKP3RsAtTick(_amount, _tickDifference, rewardPeriodTime);\n }\n }\n\n /// @notice Updates job credits to current quotes and rewards job's pending minted credits\n /// @dev Ensures a maximum of 1 period of credits\n function _settleJobAccountance(address _job) internal virtual {\n _updateJobCreditsIfNeeded(_job);\n _rewardJobCredits(_job);\n _jobLiquidityCredits[_job] = Math.min(_jobLiquidityCredits[_job], _jobPeriodCredits[_job]);\n }\n}\n" - }, - "solidity/contracts/peripherals/Keep3rParameters.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../../interfaces/IKeep3rHelper.sol';\nimport '../../interfaces/peripherals/IKeep3rParameters.sol';\nimport '../../interfaces/external/IKeep3rV1Proxy.sol';\nimport './Keep3rAccountance.sol';\n\nabstract contract Keep3rParameters is IKeep3rParameters, Keep3rAccountance {\n /// @inheritdoc IKeep3rParameters\n address public override keep3rV1;\n\n /// @inheritdoc IKeep3rParameters\n address public override keep3rV1Proxy;\n\n /// @inheritdoc IKeep3rParameters\n address public override keep3rHelper;\n\n /// @inheritdoc IKeep3rParameters\n uint256 public override bondTime = 3 days;\n\n /// @inheritdoc IKeep3rParameters\n uint256 public override unbondTime = 14 days;\n\n /// @inheritdoc IKeep3rParameters\n uint256 public override liquidityMinimum = 3 ether;\n\n /// @inheritdoc IKeep3rParameters\n uint256 public override rewardPeriodTime = 5 days;\n\n /// @inheritdoc IKeep3rParameters\n uint256 public override inflationPeriod = 34 days;\n\n /// @inheritdoc IKeep3rParameters\n uint256 public override fee = 30;\n\n /// @notice The base that will be used to calculate the fee\n uint256 internal constant _BASE = 10_000;\n\n /// @notice The minimum reward period\n uint256 internal constant _MIN_REWARD_PERIOD_TIME = 1 days;\n\n constructor(\n address _keep3rHelper,\n address _keep3rV1,\n address _keep3rV1Proxy\n ) {\n keep3rHelper = _keep3rHelper;\n keep3rV1 = _keep3rV1;\n keep3rV1Proxy = _keep3rV1Proxy;\n }\n\n /// @inheritdoc IKeep3rParameters\n function setKeep3rHelper(address _keep3rHelper) external override onlyGovernance {\n if (_keep3rHelper == address(0)) revert ZeroAddress();\n keep3rHelper = _keep3rHelper;\n emit Keep3rHelperChange(_keep3rHelper);\n }\n\n /// @inheritdoc IKeep3rParameters\n function setKeep3rV1(address _keep3rV1) public virtual override onlyGovernance {\n if (_keep3rV1 == address(0)) revert ZeroAddress();\n _mint(totalBonds);\n\n keep3rV1 = _keep3rV1;\n emit Keep3rV1Change(_keep3rV1);\n }\n\n /// @inheritdoc IKeep3rParameters\n function setKeep3rV1Proxy(address _keep3rV1Proxy) external override onlyGovernance {\n if (_keep3rV1Proxy == address(0)) revert ZeroAddress();\n keep3rV1Proxy = _keep3rV1Proxy;\n emit Keep3rV1ProxyChange(_keep3rV1Proxy);\n }\n\n /// @inheritdoc IKeep3rParameters\n function setBondTime(uint256 _bondTime) external override onlyGovernance {\n bondTime = _bondTime;\n emit BondTimeChange(_bondTime);\n }\n\n /// @inheritdoc IKeep3rParameters\n function setUnbondTime(uint256 _unbondTime) external override onlyGovernance {\n unbondTime = _unbondTime;\n emit UnbondTimeChange(_unbondTime);\n }\n\n /// @inheritdoc IKeep3rParameters\n function setLiquidityMinimum(uint256 _liquidityMinimum) external override onlyGovernance {\n liquidityMinimum = _liquidityMinimum;\n emit LiquidityMinimumChange(_liquidityMinimum);\n }\n\n /// @inheritdoc IKeep3rParameters\n function setRewardPeriodTime(uint256 _rewardPeriodTime) external override onlyGovernance {\n if (_rewardPeriodTime < _MIN_REWARD_PERIOD_TIME) revert MinRewardPeriod();\n rewardPeriodTime = _rewardPeriodTime;\n emit RewardPeriodTimeChange(_rewardPeriodTime);\n }\n\n /// @inheritdoc IKeep3rParameters\n function setInflationPeriod(uint256 _inflationPeriod) external override onlyGovernance {\n inflationPeriod = _inflationPeriod;\n emit InflationPeriodChange(_inflationPeriod);\n }\n\n /// @inheritdoc IKeep3rParameters\n function setFee(uint256 _fee) external override onlyGovernance {\n fee = _fee;\n emit FeeChange(_fee);\n }\n\n function _mint(uint256 _amount) internal {\n totalBonds -= _amount;\n IKeep3rV1Proxy(keep3rV1Proxy).mint(_amount);\n }\n}\n" - }, - "@openzeppelin/contracts/security/ReentrancyGuard.sol": { - "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Contract module that helps prevent reentrant calls to a function.\n *\n * Inheriting from `ReentrancyGuard` will make the {nonReentrant} modifier\n * available, which can be applied to functions to make sure there are no nested\n * (reentrant) calls to them.\n *\n * Note that because there is a single `nonReentrant` guard, functions marked as\n * `nonReentrant` may not call one another. This can be worked around by making\n * those functions `private`, and then adding `external` `nonReentrant` entry\n * points to them.\n *\n * TIP: If you would like to learn more about reentrancy and alternative ways\n * to protect against it, check out our blog post\n * https://blog.openzeppelin.com/reentrancy-after-istanbul/[Reentrancy After Istanbul].\n */\nabstract contract ReentrancyGuard {\n // Booleans are more expensive than uint256 or any type that takes up a full\n // word because each write operation emits an extra SLOAD to first read the\n // slot's contents, replace the bits taken up by the boolean, and then write\n // back. This is the compiler's defense against contract upgrades and\n // pointer aliasing, and it cannot be disabled.\n\n // The values being non-zero value makes deployment a bit more expensive,\n // but in exchange the refund on every call to nonReentrant will be lower in\n // amount. Since refunds are capped to a percentage of the total\n // transaction's gas, it is best to keep them low in cases like this one, to\n // increase the likelihood of the full refund coming into effect.\n uint256 private constant _NOT_ENTERED = 1;\n uint256 private constant _ENTERED = 2;\n\n uint256 private _status;\n\n constructor() {\n _status = _NOT_ENTERED;\n }\n\n /**\n * @dev Prevents a contract from calling itself, directly or indirectly.\n * Calling a `nonReentrant` function from another `nonReentrant`\n * function is not supported. It is possible to prevent this from happening\n * by making the `nonReentrant` function external, and make it call a\n * `private` function that does the actual work.\n */\n modifier nonReentrant() {\n // On the first call to nonReentrant, _notEntered will be true\n require(_status != _ENTERED, \"ReentrancyGuard: reentrant call\");\n\n // Any calls to nonReentrant after this point will fail\n _status = _ENTERED;\n\n _;\n\n // By storing the original value once again, a refund is triggered (see\n // https://eips.ethereum.org/EIPS/eip-2200)\n _status = _NOT_ENTERED;\n }\n}\n" - }, - "@openzeppelin/contracts/utils/math/Math.sol": { - "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Standard math utilities missing in the Solidity language.\n */\nlibrary Math {\n /**\n * @dev Returns the largest of two numbers.\n */\n function max(uint256 a, uint256 b) internal pure returns (uint256) {\n return a >= b ? a : b;\n }\n\n /**\n * @dev Returns the smallest of two numbers.\n */\n function min(uint256 a, uint256 b) internal pure returns (uint256) {\n return a < b ? a : b;\n }\n\n /**\n * @dev Returns the average of two numbers. The result is rounded towards\n * zero.\n */\n function average(uint256 a, uint256 b) internal pure returns (uint256) {\n // (a + b) / 2 can overflow.\n return (a & b) + (a ^ b) / 2;\n }\n\n /**\n * @dev Returns the ceiling of the division of two numbers.\n *\n * This differs from standard division with `/` in that it rounds up instead\n * of rounding down.\n */\n function ceilDiv(uint256 a, uint256 b) internal pure returns (uint256) {\n // (a + b - 1) / b can overflow on addition, so we distribute.\n return a / b + (a % b == 0 ? 0 : 1);\n }\n}\n" - }, - "solidity/interfaces/external/IKeep3rV1Proxy.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../peripherals/IGovernable.sol';\n\ninterface IKeep3rV1Proxy is IGovernable {\n // Structs\n struct Recipient {\n address recipient;\n uint256 caps;\n }\n\n // Variables\n function keep3rV1() external view returns (address);\n\n function minter() external view returns (address);\n\n function next(address) external view returns (uint256);\n\n function caps(address) external view returns (uint256);\n\n function recipients() external view returns (address[] memory);\n\n function recipientsCaps() external view returns (Recipient[] memory);\n\n // Errors\n error Cooldown();\n error NoDrawableAmount();\n error ZeroAddress();\n error OnlyMinter();\n\n // Methods\n function addRecipient(address recipient, uint256 amount) external;\n\n function removeRecipient(address recipient) external;\n\n function draw() external returns (uint256 _amount);\n\n function setKeep3rV1(address _keep3rV1) external;\n\n function setMinter(address _minter) external;\n\n function mint(uint256 _amount) external;\n\n function mint(address _account, uint256 _amount) external;\n\n function setKeep3rV1Governance(address _governance) external;\n\n function acceptKeep3rV1Governance() external;\n\n function dispute(address _keeper) external;\n\n function slash(\n address _bonded,\n address _keeper,\n uint256 _amount\n ) external;\n\n function revoke(address _keeper) external;\n\n function resolve(address _keeper) external;\n\n function addJob(address _job) external;\n\n function removeJob(address _job) external;\n\n function addKPRCredit(address _job, uint256 _amount) external;\n\n function approveLiquidity(address _liquidity) external;\n\n function revokeLiquidity(address _liquidity) external;\n\n function setKeep3rHelper(address _keep3rHelper) external;\n\n function addVotes(address _voter, uint256 _amount) external;\n\n function removeVotes(address _voter, uint256 _amount) external;\n}\n" - }, - "solidity/interfaces/IKeep3rHelperParameters.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\n/// @title Keep3rHelperParameters contract\n/// @notice Contains all the helper functions used throughout the different files.\ninterface IKeep3rHelperParameters {\n // Structs\n\n /// @dev KP3R-WETH Pool address and isKP3RToken0\n /// @dev Created in order to save gas by avoiding calls to pool's token0 method\n struct TokenOraclePool {\n address poolAddress;\n bool isTKNToken0;\n }\n\n // Errors\n\n /// @notice Throws when pool does not have KP3R as token0 nor token1\n error InvalidOraclePool();\n\n // Events\n\n /// @notice Emitted when the kp3r weth pool is changed\n /// @param _address Address of the new kp3r weth pool\n /// @param _isKP3RToken0 True if calling the token0 method of the pool returns the KP3R token address\n event Kp3rWethPoolChange(address _address, bool _isKP3RToken0);\n\n /// @notice Emitted when the minimum boost multiplier is changed\n /// @param _minBoost The minimum boost multiplier\n event MinBoostChange(uint256 _minBoost);\n\n /// @notice Emitted when the maximum boost multiplier is changed\n /// @param _maxBoost The maximum boost multiplier\n event MaxBoostChange(uint256 _maxBoost);\n\n /// @notice Emitted when the target bond amount is changed\n /// @param _targetBond The target bond amount\n event TargetBondChange(uint256 _targetBond);\n\n /// @notice Emitted when the Keep3r V2 address is changed\n /// @param _keep3rV2 The address of Keep3r V2\n event Keep3rV2Change(address _keep3rV2);\n\n /// @notice Emitted when the work extra gas amount is changed\n /// @param _workExtraGas The work extra gas\n event WorkExtraGasChange(uint256 _workExtraGas);\n\n /// @notice Emitted when the quote twap time is changed\n /// @param _quoteTwapTime The twap time for quoting\n event QuoteTwapTimeChange(uint32 _quoteTwapTime);\n\n /// @notice Emitted when minimum rewarded gas fee is changed\n /// @param _minBaseFee The minimum rewarded gas fee\n event MinBaseFeeChange(uint256 _minBaseFee);\n\n /// @notice Emitted when minimum rewarded priority fee is changed\n /// @param _minPriorityFee The minimum expected fee that the keeper should pay\n event MinPriorityFeeChange(uint256 _minPriorityFee);\n\n // Variables\n\n /// @notice Address of KP3R token\n /// @return _kp3r Address of KP3R token\n // solhint-disable func-name-mixedcase\n function KP3R() external view returns (address _kp3r);\n\n /// @notice The boost base used to calculate the boost rewards for the keeper\n /// @return _base The boost base number\n function BOOST_BASE() external view returns (uint256 _base);\n\n /// @notice KP3R-WETH pool that is being used as oracle\n /// @return poolAddress Address of the pool\n /// @return isTKNToken0 True if calling the token0 method of the pool returns the KP3R token address\n function kp3rWethPool() external view returns (address poolAddress, bool isTKNToken0);\n\n /// @notice The minimum multiplier used to calculate the amount of gas paid to the Keeper for the gas used to perform a job\n /// For example: if the quoted gas used is 1000, then the minimum amount to be paid will be 1000 * minBoost / BOOST_BASE\n /// @return _multiplier The minimum boost multiplier\n function minBoost() external view returns (uint256 _multiplier);\n\n /// @notice The maximum multiplier used to calculate the amount of gas paid to the Keeper for the gas used to perform a job\n /// For example: if the quoted gas used is 1000, then the maximum amount to be paid will be 1000 * maxBoost / BOOST_BASE\n /// @return _multiplier The maximum boost multiplier\n function maxBoost() external view returns (uint256 _multiplier);\n\n /// @notice The targeted amount of bonded KP3Rs to max-up reward multiplier\n /// For example: if the amount of KP3R the keeper has bonded is targetBond or more, then the keeper will get\n /// the maximum boost possible in his rewards, if it's less, the reward boost will be proportional\n /// @return _target The amount of KP3R that comforms the targetBond\n function targetBond() external view returns (uint256 _target);\n\n /// @notice The amount of unaccounted gas that is going to be added to keeper payments\n /// @return _workExtraGas The work unaccounted gas amount\n function workExtraGas() external view returns (uint256 _workExtraGas);\n\n /// @notice The twap time for quoting\n /// @return _quoteTwapTime The twap time\n function quoteTwapTime() external view returns (uint32 _quoteTwapTime);\n\n /// @notice The minimum base fee that is used to calculate keeper rewards\n /// @return _minBaseFee The minimum rewarded gas fee\n function minBaseFee() external view returns (uint256 _minBaseFee);\n\n /// @notice The minimum priority fee that is also rewarded for keepers\n /// @return _minPriorityFee The minimum rewarded priority fee\n function minPriorityFee() external view returns (uint256 _minPriorityFee);\n\n /// @notice Address of Keep3r V2\n /// @return _keep3rV2 Address of Keep3r V2\n function keep3rV2() external view returns (address _keep3rV2);\n\n // Methods\n\n /// @notice Sets KP3R-WETH pool\n /// @param _poolAddress The address of the KP3R-WETH pool\n function setKp3rWethPool(address _poolAddress) external;\n\n /// @notice Sets the minimum boost multiplier\n /// @param _minBoost The minimum boost multiplier\n function setMinBoost(uint256 _minBoost) external;\n\n /// @notice Sets the maximum boost multiplier\n /// @param _maxBoost The maximum boost multiplier\n function setMaxBoost(uint256 _maxBoost) external;\n\n /// @notice Sets the target bond amount\n /// @param _targetBond The target bond amount\n function setTargetBond(uint256 _targetBond) external;\n\n /// @notice Sets the Keep3r V2 address\n /// @param _keep3rV2 The address of Keep3r V2\n function setKeep3rV2(address _keep3rV2) external;\n\n /// @notice Sets the work extra gas amount\n /// @param _workExtraGas The work extra gas\n function setWorkExtraGas(uint256 _workExtraGas) external;\n\n /// @notice Sets the quote twap time\n /// @param _quoteTwapTime The twap time for quoting\n function setQuoteTwapTime(uint32 _quoteTwapTime) external;\n\n /// @notice Sets the minimum rewarded gas fee\n /// @param _minBaseFee The minimum rewarded gas fee\n function setMinBaseFee(uint256 _minBaseFee) external;\n\n /// @notice Sets the minimum rewarded gas priority fee\n /// @param _minPriorityFee The minimum rewarded priority fee\n function setMinPriorityFee(uint256 _minPriorityFee) external;\n}\n" - }, - "solidity/interfaces/IPairManager.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol';\n\n/// @title Pair Manager interface\n/// @notice Generic interface for Keep3r liquidity pools (kLP)\ninterface IPairManager is IERC20Metadata {\n /// @notice Address of the factory from which the pair manager was created\n /// @return _factory The address of the PairManager Factory\n function factory() external view returns (address _factory);\n\n /// @notice Address of the pool from which the Keep3r pair manager will interact with\n /// @return _pool The address of the pool\n function pool() external view returns (address _pool);\n\n /// @notice Token0 of the pool\n /// @return _token0 The address of token0\n function token0() external view returns (address _token0);\n\n /// @notice Token1 of the pool\n /// @return _token1 The address of token1\n function token1() external view returns (address _token1);\n}\n" - }, - "solidity/contracts/libraries/FullMath.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\n/// @title Contains 512-bit math functions\n/// @notice Facilitates multiplication and division that can have overflow of an intermediate value without any loss of precision\n/// @dev Handles \"phantom overflow\" i.e., allows multiplication and division where an intermediate value overflows 256 bits\nlibrary FullMath {\n /// @notice Calculates floor(a×b÷denominator) with full precision. Throws if result overflows a uint256 or denominator == 0\n /// @param a The multiplicand\n /// @param b The multiplier\n /// @param denominator The divisor\n /// @return result The 256-bit result\n /// @dev Credit to Remco Bloemen under MIT license https://xn--2-umb.com/21/muldiv\n function mulDiv(\n uint256 a,\n uint256 b,\n uint256 denominator\n ) internal pure returns (uint256 result) {\n unchecked {\n // 512-bit multiply [prod1 prod0] = a * b\n // Compute the product mod 2**256 and mod 2**256 - 1\n // then use the Chinese Remainder Theorem to reconstruct\n // the 512 bit result. The result is stored in two 256\n // variables such that product = prod1 * 2**256 + prod0\n uint256 prod0; // Least significant 256 bits of the product\n uint256 prod1; // Most significant 256 bits of the product\n assembly {\n let mm := mulmod(a, b, not(0))\n prod0 := mul(a, b)\n prod1 := sub(sub(mm, prod0), lt(mm, prod0))\n }\n\n // Handle non-overflow cases, 256 by 256 division\n if (prod1 == 0) {\n require(denominator > 0);\n assembly {\n result := div(prod0, denominator)\n }\n return result;\n }\n\n // Make sure the result is less than 2**256.\n // Also prevents denominator == 0\n require(denominator > prod1);\n\n ///////////////////////////////////////////////\n // 512 by 256 division.\n ///////////////////////////////////////////////\n\n // Make division exact by subtracting the remainder from [prod1 prod0]\n // Compute remainder using mulmod\n uint256 remainder;\n assembly {\n remainder := mulmod(a, b, denominator)\n }\n // Subtract 256 bit number from 512 bit number\n assembly {\n prod1 := sub(prod1, gt(remainder, prod0))\n prod0 := sub(prod0, remainder)\n }\n\n // Factor powers of two out of denominator\n // Compute largest power of two divisor of denominator.\n // Always >= 1.\n uint256 twos = (~denominator + 1) & denominator;\n // Divide denominator by power of two\n assembly {\n denominator := div(denominator, twos)\n }\n\n // Divide [prod1 prod0] by the factors of two\n assembly {\n prod0 := div(prod0, twos)\n }\n // Shift in bits from prod1 into prod0. For this we need\n // to flip `twos` such that it is 2**256 / twos.\n // If twos is zero, then it becomes one\n assembly {\n twos := add(div(sub(0, twos), twos), 1)\n }\n prod0 |= prod1 * twos;\n\n // Invert denominator mod 2**256\n // Now that denominator is an odd number, it has an inverse\n // modulo 2**256 such that denominator * inv = 1 mod 2**256.\n // Compute the inverse by starting with a seed that is correct\n // correct for four bits. That is, denominator * inv = 1 mod 2**4\n uint256 inv = (3 * denominator) ^ 2;\n // Now use Newton-Raphson iteration to improve the precision.\n // Thanks to Hensel's lifting lemma, this also works in modular\n // arithmetic, doubling the correct bits in each step.\n inv *= 2 - denominator * inv; // inverse mod 2**8\n inv *= 2 - denominator * inv; // inverse mod 2**16\n inv *= 2 - denominator * inv; // inverse mod 2**32\n inv *= 2 - denominator * inv; // inverse mod 2**64\n inv *= 2 - denominator * inv; // inverse mod 2**128\n inv *= 2 - denominator * inv; // inverse mod 2**256\n\n // Because the division is now exact we can divide by multiplying\n // with the modular inverse of denominator. This will give us the\n // correct result modulo 2**256. Since the precoditions guarantee\n // that the outcome is less than 2**256, this is the final result.\n // We don't need to compute the high bits of the result and prod1\n // is no longer required.\n result = prod0 * inv;\n return result;\n }\n }\n\n /// @notice Calculates ceil(a×b÷denominator) with full precision. Throws if result overflows a uint256 or denominator == 0\n /// @param a The multiplicand\n /// @param b The multiplier\n /// @param denominator The divisor\n /// @return result The 256-bit result\n function mulDivRoundingUp(\n uint256 a,\n uint256 b,\n uint256 denominator\n ) internal pure returns (uint256 result) {\n unchecked {\n result = mulDiv(a, b, denominator);\n if (mulmod(a, b, denominator) > 0) {\n require(result < type(uint256).max);\n result++;\n }\n }\n }\n}\n" - }, - "@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol": { - "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\nimport \"../IERC20.sol\";\n\n/**\n * @dev Interface for the optional metadata functions from the ERC20 standard.\n *\n * _Available since v4.1._\n */\ninterface IERC20Metadata is IERC20 {\n /**\n * @dev Returns the name of the token.\n */\n function name() external view returns (string memory);\n\n /**\n * @dev Returns the symbol of the token.\n */\n function symbol() external view returns (string memory);\n\n /**\n * @dev Returns the decimals places of the token.\n */\n function decimals() external view returns (uint8);\n}\n" - }, - "solidity/contracts/peripherals/Keep3rDisputable.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport './Keep3rParameters.sol';\nimport '../../interfaces/peripherals/IKeep3rDisputable.sol';\n\nabstract contract Keep3rDisputable is IKeep3rDisputable, Keep3rParameters {\n /// @inheritdoc IKeep3rDisputable\n function dispute(address _jobOrKeeper) external override onlyDisputer {\n if (disputes[_jobOrKeeper]) revert AlreadyDisputed();\n disputes[_jobOrKeeper] = true;\n emit Dispute(_jobOrKeeper, msg.sender);\n }\n\n /// @inheritdoc IKeep3rDisputable\n function resolve(address _jobOrKeeper) external override onlyDisputer {\n if (!disputes[_jobOrKeeper]) revert NotDisputed();\n disputes[_jobOrKeeper] = false;\n emit Resolve(_jobOrKeeper, msg.sender);\n }\n}\n" - }, - "solidity/contracts/peripherals/keepers/Keep3rKeeperDisputable.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport './Keep3rKeeperFundable.sol';\nimport '../Keep3rDisputable.sol';\nimport '../../../interfaces/external/IKeep3rV1.sol';\nimport '../../../interfaces/peripherals/IKeep3rKeepers.sol';\n\nabstract contract Keep3rKeeperDisputable is IKeep3rKeeperDisputable, Keep3rDisputable, Keep3rKeeperFundable {\n using EnumerableSet for EnumerableSet.AddressSet;\n using SafeERC20 for IERC20;\n\n /// @inheritdoc IKeep3rKeeperDisputable\n function slash(\n address _keeper,\n address _bonded,\n uint256 _bondAmount,\n uint256 _unbondAmount\n ) external override onlySlasher {\n if (!disputes[_keeper]) revert NotDisputed();\n _slash(_keeper, _bonded, _bondAmount, _unbondAmount);\n emit KeeperSlash(_keeper, msg.sender, _bondAmount + _unbondAmount);\n }\n\n /// @inheritdoc IKeep3rKeeperDisputable\n function revoke(address _keeper) external override onlySlasher {\n if (!disputes[_keeper]) revert NotDisputed();\n _keepers.remove(_keeper);\n _slash(_keeper, keep3rV1, bonds[_keeper][keep3rV1], pendingUnbonds[_keeper][keep3rV1]);\n emit KeeperRevoke(_keeper, msg.sender);\n }\n\n function _slash(\n address _keeper,\n address _bonded,\n uint256 _bondAmount,\n uint256 _unbondAmount\n ) internal {\n if (_bonded != keep3rV1) {\n try IERC20(_bonded).transfer(governance, _bondAmount + _unbondAmount) returns (bool) {} catch (bytes memory) {}\n }\n bonds[_keeper][_bonded] -= _bondAmount;\n pendingUnbonds[_keeper][_bonded] -= _unbondAmount;\n }\n}\n" - }, - "solidity/contracts/peripherals/keepers/Keep3rKeeperFundable.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../Keep3rAccountance.sol';\nimport '../Keep3rParameters.sol';\nimport '../../../interfaces/peripherals/IKeep3rKeepers.sol';\n\nimport '../../../interfaces/external/IKeep3rV1.sol';\n\nimport '@openzeppelin/contracts/security/ReentrancyGuard.sol';\nimport '@openzeppelin/contracts/token/ERC20/IERC20.sol';\nimport '@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol';\n\nabstract contract Keep3rKeeperFundable is IKeep3rKeeperFundable, ReentrancyGuard, Keep3rParameters {\n using EnumerableSet for EnumerableSet.AddressSet;\n using SafeERC20 for IERC20;\n\n /// @inheritdoc IKeep3rKeeperFundable\n function bond(address _bonding, uint256 _amount) external override nonReentrant {\n if (disputes[msg.sender]) revert Disputed();\n if (_jobs.contains(msg.sender)) revert AlreadyAJob();\n canActivateAfter[msg.sender][_bonding] = block.timestamp + bondTime;\n\n uint256 _before = IERC20(_bonding).balanceOf(address(this));\n IERC20(_bonding).safeTransferFrom(msg.sender, address(this), _amount);\n _amount = IERC20(_bonding).balanceOf(address(this)) - _before;\n\n hasBonded[msg.sender] = true;\n pendingBonds[msg.sender][_bonding] += _amount;\n\n emit Bonding(msg.sender, _bonding, _amount);\n }\n\n /// @inheritdoc IKeep3rKeeperFundable\n function activate(address _bonding) external override {\n address _keeper = msg.sender;\n if (disputes[_keeper]) revert Disputed();\n uint256 _canActivateAfter = canActivateAfter[_keeper][_bonding];\n if (_canActivateAfter == 0) revert BondsUnexistent();\n if (_canActivateAfter >= block.timestamp) revert BondsLocked();\n\n if (firstSeen[_keeper] == 0) {\n firstSeen[_keeper] = block.timestamp;\n }\n _keepers.add(_keeper);\n\n uint256 _amount = pendingBonds[_keeper][_bonding];\n delete pendingBonds[_keeper][_bonding];\n\n // bond provided tokens\n bonds[_keeper][_bonding] += _amount;\n if (_bonding == keep3rV1) {\n totalBonds += _amount;\n _depositBonds(_amount);\n }\n\n emit Activation(_keeper, _bonding, _amount);\n }\n\n /// @inheritdoc IKeep3rKeeperFundable\n function unbond(address _bonding, uint256 _amount) external override {\n canWithdrawAfter[msg.sender][_bonding] = block.timestamp + unbondTime;\n bonds[msg.sender][_bonding] -= _amount;\n pendingUnbonds[msg.sender][_bonding] += _amount;\n\n emit Unbonding(msg.sender, _bonding, _amount);\n }\n\n /// @inheritdoc IKeep3rKeeperFundable\n function withdraw(address _bonding) external override nonReentrant {\n if (pendingUnbonds[msg.sender][_bonding] == 0) revert UnbondsUnexistent();\n if (canWithdrawAfter[msg.sender][_bonding] >= block.timestamp) revert UnbondsLocked();\n if (disputes[msg.sender]) revert Disputed();\n\n uint256 _amount = pendingUnbonds[msg.sender][_bonding];\n\n delete pendingUnbonds[msg.sender][_bonding];\n delete canWithdrawAfter[msg.sender][_bonding];\n\n if (_bonding == keep3rV1) _mint(_amount);\n IERC20(_bonding).safeTransfer(msg.sender, _amount);\n\n emit Withdrawal(msg.sender, _bonding, _amount);\n }\n\n function _depositBonds(uint256 _amount) internal virtual {\n IKeep3rV1(keep3rV1).burn(_amount);\n }\n}\n" - }, - "solidity/interfaces/external/IKeep3rV1.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '@openzeppelin/contracts/token/ERC20/IERC20.sol';\nimport '@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol';\n\n// solhint-disable func-name-mixedcase\ninterface IKeep3rV1 is IERC20, IERC20Metadata {\n // Structs\n struct Checkpoint {\n uint32 fromBlock;\n uint256 votes;\n }\n\n // Events\n event DelegateChanged(address indexed _delegator, address indexed _fromDelegate, address indexed _toDelegate);\n event DelegateVotesChanged(address indexed _delegate, uint256 _previousBalance, uint256 _newBalance);\n event SubmitJob(address indexed _job, address indexed _liquidity, address indexed _provider, uint256 _block, uint256 _credit);\n event ApplyCredit(address indexed _job, address indexed _liquidity, address indexed _provider, uint256 _block, uint256 _credit);\n event RemoveJob(address indexed _job, address indexed _liquidity, address indexed _provider, uint256 _block, uint256 _credit);\n event UnbondJob(address indexed _job, address indexed _liquidity, address indexed _provider, uint256 _block, uint256 _credit);\n event JobAdded(address indexed _job, uint256 _block, address _governance);\n event JobRemoved(address indexed _job, uint256 _block, address _governance);\n event KeeperWorked(address indexed _credit, address indexed _job, address indexed _keeper, uint256 _block, uint256 _amount);\n event KeeperBonding(address indexed _keeper, uint256 _block, uint256 _active, uint256 _bond);\n event KeeperBonded(address indexed _keeper, uint256 _block, uint256 _activated, uint256 _bond);\n event KeeperUnbonding(address indexed _keeper, uint256 _block, uint256 _deactive, uint256 _bond);\n event KeeperUnbound(address indexed _keeper, uint256 _block, uint256 _deactivated, uint256 _bond);\n event KeeperSlashed(address indexed _keeper, address indexed _slasher, uint256 _block, uint256 _slash);\n event KeeperDispute(address indexed _keeper, uint256 _block);\n event KeeperResolved(address indexed _keeper, uint256 _block);\n event TokenCreditAddition(address indexed _credit, address indexed _job, address indexed _creditor, uint256 _block, uint256 _amount);\n\n // Variables\n function KPRH() external returns (address);\n\n function delegates(address _delegator) external view returns (address);\n\n function checkpoints(address _account, uint32 _checkpoint) external view returns (Checkpoint memory);\n\n function numCheckpoints(address _account) external view returns (uint32);\n\n function DOMAIN_TYPEHASH() external returns (bytes32);\n\n function DOMAINSEPARATOR() external returns (bytes32);\n\n function DELEGATION_TYPEHASH() external returns (bytes32);\n\n function PERMIT_TYPEHASH() external returns (bytes32);\n\n function nonces(address _user) external view returns (uint256);\n\n function BOND() external returns (uint256);\n\n function UNBOND() external returns (uint256);\n\n function LIQUIDITYBOND() external returns (uint256);\n\n function FEE() external returns (uint256);\n\n function BASE() external returns (uint256);\n\n function ETH() external returns (address);\n\n function bondings(address _user, address _bonding) external view returns (uint256);\n\n function canWithdrawAfter(address _user, address _bonding) external view returns (uint256);\n\n function pendingUnbonds(address _keeper, address _bonding) external view returns (uint256);\n\n function pendingbonds(address _keeper, address _bonding) external view returns (uint256);\n\n function bonds(address _keeper, address _bonding) external view returns (uint256);\n\n function votes(address _delegator) external view returns (uint256);\n\n function firstSeen(address _keeper) external view returns (uint256);\n\n function disputes(address _keeper) external view returns (bool);\n\n function lastJob(address _keeper) external view returns (uint256);\n\n function workCompleted(address _keeper) external view returns (uint256);\n\n function jobs(address _job) external view returns (bool);\n\n function credits(address _job, address _credit) external view returns (uint256);\n\n function liquidityProvided(\n address _provider,\n address _liquidity,\n address _job\n ) external view returns (uint256);\n\n function liquidityUnbonding(\n address _provider,\n address _liquidity,\n address _job\n ) external view returns (uint256);\n\n function liquidityAmountsUnbonding(\n address _provider,\n address _liquidity,\n address _job\n ) external view returns (uint256);\n\n function jobProposalDelay(address _job) external view returns (uint256);\n\n function liquidityApplied(\n address _provider,\n address _liquidity,\n address _job\n ) external view returns (uint256);\n\n function liquidityAmount(\n address _provider,\n address _liquidity,\n address _job\n ) external view returns (uint256);\n\n function keepers(address _keeper) external view returns (bool);\n\n function blacklist(address _keeper) external view returns (bool);\n\n function keeperList(uint256 _index) external view returns (address);\n\n function jobList(uint256 _index) external view returns (address);\n\n function governance() external returns (address);\n\n function pendingGovernance() external returns (address);\n\n function liquidityAccepted(address _liquidity) external view returns (bool);\n\n function liquidityPairs(uint256 _index) external view returns (address);\n\n // Methods\n function getCurrentVotes(address _account) external view returns (uint256);\n\n function addCreditETH(address _job) external payable;\n\n function addCredit(\n address _credit,\n address _job,\n uint256 _amount\n ) external;\n\n function addVotes(address _voter, uint256 _amount) external;\n\n function removeVotes(address _voter, uint256 _amount) external;\n\n function addKPRCredit(address _job, uint256 _amount) external;\n\n function approveLiquidity(address _liquidity) external;\n\n function revokeLiquidity(address _liquidity) external;\n\n function pairs() external view returns (address[] memory);\n\n function addLiquidityToJob(\n address _liquidity,\n address _job,\n uint256 _amount\n ) external;\n\n function applyCreditToJob(\n address _provider,\n address _liquidity,\n address _job\n ) external;\n\n function unbondLiquidityFromJob(\n address _liquidity,\n address _job,\n uint256 _amount\n ) external;\n\n function removeLiquidityFromJob(address _liquidity, address _job) external;\n\n function mint(uint256 _amount) external;\n\n function burn(uint256 _amount) external;\n\n function worked(address _keeper) external;\n\n function receipt(\n address _credit,\n address _keeper,\n uint256 _amount\n ) external;\n\n function receiptETH(address _keeper, uint256 _amount) external;\n\n function addJob(address _job) external;\n\n function getJobs() external view returns (address[] memory);\n\n function removeJob(address _job) external;\n\n function setKeep3rHelper(address _keep3rHelper) external;\n\n function setGovernance(address _governance) external;\n\n function acceptGovernance() external;\n\n function isKeeper(address _keeper) external returns (bool);\n\n function isMinKeeper(\n address _keeper,\n uint256 _minBond,\n uint256 _earned,\n uint256 _age\n ) external returns (bool);\n\n function isBondedKeeper(\n address _keeper,\n address _bond,\n uint256 _minBond,\n uint256 _earned,\n uint256 _age\n ) external returns (bool);\n\n function bond(address _bonding, uint256 _amount) external;\n\n function getKeepers() external view returns (address[] memory);\n\n function activate(address _bonding) external;\n\n function unbond(address _bonding, uint256 _amount) external;\n\n function slash(\n address _bonded,\n address _keeper,\n uint256 _amount\n ) external;\n\n function withdraw(address _bonding) external;\n\n function dispute(address _keeper) external;\n\n function revoke(address _keeper) external;\n\n function resolve(address _keeper) external;\n\n function permit(\n address _owner,\n address _spender,\n uint256 _amount,\n uint256 _deadline,\n uint8 _v,\n bytes32 _r,\n bytes32 _s\n ) external;\n}\n" - }, - "solidity/for-test/testnet/Keep3rForTestnet.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../../contracts/Keep3r.sol';\n\ncontract Keep3rForTestnet is Keep3r {\n constructor(\n address _governance,\n address _keep3rHelper,\n address _keep3rV1,\n address _keep3rV1Proxy\n ) Keep3r(_governance, _keep3rHelper, _keep3rV1, _keep3rV1Proxy) {\n bondTime = 0; // allows keepers to instantly register\n unbondTime = 0; // allows keepers & jobOwners to instantly withdraw funds\n liquidityMinimum = 1; // allows job providers to add low liquidity\n rewardPeriodTime = 1 days; // reduces twap calculation period\n inflationPeriod = 5 days; // increases credit minting\n }\n}\n" - }, - "solidity/for-test/Keep3rForTest.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../contracts/Keep3r.sol';\n\ncontract Keep3rForTest is Keep3r {\n constructor(\n address _governance,\n address _keep3rHelper,\n address _keep3rV1,\n address _keep3rV1Proxy\n ) Keep3r(_governance, _keep3rHelper, _keep3rV1, _keep3rV1Proxy) {}\n}\n" - }, - "solidity/contracts/sidechain/Keep3rSidechain.sol": { - "content": "// SPDX-License-Identifier: MIT\n\n/*\n\nCoded for The Keep3r Network with ♥ by\n\n██████╗░███████╗███████╗██╗░░░██╗░░░░░░░██╗░█████╗░███╗░░██╗██████╗░███████╗██████╗░██╗░░░░░░█████╗░███╗░░██╗██████╗░\n██╔══██╗██╔════╝██╔════╝██║░░░██║░░██╗░░██║██╔══██╗████╗░██║██╔══██╗██╔════╝██╔══██╗██║░░░░░██╔══██╗████╗░██║██╔══██╗\n██║░░██║█████╗░░█████╗░░██║░░░╚██╗████╗██╔╝██║░░██║██╔██╗██║██║░░██║█████╗░░██████╔╝██║░░░░░███████║██╔██╗██║██║░░██║\n██║░░██║██╔══╝░░██╔══╝░░██║░░░░████╔═████║░██║░░██║██║╚████║██║░░██║██╔══╝░░██╔══██╗██║░░░░░██╔══██║██║╚████║██║░░██║\n██████╔╝███████╗██║░░░░░██║░░░░╚██╔╝░╚██╔╝░╚█████╔╝██║░╚███║██████╔╝███████╗██║░░██║███████╗██║░░██║██║░╚███║██████╔╝\n╚═════╝░╚══════╝╚═╝░░░░░╚═╝░░░░░╚═╝░░░╚═╝░░░╚════╝░╚═╝░░╚══╝╚═════╝░╚══════╝╚═╝░░╚═╝╚══════╝╚═╝░░╚═╝╚═╝░░╚══╝╚═════╝░\n\nhttps://defi.sucks\n\nCommit hash: ead559c8dc4361349b7222741c2399447e255d8e\n\n*/\n\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../Keep3r.sol';\nimport '../../interfaces/sidechain/IKeep3rEscrow.sol';\nimport '../../interfaces/sidechain/IKeep3rHelperSidechain.sol';\nimport '../../interfaces/sidechain/IKeep3rJobWorkableRated.sol';\nimport '../../interfaces/sidechain/IKeep3rSidechainAccountance.sol';\n\ncontract Keep3rSidechain is Keep3r, IKeep3rJobWorkableRated, IKeep3rSidechainAccountance {\n using EnumerableSet for EnumerableSet.AddressSet;\n\n /// @param _governance Address of governance\n /// @param _keep3rHelperSidechain Address of sidechain Keep3rHelper\n /// @param _wrappedKP3R Address of wrapped KP3R implementation\n /// @param _keep3rEscrow Address of sidechain Keep3rEscrow\n constructor(\n address _governance, // governance\n address _keep3rHelperSidechain, // helper\n address _wrappedKP3R, // keep3rV1\n address _keep3rEscrow // keep3rV1Proxy\n ) Keep3r(_governance, _keep3rHelperSidechain, _wrappedKP3R, _keep3rEscrow) {}\n\n // Keep3rSidechainAccountance\n\n /// @inheritdoc IKeep3rSidechainAccountance\n function virtualReserves() external view override returns (int256 _virtualReserves) {\n // Queries wKP3R balanceOf escrow contract minus the totalBonds\n return int256(IERC20(keep3rV1).balanceOf(keep3rV1Proxy)) - int256(totalBonds);\n }\n\n // Keep3rJobFundableLiquidity\n\n /// @notice Sidechain implementation asks the Helper for an oracle, instead of reading it from the ERC-20\n /// @dev Function should be called after setting an oracle in Keep3rHelperSidechain\n /// @param _liquidity Address of the liquidity token being approved\n function approveLiquidity(address _liquidity) external virtual override onlyGovernance {\n if (!_approvedLiquidities.add(_liquidity)) revert LiquidityPairApproved();\n _liquidityPool[_liquidity] = IKeep3rHelperSidechain(keep3rHelper).oracle(_liquidity);\n if (_liquidityPool[_liquidity] == address(0)) revert ZeroAddress();\n _isKP3RToken0[_liquidity] = IKeep3rHelper(keep3rHelper).isKP3RToken0(_liquidityPool[_liquidity]);\n _tick[_liquidity] = observeLiquidity(_liquidity);\n emit LiquidityApproval(_liquidity);\n }\n\n /// @notice Sidechain implementation will always ask for 2 tickCumulatives instead of cacheing\n /// @param _liquidity Address of the liquidity token being observed\n function observeLiquidity(address _liquidity) public view virtual override returns (TickCache memory _tickCache) {\n if (_tick[_liquidity].period == _period(block.timestamp)) {\n // Will return cached twaps if liquidity is updated\n _tickCache = _tick[_liquidity];\n } else {\n bool success;\n\n // Will always ask for 2 accumulators in sidechain\n uint32[] memory _secondsAgo = new uint32[](2);\n\n _secondsAgo[0] = uint32(block.timestamp - _period(block.timestamp));\n _secondsAgo[1] = uint32(block.timestamp - _period(block.timestamp) + rewardPeriodTime);\n\n int56 _tickCumulative2;\n (_tickCache.current, _tickCumulative2, success) = IKeep3rHelper(keep3rHelper).observe(_liquidityPool[_liquidity], _secondsAgo);\n\n _tickCache.difference = _tickCache.current - _tickCumulative2;\n\n if (success) {\n _tickCache.period = _period(block.timestamp);\n } else {\n delete _tickCache.period;\n }\n }\n }\n\n // Keep3rJobsWorkable\n\n /// @dev Sidechain implementation deprecates worked(address) as it should come with a usdPerGasUnit parameter\n function worked(address) external pure override {\n revert Deprecated();\n }\n\n /// @notice Implemented by jobs to show that a keeper performed work\n /// @dev Uses a USD per gas unit payment mechanism\n /// @param _keeper Address of the keeper that performed the work\n /// @param _usdPerGasUnit Units of USD (in wei) per gas unit that should be rewarded to the keeper\n function worked(address _keeper, uint256 _usdPerGasUnit) external override {\n if (_initialGas == 0) revert GasNotInitialized();\n // Gas used for quote calculations & payment is not rewarded\n uint256 _gasLeft = _getGasLeft();\n\n address _job = msg.sender;\n if (disputes[_job]) revert JobDisputed();\n if (!_jobs.contains(_job)) revert JobUnapproved();\n\n if (_updateJobCreditsIfNeeded(_job)) {\n emit LiquidityCreditsReward(_job, rewardedAt[_job], _jobLiquidityCredits[_job], _jobPeriodCredits[_job]);\n }\n\n (uint256 _boost, uint256 _oneUsdQuote, uint256 _extraGas) = IKeep3rHelper(keep3rHelper).getPaymentParams(bonds[_keeper][keep3rV1]);\n\n uint256 _kp3rPayment = _calculatePayment(_gasLeft, _extraGas, _oneUsdQuote * _usdPerGasUnit, _boost);\n\n if (_kp3rPayment > _jobLiquidityCredits[_job]) {\n _rewardJobCredits(_job);\n emit LiquidityCreditsReward(_job, rewardedAt[_job], _jobLiquidityCredits[_job], _jobPeriodCredits[_job]);\n }\n\n _bondedPayment(_job, _keeper, _kp3rPayment);\n delete _initialGas;\n\n emit KeeperWork(keep3rV1, _job, _keeper, _kp3rPayment, _gasLeft);\n }\n\n // Keep3rKeeperFundable\n\n /// @dev Sidechain implementation doesn't burn tokens, but deposit them in Keep3rEscrow\n function _depositBonds(uint256 _amount) internal virtual override {\n IKeep3rV1(keep3rV1).approve(keep3rV1Proxy, _amount);\n IKeep3rEscrow(keep3rV1Proxy).deposit(_amount);\n }\n}\n" - }, - "solidity/interfaces/sidechain/IKeep3rEscrow.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\n// solhint-disable-next-line no-empty-blocks\n\nimport '../peripherals/IMintable.sol';\n\n/// @title Keep3rEscrow contract\n/// @notice This contract acts as an escrow contract for wKP3R tokens on sidechains and L2s\n/// @dev Can be used as a replacement for keep3rV1Proxy in keep3r sidechain implementations\ninterface IKeep3rEscrow is IMintable {\n /// @notice Emitted when Keep3rEscrow#deposit function is called\n /// @param _wKP3R The addess of the wrapped KP3R token\n /// @param _sender The address that called the function\n /// @param _amount The amount of wKP3R the user deposited\n event wKP3RDeposited(address _wKP3R, address _sender, uint256 _amount);\n\n /// @notice Emitted when Keep3rEscrow#mint function is called\n /// @param _wKP3R The addess of the wrapped KP3R token\n /// @param _recipient The address that will received the newly minted wKP3R\n /// @param _amount The amount of wKP3R minted to the recipient\n event wKP3RMinted(address _wKP3R, address _recipient, uint256 _amount);\n\n /// @notice Emitted when Keep3rEscrow#setWKP3R function is called\n /// @param _newWKP3R The address of the wKP3R contract\n event wKP3RSet(address _newWKP3R);\n\n /// @notice Throws when minter attempts to withdraw more wKP3R than the escrow has in its balance\n error InsufficientBalance();\n\n /// @notice Lists the address of the wKP3R contract\n /// @return _wKP3RAddress The address of wKP3R\n function wKP3R() external view returns (address _wKP3RAddress);\n\n /// @notice Deposits wKP3R into the contract\n /// @param _amount The amount of wKP3R to deposit\n function deposit(uint256 _amount) external;\n\n /// @notice mints wKP3R to the recipient\n /// @param _amount The amount of wKP3R to mint\n function mint(uint256 _amount) external;\n\n /// @notice sets the wKP3R address\n /// @param _wKP3R the wKP3R address\n function setWKP3R(address _wKP3R) external;\n}\n" - }, - "solidity/interfaces/sidechain/IKeep3rHelperSidechain.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../IKeep3rHelper.sol';\n\n/// @title Keep3rHelperSidechain contract\n/// @notice Contains all the helper functions for sidechain keep3r implementations\ninterface IKeep3rHelperSidechain is IKeep3rHelper {\n // Events\n\n /// @notice The oracle for a liquidity has been saved\n /// @param _liquidity The address of the given liquidity\n /// @param _oraclePool The address of the oracle pool\n event OracleSet(address _liquidity, address _oraclePool);\n\n /// @notice Emitted when the WETH USD pool is changed\n /// @param _address Address of the new WETH USD pool\n /// @param _isWETHToken0 True if calling the token0 method of the pool returns the WETH token address\n event WethUSDPoolChange(address _address, bool _isWETHToken0);\n\n /// Variables\n\n /// @notice Ethereum mainnet WETH address used for quoting references\n /// @return _weth Address of WETH token\n // solhint-disable func-name-mixedcase\n function WETH() external view returns (address _weth);\n\n /// @return _oracle The address of the observable pool for given liquidity\n function oracle(address _liquidity) external view returns (address _oracle);\n\n /// @notice WETH-USD pool that is being used as oracle\n /// @return poolAddress Address of the pool\n /// @return isTKNToken0 True if calling the token0 method of the pool returns the WETH token address\n function wethUSDPool() external view returns (address poolAddress, bool isTKNToken0);\n\n /// @notice Quotes USD to ETH\n /// @dev Used to know how much ETH should be paid to keepers before converting it from ETH to KP3R\n /// @param _usd The amount of USD to quote to ETH\n /// @return _eth The resulting amount of ETH after quoting the USD\n function quoteUsdToEth(uint256 _usd) external returns (uint256 _eth);\n\n /// Methods\n\n /// @notice Sets an oracle for a given liquidity\n /// @param _liquidity The address of the liquidity\n /// @param _oracle The address of the pool used to quote the liquidity from\n /// @dev The oracle must contain KP3R as either token0 or token1\n function setOracle(address _liquidity, address _oracle) external;\n\n /// @notice Sets an oracle for querying WETH/USD quote\n /// @param _poolAddress The address of the pool used as oracle\n /// @dev The oracle must contain WETH as either token0 or token1\n function setWethUsdPool(address _poolAddress) external;\n}\n" - }, - "solidity/interfaces/sidechain/IKeep3rJobWorkableRated.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../peripherals/IKeep3rJobs.sol';\n\n/// @title Keep3rJobWorkableRated contract\n/// @notice Implements a quoting in USD per gas unit for Keep3r jobs\ninterface IKeep3rJobWorkableRated is IKeep3rJobs {\n /// @notice Throws when job contract calls deprecated worked(address) function\n error Deprecated();\n\n /// @notice Implemented by jobs to show that a keeper performed work and reward in stable USD quote\n /// @dev Automatically calculates the payment for the keeper and pays the keeper with bonded KP3R\n /// @param _keeper Address of the keeper that performed the work\n /// @param _usdPerGasUnit Amount of USD in wei rewarded for gas unit worked by the keeper\n function worked(address _keeper, uint256 _usdPerGasUnit) external;\n}\n" - }, - "solidity/interfaces/sidechain/IKeep3rSidechainAccountance.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\n/// @title IKeep3rSidechainAccountance interface\n/// @notice Implements a view to get the amount of credits that can be withdrawn\ninterface IKeep3rSidechainAccountance {\n /// @notice The surplus amount of wKP3Rs in escrow contract\n /// @return _virtualReserves The surplus amount of wKP3Rs in escrow contract\n function virtualReserves() external view returns (int256 _virtualReserves);\n}\n" - }, - "solidity/interfaces/peripherals/IMintable.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport './IGovernable.sol';\nimport './IBaseErrors.sol';\n\n/// @title Mintable contract\n/// @notice Manages the minter role\ninterface IMintable is IBaseErrors, IGovernable {\n // Events\n\n /// @notice Emitted when governance sets a new minter\n /// @param _minter Address of the new minter\n event MinterSet(address _minter);\n\n // Errors\n\n /// @notice Throws if the caller of the function is not the minter\n error OnlyMinter();\n\n // Variables\n\n /// @notice Stores the minter address\n /// @return _minter The minter addresss\n function minter() external view returns (address _minter);\n\n // Methods\n\n /// @notice Sets a new address to be the minter\n /// @param _minter The address set as the minter\n function setMinter(address _minter) external;\n}\n" - }, - "solidity/for-test/testnet/Keep3rSidechainForTestnet.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../../contracts/sidechain/Keep3rSidechain.sol';\n\ncontract Keep3rSidechainForTestnet is Keep3rSidechain {\n constructor(\n address _governance,\n address _keep3rHelper,\n address _keep3rV1,\n address _keep3rV1Proxy\n ) Keep3rSidechain(_governance, _keep3rHelper, _keep3rV1, _keep3rV1Proxy) {\n bondTime = 0; // allows keepers to instantly register\n unbondTime = 0; // allows keepers & jobOwners to instantly withdraw funds\n liquidityMinimum = 1; // allows job providers to add low liquidity\n rewardPeriodTime = 1 days; // reduces twap calculation period\n inflationPeriod = 5 days; // increases credit minting\n }\n}\n" - }, - "solidity/for-test/Keep3rSidechainForTest.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../contracts/sidechain/Keep3rSidechain.sol';\n\ncontract Keep3rSidechainForTest is Keep3rSidechain {\n using EnumerableSet for EnumerableSet.AddressSet;\n\n constructor(\n address _governance,\n address _keep3rHelper,\n address _wrappedKP3R,\n address _keep3rEscrow\n ) Keep3rSidechain(_governance, _keep3rHelper, _wrappedKP3R, _keep3rEscrow) {}\n\n function setJobLiquidity(address _job, address _liquidity) external {\n _jobLiquidities[_job].add(_liquidity);\n }\n}\n" - }, - "solidity/for-test/JobRatedForTest.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../interfaces/IKeep3r.sol';\nimport '../interfaces/sidechain/IKeep3rJobWorkableRated.sol';\n\ncontract JobRatedForTest {\n error InvalidKeeper();\n address public keep3r;\n uint256 public nonce;\n uint256 public usdPerGasUnit = 1;\n\n constructor(address _keep3r) {\n keep3r = _keep3r;\n }\n\n function work() external {\n if (!IKeep3r(keep3r).isKeeper(msg.sender)) revert InvalidKeeper();\n\n for (uint256 i = 0; i < 1000; i++) {\n nonce++;\n }\n\n IKeep3rJobWorkableRated(keep3r).worked(msg.sender, usdPerGasUnit);\n }\n\n function workHard(uint256 _factor) external {\n if (!IKeep3r(keep3r).isKeeper(msg.sender)) revert InvalidKeeper();\n\n for (uint256 i = 0; i < 1000 * _factor; i++) {\n nonce++;\n }\n\n IKeep3rJobWorkableRated(keep3r).worked(msg.sender, usdPerGasUnit);\n }\n}\n" - }, - "solidity/for-test/JobForTest.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../interfaces/IKeep3r.sol';\n\ncontract JobForTest {\n error InvalidKeeper();\n address public keep3r;\n uint256 public nonce;\n\n constructor(address _keep3r) {\n keep3r = _keep3r;\n }\n\n function work() external {\n if (!IKeep3r(keep3r).isKeeper(msg.sender)) revert InvalidKeeper();\n\n for (uint256 i; i < 1000; i++) {\n nonce++;\n }\n\n IKeep3r(keep3r).worked(msg.sender);\n }\n\n function workHard(uint256 _factor) external {\n if (!IKeep3r(keep3r).isKeeper(msg.sender)) revert InvalidKeeper();\n\n for (uint256 i; i < 1000 * _factor; i++) {\n nonce++;\n }\n\n IKeep3r(keep3r).worked(msg.sender);\n }\n}\n" - }, - "solidity/for-test/BasicJob.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../interfaces/IKeep3r.sol';\n\ncontract BasicJob {\n error KeeperNotValid();\n\n address public keep3r;\n uint256 public nonce;\n uint256[] public array;\n\n constructor(address _keep3r) {\n keep3r = _keep3r;\n }\n\n function work() external upkeep {}\n\n function workHard(uint256 _howHard) external upkeep {\n for (uint256 i = nonce; i < _howHard; i++) {\n nonce++;\n }\n }\n\n function workRefund(uint256 _howHard) external upkeep {\n for (uint256 i; i < _howHard; i++) {\n array.push(i);\n }\n\n while (array.length > 0) {\n array.pop();\n }\n }\n\n modifier upkeep() {\n if (!IKeep3r(keep3r).isKeeper(msg.sender)) revert KeeperNotValid();\n _;\n IKeep3r(keep3r).worked(msg.sender);\n }\n}\n" - }, - "solidity/contracts/Keep3rHelperParameters.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.7 <0.9.0;\n\nimport './libraries/FullMath.sol';\nimport './libraries/TickMath.sol';\nimport '../interfaces/peripherals/IBaseErrors.sol';\nimport '../interfaces/IKeep3r.sol';\nimport '../interfaces/external/IKeep3rV1.sol';\nimport '../interfaces/IKeep3rHelperParameters.sol';\nimport './peripherals/Governable.sol';\nimport './Keep3rHelperParameters.sol';\n\nimport '@openzeppelin/contracts/utils/math/Math.sol';\nimport '@uniswap/v3-core/contracts/interfaces/IUniswapV3Pool.sol';\n\ncontract Keep3rHelperParameters is IKeep3rHelperParameters, IBaseErrors, Governable {\n /// @inheritdoc IKeep3rHelperParameters\n address public immutable override KP3R;\n\n /// @inheritdoc IKeep3rHelperParameters\n uint256 public constant override BOOST_BASE = 10_000;\n\n /// @inheritdoc IKeep3rHelperParameters\n uint256 public override minBoost = 11_000;\n\n /// @inheritdoc IKeep3rHelperParameters\n uint256 public override maxBoost = 12_000;\n\n /// @inheritdoc IKeep3rHelperParameters\n uint256 public override targetBond = 200 ether;\n\n /// @inheritdoc IKeep3rHelperParameters\n uint256 public override workExtraGas = 34_000;\n\n /// @inheritdoc IKeep3rHelperParameters\n uint32 public override quoteTwapTime = 10 minutes;\n\n /// @inheritdoc IKeep3rHelperParameters\n uint256 public override minBaseFee = 15e9;\n\n /// @inheritdoc IKeep3rHelperParameters\n uint256 public override minPriorityFee = 2e9;\n\n /// @inheritdoc IKeep3rHelperParameters\n address public override keep3rV2;\n\n /// @inheritdoc IKeep3rHelperParameters\n IKeep3rHelperParameters.TokenOraclePool public override kp3rWethPool;\n\n constructor(\n address _kp3r,\n address _keep3rV2,\n address _governance,\n address _kp3rWethPool\n ) Governable(_governance) {\n KP3R = _kp3r;\n keep3rV2 = _keep3rV2;\n\n // Immutable variables [KP3R] cannot be read during contract creation time [_setKp3rWethPool]\n kp3rWethPool = _validateOraclePool(_kp3rWethPool, _kp3r);\n emit Kp3rWethPoolChange(kp3rWethPool.poolAddress, kp3rWethPool.isTKNToken0);\n }\n\n /// @inheritdoc IKeep3rHelperParameters\n function setKp3rWethPool(address _poolAddress) external override onlyGovernance {\n if (_poolAddress == address(0)) revert ZeroAddress();\n _setKp3rWethPool(_poolAddress);\n }\n\n /// @inheritdoc IKeep3rHelperParameters\n function setMinBoost(uint256 _minBoost) external override onlyGovernance {\n minBoost = _minBoost;\n emit MinBoostChange(minBoost);\n }\n\n /// @inheritdoc IKeep3rHelperParameters\n function setMaxBoost(uint256 _maxBoost) external override onlyGovernance {\n maxBoost = _maxBoost;\n emit MaxBoostChange(maxBoost);\n }\n\n /// @inheritdoc IKeep3rHelperParameters\n function setTargetBond(uint256 _targetBond) external override onlyGovernance {\n targetBond = _targetBond;\n emit TargetBondChange(targetBond);\n }\n\n /// @inheritdoc IKeep3rHelperParameters\n function setKeep3rV2(address _keep3rV2) external override onlyGovernance {\n if (_keep3rV2 == address(0)) revert ZeroAddress();\n keep3rV2 = _keep3rV2;\n emit Keep3rV2Change(keep3rV2);\n }\n\n /// @inheritdoc IKeep3rHelperParameters\n function setWorkExtraGas(uint256 _workExtraGas) external override onlyGovernance {\n workExtraGas = _workExtraGas;\n emit WorkExtraGasChange(workExtraGas);\n }\n\n /// @inheritdoc IKeep3rHelperParameters\n function setQuoteTwapTime(uint32 _quoteTwapTime) external override onlyGovernance {\n _setQuoteTwapTime(_quoteTwapTime);\n }\n\n function _setQuoteTwapTime(uint32 _quoteTwapTime) internal {\n quoteTwapTime = _quoteTwapTime;\n emit QuoteTwapTimeChange(quoteTwapTime);\n }\n\n /// @inheritdoc IKeep3rHelperParameters\n function setMinBaseFee(uint256 _minBaseFee) external override onlyGovernance {\n minBaseFee = _minBaseFee;\n emit MinBaseFeeChange(minBaseFee);\n }\n\n /// @inheritdoc IKeep3rHelperParameters\n function setMinPriorityFee(uint256 _minPriorityFee) external override onlyGovernance {\n minPriorityFee = _minPriorityFee;\n emit MinPriorityFeeChange(minPriorityFee);\n }\n\n /// @notice Sets KP3R-WETH pool\n /// @param _poolAddress The address of the KP3R-WETH pool\n function _setKp3rWethPool(address _poolAddress) internal {\n kp3rWethPool = _validateOraclePool(_poolAddress, KP3R);\n emit Kp3rWethPoolChange(kp3rWethPool.poolAddress, kp3rWethPool.isTKNToken0);\n }\n\n function _validateOraclePool(address _poolAddress, address _token) internal view virtual returns (TokenOraclePool memory _oraclePool) {\n bool _isTKNToken0 = IUniswapV3Pool(_poolAddress).token0() == _token;\n\n if (!_isTKNToken0 && IUniswapV3Pool(_poolAddress).token1() != _token) revert InvalidOraclePool();\n\n return TokenOraclePool(_poolAddress, _isTKNToken0);\n }\n}\n" - }, - "solidity/contracts/libraries/TickMath.sol": { - "content": "// SPDX-License-Identifier: GPL-2.0-or-later\npragma solidity >=0.5.0;\n\n// solhint-disable\n\n/// @title Math library for computing sqrt prices from ticks and vice versa\n/// @notice Computes sqrt price for ticks of size 1.0001, i.e. sqrt(1.0001^tick) as fixed point Q64.96 numbers. Supports\n/// prices between 2**-128 and 2**128\nlibrary TickMath {\n /// @dev The minimum tick that may be passed to #getSqrtRatioAtTick computed from log base 1.0001 of 2**-128\n int24 internal constant MIN_TICK = -887272;\n /// @dev The maximum tick that may be passed to #getSqrtRatioAtTick computed from log base 1.0001 of 2**128\n int24 internal constant MAX_TICK = -MIN_TICK;\n\n /// @dev The minimum value that can be returned from #getSqrtRatioAtTick. Equivalent to getSqrtRatioAtTick(MIN_TICK)\n uint160 internal constant MIN_SQRT_RATIO = 4295128739;\n /// @dev The maximum value that can be returned from #getSqrtRatioAtTick. Equivalent to getSqrtRatioAtTick(MAX_TICK)\n uint160 internal constant MAX_SQRT_RATIO = 1461446703485210103287273052203988822378723970342;\n\n /// @notice Calculates sqrt(1.0001^tick) * 2^96\n /// @dev Throws if |tick| > max tick\n /// @param tick The input tick for the above formula\n /// @return sqrtPriceX96 A Fixed point Q64.96 number representing the sqrt of the ratio of the two assets (token1/token0)\n /// at the given tick\n function getSqrtRatioAtTick(int24 tick) internal pure returns (uint160 sqrtPriceX96) {\n uint256 absTick = tick < 0 ? uint256(-int256(tick)) : uint256(int256(tick));\n require(absTick <= uint256(int256(MAX_TICK)), 'T');\n\n uint256 ratio = absTick & 0x1 != 0 ? 0xfffcb933bd6fad37aa2d162d1a594001 : 0x100000000000000000000000000000000;\n if (absTick & 0x2 != 0) ratio = (ratio * 0xfff97272373d413259a46990580e213a) >> 128;\n if (absTick & 0x4 != 0) ratio = (ratio * 0xfff2e50f5f656932ef12357cf3c7fdcc) >> 128;\n if (absTick & 0x8 != 0) ratio = (ratio * 0xffe5caca7e10e4e61c3624eaa0941cd0) >> 128;\n if (absTick & 0x10 != 0) ratio = (ratio * 0xffcb9843d60f6159c9db58835c926644) >> 128;\n if (absTick & 0x20 != 0) ratio = (ratio * 0xff973b41fa98c081472e6896dfb254c0) >> 128;\n if (absTick & 0x40 != 0) ratio = (ratio * 0xff2ea16466c96a3843ec78b326b52861) >> 128;\n if (absTick & 0x80 != 0) ratio = (ratio * 0xfe5dee046a99a2a811c461f1969c3053) >> 128;\n if (absTick & 0x100 != 0) ratio = (ratio * 0xfcbe86c7900a88aedcffc83b479aa3a4) >> 128;\n if (absTick & 0x200 != 0) ratio = (ratio * 0xf987a7253ac413176f2b074cf7815e54) >> 128;\n if (absTick & 0x400 != 0) ratio = (ratio * 0xf3392b0822b70005940c7a398e4b70f3) >> 128;\n if (absTick & 0x800 != 0) ratio = (ratio * 0xe7159475a2c29b7443b29c7fa6e889d9) >> 128;\n if (absTick & 0x1000 != 0) ratio = (ratio * 0xd097f3bdfd2022b8845ad8f792aa5825) >> 128;\n if (absTick & 0x2000 != 0) ratio = (ratio * 0xa9f746462d870fdf8a65dc1f90e061e5) >> 128;\n if (absTick & 0x4000 != 0) ratio = (ratio * 0x70d869a156d2a1b890bb3df62baf32f7) >> 128;\n if (absTick & 0x8000 != 0) ratio = (ratio * 0x31be135f97d08fd981231505542fcfa6) >> 128;\n if (absTick & 0x10000 != 0) ratio = (ratio * 0x9aa508b5b7a84e1c677de54f3e99bc9) >> 128;\n if (absTick & 0x20000 != 0) ratio = (ratio * 0x5d6af8dedb81196699c329225ee604) >> 128;\n if (absTick & 0x40000 != 0) ratio = (ratio * 0x2216e584f5fa1ea926041bedfe98) >> 128;\n if (absTick & 0x80000 != 0) ratio = (ratio * 0x48a170391f7dc42444e8fa2) >> 128;\n\n if (tick > 0) ratio = type(uint256).max / ratio;\n\n // Divides by 1<<32 rounding up to go from a Q128.128 to a Q128.96.\n // we then downcast because we know the result always fits within 160 bits due to our tick input constraint\n // we round up in the division so getTickAtSqrtRatio of the output price is always consistent\n sqrtPriceX96 = uint160((ratio >> 32) + (ratio % (1 << 32) == 0 ? 0 : 1));\n }\n\n /// @notice Calculates the greatest tick value such that getRatioAtTick(tick) <= ratio\n /// @dev Throws in case sqrtPriceX96 < MIN_SQRT_RATIO, as MIN_SQRT_RATIO is the lowest value getRatioAtTick may ever return.\n /// @param sqrtPriceX96 The sqrt ratio for which to compute the tick as a Q64.96\n /// @return tick The greatest tick for which the ratio is less than or equal to the input ratio\n function getTickAtSqrtRatio(uint160 sqrtPriceX96) internal pure returns (int24 tick) {\n // Second inequality must be < because the price can never reach the price at the max tick\n require(sqrtPriceX96 >= MIN_SQRT_RATIO && sqrtPriceX96 < MAX_SQRT_RATIO, 'R');\n uint256 ratio = uint256(sqrtPriceX96) << 32;\n\n uint256 r = ratio;\n uint256 msb = 0;\n\n assembly {\n let f := shl(7, gt(r, 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF))\n msb := or(msb, f)\n r := shr(f, r)\n }\n assembly {\n let f := shl(6, gt(r, 0xFFFFFFFFFFFFFFFF))\n msb := or(msb, f)\n r := shr(f, r)\n }\n assembly {\n let f := shl(5, gt(r, 0xFFFFFFFF))\n msb := or(msb, f)\n r := shr(f, r)\n }\n assembly {\n let f := shl(4, gt(r, 0xFFFF))\n msb := or(msb, f)\n r := shr(f, r)\n }\n assembly {\n let f := shl(3, gt(r, 0xFF))\n msb := or(msb, f)\n r := shr(f, r)\n }\n assembly {\n let f := shl(2, gt(r, 0xF))\n msb := or(msb, f)\n r := shr(f, r)\n }\n assembly {\n let f := shl(1, gt(r, 0x3))\n msb := or(msb, f)\n r := shr(f, r)\n }\n assembly {\n let f := gt(r, 0x1)\n msb := or(msb, f)\n }\n\n if (msb >= 128) r = ratio >> (msb - 127);\n else r = ratio << (127 - msb);\n\n int256 log_2 = (int256(msb) - 128) << 64;\n\n assembly {\n r := shr(127, mul(r, r))\n let f := shr(128, r)\n log_2 := or(log_2, shl(63, f))\n r := shr(f, r)\n }\n assembly {\n r := shr(127, mul(r, r))\n let f := shr(128, r)\n log_2 := or(log_2, shl(62, f))\n r := shr(f, r)\n }\n assembly {\n r := shr(127, mul(r, r))\n let f := shr(128, r)\n log_2 := or(log_2, shl(61, f))\n r := shr(f, r)\n }\n assembly {\n r := shr(127, mul(r, r))\n let f := shr(128, r)\n log_2 := or(log_2, shl(60, f))\n r := shr(f, r)\n }\n assembly {\n r := shr(127, mul(r, r))\n let f := shr(128, r)\n log_2 := or(log_2, shl(59, f))\n r := shr(f, r)\n }\n assembly {\n r := shr(127, mul(r, r))\n let f := shr(128, r)\n log_2 := or(log_2, shl(58, f))\n r := shr(f, r)\n }\n assembly {\n r := shr(127, mul(r, r))\n let f := shr(128, r)\n log_2 := or(log_2, shl(57, f))\n r := shr(f, r)\n }\n assembly {\n r := shr(127, mul(r, r))\n let f := shr(128, r)\n log_2 := or(log_2, shl(56, f))\n r := shr(f, r)\n }\n assembly {\n r := shr(127, mul(r, r))\n let f := shr(128, r)\n log_2 := or(log_2, shl(55, f))\n r := shr(f, r)\n }\n assembly {\n r := shr(127, mul(r, r))\n let f := shr(128, r)\n log_2 := or(log_2, shl(54, f))\n r := shr(f, r)\n }\n assembly {\n r := shr(127, mul(r, r))\n let f := shr(128, r)\n log_2 := or(log_2, shl(53, f))\n r := shr(f, r)\n }\n assembly {\n r := shr(127, mul(r, r))\n let f := shr(128, r)\n log_2 := or(log_2, shl(52, f))\n r := shr(f, r)\n }\n assembly {\n r := shr(127, mul(r, r))\n let f := shr(128, r)\n log_2 := or(log_2, shl(51, f))\n r := shr(f, r)\n }\n assembly {\n r := shr(127, mul(r, r))\n let f := shr(128, r)\n log_2 := or(log_2, shl(50, f))\n }\n\n int256 log_sqrt10001 = log_2 * 255738958999603826347141; // 128.128 number\n\n int24 tickLow = int24((log_sqrt10001 - 3402992956809132418596140100660247210) >> 128);\n int24 tickHi = int24((log_sqrt10001 + 291339464771989622907027621153398088495) >> 128);\n\n tick = tickLow == tickHi ? tickLow : getSqrtRatioAtTick(tickHi) <= sqrtPriceX96 ? tickHi : tickLow;\n }\n}\n" - }, - "@uniswap/v3-core/contracts/interfaces/IUniswapV3Pool.sol": { - "content": "// SPDX-License-Identifier: GPL-2.0-or-later\npragma solidity >=0.5.0;\n\nimport './pool/IUniswapV3PoolImmutables.sol';\nimport './pool/IUniswapV3PoolState.sol';\nimport './pool/IUniswapV3PoolDerivedState.sol';\nimport './pool/IUniswapV3PoolActions.sol';\nimport './pool/IUniswapV3PoolOwnerActions.sol';\nimport './pool/IUniswapV3PoolEvents.sol';\n\n/// @title The interface for a Uniswap V3 Pool\n/// @notice A Uniswap pool facilitates swapping and automated market making between any two assets that strictly conform\n/// to the ERC20 specification\n/// @dev The pool interface is broken up into many smaller pieces\ninterface IUniswapV3Pool is\n IUniswapV3PoolImmutables,\n IUniswapV3PoolState,\n IUniswapV3PoolDerivedState,\n IUniswapV3PoolActions,\n IUniswapV3PoolOwnerActions,\n IUniswapV3PoolEvents\n{\n\n}\n" - }, - "@uniswap/v3-core/contracts/interfaces/pool/IUniswapV3PoolImmutables.sol": { - "content": "// SPDX-License-Identifier: GPL-2.0-or-later\npragma solidity >=0.5.0;\n\n/// @title Pool state that never changes\n/// @notice These parameters are fixed for a pool forever, i.e., the methods will always return the same values\ninterface IUniswapV3PoolImmutables {\n /// @notice The contract that deployed the pool, which must adhere to the IUniswapV3Factory interface\n /// @return The contract address\n function factory() external view returns (address);\n\n /// @notice The first of the two tokens of the pool, sorted by address\n /// @return The token contract address\n function token0() external view returns (address);\n\n /// @notice The second of the two tokens of the pool, sorted by address\n /// @return The token contract address\n function token1() external view returns (address);\n\n /// @notice The pool's fee in hundredths of a bip, i.e. 1e-6\n /// @return The fee\n function fee() external view returns (uint24);\n\n /// @notice The pool tick spacing\n /// @dev Ticks can only be used at multiples of this value, minimum of 1 and always positive\n /// e.g.: a tickSpacing of 3 means ticks can be initialized every 3rd tick, i.e., ..., -6, -3, 0, 3, 6, ...\n /// This value is an int24 to avoid casting even though it is always positive.\n /// @return The tick spacing\n function tickSpacing() external view returns (int24);\n\n /// @notice The maximum amount of position liquidity that can use any tick in the range\n /// @dev This parameter is enforced per tick to prevent liquidity from overflowing a uint128 at any point, and\n /// also prevents out-of-range liquidity from being used to prevent adding in-range liquidity to a pool\n /// @return The max amount of liquidity per tick\n function maxLiquidityPerTick() external view returns (uint128);\n}\n" - }, - "@uniswap/v3-core/contracts/interfaces/pool/IUniswapV3PoolState.sol": { - "content": "// SPDX-License-Identifier: GPL-2.0-or-later\npragma solidity >=0.5.0;\n\n/// @title Pool state that can change\n/// @notice These methods compose the pool's state, and can change with any frequency including multiple times\n/// per transaction\ninterface IUniswapV3PoolState {\n /// @notice The 0th storage slot in the pool stores many values, and is exposed as a single method to save gas\n /// when accessed externally.\n /// @return sqrtPriceX96 The current price of the pool as a sqrt(token1/token0) Q64.96 value\n /// tick The current tick of the pool, i.e. according to the last tick transition that was run.\n /// This value may not always be equal to SqrtTickMath.getTickAtSqrtRatio(sqrtPriceX96) if the price is on a tick\n /// boundary.\n /// observationIndex The index of the last oracle observation that was written,\n /// observationCardinality The current maximum number of observations stored in the pool,\n /// observationCardinalityNext The next maximum number of observations, to be updated when the observation.\n /// feeProtocol The protocol fee for both tokens of the pool.\n /// Encoded as two 4 bit values, where the protocol fee of token1 is shifted 4 bits and the protocol fee of token0\n /// is the lower 4 bits. Used as the denominator of a fraction of the swap fee, e.g. 4 means 1/4th of the swap fee.\n /// unlocked Whether the pool is currently locked to reentrancy\n function slot0()\n external\n view\n returns (\n uint160 sqrtPriceX96,\n int24 tick,\n uint16 observationIndex,\n uint16 observationCardinality,\n uint16 observationCardinalityNext,\n uint8 feeProtocol,\n bool unlocked\n );\n\n /// @notice The fee growth as a Q128.128 fees of token0 collected per unit of liquidity for the entire life of the pool\n /// @dev This value can overflow the uint256\n function feeGrowthGlobal0X128() external view returns (uint256);\n\n /// @notice The fee growth as a Q128.128 fees of token1 collected per unit of liquidity for the entire life of the pool\n /// @dev This value can overflow the uint256\n function feeGrowthGlobal1X128() external view returns (uint256);\n\n /// @notice The amounts of token0 and token1 that are owed to the protocol\n /// @dev Protocol fees will never exceed uint128 max in either token\n function protocolFees() external view returns (uint128 token0, uint128 token1);\n\n /// @notice The currently in range liquidity available to the pool\n /// @dev This value has no relationship to the total liquidity across all ticks\n function liquidity() external view returns (uint128);\n\n /// @notice Look up information about a specific tick in the pool\n /// @param tick The tick to look up\n /// @return liquidityGross the total amount of position liquidity that uses the pool either as tick lower or\n /// tick upper,\n /// liquidityNet how much liquidity changes when the pool price crosses the tick,\n /// feeGrowthOutside0X128 the fee growth on the other side of the tick from the current tick in token0,\n /// feeGrowthOutside1X128 the fee growth on the other side of the tick from the current tick in token1,\n /// tickCumulativeOutside the cumulative tick value on the other side of the tick from the current tick\n /// secondsPerLiquidityOutsideX128 the seconds spent per liquidity on the other side of the tick from the current tick,\n /// secondsOutside the seconds spent on the other side of the tick from the current tick,\n /// initialized Set to true if the tick is initialized, i.e. liquidityGross is greater than 0, otherwise equal to false.\n /// Outside values can only be used if the tick is initialized, i.e. if liquidityGross is greater than 0.\n /// In addition, these values are only relative and must be used only in comparison to previous snapshots for\n /// a specific position.\n function ticks(int24 tick)\n external\n view\n returns (\n uint128 liquidityGross,\n int128 liquidityNet,\n uint256 feeGrowthOutside0X128,\n uint256 feeGrowthOutside1X128,\n int56 tickCumulativeOutside,\n uint160 secondsPerLiquidityOutsideX128,\n uint32 secondsOutside,\n bool initialized\n );\n\n /// @notice Returns 256 packed tick initialized boolean values. See TickBitmap for more information\n function tickBitmap(int16 wordPosition) external view returns (uint256);\n\n /// @notice Returns the information about a position by the position's key\n /// @param key The position's key is a hash of a preimage composed by the owner, tickLower and tickUpper\n /// @return _liquidity The amount of liquidity in the position,\n /// Returns feeGrowthInside0LastX128 fee growth of token0 inside the tick range as of the last mint/burn/poke,\n /// Returns feeGrowthInside1LastX128 fee growth of token1 inside the tick range as of the last mint/burn/poke,\n /// Returns tokensOwed0 the computed amount of token0 owed to the position as of the last mint/burn/poke,\n /// Returns tokensOwed1 the computed amount of token1 owed to the position as of the last mint/burn/poke\n function positions(bytes32 key)\n external\n view\n returns (\n uint128 _liquidity,\n uint256 feeGrowthInside0LastX128,\n uint256 feeGrowthInside1LastX128,\n uint128 tokensOwed0,\n uint128 tokensOwed1\n );\n\n /// @notice Returns data about a specific observation index\n /// @param index The element of the observations array to fetch\n /// @dev You most likely want to use #observe() instead of this method to get an observation as of some amount of time\n /// ago, rather than at a specific index in the array.\n /// @return blockTimestamp The timestamp of the observation,\n /// Returns tickCumulative the tick multiplied by seconds elapsed for the life of the pool as of the observation timestamp,\n /// Returns secondsPerLiquidityCumulativeX128 the seconds per in range liquidity for the life of the pool as of the observation timestamp,\n /// Returns initialized whether the observation has been initialized and the values are safe to use\n function observations(uint256 index)\n external\n view\n returns (\n uint32 blockTimestamp,\n int56 tickCumulative,\n uint160 secondsPerLiquidityCumulativeX128,\n bool initialized\n );\n}\n" - }, - "@uniswap/v3-core/contracts/interfaces/pool/IUniswapV3PoolDerivedState.sol": { - "content": "// SPDX-License-Identifier: GPL-2.0-or-later\npragma solidity >=0.5.0;\n\n/// @title Pool state that is not stored\n/// @notice Contains view functions to provide information about the pool that is computed rather than stored on the\n/// blockchain. The functions here may have variable gas costs.\ninterface IUniswapV3PoolDerivedState {\n /// @notice Returns the cumulative tick and liquidity as of each timestamp `secondsAgo` from the current block timestamp\n /// @dev To get a time weighted average tick or liquidity-in-range, you must call this with two values, one representing\n /// the beginning of the period and another for the end of the period. E.g., to get the last hour time-weighted average tick,\n /// you must call it with secondsAgos = [3600, 0].\n /// @dev The time weighted average tick represents the geometric time weighted average price of the pool, in\n /// log base sqrt(1.0001) of token1 / token0. The TickMath library can be used to go from a tick value to a ratio.\n /// @param secondsAgos From how long ago each cumulative tick and liquidity value should be returned\n /// @return tickCumulatives Cumulative tick values as of each `secondsAgos` from the current block timestamp\n /// @return secondsPerLiquidityCumulativeX128s Cumulative seconds per liquidity-in-range value as of each `secondsAgos` from the current block\n /// timestamp\n function observe(uint32[] calldata secondsAgos)\n external\n view\n returns (int56[] memory tickCumulatives, uint160[] memory secondsPerLiquidityCumulativeX128s);\n\n /// @notice Returns a snapshot of the tick cumulative, seconds per liquidity and seconds inside a tick range\n /// @dev Snapshots must only be compared to other snapshots, taken over a period for which a position existed.\n /// I.e., snapshots cannot be compared if a position is not held for the entire period between when the first\n /// snapshot is taken and the second snapshot is taken.\n /// @param tickLower The lower tick of the range\n /// @param tickUpper The upper tick of the range\n /// @return tickCumulativeInside The snapshot of the tick accumulator for the range\n /// @return secondsPerLiquidityInsideX128 The snapshot of seconds per liquidity for the range\n /// @return secondsInside The snapshot of seconds per liquidity for the range\n function snapshotCumulativesInside(int24 tickLower, int24 tickUpper)\n external\n view\n returns (\n int56 tickCumulativeInside,\n uint160 secondsPerLiquidityInsideX128,\n uint32 secondsInside\n );\n}\n" - }, - "@uniswap/v3-core/contracts/interfaces/pool/IUniswapV3PoolActions.sol": { - "content": "// SPDX-License-Identifier: GPL-2.0-or-later\npragma solidity >=0.5.0;\n\n/// @title Permissionless pool actions\n/// @notice Contains pool methods that can be called by anyone\ninterface IUniswapV3PoolActions {\n /// @notice Sets the initial price for the pool\n /// @dev Price is represented as a sqrt(amountToken1/amountToken0) Q64.96 value\n /// @param sqrtPriceX96 the initial sqrt price of the pool as a Q64.96\n function initialize(uint160 sqrtPriceX96) external;\n\n /// @notice Adds liquidity for the given recipient/tickLower/tickUpper position\n /// @dev The caller of this method receives a callback in the form of IUniswapV3MintCallback#uniswapV3MintCallback\n /// in which they must pay any token0 or token1 owed for the liquidity. The amount of token0/token1 due depends\n /// on tickLower, tickUpper, the amount of liquidity, and the current price.\n /// @param recipient The address for which the liquidity will be created\n /// @param tickLower The lower tick of the position in which to add liquidity\n /// @param tickUpper The upper tick of the position in which to add liquidity\n /// @param amount The amount of liquidity to mint\n /// @param data Any data that should be passed through to the callback\n /// @return amount0 The amount of token0 that was paid to mint the given amount of liquidity. Matches the value in the callback\n /// @return amount1 The amount of token1 that was paid to mint the given amount of liquidity. Matches the value in the callback\n function mint(\n address recipient,\n int24 tickLower,\n int24 tickUpper,\n uint128 amount,\n bytes calldata data\n ) external returns (uint256 amount0, uint256 amount1);\n\n /// @notice Collects tokens owed to a position\n /// @dev Does not recompute fees earned, which must be done either via mint or burn of any amount of liquidity.\n /// Collect must be called by the position owner. To withdraw only token0 or only token1, amount0Requested or\n /// amount1Requested may be set to zero. To withdraw all tokens owed, caller may pass any value greater than the\n /// actual tokens owed, e.g. type(uint128).max. Tokens owed may be from accumulated swap fees or burned liquidity.\n /// @param recipient The address which should receive the fees collected\n /// @param tickLower The lower tick of the position for which to collect fees\n /// @param tickUpper The upper tick of the position for which to collect fees\n /// @param amount0Requested How much token0 should be withdrawn from the fees owed\n /// @param amount1Requested How much token1 should be withdrawn from the fees owed\n /// @return amount0 The amount of fees collected in token0\n /// @return amount1 The amount of fees collected in token1\n function collect(\n address recipient,\n int24 tickLower,\n int24 tickUpper,\n uint128 amount0Requested,\n uint128 amount1Requested\n ) external returns (uint128 amount0, uint128 amount1);\n\n /// @notice Burn liquidity from the sender and account tokens owed for the liquidity to the position\n /// @dev Can be used to trigger a recalculation of fees owed to a position by calling with an amount of 0\n /// @dev Fees must be collected separately via a call to #collect\n /// @param tickLower The lower tick of the position for which to burn liquidity\n /// @param tickUpper The upper tick of the position for which to burn liquidity\n /// @param amount How much liquidity to burn\n /// @return amount0 The amount of token0 sent to the recipient\n /// @return amount1 The amount of token1 sent to the recipient\n function burn(\n int24 tickLower,\n int24 tickUpper,\n uint128 amount\n ) external returns (uint256 amount0, uint256 amount1);\n\n /// @notice Swap token0 for token1, or token1 for token0\n /// @dev The caller of this method receives a callback in the form of IUniswapV3SwapCallback#uniswapV3SwapCallback\n /// @param recipient The address to receive the output of the swap\n /// @param zeroForOne The direction of the swap, true for token0 to token1, false for token1 to token0\n /// @param amountSpecified The amount of the swap, which implicitly configures the swap as exact input (positive), or exact output (negative)\n /// @param sqrtPriceLimitX96 The Q64.96 sqrt price limit. If zero for one, the price cannot be less than this\n /// value after the swap. If one for zero, the price cannot be greater than this value after the swap\n /// @param data Any data to be passed through to the callback\n /// @return amount0 The delta of the balance of token0 of the pool, exact when negative, minimum when positive\n /// @return amount1 The delta of the balance of token1 of the pool, exact when negative, minimum when positive\n function swap(\n address recipient,\n bool zeroForOne,\n int256 amountSpecified,\n uint160 sqrtPriceLimitX96,\n bytes calldata data\n ) external returns (int256 amount0, int256 amount1);\n\n /// @notice Receive token0 and/or token1 and pay it back, plus a fee, in the callback\n /// @dev The caller of this method receives a callback in the form of IUniswapV3FlashCallback#uniswapV3FlashCallback\n /// @dev Can be used to donate underlying tokens pro-rata to currently in-range liquidity providers by calling\n /// with 0 amount{0,1} and sending the donation amount(s) from the callback\n /// @param recipient The address which will receive the token0 and token1 amounts\n /// @param amount0 The amount of token0 to send\n /// @param amount1 The amount of token1 to send\n /// @param data Any data to be passed through to the callback\n function flash(\n address recipient,\n uint256 amount0,\n uint256 amount1,\n bytes calldata data\n ) external;\n\n /// @notice Increase the maximum number of price and liquidity observations that this pool will store\n /// @dev This method is no-op if the pool already has an observationCardinalityNext greater than or equal to\n /// the input observationCardinalityNext.\n /// @param observationCardinalityNext The desired minimum number of observations for the pool to store\n function increaseObservationCardinalityNext(uint16 observationCardinalityNext) external;\n}\n" - }, - "@uniswap/v3-core/contracts/interfaces/pool/IUniswapV3PoolOwnerActions.sol": { - "content": "// SPDX-License-Identifier: GPL-2.0-or-later\npragma solidity >=0.5.0;\n\n/// @title Permissioned pool actions\n/// @notice Contains pool methods that may only be called by the factory owner\ninterface IUniswapV3PoolOwnerActions {\n /// @notice Set the denominator of the protocol's % share of the fees\n /// @param feeProtocol0 new protocol fee for token0 of the pool\n /// @param feeProtocol1 new protocol fee for token1 of the pool\n function setFeeProtocol(uint8 feeProtocol0, uint8 feeProtocol1) external;\n\n /// @notice Collect the protocol fee accrued to the pool\n /// @param recipient The address to which collected protocol fees should be sent\n /// @param amount0Requested The maximum amount of token0 to send, can be 0 to collect fees in only token1\n /// @param amount1Requested The maximum amount of token1 to send, can be 0 to collect fees in only token0\n /// @return amount0 The protocol fee collected in token0\n /// @return amount1 The protocol fee collected in token1\n function collectProtocol(\n address recipient,\n uint128 amount0Requested,\n uint128 amount1Requested\n ) external returns (uint128 amount0, uint128 amount1);\n}\n" - }, - "@uniswap/v3-core/contracts/interfaces/pool/IUniswapV3PoolEvents.sol": { - "content": "// SPDX-License-Identifier: GPL-2.0-or-later\npragma solidity >=0.5.0;\n\n/// @title Events emitted by a pool\n/// @notice Contains all events emitted by the pool\ninterface IUniswapV3PoolEvents {\n /// @notice Emitted exactly once by a pool when #initialize is first called on the pool\n /// @dev Mint/Burn/Swap cannot be emitted by the pool before Initialize\n /// @param sqrtPriceX96 The initial sqrt price of the pool, as a Q64.96\n /// @param tick The initial tick of the pool, i.e. log base 1.0001 of the starting price of the pool\n event Initialize(uint160 sqrtPriceX96, int24 tick);\n\n /// @notice Emitted when liquidity is minted for a given position\n /// @param sender The address that minted the liquidity\n /// @param owner The owner of the position and recipient of any minted liquidity\n /// @param tickLower The lower tick of the position\n /// @param tickUpper The upper tick of the position\n /// @param amount The amount of liquidity minted to the position range\n /// @param amount0 How much token0 was required for the minted liquidity\n /// @param amount1 How much token1 was required for the minted liquidity\n event Mint(\n address sender,\n address indexed owner,\n int24 indexed tickLower,\n int24 indexed tickUpper,\n uint128 amount,\n uint256 amount0,\n uint256 amount1\n );\n\n /// @notice Emitted when fees are collected by the owner of a position\n /// @dev Collect events may be emitted with zero amount0 and amount1 when the caller chooses not to collect fees\n /// @param owner The owner of the position for which fees are collected\n /// @param tickLower The lower tick of the position\n /// @param tickUpper The upper tick of the position\n /// @param amount0 The amount of token0 fees collected\n /// @param amount1 The amount of token1 fees collected\n event Collect(\n address indexed owner,\n address recipient,\n int24 indexed tickLower,\n int24 indexed tickUpper,\n uint128 amount0,\n uint128 amount1\n );\n\n /// @notice Emitted when a position's liquidity is removed\n /// @dev Does not withdraw any fees earned by the liquidity position, which must be withdrawn via #collect\n /// @param owner The owner of the position for which liquidity is removed\n /// @param tickLower The lower tick of the position\n /// @param tickUpper The upper tick of the position\n /// @param amount The amount of liquidity to remove\n /// @param amount0 The amount of token0 withdrawn\n /// @param amount1 The amount of token1 withdrawn\n event Burn(\n address indexed owner,\n int24 indexed tickLower,\n int24 indexed tickUpper,\n uint128 amount,\n uint256 amount0,\n uint256 amount1\n );\n\n /// @notice Emitted by the pool for any swaps between token0 and token1\n /// @param sender The address that initiated the swap call, and that received the callback\n /// @param recipient The address that received the output of the swap\n /// @param amount0 The delta of the token0 balance of the pool\n /// @param amount1 The delta of the token1 balance of the pool\n /// @param sqrtPriceX96 The sqrt(price) of the pool after the swap, as a Q64.96\n /// @param liquidity The liquidity of the pool after the swap\n /// @param tick The log base 1.0001 of price of the pool after the swap\n event Swap(\n address indexed sender,\n address indexed recipient,\n int256 amount0,\n int256 amount1,\n uint160 sqrtPriceX96,\n uint128 liquidity,\n int24 tick\n );\n\n /// @notice Emitted by the pool for any flashes of token0/token1\n /// @param sender The address that initiated the swap call, and that received the callback\n /// @param recipient The address that received the tokens from flash\n /// @param amount0 The amount of token0 that was flashed\n /// @param amount1 The amount of token1 that was flashed\n /// @param paid0 The amount of token0 paid for the flash, which can exceed the amount0 plus the fee\n /// @param paid1 The amount of token1 paid for the flash, which can exceed the amount1 plus the fee\n event Flash(\n address indexed sender,\n address indexed recipient,\n uint256 amount0,\n uint256 amount1,\n uint256 paid0,\n uint256 paid1\n );\n\n /// @notice Emitted by the pool for increases to the number of observations that can be stored\n /// @dev observationCardinalityNext is not the observation cardinality until an observation is written at the index\n /// just before a mint/swap/burn.\n /// @param observationCardinalityNextOld The previous value of the next observation cardinality\n /// @param observationCardinalityNextNew The updated value of the next observation cardinality\n event IncreaseObservationCardinalityNext(\n uint16 observationCardinalityNextOld,\n uint16 observationCardinalityNextNew\n );\n\n /// @notice Emitted when the protocol fee is changed by the pool\n /// @param feeProtocol0Old The previous value of the token0 protocol fee\n /// @param feeProtocol1Old The previous value of the token1 protocol fee\n /// @param feeProtocol0New The updated value of the token0 protocol fee\n /// @param feeProtocol1New The updated value of the token1 protocol fee\n event SetFeeProtocol(uint8 feeProtocol0Old, uint8 feeProtocol1Old, uint8 feeProtocol0New, uint8 feeProtocol1New);\n\n /// @notice Emitted when the collected protocol fees are withdrawn by the factory owner\n /// @param sender The address that collects the protocol fees\n /// @param recipient The address that receives the collected protocol fees\n /// @param amount0 The amount of token0 protocol fees that is withdrawn\n /// @param amount0 The amount of token1 protocol fees that is withdrawn\n event CollectProtocol(address indexed sender, address indexed recipient, uint128 amount0, uint128 amount1);\n}\n" - }, - "solidity/for-test/UniV3PairManagerForTest.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '@openzeppelin/contracts/token/ERC20/ERC20.sol';\nimport '@uniswap/v3-core/contracts/interfaces/IUniswapV3Pool.sol';\n\nimport '../contracts/libraries/LiquidityAmounts.sol';\nimport '../contracts/libraries/FixedPoint96.sol';\nimport '../contracts/libraries/FullMath.sol';\nimport '../contracts/libraries/TickMath.sol';\nimport '../contracts/UniV3PairManager.sol';\nimport '../interfaces/external/IWeth9.sol';\nimport '../interfaces/IUniV3PairManager.sol';\n\ncontract UniV3PairManagerForTest is UniV3PairManager {\n constructor(address _pool, address _governance) UniV3PairManager(_pool, _governance) {}\n\n function internalAddLiquidity(\n uint256 amount0Desired,\n uint256 amount1Desired,\n uint256 amount0Min,\n uint256 amount1Min\n )\n external\n returns (\n uint128 liquidity,\n uint256 amount0,\n uint256 amount1\n )\n {\n return _addLiquidity(amount0Desired, amount1Desired, amount0Min, amount1Min);\n }\n\n function internalPay(\n address token,\n address payer,\n address recipient,\n uint256 value\n ) external {\n return _pay(token, payer, recipient, value);\n }\n\n function internalMint(address dst, uint256 amount) external {\n return _mint(dst, amount);\n }\n\n function internalBurn(address dst, uint256 amount) external {\n return _burn(dst, amount);\n }\n\n function internalTransferTokens(\n address src,\n address dst,\n uint256 amount\n ) external {\n _transferTokens(src, dst, amount);\n }\n\n function internalSafeTransferFrom(\n address token,\n address from,\n address to,\n uint256 value\n ) external {\n _safeTransferFrom(token, from, to, value);\n }\n\n receive() external payable {}\n}\n" - }, - "@openzeppelin/contracts/token/ERC20/ERC20.sol": { - "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\nimport \"./IERC20.sol\";\nimport \"./extensions/IERC20Metadata.sol\";\nimport \"../../utils/Context.sol\";\n\n/**\n * @dev Implementation of the {IERC20} interface.\n *\n * This implementation is agnostic to the way tokens are created. This means\n * that a supply mechanism has to be added in a derived contract using {_mint}.\n * For a generic mechanism see {ERC20PresetMinterPauser}.\n *\n * TIP: For a detailed writeup see our guide\n * https://forum.zeppelin.solutions/t/how-to-implement-erc20-supply-mechanisms/226[How\n * to implement supply mechanisms].\n *\n * We have followed general OpenZeppelin Contracts guidelines: functions revert\n * instead returning `false` on failure. This behavior is nonetheless\n * conventional and does not conflict with the expectations of ERC20\n * applications.\n *\n * Additionally, an {Approval} event is emitted on calls to {transferFrom}.\n * This allows applications to reconstruct the allowance for all accounts just\n * by listening to said events. Other implementations of the EIP may not emit\n * these events, as it isn't required by the specification.\n *\n * Finally, the non-standard {decreaseAllowance} and {increaseAllowance}\n * functions have been added to mitigate the well-known issues around setting\n * allowances. See {IERC20-approve}.\n */\ncontract ERC20 is Context, IERC20, IERC20Metadata {\n mapping(address => uint256) private _balances;\n\n mapping(address => mapping(address => uint256)) private _allowances;\n\n uint256 private _totalSupply;\n\n string private _name;\n string private _symbol;\n\n /**\n * @dev Sets the values for {name} and {symbol}.\n *\n * The default value of {decimals} is 18. To select a different value for\n * {decimals} you should overload it.\n *\n * All two of these values are immutable: they can only be set once during\n * construction.\n */\n constructor(string memory name_, string memory symbol_) {\n _name = name_;\n _symbol = symbol_;\n }\n\n /**\n * @dev Returns the name of the token.\n */\n function name() public view virtual override returns (string memory) {\n return _name;\n }\n\n /**\n * @dev Returns the symbol of the token, usually a shorter version of the\n * name.\n */\n function symbol() public view virtual override returns (string memory) {\n return _symbol;\n }\n\n /**\n * @dev Returns the number of decimals used to get its user representation.\n * For example, if `decimals` equals `2`, a balance of `505` tokens should\n * be displayed to a user as `5.05` (`505 / 10 ** 2`).\n *\n * Tokens usually opt for a value of 18, imitating the relationship between\n * Ether and Wei. This is the value {ERC20} uses, unless this function is\n * overridden;\n *\n * NOTE: This information is only used for _display_ purposes: it in\n * no way affects any of the arithmetic of the contract, including\n * {IERC20-balanceOf} and {IERC20-transfer}.\n */\n function decimals() public view virtual override returns (uint8) {\n return 18;\n }\n\n /**\n * @dev See {IERC20-totalSupply}.\n */\n function totalSupply() public view virtual override returns (uint256) {\n return _totalSupply;\n }\n\n /**\n * @dev See {IERC20-balanceOf}.\n */\n function balanceOf(address account) public view virtual override returns (uint256) {\n return _balances[account];\n }\n\n /**\n * @dev See {IERC20-transfer}.\n *\n * Requirements:\n *\n * - `recipient` cannot be the zero address.\n * - the caller must have a balance of at least `amount`.\n */\n function transfer(address recipient, uint256 amount) public virtual override returns (bool) {\n _transfer(_msgSender(), recipient, amount);\n return true;\n }\n\n /**\n * @dev See {IERC20-allowance}.\n */\n function allowance(address owner, address spender) public view virtual override returns (uint256) {\n return _allowances[owner][spender];\n }\n\n /**\n * @dev See {IERC20-approve}.\n *\n * Requirements:\n *\n * - `spender` cannot be the zero address.\n */\n function approve(address spender, uint256 amount) public virtual override returns (bool) {\n _approve(_msgSender(), spender, amount);\n return true;\n }\n\n /**\n * @dev See {IERC20-transferFrom}.\n *\n * Emits an {Approval} event indicating the updated allowance. This is not\n * required by the EIP. See the note at the beginning of {ERC20}.\n *\n * Requirements:\n *\n * - `sender` and `recipient` cannot be the zero address.\n * - `sender` must have a balance of at least `amount`.\n * - the caller must have allowance for ``sender``'s tokens of at least\n * `amount`.\n */\n function transferFrom(\n address sender,\n address recipient,\n uint256 amount\n ) public virtual override returns (bool) {\n _transfer(sender, recipient, amount);\n\n uint256 currentAllowance = _allowances[sender][_msgSender()];\n require(currentAllowance >= amount, \"ERC20: transfer amount exceeds allowance\");\n unchecked {\n _approve(sender, _msgSender(), currentAllowance - amount);\n }\n\n return true;\n }\n\n /**\n * @dev Atomically increases the allowance granted to `spender` by the caller.\n *\n * This is an alternative to {approve} that can be used as a mitigation for\n * problems described in {IERC20-approve}.\n *\n * Emits an {Approval} event indicating the updated allowance.\n *\n * Requirements:\n *\n * - `spender` cannot be the zero address.\n */\n function increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool) {\n _approve(_msgSender(), spender, _allowances[_msgSender()][spender] + addedValue);\n return true;\n }\n\n /**\n * @dev Atomically decreases the allowance granted to `spender` by the caller.\n *\n * This is an alternative to {approve} that can be used as a mitigation for\n * problems described in {IERC20-approve}.\n *\n * Emits an {Approval} event indicating the updated allowance.\n *\n * Requirements:\n *\n * - `spender` cannot be the zero address.\n * - `spender` must have allowance for the caller of at least\n * `subtractedValue`.\n */\n function decreaseAllowance(address spender, uint256 subtractedValue) public virtual returns (bool) {\n uint256 currentAllowance = _allowances[_msgSender()][spender];\n require(currentAllowance >= subtractedValue, \"ERC20: decreased allowance below zero\");\n unchecked {\n _approve(_msgSender(), spender, currentAllowance - subtractedValue);\n }\n\n return true;\n }\n\n /**\n * @dev Moves `amount` of tokens from `sender` to `recipient`.\n *\n * This internal function is equivalent to {transfer}, and can be used to\n * e.g. implement automatic token fees, slashing mechanisms, etc.\n *\n * Emits a {Transfer} event.\n *\n * Requirements:\n *\n * - `sender` cannot be the zero address.\n * - `recipient` cannot be the zero address.\n * - `sender` must have a balance of at least `amount`.\n */\n function _transfer(\n address sender,\n address recipient,\n uint256 amount\n ) internal virtual {\n require(sender != address(0), \"ERC20: transfer from the zero address\");\n require(recipient != address(0), \"ERC20: transfer to the zero address\");\n\n _beforeTokenTransfer(sender, recipient, amount);\n\n uint256 senderBalance = _balances[sender];\n require(senderBalance >= amount, \"ERC20: transfer amount exceeds balance\");\n unchecked {\n _balances[sender] = senderBalance - amount;\n }\n _balances[recipient] += amount;\n\n emit Transfer(sender, recipient, amount);\n\n _afterTokenTransfer(sender, recipient, amount);\n }\n\n /** @dev Creates `amount` tokens and assigns them to `account`, increasing\n * the total supply.\n *\n * Emits a {Transfer} event with `from` set to the zero address.\n *\n * Requirements:\n *\n * - `account` cannot be the zero address.\n */\n function _mint(address account, uint256 amount) internal virtual {\n require(account != address(0), \"ERC20: mint to the zero address\");\n\n _beforeTokenTransfer(address(0), account, amount);\n\n _totalSupply += amount;\n _balances[account] += amount;\n emit Transfer(address(0), account, amount);\n\n _afterTokenTransfer(address(0), account, amount);\n }\n\n /**\n * @dev Destroys `amount` tokens from `account`, reducing the\n * total supply.\n *\n * Emits a {Transfer} event with `to` set to the zero address.\n *\n * Requirements:\n *\n * - `account` cannot be the zero address.\n * - `account` must have at least `amount` tokens.\n */\n function _burn(address account, uint256 amount) internal virtual {\n require(account != address(0), \"ERC20: burn from the zero address\");\n\n _beforeTokenTransfer(account, address(0), amount);\n\n uint256 accountBalance = _balances[account];\n require(accountBalance >= amount, \"ERC20: burn amount exceeds balance\");\n unchecked {\n _balances[account] = accountBalance - amount;\n }\n _totalSupply -= amount;\n\n emit Transfer(account, address(0), amount);\n\n _afterTokenTransfer(account, address(0), amount);\n }\n\n /**\n * @dev Sets `amount` as the allowance of `spender` over the `owner` s tokens.\n *\n * This internal function is equivalent to `approve`, and can be used to\n * e.g. set automatic allowances for certain subsystems, etc.\n *\n * Emits an {Approval} event.\n *\n * Requirements:\n *\n * - `owner` cannot be the zero address.\n * - `spender` cannot be the zero address.\n */\n function _approve(\n address owner,\n address spender,\n uint256 amount\n ) internal virtual {\n require(owner != address(0), \"ERC20: approve from the zero address\");\n require(spender != address(0), \"ERC20: approve to the zero address\");\n\n _allowances[owner][spender] = amount;\n emit Approval(owner, spender, amount);\n }\n\n /**\n * @dev Hook that is called before any transfer of tokens. This includes\n * minting and burning.\n *\n * Calling conditions:\n *\n * - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens\n * will be transferred to `to`.\n * - when `from` is zero, `amount` tokens will be minted for `to`.\n * - when `to` is zero, `amount` of ``from``'s tokens will be burned.\n * - `from` and `to` are never both zero.\n *\n * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].\n */\n function _beforeTokenTransfer(\n address from,\n address to,\n uint256 amount\n ) internal virtual {}\n\n /**\n * @dev Hook that is called after any transfer of tokens. This includes\n * minting and burning.\n *\n * Calling conditions:\n *\n * - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens\n * has been transferred to `to`.\n * - when `from` is zero, `amount` tokens have been minted for `to`.\n * - when `to` is zero, `amount` of ``from``'s tokens have been burned.\n * - `from` and `to` are never both zero.\n *\n * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].\n */\n function _afterTokenTransfer(\n address from,\n address to,\n uint256 amount\n ) internal virtual {}\n}\n" - }, - "solidity/contracts/libraries/LiquidityAmounts.sol": { - "content": "// SPDX-License-Identifier: GPL-2.0-or-later\npragma solidity >=0.8.4 <0.9.0;\n\nimport './FullMath.sol';\nimport './FixedPoint96.sol';\n\n// solhint-disable\nlibrary LiquidityAmounts {\n function toUint128(uint256 x) private pure returns (uint128 y) {\n require((y = uint128(x)) == x);\n }\n\n function getLiquidityForAmount0(\n uint160 sqrtRatioAX96,\n uint160 sqrtRatioBX96,\n uint256 amount0\n ) internal pure returns (uint128 liquidity) {\n if (sqrtRatioAX96 > sqrtRatioBX96) (sqrtRatioAX96, sqrtRatioBX96) = (sqrtRatioBX96, sqrtRatioAX96);\n uint256 intermediate = FullMath.mulDiv(sqrtRatioAX96, sqrtRatioBX96, FixedPoint96.Q96);\n return toUint128(FullMath.mulDiv(amount0, intermediate, sqrtRatioBX96 - sqrtRatioAX96));\n }\n\n function getLiquidityForAmount1(\n uint160 sqrtRatioAX96,\n uint160 sqrtRatioBX96,\n uint256 amount1\n ) internal pure returns (uint128 liquidity) {\n if (sqrtRatioAX96 > sqrtRatioBX96) (sqrtRatioAX96, sqrtRatioBX96) = (sqrtRatioBX96, sqrtRatioAX96);\n return toUint128(FullMath.mulDiv(amount1, FixedPoint96.Q96, sqrtRatioBX96 - sqrtRatioAX96));\n }\n\n function getLiquidityForAmounts(\n uint160 sqrtRatioX96,\n uint160 sqrtRatioAX96,\n uint160 sqrtRatioBX96,\n uint256 amount0,\n uint256 amount1\n ) internal pure returns (uint128 liquidity) {\n if (sqrtRatioAX96 > sqrtRatioBX96) (sqrtRatioAX96, sqrtRatioBX96) = (sqrtRatioBX96, sqrtRatioAX96);\n\n if (sqrtRatioX96 <= sqrtRatioAX96) {\n liquidity = getLiquidityForAmount0(sqrtRatioAX96, sqrtRatioBX96, amount0);\n } else if (sqrtRatioX96 < sqrtRatioBX96) {\n uint128 liquidity0 = getLiquidityForAmount0(sqrtRatioX96, sqrtRatioBX96, amount0);\n uint128 liquidity1 = getLiquidityForAmount1(sqrtRatioAX96, sqrtRatioX96, amount1);\n\n liquidity = liquidity0 < liquidity1 ? liquidity0 : liquidity1;\n } else {\n liquidity = getLiquidityForAmount1(sqrtRatioAX96, sqrtRatioBX96, amount1);\n }\n }\n\n function getAmount0ForLiquidity(\n uint160 sqrtRatioAX96,\n uint160 sqrtRatioBX96,\n uint128 liquidity\n ) internal pure returns (uint256 amount0) {\n if (sqrtRatioAX96 > sqrtRatioBX96) (sqrtRatioAX96, sqrtRatioBX96) = (sqrtRatioBX96, sqrtRatioAX96);\n\n return FullMath.mulDiv(uint256(liquidity) << FixedPoint96.RESOLUTION, sqrtRatioBX96 - sqrtRatioAX96, sqrtRatioBX96) / sqrtRatioAX96;\n }\n\n function getAmount1ForLiquidity(\n uint160 sqrtRatioAX96,\n uint160 sqrtRatioBX96,\n uint128 liquidity\n ) internal pure returns (uint256 amount1) {\n if (sqrtRatioAX96 > sqrtRatioBX96) (sqrtRatioAX96, sqrtRatioBX96) = (sqrtRatioBX96, sqrtRatioAX96);\n\n return FullMath.mulDiv(liquidity, sqrtRatioBX96 - sqrtRatioAX96, FixedPoint96.Q96);\n }\n\n function getAmountsForLiquidity(\n uint160 sqrtRatioX96,\n uint160 sqrtRatioAX96,\n uint160 sqrtRatioBX96,\n uint128 liquidity\n ) internal pure returns (uint256 amount0, uint256 amount1) {\n if (sqrtRatioAX96 > sqrtRatioBX96) (sqrtRatioAX96, sqrtRatioBX96) = (sqrtRatioBX96, sqrtRatioAX96);\n\n if (sqrtRatioX96 <= sqrtRatioAX96) {\n amount0 = getAmount0ForLiquidity(sqrtRatioAX96, sqrtRatioBX96, liquidity);\n } else if (sqrtRatioX96 < sqrtRatioBX96) {\n amount0 = getAmount0ForLiquidity(sqrtRatioX96, sqrtRatioBX96, liquidity);\n amount1 = getAmount1ForLiquidity(sqrtRatioAX96, sqrtRatioX96, liquidity);\n } else {\n amount1 = getAmount1ForLiquidity(sqrtRatioAX96, sqrtRatioBX96, liquidity);\n }\n }\n}\n" - }, - "solidity/contracts/libraries/FixedPoint96.sol": { - "content": "// SPDX-License-Identifier: GPL-2.0-or-later\npragma solidity >=0.8.4 <0.9.0;\n\nlibrary FixedPoint96 {\n // solhint-disable\n uint8 internal constant RESOLUTION = 96;\n uint256 internal constant Q96 = 0x1000000000000000000000000;\n}\n" - }, - "solidity/contracts/UniV3PairManager.sol": { - "content": "// SPDX-License-Identifier: MIT\n\n/*\n\nCoded for The Keep3r Network with ♥ by\n\n██████╗░███████╗███████╗██╗  ░██╗░░░░░░░██╗░█████╗░███╗░░██╗██████╗░███████╗██████╗░██╗░░░░░░█████╗░███╗░░██╗██████╗░\n██╔══██╗██╔════╝██╔════╝██║  ░██║░░██╗░░██║██╔══██╗████╗░██║██╔══██╗██╔════╝██╔══██╗██║░░░░░██╔══██╗████╗░██║██╔══██╗\n██║░░██║█████╗░░█████╗░░██║  ░╚██╗████╗██╔╝██║░░██║██╔██╗██║██║░░██║█████╗░░██████╔╝██║░░░░░███████║██╔██╗██║██║░░██║\n██║░░██║██╔══╝░░██╔══╝░░██║  ░░████╔═████║░██║░░██║██║╚████║██║░░██║██╔══╝░░██╔══██╗██║░░░░░██╔══██║██║╚████║██║░░██║\n██████╔╝███████╗██║░░░░░██║  ░░╚██╔╝░╚██╔╝░╚█████╔╝██║░╚███║██████╔╝███████╗██║░░██║███████╗██║░░██║██║░╚███║██████╔╝\n╚═════╝░╚══════╝╚═╝░░░░░╚═╝  ░░░╚═╝░░░╚═╝░░░╚════╝░╚═╝░░╚══╝╚═════╝░╚══════╝╚═╝░░╚═╝╚══════╝╚═╝░░╚═╝╚═╝░░╚══╝╚═════╝░\n\nhttps://defi.sucks\n\n*/\n\npragma solidity >=0.8.4 <0.9.0;\n\nimport '@openzeppelin/contracts/token/ERC20/ERC20.sol';\nimport '@uniswap/v3-core/contracts/interfaces/IUniswapV3Pool.sol';\n\nimport './libraries/LiquidityAmounts.sol';\nimport './libraries/FixedPoint96.sol';\nimport './libraries/FullMath.sol';\nimport './libraries/TickMath.sol';\n\nimport '../interfaces/external/IWeth9.sol';\nimport '../interfaces/IUniV3PairManager.sol';\n\nimport './peripherals/Governable.sol';\n\ncontract UniV3PairManager is IUniV3PairManager, Governable {\n /// @inheritdoc IERC20Metadata\n string public override name;\n\n /// @inheritdoc IERC20Metadata\n string public override symbol;\n\n /// @inheritdoc IERC20\n uint256 public override totalSupply;\n\n /// @inheritdoc IPairManager\n address public immutable override factory;\n\n /// @inheritdoc IPairManager\n address public immutable override token0;\n\n /// @inheritdoc IPairManager\n address public immutable override token1;\n\n /// @inheritdoc IPairManager\n address public immutable override pool;\n\n /// @inheritdoc IUniV3PairManager\n uint24 public immutable override fee;\n\n /// @inheritdoc IUniV3PairManager\n uint160 public immutable override sqrtRatioAX96;\n\n /// @inheritdoc IUniV3PairManager\n uint160 public immutable override sqrtRatioBX96;\n\n /// @inheritdoc IUniV3PairManager\n int24 public immutable override tickLower;\n\n /// @inheritdoc IUniV3PairManager\n int24 public immutable override tickUpper;\n\n /// @inheritdoc IUniV3PairManager\n int24 public immutable override tickSpacing;\n\n /// @notice Uniswap's maximum tick\n /// @dev Due to tick spacing, pools with different fees may have differences between _MAX_TICK and tickUpper. Use tickUpper to find the max tick of the pool.\n int24 private constant _MAX_TICK = 887272;\n\n /// @inheritdoc IERC20Metadata\n //solhint-disable-next-line const-name-snakecase\n uint8 public constant override decimals = 18;\n\n /// @inheritdoc IERC20\n mapping(address => mapping(address => uint256)) public override allowance;\n\n /// @inheritdoc IERC20\n mapping(address => uint256) public override balanceOf;\n\n /// @notice Struct that contains token0, token1, and fee of the Uniswap pool\n PoolKey private _poolKey;\n\n constructor(address _pool, address _governance) Governable(_governance) {\n uint24 _fee = IUniswapV3Pool(_pool).fee();\n address _token0 = IUniswapV3Pool(_pool).token0();\n address _token1 = IUniswapV3Pool(_pool).token1();\n int24 _tickSpacing = IUniswapV3Pool(_pool).tickSpacing();\n int24 _tickUpper = _MAX_TICK - (_MAX_TICK % _tickSpacing);\n int24 _tickLower = -_tickUpper;\n\n factory = msg.sender;\n pool = _pool;\n fee = _fee;\n tickSpacing = _tickSpacing;\n tickUpper = _tickUpper;\n tickLower = _tickLower;\n token0 = _token0;\n token1 = _token1;\n name = string(abi.encodePacked('Keep3rLP - ', ERC20(_token0).symbol(), '/', ERC20(_token1).symbol()));\n symbol = string(abi.encodePacked('kLP-', ERC20(_token0).symbol(), '/', ERC20(_token1).symbol()));\n\n sqrtRatioAX96 = TickMath.getSqrtRatioAtTick(_tickLower);\n sqrtRatioBX96 = TickMath.getSqrtRatioAtTick(_tickUpper);\n _poolKey = PoolKey({token0: _token0, token1: _token1, fee: _fee});\n }\n\n // This low-level function should be called from a contract which performs important safety checks\n /// @inheritdoc IUniV3PairManager\n function mint(\n uint256 amount0Desired,\n uint256 amount1Desired,\n uint256 amount0Min,\n uint256 amount1Min,\n address to\n ) external override returns (uint128 liquidity) {\n (liquidity, , ) = _addLiquidity(amount0Desired, amount1Desired, amount0Min, amount1Min);\n _mint(to, liquidity);\n }\n\n /// @inheritdoc IUniV3PairManager\n function uniswapV3MintCallback(\n uint256 amount0Owed,\n uint256 amount1Owed,\n bytes calldata data\n ) external override {\n MintCallbackData memory decoded = abi.decode(data, (MintCallbackData));\n if (msg.sender != pool) revert OnlyPool();\n if (amount0Owed > 0) _pay(decoded._poolKey.token0, decoded.payer, pool, amount0Owed);\n if (amount1Owed > 0) _pay(decoded._poolKey.token1, decoded.payer, pool, amount1Owed);\n }\n\n /// @inheritdoc IUniV3PairManager\n function burn(\n uint128 liquidity,\n uint256 amount0Min,\n uint256 amount1Min,\n address to\n ) external override returns (uint256 amount0, uint256 amount1) {\n (amount0, amount1) = IUniswapV3Pool(pool).burn(tickLower, tickUpper, liquidity);\n\n if (amount0 < amount0Min || amount1 < amount1Min) revert ExcessiveSlippage();\n\n IUniswapV3Pool(pool).collect(to, tickLower, tickUpper, uint128(amount0), uint128(amount1));\n _burn(msg.sender, liquidity);\n }\n\n /// @inheritdoc IUniV3PairManager\n function collect() external override onlyGovernance returns (uint256 amount0, uint256 amount1) {\n (, , , uint128 tokensOwed0, uint128 tokensOwed1) = IUniswapV3Pool(pool).positions(\n keccak256(abi.encodePacked(address(this), tickLower, tickUpper))\n );\n (amount0, amount1) = IUniswapV3Pool(pool).collect(governance, tickLower, tickUpper, tokensOwed0, tokensOwed1);\n }\n\n /// @inheritdoc IUniV3PairManager\n function position()\n external\n view\n override\n returns (\n uint128 liquidity,\n uint256 feeGrowthInside0LastX128,\n uint256 feeGrowthInside1LastX128,\n uint128 tokensOwed0,\n uint128 tokensOwed1\n )\n {\n (liquidity, feeGrowthInside0LastX128, feeGrowthInside1LastX128, tokensOwed0, tokensOwed1) = IUniswapV3Pool(pool).positions(\n keccak256(abi.encodePacked(address(this), tickLower, tickUpper))\n );\n }\n\n /// @inheritdoc IERC20\n function approve(address spender, uint256 amount) external override returns (bool) {\n allowance[msg.sender][spender] = amount;\n\n emit Approval(msg.sender, spender, amount);\n return true;\n }\n\n /// @inheritdoc IERC20\n function transfer(address to, uint256 amount) external override returns (bool) {\n _transferTokens(msg.sender, to, amount);\n return true;\n }\n\n /// @inheritdoc IERC20\n function transferFrom(\n address from,\n address to,\n uint256 amount\n ) external override returns (bool) {\n address spender = msg.sender;\n uint256 spenderAllowance = allowance[from][spender];\n\n if (spender != from && spenderAllowance != type(uint256).max) {\n uint256 newAllowance = spenderAllowance - amount;\n allowance[from][spender] = newAllowance;\n\n emit Approval(from, spender, newAllowance);\n }\n\n _transferTokens(from, to, amount);\n return true;\n }\n\n /// @notice Adds liquidity to an initialized pool\n /// @dev Reverts if the returned amount0 is less than amount0Min or if amount1 is less than amount1Min\n /// @dev This function calls the mint function of the corresponding Uniswap pool, which in turn calls UniswapV3Callback\n /// @param amount0Desired The amount of token0 we would like to provide\n /// @param amount1Desired The amount of token1 we would like to provide\n /// @param amount0Min The minimum amount of token0 we want to provide\n /// @param amount1Min The minimum amount of token1 we want to provide\n /// @return liquidity The calculated liquidity we get for the token amounts we provided\n /// @return amount0 The amount of token0 we ended up providing\n /// @return amount1 The amount of token1 we ended up providing\n function _addLiquidity(\n uint256 amount0Desired,\n uint256 amount1Desired,\n uint256 amount0Min,\n uint256 amount1Min\n )\n internal\n returns (\n uint128 liquidity,\n uint256 amount0,\n uint256 amount1\n )\n {\n (uint160 sqrtPriceX96, , , , , , ) = IUniswapV3Pool(pool).slot0();\n\n liquidity = LiquidityAmounts.getLiquidityForAmounts(sqrtPriceX96, sqrtRatioAX96, sqrtRatioBX96, amount0Desired, amount1Desired);\n\n (amount0, amount1) = IUniswapV3Pool(pool).mint(\n address(this),\n tickLower,\n tickUpper,\n liquidity,\n abi.encode(MintCallbackData({_poolKey: _poolKey, payer: msg.sender}))\n );\n\n if (amount0 < amount0Min || amount1 < amount1Min) revert ExcessiveSlippage();\n }\n\n /// @notice Transfers the passed-in token from the payer to the recipient for the corresponding value\n /// @param token The token to be transferred to the recipient\n /// @param from The address of the payer\n /// @param to The address of the passed-in tokens recipient\n /// @param value How much of that token to be transferred from payer to the recipient\n function _pay(\n address token,\n address from,\n address to,\n uint256 value\n ) internal {\n _safeTransferFrom(token, from, to, value);\n }\n\n /// @notice Mints Keep3r credits to the passed-in address of recipient and increases total supply of Keep3r credits by the corresponding amount\n /// @param to The recipient of the Keep3r credits\n /// @param amount The amount Keep3r credits to be minted to the recipient\n function _mint(address to, uint256 amount) internal {\n totalSupply += amount;\n balanceOf[to] += amount;\n emit Transfer(address(0), to, amount);\n }\n\n /// @notice Burns Keep3r credits to the passed-in address of recipient and reduces total supply of Keep3r credits by the corresponding amount\n /// @param to The address that will get its Keep3r credits burned\n /// @param amount The amount Keep3r credits to be burned from the recipient/recipient\n function _burn(address to, uint256 amount) internal {\n totalSupply -= amount;\n balanceOf[to] -= amount;\n emit Transfer(to, address(0), amount);\n }\n\n /// @notice Transfers amount of Keep3r credits between two addresses\n /// @param from The user that transfers the Keep3r credits\n /// @param to The user that receives the Keep3r credits\n /// @param amount The amount of Keep3r credits to be transferred\n function _transferTokens(\n address from,\n address to,\n uint256 amount\n ) internal {\n balanceOf[from] -= amount;\n balanceOf[to] += amount;\n\n emit Transfer(from, to, amount);\n }\n\n /// @notice Transfers the passed-in token from the specified \"from\" to the specified \"to\" for the corresponding value\n /// @dev Reverts with IUniV3PairManager#UnsuccessfulTransfer if the transfer was not successful,\n /// or if the passed data length is different than 0 and the decoded data is not a boolean\n /// @param token The token to be transferred to the specified \"to\"\n /// @param from The address which is going to transfer the tokens\n /// @param value How much of that token to be transferred from \"from\" to \"to\"\n function _safeTransferFrom(\n address token,\n address from,\n address to,\n uint256 value\n ) internal {\n // solhint-disable-next-line avoid-low-level-calls\n (bool success, bytes memory data) = token.call(abi.encodeWithSelector(IERC20.transferFrom.selector, from, to, value));\n if (!success || (data.length != 0 && !abi.decode(data, (bool)))) revert UnsuccessfulTransfer();\n }\n}\n" - }, - "solidity/interfaces/external/IWeth9.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '@openzeppelin/contracts/token/ERC20/IERC20.sol';\n\ninterface IWeth9 is IERC20 {\n function deposit() external payable;\n\n function withdraw(uint256) external;\n}\n" - }, - "solidity/interfaces/IUniV3PairManager.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport './IPairManager.sol';\nimport '@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol';\nimport './peripherals/IGovernable.sol';\n\n/// @title Pair Manager contract\n/// @notice Creates a UniswapV3 position, and tokenizes in an ERC20 manner\n/// so that the user can use it as liquidity for a Keep3rJob\ninterface IUniV3PairManager is IGovernable, IPairManager {\n // Structs\n struct PoolKey {\n address token0;\n address token1;\n uint24 fee;\n }\n\n /// @notice The data to be decoded by the UniswapV3MintCallback function\n struct MintCallbackData {\n PoolKey _poolKey; // Struct that contains token0, token1, and fee of the pool passed into the constructor\n address payer; // The address of the payer, which will be the msg.sender of the mint function\n }\n\n // Variables\n\n /// @notice The fee of the Uniswap pool passed into the constructor\n /// @return _fee The fee of the Uniswap pool passed into the constructor\n function fee() external view returns (uint24 _fee);\n\n /// @notice Highest tick in the Uniswap's curve\n /// @return _tickUpper The highest tick in the Uniswap's curve\n function tickUpper() external view returns (int24 _tickUpper);\n\n /// @notice Lowest tick in the Uniswap's curve\n /// @return _tickLower The lower tick in the Uniswap's curve\n function tickLower() external view returns (int24 _tickLower);\n\n /// @notice The pair tick spacing\n /// @return _tickSpacing The pair tick spacing\n function tickSpacing() external view returns (int24 _tickSpacing);\n\n /// @notice The sqrtRatioAX96 at the lowest tick (-887200) of the Uniswap pool\n /// @return _sqrtPriceA96 A Fixed point Q64.96 number representing the sqrt of the ratio of the two assets (token1/token0)\n /// at the lowest tick\n function sqrtRatioAX96() external view returns (uint160 _sqrtPriceA96);\n\n /// @notice The sqrtRatioBX96 at the highest tick (887200) of the Uniswap pool\n /// @return _sqrtPriceBX96 A Fixed point Q64.96 number representing the sqrt of the ratio of the two assets (token1/token0)\n /// at the highest tick\n function sqrtRatioBX96() external view returns (uint160 _sqrtPriceBX96);\n\n // Errors\n\n /// @notice Throws when the caller of the function is not the pool\n error OnlyPool();\n\n /// @notice Throws when the slippage exceeds what the user is comfortable with\n error ExcessiveSlippage();\n\n /// @notice Throws when a transfer is unsuccessful\n error UnsuccessfulTransfer();\n\n // Methods\n\n /// @notice This function is called after a user calls IUniV3PairManager#mint function\n /// It ensures that any tokens owed to the pool are paid by the msg.sender of IUniV3PairManager#mint function\n /// @param amount0Owed The amount of token0 due to the pool for the minted liquidity\n /// @param amount1Owed The amount of token1 due to the pool for the minted liquidity\n /// @param data The encoded token0, token1, fee (_poolKey) and the payer (msg.sender) of the IUniV3PairManager#mint function\n function uniswapV3MintCallback(\n uint256 amount0Owed,\n uint256 amount1Owed,\n bytes calldata data\n ) external;\n\n /// @notice Mints kLP tokens to an address according to the liquidity the msg.sender provides to the UniswapV3 pool\n /// @dev Triggers UniV3PairManager#uniswapV3MintCallback\n /// @param amount0Desired The amount of token0 we would like to provide\n /// @param amount1Desired The amount of token1 we would like to provide\n /// @param amount0Min The minimum amount of token0 we want to provide\n /// @param amount1Min The minimum amount of token1 we want to provide\n /// @param to The address to which the kLP tokens are going to be minted to\n /// @return liquidity kLP tokens sent in exchange for the provision of tokens\n function mint(\n uint256 amount0Desired,\n uint256 amount1Desired,\n uint256 amount0Min,\n uint256 amount1Min,\n address to\n ) external returns (uint128 liquidity);\n\n /// @notice Returns the pair manager's position in the corresponding UniswapV3 pool\n /// @return liquidity The amount of liquidity provided to the UniswapV3 pool by the pair manager\n /// @return feeGrowthInside0LastX128 The fee growth of token0 as of the last action on the individual position\n /// @return feeGrowthInside1LastX128 The fee growth of token1 as of the last action on the individual position\n /// @return tokensOwed0 The uncollected amount of token0 owed to the position as of the last computation\n /// @return tokensOwed1 The uncollected amount of token1 owed to the position as of the last computation\n function position()\n external\n view\n returns (\n uint128 liquidity,\n uint256 feeGrowthInside0LastX128,\n uint256 feeGrowthInside1LastX128,\n uint128 tokensOwed0,\n uint128 tokensOwed1\n );\n\n /// @notice Calls the UniswapV3 pool's collect function, which collects up to a maximum amount of fees\n // owed to a specific position to the recipient, in this case, that recipient is the pair manager\n /// @dev The collected fees will be sent to governance\n /// @return amount0 The amount of fees collected in token0\n /// @return amount1 The amount of fees collected in token1\n function collect() external returns (uint256 amount0, uint256 amount1);\n\n /// @notice Burns the corresponding amount of kLP tokens from the msg.sender and withdraws the specified liquidity\n // in the entire range\n /// @param liquidity The amount of liquidity to be burned\n /// @param amount0Min The minimum amount of token0 we want to send to the recipient (to)\n /// @param amount1Min The minimum amount of token1 we want to send to the recipient (to)\n /// @param to The address that will receive the due fees\n /// @return amount0 The calculated amount of token0 that will be sent to the recipient\n /// @return amount1 The calculated amount of token1 that will be sent to the recipient\n function burn(\n uint128 liquidity,\n uint256 amount0Min,\n uint256 amount1Min,\n address to\n ) external returns (uint256 amount0, uint256 amount1);\n}\n" - }, - "@openzeppelin/contracts/utils/Context.sol": { - "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Provides information about the current execution context, including the\n * sender of the transaction and its data. While these are generally available\n * via msg.sender and msg.data, they should not be accessed in such a direct\n * manner, since when dealing with meta-transactions the account sending and\n * paying for execution may not be the actual sender (as far as an application\n * is concerned).\n *\n * This contract is only required for intermediate, library-like contracts.\n */\nabstract contract Context {\n function _msgSender() internal view virtual returns (address) {\n return msg.sender;\n }\n\n function _msgData() internal view virtual returns (bytes calldata) {\n return msg.data;\n }\n}\n" - }, - "solidity/interfaces/IPairManagerFactory.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport './peripherals/IGovernable.sol';\n\n/// @title Factory of Pair Managers\n/// @notice This contract creates new pair managers\ninterface IPairManagerFactory is IGovernable {\n // Variables\n\n /// @notice Maps the address of a Uniswap pool, to the address of the corresponding PairManager\n /// For example, the uniswap address of DAI-WETH, will return the Keep3r/DAI-WETH pair manager address\n /// @param _pool The address of the Uniswap pool\n /// @return _pairManager The address of the corresponding pair manager\n function pairManagers(address _pool) external view returns (address _pairManager);\n\n // Events\n\n /// @notice Emitted when a new pair manager is created\n /// @param _pool The address of the corresponding Uniswap pool\n /// @param _pairManager The address of the just-created pair manager\n event PairCreated(address _pool, address _pairManager);\n\n // Errors\n\n /// @notice Throws an error if the pair manager is already initialized\n error AlreadyInitialized();\n\n /// @notice Throws an error if the caller is not the owner\n error OnlyOwner();\n\n // Methods\n\n /// @notice Creates a new pair manager based on the address of a Uniswap pool\n /// For example, the uniswap address of DAI-WETH, will create the Keep3r/DAI-WETH pool\n /// @param _pool The address of the Uniswap pool the pair manager will be based of\n /// @return _pairManager The address of the just-created pair manager\n function createPairManager(address _pool) external returns (address _pairManager);\n}\n" - }, - "solidity/contracts/UniV3PairManagerFactory.sol": { - "content": "// SPDX-License-Identifier: MIT\n\n/*\n\nCoded for The Keep3r Network with ♥ by\n\n██████╗░███████╗███████╗██╗  ░██╗░░░░░░░██╗░█████╗░███╗░░██╗██████╗░███████╗██████╗░██╗░░░░░░█████╗░███╗░░██╗██████╗░\n██╔══██╗██╔════╝██╔════╝██║  ░██║░░██╗░░██║██╔══██╗████╗░██║██╔══██╗██╔════╝██╔══██╗██║░░░░░██╔══██╗████╗░██║██╔══██╗\n██║░░██║█████╗░░█████╗░░██║  ░╚██╗████╗██╔╝██║░░██║██╔██╗██║██║░░██║█████╗░░██████╔╝██║░░░░░███████║██╔██╗██║██║░░██║\n██║░░██║██╔══╝░░██╔══╝░░██║  ░░████╔═████║░██║░░██║██║╚████║██║░░██║██╔══╝░░██╔══██╗██║░░░░░██╔══██║██║╚████║██║░░██║\n██████╔╝███████╗██║░░░░░██║  ░░╚██╔╝░╚██╔╝░╚█████╔╝██║░╚███║██████╔╝███████╗██║░░██║███████╗██║░░██║██║░╚███║██████╔╝\n╚═════╝░╚══════╝╚═╝░░░░░╚═╝  ░░░╚═╝░░░╚═╝░░░╚════╝░╚═╝░░╚══╝╚═════╝░╚══════╝╚═╝░░╚═╝╚══════╝╚═╝░░╚═╝╚═╝░░╚══╝╚═════╝░\n\nhttps://defi.sucks\n\n*/\n\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../interfaces/IPairManagerFactory.sol';\nimport './UniV3PairManager.sol';\nimport './peripherals/Governable.sol';\n\n/// @title Factory of Pair Managers\n/// @notice This contract creates new pair managers\ncontract UniV3PairManagerFactory is IPairManagerFactory, Governable {\n mapping(address => address) public override pairManagers;\n\n constructor(address _governance) Governable(_governance) {}\n\n ///@inheritdoc IPairManagerFactory\n function createPairManager(address _pool) external override returns (address _pairManager) {\n if (pairManagers[_pool] != address(0)) revert AlreadyInitialized();\n _pairManager = address(new UniV3PairManager(_pool, governance));\n pairManagers[_pool] = _pairManager;\n emit PairCreated(_pool, _pairManager);\n }\n}\n" - }, - "solidity/for-test/peripherals/GovernableForTest.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../../contracts/peripherals/Governable.sol';\n\ncontract GovernableForTest is Governable {\n constructor(address _governor) Governable(_governor) {}\n}\n" - }, - "solidity/for-test/BridgeForTest.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.0 <0.9.0;\n\nimport '@openzeppelin/contracts/token/ERC20/ERC20.sol';\nimport '@openzeppelin/contracts/token/ERC20/IERC20.sol';\n\ncontract BridgeForTest is ERC20 {\n address public immutable kp3r;\n\n constructor(address _kp3r) ERC20('Wrapped KP3R', 'wKP3R') {\n kp3r = _kp3r;\n }\n\n function bridge(uint256 _amount) external {\n IERC20(kp3r).transferFrom(msg.sender, address(this), _amount);\n _mint(msg.sender, _amount);\n }\n\n function bridgeBack(uint256 _amount) external {\n _burn(msg.sender, _amount);\n IERC20(kp3r).transfer(msg.sender, _amount);\n }\n}\n" - }, - "solidity/for-test/ERC20ForTest.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '@openzeppelin/contracts/token/ERC20/ERC20.sol';\n\ncontract ERC20ForTest is ERC20 {\n constructor(\n string memory _name,\n string memory _symbol,\n address _initialAccount,\n uint256 _initialBalance\n ) ERC20(_name, _symbol) {\n _mint(_initialAccount, _initialBalance);\n }\n\n function mint(uint256 _amount) public {\n _mint(msg.sender, _amount);\n }\n\n function mint(address _account, uint256 _amount) public {\n _mint(_account, _amount);\n }\n\n function burn(uint256 _amount) public {\n _burn(msg.sender, _amount);\n }\n\n function burn(address _account, uint256 _amount) public {\n _burn(_account, _amount);\n }\n\n function transferInternal(\n address _from,\n address _to,\n uint256 _value\n ) public {\n _transfer(_from, _to, _value);\n }\n\n function approveInternal(\n address _owner,\n address _spender,\n uint256 _value\n ) public {\n _approve(_owner, _spender, _value);\n }\n\n function deposit() external payable {\n // Function added for compatibility with WETH\n }\n}\n" - }, - "solidity/for-test/peripherals/keepers/Keep3rKeeperFundableForTest.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../../../contracts/peripherals/keepers/Keep3rKeeperFundable.sol';\n\ncontract Keep3rKeeperFundableForTest is Keep3rKeeperFundable {\n using EnumerableSet for EnumerableSet.AddressSet;\n\n constructor(\n address _kph,\n address _keep3rV1,\n address _keep3rV1Proxy\n ) Keep3rParameters(_kph, _keep3rV1, _keep3rV1Proxy) Keep3rRoles(msg.sender) {}\n\n function isKeeper(address _keeper) external view returns (bool) {\n return _keepers.contains(_keeper);\n }\n\n function setJob(address job) external {\n _jobs.add(job);\n }\n}\n" - }, - "solidity/contracts/sidechain/Keep3rEscrow.sol": { - "content": "// SPDX-License-Identifier: MIT\n\n/*\n\nCoded for The Keep3r Network with ♥ by\n\n██████╗░███████╗███████╗██╗░░░██╗░░░░░░░██╗░█████╗░███╗░░██╗██████╗░███████╗██████╗░██╗░░░░░░█████╗░███╗░░██╗██████╗░\n██╔══██╗██╔════╝██╔════╝██║░░░██║░░██╗░░██║██╔══██╗████╗░██║██╔══██╗██╔════╝██╔══██╗██║░░░░░██╔══██╗████╗░██║██╔══██╗\n██║░░██║█████╗░░█████╗░░██║░░░╚██╗████╗██╔╝██║░░██║██╔██╗██║██║░░██║█████╗░░██████╔╝██║░░░░░███████║██╔██╗██║██║░░██║\n██║░░██║██╔══╝░░██╔══╝░░██║░░░░████╔═████║░██║░░██║██║╚████║██║░░██║██╔══╝░░██╔══██╗██║░░░░░██╔══██║██║╚████║██║░░██║\n██████╔╝███████╗██║░░░░░██║░░░░╚██╔╝░╚██╔╝░╚█████╔╝██║░╚███║██████╔╝███████╗██║░░██║███████╗██║░░██║██║░╚███║██████╔╝\n╚═════╝░╚══════╝╚═╝░░░░░╚═╝░░░░░╚═╝░░░╚═╝░░░╚════╝░╚═╝░░╚══╝╚═════╝░╚══════╝╚═╝░░╚═╝╚══════╝╚═╝░░╚═╝╚═╝░░╚══╝╚═════╝░\n\nhttps://defi.sucks\n\nCommit hash: ead559c8dc4361349b7222741c2399447e255d8e\n\n*/\n\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../peripherals/Mintable.sol';\nimport '../peripherals/DustCollector.sol';\nimport '../../interfaces/sidechain/IKeep3rEscrow.sol';\nimport '@openzeppelin/contracts/token/ERC20/IERC20.sol';\nimport '@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol';\n\ncontract Keep3rEscrow is Mintable, DustCollector, IKeep3rEscrow {\n using SafeERC20 for IERC20;\n\n /// @inheritdoc IKeep3rEscrow\n address public override wKP3R;\n\n /// @param _governance Address of governance\n /// @param _wKP3R Address of wrapped KP3R implementation\n constructor(address _governance, address _wKP3R) Mintable(_governance) {\n wKP3R = _wKP3R;\n }\n\n /// @inheritdoc IKeep3rEscrow\n function deposit(uint256 _amount) external override {\n IERC20(wKP3R).safeTransferFrom(msg.sender, address(this), _amount);\n emit wKP3RDeposited(wKP3R, msg.sender, _amount);\n }\n\n /// @inheritdoc IKeep3rEscrow\n function mint(uint256 _amount) external override onlyMinter {\n IERC20(wKP3R).safeTransfer(msg.sender, _amount);\n emit wKP3RMinted(wKP3R, msg.sender, _amount);\n }\n\n /// @inheritdoc IKeep3rEscrow\n function setWKP3R(address _wKP3R) external override onlyGovernance {\n if (_wKP3R == address(0)) revert ZeroAddress();\n wKP3R = _wKP3R;\n emit wKP3RSet(wKP3R);\n }\n}\n" - }, - "solidity/contracts/peripherals/Mintable.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../../interfaces/peripherals/IMintable.sol';\nimport './Governable.sol';\n\nabstract contract Mintable is Governable, IMintable {\n /// @inheritdoc IMintable\n address public override minter;\n\n constructor(address _governance) Governable(_governance) {}\n\n /// @inheritdoc IMintable\n function setMinter(address _minter) external override onlyGovernance {\n if (_minter == address(0)) revert ZeroAddress();\n minter = _minter;\n emit MinterSet(_minter);\n }\n\n /// @notice Functions with this modifier can only be called by the minter;\n modifier onlyMinter() {\n if (msg.sender != minter) revert OnlyMinter();\n _;\n }\n}\n" - }, - "solidity/for-test/peripherals/DustCollectorForTest.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../../contracts/peripherals/DustCollector.sol';\n\ncontract DustCollectorForTest is DustCollector {\n constructor() DustCollector() Governable(msg.sender) {}\n}\n" - }, - "solidity/for-test/peripherals/Keep3rAccountanceForTest.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../../contracts/peripherals/Keep3rAccountance.sol';\n\ncontract Keep3rAccountanceForTest is Keep3rAccountance {\n using EnumerableSet for EnumerableSet.AddressSet;\n\n constructor() Keep3rRoles(msg.sender) {}\n\n function setJob(address job) external {\n _jobs.add(job);\n }\n\n function setKeeper(address keeper) external {\n _keepers.add(keeper);\n }\n}\n" - }, - "solidity/for-test/peripherals/jobs/Keep3rJobFundableLiquidityForTest.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../../../contracts/peripherals/jobs/Keep3rJobFundableLiquidity.sol';\n\ncontract Keep3rJobFundableLiquidityForTest is Keep3rJobFundableLiquidity {\n using EnumerableSet for EnumerableSet.AddressSet;\n\n constructor(\n address _kph,\n address _keep3rV1,\n address _keep3rV1Proxy\n ) Keep3rParameters(_kph, _keep3rV1, _keep3rV1Proxy) Keep3rRoles(msg.sender) {}\n\n function setJob(address _job) external {\n _jobs.add(_job);\n }\n\n function setJobLiquidity(address _job, address _liquidity) external returns (bool) {\n return _jobLiquidities[_job].add(_liquidity);\n }\n\n function setApprovedLiquidity(address _liquidity) external {\n _approvedLiquidities.add(_liquidity);\n }\n\n function setRevokedLiquidity(address _liquidity) external {\n _approvedLiquidities.remove(_liquidity);\n }\n\n function viewTickCache(address _liquidity) external view returns (TickCache memory _tickCache) {\n _tickCache = _tick[_liquidity];\n }\n\n function viewTickOrder(address _liquidity) external view returns (bool) {\n return _isKP3RToken0[_liquidity];\n }\n\n function internalJobLiquidities(address _job) external view returns (address[] memory _list) {\n _list = _jobLiquidities[_job].values();\n }\n\n function internalSettleJobAccountance(address _job) external {\n _settleJobAccountance(_job);\n }\n}\n" - }, - "solidity/for-test/peripherals/jobs/Keep3rJobDisputableForTest.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../../../contracts/peripherals/jobs/Keep3rJobDisputable.sol';\n\ncontract Keep3rJobDisputableForTest is Keep3rJobDisputable {\n using EnumerableSet for EnumerableSet.AddressSet;\n\n constructor(\n address _kph,\n address _keep3rV1,\n address _keep3rV1Proxy\n ) Keep3rParameters(_kph, _keep3rV1, _keep3rV1Proxy) Keep3rRoles(msg.sender) {}\n\n function setJobLiquidity(address _job, address _liquidity) external {\n _jobLiquidities[_job].add(_liquidity);\n }\n\n function setJobToken(address _job, address _token) external {\n _jobTokens[_job].add(_token);\n }\n\n function setApprovedLiquidity(address _liquidity) external {\n _approvedLiquidities.add(_liquidity);\n }\n\n function setRevokedLiquidity(address _liquidity) external {\n _approvedLiquidities.remove(_liquidity);\n }\n\n function internalJobLiquidityCredits(address _job) external view returns (uint256 _credits) {\n _credits = _jobLiquidityCredits[_job];\n }\n\n function internalJobPeriodCredits(address _job) external view returns (uint256 _credits) {\n _credits = _jobPeriodCredits[_job];\n }\n\n function internalJobTokens(address _job) external view returns (address[] memory _tokens) {\n _tokens = new address[](_jobTokens[_job].length());\n for (uint256 i; i < _jobTokens[_job].length(); i++) {\n _tokens[i] = _jobTokens[_job].at(i);\n }\n }\n\n function internalJobLiquidities(address _job) external view returns (address[] memory _tokens) {\n _tokens = new address[](_jobLiquidities[_job].length());\n for (uint256 i; i < _jobLiquidities[_job].length(); i++) {\n _tokens[i] = _jobLiquidities[_job].at(i);\n }\n }\n}\n" - }, - "solidity/for-test/peripherals/Keep3rDisputableForTest.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../../contracts/peripherals/Keep3rDisputable.sol';\n\ncontract Keep3rDisputableForTest is Keep3rDisputable {\n constructor() Keep3rParameters(address(0), address(0), address(0)) Keep3rRoles(msg.sender) {}\n}\n" - }, - "solidity/for-test/peripherals/keepers/Keep3rKeeperDisputableForTest.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../../../contracts/peripherals/keepers/Keep3rKeeperDisputable.sol';\n\ncontract Keep3rKeeperDisputableForTest is Keep3rKeeperDisputable {\n using EnumerableSet for EnumerableSet.AddressSet;\n\n constructor(\n address _kph,\n address _keep3rV1,\n address _keep3rV1Proxy\n ) Keep3rParameters(_kph, _keep3rV1, _keep3rV1Proxy) Keep3rRoles(msg.sender) {}\n\n function setKeeper(address _keeper) external {\n _keepers.add(_keeper);\n }\n\n function internalSlash(\n address _bonded,\n address _keeper,\n uint256 _bondAmount,\n uint256 _unbondAmount\n ) external {\n _slash(_bonded, _keeper, _bondAmount, _unbondAmount);\n }\n\n function isKeeper(address _address) external view returns (bool _isKeeper) {\n _isKeeper = _keepers.contains(_address);\n }\n}\n" - }, - "solidity/for-test/peripherals/jobs/Keep3rJobFundableCreditsForTest.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../../../contracts/peripherals/jobs/Keep3rJobFundableCredits.sol';\n\ncontract Keep3rJobFundableCreditsForTest is Keep3rJobFundableCredits {\n using EnumerableSet for EnumerableSet.AddressSet;\n\n constructor(\n address _kph,\n address _keep3rV1,\n address _keep3rV1Proxy\n ) Keep3rParameters(_kph, _keep3rV1, _keep3rV1Proxy) Keep3rRoles(msg.sender) {}\n\n function setJob(address _job, address _jobOwner) external {\n _jobs.add(_job);\n jobOwner[_job] = _jobOwner;\n }\n\n function setJobToken(address _job, address _token) external {\n _jobTokens[_job].add(_token);\n }\n\n function isJobToken(address _job, address _token) external view returns (bool _contains) {\n _contains = _jobTokens[_job].contains(_token);\n }\n}\n" - }, - "solidity/contracts/Keep3rHelper.sol": { - "content": "// SPDX-License-Identifier: MIT\n\n/*\n\nCoded for The Keep3r Network with ♥ by\n\n██████╗░███████╗███████╗██╗  ░██╗░░░░░░░██╗░█████╗░███╗░░██╗██████╗░███████╗██████╗░██╗░░░░░░█████╗░███╗░░██╗██████╗░\n██╔══██╗██╔════╝██╔════╝██║  ░██║░░██╗░░██║██╔══██╗████╗░██║██╔══██╗██╔════╝██╔══██╗██║░░░░░██╔══██╗████╗░██║██╔══██╗\n██║░░██║█████╗░░█████╗░░██║  ░╚██╗████╗██╔╝██║░░██║██╔██╗██║██║░░██║█████╗░░██████╔╝██║░░░░░███████║██╔██╗██║██║░░██║\n██║░░██║██╔══╝░░██╔══╝░░██║  ░░████╔═████║░██║░░██║██║╚████║██║░░██║██╔══╝░░██╔══██╗██║░░░░░██╔══██║██║╚████║██║░░██║\n██████╔╝███████╗██║░░░░░██║  ░░╚██╔╝░╚██╔╝░╚█████╔╝██║░╚███║██████╔╝███████╗██║░░██║███████╗██║░░██║██║░╚███║██████╔╝\n╚═════╝░╚══════╝╚═╝░░░░░╚═╝  ░░░╚═╝░░░╚═╝░░░╚════╝░╚═╝░░╚══╝╚═════╝░╚══════╝╚═╝░░╚═╝╚══════╝╚═╝░░╚═╝╚═╝░░╚══╝╚═════╝░\n\nhttps://defi.sucks\n\n*/\n\npragma solidity >=0.8.7 <0.9.0;\n\nimport './libraries/FullMath.sol';\nimport './libraries/TickMath.sol';\nimport '../interfaces/IKeep3r.sol';\nimport '../interfaces/IKeep3rHelper.sol';\nimport './Keep3rHelperParameters.sol';\n\nimport '@openzeppelin/contracts/utils/math/Math.sol';\nimport '@uniswap/v3-core/contracts/interfaces/IUniswapV3Pool.sol';\n\ncontract Keep3rHelper is IKeep3rHelper, Keep3rHelperParameters {\n constructor(\n address _kp3r,\n address _keep3rV2,\n address _governance,\n address _kp3rWethPool\n ) Keep3rHelperParameters(_kp3r, _keep3rV2, _governance, _kp3rWethPool) {}\n\n /// @inheritdoc IKeep3rHelper\n function quote(uint256 _eth) public view override returns (uint256 _amountOut) {\n uint32[] memory _secondsAgos = new uint32[](2);\n _secondsAgos[1] = quoteTwapTime;\n\n (int56[] memory _tickCumulatives, ) = IUniswapV3Pool(kp3rWethPool.poolAddress).observe(_secondsAgos);\n int56 _difference = _tickCumulatives[0] - _tickCumulatives[1];\n _amountOut = getQuoteAtTick(uint128(_eth), kp3rWethPool.isTKNToken0 ? _difference : -_difference, quoteTwapTime);\n }\n\n /// @inheritdoc IKeep3rHelper\n function bonds(address _keeper) public view virtual override returns (uint256 _amountBonded) {\n return IKeep3r(keep3rV2).bonds(_keeper, KP3R);\n }\n\n /// @inheritdoc IKeep3rHelper\n function getRewardAmountFor(address _keeper, uint256 _gasUsed) public view override returns (uint256 _kp3r) {\n uint256 _boost = getRewardBoostFor(bonds(_keeper));\n _kp3r = quote((_gasUsed * _boost) / BOOST_BASE);\n }\n\n /// @inheritdoc IKeep3rHelper\n function getRewardAmount(uint256 _gasUsed) external view override returns (uint256 _amount) {\n // solhint-disable-next-line avoid-tx-origin\n return getRewardAmountFor(tx.origin, _gasUsed);\n }\n\n /// @inheritdoc IKeep3rHelper\n function getRewardBoostFor(uint256 _bonds) public view override returns (uint256 _rewardBoost) {\n _bonds = Math.min(_bonds, targetBond);\n uint256 _cap = minBoost + ((maxBoost - minBoost) * _bonds) / targetBond;\n _rewardBoost = _cap * _getBasefee();\n }\n\n /// @inheritdoc IKeep3rHelper\n function getPoolTokens(address _pool) public view override returns (address _token0, address _token1) {\n return (IUniswapV3Pool(_pool).token0(), IUniswapV3Pool(_pool).token1());\n }\n\n /// @inheritdoc IKeep3rHelper\n function isKP3RToken0(address _pool) external view virtual override returns (bool _isKP3RToken0) {\n address _token0;\n address _token1;\n (_token0, _token1) = getPoolTokens(_pool);\n if (_token0 == KP3R) {\n return true;\n } else if (_token1 != KP3R) {\n revert LiquidityPairInvalid();\n }\n }\n\n /// @inheritdoc IKeep3rHelper\n function observe(address _pool, uint32[] memory _secondsAgo)\n external\n view\n override\n returns (\n int56 _tickCumulative1,\n int56 _tickCumulative2,\n bool _success\n )\n {\n try IUniswapV3Pool(_pool).observe(_secondsAgo) returns (int56[] memory _uniswapResponse, uint160[] memory) {\n _tickCumulative1 = _uniswapResponse[0];\n if (_uniswapResponse.length > 1) {\n _tickCumulative2 = _uniswapResponse[1];\n }\n _success = true;\n } catch (bytes memory) {}\n }\n\n /// @inheritdoc IKeep3rHelper\n function getPaymentParams(uint256 _bonds)\n external\n view\n virtual\n override\n returns (\n uint256 _boost,\n uint256 _oneEthQuote,\n uint256 _extra\n )\n {\n _oneEthQuote = quote(1 ether);\n _boost = getRewardBoostFor(_bonds);\n _extra = workExtraGas;\n }\n\n /// @inheritdoc IKeep3rHelper\n function getKP3RsAtTick(\n uint256 _liquidityAmount,\n int56 _tickDifference,\n uint256 _timeInterval\n ) external pure override returns (uint256 _kp3rAmount) {\n uint160 sqrtRatioX96 = TickMath.getSqrtRatioAtTick(int24(_tickDifference / int256(_timeInterval)));\n _kp3rAmount = FullMath.mulDiv(1 << 96, _liquidityAmount, sqrtRatioX96);\n }\n\n /// @inheritdoc IKeep3rHelper\n function getQuoteAtTick(\n uint128 _baseAmount,\n int56 _tickDifference,\n uint256 _timeInterval\n ) public pure override returns (uint256 _quoteAmount) {\n uint160 sqrtRatioX96 = TickMath.getSqrtRatioAtTick(int24(_tickDifference / int256(_timeInterval)));\n\n if (sqrtRatioX96 <= type(uint128).max) {\n uint256 ratioX192 = uint256(sqrtRatioX96) * sqrtRatioX96;\n _quoteAmount = FullMath.mulDiv(1 << 192, _baseAmount, ratioX192);\n } else {\n uint256 ratioX128 = FullMath.mulDiv(sqrtRatioX96, sqrtRatioX96, 1 << 64);\n _quoteAmount = FullMath.mulDiv(1 << 128, _baseAmount, ratioX128);\n }\n }\n\n /// @notice Gets the gas basefee cost to calculate keeper rewards\n /// @dev Keepers are required to pay a priority fee to be included, this function recognizes a minimum priority fee\n /// @return _baseFee The block's basefee + a minimum priority fee, or a preset minimum gas fee\n function _getBasefee() internal view virtual returns (uint256 _baseFee) {\n return Math.max(minBaseFee, block.basefee + minPriorityFee);\n }\n}\n" - }, - "solidity/for-test/testnet/Keep3rHelperForTestnet.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../../contracts/Keep3rHelper.sol';\n\ncontract Keep3rHelperForTestnet is Keep3rHelper {\n constructor(\n address _kp3r,\n address _keep3rV2,\n address _governance,\n address _kp3rWethPool\n ) Keep3rHelper(_kp3r, _keep3rV2, _governance, _kp3rWethPool) {}\n\n function _getBasefee() internal pure override returns (uint256) {\n return 1;\n }\n}\n" - }, - "solidity/for-test/Keep3rHelperForTest.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../contracts/Keep3rHelper.sol';\n\ncontract Keep3rHelperForTest is Keep3rHelper {\n uint256 public basefee;\n\n constructor(\n address _kp3r,\n address _keep3rV2,\n address _governance,\n address _kp3rWethPool\n ) Keep3rHelper(_kp3r, _keep3rV2, _governance, _kp3rWethPool) {}\n\n function _getBasefee() internal view override returns (uint256) {\n return basefee != 0 ? (basefee + minPriorityFee) : super._getBasefee();\n }\n\n function setBaseFee(uint256 _baseFee) external {\n basefee = _baseFee;\n }\n}\n" - }, - "solidity/contracts/sidechain/Keep3rHelperSidechain.sol": { - "content": "// SPDX-License-Identifier: MIT\n\n/*\n\nCoded for The Keep3r Network with ♥ by\n\n██████╗░███████╗███████╗██╗░░░██╗░░░░░░░██╗░█████╗░███╗░░██╗██████╗░███████╗██████╗░██╗░░░░░░█████╗░███╗░░██╗██████╗░\n██╔══██╗██╔════╝██╔════╝██║░░░██║░░██╗░░██║██╔══██╗████╗░██║██╔══██╗██╔════╝██╔══██╗██║░░░░░██╔══██╗████╗░██║██╔══██╗\n██║░░██║█████╗░░█████╗░░██║░░░╚██╗████╗██╔╝██║░░██║██╔██╗██║██║░░██║█████╗░░██████╔╝██║░░░░░███████║██╔██╗██║██║░░██║\n██║░░██║██╔══╝░░██╔══╝░░██║░░░░████╔═████║░██║░░██║██║╚████║██║░░██║██╔══╝░░██╔══██╗██║░░░░░██╔══██║██║╚████║██║░░██║\n██████╔╝███████╗██║░░░░░██║░░░░╚██╔╝░╚██╔╝░╚█████╔╝██║░╚███║██████╔╝███████╗██║░░██║███████╗██║░░██║██║░╚███║██████╔╝\n╚═════╝░╚══════╝╚═╝░░░░░╚═╝░░░░░╚═╝░░░╚═╝░░░╚════╝░╚═╝░░╚══╝╚═════╝░╚══════╝╚═╝░░╚═╝╚══════╝╚═╝░░╚═╝╚═╝░░╚══╝╚═════╝░\n\nhttps://defi.sucks\n\nCommit hash: ead559c8dc4361349b7222741c2399447e255d8e\n\n*/\n\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../Keep3rHelper.sol';\nimport '../../interfaces/sidechain/IKeep3rHelperSidechain.sol';\n\ncontract Keep3rHelperSidechain is IKeep3rHelperSidechain, Keep3rHelper {\n /// @inheritdoc IKeep3rHelperSidechain\n mapping(address => address) public override oracle;\n /// @inheritdoc IKeep3rHelperSidechain\n IKeep3rHelperParameters.TokenOraclePool public override wethUSDPool;\n\n /// @notice Ethereum mainnet WETH address used for quoting references\n address public immutable override WETH;\n\n /// @param _keep3rV2 Address of sidechain Keep3r implementation\n /// @param _governance Address of governance\n /// @param _kp3rWethOracle Address of oracle used for KP3R/WETH quote\n /// @param _wethUsdOracle Address of oracle used for WETH/USD quote\n /// @dev Oracle pools should use 18 decimals tokens\n constructor(\n address _keep3rV2,\n address _governance,\n address _kp3r,\n address _weth,\n address _kp3rWethOracle,\n address _wethUsdOracle\n ) Keep3rHelper(_kp3r, _keep3rV2, _governance, _kp3rWethOracle) {\n WETH = _weth;\n wethUSDPool = _validateOraclePool(_wethUsdOracle, _weth);\n _setQuoteTwapTime(1 days);\n workExtraGas = 0;\n }\n\n /// @inheritdoc IKeep3rHelper\n /// @notice Uses valid wKP3R address from Keep3rSidechain to query keeper bonds\n function bonds(address _keeper) public view override(Keep3rHelper, IKeep3rHelper) returns (uint256 _amountBonded) {\n address wKP3R = IKeep3r(keep3rV2).keep3rV1();\n return IKeep3r(keep3rV2).bonds(_keeper, wKP3R);\n }\n\n /// @inheritdoc IKeep3rHelperSidechain\n function setOracle(address _liquidity, address _oracle) external override onlyGovernance {\n if (_liquidity == address(0) || _oracle == address(0)) revert ZeroAddress();\n oracle[_liquidity] = _oracle;\n emit OracleSet(_liquidity, _oracle);\n }\n\n /// @inheritdoc IKeep3rHelperSidechain\n function quoteUsdToEth(uint256 _usd) public view virtual override returns (uint256 _amountOut) {\n uint32[] memory _secondsAgos = new uint32[](2);\n _secondsAgos[1] = quoteTwapTime;\n\n /// @dev Oracle is compatible with IUniswapV3Pool\n (int56[] memory _tickCumulatives, ) = IUniswapV3Pool(wethUSDPool.poolAddress).observe(_secondsAgos);\n int56 _difference = _tickCumulatives[0] - _tickCumulatives[1];\n _amountOut = getQuoteAtTick(uint128(_usd), wethUSDPool.isTKNToken0 ? _difference : -_difference, quoteTwapTime);\n }\n\n /// @inheritdoc IKeep3rHelperSidechain\n function setWethUsdPool(address _poolAddress) external override onlyGovernance {\n if (_poolAddress == address(0)) revert ZeroAddress();\n _setWethUsdPool(_poolAddress);\n }\n\n /// @inheritdoc IKeep3rHelper\n function getPaymentParams(uint256 _bonds)\n external\n view\n virtual\n override(Keep3rHelper, IKeep3rHelper)\n returns (\n uint256 _boost,\n uint256 _oneUsdQuote,\n uint256 _extraGas\n )\n {\n _oneUsdQuote = quote(quoteUsdToEth(1 ether));\n _boost = getRewardBoostFor(_bonds);\n _extraGas = workExtraGas;\n }\n\n function _setWethUsdPool(address _poolAddress) internal {\n wethUSDPool = _validateOraclePool(_poolAddress, WETH);\n emit WethUSDPoolChange(wethUSDPool.poolAddress, wethUSDPool.isTKNToken0);\n }\n\n /// @dev Sidechain jobs are quoted by USD/gasUnit, baseFee is set to 1\n function _getBasefee() internal view virtual override returns (uint256 _baseFee) {\n return 1;\n }\n}\n" - }, - "solidity/for-test/peripherals/Keep3rParametersForTest.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../../contracts/peripherals/Keep3rParameters.sol';\n\ncontract Keep3rParametersForTest is Keep3rParameters {\n constructor(\n address _keep3rHelper,\n address _keep3rV1,\n address _keep3rV1Proxy\n ) Keep3rParameters(_keep3rHelper, _keep3rV1, _keep3rV1Proxy) Keep3rRoles(msg.sender) {}\n}\n" - }, - "solidity/for-test/peripherals/jobs/Keep3rJobWorkableForTest.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../../../contracts/peripherals/jobs/Keep3rJobWorkable.sol';\n\ncontract Keep3rJobWorkableForTest is Keep3rJobWorkable {\n using EnumerableSet for EnumerableSet.AddressSet;\n\n constructor(\n address _keep3rHelper,\n address _keep3rV1,\n address _keep3rV1Proxy\n ) Keep3rParameters(_keep3rHelper, _keep3rV1, _keep3rV1Proxy) Keep3rRoles(msg.sender) {}\n\n function setJob(address _job) external {\n _jobs.add(_job);\n }\n\n function setKeeper(address _keeper) external {\n _keepers.add(_keeper);\n }\n\n function setApprovedLiquidity(address _liquidity) external {\n _approvedLiquidities.add(_liquidity);\n }\n\n function setJobLiquidity(address _job, address _liquidity) external {\n _jobLiquidities[_job].add(_liquidity);\n }\n\n function viewJobLiquidityCredits(address _job) external view returns (uint256) {\n return _jobLiquidityCredits[_job];\n }\n\n function viewJobPeriodCredits(address _job) external view returns (uint256) {\n return _jobPeriodCredits[_job];\n }\n\n function viewTickCache(address _liquidity) external view returns (TickCache memory _tickCache) {\n _tickCache = _tick[_liquidity];\n }\n\n function viewGas() external view returns (uint256) {\n return _initialGas;\n }\n}\n" - }, - "solidity/for-test/peripherals/jobs/Keep3rJobMigrationForTest.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../../../contracts/peripherals/jobs/Keep3rJobMigration.sol';\n\ncontract Keep3rJobMigrationForTest is Keep3rJobMigration {\n using EnumerableSet for EnumerableSet.AddressSet;\n\n mapping(address => uint256) public settleJobAccountanceCallCount;\n\n constructor(\n address _kph,\n address _keep3rV1,\n address _keep3rV1Proxy\n ) Keep3rParameters(_kph, _keep3rV1, _keep3rV1Proxy) Keep3rRoles(msg.sender) {}\n\n function setJobToken(address _job, address _token) external {\n _jobTokens[_job].add(_token);\n }\n\n function setJobLiquidity(address _job, address _liquidity) external {\n _jobLiquidities[_job].add(_liquidity);\n }\n\n function viewJobTokenListLength(address _job) external view returns (uint256) {\n return _jobTokens[_job].length();\n }\n\n function viewJobLiquidityList(address _job) external view returns (address[] memory _list) {\n _list = _jobLiquidities[_job].values();\n }\n\n function viewJobPeriodCredits(address _job) external view returns (uint256) {\n return _jobPeriodCredits[_job];\n }\n\n function viewJobLiquidityCredits(address _job) external view returns (uint256) {\n return _jobLiquidityCredits[_job];\n }\n\n function viewMigrationCreatedAt(address _fromJob, address _toJob) external view returns (uint256) {\n return _migrationCreatedAt[_fromJob][_toJob];\n }\n\n function isJob(address _job) external view returns (bool) {\n return _jobs.contains(_job);\n }\n\n function _settleJobAccountance(address _job) internal override {\n settleJobAccountanceCallCount[_job]++;\n }\n}\n" - }, - "solidity/for-test/peripherals/jobs/Keep3rJobManagerForTest.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../../../contracts/peripherals/jobs/Keep3rJobManager.sol';\n\ncontract Keep3rJobManagerForTest is Keep3rJobManager {\n using EnumerableSet for EnumerableSet.AddressSet;\n\n constructor(\n address _keep3rHelper,\n address _keep3rV1,\n address _keep3rV1Proxy\n ) Keep3rRoles(msg.sender) {}\n\n function isJob(address _job) external view returns (bool _isJob) {\n _isJob = _jobs.contains(_job);\n }\n}\n" - }, - "solidity/for-test/peripherals/jobs/Keep3rJobOwnershipForTest.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../../../contracts/peripherals/jobs/Keep3rJobOwnership.sol';\n\ncontract Keep3rJobOwnershipForTest is Keep3rJobOwnership {}\n" - }, - "solidity/for-test/libraries/LiquidityAmountsForTest.sol": { - "content": "// SPDX-License-Identifier: GPL-2.0-or-later\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../../contracts/libraries/FullMath.sol';\nimport '../../contracts/libraries/FixedPoint96.sol';\n\n/// @dev Made this library into a contract to be able to calculate liquidity more precisely for tests\n\n// solhint-disable\ncontract LiquidityAmountsForTest {\n function toUint128(uint256 x) private pure returns (uint128 y) {\n require((y = uint128(x)) == x);\n }\n\n function getLiquidityForAmount0(\n uint160 sqrtRatioAX96,\n uint160 sqrtRatioBX96,\n uint256 amount0\n ) public pure returns (uint128 liquidity) {\n if (sqrtRatioAX96 > sqrtRatioBX96) (sqrtRatioAX96, sqrtRatioBX96) = (sqrtRatioBX96, sqrtRatioAX96);\n uint256 intermediate = FullMath.mulDiv(sqrtRatioAX96, sqrtRatioBX96, FixedPoint96.Q96);\n return toUint128(FullMath.mulDiv(amount0, intermediate, sqrtRatioBX96 - sqrtRatioAX96));\n }\n\n function getLiquidityForAmount1(\n uint160 sqrtRatioAX96,\n uint160 sqrtRatioBX96,\n uint256 amount1\n ) public pure returns (uint128 liquidity) {\n if (sqrtRatioAX96 > sqrtRatioBX96) (sqrtRatioAX96, sqrtRatioBX96) = (sqrtRatioBX96, sqrtRatioAX96);\n return toUint128(FullMath.mulDiv(amount1, FixedPoint96.Q96, sqrtRatioBX96 - sqrtRatioAX96));\n }\n\n function getLiquidityForAmounts(\n uint160 sqrtRatioX96,\n uint160 sqrtRatioAX96,\n uint160 sqrtRatioBX96,\n uint256 amount0,\n uint256 amount1\n ) external pure returns (uint128 liquidity) {\n if (sqrtRatioAX96 > sqrtRatioBX96) (sqrtRatioAX96, sqrtRatioBX96) = (sqrtRatioBX96, sqrtRatioAX96);\n\n if (sqrtRatioX96 <= sqrtRatioAX96) {\n liquidity = getLiquidityForAmount0(sqrtRatioAX96, sqrtRatioBX96, amount0);\n } else if (sqrtRatioX96 < sqrtRatioBX96) {\n uint128 liquidity0 = getLiquidityForAmount0(sqrtRatioX96, sqrtRatioBX96, amount0);\n uint128 liquidity1 = getLiquidityForAmount1(sqrtRatioAX96, sqrtRatioX96, amount1);\n\n liquidity = liquidity0 < liquidity1 ? liquidity0 : liquidity1;\n } else {\n liquidity = getLiquidityForAmount1(sqrtRatioAX96, sqrtRatioBX96, amount1);\n }\n }\n\n function getAmount0ForLiquidity(\n uint160 sqrtRatioAX96,\n uint160 sqrtRatioBX96,\n uint128 liquidity\n ) public pure returns (uint256 amount0) {\n if (sqrtRatioAX96 > sqrtRatioBX96) (sqrtRatioAX96, sqrtRatioBX96) = (sqrtRatioBX96, sqrtRatioAX96);\n\n return FullMath.mulDiv(uint256(liquidity) << FixedPoint96.RESOLUTION, sqrtRatioBX96 - sqrtRatioAX96, sqrtRatioBX96) / sqrtRatioAX96;\n }\n\n function getAmount1ForLiquidity(\n uint160 sqrtRatioAX96,\n uint160 sqrtRatioBX96,\n uint128 liquidity\n ) public pure returns (uint256 amount1) {\n if (sqrtRatioAX96 > sqrtRatioBX96) (sqrtRatioAX96, sqrtRatioBX96) = (sqrtRatioBX96, sqrtRatioAX96);\n\n return FullMath.mulDiv(liquidity, sqrtRatioBX96 - sqrtRatioAX96, FixedPoint96.Q96);\n }\n\n function getAmountsForLiquidity(\n uint160 sqrtRatioX96,\n uint160 sqrtRatioAX96,\n uint160 sqrtRatioBX96,\n uint128 liquidity\n ) external pure returns (uint256 amount0, uint256 amount1) {\n if (sqrtRatioAX96 > sqrtRatioBX96) (sqrtRatioAX96, sqrtRatioBX96) = (sqrtRatioBX96, sqrtRatioAX96);\n\n if (sqrtRatioX96 <= sqrtRatioAX96) {\n amount0 = getAmount0ForLiquidity(sqrtRatioAX96, sqrtRatioBX96, liquidity);\n } else if (sqrtRatioX96 < sqrtRatioBX96) {\n amount0 = getAmount0ForLiquidity(sqrtRatioX96, sqrtRatioBX96, liquidity);\n amount1 = getAmount1ForLiquidity(sqrtRatioAX96, sqrtRatioX96, liquidity);\n } else {\n amount1 = getAmount1ForLiquidity(sqrtRatioAX96, sqrtRatioBX96, liquidity);\n }\n }\n}\n" - }, - "solidity/for-test/IUniswapV3PoolForTest.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '@uniswap/v3-core/contracts/interfaces/IERC20Minimal.sol';\nimport '@uniswap/v3-core/contracts/interfaces/IUniswapV3Pool.sol';\n\n// solhint-disable-next-line no-empty-blocks\ninterface IUniswapV3PoolForTest is IERC20Minimal, IUniswapV3Pool {\n\n}\n" - }, - "@uniswap/v3-core/contracts/interfaces/IERC20Minimal.sol": { - "content": "// SPDX-License-Identifier: GPL-2.0-or-later\npragma solidity >=0.5.0;\n\n/// @title Minimal ERC20 interface for Uniswap\n/// @notice Contains a subset of the full ERC20 interface that is used in Uniswap V3\ninterface IERC20Minimal {\n /// @notice Returns the balance of a token\n /// @param account The account for which to look up the number of tokens it has, i.e. its balance\n /// @return The number of tokens held by the account\n function balanceOf(address account) external view returns (uint256);\n\n /// @notice Transfers the amount of token from the `msg.sender` to the recipient\n /// @param recipient The account that will receive the amount transferred\n /// @param amount The number of tokens to send from the sender to the recipient\n /// @return Returns true for a successful transfer, false for an unsuccessful transfer\n function transfer(address recipient, uint256 amount) external returns (bool);\n\n /// @notice Returns the current allowance given to a spender by an owner\n /// @param owner The account of the token owner\n /// @param spender The account of the token spender\n /// @return The current allowance granted by `owner` to `spender`\n function allowance(address owner, address spender) external view returns (uint256);\n\n /// @notice Sets the allowance of a spender from the `msg.sender` to the value `amount`\n /// @param spender The account which will be allowed to spend a given amount of the owners tokens\n /// @param amount The amount of tokens allowed to be used by `spender`\n /// @return Returns true for a successful approval, false for unsuccessful\n function approve(address spender, uint256 amount) external returns (bool);\n\n /// @notice Transfers `amount` tokens from `sender` to `recipient` up to the allowance given to the `msg.sender`\n /// @param sender The account from which the transfer will be initiated\n /// @param recipient The recipient of the transfer\n /// @param amount The amount of the transfer\n /// @return Returns true for a successful transfer, false for unsuccessful\n function transferFrom(\n address sender,\n address recipient,\n uint256 amount\n ) external returns (bool);\n\n /// @notice Event emitted when tokens are transferred from one address to another, either via `#transfer` or `#transferFrom`.\n /// @param from The account from which the tokens were sent, i.e. the balance decreased\n /// @param to The account to which the tokens were sent, i.e. the balance increased\n /// @param value The amount of tokens that were transferred\n event Transfer(address indexed from, address indexed to, uint256 value);\n\n /// @notice Event emitted when the approval amount for the spender of a given owner's tokens changes.\n /// @param owner The account that approved spending of its tokens\n /// @param spender The account for which the spending allowance was modified\n /// @param value The new allowance from the owner to the spender\n event Approval(address indexed owner, address indexed spender, uint256 value);\n}\n" - } - }, - "settings": { - "optimizer": { - "enabled": true, - "runs": 200 - }, - "outputSelection": { - "*": { - "*": [ - "storageLayout", - "abi", - "evm.bytecode", - "evm.deployedBytecode", - "evm.methodIdentifiers", - "metadata", - "devdoc", - "userdoc", - "evm.gasEstimates" - ], - "": [ - "ast" - ] - } - }, - "metadata": { - "useLiteralContent": true - }, - "libraries": { - "": { - "__CACHE_BREAKER__": "0x00000000d41867734bbee4c6863d9255b2b06ac1" - } - } - } -} \ No newline at end of file diff --git a/deployments/optimisticGoerli/.chainId b/deployments/optimisticGoerli/.chainId deleted file mode 100644 index 1e59c84..0000000 --- a/deployments/optimisticGoerli/.chainId +++ /dev/null @@ -1 +0,0 @@ -420 \ No newline at end of file diff --git a/deployments/optimisticGoerli/BasicJob.json b/deployments/optimisticGoerli/BasicJob.json deleted file mode 100644 index 8705da1..0000000 --- a/deployments/optimisticGoerli/BasicJob.json +++ /dev/null @@ -1,154 +0,0 @@ -{ - "address": "0x9abB5cfF47b9F604351a6f0730d9fe39Fb620B2b", - "abi": [ - { - "inputs": [ - { - "internalType": "address", - "name": "_keep3r", - "type": "address" - } - ], - "stateMutability": "nonpayable", - "type": "constructor" - }, - { - "inputs": [], - "name": "InvalidKeeper", - "type": "error" - }, - { - "inputs": [], - "name": "keep3r", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "nonce", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "usdPerGasUnit", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "work", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "_factor", - "type": "uint256" - } - ], - "name": "workHard", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - } - ], - "transactionHash": "0xfdc0a295f18e45d3c4c3ec32762d2aa0fdf2c7f2beda4eef821040aca53ce133", - "receipt": { - "to": null, - "from": "0x258b180E741157763236F5277619D71ECf00B906", - "contractAddress": "0x9abB5cfF47b9F604351a6f0730d9fe39Fb620B2b", - "transactionIndex": 0, - "gasUsed": "333540", - "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", - "blockHash": "0x8bb06121b60b56f2b67c5ec7f2a67e691cb6de533ac8f99c326374c7e6f89e08", - "transactionHash": "0xfdc0a295f18e45d3c4c3ec32762d2aa0fdf2c7f2beda4eef821040aca53ce133", - "logs": [], - "blockNumber": 3238239, - "cumulativeGasUsed": "333540", - "status": 1, - "byzantium": true - }, - "args": [ - "0x85063437C02Ba7F4f82F898859e4992380DEd3bb" - ], - "numDeployments": 2, - "solcInputHash": "f7e3e740337524d02345ab2e7585c15c", - "metadata": "{\"compiler\":{\"version\":\"0.8.7+commit.e28d00a7\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_keep3r\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"inputs\":[],\"name\":\"InvalidKeeper\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"keep3r\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"nonce\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"usdPerGasUnit\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"work\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_factor\",\"type\":\"uint256\"}],\"name\":\"workHard\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"}],\"devdoc\":{\"kind\":\"dev\",\"methods\":{},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{},\"version\":1}},\"settings\":{\"compilationTarget\":{\"solidity/for-test/JobRatedForTest.sol\":\"JobRatedForTest\"},\"evmVersion\":\"london\",\"libraries\":{\":__CACHE_BREAKER__\":\"0x00000000d41867734bbee4c6863d9255b2b06ac1\"},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":33},\"remappings\":[]},\"sources\":{\"solidity/for-test/JobRatedForTest.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4 <0.9.0;\\n\\nimport '../interfaces/IKeep3r.sol';\\nimport '../interfaces/sidechain/IKeep3rJobWorkableRated.sol';\\n\\ncontract JobRatedForTest {\\n error InvalidKeeper();\\n address public keep3r;\\n uint256 public nonce;\\n uint256 public usdPerGasUnit = 1;\\n\\n constructor(address _keep3r) {\\n keep3r = _keep3r;\\n }\\n\\n function work() external {\\n if (!IKeep3r(keep3r).isKeeper(msg.sender)) revert InvalidKeeper();\\n\\n for (uint256 i = 0; i < 1000; i++) {\\n nonce++;\\n }\\n\\n IKeep3rJobWorkableRated(keep3r).worked(msg.sender, usdPerGasUnit);\\n }\\n\\n function workHard(uint256 _factor) external {\\n if (!IKeep3r(keep3r).isKeeper(msg.sender)) revert InvalidKeeper();\\n\\n for (uint256 i = 0; i < 1000 * _factor; i++) {\\n nonce++;\\n }\\n\\n IKeep3rJobWorkableRated(keep3r).worked(msg.sender, usdPerGasUnit);\\n }\\n}\\n\",\"keccak256\":\"0x235a0959e11d21a0d729be34f808b1648d0654c5d6f3893806cba610a1f8473a\",\"license\":\"MIT\"},\"solidity/interfaces/IKeep3r.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4 <0.9.0;\\n\\nimport './peripherals/IKeep3rJobs.sol';\\nimport './peripherals/IKeep3rKeepers.sol';\\nimport './peripherals/IKeep3rParameters.sol';\\n\\n// solhint-disable-next-line no-empty-blocks\\n\\n/// @title Keep3rV2 contract\\n/// @notice This contract inherits all the functionality of Keep3rV2\\ninterface IKeep3r is IKeep3rJobs, IKeep3rKeepers, IKeep3rParameters {\\n\\n}\\n\",\"keccak256\":\"0x273a39984c1475c60182e636bb91a1b89ec98646a036cac6a87067869b3adeb9\",\"license\":\"MIT\"},\"solidity/interfaces/peripherals/IBaseErrors.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity >=0.8.4 <0.9.0;\\n\\ninterface IBaseErrors {\\n /// @notice Throws if a variable is assigned to the zero address\\n error ZeroAddress();\\n}\\n\",\"keccak256\":\"0x9130019a08d9eaedfb920a323fed5c7f409736cd918f1a32921c93551b3ee00e\",\"license\":\"MIT\"},\"solidity/interfaces/peripherals/IDustCollector.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity >=0.8.4 <0.9.0;\\n\\nimport './IBaseErrors.sol';\\n\\ninterface IDustCollector is IBaseErrors {\\n /// @notice Emitted when dust is sent\\n /// @param _token The token that will be transferred\\n /// @param _amount The amount of the token that will be transferred\\n /// @param _to The address which will receive the funds\\n event DustSent(address _token, uint256 _amount, address _to);\\n\\n /// @notice Allows an authorized user to transfer the tokens or eth that may have been left in a contract\\n /// @param _token The token that will be transferred\\n /// @param _amount The amount of the token that will be transferred\\n /// @param _to The address that will receive the idle funds\\n function sendDust(\\n address _token,\\n uint256 _amount,\\n address _to\\n ) external;\\n}\\n\",\"keccak256\":\"0x38dce228111f2a3c6b26ac09c5652c3f1f184c4cfe50d11ff0958ef6a50683bb\",\"license\":\"MIT\"},\"solidity/interfaces/peripherals/IGovernable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4 <0.9.0;\\n\\n/// @title Governable contract\\n/// @notice Manages the governance role\\ninterface IGovernable {\\n // Events\\n\\n /// @notice Emitted when pendingGovernance accepts to be governance\\n /// @param _governance Address of the new governance\\n event GovernanceSet(address _governance);\\n\\n /// @notice Emitted when a new governance is proposed\\n /// @param _pendingGovernance Address that is proposed to be the new governance\\n event GovernanceProposal(address _pendingGovernance);\\n\\n // Errors\\n\\n /// @notice Throws if the caller of the function is not governance\\n error OnlyGovernance();\\n\\n /// @notice Throws if the caller of the function is not pendingGovernance\\n error OnlyPendingGovernance();\\n\\n /// @notice Throws if trying to set governance to zero address\\n error NoGovernanceZeroAddress();\\n\\n // Variables\\n\\n /// @notice Stores the governance address\\n /// @return _governance The governance addresss\\n function governance() external view returns (address _governance);\\n\\n /// @notice Stores the pendingGovernance address\\n /// @return _pendingGovernance The pendingGovernance addresss\\n function pendingGovernance() external view returns (address _pendingGovernance);\\n\\n // Methods\\n\\n /// @notice Proposes a new address to be governance\\n /// @param _governance The address being proposed as the new governance\\n function setGovernance(address _governance) external;\\n\\n /// @notice Changes the governance from the current governance to the previously proposed address\\n function acceptGovernance() external;\\n}\\n\",\"keccak256\":\"0x3284624b2479bbf97c821f37c93a096dcb869b30bbf9b20d30d1800f9535452c\",\"license\":\"MIT\"},\"solidity/interfaces/peripherals/IKeep3rAccountance.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4 <0.9.0;\\n\\nimport './IKeep3rRoles.sol';\\n\\n/// @title Keep3rDisputable contract\\n/// @notice Disputes keepers, or if they're already disputed, it can resolve the case\\n/// @dev Argument `bonding` can be the address of either a token or a liquidity\\ninterface IKeep3rAccountance is IKeep3rRoles {\\n // Events\\n\\n /// @notice Emitted when the bonding process of a new keeper begins\\n /// @param _keeper The caller of Keep3rKeeperFundable#bond function\\n /// @param _bonding The asset the keeper has bonded\\n /// @param _amount The amount the keeper has bonded\\n event Bonding(address indexed _keeper, address indexed _bonding, uint256 _amount);\\n\\n /// @notice Emitted when a keeper or job begins the unbonding process to withdraw the funds\\n /// @param _keeperOrJob The keeper or job that began the unbonding process\\n /// @param _unbonding The liquidity pair or asset being unbonded\\n /// @param _amount The amount being unbonded\\n event Unbonding(address indexed _keeperOrJob, address indexed _unbonding, uint256 _amount);\\n\\n // Variables\\n\\n /// @notice Tracks the total amount of bonded KP3Rs in the contract\\n /// @return _totalBonds The total amount of bonded KP3Rs in the contract\\n function totalBonds() external view returns (uint256 _totalBonds);\\n\\n /// @notice Tracks the total KP3R earnings of a keeper since it started working\\n /// @param _keeper The address of the keeper\\n /// @return _workCompleted Total KP3R earnings of a keeper since it started working\\n function workCompleted(address _keeper) external view returns (uint256 _workCompleted);\\n\\n /// @notice Tracks when a keeper was first registered\\n /// @param _keeper The address of the keeper\\n /// @return timestamp The time at which the keeper was first registered\\n function firstSeen(address _keeper) external view returns (uint256 timestamp);\\n\\n /// @notice Tracks if a keeper or job has a pending dispute\\n /// @param _keeperOrJob The address of the keeper or job\\n /// @return _disputed Whether a keeper or job has a pending dispute\\n function disputes(address _keeperOrJob) external view returns (bool _disputed);\\n\\n /// @notice Tracks how much a keeper has bonded of a certain token\\n /// @param _keeper The address of the keeper\\n /// @param _bond The address of the token being bonded\\n /// @return _bonds Amount of a certain token that a keeper has bonded\\n function bonds(address _keeper, address _bond) external view returns (uint256 _bonds);\\n\\n /// @notice The current token credits available for a job\\n /// @param _job The address of the job\\n /// @param _token The address of the token bonded\\n /// @return _amount The amount of token credits available for a job\\n function jobTokenCredits(address _job, address _token) external view returns (uint256 _amount);\\n\\n /// @notice Tracks the amount of assets deposited in pending bonds\\n /// @param _keeper The address of the keeper\\n /// @param _bonding The address of the token being bonded\\n /// @return _pendingBonds Amount of a certain asset a keeper has unbonding\\n function pendingBonds(address _keeper, address _bonding) external view returns (uint256 _pendingBonds);\\n\\n /// @notice Tracks when a bonding for a keeper can be activated\\n /// @param _keeper The address of the keeper\\n /// @param _bonding The address of the token being bonded\\n /// @return _timestamp Time at which the bonding for a keeper can be activated\\n function canActivateAfter(address _keeper, address _bonding) external view returns (uint256 _timestamp);\\n\\n /// @notice Tracks when keeper bonds are ready to be withdrawn\\n /// @param _keeper The address of the keeper\\n /// @param _bonding The address of the token being unbonded\\n /// @return _timestamp Time at which the keeper bonds are ready to be withdrawn\\n function canWithdrawAfter(address _keeper, address _bonding) external view returns (uint256 _timestamp);\\n\\n /// @notice Tracks how much keeper bonds are to be withdrawn\\n /// @param _keeper The address of the keeper\\n /// @param _bonding The address of the token being unbonded\\n /// @return _pendingUnbonds The amount of keeper bonds that are to be withdrawn\\n function pendingUnbonds(address _keeper, address _bonding) external view returns (uint256 _pendingUnbonds);\\n\\n /// @notice Checks whether the address has ever bonded an asset\\n /// @param _keeper The address of the keeper\\n /// @return _hasBonded Whether the address has ever bonded an asset\\n function hasBonded(address _keeper) external view returns (bool _hasBonded);\\n\\n // Methods\\n\\n /// @notice Lists all jobs\\n /// @return _jobList Array with all the jobs in _jobs\\n function jobs() external view returns (address[] memory _jobList);\\n\\n /// @notice Lists all keepers\\n /// @return _keeperList Array with all the keepers in _keepers\\n function keepers() external view returns (address[] memory _keeperList);\\n\\n // Errors\\n\\n /// @notice Throws when an address is passed as a job, but that address is not a job\\n error JobUnavailable();\\n\\n /// @notice Throws when an action that requires an undisputed job is applied on a disputed job\\n error JobDisputed();\\n}\\n\",\"keccak256\":\"0xf4748c236ddf409e45e7169c735e2fc54e627b2b3ccd189ebb438ad768f1deb1\",\"license\":\"MIT\"},\"solidity/interfaces/peripherals/IKeep3rDisputable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4 <0.9.0;\\n\\n/// @title Keep3rDisputable contract\\n/// @notice Creates/resolves disputes for jobs or keepers\\n/// A disputed keeper is slashable and is not able to bond, activate, withdraw or receive direct payments\\n/// A disputed job is slashable and is not able to pay the keepers, withdraw tokens or to migrate\\ninterface IKeep3rDisputable {\\n /// @notice Emitted when a keeper or a job is disputed\\n /// @param _jobOrKeeper The address of the disputed keeper/job\\n /// @param _disputer The user that called the function and disputed the keeper\\n event Dispute(address indexed _jobOrKeeper, address indexed _disputer);\\n\\n /// @notice Emitted when a dispute is resolved\\n /// @param _jobOrKeeper The address of the disputed keeper/job\\n /// @param _resolver The user that called the function and resolved the dispute\\n event Resolve(address indexed _jobOrKeeper, address indexed _resolver);\\n\\n /// @notice Throws when a job or keeper is already disputed\\n error AlreadyDisputed();\\n\\n /// @notice Throws when a job or keeper is not disputed and someone tries to resolve the dispute\\n error NotDisputed();\\n\\n /// @notice Allows governance to create a dispute for a given keeper/job\\n /// @param _jobOrKeeper The address in dispute\\n function dispute(address _jobOrKeeper) external;\\n\\n /// @notice Allows governance to resolve a dispute on a keeper/job\\n /// @param _jobOrKeeper The address cleared\\n function resolve(address _jobOrKeeper) external;\\n}\\n\",\"keccak256\":\"0x002b9b4c75e62d48d74b6447649d39eb5c1e128d2523bb11e08e9cd3e27b1f70\",\"license\":\"MIT\"},\"solidity/interfaces/peripherals/IKeep3rJobs.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4 <0.9.0;\\n\\nimport './IKeep3rDisputable.sol';\\n\\n/// @title Keep3rJobOwnership contract\\n/// @notice Handles the ownership of the jobs\\ninterface IKeep3rJobOwnership {\\n // Events\\n\\n /// @notice Emitted when Keep3rJobOwnership#changeJobOwnership is called\\n /// @param _job The address of the job proposed to have a change of owner\\n /// @param _owner The current owner of the job\\n /// @param _pendingOwner The new address proposed to be the owner of the job\\n event JobOwnershipChange(address indexed _job, address indexed _owner, address indexed _pendingOwner);\\n\\n /// @notice Emitted when Keep3rJobOwnership#JobOwnershipAssent is called\\n /// @param _job The address of the job which the proposed owner will now own\\n /// @param _previousOwner The previous owner of the job\\n /// @param _newOwner The new owner of the job\\n event JobOwnershipAssent(address indexed _job, address indexed _previousOwner, address indexed _newOwner);\\n\\n // Errors\\n\\n /// @notice Throws when the caller of the function is not the job owner\\n error OnlyJobOwner();\\n\\n /// @notice Throws when the caller of the function is not the pending job owner\\n error OnlyPendingJobOwner();\\n\\n // Variables\\n\\n /// @notice Maps the job to the owner of the job\\n /// @param _job The address of the job\\n /// @return _owner The address of the owner of the job\\n function jobOwner(address _job) external view returns (address _owner);\\n\\n /// @notice Maps the job to its pending owner\\n /// @param _job The address of the job\\n /// @return _pendingOwner The address of the pending owner of the job\\n function jobPendingOwner(address _job) external view returns (address _pendingOwner);\\n\\n // Methods\\n\\n /// @notice Proposes a new address to be the owner of the job\\n /// @param _job The address of the job\\n /// @param _newOwner The address of the proposed new owner\\n function changeJobOwnership(address _job, address _newOwner) external;\\n\\n /// @notice The proposed address accepts to be the owner of the job\\n /// @param _job The address of the job\\n function acceptJobOwnership(address _job) external;\\n}\\n\\n/// @title Keep3rJobManager contract\\n/// @notice Handles the addition and withdrawal of credits from a job\\ninterface IKeep3rJobManager is IKeep3rJobOwnership {\\n // Events\\n\\n /// @notice Emitted when Keep3rJobManager#addJob is called\\n /// @param _job The address of the job to add\\n /// @param _jobOwner The job's owner\\n event JobAddition(address indexed _job, address indexed _jobOwner);\\n\\n // Errors\\n\\n /// @notice Throws when trying to add a job that has already been added\\n error JobAlreadyAdded();\\n\\n /// @notice Throws when the address that is trying to register as a keeper is already a keeper\\n error AlreadyAKeeper();\\n\\n // Methods\\n\\n /// @notice Allows any caller to add a new job\\n /// @param _job Address of the contract for which work should be performed\\n function addJob(address _job) external;\\n}\\n\\n/// @title Keep3rJobFundableCredits contract\\n/// @notice Handles the addition and withdrawal of credits from a job\\ninterface IKeep3rJobFundableCredits is IKeep3rJobOwnership {\\n // Events\\n\\n /// @notice Emitted when Keep3rJobFundableCredits#addTokenCreditsToJob is called\\n /// @param _job The address of the job being credited\\n /// @param _token The address of the token being provided\\n /// @param _provider The user that calls the function\\n /// @param _amount The amount of credit being added to the job\\n event TokenCreditAddition(address indexed _job, address indexed _token, address indexed _provider, uint256 _amount);\\n\\n /// @notice Emitted when Keep3rJobFundableCredits#withdrawTokenCreditsFromJob is called\\n /// @param _job The address of the job from which the credits are withdrawn\\n /// @param _token The credit being withdrawn from the job\\n /// @param _receiver The user that receives the tokens\\n /// @param _amount The amount of credit withdrawn\\n event TokenCreditWithdrawal(address indexed _job, address indexed _token, address indexed _receiver, uint256 _amount);\\n\\n // Errors\\n\\n /// @notice Throws when the token is KP3R, as it should not be used for direct token payments\\n error TokenUnallowed();\\n\\n /// @notice Throws when the token withdraw cooldown has not yet passed\\n error JobTokenCreditsLocked();\\n\\n /// @notice Throws when the user tries to withdraw more tokens than it has\\n error InsufficientJobTokenCredits();\\n\\n // Variables\\n\\n /// @notice Last block where tokens were added to the job\\n /// @param _job The address of the job credited\\n /// @param _token The address of the token credited\\n /// @return _timestamp The last block where tokens were added to the job\\n function jobTokenCreditsAddedAt(address _job, address _token) external view returns (uint256 _timestamp);\\n\\n // Methods\\n\\n /// @notice Add credit to a job to be paid out for work\\n /// @param _job The address of the job being credited\\n /// @param _token The address of the token being credited\\n /// @param _amount The amount of credit being added\\n function addTokenCreditsToJob(\\n address _job,\\n address _token,\\n uint256 _amount\\n ) external;\\n\\n /// @notice Withdraw credit from a job\\n /// @param _job The address of the job from which the credits are withdrawn\\n /// @param _token The address of the token being withdrawn\\n /// @param _amount The amount of token to be withdrawn\\n /// @param _receiver The user that will receive tokens\\n function withdrawTokenCreditsFromJob(\\n address _job,\\n address _token,\\n uint256 _amount,\\n address _receiver\\n ) external;\\n}\\n\\n/// @title Keep3rJobFundableLiquidity contract\\n/// @notice Handles the funding of jobs through specific liquidity pairs\\ninterface IKeep3rJobFundableLiquidity is IKeep3rJobOwnership {\\n // Events\\n\\n /// @notice Emitted when Keep3rJobFundableLiquidity#approveLiquidity function is called\\n /// @param _liquidity The address of the liquidity pair being approved\\n event LiquidityApproval(address _liquidity);\\n\\n /// @notice Emitted when Keep3rJobFundableLiquidity#revokeLiquidity function is called\\n /// @param _liquidity The address of the liquidity pair being revoked\\n event LiquidityRevocation(address _liquidity);\\n\\n /// @notice Emitted when IKeep3rJobFundableLiquidity#addLiquidityToJob function is called\\n /// @param _job The address of the job to which liquidity will be added\\n /// @param _liquidity The address of the liquidity being added\\n /// @param _provider The user that calls the function\\n /// @param _amount The amount of liquidity being added\\n event LiquidityAddition(address indexed _job, address indexed _liquidity, address indexed _provider, uint256 _amount);\\n\\n /// @notice Emitted when IKeep3rJobFundableLiquidity#withdrawLiquidityFromJob function is called\\n /// @param _job The address of the job of which liquidity will be withdrawn from\\n /// @param _liquidity The address of the liquidity being withdrawn\\n /// @param _receiver The receiver of the liquidity tokens\\n /// @param _amount The amount of liquidity being withdrawn from the job\\n event LiquidityWithdrawal(address indexed _job, address indexed _liquidity, address indexed _receiver, uint256 _amount);\\n\\n /// @notice Emitted when Keep3rJobFundableLiquidity#addLiquidityToJob function is called\\n /// @param _job The address of the job whose credits will be updated\\n /// @param _rewardedAt The time at which the job was last rewarded\\n /// @param _currentCredits The current credits of the job\\n /// @param _periodCredits The credits of the job for the current period\\n event LiquidityCreditsReward(address indexed _job, uint256 _rewardedAt, uint256 _currentCredits, uint256 _periodCredits);\\n\\n /// @notice Emitted when Keep3rJobFundableLiquidity#forceLiquidityCreditsToJob function is called\\n /// @param _job The address of the job whose credits will be updated\\n /// @param _rewardedAt The time at which the job was last rewarded\\n /// @param _currentCredits The current credits of the job\\n event LiquidityCreditsForced(address indexed _job, uint256 _rewardedAt, uint256 _currentCredits);\\n\\n // Errors\\n\\n /// @notice Throws when the liquidity being approved has already been approved\\n error LiquidityPairApproved();\\n\\n /// @notice Throws when the liquidity being removed has not been approved\\n error LiquidityPairUnexistent();\\n\\n /// @notice Throws when trying to add liquidity to an unapproved pool\\n error LiquidityPairUnapproved();\\n\\n /// @notice Throws when the job doesn't have the requested liquidity\\n error JobLiquidityUnexistent();\\n\\n /// @notice Throws when trying to remove more liquidity than the job has\\n error JobLiquidityInsufficient();\\n\\n /// @notice Throws when trying to add less liquidity than the minimum liquidity required\\n error JobLiquidityLessThanMin();\\n\\n // Structs\\n\\n /// @notice Stores the tick information of the different liquidity pairs\\n struct TickCache {\\n int56 current; // Tracks the current tick\\n int56 difference; // Stores the difference between the current tick and the last tick\\n uint256 period; // Stores the period at which the last observation was made\\n }\\n\\n // Variables\\n\\n /// @notice Lists liquidity pairs\\n /// @return _list An array of addresses with all the approved liquidity pairs\\n function approvedLiquidities() external view returns (address[] memory _list);\\n\\n /// @notice Amount of liquidity in a specified job\\n /// @param _job The address of the job being checked\\n /// @param _liquidity The address of the liquidity we are checking\\n /// @return _amount Amount of liquidity in the specified job\\n function liquidityAmount(address _job, address _liquidity) external view returns (uint256 _amount);\\n\\n /// @notice Last time the job was rewarded liquidity credits\\n /// @param _job The address of the job being checked\\n /// @return _timestamp Timestamp of the last time the job was rewarded liquidity credits\\n function rewardedAt(address _job) external view returns (uint256 _timestamp);\\n\\n /// @notice Last time the job was worked\\n /// @param _job The address of the job being checked\\n /// @return _timestamp Timestamp of the last time the job was worked\\n function workedAt(address _job) external view returns (uint256 _timestamp);\\n\\n // Methods\\n\\n /// @notice Returns the liquidity credits of a given job\\n /// @param _job The address of the job of which we want to know the liquidity credits\\n /// @return _amount The liquidity credits of a given job\\n function jobLiquidityCredits(address _job) external view returns (uint256 _amount);\\n\\n /// @notice Returns the credits of a given job for the current period\\n /// @param _job The address of the job of which we want to know the period credits\\n /// @return _amount The credits the given job has at the current period\\n function jobPeriodCredits(address _job) external view returns (uint256 _amount);\\n\\n /// @notice Calculates the total credits of a given job\\n /// @param _job The address of the job of which we want to know the total credits\\n /// @return _amount The total credits of the given job\\n function totalJobCredits(address _job) external view returns (uint256 _amount);\\n\\n /// @notice Calculates how many credits should be rewarded periodically for a given liquidity amount\\n /// @dev _periodCredits = underlying KP3Rs for given liquidity amount * rewardPeriod / inflationPeriod\\n /// @param _liquidity The address of the liquidity to provide\\n /// @param _amount The amount of liquidity to provide\\n /// @return _periodCredits The amount of KP3R periodically minted for the given liquidity\\n function quoteLiquidity(address _liquidity, uint256 _amount) external view returns (uint256 _periodCredits);\\n\\n /// @notice Observes the current state of the liquidity pair being observed and updates TickCache with the information\\n /// @param _liquidity The address of the liquidity pair being observed\\n /// @return _tickCache The updated TickCache\\n function observeLiquidity(address _liquidity) external view returns (TickCache memory _tickCache);\\n\\n /// @notice Gifts liquidity credits to the specified job\\n /// @param _job The address of the job being credited\\n /// @param _amount The amount of liquidity credits to gift\\n function forceLiquidityCreditsToJob(address _job, uint256 _amount) external;\\n\\n /// @notice Approve a liquidity pair for being accepted in future\\n /// @param _liquidity The address of the liquidity accepted\\n function approveLiquidity(address _liquidity) external;\\n\\n /// @notice Revoke a liquidity pair from being accepted in future\\n /// @param _liquidity The liquidity no longer accepted\\n function revokeLiquidity(address _liquidity) external;\\n\\n /// @notice Allows anyone to fund a job with liquidity\\n /// @param _job The address of the job to assign liquidity to\\n /// @param _liquidity The liquidity being added\\n /// @param _amount The amount of liquidity tokens to add\\n function addLiquidityToJob(\\n address _job,\\n address _liquidity,\\n uint256 _amount\\n ) external;\\n\\n /// @notice Unbond liquidity for a job\\n /// @dev Can only be called by the job's owner\\n /// @param _job The address of the job being unbonded from\\n /// @param _liquidity The liquidity being unbonded\\n /// @param _amount The amount of liquidity being removed\\n function unbondLiquidityFromJob(\\n address _job,\\n address _liquidity,\\n uint256 _amount\\n ) external;\\n\\n /// @notice Withdraw liquidity from a job\\n /// @param _job The address of the job being withdrawn from\\n /// @param _liquidity The liquidity being withdrawn\\n /// @param _receiver The address that will receive the withdrawn liquidity\\n function withdrawLiquidityFromJob(\\n address _job,\\n address _liquidity,\\n address _receiver\\n ) external;\\n}\\n\\n/// @title Keep3rJobMigration contract\\n/// @notice Handles the migration process of jobs to different addresses\\ninterface IKeep3rJobMigration is IKeep3rJobFundableCredits, IKeep3rJobFundableLiquidity {\\n // Events\\n\\n /// @notice Emitted when Keep3rJobMigration#migrateJob function is called\\n /// @param _fromJob The address of the job that requests to migrate\\n /// @param _toJob The address at which the job requests to migrate\\n event JobMigrationRequested(address indexed _fromJob, address _toJob);\\n\\n /// @notice Emitted when Keep3rJobMigration#acceptJobMigration function is called\\n /// @param _fromJob The address of the job that requested to migrate\\n /// @param _toJob The address at which the job had requested to migrate\\n event JobMigrationSuccessful(address _fromJob, address indexed _toJob);\\n\\n // Errors\\n\\n /// @notice Throws when the address of the job that requests to migrate wants to migrate to its same address\\n error JobMigrationImpossible();\\n\\n /// @notice Throws when the _toJob address differs from the address being tracked in the pendingJobMigrations mapping\\n error JobMigrationUnavailable();\\n\\n /// @notice Throws when cooldown between migrations has not yet passed\\n error JobMigrationLocked();\\n\\n // Variables\\n\\n /// @notice Maps the jobs that have requested a migration to the address they have requested to migrate to\\n /// @return _toJob The address to which the job has requested to migrate to\\n function pendingJobMigrations(address _fromJob) external view returns (address _toJob);\\n\\n // Methods\\n\\n /// @notice Initializes the migration process for a job by adding the request to the pendingJobMigrations mapping\\n /// @param _fromJob The address of the job that is requesting to migrate\\n /// @param _toJob The address at which the job is requesting to migrate\\n function migrateJob(address _fromJob, address _toJob) external;\\n\\n /// @notice Completes the migration process for a job\\n /// @dev Unbond/withdraw process doesn't get migrated\\n /// @param _fromJob The address of the job that requested to migrate\\n /// @param _toJob The address to which the job wants to migrate to\\n function acceptJobMigration(address _fromJob, address _toJob) external;\\n}\\n\\n/// @title Keep3rJobWorkable contract\\n/// @notice Handles the mechanisms jobs can pay keepers with along with the restrictions jobs can put on keepers before they can work on jobs\\ninterface IKeep3rJobWorkable is IKeep3rJobMigration {\\n // Events\\n\\n /// @notice Emitted when a keeper is validated before a job\\n /// @param _gasLeft The amount of gas that the transaction has left at the moment of keeper validation\\n event KeeperValidation(uint256 _gasLeft);\\n\\n /// @notice Emitted when a keeper works a job\\n /// @param _credit The address of the asset in which the keeper is paid\\n /// @param _job The address of the job the keeper has worked\\n /// @param _keeper The address of the keeper that has worked the job\\n /// @param _payment The amount that has been paid out to the keeper in exchange for working the job\\n /// @param _gasLeft The amount of gas that the transaction has left at the moment of payment\\n event KeeperWork(address indexed _credit, address indexed _job, address indexed _keeper, uint256 _payment, uint256 _gasLeft);\\n\\n // Errors\\n\\n /// @notice Throws if work method was called without calling isKeeper or isBondedKeeper\\n error GasNotInitialized();\\n\\n /// @notice Throws if the address claiming to be a job is not in the list of approved jobs\\n error JobUnapproved();\\n\\n /// @notice Throws if the amount of funds in the job is less than the payment that must be paid to the keeper that works that job\\n error InsufficientFunds();\\n\\n // Methods\\n\\n /// @notice Confirms if the current keeper is registered\\n /// @dev Can be used for general (non critical) functions\\n /// @param _keeper The keeper being investigated\\n /// @return _isKeeper Whether the address passed as a parameter is a keeper or not\\n function isKeeper(address _keeper) external returns (bool _isKeeper);\\n\\n /// @notice Confirms if the current keeper is registered and has a minimum bond of any asset.\\n /// @dev Should be used for protected functions\\n /// @param _keeper The keeper to check\\n /// @param _bond The bond token being evaluated\\n /// @param _minBond The minimum amount of bonded tokens\\n /// @param _earned The minimum funds earned in the keepers lifetime\\n /// @param _age The minimum keeper age required\\n /// @return _isBondedKeeper Whether the `_keeper` meets the given requirements\\n function isBondedKeeper(\\n address _keeper,\\n address _bond,\\n uint256 _minBond,\\n uint256 _earned,\\n uint256 _age\\n ) external returns (bool _isBondedKeeper);\\n\\n /// @notice Implemented by jobs to show that a keeper performed work\\n /// @dev Automatically calculates the payment for the keeper and pays the keeper with bonded KP3R\\n /// @param _keeper Address of the keeper that performed the work\\n function worked(address _keeper) external;\\n\\n /// @notice Implemented by jobs to show that a keeper performed work\\n /// @dev Pays the keeper that performs the work with KP3R\\n /// @param _keeper Address of the keeper that performed the work\\n /// @param _payment The reward that should be allocated for the job\\n function bondedPayment(address _keeper, uint256 _payment) external;\\n\\n /// @notice Implemented by jobs to show that a keeper performed work\\n /// @dev Pays the keeper that performs the work with a specific token\\n /// @param _token The asset being awarded to the keeper\\n /// @param _keeper Address of the keeper that performed the work\\n /// @param _amount The reward that should be allocated\\n function directTokenPayment(\\n address _token,\\n address _keeper,\\n uint256 _amount\\n ) external;\\n}\\n\\n/// @title Keep3rJobDisputable contract\\n/// @notice Handles the actions that can be taken on a disputed job\\ninterface IKeep3rJobDisputable is IKeep3rDisputable, IKeep3rJobFundableCredits, IKeep3rJobFundableLiquidity {\\n // Events\\n\\n /// @notice Emitted when Keep3rJobDisputable#slashTokenFromJob is called\\n /// @param _job The address of the job from which the token will be slashed\\n /// @param _token The address of the token being slashed\\n /// @param _slasher The user that slashes the token\\n /// @param _amount The amount of the token being slashed\\n event JobSlashToken(address indexed _job, address _token, address indexed _slasher, uint256 _amount);\\n\\n /// @notice Emitted when Keep3rJobDisputable#slashLiquidityFromJob is called\\n /// @param _job The address of the job from which the liquidity will be slashed\\n /// @param _liquidity The address of the liquidity being slashed\\n /// @param _slasher The user that slashes the liquidity\\n /// @param _amount The amount of the liquidity being slashed\\n event JobSlashLiquidity(address indexed _job, address _liquidity, address indexed _slasher, uint256 _amount);\\n\\n // Errors\\n\\n /// @notice Throws when the token trying to be slashed doesn't exist\\n error JobTokenUnexistent();\\n\\n /// @notice Throws when someone tries to slash more tokens than the job has\\n error JobTokenInsufficient();\\n\\n // Methods\\n\\n /// @notice Allows governance or slasher to slash a job specific token\\n /// @param _job The address of the job from which the token will be slashed\\n /// @param _token The address of the token that will be slashed\\n /// @param _amount The amount of the token that will be slashed\\n function slashTokenFromJob(\\n address _job,\\n address _token,\\n uint256 _amount\\n ) external;\\n\\n /// @notice Allows governance or a slasher to slash liquidity from a job\\n /// @param _job The address being slashed\\n /// @param _liquidity The address of the liquidity that will be slashed\\n /// @param _amount The amount of liquidity that will be slashed\\n function slashLiquidityFromJob(\\n address _job,\\n address _liquidity,\\n uint256 _amount\\n ) external;\\n}\\n\\n// solhint-disable-next-line no-empty-blocks\\ninterface IKeep3rJobs is IKeep3rJobWorkable, IKeep3rJobManager, IKeep3rJobDisputable {\\n\\n}\\n\",\"keccak256\":\"0x08915189f1a9484d17a51b7fb343b765b9edba29062bb644af9663af18f03e34\",\"license\":\"MIT\"},\"solidity/interfaces/peripherals/IKeep3rKeepers.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4 <0.9.0;\\n\\nimport './IKeep3rDisputable.sol';\\n\\n/// @title Keep3rKeeperFundable contract\\n/// @notice Handles the actions required to become a keeper\\ninterface IKeep3rKeeperFundable {\\n // Events\\n\\n /// @notice Emitted when Keep3rKeeperFundable#activate is called\\n /// @param _keeper The keeper that has been activated\\n /// @param _bond The asset the keeper has bonded\\n /// @param _amount The amount of the asset the keeper has bonded\\n event Activation(address indexed _keeper, address indexed _bond, uint256 _amount);\\n\\n /// @notice Emitted when Keep3rKeeperFundable#withdraw is called\\n /// @param _keeper The caller of Keep3rKeeperFundable#withdraw function\\n /// @param _bond The asset to withdraw from the bonding pool\\n /// @param _amount The amount of funds withdrawn\\n event Withdrawal(address indexed _keeper, address indexed _bond, uint256 _amount);\\n\\n // Errors\\n\\n /// @notice Throws when the address that is trying to register as a job is already a job\\n error AlreadyAJob();\\n\\n // Methods\\n\\n /// @notice Beginning of the bonding process\\n /// @param _bonding The asset being bonded\\n /// @param _amount The amount of bonding asset being bonded\\n function bond(address _bonding, uint256 _amount) external;\\n\\n /// @notice Beginning of the unbonding process\\n /// @param _bonding The asset being unbonded\\n /// @param _amount Allows for partial unbonding\\n function unbond(address _bonding, uint256 _amount) external;\\n\\n /// @notice End of the bonding process after bonding time has passed\\n /// @param _bonding The asset being activated as bond collateral\\n function activate(address _bonding) external;\\n\\n /// @notice Withdraw funds after unbonding has finished\\n /// @param _bonding The asset to withdraw from the bonding pool\\n function withdraw(address _bonding) external;\\n}\\n\\n/// @title Keep3rKeeperDisputable contract\\n/// @notice Handles the actions that can be taken on a disputed keeper\\ninterface IKeep3rKeeperDisputable is IKeep3rDisputable, IKeep3rKeeperFundable {\\n // Events\\n\\n /// @notice Emitted when Keep3rKeeperDisputable#slash is called\\n /// @param _keeper The address of the slashed keeper\\n /// @param _slasher The user that called Keep3rKeeperDisputable#slash\\n /// @param _amount The amount of credits slashed from the keeper\\n event KeeperSlash(address indexed _keeper, address indexed _slasher, uint256 _amount);\\n\\n /// @notice Emitted when Keep3rKeeperDisputable#revoke is called\\n /// @param _keeper The address of the revoked keeper\\n /// @param _slasher The user that called Keep3rKeeperDisputable#revoke\\n event KeeperRevoke(address indexed _keeper, address indexed _slasher);\\n\\n // Methods\\n\\n /// @notice Allows governance to slash a keeper based on a dispute\\n /// @param _keeper The address being slashed\\n /// @param _bonded The asset being slashed\\n /// @param _bondAmount The bonded amount being slashed\\n /// @param _unbondAmount The pending unbond amount being slashed\\n function slash(\\n address _keeper,\\n address _bonded,\\n uint256 _bondAmount,\\n uint256 _unbondAmount\\n ) external;\\n\\n /// @notice Blacklists a keeper from participating in the network\\n /// @param _keeper The address being slashed\\n function revoke(address _keeper) external;\\n}\\n\\n// solhint-disable-next-line no-empty-blocks\\n\\n/// @title Keep3rKeepers contract\\ninterface IKeep3rKeepers is IKeep3rKeeperDisputable {\\n\\n}\\n\",\"keccak256\":\"0xc95e6bba82a8371c6bd15a8e9d0df91c826b5050b8ee01d913c1c13a4e92a49b\",\"license\":\"MIT\"},\"solidity/interfaces/peripherals/IKeep3rParameters.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4 <0.9.0;\\n\\nimport './IKeep3rAccountance.sol';\\n\\n/// @title Keep3rParameters contract\\n/// @notice Handles and sets all the required parameters for Keep3r\\ninterface IKeep3rParameters is IKeep3rAccountance {\\n // Events\\n\\n /// @notice Emitted when the Keep3rHelper address is changed\\n /// @param _keep3rHelper The address of Keep3rHelper's contract\\n event Keep3rHelperChange(address _keep3rHelper);\\n\\n /// @notice Emitted when the Keep3rV1 address is changed\\n /// @param _keep3rV1 The address of Keep3rV1's contract\\n event Keep3rV1Change(address _keep3rV1);\\n\\n /// @notice Emitted when the Keep3rV1Proxy address is changed\\n /// @param _keep3rV1Proxy The address of Keep3rV1Proxy's contract\\n event Keep3rV1ProxyChange(address _keep3rV1Proxy);\\n\\n /// @notice Emitted when bondTime is changed\\n /// @param _bondTime The new bondTime\\n event BondTimeChange(uint256 _bondTime);\\n\\n /// @notice Emitted when _liquidityMinimum is changed\\n /// @param _liquidityMinimum The new _liquidityMinimum\\n event LiquidityMinimumChange(uint256 _liquidityMinimum);\\n\\n /// @notice Emitted when _unbondTime is changed\\n /// @param _unbondTime The new _unbondTime\\n event UnbondTimeChange(uint256 _unbondTime);\\n\\n /// @notice Emitted when _rewardPeriodTime is changed\\n /// @param _rewardPeriodTime The new _rewardPeriodTime\\n event RewardPeriodTimeChange(uint256 _rewardPeriodTime);\\n\\n /// @notice Emitted when the inflationPeriod is changed\\n /// @param _inflationPeriod The new inflationPeriod\\n event InflationPeriodChange(uint256 _inflationPeriod);\\n\\n /// @notice Emitted when the fee is changed\\n /// @param _fee The new token credits fee\\n event FeeChange(uint256 _fee);\\n\\n // Variables\\n\\n /// @notice Address of Keep3rHelper's contract\\n /// @return _keep3rHelper The address of Keep3rHelper's contract\\n function keep3rHelper() external view returns (address _keep3rHelper);\\n\\n /// @notice Address of Keep3rV1's contract\\n /// @return _keep3rV1 The address of Keep3rV1's contract\\n function keep3rV1() external view returns (address _keep3rV1);\\n\\n /// @notice Address of Keep3rV1Proxy's contract\\n /// @return _keep3rV1Proxy The address of Keep3rV1Proxy's contract\\n function keep3rV1Proxy() external view returns (address _keep3rV1Proxy);\\n\\n /// @notice The amount of time required to pass after a keeper has bonded assets for it to be able to activate\\n /// @return _days The required bondTime in days\\n function bondTime() external view returns (uint256 _days);\\n\\n /// @notice The amount of time required to pass before a keeper can unbond what he has bonded\\n /// @return _days The required unbondTime in days\\n function unbondTime() external view returns (uint256 _days);\\n\\n /// @notice The minimum amount of liquidity required to fund a job per liquidity\\n /// @return _amount The minimum amount of liquidity in KP3R\\n function liquidityMinimum() external view returns (uint256 _amount);\\n\\n /// @notice The amount of time between each scheduled credits reward given to a job\\n /// @return _days The reward period in days\\n function rewardPeriodTime() external view returns (uint256 _days);\\n\\n /// @notice The inflation period is the denominator used to regulate the emission of KP3R\\n /// @return _period The denominator used to regulate the emission of KP3R\\n function inflationPeriod() external view returns (uint256 _period);\\n\\n /// @notice The fee to be sent to governance when a user adds liquidity to a job\\n /// @return _amount The fee amount to be sent to governance when a user adds liquidity to a job\\n function fee() external view returns (uint256 _amount);\\n\\n // Errors\\n\\n /// @notice Throws if the reward period is less than the minimum reward period time\\n error MinRewardPeriod();\\n\\n /// @notice Throws if either a job or a keeper is disputed\\n error Disputed();\\n\\n /// @notice Throws if there are no bonded assets\\n error BondsUnexistent();\\n\\n /// @notice Throws if the time required to bond an asset has not passed yet\\n error BondsLocked();\\n\\n /// @notice Throws if there are no bonds to withdraw\\n error UnbondsUnexistent();\\n\\n /// @notice Throws if the time required to withdraw the bonds has not passed yet\\n error UnbondsLocked();\\n\\n // Methods\\n\\n /// @notice Sets the Keep3rHelper address\\n /// @param _keep3rHelper The Keep3rHelper address\\n function setKeep3rHelper(address _keep3rHelper) external;\\n\\n /// @notice Sets the Keep3rV1 address\\n /// @param _keep3rV1 The Keep3rV1 address\\n function setKeep3rV1(address _keep3rV1) external;\\n\\n /// @notice Sets the Keep3rV1Proxy address\\n /// @param _keep3rV1Proxy The Keep3rV1Proxy address\\n function setKeep3rV1Proxy(address _keep3rV1Proxy) external;\\n\\n /// @notice Sets the bond time required to activate as a keeper\\n /// @param _bond The new bond time\\n function setBondTime(uint256 _bond) external;\\n\\n /// @notice Sets the unbond time required unbond what has been bonded\\n /// @param _unbond The new unbond time\\n function setUnbondTime(uint256 _unbond) external;\\n\\n /// @notice Sets the minimum amount of liquidity required to fund a job\\n /// @param _liquidityMinimum The new minimum amount of liquidity\\n function setLiquidityMinimum(uint256 _liquidityMinimum) external;\\n\\n /// @notice Sets the time required to pass between rewards for jobs\\n /// @param _rewardPeriodTime The new amount of time required to pass between rewards\\n function setRewardPeriodTime(uint256 _rewardPeriodTime) external;\\n\\n /// @notice Sets the new inflation period\\n /// @param _inflationPeriod The new inflation period\\n function setInflationPeriod(uint256 _inflationPeriod) external;\\n\\n /// @notice Sets the new fee\\n /// @param _fee The new fee\\n function setFee(uint256 _fee) external;\\n}\\n\",\"keccak256\":\"0x942f99c6e3b229a551faaae8f03000b934b20502a7cfade14780508201fd098e\",\"license\":\"MIT\"},\"solidity/interfaces/peripherals/IKeep3rRoles.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4 <0.9.0;\\n\\nimport './IBaseErrors.sol';\\nimport './IGovernable.sol';\\nimport './IDustCollector.sol';\\n\\n/// @title Keep3rRoles contract\\n/// @notice Manages the Keep3r specific roles\\ninterface IKeep3rRoles is IBaseErrors, IDustCollector, IGovernable {\\n // Events\\n\\n /// @notice Emitted when a slasher is added\\n /// @param _slasher Address of the added slasher\\n event SlasherAdded(address _slasher);\\n\\n /// @notice Emitted when a slasher is removed\\n /// @param _slasher Address of the removed slasher\\n event SlasherRemoved(address _slasher);\\n\\n /// @notice Emitted when a disputer is added\\n /// @param _disputer Address of the added disputer\\n event DisputerAdded(address _disputer);\\n\\n /// @notice Emitted when a disputer is removed\\n /// @param _disputer Address of the removed disputer\\n event DisputerRemoved(address _disputer);\\n\\n // Variables\\n\\n /// @notice Tracks whether the address is a slasher or not\\n /// @param _slasher Address being checked as a slasher\\n /// @return _isSlasher Whether the address is a slasher or not\\n function slashers(address _slasher) external view returns (bool _isSlasher);\\n\\n /// @notice Tracks whether the address is a disputer or not\\n /// @param _disputer Address being checked as a disputer\\n /// @return _isDisputer Whether the address is a disputer or not\\n function disputers(address _disputer) external view returns (bool _isDisputer);\\n\\n // Errors\\n\\n /// @notice Throws if the address is already a registered slasher\\n error SlasherExistent();\\n\\n /// @notice Throws if caller is not a registered slasher\\n error SlasherUnexistent();\\n\\n /// @notice Throws if the address is already a registered disputer\\n error DisputerExistent();\\n\\n /// @notice Throws if caller is not a registered disputer\\n error DisputerUnexistent();\\n\\n /// @notice Throws if the msg.sender is not a slasher or is not a part of governance\\n error OnlySlasher();\\n\\n /// @notice Throws if the msg.sender is not a disputer or is not a part of governance\\n error OnlyDisputer();\\n\\n // Methods\\n\\n /// @notice Registers a slasher by updating the slashers mapping\\n function addSlasher(address _slasher) external;\\n\\n /// @notice Removes a slasher by updating the slashers mapping\\n function removeSlasher(address _slasher) external;\\n\\n /// @notice Registers a disputer by updating the disputers mapping\\n function addDisputer(address _disputer) external;\\n\\n /// @notice Removes a disputer by updating the disputers mapping\\n function removeDisputer(address _disputer) external;\\n}\\n\",\"keccak256\":\"0xe6eca166cf6ad99e5379d754030222873bb9868ff3e2a76de815a438ead533a2\",\"license\":\"MIT\"},\"solidity/interfaces/sidechain/IKeep3rJobWorkableRated.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4 <0.9.0;\\n\\nimport '../peripherals/IKeep3rJobs.sol';\\n\\n/// @title Keep3rJobWorkableRated contract\\n/// @notice Implements a quoting in USD per gas unit for Keep3r jobs\\ninterface IKeep3rJobWorkableRated is IKeep3rJobs {\\n /// @notice Throws when job contract calls deprecated worked(address) function\\n error Deprecated();\\n\\n /// @notice Implemented by jobs to show that a keeper performed work and reward in stable USD quote\\n /// @dev Automatically calculates the payment for the keeper and pays the keeper with bonded KP3R\\n /// @param _keeper Address of the keeper that performed the work\\n /// @param _usdPerGasUnit Amount of USD in wei rewarded for gas unit worked by the keeper\\n function worked(address _keeper, uint256 _usdPerGasUnit) external;\\n}\\n\",\"keccak256\":\"0xce2c2721f1df7d944bf3ae20331cb628d38247e667c47bf4a33a90f0b5753884\",\"license\":\"MIT\"}},\"version\":1}", - "bytecode": "0x6080604052600160025534801561001557600080fd5b506040516104d33803806104d383398101604081905261003491610059565b600080546001600160a01b0319166001600160a01b0392909216919091179055610089565b60006020828403121561006b57600080fd5b81516001600160a01b038116811461008257600080fd5b9392505050565b61043b806100986000396000f3fe608060405234801561001057600080fd5b50600436106100575760003560e01c8063322e9f041461005c5780633bb39c3314610066578063634c7bb5146100795780639ecc0b95146100a2578063affed0e0146100b9575b600080fd5b6100646100c2565b005b61006461007436600461036f565b6101ff565b60005461008c906001600160a01b031681565b6040516100999190610388565b60405180910390f35b6100ab60025481565b604051908152602001610099565b6100ab60015481565b6000546040516335d2155560e11b81526001600160a01b0390911690636ba42aaa906100f2903390600401610388565b602060405180830381600087803b15801561010c57600080fd5b505af1158015610120573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906101449190610346565b61016157604051637671ff4960e11b815260040160405180910390fd5b60005b6103e8811015610196576001805490600061017e836103d4565b9190505550808061018e906103d4565b915050610164565b5060005460025460405163b70362b960e01b81526001600160a01b039092169163b70362b9916101cb9133919060040161039c565b600060405180830381600087803b1580156101e557600080fd5b505af11580156101f9573d6000803e3d6000fd5b50505050565b6000546040516335d2155560e11b81526001600160a01b0390911690636ba42aaa9061022f903390600401610388565b602060405180830381600087803b15801561024957600080fd5b505af115801561025d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906102819190610346565b61029e57604051637671ff4960e11b815260040160405180910390fd5b60005b6102ad826103e86103b5565b8110156102dc57600180549060006102c4836103d4565b919050555080806102d4906103d4565b9150506102a1565b5060005460025460405163b70362b960e01b81526001600160a01b039092169163b70362b9916103119133919060040161039c565b600060405180830381600087803b15801561032b57600080fd5b505af115801561033f573d6000803e3d6000fd5b5050505050565b60006020828403121561035857600080fd5b8151801515811461036857600080fd5b9392505050565b60006020828403121561038157600080fd5b5035919050565b6001600160a01b0391909116815260200190565b6001600160a01b03929092168252602082015260400190565b60008160001904831182151516156103cf576103cf6103ef565b500290565b60006000198214156103e8576103e86103ef565b5060010190565b634e487b7160e01b600052601160045260246000fdfea26469706673582212202e08507f46886e2b4b905e75ba7caed9cd3428ceb92934589b747ae6092aa66064736f6c63430008070033", - "deployedBytecode": "0x608060405234801561001057600080fd5b50600436106100575760003560e01c8063322e9f041461005c5780633bb39c3314610066578063634c7bb5146100795780639ecc0b95146100a2578063affed0e0146100b9575b600080fd5b6100646100c2565b005b61006461007436600461036f565b6101ff565b60005461008c906001600160a01b031681565b6040516100999190610388565b60405180910390f35b6100ab60025481565b604051908152602001610099565b6100ab60015481565b6000546040516335d2155560e11b81526001600160a01b0390911690636ba42aaa906100f2903390600401610388565b602060405180830381600087803b15801561010c57600080fd5b505af1158015610120573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906101449190610346565b61016157604051637671ff4960e11b815260040160405180910390fd5b60005b6103e8811015610196576001805490600061017e836103d4565b9190505550808061018e906103d4565b915050610164565b5060005460025460405163b70362b960e01b81526001600160a01b039092169163b70362b9916101cb9133919060040161039c565b600060405180830381600087803b1580156101e557600080fd5b505af11580156101f9573d6000803e3d6000fd5b50505050565b6000546040516335d2155560e11b81526001600160a01b0390911690636ba42aaa9061022f903390600401610388565b602060405180830381600087803b15801561024957600080fd5b505af115801561025d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906102819190610346565b61029e57604051637671ff4960e11b815260040160405180910390fd5b60005b6102ad826103e86103b5565b8110156102dc57600180549060006102c4836103d4565b919050555080806102d4906103d4565b9150506102a1565b5060005460025460405163b70362b960e01b81526001600160a01b039092169163b70362b9916103119133919060040161039c565b600060405180830381600087803b15801561032b57600080fd5b505af115801561033f573d6000803e3d6000fd5b5050505050565b60006020828403121561035857600080fd5b8151801515811461036857600080fd5b9392505050565b60006020828403121561038157600080fd5b5035919050565b6001600160a01b0391909116815260200190565b6001600160a01b03929092168252602082015260400190565b60008160001904831182151516156103cf576103cf6103ef565b500290565b60006000198214156103e8576103e86103ef565b5060010190565b634e487b7160e01b600052601160045260246000fdfea26469706673582212202e08507f46886e2b4b905e75ba7caed9cd3428ceb92934589b747ae6092aa66064736f6c63430008070033", - "devdoc": { - "kind": "dev", - "methods": {}, - "version": 1 - }, - "userdoc": { - "kind": "user", - "methods": {}, - "version": 1 - }, - "storageLayout": { - "storage": [ - { - "astId": 10848, - "contract": "solidity/for-test/JobRatedForTest.sol:JobRatedForTest", - "label": "keep3r", - "offset": 0, - "slot": "0", - "type": "t_address" - }, - { - "astId": 10850, - "contract": "solidity/for-test/JobRatedForTest.sol:JobRatedForTest", - "label": "nonce", - "offset": 0, - "slot": "1", - "type": "t_uint256" - }, - { - "astId": 10853, - "contract": "solidity/for-test/JobRatedForTest.sol:JobRatedForTest", - "label": "usdPerGasUnit", - "offset": 0, - "slot": "2", - "type": "t_uint256" - } - ], - "types": { - "t_address": { - "encoding": "inplace", - "label": "address", - "numberOfBytes": "20" - }, - "t_uint256": { - "encoding": "inplace", - "label": "uint256", - "numberOfBytes": "32" - } - } - } -} \ No newline at end of file diff --git a/deployments/optimisticGoerli/Keep3rEscrow.json b/deployments/optimisticGoerli/Keep3rEscrow.json deleted file mode 100644 index e7050de..0000000 --- a/deployments/optimisticGoerli/Keep3rEscrow.json +++ /dev/null @@ -1,539 +0,0 @@ -{ - "address": "0xBa4A759E41cCA14980bE4106792cdAC5F7BeDF83", - "abi": [ - { - "inputs": [ - { - "internalType": "address", - "name": "_governance", - "type": "address" - }, - { - "internalType": "address", - "name": "_wKP3R", - "type": "address" - } - ], - "stateMutability": "nonpayable", - "type": "constructor" - }, - { - "inputs": [], - "name": "InsufficientBalance", - "type": "error" - }, - { - "inputs": [], - "name": "NoGovernanceZeroAddress", - "type": "error" - }, - { - "inputs": [], - "name": "OnlyGovernance", - "type": "error" - }, - { - "inputs": [], - "name": "OnlyMinter", - "type": "error" - }, - { - "inputs": [], - "name": "OnlyPendingGovernance", - "type": "error" - }, - { - "inputs": [], - "name": "ZeroAddress", - "type": "error" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "address", - "name": "_token", - "type": "address" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "_amount", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "address", - "name": "_to", - "type": "address" - } - ], - "name": "DustSent", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "address", - "name": "_pendingGovernance", - "type": "address" - } - ], - "name": "GovernanceProposal", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "address", - "name": "_governance", - "type": "address" - } - ], - "name": "GovernanceSet", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "address", - "name": "_minter", - "type": "address" - } - ], - "name": "MinterSet", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "address", - "name": "_wKP3R", - "type": "address" - }, - { - "indexed": false, - "internalType": "address", - "name": "_sender", - "type": "address" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "_amount", - "type": "uint256" - } - ], - "name": "wKP3RDeposited", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "address", - "name": "_wKP3R", - "type": "address" - }, - { - "indexed": false, - "internalType": "address", - "name": "_recipient", - "type": "address" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "_amount", - "type": "uint256" - } - ], - "name": "wKP3RMinted", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "address", - "name": "_newWKP3R", - "type": "address" - } - ], - "name": "wKP3RSet", - "type": "event" - }, - { - "inputs": [], - "name": "acceptGovernance", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "_amount", - "type": "uint256" - } - ], - "name": "deposit", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [], - "name": "governance", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "_amount", - "type": "uint256" - } - ], - "name": "mint", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [], - "name": "minter", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "pendingGovernance", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_token", - "type": "address" - }, - { - "internalType": "uint256", - "name": "_amount", - "type": "uint256" - }, - { - "internalType": "address", - "name": "_to", - "type": "address" - } - ], - "name": "sendDust", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_governance", - "type": "address" - } - ], - "name": "setGovernance", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_minter", - "type": "address" - } - ], - "name": "setMinter", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_wKP3R", - "type": "address" - } - ], - "name": "setWKP3R", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [], - "name": "wKP3R", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - } - ], - "transactionHash": "0x04ac7849ec511257a2b9e76962ae793898ae91cafaf363eaaa25c091ac6445b0", - "receipt": { - "to": null, - "from": "0x258b180E741157763236F5277619D71ECf00B906", - "contractAddress": "0xBa4A759E41cCA14980bE4106792cdAC5F7BeDF83", - "transactionIndex": 0, - "gasUsed": "664456", - "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", - "blockHash": "0x2d0df5213d866412602cf7fdff0ad56093b22150e5f8ef9c910270247bb12562", - "transactionHash": "0x04ac7849ec511257a2b9e76962ae793898ae91cafaf363eaaa25c091ac6445b0", - "logs": [], - "blockNumber": 3232893, - "cumulativeGasUsed": "664456", - "status": 1, - "byzantium": true - }, - "args": [ - "0x258b180E741157763236F5277619D71ECf00B906", - "0x3Db593146464816F10d4eBA4743C76A5A4D08425" - ], - "numDeployments": 2, - "solcInputHash": "8c968687fa7312972c014a5aac38beba", - "metadata": "{\"compiler\":{\"version\":\"0.8.7+commit.e28d00a7\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_governance\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"_wKP3R\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"inputs\":[],\"name\":\"InsufficientBalance\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"NoGovernanceZeroAddress\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"OnlyGovernance\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"OnlyMinter\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"OnlyPendingGovernance\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"ZeroAddress\",\"type\":\"error\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"_token\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"_amount\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"_to\",\"type\":\"address\"}],\"name\":\"DustSent\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"_pendingGovernance\",\"type\":\"address\"}],\"name\":\"GovernanceProposal\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"_governance\",\"type\":\"address\"}],\"name\":\"GovernanceSet\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"_minter\",\"type\":\"address\"}],\"name\":\"MinterSet\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"_wKP3R\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"_sender\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"_amount\",\"type\":\"uint256\"}],\"name\":\"wKP3RDeposited\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"_wKP3R\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"_recipient\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"_amount\",\"type\":\"uint256\"}],\"name\":\"wKP3RMinted\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"_newWKP3R\",\"type\":\"address\"}],\"name\":\"wKP3RSet\",\"type\":\"event\"},{\"inputs\":[],\"name\":\"acceptGovernance\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_amount\",\"type\":\"uint256\"}],\"name\":\"deposit\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"governance\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_amount\",\"type\":\"uint256\"}],\"name\":\"mint\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"minter\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"pendingGovernance\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_token\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"_amount\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"_to\",\"type\":\"address\"}],\"name\":\"sendDust\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_governance\",\"type\":\"address\"}],\"name\":\"setGovernance\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_minter\",\"type\":\"address\"}],\"name\":\"setMinter\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_wKP3R\",\"type\":\"address\"}],\"name\":\"setWKP3R\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"wKP3R\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"}],\"devdoc\":{\"kind\":\"dev\",\"methods\":{\"constructor\":{\"params\":{\"_governance\":\"Address of governance\",\"_wKP3R\":\"Address of wrapped KP3R implementation\"}},\"deposit(uint256)\":{\"params\":{\"_amount\":\"The amount of wKP3R to deposit\"}},\"mint(uint256)\":{\"params\":{\"_amount\":\"The amount of wKP3R to mint\"}},\"sendDust(address,uint256,address)\":{\"params\":{\"_amount\":\"The amount of the token that will be transferred\",\"_to\":\"The address that will receive the idle funds\",\"_token\":\"The token that will be transferred\"}},\"setGovernance(address)\":{\"params\":{\"_governance\":\"The address being proposed as the new governance\"}},\"setMinter(address)\":{\"params\":{\"_minter\":\"The address set as the minter\"}},\"setWKP3R(address)\":{\"params\":{\"_wKP3R\":\"the wKP3R address\"}}},\"stateVariables\":{\"wKP3R\":{\"return\":\"_wKP3RAddress The address of wKP3R\",\"returns\":{\"_0\":\"_wKP3RAddress The address of wKP3R\"}}},\"version\":1},\"userdoc\":{\"errors\":{\"InsufficientBalance()\":[{\"notice\":\"Throws when minter attempts to withdraw more wKP3R than the escrow has in its balance\"}],\"NoGovernanceZeroAddress()\":[{\"notice\":\"Throws if trying to set governance to zero address\"}],\"OnlyGovernance()\":[{\"notice\":\"Throws if the caller of the function is not governance\"}],\"OnlyMinter()\":[{\"notice\":\"Throws if the caller of the function is not the minter\"}],\"OnlyPendingGovernance()\":[{\"notice\":\"Throws if the caller of the function is not pendingGovernance\"}],\"ZeroAddress()\":[{\"notice\":\"Throws if a variable is assigned to the zero address\"}]},\"events\":{\"DustSent(address,uint256,address)\":{\"notice\":\"Emitted when dust is sent\"},\"GovernanceProposal(address)\":{\"notice\":\"Emitted when a new governance is proposed\"},\"GovernanceSet(address)\":{\"notice\":\"Emitted when pendingGovernance accepts to be governance\"},\"MinterSet(address)\":{\"notice\":\"Emitted when governance sets a new minter\"},\"wKP3RDeposited(address,address,uint256)\":{\"notice\":\"Emitted when Keep3rEscrow#deposit function is called\"},\"wKP3RMinted(address,address,uint256)\":{\"notice\":\"Emitted when Keep3rEscrow#mint function is called\"},\"wKP3RSet(address)\":{\"notice\":\"Emitted when Keep3rEscrow#setWKP3R function is called\"}},\"kind\":\"user\",\"methods\":{\"acceptGovernance()\":{\"notice\":\"Changes the governance from the current governance to the previously proposed address\"},\"deposit(uint256)\":{\"notice\":\"Deposits wKP3R into the contract\"},\"governance()\":{\"notice\":\"Stores the governance address\"},\"mint(uint256)\":{\"notice\":\"mints wKP3R to the recipient\"},\"minter()\":{\"notice\":\"Stores the minter address\"},\"pendingGovernance()\":{\"notice\":\"Stores the pendingGovernance address\"},\"sendDust(address,uint256,address)\":{\"notice\":\"Allows an authorized user to transfer the tokens or eth that may have been left in a contract\"},\"setGovernance(address)\":{\"notice\":\"Proposes a new address to be governance\"},\"setMinter(address)\":{\"notice\":\"Sets a new address to be the minter\"},\"setWKP3R(address)\":{\"notice\":\"sets the wKP3R address\"},\"wKP3R()\":{\"notice\":\"Lists the address of the wKP3R contract\"}},\"version\":1}},\"settings\":{\"compilationTarget\":{\"solidity/contracts/sidechain/Keep3rEscrow.sol\":\"Keep3rEscrow\"},\"evmVersion\":\"london\",\"libraries\":{\":__CACHE_BREAKER__\":\"0x00000000d41867734bbee4c6863d9255b2b06ac1\"},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":33},\"remappings\":[]},\"sources\":{\"@openzeppelin/contracts/token/ERC20/IERC20.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Interface of the ERC20 standard as defined in the EIP.\\n */\\ninterface IERC20 {\\n /**\\n * @dev Returns the amount of tokens in existence.\\n */\\n function totalSupply() external view returns (uint256);\\n\\n /**\\n * @dev Returns the amount of tokens owned by `account`.\\n */\\n function balanceOf(address account) external view returns (uint256);\\n\\n /**\\n * @dev Moves `amount` tokens from the caller's account to `recipient`.\\n *\\n * Returns a boolean value indicating whether the operation succeeded.\\n *\\n * Emits a {Transfer} event.\\n */\\n function transfer(address recipient, uint256 amount) external returns (bool);\\n\\n /**\\n * @dev Returns the remaining number of tokens that `spender` will be\\n * allowed to spend on behalf of `owner` through {transferFrom}. This is\\n * zero by default.\\n *\\n * This value changes when {approve} or {transferFrom} are called.\\n */\\n function allowance(address owner, address spender) external view returns (uint256);\\n\\n /**\\n * @dev Sets `amount` as the allowance of `spender` over the caller's tokens.\\n *\\n * Returns a boolean value indicating whether the operation succeeded.\\n *\\n * IMPORTANT: Beware that changing an allowance with this method brings the risk\\n * that someone may use both the old and the new allowance by unfortunate\\n * transaction ordering. One possible solution to mitigate this race\\n * condition is to first reduce the spender's allowance to 0 and set the\\n * desired value afterwards:\\n * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729\\n *\\n * Emits an {Approval} event.\\n */\\n function approve(address spender, uint256 amount) external returns (bool);\\n\\n /**\\n * @dev Moves `amount` tokens from `sender` to `recipient` using the\\n * allowance mechanism. `amount` is then deducted from the caller's\\n * allowance.\\n *\\n * Returns a boolean value indicating whether the operation succeeded.\\n *\\n * Emits a {Transfer} event.\\n */\\n function transferFrom(\\n address sender,\\n address recipient,\\n uint256 amount\\n ) external returns (bool);\\n\\n /**\\n * @dev Emitted when `value` tokens are moved from one account (`from`) to\\n * another (`to`).\\n *\\n * Note that `value` may be zero.\\n */\\n event Transfer(address indexed from, address indexed to, uint256 value);\\n\\n /**\\n * @dev Emitted when the allowance of a `spender` for an `owner` is set by\\n * a call to {approve}. `value` is the new allowance.\\n */\\n event Approval(address indexed owner, address indexed spender, uint256 value);\\n}\\n\",\"keccak256\":\"0x027b891937d20ccf213fdb9c31531574256de774bda99d3a70ecef6e1913ed2a\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../IERC20.sol\\\";\\nimport \\\"../../../utils/Address.sol\\\";\\n\\n/**\\n * @title SafeERC20\\n * @dev Wrappers around ERC20 operations that throw on failure (when the token\\n * contract returns false). Tokens that return no value (and instead revert or\\n * throw on failure) are also supported, non-reverting calls are assumed to be\\n * successful.\\n * To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract,\\n * which allows you to call the safe operations as `token.safeTransfer(...)`, etc.\\n */\\nlibrary SafeERC20 {\\n using Address for address;\\n\\n function safeTransfer(\\n IERC20 token,\\n address to,\\n uint256 value\\n ) internal {\\n _callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value));\\n }\\n\\n function safeTransferFrom(\\n IERC20 token,\\n address from,\\n address to,\\n uint256 value\\n ) internal {\\n _callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value));\\n }\\n\\n /**\\n * @dev Deprecated. This function has issues similar to the ones found in\\n * {IERC20-approve}, and its usage is discouraged.\\n *\\n * Whenever possible, use {safeIncreaseAllowance} and\\n * {safeDecreaseAllowance} instead.\\n */\\n function safeApprove(\\n IERC20 token,\\n address spender,\\n uint256 value\\n ) internal {\\n // safeApprove should only be called when setting an initial allowance,\\n // or when resetting it to zero. To increase and decrease it, use\\n // 'safeIncreaseAllowance' and 'safeDecreaseAllowance'\\n require(\\n (value == 0) || (token.allowance(address(this), spender) == 0),\\n \\\"SafeERC20: approve from non-zero to non-zero allowance\\\"\\n );\\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value));\\n }\\n\\n function safeIncreaseAllowance(\\n IERC20 token,\\n address spender,\\n uint256 value\\n ) internal {\\n uint256 newAllowance = token.allowance(address(this), spender) + value;\\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));\\n }\\n\\n function safeDecreaseAllowance(\\n IERC20 token,\\n address spender,\\n uint256 value\\n ) internal {\\n unchecked {\\n uint256 oldAllowance = token.allowance(address(this), spender);\\n require(oldAllowance >= value, \\\"SafeERC20: decreased allowance below zero\\\");\\n uint256 newAllowance = oldAllowance - value;\\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));\\n }\\n }\\n\\n /**\\n * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement\\n * on the return value: the return value is optional (but if data is returned, it must not be false).\\n * @param token The token targeted by the call.\\n * @param data The call data (encoded using abi.encode or one of its variants).\\n */\\n function _callOptionalReturn(IERC20 token, bytes memory data) private {\\n // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since\\n // we're implementing it ourselves. We use {Address.functionCall} to perform this call, which verifies that\\n // the target address contains contract code and also asserts for success in the low-level call.\\n\\n bytes memory returndata = address(token).functionCall(data, \\\"SafeERC20: low-level call failed\\\");\\n if (returndata.length > 0) {\\n // Return data is optional\\n require(abi.decode(returndata, (bool)), \\\"SafeERC20: ERC20 operation did not succeed\\\");\\n }\\n }\\n}\\n\",\"keccak256\":\"0x02348b2e4b9f3200c7e3907c5c2661643a6d8520e9f79939fbb9b4005a54894d\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/Address.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Collection of functions related to the address type\\n */\\nlibrary Address {\\n /**\\n * @dev Returns true if `account` is a contract.\\n *\\n * [IMPORTANT]\\n * ====\\n * It is unsafe to assume that an address for which this function returns\\n * false is an externally-owned account (EOA) and not a contract.\\n *\\n * Among others, `isContract` will return false for the following\\n * types of addresses:\\n *\\n * - an externally-owned account\\n * - a contract in construction\\n * - an address where a contract will be created\\n * - an address where a contract lived, but was destroyed\\n * ====\\n */\\n function isContract(address account) internal view returns (bool) {\\n // This method relies on extcodesize, which returns 0 for contracts in\\n // construction, since the code is only stored at the end of the\\n // constructor execution.\\n\\n uint256 size;\\n assembly {\\n size := extcodesize(account)\\n }\\n return size > 0;\\n }\\n\\n /**\\n * @dev Replacement for Solidity's `transfer`: sends `amount` wei to\\n * `recipient`, forwarding all available gas and reverting on errors.\\n *\\n * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost\\n * of certain opcodes, possibly making contracts go over the 2300 gas limit\\n * imposed by `transfer`, making them unable to receive funds via\\n * `transfer`. {sendValue} removes this limitation.\\n *\\n * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].\\n *\\n * IMPORTANT: because control is transferred to `recipient`, care must be\\n * taken to not create reentrancy vulnerabilities. Consider using\\n * {ReentrancyGuard} or the\\n * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].\\n */\\n function sendValue(address payable recipient, uint256 amount) internal {\\n require(address(this).balance >= amount, \\\"Address: insufficient balance\\\");\\n\\n (bool success, ) = recipient.call{value: amount}(\\\"\\\");\\n require(success, \\\"Address: unable to send value, recipient may have reverted\\\");\\n }\\n\\n /**\\n * @dev Performs a Solidity function call using a low level `call`. A\\n * plain `call` is an unsafe replacement for a function call: use this\\n * function instead.\\n *\\n * If `target` reverts with a revert reason, it is bubbled up by this\\n * function (like regular Solidity function calls).\\n *\\n * Returns the raw returned data. To convert to the expected return value,\\n * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\\n *\\n * Requirements:\\n *\\n * - `target` must be a contract.\\n * - calling `target` with `data` must not revert.\\n *\\n * _Available since v3.1._\\n */\\n function functionCall(address target, bytes memory data) internal returns (bytes memory) {\\n return functionCall(target, data, \\\"Address: low-level call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with\\n * `errorMessage` as a fallback revert reason when `target` reverts.\\n *\\n * _Available since v3.1._\\n */\\n function functionCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, 0, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but also transferring `value` wei to `target`.\\n *\\n * Requirements:\\n *\\n * - the calling contract must have an ETH balance of at least `value`.\\n * - the called Solidity function must be `payable`.\\n *\\n * _Available since v3.1._\\n */\\n function functionCallWithValue(\\n address target,\\n bytes memory data,\\n uint256 value\\n ) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, value, \\\"Address: low-level call with value failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but\\n * with `errorMessage` as a fallback revert reason when `target` reverts.\\n *\\n * _Available since v3.1._\\n */\\n function functionCallWithValue(\\n address target,\\n bytes memory data,\\n uint256 value,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n require(address(this).balance >= value, \\\"Address: insufficient balance for call\\\");\\n require(isContract(target), \\\"Address: call to non-contract\\\");\\n\\n (bool success, bytes memory returndata) = target.call{value: value}(data);\\n return verifyCallResult(success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but performing a static call.\\n *\\n * _Available since v3.3._\\n */\\n function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\\n return functionStaticCall(target, data, \\\"Address: low-level static call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\\n * but performing a static call.\\n *\\n * _Available since v3.3._\\n */\\n function functionStaticCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal view returns (bytes memory) {\\n require(isContract(target), \\\"Address: static call to non-contract\\\");\\n\\n (bool success, bytes memory returndata) = target.staticcall(data);\\n return verifyCallResult(success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but performing a delegate call.\\n *\\n * _Available since v3.4._\\n */\\n function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {\\n return functionDelegateCall(target, data, \\\"Address: low-level delegate call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\\n * but performing a delegate call.\\n *\\n * _Available since v3.4._\\n */\\n function functionDelegateCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n require(isContract(target), \\\"Address: delegate call to non-contract\\\");\\n\\n (bool success, bytes memory returndata) = target.delegatecall(data);\\n return verifyCallResult(success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the\\n * revert reason using the provided one.\\n *\\n * _Available since v4.3._\\n */\\n function verifyCallResult(\\n bool success,\\n bytes memory returndata,\\n string memory errorMessage\\n ) internal pure returns (bytes memory) {\\n if (success) {\\n return returndata;\\n } else {\\n // Look for revert reason and bubble it up if present\\n if (returndata.length > 0) {\\n // The easiest way to bubble the revert reason is using memory via assembly\\n\\n assembly {\\n let returndata_size := mload(returndata)\\n revert(add(32, returndata), returndata_size)\\n }\\n } else {\\n revert(errorMessage);\\n }\\n }\\n }\\n}\\n\",\"keccak256\":\"0x3336baae5cf23e94274d75336e2d412193be508504aee185e61dc7d58cd05c8a\",\"license\":\"MIT\"},\"solidity/contracts/peripherals/DustCollector.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity >=0.8.4 <0.9.0;\\n\\nimport '@openzeppelin/contracts/token/ERC20/IERC20.sol';\\nimport '@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol';\\nimport '../../contracts/peripherals/Governable.sol';\\nimport '../../interfaces/peripherals/IDustCollector.sol';\\n\\nabstract contract DustCollector is IDustCollector, Governable {\\n using SafeERC20 for IERC20;\\n\\n address internal constant _ETH_ADDRESS = 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE;\\n\\n function sendDust(\\n address _token,\\n uint256 _amount,\\n address _to\\n ) external override onlyGovernance {\\n if (_to == address(0)) revert ZeroAddress();\\n if (_token == _ETH_ADDRESS) {\\n payable(_to).transfer(_amount);\\n } else {\\n IERC20(_token).safeTransfer(_to, _amount);\\n }\\n emit DustSent(_token, _amount, _to);\\n }\\n}\\n\",\"keccak256\":\"0x246ac2c4057520bb627ea8040367549786f4477a04fd79358927cd607952bc2f\",\"license\":\"MIT\"},\"solidity/contracts/peripherals/Governable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4 <0.9.0;\\n\\nimport '../../interfaces/peripherals/IGovernable.sol';\\n\\nabstract contract Governable is IGovernable {\\n /// @inheritdoc IGovernable\\n address public override governance;\\n\\n /// @inheritdoc IGovernable\\n address public override pendingGovernance;\\n\\n constructor(address _governance) {\\n if (_governance == address(0)) revert NoGovernanceZeroAddress();\\n governance = _governance;\\n }\\n\\n /// @inheritdoc IGovernable\\n function setGovernance(address _governance) external override onlyGovernance {\\n pendingGovernance = _governance;\\n emit GovernanceProposal(_governance);\\n }\\n\\n /// @inheritdoc IGovernable\\n function acceptGovernance() external override onlyPendingGovernance {\\n governance = pendingGovernance;\\n delete pendingGovernance;\\n emit GovernanceSet(governance);\\n }\\n\\n /// @notice Functions with this modifier can only be called by governance\\n modifier onlyGovernance {\\n if (msg.sender != governance) revert OnlyGovernance();\\n _;\\n }\\n\\n /// @notice Functions with this modifier can only be called by pendingGovernance\\n modifier onlyPendingGovernance {\\n if (msg.sender != pendingGovernance) revert OnlyPendingGovernance();\\n _;\\n }\\n}\\n\",\"keccak256\":\"0x5b6d7601a42d2229657a7f60021c7e2bfe890c3541ab0003f7d88e20a28d722b\",\"license\":\"MIT\"},\"solidity/contracts/peripherals/Mintable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4 <0.9.0;\\n\\nimport '../../interfaces/peripherals/IMintable.sol';\\nimport './Governable.sol';\\n\\nabstract contract Mintable is Governable, IMintable {\\n /// @inheritdoc IMintable\\n address public override minter;\\n\\n constructor(address _governance) Governable(_governance) {}\\n\\n /// @inheritdoc IMintable\\n function setMinter(address _minter) external override onlyGovernance {\\n if (_minter == address(0)) revert ZeroAddress();\\n minter = _minter;\\n emit MinterSet(_minter);\\n }\\n\\n /// @notice Functions with this modifier can only be called by the minter;\\n modifier onlyMinter() {\\n if (msg.sender != minter) revert OnlyMinter();\\n _;\\n }\\n}\\n\",\"keccak256\":\"0xc995899a6f8f32a0302fa017197b566012c2fefee9dc6fd2dac9d2674a5588f6\",\"license\":\"MIT\"},\"solidity/contracts/sidechain/Keep3rEscrow.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity >=0.8.4 <0.9.0;\\n\\nimport '../peripherals/Mintable.sol';\\nimport '../peripherals/DustCollector.sol';\\nimport '../../interfaces/sidechain/IKeep3rEscrow.sol';\\nimport '@openzeppelin/contracts/token/ERC20/IERC20.sol';\\nimport '@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol';\\n\\ncontract Keep3rEscrow is Mintable, DustCollector, IKeep3rEscrow {\\n using SafeERC20 for IERC20;\\n\\n /// @inheritdoc IKeep3rEscrow\\n address public override wKP3R;\\n\\n /// @param _governance Address of governance\\n /// @param _wKP3R Address of wrapped KP3R implementation\\n constructor(address _governance, address _wKP3R) Mintable(_governance) {\\n wKP3R = _wKP3R;\\n }\\n\\n /// @inheritdoc IKeep3rEscrow\\n function deposit(uint256 _amount) external override {\\n IERC20(wKP3R).safeTransferFrom(msg.sender, address(this), _amount);\\n emit wKP3RDeposited(wKP3R, msg.sender, _amount);\\n }\\n\\n /// @inheritdoc IKeep3rEscrow\\n function mint(uint256 _amount) external override onlyMinter {\\n IERC20(wKP3R).safeTransfer(msg.sender, _amount);\\n emit wKP3RMinted(wKP3R, msg.sender, _amount);\\n }\\n\\n /// @inheritdoc IKeep3rEscrow\\n function setWKP3R(address _wKP3R) external override onlyGovernance {\\n if (_wKP3R == address(0)) revert ZeroAddress();\\n wKP3R = _wKP3R;\\n emit wKP3RSet(wKP3R);\\n }\\n}\\n\",\"keccak256\":\"0x393124ed73b9b0b6aad631d03605302e1636beb478865cfa7b5d2b57aa517bca\",\"license\":\"MIT\"},\"solidity/interfaces/peripherals/IBaseErrors.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity >=0.8.4 <0.9.0;\\n\\ninterface IBaseErrors {\\n /// @notice Throws if a variable is assigned to the zero address\\n error ZeroAddress();\\n}\\n\",\"keccak256\":\"0x9130019a08d9eaedfb920a323fed5c7f409736cd918f1a32921c93551b3ee00e\",\"license\":\"MIT\"},\"solidity/interfaces/peripherals/IDustCollector.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity >=0.8.4 <0.9.0;\\n\\nimport './IBaseErrors.sol';\\n\\ninterface IDustCollector is IBaseErrors {\\n /// @notice Emitted when dust is sent\\n /// @param _token The token that will be transferred\\n /// @param _amount The amount of the token that will be transferred\\n /// @param _to The address which will receive the funds\\n event DustSent(address _token, uint256 _amount, address _to);\\n\\n /// @notice Allows an authorized user to transfer the tokens or eth that may have been left in a contract\\n /// @param _token The token that will be transferred\\n /// @param _amount The amount of the token that will be transferred\\n /// @param _to The address that will receive the idle funds\\n function sendDust(\\n address _token,\\n uint256 _amount,\\n address _to\\n ) external;\\n}\\n\",\"keccak256\":\"0x38dce228111f2a3c6b26ac09c5652c3f1f184c4cfe50d11ff0958ef6a50683bb\",\"license\":\"MIT\"},\"solidity/interfaces/peripherals/IGovernable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4 <0.9.0;\\n\\n/// @title Governable contract\\n/// @notice Manages the governance role\\ninterface IGovernable {\\n // Events\\n\\n /// @notice Emitted when pendingGovernance accepts to be governance\\n /// @param _governance Address of the new governance\\n event GovernanceSet(address _governance);\\n\\n /// @notice Emitted when a new governance is proposed\\n /// @param _pendingGovernance Address that is proposed to be the new governance\\n event GovernanceProposal(address _pendingGovernance);\\n\\n // Errors\\n\\n /// @notice Throws if the caller of the function is not governance\\n error OnlyGovernance();\\n\\n /// @notice Throws if the caller of the function is not pendingGovernance\\n error OnlyPendingGovernance();\\n\\n /// @notice Throws if trying to set governance to zero address\\n error NoGovernanceZeroAddress();\\n\\n // Variables\\n\\n /// @notice Stores the governance address\\n /// @return _governance The governance addresss\\n function governance() external view returns (address _governance);\\n\\n /// @notice Stores the pendingGovernance address\\n /// @return _pendingGovernance The pendingGovernance addresss\\n function pendingGovernance() external view returns (address _pendingGovernance);\\n\\n // Methods\\n\\n /// @notice Proposes a new address to be governance\\n /// @param _governance The address being proposed as the new governance\\n function setGovernance(address _governance) external;\\n\\n /// @notice Changes the governance from the current governance to the previously proposed address\\n function acceptGovernance() external;\\n}\\n\",\"keccak256\":\"0x3284624b2479bbf97c821f37c93a096dcb869b30bbf9b20d30d1800f9535452c\",\"license\":\"MIT\"},\"solidity/interfaces/peripherals/IMintable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4 <0.9.0;\\n\\nimport './IGovernable.sol';\\nimport './IBaseErrors.sol';\\n\\n/// @title Mintable contract\\n/// @notice Manages the minter role\\ninterface IMintable is IBaseErrors, IGovernable {\\n // Events\\n\\n /// @notice Emitted when governance sets a new minter\\n /// @param _minter Address of the new minter\\n event MinterSet(address _minter);\\n\\n // Errors\\n\\n /// @notice Throws if the caller of the function is not the minter\\n error OnlyMinter();\\n\\n // Variables\\n\\n /// @notice Stores the minter address\\n /// @return _minter The minter addresss\\n function minter() external view returns (address _minter);\\n\\n // Methods\\n\\n /// @notice Sets a new address to be the minter\\n /// @param _minter The address set as the minter\\n function setMinter(address _minter) external;\\n}\\n\",\"keccak256\":\"0x255f4ed4b7c4ddf4fcff9db7524365ef734806583acca7c7912e867f110d9c81\",\"license\":\"MIT\"},\"solidity/interfaces/sidechain/IKeep3rEscrow.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4 <0.9.0;\\n\\n// solhint-disable-next-line no-empty-blocks\\n\\nimport '../peripherals/IMintable.sol';\\n\\n/// @title Keep3rEscrow contract\\n/// @notice This contract acts as an escrow contract for wKP3R tokens on sidechains and L2s\\n/// @dev Can be used as a replacement for keep3rV1Proxy in keep3r sidechain implementations\\ninterface IKeep3rEscrow is IMintable {\\n /// @notice Emitted when Keep3rEscrow#deposit function is called\\n /// @param _wKP3R The addess of the wrapped KP3R token\\n /// @param _sender The address that called the function\\n /// @param _amount The amount of wKP3R the user deposited\\n event wKP3RDeposited(address _wKP3R, address _sender, uint256 _amount);\\n\\n /// @notice Emitted when Keep3rEscrow#mint function is called\\n /// @param _wKP3R The addess of the wrapped KP3R token\\n /// @param _recipient The address that will received the newly minted wKP3R\\n /// @param _amount The amount of wKP3R minted to the recipient\\n event wKP3RMinted(address _wKP3R, address _recipient, uint256 _amount);\\n\\n /// @notice Emitted when Keep3rEscrow#setWKP3R function is called\\n /// @param _newWKP3R The address of the wKP3R contract\\n event wKP3RSet(address _newWKP3R);\\n\\n /// @notice Throws when minter attempts to withdraw more wKP3R than the escrow has in its balance\\n error InsufficientBalance();\\n\\n /// @notice Lists the address of the wKP3R contract\\n /// @return _wKP3RAddress The address of wKP3R\\n function wKP3R() external view returns (address _wKP3RAddress);\\n\\n /// @notice Deposits wKP3R into the contract\\n /// @param _amount The amount of wKP3R to deposit\\n function deposit(uint256 _amount) external;\\n\\n /// @notice mints wKP3R to the recipient\\n /// @param _amount The amount of wKP3R to mint\\n function mint(uint256 _amount) external;\\n\\n /// @notice sets the wKP3R address\\n /// @param _wKP3R the wKP3R address\\n function setWKP3R(address _wKP3R) external;\\n}\\n\",\"keccak256\":\"0xf4796dde1afba7f50805aeae92ac0a4848525aeca8355d9b1c6b36c15cca4322\",\"license\":\"MIT\"}},\"version\":1}", - "bytecode": "0x608060405234801561001057600080fd5b50604051610b1a380380610b1a83398101604081905261002f916100ab565b81806001600160a01b0381166100575760405162b293ed60e81b815260040160405180910390fd5b600080546001600160a01b039283166001600160a01b0319918216179091556003805494909216931692909217909155506100de9050565b80516001600160a01b03811681146100a657600080fd5b919050565b600080604083850312156100be57600080fd5b6100c78361008f565b91506100d56020840161008f565b90509250929050565b610a2d806100ed6000396000f3fe608060405234801561001057600080fd5b50600436106100995760003560e01c8063075461721461009e57806321316064146100c7578063238efcbc146100dc5780635aa6e675146100e4578063966abd00146100f7578063a0712d681461010a578063ab033ea91461011d578063b509ec4514610130578063b6b55f2514610143578063f39c38a014610156578063fca3b5aa14610169575b600080fd5b6002546100b1906001600160a01b031681565b6040516100be9190610960565b60405180910390f35b6100da6100d53660046108b2565b61017c565b005b6100da610225565b6000546100b1906001600160a01b031681565b6100da6101053660046108cd565b6102b1565b6100da61011836600461092b565b6103c7565b6100da61012b3660046108b2565b61044a565b6003546100b1906001600160a01b031681565b6100da61015136600461092b565b6104c0565b6001546100b1906001600160a01b031681565b6100da6101773660046108b2565b610519565b6000546001600160a01b031633146101a7576040516354348f0360e01b815260040160405180910390fd5b6001600160a01b0381166101ce5760405163d92e233d60e01b815260040160405180910390fd5b600380546001600160a01b0319166001600160a01b0383169081179091556040517f8592ade84fad7cc1c020f9783980e05e1be8bf3c0b6b557f3f5d5b48b51476479161021a91610960565b60405180910390a150565b6001546001600160a01b0316331461025057604051637ef5703160e11b815260040160405180910390fd5b60018054600080546001600160a01b0383166001600160a01b031991821681179092559091169091556040517fc73be659241aade67e9a059bcf21494955018b213dbd1179054ccf928b13f3b6916102a791610960565b60405180910390a1565b6000546001600160a01b031633146102dc576040516354348f0360e01b815260040160405180910390fd5b6001600160a01b0381166103035760405163d92e233d60e01b815260040160405180910390fd5b6001600160a01b03831673eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee1415610364576040516001600160a01b0382169083156108fc029084906000818181858888f1935050505015801561035e573d6000803e3d6000fd5b50610378565b6103786001600160a01b03841682846105b6565b604080516001600160a01b0385811682526020820185905283168183015290517f9a3055ded8c8b5f21bbf4946c5afab6e1fa8b3f057922658e5e1ade125fb0b1e9181900360600190a1505050565b6002546001600160a01b031633146103f257604051639cdc2ed560e01b815260040160405180910390fd5b600354610409906001600160a01b031633836105b6565b6003546040517f5c5d429f40d64606e3af1c2373aa5f5b0846566f2bb3871dcccf094850ed4fc89161021a916001600160a01b039091169033908590610974565b6000546001600160a01b03163314610475576040516354348f0360e01b815260040160405180910390fd5b600180546001600160a01b0319166001600160a01b0383161790556040517fe987aaedf9d279143bdf1eee16cf1d0feb47742867d81083df8d6cd0a5ac857f9061021a908390610960565b6003546104d8906001600160a01b031633308461061e565b6003546040517fb0c9218af42df0588074c7f30948dd6d1293a5ef42e7762e83d62c5daa7c9b849161021a916001600160a01b039091169033908590610974565b6000546001600160a01b03163314610544576040516354348f0360e01b815260040160405180910390fd5b6001600160a01b03811661056b5760405163d92e233d60e01b815260040160405180910390fd5b600280546001600160a01b0319166001600160a01b0383161790556040517f726b590ef91a8c76ad05bbe91a57ef84605276528f49cd47d787f558a4e755b69061021a908390610960565b6040516001600160a01b03831660248201526044810182905261061990849063a9059cbb60e01b906064015b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b031990931692909217909152610645565b505050565b61063f846323b872dd60e01b8585856040516024016105e293929190610974565b50505050565b600061069a826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b031661071c9092919063ffffffff16565b80519091501561061957808060200190518101906106b89190610909565b6106195760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b60648201526084015b60405180910390fd5b606061072b8484600085610735565b90505b9392505050565b6060824710156107965760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f6044820152651c8818d85b1b60d21b6064820152608401610713565b843b6107e45760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606401610713565b600080866001600160a01b031685876040516108009190610944565b60006040518083038185875af1925050503d806000811461083d576040519150601f19603f3d011682016040523d82523d6000602084013e610842565b606091505b509150915061085282828661085d565b979650505050505050565b6060831561086c57508161072e565b82511561087c5782518084602001fd5b8160405162461bcd60e51b81526004016107139190610998565b80356001600160a01b03811681146108ad57600080fd5b919050565b6000602082840312156108c457600080fd5b61072e82610896565b6000806000606084860312156108e257600080fd5b6108eb84610896565b92506020840135915061090060408501610896565b90509250925092565b60006020828403121561091b57600080fd5b8151801515811461072e57600080fd5b60006020828403121561093d57600080fd5b5035919050565b600082516109568184602087016109cb565b9190910192915050565b6001600160a01b0391909116815260200190565b6001600160a01b039384168152919092166020820152604081019190915260600190565b60208152600082518060208401526109b78160408501602087016109cb565b601f01601f19169190910160400192915050565b60005b838110156109e65781810151838201526020016109ce565b8381111561063f575050600091015256fea2646970667358221220f27662244867a849ca4b8b284ad15a4e1cf161566f3c6c1a40cca8dd7d21eaee64736f6c63430008070033", - "deployedBytecode": "0x608060405234801561001057600080fd5b50600436106100995760003560e01c8063075461721461009e57806321316064146100c7578063238efcbc146100dc5780635aa6e675146100e4578063966abd00146100f7578063a0712d681461010a578063ab033ea91461011d578063b509ec4514610130578063b6b55f2514610143578063f39c38a014610156578063fca3b5aa14610169575b600080fd5b6002546100b1906001600160a01b031681565b6040516100be9190610960565b60405180910390f35b6100da6100d53660046108b2565b61017c565b005b6100da610225565b6000546100b1906001600160a01b031681565b6100da6101053660046108cd565b6102b1565b6100da61011836600461092b565b6103c7565b6100da61012b3660046108b2565b61044a565b6003546100b1906001600160a01b031681565b6100da61015136600461092b565b6104c0565b6001546100b1906001600160a01b031681565b6100da6101773660046108b2565b610519565b6000546001600160a01b031633146101a7576040516354348f0360e01b815260040160405180910390fd5b6001600160a01b0381166101ce5760405163d92e233d60e01b815260040160405180910390fd5b600380546001600160a01b0319166001600160a01b0383169081179091556040517f8592ade84fad7cc1c020f9783980e05e1be8bf3c0b6b557f3f5d5b48b51476479161021a91610960565b60405180910390a150565b6001546001600160a01b0316331461025057604051637ef5703160e11b815260040160405180910390fd5b60018054600080546001600160a01b0383166001600160a01b031991821681179092559091169091556040517fc73be659241aade67e9a059bcf21494955018b213dbd1179054ccf928b13f3b6916102a791610960565b60405180910390a1565b6000546001600160a01b031633146102dc576040516354348f0360e01b815260040160405180910390fd5b6001600160a01b0381166103035760405163d92e233d60e01b815260040160405180910390fd5b6001600160a01b03831673eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee1415610364576040516001600160a01b0382169083156108fc029084906000818181858888f1935050505015801561035e573d6000803e3d6000fd5b50610378565b6103786001600160a01b03841682846105b6565b604080516001600160a01b0385811682526020820185905283168183015290517f9a3055ded8c8b5f21bbf4946c5afab6e1fa8b3f057922658e5e1ade125fb0b1e9181900360600190a1505050565b6002546001600160a01b031633146103f257604051639cdc2ed560e01b815260040160405180910390fd5b600354610409906001600160a01b031633836105b6565b6003546040517f5c5d429f40d64606e3af1c2373aa5f5b0846566f2bb3871dcccf094850ed4fc89161021a916001600160a01b039091169033908590610974565b6000546001600160a01b03163314610475576040516354348f0360e01b815260040160405180910390fd5b600180546001600160a01b0319166001600160a01b0383161790556040517fe987aaedf9d279143bdf1eee16cf1d0feb47742867d81083df8d6cd0a5ac857f9061021a908390610960565b6003546104d8906001600160a01b031633308461061e565b6003546040517fb0c9218af42df0588074c7f30948dd6d1293a5ef42e7762e83d62c5daa7c9b849161021a916001600160a01b039091169033908590610974565b6000546001600160a01b03163314610544576040516354348f0360e01b815260040160405180910390fd5b6001600160a01b03811661056b5760405163d92e233d60e01b815260040160405180910390fd5b600280546001600160a01b0319166001600160a01b0383161790556040517f726b590ef91a8c76ad05bbe91a57ef84605276528f49cd47d787f558a4e755b69061021a908390610960565b6040516001600160a01b03831660248201526044810182905261061990849063a9059cbb60e01b906064015b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b031990931692909217909152610645565b505050565b61063f846323b872dd60e01b8585856040516024016105e293929190610974565b50505050565b600061069a826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b031661071c9092919063ffffffff16565b80519091501561061957808060200190518101906106b89190610909565b6106195760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b60648201526084015b60405180910390fd5b606061072b8484600085610735565b90505b9392505050565b6060824710156107965760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f6044820152651c8818d85b1b60d21b6064820152608401610713565b843b6107e45760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606401610713565b600080866001600160a01b031685876040516108009190610944565b60006040518083038185875af1925050503d806000811461083d576040519150601f19603f3d011682016040523d82523d6000602084013e610842565b606091505b509150915061085282828661085d565b979650505050505050565b6060831561086c57508161072e565b82511561087c5782518084602001fd5b8160405162461bcd60e51b81526004016107139190610998565b80356001600160a01b03811681146108ad57600080fd5b919050565b6000602082840312156108c457600080fd5b61072e82610896565b6000806000606084860312156108e257600080fd5b6108eb84610896565b92506020840135915061090060408501610896565b90509250925092565b60006020828403121561091b57600080fd5b8151801515811461072e57600080fd5b60006020828403121561093d57600080fd5b5035919050565b600082516109568184602087016109cb565b9190910192915050565b6001600160a01b0391909116815260200190565b6001600160a01b039384168152919092166020820152604081019190915260600190565b60208152600082518060208401526109b78160408501602087016109cb565b601f01601f19169190910160400192915050565b60005b838110156109e65781810151838201526020016109ce565b8381111561063f575050600091015256fea2646970667358221220f27662244867a849ca4b8b284ad15a4e1cf161566f3c6c1a40cca8dd7d21eaee64736f6c63430008070033", - "devdoc": { - "kind": "dev", - "methods": { - "constructor": { - "params": { - "_governance": "Address of governance", - "_wKP3R": "Address of wrapped KP3R implementation" - } - }, - "deposit(uint256)": { - "params": { - "_amount": "The amount of wKP3R to deposit" - } - }, - "mint(uint256)": { - "params": { - "_amount": "The amount of wKP3R to mint" - } - }, - "sendDust(address,uint256,address)": { - "params": { - "_amount": "The amount of the token that will be transferred", - "_to": "The address that will receive the idle funds", - "_token": "The token that will be transferred" - } - }, - "setGovernance(address)": { - "params": { - "_governance": "The address being proposed as the new governance" - } - }, - "setMinter(address)": { - "params": { - "_minter": "The address set as the minter" - } - }, - "setWKP3R(address)": { - "params": { - "_wKP3R": "the wKP3R address" - } - } - }, - "stateVariables": { - "wKP3R": { - "return": "_wKP3RAddress The address of wKP3R", - "returns": { - "_0": "_wKP3RAddress The address of wKP3R" - } - } - }, - "version": 1 - }, - "userdoc": { - "errors": { - "InsufficientBalance()": [ - { - "notice": "Throws when minter attempts to withdraw more wKP3R than the escrow has in its balance" - } - ], - "NoGovernanceZeroAddress()": [ - { - "notice": "Throws if trying to set governance to zero address" - } - ], - "OnlyGovernance()": [ - { - "notice": "Throws if the caller of the function is not governance" - } - ], - "OnlyMinter()": [ - { - "notice": "Throws if the caller of the function is not the minter" - } - ], - "OnlyPendingGovernance()": [ - { - "notice": "Throws if the caller of the function is not pendingGovernance" - } - ], - "ZeroAddress()": [ - { - "notice": "Throws if a variable is assigned to the zero address" - } - ] - }, - "events": { - "DustSent(address,uint256,address)": { - "notice": "Emitted when dust is sent" - }, - "GovernanceProposal(address)": { - "notice": "Emitted when a new governance is proposed" - }, - "GovernanceSet(address)": { - "notice": "Emitted when pendingGovernance accepts to be governance" - }, - "MinterSet(address)": { - "notice": "Emitted when governance sets a new minter" - }, - "wKP3RDeposited(address,address,uint256)": { - "notice": "Emitted when Keep3rEscrow#deposit function is called" - }, - "wKP3RMinted(address,address,uint256)": { - "notice": "Emitted when Keep3rEscrow#mint function is called" - }, - "wKP3RSet(address)": { - "notice": "Emitted when Keep3rEscrow#setWKP3R function is called" - } - }, - "kind": "user", - "methods": { - "acceptGovernance()": { - "notice": "Changes the governance from the current governance to the previously proposed address" - }, - "deposit(uint256)": { - "notice": "Deposits wKP3R into the contract" - }, - "governance()": { - "notice": "Stores the governance address" - }, - "mint(uint256)": { - "notice": "mints wKP3R to the recipient" - }, - "minter()": { - "notice": "Stores the minter address" - }, - "pendingGovernance()": { - "notice": "Stores the pendingGovernance address" - }, - "sendDust(address,uint256,address)": { - "notice": "Allows an authorized user to transfer the tokens or eth that may have been left in a contract" - }, - "setGovernance(address)": { - "notice": "Proposes a new address to be governance" - }, - "setMinter(address)": { - "notice": "Sets a new address to be the minter" - }, - "setWKP3R(address)": { - "notice": "sets the wKP3R address" - }, - "wKP3R()": { - "notice": "Lists the address of the wKP3R contract" - } - }, - "version": 1 - }, - "storageLayout": { - "storage": [ - { - "astId": 5362, - "contract": "solidity/contracts/sidechain/Keep3rEscrow.sol:Keep3rEscrow", - "label": "governance", - "offset": 0, - "slot": "0", - "type": "t_address" - }, - { - "astId": 5366, - "contract": "solidity/contracts/sidechain/Keep3rEscrow.sol:Keep3rEscrow", - "label": "pendingGovernance", - "offset": 0, - "slot": "1", - "type": "t_address" - }, - { - "astId": 6185, - "contract": "solidity/contracts/sidechain/Keep3rEscrow.sol:Keep3rEscrow", - "label": "minter", - "offset": 0, - "slot": "2", - "type": "t_address" - }, - { - "astId": 9638, - "contract": "solidity/contracts/sidechain/Keep3rEscrow.sol:Keep3rEscrow", - "label": "wKP3R", - "offset": 0, - "slot": "3", - "type": "t_address" - } - ], - "types": { - "t_address": { - "encoding": "inplace", - "label": "address", - "numberOfBytes": "20" - } - } - } -} \ No newline at end of file diff --git a/deployments/optimisticGoerli/Keep3rHelperSidechain.json b/deployments/optimisticGoerli/Keep3rHelperSidechain.json deleted file mode 100644 index d7f4e07..0000000 --- a/deployments/optimisticGoerli/Keep3rHelperSidechain.json +++ /dev/null @@ -1,1548 +0,0 @@ -{ - "address": "0x399394ca069dCDE2C4d2a32E00a06C3D5fE17E3A", - "abi": [ - { - "inputs": [ - { - "internalType": "address", - "name": "_keep3rV2", - "type": "address" - }, - { - "internalType": "address", - "name": "_governance", - "type": "address" - }, - { - "internalType": "address", - "name": "_kp3r", - "type": "address" - }, - { - "internalType": "address", - "name": "_weth", - "type": "address" - }, - { - "internalType": "address", - "name": "_kp3rWethOracle", - "type": "address" - }, - { - "internalType": "address", - "name": "_wethUsdOracle", - "type": "address" - } - ], - "stateMutability": "nonpayable", - "type": "constructor" - }, - { - "inputs": [], - "name": "InvalidOraclePool", - "type": "error" - }, - { - "inputs": [], - "name": "LiquidityPairInvalid", - "type": "error" - }, - { - "inputs": [], - "name": "NoGovernanceZeroAddress", - "type": "error" - }, - { - "inputs": [], - "name": "OnlyGovernance", - "type": "error" - }, - { - "inputs": [], - "name": "OnlyPendingGovernance", - "type": "error" - }, - { - "inputs": [], - "name": "ZeroAddress", - "type": "error" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "address", - "name": "_pendingGovernance", - "type": "address" - } - ], - "name": "GovernanceProposal", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "address", - "name": "_governance", - "type": "address" - } - ], - "name": "GovernanceSet", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "address", - "name": "_keep3rV2", - "type": "address" - } - ], - "name": "Keep3rV2Change", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "address", - "name": "_address", - "type": "address" - }, - { - "indexed": false, - "internalType": "bool", - "name": "_isKP3RToken0", - "type": "bool" - } - ], - "name": "Kp3rWethPoolChange", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "uint256", - "name": "_maxBoost", - "type": "uint256" - } - ], - "name": "MaxBoostChange", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "uint256", - "name": "_minBaseFee", - "type": "uint256" - } - ], - "name": "MinBaseFeeChange", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "uint256", - "name": "_minBoost", - "type": "uint256" - } - ], - "name": "MinBoostChange", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "uint256", - "name": "_minPriorityFee", - "type": "uint256" - } - ], - "name": "MinPriorityFeeChange", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "address", - "name": "_liquidity", - "type": "address" - }, - { - "indexed": false, - "internalType": "address", - "name": "_oraclePool", - "type": "address" - } - ], - "name": "OracleSet", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "uint32", - "name": "_quoteTwapTime", - "type": "uint32" - } - ], - "name": "QuoteTwapTimeChange", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "uint256", - "name": "_targetBond", - "type": "uint256" - } - ], - "name": "TargetBondChange", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "address", - "name": "_address", - "type": "address" - }, - { - "indexed": false, - "internalType": "bool", - "name": "_isWETHToken0", - "type": "bool" - } - ], - "name": "WethUSDPoolChange", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "uint256", - "name": "_workExtraGas", - "type": "uint256" - } - ], - "name": "WorkExtraGasChange", - "type": "event" - }, - { - "inputs": [], - "name": "BOOST_BASE", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "KP3R", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "WETH", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "acceptGovernance", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_keeper", - "type": "address" - } - ], - "name": "bonds", - "outputs": [ - { - "internalType": "uint256", - "name": "_amountBonded", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "_liquidityAmount", - "type": "uint256" - }, - { - "internalType": "int56", - "name": "_tickDifference", - "type": "int56" - }, - { - "internalType": "uint256", - "name": "_timeInterval", - "type": "uint256" - } - ], - "name": "getKP3RsAtTick", - "outputs": [ - { - "internalType": "uint256", - "name": "_kp3rAmount", - "type": "uint256" - } - ], - "stateMutability": "pure", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "_bonds", - "type": "uint256" - } - ], - "name": "getPaymentParams", - "outputs": [ - { - "internalType": "uint256", - "name": "_boost", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "_oneUsdQuote", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "_extraGas", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_pool", - "type": "address" - } - ], - "name": "getPoolTokens", - "outputs": [ - { - "internalType": "address", - "name": "_token0", - "type": "address" - }, - { - "internalType": "address", - "name": "_token1", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint128", - "name": "_baseAmount", - "type": "uint128" - }, - { - "internalType": "int56", - "name": "_tickDifference", - "type": "int56" - }, - { - "internalType": "uint256", - "name": "_timeInterval", - "type": "uint256" - } - ], - "name": "getQuoteAtTick", - "outputs": [ - { - "internalType": "uint256", - "name": "_quoteAmount", - "type": "uint256" - } - ], - "stateMutability": "pure", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "_gasUsed", - "type": "uint256" - } - ], - "name": "getRewardAmount", - "outputs": [ - { - "internalType": "uint256", - "name": "_amount", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_keeper", - "type": "address" - }, - { - "internalType": "uint256", - "name": "_gasUsed", - "type": "uint256" - } - ], - "name": "getRewardAmountFor", - "outputs": [ - { - "internalType": "uint256", - "name": "_kp3r", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "_bonds", - "type": "uint256" - } - ], - "name": "getRewardBoostFor", - "outputs": [ - { - "internalType": "uint256", - "name": "_rewardBoost", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "governance", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_pool", - "type": "address" - } - ], - "name": "isKP3RToken0", - "outputs": [ - { - "internalType": "bool", - "name": "_isKP3RToken0", - "type": "bool" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "keep3rV2", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "kp3rWethPool", - "outputs": [ - { - "internalType": "address", - "name": "poolAddress", - "type": "address" - }, - { - "internalType": "bool", - "name": "isTKNToken0", - "type": "bool" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "maxBoost", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "minBaseFee", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "minBoost", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "minPriorityFee", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_pool", - "type": "address" - }, - { - "internalType": "uint32[]", - "name": "_secondsAgo", - "type": "uint32[]" - } - ], - "name": "observe", - "outputs": [ - { - "internalType": "int56", - "name": "_tickCumulative1", - "type": "int56" - }, - { - "internalType": "int56", - "name": "_tickCumulative2", - "type": "int56" - }, - { - "internalType": "bool", - "name": "_success", - "type": "bool" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "name": "oracle", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "pendingGovernance", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "_eth", - "type": "uint256" - } - ], - "name": "quote", - "outputs": [ - { - "internalType": "uint256", - "name": "_amountOut", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "quoteTwapTime", - "outputs": [ - { - "internalType": "uint32", - "name": "", - "type": "uint32" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "_usd", - "type": "uint256" - } - ], - "name": "quoteUsdToEth", - "outputs": [ - { - "internalType": "uint256", - "name": "_amountOut", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_governance", - "type": "address" - } - ], - "name": "setGovernance", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_keep3rV2", - "type": "address" - } - ], - "name": "setKeep3rV2", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_poolAddress", - "type": "address" - } - ], - "name": "setKp3rWethPool", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "_maxBoost", - "type": "uint256" - } - ], - "name": "setMaxBoost", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "_minBaseFee", - "type": "uint256" - } - ], - "name": "setMinBaseFee", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "_minBoost", - "type": "uint256" - } - ], - "name": "setMinBoost", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "_minPriorityFee", - "type": "uint256" - } - ], - "name": "setMinPriorityFee", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_liquidity", - "type": "address" - }, - { - "internalType": "address", - "name": "_oracle", - "type": "address" - } - ], - "name": "setOracle", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint32", - "name": "_quoteTwapTime", - "type": "uint32" - } - ], - "name": "setQuoteTwapTime", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "_targetBond", - "type": "uint256" - } - ], - "name": "setTargetBond", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_poolAddress", - "type": "address" - } - ], - "name": "setWethUsdPool", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "_workExtraGas", - "type": "uint256" - } - ], - "name": "setWorkExtraGas", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [], - "name": "targetBond", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "wethUSDPool", - "outputs": [ - { - "internalType": "address", - "name": "poolAddress", - "type": "address" - }, - { - "internalType": "bool", - "name": "isTKNToken0", - "type": "bool" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "workExtraGas", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - } - ], - "transactionHash": "0x140e28be60d0f3e1c436f07b4ed24d38d4631a34dca88b8551f7800254f20b09", - "receipt": { - "to": null, - "from": "0x258b180E741157763236F5277619D71ECf00B906", - "contractAddress": "0x399394ca069dCDE2C4d2a32E00a06C3D5fE17E3A", - "transactionIndex": 0, - "gasUsed": "2156048", - "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000040000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000104000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000010000000000000000000000100000000000000000000000000000000000200000000000000000000000000000000000000008000000000000000000", - "blockHash": "0x24e734410564053a067d33b5f00a1e4aecc1de50263bd5b75fba51bec2c66df8", - "transactionHash": "0x140e28be60d0f3e1c436f07b4ed24d38d4631a34dca88b8551f7800254f20b09", - "logs": [ - { - "transactionIndex": 0, - "blockNumber": 3238158, - "transactionHash": "0x140e28be60d0f3e1c436f07b4ed24d38d4631a34dca88b8551f7800254f20b09", - "address": "0x399394ca069dCDE2C4d2a32E00a06C3D5fE17E3A", - "topics": [ - "0x554c636366d5fc882a9ab4b7b9d5181781d1a7076abe50ed410365620dcf4108" - ], - "data": "0x0000000000000000000000004ecff2c532d47d7be3d957e4a332ab134cad1fd90000000000000000000000000000000000000000000000000000000000000001", - "logIndex": 0, - "blockHash": "0x24e734410564053a067d33b5f00a1e4aecc1de50263bd5b75fba51bec2c66df8" - }, - { - "transactionIndex": 0, - "blockNumber": 3238158, - "transactionHash": "0x140e28be60d0f3e1c436f07b4ed24d38d4631a34dca88b8551f7800254f20b09", - "address": "0x399394ca069dCDE2C4d2a32E00a06C3D5fE17E3A", - "topics": [ - "0xc806e26fb64e3a95f4b70abf4d87280555696244d01068b5f45b0e515aceb1de" - ], - "data": "0x0000000000000000000000000000000000000000000000000000000000015180", - "logIndex": 1, - "blockHash": "0x24e734410564053a067d33b5f00a1e4aecc1de50263bd5b75fba51bec2c66df8" - } - ], - "blockNumber": 3238158, - "cumulativeGasUsed": "2156048", - "status": 1, - "byzantium": true - }, - "args": [ - "0x85063437C02Ba7F4f82F898859e4992380DEd3bb", - "0x258b180E741157763236F5277619D71ECf00B906", - "0x16F63C5036d3F48A239358656a8f123eCE85789C", - "0xB4FBF271143F4FBf7B91A5ded31805e42b2208d6", - "0x4ECFF2c532d47D7be3D957E4a332AB134cad1fd9", - "0x4ECFF2c532d47D7be3D957E4a332AB134cad1fd9" - ], - "numDeployments": 1, - "solcInputHash": "7d006d28afea8f44b7106e2df679db88", - "metadata": "{\"compiler\":{\"version\":\"0.8.7+commit.e28d00a7\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_keep3rV2\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"_governance\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"_kp3r\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"_weth\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"_kp3rWethOracle\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"_wethUsdOracle\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"inputs\":[],\"name\":\"InvalidOraclePool\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"LiquidityPairInvalid\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"NoGovernanceZeroAddress\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"OnlyGovernance\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"OnlyPendingGovernance\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"ZeroAddress\",\"type\":\"error\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"_pendingGovernance\",\"type\":\"address\"}],\"name\":\"GovernanceProposal\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"_governance\",\"type\":\"address\"}],\"name\":\"GovernanceSet\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"_keep3rV2\",\"type\":\"address\"}],\"name\":\"Keep3rV2Change\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"_address\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"bool\",\"name\":\"_isKP3RToken0\",\"type\":\"bool\"}],\"name\":\"Kp3rWethPoolChange\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"_maxBoost\",\"type\":\"uint256\"}],\"name\":\"MaxBoostChange\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"_minBaseFee\",\"type\":\"uint256\"}],\"name\":\"MinBaseFeeChange\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"_minBoost\",\"type\":\"uint256\"}],\"name\":\"MinBoostChange\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"_minPriorityFee\",\"type\":\"uint256\"}],\"name\":\"MinPriorityFeeChange\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"_liquidity\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"_oraclePool\",\"type\":\"address\"}],\"name\":\"OracleSet\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint32\",\"name\":\"_quoteTwapTime\",\"type\":\"uint32\"}],\"name\":\"QuoteTwapTimeChange\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"_targetBond\",\"type\":\"uint256\"}],\"name\":\"TargetBondChange\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"_address\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"bool\",\"name\":\"_isWETHToken0\",\"type\":\"bool\"}],\"name\":\"WethUSDPoolChange\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"_workExtraGas\",\"type\":\"uint256\"}],\"name\":\"WorkExtraGasChange\",\"type\":\"event\"},{\"inputs\":[],\"name\":\"BOOST_BASE\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"KP3R\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"WETH\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"acceptGovernance\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_keeper\",\"type\":\"address\"}],\"name\":\"bonds\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"_amountBonded\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_liquidityAmount\",\"type\":\"uint256\"},{\"internalType\":\"int56\",\"name\":\"_tickDifference\",\"type\":\"int56\"},{\"internalType\":\"uint256\",\"name\":\"_timeInterval\",\"type\":\"uint256\"}],\"name\":\"getKP3RsAtTick\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"_kp3rAmount\",\"type\":\"uint256\"}],\"stateMutability\":\"pure\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_bonds\",\"type\":\"uint256\"}],\"name\":\"getPaymentParams\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"_boost\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"_oneUsdQuote\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"_extraGas\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_pool\",\"type\":\"address\"}],\"name\":\"getPoolTokens\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"_token0\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"_token1\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint128\",\"name\":\"_baseAmount\",\"type\":\"uint128\"},{\"internalType\":\"int56\",\"name\":\"_tickDifference\",\"type\":\"int56\"},{\"internalType\":\"uint256\",\"name\":\"_timeInterval\",\"type\":\"uint256\"}],\"name\":\"getQuoteAtTick\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"_quoteAmount\",\"type\":\"uint256\"}],\"stateMutability\":\"pure\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_gasUsed\",\"type\":\"uint256\"}],\"name\":\"getRewardAmount\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"_amount\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_keeper\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"_gasUsed\",\"type\":\"uint256\"}],\"name\":\"getRewardAmountFor\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"_kp3r\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_bonds\",\"type\":\"uint256\"}],\"name\":\"getRewardBoostFor\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"_rewardBoost\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"governance\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_pool\",\"type\":\"address\"}],\"name\":\"isKP3RToken0\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"_isKP3RToken0\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"keep3rV2\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"kp3rWethPool\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"poolAddress\",\"type\":\"address\"},{\"internalType\":\"bool\",\"name\":\"isTKNToken0\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"maxBoost\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"minBaseFee\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"minBoost\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"minPriorityFee\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_pool\",\"type\":\"address\"},{\"internalType\":\"uint32[]\",\"name\":\"_secondsAgo\",\"type\":\"uint32[]\"}],\"name\":\"observe\",\"outputs\":[{\"internalType\":\"int56\",\"name\":\"_tickCumulative1\",\"type\":\"int56\"},{\"internalType\":\"int56\",\"name\":\"_tickCumulative2\",\"type\":\"int56\"},{\"internalType\":\"bool\",\"name\":\"_success\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"oracle\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"pendingGovernance\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_eth\",\"type\":\"uint256\"}],\"name\":\"quote\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"_amountOut\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"quoteTwapTime\",\"outputs\":[{\"internalType\":\"uint32\",\"name\":\"\",\"type\":\"uint32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_usd\",\"type\":\"uint256\"}],\"name\":\"quoteUsdToEth\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"_amountOut\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_governance\",\"type\":\"address\"}],\"name\":\"setGovernance\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_keep3rV2\",\"type\":\"address\"}],\"name\":\"setKeep3rV2\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_poolAddress\",\"type\":\"address\"}],\"name\":\"setKp3rWethPool\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_maxBoost\",\"type\":\"uint256\"}],\"name\":\"setMaxBoost\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_minBaseFee\",\"type\":\"uint256\"}],\"name\":\"setMinBaseFee\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_minBoost\",\"type\":\"uint256\"}],\"name\":\"setMinBoost\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_minPriorityFee\",\"type\":\"uint256\"}],\"name\":\"setMinPriorityFee\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_liquidity\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"_oracle\",\"type\":\"address\"}],\"name\":\"setOracle\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint32\",\"name\":\"_quoteTwapTime\",\"type\":\"uint32\"}],\"name\":\"setQuoteTwapTime\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_targetBond\",\"type\":\"uint256\"}],\"name\":\"setTargetBond\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_poolAddress\",\"type\":\"address\"}],\"name\":\"setWethUsdPool\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_workExtraGas\",\"type\":\"uint256\"}],\"name\":\"setWorkExtraGas\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"targetBond\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"wethUSDPool\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"poolAddress\",\"type\":\"address\"},{\"internalType\":\"bool\",\"name\":\"isTKNToken0\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"workExtraGas\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"}],\"devdoc\":{\"kind\":\"dev\",\"methods\":{\"bonds(address)\":{\"params\":{\"_keeper\":\"The address of the keeper to check\"},\"returns\":{\"_amountBonded\":\"The amount of KP3R the keeper has bonded\"}},\"constructor\":{\"details\":\"Oracle pools should use 18 decimals tokens\",\"params\":{\"_governance\":\"Address of governance\",\"_keep3rV2\":\"Address of sidechain Keep3r implementation\",\"_kp3rWethOracle\":\"Address of oracle used for KP3R/WETH quote\",\"_wethUsdOracle\":\"Address of oracle used for WETH/USD quote\"}},\"getKP3RsAtTick(uint256,int56,uint256)\":{\"params\":{\"_liquidityAmount\":\"Amount of liquidity to be converted\",\"_tickDifference\":\"Tick value used to calculate the quote\",\"_timeInterval\":\"Time value used to calculate the quote\"},\"returns\":{\"_kp3rAmount\":\"Amount of KP3R tokens underlying on the given liquidity\"}},\"getPaymentParams(uint256)\":{\"params\":{\"_bonds\":\"Amount of bonded KP3R owned by the keeper\"},\"returns\":{\"_boost\":\"Multiplier per gas unit. Takes into account the base fee and the amount of bonded KP3R\",\"_extraGas\":\"Amount of extra gas that should be added to the gas spent\",\"_oneUsdQuote\":\"Amount of KP3R tokens equivalent to 1 ETH\"}},\"getPoolTokens(address)\":{\"params\":{\"_pool\":\"Address of the correspondant pool\"},\"returns\":{\"_token0\":\"Address of the first token of the pair\",\"_token1\":\"Address of the second token of the pair\"}},\"getQuoteAtTick(uint128,int56,uint256)\":{\"params\":{\"_baseAmount\":\"Amount of token to be converted\",\"_tickDifference\":\"Tick value used to calculate the quote\",\"_timeInterval\":\"Time value used to calculate the quote\"},\"returns\":{\"_quoteAmount\":\"Amount of credits deserved for the baseAmount at the tick value\"}},\"getRewardAmount(uint256)\":{\"params\":{\"_gasUsed\":\"The amount of gas used that will be rewarded\"},\"returns\":{\"_amount\":\"The amount of KP3R that should be awarded to tx.origin\"}},\"getRewardAmountFor(address,uint256)\":{\"params\":{\"_gasUsed\":\"The amount of gas used that will be rewarded\",\"_keeper\":\"The address of the keeper to check\"},\"returns\":{\"_kp3r\":\"The amount of KP3R that should be awarded to the keeper\"}},\"getRewardBoostFor(uint256)\":{\"details\":\"If the keeper has no bonds, boost should be +10% of gas cost, if keeper has max bonds, +20%\",\"params\":{\"_bonds\":\"The amount of KP3R tokens bonded by the keeper\"},\"returns\":{\"_rewardBoost\":\"The reward boost that corresponds to the keeper\"}},\"isKP3RToken0(address)\":{\"params\":{\"_pool\":\"Address of the correspondant pool\"},\"returns\":{\"_isKP3RToken0\":\"Boolean indicating the order of the tokens in the pair\"}},\"observe(address,uint32[])\":{\"params\":{\"_pool\":\"Address of the pool to observe\",\"_secondsAgo\":\"Array with time references to observe\"},\"returns\":{\"_success\":\"Boolean indicating if the observe call was succesfull\",\"_tickCumulative1\":\"Cumulative sum of ticks until first time reference\",\"_tickCumulative2\":\"Cumulative sum of ticks until second time reference\"}},\"quote(uint256)\":{\"details\":\"This function allows us to calculate how much KP3R we should pay to a keeper for things expressed in ETH, like gas\",\"params\":{\"_eth\":\"The amount of ETH\"},\"returns\":{\"_amountOut\":\"The amount of KP3R\"}},\"quoteUsdToEth(uint256)\":{\"details\":\"Used to know how much ETH should be paid to keepers before converting it from ETH to KP3R\",\"params\":{\"_usd\":\"The amount of USD to quote to ETH\"},\"returns\":{\"_amountOut\":\"The resulting amount of ETH after quoting the USD\"}},\"setGovernance(address)\":{\"params\":{\"_governance\":\"The address being proposed as the new governance\"}},\"setKeep3rV2(address)\":{\"params\":{\"_keep3rV2\":\"The address of Keep3r V2\"}},\"setKp3rWethPool(address)\":{\"params\":{\"_poolAddress\":\"The address of the KP3R-WETH pool\"}},\"setMaxBoost(uint256)\":{\"params\":{\"_maxBoost\":\"The maximum boost multiplier\"}},\"setMinBaseFee(uint256)\":{\"params\":{\"_minBaseFee\":\"The minimum rewarded gas fee\"}},\"setMinBoost(uint256)\":{\"params\":{\"_minBoost\":\"The minimum boost multiplier\"}},\"setMinPriorityFee(uint256)\":{\"params\":{\"_minPriorityFee\":\"The minimum rewarded priority fee\"}},\"setOracle(address,address)\":{\"details\":\"The oracle must contain KP3R as either token0 or token1\",\"params\":{\"_liquidity\":\"The address of the liquidity\",\"_oracle\":\"The address of the pool used to quote the liquidity from\"}},\"setQuoteTwapTime(uint32)\":{\"params\":{\"_quoteTwapTime\":\"The twap time for quoting\"}},\"setTargetBond(uint256)\":{\"params\":{\"_targetBond\":\"The target bond amount\"}},\"setWethUsdPool(address)\":{\"details\":\"The oracle must contain WETH as either token0 or token1\",\"params\":{\"_poolAddress\":\"The address of the pool used as oracle\"}},\"setWorkExtraGas(uint256)\":{\"params\":{\"_workExtraGas\":\"The work extra gas\"}}},\"stateVariables\":{\"oracle\":{\"return\":\"_oracle The address of the observable pool for given liquidity\",\"returns\":{\"_0\":\"_oracle The address of the observable pool for given liquidity\"}},\"wethUSDPool\":{\"returns\":{\"isTKNToken0\":\"True if calling the token0 method of the pool returns the WETH token address\",\"poolAddress\":\"Address of the pool\"}}},\"version\":1},\"userdoc\":{\"errors\":{\"InvalidOraclePool()\":[{\"notice\":\"Throws when pool does not have KP3R as token0 nor token1\"}],\"LiquidityPairInvalid()\":[{\"notice\":\"Throws when none of the tokens in the liquidity pair is KP3R\"}],\"NoGovernanceZeroAddress()\":[{\"notice\":\"Throws if trying to set governance to zero address\"}],\"OnlyGovernance()\":[{\"notice\":\"Throws if the caller of the function is not governance\"}],\"OnlyPendingGovernance()\":[{\"notice\":\"Throws if the caller of the function is not pendingGovernance\"}],\"ZeroAddress()\":[{\"notice\":\"Throws if a variable is assigned to the zero address\"}]},\"events\":{\"GovernanceProposal(address)\":{\"notice\":\"Emitted when a new governance is proposed\"},\"GovernanceSet(address)\":{\"notice\":\"Emitted when pendingGovernance accepts to be governance\"},\"Keep3rV2Change(address)\":{\"notice\":\"Emitted when the Keep3r V2 address is changed\"},\"Kp3rWethPoolChange(address,bool)\":{\"notice\":\"Emitted when the kp3r weth pool is changed\"},\"MaxBoostChange(uint256)\":{\"notice\":\"Emitted when the maximum boost multiplier is changed\"},\"MinBaseFeeChange(uint256)\":{\"notice\":\"Emitted when minimum rewarded gas fee is changed\"},\"MinBoostChange(uint256)\":{\"notice\":\"Emitted when the minimum boost multiplier is changed\"},\"MinPriorityFeeChange(uint256)\":{\"notice\":\"Emitted when minimum rewarded priority fee is changed\"},\"OracleSet(address,address)\":{\"notice\":\"The oracle for a liquidity has been saved\"},\"QuoteTwapTimeChange(uint32)\":{\"notice\":\"Emitted when the quote twap time is changed\"},\"TargetBondChange(uint256)\":{\"notice\":\"Emitted when the target bond amount is changed\"},\"WethUSDPoolChange(address,bool)\":{\"notice\":\"Emitted when the WETH USD pool is changed\"},\"WorkExtraGasChange(uint256)\":{\"notice\":\"Emitted when the work extra gas amount is changed\"}},\"kind\":\"user\",\"methods\":{\"BOOST_BASE()\":{\"notice\":\"The boost base used to calculate the boost rewards for the keeper\"},\"KP3R()\":{\"notice\":\"Address of KP3R token\"},\"WETH()\":{\"notice\":\"Ethereum mainnet WETH address used for quoting references\"},\"acceptGovernance()\":{\"notice\":\"Changes the governance from the current governance to the previously proposed address\"},\"bonds(address)\":{\"notice\":\"Uses valid wKP3R address from Keep3rSidechain to query keeper bonds\"},\"getKP3RsAtTick(uint256,int56,uint256)\":{\"notice\":\"Given a tick and a liquidity amount, calculates the underlying KP3R tokens\"},\"getPaymentParams(uint256)\":{\"notice\":\"Get multiplier, quote, and extra, in order to calculate keeper payment\"},\"getPoolTokens(address)\":{\"notice\":\"Given a pool address, returns the underlying tokens of the pair\"},\"getQuoteAtTick(uint128,int56,uint256)\":{\"notice\":\"Given a tick and a token amount, calculates the output in correspondant token\"},\"getRewardAmount(uint256)\":{\"notice\":\"Calculates the reward (in KP3R) that corresponds to tx.origin for using gas\"},\"getRewardAmountFor(address,uint256)\":{\"notice\":\"Calculates the reward (in KP3R) that corresponds to a keeper for using gas\"},\"getRewardBoostFor(uint256)\":{\"notice\":\"Calculates the boost in the reward given to a keeper based on the amount of KP3R that keeper has bonded\"},\"governance()\":{\"notice\":\"Stores the governance address\"},\"isKP3RToken0(address)\":{\"notice\":\"Defines the order of the tokens in the pair for twap calculations\"},\"keep3rV2()\":{\"notice\":\"Address of Keep3r V2\"},\"kp3rWethPool()\":{\"notice\":\"KP3R-WETH pool that is being used as oracle\"},\"maxBoost()\":{\"notice\":\"The maximum multiplier used to calculate the amount of gas paid to the Keeper for the gas used to perform a job For example: if the quoted gas used is 1000, then the maximum amount to be paid will be 1000 * maxBoost / BOOST_BASE\"},\"minBaseFee()\":{\"notice\":\"The minimum base fee that is used to calculate keeper rewards\"},\"minBoost()\":{\"notice\":\"The minimum multiplier used to calculate the amount of gas paid to the Keeper for the gas used to perform a job For example: if the quoted gas used is 1000, then the minimum amount to be paid will be 1000 * minBoost / BOOST_BASE\"},\"minPriorityFee()\":{\"notice\":\"The minimum priority fee that is also rewarded for keepers\"},\"observe(address,uint32[])\":{\"notice\":\"Given an array of secondsAgo, returns UniswapV3 pool cumulatives at that moment\"},\"pendingGovernance()\":{\"notice\":\"Stores the pendingGovernance address\"},\"quote(uint256)\":{\"notice\":\"Calculates the amount of KP3R that corresponds to the ETH passed into the function\"},\"quoteTwapTime()\":{\"notice\":\"The twap time for quoting\"},\"quoteUsdToEth(uint256)\":{\"notice\":\"Quotes USD to ETH\"},\"setGovernance(address)\":{\"notice\":\"Proposes a new address to be governance\"},\"setKeep3rV2(address)\":{\"notice\":\"Sets the Keep3r V2 address\"},\"setKp3rWethPool(address)\":{\"notice\":\"Sets KP3R-WETH pool\"},\"setMaxBoost(uint256)\":{\"notice\":\"Sets the maximum boost multiplier\"},\"setMinBaseFee(uint256)\":{\"notice\":\"Sets the minimum rewarded gas fee\"},\"setMinBoost(uint256)\":{\"notice\":\"Sets the minimum boost multiplier\"},\"setMinPriorityFee(uint256)\":{\"notice\":\"Sets the minimum rewarded gas priority fee\"},\"setOracle(address,address)\":{\"notice\":\"Sets an oracle for a given liquidity\"},\"setQuoteTwapTime(uint32)\":{\"notice\":\"Sets the quote twap time\"},\"setTargetBond(uint256)\":{\"notice\":\"Sets the target bond amount\"},\"setWethUsdPool(address)\":{\"notice\":\"Sets an oracle for querying WETH/USD quote\"},\"setWorkExtraGas(uint256)\":{\"notice\":\"Sets the work extra gas amount\"},\"targetBond()\":{\"notice\":\"The targeted amount of bonded KP3Rs to max-up reward multiplier For example: if the amount of KP3R the keeper has bonded is targetBond or more, then the keeper will get the maximum boost possible in his rewards, if it's less, the reward boost will be proportional\"},\"wethUSDPool()\":{\"notice\":\"WETH-USD pool that is being used as oracle\"},\"workExtraGas()\":{\"notice\":\"The amount of unaccounted gas that is going to be added to keeper payments\"}},\"version\":1}},\"settings\":{\"compilationTarget\":{\"solidity/contracts/sidechain/Keep3rHelperSidechain.sol\":\"Keep3rHelperSidechain\"},\"evmVersion\":\"london\",\"libraries\":{\":__CACHE_BREAKER__\":\"0x00000000d41867734bbee4c6863d9255b2b06ac1\"},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":33},\"remappings\":[]},\"sources\":{\"@openzeppelin/contracts/token/ERC20/IERC20.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Interface of the ERC20 standard as defined in the EIP.\\n */\\ninterface IERC20 {\\n /**\\n * @dev Returns the amount of tokens in existence.\\n */\\n function totalSupply() external view returns (uint256);\\n\\n /**\\n * @dev Returns the amount of tokens owned by `account`.\\n */\\n function balanceOf(address account) external view returns (uint256);\\n\\n /**\\n * @dev Moves `amount` tokens from the caller's account to `recipient`.\\n *\\n * Returns a boolean value indicating whether the operation succeeded.\\n *\\n * Emits a {Transfer} event.\\n */\\n function transfer(address recipient, uint256 amount) external returns (bool);\\n\\n /**\\n * @dev Returns the remaining number of tokens that `spender` will be\\n * allowed to spend on behalf of `owner` through {transferFrom}. This is\\n * zero by default.\\n *\\n * This value changes when {approve} or {transferFrom} are called.\\n */\\n function allowance(address owner, address spender) external view returns (uint256);\\n\\n /**\\n * @dev Sets `amount` as the allowance of `spender` over the caller's tokens.\\n *\\n * Returns a boolean value indicating whether the operation succeeded.\\n *\\n * IMPORTANT: Beware that changing an allowance with this method brings the risk\\n * that someone may use both the old and the new allowance by unfortunate\\n * transaction ordering. One possible solution to mitigate this race\\n * condition is to first reduce the spender's allowance to 0 and set the\\n * desired value afterwards:\\n * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729\\n *\\n * Emits an {Approval} event.\\n */\\n function approve(address spender, uint256 amount) external returns (bool);\\n\\n /**\\n * @dev Moves `amount` tokens from `sender` to `recipient` using the\\n * allowance mechanism. `amount` is then deducted from the caller's\\n * allowance.\\n *\\n * Returns a boolean value indicating whether the operation succeeded.\\n *\\n * Emits a {Transfer} event.\\n */\\n function transferFrom(\\n address sender,\\n address recipient,\\n uint256 amount\\n ) external returns (bool);\\n\\n /**\\n * @dev Emitted when `value` tokens are moved from one account (`from`) to\\n * another (`to`).\\n *\\n * Note that `value` may be zero.\\n */\\n event Transfer(address indexed from, address indexed to, uint256 value);\\n\\n /**\\n * @dev Emitted when the allowance of a `spender` for an `owner` is set by\\n * a call to {approve}. `value` is the new allowance.\\n */\\n event Approval(address indexed owner, address indexed spender, uint256 value);\\n}\\n\",\"keccak256\":\"0x027b891937d20ccf213fdb9c31531574256de774bda99d3a70ecef6e1913ed2a\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../IERC20.sol\\\";\\n\\n/**\\n * @dev Interface for the optional metadata functions from the ERC20 standard.\\n *\\n * _Available since v4.1._\\n */\\ninterface IERC20Metadata is IERC20 {\\n /**\\n * @dev Returns the name of the token.\\n */\\n function name() external view returns (string memory);\\n\\n /**\\n * @dev Returns the symbol of the token.\\n */\\n function symbol() external view returns (string memory);\\n\\n /**\\n * @dev Returns the decimals places of the token.\\n */\\n function decimals() external view returns (uint8);\\n}\\n\",\"keccak256\":\"0x83fe24f5c04a56091e50f4a345ff504c8bff658a76d4c43b16878c8f940c53b2\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/math/Math.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Standard math utilities missing in the Solidity language.\\n */\\nlibrary Math {\\n /**\\n * @dev Returns the largest of two numbers.\\n */\\n function max(uint256 a, uint256 b) internal pure returns (uint256) {\\n return a >= b ? a : b;\\n }\\n\\n /**\\n * @dev Returns the smallest of two numbers.\\n */\\n function min(uint256 a, uint256 b) internal pure returns (uint256) {\\n return a < b ? a : b;\\n }\\n\\n /**\\n * @dev Returns the average of two numbers. The result is rounded towards\\n * zero.\\n */\\n function average(uint256 a, uint256 b) internal pure returns (uint256) {\\n // (a + b) / 2 can overflow.\\n return (a & b) + (a ^ b) / 2;\\n }\\n\\n /**\\n * @dev Returns the ceiling of the division of two numbers.\\n *\\n * This differs from standard division with `/` in that it rounds up instead\\n * of rounding down.\\n */\\n function ceilDiv(uint256 a, uint256 b) internal pure returns (uint256) {\\n // (a + b - 1) / b can overflow on addition, so we distribute.\\n return a / b + (a % b == 0 ? 0 : 1);\\n }\\n}\\n\",\"keccak256\":\"0x49ebdac5d515aebb95168564158940b79d7d5d12fbfe59cec546a00d57fee64a\",\"license\":\"MIT\"},\"@uniswap/v3-core/contracts/interfaces/IUniswapV3Pool.sol\":{\"content\":\"// SPDX-License-Identifier: GPL-2.0-or-later\\npragma solidity >=0.5.0;\\n\\nimport './pool/IUniswapV3PoolImmutables.sol';\\nimport './pool/IUniswapV3PoolState.sol';\\nimport './pool/IUniswapV3PoolDerivedState.sol';\\nimport './pool/IUniswapV3PoolActions.sol';\\nimport './pool/IUniswapV3PoolOwnerActions.sol';\\nimport './pool/IUniswapV3PoolEvents.sol';\\n\\n/// @title The interface for a Uniswap V3 Pool\\n/// @notice A Uniswap pool facilitates swapping and automated market making between any two assets that strictly conform\\n/// to the ERC20 specification\\n/// @dev The pool interface is broken up into many smaller pieces\\ninterface IUniswapV3Pool is\\n IUniswapV3PoolImmutables,\\n IUniswapV3PoolState,\\n IUniswapV3PoolDerivedState,\\n IUniswapV3PoolActions,\\n IUniswapV3PoolOwnerActions,\\n IUniswapV3PoolEvents\\n{\\n\\n}\\n\",\"keccak256\":\"0xfe6113d518466cd6652c85b111e01f33eb62157f49ae5ed7d5a3947a2044adb1\",\"license\":\"GPL-2.0-or-later\"},\"@uniswap/v3-core/contracts/interfaces/pool/IUniswapV3PoolActions.sol\":{\"content\":\"// SPDX-License-Identifier: GPL-2.0-or-later\\npragma solidity >=0.5.0;\\n\\n/// @title Permissionless pool actions\\n/// @notice Contains pool methods that can be called by anyone\\ninterface IUniswapV3PoolActions {\\n /// @notice Sets the initial price for the pool\\n /// @dev Price is represented as a sqrt(amountToken1/amountToken0) Q64.96 value\\n /// @param sqrtPriceX96 the initial sqrt price of the pool as a Q64.96\\n function initialize(uint160 sqrtPriceX96) external;\\n\\n /// @notice Adds liquidity for the given recipient/tickLower/tickUpper position\\n /// @dev The caller of this method receives a callback in the form of IUniswapV3MintCallback#uniswapV3MintCallback\\n /// in which they must pay any token0 or token1 owed for the liquidity. The amount of token0/token1 due depends\\n /// on tickLower, tickUpper, the amount of liquidity, and the current price.\\n /// @param recipient The address for which the liquidity will be created\\n /// @param tickLower The lower tick of the position in which to add liquidity\\n /// @param tickUpper The upper tick of the position in which to add liquidity\\n /// @param amount The amount of liquidity to mint\\n /// @param data Any data that should be passed through to the callback\\n /// @return amount0 The amount of token0 that was paid to mint the given amount of liquidity. Matches the value in the callback\\n /// @return amount1 The amount of token1 that was paid to mint the given amount of liquidity. Matches the value in the callback\\n function mint(\\n address recipient,\\n int24 tickLower,\\n int24 tickUpper,\\n uint128 amount,\\n bytes calldata data\\n ) external returns (uint256 amount0, uint256 amount1);\\n\\n /// @notice Collects tokens owed to a position\\n /// @dev Does not recompute fees earned, which must be done either via mint or burn of any amount of liquidity.\\n /// Collect must be called by the position owner. To withdraw only token0 or only token1, amount0Requested or\\n /// amount1Requested may be set to zero. To withdraw all tokens owed, caller may pass any value greater than the\\n /// actual tokens owed, e.g. type(uint128).max. Tokens owed may be from accumulated swap fees or burned liquidity.\\n /// @param recipient The address which should receive the fees collected\\n /// @param tickLower The lower tick of the position for which to collect fees\\n /// @param tickUpper The upper tick of the position for which to collect fees\\n /// @param amount0Requested How much token0 should be withdrawn from the fees owed\\n /// @param amount1Requested How much token1 should be withdrawn from the fees owed\\n /// @return amount0 The amount of fees collected in token0\\n /// @return amount1 The amount of fees collected in token1\\n function collect(\\n address recipient,\\n int24 tickLower,\\n int24 tickUpper,\\n uint128 amount0Requested,\\n uint128 amount1Requested\\n ) external returns (uint128 amount0, uint128 amount1);\\n\\n /// @notice Burn liquidity from the sender and account tokens owed for the liquidity to the position\\n /// @dev Can be used to trigger a recalculation of fees owed to a position by calling with an amount of 0\\n /// @dev Fees must be collected separately via a call to #collect\\n /// @param tickLower The lower tick of the position for which to burn liquidity\\n /// @param tickUpper The upper tick of the position for which to burn liquidity\\n /// @param amount How much liquidity to burn\\n /// @return amount0 The amount of token0 sent to the recipient\\n /// @return amount1 The amount of token1 sent to the recipient\\n function burn(\\n int24 tickLower,\\n int24 tickUpper,\\n uint128 amount\\n ) external returns (uint256 amount0, uint256 amount1);\\n\\n /// @notice Swap token0 for token1, or token1 for token0\\n /// @dev The caller of this method receives a callback in the form of IUniswapV3SwapCallback#uniswapV3SwapCallback\\n /// @param recipient The address to receive the output of the swap\\n /// @param zeroForOne The direction of the swap, true for token0 to token1, false for token1 to token0\\n /// @param amountSpecified The amount of the swap, which implicitly configures the swap as exact input (positive), or exact output (negative)\\n /// @param sqrtPriceLimitX96 The Q64.96 sqrt price limit. If zero for one, the price cannot be less than this\\n /// value after the swap. If one for zero, the price cannot be greater than this value after the swap\\n /// @param data Any data to be passed through to the callback\\n /// @return amount0 The delta of the balance of token0 of the pool, exact when negative, minimum when positive\\n /// @return amount1 The delta of the balance of token1 of the pool, exact when negative, minimum when positive\\n function swap(\\n address recipient,\\n bool zeroForOne,\\n int256 amountSpecified,\\n uint160 sqrtPriceLimitX96,\\n bytes calldata data\\n ) external returns (int256 amount0, int256 amount1);\\n\\n /// @notice Receive token0 and/or token1 and pay it back, plus a fee, in the callback\\n /// @dev The caller of this method receives a callback in the form of IUniswapV3FlashCallback#uniswapV3FlashCallback\\n /// @dev Can be used to donate underlying tokens pro-rata to currently in-range liquidity providers by calling\\n /// with 0 amount{0,1} and sending the donation amount(s) from the callback\\n /// @param recipient The address which will receive the token0 and token1 amounts\\n /// @param amount0 The amount of token0 to send\\n /// @param amount1 The amount of token1 to send\\n /// @param data Any data to be passed through to the callback\\n function flash(\\n address recipient,\\n uint256 amount0,\\n uint256 amount1,\\n bytes calldata data\\n ) external;\\n\\n /// @notice Increase the maximum number of price and liquidity observations that this pool will store\\n /// @dev This method is no-op if the pool already has an observationCardinalityNext greater than or equal to\\n /// the input observationCardinalityNext.\\n /// @param observationCardinalityNext The desired minimum number of observations for the pool to store\\n function increaseObservationCardinalityNext(uint16 observationCardinalityNext) external;\\n}\\n\",\"keccak256\":\"0x9453dd0e7442188667d01d9b65de3f1e14e9511ff3e303179a15f6fc267f7634\",\"license\":\"GPL-2.0-or-later\"},\"@uniswap/v3-core/contracts/interfaces/pool/IUniswapV3PoolDerivedState.sol\":{\"content\":\"// SPDX-License-Identifier: GPL-2.0-or-later\\npragma solidity >=0.5.0;\\n\\n/// @title Pool state that is not stored\\n/// @notice Contains view functions to provide information about the pool that is computed rather than stored on the\\n/// blockchain. The functions here may have variable gas costs.\\ninterface IUniswapV3PoolDerivedState {\\n /// @notice Returns the cumulative tick and liquidity as of each timestamp `secondsAgo` from the current block timestamp\\n /// @dev To get a time weighted average tick or liquidity-in-range, you must call this with two values, one representing\\n /// the beginning of the period and another for the end of the period. E.g., to get the last hour time-weighted average tick,\\n /// you must call it with secondsAgos = [3600, 0].\\n /// @dev The time weighted average tick represents the geometric time weighted average price of the pool, in\\n /// log base sqrt(1.0001) of token1 / token0. The TickMath library can be used to go from a tick value to a ratio.\\n /// @param secondsAgos From how long ago each cumulative tick and liquidity value should be returned\\n /// @return tickCumulatives Cumulative tick values as of each `secondsAgos` from the current block timestamp\\n /// @return secondsPerLiquidityCumulativeX128s Cumulative seconds per liquidity-in-range value as of each `secondsAgos` from the current block\\n /// timestamp\\n function observe(uint32[] calldata secondsAgos)\\n external\\n view\\n returns (int56[] memory tickCumulatives, uint160[] memory secondsPerLiquidityCumulativeX128s);\\n\\n /// @notice Returns a snapshot of the tick cumulative, seconds per liquidity and seconds inside a tick range\\n /// @dev Snapshots must only be compared to other snapshots, taken over a period for which a position existed.\\n /// I.e., snapshots cannot be compared if a position is not held for the entire period between when the first\\n /// snapshot is taken and the second snapshot is taken.\\n /// @param tickLower The lower tick of the range\\n /// @param tickUpper The upper tick of the range\\n /// @return tickCumulativeInside The snapshot of the tick accumulator for the range\\n /// @return secondsPerLiquidityInsideX128 The snapshot of seconds per liquidity for the range\\n /// @return secondsInside The snapshot of seconds per liquidity for the range\\n function snapshotCumulativesInside(int24 tickLower, int24 tickUpper)\\n external\\n view\\n returns (\\n int56 tickCumulativeInside,\\n uint160 secondsPerLiquidityInsideX128,\\n uint32 secondsInside\\n );\\n}\\n\",\"keccak256\":\"0xe603ac5b17ecdee73ba2b27efdf386c257a19c14206e87eee77e2017b742d9e5\",\"license\":\"GPL-2.0-or-later\"},\"@uniswap/v3-core/contracts/interfaces/pool/IUniswapV3PoolEvents.sol\":{\"content\":\"// SPDX-License-Identifier: GPL-2.0-or-later\\npragma solidity >=0.5.0;\\n\\n/// @title Events emitted by a pool\\n/// @notice Contains all events emitted by the pool\\ninterface IUniswapV3PoolEvents {\\n /// @notice Emitted exactly once by a pool when #initialize is first called on the pool\\n /// @dev Mint/Burn/Swap cannot be emitted by the pool before Initialize\\n /// @param sqrtPriceX96 The initial sqrt price of the pool, as a Q64.96\\n /// @param tick The initial tick of the pool, i.e. log base 1.0001 of the starting price of the pool\\n event Initialize(uint160 sqrtPriceX96, int24 tick);\\n\\n /// @notice Emitted when liquidity is minted for a given position\\n /// @param sender The address that minted the liquidity\\n /// @param owner The owner of the position and recipient of any minted liquidity\\n /// @param tickLower The lower tick of the position\\n /// @param tickUpper The upper tick of the position\\n /// @param amount The amount of liquidity minted to the position range\\n /// @param amount0 How much token0 was required for the minted liquidity\\n /// @param amount1 How much token1 was required for the minted liquidity\\n event Mint(\\n address sender,\\n address indexed owner,\\n int24 indexed tickLower,\\n int24 indexed tickUpper,\\n uint128 amount,\\n uint256 amount0,\\n uint256 amount1\\n );\\n\\n /// @notice Emitted when fees are collected by the owner of a position\\n /// @dev Collect events may be emitted with zero amount0 and amount1 when the caller chooses not to collect fees\\n /// @param owner The owner of the position for which fees are collected\\n /// @param tickLower The lower tick of the position\\n /// @param tickUpper The upper tick of the position\\n /// @param amount0 The amount of token0 fees collected\\n /// @param amount1 The amount of token1 fees collected\\n event Collect(\\n address indexed owner,\\n address recipient,\\n int24 indexed tickLower,\\n int24 indexed tickUpper,\\n uint128 amount0,\\n uint128 amount1\\n );\\n\\n /// @notice Emitted when a position's liquidity is removed\\n /// @dev Does not withdraw any fees earned by the liquidity position, which must be withdrawn via #collect\\n /// @param owner The owner of the position for which liquidity is removed\\n /// @param tickLower The lower tick of the position\\n /// @param tickUpper The upper tick of the position\\n /// @param amount The amount of liquidity to remove\\n /// @param amount0 The amount of token0 withdrawn\\n /// @param amount1 The amount of token1 withdrawn\\n event Burn(\\n address indexed owner,\\n int24 indexed tickLower,\\n int24 indexed tickUpper,\\n uint128 amount,\\n uint256 amount0,\\n uint256 amount1\\n );\\n\\n /// @notice Emitted by the pool for any swaps between token0 and token1\\n /// @param sender The address that initiated the swap call, and that received the callback\\n /// @param recipient The address that received the output of the swap\\n /// @param amount0 The delta of the token0 balance of the pool\\n /// @param amount1 The delta of the token1 balance of the pool\\n /// @param sqrtPriceX96 The sqrt(price) of the pool after the swap, as a Q64.96\\n /// @param liquidity The liquidity of the pool after the swap\\n /// @param tick The log base 1.0001 of price of the pool after the swap\\n event Swap(\\n address indexed sender,\\n address indexed recipient,\\n int256 amount0,\\n int256 amount1,\\n uint160 sqrtPriceX96,\\n uint128 liquidity,\\n int24 tick\\n );\\n\\n /// @notice Emitted by the pool for any flashes of token0/token1\\n /// @param sender The address that initiated the swap call, and that received the callback\\n /// @param recipient The address that received the tokens from flash\\n /// @param amount0 The amount of token0 that was flashed\\n /// @param amount1 The amount of token1 that was flashed\\n /// @param paid0 The amount of token0 paid for the flash, which can exceed the amount0 plus the fee\\n /// @param paid1 The amount of token1 paid for the flash, which can exceed the amount1 plus the fee\\n event Flash(\\n address indexed sender,\\n address indexed recipient,\\n uint256 amount0,\\n uint256 amount1,\\n uint256 paid0,\\n uint256 paid1\\n );\\n\\n /// @notice Emitted by the pool for increases to the number of observations that can be stored\\n /// @dev observationCardinalityNext is not the observation cardinality until an observation is written at the index\\n /// just before a mint/swap/burn.\\n /// @param observationCardinalityNextOld The previous value of the next observation cardinality\\n /// @param observationCardinalityNextNew The updated value of the next observation cardinality\\n event IncreaseObservationCardinalityNext(\\n uint16 observationCardinalityNextOld,\\n uint16 observationCardinalityNextNew\\n );\\n\\n /// @notice Emitted when the protocol fee is changed by the pool\\n /// @param feeProtocol0Old The previous value of the token0 protocol fee\\n /// @param feeProtocol1Old The previous value of the token1 protocol fee\\n /// @param feeProtocol0New The updated value of the token0 protocol fee\\n /// @param feeProtocol1New The updated value of the token1 protocol fee\\n event SetFeeProtocol(uint8 feeProtocol0Old, uint8 feeProtocol1Old, uint8 feeProtocol0New, uint8 feeProtocol1New);\\n\\n /// @notice Emitted when the collected protocol fees are withdrawn by the factory owner\\n /// @param sender The address that collects the protocol fees\\n /// @param recipient The address that receives the collected protocol fees\\n /// @param amount0 The amount of token0 protocol fees that is withdrawn\\n /// @param amount0 The amount of token1 protocol fees that is withdrawn\\n event CollectProtocol(address indexed sender, address indexed recipient, uint128 amount0, uint128 amount1);\\n}\\n\",\"keccak256\":\"0x8071514d0fe5d17d6fbd31c191cdfb703031c24e0ece3621d88ab10e871375cd\",\"license\":\"GPL-2.0-or-later\"},\"@uniswap/v3-core/contracts/interfaces/pool/IUniswapV3PoolImmutables.sol\":{\"content\":\"// SPDX-License-Identifier: GPL-2.0-or-later\\npragma solidity >=0.5.0;\\n\\n/// @title Pool state that never changes\\n/// @notice These parameters are fixed for a pool forever, i.e., the methods will always return the same values\\ninterface IUniswapV3PoolImmutables {\\n /// @notice The contract that deployed the pool, which must adhere to the IUniswapV3Factory interface\\n /// @return The contract address\\n function factory() external view returns (address);\\n\\n /// @notice The first of the two tokens of the pool, sorted by address\\n /// @return The token contract address\\n function token0() external view returns (address);\\n\\n /// @notice The second of the two tokens of the pool, sorted by address\\n /// @return The token contract address\\n function token1() external view returns (address);\\n\\n /// @notice The pool's fee in hundredths of a bip, i.e. 1e-6\\n /// @return The fee\\n function fee() external view returns (uint24);\\n\\n /// @notice The pool tick spacing\\n /// @dev Ticks can only be used at multiples of this value, minimum of 1 and always positive\\n /// e.g.: a tickSpacing of 3 means ticks can be initialized every 3rd tick, i.e., ..., -6, -3, 0, 3, 6, ...\\n /// This value is an int24 to avoid casting even though it is always positive.\\n /// @return The tick spacing\\n function tickSpacing() external view returns (int24);\\n\\n /// @notice The maximum amount of position liquidity that can use any tick in the range\\n /// @dev This parameter is enforced per tick to prevent liquidity from overflowing a uint128 at any point, and\\n /// also prevents out-of-range liquidity from being used to prevent adding in-range liquidity to a pool\\n /// @return The max amount of liquidity per tick\\n function maxLiquidityPerTick() external view returns (uint128);\\n}\\n\",\"keccak256\":\"0xf6e5d2cd1139c4c276bdbc8e1d2b256e456c866a91f1b868da265c6d2685c3f7\",\"license\":\"GPL-2.0-or-later\"},\"@uniswap/v3-core/contracts/interfaces/pool/IUniswapV3PoolOwnerActions.sol\":{\"content\":\"// SPDX-License-Identifier: GPL-2.0-or-later\\npragma solidity >=0.5.0;\\n\\n/// @title Permissioned pool actions\\n/// @notice Contains pool methods that may only be called by the factory owner\\ninterface IUniswapV3PoolOwnerActions {\\n /// @notice Set the denominator of the protocol's % share of the fees\\n /// @param feeProtocol0 new protocol fee for token0 of the pool\\n /// @param feeProtocol1 new protocol fee for token1 of the pool\\n function setFeeProtocol(uint8 feeProtocol0, uint8 feeProtocol1) external;\\n\\n /// @notice Collect the protocol fee accrued to the pool\\n /// @param recipient The address to which collected protocol fees should be sent\\n /// @param amount0Requested The maximum amount of token0 to send, can be 0 to collect fees in only token1\\n /// @param amount1Requested The maximum amount of token1 to send, can be 0 to collect fees in only token0\\n /// @return amount0 The protocol fee collected in token0\\n /// @return amount1 The protocol fee collected in token1\\n function collectProtocol(\\n address recipient,\\n uint128 amount0Requested,\\n uint128 amount1Requested\\n ) external returns (uint128 amount0, uint128 amount1);\\n}\\n\",\"keccak256\":\"0x759b78a2918af9e99e246dc3af084f654e48ef32bb4e4cb8a966aa3dcaece235\",\"license\":\"GPL-2.0-or-later\"},\"@uniswap/v3-core/contracts/interfaces/pool/IUniswapV3PoolState.sol\":{\"content\":\"// SPDX-License-Identifier: GPL-2.0-or-later\\npragma solidity >=0.5.0;\\n\\n/// @title Pool state that can change\\n/// @notice These methods compose the pool's state, and can change with any frequency including multiple times\\n/// per transaction\\ninterface IUniswapV3PoolState {\\n /// @notice The 0th storage slot in the pool stores many values, and is exposed as a single method to save gas\\n /// when accessed externally.\\n /// @return sqrtPriceX96 The current price of the pool as a sqrt(token1/token0) Q64.96 value\\n /// tick The current tick of the pool, i.e. according to the last tick transition that was run.\\n /// This value may not always be equal to SqrtTickMath.getTickAtSqrtRatio(sqrtPriceX96) if the price is on a tick\\n /// boundary.\\n /// observationIndex The index of the last oracle observation that was written,\\n /// observationCardinality The current maximum number of observations stored in the pool,\\n /// observationCardinalityNext The next maximum number of observations, to be updated when the observation.\\n /// feeProtocol The protocol fee for both tokens of the pool.\\n /// Encoded as two 4 bit values, where the protocol fee of token1 is shifted 4 bits and the protocol fee of token0\\n /// is the lower 4 bits. Used as the denominator of a fraction of the swap fee, e.g. 4 means 1/4th of the swap fee.\\n /// unlocked Whether the pool is currently locked to reentrancy\\n function slot0()\\n external\\n view\\n returns (\\n uint160 sqrtPriceX96,\\n int24 tick,\\n uint16 observationIndex,\\n uint16 observationCardinality,\\n uint16 observationCardinalityNext,\\n uint8 feeProtocol,\\n bool unlocked\\n );\\n\\n /// @notice The fee growth as a Q128.128 fees of token0 collected per unit of liquidity for the entire life of the pool\\n /// @dev This value can overflow the uint256\\n function feeGrowthGlobal0X128() external view returns (uint256);\\n\\n /// @notice The fee growth as a Q128.128 fees of token1 collected per unit of liquidity for the entire life of the pool\\n /// @dev This value can overflow the uint256\\n function feeGrowthGlobal1X128() external view returns (uint256);\\n\\n /// @notice The amounts of token0 and token1 that are owed to the protocol\\n /// @dev Protocol fees will never exceed uint128 max in either token\\n function protocolFees() external view returns (uint128 token0, uint128 token1);\\n\\n /// @notice The currently in range liquidity available to the pool\\n /// @dev This value has no relationship to the total liquidity across all ticks\\n function liquidity() external view returns (uint128);\\n\\n /// @notice Look up information about a specific tick in the pool\\n /// @param tick The tick to look up\\n /// @return liquidityGross the total amount of position liquidity that uses the pool either as tick lower or\\n /// tick upper,\\n /// liquidityNet how much liquidity changes when the pool price crosses the tick,\\n /// feeGrowthOutside0X128 the fee growth on the other side of the tick from the current tick in token0,\\n /// feeGrowthOutside1X128 the fee growth on the other side of the tick from the current tick in token1,\\n /// tickCumulativeOutside the cumulative tick value on the other side of the tick from the current tick\\n /// secondsPerLiquidityOutsideX128 the seconds spent per liquidity on the other side of the tick from the current tick,\\n /// secondsOutside the seconds spent on the other side of the tick from the current tick,\\n /// initialized Set to true if the tick is initialized, i.e. liquidityGross is greater than 0, otherwise equal to false.\\n /// Outside values can only be used if the tick is initialized, i.e. if liquidityGross is greater than 0.\\n /// In addition, these values are only relative and must be used only in comparison to previous snapshots for\\n /// a specific position.\\n function ticks(int24 tick)\\n external\\n view\\n returns (\\n uint128 liquidityGross,\\n int128 liquidityNet,\\n uint256 feeGrowthOutside0X128,\\n uint256 feeGrowthOutside1X128,\\n int56 tickCumulativeOutside,\\n uint160 secondsPerLiquidityOutsideX128,\\n uint32 secondsOutside,\\n bool initialized\\n );\\n\\n /// @notice Returns 256 packed tick initialized boolean values. See TickBitmap for more information\\n function tickBitmap(int16 wordPosition) external view returns (uint256);\\n\\n /// @notice Returns the information about a position by the position's key\\n /// @param key The position's key is a hash of a preimage composed by the owner, tickLower and tickUpper\\n /// @return _liquidity The amount of liquidity in the position,\\n /// Returns feeGrowthInside0LastX128 fee growth of token0 inside the tick range as of the last mint/burn/poke,\\n /// Returns feeGrowthInside1LastX128 fee growth of token1 inside the tick range as of the last mint/burn/poke,\\n /// Returns tokensOwed0 the computed amount of token0 owed to the position as of the last mint/burn/poke,\\n /// Returns tokensOwed1 the computed amount of token1 owed to the position as of the last mint/burn/poke\\n function positions(bytes32 key)\\n external\\n view\\n returns (\\n uint128 _liquidity,\\n uint256 feeGrowthInside0LastX128,\\n uint256 feeGrowthInside1LastX128,\\n uint128 tokensOwed0,\\n uint128 tokensOwed1\\n );\\n\\n /// @notice Returns data about a specific observation index\\n /// @param index The element of the observations array to fetch\\n /// @dev You most likely want to use #observe() instead of this method to get an observation as of some amount of time\\n /// ago, rather than at a specific index in the array.\\n /// @return blockTimestamp The timestamp of the observation,\\n /// Returns tickCumulative the tick multiplied by seconds elapsed for the life of the pool as of the observation timestamp,\\n /// Returns secondsPerLiquidityCumulativeX128 the seconds per in range liquidity for the life of the pool as of the observation timestamp,\\n /// Returns initialized whether the observation has been initialized and the values are safe to use\\n function observations(uint256 index)\\n external\\n view\\n returns (\\n uint32 blockTimestamp,\\n int56 tickCumulative,\\n uint160 secondsPerLiquidityCumulativeX128,\\n bool initialized\\n );\\n}\\n\",\"keccak256\":\"0x852dc1f5df7dcf7f11e7bb3eed79f0cea72ad4b25f6a9d2c35aafb48925fd49f\",\"license\":\"GPL-2.0-or-later\"},\"solidity/contracts/Keep3rHelper.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\n/*\\n\\nCoded for The Keep3r Network with \\u2665 by\\n\\n\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2557\\u2591\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2557\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2557\\u2588\\u2588\\u2557\\u2003\\u2003\\u2591\\u2588\\u2588\\u2557\\u2591\\u2591\\u2591\\u2591\\u2591\\u2591\\u2591\\u2588\\u2588\\u2557\\u2591\\u2588\\u2588\\u2588\\u2588\\u2588\\u2557\\u2591\\u2588\\u2588\\u2588\\u2557\\u2591\\u2591\\u2588\\u2588\\u2557\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2557\\u2591\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2557\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2557\\u2591\\u2588\\u2588\\u2557\\u2591\\u2591\\u2591\\u2591\\u2591\\u2591\\u2588\\u2588\\u2588\\u2588\\u2588\\u2557\\u2591\\u2588\\u2588\\u2588\\u2557\\u2591\\u2591\\u2588\\u2588\\u2557\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2557\\u2591\\n\\u2588\\u2588\\u2554\\u2550\\u2550\\u2588\\u2588\\u2557\\u2588\\u2588\\u2554\\u2550\\u2550\\u2550\\u2550\\u255d\\u2588\\u2588\\u2554\\u2550\\u2550\\u2550\\u2550\\u255d\\u2588\\u2588\\u2551\\u2003\\u2003\\u2591\\u2588\\u2588\\u2551\\u2591\\u2591\\u2588\\u2588\\u2557\\u2591\\u2591\\u2588\\u2588\\u2551\\u2588\\u2588\\u2554\\u2550\\u2550\\u2588\\u2588\\u2557\\u2588\\u2588\\u2588\\u2588\\u2557\\u2591\\u2588\\u2588\\u2551\\u2588\\u2588\\u2554\\u2550\\u2550\\u2588\\u2588\\u2557\\u2588\\u2588\\u2554\\u2550\\u2550\\u2550\\u2550\\u255d\\u2588\\u2588\\u2554\\u2550\\u2550\\u2588\\u2588\\u2557\\u2588\\u2588\\u2551\\u2591\\u2591\\u2591\\u2591\\u2591\\u2588\\u2588\\u2554\\u2550\\u2550\\u2588\\u2588\\u2557\\u2588\\u2588\\u2588\\u2588\\u2557\\u2591\\u2588\\u2588\\u2551\\u2588\\u2588\\u2554\\u2550\\u2550\\u2588\\u2588\\u2557\\n\\u2588\\u2588\\u2551\\u2591\\u2591\\u2588\\u2588\\u2551\\u2588\\u2588\\u2588\\u2588\\u2588\\u2557\\u2591\\u2591\\u2588\\u2588\\u2588\\u2588\\u2588\\u2557\\u2591\\u2591\\u2588\\u2588\\u2551\\u2003\\u2003\\u2591\\u255a\\u2588\\u2588\\u2557\\u2588\\u2588\\u2588\\u2588\\u2557\\u2588\\u2588\\u2554\\u255d\\u2588\\u2588\\u2551\\u2591\\u2591\\u2588\\u2588\\u2551\\u2588\\u2588\\u2554\\u2588\\u2588\\u2557\\u2588\\u2588\\u2551\\u2588\\u2588\\u2551\\u2591\\u2591\\u2588\\u2588\\u2551\\u2588\\u2588\\u2588\\u2588\\u2588\\u2557\\u2591\\u2591\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2554\\u255d\\u2588\\u2588\\u2551\\u2591\\u2591\\u2591\\u2591\\u2591\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2551\\u2588\\u2588\\u2554\\u2588\\u2588\\u2557\\u2588\\u2588\\u2551\\u2588\\u2588\\u2551\\u2591\\u2591\\u2588\\u2588\\u2551\\n\\u2588\\u2588\\u2551\\u2591\\u2591\\u2588\\u2588\\u2551\\u2588\\u2588\\u2554\\u2550\\u2550\\u255d\\u2591\\u2591\\u2588\\u2588\\u2554\\u2550\\u2550\\u255d\\u2591\\u2591\\u2588\\u2588\\u2551\\u2003\\u2003\\u2591\\u2591\\u2588\\u2588\\u2588\\u2588\\u2554\\u2550\\u2588\\u2588\\u2588\\u2588\\u2551\\u2591\\u2588\\u2588\\u2551\\u2591\\u2591\\u2588\\u2588\\u2551\\u2588\\u2588\\u2551\\u255a\\u2588\\u2588\\u2588\\u2588\\u2551\\u2588\\u2588\\u2551\\u2591\\u2591\\u2588\\u2588\\u2551\\u2588\\u2588\\u2554\\u2550\\u2550\\u255d\\u2591\\u2591\\u2588\\u2588\\u2554\\u2550\\u2550\\u2588\\u2588\\u2557\\u2588\\u2588\\u2551\\u2591\\u2591\\u2591\\u2591\\u2591\\u2588\\u2588\\u2554\\u2550\\u2550\\u2588\\u2588\\u2551\\u2588\\u2588\\u2551\\u255a\\u2588\\u2588\\u2588\\u2588\\u2551\\u2588\\u2588\\u2551\\u2591\\u2591\\u2588\\u2588\\u2551\\n\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2554\\u255d\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2557\\u2588\\u2588\\u2551\\u2591\\u2591\\u2591\\u2591\\u2591\\u2588\\u2588\\u2551\\u2003\\u2003\\u2591\\u2591\\u255a\\u2588\\u2588\\u2554\\u255d\\u2591\\u255a\\u2588\\u2588\\u2554\\u255d\\u2591\\u255a\\u2588\\u2588\\u2588\\u2588\\u2588\\u2554\\u255d\\u2588\\u2588\\u2551\\u2591\\u255a\\u2588\\u2588\\u2588\\u2551\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2554\\u255d\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2557\\u2588\\u2588\\u2551\\u2591\\u2591\\u2588\\u2588\\u2551\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2557\\u2588\\u2588\\u2551\\u2591\\u2591\\u2588\\u2588\\u2551\\u2588\\u2588\\u2551\\u2591\\u255a\\u2588\\u2588\\u2588\\u2551\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2554\\u255d\\n\\u255a\\u2550\\u2550\\u2550\\u2550\\u2550\\u255d\\u2591\\u255a\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u255d\\u255a\\u2550\\u255d\\u2591\\u2591\\u2591\\u2591\\u2591\\u255a\\u2550\\u255d\\u2003\\u2003\\u2591\\u2591\\u2591\\u255a\\u2550\\u255d\\u2591\\u2591\\u2591\\u255a\\u2550\\u255d\\u2591\\u2591\\u2591\\u255a\\u2550\\u2550\\u2550\\u2550\\u255d\\u2591\\u255a\\u2550\\u255d\\u2591\\u2591\\u255a\\u2550\\u2550\\u255d\\u255a\\u2550\\u2550\\u2550\\u2550\\u2550\\u255d\\u2591\\u255a\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u255d\\u255a\\u2550\\u255d\\u2591\\u2591\\u255a\\u2550\\u255d\\u255a\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u255d\\u255a\\u2550\\u255d\\u2591\\u2591\\u255a\\u2550\\u255d\\u255a\\u2550\\u255d\\u2591\\u2591\\u255a\\u2550\\u2550\\u255d\\u255a\\u2550\\u2550\\u2550\\u2550\\u2550\\u255d\\u2591\\n\\nhttps://defi.sucks\\n\\n*/\\n\\npragma solidity >=0.8.7 <0.9.0;\\n\\nimport './libraries/FullMath.sol';\\nimport './libraries/TickMath.sol';\\nimport '../interfaces/IKeep3r.sol';\\nimport '../interfaces/IKeep3rHelper.sol';\\nimport './Keep3rHelperParameters.sol';\\n\\nimport '@openzeppelin/contracts/utils/math/Math.sol';\\nimport '@uniswap/v3-core/contracts/interfaces/IUniswapV3Pool.sol';\\n\\ncontract Keep3rHelper is IKeep3rHelper, Keep3rHelperParameters {\\n constructor(\\n address _kp3r,\\n address _keep3rV2,\\n address _governance,\\n address _kp3rWethPool\\n ) Keep3rHelperParameters(_kp3r, _keep3rV2, _governance, _kp3rWethPool) {}\\n\\n /// @inheritdoc IKeep3rHelper\\n function quote(uint256 _eth) public view override returns (uint256 _amountOut) {\\n uint32[] memory _secondsAgos = new uint32[](2);\\n _secondsAgos[1] = quoteTwapTime;\\n\\n (int56[] memory _tickCumulatives, ) = IUniswapV3Pool(kp3rWethPool.poolAddress).observe(_secondsAgos);\\n int56 _difference = _tickCumulatives[0] - _tickCumulatives[1];\\n _amountOut = getQuoteAtTick(uint128(_eth), kp3rWethPool.isTKNToken0 ? _difference : -_difference, quoteTwapTime);\\n }\\n\\n /// @inheritdoc IKeep3rHelper\\n function bonds(address _keeper) public view virtual override returns (uint256 _amountBonded) {\\n return IKeep3r(keep3rV2).bonds(_keeper, KP3R);\\n }\\n\\n /// @inheritdoc IKeep3rHelper\\n function getRewardAmountFor(address _keeper, uint256 _gasUsed) public view override returns (uint256 _kp3r) {\\n uint256 _boost = getRewardBoostFor(bonds(_keeper));\\n _kp3r = quote((_gasUsed * _boost) / BOOST_BASE);\\n }\\n\\n /// @inheritdoc IKeep3rHelper\\n function getRewardAmount(uint256 _gasUsed) external view override returns (uint256 _amount) {\\n // solhint-disable-next-line avoid-tx-origin\\n return getRewardAmountFor(tx.origin, _gasUsed);\\n }\\n\\n /// @inheritdoc IKeep3rHelper\\n function getRewardBoostFor(uint256 _bonds) public view override returns (uint256 _rewardBoost) {\\n _bonds = Math.min(_bonds, targetBond);\\n uint256 _cap = minBoost + ((maxBoost - minBoost) * _bonds) / targetBond;\\n _rewardBoost = _cap * _getBasefee();\\n }\\n\\n /// @inheritdoc IKeep3rHelper\\n function getPoolTokens(address _pool) public view override returns (address _token0, address _token1) {\\n return (IUniswapV3Pool(_pool).token0(), IUniswapV3Pool(_pool).token1());\\n }\\n\\n /// @inheritdoc IKeep3rHelper\\n function isKP3RToken0(address _pool) external view virtual override returns (bool _isKP3RToken0) {\\n address _token0;\\n address _token1;\\n (_token0, _token1) = getPoolTokens(_pool);\\n if (_token0 == KP3R) {\\n return true;\\n } else if (_token1 != KP3R) {\\n revert LiquidityPairInvalid();\\n }\\n }\\n\\n /// @inheritdoc IKeep3rHelper\\n function observe(address _pool, uint32[] memory _secondsAgo)\\n external\\n view\\n override\\n returns (\\n int56 _tickCumulative1,\\n int56 _tickCumulative2,\\n bool _success\\n )\\n {\\n try IUniswapV3Pool(_pool).observe(_secondsAgo) returns (int56[] memory _uniswapResponse, uint160[] memory) {\\n _tickCumulative1 = _uniswapResponse[0];\\n if (_uniswapResponse.length > 1) {\\n _tickCumulative2 = _uniswapResponse[1];\\n }\\n _success = true;\\n } catch (bytes memory) {}\\n }\\n\\n /// @inheritdoc IKeep3rHelper\\n function getPaymentParams(uint256 _bonds)\\n external\\n view\\n virtual\\n override\\n returns (\\n uint256 _boost,\\n uint256 _oneEthQuote,\\n uint256 _extra\\n )\\n {\\n _oneEthQuote = quote(1 ether);\\n _boost = getRewardBoostFor(_bonds);\\n _extra = workExtraGas;\\n }\\n\\n /// @inheritdoc IKeep3rHelper\\n function getKP3RsAtTick(\\n uint256 _liquidityAmount,\\n int56 _tickDifference,\\n uint256 _timeInterval\\n ) external pure override returns (uint256 _kp3rAmount) {\\n uint160 sqrtRatioX96 = TickMath.getSqrtRatioAtTick(int24(_tickDifference / int256(_timeInterval)));\\n _kp3rAmount = FullMath.mulDiv(1 << 96, _liquidityAmount, sqrtRatioX96);\\n }\\n\\n /// @inheritdoc IKeep3rHelper\\n function getQuoteAtTick(\\n uint128 _baseAmount,\\n int56 _tickDifference,\\n uint256 _timeInterval\\n ) public pure override returns (uint256 _quoteAmount) {\\n uint160 sqrtRatioX96 = TickMath.getSqrtRatioAtTick(int24(_tickDifference / int256(_timeInterval)));\\n\\n if (sqrtRatioX96 <= type(uint128).max) {\\n uint256 ratioX192 = uint256(sqrtRatioX96) * sqrtRatioX96;\\n _quoteAmount = FullMath.mulDiv(1 << 192, _baseAmount, ratioX192);\\n } else {\\n uint256 ratioX128 = FullMath.mulDiv(sqrtRatioX96, sqrtRatioX96, 1 << 64);\\n _quoteAmount = FullMath.mulDiv(1 << 128, _baseAmount, ratioX128);\\n }\\n }\\n\\n /// @notice Gets the gas basefee cost to calculate keeper rewards\\n /// @dev Keepers are required to pay a priority fee to be included, this function recognizes a minimum priority fee\\n /// @return _baseFee The block's basefee + a minimum priority fee, or a preset minimum gas fee\\n function _getBasefee() internal view virtual returns (uint256 _baseFee) {\\n return Math.max(minBaseFee, block.basefee + minPriorityFee);\\n }\\n}\\n\",\"keccak256\":\"0x022987525462636329608fd3032553a123451854d6191d863f068de237302d17\",\"license\":\"MIT\"},\"solidity/contracts/Keep3rHelperParameters.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.7 <0.9.0;\\n\\nimport './libraries/FullMath.sol';\\nimport './libraries/TickMath.sol';\\nimport '../interfaces/peripherals/IBaseErrors.sol';\\nimport '../interfaces/IKeep3r.sol';\\nimport '../interfaces/external/IKeep3rV1.sol';\\nimport '../interfaces/IKeep3rHelperParameters.sol';\\nimport './peripherals/Governable.sol';\\nimport './Keep3rHelperParameters.sol';\\n\\nimport '@openzeppelin/contracts/utils/math/Math.sol';\\nimport '@uniswap/v3-core/contracts/interfaces/IUniswapV3Pool.sol';\\n\\ncontract Keep3rHelperParameters is IKeep3rHelperParameters, IBaseErrors, Governable {\\n /// @inheritdoc IKeep3rHelperParameters\\n address public immutable override KP3R;\\n\\n /// @inheritdoc IKeep3rHelperParameters\\n uint256 public constant override BOOST_BASE = 10_000;\\n\\n /// @inheritdoc IKeep3rHelperParameters\\n uint256 public override minBoost = 11_000;\\n\\n /// @inheritdoc IKeep3rHelperParameters\\n uint256 public override maxBoost = 12_000;\\n\\n /// @inheritdoc IKeep3rHelperParameters\\n uint256 public override targetBond = 200 ether;\\n\\n /// @inheritdoc IKeep3rHelperParameters\\n uint256 public override workExtraGas = 34_000;\\n\\n /// @inheritdoc IKeep3rHelperParameters\\n uint32 public override quoteTwapTime = 10 minutes;\\n\\n /// @inheritdoc IKeep3rHelperParameters\\n uint256 public override minBaseFee = 15e9;\\n\\n /// @inheritdoc IKeep3rHelperParameters\\n uint256 public override minPriorityFee = 2e9;\\n\\n /// @inheritdoc IKeep3rHelperParameters\\n address public override keep3rV2;\\n\\n /// @inheritdoc IKeep3rHelperParameters\\n IKeep3rHelperParameters.TokenOraclePool public override kp3rWethPool;\\n\\n constructor(\\n address _kp3r,\\n address _keep3rV2,\\n address _governance,\\n address _kp3rWethPool\\n ) Governable(_governance) {\\n KP3R = _kp3r;\\n keep3rV2 = _keep3rV2;\\n\\n // Immutable variables [KP3R] cannot be read during contract creation time [_setKp3rWethPool]\\n kp3rWethPool = _validateOraclePool(_kp3rWethPool, _kp3r);\\n emit Kp3rWethPoolChange(kp3rWethPool.poolAddress, kp3rWethPool.isTKNToken0);\\n }\\n\\n /// @inheritdoc IKeep3rHelperParameters\\n function setKp3rWethPool(address _poolAddress) external override onlyGovernance {\\n if (_poolAddress == address(0)) revert ZeroAddress();\\n _setKp3rWethPool(_poolAddress);\\n }\\n\\n /// @inheritdoc IKeep3rHelperParameters\\n function setMinBoost(uint256 _minBoost) external override onlyGovernance {\\n minBoost = _minBoost;\\n emit MinBoostChange(minBoost);\\n }\\n\\n /// @inheritdoc IKeep3rHelperParameters\\n function setMaxBoost(uint256 _maxBoost) external override onlyGovernance {\\n maxBoost = _maxBoost;\\n emit MaxBoostChange(maxBoost);\\n }\\n\\n /// @inheritdoc IKeep3rHelperParameters\\n function setTargetBond(uint256 _targetBond) external override onlyGovernance {\\n targetBond = _targetBond;\\n emit TargetBondChange(targetBond);\\n }\\n\\n /// @inheritdoc IKeep3rHelperParameters\\n function setKeep3rV2(address _keep3rV2) external override onlyGovernance {\\n if (_keep3rV2 == address(0)) revert ZeroAddress();\\n keep3rV2 = _keep3rV2;\\n emit Keep3rV2Change(keep3rV2);\\n }\\n\\n /// @inheritdoc IKeep3rHelperParameters\\n function setWorkExtraGas(uint256 _workExtraGas) external override onlyGovernance {\\n workExtraGas = _workExtraGas;\\n emit WorkExtraGasChange(workExtraGas);\\n }\\n\\n /// @inheritdoc IKeep3rHelperParameters\\n function setQuoteTwapTime(uint32 _quoteTwapTime) external override onlyGovernance {\\n _setQuoteTwapTime(_quoteTwapTime);\\n }\\n\\n function _setQuoteTwapTime(uint32 _quoteTwapTime) internal {\\n quoteTwapTime = _quoteTwapTime;\\n emit QuoteTwapTimeChange(quoteTwapTime);\\n }\\n\\n /// @inheritdoc IKeep3rHelperParameters\\n function setMinBaseFee(uint256 _minBaseFee) external override onlyGovernance {\\n minBaseFee = _minBaseFee;\\n emit MinBaseFeeChange(minBaseFee);\\n }\\n\\n /// @inheritdoc IKeep3rHelperParameters\\n function setMinPriorityFee(uint256 _minPriorityFee) external override onlyGovernance {\\n minPriorityFee = _minPriorityFee;\\n emit MinPriorityFeeChange(minPriorityFee);\\n }\\n\\n /// @notice Sets KP3R-WETH pool\\n /// @param _poolAddress The address of the KP3R-WETH pool\\n function _setKp3rWethPool(address _poolAddress) internal {\\n kp3rWethPool = _validateOraclePool(_poolAddress, KP3R);\\n emit Kp3rWethPoolChange(kp3rWethPool.poolAddress, kp3rWethPool.isTKNToken0);\\n }\\n\\n function _validateOraclePool(address _poolAddress, address _token) internal view virtual returns (TokenOraclePool memory _oraclePool) {\\n bool _isTKNToken0 = IUniswapV3Pool(_poolAddress).token0() == _token;\\n\\n if (!_isTKNToken0 && IUniswapV3Pool(_poolAddress).token1() != _token) revert InvalidOraclePool();\\n\\n return TokenOraclePool(_poolAddress, _isTKNToken0);\\n }\\n}\\n\",\"keccak256\":\"0xff1d1cdd8acec9bed3ac67c0980c1e211e6e09483e30a090c05ed4698a5c0dd4\",\"license\":\"MIT\"},\"solidity/contracts/libraries/FullMath.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4 <0.9.0;\\n\\n/// @title Contains 512-bit math functions\\n/// @notice Facilitates multiplication and division that can have overflow of an intermediate value without any loss of precision\\n/// @dev Handles \\\"phantom overflow\\\" i.e., allows multiplication and division where an intermediate value overflows 256 bits\\nlibrary FullMath {\\n /// @notice Calculates floor(a\\u00d7b\\u00f7denominator) with full precision. Throws if result overflows a uint256 or denominator == 0\\n /// @param a The multiplicand\\n /// @param b The multiplier\\n /// @param denominator The divisor\\n /// @return result The 256-bit result\\n /// @dev Credit to Remco Bloemen under MIT license https://xn--2-umb.com/21/muldiv\\n function mulDiv(\\n uint256 a,\\n uint256 b,\\n uint256 denominator\\n ) internal pure returns (uint256 result) {\\n unchecked {\\n // 512-bit multiply [prod1 prod0] = a * b\\n // Compute the product mod 2**256 and mod 2**256 - 1\\n // then use the Chinese Remainder Theorem to reconstruct\\n // the 512 bit result. The result is stored in two 256\\n // variables such that product = prod1 * 2**256 + prod0\\n uint256 prod0; // Least significant 256 bits of the product\\n uint256 prod1; // Most significant 256 bits of the product\\n assembly {\\n let mm := mulmod(a, b, not(0))\\n prod0 := mul(a, b)\\n prod1 := sub(sub(mm, prod0), lt(mm, prod0))\\n }\\n\\n // Handle non-overflow cases, 256 by 256 division\\n if (prod1 == 0) {\\n require(denominator > 0);\\n assembly {\\n result := div(prod0, denominator)\\n }\\n return result;\\n }\\n\\n // Make sure the result is less than 2**256.\\n // Also prevents denominator == 0\\n require(denominator > prod1);\\n\\n ///////////////////////////////////////////////\\n // 512 by 256 division.\\n ///////////////////////////////////////////////\\n\\n // Make division exact by subtracting the remainder from [prod1 prod0]\\n // Compute remainder using mulmod\\n uint256 remainder;\\n assembly {\\n remainder := mulmod(a, b, denominator)\\n }\\n // Subtract 256 bit number from 512 bit number\\n assembly {\\n prod1 := sub(prod1, gt(remainder, prod0))\\n prod0 := sub(prod0, remainder)\\n }\\n\\n // Factor powers of two out of denominator\\n // Compute largest power of two divisor of denominator.\\n // Always >= 1.\\n uint256 twos = (~denominator + 1) & denominator;\\n // Divide denominator by power of two\\n assembly {\\n denominator := div(denominator, twos)\\n }\\n\\n // Divide [prod1 prod0] by the factors of two\\n assembly {\\n prod0 := div(prod0, twos)\\n }\\n // Shift in bits from prod1 into prod0. For this we need\\n // to flip `twos` such that it is 2**256 / twos.\\n // If twos is zero, then it becomes one\\n assembly {\\n twos := add(div(sub(0, twos), twos), 1)\\n }\\n prod0 |= prod1 * twos;\\n\\n // Invert denominator mod 2**256\\n // Now that denominator is an odd number, it has an inverse\\n // modulo 2**256 such that denominator * inv = 1 mod 2**256.\\n // Compute the inverse by starting with a seed that is correct\\n // correct for four bits. That is, denominator * inv = 1 mod 2**4\\n uint256 inv = (3 * denominator) ^ 2;\\n // Now use Newton-Raphson iteration to improve the precision.\\n // Thanks to Hensel's lifting lemma, this also works in modular\\n // arithmetic, doubling the correct bits in each step.\\n inv *= 2 - denominator * inv; // inverse mod 2**8\\n inv *= 2 - denominator * inv; // inverse mod 2**16\\n inv *= 2 - denominator * inv; // inverse mod 2**32\\n inv *= 2 - denominator * inv; // inverse mod 2**64\\n inv *= 2 - denominator * inv; // inverse mod 2**128\\n inv *= 2 - denominator * inv; // inverse mod 2**256\\n\\n // Because the division is now exact we can divide by multiplying\\n // with the modular inverse of denominator. This will give us the\\n // correct result modulo 2**256. Since the precoditions guarantee\\n // that the outcome is less than 2**256, this is the final result.\\n // We don't need to compute the high bits of the result and prod1\\n // is no longer required.\\n result = prod0 * inv;\\n return result;\\n }\\n }\\n\\n /// @notice Calculates ceil(a\\u00d7b\\u00f7denominator) with full precision. Throws if result overflows a uint256 or denominator == 0\\n /// @param a The multiplicand\\n /// @param b The multiplier\\n /// @param denominator The divisor\\n /// @return result The 256-bit result\\n function mulDivRoundingUp(\\n uint256 a,\\n uint256 b,\\n uint256 denominator\\n ) internal pure returns (uint256 result) {\\n unchecked {\\n result = mulDiv(a, b, denominator);\\n if (mulmod(a, b, denominator) > 0) {\\n require(result < type(uint256).max);\\n result++;\\n }\\n }\\n }\\n}\\n\",\"keccak256\":\"0xe1c595da02adf8ba2ae74ac579b9b3c966d1ecb2a99c25081a62ee8550f26569\",\"license\":\"MIT\"},\"solidity/contracts/libraries/TickMath.sol\":{\"content\":\"// SPDX-License-Identifier: GPL-2.0-or-later\\npragma solidity >=0.5.0;\\n\\n// solhint-disable\\n\\n/// @title Math library for computing sqrt prices from ticks and vice versa\\n/// @notice Computes sqrt price for ticks of size 1.0001, i.e. sqrt(1.0001^tick) as fixed point Q64.96 numbers. Supports\\n/// prices between 2**-128 and 2**128\\nlibrary TickMath {\\n /// @dev The minimum tick that may be passed to #getSqrtRatioAtTick computed from log base 1.0001 of 2**-128\\n int24 internal constant MIN_TICK = -887272;\\n /// @dev The maximum tick that may be passed to #getSqrtRatioAtTick computed from log base 1.0001 of 2**128\\n int24 internal constant MAX_TICK = -MIN_TICK;\\n\\n /// @dev The minimum value that can be returned from #getSqrtRatioAtTick. Equivalent to getSqrtRatioAtTick(MIN_TICK)\\n uint160 internal constant MIN_SQRT_RATIO = 4295128739;\\n /// @dev The maximum value that can be returned from #getSqrtRatioAtTick. Equivalent to getSqrtRatioAtTick(MAX_TICK)\\n uint160 internal constant MAX_SQRT_RATIO = 1461446703485210103287273052203988822378723970342;\\n\\n /// @notice Calculates sqrt(1.0001^tick) * 2^96\\n /// @dev Throws if |tick| > max tick\\n /// @param tick The input tick for the above formula\\n /// @return sqrtPriceX96 A Fixed point Q64.96 number representing the sqrt of the ratio of the two assets (token1/token0)\\n /// at the given tick\\n function getSqrtRatioAtTick(int24 tick) internal pure returns (uint160 sqrtPriceX96) {\\n uint256 absTick = tick < 0 ? uint256(-int256(tick)) : uint256(int256(tick));\\n require(absTick <= uint256(int256(MAX_TICK)), 'T');\\n\\n uint256 ratio = absTick & 0x1 != 0 ? 0xfffcb933bd6fad37aa2d162d1a594001 : 0x100000000000000000000000000000000;\\n if (absTick & 0x2 != 0) ratio = (ratio * 0xfff97272373d413259a46990580e213a) >> 128;\\n if (absTick & 0x4 != 0) ratio = (ratio * 0xfff2e50f5f656932ef12357cf3c7fdcc) >> 128;\\n if (absTick & 0x8 != 0) ratio = (ratio * 0xffe5caca7e10e4e61c3624eaa0941cd0) >> 128;\\n if (absTick & 0x10 != 0) ratio = (ratio * 0xffcb9843d60f6159c9db58835c926644) >> 128;\\n if (absTick & 0x20 != 0) ratio = (ratio * 0xff973b41fa98c081472e6896dfb254c0) >> 128;\\n if (absTick & 0x40 != 0) ratio = (ratio * 0xff2ea16466c96a3843ec78b326b52861) >> 128;\\n if (absTick & 0x80 != 0) ratio = (ratio * 0xfe5dee046a99a2a811c461f1969c3053) >> 128;\\n if (absTick & 0x100 != 0) ratio = (ratio * 0xfcbe86c7900a88aedcffc83b479aa3a4) >> 128;\\n if (absTick & 0x200 != 0) ratio = (ratio * 0xf987a7253ac413176f2b074cf7815e54) >> 128;\\n if (absTick & 0x400 != 0) ratio = (ratio * 0xf3392b0822b70005940c7a398e4b70f3) >> 128;\\n if (absTick & 0x800 != 0) ratio = (ratio * 0xe7159475a2c29b7443b29c7fa6e889d9) >> 128;\\n if (absTick & 0x1000 != 0) ratio = (ratio * 0xd097f3bdfd2022b8845ad8f792aa5825) >> 128;\\n if (absTick & 0x2000 != 0) ratio = (ratio * 0xa9f746462d870fdf8a65dc1f90e061e5) >> 128;\\n if (absTick & 0x4000 != 0) ratio = (ratio * 0x70d869a156d2a1b890bb3df62baf32f7) >> 128;\\n if (absTick & 0x8000 != 0) ratio = (ratio * 0x31be135f97d08fd981231505542fcfa6) >> 128;\\n if (absTick & 0x10000 != 0) ratio = (ratio * 0x9aa508b5b7a84e1c677de54f3e99bc9) >> 128;\\n if (absTick & 0x20000 != 0) ratio = (ratio * 0x5d6af8dedb81196699c329225ee604) >> 128;\\n if (absTick & 0x40000 != 0) ratio = (ratio * 0x2216e584f5fa1ea926041bedfe98) >> 128;\\n if (absTick & 0x80000 != 0) ratio = (ratio * 0x48a170391f7dc42444e8fa2) >> 128;\\n\\n if (tick > 0) ratio = type(uint256).max / ratio;\\n\\n // Divides by 1<<32 rounding up to go from a Q128.128 to a Q128.96.\\n // we then downcast because we know the result always fits within 160 bits due to our tick input constraint\\n // we round up in the division so getTickAtSqrtRatio of the output price is always consistent\\n sqrtPriceX96 = uint160((ratio >> 32) + (ratio % (1 << 32) == 0 ? 0 : 1));\\n }\\n\\n /// @notice Calculates the greatest tick value such that getRatioAtTick(tick) <= ratio\\n /// @dev Throws in case sqrtPriceX96 < MIN_SQRT_RATIO, as MIN_SQRT_RATIO is the lowest value getRatioAtTick may ever return.\\n /// @param sqrtPriceX96 The sqrt ratio for which to compute the tick as a Q64.96\\n /// @return tick The greatest tick for which the ratio is less than or equal to the input ratio\\n function getTickAtSqrtRatio(uint160 sqrtPriceX96) internal pure returns (int24 tick) {\\n // Second inequality must be < because the price can never reach the price at the max tick\\n require(sqrtPriceX96 >= MIN_SQRT_RATIO && sqrtPriceX96 < MAX_SQRT_RATIO, 'R');\\n uint256 ratio = uint256(sqrtPriceX96) << 32;\\n\\n uint256 r = ratio;\\n uint256 msb = 0;\\n\\n assembly {\\n let f := shl(7, gt(r, 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF))\\n msb := or(msb, f)\\n r := shr(f, r)\\n }\\n assembly {\\n let f := shl(6, gt(r, 0xFFFFFFFFFFFFFFFF))\\n msb := or(msb, f)\\n r := shr(f, r)\\n }\\n assembly {\\n let f := shl(5, gt(r, 0xFFFFFFFF))\\n msb := or(msb, f)\\n r := shr(f, r)\\n }\\n assembly {\\n let f := shl(4, gt(r, 0xFFFF))\\n msb := or(msb, f)\\n r := shr(f, r)\\n }\\n assembly {\\n let f := shl(3, gt(r, 0xFF))\\n msb := or(msb, f)\\n r := shr(f, r)\\n }\\n assembly {\\n let f := shl(2, gt(r, 0xF))\\n msb := or(msb, f)\\n r := shr(f, r)\\n }\\n assembly {\\n let f := shl(1, gt(r, 0x3))\\n msb := or(msb, f)\\n r := shr(f, r)\\n }\\n assembly {\\n let f := gt(r, 0x1)\\n msb := or(msb, f)\\n }\\n\\n if (msb >= 128) r = ratio >> (msb - 127);\\n else r = ratio << (127 - msb);\\n\\n int256 log_2 = (int256(msb) - 128) << 64;\\n\\n assembly {\\n r := shr(127, mul(r, r))\\n let f := shr(128, r)\\n log_2 := or(log_2, shl(63, f))\\n r := shr(f, r)\\n }\\n assembly {\\n r := shr(127, mul(r, r))\\n let f := shr(128, r)\\n log_2 := or(log_2, shl(62, f))\\n r := shr(f, r)\\n }\\n assembly {\\n r := shr(127, mul(r, r))\\n let f := shr(128, r)\\n log_2 := or(log_2, shl(61, f))\\n r := shr(f, r)\\n }\\n assembly {\\n r := shr(127, mul(r, r))\\n let f := shr(128, r)\\n log_2 := or(log_2, shl(60, f))\\n r := shr(f, r)\\n }\\n assembly {\\n r := shr(127, mul(r, r))\\n let f := shr(128, r)\\n log_2 := or(log_2, shl(59, f))\\n r := shr(f, r)\\n }\\n assembly {\\n r := shr(127, mul(r, r))\\n let f := shr(128, r)\\n log_2 := or(log_2, shl(58, f))\\n r := shr(f, r)\\n }\\n assembly {\\n r := shr(127, mul(r, r))\\n let f := shr(128, r)\\n log_2 := or(log_2, shl(57, f))\\n r := shr(f, r)\\n }\\n assembly {\\n r := shr(127, mul(r, r))\\n let f := shr(128, r)\\n log_2 := or(log_2, shl(56, f))\\n r := shr(f, r)\\n }\\n assembly {\\n r := shr(127, mul(r, r))\\n let f := shr(128, r)\\n log_2 := or(log_2, shl(55, f))\\n r := shr(f, r)\\n }\\n assembly {\\n r := shr(127, mul(r, r))\\n let f := shr(128, r)\\n log_2 := or(log_2, shl(54, f))\\n r := shr(f, r)\\n }\\n assembly {\\n r := shr(127, mul(r, r))\\n let f := shr(128, r)\\n log_2 := or(log_2, shl(53, f))\\n r := shr(f, r)\\n }\\n assembly {\\n r := shr(127, mul(r, r))\\n let f := shr(128, r)\\n log_2 := or(log_2, shl(52, f))\\n r := shr(f, r)\\n }\\n assembly {\\n r := shr(127, mul(r, r))\\n let f := shr(128, r)\\n log_2 := or(log_2, shl(51, f))\\n r := shr(f, r)\\n }\\n assembly {\\n r := shr(127, mul(r, r))\\n let f := shr(128, r)\\n log_2 := or(log_2, shl(50, f))\\n }\\n\\n int256 log_sqrt10001 = log_2 * 255738958999603826347141; // 128.128 number\\n\\n int24 tickLow = int24((log_sqrt10001 - 3402992956809132418596140100660247210) >> 128);\\n int24 tickHi = int24((log_sqrt10001 + 291339464771989622907027621153398088495) >> 128);\\n\\n tick = tickLow == tickHi ? tickLow : getSqrtRatioAtTick(tickHi) <= sqrtPriceX96 ? tickHi : tickLow;\\n }\\n}\\n\",\"keccak256\":\"0x11b965ba576ff91b4a6e9533c0f334f2b7b6024ee1c54e36d21799de5580899d\",\"license\":\"GPL-2.0-or-later\"},\"solidity/contracts/peripherals/Governable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4 <0.9.0;\\n\\nimport '../../interfaces/peripherals/IGovernable.sol';\\n\\nabstract contract Governable is IGovernable {\\n /// @inheritdoc IGovernable\\n address public override governance;\\n\\n /// @inheritdoc IGovernable\\n address public override pendingGovernance;\\n\\n constructor(address _governance) {\\n if (_governance == address(0)) revert NoGovernanceZeroAddress();\\n governance = _governance;\\n }\\n\\n /// @inheritdoc IGovernable\\n function setGovernance(address _governance) external override onlyGovernance {\\n pendingGovernance = _governance;\\n emit GovernanceProposal(_governance);\\n }\\n\\n /// @inheritdoc IGovernable\\n function acceptGovernance() external override onlyPendingGovernance {\\n governance = pendingGovernance;\\n delete pendingGovernance;\\n emit GovernanceSet(governance);\\n }\\n\\n /// @notice Functions with this modifier can only be called by governance\\n modifier onlyGovernance {\\n if (msg.sender != governance) revert OnlyGovernance();\\n _;\\n }\\n\\n /// @notice Functions with this modifier can only be called by pendingGovernance\\n modifier onlyPendingGovernance {\\n if (msg.sender != pendingGovernance) revert OnlyPendingGovernance();\\n _;\\n }\\n}\\n\",\"keccak256\":\"0x5b6d7601a42d2229657a7f60021c7e2bfe890c3541ab0003f7d88e20a28d722b\",\"license\":\"MIT\"},\"solidity/contracts/sidechain/Keep3rHelperSidechain.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity >=0.8.4 <0.9.0;\\n\\nimport '../Keep3rHelper.sol';\\nimport '../../interfaces/sidechain/IKeep3rHelperSidechain.sol';\\n\\ncontract Keep3rHelperSidechain is IKeep3rHelperSidechain, Keep3rHelper {\\n /// @inheritdoc IKeep3rHelperSidechain\\n mapping(address => address) public override oracle;\\n /// @inheritdoc IKeep3rHelperSidechain\\n IKeep3rHelperParameters.TokenOraclePool public override wethUSDPool;\\n\\n /// @notice Ethereum mainnet WETH address used for quoting references\\n address public immutable override WETH;\\n\\n /// @param _keep3rV2 Address of sidechain Keep3r implementation\\n /// @param _governance Address of governance\\n /// @param _kp3rWethOracle Address of oracle used for KP3R/WETH quote\\n /// @param _wethUsdOracle Address of oracle used for WETH/USD quote\\n /// @dev Oracle pools should use 18 decimals tokens\\n constructor(\\n address _keep3rV2,\\n address _governance,\\n address _kp3r,\\n address _weth,\\n address _kp3rWethOracle,\\n address _wethUsdOracle\\n ) Keep3rHelper(_kp3r, _keep3rV2, _governance, _kp3rWethOracle) {\\n WETH = _weth;\\n wethUSDPool = _validateOraclePool(_wethUsdOracle, _weth);\\n _setQuoteTwapTime(1 days);\\n workExtraGas = 0;\\n }\\n\\n /// @inheritdoc IKeep3rHelper\\n /// @notice Uses valid wKP3R address from Keep3rSidechain to query keeper bonds\\n function bonds(address _keeper) public view override(Keep3rHelper, IKeep3rHelper) returns (uint256 _amountBonded) {\\n address wKP3R = IKeep3r(keep3rV2).keep3rV1();\\n return IKeep3r(keep3rV2).bonds(_keeper, wKP3R);\\n }\\n\\n /// @inheritdoc IKeep3rHelperSidechain\\n function setOracle(address _liquidity, address _oracle) external override onlyGovernance {\\n if (_liquidity == address(0) || _oracle == address(0)) revert ZeroAddress();\\n oracle[_liquidity] = _oracle;\\n emit OracleSet(_liquidity, _oracle);\\n }\\n\\n /// @inheritdoc IKeep3rHelperSidechain\\n function quoteUsdToEth(uint256 _usd) public view virtual override returns (uint256 _amountOut) {\\n uint32[] memory _secondsAgos = new uint32[](2);\\n _secondsAgos[1] = quoteTwapTime;\\n\\n /// @dev Oracle is compatible with IUniswapV3Pool\\n (int56[] memory _tickCumulatives, ) = IUniswapV3Pool(wethUSDPool.poolAddress).observe(_secondsAgos);\\n int56 _difference = _tickCumulatives[0] - _tickCumulatives[1];\\n _amountOut = getQuoteAtTick(uint128(_usd), wethUSDPool.isTKNToken0 ? _difference : -_difference, quoteTwapTime);\\n }\\n\\n /// @inheritdoc IKeep3rHelperSidechain\\n function setWethUsdPool(address _poolAddress) external override onlyGovernance {\\n if (_poolAddress == address(0)) revert ZeroAddress();\\n _setWethUsdPool(_poolAddress);\\n }\\n\\n /// @inheritdoc IKeep3rHelper\\n function getPaymentParams(uint256 _bonds)\\n external\\n view\\n virtual\\n override(Keep3rHelper, IKeep3rHelper)\\n returns (\\n uint256 _boost,\\n uint256 _oneUsdQuote,\\n uint256 _extraGas\\n )\\n {\\n _oneUsdQuote = quote(quoteUsdToEth(1 ether));\\n _boost = getRewardBoostFor(_bonds);\\n _extraGas = workExtraGas;\\n }\\n\\n function _setWethUsdPool(address _poolAddress) internal {\\n wethUSDPool = _validateOraclePool(_poolAddress, WETH);\\n emit WethUSDPoolChange(wethUSDPool.poolAddress, wethUSDPool.isTKNToken0);\\n }\\n\\n /// @dev Sidechain jobs are quoted by USD/gasUnit, baseFee is set to 1\\n function _getBasefee() internal view virtual override returns (uint256 _baseFee) {\\n return 1;\\n }\\n}\\n\",\"keccak256\":\"0x285aae877c6f2de8dba6fd12f31f1105ca214b3025537081f521dc628f72a677\",\"license\":\"MIT\"},\"solidity/interfaces/IKeep3r.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4 <0.9.0;\\n\\nimport './peripherals/IKeep3rJobs.sol';\\nimport './peripherals/IKeep3rKeepers.sol';\\nimport './peripherals/IKeep3rParameters.sol';\\n\\n// solhint-disable-next-line no-empty-blocks\\n\\n/// @title Keep3rV2 contract\\n/// @notice This contract inherits all the functionality of Keep3rV2\\ninterface IKeep3r is IKeep3rJobs, IKeep3rKeepers, IKeep3rParameters {\\n\\n}\\n\",\"keccak256\":\"0x273a39984c1475c60182e636bb91a1b89ec98646a036cac6a87067869b3adeb9\",\"license\":\"MIT\"},\"solidity/interfaces/IKeep3rHelper.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4 <0.9.0;\\n\\nimport './IKeep3rHelperParameters.sol';\\n\\n/// @title Keep3rHelper contract\\n/// @notice Contains all the helper functions used throughout the different files.\\ninterface IKeep3rHelper is IKeep3rHelperParameters {\\n // Errors\\n\\n /// @notice Throws when none of the tokens in the liquidity pair is KP3R\\n error LiquidityPairInvalid();\\n\\n // Methods\\n // solhint-enable func-name-mixedcase\\n\\n /// @notice Calculates the amount of KP3R that corresponds to the ETH passed into the function\\n /// @dev This function allows us to calculate how much KP3R we should pay to a keeper for things expressed in ETH, like gas\\n /// @param _eth The amount of ETH\\n /// @return _amountOut The amount of KP3R\\n function quote(uint256 _eth) external view returns (uint256 _amountOut);\\n\\n /// @notice Returns the amount of KP3R the keeper has bonded\\n /// @param _keeper The address of the keeper to check\\n /// @return _amountBonded The amount of KP3R the keeper has bonded\\n function bonds(address _keeper) external view returns (uint256 _amountBonded);\\n\\n /// @notice Calculates the reward (in KP3R) that corresponds to a keeper for using gas\\n /// @param _keeper The address of the keeper to check\\n /// @param _gasUsed The amount of gas used that will be rewarded\\n /// @return _kp3r The amount of KP3R that should be awarded to the keeper\\n function getRewardAmountFor(address _keeper, uint256 _gasUsed) external view returns (uint256 _kp3r);\\n\\n /// @notice Calculates the boost in the reward given to a keeper based on the amount of KP3R that keeper has bonded\\n /// @dev If the keeper has no bonds, boost should be +10% of gas cost, if keeper has max bonds, +20%\\n /// @param _bonds The amount of KP3R tokens bonded by the keeper\\n /// @return _rewardBoost The reward boost that corresponds to the keeper\\n function getRewardBoostFor(uint256 _bonds) external view returns (uint256 _rewardBoost);\\n\\n /// @notice Calculates the reward (in KP3R) that corresponds to tx.origin for using gas\\n /// @param _gasUsed The amount of gas used that will be rewarded\\n /// @return _amount The amount of KP3R that should be awarded to tx.origin\\n function getRewardAmount(uint256 _gasUsed) external view returns (uint256 _amount);\\n\\n /// @notice Given a pool address, returns the underlying tokens of the pair\\n /// @param _pool Address of the correspondant pool\\n /// @return _token0 Address of the first token of the pair\\n /// @return _token1 Address of the second token of the pair\\n function getPoolTokens(address _pool) external view returns (address _token0, address _token1);\\n\\n /// @notice Defines the order of the tokens in the pair for twap calculations\\n /// @param _pool Address of the correspondant pool\\n /// @return _isKP3RToken0 Boolean indicating the order of the tokens in the pair\\n function isKP3RToken0(address _pool) external view returns (bool _isKP3RToken0);\\n\\n /// @notice Given an array of secondsAgo, returns UniswapV3 pool cumulatives at that moment\\n /// @param _pool Address of the pool to observe\\n /// @param _secondsAgo Array with time references to observe\\n /// @return _tickCumulative1 Cumulative sum of ticks until first time reference\\n /// @return _tickCumulative2 Cumulative sum of ticks until second time reference\\n /// @return _success Boolean indicating if the observe call was succesfull\\n function observe(address _pool, uint32[] memory _secondsAgo)\\n external\\n view\\n returns (\\n int56 _tickCumulative1,\\n int56 _tickCumulative2,\\n bool _success\\n );\\n\\n /// @notice Get multiplier, quote, and extra, in order to calculate keeper payment\\n /// @param _bonds Amount of bonded KP3R owned by the keeper\\n /// @return _boost Multiplier per gas unit. Takes into account the base fee and the amount of bonded KP3R\\n /// @return _oneEthQuote Amount of KP3R tokens equivalent to 1 ETH\\n /// @return _extra Amount of extra gas that should be added to the gas spent\\n function getPaymentParams(uint256 _bonds)\\n external\\n view\\n returns (\\n uint256 _boost,\\n uint256 _oneEthQuote,\\n uint256 _extra\\n );\\n\\n /// @notice Given a tick and a liquidity amount, calculates the underlying KP3R tokens\\n /// @param _liquidityAmount Amount of liquidity to be converted\\n /// @param _tickDifference Tick value used to calculate the quote\\n /// @param _timeInterval Time value used to calculate the quote\\n /// @return _kp3rAmount Amount of KP3R tokens underlying on the given liquidity\\n function getKP3RsAtTick(\\n uint256 _liquidityAmount,\\n int56 _tickDifference,\\n uint256 _timeInterval\\n ) external pure returns (uint256 _kp3rAmount);\\n\\n /// @notice Given a tick and a token amount, calculates the output in correspondant token\\n /// @param _baseAmount Amount of token to be converted\\n /// @param _tickDifference Tick value used to calculate the quote\\n /// @param _timeInterval Time value used to calculate the quote\\n /// @return _quoteAmount Amount of credits deserved for the baseAmount at the tick value\\n function getQuoteAtTick(\\n uint128 _baseAmount,\\n int56 _tickDifference,\\n uint256 _timeInterval\\n ) external pure returns (uint256 _quoteAmount);\\n}\\n\",\"keccak256\":\"0x67817dc98fde9b3a917e25bc16fe60a91772dd5a77e0ce22a208b66b29d3ad8e\",\"license\":\"MIT\"},\"solidity/interfaces/IKeep3rHelperParameters.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4 <0.9.0;\\n\\n/// @title Keep3rHelperParameters contract\\n/// @notice Contains all the helper functions used throughout the different files.\\ninterface IKeep3rHelperParameters {\\n // Structs\\n\\n /// @dev KP3R-WETH Pool address and isKP3RToken0\\n /// @dev Created in order to save gas by avoiding calls to pool's token0 method\\n struct TokenOraclePool {\\n address poolAddress;\\n bool isTKNToken0;\\n }\\n\\n // Errors\\n\\n /// @notice Throws when pool does not have KP3R as token0 nor token1\\n error InvalidOraclePool();\\n\\n // Events\\n\\n /// @notice Emitted when the kp3r weth pool is changed\\n /// @param _address Address of the new kp3r weth pool\\n /// @param _isKP3RToken0 True if calling the token0 method of the pool returns the KP3R token address\\n event Kp3rWethPoolChange(address _address, bool _isKP3RToken0);\\n\\n /// @notice Emitted when the minimum boost multiplier is changed\\n /// @param _minBoost The minimum boost multiplier\\n event MinBoostChange(uint256 _minBoost);\\n\\n /// @notice Emitted when the maximum boost multiplier is changed\\n /// @param _maxBoost The maximum boost multiplier\\n event MaxBoostChange(uint256 _maxBoost);\\n\\n /// @notice Emitted when the target bond amount is changed\\n /// @param _targetBond The target bond amount\\n event TargetBondChange(uint256 _targetBond);\\n\\n /// @notice Emitted when the Keep3r V2 address is changed\\n /// @param _keep3rV2 The address of Keep3r V2\\n event Keep3rV2Change(address _keep3rV2);\\n\\n /// @notice Emitted when the work extra gas amount is changed\\n /// @param _workExtraGas The work extra gas\\n event WorkExtraGasChange(uint256 _workExtraGas);\\n\\n /// @notice Emitted when the quote twap time is changed\\n /// @param _quoteTwapTime The twap time for quoting\\n event QuoteTwapTimeChange(uint32 _quoteTwapTime);\\n\\n /// @notice Emitted when minimum rewarded gas fee is changed\\n /// @param _minBaseFee The minimum rewarded gas fee\\n event MinBaseFeeChange(uint256 _minBaseFee);\\n\\n /// @notice Emitted when minimum rewarded priority fee is changed\\n /// @param _minPriorityFee The minimum expected fee that the keeper should pay\\n event MinPriorityFeeChange(uint256 _minPriorityFee);\\n\\n // Variables\\n\\n /// @notice Address of KP3R token\\n /// @return _kp3r Address of KP3R token\\n // solhint-disable func-name-mixedcase\\n function KP3R() external view returns (address _kp3r);\\n\\n /// @notice The boost base used to calculate the boost rewards for the keeper\\n /// @return _base The boost base number\\n function BOOST_BASE() external view returns (uint256 _base);\\n\\n /// @notice KP3R-WETH pool that is being used as oracle\\n /// @return poolAddress Address of the pool\\n /// @return isTKNToken0 True if calling the token0 method of the pool returns the KP3R token address\\n function kp3rWethPool() external view returns (address poolAddress, bool isTKNToken0);\\n\\n /// @notice The minimum multiplier used to calculate the amount of gas paid to the Keeper for the gas used to perform a job\\n /// For example: if the quoted gas used is 1000, then the minimum amount to be paid will be 1000 * minBoost / BOOST_BASE\\n /// @return _multiplier The minimum boost multiplier\\n function minBoost() external view returns (uint256 _multiplier);\\n\\n /// @notice The maximum multiplier used to calculate the amount of gas paid to the Keeper for the gas used to perform a job\\n /// For example: if the quoted gas used is 1000, then the maximum amount to be paid will be 1000 * maxBoost / BOOST_BASE\\n /// @return _multiplier The maximum boost multiplier\\n function maxBoost() external view returns (uint256 _multiplier);\\n\\n /// @notice The targeted amount of bonded KP3Rs to max-up reward multiplier\\n /// For example: if the amount of KP3R the keeper has bonded is targetBond or more, then the keeper will get\\n /// the maximum boost possible in his rewards, if it's less, the reward boost will be proportional\\n /// @return _target The amount of KP3R that comforms the targetBond\\n function targetBond() external view returns (uint256 _target);\\n\\n /// @notice The amount of unaccounted gas that is going to be added to keeper payments\\n /// @return _workExtraGas The work unaccounted gas amount\\n function workExtraGas() external view returns (uint256 _workExtraGas);\\n\\n /// @notice The twap time for quoting\\n /// @return _quoteTwapTime The twap time\\n function quoteTwapTime() external view returns (uint32 _quoteTwapTime);\\n\\n /// @notice The minimum base fee that is used to calculate keeper rewards\\n /// @return _minBaseFee The minimum rewarded gas fee\\n function minBaseFee() external view returns (uint256 _minBaseFee);\\n\\n /// @notice The minimum priority fee that is also rewarded for keepers\\n /// @return _minPriorityFee The minimum rewarded priority fee\\n function minPriorityFee() external view returns (uint256 _minPriorityFee);\\n\\n /// @notice Address of Keep3r V2\\n /// @return _keep3rV2 Address of Keep3r V2\\n function keep3rV2() external view returns (address _keep3rV2);\\n\\n // Methods\\n\\n /// @notice Sets KP3R-WETH pool\\n /// @param _poolAddress The address of the KP3R-WETH pool\\n function setKp3rWethPool(address _poolAddress) external;\\n\\n /// @notice Sets the minimum boost multiplier\\n /// @param _minBoost The minimum boost multiplier\\n function setMinBoost(uint256 _minBoost) external;\\n\\n /// @notice Sets the maximum boost multiplier\\n /// @param _maxBoost The maximum boost multiplier\\n function setMaxBoost(uint256 _maxBoost) external;\\n\\n /// @notice Sets the target bond amount\\n /// @param _targetBond The target bond amount\\n function setTargetBond(uint256 _targetBond) external;\\n\\n /// @notice Sets the Keep3r V2 address\\n /// @param _keep3rV2 The address of Keep3r V2\\n function setKeep3rV2(address _keep3rV2) external;\\n\\n /// @notice Sets the work extra gas amount\\n /// @param _workExtraGas The work extra gas\\n function setWorkExtraGas(uint256 _workExtraGas) external;\\n\\n /// @notice Sets the quote twap time\\n /// @param _quoteTwapTime The twap time for quoting\\n function setQuoteTwapTime(uint32 _quoteTwapTime) external;\\n\\n /// @notice Sets the minimum rewarded gas fee\\n /// @param _minBaseFee The minimum rewarded gas fee\\n function setMinBaseFee(uint256 _minBaseFee) external;\\n\\n /// @notice Sets the minimum rewarded gas priority fee\\n /// @param _minPriorityFee The minimum rewarded priority fee\\n function setMinPriorityFee(uint256 _minPriorityFee) external;\\n}\\n\",\"keccak256\":\"0x76f99ca04361c0459fc9e99f0387ddb76da18cc470ec5bc744e7dc3bf6e9d334\",\"license\":\"MIT\"},\"solidity/interfaces/external/IKeep3rV1.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4 <0.9.0;\\n\\nimport '@openzeppelin/contracts/token/ERC20/IERC20.sol';\\nimport '@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol';\\n\\n// solhint-disable func-name-mixedcase\\ninterface IKeep3rV1 is IERC20, IERC20Metadata {\\n // Structs\\n struct Checkpoint {\\n uint32 fromBlock;\\n uint256 votes;\\n }\\n\\n // Events\\n event DelegateChanged(address indexed _delegator, address indexed _fromDelegate, address indexed _toDelegate);\\n event DelegateVotesChanged(address indexed _delegate, uint256 _previousBalance, uint256 _newBalance);\\n event SubmitJob(address indexed _job, address indexed _liquidity, address indexed _provider, uint256 _block, uint256 _credit);\\n event ApplyCredit(address indexed _job, address indexed _liquidity, address indexed _provider, uint256 _block, uint256 _credit);\\n event RemoveJob(address indexed _job, address indexed _liquidity, address indexed _provider, uint256 _block, uint256 _credit);\\n event UnbondJob(address indexed _job, address indexed _liquidity, address indexed _provider, uint256 _block, uint256 _credit);\\n event JobAdded(address indexed _job, uint256 _block, address _governance);\\n event JobRemoved(address indexed _job, uint256 _block, address _governance);\\n event KeeperWorked(address indexed _credit, address indexed _job, address indexed _keeper, uint256 _block, uint256 _amount);\\n event KeeperBonding(address indexed _keeper, uint256 _block, uint256 _active, uint256 _bond);\\n event KeeperBonded(address indexed _keeper, uint256 _block, uint256 _activated, uint256 _bond);\\n event KeeperUnbonding(address indexed _keeper, uint256 _block, uint256 _deactive, uint256 _bond);\\n event KeeperUnbound(address indexed _keeper, uint256 _block, uint256 _deactivated, uint256 _bond);\\n event KeeperSlashed(address indexed _keeper, address indexed _slasher, uint256 _block, uint256 _slash);\\n event KeeperDispute(address indexed _keeper, uint256 _block);\\n event KeeperResolved(address indexed _keeper, uint256 _block);\\n event TokenCreditAddition(address indexed _credit, address indexed _job, address indexed _creditor, uint256 _block, uint256 _amount);\\n\\n // Variables\\n function KPRH() external returns (address);\\n\\n function delegates(address _delegator) external view returns (address);\\n\\n function checkpoints(address _account, uint32 _checkpoint) external view returns (Checkpoint memory);\\n\\n function numCheckpoints(address _account) external view returns (uint32);\\n\\n function DOMAIN_TYPEHASH() external returns (bytes32);\\n\\n function DOMAINSEPARATOR() external returns (bytes32);\\n\\n function DELEGATION_TYPEHASH() external returns (bytes32);\\n\\n function PERMIT_TYPEHASH() external returns (bytes32);\\n\\n function nonces(address _user) external view returns (uint256);\\n\\n function BOND() external returns (uint256);\\n\\n function UNBOND() external returns (uint256);\\n\\n function LIQUIDITYBOND() external returns (uint256);\\n\\n function FEE() external returns (uint256);\\n\\n function BASE() external returns (uint256);\\n\\n function ETH() external returns (address);\\n\\n function bondings(address _user, address _bonding) external view returns (uint256);\\n\\n function canWithdrawAfter(address _user, address _bonding) external view returns (uint256);\\n\\n function pendingUnbonds(address _keeper, address _bonding) external view returns (uint256);\\n\\n function pendingbonds(address _keeper, address _bonding) external view returns (uint256);\\n\\n function bonds(address _keeper, address _bonding) external view returns (uint256);\\n\\n function votes(address _delegator) external view returns (uint256);\\n\\n function firstSeen(address _keeper) external view returns (uint256);\\n\\n function disputes(address _keeper) external view returns (bool);\\n\\n function lastJob(address _keeper) external view returns (uint256);\\n\\n function workCompleted(address _keeper) external view returns (uint256);\\n\\n function jobs(address _job) external view returns (bool);\\n\\n function credits(address _job, address _credit) external view returns (uint256);\\n\\n function liquidityProvided(\\n address _provider,\\n address _liquidity,\\n address _job\\n ) external view returns (uint256);\\n\\n function liquidityUnbonding(\\n address _provider,\\n address _liquidity,\\n address _job\\n ) external view returns (uint256);\\n\\n function liquidityAmountsUnbonding(\\n address _provider,\\n address _liquidity,\\n address _job\\n ) external view returns (uint256);\\n\\n function jobProposalDelay(address _job) external view returns (uint256);\\n\\n function liquidityApplied(\\n address _provider,\\n address _liquidity,\\n address _job\\n ) external view returns (uint256);\\n\\n function liquidityAmount(\\n address _provider,\\n address _liquidity,\\n address _job\\n ) external view returns (uint256);\\n\\n function keepers(address _keeper) external view returns (bool);\\n\\n function blacklist(address _keeper) external view returns (bool);\\n\\n function keeperList(uint256 _index) external view returns (address);\\n\\n function jobList(uint256 _index) external view returns (address);\\n\\n function governance() external returns (address);\\n\\n function pendingGovernance() external returns (address);\\n\\n function liquidityAccepted(address _liquidity) external view returns (bool);\\n\\n function liquidityPairs(uint256 _index) external view returns (address);\\n\\n // Methods\\n function getCurrentVotes(address _account) external view returns (uint256);\\n\\n function addCreditETH(address _job) external payable;\\n\\n function addCredit(\\n address _credit,\\n address _job,\\n uint256 _amount\\n ) external;\\n\\n function addVotes(address _voter, uint256 _amount) external;\\n\\n function removeVotes(address _voter, uint256 _amount) external;\\n\\n function addKPRCredit(address _job, uint256 _amount) external;\\n\\n function approveLiquidity(address _liquidity) external;\\n\\n function revokeLiquidity(address _liquidity) external;\\n\\n function pairs() external view returns (address[] memory);\\n\\n function addLiquidityToJob(\\n address _liquidity,\\n address _job,\\n uint256 _amount\\n ) external;\\n\\n function applyCreditToJob(\\n address _provider,\\n address _liquidity,\\n address _job\\n ) external;\\n\\n function unbondLiquidityFromJob(\\n address _liquidity,\\n address _job,\\n uint256 _amount\\n ) external;\\n\\n function removeLiquidityFromJob(address _liquidity, address _job) external;\\n\\n function mint(uint256 _amount) external;\\n\\n function burn(uint256 _amount) external;\\n\\n function worked(address _keeper) external;\\n\\n function receipt(\\n address _credit,\\n address _keeper,\\n uint256 _amount\\n ) external;\\n\\n function receiptETH(address _keeper, uint256 _amount) external;\\n\\n function addJob(address _job) external;\\n\\n function getJobs() external view returns (address[] memory);\\n\\n function removeJob(address _job) external;\\n\\n function setKeep3rHelper(address _keep3rHelper) external;\\n\\n function setGovernance(address _governance) external;\\n\\n function acceptGovernance() external;\\n\\n function isKeeper(address _keeper) external returns (bool);\\n\\n function isMinKeeper(\\n address _keeper,\\n uint256 _minBond,\\n uint256 _earned,\\n uint256 _age\\n ) external returns (bool);\\n\\n function isBondedKeeper(\\n address _keeper,\\n address _bond,\\n uint256 _minBond,\\n uint256 _earned,\\n uint256 _age\\n ) external returns (bool);\\n\\n function bond(address _bonding, uint256 _amount) external;\\n\\n function getKeepers() external view returns (address[] memory);\\n\\n function activate(address _bonding) external;\\n\\n function unbond(address _bonding, uint256 _amount) external;\\n\\n function slash(\\n address _bonded,\\n address _keeper,\\n uint256 _amount\\n ) external;\\n\\n function withdraw(address _bonding) external;\\n\\n function dispute(address _keeper) external;\\n\\n function revoke(address _keeper) external;\\n\\n function resolve(address _keeper) external;\\n\\n function permit(\\n address _owner,\\n address _spender,\\n uint256 _amount,\\n uint256 _deadline,\\n uint8 _v,\\n bytes32 _r,\\n bytes32 _s\\n ) external;\\n}\\n\",\"keccak256\":\"0xa9806cd6666ab1b7375ef72446964a72397fd4cefc7cc8c5b37caa7c50df0246\",\"license\":\"MIT\"},\"solidity/interfaces/peripherals/IBaseErrors.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity >=0.8.4 <0.9.0;\\n\\ninterface IBaseErrors {\\n /// @notice Throws if a variable is assigned to the zero address\\n error ZeroAddress();\\n}\\n\",\"keccak256\":\"0x9130019a08d9eaedfb920a323fed5c7f409736cd918f1a32921c93551b3ee00e\",\"license\":\"MIT\"},\"solidity/interfaces/peripherals/IDustCollector.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity >=0.8.4 <0.9.0;\\n\\nimport './IBaseErrors.sol';\\n\\ninterface IDustCollector is IBaseErrors {\\n /// @notice Emitted when dust is sent\\n /// @param _token The token that will be transferred\\n /// @param _amount The amount of the token that will be transferred\\n /// @param _to The address which will receive the funds\\n event DustSent(address _token, uint256 _amount, address _to);\\n\\n /// @notice Allows an authorized user to transfer the tokens or eth that may have been left in a contract\\n /// @param _token The token that will be transferred\\n /// @param _amount The amount of the token that will be transferred\\n /// @param _to The address that will receive the idle funds\\n function sendDust(\\n address _token,\\n uint256 _amount,\\n address _to\\n ) external;\\n}\\n\",\"keccak256\":\"0x38dce228111f2a3c6b26ac09c5652c3f1f184c4cfe50d11ff0958ef6a50683bb\",\"license\":\"MIT\"},\"solidity/interfaces/peripherals/IGovernable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4 <0.9.0;\\n\\n/// @title Governable contract\\n/// @notice Manages the governance role\\ninterface IGovernable {\\n // Events\\n\\n /// @notice Emitted when pendingGovernance accepts to be governance\\n /// @param _governance Address of the new governance\\n event GovernanceSet(address _governance);\\n\\n /// @notice Emitted when a new governance is proposed\\n /// @param _pendingGovernance Address that is proposed to be the new governance\\n event GovernanceProposal(address _pendingGovernance);\\n\\n // Errors\\n\\n /// @notice Throws if the caller of the function is not governance\\n error OnlyGovernance();\\n\\n /// @notice Throws if the caller of the function is not pendingGovernance\\n error OnlyPendingGovernance();\\n\\n /// @notice Throws if trying to set governance to zero address\\n error NoGovernanceZeroAddress();\\n\\n // Variables\\n\\n /// @notice Stores the governance address\\n /// @return _governance The governance addresss\\n function governance() external view returns (address _governance);\\n\\n /// @notice Stores the pendingGovernance address\\n /// @return _pendingGovernance The pendingGovernance addresss\\n function pendingGovernance() external view returns (address _pendingGovernance);\\n\\n // Methods\\n\\n /// @notice Proposes a new address to be governance\\n /// @param _governance The address being proposed as the new governance\\n function setGovernance(address _governance) external;\\n\\n /// @notice Changes the governance from the current governance to the previously proposed address\\n function acceptGovernance() external;\\n}\\n\",\"keccak256\":\"0x3284624b2479bbf97c821f37c93a096dcb869b30bbf9b20d30d1800f9535452c\",\"license\":\"MIT\"},\"solidity/interfaces/peripherals/IKeep3rAccountance.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4 <0.9.0;\\n\\nimport './IKeep3rRoles.sol';\\n\\n/// @title Keep3rDisputable contract\\n/// @notice Disputes keepers, or if they're already disputed, it can resolve the case\\n/// @dev Argument `bonding` can be the address of either a token or a liquidity\\ninterface IKeep3rAccountance is IKeep3rRoles {\\n // Events\\n\\n /// @notice Emitted when the bonding process of a new keeper begins\\n /// @param _keeper The caller of Keep3rKeeperFundable#bond function\\n /// @param _bonding The asset the keeper has bonded\\n /// @param _amount The amount the keeper has bonded\\n event Bonding(address indexed _keeper, address indexed _bonding, uint256 _amount);\\n\\n /// @notice Emitted when a keeper or job begins the unbonding process to withdraw the funds\\n /// @param _keeperOrJob The keeper or job that began the unbonding process\\n /// @param _unbonding The liquidity pair or asset being unbonded\\n /// @param _amount The amount being unbonded\\n event Unbonding(address indexed _keeperOrJob, address indexed _unbonding, uint256 _amount);\\n\\n // Variables\\n\\n /// @notice Tracks the total amount of bonded KP3Rs in the contract\\n /// @return _totalBonds The total amount of bonded KP3Rs in the contract\\n function totalBonds() external view returns (uint256 _totalBonds);\\n\\n /// @notice Tracks the total KP3R earnings of a keeper since it started working\\n /// @param _keeper The address of the keeper\\n /// @return _workCompleted Total KP3R earnings of a keeper since it started working\\n function workCompleted(address _keeper) external view returns (uint256 _workCompleted);\\n\\n /// @notice Tracks when a keeper was first registered\\n /// @param _keeper The address of the keeper\\n /// @return timestamp The time at which the keeper was first registered\\n function firstSeen(address _keeper) external view returns (uint256 timestamp);\\n\\n /// @notice Tracks if a keeper or job has a pending dispute\\n /// @param _keeperOrJob The address of the keeper or job\\n /// @return _disputed Whether a keeper or job has a pending dispute\\n function disputes(address _keeperOrJob) external view returns (bool _disputed);\\n\\n /// @notice Tracks how much a keeper has bonded of a certain token\\n /// @param _keeper The address of the keeper\\n /// @param _bond The address of the token being bonded\\n /// @return _bonds Amount of a certain token that a keeper has bonded\\n function bonds(address _keeper, address _bond) external view returns (uint256 _bonds);\\n\\n /// @notice The current token credits available for a job\\n /// @param _job The address of the job\\n /// @param _token The address of the token bonded\\n /// @return _amount The amount of token credits available for a job\\n function jobTokenCredits(address _job, address _token) external view returns (uint256 _amount);\\n\\n /// @notice Tracks the amount of assets deposited in pending bonds\\n /// @param _keeper The address of the keeper\\n /// @param _bonding The address of the token being bonded\\n /// @return _pendingBonds Amount of a certain asset a keeper has unbonding\\n function pendingBonds(address _keeper, address _bonding) external view returns (uint256 _pendingBonds);\\n\\n /// @notice Tracks when a bonding for a keeper can be activated\\n /// @param _keeper The address of the keeper\\n /// @param _bonding The address of the token being bonded\\n /// @return _timestamp Time at which the bonding for a keeper can be activated\\n function canActivateAfter(address _keeper, address _bonding) external view returns (uint256 _timestamp);\\n\\n /// @notice Tracks when keeper bonds are ready to be withdrawn\\n /// @param _keeper The address of the keeper\\n /// @param _bonding The address of the token being unbonded\\n /// @return _timestamp Time at which the keeper bonds are ready to be withdrawn\\n function canWithdrawAfter(address _keeper, address _bonding) external view returns (uint256 _timestamp);\\n\\n /// @notice Tracks how much keeper bonds are to be withdrawn\\n /// @param _keeper The address of the keeper\\n /// @param _bonding The address of the token being unbonded\\n /// @return _pendingUnbonds The amount of keeper bonds that are to be withdrawn\\n function pendingUnbonds(address _keeper, address _bonding) external view returns (uint256 _pendingUnbonds);\\n\\n /// @notice Checks whether the address has ever bonded an asset\\n /// @param _keeper The address of the keeper\\n /// @return _hasBonded Whether the address has ever bonded an asset\\n function hasBonded(address _keeper) external view returns (bool _hasBonded);\\n\\n // Methods\\n\\n /// @notice Lists all jobs\\n /// @return _jobList Array with all the jobs in _jobs\\n function jobs() external view returns (address[] memory _jobList);\\n\\n /// @notice Lists all keepers\\n /// @return _keeperList Array with all the keepers in _keepers\\n function keepers() external view returns (address[] memory _keeperList);\\n\\n // Errors\\n\\n /// @notice Throws when an address is passed as a job, but that address is not a job\\n error JobUnavailable();\\n\\n /// @notice Throws when an action that requires an undisputed job is applied on a disputed job\\n error JobDisputed();\\n}\\n\",\"keccak256\":\"0xf4748c236ddf409e45e7169c735e2fc54e627b2b3ccd189ebb438ad768f1deb1\",\"license\":\"MIT\"},\"solidity/interfaces/peripherals/IKeep3rDisputable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4 <0.9.0;\\n\\n/// @title Keep3rDisputable contract\\n/// @notice Creates/resolves disputes for jobs or keepers\\n/// A disputed keeper is slashable and is not able to bond, activate, withdraw or receive direct payments\\n/// A disputed job is slashable and is not able to pay the keepers, withdraw tokens or to migrate\\ninterface IKeep3rDisputable {\\n /// @notice Emitted when a keeper or a job is disputed\\n /// @param _jobOrKeeper The address of the disputed keeper/job\\n /// @param _disputer The user that called the function and disputed the keeper\\n event Dispute(address indexed _jobOrKeeper, address indexed _disputer);\\n\\n /// @notice Emitted when a dispute is resolved\\n /// @param _jobOrKeeper The address of the disputed keeper/job\\n /// @param _resolver The user that called the function and resolved the dispute\\n event Resolve(address indexed _jobOrKeeper, address indexed _resolver);\\n\\n /// @notice Throws when a job or keeper is already disputed\\n error AlreadyDisputed();\\n\\n /// @notice Throws when a job or keeper is not disputed and someone tries to resolve the dispute\\n error NotDisputed();\\n\\n /// @notice Allows governance to create a dispute for a given keeper/job\\n /// @param _jobOrKeeper The address in dispute\\n function dispute(address _jobOrKeeper) external;\\n\\n /// @notice Allows governance to resolve a dispute on a keeper/job\\n /// @param _jobOrKeeper The address cleared\\n function resolve(address _jobOrKeeper) external;\\n}\\n\",\"keccak256\":\"0x002b9b4c75e62d48d74b6447649d39eb5c1e128d2523bb11e08e9cd3e27b1f70\",\"license\":\"MIT\"},\"solidity/interfaces/peripherals/IKeep3rJobs.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4 <0.9.0;\\n\\nimport './IKeep3rDisputable.sol';\\n\\n/// @title Keep3rJobOwnership contract\\n/// @notice Handles the ownership of the jobs\\ninterface IKeep3rJobOwnership {\\n // Events\\n\\n /// @notice Emitted when Keep3rJobOwnership#changeJobOwnership is called\\n /// @param _job The address of the job proposed to have a change of owner\\n /// @param _owner The current owner of the job\\n /// @param _pendingOwner The new address proposed to be the owner of the job\\n event JobOwnershipChange(address indexed _job, address indexed _owner, address indexed _pendingOwner);\\n\\n /// @notice Emitted when Keep3rJobOwnership#JobOwnershipAssent is called\\n /// @param _job The address of the job which the proposed owner will now own\\n /// @param _previousOwner The previous owner of the job\\n /// @param _newOwner The new owner of the job\\n event JobOwnershipAssent(address indexed _job, address indexed _previousOwner, address indexed _newOwner);\\n\\n // Errors\\n\\n /// @notice Throws when the caller of the function is not the job owner\\n error OnlyJobOwner();\\n\\n /// @notice Throws when the caller of the function is not the pending job owner\\n error OnlyPendingJobOwner();\\n\\n // Variables\\n\\n /// @notice Maps the job to the owner of the job\\n /// @param _job The address of the job\\n /// @return _owner The address of the owner of the job\\n function jobOwner(address _job) external view returns (address _owner);\\n\\n /// @notice Maps the job to its pending owner\\n /// @param _job The address of the job\\n /// @return _pendingOwner The address of the pending owner of the job\\n function jobPendingOwner(address _job) external view returns (address _pendingOwner);\\n\\n // Methods\\n\\n /// @notice Proposes a new address to be the owner of the job\\n /// @param _job The address of the job\\n /// @param _newOwner The address of the proposed new owner\\n function changeJobOwnership(address _job, address _newOwner) external;\\n\\n /// @notice The proposed address accepts to be the owner of the job\\n /// @param _job The address of the job\\n function acceptJobOwnership(address _job) external;\\n}\\n\\n/// @title Keep3rJobManager contract\\n/// @notice Handles the addition and withdrawal of credits from a job\\ninterface IKeep3rJobManager is IKeep3rJobOwnership {\\n // Events\\n\\n /// @notice Emitted when Keep3rJobManager#addJob is called\\n /// @param _job The address of the job to add\\n /// @param _jobOwner The job's owner\\n event JobAddition(address indexed _job, address indexed _jobOwner);\\n\\n // Errors\\n\\n /// @notice Throws when trying to add a job that has already been added\\n error JobAlreadyAdded();\\n\\n /// @notice Throws when the address that is trying to register as a keeper is already a keeper\\n error AlreadyAKeeper();\\n\\n // Methods\\n\\n /// @notice Allows any caller to add a new job\\n /// @param _job Address of the contract for which work should be performed\\n function addJob(address _job) external;\\n}\\n\\n/// @title Keep3rJobFundableCredits contract\\n/// @notice Handles the addition and withdrawal of credits from a job\\ninterface IKeep3rJobFundableCredits is IKeep3rJobOwnership {\\n // Events\\n\\n /// @notice Emitted when Keep3rJobFundableCredits#addTokenCreditsToJob is called\\n /// @param _job The address of the job being credited\\n /// @param _token The address of the token being provided\\n /// @param _provider The user that calls the function\\n /// @param _amount The amount of credit being added to the job\\n event TokenCreditAddition(address indexed _job, address indexed _token, address indexed _provider, uint256 _amount);\\n\\n /// @notice Emitted when Keep3rJobFundableCredits#withdrawTokenCreditsFromJob is called\\n /// @param _job The address of the job from which the credits are withdrawn\\n /// @param _token The credit being withdrawn from the job\\n /// @param _receiver The user that receives the tokens\\n /// @param _amount The amount of credit withdrawn\\n event TokenCreditWithdrawal(address indexed _job, address indexed _token, address indexed _receiver, uint256 _amount);\\n\\n // Errors\\n\\n /// @notice Throws when the token is KP3R, as it should not be used for direct token payments\\n error TokenUnallowed();\\n\\n /// @notice Throws when the token withdraw cooldown has not yet passed\\n error JobTokenCreditsLocked();\\n\\n /// @notice Throws when the user tries to withdraw more tokens than it has\\n error InsufficientJobTokenCredits();\\n\\n // Variables\\n\\n /// @notice Last block where tokens were added to the job\\n /// @param _job The address of the job credited\\n /// @param _token The address of the token credited\\n /// @return _timestamp The last block where tokens were added to the job\\n function jobTokenCreditsAddedAt(address _job, address _token) external view returns (uint256 _timestamp);\\n\\n // Methods\\n\\n /// @notice Add credit to a job to be paid out for work\\n /// @param _job The address of the job being credited\\n /// @param _token The address of the token being credited\\n /// @param _amount The amount of credit being added\\n function addTokenCreditsToJob(\\n address _job,\\n address _token,\\n uint256 _amount\\n ) external;\\n\\n /// @notice Withdraw credit from a job\\n /// @param _job The address of the job from which the credits are withdrawn\\n /// @param _token The address of the token being withdrawn\\n /// @param _amount The amount of token to be withdrawn\\n /// @param _receiver The user that will receive tokens\\n function withdrawTokenCreditsFromJob(\\n address _job,\\n address _token,\\n uint256 _amount,\\n address _receiver\\n ) external;\\n}\\n\\n/// @title Keep3rJobFundableLiquidity contract\\n/// @notice Handles the funding of jobs through specific liquidity pairs\\ninterface IKeep3rJobFundableLiquidity is IKeep3rJobOwnership {\\n // Events\\n\\n /// @notice Emitted when Keep3rJobFundableLiquidity#approveLiquidity function is called\\n /// @param _liquidity The address of the liquidity pair being approved\\n event LiquidityApproval(address _liquidity);\\n\\n /// @notice Emitted when Keep3rJobFundableLiquidity#revokeLiquidity function is called\\n /// @param _liquidity The address of the liquidity pair being revoked\\n event LiquidityRevocation(address _liquidity);\\n\\n /// @notice Emitted when IKeep3rJobFundableLiquidity#addLiquidityToJob function is called\\n /// @param _job The address of the job to which liquidity will be added\\n /// @param _liquidity The address of the liquidity being added\\n /// @param _provider The user that calls the function\\n /// @param _amount The amount of liquidity being added\\n event LiquidityAddition(address indexed _job, address indexed _liquidity, address indexed _provider, uint256 _amount);\\n\\n /// @notice Emitted when IKeep3rJobFundableLiquidity#withdrawLiquidityFromJob function is called\\n /// @param _job The address of the job of which liquidity will be withdrawn from\\n /// @param _liquidity The address of the liquidity being withdrawn\\n /// @param _receiver The receiver of the liquidity tokens\\n /// @param _amount The amount of liquidity being withdrawn from the job\\n event LiquidityWithdrawal(address indexed _job, address indexed _liquidity, address indexed _receiver, uint256 _amount);\\n\\n /// @notice Emitted when Keep3rJobFundableLiquidity#addLiquidityToJob function is called\\n /// @param _job The address of the job whose credits will be updated\\n /// @param _rewardedAt The time at which the job was last rewarded\\n /// @param _currentCredits The current credits of the job\\n /// @param _periodCredits The credits of the job for the current period\\n event LiquidityCreditsReward(address indexed _job, uint256 _rewardedAt, uint256 _currentCredits, uint256 _periodCredits);\\n\\n /// @notice Emitted when Keep3rJobFundableLiquidity#forceLiquidityCreditsToJob function is called\\n /// @param _job The address of the job whose credits will be updated\\n /// @param _rewardedAt The time at which the job was last rewarded\\n /// @param _currentCredits The current credits of the job\\n event LiquidityCreditsForced(address indexed _job, uint256 _rewardedAt, uint256 _currentCredits);\\n\\n // Errors\\n\\n /// @notice Throws when the liquidity being approved has already been approved\\n error LiquidityPairApproved();\\n\\n /// @notice Throws when the liquidity being removed has not been approved\\n error LiquidityPairUnexistent();\\n\\n /// @notice Throws when trying to add liquidity to an unapproved pool\\n error LiquidityPairUnapproved();\\n\\n /// @notice Throws when the job doesn't have the requested liquidity\\n error JobLiquidityUnexistent();\\n\\n /// @notice Throws when trying to remove more liquidity than the job has\\n error JobLiquidityInsufficient();\\n\\n /// @notice Throws when trying to add less liquidity than the minimum liquidity required\\n error JobLiquidityLessThanMin();\\n\\n // Structs\\n\\n /// @notice Stores the tick information of the different liquidity pairs\\n struct TickCache {\\n int56 current; // Tracks the current tick\\n int56 difference; // Stores the difference between the current tick and the last tick\\n uint256 period; // Stores the period at which the last observation was made\\n }\\n\\n // Variables\\n\\n /// @notice Lists liquidity pairs\\n /// @return _list An array of addresses with all the approved liquidity pairs\\n function approvedLiquidities() external view returns (address[] memory _list);\\n\\n /// @notice Amount of liquidity in a specified job\\n /// @param _job The address of the job being checked\\n /// @param _liquidity The address of the liquidity we are checking\\n /// @return _amount Amount of liquidity in the specified job\\n function liquidityAmount(address _job, address _liquidity) external view returns (uint256 _amount);\\n\\n /// @notice Last time the job was rewarded liquidity credits\\n /// @param _job The address of the job being checked\\n /// @return _timestamp Timestamp of the last time the job was rewarded liquidity credits\\n function rewardedAt(address _job) external view returns (uint256 _timestamp);\\n\\n /// @notice Last time the job was worked\\n /// @param _job The address of the job being checked\\n /// @return _timestamp Timestamp of the last time the job was worked\\n function workedAt(address _job) external view returns (uint256 _timestamp);\\n\\n // Methods\\n\\n /// @notice Returns the liquidity credits of a given job\\n /// @param _job The address of the job of which we want to know the liquidity credits\\n /// @return _amount The liquidity credits of a given job\\n function jobLiquidityCredits(address _job) external view returns (uint256 _amount);\\n\\n /// @notice Returns the credits of a given job for the current period\\n /// @param _job The address of the job of which we want to know the period credits\\n /// @return _amount The credits the given job has at the current period\\n function jobPeriodCredits(address _job) external view returns (uint256 _amount);\\n\\n /// @notice Calculates the total credits of a given job\\n /// @param _job The address of the job of which we want to know the total credits\\n /// @return _amount The total credits of the given job\\n function totalJobCredits(address _job) external view returns (uint256 _amount);\\n\\n /// @notice Calculates how many credits should be rewarded periodically for a given liquidity amount\\n /// @dev _periodCredits = underlying KP3Rs for given liquidity amount * rewardPeriod / inflationPeriod\\n /// @param _liquidity The address of the liquidity to provide\\n /// @param _amount The amount of liquidity to provide\\n /// @return _periodCredits The amount of KP3R periodically minted for the given liquidity\\n function quoteLiquidity(address _liquidity, uint256 _amount) external view returns (uint256 _periodCredits);\\n\\n /// @notice Observes the current state of the liquidity pair being observed and updates TickCache with the information\\n /// @param _liquidity The address of the liquidity pair being observed\\n /// @return _tickCache The updated TickCache\\n function observeLiquidity(address _liquidity) external view returns (TickCache memory _tickCache);\\n\\n /// @notice Gifts liquidity credits to the specified job\\n /// @param _job The address of the job being credited\\n /// @param _amount The amount of liquidity credits to gift\\n function forceLiquidityCreditsToJob(address _job, uint256 _amount) external;\\n\\n /// @notice Approve a liquidity pair for being accepted in future\\n /// @param _liquidity The address of the liquidity accepted\\n function approveLiquidity(address _liquidity) external;\\n\\n /// @notice Revoke a liquidity pair from being accepted in future\\n /// @param _liquidity The liquidity no longer accepted\\n function revokeLiquidity(address _liquidity) external;\\n\\n /// @notice Allows anyone to fund a job with liquidity\\n /// @param _job The address of the job to assign liquidity to\\n /// @param _liquidity The liquidity being added\\n /// @param _amount The amount of liquidity tokens to add\\n function addLiquidityToJob(\\n address _job,\\n address _liquidity,\\n uint256 _amount\\n ) external;\\n\\n /// @notice Unbond liquidity for a job\\n /// @dev Can only be called by the job's owner\\n /// @param _job The address of the job being unbonded from\\n /// @param _liquidity The liquidity being unbonded\\n /// @param _amount The amount of liquidity being removed\\n function unbondLiquidityFromJob(\\n address _job,\\n address _liquidity,\\n uint256 _amount\\n ) external;\\n\\n /// @notice Withdraw liquidity from a job\\n /// @param _job The address of the job being withdrawn from\\n /// @param _liquidity The liquidity being withdrawn\\n /// @param _receiver The address that will receive the withdrawn liquidity\\n function withdrawLiquidityFromJob(\\n address _job,\\n address _liquidity,\\n address _receiver\\n ) external;\\n}\\n\\n/// @title Keep3rJobMigration contract\\n/// @notice Handles the migration process of jobs to different addresses\\ninterface IKeep3rJobMigration is IKeep3rJobFundableCredits, IKeep3rJobFundableLiquidity {\\n // Events\\n\\n /// @notice Emitted when Keep3rJobMigration#migrateJob function is called\\n /// @param _fromJob The address of the job that requests to migrate\\n /// @param _toJob The address at which the job requests to migrate\\n event JobMigrationRequested(address indexed _fromJob, address _toJob);\\n\\n /// @notice Emitted when Keep3rJobMigration#acceptJobMigration function is called\\n /// @param _fromJob The address of the job that requested to migrate\\n /// @param _toJob The address at which the job had requested to migrate\\n event JobMigrationSuccessful(address _fromJob, address indexed _toJob);\\n\\n // Errors\\n\\n /// @notice Throws when the address of the job that requests to migrate wants to migrate to its same address\\n error JobMigrationImpossible();\\n\\n /// @notice Throws when the _toJob address differs from the address being tracked in the pendingJobMigrations mapping\\n error JobMigrationUnavailable();\\n\\n /// @notice Throws when cooldown between migrations has not yet passed\\n error JobMigrationLocked();\\n\\n // Variables\\n\\n /// @notice Maps the jobs that have requested a migration to the address they have requested to migrate to\\n /// @return _toJob The address to which the job has requested to migrate to\\n function pendingJobMigrations(address _fromJob) external view returns (address _toJob);\\n\\n // Methods\\n\\n /// @notice Initializes the migration process for a job by adding the request to the pendingJobMigrations mapping\\n /// @param _fromJob The address of the job that is requesting to migrate\\n /// @param _toJob The address at which the job is requesting to migrate\\n function migrateJob(address _fromJob, address _toJob) external;\\n\\n /// @notice Completes the migration process for a job\\n /// @dev Unbond/withdraw process doesn't get migrated\\n /// @param _fromJob The address of the job that requested to migrate\\n /// @param _toJob The address to which the job wants to migrate to\\n function acceptJobMigration(address _fromJob, address _toJob) external;\\n}\\n\\n/// @title Keep3rJobWorkable contract\\n/// @notice Handles the mechanisms jobs can pay keepers with along with the restrictions jobs can put on keepers before they can work on jobs\\ninterface IKeep3rJobWorkable is IKeep3rJobMigration {\\n // Events\\n\\n /// @notice Emitted when a keeper is validated before a job\\n /// @param _gasLeft The amount of gas that the transaction has left at the moment of keeper validation\\n event KeeperValidation(uint256 _gasLeft);\\n\\n /// @notice Emitted when a keeper works a job\\n /// @param _credit The address of the asset in which the keeper is paid\\n /// @param _job The address of the job the keeper has worked\\n /// @param _keeper The address of the keeper that has worked the job\\n /// @param _payment The amount that has been paid out to the keeper in exchange for working the job\\n /// @param _gasLeft The amount of gas that the transaction has left at the moment of payment\\n event KeeperWork(address indexed _credit, address indexed _job, address indexed _keeper, uint256 _payment, uint256 _gasLeft);\\n\\n // Errors\\n\\n /// @notice Throws if work method was called without calling isKeeper or isBondedKeeper\\n error GasNotInitialized();\\n\\n /// @notice Throws if the address claiming to be a job is not in the list of approved jobs\\n error JobUnapproved();\\n\\n /// @notice Throws if the amount of funds in the job is less than the payment that must be paid to the keeper that works that job\\n error InsufficientFunds();\\n\\n // Methods\\n\\n /// @notice Confirms if the current keeper is registered\\n /// @dev Can be used for general (non critical) functions\\n /// @param _keeper The keeper being investigated\\n /// @return _isKeeper Whether the address passed as a parameter is a keeper or not\\n function isKeeper(address _keeper) external returns (bool _isKeeper);\\n\\n /// @notice Confirms if the current keeper is registered and has a minimum bond of any asset.\\n /// @dev Should be used for protected functions\\n /// @param _keeper The keeper to check\\n /// @param _bond The bond token being evaluated\\n /// @param _minBond The minimum amount of bonded tokens\\n /// @param _earned The minimum funds earned in the keepers lifetime\\n /// @param _age The minimum keeper age required\\n /// @return _isBondedKeeper Whether the `_keeper` meets the given requirements\\n function isBondedKeeper(\\n address _keeper,\\n address _bond,\\n uint256 _minBond,\\n uint256 _earned,\\n uint256 _age\\n ) external returns (bool _isBondedKeeper);\\n\\n /// @notice Implemented by jobs to show that a keeper performed work\\n /// @dev Automatically calculates the payment for the keeper and pays the keeper with bonded KP3R\\n /// @param _keeper Address of the keeper that performed the work\\n function worked(address _keeper) external;\\n\\n /// @notice Implemented by jobs to show that a keeper performed work\\n /// @dev Pays the keeper that performs the work with KP3R\\n /// @param _keeper Address of the keeper that performed the work\\n /// @param _payment The reward that should be allocated for the job\\n function bondedPayment(address _keeper, uint256 _payment) external;\\n\\n /// @notice Implemented by jobs to show that a keeper performed work\\n /// @dev Pays the keeper that performs the work with a specific token\\n /// @param _token The asset being awarded to the keeper\\n /// @param _keeper Address of the keeper that performed the work\\n /// @param _amount The reward that should be allocated\\n function directTokenPayment(\\n address _token,\\n address _keeper,\\n uint256 _amount\\n ) external;\\n}\\n\\n/// @title Keep3rJobDisputable contract\\n/// @notice Handles the actions that can be taken on a disputed job\\ninterface IKeep3rJobDisputable is IKeep3rDisputable, IKeep3rJobFundableCredits, IKeep3rJobFundableLiquidity {\\n // Events\\n\\n /// @notice Emitted when Keep3rJobDisputable#slashTokenFromJob is called\\n /// @param _job The address of the job from which the token will be slashed\\n /// @param _token The address of the token being slashed\\n /// @param _slasher The user that slashes the token\\n /// @param _amount The amount of the token being slashed\\n event JobSlashToken(address indexed _job, address _token, address indexed _slasher, uint256 _amount);\\n\\n /// @notice Emitted when Keep3rJobDisputable#slashLiquidityFromJob is called\\n /// @param _job The address of the job from which the liquidity will be slashed\\n /// @param _liquidity The address of the liquidity being slashed\\n /// @param _slasher The user that slashes the liquidity\\n /// @param _amount The amount of the liquidity being slashed\\n event JobSlashLiquidity(address indexed _job, address _liquidity, address indexed _slasher, uint256 _amount);\\n\\n // Errors\\n\\n /// @notice Throws when the token trying to be slashed doesn't exist\\n error JobTokenUnexistent();\\n\\n /// @notice Throws when someone tries to slash more tokens than the job has\\n error JobTokenInsufficient();\\n\\n // Methods\\n\\n /// @notice Allows governance or slasher to slash a job specific token\\n /// @param _job The address of the job from which the token will be slashed\\n /// @param _token The address of the token that will be slashed\\n /// @param _amount The amount of the token that will be slashed\\n function slashTokenFromJob(\\n address _job,\\n address _token,\\n uint256 _amount\\n ) external;\\n\\n /// @notice Allows governance or a slasher to slash liquidity from a job\\n /// @param _job The address being slashed\\n /// @param _liquidity The address of the liquidity that will be slashed\\n /// @param _amount The amount of liquidity that will be slashed\\n function slashLiquidityFromJob(\\n address _job,\\n address _liquidity,\\n uint256 _amount\\n ) external;\\n}\\n\\n// solhint-disable-next-line no-empty-blocks\\ninterface IKeep3rJobs is IKeep3rJobWorkable, IKeep3rJobManager, IKeep3rJobDisputable {\\n\\n}\\n\",\"keccak256\":\"0x08915189f1a9484d17a51b7fb343b765b9edba29062bb644af9663af18f03e34\",\"license\":\"MIT\"},\"solidity/interfaces/peripherals/IKeep3rKeepers.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4 <0.9.0;\\n\\nimport './IKeep3rDisputable.sol';\\n\\n/// @title Keep3rKeeperFundable contract\\n/// @notice Handles the actions required to become a keeper\\ninterface IKeep3rKeeperFundable {\\n // Events\\n\\n /// @notice Emitted when Keep3rKeeperFundable#activate is called\\n /// @param _keeper The keeper that has been activated\\n /// @param _bond The asset the keeper has bonded\\n /// @param _amount The amount of the asset the keeper has bonded\\n event Activation(address indexed _keeper, address indexed _bond, uint256 _amount);\\n\\n /// @notice Emitted when Keep3rKeeperFundable#withdraw is called\\n /// @param _keeper The caller of Keep3rKeeperFundable#withdraw function\\n /// @param _bond The asset to withdraw from the bonding pool\\n /// @param _amount The amount of funds withdrawn\\n event Withdrawal(address indexed _keeper, address indexed _bond, uint256 _amount);\\n\\n // Errors\\n\\n /// @notice Throws when the address that is trying to register as a job is already a job\\n error AlreadyAJob();\\n\\n // Methods\\n\\n /// @notice Beginning of the bonding process\\n /// @param _bonding The asset being bonded\\n /// @param _amount The amount of bonding asset being bonded\\n function bond(address _bonding, uint256 _amount) external;\\n\\n /// @notice Beginning of the unbonding process\\n /// @param _bonding The asset being unbonded\\n /// @param _amount Allows for partial unbonding\\n function unbond(address _bonding, uint256 _amount) external;\\n\\n /// @notice End of the bonding process after bonding time has passed\\n /// @param _bonding The asset being activated as bond collateral\\n function activate(address _bonding) external;\\n\\n /// @notice Withdraw funds after unbonding has finished\\n /// @param _bonding The asset to withdraw from the bonding pool\\n function withdraw(address _bonding) external;\\n}\\n\\n/// @title Keep3rKeeperDisputable contract\\n/// @notice Handles the actions that can be taken on a disputed keeper\\ninterface IKeep3rKeeperDisputable is IKeep3rDisputable, IKeep3rKeeperFundable {\\n // Events\\n\\n /// @notice Emitted when Keep3rKeeperDisputable#slash is called\\n /// @param _keeper The address of the slashed keeper\\n /// @param _slasher The user that called Keep3rKeeperDisputable#slash\\n /// @param _amount The amount of credits slashed from the keeper\\n event KeeperSlash(address indexed _keeper, address indexed _slasher, uint256 _amount);\\n\\n /// @notice Emitted when Keep3rKeeperDisputable#revoke is called\\n /// @param _keeper The address of the revoked keeper\\n /// @param _slasher The user that called Keep3rKeeperDisputable#revoke\\n event KeeperRevoke(address indexed _keeper, address indexed _slasher);\\n\\n // Methods\\n\\n /// @notice Allows governance to slash a keeper based on a dispute\\n /// @param _keeper The address being slashed\\n /// @param _bonded The asset being slashed\\n /// @param _bondAmount The bonded amount being slashed\\n /// @param _unbondAmount The pending unbond amount being slashed\\n function slash(\\n address _keeper,\\n address _bonded,\\n uint256 _bondAmount,\\n uint256 _unbondAmount\\n ) external;\\n\\n /// @notice Blacklists a keeper from participating in the network\\n /// @param _keeper The address being slashed\\n function revoke(address _keeper) external;\\n}\\n\\n// solhint-disable-next-line no-empty-blocks\\n\\n/// @title Keep3rKeepers contract\\ninterface IKeep3rKeepers is IKeep3rKeeperDisputable {\\n\\n}\\n\",\"keccak256\":\"0xc95e6bba82a8371c6bd15a8e9d0df91c826b5050b8ee01d913c1c13a4e92a49b\",\"license\":\"MIT\"},\"solidity/interfaces/peripherals/IKeep3rParameters.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4 <0.9.0;\\n\\nimport './IKeep3rAccountance.sol';\\n\\n/// @title Keep3rParameters contract\\n/// @notice Handles and sets all the required parameters for Keep3r\\ninterface IKeep3rParameters is IKeep3rAccountance {\\n // Events\\n\\n /// @notice Emitted when the Keep3rHelper address is changed\\n /// @param _keep3rHelper The address of Keep3rHelper's contract\\n event Keep3rHelperChange(address _keep3rHelper);\\n\\n /// @notice Emitted when the Keep3rV1 address is changed\\n /// @param _keep3rV1 The address of Keep3rV1's contract\\n event Keep3rV1Change(address _keep3rV1);\\n\\n /// @notice Emitted when the Keep3rV1Proxy address is changed\\n /// @param _keep3rV1Proxy The address of Keep3rV1Proxy's contract\\n event Keep3rV1ProxyChange(address _keep3rV1Proxy);\\n\\n /// @notice Emitted when bondTime is changed\\n /// @param _bondTime The new bondTime\\n event BondTimeChange(uint256 _bondTime);\\n\\n /// @notice Emitted when _liquidityMinimum is changed\\n /// @param _liquidityMinimum The new _liquidityMinimum\\n event LiquidityMinimumChange(uint256 _liquidityMinimum);\\n\\n /// @notice Emitted when _unbondTime is changed\\n /// @param _unbondTime The new _unbondTime\\n event UnbondTimeChange(uint256 _unbondTime);\\n\\n /// @notice Emitted when _rewardPeriodTime is changed\\n /// @param _rewardPeriodTime The new _rewardPeriodTime\\n event RewardPeriodTimeChange(uint256 _rewardPeriodTime);\\n\\n /// @notice Emitted when the inflationPeriod is changed\\n /// @param _inflationPeriod The new inflationPeriod\\n event InflationPeriodChange(uint256 _inflationPeriod);\\n\\n /// @notice Emitted when the fee is changed\\n /// @param _fee The new token credits fee\\n event FeeChange(uint256 _fee);\\n\\n // Variables\\n\\n /// @notice Address of Keep3rHelper's contract\\n /// @return _keep3rHelper The address of Keep3rHelper's contract\\n function keep3rHelper() external view returns (address _keep3rHelper);\\n\\n /// @notice Address of Keep3rV1's contract\\n /// @return _keep3rV1 The address of Keep3rV1's contract\\n function keep3rV1() external view returns (address _keep3rV1);\\n\\n /// @notice Address of Keep3rV1Proxy's contract\\n /// @return _keep3rV1Proxy The address of Keep3rV1Proxy's contract\\n function keep3rV1Proxy() external view returns (address _keep3rV1Proxy);\\n\\n /// @notice The amount of time required to pass after a keeper has bonded assets for it to be able to activate\\n /// @return _days The required bondTime in days\\n function bondTime() external view returns (uint256 _days);\\n\\n /// @notice The amount of time required to pass before a keeper can unbond what he has bonded\\n /// @return _days The required unbondTime in days\\n function unbondTime() external view returns (uint256 _days);\\n\\n /// @notice The minimum amount of liquidity required to fund a job per liquidity\\n /// @return _amount The minimum amount of liquidity in KP3R\\n function liquidityMinimum() external view returns (uint256 _amount);\\n\\n /// @notice The amount of time between each scheduled credits reward given to a job\\n /// @return _days The reward period in days\\n function rewardPeriodTime() external view returns (uint256 _days);\\n\\n /// @notice The inflation period is the denominator used to regulate the emission of KP3R\\n /// @return _period The denominator used to regulate the emission of KP3R\\n function inflationPeriod() external view returns (uint256 _period);\\n\\n /// @notice The fee to be sent to governance when a user adds liquidity to a job\\n /// @return _amount The fee amount to be sent to governance when a user adds liquidity to a job\\n function fee() external view returns (uint256 _amount);\\n\\n // Errors\\n\\n /// @notice Throws if the reward period is less than the minimum reward period time\\n error MinRewardPeriod();\\n\\n /// @notice Throws if either a job or a keeper is disputed\\n error Disputed();\\n\\n /// @notice Throws if there are no bonded assets\\n error BondsUnexistent();\\n\\n /// @notice Throws if the time required to bond an asset has not passed yet\\n error BondsLocked();\\n\\n /// @notice Throws if there are no bonds to withdraw\\n error UnbondsUnexistent();\\n\\n /// @notice Throws if the time required to withdraw the bonds has not passed yet\\n error UnbondsLocked();\\n\\n // Methods\\n\\n /// @notice Sets the Keep3rHelper address\\n /// @param _keep3rHelper The Keep3rHelper address\\n function setKeep3rHelper(address _keep3rHelper) external;\\n\\n /// @notice Sets the Keep3rV1 address\\n /// @param _keep3rV1 The Keep3rV1 address\\n function setKeep3rV1(address _keep3rV1) external;\\n\\n /// @notice Sets the Keep3rV1Proxy address\\n /// @param _keep3rV1Proxy The Keep3rV1Proxy address\\n function setKeep3rV1Proxy(address _keep3rV1Proxy) external;\\n\\n /// @notice Sets the bond time required to activate as a keeper\\n /// @param _bond The new bond time\\n function setBondTime(uint256 _bond) external;\\n\\n /// @notice Sets the unbond time required unbond what has been bonded\\n /// @param _unbond The new unbond time\\n function setUnbondTime(uint256 _unbond) external;\\n\\n /// @notice Sets the minimum amount of liquidity required to fund a job\\n /// @param _liquidityMinimum The new minimum amount of liquidity\\n function setLiquidityMinimum(uint256 _liquidityMinimum) external;\\n\\n /// @notice Sets the time required to pass between rewards for jobs\\n /// @param _rewardPeriodTime The new amount of time required to pass between rewards\\n function setRewardPeriodTime(uint256 _rewardPeriodTime) external;\\n\\n /// @notice Sets the new inflation period\\n /// @param _inflationPeriod The new inflation period\\n function setInflationPeriod(uint256 _inflationPeriod) external;\\n\\n /// @notice Sets the new fee\\n /// @param _fee The new fee\\n function setFee(uint256 _fee) external;\\n}\\n\",\"keccak256\":\"0x942f99c6e3b229a551faaae8f03000b934b20502a7cfade14780508201fd098e\",\"license\":\"MIT\"},\"solidity/interfaces/peripherals/IKeep3rRoles.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4 <0.9.0;\\n\\nimport './IBaseErrors.sol';\\nimport './IGovernable.sol';\\nimport './IDustCollector.sol';\\n\\n/// @title Keep3rRoles contract\\n/// @notice Manages the Keep3r specific roles\\ninterface IKeep3rRoles is IBaseErrors, IDustCollector, IGovernable {\\n // Events\\n\\n /// @notice Emitted when a slasher is added\\n /// @param _slasher Address of the added slasher\\n event SlasherAdded(address _slasher);\\n\\n /// @notice Emitted when a slasher is removed\\n /// @param _slasher Address of the removed slasher\\n event SlasherRemoved(address _slasher);\\n\\n /// @notice Emitted when a disputer is added\\n /// @param _disputer Address of the added disputer\\n event DisputerAdded(address _disputer);\\n\\n /// @notice Emitted when a disputer is removed\\n /// @param _disputer Address of the removed disputer\\n event DisputerRemoved(address _disputer);\\n\\n // Variables\\n\\n /// @notice Tracks whether the address is a slasher or not\\n /// @param _slasher Address being checked as a slasher\\n /// @return _isSlasher Whether the address is a slasher or not\\n function slashers(address _slasher) external view returns (bool _isSlasher);\\n\\n /// @notice Tracks whether the address is a disputer or not\\n /// @param _disputer Address being checked as a disputer\\n /// @return _isDisputer Whether the address is a disputer or not\\n function disputers(address _disputer) external view returns (bool _isDisputer);\\n\\n // Errors\\n\\n /// @notice Throws if the address is already a registered slasher\\n error SlasherExistent();\\n\\n /// @notice Throws if caller is not a registered slasher\\n error SlasherUnexistent();\\n\\n /// @notice Throws if the address is already a registered disputer\\n error DisputerExistent();\\n\\n /// @notice Throws if caller is not a registered disputer\\n error DisputerUnexistent();\\n\\n /// @notice Throws if the msg.sender is not a slasher or is not a part of governance\\n error OnlySlasher();\\n\\n /// @notice Throws if the msg.sender is not a disputer or is not a part of governance\\n error OnlyDisputer();\\n\\n // Methods\\n\\n /// @notice Registers a slasher by updating the slashers mapping\\n function addSlasher(address _slasher) external;\\n\\n /// @notice Removes a slasher by updating the slashers mapping\\n function removeSlasher(address _slasher) external;\\n\\n /// @notice Registers a disputer by updating the disputers mapping\\n function addDisputer(address _disputer) external;\\n\\n /// @notice Removes a disputer by updating the disputers mapping\\n function removeDisputer(address _disputer) external;\\n}\\n\",\"keccak256\":\"0xe6eca166cf6ad99e5379d754030222873bb9868ff3e2a76de815a438ead533a2\",\"license\":\"MIT\"},\"solidity/interfaces/sidechain/IKeep3rHelperSidechain.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4 <0.9.0;\\n\\nimport '../IKeep3rHelper.sol';\\n\\n/// @title Keep3rHelperSidechain contract\\n/// @notice Contains all the helper functions for sidechain keep3r implementations\\ninterface IKeep3rHelperSidechain is IKeep3rHelper {\\n // Events\\n\\n /// @notice The oracle for a liquidity has been saved\\n /// @param _liquidity The address of the given liquidity\\n /// @param _oraclePool The address of the oracle pool\\n event OracleSet(address _liquidity, address _oraclePool);\\n\\n /// @notice Emitted when the WETH USD pool is changed\\n /// @param _address Address of the new WETH USD pool\\n /// @param _isWETHToken0 True if calling the token0 method of the pool returns the WETH token address\\n event WethUSDPoolChange(address _address, bool _isWETHToken0);\\n\\n /// Variables\\n\\n /// @notice Ethereum mainnet WETH address used for quoting references\\n /// @return _weth Address of WETH token\\n // solhint-disable func-name-mixedcase\\n function WETH() external view returns (address _weth);\\n\\n /// @return _oracle The address of the observable pool for given liquidity\\n function oracle(address _liquidity) external view returns (address _oracle);\\n\\n /// @notice WETH-USD pool that is being used as oracle\\n /// @return poolAddress Address of the pool\\n /// @return isTKNToken0 True if calling the token0 method of the pool returns the WETH token address\\n function wethUSDPool() external view returns (address poolAddress, bool isTKNToken0);\\n\\n /// @notice Quotes USD to ETH\\n /// @dev Used to know how much ETH should be paid to keepers before converting it from ETH to KP3R\\n /// @param _usd The amount of USD to quote to ETH\\n /// @return _eth The resulting amount of ETH after quoting the USD\\n function quoteUsdToEth(uint256 _usd) external returns (uint256 _eth);\\n\\n /// Methods\\n\\n /// @notice Sets an oracle for a given liquidity\\n /// @param _liquidity The address of the liquidity\\n /// @param _oracle The address of the pool used to quote the liquidity from\\n /// @dev The oracle must contain KP3R as either token0 or token1\\n function setOracle(address _liquidity, address _oracle) external;\\n\\n /// @notice Sets an oracle for querying WETH/USD quote\\n /// @param _poolAddress The address of the pool used as oracle\\n /// @dev The oracle must contain WETH as either token0 or token1\\n function setWethUsdPool(address _poolAddress) external;\\n}\\n\",\"keccak256\":\"0xb6d5459e8a47ab09a052e1acac1c28304f9f0762d20f01819559b4d39729c987\",\"license\":\"MIT\"}},\"version\":1}", - "bytecode": "0x60c0604052612af8600255612ee0600355680ad78ebc5ac62000006004556184d06005556006805463ffffffff191661025817905564037e11d60060075563773594006008553480156200005257600080fd5b5060405162002625380380620026258339810160408190526200007591620003f1565b8386868483838383816001600160a01b038116620000a55760405162b293ed60e81b815260040160405180910390fd5b600080546001600160a01b03199081166001600160a01b0393841617909155606086901b6001600160601b03191660805260098054909116918516919091179055620000f28185620001e7565b8051600a80546020938401511515600160a01b9081026001600160a81b03199092166001600160a01b03948516179190911791829055604080519383168452910460ff161515928201929092527f554c636366d5fc882a9ab4b7b9d5181781d1a7076abe50ed410365620dcf4108910160405180910390a15050505050606086901b6001600160601b03191660a0525062000192915082905084620001e7565b8051600c80546020909301511515600160a01b026001600160a81b03199093166001600160a01b0390921691909117919091179055620001d56201518062000361565b50506000600555506200047292505050565b60408051808201909152600080825260208201526000826001600160a01b0316846001600160a01b0316630dfe16816040518163ffffffff1660e01b815260040160206040518083038186803b1580156200024157600080fd5b505afa15801562000256573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906200027c9190620003cc565b6001600160a01b03161490508015816200031c5750826001600160a01b0316846001600160a01b031663d21220a76040518163ffffffff1660e01b815260040160206040518083038186803b158015620002d557600080fd5b505afa158015620002ea573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190620003109190620003cc565b6001600160a01b031614155b156200033b5760405163db60809d60e01b815260040160405180910390fd5b604080518082019091526001600160a01b03851681529015156020820152905092915050565b6006805463ffffffff191663ffffffff83169081179091556040519081527fc806e26fb64e3a95f4b70abf4d87280555696244d01068b5f45b0e515aceb1de9060200160405180910390a150565b80516001600160a01b0381168114620003c757600080fd5b919050565b600060208284031215620003df57600080fd5b620003ea82620003af565b9392505050565b60008060008060008060c087890312156200040b57600080fd5b6200041687620003af565b95506200042660208801620003af565b94506200043660408801620003af565b93506200044660608801620003af565b92506200045660808801620003af565b91506200046660a08801620003af565b90509295509295509295565b60805160601c60a05160601c61216b620004ba6000396000818161047001526119130152600081816101fd01528181610b6901528181610bad0152611363015261216b6000f3fe608060405234801561001057600080fd5b50600436106101f35760003560e01c80637b40c913116101165780637b40c913146103c05780638561579c146103df5780638a9b1b09146103e85780639aaad679146103f1578063a0d2710714610416578063a62611a214610429578063ab033ea914610432578063ab5dce0014610445578063ab8cedc514610458578063ad5c46481461046b578063b2e0df9614610492578063b93f5af0146104a5578063c84993af146104b8578063ca4f2803146104cb578063dc686d91146104ec578063e244208b14610524578063eb37d34914610537578063ed1bd76c14610560578063f39c38a014610573578063fae63d6114610586578063fe10d7741461059957600080fd5b806305e0b9a0146101f85780630c52583514610235578063117cfc1b1461024a578063160e1e311461025d5780632248e82d14610270578063238efcbc1461029157806325f09e61146102995780632742b9e7146102a25780632750c0f9146102ab578063289adb44146102d857806337090c2f146102eb5780633b67c3bd146102f45780633cc7ab30146103075780633facf2421461031a578063435b21c114610323578063516c3323146103515780635aa6e675146103645780635c38eb3a14610377578063607e48d41461038a578063696a437b1461039d575b600080fd5b61021f7f000000000000000000000000000000000000000000000000000000000000000081565b60405161022c9190611e85565b60405180910390f35b610248610243366004611e11565b6105ac565b005b60095461021f906001600160a01b031681565b61024861026b366004611ba7565b610613565b61028361027e366004611ccd565b610671565b60405190815260200161022c565b6102486106a4565b61028361271081565b61028360045481565b600c546102ca906001600160a01b03811690600160a01b900460ff1682565b60405161022c929190611eb3565b6102486102e6366004611e11565b610730565b61028360035481565b610283610302366004611e11565b610790565b610248610315366004611ba7565b6108f4565b61028360055481565b610336610331366004611e11565b610992565b6040805193845260208401929092529082015260600161022c565b61028361035f366004611e11565b6109c3565b60005461021f906001600160a01b031681565b610248610385366004611be1565b610a1e565b610248610398366004611e11565b610af1565b6103b06103ab366004611ba7565b610b51565b604051901515815260200161022c565b600a546102ca906001600160a01b03811690600160a01b900460ff1682565b61028360025481565b61028360085481565b6006546104019063ffffffff1681565b60405163ffffffff909116815260200161022c565b610283610424366004611e43565b610c04565b61028360075481565b610248610440366004611ba7565b610c37565b610248610453366004611e11565b610cad565b610283610466366004611dc4565b610d0d565b61021f7f000000000000000000000000000000000000000000000000000000000000000081565b6102486104a0366004611e11565b610db1565b6102486104b3366004611e6a565b610e11565b6102836104c6366004611e11565b610e45565b6104de6104d9366004611ba7565b610e57565b60405161022c929190611e99565b6104ff6104fa366004611c1a565b610f45565b60408051600694850b81529290930b602083015215159181019190915260600161022c565b610248610532366004611e11565b611050565b61021f610545366004611ba7565b600b602052600090815260409020546001600160a01b031681565b61028361056e366004611e11565b6110b0565b60015461021f906001600160a01b031681565b610248610594366004611ba7565b6111f6565b6102836105a7366004611ba7565b611251565b6000546001600160a01b031633146105d7576040516354348f0360e01b815260040160405180910390fd5b60028190556040518181527f0919fdaaac0f59c6bc7eeef4f975d6163475220f1e4820d0bce99c84c51cac1d906020015b60405180910390a150565b6000546001600160a01b0316331461063e576040516354348f0360e01b815260040160405180910390fd5b6001600160a01b0381166106655760405163d92e233d60e01b815260040160405180910390fd5b61066e8161135d565b50565b60008061068061035f85611251565b905061069c6127106106928386611fc5565b61056e9190611fb1565b949350505050565b6001546001600160a01b031633146106cf57604051637ef5703160e11b815260040160405180910390fd5b60018054600080546001600160a01b0383166001600160a01b031991821681179092559091169091556040517fc73be659241aade67e9a059bcf21494955018b213dbd1179054ccf928b13f3b69161072691611e85565b60405180910390a1565b6000546001600160a01b0316331461075b576040516354348f0360e01b815260040160405180910390fd5b60058190556040518181527fed847bdbab1a30becee18585f23c759bd06156561390d2e7fbffd18e74b56c9b90602001610608565b604080516002808252606082018352600092839291906020830190803683375050600654825192935063ffffffff169183915060019081106107d4576107d46120e5565b63ffffffff90921660209283029190910190910152600c5460405163883bdbfd60e01b81526000916001600160a01b03169063883bdbfd9061081a908590600401611ece565b60006040518083038186803b15801561083257600080fd5b505afa158015610846573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f1916820160405261086e9190810190611cf9565b509050600081600181518110610886576108866120e5565b6020026020010151826000815181106108a1576108a16120e5565b60200260200101516108b39190611fe4565b600c549091506108eb908690600160a01b900460ff166108db576108d68361209f565b6108dd565b825b60065463ffffffff16610d0d565b95945050505050565b6000546001600160a01b0316331461091f576040516354348f0360e01b815260040160405180910390fd5b6001600160a01b0381166109465760405163d92e233d60e01b815260040160405180910390fd5b600980546001600160a01b0319166001600160a01b0383169081179091556040517fcf744e4fc39d49b6d8103035078629b8a3be95adc007b0d663e96bdff777b10a9161060891611e85565b60008060006109ab61056e670de0b6b3a7640000610790565b91506109b6846109c3565b6005549095929450925050565b60006109d1826004546113f3565b91506000600454836002546003546109e99190612034565b6109f39190611fc5565b6109fd9190611fb1565b600254610a0a9190611f6b565b9050610a17600182611fc5565b9392505050565b6000546001600160a01b03163314610a49576040516354348f0360e01b815260040160405180910390fd5b6001600160a01b0382161580610a6657506001600160a01b038116155b15610a845760405163d92e233d60e01b815260040160405180910390fd5b6001600160a01b038281166000908152600b60205260409081902080546001600160a01b03191692841692909217909155517fc1d3048301c0d23629a2532c8defa6d68f8e1a0e4157918769e9fb1b2eeb888e90610ae59084908490611e99565b60405180910390a15050565b6000546001600160a01b03163314610b1c576040516354348f0360e01b815260040160405180910390fd5b60078190556040518181527ff1443dcc693c421058f429cf588bc37e5c8de2275c3771a810a5e4bf0a908a4b90602001610608565b6000806000610b5f84610e57565b80925081935050507f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316826001600160a01b03161415610bab575060019392505050565b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316816001600160a01b031614610bfd57604051637d7c8f2760e11b815260040160405180910390fd5b5050919050565b600080610c1d610c1884600687900b611f83565b611409565b90506108eb600160601b86836001600160a01b0316611817565b6000546001600160a01b03163314610c62576040516354348f0360e01b815260040160405180910390fd5b600180546001600160a01b0319166001600160a01b0383161790556040517fe987aaedf9d279143bdf1eee16cf1d0feb47742867d81083df8d6cd0a5ac857f90610608908390611e85565b6000546001600160a01b03163314610cd8576040516354348f0360e01b815260040160405180910390fd5b60048190556040518181527feac367d684b6ac6c6ae7e3e852c06f17e6354e0f1e7122832c3e6d17e0a2b71e90602001610608565b600080610d21610c1884600687900b611f83565b90506001600160801b036001600160a01b03821611610d71576000610d4f6001600160a01b03831680611fc5565b9050610d69600160c01b876001600160801b031683611817565b925050610da9565b6000610d8b6001600160a01b03831680600160401b611817565b9050610da5600160801b876001600160801b031683611817565b9250505b509392505050565b6000546001600160a01b03163314610ddc576040516354348f0360e01b815260040160405180910390fd5b60038190556040518181527fa1292b4e7a0d916ccfd2bc83858b05f328e344d1f0f507d97ac66723ac7c2aaa90602001610608565b6000546001600160a01b03163314610e3c576040516354348f0360e01b815260040160405180910390fd5b61066e816118c5565b6000610e513283610671565b92915050565b600080826001600160a01b0316630dfe16816040518163ffffffff1660e01b815260040160206040518083038186803b158015610e9357600080fd5b505afa158015610ea7573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610ecb9190611bc4565b836001600160a01b031663d21220a76040518163ffffffff1660e01b815260040160206040518083038186803b158015610f0457600080fd5b505afa158015610f18573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610f3c9190611bc4565b91509150915091565b6000806000846001600160a01b031663883bdbfd856040518263ffffffff1660e01b8152600401610f769190611ece565b60006040518083038186803b158015610f8e57600080fd5b505afa925050508015610fc357506040513d6000823e601f3d908101601f19168201604052610fc09190810190611cf9565b60015b610ffd573d808015610ff1576040519150601f19603f3d011682016040523d82523d6000602084013e610ff6565b606091505b5050611049565b81600081518110611010576110106120e5565b602002602001015194506001825111156110425781600181518110611037576110376120e5565b602002602001015193505b6001925050505b9250925092565b6000546001600160a01b0316331461107b576040516354348f0360e01b815260040160405180910390fd5b60088190556040518181527f403b461d2c3bcad840d570faac033e4e69e5649645ce89f3c5b4e28d5415922190602001610608565b604080516002808252606082018352600092839291906020830190803683375050600654825192935063ffffffff169183915060019081106110f4576110f46120e5565b63ffffffff90921660209283029190910190910152600a5460405163883bdbfd60e01b81526000916001600160a01b03169063883bdbfd9061113a908590600401611ece565b60006040518083038186803b15801561115257600080fd5b505afa158015611166573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f1916820160405261118e9190810190611cf9565b5090506000816001815181106111a6576111a66120e5565b6020026020010151826000815181106111c1576111c16120e5565b60200260200101516111d39190611fe4565b600a549091506108eb908690600160a01b900460ff166108db576108d68361209f565b6000546001600160a01b03163314611221576040516354348f0360e01b815260040160405180910390fd5b6001600160a01b0381166112485760405163d92e233d60e01b815260040160405180910390fd5b61066e8161190d565b600080600960009054906101000a90046001600160a01b03166001600160a01b0316631ef94b916040518163ffffffff1660e01b815260040160206040518083038186803b1580156112a257600080fd5b505afa1580156112b6573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906112da9190611bc4565b60095460405163a39744b560e01b81529192506001600160a01b03169063a39744b59061130d9086908590600401611e99565b60206040518083038186803b15801561132557600080fd5b505afa158015611339573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a179190611e2a565b611387817f00000000000000000000000000000000000000000000000000000000000000006119a3565b8051600a80546020909301511515600160a01b9081026001600160a81b03199094166001600160a01b039384161793909317908190556040517f554c636366d5fc882a9ab4b7b9d5181781d1a7076abe50ed410365620dcf410893610608938316920460ff1690611eb3565b60008183106114025781610a17565b5090919050565b60008060008360020b12611420578260020b61142d565b8260020b61142d90612082565b905061143c620d89e71961205f565b60020b8111156114765760405162461bcd60e51b81526020600482015260016024820152601560fa1b604482015260640160405180910390fd5b60006001821661148a57600160801b61149c565b6ffffcb933bd6fad37aa2d162d1a5940015b6001600160881b0316905060028216156114d15760806114cc826ffff97272373d413259a46990580e213a611fc5565b901c90505b60048216156114fb5760806114f6826ffff2e50f5f656932ef12357cf3c7fdcc611fc5565b901c90505b6008821615611525576080611520826fffe5caca7e10e4e61c3624eaa0941cd0611fc5565b901c90505b601082161561154f57608061154a826fffcb9843d60f6159c9db58835c926644611fc5565b901c90505b6020821615611579576080611574826fff973b41fa98c081472e6896dfb254c0611fc5565b901c90505b60408216156115a357608061159e826fff2ea16466c96a3843ec78b326b52861611fc5565b901c90505b60808216156115cd5760806115c8826ffe5dee046a99a2a811c461f1969c3053611fc5565b901c90505b6101008216156115f85760806115f3826ffcbe86c7900a88aedcffc83b479aa3a4611fc5565b901c90505b61020082161561162357608061161e826ff987a7253ac413176f2b074cf7815e54611fc5565b901c90505b61040082161561164e576080611649826ff3392b0822b70005940c7a398e4b70f3611fc5565b901c90505b610800821615611679576080611674826fe7159475a2c29b7443b29c7fa6e889d9611fc5565b901c90505b6110008216156116a457608061169f826fd097f3bdfd2022b8845ad8f792aa5825611fc5565b901c90505b6120008216156116cf5760806116ca826fa9f746462d870fdf8a65dc1f90e061e5611fc5565b901c90505b6140008216156116fa5760806116f5826f70d869a156d2a1b890bb3df62baf32f7611fc5565b901c90505b618000821615611725576080611720826f31be135f97d08fd981231505542fcfa6611fc5565b901c90505b6201000082161561175157608061174c826f09aa508b5b7a84e1c677de54f3e99bc9611fc5565b901c90505b6202000082161561177c576080611777826e5d6af8dedb81196699c329225ee604611fc5565b901c90505b620400008216156117a65760806117a1826d2216e584f5fa1ea926041bedfe98611fc5565b901c90505b620800008216156117ce5760806117c9826b048a170391f7dc42444e8fa2611fc5565b901c90505b60008460020b13156117e9576117e681600019611fb1565b90505b6117f7600160201b8261204b565b15611803576001611806565b60005b61069c9060ff16602083901c611f6b565b600080806000198587098587029250828110838203039150508060001415611851576000841161184657600080fd5b508290049050610a17565b80841161185d57600080fd5b600084868809600260036001881981018916988990049182028318808302840302808302840302808302840302808302840302808302840302918202909203026000889003889004909101858311909403939093029303949094049190911702949350505050565b6006805463ffffffff191663ffffffff83169081179091556040519081527fc806e26fb64e3a95f4b70abf4d87280555696244d01068b5f45b0e515aceb1de90602001610608565b611937817f00000000000000000000000000000000000000000000000000000000000000006119a3565b8051600c80546020909301511515600160a01b9081026001600160a81b03199094166001600160a01b039384161793909317908190556040517fefe4783561b790425a9d83dd379f0e184938b04965a63d14ec51c27cb4ca1b3c93610608938316920460ff1690611eb3565b60408051808201909152600080825260208201526000826001600160a01b0316846001600160a01b0316630dfe16816040518163ffffffff1660e01b815260040160206040518083038186803b1580156119fc57600080fd5b505afa158015611a10573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611a349190611bc4565b6001600160a01b0316149050801581611acf5750826001600160a01b0316846001600160a01b031663d21220a76040518163ffffffff1660e01b815260040160206040518083038186803b158015611a8b57600080fd5b505afa158015611a9f573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611ac39190611bc4565b6001600160a01b031614155b15611aed5760405163db60809d60e01b815260040160405180910390fd5b604080518082019091526001600160a01b03851681529015156020820152905092915050565b600082601f830112611b2457600080fd5b81516020611b39611b3483611f48565b611f18565b80838252828201915082860187848660051b8901011115611b5957600080fd5b60005b85811015611b81578151611b6f81612111565b84529284019290840190600101611b5c565b5090979650505050505050565b803563ffffffff81168114611ba257600080fd5b919050565b600060208284031215611bb957600080fd5b8135610a1781612111565b600060208284031215611bd657600080fd5b8151610a1781612111565b60008060408385031215611bf457600080fd5b8235611bff81612111565b91506020830135611c0f81612111565b809150509250929050565b60008060408385031215611c2d57600080fd5b8235611c3881612111565b91506020838101356001600160401b03811115611c5457600080fd5b8401601f81018613611c6557600080fd5b8035611c73611b3482611f48565b80828252848201915084840189868560051b8701011115611c9357600080fd5b600094505b83851015611cbd57611ca981611b8e565b835260019490940193918501918501611c98565b5080955050505050509250929050565b60008060408385031215611ce057600080fd5b8235611ceb81612111565b946020939093013593505050565b60008060408385031215611d0c57600080fd5b82516001600160401b0380821115611d2357600080fd5b818501915085601f830112611d3757600080fd5b81516020611d47611b3483611f48565b8083825282820191508286018a848660051b8901011115611d6757600080fd5b600096505b84871015611d93578051611d7f81612126565b835260019690960195918301918301611d6c565b5091880151919650909350505080821115611dad57600080fd5b50611dba85828601611b13565b9150509250929050565b600080600060608486031215611dd957600080fd5b83356001600160801b0381168114611df057600080fd5b92506020840135611e0081612126565b929592945050506040919091013590565b600060208284031215611e2357600080fd5b5035919050565b600060208284031215611e3c57600080fd5b5051919050565b600080600060608486031215611e5857600080fd5b833592506020840135611e0081612126565b600060208284031215611e7c57600080fd5b610a1782611b8e565b6001600160a01b0391909116815260200190565b6001600160a01b0392831681529116602082015260400190565b6001600160a01b039290921682521515602082015260400190565b6020808252825182820181905260009190848201906040850190845b81811015611f0c57835163ffffffff1683529284019291840191600101611eea565b50909695505050505050565b604051601f8201601f191681016001600160401b0381118282101715611f4057611f406120fb565b604052919050565b60006001600160401b03821115611f6157611f616120fb565b5060051b60200190565b60008219821115611f7e57611f7e6120b9565b500190565b600082611f9257611f926120cf565b600160ff1b821460001984141615611fac57611fac6120b9565b500590565b600082611fc057611fc06120cf565b500490565b6000816000190483118215151615611fdf57611fdf6120b9565b500290565b60008160060b8360060b6000811281667fffffffffffff190183128115161561200f5761200f6120b9565b81667fffffffffffff01831381161561202a5761202a6120b9565b5090039392505050565b600082821015612046576120466120b9565b500390565b60008261205a5761205a6120cf565b500690565b60008160020b627fffff19811415612079576120796120b9565b60000392915050565b6000600160ff1b821415612098576120986120b9565b5060000390565b60008160060b667fffffffffffff19811415612079576120795b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052601260045260246000fd5b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052604160045260246000fd5b6001600160a01b038116811461066e57600080fd5b8060060b811461066e57600080fdfea264697066735822122013caec67b9b218ca18a717b11d92ba62488d93a218d97f2464182db56918e05c64736f6c63430008070033", - "deployedBytecode": "0x608060405234801561001057600080fd5b50600436106101f35760003560e01c80637b40c913116101165780637b40c913146103c05780638561579c146103df5780638a9b1b09146103e85780639aaad679146103f1578063a0d2710714610416578063a62611a214610429578063ab033ea914610432578063ab5dce0014610445578063ab8cedc514610458578063ad5c46481461046b578063b2e0df9614610492578063b93f5af0146104a5578063c84993af146104b8578063ca4f2803146104cb578063dc686d91146104ec578063e244208b14610524578063eb37d34914610537578063ed1bd76c14610560578063f39c38a014610573578063fae63d6114610586578063fe10d7741461059957600080fd5b806305e0b9a0146101f85780630c52583514610235578063117cfc1b1461024a578063160e1e311461025d5780632248e82d14610270578063238efcbc1461029157806325f09e61146102995780632742b9e7146102a25780632750c0f9146102ab578063289adb44146102d857806337090c2f146102eb5780633b67c3bd146102f45780633cc7ab30146103075780633facf2421461031a578063435b21c114610323578063516c3323146103515780635aa6e675146103645780635c38eb3a14610377578063607e48d41461038a578063696a437b1461039d575b600080fd5b61021f7f000000000000000000000000000000000000000000000000000000000000000081565b60405161022c9190611e85565b60405180910390f35b610248610243366004611e11565b6105ac565b005b60095461021f906001600160a01b031681565b61024861026b366004611ba7565b610613565b61028361027e366004611ccd565b610671565b60405190815260200161022c565b6102486106a4565b61028361271081565b61028360045481565b600c546102ca906001600160a01b03811690600160a01b900460ff1682565b60405161022c929190611eb3565b6102486102e6366004611e11565b610730565b61028360035481565b610283610302366004611e11565b610790565b610248610315366004611ba7565b6108f4565b61028360055481565b610336610331366004611e11565b610992565b6040805193845260208401929092529082015260600161022c565b61028361035f366004611e11565b6109c3565b60005461021f906001600160a01b031681565b610248610385366004611be1565b610a1e565b610248610398366004611e11565b610af1565b6103b06103ab366004611ba7565b610b51565b604051901515815260200161022c565b600a546102ca906001600160a01b03811690600160a01b900460ff1682565b61028360025481565b61028360085481565b6006546104019063ffffffff1681565b60405163ffffffff909116815260200161022c565b610283610424366004611e43565b610c04565b61028360075481565b610248610440366004611ba7565b610c37565b610248610453366004611e11565b610cad565b610283610466366004611dc4565b610d0d565b61021f7f000000000000000000000000000000000000000000000000000000000000000081565b6102486104a0366004611e11565b610db1565b6102486104b3366004611e6a565b610e11565b6102836104c6366004611e11565b610e45565b6104de6104d9366004611ba7565b610e57565b60405161022c929190611e99565b6104ff6104fa366004611c1a565b610f45565b60408051600694850b81529290930b602083015215159181019190915260600161022c565b610248610532366004611e11565b611050565b61021f610545366004611ba7565b600b602052600090815260409020546001600160a01b031681565b61028361056e366004611e11565b6110b0565b60015461021f906001600160a01b031681565b610248610594366004611ba7565b6111f6565b6102836105a7366004611ba7565b611251565b6000546001600160a01b031633146105d7576040516354348f0360e01b815260040160405180910390fd5b60028190556040518181527f0919fdaaac0f59c6bc7eeef4f975d6163475220f1e4820d0bce99c84c51cac1d906020015b60405180910390a150565b6000546001600160a01b0316331461063e576040516354348f0360e01b815260040160405180910390fd5b6001600160a01b0381166106655760405163d92e233d60e01b815260040160405180910390fd5b61066e8161135d565b50565b60008061068061035f85611251565b905061069c6127106106928386611fc5565b61056e9190611fb1565b949350505050565b6001546001600160a01b031633146106cf57604051637ef5703160e11b815260040160405180910390fd5b60018054600080546001600160a01b0383166001600160a01b031991821681179092559091169091556040517fc73be659241aade67e9a059bcf21494955018b213dbd1179054ccf928b13f3b69161072691611e85565b60405180910390a1565b6000546001600160a01b0316331461075b576040516354348f0360e01b815260040160405180910390fd5b60058190556040518181527fed847bdbab1a30becee18585f23c759bd06156561390d2e7fbffd18e74b56c9b90602001610608565b604080516002808252606082018352600092839291906020830190803683375050600654825192935063ffffffff169183915060019081106107d4576107d46120e5565b63ffffffff90921660209283029190910190910152600c5460405163883bdbfd60e01b81526000916001600160a01b03169063883bdbfd9061081a908590600401611ece565b60006040518083038186803b15801561083257600080fd5b505afa158015610846573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f1916820160405261086e9190810190611cf9565b509050600081600181518110610886576108866120e5565b6020026020010151826000815181106108a1576108a16120e5565b60200260200101516108b39190611fe4565b600c549091506108eb908690600160a01b900460ff166108db576108d68361209f565b6108dd565b825b60065463ffffffff16610d0d565b95945050505050565b6000546001600160a01b0316331461091f576040516354348f0360e01b815260040160405180910390fd5b6001600160a01b0381166109465760405163d92e233d60e01b815260040160405180910390fd5b600980546001600160a01b0319166001600160a01b0383169081179091556040517fcf744e4fc39d49b6d8103035078629b8a3be95adc007b0d663e96bdff777b10a9161060891611e85565b60008060006109ab61056e670de0b6b3a7640000610790565b91506109b6846109c3565b6005549095929450925050565b60006109d1826004546113f3565b91506000600454836002546003546109e99190612034565b6109f39190611fc5565b6109fd9190611fb1565b600254610a0a9190611f6b565b9050610a17600182611fc5565b9392505050565b6000546001600160a01b03163314610a49576040516354348f0360e01b815260040160405180910390fd5b6001600160a01b0382161580610a6657506001600160a01b038116155b15610a845760405163d92e233d60e01b815260040160405180910390fd5b6001600160a01b038281166000908152600b60205260409081902080546001600160a01b03191692841692909217909155517fc1d3048301c0d23629a2532c8defa6d68f8e1a0e4157918769e9fb1b2eeb888e90610ae59084908490611e99565b60405180910390a15050565b6000546001600160a01b03163314610b1c576040516354348f0360e01b815260040160405180910390fd5b60078190556040518181527ff1443dcc693c421058f429cf588bc37e5c8de2275c3771a810a5e4bf0a908a4b90602001610608565b6000806000610b5f84610e57565b80925081935050507f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316826001600160a01b03161415610bab575060019392505050565b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316816001600160a01b031614610bfd57604051637d7c8f2760e11b815260040160405180910390fd5b5050919050565b600080610c1d610c1884600687900b611f83565b611409565b90506108eb600160601b86836001600160a01b0316611817565b6000546001600160a01b03163314610c62576040516354348f0360e01b815260040160405180910390fd5b600180546001600160a01b0319166001600160a01b0383161790556040517fe987aaedf9d279143bdf1eee16cf1d0feb47742867d81083df8d6cd0a5ac857f90610608908390611e85565b6000546001600160a01b03163314610cd8576040516354348f0360e01b815260040160405180910390fd5b60048190556040518181527feac367d684b6ac6c6ae7e3e852c06f17e6354e0f1e7122832c3e6d17e0a2b71e90602001610608565b600080610d21610c1884600687900b611f83565b90506001600160801b036001600160a01b03821611610d71576000610d4f6001600160a01b03831680611fc5565b9050610d69600160c01b876001600160801b031683611817565b925050610da9565b6000610d8b6001600160a01b03831680600160401b611817565b9050610da5600160801b876001600160801b031683611817565b9250505b509392505050565b6000546001600160a01b03163314610ddc576040516354348f0360e01b815260040160405180910390fd5b60038190556040518181527fa1292b4e7a0d916ccfd2bc83858b05f328e344d1f0f507d97ac66723ac7c2aaa90602001610608565b6000546001600160a01b03163314610e3c576040516354348f0360e01b815260040160405180910390fd5b61066e816118c5565b6000610e513283610671565b92915050565b600080826001600160a01b0316630dfe16816040518163ffffffff1660e01b815260040160206040518083038186803b158015610e9357600080fd5b505afa158015610ea7573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610ecb9190611bc4565b836001600160a01b031663d21220a76040518163ffffffff1660e01b815260040160206040518083038186803b158015610f0457600080fd5b505afa158015610f18573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610f3c9190611bc4565b91509150915091565b6000806000846001600160a01b031663883bdbfd856040518263ffffffff1660e01b8152600401610f769190611ece565b60006040518083038186803b158015610f8e57600080fd5b505afa925050508015610fc357506040513d6000823e601f3d908101601f19168201604052610fc09190810190611cf9565b60015b610ffd573d808015610ff1576040519150601f19603f3d011682016040523d82523d6000602084013e610ff6565b606091505b5050611049565b81600081518110611010576110106120e5565b602002602001015194506001825111156110425781600181518110611037576110376120e5565b602002602001015193505b6001925050505b9250925092565b6000546001600160a01b0316331461107b576040516354348f0360e01b815260040160405180910390fd5b60088190556040518181527f403b461d2c3bcad840d570faac033e4e69e5649645ce89f3c5b4e28d5415922190602001610608565b604080516002808252606082018352600092839291906020830190803683375050600654825192935063ffffffff169183915060019081106110f4576110f46120e5565b63ffffffff90921660209283029190910190910152600a5460405163883bdbfd60e01b81526000916001600160a01b03169063883bdbfd9061113a908590600401611ece565b60006040518083038186803b15801561115257600080fd5b505afa158015611166573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f1916820160405261118e9190810190611cf9565b5090506000816001815181106111a6576111a66120e5565b6020026020010151826000815181106111c1576111c16120e5565b60200260200101516111d39190611fe4565b600a549091506108eb908690600160a01b900460ff166108db576108d68361209f565b6000546001600160a01b03163314611221576040516354348f0360e01b815260040160405180910390fd5b6001600160a01b0381166112485760405163d92e233d60e01b815260040160405180910390fd5b61066e8161190d565b600080600960009054906101000a90046001600160a01b03166001600160a01b0316631ef94b916040518163ffffffff1660e01b815260040160206040518083038186803b1580156112a257600080fd5b505afa1580156112b6573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906112da9190611bc4565b60095460405163a39744b560e01b81529192506001600160a01b03169063a39744b59061130d9086908590600401611e99565b60206040518083038186803b15801561132557600080fd5b505afa158015611339573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a179190611e2a565b611387817f00000000000000000000000000000000000000000000000000000000000000006119a3565b8051600a80546020909301511515600160a01b9081026001600160a81b03199094166001600160a01b039384161793909317908190556040517f554c636366d5fc882a9ab4b7b9d5181781d1a7076abe50ed410365620dcf410893610608938316920460ff1690611eb3565b60008183106114025781610a17565b5090919050565b60008060008360020b12611420578260020b61142d565b8260020b61142d90612082565b905061143c620d89e71961205f565b60020b8111156114765760405162461bcd60e51b81526020600482015260016024820152601560fa1b604482015260640160405180910390fd5b60006001821661148a57600160801b61149c565b6ffffcb933bd6fad37aa2d162d1a5940015b6001600160881b0316905060028216156114d15760806114cc826ffff97272373d413259a46990580e213a611fc5565b901c90505b60048216156114fb5760806114f6826ffff2e50f5f656932ef12357cf3c7fdcc611fc5565b901c90505b6008821615611525576080611520826fffe5caca7e10e4e61c3624eaa0941cd0611fc5565b901c90505b601082161561154f57608061154a826fffcb9843d60f6159c9db58835c926644611fc5565b901c90505b6020821615611579576080611574826fff973b41fa98c081472e6896dfb254c0611fc5565b901c90505b60408216156115a357608061159e826fff2ea16466c96a3843ec78b326b52861611fc5565b901c90505b60808216156115cd5760806115c8826ffe5dee046a99a2a811c461f1969c3053611fc5565b901c90505b6101008216156115f85760806115f3826ffcbe86c7900a88aedcffc83b479aa3a4611fc5565b901c90505b61020082161561162357608061161e826ff987a7253ac413176f2b074cf7815e54611fc5565b901c90505b61040082161561164e576080611649826ff3392b0822b70005940c7a398e4b70f3611fc5565b901c90505b610800821615611679576080611674826fe7159475a2c29b7443b29c7fa6e889d9611fc5565b901c90505b6110008216156116a457608061169f826fd097f3bdfd2022b8845ad8f792aa5825611fc5565b901c90505b6120008216156116cf5760806116ca826fa9f746462d870fdf8a65dc1f90e061e5611fc5565b901c90505b6140008216156116fa5760806116f5826f70d869a156d2a1b890bb3df62baf32f7611fc5565b901c90505b618000821615611725576080611720826f31be135f97d08fd981231505542fcfa6611fc5565b901c90505b6201000082161561175157608061174c826f09aa508b5b7a84e1c677de54f3e99bc9611fc5565b901c90505b6202000082161561177c576080611777826e5d6af8dedb81196699c329225ee604611fc5565b901c90505b620400008216156117a65760806117a1826d2216e584f5fa1ea926041bedfe98611fc5565b901c90505b620800008216156117ce5760806117c9826b048a170391f7dc42444e8fa2611fc5565b901c90505b60008460020b13156117e9576117e681600019611fb1565b90505b6117f7600160201b8261204b565b15611803576001611806565b60005b61069c9060ff16602083901c611f6b565b600080806000198587098587029250828110838203039150508060001415611851576000841161184657600080fd5b508290049050610a17565b80841161185d57600080fd5b600084868809600260036001881981018916988990049182028318808302840302808302840302808302840302808302840302808302840302918202909203026000889003889004909101858311909403939093029303949094049190911702949350505050565b6006805463ffffffff191663ffffffff83169081179091556040519081527fc806e26fb64e3a95f4b70abf4d87280555696244d01068b5f45b0e515aceb1de90602001610608565b611937817f00000000000000000000000000000000000000000000000000000000000000006119a3565b8051600c80546020909301511515600160a01b9081026001600160a81b03199094166001600160a01b039384161793909317908190556040517fefe4783561b790425a9d83dd379f0e184938b04965a63d14ec51c27cb4ca1b3c93610608938316920460ff1690611eb3565b60408051808201909152600080825260208201526000826001600160a01b0316846001600160a01b0316630dfe16816040518163ffffffff1660e01b815260040160206040518083038186803b1580156119fc57600080fd5b505afa158015611a10573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611a349190611bc4565b6001600160a01b0316149050801581611acf5750826001600160a01b0316846001600160a01b031663d21220a76040518163ffffffff1660e01b815260040160206040518083038186803b158015611a8b57600080fd5b505afa158015611a9f573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611ac39190611bc4565b6001600160a01b031614155b15611aed5760405163db60809d60e01b815260040160405180910390fd5b604080518082019091526001600160a01b03851681529015156020820152905092915050565b600082601f830112611b2457600080fd5b81516020611b39611b3483611f48565b611f18565b80838252828201915082860187848660051b8901011115611b5957600080fd5b60005b85811015611b81578151611b6f81612111565b84529284019290840190600101611b5c565b5090979650505050505050565b803563ffffffff81168114611ba257600080fd5b919050565b600060208284031215611bb957600080fd5b8135610a1781612111565b600060208284031215611bd657600080fd5b8151610a1781612111565b60008060408385031215611bf457600080fd5b8235611bff81612111565b91506020830135611c0f81612111565b809150509250929050565b60008060408385031215611c2d57600080fd5b8235611c3881612111565b91506020838101356001600160401b03811115611c5457600080fd5b8401601f81018613611c6557600080fd5b8035611c73611b3482611f48565b80828252848201915084840189868560051b8701011115611c9357600080fd5b600094505b83851015611cbd57611ca981611b8e565b835260019490940193918501918501611c98565b5080955050505050509250929050565b60008060408385031215611ce057600080fd5b8235611ceb81612111565b946020939093013593505050565b60008060408385031215611d0c57600080fd5b82516001600160401b0380821115611d2357600080fd5b818501915085601f830112611d3757600080fd5b81516020611d47611b3483611f48565b8083825282820191508286018a848660051b8901011115611d6757600080fd5b600096505b84871015611d93578051611d7f81612126565b835260019690960195918301918301611d6c565b5091880151919650909350505080821115611dad57600080fd5b50611dba85828601611b13565b9150509250929050565b600080600060608486031215611dd957600080fd5b83356001600160801b0381168114611df057600080fd5b92506020840135611e0081612126565b929592945050506040919091013590565b600060208284031215611e2357600080fd5b5035919050565b600060208284031215611e3c57600080fd5b5051919050565b600080600060608486031215611e5857600080fd5b833592506020840135611e0081612126565b600060208284031215611e7c57600080fd5b610a1782611b8e565b6001600160a01b0391909116815260200190565b6001600160a01b0392831681529116602082015260400190565b6001600160a01b039290921682521515602082015260400190565b6020808252825182820181905260009190848201906040850190845b81811015611f0c57835163ffffffff1683529284019291840191600101611eea565b50909695505050505050565b604051601f8201601f191681016001600160401b0381118282101715611f4057611f406120fb565b604052919050565b60006001600160401b03821115611f6157611f616120fb565b5060051b60200190565b60008219821115611f7e57611f7e6120b9565b500190565b600082611f9257611f926120cf565b600160ff1b821460001984141615611fac57611fac6120b9565b500590565b600082611fc057611fc06120cf565b500490565b6000816000190483118215151615611fdf57611fdf6120b9565b500290565b60008160060b8360060b6000811281667fffffffffffff190183128115161561200f5761200f6120b9565b81667fffffffffffff01831381161561202a5761202a6120b9565b5090039392505050565b600082821015612046576120466120b9565b500390565b60008261205a5761205a6120cf565b500690565b60008160020b627fffff19811415612079576120796120b9565b60000392915050565b6000600160ff1b821415612098576120986120b9565b5060000390565b60008160060b667fffffffffffff19811415612079576120795b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052601260045260246000fd5b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052604160045260246000fd5b6001600160a01b038116811461066e57600080fd5b8060060b811461066e57600080fdfea264697066735822122013caec67b9b218ca18a717b11d92ba62488d93a218d97f2464182db56918e05c64736f6c63430008070033", - "devdoc": { - "kind": "dev", - "methods": { - "bonds(address)": { - "params": { - "_keeper": "The address of the keeper to check" - }, - "returns": { - "_amountBonded": "The amount of KP3R the keeper has bonded" - } - }, - "constructor": { - "details": "Oracle pools should use 18 decimals tokens", - "params": { - "_governance": "Address of governance", - "_keep3rV2": "Address of sidechain Keep3r implementation", - "_kp3rWethOracle": "Address of oracle used for KP3R/WETH quote", - "_wethUsdOracle": "Address of oracle used for WETH/USD quote" - } - }, - "getKP3RsAtTick(uint256,int56,uint256)": { - "params": { - "_liquidityAmount": "Amount of liquidity to be converted", - "_tickDifference": "Tick value used to calculate the quote", - "_timeInterval": "Time value used to calculate the quote" - }, - "returns": { - "_kp3rAmount": "Amount of KP3R tokens underlying on the given liquidity" - } - }, - "getPaymentParams(uint256)": { - "params": { - "_bonds": "Amount of bonded KP3R owned by the keeper" - }, - "returns": { - "_boost": "Multiplier per gas unit. Takes into account the base fee and the amount of bonded KP3R", - "_extraGas": "Amount of extra gas that should be added to the gas spent", - "_oneUsdQuote": "Amount of KP3R tokens equivalent to 1 ETH" - } - }, - "getPoolTokens(address)": { - "params": { - "_pool": "Address of the correspondant pool" - }, - "returns": { - "_token0": "Address of the first token of the pair", - "_token1": "Address of the second token of the pair" - } - }, - "getQuoteAtTick(uint128,int56,uint256)": { - "params": { - "_baseAmount": "Amount of token to be converted", - "_tickDifference": "Tick value used to calculate the quote", - "_timeInterval": "Time value used to calculate the quote" - }, - "returns": { - "_quoteAmount": "Amount of credits deserved for the baseAmount at the tick value" - } - }, - "getRewardAmount(uint256)": { - "params": { - "_gasUsed": "The amount of gas used that will be rewarded" - }, - "returns": { - "_amount": "The amount of KP3R that should be awarded to tx.origin" - } - }, - "getRewardAmountFor(address,uint256)": { - "params": { - "_gasUsed": "The amount of gas used that will be rewarded", - "_keeper": "The address of the keeper to check" - }, - "returns": { - "_kp3r": "The amount of KP3R that should be awarded to the keeper" - } - }, - "getRewardBoostFor(uint256)": { - "details": "If the keeper has no bonds, boost should be +10% of gas cost, if keeper has max bonds, +20%", - "params": { - "_bonds": "The amount of KP3R tokens bonded by the keeper" - }, - "returns": { - "_rewardBoost": "The reward boost that corresponds to the keeper" - } - }, - "isKP3RToken0(address)": { - "params": { - "_pool": "Address of the correspondant pool" - }, - "returns": { - "_isKP3RToken0": "Boolean indicating the order of the tokens in the pair" - } - }, - "observe(address,uint32[])": { - "params": { - "_pool": "Address of the pool to observe", - "_secondsAgo": "Array with time references to observe" - }, - "returns": { - "_success": "Boolean indicating if the observe call was succesfull", - "_tickCumulative1": "Cumulative sum of ticks until first time reference", - "_tickCumulative2": "Cumulative sum of ticks until second time reference" - } - }, - "quote(uint256)": { - "details": "This function allows us to calculate how much KP3R we should pay to a keeper for things expressed in ETH, like gas", - "params": { - "_eth": "The amount of ETH" - }, - "returns": { - "_amountOut": "The amount of KP3R" - } - }, - "quoteUsdToEth(uint256)": { - "details": "Used to know how much ETH should be paid to keepers before converting it from ETH to KP3R", - "params": { - "_usd": "The amount of USD to quote to ETH" - }, - "returns": { - "_amountOut": "The resulting amount of ETH after quoting the USD" - } - }, - "setGovernance(address)": { - "params": { - "_governance": "The address being proposed as the new governance" - } - }, - "setKeep3rV2(address)": { - "params": { - "_keep3rV2": "The address of Keep3r V2" - } - }, - "setKp3rWethPool(address)": { - "params": { - "_poolAddress": "The address of the KP3R-WETH pool" - } - }, - "setMaxBoost(uint256)": { - "params": { - "_maxBoost": "The maximum boost multiplier" - } - }, - "setMinBaseFee(uint256)": { - "params": { - "_minBaseFee": "The minimum rewarded gas fee" - } - }, - "setMinBoost(uint256)": { - "params": { - "_minBoost": "The minimum boost multiplier" - } - }, - "setMinPriorityFee(uint256)": { - "params": { - "_minPriorityFee": "The minimum rewarded priority fee" - } - }, - "setOracle(address,address)": { - "details": "The oracle must contain KP3R as either token0 or token1", - "params": { - "_liquidity": "The address of the liquidity", - "_oracle": "The address of the pool used to quote the liquidity from" - } - }, - "setQuoteTwapTime(uint32)": { - "params": { - "_quoteTwapTime": "The twap time for quoting" - } - }, - "setTargetBond(uint256)": { - "params": { - "_targetBond": "The target bond amount" - } - }, - "setWethUsdPool(address)": { - "details": "The oracle must contain WETH as either token0 or token1", - "params": { - "_poolAddress": "The address of the pool used as oracle" - } - }, - "setWorkExtraGas(uint256)": { - "params": { - "_workExtraGas": "The work extra gas" - } - } - }, - "stateVariables": { - "oracle": { - "return": "_oracle The address of the observable pool for given liquidity", - "returns": { - "_0": "_oracle The address of the observable pool for given liquidity" - } - }, - "wethUSDPool": { - "returns": { - "isTKNToken0": "True if calling the token0 method of the pool returns the WETH token address", - "poolAddress": "Address of the pool" - } - } - }, - "version": 1 - }, - "userdoc": { - "errors": { - "InvalidOraclePool()": [ - { - "notice": "Throws when pool does not have KP3R as token0 nor token1" - } - ], - "LiquidityPairInvalid()": [ - { - "notice": "Throws when none of the tokens in the liquidity pair is KP3R" - } - ], - "NoGovernanceZeroAddress()": [ - { - "notice": "Throws if trying to set governance to zero address" - } - ], - "OnlyGovernance()": [ - { - "notice": "Throws if the caller of the function is not governance" - } - ], - "OnlyPendingGovernance()": [ - { - "notice": "Throws if the caller of the function is not pendingGovernance" - } - ], - "ZeroAddress()": [ - { - "notice": "Throws if a variable is assigned to the zero address" - } - ] - }, - "events": { - "GovernanceProposal(address)": { - "notice": "Emitted when a new governance is proposed" - }, - "GovernanceSet(address)": { - "notice": "Emitted when pendingGovernance accepts to be governance" - }, - "Keep3rV2Change(address)": { - "notice": "Emitted when the Keep3r V2 address is changed" - }, - "Kp3rWethPoolChange(address,bool)": { - "notice": "Emitted when the kp3r weth pool is changed" - }, - "MaxBoostChange(uint256)": { - "notice": "Emitted when the maximum boost multiplier is changed" - }, - "MinBaseFeeChange(uint256)": { - "notice": "Emitted when minimum rewarded gas fee is changed" - }, - "MinBoostChange(uint256)": { - "notice": "Emitted when the minimum boost multiplier is changed" - }, - "MinPriorityFeeChange(uint256)": { - "notice": "Emitted when minimum rewarded priority fee is changed" - }, - "OracleSet(address,address)": { - "notice": "The oracle for a liquidity has been saved" - }, - "QuoteTwapTimeChange(uint32)": { - "notice": "Emitted when the quote twap time is changed" - }, - "TargetBondChange(uint256)": { - "notice": "Emitted when the target bond amount is changed" - }, - "WethUSDPoolChange(address,bool)": { - "notice": "Emitted when the WETH USD pool is changed" - }, - "WorkExtraGasChange(uint256)": { - "notice": "Emitted when the work extra gas amount is changed" - } - }, - "kind": "user", - "methods": { - "BOOST_BASE()": { - "notice": "The boost base used to calculate the boost rewards for the keeper" - }, - "KP3R()": { - "notice": "Address of KP3R token" - }, - "WETH()": { - "notice": "Ethereum mainnet WETH address used for quoting references" - }, - "acceptGovernance()": { - "notice": "Changes the governance from the current governance to the previously proposed address" - }, - "bonds(address)": { - "notice": "Uses valid wKP3R address from Keep3rSidechain to query keeper bonds" - }, - "getKP3RsAtTick(uint256,int56,uint256)": { - "notice": "Given a tick and a liquidity amount, calculates the underlying KP3R tokens" - }, - "getPaymentParams(uint256)": { - "notice": "Get multiplier, quote, and extra, in order to calculate keeper payment" - }, - "getPoolTokens(address)": { - "notice": "Given a pool address, returns the underlying tokens of the pair" - }, - "getQuoteAtTick(uint128,int56,uint256)": { - "notice": "Given a tick and a token amount, calculates the output in correspondant token" - }, - "getRewardAmount(uint256)": { - "notice": "Calculates the reward (in KP3R) that corresponds to tx.origin for using gas" - }, - "getRewardAmountFor(address,uint256)": { - "notice": "Calculates the reward (in KP3R) that corresponds to a keeper for using gas" - }, - "getRewardBoostFor(uint256)": { - "notice": "Calculates the boost in the reward given to a keeper based on the amount of KP3R that keeper has bonded" - }, - "governance()": { - "notice": "Stores the governance address" - }, - "isKP3RToken0(address)": { - "notice": "Defines the order of the tokens in the pair for twap calculations" - }, - "keep3rV2()": { - "notice": "Address of Keep3r V2" - }, - "kp3rWethPool()": { - "notice": "KP3R-WETH pool that is being used as oracle" - }, - "maxBoost()": { - "notice": "The maximum multiplier used to calculate the amount of gas paid to the Keeper for the gas used to perform a job For example: if the quoted gas used is 1000, then the maximum amount to be paid will be 1000 * maxBoost / BOOST_BASE" - }, - "minBaseFee()": { - "notice": "The minimum base fee that is used to calculate keeper rewards" - }, - "minBoost()": { - "notice": "The minimum multiplier used to calculate the amount of gas paid to the Keeper for the gas used to perform a job For example: if the quoted gas used is 1000, then the minimum amount to be paid will be 1000 * minBoost / BOOST_BASE" - }, - "minPriorityFee()": { - "notice": "The minimum priority fee that is also rewarded for keepers" - }, - "observe(address,uint32[])": { - "notice": "Given an array of secondsAgo, returns UniswapV3 pool cumulatives at that moment" - }, - "pendingGovernance()": { - "notice": "Stores the pendingGovernance address" - }, - "quote(uint256)": { - "notice": "Calculates the amount of KP3R that corresponds to the ETH passed into the function" - }, - "quoteTwapTime()": { - "notice": "The twap time for quoting" - }, - "quoteUsdToEth(uint256)": { - "notice": "Quotes USD to ETH" - }, - "setGovernance(address)": { - "notice": "Proposes a new address to be governance" - }, - "setKeep3rV2(address)": { - "notice": "Sets the Keep3r V2 address" - }, - "setKp3rWethPool(address)": { - "notice": "Sets KP3R-WETH pool" - }, - "setMaxBoost(uint256)": { - "notice": "Sets the maximum boost multiplier" - }, - "setMinBaseFee(uint256)": { - "notice": "Sets the minimum rewarded gas fee" - }, - "setMinBoost(uint256)": { - "notice": "Sets the minimum boost multiplier" - }, - "setMinPriorityFee(uint256)": { - "notice": "Sets the minimum rewarded gas priority fee" - }, - "setOracle(address,address)": { - "notice": "Sets an oracle for a given liquidity" - }, - "setQuoteTwapTime(uint32)": { - "notice": "Sets the quote twap time" - }, - "setTargetBond(uint256)": { - "notice": "Sets the target bond amount" - }, - "setWethUsdPool(address)": { - "notice": "Sets an oracle for querying WETH/USD quote" - }, - "setWorkExtraGas(uint256)": { - "notice": "Sets the work extra gas amount" - }, - "targetBond()": { - "notice": "The targeted amount of bonded KP3Rs to max-up reward multiplier For example: if the amount of KP3R the keeper has bonded is targetBond or more, then the keeper will get the maximum boost possible in his rewards, if it's less, the reward boost will be proportional" - }, - "wethUSDPool()": { - "notice": "WETH-USD pool that is being used as oracle" - }, - "workExtraGas()": { - "notice": "The amount of unaccounted gas that is going to be added to keeper payments" - } - }, - "version": 1 - }, - "storageLayout": { - "storage": [ - { - "astId": 5362, - "contract": "solidity/contracts/sidechain/Keep3rHelperSidechain.sol:Keep3rHelperSidechain", - "label": "governance", - "offset": 0, - "slot": "0", - "type": "t_address" - }, - { - "astId": 5366, - "contract": "solidity/contracts/sidechain/Keep3rHelperSidechain.sol:Keep3rHelperSidechain", - "label": "pendingGovernance", - "offset": 0, - "slot": "1", - "type": "t_address" - }, - { - "astId": 2989, - "contract": "solidity/contracts/sidechain/Keep3rHelperSidechain.sol:Keep3rHelperSidechain", - "label": "minBoost", - "offset": 0, - "slot": "2", - "type": "t_uint256" - }, - { - "astId": 2994, - "contract": "solidity/contracts/sidechain/Keep3rHelperSidechain.sol:Keep3rHelperSidechain", - "label": "maxBoost", - "offset": 0, - "slot": "3", - "type": "t_uint256" - }, - { - "astId": 2999, - "contract": "solidity/contracts/sidechain/Keep3rHelperSidechain.sol:Keep3rHelperSidechain", - "label": "targetBond", - "offset": 0, - "slot": "4", - "type": "t_uint256" - }, - { - "astId": 3004, - "contract": "solidity/contracts/sidechain/Keep3rHelperSidechain.sol:Keep3rHelperSidechain", - "label": "workExtraGas", - "offset": 0, - "slot": "5", - "type": "t_uint256" - }, - { - "astId": 3009, - "contract": "solidity/contracts/sidechain/Keep3rHelperSidechain.sol:Keep3rHelperSidechain", - "label": "quoteTwapTime", - "offset": 0, - "slot": "6", - "type": "t_uint32" - }, - { - "astId": 3014, - "contract": "solidity/contracts/sidechain/Keep3rHelperSidechain.sol:Keep3rHelperSidechain", - "label": "minBaseFee", - "offset": 0, - "slot": "7", - "type": "t_uint256" - }, - { - "astId": 3019, - "contract": "solidity/contracts/sidechain/Keep3rHelperSidechain.sol:Keep3rHelperSidechain", - "label": "minPriorityFee", - "offset": 0, - "slot": "8", - "type": "t_uint256" - }, - { - "astId": 3023, - "contract": "solidity/contracts/sidechain/Keep3rHelperSidechain.sol:Keep3rHelperSidechain", - "label": "keep3rV2", - "offset": 0, - "slot": "9", - "type": "t_address" - }, - { - "astId": 3028, - "contract": "solidity/contracts/sidechain/Keep3rHelperSidechain.sol:Keep3rHelperSidechain", - "label": "kp3rWethPool", - "offset": 0, - "slot": "10", - "type": "t_struct(TokenOraclePool)12841_storage" - }, - { - "astId": 9751, - "contract": "solidity/contracts/sidechain/Keep3rHelperSidechain.sol:Keep3rHelperSidechain", - "label": "oracle", - "offset": 0, - "slot": "11", - "type": "t_mapping(t_address,t_address)" - }, - { - "astId": 9756, - "contract": "solidity/contracts/sidechain/Keep3rHelperSidechain.sol:Keep3rHelperSidechain", - "label": "wethUSDPool", - "offset": 0, - "slot": "12", - "type": "t_struct(TokenOraclePool)12841_storage" - } - ], - "types": { - "t_address": { - "encoding": "inplace", - "label": "address", - "numberOfBytes": "20" - }, - "t_bool": { - "encoding": "inplace", - "label": "bool", - "numberOfBytes": "1" - }, - "t_mapping(t_address,t_address)": { - "encoding": "mapping", - "key": "t_address", - "label": "mapping(address => address)", - "numberOfBytes": "32", - "value": "t_address" - }, - "t_struct(TokenOraclePool)12841_storage": { - "encoding": "inplace", - "label": "struct IKeep3rHelperParameters.TokenOraclePool", - "members": [ - { - "astId": 12838, - "contract": "solidity/contracts/sidechain/Keep3rHelperSidechain.sol:Keep3rHelperSidechain", - "label": "poolAddress", - "offset": 0, - "slot": "0", - "type": "t_address" - }, - { - "astId": 12840, - "contract": "solidity/contracts/sidechain/Keep3rHelperSidechain.sol:Keep3rHelperSidechain", - "label": "isTKNToken0", - "offset": 20, - "slot": "0", - "type": "t_bool" - } - ], - "numberOfBytes": "32" - }, - "t_uint256": { - "encoding": "inplace", - "label": "uint256", - "numberOfBytes": "32" - }, - "t_uint32": { - "encoding": "inplace", - "label": "uint32", - "numberOfBytes": "4" - } - } - } -} \ No newline at end of file diff --git a/deployments/optimisticGoerli/Keep3rSidechainForTestnet.json b/deployments/optimisticGoerli/Keep3rSidechainForTestnet.json deleted file mode 100644 index 3624b52..0000000 --- a/deployments/optimisticGoerli/Keep3rSidechainForTestnet.json +++ /dev/null @@ -1,4005 +0,0 @@ -{ - "address": "0x85063437C02Ba7F4f82F898859e4992380DEd3bb", - "abi": [ - { - "inputs": [ - { - "internalType": "address", - "name": "_governance", - "type": "address" - }, - { - "internalType": "address", - "name": "_keep3rHelper", - "type": "address" - }, - { - "internalType": "address", - "name": "_keep3rV1", - "type": "address" - }, - { - "internalType": "address", - "name": "_keep3rV1Proxy", - "type": "address" - } - ], - "stateMutability": "nonpayable", - "type": "constructor" - }, - { - "inputs": [], - "name": "AlreadyAJob", - "type": "error" - }, - { - "inputs": [], - "name": "AlreadyAKeeper", - "type": "error" - }, - { - "inputs": [], - "name": "AlreadyDisputed", - "type": "error" - }, - { - "inputs": [], - "name": "BondsLocked", - "type": "error" - }, - { - "inputs": [], - "name": "BondsUnexistent", - "type": "error" - }, - { - "inputs": [], - "name": "Deprecated", - "type": "error" - }, - { - "inputs": [], - "name": "Disputed", - "type": "error" - }, - { - "inputs": [], - "name": "DisputerExistent", - "type": "error" - }, - { - "inputs": [], - "name": "DisputerUnexistent", - "type": "error" - }, - { - "inputs": [], - "name": "GasNotInitialized", - "type": "error" - }, - { - "inputs": [], - "name": "InsufficientFunds", - "type": "error" - }, - { - "inputs": [], - "name": "InsufficientJobTokenCredits", - "type": "error" - }, - { - "inputs": [], - "name": "JobAlreadyAdded", - "type": "error" - }, - { - "inputs": [], - "name": "JobDisputed", - "type": "error" - }, - { - "inputs": [], - "name": "JobLiquidityInsufficient", - "type": "error" - }, - { - "inputs": [], - "name": "JobLiquidityLessThanMin", - "type": "error" - }, - { - "inputs": [], - "name": "JobLiquidityUnexistent", - "type": "error" - }, - { - "inputs": [], - "name": "JobMigrationImpossible", - "type": "error" - }, - { - "inputs": [], - "name": "JobMigrationLocked", - "type": "error" - }, - { - "inputs": [], - "name": "JobMigrationUnavailable", - "type": "error" - }, - { - "inputs": [], - "name": "JobTokenCreditsLocked", - "type": "error" - }, - { - "inputs": [], - "name": "JobTokenInsufficient", - "type": "error" - }, - { - "inputs": [], - "name": "JobTokenUnexistent", - "type": "error" - }, - { - "inputs": [], - "name": "JobUnapproved", - "type": "error" - }, - { - "inputs": [], - "name": "JobUnavailable", - "type": "error" - }, - { - "inputs": [], - "name": "LiquidityPairApproved", - "type": "error" - }, - { - "inputs": [], - "name": "LiquidityPairUnapproved", - "type": "error" - }, - { - "inputs": [], - "name": "LiquidityPairUnexistent", - "type": "error" - }, - { - "inputs": [], - "name": "MinRewardPeriod", - "type": "error" - }, - { - "inputs": [], - "name": "NoGovernanceZeroAddress", - "type": "error" - }, - { - "inputs": [], - "name": "NotDisputed", - "type": "error" - }, - { - "inputs": [], - "name": "OnlyDisputer", - "type": "error" - }, - { - "inputs": [], - "name": "OnlyGovernance", - "type": "error" - }, - { - "inputs": [], - "name": "OnlyJobOwner", - "type": "error" - }, - { - "inputs": [], - "name": "OnlyPendingGovernance", - "type": "error" - }, - { - "inputs": [], - "name": "OnlyPendingJobOwner", - "type": "error" - }, - { - "inputs": [], - "name": "OnlySlasher", - "type": "error" - }, - { - "inputs": [], - "name": "SlasherExistent", - "type": "error" - }, - { - "inputs": [], - "name": "SlasherUnexistent", - "type": "error" - }, - { - "inputs": [], - "name": "TokenUnallowed", - "type": "error" - }, - { - "inputs": [], - "name": "UnbondsLocked", - "type": "error" - }, - { - "inputs": [], - "name": "UnbondsUnexistent", - "type": "error" - }, - { - "inputs": [], - "name": "ZeroAddress", - "type": "error" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "_keeper", - "type": "address" - }, - { - "indexed": true, - "internalType": "address", - "name": "_bond", - "type": "address" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "_amount", - "type": "uint256" - } - ], - "name": "Activation", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "uint256", - "name": "_bondTime", - "type": "uint256" - } - ], - "name": "BondTimeChange", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "_keeper", - "type": "address" - }, - { - "indexed": true, - "internalType": "address", - "name": "_bonding", - "type": "address" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "_amount", - "type": "uint256" - } - ], - "name": "Bonding", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "_jobOrKeeper", - "type": "address" - }, - { - "indexed": true, - "internalType": "address", - "name": "_disputer", - "type": "address" - } - ], - "name": "Dispute", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "address", - "name": "_disputer", - "type": "address" - } - ], - "name": "DisputerAdded", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "address", - "name": "_disputer", - "type": "address" - } - ], - "name": "DisputerRemoved", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "address", - "name": "_token", - "type": "address" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "_amount", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "address", - "name": "_to", - "type": "address" - } - ], - "name": "DustSent", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "uint256", - "name": "_fee", - "type": "uint256" - } - ], - "name": "FeeChange", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "address", - "name": "_pendingGovernance", - "type": "address" - } - ], - "name": "GovernanceProposal", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "address", - "name": "_governance", - "type": "address" - } - ], - "name": "GovernanceSet", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "uint256", - "name": "_inflationPeriod", - "type": "uint256" - } - ], - "name": "InflationPeriodChange", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "_job", - "type": "address" - }, - { - "indexed": true, - "internalType": "address", - "name": "_jobOwner", - "type": "address" - } - ], - "name": "JobAddition", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "_fromJob", - "type": "address" - }, - { - "indexed": false, - "internalType": "address", - "name": "_toJob", - "type": "address" - } - ], - "name": "JobMigrationRequested", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "address", - "name": "_fromJob", - "type": "address" - }, - { - "indexed": true, - "internalType": "address", - "name": "_toJob", - "type": "address" - } - ], - "name": "JobMigrationSuccessful", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "_job", - "type": "address" - }, - { - "indexed": true, - "internalType": "address", - "name": "_previousOwner", - "type": "address" - }, - { - "indexed": true, - "internalType": "address", - "name": "_newOwner", - "type": "address" - } - ], - "name": "JobOwnershipAssent", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "_job", - "type": "address" - }, - { - "indexed": true, - "internalType": "address", - "name": "_owner", - "type": "address" - }, - { - "indexed": true, - "internalType": "address", - "name": "_pendingOwner", - "type": "address" - } - ], - "name": "JobOwnershipChange", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "_job", - "type": "address" - }, - { - "indexed": false, - "internalType": "address", - "name": "_liquidity", - "type": "address" - }, - { - "indexed": true, - "internalType": "address", - "name": "_slasher", - "type": "address" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "_amount", - "type": "uint256" - } - ], - "name": "JobSlashLiquidity", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "_job", - "type": "address" - }, - { - "indexed": false, - "internalType": "address", - "name": "_token", - "type": "address" - }, - { - "indexed": true, - "internalType": "address", - "name": "_slasher", - "type": "address" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "_amount", - "type": "uint256" - } - ], - "name": "JobSlashToken", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "address", - "name": "_keep3rHelper", - "type": "address" - } - ], - "name": "Keep3rHelperChange", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "address", - "name": "_keep3rV1", - "type": "address" - } - ], - "name": "Keep3rV1Change", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "address", - "name": "_keep3rV1Proxy", - "type": "address" - } - ], - "name": "Keep3rV1ProxyChange", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "_keeper", - "type": "address" - }, - { - "indexed": true, - "internalType": "address", - "name": "_slasher", - "type": "address" - } - ], - "name": "KeeperRevoke", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "_keeper", - "type": "address" - }, - { - "indexed": true, - "internalType": "address", - "name": "_slasher", - "type": "address" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "_amount", - "type": "uint256" - } - ], - "name": "KeeperSlash", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "uint256", - "name": "_gasLeft", - "type": "uint256" - } - ], - "name": "KeeperValidation", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "_credit", - "type": "address" - }, - { - "indexed": true, - "internalType": "address", - "name": "_job", - "type": "address" - }, - { - "indexed": true, - "internalType": "address", - "name": "_keeper", - "type": "address" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "_payment", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "_gasLeft", - "type": "uint256" - } - ], - "name": "KeeperWork", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "_job", - "type": "address" - }, - { - "indexed": true, - "internalType": "address", - "name": "_liquidity", - "type": "address" - }, - { - "indexed": true, - "internalType": "address", - "name": "_provider", - "type": "address" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "_amount", - "type": "uint256" - } - ], - "name": "LiquidityAddition", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "address", - "name": "_liquidity", - "type": "address" - } - ], - "name": "LiquidityApproval", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "_job", - "type": "address" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "_rewardedAt", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "_currentCredits", - "type": "uint256" - } - ], - "name": "LiquidityCreditsForced", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "_job", - "type": "address" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "_rewardedAt", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "_currentCredits", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "_periodCredits", - "type": "uint256" - } - ], - "name": "LiquidityCreditsReward", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "uint256", - "name": "_liquidityMinimum", - "type": "uint256" - } - ], - "name": "LiquidityMinimumChange", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "address", - "name": "_liquidity", - "type": "address" - } - ], - "name": "LiquidityRevocation", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "_job", - "type": "address" - }, - { - "indexed": true, - "internalType": "address", - "name": "_liquidity", - "type": "address" - }, - { - "indexed": true, - "internalType": "address", - "name": "_receiver", - "type": "address" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "_amount", - "type": "uint256" - } - ], - "name": "LiquidityWithdrawal", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "_jobOrKeeper", - "type": "address" - }, - { - "indexed": true, - "internalType": "address", - "name": "_resolver", - "type": "address" - } - ], - "name": "Resolve", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "uint256", - "name": "_rewardPeriodTime", - "type": "uint256" - } - ], - "name": "RewardPeriodTimeChange", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "address", - "name": "_slasher", - "type": "address" - } - ], - "name": "SlasherAdded", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "address", - "name": "_slasher", - "type": "address" - } - ], - "name": "SlasherRemoved", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "_job", - "type": "address" - }, - { - "indexed": true, - "internalType": "address", - "name": "_token", - "type": "address" - }, - { - "indexed": true, - "internalType": "address", - "name": "_provider", - "type": "address" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "_amount", - "type": "uint256" - } - ], - "name": "TokenCreditAddition", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "_job", - "type": "address" - }, - { - "indexed": true, - "internalType": "address", - "name": "_token", - "type": "address" - }, - { - "indexed": true, - "internalType": "address", - "name": "_receiver", - "type": "address" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "_amount", - "type": "uint256" - } - ], - "name": "TokenCreditWithdrawal", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "uint256", - "name": "_unbondTime", - "type": "uint256" - } - ], - "name": "UnbondTimeChange", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "_keeperOrJob", - "type": "address" - }, - { - "indexed": true, - "internalType": "address", - "name": "_unbonding", - "type": "address" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "_amount", - "type": "uint256" - } - ], - "name": "Unbonding", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "_keeper", - "type": "address" - }, - { - "indexed": true, - "internalType": "address", - "name": "_bond", - "type": "address" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "_amount", - "type": "uint256" - } - ], - "name": "Withdrawal", - "type": "event" - }, - { - "inputs": [], - "name": "acceptGovernance", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_fromJob", - "type": "address" - }, - { - "internalType": "address", - "name": "_toJob", - "type": "address" - } - ], - "name": "acceptJobMigration", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_job", - "type": "address" - } - ], - "name": "acceptJobOwnership", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_bonding", - "type": "address" - } - ], - "name": "activate", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_disputer", - "type": "address" - } - ], - "name": "addDisputer", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_job", - "type": "address" - } - ], - "name": "addJob", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_job", - "type": "address" - }, - { - "internalType": "address", - "name": "_liquidity", - "type": "address" - }, - { - "internalType": "uint256", - "name": "_amount", - "type": "uint256" - } - ], - "name": "addLiquidityToJob", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_slasher", - "type": "address" - } - ], - "name": "addSlasher", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_job", - "type": "address" - }, - { - "internalType": "address", - "name": "_token", - "type": "address" - }, - { - "internalType": "uint256", - "name": "_amount", - "type": "uint256" - } - ], - "name": "addTokenCreditsToJob", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_liquidity", - "type": "address" - } - ], - "name": "approveLiquidity", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [], - "name": "approvedLiquidities", - "outputs": [ - { - "internalType": "address[]", - "name": "_list", - "type": "address[]" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_bonding", - "type": "address" - }, - { - "internalType": "uint256", - "name": "_amount", - "type": "uint256" - } - ], - "name": "bond", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [], - "name": "bondTime", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_keeper", - "type": "address" - }, - { - "internalType": "uint256", - "name": "_payment", - "type": "uint256" - } - ], - "name": "bondedPayment", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - }, - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "name": "bonds", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - }, - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "name": "canActivateAfter", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - }, - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "name": "canWithdrawAfter", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_job", - "type": "address" - }, - { - "internalType": "address", - "name": "_newOwner", - "type": "address" - } - ], - "name": "changeJobOwnership", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_token", - "type": "address" - }, - { - "internalType": "address", - "name": "_keeper", - "type": "address" - }, - { - "internalType": "uint256", - "name": "_amount", - "type": "uint256" - } - ], - "name": "directTokenPayment", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_jobOrKeeper", - "type": "address" - } - ], - "name": "dispute", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "name": "disputers", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "name": "disputes", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "fee", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "name": "firstSeen", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_job", - "type": "address" - }, - { - "internalType": "uint256", - "name": "_amount", - "type": "uint256" - } - ], - "name": "forceLiquidityCreditsToJob", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [], - "name": "governance", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "name": "hasBonded", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "inflationPeriod", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_keeper", - "type": "address" - }, - { - "internalType": "address", - "name": "_bond", - "type": "address" - }, - { - "internalType": "uint256", - "name": "_minBond", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "_earned", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "_age", - "type": "uint256" - } - ], - "name": "isBondedKeeper", - "outputs": [ - { - "internalType": "bool", - "name": "_isBondedKeeper", - "type": "bool" - } - ], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_keeper", - "type": "address" - } - ], - "name": "isKeeper", - "outputs": [ - { - "internalType": "bool", - "name": "_isKeeper", - "type": "bool" - } - ], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_job", - "type": "address" - } - ], - "name": "jobLiquidityCredits", - "outputs": [ - { - "internalType": "uint256", - "name": "_liquidityCredits", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "name": "jobOwner", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "name": "jobPendingOwner", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_job", - "type": "address" - } - ], - "name": "jobPeriodCredits", - "outputs": [ - { - "internalType": "uint256", - "name": "_periodCredits", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - }, - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "name": "jobTokenCredits", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - }, - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "name": "jobTokenCreditsAddedAt", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "jobs", - "outputs": [ - { - "internalType": "address[]", - "name": "_list", - "type": "address[]" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "keep3rHelper", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "keep3rV1", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "keep3rV1Proxy", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "keepers", - "outputs": [ - { - "internalType": "address[]", - "name": "_list", - "type": "address[]" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - }, - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "name": "liquidityAmount", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "liquidityMinimum", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_fromJob", - "type": "address" - }, - { - "internalType": "address", - "name": "_toJob", - "type": "address" - } - ], - "name": "migrateJob", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_liquidity", - "type": "address" - } - ], - "name": "observeLiquidity", - "outputs": [ - { - "components": [ - { - "internalType": "int56", - "name": "current", - "type": "int56" - }, - { - "internalType": "int56", - "name": "difference", - "type": "int56" - }, - { - "internalType": "uint256", - "name": "period", - "type": "uint256" - } - ], - "internalType": "struct IKeep3rJobFundableLiquidity.TickCache", - "name": "_tickCache", - "type": "tuple" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - }, - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "name": "pendingBonds", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "pendingGovernance", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "name": "pendingJobMigrations", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - }, - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "name": "pendingUnbonds", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_liquidity", - "type": "address" - }, - { - "internalType": "uint256", - "name": "_amount", - "type": "uint256" - } - ], - "name": "quoteLiquidity", - "outputs": [ - { - "internalType": "uint256", - "name": "_periodCredits", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_disputer", - "type": "address" - } - ], - "name": "removeDisputer", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_slasher", - "type": "address" - } - ], - "name": "removeSlasher", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_jobOrKeeper", - "type": "address" - } - ], - "name": "resolve", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_keeper", - "type": "address" - } - ], - "name": "revoke", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_liquidity", - "type": "address" - } - ], - "name": "revokeLiquidity", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [], - "name": "rewardPeriodTime", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "name": "rewardedAt", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_token", - "type": "address" - }, - { - "internalType": "uint256", - "name": "_amount", - "type": "uint256" - }, - { - "internalType": "address", - "name": "_to", - "type": "address" - } - ], - "name": "sendDust", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "_bondTime", - "type": "uint256" - } - ], - "name": "setBondTime", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "_fee", - "type": "uint256" - } - ], - "name": "setFee", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_governance", - "type": "address" - } - ], - "name": "setGovernance", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "_inflationPeriod", - "type": "uint256" - } - ], - "name": "setInflationPeriod", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_keep3rHelper", - "type": "address" - } - ], - "name": "setKeep3rHelper", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_keep3rV1", - "type": "address" - } - ], - "name": "setKeep3rV1", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_keep3rV1Proxy", - "type": "address" - } - ], - "name": "setKeep3rV1Proxy", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "_liquidityMinimum", - "type": "uint256" - } - ], - "name": "setLiquidityMinimum", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "_rewardPeriodTime", - "type": "uint256" - } - ], - "name": "setRewardPeriodTime", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "_unbondTime", - "type": "uint256" - } - ], - "name": "setUnbondTime", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_keeper", - "type": "address" - }, - { - "internalType": "address", - "name": "_bonded", - "type": "address" - }, - { - "internalType": "uint256", - "name": "_bondAmount", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "_unbondAmount", - "type": "uint256" - } - ], - "name": "slash", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_job", - "type": "address" - }, - { - "internalType": "address", - "name": "_liquidity", - "type": "address" - }, - { - "internalType": "uint256", - "name": "_amount", - "type": "uint256" - } - ], - "name": "slashLiquidityFromJob", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_job", - "type": "address" - }, - { - "internalType": "address", - "name": "_token", - "type": "address" - }, - { - "internalType": "uint256", - "name": "_amount", - "type": "uint256" - } - ], - "name": "slashTokenFromJob", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "name": "slashers", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "totalBonds", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_job", - "type": "address" - } - ], - "name": "totalJobCredits", - "outputs": [ - { - "internalType": "uint256", - "name": "_credits", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_bonding", - "type": "address" - }, - { - "internalType": "uint256", - "name": "_amount", - "type": "uint256" - } - ], - "name": "unbond", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_job", - "type": "address" - }, - { - "internalType": "address", - "name": "_liquidity", - "type": "address" - }, - { - "internalType": "uint256", - "name": "_amount", - "type": "uint256" - } - ], - "name": "unbondLiquidityFromJob", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [], - "name": "unbondTime", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "virtualReserves", - "outputs": [ - { - "internalType": "int256", - "name": "_virtualReserves", - "type": "int256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_bonding", - "type": "address" - } - ], - "name": "withdraw", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_job", - "type": "address" - }, - { - "internalType": "address", - "name": "_liquidity", - "type": "address" - }, - { - "internalType": "address", - "name": "_receiver", - "type": "address" - } - ], - "name": "withdrawLiquidityFromJob", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_job", - "type": "address" - }, - { - "internalType": "address", - "name": "_token", - "type": "address" - }, - { - "internalType": "uint256", - "name": "_amount", - "type": "uint256" - }, - { - "internalType": "address", - "name": "_receiver", - "type": "address" - } - ], - "name": "withdrawTokenCreditsFromJob", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "name": "workCompleted", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "name": "worked", - "outputs": [], - "stateMutability": "pure", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_keeper", - "type": "address" - }, - { - "internalType": "uint256", - "name": "_usdPerGasUnit", - "type": "uint256" - } - ], - "name": "worked", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "name": "workedAt", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - } - ], - "transactionHash": "0x7810e51483be33da70766b089564ba82b91df4e2a2a495a9fe469a6e5b90cbdf", - "receipt": { - "to": null, - "from": "0x258b180E741157763236F5277619D71ECf00B906", - "contractAddress": "0x85063437C02Ba7F4f82F898859e4992380DEd3bb", - "transactionIndex": 0, - "gasUsed": "5495089", - "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", - "blockHash": "0x4d4275f7be655158e81490cc1eb942343cefaeaa7bb9b823445967e630f7e36c", - "transactionHash": "0x7810e51483be33da70766b089564ba82b91df4e2a2a495a9fe469a6e5b90cbdf", - "logs": [], - "blockNumber": 3238159, - "cumulativeGasUsed": "5495089", - "status": 1, - "byzantium": true - }, - "args": [ - "0x258b180E741157763236F5277619D71ECf00B906", - "0x399394ca069dCDE2C4d2a32E00a06C3D5fE17E3A", - "0x3Db593146464816F10d4eBA4743C76A5A4D08425", - "0xBa4A759E41cCA14980bE4106792cdAC5F7BeDF83" - ], - "numDeployments": 1, - "solcInputHash": "7d006d28afea8f44b7106e2df679db88", - "metadata": "{\"compiler\":{\"version\":\"0.8.7+commit.e28d00a7\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_governance\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"_keep3rHelper\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"_keep3rV1\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"_keep3rV1Proxy\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"inputs\":[],\"name\":\"AlreadyAJob\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"AlreadyAKeeper\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"AlreadyDisputed\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"BondsLocked\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"BondsUnexistent\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"Deprecated\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"Disputed\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"DisputerExistent\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"DisputerUnexistent\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"GasNotInitialized\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"InsufficientFunds\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"InsufficientJobTokenCredits\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"JobAlreadyAdded\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"JobDisputed\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"JobLiquidityInsufficient\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"JobLiquidityLessThanMin\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"JobLiquidityUnexistent\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"JobMigrationImpossible\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"JobMigrationLocked\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"JobMigrationUnavailable\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"JobTokenCreditsLocked\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"JobTokenInsufficient\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"JobTokenUnexistent\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"JobUnapproved\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"JobUnavailable\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"LiquidityPairApproved\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"LiquidityPairUnapproved\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"LiquidityPairUnexistent\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"MinRewardPeriod\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"NoGovernanceZeroAddress\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"NotDisputed\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"OnlyDisputer\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"OnlyGovernance\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"OnlyJobOwner\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"OnlyPendingGovernance\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"OnlyPendingJobOwner\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"OnlySlasher\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"SlasherExistent\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"SlasherUnexistent\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"TokenUnallowed\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"UnbondsLocked\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"UnbondsUnexistent\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"ZeroAddress\",\"type\":\"error\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"_keeper\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"_bond\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"_amount\",\"type\":\"uint256\"}],\"name\":\"Activation\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"_bondTime\",\"type\":\"uint256\"}],\"name\":\"BondTimeChange\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"_keeper\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"_bonding\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"_amount\",\"type\":\"uint256\"}],\"name\":\"Bonding\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"_jobOrKeeper\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"_disputer\",\"type\":\"address\"}],\"name\":\"Dispute\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"_disputer\",\"type\":\"address\"}],\"name\":\"DisputerAdded\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"_disputer\",\"type\":\"address\"}],\"name\":\"DisputerRemoved\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"_token\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"_amount\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"_to\",\"type\":\"address\"}],\"name\":\"DustSent\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"_fee\",\"type\":\"uint256\"}],\"name\":\"FeeChange\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"_pendingGovernance\",\"type\":\"address\"}],\"name\":\"GovernanceProposal\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"_governance\",\"type\":\"address\"}],\"name\":\"GovernanceSet\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"_inflationPeriod\",\"type\":\"uint256\"}],\"name\":\"InflationPeriodChange\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"_job\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"_jobOwner\",\"type\":\"address\"}],\"name\":\"JobAddition\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"_fromJob\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"_toJob\",\"type\":\"address\"}],\"name\":\"JobMigrationRequested\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"_fromJob\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"_toJob\",\"type\":\"address\"}],\"name\":\"JobMigrationSuccessful\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"_job\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"_previousOwner\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"_newOwner\",\"type\":\"address\"}],\"name\":\"JobOwnershipAssent\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"_job\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"_owner\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"_pendingOwner\",\"type\":\"address\"}],\"name\":\"JobOwnershipChange\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"_job\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"_liquidity\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"_slasher\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"_amount\",\"type\":\"uint256\"}],\"name\":\"JobSlashLiquidity\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"_job\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"_token\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"_slasher\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"_amount\",\"type\":\"uint256\"}],\"name\":\"JobSlashToken\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"_keep3rHelper\",\"type\":\"address\"}],\"name\":\"Keep3rHelperChange\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"_keep3rV1\",\"type\":\"address\"}],\"name\":\"Keep3rV1Change\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"_keep3rV1Proxy\",\"type\":\"address\"}],\"name\":\"Keep3rV1ProxyChange\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"_keeper\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"_slasher\",\"type\":\"address\"}],\"name\":\"KeeperRevoke\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"_keeper\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"_slasher\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"_amount\",\"type\":\"uint256\"}],\"name\":\"KeeperSlash\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"_gasLeft\",\"type\":\"uint256\"}],\"name\":\"KeeperValidation\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"_credit\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"_job\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"_keeper\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"_payment\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"_gasLeft\",\"type\":\"uint256\"}],\"name\":\"KeeperWork\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"_job\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"_liquidity\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"_provider\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"_amount\",\"type\":\"uint256\"}],\"name\":\"LiquidityAddition\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"_liquidity\",\"type\":\"address\"}],\"name\":\"LiquidityApproval\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"_job\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"_rewardedAt\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"_currentCredits\",\"type\":\"uint256\"}],\"name\":\"LiquidityCreditsForced\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"_job\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"_rewardedAt\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"_currentCredits\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"_periodCredits\",\"type\":\"uint256\"}],\"name\":\"LiquidityCreditsReward\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"_liquidityMinimum\",\"type\":\"uint256\"}],\"name\":\"LiquidityMinimumChange\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"_liquidity\",\"type\":\"address\"}],\"name\":\"LiquidityRevocation\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"_job\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"_liquidity\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"_receiver\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"_amount\",\"type\":\"uint256\"}],\"name\":\"LiquidityWithdrawal\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"_jobOrKeeper\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"_resolver\",\"type\":\"address\"}],\"name\":\"Resolve\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"_rewardPeriodTime\",\"type\":\"uint256\"}],\"name\":\"RewardPeriodTimeChange\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"_slasher\",\"type\":\"address\"}],\"name\":\"SlasherAdded\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"_slasher\",\"type\":\"address\"}],\"name\":\"SlasherRemoved\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"_job\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"_token\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"_provider\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"_amount\",\"type\":\"uint256\"}],\"name\":\"TokenCreditAddition\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"_job\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"_token\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"_receiver\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"_amount\",\"type\":\"uint256\"}],\"name\":\"TokenCreditWithdrawal\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"_unbondTime\",\"type\":\"uint256\"}],\"name\":\"UnbondTimeChange\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"_keeperOrJob\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"_unbonding\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"_amount\",\"type\":\"uint256\"}],\"name\":\"Unbonding\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"_keeper\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"_bond\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"_amount\",\"type\":\"uint256\"}],\"name\":\"Withdrawal\",\"type\":\"event\"},{\"inputs\":[],\"name\":\"acceptGovernance\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_fromJob\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"_toJob\",\"type\":\"address\"}],\"name\":\"acceptJobMigration\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_job\",\"type\":\"address\"}],\"name\":\"acceptJobOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_bonding\",\"type\":\"address\"}],\"name\":\"activate\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_disputer\",\"type\":\"address\"}],\"name\":\"addDisputer\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_job\",\"type\":\"address\"}],\"name\":\"addJob\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_job\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"_liquidity\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"_amount\",\"type\":\"uint256\"}],\"name\":\"addLiquidityToJob\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_slasher\",\"type\":\"address\"}],\"name\":\"addSlasher\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_job\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"_token\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"_amount\",\"type\":\"uint256\"}],\"name\":\"addTokenCreditsToJob\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_liquidity\",\"type\":\"address\"}],\"name\":\"approveLiquidity\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"approvedLiquidities\",\"outputs\":[{\"internalType\":\"address[]\",\"name\":\"_list\",\"type\":\"address[]\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_bonding\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"_amount\",\"type\":\"uint256\"}],\"name\":\"bond\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"bondTime\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_keeper\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"_payment\",\"type\":\"uint256\"}],\"name\":\"bondedPayment\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"bonds\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"canActivateAfter\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"canWithdrawAfter\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_job\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"_newOwner\",\"type\":\"address\"}],\"name\":\"changeJobOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_token\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"_keeper\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"_amount\",\"type\":\"uint256\"}],\"name\":\"directTokenPayment\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_jobOrKeeper\",\"type\":\"address\"}],\"name\":\"dispute\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"disputers\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"disputes\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"fee\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"firstSeen\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_job\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"_amount\",\"type\":\"uint256\"}],\"name\":\"forceLiquidityCreditsToJob\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"governance\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"hasBonded\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"inflationPeriod\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_keeper\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"_bond\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"_minBond\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"_earned\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"_age\",\"type\":\"uint256\"}],\"name\":\"isBondedKeeper\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"_isBondedKeeper\",\"type\":\"bool\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_keeper\",\"type\":\"address\"}],\"name\":\"isKeeper\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"_isKeeper\",\"type\":\"bool\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_job\",\"type\":\"address\"}],\"name\":\"jobLiquidityCredits\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"_liquidityCredits\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"jobOwner\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"jobPendingOwner\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_job\",\"type\":\"address\"}],\"name\":\"jobPeriodCredits\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"_periodCredits\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"jobTokenCredits\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"jobTokenCreditsAddedAt\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"jobs\",\"outputs\":[{\"internalType\":\"address[]\",\"name\":\"_list\",\"type\":\"address[]\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"keep3rHelper\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"keep3rV1\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"keep3rV1Proxy\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"keepers\",\"outputs\":[{\"internalType\":\"address[]\",\"name\":\"_list\",\"type\":\"address[]\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"liquidityAmount\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"liquidityMinimum\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_fromJob\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"_toJob\",\"type\":\"address\"}],\"name\":\"migrateJob\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_liquidity\",\"type\":\"address\"}],\"name\":\"observeLiquidity\",\"outputs\":[{\"components\":[{\"internalType\":\"int56\",\"name\":\"current\",\"type\":\"int56\"},{\"internalType\":\"int56\",\"name\":\"difference\",\"type\":\"int56\"},{\"internalType\":\"uint256\",\"name\":\"period\",\"type\":\"uint256\"}],\"internalType\":\"struct IKeep3rJobFundableLiquidity.TickCache\",\"name\":\"_tickCache\",\"type\":\"tuple\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"pendingBonds\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"pendingGovernance\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"pendingJobMigrations\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"pendingUnbonds\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_liquidity\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"_amount\",\"type\":\"uint256\"}],\"name\":\"quoteLiquidity\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"_periodCredits\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_disputer\",\"type\":\"address\"}],\"name\":\"removeDisputer\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_slasher\",\"type\":\"address\"}],\"name\":\"removeSlasher\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_jobOrKeeper\",\"type\":\"address\"}],\"name\":\"resolve\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_keeper\",\"type\":\"address\"}],\"name\":\"revoke\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_liquidity\",\"type\":\"address\"}],\"name\":\"revokeLiquidity\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"rewardPeriodTime\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"rewardedAt\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_token\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"_amount\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"_to\",\"type\":\"address\"}],\"name\":\"sendDust\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_bondTime\",\"type\":\"uint256\"}],\"name\":\"setBondTime\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_fee\",\"type\":\"uint256\"}],\"name\":\"setFee\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_governance\",\"type\":\"address\"}],\"name\":\"setGovernance\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_inflationPeriod\",\"type\":\"uint256\"}],\"name\":\"setInflationPeriod\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_keep3rHelper\",\"type\":\"address\"}],\"name\":\"setKeep3rHelper\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_keep3rV1\",\"type\":\"address\"}],\"name\":\"setKeep3rV1\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_keep3rV1Proxy\",\"type\":\"address\"}],\"name\":\"setKeep3rV1Proxy\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_liquidityMinimum\",\"type\":\"uint256\"}],\"name\":\"setLiquidityMinimum\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_rewardPeriodTime\",\"type\":\"uint256\"}],\"name\":\"setRewardPeriodTime\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_unbondTime\",\"type\":\"uint256\"}],\"name\":\"setUnbondTime\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_keeper\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"_bonded\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"_bondAmount\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"_unbondAmount\",\"type\":\"uint256\"}],\"name\":\"slash\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_job\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"_liquidity\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"_amount\",\"type\":\"uint256\"}],\"name\":\"slashLiquidityFromJob\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_job\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"_token\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"_amount\",\"type\":\"uint256\"}],\"name\":\"slashTokenFromJob\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"slashers\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"totalBonds\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_job\",\"type\":\"address\"}],\"name\":\"totalJobCredits\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"_credits\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_bonding\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"_amount\",\"type\":\"uint256\"}],\"name\":\"unbond\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_job\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"_liquidity\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"_amount\",\"type\":\"uint256\"}],\"name\":\"unbondLiquidityFromJob\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"unbondTime\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"virtualReserves\",\"outputs\":[{\"internalType\":\"int256\",\"name\":\"_virtualReserves\",\"type\":\"int256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_bonding\",\"type\":\"address\"}],\"name\":\"withdraw\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_job\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"_liquidity\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"_receiver\",\"type\":\"address\"}],\"name\":\"withdrawLiquidityFromJob\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_job\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"_token\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"_amount\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"_receiver\",\"type\":\"address\"}],\"name\":\"withdrawTokenCreditsFromJob\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"workCompleted\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"worked\",\"outputs\":[],\"stateMutability\":\"pure\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_keeper\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"_usdPerGasUnit\",\"type\":\"uint256\"}],\"name\":\"worked\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"workedAt\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"}],\"devdoc\":{\"kind\":\"dev\",\"methods\":{\"acceptJobMigration(address,address)\":{\"details\":\"Unbond/withdraw process doesn't get migrated\",\"params\":{\"_fromJob\":\"The address of the job that requested to migrate\",\"_toJob\":\"The address to which the job wants to migrate to\"}},\"acceptJobOwnership(address)\":{\"params\":{\"_job\":\"The address of the job\"}},\"activate(address)\":{\"params\":{\"_bonding\":\"The asset being activated as bond collateral\"}},\"addJob(address)\":{\"params\":{\"_job\":\"Address of the contract for which work should be performed\"}},\"addLiquidityToJob(address,address,uint256)\":{\"params\":{\"_amount\":\"The amount of liquidity tokens to add\",\"_job\":\"The address of the job to assign liquidity to\",\"_liquidity\":\"The liquidity being added\"}},\"addTokenCreditsToJob(address,address,uint256)\":{\"params\":{\"_amount\":\"The amount of credit being added\",\"_job\":\"The address of the job being credited\",\"_token\":\"The address of the token being credited\"}},\"approveLiquidity(address)\":{\"details\":\"Function should be called after setting an oracle in Keep3rHelperSidechain\",\"params\":{\"_liquidity\":\"Address of the liquidity token being approved\"}},\"approvedLiquidities()\":{\"returns\":{\"_list\":\"An array of addresses with all the approved liquidity pairs\"}},\"bond(address,uint256)\":{\"params\":{\"_amount\":\"The amount of bonding asset being bonded\",\"_bonding\":\"The asset being bonded\"}},\"bondedPayment(address,uint256)\":{\"details\":\"Pays the keeper that performs the work with KP3R\",\"params\":{\"_keeper\":\"Address of the keeper that performed the work\",\"_payment\":\"The reward that should be allocated for the job\"}},\"changeJobOwnership(address,address)\":{\"params\":{\"_job\":\"The address of the job\",\"_newOwner\":\"The address of the proposed new owner\"}},\"directTokenPayment(address,address,uint256)\":{\"details\":\"Pays the keeper that performs the work with a specific token\",\"params\":{\"_amount\":\"The reward that should be allocated\",\"_keeper\":\"Address of the keeper that performed the work\",\"_token\":\"The asset being awarded to the keeper\"}},\"dispute(address)\":{\"params\":{\"_jobOrKeeper\":\"The address in dispute\"}},\"forceLiquidityCreditsToJob(address,uint256)\":{\"params\":{\"_amount\":\"The amount of liquidity credits to gift\",\"_job\":\"The address of the job being credited\"}},\"isBondedKeeper(address,address,uint256,uint256,uint256)\":{\"details\":\"Should be used for protected functions\",\"params\":{\"_age\":\"The minimum keeper age required\",\"_bond\":\"The bond token being evaluated\",\"_earned\":\"The minimum funds earned in the keepers lifetime\",\"_keeper\":\"The keeper to check\",\"_minBond\":\"The minimum amount of bonded tokens\"},\"returns\":{\"_isBondedKeeper\":\"Whether the `_keeper` meets the given requirements\"}},\"isKeeper(address)\":{\"details\":\"Can be used for general (non critical) functions\",\"params\":{\"_keeper\":\"The keeper being investigated\"},\"returns\":{\"_isKeeper\":\"Whether the address passed as a parameter is a keeper or not\"}},\"jobLiquidityCredits(address)\":{\"params\":{\"_job\":\"The address of the job of which we want to know the liquidity credits\"},\"returns\":{\"_liquidityCredits\":\"The liquidity credits of a given job\"}},\"jobPeriodCredits(address)\":{\"params\":{\"_job\":\"The address of the job of which we want to know the period credits\"},\"returns\":{\"_periodCredits\":\"The credits the given job has at the current period\"}},\"jobs()\":{\"returns\":{\"_list\":\"Array with all the jobs in _jobs\"}},\"keepers()\":{\"returns\":{\"_list\":\"Array with all the keepers in _keepers\"}},\"migrateJob(address,address)\":{\"params\":{\"_fromJob\":\"The address of the job that is requesting to migrate\",\"_toJob\":\"The address at which the job is requesting to migrate\"}},\"observeLiquidity(address)\":{\"params\":{\"_liquidity\":\"Address of the liquidity token being observed\"}},\"quoteLiquidity(address,uint256)\":{\"details\":\"_periodCredits = underlying KP3Rs for given liquidity amount * rewardPeriod / inflationPeriod\",\"params\":{\"_amount\":\"The amount of liquidity to provide\",\"_liquidity\":\"The address of the liquidity to provide\"},\"returns\":{\"_periodCredits\":\"The amount of KP3R periodically minted for the given liquidity\"}},\"resolve(address)\":{\"params\":{\"_jobOrKeeper\":\"The address cleared\"}},\"revoke(address)\":{\"params\":{\"_keeper\":\"The address being slashed\"}},\"revokeLiquidity(address)\":{\"params\":{\"_liquidity\":\"The liquidity no longer accepted\"}},\"sendDust(address,uint256,address)\":{\"params\":{\"_amount\":\"The amount of the token that will be transferred\",\"_to\":\"The address that will receive the idle funds\",\"_token\":\"The token that will be transferred\"}},\"setBondTime(uint256)\":{\"params\":{\"_bond\":\"The new bond time\"}},\"setFee(uint256)\":{\"params\":{\"_fee\":\"The new fee\"}},\"setGovernance(address)\":{\"params\":{\"_governance\":\"The address being proposed as the new governance\"}},\"setInflationPeriod(uint256)\":{\"params\":{\"_inflationPeriod\":\"The new inflation period\"}},\"setKeep3rHelper(address)\":{\"params\":{\"_keep3rHelper\":\"The Keep3rHelper address\"}},\"setKeep3rV1(address)\":{\"params\":{\"_keep3rV1\":\"The Keep3rV1 address\"}},\"setKeep3rV1Proxy(address)\":{\"params\":{\"_keep3rV1Proxy\":\"The Keep3rV1Proxy address\"}},\"setLiquidityMinimum(uint256)\":{\"params\":{\"_liquidityMinimum\":\"The new minimum amount of liquidity\"}},\"setRewardPeriodTime(uint256)\":{\"params\":{\"_rewardPeriodTime\":\"The new amount of time required to pass between rewards\"}},\"setUnbondTime(uint256)\":{\"params\":{\"_unbond\":\"The new unbond time\"}},\"slash(address,address,uint256,uint256)\":{\"params\":{\"_bondAmount\":\"The bonded amount being slashed\",\"_bonded\":\"The asset being slashed\",\"_keeper\":\"The address being slashed\",\"_unbondAmount\":\"The pending unbond amount being slashed\"}},\"slashLiquidityFromJob(address,address,uint256)\":{\"params\":{\"_amount\":\"The amount of liquidity that will be slashed\",\"_job\":\"The address being slashed\",\"_liquidity\":\"The address of the liquidity that will be slashed\"}},\"slashTokenFromJob(address,address,uint256)\":{\"params\":{\"_amount\":\"The amount of the token that will be slashed\",\"_job\":\"The address of the job from which the token will be slashed\",\"_token\":\"The address of the token that will be slashed\"}},\"totalJobCredits(address)\":{\"params\":{\"_job\":\"The address of the job of which we want to know the total credits\"},\"returns\":{\"_credits\":\"The total credits of the given job\"}},\"unbond(address,uint256)\":{\"params\":{\"_amount\":\"Allows for partial unbonding\",\"_bonding\":\"The asset being unbonded\"}},\"unbondLiquidityFromJob(address,address,uint256)\":{\"details\":\"Can only be called by the job's owner\",\"params\":{\"_amount\":\"The amount of liquidity being removed\",\"_job\":\"The address of the job being unbonded from\",\"_liquidity\":\"The liquidity being unbonded\"}},\"virtualReserves()\":{\"returns\":{\"_virtualReserves\":\"The surplus amount of wKP3Rs in escrow contract\"}},\"withdraw(address)\":{\"params\":{\"_bonding\":\"The asset to withdraw from the bonding pool\"}},\"withdrawLiquidityFromJob(address,address,address)\":{\"params\":{\"_job\":\"The address of the job being withdrawn from\",\"_liquidity\":\"The liquidity being withdrawn\",\"_receiver\":\"The address that will receive the withdrawn liquidity\"}},\"withdrawTokenCreditsFromJob(address,address,uint256,address)\":{\"params\":{\"_amount\":\"The amount of token to be withdrawn\",\"_job\":\"The address of the job from which the credits are withdrawn\",\"_receiver\":\"The user that will receive tokens\",\"_token\":\"The address of the token being withdrawn\"}},\"worked(address)\":{\"details\":\"Sidechain implementation deprecates worked(address) as it should come with a usdPerGasUnit parameter\"},\"worked(address,uint256)\":{\"details\":\"Uses a USD per gas unit payment mechanism\",\"params\":{\"_keeper\":\"Address of the keeper that performed the work\",\"_usdPerGasUnit\":\"Units of USD (in wei) per gas unit that should be rewarded to the keeper\"}}},\"version\":1},\"userdoc\":{\"errors\":{\"AlreadyAJob()\":[{\"notice\":\"Throws when the address that is trying to register as a job is already a job\"}],\"AlreadyAKeeper()\":[{\"notice\":\"Throws when the address that is trying to register as a keeper is already a keeper\"}],\"AlreadyDisputed()\":[{\"notice\":\"Throws when a job or keeper is already disputed\"}],\"BondsLocked()\":[{\"notice\":\"Throws if the time required to bond an asset has not passed yet\"}],\"BondsUnexistent()\":[{\"notice\":\"Throws if there are no bonded assets\"}],\"Deprecated()\":[{\"notice\":\"Throws when job contract calls deprecated worked(address) function\"}],\"Disputed()\":[{\"notice\":\"Throws if either a job or a keeper is disputed\"}],\"DisputerExistent()\":[{\"notice\":\"Throws if the address is already a registered disputer\"}],\"DisputerUnexistent()\":[{\"notice\":\"Throws if caller is not a registered disputer\"}],\"GasNotInitialized()\":[{\"notice\":\"Throws if work method was called without calling isKeeper or isBondedKeeper\"}],\"InsufficientFunds()\":[{\"notice\":\"Throws if the amount of funds in the job is less than the payment that must be paid to the keeper that works that job\"}],\"InsufficientJobTokenCredits()\":[{\"notice\":\"Throws when the user tries to withdraw more tokens than it has\"}],\"JobAlreadyAdded()\":[{\"notice\":\"Throws when trying to add a job that has already been added\"}],\"JobDisputed()\":[{\"notice\":\"Throws when an action that requires an undisputed job is applied on a disputed job\"}],\"JobLiquidityInsufficient()\":[{\"notice\":\"Throws when trying to remove more liquidity than the job has\"}],\"JobLiquidityLessThanMin()\":[{\"notice\":\"Throws when trying to add less liquidity than the minimum liquidity required\"}],\"JobLiquidityUnexistent()\":[{\"notice\":\"Throws when the job doesn't have the requested liquidity\"}],\"JobMigrationImpossible()\":[{\"notice\":\"Throws when the address of the job that requests to migrate wants to migrate to its same address\"}],\"JobMigrationLocked()\":[{\"notice\":\"Throws when cooldown between migrations has not yet passed\"}],\"JobMigrationUnavailable()\":[{\"notice\":\"Throws when the _toJob address differs from the address being tracked in the pendingJobMigrations mapping\"}],\"JobTokenCreditsLocked()\":[{\"notice\":\"Throws when the token withdraw cooldown has not yet passed\"}],\"JobTokenInsufficient()\":[{\"notice\":\"Throws when someone tries to slash more tokens than the job has\"}],\"JobTokenUnexistent()\":[{\"notice\":\"Throws when the token trying to be slashed doesn't exist\"}],\"JobUnapproved()\":[{\"notice\":\"Throws if the address claiming to be a job is not in the list of approved jobs\"}],\"JobUnavailable()\":[{\"notice\":\"Throws when an address is passed as a job, but that address is not a job\"}],\"LiquidityPairApproved()\":[{\"notice\":\"Throws when the liquidity being approved has already been approved\"}],\"LiquidityPairUnapproved()\":[{\"notice\":\"Throws when trying to add liquidity to an unapproved pool\"}],\"LiquidityPairUnexistent()\":[{\"notice\":\"Throws when the liquidity being removed has not been approved\"}],\"MinRewardPeriod()\":[{\"notice\":\"Throws if the reward period is less than the minimum reward period time\"}],\"NoGovernanceZeroAddress()\":[{\"notice\":\"Throws if trying to set governance to zero address\"}],\"NotDisputed()\":[{\"notice\":\"Throws when a job or keeper is not disputed and someone tries to resolve the dispute\"}],\"OnlyDisputer()\":[{\"notice\":\"Throws if the msg.sender is not a disputer or is not a part of governance\"}],\"OnlyGovernance()\":[{\"notice\":\"Throws if the caller of the function is not governance\"}],\"OnlyJobOwner()\":[{\"notice\":\"Throws when the caller of the function is not the job owner\"}],\"OnlyPendingGovernance()\":[{\"notice\":\"Throws if the caller of the function is not pendingGovernance\"}],\"OnlyPendingJobOwner()\":[{\"notice\":\"Throws when the caller of the function is not the pending job owner\"}],\"OnlySlasher()\":[{\"notice\":\"Throws if the msg.sender is not a slasher or is not a part of governance\"}],\"SlasherExistent()\":[{\"notice\":\"Throws if the address is already a registered slasher\"}],\"SlasherUnexistent()\":[{\"notice\":\"Throws if caller is not a registered slasher\"}],\"TokenUnallowed()\":[{\"notice\":\"Throws when the token is KP3R, as it should not be used for direct token payments\"}],\"UnbondsLocked()\":[{\"notice\":\"Throws if the time required to withdraw the bonds has not passed yet\"}],\"UnbondsUnexistent()\":[{\"notice\":\"Throws if there are no bonds to withdraw\"}],\"ZeroAddress()\":[{\"notice\":\"Throws if a variable is assigned to the zero address\"}]},\"events\":{\"Activation(address,address,uint256)\":{\"notice\":\"Emitted when Keep3rKeeperFundable#activate is called\"},\"BondTimeChange(uint256)\":{\"notice\":\"Emitted when bondTime is changed\"},\"Bonding(address,address,uint256)\":{\"notice\":\"Emitted when the bonding process of a new keeper begins\"},\"Dispute(address,address)\":{\"notice\":\"Emitted when a keeper or a job is disputed\"},\"DisputerAdded(address)\":{\"notice\":\"Emitted when a disputer is added\"},\"DisputerRemoved(address)\":{\"notice\":\"Emitted when a disputer is removed\"},\"DustSent(address,uint256,address)\":{\"notice\":\"Emitted when dust is sent\"},\"FeeChange(uint256)\":{\"notice\":\"Emitted when the fee is changed\"},\"GovernanceProposal(address)\":{\"notice\":\"Emitted when a new governance is proposed\"},\"GovernanceSet(address)\":{\"notice\":\"Emitted when pendingGovernance accepts to be governance\"},\"InflationPeriodChange(uint256)\":{\"notice\":\"Emitted when the inflationPeriod is changed\"},\"JobAddition(address,address)\":{\"notice\":\"Emitted when Keep3rJobManager#addJob is called\"},\"JobMigrationRequested(address,address)\":{\"notice\":\"Emitted when Keep3rJobMigration#migrateJob function is called\"},\"JobMigrationSuccessful(address,address)\":{\"notice\":\"Emitted when Keep3rJobMigration#acceptJobMigration function is called\"},\"JobOwnershipAssent(address,address,address)\":{\"notice\":\"Emitted when Keep3rJobOwnership#JobOwnershipAssent is called\"},\"JobOwnershipChange(address,address,address)\":{\"notice\":\"Emitted when Keep3rJobOwnership#changeJobOwnership is called\"},\"JobSlashLiquidity(address,address,address,uint256)\":{\"notice\":\"Emitted when Keep3rJobDisputable#slashLiquidityFromJob is called\"},\"JobSlashToken(address,address,address,uint256)\":{\"notice\":\"Emitted when Keep3rJobDisputable#slashTokenFromJob is called\"},\"Keep3rHelperChange(address)\":{\"notice\":\"Emitted when the Keep3rHelper address is changed\"},\"Keep3rV1Change(address)\":{\"notice\":\"Emitted when the Keep3rV1 address is changed\"},\"Keep3rV1ProxyChange(address)\":{\"notice\":\"Emitted when the Keep3rV1Proxy address is changed\"},\"KeeperRevoke(address,address)\":{\"notice\":\"Emitted when Keep3rKeeperDisputable#revoke is called\"},\"KeeperSlash(address,address,uint256)\":{\"notice\":\"Emitted when Keep3rKeeperDisputable#slash is called\"},\"KeeperValidation(uint256)\":{\"notice\":\"Emitted when a keeper is validated before a job\"},\"KeeperWork(address,address,address,uint256,uint256)\":{\"notice\":\"Emitted when a keeper works a job\"},\"LiquidityAddition(address,address,address,uint256)\":{\"notice\":\"Emitted when IKeep3rJobFundableLiquidity#addLiquidityToJob function is called\"},\"LiquidityApproval(address)\":{\"notice\":\"Emitted when Keep3rJobFundableLiquidity#approveLiquidity function is called\"},\"LiquidityCreditsForced(address,uint256,uint256)\":{\"notice\":\"Emitted when Keep3rJobFundableLiquidity#forceLiquidityCreditsToJob function is called\"},\"LiquidityCreditsReward(address,uint256,uint256,uint256)\":{\"notice\":\"Emitted when Keep3rJobFundableLiquidity#addLiquidityToJob function is called\"},\"LiquidityMinimumChange(uint256)\":{\"notice\":\"Emitted when _liquidityMinimum is changed\"},\"LiquidityRevocation(address)\":{\"notice\":\"Emitted when Keep3rJobFundableLiquidity#revokeLiquidity function is called\"},\"LiquidityWithdrawal(address,address,address,uint256)\":{\"notice\":\"Emitted when IKeep3rJobFundableLiquidity#withdrawLiquidityFromJob function is called\"},\"Resolve(address,address)\":{\"notice\":\"Emitted when a dispute is resolved\"},\"RewardPeriodTimeChange(uint256)\":{\"notice\":\"Emitted when _rewardPeriodTime is changed\"},\"SlasherAdded(address)\":{\"notice\":\"Emitted when a slasher is added\"},\"SlasherRemoved(address)\":{\"notice\":\"Emitted when a slasher is removed\"},\"TokenCreditAddition(address,address,address,uint256)\":{\"notice\":\"Emitted when Keep3rJobFundableCredits#addTokenCreditsToJob is called\"},\"TokenCreditWithdrawal(address,address,address,uint256)\":{\"notice\":\"Emitted when Keep3rJobFundableCredits#withdrawTokenCreditsFromJob is called\"},\"UnbondTimeChange(uint256)\":{\"notice\":\"Emitted when _unbondTime is changed\"},\"Unbonding(address,address,uint256)\":{\"notice\":\"Emitted when a keeper or job begins the unbonding process to withdraw the funds\"},\"Withdrawal(address,address,uint256)\":{\"notice\":\"Emitted when Keep3rKeeperFundable#withdraw is called\"}},\"kind\":\"user\",\"methods\":{\"acceptGovernance()\":{\"notice\":\"Changes the governance from the current governance to the previously proposed address\"},\"acceptJobMigration(address,address)\":{\"notice\":\"Completes the migration process for a job\"},\"acceptJobOwnership(address)\":{\"notice\":\"The proposed address accepts to be the owner of the job\"},\"activate(address)\":{\"notice\":\"End of the bonding process after bonding time has passed\"},\"addDisputer(address)\":{\"notice\":\"Registers a disputer by updating the disputers mapping\"},\"addJob(address)\":{\"notice\":\"Allows any caller to add a new job\"},\"addLiquidityToJob(address,address,uint256)\":{\"notice\":\"Allows anyone to fund a job with liquidity\"},\"addSlasher(address)\":{\"notice\":\"Registers a slasher by updating the slashers mapping\"},\"addTokenCreditsToJob(address,address,uint256)\":{\"notice\":\"Add credit to a job to be paid out for work\"},\"approveLiquidity(address)\":{\"notice\":\"Sidechain implementation asks the Helper for an oracle, instead of reading it from the ERC-20\"},\"approvedLiquidities()\":{\"notice\":\"Lists liquidity pairs\"},\"bond(address,uint256)\":{\"notice\":\"Beginning of the bonding process\"},\"bondTime()\":{\"notice\":\"The amount of time required to pass after a keeper has bonded assets for it to be able to activate\"},\"bondedPayment(address,uint256)\":{\"notice\":\"Implemented by jobs to show that a keeper performed work\"},\"bonds(address,address)\":{\"notice\":\"Mapping (job => bonding => amount)\"},\"canActivateAfter(address,address)\":{\"notice\":\"Tracks when a bonding for a keeper can be activated\"},\"canWithdrawAfter(address,address)\":{\"notice\":\"Tracks when keeper bonds are ready to be withdrawn\"},\"changeJobOwnership(address,address)\":{\"notice\":\"Proposes a new address to be the owner of the job\"},\"directTokenPayment(address,address,uint256)\":{\"notice\":\"Implemented by jobs to show that a keeper performed work\"},\"dispute(address)\":{\"notice\":\"Allows governance to create a dispute for a given keeper/job\"},\"disputers(address)\":{\"notice\":\"Tracks whether the address is a disputer or not\"},\"disputes(address)\":{\"notice\":\"Tracks if a keeper or job has a pending dispute\"},\"fee()\":{\"notice\":\"The fee to be sent to governance when a user adds liquidity to a job\"},\"firstSeen(address)\":{\"notice\":\"Tracks when a keeper was first registered\"},\"forceLiquidityCreditsToJob(address,uint256)\":{\"notice\":\"Gifts liquidity credits to the specified job\"},\"governance()\":{\"notice\":\"Stores the governance address\"},\"hasBonded(address)\":{\"notice\":\"Checks whether the address has ever bonded an asset\"},\"inflationPeriod()\":{\"notice\":\"The inflation period is the denominator used to regulate the emission of KP3R\"},\"isBondedKeeper(address,address,uint256,uint256,uint256)\":{\"notice\":\"Confirms if the current keeper is registered and has a minimum bond of any asset.\"},\"isKeeper(address)\":{\"notice\":\"Confirms if the current keeper is registered\"},\"jobLiquidityCredits(address)\":{\"notice\":\"Returns the liquidity credits of a given job\"},\"jobOwner(address)\":{\"notice\":\"Maps the job to the owner of the job\"},\"jobPendingOwner(address)\":{\"notice\":\"Maps the job to its pending owner\"},\"jobPeriodCredits(address)\":{\"notice\":\"Returns the credits of a given job for the current period\"},\"jobTokenCredits(address,address)\":{\"notice\":\"The current token credits available for a job\"},\"jobTokenCreditsAddedAt(address,address)\":{\"notice\":\"Last block where tokens were added to the job\"},\"jobs()\":{\"notice\":\"Lists all jobs\"},\"keep3rHelper()\":{\"notice\":\"Address of Keep3rHelper's contract\"},\"keep3rV1()\":{\"notice\":\"Address of Keep3rV1's contract\"},\"keep3rV1Proxy()\":{\"notice\":\"Address of Keep3rV1Proxy's contract\"},\"keepers()\":{\"notice\":\"Lists all keepers\"},\"liquidityAmount(address,address)\":{\"notice\":\"Amount of liquidity in a specified job\"},\"liquidityMinimum()\":{\"notice\":\"The minimum amount of liquidity required to fund a job per liquidity\"},\"migrateJob(address,address)\":{\"notice\":\"Initializes the migration process for a job by adding the request to the pendingJobMigrations mapping\"},\"observeLiquidity(address)\":{\"notice\":\"Sidechain implementation will always ask for 2 tickCumulatives instead of cacheing\"},\"pendingBonds(address,address)\":{\"notice\":\"Tracks the amount of assets deposited in pending bonds\"},\"pendingGovernance()\":{\"notice\":\"Stores the pendingGovernance address\"},\"pendingJobMigrations(address)\":{\"notice\":\"Maps the jobs that have requested a migration to the address they have requested to migrate to\"},\"pendingUnbonds(address,address)\":{\"notice\":\"Tracks how much keeper bonds are to be withdrawn\"},\"quoteLiquidity(address,uint256)\":{\"notice\":\"Calculates how many credits should be rewarded periodically for a given liquidity amount\"},\"removeDisputer(address)\":{\"notice\":\"Removes a disputer by updating the disputers mapping\"},\"removeSlasher(address)\":{\"notice\":\"Removes a slasher by updating the slashers mapping\"},\"resolve(address)\":{\"notice\":\"Allows governance to resolve a dispute on a keeper/job\"},\"revoke(address)\":{\"notice\":\"Blacklists a keeper from participating in the network\"},\"revokeLiquidity(address)\":{\"notice\":\"Revoke a liquidity pair from being accepted in future\"},\"rewardPeriodTime()\":{\"notice\":\"The amount of time between each scheduled credits reward given to a job\"},\"rewardedAt(address)\":{\"notice\":\"Last time the job was rewarded liquidity credits\"},\"sendDust(address,uint256,address)\":{\"notice\":\"Allows an authorized user to transfer the tokens or eth that may have been left in a contract\"},\"setBondTime(uint256)\":{\"notice\":\"Sets the bond time required to activate as a keeper\"},\"setFee(uint256)\":{\"notice\":\"Sets the new fee\"},\"setGovernance(address)\":{\"notice\":\"Proposes a new address to be governance\"},\"setInflationPeriod(uint256)\":{\"notice\":\"Sets the new inflation period\"},\"setKeep3rHelper(address)\":{\"notice\":\"Sets the Keep3rHelper address\"},\"setKeep3rV1(address)\":{\"notice\":\"Sets the Keep3rV1 address\"},\"setKeep3rV1Proxy(address)\":{\"notice\":\"Sets the Keep3rV1Proxy address\"},\"setLiquidityMinimum(uint256)\":{\"notice\":\"Sets the minimum amount of liquidity required to fund a job\"},\"setRewardPeriodTime(uint256)\":{\"notice\":\"Sets the time required to pass between rewards for jobs\"},\"setUnbondTime(uint256)\":{\"notice\":\"Sets the unbond time required unbond what has been bonded\"},\"slash(address,address,uint256,uint256)\":{\"notice\":\"Allows governance to slash a keeper based on a dispute\"},\"slashLiquidityFromJob(address,address,uint256)\":{\"notice\":\"Allows governance or a slasher to slash liquidity from a job\"},\"slashTokenFromJob(address,address,uint256)\":{\"notice\":\"Allows governance or slasher to slash a job specific token\"},\"slashers(address)\":{\"notice\":\"Tracks whether the address is a slasher or not\"},\"totalBonds()\":{\"notice\":\"Tracks the total amount of bonded KP3Rs in the contract\"},\"totalJobCredits(address)\":{\"notice\":\"Calculates the total credits of a given job\"},\"unbond(address,uint256)\":{\"notice\":\"Beginning of the unbonding process\"},\"unbondLiquidityFromJob(address,address,uint256)\":{\"notice\":\"Unbond liquidity for a job\"},\"unbondTime()\":{\"notice\":\"The amount of time required to pass before a keeper can unbond what he has bonded\"},\"virtualReserves()\":{\"notice\":\"The surplus amount of wKP3Rs in escrow contract\"},\"withdraw(address)\":{\"notice\":\"Withdraw funds after unbonding has finished\"},\"withdrawLiquidityFromJob(address,address,address)\":{\"notice\":\"Withdraw liquidity from a job\"},\"withdrawTokenCreditsFromJob(address,address,uint256,address)\":{\"notice\":\"Withdraw credit from a job\"},\"workCompleted(address)\":{\"notice\":\"Tracks the total KP3R earnings of a keeper since it started working\"},\"worked(address,uint256)\":{\"notice\":\"Implemented by jobs to show that a keeper performed work\"},\"workedAt(address)\":{\"notice\":\"Last time the job was worked\"}},\"version\":1}},\"settings\":{\"compilationTarget\":{\"solidity/for-test/testnet/Keep3rSidechainForTestnet.sol\":\"Keep3rSidechainForTestnet\"},\"evmVersion\":\"london\",\"libraries\":{\":__CACHE_BREAKER__\":\"0x00000000d41867734bbee4c6863d9255b2b06ac1\"},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":33},\"remappings\":[]},\"sources\":{\"@openzeppelin/contracts/security/ReentrancyGuard.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Contract module that helps prevent reentrant calls to a function.\\n *\\n * Inheriting from `ReentrancyGuard` will make the {nonReentrant} modifier\\n * available, which can be applied to functions to make sure there are no nested\\n * (reentrant) calls to them.\\n *\\n * Note that because there is a single `nonReentrant` guard, functions marked as\\n * `nonReentrant` may not call one another. This can be worked around by making\\n * those functions `private`, and then adding `external` `nonReentrant` entry\\n * points to them.\\n *\\n * TIP: If you would like to learn more about reentrancy and alternative ways\\n * to protect against it, check out our blog post\\n * https://blog.openzeppelin.com/reentrancy-after-istanbul/[Reentrancy After Istanbul].\\n */\\nabstract contract ReentrancyGuard {\\n // Booleans are more expensive than uint256 or any type that takes up a full\\n // word because each write operation emits an extra SLOAD to first read the\\n // slot's contents, replace the bits taken up by the boolean, and then write\\n // back. This is the compiler's defense against contract upgrades and\\n // pointer aliasing, and it cannot be disabled.\\n\\n // The values being non-zero value makes deployment a bit more expensive,\\n // but in exchange the refund on every call to nonReentrant will be lower in\\n // amount. Since refunds are capped to a percentage of the total\\n // transaction's gas, it is best to keep them low in cases like this one, to\\n // increase the likelihood of the full refund coming into effect.\\n uint256 private constant _NOT_ENTERED = 1;\\n uint256 private constant _ENTERED = 2;\\n\\n uint256 private _status;\\n\\n constructor() {\\n _status = _NOT_ENTERED;\\n }\\n\\n /**\\n * @dev Prevents a contract from calling itself, directly or indirectly.\\n * Calling a `nonReentrant` function from another `nonReentrant`\\n * function is not supported. It is possible to prevent this from happening\\n * by making the `nonReentrant` function external, and make it call a\\n * `private` function that does the actual work.\\n */\\n modifier nonReentrant() {\\n // On the first call to nonReentrant, _notEntered will be true\\n require(_status != _ENTERED, \\\"ReentrancyGuard: reentrant call\\\");\\n\\n // Any calls to nonReentrant after this point will fail\\n _status = _ENTERED;\\n\\n _;\\n\\n // By storing the original value once again, a refund is triggered (see\\n // https://eips.ethereum.org/EIPS/eip-2200)\\n _status = _NOT_ENTERED;\\n }\\n}\\n\",\"keccak256\":\"0x842ccf9a6cd33e17b7acef8372ca42090755217b358fe0c44c98e951ea549d3a\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC20/IERC20.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Interface of the ERC20 standard as defined in the EIP.\\n */\\ninterface IERC20 {\\n /**\\n * @dev Returns the amount of tokens in existence.\\n */\\n function totalSupply() external view returns (uint256);\\n\\n /**\\n * @dev Returns the amount of tokens owned by `account`.\\n */\\n function balanceOf(address account) external view returns (uint256);\\n\\n /**\\n * @dev Moves `amount` tokens from the caller's account to `recipient`.\\n *\\n * Returns a boolean value indicating whether the operation succeeded.\\n *\\n * Emits a {Transfer} event.\\n */\\n function transfer(address recipient, uint256 amount) external returns (bool);\\n\\n /**\\n * @dev Returns the remaining number of tokens that `spender` will be\\n * allowed to spend on behalf of `owner` through {transferFrom}. This is\\n * zero by default.\\n *\\n * This value changes when {approve} or {transferFrom} are called.\\n */\\n function allowance(address owner, address spender) external view returns (uint256);\\n\\n /**\\n * @dev Sets `amount` as the allowance of `spender` over the caller's tokens.\\n *\\n * Returns a boolean value indicating whether the operation succeeded.\\n *\\n * IMPORTANT: Beware that changing an allowance with this method brings the risk\\n * that someone may use both the old and the new allowance by unfortunate\\n * transaction ordering. One possible solution to mitigate this race\\n * condition is to first reduce the spender's allowance to 0 and set the\\n * desired value afterwards:\\n * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729\\n *\\n * Emits an {Approval} event.\\n */\\n function approve(address spender, uint256 amount) external returns (bool);\\n\\n /**\\n * @dev Moves `amount` tokens from `sender` to `recipient` using the\\n * allowance mechanism. `amount` is then deducted from the caller's\\n * allowance.\\n *\\n * Returns a boolean value indicating whether the operation succeeded.\\n *\\n * Emits a {Transfer} event.\\n */\\n function transferFrom(\\n address sender,\\n address recipient,\\n uint256 amount\\n ) external returns (bool);\\n\\n /**\\n * @dev Emitted when `value` tokens are moved from one account (`from`) to\\n * another (`to`).\\n *\\n * Note that `value` may be zero.\\n */\\n event Transfer(address indexed from, address indexed to, uint256 value);\\n\\n /**\\n * @dev Emitted when the allowance of a `spender` for an `owner` is set by\\n * a call to {approve}. `value` is the new allowance.\\n */\\n event Approval(address indexed owner, address indexed spender, uint256 value);\\n}\\n\",\"keccak256\":\"0x027b891937d20ccf213fdb9c31531574256de774bda99d3a70ecef6e1913ed2a\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../IERC20.sol\\\";\\n\\n/**\\n * @dev Interface for the optional metadata functions from the ERC20 standard.\\n *\\n * _Available since v4.1._\\n */\\ninterface IERC20Metadata is IERC20 {\\n /**\\n * @dev Returns the name of the token.\\n */\\n function name() external view returns (string memory);\\n\\n /**\\n * @dev Returns the symbol of the token.\\n */\\n function symbol() external view returns (string memory);\\n\\n /**\\n * @dev Returns the decimals places of the token.\\n */\\n function decimals() external view returns (uint8);\\n}\\n\",\"keccak256\":\"0x83fe24f5c04a56091e50f4a345ff504c8bff658a76d4c43b16878c8f940c53b2\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../IERC20.sol\\\";\\nimport \\\"../../../utils/Address.sol\\\";\\n\\n/**\\n * @title SafeERC20\\n * @dev Wrappers around ERC20 operations that throw on failure (when the token\\n * contract returns false). Tokens that return no value (and instead revert or\\n * throw on failure) are also supported, non-reverting calls are assumed to be\\n * successful.\\n * To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract,\\n * which allows you to call the safe operations as `token.safeTransfer(...)`, etc.\\n */\\nlibrary SafeERC20 {\\n using Address for address;\\n\\n function safeTransfer(\\n IERC20 token,\\n address to,\\n uint256 value\\n ) internal {\\n _callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value));\\n }\\n\\n function safeTransferFrom(\\n IERC20 token,\\n address from,\\n address to,\\n uint256 value\\n ) internal {\\n _callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value));\\n }\\n\\n /**\\n * @dev Deprecated. This function has issues similar to the ones found in\\n * {IERC20-approve}, and its usage is discouraged.\\n *\\n * Whenever possible, use {safeIncreaseAllowance} and\\n * {safeDecreaseAllowance} instead.\\n */\\n function safeApprove(\\n IERC20 token,\\n address spender,\\n uint256 value\\n ) internal {\\n // safeApprove should only be called when setting an initial allowance,\\n // or when resetting it to zero. To increase and decrease it, use\\n // 'safeIncreaseAllowance' and 'safeDecreaseAllowance'\\n require(\\n (value == 0) || (token.allowance(address(this), spender) == 0),\\n \\\"SafeERC20: approve from non-zero to non-zero allowance\\\"\\n );\\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value));\\n }\\n\\n function safeIncreaseAllowance(\\n IERC20 token,\\n address spender,\\n uint256 value\\n ) internal {\\n uint256 newAllowance = token.allowance(address(this), spender) + value;\\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));\\n }\\n\\n function safeDecreaseAllowance(\\n IERC20 token,\\n address spender,\\n uint256 value\\n ) internal {\\n unchecked {\\n uint256 oldAllowance = token.allowance(address(this), spender);\\n require(oldAllowance >= value, \\\"SafeERC20: decreased allowance below zero\\\");\\n uint256 newAllowance = oldAllowance - value;\\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));\\n }\\n }\\n\\n /**\\n * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement\\n * on the return value: the return value is optional (but if data is returned, it must not be false).\\n * @param token The token targeted by the call.\\n * @param data The call data (encoded using abi.encode or one of its variants).\\n */\\n function _callOptionalReturn(IERC20 token, bytes memory data) private {\\n // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since\\n // we're implementing it ourselves. We use {Address.functionCall} to perform this call, which verifies that\\n // the target address contains contract code and also asserts for success in the low-level call.\\n\\n bytes memory returndata = address(token).functionCall(data, \\\"SafeERC20: low-level call failed\\\");\\n if (returndata.length > 0) {\\n // Return data is optional\\n require(abi.decode(returndata, (bool)), \\\"SafeERC20: ERC20 operation did not succeed\\\");\\n }\\n }\\n}\\n\",\"keccak256\":\"0x02348b2e4b9f3200c7e3907c5c2661643a6d8520e9f79939fbb9b4005a54894d\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/Address.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Collection of functions related to the address type\\n */\\nlibrary Address {\\n /**\\n * @dev Returns true if `account` is a contract.\\n *\\n * [IMPORTANT]\\n * ====\\n * It is unsafe to assume that an address for which this function returns\\n * false is an externally-owned account (EOA) and not a contract.\\n *\\n * Among others, `isContract` will return false for the following\\n * types of addresses:\\n *\\n * - an externally-owned account\\n * - a contract in construction\\n * - an address where a contract will be created\\n * - an address where a contract lived, but was destroyed\\n * ====\\n */\\n function isContract(address account) internal view returns (bool) {\\n // This method relies on extcodesize, which returns 0 for contracts in\\n // construction, since the code is only stored at the end of the\\n // constructor execution.\\n\\n uint256 size;\\n assembly {\\n size := extcodesize(account)\\n }\\n return size > 0;\\n }\\n\\n /**\\n * @dev Replacement for Solidity's `transfer`: sends `amount` wei to\\n * `recipient`, forwarding all available gas and reverting on errors.\\n *\\n * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost\\n * of certain opcodes, possibly making contracts go over the 2300 gas limit\\n * imposed by `transfer`, making them unable to receive funds via\\n * `transfer`. {sendValue} removes this limitation.\\n *\\n * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].\\n *\\n * IMPORTANT: because control is transferred to `recipient`, care must be\\n * taken to not create reentrancy vulnerabilities. Consider using\\n * {ReentrancyGuard} or the\\n * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].\\n */\\n function sendValue(address payable recipient, uint256 amount) internal {\\n require(address(this).balance >= amount, \\\"Address: insufficient balance\\\");\\n\\n (bool success, ) = recipient.call{value: amount}(\\\"\\\");\\n require(success, \\\"Address: unable to send value, recipient may have reverted\\\");\\n }\\n\\n /**\\n * @dev Performs a Solidity function call using a low level `call`. A\\n * plain `call` is an unsafe replacement for a function call: use this\\n * function instead.\\n *\\n * If `target` reverts with a revert reason, it is bubbled up by this\\n * function (like regular Solidity function calls).\\n *\\n * Returns the raw returned data. To convert to the expected return value,\\n * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\\n *\\n * Requirements:\\n *\\n * - `target` must be a contract.\\n * - calling `target` with `data` must not revert.\\n *\\n * _Available since v3.1._\\n */\\n function functionCall(address target, bytes memory data) internal returns (bytes memory) {\\n return functionCall(target, data, \\\"Address: low-level call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with\\n * `errorMessage` as a fallback revert reason when `target` reverts.\\n *\\n * _Available since v3.1._\\n */\\n function functionCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, 0, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but also transferring `value` wei to `target`.\\n *\\n * Requirements:\\n *\\n * - the calling contract must have an ETH balance of at least `value`.\\n * - the called Solidity function must be `payable`.\\n *\\n * _Available since v3.1._\\n */\\n function functionCallWithValue(\\n address target,\\n bytes memory data,\\n uint256 value\\n ) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, value, \\\"Address: low-level call with value failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but\\n * with `errorMessage` as a fallback revert reason when `target` reverts.\\n *\\n * _Available since v3.1._\\n */\\n function functionCallWithValue(\\n address target,\\n bytes memory data,\\n uint256 value,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n require(address(this).balance >= value, \\\"Address: insufficient balance for call\\\");\\n require(isContract(target), \\\"Address: call to non-contract\\\");\\n\\n (bool success, bytes memory returndata) = target.call{value: value}(data);\\n return verifyCallResult(success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but performing a static call.\\n *\\n * _Available since v3.3._\\n */\\n function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\\n return functionStaticCall(target, data, \\\"Address: low-level static call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\\n * but performing a static call.\\n *\\n * _Available since v3.3._\\n */\\n function functionStaticCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal view returns (bytes memory) {\\n require(isContract(target), \\\"Address: static call to non-contract\\\");\\n\\n (bool success, bytes memory returndata) = target.staticcall(data);\\n return verifyCallResult(success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but performing a delegate call.\\n *\\n * _Available since v3.4._\\n */\\n function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {\\n return functionDelegateCall(target, data, \\\"Address: low-level delegate call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\\n * but performing a delegate call.\\n *\\n * _Available since v3.4._\\n */\\n function functionDelegateCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n require(isContract(target), \\\"Address: delegate call to non-contract\\\");\\n\\n (bool success, bytes memory returndata) = target.delegatecall(data);\\n return verifyCallResult(success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the\\n * revert reason using the provided one.\\n *\\n * _Available since v4.3._\\n */\\n function verifyCallResult(\\n bool success,\\n bytes memory returndata,\\n string memory errorMessage\\n ) internal pure returns (bytes memory) {\\n if (success) {\\n return returndata;\\n } else {\\n // Look for revert reason and bubble it up if present\\n if (returndata.length > 0) {\\n // The easiest way to bubble the revert reason is using memory via assembly\\n\\n assembly {\\n let returndata_size := mload(returndata)\\n revert(add(32, returndata), returndata_size)\\n }\\n } else {\\n revert(errorMessage);\\n }\\n }\\n }\\n}\\n\",\"keccak256\":\"0x3336baae5cf23e94274d75336e2d412193be508504aee185e61dc7d58cd05c8a\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/math/Math.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Standard math utilities missing in the Solidity language.\\n */\\nlibrary Math {\\n /**\\n * @dev Returns the largest of two numbers.\\n */\\n function max(uint256 a, uint256 b) internal pure returns (uint256) {\\n return a >= b ? a : b;\\n }\\n\\n /**\\n * @dev Returns the smallest of two numbers.\\n */\\n function min(uint256 a, uint256 b) internal pure returns (uint256) {\\n return a < b ? a : b;\\n }\\n\\n /**\\n * @dev Returns the average of two numbers. The result is rounded towards\\n * zero.\\n */\\n function average(uint256 a, uint256 b) internal pure returns (uint256) {\\n // (a + b) / 2 can overflow.\\n return (a & b) + (a ^ b) / 2;\\n }\\n\\n /**\\n * @dev Returns the ceiling of the division of two numbers.\\n *\\n * This differs from standard division with `/` in that it rounds up instead\\n * of rounding down.\\n */\\n function ceilDiv(uint256 a, uint256 b) internal pure returns (uint256) {\\n // (a + b - 1) / b can overflow on addition, so we distribute.\\n return a / b + (a % b == 0 ? 0 : 1);\\n }\\n}\\n\",\"keccak256\":\"0x49ebdac5d515aebb95168564158940b79d7d5d12fbfe59cec546a00d57fee64a\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/structs/EnumerableSet.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Library for managing\\n * https://en.wikipedia.org/wiki/Set_(abstract_data_type)[sets] of primitive\\n * types.\\n *\\n * Sets have the following properties:\\n *\\n * - Elements are added, removed, and checked for existence in constant time\\n * (O(1)).\\n * - Elements are enumerated in O(n). No guarantees are made on the ordering.\\n *\\n * ```\\n * contract Example {\\n * // Add the library methods\\n * using EnumerableSet for EnumerableSet.AddressSet;\\n *\\n * // Declare a set state variable\\n * EnumerableSet.AddressSet private mySet;\\n * }\\n * ```\\n *\\n * As of v3.3.0, sets of type `bytes32` (`Bytes32Set`), `address` (`AddressSet`)\\n * and `uint256` (`UintSet`) are supported.\\n */\\nlibrary EnumerableSet {\\n // To implement this library for multiple types with as little code\\n // repetition as possible, we write it in terms of a generic Set type with\\n // bytes32 values.\\n // The Set implementation uses private functions, and user-facing\\n // implementations (such as AddressSet) are just wrappers around the\\n // underlying Set.\\n // This means that we can only create new EnumerableSets for types that fit\\n // in bytes32.\\n\\n struct Set {\\n // Storage of set values\\n bytes32[] _values;\\n // Position of the value in the `values` array, plus 1 because index 0\\n // means a value is not in the set.\\n mapping(bytes32 => uint256) _indexes;\\n }\\n\\n /**\\n * @dev Add a value to a set. O(1).\\n *\\n * Returns true if the value was added to the set, that is if it was not\\n * already present.\\n */\\n function _add(Set storage set, bytes32 value) private returns (bool) {\\n if (!_contains(set, value)) {\\n set._values.push(value);\\n // The value is stored at length-1, but we add 1 to all indexes\\n // and use 0 as a sentinel value\\n set._indexes[value] = set._values.length;\\n return true;\\n } else {\\n return false;\\n }\\n }\\n\\n /**\\n * @dev Removes a value from a set. O(1).\\n *\\n * Returns true if the value was removed from the set, that is if it was\\n * present.\\n */\\n function _remove(Set storage set, bytes32 value) private returns (bool) {\\n // We read and store the value's index to prevent multiple reads from the same storage slot\\n uint256 valueIndex = set._indexes[value];\\n\\n if (valueIndex != 0) {\\n // Equivalent to contains(set, value)\\n // To delete an element from the _values array in O(1), we swap the element to delete with the last one in\\n // the array, and then remove the last element (sometimes called as 'swap and pop').\\n // This modifies the order of the array, as noted in {at}.\\n\\n uint256 toDeleteIndex = valueIndex - 1;\\n uint256 lastIndex = set._values.length - 1;\\n\\n if (lastIndex != toDeleteIndex) {\\n bytes32 lastvalue = set._values[lastIndex];\\n\\n // Move the last value to the index where the value to delete is\\n set._values[toDeleteIndex] = lastvalue;\\n // Update the index for the moved value\\n set._indexes[lastvalue] = valueIndex; // Replace lastvalue's index to valueIndex\\n }\\n\\n // Delete the slot where the moved value was stored\\n set._values.pop();\\n\\n // Delete the index for the deleted slot\\n delete set._indexes[value];\\n\\n return true;\\n } else {\\n return false;\\n }\\n }\\n\\n /**\\n * @dev Returns true if the value is in the set. O(1).\\n */\\n function _contains(Set storage set, bytes32 value) private view returns (bool) {\\n return set._indexes[value] != 0;\\n }\\n\\n /**\\n * @dev Returns the number of values on the set. O(1).\\n */\\n function _length(Set storage set) private view returns (uint256) {\\n return set._values.length;\\n }\\n\\n /**\\n * @dev Returns the value stored at position `index` in the set. O(1).\\n *\\n * Note that there are no guarantees on the ordering of values inside the\\n * array, and it may change when more values are added or removed.\\n *\\n * Requirements:\\n *\\n * - `index` must be strictly less than {length}.\\n */\\n function _at(Set storage set, uint256 index) private view returns (bytes32) {\\n return set._values[index];\\n }\\n\\n /**\\n * @dev Return the entire set in an array\\n *\\n * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed\\n * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that\\n * this function has an unbounded cost, and using it as part of a state-changing function may render the function\\n * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.\\n */\\n function _values(Set storage set) private view returns (bytes32[] memory) {\\n return set._values;\\n }\\n\\n // Bytes32Set\\n\\n struct Bytes32Set {\\n Set _inner;\\n }\\n\\n /**\\n * @dev Add a value to a set. O(1).\\n *\\n * Returns true if the value was added to the set, that is if it was not\\n * already present.\\n */\\n function add(Bytes32Set storage set, bytes32 value) internal returns (bool) {\\n return _add(set._inner, value);\\n }\\n\\n /**\\n * @dev Removes a value from a set. O(1).\\n *\\n * Returns true if the value was removed from the set, that is if it was\\n * present.\\n */\\n function remove(Bytes32Set storage set, bytes32 value) internal returns (bool) {\\n return _remove(set._inner, value);\\n }\\n\\n /**\\n * @dev Returns true if the value is in the set. O(1).\\n */\\n function contains(Bytes32Set storage set, bytes32 value) internal view returns (bool) {\\n return _contains(set._inner, value);\\n }\\n\\n /**\\n * @dev Returns the number of values in the set. O(1).\\n */\\n function length(Bytes32Set storage set) internal view returns (uint256) {\\n return _length(set._inner);\\n }\\n\\n /**\\n * @dev Returns the value stored at position `index` in the set. O(1).\\n *\\n * Note that there are no guarantees on the ordering of values inside the\\n * array, and it may change when more values are added or removed.\\n *\\n * Requirements:\\n *\\n * - `index` must be strictly less than {length}.\\n */\\n function at(Bytes32Set storage set, uint256 index) internal view returns (bytes32) {\\n return _at(set._inner, index);\\n }\\n\\n /**\\n * @dev Return the entire set in an array\\n *\\n * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed\\n * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that\\n * this function has an unbounded cost, and using it as part of a state-changing function may render the function\\n * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.\\n */\\n function values(Bytes32Set storage set) internal view returns (bytes32[] memory) {\\n return _values(set._inner);\\n }\\n\\n // AddressSet\\n\\n struct AddressSet {\\n Set _inner;\\n }\\n\\n /**\\n * @dev Add a value to a set. O(1).\\n *\\n * Returns true if the value was added to the set, that is if it was not\\n * already present.\\n */\\n function add(AddressSet storage set, address value) internal returns (bool) {\\n return _add(set._inner, bytes32(uint256(uint160(value))));\\n }\\n\\n /**\\n * @dev Removes a value from a set. O(1).\\n *\\n * Returns true if the value was removed from the set, that is if it was\\n * present.\\n */\\n function remove(AddressSet storage set, address value) internal returns (bool) {\\n return _remove(set._inner, bytes32(uint256(uint160(value))));\\n }\\n\\n /**\\n * @dev Returns true if the value is in the set. O(1).\\n */\\n function contains(AddressSet storage set, address value) internal view returns (bool) {\\n return _contains(set._inner, bytes32(uint256(uint160(value))));\\n }\\n\\n /**\\n * @dev Returns the number of values in the set. O(1).\\n */\\n function length(AddressSet storage set) internal view returns (uint256) {\\n return _length(set._inner);\\n }\\n\\n /**\\n * @dev Returns the value stored at position `index` in the set. O(1).\\n *\\n * Note that there are no guarantees on the ordering of values inside the\\n * array, and it may change when more values are added or removed.\\n *\\n * Requirements:\\n *\\n * - `index` must be strictly less than {length}.\\n */\\n function at(AddressSet storage set, uint256 index) internal view returns (address) {\\n return address(uint160(uint256(_at(set._inner, index))));\\n }\\n\\n /**\\n * @dev Return the entire set in an array\\n *\\n * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed\\n * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that\\n * this function has an unbounded cost, and using it as part of a state-changing function may render the function\\n * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.\\n */\\n function values(AddressSet storage set) internal view returns (address[] memory) {\\n bytes32[] memory store = _values(set._inner);\\n address[] memory result;\\n\\n assembly {\\n result := store\\n }\\n\\n return result;\\n }\\n\\n // UintSet\\n\\n struct UintSet {\\n Set _inner;\\n }\\n\\n /**\\n * @dev Add a value to a set. O(1).\\n *\\n * Returns true if the value was added to the set, that is if it was not\\n * already present.\\n */\\n function add(UintSet storage set, uint256 value) internal returns (bool) {\\n return _add(set._inner, bytes32(value));\\n }\\n\\n /**\\n * @dev Removes a value from a set. O(1).\\n *\\n * Returns true if the value was removed from the set, that is if it was\\n * present.\\n */\\n function remove(UintSet storage set, uint256 value) internal returns (bool) {\\n return _remove(set._inner, bytes32(value));\\n }\\n\\n /**\\n * @dev Returns true if the value is in the set. O(1).\\n */\\n function contains(UintSet storage set, uint256 value) internal view returns (bool) {\\n return _contains(set._inner, bytes32(value));\\n }\\n\\n /**\\n * @dev Returns the number of values on the set. O(1).\\n */\\n function length(UintSet storage set) internal view returns (uint256) {\\n return _length(set._inner);\\n }\\n\\n /**\\n * @dev Returns the value stored at position `index` in the set. O(1).\\n *\\n * Note that there are no guarantees on the ordering of values inside the\\n * array, and it may change when more values are added or removed.\\n *\\n * Requirements:\\n *\\n * - `index` must be strictly less than {length}.\\n */\\n function at(UintSet storage set, uint256 index) internal view returns (uint256) {\\n return uint256(_at(set._inner, index));\\n }\\n\\n /**\\n * @dev Return the entire set in an array\\n *\\n * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed\\n * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that\\n * this function has an unbounded cost, and using it as part of a state-changing function may render the function\\n * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.\\n */\\n function values(UintSet storage set) internal view returns (uint256[] memory) {\\n bytes32[] memory store = _values(set._inner);\\n uint256[] memory result;\\n\\n assembly {\\n result := store\\n }\\n\\n return result;\\n }\\n}\\n\",\"keccak256\":\"0x3778dc944f4a696335878bad8beca60f38b7c79b7a0bd8ddbeb618bd502a95ae\",\"license\":\"MIT\"},\"solidity/contracts/Keep3r.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\n/*\\n\\nCoded for The Keep3r Network with \\u2665 by\\n\\n\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2557\\u2591\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2557\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2557\\u2588\\u2588\\u2557\\u2591\\u2591\\u2591\\u2588\\u2588\\u2557\\u2591\\u2591\\u2591\\u2591\\u2591\\u2591\\u2591\\u2588\\u2588\\u2557\\u2591\\u2588\\u2588\\u2588\\u2588\\u2588\\u2557\\u2591\\u2588\\u2588\\u2588\\u2557\\u2591\\u2591\\u2588\\u2588\\u2557\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2557\\u2591\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2557\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2557\\u2591\\u2588\\u2588\\u2557\\u2591\\u2591\\u2591\\u2591\\u2591\\u2591\\u2588\\u2588\\u2588\\u2588\\u2588\\u2557\\u2591\\u2588\\u2588\\u2588\\u2557\\u2591\\u2591\\u2588\\u2588\\u2557\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2557\\u2591\\n\\u2588\\u2588\\u2554\\u2550\\u2550\\u2588\\u2588\\u2557\\u2588\\u2588\\u2554\\u2550\\u2550\\u2550\\u2550\\u255d\\u2588\\u2588\\u2554\\u2550\\u2550\\u2550\\u2550\\u255d\\u2588\\u2588\\u2551\\u2591\\u2591\\u2591\\u2588\\u2588\\u2551\\u2591\\u2591\\u2588\\u2588\\u2557\\u2591\\u2591\\u2588\\u2588\\u2551\\u2588\\u2588\\u2554\\u2550\\u2550\\u2588\\u2588\\u2557\\u2588\\u2588\\u2588\\u2588\\u2557\\u2591\\u2588\\u2588\\u2551\\u2588\\u2588\\u2554\\u2550\\u2550\\u2588\\u2588\\u2557\\u2588\\u2588\\u2554\\u2550\\u2550\\u2550\\u2550\\u255d\\u2588\\u2588\\u2554\\u2550\\u2550\\u2588\\u2588\\u2557\\u2588\\u2588\\u2551\\u2591\\u2591\\u2591\\u2591\\u2591\\u2588\\u2588\\u2554\\u2550\\u2550\\u2588\\u2588\\u2557\\u2588\\u2588\\u2588\\u2588\\u2557\\u2591\\u2588\\u2588\\u2551\\u2588\\u2588\\u2554\\u2550\\u2550\\u2588\\u2588\\u2557\\n\\u2588\\u2588\\u2551\\u2591\\u2591\\u2588\\u2588\\u2551\\u2588\\u2588\\u2588\\u2588\\u2588\\u2557\\u2591\\u2591\\u2588\\u2588\\u2588\\u2588\\u2588\\u2557\\u2591\\u2591\\u2588\\u2588\\u2551\\u2591\\u2591\\u2591\\u255a\\u2588\\u2588\\u2557\\u2588\\u2588\\u2588\\u2588\\u2557\\u2588\\u2588\\u2554\\u255d\\u2588\\u2588\\u2551\\u2591\\u2591\\u2588\\u2588\\u2551\\u2588\\u2588\\u2554\\u2588\\u2588\\u2557\\u2588\\u2588\\u2551\\u2588\\u2588\\u2551\\u2591\\u2591\\u2588\\u2588\\u2551\\u2588\\u2588\\u2588\\u2588\\u2588\\u2557\\u2591\\u2591\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2554\\u255d\\u2588\\u2588\\u2551\\u2591\\u2591\\u2591\\u2591\\u2591\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2551\\u2588\\u2588\\u2554\\u2588\\u2588\\u2557\\u2588\\u2588\\u2551\\u2588\\u2588\\u2551\\u2591\\u2591\\u2588\\u2588\\u2551\\n\\u2588\\u2588\\u2551\\u2591\\u2591\\u2588\\u2588\\u2551\\u2588\\u2588\\u2554\\u2550\\u2550\\u255d\\u2591\\u2591\\u2588\\u2588\\u2554\\u2550\\u2550\\u255d\\u2591\\u2591\\u2588\\u2588\\u2551\\u2591\\u2591\\u2591\\u2591\\u2588\\u2588\\u2588\\u2588\\u2554\\u2550\\u2588\\u2588\\u2588\\u2588\\u2551\\u2591\\u2588\\u2588\\u2551\\u2591\\u2591\\u2588\\u2588\\u2551\\u2588\\u2588\\u2551\\u255a\\u2588\\u2588\\u2588\\u2588\\u2551\\u2588\\u2588\\u2551\\u2591\\u2591\\u2588\\u2588\\u2551\\u2588\\u2588\\u2554\\u2550\\u2550\\u255d\\u2591\\u2591\\u2588\\u2588\\u2554\\u2550\\u2550\\u2588\\u2588\\u2557\\u2588\\u2588\\u2551\\u2591\\u2591\\u2591\\u2591\\u2591\\u2588\\u2588\\u2554\\u2550\\u2550\\u2588\\u2588\\u2551\\u2588\\u2588\\u2551\\u255a\\u2588\\u2588\\u2588\\u2588\\u2551\\u2588\\u2588\\u2551\\u2591\\u2591\\u2588\\u2588\\u2551\\n\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2554\\u255d\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2557\\u2588\\u2588\\u2551\\u2591\\u2591\\u2591\\u2591\\u2591\\u2588\\u2588\\u2551\\u2591\\u2591\\u2591\\u2591\\u255a\\u2588\\u2588\\u2554\\u255d\\u2591\\u255a\\u2588\\u2588\\u2554\\u255d\\u2591\\u255a\\u2588\\u2588\\u2588\\u2588\\u2588\\u2554\\u255d\\u2588\\u2588\\u2551\\u2591\\u255a\\u2588\\u2588\\u2588\\u2551\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2554\\u255d\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2557\\u2588\\u2588\\u2551\\u2591\\u2591\\u2588\\u2588\\u2551\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2557\\u2588\\u2588\\u2551\\u2591\\u2591\\u2588\\u2588\\u2551\\u2588\\u2588\\u2551\\u2591\\u255a\\u2588\\u2588\\u2588\\u2551\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2554\\u255d\\n\\u255a\\u2550\\u2550\\u2550\\u2550\\u2550\\u255d\\u2591\\u255a\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u255d\\u255a\\u2550\\u255d\\u2591\\u2591\\u2591\\u2591\\u2591\\u255a\\u2550\\u255d\\u2591\\u2591\\u2591\\u2591\\u2591\\u255a\\u2550\\u255d\\u2591\\u2591\\u2591\\u255a\\u2550\\u255d\\u2591\\u2591\\u2591\\u255a\\u2550\\u2550\\u2550\\u2550\\u255d\\u2591\\u255a\\u2550\\u255d\\u2591\\u2591\\u255a\\u2550\\u2550\\u255d\\u255a\\u2550\\u2550\\u2550\\u2550\\u2550\\u255d\\u2591\\u255a\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u255d\\u255a\\u2550\\u255d\\u2591\\u2591\\u255a\\u2550\\u255d\\u255a\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u255d\\u255a\\u2550\\u255d\\u2591\\u2591\\u255a\\u2550\\u255d\\u255a\\u2550\\u255d\\u2591\\u2591\\u255a\\u2550\\u2550\\u255d\\u255a\\u2550\\u2550\\u2550\\u2550\\u2550\\u255d\\u2591\\n\\nhttps://defi.sucks\\n\\n*/\\n\\npragma solidity >=0.8.4 <0.9.0;\\n\\nimport '../interfaces/IKeep3r.sol';\\nimport './peripherals/jobs/Keep3rJobs.sol';\\nimport './peripherals/keepers/Keep3rKeepers.sol';\\nimport './peripherals/DustCollector.sol';\\n\\ncontract Keep3r is IKeep3r, Keep3rJobs, Keep3rKeepers {\\n constructor(\\n address _governance,\\n address _keep3rHelper,\\n address _keep3rV1,\\n address _keep3rV1Proxy\\n ) Keep3rParameters(_keep3rHelper, _keep3rV1, _keep3rV1Proxy) Keep3rRoles(_governance) {}\\n}\\n\",\"keccak256\":\"0x8b7a11409585a734b97d64773753921ea64b17ea6ee45d712d0478898990a8b0\",\"license\":\"MIT\"},\"solidity/contracts/libraries/FullMath.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4 <0.9.0;\\n\\n/// @title Contains 512-bit math functions\\n/// @notice Facilitates multiplication and division that can have overflow of an intermediate value without any loss of precision\\n/// @dev Handles \\\"phantom overflow\\\" i.e., allows multiplication and division where an intermediate value overflows 256 bits\\nlibrary FullMath {\\n /// @notice Calculates floor(a\\u00d7b\\u00f7denominator) with full precision. Throws if result overflows a uint256 or denominator == 0\\n /// @param a The multiplicand\\n /// @param b The multiplier\\n /// @param denominator The divisor\\n /// @return result The 256-bit result\\n /// @dev Credit to Remco Bloemen under MIT license https://xn--2-umb.com/21/muldiv\\n function mulDiv(\\n uint256 a,\\n uint256 b,\\n uint256 denominator\\n ) internal pure returns (uint256 result) {\\n unchecked {\\n // 512-bit multiply [prod1 prod0] = a * b\\n // Compute the product mod 2**256 and mod 2**256 - 1\\n // then use the Chinese Remainder Theorem to reconstruct\\n // the 512 bit result. The result is stored in two 256\\n // variables such that product = prod1 * 2**256 + prod0\\n uint256 prod0; // Least significant 256 bits of the product\\n uint256 prod1; // Most significant 256 bits of the product\\n assembly {\\n let mm := mulmod(a, b, not(0))\\n prod0 := mul(a, b)\\n prod1 := sub(sub(mm, prod0), lt(mm, prod0))\\n }\\n\\n // Handle non-overflow cases, 256 by 256 division\\n if (prod1 == 0) {\\n require(denominator > 0);\\n assembly {\\n result := div(prod0, denominator)\\n }\\n return result;\\n }\\n\\n // Make sure the result is less than 2**256.\\n // Also prevents denominator == 0\\n require(denominator > prod1);\\n\\n ///////////////////////////////////////////////\\n // 512 by 256 division.\\n ///////////////////////////////////////////////\\n\\n // Make division exact by subtracting the remainder from [prod1 prod0]\\n // Compute remainder using mulmod\\n uint256 remainder;\\n assembly {\\n remainder := mulmod(a, b, denominator)\\n }\\n // Subtract 256 bit number from 512 bit number\\n assembly {\\n prod1 := sub(prod1, gt(remainder, prod0))\\n prod0 := sub(prod0, remainder)\\n }\\n\\n // Factor powers of two out of denominator\\n // Compute largest power of two divisor of denominator.\\n // Always >= 1.\\n uint256 twos = (~denominator + 1) & denominator;\\n // Divide denominator by power of two\\n assembly {\\n denominator := div(denominator, twos)\\n }\\n\\n // Divide [prod1 prod0] by the factors of two\\n assembly {\\n prod0 := div(prod0, twos)\\n }\\n // Shift in bits from prod1 into prod0. For this we need\\n // to flip `twos` such that it is 2**256 / twos.\\n // If twos is zero, then it becomes one\\n assembly {\\n twos := add(div(sub(0, twos), twos), 1)\\n }\\n prod0 |= prod1 * twos;\\n\\n // Invert denominator mod 2**256\\n // Now that denominator is an odd number, it has an inverse\\n // modulo 2**256 such that denominator * inv = 1 mod 2**256.\\n // Compute the inverse by starting with a seed that is correct\\n // correct for four bits. That is, denominator * inv = 1 mod 2**4\\n uint256 inv = (3 * denominator) ^ 2;\\n // Now use Newton-Raphson iteration to improve the precision.\\n // Thanks to Hensel's lifting lemma, this also works in modular\\n // arithmetic, doubling the correct bits in each step.\\n inv *= 2 - denominator * inv; // inverse mod 2**8\\n inv *= 2 - denominator * inv; // inverse mod 2**16\\n inv *= 2 - denominator * inv; // inverse mod 2**32\\n inv *= 2 - denominator * inv; // inverse mod 2**64\\n inv *= 2 - denominator * inv; // inverse mod 2**128\\n inv *= 2 - denominator * inv; // inverse mod 2**256\\n\\n // Because the division is now exact we can divide by multiplying\\n // with the modular inverse of denominator. This will give us the\\n // correct result modulo 2**256. Since the precoditions guarantee\\n // that the outcome is less than 2**256, this is the final result.\\n // We don't need to compute the high bits of the result and prod1\\n // is no longer required.\\n result = prod0 * inv;\\n return result;\\n }\\n }\\n\\n /// @notice Calculates ceil(a\\u00d7b\\u00f7denominator) with full precision. Throws if result overflows a uint256 or denominator == 0\\n /// @param a The multiplicand\\n /// @param b The multiplier\\n /// @param denominator The divisor\\n /// @return result The 256-bit result\\n function mulDivRoundingUp(\\n uint256 a,\\n uint256 b,\\n uint256 denominator\\n ) internal pure returns (uint256 result) {\\n unchecked {\\n result = mulDiv(a, b, denominator);\\n if (mulmod(a, b, denominator) > 0) {\\n require(result < type(uint256).max);\\n result++;\\n }\\n }\\n }\\n}\\n\",\"keccak256\":\"0xe1c595da02adf8ba2ae74ac579b9b3c966d1ecb2a99c25081a62ee8550f26569\",\"license\":\"MIT\"},\"solidity/contracts/peripherals/DustCollector.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity >=0.8.4 <0.9.0;\\n\\nimport '@openzeppelin/contracts/token/ERC20/IERC20.sol';\\nimport '@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol';\\nimport '../../contracts/peripherals/Governable.sol';\\nimport '../../interfaces/peripherals/IDustCollector.sol';\\n\\nabstract contract DustCollector is IDustCollector, Governable {\\n using SafeERC20 for IERC20;\\n\\n address internal constant _ETH_ADDRESS = 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE;\\n\\n function sendDust(\\n address _token,\\n uint256 _amount,\\n address _to\\n ) external override onlyGovernance {\\n if (_to == address(0)) revert ZeroAddress();\\n if (_token == _ETH_ADDRESS) {\\n payable(_to).transfer(_amount);\\n } else {\\n IERC20(_token).safeTransfer(_to, _amount);\\n }\\n emit DustSent(_token, _amount, _to);\\n }\\n}\\n\",\"keccak256\":\"0x246ac2c4057520bb627ea8040367549786f4477a04fd79358927cd607952bc2f\",\"license\":\"MIT\"},\"solidity/contracts/peripherals/Governable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4 <0.9.0;\\n\\nimport '../../interfaces/peripherals/IGovernable.sol';\\n\\nabstract contract Governable is IGovernable {\\n /// @inheritdoc IGovernable\\n address public override governance;\\n\\n /// @inheritdoc IGovernable\\n address public override pendingGovernance;\\n\\n constructor(address _governance) {\\n if (_governance == address(0)) revert NoGovernanceZeroAddress();\\n governance = _governance;\\n }\\n\\n /// @inheritdoc IGovernable\\n function setGovernance(address _governance) external override onlyGovernance {\\n pendingGovernance = _governance;\\n emit GovernanceProposal(_governance);\\n }\\n\\n /// @inheritdoc IGovernable\\n function acceptGovernance() external override onlyPendingGovernance {\\n governance = pendingGovernance;\\n delete pendingGovernance;\\n emit GovernanceSet(governance);\\n }\\n\\n /// @notice Functions with this modifier can only be called by governance\\n modifier onlyGovernance {\\n if (msg.sender != governance) revert OnlyGovernance();\\n _;\\n }\\n\\n /// @notice Functions with this modifier can only be called by pendingGovernance\\n modifier onlyPendingGovernance {\\n if (msg.sender != pendingGovernance) revert OnlyPendingGovernance();\\n _;\\n }\\n}\\n\",\"keccak256\":\"0x5b6d7601a42d2229657a7f60021c7e2bfe890c3541ab0003f7d88e20a28d722b\",\"license\":\"MIT\"},\"solidity/contracts/peripherals/Keep3rAccountance.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4 <0.9.0;\\n\\nimport '@openzeppelin/contracts/utils/structs/EnumerableSet.sol';\\nimport '../../interfaces/peripherals/IKeep3rAccountance.sol';\\nimport './Keep3rRoles.sol';\\n\\nabstract contract Keep3rAccountance is IKeep3rAccountance, Keep3rRoles {\\n using EnumerableSet for EnumerableSet.AddressSet;\\n\\n /// @notice List of all enabled keepers\\n EnumerableSet.AddressSet internal _keepers;\\n\\n /// @inheritdoc IKeep3rAccountance\\n uint256 public override totalBonds;\\n\\n /// @inheritdoc IKeep3rAccountance\\n mapping(address => uint256) public override workCompleted;\\n\\n /// @inheritdoc IKeep3rAccountance\\n mapping(address => uint256) public override firstSeen;\\n\\n /// @inheritdoc IKeep3rAccountance\\n mapping(address => bool) public override disputes;\\n\\n /// @inheritdoc IKeep3rAccountance\\n /// @notice Mapping (job => bonding => amount)\\n mapping(address => mapping(address => uint256)) public override bonds;\\n\\n /// @inheritdoc IKeep3rAccountance\\n mapping(address => mapping(address => uint256)) public override jobTokenCredits;\\n\\n /// @notice The current liquidity credits available for a job\\n mapping(address => uint256) internal _jobLiquidityCredits;\\n\\n /// @notice Map the address of a job to its correspondent periodCredits\\n mapping(address => uint256) internal _jobPeriodCredits;\\n\\n /// @notice Enumerable array of Job Tokens for Credits\\n mapping(address => EnumerableSet.AddressSet) internal _jobTokens;\\n\\n /// @notice List of liquidities that a job has (job => liquidities)\\n mapping(address => EnumerableSet.AddressSet) internal _jobLiquidities;\\n\\n /// @notice Liquidity pool to observe\\n mapping(address => address) internal _liquidityPool;\\n\\n /// @notice Tracks if a pool has KP3R as token0\\n mapping(address => bool) internal _isKP3RToken0;\\n\\n /// @inheritdoc IKeep3rAccountance\\n mapping(address => mapping(address => uint256)) public override pendingBonds;\\n\\n /// @inheritdoc IKeep3rAccountance\\n mapping(address => mapping(address => uint256)) public override canActivateAfter;\\n\\n /// @inheritdoc IKeep3rAccountance\\n mapping(address => mapping(address => uint256)) public override canWithdrawAfter;\\n\\n /// @inheritdoc IKeep3rAccountance\\n mapping(address => mapping(address => uint256)) public override pendingUnbonds;\\n\\n /// @inheritdoc IKeep3rAccountance\\n mapping(address => bool) public override hasBonded;\\n\\n /// @notice List of all enabled jobs\\n EnumerableSet.AddressSet internal _jobs;\\n\\n /// @inheritdoc IKeep3rAccountance\\n function jobs() external view override returns (address[] memory _list) {\\n _list = _jobs.values();\\n }\\n\\n /// @inheritdoc IKeep3rAccountance\\n function keepers() external view override returns (address[] memory _list) {\\n _list = _keepers.values();\\n }\\n}\\n\",\"keccak256\":\"0xcd2a525e6567eea4f2a7f93e8eb686e484d2a078686f2744dde35a8383881730\",\"license\":\"MIT\"},\"solidity/contracts/peripherals/Keep3rDisputable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4 <0.9.0;\\n\\nimport './Keep3rParameters.sol';\\nimport '../../interfaces/peripherals/IKeep3rDisputable.sol';\\n\\nabstract contract Keep3rDisputable is IKeep3rDisputable, Keep3rParameters {\\n /// @inheritdoc IKeep3rDisputable\\n function dispute(address _jobOrKeeper) external override onlyDisputer {\\n if (disputes[_jobOrKeeper]) revert AlreadyDisputed();\\n disputes[_jobOrKeeper] = true;\\n emit Dispute(_jobOrKeeper, msg.sender);\\n }\\n\\n /// @inheritdoc IKeep3rDisputable\\n function resolve(address _jobOrKeeper) external override onlyDisputer {\\n if (!disputes[_jobOrKeeper]) revert NotDisputed();\\n disputes[_jobOrKeeper] = false;\\n emit Resolve(_jobOrKeeper, msg.sender);\\n }\\n}\\n\",\"keccak256\":\"0x664b54040aa4e734f68a01fcfb5bf67cbb1a70efd03862cd3a456457536b1fb4\",\"license\":\"MIT\"},\"solidity/contracts/peripherals/Keep3rParameters.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4 <0.9.0;\\n\\nimport '../../interfaces/IKeep3rHelper.sol';\\nimport '../../interfaces/peripherals/IKeep3rParameters.sol';\\nimport '../../interfaces/external/IKeep3rV1Proxy.sol';\\nimport './Keep3rAccountance.sol';\\n\\nabstract contract Keep3rParameters is IKeep3rParameters, Keep3rAccountance {\\n /// @inheritdoc IKeep3rParameters\\n address public override keep3rV1;\\n\\n /// @inheritdoc IKeep3rParameters\\n address public override keep3rV1Proxy;\\n\\n /// @inheritdoc IKeep3rParameters\\n address public override keep3rHelper;\\n\\n /// @inheritdoc IKeep3rParameters\\n uint256 public override bondTime = 3 days;\\n\\n /// @inheritdoc IKeep3rParameters\\n uint256 public override unbondTime = 14 days;\\n\\n /// @inheritdoc IKeep3rParameters\\n uint256 public override liquidityMinimum = 3 ether;\\n\\n /// @inheritdoc IKeep3rParameters\\n uint256 public override rewardPeriodTime = 5 days;\\n\\n /// @inheritdoc IKeep3rParameters\\n uint256 public override inflationPeriod = 34 days;\\n\\n /// @inheritdoc IKeep3rParameters\\n uint256 public override fee = 30;\\n\\n /// @notice The base that will be used to calculate the fee\\n uint256 internal constant _BASE = 10_000;\\n\\n /// @notice The minimum reward period\\n uint256 internal constant _MIN_REWARD_PERIOD_TIME = 1 days;\\n\\n constructor(\\n address _keep3rHelper,\\n address _keep3rV1,\\n address _keep3rV1Proxy\\n ) {\\n keep3rHelper = _keep3rHelper;\\n keep3rV1 = _keep3rV1;\\n keep3rV1Proxy = _keep3rV1Proxy;\\n }\\n\\n /// @inheritdoc IKeep3rParameters\\n function setKeep3rHelper(address _keep3rHelper) external override onlyGovernance {\\n if (_keep3rHelper == address(0)) revert ZeroAddress();\\n keep3rHelper = _keep3rHelper;\\n emit Keep3rHelperChange(_keep3rHelper);\\n }\\n\\n /// @inheritdoc IKeep3rParameters\\n function setKeep3rV1(address _keep3rV1) public virtual override onlyGovernance {\\n if (_keep3rV1 == address(0)) revert ZeroAddress();\\n _mint(totalBonds);\\n\\n keep3rV1 = _keep3rV1;\\n emit Keep3rV1Change(_keep3rV1);\\n }\\n\\n /// @inheritdoc IKeep3rParameters\\n function setKeep3rV1Proxy(address _keep3rV1Proxy) external override onlyGovernance {\\n if (_keep3rV1Proxy == address(0)) revert ZeroAddress();\\n keep3rV1Proxy = _keep3rV1Proxy;\\n emit Keep3rV1ProxyChange(_keep3rV1Proxy);\\n }\\n\\n /// @inheritdoc IKeep3rParameters\\n function setBondTime(uint256 _bondTime) external override onlyGovernance {\\n bondTime = _bondTime;\\n emit BondTimeChange(_bondTime);\\n }\\n\\n /// @inheritdoc IKeep3rParameters\\n function setUnbondTime(uint256 _unbondTime) external override onlyGovernance {\\n unbondTime = _unbondTime;\\n emit UnbondTimeChange(_unbondTime);\\n }\\n\\n /// @inheritdoc IKeep3rParameters\\n function setLiquidityMinimum(uint256 _liquidityMinimum) external override onlyGovernance {\\n liquidityMinimum = _liquidityMinimum;\\n emit LiquidityMinimumChange(_liquidityMinimum);\\n }\\n\\n /// @inheritdoc IKeep3rParameters\\n function setRewardPeriodTime(uint256 _rewardPeriodTime) external override onlyGovernance {\\n if (_rewardPeriodTime < _MIN_REWARD_PERIOD_TIME) revert MinRewardPeriod();\\n rewardPeriodTime = _rewardPeriodTime;\\n emit RewardPeriodTimeChange(_rewardPeriodTime);\\n }\\n\\n /// @inheritdoc IKeep3rParameters\\n function setInflationPeriod(uint256 _inflationPeriod) external override onlyGovernance {\\n inflationPeriod = _inflationPeriod;\\n emit InflationPeriodChange(_inflationPeriod);\\n }\\n\\n /// @inheritdoc IKeep3rParameters\\n function setFee(uint256 _fee) external override onlyGovernance {\\n fee = _fee;\\n emit FeeChange(_fee);\\n }\\n\\n function _mint(uint256 _amount) internal {\\n totalBonds -= _amount;\\n IKeep3rV1Proxy(keep3rV1Proxy).mint(_amount);\\n }\\n}\\n\",\"keccak256\":\"0x180349c0ff1fffec1566fba13b494595dcc5ca7eaf049d3f7a2a8d1c60de7d0f\",\"license\":\"MIT\"},\"solidity/contracts/peripherals/Keep3rRoles.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4 <0.9.0;\\n\\nimport '../../interfaces/peripherals/IKeep3rRoles.sol';\\nimport '@openzeppelin/contracts/utils/structs/EnumerableSet.sol';\\nimport './DustCollector.sol';\\nimport './Governable.sol';\\n\\ncontract Keep3rRoles is IKeep3rRoles, Governable, DustCollector {\\n /// @inheritdoc IKeep3rRoles\\n mapping(address => bool) public override slashers;\\n\\n /// @inheritdoc IKeep3rRoles\\n mapping(address => bool) public override disputers;\\n\\n constructor(address _governance) Governable(_governance) DustCollector() {}\\n\\n /// @inheritdoc IKeep3rRoles\\n function addSlasher(address _slasher) external override onlyGovernance {\\n if (_slasher == address(0)) revert ZeroAddress();\\n if (slashers[_slasher]) revert SlasherExistent();\\n slashers[_slasher] = true;\\n emit SlasherAdded(_slasher);\\n }\\n\\n /// @inheritdoc IKeep3rRoles\\n function removeSlasher(address _slasher) external override onlyGovernance {\\n if (!slashers[_slasher]) revert SlasherUnexistent();\\n delete slashers[_slasher];\\n emit SlasherRemoved(_slasher);\\n }\\n\\n /// @inheritdoc IKeep3rRoles\\n function addDisputer(address _disputer) external override onlyGovernance {\\n if (_disputer == address(0)) revert ZeroAddress();\\n if (disputers[_disputer]) revert DisputerExistent();\\n disputers[_disputer] = true;\\n emit DisputerAdded(_disputer);\\n }\\n\\n /// @inheritdoc IKeep3rRoles\\n function removeDisputer(address _disputer) external override onlyGovernance {\\n if (!disputers[_disputer]) revert DisputerUnexistent();\\n delete disputers[_disputer];\\n emit DisputerRemoved(_disputer);\\n }\\n\\n /// @notice Functions with this modifier can only be called by either a slasher or governance\\n modifier onlySlasher {\\n if (!slashers[msg.sender]) revert OnlySlasher();\\n _;\\n }\\n\\n /// @notice Functions with this modifier can only be called by either a disputer or governance\\n modifier onlyDisputer {\\n if (!disputers[msg.sender]) revert OnlyDisputer();\\n _;\\n }\\n}\\n\",\"keccak256\":\"0x61a1cf0d52db8fe78fa8cfb76d9b02f93ef3adc23e6655969bc1a4bb83ea9a95\",\"license\":\"MIT\"},\"solidity/contracts/peripherals/jobs/Keep3rJobDisputable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4 <0.9.0;\\n\\nimport './Keep3rJobFundableCredits.sol';\\nimport './Keep3rJobFundableLiquidity.sol';\\nimport '../Keep3rDisputable.sol';\\n\\nabstract contract Keep3rJobDisputable is IKeep3rJobDisputable, Keep3rDisputable, Keep3rJobFundableCredits, Keep3rJobFundableLiquidity {\\n using EnumerableSet for EnumerableSet.AddressSet;\\n using SafeERC20 for IERC20;\\n\\n /// @inheritdoc IKeep3rJobDisputable\\n function slashTokenFromJob(\\n address _job,\\n address _token,\\n uint256 _amount\\n ) external override onlySlasher {\\n if (!disputes[_job]) revert NotDisputed();\\n if (!_jobTokens[_job].contains(_token)) revert JobTokenUnexistent();\\n if (jobTokenCredits[_job][_token] < _amount) revert JobTokenInsufficient();\\n\\n try IERC20(_token).transfer(governance, _amount) {} catch {}\\n jobTokenCredits[_job][_token] -= _amount;\\n if (jobTokenCredits[_job][_token] == 0) {\\n _jobTokens[_job].remove(_token);\\n }\\n\\n emit JobSlashToken(_job, _token, msg.sender, _amount);\\n }\\n\\n /// @inheritdoc IKeep3rJobDisputable\\n function slashLiquidityFromJob(\\n address _job,\\n address _liquidity,\\n uint256 _amount\\n ) external override onlySlasher {\\n if (!disputes[_job]) revert NotDisputed();\\n\\n _unbondLiquidityFromJob(_job, _liquidity, _amount);\\n try IERC20(_liquidity).transfer(governance, _amount) {} catch {}\\n emit JobSlashLiquidity(_job, _liquidity, msg.sender, _amount);\\n }\\n}\\n\",\"keccak256\":\"0x86cdbf44dfa46c6b6e184e48e11cb8571e26cf50c793b6b07227c29e743da397\",\"license\":\"MIT\"},\"solidity/contracts/peripherals/jobs/Keep3rJobFundableCredits.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4 <0.9.0;\\n\\nimport './Keep3rJobOwnership.sol';\\nimport '../Keep3rAccountance.sol';\\nimport '../Keep3rParameters.sol';\\nimport '../../../interfaces/peripherals/IKeep3rJobs.sol';\\n\\nimport '@openzeppelin/contracts/security/ReentrancyGuard.sol';\\nimport '@openzeppelin/contracts/token/ERC20/IERC20.sol';\\nimport '@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol';\\nimport '@openzeppelin/contracts/utils/math/Math.sol';\\n\\nabstract contract Keep3rJobFundableCredits is IKeep3rJobFundableCredits, ReentrancyGuard, Keep3rJobOwnership, Keep3rParameters {\\n using EnumerableSet for EnumerableSet.AddressSet;\\n using SafeERC20 for IERC20;\\n\\n /// @notice Cooldown between withdrawals\\n uint256 internal constant _WITHDRAW_TOKENS_COOLDOWN = 1 minutes;\\n\\n /// @inheritdoc IKeep3rJobFundableCredits\\n mapping(address => mapping(address => uint256)) public override jobTokenCreditsAddedAt;\\n\\n /// @inheritdoc IKeep3rJobFundableCredits\\n function addTokenCreditsToJob(\\n address _job,\\n address _token,\\n uint256 _amount\\n ) external override nonReentrant {\\n if (!_jobs.contains(_job)) revert JobUnavailable();\\n // KP3R shouldn't be used for direct token payments\\n if (_token == keep3rV1) revert TokenUnallowed();\\n uint256 _before = IERC20(_token).balanceOf(address(this));\\n IERC20(_token).safeTransferFrom(msg.sender, address(this), _amount);\\n uint256 _received = IERC20(_token).balanceOf(address(this)) - _before;\\n uint256 _tokenFee = (_received * fee) / _BASE;\\n jobTokenCredits[_job][_token] += _received - _tokenFee;\\n jobTokenCreditsAddedAt[_job][_token] = block.timestamp;\\n IERC20(_token).safeTransfer(governance, _tokenFee);\\n _jobTokens[_job].add(_token);\\n\\n emit TokenCreditAddition(_job, _token, msg.sender, _received);\\n }\\n\\n /// @inheritdoc IKeep3rJobFundableCredits\\n function withdrawTokenCreditsFromJob(\\n address _job,\\n address _token,\\n uint256 _amount,\\n address _receiver\\n ) external override nonReentrant onlyJobOwner(_job) {\\n if (block.timestamp <= jobTokenCreditsAddedAt[_job][_token] + _WITHDRAW_TOKENS_COOLDOWN) revert JobTokenCreditsLocked();\\n if (jobTokenCredits[_job][_token] < _amount) revert InsufficientJobTokenCredits();\\n if (disputes[_job]) revert JobDisputed();\\n\\n jobTokenCredits[_job][_token] -= _amount;\\n IERC20(_token).safeTransfer(_receiver, _amount);\\n\\n if (jobTokenCredits[_job][_token] == 0) {\\n _jobTokens[_job].remove(_token);\\n }\\n\\n emit TokenCreditWithdrawal(_job, _token, _receiver, _amount);\\n }\\n}\\n\",\"keccak256\":\"0xb600d18903a008a1ca03743de7cef8330c2d5e66db52c900822551a4be75f7a5\",\"license\":\"MIT\"},\"solidity/contracts/peripherals/jobs/Keep3rJobFundableLiquidity.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4 <0.9.0;\\n\\nimport './Keep3rJobOwnership.sol';\\nimport '../Keep3rAccountance.sol';\\nimport '../Keep3rParameters.sol';\\nimport '../../../interfaces/IPairManager.sol';\\nimport '../../../interfaces/peripherals/IKeep3rJobs.sol';\\n\\nimport '../../libraries/FullMath.sol';\\n\\nimport '@openzeppelin/contracts/security/ReentrancyGuard.sol';\\nimport '@openzeppelin/contracts/token/ERC20/IERC20.sol';\\nimport '@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol';\\nimport '@openzeppelin/contracts/utils/math/Math.sol';\\n\\nabstract contract Keep3rJobFundableLiquidity is IKeep3rJobFundableLiquidity, ReentrancyGuard, Keep3rJobOwnership, Keep3rParameters {\\n using EnumerableSet for EnumerableSet.AddressSet;\\n using SafeERC20 for IERC20;\\n\\n /// @notice List of liquidities that are accepted in the system\\n EnumerableSet.AddressSet internal _approvedLiquidities;\\n\\n /// @inheritdoc IKeep3rJobFundableLiquidity\\n mapping(address => mapping(address => uint256)) public override liquidityAmount;\\n\\n /// @inheritdoc IKeep3rJobFundableLiquidity\\n mapping(address => uint256) public override rewardedAt;\\n\\n /// @inheritdoc IKeep3rJobFundableLiquidity\\n mapping(address => uint256) public override workedAt;\\n\\n /// @notice Tracks an address and returns its TickCache\\n mapping(address => TickCache) internal _tick;\\n\\n // Views\\n\\n /// @inheritdoc IKeep3rJobFundableLiquidity\\n function approvedLiquidities() external view override returns (address[] memory _list) {\\n _list = _approvedLiquidities.values();\\n }\\n\\n /// @inheritdoc IKeep3rJobFundableLiquidity\\n function jobPeriodCredits(address _job) public view override returns (uint256 _periodCredits) {\\n for (uint256 i; i < _jobLiquidities[_job].length(); i++) {\\n address _liquidity = _jobLiquidities[_job].at(i);\\n if (_approvedLiquidities.contains(_liquidity)) {\\n TickCache memory _tickCache = observeLiquidity(_liquidity);\\n if (_tickCache.period != 0) {\\n int56 _tickDifference = _isKP3RToken0[_liquidity] ? _tickCache.difference : -_tickCache.difference;\\n _periodCredits += _getReward(\\n IKeep3rHelper(keep3rHelper).getKP3RsAtTick(liquidityAmount[_job][_liquidity], _tickDifference, rewardPeriodTime)\\n );\\n }\\n }\\n }\\n }\\n\\n /// @inheritdoc IKeep3rJobFundableLiquidity\\n function jobLiquidityCredits(address _job) public view override returns (uint256 _liquidityCredits) {\\n uint256 _periodCredits = jobPeriodCredits(_job);\\n\\n // If the job was rewarded in the past 1 period time\\n if ((block.timestamp - rewardedAt[_job]) < rewardPeriodTime) {\\n // If the job has period credits, update minted job credits to new twap\\n _liquidityCredits = _periodCredits > 0\\n ? (_jobLiquidityCredits[_job] * _periodCredits) / _jobPeriodCredits[_job] // If the job has period credits, return remaining job credits updated to new twap\\n : _jobLiquidityCredits[_job]; // If not, return remaining credits, forced credits should not be updated\\n } else {\\n // Else return a full period worth of credits if current credits have expired\\n _liquidityCredits = _periodCredits;\\n }\\n }\\n\\n /// @inheritdoc IKeep3rJobFundableLiquidity\\n function totalJobCredits(address _job) external view override returns (uint256 _credits) {\\n uint256 _periodCredits = jobPeriodCredits(_job);\\n uint256 _cooldown = block.timestamp;\\n\\n if ((rewardedAt[_job] > _period(block.timestamp - rewardPeriodTime))) {\\n // Will calculate cooldown if it outdated\\n if ((block.timestamp - rewardedAt[_job]) >= rewardPeriodTime) {\\n // Will calculate cooldown from last reward reference in this period\\n _cooldown -= (rewardedAt[_job] + rewardPeriodTime);\\n } else {\\n // Will calculate cooldown from last reward timestamp\\n _cooldown -= rewardedAt[_job];\\n }\\n } else {\\n // Will calculate cooldown from period start if expired\\n _cooldown -= _period(block.timestamp);\\n }\\n _credits = jobLiquidityCredits(_job) + _phase(_cooldown, _periodCredits);\\n }\\n\\n /// @inheritdoc IKeep3rJobFundableLiquidity\\n function quoteLiquidity(address _liquidity, uint256 _amount) external view override returns (uint256 _periodCredits) {\\n if (_approvedLiquidities.contains(_liquidity)) {\\n TickCache memory _tickCache = observeLiquidity(_liquidity);\\n if (_tickCache.period != 0) {\\n int56 _tickDifference = _isKP3RToken0[_liquidity] ? _tickCache.difference : -_tickCache.difference;\\n return _getReward(IKeep3rHelper(keep3rHelper).getKP3RsAtTick(_amount, _tickDifference, rewardPeriodTime));\\n }\\n }\\n }\\n\\n /// @inheritdoc IKeep3rJobFundableLiquidity\\n function observeLiquidity(address _liquidity) public view virtual override returns (TickCache memory _tickCache) {\\n if (_tick[_liquidity].period == _period(block.timestamp)) {\\n // Will return cached twaps if liquidity is updated\\n _tickCache = _tick[_liquidity];\\n } else {\\n bool success;\\n uint256 lastPeriod = _period(block.timestamp - rewardPeriodTime);\\n\\n if (_tick[_liquidity].period == lastPeriod) {\\n // Will only ask for current period accumulator if liquidity is outdated\\n uint32[] memory _secondsAgo = new uint32[](1);\\n int56 previousTick = _tick[_liquidity].current;\\n\\n _secondsAgo[0] = uint32(block.timestamp - _period(block.timestamp));\\n\\n (_tickCache.current, , success) = IKeep3rHelper(keep3rHelper).observe(_liquidityPool[_liquidity], _secondsAgo);\\n\\n _tickCache.difference = _tickCache.current - previousTick;\\n } else if (_tick[_liquidity].period < lastPeriod) {\\n // Will ask for 2 accumulators if liquidity is expired\\n uint32[] memory _secondsAgo = new uint32[](2);\\n\\n _secondsAgo[0] = uint32(block.timestamp - _period(block.timestamp));\\n _secondsAgo[1] = uint32(block.timestamp - _period(block.timestamp) + rewardPeriodTime);\\n\\n int56 _tickCumulative2;\\n (_tickCache.current, _tickCumulative2, success) = IKeep3rHelper(keep3rHelper).observe(_liquidityPool[_liquidity], _secondsAgo);\\n\\n _tickCache.difference = _tickCache.current - _tickCumulative2;\\n }\\n if (success) {\\n _tickCache.period = _period(block.timestamp);\\n } else {\\n delete _tickCache.period;\\n }\\n }\\n }\\n\\n // Methods\\n\\n /// @inheritdoc IKeep3rJobFundableLiquidity\\n function forceLiquidityCreditsToJob(address _job, uint256 _amount) external override onlyGovernance {\\n if (!_jobs.contains(_job)) revert JobUnavailable();\\n _settleJobAccountance(_job);\\n _jobLiquidityCredits[_job] += _amount;\\n emit LiquidityCreditsForced(_job, rewardedAt[_job], _jobLiquidityCredits[_job]);\\n }\\n\\n /// @inheritdoc IKeep3rJobFundableLiquidity\\n function approveLiquidity(address _liquidity) external virtual override onlyGovernance {\\n if (!_approvedLiquidities.add(_liquidity)) revert LiquidityPairApproved();\\n _liquidityPool[_liquidity] = IPairManager(_liquidity).pool();\\n _isKP3RToken0[_liquidity] = IKeep3rHelper(keep3rHelper).isKP3RToken0(_liquidityPool[_liquidity]);\\n _tick[_liquidity] = observeLiquidity(_liquidity);\\n emit LiquidityApproval(_liquidity);\\n }\\n\\n /// @inheritdoc IKeep3rJobFundableLiquidity\\n function revokeLiquidity(address _liquidity) external override onlyGovernance {\\n if (!_approvedLiquidities.remove(_liquidity)) revert LiquidityPairUnexistent();\\n delete _liquidityPool[_liquidity];\\n delete _isKP3RToken0[_liquidity];\\n delete _tick[_liquidity];\\n\\n emit LiquidityRevocation(_liquidity);\\n }\\n\\n /// @inheritdoc IKeep3rJobFundableLiquidity\\n function addLiquidityToJob(\\n address _job,\\n address _liquidity,\\n uint256 _amount\\n ) external override nonReentrant {\\n if (!_approvedLiquidities.contains(_liquidity)) revert LiquidityPairUnapproved();\\n if (!_jobs.contains(_job)) revert JobUnavailable();\\n\\n _jobLiquidities[_job].add(_liquidity);\\n\\n _settleJobAccountance(_job);\\n\\n if (_quoteLiquidity(liquidityAmount[_job][_liquidity] + _amount, _liquidity) < liquidityMinimum) revert JobLiquidityLessThanMin();\\n\\n emit LiquidityCreditsReward(_job, rewardedAt[_job], _jobLiquidityCredits[_job], _jobPeriodCredits[_job]);\\n\\n IERC20(_liquidity).safeTransferFrom(msg.sender, address(this), _amount);\\n liquidityAmount[_job][_liquidity] += _amount;\\n _jobPeriodCredits[_job] += _getReward(_quoteLiquidity(_amount, _liquidity));\\n emit LiquidityAddition(_job, _liquidity, msg.sender, _amount);\\n }\\n\\n /// @inheritdoc IKeep3rJobFundableLiquidity\\n function unbondLiquidityFromJob(\\n address _job,\\n address _liquidity,\\n uint256 _amount\\n ) external override onlyJobOwner(_job) {\\n canWithdrawAfter[_job][_liquidity] = block.timestamp + unbondTime;\\n pendingUnbonds[_job][_liquidity] += _amount;\\n _unbondLiquidityFromJob(_job, _liquidity, _amount);\\n\\n uint256 _remainingLiquidity = liquidityAmount[_job][_liquidity];\\n if (_remainingLiquidity > 0 && _quoteLiquidity(_remainingLiquidity, _liquidity) < liquidityMinimum) revert JobLiquidityLessThanMin();\\n\\n emit Unbonding(_job, _liquidity, _amount);\\n }\\n\\n /// @inheritdoc IKeep3rJobFundableLiquidity\\n function withdrawLiquidityFromJob(\\n address _job,\\n address _liquidity,\\n address _receiver\\n ) external override onlyJobOwner(_job) {\\n if (_receiver == address(0)) revert ZeroAddress();\\n if (pendingUnbonds[_job][_liquidity] == 0) revert UnbondsUnexistent();\\n if (canWithdrawAfter[_job][_liquidity] >= block.timestamp) revert UnbondsLocked();\\n if (disputes[_job]) revert Disputed();\\n\\n uint256 _amount = pendingUnbonds[_job][_liquidity];\\n\\n delete pendingUnbonds[_job][_liquidity];\\n delete canWithdrawAfter[_job][_liquidity];\\n\\n IERC20(_liquidity).safeTransfer(_receiver, _amount);\\n emit LiquidityWithdrawal(_job, _liquidity, _receiver, _amount);\\n }\\n\\n // Internal functions\\n\\n /// @notice Updates or rewards job liquidity credits depending on time since last job reward\\n function _updateJobCreditsIfNeeded(address _job) internal returns (bool _rewarded) {\\n if (rewardedAt[_job] < _period(block.timestamp)) {\\n // Will exit function if job has been rewarded in current period\\n if (rewardedAt[_job] <= _period(block.timestamp - rewardPeriodTime)) {\\n // Will reset job to period syncronicity if a full period passed without rewards\\n _updateJobPeriod(_job);\\n _jobLiquidityCredits[_job] = _jobPeriodCredits[_job];\\n rewardedAt[_job] = _period(block.timestamp);\\n _rewarded = true;\\n } else if ((block.timestamp - rewardedAt[_job]) >= rewardPeriodTime) {\\n // Will reset job's syncronicity if last reward was more than epoch ago\\n _updateJobPeriod(_job);\\n _jobLiquidityCredits[_job] = _jobPeriodCredits[_job];\\n rewardedAt[_job] += rewardPeriodTime;\\n _rewarded = true;\\n } else if (workedAt[_job] < _period(block.timestamp)) {\\n // First keeper on period has to update job accountance to current twaps\\n uint256 previousPeriodCredits = _jobPeriodCredits[_job];\\n _updateJobPeriod(_job);\\n _jobLiquidityCredits[_job] = (_jobLiquidityCredits[_job] * _jobPeriodCredits[_job]) / previousPeriodCredits;\\n // Updating job accountance does not reward job\\n }\\n }\\n }\\n\\n /// @notice Only called if _jobLiquidityCredits < payment\\n function _rewardJobCredits(address _job) internal {\\n /// @notice Only way to += jobLiquidityCredits is when keeper rewarding (cannot pay work)\\n /* WARNING: this allows to top up _jobLiquidityCredits to a max of 1.99 but have to spend at least 1 */\\n _jobLiquidityCredits[_job] += _phase(block.timestamp - rewardedAt[_job], _jobPeriodCredits[_job]);\\n rewardedAt[_job] = block.timestamp;\\n }\\n\\n /// @notice Updates accountance for _jobPeriodCredits\\n function _updateJobPeriod(address _job) internal {\\n _jobPeriodCredits[_job] = _calculateJobPeriodCredits(_job);\\n }\\n\\n /// @notice Quotes the outdated job liquidities and calculates _periodCredits\\n /// @dev This function is also responsible for keeping the KP3R/WETH quote updated\\n function _calculateJobPeriodCredits(address _job) internal returns (uint256 _periodCredits) {\\n for (uint256 i; i < _jobLiquidities[_job].length(); i++) {\\n address _liquidity = _jobLiquidities[_job].at(i);\\n if (_approvedLiquidities.contains(_liquidity)) {\\n if (_tick[_liquidity].period != _period(block.timestamp)) {\\n // Updates liquidity cache only if needed\\n _tick[_liquidity] = observeLiquidity(_liquidity);\\n }\\n _periodCredits += _getReward(_quoteLiquidity(liquidityAmount[_job][_liquidity], _liquidity));\\n }\\n }\\n }\\n\\n /// @notice Updates job accountance calculating the impact of the unbonded liquidity amount\\n function _unbondLiquidityFromJob(\\n address _job,\\n address _liquidity,\\n uint256 _amount\\n ) internal nonReentrant {\\n if (!_jobLiquidities[_job].contains(_liquidity)) revert JobLiquidityUnexistent();\\n if (liquidityAmount[_job][_liquidity] < _amount) revert JobLiquidityInsufficient();\\n\\n // Ensures current twaps in job liquidities\\n _updateJobPeriod(_job);\\n uint256 _periodCreditsToRemove = _getReward(_quoteLiquidity(_amount, _liquidity));\\n\\n // A liquidity can be revoked causing a job to have 0 periodCredits\\n if (_jobPeriodCredits[_job] > 0) {\\n // Removes a % correspondant to a full rewardPeriodTime for the liquidity withdrawn vs all of the liquidities\\n _jobLiquidityCredits[_job] -= (_jobLiquidityCredits[_job] * _periodCreditsToRemove) / _jobPeriodCredits[_job];\\n _jobPeriodCredits[_job] -= _periodCreditsToRemove;\\n }\\n\\n liquidityAmount[_job][_liquidity] -= _amount;\\n if (liquidityAmount[_job][_liquidity] == 0) {\\n _jobLiquidities[_job].remove(_liquidity);\\n }\\n }\\n\\n /// @notice Returns a fraction of the multiplier or the whole multiplier if equal or more than a rewardPeriodTime has passed\\n function _phase(uint256 _timePassed, uint256 _multiplier) internal view returns (uint256 _result) {\\n if (_timePassed < rewardPeriodTime) {\\n _result = (_timePassed * _multiplier) / rewardPeriodTime;\\n } else _result = _multiplier;\\n }\\n\\n /// @notice Returns the start of the period of the provided timestamp\\n function _period(uint256 _timestamp) internal view returns (uint256 _periodTimestamp) {\\n return _timestamp - (_timestamp % rewardPeriodTime);\\n }\\n\\n /// @notice Calculates relation between rewardPeriod and inflationPeriod\\n function _getReward(uint256 _baseAmount) internal view returns (uint256 _credits) {\\n return FullMath.mulDiv(_baseAmount, rewardPeriodTime, inflationPeriod);\\n }\\n\\n /// @notice Returns underlying KP3R amount for a given liquidity amount\\n function _quoteLiquidity(uint256 _amount, address _liquidity) internal view returns (uint256 _quote) {\\n if (_tick[_liquidity].period != 0) {\\n int56 _tickDifference = _isKP3RToken0[_liquidity] ? _tick[_liquidity].difference : -_tick[_liquidity].difference;\\n _quote = IKeep3rHelper(keep3rHelper).getKP3RsAtTick(_amount, _tickDifference, rewardPeriodTime);\\n }\\n }\\n\\n /// @notice Updates job credits to current quotes and rewards job's pending minted credits\\n /// @dev Ensures a maximum of 1 period of credits\\n function _settleJobAccountance(address _job) internal virtual {\\n _updateJobCreditsIfNeeded(_job);\\n _rewardJobCredits(_job);\\n _jobLiquidityCredits[_job] = Math.min(_jobLiquidityCredits[_job], _jobPeriodCredits[_job]);\\n }\\n}\\n\",\"keccak256\":\"0xe3b244460364baf1ea293db6f6feba8365fd376320ad77ae6d6813ed65b52929\",\"license\":\"MIT\"},\"solidity/contracts/peripherals/jobs/Keep3rJobManager.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4 <0.9.0;\\n\\nimport './Keep3rJobOwnership.sol';\\nimport '../Keep3rAccountance.sol';\\nimport '../../../interfaces/peripherals/IKeep3rJobs.sol';\\n\\nabstract contract Keep3rJobManager is IKeep3rJobManager, Keep3rJobOwnership, Keep3rAccountance {\\n using EnumerableSet for EnumerableSet.AddressSet;\\n\\n /// @inheritdoc IKeep3rJobManager\\n function addJob(address _job) external override {\\n if (_jobs.contains(_job)) revert JobAlreadyAdded();\\n if (hasBonded[_job]) revert AlreadyAKeeper();\\n _jobs.add(_job);\\n jobOwner[_job] = msg.sender;\\n emit JobAddition(_job, msg.sender);\\n }\\n}\\n\",\"keccak256\":\"0xf6e1577a6a34b674ca34a6d7530dc81349e3ad13d321281c37e0b25b7325d013\",\"license\":\"MIT\"},\"solidity/contracts/peripherals/jobs/Keep3rJobMigration.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4 <0.9.0;\\n\\nimport '../../../interfaces/peripherals/IKeep3rJobs.sol';\\nimport './Keep3rJobFundableCredits.sol';\\nimport './Keep3rJobFundableLiquidity.sol';\\n\\nabstract contract Keep3rJobMigration is IKeep3rJobMigration, Keep3rJobFundableCredits, Keep3rJobFundableLiquidity {\\n using EnumerableSet for EnumerableSet.AddressSet;\\n\\n uint256 internal constant _MIGRATION_COOLDOWN = 1 minutes;\\n\\n /// @inheritdoc IKeep3rJobMigration\\n mapping(address => address) public override pendingJobMigrations;\\n mapping(address => mapping(address => uint256)) internal _migrationCreatedAt;\\n\\n /// @inheritdoc IKeep3rJobMigration\\n function migrateJob(address _fromJob, address _toJob) external override onlyJobOwner(_fromJob) {\\n if (_fromJob == _toJob) revert JobMigrationImpossible();\\n\\n pendingJobMigrations[_fromJob] = _toJob;\\n _migrationCreatedAt[_fromJob][_toJob] = block.timestamp;\\n\\n emit JobMigrationRequested(_fromJob, _toJob);\\n }\\n\\n /// @inheritdoc IKeep3rJobMigration\\n function acceptJobMigration(address _fromJob, address _toJob) external override onlyJobOwner(_toJob) {\\n if (disputes[_fromJob] || disputes[_toJob]) revert JobDisputed();\\n if (pendingJobMigrations[_fromJob] != _toJob) revert JobMigrationUnavailable();\\n if (block.timestamp < _migrationCreatedAt[_fromJob][_toJob] + _MIGRATION_COOLDOWN) revert JobMigrationLocked();\\n\\n // force job credits update for both jobs\\n _settleJobAccountance(_fromJob);\\n _settleJobAccountance(_toJob);\\n\\n // migrate tokens\\n while (_jobTokens[_fromJob].length() > 0) {\\n address _tokenToMigrate = _jobTokens[_fromJob].at(0);\\n jobTokenCredits[_toJob][_tokenToMigrate] += jobTokenCredits[_fromJob][_tokenToMigrate];\\n delete jobTokenCredits[_fromJob][_tokenToMigrate];\\n _jobTokens[_fromJob].remove(_tokenToMigrate);\\n _jobTokens[_toJob].add(_tokenToMigrate);\\n }\\n\\n // migrate liquidities\\n while (_jobLiquidities[_fromJob].length() > 0) {\\n address _liquidity = _jobLiquidities[_fromJob].at(0);\\n\\n liquidityAmount[_toJob][_liquidity] += liquidityAmount[_fromJob][_liquidity];\\n delete liquidityAmount[_fromJob][_liquidity];\\n\\n _jobLiquidities[_toJob].add(_liquidity);\\n _jobLiquidities[_fromJob].remove(_liquidity);\\n }\\n\\n // migrate job balances\\n _jobPeriodCredits[_toJob] += _jobPeriodCredits[_fromJob];\\n delete _jobPeriodCredits[_fromJob];\\n\\n _jobLiquidityCredits[_toJob] += _jobLiquidityCredits[_fromJob];\\n delete _jobLiquidityCredits[_fromJob];\\n\\n // stop _fromJob from being a job\\n delete rewardedAt[_fromJob];\\n _jobs.remove(_fromJob);\\n\\n // delete unused data slots\\n delete jobOwner[_fromJob];\\n delete jobPendingOwner[_fromJob];\\n delete _migrationCreatedAt[_fromJob][_toJob];\\n delete pendingJobMigrations[_fromJob];\\n\\n emit JobMigrationSuccessful(_fromJob, _toJob);\\n }\\n}\\n\",\"keccak256\":\"0xd46c3c9ce970098d8d75f11966894a341824aceb40583fcfbbc0ebda93d869f9\",\"license\":\"MIT\"},\"solidity/contracts/peripherals/jobs/Keep3rJobOwnership.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4 <0.9.0;\\n\\nimport '../../../interfaces/peripherals/IKeep3rJobs.sol';\\n\\nabstract contract Keep3rJobOwnership is IKeep3rJobOwnership {\\n /// @inheritdoc IKeep3rJobOwnership\\n mapping(address => address) public override jobOwner;\\n\\n /// @inheritdoc IKeep3rJobOwnership\\n mapping(address => address) public override jobPendingOwner;\\n\\n /// @inheritdoc IKeep3rJobOwnership\\n function changeJobOwnership(address _job, address _newOwner) external override onlyJobOwner(_job) {\\n jobPendingOwner[_job] = _newOwner;\\n emit JobOwnershipChange(_job, jobOwner[_job], _newOwner);\\n }\\n\\n /// @inheritdoc IKeep3rJobOwnership\\n function acceptJobOwnership(address _job) external override onlyPendingJobOwner(_job) {\\n address _previousOwner = jobOwner[_job];\\n\\n jobOwner[_job] = jobPendingOwner[_job];\\n delete jobPendingOwner[_job];\\n\\n emit JobOwnershipAssent(msg.sender, _job, _previousOwner);\\n }\\n\\n modifier onlyJobOwner(address _job) {\\n if (msg.sender != jobOwner[_job]) revert OnlyJobOwner();\\n _;\\n }\\n\\n modifier onlyPendingJobOwner(address _job) {\\n if (msg.sender != jobPendingOwner[_job]) revert OnlyPendingJobOwner();\\n _;\\n }\\n}\\n\",\"keccak256\":\"0xa837590ade9cd5d25690e3f2d8b9a63e7202f7179b32e42eab4fa4c4324b9728\",\"license\":\"MIT\"},\"solidity/contracts/peripherals/jobs/Keep3rJobWorkable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4 <0.9.0;\\n\\nimport './Keep3rJobMigration.sol';\\nimport '../../../interfaces/IKeep3rHelper.sol';\\nimport '../../../interfaces/peripherals/IKeep3rJobs.sol';\\n\\nimport '@openzeppelin/contracts/token/ERC20/IERC20.sol';\\nimport '@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol';\\n\\nabstract contract Keep3rJobWorkable is IKeep3rJobWorkable, Keep3rJobMigration {\\n using EnumerableSet for EnumerableSet.AddressSet;\\n using SafeERC20 for IERC20;\\n\\n uint256 internal _initialGas;\\n\\n /// @inheritdoc IKeep3rJobWorkable\\n function isKeeper(address _keeper) external override returns (bool _isKeeper) {\\n _initialGas = _getGasLeft();\\n if (_keepers.contains(_keeper)) {\\n emit KeeperValidation(_initialGas);\\n return true;\\n }\\n }\\n\\n /// @inheritdoc IKeep3rJobWorkable\\n function isBondedKeeper(\\n address _keeper,\\n address _bond,\\n uint256 _minBond,\\n uint256 _earned,\\n uint256 _age\\n ) external override returns (bool _isBondedKeeper) {\\n _initialGas = _getGasLeft();\\n if (\\n _keepers.contains(_keeper) &&\\n bonds[_keeper][_bond] >= _minBond &&\\n workCompleted[_keeper] >= _earned &&\\n block.timestamp - firstSeen[_keeper] >= _age\\n ) {\\n emit KeeperValidation(_initialGas);\\n return true;\\n }\\n }\\n\\n /// @inheritdoc IKeep3rJobWorkable\\n function worked(address _keeper) external virtual override {\\n if (_initialGas == 0) revert GasNotInitialized();\\n address _job = msg.sender;\\n if (disputes[_job]) revert JobDisputed();\\n if (!_jobs.contains(_job)) revert JobUnapproved();\\n\\n if (_updateJobCreditsIfNeeded(_job)) {\\n emit LiquidityCreditsReward(_job, rewardedAt[_job], _jobLiquidityCredits[_job], _jobPeriodCredits[_job]);\\n }\\n\\n (uint256 _boost, uint256 _oneEthQuote, uint256 _extraGas) = IKeep3rHelper(keep3rHelper).getPaymentParams(bonds[_keeper][keep3rV1]);\\n\\n uint256 _gasLeft = _getGasLeft();\\n uint256 _payment = _calculatePayment(_gasLeft, _extraGas, _oneEthQuote, _boost);\\n\\n if (_payment > _jobLiquidityCredits[_job]) {\\n _rewardJobCredits(_job);\\n emit LiquidityCreditsReward(_job, rewardedAt[_job], _jobLiquidityCredits[_job], _jobPeriodCredits[_job]);\\n\\n _gasLeft = _getGasLeft();\\n _payment = _calculatePayment(_gasLeft, _extraGas, _oneEthQuote, _boost);\\n }\\n\\n _bondedPayment(_job, _keeper, _payment);\\n delete _initialGas;\\n\\n emit KeeperWork(keep3rV1, _job, _keeper, _payment, _gasLeft);\\n }\\n\\n /// @inheritdoc IKeep3rJobWorkable\\n function bondedPayment(address _keeper, uint256 _payment) external override {\\n address _job = msg.sender;\\n\\n if (disputes[_job]) revert JobDisputed();\\n if (!_jobs.contains(_job)) revert JobUnapproved();\\n\\n if (_updateJobCreditsIfNeeded(_job)) {\\n emit LiquidityCreditsReward(_job, rewardedAt[_job], _jobLiquidityCredits[_job], _jobPeriodCredits[_job]);\\n }\\n\\n if (_payment > _jobLiquidityCredits[_job]) {\\n _rewardJobCredits(_job);\\n emit LiquidityCreditsReward(_job, rewardedAt[_job], _jobLiquidityCredits[_job], _jobPeriodCredits[_job]);\\n }\\n\\n _bondedPayment(_job, _keeper, _payment);\\n emit KeeperWork(keep3rV1, _job, _keeper, _payment, _getGasLeft());\\n }\\n\\n /// @inheritdoc IKeep3rJobWorkable\\n function directTokenPayment(\\n address _token,\\n address _keeper,\\n uint256 _amount\\n ) external override {\\n address _job = msg.sender;\\n\\n if (disputes[_job]) revert JobDisputed();\\n if (disputes[_keeper]) revert Disputed();\\n if (!_jobs.contains(_job)) revert JobUnapproved();\\n if (jobTokenCredits[_job][_token] < _amount) revert InsufficientFunds();\\n jobTokenCredits[_job][_token] -= _amount;\\n IERC20(_token).safeTransfer(_keeper, _amount);\\n emit KeeperWork(_token, _job, _keeper, _amount, _getGasLeft());\\n }\\n\\n function _bondedPayment(\\n address _job,\\n address _keeper,\\n uint256 _payment\\n ) internal {\\n if (_payment > _jobLiquidityCredits[_job]) revert InsufficientFunds();\\n\\n workedAt[_job] = block.timestamp;\\n _jobLiquidityCredits[_job] -= _payment;\\n bonds[_keeper][keep3rV1] += _payment;\\n workCompleted[_keeper] += _payment;\\n totalBonds += _payment;\\n }\\n\\n /// @notice Calculate amount to be payed in KP3R, taking into account multiple parameters\\n /// @param _gasLeft Amount of gas left after working the job\\n /// @param _extraGas Amount of expected unaccounted gas\\n /// @param _oneEthQuote Amount of KP3R equivalent to 1 ETH\\n /// @param _boost Reward given to the keeper for having bonded KP3R tokens\\n /// @return _payment Amount to be payed in KP3R tokens\\n function _calculatePayment(\\n uint256 _gasLeft,\\n uint256 _extraGas,\\n uint256 _oneEthQuote,\\n uint256 _boost\\n ) internal view returns (uint256 _payment) {\\n uint256 _accountedGas = _initialGas - _gasLeft + _extraGas;\\n _payment = (((_accountedGas * _boost) / _BASE) * _oneEthQuote) / 1 ether;\\n }\\n\\n /// @notice Return the gas left and add 1/64 in order to match real gas left at first level of depth (EIP-150)\\n /// @return _gasLeft Amount of gas left recording taking into account EIP-150\\n function _getGasLeft() internal view returns (uint256 _gasLeft) {\\n _gasLeft = (gasleft() * 64) / 63;\\n }\\n}\\n\",\"keccak256\":\"0x7e113a0815d9125e760ee75c9d9c55fc93192ae2535afccdb8835984d17b510f\",\"license\":\"MIT\"},\"solidity/contracts/peripherals/jobs/Keep3rJobs.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4 <0.9.0;\\n\\nimport '../../../interfaces/peripherals/IKeep3rJobs.sol';\\nimport './Keep3rJobManager.sol';\\nimport './Keep3rJobWorkable.sol';\\nimport './Keep3rJobDisputable.sol';\\n\\nabstract contract Keep3rJobs is IKeep3rJobs, Keep3rJobManager, Keep3rJobWorkable, Keep3rJobDisputable {}\\n\",\"keccak256\":\"0x882e1a19891795de04c4c891dc58d50034ca0a32c8b61651aaf0f47d0bc321d4\",\"license\":\"MIT\"},\"solidity/contracts/peripherals/keepers/Keep3rKeeperDisputable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4 <0.9.0;\\n\\nimport './Keep3rKeeperFundable.sol';\\nimport '../Keep3rDisputable.sol';\\nimport '../../../interfaces/external/IKeep3rV1.sol';\\nimport '../../../interfaces/peripherals/IKeep3rKeepers.sol';\\n\\nabstract contract Keep3rKeeperDisputable is IKeep3rKeeperDisputable, Keep3rDisputable, Keep3rKeeperFundable {\\n using EnumerableSet for EnumerableSet.AddressSet;\\n using SafeERC20 for IERC20;\\n\\n /// @inheritdoc IKeep3rKeeperDisputable\\n function slash(\\n address _keeper,\\n address _bonded,\\n uint256 _bondAmount,\\n uint256 _unbondAmount\\n ) external override onlySlasher {\\n if (!disputes[_keeper]) revert NotDisputed();\\n _slash(_keeper, _bonded, _bondAmount, _unbondAmount);\\n emit KeeperSlash(_keeper, msg.sender, _bondAmount + _unbondAmount);\\n }\\n\\n /// @inheritdoc IKeep3rKeeperDisputable\\n function revoke(address _keeper) external override onlySlasher {\\n if (!disputes[_keeper]) revert NotDisputed();\\n _keepers.remove(_keeper);\\n _slash(_keeper, keep3rV1, bonds[_keeper][keep3rV1], pendingUnbonds[_keeper][keep3rV1]);\\n emit KeeperRevoke(_keeper, msg.sender);\\n }\\n\\n function _slash(\\n address _keeper,\\n address _bonded,\\n uint256 _bondAmount,\\n uint256 _unbondAmount\\n ) internal {\\n if (_bonded != keep3rV1) {\\n try IERC20(_bonded).transfer(governance, _bondAmount + _unbondAmount) returns (bool) {} catch (bytes memory) {}\\n }\\n bonds[_keeper][_bonded] -= _bondAmount;\\n pendingUnbonds[_keeper][_bonded] -= _unbondAmount;\\n }\\n}\\n\",\"keccak256\":\"0xa15b13218af4331d1fb3e8cfdfa9b69117f291ac9a462ede6b1b4fb5be8967de\",\"license\":\"MIT\"},\"solidity/contracts/peripherals/keepers/Keep3rKeeperFundable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4 <0.9.0;\\n\\nimport '../Keep3rAccountance.sol';\\nimport '../Keep3rParameters.sol';\\nimport '../../../interfaces/peripherals/IKeep3rKeepers.sol';\\n\\nimport '../../../interfaces/external/IKeep3rV1.sol';\\n\\nimport '@openzeppelin/contracts/security/ReentrancyGuard.sol';\\nimport '@openzeppelin/contracts/token/ERC20/IERC20.sol';\\nimport '@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol';\\n\\nabstract contract Keep3rKeeperFundable is IKeep3rKeeperFundable, ReentrancyGuard, Keep3rParameters {\\n using EnumerableSet for EnumerableSet.AddressSet;\\n using SafeERC20 for IERC20;\\n\\n /// @inheritdoc IKeep3rKeeperFundable\\n function bond(address _bonding, uint256 _amount) external override nonReentrant {\\n if (disputes[msg.sender]) revert Disputed();\\n if (_jobs.contains(msg.sender)) revert AlreadyAJob();\\n canActivateAfter[msg.sender][_bonding] = block.timestamp + bondTime;\\n\\n uint256 _before = IERC20(_bonding).balanceOf(address(this));\\n IERC20(_bonding).safeTransferFrom(msg.sender, address(this), _amount);\\n _amount = IERC20(_bonding).balanceOf(address(this)) - _before;\\n\\n hasBonded[msg.sender] = true;\\n pendingBonds[msg.sender][_bonding] += _amount;\\n\\n emit Bonding(msg.sender, _bonding, _amount);\\n }\\n\\n /// @inheritdoc IKeep3rKeeperFundable\\n function activate(address _bonding) external override {\\n address _keeper = msg.sender;\\n if (disputes[_keeper]) revert Disputed();\\n uint256 _canActivateAfter = canActivateAfter[_keeper][_bonding];\\n if (_canActivateAfter == 0) revert BondsUnexistent();\\n if (_canActivateAfter >= block.timestamp) revert BondsLocked();\\n\\n if (firstSeen[_keeper] == 0) {\\n firstSeen[_keeper] = block.timestamp;\\n }\\n _keepers.add(_keeper);\\n\\n uint256 _amount = pendingBonds[_keeper][_bonding];\\n delete pendingBonds[_keeper][_bonding];\\n\\n // bond provided tokens\\n bonds[_keeper][_bonding] += _amount;\\n if (_bonding == keep3rV1) {\\n totalBonds += _amount;\\n _depositBonds(_amount);\\n }\\n\\n emit Activation(_keeper, _bonding, _amount);\\n }\\n\\n /// @inheritdoc IKeep3rKeeperFundable\\n function unbond(address _bonding, uint256 _amount) external override {\\n canWithdrawAfter[msg.sender][_bonding] = block.timestamp + unbondTime;\\n bonds[msg.sender][_bonding] -= _amount;\\n pendingUnbonds[msg.sender][_bonding] += _amount;\\n\\n emit Unbonding(msg.sender, _bonding, _amount);\\n }\\n\\n /// @inheritdoc IKeep3rKeeperFundable\\n function withdraw(address _bonding) external override nonReentrant {\\n if (pendingUnbonds[msg.sender][_bonding] == 0) revert UnbondsUnexistent();\\n if (canWithdrawAfter[msg.sender][_bonding] >= block.timestamp) revert UnbondsLocked();\\n if (disputes[msg.sender]) revert Disputed();\\n\\n uint256 _amount = pendingUnbonds[msg.sender][_bonding];\\n\\n delete pendingUnbonds[msg.sender][_bonding];\\n delete canWithdrawAfter[msg.sender][_bonding];\\n\\n if (_bonding == keep3rV1) _mint(_amount);\\n IERC20(_bonding).safeTransfer(msg.sender, _amount);\\n\\n emit Withdrawal(msg.sender, _bonding, _amount);\\n }\\n\\n function _depositBonds(uint256 _amount) internal virtual {\\n IKeep3rV1(keep3rV1).burn(_amount);\\n }\\n}\\n\",\"keccak256\":\"0x121dc11fa555731679912d54da3bb8282d26ad425deffae6d4d7085ef3c9290d\",\"license\":\"MIT\"},\"solidity/contracts/peripherals/keepers/Keep3rKeepers.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4 <0.9.0;\\n\\nimport '../../../interfaces/peripherals/IKeep3rKeepers.sol';\\nimport './Keep3rKeeperDisputable.sol';\\n\\nabstract contract Keep3rKeepers is IKeep3rKeepers, Keep3rKeeperDisputable {}\\n\",\"keccak256\":\"0xfc762d9fd6ff478acba446c3ab6fc19c7d49a85de097dc35f02c56e928153c5e\",\"license\":\"MIT\"},\"solidity/contracts/sidechain/Keep3rSidechain.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\n/*\\n\\nCoded for The Keep3r Network with \\u2665 by\\n\\n\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2557\\u2591\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2557\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2557\\u2588\\u2588\\u2557\\u2591\\u2591\\u2591\\u2588\\u2588\\u2557\\u2591\\u2591\\u2591\\u2591\\u2591\\u2591\\u2591\\u2588\\u2588\\u2557\\u2591\\u2588\\u2588\\u2588\\u2588\\u2588\\u2557\\u2591\\u2588\\u2588\\u2588\\u2557\\u2591\\u2591\\u2588\\u2588\\u2557\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2557\\u2591\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2557\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2557\\u2591\\u2588\\u2588\\u2557\\u2591\\u2591\\u2591\\u2591\\u2591\\u2591\\u2588\\u2588\\u2588\\u2588\\u2588\\u2557\\u2591\\u2588\\u2588\\u2588\\u2557\\u2591\\u2591\\u2588\\u2588\\u2557\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2557\\u2591\\n\\u2588\\u2588\\u2554\\u2550\\u2550\\u2588\\u2588\\u2557\\u2588\\u2588\\u2554\\u2550\\u2550\\u2550\\u2550\\u255d\\u2588\\u2588\\u2554\\u2550\\u2550\\u2550\\u2550\\u255d\\u2588\\u2588\\u2551\\u2591\\u2591\\u2591\\u2588\\u2588\\u2551\\u2591\\u2591\\u2588\\u2588\\u2557\\u2591\\u2591\\u2588\\u2588\\u2551\\u2588\\u2588\\u2554\\u2550\\u2550\\u2588\\u2588\\u2557\\u2588\\u2588\\u2588\\u2588\\u2557\\u2591\\u2588\\u2588\\u2551\\u2588\\u2588\\u2554\\u2550\\u2550\\u2588\\u2588\\u2557\\u2588\\u2588\\u2554\\u2550\\u2550\\u2550\\u2550\\u255d\\u2588\\u2588\\u2554\\u2550\\u2550\\u2588\\u2588\\u2557\\u2588\\u2588\\u2551\\u2591\\u2591\\u2591\\u2591\\u2591\\u2588\\u2588\\u2554\\u2550\\u2550\\u2588\\u2588\\u2557\\u2588\\u2588\\u2588\\u2588\\u2557\\u2591\\u2588\\u2588\\u2551\\u2588\\u2588\\u2554\\u2550\\u2550\\u2588\\u2588\\u2557\\n\\u2588\\u2588\\u2551\\u2591\\u2591\\u2588\\u2588\\u2551\\u2588\\u2588\\u2588\\u2588\\u2588\\u2557\\u2591\\u2591\\u2588\\u2588\\u2588\\u2588\\u2588\\u2557\\u2591\\u2591\\u2588\\u2588\\u2551\\u2591\\u2591\\u2591\\u255a\\u2588\\u2588\\u2557\\u2588\\u2588\\u2588\\u2588\\u2557\\u2588\\u2588\\u2554\\u255d\\u2588\\u2588\\u2551\\u2591\\u2591\\u2588\\u2588\\u2551\\u2588\\u2588\\u2554\\u2588\\u2588\\u2557\\u2588\\u2588\\u2551\\u2588\\u2588\\u2551\\u2591\\u2591\\u2588\\u2588\\u2551\\u2588\\u2588\\u2588\\u2588\\u2588\\u2557\\u2591\\u2591\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2554\\u255d\\u2588\\u2588\\u2551\\u2591\\u2591\\u2591\\u2591\\u2591\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2551\\u2588\\u2588\\u2554\\u2588\\u2588\\u2557\\u2588\\u2588\\u2551\\u2588\\u2588\\u2551\\u2591\\u2591\\u2588\\u2588\\u2551\\n\\u2588\\u2588\\u2551\\u2591\\u2591\\u2588\\u2588\\u2551\\u2588\\u2588\\u2554\\u2550\\u2550\\u255d\\u2591\\u2591\\u2588\\u2588\\u2554\\u2550\\u2550\\u255d\\u2591\\u2591\\u2588\\u2588\\u2551\\u2591\\u2591\\u2591\\u2591\\u2588\\u2588\\u2588\\u2588\\u2554\\u2550\\u2588\\u2588\\u2588\\u2588\\u2551\\u2591\\u2588\\u2588\\u2551\\u2591\\u2591\\u2588\\u2588\\u2551\\u2588\\u2588\\u2551\\u255a\\u2588\\u2588\\u2588\\u2588\\u2551\\u2588\\u2588\\u2551\\u2591\\u2591\\u2588\\u2588\\u2551\\u2588\\u2588\\u2554\\u2550\\u2550\\u255d\\u2591\\u2591\\u2588\\u2588\\u2554\\u2550\\u2550\\u2588\\u2588\\u2557\\u2588\\u2588\\u2551\\u2591\\u2591\\u2591\\u2591\\u2591\\u2588\\u2588\\u2554\\u2550\\u2550\\u2588\\u2588\\u2551\\u2588\\u2588\\u2551\\u255a\\u2588\\u2588\\u2588\\u2588\\u2551\\u2588\\u2588\\u2551\\u2591\\u2591\\u2588\\u2588\\u2551\\n\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2554\\u255d\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2557\\u2588\\u2588\\u2551\\u2591\\u2591\\u2591\\u2591\\u2591\\u2588\\u2588\\u2551\\u2591\\u2591\\u2591\\u2591\\u255a\\u2588\\u2588\\u2554\\u255d\\u2591\\u255a\\u2588\\u2588\\u2554\\u255d\\u2591\\u255a\\u2588\\u2588\\u2588\\u2588\\u2588\\u2554\\u255d\\u2588\\u2588\\u2551\\u2591\\u255a\\u2588\\u2588\\u2588\\u2551\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2554\\u255d\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2557\\u2588\\u2588\\u2551\\u2591\\u2591\\u2588\\u2588\\u2551\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2557\\u2588\\u2588\\u2551\\u2591\\u2591\\u2588\\u2588\\u2551\\u2588\\u2588\\u2551\\u2591\\u255a\\u2588\\u2588\\u2588\\u2551\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2554\\u255d\\n\\u255a\\u2550\\u2550\\u2550\\u2550\\u2550\\u255d\\u2591\\u255a\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u255d\\u255a\\u2550\\u255d\\u2591\\u2591\\u2591\\u2591\\u2591\\u255a\\u2550\\u255d\\u2591\\u2591\\u2591\\u2591\\u2591\\u255a\\u2550\\u255d\\u2591\\u2591\\u2591\\u255a\\u2550\\u255d\\u2591\\u2591\\u2591\\u255a\\u2550\\u2550\\u2550\\u2550\\u255d\\u2591\\u255a\\u2550\\u255d\\u2591\\u2591\\u255a\\u2550\\u2550\\u255d\\u255a\\u2550\\u2550\\u2550\\u2550\\u2550\\u255d\\u2591\\u255a\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u255d\\u255a\\u2550\\u255d\\u2591\\u2591\\u255a\\u2550\\u255d\\u255a\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u255d\\u255a\\u2550\\u255d\\u2591\\u2591\\u255a\\u2550\\u255d\\u255a\\u2550\\u255d\\u2591\\u2591\\u255a\\u2550\\u2550\\u255d\\u255a\\u2550\\u2550\\u2550\\u2550\\u2550\\u255d\\u2591\\n\\nhttps://defi.sucks\\n\\n*/\\n\\npragma solidity >=0.8.4 <0.9.0;\\n\\nimport '../Keep3r.sol';\\nimport '../../interfaces/sidechain/IKeep3rEscrow.sol';\\nimport '../../interfaces/sidechain/IKeep3rHelperSidechain.sol';\\nimport '../../interfaces/sidechain/IKeep3rJobWorkableRated.sol';\\nimport '../../interfaces/sidechain/IKeep3rSidechainAccountance.sol';\\n\\ncontract Keep3rSidechain is Keep3r, IKeep3rJobWorkableRated, IKeep3rSidechainAccountance {\\n using EnumerableSet for EnumerableSet.AddressSet;\\n\\n /// @param _governance Address of governance\\n /// @param _keep3rHelperSidechain Address of sidechain Keep3rHelper\\n /// @param _wrappedKP3R Address of wrapped KP3R implementation\\n /// @param _keep3rEscrow Address of sidechain Keep3rEscrow\\n constructor(\\n address _governance, // governance\\n address _keep3rHelperSidechain, // helper\\n address _wrappedKP3R, // keep3rV1\\n address _keep3rEscrow // keep3rV1Proxy\\n ) Keep3r(_governance, _keep3rHelperSidechain, _wrappedKP3R, _keep3rEscrow) {}\\n\\n // Keep3rSidechainAccountance\\n\\n /// @inheritdoc IKeep3rSidechainAccountance\\n function virtualReserves() external view override returns (int256 _virtualReserves) {\\n // Queries wKP3R balanceOf escrow contract minus the totalBonds\\n return int256(IERC20(keep3rV1).balanceOf(keep3rV1Proxy)) - int256(totalBonds);\\n }\\n\\n // Keep3rJobFundableLiquidity\\n\\n /// @notice Sidechain implementation asks the Helper for an oracle, instead of reading it from the ERC-20\\n /// @dev Function should be called after setting an oracle in Keep3rHelperSidechain\\n /// @param _liquidity Address of the liquidity token being approved\\n function approveLiquidity(address _liquidity) external virtual override onlyGovernance {\\n if (!_approvedLiquidities.add(_liquidity)) revert LiquidityPairApproved();\\n _liquidityPool[_liquidity] = IKeep3rHelperSidechain(keep3rHelper).oracle(_liquidity);\\n if (_liquidityPool[_liquidity] == address(0)) revert ZeroAddress();\\n _isKP3RToken0[_liquidity] = IKeep3rHelper(keep3rHelper).isKP3RToken0(_liquidityPool[_liquidity]);\\n _tick[_liquidity] = observeLiquidity(_liquidity);\\n emit LiquidityApproval(_liquidity);\\n }\\n\\n /// @notice Sidechain implementation will always ask for 2 tickCumulatives instead of cacheing\\n /// @param _liquidity Address of the liquidity token being observed\\n function observeLiquidity(address _liquidity) public view virtual override returns (TickCache memory _tickCache) {\\n if (_tick[_liquidity].period == _period(block.timestamp)) {\\n // Will return cached twaps if liquidity is updated\\n _tickCache = _tick[_liquidity];\\n } else {\\n bool success;\\n\\n // Will always ask for 2 accumulators in sidechain\\n uint32[] memory _secondsAgo = new uint32[](2);\\n\\n _secondsAgo[0] = uint32(block.timestamp - _period(block.timestamp));\\n _secondsAgo[1] = uint32(block.timestamp - _period(block.timestamp) + rewardPeriodTime);\\n\\n int56 _tickCumulative2;\\n (_tickCache.current, _tickCumulative2, success) = IKeep3rHelper(keep3rHelper).observe(_liquidityPool[_liquidity], _secondsAgo);\\n\\n _tickCache.difference = _tickCache.current - _tickCumulative2;\\n\\n if (success) {\\n _tickCache.period = _period(block.timestamp);\\n } else {\\n delete _tickCache.period;\\n }\\n }\\n }\\n\\n // Keep3rJobsWorkable\\n\\n /// @dev Sidechain implementation deprecates worked(address) as it should come with a usdPerGasUnit parameter\\n function worked(address) external pure override {\\n revert Deprecated();\\n }\\n\\n /// @notice Implemented by jobs to show that a keeper performed work\\n /// @dev Uses a USD per gas unit payment mechanism\\n /// @param _keeper Address of the keeper that performed the work\\n /// @param _usdPerGasUnit Units of USD (in wei) per gas unit that should be rewarded to the keeper\\n function worked(address _keeper, uint256 _usdPerGasUnit) external override {\\n if (_initialGas == 0) revert GasNotInitialized();\\n // Gas used for quote calculations & payment is not rewarded\\n uint256 _gasLeft = _getGasLeft();\\n\\n address _job = msg.sender;\\n if (disputes[_job]) revert JobDisputed();\\n if (!_jobs.contains(_job)) revert JobUnapproved();\\n\\n if (_updateJobCreditsIfNeeded(_job)) {\\n emit LiquidityCreditsReward(_job, rewardedAt[_job], _jobLiquidityCredits[_job], _jobPeriodCredits[_job]);\\n }\\n\\n (uint256 _boost, uint256 _oneUsdQuote, uint256 _extraGas) = IKeep3rHelper(keep3rHelper).getPaymentParams(bonds[_keeper][keep3rV1]);\\n\\n uint256 _kp3rPayment = _calculatePayment(_gasLeft, _extraGas, _oneUsdQuote * _usdPerGasUnit, _boost);\\n\\n if (_kp3rPayment > _jobLiquidityCredits[_job]) {\\n _rewardJobCredits(_job);\\n emit LiquidityCreditsReward(_job, rewardedAt[_job], _jobLiquidityCredits[_job], _jobPeriodCredits[_job]);\\n }\\n\\n _bondedPayment(_job, _keeper, _kp3rPayment);\\n delete _initialGas;\\n\\n emit KeeperWork(keep3rV1, _job, _keeper, _kp3rPayment, _gasLeft);\\n }\\n\\n // Keep3rKeeperFundable\\n\\n /// @dev Sidechain implementation doesn't burn tokens, but deposit them in Keep3rEscrow\\n function _depositBonds(uint256 _amount) internal virtual override {\\n IKeep3rV1(keep3rV1).approve(keep3rV1Proxy, _amount);\\n IKeep3rEscrow(keep3rV1Proxy).deposit(_amount);\\n }\\n}\\n\",\"keccak256\":\"0xd546c5e5c9286e0e8785584d6395c0b4facc58b447351df92934346101b90290\",\"license\":\"MIT\"},\"solidity/for-test/testnet/Keep3rSidechainForTestnet.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4 <0.9.0;\\n\\nimport '../../contracts/sidechain/Keep3rSidechain.sol';\\n\\ncontract Keep3rSidechainForTestnet is Keep3rSidechain {\\n constructor(\\n address _governance,\\n address _keep3rHelper,\\n address _keep3rV1,\\n address _keep3rV1Proxy\\n ) Keep3rSidechain(_governance, _keep3rHelper, _keep3rV1, _keep3rV1Proxy) {\\n bondTime = 0; // allows keepers to instantly register\\n unbondTime = 0; // allows keepers & jobOwners to instantly withdraw funds\\n liquidityMinimum = 1; // allows job providers to add low liquidity\\n rewardPeriodTime = 1 days; // reduces twap calculation period\\n inflationPeriod = 5 days; // increases credit minting\\n }\\n}\\n\",\"keccak256\":\"0xa098eda6b1501e4d252ac77bef69e520e0fa3dd7427626639db3511b07e535bd\",\"license\":\"MIT\"},\"solidity/interfaces/IKeep3r.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4 <0.9.0;\\n\\nimport './peripherals/IKeep3rJobs.sol';\\nimport './peripherals/IKeep3rKeepers.sol';\\nimport './peripherals/IKeep3rParameters.sol';\\n\\n// solhint-disable-next-line no-empty-blocks\\n\\n/// @title Keep3rV2 contract\\n/// @notice This contract inherits all the functionality of Keep3rV2\\ninterface IKeep3r is IKeep3rJobs, IKeep3rKeepers, IKeep3rParameters {\\n\\n}\\n\",\"keccak256\":\"0x273a39984c1475c60182e636bb91a1b89ec98646a036cac6a87067869b3adeb9\",\"license\":\"MIT\"},\"solidity/interfaces/IKeep3rHelper.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4 <0.9.0;\\n\\nimport './IKeep3rHelperParameters.sol';\\n\\n/// @title Keep3rHelper contract\\n/// @notice Contains all the helper functions used throughout the different files.\\ninterface IKeep3rHelper is IKeep3rHelperParameters {\\n // Errors\\n\\n /// @notice Throws when none of the tokens in the liquidity pair is KP3R\\n error LiquidityPairInvalid();\\n\\n // Methods\\n // solhint-enable func-name-mixedcase\\n\\n /// @notice Calculates the amount of KP3R that corresponds to the ETH passed into the function\\n /// @dev This function allows us to calculate how much KP3R we should pay to a keeper for things expressed in ETH, like gas\\n /// @param _eth The amount of ETH\\n /// @return _amountOut The amount of KP3R\\n function quote(uint256 _eth) external view returns (uint256 _amountOut);\\n\\n /// @notice Returns the amount of KP3R the keeper has bonded\\n /// @param _keeper The address of the keeper to check\\n /// @return _amountBonded The amount of KP3R the keeper has bonded\\n function bonds(address _keeper) external view returns (uint256 _amountBonded);\\n\\n /// @notice Calculates the reward (in KP3R) that corresponds to a keeper for using gas\\n /// @param _keeper The address of the keeper to check\\n /// @param _gasUsed The amount of gas used that will be rewarded\\n /// @return _kp3r The amount of KP3R that should be awarded to the keeper\\n function getRewardAmountFor(address _keeper, uint256 _gasUsed) external view returns (uint256 _kp3r);\\n\\n /// @notice Calculates the boost in the reward given to a keeper based on the amount of KP3R that keeper has bonded\\n /// @dev If the keeper has no bonds, boost should be +10% of gas cost, if keeper has max bonds, +20%\\n /// @param _bonds The amount of KP3R tokens bonded by the keeper\\n /// @return _rewardBoost The reward boost that corresponds to the keeper\\n function getRewardBoostFor(uint256 _bonds) external view returns (uint256 _rewardBoost);\\n\\n /// @notice Calculates the reward (in KP3R) that corresponds to tx.origin for using gas\\n /// @param _gasUsed The amount of gas used that will be rewarded\\n /// @return _amount The amount of KP3R that should be awarded to tx.origin\\n function getRewardAmount(uint256 _gasUsed) external view returns (uint256 _amount);\\n\\n /// @notice Given a pool address, returns the underlying tokens of the pair\\n /// @param _pool Address of the correspondant pool\\n /// @return _token0 Address of the first token of the pair\\n /// @return _token1 Address of the second token of the pair\\n function getPoolTokens(address _pool) external view returns (address _token0, address _token1);\\n\\n /// @notice Defines the order of the tokens in the pair for twap calculations\\n /// @param _pool Address of the correspondant pool\\n /// @return _isKP3RToken0 Boolean indicating the order of the tokens in the pair\\n function isKP3RToken0(address _pool) external view returns (bool _isKP3RToken0);\\n\\n /// @notice Given an array of secondsAgo, returns UniswapV3 pool cumulatives at that moment\\n /// @param _pool Address of the pool to observe\\n /// @param _secondsAgo Array with time references to observe\\n /// @return _tickCumulative1 Cumulative sum of ticks until first time reference\\n /// @return _tickCumulative2 Cumulative sum of ticks until second time reference\\n /// @return _success Boolean indicating if the observe call was succesfull\\n function observe(address _pool, uint32[] memory _secondsAgo)\\n external\\n view\\n returns (\\n int56 _tickCumulative1,\\n int56 _tickCumulative2,\\n bool _success\\n );\\n\\n /// @notice Get multiplier, quote, and extra, in order to calculate keeper payment\\n /// @param _bonds Amount of bonded KP3R owned by the keeper\\n /// @return _boost Multiplier per gas unit. Takes into account the base fee and the amount of bonded KP3R\\n /// @return _oneEthQuote Amount of KP3R tokens equivalent to 1 ETH\\n /// @return _extra Amount of extra gas that should be added to the gas spent\\n function getPaymentParams(uint256 _bonds)\\n external\\n view\\n returns (\\n uint256 _boost,\\n uint256 _oneEthQuote,\\n uint256 _extra\\n );\\n\\n /// @notice Given a tick and a liquidity amount, calculates the underlying KP3R tokens\\n /// @param _liquidityAmount Amount of liquidity to be converted\\n /// @param _tickDifference Tick value used to calculate the quote\\n /// @param _timeInterval Time value used to calculate the quote\\n /// @return _kp3rAmount Amount of KP3R tokens underlying on the given liquidity\\n function getKP3RsAtTick(\\n uint256 _liquidityAmount,\\n int56 _tickDifference,\\n uint256 _timeInterval\\n ) external pure returns (uint256 _kp3rAmount);\\n\\n /// @notice Given a tick and a token amount, calculates the output in correspondant token\\n /// @param _baseAmount Amount of token to be converted\\n /// @param _tickDifference Tick value used to calculate the quote\\n /// @param _timeInterval Time value used to calculate the quote\\n /// @return _quoteAmount Amount of credits deserved for the baseAmount at the tick value\\n function getQuoteAtTick(\\n uint128 _baseAmount,\\n int56 _tickDifference,\\n uint256 _timeInterval\\n ) external pure returns (uint256 _quoteAmount);\\n}\\n\",\"keccak256\":\"0x67817dc98fde9b3a917e25bc16fe60a91772dd5a77e0ce22a208b66b29d3ad8e\",\"license\":\"MIT\"},\"solidity/interfaces/IKeep3rHelperParameters.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4 <0.9.0;\\n\\n/// @title Keep3rHelperParameters contract\\n/// @notice Contains all the helper functions used throughout the different files.\\ninterface IKeep3rHelperParameters {\\n // Structs\\n\\n /// @dev KP3R-WETH Pool address and isKP3RToken0\\n /// @dev Created in order to save gas by avoiding calls to pool's token0 method\\n struct TokenOraclePool {\\n address poolAddress;\\n bool isTKNToken0;\\n }\\n\\n // Errors\\n\\n /// @notice Throws when pool does not have KP3R as token0 nor token1\\n error InvalidOraclePool();\\n\\n // Events\\n\\n /// @notice Emitted when the kp3r weth pool is changed\\n /// @param _address Address of the new kp3r weth pool\\n /// @param _isKP3RToken0 True if calling the token0 method of the pool returns the KP3R token address\\n event Kp3rWethPoolChange(address _address, bool _isKP3RToken0);\\n\\n /// @notice Emitted when the minimum boost multiplier is changed\\n /// @param _minBoost The minimum boost multiplier\\n event MinBoostChange(uint256 _minBoost);\\n\\n /// @notice Emitted when the maximum boost multiplier is changed\\n /// @param _maxBoost The maximum boost multiplier\\n event MaxBoostChange(uint256 _maxBoost);\\n\\n /// @notice Emitted when the target bond amount is changed\\n /// @param _targetBond The target bond amount\\n event TargetBondChange(uint256 _targetBond);\\n\\n /// @notice Emitted when the Keep3r V2 address is changed\\n /// @param _keep3rV2 The address of Keep3r V2\\n event Keep3rV2Change(address _keep3rV2);\\n\\n /// @notice Emitted when the work extra gas amount is changed\\n /// @param _workExtraGas The work extra gas\\n event WorkExtraGasChange(uint256 _workExtraGas);\\n\\n /// @notice Emitted when the quote twap time is changed\\n /// @param _quoteTwapTime The twap time for quoting\\n event QuoteTwapTimeChange(uint32 _quoteTwapTime);\\n\\n /// @notice Emitted when minimum rewarded gas fee is changed\\n /// @param _minBaseFee The minimum rewarded gas fee\\n event MinBaseFeeChange(uint256 _minBaseFee);\\n\\n /// @notice Emitted when minimum rewarded priority fee is changed\\n /// @param _minPriorityFee The minimum expected fee that the keeper should pay\\n event MinPriorityFeeChange(uint256 _minPriorityFee);\\n\\n // Variables\\n\\n /// @notice Address of KP3R token\\n /// @return _kp3r Address of KP3R token\\n // solhint-disable func-name-mixedcase\\n function KP3R() external view returns (address _kp3r);\\n\\n /// @notice The boost base used to calculate the boost rewards for the keeper\\n /// @return _base The boost base number\\n function BOOST_BASE() external view returns (uint256 _base);\\n\\n /// @notice KP3R-WETH pool that is being used as oracle\\n /// @return poolAddress Address of the pool\\n /// @return isTKNToken0 True if calling the token0 method of the pool returns the KP3R token address\\n function kp3rWethPool() external view returns (address poolAddress, bool isTKNToken0);\\n\\n /// @notice The minimum multiplier used to calculate the amount of gas paid to the Keeper for the gas used to perform a job\\n /// For example: if the quoted gas used is 1000, then the minimum amount to be paid will be 1000 * minBoost / BOOST_BASE\\n /// @return _multiplier The minimum boost multiplier\\n function minBoost() external view returns (uint256 _multiplier);\\n\\n /// @notice The maximum multiplier used to calculate the amount of gas paid to the Keeper for the gas used to perform a job\\n /// For example: if the quoted gas used is 1000, then the maximum amount to be paid will be 1000 * maxBoost / BOOST_BASE\\n /// @return _multiplier The maximum boost multiplier\\n function maxBoost() external view returns (uint256 _multiplier);\\n\\n /// @notice The targeted amount of bonded KP3Rs to max-up reward multiplier\\n /// For example: if the amount of KP3R the keeper has bonded is targetBond or more, then the keeper will get\\n /// the maximum boost possible in his rewards, if it's less, the reward boost will be proportional\\n /// @return _target The amount of KP3R that comforms the targetBond\\n function targetBond() external view returns (uint256 _target);\\n\\n /// @notice The amount of unaccounted gas that is going to be added to keeper payments\\n /// @return _workExtraGas The work unaccounted gas amount\\n function workExtraGas() external view returns (uint256 _workExtraGas);\\n\\n /// @notice The twap time for quoting\\n /// @return _quoteTwapTime The twap time\\n function quoteTwapTime() external view returns (uint32 _quoteTwapTime);\\n\\n /// @notice The minimum base fee that is used to calculate keeper rewards\\n /// @return _minBaseFee The minimum rewarded gas fee\\n function minBaseFee() external view returns (uint256 _minBaseFee);\\n\\n /// @notice The minimum priority fee that is also rewarded for keepers\\n /// @return _minPriorityFee The minimum rewarded priority fee\\n function minPriorityFee() external view returns (uint256 _minPriorityFee);\\n\\n /// @notice Address of Keep3r V2\\n /// @return _keep3rV2 Address of Keep3r V2\\n function keep3rV2() external view returns (address _keep3rV2);\\n\\n // Methods\\n\\n /// @notice Sets KP3R-WETH pool\\n /// @param _poolAddress The address of the KP3R-WETH pool\\n function setKp3rWethPool(address _poolAddress) external;\\n\\n /// @notice Sets the minimum boost multiplier\\n /// @param _minBoost The minimum boost multiplier\\n function setMinBoost(uint256 _minBoost) external;\\n\\n /// @notice Sets the maximum boost multiplier\\n /// @param _maxBoost The maximum boost multiplier\\n function setMaxBoost(uint256 _maxBoost) external;\\n\\n /// @notice Sets the target bond amount\\n /// @param _targetBond The target bond amount\\n function setTargetBond(uint256 _targetBond) external;\\n\\n /// @notice Sets the Keep3r V2 address\\n /// @param _keep3rV2 The address of Keep3r V2\\n function setKeep3rV2(address _keep3rV2) external;\\n\\n /// @notice Sets the work extra gas amount\\n /// @param _workExtraGas The work extra gas\\n function setWorkExtraGas(uint256 _workExtraGas) external;\\n\\n /// @notice Sets the quote twap time\\n /// @param _quoteTwapTime The twap time for quoting\\n function setQuoteTwapTime(uint32 _quoteTwapTime) external;\\n\\n /// @notice Sets the minimum rewarded gas fee\\n /// @param _minBaseFee The minimum rewarded gas fee\\n function setMinBaseFee(uint256 _minBaseFee) external;\\n\\n /// @notice Sets the minimum rewarded gas priority fee\\n /// @param _minPriorityFee The minimum rewarded priority fee\\n function setMinPriorityFee(uint256 _minPriorityFee) external;\\n}\\n\",\"keccak256\":\"0x76f99ca04361c0459fc9e99f0387ddb76da18cc470ec5bc744e7dc3bf6e9d334\",\"license\":\"MIT\"},\"solidity/interfaces/IPairManager.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4 <0.9.0;\\n\\nimport '@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol';\\n\\n/// @title Pair Manager interface\\n/// @notice Generic interface for Keep3r liquidity pools (kLP)\\ninterface IPairManager is IERC20Metadata {\\n /// @notice Address of the factory from which the pair manager was created\\n /// @return _factory The address of the PairManager Factory\\n function factory() external view returns (address _factory);\\n\\n /// @notice Address of the pool from which the Keep3r pair manager will interact with\\n /// @return _pool The address of the pool\\n function pool() external view returns (address _pool);\\n\\n /// @notice Token0 of the pool\\n /// @return _token0 The address of token0\\n function token0() external view returns (address _token0);\\n\\n /// @notice Token1 of the pool\\n /// @return _token1 The address of token1\\n function token1() external view returns (address _token1);\\n}\\n\",\"keccak256\":\"0x345c312b340c5775fb8f68d89ce851c7f75522940bd9bc64f2301a3f8312636a\",\"license\":\"MIT\"},\"solidity/interfaces/external/IKeep3rV1.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4 <0.9.0;\\n\\nimport '@openzeppelin/contracts/token/ERC20/IERC20.sol';\\nimport '@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol';\\n\\n// solhint-disable func-name-mixedcase\\ninterface IKeep3rV1 is IERC20, IERC20Metadata {\\n // Structs\\n struct Checkpoint {\\n uint32 fromBlock;\\n uint256 votes;\\n }\\n\\n // Events\\n event DelegateChanged(address indexed _delegator, address indexed _fromDelegate, address indexed _toDelegate);\\n event DelegateVotesChanged(address indexed _delegate, uint256 _previousBalance, uint256 _newBalance);\\n event SubmitJob(address indexed _job, address indexed _liquidity, address indexed _provider, uint256 _block, uint256 _credit);\\n event ApplyCredit(address indexed _job, address indexed _liquidity, address indexed _provider, uint256 _block, uint256 _credit);\\n event RemoveJob(address indexed _job, address indexed _liquidity, address indexed _provider, uint256 _block, uint256 _credit);\\n event UnbondJob(address indexed _job, address indexed _liquidity, address indexed _provider, uint256 _block, uint256 _credit);\\n event JobAdded(address indexed _job, uint256 _block, address _governance);\\n event JobRemoved(address indexed _job, uint256 _block, address _governance);\\n event KeeperWorked(address indexed _credit, address indexed _job, address indexed _keeper, uint256 _block, uint256 _amount);\\n event KeeperBonding(address indexed _keeper, uint256 _block, uint256 _active, uint256 _bond);\\n event KeeperBonded(address indexed _keeper, uint256 _block, uint256 _activated, uint256 _bond);\\n event KeeperUnbonding(address indexed _keeper, uint256 _block, uint256 _deactive, uint256 _bond);\\n event KeeperUnbound(address indexed _keeper, uint256 _block, uint256 _deactivated, uint256 _bond);\\n event KeeperSlashed(address indexed _keeper, address indexed _slasher, uint256 _block, uint256 _slash);\\n event KeeperDispute(address indexed _keeper, uint256 _block);\\n event KeeperResolved(address indexed _keeper, uint256 _block);\\n event TokenCreditAddition(address indexed _credit, address indexed _job, address indexed _creditor, uint256 _block, uint256 _amount);\\n\\n // Variables\\n function KPRH() external returns (address);\\n\\n function delegates(address _delegator) external view returns (address);\\n\\n function checkpoints(address _account, uint32 _checkpoint) external view returns (Checkpoint memory);\\n\\n function numCheckpoints(address _account) external view returns (uint32);\\n\\n function DOMAIN_TYPEHASH() external returns (bytes32);\\n\\n function DOMAINSEPARATOR() external returns (bytes32);\\n\\n function DELEGATION_TYPEHASH() external returns (bytes32);\\n\\n function PERMIT_TYPEHASH() external returns (bytes32);\\n\\n function nonces(address _user) external view returns (uint256);\\n\\n function BOND() external returns (uint256);\\n\\n function UNBOND() external returns (uint256);\\n\\n function LIQUIDITYBOND() external returns (uint256);\\n\\n function FEE() external returns (uint256);\\n\\n function BASE() external returns (uint256);\\n\\n function ETH() external returns (address);\\n\\n function bondings(address _user, address _bonding) external view returns (uint256);\\n\\n function canWithdrawAfter(address _user, address _bonding) external view returns (uint256);\\n\\n function pendingUnbonds(address _keeper, address _bonding) external view returns (uint256);\\n\\n function pendingbonds(address _keeper, address _bonding) external view returns (uint256);\\n\\n function bonds(address _keeper, address _bonding) external view returns (uint256);\\n\\n function votes(address _delegator) external view returns (uint256);\\n\\n function firstSeen(address _keeper) external view returns (uint256);\\n\\n function disputes(address _keeper) external view returns (bool);\\n\\n function lastJob(address _keeper) external view returns (uint256);\\n\\n function workCompleted(address _keeper) external view returns (uint256);\\n\\n function jobs(address _job) external view returns (bool);\\n\\n function credits(address _job, address _credit) external view returns (uint256);\\n\\n function liquidityProvided(\\n address _provider,\\n address _liquidity,\\n address _job\\n ) external view returns (uint256);\\n\\n function liquidityUnbonding(\\n address _provider,\\n address _liquidity,\\n address _job\\n ) external view returns (uint256);\\n\\n function liquidityAmountsUnbonding(\\n address _provider,\\n address _liquidity,\\n address _job\\n ) external view returns (uint256);\\n\\n function jobProposalDelay(address _job) external view returns (uint256);\\n\\n function liquidityApplied(\\n address _provider,\\n address _liquidity,\\n address _job\\n ) external view returns (uint256);\\n\\n function liquidityAmount(\\n address _provider,\\n address _liquidity,\\n address _job\\n ) external view returns (uint256);\\n\\n function keepers(address _keeper) external view returns (bool);\\n\\n function blacklist(address _keeper) external view returns (bool);\\n\\n function keeperList(uint256 _index) external view returns (address);\\n\\n function jobList(uint256 _index) external view returns (address);\\n\\n function governance() external returns (address);\\n\\n function pendingGovernance() external returns (address);\\n\\n function liquidityAccepted(address _liquidity) external view returns (bool);\\n\\n function liquidityPairs(uint256 _index) external view returns (address);\\n\\n // Methods\\n function getCurrentVotes(address _account) external view returns (uint256);\\n\\n function addCreditETH(address _job) external payable;\\n\\n function addCredit(\\n address _credit,\\n address _job,\\n uint256 _amount\\n ) external;\\n\\n function addVotes(address _voter, uint256 _amount) external;\\n\\n function removeVotes(address _voter, uint256 _amount) external;\\n\\n function addKPRCredit(address _job, uint256 _amount) external;\\n\\n function approveLiquidity(address _liquidity) external;\\n\\n function revokeLiquidity(address _liquidity) external;\\n\\n function pairs() external view returns (address[] memory);\\n\\n function addLiquidityToJob(\\n address _liquidity,\\n address _job,\\n uint256 _amount\\n ) external;\\n\\n function applyCreditToJob(\\n address _provider,\\n address _liquidity,\\n address _job\\n ) external;\\n\\n function unbondLiquidityFromJob(\\n address _liquidity,\\n address _job,\\n uint256 _amount\\n ) external;\\n\\n function removeLiquidityFromJob(address _liquidity, address _job) external;\\n\\n function mint(uint256 _amount) external;\\n\\n function burn(uint256 _amount) external;\\n\\n function worked(address _keeper) external;\\n\\n function receipt(\\n address _credit,\\n address _keeper,\\n uint256 _amount\\n ) external;\\n\\n function receiptETH(address _keeper, uint256 _amount) external;\\n\\n function addJob(address _job) external;\\n\\n function getJobs() external view returns (address[] memory);\\n\\n function removeJob(address _job) external;\\n\\n function setKeep3rHelper(address _keep3rHelper) external;\\n\\n function setGovernance(address _governance) external;\\n\\n function acceptGovernance() external;\\n\\n function isKeeper(address _keeper) external returns (bool);\\n\\n function isMinKeeper(\\n address _keeper,\\n uint256 _minBond,\\n uint256 _earned,\\n uint256 _age\\n ) external returns (bool);\\n\\n function isBondedKeeper(\\n address _keeper,\\n address _bond,\\n uint256 _minBond,\\n uint256 _earned,\\n uint256 _age\\n ) external returns (bool);\\n\\n function bond(address _bonding, uint256 _amount) external;\\n\\n function getKeepers() external view returns (address[] memory);\\n\\n function activate(address _bonding) external;\\n\\n function unbond(address _bonding, uint256 _amount) external;\\n\\n function slash(\\n address _bonded,\\n address _keeper,\\n uint256 _amount\\n ) external;\\n\\n function withdraw(address _bonding) external;\\n\\n function dispute(address _keeper) external;\\n\\n function revoke(address _keeper) external;\\n\\n function resolve(address _keeper) external;\\n\\n function permit(\\n address _owner,\\n address _spender,\\n uint256 _amount,\\n uint256 _deadline,\\n uint8 _v,\\n bytes32 _r,\\n bytes32 _s\\n ) external;\\n}\\n\",\"keccak256\":\"0xa9806cd6666ab1b7375ef72446964a72397fd4cefc7cc8c5b37caa7c50df0246\",\"license\":\"MIT\"},\"solidity/interfaces/external/IKeep3rV1Proxy.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4 <0.9.0;\\n\\nimport '../peripherals/IGovernable.sol';\\n\\ninterface IKeep3rV1Proxy is IGovernable {\\n // Structs\\n struct Recipient {\\n address recipient;\\n uint256 caps;\\n }\\n\\n // Variables\\n function keep3rV1() external view returns (address);\\n\\n function minter() external view returns (address);\\n\\n function next(address) external view returns (uint256);\\n\\n function caps(address) external view returns (uint256);\\n\\n function recipients() external view returns (address[] memory);\\n\\n function recipientsCaps() external view returns (Recipient[] memory);\\n\\n // Errors\\n error Cooldown();\\n error NoDrawableAmount();\\n error ZeroAddress();\\n error OnlyMinter();\\n\\n // Methods\\n function addRecipient(address recipient, uint256 amount) external;\\n\\n function removeRecipient(address recipient) external;\\n\\n function draw() external returns (uint256 _amount);\\n\\n function setKeep3rV1(address _keep3rV1) external;\\n\\n function setMinter(address _minter) external;\\n\\n function mint(uint256 _amount) external;\\n\\n function mint(address _account, uint256 _amount) external;\\n\\n function setKeep3rV1Governance(address _governance) external;\\n\\n function acceptKeep3rV1Governance() external;\\n\\n function dispute(address _keeper) external;\\n\\n function slash(\\n address _bonded,\\n address _keeper,\\n uint256 _amount\\n ) external;\\n\\n function revoke(address _keeper) external;\\n\\n function resolve(address _keeper) external;\\n\\n function addJob(address _job) external;\\n\\n function removeJob(address _job) external;\\n\\n function addKPRCredit(address _job, uint256 _amount) external;\\n\\n function approveLiquidity(address _liquidity) external;\\n\\n function revokeLiquidity(address _liquidity) external;\\n\\n function setKeep3rHelper(address _keep3rHelper) external;\\n\\n function addVotes(address _voter, uint256 _amount) external;\\n\\n function removeVotes(address _voter, uint256 _amount) external;\\n}\\n\",\"keccak256\":\"0xfb2e81fe347b39aabce849ef2d42c6df846b7ef0ed5ae952c85bbb708da99408\",\"license\":\"MIT\"},\"solidity/interfaces/peripherals/IBaseErrors.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity >=0.8.4 <0.9.0;\\n\\ninterface IBaseErrors {\\n /// @notice Throws if a variable is assigned to the zero address\\n error ZeroAddress();\\n}\\n\",\"keccak256\":\"0x9130019a08d9eaedfb920a323fed5c7f409736cd918f1a32921c93551b3ee00e\",\"license\":\"MIT\"},\"solidity/interfaces/peripherals/IDustCollector.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity >=0.8.4 <0.9.0;\\n\\nimport './IBaseErrors.sol';\\n\\ninterface IDustCollector is IBaseErrors {\\n /// @notice Emitted when dust is sent\\n /// @param _token The token that will be transferred\\n /// @param _amount The amount of the token that will be transferred\\n /// @param _to The address which will receive the funds\\n event DustSent(address _token, uint256 _amount, address _to);\\n\\n /// @notice Allows an authorized user to transfer the tokens or eth that may have been left in a contract\\n /// @param _token The token that will be transferred\\n /// @param _amount The amount of the token that will be transferred\\n /// @param _to The address that will receive the idle funds\\n function sendDust(\\n address _token,\\n uint256 _amount,\\n address _to\\n ) external;\\n}\\n\",\"keccak256\":\"0x38dce228111f2a3c6b26ac09c5652c3f1f184c4cfe50d11ff0958ef6a50683bb\",\"license\":\"MIT\"},\"solidity/interfaces/peripherals/IGovernable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4 <0.9.0;\\n\\n/// @title Governable contract\\n/// @notice Manages the governance role\\ninterface IGovernable {\\n // Events\\n\\n /// @notice Emitted when pendingGovernance accepts to be governance\\n /// @param _governance Address of the new governance\\n event GovernanceSet(address _governance);\\n\\n /// @notice Emitted when a new governance is proposed\\n /// @param _pendingGovernance Address that is proposed to be the new governance\\n event GovernanceProposal(address _pendingGovernance);\\n\\n // Errors\\n\\n /// @notice Throws if the caller of the function is not governance\\n error OnlyGovernance();\\n\\n /// @notice Throws if the caller of the function is not pendingGovernance\\n error OnlyPendingGovernance();\\n\\n /// @notice Throws if trying to set governance to zero address\\n error NoGovernanceZeroAddress();\\n\\n // Variables\\n\\n /// @notice Stores the governance address\\n /// @return _governance The governance addresss\\n function governance() external view returns (address _governance);\\n\\n /// @notice Stores the pendingGovernance address\\n /// @return _pendingGovernance The pendingGovernance addresss\\n function pendingGovernance() external view returns (address _pendingGovernance);\\n\\n // Methods\\n\\n /// @notice Proposes a new address to be governance\\n /// @param _governance The address being proposed as the new governance\\n function setGovernance(address _governance) external;\\n\\n /// @notice Changes the governance from the current governance to the previously proposed address\\n function acceptGovernance() external;\\n}\\n\",\"keccak256\":\"0x3284624b2479bbf97c821f37c93a096dcb869b30bbf9b20d30d1800f9535452c\",\"license\":\"MIT\"},\"solidity/interfaces/peripherals/IKeep3rAccountance.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4 <0.9.0;\\n\\nimport './IKeep3rRoles.sol';\\n\\n/// @title Keep3rDisputable contract\\n/// @notice Disputes keepers, or if they're already disputed, it can resolve the case\\n/// @dev Argument `bonding` can be the address of either a token or a liquidity\\ninterface IKeep3rAccountance is IKeep3rRoles {\\n // Events\\n\\n /// @notice Emitted when the bonding process of a new keeper begins\\n /// @param _keeper The caller of Keep3rKeeperFundable#bond function\\n /// @param _bonding The asset the keeper has bonded\\n /// @param _amount The amount the keeper has bonded\\n event Bonding(address indexed _keeper, address indexed _bonding, uint256 _amount);\\n\\n /// @notice Emitted when a keeper or job begins the unbonding process to withdraw the funds\\n /// @param _keeperOrJob The keeper or job that began the unbonding process\\n /// @param _unbonding The liquidity pair or asset being unbonded\\n /// @param _amount The amount being unbonded\\n event Unbonding(address indexed _keeperOrJob, address indexed _unbonding, uint256 _amount);\\n\\n // Variables\\n\\n /// @notice Tracks the total amount of bonded KP3Rs in the contract\\n /// @return _totalBonds The total amount of bonded KP3Rs in the contract\\n function totalBonds() external view returns (uint256 _totalBonds);\\n\\n /// @notice Tracks the total KP3R earnings of a keeper since it started working\\n /// @param _keeper The address of the keeper\\n /// @return _workCompleted Total KP3R earnings of a keeper since it started working\\n function workCompleted(address _keeper) external view returns (uint256 _workCompleted);\\n\\n /// @notice Tracks when a keeper was first registered\\n /// @param _keeper The address of the keeper\\n /// @return timestamp The time at which the keeper was first registered\\n function firstSeen(address _keeper) external view returns (uint256 timestamp);\\n\\n /// @notice Tracks if a keeper or job has a pending dispute\\n /// @param _keeperOrJob The address of the keeper or job\\n /// @return _disputed Whether a keeper or job has a pending dispute\\n function disputes(address _keeperOrJob) external view returns (bool _disputed);\\n\\n /// @notice Tracks how much a keeper has bonded of a certain token\\n /// @param _keeper The address of the keeper\\n /// @param _bond The address of the token being bonded\\n /// @return _bonds Amount of a certain token that a keeper has bonded\\n function bonds(address _keeper, address _bond) external view returns (uint256 _bonds);\\n\\n /// @notice The current token credits available for a job\\n /// @param _job The address of the job\\n /// @param _token The address of the token bonded\\n /// @return _amount The amount of token credits available for a job\\n function jobTokenCredits(address _job, address _token) external view returns (uint256 _amount);\\n\\n /// @notice Tracks the amount of assets deposited in pending bonds\\n /// @param _keeper The address of the keeper\\n /// @param _bonding The address of the token being bonded\\n /// @return _pendingBonds Amount of a certain asset a keeper has unbonding\\n function pendingBonds(address _keeper, address _bonding) external view returns (uint256 _pendingBonds);\\n\\n /// @notice Tracks when a bonding for a keeper can be activated\\n /// @param _keeper The address of the keeper\\n /// @param _bonding The address of the token being bonded\\n /// @return _timestamp Time at which the bonding for a keeper can be activated\\n function canActivateAfter(address _keeper, address _bonding) external view returns (uint256 _timestamp);\\n\\n /// @notice Tracks when keeper bonds are ready to be withdrawn\\n /// @param _keeper The address of the keeper\\n /// @param _bonding The address of the token being unbonded\\n /// @return _timestamp Time at which the keeper bonds are ready to be withdrawn\\n function canWithdrawAfter(address _keeper, address _bonding) external view returns (uint256 _timestamp);\\n\\n /// @notice Tracks how much keeper bonds are to be withdrawn\\n /// @param _keeper The address of the keeper\\n /// @param _bonding The address of the token being unbonded\\n /// @return _pendingUnbonds The amount of keeper bonds that are to be withdrawn\\n function pendingUnbonds(address _keeper, address _bonding) external view returns (uint256 _pendingUnbonds);\\n\\n /// @notice Checks whether the address has ever bonded an asset\\n /// @param _keeper The address of the keeper\\n /// @return _hasBonded Whether the address has ever bonded an asset\\n function hasBonded(address _keeper) external view returns (bool _hasBonded);\\n\\n // Methods\\n\\n /// @notice Lists all jobs\\n /// @return _jobList Array with all the jobs in _jobs\\n function jobs() external view returns (address[] memory _jobList);\\n\\n /// @notice Lists all keepers\\n /// @return _keeperList Array with all the keepers in _keepers\\n function keepers() external view returns (address[] memory _keeperList);\\n\\n // Errors\\n\\n /// @notice Throws when an address is passed as a job, but that address is not a job\\n error JobUnavailable();\\n\\n /// @notice Throws when an action that requires an undisputed job is applied on a disputed job\\n error JobDisputed();\\n}\\n\",\"keccak256\":\"0xf4748c236ddf409e45e7169c735e2fc54e627b2b3ccd189ebb438ad768f1deb1\",\"license\":\"MIT\"},\"solidity/interfaces/peripherals/IKeep3rDisputable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4 <0.9.0;\\n\\n/// @title Keep3rDisputable contract\\n/// @notice Creates/resolves disputes for jobs or keepers\\n/// A disputed keeper is slashable and is not able to bond, activate, withdraw or receive direct payments\\n/// A disputed job is slashable and is not able to pay the keepers, withdraw tokens or to migrate\\ninterface IKeep3rDisputable {\\n /// @notice Emitted when a keeper or a job is disputed\\n /// @param _jobOrKeeper The address of the disputed keeper/job\\n /// @param _disputer The user that called the function and disputed the keeper\\n event Dispute(address indexed _jobOrKeeper, address indexed _disputer);\\n\\n /// @notice Emitted when a dispute is resolved\\n /// @param _jobOrKeeper The address of the disputed keeper/job\\n /// @param _resolver The user that called the function and resolved the dispute\\n event Resolve(address indexed _jobOrKeeper, address indexed _resolver);\\n\\n /// @notice Throws when a job or keeper is already disputed\\n error AlreadyDisputed();\\n\\n /// @notice Throws when a job or keeper is not disputed and someone tries to resolve the dispute\\n error NotDisputed();\\n\\n /// @notice Allows governance to create a dispute for a given keeper/job\\n /// @param _jobOrKeeper The address in dispute\\n function dispute(address _jobOrKeeper) external;\\n\\n /// @notice Allows governance to resolve a dispute on a keeper/job\\n /// @param _jobOrKeeper The address cleared\\n function resolve(address _jobOrKeeper) external;\\n}\\n\",\"keccak256\":\"0x002b9b4c75e62d48d74b6447649d39eb5c1e128d2523bb11e08e9cd3e27b1f70\",\"license\":\"MIT\"},\"solidity/interfaces/peripherals/IKeep3rJobs.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4 <0.9.0;\\n\\nimport './IKeep3rDisputable.sol';\\n\\n/// @title Keep3rJobOwnership contract\\n/// @notice Handles the ownership of the jobs\\ninterface IKeep3rJobOwnership {\\n // Events\\n\\n /// @notice Emitted when Keep3rJobOwnership#changeJobOwnership is called\\n /// @param _job The address of the job proposed to have a change of owner\\n /// @param _owner The current owner of the job\\n /// @param _pendingOwner The new address proposed to be the owner of the job\\n event JobOwnershipChange(address indexed _job, address indexed _owner, address indexed _pendingOwner);\\n\\n /// @notice Emitted when Keep3rJobOwnership#JobOwnershipAssent is called\\n /// @param _job The address of the job which the proposed owner will now own\\n /// @param _previousOwner The previous owner of the job\\n /// @param _newOwner The new owner of the job\\n event JobOwnershipAssent(address indexed _job, address indexed _previousOwner, address indexed _newOwner);\\n\\n // Errors\\n\\n /// @notice Throws when the caller of the function is not the job owner\\n error OnlyJobOwner();\\n\\n /// @notice Throws when the caller of the function is not the pending job owner\\n error OnlyPendingJobOwner();\\n\\n // Variables\\n\\n /// @notice Maps the job to the owner of the job\\n /// @param _job The address of the job\\n /// @return _owner The address of the owner of the job\\n function jobOwner(address _job) external view returns (address _owner);\\n\\n /// @notice Maps the job to its pending owner\\n /// @param _job The address of the job\\n /// @return _pendingOwner The address of the pending owner of the job\\n function jobPendingOwner(address _job) external view returns (address _pendingOwner);\\n\\n // Methods\\n\\n /// @notice Proposes a new address to be the owner of the job\\n /// @param _job The address of the job\\n /// @param _newOwner The address of the proposed new owner\\n function changeJobOwnership(address _job, address _newOwner) external;\\n\\n /// @notice The proposed address accepts to be the owner of the job\\n /// @param _job The address of the job\\n function acceptJobOwnership(address _job) external;\\n}\\n\\n/// @title Keep3rJobManager contract\\n/// @notice Handles the addition and withdrawal of credits from a job\\ninterface IKeep3rJobManager is IKeep3rJobOwnership {\\n // Events\\n\\n /// @notice Emitted when Keep3rJobManager#addJob is called\\n /// @param _job The address of the job to add\\n /// @param _jobOwner The job's owner\\n event JobAddition(address indexed _job, address indexed _jobOwner);\\n\\n // Errors\\n\\n /// @notice Throws when trying to add a job that has already been added\\n error JobAlreadyAdded();\\n\\n /// @notice Throws when the address that is trying to register as a keeper is already a keeper\\n error AlreadyAKeeper();\\n\\n // Methods\\n\\n /// @notice Allows any caller to add a new job\\n /// @param _job Address of the contract for which work should be performed\\n function addJob(address _job) external;\\n}\\n\\n/// @title Keep3rJobFundableCredits contract\\n/// @notice Handles the addition and withdrawal of credits from a job\\ninterface IKeep3rJobFundableCredits is IKeep3rJobOwnership {\\n // Events\\n\\n /// @notice Emitted when Keep3rJobFundableCredits#addTokenCreditsToJob is called\\n /// @param _job The address of the job being credited\\n /// @param _token The address of the token being provided\\n /// @param _provider The user that calls the function\\n /// @param _amount The amount of credit being added to the job\\n event TokenCreditAddition(address indexed _job, address indexed _token, address indexed _provider, uint256 _amount);\\n\\n /// @notice Emitted when Keep3rJobFundableCredits#withdrawTokenCreditsFromJob is called\\n /// @param _job The address of the job from which the credits are withdrawn\\n /// @param _token The credit being withdrawn from the job\\n /// @param _receiver The user that receives the tokens\\n /// @param _amount The amount of credit withdrawn\\n event TokenCreditWithdrawal(address indexed _job, address indexed _token, address indexed _receiver, uint256 _amount);\\n\\n // Errors\\n\\n /// @notice Throws when the token is KP3R, as it should not be used for direct token payments\\n error TokenUnallowed();\\n\\n /// @notice Throws when the token withdraw cooldown has not yet passed\\n error JobTokenCreditsLocked();\\n\\n /// @notice Throws when the user tries to withdraw more tokens than it has\\n error InsufficientJobTokenCredits();\\n\\n // Variables\\n\\n /// @notice Last block where tokens were added to the job\\n /// @param _job The address of the job credited\\n /// @param _token The address of the token credited\\n /// @return _timestamp The last block where tokens were added to the job\\n function jobTokenCreditsAddedAt(address _job, address _token) external view returns (uint256 _timestamp);\\n\\n // Methods\\n\\n /// @notice Add credit to a job to be paid out for work\\n /// @param _job The address of the job being credited\\n /// @param _token The address of the token being credited\\n /// @param _amount The amount of credit being added\\n function addTokenCreditsToJob(\\n address _job,\\n address _token,\\n uint256 _amount\\n ) external;\\n\\n /// @notice Withdraw credit from a job\\n /// @param _job The address of the job from which the credits are withdrawn\\n /// @param _token The address of the token being withdrawn\\n /// @param _amount The amount of token to be withdrawn\\n /// @param _receiver The user that will receive tokens\\n function withdrawTokenCreditsFromJob(\\n address _job,\\n address _token,\\n uint256 _amount,\\n address _receiver\\n ) external;\\n}\\n\\n/// @title Keep3rJobFundableLiquidity contract\\n/// @notice Handles the funding of jobs through specific liquidity pairs\\ninterface IKeep3rJobFundableLiquidity is IKeep3rJobOwnership {\\n // Events\\n\\n /// @notice Emitted when Keep3rJobFundableLiquidity#approveLiquidity function is called\\n /// @param _liquidity The address of the liquidity pair being approved\\n event LiquidityApproval(address _liquidity);\\n\\n /// @notice Emitted when Keep3rJobFundableLiquidity#revokeLiquidity function is called\\n /// @param _liquidity The address of the liquidity pair being revoked\\n event LiquidityRevocation(address _liquidity);\\n\\n /// @notice Emitted when IKeep3rJobFundableLiquidity#addLiquidityToJob function is called\\n /// @param _job The address of the job to which liquidity will be added\\n /// @param _liquidity The address of the liquidity being added\\n /// @param _provider The user that calls the function\\n /// @param _amount The amount of liquidity being added\\n event LiquidityAddition(address indexed _job, address indexed _liquidity, address indexed _provider, uint256 _amount);\\n\\n /// @notice Emitted when IKeep3rJobFundableLiquidity#withdrawLiquidityFromJob function is called\\n /// @param _job The address of the job of which liquidity will be withdrawn from\\n /// @param _liquidity The address of the liquidity being withdrawn\\n /// @param _receiver The receiver of the liquidity tokens\\n /// @param _amount The amount of liquidity being withdrawn from the job\\n event LiquidityWithdrawal(address indexed _job, address indexed _liquidity, address indexed _receiver, uint256 _amount);\\n\\n /// @notice Emitted when Keep3rJobFundableLiquidity#addLiquidityToJob function is called\\n /// @param _job The address of the job whose credits will be updated\\n /// @param _rewardedAt The time at which the job was last rewarded\\n /// @param _currentCredits The current credits of the job\\n /// @param _periodCredits The credits of the job for the current period\\n event LiquidityCreditsReward(address indexed _job, uint256 _rewardedAt, uint256 _currentCredits, uint256 _periodCredits);\\n\\n /// @notice Emitted when Keep3rJobFundableLiquidity#forceLiquidityCreditsToJob function is called\\n /// @param _job The address of the job whose credits will be updated\\n /// @param _rewardedAt The time at which the job was last rewarded\\n /// @param _currentCredits The current credits of the job\\n event LiquidityCreditsForced(address indexed _job, uint256 _rewardedAt, uint256 _currentCredits);\\n\\n // Errors\\n\\n /// @notice Throws when the liquidity being approved has already been approved\\n error LiquidityPairApproved();\\n\\n /// @notice Throws when the liquidity being removed has not been approved\\n error LiquidityPairUnexistent();\\n\\n /// @notice Throws when trying to add liquidity to an unapproved pool\\n error LiquidityPairUnapproved();\\n\\n /// @notice Throws when the job doesn't have the requested liquidity\\n error JobLiquidityUnexistent();\\n\\n /// @notice Throws when trying to remove more liquidity than the job has\\n error JobLiquidityInsufficient();\\n\\n /// @notice Throws when trying to add less liquidity than the minimum liquidity required\\n error JobLiquidityLessThanMin();\\n\\n // Structs\\n\\n /// @notice Stores the tick information of the different liquidity pairs\\n struct TickCache {\\n int56 current; // Tracks the current tick\\n int56 difference; // Stores the difference between the current tick and the last tick\\n uint256 period; // Stores the period at which the last observation was made\\n }\\n\\n // Variables\\n\\n /// @notice Lists liquidity pairs\\n /// @return _list An array of addresses with all the approved liquidity pairs\\n function approvedLiquidities() external view returns (address[] memory _list);\\n\\n /// @notice Amount of liquidity in a specified job\\n /// @param _job The address of the job being checked\\n /// @param _liquidity The address of the liquidity we are checking\\n /// @return _amount Amount of liquidity in the specified job\\n function liquidityAmount(address _job, address _liquidity) external view returns (uint256 _amount);\\n\\n /// @notice Last time the job was rewarded liquidity credits\\n /// @param _job The address of the job being checked\\n /// @return _timestamp Timestamp of the last time the job was rewarded liquidity credits\\n function rewardedAt(address _job) external view returns (uint256 _timestamp);\\n\\n /// @notice Last time the job was worked\\n /// @param _job The address of the job being checked\\n /// @return _timestamp Timestamp of the last time the job was worked\\n function workedAt(address _job) external view returns (uint256 _timestamp);\\n\\n // Methods\\n\\n /// @notice Returns the liquidity credits of a given job\\n /// @param _job The address of the job of which we want to know the liquidity credits\\n /// @return _amount The liquidity credits of a given job\\n function jobLiquidityCredits(address _job) external view returns (uint256 _amount);\\n\\n /// @notice Returns the credits of a given job for the current period\\n /// @param _job The address of the job of which we want to know the period credits\\n /// @return _amount The credits the given job has at the current period\\n function jobPeriodCredits(address _job) external view returns (uint256 _amount);\\n\\n /// @notice Calculates the total credits of a given job\\n /// @param _job The address of the job of which we want to know the total credits\\n /// @return _amount The total credits of the given job\\n function totalJobCredits(address _job) external view returns (uint256 _amount);\\n\\n /// @notice Calculates how many credits should be rewarded periodically for a given liquidity amount\\n /// @dev _periodCredits = underlying KP3Rs for given liquidity amount * rewardPeriod / inflationPeriod\\n /// @param _liquidity The address of the liquidity to provide\\n /// @param _amount The amount of liquidity to provide\\n /// @return _periodCredits The amount of KP3R periodically minted for the given liquidity\\n function quoteLiquidity(address _liquidity, uint256 _amount) external view returns (uint256 _periodCredits);\\n\\n /// @notice Observes the current state of the liquidity pair being observed and updates TickCache with the information\\n /// @param _liquidity The address of the liquidity pair being observed\\n /// @return _tickCache The updated TickCache\\n function observeLiquidity(address _liquidity) external view returns (TickCache memory _tickCache);\\n\\n /// @notice Gifts liquidity credits to the specified job\\n /// @param _job The address of the job being credited\\n /// @param _amount The amount of liquidity credits to gift\\n function forceLiquidityCreditsToJob(address _job, uint256 _amount) external;\\n\\n /// @notice Approve a liquidity pair for being accepted in future\\n /// @param _liquidity The address of the liquidity accepted\\n function approveLiquidity(address _liquidity) external;\\n\\n /// @notice Revoke a liquidity pair from being accepted in future\\n /// @param _liquidity The liquidity no longer accepted\\n function revokeLiquidity(address _liquidity) external;\\n\\n /// @notice Allows anyone to fund a job with liquidity\\n /// @param _job The address of the job to assign liquidity to\\n /// @param _liquidity The liquidity being added\\n /// @param _amount The amount of liquidity tokens to add\\n function addLiquidityToJob(\\n address _job,\\n address _liquidity,\\n uint256 _amount\\n ) external;\\n\\n /// @notice Unbond liquidity for a job\\n /// @dev Can only be called by the job's owner\\n /// @param _job The address of the job being unbonded from\\n /// @param _liquidity The liquidity being unbonded\\n /// @param _amount The amount of liquidity being removed\\n function unbondLiquidityFromJob(\\n address _job,\\n address _liquidity,\\n uint256 _amount\\n ) external;\\n\\n /// @notice Withdraw liquidity from a job\\n /// @param _job The address of the job being withdrawn from\\n /// @param _liquidity The liquidity being withdrawn\\n /// @param _receiver The address that will receive the withdrawn liquidity\\n function withdrawLiquidityFromJob(\\n address _job,\\n address _liquidity,\\n address _receiver\\n ) external;\\n}\\n\\n/// @title Keep3rJobMigration contract\\n/// @notice Handles the migration process of jobs to different addresses\\ninterface IKeep3rJobMigration is IKeep3rJobFundableCredits, IKeep3rJobFundableLiquidity {\\n // Events\\n\\n /// @notice Emitted when Keep3rJobMigration#migrateJob function is called\\n /// @param _fromJob The address of the job that requests to migrate\\n /// @param _toJob The address at which the job requests to migrate\\n event JobMigrationRequested(address indexed _fromJob, address _toJob);\\n\\n /// @notice Emitted when Keep3rJobMigration#acceptJobMigration function is called\\n /// @param _fromJob The address of the job that requested to migrate\\n /// @param _toJob The address at which the job had requested to migrate\\n event JobMigrationSuccessful(address _fromJob, address indexed _toJob);\\n\\n // Errors\\n\\n /// @notice Throws when the address of the job that requests to migrate wants to migrate to its same address\\n error JobMigrationImpossible();\\n\\n /// @notice Throws when the _toJob address differs from the address being tracked in the pendingJobMigrations mapping\\n error JobMigrationUnavailable();\\n\\n /// @notice Throws when cooldown between migrations has not yet passed\\n error JobMigrationLocked();\\n\\n // Variables\\n\\n /// @notice Maps the jobs that have requested a migration to the address they have requested to migrate to\\n /// @return _toJob The address to which the job has requested to migrate to\\n function pendingJobMigrations(address _fromJob) external view returns (address _toJob);\\n\\n // Methods\\n\\n /// @notice Initializes the migration process for a job by adding the request to the pendingJobMigrations mapping\\n /// @param _fromJob The address of the job that is requesting to migrate\\n /// @param _toJob The address at which the job is requesting to migrate\\n function migrateJob(address _fromJob, address _toJob) external;\\n\\n /// @notice Completes the migration process for a job\\n /// @dev Unbond/withdraw process doesn't get migrated\\n /// @param _fromJob The address of the job that requested to migrate\\n /// @param _toJob The address to which the job wants to migrate to\\n function acceptJobMigration(address _fromJob, address _toJob) external;\\n}\\n\\n/// @title Keep3rJobWorkable contract\\n/// @notice Handles the mechanisms jobs can pay keepers with along with the restrictions jobs can put on keepers before they can work on jobs\\ninterface IKeep3rJobWorkable is IKeep3rJobMigration {\\n // Events\\n\\n /// @notice Emitted when a keeper is validated before a job\\n /// @param _gasLeft The amount of gas that the transaction has left at the moment of keeper validation\\n event KeeperValidation(uint256 _gasLeft);\\n\\n /// @notice Emitted when a keeper works a job\\n /// @param _credit The address of the asset in which the keeper is paid\\n /// @param _job The address of the job the keeper has worked\\n /// @param _keeper The address of the keeper that has worked the job\\n /// @param _payment The amount that has been paid out to the keeper in exchange for working the job\\n /// @param _gasLeft The amount of gas that the transaction has left at the moment of payment\\n event KeeperWork(address indexed _credit, address indexed _job, address indexed _keeper, uint256 _payment, uint256 _gasLeft);\\n\\n // Errors\\n\\n /// @notice Throws if work method was called without calling isKeeper or isBondedKeeper\\n error GasNotInitialized();\\n\\n /// @notice Throws if the address claiming to be a job is not in the list of approved jobs\\n error JobUnapproved();\\n\\n /// @notice Throws if the amount of funds in the job is less than the payment that must be paid to the keeper that works that job\\n error InsufficientFunds();\\n\\n // Methods\\n\\n /// @notice Confirms if the current keeper is registered\\n /// @dev Can be used for general (non critical) functions\\n /// @param _keeper The keeper being investigated\\n /// @return _isKeeper Whether the address passed as a parameter is a keeper or not\\n function isKeeper(address _keeper) external returns (bool _isKeeper);\\n\\n /// @notice Confirms if the current keeper is registered and has a minimum bond of any asset.\\n /// @dev Should be used for protected functions\\n /// @param _keeper The keeper to check\\n /// @param _bond The bond token being evaluated\\n /// @param _minBond The minimum amount of bonded tokens\\n /// @param _earned The minimum funds earned in the keepers lifetime\\n /// @param _age The minimum keeper age required\\n /// @return _isBondedKeeper Whether the `_keeper` meets the given requirements\\n function isBondedKeeper(\\n address _keeper,\\n address _bond,\\n uint256 _minBond,\\n uint256 _earned,\\n uint256 _age\\n ) external returns (bool _isBondedKeeper);\\n\\n /// @notice Implemented by jobs to show that a keeper performed work\\n /// @dev Automatically calculates the payment for the keeper and pays the keeper with bonded KP3R\\n /// @param _keeper Address of the keeper that performed the work\\n function worked(address _keeper) external;\\n\\n /// @notice Implemented by jobs to show that a keeper performed work\\n /// @dev Pays the keeper that performs the work with KP3R\\n /// @param _keeper Address of the keeper that performed the work\\n /// @param _payment The reward that should be allocated for the job\\n function bondedPayment(address _keeper, uint256 _payment) external;\\n\\n /// @notice Implemented by jobs to show that a keeper performed work\\n /// @dev Pays the keeper that performs the work with a specific token\\n /// @param _token The asset being awarded to the keeper\\n /// @param _keeper Address of the keeper that performed the work\\n /// @param _amount The reward that should be allocated\\n function directTokenPayment(\\n address _token,\\n address _keeper,\\n uint256 _amount\\n ) external;\\n}\\n\\n/// @title Keep3rJobDisputable contract\\n/// @notice Handles the actions that can be taken on a disputed job\\ninterface IKeep3rJobDisputable is IKeep3rDisputable, IKeep3rJobFundableCredits, IKeep3rJobFundableLiquidity {\\n // Events\\n\\n /// @notice Emitted when Keep3rJobDisputable#slashTokenFromJob is called\\n /// @param _job The address of the job from which the token will be slashed\\n /// @param _token The address of the token being slashed\\n /// @param _slasher The user that slashes the token\\n /// @param _amount The amount of the token being slashed\\n event JobSlashToken(address indexed _job, address _token, address indexed _slasher, uint256 _amount);\\n\\n /// @notice Emitted when Keep3rJobDisputable#slashLiquidityFromJob is called\\n /// @param _job The address of the job from which the liquidity will be slashed\\n /// @param _liquidity The address of the liquidity being slashed\\n /// @param _slasher The user that slashes the liquidity\\n /// @param _amount The amount of the liquidity being slashed\\n event JobSlashLiquidity(address indexed _job, address _liquidity, address indexed _slasher, uint256 _amount);\\n\\n // Errors\\n\\n /// @notice Throws when the token trying to be slashed doesn't exist\\n error JobTokenUnexistent();\\n\\n /// @notice Throws when someone tries to slash more tokens than the job has\\n error JobTokenInsufficient();\\n\\n // Methods\\n\\n /// @notice Allows governance or slasher to slash a job specific token\\n /// @param _job The address of the job from which the token will be slashed\\n /// @param _token The address of the token that will be slashed\\n /// @param _amount The amount of the token that will be slashed\\n function slashTokenFromJob(\\n address _job,\\n address _token,\\n uint256 _amount\\n ) external;\\n\\n /// @notice Allows governance or a slasher to slash liquidity from a job\\n /// @param _job The address being slashed\\n /// @param _liquidity The address of the liquidity that will be slashed\\n /// @param _amount The amount of liquidity that will be slashed\\n function slashLiquidityFromJob(\\n address _job,\\n address _liquidity,\\n uint256 _amount\\n ) external;\\n}\\n\\n// solhint-disable-next-line no-empty-blocks\\ninterface IKeep3rJobs is IKeep3rJobWorkable, IKeep3rJobManager, IKeep3rJobDisputable {\\n\\n}\\n\",\"keccak256\":\"0x08915189f1a9484d17a51b7fb343b765b9edba29062bb644af9663af18f03e34\",\"license\":\"MIT\"},\"solidity/interfaces/peripherals/IKeep3rKeepers.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4 <0.9.0;\\n\\nimport './IKeep3rDisputable.sol';\\n\\n/// @title Keep3rKeeperFundable contract\\n/// @notice Handles the actions required to become a keeper\\ninterface IKeep3rKeeperFundable {\\n // Events\\n\\n /// @notice Emitted when Keep3rKeeperFundable#activate is called\\n /// @param _keeper The keeper that has been activated\\n /// @param _bond The asset the keeper has bonded\\n /// @param _amount The amount of the asset the keeper has bonded\\n event Activation(address indexed _keeper, address indexed _bond, uint256 _amount);\\n\\n /// @notice Emitted when Keep3rKeeperFundable#withdraw is called\\n /// @param _keeper The caller of Keep3rKeeperFundable#withdraw function\\n /// @param _bond The asset to withdraw from the bonding pool\\n /// @param _amount The amount of funds withdrawn\\n event Withdrawal(address indexed _keeper, address indexed _bond, uint256 _amount);\\n\\n // Errors\\n\\n /// @notice Throws when the address that is trying to register as a job is already a job\\n error AlreadyAJob();\\n\\n // Methods\\n\\n /// @notice Beginning of the bonding process\\n /// @param _bonding The asset being bonded\\n /// @param _amount The amount of bonding asset being bonded\\n function bond(address _bonding, uint256 _amount) external;\\n\\n /// @notice Beginning of the unbonding process\\n /// @param _bonding The asset being unbonded\\n /// @param _amount Allows for partial unbonding\\n function unbond(address _bonding, uint256 _amount) external;\\n\\n /// @notice End of the bonding process after bonding time has passed\\n /// @param _bonding The asset being activated as bond collateral\\n function activate(address _bonding) external;\\n\\n /// @notice Withdraw funds after unbonding has finished\\n /// @param _bonding The asset to withdraw from the bonding pool\\n function withdraw(address _bonding) external;\\n}\\n\\n/// @title Keep3rKeeperDisputable contract\\n/// @notice Handles the actions that can be taken on a disputed keeper\\ninterface IKeep3rKeeperDisputable is IKeep3rDisputable, IKeep3rKeeperFundable {\\n // Events\\n\\n /// @notice Emitted when Keep3rKeeperDisputable#slash is called\\n /// @param _keeper The address of the slashed keeper\\n /// @param _slasher The user that called Keep3rKeeperDisputable#slash\\n /// @param _amount The amount of credits slashed from the keeper\\n event KeeperSlash(address indexed _keeper, address indexed _slasher, uint256 _amount);\\n\\n /// @notice Emitted when Keep3rKeeperDisputable#revoke is called\\n /// @param _keeper The address of the revoked keeper\\n /// @param _slasher The user that called Keep3rKeeperDisputable#revoke\\n event KeeperRevoke(address indexed _keeper, address indexed _slasher);\\n\\n // Methods\\n\\n /// @notice Allows governance to slash a keeper based on a dispute\\n /// @param _keeper The address being slashed\\n /// @param _bonded The asset being slashed\\n /// @param _bondAmount The bonded amount being slashed\\n /// @param _unbondAmount The pending unbond amount being slashed\\n function slash(\\n address _keeper,\\n address _bonded,\\n uint256 _bondAmount,\\n uint256 _unbondAmount\\n ) external;\\n\\n /// @notice Blacklists a keeper from participating in the network\\n /// @param _keeper The address being slashed\\n function revoke(address _keeper) external;\\n}\\n\\n// solhint-disable-next-line no-empty-blocks\\n\\n/// @title Keep3rKeepers contract\\ninterface IKeep3rKeepers is IKeep3rKeeperDisputable {\\n\\n}\\n\",\"keccak256\":\"0xc95e6bba82a8371c6bd15a8e9d0df91c826b5050b8ee01d913c1c13a4e92a49b\",\"license\":\"MIT\"},\"solidity/interfaces/peripherals/IKeep3rParameters.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4 <0.9.0;\\n\\nimport './IKeep3rAccountance.sol';\\n\\n/// @title Keep3rParameters contract\\n/// @notice Handles and sets all the required parameters for Keep3r\\ninterface IKeep3rParameters is IKeep3rAccountance {\\n // Events\\n\\n /// @notice Emitted when the Keep3rHelper address is changed\\n /// @param _keep3rHelper The address of Keep3rHelper's contract\\n event Keep3rHelperChange(address _keep3rHelper);\\n\\n /// @notice Emitted when the Keep3rV1 address is changed\\n /// @param _keep3rV1 The address of Keep3rV1's contract\\n event Keep3rV1Change(address _keep3rV1);\\n\\n /// @notice Emitted when the Keep3rV1Proxy address is changed\\n /// @param _keep3rV1Proxy The address of Keep3rV1Proxy's contract\\n event Keep3rV1ProxyChange(address _keep3rV1Proxy);\\n\\n /// @notice Emitted when bondTime is changed\\n /// @param _bondTime The new bondTime\\n event BondTimeChange(uint256 _bondTime);\\n\\n /// @notice Emitted when _liquidityMinimum is changed\\n /// @param _liquidityMinimum The new _liquidityMinimum\\n event LiquidityMinimumChange(uint256 _liquidityMinimum);\\n\\n /// @notice Emitted when _unbondTime is changed\\n /// @param _unbondTime The new _unbondTime\\n event UnbondTimeChange(uint256 _unbondTime);\\n\\n /// @notice Emitted when _rewardPeriodTime is changed\\n /// @param _rewardPeriodTime The new _rewardPeriodTime\\n event RewardPeriodTimeChange(uint256 _rewardPeriodTime);\\n\\n /// @notice Emitted when the inflationPeriod is changed\\n /// @param _inflationPeriod The new inflationPeriod\\n event InflationPeriodChange(uint256 _inflationPeriod);\\n\\n /// @notice Emitted when the fee is changed\\n /// @param _fee The new token credits fee\\n event FeeChange(uint256 _fee);\\n\\n // Variables\\n\\n /// @notice Address of Keep3rHelper's contract\\n /// @return _keep3rHelper The address of Keep3rHelper's contract\\n function keep3rHelper() external view returns (address _keep3rHelper);\\n\\n /// @notice Address of Keep3rV1's contract\\n /// @return _keep3rV1 The address of Keep3rV1's contract\\n function keep3rV1() external view returns (address _keep3rV1);\\n\\n /// @notice Address of Keep3rV1Proxy's contract\\n /// @return _keep3rV1Proxy The address of Keep3rV1Proxy's contract\\n function keep3rV1Proxy() external view returns (address _keep3rV1Proxy);\\n\\n /// @notice The amount of time required to pass after a keeper has bonded assets for it to be able to activate\\n /// @return _days The required bondTime in days\\n function bondTime() external view returns (uint256 _days);\\n\\n /// @notice The amount of time required to pass before a keeper can unbond what he has bonded\\n /// @return _days The required unbondTime in days\\n function unbondTime() external view returns (uint256 _days);\\n\\n /// @notice The minimum amount of liquidity required to fund a job per liquidity\\n /// @return _amount The minimum amount of liquidity in KP3R\\n function liquidityMinimum() external view returns (uint256 _amount);\\n\\n /// @notice The amount of time between each scheduled credits reward given to a job\\n /// @return _days The reward period in days\\n function rewardPeriodTime() external view returns (uint256 _days);\\n\\n /// @notice The inflation period is the denominator used to regulate the emission of KP3R\\n /// @return _period The denominator used to regulate the emission of KP3R\\n function inflationPeriod() external view returns (uint256 _period);\\n\\n /// @notice The fee to be sent to governance when a user adds liquidity to a job\\n /// @return _amount The fee amount to be sent to governance when a user adds liquidity to a job\\n function fee() external view returns (uint256 _amount);\\n\\n // Errors\\n\\n /// @notice Throws if the reward period is less than the minimum reward period time\\n error MinRewardPeriod();\\n\\n /// @notice Throws if either a job or a keeper is disputed\\n error Disputed();\\n\\n /// @notice Throws if there are no bonded assets\\n error BondsUnexistent();\\n\\n /// @notice Throws if the time required to bond an asset has not passed yet\\n error BondsLocked();\\n\\n /// @notice Throws if there are no bonds to withdraw\\n error UnbondsUnexistent();\\n\\n /// @notice Throws if the time required to withdraw the bonds has not passed yet\\n error UnbondsLocked();\\n\\n // Methods\\n\\n /// @notice Sets the Keep3rHelper address\\n /// @param _keep3rHelper The Keep3rHelper address\\n function setKeep3rHelper(address _keep3rHelper) external;\\n\\n /// @notice Sets the Keep3rV1 address\\n /// @param _keep3rV1 The Keep3rV1 address\\n function setKeep3rV1(address _keep3rV1) external;\\n\\n /// @notice Sets the Keep3rV1Proxy address\\n /// @param _keep3rV1Proxy The Keep3rV1Proxy address\\n function setKeep3rV1Proxy(address _keep3rV1Proxy) external;\\n\\n /// @notice Sets the bond time required to activate as a keeper\\n /// @param _bond The new bond time\\n function setBondTime(uint256 _bond) external;\\n\\n /// @notice Sets the unbond time required unbond what has been bonded\\n /// @param _unbond The new unbond time\\n function setUnbondTime(uint256 _unbond) external;\\n\\n /// @notice Sets the minimum amount of liquidity required to fund a job\\n /// @param _liquidityMinimum The new minimum amount of liquidity\\n function setLiquidityMinimum(uint256 _liquidityMinimum) external;\\n\\n /// @notice Sets the time required to pass between rewards for jobs\\n /// @param _rewardPeriodTime The new amount of time required to pass between rewards\\n function setRewardPeriodTime(uint256 _rewardPeriodTime) external;\\n\\n /// @notice Sets the new inflation period\\n /// @param _inflationPeriod The new inflation period\\n function setInflationPeriod(uint256 _inflationPeriod) external;\\n\\n /// @notice Sets the new fee\\n /// @param _fee The new fee\\n function setFee(uint256 _fee) external;\\n}\\n\",\"keccak256\":\"0x942f99c6e3b229a551faaae8f03000b934b20502a7cfade14780508201fd098e\",\"license\":\"MIT\"},\"solidity/interfaces/peripherals/IKeep3rRoles.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4 <0.9.0;\\n\\nimport './IBaseErrors.sol';\\nimport './IGovernable.sol';\\nimport './IDustCollector.sol';\\n\\n/// @title Keep3rRoles contract\\n/// @notice Manages the Keep3r specific roles\\ninterface IKeep3rRoles is IBaseErrors, IDustCollector, IGovernable {\\n // Events\\n\\n /// @notice Emitted when a slasher is added\\n /// @param _slasher Address of the added slasher\\n event SlasherAdded(address _slasher);\\n\\n /// @notice Emitted when a slasher is removed\\n /// @param _slasher Address of the removed slasher\\n event SlasherRemoved(address _slasher);\\n\\n /// @notice Emitted when a disputer is added\\n /// @param _disputer Address of the added disputer\\n event DisputerAdded(address _disputer);\\n\\n /// @notice Emitted when a disputer is removed\\n /// @param _disputer Address of the removed disputer\\n event DisputerRemoved(address _disputer);\\n\\n // Variables\\n\\n /// @notice Tracks whether the address is a slasher or not\\n /// @param _slasher Address being checked as a slasher\\n /// @return _isSlasher Whether the address is a slasher or not\\n function slashers(address _slasher) external view returns (bool _isSlasher);\\n\\n /// @notice Tracks whether the address is a disputer or not\\n /// @param _disputer Address being checked as a disputer\\n /// @return _isDisputer Whether the address is a disputer or not\\n function disputers(address _disputer) external view returns (bool _isDisputer);\\n\\n // Errors\\n\\n /// @notice Throws if the address is already a registered slasher\\n error SlasherExistent();\\n\\n /// @notice Throws if caller is not a registered slasher\\n error SlasherUnexistent();\\n\\n /// @notice Throws if the address is already a registered disputer\\n error DisputerExistent();\\n\\n /// @notice Throws if caller is not a registered disputer\\n error DisputerUnexistent();\\n\\n /// @notice Throws if the msg.sender is not a slasher or is not a part of governance\\n error OnlySlasher();\\n\\n /// @notice Throws if the msg.sender is not a disputer or is not a part of governance\\n error OnlyDisputer();\\n\\n // Methods\\n\\n /// @notice Registers a slasher by updating the slashers mapping\\n function addSlasher(address _slasher) external;\\n\\n /// @notice Removes a slasher by updating the slashers mapping\\n function removeSlasher(address _slasher) external;\\n\\n /// @notice Registers a disputer by updating the disputers mapping\\n function addDisputer(address _disputer) external;\\n\\n /// @notice Removes a disputer by updating the disputers mapping\\n function removeDisputer(address _disputer) external;\\n}\\n\",\"keccak256\":\"0xe6eca166cf6ad99e5379d754030222873bb9868ff3e2a76de815a438ead533a2\",\"license\":\"MIT\"},\"solidity/interfaces/peripherals/IMintable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4 <0.9.0;\\n\\nimport './IGovernable.sol';\\nimport './IBaseErrors.sol';\\n\\n/// @title Mintable contract\\n/// @notice Manages the minter role\\ninterface IMintable is IBaseErrors, IGovernable {\\n // Events\\n\\n /// @notice Emitted when governance sets a new minter\\n /// @param _minter Address of the new minter\\n event MinterSet(address _minter);\\n\\n // Errors\\n\\n /// @notice Throws if the caller of the function is not the minter\\n error OnlyMinter();\\n\\n // Variables\\n\\n /// @notice Stores the minter address\\n /// @return _minter The minter addresss\\n function minter() external view returns (address _minter);\\n\\n // Methods\\n\\n /// @notice Sets a new address to be the minter\\n /// @param _minter The address set as the minter\\n function setMinter(address _minter) external;\\n}\\n\",\"keccak256\":\"0x255f4ed4b7c4ddf4fcff9db7524365ef734806583acca7c7912e867f110d9c81\",\"license\":\"MIT\"},\"solidity/interfaces/sidechain/IKeep3rEscrow.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4 <0.9.0;\\n\\n// solhint-disable-next-line no-empty-blocks\\n\\nimport '../peripherals/IMintable.sol';\\n\\n/// @title Keep3rEscrow contract\\n/// @notice This contract acts as an escrow contract for wKP3R tokens on sidechains and L2s\\n/// @dev Can be used as a replacement for keep3rV1Proxy in keep3r sidechain implementations\\ninterface IKeep3rEscrow is IMintable {\\n /// @notice Emitted when Keep3rEscrow#deposit function is called\\n /// @param _wKP3R The addess of the wrapped KP3R token\\n /// @param _sender The address that called the function\\n /// @param _amount The amount of wKP3R the user deposited\\n event wKP3RDeposited(address _wKP3R, address _sender, uint256 _amount);\\n\\n /// @notice Emitted when Keep3rEscrow#mint function is called\\n /// @param _wKP3R The addess of the wrapped KP3R token\\n /// @param _recipient The address that will received the newly minted wKP3R\\n /// @param _amount The amount of wKP3R minted to the recipient\\n event wKP3RMinted(address _wKP3R, address _recipient, uint256 _amount);\\n\\n /// @notice Emitted when Keep3rEscrow#setWKP3R function is called\\n /// @param _newWKP3R The address of the wKP3R contract\\n event wKP3RSet(address _newWKP3R);\\n\\n /// @notice Throws when minter attempts to withdraw more wKP3R than the escrow has in its balance\\n error InsufficientBalance();\\n\\n /// @notice Lists the address of the wKP3R contract\\n /// @return _wKP3RAddress The address of wKP3R\\n function wKP3R() external view returns (address _wKP3RAddress);\\n\\n /// @notice Deposits wKP3R into the contract\\n /// @param _amount The amount of wKP3R to deposit\\n function deposit(uint256 _amount) external;\\n\\n /// @notice mints wKP3R to the recipient\\n /// @param _amount The amount of wKP3R to mint\\n function mint(uint256 _amount) external;\\n\\n /// @notice sets the wKP3R address\\n /// @param _wKP3R the wKP3R address\\n function setWKP3R(address _wKP3R) external;\\n}\\n\",\"keccak256\":\"0xf4796dde1afba7f50805aeae92ac0a4848525aeca8355d9b1c6b36c15cca4322\",\"license\":\"MIT\"},\"solidity/interfaces/sidechain/IKeep3rHelperSidechain.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4 <0.9.0;\\n\\nimport '../IKeep3rHelper.sol';\\n\\n/// @title Keep3rHelperSidechain contract\\n/// @notice Contains all the helper functions for sidechain keep3r implementations\\ninterface IKeep3rHelperSidechain is IKeep3rHelper {\\n // Events\\n\\n /// @notice The oracle for a liquidity has been saved\\n /// @param _liquidity The address of the given liquidity\\n /// @param _oraclePool The address of the oracle pool\\n event OracleSet(address _liquidity, address _oraclePool);\\n\\n /// @notice Emitted when the WETH USD pool is changed\\n /// @param _address Address of the new WETH USD pool\\n /// @param _isWETHToken0 True if calling the token0 method of the pool returns the WETH token address\\n event WethUSDPoolChange(address _address, bool _isWETHToken0);\\n\\n /// Variables\\n\\n /// @notice Ethereum mainnet WETH address used for quoting references\\n /// @return _weth Address of WETH token\\n // solhint-disable func-name-mixedcase\\n function WETH() external view returns (address _weth);\\n\\n /// @return _oracle The address of the observable pool for given liquidity\\n function oracle(address _liquidity) external view returns (address _oracle);\\n\\n /// @notice WETH-USD pool that is being used as oracle\\n /// @return poolAddress Address of the pool\\n /// @return isTKNToken0 True if calling the token0 method of the pool returns the WETH token address\\n function wethUSDPool() external view returns (address poolAddress, bool isTKNToken0);\\n\\n /// @notice Quotes USD to ETH\\n /// @dev Used to know how much ETH should be paid to keepers before converting it from ETH to KP3R\\n /// @param _usd The amount of USD to quote to ETH\\n /// @return _eth The resulting amount of ETH after quoting the USD\\n function quoteUsdToEth(uint256 _usd) external returns (uint256 _eth);\\n\\n /// Methods\\n\\n /// @notice Sets an oracle for a given liquidity\\n /// @param _liquidity The address of the liquidity\\n /// @param _oracle The address of the pool used to quote the liquidity from\\n /// @dev The oracle must contain KP3R as either token0 or token1\\n function setOracle(address _liquidity, address _oracle) external;\\n\\n /// @notice Sets an oracle for querying WETH/USD quote\\n /// @param _poolAddress The address of the pool used as oracle\\n /// @dev The oracle must contain WETH as either token0 or token1\\n function setWethUsdPool(address _poolAddress) external;\\n}\\n\",\"keccak256\":\"0xb6d5459e8a47ab09a052e1acac1c28304f9f0762d20f01819559b4d39729c987\",\"license\":\"MIT\"},\"solidity/interfaces/sidechain/IKeep3rJobWorkableRated.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4 <0.9.0;\\n\\nimport '../peripherals/IKeep3rJobs.sol';\\n\\n/// @title Keep3rJobWorkableRated contract\\n/// @notice Implements a quoting in USD per gas unit for Keep3r jobs\\ninterface IKeep3rJobWorkableRated is IKeep3rJobs {\\n /// @notice Throws when job contract calls deprecated worked(address) function\\n error Deprecated();\\n\\n /// @notice Implemented by jobs to show that a keeper performed work and reward in stable USD quote\\n /// @dev Automatically calculates the payment for the keeper and pays the keeper with bonded KP3R\\n /// @param _keeper Address of the keeper that performed the work\\n /// @param _usdPerGasUnit Amount of USD in wei rewarded for gas unit worked by the keeper\\n function worked(address _keeper, uint256 _usdPerGasUnit) external;\\n}\\n\",\"keccak256\":\"0xce2c2721f1df7d944bf3ae20331cb628d38247e667c47bf4a33a90f0b5753884\",\"license\":\"MIT\"},\"solidity/interfaces/sidechain/IKeep3rSidechainAccountance.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4 <0.9.0;\\n\\n/// @title IKeep3rSidechainAccountance interface\\n/// @notice Implements a view to get the amount of credits that can be withdrawn\\ninterface IKeep3rSidechainAccountance {\\n /// @notice The surplus amount of wKP3Rs in escrow contract\\n /// @return _virtualReserves The surplus amount of wKP3Rs in escrow contract\\n function virtualReserves() external view returns (int256 _virtualReserves);\\n}\\n\",\"keccak256\":\"0x4c11242f13d72b5db97e89672d09a771abb903e795ff85588d02c8e11fdc435e\",\"license\":\"MIT\"}},\"version\":1}", - "bytecode": "0x60806040526203f480601f55621275006020556729a2241af62c000060215562069780602255622cd300602355601e6024553480156200003e57600080fd5b506040516200603238038062006032833981016040819052620000619162000133565b6001600055838383838383838382828286806001600160a01b0381166200009a5760405162b293ed60e81b815260040160405180910390fd5b600380546001600160a01b03199081166001600160a01b0393841617909155601e8054821696831696909617909555601c805486169482169490941790935550601d8054909316911617905550506000601f81905560205550506001602155505062015180602255505062069780602355506200019092505050565b80516001600160a01b03811681146200012e57600080fd5b919050565b600080600080608085870312156200014a57600080fd5b620001558562000116565b9350620001656020860162000116565b9250620001756040860162000116565b9150620001856060860162000116565b905092959194509250565b615e9280620001a06000396000f3fe608060405234801561001057600080fd5b50600436106104075760003560e01c8063966abd0011610228578063c5198abc1161013c578063ec8ca643116100be578063ec8ca64314610add578063f0f346b914610b06578063f11a1d1a14610b19578063f136a09d14610b2c578063f25e311b14610b4c578063f263c47014610b5f578063f39c38a014610b68578063f75f9f7b14610b7b578063f9d46cf214610b8e578063fc253d2b14610ba1578063fe75bc4614610baa57600080fd5b8063c5198abc146109f1578063c7ae40d014610a04578063cb4be2bb14610a17578063cb54694d14610a2a578063cd22af1b14610a3d578063d55995fe14610a68578063dd2080d614610a7b578063ddca3f4314610a8e578063e326ac4314610a97578063ebbb619414610ab7578063ec00cdfc14610aca57600080fd5b8063966abd001461080457806398e90a0f146108175780639d5c33d814610840578063a214580914610853578063a39744b514610866578063a515366a14610891578063a5d059ca146108a4578063a676f9ff146108b7578063a7d2e784146108d7578063aac6aa9c146108e0578063ab033ea9146108f3578063af320e8114610906578063b0103b1a14610919578063b0f328f11461093c578063b239223314610944578063b440027f14610957578063b600702a14610982578063b70362b914610995578063b7e77340146109a8578063b87fcbff146109bb578063c20297f0146109de57600080fd5b80635aa6e6751161031f5780635aa6e6751461066b5780635ebe23f01461067e5780635feeb79414610687578063633fb68f1461069a57806364bb43ee146106a357806368a9f19c146106b6578063694798e6146106c957806369fe0e2d146106f45780636ba42aaa146107075780636cf262bc1461071a5780636e2a9ca61461072d57806372da828a1461074057806374a8f10314610753578063768b5d90146107665780637c8fce231461076f578063878c723e146107775780638bb6dfa8146107a05780638cb22b76146107b35780638fe204dd146107d657806390a4684e146107e9578063951dc22c146107fc57600080fd5b8063034d4c611461040c57806307b435c2146104325780630c620bce1461045d5780630d6a1f87146104725780631101eb411461048557806311466d721461049a57806315006b82146104ad578063165e62e7146104d8578063168f92e7146105155780631b44555e146105405780631c5a9d9c146105605780631ef94b911461057357806321040b0114610593578063238efcbc146105be578063274a8db4146105c657806351cff8d9146105f957806352a4de291461060c57806355ea6c471461061f578063575288bf14610632578063594a3a931461064557806359a2255e14610658575b600080fd5b61041f61041a3660046157a4565b610bbd565b6040519081526020015b60405180910390f35b61041f6104403660046157de565b601760209081526000928352604080842090915290825290205481565b610465610cc3565b6040516104299190615b53565b61041f61048036600461598d565b610cd4565b610498610493366004615862565b610dda565b005b6104986104a836600461598d565b610f34565b61041f6104bb3660046157de565b601560209081526000928352604080842090915290825290205481565b6104eb6104e63660046157a4565b6110c3565b604080518251600690810b825260208085015190910b908201529181015190820152606001610429565b61041f6105233660046157de565b600e60209081526000928352604080842090915290825290205481565b61041f61054e3660046157a4565b600a6020526000908152604090205481565b61049861056e3660046157a4565b6112f0565b601c54610586906001600160a01b031681565b6040516104299190615aca565b61041f6105a13660046157de565b601860209081526000928352604080842090915290825290205481565b6104986114ab565b6105e96105d43660046157a4565b60066020526000908152604090205460ff1681565b6040519015158152602001610429565b6104986106073660046157a4565b611537565b61049861061a366004615862565b6116cf565b61049861062d3660046157a4565b611900565b610498610640366004615862565b6119b4565b6104986106533660046157de565b611c77565b6104986106663660046157a4565b611d1c565b600354610586906001600160a01b031681565b61041f601f5481565b6104986106953660046157a4565b611dce565b61041f60215481565b6104986106b13660046157a4565b611de7565b6104986106c43660046157a4565b611ec8565b61041f6106d73660046157de565b602860209081526000928352604080842090915290825290205481565b610498610702366004615a4e565b611fa7565b6105e96107153660046157a4565b612007565b61041f6107283660046157a4565b612067565b61049861073b366004615862565b61219d565b61049861074e3660046157a4565b6122ec565b6104986107613660046157a4565b612389565b61041f60225481565b610465612484565b6105866107853660046157a4565b6001602052600090815260409020546001600160a01b031681565b61041f6107ae3660046157a4565b612490565b6105e96107c13660046157a4565b60196020526000908152604090205460ff1681565b6104986107e4366004615a4e565b612533565b6104986107f73660046157de565b612591565b61046561267f565b6104986108123660046159b9565b61268b565b6105866108253660046157a4565b6002602052600090815260409020546001600160a01b031681565b61049861084e3660046157a4565b6127a1565b610498610861366004615817565b612880565b61041f6108743660046157de565b600d60209081526000928352604080842090915290825290205481565b61049861089f36600461598d565b612a50565b6104986108b236600461598d565b612cb1565b61041f6108c53660046157a4565b60296020526000908152604090205481565b61041f60205481565b6104986108ee3660046157a4565b612d8b565b6104986109013660046157a4565b612e3f565b6104986109143660046157de565b612eb5565b6105e96109273660046157a4565b600c6020526000908152604090205460ff1681565b61041f613334565b610498610952366004615a4e565b6133ca565b61041f6109653660046157de565b602560209081526000928352604080842090915290825290205481565b6104986109903660046157a4565b61342a565b6104986109a336600461598d565b613698565b6104986109b6366004615a4e565b61391c565b6105e96109c93660046157a4565b60056020526000908152604090205460ff1681565b6104986109ec3660046158f6565b61397c565b6104986109ff3660046157a4565b613a35565b601d54610586906001600160a01b031681565b610498610a253660046157a4565b613afb565b610498610a38366004615a4e565b613b98565b61041f610a4b3660046157de565b601660209081526000928352604080842090915290825290205481565b610498610a763660046158a3565b613c1c565b610498610a89366004615862565b613e53565b61041f60245481565b61041f610aa53660046157a4565b600b6020526000908152604090205481565b610498610ac5366004615a4e565b613fd0565b610498610ad83660046157a4565b614030565b610586610aeb3660046157a4565b602c602052600090815260409020546001600160a01b031681565b610498610b143660046157a4565b6140d8565b601e54610586906001600160a01b031681565b61041f610b3a3660046157a4565b602a6020526000908152604090205481565b610498610b5a366004615862565b61418c565b61041f60095481565b600454610586906001600160a01b031681565b610498610b893660046157a4565b6143d1565b6105e9610b9c36600461593c565b614489565b61041f60235481565b610498610bb836600461598d565b614572565b600080610bc983612067565b6022549091504290610be490610bdf9083615d13565b614662565b6001600160a01b0385166000908152602960205260409020541115610c88576022546001600160a01b038516600090815260296020526040902054610c299042615d13565b10610c65576022546001600160a01b038516600090815260296020526040902054610c549190615c39565b610c5e9082615d13565b9050610c9e565b6001600160a01b038416600090815260296020526040902054610c5e9082615d13565b610c9142614662565b610c9b9082615d13565b90505b610ca8818361467c565b610cb185612490565b610cbb9190615c39565b949350505050565b6060610ccf60266146a6565b905090565b6000610ce16026846146ba565b15610dd4576000610cf1846110c3565b90508060400151600014610dd2576001600160a01b03841660009081526014602052604081205460ff16610d32578160200151610d2d90615d85565b610d38565b81602001515b601e5460225460405163a0d2710760e01b8152929350610dc9926001600160a01b039092169163a0d2710791610d749189918791600401615c0a565b60206040518083038186803b158015610d8c57600080fd5b505afa158015610da0573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610dc49190615a67565b6146dc565b92505050610dd4565b505b92915050565b6001600160a01b038381166000908152600160205260409020548491163314610e1657604051636efb4f4160e11b815260040160405180910390fd5b602054610e239042615c39565b6001600160a01b03808616600081815260176020908152604080832094891680845294825280832095909555918152601882528381209281529190529081208054849290610e72908490615c39565b90915550610e8390508484846146ed565b6001600160a01b038085166000908152602860209081526040808320938716835292905220548015801590610ec25750602154610ec082866148fb565b105b15610ee057604051636f447fcd60e11b815260040160405180910390fd5b836001600160a01b0316856001600160a01b03167f9aaab310d247ad45aef26bbdefc4ebf20c728fdb84c92b95b2b05d21826940de85604051610f2591815260200190565b60405180910390a35050505050565b336000818152600c602052604090205460ff1615610f655760405163ad2fdf3b60e01b815260040160405180910390fd5b610f70601a826146ba565b610f8c5760405162941a5760e11b815260040160405180910390fd5b610f9581614a19565b15610ff0576001600160a01b038116600081815260296020908152604080832054600f835281842054601090935292819020549051600080516020615e3d83398151915293610fe79390929091615c23565b60405180910390a25b6001600160a01b0381166000908152600f602052604090205482111561106f5761101981614bef565b6001600160a01b038116600081815260296020908152604080832054600f835281842054601090935292819020549051600080516020615e3d833981519152936110669390929091615c23565b60405180910390a25b61107a818484614c7d565b601c546001600160a01b03808516918382169116600080516020615e1d833981519152856110a6614d7a565b6040805192835260208301919091520160405180910390a4505050565b60408051606081018252600080825260208201819052918101919091526110e942614662565b6001600160a01b0383166000908152602b6020526040902060010154141561115f57506001600160a01b03166000908152602b602090815260409182902082516060810184528154600681810b810b810b8352600160381b909104810b810b900b92810192909252600101549181019190915290565b6040805160028082526060820183526000928392919060208301908036833701905050905061118d42614662565b6111979042615d13565b816000815181106111aa576111aa615dee565b602002602001019063ffffffff16908163ffffffff16815250506022546111d042614662565b6111da9042615d13565b6111e49190615c39565b816001815181106111f7576111f7615dee565b63ffffffff909216602092830291909101820152601e546001600160a01b0386811660009081526013909352604080842054905163dc686d9160e01b81529282169263dc686d919261124f9216908690600401615ade565b60606040518083038186803b15801561126757600080fd5b505afa15801561127b573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061129f9190615a0b565b600692830b90920b80875291945091506112ba908290615cc3565b600690810b900b602085015282156112df576112d542614662565b60408501526112e7565b600060408501525b5050505b919050565b336000818152600c602052604090205460ff1615611321576040516362e6201d60e01b815260040160405180910390fd5b6001600160a01b038082166000908152601660209081526040808320938616835292905220548061136557604051636258f48160e01b815260040160405180910390fd5b42811061138557604051630fd0eeef60e11b815260040160405180910390fd5b6001600160a01b0382166000908152600b60205260409020546113be576001600160a01b0382166000908152600b602052604090204290555b6113c9600783614d94565b506001600160a01b038083166000818152601560209081526040808320948816808452948252808320805490849055938352600d825280832094835293905291822080549192839261141c908490615c39565b9091555050601c546001600160a01b03858116911614156114585780600960008282546114499190615c39565b90915550611458905081614da9565b836001600160a01b0316836001600160a01b03167f3673530133b6da67e9854f605b0cfa7bb9798cd33c18036dfc10d8da7c4d4a758360405161149d91815260200190565b60405180910390a350505050565b6004546001600160a01b031633146114d657604051637ef5703160e11b815260040160405180910390fd5b60048054600380546001600160a01b0383166001600160a01b031991821681179092559091169091556040517fc73be659241aade67e9a059bcf21494955018b213dbd1179054ccf928b13f3b69161152d91615aca565b60405180910390a1565b600260005414156115635760405162461bcd60e51b815260040161155a90615bd3565b60405180910390fd5b600260009081553381526018602090815260408083206001600160a01b03851684529091529020546115a85760405163184c088160e21b815260040160405180910390fd5b3360009081526017602090815260408083206001600160a01b038516845290915290205442116115eb576040516327cfdcb760e01b815260040160405180910390fd5b336000908152600c602052604090205460ff161561161c576040516362e6201d60e01b815260040160405180910390fd5b3360008181526018602090815260408083206001600160a01b038681168086529184528285208054908690559585526017845282852082865290935290832092909255601c541614156116725761167281614e94565b6116866001600160a01b0383163383614edc565b6040518181526001600160a01b0383169033907f2717ead6b9200dd235aad468c9809ea400fe33ac69b5bfaa6d3e90fc922b63989060200160405180910390a350506001600055565b600260005414156116f25760405162461bcd60e51b815260040161155a90615bd3565b60026000556117026026836146ba565b61171f5760405163e0b6aead60e01b815260040160405180910390fd5b61172a601a846146ba565b61174757604051636211d34960e01b815260040160405180910390fd5b6001600160a01b03831660009081526012602052604090206117699083614d94565b5061177383614f37565b6021546001600160a01b038085166000908152602860209081526040808320938716835292905220546117b1906117ab908490615c39565b846148fb565b10156117d057604051636f447fcd60e11b815260040160405180910390fd5b6001600160a01b038316600081815260296020908152604080832054600f835281842054601090935292819020549051600080516020615e3d8339815191529361181d9390929091615c23565b60405180910390a261183a6001600160a01b038316333084614f95565b6001600160a01b03808416600090815260286020908152604080832093861683529290529081208054839290611871908490615c39565b909155506118849050610dc482846148fb565b6001600160a01b038416600090815260106020526040812080549091906118ac908490615c39565b909155505060405181815233906001600160a01b0384811691908616907f4e186bc75a2220191b826baff3ee63c3e970e94e58a9007ff94c9a7b8e6ebb3f9060200160405180910390a45050600160005550565b3360009081526006602052604090205460ff1661193057604051630942721960e31b815260040160405180910390fd5b6001600160a01b0381166000908152600c602052604090205460ff16611969576040516310cec38560e21b815260040160405180910390fd5b6001600160a01b0381166000818152600c6020526040808220805460ff19169055513392917fe02b2375d8fb4aef3e5bc5d53bffcf70b6f185c5c93e69dcbe8b6cfc58e837e291a350565b600260005414156119d75760405162461bcd60e51b815260040161155a90615bd3565b60026000556119e7601a846146ba565b611a0457604051636211d34960e01b815260040160405180910390fd5b601c546001600160a01b0383811691161415611a325760405162822d9760e71b815260040160405180910390fd5b6040516370a0823160e01b81526000906001600160a01b038416906370a0823190611a61903090600401615aca565b60206040518083038186803b158015611a7957600080fd5b505afa158015611a8d573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611ab19190615a67565b9050611ac86001600160a01b038416333085614f95565b600081846001600160a01b03166370a08231306040518263ffffffff1660e01b8152600401611af79190615aca565b60206040518083038186803b158015611b0f57600080fd5b505afa158015611b23573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611b479190615a67565b611b519190615d13565b9050600061271060245483611b669190615c65565b611b709190615c51565b9050611b7c8183615d13565b6001600160a01b038088166000908152600e60209081526040808320938a1683529290529081208054909190611bb3908490615c39565b90915550506001600160a01b0380871660009081526025602090815260408083208985168085529252909120429055600354611bf0921683614edc565b6001600160a01b0386166000908152601160205260409020611c129086614d94565b50336001600160a01b0316856001600160a01b0316876001600160a01b03167fec1a37d4a331a5059081e0fb5da1735e7890900cd215a4fb1e9f2779fd7b83eb85604051611c6291815260200190565b60405180910390a45050600160005550505050565b6001600160a01b038281166000908152600160205260409020548391163314611cb357604051636efb4f4160e11b815260040160405180910390fd5b6001600160a01b03838116600081815260026020908152604080832080546001600160a01b031916888716908117909155600190925280832054905191941692917fa8bad3f0b781e1d954af9945167d5f80bfe5e57930f17c93843187c77557a6b891a4505050565b6001600160a01b038181166000908152600260205260409020548291163314611d585760405163cfe9663360e01b815260040160405180910390fd5b6001600160a01b03828116600081815260016020908152604080832080546002909352818420805487166001600160a01b031980861691909117909255805490911690555193169283929133917fcf30c54296d5eee76168b564c59c50578d49c271733a470f32707c8cfbc88a8b9190a4505050565b6040516331cee75f60e21b815260040160405180910390fd5b6003546001600160a01b03163314611e12576040516354348f0360e01b815260040160405180910390fd5b611e1d602682614fd3565b611e3a57604051630a8d08b160e01b815260040160405180910390fd5b6001600160a01b038116600090815260136020908152604080832080546001600160a01b031916905560148252808320805460ff19169055602b90915280822080546001600160701b031916815560010191909155517f51199d699bdfd516fa88dd0d2f8487c40c147b4867acaa23adc8d4df6b098e5690611ebd908390615aca565b60405180910390a150565b6003546001600160a01b03163314611ef3576040516354348f0360e01b815260040160405180910390fd5b6001600160a01b038116611f1a5760405163d92e233d60e01b815260040160405180910390fd5b6001600160a01b03811660009081526005602052604090205460ff1615611f545760405163546da66560e11b815260040160405180910390fd5b6001600160a01b03811660009081526005602052604090819020805460ff19166001179055517f049ccb28ab796d3225573a065712f6e7754487ced56056cda8889c337511807b90611ebd908390615aca565b6003546001600160a01b03163314611fd2576040516354348f0360e01b815260040160405180910390fd5b60248190556040518181527f4c10ca068ff7002cf5da78f2f697d1e91f6f0ac27f7344b28e8ef25263f87e5d90602001611ebd565b6000612011614d7a565b602e5561201f6007836146ba565b156112eb577f4851cad52e624c8f7a1d44c28a80db05988ba2451fc0db6b0ec338d8eca95afb602e5460405161205791815260200190565b60405180910390a1506001919050565b6000805b6001600160a01b038316600090815260126020526040902061208c90614fe8565b811015612197576001600160a01b03831660009081526012602052604081206120b59083614ff2565b90506120c26026826146ba565b156121845760006120d2826110c3565b90508060400151600014612182576001600160a01b03821660009081526014602052604081205460ff1661211357816020015161210e90615d85565b612119565b81602001515b601e546001600160a01b03888116600090815260286020908152604080832089851684529091529081902054602254915163a0d2710760e01b815294955061217494929093169263a0d2710792610d74928791600401615c0a565b61217e9086615c39565b9450505b505b508061218f81615d56565b91505061206b565b50919050565b3360009081526005602052604090205460ff166121cd57604051637e57b1e160e01b815260040160405180910390fd5b6001600160a01b0383166000908152600c602052604090205460ff16612206576040516310cec38560e21b815260040160405180910390fd5b6122118383836146ed565b60035460405163a9059cbb60e01b81526001600160a01b038481169263a9059cbb9261224592909116908590600401615b3a565b602060405180830381600087803b15801561225f57600080fd5b505af192505050801561228f575060408051601f3d908101601f1916820190925261228c918101906159f0565b60015b6122985761229a565b505b336001600160a01b0316836001600160a01b03167f6e10247c3c094d220ee99436c164b7f38d63b335a20ed817cbefaee4bb02d20e84846040516122df929190615b3a565b60405180910390a3505050565b6003546001600160a01b03163314612317576040516354348f0360e01b815260040160405180910390fd5b6001600160a01b03811661233e5760405163d92e233d60e01b815260040160405180910390fd5b601e80546001600160a01b0319166001600160a01b0383161790556040517f71973fd672e51deb8f739b1f7e1eab991936645acd6f83e2bde6eeeaff5490b090611ebd908390615aca565b3360009081526005602052604090205460ff166123b957604051637e57b1e160e01b815260040160405180910390fd5b6001600160a01b0381166000908152600c602052604090205460ff166123f2576040516310cec38560e21b815260040160405180910390fd5b6123fd600782614fd3565b50601c546001600160a01b038083166000818152600d602090815260408083209490951680835293815284822054928252601881528482208483529052929092205461244b92849291614ffe565b60405133906001600160a01b038316907f038a17b9b553c0c3fc2ed14b957a5d8420a1666fd2efe5c1b3fe5f23eea61bb390600090a350565b6060610ccf601a6146a6565b60008061249c83612067565b6022546001600160a01b038516600090815260296020526040902054919250906124c69042615d13565b1015610dd457600081116124f2576001600160a01b0383166000908152600f602052604090205461252c565b6001600160a01b038316600090815260106020908152604080832054600f90925290912054612522908390615c65565b61252c9190615c51565b9150612197565b6003546001600160a01b0316331461255e576040516354348f0360e01b815260040160405180910390fd5b60208181556040518281527fc8d443472c9783cc36f8f5f5091f08ce9f37fc2f9e6d79cf1d9aaf40a433fee29101611ebd565b6001600160a01b0382811660009081526001602052604090205483911633146125cd57604051636efb4f4160e11b815260040160405180910390fd5b816001600160a01b0316836001600160a01b031614156126005760405163afe7ad4960e01b815260040160405180910390fd5b6001600160a01b038381166000818152602c6020908152604080832080546001600160a01b0319169588169586179055602d825280832094835293905282902042905590517fff0456758201108de53c0ff04c69988d4678ff455b2ce6f733328cf85722c04c90612672908590615aca565b60405180910390a2505050565b6060610ccf60076146a6565b6003546001600160a01b031633146126b6576040516354348f0360e01b815260040160405180910390fd5b6001600160a01b0381166126dd5760405163d92e233d60e01b815260040160405180910390fd5b6001600160a01b03831673eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee141561273e576040516001600160a01b0382169083156108fc029084906000818181858888f19350505050158015612738573d6000803e3d6000fd5b50612752565b6127526001600160a01b0384168284614edc565b604080516001600160a01b0385811682526020820185905283168183015290517f9a3055ded8c8b5f21bbf4946c5afab6e1fa8b3f057922658e5e1ade125fb0b1e9181900360600190a1505050565b6003546001600160a01b031633146127cc576040516354348f0360e01b815260040160405180910390fd5b6001600160a01b0381166127f35760405163d92e233d60e01b815260040160405180910390fd5b6001600160a01b03811660009081526006602052604090205460ff161561282d5760405163274e25dd60e11b815260040160405180910390fd5b6001600160a01b03811660009081526006602052604090819020805460ff19166001179055517f8addc69f897ecca0e41d70ed4ff9d75a9148a615a0fbda8597e53aea2684302f90611ebd908390615aca565b6001600160a01b0383811660009081526001602052604090205484911633146128bc57604051636efb4f4160e11b815260040160405180910390fd5b6001600160a01b0382166128e35760405163d92e233d60e01b815260040160405180910390fd5b6001600160a01b038085166000908152601860209081526040808320938716835292905220546129265760405163184c088160e21b815260040160405180910390fd5b6001600160a01b03808516600090815260176020908152604080832093871683529290522054421161296b576040516327cfdcb760e01b815260040160405180910390fd5b6001600160a01b0384166000908152600c602052604090205460ff16156129a5576040516362e6201d60e01b815260040160405180910390fd5b6001600160a01b03808516600081815260186020908152604080832094881680845294825280832080549084905593835260178252808320858452909152812055906129f2908483614edc565b826001600160a01b0316846001600160a01b0316866001600160a01b03167ffdb7893bf11f50c621e59cc7f1cf540e94295cb27ca869ec7ed7618ca792886284604051612a4191815260200190565b60405180910390a45050505050565b60026000541415612a735760405162461bcd60e51b815260040161155a90615bd3565b60026000908155338152600c602052604090205460ff1615612aa8576040516362e6201d60e01b815260040160405180910390fd5b612ab3601a336146ba565b15612ad15760405163d7229c4360e01b815260040160405180910390fd5b601f54612ade9042615c39565b3360009081526016602090815260408083206001600160a01b03871680855292528083209390935591516370a0823160e01b81529091906370a0823190612b29903090600401615aca565b60206040518083038186803b158015612b4157600080fd5b505afa158015612b55573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612b799190615a67565b9050612b906001600160a01b038416333085614f95565b6040516370a0823160e01b815281906001600160a01b038516906370a0823190612bbe903090600401615aca565b60206040518083038186803b158015612bd657600080fd5b505afa158015612bea573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612c0e9190615a67565b612c189190615d13565b336000908152601960209081526040808320805460ff19166001179055601582528083206001600160a01b0388168452909152812080549294508492909190612c62908490615c39565b90915550506040518281526001600160a01b0384169033907fa7e66869262026842e8d81f5e6806cdc8d846e27c824e2e22f4fe51442771b349060200160405180910390a35050600160005550565b602054612cbe9042615c39565b3360008181526017602090815260408083206001600160a01b03881680855290835281842095909555928252600d81528282209382529290925281208054839290612d0a908490615d13565b90915550503360009081526018602090815260408083206001600160a01b038616845290915281208054839290612d42908490615c39565b90915550506040518181526001600160a01b0383169033907f9aaab310d247ad45aef26bbdefc4ebf20c728fdb84c92b95b2b05d21826940de9060200160405180910390a35050565b6003546001600160a01b03163314612db6576040516354348f0360e01b815260040160405180910390fd5b6001600160a01b03811660009081526005602052604090205460ff16612def576040516336fe17e760e21b815260040160405180910390fd5b6001600160a01b03811660009081526005602052604090819020805460ff19169055517f3ed8cbce8cab40e59282f1743e2b607effa08b5cbe0111bb4721134f2f80d02590611ebd908390615aca565b6003546001600160a01b03163314612e6a576040516354348f0360e01b815260040160405180910390fd5b600480546001600160a01b0319166001600160a01b0383161790556040517fe987aaedf9d279143bdf1eee16cf1d0feb47742867d81083df8d6cd0a5ac857f90611ebd908390615aca565b6001600160a01b038181166000908152600160205260409020548291163314612ef157604051636efb4f4160e11b815260040160405180910390fd5b6001600160a01b0383166000908152600c602052604090205460ff1680612f3057506001600160a01b0382166000908152600c602052604090205460ff165b15612f4e5760405163ad2fdf3b60e01b815260040160405180910390fd5b6001600160a01b038381166000908152602c6020526040902054811690831614612f8b57604051630ced616b60e21b815260040160405180910390fd5b6001600160a01b038084166000908152602d6020908152604080832093861683529290522054612fbd90603c90615c39565b421015612fdd576040516356248e9760e01b815260040160405180910390fd5b612fe683614f37565b612fef82614f37565b6001600160a01b038316600090815260116020526040812061301090614fe8565b11156130f2576001600160a01b03831660009081526011602052604081206130389082614ff2565b6001600160a01b038086166000908152600e6020818152604080842085871680865290835281852054958a168552928252808420928452919052812080549394509192613086908490615c39565b90915550506001600160a01b038085166000818152600e6020908152604080832094861683529381528382208290559181526011909152206130c89082614fd3565b506001600160a01b03831660009081526011602052604090206130eb9082614d94565b5050612fef565b6001600160a01b038316600090815260126020526040812061311390614fe8565b11156131f5576001600160a01b038316600090815260126020526040812061313b9082614ff2565b6001600160a01b03808616600090815260286020818152604080842085871680865290835281852054958a168552928252808420928452919052812080549394509192613189908490615c39565b90915550506001600160a01b03808516600090815260286020908152604080832085851684528252808320839055928616825260129052206131cb9082614d94565b506001600160a01b03841660009081526012602052604090206131ee9082614fd3565b50506130f2565b6001600160a01b0380841660009081526010602052604080822054928516825281208054909190613227908490615c39565b90915550506001600160a01b038084166000908152601060209081526040808320839055600f9091528082205492851682528120805490919061326b908490615c39565b90915550506001600160a01b0383166000908152600f6020908152604080832083905560299091528120556132a1601a84614fd3565b506001600160a01b03808416600081815260016020908152604080832080546001600160a01b031990811690915560028352818420805482169055602d8352818420958816808552958352818420849055938352602c909152908190208054909216909155517f9b712b63e3fb1325fa042d3c238ce8144937875065900528ea1e4f3b00f379f290612672908690615aca565b600954601c54601d546040516370a0823160e01b8152600093926001600160a01b03908116926370a08231926133709290911690600401615aca565b60206040518083038186803b15801561338857600080fd5b505afa15801561339c573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906133c09190615a67565b610ccf9190615c84565b6003546001600160a01b031633146133f5576040516354348f0360e01b815260040160405180910390fd5b60238190556040518181527fbdcfd7b8482f31cff6a87c362d9e2e3887f4cdc2018c7c485d8e78a7b2fadb6990602001611ebd565b6003546001600160a01b03163314613455576040516354348f0360e01b815260040160405180910390fd5b613460602682614d94565b61347d5760405163f25e6b9f60e01b815260040160405180910390fd5b601e5460405163eb37d34960e01b81526001600160a01b039091169063eb37d349906134ad908490600401615aca565b60206040518083038186803b1580156134c557600080fd5b505afa1580156134d9573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906134fd91906157c1565b6001600160a01b03828116600090815260136020526040902080546001600160a01b0319169290911691821790556135485760405163d92e233d60e01b815260040160405180910390fd5b601e546001600160a01b038281166000908152601360205260409081902054905163696a437b60e01b81529282169263696a437b9261358b921690600401615aca565b60206040518083038186803b1580156135a357600080fd5b505afa1580156135b7573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906135db91906159f0565b6001600160a01b0382166000908152601460205260409020805460ff191691151591909117905561360b816110c3565b6001600160a01b0382166000908152602b60209081526040918290208351815492850151600690810b66ffffffffffffff908116600160381b026001600160701b03199095169290910b161791909117815591810151600190920191909155517fabfa8db4d238fa78bf4e15fcc91328dd35f3978f200e2857a56bb719732b7b0b90611ebd908390615aca565b602e546136b857604051630262ab9b60e61b815260040160405180910390fd5b60006136c2614d7a565b336000818152600c60205260409020549192509060ff16156136f75760405163ad2fdf3b60e01b815260040160405180910390fd5b613702601a826146ba565b61371e5760405162941a5760e11b815260040160405180910390fd5b61372781614a19565b15613782576001600160a01b038116600081815260296020908152604080832054600f835281842054601090935292819020549051600080516020615e3d833981519152936137799390929091615c23565b60405180910390a25b601e546001600160a01b038581166000908152600d60209081526040808320601c548516845290915280822054905163435b21c160e01b8152600481019190915290928392839291169063435b21c19060240160606040518083038186803b1580156137ed57600080fd5b505afa158015613801573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906138259190615a80565b919450925090506000613843868361383d8a87615c65565b87615154565b6001600160a01b0386166000908152600f60205260409020549091508111156138c55761386f85614bef565b6001600160a01b038516600081815260296020908152604080832054600f835281842054601090935292819020549051600080516020615e3d833981519152936138bc9390929091615c23565b60405180910390a25b6138d0858983614c7d565b6000602e55601c5460408051838152602081018990526001600160a01b038b81169389821693911691600080516020615e1d833981519152910160405180910390a45050505050505050565b6003546001600160a01b03163314613947576040516354348f0360e01b815260040160405180910390fd5b601f8190556040518181527fd319ef78d2b690bb773fcccc2d096306bac7c9222dd0bb6b300f461e4a376b4390602001611ebd565b3360009081526005602052604090205460ff166139ac57604051637e57b1e160e01b815260040160405180910390fd5b6001600160a01b0384166000908152600c602052604090205460ff166139e5576040516310cec38560e21b815260040160405180910390fd5b6139f184848484614ffe565b336001600160a01b0385167f10a73de7ab6e9023aa6e2bc23f7abf4dcef591487e7e55f44c00e34fe60d56db613a278486615c39565b60405190815260200161149d565b613a40601a826146ba565b15613a5e57604051630809740d60e01b815260040160405180910390fd5b6001600160a01b03811660009081526019602052604090205460ff1615613a9857604051632f3d320560e01b815260040160405180910390fd5b613aa3601a82614d94565b506001600160a01b03811660008181526001602052604080822080546001600160a01b0319163390811790915590519092917fed3faef50715743626cd57de74281a2b17cdbfc11c0486feda541fb911e0293d91a350565b6003546001600160a01b03163314613b26576040516354348f0360e01b815260040160405180910390fd5b6001600160a01b038116613b4d5760405163d92e233d60e01b815260040160405180910390fd5b601d80546001600160a01b0319166001600160a01b0383161790556040517feb931b4b5a98d20a6b1e6693a7c59d8e337a06e2f1473bb776e19251db7ae25090611ebd908390615aca565b6003546001600160a01b03163314613bc3576040516354348f0360e01b815260040160405180910390fd5b62015180811015613be757604051633f384aad60e21b815260040160405180910390fd5b60228190556040518181527f54aafa56429e22230b52f1495588ffc632277d74f3a85ec755e13ac50c1584d990602001611ebd565b60026000541415613c3f5760405162461bcd60e51b815260040161155a90615bd3565b600260009081556001600160a01b03858116825260016020526040909120548591163314613c8057604051636efb4f4160e11b815260040160405180910390fd5b6001600160a01b03808616600090815260256020908152604080832093881683529290522054613cb290603c90615c39565b4211613cd157604051631e0b407560e01b815260040160405180910390fd5b6001600160a01b038086166000908152600e6020908152604080832093881683529290522054831115613d175760405163024ae82d60e61b815260040160405180910390fd5b6001600160a01b0385166000908152600c602052604090205460ff1615613d515760405163ad2fdf3b60e01b815260040160405180910390fd5b6001600160a01b038086166000908152600e6020908152604080832093881683529290529081208054859290613d88908490615d13565b90915550613da290506001600160a01b0385168385614edc565b6001600160a01b038086166000908152600e6020908152604080832093881683529290522054613df0576001600160a01b0385166000908152601160205260409020613dee9085614fd3565b505b816001600160a01b0316846001600160a01b0316866001600160a01b03167f53e982dd9ec088d634c74c98fbbc161f808b4b6469a26c657120b9a31cb34bfe86604051613e3f91815260200190565b60405180910390a450506001600055505050565b336000818152600c602052604090205460ff1615613e845760405163ad2fdf3b60e01b815260040160405180910390fd5b6001600160a01b0383166000908152600c602052604090205460ff1615613ebe576040516362e6201d60e01b815260040160405180910390fd5b613ec9601a826146ba565b613ee55760405162941a5760e11b815260040160405180910390fd5b6001600160a01b038082166000908152600e6020908152604080832093881683529290522054821115613f2b5760405163356680b760e01b815260040160405180910390fd5b6001600160a01b038082166000908152600e6020908152604080832093881683529290529081208054849290613f62908490615d13565b90915550613f7c90506001600160a01b0385168484614edc565b826001600160a01b0316816001600160a01b0316856001600160a01b0316600080516020615e1d83398151915285613fb2614d7a565b6040805192835260208301919091520160405180910390a450505050565b6003546001600160a01b03163314613ffb576040516354348f0360e01b815260040160405180910390fd5b60218190556040518181527f24d51b415694a791b1c77df7817c075ac82b83ce611bcd8627d2e66cf37aa3e790602001611ebd565b6003546001600160a01b0316331461405b576040516354348f0360e01b815260040160405180910390fd5b6001600160a01b0381166140825760405163d92e233d60e01b815260040160405180910390fd5b61408d600954614e94565b601c80546001600160a01b0319166001600160a01b0383161790556040517f1d1a3e7caf0717056e48dc8aefa54d806c7af86324fece4e5d49f8e1f01f84bf90611ebd908390615aca565b6003546001600160a01b03163314614103576040516354348f0360e01b815260040160405180910390fd5b6001600160a01b03811660009081526006602052604090205460ff1661413c57604051633ca0d42760e11b815260040160405180910390fd5b6001600160a01b03811660009081526006602052604090819020805460ff19169055517f5e8bd21d0a98cb2caf33706e56139ff40ffbdca7ec5d9d412a0a2292496dc70e90611ebd908390615aca565b3360009081526005602052604090205460ff166141bc57604051637e57b1e160e01b815260040160405180910390fd5b6001600160a01b0383166000908152600c602052604090205460ff166141f5576040516310cec38560e21b815260040160405180910390fd5b6001600160a01b038316600090815260116020526040902061421790836146ba565b61423457604051632eda7a1160e01b815260040160405180910390fd5b6001600160a01b038084166000908152600e60209081526040808320938616835292905220548111156142795760405162919bed60e01b815260040160405180910390fd5b60035460405163a9059cbb60e01b81526001600160a01b038481169263a9059cbb926142ad92909116908590600401615b3a565b602060405180830381600087803b1580156142c757600080fd5b505af19250505080156142f7575060408051601f3d908101601f191682019092526142f4918101906159f0565b60015b61430057614302565b505b6001600160a01b038084166000908152600e6020908152604080832093861683529290529081208054839290614339908490615d13565b90915550506001600160a01b038084166000908152600e602090815260408083209386168352929052205461438c576001600160a01b038316600090815260116020526040902061438a9083614fd3565b505b336001600160a01b0316836001600160a01b03167f20262b97130b5cb8f80624eed2733df2b05db4a0789b4a3d0157e1d31833310484846040516122df929190615b3a565b3360009081526006602052604090205460ff1661440157604051630942721960e31b815260040160405180910390fd5b6001600160a01b0381166000908152600c602052604090205460ff161561443b576040516304ee891b60e11b815260040160405180910390fd5b6001600160a01b0381166000818152600c6020526040808220805460ff19166001179055513392917f070125a1c0f5202217aae14ec399abfaaa13c2fd98a91d43bd3a897dd4751e8091a350565b6000614493614d7a565b602e556144a16007876146ba565b80156144d257506001600160a01b038087166000908152600d60209081526040808320938916835292905220548411155b80156144f657506001600160a01b0386166000908152600a60205260409020548311155b801561452557506001600160a01b0386166000908152600b602052604090205482906145229042615d13565b10155b15614569577f4851cad52e624c8f7a1d44c28a80db05988ba2451fc0db6b0ec338d8eca95afb602e5460405161455d91815260200190565b60405180910390a15060015b95945050505050565b6003546001600160a01b0316331461459d576040516354348f0360e01b815260040160405180910390fd5b6145a8601a836146ba565b6145c557604051636211d34960e01b815260040160405180910390fd5b6145ce82614f37565b6001600160a01b0382166000908152600f6020526040812080548392906145f6908490615c39565b90915550506001600160a01b038216600081815260296020908152604080832054600f909252918290205491517f5abcf5031fdbd3badb9d1e09094208de329aee72730e87650f346584205d23d192614656928252602082015260400190565b60405180910390a25050565b6000602254826146729190615d71565b610dd49083615d13565b6000602254831015612197576022546146958385615c65565b61469f9190615c51565b9050610dd4565b606060006146b3836151b1565b9392505050565b6001600160a01b038116600090815260018301602052604081205415156146b3565b6000610dd48260225460235461520d565b600260005414156147105760405162461bcd60e51b815260040161155a90615bd3565b600260009081556001600160a01b038416815260126020526040902061473690836146ba565b614752576040516241cfa560e21b815260040160405180910390fd5b6001600160a01b038084166000908152602860209081526040808320938616835292905220548111156147985760405163435b562560e01b815260040160405180910390fd5b6147a1836152bb565b60006147b0610dc483856148fb565b6001600160a01b03851660009081526010602052604090205490915015614866576001600160a01b038416600090815260106020908152604080832054600f90925290912054614801908390615c65565b61480b9190615c51565b6001600160a01b0385166000908152600f602052604081208054909190614833908490615d13565b90915550506001600160a01b03841660009081526010602052604081208054839290614860908490615d13565b90915550505b6001600160a01b0380851660009081526028602090815260408083209387168352929052908120805484929061489d908490615d13565b90915550506001600160a01b038085166000908152602860209081526040808320938716835292905220546148f0576001600160a01b03841660009081526012602052604090206148ee9084614fd3565b505b505060016000555050565b6001600160a01b0381166000908152602b602052604081206001015415610dd4576001600160a01b03821660009081526014602052604081205460ff1661496d576001600160a01b0383166000908152602b602052604090205461496890600160381b900460060b615d85565b614991565b6001600160a01b0383166000908152602b6020526040902054600160381b900460060b5b601e5460225460405163a0d2710760e01b81529293506001600160a01b039091169163a0d27107916149c99188918691600401615c0a565b60206040518083038186803b1580156149e157600080fd5b505afa1580156149f5573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610cbb9190615a67565b6000614a2442614662565b6001600160a01b03831660009081526029602052604090205410156112eb57614a5460225442610bdf9190615d13565b6001600160a01b03831660009081526029602052604090205411614aca57614a7b826152bb565b6001600160a01b038216600090815260106020908152604080832054600f90925290912055614aa942614662565b6001600160a01b038316600090815260296020526040902055506001919050565b6022546001600160a01b038316600090815260296020526040902054614af09042615d13565b10614b4c57614afe826152bb565b6001600160a01b038216600090815260106020908152604080832054600f83528184205560225460299092528220805491929091614b3d908490615c39565b90915550600191506112eb9050565b614b5542614662565b6001600160a01b0383166000908152602a602052604090205410156112eb576001600160a01b038216600090815260106020526040902054614b96836152bb565b6001600160a01b038316600090815260106020908152604080832054600f909252909120548291614bc691615c65565b614bd09190615c51565b6001600160a01b0384166000908152600f602052604090205550919050565b6001600160a01b038116600090815260296020526040902054614c3490614c169042615d13565b6001600160a01b03831660009081526010602052604090205461467c565b6001600160a01b0382166000908152600f602052604081208054909190614c5c908490615c39565b90915550506001600160a01b03166000908152602960205260409020429055565b6001600160a01b0383166000908152600f6020526040902054811115614cb65760405163356680b760e01b815260040160405180910390fd5b6001600160a01b0383166000908152602a60209081526040808320429055600f90915281208054839290614ceb908490615d13565b90915550506001600160a01b038083166000908152600d60209081526040808320601c5490941683529290529081208054839290614d2a908490615c39565b90915550506001600160a01b0382166000908152600a602052604081208054839290614d57908490615c39565b925050819055508060096000828254614d709190615c39565b9091555050505050565b6000603f5a614d8a906040615c65565b610ccf9190615c51565b60006146b3836001600160a01b0384166152e0565b601c54601d5460405163095ea7b360e01b81526001600160a01b039283169263095ea7b392614ddf929116908590600401615b3a565b602060405180830381600087803b158015614df957600080fd5b505af1158015614e0d573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190614e3191906159f0565b50601d5460405163b6b55f2560e01b8152600481018390526001600160a01b039091169063b6b55f25906024015b600060405180830381600087803b158015614e7957600080fd5b505af1158015614e8d573d6000803e3d6000fd5b5050505050565b8060096000828254614ea69190615d13565b9091555050601d5460405163140e25ad60e31b8152600481018390526001600160a01b039091169063a0712d6890602401614e5f565b614f328363a9059cbb60e01b8484604051602401614efb929190615b3a565b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b03199093169290921790915261532f565b505050565b614f4081614a19565b50614f4a81614bef565b6001600160a01b0381166000908152600f6020908152604080832054601090925290912054614f799190615401565b6001600160a01b039091166000908152600f6020526040902055565b6040516001600160a01b0380851660248301528316604482015260648101829052614fcd9085906323b872dd60e01b90608401614efb565b50505050565b60006146b3836001600160a01b038416615417565b6000610dd4825490565b60006146b3838361550a565b601c546001600160a01b038481169116146150d6576003546001600160a01b038085169163a9059cbb91166150338486615c39565b6040518363ffffffff1660e01b8152600401615050929190615b3a565b602060405180830381600087803b15801561506a57600080fd5b505af192505050801561509a575060408051601f3d908101601f19168201909252615097918101906159f0565b60015b6150d4573d8080156150c8576040519150601f19603f3d011682016040523d82523d6000602084013e6150cd565b606091505b50506150d6565b505b6001600160a01b038085166000908152600d602090815260408083209387168352929052908120805484929061510d908490615d13565b90915550506001600160a01b03808516600090815260186020908152604080832093871683529290529081208054839290615149908490615d13565b909155505050505050565b6000808486602e546151669190615d13565b6151709190615c39565b9050670de0b6b3a7640000846127106151898685615c65565b6151939190615c51565b61519d9190615c65565b6151a79190615c51565b9695505050505050565b60608160000180548060200260200160405190810160405280929190818152602001828054801561520157602002820191906000526020600020905b8154815260200190600101908083116151ed575b50505050509050919050565b600080806000198587098587029250828110838203039150508060001415615247576000841161523c57600080fd5b5082900490506146b3565b80841161525357600080fd5b600084868809600260036001881981018916988990049182028318808302840302808302840302808302840302808302840302808302840302918202909203026000889003889004909101858311909403939093029303949094049190911702949350505050565b6152c481615534565b6001600160a01b03909116600090815260106020526040902055565b600081815260018301602052604081205461532757508154600181810184556000848152602080822090930184905584548482528286019093526040902091909155610dd4565b506000610dd4565b6000615384826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b03166156779092919063ffffffff16565b805190915015614f3257808060200190518101906153a291906159f0565b614f325760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b606482015260840161155a565b600081831061541057816146b3565b5090919050565b6000818152600183016020526040812054801561550057600061543b600183615d13565b855490915060009061544f90600190615d13565b90508181146154b457600086600001828154811061546f5761546f615dee565b906000526020600020015490508087600001848154811061549257615492615dee565b6000918252602080832090910192909255918252600188019052604090208390555b85548690806154c5576154c5615dd8565b600190038181906000526020600020016000905590558560010160008681526020019081526020016000206000905560019350505050610dd4565b6000915050610dd4565b600082600001828154811061552157615521615dee565b9060005260206000200154905092915050565b6000805b6001600160a01b038316600090815260126020526040902061555990614fe8565b811015612197576001600160a01b03831660009081526012602052604081206155829083614ff2565b905061558f6026826146ba565b156156645761559d42614662565b6001600160a01b0382166000908152602b602052604090206001015414615623576155c7816110c3565b6001600160a01b0382166000908152602b60209081526040918290208351815492850151600690810b66ffffffffffffff908116600160381b026001600160701b03199095169290910b16179190911781559101516001909101555b6001600160a01b0380851660009081526028602090815260408083209385168352929052205461565790610dc490836148fb565b6156619084615c39565b92505b508061566f81615d56565b915050615538565b6060610cbb848460008585843b6156d05760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e7472616374000000604482015260640161155a565b600080866001600160a01b031685876040516156ec9190615aae565b60006040518083038185875af1925050503d8060008114615729576040519150601f19603f3d011682016040523d82523d6000602084013e61572e565b606091505b509150915061573e828286615749565b979650505050505050565b606083156157585750816146b3565b8251156157685782518084602001fd5b8160405162461bcd60e51b815260040161155a9190615ba0565b805180151581146112eb57600080fd5b8051600681900b81146112eb57600080fd5b6000602082840312156157b657600080fd5b81356146b381615e04565b6000602082840312156157d357600080fd5b81516146b381615e04565b600080604083850312156157f157600080fd5b82356157fc81615e04565b9150602083013561580c81615e04565b809150509250929050565b60008060006060848603121561582c57600080fd5b833561583781615e04565b9250602084013561584781615e04565b9150604084013561585781615e04565b809150509250925092565b60008060006060848603121561587757600080fd5b833561588281615e04565b9250602084013561589281615e04565b929592945050506040919091013590565b600080600080608085870312156158b957600080fd5b84356158c481615e04565b935060208501356158d481615e04565b92506040850135915060608501356158eb81615e04565b939692955090935050565b6000806000806080858703121561590c57600080fd5b843561591781615e04565b9350602085013561592781615e04565b93969395505050506040820135916060013590565b600080600080600060a0868803121561595457600080fd5b853561595f81615e04565b9450602086013561596f81615e04565b94979496505050506040830135926060810135926080909101359150565b600080604083850312156159a057600080fd5b82356159ab81615e04565b946020939093013593505050565b6000806000606084860312156159ce57600080fd5b83356159d981615e04565b925060208401359150604084013561585781615e04565b600060208284031215615a0257600080fd5b6146b382615782565b600080600060608486031215615a2057600080fd5b615a2984615792565b9250615a3760208501615792565b9150615a4560408501615782565b90509250925092565b600060208284031215615a6057600080fd5b5035919050565b600060208284031215615a7957600080fd5b5051919050565b600080600060608486031215615a9557600080fd5b8351925060208401519150604084015190509250925092565b60008251615ac0818460208701615d2a565b9190910192915050565b6001600160a01b0391909116815260200190565b6001600160a01b038316815260406020808301829052835191830182905260009184820191906060850190845b81811015615b2d57845163ffffffff1683529383019391830191600101615b0b565b5090979650505050505050565b6001600160a01b03929092168252602082015260400190565b6020808252825182820181905260009190848201906040850190845b81811015615b945783516001600160a01b031683529284019291840191600101615b6f565b50909695505050505050565b6020815260008251806020840152615bbf816040850160208701615d2a565b601f01601f19169190910160400192915050565b6020808252601f908201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604082015260600190565b92835260069190910b6020830152604082015260600190565b9283526020830191909152604082015260600190565b60008219821115615c4c57615c4c615dac565b500190565b600082615c6057615c60615dc2565b500490565b6000816000190483118215151615615c7f57615c7f615dac565b500290565b60008083128015600160ff1b850184121615615ca257615ca2615dac565b6001600160ff1b0384018313811615615cbd57615cbd615dac565b50500390565b60008160060b8360060b6000811281667fffffffffffff1901831281151615615cee57615cee615dac565b81667fffffffffffff018313811615615d0957615d09615dac565b5090039392505050565b600082821015615d2557615d25615dac565b500390565b60005b83811015615d45578181015183820152602001615d2d565b83811115614fcd5750506000910152565b6000600019821415615d6a57615d6a615dac565b5060010190565b600082615d8057615d80615dc2565b500690565b60008160060b667fffffffffffff19811415615da357615da3615dac565b60000392915050565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052601260045260246000fd5b634e487b7160e01b600052603160045260246000fd5b634e487b7160e01b600052603260045260246000fd5b6001600160a01b0381168114615e1957600080fd5b5056fe46f2180879a7123a197cc3828c28955d70d661c70acbdc02450daf5f9a9c1cfaee3f0daba9837d1ab0597acf34328550e4832d02e24e467825e7c2dd318c3820a2646970667358221220387041f4445770e88edda922a11b4527ef0755a64cad19454f2008ef77f4af2564736f6c63430008070033", - "deployedBytecode": "0x608060405234801561001057600080fd5b50600436106104075760003560e01c8063966abd0011610228578063c5198abc1161013c578063ec8ca643116100be578063ec8ca64314610add578063f0f346b914610b06578063f11a1d1a14610b19578063f136a09d14610b2c578063f25e311b14610b4c578063f263c47014610b5f578063f39c38a014610b68578063f75f9f7b14610b7b578063f9d46cf214610b8e578063fc253d2b14610ba1578063fe75bc4614610baa57600080fd5b8063c5198abc146109f1578063c7ae40d014610a04578063cb4be2bb14610a17578063cb54694d14610a2a578063cd22af1b14610a3d578063d55995fe14610a68578063dd2080d614610a7b578063ddca3f4314610a8e578063e326ac4314610a97578063ebbb619414610ab7578063ec00cdfc14610aca57600080fd5b8063966abd001461080457806398e90a0f146108175780639d5c33d814610840578063a214580914610853578063a39744b514610866578063a515366a14610891578063a5d059ca146108a4578063a676f9ff146108b7578063a7d2e784146108d7578063aac6aa9c146108e0578063ab033ea9146108f3578063af320e8114610906578063b0103b1a14610919578063b0f328f11461093c578063b239223314610944578063b440027f14610957578063b600702a14610982578063b70362b914610995578063b7e77340146109a8578063b87fcbff146109bb578063c20297f0146109de57600080fd5b80635aa6e6751161031f5780635aa6e6751461066b5780635ebe23f01461067e5780635feeb79414610687578063633fb68f1461069a57806364bb43ee146106a357806368a9f19c146106b6578063694798e6146106c957806369fe0e2d146106f45780636ba42aaa146107075780636cf262bc1461071a5780636e2a9ca61461072d57806372da828a1461074057806374a8f10314610753578063768b5d90146107665780637c8fce231461076f578063878c723e146107775780638bb6dfa8146107a05780638cb22b76146107b35780638fe204dd146107d657806390a4684e146107e9578063951dc22c146107fc57600080fd5b8063034d4c611461040c57806307b435c2146104325780630c620bce1461045d5780630d6a1f87146104725780631101eb411461048557806311466d721461049a57806315006b82146104ad578063165e62e7146104d8578063168f92e7146105155780631b44555e146105405780631c5a9d9c146105605780631ef94b911461057357806321040b0114610593578063238efcbc146105be578063274a8db4146105c657806351cff8d9146105f957806352a4de291461060c57806355ea6c471461061f578063575288bf14610632578063594a3a931461064557806359a2255e14610658575b600080fd5b61041f61041a3660046157a4565b610bbd565b6040519081526020015b60405180910390f35b61041f6104403660046157de565b601760209081526000928352604080842090915290825290205481565b610465610cc3565b6040516104299190615b53565b61041f61048036600461598d565b610cd4565b610498610493366004615862565b610dda565b005b6104986104a836600461598d565b610f34565b61041f6104bb3660046157de565b601560209081526000928352604080842090915290825290205481565b6104eb6104e63660046157a4565b6110c3565b604080518251600690810b825260208085015190910b908201529181015190820152606001610429565b61041f6105233660046157de565b600e60209081526000928352604080842090915290825290205481565b61041f61054e3660046157a4565b600a6020526000908152604090205481565b61049861056e3660046157a4565b6112f0565b601c54610586906001600160a01b031681565b6040516104299190615aca565b61041f6105a13660046157de565b601860209081526000928352604080842090915290825290205481565b6104986114ab565b6105e96105d43660046157a4565b60066020526000908152604090205460ff1681565b6040519015158152602001610429565b6104986106073660046157a4565b611537565b61049861061a366004615862565b6116cf565b61049861062d3660046157a4565b611900565b610498610640366004615862565b6119b4565b6104986106533660046157de565b611c77565b6104986106663660046157a4565b611d1c565b600354610586906001600160a01b031681565b61041f601f5481565b6104986106953660046157a4565b611dce565b61041f60215481565b6104986106b13660046157a4565b611de7565b6104986106c43660046157a4565b611ec8565b61041f6106d73660046157de565b602860209081526000928352604080842090915290825290205481565b610498610702366004615a4e565b611fa7565b6105e96107153660046157a4565b612007565b61041f6107283660046157a4565b612067565b61049861073b366004615862565b61219d565b61049861074e3660046157a4565b6122ec565b6104986107613660046157a4565b612389565b61041f60225481565b610465612484565b6105866107853660046157a4565b6001602052600090815260409020546001600160a01b031681565b61041f6107ae3660046157a4565b612490565b6105e96107c13660046157a4565b60196020526000908152604090205460ff1681565b6104986107e4366004615a4e565b612533565b6104986107f73660046157de565b612591565b61046561267f565b6104986108123660046159b9565b61268b565b6105866108253660046157a4565b6002602052600090815260409020546001600160a01b031681565b61049861084e3660046157a4565b6127a1565b610498610861366004615817565b612880565b61041f6108743660046157de565b600d60209081526000928352604080842090915290825290205481565b61049861089f36600461598d565b612a50565b6104986108b236600461598d565b612cb1565b61041f6108c53660046157a4565b60296020526000908152604090205481565b61041f60205481565b6104986108ee3660046157a4565b612d8b565b6104986109013660046157a4565b612e3f565b6104986109143660046157de565b612eb5565b6105e96109273660046157a4565b600c6020526000908152604090205460ff1681565b61041f613334565b610498610952366004615a4e565b6133ca565b61041f6109653660046157de565b602560209081526000928352604080842090915290825290205481565b6104986109903660046157a4565b61342a565b6104986109a336600461598d565b613698565b6104986109b6366004615a4e565b61391c565b6105e96109c93660046157a4565b60056020526000908152604090205460ff1681565b6104986109ec3660046158f6565b61397c565b6104986109ff3660046157a4565b613a35565b601d54610586906001600160a01b031681565b610498610a253660046157a4565b613afb565b610498610a38366004615a4e565b613b98565b61041f610a4b3660046157de565b601660209081526000928352604080842090915290825290205481565b610498610a763660046158a3565b613c1c565b610498610a89366004615862565b613e53565b61041f60245481565b61041f610aa53660046157a4565b600b6020526000908152604090205481565b610498610ac5366004615a4e565b613fd0565b610498610ad83660046157a4565b614030565b610586610aeb3660046157a4565b602c602052600090815260409020546001600160a01b031681565b610498610b143660046157a4565b6140d8565b601e54610586906001600160a01b031681565b61041f610b3a3660046157a4565b602a6020526000908152604090205481565b610498610b5a366004615862565b61418c565b61041f60095481565b600454610586906001600160a01b031681565b610498610b893660046157a4565b6143d1565b6105e9610b9c36600461593c565b614489565b61041f60235481565b610498610bb836600461598d565b614572565b600080610bc983612067565b6022549091504290610be490610bdf9083615d13565b614662565b6001600160a01b0385166000908152602960205260409020541115610c88576022546001600160a01b038516600090815260296020526040902054610c299042615d13565b10610c65576022546001600160a01b038516600090815260296020526040902054610c549190615c39565b610c5e9082615d13565b9050610c9e565b6001600160a01b038416600090815260296020526040902054610c5e9082615d13565b610c9142614662565b610c9b9082615d13565b90505b610ca8818361467c565b610cb185612490565b610cbb9190615c39565b949350505050565b6060610ccf60266146a6565b905090565b6000610ce16026846146ba565b15610dd4576000610cf1846110c3565b90508060400151600014610dd2576001600160a01b03841660009081526014602052604081205460ff16610d32578160200151610d2d90615d85565b610d38565b81602001515b601e5460225460405163a0d2710760e01b8152929350610dc9926001600160a01b039092169163a0d2710791610d749189918791600401615c0a565b60206040518083038186803b158015610d8c57600080fd5b505afa158015610da0573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610dc49190615a67565b6146dc565b92505050610dd4565b505b92915050565b6001600160a01b038381166000908152600160205260409020548491163314610e1657604051636efb4f4160e11b815260040160405180910390fd5b602054610e239042615c39565b6001600160a01b03808616600081815260176020908152604080832094891680845294825280832095909555918152601882528381209281529190529081208054849290610e72908490615c39565b90915550610e8390508484846146ed565b6001600160a01b038085166000908152602860209081526040808320938716835292905220548015801590610ec25750602154610ec082866148fb565b105b15610ee057604051636f447fcd60e11b815260040160405180910390fd5b836001600160a01b0316856001600160a01b03167f9aaab310d247ad45aef26bbdefc4ebf20c728fdb84c92b95b2b05d21826940de85604051610f2591815260200190565b60405180910390a35050505050565b336000818152600c602052604090205460ff1615610f655760405163ad2fdf3b60e01b815260040160405180910390fd5b610f70601a826146ba565b610f8c5760405162941a5760e11b815260040160405180910390fd5b610f9581614a19565b15610ff0576001600160a01b038116600081815260296020908152604080832054600f835281842054601090935292819020549051600080516020615e3d83398151915293610fe79390929091615c23565b60405180910390a25b6001600160a01b0381166000908152600f602052604090205482111561106f5761101981614bef565b6001600160a01b038116600081815260296020908152604080832054600f835281842054601090935292819020549051600080516020615e3d833981519152936110669390929091615c23565b60405180910390a25b61107a818484614c7d565b601c546001600160a01b03808516918382169116600080516020615e1d833981519152856110a6614d7a565b6040805192835260208301919091520160405180910390a4505050565b60408051606081018252600080825260208201819052918101919091526110e942614662565b6001600160a01b0383166000908152602b6020526040902060010154141561115f57506001600160a01b03166000908152602b602090815260409182902082516060810184528154600681810b810b810b8352600160381b909104810b810b900b92810192909252600101549181019190915290565b6040805160028082526060820183526000928392919060208301908036833701905050905061118d42614662565b6111979042615d13565b816000815181106111aa576111aa615dee565b602002602001019063ffffffff16908163ffffffff16815250506022546111d042614662565b6111da9042615d13565b6111e49190615c39565b816001815181106111f7576111f7615dee565b63ffffffff909216602092830291909101820152601e546001600160a01b0386811660009081526013909352604080842054905163dc686d9160e01b81529282169263dc686d919261124f9216908690600401615ade565b60606040518083038186803b15801561126757600080fd5b505afa15801561127b573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061129f9190615a0b565b600692830b90920b80875291945091506112ba908290615cc3565b600690810b900b602085015282156112df576112d542614662565b60408501526112e7565b600060408501525b5050505b919050565b336000818152600c602052604090205460ff1615611321576040516362e6201d60e01b815260040160405180910390fd5b6001600160a01b038082166000908152601660209081526040808320938616835292905220548061136557604051636258f48160e01b815260040160405180910390fd5b42811061138557604051630fd0eeef60e11b815260040160405180910390fd5b6001600160a01b0382166000908152600b60205260409020546113be576001600160a01b0382166000908152600b602052604090204290555b6113c9600783614d94565b506001600160a01b038083166000818152601560209081526040808320948816808452948252808320805490849055938352600d825280832094835293905291822080549192839261141c908490615c39565b9091555050601c546001600160a01b03858116911614156114585780600960008282546114499190615c39565b90915550611458905081614da9565b836001600160a01b0316836001600160a01b03167f3673530133b6da67e9854f605b0cfa7bb9798cd33c18036dfc10d8da7c4d4a758360405161149d91815260200190565b60405180910390a350505050565b6004546001600160a01b031633146114d657604051637ef5703160e11b815260040160405180910390fd5b60048054600380546001600160a01b0383166001600160a01b031991821681179092559091169091556040517fc73be659241aade67e9a059bcf21494955018b213dbd1179054ccf928b13f3b69161152d91615aca565b60405180910390a1565b600260005414156115635760405162461bcd60e51b815260040161155a90615bd3565b60405180910390fd5b600260009081553381526018602090815260408083206001600160a01b03851684529091529020546115a85760405163184c088160e21b815260040160405180910390fd5b3360009081526017602090815260408083206001600160a01b038516845290915290205442116115eb576040516327cfdcb760e01b815260040160405180910390fd5b336000908152600c602052604090205460ff161561161c576040516362e6201d60e01b815260040160405180910390fd5b3360008181526018602090815260408083206001600160a01b038681168086529184528285208054908690559585526017845282852082865290935290832092909255601c541614156116725761167281614e94565b6116866001600160a01b0383163383614edc565b6040518181526001600160a01b0383169033907f2717ead6b9200dd235aad468c9809ea400fe33ac69b5bfaa6d3e90fc922b63989060200160405180910390a350506001600055565b600260005414156116f25760405162461bcd60e51b815260040161155a90615bd3565b60026000556117026026836146ba565b61171f5760405163e0b6aead60e01b815260040160405180910390fd5b61172a601a846146ba565b61174757604051636211d34960e01b815260040160405180910390fd5b6001600160a01b03831660009081526012602052604090206117699083614d94565b5061177383614f37565b6021546001600160a01b038085166000908152602860209081526040808320938716835292905220546117b1906117ab908490615c39565b846148fb565b10156117d057604051636f447fcd60e11b815260040160405180910390fd5b6001600160a01b038316600081815260296020908152604080832054600f835281842054601090935292819020549051600080516020615e3d8339815191529361181d9390929091615c23565b60405180910390a261183a6001600160a01b038316333084614f95565b6001600160a01b03808416600090815260286020908152604080832093861683529290529081208054839290611871908490615c39565b909155506118849050610dc482846148fb565b6001600160a01b038416600090815260106020526040812080549091906118ac908490615c39565b909155505060405181815233906001600160a01b0384811691908616907f4e186bc75a2220191b826baff3ee63c3e970e94e58a9007ff94c9a7b8e6ebb3f9060200160405180910390a45050600160005550565b3360009081526006602052604090205460ff1661193057604051630942721960e31b815260040160405180910390fd5b6001600160a01b0381166000908152600c602052604090205460ff16611969576040516310cec38560e21b815260040160405180910390fd5b6001600160a01b0381166000818152600c6020526040808220805460ff19169055513392917fe02b2375d8fb4aef3e5bc5d53bffcf70b6f185c5c93e69dcbe8b6cfc58e837e291a350565b600260005414156119d75760405162461bcd60e51b815260040161155a90615bd3565b60026000556119e7601a846146ba565b611a0457604051636211d34960e01b815260040160405180910390fd5b601c546001600160a01b0383811691161415611a325760405162822d9760e71b815260040160405180910390fd5b6040516370a0823160e01b81526000906001600160a01b038416906370a0823190611a61903090600401615aca565b60206040518083038186803b158015611a7957600080fd5b505afa158015611a8d573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611ab19190615a67565b9050611ac86001600160a01b038416333085614f95565b600081846001600160a01b03166370a08231306040518263ffffffff1660e01b8152600401611af79190615aca565b60206040518083038186803b158015611b0f57600080fd5b505afa158015611b23573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611b479190615a67565b611b519190615d13565b9050600061271060245483611b669190615c65565b611b709190615c51565b9050611b7c8183615d13565b6001600160a01b038088166000908152600e60209081526040808320938a1683529290529081208054909190611bb3908490615c39565b90915550506001600160a01b0380871660009081526025602090815260408083208985168085529252909120429055600354611bf0921683614edc565b6001600160a01b0386166000908152601160205260409020611c129086614d94565b50336001600160a01b0316856001600160a01b0316876001600160a01b03167fec1a37d4a331a5059081e0fb5da1735e7890900cd215a4fb1e9f2779fd7b83eb85604051611c6291815260200190565b60405180910390a45050600160005550505050565b6001600160a01b038281166000908152600160205260409020548391163314611cb357604051636efb4f4160e11b815260040160405180910390fd5b6001600160a01b03838116600081815260026020908152604080832080546001600160a01b031916888716908117909155600190925280832054905191941692917fa8bad3f0b781e1d954af9945167d5f80bfe5e57930f17c93843187c77557a6b891a4505050565b6001600160a01b038181166000908152600260205260409020548291163314611d585760405163cfe9663360e01b815260040160405180910390fd5b6001600160a01b03828116600081815260016020908152604080832080546002909352818420805487166001600160a01b031980861691909117909255805490911690555193169283929133917fcf30c54296d5eee76168b564c59c50578d49c271733a470f32707c8cfbc88a8b9190a4505050565b6040516331cee75f60e21b815260040160405180910390fd5b6003546001600160a01b03163314611e12576040516354348f0360e01b815260040160405180910390fd5b611e1d602682614fd3565b611e3a57604051630a8d08b160e01b815260040160405180910390fd5b6001600160a01b038116600090815260136020908152604080832080546001600160a01b031916905560148252808320805460ff19169055602b90915280822080546001600160701b031916815560010191909155517f51199d699bdfd516fa88dd0d2f8487c40c147b4867acaa23adc8d4df6b098e5690611ebd908390615aca565b60405180910390a150565b6003546001600160a01b03163314611ef3576040516354348f0360e01b815260040160405180910390fd5b6001600160a01b038116611f1a5760405163d92e233d60e01b815260040160405180910390fd5b6001600160a01b03811660009081526005602052604090205460ff1615611f545760405163546da66560e11b815260040160405180910390fd5b6001600160a01b03811660009081526005602052604090819020805460ff19166001179055517f049ccb28ab796d3225573a065712f6e7754487ced56056cda8889c337511807b90611ebd908390615aca565b6003546001600160a01b03163314611fd2576040516354348f0360e01b815260040160405180910390fd5b60248190556040518181527f4c10ca068ff7002cf5da78f2f697d1e91f6f0ac27f7344b28e8ef25263f87e5d90602001611ebd565b6000612011614d7a565b602e5561201f6007836146ba565b156112eb577f4851cad52e624c8f7a1d44c28a80db05988ba2451fc0db6b0ec338d8eca95afb602e5460405161205791815260200190565b60405180910390a1506001919050565b6000805b6001600160a01b038316600090815260126020526040902061208c90614fe8565b811015612197576001600160a01b03831660009081526012602052604081206120b59083614ff2565b90506120c26026826146ba565b156121845760006120d2826110c3565b90508060400151600014612182576001600160a01b03821660009081526014602052604081205460ff1661211357816020015161210e90615d85565b612119565b81602001515b601e546001600160a01b03888116600090815260286020908152604080832089851684529091529081902054602254915163a0d2710760e01b815294955061217494929093169263a0d2710792610d74928791600401615c0a565b61217e9086615c39565b9450505b505b508061218f81615d56565b91505061206b565b50919050565b3360009081526005602052604090205460ff166121cd57604051637e57b1e160e01b815260040160405180910390fd5b6001600160a01b0383166000908152600c602052604090205460ff16612206576040516310cec38560e21b815260040160405180910390fd5b6122118383836146ed565b60035460405163a9059cbb60e01b81526001600160a01b038481169263a9059cbb9261224592909116908590600401615b3a565b602060405180830381600087803b15801561225f57600080fd5b505af192505050801561228f575060408051601f3d908101601f1916820190925261228c918101906159f0565b60015b6122985761229a565b505b336001600160a01b0316836001600160a01b03167f6e10247c3c094d220ee99436c164b7f38d63b335a20ed817cbefaee4bb02d20e84846040516122df929190615b3a565b60405180910390a3505050565b6003546001600160a01b03163314612317576040516354348f0360e01b815260040160405180910390fd5b6001600160a01b03811661233e5760405163d92e233d60e01b815260040160405180910390fd5b601e80546001600160a01b0319166001600160a01b0383161790556040517f71973fd672e51deb8f739b1f7e1eab991936645acd6f83e2bde6eeeaff5490b090611ebd908390615aca565b3360009081526005602052604090205460ff166123b957604051637e57b1e160e01b815260040160405180910390fd5b6001600160a01b0381166000908152600c602052604090205460ff166123f2576040516310cec38560e21b815260040160405180910390fd5b6123fd600782614fd3565b50601c546001600160a01b038083166000818152600d602090815260408083209490951680835293815284822054928252601881528482208483529052929092205461244b92849291614ffe565b60405133906001600160a01b038316907f038a17b9b553c0c3fc2ed14b957a5d8420a1666fd2efe5c1b3fe5f23eea61bb390600090a350565b6060610ccf601a6146a6565b60008061249c83612067565b6022546001600160a01b038516600090815260296020526040902054919250906124c69042615d13565b1015610dd457600081116124f2576001600160a01b0383166000908152600f602052604090205461252c565b6001600160a01b038316600090815260106020908152604080832054600f90925290912054612522908390615c65565b61252c9190615c51565b9150612197565b6003546001600160a01b0316331461255e576040516354348f0360e01b815260040160405180910390fd5b60208181556040518281527fc8d443472c9783cc36f8f5f5091f08ce9f37fc2f9e6d79cf1d9aaf40a433fee29101611ebd565b6001600160a01b0382811660009081526001602052604090205483911633146125cd57604051636efb4f4160e11b815260040160405180910390fd5b816001600160a01b0316836001600160a01b031614156126005760405163afe7ad4960e01b815260040160405180910390fd5b6001600160a01b038381166000818152602c6020908152604080832080546001600160a01b0319169588169586179055602d825280832094835293905282902042905590517fff0456758201108de53c0ff04c69988d4678ff455b2ce6f733328cf85722c04c90612672908590615aca565b60405180910390a2505050565b6060610ccf60076146a6565b6003546001600160a01b031633146126b6576040516354348f0360e01b815260040160405180910390fd5b6001600160a01b0381166126dd5760405163d92e233d60e01b815260040160405180910390fd5b6001600160a01b03831673eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee141561273e576040516001600160a01b0382169083156108fc029084906000818181858888f19350505050158015612738573d6000803e3d6000fd5b50612752565b6127526001600160a01b0384168284614edc565b604080516001600160a01b0385811682526020820185905283168183015290517f9a3055ded8c8b5f21bbf4946c5afab6e1fa8b3f057922658e5e1ade125fb0b1e9181900360600190a1505050565b6003546001600160a01b031633146127cc576040516354348f0360e01b815260040160405180910390fd5b6001600160a01b0381166127f35760405163d92e233d60e01b815260040160405180910390fd5b6001600160a01b03811660009081526006602052604090205460ff161561282d5760405163274e25dd60e11b815260040160405180910390fd5b6001600160a01b03811660009081526006602052604090819020805460ff19166001179055517f8addc69f897ecca0e41d70ed4ff9d75a9148a615a0fbda8597e53aea2684302f90611ebd908390615aca565b6001600160a01b0383811660009081526001602052604090205484911633146128bc57604051636efb4f4160e11b815260040160405180910390fd5b6001600160a01b0382166128e35760405163d92e233d60e01b815260040160405180910390fd5b6001600160a01b038085166000908152601860209081526040808320938716835292905220546129265760405163184c088160e21b815260040160405180910390fd5b6001600160a01b03808516600090815260176020908152604080832093871683529290522054421161296b576040516327cfdcb760e01b815260040160405180910390fd5b6001600160a01b0384166000908152600c602052604090205460ff16156129a5576040516362e6201d60e01b815260040160405180910390fd5b6001600160a01b03808516600081815260186020908152604080832094881680845294825280832080549084905593835260178252808320858452909152812055906129f2908483614edc565b826001600160a01b0316846001600160a01b0316866001600160a01b03167ffdb7893bf11f50c621e59cc7f1cf540e94295cb27ca869ec7ed7618ca792886284604051612a4191815260200190565b60405180910390a45050505050565b60026000541415612a735760405162461bcd60e51b815260040161155a90615bd3565b60026000908155338152600c602052604090205460ff1615612aa8576040516362e6201d60e01b815260040160405180910390fd5b612ab3601a336146ba565b15612ad15760405163d7229c4360e01b815260040160405180910390fd5b601f54612ade9042615c39565b3360009081526016602090815260408083206001600160a01b03871680855292528083209390935591516370a0823160e01b81529091906370a0823190612b29903090600401615aca565b60206040518083038186803b158015612b4157600080fd5b505afa158015612b55573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612b799190615a67565b9050612b906001600160a01b038416333085614f95565b6040516370a0823160e01b815281906001600160a01b038516906370a0823190612bbe903090600401615aca565b60206040518083038186803b158015612bd657600080fd5b505afa158015612bea573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612c0e9190615a67565b612c189190615d13565b336000908152601960209081526040808320805460ff19166001179055601582528083206001600160a01b0388168452909152812080549294508492909190612c62908490615c39565b90915550506040518281526001600160a01b0384169033907fa7e66869262026842e8d81f5e6806cdc8d846e27c824e2e22f4fe51442771b349060200160405180910390a35050600160005550565b602054612cbe9042615c39565b3360008181526017602090815260408083206001600160a01b03881680855290835281842095909555928252600d81528282209382529290925281208054839290612d0a908490615d13565b90915550503360009081526018602090815260408083206001600160a01b038616845290915281208054839290612d42908490615c39565b90915550506040518181526001600160a01b0383169033907f9aaab310d247ad45aef26bbdefc4ebf20c728fdb84c92b95b2b05d21826940de9060200160405180910390a35050565b6003546001600160a01b03163314612db6576040516354348f0360e01b815260040160405180910390fd5b6001600160a01b03811660009081526005602052604090205460ff16612def576040516336fe17e760e21b815260040160405180910390fd5b6001600160a01b03811660009081526005602052604090819020805460ff19169055517f3ed8cbce8cab40e59282f1743e2b607effa08b5cbe0111bb4721134f2f80d02590611ebd908390615aca565b6003546001600160a01b03163314612e6a576040516354348f0360e01b815260040160405180910390fd5b600480546001600160a01b0319166001600160a01b0383161790556040517fe987aaedf9d279143bdf1eee16cf1d0feb47742867d81083df8d6cd0a5ac857f90611ebd908390615aca565b6001600160a01b038181166000908152600160205260409020548291163314612ef157604051636efb4f4160e11b815260040160405180910390fd5b6001600160a01b0383166000908152600c602052604090205460ff1680612f3057506001600160a01b0382166000908152600c602052604090205460ff165b15612f4e5760405163ad2fdf3b60e01b815260040160405180910390fd5b6001600160a01b038381166000908152602c6020526040902054811690831614612f8b57604051630ced616b60e21b815260040160405180910390fd5b6001600160a01b038084166000908152602d6020908152604080832093861683529290522054612fbd90603c90615c39565b421015612fdd576040516356248e9760e01b815260040160405180910390fd5b612fe683614f37565b612fef82614f37565b6001600160a01b038316600090815260116020526040812061301090614fe8565b11156130f2576001600160a01b03831660009081526011602052604081206130389082614ff2565b6001600160a01b038086166000908152600e6020818152604080842085871680865290835281852054958a168552928252808420928452919052812080549394509192613086908490615c39565b90915550506001600160a01b038085166000818152600e6020908152604080832094861683529381528382208290559181526011909152206130c89082614fd3565b506001600160a01b03831660009081526011602052604090206130eb9082614d94565b5050612fef565b6001600160a01b038316600090815260126020526040812061311390614fe8565b11156131f5576001600160a01b038316600090815260126020526040812061313b9082614ff2565b6001600160a01b03808616600090815260286020818152604080842085871680865290835281852054958a168552928252808420928452919052812080549394509192613189908490615c39565b90915550506001600160a01b03808516600090815260286020908152604080832085851684528252808320839055928616825260129052206131cb9082614d94565b506001600160a01b03841660009081526012602052604090206131ee9082614fd3565b50506130f2565b6001600160a01b0380841660009081526010602052604080822054928516825281208054909190613227908490615c39565b90915550506001600160a01b038084166000908152601060209081526040808320839055600f9091528082205492851682528120805490919061326b908490615c39565b90915550506001600160a01b0383166000908152600f6020908152604080832083905560299091528120556132a1601a84614fd3565b506001600160a01b03808416600081815260016020908152604080832080546001600160a01b031990811690915560028352818420805482169055602d8352818420958816808552958352818420849055938352602c909152908190208054909216909155517f9b712b63e3fb1325fa042d3c238ce8144937875065900528ea1e4f3b00f379f290612672908690615aca565b600954601c54601d546040516370a0823160e01b8152600093926001600160a01b03908116926370a08231926133709290911690600401615aca565b60206040518083038186803b15801561338857600080fd5b505afa15801561339c573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906133c09190615a67565b610ccf9190615c84565b6003546001600160a01b031633146133f5576040516354348f0360e01b815260040160405180910390fd5b60238190556040518181527fbdcfd7b8482f31cff6a87c362d9e2e3887f4cdc2018c7c485d8e78a7b2fadb6990602001611ebd565b6003546001600160a01b03163314613455576040516354348f0360e01b815260040160405180910390fd5b613460602682614d94565b61347d5760405163f25e6b9f60e01b815260040160405180910390fd5b601e5460405163eb37d34960e01b81526001600160a01b039091169063eb37d349906134ad908490600401615aca565b60206040518083038186803b1580156134c557600080fd5b505afa1580156134d9573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906134fd91906157c1565b6001600160a01b03828116600090815260136020526040902080546001600160a01b0319169290911691821790556135485760405163d92e233d60e01b815260040160405180910390fd5b601e546001600160a01b038281166000908152601360205260409081902054905163696a437b60e01b81529282169263696a437b9261358b921690600401615aca565b60206040518083038186803b1580156135a357600080fd5b505afa1580156135b7573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906135db91906159f0565b6001600160a01b0382166000908152601460205260409020805460ff191691151591909117905561360b816110c3565b6001600160a01b0382166000908152602b60209081526040918290208351815492850151600690810b66ffffffffffffff908116600160381b026001600160701b03199095169290910b161791909117815591810151600190920191909155517fabfa8db4d238fa78bf4e15fcc91328dd35f3978f200e2857a56bb719732b7b0b90611ebd908390615aca565b602e546136b857604051630262ab9b60e61b815260040160405180910390fd5b60006136c2614d7a565b336000818152600c60205260409020549192509060ff16156136f75760405163ad2fdf3b60e01b815260040160405180910390fd5b613702601a826146ba565b61371e5760405162941a5760e11b815260040160405180910390fd5b61372781614a19565b15613782576001600160a01b038116600081815260296020908152604080832054600f835281842054601090935292819020549051600080516020615e3d833981519152936137799390929091615c23565b60405180910390a25b601e546001600160a01b038581166000908152600d60209081526040808320601c548516845290915280822054905163435b21c160e01b8152600481019190915290928392839291169063435b21c19060240160606040518083038186803b1580156137ed57600080fd5b505afa158015613801573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906138259190615a80565b919450925090506000613843868361383d8a87615c65565b87615154565b6001600160a01b0386166000908152600f60205260409020549091508111156138c55761386f85614bef565b6001600160a01b038516600081815260296020908152604080832054600f835281842054601090935292819020549051600080516020615e3d833981519152936138bc9390929091615c23565b60405180910390a25b6138d0858983614c7d565b6000602e55601c5460408051838152602081018990526001600160a01b038b81169389821693911691600080516020615e1d833981519152910160405180910390a45050505050505050565b6003546001600160a01b03163314613947576040516354348f0360e01b815260040160405180910390fd5b601f8190556040518181527fd319ef78d2b690bb773fcccc2d096306bac7c9222dd0bb6b300f461e4a376b4390602001611ebd565b3360009081526005602052604090205460ff166139ac57604051637e57b1e160e01b815260040160405180910390fd5b6001600160a01b0384166000908152600c602052604090205460ff166139e5576040516310cec38560e21b815260040160405180910390fd5b6139f184848484614ffe565b336001600160a01b0385167f10a73de7ab6e9023aa6e2bc23f7abf4dcef591487e7e55f44c00e34fe60d56db613a278486615c39565b60405190815260200161149d565b613a40601a826146ba565b15613a5e57604051630809740d60e01b815260040160405180910390fd5b6001600160a01b03811660009081526019602052604090205460ff1615613a9857604051632f3d320560e01b815260040160405180910390fd5b613aa3601a82614d94565b506001600160a01b03811660008181526001602052604080822080546001600160a01b0319163390811790915590519092917fed3faef50715743626cd57de74281a2b17cdbfc11c0486feda541fb911e0293d91a350565b6003546001600160a01b03163314613b26576040516354348f0360e01b815260040160405180910390fd5b6001600160a01b038116613b4d5760405163d92e233d60e01b815260040160405180910390fd5b601d80546001600160a01b0319166001600160a01b0383161790556040517feb931b4b5a98d20a6b1e6693a7c59d8e337a06e2f1473bb776e19251db7ae25090611ebd908390615aca565b6003546001600160a01b03163314613bc3576040516354348f0360e01b815260040160405180910390fd5b62015180811015613be757604051633f384aad60e21b815260040160405180910390fd5b60228190556040518181527f54aafa56429e22230b52f1495588ffc632277d74f3a85ec755e13ac50c1584d990602001611ebd565b60026000541415613c3f5760405162461bcd60e51b815260040161155a90615bd3565b600260009081556001600160a01b03858116825260016020526040909120548591163314613c8057604051636efb4f4160e11b815260040160405180910390fd5b6001600160a01b03808616600090815260256020908152604080832093881683529290522054613cb290603c90615c39565b4211613cd157604051631e0b407560e01b815260040160405180910390fd5b6001600160a01b038086166000908152600e6020908152604080832093881683529290522054831115613d175760405163024ae82d60e61b815260040160405180910390fd5b6001600160a01b0385166000908152600c602052604090205460ff1615613d515760405163ad2fdf3b60e01b815260040160405180910390fd5b6001600160a01b038086166000908152600e6020908152604080832093881683529290529081208054859290613d88908490615d13565b90915550613da290506001600160a01b0385168385614edc565b6001600160a01b038086166000908152600e6020908152604080832093881683529290522054613df0576001600160a01b0385166000908152601160205260409020613dee9085614fd3565b505b816001600160a01b0316846001600160a01b0316866001600160a01b03167f53e982dd9ec088d634c74c98fbbc161f808b4b6469a26c657120b9a31cb34bfe86604051613e3f91815260200190565b60405180910390a450506001600055505050565b336000818152600c602052604090205460ff1615613e845760405163ad2fdf3b60e01b815260040160405180910390fd5b6001600160a01b0383166000908152600c602052604090205460ff1615613ebe576040516362e6201d60e01b815260040160405180910390fd5b613ec9601a826146ba565b613ee55760405162941a5760e11b815260040160405180910390fd5b6001600160a01b038082166000908152600e6020908152604080832093881683529290522054821115613f2b5760405163356680b760e01b815260040160405180910390fd5b6001600160a01b038082166000908152600e6020908152604080832093881683529290529081208054849290613f62908490615d13565b90915550613f7c90506001600160a01b0385168484614edc565b826001600160a01b0316816001600160a01b0316856001600160a01b0316600080516020615e1d83398151915285613fb2614d7a565b6040805192835260208301919091520160405180910390a450505050565b6003546001600160a01b03163314613ffb576040516354348f0360e01b815260040160405180910390fd5b60218190556040518181527f24d51b415694a791b1c77df7817c075ac82b83ce611bcd8627d2e66cf37aa3e790602001611ebd565b6003546001600160a01b0316331461405b576040516354348f0360e01b815260040160405180910390fd5b6001600160a01b0381166140825760405163d92e233d60e01b815260040160405180910390fd5b61408d600954614e94565b601c80546001600160a01b0319166001600160a01b0383161790556040517f1d1a3e7caf0717056e48dc8aefa54d806c7af86324fece4e5d49f8e1f01f84bf90611ebd908390615aca565b6003546001600160a01b03163314614103576040516354348f0360e01b815260040160405180910390fd5b6001600160a01b03811660009081526006602052604090205460ff1661413c57604051633ca0d42760e11b815260040160405180910390fd5b6001600160a01b03811660009081526006602052604090819020805460ff19169055517f5e8bd21d0a98cb2caf33706e56139ff40ffbdca7ec5d9d412a0a2292496dc70e90611ebd908390615aca565b3360009081526005602052604090205460ff166141bc57604051637e57b1e160e01b815260040160405180910390fd5b6001600160a01b0383166000908152600c602052604090205460ff166141f5576040516310cec38560e21b815260040160405180910390fd5b6001600160a01b038316600090815260116020526040902061421790836146ba565b61423457604051632eda7a1160e01b815260040160405180910390fd5b6001600160a01b038084166000908152600e60209081526040808320938616835292905220548111156142795760405162919bed60e01b815260040160405180910390fd5b60035460405163a9059cbb60e01b81526001600160a01b038481169263a9059cbb926142ad92909116908590600401615b3a565b602060405180830381600087803b1580156142c757600080fd5b505af19250505080156142f7575060408051601f3d908101601f191682019092526142f4918101906159f0565b60015b61430057614302565b505b6001600160a01b038084166000908152600e6020908152604080832093861683529290529081208054839290614339908490615d13565b90915550506001600160a01b038084166000908152600e602090815260408083209386168352929052205461438c576001600160a01b038316600090815260116020526040902061438a9083614fd3565b505b336001600160a01b0316836001600160a01b03167f20262b97130b5cb8f80624eed2733df2b05db4a0789b4a3d0157e1d31833310484846040516122df929190615b3a565b3360009081526006602052604090205460ff1661440157604051630942721960e31b815260040160405180910390fd5b6001600160a01b0381166000908152600c602052604090205460ff161561443b576040516304ee891b60e11b815260040160405180910390fd5b6001600160a01b0381166000818152600c6020526040808220805460ff19166001179055513392917f070125a1c0f5202217aae14ec399abfaaa13c2fd98a91d43bd3a897dd4751e8091a350565b6000614493614d7a565b602e556144a16007876146ba565b80156144d257506001600160a01b038087166000908152600d60209081526040808320938916835292905220548411155b80156144f657506001600160a01b0386166000908152600a60205260409020548311155b801561452557506001600160a01b0386166000908152600b602052604090205482906145229042615d13565b10155b15614569577f4851cad52e624c8f7a1d44c28a80db05988ba2451fc0db6b0ec338d8eca95afb602e5460405161455d91815260200190565b60405180910390a15060015b95945050505050565b6003546001600160a01b0316331461459d576040516354348f0360e01b815260040160405180910390fd5b6145a8601a836146ba565b6145c557604051636211d34960e01b815260040160405180910390fd5b6145ce82614f37565b6001600160a01b0382166000908152600f6020526040812080548392906145f6908490615c39565b90915550506001600160a01b038216600081815260296020908152604080832054600f909252918290205491517f5abcf5031fdbd3badb9d1e09094208de329aee72730e87650f346584205d23d192614656928252602082015260400190565b60405180910390a25050565b6000602254826146729190615d71565b610dd49083615d13565b6000602254831015612197576022546146958385615c65565b61469f9190615c51565b9050610dd4565b606060006146b3836151b1565b9392505050565b6001600160a01b038116600090815260018301602052604081205415156146b3565b6000610dd48260225460235461520d565b600260005414156147105760405162461bcd60e51b815260040161155a90615bd3565b600260009081556001600160a01b038416815260126020526040902061473690836146ba565b614752576040516241cfa560e21b815260040160405180910390fd5b6001600160a01b038084166000908152602860209081526040808320938616835292905220548111156147985760405163435b562560e01b815260040160405180910390fd5b6147a1836152bb565b60006147b0610dc483856148fb565b6001600160a01b03851660009081526010602052604090205490915015614866576001600160a01b038416600090815260106020908152604080832054600f90925290912054614801908390615c65565b61480b9190615c51565b6001600160a01b0385166000908152600f602052604081208054909190614833908490615d13565b90915550506001600160a01b03841660009081526010602052604081208054839290614860908490615d13565b90915550505b6001600160a01b0380851660009081526028602090815260408083209387168352929052908120805484929061489d908490615d13565b90915550506001600160a01b038085166000908152602860209081526040808320938716835292905220546148f0576001600160a01b03841660009081526012602052604090206148ee9084614fd3565b505b505060016000555050565b6001600160a01b0381166000908152602b602052604081206001015415610dd4576001600160a01b03821660009081526014602052604081205460ff1661496d576001600160a01b0383166000908152602b602052604090205461496890600160381b900460060b615d85565b614991565b6001600160a01b0383166000908152602b6020526040902054600160381b900460060b5b601e5460225460405163a0d2710760e01b81529293506001600160a01b039091169163a0d27107916149c99188918691600401615c0a565b60206040518083038186803b1580156149e157600080fd5b505afa1580156149f5573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610cbb9190615a67565b6000614a2442614662565b6001600160a01b03831660009081526029602052604090205410156112eb57614a5460225442610bdf9190615d13565b6001600160a01b03831660009081526029602052604090205411614aca57614a7b826152bb565b6001600160a01b038216600090815260106020908152604080832054600f90925290912055614aa942614662565b6001600160a01b038316600090815260296020526040902055506001919050565b6022546001600160a01b038316600090815260296020526040902054614af09042615d13565b10614b4c57614afe826152bb565b6001600160a01b038216600090815260106020908152604080832054600f83528184205560225460299092528220805491929091614b3d908490615c39565b90915550600191506112eb9050565b614b5542614662565b6001600160a01b0383166000908152602a602052604090205410156112eb576001600160a01b038216600090815260106020526040902054614b96836152bb565b6001600160a01b038316600090815260106020908152604080832054600f909252909120548291614bc691615c65565b614bd09190615c51565b6001600160a01b0384166000908152600f602052604090205550919050565b6001600160a01b038116600090815260296020526040902054614c3490614c169042615d13565b6001600160a01b03831660009081526010602052604090205461467c565b6001600160a01b0382166000908152600f602052604081208054909190614c5c908490615c39565b90915550506001600160a01b03166000908152602960205260409020429055565b6001600160a01b0383166000908152600f6020526040902054811115614cb65760405163356680b760e01b815260040160405180910390fd5b6001600160a01b0383166000908152602a60209081526040808320429055600f90915281208054839290614ceb908490615d13565b90915550506001600160a01b038083166000908152600d60209081526040808320601c5490941683529290529081208054839290614d2a908490615c39565b90915550506001600160a01b0382166000908152600a602052604081208054839290614d57908490615c39565b925050819055508060096000828254614d709190615c39565b9091555050505050565b6000603f5a614d8a906040615c65565b610ccf9190615c51565b60006146b3836001600160a01b0384166152e0565b601c54601d5460405163095ea7b360e01b81526001600160a01b039283169263095ea7b392614ddf929116908590600401615b3a565b602060405180830381600087803b158015614df957600080fd5b505af1158015614e0d573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190614e3191906159f0565b50601d5460405163b6b55f2560e01b8152600481018390526001600160a01b039091169063b6b55f25906024015b600060405180830381600087803b158015614e7957600080fd5b505af1158015614e8d573d6000803e3d6000fd5b5050505050565b8060096000828254614ea69190615d13565b9091555050601d5460405163140e25ad60e31b8152600481018390526001600160a01b039091169063a0712d6890602401614e5f565b614f328363a9059cbb60e01b8484604051602401614efb929190615b3a565b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b03199093169290921790915261532f565b505050565b614f4081614a19565b50614f4a81614bef565b6001600160a01b0381166000908152600f6020908152604080832054601090925290912054614f799190615401565b6001600160a01b039091166000908152600f6020526040902055565b6040516001600160a01b0380851660248301528316604482015260648101829052614fcd9085906323b872dd60e01b90608401614efb565b50505050565b60006146b3836001600160a01b038416615417565b6000610dd4825490565b60006146b3838361550a565b601c546001600160a01b038481169116146150d6576003546001600160a01b038085169163a9059cbb91166150338486615c39565b6040518363ffffffff1660e01b8152600401615050929190615b3a565b602060405180830381600087803b15801561506a57600080fd5b505af192505050801561509a575060408051601f3d908101601f19168201909252615097918101906159f0565b60015b6150d4573d8080156150c8576040519150601f19603f3d011682016040523d82523d6000602084013e6150cd565b606091505b50506150d6565b505b6001600160a01b038085166000908152600d602090815260408083209387168352929052908120805484929061510d908490615d13565b90915550506001600160a01b03808516600090815260186020908152604080832093871683529290529081208054839290615149908490615d13565b909155505050505050565b6000808486602e546151669190615d13565b6151709190615c39565b9050670de0b6b3a7640000846127106151898685615c65565b6151939190615c51565b61519d9190615c65565b6151a79190615c51565b9695505050505050565b60608160000180548060200260200160405190810160405280929190818152602001828054801561520157602002820191906000526020600020905b8154815260200190600101908083116151ed575b50505050509050919050565b600080806000198587098587029250828110838203039150508060001415615247576000841161523c57600080fd5b5082900490506146b3565b80841161525357600080fd5b600084868809600260036001881981018916988990049182028318808302840302808302840302808302840302808302840302808302840302918202909203026000889003889004909101858311909403939093029303949094049190911702949350505050565b6152c481615534565b6001600160a01b03909116600090815260106020526040902055565b600081815260018301602052604081205461532757508154600181810184556000848152602080822090930184905584548482528286019093526040902091909155610dd4565b506000610dd4565b6000615384826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b03166156779092919063ffffffff16565b805190915015614f3257808060200190518101906153a291906159f0565b614f325760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b606482015260840161155a565b600081831061541057816146b3565b5090919050565b6000818152600183016020526040812054801561550057600061543b600183615d13565b855490915060009061544f90600190615d13565b90508181146154b457600086600001828154811061546f5761546f615dee565b906000526020600020015490508087600001848154811061549257615492615dee565b6000918252602080832090910192909255918252600188019052604090208390555b85548690806154c5576154c5615dd8565b600190038181906000526020600020016000905590558560010160008681526020019081526020016000206000905560019350505050610dd4565b6000915050610dd4565b600082600001828154811061552157615521615dee565b9060005260206000200154905092915050565b6000805b6001600160a01b038316600090815260126020526040902061555990614fe8565b811015612197576001600160a01b03831660009081526012602052604081206155829083614ff2565b905061558f6026826146ba565b156156645761559d42614662565b6001600160a01b0382166000908152602b602052604090206001015414615623576155c7816110c3565b6001600160a01b0382166000908152602b60209081526040918290208351815492850151600690810b66ffffffffffffff908116600160381b026001600160701b03199095169290910b16179190911781559101516001909101555b6001600160a01b0380851660009081526028602090815260408083209385168352929052205461565790610dc490836148fb565b6156619084615c39565b92505b508061566f81615d56565b915050615538565b6060610cbb848460008585843b6156d05760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e7472616374000000604482015260640161155a565b600080866001600160a01b031685876040516156ec9190615aae565b60006040518083038185875af1925050503d8060008114615729576040519150601f19603f3d011682016040523d82523d6000602084013e61572e565b606091505b509150915061573e828286615749565b979650505050505050565b606083156157585750816146b3565b8251156157685782518084602001fd5b8160405162461bcd60e51b815260040161155a9190615ba0565b805180151581146112eb57600080fd5b8051600681900b81146112eb57600080fd5b6000602082840312156157b657600080fd5b81356146b381615e04565b6000602082840312156157d357600080fd5b81516146b381615e04565b600080604083850312156157f157600080fd5b82356157fc81615e04565b9150602083013561580c81615e04565b809150509250929050565b60008060006060848603121561582c57600080fd5b833561583781615e04565b9250602084013561584781615e04565b9150604084013561585781615e04565b809150509250925092565b60008060006060848603121561587757600080fd5b833561588281615e04565b9250602084013561589281615e04565b929592945050506040919091013590565b600080600080608085870312156158b957600080fd5b84356158c481615e04565b935060208501356158d481615e04565b92506040850135915060608501356158eb81615e04565b939692955090935050565b6000806000806080858703121561590c57600080fd5b843561591781615e04565b9350602085013561592781615e04565b93969395505050506040820135916060013590565b600080600080600060a0868803121561595457600080fd5b853561595f81615e04565b9450602086013561596f81615e04565b94979496505050506040830135926060810135926080909101359150565b600080604083850312156159a057600080fd5b82356159ab81615e04565b946020939093013593505050565b6000806000606084860312156159ce57600080fd5b83356159d981615e04565b925060208401359150604084013561585781615e04565b600060208284031215615a0257600080fd5b6146b382615782565b600080600060608486031215615a2057600080fd5b615a2984615792565b9250615a3760208501615792565b9150615a4560408501615782565b90509250925092565b600060208284031215615a6057600080fd5b5035919050565b600060208284031215615a7957600080fd5b5051919050565b600080600060608486031215615a9557600080fd5b8351925060208401519150604084015190509250925092565b60008251615ac0818460208701615d2a565b9190910192915050565b6001600160a01b0391909116815260200190565b6001600160a01b038316815260406020808301829052835191830182905260009184820191906060850190845b81811015615b2d57845163ffffffff1683529383019391830191600101615b0b565b5090979650505050505050565b6001600160a01b03929092168252602082015260400190565b6020808252825182820181905260009190848201906040850190845b81811015615b945783516001600160a01b031683529284019291840191600101615b6f565b50909695505050505050565b6020815260008251806020840152615bbf816040850160208701615d2a565b601f01601f19169190910160400192915050565b6020808252601f908201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604082015260600190565b92835260069190910b6020830152604082015260600190565b9283526020830191909152604082015260600190565b60008219821115615c4c57615c4c615dac565b500190565b600082615c6057615c60615dc2565b500490565b6000816000190483118215151615615c7f57615c7f615dac565b500290565b60008083128015600160ff1b850184121615615ca257615ca2615dac565b6001600160ff1b0384018313811615615cbd57615cbd615dac565b50500390565b60008160060b8360060b6000811281667fffffffffffff1901831281151615615cee57615cee615dac565b81667fffffffffffff018313811615615d0957615d09615dac565b5090039392505050565b600082821015615d2557615d25615dac565b500390565b60005b83811015615d45578181015183820152602001615d2d565b83811115614fcd5750506000910152565b6000600019821415615d6a57615d6a615dac565b5060010190565b600082615d8057615d80615dc2565b500690565b60008160060b667fffffffffffff19811415615da357615da3615dac565b60000392915050565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052601260045260246000fd5b634e487b7160e01b600052603160045260246000fd5b634e487b7160e01b600052603260045260246000fd5b6001600160a01b0381168114615e1957600080fd5b5056fe46f2180879a7123a197cc3828c28955d70d661c70acbdc02450daf5f9a9c1cfaee3f0daba9837d1ab0597acf34328550e4832d02e24e467825e7c2dd318c3820a2646970667358221220387041f4445770e88edda922a11b4527ef0755a64cad19454f2008ef77f4af2564736f6c63430008070033", - "devdoc": { - "kind": "dev", - "methods": { - "acceptJobMigration(address,address)": { - "details": "Unbond/withdraw process doesn't get migrated", - "params": { - "_fromJob": "The address of the job that requested to migrate", - "_toJob": "The address to which the job wants to migrate to" - } - }, - "acceptJobOwnership(address)": { - "params": { - "_job": "The address of the job" - } - }, - "activate(address)": { - "params": { - "_bonding": "The asset being activated as bond collateral" - } - }, - "addJob(address)": { - "params": { - "_job": "Address of the contract for which work should be performed" - } - }, - "addLiquidityToJob(address,address,uint256)": { - "params": { - "_amount": "The amount of liquidity tokens to add", - "_job": "The address of the job to assign liquidity to", - "_liquidity": "The liquidity being added" - } - }, - "addTokenCreditsToJob(address,address,uint256)": { - "params": { - "_amount": "The amount of credit being added", - "_job": "The address of the job being credited", - "_token": "The address of the token being credited" - } - }, - "approveLiquidity(address)": { - "details": "Function should be called after setting an oracle in Keep3rHelperSidechain", - "params": { - "_liquidity": "Address of the liquidity token being approved" - } - }, - "approvedLiquidities()": { - "returns": { - "_list": "An array of addresses with all the approved liquidity pairs" - } - }, - "bond(address,uint256)": { - "params": { - "_amount": "The amount of bonding asset being bonded", - "_bonding": "The asset being bonded" - } - }, - "bondedPayment(address,uint256)": { - "details": "Pays the keeper that performs the work with KP3R", - "params": { - "_keeper": "Address of the keeper that performed the work", - "_payment": "The reward that should be allocated for the job" - } - }, - "changeJobOwnership(address,address)": { - "params": { - "_job": "The address of the job", - "_newOwner": "The address of the proposed new owner" - } - }, - "directTokenPayment(address,address,uint256)": { - "details": "Pays the keeper that performs the work with a specific token", - "params": { - "_amount": "The reward that should be allocated", - "_keeper": "Address of the keeper that performed the work", - "_token": "The asset being awarded to the keeper" - } - }, - "dispute(address)": { - "params": { - "_jobOrKeeper": "The address in dispute" - } - }, - "forceLiquidityCreditsToJob(address,uint256)": { - "params": { - "_amount": "The amount of liquidity credits to gift", - "_job": "The address of the job being credited" - } - }, - "isBondedKeeper(address,address,uint256,uint256,uint256)": { - "details": "Should be used for protected functions", - "params": { - "_age": "The minimum keeper age required", - "_bond": "The bond token being evaluated", - "_earned": "The minimum funds earned in the keepers lifetime", - "_keeper": "The keeper to check", - "_minBond": "The minimum amount of bonded tokens" - }, - "returns": { - "_isBondedKeeper": "Whether the `_keeper` meets the given requirements" - } - }, - "isKeeper(address)": { - "details": "Can be used for general (non critical) functions", - "params": { - "_keeper": "The keeper being investigated" - }, - "returns": { - "_isKeeper": "Whether the address passed as a parameter is a keeper or not" - } - }, - "jobLiquidityCredits(address)": { - "params": { - "_job": "The address of the job of which we want to know the liquidity credits" - }, - "returns": { - "_liquidityCredits": "The liquidity credits of a given job" - } - }, - "jobPeriodCredits(address)": { - "params": { - "_job": "The address of the job of which we want to know the period credits" - }, - "returns": { - "_periodCredits": "The credits the given job has at the current period" - } - }, - "jobs()": { - "returns": { - "_list": "Array with all the jobs in _jobs" - } - }, - "keepers()": { - "returns": { - "_list": "Array with all the keepers in _keepers" - } - }, - "migrateJob(address,address)": { - "params": { - "_fromJob": "The address of the job that is requesting to migrate", - "_toJob": "The address at which the job is requesting to migrate" - } - }, - "observeLiquidity(address)": { - "params": { - "_liquidity": "Address of the liquidity token being observed" - } - }, - "quoteLiquidity(address,uint256)": { - "details": "_periodCredits = underlying KP3Rs for given liquidity amount * rewardPeriod / inflationPeriod", - "params": { - "_amount": "The amount of liquidity to provide", - "_liquidity": "The address of the liquidity to provide" - }, - "returns": { - "_periodCredits": "The amount of KP3R periodically minted for the given liquidity" - } - }, - "resolve(address)": { - "params": { - "_jobOrKeeper": "The address cleared" - } - }, - "revoke(address)": { - "params": { - "_keeper": "The address being slashed" - } - }, - "revokeLiquidity(address)": { - "params": { - "_liquidity": "The liquidity no longer accepted" - } - }, - "sendDust(address,uint256,address)": { - "params": { - "_amount": "The amount of the token that will be transferred", - "_to": "The address that will receive the idle funds", - "_token": "The token that will be transferred" - } - }, - "setBondTime(uint256)": { - "params": { - "_bond": "The new bond time" - } - }, - "setFee(uint256)": { - "params": { - "_fee": "The new fee" - } - }, - "setGovernance(address)": { - "params": { - "_governance": "The address being proposed as the new governance" - } - }, - "setInflationPeriod(uint256)": { - "params": { - "_inflationPeriod": "The new inflation period" - } - }, - "setKeep3rHelper(address)": { - "params": { - "_keep3rHelper": "The Keep3rHelper address" - } - }, - "setKeep3rV1(address)": { - "params": { - "_keep3rV1": "The Keep3rV1 address" - } - }, - "setKeep3rV1Proxy(address)": { - "params": { - "_keep3rV1Proxy": "The Keep3rV1Proxy address" - } - }, - "setLiquidityMinimum(uint256)": { - "params": { - "_liquidityMinimum": "The new minimum amount of liquidity" - } - }, - "setRewardPeriodTime(uint256)": { - "params": { - "_rewardPeriodTime": "The new amount of time required to pass between rewards" - } - }, - "setUnbondTime(uint256)": { - "params": { - "_unbond": "The new unbond time" - } - }, - "slash(address,address,uint256,uint256)": { - "params": { - "_bondAmount": "The bonded amount being slashed", - "_bonded": "The asset being slashed", - "_keeper": "The address being slashed", - "_unbondAmount": "The pending unbond amount being slashed" - } - }, - "slashLiquidityFromJob(address,address,uint256)": { - "params": { - "_amount": "The amount of liquidity that will be slashed", - "_job": "The address being slashed", - "_liquidity": "The address of the liquidity that will be slashed" - } - }, - "slashTokenFromJob(address,address,uint256)": { - "params": { - "_amount": "The amount of the token that will be slashed", - "_job": "The address of the job from which the token will be slashed", - "_token": "The address of the token that will be slashed" - } - }, - "totalJobCredits(address)": { - "params": { - "_job": "The address of the job of which we want to know the total credits" - }, - "returns": { - "_credits": "The total credits of the given job" - } - }, - "unbond(address,uint256)": { - "params": { - "_amount": "Allows for partial unbonding", - "_bonding": "The asset being unbonded" - } - }, - "unbondLiquidityFromJob(address,address,uint256)": { - "details": "Can only be called by the job's owner", - "params": { - "_amount": "The amount of liquidity being removed", - "_job": "The address of the job being unbonded from", - "_liquidity": "The liquidity being unbonded" - } - }, - "virtualReserves()": { - "returns": { - "_virtualReserves": "The surplus amount of wKP3Rs in escrow contract" - } - }, - "withdraw(address)": { - "params": { - "_bonding": "The asset to withdraw from the bonding pool" - } - }, - "withdrawLiquidityFromJob(address,address,address)": { - "params": { - "_job": "The address of the job being withdrawn from", - "_liquidity": "The liquidity being withdrawn", - "_receiver": "The address that will receive the withdrawn liquidity" - } - }, - "withdrawTokenCreditsFromJob(address,address,uint256,address)": { - "params": { - "_amount": "The amount of token to be withdrawn", - "_job": "The address of the job from which the credits are withdrawn", - "_receiver": "The user that will receive tokens", - "_token": "The address of the token being withdrawn" - } - }, - "worked(address)": { - "details": "Sidechain implementation deprecates worked(address) as it should come with a usdPerGasUnit parameter" - }, - "worked(address,uint256)": { - "details": "Uses a USD per gas unit payment mechanism", - "params": { - "_keeper": "Address of the keeper that performed the work", - "_usdPerGasUnit": "Units of USD (in wei) per gas unit that should be rewarded to the keeper" - } - } - }, - "version": 1 - }, - "userdoc": { - "errors": { - "AlreadyAJob()": [ - { - "notice": "Throws when the address that is trying to register as a job is already a job" - } - ], - "AlreadyAKeeper()": [ - { - "notice": "Throws when the address that is trying to register as a keeper is already a keeper" - } - ], - "AlreadyDisputed()": [ - { - "notice": "Throws when a job or keeper is already disputed" - } - ], - "BondsLocked()": [ - { - "notice": "Throws if the time required to bond an asset has not passed yet" - } - ], - "BondsUnexistent()": [ - { - "notice": "Throws if there are no bonded assets" - } - ], - "Deprecated()": [ - { - "notice": "Throws when job contract calls deprecated worked(address) function" - } - ], - "Disputed()": [ - { - "notice": "Throws if either a job or a keeper is disputed" - } - ], - "DisputerExistent()": [ - { - "notice": "Throws if the address is already a registered disputer" - } - ], - "DisputerUnexistent()": [ - { - "notice": "Throws if caller is not a registered disputer" - } - ], - "GasNotInitialized()": [ - { - "notice": "Throws if work method was called without calling isKeeper or isBondedKeeper" - } - ], - "InsufficientFunds()": [ - { - "notice": "Throws if the amount of funds in the job is less than the payment that must be paid to the keeper that works that job" - } - ], - "InsufficientJobTokenCredits()": [ - { - "notice": "Throws when the user tries to withdraw more tokens than it has" - } - ], - "JobAlreadyAdded()": [ - { - "notice": "Throws when trying to add a job that has already been added" - } - ], - "JobDisputed()": [ - { - "notice": "Throws when an action that requires an undisputed job is applied on a disputed job" - } - ], - "JobLiquidityInsufficient()": [ - { - "notice": "Throws when trying to remove more liquidity than the job has" - } - ], - "JobLiquidityLessThanMin()": [ - { - "notice": "Throws when trying to add less liquidity than the minimum liquidity required" - } - ], - "JobLiquidityUnexistent()": [ - { - "notice": "Throws when the job doesn't have the requested liquidity" - } - ], - "JobMigrationImpossible()": [ - { - "notice": "Throws when the address of the job that requests to migrate wants to migrate to its same address" - } - ], - "JobMigrationLocked()": [ - { - "notice": "Throws when cooldown between migrations has not yet passed" - } - ], - "JobMigrationUnavailable()": [ - { - "notice": "Throws when the _toJob address differs from the address being tracked in the pendingJobMigrations mapping" - } - ], - "JobTokenCreditsLocked()": [ - { - "notice": "Throws when the token withdraw cooldown has not yet passed" - } - ], - "JobTokenInsufficient()": [ - { - "notice": "Throws when someone tries to slash more tokens than the job has" - } - ], - "JobTokenUnexistent()": [ - { - "notice": "Throws when the token trying to be slashed doesn't exist" - } - ], - "JobUnapproved()": [ - { - "notice": "Throws if the address claiming to be a job is not in the list of approved jobs" - } - ], - "JobUnavailable()": [ - { - "notice": "Throws when an address is passed as a job, but that address is not a job" - } - ], - "LiquidityPairApproved()": [ - { - "notice": "Throws when the liquidity being approved has already been approved" - } - ], - "LiquidityPairUnapproved()": [ - { - "notice": "Throws when trying to add liquidity to an unapproved pool" - } - ], - "LiquidityPairUnexistent()": [ - { - "notice": "Throws when the liquidity being removed has not been approved" - } - ], - "MinRewardPeriod()": [ - { - "notice": "Throws if the reward period is less than the minimum reward period time" - } - ], - "NoGovernanceZeroAddress()": [ - { - "notice": "Throws if trying to set governance to zero address" - } - ], - "NotDisputed()": [ - { - "notice": "Throws when a job or keeper is not disputed and someone tries to resolve the dispute" - } - ], - "OnlyDisputer()": [ - { - "notice": "Throws if the msg.sender is not a disputer or is not a part of governance" - } - ], - "OnlyGovernance()": [ - { - "notice": "Throws if the caller of the function is not governance" - } - ], - "OnlyJobOwner()": [ - { - "notice": "Throws when the caller of the function is not the job owner" - } - ], - "OnlyPendingGovernance()": [ - { - "notice": "Throws if the caller of the function is not pendingGovernance" - } - ], - "OnlyPendingJobOwner()": [ - { - "notice": "Throws when the caller of the function is not the pending job owner" - } - ], - "OnlySlasher()": [ - { - "notice": "Throws if the msg.sender is not a slasher or is not a part of governance" - } - ], - "SlasherExistent()": [ - { - "notice": "Throws if the address is already a registered slasher" - } - ], - "SlasherUnexistent()": [ - { - "notice": "Throws if caller is not a registered slasher" - } - ], - "TokenUnallowed()": [ - { - "notice": "Throws when the token is KP3R, as it should not be used for direct token payments" - } - ], - "UnbondsLocked()": [ - { - "notice": "Throws if the time required to withdraw the bonds has not passed yet" - } - ], - "UnbondsUnexistent()": [ - { - "notice": "Throws if there are no bonds to withdraw" - } - ], - "ZeroAddress()": [ - { - "notice": "Throws if a variable is assigned to the zero address" - } - ] - }, - "events": { - "Activation(address,address,uint256)": { - "notice": "Emitted when Keep3rKeeperFundable#activate is called" - }, - "BondTimeChange(uint256)": { - "notice": "Emitted when bondTime is changed" - }, - "Bonding(address,address,uint256)": { - "notice": "Emitted when the bonding process of a new keeper begins" - }, - "Dispute(address,address)": { - "notice": "Emitted when a keeper or a job is disputed" - }, - "DisputerAdded(address)": { - "notice": "Emitted when a disputer is added" - }, - "DisputerRemoved(address)": { - "notice": "Emitted when a disputer is removed" - }, - "DustSent(address,uint256,address)": { - "notice": "Emitted when dust is sent" - }, - "FeeChange(uint256)": { - "notice": "Emitted when the fee is changed" - }, - "GovernanceProposal(address)": { - "notice": "Emitted when a new governance is proposed" - }, - "GovernanceSet(address)": { - "notice": "Emitted when pendingGovernance accepts to be governance" - }, - "InflationPeriodChange(uint256)": { - "notice": "Emitted when the inflationPeriod is changed" - }, - "JobAddition(address,address)": { - "notice": "Emitted when Keep3rJobManager#addJob is called" - }, - "JobMigrationRequested(address,address)": { - "notice": "Emitted when Keep3rJobMigration#migrateJob function is called" - }, - "JobMigrationSuccessful(address,address)": { - "notice": "Emitted when Keep3rJobMigration#acceptJobMigration function is called" - }, - "JobOwnershipAssent(address,address,address)": { - "notice": "Emitted when Keep3rJobOwnership#JobOwnershipAssent is called" - }, - "JobOwnershipChange(address,address,address)": { - "notice": "Emitted when Keep3rJobOwnership#changeJobOwnership is called" - }, - "JobSlashLiquidity(address,address,address,uint256)": { - "notice": "Emitted when Keep3rJobDisputable#slashLiquidityFromJob is called" - }, - "JobSlashToken(address,address,address,uint256)": { - "notice": "Emitted when Keep3rJobDisputable#slashTokenFromJob is called" - }, - "Keep3rHelperChange(address)": { - "notice": "Emitted when the Keep3rHelper address is changed" - }, - "Keep3rV1Change(address)": { - "notice": "Emitted when the Keep3rV1 address is changed" - }, - "Keep3rV1ProxyChange(address)": { - "notice": "Emitted when the Keep3rV1Proxy address is changed" - }, - "KeeperRevoke(address,address)": { - "notice": "Emitted when Keep3rKeeperDisputable#revoke is called" - }, - "KeeperSlash(address,address,uint256)": { - "notice": "Emitted when Keep3rKeeperDisputable#slash is called" - }, - "KeeperValidation(uint256)": { - "notice": "Emitted when a keeper is validated before a job" - }, - "KeeperWork(address,address,address,uint256,uint256)": { - "notice": "Emitted when a keeper works a job" - }, - "LiquidityAddition(address,address,address,uint256)": { - "notice": "Emitted when IKeep3rJobFundableLiquidity#addLiquidityToJob function is called" - }, - "LiquidityApproval(address)": { - "notice": "Emitted when Keep3rJobFundableLiquidity#approveLiquidity function is called" - }, - "LiquidityCreditsForced(address,uint256,uint256)": { - "notice": "Emitted when Keep3rJobFundableLiquidity#forceLiquidityCreditsToJob function is called" - }, - "LiquidityCreditsReward(address,uint256,uint256,uint256)": { - "notice": "Emitted when Keep3rJobFundableLiquidity#addLiquidityToJob function is called" - }, - "LiquidityMinimumChange(uint256)": { - "notice": "Emitted when _liquidityMinimum is changed" - }, - "LiquidityRevocation(address)": { - "notice": "Emitted when Keep3rJobFundableLiquidity#revokeLiquidity function is called" - }, - "LiquidityWithdrawal(address,address,address,uint256)": { - "notice": "Emitted when IKeep3rJobFundableLiquidity#withdrawLiquidityFromJob function is called" - }, - "Resolve(address,address)": { - "notice": "Emitted when a dispute is resolved" - }, - "RewardPeriodTimeChange(uint256)": { - "notice": "Emitted when _rewardPeriodTime is changed" - }, - "SlasherAdded(address)": { - "notice": "Emitted when a slasher is added" - }, - "SlasherRemoved(address)": { - "notice": "Emitted when a slasher is removed" - }, - "TokenCreditAddition(address,address,address,uint256)": { - "notice": "Emitted when Keep3rJobFundableCredits#addTokenCreditsToJob is called" - }, - "TokenCreditWithdrawal(address,address,address,uint256)": { - "notice": "Emitted when Keep3rJobFundableCredits#withdrawTokenCreditsFromJob is called" - }, - "UnbondTimeChange(uint256)": { - "notice": "Emitted when _unbondTime is changed" - }, - "Unbonding(address,address,uint256)": { - "notice": "Emitted when a keeper or job begins the unbonding process to withdraw the funds" - }, - "Withdrawal(address,address,uint256)": { - "notice": "Emitted when Keep3rKeeperFundable#withdraw is called" - } - }, - "kind": "user", - "methods": { - "acceptGovernance()": { - "notice": "Changes the governance from the current governance to the previously proposed address" - }, - "acceptJobMigration(address,address)": { - "notice": "Completes the migration process for a job" - }, - "acceptJobOwnership(address)": { - "notice": "The proposed address accepts to be the owner of the job" - }, - "activate(address)": { - "notice": "End of the bonding process after bonding time has passed" - }, - "addDisputer(address)": { - "notice": "Registers a disputer by updating the disputers mapping" - }, - "addJob(address)": { - "notice": "Allows any caller to add a new job" - }, - "addLiquidityToJob(address,address,uint256)": { - "notice": "Allows anyone to fund a job with liquidity" - }, - "addSlasher(address)": { - "notice": "Registers a slasher by updating the slashers mapping" - }, - "addTokenCreditsToJob(address,address,uint256)": { - "notice": "Add credit to a job to be paid out for work" - }, - "approveLiquidity(address)": { - "notice": "Sidechain implementation asks the Helper for an oracle, instead of reading it from the ERC-20" - }, - "approvedLiquidities()": { - "notice": "Lists liquidity pairs" - }, - "bond(address,uint256)": { - "notice": "Beginning of the bonding process" - }, - "bondTime()": { - "notice": "The amount of time required to pass after a keeper has bonded assets for it to be able to activate" - }, - "bondedPayment(address,uint256)": { - "notice": "Implemented by jobs to show that a keeper performed work" - }, - "bonds(address,address)": { - "notice": "Mapping (job => bonding => amount)" - }, - "canActivateAfter(address,address)": { - "notice": "Tracks when a bonding for a keeper can be activated" - }, - "canWithdrawAfter(address,address)": { - "notice": "Tracks when keeper bonds are ready to be withdrawn" - }, - "changeJobOwnership(address,address)": { - "notice": "Proposes a new address to be the owner of the job" - }, - "directTokenPayment(address,address,uint256)": { - "notice": "Implemented by jobs to show that a keeper performed work" - }, - "dispute(address)": { - "notice": "Allows governance to create a dispute for a given keeper/job" - }, - "disputers(address)": { - "notice": "Tracks whether the address is a disputer or not" - }, - "disputes(address)": { - "notice": "Tracks if a keeper or job has a pending dispute" - }, - "fee()": { - "notice": "The fee to be sent to governance when a user adds liquidity to a job" - }, - "firstSeen(address)": { - "notice": "Tracks when a keeper was first registered" - }, - "forceLiquidityCreditsToJob(address,uint256)": { - "notice": "Gifts liquidity credits to the specified job" - }, - "governance()": { - "notice": "Stores the governance address" - }, - "hasBonded(address)": { - "notice": "Checks whether the address has ever bonded an asset" - }, - "inflationPeriod()": { - "notice": "The inflation period is the denominator used to regulate the emission of KP3R" - }, - "isBondedKeeper(address,address,uint256,uint256,uint256)": { - "notice": "Confirms if the current keeper is registered and has a minimum bond of any asset." - }, - "isKeeper(address)": { - "notice": "Confirms if the current keeper is registered" - }, - "jobLiquidityCredits(address)": { - "notice": "Returns the liquidity credits of a given job" - }, - "jobOwner(address)": { - "notice": "Maps the job to the owner of the job" - }, - "jobPendingOwner(address)": { - "notice": "Maps the job to its pending owner" - }, - "jobPeriodCredits(address)": { - "notice": "Returns the credits of a given job for the current period" - }, - "jobTokenCredits(address,address)": { - "notice": "The current token credits available for a job" - }, - "jobTokenCreditsAddedAt(address,address)": { - "notice": "Last block where tokens were added to the job" - }, - "jobs()": { - "notice": "Lists all jobs" - }, - "keep3rHelper()": { - "notice": "Address of Keep3rHelper's contract" - }, - "keep3rV1()": { - "notice": "Address of Keep3rV1's contract" - }, - "keep3rV1Proxy()": { - "notice": "Address of Keep3rV1Proxy's contract" - }, - "keepers()": { - "notice": "Lists all keepers" - }, - "liquidityAmount(address,address)": { - "notice": "Amount of liquidity in a specified job" - }, - "liquidityMinimum()": { - "notice": "The minimum amount of liquidity required to fund a job per liquidity" - }, - "migrateJob(address,address)": { - "notice": "Initializes the migration process for a job by adding the request to the pendingJobMigrations mapping" - }, - "observeLiquidity(address)": { - "notice": "Sidechain implementation will always ask for 2 tickCumulatives instead of cacheing" - }, - "pendingBonds(address,address)": { - "notice": "Tracks the amount of assets deposited in pending bonds" - }, - "pendingGovernance()": { - "notice": "Stores the pendingGovernance address" - }, - "pendingJobMigrations(address)": { - "notice": "Maps the jobs that have requested a migration to the address they have requested to migrate to" - }, - "pendingUnbonds(address,address)": { - "notice": "Tracks how much keeper bonds are to be withdrawn" - }, - "quoteLiquidity(address,uint256)": { - "notice": "Calculates how many credits should be rewarded periodically for a given liquidity amount" - }, - "removeDisputer(address)": { - "notice": "Removes a disputer by updating the disputers mapping" - }, - "removeSlasher(address)": { - "notice": "Removes a slasher by updating the slashers mapping" - }, - "resolve(address)": { - "notice": "Allows governance to resolve a dispute on a keeper/job" - }, - "revoke(address)": { - "notice": "Blacklists a keeper from participating in the network" - }, - "revokeLiquidity(address)": { - "notice": "Revoke a liquidity pair from being accepted in future" - }, - "rewardPeriodTime()": { - "notice": "The amount of time between each scheduled credits reward given to a job" - }, - "rewardedAt(address)": { - "notice": "Last time the job was rewarded liquidity credits" - }, - "sendDust(address,uint256,address)": { - "notice": "Allows an authorized user to transfer the tokens or eth that may have been left in a contract" - }, - "setBondTime(uint256)": { - "notice": "Sets the bond time required to activate as a keeper" - }, - "setFee(uint256)": { - "notice": "Sets the new fee" - }, - "setGovernance(address)": { - "notice": "Proposes a new address to be governance" - }, - "setInflationPeriod(uint256)": { - "notice": "Sets the new inflation period" - }, - "setKeep3rHelper(address)": { - "notice": "Sets the Keep3rHelper address" - }, - "setKeep3rV1(address)": { - "notice": "Sets the Keep3rV1 address" - }, - "setKeep3rV1Proxy(address)": { - "notice": "Sets the Keep3rV1Proxy address" - }, - "setLiquidityMinimum(uint256)": { - "notice": "Sets the minimum amount of liquidity required to fund a job" - }, - "setRewardPeriodTime(uint256)": { - "notice": "Sets the time required to pass between rewards for jobs" - }, - "setUnbondTime(uint256)": { - "notice": "Sets the unbond time required unbond what has been bonded" - }, - "slash(address,address,uint256,uint256)": { - "notice": "Allows governance to slash a keeper based on a dispute" - }, - "slashLiquidityFromJob(address,address,uint256)": { - "notice": "Allows governance or a slasher to slash liquidity from a job" - }, - "slashTokenFromJob(address,address,uint256)": { - "notice": "Allows governance or slasher to slash a job specific token" - }, - "slashers(address)": { - "notice": "Tracks whether the address is a slasher or not" - }, - "totalBonds()": { - "notice": "Tracks the total amount of bonded KP3Rs in the contract" - }, - "totalJobCredits(address)": { - "notice": "Calculates the total credits of a given job" - }, - "unbond(address,uint256)": { - "notice": "Beginning of the unbonding process" - }, - "unbondLiquidityFromJob(address,address,uint256)": { - "notice": "Unbond liquidity for a job" - }, - "unbondTime()": { - "notice": "The amount of time required to pass before a keeper can unbond what he has bonded" - }, - "virtualReserves()": { - "notice": "The surplus amount of wKP3Rs in escrow contract" - }, - "withdraw(address)": { - "notice": "Withdraw funds after unbonding has finished" - }, - "withdrawLiquidityFromJob(address,address,address)": { - "notice": "Withdraw liquidity from a job" - }, - "withdrawTokenCreditsFromJob(address,address,uint256,address)": { - "notice": "Withdraw credit from a job" - }, - "workCompleted(address)": { - "notice": "Tracks the total KP3R earnings of a keeper since it started working" - }, - "worked(address,uint256)": { - "notice": "Implemented by jobs to show that a keeper performed work" - }, - "workedAt(address)": { - "notice": "Last time the job was worked" - } - }, - "version": 1 - }, - "storageLayout": { - "storage": [ - { - "astId": 10, - "contract": "solidity/for-test/testnet/Keep3rSidechainForTestnet.sol:Keep3rSidechainForTestnet", - "label": "_status", - "offset": 0, - "slot": "0", - "type": "t_uint256" - }, - { - "astId": 8431, - "contract": "solidity/for-test/testnet/Keep3rSidechainForTestnet.sol:Keep3rSidechainForTestnet", - "label": "jobOwner", - "offset": 0, - "slot": "1", - "type": "t_mapping(t_address,t_address)" - }, - { - "astId": 8437, - "contract": "solidity/for-test/testnet/Keep3rSidechainForTestnet.sol:Keep3rSidechainForTestnet", - "label": "jobPendingOwner", - "offset": 0, - "slot": "2", - "type": "t_mapping(t_address,t_address)" - }, - { - "astId": 5362, - "contract": "solidity/for-test/testnet/Keep3rSidechainForTestnet.sol:Keep3rSidechainForTestnet", - "label": "governance", - "offset": 0, - "slot": "3", - "type": "t_address" - }, - { - "astId": 5366, - "contract": "solidity/for-test/testnet/Keep3rSidechainForTestnet.sol:Keep3rSidechainForTestnet", - "label": "pendingGovernance", - "offset": 0, - "slot": "4", - "type": "t_address" - }, - { - "astId": 5999, - "contract": "solidity/for-test/testnet/Keep3rSidechainForTestnet.sol:Keep3rSidechainForTestnet", - "label": "slashers", - "offset": 0, - "slot": "5", - "type": "t_mapping(t_address,t_bool)" - }, - { - "astId": 6005, - "contract": "solidity/for-test/testnet/Keep3rSidechainForTestnet.sol:Keep3rSidechainForTestnet", - "label": "disputers", - "offset": 0, - "slot": "6", - "type": "t_mapping(t_address,t_bool)" - }, - { - "astId": 5467, - "contract": "solidity/for-test/testnet/Keep3rSidechainForTestnet.sol:Keep3rSidechainForTestnet", - "label": "_keepers", - "offset": 0, - "slot": "7", - "type": "t_struct(AddressSet)1631_storage" - }, - { - "astId": 5471, - "contract": "solidity/for-test/testnet/Keep3rSidechainForTestnet.sol:Keep3rSidechainForTestnet", - "label": "totalBonds", - "offset": 0, - "slot": "9", - "type": "t_uint256" - }, - { - "astId": 5477, - "contract": "solidity/for-test/testnet/Keep3rSidechainForTestnet.sol:Keep3rSidechainForTestnet", - "label": "workCompleted", - "offset": 0, - "slot": "10", - "type": "t_mapping(t_address,t_uint256)" - }, - { - "astId": 5483, - "contract": "solidity/for-test/testnet/Keep3rSidechainForTestnet.sol:Keep3rSidechainForTestnet", - "label": "firstSeen", - "offset": 0, - "slot": "11", - "type": "t_mapping(t_address,t_uint256)" - }, - { - "astId": 5489, - "contract": "solidity/for-test/testnet/Keep3rSidechainForTestnet.sol:Keep3rSidechainForTestnet", - "label": "disputes", - "offset": 0, - "slot": "12", - "type": "t_mapping(t_address,t_bool)" - }, - { - "astId": 5497, - "contract": "solidity/for-test/testnet/Keep3rSidechainForTestnet.sol:Keep3rSidechainForTestnet", - "label": "bonds", - "offset": 0, - "slot": "13", - "type": "t_mapping(t_address,t_mapping(t_address,t_uint256))" - }, - { - "astId": 5505, - "contract": "solidity/for-test/testnet/Keep3rSidechainForTestnet.sol:Keep3rSidechainForTestnet", - "label": "jobTokenCredits", - "offset": 0, - "slot": "14", - "type": "t_mapping(t_address,t_mapping(t_address,t_uint256))" - }, - { - "astId": 5510, - "contract": "solidity/for-test/testnet/Keep3rSidechainForTestnet.sol:Keep3rSidechainForTestnet", - "label": "_jobLiquidityCredits", - "offset": 0, - "slot": "15", - "type": "t_mapping(t_address,t_uint256)" - }, - { - "astId": 5515, - "contract": "solidity/for-test/testnet/Keep3rSidechainForTestnet.sol:Keep3rSidechainForTestnet", - "label": "_jobPeriodCredits", - "offset": 0, - "slot": "16", - "type": "t_mapping(t_address,t_uint256)" - }, - { - "astId": 5521, - "contract": "solidity/for-test/testnet/Keep3rSidechainForTestnet.sol:Keep3rSidechainForTestnet", - "label": "_jobTokens", - "offset": 0, - "slot": "17", - "type": "t_mapping(t_address,t_struct(AddressSet)1631_storage)" - }, - { - "astId": 5527, - "contract": "solidity/for-test/testnet/Keep3rSidechainForTestnet.sol:Keep3rSidechainForTestnet", - "label": "_jobLiquidities", - "offset": 0, - "slot": "18", - "type": "t_mapping(t_address,t_struct(AddressSet)1631_storage)" - }, - { - "astId": 5532, - "contract": "solidity/for-test/testnet/Keep3rSidechainForTestnet.sol:Keep3rSidechainForTestnet", - "label": "_liquidityPool", - "offset": 0, - "slot": "19", - "type": "t_mapping(t_address,t_address)" - }, - { - "astId": 5537, - "contract": "solidity/for-test/testnet/Keep3rSidechainForTestnet.sol:Keep3rSidechainForTestnet", - "label": "_isKP3RToken0", - "offset": 0, - "slot": "20", - "type": "t_mapping(t_address,t_bool)" - }, - { - "astId": 5545, - "contract": "solidity/for-test/testnet/Keep3rSidechainForTestnet.sol:Keep3rSidechainForTestnet", - "label": "pendingBonds", - "offset": 0, - "slot": "21", - "type": "t_mapping(t_address,t_mapping(t_address,t_uint256))" - }, - { - "astId": 5553, - "contract": "solidity/for-test/testnet/Keep3rSidechainForTestnet.sol:Keep3rSidechainForTestnet", - "label": "canActivateAfter", - "offset": 0, - "slot": "22", - "type": "t_mapping(t_address,t_mapping(t_address,t_uint256))" - }, - { - "astId": 5561, - "contract": "solidity/for-test/testnet/Keep3rSidechainForTestnet.sol:Keep3rSidechainForTestnet", - "label": "canWithdrawAfter", - "offset": 0, - "slot": "23", - "type": "t_mapping(t_address,t_mapping(t_address,t_uint256))" - }, - { - "astId": 5569, - "contract": "solidity/for-test/testnet/Keep3rSidechainForTestnet.sol:Keep3rSidechainForTestnet", - "label": "pendingUnbonds", - "offset": 0, - "slot": "24", - "type": "t_mapping(t_address,t_mapping(t_address,t_uint256))" - }, - { - "astId": 5575, - "contract": "solidity/for-test/testnet/Keep3rSidechainForTestnet.sol:Keep3rSidechainForTestnet", - "label": "hasBonded", - "offset": 0, - "slot": "25", - "type": "t_mapping(t_address,t_bool)" - }, - { - "astId": 5579, - "contract": "solidity/for-test/testnet/Keep3rSidechainForTestnet.sol:Keep3rSidechainForTestnet", - "label": "_jobs", - "offset": 0, - "slot": "26", - "type": "t_struct(AddressSet)1631_storage" - }, - { - "astId": 5692, - "contract": "solidity/for-test/testnet/Keep3rSidechainForTestnet.sol:Keep3rSidechainForTestnet", - "label": "keep3rV1", - "offset": 0, - "slot": "28", - "type": "t_address" - }, - { - "astId": 5696, - "contract": "solidity/for-test/testnet/Keep3rSidechainForTestnet.sol:Keep3rSidechainForTestnet", - "label": "keep3rV1Proxy", - "offset": 0, - "slot": "29", - "type": "t_address" - }, - { - "astId": 5700, - "contract": "solidity/for-test/testnet/Keep3rSidechainForTestnet.sol:Keep3rSidechainForTestnet", - "label": "keep3rHelper", - "offset": 0, - "slot": "30", - "type": "t_address" - }, - { - "astId": 5705, - "contract": "solidity/for-test/testnet/Keep3rSidechainForTestnet.sol:Keep3rSidechainForTestnet", - "label": "bondTime", - "offset": 0, - "slot": "31", - "type": "t_uint256" - }, - { - "astId": 5710, - "contract": "solidity/for-test/testnet/Keep3rSidechainForTestnet.sol:Keep3rSidechainForTestnet", - "label": "unbondTime", - "offset": 0, - "slot": "32", - "type": "t_uint256" - }, - { - "astId": 5715, - "contract": "solidity/for-test/testnet/Keep3rSidechainForTestnet.sol:Keep3rSidechainForTestnet", - "label": "liquidityMinimum", - "offset": 0, - "slot": "33", - "type": "t_uint256" - }, - { - "astId": 5720, - "contract": "solidity/for-test/testnet/Keep3rSidechainForTestnet.sol:Keep3rSidechainForTestnet", - "label": "rewardPeriodTime", - "offset": 0, - "slot": "34", - "type": "t_uint256" - }, - { - "astId": 5725, - "contract": "solidity/for-test/testnet/Keep3rSidechainForTestnet.sol:Keep3rSidechainForTestnet", - "label": "inflationPeriod", - "offset": 0, - "slot": "35", - "type": "t_uint256" - }, - { - "astId": 5730, - "contract": "solidity/for-test/testnet/Keep3rSidechainForTestnet.sol:Keep3rSidechainForTestnet", - "label": "fee", - "offset": 0, - "slot": "36", - "type": "t_uint256" - }, - { - "astId": 6432, - "contract": "solidity/for-test/testnet/Keep3rSidechainForTestnet.sol:Keep3rSidechainForTestnet", - "label": "jobTokenCreditsAddedAt", - "offset": 0, - "slot": "37", - "type": "t_mapping(t_address,t_mapping(t_address,t_uint256))" - }, - { - "astId": 6675, - "contract": "solidity/for-test/testnet/Keep3rSidechainForTestnet.sol:Keep3rSidechainForTestnet", - "label": "_approvedLiquidities", - "offset": 0, - "slot": "38", - "type": "t_struct(AddressSet)1631_storage" - }, - { - "astId": 6683, - "contract": "solidity/for-test/testnet/Keep3rSidechainForTestnet.sol:Keep3rSidechainForTestnet", - "label": "liquidityAmount", - "offset": 0, - "slot": "40", - "type": "t_mapping(t_address,t_mapping(t_address,t_uint256))" - }, - { - "astId": 6689, - "contract": "solidity/for-test/testnet/Keep3rSidechainForTestnet.sol:Keep3rSidechainForTestnet", - "label": "rewardedAt", - "offset": 0, - "slot": "41", - "type": "t_mapping(t_address,t_uint256)" - }, - { - "astId": 6695, - "contract": "solidity/for-test/testnet/Keep3rSidechainForTestnet.sol:Keep3rSidechainForTestnet", - "label": "workedAt", - "offset": 0, - "slot": "42", - "type": "t_mapping(t_address,t_uint256)" - }, - { - "astId": 6701, - "contract": "solidity/for-test/testnet/Keep3rSidechainForTestnet.sol:Keep3rSidechainForTestnet", - "label": "_tick", - "offset": 0, - "slot": "43", - "type": "t_mapping(t_address,t_struct(TickCache)14619_storage)" - }, - { - "astId": 8152, - "contract": "solidity/for-test/testnet/Keep3rSidechainForTestnet.sol:Keep3rSidechainForTestnet", - "label": "pendingJobMigrations", - "offset": 0, - "slot": "44", - "type": "t_mapping(t_address,t_address)" - }, - { - "astId": 8158, - "contract": "solidity/for-test/testnet/Keep3rSidechainForTestnet.sol:Keep3rSidechainForTestnet", - "label": "_migrationCreatedAt", - "offset": 0, - "slot": "45", - "type": "t_mapping(t_address,t_mapping(t_address,t_uint256))" - }, - { - "astId": 8555, - "contract": "solidity/for-test/testnet/Keep3rSidechainForTestnet.sol:Keep3rSidechainForTestnet", - "label": "_initialGas", - "offset": 0, - "slot": "46", - "type": "t_uint256" - } - ], - "types": { - "t_address": { - "encoding": "inplace", - "label": "address", - "numberOfBytes": "20" - }, - "t_array(t_bytes32)dyn_storage": { - "base": "t_bytes32", - "encoding": "dynamic_array", - "label": "bytes32[]", - "numberOfBytes": "32" - }, - "t_bool": { - "encoding": "inplace", - "label": "bool", - "numberOfBytes": "1" - }, - "t_bytes32": { - "encoding": "inplace", - "label": "bytes32", - "numberOfBytes": "32" - }, - "t_int56": { - "encoding": "inplace", - "label": "int56", - "numberOfBytes": "7" - }, - "t_mapping(t_address,t_address)": { - "encoding": "mapping", - "key": "t_address", - "label": "mapping(address => address)", - "numberOfBytes": "32", - "value": "t_address" - }, - "t_mapping(t_address,t_bool)": { - "encoding": "mapping", - "key": "t_address", - "label": "mapping(address => bool)", - "numberOfBytes": "32", - "value": "t_bool" - }, - "t_mapping(t_address,t_mapping(t_address,t_uint256))": { - "encoding": "mapping", - "key": "t_address", - "label": "mapping(address => mapping(address => uint256))", - "numberOfBytes": "32", - "value": "t_mapping(t_address,t_uint256)" - }, - "t_mapping(t_address,t_struct(AddressSet)1631_storage)": { - "encoding": "mapping", - "key": "t_address", - "label": "mapping(address => struct EnumerableSet.AddressSet)", - "numberOfBytes": "32", - "value": "t_struct(AddressSet)1631_storage" - }, - "t_mapping(t_address,t_struct(TickCache)14619_storage)": { - "encoding": "mapping", - "key": "t_address", - "label": "mapping(address => struct IKeep3rJobFundableLiquidity.TickCache)", - "numberOfBytes": "32", - "value": "t_struct(TickCache)14619_storage" - }, - "t_mapping(t_address,t_uint256)": { - "encoding": "mapping", - "key": "t_address", - "label": "mapping(address => uint256)", - "numberOfBytes": "32", - "value": "t_uint256" - }, - "t_mapping(t_bytes32,t_uint256)": { - "encoding": "mapping", - "key": "t_bytes32", - "label": "mapping(bytes32 => uint256)", - "numberOfBytes": "32", - "value": "t_uint256" - }, - "t_struct(AddressSet)1631_storage": { - "encoding": "inplace", - "label": "struct EnumerableSet.AddressSet", - "members": [ - { - "astId": 1630, - "contract": "solidity/for-test/testnet/Keep3rSidechainForTestnet.sol:Keep3rSidechainForTestnet", - "label": "_inner", - "offset": 0, - "slot": "0", - "type": "t_struct(Set)1330_storage" - } - ], - "numberOfBytes": "64" - }, - "t_struct(Set)1330_storage": { - "encoding": "inplace", - "label": "struct EnumerableSet.Set", - "members": [ - { - "astId": 1325, - "contract": "solidity/for-test/testnet/Keep3rSidechainForTestnet.sol:Keep3rSidechainForTestnet", - "label": "_values", - "offset": 0, - "slot": "0", - "type": "t_array(t_bytes32)dyn_storage" - }, - { - "astId": 1329, - "contract": "solidity/for-test/testnet/Keep3rSidechainForTestnet.sol:Keep3rSidechainForTestnet", - "label": "_indexes", - "offset": 0, - "slot": "1", - "type": "t_mapping(t_bytes32,t_uint256)" - } - ], - "numberOfBytes": "64" - }, - "t_struct(TickCache)14619_storage": { - "encoding": "inplace", - "label": "struct IKeep3rJobFundableLiquidity.TickCache", - "members": [ - { - "astId": 14614, - "contract": "solidity/for-test/testnet/Keep3rSidechainForTestnet.sol:Keep3rSidechainForTestnet", - "label": "current", - "offset": 0, - "slot": "0", - "type": "t_int56" - }, - { - "astId": 14616, - "contract": "solidity/for-test/testnet/Keep3rSidechainForTestnet.sol:Keep3rSidechainForTestnet", - "label": "difference", - "offset": 7, - "slot": "0", - "type": "t_int56" - }, - { - "astId": 14618, - "contract": "solidity/for-test/testnet/Keep3rSidechainForTestnet.sol:Keep3rSidechainForTestnet", - "label": "period", - "offset": 0, - "slot": "1", - "type": "t_uint256" - } - ], - "numberOfBytes": "64" - }, - "t_uint256": { - "encoding": "inplace", - "label": "uint256", - "numberOfBytes": "32" - } - } - } -} \ No newline at end of file diff --git a/deployments/optimisticGoerli/solcInputs/0100086ed88435cb002327f6c69d11e5.json b/deployments/optimisticGoerli/solcInputs/0100086ed88435cb002327f6c69d11e5.json deleted file mode 100644 index 1f9c5fc..0000000 --- a/deployments/optimisticGoerli/solcInputs/0100086ed88435cb002327f6c69d11e5.json +++ /dev/null @@ -1,334 +0,0 @@ -{ - "language": "Solidity", - "sources": { - "solidity/contracts/Keep3r.sol": { - "content": "// SPDX-License-Identifier: MIT\n\n/*\n\nCoded for The Keep3r Network with ♥ by\n\n██████╗░███████╗███████╗██╗░░░██╗░░░░░░░██╗░█████╗░███╗░░██╗██████╗░███████╗██████╗░██╗░░░░░░█████╗░███╗░░██╗██████╗░\n██╔══██╗██╔════╝██╔════╝██║░░░██║░░██╗░░██║██╔══██╗████╗░██║██╔══██╗██╔════╝██╔══██╗██║░░░░░██╔══██╗████╗░██║██╔══██╗\n██║░░██║█████╗░░█████╗░░██║░░░╚██╗████╗██╔╝██║░░██║██╔██╗██║██║░░██║█████╗░░██████╔╝██║░░░░░███████║██╔██╗██║██║░░██║\n██║░░██║██╔══╝░░██╔══╝░░██║░░░░████╔═████║░██║░░██║██║╚████║██║░░██║██╔══╝░░██╔══██╗██║░░░░░██╔══██║██║╚████║██║░░██║\n██████╔╝███████╗██║░░░░░██║░░░░╚██╔╝░╚██╔╝░╚█████╔╝██║░╚███║██████╔╝███████╗██║░░██║███████╗██║░░██║██║░╚███║██████╔╝\n╚═════╝░╚══════╝╚═╝░░░░░╚═╝░░░░░╚═╝░░░╚═╝░░░╚════╝░╚═╝░░╚══╝╚═════╝░╚══════╝╚═╝░░╚═╝╚══════╝╚═╝░░╚═╝╚═╝░░╚══╝╚═════╝░\n\nhttps://defi.sucks\n\n*/\n\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../interfaces/IKeep3r.sol';\nimport './peripherals/jobs/Keep3rJobs.sol';\nimport './peripherals/keepers/Keep3rKeepers.sol';\nimport './peripherals/DustCollector.sol';\n\ncontract Keep3r is IKeep3r, Keep3rJobs, Keep3rKeepers {\n constructor(\n address _governance,\n address _keep3rHelper,\n address _keep3rV1,\n address _keep3rV1Proxy\n ) Keep3rParameters(_keep3rHelper, _keep3rV1, _keep3rV1Proxy) Keep3rRoles(_governance) {}\n}\n" - }, - "solidity/interfaces/IKeep3r.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport './peripherals/IKeep3rJobs.sol';\nimport './peripherals/IKeep3rKeepers.sol';\nimport './peripherals/IKeep3rParameters.sol';\n\n// solhint-disable-next-line no-empty-blocks\n\n/// @title Keep3rV2 contract\n/// @notice This contract inherits all the functionality of Keep3rV2\ninterface IKeep3r is IKeep3rJobs, IKeep3rKeepers, IKeep3rParameters {\n\n}\n" - }, - "solidity/contracts/peripherals/jobs/Keep3rJobs.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../../../interfaces/peripherals/IKeep3rJobs.sol';\nimport './Keep3rJobManager.sol';\nimport './Keep3rJobWorkable.sol';\nimport './Keep3rJobDisputable.sol';\n\nabstract contract Keep3rJobs is IKeep3rJobs, Keep3rJobManager, Keep3rJobWorkable, Keep3rJobDisputable {}\n" - }, - "solidity/contracts/peripherals/keepers/Keep3rKeepers.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../../../interfaces/peripherals/IKeep3rKeepers.sol';\nimport './Keep3rKeeperDisputable.sol';\n\nabstract contract Keep3rKeepers is IKeep3rKeepers, Keep3rKeeperDisputable {}\n" - }, - "solidity/contracts/peripherals/DustCollector.sol": { - "content": "// SPDX-License-Identifier: MIT\n\npragma solidity >=0.8.4 <0.9.0;\n\nimport '@openzeppelin/contracts/token/ERC20/IERC20.sol';\nimport '@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol';\nimport '../../contracts/peripherals/Governable.sol';\nimport '../../interfaces/peripherals/IDustCollector.sol';\n\nabstract contract DustCollector is IDustCollector, Governable {\n using SafeERC20 for IERC20;\n\n address internal constant _ETH_ADDRESS = 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE;\n\n function sendDust(\n address _token,\n uint256 _amount,\n address _to\n ) external override onlyGovernance {\n if (_to == address(0)) revert ZeroAddress();\n if (_token == _ETH_ADDRESS) {\n payable(_to).transfer(_amount);\n } else {\n IERC20(_token).safeTransfer(_to, _amount);\n }\n emit DustSent(_token, _amount, _to);\n }\n}\n" - }, - "solidity/interfaces/peripherals/IKeep3rJobs.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport './IKeep3rDisputable.sol';\n\n/// @title Keep3rJobOwnership contract\n/// @notice Handles the ownership of the jobs\ninterface IKeep3rJobOwnership {\n // Events\n\n /// @notice Emitted when Keep3rJobOwnership#changeJobOwnership is called\n /// @param _job The address of the job proposed to have a change of owner\n /// @param _owner The current owner of the job\n /// @param _pendingOwner The new address proposed to be the owner of the job\n event JobOwnershipChange(address indexed _job, address indexed _owner, address indexed _pendingOwner);\n\n /// @notice Emitted when Keep3rJobOwnership#JobOwnershipAssent is called\n /// @param _job The address of the job which the proposed owner will now own\n /// @param _previousOwner The previous owner of the job\n /// @param _newOwner The new owner of the job\n event JobOwnershipAssent(address indexed _job, address indexed _previousOwner, address indexed _newOwner);\n\n // Errors\n\n /// @notice Throws when the caller of the function is not the job owner\n error OnlyJobOwner();\n\n /// @notice Throws when the caller of the function is not the pending job owner\n error OnlyPendingJobOwner();\n\n // Variables\n\n /// @notice Maps the job to the owner of the job\n /// @param _job The address of the job\n /// @return _owner The address of the owner of the job\n function jobOwner(address _job) external view returns (address _owner);\n\n /// @notice Maps the job to its pending owner\n /// @param _job The address of the job\n /// @return _pendingOwner The address of the pending owner of the job\n function jobPendingOwner(address _job) external view returns (address _pendingOwner);\n\n // Methods\n\n /// @notice Proposes a new address to be the owner of the job\n /// @param _job The address of the job\n /// @param _newOwner The address of the proposed new owner\n function changeJobOwnership(address _job, address _newOwner) external;\n\n /// @notice The proposed address accepts to be the owner of the job\n /// @param _job The address of the job\n function acceptJobOwnership(address _job) external;\n}\n\n/// @title Keep3rJobManager contract\n/// @notice Handles the addition and withdrawal of credits from a job\ninterface IKeep3rJobManager is IKeep3rJobOwnership {\n // Events\n\n /// @notice Emitted when Keep3rJobManager#addJob is called\n /// @param _job The address of the job to add\n /// @param _jobOwner The job's owner\n event JobAddition(address indexed _job, address indexed _jobOwner);\n\n // Errors\n\n /// @notice Throws when trying to add a job that has already been added\n error JobAlreadyAdded();\n\n /// @notice Throws when the address that is trying to register as a keeper is already a keeper\n error AlreadyAKeeper();\n\n // Methods\n\n /// @notice Allows any caller to add a new job\n /// @param _job Address of the contract for which work should be performed\n function addJob(address _job) external;\n}\n\n/// @title Keep3rJobFundableCredits contract\n/// @notice Handles the addition and withdrawal of credits from a job\ninterface IKeep3rJobFundableCredits is IKeep3rJobOwnership {\n // Events\n\n /// @notice Emitted when Keep3rJobFundableCredits#addTokenCreditsToJob is called\n /// @param _job The address of the job being credited\n /// @param _token The address of the token being provided\n /// @param _provider The user that calls the function\n /// @param _amount The amount of credit being added to the job\n event TokenCreditAddition(address indexed _job, address indexed _token, address indexed _provider, uint256 _amount);\n\n /// @notice Emitted when Keep3rJobFundableCredits#withdrawTokenCreditsFromJob is called\n /// @param _job The address of the job from which the credits are withdrawn\n /// @param _token The credit being withdrawn from the job\n /// @param _receiver The user that receives the tokens\n /// @param _amount The amount of credit withdrawn\n event TokenCreditWithdrawal(address indexed _job, address indexed _token, address indexed _receiver, uint256 _amount);\n\n // Errors\n\n /// @notice Throws when the token is KP3R, as it should not be used for direct token payments\n error TokenUnallowed();\n\n /// @notice Throws when the token withdraw cooldown has not yet passed\n error JobTokenCreditsLocked();\n\n /// @notice Throws when the user tries to withdraw more tokens than it has\n error InsufficientJobTokenCredits();\n\n // Variables\n\n /// @notice Last block where tokens were added to the job\n /// @param _job The address of the job credited\n /// @param _token The address of the token credited\n /// @return _timestamp The last block where tokens were added to the job\n function jobTokenCreditsAddedAt(address _job, address _token) external view returns (uint256 _timestamp);\n\n // Methods\n\n /// @notice Add credit to a job to be paid out for work\n /// @param _job The address of the job being credited\n /// @param _token The address of the token being credited\n /// @param _amount The amount of credit being added\n function addTokenCreditsToJob(\n address _job,\n address _token,\n uint256 _amount\n ) external;\n\n /// @notice Withdraw credit from a job\n /// @param _job The address of the job from which the credits are withdrawn\n /// @param _token The address of the token being withdrawn\n /// @param _amount The amount of token to be withdrawn\n /// @param _receiver The user that will receive tokens\n function withdrawTokenCreditsFromJob(\n address _job,\n address _token,\n uint256 _amount,\n address _receiver\n ) external;\n}\n\n/// @title Keep3rJobFundableLiquidity contract\n/// @notice Handles the funding of jobs through specific liquidity pairs\ninterface IKeep3rJobFundableLiquidity is IKeep3rJobOwnership {\n // Events\n\n /// @notice Emitted when Keep3rJobFundableLiquidity#approveLiquidity function is called\n /// @param _liquidity The address of the liquidity pair being approved\n event LiquidityApproval(address _liquidity);\n\n /// @notice Emitted when Keep3rJobFundableLiquidity#revokeLiquidity function is called\n /// @param _liquidity The address of the liquidity pair being revoked\n event LiquidityRevocation(address _liquidity);\n\n /// @notice Emitted when IKeep3rJobFundableLiquidity#addLiquidityToJob function is called\n /// @param _job The address of the job to which liquidity will be added\n /// @param _liquidity The address of the liquidity being added\n /// @param _provider The user that calls the function\n /// @param _amount The amount of liquidity being added\n event LiquidityAddition(address indexed _job, address indexed _liquidity, address indexed _provider, uint256 _amount);\n\n /// @notice Emitted when IKeep3rJobFundableLiquidity#withdrawLiquidityFromJob function is called\n /// @param _job The address of the job of which liquidity will be withdrawn from\n /// @param _liquidity The address of the liquidity being withdrawn\n /// @param _receiver The receiver of the liquidity tokens\n /// @param _amount The amount of liquidity being withdrawn from the job\n event LiquidityWithdrawal(address indexed _job, address indexed _liquidity, address indexed _receiver, uint256 _amount);\n\n /// @notice Emitted when Keep3rJobFundableLiquidity#addLiquidityToJob function is called\n /// @param _job The address of the job whose credits will be updated\n /// @param _rewardedAt The time at which the job was last rewarded\n /// @param _currentCredits The current credits of the job\n /// @param _periodCredits The credits of the job for the current period\n event LiquidityCreditsReward(address indexed _job, uint256 _rewardedAt, uint256 _currentCredits, uint256 _periodCredits);\n\n /// @notice Emitted when Keep3rJobFundableLiquidity#forceLiquidityCreditsToJob function is called\n /// @param _job The address of the job whose credits will be updated\n /// @param _rewardedAt The time at which the job was last rewarded\n /// @param _currentCredits The current credits of the job\n event LiquidityCreditsForced(address indexed _job, uint256 _rewardedAt, uint256 _currentCredits);\n\n // Errors\n\n /// @notice Throws when the liquidity being approved has already been approved\n error LiquidityPairApproved();\n\n /// @notice Throws when the liquidity being removed has not been approved\n error LiquidityPairUnexistent();\n\n /// @notice Throws when trying to add liquidity to an unapproved pool\n error LiquidityPairUnapproved();\n\n /// @notice Throws when the job doesn't have the requested liquidity\n error JobLiquidityUnexistent();\n\n /// @notice Throws when trying to remove more liquidity than the job has\n error JobLiquidityInsufficient();\n\n /// @notice Throws when trying to add less liquidity than the minimum liquidity required\n error JobLiquidityLessThanMin();\n\n // Structs\n\n /// @notice Stores the tick information of the different liquidity pairs\n struct TickCache {\n int56 current; // Tracks the current tick\n int56 difference; // Stores the difference between the current tick and the last tick\n uint256 period; // Stores the period at which the last observation was made\n }\n\n // Variables\n\n /// @notice Lists liquidity pairs\n /// @return _list An array of addresses with all the approved liquidity pairs\n function approvedLiquidities() external view returns (address[] memory _list);\n\n /// @notice Amount of liquidity in a specified job\n /// @param _job The address of the job being checked\n /// @param _liquidity The address of the liquidity we are checking\n /// @return _amount Amount of liquidity in the specified job\n function liquidityAmount(address _job, address _liquidity) external view returns (uint256 _amount);\n\n /// @notice Last time the job was rewarded liquidity credits\n /// @param _job The address of the job being checked\n /// @return _timestamp Timestamp of the last time the job was rewarded liquidity credits\n function rewardedAt(address _job) external view returns (uint256 _timestamp);\n\n /// @notice Last time the job was worked\n /// @param _job The address of the job being checked\n /// @return _timestamp Timestamp of the last time the job was worked\n function workedAt(address _job) external view returns (uint256 _timestamp);\n\n // Methods\n\n /// @notice Returns the liquidity credits of a given job\n /// @param _job The address of the job of which we want to know the liquidity credits\n /// @return _amount The liquidity credits of a given job\n function jobLiquidityCredits(address _job) external view returns (uint256 _amount);\n\n /// @notice Returns the credits of a given job for the current period\n /// @param _job The address of the job of which we want to know the period credits\n /// @return _amount The credits the given job has at the current period\n function jobPeriodCredits(address _job) external view returns (uint256 _amount);\n\n /// @notice Calculates the total credits of a given job\n /// @param _job The address of the job of which we want to know the total credits\n /// @return _amount The total credits of the given job\n function totalJobCredits(address _job) external view returns (uint256 _amount);\n\n /// @notice Calculates how many credits should be rewarded periodically for a given liquidity amount\n /// @dev _periodCredits = underlying KP3Rs for given liquidity amount * rewardPeriod / inflationPeriod\n /// @param _liquidity The address of the liquidity to provide\n /// @param _amount The amount of liquidity to provide\n /// @return _periodCredits The amount of KP3R periodically minted for the given liquidity\n function quoteLiquidity(address _liquidity, uint256 _amount) external view returns (uint256 _periodCredits);\n\n /// @notice Observes the current state of the liquidity pair being observed and updates TickCache with the information\n /// @param _liquidity The address of the liquidity pair being observed\n /// @return _tickCache The updated TickCache\n function observeLiquidity(address _liquidity) external view returns (TickCache memory _tickCache);\n\n /// @notice Gifts liquidity credits to the specified job\n /// @param _job The address of the job being credited\n /// @param _amount The amount of liquidity credits to gift\n function forceLiquidityCreditsToJob(address _job, uint256 _amount) external;\n\n /// @notice Approve a liquidity pair for being accepted in future\n /// @param _liquidity The address of the liquidity accepted\n function approveLiquidity(address _liquidity) external;\n\n /// @notice Revoke a liquidity pair from being accepted in future\n /// @param _liquidity The liquidity no longer accepted\n function revokeLiquidity(address _liquidity) external;\n\n /// @notice Allows anyone to fund a job with liquidity\n /// @param _job The address of the job to assign liquidity to\n /// @param _liquidity The liquidity being added\n /// @param _amount The amount of liquidity tokens to add\n function addLiquidityToJob(\n address _job,\n address _liquidity,\n uint256 _amount\n ) external;\n\n /// @notice Unbond liquidity for a job\n /// @dev Can only be called by the job's owner\n /// @param _job The address of the job being unbonded from\n /// @param _liquidity The liquidity being unbonded\n /// @param _amount The amount of liquidity being removed\n function unbondLiquidityFromJob(\n address _job,\n address _liquidity,\n uint256 _amount\n ) external;\n\n /// @notice Withdraw liquidity from a job\n /// @param _job The address of the job being withdrawn from\n /// @param _liquidity The liquidity being withdrawn\n /// @param _receiver The address that will receive the withdrawn liquidity\n function withdrawLiquidityFromJob(\n address _job,\n address _liquidity,\n address _receiver\n ) external;\n}\n\n/// @title Keep3rJobMigration contract\n/// @notice Handles the migration process of jobs to different addresses\ninterface IKeep3rJobMigration is IKeep3rJobFundableCredits, IKeep3rJobFundableLiquidity {\n // Events\n\n /// @notice Emitted when Keep3rJobMigration#migrateJob function is called\n /// @param _fromJob The address of the job that requests to migrate\n /// @param _toJob The address at which the job requests to migrate\n event JobMigrationRequested(address indexed _fromJob, address _toJob);\n\n /// @notice Emitted when Keep3rJobMigration#acceptJobMigration function is called\n /// @param _fromJob The address of the job that requested to migrate\n /// @param _toJob The address at which the job had requested to migrate\n event JobMigrationSuccessful(address _fromJob, address indexed _toJob);\n\n // Errors\n\n /// @notice Throws when the address of the job that requests to migrate wants to migrate to its same address\n error JobMigrationImpossible();\n\n /// @notice Throws when the _toJob address differs from the address being tracked in the pendingJobMigrations mapping\n error JobMigrationUnavailable();\n\n /// @notice Throws when cooldown between migrations has not yet passed\n error JobMigrationLocked();\n\n // Variables\n\n /// @notice Maps the jobs that have requested a migration to the address they have requested to migrate to\n /// @return _toJob The address to which the job has requested to migrate to\n function pendingJobMigrations(address _fromJob) external view returns (address _toJob);\n\n // Methods\n\n /// @notice Initializes the migration process for a job by adding the request to the pendingJobMigrations mapping\n /// @param _fromJob The address of the job that is requesting to migrate\n /// @param _toJob The address at which the job is requesting to migrate\n function migrateJob(address _fromJob, address _toJob) external;\n\n /// @notice Completes the migration process for a job\n /// @dev Unbond/withdraw process doesn't get migrated\n /// @param _fromJob The address of the job that requested to migrate\n /// @param _toJob The address to which the job wants to migrate to\n function acceptJobMigration(address _fromJob, address _toJob) external;\n}\n\n/// @title Keep3rJobWorkable contract\n/// @notice Handles the mechanisms jobs can pay keepers with along with the restrictions jobs can put on keepers before they can work on jobs\ninterface IKeep3rJobWorkable is IKeep3rJobMigration {\n // Events\n\n /// @notice Emitted when a keeper is validated before a job\n /// @param _gasLeft The amount of gas that the transaction has left at the moment of keeper validation\n event KeeperValidation(uint256 _gasLeft);\n\n /// @notice Emitted when a keeper works a job\n /// @param _credit The address of the asset in which the keeper is paid\n /// @param _job The address of the job the keeper has worked\n /// @param _keeper The address of the keeper that has worked the job\n /// @param _payment The amount that has been paid out to the keeper in exchange for working the job\n /// @param _gasLeft The amount of gas that the transaction has left at the moment of payment\n event KeeperWork(address indexed _credit, address indexed _job, address indexed _keeper, uint256 _payment, uint256 _gasLeft);\n\n // Errors\n\n /// @notice Throws if work method was called without calling isKeeper or isBondedKeeper\n error GasNotInitialized();\n\n /// @notice Throws if the address claiming to be a job is not in the list of approved jobs\n error JobUnapproved();\n\n /// @notice Throws if the amount of funds in the job is less than the payment that must be paid to the keeper that works that job\n error InsufficientFunds();\n\n // Methods\n\n /// @notice Confirms if the current keeper is registered\n /// @dev Can be used for general (non critical) functions\n /// @param _keeper The keeper being investigated\n /// @return _isKeeper Whether the address passed as a parameter is a keeper or not\n function isKeeper(address _keeper) external returns (bool _isKeeper);\n\n /// @notice Confirms if the current keeper is registered and has a minimum bond of any asset.\n /// @dev Should be used for protected functions\n /// @param _keeper The keeper to check\n /// @param _bond The bond token being evaluated\n /// @param _minBond The minimum amount of bonded tokens\n /// @param _earned The minimum funds earned in the keepers lifetime\n /// @param _age The minimum keeper age required\n /// @return _isBondedKeeper Whether the `_keeper` meets the given requirements\n function isBondedKeeper(\n address _keeper,\n address _bond,\n uint256 _minBond,\n uint256 _earned,\n uint256 _age\n ) external returns (bool _isBondedKeeper);\n\n /// @notice Implemented by jobs to show that a keeper performed work\n /// @dev Automatically calculates the payment for the keeper and pays the keeper with bonded KP3R\n /// @param _keeper Address of the keeper that performed the work\n function worked(address _keeper) external;\n\n /// @notice Implemented by jobs to show that a keeper performed work\n /// @dev Pays the keeper that performs the work with KP3R\n /// @param _keeper Address of the keeper that performed the work\n /// @param _payment The reward that should be allocated for the job\n function bondedPayment(address _keeper, uint256 _payment) external;\n\n /// @notice Implemented by jobs to show that a keeper performed work\n /// @dev Pays the keeper that performs the work with a specific token\n /// @param _token The asset being awarded to the keeper\n /// @param _keeper Address of the keeper that performed the work\n /// @param _amount The reward that should be allocated\n function directTokenPayment(\n address _token,\n address _keeper,\n uint256 _amount\n ) external;\n}\n\n/// @title Keep3rJobDisputable contract\n/// @notice Handles the actions that can be taken on a disputed job\ninterface IKeep3rJobDisputable is IKeep3rDisputable, IKeep3rJobFundableCredits, IKeep3rJobFundableLiquidity {\n // Events\n\n /// @notice Emitted when Keep3rJobDisputable#slashTokenFromJob is called\n /// @param _job The address of the job from which the token will be slashed\n /// @param _token The address of the token being slashed\n /// @param _slasher The user that slashes the token\n /// @param _amount The amount of the token being slashed\n event JobSlashToken(address indexed _job, address _token, address indexed _slasher, uint256 _amount);\n\n /// @notice Emitted when Keep3rJobDisputable#slashLiquidityFromJob is called\n /// @param _job The address of the job from which the liquidity will be slashed\n /// @param _liquidity The address of the liquidity being slashed\n /// @param _slasher The user that slashes the liquidity\n /// @param _amount The amount of the liquidity being slashed\n event JobSlashLiquidity(address indexed _job, address _liquidity, address indexed _slasher, uint256 _amount);\n\n // Errors\n\n /// @notice Throws when the token trying to be slashed doesn't exist\n error JobTokenUnexistent();\n\n /// @notice Throws when someone tries to slash more tokens than the job has\n error JobTokenInsufficient();\n\n // Methods\n\n /// @notice Allows governance or slasher to slash a job specific token\n /// @param _job The address of the job from which the token will be slashed\n /// @param _token The address of the token that will be slashed\n /// @param _amount The amount of the token that will be slashed\n function slashTokenFromJob(\n address _job,\n address _token,\n uint256 _amount\n ) external;\n\n /// @notice Allows governance or a slasher to slash liquidity from a job\n /// @param _job The address being slashed\n /// @param _liquidity The address of the liquidity that will be slashed\n /// @param _amount The amount of liquidity that will be slashed\n function slashLiquidityFromJob(\n address _job,\n address _liquidity,\n uint256 _amount\n ) external;\n}\n\n// solhint-disable-next-line no-empty-blocks\ninterface IKeep3rJobs is IKeep3rJobWorkable, IKeep3rJobManager, IKeep3rJobDisputable {\n\n}\n" - }, - "solidity/interfaces/peripherals/IKeep3rKeepers.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport './IKeep3rDisputable.sol';\n\n/// @title Keep3rKeeperFundable contract\n/// @notice Handles the actions required to become a keeper\ninterface IKeep3rKeeperFundable {\n // Events\n\n /// @notice Emitted when Keep3rKeeperFundable#activate is called\n /// @param _keeper The keeper that has been activated\n /// @param _bond The asset the keeper has bonded\n /// @param _amount The amount of the asset the keeper has bonded\n event Activation(address indexed _keeper, address indexed _bond, uint256 _amount);\n\n /// @notice Emitted when Keep3rKeeperFundable#withdraw is called\n /// @param _keeper The caller of Keep3rKeeperFundable#withdraw function\n /// @param _bond The asset to withdraw from the bonding pool\n /// @param _amount The amount of funds withdrawn\n event Withdrawal(address indexed _keeper, address indexed _bond, uint256 _amount);\n\n // Errors\n\n /// @notice Throws when the address that is trying to register as a job is already a job\n error AlreadyAJob();\n\n // Methods\n\n /// @notice Beginning of the bonding process\n /// @param _bonding The asset being bonded\n /// @param _amount The amount of bonding asset being bonded\n function bond(address _bonding, uint256 _amount) external;\n\n /// @notice Beginning of the unbonding process\n /// @param _bonding The asset being unbonded\n /// @param _amount Allows for partial unbonding\n function unbond(address _bonding, uint256 _amount) external;\n\n /// @notice End of the bonding process after bonding time has passed\n /// @param _bonding The asset being activated as bond collateral\n function activate(address _bonding) external;\n\n /// @notice Withdraw funds after unbonding has finished\n /// @param _bonding The asset to withdraw from the bonding pool\n function withdraw(address _bonding) external;\n}\n\n/// @title Keep3rKeeperDisputable contract\n/// @notice Handles the actions that can be taken on a disputed keeper\ninterface IKeep3rKeeperDisputable is IKeep3rDisputable, IKeep3rKeeperFundable {\n // Events\n\n /// @notice Emitted when Keep3rKeeperDisputable#slash is called\n /// @param _keeper The address of the slashed keeper\n /// @param _slasher The user that called Keep3rKeeperDisputable#slash\n /// @param _amount The amount of credits slashed from the keeper\n event KeeperSlash(address indexed _keeper, address indexed _slasher, uint256 _amount);\n\n /// @notice Emitted when Keep3rKeeperDisputable#revoke is called\n /// @param _keeper The address of the revoked keeper\n /// @param _slasher The user that called Keep3rKeeperDisputable#revoke\n event KeeperRevoke(address indexed _keeper, address indexed _slasher);\n\n // Methods\n\n /// @notice Allows governance to slash a keeper based on a dispute\n /// @param _keeper The address being slashed\n /// @param _bonded The asset being slashed\n /// @param _bondAmount The bonded amount being slashed\n /// @param _unbondAmount The pending unbond amount being slashed\n function slash(\n address _keeper,\n address _bonded,\n uint256 _bondAmount,\n uint256 _unbondAmount\n ) external;\n\n /// @notice Blacklists a keeper from participating in the network\n /// @param _keeper The address being slashed\n function revoke(address _keeper) external;\n}\n\n// solhint-disable-next-line no-empty-blocks\n\n/// @title Keep3rKeepers contract\ninterface IKeep3rKeepers is IKeep3rKeeperDisputable {\n\n}\n" - }, - "solidity/interfaces/peripherals/IKeep3rParameters.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport './IKeep3rAccountance.sol';\n\n/// @title Keep3rParameters contract\n/// @notice Handles and sets all the required parameters for Keep3r\ninterface IKeep3rParameters is IKeep3rAccountance {\n // Events\n\n /// @notice Emitted when the Keep3rHelper address is changed\n /// @param _keep3rHelper The address of Keep3rHelper's contract\n event Keep3rHelperChange(address _keep3rHelper);\n\n /// @notice Emitted when the Keep3rV1 address is changed\n /// @param _keep3rV1 The address of Keep3rV1's contract\n event Keep3rV1Change(address _keep3rV1);\n\n /// @notice Emitted when the Keep3rV1Proxy address is changed\n /// @param _keep3rV1Proxy The address of Keep3rV1Proxy's contract\n event Keep3rV1ProxyChange(address _keep3rV1Proxy);\n\n /// @notice Emitted when bondTime is changed\n /// @param _bondTime The new bondTime\n event BondTimeChange(uint256 _bondTime);\n\n /// @notice Emitted when _liquidityMinimum is changed\n /// @param _liquidityMinimum The new _liquidityMinimum\n event LiquidityMinimumChange(uint256 _liquidityMinimum);\n\n /// @notice Emitted when _unbondTime is changed\n /// @param _unbondTime The new _unbondTime\n event UnbondTimeChange(uint256 _unbondTime);\n\n /// @notice Emitted when _rewardPeriodTime is changed\n /// @param _rewardPeriodTime The new _rewardPeriodTime\n event RewardPeriodTimeChange(uint256 _rewardPeriodTime);\n\n /// @notice Emitted when the inflationPeriod is changed\n /// @param _inflationPeriod The new inflationPeriod\n event InflationPeriodChange(uint256 _inflationPeriod);\n\n /// @notice Emitted when the fee is changed\n /// @param _fee The new token credits fee\n event FeeChange(uint256 _fee);\n\n // Variables\n\n /// @notice Address of Keep3rHelper's contract\n /// @return _keep3rHelper The address of Keep3rHelper's contract\n function keep3rHelper() external view returns (address _keep3rHelper);\n\n /// @notice Address of Keep3rV1's contract\n /// @return _keep3rV1 The address of Keep3rV1's contract\n function keep3rV1() external view returns (address _keep3rV1);\n\n /// @notice Address of Keep3rV1Proxy's contract\n /// @return _keep3rV1Proxy The address of Keep3rV1Proxy's contract\n function keep3rV1Proxy() external view returns (address _keep3rV1Proxy);\n\n /// @notice The amount of time required to pass after a keeper has bonded assets for it to be able to activate\n /// @return _days The required bondTime in days\n function bondTime() external view returns (uint256 _days);\n\n /// @notice The amount of time required to pass before a keeper can unbond what he has bonded\n /// @return _days The required unbondTime in days\n function unbondTime() external view returns (uint256 _days);\n\n /// @notice The minimum amount of liquidity required to fund a job per liquidity\n /// @return _amount The minimum amount of liquidity in KP3R\n function liquidityMinimum() external view returns (uint256 _amount);\n\n /// @notice The amount of time between each scheduled credits reward given to a job\n /// @return _days The reward period in days\n function rewardPeriodTime() external view returns (uint256 _days);\n\n /// @notice The inflation period is the denominator used to regulate the emission of KP3R\n /// @return _period The denominator used to regulate the emission of KP3R\n function inflationPeriod() external view returns (uint256 _period);\n\n /// @notice The fee to be sent to governance when a user adds liquidity to a job\n /// @return _amount The fee amount to be sent to governance when a user adds liquidity to a job\n function fee() external view returns (uint256 _amount);\n\n // Errors\n\n /// @notice Throws if the reward period is less than the minimum reward period time\n error MinRewardPeriod();\n\n /// @notice Throws if either a job or a keeper is disputed\n error Disputed();\n\n /// @notice Throws if there are no bonded assets\n error BondsUnexistent();\n\n /// @notice Throws if the time required to bond an asset has not passed yet\n error BondsLocked();\n\n /// @notice Throws if there are no bonds to withdraw\n error UnbondsUnexistent();\n\n /// @notice Throws if the time required to withdraw the bonds has not passed yet\n error UnbondsLocked();\n\n // Methods\n\n /// @notice Sets the Keep3rHelper address\n /// @param _keep3rHelper The Keep3rHelper address\n function setKeep3rHelper(address _keep3rHelper) external;\n\n /// @notice Sets the Keep3rV1 address\n /// @param _keep3rV1 The Keep3rV1 address\n function setKeep3rV1(address _keep3rV1) external;\n\n /// @notice Sets the Keep3rV1Proxy address\n /// @param _keep3rV1Proxy The Keep3rV1Proxy address\n function setKeep3rV1Proxy(address _keep3rV1Proxy) external;\n\n /// @notice Sets the bond time required to activate as a keeper\n /// @param _bond The new bond time\n function setBondTime(uint256 _bond) external;\n\n /// @notice Sets the unbond time required unbond what has been bonded\n /// @param _unbond The new unbond time\n function setUnbondTime(uint256 _unbond) external;\n\n /// @notice Sets the minimum amount of liquidity required to fund a job\n /// @param _liquidityMinimum The new minimum amount of liquidity\n function setLiquidityMinimum(uint256 _liquidityMinimum) external;\n\n /// @notice Sets the time required to pass between rewards for jobs\n /// @param _rewardPeriodTime The new amount of time required to pass between rewards\n function setRewardPeriodTime(uint256 _rewardPeriodTime) external;\n\n /// @notice Sets the new inflation period\n /// @param _inflationPeriod The new inflation period\n function setInflationPeriod(uint256 _inflationPeriod) external;\n\n /// @notice Sets the new fee\n /// @param _fee The new fee\n function setFee(uint256 _fee) external;\n}\n" - }, - "solidity/interfaces/peripherals/IKeep3rDisputable.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\n/// @title Keep3rDisputable contract\n/// @notice Creates/resolves disputes for jobs or keepers\n/// A disputed keeper is slashable and is not able to bond, activate, withdraw or receive direct payments\n/// A disputed job is slashable and is not able to pay the keepers, withdraw tokens or to migrate\ninterface IKeep3rDisputable {\n /// @notice Emitted when a keeper or a job is disputed\n /// @param _jobOrKeeper The address of the disputed keeper/job\n /// @param _disputer The user that called the function and disputed the keeper\n event Dispute(address indexed _jobOrKeeper, address indexed _disputer);\n\n /// @notice Emitted when a dispute is resolved\n /// @param _jobOrKeeper The address of the disputed keeper/job\n /// @param _resolver The user that called the function and resolved the dispute\n event Resolve(address indexed _jobOrKeeper, address indexed _resolver);\n\n /// @notice Throws when a job or keeper is already disputed\n error AlreadyDisputed();\n\n /// @notice Throws when a job or keeper is not disputed and someone tries to resolve the dispute\n error NotDisputed();\n\n /// @notice Allows governance to create a dispute for a given keeper/job\n /// @param _jobOrKeeper The address in dispute\n function dispute(address _jobOrKeeper) external;\n\n /// @notice Allows governance to resolve a dispute on a keeper/job\n /// @param _jobOrKeeper The address cleared\n function resolve(address _jobOrKeeper) external;\n}\n" - }, - "solidity/interfaces/peripherals/IKeep3rAccountance.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport './IKeep3rRoles.sol';\n\n/// @title Keep3rDisputable contract\n/// @notice Disputes keepers, or if they're already disputed, it can resolve the case\n/// @dev Argument `bonding` can be the address of either a token or a liquidity\ninterface IKeep3rAccountance is IKeep3rRoles {\n // Events\n\n /// @notice Emitted when the bonding process of a new keeper begins\n /// @param _keeper The caller of Keep3rKeeperFundable#bond function\n /// @param _bonding The asset the keeper has bonded\n /// @param _amount The amount the keeper has bonded\n event Bonding(address indexed _keeper, address indexed _bonding, uint256 _amount);\n\n /// @notice Emitted when a keeper or job begins the unbonding process to withdraw the funds\n /// @param _keeperOrJob The keeper or job that began the unbonding process\n /// @param _unbonding The liquidity pair or asset being unbonded\n /// @param _amount The amount being unbonded\n event Unbonding(address indexed _keeperOrJob, address indexed _unbonding, uint256 _amount);\n\n // Variables\n\n /// @notice Tracks the total amount of bonded KP3Rs in the contract\n /// @return _totalBonds The total amount of bonded KP3Rs in the contract\n function totalBonds() external view returns (uint256 _totalBonds);\n\n /// @notice Tracks the total KP3R earnings of a keeper since it started working\n /// @param _keeper The address of the keeper\n /// @return _workCompleted Total KP3R earnings of a keeper since it started working\n function workCompleted(address _keeper) external view returns (uint256 _workCompleted);\n\n /// @notice Tracks when a keeper was first registered\n /// @param _keeper The address of the keeper\n /// @return timestamp The time at which the keeper was first registered\n function firstSeen(address _keeper) external view returns (uint256 timestamp);\n\n /// @notice Tracks if a keeper or job has a pending dispute\n /// @param _keeperOrJob The address of the keeper or job\n /// @return _disputed Whether a keeper or job has a pending dispute\n function disputes(address _keeperOrJob) external view returns (bool _disputed);\n\n /// @notice Tracks how much a keeper has bonded of a certain token\n /// @param _keeper The address of the keeper\n /// @param _bond The address of the token being bonded\n /// @return _bonds Amount of a certain token that a keeper has bonded\n function bonds(address _keeper, address _bond) external view returns (uint256 _bonds);\n\n /// @notice The current token credits available for a job\n /// @param _job The address of the job\n /// @param _token The address of the token bonded\n /// @return _amount The amount of token credits available for a job\n function jobTokenCredits(address _job, address _token) external view returns (uint256 _amount);\n\n /// @notice Tracks the amount of assets deposited in pending bonds\n /// @param _keeper The address of the keeper\n /// @param _bonding The address of the token being bonded\n /// @return _pendingBonds Amount of a certain asset a keeper has unbonding\n function pendingBonds(address _keeper, address _bonding) external view returns (uint256 _pendingBonds);\n\n /// @notice Tracks when a bonding for a keeper can be activated\n /// @param _keeper The address of the keeper\n /// @param _bonding The address of the token being bonded\n /// @return _timestamp Time at which the bonding for a keeper can be activated\n function canActivateAfter(address _keeper, address _bonding) external view returns (uint256 _timestamp);\n\n /// @notice Tracks when keeper bonds are ready to be withdrawn\n /// @param _keeper The address of the keeper\n /// @param _bonding The address of the token being unbonded\n /// @return _timestamp Time at which the keeper bonds are ready to be withdrawn\n function canWithdrawAfter(address _keeper, address _bonding) external view returns (uint256 _timestamp);\n\n /// @notice Tracks how much keeper bonds are to be withdrawn\n /// @param _keeper The address of the keeper\n /// @param _bonding The address of the token being unbonded\n /// @return _pendingUnbonds The amount of keeper bonds that are to be withdrawn\n function pendingUnbonds(address _keeper, address _bonding) external view returns (uint256 _pendingUnbonds);\n\n /// @notice Checks whether the address has ever bonded an asset\n /// @param _keeper The address of the keeper\n /// @return _hasBonded Whether the address has ever bonded an asset\n function hasBonded(address _keeper) external view returns (bool _hasBonded);\n\n // Methods\n\n /// @notice Lists all jobs\n /// @return _jobList Array with all the jobs in _jobs\n function jobs() external view returns (address[] memory _jobList);\n\n /// @notice Lists all keepers\n /// @return _keeperList Array with all the keepers in _keepers\n function keepers() external view returns (address[] memory _keeperList);\n\n // Errors\n\n /// @notice Throws when an address is passed as a job, but that address is not a job\n error JobUnavailable();\n\n /// @notice Throws when an action that requires an undisputed job is applied on a disputed job\n error JobDisputed();\n}\n" - }, - "solidity/interfaces/peripherals/IKeep3rRoles.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport './IBaseErrors.sol';\nimport './IGovernable.sol';\nimport './IDustCollector.sol';\n\n/// @title Keep3rRoles contract\n/// @notice Manages the Keep3r specific roles\ninterface IKeep3rRoles is IBaseErrors, IDustCollector, IGovernable {\n // Events\n\n /// @notice Emitted when a slasher is added\n /// @param _slasher Address of the added slasher\n event SlasherAdded(address _slasher);\n\n /// @notice Emitted when a slasher is removed\n /// @param _slasher Address of the removed slasher\n event SlasherRemoved(address _slasher);\n\n /// @notice Emitted when a disputer is added\n /// @param _disputer Address of the added disputer\n event DisputerAdded(address _disputer);\n\n /// @notice Emitted when a disputer is removed\n /// @param _disputer Address of the removed disputer\n event DisputerRemoved(address _disputer);\n\n // Variables\n\n /// @notice Tracks whether the address is a slasher or not\n /// @param _slasher Address being checked as a slasher\n /// @return _isSlasher Whether the address is a slasher or not\n function slashers(address _slasher) external view returns (bool _isSlasher);\n\n /// @notice Tracks whether the address is a disputer or not\n /// @param _disputer Address being checked as a disputer\n /// @return _isDisputer Whether the address is a disputer or not\n function disputers(address _disputer) external view returns (bool _isDisputer);\n\n // Errors\n\n /// @notice Throws if the address is already a registered slasher\n error SlasherExistent();\n\n /// @notice Throws if caller is not a registered slasher\n error SlasherUnexistent();\n\n /// @notice Throws if the address is already a registered disputer\n error DisputerExistent();\n\n /// @notice Throws if caller is not a registered disputer\n error DisputerUnexistent();\n\n /// @notice Throws if the msg.sender is not a slasher or is not a part of governance\n error OnlySlasher();\n\n /// @notice Throws if the msg.sender is not a disputer or is not a part of governance\n error OnlyDisputer();\n\n // Methods\n\n /// @notice Registers a slasher by updating the slashers mapping\n function addSlasher(address _slasher) external;\n\n /// @notice Removes a slasher by updating the slashers mapping\n function removeSlasher(address _slasher) external;\n\n /// @notice Registers a disputer by updating the disputers mapping\n function addDisputer(address _disputer) external;\n\n /// @notice Removes a disputer by updating the disputers mapping\n function removeDisputer(address _disputer) external;\n}\n" - }, - "solidity/interfaces/peripherals/IBaseErrors.sol": { - "content": "// SPDX-License-Identifier: MIT\n\npragma solidity >=0.8.4 <0.9.0;\n\ninterface IBaseErrors {\n /// @notice Throws if a variable is assigned to the zero address\n error ZeroAddress();\n}\n" - }, - "solidity/interfaces/peripherals/IGovernable.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\n/// @title Governable contract\n/// @notice Manages the governance role\ninterface IGovernable {\n // Events\n\n /// @notice Emitted when pendingGovernance accepts to be governance\n /// @param _governance Address of the new governance\n event GovernanceSet(address _governance);\n\n /// @notice Emitted when a new governance is proposed\n /// @param _pendingGovernance Address that is proposed to be the new governance\n event GovernanceProposal(address _pendingGovernance);\n\n // Errors\n\n /// @notice Throws if the caller of the function is not governance\n error OnlyGovernance();\n\n /// @notice Throws if the caller of the function is not pendingGovernance\n error OnlyPendingGovernance();\n\n /// @notice Throws if trying to set governance to zero address\n error NoGovernanceZeroAddress();\n\n // Variables\n\n /// @notice Stores the governance address\n /// @return _governance The governance addresss\n function governance() external view returns (address _governance);\n\n /// @notice Stores the pendingGovernance address\n /// @return _pendingGovernance The pendingGovernance addresss\n function pendingGovernance() external view returns (address _pendingGovernance);\n\n // Methods\n\n /// @notice Proposes a new address to be governance\n /// @param _governance The address being proposed as the new governance\n function setGovernance(address _governance) external;\n\n /// @notice Changes the governance from the current governance to the previously proposed address\n function acceptGovernance() external;\n}\n" - }, - "solidity/interfaces/peripherals/IDustCollector.sol": { - "content": "// SPDX-License-Identifier: MIT\n\npragma solidity >=0.8.4 <0.9.0;\n\nimport './IBaseErrors.sol';\n\ninterface IDustCollector is IBaseErrors {\n /// @notice Emitted when dust is sent\n /// @param _token The token that will be transferred\n /// @param _amount The amount of the token that will be transferred\n /// @param _to The address which will receive the funds\n event DustSent(address _token, uint256 _amount, address _to);\n\n /// @notice Allows an authorized user to transfer the tokens or eth that may have been left in a contract\n /// @param _token The token that will be transferred\n /// @param _amount The amount of the token that will be transferred\n /// @param _to The address that will receive the idle funds\n function sendDust(\n address _token,\n uint256 _amount,\n address _to\n ) external;\n}\n" - }, - "solidity/contracts/peripherals/jobs/Keep3rJobManager.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport './Keep3rJobOwnership.sol';\nimport '../Keep3rAccountance.sol';\nimport '../../../interfaces/peripherals/IKeep3rJobs.sol';\n\nabstract contract Keep3rJobManager is IKeep3rJobManager, Keep3rJobOwnership, Keep3rAccountance {\n using EnumerableSet for EnumerableSet.AddressSet;\n\n /// @inheritdoc IKeep3rJobManager\n function addJob(address _job) external override {\n if (_jobs.contains(_job)) revert JobAlreadyAdded();\n if (hasBonded[_job]) revert AlreadyAKeeper();\n _jobs.add(_job);\n jobOwner[_job] = msg.sender;\n emit JobAddition(_job, msg.sender);\n }\n}\n" - }, - "solidity/contracts/peripherals/jobs/Keep3rJobWorkable.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport './Keep3rJobMigration.sol';\nimport '../../../interfaces/IKeep3rHelper.sol';\nimport '../../../interfaces/peripherals/IKeep3rJobs.sol';\n\nimport '@openzeppelin/contracts/token/ERC20/IERC20.sol';\nimport '@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol';\n\nabstract contract Keep3rJobWorkable is IKeep3rJobWorkable, Keep3rJobMigration {\n using EnumerableSet for EnumerableSet.AddressSet;\n using SafeERC20 for IERC20;\n\n uint256 internal _initialGas;\n\n /// @inheritdoc IKeep3rJobWorkable\n function isKeeper(address _keeper) external override returns (bool _isKeeper) {\n _initialGas = _getGasLeft();\n if (_keepers.contains(_keeper)) {\n emit KeeperValidation(_initialGas);\n return true;\n }\n }\n\n /// @inheritdoc IKeep3rJobWorkable\n function isBondedKeeper(\n address _keeper,\n address _bond,\n uint256 _minBond,\n uint256 _earned,\n uint256 _age\n ) external override returns (bool _isBondedKeeper) {\n _initialGas = _getGasLeft();\n if (\n _keepers.contains(_keeper) &&\n bonds[_keeper][_bond] >= _minBond &&\n workCompleted[_keeper] >= _earned &&\n block.timestamp - firstSeen[_keeper] >= _age\n ) {\n emit KeeperValidation(_initialGas);\n return true;\n }\n }\n\n /// @inheritdoc IKeep3rJobWorkable\n function worked(address _keeper) external virtual override {\n if (_initialGas == 0) revert GasNotInitialized();\n address _job = msg.sender;\n if (disputes[_job]) revert JobDisputed();\n if (!_jobs.contains(_job)) revert JobUnapproved();\n\n if (_updateJobCreditsIfNeeded(_job)) {\n emit LiquidityCreditsReward(_job, rewardedAt[_job], _jobLiquidityCredits[_job], _jobPeriodCredits[_job]);\n }\n\n (uint256 _boost, uint256 _oneEthQuote, uint256 _extraGas) = IKeep3rHelper(keep3rHelper).getPaymentParams(bonds[_keeper][keep3rV1]);\n\n uint256 _gasLeft = _getGasLeft();\n uint256 _payment = _calculatePayment(_gasLeft, _extraGas, _oneEthQuote, _boost);\n\n if (_payment > _jobLiquidityCredits[_job]) {\n _rewardJobCredits(_job);\n emit LiquidityCreditsReward(_job, rewardedAt[_job], _jobLiquidityCredits[_job], _jobPeriodCredits[_job]);\n\n _gasLeft = _getGasLeft();\n _payment = _calculatePayment(_gasLeft, _extraGas, _oneEthQuote, _boost);\n }\n\n _bondedPayment(_job, _keeper, _payment);\n delete _initialGas;\n\n emit KeeperWork(keep3rV1, _job, _keeper, _payment, _gasLeft);\n }\n\n /// @inheritdoc IKeep3rJobWorkable\n function bondedPayment(address _keeper, uint256 _payment) external override {\n address _job = msg.sender;\n\n if (disputes[_job]) revert JobDisputed();\n if (!_jobs.contains(_job)) revert JobUnapproved();\n\n if (_updateJobCreditsIfNeeded(_job)) {\n emit LiquidityCreditsReward(_job, rewardedAt[_job], _jobLiquidityCredits[_job], _jobPeriodCredits[_job]);\n }\n\n if (_payment > _jobLiquidityCredits[_job]) {\n _rewardJobCredits(_job);\n emit LiquidityCreditsReward(_job, rewardedAt[_job], _jobLiquidityCredits[_job], _jobPeriodCredits[_job]);\n }\n\n _bondedPayment(_job, _keeper, _payment);\n emit KeeperWork(keep3rV1, _job, _keeper, _payment, _getGasLeft());\n }\n\n /// @inheritdoc IKeep3rJobWorkable\n function directTokenPayment(\n address _token,\n address _keeper,\n uint256 _amount\n ) external override {\n address _job = msg.sender;\n\n if (disputes[_job]) revert JobDisputed();\n if (disputes[_keeper]) revert Disputed();\n if (!_jobs.contains(_job)) revert JobUnapproved();\n if (jobTokenCredits[_job][_token] < _amount) revert InsufficientFunds();\n jobTokenCredits[_job][_token] -= _amount;\n IERC20(_token).safeTransfer(_keeper, _amount);\n emit KeeperWork(_token, _job, _keeper, _amount, _getGasLeft());\n }\n\n function _bondedPayment(\n address _job,\n address _keeper,\n uint256 _payment\n ) internal {\n if (_payment > _jobLiquidityCredits[_job]) revert InsufficientFunds();\n\n workedAt[_job] = block.timestamp;\n _jobLiquidityCredits[_job] -= _payment;\n bonds[_keeper][keep3rV1] += _payment;\n workCompleted[_keeper] += _payment;\n totalBonds += _payment;\n }\n\n /// @notice Calculate amount to be payed in KP3R, taking into account multiple parameters\n /// @param _gasLeft Amount of gas left after working the job\n /// @param _extraGas Amount of expected unaccounted gas\n /// @param _oneEthQuote Amount of KP3R equivalent to 1 ETH\n /// @param _boost Reward given to the keeper for having bonded KP3R tokens\n /// @return _payment Amount to be payed in KP3R tokens\n function _calculatePayment(\n uint256 _gasLeft,\n uint256 _extraGas,\n uint256 _oneEthQuote,\n uint256 _boost\n ) internal view returns (uint256 _payment) {\n uint256 _accountedGas = _initialGas - _gasLeft + _extraGas;\n _payment = (((_accountedGas * _boost) / _BASE) * _oneEthQuote) / 1 ether;\n }\n\n /// @notice Return the gas left and add 1/64 in order to match real gas left at first level of depth (EIP-150)\n /// @return _gasLeft Amount of gas left recording taking into account EIP-150\n function _getGasLeft() internal view returns (uint256 _gasLeft) {\n _gasLeft = (gasleft() * 64) / 63;\n }\n}\n" - }, - "solidity/contracts/peripherals/jobs/Keep3rJobDisputable.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport './Keep3rJobFundableCredits.sol';\nimport './Keep3rJobFundableLiquidity.sol';\nimport '../Keep3rDisputable.sol';\n\nabstract contract Keep3rJobDisputable is IKeep3rJobDisputable, Keep3rDisputable, Keep3rJobFundableCredits, Keep3rJobFundableLiquidity {\n using EnumerableSet for EnumerableSet.AddressSet;\n using SafeERC20 for IERC20;\n\n /// @inheritdoc IKeep3rJobDisputable\n function slashTokenFromJob(\n address _job,\n address _token,\n uint256 _amount\n ) external override onlySlasher {\n if (!disputes[_job]) revert NotDisputed();\n if (!_jobTokens[_job].contains(_token)) revert JobTokenUnexistent();\n if (jobTokenCredits[_job][_token] < _amount) revert JobTokenInsufficient();\n\n try IERC20(_token).transfer(governance, _amount) {} catch {}\n jobTokenCredits[_job][_token] -= _amount;\n if (jobTokenCredits[_job][_token] == 0) {\n _jobTokens[_job].remove(_token);\n }\n\n emit JobSlashToken(_job, _token, msg.sender, _amount);\n }\n\n /// @inheritdoc IKeep3rJobDisputable\n function slashLiquidityFromJob(\n address _job,\n address _liquidity,\n uint256 _amount\n ) external override onlySlasher {\n if (!disputes[_job]) revert NotDisputed();\n\n _unbondLiquidityFromJob(_job, _liquidity, _amount);\n try IERC20(_liquidity).transfer(governance, _amount) {} catch {}\n emit JobSlashLiquidity(_job, _liquidity, msg.sender, _amount);\n }\n}\n" - }, - "solidity/contracts/peripherals/jobs/Keep3rJobOwnership.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../../../interfaces/peripherals/IKeep3rJobs.sol';\n\nabstract contract Keep3rJobOwnership is IKeep3rJobOwnership {\n /// @inheritdoc IKeep3rJobOwnership\n mapping(address => address) public override jobOwner;\n\n /// @inheritdoc IKeep3rJobOwnership\n mapping(address => address) public override jobPendingOwner;\n\n /// @inheritdoc IKeep3rJobOwnership\n function changeJobOwnership(address _job, address _newOwner) external override onlyJobOwner(_job) {\n jobPendingOwner[_job] = _newOwner;\n emit JobOwnershipChange(_job, jobOwner[_job], _newOwner);\n }\n\n /// @inheritdoc IKeep3rJobOwnership\n function acceptJobOwnership(address _job) external override onlyPendingJobOwner(_job) {\n address _previousOwner = jobOwner[_job];\n\n jobOwner[_job] = jobPendingOwner[_job];\n delete jobPendingOwner[_job];\n\n emit JobOwnershipAssent(msg.sender, _job, _previousOwner);\n }\n\n modifier onlyJobOwner(address _job) {\n if (msg.sender != jobOwner[_job]) revert OnlyJobOwner();\n _;\n }\n\n modifier onlyPendingJobOwner(address _job) {\n if (msg.sender != jobPendingOwner[_job]) revert OnlyPendingJobOwner();\n _;\n }\n}\n" - }, - "solidity/contracts/peripherals/Keep3rAccountance.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '@openzeppelin/contracts/utils/structs/EnumerableSet.sol';\nimport '../../interfaces/peripherals/IKeep3rAccountance.sol';\nimport './Keep3rRoles.sol';\n\nabstract contract Keep3rAccountance is IKeep3rAccountance, Keep3rRoles {\n using EnumerableSet for EnumerableSet.AddressSet;\n\n /// @notice List of all enabled keepers\n EnumerableSet.AddressSet internal _keepers;\n\n /// @inheritdoc IKeep3rAccountance\n uint256 public override totalBonds;\n\n /// @inheritdoc IKeep3rAccountance\n mapping(address => uint256) public override workCompleted;\n\n /// @inheritdoc IKeep3rAccountance\n mapping(address => uint256) public override firstSeen;\n\n /// @inheritdoc IKeep3rAccountance\n mapping(address => bool) public override disputes;\n\n /// @inheritdoc IKeep3rAccountance\n /// @notice Mapping (job => bonding => amount)\n mapping(address => mapping(address => uint256)) public override bonds;\n\n /// @inheritdoc IKeep3rAccountance\n mapping(address => mapping(address => uint256)) public override jobTokenCredits;\n\n /// @notice The current liquidity credits available for a job\n mapping(address => uint256) internal _jobLiquidityCredits;\n\n /// @notice Map the address of a job to its correspondent periodCredits\n mapping(address => uint256) internal _jobPeriodCredits;\n\n /// @notice Enumerable array of Job Tokens for Credits\n mapping(address => EnumerableSet.AddressSet) internal _jobTokens;\n\n /// @notice List of liquidities that a job has (job => liquidities)\n mapping(address => EnumerableSet.AddressSet) internal _jobLiquidities;\n\n /// @notice Liquidity pool to observe\n mapping(address => address) internal _liquidityPool;\n\n /// @notice Tracks if a pool has KP3R as token0\n mapping(address => bool) internal _isKP3RToken0;\n\n /// @inheritdoc IKeep3rAccountance\n mapping(address => mapping(address => uint256)) public override pendingBonds;\n\n /// @inheritdoc IKeep3rAccountance\n mapping(address => mapping(address => uint256)) public override canActivateAfter;\n\n /// @inheritdoc IKeep3rAccountance\n mapping(address => mapping(address => uint256)) public override canWithdrawAfter;\n\n /// @inheritdoc IKeep3rAccountance\n mapping(address => mapping(address => uint256)) public override pendingUnbonds;\n\n /// @inheritdoc IKeep3rAccountance\n mapping(address => bool) public override hasBonded;\n\n /// @notice List of all enabled jobs\n EnumerableSet.AddressSet internal _jobs;\n\n /// @inheritdoc IKeep3rAccountance\n function jobs() external view override returns (address[] memory _list) {\n _list = _jobs.values();\n }\n\n /// @inheritdoc IKeep3rAccountance\n function keepers() external view override returns (address[] memory _list) {\n _list = _keepers.values();\n }\n}\n" - }, - "@openzeppelin/contracts/utils/structs/EnumerableSet.sol": { - "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Library for managing\n * https://en.wikipedia.org/wiki/Set_(abstract_data_type)[sets] of primitive\n * types.\n *\n * Sets have the following properties:\n *\n * - Elements are added, removed, and checked for existence in constant time\n * (O(1)).\n * - Elements are enumerated in O(n). No guarantees are made on the ordering.\n *\n * ```\n * contract Example {\n * // Add the library methods\n * using EnumerableSet for EnumerableSet.AddressSet;\n *\n * // Declare a set state variable\n * EnumerableSet.AddressSet private mySet;\n * }\n * ```\n *\n * As of v3.3.0, sets of type `bytes32` (`Bytes32Set`), `address` (`AddressSet`)\n * and `uint256` (`UintSet`) are supported.\n */\nlibrary EnumerableSet {\n // To implement this library for multiple types with as little code\n // repetition as possible, we write it in terms of a generic Set type with\n // bytes32 values.\n // The Set implementation uses private functions, and user-facing\n // implementations (such as AddressSet) are just wrappers around the\n // underlying Set.\n // This means that we can only create new EnumerableSets for types that fit\n // in bytes32.\n\n struct Set {\n // Storage of set values\n bytes32[] _values;\n // Position of the value in the `values` array, plus 1 because index 0\n // means a value is not in the set.\n mapping(bytes32 => uint256) _indexes;\n }\n\n /**\n * @dev Add a value to a set. O(1).\n *\n * Returns true if the value was added to the set, that is if it was not\n * already present.\n */\n function _add(Set storage set, bytes32 value) private returns (bool) {\n if (!_contains(set, value)) {\n set._values.push(value);\n // The value is stored at length-1, but we add 1 to all indexes\n // and use 0 as a sentinel value\n set._indexes[value] = set._values.length;\n return true;\n } else {\n return false;\n }\n }\n\n /**\n * @dev Removes a value from a set. O(1).\n *\n * Returns true if the value was removed from the set, that is if it was\n * present.\n */\n function _remove(Set storage set, bytes32 value) private returns (bool) {\n // We read and store the value's index to prevent multiple reads from the same storage slot\n uint256 valueIndex = set._indexes[value];\n\n if (valueIndex != 0) {\n // Equivalent to contains(set, value)\n // To delete an element from the _values array in O(1), we swap the element to delete with the last one in\n // the array, and then remove the last element (sometimes called as 'swap and pop').\n // This modifies the order of the array, as noted in {at}.\n\n uint256 toDeleteIndex = valueIndex - 1;\n uint256 lastIndex = set._values.length - 1;\n\n if (lastIndex != toDeleteIndex) {\n bytes32 lastvalue = set._values[lastIndex];\n\n // Move the last value to the index where the value to delete is\n set._values[toDeleteIndex] = lastvalue;\n // Update the index for the moved value\n set._indexes[lastvalue] = valueIndex; // Replace lastvalue's index to valueIndex\n }\n\n // Delete the slot where the moved value was stored\n set._values.pop();\n\n // Delete the index for the deleted slot\n delete set._indexes[value];\n\n return true;\n } else {\n return false;\n }\n }\n\n /**\n * @dev Returns true if the value is in the set. O(1).\n */\n function _contains(Set storage set, bytes32 value) private view returns (bool) {\n return set._indexes[value] != 0;\n }\n\n /**\n * @dev Returns the number of values on the set. O(1).\n */\n function _length(Set storage set) private view returns (uint256) {\n return set._values.length;\n }\n\n /**\n * @dev Returns the value stored at position `index` in the set. O(1).\n *\n * Note that there are no guarantees on the ordering of values inside the\n * array, and it may change when more values are added or removed.\n *\n * Requirements:\n *\n * - `index` must be strictly less than {length}.\n */\n function _at(Set storage set, uint256 index) private view returns (bytes32) {\n return set._values[index];\n }\n\n /**\n * @dev Return the entire set in an array\n *\n * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed\n * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that\n * this function has an unbounded cost, and using it as part of a state-changing function may render the function\n * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.\n */\n function _values(Set storage set) private view returns (bytes32[] memory) {\n return set._values;\n }\n\n // Bytes32Set\n\n struct Bytes32Set {\n Set _inner;\n }\n\n /**\n * @dev Add a value to a set. O(1).\n *\n * Returns true if the value was added to the set, that is if it was not\n * already present.\n */\n function add(Bytes32Set storage set, bytes32 value) internal returns (bool) {\n return _add(set._inner, value);\n }\n\n /**\n * @dev Removes a value from a set. O(1).\n *\n * Returns true if the value was removed from the set, that is if it was\n * present.\n */\n function remove(Bytes32Set storage set, bytes32 value) internal returns (bool) {\n return _remove(set._inner, value);\n }\n\n /**\n * @dev Returns true if the value is in the set. O(1).\n */\n function contains(Bytes32Set storage set, bytes32 value) internal view returns (bool) {\n return _contains(set._inner, value);\n }\n\n /**\n * @dev Returns the number of values in the set. O(1).\n */\n function length(Bytes32Set storage set) internal view returns (uint256) {\n return _length(set._inner);\n }\n\n /**\n * @dev Returns the value stored at position `index` in the set. O(1).\n *\n * Note that there are no guarantees on the ordering of values inside the\n * array, and it may change when more values are added or removed.\n *\n * Requirements:\n *\n * - `index` must be strictly less than {length}.\n */\n function at(Bytes32Set storage set, uint256 index) internal view returns (bytes32) {\n return _at(set._inner, index);\n }\n\n /**\n * @dev Return the entire set in an array\n *\n * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed\n * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that\n * this function has an unbounded cost, and using it as part of a state-changing function may render the function\n * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.\n */\n function values(Bytes32Set storage set) internal view returns (bytes32[] memory) {\n return _values(set._inner);\n }\n\n // AddressSet\n\n struct AddressSet {\n Set _inner;\n }\n\n /**\n * @dev Add a value to a set. O(1).\n *\n * Returns true if the value was added to the set, that is if it was not\n * already present.\n */\n function add(AddressSet storage set, address value) internal returns (bool) {\n return _add(set._inner, bytes32(uint256(uint160(value))));\n }\n\n /**\n * @dev Removes a value from a set. O(1).\n *\n * Returns true if the value was removed from the set, that is if it was\n * present.\n */\n function remove(AddressSet storage set, address value) internal returns (bool) {\n return _remove(set._inner, bytes32(uint256(uint160(value))));\n }\n\n /**\n * @dev Returns true if the value is in the set. O(1).\n */\n function contains(AddressSet storage set, address value) internal view returns (bool) {\n return _contains(set._inner, bytes32(uint256(uint160(value))));\n }\n\n /**\n * @dev Returns the number of values in the set. O(1).\n */\n function length(AddressSet storage set) internal view returns (uint256) {\n return _length(set._inner);\n }\n\n /**\n * @dev Returns the value stored at position `index` in the set. O(1).\n *\n * Note that there are no guarantees on the ordering of values inside the\n * array, and it may change when more values are added or removed.\n *\n * Requirements:\n *\n * - `index` must be strictly less than {length}.\n */\n function at(AddressSet storage set, uint256 index) internal view returns (address) {\n return address(uint160(uint256(_at(set._inner, index))));\n }\n\n /**\n * @dev Return the entire set in an array\n *\n * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed\n * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that\n * this function has an unbounded cost, and using it as part of a state-changing function may render the function\n * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.\n */\n function values(AddressSet storage set) internal view returns (address[] memory) {\n bytes32[] memory store = _values(set._inner);\n address[] memory result;\n\n assembly {\n result := store\n }\n\n return result;\n }\n\n // UintSet\n\n struct UintSet {\n Set _inner;\n }\n\n /**\n * @dev Add a value to a set. O(1).\n *\n * Returns true if the value was added to the set, that is if it was not\n * already present.\n */\n function add(UintSet storage set, uint256 value) internal returns (bool) {\n return _add(set._inner, bytes32(value));\n }\n\n /**\n * @dev Removes a value from a set. O(1).\n *\n * Returns true if the value was removed from the set, that is if it was\n * present.\n */\n function remove(UintSet storage set, uint256 value) internal returns (bool) {\n return _remove(set._inner, bytes32(value));\n }\n\n /**\n * @dev Returns true if the value is in the set. O(1).\n */\n function contains(UintSet storage set, uint256 value) internal view returns (bool) {\n return _contains(set._inner, bytes32(value));\n }\n\n /**\n * @dev Returns the number of values on the set. O(1).\n */\n function length(UintSet storage set) internal view returns (uint256) {\n return _length(set._inner);\n }\n\n /**\n * @dev Returns the value stored at position `index` in the set. O(1).\n *\n * Note that there are no guarantees on the ordering of values inside the\n * array, and it may change when more values are added or removed.\n *\n * Requirements:\n *\n * - `index` must be strictly less than {length}.\n */\n function at(UintSet storage set, uint256 index) internal view returns (uint256) {\n return uint256(_at(set._inner, index));\n }\n\n /**\n * @dev Return the entire set in an array\n *\n * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed\n * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that\n * this function has an unbounded cost, and using it as part of a state-changing function may render the function\n * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.\n */\n function values(UintSet storage set) internal view returns (uint256[] memory) {\n bytes32[] memory store = _values(set._inner);\n uint256[] memory result;\n\n assembly {\n result := store\n }\n\n return result;\n }\n}\n" - }, - "solidity/contracts/peripherals/Keep3rRoles.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../../interfaces/peripherals/IKeep3rRoles.sol';\nimport '@openzeppelin/contracts/utils/structs/EnumerableSet.sol';\nimport './DustCollector.sol';\nimport './Governable.sol';\n\ncontract Keep3rRoles is IKeep3rRoles, Governable, DustCollector {\n /// @inheritdoc IKeep3rRoles\n mapping(address => bool) public override slashers;\n\n /// @inheritdoc IKeep3rRoles\n mapping(address => bool) public override disputers;\n\n constructor(address _governance) Governable(_governance) DustCollector() {}\n\n /// @inheritdoc IKeep3rRoles\n function addSlasher(address _slasher) external override onlyGovernance {\n if (_slasher == address(0)) revert ZeroAddress();\n if (slashers[_slasher]) revert SlasherExistent();\n slashers[_slasher] = true;\n emit SlasherAdded(_slasher);\n }\n\n /// @inheritdoc IKeep3rRoles\n function removeSlasher(address _slasher) external override onlyGovernance {\n if (!slashers[_slasher]) revert SlasherUnexistent();\n delete slashers[_slasher];\n emit SlasherRemoved(_slasher);\n }\n\n /// @inheritdoc IKeep3rRoles\n function addDisputer(address _disputer) external override onlyGovernance {\n if (_disputer == address(0)) revert ZeroAddress();\n if (disputers[_disputer]) revert DisputerExistent();\n disputers[_disputer] = true;\n emit DisputerAdded(_disputer);\n }\n\n /// @inheritdoc IKeep3rRoles\n function removeDisputer(address _disputer) external override onlyGovernance {\n if (!disputers[_disputer]) revert DisputerUnexistent();\n delete disputers[_disputer];\n emit DisputerRemoved(_disputer);\n }\n\n /// @notice Functions with this modifier can only be called by either a slasher or governance\n modifier onlySlasher {\n if (!slashers[msg.sender]) revert OnlySlasher();\n _;\n }\n\n /// @notice Functions with this modifier can only be called by either a disputer or governance\n modifier onlyDisputer {\n if (!disputers[msg.sender]) revert OnlyDisputer();\n _;\n }\n}\n" - }, - "solidity/contracts/peripherals/Governable.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../../interfaces/peripherals/IGovernable.sol';\n\nabstract contract Governable is IGovernable {\n /// @inheritdoc IGovernable\n address public override governance;\n\n /// @inheritdoc IGovernable\n address public override pendingGovernance;\n\n constructor(address _governance) {\n if (_governance == address(0)) revert NoGovernanceZeroAddress();\n governance = _governance;\n }\n\n /// @inheritdoc IGovernable\n function setGovernance(address _governance) external override onlyGovernance {\n pendingGovernance = _governance;\n emit GovernanceProposal(_governance);\n }\n\n /// @inheritdoc IGovernable\n function acceptGovernance() external override onlyPendingGovernance {\n governance = pendingGovernance;\n delete pendingGovernance;\n emit GovernanceSet(governance);\n }\n\n /// @notice Functions with this modifier can only be called by governance\n modifier onlyGovernance {\n if (msg.sender != governance) revert OnlyGovernance();\n _;\n }\n\n /// @notice Functions with this modifier can only be called by pendingGovernance\n modifier onlyPendingGovernance {\n if (msg.sender != pendingGovernance) revert OnlyPendingGovernance();\n _;\n }\n}\n" - }, - "@openzeppelin/contracts/token/ERC20/IERC20.sol": { - "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Interface of the ERC20 standard as defined in the EIP.\n */\ninterface IERC20 {\n /**\n * @dev Returns the amount of tokens in existence.\n */\n function totalSupply() external view returns (uint256);\n\n /**\n * @dev Returns the amount of tokens owned by `account`.\n */\n function balanceOf(address account) external view returns (uint256);\n\n /**\n * @dev Moves `amount` tokens from the caller's account to `recipient`.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * Emits a {Transfer} event.\n */\n function transfer(address recipient, uint256 amount) external returns (bool);\n\n /**\n * @dev Returns the remaining number of tokens that `spender` will be\n * allowed to spend on behalf of `owner` through {transferFrom}. This is\n * zero by default.\n *\n * This value changes when {approve} or {transferFrom} are called.\n */\n function allowance(address owner, address spender) external view returns (uint256);\n\n /**\n * @dev Sets `amount` as the allowance of `spender` over the caller's tokens.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * IMPORTANT: Beware that changing an allowance with this method brings the risk\n * that someone may use both the old and the new allowance by unfortunate\n * transaction ordering. One possible solution to mitigate this race\n * condition is to first reduce the spender's allowance to 0 and set the\n * desired value afterwards:\n * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729\n *\n * Emits an {Approval} event.\n */\n function approve(address spender, uint256 amount) external returns (bool);\n\n /**\n * @dev Moves `amount` tokens from `sender` to `recipient` using the\n * allowance mechanism. `amount` is then deducted from the caller's\n * allowance.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * Emits a {Transfer} event.\n */\n function transferFrom(\n address sender,\n address recipient,\n uint256 amount\n ) external returns (bool);\n\n /**\n * @dev Emitted when `value` tokens are moved from one account (`from`) to\n * another (`to`).\n *\n * Note that `value` may be zero.\n */\n event Transfer(address indexed from, address indexed to, uint256 value);\n\n /**\n * @dev Emitted when the allowance of a `spender` for an `owner` is set by\n * a call to {approve}. `value` is the new allowance.\n */\n event Approval(address indexed owner, address indexed spender, uint256 value);\n}\n" - }, - "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol": { - "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\nimport \"../IERC20.sol\";\nimport \"../../../utils/Address.sol\";\n\n/**\n * @title SafeERC20\n * @dev Wrappers around ERC20 operations that throw on failure (when the token\n * contract returns false). Tokens that return no value (and instead revert or\n * throw on failure) are also supported, non-reverting calls are assumed to be\n * successful.\n * To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract,\n * which allows you to call the safe operations as `token.safeTransfer(...)`, etc.\n */\nlibrary SafeERC20 {\n using Address for address;\n\n function safeTransfer(\n IERC20 token,\n address to,\n uint256 value\n ) internal {\n _callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value));\n }\n\n function safeTransferFrom(\n IERC20 token,\n address from,\n address to,\n uint256 value\n ) internal {\n _callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value));\n }\n\n /**\n * @dev Deprecated. This function has issues similar to the ones found in\n * {IERC20-approve}, and its usage is discouraged.\n *\n * Whenever possible, use {safeIncreaseAllowance} and\n * {safeDecreaseAllowance} instead.\n */\n function safeApprove(\n IERC20 token,\n address spender,\n uint256 value\n ) internal {\n // safeApprove should only be called when setting an initial allowance,\n // or when resetting it to zero. To increase and decrease it, use\n // 'safeIncreaseAllowance' and 'safeDecreaseAllowance'\n require(\n (value == 0) || (token.allowance(address(this), spender) == 0),\n \"SafeERC20: approve from non-zero to non-zero allowance\"\n );\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value));\n }\n\n function safeIncreaseAllowance(\n IERC20 token,\n address spender,\n uint256 value\n ) internal {\n uint256 newAllowance = token.allowance(address(this), spender) + value;\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));\n }\n\n function safeDecreaseAllowance(\n IERC20 token,\n address spender,\n uint256 value\n ) internal {\n unchecked {\n uint256 oldAllowance = token.allowance(address(this), spender);\n require(oldAllowance >= value, \"SafeERC20: decreased allowance below zero\");\n uint256 newAllowance = oldAllowance - value;\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));\n }\n }\n\n /**\n * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement\n * on the return value: the return value is optional (but if data is returned, it must not be false).\n * @param token The token targeted by the call.\n * @param data The call data (encoded using abi.encode or one of its variants).\n */\n function _callOptionalReturn(IERC20 token, bytes memory data) private {\n // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since\n // we're implementing it ourselves. We use {Address.functionCall} to perform this call, which verifies that\n // the target address contains contract code and also asserts for success in the low-level call.\n\n bytes memory returndata = address(token).functionCall(data, \"SafeERC20: low-level call failed\");\n if (returndata.length > 0) {\n // Return data is optional\n require(abi.decode(returndata, (bool)), \"SafeERC20: ERC20 operation did not succeed\");\n }\n }\n}\n" - }, - "@openzeppelin/contracts/utils/Address.sol": { - "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Collection of functions related to the address type\n */\nlibrary Address {\n /**\n * @dev Returns true if `account` is a contract.\n *\n * [IMPORTANT]\n * ====\n * It is unsafe to assume that an address for which this function returns\n * false is an externally-owned account (EOA) and not a contract.\n *\n * Among others, `isContract` will return false for the following\n * types of addresses:\n *\n * - an externally-owned account\n * - a contract in construction\n * - an address where a contract will be created\n * - an address where a contract lived, but was destroyed\n * ====\n */\n function isContract(address account) internal view returns (bool) {\n // This method relies on extcodesize, which returns 0 for contracts in\n // construction, since the code is only stored at the end of the\n // constructor execution.\n\n uint256 size;\n assembly {\n size := extcodesize(account)\n }\n return size > 0;\n }\n\n /**\n * @dev Replacement for Solidity's `transfer`: sends `amount` wei to\n * `recipient`, forwarding all available gas and reverting on errors.\n *\n * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost\n * of certain opcodes, possibly making contracts go over the 2300 gas limit\n * imposed by `transfer`, making them unable to receive funds via\n * `transfer`. {sendValue} removes this limitation.\n *\n * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].\n *\n * IMPORTANT: because control is transferred to `recipient`, care must be\n * taken to not create reentrancy vulnerabilities. Consider using\n * {ReentrancyGuard} or the\n * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].\n */\n function sendValue(address payable recipient, uint256 amount) internal {\n require(address(this).balance >= amount, \"Address: insufficient balance\");\n\n (bool success, ) = recipient.call{value: amount}(\"\");\n require(success, \"Address: unable to send value, recipient may have reverted\");\n }\n\n /**\n * @dev Performs a Solidity function call using a low level `call`. A\n * plain `call` is an unsafe replacement for a function call: use this\n * function instead.\n *\n * If `target` reverts with a revert reason, it is bubbled up by this\n * function (like regular Solidity function calls).\n *\n * Returns the raw returned data. To convert to the expected return value,\n * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\n *\n * Requirements:\n *\n * - `target` must be a contract.\n * - calling `target` with `data` must not revert.\n *\n * _Available since v3.1._\n */\n function functionCall(address target, bytes memory data) internal returns (bytes memory) {\n return functionCall(target, data, \"Address: low-level call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with\n * `errorMessage` as a fallback revert reason when `target` reverts.\n *\n * _Available since v3.1._\n */\n function functionCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal returns (bytes memory) {\n return functionCallWithValue(target, data, 0, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but also transferring `value` wei to `target`.\n *\n * Requirements:\n *\n * - the calling contract must have an ETH balance of at least `value`.\n * - the called Solidity function must be `payable`.\n *\n * _Available since v3.1._\n */\n function functionCallWithValue(\n address target,\n bytes memory data,\n uint256 value\n ) internal returns (bytes memory) {\n return functionCallWithValue(target, data, value, \"Address: low-level call with value failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but\n * with `errorMessage` as a fallback revert reason when `target` reverts.\n *\n * _Available since v3.1._\n */\n function functionCallWithValue(\n address target,\n bytes memory data,\n uint256 value,\n string memory errorMessage\n ) internal returns (bytes memory) {\n require(address(this).balance >= value, \"Address: insufficient balance for call\");\n require(isContract(target), \"Address: call to non-contract\");\n\n (bool success, bytes memory returndata) = target.call{value: value}(data);\n return verifyCallResult(success, returndata, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but performing a static call.\n *\n * _Available since v3.3._\n */\n function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\n return functionStaticCall(target, data, \"Address: low-level static call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\n * but performing a static call.\n *\n * _Available since v3.3._\n */\n function functionStaticCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal view returns (bytes memory) {\n require(isContract(target), \"Address: static call to non-contract\");\n\n (bool success, bytes memory returndata) = target.staticcall(data);\n return verifyCallResult(success, returndata, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but performing a delegate call.\n *\n * _Available since v3.4._\n */\n function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {\n return functionDelegateCall(target, data, \"Address: low-level delegate call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\n * but performing a delegate call.\n *\n * _Available since v3.4._\n */\n function functionDelegateCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal returns (bytes memory) {\n require(isContract(target), \"Address: delegate call to non-contract\");\n\n (bool success, bytes memory returndata) = target.delegatecall(data);\n return verifyCallResult(success, returndata, errorMessage);\n }\n\n /**\n * @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the\n * revert reason using the provided one.\n *\n * _Available since v4.3._\n */\n function verifyCallResult(\n bool success,\n bytes memory returndata,\n string memory errorMessage\n ) internal pure returns (bytes memory) {\n if (success) {\n return returndata;\n } else {\n // Look for revert reason and bubble it up if present\n if (returndata.length > 0) {\n // The easiest way to bubble the revert reason is using memory via assembly\n\n assembly {\n let returndata_size := mload(returndata)\n revert(add(32, returndata), returndata_size)\n }\n } else {\n revert(errorMessage);\n }\n }\n }\n}\n" - }, - "solidity/contracts/peripherals/jobs/Keep3rJobMigration.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../../../interfaces/peripherals/IKeep3rJobs.sol';\nimport './Keep3rJobFundableCredits.sol';\nimport './Keep3rJobFundableLiquidity.sol';\n\nabstract contract Keep3rJobMigration is IKeep3rJobMigration, Keep3rJobFundableCredits, Keep3rJobFundableLiquidity {\n using EnumerableSet for EnumerableSet.AddressSet;\n\n uint256 internal constant _MIGRATION_COOLDOWN = 1 minutes;\n\n /// @inheritdoc IKeep3rJobMigration\n mapping(address => address) public override pendingJobMigrations;\n mapping(address => mapping(address => uint256)) internal _migrationCreatedAt;\n\n /// @inheritdoc IKeep3rJobMigration\n function migrateJob(address _fromJob, address _toJob) external override onlyJobOwner(_fromJob) {\n if (_fromJob == _toJob) revert JobMigrationImpossible();\n\n pendingJobMigrations[_fromJob] = _toJob;\n _migrationCreatedAt[_fromJob][_toJob] = block.timestamp;\n\n emit JobMigrationRequested(_fromJob, _toJob);\n }\n\n /// @inheritdoc IKeep3rJobMigration\n function acceptJobMigration(address _fromJob, address _toJob) external override onlyJobOwner(_toJob) {\n if (disputes[_fromJob] || disputes[_toJob]) revert JobDisputed();\n if (pendingJobMigrations[_fromJob] != _toJob) revert JobMigrationUnavailable();\n if (block.timestamp < _migrationCreatedAt[_fromJob][_toJob] + _MIGRATION_COOLDOWN) revert JobMigrationLocked();\n\n // force job credits update for both jobs\n _settleJobAccountance(_fromJob);\n _settleJobAccountance(_toJob);\n\n // migrate tokens\n while (_jobTokens[_fromJob].length() > 0) {\n address _tokenToMigrate = _jobTokens[_fromJob].at(0);\n jobTokenCredits[_toJob][_tokenToMigrate] += jobTokenCredits[_fromJob][_tokenToMigrate];\n delete jobTokenCredits[_fromJob][_tokenToMigrate];\n _jobTokens[_fromJob].remove(_tokenToMigrate);\n _jobTokens[_toJob].add(_tokenToMigrate);\n }\n\n // migrate liquidities\n while (_jobLiquidities[_fromJob].length() > 0) {\n address _liquidity = _jobLiquidities[_fromJob].at(0);\n\n liquidityAmount[_toJob][_liquidity] += liquidityAmount[_fromJob][_liquidity];\n delete liquidityAmount[_fromJob][_liquidity];\n\n _jobLiquidities[_toJob].add(_liquidity);\n _jobLiquidities[_fromJob].remove(_liquidity);\n }\n\n // migrate job balances\n _jobPeriodCredits[_toJob] += _jobPeriodCredits[_fromJob];\n delete _jobPeriodCredits[_fromJob];\n\n _jobLiquidityCredits[_toJob] += _jobLiquidityCredits[_fromJob];\n delete _jobLiquidityCredits[_fromJob];\n\n // stop _fromJob from being a job\n delete rewardedAt[_fromJob];\n _jobs.remove(_fromJob);\n\n // delete unused data slots\n delete jobOwner[_fromJob];\n delete jobPendingOwner[_fromJob];\n delete _migrationCreatedAt[_fromJob][_toJob];\n delete pendingJobMigrations[_fromJob];\n\n emit JobMigrationSuccessful(_fromJob, _toJob);\n }\n}\n" - }, - "solidity/interfaces/IKeep3rHelper.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport './IKeep3rHelperParameters.sol';\n\n/// @title Keep3rHelper contract\n/// @notice Contains all the helper functions used throughout the different files.\ninterface IKeep3rHelper is IKeep3rHelperParameters {\n // Errors\n\n /// @notice Throws when none of the tokens in the liquidity pair is KP3R\n error LiquidityPairInvalid();\n\n // Methods\n // solhint-enable func-name-mixedcase\n\n /// @notice Calculates the amount of KP3R that corresponds to the ETH passed into the function\n /// @dev This function allows us to calculate how much KP3R we should pay to a keeper for things expressed in ETH, like gas\n /// @param _eth The amount of ETH\n /// @return _amountOut The amount of KP3R\n function quote(uint256 _eth) external view returns (uint256 _amountOut);\n\n /// @notice Returns the amount of KP3R the keeper has bonded\n /// @param _keeper The address of the keeper to check\n /// @return _amountBonded The amount of KP3R the keeper has bonded\n function bonds(address _keeper) external view returns (uint256 _amountBonded);\n\n /// @notice Calculates the reward (in KP3R) that corresponds to a keeper for using gas\n /// @param _keeper The address of the keeper to check\n /// @param _gasUsed The amount of gas used that will be rewarded\n /// @return _kp3r The amount of KP3R that should be awarded to the keeper\n function getRewardAmountFor(address _keeper, uint256 _gasUsed) external view returns (uint256 _kp3r);\n\n /// @notice Calculates the boost in the reward given to a keeper based on the amount of KP3R that keeper has bonded\n /// @dev If the keeper has no bonds, boost should be +10% of gas cost, if keeper has max bonds, +20%\n /// @param _bonds The amount of KP3R tokens bonded by the keeper\n /// @return _rewardBoost The reward boost that corresponds to the keeper\n function getRewardBoostFor(uint256 _bonds) external view returns (uint256 _rewardBoost);\n\n /// @notice Calculates the reward (in KP3R) that corresponds to tx.origin for using gas\n /// @param _gasUsed The amount of gas used that will be rewarded\n /// @return _amount The amount of KP3R that should be awarded to tx.origin\n function getRewardAmount(uint256 _gasUsed) external view returns (uint256 _amount);\n\n /// @notice Given a pool address, returns the underlying tokens of the pair\n /// @param _pool Address of the correspondant pool\n /// @return _token0 Address of the first token of the pair\n /// @return _token1 Address of the second token of the pair\n function getPoolTokens(address _pool) external view returns (address _token0, address _token1);\n\n /// @notice Defines the order of the tokens in the pair for twap calculations\n /// @param _pool Address of the correspondant pool\n /// @return _isKP3RToken0 Boolean indicating the order of the tokens in the pair\n function isKP3RToken0(address _pool) external view returns (bool _isKP3RToken0);\n\n /// @notice Given an array of secondsAgo, returns UniswapV3 pool cumulatives at that moment\n /// @param _pool Address of the pool to observe\n /// @param _secondsAgo Array with time references to observe\n /// @return _tickCumulative1 Cumulative sum of ticks until first time reference\n /// @return _tickCumulative2 Cumulative sum of ticks until second time reference\n /// @return _success Boolean indicating if the observe call was succesfull\n function observe(address _pool, uint32[] memory _secondsAgo)\n external\n view\n returns (\n int56 _tickCumulative1,\n int56 _tickCumulative2,\n bool _success\n );\n\n /// @notice Get multiplier, quote, and extra, in order to calculate keeper payment\n /// @param _bonds Amount of bonded KP3R owned by the keeper\n /// @return _boost Multiplier per gas unit. Takes into account the base fee and the amount of bonded KP3R\n /// @return _oneEthQuote Amount of KP3R tokens equivalent to 1 ETH\n /// @return _extra Amount of extra gas that should be added to the gas spent\n function getPaymentParams(uint256 _bonds)\n external\n view\n returns (\n uint256 _boost,\n uint256 _oneEthQuote,\n uint256 _extra\n );\n\n /// @notice Given a tick and a liquidity amount, calculates the underlying KP3R tokens\n /// @param _liquidityAmount Amount of liquidity to be converted\n /// @param _tickDifference Tick value used to calculate the quote\n /// @param _timeInterval Time value used to calculate the quote\n /// @return _kp3rAmount Amount of KP3R tokens underlying on the given liquidity\n function getKP3RsAtTick(\n uint256 _liquidityAmount,\n int56 _tickDifference,\n uint256 _timeInterval\n ) external pure returns (uint256 _kp3rAmount);\n\n /// @notice Given a tick and a token amount, calculates the output in correspondant token\n /// @param _baseAmount Amount of token to be converted\n /// @param _tickDifference Tick value used to calculate the quote\n /// @param _timeInterval Time value used to calculate the quote\n /// @return _quoteAmount Amount of credits deserved for the baseAmount at the tick value\n function getQuoteAtTick(\n uint128 _baseAmount,\n int56 _tickDifference,\n uint256 _timeInterval\n ) external pure returns (uint256 _quoteAmount);\n}\n" - }, - "solidity/contracts/peripherals/jobs/Keep3rJobFundableCredits.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport './Keep3rJobOwnership.sol';\nimport '../Keep3rAccountance.sol';\nimport '../Keep3rParameters.sol';\nimport '../../../interfaces/peripherals/IKeep3rJobs.sol';\n\nimport '@openzeppelin/contracts/security/ReentrancyGuard.sol';\nimport '@openzeppelin/contracts/token/ERC20/IERC20.sol';\nimport '@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol';\nimport '@openzeppelin/contracts/utils/math/Math.sol';\n\nabstract contract Keep3rJobFundableCredits is IKeep3rJobFundableCredits, ReentrancyGuard, Keep3rJobOwnership, Keep3rParameters {\n using EnumerableSet for EnumerableSet.AddressSet;\n using SafeERC20 for IERC20;\n\n /// @notice Cooldown between withdrawals\n uint256 internal constant _WITHDRAW_TOKENS_COOLDOWN = 1 minutes;\n\n /// @inheritdoc IKeep3rJobFundableCredits\n mapping(address => mapping(address => uint256)) public override jobTokenCreditsAddedAt;\n\n /// @inheritdoc IKeep3rJobFundableCredits\n function addTokenCreditsToJob(\n address _job,\n address _token,\n uint256 _amount\n ) external override nonReentrant {\n if (!_jobs.contains(_job)) revert JobUnavailable();\n // KP3R shouldn't be used for direct token payments\n if (_token == keep3rV1) revert TokenUnallowed();\n uint256 _before = IERC20(_token).balanceOf(address(this));\n IERC20(_token).safeTransferFrom(msg.sender, address(this), _amount);\n uint256 _received = IERC20(_token).balanceOf(address(this)) - _before;\n uint256 _tokenFee = (_received * fee) / _BASE;\n jobTokenCredits[_job][_token] += _received - _tokenFee;\n jobTokenCreditsAddedAt[_job][_token] = block.timestamp;\n IERC20(_token).safeTransfer(governance, _tokenFee);\n _jobTokens[_job].add(_token);\n\n emit TokenCreditAddition(_job, _token, msg.sender, _received);\n }\n\n /// @inheritdoc IKeep3rJobFundableCredits\n function withdrawTokenCreditsFromJob(\n address _job,\n address _token,\n uint256 _amount,\n address _receiver\n ) external override nonReentrant onlyJobOwner(_job) {\n if (block.timestamp <= jobTokenCreditsAddedAt[_job][_token] + _WITHDRAW_TOKENS_COOLDOWN) revert JobTokenCreditsLocked();\n if (jobTokenCredits[_job][_token] < _amount) revert InsufficientJobTokenCredits();\n if (disputes[_job]) revert JobDisputed();\n\n jobTokenCredits[_job][_token] -= _amount;\n IERC20(_token).safeTransfer(_receiver, _amount);\n\n if (jobTokenCredits[_job][_token] == 0) {\n _jobTokens[_job].remove(_token);\n }\n\n emit TokenCreditWithdrawal(_job, _token, _receiver, _amount);\n }\n}\n" - }, - "solidity/contracts/peripherals/jobs/Keep3rJobFundableLiquidity.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport './Keep3rJobOwnership.sol';\nimport '../Keep3rAccountance.sol';\nimport '../Keep3rParameters.sol';\nimport '../../../interfaces/IPairManager.sol';\nimport '../../../interfaces/peripherals/IKeep3rJobs.sol';\n\nimport '../../libraries/FullMath.sol';\n\nimport '@openzeppelin/contracts/security/ReentrancyGuard.sol';\nimport '@openzeppelin/contracts/token/ERC20/IERC20.sol';\nimport '@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol';\nimport '@openzeppelin/contracts/utils/math/Math.sol';\n\nabstract contract Keep3rJobFundableLiquidity is IKeep3rJobFundableLiquidity, ReentrancyGuard, Keep3rJobOwnership, Keep3rParameters {\n using EnumerableSet for EnumerableSet.AddressSet;\n using SafeERC20 for IERC20;\n\n /// @notice List of liquidities that are accepted in the system\n EnumerableSet.AddressSet internal _approvedLiquidities;\n\n /// @inheritdoc IKeep3rJobFundableLiquidity\n mapping(address => mapping(address => uint256)) public override liquidityAmount;\n\n /// @inheritdoc IKeep3rJobFundableLiquidity\n mapping(address => uint256) public override rewardedAt;\n\n /// @inheritdoc IKeep3rJobFundableLiquidity\n mapping(address => uint256) public override workedAt;\n\n /// @notice Tracks an address and returns its TickCache\n mapping(address => TickCache) internal _tick;\n\n // Views\n\n /// @inheritdoc IKeep3rJobFundableLiquidity\n function approvedLiquidities() external view override returns (address[] memory _list) {\n _list = _approvedLiquidities.values();\n }\n\n /// @inheritdoc IKeep3rJobFundableLiquidity\n function jobPeriodCredits(address _job) public view override returns (uint256 _periodCredits) {\n for (uint256 i; i < _jobLiquidities[_job].length(); i++) {\n address _liquidity = _jobLiquidities[_job].at(i);\n if (_approvedLiquidities.contains(_liquidity)) {\n TickCache memory _tickCache = observeLiquidity(_liquidity);\n if (_tickCache.period != 0) {\n int56 _tickDifference = _isKP3RToken0[_liquidity] ? _tickCache.difference : -_tickCache.difference;\n _periodCredits += _getReward(\n IKeep3rHelper(keep3rHelper).getKP3RsAtTick(liquidityAmount[_job][_liquidity], _tickDifference, rewardPeriodTime)\n );\n }\n }\n }\n }\n\n /// @inheritdoc IKeep3rJobFundableLiquidity\n function jobLiquidityCredits(address _job) public view override returns (uint256 _liquidityCredits) {\n uint256 _periodCredits = jobPeriodCredits(_job);\n\n // If the job was rewarded in the past 1 period time\n if ((block.timestamp - rewardedAt[_job]) < rewardPeriodTime) {\n // If the job has period credits, update minted job credits to new twap\n _liquidityCredits = _periodCredits > 0\n ? (_jobLiquidityCredits[_job] * _periodCredits) / _jobPeriodCredits[_job] // If the job has period credits, return remaining job credits updated to new twap\n : _jobLiquidityCredits[_job]; // If not, return remaining credits, forced credits should not be updated\n } else {\n // Else return a full period worth of credits if current credits have expired\n _liquidityCredits = _periodCredits;\n }\n }\n\n /// @inheritdoc IKeep3rJobFundableLiquidity\n function totalJobCredits(address _job) external view override returns (uint256 _credits) {\n uint256 _periodCredits = jobPeriodCredits(_job);\n uint256 _cooldown = block.timestamp;\n\n if ((rewardedAt[_job] > _period(block.timestamp - rewardPeriodTime))) {\n // Will calculate cooldown if it outdated\n if ((block.timestamp - rewardedAt[_job]) >= rewardPeriodTime) {\n // Will calculate cooldown from last reward reference in this period\n _cooldown -= (rewardedAt[_job] + rewardPeriodTime);\n } else {\n // Will calculate cooldown from last reward timestamp\n _cooldown -= rewardedAt[_job];\n }\n } else {\n // Will calculate cooldown from period start if expired\n _cooldown -= _period(block.timestamp);\n }\n _credits = jobLiquidityCredits(_job) + _phase(_cooldown, _periodCredits);\n }\n\n /// @inheritdoc IKeep3rJobFundableLiquidity\n function quoteLiquidity(address _liquidity, uint256 _amount) external view override returns (uint256 _periodCredits) {\n if (_approvedLiquidities.contains(_liquidity)) {\n TickCache memory _tickCache = observeLiquidity(_liquidity);\n if (_tickCache.period != 0) {\n int56 _tickDifference = _isKP3RToken0[_liquidity] ? _tickCache.difference : -_tickCache.difference;\n return _getReward(IKeep3rHelper(keep3rHelper).getKP3RsAtTick(_amount, _tickDifference, rewardPeriodTime));\n }\n }\n }\n\n /// @inheritdoc IKeep3rJobFundableLiquidity\n function observeLiquidity(address _liquidity) public view virtual override returns (TickCache memory _tickCache) {\n if (_tick[_liquidity].period == _period(block.timestamp)) {\n // Will return cached twaps if liquidity is updated\n _tickCache = _tick[_liquidity];\n } else {\n bool success;\n uint256 lastPeriod = _period(block.timestamp - rewardPeriodTime);\n\n if (_tick[_liquidity].period == lastPeriod) {\n // Will only ask for current period accumulator if liquidity is outdated\n uint32[] memory _secondsAgo = new uint32[](1);\n int56 previousTick = _tick[_liquidity].current;\n\n _secondsAgo[0] = uint32(block.timestamp - _period(block.timestamp));\n\n (_tickCache.current, , success) = IKeep3rHelper(keep3rHelper).observe(_liquidityPool[_liquidity], _secondsAgo);\n\n _tickCache.difference = _tickCache.current - previousTick;\n } else if (_tick[_liquidity].period < lastPeriod) {\n // Will ask for 2 accumulators if liquidity is expired\n uint32[] memory _secondsAgo = new uint32[](2);\n\n _secondsAgo[0] = uint32(block.timestamp - _period(block.timestamp));\n _secondsAgo[1] = uint32(block.timestamp - _period(block.timestamp) + rewardPeriodTime);\n\n int56 _tickCumulative2;\n (_tickCache.current, _tickCumulative2, success) = IKeep3rHelper(keep3rHelper).observe(_liquidityPool[_liquidity], _secondsAgo);\n\n _tickCache.difference = _tickCache.current - _tickCumulative2;\n }\n if (success) {\n _tickCache.period = _period(block.timestamp);\n } else {\n delete _tickCache.period;\n }\n }\n }\n\n // Methods\n\n /// @inheritdoc IKeep3rJobFundableLiquidity\n function forceLiquidityCreditsToJob(address _job, uint256 _amount) external override onlyGovernance {\n if (!_jobs.contains(_job)) revert JobUnavailable();\n _settleJobAccountance(_job);\n _jobLiquidityCredits[_job] += _amount;\n emit LiquidityCreditsForced(_job, rewardedAt[_job], _jobLiquidityCredits[_job]);\n }\n\n /// @inheritdoc IKeep3rJobFundableLiquidity\n function approveLiquidity(address _liquidity) external virtual override onlyGovernance {\n if (!_approvedLiquidities.add(_liquidity)) revert LiquidityPairApproved();\n _liquidityPool[_liquidity] = IPairManager(_liquidity).pool();\n _isKP3RToken0[_liquidity] = IKeep3rHelper(keep3rHelper).isKP3RToken0(_liquidityPool[_liquidity]);\n _tick[_liquidity] = observeLiquidity(_liquidity);\n emit LiquidityApproval(_liquidity);\n }\n\n /// @inheritdoc IKeep3rJobFundableLiquidity\n function revokeLiquidity(address _liquidity) external override onlyGovernance {\n if (!_approvedLiquidities.remove(_liquidity)) revert LiquidityPairUnexistent();\n delete _liquidityPool[_liquidity];\n delete _isKP3RToken0[_liquidity];\n delete _tick[_liquidity];\n\n emit LiquidityRevocation(_liquidity);\n }\n\n /// @inheritdoc IKeep3rJobFundableLiquidity\n function addLiquidityToJob(\n address _job,\n address _liquidity,\n uint256 _amount\n ) external override nonReentrant {\n if (!_approvedLiquidities.contains(_liquidity)) revert LiquidityPairUnapproved();\n if (!_jobs.contains(_job)) revert JobUnavailable();\n\n _jobLiquidities[_job].add(_liquidity);\n\n _settleJobAccountance(_job);\n\n if (_quoteLiquidity(liquidityAmount[_job][_liquidity] + _amount, _liquidity) < liquidityMinimum) revert JobLiquidityLessThanMin();\n\n emit LiquidityCreditsReward(_job, rewardedAt[_job], _jobLiquidityCredits[_job], _jobPeriodCredits[_job]);\n\n IERC20(_liquidity).safeTransferFrom(msg.sender, address(this), _amount);\n liquidityAmount[_job][_liquidity] += _amount;\n _jobPeriodCredits[_job] += _getReward(_quoteLiquidity(_amount, _liquidity));\n emit LiquidityAddition(_job, _liquidity, msg.sender, _amount);\n }\n\n /// @inheritdoc IKeep3rJobFundableLiquidity\n function unbondLiquidityFromJob(\n address _job,\n address _liquidity,\n uint256 _amount\n ) external override onlyJobOwner(_job) {\n canWithdrawAfter[_job][_liquidity] = block.timestamp + unbondTime;\n pendingUnbonds[_job][_liquidity] += _amount;\n _unbondLiquidityFromJob(_job, _liquidity, _amount);\n\n uint256 _remainingLiquidity = liquidityAmount[_job][_liquidity];\n if (_remainingLiquidity > 0 && _quoteLiquidity(_remainingLiquidity, _liquidity) < liquidityMinimum) revert JobLiquidityLessThanMin();\n\n emit Unbonding(_job, _liquidity, _amount);\n }\n\n /// @inheritdoc IKeep3rJobFundableLiquidity\n function withdrawLiquidityFromJob(\n address _job,\n address _liquidity,\n address _receiver\n ) external override onlyJobOwner(_job) {\n if (_receiver == address(0)) revert ZeroAddress();\n if (pendingUnbonds[_job][_liquidity] == 0) revert UnbondsUnexistent();\n if (canWithdrawAfter[_job][_liquidity] >= block.timestamp) revert UnbondsLocked();\n if (disputes[_job]) revert Disputed();\n\n uint256 _amount = pendingUnbonds[_job][_liquidity];\n\n delete pendingUnbonds[_job][_liquidity];\n delete canWithdrawAfter[_job][_liquidity];\n\n IERC20(_liquidity).safeTransfer(_receiver, _amount);\n emit LiquidityWithdrawal(_job, _liquidity, _receiver, _amount);\n }\n\n // Internal functions\n\n /// @notice Updates or rewards job liquidity credits depending on time since last job reward\n function _updateJobCreditsIfNeeded(address _job) internal returns (bool _rewarded) {\n if (rewardedAt[_job] < _period(block.timestamp)) {\n // Will exit function if job has been rewarded in current period\n if (rewardedAt[_job] <= _period(block.timestamp - rewardPeriodTime)) {\n // Will reset job to period syncronicity if a full period passed without rewards\n _updateJobPeriod(_job);\n _jobLiquidityCredits[_job] = _jobPeriodCredits[_job];\n rewardedAt[_job] = _period(block.timestamp);\n _rewarded = true;\n } else if ((block.timestamp - rewardedAt[_job]) >= rewardPeriodTime) {\n // Will reset job's syncronicity if last reward was more than epoch ago\n _updateJobPeriod(_job);\n _jobLiquidityCredits[_job] = _jobPeriodCredits[_job];\n rewardedAt[_job] += rewardPeriodTime;\n _rewarded = true;\n } else if (workedAt[_job] < _period(block.timestamp)) {\n // First keeper on period has to update job accountance to current twaps\n uint256 previousPeriodCredits = _jobPeriodCredits[_job];\n _updateJobPeriod(_job);\n _jobLiquidityCredits[_job] = (_jobLiquidityCredits[_job] * _jobPeriodCredits[_job]) / previousPeriodCredits;\n // Updating job accountance does not reward job\n }\n }\n }\n\n /// @notice Only called if _jobLiquidityCredits < payment\n function _rewardJobCredits(address _job) internal {\n /// @notice Only way to += jobLiquidityCredits is when keeper rewarding (cannot pay work)\n /* WARNING: this allows to top up _jobLiquidityCredits to a max of 1.99 but have to spend at least 1 */\n _jobLiquidityCredits[_job] += _phase(block.timestamp - rewardedAt[_job], _jobPeriodCredits[_job]);\n rewardedAt[_job] = block.timestamp;\n }\n\n /// @notice Updates accountance for _jobPeriodCredits\n function _updateJobPeriod(address _job) internal {\n _jobPeriodCredits[_job] = _calculateJobPeriodCredits(_job);\n }\n\n /// @notice Quotes the outdated job liquidities and calculates _periodCredits\n /// @dev This function is also responsible for keeping the KP3R/WETH quote updated\n function _calculateJobPeriodCredits(address _job) internal returns (uint256 _periodCredits) {\n for (uint256 i; i < _jobLiquidities[_job].length(); i++) {\n address _liquidity = _jobLiquidities[_job].at(i);\n if (_approvedLiquidities.contains(_liquidity)) {\n if (_tick[_liquidity].period != _period(block.timestamp)) {\n // Updates liquidity cache only if needed\n _tick[_liquidity] = observeLiquidity(_liquidity);\n }\n _periodCredits += _getReward(_quoteLiquidity(liquidityAmount[_job][_liquidity], _liquidity));\n }\n }\n }\n\n /// @notice Updates job accountance calculating the impact of the unbonded liquidity amount\n function _unbondLiquidityFromJob(\n address _job,\n address _liquidity,\n uint256 _amount\n ) internal nonReentrant {\n if (!_jobLiquidities[_job].contains(_liquidity)) revert JobLiquidityUnexistent();\n if (liquidityAmount[_job][_liquidity] < _amount) revert JobLiquidityInsufficient();\n\n // Ensures current twaps in job liquidities\n _updateJobPeriod(_job);\n uint256 _periodCreditsToRemove = _getReward(_quoteLiquidity(_amount, _liquidity));\n\n // A liquidity can be revoked causing a job to have 0 periodCredits\n if (_jobPeriodCredits[_job] > 0) {\n // Removes a % correspondant to a full rewardPeriodTime for the liquidity withdrawn vs all of the liquidities\n _jobLiquidityCredits[_job] -= (_jobLiquidityCredits[_job] * _periodCreditsToRemove) / _jobPeriodCredits[_job];\n _jobPeriodCredits[_job] -= _periodCreditsToRemove;\n }\n\n liquidityAmount[_job][_liquidity] -= _amount;\n if (liquidityAmount[_job][_liquidity] == 0) {\n _jobLiquidities[_job].remove(_liquidity);\n }\n }\n\n /// @notice Returns a fraction of the multiplier or the whole multiplier if equal or more than a rewardPeriodTime has passed\n function _phase(uint256 _timePassed, uint256 _multiplier) internal view returns (uint256 _result) {\n if (_timePassed < rewardPeriodTime) {\n _result = (_timePassed * _multiplier) / rewardPeriodTime;\n } else _result = _multiplier;\n }\n\n /// @notice Returns the start of the period of the provided timestamp\n function _period(uint256 _timestamp) internal view returns (uint256 _periodTimestamp) {\n return _timestamp - (_timestamp % rewardPeriodTime);\n }\n\n /// @notice Calculates relation between rewardPeriod and inflationPeriod\n function _getReward(uint256 _baseAmount) internal view returns (uint256 _credits) {\n return FullMath.mulDiv(_baseAmount, rewardPeriodTime, inflationPeriod);\n }\n\n /// @notice Returns underlying KP3R amount for a given liquidity amount\n function _quoteLiquidity(uint256 _amount, address _liquidity) internal view returns (uint256 _quote) {\n if (_tick[_liquidity].period != 0) {\n int56 _tickDifference = _isKP3RToken0[_liquidity] ? _tick[_liquidity].difference : -_tick[_liquidity].difference;\n _quote = IKeep3rHelper(keep3rHelper).getKP3RsAtTick(_amount, _tickDifference, rewardPeriodTime);\n }\n }\n\n /// @notice Updates job credits to current quotes and rewards job's pending minted credits\n /// @dev Ensures a maximum of 1 period of credits\n function _settleJobAccountance(address _job) internal virtual {\n _updateJobCreditsIfNeeded(_job);\n _rewardJobCredits(_job);\n _jobLiquidityCredits[_job] = Math.min(_jobLiquidityCredits[_job], _jobPeriodCredits[_job]);\n }\n}\n" - }, - "solidity/contracts/peripherals/Keep3rParameters.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../../interfaces/IKeep3rHelper.sol';\nimport '../../interfaces/peripherals/IKeep3rParameters.sol';\nimport '../../interfaces/external/IKeep3rV1Proxy.sol';\nimport './Keep3rAccountance.sol';\n\nabstract contract Keep3rParameters is IKeep3rParameters, Keep3rAccountance {\n /// @inheritdoc IKeep3rParameters\n address public override keep3rV1;\n\n /// @inheritdoc IKeep3rParameters\n address public override keep3rV1Proxy;\n\n /// @inheritdoc IKeep3rParameters\n address public override keep3rHelper;\n\n /// @inheritdoc IKeep3rParameters\n uint256 public override bondTime = 3 days;\n\n /// @inheritdoc IKeep3rParameters\n uint256 public override unbondTime = 14 days;\n\n /// @inheritdoc IKeep3rParameters\n uint256 public override liquidityMinimum = 3 ether;\n\n /// @inheritdoc IKeep3rParameters\n uint256 public override rewardPeriodTime = 5 days;\n\n /// @inheritdoc IKeep3rParameters\n uint256 public override inflationPeriod = 34 days;\n\n /// @inheritdoc IKeep3rParameters\n uint256 public override fee = 30;\n\n /// @notice The base that will be used to calculate the fee\n uint256 internal constant _BASE = 10_000;\n\n /// @notice The minimum reward period\n uint256 internal constant _MIN_REWARD_PERIOD_TIME = 1 days;\n\n constructor(\n address _keep3rHelper,\n address _keep3rV1,\n address _keep3rV1Proxy\n ) {\n keep3rHelper = _keep3rHelper;\n keep3rV1 = _keep3rV1;\n keep3rV1Proxy = _keep3rV1Proxy;\n }\n\n /// @inheritdoc IKeep3rParameters\n function setKeep3rHelper(address _keep3rHelper) external override onlyGovernance {\n if (_keep3rHelper == address(0)) revert ZeroAddress();\n keep3rHelper = _keep3rHelper;\n emit Keep3rHelperChange(_keep3rHelper);\n }\n\n /// @inheritdoc IKeep3rParameters\n function setKeep3rV1(address _keep3rV1) public virtual override onlyGovernance {\n if (_keep3rV1 == address(0)) revert ZeroAddress();\n _mint(totalBonds);\n\n keep3rV1 = _keep3rV1;\n emit Keep3rV1Change(_keep3rV1);\n }\n\n /// @inheritdoc IKeep3rParameters\n function setKeep3rV1Proxy(address _keep3rV1Proxy) external override onlyGovernance {\n if (_keep3rV1Proxy == address(0)) revert ZeroAddress();\n keep3rV1Proxy = _keep3rV1Proxy;\n emit Keep3rV1ProxyChange(_keep3rV1Proxy);\n }\n\n /// @inheritdoc IKeep3rParameters\n function setBondTime(uint256 _bondTime) external override onlyGovernance {\n bondTime = _bondTime;\n emit BondTimeChange(_bondTime);\n }\n\n /// @inheritdoc IKeep3rParameters\n function setUnbondTime(uint256 _unbondTime) external override onlyGovernance {\n unbondTime = _unbondTime;\n emit UnbondTimeChange(_unbondTime);\n }\n\n /// @inheritdoc IKeep3rParameters\n function setLiquidityMinimum(uint256 _liquidityMinimum) external override onlyGovernance {\n liquidityMinimum = _liquidityMinimum;\n emit LiquidityMinimumChange(_liquidityMinimum);\n }\n\n /// @inheritdoc IKeep3rParameters\n function setRewardPeriodTime(uint256 _rewardPeriodTime) external override onlyGovernance {\n if (_rewardPeriodTime < _MIN_REWARD_PERIOD_TIME) revert MinRewardPeriod();\n rewardPeriodTime = _rewardPeriodTime;\n emit RewardPeriodTimeChange(_rewardPeriodTime);\n }\n\n /// @inheritdoc IKeep3rParameters\n function setInflationPeriod(uint256 _inflationPeriod) external override onlyGovernance {\n inflationPeriod = _inflationPeriod;\n emit InflationPeriodChange(_inflationPeriod);\n }\n\n /// @inheritdoc IKeep3rParameters\n function setFee(uint256 _fee) external override onlyGovernance {\n fee = _fee;\n emit FeeChange(_fee);\n }\n\n function _mint(uint256 _amount) internal {\n totalBonds -= _amount;\n IKeep3rV1Proxy(keep3rV1Proxy).mint(_amount);\n }\n}\n" - }, - "@openzeppelin/contracts/security/ReentrancyGuard.sol": { - "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Contract module that helps prevent reentrant calls to a function.\n *\n * Inheriting from `ReentrancyGuard` will make the {nonReentrant} modifier\n * available, which can be applied to functions to make sure there are no nested\n * (reentrant) calls to them.\n *\n * Note that because there is a single `nonReentrant` guard, functions marked as\n * `nonReentrant` may not call one another. This can be worked around by making\n * those functions `private`, and then adding `external` `nonReentrant` entry\n * points to them.\n *\n * TIP: If you would like to learn more about reentrancy and alternative ways\n * to protect against it, check out our blog post\n * https://blog.openzeppelin.com/reentrancy-after-istanbul/[Reentrancy After Istanbul].\n */\nabstract contract ReentrancyGuard {\n // Booleans are more expensive than uint256 or any type that takes up a full\n // word because each write operation emits an extra SLOAD to first read the\n // slot's contents, replace the bits taken up by the boolean, and then write\n // back. This is the compiler's defense against contract upgrades and\n // pointer aliasing, and it cannot be disabled.\n\n // The values being non-zero value makes deployment a bit more expensive,\n // but in exchange the refund on every call to nonReentrant will be lower in\n // amount. Since refunds are capped to a percentage of the total\n // transaction's gas, it is best to keep them low in cases like this one, to\n // increase the likelihood of the full refund coming into effect.\n uint256 private constant _NOT_ENTERED = 1;\n uint256 private constant _ENTERED = 2;\n\n uint256 private _status;\n\n constructor() {\n _status = _NOT_ENTERED;\n }\n\n /**\n * @dev Prevents a contract from calling itself, directly or indirectly.\n * Calling a `nonReentrant` function from another `nonReentrant`\n * function is not supported. It is possible to prevent this from happening\n * by making the `nonReentrant` function external, and make it call a\n * `private` function that does the actual work.\n */\n modifier nonReentrant() {\n // On the first call to nonReentrant, _notEntered will be true\n require(_status != _ENTERED, \"ReentrancyGuard: reentrant call\");\n\n // Any calls to nonReentrant after this point will fail\n _status = _ENTERED;\n\n _;\n\n // By storing the original value once again, a refund is triggered (see\n // https://eips.ethereum.org/EIPS/eip-2200)\n _status = _NOT_ENTERED;\n }\n}\n" - }, - "@openzeppelin/contracts/utils/math/Math.sol": { - "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Standard math utilities missing in the Solidity language.\n */\nlibrary Math {\n /**\n * @dev Returns the largest of two numbers.\n */\n function max(uint256 a, uint256 b) internal pure returns (uint256) {\n return a >= b ? a : b;\n }\n\n /**\n * @dev Returns the smallest of two numbers.\n */\n function min(uint256 a, uint256 b) internal pure returns (uint256) {\n return a < b ? a : b;\n }\n\n /**\n * @dev Returns the average of two numbers. The result is rounded towards\n * zero.\n */\n function average(uint256 a, uint256 b) internal pure returns (uint256) {\n // (a + b) / 2 can overflow.\n return (a & b) + (a ^ b) / 2;\n }\n\n /**\n * @dev Returns the ceiling of the division of two numbers.\n *\n * This differs from standard division with `/` in that it rounds up instead\n * of rounding down.\n */\n function ceilDiv(uint256 a, uint256 b) internal pure returns (uint256) {\n // (a + b - 1) / b can overflow on addition, so we distribute.\n return a / b + (a % b == 0 ? 0 : 1);\n }\n}\n" - }, - "solidity/interfaces/external/IKeep3rV1Proxy.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../peripherals/IGovernable.sol';\n\ninterface IKeep3rV1Proxy is IGovernable {\n // Structs\n struct Recipient {\n address recipient;\n uint256 caps;\n }\n\n // Variables\n function keep3rV1() external view returns (address);\n\n function minter() external view returns (address);\n\n function next(address) external view returns (uint256);\n\n function caps(address) external view returns (uint256);\n\n function recipients() external view returns (address[] memory);\n\n function recipientsCaps() external view returns (Recipient[] memory);\n\n // Errors\n error Cooldown();\n error NoDrawableAmount();\n error ZeroAddress();\n error OnlyMinter();\n\n // Methods\n function addRecipient(address recipient, uint256 amount) external;\n\n function removeRecipient(address recipient) external;\n\n function draw() external returns (uint256 _amount);\n\n function setKeep3rV1(address _keep3rV1) external;\n\n function setMinter(address _minter) external;\n\n function mint(uint256 _amount) external;\n\n function mint(address _account, uint256 _amount) external;\n\n function setKeep3rV1Governance(address _governance) external;\n\n function acceptKeep3rV1Governance() external;\n\n function dispute(address _keeper) external;\n\n function slash(\n address _bonded,\n address _keeper,\n uint256 _amount\n ) external;\n\n function revoke(address _keeper) external;\n\n function resolve(address _keeper) external;\n\n function addJob(address _job) external;\n\n function removeJob(address _job) external;\n\n function addKPRCredit(address _job, uint256 _amount) external;\n\n function approveLiquidity(address _liquidity) external;\n\n function revokeLiquidity(address _liquidity) external;\n\n function setKeep3rHelper(address _keep3rHelper) external;\n\n function addVotes(address _voter, uint256 _amount) external;\n\n function removeVotes(address _voter, uint256 _amount) external;\n}\n" - }, - "solidity/interfaces/IKeep3rHelperParameters.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\n/// @title Keep3rHelperParameters contract\n/// @notice Contains all the helper functions used throughout the different files.\ninterface IKeep3rHelperParameters {\n // Structs\n\n /// @dev KP3R-WETH Pool address and isKP3RToken0\n /// @dev Created in order to save gas by avoiding calls to pool's token0 method\n struct TokenOraclePool {\n address poolAddress;\n bool isTKNToken0;\n }\n\n // Errors\n\n /// @notice Throws when pool does not have KP3R as token0 nor token1\n error InvalidOraclePool();\n\n // Events\n\n /// @notice Emitted when the kp3r weth pool is changed\n /// @param _address Address of the new kp3r weth pool\n /// @param _isKP3RToken0 True if calling the token0 method of the pool returns the KP3R token address\n event Kp3rWethPoolChange(address _address, bool _isKP3RToken0);\n\n /// @notice Emitted when the minimum boost multiplier is changed\n /// @param _minBoost The minimum boost multiplier\n event MinBoostChange(uint256 _minBoost);\n\n /// @notice Emitted when the maximum boost multiplier is changed\n /// @param _maxBoost The maximum boost multiplier\n event MaxBoostChange(uint256 _maxBoost);\n\n /// @notice Emitted when the target bond amount is changed\n /// @param _targetBond The target bond amount\n event TargetBondChange(uint256 _targetBond);\n\n /// @notice Emitted when the Keep3r V2 address is changed\n /// @param _keep3rV2 The address of Keep3r V2\n event Keep3rV2Change(address _keep3rV2);\n\n /// @notice Emitted when the work extra gas amount is changed\n /// @param _workExtraGas The work extra gas\n event WorkExtraGasChange(uint256 _workExtraGas);\n\n /// @notice Emitted when the quote twap time is changed\n /// @param _quoteTwapTime The twap time for quoting\n event QuoteTwapTimeChange(uint32 _quoteTwapTime);\n\n /// @notice Emitted when minimum rewarded gas fee is changed\n /// @param _minBaseFee The minimum rewarded gas fee\n event MinBaseFeeChange(uint256 _minBaseFee);\n\n /// @notice Emitted when minimum rewarded priority fee is changed\n /// @param _minPriorityFee The minimum expected fee that the keeper should pay\n event MinPriorityFeeChange(uint256 _minPriorityFee);\n\n // Variables\n\n /// @notice Address of KP3R token\n /// @return _kp3r Address of KP3R token\n // solhint-disable func-name-mixedcase\n function KP3R() external view returns (address _kp3r);\n\n /// @notice The boost base used to calculate the boost rewards for the keeper\n /// @return _base The boost base number\n function BOOST_BASE() external view returns (uint256 _base);\n\n /// @notice KP3R-WETH pool that is being used as oracle\n /// @return poolAddress Address of the pool\n /// @return isTKNToken0 True if calling the token0 method of the pool returns the KP3R token address\n function kp3rWethPool() external view returns (address poolAddress, bool isTKNToken0);\n\n /// @notice The minimum multiplier used to calculate the amount of gas paid to the Keeper for the gas used to perform a job\n /// For example: if the quoted gas used is 1000, then the minimum amount to be paid will be 1000 * minBoost / BOOST_BASE\n /// @return _multiplier The minimum boost multiplier\n function minBoost() external view returns (uint256 _multiplier);\n\n /// @notice The maximum multiplier used to calculate the amount of gas paid to the Keeper for the gas used to perform a job\n /// For example: if the quoted gas used is 1000, then the maximum amount to be paid will be 1000 * maxBoost / BOOST_BASE\n /// @return _multiplier The maximum boost multiplier\n function maxBoost() external view returns (uint256 _multiplier);\n\n /// @notice The targeted amount of bonded KP3Rs to max-up reward multiplier\n /// For example: if the amount of KP3R the keeper has bonded is targetBond or more, then the keeper will get\n /// the maximum boost possible in his rewards, if it's less, the reward boost will be proportional\n /// @return _target The amount of KP3R that comforms the targetBond\n function targetBond() external view returns (uint256 _target);\n\n /// @notice The amount of unaccounted gas that is going to be added to keeper payments\n /// @return _workExtraGas The work unaccounted gas amount\n function workExtraGas() external view returns (uint256 _workExtraGas);\n\n /// @notice The twap time for quoting\n /// @return _quoteTwapTime The twap time\n function quoteTwapTime() external view returns (uint32 _quoteTwapTime);\n\n /// @notice The minimum base fee that is used to calculate keeper rewards\n /// @return _minBaseFee The minimum rewarded gas fee\n function minBaseFee() external view returns (uint256 _minBaseFee);\n\n /// @notice The minimum priority fee that is also rewarded for keepers\n /// @return _minPriorityFee The minimum rewarded priority fee\n function minPriorityFee() external view returns (uint256 _minPriorityFee);\n\n /// @notice Address of Keep3r V2\n /// @return _keep3rV2 Address of Keep3r V2\n function keep3rV2() external view returns (address _keep3rV2);\n\n // Methods\n\n /// @notice Sets KP3R-WETH pool\n /// @param _poolAddress The address of the KP3R-WETH pool\n function setKp3rWethPool(address _poolAddress) external;\n\n /// @notice Sets the minimum boost multiplier\n /// @param _minBoost The minimum boost multiplier\n function setMinBoost(uint256 _minBoost) external;\n\n /// @notice Sets the maximum boost multiplier\n /// @param _maxBoost The maximum boost multiplier\n function setMaxBoost(uint256 _maxBoost) external;\n\n /// @notice Sets the target bond amount\n /// @param _targetBond The target bond amount\n function setTargetBond(uint256 _targetBond) external;\n\n /// @notice Sets the Keep3r V2 address\n /// @param _keep3rV2 The address of Keep3r V2\n function setKeep3rV2(address _keep3rV2) external;\n\n /// @notice Sets the work extra gas amount\n /// @param _workExtraGas The work extra gas\n function setWorkExtraGas(uint256 _workExtraGas) external;\n\n /// @notice Sets the quote twap time\n /// @param _quoteTwapTime The twap time for quoting\n function setQuoteTwapTime(uint32 _quoteTwapTime) external;\n\n /// @notice Sets the minimum rewarded gas fee\n /// @param _minBaseFee The minimum rewarded gas fee\n function setMinBaseFee(uint256 _minBaseFee) external;\n\n /// @notice Sets the minimum rewarded gas priority fee\n /// @param _minPriorityFee The minimum rewarded priority fee\n function setMinPriorityFee(uint256 _minPriorityFee) external;\n}\n" - }, - "solidity/interfaces/IPairManager.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol';\n\n/// @title Pair Manager interface\n/// @notice Generic interface for Keep3r liquidity pools (kLP)\ninterface IPairManager is IERC20Metadata {\n /// @notice Address of the factory from which the pair manager was created\n /// @return _factory The address of the PairManager Factory\n function factory() external view returns (address _factory);\n\n /// @notice Address of the pool from which the Keep3r pair manager will interact with\n /// @return _pool The address of the pool\n function pool() external view returns (address _pool);\n\n /// @notice Token0 of the pool\n /// @return _token0 The address of token0\n function token0() external view returns (address _token0);\n\n /// @notice Token1 of the pool\n /// @return _token1 The address of token1\n function token1() external view returns (address _token1);\n}\n" - }, - "solidity/contracts/libraries/FullMath.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\n/// @title Contains 512-bit math functions\n/// @notice Facilitates multiplication and division that can have overflow of an intermediate value without any loss of precision\n/// @dev Handles \"phantom overflow\" i.e., allows multiplication and division where an intermediate value overflows 256 bits\nlibrary FullMath {\n /// @notice Calculates floor(a×b÷denominator) with full precision. Throws if result overflows a uint256 or denominator == 0\n /// @param a The multiplicand\n /// @param b The multiplier\n /// @param denominator The divisor\n /// @return result The 256-bit result\n /// @dev Credit to Remco Bloemen under MIT license https://xn--2-umb.com/21/muldiv\n function mulDiv(\n uint256 a,\n uint256 b,\n uint256 denominator\n ) internal pure returns (uint256 result) {\n unchecked {\n // 512-bit multiply [prod1 prod0] = a * b\n // Compute the product mod 2**256 and mod 2**256 - 1\n // then use the Chinese Remainder Theorem to reconstruct\n // the 512 bit result. The result is stored in two 256\n // variables such that product = prod1 * 2**256 + prod0\n uint256 prod0; // Least significant 256 bits of the product\n uint256 prod1; // Most significant 256 bits of the product\n assembly {\n let mm := mulmod(a, b, not(0))\n prod0 := mul(a, b)\n prod1 := sub(sub(mm, prod0), lt(mm, prod0))\n }\n\n // Handle non-overflow cases, 256 by 256 division\n if (prod1 == 0) {\n require(denominator > 0);\n assembly {\n result := div(prod0, denominator)\n }\n return result;\n }\n\n // Make sure the result is less than 2**256.\n // Also prevents denominator == 0\n require(denominator > prod1);\n\n ///////////////////////////////////////////////\n // 512 by 256 division.\n ///////////////////////////////////////////////\n\n // Make division exact by subtracting the remainder from [prod1 prod0]\n // Compute remainder using mulmod\n uint256 remainder;\n assembly {\n remainder := mulmod(a, b, denominator)\n }\n // Subtract 256 bit number from 512 bit number\n assembly {\n prod1 := sub(prod1, gt(remainder, prod0))\n prod0 := sub(prod0, remainder)\n }\n\n // Factor powers of two out of denominator\n // Compute largest power of two divisor of denominator.\n // Always >= 1.\n uint256 twos = (~denominator + 1) & denominator;\n // Divide denominator by power of two\n assembly {\n denominator := div(denominator, twos)\n }\n\n // Divide [prod1 prod0] by the factors of two\n assembly {\n prod0 := div(prod0, twos)\n }\n // Shift in bits from prod1 into prod0. For this we need\n // to flip `twos` such that it is 2**256 / twos.\n // If twos is zero, then it becomes one\n assembly {\n twos := add(div(sub(0, twos), twos), 1)\n }\n prod0 |= prod1 * twos;\n\n // Invert denominator mod 2**256\n // Now that denominator is an odd number, it has an inverse\n // modulo 2**256 such that denominator * inv = 1 mod 2**256.\n // Compute the inverse by starting with a seed that is correct\n // correct for four bits. That is, denominator * inv = 1 mod 2**4\n uint256 inv = (3 * denominator) ^ 2;\n // Now use Newton-Raphson iteration to improve the precision.\n // Thanks to Hensel's lifting lemma, this also works in modular\n // arithmetic, doubling the correct bits in each step.\n inv *= 2 - denominator * inv; // inverse mod 2**8\n inv *= 2 - denominator * inv; // inverse mod 2**16\n inv *= 2 - denominator * inv; // inverse mod 2**32\n inv *= 2 - denominator * inv; // inverse mod 2**64\n inv *= 2 - denominator * inv; // inverse mod 2**128\n inv *= 2 - denominator * inv; // inverse mod 2**256\n\n // Because the division is now exact we can divide by multiplying\n // with the modular inverse of denominator. This will give us the\n // correct result modulo 2**256. Since the precoditions guarantee\n // that the outcome is less than 2**256, this is the final result.\n // We don't need to compute the high bits of the result and prod1\n // is no longer required.\n result = prod0 * inv;\n return result;\n }\n }\n\n /// @notice Calculates ceil(a×b÷denominator) with full precision. Throws if result overflows a uint256 or denominator == 0\n /// @param a The multiplicand\n /// @param b The multiplier\n /// @param denominator The divisor\n /// @return result The 256-bit result\n function mulDivRoundingUp(\n uint256 a,\n uint256 b,\n uint256 denominator\n ) internal pure returns (uint256 result) {\n unchecked {\n result = mulDiv(a, b, denominator);\n if (mulmod(a, b, denominator) > 0) {\n require(result < type(uint256).max);\n result++;\n }\n }\n }\n}\n" - }, - "@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol": { - "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\nimport \"../IERC20.sol\";\n\n/**\n * @dev Interface for the optional metadata functions from the ERC20 standard.\n *\n * _Available since v4.1._\n */\ninterface IERC20Metadata is IERC20 {\n /**\n * @dev Returns the name of the token.\n */\n function name() external view returns (string memory);\n\n /**\n * @dev Returns the symbol of the token.\n */\n function symbol() external view returns (string memory);\n\n /**\n * @dev Returns the decimals places of the token.\n */\n function decimals() external view returns (uint8);\n}\n" - }, - "solidity/contracts/peripherals/Keep3rDisputable.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport './Keep3rParameters.sol';\nimport '../../interfaces/peripherals/IKeep3rDisputable.sol';\n\nabstract contract Keep3rDisputable is IKeep3rDisputable, Keep3rParameters {\n /// @inheritdoc IKeep3rDisputable\n function dispute(address _jobOrKeeper) external override onlyDisputer {\n if (disputes[_jobOrKeeper]) revert AlreadyDisputed();\n disputes[_jobOrKeeper] = true;\n emit Dispute(_jobOrKeeper, msg.sender);\n }\n\n /// @inheritdoc IKeep3rDisputable\n function resolve(address _jobOrKeeper) external override onlyDisputer {\n if (!disputes[_jobOrKeeper]) revert NotDisputed();\n disputes[_jobOrKeeper] = false;\n emit Resolve(_jobOrKeeper, msg.sender);\n }\n}\n" - }, - "solidity/contracts/peripherals/keepers/Keep3rKeeperDisputable.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport './Keep3rKeeperFundable.sol';\nimport '../Keep3rDisputable.sol';\nimport '../../../interfaces/external/IKeep3rV1.sol';\nimport '../../../interfaces/peripherals/IKeep3rKeepers.sol';\n\nabstract contract Keep3rKeeperDisputable is IKeep3rKeeperDisputable, Keep3rDisputable, Keep3rKeeperFundable {\n using EnumerableSet for EnumerableSet.AddressSet;\n using SafeERC20 for IERC20;\n\n /// @inheritdoc IKeep3rKeeperDisputable\n function slash(\n address _keeper,\n address _bonded,\n uint256 _bondAmount,\n uint256 _unbondAmount\n ) external override onlySlasher {\n if (!disputes[_keeper]) revert NotDisputed();\n _slash(_keeper, _bonded, _bondAmount, _unbondAmount);\n emit KeeperSlash(_keeper, msg.sender, _bondAmount + _unbondAmount);\n }\n\n /// @inheritdoc IKeep3rKeeperDisputable\n function revoke(address _keeper) external override onlySlasher {\n if (!disputes[_keeper]) revert NotDisputed();\n _keepers.remove(_keeper);\n _slash(_keeper, keep3rV1, bonds[_keeper][keep3rV1], pendingUnbonds[_keeper][keep3rV1]);\n emit KeeperRevoke(_keeper, msg.sender);\n }\n\n function _slash(\n address _keeper,\n address _bonded,\n uint256 _bondAmount,\n uint256 _unbondAmount\n ) internal {\n if (_bonded != keep3rV1) {\n try IERC20(_bonded).transfer(governance, _bondAmount + _unbondAmount) returns (bool) {} catch (bytes memory) {}\n }\n bonds[_keeper][_bonded] -= _bondAmount;\n pendingUnbonds[_keeper][_bonded] -= _unbondAmount;\n }\n}\n" - }, - "solidity/contracts/peripherals/keepers/Keep3rKeeperFundable.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../Keep3rAccountance.sol';\nimport '../Keep3rParameters.sol';\nimport '../../../interfaces/peripherals/IKeep3rKeepers.sol';\n\nimport '../../../interfaces/external/IKeep3rV1.sol';\n\nimport '@openzeppelin/contracts/security/ReentrancyGuard.sol';\nimport '@openzeppelin/contracts/token/ERC20/IERC20.sol';\nimport '@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol';\n\nabstract contract Keep3rKeeperFundable is IKeep3rKeeperFundable, ReentrancyGuard, Keep3rParameters {\n using EnumerableSet for EnumerableSet.AddressSet;\n using SafeERC20 for IERC20;\n\n /// @inheritdoc IKeep3rKeeperFundable\n function bond(address _bonding, uint256 _amount) external override nonReentrant {\n if (disputes[msg.sender]) revert Disputed();\n if (_jobs.contains(msg.sender)) revert AlreadyAJob();\n canActivateAfter[msg.sender][_bonding] = block.timestamp + bondTime;\n\n uint256 _before = IERC20(_bonding).balanceOf(address(this));\n IERC20(_bonding).safeTransferFrom(msg.sender, address(this), _amount);\n _amount = IERC20(_bonding).balanceOf(address(this)) - _before;\n\n hasBonded[msg.sender] = true;\n pendingBonds[msg.sender][_bonding] += _amount;\n\n emit Bonding(msg.sender, _bonding, _amount);\n }\n\n /// @inheritdoc IKeep3rKeeperFundable\n function activate(address _bonding) external override {\n address _keeper = msg.sender;\n if (disputes[_keeper]) revert Disputed();\n uint256 _canActivateAfter = canActivateAfter[_keeper][_bonding];\n if (_canActivateAfter == 0) revert BondsUnexistent();\n if (_canActivateAfter >= block.timestamp) revert BondsLocked();\n\n if (firstSeen[_keeper] == 0) {\n firstSeen[_keeper] = block.timestamp;\n }\n _keepers.add(_keeper);\n\n uint256 _amount = pendingBonds[_keeper][_bonding];\n delete pendingBonds[_keeper][_bonding];\n\n // bond provided tokens\n bonds[_keeper][_bonding] += _amount;\n if (_bonding == keep3rV1) {\n totalBonds += _amount;\n _depositBonds(_amount);\n }\n\n emit Activation(_keeper, _bonding, _amount);\n }\n\n /// @inheritdoc IKeep3rKeeperFundable\n function unbond(address _bonding, uint256 _amount) external override {\n canWithdrawAfter[msg.sender][_bonding] = block.timestamp + unbondTime;\n bonds[msg.sender][_bonding] -= _amount;\n pendingUnbonds[msg.sender][_bonding] += _amount;\n\n emit Unbonding(msg.sender, _bonding, _amount);\n }\n\n /// @inheritdoc IKeep3rKeeperFundable\n function withdraw(address _bonding) external override nonReentrant {\n if (pendingUnbonds[msg.sender][_bonding] == 0) revert UnbondsUnexistent();\n if (canWithdrawAfter[msg.sender][_bonding] >= block.timestamp) revert UnbondsLocked();\n if (disputes[msg.sender]) revert Disputed();\n\n uint256 _amount = pendingUnbonds[msg.sender][_bonding];\n\n delete pendingUnbonds[msg.sender][_bonding];\n delete canWithdrawAfter[msg.sender][_bonding];\n\n if (_bonding == keep3rV1) _mint(_amount);\n IERC20(_bonding).safeTransfer(msg.sender, _amount);\n\n emit Withdrawal(msg.sender, _bonding, _amount);\n }\n\n function _depositBonds(uint256 _amount) internal virtual {\n IKeep3rV1(keep3rV1).burn(_amount);\n }\n}\n" - }, - "solidity/interfaces/external/IKeep3rV1.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '@openzeppelin/contracts/token/ERC20/IERC20.sol';\nimport '@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol';\n\n// solhint-disable func-name-mixedcase\ninterface IKeep3rV1 is IERC20, IERC20Metadata {\n // Structs\n struct Checkpoint {\n uint32 fromBlock;\n uint256 votes;\n }\n\n // Events\n event DelegateChanged(address indexed _delegator, address indexed _fromDelegate, address indexed _toDelegate);\n event DelegateVotesChanged(address indexed _delegate, uint256 _previousBalance, uint256 _newBalance);\n event SubmitJob(address indexed _job, address indexed _liquidity, address indexed _provider, uint256 _block, uint256 _credit);\n event ApplyCredit(address indexed _job, address indexed _liquidity, address indexed _provider, uint256 _block, uint256 _credit);\n event RemoveJob(address indexed _job, address indexed _liquidity, address indexed _provider, uint256 _block, uint256 _credit);\n event UnbondJob(address indexed _job, address indexed _liquidity, address indexed _provider, uint256 _block, uint256 _credit);\n event JobAdded(address indexed _job, uint256 _block, address _governance);\n event JobRemoved(address indexed _job, uint256 _block, address _governance);\n event KeeperWorked(address indexed _credit, address indexed _job, address indexed _keeper, uint256 _block, uint256 _amount);\n event KeeperBonding(address indexed _keeper, uint256 _block, uint256 _active, uint256 _bond);\n event KeeperBonded(address indexed _keeper, uint256 _block, uint256 _activated, uint256 _bond);\n event KeeperUnbonding(address indexed _keeper, uint256 _block, uint256 _deactive, uint256 _bond);\n event KeeperUnbound(address indexed _keeper, uint256 _block, uint256 _deactivated, uint256 _bond);\n event KeeperSlashed(address indexed _keeper, address indexed _slasher, uint256 _block, uint256 _slash);\n event KeeperDispute(address indexed _keeper, uint256 _block);\n event KeeperResolved(address indexed _keeper, uint256 _block);\n event TokenCreditAddition(address indexed _credit, address indexed _job, address indexed _creditor, uint256 _block, uint256 _amount);\n\n // Variables\n function KPRH() external returns (address);\n\n function delegates(address _delegator) external view returns (address);\n\n function checkpoints(address _account, uint32 _checkpoint) external view returns (Checkpoint memory);\n\n function numCheckpoints(address _account) external view returns (uint32);\n\n function DOMAIN_TYPEHASH() external returns (bytes32);\n\n function DOMAINSEPARATOR() external returns (bytes32);\n\n function DELEGATION_TYPEHASH() external returns (bytes32);\n\n function PERMIT_TYPEHASH() external returns (bytes32);\n\n function nonces(address _user) external view returns (uint256);\n\n function BOND() external returns (uint256);\n\n function UNBOND() external returns (uint256);\n\n function LIQUIDITYBOND() external returns (uint256);\n\n function FEE() external returns (uint256);\n\n function BASE() external returns (uint256);\n\n function ETH() external returns (address);\n\n function bondings(address _user, address _bonding) external view returns (uint256);\n\n function canWithdrawAfter(address _user, address _bonding) external view returns (uint256);\n\n function pendingUnbonds(address _keeper, address _bonding) external view returns (uint256);\n\n function pendingbonds(address _keeper, address _bonding) external view returns (uint256);\n\n function bonds(address _keeper, address _bonding) external view returns (uint256);\n\n function votes(address _delegator) external view returns (uint256);\n\n function firstSeen(address _keeper) external view returns (uint256);\n\n function disputes(address _keeper) external view returns (bool);\n\n function lastJob(address _keeper) external view returns (uint256);\n\n function workCompleted(address _keeper) external view returns (uint256);\n\n function jobs(address _job) external view returns (bool);\n\n function credits(address _job, address _credit) external view returns (uint256);\n\n function liquidityProvided(\n address _provider,\n address _liquidity,\n address _job\n ) external view returns (uint256);\n\n function liquidityUnbonding(\n address _provider,\n address _liquidity,\n address _job\n ) external view returns (uint256);\n\n function liquidityAmountsUnbonding(\n address _provider,\n address _liquidity,\n address _job\n ) external view returns (uint256);\n\n function jobProposalDelay(address _job) external view returns (uint256);\n\n function liquidityApplied(\n address _provider,\n address _liquidity,\n address _job\n ) external view returns (uint256);\n\n function liquidityAmount(\n address _provider,\n address _liquidity,\n address _job\n ) external view returns (uint256);\n\n function keepers(address _keeper) external view returns (bool);\n\n function blacklist(address _keeper) external view returns (bool);\n\n function keeperList(uint256 _index) external view returns (address);\n\n function jobList(uint256 _index) external view returns (address);\n\n function governance() external returns (address);\n\n function pendingGovernance() external returns (address);\n\n function liquidityAccepted(address _liquidity) external view returns (bool);\n\n function liquidityPairs(uint256 _index) external view returns (address);\n\n // Methods\n function getCurrentVotes(address _account) external view returns (uint256);\n\n function addCreditETH(address _job) external payable;\n\n function addCredit(\n address _credit,\n address _job,\n uint256 _amount\n ) external;\n\n function addVotes(address _voter, uint256 _amount) external;\n\n function removeVotes(address _voter, uint256 _amount) external;\n\n function addKPRCredit(address _job, uint256 _amount) external;\n\n function approveLiquidity(address _liquidity) external;\n\n function revokeLiquidity(address _liquidity) external;\n\n function pairs() external view returns (address[] memory);\n\n function addLiquidityToJob(\n address _liquidity,\n address _job,\n uint256 _amount\n ) external;\n\n function applyCreditToJob(\n address _provider,\n address _liquidity,\n address _job\n ) external;\n\n function unbondLiquidityFromJob(\n address _liquidity,\n address _job,\n uint256 _amount\n ) external;\n\n function removeLiquidityFromJob(address _liquidity, address _job) external;\n\n function mint(uint256 _amount) external;\n\n function burn(uint256 _amount) external;\n\n function worked(address _keeper) external;\n\n function receipt(\n address _credit,\n address _keeper,\n uint256 _amount\n ) external;\n\n function receiptETH(address _keeper, uint256 _amount) external;\n\n function addJob(address _job) external;\n\n function getJobs() external view returns (address[] memory);\n\n function removeJob(address _job) external;\n\n function setKeep3rHelper(address _keep3rHelper) external;\n\n function setGovernance(address _governance) external;\n\n function acceptGovernance() external;\n\n function isKeeper(address _keeper) external returns (bool);\n\n function isMinKeeper(\n address _keeper,\n uint256 _minBond,\n uint256 _earned,\n uint256 _age\n ) external returns (bool);\n\n function isBondedKeeper(\n address _keeper,\n address _bond,\n uint256 _minBond,\n uint256 _earned,\n uint256 _age\n ) external returns (bool);\n\n function bond(address _bonding, uint256 _amount) external;\n\n function getKeepers() external view returns (address[] memory);\n\n function activate(address _bonding) external;\n\n function unbond(address _bonding, uint256 _amount) external;\n\n function slash(\n address _bonded,\n address _keeper,\n uint256 _amount\n ) external;\n\n function withdraw(address _bonding) external;\n\n function dispute(address _keeper) external;\n\n function revoke(address _keeper) external;\n\n function resolve(address _keeper) external;\n\n function permit(\n address _owner,\n address _spender,\n uint256 _amount,\n uint256 _deadline,\n uint8 _v,\n bytes32 _r,\n bytes32 _s\n ) external;\n}\n" - }, - "solidity/for-test/testnet/Keep3rForTestnet.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../../contracts/Keep3r.sol';\n\ncontract Keep3rForTestnet is Keep3r {\n constructor(\n address _governance,\n address _keep3rHelper,\n address _keep3rV1,\n address _keep3rV1Proxy\n ) Keep3r(_governance, _keep3rHelper, _keep3rV1, _keep3rV1Proxy) {\n bondTime = 0; // allows keepers to instantly register\n unbondTime = 0; // allows keepers & jobOwners to instantly withdraw funds\n liquidityMinimum = 1; // allows job providers to add low liquidity\n rewardPeriodTime = 1 days; // reduces twap calculation period\n inflationPeriod = 5 days; // increases credit minting\n }\n}\n" - }, - "solidity/for-test/Keep3rForTest.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../contracts/Keep3r.sol';\n\ncontract Keep3rForTest is Keep3r {\n constructor(\n address _governance,\n address _keep3rHelper,\n address _keep3rV1,\n address _keep3rV1Proxy\n ) Keep3r(_governance, _keep3rHelper, _keep3rV1, _keep3rV1Proxy) {}\n}\n" - }, - "solidity/contracts/sidechain/Keep3rSidechain.sol": { - "content": "// SPDX-License-Identifier: MIT\n\n/*\n\nCoded for The Keep3r Network with ♥ by\n\n██████╗░███████╗███████╗██╗░░░██╗░░░░░░░██╗░█████╗░███╗░░██╗██████╗░███████╗██████╗░██╗░░░░░░█████╗░███╗░░██╗██████╗░\n██╔══██╗██╔════╝██╔════╝██║░░░██║░░██╗░░██║██╔══██╗████╗░██║██╔══██╗██╔════╝██╔══██╗██║░░░░░██╔══██╗████╗░██║██╔══██╗\n██║░░██║█████╗░░█████╗░░██║░░░╚██╗████╗██╔╝██║░░██║██╔██╗██║██║░░██║█████╗░░██████╔╝██║░░░░░███████║██╔██╗██║██║░░██║\n██║░░██║██╔══╝░░██╔══╝░░██║░░░░████╔═████║░██║░░██║██║╚████║██║░░██║██╔══╝░░██╔══██╗██║░░░░░██╔══██║██║╚████║██║░░██║\n██████╔╝███████╗██║░░░░░██║░░░░╚██╔╝░╚██╔╝░╚█████╔╝██║░╚███║██████╔╝███████╗██║░░██║███████╗██║░░██║██║░╚███║██████╔╝\n╚═════╝░╚══════╝╚═╝░░░░░╚═╝░░░░░╚═╝░░░╚═╝░░░╚════╝░╚═╝░░╚══╝╚═════╝░╚══════╝╚═╝░░╚═╝╚══════╝╚═╝░░╚═╝╚═╝░░╚══╝╚═════╝░\n\nhttps://defi.sucks\n\n*/\n\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../Keep3r.sol';\nimport '../../interfaces/sidechain/IKeep3rEscrow.sol';\nimport '../../interfaces/sidechain/IKeep3rHelperSidechain.sol';\nimport '../../interfaces/sidechain/IKeep3rJobWorkableRated.sol';\nimport '../../interfaces/sidechain/IKeep3rSidechainAccountance.sol';\n\ncontract Keep3rSidechain is Keep3r, IKeep3rJobWorkableRated, IKeep3rSidechainAccountance {\n using EnumerableSet for EnumerableSet.AddressSet;\n\n /// @param _governance Address of governance\n /// @param _keep3rHelperSidechain Address of sidechain Keep3rHelper\n /// @param _wrappedKP3R Address of wrapped KP3R implementation\n /// @param _keep3rEscrow Address of sidechain Keep3rEscrow\n constructor(\n address _governance, // governance\n address _keep3rHelperSidechain, // helper\n address _wrappedKP3R, // keep3rV1\n address _keep3rEscrow // keep3rV1Proxy\n ) Keep3r(_governance, _keep3rHelperSidechain, _wrappedKP3R, _keep3rEscrow) {}\n\n // Keep3rSidechainAccountance\n\n /// @inheritdoc IKeep3rSidechainAccountance\n function virtualReserves() external view override returns (int256 _virtualReserves) {\n // Queries wKP3R balanceOf escrow contract minus the totalBonds\n return int256(IERC20(keep3rV1).balanceOf(keep3rV1Proxy)) - int256(totalBonds);\n }\n\n // Keep3rJobFundableLiquidity\n\n /// @notice Sidechain implementation asks the Helper for an oracle, instead of reading it from the ERC-20\n /// @dev Function should be called after setting an oracle in Keep3rHelperSidechain\n /// @param _liquidity Address of the liquidity token being approved\n function approveLiquidity(address _liquidity) external virtual override onlyGovernance {\n if (!_approvedLiquidities.add(_liquidity)) revert LiquidityPairApproved();\n _liquidityPool[_liquidity] = IKeep3rHelperSidechain(keep3rHelper).oracle(_liquidity);\n if (_liquidityPool[_liquidity] == address(0)) revert ZeroAddress();\n _isKP3RToken0[_liquidity] = IKeep3rHelper(keep3rHelper).isKP3RToken0(_liquidityPool[_liquidity]);\n _tick[_liquidity] = observeLiquidity(_liquidity);\n emit LiquidityApproval(_liquidity);\n }\n\n /// @notice Sidechain implementation will always ask for 2 tickCumulatives instead of cacheing\n /// @param _liquidity Address of the liquidity token being observed\n function observeLiquidity(address _liquidity) public view virtual override returns (TickCache memory _tickCache) {\n if (_tick[_liquidity].period == _period(block.timestamp)) {\n // Will return cached twaps if liquidity is updated\n _tickCache = _tick[_liquidity];\n } else {\n bool success;\n\n // Will always ask for 2 accumulators in sidechain\n uint32[] memory _secondsAgo = new uint32[](2);\n\n _secondsAgo[0] = uint32(block.timestamp - _period(block.timestamp));\n _secondsAgo[1] = uint32(block.timestamp - _period(block.timestamp) + rewardPeriodTime);\n\n int56 _tickCumulative2;\n (_tickCache.current, _tickCumulative2, success) = IKeep3rHelper(keep3rHelper).observe(_liquidityPool[_liquidity], _secondsAgo);\n\n _tickCache.difference = _tickCache.current - _tickCumulative2;\n\n if (success) {\n _tickCache.period = _period(block.timestamp);\n } else {\n delete _tickCache.period;\n }\n }\n }\n\n // Keep3rJobsWorkable\n\n /// @dev Sidechain implementation deprecates worked(address) as it should come with a usdPerGasUnit parameter\n function worked(address) external pure override {\n revert Deprecated();\n }\n\n /// @notice Implemented by jobs to show that a keeper performed work\n /// @dev Uses a USD per gas unit payment mechanism\n /// @param _keeper Address of the keeper that performed the work\n /// @param _usdPerGasUnit Units of USD (in wei) per gas unit that should be rewarded to the keeper\n function worked(address _keeper, uint256 _usdPerGasUnit) external override {\n if (_initialGas == 0) revert GasNotInitialized();\n // Gas used for quote calculations & payment is not rewarded\n uint256 _gasLeft = _getGasLeft();\n\n address _job = msg.sender;\n if (disputes[_job]) revert JobDisputed();\n if (!_jobs.contains(_job)) revert JobUnapproved();\n\n if (_updateJobCreditsIfNeeded(_job)) {\n emit LiquidityCreditsReward(_job, rewardedAt[_job], _jobLiquidityCredits[_job], _jobPeriodCredits[_job]);\n }\n\n (uint256 _boost, uint256 _oneUsdQuote, uint256 _extraGas) = IKeep3rHelper(keep3rHelper).getPaymentParams(bonds[_keeper][keep3rV1]);\n\n uint256 _kp3rPayment = _calculatePayment(_gasLeft, _extraGas, _oneUsdQuote * _usdPerGasUnit, _boost);\n\n if (_kp3rPayment > _jobLiquidityCredits[_job]) {\n _rewardJobCredits(_job);\n emit LiquidityCreditsReward(_job, rewardedAt[_job], _jobLiquidityCredits[_job], _jobPeriodCredits[_job]);\n }\n\n _bondedPayment(_job, _keeper, _kp3rPayment);\n delete _initialGas;\n\n emit KeeperWork(keep3rV1, _job, _keeper, _kp3rPayment, _gasLeft);\n }\n\n // Keep3rKeeperFundable\n\n /// @dev Sidechain implementation doesn't burn tokens, but deposit them in Keep3rEscrow\n function _depositBonds(uint256 _amount) internal virtual override {\n IKeep3rV1(keep3rV1).approve(keep3rV1Proxy, _amount);\n IKeep3rEscrow(keep3rV1Proxy).deposit(_amount);\n }\n}\n" - }, - "solidity/interfaces/sidechain/IKeep3rEscrow.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\n// solhint-disable-next-line no-empty-blocks\n\nimport '../peripherals/IMintable.sol';\n\n/// @title Keep3rEscrow contract\n/// @notice This contract acts as an escrow contract for wKP3R tokens on sidechains and L2s\n/// @dev Can be used as a replacement for keep3rV1Proxy in keep3r sidechain implementations\ninterface IKeep3rEscrow is IMintable {\n /// @notice Emitted when Keep3rEscrow#deposit function is called\n /// @param _wKP3R The addess of the wrapped KP3R token\n /// @param _sender The address that called the function\n /// @param _amount The amount of wKP3R the user deposited\n event wKP3RDeposited(address _wKP3R, address _sender, uint256 _amount);\n\n /// @notice Emitted when Keep3rEscrow#mint function is called\n /// @param _wKP3R The addess of the wrapped KP3R token\n /// @param _recipient The address that will received the newly minted wKP3R\n /// @param _amount The amount of wKP3R minted to the recipient\n event wKP3RMinted(address _wKP3R, address _recipient, uint256 _amount);\n\n /// @notice Emitted when Keep3rEscrow#setWKP3R function is called\n /// @param _newWKP3R The address of the wKP3R contract\n event wKP3RSet(address _newWKP3R);\n\n /// @notice Throws when minter attempts to withdraw more wKP3R than the escrow has in its balance\n error InsufficientBalance();\n\n /// @notice Lists the address of the wKP3R contract\n /// @return _wKP3RAddress The address of wKP3R\n function wKP3R() external view returns (address _wKP3RAddress);\n\n /// @notice Deposits wKP3R into the contract\n /// @param _amount The amount of wKP3R to deposit\n function deposit(uint256 _amount) external;\n\n /// @notice mints wKP3R to the recipient\n /// @param _amount The amount of wKP3R to mint\n function mint(uint256 _amount) external;\n\n /// @notice sets the wKP3R address\n /// @param _wKP3R the wKP3R address\n function setWKP3R(address _wKP3R) external;\n}\n" - }, - "solidity/interfaces/sidechain/IKeep3rHelperSidechain.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../IKeep3rHelper.sol';\n\n/// @title Keep3rHelperSidechain contract\n/// @notice Contains all the helper functions for sidechain keep3r implementations\ninterface IKeep3rHelperSidechain is IKeep3rHelper {\n // Events\n\n /// @notice The oracle for a liquidity has been saved\n /// @param _liquidity The address of the given liquidity\n /// @param _oraclePool The address of the oracle pool\n event OracleSet(address _liquidity, address _oraclePool);\n\n /// @notice Emitted when the WETH USD pool is changed\n /// @param _address Address of the new WETH USD pool\n /// @param _isWETHToken0 True if calling the token0 method of the pool returns the WETH token address\n event WethUSDPoolChange(address _address, bool _isWETHToken0);\n\n /// Variables\n\n /// @notice Ethereum mainnet WETH address used for quoting references\n /// @return _weth Address of WETH token\n // solhint-disable func-name-mixedcase\n function WETH() external view returns (address _weth);\n\n /// @return _oracle The address of the observable pool for given liquidity\n function oracle(address _liquidity) external view returns (address _oracle);\n\n /// @notice WETH-USD pool that is being used as oracle\n /// @return poolAddress Address of the pool\n /// @return isTKNToken0 True if calling the token0 method of the pool returns the WETH token address\n function wethUSDPool() external view returns (address poolAddress, bool isTKNToken0);\n\n /// @notice Quotes USD to ETH\n /// @dev Used to know how much ETH should be paid to keepers before converting it from ETH to KP3R\n /// @param _usd The amount of USD to quote to ETH\n /// @return _eth The resulting amount of ETH after quoting the USD\n function quoteUsdToEth(uint256 _usd) external returns (uint256 _eth);\n\n /// Methods\n\n /// @notice Sets an oracle for a given liquidity\n /// @param _liquidity The address of the liquidity\n /// @param _oracle The address of the pool used to quote the liquidity from\n /// @dev The oracle must contain KP3R as either token0 or token1\n function setOracle(address _liquidity, address _oracle) external;\n\n /// @notice Sets an oracle for querying WETH/USD quote\n /// @param _poolAddress The address of the pool used as oracle\n /// @dev The oracle must contain WETH as either token0 or token1\n function setWethUsdPool(address _poolAddress) external;\n}\n" - }, - "solidity/interfaces/sidechain/IKeep3rJobWorkableRated.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../peripherals/IKeep3rJobs.sol';\n\n/// @title Keep3rJobWorkableRated contract\n/// @notice Implements a quoting in USD per gas unit for Keep3r jobs\ninterface IKeep3rJobWorkableRated is IKeep3rJobs {\n /// @notice Throws when job contract calls deprecated worked(address) function\n error Deprecated();\n\n /// @notice Implemented by jobs to show that a keeper performed work and reward in stable USD quote\n /// @dev Automatically calculates the payment for the keeper and pays the keeper with bonded KP3R\n /// @param _keeper Address of the keeper that performed the work\n /// @param _usdPerGasUnit Amount of USD in wei rewarded for gas unit worked by the keeper\n function worked(address _keeper, uint256 _usdPerGasUnit) external;\n}\n" - }, - "solidity/interfaces/sidechain/IKeep3rSidechainAccountance.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\n/// @title IKeep3rSidechainAccountance interface\n/// @notice Implements a view to get the amount of credits that can be withdrawn\ninterface IKeep3rSidechainAccountance {\n /// @notice The surplus amount of wKP3Rs in escrow contract\n /// @return _virtualReserves The surplus amount of wKP3Rs in escrow contract\n function virtualReserves() external view returns (int256 _virtualReserves);\n}\n" - }, - "solidity/interfaces/peripherals/IMintable.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport './IGovernable.sol';\nimport './IBaseErrors.sol';\n\n/// @title Mintable contract\n/// @notice Manages the minter role\ninterface IMintable is IBaseErrors, IGovernable {\n // Events\n\n /// @notice Emitted when governance sets a new minter\n /// @param _minter Address of the new minter\n event MinterSet(address _minter);\n\n // Errors\n\n /// @notice Throws if the caller of the function is not the minter\n error OnlyMinter();\n\n // Variables\n\n /// @notice Stores the minter address\n /// @return _minter The minter addresss\n function minter() external view returns (address _minter);\n\n // Methods\n\n /// @notice Sets a new address to be the minter\n /// @param _minter The address set as the minter\n function setMinter(address _minter) external;\n}\n" - }, - "solidity/for-test/testnet/Keep3rSidechainForTestnet.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../../contracts/sidechain/Keep3rSidechain.sol';\n\ncontract Keep3rSidechainForTestnet is Keep3rSidechain {\n constructor(\n address _governance,\n address _keep3rHelper,\n address _keep3rV1,\n address _keep3rV1Proxy\n ) Keep3rSidechain(_governance, _keep3rHelper, _keep3rV1, _keep3rV1Proxy) {\n bondTime = 0; // allows keepers to instantly register\n unbondTime = 0; // allows keepers & jobOwners to instantly withdraw funds\n liquidityMinimum = 1; // allows job providers to add low liquidity\n rewardPeriodTime = 1 days; // reduces twap calculation period\n inflationPeriod = 5 days; // increases credit minting\n }\n}\n" - }, - "solidity/for-test/Keep3rSidechainForTest.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../contracts/sidechain/Keep3rSidechain.sol';\n\ncontract Keep3rSidechainForTest is Keep3rSidechain {\n using EnumerableSet for EnumerableSet.AddressSet;\n\n constructor(\n address _governance,\n address _keep3rHelper,\n address _wrappedKP3R,\n address _keep3rEscrow\n ) Keep3rSidechain(_governance, _keep3rHelper, _wrappedKP3R, _keep3rEscrow) {}\n\n function setJobLiquidity(address _job, address _liquidity) external {\n _jobLiquidities[_job].add(_liquidity);\n }\n}\n" - }, - "solidity/for-test/JobRatedForTest.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../interfaces/IKeep3r.sol';\nimport '../interfaces/sidechain/IKeep3rJobWorkableRated.sol';\n\ncontract JobRatedForTest {\n error InvalidKeeper();\n address public keep3r;\n uint256 public nonce;\n uint256 public usdPerGasUnit = 1_000e9;\n\n constructor(address _keep3r) {\n keep3r = _keep3r;\n }\n\n function work() external {\n if (!IKeep3r(keep3r).isKeeper(msg.sender)) revert InvalidKeeper();\n\n for (uint256 i = 0; i < 1000; i++) {\n nonce++;\n }\n\n IKeep3rJobWorkableRated(keep3r).worked(msg.sender, usdPerGasUnit);\n }\n\n function workHard(uint256 _factor) external {\n if (!IKeep3r(keep3r).isKeeper(msg.sender)) revert InvalidKeeper();\n\n for (uint256 i = 0; i < 1000 * _factor; i++) {\n nonce++;\n }\n\n IKeep3rJobWorkableRated(keep3r).worked(msg.sender, usdPerGasUnit);\n }\n}\n" - }, - "solidity/for-test/JobForTest.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../interfaces/IKeep3r.sol';\n\ncontract JobForTest {\n error InvalidKeeper();\n address public keep3r;\n uint256 public nonce;\n\n constructor(address _keep3r) {\n keep3r = _keep3r;\n }\n\n function work() external {\n if (!IKeep3r(keep3r).isKeeper(msg.sender)) revert InvalidKeeper();\n\n for (uint256 i; i < 1000; i++) {\n nonce++;\n }\n\n IKeep3r(keep3r).worked(msg.sender);\n }\n\n function workHard(uint256 _factor) external {\n if (!IKeep3r(keep3r).isKeeper(msg.sender)) revert InvalidKeeper();\n\n for (uint256 i; i < 1000 * _factor; i++) {\n nonce++;\n }\n\n IKeep3r(keep3r).worked(msg.sender);\n }\n}\n" - }, - "solidity/for-test/BasicJob.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../interfaces/IKeep3r.sol';\n\ncontract BasicJob {\n error KeeperNotValid();\n\n address public keep3r;\n uint256 public nonce;\n uint256[] public array;\n\n constructor(address _keep3r) {\n keep3r = _keep3r;\n }\n\n function work() external upkeep {}\n\n function workHard(uint256 _howHard) external upkeep {\n for (uint256 i = nonce; i < _howHard; i++) {\n nonce++;\n }\n }\n\n function workRefund(uint256 _howHard) external upkeep {\n for (uint256 i; i < _howHard; i++) {\n array.push(i);\n }\n\n while (array.length > 0) {\n array.pop();\n }\n }\n\n modifier upkeep() {\n if (!IKeep3r(keep3r).isKeeper(msg.sender)) revert KeeperNotValid();\n _;\n IKeep3r(keep3r).worked(msg.sender);\n }\n}\n" - }, - "solidity/contracts/Keep3rHelperParameters.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.7 <0.9.0;\n\nimport './libraries/FullMath.sol';\nimport './libraries/TickMath.sol';\nimport '../interfaces/peripherals/IBaseErrors.sol';\nimport '../interfaces/IKeep3r.sol';\nimport '../interfaces/external/IKeep3rV1.sol';\nimport '../interfaces/IKeep3rHelperParameters.sol';\nimport './peripherals/Governable.sol';\nimport './Keep3rHelperParameters.sol';\n\nimport '@openzeppelin/contracts/utils/math/Math.sol';\nimport '@uniswap/v3-core/contracts/interfaces/IUniswapV3Pool.sol';\n\ncontract Keep3rHelperParameters is IKeep3rHelperParameters, IBaseErrors, Governable {\n /// @inheritdoc IKeep3rHelperParameters\n address public immutable override KP3R;\n\n /// @inheritdoc IKeep3rHelperParameters\n uint256 public constant override BOOST_BASE = 10_000;\n\n /// @inheritdoc IKeep3rHelperParameters\n uint256 public override minBoost = 11_000;\n\n /// @inheritdoc IKeep3rHelperParameters\n uint256 public override maxBoost = 12_000;\n\n /// @inheritdoc IKeep3rHelperParameters\n uint256 public override targetBond = 200 ether;\n\n /// @inheritdoc IKeep3rHelperParameters\n uint256 public override workExtraGas = 34_000;\n\n /// @inheritdoc IKeep3rHelperParameters\n uint32 public override quoteTwapTime = 10 minutes;\n\n /// @inheritdoc IKeep3rHelperParameters\n uint256 public override minBaseFee = 15e9;\n\n /// @inheritdoc IKeep3rHelperParameters\n uint256 public override minPriorityFee = 2e9;\n\n /// @inheritdoc IKeep3rHelperParameters\n address public override keep3rV2;\n\n /// @inheritdoc IKeep3rHelperParameters\n IKeep3rHelperParameters.TokenOraclePool public override kp3rWethPool;\n\n constructor(\n address _kp3r,\n address _keep3rV2,\n address _governance,\n address _kp3rWethPool\n ) Governable(_governance) {\n KP3R = _kp3r;\n keep3rV2 = _keep3rV2;\n\n // Immutable variables [KP3R] cannot be read during contract creation time [_setKp3rWethPool]\n kp3rWethPool = _validateOraclePool(_kp3rWethPool, _kp3r);\n emit Kp3rWethPoolChange(kp3rWethPool.poolAddress, kp3rWethPool.isTKNToken0);\n }\n\n /// @inheritdoc IKeep3rHelperParameters\n function setKp3rWethPool(address _poolAddress) external override onlyGovernance {\n if (_poolAddress == address(0)) revert ZeroAddress();\n _setKp3rWethPool(_poolAddress);\n }\n\n /// @inheritdoc IKeep3rHelperParameters\n function setMinBoost(uint256 _minBoost) external override onlyGovernance {\n minBoost = _minBoost;\n emit MinBoostChange(minBoost);\n }\n\n /// @inheritdoc IKeep3rHelperParameters\n function setMaxBoost(uint256 _maxBoost) external override onlyGovernance {\n maxBoost = _maxBoost;\n emit MaxBoostChange(maxBoost);\n }\n\n /// @inheritdoc IKeep3rHelperParameters\n function setTargetBond(uint256 _targetBond) external override onlyGovernance {\n targetBond = _targetBond;\n emit TargetBondChange(targetBond);\n }\n\n /// @inheritdoc IKeep3rHelperParameters\n function setKeep3rV2(address _keep3rV2) external override onlyGovernance {\n if (_keep3rV2 == address(0)) revert ZeroAddress();\n keep3rV2 = _keep3rV2;\n emit Keep3rV2Change(keep3rV2);\n }\n\n /// @inheritdoc IKeep3rHelperParameters\n function setWorkExtraGas(uint256 _workExtraGas) external override onlyGovernance {\n workExtraGas = _workExtraGas;\n emit WorkExtraGasChange(workExtraGas);\n }\n\n /// @inheritdoc IKeep3rHelperParameters\n function setQuoteTwapTime(uint32 _quoteTwapTime) external override onlyGovernance {\n _setQuoteTwapTime(_quoteTwapTime);\n }\n\n function _setQuoteTwapTime(uint32 _quoteTwapTime) internal {\n quoteTwapTime = _quoteTwapTime;\n emit QuoteTwapTimeChange(quoteTwapTime);\n }\n\n /// @inheritdoc IKeep3rHelperParameters\n function setMinBaseFee(uint256 _minBaseFee) external override onlyGovernance {\n minBaseFee = _minBaseFee;\n emit MinBaseFeeChange(minBaseFee);\n }\n\n /// @inheritdoc IKeep3rHelperParameters\n function setMinPriorityFee(uint256 _minPriorityFee) external override onlyGovernance {\n minPriorityFee = _minPriorityFee;\n emit MinPriorityFeeChange(minPriorityFee);\n }\n\n /// @notice Sets KP3R-WETH pool\n /// @param _poolAddress The address of the KP3R-WETH pool\n function _setKp3rWethPool(address _poolAddress) internal {\n kp3rWethPool = _validateOraclePool(_poolAddress, KP3R);\n emit Kp3rWethPoolChange(kp3rWethPool.poolAddress, kp3rWethPool.isTKNToken0);\n }\n\n function _validateOraclePool(address _poolAddress, address _token) internal view virtual returns (TokenOraclePool memory _oraclePool) {\n bool _isTKNToken0 = IUniswapV3Pool(_poolAddress).token0() == _token;\n\n if (!_isTKNToken0 && IUniswapV3Pool(_poolAddress).token1() != _token) revert InvalidOraclePool();\n\n return TokenOraclePool(_poolAddress, _isTKNToken0);\n }\n}\n" - }, - "solidity/contracts/libraries/TickMath.sol": { - "content": "// SPDX-License-Identifier: GPL-2.0-or-later\npragma solidity >=0.5.0;\n\n// solhint-disable\n\n/// @title Math library for computing sqrt prices from ticks and vice versa\n/// @notice Computes sqrt price for ticks of size 1.0001, i.e. sqrt(1.0001^tick) as fixed point Q64.96 numbers. Supports\n/// prices between 2**-128 and 2**128\nlibrary TickMath {\n /// @dev The minimum tick that may be passed to #getSqrtRatioAtTick computed from log base 1.0001 of 2**-128\n int24 internal constant MIN_TICK = -887272;\n /// @dev The maximum tick that may be passed to #getSqrtRatioAtTick computed from log base 1.0001 of 2**128\n int24 internal constant MAX_TICK = -MIN_TICK;\n\n /// @dev The minimum value that can be returned from #getSqrtRatioAtTick. Equivalent to getSqrtRatioAtTick(MIN_TICK)\n uint160 internal constant MIN_SQRT_RATIO = 4295128739;\n /// @dev The maximum value that can be returned from #getSqrtRatioAtTick. Equivalent to getSqrtRatioAtTick(MAX_TICK)\n uint160 internal constant MAX_SQRT_RATIO = 1461446703485210103287273052203988822378723970342;\n\n /// @notice Calculates sqrt(1.0001^tick) * 2^96\n /// @dev Throws if |tick| > max tick\n /// @param tick The input tick for the above formula\n /// @return sqrtPriceX96 A Fixed point Q64.96 number representing the sqrt of the ratio of the two assets (token1/token0)\n /// at the given tick\n function getSqrtRatioAtTick(int24 tick) internal pure returns (uint160 sqrtPriceX96) {\n uint256 absTick = tick < 0 ? uint256(-int256(tick)) : uint256(int256(tick));\n require(absTick <= uint256(int256(MAX_TICK)), 'T');\n\n uint256 ratio = absTick & 0x1 != 0 ? 0xfffcb933bd6fad37aa2d162d1a594001 : 0x100000000000000000000000000000000;\n if (absTick & 0x2 != 0) ratio = (ratio * 0xfff97272373d413259a46990580e213a) >> 128;\n if (absTick & 0x4 != 0) ratio = (ratio * 0xfff2e50f5f656932ef12357cf3c7fdcc) >> 128;\n if (absTick & 0x8 != 0) ratio = (ratio * 0xffe5caca7e10e4e61c3624eaa0941cd0) >> 128;\n if (absTick & 0x10 != 0) ratio = (ratio * 0xffcb9843d60f6159c9db58835c926644) >> 128;\n if (absTick & 0x20 != 0) ratio = (ratio * 0xff973b41fa98c081472e6896dfb254c0) >> 128;\n if (absTick & 0x40 != 0) ratio = (ratio * 0xff2ea16466c96a3843ec78b326b52861) >> 128;\n if (absTick & 0x80 != 0) ratio = (ratio * 0xfe5dee046a99a2a811c461f1969c3053) >> 128;\n if (absTick & 0x100 != 0) ratio = (ratio * 0xfcbe86c7900a88aedcffc83b479aa3a4) >> 128;\n if (absTick & 0x200 != 0) ratio = (ratio * 0xf987a7253ac413176f2b074cf7815e54) >> 128;\n if (absTick & 0x400 != 0) ratio = (ratio * 0xf3392b0822b70005940c7a398e4b70f3) >> 128;\n if (absTick & 0x800 != 0) ratio = (ratio * 0xe7159475a2c29b7443b29c7fa6e889d9) >> 128;\n if (absTick & 0x1000 != 0) ratio = (ratio * 0xd097f3bdfd2022b8845ad8f792aa5825) >> 128;\n if (absTick & 0x2000 != 0) ratio = (ratio * 0xa9f746462d870fdf8a65dc1f90e061e5) >> 128;\n if (absTick & 0x4000 != 0) ratio = (ratio * 0x70d869a156d2a1b890bb3df62baf32f7) >> 128;\n if (absTick & 0x8000 != 0) ratio = (ratio * 0x31be135f97d08fd981231505542fcfa6) >> 128;\n if (absTick & 0x10000 != 0) ratio = (ratio * 0x9aa508b5b7a84e1c677de54f3e99bc9) >> 128;\n if (absTick & 0x20000 != 0) ratio = (ratio * 0x5d6af8dedb81196699c329225ee604) >> 128;\n if (absTick & 0x40000 != 0) ratio = (ratio * 0x2216e584f5fa1ea926041bedfe98) >> 128;\n if (absTick & 0x80000 != 0) ratio = (ratio * 0x48a170391f7dc42444e8fa2) >> 128;\n\n if (tick > 0) ratio = type(uint256).max / ratio;\n\n // Divides by 1<<32 rounding up to go from a Q128.128 to a Q128.96.\n // we then downcast because we know the result always fits within 160 bits due to our tick input constraint\n // we round up in the division so getTickAtSqrtRatio of the output price is always consistent\n sqrtPriceX96 = uint160((ratio >> 32) + (ratio % (1 << 32) == 0 ? 0 : 1));\n }\n\n /// @notice Calculates the greatest tick value such that getRatioAtTick(tick) <= ratio\n /// @dev Throws in case sqrtPriceX96 < MIN_SQRT_RATIO, as MIN_SQRT_RATIO is the lowest value getRatioAtTick may ever return.\n /// @param sqrtPriceX96 The sqrt ratio for which to compute the tick as a Q64.96\n /// @return tick The greatest tick for which the ratio is less than or equal to the input ratio\n function getTickAtSqrtRatio(uint160 sqrtPriceX96) internal pure returns (int24 tick) {\n // Second inequality must be < because the price can never reach the price at the max tick\n require(sqrtPriceX96 >= MIN_SQRT_RATIO && sqrtPriceX96 < MAX_SQRT_RATIO, 'R');\n uint256 ratio = uint256(sqrtPriceX96) << 32;\n\n uint256 r = ratio;\n uint256 msb = 0;\n\n assembly {\n let f := shl(7, gt(r, 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF))\n msb := or(msb, f)\n r := shr(f, r)\n }\n assembly {\n let f := shl(6, gt(r, 0xFFFFFFFFFFFFFFFF))\n msb := or(msb, f)\n r := shr(f, r)\n }\n assembly {\n let f := shl(5, gt(r, 0xFFFFFFFF))\n msb := or(msb, f)\n r := shr(f, r)\n }\n assembly {\n let f := shl(4, gt(r, 0xFFFF))\n msb := or(msb, f)\n r := shr(f, r)\n }\n assembly {\n let f := shl(3, gt(r, 0xFF))\n msb := or(msb, f)\n r := shr(f, r)\n }\n assembly {\n let f := shl(2, gt(r, 0xF))\n msb := or(msb, f)\n r := shr(f, r)\n }\n assembly {\n let f := shl(1, gt(r, 0x3))\n msb := or(msb, f)\n r := shr(f, r)\n }\n assembly {\n let f := gt(r, 0x1)\n msb := or(msb, f)\n }\n\n if (msb >= 128) r = ratio >> (msb - 127);\n else r = ratio << (127 - msb);\n\n int256 log_2 = (int256(msb) - 128) << 64;\n\n assembly {\n r := shr(127, mul(r, r))\n let f := shr(128, r)\n log_2 := or(log_2, shl(63, f))\n r := shr(f, r)\n }\n assembly {\n r := shr(127, mul(r, r))\n let f := shr(128, r)\n log_2 := or(log_2, shl(62, f))\n r := shr(f, r)\n }\n assembly {\n r := shr(127, mul(r, r))\n let f := shr(128, r)\n log_2 := or(log_2, shl(61, f))\n r := shr(f, r)\n }\n assembly {\n r := shr(127, mul(r, r))\n let f := shr(128, r)\n log_2 := or(log_2, shl(60, f))\n r := shr(f, r)\n }\n assembly {\n r := shr(127, mul(r, r))\n let f := shr(128, r)\n log_2 := or(log_2, shl(59, f))\n r := shr(f, r)\n }\n assembly {\n r := shr(127, mul(r, r))\n let f := shr(128, r)\n log_2 := or(log_2, shl(58, f))\n r := shr(f, r)\n }\n assembly {\n r := shr(127, mul(r, r))\n let f := shr(128, r)\n log_2 := or(log_2, shl(57, f))\n r := shr(f, r)\n }\n assembly {\n r := shr(127, mul(r, r))\n let f := shr(128, r)\n log_2 := or(log_2, shl(56, f))\n r := shr(f, r)\n }\n assembly {\n r := shr(127, mul(r, r))\n let f := shr(128, r)\n log_2 := or(log_2, shl(55, f))\n r := shr(f, r)\n }\n assembly {\n r := shr(127, mul(r, r))\n let f := shr(128, r)\n log_2 := or(log_2, shl(54, f))\n r := shr(f, r)\n }\n assembly {\n r := shr(127, mul(r, r))\n let f := shr(128, r)\n log_2 := or(log_2, shl(53, f))\n r := shr(f, r)\n }\n assembly {\n r := shr(127, mul(r, r))\n let f := shr(128, r)\n log_2 := or(log_2, shl(52, f))\n r := shr(f, r)\n }\n assembly {\n r := shr(127, mul(r, r))\n let f := shr(128, r)\n log_2 := or(log_2, shl(51, f))\n r := shr(f, r)\n }\n assembly {\n r := shr(127, mul(r, r))\n let f := shr(128, r)\n log_2 := or(log_2, shl(50, f))\n }\n\n int256 log_sqrt10001 = log_2 * 255738958999603826347141; // 128.128 number\n\n int24 tickLow = int24((log_sqrt10001 - 3402992956809132418596140100660247210) >> 128);\n int24 tickHi = int24((log_sqrt10001 + 291339464771989622907027621153398088495) >> 128);\n\n tick = tickLow == tickHi ? tickLow : getSqrtRatioAtTick(tickHi) <= sqrtPriceX96 ? tickHi : tickLow;\n }\n}\n" - }, - "@uniswap/v3-core/contracts/interfaces/IUniswapV3Pool.sol": { - "content": "// SPDX-License-Identifier: GPL-2.0-or-later\npragma solidity >=0.5.0;\n\nimport './pool/IUniswapV3PoolImmutables.sol';\nimport './pool/IUniswapV3PoolState.sol';\nimport './pool/IUniswapV3PoolDerivedState.sol';\nimport './pool/IUniswapV3PoolActions.sol';\nimport './pool/IUniswapV3PoolOwnerActions.sol';\nimport './pool/IUniswapV3PoolEvents.sol';\n\n/// @title The interface for a Uniswap V3 Pool\n/// @notice A Uniswap pool facilitates swapping and automated market making between any two assets that strictly conform\n/// to the ERC20 specification\n/// @dev The pool interface is broken up into many smaller pieces\ninterface IUniswapV3Pool is\n IUniswapV3PoolImmutables,\n IUniswapV3PoolState,\n IUniswapV3PoolDerivedState,\n IUniswapV3PoolActions,\n IUniswapV3PoolOwnerActions,\n IUniswapV3PoolEvents\n{\n\n}\n" - }, - "@uniswap/v3-core/contracts/interfaces/pool/IUniswapV3PoolImmutables.sol": { - "content": "// SPDX-License-Identifier: GPL-2.0-or-later\npragma solidity >=0.5.0;\n\n/// @title Pool state that never changes\n/// @notice These parameters are fixed for a pool forever, i.e., the methods will always return the same values\ninterface IUniswapV3PoolImmutables {\n /// @notice The contract that deployed the pool, which must adhere to the IUniswapV3Factory interface\n /// @return The contract address\n function factory() external view returns (address);\n\n /// @notice The first of the two tokens of the pool, sorted by address\n /// @return The token contract address\n function token0() external view returns (address);\n\n /// @notice The second of the two tokens of the pool, sorted by address\n /// @return The token contract address\n function token1() external view returns (address);\n\n /// @notice The pool's fee in hundredths of a bip, i.e. 1e-6\n /// @return The fee\n function fee() external view returns (uint24);\n\n /// @notice The pool tick spacing\n /// @dev Ticks can only be used at multiples of this value, minimum of 1 and always positive\n /// e.g.: a tickSpacing of 3 means ticks can be initialized every 3rd tick, i.e., ..., -6, -3, 0, 3, 6, ...\n /// This value is an int24 to avoid casting even though it is always positive.\n /// @return The tick spacing\n function tickSpacing() external view returns (int24);\n\n /// @notice The maximum amount of position liquidity that can use any tick in the range\n /// @dev This parameter is enforced per tick to prevent liquidity from overflowing a uint128 at any point, and\n /// also prevents out-of-range liquidity from being used to prevent adding in-range liquidity to a pool\n /// @return The max amount of liquidity per tick\n function maxLiquidityPerTick() external view returns (uint128);\n}\n" - }, - "@uniswap/v3-core/contracts/interfaces/pool/IUniswapV3PoolState.sol": { - "content": "// SPDX-License-Identifier: GPL-2.0-or-later\npragma solidity >=0.5.0;\n\n/// @title Pool state that can change\n/// @notice These methods compose the pool's state, and can change with any frequency including multiple times\n/// per transaction\ninterface IUniswapV3PoolState {\n /// @notice The 0th storage slot in the pool stores many values, and is exposed as a single method to save gas\n /// when accessed externally.\n /// @return sqrtPriceX96 The current price of the pool as a sqrt(token1/token0) Q64.96 value\n /// tick The current tick of the pool, i.e. according to the last tick transition that was run.\n /// This value may not always be equal to SqrtTickMath.getTickAtSqrtRatio(sqrtPriceX96) if the price is on a tick\n /// boundary.\n /// observationIndex The index of the last oracle observation that was written,\n /// observationCardinality The current maximum number of observations stored in the pool,\n /// observationCardinalityNext The next maximum number of observations, to be updated when the observation.\n /// feeProtocol The protocol fee for both tokens of the pool.\n /// Encoded as two 4 bit values, where the protocol fee of token1 is shifted 4 bits and the protocol fee of token0\n /// is the lower 4 bits. Used as the denominator of a fraction of the swap fee, e.g. 4 means 1/4th of the swap fee.\n /// unlocked Whether the pool is currently locked to reentrancy\n function slot0()\n external\n view\n returns (\n uint160 sqrtPriceX96,\n int24 tick,\n uint16 observationIndex,\n uint16 observationCardinality,\n uint16 observationCardinalityNext,\n uint8 feeProtocol,\n bool unlocked\n );\n\n /// @notice The fee growth as a Q128.128 fees of token0 collected per unit of liquidity for the entire life of the pool\n /// @dev This value can overflow the uint256\n function feeGrowthGlobal0X128() external view returns (uint256);\n\n /// @notice The fee growth as a Q128.128 fees of token1 collected per unit of liquidity for the entire life of the pool\n /// @dev This value can overflow the uint256\n function feeGrowthGlobal1X128() external view returns (uint256);\n\n /// @notice The amounts of token0 and token1 that are owed to the protocol\n /// @dev Protocol fees will never exceed uint128 max in either token\n function protocolFees() external view returns (uint128 token0, uint128 token1);\n\n /// @notice The currently in range liquidity available to the pool\n /// @dev This value has no relationship to the total liquidity across all ticks\n function liquidity() external view returns (uint128);\n\n /// @notice Look up information about a specific tick in the pool\n /// @param tick The tick to look up\n /// @return liquidityGross the total amount of position liquidity that uses the pool either as tick lower or\n /// tick upper,\n /// liquidityNet how much liquidity changes when the pool price crosses the tick,\n /// feeGrowthOutside0X128 the fee growth on the other side of the tick from the current tick in token0,\n /// feeGrowthOutside1X128 the fee growth on the other side of the tick from the current tick in token1,\n /// tickCumulativeOutside the cumulative tick value on the other side of the tick from the current tick\n /// secondsPerLiquidityOutsideX128 the seconds spent per liquidity on the other side of the tick from the current tick,\n /// secondsOutside the seconds spent on the other side of the tick from the current tick,\n /// initialized Set to true if the tick is initialized, i.e. liquidityGross is greater than 0, otherwise equal to false.\n /// Outside values can only be used if the tick is initialized, i.e. if liquidityGross is greater than 0.\n /// In addition, these values are only relative and must be used only in comparison to previous snapshots for\n /// a specific position.\n function ticks(int24 tick)\n external\n view\n returns (\n uint128 liquidityGross,\n int128 liquidityNet,\n uint256 feeGrowthOutside0X128,\n uint256 feeGrowthOutside1X128,\n int56 tickCumulativeOutside,\n uint160 secondsPerLiquidityOutsideX128,\n uint32 secondsOutside,\n bool initialized\n );\n\n /// @notice Returns 256 packed tick initialized boolean values. See TickBitmap for more information\n function tickBitmap(int16 wordPosition) external view returns (uint256);\n\n /// @notice Returns the information about a position by the position's key\n /// @param key The position's key is a hash of a preimage composed by the owner, tickLower and tickUpper\n /// @return _liquidity The amount of liquidity in the position,\n /// Returns feeGrowthInside0LastX128 fee growth of token0 inside the tick range as of the last mint/burn/poke,\n /// Returns feeGrowthInside1LastX128 fee growth of token1 inside the tick range as of the last mint/burn/poke,\n /// Returns tokensOwed0 the computed amount of token0 owed to the position as of the last mint/burn/poke,\n /// Returns tokensOwed1 the computed amount of token1 owed to the position as of the last mint/burn/poke\n function positions(bytes32 key)\n external\n view\n returns (\n uint128 _liquidity,\n uint256 feeGrowthInside0LastX128,\n uint256 feeGrowthInside1LastX128,\n uint128 tokensOwed0,\n uint128 tokensOwed1\n );\n\n /// @notice Returns data about a specific observation index\n /// @param index The element of the observations array to fetch\n /// @dev You most likely want to use #observe() instead of this method to get an observation as of some amount of time\n /// ago, rather than at a specific index in the array.\n /// @return blockTimestamp The timestamp of the observation,\n /// Returns tickCumulative the tick multiplied by seconds elapsed for the life of the pool as of the observation timestamp,\n /// Returns secondsPerLiquidityCumulativeX128 the seconds per in range liquidity for the life of the pool as of the observation timestamp,\n /// Returns initialized whether the observation has been initialized and the values are safe to use\n function observations(uint256 index)\n external\n view\n returns (\n uint32 blockTimestamp,\n int56 tickCumulative,\n uint160 secondsPerLiquidityCumulativeX128,\n bool initialized\n );\n}\n" - }, - "@uniswap/v3-core/contracts/interfaces/pool/IUniswapV3PoolDerivedState.sol": { - "content": "// SPDX-License-Identifier: GPL-2.0-or-later\npragma solidity >=0.5.0;\n\n/// @title Pool state that is not stored\n/// @notice Contains view functions to provide information about the pool that is computed rather than stored on the\n/// blockchain. The functions here may have variable gas costs.\ninterface IUniswapV3PoolDerivedState {\n /// @notice Returns the cumulative tick and liquidity as of each timestamp `secondsAgo` from the current block timestamp\n /// @dev To get a time weighted average tick or liquidity-in-range, you must call this with two values, one representing\n /// the beginning of the period and another for the end of the period. E.g., to get the last hour time-weighted average tick,\n /// you must call it with secondsAgos = [3600, 0].\n /// @dev The time weighted average tick represents the geometric time weighted average price of the pool, in\n /// log base sqrt(1.0001) of token1 / token0. The TickMath library can be used to go from a tick value to a ratio.\n /// @param secondsAgos From how long ago each cumulative tick and liquidity value should be returned\n /// @return tickCumulatives Cumulative tick values as of each `secondsAgos` from the current block timestamp\n /// @return secondsPerLiquidityCumulativeX128s Cumulative seconds per liquidity-in-range value as of each `secondsAgos` from the current block\n /// timestamp\n function observe(uint32[] calldata secondsAgos)\n external\n view\n returns (int56[] memory tickCumulatives, uint160[] memory secondsPerLiquidityCumulativeX128s);\n\n /// @notice Returns a snapshot of the tick cumulative, seconds per liquidity and seconds inside a tick range\n /// @dev Snapshots must only be compared to other snapshots, taken over a period for which a position existed.\n /// I.e., snapshots cannot be compared if a position is not held for the entire period between when the first\n /// snapshot is taken and the second snapshot is taken.\n /// @param tickLower The lower tick of the range\n /// @param tickUpper The upper tick of the range\n /// @return tickCumulativeInside The snapshot of the tick accumulator for the range\n /// @return secondsPerLiquidityInsideX128 The snapshot of seconds per liquidity for the range\n /// @return secondsInside The snapshot of seconds per liquidity for the range\n function snapshotCumulativesInside(int24 tickLower, int24 tickUpper)\n external\n view\n returns (\n int56 tickCumulativeInside,\n uint160 secondsPerLiquidityInsideX128,\n uint32 secondsInside\n );\n}\n" - }, - "@uniswap/v3-core/contracts/interfaces/pool/IUniswapV3PoolActions.sol": { - "content": "// SPDX-License-Identifier: GPL-2.0-or-later\npragma solidity >=0.5.0;\n\n/// @title Permissionless pool actions\n/// @notice Contains pool methods that can be called by anyone\ninterface IUniswapV3PoolActions {\n /// @notice Sets the initial price for the pool\n /// @dev Price is represented as a sqrt(amountToken1/amountToken0) Q64.96 value\n /// @param sqrtPriceX96 the initial sqrt price of the pool as a Q64.96\n function initialize(uint160 sqrtPriceX96) external;\n\n /// @notice Adds liquidity for the given recipient/tickLower/tickUpper position\n /// @dev The caller of this method receives a callback in the form of IUniswapV3MintCallback#uniswapV3MintCallback\n /// in which they must pay any token0 or token1 owed for the liquidity. The amount of token0/token1 due depends\n /// on tickLower, tickUpper, the amount of liquidity, and the current price.\n /// @param recipient The address for which the liquidity will be created\n /// @param tickLower The lower tick of the position in which to add liquidity\n /// @param tickUpper The upper tick of the position in which to add liquidity\n /// @param amount The amount of liquidity to mint\n /// @param data Any data that should be passed through to the callback\n /// @return amount0 The amount of token0 that was paid to mint the given amount of liquidity. Matches the value in the callback\n /// @return amount1 The amount of token1 that was paid to mint the given amount of liquidity. Matches the value in the callback\n function mint(\n address recipient,\n int24 tickLower,\n int24 tickUpper,\n uint128 amount,\n bytes calldata data\n ) external returns (uint256 amount0, uint256 amount1);\n\n /// @notice Collects tokens owed to a position\n /// @dev Does not recompute fees earned, which must be done either via mint or burn of any amount of liquidity.\n /// Collect must be called by the position owner. To withdraw only token0 or only token1, amount0Requested or\n /// amount1Requested may be set to zero. To withdraw all tokens owed, caller may pass any value greater than the\n /// actual tokens owed, e.g. type(uint128).max. Tokens owed may be from accumulated swap fees or burned liquidity.\n /// @param recipient The address which should receive the fees collected\n /// @param tickLower The lower tick of the position for which to collect fees\n /// @param tickUpper The upper tick of the position for which to collect fees\n /// @param amount0Requested How much token0 should be withdrawn from the fees owed\n /// @param amount1Requested How much token1 should be withdrawn from the fees owed\n /// @return amount0 The amount of fees collected in token0\n /// @return amount1 The amount of fees collected in token1\n function collect(\n address recipient,\n int24 tickLower,\n int24 tickUpper,\n uint128 amount0Requested,\n uint128 amount1Requested\n ) external returns (uint128 amount0, uint128 amount1);\n\n /// @notice Burn liquidity from the sender and account tokens owed for the liquidity to the position\n /// @dev Can be used to trigger a recalculation of fees owed to a position by calling with an amount of 0\n /// @dev Fees must be collected separately via a call to #collect\n /// @param tickLower The lower tick of the position for which to burn liquidity\n /// @param tickUpper The upper tick of the position for which to burn liquidity\n /// @param amount How much liquidity to burn\n /// @return amount0 The amount of token0 sent to the recipient\n /// @return amount1 The amount of token1 sent to the recipient\n function burn(\n int24 tickLower,\n int24 tickUpper,\n uint128 amount\n ) external returns (uint256 amount0, uint256 amount1);\n\n /// @notice Swap token0 for token1, or token1 for token0\n /// @dev The caller of this method receives a callback in the form of IUniswapV3SwapCallback#uniswapV3SwapCallback\n /// @param recipient The address to receive the output of the swap\n /// @param zeroForOne The direction of the swap, true for token0 to token1, false for token1 to token0\n /// @param amountSpecified The amount of the swap, which implicitly configures the swap as exact input (positive), or exact output (negative)\n /// @param sqrtPriceLimitX96 The Q64.96 sqrt price limit. If zero for one, the price cannot be less than this\n /// value after the swap. If one for zero, the price cannot be greater than this value after the swap\n /// @param data Any data to be passed through to the callback\n /// @return amount0 The delta of the balance of token0 of the pool, exact when negative, minimum when positive\n /// @return amount1 The delta of the balance of token1 of the pool, exact when negative, minimum when positive\n function swap(\n address recipient,\n bool zeroForOne,\n int256 amountSpecified,\n uint160 sqrtPriceLimitX96,\n bytes calldata data\n ) external returns (int256 amount0, int256 amount1);\n\n /// @notice Receive token0 and/or token1 and pay it back, plus a fee, in the callback\n /// @dev The caller of this method receives a callback in the form of IUniswapV3FlashCallback#uniswapV3FlashCallback\n /// @dev Can be used to donate underlying tokens pro-rata to currently in-range liquidity providers by calling\n /// with 0 amount{0,1} and sending the donation amount(s) from the callback\n /// @param recipient The address which will receive the token0 and token1 amounts\n /// @param amount0 The amount of token0 to send\n /// @param amount1 The amount of token1 to send\n /// @param data Any data to be passed through to the callback\n function flash(\n address recipient,\n uint256 amount0,\n uint256 amount1,\n bytes calldata data\n ) external;\n\n /// @notice Increase the maximum number of price and liquidity observations that this pool will store\n /// @dev This method is no-op if the pool already has an observationCardinalityNext greater than or equal to\n /// the input observationCardinalityNext.\n /// @param observationCardinalityNext The desired minimum number of observations for the pool to store\n function increaseObservationCardinalityNext(uint16 observationCardinalityNext) external;\n}\n" - }, - "@uniswap/v3-core/contracts/interfaces/pool/IUniswapV3PoolOwnerActions.sol": { - "content": "// SPDX-License-Identifier: GPL-2.0-or-later\npragma solidity >=0.5.0;\n\n/// @title Permissioned pool actions\n/// @notice Contains pool methods that may only be called by the factory owner\ninterface IUniswapV3PoolOwnerActions {\n /// @notice Set the denominator of the protocol's % share of the fees\n /// @param feeProtocol0 new protocol fee for token0 of the pool\n /// @param feeProtocol1 new protocol fee for token1 of the pool\n function setFeeProtocol(uint8 feeProtocol0, uint8 feeProtocol1) external;\n\n /// @notice Collect the protocol fee accrued to the pool\n /// @param recipient The address to which collected protocol fees should be sent\n /// @param amount0Requested The maximum amount of token0 to send, can be 0 to collect fees in only token1\n /// @param amount1Requested The maximum amount of token1 to send, can be 0 to collect fees in only token0\n /// @return amount0 The protocol fee collected in token0\n /// @return amount1 The protocol fee collected in token1\n function collectProtocol(\n address recipient,\n uint128 amount0Requested,\n uint128 amount1Requested\n ) external returns (uint128 amount0, uint128 amount1);\n}\n" - }, - "@uniswap/v3-core/contracts/interfaces/pool/IUniswapV3PoolEvents.sol": { - "content": "// SPDX-License-Identifier: GPL-2.0-or-later\npragma solidity >=0.5.0;\n\n/// @title Events emitted by a pool\n/// @notice Contains all events emitted by the pool\ninterface IUniswapV3PoolEvents {\n /// @notice Emitted exactly once by a pool when #initialize is first called on the pool\n /// @dev Mint/Burn/Swap cannot be emitted by the pool before Initialize\n /// @param sqrtPriceX96 The initial sqrt price of the pool, as a Q64.96\n /// @param tick The initial tick of the pool, i.e. log base 1.0001 of the starting price of the pool\n event Initialize(uint160 sqrtPriceX96, int24 tick);\n\n /// @notice Emitted when liquidity is minted for a given position\n /// @param sender The address that minted the liquidity\n /// @param owner The owner of the position and recipient of any minted liquidity\n /// @param tickLower The lower tick of the position\n /// @param tickUpper The upper tick of the position\n /// @param amount The amount of liquidity minted to the position range\n /// @param amount0 How much token0 was required for the minted liquidity\n /// @param amount1 How much token1 was required for the minted liquidity\n event Mint(\n address sender,\n address indexed owner,\n int24 indexed tickLower,\n int24 indexed tickUpper,\n uint128 amount,\n uint256 amount0,\n uint256 amount1\n );\n\n /// @notice Emitted when fees are collected by the owner of a position\n /// @dev Collect events may be emitted with zero amount0 and amount1 when the caller chooses not to collect fees\n /// @param owner The owner of the position for which fees are collected\n /// @param tickLower The lower tick of the position\n /// @param tickUpper The upper tick of the position\n /// @param amount0 The amount of token0 fees collected\n /// @param amount1 The amount of token1 fees collected\n event Collect(\n address indexed owner,\n address recipient,\n int24 indexed tickLower,\n int24 indexed tickUpper,\n uint128 amount0,\n uint128 amount1\n );\n\n /// @notice Emitted when a position's liquidity is removed\n /// @dev Does not withdraw any fees earned by the liquidity position, which must be withdrawn via #collect\n /// @param owner The owner of the position for which liquidity is removed\n /// @param tickLower The lower tick of the position\n /// @param tickUpper The upper tick of the position\n /// @param amount The amount of liquidity to remove\n /// @param amount0 The amount of token0 withdrawn\n /// @param amount1 The amount of token1 withdrawn\n event Burn(\n address indexed owner,\n int24 indexed tickLower,\n int24 indexed tickUpper,\n uint128 amount,\n uint256 amount0,\n uint256 amount1\n );\n\n /// @notice Emitted by the pool for any swaps between token0 and token1\n /// @param sender The address that initiated the swap call, and that received the callback\n /// @param recipient The address that received the output of the swap\n /// @param amount0 The delta of the token0 balance of the pool\n /// @param amount1 The delta of the token1 balance of the pool\n /// @param sqrtPriceX96 The sqrt(price) of the pool after the swap, as a Q64.96\n /// @param liquidity The liquidity of the pool after the swap\n /// @param tick The log base 1.0001 of price of the pool after the swap\n event Swap(\n address indexed sender,\n address indexed recipient,\n int256 amount0,\n int256 amount1,\n uint160 sqrtPriceX96,\n uint128 liquidity,\n int24 tick\n );\n\n /// @notice Emitted by the pool for any flashes of token0/token1\n /// @param sender The address that initiated the swap call, and that received the callback\n /// @param recipient The address that received the tokens from flash\n /// @param amount0 The amount of token0 that was flashed\n /// @param amount1 The amount of token1 that was flashed\n /// @param paid0 The amount of token0 paid for the flash, which can exceed the amount0 plus the fee\n /// @param paid1 The amount of token1 paid for the flash, which can exceed the amount1 plus the fee\n event Flash(\n address indexed sender,\n address indexed recipient,\n uint256 amount0,\n uint256 amount1,\n uint256 paid0,\n uint256 paid1\n );\n\n /// @notice Emitted by the pool for increases to the number of observations that can be stored\n /// @dev observationCardinalityNext is not the observation cardinality until an observation is written at the index\n /// just before a mint/swap/burn.\n /// @param observationCardinalityNextOld The previous value of the next observation cardinality\n /// @param observationCardinalityNextNew The updated value of the next observation cardinality\n event IncreaseObservationCardinalityNext(\n uint16 observationCardinalityNextOld,\n uint16 observationCardinalityNextNew\n );\n\n /// @notice Emitted when the protocol fee is changed by the pool\n /// @param feeProtocol0Old The previous value of the token0 protocol fee\n /// @param feeProtocol1Old The previous value of the token1 protocol fee\n /// @param feeProtocol0New The updated value of the token0 protocol fee\n /// @param feeProtocol1New The updated value of the token1 protocol fee\n event SetFeeProtocol(uint8 feeProtocol0Old, uint8 feeProtocol1Old, uint8 feeProtocol0New, uint8 feeProtocol1New);\n\n /// @notice Emitted when the collected protocol fees are withdrawn by the factory owner\n /// @param sender The address that collects the protocol fees\n /// @param recipient The address that receives the collected protocol fees\n /// @param amount0 The amount of token0 protocol fees that is withdrawn\n /// @param amount0 The amount of token1 protocol fees that is withdrawn\n event CollectProtocol(address indexed sender, address indexed recipient, uint128 amount0, uint128 amount1);\n}\n" - }, - "solidity/for-test/UniV3PairManagerForTest.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '@openzeppelin/contracts/token/ERC20/ERC20.sol';\nimport '@uniswap/v3-core/contracts/interfaces/IUniswapV3Pool.sol';\n\nimport '../contracts/libraries/LiquidityAmounts.sol';\nimport '../contracts/libraries/FixedPoint96.sol';\nimport '../contracts/libraries/FullMath.sol';\nimport '../contracts/libraries/TickMath.sol';\nimport '../contracts/UniV3PairManager.sol';\nimport '../interfaces/external/IWeth9.sol';\nimport '../interfaces/IUniV3PairManager.sol';\n\ncontract UniV3PairManagerForTest is UniV3PairManager {\n constructor(address _pool, address _governance) UniV3PairManager(_pool, _governance) {}\n\n function internalAddLiquidity(\n uint256 amount0Desired,\n uint256 amount1Desired,\n uint256 amount0Min,\n uint256 amount1Min\n )\n external\n returns (\n uint128 liquidity,\n uint256 amount0,\n uint256 amount1\n )\n {\n return _addLiquidity(amount0Desired, amount1Desired, amount0Min, amount1Min);\n }\n\n function internalPay(\n address token,\n address payer,\n address recipient,\n uint256 value\n ) external {\n return _pay(token, payer, recipient, value);\n }\n\n function internalMint(address dst, uint256 amount) external {\n return _mint(dst, amount);\n }\n\n function internalBurn(address dst, uint256 amount) external {\n return _burn(dst, amount);\n }\n\n function internalTransferTokens(\n address src,\n address dst,\n uint256 amount\n ) external {\n _transferTokens(src, dst, amount);\n }\n\n function internalSafeTransferFrom(\n address token,\n address from,\n address to,\n uint256 value\n ) external {\n _safeTransferFrom(token, from, to, value);\n }\n\n receive() external payable {}\n}\n" - }, - "@openzeppelin/contracts/token/ERC20/ERC20.sol": { - "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\nimport \"./IERC20.sol\";\nimport \"./extensions/IERC20Metadata.sol\";\nimport \"../../utils/Context.sol\";\n\n/**\n * @dev Implementation of the {IERC20} interface.\n *\n * This implementation is agnostic to the way tokens are created. This means\n * that a supply mechanism has to be added in a derived contract using {_mint}.\n * For a generic mechanism see {ERC20PresetMinterPauser}.\n *\n * TIP: For a detailed writeup see our guide\n * https://forum.zeppelin.solutions/t/how-to-implement-erc20-supply-mechanisms/226[How\n * to implement supply mechanisms].\n *\n * We have followed general OpenZeppelin Contracts guidelines: functions revert\n * instead returning `false` on failure. This behavior is nonetheless\n * conventional and does not conflict with the expectations of ERC20\n * applications.\n *\n * Additionally, an {Approval} event is emitted on calls to {transferFrom}.\n * This allows applications to reconstruct the allowance for all accounts just\n * by listening to said events. Other implementations of the EIP may not emit\n * these events, as it isn't required by the specification.\n *\n * Finally, the non-standard {decreaseAllowance} and {increaseAllowance}\n * functions have been added to mitigate the well-known issues around setting\n * allowances. See {IERC20-approve}.\n */\ncontract ERC20 is Context, IERC20, IERC20Metadata {\n mapping(address => uint256) private _balances;\n\n mapping(address => mapping(address => uint256)) private _allowances;\n\n uint256 private _totalSupply;\n\n string private _name;\n string private _symbol;\n\n /**\n * @dev Sets the values for {name} and {symbol}.\n *\n * The default value of {decimals} is 18. To select a different value for\n * {decimals} you should overload it.\n *\n * All two of these values are immutable: they can only be set once during\n * construction.\n */\n constructor(string memory name_, string memory symbol_) {\n _name = name_;\n _symbol = symbol_;\n }\n\n /**\n * @dev Returns the name of the token.\n */\n function name() public view virtual override returns (string memory) {\n return _name;\n }\n\n /**\n * @dev Returns the symbol of the token, usually a shorter version of the\n * name.\n */\n function symbol() public view virtual override returns (string memory) {\n return _symbol;\n }\n\n /**\n * @dev Returns the number of decimals used to get its user representation.\n * For example, if `decimals` equals `2`, a balance of `505` tokens should\n * be displayed to a user as `5.05` (`505 / 10 ** 2`).\n *\n * Tokens usually opt for a value of 18, imitating the relationship between\n * Ether and Wei. This is the value {ERC20} uses, unless this function is\n * overridden;\n *\n * NOTE: This information is only used for _display_ purposes: it in\n * no way affects any of the arithmetic of the contract, including\n * {IERC20-balanceOf} and {IERC20-transfer}.\n */\n function decimals() public view virtual override returns (uint8) {\n return 18;\n }\n\n /**\n * @dev See {IERC20-totalSupply}.\n */\n function totalSupply() public view virtual override returns (uint256) {\n return _totalSupply;\n }\n\n /**\n * @dev See {IERC20-balanceOf}.\n */\n function balanceOf(address account) public view virtual override returns (uint256) {\n return _balances[account];\n }\n\n /**\n * @dev See {IERC20-transfer}.\n *\n * Requirements:\n *\n * - `recipient` cannot be the zero address.\n * - the caller must have a balance of at least `amount`.\n */\n function transfer(address recipient, uint256 amount) public virtual override returns (bool) {\n _transfer(_msgSender(), recipient, amount);\n return true;\n }\n\n /**\n * @dev See {IERC20-allowance}.\n */\n function allowance(address owner, address spender) public view virtual override returns (uint256) {\n return _allowances[owner][spender];\n }\n\n /**\n * @dev See {IERC20-approve}.\n *\n * Requirements:\n *\n * - `spender` cannot be the zero address.\n */\n function approve(address spender, uint256 amount) public virtual override returns (bool) {\n _approve(_msgSender(), spender, amount);\n return true;\n }\n\n /**\n * @dev See {IERC20-transferFrom}.\n *\n * Emits an {Approval} event indicating the updated allowance. This is not\n * required by the EIP. See the note at the beginning of {ERC20}.\n *\n * Requirements:\n *\n * - `sender` and `recipient` cannot be the zero address.\n * - `sender` must have a balance of at least `amount`.\n * - the caller must have allowance for ``sender``'s tokens of at least\n * `amount`.\n */\n function transferFrom(\n address sender,\n address recipient,\n uint256 amount\n ) public virtual override returns (bool) {\n _transfer(sender, recipient, amount);\n\n uint256 currentAllowance = _allowances[sender][_msgSender()];\n require(currentAllowance >= amount, \"ERC20: transfer amount exceeds allowance\");\n unchecked {\n _approve(sender, _msgSender(), currentAllowance - amount);\n }\n\n return true;\n }\n\n /**\n * @dev Atomically increases the allowance granted to `spender` by the caller.\n *\n * This is an alternative to {approve} that can be used as a mitigation for\n * problems described in {IERC20-approve}.\n *\n * Emits an {Approval} event indicating the updated allowance.\n *\n * Requirements:\n *\n * - `spender` cannot be the zero address.\n */\n function increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool) {\n _approve(_msgSender(), spender, _allowances[_msgSender()][spender] + addedValue);\n return true;\n }\n\n /**\n * @dev Atomically decreases the allowance granted to `spender` by the caller.\n *\n * This is an alternative to {approve} that can be used as a mitigation for\n * problems described in {IERC20-approve}.\n *\n * Emits an {Approval} event indicating the updated allowance.\n *\n * Requirements:\n *\n * - `spender` cannot be the zero address.\n * - `spender` must have allowance for the caller of at least\n * `subtractedValue`.\n */\n function decreaseAllowance(address spender, uint256 subtractedValue) public virtual returns (bool) {\n uint256 currentAllowance = _allowances[_msgSender()][spender];\n require(currentAllowance >= subtractedValue, \"ERC20: decreased allowance below zero\");\n unchecked {\n _approve(_msgSender(), spender, currentAllowance - subtractedValue);\n }\n\n return true;\n }\n\n /**\n * @dev Moves `amount` of tokens from `sender` to `recipient`.\n *\n * This internal function is equivalent to {transfer}, and can be used to\n * e.g. implement automatic token fees, slashing mechanisms, etc.\n *\n * Emits a {Transfer} event.\n *\n * Requirements:\n *\n * - `sender` cannot be the zero address.\n * - `recipient` cannot be the zero address.\n * - `sender` must have a balance of at least `amount`.\n */\n function _transfer(\n address sender,\n address recipient,\n uint256 amount\n ) internal virtual {\n require(sender != address(0), \"ERC20: transfer from the zero address\");\n require(recipient != address(0), \"ERC20: transfer to the zero address\");\n\n _beforeTokenTransfer(sender, recipient, amount);\n\n uint256 senderBalance = _balances[sender];\n require(senderBalance >= amount, \"ERC20: transfer amount exceeds balance\");\n unchecked {\n _balances[sender] = senderBalance - amount;\n }\n _balances[recipient] += amount;\n\n emit Transfer(sender, recipient, amount);\n\n _afterTokenTransfer(sender, recipient, amount);\n }\n\n /** @dev Creates `amount` tokens and assigns them to `account`, increasing\n * the total supply.\n *\n * Emits a {Transfer} event with `from` set to the zero address.\n *\n * Requirements:\n *\n * - `account` cannot be the zero address.\n */\n function _mint(address account, uint256 amount) internal virtual {\n require(account != address(0), \"ERC20: mint to the zero address\");\n\n _beforeTokenTransfer(address(0), account, amount);\n\n _totalSupply += amount;\n _balances[account] += amount;\n emit Transfer(address(0), account, amount);\n\n _afterTokenTransfer(address(0), account, amount);\n }\n\n /**\n * @dev Destroys `amount` tokens from `account`, reducing the\n * total supply.\n *\n * Emits a {Transfer} event with `to` set to the zero address.\n *\n * Requirements:\n *\n * - `account` cannot be the zero address.\n * - `account` must have at least `amount` tokens.\n */\n function _burn(address account, uint256 amount) internal virtual {\n require(account != address(0), \"ERC20: burn from the zero address\");\n\n _beforeTokenTransfer(account, address(0), amount);\n\n uint256 accountBalance = _balances[account];\n require(accountBalance >= amount, \"ERC20: burn amount exceeds balance\");\n unchecked {\n _balances[account] = accountBalance - amount;\n }\n _totalSupply -= amount;\n\n emit Transfer(account, address(0), amount);\n\n _afterTokenTransfer(account, address(0), amount);\n }\n\n /**\n * @dev Sets `amount` as the allowance of `spender` over the `owner` s tokens.\n *\n * This internal function is equivalent to `approve`, and can be used to\n * e.g. set automatic allowances for certain subsystems, etc.\n *\n * Emits an {Approval} event.\n *\n * Requirements:\n *\n * - `owner` cannot be the zero address.\n * - `spender` cannot be the zero address.\n */\n function _approve(\n address owner,\n address spender,\n uint256 amount\n ) internal virtual {\n require(owner != address(0), \"ERC20: approve from the zero address\");\n require(spender != address(0), \"ERC20: approve to the zero address\");\n\n _allowances[owner][spender] = amount;\n emit Approval(owner, spender, amount);\n }\n\n /**\n * @dev Hook that is called before any transfer of tokens. This includes\n * minting and burning.\n *\n * Calling conditions:\n *\n * - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens\n * will be transferred to `to`.\n * - when `from` is zero, `amount` tokens will be minted for `to`.\n * - when `to` is zero, `amount` of ``from``'s tokens will be burned.\n * - `from` and `to` are never both zero.\n *\n * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].\n */\n function _beforeTokenTransfer(\n address from,\n address to,\n uint256 amount\n ) internal virtual {}\n\n /**\n * @dev Hook that is called after any transfer of tokens. This includes\n * minting and burning.\n *\n * Calling conditions:\n *\n * - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens\n * has been transferred to `to`.\n * - when `from` is zero, `amount` tokens have been minted for `to`.\n * - when `to` is zero, `amount` of ``from``'s tokens have been burned.\n * - `from` and `to` are never both zero.\n *\n * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].\n */\n function _afterTokenTransfer(\n address from,\n address to,\n uint256 amount\n ) internal virtual {}\n}\n" - }, - "solidity/contracts/libraries/LiquidityAmounts.sol": { - "content": "// SPDX-License-Identifier: GPL-2.0-or-later\npragma solidity >=0.8.4 <0.9.0;\n\nimport './FullMath.sol';\nimport './FixedPoint96.sol';\n\n// solhint-disable\nlibrary LiquidityAmounts {\n function toUint128(uint256 x) private pure returns (uint128 y) {\n require((y = uint128(x)) == x);\n }\n\n function getLiquidityForAmount0(\n uint160 sqrtRatioAX96,\n uint160 sqrtRatioBX96,\n uint256 amount0\n ) internal pure returns (uint128 liquidity) {\n if (sqrtRatioAX96 > sqrtRatioBX96) (sqrtRatioAX96, sqrtRatioBX96) = (sqrtRatioBX96, sqrtRatioAX96);\n uint256 intermediate = FullMath.mulDiv(sqrtRatioAX96, sqrtRatioBX96, FixedPoint96.Q96);\n return toUint128(FullMath.mulDiv(amount0, intermediate, sqrtRatioBX96 - sqrtRatioAX96));\n }\n\n function getLiquidityForAmount1(\n uint160 sqrtRatioAX96,\n uint160 sqrtRatioBX96,\n uint256 amount1\n ) internal pure returns (uint128 liquidity) {\n if (sqrtRatioAX96 > sqrtRatioBX96) (sqrtRatioAX96, sqrtRatioBX96) = (sqrtRatioBX96, sqrtRatioAX96);\n return toUint128(FullMath.mulDiv(amount1, FixedPoint96.Q96, sqrtRatioBX96 - sqrtRatioAX96));\n }\n\n function getLiquidityForAmounts(\n uint160 sqrtRatioX96,\n uint160 sqrtRatioAX96,\n uint160 sqrtRatioBX96,\n uint256 amount0,\n uint256 amount1\n ) internal pure returns (uint128 liquidity) {\n if (sqrtRatioAX96 > sqrtRatioBX96) (sqrtRatioAX96, sqrtRatioBX96) = (sqrtRatioBX96, sqrtRatioAX96);\n\n if (sqrtRatioX96 <= sqrtRatioAX96) {\n liquidity = getLiquidityForAmount0(sqrtRatioAX96, sqrtRatioBX96, amount0);\n } else if (sqrtRatioX96 < sqrtRatioBX96) {\n uint128 liquidity0 = getLiquidityForAmount0(sqrtRatioX96, sqrtRatioBX96, amount0);\n uint128 liquidity1 = getLiquidityForAmount1(sqrtRatioAX96, sqrtRatioX96, amount1);\n\n liquidity = liquidity0 < liquidity1 ? liquidity0 : liquidity1;\n } else {\n liquidity = getLiquidityForAmount1(sqrtRatioAX96, sqrtRatioBX96, amount1);\n }\n }\n\n function getAmount0ForLiquidity(\n uint160 sqrtRatioAX96,\n uint160 sqrtRatioBX96,\n uint128 liquidity\n ) internal pure returns (uint256 amount0) {\n if (sqrtRatioAX96 > sqrtRatioBX96) (sqrtRatioAX96, sqrtRatioBX96) = (sqrtRatioBX96, sqrtRatioAX96);\n\n return FullMath.mulDiv(uint256(liquidity) << FixedPoint96.RESOLUTION, sqrtRatioBX96 - sqrtRatioAX96, sqrtRatioBX96) / sqrtRatioAX96;\n }\n\n function getAmount1ForLiquidity(\n uint160 sqrtRatioAX96,\n uint160 sqrtRatioBX96,\n uint128 liquidity\n ) internal pure returns (uint256 amount1) {\n if (sqrtRatioAX96 > sqrtRatioBX96) (sqrtRatioAX96, sqrtRatioBX96) = (sqrtRatioBX96, sqrtRatioAX96);\n\n return FullMath.mulDiv(liquidity, sqrtRatioBX96 - sqrtRatioAX96, FixedPoint96.Q96);\n }\n\n function getAmountsForLiquidity(\n uint160 sqrtRatioX96,\n uint160 sqrtRatioAX96,\n uint160 sqrtRatioBX96,\n uint128 liquidity\n ) internal pure returns (uint256 amount0, uint256 amount1) {\n if (sqrtRatioAX96 > sqrtRatioBX96) (sqrtRatioAX96, sqrtRatioBX96) = (sqrtRatioBX96, sqrtRatioAX96);\n\n if (sqrtRatioX96 <= sqrtRatioAX96) {\n amount0 = getAmount0ForLiquidity(sqrtRatioAX96, sqrtRatioBX96, liquidity);\n } else if (sqrtRatioX96 < sqrtRatioBX96) {\n amount0 = getAmount0ForLiquidity(sqrtRatioX96, sqrtRatioBX96, liquidity);\n amount1 = getAmount1ForLiquidity(sqrtRatioAX96, sqrtRatioX96, liquidity);\n } else {\n amount1 = getAmount1ForLiquidity(sqrtRatioAX96, sqrtRatioBX96, liquidity);\n }\n }\n}\n" - }, - "solidity/contracts/libraries/FixedPoint96.sol": { - "content": "// SPDX-License-Identifier: GPL-2.0-or-later\npragma solidity >=0.8.4 <0.9.0;\n\nlibrary FixedPoint96 {\n // solhint-disable\n uint8 internal constant RESOLUTION = 96;\n uint256 internal constant Q96 = 0x1000000000000000000000000;\n}\n" - }, - "solidity/contracts/UniV3PairManager.sol": { - "content": "// SPDX-License-Identifier: MIT\n\n/*\n\nCoded for The Keep3r Network with ♥ by\n\n██████╗░███████╗███████╗██╗  ░██╗░░░░░░░██╗░█████╗░███╗░░██╗██████╗░███████╗██████╗░██╗░░░░░░█████╗░███╗░░██╗██████╗░\n██╔══██╗██╔════╝██╔════╝██║  ░██║░░██╗░░██║██╔══██╗████╗░██║██╔══██╗██╔════╝██╔══██╗██║░░░░░██╔══██╗████╗░██║██╔══██╗\n██║░░██║█████╗░░█████╗░░██║  ░╚██╗████╗██╔╝██║░░██║██╔██╗██║██║░░██║█████╗░░██████╔╝██║░░░░░███████║██╔██╗██║██║░░██║\n██║░░██║██╔══╝░░██╔══╝░░██║  ░░████╔═████║░██║░░██║██║╚████║██║░░██║██╔══╝░░██╔══██╗██║░░░░░██╔══██║██║╚████║██║░░██║\n██████╔╝███████╗██║░░░░░██║  ░░╚██╔╝░╚██╔╝░╚█████╔╝██║░╚███║██████╔╝███████╗██║░░██║███████╗██║░░██║██║░╚███║██████╔╝\n╚═════╝░╚══════╝╚═╝░░░░░╚═╝  ░░░╚═╝░░░╚═╝░░░╚════╝░╚═╝░░╚══╝╚═════╝░╚══════╝╚═╝░░╚═╝╚══════╝╚═╝░░╚═╝╚═╝░░╚══╝╚═════╝░\n\nhttps://defi.sucks\n\n*/\n\npragma solidity >=0.8.4 <0.9.0;\n\nimport '@openzeppelin/contracts/token/ERC20/ERC20.sol';\nimport '@uniswap/v3-core/contracts/interfaces/IUniswapV3Pool.sol';\n\nimport './libraries/LiquidityAmounts.sol';\nimport './libraries/FixedPoint96.sol';\nimport './libraries/FullMath.sol';\nimport './libraries/TickMath.sol';\n\nimport '../interfaces/external/IWeth9.sol';\nimport '../interfaces/IUniV3PairManager.sol';\n\nimport './peripherals/Governable.sol';\n\ncontract UniV3PairManager is IUniV3PairManager, Governable {\n /// @inheritdoc IERC20Metadata\n string public override name;\n\n /// @inheritdoc IERC20Metadata\n string public override symbol;\n\n /// @inheritdoc IERC20\n uint256 public override totalSupply;\n\n /// @inheritdoc IPairManager\n address public immutable override factory;\n\n /// @inheritdoc IPairManager\n address public immutable override token0;\n\n /// @inheritdoc IPairManager\n address public immutable override token1;\n\n /// @inheritdoc IPairManager\n address public immutable override pool;\n\n /// @inheritdoc IUniV3PairManager\n uint24 public immutable override fee;\n\n /// @inheritdoc IUniV3PairManager\n uint160 public immutable override sqrtRatioAX96;\n\n /// @inheritdoc IUniV3PairManager\n uint160 public immutable override sqrtRatioBX96;\n\n /// @inheritdoc IUniV3PairManager\n int24 public immutable override tickLower;\n\n /// @inheritdoc IUniV3PairManager\n int24 public immutable override tickUpper;\n\n /// @inheritdoc IUniV3PairManager\n int24 public immutable override tickSpacing;\n\n /// @notice Uniswap's maximum tick\n /// @dev Due to tick spacing, pools with different fees may have differences between _MAX_TICK and tickUpper. Use tickUpper to find the max tick of the pool.\n int24 private constant _MAX_TICK = 887272;\n\n /// @inheritdoc IERC20Metadata\n //solhint-disable-next-line const-name-snakecase\n uint8 public constant override decimals = 18;\n\n /// @inheritdoc IERC20\n mapping(address => mapping(address => uint256)) public override allowance;\n\n /// @inheritdoc IERC20\n mapping(address => uint256) public override balanceOf;\n\n /// @notice Struct that contains token0, token1, and fee of the Uniswap pool\n PoolKey private _poolKey;\n\n constructor(address _pool, address _governance) Governable(_governance) {\n uint24 _fee = IUniswapV3Pool(_pool).fee();\n address _token0 = IUniswapV3Pool(_pool).token0();\n address _token1 = IUniswapV3Pool(_pool).token1();\n int24 _tickSpacing = IUniswapV3Pool(_pool).tickSpacing();\n int24 _tickUpper = _MAX_TICK - (_MAX_TICK % _tickSpacing);\n int24 _tickLower = -_tickUpper;\n\n factory = msg.sender;\n pool = _pool;\n fee = _fee;\n tickSpacing = _tickSpacing;\n tickUpper = _tickUpper;\n tickLower = _tickLower;\n token0 = _token0;\n token1 = _token1;\n name = string(abi.encodePacked('Keep3rLP - ', ERC20(_token0).symbol(), '/', ERC20(_token1).symbol()));\n symbol = string(abi.encodePacked('kLP-', ERC20(_token0).symbol(), '/', ERC20(_token1).symbol()));\n\n sqrtRatioAX96 = TickMath.getSqrtRatioAtTick(_tickLower);\n sqrtRatioBX96 = TickMath.getSqrtRatioAtTick(_tickUpper);\n _poolKey = PoolKey({token0: _token0, token1: _token1, fee: _fee});\n }\n\n // This low-level function should be called from a contract which performs important safety checks\n /// @inheritdoc IUniV3PairManager\n function mint(\n uint256 amount0Desired,\n uint256 amount1Desired,\n uint256 amount0Min,\n uint256 amount1Min,\n address to\n ) external override returns (uint128 liquidity) {\n (liquidity, , ) = _addLiquidity(amount0Desired, amount1Desired, amount0Min, amount1Min);\n _mint(to, liquidity);\n }\n\n /// @inheritdoc IUniV3PairManager\n function uniswapV3MintCallback(\n uint256 amount0Owed,\n uint256 amount1Owed,\n bytes calldata data\n ) external override {\n MintCallbackData memory decoded = abi.decode(data, (MintCallbackData));\n if (msg.sender != pool) revert OnlyPool();\n if (amount0Owed > 0) _pay(decoded._poolKey.token0, decoded.payer, pool, amount0Owed);\n if (amount1Owed > 0) _pay(decoded._poolKey.token1, decoded.payer, pool, amount1Owed);\n }\n\n /// @inheritdoc IUniV3PairManager\n function burn(\n uint128 liquidity,\n uint256 amount0Min,\n uint256 amount1Min,\n address to\n ) external override returns (uint256 amount0, uint256 amount1) {\n (amount0, amount1) = IUniswapV3Pool(pool).burn(tickLower, tickUpper, liquidity);\n\n if (amount0 < amount0Min || amount1 < amount1Min) revert ExcessiveSlippage();\n\n IUniswapV3Pool(pool).collect(to, tickLower, tickUpper, uint128(amount0), uint128(amount1));\n _burn(msg.sender, liquidity);\n }\n\n /// @inheritdoc IUniV3PairManager\n function collect() external override onlyGovernance returns (uint256 amount0, uint256 amount1) {\n (, , , uint128 tokensOwed0, uint128 tokensOwed1) = IUniswapV3Pool(pool).positions(\n keccak256(abi.encodePacked(address(this), tickLower, tickUpper))\n );\n (amount0, amount1) = IUniswapV3Pool(pool).collect(governance, tickLower, tickUpper, tokensOwed0, tokensOwed1);\n }\n\n /// @inheritdoc IUniV3PairManager\n function position()\n external\n view\n override\n returns (\n uint128 liquidity,\n uint256 feeGrowthInside0LastX128,\n uint256 feeGrowthInside1LastX128,\n uint128 tokensOwed0,\n uint128 tokensOwed1\n )\n {\n (liquidity, feeGrowthInside0LastX128, feeGrowthInside1LastX128, tokensOwed0, tokensOwed1) = IUniswapV3Pool(pool).positions(\n keccak256(abi.encodePacked(address(this), tickLower, tickUpper))\n );\n }\n\n /// @inheritdoc IERC20\n function approve(address spender, uint256 amount) external override returns (bool) {\n allowance[msg.sender][spender] = amount;\n\n emit Approval(msg.sender, spender, amount);\n return true;\n }\n\n /// @inheritdoc IERC20\n function transfer(address to, uint256 amount) external override returns (bool) {\n _transferTokens(msg.sender, to, amount);\n return true;\n }\n\n /// @inheritdoc IERC20\n function transferFrom(\n address from,\n address to,\n uint256 amount\n ) external override returns (bool) {\n address spender = msg.sender;\n uint256 spenderAllowance = allowance[from][spender];\n\n if (spender != from && spenderAllowance != type(uint256).max) {\n uint256 newAllowance = spenderAllowance - amount;\n allowance[from][spender] = newAllowance;\n\n emit Approval(from, spender, newAllowance);\n }\n\n _transferTokens(from, to, amount);\n return true;\n }\n\n /// @notice Adds liquidity to an initialized pool\n /// @dev Reverts if the returned amount0 is less than amount0Min or if amount1 is less than amount1Min\n /// @dev This function calls the mint function of the corresponding Uniswap pool, which in turn calls UniswapV3Callback\n /// @param amount0Desired The amount of token0 we would like to provide\n /// @param amount1Desired The amount of token1 we would like to provide\n /// @param amount0Min The minimum amount of token0 we want to provide\n /// @param amount1Min The minimum amount of token1 we want to provide\n /// @return liquidity The calculated liquidity we get for the token amounts we provided\n /// @return amount0 The amount of token0 we ended up providing\n /// @return amount1 The amount of token1 we ended up providing\n function _addLiquidity(\n uint256 amount0Desired,\n uint256 amount1Desired,\n uint256 amount0Min,\n uint256 amount1Min\n )\n internal\n returns (\n uint128 liquidity,\n uint256 amount0,\n uint256 amount1\n )\n {\n (uint160 sqrtPriceX96, , , , , , ) = IUniswapV3Pool(pool).slot0();\n\n liquidity = LiquidityAmounts.getLiquidityForAmounts(sqrtPriceX96, sqrtRatioAX96, sqrtRatioBX96, amount0Desired, amount1Desired);\n\n (amount0, amount1) = IUniswapV3Pool(pool).mint(\n address(this),\n tickLower,\n tickUpper,\n liquidity,\n abi.encode(MintCallbackData({_poolKey: _poolKey, payer: msg.sender}))\n );\n\n if (amount0 < amount0Min || amount1 < amount1Min) revert ExcessiveSlippage();\n }\n\n /// @notice Transfers the passed-in token from the payer to the recipient for the corresponding value\n /// @param token The token to be transferred to the recipient\n /// @param from The address of the payer\n /// @param to The address of the passed-in tokens recipient\n /// @param value How much of that token to be transferred from payer to the recipient\n function _pay(\n address token,\n address from,\n address to,\n uint256 value\n ) internal {\n _safeTransferFrom(token, from, to, value);\n }\n\n /// @notice Mints Keep3r credits to the passed-in address of recipient and increases total supply of Keep3r credits by the corresponding amount\n /// @param to The recipient of the Keep3r credits\n /// @param amount The amount Keep3r credits to be minted to the recipient\n function _mint(address to, uint256 amount) internal {\n totalSupply += amount;\n balanceOf[to] += amount;\n emit Transfer(address(0), to, amount);\n }\n\n /// @notice Burns Keep3r credits to the passed-in address of recipient and reduces total supply of Keep3r credits by the corresponding amount\n /// @param to The address that will get its Keep3r credits burned\n /// @param amount The amount Keep3r credits to be burned from the recipient/recipient\n function _burn(address to, uint256 amount) internal {\n totalSupply -= amount;\n balanceOf[to] -= amount;\n emit Transfer(to, address(0), amount);\n }\n\n /// @notice Transfers amount of Keep3r credits between two addresses\n /// @param from The user that transfers the Keep3r credits\n /// @param to The user that receives the Keep3r credits\n /// @param amount The amount of Keep3r credits to be transferred\n function _transferTokens(\n address from,\n address to,\n uint256 amount\n ) internal {\n balanceOf[from] -= amount;\n balanceOf[to] += amount;\n\n emit Transfer(from, to, amount);\n }\n\n /// @notice Transfers the passed-in token from the specified \"from\" to the specified \"to\" for the corresponding value\n /// @dev Reverts with IUniV3PairManager#UnsuccessfulTransfer if the transfer was not successful,\n /// or if the passed data length is different than 0 and the decoded data is not a boolean\n /// @param token The token to be transferred to the specified \"to\"\n /// @param from The address which is going to transfer the tokens\n /// @param value How much of that token to be transferred from \"from\" to \"to\"\n function _safeTransferFrom(\n address token,\n address from,\n address to,\n uint256 value\n ) internal {\n // solhint-disable-next-line avoid-low-level-calls\n (bool success, bytes memory data) = token.call(abi.encodeWithSelector(IERC20.transferFrom.selector, from, to, value));\n if (!success || (data.length != 0 && !abi.decode(data, (bool)))) revert UnsuccessfulTransfer();\n }\n}\n" - }, - "solidity/interfaces/external/IWeth9.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '@openzeppelin/contracts/token/ERC20/IERC20.sol';\n\ninterface IWeth9 is IERC20 {\n function deposit() external payable;\n\n function withdraw(uint256) external;\n}\n" - }, - "solidity/interfaces/IUniV3PairManager.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport './IPairManager.sol';\nimport '@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol';\nimport './peripherals/IGovernable.sol';\n\n/// @title Pair Manager contract\n/// @notice Creates a UniswapV3 position, and tokenizes in an ERC20 manner\n/// so that the user can use it as liquidity for a Keep3rJob\ninterface IUniV3PairManager is IGovernable, IPairManager {\n // Structs\n struct PoolKey {\n address token0;\n address token1;\n uint24 fee;\n }\n\n /// @notice The data to be decoded by the UniswapV3MintCallback function\n struct MintCallbackData {\n PoolKey _poolKey; // Struct that contains token0, token1, and fee of the pool passed into the constructor\n address payer; // The address of the payer, which will be the msg.sender of the mint function\n }\n\n // Variables\n\n /// @notice The fee of the Uniswap pool passed into the constructor\n /// @return _fee The fee of the Uniswap pool passed into the constructor\n function fee() external view returns (uint24 _fee);\n\n /// @notice Highest tick in the Uniswap's curve\n /// @return _tickUpper The highest tick in the Uniswap's curve\n function tickUpper() external view returns (int24 _tickUpper);\n\n /// @notice Lowest tick in the Uniswap's curve\n /// @return _tickLower The lower tick in the Uniswap's curve\n function tickLower() external view returns (int24 _tickLower);\n\n /// @notice The pair tick spacing\n /// @return _tickSpacing The pair tick spacing\n function tickSpacing() external view returns (int24 _tickSpacing);\n\n /// @notice The sqrtRatioAX96 at the lowest tick (-887200) of the Uniswap pool\n /// @return _sqrtPriceA96 A Fixed point Q64.96 number representing the sqrt of the ratio of the two assets (token1/token0)\n /// at the lowest tick\n function sqrtRatioAX96() external view returns (uint160 _sqrtPriceA96);\n\n /// @notice The sqrtRatioBX96 at the highest tick (887200) of the Uniswap pool\n /// @return _sqrtPriceBX96 A Fixed point Q64.96 number representing the sqrt of the ratio of the two assets (token1/token0)\n /// at the highest tick\n function sqrtRatioBX96() external view returns (uint160 _sqrtPriceBX96);\n\n // Errors\n\n /// @notice Throws when the caller of the function is not the pool\n error OnlyPool();\n\n /// @notice Throws when the slippage exceeds what the user is comfortable with\n error ExcessiveSlippage();\n\n /// @notice Throws when a transfer is unsuccessful\n error UnsuccessfulTransfer();\n\n // Methods\n\n /// @notice This function is called after a user calls IUniV3PairManager#mint function\n /// It ensures that any tokens owed to the pool are paid by the msg.sender of IUniV3PairManager#mint function\n /// @param amount0Owed The amount of token0 due to the pool for the minted liquidity\n /// @param amount1Owed The amount of token1 due to the pool for the minted liquidity\n /// @param data The encoded token0, token1, fee (_poolKey) and the payer (msg.sender) of the IUniV3PairManager#mint function\n function uniswapV3MintCallback(\n uint256 amount0Owed,\n uint256 amount1Owed,\n bytes calldata data\n ) external;\n\n /// @notice Mints kLP tokens to an address according to the liquidity the msg.sender provides to the UniswapV3 pool\n /// @dev Triggers UniV3PairManager#uniswapV3MintCallback\n /// @param amount0Desired The amount of token0 we would like to provide\n /// @param amount1Desired The amount of token1 we would like to provide\n /// @param amount0Min The minimum amount of token0 we want to provide\n /// @param amount1Min The minimum amount of token1 we want to provide\n /// @param to The address to which the kLP tokens are going to be minted to\n /// @return liquidity kLP tokens sent in exchange for the provision of tokens\n function mint(\n uint256 amount0Desired,\n uint256 amount1Desired,\n uint256 amount0Min,\n uint256 amount1Min,\n address to\n ) external returns (uint128 liquidity);\n\n /// @notice Returns the pair manager's position in the corresponding UniswapV3 pool\n /// @return liquidity The amount of liquidity provided to the UniswapV3 pool by the pair manager\n /// @return feeGrowthInside0LastX128 The fee growth of token0 as of the last action on the individual position\n /// @return feeGrowthInside1LastX128 The fee growth of token1 as of the last action on the individual position\n /// @return tokensOwed0 The uncollected amount of token0 owed to the position as of the last computation\n /// @return tokensOwed1 The uncollected amount of token1 owed to the position as of the last computation\n function position()\n external\n view\n returns (\n uint128 liquidity,\n uint256 feeGrowthInside0LastX128,\n uint256 feeGrowthInside1LastX128,\n uint128 tokensOwed0,\n uint128 tokensOwed1\n );\n\n /// @notice Calls the UniswapV3 pool's collect function, which collects up to a maximum amount of fees\n // owed to a specific position to the recipient, in this case, that recipient is the pair manager\n /// @dev The collected fees will be sent to governance\n /// @return amount0 The amount of fees collected in token0\n /// @return amount1 The amount of fees collected in token1\n function collect() external returns (uint256 amount0, uint256 amount1);\n\n /// @notice Burns the corresponding amount of kLP tokens from the msg.sender and withdraws the specified liquidity\n // in the entire range\n /// @param liquidity The amount of liquidity to be burned\n /// @param amount0Min The minimum amount of token0 we want to send to the recipient (to)\n /// @param amount1Min The minimum amount of token1 we want to send to the recipient (to)\n /// @param to The address that will receive the due fees\n /// @return amount0 The calculated amount of token0 that will be sent to the recipient\n /// @return amount1 The calculated amount of token1 that will be sent to the recipient\n function burn(\n uint128 liquidity,\n uint256 amount0Min,\n uint256 amount1Min,\n address to\n ) external returns (uint256 amount0, uint256 amount1);\n}\n" - }, - "@openzeppelin/contracts/utils/Context.sol": { - "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Provides information about the current execution context, including the\n * sender of the transaction and its data. While these are generally available\n * via msg.sender and msg.data, they should not be accessed in such a direct\n * manner, since when dealing with meta-transactions the account sending and\n * paying for execution may not be the actual sender (as far as an application\n * is concerned).\n *\n * This contract is only required for intermediate, library-like contracts.\n */\nabstract contract Context {\n function _msgSender() internal view virtual returns (address) {\n return msg.sender;\n }\n\n function _msgData() internal view virtual returns (bytes calldata) {\n return msg.data;\n }\n}\n" - }, - "solidity/interfaces/IPairManagerFactory.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport './peripherals/IGovernable.sol';\n\n/// @title Factory of Pair Managers\n/// @notice This contract creates new pair managers\ninterface IPairManagerFactory is IGovernable {\n // Variables\n\n /// @notice Maps the address of a Uniswap pool, to the address of the corresponding PairManager\n /// For example, the uniswap address of DAI-WETH, will return the Keep3r/DAI-WETH pair manager address\n /// @param _pool The address of the Uniswap pool\n /// @return _pairManager The address of the corresponding pair manager\n function pairManagers(address _pool) external view returns (address _pairManager);\n\n // Events\n\n /// @notice Emitted when a new pair manager is created\n /// @param _pool The address of the corresponding Uniswap pool\n /// @param _pairManager The address of the just-created pair manager\n event PairCreated(address _pool, address _pairManager);\n\n // Errors\n\n /// @notice Throws an error if the pair manager is already initialized\n error AlreadyInitialized();\n\n /// @notice Throws an error if the caller is not the owner\n error OnlyOwner();\n\n // Methods\n\n /// @notice Creates a new pair manager based on the address of a Uniswap pool\n /// For example, the uniswap address of DAI-WETH, will create the Keep3r/DAI-WETH pool\n /// @param _pool The address of the Uniswap pool the pair manager will be based of\n /// @return _pairManager The address of the just-created pair manager\n function createPairManager(address _pool) external returns (address _pairManager);\n}\n" - }, - "solidity/contracts/UniV3PairManagerFactory.sol": { - "content": "// SPDX-License-Identifier: MIT\n\n/*\n\nCoded for The Keep3r Network with ♥ by\n\n██████╗░███████╗███████╗██╗  ░██╗░░░░░░░██╗░█████╗░███╗░░██╗██████╗░███████╗██████╗░██╗░░░░░░█████╗░███╗░░██╗██████╗░\n██╔══██╗██╔════╝██╔════╝██║  ░██║░░██╗░░██║██╔══██╗████╗░██║██╔══██╗██╔════╝██╔══██╗██║░░░░░██╔══██╗████╗░██║██╔══██╗\n██║░░██║█████╗░░█████╗░░██║  ░╚██╗████╗██╔╝██║░░██║██╔██╗██║██║░░██║█████╗░░██████╔╝██║░░░░░███████║██╔██╗██║██║░░██║\n██║░░██║██╔══╝░░██╔══╝░░██║  ░░████╔═████║░██║░░██║██║╚████║██║░░██║██╔══╝░░██╔══██╗██║░░░░░██╔══██║██║╚████║██║░░██║\n██████╔╝███████╗██║░░░░░██║  ░░╚██╔╝░╚██╔╝░╚█████╔╝██║░╚███║██████╔╝███████╗██║░░██║███████╗██║░░██║██║░╚███║██████╔╝\n╚═════╝░╚══════╝╚═╝░░░░░╚═╝  ░░░╚═╝░░░╚═╝░░░╚════╝░╚═╝░░╚══╝╚═════╝░╚══════╝╚═╝░░╚═╝╚══════╝╚═╝░░╚═╝╚═╝░░╚══╝╚═════╝░\n\nhttps://defi.sucks\n\n*/\n\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../interfaces/IPairManagerFactory.sol';\nimport './UniV3PairManager.sol';\nimport './peripherals/Governable.sol';\n\n/// @title Factory of Pair Managers\n/// @notice This contract creates new pair managers\ncontract UniV3PairManagerFactory is IPairManagerFactory, Governable {\n mapping(address => address) public override pairManagers;\n\n constructor(address _governance) Governable(_governance) {}\n\n ///@inheritdoc IPairManagerFactory\n function createPairManager(address _pool) external override returns (address _pairManager) {\n if (pairManagers[_pool] != address(0)) revert AlreadyInitialized();\n _pairManager = address(new UniV3PairManager(_pool, governance));\n pairManagers[_pool] = _pairManager;\n emit PairCreated(_pool, _pairManager);\n }\n}\n" - }, - "solidity/for-test/peripherals/GovernableForTest.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../../contracts/peripherals/Governable.sol';\n\ncontract GovernableForTest is Governable {\n constructor(address _governor) Governable(_governor) {}\n}\n" - }, - "solidity/for-test/BridgeForTest.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.0 <0.9.0;\n\nimport '@openzeppelin/contracts/token/ERC20/ERC20.sol';\nimport '@openzeppelin/contracts/token/ERC20/IERC20.sol';\n\ncontract BridgeForTest is ERC20 {\n address public immutable kp3r;\n\n constructor(address _kp3r) ERC20('Wrapped KP3R', 'wKP3R') {\n kp3r = _kp3r;\n }\n\n function bridge(uint256 _amount) external {\n IERC20(kp3r).transferFrom(msg.sender, address(this), _amount);\n _mint(msg.sender, _amount);\n }\n\n function bridgeBack(uint256 _amount) external {\n _burn(msg.sender, _amount);\n IERC20(kp3r).transfer(msg.sender, _amount);\n }\n}\n" - }, - "solidity/for-test/ERC20ForTest.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '@openzeppelin/contracts/token/ERC20/ERC20.sol';\n\ncontract ERC20ForTest is ERC20 {\n constructor(\n string memory _name,\n string memory _symbol,\n address _initialAccount,\n uint256 _initialBalance\n ) ERC20(_name, _symbol) {\n _mint(_initialAccount, _initialBalance);\n }\n\n function mint(uint256 _amount) public {\n _mint(msg.sender, _amount);\n }\n\n function mint(address _account, uint256 _amount) public {\n _mint(_account, _amount);\n }\n\n function burn(uint256 _amount) public {\n _burn(msg.sender, _amount);\n }\n\n function burn(address _account, uint256 _amount) public {\n _burn(_account, _amount);\n }\n\n function transferInternal(\n address _from,\n address _to,\n uint256 _value\n ) public {\n _transfer(_from, _to, _value);\n }\n\n function approveInternal(\n address _owner,\n address _spender,\n uint256 _value\n ) public {\n _approve(_owner, _spender, _value);\n }\n\n function deposit() external payable {\n // Function added for compatibility with WETH\n }\n}\n" - }, - "solidity/for-test/peripherals/keepers/Keep3rKeeperFundableForTest.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../../../contracts/peripherals/keepers/Keep3rKeeperFundable.sol';\n\ncontract Keep3rKeeperFundableForTest is Keep3rKeeperFundable {\n using EnumerableSet for EnumerableSet.AddressSet;\n\n constructor(\n address _kph,\n address _keep3rV1,\n address _keep3rV1Proxy\n ) Keep3rParameters(_kph, _keep3rV1, _keep3rV1Proxy) Keep3rRoles(msg.sender) {}\n\n function isKeeper(address _keeper) external view returns (bool) {\n return _keepers.contains(_keeper);\n }\n\n function setJob(address job) external {\n _jobs.add(job);\n }\n}\n" - }, - "solidity/contracts/sidechain/Keep3rEscrow.sol": { - "content": "// SPDX-License-Identifier: MIT\n\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../peripherals/Mintable.sol';\nimport '../peripherals/DustCollector.sol';\nimport '../../interfaces/sidechain/IKeep3rEscrow.sol';\nimport '@openzeppelin/contracts/token/ERC20/IERC20.sol';\nimport '@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol';\n\ncontract Keep3rEscrow is Mintable, DustCollector, IKeep3rEscrow {\n using SafeERC20 for IERC20;\n\n /// @inheritdoc IKeep3rEscrow\n address public override wKP3R;\n\n /// @param _governance Address of governance\n /// @param _wKP3R Address of wrapped KP3R implementation\n constructor(address _governance, address _wKP3R) Mintable(_governance) {\n wKP3R = _wKP3R;\n }\n\n /// @inheritdoc IKeep3rEscrow\n function deposit(uint256 _amount) external override {\n IERC20(wKP3R).safeTransferFrom(msg.sender, address(this), _amount);\n emit wKP3RDeposited(wKP3R, msg.sender, _amount);\n }\n\n /// @inheritdoc IKeep3rEscrow\n function mint(uint256 _amount) external override onlyMinter {\n IERC20(wKP3R).safeTransfer(msg.sender, _amount);\n emit wKP3RMinted(wKP3R, msg.sender, _amount);\n }\n\n /// @inheritdoc IKeep3rEscrow\n function setWKP3R(address _wKP3R) external override onlyGovernance {\n if (_wKP3R == address(0)) revert ZeroAddress();\n wKP3R = _wKP3R;\n emit wKP3RSet(wKP3R);\n }\n}\n" - }, - "solidity/contracts/peripherals/Mintable.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../../interfaces/peripherals/IMintable.sol';\nimport './Governable.sol';\n\nabstract contract Mintable is Governable, IMintable {\n /// @inheritdoc IMintable\n address public override minter;\n\n constructor(address _governance) Governable(_governance) {}\n\n /// @inheritdoc IMintable\n function setMinter(address _minter) external override onlyGovernance {\n if (_minter == address(0)) revert ZeroAddress();\n minter = _minter;\n emit MinterSet(_minter);\n }\n\n /// @notice Functions with this modifier can only be called by the minter;\n modifier onlyMinter() {\n if (msg.sender != minter) revert OnlyMinter();\n _;\n }\n}\n" - }, - "solidity/for-test/peripherals/DustCollectorForTest.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../../contracts/peripherals/DustCollector.sol';\n\ncontract DustCollectorForTest is DustCollector {\n constructor() DustCollector() Governable(msg.sender) {}\n}\n" - }, - "solidity/for-test/peripherals/Keep3rAccountanceForTest.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../../contracts/peripherals/Keep3rAccountance.sol';\n\ncontract Keep3rAccountanceForTest is Keep3rAccountance {\n using EnumerableSet for EnumerableSet.AddressSet;\n\n constructor() Keep3rRoles(msg.sender) {}\n\n function setJob(address job) external {\n _jobs.add(job);\n }\n\n function setKeeper(address keeper) external {\n _keepers.add(keeper);\n }\n}\n" - }, - "solidity/for-test/peripherals/jobs/Keep3rJobFundableLiquidityForTest.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../../../contracts/peripherals/jobs/Keep3rJobFundableLiquidity.sol';\n\ncontract Keep3rJobFundableLiquidityForTest is Keep3rJobFundableLiquidity {\n using EnumerableSet for EnumerableSet.AddressSet;\n\n constructor(\n address _kph,\n address _keep3rV1,\n address _keep3rV1Proxy\n ) Keep3rParameters(_kph, _keep3rV1, _keep3rV1Proxy) Keep3rRoles(msg.sender) {}\n\n function setJob(address _job) external {\n _jobs.add(_job);\n }\n\n function setJobLiquidity(address _job, address _liquidity) external returns (bool) {\n return _jobLiquidities[_job].add(_liquidity);\n }\n\n function setApprovedLiquidity(address _liquidity) external {\n _approvedLiquidities.add(_liquidity);\n }\n\n function setRevokedLiquidity(address _liquidity) external {\n _approvedLiquidities.remove(_liquidity);\n }\n\n function viewTickCache(address _liquidity) external view returns (TickCache memory _tickCache) {\n _tickCache = _tick[_liquidity];\n }\n\n function viewTickOrder(address _liquidity) external view returns (bool) {\n return _isKP3RToken0[_liquidity];\n }\n\n function internalJobLiquidities(address _job) external view returns (address[] memory _list) {\n _list = _jobLiquidities[_job].values();\n }\n\n function internalSettleJobAccountance(address _job) external {\n _settleJobAccountance(_job);\n }\n}\n" - }, - "solidity/for-test/peripherals/jobs/Keep3rJobDisputableForTest.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../../../contracts/peripherals/jobs/Keep3rJobDisputable.sol';\n\ncontract Keep3rJobDisputableForTest is Keep3rJobDisputable {\n using EnumerableSet for EnumerableSet.AddressSet;\n\n constructor(\n address _kph,\n address _keep3rV1,\n address _keep3rV1Proxy\n ) Keep3rParameters(_kph, _keep3rV1, _keep3rV1Proxy) Keep3rRoles(msg.sender) {}\n\n function setJobLiquidity(address _job, address _liquidity) external {\n _jobLiquidities[_job].add(_liquidity);\n }\n\n function setJobToken(address _job, address _token) external {\n _jobTokens[_job].add(_token);\n }\n\n function setApprovedLiquidity(address _liquidity) external {\n _approvedLiquidities.add(_liquidity);\n }\n\n function setRevokedLiquidity(address _liquidity) external {\n _approvedLiquidities.remove(_liquidity);\n }\n\n function internalJobLiquidityCredits(address _job) external view returns (uint256 _credits) {\n _credits = _jobLiquidityCredits[_job];\n }\n\n function internalJobPeriodCredits(address _job) external view returns (uint256 _credits) {\n _credits = _jobPeriodCredits[_job];\n }\n\n function internalJobTokens(address _job) external view returns (address[] memory _tokens) {\n _tokens = new address[](_jobTokens[_job].length());\n for (uint256 i; i < _jobTokens[_job].length(); i++) {\n _tokens[i] = _jobTokens[_job].at(i);\n }\n }\n\n function internalJobLiquidities(address _job) external view returns (address[] memory _tokens) {\n _tokens = new address[](_jobLiquidities[_job].length());\n for (uint256 i; i < _jobLiquidities[_job].length(); i++) {\n _tokens[i] = _jobLiquidities[_job].at(i);\n }\n }\n}\n" - }, - "solidity/for-test/peripherals/Keep3rDisputableForTest.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../../contracts/peripherals/Keep3rDisputable.sol';\n\ncontract Keep3rDisputableForTest is Keep3rDisputable {\n constructor() Keep3rParameters(address(0), address(0), address(0)) Keep3rRoles(msg.sender) {}\n}\n" - }, - "solidity/for-test/peripherals/keepers/Keep3rKeeperDisputableForTest.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../../../contracts/peripherals/keepers/Keep3rKeeperDisputable.sol';\n\ncontract Keep3rKeeperDisputableForTest is Keep3rKeeperDisputable {\n using EnumerableSet for EnumerableSet.AddressSet;\n\n constructor(\n address _kph,\n address _keep3rV1,\n address _keep3rV1Proxy\n ) Keep3rParameters(_kph, _keep3rV1, _keep3rV1Proxy) Keep3rRoles(msg.sender) {}\n\n function setKeeper(address _keeper) external {\n _keepers.add(_keeper);\n }\n\n function internalSlash(\n address _bonded,\n address _keeper,\n uint256 _bondAmount,\n uint256 _unbondAmount\n ) external {\n _slash(_bonded, _keeper, _bondAmount, _unbondAmount);\n }\n\n function isKeeper(address _address) external view returns (bool _isKeeper) {\n _isKeeper = _keepers.contains(_address);\n }\n}\n" - }, - "solidity/for-test/peripherals/jobs/Keep3rJobFundableCreditsForTest.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../../../contracts/peripherals/jobs/Keep3rJobFundableCredits.sol';\n\ncontract Keep3rJobFundableCreditsForTest is Keep3rJobFundableCredits {\n using EnumerableSet for EnumerableSet.AddressSet;\n\n constructor(\n address _kph,\n address _keep3rV1,\n address _keep3rV1Proxy\n ) Keep3rParameters(_kph, _keep3rV1, _keep3rV1Proxy) Keep3rRoles(msg.sender) {}\n\n function setJob(address _job, address _jobOwner) external {\n _jobs.add(_job);\n jobOwner[_job] = _jobOwner;\n }\n\n function setJobToken(address _job, address _token) external {\n _jobTokens[_job].add(_token);\n }\n\n function isJobToken(address _job, address _token) external view returns (bool _contains) {\n _contains = _jobTokens[_job].contains(_token);\n }\n}\n" - }, - "solidity/contracts/Keep3rHelper.sol": { - "content": "// SPDX-License-Identifier: MIT\n\n/*\n\nCoded for The Keep3r Network with ♥ by\n\n██████╗░███████╗███████╗██╗  ░██╗░░░░░░░██╗░█████╗░███╗░░██╗██████╗░███████╗██████╗░██╗░░░░░░█████╗░███╗░░██╗██████╗░\n██╔══██╗██╔════╝██╔════╝██║  ░██║░░██╗░░██║██╔══██╗████╗░██║██╔══██╗██╔════╝██╔══██╗██║░░░░░██╔══██╗████╗░██║██╔══██╗\n██║░░██║█████╗░░█████╗░░██║  ░╚██╗████╗██╔╝██║░░██║██╔██╗██║██║░░██║█████╗░░██████╔╝██║░░░░░███████║██╔██╗██║██║░░██║\n██║░░██║██╔══╝░░██╔══╝░░██║  ░░████╔═████║░██║░░██║██║╚████║██║░░██║██╔══╝░░██╔══██╗██║░░░░░██╔══██║██║╚████║██║░░██║\n██████╔╝███████╗██║░░░░░██║  ░░╚██╔╝░╚██╔╝░╚█████╔╝██║░╚███║██████╔╝███████╗██║░░██║███████╗██║░░██║██║░╚███║██████╔╝\n╚═════╝░╚══════╝╚═╝░░░░░╚═╝  ░░░╚═╝░░░╚═╝░░░╚════╝░╚═╝░░╚══╝╚═════╝░╚══════╝╚═╝░░╚═╝╚══════╝╚═╝░░╚═╝╚═╝░░╚══╝╚═════╝░\n\nhttps://defi.sucks\n\n*/\n\npragma solidity >=0.8.7 <0.9.0;\n\nimport './libraries/FullMath.sol';\nimport './libraries/TickMath.sol';\nimport '../interfaces/IKeep3r.sol';\nimport '../interfaces/IKeep3rHelper.sol';\nimport './Keep3rHelperParameters.sol';\n\nimport '@openzeppelin/contracts/utils/math/Math.sol';\nimport '@uniswap/v3-core/contracts/interfaces/IUniswapV3Pool.sol';\n\ncontract Keep3rHelper is IKeep3rHelper, Keep3rHelperParameters {\n constructor(\n address _kp3r,\n address _keep3rV2,\n address _governance,\n address _kp3rWethPool\n ) Keep3rHelperParameters(_kp3r, _keep3rV2, _governance, _kp3rWethPool) {}\n\n /// @inheritdoc IKeep3rHelper\n function quote(uint256 _eth) public view override returns (uint256 _amountOut) {\n uint32[] memory _secondsAgos = new uint32[](2);\n _secondsAgos[1] = quoteTwapTime;\n\n (int56[] memory _tickCumulatives, ) = IUniswapV3Pool(kp3rWethPool.poolAddress).observe(_secondsAgos);\n int56 _difference = _tickCumulatives[0] - _tickCumulatives[1];\n _amountOut = getQuoteAtTick(uint128(_eth), kp3rWethPool.isTKNToken0 ? _difference : -_difference, quoteTwapTime);\n }\n\n /// @inheritdoc IKeep3rHelper\n function bonds(address _keeper) public view virtual override returns (uint256 _amountBonded) {\n return IKeep3r(keep3rV2).bonds(_keeper, KP3R);\n }\n\n /// @inheritdoc IKeep3rHelper\n function getRewardAmountFor(address _keeper, uint256 _gasUsed) public view override returns (uint256 _kp3r) {\n uint256 _boost = getRewardBoostFor(bonds(_keeper));\n _kp3r = quote((_gasUsed * _boost) / BOOST_BASE);\n }\n\n /// @inheritdoc IKeep3rHelper\n function getRewardAmount(uint256 _gasUsed) external view override returns (uint256 _amount) {\n // solhint-disable-next-line avoid-tx-origin\n return getRewardAmountFor(tx.origin, _gasUsed);\n }\n\n /// @inheritdoc IKeep3rHelper\n function getRewardBoostFor(uint256 _bonds) public view override returns (uint256 _rewardBoost) {\n _bonds = Math.min(_bonds, targetBond);\n uint256 _cap = minBoost + ((maxBoost - minBoost) * _bonds) / targetBond;\n _rewardBoost = _cap * _getBasefee();\n }\n\n /// @inheritdoc IKeep3rHelper\n function getPoolTokens(address _pool) public view override returns (address _token0, address _token1) {\n return (IUniswapV3Pool(_pool).token0(), IUniswapV3Pool(_pool).token1());\n }\n\n /// @inheritdoc IKeep3rHelper\n function isKP3RToken0(address _pool) external view virtual override returns (bool _isKP3RToken0) {\n address _token0;\n address _token1;\n (_token0, _token1) = getPoolTokens(_pool);\n if (_token0 == KP3R) {\n return true;\n } else if (_token1 != KP3R) {\n revert LiquidityPairInvalid();\n }\n }\n\n /// @inheritdoc IKeep3rHelper\n function observe(address _pool, uint32[] memory _secondsAgo)\n external\n view\n override\n returns (\n int56 _tickCumulative1,\n int56 _tickCumulative2,\n bool _success\n )\n {\n try IUniswapV3Pool(_pool).observe(_secondsAgo) returns (int56[] memory _uniswapResponse, uint160[] memory) {\n _tickCumulative1 = _uniswapResponse[0];\n if (_uniswapResponse.length > 1) {\n _tickCumulative2 = _uniswapResponse[1];\n }\n _success = true;\n } catch (bytes memory) {}\n }\n\n /// @inheritdoc IKeep3rHelper\n function getPaymentParams(uint256 _bonds)\n external\n view\n virtual\n override\n returns (\n uint256 _boost,\n uint256 _oneEthQuote,\n uint256 _extra\n )\n {\n _oneEthQuote = quote(1 ether);\n _boost = getRewardBoostFor(_bonds);\n _extra = workExtraGas;\n }\n\n /// @inheritdoc IKeep3rHelper\n function getKP3RsAtTick(\n uint256 _liquidityAmount,\n int56 _tickDifference,\n uint256 _timeInterval\n ) external pure override returns (uint256 _kp3rAmount) {\n uint160 sqrtRatioX96 = TickMath.getSqrtRatioAtTick(int24(_tickDifference / int256(_timeInterval)));\n _kp3rAmount = FullMath.mulDiv(1 << 96, _liquidityAmount, sqrtRatioX96);\n }\n\n /// @inheritdoc IKeep3rHelper\n function getQuoteAtTick(\n uint128 _baseAmount,\n int56 _tickDifference,\n uint256 _timeInterval\n ) public pure override returns (uint256 _quoteAmount) {\n uint160 sqrtRatioX96 = TickMath.getSqrtRatioAtTick(int24(_tickDifference / int256(_timeInterval)));\n\n if (sqrtRatioX96 <= type(uint128).max) {\n uint256 ratioX192 = uint256(sqrtRatioX96) * sqrtRatioX96;\n _quoteAmount = FullMath.mulDiv(1 << 192, _baseAmount, ratioX192);\n } else {\n uint256 ratioX128 = FullMath.mulDiv(sqrtRatioX96, sqrtRatioX96, 1 << 64);\n _quoteAmount = FullMath.mulDiv(1 << 128, _baseAmount, ratioX128);\n }\n }\n\n /// @notice Gets the gas basefee cost to calculate keeper rewards\n /// @dev Keepers are required to pay a priority fee to be included, this function recognizes a minimum priority fee\n /// @return _baseFee The block's basefee + a minimum priority fee, or a preset minimum gas fee\n function _getBasefee() internal view virtual returns (uint256 _baseFee) {\n return Math.max(minBaseFee, block.basefee + minPriorityFee);\n }\n}\n" - }, - "solidity/for-test/testnet/Keep3rHelperForTestnet.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../../contracts/Keep3rHelper.sol';\n\ncontract Keep3rHelperForTestnet is Keep3rHelper {\n constructor(\n address _kp3r,\n address _keep3rV2,\n address _governance,\n address _kp3rWethPool\n ) Keep3rHelper(_kp3r, _keep3rV2, _governance, _kp3rWethPool) {}\n\n function _getBasefee() internal pure override returns (uint256) {\n return 1;\n }\n}\n" - }, - "solidity/for-test/Keep3rHelperForTest.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../contracts/Keep3rHelper.sol';\n\ncontract Keep3rHelperForTest is Keep3rHelper {\n uint256 public basefee;\n\n constructor(\n address _kp3r,\n address _keep3rV2,\n address _governance,\n address _kp3rWethPool\n ) Keep3rHelper(_kp3r, _keep3rV2, _governance, _kp3rWethPool) {}\n\n function _getBasefee() internal view override returns (uint256) {\n return basefee != 0 ? (basefee + minPriorityFee) : super._getBasefee();\n }\n\n function setBaseFee(uint256 _baseFee) external {\n basefee = _baseFee;\n }\n}\n" - }, - "solidity/contracts/sidechain/Keep3rHelperSidechain.sol": { - "content": "// SPDX-License-Identifier: MIT\n\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../Keep3rHelper.sol';\nimport '../../interfaces/sidechain/IKeep3rHelperSidechain.sol';\n\ncontract Keep3rHelperSidechain is IKeep3rHelperSidechain, Keep3rHelper {\n /// @inheritdoc IKeep3rHelperSidechain\n mapping(address => address) public override oracle;\n /// @inheritdoc IKeep3rHelperSidechain\n IKeep3rHelperParameters.TokenOraclePool public override wethUSDPool;\n\n /// @notice Ethereum mainnet WETH address used for quoting references\n address public immutable override WETH;\n\n /// @param _keep3rV2 Address of sidechain Keep3r implementation\n /// @param _governance Address of governance\n /// @param _kp3rWethOracle Address of oracle used for KP3R/WETH quote\n /// @param _wethUsdOracle Address of oracle used for WETH/USD quote\n /// @dev Oracle pools should use 18 decimals tokens\n constructor(\n address _keep3rV2,\n address _governance,\n address _kp3r,\n address _weth,\n address _kp3rWethOracle,\n address _wethUsdOracle\n ) Keep3rHelper(_kp3r, _keep3rV2, _governance, _kp3rWethOracle) {\n WETH = _weth;\n wethUSDPool = _validateOraclePool(_wethUsdOracle, _weth);\n _setQuoteTwapTime(1 days);\n workExtraGas = 0;\n }\n\n /// @inheritdoc IKeep3rHelper\n /// @notice Uses valid wKP3R address from Keep3rSidechain to query keeper bonds\n function bonds(address _keeper) public view override(Keep3rHelper, IKeep3rHelper) returns (uint256 _amountBonded) {\n address wKP3R = IKeep3r(keep3rV2).keep3rV1();\n return IKeep3r(keep3rV2).bonds(_keeper, wKP3R);\n }\n\n /// @inheritdoc IKeep3rHelperSidechain\n function setOracle(address _liquidity, address _oracle) external override onlyGovernance {\n if (_liquidity == address(0) || _oracle == address(0)) revert ZeroAddress();\n oracle[_liquidity] = _oracle;\n emit OracleSet(_liquidity, _oracle);\n }\n\n /// @inheritdoc IKeep3rHelperSidechain\n function quoteUsdToEth(uint256 _usd) public view virtual override returns (uint256 _amountOut) {\n uint32[] memory _secondsAgos = new uint32[](2);\n _secondsAgos[1] = quoteTwapTime;\n\n /// @dev Oracle is compatible with IUniswapV3Pool\n (int56[] memory _tickCumulatives, ) = IUniswapV3Pool(wethUSDPool.poolAddress).observe(_secondsAgos);\n int56 _difference = _tickCumulatives[0] - _tickCumulatives[1];\n _amountOut = getQuoteAtTick(uint128(_usd), wethUSDPool.isTKNToken0 ? _difference : -_difference, quoteTwapTime);\n }\n\n /// @inheritdoc IKeep3rHelperSidechain\n function setWethUsdPool(address _poolAddress) external override onlyGovernance {\n if (_poolAddress == address(0)) revert ZeroAddress();\n _setWethUsdPool(_poolAddress);\n }\n\n /// @inheritdoc IKeep3rHelper\n function getPaymentParams(uint256 _bonds)\n external\n view\n virtual\n override(Keep3rHelper, IKeep3rHelper)\n returns (\n uint256 _boost,\n uint256 _oneUsdQuote,\n uint256 _extraGas\n )\n {\n _oneUsdQuote = quote(quoteUsdToEth(1 ether));\n _boost = getRewardBoostFor(_bonds);\n _extraGas = workExtraGas;\n }\n\n function _setWethUsdPool(address _poolAddress) internal {\n wethUSDPool = _validateOraclePool(_poolAddress, WETH);\n emit WethUSDPoolChange(wethUSDPool.poolAddress, wethUSDPool.isTKNToken0);\n }\n\n /// @dev Sidechain jobs are quoted by USD/gasUnit, baseFee is set to 1\n function _getBasefee() internal view virtual override returns (uint256 _baseFee) {\n return 1;\n }\n}\n" - }, - "solidity/for-test/testnet/Keep3rHelperSidechainForTestnet.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../../contracts/sidechain/Keep3rHelperSidechain.sol';\n\ncontract Keep3rHelperSidechainForTestnet is Keep3rHelperSidechain {\n constructor(\n address _keep3rV2,\n address _governance,\n address _kp3r,\n address _weth,\n address _kp3rWethOracle,\n address _wethUsdOracle\n ) Keep3rHelperSidechain(_keep3rV2, _governance, _kp3r, _weth, _kp3rWethOracle, _wethUsdOracle) {}\n\n /// @dev Overrides oracle validation that uses KP3R and WETH addresses\n function _validateOraclePool(address _poolAddress, address) internal view virtual override returns (TokenOraclePool memory _oraclePool) {\n return TokenOraclePool(_poolAddress, true);\n }\n\n /// @dev Overrides token comparison with KP3R address\n function isKP3RToken0(address) public view virtual override returns (bool) {\n return true;\n }\n\n function quoteUsdToEth(uint256 _usd) public view virtual override returns (uint256) {\n return _usd / 1000;\n }\n}\n" - }, - "solidity/for-test/peripherals/Keep3rParametersForTest.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../../contracts/peripherals/Keep3rParameters.sol';\n\ncontract Keep3rParametersForTest is Keep3rParameters {\n constructor(\n address _keep3rHelper,\n address _keep3rV1,\n address _keep3rV1Proxy\n ) Keep3rParameters(_keep3rHelper, _keep3rV1, _keep3rV1Proxy) Keep3rRoles(msg.sender) {}\n}\n" - }, - "solidity/for-test/peripherals/jobs/Keep3rJobWorkableForTest.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../../../contracts/peripherals/jobs/Keep3rJobWorkable.sol';\n\ncontract Keep3rJobWorkableForTest is Keep3rJobWorkable {\n using EnumerableSet for EnumerableSet.AddressSet;\n\n constructor(\n address _keep3rHelper,\n address _keep3rV1,\n address _keep3rV1Proxy\n ) Keep3rParameters(_keep3rHelper, _keep3rV1, _keep3rV1Proxy) Keep3rRoles(msg.sender) {}\n\n function setJob(address _job) external {\n _jobs.add(_job);\n }\n\n function setKeeper(address _keeper) external {\n _keepers.add(_keeper);\n }\n\n function setApprovedLiquidity(address _liquidity) external {\n _approvedLiquidities.add(_liquidity);\n }\n\n function setJobLiquidity(address _job, address _liquidity) external {\n _jobLiquidities[_job].add(_liquidity);\n }\n\n function viewJobLiquidityCredits(address _job) external view returns (uint256) {\n return _jobLiquidityCredits[_job];\n }\n\n function viewJobPeriodCredits(address _job) external view returns (uint256) {\n return _jobPeriodCredits[_job];\n }\n\n function viewTickCache(address _liquidity) external view returns (TickCache memory _tickCache) {\n _tickCache = _tick[_liquidity];\n }\n\n function viewGas() external view returns (uint256) {\n return _initialGas;\n }\n}\n" - }, - "solidity/for-test/peripherals/jobs/Keep3rJobMigrationForTest.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../../../contracts/peripherals/jobs/Keep3rJobMigration.sol';\n\ncontract Keep3rJobMigrationForTest is Keep3rJobMigration {\n using EnumerableSet for EnumerableSet.AddressSet;\n\n mapping(address => uint256) public settleJobAccountanceCallCount;\n\n constructor(\n address _kph,\n address _keep3rV1,\n address _keep3rV1Proxy\n ) Keep3rParameters(_kph, _keep3rV1, _keep3rV1Proxy) Keep3rRoles(msg.sender) {}\n\n function setJobToken(address _job, address _token) external {\n _jobTokens[_job].add(_token);\n }\n\n function setJobLiquidity(address _job, address _liquidity) external {\n _jobLiquidities[_job].add(_liquidity);\n }\n\n function viewJobTokenListLength(address _job) external view returns (uint256) {\n return _jobTokens[_job].length();\n }\n\n function viewJobLiquidityList(address _job) external view returns (address[] memory _list) {\n _list = _jobLiquidities[_job].values();\n }\n\n function viewJobPeriodCredits(address _job) external view returns (uint256) {\n return _jobPeriodCredits[_job];\n }\n\n function viewJobLiquidityCredits(address _job) external view returns (uint256) {\n return _jobLiquidityCredits[_job];\n }\n\n function viewMigrationCreatedAt(address _fromJob, address _toJob) external view returns (uint256) {\n return _migrationCreatedAt[_fromJob][_toJob];\n }\n\n function isJob(address _job) external view returns (bool) {\n return _jobs.contains(_job);\n }\n\n function _settleJobAccountance(address _job) internal override {\n settleJobAccountanceCallCount[_job]++;\n }\n}\n" - }, - "solidity/for-test/peripherals/jobs/Keep3rJobManagerForTest.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../../../contracts/peripherals/jobs/Keep3rJobManager.sol';\n\ncontract Keep3rJobManagerForTest is Keep3rJobManager {\n using EnumerableSet for EnumerableSet.AddressSet;\n\n constructor(\n address _keep3rHelper,\n address _keep3rV1,\n address _keep3rV1Proxy\n ) Keep3rRoles(msg.sender) {}\n\n function isJob(address _job) external view returns (bool _isJob) {\n _isJob = _jobs.contains(_job);\n }\n}\n" - }, - "solidity/for-test/peripherals/jobs/Keep3rJobOwnershipForTest.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../../../contracts/peripherals/jobs/Keep3rJobOwnership.sol';\n\ncontract Keep3rJobOwnershipForTest is Keep3rJobOwnership {}\n" - }, - "solidity/for-test/libraries/LiquidityAmountsForTest.sol": { - "content": "// SPDX-License-Identifier: GPL-2.0-or-later\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../../contracts/libraries/FullMath.sol';\nimport '../../contracts/libraries/FixedPoint96.sol';\n\n/// @dev Made this library into a contract to be able to calculate liquidity more precisely for tests\n\n// solhint-disable\ncontract LiquidityAmountsForTest {\n function toUint128(uint256 x) private pure returns (uint128 y) {\n require((y = uint128(x)) == x);\n }\n\n function getLiquidityForAmount0(\n uint160 sqrtRatioAX96,\n uint160 sqrtRatioBX96,\n uint256 amount0\n ) public pure returns (uint128 liquidity) {\n if (sqrtRatioAX96 > sqrtRatioBX96) (sqrtRatioAX96, sqrtRatioBX96) = (sqrtRatioBX96, sqrtRatioAX96);\n uint256 intermediate = FullMath.mulDiv(sqrtRatioAX96, sqrtRatioBX96, FixedPoint96.Q96);\n return toUint128(FullMath.mulDiv(amount0, intermediate, sqrtRatioBX96 - sqrtRatioAX96));\n }\n\n function getLiquidityForAmount1(\n uint160 sqrtRatioAX96,\n uint160 sqrtRatioBX96,\n uint256 amount1\n ) public pure returns (uint128 liquidity) {\n if (sqrtRatioAX96 > sqrtRatioBX96) (sqrtRatioAX96, sqrtRatioBX96) = (sqrtRatioBX96, sqrtRatioAX96);\n return toUint128(FullMath.mulDiv(amount1, FixedPoint96.Q96, sqrtRatioBX96 - sqrtRatioAX96));\n }\n\n function getLiquidityForAmounts(\n uint160 sqrtRatioX96,\n uint160 sqrtRatioAX96,\n uint160 sqrtRatioBX96,\n uint256 amount0,\n uint256 amount1\n ) external pure returns (uint128 liquidity) {\n if (sqrtRatioAX96 > sqrtRatioBX96) (sqrtRatioAX96, sqrtRatioBX96) = (sqrtRatioBX96, sqrtRatioAX96);\n\n if (sqrtRatioX96 <= sqrtRatioAX96) {\n liquidity = getLiquidityForAmount0(sqrtRatioAX96, sqrtRatioBX96, amount0);\n } else if (sqrtRatioX96 < sqrtRatioBX96) {\n uint128 liquidity0 = getLiquidityForAmount0(sqrtRatioX96, sqrtRatioBX96, amount0);\n uint128 liquidity1 = getLiquidityForAmount1(sqrtRatioAX96, sqrtRatioX96, amount1);\n\n liquidity = liquidity0 < liquidity1 ? liquidity0 : liquidity1;\n } else {\n liquidity = getLiquidityForAmount1(sqrtRatioAX96, sqrtRatioBX96, amount1);\n }\n }\n\n function getAmount0ForLiquidity(\n uint160 sqrtRatioAX96,\n uint160 sqrtRatioBX96,\n uint128 liquidity\n ) public pure returns (uint256 amount0) {\n if (sqrtRatioAX96 > sqrtRatioBX96) (sqrtRatioAX96, sqrtRatioBX96) = (sqrtRatioBX96, sqrtRatioAX96);\n\n return FullMath.mulDiv(uint256(liquidity) << FixedPoint96.RESOLUTION, sqrtRatioBX96 - sqrtRatioAX96, sqrtRatioBX96) / sqrtRatioAX96;\n }\n\n function getAmount1ForLiquidity(\n uint160 sqrtRatioAX96,\n uint160 sqrtRatioBX96,\n uint128 liquidity\n ) public pure returns (uint256 amount1) {\n if (sqrtRatioAX96 > sqrtRatioBX96) (sqrtRatioAX96, sqrtRatioBX96) = (sqrtRatioBX96, sqrtRatioAX96);\n\n return FullMath.mulDiv(liquidity, sqrtRatioBX96 - sqrtRatioAX96, FixedPoint96.Q96);\n }\n\n function getAmountsForLiquidity(\n uint160 sqrtRatioX96,\n uint160 sqrtRatioAX96,\n uint160 sqrtRatioBX96,\n uint128 liquidity\n ) external pure returns (uint256 amount0, uint256 amount1) {\n if (sqrtRatioAX96 > sqrtRatioBX96) (sqrtRatioAX96, sqrtRatioBX96) = (sqrtRatioBX96, sqrtRatioAX96);\n\n if (sqrtRatioX96 <= sqrtRatioAX96) {\n amount0 = getAmount0ForLiquidity(sqrtRatioAX96, sqrtRatioBX96, liquidity);\n } else if (sqrtRatioX96 < sqrtRatioBX96) {\n amount0 = getAmount0ForLiquidity(sqrtRatioX96, sqrtRatioBX96, liquidity);\n amount1 = getAmount1ForLiquidity(sqrtRatioAX96, sqrtRatioX96, liquidity);\n } else {\n amount1 = getAmount1ForLiquidity(sqrtRatioAX96, sqrtRatioBX96, liquidity);\n }\n }\n}\n" - }, - "solidity/for-test/IUniswapV3PoolForTest.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '@uniswap/v3-core/contracts/interfaces/IERC20Minimal.sol';\nimport '@uniswap/v3-core/contracts/interfaces/IUniswapV3Pool.sol';\n\n// solhint-disable-next-line no-empty-blocks\ninterface IUniswapV3PoolForTest is IERC20Minimal, IUniswapV3Pool {\n\n}\n" - }, - "@uniswap/v3-core/contracts/interfaces/IERC20Minimal.sol": { - "content": "// SPDX-License-Identifier: GPL-2.0-or-later\npragma solidity >=0.5.0;\n\n/// @title Minimal ERC20 interface for Uniswap\n/// @notice Contains a subset of the full ERC20 interface that is used in Uniswap V3\ninterface IERC20Minimal {\n /// @notice Returns the balance of a token\n /// @param account The account for which to look up the number of tokens it has, i.e. its balance\n /// @return The number of tokens held by the account\n function balanceOf(address account) external view returns (uint256);\n\n /// @notice Transfers the amount of token from the `msg.sender` to the recipient\n /// @param recipient The account that will receive the amount transferred\n /// @param amount The number of tokens to send from the sender to the recipient\n /// @return Returns true for a successful transfer, false for an unsuccessful transfer\n function transfer(address recipient, uint256 amount) external returns (bool);\n\n /// @notice Returns the current allowance given to a spender by an owner\n /// @param owner The account of the token owner\n /// @param spender The account of the token spender\n /// @return The current allowance granted by `owner` to `spender`\n function allowance(address owner, address spender) external view returns (uint256);\n\n /// @notice Sets the allowance of a spender from the `msg.sender` to the value `amount`\n /// @param spender The account which will be allowed to spend a given amount of the owners tokens\n /// @param amount The amount of tokens allowed to be used by `spender`\n /// @return Returns true for a successful approval, false for unsuccessful\n function approve(address spender, uint256 amount) external returns (bool);\n\n /// @notice Transfers `amount` tokens from `sender` to `recipient` up to the allowance given to the `msg.sender`\n /// @param sender The account from which the transfer will be initiated\n /// @param recipient The recipient of the transfer\n /// @param amount The amount of the transfer\n /// @return Returns true for a successful transfer, false for unsuccessful\n function transferFrom(\n address sender,\n address recipient,\n uint256 amount\n ) external returns (bool);\n\n /// @notice Event emitted when tokens are transferred from one address to another, either via `#transfer` or `#transferFrom`.\n /// @param from The account from which the tokens were sent, i.e. the balance decreased\n /// @param to The account to which the tokens were sent, i.e. the balance increased\n /// @param value The amount of tokens that were transferred\n event Transfer(address indexed from, address indexed to, uint256 value);\n\n /// @notice Event emitted when the approval amount for the spender of a given owner's tokens changes.\n /// @param owner The account that approved spending of its tokens\n /// @param spender The account for which the spending allowance was modified\n /// @param value The new allowance from the owner to the spender\n event Approval(address indexed owner, address indexed spender, uint256 value);\n}\n" - } - }, - "settings": { - "optimizer": { - "enabled": true, - "runs": 33 - }, - "outputSelection": { - "*": { - "*": [ - "storageLayout", - "abi", - "evm.bytecode", - "evm.deployedBytecode", - "evm.methodIdentifiers", - "metadata", - "devdoc", - "userdoc", - "evm.gasEstimates" - ], - "": [ - "ast" - ] - } - }, - "metadata": { - "useLiteralContent": true - }, - "libraries": { - "": { - "__CACHE_BREAKER__": "0x00000000d41867734bbee4c6863d9255b2b06ac1" - } - } - } -} \ No newline at end of file diff --git a/deployments/optimisticGoerli/solcInputs/7d006d28afea8f44b7106e2df679db88.json b/deployments/optimisticGoerli/solcInputs/7d006d28afea8f44b7106e2df679db88.json deleted file mode 100644 index 771a29a..0000000 --- a/deployments/optimisticGoerli/solcInputs/7d006d28afea8f44b7106e2df679db88.json +++ /dev/null @@ -1,334 +0,0 @@ -{ - "language": "Solidity", - "sources": { - "solidity/contracts/Keep3r.sol": { - "content": "// SPDX-License-Identifier: MIT\n\n/*\n\nCoded for The Keep3r Network with ♥ by\n\n██████╗░███████╗███████╗██╗░░░██╗░░░░░░░██╗░█████╗░███╗░░██╗██████╗░███████╗██████╗░██╗░░░░░░█████╗░███╗░░██╗██████╗░\n██╔══██╗██╔════╝██╔════╝██║░░░██║░░██╗░░██║██╔══██╗████╗░██║██╔══██╗██╔════╝██╔══██╗██║░░░░░██╔══██╗████╗░██║██╔══██╗\n██║░░██║█████╗░░█████╗░░██║░░░╚██╗████╗██╔╝██║░░██║██╔██╗██║██║░░██║█████╗░░██████╔╝██║░░░░░███████║██╔██╗██║██║░░██║\n██║░░██║██╔══╝░░██╔══╝░░██║░░░░████╔═████║░██║░░██║██║╚████║██║░░██║██╔══╝░░██╔══██╗██║░░░░░██╔══██║██║╚████║██║░░██║\n██████╔╝███████╗██║░░░░░██║░░░░╚██╔╝░╚██╔╝░╚█████╔╝██║░╚███║██████╔╝███████╗██║░░██║███████╗██║░░██║██║░╚███║██████╔╝\n╚═════╝░╚══════╝╚═╝░░░░░╚═╝░░░░░╚═╝░░░╚═╝░░░╚════╝░╚═╝░░╚══╝╚═════╝░╚══════╝╚═╝░░╚═╝╚══════╝╚═╝░░╚═╝╚═╝░░╚══╝╚═════╝░\n\nhttps://defi.sucks\n\n*/\n\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../interfaces/IKeep3r.sol';\nimport './peripherals/jobs/Keep3rJobs.sol';\nimport './peripherals/keepers/Keep3rKeepers.sol';\nimport './peripherals/DustCollector.sol';\n\ncontract Keep3r is IKeep3r, Keep3rJobs, Keep3rKeepers {\n constructor(\n address _governance,\n address _keep3rHelper,\n address _keep3rV1,\n address _keep3rV1Proxy\n ) Keep3rParameters(_keep3rHelper, _keep3rV1, _keep3rV1Proxy) Keep3rRoles(_governance) {}\n}\n" - }, - "solidity/interfaces/IKeep3r.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport './peripherals/IKeep3rJobs.sol';\nimport './peripherals/IKeep3rKeepers.sol';\nimport './peripherals/IKeep3rParameters.sol';\n\n// solhint-disable-next-line no-empty-blocks\n\n/// @title Keep3rV2 contract\n/// @notice This contract inherits all the functionality of Keep3rV2\ninterface IKeep3r is IKeep3rJobs, IKeep3rKeepers, IKeep3rParameters {\n\n}\n" - }, - "solidity/contracts/peripherals/jobs/Keep3rJobs.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../../../interfaces/peripherals/IKeep3rJobs.sol';\nimport './Keep3rJobManager.sol';\nimport './Keep3rJobWorkable.sol';\nimport './Keep3rJobDisputable.sol';\n\nabstract contract Keep3rJobs is IKeep3rJobs, Keep3rJobManager, Keep3rJobWorkable, Keep3rJobDisputable {}\n" - }, - "solidity/contracts/peripherals/keepers/Keep3rKeepers.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../../../interfaces/peripherals/IKeep3rKeepers.sol';\nimport './Keep3rKeeperDisputable.sol';\n\nabstract contract Keep3rKeepers is IKeep3rKeepers, Keep3rKeeperDisputable {}\n" - }, - "solidity/contracts/peripherals/DustCollector.sol": { - "content": "// SPDX-License-Identifier: MIT\n\npragma solidity >=0.8.4 <0.9.0;\n\nimport '@openzeppelin/contracts/token/ERC20/IERC20.sol';\nimport '@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol';\nimport '../../contracts/peripherals/Governable.sol';\nimport '../../interfaces/peripherals/IDustCollector.sol';\n\nabstract contract DustCollector is IDustCollector, Governable {\n using SafeERC20 for IERC20;\n\n address internal constant _ETH_ADDRESS = 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE;\n\n function sendDust(\n address _token,\n uint256 _amount,\n address _to\n ) external override onlyGovernance {\n if (_to == address(0)) revert ZeroAddress();\n if (_token == _ETH_ADDRESS) {\n payable(_to).transfer(_amount);\n } else {\n IERC20(_token).safeTransfer(_to, _amount);\n }\n emit DustSent(_token, _amount, _to);\n }\n}\n" - }, - "solidity/interfaces/peripherals/IKeep3rJobs.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport './IKeep3rDisputable.sol';\n\n/// @title Keep3rJobOwnership contract\n/// @notice Handles the ownership of the jobs\ninterface IKeep3rJobOwnership {\n // Events\n\n /// @notice Emitted when Keep3rJobOwnership#changeJobOwnership is called\n /// @param _job The address of the job proposed to have a change of owner\n /// @param _owner The current owner of the job\n /// @param _pendingOwner The new address proposed to be the owner of the job\n event JobOwnershipChange(address indexed _job, address indexed _owner, address indexed _pendingOwner);\n\n /// @notice Emitted when Keep3rJobOwnership#JobOwnershipAssent is called\n /// @param _job The address of the job which the proposed owner will now own\n /// @param _previousOwner The previous owner of the job\n /// @param _newOwner The new owner of the job\n event JobOwnershipAssent(address indexed _job, address indexed _previousOwner, address indexed _newOwner);\n\n // Errors\n\n /// @notice Throws when the caller of the function is not the job owner\n error OnlyJobOwner();\n\n /// @notice Throws when the caller of the function is not the pending job owner\n error OnlyPendingJobOwner();\n\n // Variables\n\n /// @notice Maps the job to the owner of the job\n /// @param _job The address of the job\n /// @return _owner The address of the owner of the job\n function jobOwner(address _job) external view returns (address _owner);\n\n /// @notice Maps the job to its pending owner\n /// @param _job The address of the job\n /// @return _pendingOwner The address of the pending owner of the job\n function jobPendingOwner(address _job) external view returns (address _pendingOwner);\n\n // Methods\n\n /// @notice Proposes a new address to be the owner of the job\n /// @param _job The address of the job\n /// @param _newOwner The address of the proposed new owner\n function changeJobOwnership(address _job, address _newOwner) external;\n\n /// @notice The proposed address accepts to be the owner of the job\n /// @param _job The address of the job\n function acceptJobOwnership(address _job) external;\n}\n\n/// @title Keep3rJobManager contract\n/// @notice Handles the addition and withdrawal of credits from a job\ninterface IKeep3rJobManager is IKeep3rJobOwnership {\n // Events\n\n /// @notice Emitted when Keep3rJobManager#addJob is called\n /// @param _job The address of the job to add\n /// @param _jobOwner The job's owner\n event JobAddition(address indexed _job, address indexed _jobOwner);\n\n // Errors\n\n /// @notice Throws when trying to add a job that has already been added\n error JobAlreadyAdded();\n\n /// @notice Throws when the address that is trying to register as a keeper is already a keeper\n error AlreadyAKeeper();\n\n // Methods\n\n /// @notice Allows any caller to add a new job\n /// @param _job Address of the contract for which work should be performed\n function addJob(address _job) external;\n}\n\n/// @title Keep3rJobFundableCredits contract\n/// @notice Handles the addition and withdrawal of credits from a job\ninterface IKeep3rJobFundableCredits is IKeep3rJobOwnership {\n // Events\n\n /// @notice Emitted when Keep3rJobFundableCredits#addTokenCreditsToJob is called\n /// @param _job The address of the job being credited\n /// @param _token The address of the token being provided\n /// @param _provider The user that calls the function\n /// @param _amount The amount of credit being added to the job\n event TokenCreditAddition(address indexed _job, address indexed _token, address indexed _provider, uint256 _amount);\n\n /// @notice Emitted when Keep3rJobFundableCredits#withdrawTokenCreditsFromJob is called\n /// @param _job The address of the job from which the credits are withdrawn\n /// @param _token The credit being withdrawn from the job\n /// @param _receiver The user that receives the tokens\n /// @param _amount The amount of credit withdrawn\n event TokenCreditWithdrawal(address indexed _job, address indexed _token, address indexed _receiver, uint256 _amount);\n\n // Errors\n\n /// @notice Throws when the token is KP3R, as it should not be used for direct token payments\n error TokenUnallowed();\n\n /// @notice Throws when the token withdraw cooldown has not yet passed\n error JobTokenCreditsLocked();\n\n /// @notice Throws when the user tries to withdraw more tokens than it has\n error InsufficientJobTokenCredits();\n\n // Variables\n\n /// @notice Last block where tokens were added to the job\n /// @param _job The address of the job credited\n /// @param _token The address of the token credited\n /// @return _timestamp The last block where tokens were added to the job\n function jobTokenCreditsAddedAt(address _job, address _token) external view returns (uint256 _timestamp);\n\n // Methods\n\n /// @notice Add credit to a job to be paid out for work\n /// @param _job The address of the job being credited\n /// @param _token The address of the token being credited\n /// @param _amount The amount of credit being added\n function addTokenCreditsToJob(\n address _job,\n address _token,\n uint256 _amount\n ) external;\n\n /// @notice Withdraw credit from a job\n /// @param _job The address of the job from which the credits are withdrawn\n /// @param _token The address of the token being withdrawn\n /// @param _amount The amount of token to be withdrawn\n /// @param _receiver The user that will receive tokens\n function withdrawTokenCreditsFromJob(\n address _job,\n address _token,\n uint256 _amount,\n address _receiver\n ) external;\n}\n\n/// @title Keep3rJobFundableLiquidity contract\n/// @notice Handles the funding of jobs through specific liquidity pairs\ninterface IKeep3rJobFundableLiquidity is IKeep3rJobOwnership {\n // Events\n\n /// @notice Emitted when Keep3rJobFundableLiquidity#approveLiquidity function is called\n /// @param _liquidity The address of the liquidity pair being approved\n event LiquidityApproval(address _liquidity);\n\n /// @notice Emitted when Keep3rJobFundableLiquidity#revokeLiquidity function is called\n /// @param _liquidity The address of the liquidity pair being revoked\n event LiquidityRevocation(address _liquidity);\n\n /// @notice Emitted when IKeep3rJobFundableLiquidity#addLiquidityToJob function is called\n /// @param _job The address of the job to which liquidity will be added\n /// @param _liquidity The address of the liquidity being added\n /// @param _provider The user that calls the function\n /// @param _amount The amount of liquidity being added\n event LiquidityAddition(address indexed _job, address indexed _liquidity, address indexed _provider, uint256 _amount);\n\n /// @notice Emitted when IKeep3rJobFundableLiquidity#withdrawLiquidityFromJob function is called\n /// @param _job The address of the job of which liquidity will be withdrawn from\n /// @param _liquidity The address of the liquidity being withdrawn\n /// @param _receiver The receiver of the liquidity tokens\n /// @param _amount The amount of liquidity being withdrawn from the job\n event LiquidityWithdrawal(address indexed _job, address indexed _liquidity, address indexed _receiver, uint256 _amount);\n\n /// @notice Emitted when Keep3rJobFundableLiquidity#addLiquidityToJob function is called\n /// @param _job The address of the job whose credits will be updated\n /// @param _rewardedAt The time at which the job was last rewarded\n /// @param _currentCredits The current credits of the job\n /// @param _periodCredits The credits of the job for the current period\n event LiquidityCreditsReward(address indexed _job, uint256 _rewardedAt, uint256 _currentCredits, uint256 _periodCredits);\n\n /// @notice Emitted when Keep3rJobFundableLiquidity#forceLiquidityCreditsToJob function is called\n /// @param _job The address of the job whose credits will be updated\n /// @param _rewardedAt The time at which the job was last rewarded\n /// @param _currentCredits The current credits of the job\n event LiquidityCreditsForced(address indexed _job, uint256 _rewardedAt, uint256 _currentCredits);\n\n // Errors\n\n /// @notice Throws when the liquidity being approved has already been approved\n error LiquidityPairApproved();\n\n /// @notice Throws when the liquidity being removed has not been approved\n error LiquidityPairUnexistent();\n\n /// @notice Throws when trying to add liquidity to an unapproved pool\n error LiquidityPairUnapproved();\n\n /// @notice Throws when the job doesn't have the requested liquidity\n error JobLiquidityUnexistent();\n\n /// @notice Throws when trying to remove more liquidity than the job has\n error JobLiquidityInsufficient();\n\n /// @notice Throws when trying to add less liquidity than the minimum liquidity required\n error JobLiquidityLessThanMin();\n\n // Structs\n\n /// @notice Stores the tick information of the different liquidity pairs\n struct TickCache {\n int56 current; // Tracks the current tick\n int56 difference; // Stores the difference between the current tick and the last tick\n uint256 period; // Stores the period at which the last observation was made\n }\n\n // Variables\n\n /// @notice Lists liquidity pairs\n /// @return _list An array of addresses with all the approved liquidity pairs\n function approvedLiquidities() external view returns (address[] memory _list);\n\n /// @notice Amount of liquidity in a specified job\n /// @param _job The address of the job being checked\n /// @param _liquidity The address of the liquidity we are checking\n /// @return _amount Amount of liquidity in the specified job\n function liquidityAmount(address _job, address _liquidity) external view returns (uint256 _amount);\n\n /// @notice Last time the job was rewarded liquidity credits\n /// @param _job The address of the job being checked\n /// @return _timestamp Timestamp of the last time the job was rewarded liquidity credits\n function rewardedAt(address _job) external view returns (uint256 _timestamp);\n\n /// @notice Last time the job was worked\n /// @param _job The address of the job being checked\n /// @return _timestamp Timestamp of the last time the job was worked\n function workedAt(address _job) external view returns (uint256 _timestamp);\n\n // Methods\n\n /// @notice Returns the liquidity credits of a given job\n /// @param _job The address of the job of which we want to know the liquidity credits\n /// @return _amount The liquidity credits of a given job\n function jobLiquidityCredits(address _job) external view returns (uint256 _amount);\n\n /// @notice Returns the credits of a given job for the current period\n /// @param _job The address of the job of which we want to know the period credits\n /// @return _amount The credits the given job has at the current period\n function jobPeriodCredits(address _job) external view returns (uint256 _amount);\n\n /// @notice Calculates the total credits of a given job\n /// @param _job The address of the job of which we want to know the total credits\n /// @return _amount The total credits of the given job\n function totalJobCredits(address _job) external view returns (uint256 _amount);\n\n /// @notice Calculates how many credits should be rewarded periodically for a given liquidity amount\n /// @dev _periodCredits = underlying KP3Rs for given liquidity amount * rewardPeriod / inflationPeriod\n /// @param _liquidity The address of the liquidity to provide\n /// @param _amount The amount of liquidity to provide\n /// @return _periodCredits The amount of KP3R periodically minted for the given liquidity\n function quoteLiquidity(address _liquidity, uint256 _amount) external view returns (uint256 _periodCredits);\n\n /// @notice Observes the current state of the liquidity pair being observed and updates TickCache with the information\n /// @param _liquidity The address of the liquidity pair being observed\n /// @return _tickCache The updated TickCache\n function observeLiquidity(address _liquidity) external view returns (TickCache memory _tickCache);\n\n /// @notice Gifts liquidity credits to the specified job\n /// @param _job The address of the job being credited\n /// @param _amount The amount of liquidity credits to gift\n function forceLiquidityCreditsToJob(address _job, uint256 _amount) external;\n\n /// @notice Approve a liquidity pair for being accepted in future\n /// @param _liquidity The address of the liquidity accepted\n function approveLiquidity(address _liquidity) external;\n\n /// @notice Revoke a liquidity pair from being accepted in future\n /// @param _liquidity The liquidity no longer accepted\n function revokeLiquidity(address _liquidity) external;\n\n /// @notice Allows anyone to fund a job with liquidity\n /// @param _job The address of the job to assign liquidity to\n /// @param _liquidity The liquidity being added\n /// @param _amount The amount of liquidity tokens to add\n function addLiquidityToJob(\n address _job,\n address _liquidity,\n uint256 _amount\n ) external;\n\n /// @notice Unbond liquidity for a job\n /// @dev Can only be called by the job's owner\n /// @param _job The address of the job being unbonded from\n /// @param _liquidity The liquidity being unbonded\n /// @param _amount The amount of liquidity being removed\n function unbondLiquidityFromJob(\n address _job,\n address _liquidity,\n uint256 _amount\n ) external;\n\n /// @notice Withdraw liquidity from a job\n /// @param _job The address of the job being withdrawn from\n /// @param _liquidity The liquidity being withdrawn\n /// @param _receiver The address that will receive the withdrawn liquidity\n function withdrawLiquidityFromJob(\n address _job,\n address _liquidity,\n address _receiver\n ) external;\n}\n\n/// @title Keep3rJobMigration contract\n/// @notice Handles the migration process of jobs to different addresses\ninterface IKeep3rJobMigration is IKeep3rJobFundableCredits, IKeep3rJobFundableLiquidity {\n // Events\n\n /// @notice Emitted when Keep3rJobMigration#migrateJob function is called\n /// @param _fromJob The address of the job that requests to migrate\n /// @param _toJob The address at which the job requests to migrate\n event JobMigrationRequested(address indexed _fromJob, address _toJob);\n\n /// @notice Emitted when Keep3rJobMigration#acceptJobMigration function is called\n /// @param _fromJob The address of the job that requested to migrate\n /// @param _toJob The address at which the job had requested to migrate\n event JobMigrationSuccessful(address _fromJob, address indexed _toJob);\n\n // Errors\n\n /// @notice Throws when the address of the job that requests to migrate wants to migrate to its same address\n error JobMigrationImpossible();\n\n /// @notice Throws when the _toJob address differs from the address being tracked in the pendingJobMigrations mapping\n error JobMigrationUnavailable();\n\n /// @notice Throws when cooldown between migrations has not yet passed\n error JobMigrationLocked();\n\n // Variables\n\n /// @notice Maps the jobs that have requested a migration to the address they have requested to migrate to\n /// @return _toJob The address to which the job has requested to migrate to\n function pendingJobMigrations(address _fromJob) external view returns (address _toJob);\n\n // Methods\n\n /// @notice Initializes the migration process for a job by adding the request to the pendingJobMigrations mapping\n /// @param _fromJob The address of the job that is requesting to migrate\n /// @param _toJob The address at which the job is requesting to migrate\n function migrateJob(address _fromJob, address _toJob) external;\n\n /// @notice Completes the migration process for a job\n /// @dev Unbond/withdraw process doesn't get migrated\n /// @param _fromJob The address of the job that requested to migrate\n /// @param _toJob The address to which the job wants to migrate to\n function acceptJobMigration(address _fromJob, address _toJob) external;\n}\n\n/// @title Keep3rJobWorkable contract\n/// @notice Handles the mechanisms jobs can pay keepers with along with the restrictions jobs can put on keepers before they can work on jobs\ninterface IKeep3rJobWorkable is IKeep3rJobMigration {\n // Events\n\n /// @notice Emitted when a keeper is validated before a job\n /// @param _gasLeft The amount of gas that the transaction has left at the moment of keeper validation\n event KeeperValidation(uint256 _gasLeft);\n\n /// @notice Emitted when a keeper works a job\n /// @param _credit The address of the asset in which the keeper is paid\n /// @param _job The address of the job the keeper has worked\n /// @param _keeper The address of the keeper that has worked the job\n /// @param _payment The amount that has been paid out to the keeper in exchange for working the job\n /// @param _gasLeft The amount of gas that the transaction has left at the moment of payment\n event KeeperWork(address indexed _credit, address indexed _job, address indexed _keeper, uint256 _payment, uint256 _gasLeft);\n\n // Errors\n\n /// @notice Throws if work method was called without calling isKeeper or isBondedKeeper\n error GasNotInitialized();\n\n /// @notice Throws if the address claiming to be a job is not in the list of approved jobs\n error JobUnapproved();\n\n /// @notice Throws if the amount of funds in the job is less than the payment that must be paid to the keeper that works that job\n error InsufficientFunds();\n\n // Methods\n\n /// @notice Confirms if the current keeper is registered\n /// @dev Can be used for general (non critical) functions\n /// @param _keeper The keeper being investigated\n /// @return _isKeeper Whether the address passed as a parameter is a keeper or not\n function isKeeper(address _keeper) external returns (bool _isKeeper);\n\n /// @notice Confirms if the current keeper is registered and has a minimum bond of any asset.\n /// @dev Should be used for protected functions\n /// @param _keeper The keeper to check\n /// @param _bond The bond token being evaluated\n /// @param _minBond The minimum amount of bonded tokens\n /// @param _earned The minimum funds earned in the keepers lifetime\n /// @param _age The minimum keeper age required\n /// @return _isBondedKeeper Whether the `_keeper` meets the given requirements\n function isBondedKeeper(\n address _keeper,\n address _bond,\n uint256 _minBond,\n uint256 _earned,\n uint256 _age\n ) external returns (bool _isBondedKeeper);\n\n /// @notice Implemented by jobs to show that a keeper performed work\n /// @dev Automatically calculates the payment for the keeper and pays the keeper with bonded KP3R\n /// @param _keeper Address of the keeper that performed the work\n function worked(address _keeper) external;\n\n /// @notice Implemented by jobs to show that a keeper performed work\n /// @dev Pays the keeper that performs the work with KP3R\n /// @param _keeper Address of the keeper that performed the work\n /// @param _payment The reward that should be allocated for the job\n function bondedPayment(address _keeper, uint256 _payment) external;\n\n /// @notice Implemented by jobs to show that a keeper performed work\n /// @dev Pays the keeper that performs the work with a specific token\n /// @param _token The asset being awarded to the keeper\n /// @param _keeper Address of the keeper that performed the work\n /// @param _amount The reward that should be allocated\n function directTokenPayment(\n address _token,\n address _keeper,\n uint256 _amount\n ) external;\n}\n\n/// @title Keep3rJobDisputable contract\n/// @notice Handles the actions that can be taken on a disputed job\ninterface IKeep3rJobDisputable is IKeep3rDisputable, IKeep3rJobFundableCredits, IKeep3rJobFundableLiquidity {\n // Events\n\n /// @notice Emitted when Keep3rJobDisputable#slashTokenFromJob is called\n /// @param _job The address of the job from which the token will be slashed\n /// @param _token The address of the token being slashed\n /// @param _slasher The user that slashes the token\n /// @param _amount The amount of the token being slashed\n event JobSlashToken(address indexed _job, address _token, address indexed _slasher, uint256 _amount);\n\n /// @notice Emitted when Keep3rJobDisputable#slashLiquidityFromJob is called\n /// @param _job The address of the job from which the liquidity will be slashed\n /// @param _liquidity The address of the liquidity being slashed\n /// @param _slasher The user that slashes the liquidity\n /// @param _amount The amount of the liquidity being slashed\n event JobSlashLiquidity(address indexed _job, address _liquidity, address indexed _slasher, uint256 _amount);\n\n // Errors\n\n /// @notice Throws when the token trying to be slashed doesn't exist\n error JobTokenUnexistent();\n\n /// @notice Throws when someone tries to slash more tokens than the job has\n error JobTokenInsufficient();\n\n // Methods\n\n /// @notice Allows governance or slasher to slash a job specific token\n /// @param _job The address of the job from which the token will be slashed\n /// @param _token The address of the token that will be slashed\n /// @param _amount The amount of the token that will be slashed\n function slashTokenFromJob(\n address _job,\n address _token,\n uint256 _amount\n ) external;\n\n /// @notice Allows governance or a slasher to slash liquidity from a job\n /// @param _job The address being slashed\n /// @param _liquidity The address of the liquidity that will be slashed\n /// @param _amount The amount of liquidity that will be slashed\n function slashLiquidityFromJob(\n address _job,\n address _liquidity,\n uint256 _amount\n ) external;\n}\n\n// solhint-disable-next-line no-empty-blocks\ninterface IKeep3rJobs is IKeep3rJobWorkable, IKeep3rJobManager, IKeep3rJobDisputable {\n\n}\n" - }, - "solidity/interfaces/peripherals/IKeep3rKeepers.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport './IKeep3rDisputable.sol';\n\n/// @title Keep3rKeeperFundable contract\n/// @notice Handles the actions required to become a keeper\ninterface IKeep3rKeeperFundable {\n // Events\n\n /// @notice Emitted when Keep3rKeeperFundable#activate is called\n /// @param _keeper The keeper that has been activated\n /// @param _bond The asset the keeper has bonded\n /// @param _amount The amount of the asset the keeper has bonded\n event Activation(address indexed _keeper, address indexed _bond, uint256 _amount);\n\n /// @notice Emitted when Keep3rKeeperFundable#withdraw is called\n /// @param _keeper The caller of Keep3rKeeperFundable#withdraw function\n /// @param _bond The asset to withdraw from the bonding pool\n /// @param _amount The amount of funds withdrawn\n event Withdrawal(address indexed _keeper, address indexed _bond, uint256 _amount);\n\n // Errors\n\n /// @notice Throws when the address that is trying to register as a job is already a job\n error AlreadyAJob();\n\n // Methods\n\n /// @notice Beginning of the bonding process\n /// @param _bonding The asset being bonded\n /// @param _amount The amount of bonding asset being bonded\n function bond(address _bonding, uint256 _amount) external;\n\n /// @notice Beginning of the unbonding process\n /// @param _bonding The asset being unbonded\n /// @param _amount Allows for partial unbonding\n function unbond(address _bonding, uint256 _amount) external;\n\n /// @notice End of the bonding process after bonding time has passed\n /// @param _bonding The asset being activated as bond collateral\n function activate(address _bonding) external;\n\n /// @notice Withdraw funds after unbonding has finished\n /// @param _bonding The asset to withdraw from the bonding pool\n function withdraw(address _bonding) external;\n}\n\n/// @title Keep3rKeeperDisputable contract\n/// @notice Handles the actions that can be taken on a disputed keeper\ninterface IKeep3rKeeperDisputable is IKeep3rDisputable, IKeep3rKeeperFundable {\n // Events\n\n /// @notice Emitted when Keep3rKeeperDisputable#slash is called\n /// @param _keeper The address of the slashed keeper\n /// @param _slasher The user that called Keep3rKeeperDisputable#slash\n /// @param _amount The amount of credits slashed from the keeper\n event KeeperSlash(address indexed _keeper, address indexed _slasher, uint256 _amount);\n\n /// @notice Emitted when Keep3rKeeperDisputable#revoke is called\n /// @param _keeper The address of the revoked keeper\n /// @param _slasher The user that called Keep3rKeeperDisputable#revoke\n event KeeperRevoke(address indexed _keeper, address indexed _slasher);\n\n // Methods\n\n /// @notice Allows governance to slash a keeper based on a dispute\n /// @param _keeper The address being slashed\n /// @param _bonded The asset being slashed\n /// @param _bondAmount The bonded amount being slashed\n /// @param _unbondAmount The pending unbond amount being slashed\n function slash(\n address _keeper,\n address _bonded,\n uint256 _bondAmount,\n uint256 _unbondAmount\n ) external;\n\n /// @notice Blacklists a keeper from participating in the network\n /// @param _keeper The address being slashed\n function revoke(address _keeper) external;\n}\n\n// solhint-disable-next-line no-empty-blocks\n\n/// @title Keep3rKeepers contract\ninterface IKeep3rKeepers is IKeep3rKeeperDisputable {\n\n}\n" - }, - "solidity/interfaces/peripherals/IKeep3rParameters.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport './IKeep3rAccountance.sol';\n\n/// @title Keep3rParameters contract\n/// @notice Handles and sets all the required parameters for Keep3r\ninterface IKeep3rParameters is IKeep3rAccountance {\n // Events\n\n /// @notice Emitted when the Keep3rHelper address is changed\n /// @param _keep3rHelper The address of Keep3rHelper's contract\n event Keep3rHelperChange(address _keep3rHelper);\n\n /// @notice Emitted when the Keep3rV1 address is changed\n /// @param _keep3rV1 The address of Keep3rV1's contract\n event Keep3rV1Change(address _keep3rV1);\n\n /// @notice Emitted when the Keep3rV1Proxy address is changed\n /// @param _keep3rV1Proxy The address of Keep3rV1Proxy's contract\n event Keep3rV1ProxyChange(address _keep3rV1Proxy);\n\n /// @notice Emitted when bondTime is changed\n /// @param _bondTime The new bondTime\n event BondTimeChange(uint256 _bondTime);\n\n /// @notice Emitted when _liquidityMinimum is changed\n /// @param _liquidityMinimum The new _liquidityMinimum\n event LiquidityMinimumChange(uint256 _liquidityMinimum);\n\n /// @notice Emitted when _unbondTime is changed\n /// @param _unbondTime The new _unbondTime\n event UnbondTimeChange(uint256 _unbondTime);\n\n /// @notice Emitted when _rewardPeriodTime is changed\n /// @param _rewardPeriodTime The new _rewardPeriodTime\n event RewardPeriodTimeChange(uint256 _rewardPeriodTime);\n\n /// @notice Emitted when the inflationPeriod is changed\n /// @param _inflationPeriod The new inflationPeriod\n event InflationPeriodChange(uint256 _inflationPeriod);\n\n /// @notice Emitted when the fee is changed\n /// @param _fee The new token credits fee\n event FeeChange(uint256 _fee);\n\n // Variables\n\n /// @notice Address of Keep3rHelper's contract\n /// @return _keep3rHelper The address of Keep3rHelper's contract\n function keep3rHelper() external view returns (address _keep3rHelper);\n\n /// @notice Address of Keep3rV1's contract\n /// @return _keep3rV1 The address of Keep3rV1's contract\n function keep3rV1() external view returns (address _keep3rV1);\n\n /// @notice Address of Keep3rV1Proxy's contract\n /// @return _keep3rV1Proxy The address of Keep3rV1Proxy's contract\n function keep3rV1Proxy() external view returns (address _keep3rV1Proxy);\n\n /// @notice The amount of time required to pass after a keeper has bonded assets for it to be able to activate\n /// @return _days The required bondTime in days\n function bondTime() external view returns (uint256 _days);\n\n /// @notice The amount of time required to pass before a keeper can unbond what he has bonded\n /// @return _days The required unbondTime in days\n function unbondTime() external view returns (uint256 _days);\n\n /// @notice The minimum amount of liquidity required to fund a job per liquidity\n /// @return _amount The minimum amount of liquidity in KP3R\n function liquidityMinimum() external view returns (uint256 _amount);\n\n /// @notice The amount of time between each scheduled credits reward given to a job\n /// @return _days The reward period in days\n function rewardPeriodTime() external view returns (uint256 _days);\n\n /// @notice The inflation period is the denominator used to regulate the emission of KP3R\n /// @return _period The denominator used to regulate the emission of KP3R\n function inflationPeriod() external view returns (uint256 _period);\n\n /// @notice The fee to be sent to governance when a user adds liquidity to a job\n /// @return _amount The fee amount to be sent to governance when a user adds liquidity to a job\n function fee() external view returns (uint256 _amount);\n\n // Errors\n\n /// @notice Throws if the reward period is less than the minimum reward period time\n error MinRewardPeriod();\n\n /// @notice Throws if either a job or a keeper is disputed\n error Disputed();\n\n /// @notice Throws if there are no bonded assets\n error BondsUnexistent();\n\n /// @notice Throws if the time required to bond an asset has not passed yet\n error BondsLocked();\n\n /// @notice Throws if there are no bonds to withdraw\n error UnbondsUnexistent();\n\n /// @notice Throws if the time required to withdraw the bonds has not passed yet\n error UnbondsLocked();\n\n // Methods\n\n /// @notice Sets the Keep3rHelper address\n /// @param _keep3rHelper The Keep3rHelper address\n function setKeep3rHelper(address _keep3rHelper) external;\n\n /// @notice Sets the Keep3rV1 address\n /// @param _keep3rV1 The Keep3rV1 address\n function setKeep3rV1(address _keep3rV1) external;\n\n /// @notice Sets the Keep3rV1Proxy address\n /// @param _keep3rV1Proxy The Keep3rV1Proxy address\n function setKeep3rV1Proxy(address _keep3rV1Proxy) external;\n\n /// @notice Sets the bond time required to activate as a keeper\n /// @param _bond The new bond time\n function setBondTime(uint256 _bond) external;\n\n /// @notice Sets the unbond time required unbond what has been bonded\n /// @param _unbond The new unbond time\n function setUnbondTime(uint256 _unbond) external;\n\n /// @notice Sets the minimum amount of liquidity required to fund a job\n /// @param _liquidityMinimum The new minimum amount of liquidity\n function setLiquidityMinimum(uint256 _liquidityMinimum) external;\n\n /// @notice Sets the time required to pass between rewards for jobs\n /// @param _rewardPeriodTime The new amount of time required to pass between rewards\n function setRewardPeriodTime(uint256 _rewardPeriodTime) external;\n\n /// @notice Sets the new inflation period\n /// @param _inflationPeriod The new inflation period\n function setInflationPeriod(uint256 _inflationPeriod) external;\n\n /// @notice Sets the new fee\n /// @param _fee The new fee\n function setFee(uint256 _fee) external;\n}\n" - }, - "solidity/interfaces/peripherals/IKeep3rDisputable.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\n/// @title Keep3rDisputable contract\n/// @notice Creates/resolves disputes for jobs or keepers\n/// A disputed keeper is slashable and is not able to bond, activate, withdraw or receive direct payments\n/// A disputed job is slashable and is not able to pay the keepers, withdraw tokens or to migrate\ninterface IKeep3rDisputable {\n /// @notice Emitted when a keeper or a job is disputed\n /// @param _jobOrKeeper The address of the disputed keeper/job\n /// @param _disputer The user that called the function and disputed the keeper\n event Dispute(address indexed _jobOrKeeper, address indexed _disputer);\n\n /// @notice Emitted when a dispute is resolved\n /// @param _jobOrKeeper The address of the disputed keeper/job\n /// @param _resolver The user that called the function and resolved the dispute\n event Resolve(address indexed _jobOrKeeper, address indexed _resolver);\n\n /// @notice Throws when a job or keeper is already disputed\n error AlreadyDisputed();\n\n /// @notice Throws when a job or keeper is not disputed and someone tries to resolve the dispute\n error NotDisputed();\n\n /// @notice Allows governance to create a dispute for a given keeper/job\n /// @param _jobOrKeeper The address in dispute\n function dispute(address _jobOrKeeper) external;\n\n /// @notice Allows governance to resolve a dispute on a keeper/job\n /// @param _jobOrKeeper The address cleared\n function resolve(address _jobOrKeeper) external;\n}\n" - }, - "solidity/interfaces/peripherals/IKeep3rAccountance.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport './IKeep3rRoles.sol';\n\n/// @title Keep3rDisputable contract\n/// @notice Disputes keepers, or if they're already disputed, it can resolve the case\n/// @dev Argument `bonding` can be the address of either a token or a liquidity\ninterface IKeep3rAccountance is IKeep3rRoles {\n // Events\n\n /// @notice Emitted when the bonding process of a new keeper begins\n /// @param _keeper The caller of Keep3rKeeperFundable#bond function\n /// @param _bonding The asset the keeper has bonded\n /// @param _amount The amount the keeper has bonded\n event Bonding(address indexed _keeper, address indexed _bonding, uint256 _amount);\n\n /// @notice Emitted when a keeper or job begins the unbonding process to withdraw the funds\n /// @param _keeperOrJob The keeper or job that began the unbonding process\n /// @param _unbonding The liquidity pair or asset being unbonded\n /// @param _amount The amount being unbonded\n event Unbonding(address indexed _keeperOrJob, address indexed _unbonding, uint256 _amount);\n\n // Variables\n\n /// @notice Tracks the total amount of bonded KP3Rs in the contract\n /// @return _totalBonds The total amount of bonded KP3Rs in the contract\n function totalBonds() external view returns (uint256 _totalBonds);\n\n /// @notice Tracks the total KP3R earnings of a keeper since it started working\n /// @param _keeper The address of the keeper\n /// @return _workCompleted Total KP3R earnings of a keeper since it started working\n function workCompleted(address _keeper) external view returns (uint256 _workCompleted);\n\n /// @notice Tracks when a keeper was first registered\n /// @param _keeper The address of the keeper\n /// @return timestamp The time at which the keeper was first registered\n function firstSeen(address _keeper) external view returns (uint256 timestamp);\n\n /// @notice Tracks if a keeper or job has a pending dispute\n /// @param _keeperOrJob The address of the keeper or job\n /// @return _disputed Whether a keeper or job has a pending dispute\n function disputes(address _keeperOrJob) external view returns (bool _disputed);\n\n /// @notice Tracks how much a keeper has bonded of a certain token\n /// @param _keeper The address of the keeper\n /// @param _bond The address of the token being bonded\n /// @return _bonds Amount of a certain token that a keeper has bonded\n function bonds(address _keeper, address _bond) external view returns (uint256 _bonds);\n\n /// @notice The current token credits available for a job\n /// @param _job The address of the job\n /// @param _token The address of the token bonded\n /// @return _amount The amount of token credits available for a job\n function jobTokenCredits(address _job, address _token) external view returns (uint256 _amount);\n\n /// @notice Tracks the amount of assets deposited in pending bonds\n /// @param _keeper The address of the keeper\n /// @param _bonding The address of the token being bonded\n /// @return _pendingBonds Amount of a certain asset a keeper has unbonding\n function pendingBonds(address _keeper, address _bonding) external view returns (uint256 _pendingBonds);\n\n /// @notice Tracks when a bonding for a keeper can be activated\n /// @param _keeper The address of the keeper\n /// @param _bonding The address of the token being bonded\n /// @return _timestamp Time at which the bonding for a keeper can be activated\n function canActivateAfter(address _keeper, address _bonding) external view returns (uint256 _timestamp);\n\n /// @notice Tracks when keeper bonds are ready to be withdrawn\n /// @param _keeper The address of the keeper\n /// @param _bonding The address of the token being unbonded\n /// @return _timestamp Time at which the keeper bonds are ready to be withdrawn\n function canWithdrawAfter(address _keeper, address _bonding) external view returns (uint256 _timestamp);\n\n /// @notice Tracks how much keeper bonds are to be withdrawn\n /// @param _keeper The address of the keeper\n /// @param _bonding The address of the token being unbonded\n /// @return _pendingUnbonds The amount of keeper bonds that are to be withdrawn\n function pendingUnbonds(address _keeper, address _bonding) external view returns (uint256 _pendingUnbonds);\n\n /// @notice Checks whether the address has ever bonded an asset\n /// @param _keeper The address of the keeper\n /// @return _hasBonded Whether the address has ever bonded an asset\n function hasBonded(address _keeper) external view returns (bool _hasBonded);\n\n // Methods\n\n /// @notice Lists all jobs\n /// @return _jobList Array with all the jobs in _jobs\n function jobs() external view returns (address[] memory _jobList);\n\n /// @notice Lists all keepers\n /// @return _keeperList Array with all the keepers in _keepers\n function keepers() external view returns (address[] memory _keeperList);\n\n // Errors\n\n /// @notice Throws when an address is passed as a job, but that address is not a job\n error JobUnavailable();\n\n /// @notice Throws when an action that requires an undisputed job is applied on a disputed job\n error JobDisputed();\n}\n" - }, - "solidity/interfaces/peripherals/IKeep3rRoles.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport './IBaseErrors.sol';\nimport './IGovernable.sol';\nimport './IDustCollector.sol';\n\n/// @title Keep3rRoles contract\n/// @notice Manages the Keep3r specific roles\ninterface IKeep3rRoles is IBaseErrors, IDustCollector, IGovernable {\n // Events\n\n /// @notice Emitted when a slasher is added\n /// @param _slasher Address of the added slasher\n event SlasherAdded(address _slasher);\n\n /// @notice Emitted when a slasher is removed\n /// @param _slasher Address of the removed slasher\n event SlasherRemoved(address _slasher);\n\n /// @notice Emitted when a disputer is added\n /// @param _disputer Address of the added disputer\n event DisputerAdded(address _disputer);\n\n /// @notice Emitted when a disputer is removed\n /// @param _disputer Address of the removed disputer\n event DisputerRemoved(address _disputer);\n\n // Variables\n\n /// @notice Tracks whether the address is a slasher or not\n /// @param _slasher Address being checked as a slasher\n /// @return _isSlasher Whether the address is a slasher or not\n function slashers(address _slasher) external view returns (bool _isSlasher);\n\n /// @notice Tracks whether the address is a disputer or not\n /// @param _disputer Address being checked as a disputer\n /// @return _isDisputer Whether the address is a disputer or not\n function disputers(address _disputer) external view returns (bool _isDisputer);\n\n // Errors\n\n /// @notice Throws if the address is already a registered slasher\n error SlasherExistent();\n\n /// @notice Throws if caller is not a registered slasher\n error SlasherUnexistent();\n\n /// @notice Throws if the address is already a registered disputer\n error DisputerExistent();\n\n /// @notice Throws if caller is not a registered disputer\n error DisputerUnexistent();\n\n /// @notice Throws if the msg.sender is not a slasher or is not a part of governance\n error OnlySlasher();\n\n /// @notice Throws if the msg.sender is not a disputer or is not a part of governance\n error OnlyDisputer();\n\n // Methods\n\n /// @notice Registers a slasher by updating the slashers mapping\n function addSlasher(address _slasher) external;\n\n /// @notice Removes a slasher by updating the slashers mapping\n function removeSlasher(address _slasher) external;\n\n /// @notice Registers a disputer by updating the disputers mapping\n function addDisputer(address _disputer) external;\n\n /// @notice Removes a disputer by updating the disputers mapping\n function removeDisputer(address _disputer) external;\n}\n" - }, - "solidity/interfaces/peripherals/IBaseErrors.sol": { - "content": "// SPDX-License-Identifier: MIT\n\npragma solidity >=0.8.4 <0.9.0;\n\ninterface IBaseErrors {\n /// @notice Throws if a variable is assigned to the zero address\n error ZeroAddress();\n}\n" - }, - "solidity/interfaces/peripherals/IGovernable.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\n/// @title Governable contract\n/// @notice Manages the governance role\ninterface IGovernable {\n // Events\n\n /// @notice Emitted when pendingGovernance accepts to be governance\n /// @param _governance Address of the new governance\n event GovernanceSet(address _governance);\n\n /// @notice Emitted when a new governance is proposed\n /// @param _pendingGovernance Address that is proposed to be the new governance\n event GovernanceProposal(address _pendingGovernance);\n\n // Errors\n\n /// @notice Throws if the caller of the function is not governance\n error OnlyGovernance();\n\n /// @notice Throws if the caller of the function is not pendingGovernance\n error OnlyPendingGovernance();\n\n /// @notice Throws if trying to set governance to zero address\n error NoGovernanceZeroAddress();\n\n // Variables\n\n /// @notice Stores the governance address\n /// @return _governance The governance addresss\n function governance() external view returns (address _governance);\n\n /// @notice Stores the pendingGovernance address\n /// @return _pendingGovernance The pendingGovernance addresss\n function pendingGovernance() external view returns (address _pendingGovernance);\n\n // Methods\n\n /// @notice Proposes a new address to be governance\n /// @param _governance The address being proposed as the new governance\n function setGovernance(address _governance) external;\n\n /// @notice Changes the governance from the current governance to the previously proposed address\n function acceptGovernance() external;\n}\n" - }, - "solidity/interfaces/peripherals/IDustCollector.sol": { - "content": "// SPDX-License-Identifier: MIT\n\npragma solidity >=0.8.4 <0.9.0;\n\nimport './IBaseErrors.sol';\n\ninterface IDustCollector is IBaseErrors {\n /// @notice Emitted when dust is sent\n /// @param _token The token that will be transferred\n /// @param _amount The amount of the token that will be transferred\n /// @param _to The address which will receive the funds\n event DustSent(address _token, uint256 _amount, address _to);\n\n /// @notice Allows an authorized user to transfer the tokens or eth that may have been left in a contract\n /// @param _token The token that will be transferred\n /// @param _amount The amount of the token that will be transferred\n /// @param _to The address that will receive the idle funds\n function sendDust(\n address _token,\n uint256 _amount,\n address _to\n ) external;\n}\n" - }, - "solidity/contracts/peripherals/jobs/Keep3rJobManager.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport './Keep3rJobOwnership.sol';\nimport '../Keep3rAccountance.sol';\nimport '../../../interfaces/peripherals/IKeep3rJobs.sol';\n\nabstract contract Keep3rJobManager is IKeep3rJobManager, Keep3rJobOwnership, Keep3rAccountance {\n using EnumerableSet for EnumerableSet.AddressSet;\n\n /// @inheritdoc IKeep3rJobManager\n function addJob(address _job) external override {\n if (_jobs.contains(_job)) revert JobAlreadyAdded();\n if (hasBonded[_job]) revert AlreadyAKeeper();\n _jobs.add(_job);\n jobOwner[_job] = msg.sender;\n emit JobAddition(_job, msg.sender);\n }\n}\n" - }, - "solidity/contracts/peripherals/jobs/Keep3rJobWorkable.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport './Keep3rJobMigration.sol';\nimport '../../../interfaces/IKeep3rHelper.sol';\nimport '../../../interfaces/peripherals/IKeep3rJobs.sol';\n\nimport '@openzeppelin/contracts/token/ERC20/IERC20.sol';\nimport '@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol';\n\nabstract contract Keep3rJobWorkable is IKeep3rJobWorkable, Keep3rJobMigration {\n using EnumerableSet for EnumerableSet.AddressSet;\n using SafeERC20 for IERC20;\n\n uint256 internal _initialGas;\n\n /// @inheritdoc IKeep3rJobWorkable\n function isKeeper(address _keeper) external override returns (bool _isKeeper) {\n _initialGas = _getGasLeft();\n if (_keepers.contains(_keeper)) {\n emit KeeperValidation(_initialGas);\n return true;\n }\n }\n\n /// @inheritdoc IKeep3rJobWorkable\n function isBondedKeeper(\n address _keeper,\n address _bond,\n uint256 _minBond,\n uint256 _earned,\n uint256 _age\n ) external override returns (bool _isBondedKeeper) {\n _initialGas = _getGasLeft();\n if (\n _keepers.contains(_keeper) &&\n bonds[_keeper][_bond] >= _minBond &&\n workCompleted[_keeper] >= _earned &&\n block.timestamp - firstSeen[_keeper] >= _age\n ) {\n emit KeeperValidation(_initialGas);\n return true;\n }\n }\n\n /// @inheritdoc IKeep3rJobWorkable\n function worked(address _keeper) external virtual override {\n if (_initialGas == 0) revert GasNotInitialized();\n address _job = msg.sender;\n if (disputes[_job]) revert JobDisputed();\n if (!_jobs.contains(_job)) revert JobUnapproved();\n\n if (_updateJobCreditsIfNeeded(_job)) {\n emit LiquidityCreditsReward(_job, rewardedAt[_job], _jobLiquidityCredits[_job], _jobPeriodCredits[_job]);\n }\n\n (uint256 _boost, uint256 _oneEthQuote, uint256 _extraGas) = IKeep3rHelper(keep3rHelper).getPaymentParams(bonds[_keeper][keep3rV1]);\n\n uint256 _gasLeft = _getGasLeft();\n uint256 _payment = _calculatePayment(_gasLeft, _extraGas, _oneEthQuote, _boost);\n\n if (_payment > _jobLiquidityCredits[_job]) {\n _rewardJobCredits(_job);\n emit LiquidityCreditsReward(_job, rewardedAt[_job], _jobLiquidityCredits[_job], _jobPeriodCredits[_job]);\n\n _gasLeft = _getGasLeft();\n _payment = _calculatePayment(_gasLeft, _extraGas, _oneEthQuote, _boost);\n }\n\n _bondedPayment(_job, _keeper, _payment);\n delete _initialGas;\n\n emit KeeperWork(keep3rV1, _job, _keeper, _payment, _gasLeft);\n }\n\n /// @inheritdoc IKeep3rJobWorkable\n function bondedPayment(address _keeper, uint256 _payment) external override {\n address _job = msg.sender;\n\n if (disputes[_job]) revert JobDisputed();\n if (!_jobs.contains(_job)) revert JobUnapproved();\n\n if (_updateJobCreditsIfNeeded(_job)) {\n emit LiquidityCreditsReward(_job, rewardedAt[_job], _jobLiquidityCredits[_job], _jobPeriodCredits[_job]);\n }\n\n if (_payment > _jobLiquidityCredits[_job]) {\n _rewardJobCredits(_job);\n emit LiquidityCreditsReward(_job, rewardedAt[_job], _jobLiquidityCredits[_job], _jobPeriodCredits[_job]);\n }\n\n _bondedPayment(_job, _keeper, _payment);\n emit KeeperWork(keep3rV1, _job, _keeper, _payment, _getGasLeft());\n }\n\n /// @inheritdoc IKeep3rJobWorkable\n function directTokenPayment(\n address _token,\n address _keeper,\n uint256 _amount\n ) external override {\n address _job = msg.sender;\n\n if (disputes[_job]) revert JobDisputed();\n if (disputes[_keeper]) revert Disputed();\n if (!_jobs.contains(_job)) revert JobUnapproved();\n if (jobTokenCredits[_job][_token] < _amount) revert InsufficientFunds();\n jobTokenCredits[_job][_token] -= _amount;\n IERC20(_token).safeTransfer(_keeper, _amount);\n emit KeeperWork(_token, _job, _keeper, _amount, _getGasLeft());\n }\n\n function _bondedPayment(\n address _job,\n address _keeper,\n uint256 _payment\n ) internal {\n if (_payment > _jobLiquidityCredits[_job]) revert InsufficientFunds();\n\n workedAt[_job] = block.timestamp;\n _jobLiquidityCredits[_job] -= _payment;\n bonds[_keeper][keep3rV1] += _payment;\n workCompleted[_keeper] += _payment;\n totalBonds += _payment;\n }\n\n /// @notice Calculate amount to be payed in KP3R, taking into account multiple parameters\n /// @param _gasLeft Amount of gas left after working the job\n /// @param _extraGas Amount of expected unaccounted gas\n /// @param _oneEthQuote Amount of KP3R equivalent to 1 ETH\n /// @param _boost Reward given to the keeper for having bonded KP3R tokens\n /// @return _payment Amount to be payed in KP3R tokens\n function _calculatePayment(\n uint256 _gasLeft,\n uint256 _extraGas,\n uint256 _oneEthQuote,\n uint256 _boost\n ) internal view returns (uint256 _payment) {\n uint256 _accountedGas = _initialGas - _gasLeft + _extraGas;\n _payment = (((_accountedGas * _boost) / _BASE) * _oneEthQuote) / 1 ether;\n }\n\n /// @notice Return the gas left and add 1/64 in order to match real gas left at first level of depth (EIP-150)\n /// @return _gasLeft Amount of gas left recording taking into account EIP-150\n function _getGasLeft() internal view returns (uint256 _gasLeft) {\n _gasLeft = (gasleft() * 64) / 63;\n }\n}\n" - }, - "solidity/contracts/peripherals/jobs/Keep3rJobDisputable.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport './Keep3rJobFundableCredits.sol';\nimport './Keep3rJobFundableLiquidity.sol';\nimport '../Keep3rDisputable.sol';\n\nabstract contract Keep3rJobDisputable is IKeep3rJobDisputable, Keep3rDisputable, Keep3rJobFundableCredits, Keep3rJobFundableLiquidity {\n using EnumerableSet for EnumerableSet.AddressSet;\n using SafeERC20 for IERC20;\n\n /// @inheritdoc IKeep3rJobDisputable\n function slashTokenFromJob(\n address _job,\n address _token,\n uint256 _amount\n ) external override onlySlasher {\n if (!disputes[_job]) revert NotDisputed();\n if (!_jobTokens[_job].contains(_token)) revert JobTokenUnexistent();\n if (jobTokenCredits[_job][_token] < _amount) revert JobTokenInsufficient();\n\n try IERC20(_token).transfer(governance, _amount) {} catch {}\n jobTokenCredits[_job][_token] -= _amount;\n if (jobTokenCredits[_job][_token] == 0) {\n _jobTokens[_job].remove(_token);\n }\n\n emit JobSlashToken(_job, _token, msg.sender, _amount);\n }\n\n /// @inheritdoc IKeep3rJobDisputable\n function slashLiquidityFromJob(\n address _job,\n address _liquidity,\n uint256 _amount\n ) external override onlySlasher {\n if (!disputes[_job]) revert NotDisputed();\n\n _unbondLiquidityFromJob(_job, _liquidity, _amount);\n try IERC20(_liquidity).transfer(governance, _amount) {} catch {}\n emit JobSlashLiquidity(_job, _liquidity, msg.sender, _amount);\n }\n}\n" - }, - "solidity/contracts/peripherals/jobs/Keep3rJobOwnership.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../../../interfaces/peripherals/IKeep3rJobs.sol';\n\nabstract contract Keep3rJobOwnership is IKeep3rJobOwnership {\n /// @inheritdoc IKeep3rJobOwnership\n mapping(address => address) public override jobOwner;\n\n /// @inheritdoc IKeep3rJobOwnership\n mapping(address => address) public override jobPendingOwner;\n\n /// @inheritdoc IKeep3rJobOwnership\n function changeJobOwnership(address _job, address _newOwner) external override onlyJobOwner(_job) {\n jobPendingOwner[_job] = _newOwner;\n emit JobOwnershipChange(_job, jobOwner[_job], _newOwner);\n }\n\n /// @inheritdoc IKeep3rJobOwnership\n function acceptJobOwnership(address _job) external override onlyPendingJobOwner(_job) {\n address _previousOwner = jobOwner[_job];\n\n jobOwner[_job] = jobPendingOwner[_job];\n delete jobPendingOwner[_job];\n\n emit JobOwnershipAssent(msg.sender, _job, _previousOwner);\n }\n\n modifier onlyJobOwner(address _job) {\n if (msg.sender != jobOwner[_job]) revert OnlyJobOwner();\n _;\n }\n\n modifier onlyPendingJobOwner(address _job) {\n if (msg.sender != jobPendingOwner[_job]) revert OnlyPendingJobOwner();\n _;\n }\n}\n" - }, - "solidity/contracts/peripherals/Keep3rAccountance.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '@openzeppelin/contracts/utils/structs/EnumerableSet.sol';\nimport '../../interfaces/peripherals/IKeep3rAccountance.sol';\nimport './Keep3rRoles.sol';\n\nabstract contract Keep3rAccountance is IKeep3rAccountance, Keep3rRoles {\n using EnumerableSet for EnumerableSet.AddressSet;\n\n /// @notice List of all enabled keepers\n EnumerableSet.AddressSet internal _keepers;\n\n /// @inheritdoc IKeep3rAccountance\n uint256 public override totalBonds;\n\n /// @inheritdoc IKeep3rAccountance\n mapping(address => uint256) public override workCompleted;\n\n /// @inheritdoc IKeep3rAccountance\n mapping(address => uint256) public override firstSeen;\n\n /// @inheritdoc IKeep3rAccountance\n mapping(address => bool) public override disputes;\n\n /// @inheritdoc IKeep3rAccountance\n /// @notice Mapping (job => bonding => amount)\n mapping(address => mapping(address => uint256)) public override bonds;\n\n /// @inheritdoc IKeep3rAccountance\n mapping(address => mapping(address => uint256)) public override jobTokenCredits;\n\n /// @notice The current liquidity credits available for a job\n mapping(address => uint256) internal _jobLiquidityCredits;\n\n /// @notice Map the address of a job to its correspondent periodCredits\n mapping(address => uint256) internal _jobPeriodCredits;\n\n /// @notice Enumerable array of Job Tokens for Credits\n mapping(address => EnumerableSet.AddressSet) internal _jobTokens;\n\n /// @notice List of liquidities that a job has (job => liquidities)\n mapping(address => EnumerableSet.AddressSet) internal _jobLiquidities;\n\n /// @notice Liquidity pool to observe\n mapping(address => address) internal _liquidityPool;\n\n /// @notice Tracks if a pool has KP3R as token0\n mapping(address => bool) internal _isKP3RToken0;\n\n /// @inheritdoc IKeep3rAccountance\n mapping(address => mapping(address => uint256)) public override pendingBonds;\n\n /// @inheritdoc IKeep3rAccountance\n mapping(address => mapping(address => uint256)) public override canActivateAfter;\n\n /// @inheritdoc IKeep3rAccountance\n mapping(address => mapping(address => uint256)) public override canWithdrawAfter;\n\n /// @inheritdoc IKeep3rAccountance\n mapping(address => mapping(address => uint256)) public override pendingUnbonds;\n\n /// @inheritdoc IKeep3rAccountance\n mapping(address => bool) public override hasBonded;\n\n /// @notice List of all enabled jobs\n EnumerableSet.AddressSet internal _jobs;\n\n /// @inheritdoc IKeep3rAccountance\n function jobs() external view override returns (address[] memory _list) {\n _list = _jobs.values();\n }\n\n /// @inheritdoc IKeep3rAccountance\n function keepers() external view override returns (address[] memory _list) {\n _list = _keepers.values();\n }\n}\n" - }, - "@openzeppelin/contracts/utils/structs/EnumerableSet.sol": { - "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Library for managing\n * https://en.wikipedia.org/wiki/Set_(abstract_data_type)[sets] of primitive\n * types.\n *\n * Sets have the following properties:\n *\n * - Elements are added, removed, and checked for existence in constant time\n * (O(1)).\n * - Elements are enumerated in O(n). No guarantees are made on the ordering.\n *\n * ```\n * contract Example {\n * // Add the library methods\n * using EnumerableSet for EnumerableSet.AddressSet;\n *\n * // Declare a set state variable\n * EnumerableSet.AddressSet private mySet;\n * }\n * ```\n *\n * As of v3.3.0, sets of type `bytes32` (`Bytes32Set`), `address` (`AddressSet`)\n * and `uint256` (`UintSet`) are supported.\n */\nlibrary EnumerableSet {\n // To implement this library for multiple types with as little code\n // repetition as possible, we write it in terms of a generic Set type with\n // bytes32 values.\n // The Set implementation uses private functions, and user-facing\n // implementations (such as AddressSet) are just wrappers around the\n // underlying Set.\n // This means that we can only create new EnumerableSets for types that fit\n // in bytes32.\n\n struct Set {\n // Storage of set values\n bytes32[] _values;\n // Position of the value in the `values` array, plus 1 because index 0\n // means a value is not in the set.\n mapping(bytes32 => uint256) _indexes;\n }\n\n /**\n * @dev Add a value to a set. O(1).\n *\n * Returns true if the value was added to the set, that is if it was not\n * already present.\n */\n function _add(Set storage set, bytes32 value) private returns (bool) {\n if (!_contains(set, value)) {\n set._values.push(value);\n // The value is stored at length-1, but we add 1 to all indexes\n // and use 0 as a sentinel value\n set._indexes[value] = set._values.length;\n return true;\n } else {\n return false;\n }\n }\n\n /**\n * @dev Removes a value from a set. O(1).\n *\n * Returns true if the value was removed from the set, that is if it was\n * present.\n */\n function _remove(Set storage set, bytes32 value) private returns (bool) {\n // We read and store the value's index to prevent multiple reads from the same storage slot\n uint256 valueIndex = set._indexes[value];\n\n if (valueIndex != 0) {\n // Equivalent to contains(set, value)\n // To delete an element from the _values array in O(1), we swap the element to delete with the last one in\n // the array, and then remove the last element (sometimes called as 'swap and pop').\n // This modifies the order of the array, as noted in {at}.\n\n uint256 toDeleteIndex = valueIndex - 1;\n uint256 lastIndex = set._values.length - 1;\n\n if (lastIndex != toDeleteIndex) {\n bytes32 lastvalue = set._values[lastIndex];\n\n // Move the last value to the index where the value to delete is\n set._values[toDeleteIndex] = lastvalue;\n // Update the index for the moved value\n set._indexes[lastvalue] = valueIndex; // Replace lastvalue's index to valueIndex\n }\n\n // Delete the slot where the moved value was stored\n set._values.pop();\n\n // Delete the index for the deleted slot\n delete set._indexes[value];\n\n return true;\n } else {\n return false;\n }\n }\n\n /**\n * @dev Returns true if the value is in the set. O(1).\n */\n function _contains(Set storage set, bytes32 value) private view returns (bool) {\n return set._indexes[value] != 0;\n }\n\n /**\n * @dev Returns the number of values on the set. O(1).\n */\n function _length(Set storage set) private view returns (uint256) {\n return set._values.length;\n }\n\n /**\n * @dev Returns the value stored at position `index` in the set. O(1).\n *\n * Note that there are no guarantees on the ordering of values inside the\n * array, and it may change when more values are added or removed.\n *\n * Requirements:\n *\n * - `index` must be strictly less than {length}.\n */\n function _at(Set storage set, uint256 index) private view returns (bytes32) {\n return set._values[index];\n }\n\n /**\n * @dev Return the entire set in an array\n *\n * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed\n * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that\n * this function has an unbounded cost, and using it as part of a state-changing function may render the function\n * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.\n */\n function _values(Set storage set) private view returns (bytes32[] memory) {\n return set._values;\n }\n\n // Bytes32Set\n\n struct Bytes32Set {\n Set _inner;\n }\n\n /**\n * @dev Add a value to a set. O(1).\n *\n * Returns true if the value was added to the set, that is if it was not\n * already present.\n */\n function add(Bytes32Set storage set, bytes32 value) internal returns (bool) {\n return _add(set._inner, value);\n }\n\n /**\n * @dev Removes a value from a set. O(1).\n *\n * Returns true if the value was removed from the set, that is if it was\n * present.\n */\n function remove(Bytes32Set storage set, bytes32 value) internal returns (bool) {\n return _remove(set._inner, value);\n }\n\n /**\n * @dev Returns true if the value is in the set. O(1).\n */\n function contains(Bytes32Set storage set, bytes32 value) internal view returns (bool) {\n return _contains(set._inner, value);\n }\n\n /**\n * @dev Returns the number of values in the set. O(1).\n */\n function length(Bytes32Set storage set) internal view returns (uint256) {\n return _length(set._inner);\n }\n\n /**\n * @dev Returns the value stored at position `index` in the set. O(1).\n *\n * Note that there are no guarantees on the ordering of values inside the\n * array, and it may change when more values are added or removed.\n *\n * Requirements:\n *\n * - `index` must be strictly less than {length}.\n */\n function at(Bytes32Set storage set, uint256 index) internal view returns (bytes32) {\n return _at(set._inner, index);\n }\n\n /**\n * @dev Return the entire set in an array\n *\n * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed\n * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that\n * this function has an unbounded cost, and using it as part of a state-changing function may render the function\n * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.\n */\n function values(Bytes32Set storage set) internal view returns (bytes32[] memory) {\n return _values(set._inner);\n }\n\n // AddressSet\n\n struct AddressSet {\n Set _inner;\n }\n\n /**\n * @dev Add a value to a set. O(1).\n *\n * Returns true if the value was added to the set, that is if it was not\n * already present.\n */\n function add(AddressSet storage set, address value) internal returns (bool) {\n return _add(set._inner, bytes32(uint256(uint160(value))));\n }\n\n /**\n * @dev Removes a value from a set. O(1).\n *\n * Returns true if the value was removed from the set, that is if it was\n * present.\n */\n function remove(AddressSet storage set, address value) internal returns (bool) {\n return _remove(set._inner, bytes32(uint256(uint160(value))));\n }\n\n /**\n * @dev Returns true if the value is in the set. O(1).\n */\n function contains(AddressSet storage set, address value) internal view returns (bool) {\n return _contains(set._inner, bytes32(uint256(uint160(value))));\n }\n\n /**\n * @dev Returns the number of values in the set. O(1).\n */\n function length(AddressSet storage set) internal view returns (uint256) {\n return _length(set._inner);\n }\n\n /**\n * @dev Returns the value stored at position `index` in the set. O(1).\n *\n * Note that there are no guarantees on the ordering of values inside the\n * array, and it may change when more values are added or removed.\n *\n * Requirements:\n *\n * - `index` must be strictly less than {length}.\n */\n function at(AddressSet storage set, uint256 index) internal view returns (address) {\n return address(uint160(uint256(_at(set._inner, index))));\n }\n\n /**\n * @dev Return the entire set in an array\n *\n * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed\n * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that\n * this function has an unbounded cost, and using it as part of a state-changing function may render the function\n * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.\n */\n function values(AddressSet storage set) internal view returns (address[] memory) {\n bytes32[] memory store = _values(set._inner);\n address[] memory result;\n\n assembly {\n result := store\n }\n\n return result;\n }\n\n // UintSet\n\n struct UintSet {\n Set _inner;\n }\n\n /**\n * @dev Add a value to a set. O(1).\n *\n * Returns true if the value was added to the set, that is if it was not\n * already present.\n */\n function add(UintSet storage set, uint256 value) internal returns (bool) {\n return _add(set._inner, bytes32(value));\n }\n\n /**\n * @dev Removes a value from a set. O(1).\n *\n * Returns true if the value was removed from the set, that is if it was\n * present.\n */\n function remove(UintSet storage set, uint256 value) internal returns (bool) {\n return _remove(set._inner, bytes32(value));\n }\n\n /**\n * @dev Returns true if the value is in the set. O(1).\n */\n function contains(UintSet storage set, uint256 value) internal view returns (bool) {\n return _contains(set._inner, bytes32(value));\n }\n\n /**\n * @dev Returns the number of values on the set. O(1).\n */\n function length(UintSet storage set) internal view returns (uint256) {\n return _length(set._inner);\n }\n\n /**\n * @dev Returns the value stored at position `index` in the set. O(1).\n *\n * Note that there are no guarantees on the ordering of values inside the\n * array, and it may change when more values are added or removed.\n *\n * Requirements:\n *\n * - `index` must be strictly less than {length}.\n */\n function at(UintSet storage set, uint256 index) internal view returns (uint256) {\n return uint256(_at(set._inner, index));\n }\n\n /**\n * @dev Return the entire set in an array\n *\n * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed\n * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that\n * this function has an unbounded cost, and using it as part of a state-changing function may render the function\n * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.\n */\n function values(UintSet storage set) internal view returns (uint256[] memory) {\n bytes32[] memory store = _values(set._inner);\n uint256[] memory result;\n\n assembly {\n result := store\n }\n\n return result;\n }\n}\n" - }, - "solidity/contracts/peripherals/Keep3rRoles.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../../interfaces/peripherals/IKeep3rRoles.sol';\nimport '@openzeppelin/contracts/utils/structs/EnumerableSet.sol';\nimport './DustCollector.sol';\nimport './Governable.sol';\n\ncontract Keep3rRoles is IKeep3rRoles, Governable, DustCollector {\n /// @inheritdoc IKeep3rRoles\n mapping(address => bool) public override slashers;\n\n /// @inheritdoc IKeep3rRoles\n mapping(address => bool) public override disputers;\n\n constructor(address _governance) Governable(_governance) DustCollector() {}\n\n /// @inheritdoc IKeep3rRoles\n function addSlasher(address _slasher) external override onlyGovernance {\n if (_slasher == address(0)) revert ZeroAddress();\n if (slashers[_slasher]) revert SlasherExistent();\n slashers[_slasher] = true;\n emit SlasherAdded(_slasher);\n }\n\n /// @inheritdoc IKeep3rRoles\n function removeSlasher(address _slasher) external override onlyGovernance {\n if (!slashers[_slasher]) revert SlasherUnexistent();\n delete slashers[_slasher];\n emit SlasherRemoved(_slasher);\n }\n\n /// @inheritdoc IKeep3rRoles\n function addDisputer(address _disputer) external override onlyGovernance {\n if (_disputer == address(0)) revert ZeroAddress();\n if (disputers[_disputer]) revert DisputerExistent();\n disputers[_disputer] = true;\n emit DisputerAdded(_disputer);\n }\n\n /// @inheritdoc IKeep3rRoles\n function removeDisputer(address _disputer) external override onlyGovernance {\n if (!disputers[_disputer]) revert DisputerUnexistent();\n delete disputers[_disputer];\n emit DisputerRemoved(_disputer);\n }\n\n /// @notice Functions with this modifier can only be called by either a slasher or governance\n modifier onlySlasher {\n if (!slashers[msg.sender]) revert OnlySlasher();\n _;\n }\n\n /// @notice Functions with this modifier can only be called by either a disputer or governance\n modifier onlyDisputer {\n if (!disputers[msg.sender]) revert OnlyDisputer();\n _;\n }\n}\n" - }, - "solidity/contracts/peripherals/Governable.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../../interfaces/peripherals/IGovernable.sol';\n\nabstract contract Governable is IGovernable {\n /// @inheritdoc IGovernable\n address public override governance;\n\n /// @inheritdoc IGovernable\n address public override pendingGovernance;\n\n constructor(address _governance) {\n if (_governance == address(0)) revert NoGovernanceZeroAddress();\n governance = _governance;\n }\n\n /// @inheritdoc IGovernable\n function setGovernance(address _governance) external override onlyGovernance {\n pendingGovernance = _governance;\n emit GovernanceProposal(_governance);\n }\n\n /// @inheritdoc IGovernable\n function acceptGovernance() external override onlyPendingGovernance {\n governance = pendingGovernance;\n delete pendingGovernance;\n emit GovernanceSet(governance);\n }\n\n /// @notice Functions with this modifier can only be called by governance\n modifier onlyGovernance {\n if (msg.sender != governance) revert OnlyGovernance();\n _;\n }\n\n /// @notice Functions with this modifier can only be called by pendingGovernance\n modifier onlyPendingGovernance {\n if (msg.sender != pendingGovernance) revert OnlyPendingGovernance();\n _;\n }\n}\n" - }, - "@openzeppelin/contracts/token/ERC20/IERC20.sol": { - "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Interface of the ERC20 standard as defined in the EIP.\n */\ninterface IERC20 {\n /**\n * @dev Returns the amount of tokens in existence.\n */\n function totalSupply() external view returns (uint256);\n\n /**\n * @dev Returns the amount of tokens owned by `account`.\n */\n function balanceOf(address account) external view returns (uint256);\n\n /**\n * @dev Moves `amount` tokens from the caller's account to `recipient`.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * Emits a {Transfer} event.\n */\n function transfer(address recipient, uint256 amount) external returns (bool);\n\n /**\n * @dev Returns the remaining number of tokens that `spender` will be\n * allowed to spend on behalf of `owner` through {transferFrom}. This is\n * zero by default.\n *\n * This value changes when {approve} or {transferFrom} are called.\n */\n function allowance(address owner, address spender) external view returns (uint256);\n\n /**\n * @dev Sets `amount` as the allowance of `spender` over the caller's tokens.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * IMPORTANT: Beware that changing an allowance with this method brings the risk\n * that someone may use both the old and the new allowance by unfortunate\n * transaction ordering. One possible solution to mitigate this race\n * condition is to first reduce the spender's allowance to 0 and set the\n * desired value afterwards:\n * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729\n *\n * Emits an {Approval} event.\n */\n function approve(address spender, uint256 amount) external returns (bool);\n\n /**\n * @dev Moves `amount` tokens from `sender` to `recipient` using the\n * allowance mechanism. `amount` is then deducted from the caller's\n * allowance.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * Emits a {Transfer} event.\n */\n function transferFrom(\n address sender,\n address recipient,\n uint256 amount\n ) external returns (bool);\n\n /**\n * @dev Emitted when `value` tokens are moved from one account (`from`) to\n * another (`to`).\n *\n * Note that `value` may be zero.\n */\n event Transfer(address indexed from, address indexed to, uint256 value);\n\n /**\n * @dev Emitted when the allowance of a `spender` for an `owner` is set by\n * a call to {approve}. `value` is the new allowance.\n */\n event Approval(address indexed owner, address indexed spender, uint256 value);\n}\n" - }, - "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol": { - "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\nimport \"../IERC20.sol\";\nimport \"../../../utils/Address.sol\";\n\n/**\n * @title SafeERC20\n * @dev Wrappers around ERC20 operations that throw on failure (when the token\n * contract returns false). Tokens that return no value (and instead revert or\n * throw on failure) are also supported, non-reverting calls are assumed to be\n * successful.\n * To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract,\n * which allows you to call the safe operations as `token.safeTransfer(...)`, etc.\n */\nlibrary SafeERC20 {\n using Address for address;\n\n function safeTransfer(\n IERC20 token,\n address to,\n uint256 value\n ) internal {\n _callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value));\n }\n\n function safeTransferFrom(\n IERC20 token,\n address from,\n address to,\n uint256 value\n ) internal {\n _callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value));\n }\n\n /**\n * @dev Deprecated. This function has issues similar to the ones found in\n * {IERC20-approve}, and its usage is discouraged.\n *\n * Whenever possible, use {safeIncreaseAllowance} and\n * {safeDecreaseAllowance} instead.\n */\n function safeApprove(\n IERC20 token,\n address spender,\n uint256 value\n ) internal {\n // safeApprove should only be called when setting an initial allowance,\n // or when resetting it to zero. To increase and decrease it, use\n // 'safeIncreaseAllowance' and 'safeDecreaseAllowance'\n require(\n (value == 0) || (token.allowance(address(this), spender) == 0),\n \"SafeERC20: approve from non-zero to non-zero allowance\"\n );\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value));\n }\n\n function safeIncreaseAllowance(\n IERC20 token,\n address spender,\n uint256 value\n ) internal {\n uint256 newAllowance = token.allowance(address(this), spender) + value;\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));\n }\n\n function safeDecreaseAllowance(\n IERC20 token,\n address spender,\n uint256 value\n ) internal {\n unchecked {\n uint256 oldAllowance = token.allowance(address(this), spender);\n require(oldAllowance >= value, \"SafeERC20: decreased allowance below zero\");\n uint256 newAllowance = oldAllowance - value;\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));\n }\n }\n\n /**\n * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement\n * on the return value: the return value is optional (but if data is returned, it must not be false).\n * @param token The token targeted by the call.\n * @param data The call data (encoded using abi.encode or one of its variants).\n */\n function _callOptionalReturn(IERC20 token, bytes memory data) private {\n // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since\n // we're implementing it ourselves. We use {Address.functionCall} to perform this call, which verifies that\n // the target address contains contract code and also asserts for success in the low-level call.\n\n bytes memory returndata = address(token).functionCall(data, \"SafeERC20: low-level call failed\");\n if (returndata.length > 0) {\n // Return data is optional\n require(abi.decode(returndata, (bool)), \"SafeERC20: ERC20 operation did not succeed\");\n }\n }\n}\n" - }, - "@openzeppelin/contracts/utils/Address.sol": { - "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Collection of functions related to the address type\n */\nlibrary Address {\n /**\n * @dev Returns true if `account` is a contract.\n *\n * [IMPORTANT]\n * ====\n * It is unsafe to assume that an address for which this function returns\n * false is an externally-owned account (EOA) and not a contract.\n *\n * Among others, `isContract` will return false for the following\n * types of addresses:\n *\n * - an externally-owned account\n * - a contract in construction\n * - an address where a contract will be created\n * - an address where a contract lived, but was destroyed\n * ====\n */\n function isContract(address account) internal view returns (bool) {\n // This method relies on extcodesize, which returns 0 for contracts in\n // construction, since the code is only stored at the end of the\n // constructor execution.\n\n uint256 size;\n assembly {\n size := extcodesize(account)\n }\n return size > 0;\n }\n\n /**\n * @dev Replacement for Solidity's `transfer`: sends `amount` wei to\n * `recipient`, forwarding all available gas and reverting on errors.\n *\n * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost\n * of certain opcodes, possibly making contracts go over the 2300 gas limit\n * imposed by `transfer`, making them unable to receive funds via\n * `transfer`. {sendValue} removes this limitation.\n *\n * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].\n *\n * IMPORTANT: because control is transferred to `recipient`, care must be\n * taken to not create reentrancy vulnerabilities. Consider using\n * {ReentrancyGuard} or the\n * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].\n */\n function sendValue(address payable recipient, uint256 amount) internal {\n require(address(this).balance >= amount, \"Address: insufficient balance\");\n\n (bool success, ) = recipient.call{value: amount}(\"\");\n require(success, \"Address: unable to send value, recipient may have reverted\");\n }\n\n /**\n * @dev Performs a Solidity function call using a low level `call`. A\n * plain `call` is an unsafe replacement for a function call: use this\n * function instead.\n *\n * If `target` reverts with a revert reason, it is bubbled up by this\n * function (like regular Solidity function calls).\n *\n * Returns the raw returned data. To convert to the expected return value,\n * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\n *\n * Requirements:\n *\n * - `target` must be a contract.\n * - calling `target` with `data` must not revert.\n *\n * _Available since v3.1._\n */\n function functionCall(address target, bytes memory data) internal returns (bytes memory) {\n return functionCall(target, data, \"Address: low-level call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with\n * `errorMessage` as a fallback revert reason when `target` reverts.\n *\n * _Available since v3.1._\n */\n function functionCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal returns (bytes memory) {\n return functionCallWithValue(target, data, 0, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but also transferring `value` wei to `target`.\n *\n * Requirements:\n *\n * - the calling contract must have an ETH balance of at least `value`.\n * - the called Solidity function must be `payable`.\n *\n * _Available since v3.1._\n */\n function functionCallWithValue(\n address target,\n bytes memory data,\n uint256 value\n ) internal returns (bytes memory) {\n return functionCallWithValue(target, data, value, \"Address: low-level call with value failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but\n * with `errorMessage` as a fallback revert reason when `target` reverts.\n *\n * _Available since v3.1._\n */\n function functionCallWithValue(\n address target,\n bytes memory data,\n uint256 value,\n string memory errorMessage\n ) internal returns (bytes memory) {\n require(address(this).balance >= value, \"Address: insufficient balance for call\");\n require(isContract(target), \"Address: call to non-contract\");\n\n (bool success, bytes memory returndata) = target.call{value: value}(data);\n return verifyCallResult(success, returndata, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but performing a static call.\n *\n * _Available since v3.3._\n */\n function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\n return functionStaticCall(target, data, \"Address: low-level static call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\n * but performing a static call.\n *\n * _Available since v3.3._\n */\n function functionStaticCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal view returns (bytes memory) {\n require(isContract(target), \"Address: static call to non-contract\");\n\n (bool success, bytes memory returndata) = target.staticcall(data);\n return verifyCallResult(success, returndata, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but performing a delegate call.\n *\n * _Available since v3.4._\n */\n function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {\n return functionDelegateCall(target, data, \"Address: low-level delegate call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\n * but performing a delegate call.\n *\n * _Available since v3.4._\n */\n function functionDelegateCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal returns (bytes memory) {\n require(isContract(target), \"Address: delegate call to non-contract\");\n\n (bool success, bytes memory returndata) = target.delegatecall(data);\n return verifyCallResult(success, returndata, errorMessage);\n }\n\n /**\n * @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the\n * revert reason using the provided one.\n *\n * _Available since v4.3._\n */\n function verifyCallResult(\n bool success,\n bytes memory returndata,\n string memory errorMessage\n ) internal pure returns (bytes memory) {\n if (success) {\n return returndata;\n } else {\n // Look for revert reason and bubble it up if present\n if (returndata.length > 0) {\n // The easiest way to bubble the revert reason is using memory via assembly\n\n assembly {\n let returndata_size := mload(returndata)\n revert(add(32, returndata), returndata_size)\n }\n } else {\n revert(errorMessage);\n }\n }\n }\n}\n" - }, - "solidity/contracts/peripherals/jobs/Keep3rJobMigration.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../../../interfaces/peripherals/IKeep3rJobs.sol';\nimport './Keep3rJobFundableCredits.sol';\nimport './Keep3rJobFundableLiquidity.sol';\n\nabstract contract Keep3rJobMigration is IKeep3rJobMigration, Keep3rJobFundableCredits, Keep3rJobFundableLiquidity {\n using EnumerableSet for EnumerableSet.AddressSet;\n\n uint256 internal constant _MIGRATION_COOLDOWN = 1 minutes;\n\n /// @inheritdoc IKeep3rJobMigration\n mapping(address => address) public override pendingJobMigrations;\n mapping(address => mapping(address => uint256)) internal _migrationCreatedAt;\n\n /// @inheritdoc IKeep3rJobMigration\n function migrateJob(address _fromJob, address _toJob) external override onlyJobOwner(_fromJob) {\n if (_fromJob == _toJob) revert JobMigrationImpossible();\n\n pendingJobMigrations[_fromJob] = _toJob;\n _migrationCreatedAt[_fromJob][_toJob] = block.timestamp;\n\n emit JobMigrationRequested(_fromJob, _toJob);\n }\n\n /// @inheritdoc IKeep3rJobMigration\n function acceptJobMigration(address _fromJob, address _toJob) external override onlyJobOwner(_toJob) {\n if (disputes[_fromJob] || disputes[_toJob]) revert JobDisputed();\n if (pendingJobMigrations[_fromJob] != _toJob) revert JobMigrationUnavailable();\n if (block.timestamp < _migrationCreatedAt[_fromJob][_toJob] + _MIGRATION_COOLDOWN) revert JobMigrationLocked();\n\n // force job credits update for both jobs\n _settleJobAccountance(_fromJob);\n _settleJobAccountance(_toJob);\n\n // migrate tokens\n while (_jobTokens[_fromJob].length() > 0) {\n address _tokenToMigrate = _jobTokens[_fromJob].at(0);\n jobTokenCredits[_toJob][_tokenToMigrate] += jobTokenCredits[_fromJob][_tokenToMigrate];\n delete jobTokenCredits[_fromJob][_tokenToMigrate];\n _jobTokens[_fromJob].remove(_tokenToMigrate);\n _jobTokens[_toJob].add(_tokenToMigrate);\n }\n\n // migrate liquidities\n while (_jobLiquidities[_fromJob].length() > 0) {\n address _liquidity = _jobLiquidities[_fromJob].at(0);\n\n liquidityAmount[_toJob][_liquidity] += liquidityAmount[_fromJob][_liquidity];\n delete liquidityAmount[_fromJob][_liquidity];\n\n _jobLiquidities[_toJob].add(_liquidity);\n _jobLiquidities[_fromJob].remove(_liquidity);\n }\n\n // migrate job balances\n _jobPeriodCredits[_toJob] += _jobPeriodCredits[_fromJob];\n delete _jobPeriodCredits[_fromJob];\n\n _jobLiquidityCredits[_toJob] += _jobLiquidityCredits[_fromJob];\n delete _jobLiquidityCredits[_fromJob];\n\n // stop _fromJob from being a job\n delete rewardedAt[_fromJob];\n _jobs.remove(_fromJob);\n\n // delete unused data slots\n delete jobOwner[_fromJob];\n delete jobPendingOwner[_fromJob];\n delete _migrationCreatedAt[_fromJob][_toJob];\n delete pendingJobMigrations[_fromJob];\n\n emit JobMigrationSuccessful(_fromJob, _toJob);\n }\n}\n" - }, - "solidity/interfaces/IKeep3rHelper.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport './IKeep3rHelperParameters.sol';\n\n/// @title Keep3rHelper contract\n/// @notice Contains all the helper functions used throughout the different files.\ninterface IKeep3rHelper is IKeep3rHelperParameters {\n // Errors\n\n /// @notice Throws when none of the tokens in the liquidity pair is KP3R\n error LiquidityPairInvalid();\n\n // Methods\n // solhint-enable func-name-mixedcase\n\n /// @notice Calculates the amount of KP3R that corresponds to the ETH passed into the function\n /// @dev This function allows us to calculate how much KP3R we should pay to a keeper for things expressed in ETH, like gas\n /// @param _eth The amount of ETH\n /// @return _amountOut The amount of KP3R\n function quote(uint256 _eth) external view returns (uint256 _amountOut);\n\n /// @notice Returns the amount of KP3R the keeper has bonded\n /// @param _keeper The address of the keeper to check\n /// @return _amountBonded The amount of KP3R the keeper has bonded\n function bonds(address _keeper) external view returns (uint256 _amountBonded);\n\n /// @notice Calculates the reward (in KP3R) that corresponds to a keeper for using gas\n /// @param _keeper The address of the keeper to check\n /// @param _gasUsed The amount of gas used that will be rewarded\n /// @return _kp3r The amount of KP3R that should be awarded to the keeper\n function getRewardAmountFor(address _keeper, uint256 _gasUsed) external view returns (uint256 _kp3r);\n\n /// @notice Calculates the boost in the reward given to a keeper based on the amount of KP3R that keeper has bonded\n /// @dev If the keeper has no bonds, boost should be +10% of gas cost, if keeper has max bonds, +20%\n /// @param _bonds The amount of KP3R tokens bonded by the keeper\n /// @return _rewardBoost The reward boost that corresponds to the keeper\n function getRewardBoostFor(uint256 _bonds) external view returns (uint256 _rewardBoost);\n\n /// @notice Calculates the reward (in KP3R) that corresponds to tx.origin for using gas\n /// @param _gasUsed The amount of gas used that will be rewarded\n /// @return _amount The amount of KP3R that should be awarded to tx.origin\n function getRewardAmount(uint256 _gasUsed) external view returns (uint256 _amount);\n\n /// @notice Given a pool address, returns the underlying tokens of the pair\n /// @param _pool Address of the correspondant pool\n /// @return _token0 Address of the first token of the pair\n /// @return _token1 Address of the second token of the pair\n function getPoolTokens(address _pool) external view returns (address _token0, address _token1);\n\n /// @notice Defines the order of the tokens in the pair for twap calculations\n /// @param _pool Address of the correspondant pool\n /// @return _isKP3RToken0 Boolean indicating the order of the tokens in the pair\n function isKP3RToken0(address _pool) external view returns (bool _isKP3RToken0);\n\n /// @notice Given an array of secondsAgo, returns UniswapV3 pool cumulatives at that moment\n /// @param _pool Address of the pool to observe\n /// @param _secondsAgo Array with time references to observe\n /// @return _tickCumulative1 Cumulative sum of ticks until first time reference\n /// @return _tickCumulative2 Cumulative sum of ticks until second time reference\n /// @return _success Boolean indicating if the observe call was succesfull\n function observe(address _pool, uint32[] memory _secondsAgo)\n external\n view\n returns (\n int56 _tickCumulative1,\n int56 _tickCumulative2,\n bool _success\n );\n\n /// @notice Get multiplier, quote, and extra, in order to calculate keeper payment\n /// @param _bonds Amount of bonded KP3R owned by the keeper\n /// @return _boost Multiplier per gas unit. Takes into account the base fee and the amount of bonded KP3R\n /// @return _oneEthQuote Amount of KP3R tokens equivalent to 1 ETH\n /// @return _extra Amount of extra gas that should be added to the gas spent\n function getPaymentParams(uint256 _bonds)\n external\n view\n returns (\n uint256 _boost,\n uint256 _oneEthQuote,\n uint256 _extra\n );\n\n /// @notice Given a tick and a liquidity amount, calculates the underlying KP3R tokens\n /// @param _liquidityAmount Amount of liquidity to be converted\n /// @param _tickDifference Tick value used to calculate the quote\n /// @param _timeInterval Time value used to calculate the quote\n /// @return _kp3rAmount Amount of KP3R tokens underlying on the given liquidity\n function getKP3RsAtTick(\n uint256 _liquidityAmount,\n int56 _tickDifference,\n uint256 _timeInterval\n ) external pure returns (uint256 _kp3rAmount);\n\n /// @notice Given a tick and a token amount, calculates the output in correspondant token\n /// @param _baseAmount Amount of token to be converted\n /// @param _tickDifference Tick value used to calculate the quote\n /// @param _timeInterval Time value used to calculate the quote\n /// @return _quoteAmount Amount of credits deserved for the baseAmount at the tick value\n function getQuoteAtTick(\n uint128 _baseAmount,\n int56 _tickDifference,\n uint256 _timeInterval\n ) external pure returns (uint256 _quoteAmount);\n}\n" - }, - "solidity/contracts/peripherals/jobs/Keep3rJobFundableCredits.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport './Keep3rJobOwnership.sol';\nimport '../Keep3rAccountance.sol';\nimport '../Keep3rParameters.sol';\nimport '../../../interfaces/peripherals/IKeep3rJobs.sol';\n\nimport '@openzeppelin/contracts/security/ReentrancyGuard.sol';\nimport '@openzeppelin/contracts/token/ERC20/IERC20.sol';\nimport '@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol';\nimport '@openzeppelin/contracts/utils/math/Math.sol';\n\nabstract contract Keep3rJobFundableCredits is IKeep3rJobFundableCredits, ReentrancyGuard, Keep3rJobOwnership, Keep3rParameters {\n using EnumerableSet for EnumerableSet.AddressSet;\n using SafeERC20 for IERC20;\n\n /// @notice Cooldown between withdrawals\n uint256 internal constant _WITHDRAW_TOKENS_COOLDOWN = 1 minutes;\n\n /// @inheritdoc IKeep3rJobFundableCredits\n mapping(address => mapping(address => uint256)) public override jobTokenCreditsAddedAt;\n\n /// @inheritdoc IKeep3rJobFundableCredits\n function addTokenCreditsToJob(\n address _job,\n address _token,\n uint256 _amount\n ) external override nonReentrant {\n if (!_jobs.contains(_job)) revert JobUnavailable();\n // KP3R shouldn't be used for direct token payments\n if (_token == keep3rV1) revert TokenUnallowed();\n uint256 _before = IERC20(_token).balanceOf(address(this));\n IERC20(_token).safeTransferFrom(msg.sender, address(this), _amount);\n uint256 _received = IERC20(_token).balanceOf(address(this)) - _before;\n uint256 _tokenFee = (_received * fee) / _BASE;\n jobTokenCredits[_job][_token] += _received - _tokenFee;\n jobTokenCreditsAddedAt[_job][_token] = block.timestamp;\n IERC20(_token).safeTransfer(governance, _tokenFee);\n _jobTokens[_job].add(_token);\n\n emit TokenCreditAddition(_job, _token, msg.sender, _received);\n }\n\n /// @inheritdoc IKeep3rJobFundableCredits\n function withdrawTokenCreditsFromJob(\n address _job,\n address _token,\n uint256 _amount,\n address _receiver\n ) external override nonReentrant onlyJobOwner(_job) {\n if (block.timestamp <= jobTokenCreditsAddedAt[_job][_token] + _WITHDRAW_TOKENS_COOLDOWN) revert JobTokenCreditsLocked();\n if (jobTokenCredits[_job][_token] < _amount) revert InsufficientJobTokenCredits();\n if (disputes[_job]) revert JobDisputed();\n\n jobTokenCredits[_job][_token] -= _amount;\n IERC20(_token).safeTransfer(_receiver, _amount);\n\n if (jobTokenCredits[_job][_token] == 0) {\n _jobTokens[_job].remove(_token);\n }\n\n emit TokenCreditWithdrawal(_job, _token, _receiver, _amount);\n }\n}\n" - }, - "solidity/contracts/peripherals/jobs/Keep3rJobFundableLiquidity.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport './Keep3rJobOwnership.sol';\nimport '../Keep3rAccountance.sol';\nimport '../Keep3rParameters.sol';\nimport '../../../interfaces/IPairManager.sol';\nimport '../../../interfaces/peripherals/IKeep3rJobs.sol';\n\nimport '../../libraries/FullMath.sol';\n\nimport '@openzeppelin/contracts/security/ReentrancyGuard.sol';\nimport '@openzeppelin/contracts/token/ERC20/IERC20.sol';\nimport '@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol';\nimport '@openzeppelin/contracts/utils/math/Math.sol';\n\nabstract contract Keep3rJobFundableLiquidity is IKeep3rJobFundableLiquidity, ReentrancyGuard, Keep3rJobOwnership, Keep3rParameters {\n using EnumerableSet for EnumerableSet.AddressSet;\n using SafeERC20 for IERC20;\n\n /// @notice List of liquidities that are accepted in the system\n EnumerableSet.AddressSet internal _approvedLiquidities;\n\n /// @inheritdoc IKeep3rJobFundableLiquidity\n mapping(address => mapping(address => uint256)) public override liquidityAmount;\n\n /// @inheritdoc IKeep3rJobFundableLiquidity\n mapping(address => uint256) public override rewardedAt;\n\n /// @inheritdoc IKeep3rJobFundableLiquidity\n mapping(address => uint256) public override workedAt;\n\n /// @notice Tracks an address and returns its TickCache\n mapping(address => TickCache) internal _tick;\n\n // Views\n\n /// @inheritdoc IKeep3rJobFundableLiquidity\n function approvedLiquidities() external view override returns (address[] memory _list) {\n _list = _approvedLiquidities.values();\n }\n\n /// @inheritdoc IKeep3rJobFundableLiquidity\n function jobPeriodCredits(address _job) public view override returns (uint256 _periodCredits) {\n for (uint256 i; i < _jobLiquidities[_job].length(); i++) {\n address _liquidity = _jobLiquidities[_job].at(i);\n if (_approvedLiquidities.contains(_liquidity)) {\n TickCache memory _tickCache = observeLiquidity(_liquidity);\n if (_tickCache.period != 0) {\n int56 _tickDifference = _isKP3RToken0[_liquidity] ? _tickCache.difference : -_tickCache.difference;\n _periodCredits += _getReward(\n IKeep3rHelper(keep3rHelper).getKP3RsAtTick(liquidityAmount[_job][_liquidity], _tickDifference, rewardPeriodTime)\n );\n }\n }\n }\n }\n\n /// @inheritdoc IKeep3rJobFundableLiquidity\n function jobLiquidityCredits(address _job) public view override returns (uint256 _liquidityCredits) {\n uint256 _periodCredits = jobPeriodCredits(_job);\n\n // If the job was rewarded in the past 1 period time\n if ((block.timestamp - rewardedAt[_job]) < rewardPeriodTime) {\n // If the job has period credits, update minted job credits to new twap\n _liquidityCredits = _periodCredits > 0\n ? (_jobLiquidityCredits[_job] * _periodCredits) / _jobPeriodCredits[_job] // If the job has period credits, return remaining job credits updated to new twap\n : _jobLiquidityCredits[_job]; // If not, return remaining credits, forced credits should not be updated\n } else {\n // Else return a full period worth of credits if current credits have expired\n _liquidityCredits = _periodCredits;\n }\n }\n\n /// @inheritdoc IKeep3rJobFundableLiquidity\n function totalJobCredits(address _job) external view override returns (uint256 _credits) {\n uint256 _periodCredits = jobPeriodCredits(_job);\n uint256 _cooldown = block.timestamp;\n\n if ((rewardedAt[_job] > _period(block.timestamp - rewardPeriodTime))) {\n // Will calculate cooldown if it outdated\n if ((block.timestamp - rewardedAt[_job]) >= rewardPeriodTime) {\n // Will calculate cooldown from last reward reference in this period\n _cooldown -= (rewardedAt[_job] + rewardPeriodTime);\n } else {\n // Will calculate cooldown from last reward timestamp\n _cooldown -= rewardedAt[_job];\n }\n } else {\n // Will calculate cooldown from period start if expired\n _cooldown -= _period(block.timestamp);\n }\n _credits = jobLiquidityCredits(_job) + _phase(_cooldown, _periodCredits);\n }\n\n /// @inheritdoc IKeep3rJobFundableLiquidity\n function quoteLiquidity(address _liquidity, uint256 _amount) external view override returns (uint256 _periodCredits) {\n if (_approvedLiquidities.contains(_liquidity)) {\n TickCache memory _tickCache = observeLiquidity(_liquidity);\n if (_tickCache.period != 0) {\n int56 _tickDifference = _isKP3RToken0[_liquidity] ? _tickCache.difference : -_tickCache.difference;\n return _getReward(IKeep3rHelper(keep3rHelper).getKP3RsAtTick(_amount, _tickDifference, rewardPeriodTime));\n }\n }\n }\n\n /// @inheritdoc IKeep3rJobFundableLiquidity\n function observeLiquidity(address _liquidity) public view virtual override returns (TickCache memory _tickCache) {\n if (_tick[_liquidity].period == _period(block.timestamp)) {\n // Will return cached twaps if liquidity is updated\n _tickCache = _tick[_liquidity];\n } else {\n bool success;\n uint256 lastPeriod = _period(block.timestamp - rewardPeriodTime);\n\n if (_tick[_liquidity].period == lastPeriod) {\n // Will only ask for current period accumulator if liquidity is outdated\n uint32[] memory _secondsAgo = new uint32[](1);\n int56 previousTick = _tick[_liquidity].current;\n\n _secondsAgo[0] = uint32(block.timestamp - _period(block.timestamp));\n\n (_tickCache.current, , success) = IKeep3rHelper(keep3rHelper).observe(_liquidityPool[_liquidity], _secondsAgo);\n\n _tickCache.difference = _tickCache.current - previousTick;\n } else if (_tick[_liquidity].period < lastPeriod) {\n // Will ask for 2 accumulators if liquidity is expired\n uint32[] memory _secondsAgo = new uint32[](2);\n\n _secondsAgo[0] = uint32(block.timestamp - _period(block.timestamp));\n _secondsAgo[1] = uint32(block.timestamp - _period(block.timestamp) + rewardPeriodTime);\n\n int56 _tickCumulative2;\n (_tickCache.current, _tickCumulative2, success) = IKeep3rHelper(keep3rHelper).observe(_liquidityPool[_liquidity], _secondsAgo);\n\n _tickCache.difference = _tickCache.current - _tickCumulative2;\n }\n if (success) {\n _tickCache.period = _period(block.timestamp);\n } else {\n delete _tickCache.period;\n }\n }\n }\n\n // Methods\n\n /// @inheritdoc IKeep3rJobFundableLiquidity\n function forceLiquidityCreditsToJob(address _job, uint256 _amount) external override onlyGovernance {\n if (!_jobs.contains(_job)) revert JobUnavailable();\n _settleJobAccountance(_job);\n _jobLiquidityCredits[_job] += _amount;\n emit LiquidityCreditsForced(_job, rewardedAt[_job], _jobLiquidityCredits[_job]);\n }\n\n /// @inheritdoc IKeep3rJobFundableLiquidity\n function approveLiquidity(address _liquidity) external virtual override onlyGovernance {\n if (!_approvedLiquidities.add(_liquidity)) revert LiquidityPairApproved();\n _liquidityPool[_liquidity] = IPairManager(_liquidity).pool();\n _isKP3RToken0[_liquidity] = IKeep3rHelper(keep3rHelper).isKP3RToken0(_liquidityPool[_liquidity]);\n _tick[_liquidity] = observeLiquidity(_liquidity);\n emit LiquidityApproval(_liquidity);\n }\n\n /// @inheritdoc IKeep3rJobFundableLiquidity\n function revokeLiquidity(address _liquidity) external override onlyGovernance {\n if (!_approvedLiquidities.remove(_liquidity)) revert LiquidityPairUnexistent();\n delete _liquidityPool[_liquidity];\n delete _isKP3RToken0[_liquidity];\n delete _tick[_liquidity];\n\n emit LiquidityRevocation(_liquidity);\n }\n\n /// @inheritdoc IKeep3rJobFundableLiquidity\n function addLiquidityToJob(\n address _job,\n address _liquidity,\n uint256 _amount\n ) external override nonReentrant {\n if (!_approvedLiquidities.contains(_liquidity)) revert LiquidityPairUnapproved();\n if (!_jobs.contains(_job)) revert JobUnavailable();\n\n _jobLiquidities[_job].add(_liquidity);\n\n _settleJobAccountance(_job);\n\n if (_quoteLiquidity(liquidityAmount[_job][_liquidity] + _amount, _liquidity) < liquidityMinimum) revert JobLiquidityLessThanMin();\n\n emit LiquidityCreditsReward(_job, rewardedAt[_job], _jobLiquidityCredits[_job], _jobPeriodCredits[_job]);\n\n IERC20(_liquidity).safeTransferFrom(msg.sender, address(this), _amount);\n liquidityAmount[_job][_liquidity] += _amount;\n _jobPeriodCredits[_job] += _getReward(_quoteLiquidity(_amount, _liquidity));\n emit LiquidityAddition(_job, _liquidity, msg.sender, _amount);\n }\n\n /// @inheritdoc IKeep3rJobFundableLiquidity\n function unbondLiquidityFromJob(\n address _job,\n address _liquidity,\n uint256 _amount\n ) external override onlyJobOwner(_job) {\n canWithdrawAfter[_job][_liquidity] = block.timestamp + unbondTime;\n pendingUnbonds[_job][_liquidity] += _amount;\n _unbondLiquidityFromJob(_job, _liquidity, _amount);\n\n uint256 _remainingLiquidity = liquidityAmount[_job][_liquidity];\n if (_remainingLiquidity > 0 && _quoteLiquidity(_remainingLiquidity, _liquidity) < liquidityMinimum) revert JobLiquidityLessThanMin();\n\n emit Unbonding(_job, _liquidity, _amount);\n }\n\n /// @inheritdoc IKeep3rJobFundableLiquidity\n function withdrawLiquidityFromJob(\n address _job,\n address _liquidity,\n address _receiver\n ) external override onlyJobOwner(_job) {\n if (_receiver == address(0)) revert ZeroAddress();\n if (pendingUnbonds[_job][_liquidity] == 0) revert UnbondsUnexistent();\n if (canWithdrawAfter[_job][_liquidity] >= block.timestamp) revert UnbondsLocked();\n if (disputes[_job]) revert Disputed();\n\n uint256 _amount = pendingUnbonds[_job][_liquidity];\n\n delete pendingUnbonds[_job][_liquidity];\n delete canWithdrawAfter[_job][_liquidity];\n\n IERC20(_liquidity).safeTransfer(_receiver, _amount);\n emit LiquidityWithdrawal(_job, _liquidity, _receiver, _amount);\n }\n\n // Internal functions\n\n /// @notice Updates or rewards job liquidity credits depending on time since last job reward\n function _updateJobCreditsIfNeeded(address _job) internal returns (bool _rewarded) {\n if (rewardedAt[_job] < _period(block.timestamp)) {\n // Will exit function if job has been rewarded in current period\n if (rewardedAt[_job] <= _period(block.timestamp - rewardPeriodTime)) {\n // Will reset job to period syncronicity if a full period passed without rewards\n _updateJobPeriod(_job);\n _jobLiquidityCredits[_job] = _jobPeriodCredits[_job];\n rewardedAt[_job] = _period(block.timestamp);\n _rewarded = true;\n } else if ((block.timestamp - rewardedAt[_job]) >= rewardPeriodTime) {\n // Will reset job's syncronicity if last reward was more than epoch ago\n _updateJobPeriod(_job);\n _jobLiquidityCredits[_job] = _jobPeriodCredits[_job];\n rewardedAt[_job] += rewardPeriodTime;\n _rewarded = true;\n } else if (workedAt[_job] < _period(block.timestamp)) {\n // First keeper on period has to update job accountance to current twaps\n uint256 previousPeriodCredits = _jobPeriodCredits[_job];\n _updateJobPeriod(_job);\n _jobLiquidityCredits[_job] = (_jobLiquidityCredits[_job] * _jobPeriodCredits[_job]) / previousPeriodCredits;\n // Updating job accountance does not reward job\n }\n }\n }\n\n /// @notice Only called if _jobLiquidityCredits < payment\n function _rewardJobCredits(address _job) internal {\n /// @notice Only way to += jobLiquidityCredits is when keeper rewarding (cannot pay work)\n /* WARNING: this allows to top up _jobLiquidityCredits to a max of 1.99 but have to spend at least 1 */\n _jobLiquidityCredits[_job] += _phase(block.timestamp - rewardedAt[_job], _jobPeriodCredits[_job]);\n rewardedAt[_job] = block.timestamp;\n }\n\n /// @notice Updates accountance for _jobPeriodCredits\n function _updateJobPeriod(address _job) internal {\n _jobPeriodCredits[_job] = _calculateJobPeriodCredits(_job);\n }\n\n /// @notice Quotes the outdated job liquidities and calculates _periodCredits\n /// @dev This function is also responsible for keeping the KP3R/WETH quote updated\n function _calculateJobPeriodCredits(address _job) internal returns (uint256 _periodCredits) {\n for (uint256 i; i < _jobLiquidities[_job].length(); i++) {\n address _liquidity = _jobLiquidities[_job].at(i);\n if (_approvedLiquidities.contains(_liquidity)) {\n if (_tick[_liquidity].period != _period(block.timestamp)) {\n // Updates liquidity cache only if needed\n _tick[_liquidity] = observeLiquidity(_liquidity);\n }\n _periodCredits += _getReward(_quoteLiquidity(liquidityAmount[_job][_liquidity], _liquidity));\n }\n }\n }\n\n /// @notice Updates job accountance calculating the impact of the unbonded liquidity amount\n function _unbondLiquidityFromJob(\n address _job,\n address _liquidity,\n uint256 _amount\n ) internal nonReentrant {\n if (!_jobLiquidities[_job].contains(_liquidity)) revert JobLiquidityUnexistent();\n if (liquidityAmount[_job][_liquidity] < _amount) revert JobLiquidityInsufficient();\n\n // Ensures current twaps in job liquidities\n _updateJobPeriod(_job);\n uint256 _periodCreditsToRemove = _getReward(_quoteLiquidity(_amount, _liquidity));\n\n // A liquidity can be revoked causing a job to have 0 periodCredits\n if (_jobPeriodCredits[_job] > 0) {\n // Removes a % correspondant to a full rewardPeriodTime for the liquidity withdrawn vs all of the liquidities\n _jobLiquidityCredits[_job] -= (_jobLiquidityCredits[_job] * _periodCreditsToRemove) / _jobPeriodCredits[_job];\n _jobPeriodCredits[_job] -= _periodCreditsToRemove;\n }\n\n liquidityAmount[_job][_liquidity] -= _amount;\n if (liquidityAmount[_job][_liquidity] == 0) {\n _jobLiquidities[_job].remove(_liquidity);\n }\n }\n\n /// @notice Returns a fraction of the multiplier or the whole multiplier if equal or more than a rewardPeriodTime has passed\n function _phase(uint256 _timePassed, uint256 _multiplier) internal view returns (uint256 _result) {\n if (_timePassed < rewardPeriodTime) {\n _result = (_timePassed * _multiplier) / rewardPeriodTime;\n } else _result = _multiplier;\n }\n\n /// @notice Returns the start of the period of the provided timestamp\n function _period(uint256 _timestamp) internal view returns (uint256 _periodTimestamp) {\n return _timestamp - (_timestamp % rewardPeriodTime);\n }\n\n /// @notice Calculates relation between rewardPeriod and inflationPeriod\n function _getReward(uint256 _baseAmount) internal view returns (uint256 _credits) {\n return FullMath.mulDiv(_baseAmount, rewardPeriodTime, inflationPeriod);\n }\n\n /// @notice Returns underlying KP3R amount for a given liquidity amount\n function _quoteLiquidity(uint256 _amount, address _liquidity) internal view returns (uint256 _quote) {\n if (_tick[_liquidity].period != 0) {\n int56 _tickDifference = _isKP3RToken0[_liquidity] ? _tick[_liquidity].difference : -_tick[_liquidity].difference;\n _quote = IKeep3rHelper(keep3rHelper).getKP3RsAtTick(_amount, _tickDifference, rewardPeriodTime);\n }\n }\n\n /// @notice Updates job credits to current quotes and rewards job's pending minted credits\n /// @dev Ensures a maximum of 1 period of credits\n function _settleJobAccountance(address _job) internal virtual {\n _updateJobCreditsIfNeeded(_job);\n _rewardJobCredits(_job);\n _jobLiquidityCredits[_job] = Math.min(_jobLiquidityCredits[_job], _jobPeriodCredits[_job]);\n }\n}\n" - }, - "solidity/contracts/peripherals/Keep3rParameters.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../../interfaces/IKeep3rHelper.sol';\nimport '../../interfaces/peripherals/IKeep3rParameters.sol';\nimport '../../interfaces/external/IKeep3rV1Proxy.sol';\nimport './Keep3rAccountance.sol';\n\nabstract contract Keep3rParameters is IKeep3rParameters, Keep3rAccountance {\n /// @inheritdoc IKeep3rParameters\n address public override keep3rV1;\n\n /// @inheritdoc IKeep3rParameters\n address public override keep3rV1Proxy;\n\n /// @inheritdoc IKeep3rParameters\n address public override keep3rHelper;\n\n /// @inheritdoc IKeep3rParameters\n uint256 public override bondTime = 3 days;\n\n /// @inheritdoc IKeep3rParameters\n uint256 public override unbondTime = 14 days;\n\n /// @inheritdoc IKeep3rParameters\n uint256 public override liquidityMinimum = 3 ether;\n\n /// @inheritdoc IKeep3rParameters\n uint256 public override rewardPeriodTime = 5 days;\n\n /// @inheritdoc IKeep3rParameters\n uint256 public override inflationPeriod = 34 days;\n\n /// @inheritdoc IKeep3rParameters\n uint256 public override fee = 30;\n\n /// @notice The base that will be used to calculate the fee\n uint256 internal constant _BASE = 10_000;\n\n /// @notice The minimum reward period\n uint256 internal constant _MIN_REWARD_PERIOD_TIME = 1 days;\n\n constructor(\n address _keep3rHelper,\n address _keep3rV1,\n address _keep3rV1Proxy\n ) {\n keep3rHelper = _keep3rHelper;\n keep3rV1 = _keep3rV1;\n keep3rV1Proxy = _keep3rV1Proxy;\n }\n\n /// @inheritdoc IKeep3rParameters\n function setKeep3rHelper(address _keep3rHelper) external override onlyGovernance {\n if (_keep3rHelper == address(0)) revert ZeroAddress();\n keep3rHelper = _keep3rHelper;\n emit Keep3rHelperChange(_keep3rHelper);\n }\n\n /// @inheritdoc IKeep3rParameters\n function setKeep3rV1(address _keep3rV1) public virtual override onlyGovernance {\n if (_keep3rV1 == address(0)) revert ZeroAddress();\n _mint(totalBonds);\n\n keep3rV1 = _keep3rV1;\n emit Keep3rV1Change(_keep3rV1);\n }\n\n /// @inheritdoc IKeep3rParameters\n function setKeep3rV1Proxy(address _keep3rV1Proxy) external override onlyGovernance {\n if (_keep3rV1Proxy == address(0)) revert ZeroAddress();\n keep3rV1Proxy = _keep3rV1Proxy;\n emit Keep3rV1ProxyChange(_keep3rV1Proxy);\n }\n\n /// @inheritdoc IKeep3rParameters\n function setBondTime(uint256 _bondTime) external override onlyGovernance {\n bondTime = _bondTime;\n emit BondTimeChange(_bondTime);\n }\n\n /// @inheritdoc IKeep3rParameters\n function setUnbondTime(uint256 _unbondTime) external override onlyGovernance {\n unbondTime = _unbondTime;\n emit UnbondTimeChange(_unbondTime);\n }\n\n /// @inheritdoc IKeep3rParameters\n function setLiquidityMinimum(uint256 _liquidityMinimum) external override onlyGovernance {\n liquidityMinimum = _liquidityMinimum;\n emit LiquidityMinimumChange(_liquidityMinimum);\n }\n\n /// @inheritdoc IKeep3rParameters\n function setRewardPeriodTime(uint256 _rewardPeriodTime) external override onlyGovernance {\n if (_rewardPeriodTime < _MIN_REWARD_PERIOD_TIME) revert MinRewardPeriod();\n rewardPeriodTime = _rewardPeriodTime;\n emit RewardPeriodTimeChange(_rewardPeriodTime);\n }\n\n /// @inheritdoc IKeep3rParameters\n function setInflationPeriod(uint256 _inflationPeriod) external override onlyGovernance {\n inflationPeriod = _inflationPeriod;\n emit InflationPeriodChange(_inflationPeriod);\n }\n\n /// @inheritdoc IKeep3rParameters\n function setFee(uint256 _fee) external override onlyGovernance {\n fee = _fee;\n emit FeeChange(_fee);\n }\n\n function _mint(uint256 _amount) internal {\n totalBonds -= _amount;\n IKeep3rV1Proxy(keep3rV1Proxy).mint(_amount);\n }\n}\n" - }, - "@openzeppelin/contracts/security/ReentrancyGuard.sol": { - "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Contract module that helps prevent reentrant calls to a function.\n *\n * Inheriting from `ReentrancyGuard` will make the {nonReentrant} modifier\n * available, which can be applied to functions to make sure there are no nested\n * (reentrant) calls to them.\n *\n * Note that because there is a single `nonReentrant` guard, functions marked as\n * `nonReentrant` may not call one another. This can be worked around by making\n * those functions `private`, and then adding `external` `nonReentrant` entry\n * points to them.\n *\n * TIP: If you would like to learn more about reentrancy and alternative ways\n * to protect against it, check out our blog post\n * https://blog.openzeppelin.com/reentrancy-after-istanbul/[Reentrancy After Istanbul].\n */\nabstract contract ReentrancyGuard {\n // Booleans are more expensive than uint256 or any type that takes up a full\n // word because each write operation emits an extra SLOAD to first read the\n // slot's contents, replace the bits taken up by the boolean, and then write\n // back. This is the compiler's defense against contract upgrades and\n // pointer aliasing, and it cannot be disabled.\n\n // The values being non-zero value makes deployment a bit more expensive,\n // but in exchange the refund on every call to nonReentrant will be lower in\n // amount. Since refunds are capped to a percentage of the total\n // transaction's gas, it is best to keep them low in cases like this one, to\n // increase the likelihood of the full refund coming into effect.\n uint256 private constant _NOT_ENTERED = 1;\n uint256 private constant _ENTERED = 2;\n\n uint256 private _status;\n\n constructor() {\n _status = _NOT_ENTERED;\n }\n\n /**\n * @dev Prevents a contract from calling itself, directly or indirectly.\n * Calling a `nonReentrant` function from another `nonReentrant`\n * function is not supported. It is possible to prevent this from happening\n * by making the `nonReentrant` function external, and make it call a\n * `private` function that does the actual work.\n */\n modifier nonReentrant() {\n // On the first call to nonReentrant, _notEntered will be true\n require(_status != _ENTERED, \"ReentrancyGuard: reentrant call\");\n\n // Any calls to nonReentrant after this point will fail\n _status = _ENTERED;\n\n _;\n\n // By storing the original value once again, a refund is triggered (see\n // https://eips.ethereum.org/EIPS/eip-2200)\n _status = _NOT_ENTERED;\n }\n}\n" - }, - "@openzeppelin/contracts/utils/math/Math.sol": { - "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Standard math utilities missing in the Solidity language.\n */\nlibrary Math {\n /**\n * @dev Returns the largest of two numbers.\n */\n function max(uint256 a, uint256 b) internal pure returns (uint256) {\n return a >= b ? a : b;\n }\n\n /**\n * @dev Returns the smallest of two numbers.\n */\n function min(uint256 a, uint256 b) internal pure returns (uint256) {\n return a < b ? a : b;\n }\n\n /**\n * @dev Returns the average of two numbers. The result is rounded towards\n * zero.\n */\n function average(uint256 a, uint256 b) internal pure returns (uint256) {\n // (a + b) / 2 can overflow.\n return (a & b) + (a ^ b) / 2;\n }\n\n /**\n * @dev Returns the ceiling of the division of two numbers.\n *\n * This differs from standard division with `/` in that it rounds up instead\n * of rounding down.\n */\n function ceilDiv(uint256 a, uint256 b) internal pure returns (uint256) {\n // (a + b - 1) / b can overflow on addition, so we distribute.\n return a / b + (a % b == 0 ? 0 : 1);\n }\n}\n" - }, - "solidity/interfaces/external/IKeep3rV1Proxy.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../peripherals/IGovernable.sol';\n\ninterface IKeep3rV1Proxy is IGovernable {\n // Structs\n struct Recipient {\n address recipient;\n uint256 caps;\n }\n\n // Variables\n function keep3rV1() external view returns (address);\n\n function minter() external view returns (address);\n\n function next(address) external view returns (uint256);\n\n function caps(address) external view returns (uint256);\n\n function recipients() external view returns (address[] memory);\n\n function recipientsCaps() external view returns (Recipient[] memory);\n\n // Errors\n error Cooldown();\n error NoDrawableAmount();\n error ZeroAddress();\n error OnlyMinter();\n\n // Methods\n function addRecipient(address recipient, uint256 amount) external;\n\n function removeRecipient(address recipient) external;\n\n function draw() external returns (uint256 _amount);\n\n function setKeep3rV1(address _keep3rV1) external;\n\n function setMinter(address _minter) external;\n\n function mint(uint256 _amount) external;\n\n function mint(address _account, uint256 _amount) external;\n\n function setKeep3rV1Governance(address _governance) external;\n\n function acceptKeep3rV1Governance() external;\n\n function dispute(address _keeper) external;\n\n function slash(\n address _bonded,\n address _keeper,\n uint256 _amount\n ) external;\n\n function revoke(address _keeper) external;\n\n function resolve(address _keeper) external;\n\n function addJob(address _job) external;\n\n function removeJob(address _job) external;\n\n function addKPRCredit(address _job, uint256 _amount) external;\n\n function approveLiquidity(address _liquidity) external;\n\n function revokeLiquidity(address _liquidity) external;\n\n function setKeep3rHelper(address _keep3rHelper) external;\n\n function addVotes(address _voter, uint256 _amount) external;\n\n function removeVotes(address _voter, uint256 _amount) external;\n}\n" - }, - "solidity/interfaces/IKeep3rHelperParameters.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\n/// @title Keep3rHelperParameters contract\n/// @notice Contains all the helper functions used throughout the different files.\ninterface IKeep3rHelperParameters {\n // Structs\n\n /// @dev KP3R-WETH Pool address and isKP3RToken0\n /// @dev Created in order to save gas by avoiding calls to pool's token0 method\n struct TokenOraclePool {\n address poolAddress;\n bool isTKNToken0;\n }\n\n // Errors\n\n /// @notice Throws when pool does not have KP3R as token0 nor token1\n error InvalidOraclePool();\n\n // Events\n\n /// @notice Emitted when the kp3r weth pool is changed\n /// @param _address Address of the new kp3r weth pool\n /// @param _isKP3RToken0 True if calling the token0 method of the pool returns the KP3R token address\n event Kp3rWethPoolChange(address _address, bool _isKP3RToken0);\n\n /// @notice Emitted when the minimum boost multiplier is changed\n /// @param _minBoost The minimum boost multiplier\n event MinBoostChange(uint256 _minBoost);\n\n /// @notice Emitted when the maximum boost multiplier is changed\n /// @param _maxBoost The maximum boost multiplier\n event MaxBoostChange(uint256 _maxBoost);\n\n /// @notice Emitted when the target bond amount is changed\n /// @param _targetBond The target bond amount\n event TargetBondChange(uint256 _targetBond);\n\n /// @notice Emitted when the Keep3r V2 address is changed\n /// @param _keep3rV2 The address of Keep3r V2\n event Keep3rV2Change(address _keep3rV2);\n\n /// @notice Emitted when the work extra gas amount is changed\n /// @param _workExtraGas The work extra gas\n event WorkExtraGasChange(uint256 _workExtraGas);\n\n /// @notice Emitted when the quote twap time is changed\n /// @param _quoteTwapTime The twap time for quoting\n event QuoteTwapTimeChange(uint32 _quoteTwapTime);\n\n /// @notice Emitted when minimum rewarded gas fee is changed\n /// @param _minBaseFee The minimum rewarded gas fee\n event MinBaseFeeChange(uint256 _minBaseFee);\n\n /// @notice Emitted when minimum rewarded priority fee is changed\n /// @param _minPriorityFee The minimum expected fee that the keeper should pay\n event MinPriorityFeeChange(uint256 _minPriorityFee);\n\n // Variables\n\n /// @notice Address of KP3R token\n /// @return _kp3r Address of KP3R token\n // solhint-disable func-name-mixedcase\n function KP3R() external view returns (address _kp3r);\n\n /// @notice The boost base used to calculate the boost rewards for the keeper\n /// @return _base The boost base number\n function BOOST_BASE() external view returns (uint256 _base);\n\n /// @notice KP3R-WETH pool that is being used as oracle\n /// @return poolAddress Address of the pool\n /// @return isTKNToken0 True if calling the token0 method of the pool returns the KP3R token address\n function kp3rWethPool() external view returns (address poolAddress, bool isTKNToken0);\n\n /// @notice The minimum multiplier used to calculate the amount of gas paid to the Keeper for the gas used to perform a job\n /// For example: if the quoted gas used is 1000, then the minimum amount to be paid will be 1000 * minBoost / BOOST_BASE\n /// @return _multiplier The minimum boost multiplier\n function minBoost() external view returns (uint256 _multiplier);\n\n /// @notice The maximum multiplier used to calculate the amount of gas paid to the Keeper for the gas used to perform a job\n /// For example: if the quoted gas used is 1000, then the maximum amount to be paid will be 1000 * maxBoost / BOOST_BASE\n /// @return _multiplier The maximum boost multiplier\n function maxBoost() external view returns (uint256 _multiplier);\n\n /// @notice The targeted amount of bonded KP3Rs to max-up reward multiplier\n /// For example: if the amount of KP3R the keeper has bonded is targetBond or more, then the keeper will get\n /// the maximum boost possible in his rewards, if it's less, the reward boost will be proportional\n /// @return _target The amount of KP3R that comforms the targetBond\n function targetBond() external view returns (uint256 _target);\n\n /// @notice The amount of unaccounted gas that is going to be added to keeper payments\n /// @return _workExtraGas The work unaccounted gas amount\n function workExtraGas() external view returns (uint256 _workExtraGas);\n\n /// @notice The twap time for quoting\n /// @return _quoteTwapTime The twap time\n function quoteTwapTime() external view returns (uint32 _quoteTwapTime);\n\n /// @notice The minimum base fee that is used to calculate keeper rewards\n /// @return _minBaseFee The minimum rewarded gas fee\n function minBaseFee() external view returns (uint256 _minBaseFee);\n\n /// @notice The minimum priority fee that is also rewarded for keepers\n /// @return _minPriorityFee The minimum rewarded priority fee\n function minPriorityFee() external view returns (uint256 _minPriorityFee);\n\n /// @notice Address of Keep3r V2\n /// @return _keep3rV2 Address of Keep3r V2\n function keep3rV2() external view returns (address _keep3rV2);\n\n // Methods\n\n /// @notice Sets KP3R-WETH pool\n /// @param _poolAddress The address of the KP3R-WETH pool\n function setKp3rWethPool(address _poolAddress) external;\n\n /// @notice Sets the minimum boost multiplier\n /// @param _minBoost The minimum boost multiplier\n function setMinBoost(uint256 _minBoost) external;\n\n /// @notice Sets the maximum boost multiplier\n /// @param _maxBoost The maximum boost multiplier\n function setMaxBoost(uint256 _maxBoost) external;\n\n /// @notice Sets the target bond amount\n /// @param _targetBond The target bond amount\n function setTargetBond(uint256 _targetBond) external;\n\n /// @notice Sets the Keep3r V2 address\n /// @param _keep3rV2 The address of Keep3r V2\n function setKeep3rV2(address _keep3rV2) external;\n\n /// @notice Sets the work extra gas amount\n /// @param _workExtraGas The work extra gas\n function setWorkExtraGas(uint256 _workExtraGas) external;\n\n /// @notice Sets the quote twap time\n /// @param _quoteTwapTime The twap time for quoting\n function setQuoteTwapTime(uint32 _quoteTwapTime) external;\n\n /// @notice Sets the minimum rewarded gas fee\n /// @param _minBaseFee The minimum rewarded gas fee\n function setMinBaseFee(uint256 _minBaseFee) external;\n\n /// @notice Sets the minimum rewarded gas priority fee\n /// @param _minPriorityFee The minimum rewarded priority fee\n function setMinPriorityFee(uint256 _minPriorityFee) external;\n}\n" - }, - "solidity/interfaces/IPairManager.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol';\n\n/// @title Pair Manager interface\n/// @notice Generic interface for Keep3r liquidity pools (kLP)\ninterface IPairManager is IERC20Metadata {\n /// @notice Address of the factory from which the pair manager was created\n /// @return _factory The address of the PairManager Factory\n function factory() external view returns (address _factory);\n\n /// @notice Address of the pool from which the Keep3r pair manager will interact with\n /// @return _pool The address of the pool\n function pool() external view returns (address _pool);\n\n /// @notice Token0 of the pool\n /// @return _token0 The address of token0\n function token0() external view returns (address _token0);\n\n /// @notice Token1 of the pool\n /// @return _token1 The address of token1\n function token1() external view returns (address _token1);\n}\n" - }, - "solidity/contracts/libraries/FullMath.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\n/// @title Contains 512-bit math functions\n/// @notice Facilitates multiplication and division that can have overflow of an intermediate value without any loss of precision\n/// @dev Handles \"phantom overflow\" i.e., allows multiplication and division where an intermediate value overflows 256 bits\nlibrary FullMath {\n /// @notice Calculates floor(a×b÷denominator) with full precision. Throws if result overflows a uint256 or denominator == 0\n /// @param a The multiplicand\n /// @param b The multiplier\n /// @param denominator The divisor\n /// @return result The 256-bit result\n /// @dev Credit to Remco Bloemen under MIT license https://xn--2-umb.com/21/muldiv\n function mulDiv(\n uint256 a,\n uint256 b,\n uint256 denominator\n ) internal pure returns (uint256 result) {\n unchecked {\n // 512-bit multiply [prod1 prod0] = a * b\n // Compute the product mod 2**256 and mod 2**256 - 1\n // then use the Chinese Remainder Theorem to reconstruct\n // the 512 bit result. The result is stored in two 256\n // variables such that product = prod1 * 2**256 + prod0\n uint256 prod0; // Least significant 256 bits of the product\n uint256 prod1; // Most significant 256 bits of the product\n assembly {\n let mm := mulmod(a, b, not(0))\n prod0 := mul(a, b)\n prod1 := sub(sub(mm, prod0), lt(mm, prod0))\n }\n\n // Handle non-overflow cases, 256 by 256 division\n if (prod1 == 0) {\n require(denominator > 0);\n assembly {\n result := div(prod0, denominator)\n }\n return result;\n }\n\n // Make sure the result is less than 2**256.\n // Also prevents denominator == 0\n require(denominator > prod1);\n\n ///////////////////////////////////////////////\n // 512 by 256 division.\n ///////////////////////////////////////////////\n\n // Make division exact by subtracting the remainder from [prod1 prod0]\n // Compute remainder using mulmod\n uint256 remainder;\n assembly {\n remainder := mulmod(a, b, denominator)\n }\n // Subtract 256 bit number from 512 bit number\n assembly {\n prod1 := sub(prod1, gt(remainder, prod0))\n prod0 := sub(prod0, remainder)\n }\n\n // Factor powers of two out of denominator\n // Compute largest power of two divisor of denominator.\n // Always >= 1.\n uint256 twos = (~denominator + 1) & denominator;\n // Divide denominator by power of two\n assembly {\n denominator := div(denominator, twos)\n }\n\n // Divide [prod1 prod0] by the factors of two\n assembly {\n prod0 := div(prod0, twos)\n }\n // Shift in bits from prod1 into prod0. For this we need\n // to flip `twos` such that it is 2**256 / twos.\n // If twos is zero, then it becomes one\n assembly {\n twos := add(div(sub(0, twos), twos), 1)\n }\n prod0 |= prod1 * twos;\n\n // Invert denominator mod 2**256\n // Now that denominator is an odd number, it has an inverse\n // modulo 2**256 such that denominator * inv = 1 mod 2**256.\n // Compute the inverse by starting with a seed that is correct\n // correct for four bits. That is, denominator * inv = 1 mod 2**4\n uint256 inv = (3 * denominator) ^ 2;\n // Now use Newton-Raphson iteration to improve the precision.\n // Thanks to Hensel's lifting lemma, this also works in modular\n // arithmetic, doubling the correct bits in each step.\n inv *= 2 - denominator * inv; // inverse mod 2**8\n inv *= 2 - denominator * inv; // inverse mod 2**16\n inv *= 2 - denominator * inv; // inverse mod 2**32\n inv *= 2 - denominator * inv; // inverse mod 2**64\n inv *= 2 - denominator * inv; // inverse mod 2**128\n inv *= 2 - denominator * inv; // inverse mod 2**256\n\n // Because the division is now exact we can divide by multiplying\n // with the modular inverse of denominator. This will give us the\n // correct result modulo 2**256. Since the precoditions guarantee\n // that the outcome is less than 2**256, this is the final result.\n // We don't need to compute the high bits of the result and prod1\n // is no longer required.\n result = prod0 * inv;\n return result;\n }\n }\n\n /// @notice Calculates ceil(a×b÷denominator) with full precision. Throws if result overflows a uint256 or denominator == 0\n /// @param a The multiplicand\n /// @param b The multiplier\n /// @param denominator The divisor\n /// @return result The 256-bit result\n function mulDivRoundingUp(\n uint256 a,\n uint256 b,\n uint256 denominator\n ) internal pure returns (uint256 result) {\n unchecked {\n result = mulDiv(a, b, denominator);\n if (mulmod(a, b, denominator) > 0) {\n require(result < type(uint256).max);\n result++;\n }\n }\n }\n}\n" - }, - "@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol": { - "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\nimport \"../IERC20.sol\";\n\n/**\n * @dev Interface for the optional metadata functions from the ERC20 standard.\n *\n * _Available since v4.1._\n */\ninterface IERC20Metadata is IERC20 {\n /**\n * @dev Returns the name of the token.\n */\n function name() external view returns (string memory);\n\n /**\n * @dev Returns the symbol of the token.\n */\n function symbol() external view returns (string memory);\n\n /**\n * @dev Returns the decimals places of the token.\n */\n function decimals() external view returns (uint8);\n}\n" - }, - "solidity/contracts/peripherals/Keep3rDisputable.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport './Keep3rParameters.sol';\nimport '../../interfaces/peripherals/IKeep3rDisputable.sol';\n\nabstract contract Keep3rDisputable is IKeep3rDisputable, Keep3rParameters {\n /// @inheritdoc IKeep3rDisputable\n function dispute(address _jobOrKeeper) external override onlyDisputer {\n if (disputes[_jobOrKeeper]) revert AlreadyDisputed();\n disputes[_jobOrKeeper] = true;\n emit Dispute(_jobOrKeeper, msg.sender);\n }\n\n /// @inheritdoc IKeep3rDisputable\n function resolve(address _jobOrKeeper) external override onlyDisputer {\n if (!disputes[_jobOrKeeper]) revert NotDisputed();\n disputes[_jobOrKeeper] = false;\n emit Resolve(_jobOrKeeper, msg.sender);\n }\n}\n" - }, - "solidity/contracts/peripherals/keepers/Keep3rKeeperDisputable.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport './Keep3rKeeperFundable.sol';\nimport '../Keep3rDisputable.sol';\nimport '../../../interfaces/external/IKeep3rV1.sol';\nimport '../../../interfaces/peripherals/IKeep3rKeepers.sol';\n\nabstract contract Keep3rKeeperDisputable is IKeep3rKeeperDisputable, Keep3rDisputable, Keep3rKeeperFundable {\n using EnumerableSet for EnumerableSet.AddressSet;\n using SafeERC20 for IERC20;\n\n /// @inheritdoc IKeep3rKeeperDisputable\n function slash(\n address _keeper,\n address _bonded,\n uint256 _bondAmount,\n uint256 _unbondAmount\n ) external override onlySlasher {\n if (!disputes[_keeper]) revert NotDisputed();\n _slash(_keeper, _bonded, _bondAmount, _unbondAmount);\n emit KeeperSlash(_keeper, msg.sender, _bondAmount + _unbondAmount);\n }\n\n /// @inheritdoc IKeep3rKeeperDisputable\n function revoke(address _keeper) external override onlySlasher {\n if (!disputes[_keeper]) revert NotDisputed();\n _keepers.remove(_keeper);\n _slash(_keeper, keep3rV1, bonds[_keeper][keep3rV1], pendingUnbonds[_keeper][keep3rV1]);\n emit KeeperRevoke(_keeper, msg.sender);\n }\n\n function _slash(\n address _keeper,\n address _bonded,\n uint256 _bondAmount,\n uint256 _unbondAmount\n ) internal {\n if (_bonded != keep3rV1) {\n try IERC20(_bonded).transfer(governance, _bondAmount + _unbondAmount) returns (bool) {} catch (bytes memory) {}\n }\n bonds[_keeper][_bonded] -= _bondAmount;\n pendingUnbonds[_keeper][_bonded] -= _unbondAmount;\n }\n}\n" - }, - "solidity/contracts/peripherals/keepers/Keep3rKeeperFundable.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../Keep3rAccountance.sol';\nimport '../Keep3rParameters.sol';\nimport '../../../interfaces/peripherals/IKeep3rKeepers.sol';\n\nimport '../../../interfaces/external/IKeep3rV1.sol';\n\nimport '@openzeppelin/contracts/security/ReentrancyGuard.sol';\nimport '@openzeppelin/contracts/token/ERC20/IERC20.sol';\nimport '@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol';\n\nabstract contract Keep3rKeeperFundable is IKeep3rKeeperFundable, ReentrancyGuard, Keep3rParameters {\n using EnumerableSet for EnumerableSet.AddressSet;\n using SafeERC20 for IERC20;\n\n /// @inheritdoc IKeep3rKeeperFundable\n function bond(address _bonding, uint256 _amount) external override nonReentrant {\n if (disputes[msg.sender]) revert Disputed();\n if (_jobs.contains(msg.sender)) revert AlreadyAJob();\n canActivateAfter[msg.sender][_bonding] = block.timestamp + bondTime;\n\n uint256 _before = IERC20(_bonding).balanceOf(address(this));\n IERC20(_bonding).safeTransferFrom(msg.sender, address(this), _amount);\n _amount = IERC20(_bonding).balanceOf(address(this)) - _before;\n\n hasBonded[msg.sender] = true;\n pendingBonds[msg.sender][_bonding] += _amount;\n\n emit Bonding(msg.sender, _bonding, _amount);\n }\n\n /// @inheritdoc IKeep3rKeeperFundable\n function activate(address _bonding) external override {\n address _keeper = msg.sender;\n if (disputes[_keeper]) revert Disputed();\n uint256 _canActivateAfter = canActivateAfter[_keeper][_bonding];\n if (_canActivateAfter == 0) revert BondsUnexistent();\n if (_canActivateAfter >= block.timestamp) revert BondsLocked();\n\n if (firstSeen[_keeper] == 0) {\n firstSeen[_keeper] = block.timestamp;\n }\n _keepers.add(_keeper);\n\n uint256 _amount = pendingBonds[_keeper][_bonding];\n delete pendingBonds[_keeper][_bonding];\n\n // bond provided tokens\n bonds[_keeper][_bonding] += _amount;\n if (_bonding == keep3rV1) {\n totalBonds += _amount;\n _depositBonds(_amount);\n }\n\n emit Activation(_keeper, _bonding, _amount);\n }\n\n /// @inheritdoc IKeep3rKeeperFundable\n function unbond(address _bonding, uint256 _amount) external override {\n canWithdrawAfter[msg.sender][_bonding] = block.timestamp + unbondTime;\n bonds[msg.sender][_bonding] -= _amount;\n pendingUnbonds[msg.sender][_bonding] += _amount;\n\n emit Unbonding(msg.sender, _bonding, _amount);\n }\n\n /// @inheritdoc IKeep3rKeeperFundable\n function withdraw(address _bonding) external override nonReentrant {\n if (pendingUnbonds[msg.sender][_bonding] == 0) revert UnbondsUnexistent();\n if (canWithdrawAfter[msg.sender][_bonding] >= block.timestamp) revert UnbondsLocked();\n if (disputes[msg.sender]) revert Disputed();\n\n uint256 _amount = pendingUnbonds[msg.sender][_bonding];\n\n delete pendingUnbonds[msg.sender][_bonding];\n delete canWithdrawAfter[msg.sender][_bonding];\n\n if (_bonding == keep3rV1) _mint(_amount);\n IERC20(_bonding).safeTransfer(msg.sender, _amount);\n\n emit Withdrawal(msg.sender, _bonding, _amount);\n }\n\n function _depositBonds(uint256 _amount) internal virtual {\n IKeep3rV1(keep3rV1).burn(_amount);\n }\n}\n" - }, - "solidity/interfaces/external/IKeep3rV1.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '@openzeppelin/contracts/token/ERC20/IERC20.sol';\nimport '@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol';\n\n// solhint-disable func-name-mixedcase\ninterface IKeep3rV1 is IERC20, IERC20Metadata {\n // Structs\n struct Checkpoint {\n uint32 fromBlock;\n uint256 votes;\n }\n\n // Events\n event DelegateChanged(address indexed _delegator, address indexed _fromDelegate, address indexed _toDelegate);\n event DelegateVotesChanged(address indexed _delegate, uint256 _previousBalance, uint256 _newBalance);\n event SubmitJob(address indexed _job, address indexed _liquidity, address indexed _provider, uint256 _block, uint256 _credit);\n event ApplyCredit(address indexed _job, address indexed _liquidity, address indexed _provider, uint256 _block, uint256 _credit);\n event RemoveJob(address indexed _job, address indexed _liquidity, address indexed _provider, uint256 _block, uint256 _credit);\n event UnbondJob(address indexed _job, address indexed _liquidity, address indexed _provider, uint256 _block, uint256 _credit);\n event JobAdded(address indexed _job, uint256 _block, address _governance);\n event JobRemoved(address indexed _job, uint256 _block, address _governance);\n event KeeperWorked(address indexed _credit, address indexed _job, address indexed _keeper, uint256 _block, uint256 _amount);\n event KeeperBonding(address indexed _keeper, uint256 _block, uint256 _active, uint256 _bond);\n event KeeperBonded(address indexed _keeper, uint256 _block, uint256 _activated, uint256 _bond);\n event KeeperUnbonding(address indexed _keeper, uint256 _block, uint256 _deactive, uint256 _bond);\n event KeeperUnbound(address indexed _keeper, uint256 _block, uint256 _deactivated, uint256 _bond);\n event KeeperSlashed(address indexed _keeper, address indexed _slasher, uint256 _block, uint256 _slash);\n event KeeperDispute(address indexed _keeper, uint256 _block);\n event KeeperResolved(address indexed _keeper, uint256 _block);\n event TokenCreditAddition(address indexed _credit, address indexed _job, address indexed _creditor, uint256 _block, uint256 _amount);\n\n // Variables\n function KPRH() external returns (address);\n\n function delegates(address _delegator) external view returns (address);\n\n function checkpoints(address _account, uint32 _checkpoint) external view returns (Checkpoint memory);\n\n function numCheckpoints(address _account) external view returns (uint32);\n\n function DOMAIN_TYPEHASH() external returns (bytes32);\n\n function DOMAINSEPARATOR() external returns (bytes32);\n\n function DELEGATION_TYPEHASH() external returns (bytes32);\n\n function PERMIT_TYPEHASH() external returns (bytes32);\n\n function nonces(address _user) external view returns (uint256);\n\n function BOND() external returns (uint256);\n\n function UNBOND() external returns (uint256);\n\n function LIQUIDITYBOND() external returns (uint256);\n\n function FEE() external returns (uint256);\n\n function BASE() external returns (uint256);\n\n function ETH() external returns (address);\n\n function bondings(address _user, address _bonding) external view returns (uint256);\n\n function canWithdrawAfter(address _user, address _bonding) external view returns (uint256);\n\n function pendingUnbonds(address _keeper, address _bonding) external view returns (uint256);\n\n function pendingbonds(address _keeper, address _bonding) external view returns (uint256);\n\n function bonds(address _keeper, address _bonding) external view returns (uint256);\n\n function votes(address _delegator) external view returns (uint256);\n\n function firstSeen(address _keeper) external view returns (uint256);\n\n function disputes(address _keeper) external view returns (bool);\n\n function lastJob(address _keeper) external view returns (uint256);\n\n function workCompleted(address _keeper) external view returns (uint256);\n\n function jobs(address _job) external view returns (bool);\n\n function credits(address _job, address _credit) external view returns (uint256);\n\n function liquidityProvided(\n address _provider,\n address _liquidity,\n address _job\n ) external view returns (uint256);\n\n function liquidityUnbonding(\n address _provider,\n address _liquidity,\n address _job\n ) external view returns (uint256);\n\n function liquidityAmountsUnbonding(\n address _provider,\n address _liquidity,\n address _job\n ) external view returns (uint256);\n\n function jobProposalDelay(address _job) external view returns (uint256);\n\n function liquidityApplied(\n address _provider,\n address _liquidity,\n address _job\n ) external view returns (uint256);\n\n function liquidityAmount(\n address _provider,\n address _liquidity,\n address _job\n ) external view returns (uint256);\n\n function keepers(address _keeper) external view returns (bool);\n\n function blacklist(address _keeper) external view returns (bool);\n\n function keeperList(uint256 _index) external view returns (address);\n\n function jobList(uint256 _index) external view returns (address);\n\n function governance() external returns (address);\n\n function pendingGovernance() external returns (address);\n\n function liquidityAccepted(address _liquidity) external view returns (bool);\n\n function liquidityPairs(uint256 _index) external view returns (address);\n\n // Methods\n function getCurrentVotes(address _account) external view returns (uint256);\n\n function addCreditETH(address _job) external payable;\n\n function addCredit(\n address _credit,\n address _job,\n uint256 _amount\n ) external;\n\n function addVotes(address _voter, uint256 _amount) external;\n\n function removeVotes(address _voter, uint256 _amount) external;\n\n function addKPRCredit(address _job, uint256 _amount) external;\n\n function approveLiquidity(address _liquidity) external;\n\n function revokeLiquidity(address _liquidity) external;\n\n function pairs() external view returns (address[] memory);\n\n function addLiquidityToJob(\n address _liquidity,\n address _job,\n uint256 _amount\n ) external;\n\n function applyCreditToJob(\n address _provider,\n address _liquidity,\n address _job\n ) external;\n\n function unbondLiquidityFromJob(\n address _liquidity,\n address _job,\n uint256 _amount\n ) external;\n\n function removeLiquidityFromJob(address _liquidity, address _job) external;\n\n function mint(uint256 _amount) external;\n\n function burn(uint256 _amount) external;\n\n function worked(address _keeper) external;\n\n function receipt(\n address _credit,\n address _keeper,\n uint256 _amount\n ) external;\n\n function receiptETH(address _keeper, uint256 _amount) external;\n\n function addJob(address _job) external;\n\n function getJobs() external view returns (address[] memory);\n\n function removeJob(address _job) external;\n\n function setKeep3rHelper(address _keep3rHelper) external;\n\n function setGovernance(address _governance) external;\n\n function acceptGovernance() external;\n\n function isKeeper(address _keeper) external returns (bool);\n\n function isMinKeeper(\n address _keeper,\n uint256 _minBond,\n uint256 _earned,\n uint256 _age\n ) external returns (bool);\n\n function isBondedKeeper(\n address _keeper,\n address _bond,\n uint256 _minBond,\n uint256 _earned,\n uint256 _age\n ) external returns (bool);\n\n function bond(address _bonding, uint256 _amount) external;\n\n function getKeepers() external view returns (address[] memory);\n\n function activate(address _bonding) external;\n\n function unbond(address _bonding, uint256 _amount) external;\n\n function slash(\n address _bonded,\n address _keeper,\n uint256 _amount\n ) external;\n\n function withdraw(address _bonding) external;\n\n function dispute(address _keeper) external;\n\n function revoke(address _keeper) external;\n\n function resolve(address _keeper) external;\n\n function permit(\n address _owner,\n address _spender,\n uint256 _amount,\n uint256 _deadline,\n uint8 _v,\n bytes32 _r,\n bytes32 _s\n ) external;\n}\n" - }, - "solidity/for-test/testnet/Keep3rForTestnet.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../../contracts/Keep3r.sol';\n\ncontract Keep3rForTestnet is Keep3r {\n constructor(\n address _governance,\n address _keep3rHelper,\n address _keep3rV1,\n address _keep3rV1Proxy\n ) Keep3r(_governance, _keep3rHelper, _keep3rV1, _keep3rV1Proxy) {\n bondTime = 0; // allows keepers to instantly register\n unbondTime = 0; // allows keepers & jobOwners to instantly withdraw funds\n liquidityMinimum = 1; // allows job providers to add low liquidity\n rewardPeriodTime = 1 days; // reduces twap calculation period\n inflationPeriod = 5 days; // increases credit minting\n }\n}\n" - }, - "solidity/for-test/Keep3rForTest.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../contracts/Keep3r.sol';\n\ncontract Keep3rForTest is Keep3r {\n constructor(\n address _governance,\n address _keep3rHelper,\n address _keep3rV1,\n address _keep3rV1Proxy\n ) Keep3r(_governance, _keep3rHelper, _keep3rV1, _keep3rV1Proxy) {}\n}\n" - }, - "solidity/contracts/sidechain/Keep3rSidechain.sol": { - "content": "// SPDX-License-Identifier: MIT\n\n/*\n\nCoded for The Keep3r Network with ♥ by\n\n██████╗░███████╗███████╗██╗░░░██╗░░░░░░░██╗░█████╗░███╗░░██╗██████╗░███████╗██████╗░██╗░░░░░░█████╗░███╗░░██╗██████╗░\n██╔══██╗██╔════╝██╔════╝██║░░░██║░░██╗░░██║██╔══██╗████╗░██║██╔══██╗██╔════╝██╔══██╗██║░░░░░██╔══██╗████╗░██║██╔══██╗\n██║░░██║█████╗░░█████╗░░██║░░░╚██╗████╗██╔╝██║░░██║██╔██╗██║██║░░██║█████╗░░██████╔╝██║░░░░░███████║██╔██╗██║██║░░██║\n██║░░██║██╔══╝░░██╔══╝░░██║░░░░████╔═████║░██║░░██║██║╚████║██║░░██║██╔══╝░░██╔══██╗██║░░░░░██╔══██║██║╚████║██║░░██║\n██████╔╝███████╗██║░░░░░██║░░░░╚██╔╝░╚██╔╝░╚█████╔╝██║░╚███║██████╔╝███████╗██║░░██║███████╗██║░░██║██║░╚███║██████╔╝\n╚═════╝░╚══════╝╚═╝░░░░░╚═╝░░░░░╚═╝░░░╚═╝░░░╚════╝░╚═╝░░╚══╝╚═════╝░╚══════╝╚═╝░░╚═╝╚══════╝╚═╝░░╚═╝╚═╝░░╚══╝╚═════╝░\n\nhttps://defi.sucks\n\n*/\n\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../Keep3r.sol';\nimport '../../interfaces/sidechain/IKeep3rEscrow.sol';\nimport '../../interfaces/sidechain/IKeep3rHelperSidechain.sol';\nimport '../../interfaces/sidechain/IKeep3rJobWorkableRated.sol';\nimport '../../interfaces/sidechain/IKeep3rSidechainAccountance.sol';\n\ncontract Keep3rSidechain is Keep3r, IKeep3rJobWorkableRated, IKeep3rSidechainAccountance {\n using EnumerableSet for EnumerableSet.AddressSet;\n\n /// @param _governance Address of governance\n /// @param _keep3rHelperSidechain Address of sidechain Keep3rHelper\n /// @param _wrappedKP3R Address of wrapped KP3R implementation\n /// @param _keep3rEscrow Address of sidechain Keep3rEscrow\n constructor(\n address _governance, // governance\n address _keep3rHelperSidechain, // helper\n address _wrappedKP3R, // keep3rV1\n address _keep3rEscrow // keep3rV1Proxy\n ) Keep3r(_governance, _keep3rHelperSidechain, _wrappedKP3R, _keep3rEscrow) {}\n\n // Keep3rSidechainAccountance\n\n /// @inheritdoc IKeep3rSidechainAccountance\n function virtualReserves() external view override returns (int256 _virtualReserves) {\n // Queries wKP3R balanceOf escrow contract minus the totalBonds\n return int256(IERC20(keep3rV1).balanceOf(keep3rV1Proxy)) - int256(totalBonds);\n }\n\n // Keep3rJobFundableLiquidity\n\n /// @notice Sidechain implementation asks the Helper for an oracle, instead of reading it from the ERC-20\n /// @dev Function should be called after setting an oracle in Keep3rHelperSidechain\n /// @param _liquidity Address of the liquidity token being approved\n function approveLiquidity(address _liquidity) external virtual override onlyGovernance {\n if (!_approvedLiquidities.add(_liquidity)) revert LiquidityPairApproved();\n _liquidityPool[_liquidity] = IKeep3rHelperSidechain(keep3rHelper).oracle(_liquidity);\n if (_liquidityPool[_liquidity] == address(0)) revert ZeroAddress();\n _isKP3RToken0[_liquidity] = IKeep3rHelper(keep3rHelper).isKP3RToken0(_liquidityPool[_liquidity]);\n _tick[_liquidity] = observeLiquidity(_liquidity);\n emit LiquidityApproval(_liquidity);\n }\n\n /// @notice Sidechain implementation will always ask for 2 tickCumulatives instead of cacheing\n /// @param _liquidity Address of the liquidity token being observed\n function observeLiquidity(address _liquidity) public view virtual override returns (TickCache memory _tickCache) {\n if (_tick[_liquidity].period == _period(block.timestamp)) {\n // Will return cached twaps if liquidity is updated\n _tickCache = _tick[_liquidity];\n } else {\n bool success;\n\n // Will always ask for 2 accumulators in sidechain\n uint32[] memory _secondsAgo = new uint32[](2);\n\n _secondsAgo[0] = uint32(block.timestamp - _period(block.timestamp));\n _secondsAgo[1] = uint32(block.timestamp - _period(block.timestamp) + rewardPeriodTime);\n\n int56 _tickCumulative2;\n (_tickCache.current, _tickCumulative2, success) = IKeep3rHelper(keep3rHelper).observe(_liquidityPool[_liquidity], _secondsAgo);\n\n _tickCache.difference = _tickCache.current - _tickCumulative2;\n\n if (success) {\n _tickCache.period = _period(block.timestamp);\n } else {\n delete _tickCache.period;\n }\n }\n }\n\n // Keep3rJobsWorkable\n\n /// @dev Sidechain implementation deprecates worked(address) as it should come with a usdPerGasUnit parameter\n function worked(address) external pure override {\n revert Deprecated();\n }\n\n /// @notice Implemented by jobs to show that a keeper performed work\n /// @dev Uses a USD per gas unit payment mechanism\n /// @param _keeper Address of the keeper that performed the work\n /// @param _usdPerGasUnit Units of USD (in wei) per gas unit that should be rewarded to the keeper\n function worked(address _keeper, uint256 _usdPerGasUnit) external override {\n if (_initialGas == 0) revert GasNotInitialized();\n // Gas used for quote calculations & payment is not rewarded\n uint256 _gasLeft = _getGasLeft();\n\n address _job = msg.sender;\n if (disputes[_job]) revert JobDisputed();\n if (!_jobs.contains(_job)) revert JobUnapproved();\n\n if (_updateJobCreditsIfNeeded(_job)) {\n emit LiquidityCreditsReward(_job, rewardedAt[_job], _jobLiquidityCredits[_job], _jobPeriodCredits[_job]);\n }\n\n (uint256 _boost, uint256 _oneUsdQuote, uint256 _extraGas) = IKeep3rHelper(keep3rHelper).getPaymentParams(bonds[_keeper][keep3rV1]);\n\n uint256 _kp3rPayment = _calculatePayment(_gasLeft, _extraGas, _oneUsdQuote * _usdPerGasUnit, _boost);\n\n if (_kp3rPayment > _jobLiquidityCredits[_job]) {\n _rewardJobCredits(_job);\n emit LiquidityCreditsReward(_job, rewardedAt[_job], _jobLiquidityCredits[_job], _jobPeriodCredits[_job]);\n }\n\n _bondedPayment(_job, _keeper, _kp3rPayment);\n delete _initialGas;\n\n emit KeeperWork(keep3rV1, _job, _keeper, _kp3rPayment, _gasLeft);\n }\n\n // Keep3rKeeperFundable\n\n /// @dev Sidechain implementation doesn't burn tokens, but deposit them in Keep3rEscrow\n function _depositBonds(uint256 _amount) internal virtual override {\n IKeep3rV1(keep3rV1).approve(keep3rV1Proxy, _amount);\n IKeep3rEscrow(keep3rV1Proxy).deposit(_amount);\n }\n}\n" - }, - "solidity/interfaces/sidechain/IKeep3rEscrow.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\n// solhint-disable-next-line no-empty-blocks\n\nimport '../peripherals/IMintable.sol';\n\n/// @title Keep3rEscrow contract\n/// @notice This contract acts as an escrow contract for wKP3R tokens on sidechains and L2s\n/// @dev Can be used as a replacement for keep3rV1Proxy in keep3r sidechain implementations\ninterface IKeep3rEscrow is IMintable {\n /// @notice Emitted when Keep3rEscrow#deposit function is called\n /// @param _wKP3R The addess of the wrapped KP3R token\n /// @param _sender The address that called the function\n /// @param _amount The amount of wKP3R the user deposited\n event wKP3RDeposited(address _wKP3R, address _sender, uint256 _amount);\n\n /// @notice Emitted when Keep3rEscrow#mint function is called\n /// @param _wKP3R The addess of the wrapped KP3R token\n /// @param _recipient The address that will received the newly minted wKP3R\n /// @param _amount The amount of wKP3R minted to the recipient\n event wKP3RMinted(address _wKP3R, address _recipient, uint256 _amount);\n\n /// @notice Emitted when Keep3rEscrow#setWKP3R function is called\n /// @param _newWKP3R The address of the wKP3R contract\n event wKP3RSet(address _newWKP3R);\n\n /// @notice Throws when minter attempts to withdraw more wKP3R than the escrow has in its balance\n error InsufficientBalance();\n\n /// @notice Lists the address of the wKP3R contract\n /// @return _wKP3RAddress The address of wKP3R\n function wKP3R() external view returns (address _wKP3RAddress);\n\n /// @notice Deposits wKP3R into the contract\n /// @param _amount The amount of wKP3R to deposit\n function deposit(uint256 _amount) external;\n\n /// @notice mints wKP3R to the recipient\n /// @param _amount The amount of wKP3R to mint\n function mint(uint256 _amount) external;\n\n /// @notice sets the wKP3R address\n /// @param _wKP3R the wKP3R address\n function setWKP3R(address _wKP3R) external;\n}\n" - }, - "solidity/interfaces/sidechain/IKeep3rHelperSidechain.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../IKeep3rHelper.sol';\n\n/// @title Keep3rHelperSidechain contract\n/// @notice Contains all the helper functions for sidechain keep3r implementations\ninterface IKeep3rHelperSidechain is IKeep3rHelper {\n // Events\n\n /// @notice The oracle for a liquidity has been saved\n /// @param _liquidity The address of the given liquidity\n /// @param _oraclePool The address of the oracle pool\n event OracleSet(address _liquidity, address _oraclePool);\n\n /// @notice Emitted when the WETH USD pool is changed\n /// @param _address Address of the new WETH USD pool\n /// @param _isWETHToken0 True if calling the token0 method of the pool returns the WETH token address\n event WethUSDPoolChange(address _address, bool _isWETHToken0);\n\n /// Variables\n\n /// @notice Ethereum mainnet WETH address used for quoting references\n /// @return _weth Address of WETH token\n // solhint-disable func-name-mixedcase\n function WETH() external view returns (address _weth);\n\n /// @return _oracle The address of the observable pool for given liquidity\n function oracle(address _liquidity) external view returns (address _oracle);\n\n /// @notice WETH-USD pool that is being used as oracle\n /// @return poolAddress Address of the pool\n /// @return isTKNToken0 True if calling the token0 method of the pool returns the WETH token address\n function wethUSDPool() external view returns (address poolAddress, bool isTKNToken0);\n\n /// @notice Quotes USD to ETH\n /// @dev Used to know how much ETH should be paid to keepers before converting it from ETH to KP3R\n /// @param _usd The amount of USD to quote to ETH\n /// @return _eth The resulting amount of ETH after quoting the USD\n function quoteUsdToEth(uint256 _usd) external returns (uint256 _eth);\n\n /// Methods\n\n /// @notice Sets an oracle for a given liquidity\n /// @param _liquidity The address of the liquidity\n /// @param _oracle The address of the pool used to quote the liquidity from\n /// @dev The oracle must contain KP3R as either token0 or token1\n function setOracle(address _liquidity, address _oracle) external;\n\n /// @notice Sets an oracle for querying WETH/USD quote\n /// @param _poolAddress The address of the pool used as oracle\n /// @dev The oracle must contain WETH as either token0 or token1\n function setWethUsdPool(address _poolAddress) external;\n}\n" - }, - "solidity/interfaces/sidechain/IKeep3rJobWorkableRated.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../peripherals/IKeep3rJobs.sol';\n\n/// @title Keep3rJobWorkableRated contract\n/// @notice Implements a quoting in USD per gas unit for Keep3r jobs\ninterface IKeep3rJobWorkableRated is IKeep3rJobs {\n /// @notice Throws when job contract calls deprecated worked(address) function\n error Deprecated();\n\n /// @notice Implemented by jobs to show that a keeper performed work and reward in stable USD quote\n /// @dev Automatically calculates the payment for the keeper and pays the keeper with bonded KP3R\n /// @param _keeper Address of the keeper that performed the work\n /// @param _usdPerGasUnit Amount of USD in wei rewarded for gas unit worked by the keeper\n function worked(address _keeper, uint256 _usdPerGasUnit) external;\n}\n" - }, - "solidity/interfaces/sidechain/IKeep3rSidechainAccountance.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\n/// @title IKeep3rSidechainAccountance interface\n/// @notice Implements a view to get the amount of credits that can be withdrawn\ninterface IKeep3rSidechainAccountance {\n /// @notice The surplus amount of wKP3Rs in escrow contract\n /// @return _virtualReserves The surplus amount of wKP3Rs in escrow contract\n function virtualReserves() external view returns (int256 _virtualReserves);\n}\n" - }, - "solidity/interfaces/peripherals/IMintable.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport './IGovernable.sol';\nimport './IBaseErrors.sol';\n\n/// @title Mintable contract\n/// @notice Manages the minter role\ninterface IMintable is IBaseErrors, IGovernable {\n // Events\n\n /// @notice Emitted when governance sets a new minter\n /// @param _minter Address of the new minter\n event MinterSet(address _minter);\n\n // Errors\n\n /// @notice Throws if the caller of the function is not the minter\n error OnlyMinter();\n\n // Variables\n\n /// @notice Stores the minter address\n /// @return _minter The minter addresss\n function minter() external view returns (address _minter);\n\n // Methods\n\n /// @notice Sets a new address to be the minter\n /// @param _minter The address set as the minter\n function setMinter(address _minter) external;\n}\n" - }, - "solidity/for-test/testnet/Keep3rSidechainForTestnet.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../../contracts/sidechain/Keep3rSidechain.sol';\n\ncontract Keep3rSidechainForTestnet is Keep3rSidechain {\n constructor(\n address _governance,\n address _keep3rHelper,\n address _keep3rV1,\n address _keep3rV1Proxy\n ) Keep3rSidechain(_governance, _keep3rHelper, _keep3rV1, _keep3rV1Proxy) {\n bondTime = 0; // allows keepers to instantly register\n unbondTime = 0; // allows keepers & jobOwners to instantly withdraw funds\n liquidityMinimum = 1; // allows job providers to add low liquidity\n rewardPeriodTime = 1 days; // reduces twap calculation period\n inflationPeriod = 5 days; // increases credit minting\n }\n}\n" - }, - "solidity/for-test/Keep3rSidechainForTest.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../contracts/sidechain/Keep3rSidechain.sol';\n\ncontract Keep3rSidechainForTest is Keep3rSidechain {\n using EnumerableSet for EnumerableSet.AddressSet;\n\n constructor(\n address _governance,\n address _keep3rHelper,\n address _wrappedKP3R,\n address _keep3rEscrow\n ) Keep3rSidechain(_governance, _keep3rHelper, _wrappedKP3R, _keep3rEscrow) {}\n\n function setJobLiquidity(address _job, address _liquidity) external {\n _jobLiquidities[_job].add(_liquidity);\n }\n}\n" - }, - "solidity/for-test/JobRatedForTest.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../interfaces/IKeep3r.sol';\nimport '../interfaces/sidechain/IKeep3rJobWorkableRated.sol';\n\ncontract JobRatedForTest {\n error InvalidKeeper();\n address public keep3r;\n uint256 public nonce;\n uint256 public usdPerGasUnit = 1_000e9;\n\n constructor(address _keep3r) {\n keep3r = _keep3r;\n }\n\n function work() external {\n if (!IKeep3r(keep3r).isKeeper(msg.sender)) revert InvalidKeeper();\n\n for (uint256 i = 0; i < 1000; i++) {\n nonce++;\n }\n\n IKeep3rJobWorkableRated(keep3r).worked(msg.sender, usdPerGasUnit);\n }\n\n function workHard(uint256 _factor) external {\n if (!IKeep3r(keep3r).isKeeper(msg.sender)) revert InvalidKeeper();\n\n for (uint256 i = 0; i < 1000 * _factor; i++) {\n nonce++;\n }\n\n IKeep3rJobWorkableRated(keep3r).worked(msg.sender, usdPerGasUnit);\n }\n}\n" - }, - "solidity/for-test/JobForTest.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../interfaces/IKeep3r.sol';\n\ncontract JobForTest {\n error InvalidKeeper();\n address public keep3r;\n uint256 public nonce;\n\n constructor(address _keep3r) {\n keep3r = _keep3r;\n }\n\n function work() external {\n if (!IKeep3r(keep3r).isKeeper(msg.sender)) revert InvalidKeeper();\n\n for (uint256 i; i < 1000; i++) {\n nonce++;\n }\n\n IKeep3r(keep3r).worked(msg.sender);\n }\n\n function workHard(uint256 _factor) external {\n if (!IKeep3r(keep3r).isKeeper(msg.sender)) revert InvalidKeeper();\n\n for (uint256 i; i < 1000 * _factor; i++) {\n nonce++;\n }\n\n IKeep3r(keep3r).worked(msg.sender);\n }\n}\n" - }, - "solidity/for-test/BasicJob.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../interfaces/IKeep3r.sol';\n\ncontract BasicJob {\n error KeeperNotValid();\n\n address public keep3r;\n uint256 public nonce;\n uint256[] public array;\n\n constructor(address _keep3r) {\n keep3r = _keep3r;\n }\n\n function work() external upkeep {}\n\n function workHard(uint256 _howHard) external upkeep {\n for (uint256 i = nonce; i < _howHard; i++) {\n nonce++;\n }\n }\n\n function workRefund(uint256 _howHard) external upkeep {\n for (uint256 i; i < _howHard; i++) {\n array.push(i);\n }\n\n while (array.length > 0) {\n array.pop();\n }\n }\n\n modifier upkeep() {\n if (!IKeep3r(keep3r).isKeeper(msg.sender)) revert KeeperNotValid();\n _;\n IKeep3r(keep3r).worked(msg.sender);\n }\n}\n" - }, - "solidity/contracts/Keep3rHelperParameters.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.7 <0.9.0;\n\nimport './libraries/FullMath.sol';\nimport './libraries/TickMath.sol';\nimport '../interfaces/peripherals/IBaseErrors.sol';\nimport '../interfaces/IKeep3r.sol';\nimport '../interfaces/external/IKeep3rV1.sol';\nimport '../interfaces/IKeep3rHelperParameters.sol';\nimport './peripherals/Governable.sol';\nimport './Keep3rHelperParameters.sol';\n\nimport '@openzeppelin/contracts/utils/math/Math.sol';\nimport '@uniswap/v3-core/contracts/interfaces/IUniswapV3Pool.sol';\n\ncontract Keep3rHelperParameters is IKeep3rHelperParameters, IBaseErrors, Governable {\n /// @inheritdoc IKeep3rHelperParameters\n address public immutable override KP3R;\n\n /// @inheritdoc IKeep3rHelperParameters\n uint256 public constant override BOOST_BASE = 10_000;\n\n /// @inheritdoc IKeep3rHelperParameters\n uint256 public override minBoost = 11_000;\n\n /// @inheritdoc IKeep3rHelperParameters\n uint256 public override maxBoost = 12_000;\n\n /// @inheritdoc IKeep3rHelperParameters\n uint256 public override targetBond = 200 ether;\n\n /// @inheritdoc IKeep3rHelperParameters\n uint256 public override workExtraGas = 34_000;\n\n /// @inheritdoc IKeep3rHelperParameters\n uint32 public override quoteTwapTime = 10 minutes;\n\n /// @inheritdoc IKeep3rHelperParameters\n uint256 public override minBaseFee = 15e9;\n\n /// @inheritdoc IKeep3rHelperParameters\n uint256 public override minPriorityFee = 2e9;\n\n /// @inheritdoc IKeep3rHelperParameters\n address public override keep3rV2;\n\n /// @inheritdoc IKeep3rHelperParameters\n IKeep3rHelperParameters.TokenOraclePool public override kp3rWethPool;\n\n constructor(\n address _kp3r,\n address _keep3rV2,\n address _governance,\n address _kp3rWethPool\n ) Governable(_governance) {\n KP3R = _kp3r;\n keep3rV2 = _keep3rV2;\n\n // Immutable variables [KP3R] cannot be read during contract creation time [_setKp3rWethPool]\n kp3rWethPool = _validateOraclePool(_kp3rWethPool, _kp3r);\n emit Kp3rWethPoolChange(kp3rWethPool.poolAddress, kp3rWethPool.isTKNToken0);\n }\n\n /// @inheritdoc IKeep3rHelperParameters\n function setKp3rWethPool(address _poolAddress) external override onlyGovernance {\n if (_poolAddress == address(0)) revert ZeroAddress();\n _setKp3rWethPool(_poolAddress);\n }\n\n /// @inheritdoc IKeep3rHelperParameters\n function setMinBoost(uint256 _minBoost) external override onlyGovernance {\n minBoost = _minBoost;\n emit MinBoostChange(minBoost);\n }\n\n /// @inheritdoc IKeep3rHelperParameters\n function setMaxBoost(uint256 _maxBoost) external override onlyGovernance {\n maxBoost = _maxBoost;\n emit MaxBoostChange(maxBoost);\n }\n\n /// @inheritdoc IKeep3rHelperParameters\n function setTargetBond(uint256 _targetBond) external override onlyGovernance {\n targetBond = _targetBond;\n emit TargetBondChange(targetBond);\n }\n\n /// @inheritdoc IKeep3rHelperParameters\n function setKeep3rV2(address _keep3rV2) external override onlyGovernance {\n if (_keep3rV2 == address(0)) revert ZeroAddress();\n keep3rV2 = _keep3rV2;\n emit Keep3rV2Change(keep3rV2);\n }\n\n /// @inheritdoc IKeep3rHelperParameters\n function setWorkExtraGas(uint256 _workExtraGas) external override onlyGovernance {\n workExtraGas = _workExtraGas;\n emit WorkExtraGasChange(workExtraGas);\n }\n\n /// @inheritdoc IKeep3rHelperParameters\n function setQuoteTwapTime(uint32 _quoteTwapTime) external override onlyGovernance {\n _setQuoteTwapTime(_quoteTwapTime);\n }\n\n function _setQuoteTwapTime(uint32 _quoteTwapTime) internal {\n quoteTwapTime = _quoteTwapTime;\n emit QuoteTwapTimeChange(quoteTwapTime);\n }\n\n /// @inheritdoc IKeep3rHelperParameters\n function setMinBaseFee(uint256 _minBaseFee) external override onlyGovernance {\n minBaseFee = _minBaseFee;\n emit MinBaseFeeChange(minBaseFee);\n }\n\n /// @inheritdoc IKeep3rHelperParameters\n function setMinPriorityFee(uint256 _minPriorityFee) external override onlyGovernance {\n minPriorityFee = _minPriorityFee;\n emit MinPriorityFeeChange(minPriorityFee);\n }\n\n /// @notice Sets KP3R-WETH pool\n /// @param _poolAddress The address of the KP3R-WETH pool\n function _setKp3rWethPool(address _poolAddress) internal {\n kp3rWethPool = _validateOraclePool(_poolAddress, KP3R);\n emit Kp3rWethPoolChange(kp3rWethPool.poolAddress, kp3rWethPool.isTKNToken0);\n }\n\n function _validateOraclePool(address _poolAddress, address _token) internal view virtual returns (TokenOraclePool memory _oraclePool) {\n bool _isTKNToken0 = IUniswapV3Pool(_poolAddress).token0() == _token;\n\n if (!_isTKNToken0 && IUniswapV3Pool(_poolAddress).token1() != _token) revert InvalidOraclePool();\n\n return TokenOraclePool(_poolAddress, _isTKNToken0);\n }\n}\n" - }, - "solidity/contracts/libraries/TickMath.sol": { - "content": "// SPDX-License-Identifier: GPL-2.0-or-later\npragma solidity >=0.5.0;\n\n// solhint-disable\n\n/// @title Math library for computing sqrt prices from ticks and vice versa\n/// @notice Computes sqrt price for ticks of size 1.0001, i.e. sqrt(1.0001^tick) as fixed point Q64.96 numbers. Supports\n/// prices between 2**-128 and 2**128\nlibrary TickMath {\n /// @dev The minimum tick that may be passed to #getSqrtRatioAtTick computed from log base 1.0001 of 2**-128\n int24 internal constant MIN_TICK = -887272;\n /// @dev The maximum tick that may be passed to #getSqrtRatioAtTick computed from log base 1.0001 of 2**128\n int24 internal constant MAX_TICK = -MIN_TICK;\n\n /// @dev The minimum value that can be returned from #getSqrtRatioAtTick. Equivalent to getSqrtRatioAtTick(MIN_TICK)\n uint160 internal constant MIN_SQRT_RATIO = 4295128739;\n /// @dev The maximum value that can be returned from #getSqrtRatioAtTick. Equivalent to getSqrtRatioAtTick(MAX_TICK)\n uint160 internal constant MAX_SQRT_RATIO = 1461446703485210103287273052203988822378723970342;\n\n /// @notice Calculates sqrt(1.0001^tick) * 2^96\n /// @dev Throws if |tick| > max tick\n /// @param tick The input tick for the above formula\n /// @return sqrtPriceX96 A Fixed point Q64.96 number representing the sqrt of the ratio of the two assets (token1/token0)\n /// at the given tick\n function getSqrtRatioAtTick(int24 tick) internal pure returns (uint160 sqrtPriceX96) {\n uint256 absTick = tick < 0 ? uint256(-int256(tick)) : uint256(int256(tick));\n require(absTick <= uint256(int256(MAX_TICK)), 'T');\n\n uint256 ratio = absTick & 0x1 != 0 ? 0xfffcb933bd6fad37aa2d162d1a594001 : 0x100000000000000000000000000000000;\n if (absTick & 0x2 != 0) ratio = (ratio * 0xfff97272373d413259a46990580e213a) >> 128;\n if (absTick & 0x4 != 0) ratio = (ratio * 0xfff2e50f5f656932ef12357cf3c7fdcc) >> 128;\n if (absTick & 0x8 != 0) ratio = (ratio * 0xffe5caca7e10e4e61c3624eaa0941cd0) >> 128;\n if (absTick & 0x10 != 0) ratio = (ratio * 0xffcb9843d60f6159c9db58835c926644) >> 128;\n if (absTick & 0x20 != 0) ratio = (ratio * 0xff973b41fa98c081472e6896dfb254c0) >> 128;\n if (absTick & 0x40 != 0) ratio = (ratio * 0xff2ea16466c96a3843ec78b326b52861) >> 128;\n if (absTick & 0x80 != 0) ratio = (ratio * 0xfe5dee046a99a2a811c461f1969c3053) >> 128;\n if (absTick & 0x100 != 0) ratio = (ratio * 0xfcbe86c7900a88aedcffc83b479aa3a4) >> 128;\n if (absTick & 0x200 != 0) ratio = (ratio * 0xf987a7253ac413176f2b074cf7815e54) >> 128;\n if (absTick & 0x400 != 0) ratio = (ratio * 0xf3392b0822b70005940c7a398e4b70f3) >> 128;\n if (absTick & 0x800 != 0) ratio = (ratio * 0xe7159475a2c29b7443b29c7fa6e889d9) >> 128;\n if (absTick & 0x1000 != 0) ratio = (ratio * 0xd097f3bdfd2022b8845ad8f792aa5825) >> 128;\n if (absTick & 0x2000 != 0) ratio = (ratio * 0xa9f746462d870fdf8a65dc1f90e061e5) >> 128;\n if (absTick & 0x4000 != 0) ratio = (ratio * 0x70d869a156d2a1b890bb3df62baf32f7) >> 128;\n if (absTick & 0x8000 != 0) ratio = (ratio * 0x31be135f97d08fd981231505542fcfa6) >> 128;\n if (absTick & 0x10000 != 0) ratio = (ratio * 0x9aa508b5b7a84e1c677de54f3e99bc9) >> 128;\n if (absTick & 0x20000 != 0) ratio = (ratio * 0x5d6af8dedb81196699c329225ee604) >> 128;\n if (absTick & 0x40000 != 0) ratio = (ratio * 0x2216e584f5fa1ea926041bedfe98) >> 128;\n if (absTick & 0x80000 != 0) ratio = (ratio * 0x48a170391f7dc42444e8fa2) >> 128;\n\n if (tick > 0) ratio = type(uint256).max / ratio;\n\n // Divides by 1<<32 rounding up to go from a Q128.128 to a Q128.96.\n // we then downcast because we know the result always fits within 160 bits due to our tick input constraint\n // we round up in the division so getTickAtSqrtRatio of the output price is always consistent\n sqrtPriceX96 = uint160((ratio >> 32) + (ratio % (1 << 32) == 0 ? 0 : 1));\n }\n\n /// @notice Calculates the greatest tick value such that getRatioAtTick(tick) <= ratio\n /// @dev Throws in case sqrtPriceX96 < MIN_SQRT_RATIO, as MIN_SQRT_RATIO is the lowest value getRatioAtTick may ever return.\n /// @param sqrtPriceX96 The sqrt ratio for which to compute the tick as a Q64.96\n /// @return tick The greatest tick for which the ratio is less than or equal to the input ratio\n function getTickAtSqrtRatio(uint160 sqrtPriceX96) internal pure returns (int24 tick) {\n // Second inequality must be < because the price can never reach the price at the max tick\n require(sqrtPriceX96 >= MIN_SQRT_RATIO && sqrtPriceX96 < MAX_SQRT_RATIO, 'R');\n uint256 ratio = uint256(sqrtPriceX96) << 32;\n\n uint256 r = ratio;\n uint256 msb = 0;\n\n assembly {\n let f := shl(7, gt(r, 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF))\n msb := or(msb, f)\n r := shr(f, r)\n }\n assembly {\n let f := shl(6, gt(r, 0xFFFFFFFFFFFFFFFF))\n msb := or(msb, f)\n r := shr(f, r)\n }\n assembly {\n let f := shl(5, gt(r, 0xFFFFFFFF))\n msb := or(msb, f)\n r := shr(f, r)\n }\n assembly {\n let f := shl(4, gt(r, 0xFFFF))\n msb := or(msb, f)\n r := shr(f, r)\n }\n assembly {\n let f := shl(3, gt(r, 0xFF))\n msb := or(msb, f)\n r := shr(f, r)\n }\n assembly {\n let f := shl(2, gt(r, 0xF))\n msb := or(msb, f)\n r := shr(f, r)\n }\n assembly {\n let f := shl(1, gt(r, 0x3))\n msb := or(msb, f)\n r := shr(f, r)\n }\n assembly {\n let f := gt(r, 0x1)\n msb := or(msb, f)\n }\n\n if (msb >= 128) r = ratio >> (msb - 127);\n else r = ratio << (127 - msb);\n\n int256 log_2 = (int256(msb) - 128) << 64;\n\n assembly {\n r := shr(127, mul(r, r))\n let f := shr(128, r)\n log_2 := or(log_2, shl(63, f))\n r := shr(f, r)\n }\n assembly {\n r := shr(127, mul(r, r))\n let f := shr(128, r)\n log_2 := or(log_2, shl(62, f))\n r := shr(f, r)\n }\n assembly {\n r := shr(127, mul(r, r))\n let f := shr(128, r)\n log_2 := or(log_2, shl(61, f))\n r := shr(f, r)\n }\n assembly {\n r := shr(127, mul(r, r))\n let f := shr(128, r)\n log_2 := or(log_2, shl(60, f))\n r := shr(f, r)\n }\n assembly {\n r := shr(127, mul(r, r))\n let f := shr(128, r)\n log_2 := or(log_2, shl(59, f))\n r := shr(f, r)\n }\n assembly {\n r := shr(127, mul(r, r))\n let f := shr(128, r)\n log_2 := or(log_2, shl(58, f))\n r := shr(f, r)\n }\n assembly {\n r := shr(127, mul(r, r))\n let f := shr(128, r)\n log_2 := or(log_2, shl(57, f))\n r := shr(f, r)\n }\n assembly {\n r := shr(127, mul(r, r))\n let f := shr(128, r)\n log_2 := or(log_2, shl(56, f))\n r := shr(f, r)\n }\n assembly {\n r := shr(127, mul(r, r))\n let f := shr(128, r)\n log_2 := or(log_2, shl(55, f))\n r := shr(f, r)\n }\n assembly {\n r := shr(127, mul(r, r))\n let f := shr(128, r)\n log_2 := or(log_2, shl(54, f))\n r := shr(f, r)\n }\n assembly {\n r := shr(127, mul(r, r))\n let f := shr(128, r)\n log_2 := or(log_2, shl(53, f))\n r := shr(f, r)\n }\n assembly {\n r := shr(127, mul(r, r))\n let f := shr(128, r)\n log_2 := or(log_2, shl(52, f))\n r := shr(f, r)\n }\n assembly {\n r := shr(127, mul(r, r))\n let f := shr(128, r)\n log_2 := or(log_2, shl(51, f))\n r := shr(f, r)\n }\n assembly {\n r := shr(127, mul(r, r))\n let f := shr(128, r)\n log_2 := or(log_2, shl(50, f))\n }\n\n int256 log_sqrt10001 = log_2 * 255738958999603826347141; // 128.128 number\n\n int24 tickLow = int24((log_sqrt10001 - 3402992956809132418596140100660247210) >> 128);\n int24 tickHi = int24((log_sqrt10001 + 291339464771989622907027621153398088495) >> 128);\n\n tick = tickLow == tickHi ? tickLow : getSqrtRatioAtTick(tickHi) <= sqrtPriceX96 ? tickHi : tickLow;\n }\n}\n" - }, - "@uniswap/v3-core/contracts/interfaces/IUniswapV3Pool.sol": { - "content": "// SPDX-License-Identifier: GPL-2.0-or-later\npragma solidity >=0.5.0;\n\nimport './pool/IUniswapV3PoolImmutables.sol';\nimport './pool/IUniswapV3PoolState.sol';\nimport './pool/IUniswapV3PoolDerivedState.sol';\nimport './pool/IUniswapV3PoolActions.sol';\nimport './pool/IUniswapV3PoolOwnerActions.sol';\nimport './pool/IUniswapV3PoolEvents.sol';\n\n/// @title The interface for a Uniswap V3 Pool\n/// @notice A Uniswap pool facilitates swapping and automated market making between any two assets that strictly conform\n/// to the ERC20 specification\n/// @dev The pool interface is broken up into many smaller pieces\ninterface IUniswapV3Pool is\n IUniswapV3PoolImmutables,\n IUniswapV3PoolState,\n IUniswapV3PoolDerivedState,\n IUniswapV3PoolActions,\n IUniswapV3PoolOwnerActions,\n IUniswapV3PoolEvents\n{\n\n}\n" - }, - "@uniswap/v3-core/contracts/interfaces/pool/IUniswapV3PoolImmutables.sol": { - "content": "// SPDX-License-Identifier: GPL-2.0-or-later\npragma solidity >=0.5.0;\n\n/// @title Pool state that never changes\n/// @notice These parameters are fixed for a pool forever, i.e., the methods will always return the same values\ninterface IUniswapV3PoolImmutables {\n /// @notice The contract that deployed the pool, which must adhere to the IUniswapV3Factory interface\n /// @return The contract address\n function factory() external view returns (address);\n\n /// @notice The first of the two tokens of the pool, sorted by address\n /// @return The token contract address\n function token0() external view returns (address);\n\n /// @notice The second of the two tokens of the pool, sorted by address\n /// @return The token contract address\n function token1() external view returns (address);\n\n /// @notice The pool's fee in hundredths of a bip, i.e. 1e-6\n /// @return The fee\n function fee() external view returns (uint24);\n\n /// @notice The pool tick spacing\n /// @dev Ticks can only be used at multiples of this value, minimum of 1 and always positive\n /// e.g.: a tickSpacing of 3 means ticks can be initialized every 3rd tick, i.e., ..., -6, -3, 0, 3, 6, ...\n /// This value is an int24 to avoid casting even though it is always positive.\n /// @return The tick spacing\n function tickSpacing() external view returns (int24);\n\n /// @notice The maximum amount of position liquidity that can use any tick in the range\n /// @dev This parameter is enforced per tick to prevent liquidity from overflowing a uint128 at any point, and\n /// also prevents out-of-range liquidity from being used to prevent adding in-range liquidity to a pool\n /// @return The max amount of liquidity per tick\n function maxLiquidityPerTick() external view returns (uint128);\n}\n" - }, - "@uniswap/v3-core/contracts/interfaces/pool/IUniswapV3PoolState.sol": { - "content": "// SPDX-License-Identifier: GPL-2.0-or-later\npragma solidity >=0.5.0;\n\n/// @title Pool state that can change\n/// @notice These methods compose the pool's state, and can change with any frequency including multiple times\n/// per transaction\ninterface IUniswapV3PoolState {\n /// @notice The 0th storage slot in the pool stores many values, and is exposed as a single method to save gas\n /// when accessed externally.\n /// @return sqrtPriceX96 The current price of the pool as a sqrt(token1/token0) Q64.96 value\n /// tick The current tick of the pool, i.e. according to the last tick transition that was run.\n /// This value may not always be equal to SqrtTickMath.getTickAtSqrtRatio(sqrtPriceX96) if the price is on a tick\n /// boundary.\n /// observationIndex The index of the last oracle observation that was written,\n /// observationCardinality The current maximum number of observations stored in the pool,\n /// observationCardinalityNext The next maximum number of observations, to be updated when the observation.\n /// feeProtocol The protocol fee for both tokens of the pool.\n /// Encoded as two 4 bit values, where the protocol fee of token1 is shifted 4 bits and the protocol fee of token0\n /// is the lower 4 bits. Used as the denominator of a fraction of the swap fee, e.g. 4 means 1/4th of the swap fee.\n /// unlocked Whether the pool is currently locked to reentrancy\n function slot0()\n external\n view\n returns (\n uint160 sqrtPriceX96,\n int24 tick,\n uint16 observationIndex,\n uint16 observationCardinality,\n uint16 observationCardinalityNext,\n uint8 feeProtocol,\n bool unlocked\n );\n\n /// @notice The fee growth as a Q128.128 fees of token0 collected per unit of liquidity for the entire life of the pool\n /// @dev This value can overflow the uint256\n function feeGrowthGlobal0X128() external view returns (uint256);\n\n /// @notice The fee growth as a Q128.128 fees of token1 collected per unit of liquidity for the entire life of the pool\n /// @dev This value can overflow the uint256\n function feeGrowthGlobal1X128() external view returns (uint256);\n\n /// @notice The amounts of token0 and token1 that are owed to the protocol\n /// @dev Protocol fees will never exceed uint128 max in either token\n function protocolFees() external view returns (uint128 token0, uint128 token1);\n\n /// @notice The currently in range liquidity available to the pool\n /// @dev This value has no relationship to the total liquidity across all ticks\n function liquidity() external view returns (uint128);\n\n /// @notice Look up information about a specific tick in the pool\n /// @param tick The tick to look up\n /// @return liquidityGross the total amount of position liquidity that uses the pool either as tick lower or\n /// tick upper,\n /// liquidityNet how much liquidity changes when the pool price crosses the tick,\n /// feeGrowthOutside0X128 the fee growth on the other side of the tick from the current tick in token0,\n /// feeGrowthOutside1X128 the fee growth on the other side of the tick from the current tick in token1,\n /// tickCumulativeOutside the cumulative tick value on the other side of the tick from the current tick\n /// secondsPerLiquidityOutsideX128 the seconds spent per liquidity on the other side of the tick from the current tick,\n /// secondsOutside the seconds spent on the other side of the tick from the current tick,\n /// initialized Set to true if the tick is initialized, i.e. liquidityGross is greater than 0, otherwise equal to false.\n /// Outside values can only be used if the tick is initialized, i.e. if liquidityGross is greater than 0.\n /// In addition, these values are only relative and must be used only in comparison to previous snapshots for\n /// a specific position.\n function ticks(int24 tick)\n external\n view\n returns (\n uint128 liquidityGross,\n int128 liquidityNet,\n uint256 feeGrowthOutside0X128,\n uint256 feeGrowthOutside1X128,\n int56 tickCumulativeOutside,\n uint160 secondsPerLiquidityOutsideX128,\n uint32 secondsOutside,\n bool initialized\n );\n\n /// @notice Returns 256 packed tick initialized boolean values. See TickBitmap for more information\n function tickBitmap(int16 wordPosition) external view returns (uint256);\n\n /// @notice Returns the information about a position by the position's key\n /// @param key The position's key is a hash of a preimage composed by the owner, tickLower and tickUpper\n /// @return _liquidity The amount of liquidity in the position,\n /// Returns feeGrowthInside0LastX128 fee growth of token0 inside the tick range as of the last mint/burn/poke,\n /// Returns feeGrowthInside1LastX128 fee growth of token1 inside the tick range as of the last mint/burn/poke,\n /// Returns tokensOwed0 the computed amount of token0 owed to the position as of the last mint/burn/poke,\n /// Returns tokensOwed1 the computed amount of token1 owed to the position as of the last mint/burn/poke\n function positions(bytes32 key)\n external\n view\n returns (\n uint128 _liquidity,\n uint256 feeGrowthInside0LastX128,\n uint256 feeGrowthInside1LastX128,\n uint128 tokensOwed0,\n uint128 tokensOwed1\n );\n\n /// @notice Returns data about a specific observation index\n /// @param index The element of the observations array to fetch\n /// @dev You most likely want to use #observe() instead of this method to get an observation as of some amount of time\n /// ago, rather than at a specific index in the array.\n /// @return blockTimestamp The timestamp of the observation,\n /// Returns tickCumulative the tick multiplied by seconds elapsed for the life of the pool as of the observation timestamp,\n /// Returns secondsPerLiquidityCumulativeX128 the seconds per in range liquidity for the life of the pool as of the observation timestamp,\n /// Returns initialized whether the observation has been initialized and the values are safe to use\n function observations(uint256 index)\n external\n view\n returns (\n uint32 blockTimestamp,\n int56 tickCumulative,\n uint160 secondsPerLiquidityCumulativeX128,\n bool initialized\n );\n}\n" - }, - "@uniswap/v3-core/contracts/interfaces/pool/IUniswapV3PoolDerivedState.sol": { - "content": "// SPDX-License-Identifier: GPL-2.0-or-later\npragma solidity >=0.5.0;\n\n/// @title Pool state that is not stored\n/// @notice Contains view functions to provide information about the pool that is computed rather than stored on the\n/// blockchain. The functions here may have variable gas costs.\ninterface IUniswapV3PoolDerivedState {\n /// @notice Returns the cumulative tick and liquidity as of each timestamp `secondsAgo` from the current block timestamp\n /// @dev To get a time weighted average tick or liquidity-in-range, you must call this with two values, one representing\n /// the beginning of the period and another for the end of the period. E.g., to get the last hour time-weighted average tick,\n /// you must call it with secondsAgos = [3600, 0].\n /// @dev The time weighted average tick represents the geometric time weighted average price of the pool, in\n /// log base sqrt(1.0001) of token1 / token0. The TickMath library can be used to go from a tick value to a ratio.\n /// @param secondsAgos From how long ago each cumulative tick and liquidity value should be returned\n /// @return tickCumulatives Cumulative tick values as of each `secondsAgos` from the current block timestamp\n /// @return secondsPerLiquidityCumulativeX128s Cumulative seconds per liquidity-in-range value as of each `secondsAgos` from the current block\n /// timestamp\n function observe(uint32[] calldata secondsAgos)\n external\n view\n returns (int56[] memory tickCumulatives, uint160[] memory secondsPerLiquidityCumulativeX128s);\n\n /// @notice Returns a snapshot of the tick cumulative, seconds per liquidity and seconds inside a tick range\n /// @dev Snapshots must only be compared to other snapshots, taken over a period for which a position existed.\n /// I.e., snapshots cannot be compared if a position is not held for the entire period between when the first\n /// snapshot is taken and the second snapshot is taken.\n /// @param tickLower The lower tick of the range\n /// @param tickUpper The upper tick of the range\n /// @return tickCumulativeInside The snapshot of the tick accumulator for the range\n /// @return secondsPerLiquidityInsideX128 The snapshot of seconds per liquidity for the range\n /// @return secondsInside The snapshot of seconds per liquidity for the range\n function snapshotCumulativesInside(int24 tickLower, int24 tickUpper)\n external\n view\n returns (\n int56 tickCumulativeInside,\n uint160 secondsPerLiquidityInsideX128,\n uint32 secondsInside\n );\n}\n" - }, - "@uniswap/v3-core/contracts/interfaces/pool/IUniswapV3PoolActions.sol": { - "content": "// SPDX-License-Identifier: GPL-2.0-or-later\npragma solidity >=0.5.0;\n\n/// @title Permissionless pool actions\n/// @notice Contains pool methods that can be called by anyone\ninterface IUniswapV3PoolActions {\n /// @notice Sets the initial price for the pool\n /// @dev Price is represented as a sqrt(amountToken1/amountToken0) Q64.96 value\n /// @param sqrtPriceX96 the initial sqrt price of the pool as a Q64.96\n function initialize(uint160 sqrtPriceX96) external;\n\n /// @notice Adds liquidity for the given recipient/tickLower/tickUpper position\n /// @dev The caller of this method receives a callback in the form of IUniswapV3MintCallback#uniswapV3MintCallback\n /// in which they must pay any token0 or token1 owed for the liquidity. The amount of token0/token1 due depends\n /// on tickLower, tickUpper, the amount of liquidity, and the current price.\n /// @param recipient The address for which the liquidity will be created\n /// @param tickLower The lower tick of the position in which to add liquidity\n /// @param tickUpper The upper tick of the position in which to add liquidity\n /// @param amount The amount of liquidity to mint\n /// @param data Any data that should be passed through to the callback\n /// @return amount0 The amount of token0 that was paid to mint the given amount of liquidity. Matches the value in the callback\n /// @return amount1 The amount of token1 that was paid to mint the given amount of liquidity. Matches the value in the callback\n function mint(\n address recipient,\n int24 tickLower,\n int24 tickUpper,\n uint128 amount,\n bytes calldata data\n ) external returns (uint256 amount0, uint256 amount1);\n\n /// @notice Collects tokens owed to a position\n /// @dev Does not recompute fees earned, which must be done either via mint or burn of any amount of liquidity.\n /// Collect must be called by the position owner. To withdraw only token0 or only token1, amount0Requested or\n /// amount1Requested may be set to zero. To withdraw all tokens owed, caller may pass any value greater than the\n /// actual tokens owed, e.g. type(uint128).max. Tokens owed may be from accumulated swap fees or burned liquidity.\n /// @param recipient The address which should receive the fees collected\n /// @param tickLower The lower tick of the position for which to collect fees\n /// @param tickUpper The upper tick of the position for which to collect fees\n /// @param amount0Requested How much token0 should be withdrawn from the fees owed\n /// @param amount1Requested How much token1 should be withdrawn from the fees owed\n /// @return amount0 The amount of fees collected in token0\n /// @return amount1 The amount of fees collected in token1\n function collect(\n address recipient,\n int24 tickLower,\n int24 tickUpper,\n uint128 amount0Requested,\n uint128 amount1Requested\n ) external returns (uint128 amount0, uint128 amount1);\n\n /// @notice Burn liquidity from the sender and account tokens owed for the liquidity to the position\n /// @dev Can be used to trigger a recalculation of fees owed to a position by calling with an amount of 0\n /// @dev Fees must be collected separately via a call to #collect\n /// @param tickLower The lower tick of the position for which to burn liquidity\n /// @param tickUpper The upper tick of the position for which to burn liquidity\n /// @param amount How much liquidity to burn\n /// @return amount0 The amount of token0 sent to the recipient\n /// @return amount1 The amount of token1 sent to the recipient\n function burn(\n int24 tickLower,\n int24 tickUpper,\n uint128 amount\n ) external returns (uint256 amount0, uint256 amount1);\n\n /// @notice Swap token0 for token1, or token1 for token0\n /// @dev The caller of this method receives a callback in the form of IUniswapV3SwapCallback#uniswapV3SwapCallback\n /// @param recipient The address to receive the output of the swap\n /// @param zeroForOne The direction of the swap, true for token0 to token1, false for token1 to token0\n /// @param amountSpecified The amount of the swap, which implicitly configures the swap as exact input (positive), or exact output (negative)\n /// @param sqrtPriceLimitX96 The Q64.96 sqrt price limit. If zero for one, the price cannot be less than this\n /// value after the swap. If one for zero, the price cannot be greater than this value after the swap\n /// @param data Any data to be passed through to the callback\n /// @return amount0 The delta of the balance of token0 of the pool, exact when negative, minimum when positive\n /// @return amount1 The delta of the balance of token1 of the pool, exact when negative, minimum when positive\n function swap(\n address recipient,\n bool zeroForOne,\n int256 amountSpecified,\n uint160 sqrtPriceLimitX96,\n bytes calldata data\n ) external returns (int256 amount0, int256 amount1);\n\n /// @notice Receive token0 and/or token1 and pay it back, plus a fee, in the callback\n /// @dev The caller of this method receives a callback in the form of IUniswapV3FlashCallback#uniswapV3FlashCallback\n /// @dev Can be used to donate underlying tokens pro-rata to currently in-range liquidity providers by calling\n /// with 0 amount{0,1} and sending the donation amount(s) from the callback\n /// @param recipient The address which will receive the token0 and token1 amounts\n /// @param amount0 The amount of token0 to send\n /// @param amount1 The amount of token1 to send\n /// @param data Any data to be passed through to the callback\n function flash(\n address recipient,\n uint256 amount0,\n uint256 amount1,\n bytes calldata data\n ) external;\n\n /// @notice Increase the maximum number of price and liquidity observations that this pool will store\n /// @dev This method is no-op if the pool already has an observationCardinalityNext greater than or equal to\n /// the input observationCardinalityNext.\n /// @param observationCardinalityNext The desired minimum number of observations for the pool to store\n function increaseObservationCardinalityNext(uint16 observationCardinalityNext) external;\n}\n" - }, - "@uniswap/v3-core/contracts/interfaces/pool/IUniswapV3PoolOwnerActions.sol": { - "content": "// SPDX-License-Identifier: GPL-2.0-or-later\npragma solidity >=0.5.0;\n\n/// @title Permissioned pool actions\n/// @notice Contains pool methods that may only be called by the factory owner\ninterface IUniswapV3PoolOwnerActions {\n /// @notice Set the denominator of the protocol's % share of the fees\n /// @param feeProtocol0 new protocol fee for token0 of the pool\n /// @param feeProtocol1 new protocol fee for token1 of the pool\n function setFeeProtocol(uint8 feeProtocol0, uint8 feeProtocol1) external;\n\n /// @notice Collect the protocol fee accrued to the pool\n /// @param recipient The address to which collected protocol fees should be sent\n /// @param amount0Requested The maximum amount of token0 to send, can be 0 to collect fees in only token1\n /// @param amount1Requested The maximum amount of token1 to send, can be 0 to collect fees in only token0\n /// @return amount0 The protocol fee collected in token0\n /// @return amount1 The protocol fee collected in token1\n function collectProtocol(\n address recipient,\n uint128 amount0Requested,\n uint128 amount1Requested\n ) external returns (uint128 amount0, uint128 amount1);\n}\n" - }, - "@uniswap/v3-core/contracts/interfaces/pool/IUniswapV3PoolEvents.sol": { - "content": "// SPDX-License-Identifier: GPL-2.0-or-later\npragma solidity >=0.5.0;\n\n/// @title Events emitted by a pool\n/// @notice Contains all events emitted by the pool\ninterface IUniswapV3PoolEvents {\n /// @notice Emitted exactly once by a pool when #initialize is first called on the pool\n /// @dev Mint/Burn/Swap cannot be emitted by the pool before Initialize\n /// @param sqrtPriceX96 The initial sqrt price of the pool, as a Q64.96\n /// @param tick The initial tick of the pool, i.e. log base 1.0001 of the starting price of the pool\n event Initialize(uint160 sqrtPriceX96, int24 tick);\n\n /// @notice Emitted when liquidity is minted for a given position\n /// @param sender The address that minted the liquidity\n /// @param owner The owner of the position and recipient of any minted liquidity\n /// @param tickLower The lower tick of the position\n /// @param tickUpper The upper tick of the position\n /// @param amount The amount of liquidity minted to the position range\n /// @param amount0 How much token0 was required for the minted liquidity\n /// @param amount1 How much token1 was required for the minted liquidity\n event Mint(\n address sender,\n address indexed owner,\n int24 indexed tickLower,\n int24 indexed tickUpper,\n uint128 amount,\n uint256 amount0,\n uint256 amount1\n );\n\n /// @notice Emitted when fees are collected by the owner of a position\n /// @dev Collect events may be emitted with zero amount0 and amount1 when the caller chooses not to collect fees\n /// @param owner The owner of the position for which fees are collected\n /// @param tickLower The lower tick of the position\n /// @param tickUpper The upper tick of the position\n /// @param amount0 The amount of token0 fees collected\n /// @param amount1 The amount of token1 fees collected\n event Collect(\n address indexed owner,\n address recipient,\n int24 indexed tickLower,\n int24 indexed tickUpper,\n uint128 amount0,\n uint128 amount1\n );\n\n /// @notice Emitted when a position's liquidity is removed\n /// @dev Does not withdraw any fees earned by the liquidity position, which must be withdrawn via #collect\n /// @param owner The owner of the position for which liquidity is removed\n /// @param tickLower The lower tick of the position\n /// @param tickUpper The upper tick of the position\n /// @param amount The amount of liquidity to remove\n /// @param amount0 The amount of token0 withdrawn\n /// @param amount1 The amount of token1 withdrawn\n event Burn(\n address indexed owner,\n int24 indexed tickLower,\n int24 indexed tickUpper,\n uint128 amount,\n uint256 amount0,\n uint256 amount1\n );\n\n /// @notice Emitted by the pool for any swaps between token0 and token1\n /// @param sender The address that initiated the swap call, and that received the callback\n /// @param recipient The address that received the output of the swap\n /// @param amount0 The delta of the token0 balance of the pool\n /// @param amount1 The delta of the token1 balance of the pool\n /// @param sqrtPriceX96 The sqrt(price) of the pool after the swap, as a Q64.96\n /// @param liquidity The liquidity of the pool after the swap\n /// @param tick The log base 1.0001 of price of the pool after the swap\n event Swap(\n address indexed sender,\n address indexed recipient,\n int256 amount0,\n int256 amount1,\n uint160 sqrtPriceX96,\n uint128 liquidity,\n int24 tick\n );\n\n /// @notice Emitted by the pool for any flashes of token0/token1\n /// @param sender The address that initiated the swap call, and that received the callback\n /// @param recipient The address that received the tokens from flash\n /// @param amount0 The amount of token0 that was flashed\n /// @param amount1 The amount of token1 that was flashed\n /// @param paid0 The amount of token0 paid for the flash, which can exceed the amount0 plus the fee\n /// @param paid1 The amount of token1 paid for the flash, which can exceed the amount1 plus the fee\n event Flash(\n address indexed sender,\n address indexed recipient,\n uint256 amount0,\n uint256 amount1,\n uint256 paid0,\n uint256 paid1\n );\n\n /// @notice Emitted by the pool for increases to the number of observations that can be stored\n /// @dev observationCardinalityNext is not the observation cardinality until an observation is written at the index\n /// just before a mint/swap/burn.\n /// @param observationCardinalityNextOld The previous value of the next observation cardinality\n /// @param observationCardinalityNextNew The updated value of the next observation cardinality\n event IncreaseObservationCardinalityNext(\n uint16 observationCardinalityNextOld,\n uint16 observationCardinalityNextNew\n );\n\n /// @notice Emitted when the protocol fee is changed by the pool\n /// @param feeProtocol0Old The previous value of the token0 protocol fee\n /// @param feeProtocol1Old The previous value of the token1 protocol fee\n /// @param feeProtocol0New The updated value of the token0 protocol fee\n /// @param feeProtocol1New The updated value of the token1 protocol fee\n event SetFeeProtocol(uint8 feeProtocol0Old, uint8 feeProtocol1Old, uint8 feeProtocol0New, uint8 feeProtocol1New);\n\n /// @notice Emitted when the collected protocol fees are withdrawn by the factory owner\n /// @param sender The address that collects the protocol fees\n /// @param recipient The address that receives the collected protocol fees\n /// @param amount0 The amount of token0 protocol fees that is withdrawn\n /// @param amount0 The amount of token1 protocol fees that is withdrawn\n event CollectProtocol(address indexed sender, address indexed recipient, uint128 amount0, uint128 amount1);\n}\n" - }, - "solidity/for-test/UniV3PairManagerForTest.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '@openzeppelin/contracts/token/ERC20/ERC20.sol';\nimport '@uniswap/v3-core/contracts/interfaces/IUniswapV3Pool.sol';\n\nimport '../contracts/libraries/LiquidityAmounts.sol';\nimport '../contracts/libraries/FixedPoint96.sol';\nimport '../contracts/libraries/FullMath.sol';\nimport '../contracts/libraries/TickMath.sol';\nimport '../contracts/UniV3PairManager.sol';\nimport '../interfaces/external/IWeth9.sol';\nimport '../interfaces/IUniV3PairManager.sol';\n\ncontract UniV3PairManagerForTest is UniV3PairManager {\n constructor(address _pool, address _governance) UniV3PairManager(_pool, _governance) {}\n\n function internalAddLiquidity(\n uint256 amount0Desired,\n uint256 amount1Desired,\n uint256 amount0Min,\n uint256 amount1Min\n )\n external\n returns (\n uint128 liquidity,\n uint256 amount0,\n uint256 amount1\n )\n {\n return _addLiquidity(amount0Desired, amount1Desired, amount0Min, amount1Min);\n }\n\n function internalPay(\n address token,\n address payer,\n address recipient,\n uint256 value\n ) external {\n return _pay(token, payer, recipient, value);\n }\n\n function internalMint(address dst, uint256 amount) external {\n return _mint(dst, amount);\n }\n\n function internalBurn(address dst, uint256 amount) external {\n return _burn(dst, amount);\n }\n\n function internalTransferTokens(\n address src,\n address dst,\n uint256 amount\n ) external {\n _transferTokens(src, dst, amount);\n }\n\n function internalSafeTransferFrom(\n address token,\n address from,\n address to,\n uint256 value\n ) external {\n _safeTransferFrom(token, from, to, value);\n }\n\n receive() external payable {}\n}\n" - }, - "@openzeppelin/contracts/token/ERC20/ERC20.sol": { - "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\nimport \"./IERC20.sol\";\nimport \"./extensions/IERC20Metadata.sol\";\nimport \"../../utils/Context.sol\";\n\n/**\n * @dev Implementation of the {IERC20} interface.\n *\n * This implementation is agnostic to the way tokens are created. This means\n * that a supply mechanism has to be added in a derived contract using {_mint}.\n * For a generic mechanism see {ERC20PresetMinterPauser}.\n *\n * TIP: For a detailed writeup see our guide\n * https://forum.zeppelin.solutions/t/how-to-implement-erc20-supply-mechanisms/226[How\n * to implement supply mechanisms].\n *\n * We have followed general OpenZeppelin Contracts guidelines: functions revert\n * instead returning `false` on failure. This behavior is nonetheless\n * conventional and does not conflict with the expectations of ERC20\n * applications.\n *\n * Additionally, an {Approval} event is emitted on calls to {transferFrom}.\n * This allows applications to reconstruct the allowance for all accounts just\n * by listening to said events. Other implementations of the EIP may not emit\n * these events, as it isn't required by the specification.\n *\n * Finally, the non-standard {decreaseAllowance} and {increaseAllowance}\n * functions have been added to mitigate the well-known issues around setting\n * allowances. See {IERC20-approve}.\n */\ncontract ERC20 is Context, IERC20, IERC20Metadata {\n mapping(address => uint256) private _balances;\n\n mapping(address => mapping(address => uint256)) private _allowances;\n\n uint256 private _totalSupply;\n\n string private _name;\n string private _symbol;\n\n /**\n * @dev Sets the values for {name} and {symbol}.\n *\n * The default value of {decimals} is 18. To select a different value for\n * {decimals} you should overload it.\n *\n * All two of these values are immutable: they can only be set once during\n * construction.\n */\n constructor(string memory name_, string memory symbol_) {\n _name = name_;\n _symbol = symbol_;\n }\n\n /**\n * @dev Returns the name of the token.\n */\n function name() public view virtual override returns (string memory) {\n return _name;\n }\n\n /**\n * @dev Returns the symbol of the token, usually a shorter version of the\n * name.\n */\n function symbol() public view virtual override returns (string memory) {\n return _symbol;\n }\n\n /**\n * @dev Returns the number of decimals used to get its user representation.\n * For example, if `decimals` equals `2`, a balance of `505` tokens should\n * be displayed to a user as `5.05` (`505 / 10 ** 2`).\n *\n * Tokens usually opt for a value of 18, imitating the relationship between\n * Ether and Wei. This is the value {ERC20} uses, unless this function is\n * overridden;\n *\n * NOTE: This information is only used for _display_ purposes: it in\n * no way affects any of the arithmetic of the contract, including\n * {IERC20-balanceOf} and {IERC20-transfer}.\n */\n function decimals() public view virtual override returns (uint8) {\n return 18;\n }\n\n /**\n * @dev See {IERC20-totalSupply}.\n */\n function totalSupply() public view virtual override returns (uint256) {\n return _totalSupply;\n }\n\n /**\n * @dev See {IERC20-balanceOf}.\n */\n function balanceOf(address account) public view virtual override returns (uint256) {\n return _balances[account];\n }\n\n /**\n * @dev See {IERC20-transfer}.\n *\n * Requirements:\n *\n * - `recipient` cannot be the zero address.\n * - the caller must have a balance of at least `amount`.\n */\n function transfer(address recipient, uint256 amount) public virtual override returns (bool) {\n _transfer(_msgSender(), recipient, amount);\n return true;\n }\n\n /**\n * @dev See {IERC20-allowance}.\n */\n function allowance(address owner, address spender) public view virtual override returns (uint256) {\n return _allowances[owner][spender];\n }\n\n /**\n * @dev See {IERC20-approve}.\n *\n * Requirements:\n *\n * - `spender` cannot be the zero address.\n */\n function approve(address spender, uint256 amount) public virtual override returns (bool) {\n _approve(_msgSender(), spender, amount);\n return true;\n }\n\n /**\n * @dev See {IERC20-transferFrom}.\n *\n * Emits an {Approval} event indicating the updated allowance. This is not\n * required by the EIP. See the note at the beginning of {ERC20}.\n *\n * Requirements:\n *\n * - `sender` and `recipient` cannot be the zero address.\n * - `sender` must have a balance of at least `amount`.\n * - the caller must have allowance for ``sender``'s tokens of at least\n * `amount`.\n */\n function transferFrom(\n address sender,\n address recipient,\n uint256 amount\n ) public virtual override returns (bool) {\n _transfer(sender, recipient, amount);\n\n uint256 currentAllowance = _allowances[sender][_msgSender()];\n require(currentAllowance >= amount, \"ERC20: transfer amount exceeds allowance\");\n unchecked {\n _approve(sender, _msgSender(), currentAllowance - amount);\n }\n\n return true;\n }\n\n /**\n * @dev Atomically increases the allowance granted to `spender` by the caller.\n *\n * This is an alternative to {approve} that can be used as a mitigation for\n * problems described in {IERC20-approve}.\n *\n * Emits an {Approval} event indicating the updated allowance.\n *\n * Requirements:\n *\n * - `spender` cannot be the zero address.\n */\n function increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool) {\n _approve(_msgSender(), spender, _allowances[_msgSender()][spender] + addedValue);\n return true;\n }\n\n /**\n * @dev Atomically decreases the allowance granted to `spender` by the caller.\n *\n * This is an alternative to {approve} that can be used as a mitigation for\n * problems described in {IERC20-approve}.\n *\n * Emits an {Approval} event indicating the updated allowance.\n *\n * Requirements:\n *\n * - `spender` cannot be the zero address.\n * - `spender` must have allowance for the caller of at least\n * `subtractedValue`.\n */\n function decreaseAllowance(address spender, uint256 subtractedValue) public virtual returns (bool) {\n uint256 currentAllowance = _allowances[_msgSender()][spender];\n require(currentAllowance >= subtractedValue, \"ERC20: decreased allowance below zero\");\n unchecked {\n _approve(_msgSender(), spender, currentAllowance - subtractedValue);\n }\n\n return true;\n }\n\n /**\n * @dev Moves `amount` of tokens from `sender` to `recipient`.\n *\n * This internal function is equivalent to {transfer}, and can be used to\n * e.g. implement automatic token fees, slashing mechanisms, etc.\n *\n * Emits a {Transfer} event.\n *\n * Requirements:\n *\n * - `sender` cannot be the zero address.\n * - `recipient` cannot be the zero address.\n * - `sender` must have a balance of at least `amount`.\n */\n function _transfer(\n address sender,\n address recipient,\n uint256 amount\n ) internal virtual {\n require(sender != address(0), \"ERC20: transfer from the zero address\");\n require(recipient != address(0), \"ERC20: transfer to the zero address\");\n\n _beforeTokenTransfer(sender, recipient, amount);\n\n uint256 senderBalance = _balances[sender];\n require(senderBalance >= amount, \"ERC20: transfer amount exceeds balance\");\n unchecked {\n _balances[sender] = senderBalance - amount;\n }\n _balances[recipient] += amount;\n\n emit Transfer(sender, recipient, amount);\n\n _afterTokenTransfer(sender, recipient, amount);\n }\n\n /** @dev Creates `amount` tokens and assigns them to `account`, increasing\n * the total supply.\n *\n * Emits a {Transfer} event with `from` set to the zero address.\n *\n * Requirements:\n *\n * - `account` cannot be the zero address.\n */\n function _mint(address account, uint256 amount) internal virtual {\n require(account != address(0), \"ERC20: mint to the zero address\");\n\n _beforeTokenTransfer(address(0), account, amount);\n\n _totalSupply += amount;\n _balances[account] += amount;\n emit Transfer(address(0), account, amount);\n\n _afterTokenTransfer(address(0), account, amount);\n }\n\n /**\n * @dev Destroys `amount` tokens from `account`, reducing the\n * total supply.\n *\n * Emits a {Transfer} event with `to` set to the zero address.\n *\n * Requirements:\n *\n * - `account` cannot be the zero address.\n * - `account` must have at least `amount` tokens.\n */\n function _burn(address account, uint256 amount) internal virtual {\n require(account != address(0), \"ERC20: burn from the zero address\");\n\n _beforeTokenTransfer(account, address(0), amount);\n\n uint256 accountBalance = _balances[account];\n require(accountBalance >= amount, \"ERC20: burn amount exceeds balance\");\n unchecked {\n _balances[account] = accountBalance - amount;\n }\n _totalSupply -= amount;\n\n emit Transfer(account, address(0), amount);\n\n _afterTokenTransfer(account, address(0), amount);\n }\n\n /**\n * @dev Sets `amount` as the allowance of `spender` over the `owner` s tokens.\n *\n * This internal function is equivalent to `approve`, and can be used to\n * e.g. set automatic allowances for certain subsystems, etc.\n *\n * Emits an {Approval} event.\n *\n * Requirements:\n *\n * - `owner` cannot be the zero address.\n * - `spender` cannot be the zero address.\n */\n function _approve(\n address owner,\n address spender,\n uint256 amount\n ) internal virtual {\n require(owner != address(0), \"ERC20: approve from the zero address\");\n require(spender != address(0), \"ERC20: approve to the zero address\");\n\n _allowances[owner][spender] = amount;\n emit Approval(owner, spender, amount);\n }\n\n /**\n * @dev Hook that is called before any transfer of tokens. This includes\n * minting and burning.\n *\n * Calling conditions:\n *\n * - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens\n * will be transferred to `to`.\n * - when `from` is zero, `amount` tokens will be minted for `to`.\n * - when `to` is zero, `amount` of ``from``'s tokens will be burned.\n * - `from` and `to` are never both zero.\n *\n * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].\n */\n function _beforeTokenTransfer(\n address from,\n address to,\n uint256 amount\n ) internal virtual {}\n\n /**\n * @dev Hook that is called after any transfer of tokens. This includes\n * minting and burning.\n *\n * Calling conditions:\n *\n * - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens\n * has been transferred to `to`.\n * - when `from` is zero, `amount` tokens have been minted for `to`.\n * - when `to` is zero, `amount` of ``from``'s tokens have been burned.\n * - `from` and `to` are never both zero.\n *\n * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].\n */\n function _afterTokenTransfer(\n address from,\n address to,\n uint256 amount\n ) internal virtual {}\n}\n" - }, - "solidity/contracts/libraries/LiquidityAmounts.sol": { - "content": "// SPDX-License-Identifier: GPL-2.0-or-later\npragma solidity >=0.8.4 <0.9.0;\n\nimport './FullMath.sol';\nimport './FixedPoint96.sol';\n\n// solhint-disable\nlibrary LiquidityAmounts {\n function toUint128(uint256 x) private pure returns (uint128 y) {\n require((y = uint128(x)) == x);\n }\n\n function getLiquidityForAmount0(\n uint160 sqrtRatioAX96,\n uint160 sqrtRatioBX96,\n uint256 amount0\n ) internal pure returns (uint128 liquidity) {\n if (sqrtRatioAX96 > sqrtRatioBX96) (sqrtRatioAX96, sqrtRatioBX96) = (sqrtRatioBX96, sqrtRatioAX96);\n uint256 intermediate = FullMath.mulDiv(sqrtRatioAX96, sqrtRatioBX96, FixedPoint96.Q96);\n return toUint128(FullMath.mulDiv(amount0, intermediate, sqrtRatioBX96 - sqrtRatioAX96));\n }\n\n function getLiquidityForAmount1(\n uint160 sqrtRatioAX96,\n uint160 sqrtRatioBX96,\n uint256 amount1\n ) internal pure returns (uint128 liquidity) {\n if (sqrtRatioAX96 > sqrtRatioBX96) (sqrtRatioAX96, sqrtRatioBX96) = (sqrtRatioBX96, sqrtRatioAX96);\n return toUint128(FullMath.mulDiv(amount1, FixedPoint96.Q96, sqrtRatioBX96 - sqrtRatioAX96));\n }\n\n function getLiquidityForAmounts(\n uint160 sqrtRatioX96,\n uint160 sqrtRatioAX96,\n uint160 sqrtRatioBX96,\n uint256 amount0,\n uint256 amount1\n ) internal pure returns (uint128 liquidity) {\n if (sqrtRatioAX96 > sqrtRatioBX96) (sqrtRatioAX96, sqrtRatioBX96) = (sqrtRatioBX96, sqrtRatioAX96);\n\n if (sqrtRatioX96 <= sqrtRatioAX96) {\n liquidity = getLiquidityForAmount0(sqrtRatioAX96, sqrtRatioBX96, amount0);\n } else if (sqrtRatioX96 < sqrtRatioBX96) {\n uint128 liquidity0 = getLiquidityForAmount0(sqrtRatioX96, sqrtRatioBX96, amount0);\n uint128 liquidity1 = getLiquidityForAmount1(sqrtRatioAX96, sqrtRatioX96, amount1);\n\n liquidity = liquidity0 < liquidity1 ? liquidity0 : liquidity1;\n } else {\n liquidity = getLiquidityForAmount1(sqrtRatioAX96, sqrtRatioBX96, amount1);\n }\n }\n\n function getAmount0ForLiquidity(\n uint160 sqrtRatioAX96,\n uint160 sqrtRatioBX96,\n uint128 liquidity\n ) internal pure returns (uint256 amount0) {\n if (sqrtRatioAX96 > sqrtRatioBX96) (sqrtRatioAX96, sqrtRatioBX96) = (sqrtRatioBX96, sqrtRatioAX96);\n\n return FullMath.mulDiv(uint256(liquidity) << FixedPoint96.RESOLUTION, sqrtRatioBX96 - sqrtRatioAX96, sqrtRatioBX96) / sqrtRatioAX96;\n }\n\n function getAmount1ForLiquidity(\n uint160 sqrtRatioAX96,\n uint160 sqrtRatioBX96,\n uint128 liquidity\n ) internal pure returns (uint256 amount1) {\n if (sqrtRatioAX96 > sqrtRatioBX96) (sqrtRatioAX96, sqrtRatioBX96) = (sqrtRatioBX96, sqrtRatioAX96);\n\n return FullMath.mulDiv(liquidity, sqrtRatioBX96 - sqrtRatioAX96, FixedPoint96.Q96);\n }\n\n function getAmountsForLiquidity(\n uint160 sqrtRatioX96,\n uint160 sqrtRatioAX96,\n uint160 sqrtRatioBX96,\n uint128 liquidity\n ) internal pure returns (uint256 amount0, uint256 amount1) {\n if (sqrtRatioAX96 > sqrtRatioBX96) (sqrtRatioAX96, sqrtRatioBX96) = (sqrtRatioBX96, sqrtRatioAX96);\n\n if (sqrtRatioX96 <= sqrtRatioAX96) {\n amount0 = getAmount0ForLiquidity(sqrtRatioAX96, sqrtRatioBX96, liquidity);\n } else if (sqrtRatioX96 < sqrtRatioBX96) {\n amount0 = getAmount0ForLiquidity(sqrtRatioX96, sqrtRatioBX96, liquidity);\n amount1 = getAmount1ForLiquidity(sqrtRatioAX96, sqrtRatioX96, liquidity);\n } else {\n amount1 = getAmount1ForLiquidity(sqrtRatioAX96, sqrtRatioBX96, liquidity);\n }\n }\n}\n" - }, - "solidity/contracts/libraries/FixedPoint96.sol": { - "content": "// SPDX-License-Identifier: GPL-2.0-or-later\npragma solidity >=0.8.4 <0.9.0;\n\nlibrary FixedPoint96 {\n // solhint-disable\n uint8 internal constant RESOLUTION = 96;\n uint256 internal constant Q96 = 0x1000000000000000000000000;\n}\n" - }, - "solidity/contracts/UniV3PairManager.sol": { - "content": "// SPDX-License-Identifier: MIT\n\n/*\n\nCoded for The Keep3r Network with ♥ by\n\n██████╗░███████╗███████╗██╗  ░██╗░░░░░░░██╗░█████╗░███╗░░██╗██████╗░███████╗██████╗░██╗░░░░░░█████╗░███╗░░██╗██████╗░\n██╔══██╗██╔════╝██╔════╝██║  ░██║░░██╗░░██║██╔══██╗████╗░██║██╔══██╗██╔════╝██╔══██╗██║░░░░░██╔══██╗████╗░██║██╔══██╗\n██║░░██║█████╗░░█████╗░░██║  ░╚██╗████╗██╔╝██║░░██║██╔██╗██║██║░░██║█████╗░░██████╔╝██║░░░░░███████║██╔██╗██║██║░░██║\n██║░░██║██╔══╝░░██╔══╝░░██║  ░░████╔═████║░██║░░██║██║╚████║██║░░██║██╔══╝░░██╔══██╗██║░░░░░██╔══██║██║╚████║██║░░██║\n██████╔╝███████╗██║░░░░░██║  ░░╚██╔╝░╚██╔╝░╚█████╔╝██║░╚███║██████╔╝███████╗██║░░██║███████╗██║░░██║██║░╚███║██████╔╝\n╚═════╝░╚══════╝╚═╝░░░░░╚═╝  ░░░╚═╝░░░╚═╝░░░╚════╝░╚═╝░░╚══╝╚═════╝░╚══════╝╚═╝░░╚═╝╚══════╝╚═╝░░╚═╝╚═╝░░╚══╝╚═════╝░\n\nhttps://defi.sucks\n\n*/\n\npragma solidity >=0.8.4 <0.9.0;\n\nimport '@openzeppelin/contracts/token/ERC20/ERC20.sol';\nimport '@uniswap/v3-core/contracts/interfaces/IUniswapV3Pool.sol';\n\nimport './libraries/LiquidityAmounts.sol';\nimport './libraries/FixedPoint96.sol';\nimport './libraries/FullMath.sol';\nimport './libraries/TickMath.sol';\n\nimport '../interfaces/external/IWeth9.sol';\nimport '../interfaces/IUniV3PairManager.sol';\n\nimport './peripherals/Governable.sol';\n\ncontract UniV3PairManager is IUniV3PairManager, Governable {\n /// @inheritdoc IERC20Metadata\n string public override name;\n\n /// @inheritdoc IERC20Metadata\n string public override symbol;\n\n /// @inheritdoc IERC20\n uint256 public override totalSupply;\n\n /// @inheritdoc IPairManager\n address public immutable override factory;\n\n /// @inheritdoc IPairManager\n address public immutable override token0;\n\n /// @inheritdoc IPairManager\n address public immutable override token1;\n\n /// @inheritdoc IPairManager\n address public immutable override pool;\n\n /// @inheritdoc IUniV3PairManager\n uint24 public immutable override fee;\n\n /// @inheritdoc IUniV3PairManager\n uint160 public immutable override sqrtRatioAX96;\n\n /// @inheritdoc IUniV3PairManager\n uint160 public immutable override sqrtRatioBX96;\n\n /// @inheritdoc IUniV3PairManager\n int24 public immutable override tickLower;\n\n /// @inheritdoc IUniV3PairManager\n int24 public immutable override tickUpper;\n\n /// @inheritdoc IUniV3PairManager\n int24 public immutable override tickSpacing;\n\n /// @notice Uniswap's maximum tick\n /// @dev Due to tick spacing, pools with different fees may have differences between _MAX_TICK and tickUpper. Use tickUpper to find the max tick of the pool.\n int24 private constant _MAX_TICK = 887272;\n\n /// @inheritdoc IERC20Metadata\n //solhint-disable-next-line const-name-snakecase\n uint8 public constant override decimals = 18;\n\n /// @inheritdoc IERC20\n mapping(address => mapping(address => uint256)) public override allowance;\n\n /// @inheritdoc IERC20\n mapping(address => uint256) public override balanceOf;\n\n /// @notice Struct that contains token0, token1, and fee of the Uniswap pool\n PoolKey private _poolKey;\n\n constructor(address _pool, address _governance) Governable(_governance) {\n uint24 _fee = IUniswapV3Pool(_pool).fee();\n address _token0 = IUniswapV3Pool(_pool).token0();\n address _token1 = IUniswapV3Pool(_pool).token1();\n int24 _tickSpacing = IUniswapV3Pool(_pool).tickSpacing();\n int24 _tickUpper = _MAX_TICK - (_MAX_TICK % _tickSpacing);\n int24 _tickLower = -_tickUpper;\n\n factory = msg.sender;\n pool = _pool;\n fee = _fee;\n tickSpacing = _tickSpacing;\n tickUpper = _tickUpper;\n tickLower = _tickLower;\n token0 = _token0;\n token1 = _token1;\n name = string(abi.encodePacked('Keep3rLP - ', ERC20(_token0).symbol(), '/', ERC20(_token1).symbol()));\n symbol = string(abi.encodePacked('kLP-', ERC20(_token0).symbol(), '/', ERC20(_token1).symbol()));\n\n sqrtRatioAX96 = TickMath.getSqrtRatioAtTick(_tickLower);\n sqrtRatioBX96 = TickMath.getSqrtRatioAtTick(_tickUpper);\n _poolKey = PoolKey({token0: _token0, token1: _token1, fee: _fee});\n }\n\n // This low-level function should be called from a contract which performs important safety checks\n /// @inheritdoc IUniV3PairManager\n function mint(\n uint256 amount0Desired,\n uint256 amount1Desired,\n uint256 amount0Min,\n uint256 amount1Min,\n address to\n ) external override returns (uint128 liquidity) {\n (liquidity, , ) = _addLiquidity(amount0Desired, amount1Desired, amount0Min, amount1Min);\n _mint(to, liquidity);\n }\n\n /// @inheritdoc IUniV3PairManager\n function uniswapV3MintCallback(\n uint256 amount0Owed,\n uint256 amount1Owed,\n bytes calldata data\n ) external override {\n MintCallbackData memory decoded = abi.decode(data, (MintCallbackData));\n if (msg.sender != pool) revert OnlyPool();\n if (amount0Owed > 0) _pay(decoded._poolKey.token0, decoded.payer, pool, amount0Owed);\n if (amount1Owed > 0) _pay(decoded._poolKey.token1, decoded.payer, pool, amount1Owed);\n }\n\n /// @inheritdoc IUniV3PairManager\n function burn(\n uint128 liquidity,\n uint256 amount0Min,\n uint256 amount1Min,\n address to\n ) external override returns (uint256 amount0, uint256 amount1) {\n (amount0, amount1) = IUniswapV3Pool(pool).burn(tickLower, tickUpper, liquidity);\n\n if (amount0 < amount0Min || amount1 < amount1Min) revert ExcessiveSlippage();\n\n IUniswapV3Pool(pool).collect(to, tickLower, tickUpper, uint128(amount0), uint128(amount1));\n _burn(msg.sender, liquidity);\n }\n\n /// @inheritdoc IUniV3PairManager\n function collect() external override onlyGovernance returns (uint256 amount0, uint256 amount1) {\n (, , , uint128 tokensOwed0, uint128 tokensOwed1) = IUniswapV3Pool(pool).positions(\n keccak256(abi.encodePacked(address(this), tickLower, tickUpper))\n );\n (amount0, amount1) = IUniswapV3Pool(pool).collect(governance, tickLower, tickUpper, tokensOwed0, tokensOwed1);\n }\n\n /// @inheritdoc IUniV3PairManager\n function position()\n external\n view\n override\n returns (\n uint128 liquidity,\n uint256 feeGrowthInside0LastX128,\n uint256 feeGrowthInside1LastX128,\n uint128 tokensOwed0,\n uint128 tokensOwed1\n )\n {\n (liquidity, feeGrowthInside0LastX128, feeGrowthInside1LastX128, tokensOwed0, tokensOwed1) = IUniswapV3Pool(pool).positions(\n keccak256(abi.encodePacked(address(this), tickLower, tickUpper))\n );\n }\n\n /// @inheritdoc IERC20\n function approve(address spender, uint256 amount) external override returns (bool) {\n allowance[msg.sender][spender] = amount;\n\n emit Approval(msg.sender, spender, amount);\n return true;\n }\n\n /// @inheritdoc IERC20\n function transfer(address to, uint256 amount) external override returns (bool) {\n _transferTokens(msg.sender, to, amount);\n return true;\n }\n\n /// @inheritdoc IERC20\n function transferFrom(\n address from,\n address to,\n uint256 amount\n ) external override returns (bool) {\n address spender = msg.sender;\n uint256 spenderAllowance = allowance[from][spender];\n\n if (spender != from && spenderAllowance != type(uint256).max) {\n uint256 newAllowance = spenderAllowance - amount;\n allowance[from][spender] = newAllowance;\n\n emit Approval(from, spender, newAllowance);\n }\n\n _transferTokens(from, to, amount);\n return true;\n }\n\n /// @notice Adds liquidity to an initialized pool\n /// @dev Reverts if the returned amount0 is less than amount0Min or if amount1 is less than amount1Min\n /// @dev This function calls the mint function of the corresponding Uniswap pool, which in turn calls UniswapV3Callback\n /// @param amount0Desired The amount of token0 we would like to provide\n /// @param amount1Desired The amount of token1 we would like to provide\n /// @param amount0Min The minimum amount of token0 we want to provide\n /// @param amount1Min The minimum amount of token1 we want to provide\n /// @return liquidity The calculated liquidity we get for the token amounts we provided\n /// @return amount0 The amount of token0 we ended up providing\n /// @return amount1 The amount of token1 we ended up providing\n function _addLiquidity(\n uint256 amount0Desired,\n uint256 amount1Desired,\n uint256 amount0Min,\n uint256 amount1Min\n )\n internal\n returns (\n uint128 liquidity,\n uint256 amount0,\n uint256 amount1\n )\n {\n (uint160 sqrtPriceX96, , , , , , ) = IUniswapV3Pool(pool).slot0();\n\n liquidity = LiquidityAmounts.getLiquidityForAmounts(sqrtPriceX96, sqrtRatioAX96, sqrtRatioBX96, amount0Desired, amount1Desired);\n\n (amount0, amount1) = IUniswapV3Pool(pool).mint(\n address(this),\n tickLower,\n tickUpper,\n liquidity,\n abi.encode(MintCallbackData({_poolKey: _poolKey, payer: msg.sender}))\n );\n\n if (amount0 < amount0Min || amount1 < amount1Min) revert ExcessiveSlippage();\n }\n\n /// @notice Transfers the passed-in token from the payer to the recipient for the corresponding value\n /// @param token The token to be transferred to the recipient\n /// @param from The address of the payer\n /// @param to The address of the passed-in tokens recipient\n /// @param value How much of that token to be transferred from payer to the recipient\n function _pay(\n address token,\n address from,\n address to,\n uint256 value\n ) internal {\n _safeTransferFrom(token, from, to, value);\n }\n\n /// @notice Mints Keep3r credits to the passed-in address of recipient and increases total supply of Keep3r credits by the corresponding amount\n /// @param to The recipient of the Keep3r credits\n /// @param amount The amount Keep3r credits to be minted to the recipient\n function _mint(address to, uint256 amount) internal {\n totalSupply += amount;\n balanceOf[to] += amount;\n emit Transfer(address(0), to, amount);\n }\n\n /// @notice Burns Keep3r credits to the passed-in address of recipient and reduces total supply of Keep3r credits by the corresponding amount\n /// @param to The address that will get its Keep3r credits burned\n /// @param amount The amount Keep3r credits to be burned from the recipient/recipient\n function _burn(address to, uint256 amount) internal {\n totalSupply -= amount;\n balanceOf[to] -= amount;\n emit Transfer(to, address(0), amount);\n }\n\n /// @notice Transfers amount of Keep3r credits between two addresses\n /// @param from The user that transfers the Keep3r credits\n /// @param to The user that receives the Keep3r credits\n /// @param amount The amount of Keep3r credits to be transferred\n function _transferTokens(\n address from,\n address to,\n uint256 amount\n ) internal {\n balanceOf[from] -= amount;\n balanceOf[to] += amount;\n\n emit Transfer(from, to, amount);\n }\n\n /// @notice Transfers the passed-in token from the specified \"from\" to the specified \"to\" for the corresponding value\n /// @dev Reverts with IUniV3PairManager#UnsuccessfulTransfer if the transfer was not successful,\n /// or if the passed data length is different than 0 and the decoded data is not a boolean\n /// @param token The token to be transferred to the specified \"to\"\n /// @param from The address which is going to transfer the tokens\n /// @param value How much of that token to be transferred from \"from\" to \"to\"\n function _safeTransferFrom(\n address token,\n address from,\n address to,\n uint256 value\n ) internal {\n // solhint-disable-next-line avoid-low-level-calls\n (bool success, bytes memory data) = token.call(abi.encodeWithSelector(IERC20.transferFrom.selector, from, to, value));\n if (!success || (data.length != 0 && !abi.decode(data, (bool)))) revert UnsuccessfulTransfer();\n }\n}\n" - }, - "solidity/interfaces/external/IWeth9.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '@openzeppelin/contracts/token/ERC20/IERC20.sol';\n\ninterface IWeth9 is IERC20 {\n function deposit() external payable;\n\n function withdraw(uint256) external;\n}\n" - }, - "solidity/interfaces/IUniV3PairManager.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport './IPairManager.sol';\nimport '@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol';\nimport './peripherals/IGovernable.sol';\n\n/// @title Pair Manager contract\n/// @notice Creates a UniswapV3 position, and tokenizes in an ERC20 manner\n/// so that the user can use it as liquidity for a Keep3rJob\ninterface IUniV3PairManager is IGovernable, IPairManager {\n // Structs\n struct PoolKey {\n address token0;\n address token1;\n uint24 fee;\n }\n\n /// @notice The data to be decoded by the UniswapV3MintCallback function\n struct MintCallbackData {\n PoolKey _poolKey; // Struct that contains token0, token1, and fee of the pool passed into the constructor\n address payer; // The address of the payer, which will be the msg.sender of the mint function\n }\n\n // Variables\n\n /// @notice The fee of the Uniswap pool passed into the constructor\n /// @return _fee The fee of the Uniswap pool passed into the constructor\n function fee() external view returns (uint24 _fee);\n\n /// @notice Highest tick in the Uniswap's curve\n /// @return _tickUpper The highest tick in the Uniswap's curve\n function tickUpper() external view returns (int24 _tickUpper);\n\n /// @notice Lowest tick in the Uniswap's curve\n /// @return _tickLower The lower tick in the Uniswap's curve\n function tickLower() external view returns (int24 _tickLower);\n\n /// @notice The pair tick spacing\n /// @return _tickSpacing The pair tick spacing\n function tickSpacing() external view returns (int24 _tickSpacing);\n\n /// @notice The sqrtRatioAX96 at the lowest tick (-887200) of the Uniswap pool\n /// @return _sqrtPriceA96 A Fixed point Q64.96 number representing the sqrt of the ratio of the two assets (token1/token0)\n /// at the lowest tick\n function sqrtRatioAX96() external view returns (uint160 _sqrtPriceA96);\n\n /// @notice The sqrtRatioBX96 at the highest tick (887200) of the Uniswap pool\n /// @return _sqrtPriceBX96 A Fixed point Q64.96 number representing the sqrt of the ratio of the two assets (token1/token0)\n /// at the highest tick\n function sqrtRatioBX96() external view returns (uint160 _sqrtPriceBX96);\n\n // Errors\n\n /// @notice Throws when the caller of the function is not the pool\n error OnlyPool();\n\n /// @notice Throws when the slippage exceeds what the user is comfortable with\n error ExcessiveSlippage();\n\n /// @notice Throws when a transfer is unsuccessful\n error UnsuccessfulTransfer();\n\n // Methods\n\n /// @notice This function is called after a user calls IUniV3PairManager#mint function\n /// It ensures that any tokens owed to the pool are paid by the msg.sender of IUniV3PairManager#mint function\n /// @param amount0Owed The amount of token0 due to the pool for the minted liquidity\n /// @param amount1Owed The amount of token1 due to the pool for the minted liquidity\n /// @param data The encoded token0, token1, fee (_poolKey) and the payer (msg.sender) of the IUniV3PairManager#mint function\n function uniswapV3MintCallback(\n uint256 amount0Owed,\n uint256 amount1Owed,\n bytes calldata data\n ) external;\n\n /// @notice Mints kLP tokens to an address according to the liquidity the msg.sender provides to the UniswapV3 pool\n /// @dev Triggers UniV3PairManager#uniswapV3MintCallback\n /// @param amount0Desired The amount of token0 we would like to provide\n /// @param amount1Desired The amount of token1 we would like to provide\n /// @param amount0Min The minimum amount of token0 we want to provide\n /// @param amount1Min The minimum amount of token1 we want to provide\n /// @param to The address to which the kLP tokens are going to be minted to\n /// @return liquidity kLP tokens sent in exchange for the provision of tokens\n function mint(\n uint256 amount0Desired,\n uint256 amount1Desired,\n uint256 amount0Min,\n uint256 amount1Min,\n address to\n ) external returns (uint128 liquidity);\n\n /// @notice Returns the pair manager's position in the corresponding UniswapV3 pool\n /// @return liquidity The amount of liquidity provided to the UniswapV3 pool by the pair manager\n /// @return feeGrowthInside0LastX128 The fee growth of token0 as of the last action on the individual position\n /// @return feeGrowthInside1LastX128 The fee growth of token1 as of the last action on the individual position\n /// @return tokensOwed0 The uncollected amount of token0 owed to the position as of the last computation\n /// @return tokensOwed1 The uncollected amount of token1 owed to the position as of the last computation\n function position()\n external\n view\n returns (\n uint128 liquidity,\n uint256 feeGrowthInside0LastX128,\n uint256 feeGrowthInside1LastX128,\n uint128 tokensOwed0,\n uint128 tokensOwed1\n );\n\n /// @notice Calls the UniswapV3 pool's collect function, which collects up to a maximum amount of fees\n // owed to a specific position to the recipient, in this case, that recipient is the pair manager\n /// @dev The collected fees will be sent to governance\n /// @return amount0 The amount of fees collected in token0\n /// @return amount1 The amount of fees collected in token1\n function collect() external returns (uint256 amount0, uint256 amount1);\n\n /// @notice Burns the corresponding amount of kLP tokens from the msg.sender and withdraws the specified liquidity\n // in the entire range\n /// @param liquidity The amount of liquidity to be burned\n /// @param amount0Min The minimum amount of token0 we want to send to the recipient (to)\n /// @param amount1Min The minimum amount of token1 we want to send to the recipient (to)\n /// @param to The address that will receive the due fees\n /// @return amount0 The calculated amount of token0 that will be sent to the recipient\n /// @return amount1 The calculated amount of token1 that will be sent to the recipient\n function burn(\n uint128 liquidity,\n uint256 amount0Min,\n uint256 amount1Min,\n address to\n ) external returns (uint256 amount0, uint256 amount1);\n}\n" - }, - "@openzeppelin/contracts/utils/Context.sol": { - "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Provides information about the current execution context, including the\n * sender of the transaction and its data. While these are generally available\n * via msg.sender and msg.data, they should not be accessed in such a direct\n * manner, since when dealing with meta-transactions the account sending and\n * paying for execution may not be the actual sender (as far as an application\n * is concerned).\n *\n * This contract is only required for intermediate, library-like contracts.\n */\nabstract contract Context {\n function _msgSender() internal view virtual returns (address) {\n return msg.sender;\n }\n\n function _msgData() internal view virtual returns (bytes calldata) {\n return msg.data;\n }\n}\n" - }, - "solidity/interfaces/IPairManagerFactory.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport './peripherals/IGovernable.sol';\n\n/// @title Factory of Pair Managers\n/// @notice This contract creates new pair managers\ninterface IPairManagerFactory is IGovernable {\n // Variables\n\n /// @notice Maps the address of a Uniswap pool, to the address of the corresponding PairManager\n /// For example, the uniswap address of DAI-WETH, will return the Keep3r/DAI-WETH pair manager address\n /// @param _pool The address of the Uniswap pool\n /// @return _pairManager The address of the corresponding pair manager\n function pairManagers(address _pool) external view returns (address _pairManager);\n\n // Events\n\n /// @notice Emitted when a new pair manager is created\n /// @param _pool The address of the corresponding Uniswap pool\n /// @param _pairManager The address of the just-created pair manager\n event PairCreated(address _pool, address _pairManager);\n\n // Errors\n\n /// @notice Throws an error if the pair manager is already initialized\n error AlreadyInitialized();\n\n /// @notice Throws an error if the caller is not the owner\n error OnlyOwner();\n\n // Methods\n\n /// @notice Creates a new pair manager based on the address of a Uniswap pool\n /// For example, the uniswap address of DAI-WETH, will create the Keep3r/DAI-WETH pool\n /// @param _pool The address of the Uniswap pool the pair manager will be based of\n /// @return _pairManager The address of the just-created pair manager\n function createPairManager(address _pool) external returns (address _pairManager);\n}\n" - }, - "solidity/contracts/UniV3PairManagerFactory.sol": { - "content": "// SPDX-License-Identifier: MIT\n\n/*\n\nCoded for The Keep3r Network with ♥ by\n\n██████╗░███████╗███████╗██╗  ░██╗░░░░░░░██╗░█████╗░███╗░░██╗██████╗░███████╗██████╗░██╗░░░░░░█████╗░███╗░░██╗██████╗░\n██╔══██╗██╔════╝██╔════╝██║  ░██║░░██╗░░██║██╔══██╗████╗░██║██╔══██╗██╔════╝██╔══██╗██║░░░░░██╔══██╗████╗░██║██╔══██╗\n██║░░██║█████╗░░█████╗░░██║  ░╚██╗████╗██╔╝██║░░██║██╔██╗██║██║░░██║█████╗░░██████╔╝██║░░░░░███████║██╔██╗██║██║░░██║\n██║░░██║██╔══╝░░██╔══╝░░██║  ░░████╔═████║░██║░░██║██║╚████║██║░░██║██╔══╝░░██╔══██╗██║░░░░░██╔══██║██║╚████║██║░░██║\n██████╔╝███████╗██║░░░░░██║  ░░╚██╔╝░╚██╔╝░╚█████╔╝██║░╚███║██████╔╝███████╗██║░░██║███████╗██║░░██║██║░╚███║██████╔╝\n╚═════╝░╚══════╝╚═╝░░░░░╚═╝  ░░░╚═╝░░░╚═╝░░░╚════╝░╚═╝░░╚══╝╚═════╝░╚══════╝╚═╝░░╚═╝╚══════╝╚═╝░░╚═╝╚═╝░░╚══╝╚═════╝░\n\nhttps://defi.sucks\n\n*/\n\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../interfaces/IPairManagerFactory.sol';\nimport './UniV3PairManager.sol';\nimport './peripherals/Governable.sol';\n\n/// @title Factory of Pair Managers\n/// @notice This contract creates new pair managers\ncontract UniV3PairManagerFactory is IPairManagerFactory, Governable {\n mapping(address => address) public override pairManagers;\n\n constructor(address _governance) Governable(_governance) {}\n\n ///@inheritdoc IPairManagerFactory\n function createPairManager(address _pool) external override returns (address _pairManager) {\n if (pairManagers[_pool] != address(0)) revert AlreadyInitialized();\n _pairManager = address(new UniV3PairManager(_pool, governance));\n pairManagers[_pool] = _pairManager;\n emit PairCreated(_pool, _pairManager);\n }\n}\n" - }, - "solidity/for-test/peripherals/GovernableForTest.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../../contracts/peripherals/Governable.sol';\n\ncontract GovernableForTest is Governable {\n constructor(address _governor) Governable(_governor) {}\n}\n" - }, - "solidity/for-test/BridgeForTest.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.0 <0.9.0;\n\nimport '@openzeppelin/contracts/token/ERC20/ERC20.sol';\nimport '@openzeppelin/contracts/token/ERC20/IERC20.sol';\n\ncontract BridgeForTest is ERC20 {\n address public immutable kp3r;\n\n constructor(address _kp3r) ERC20('Wrapped KP3R', 'wKP3R') {\n kp3r = _kp3r;\n }\n\n function bridge(uint256 _amount) external {\n IERC20(kp3r).transferFrom(msg.sender, address(this), _amount);\n _mint(msg.sender, _amount);\n }\n\n function bridgeBack(uint256 _amount) external {\n _burn(msg.sender, _amount);\n IERC20(kp3r).transfer(msg.sender, _amount);\n }\n}\n" - }, - "solidity/for-test/ERC20ForTest.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '@openzeppelin/contracts/token/ERC20/ERC20.sol';\n\ncontract ERC20ForTest is ERC20 {\n constructor(\n string memory _name,\n string memory _symbol,\n address _initialAccount,\n uint256 _initialBalance\n ) ERC20(_name, _symbol) {\n _mint(_initialAccount, _initialBalance);\n }\n\n function mint(uint256 _amount) public {\n _mint(msg.sender, _amount);\n }\n\n function mint(address _account, uint256 _amount) public {\n _mint(_account, _amount);\n }\n\n function burn(uint256 _amount) public {\n _burn(msg.sender, _amount);\n }\n\n function burn(address _account, uint256 _amount) public {\n _burn(_account, _amount);\n }\n\n function transferInternal(\n address _from,\n address _to,\n uint256 _value\n ) public {\n _transfer(_from, _to, _value);\n }\n\n function approveInternal(\n address _owner,\n address _spender,\n uint256 _value\n ) public {\n _approve(_owner, _spender, _value);\n }\n\n function deposit() external payable {\n // Function added for compatibility with WETH\n }\n}\n" - }, - "solidity/for-test/peripherals/keepers/Keep3rKeeperFundableForTest.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../../../contracts/peripherals/keepers/Keep3rKeeperFundable.sol';\n\ncontract Keep3rKeeperFundableForTest is Keep3rKeeperFundable {\n using EnumerableSet for EnumerableSet.AddressSet;\n\n constructor(\n address _kph,\n address _keep3rV1,\n address _keep3rV1Proxy\n ) Keep3rParameters(_kph, _keep3rV1, _keep3rV1Proxy) Keep3rRoles(msg.sender) {}\n\n function isKeeper(address _keeper) external view returns (bool) {\n return _keepers.contains(_keeper);\n }\n\n function setJob(address job) external {\n _jobs.add(job);\n }\n}\n" - }, - "solidity/contracts/sidechain/Keep3rEscrow.sol": { - "content": "// SPDX-License-Identifier: MIT\n\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../peripherals/Mintable.sol';\nimport '../peripherals/DustCollector.sol';\nimport '../../interfaces/sidechain/IKeep3rEscrow.sol';\nimport '@openzeppelin/contracts/token/ERC20/IERC20.sol';\nimport '@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol';\n\ncontract Keep3rEscrow is Mintable, DustCollector, IKeep3rEscrow {\n using SafeERC20 for IERC20;\n\n /// @inheritdoc IKeep3rEscrow\n address public override wKP3R;\n\n /// @param _governance Address of governance\n /// @param _wKP3R Address of wrapped KP3R implementation\n constructor(address _governance, address _wKP3R) Mintable(_governance) {\n wKP3R = _wKP3R;\n }\n\n /// @inheritdoc IKeep3rEscrow\n function deposit(uint256 _amount) external override {\n IERC20(wKP3R).safeTransferFrom(msg.sender, address(this), _amount);\n emit wKP3RDeposited(wKP3R, msg.sender, _amount);\n }\n\n /// @inheritdoc IKeep3rEscrow\n function mint(uint256 _amount) external override onlyMinter {\n IERC20(wKP3R).safeTransfer(msg.sender, _amount);\n emit wKP3RMinted(wKP3R, msg.sender, _amount);\n }\n\n /// @inheritdoc IKeep3rEscrow\n function setWKP3R(address _wKP3R) external override onlyGovernance {\n if (_wKP3R == address(0)) revert ZeroAddress();\n wKP3R = _wKP3R;\n emit wKP3RSet(wKP3R);\n }\n}\n" - }, - "solidity/contracts/peripherals/Mintable.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../../interfaces/peripherals/IMintable.sol';\nimport './Governable.sol';\n\nabstract contract Mintable is Governable, IMintable {\n /// @inheritdoc IMintable\n address public override minter;\n\n constructor(address _governance) Governable(_governance) {}\n\n /// @inheritdoc IMintable\n function setMinter(address _minter) external override onlyGovernance {\n if (_minter == address(0)) revert ZeroAddress();\n minter = _minter;\n emit MinterSet(_minter);\n }\n\n /// @notice Functions with this modifier can only be called by the minter;\n modifier onlyMinter() {\n if (msg.sender != minter) revert OnlyMinter();\n _;\n }\n}\n" - }, - "solidity/for-test/peripherals/DustCollectorForTest.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../../contracts/peripherals/DustCollector.sol';\n\ncontract DustCollectorForTest is DustCollector {\n constructor() DustCollector() Governable(msg.sender) {}\n}\n" - }, - "solidity/for-test/peripherals/Keep3rAccountanceForTest.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../../contracts/peripherals/Keep3rAccountance.sol';\n\ncontract Keep3rAccountanceForTest is Keep3rAccountance {\n using EnumerableSet for EnumerableSet.AddressSet;\n\n constructor() Keep3rRoles(msg.sender) {}\n\n function setJob(address job) external {\n _jobs.add(job);\n }\n\n function setKeeper(address keeper) external {\n _keepers.add(keeper);\n }\n}\n" - }, - "solidity/for-test/peripherals/jobs/Keep3rJobFundableLiquidityForTest.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../../../contracts/peripherals/jobs/Keep3rJobFundableLiquidity.sol';\n\ncontract Keep3rJobFundableLiquidityForTest is Keep3rJobFundableLiquidity {\n using EnumerableSet for EnumerableSet.AddressSet;\n\n constructor(\n address _kph,\n address _keep3rV1,\n address _keep3rV1Proxy\n ) Keep3rParameters(_kph, _keep3rV1, _keep3rV1Proxy) Keep3rRoles(msg.sender) {}\n\n function setJob(address _job) external {\n _jobs.add(_job);\n }\n\n function setJobLiquidity(address _job, address _liquidity) external returns (bool) {\n return _jobLiquidities[_job].add(_liquidity);\n }\n\n function setApprovedLiquidity(address _liquidity) external {\n _approvedLiquidities.add(_liquidity);\n }\n\n function setRevokedLiquidity(address _liquidity) external {\n _approvedLiquidities.remove(_liquidity);\n }\n\n function viewTickCache(address _liquidity) external view returns (TickCache memory _tickCache) {\n _tickCache = _tick[_liquidity];\n }\n\n function viewTickOrder(address _liquidity) external view returns (bool) {\n return _isKP3RToken0[_liquidity];\n }\n\n function internalJobLiquidities(address _job) external view returns (address[] memory _list) {\n _list = _jobLiquidities[_job].values();\n }\n\n function internalSettleJobAccountance(address _job) external {\n _settleJobAccountance(_job);\n }\n}\n" - }, - "solidity/for-test/peripherals/jobs/Keep3rJobDisputableForTest.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../../../contracts/peripherals/jobs/Keep3rJobDisputable.sol';\n\ncontract Keep3rJobDisputableForTest is Keep3rJobDisputable {\n using EnumerableSet for EnumerableSet.AddressSet;\n\n constructor(\n address _kph,\n address _keep3rV1,\n address _keep3rV1Proxy\n ) Keep3rParameters(_kph, _keep3rV1, _keep3rV1Proxy) Keep3rRoles(msg.sender) {}\n\n function setJobLiquidity(address _job, address _liquidity) external {\n _jobLiquidities[_job].add(_liquidity);\n }\n\n function setJobToken(address _job, address _token) external {\n _jobTokens[_job].add(_token);\n }\n\n function setApprovedLiquidity(address _liquidity) external {\n _approvedLiquidities.add(_liquidity);\n }\n\n function setRevokedLiquidity(address _liquidity) external {\n _approvedLiquidities.remove(_liquidity);\n }\n\n function internalJobLiquidityCredits(address _job) external view returns (uint256 _credits) {\n _credits = _jobLiquidityCredits[_job];\n }\n\n function internalJobPeriodCredits(address _job) external view returns (uint256 _credits) {\n _credits = _jobPeriodCredits[_job];\n }\n\n function internalJobTokens(address _job) external view returns (address[] memory _tokens) {\n _tokens = new address[](_jobTokens[_job].length());\n for (uint256 i; i < _jobTokens[_job].length(); i++) {\n _tokens[i] = _jobTokens[_job].at(i);\n }\n }\n\n function internalJobLiquidities(address _job) external view returns (address[] memory _tokens) {\n _tokens = new address[](_jobLiquidities[_job].length());\n for (uint256 i; i < _jobLiquidities[_job].length(); i++) {\n _tokens[i] = _jobLiquidities[_job].at(i);\n }\n }\n}\n" - }, - "solidity/for-test/peripherals/Keep3rDisputableForTest.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../../contracts/peripherals/Keep3rDisputable.sol';\n\ncontract Keep3rDisputableForTest is Keep3rDisputable {\n constructor() Keep3rParameters(address(0), address(0), address(0)) Keep3rRoles(msg.sender) {}\n}\n" - }, - "solidity/for-test/peripherals/keepers/Keep3rKeeperDisputableForTest.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../../../contracts/peripherals/keepers/Keep3rKeeperDisputable.sol';\n\ncontract Keep3rKeeperDisputableForTest is Keep3rKeeperDisputable {\n using EnumerableSet for EnumerableSet.AddressSet;\n\n constructor(\n address _kph,\n address _keep3rV1,\n address _keep3rV1Proxy\n ) Keep3rParameters(_kph, _keep3rV1, _keep3rV1Proxy) Keep3rRoles(msg.sender) {}\n\n function setKeeper(address _keeper) external {\n _keepers.add(_keeper);\n }\n\n function internalSlash(\n address _bonded,\n address _keeper,\n uint256 _bondAmount,\n uint256 _unbondAmount\n ) external {\n _slash(_bonded, _keeper, _bondAmount, _unbondAmount);\n }\n\n function isKeeper(address _address) external view returns (bool _isKeeper) {\n _isKeeper = _keepers.contains(_address);\n }\n}\n" - }, - "solidity/for-test/peripherals/jobs/Keep3rJobFundableCreditsForTest.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../../../contracts/peripherals/jobs/Keep3rJobFundableCredits.sol';\n\ncontract Keep3rJobFundableCreditsForTest is Keep3rJobFundableCredits {\n using EnumerableSet for EnumerableSet.AddressSet;\n\n constructor(\n address _kph,\n address _keep3rV1,\n address _keep3rV1Proxy\n ) Keep3rParameters(_kph, _keep3rV1, _keep3rV1Proxy) Keep3rRoles(msg.sender) {}\n\n function setJob(address _job, address _jobOwner) external {\n _jobs.add(_job);\n jobOwner[_job] = _jobOwner;\n }\n\n function setJobToken(address _job, address _token) external {\n _jobTokens[_job].add(_token);\n }\n\n function isJobToken(address _job, address _token) external view returns (bool _contains) {\n _contains = _jobTokens[_job].contains(_token);\n }\n}\n" - }, - "solidity/contracts/Keep3rHelper.sol": { - "content": "// SPDX-License-Identifier: MIT\n\n/*\n\nCoded for The Keep3r Network with ♥ by\n\n██████╗░███████╗███████╗██╗  ░██╗░░░░░░░██╗░█████╗░███╗░░██╗██████╗░███████╗██████╗░██╗░░░░░░█████╗░███╗░░██╗██████╗░\n██╔══██╗██╔════╝██╔════╝██║  ░██║░░██╗░░██║██╔══██╗████╗░██║██╔══██╗██╔════╝██╔══██╗██║░░░░░██╔══██╗████╗░██║██╔══██╗\n██║░░██║█████╗░░█████╗░░██║  ░╚██╗████╗██╔╝██║░░██║██╔██╗██║██║░░██║█████╗░░██████╔╝██║░░░░░███████║██╔██╗██║██║░░██║\n██║░░██║██╔══╝░░██╔══╝░░██║  ░░████╔═████║░██║░░██║██║╚████║██║░░██║██╔══╝░░██╔══██╗██║░░░░░██╔══██║██║╚████║██║░░██║\n██████╔╝███████╗██║░░░░░██║  ░░╚██╔╝░╚██╔╝░╚█████╔╝██║░╚███║██████╔╝███████╗██║░░██║███████╗██║░░██║██║░╚███║██████╔╝\n╚═════╝░╚══════╝╚═╝░░░░░╚═╝  ░░░╚═╝░░░╚═╝░░░╚════╝░╚═╝░░╚══╝╚═════╝░╚══════╝╚═╝░░╚═╝╚══════╝╚═╝░░╚═╝╚═╝░░╚══╝╚═════╝░\n\nhttps://defi.sucks\n\n*/\n\npragma solidity >=0.8.7 <0.9.0;\n\nimport './libraries/FullMath.sol';\nimport './libraries/TickMath.sol';\nimport '../interfaces/IKeep3r.sol';\nimport '../interfaces/IKeep3rHelper.sol';\nimport './Keep3rHelperParameters.sol';\n\nimport '@openzeppelin/contracts/utils/math/Math.sol';\nimport '@uniswap/v3-core/contracts/interfaces/IUniswapV3Pool.sol';\n\ncontract Keep3rHelper is IKeep3rHelper, Keep3rHelperParameters {\n constructor(\n address _kp3r,\n address _keep3rV2,\n address _governance,\n address _kp3rWethPool\n ) Keep3rHelperParameters(_kp3r, _keep3rV2, _governance, _kp3rWethPool) {}\n\n /// @inheritdoc IKeep3rHelper\n function quote(uint256 _eth) public view override returns (uint256 _amountOut) {\n uint32[] memory _secondsAgos = new uint32[](2);\n _secondsAgos[1] = quoteTwapTime;\n\n (int56[] memory _tickCumulatives, ) = IUniswapV3Pool(kp3rWethPool.poolAddress).observe(_secondsAgos);\n int56 _difference = _tickCumulatives[0] - _tickCumulatives[1];\n _amountOut = getQuoteAtTick(uint128(_eth), kp3rWethPool.isTKNToken0 ? _difference : -_difference, quoteTwapTime);\n }\n\n /// @inheritdoc IKeep3rHelper\n function bonds(address _keeper) public view virtual override returns (uint256 _amountBonded) {\n return IKeep3r(keep3rV2).bonds(_keeper, KP3R);\n }\n\n /// @inheritdoc IKeep3rHelper\n function getRewardAmountFor(address _keeper, uint256 _gasUsed) public view override returns (uint256 _kp3r) {\n uint256 _boost = getRewardBoostFor(bonds(_keeper));\n _kp3r = quote((_gasUsed * _boost) / BOOST_BASE);\n }\n\n /// @inheritdoc IKeep3rHelper\n function getRewardAmount(uint256 _gasUsed) external view override returns (uint256 _amount) {\n // solhint-disable-next-line avoid-tx-origin\n return getRewardAmountFor(tx.origin, _gasUsed);\n }\n\n /// @inheritdoc IKeep3rHelper\n function getRewardBoostFor(uint256 _bonds) public view override returns (uint256 _rewardBoost) {\n _bonds = Math.min(_bonds, targetBond);\n uint256 _cap = minBoost + ((maxBoost - minBoost) * _bonds) / targetBond;\n _rewardBoost = _cap * _getBasefee();\n }\n\n /// @inheritdoc IKeep3rHelper\n function getPoolTokens(address _pool) public view override returns (address _token0, address _token1) {\n return (IUniswapV3Pool(_pool).token0(), IUniswapV3Pool(_pool).token1());\n }\n\n /// @inheritdoc IKeep3rHelper\n function isKP3RToken0(address _pool) external view virtual override returns (bool _isKP3RToken0) {\n address _token0;\n address _token1;\n (_token0, _token1) = getPoolTokens(_pool);\n if (_token0 == KP3R) {\n return true;\n } else if (_token1 != KP3R) {\n revert LiquidityPairInvalid();\n }\n }\n\n /// @inheritdoc IKeep3rHelper\n function observe(address _pool, uint32[] memory _secondsAgo)\n external\n view\n override\n returns (\n int56 _tickCumulative1,\n int56 _tickCumulative2,\n bool _success\n )\n {\n try IUniswapV3Pool(_pool).observe(_secondsAgo) returns (int56[] memory _uniswapResponse, uint160[] memory) {\n _tickCumulative1 = _uniswapResponse[0];\n if (_uniswapResponse.length > 1) {\n _tickCumulative2 = _uniswapResponse[1];\n }\n _success = true;\n } catch (bytes memory) {}\n }\n\n /// @inheritdoc IKeep3rHelper\n function getPaymentParams(uint256 _bonds)\n external\n view\n virtual\n override\n returns (\n uint256 _boost,\n uint256 _oneEthQuote,\n uint256 _extra\n )\n {\n _oneEthQuote = quote(1 ether);\n _boost = getRewardBoostFor(_bonds);\n _extra = workExtraGas;\n }\n\n /// @inheritdoc IKeep3rHelper\n function getKP3RsAtTick(\n uint256 _liquidityAmount,\n int56 _tickDifference,\n uint256 _timeInterval\n ) external pure override returns (uint256 _kp3rAmount) {\n uint160 sqrtRatioX96 = TickMath.getSqrtRatioAtTick(int24(_tickDifference / int256(_timeInterval)));\n _kp3rAmount = FullMath.mulDiv(1 << 96, _liquidityAmount, sqrtRatioX96);\n }\n\n /// @inheritdoc IKeep3rHelper\n function getQuoteAtTick(\n uint128 _baseAmount,\n int56 _tickDifference,\n uint256 _timeInterval\n ) public pure override returns (uint256 _quoteAmount) {\n uint160 sqrtRatioX96 = TickMath.getSqrtRatioAtTick(int24(_tickDifference / int256(_timeInterval)));\n\n if (sqrtRatioX96 <= type(uint128).max) {\n uint256 ratioX192 = uint256(sqrtRatioX96) * sqrtRatioX96;\n _quoteAmount = FullMath.mulDiv(1 << 192, _baseAmount, ratioX192);\n } else {\n uint256 ratioX128 = FullMath.mulDiv(sqrtRatioX96, sqrtRatioX96, 1 << 64);\n _quoteAmount = FullMath.mulDiv(1 << 128, _baseAmount, ratioX128);\n }\n }\n\n /// @notice Gets the gas basefee cost to calculate keeper rewards\n /// @dev Keepers are required to pay a priority fee to be included, this function recognizes a minimum priority fee\n /// @return _baseFee The block's basefee + a minimum priority fee, or a preset minimum gas fee\n function _getBasefee() internal view virtual returns (uint256 _baseFee) {\n return Math.max(minBaseFee, block.basefee + minPriorityFee);\n }\n}\n" - }, - "solidity/for-test/testnet/Keep3rHelperForTestnet.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../../contracts/Keep3rHelper.sol';\n\ncontract Keep3rHelperForTestnet is Keep3rHelper {\n constructor(\n address _kp3r,\n address _keep3rV2,\n address _governance,\n address _kp3rWethPool\n ) Keep3rHelper(_kp3r, _keep3rV2, _governance, _kp3rWethPool) {}\n\n function _getBasefee() internal pure override returns (uint256) {\n return 1;\n }\n}\n" - }, - "solidity/for-test/Keep3rHelperForTest.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../contracts/Keep3rHelper.sol';\n\ncontract Keep3rHelperForTest is Keep3rHelper {\n uint256 public basefee;\n\n constructor(\n address _kp3r,\n address _keep3rV2,\n address _governance,\n address _kp3rWethPool\n ) Keep3rHelper(_kp3r, _keep3rV2, _governance, _kp3rWethPool) {}\n\n function _getBasefee() internal view override returns (uint256) {\n return basefee != 0 ? (basefee + minPriorityFee) : super._getBasefee();\n }\n\n function setBaseFee(uint256 _baseFee) external {\n basefee = _baseFee;\n }\n}\n" - }, - "solidity/contracts/sidechain/Keep3rHelperSidechain.sol": { - "content": "// SPDX-License-Identifier: MIT\n\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../Keep3rHelper.sol';\nimport '../../interfaces/sidechain/IKeep3rHelperSidechain.sol';\n\ncontract Keep3rHelperSidechain is IKeep3rHelperSidechain, Keep3rHelper {\n /// @inheritdoc IKeep3rHelperSidechain\n mapping(address => address) public override oracle;\n /// @inheritdoc IKeep3rHelperSidechain\n IKeep3rHelperParameters.TokenOraclePool public override wethUSDPool;\n\n /// @notice Ethereum mainnet WETH address used for quoting references\n address public immutable override WETH;\n\n /// @param _keep3rV2 Address of sidechain Keep3r implementation\n /// @param _governance Address of governance\n /// @param _kp3rWethOracle Address of oracle used for KP3R/WETH quote\n /// @param _wethUsdOracle Address of oracle used for WETH/USD quote\n /// @dev Oracle pools should use 18 decimals tokens\n constructor(\n address _keep3rV2,\n address _governance,\n address _kp3r,\n address _weth,\n address _kp3rWethOracle,\n address _wethUsdOracle\n ) Keep3rHelper(_kp3r, _keep3rV2, _governance, _kp3rWethOracle) {\n WETH = _weth;\n wethUSDPool = _validateOraclePool(_wethUsdOracle, _weth);\n _setQuoteTwapTime(1 days);\n workExtraGas = 0;\n }\n\n /// @inheritdoc IKeep3rHelper\n /// @notice Uses valid wKP3R address from Keep3rSidechain to query keeper bonds\n function bonds(address _keeper) public view override(Keep3rHelper, IKeep3rHelper) returns (uint256 _amountBonded) {\n address wKP3R = IKeep3r(keep3rV2).keep3rV1();\n return IKeep3r(keep3rV2).bonds(_keeper, wKP3R);\n }\n\n /// @inheritdoc IKeep3rHelperSidechain\n function setOracle(address _liquidity, address _oracle) external override onlyGovernance {\n if (_liquidity == address(0) || _oracle == address(0)) revert ZeroAddress();\n oracle[_liquidity] = _oracle;\n emit OracleSet(_liquidity, _oracle);\n }\n\n /// @inheritdoc IKeep3rHelperSidechain\n function quoteUsdToEth(uint256 _usd) public view virtual override returns (uint256 _amountOut) {\n uint32[] memory _secondsAgos = new uint32[](2);\n _secondsAgos[1] = quoteTwapTime;\n\n /// @dev Oracle is compatible with IUniswapV3Pool\n (int56[] memory _tickCumulatives, ) = IUniswapV3Pool(wethUSDPool.poolAddress).observe(_secondsAgos);\n int56 _difference = _tickCumulatives[0] - _tickCumulatives[1];\n _amountOut = getQuoteAtTick(uint128(_usd), wethUSDPool.isTKNToken0 ? _difference : -_difference, quoteTwapTime);\n }\n\n /// @inheritdoc IKeep3rHelperSidechain\n function setWethUsdPool(address _poolAddress) external override onlyGovernance {\n if (_poolAddress == address(0)) revert ZeroAddress();\n _setWethUsdPool(_poolAddress);\n }\n\n /// @inheritdoc IKeep3rHelper\n function getPaymentParams(uint256 _bonds)\n external\n view\n virtual\n override(Keep3rHelper, IKeep3rHelper)\n returns (\n uint256 _boost,\n uint256 _oneUsdQuote,\n uint256 _extraGas\n )\n {\n _oneUsdQuote = quote(quoteUsdToEth(1 ether));\n _boost = getRewardBoostFor(_bonds);\n _extraGas = workExtraGas;\n }\n\n function _setWethUsdPool(address _poolAddress) internal {\n wethUSDPool = _validateOraclePool(_poolAddress, WETH);\n emit WethUSDPoolChange(wethUSDPool.poolAddress, wethUSDPool.isTKNToken0);\n }\n\n /// @dev Sidechain jobs are quoted by USD/gasUnit, baseFee is set to 1\n function _getBasefee() internal view virtual override returns (uint256 _baseFee) {\n return 1;\n }\n}\n" - }, - "solidity/for-test/testnet/Keep3rHelperSidechainForTestnet.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../../contracts/sidechain/Keep3rHelperSidechain.sol';\n\ncontract Keep3rHelperSidechainForTestnet is Keep3rHelperSidechain {\n constructor(\n address _keep3rV2,\n address _governance,\n address _kp3r,\n address _weth,\n address _kp3rWethOracle,\n address _wethUsdOracle\n ) Keep3rHelperSidechain(_keep3rV2, _governance, _kp3r, _weth, _kp3rWethOracle, _wethUsdOracle) {}\n}\n" - }, - "solidity/for-test/peripherals/Keep3rParametersForTest.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../../contracts/peripherals/Keep3rParameters.sol';\n\ncontract Keep3rParametersForTest is Keep3rParameters {\n constructor(\n address _keep3rHelper,\n address _keep3rV1,\n address _keep3rV1Proxy\n ) Keep3rParameters(_keep3rHelper, _keep3rV1, _keep3rV1Proxy) Keep3rRoles(msg.sender) {}\n}\n" - }, - "solidity/for-test/peripherals/jobs/Keep3rJobWorkableForTest.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../../../contracts/peripherals/jobs/Keep3rJobWorkable.sol';\n\ncontract Keep3rJobWorkableForTest is Keep3rJobWorkable {\n using EnumerableSet for EnumerableSet.AddressSet;\n\n constructor(\n address _keep3rHelper,\n address _keep3rV1,\n address _keep3rV1Proxy\n ) Keep3rParameters(_keep3rHelper, _keep3rV1, _keep3rV1Proxy) Keep3rRoles(msg.sender) {}\n\n function setJob(address _job) external {\n _jobs.add(_job);\n }\n\n function setKeeper(address _keeper) external {\n _keepers.add(_keeper);\n }\n\n function setApprovedLiquidity(address _liquidity) external {\n _approvedLiquidities.add(_liquidity);\n }\n\n function setJobLiquidity(address _job, address _liquidity) external {\n _jobLiquidities[_job].add(_liquidity);\n }\n\n function viewJobLiquidityCredits(address _job) external view returns (uint256) {\n return _jobLiquidityCredits[_job];\n }\n\n function viewJobPeriodCredits(address _job) external view returns (uint256) {\n return _jobPeriodCredits[_job];\n }\n\n function viewTickCache(address _liquidity) external view returns (TickCache memory _tickCache) {\n _tickCache = _tick[_liquidity];\n }\n\n function viewGas() external view returns (uint256) {\n return _initialGas;\n }\n}\n" - }, - "solidity/for-test/peripherals/jobs/Keep3rJobMigrationForTest.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../../../contracts/peripherals/jobs/Keep3rJobMigration.sol';\n\ncontract Keep3rJobMigrationForTest is Keep3rJobMigration {\n using EnumerableSet for EnumerableSet.AddressSet;\n\n mapping(address => uint256) public settleJobAccountanceCallCount;\n\n constructor(\n address _kph,\n address _keep3rV1,\n address _keep3rV1Proxy\n ) Keep3rParameters(_kph, _keep3rV1, _keep3rV1Proxy) Keep3rRoles(msg.sender) {}\n\n function setJobToken(address _job, address _token) external {\n _jobTokens[_job].add(_token);\n }\n\n function setJobLiquidity(address _job, address _liquidity) external {\n _jobLiquidities[_job].add(_liquidity);\n }\n\n function viewJobTokenListLength(address _job) external view returns (uint256) {\n return _jobTokens[_job].length();\n }\n\n function viewJobLiquidityList(address _job) external view returns (address[] memory _list) {\n _list = _jobLiquidities[_job].values();\n }\n\n function viewJobPeriodCredits(address _job) external view returns (uint256) {\n return _jobPeriodCredits[_job];\n }\n\n function viewJobLiquidityCredits(address _job) external view returns (uint256) {\n return _jobLiquidityCredits[_job];\n }\n\n function viewMigrationCreatedAt(address _fromJob, address _toJob) external view returns (uint256) {\n return _migrationCreatedAt[_fromJob][_toJob];\n }\n\n function isJob(address _job) external view returns (bool) {\n return _jobs.contains(_job);\n }\n\n function _settleJobAccountance(address _job) internal override {\n settleJobAccountanceCallCount[_job]++;\n }\n}\n" - }, - "solidity/for-test/peripherals/jobs/Keep3rJobManagerForTest.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../../../contracts/peripherals/jobs/Keep3rJobManager.sol';\n\ncontract Keep3rJobManagerForTest is Keep3rJobManager {\n using EnumerableSet for EnumerableSet.AddressSet;\n\n constructor(\n address _keep3rHelper,\n address _keep3rV1,\n address _keep3rV1Proxy\n ) Keep3rRoles(msg.sender) {}\n\n function isJob(address _job) external view returns (bool _isJob) {\n _isJob = _jobs.contains(_job);\n }\n}\n" - }, - "solidity/for-test/peripherals/jobs/Keep3rJobOwnershipForTest.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../../../contracts/peripherals/jobs/Keep3rJobOwnership.sol';\n\ncontract Keep3rJobOwnershipForTest is Keep3rJobOwnership {}\n" - }, - "solidity/for-test/libraries/LiquidityAmountsForTest.sol": { - "content": "// SPDX-License-Identifier: GPL-2.0-or-later\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../../contracts/libraries/FullMath.sol';\nimport '../../contracts/libraries/FixedPoint96.sol';\n\n/// @dev Made this library into a contract to be able to calculate liquidity more precisely for tests\n\n// solhint-disable\ncontract LiquidityAmountsForTest {\n function toUint128(uint256 x) private pure returns (uint128 y) {\n require((y = uint128(x)) == x);\n }\n\n function getLiquidityForAmount0(\n uint160 sqrtRatioAX96,\n uint160 sqrtRatioBX96,\n uint256 amount0\n ) public pure returns (uint128 liquidity) {\n if (sqrtRatioAX96 > sqrtRatioBX96) (sqrtRatioAX96, sqrtRatioBX96) = (sqrtRatioBX96, sqrtRatioAX96);\n uint256 intermediate = FullMath.mulDiv(sqrtRatioAX96, sqrtRatioBX96, FixedPoint96.Q96);\n return toUint128(FullMath.mulDiv(amount0, intermediate, sqrtRatioBX96 - sqrtRatioAX96));\n }\n\n function getLiquidityForAmount1(\n uint160 sqrtRatioAX96,\n uint160 sqrtRatioBX96,\n uint256 amount1\n ) public pure returns (uint128 liquidity) {\n if (sqrtRatioAX96 > sqrtRatioBX96) (sqrtRatioAX96, sqrtRatioBX96) = (sqrtRatioBX96, sqrtRatioAX96);\n return toUint128(FullMath.mulDiv(amount1, FixedPoint96.Q96, sqrtRatioBX96 - sqrtRatioAX96));\n }\n\n function getLiquidityForAmounts(\n uint160 sqrtRatioX96,\n uint160 sqrtRatioAX96,\n uint160 sqrtRatioBX96,\n uint256 amount0,\n uint256 amount1\n ) external pure returns (uint128 liquidity) {\n if (sqrtRatioAX96 > sqrtRatioBX96) (sqrtRatioAX96, sqrtRatioBX96) = (sqrtRatioBX96, sqrtRatioAX96);\n\n if (sqrtRatioX96 <= sqrtRatioAX96) {\n liquidity = getLiquidityForAmount0(sqrtRatioAX96, sqrtRatioBX96, amount0);\n } else if (sqrtRatioX96 < sqrtRatioBX96) {\n uint128 liquidity0 = getLiquidityForAmount0(sqrtRatioX96, sqrtRatioBX96, amount0);\n uint128 liquidity1 = getLiquidityForAmount1(sqrtRatioAX96, sqrtRatioX96, amount1);\n\n liquidity = liquidity0 < liquidity1 ? liquidity0 : liquidity1;\n } else {\n liquidity = getLiquidityForAmount1(sqrtRatioAX96, sqrtRatioBX96, amount1);\n }\n }\n\n function getAmount0ForLiquidity(\n uint160 sqrtRatioAX96,\n uint160 sqrtRatioBX96,\n uint128 liquidity\n ) public pure returns (uint256 amount0) {\n if (sqrtRatioAX96 > sqrtRatioBX96) (sqrtRatioAX96, sqrtRatioBX96) = (sqrtRatioBX96, sqrtRatioAX96);\n\n return FullMath.mulDiv(uint256(liquidity) << FixedPoint96.RESOLUTION, sqrtRatioBX96 - sqrtRatioAX96, sqrtRatioBX96) / sqrtRatioAX96;\n }\n\n function getAmount1ForLiquidity(\n uint160 sqrtRatioAX96,\n uint160 sqrtRatioBX96,\n uint128 liquidity\n ) public pure returns (uint256 amount1) {\n if (sqrtRatioAX96 > sqrtRatioBX96) (sqrtRatioAX96, sqrtRatioBX96) = (sqrtRatioBX96, sqrtRatioAX96);\n\n return FullMath.mulDiv(liquidity, sqrtRatioBX96 - sqrtRatioAX96, FixedPoint96.Q96);\n }\n\n function getAmountsForLiquidity(\n uint160 sqrtRatioX96,\n uint160 sqrtRatioAX96,\n uint160 sqrtRatioBX96,\n uint128 liquidity\n ) external pure returns (uint256 amount0, uint256 amount1) {\n if (sqrtRatioAX96 > sqrtRatioBX96) (sqrtRatioAX96, sqrtRatioBX96) = (sqrtRatioBX96, sqrtRatioAX96);\n\n if (sqrtRatioX96 <= sqrtRatioAX96) {\n amount0 = getAmount0ForLiquidity(sqrtRatioAX96, sqrtRatioBX96, liquidity);\n } else if (sqrtRatioX96 < sqrtRatioBX96) {\n amount0 = getAmount0ForLiquidity(sqrtRatioX96, sqrtRatioBX96, liquidity);\n amount1 = getAmount1ForLiquidity(sqrtRatioAX96, sqrtRatioX96, liquidity);\n } else {\n amount1 = getAmount1ForLiquidity(sqrtRatioAX96, sqrtRatioBX96, liquidity);\n }\n }\n}\n" - }, - "solidity/for-test/IUniswapV3PoolForTest.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '@uniswap/v3-core/contracts/interfaces/IERC20Minimal.sol';\nimport '@uniswap/v3-core/contracts/interfaces/IUniswapV3Pool.sol';\n\n// solhint-disable-next-line no-empty-blocks\ninterface IUniswapV3PoolForTest is IERC20Minimal, IUniswapV3Pool {\n\n}\n" - }, - "@uniswap/v3-core/contracts/interfaces/IERC20Minimal.sol": { - "content": "// SPDX-License-Identifier: GPL-2.0-or-later\npragma solidity >=0.5.0;\n\n/// @title Minimal ERC20 interface for Uniswap\n/// @notice Contains a subset of the full ERC20 interface that is used in Uniswap V3\ninterface IERC20Minimal {\n /// @notice Returns the balance of a token\n /// @param account The account for which to look up the number of tokens it has, i.e. its balance\n /// @return The number of tokens held by the account\n function balanceOf(address account) external view returns (uint256);\n\n /// @notice Transfers the amount of token from the `msg.sender` to the recipient\n /// @param recipient The account that will receive the amount transferred\n /// @param amount The number of tokens to send from the sender to the recipient\n /// @return Returns true for a successful transfer, false for an unsuccessful transfer\n function transfer(address recipient, uint256 amount) external returns (bool);\n\n /// @notice Returns the current allowance given to a spender by an owner\n /// @param owner The account of the token owner\n /// @param spender The account of the token spender\n /// @return The current allowance granted by `owner` to `spender`\n function allowance(address owner, address spender) external view returns (uint256);\n\n /// @notice Sets the allowance of a spender from the `msg.sender` to the value `amount`\n /// @param spender The account which will be allowed to spend a given amount of the owners tokens\n /// @param amount The amount of tokens allowed to be used by `spender`\n /// @return Returns true for a successful approval, false for unsuccessful\n function approve(address spender, uint256 amount) external returns (bool);\n\n /// @notice Transfers `amount` tokens from `sender` to `recipient` up to the allowance given to the `msg.sender`\n /// @param sender The account from which the transfer will be initiated\n /// @param recipient The recipient of the transfer\n /// @param amount The amount of the transfer\n /// @return Returns true for a successful transfer, false for unsuccessful\n function transferFrom(\n address sender,\n address recipient,\n uint256 amount\n ) external returns (bool);\n\n /// @notice Event emitted when tokens are transferred from one address to another, either via `#transfer` or `#transferFrom`.\n /// @param from The account from which the tokens were sent, i.e. the balance decreased\n /// @param to The account to which the tokens were sent, i.e. the balance increased\n /// @param value The amount of tokens that were transferred\n event Transfer(address indexed from, address indexed to, uint256 value);\n\n /// @notice Event emitted when the approval amount for the spender of a given owner's tokens changes.\n /// @param owner The account that approved spending of its tokens\n /// @param spender The account for which the spending allowance was modified\n /// @param value The new allowance from the owner to the spender\n event Approval(address indexed owner, address indexed spender, uint256 value);\n}\n" - } - }, - "settings": { - "optimizer": { - "enabled": true, - "runs": 33 - }, - "outputSelection": { - "*": { - "*": [ - "storageLayout", - "abi", - "evm.bytecode", - "evm.deployedBytecode", - "evm.methodIdentifiers", - "metadata", - "devdoc", - "userdoc", - "evm.gasEstimates" - ], - "": [ - "ast" - ] - } - }, - "metadata": { - "useLiteralContent": true - }, - "libraries": { - "": { - "__CACHE_BREAKER__": "0x00000000d41867734bbee4c6863d9255b2b06ac1" - } - } - } -} \ No newline at end of file diff --git a/deployments/optimisticGoerli/solcInputs/85c2893002b147e91499124ad14b40ea.json b/deployments/optimisticGoerli/solcInputs/85c2893002b147e91499124ad14b40ea.json deleted file mode 100644 index d5541af..0000000 --- a/deployments/optimisticGoerli/solcInputs/85c2893002b147e91499124ad14b40ea.json +++ /dev/null @@ -1,337 +0,0 @@ -{ - "language": "Solidity", - "sources": { - "solidity/contracts/Keep3r.sol": { - "content": "// SPDX-License-Identifier: MIT\n\n/*\n\nCoded for The Keep3r Network with ♥ by\n\n██████╗░███████╗███████╗██╗  ░██╗░░░░░░░██╗░█████╗░███╗░░██╗██████╗░███████╗██████╗░██╗░░░░░░█████╗░███╗░░██╗██████╗░\n██╔══██╗██╔════╝██╔════╝██║  ░██║░░██╗░░██║██╔══██╗████╗░██║██╔══██╗██╔════╝██╔══██╗██║░░░░░██╔══██╗████╗░██║██╔══██╗\n██║░░██║█████╗░░█████╗░░██║  ░╚██╗████╗██╔╝██║░░██║██╔██╗██║██║░░██║█████╗░░██████╔╝██║░░░░░███████║██╔██╗██║██║░░██║\n██║░░██║██╔══╝░░██╔══╝░░██║  ░░████╔═████║░██║░░██║██║╚████║██║░░██║██╔══╝░░██╔══██╗██║░░░░░██╔══██║██║╚████║██║░░██║\n██████╔╝███████╗██║░░░░░██║  ░░╚██╔╝░╚██╔╝░╚█████╔╝██║░╚███║██████╔╝███████╗██║░░██║███████╗██║░░██║██║░╚███║██████╔╝\n╚═════╝░╚══════╝╚═╝░░░░░╚═╝  ░░░╚═╝░░░╚═╝░░░╚════╝░╚═╝░░╚══╝╚═════╝░╚══════╝╚═╝░░╚═╝╚══════╝╚═╝░░╚═╝╚═╝░░╚══╝╚═════╝░\n\nhttps://defi.sucks\n\n*/\n\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../interfaces/IKeep3r.sol';\nimport './peripherals/jobs/Keep3rJobs.sol';\nimport './peripherals/keepers/Keep3rKeepers.sol';\nimport './peripherals/DustCollector.sol';\n\ncontract Keep3r is IKeep3r, Keep3rJobs, Keep3rKeepers {\n constructor(\n address _governance,\n address _keep3rHelper,\n address _keep3rV1,\n address _keep3rV1Proxy\n ) Keep3rParameters(_keep3rHelper, _keep3rV1, _keep3rV1Proxy) Keep3rRoles(_governance) {}\n}\n" - }, - "solidity/interfaces/IKeep3r.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport './peripherals/IKeep3rJobs.sol';\nimport './peripherals/IKeep3rKeepers.sol';\nimport './peripherals/IKeep3rParameters.sol';\n\n// solhint-disable-next-line no-empty-blocks\n\n/// @title Keep3rV2 contract\n/// @notice This contract inherits all the functionality of Keep3rV2\ninterface IKeep3r is IKeep3rJobs, IKeep3rKeepers, IKeep3rParameters {\n\n}\n" - }, - "solidity/contracts/peripherals/jobs/Keep3rJobs.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../../../interfaces/peripherals/IKeep3rJobs.sol';\nimport './Keep3rJobManager.sol';\nimport './Keep3rJobWorkable.sol';\nimport './Keep3rJobDisputable.sol';\n\nabstract contract Keep3rJobs is IKeep3rJobs, Keep3rJobManager, Keep3rJobWorkable, Keep3rJobDisputable {}\n" - }, - "solidity/contracts/peripherals/keepers/Keep3rKeepers.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../../../interfaces/peripherals/IKeep3rKeepers.sol';\nimport './Keep3rKeeperDisputable.sol';\n\nabstract contract Keep3rKeepers is IKeep3rKeepers, Keep3rKeeperDisputable {}\n" - }, - "solidity/contracts/peripherals/DustCollector.sol": { - "content": "// SPDX-License-Identifier: MIT\n\npragma solidity >=0.8.4 <0.9.0;\n\nimport '@openzeppelin/contracts/token/ERC20/IERC20.sol';\nimport '@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol';\nimport '../../contracts/peripherals/Governable.sol';\nimport '../../interfaces/peripherals/IDustCollector.sol';\n\nabstract contract DustCollector is IDustCollector, Governable {\n using SafeERC20 for IERC20;\n\n address internal constant _ETH_ADDRESS = 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE;\n\n function sendDust(\n address _token,\n uint256 _amount,\n address _to\n ) external override onlyGovernance {\n if (_to == address(0)) revert ZeroAddress();\n if (_token == _ETH_ADDRESS) {\n payable(_to).transfer(_amount);\n } else {\n IERC20(_token).safeTransfer(_to, _amount);\n }\n emit DustSent(_token, _amount, _to);\n }\n}\n" - }, - "solidity/interfaces/peripherals/IKeep3rJobs.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport './IKeep3rDisputable.sol';\n\n/// @title Keep3rJobOwnership contract\n/// @notice Handles the ownership of the jobs\ninterface IKeep3rJobOwnership {\n // Events\n\n /// @notice Emitted when Keep3rJobOwnership#changeJobOwnership is called\n /// @param _job The address of the job proposed to have a change of owner\n /// @param _owner The current owner of the job\n /// @param _pendingOwner The new address proposed to be the owner of the job\n event JobOwnershipChange(address indexed _job, address indexed _owner, address indexed _pendingOwner);\n\n /// @notice Emitted when Keep3rJobOwnership#JobOwnershipAssent is called\n /// @param _job The address of the job which the proposed owner will now own\n /// @param _previousOwner The previous owner of the job\n /// @param _newOwner The new owner of the job\n event JobOwnershipAssent(address indexed _job, address indexed _previousOwner, address indexed _newOwner);\n\n // Errors\n\n /// @notice Throws when the caller of the function is not the job owner\n error OnlyJobOwner();\n\n /// @notice Throws when the caller of the function is not the pending job owner\n error OnlyPendingJobOwner();\n\n // Variables\n\n /// @notice Maps the job to the owner of the job\n /// @param _job The address of the job\n /// @return _owner The address of the owner of the job\n function jobOwner(address _job) external view returns (address _owner);\n\n /// @notice Maps the job to its pending owner\n /// @param _job The address of the job\n /// @return _pendingOwner The address of the pending owner of the job\n function jobPendingOwner(address _job) external view returns (address _pendingOwner);\n\n // Methods\n\n /// @notice Proposes a new address to be the owner of the job\n /// @param _job The address of the job\n /// @param _newOwner The address of the proposed new owner\n function changeJobOwnership(address _job, address _newOwner) external;\n\n /// @notice The proposed address accepts to be the owner of the job\n /// @param _job The address of the job\n function acceptJobOwnership(address _job) external;\n}\n\n/// @title Keep3rJobManager contract\n/// @notice Handles the addition and withdrawal of credits from a job\ninterface IKeep3rJobManager is IKeep3rJobOwnership {\n // Events\n\n /// @notice Emitted when Keep3rJobManager#addJob is called\n /// @param _job The address of the job to add\n /// @param _jobOwner The job's owner\n event JobAddition(address indexed _job, address indexed _jobOwner);\n\n // Errors\n\n /// @notice Throws when trying to add a job that has already been added\n error JobAlreadyAdded();\n\n /// @notice Throws when the address that is trying to register as a keeper is already a keeper\n error AlreadyAKeeper();\n\n // Methods\n\n /// @notice Allows any caller to add a new job\n /// @param _job Address of the contract for which work should be performed\n function addJob(address _job) external;\n}\n\n/// @title Keep3rJobFundableCredits contract\n/// @notice Handles the addition and withdrawal of credits from a job\ninterface IKeep3rJobFundableCredits is IKeep3rJobOwnership {\n // Events\n\n /// @notice Emitted when Keep3rJobFundableCredits#addTokenCreditsToJob is called\n /// @param _job The address of the job being credited\n /// @param _token The address of the token being provided\n /// @param _provider The user that calls the function\n /// @param _amount The amount of credit being added to the job\n event TokenCreditAddition(address indexed _job, address indexed _token, address indexed _provider, uint256 _amount);\n\n /// @notice Emitted when Keep3rJobFundableCredits#withdrawTokenCreditsFromJob is called\n /// @param _job The address of the job from which the credits are withdrawn\n /// @param _token The credit being withdrawn from the job\n /// @param _receiver The user that receives the tokens\n /// @param _amount The amount of credit withdrawn\n event TokenCreditWithdrawal(address indexed _job, address indexed _token, address indexed _receiver, uint256 _amount);\n\n // Errors\n\n /// @notice Throws when the token is KP3R, as it should not be used for direct token payments\n error TokenUnallowed();\n\n /// @notice Throws when the token withdraw cooldown has not yet passed\n error JobTokenCreditsLocked();\n\n /// @notice Throws when the user tries to withdraw more tokens than it has\n error InsufficientJobTokenCredits();\n\n // Variables\n\n /// @notice Last block where tokens were added to the job\n /// @param _job The address of the job credited\n /// @param _token The address of the token credited\n /// @return _timestamp The last block where tokens were added to the job\n function jobTokenCreditsAddedAt(address _job, address _token) external view returns (uint256 _timestamp);\n\n // Methods\n\n /// @notice Add credit to a job to be paid out for work\n /// @param _job The address of the job being credited\n /// @param _token The address of the token being credited\n /// @param _amount The amount of credit being added\n function addTokenCreditsToJob(\n address _job,\n address _token,\n uint256 _amount\n ) external;\n\n /// @notice Withdraw credit from a job\n /// @param _job The address of the job from which the credits are withdrawn\n /// @param _token The address of the token being withdrawn\n /// @param _amount The amount of token to be withdrawn\n /// @param _receiver The user that will receive tokens\n function withdrawTokenCreditsFromJob(\n address _job,\n address _token,\n uint256 _amount,\n address _receiver\n ) external;\n}\n\n/// @title Keep3rJobFundableLiquidity contract\n/// @notice Handles the funding of jobs through specific liquidity pairs\ninterface IKeep3rJobFundableLiquidity is IKeep3rJobOwnership {\n // Events\n\n /// @notice Emitted when Keep3rJobFundableLiquidity#approveLiquidity function is called\n /// @param _liquidity The address of the liquidity pair being approved\n event LiquidityApproval(address _liquidity);\n\n /// @notice Emitted when Keep3rJobFundableLiquidity#revokeLiquidity function is called\n /// @param _liquidity The address of the liquidity pair being revoked\n event LiquidityRevocation(address _liquidity);\n\n /// @notice Emitted when IKeep3rJobFundableLiquidity#addLiquidityToJob function is called\n /// @param _job The address of the job to which liquidity will be added\n /// @param _liquidity The address of the liquidity being added\n /// @param _provider The user that calls the function\n /// @param _amount The amount of liquidity being added\n event LiquidityAddition(address indexed _job, address indexed _liquidity, address indexed _provider, uint256 _amount);\n\n /// @notice Emitted when IKeep3rJobFundableLiquidity#withdrawLiquidityFromJob function is called\n /// @param _job The address of the job of which liquidity will be withdrawn from\n /// @param _liquidity The address of the liquidity being withdrawn\n /// @param _receiver The receiver of the liquidity tokens\n /// @param _amount The amount of liquidity being withdrawn from the job\n event LiquidityWithdrawal(address indexed _job, address indexed _liquidity, address indexed _receiver, uint256 _amount);\n\n /// @notice Emitted when Keep3rJobFundableLiquidity#addLiquidityToJob function is called\n /// @param _job The address of the job whose credits will be updated\n /// @param _rewardedAt The time at which the job was last rewarded\n /// @param _currentCredits The current credits of the job\n /// @param _periodCredits The credits of the job for the current period\n event LiquidityCreditsReward(address indexed _job, uint256 _rewardedAt, uint256 _currentCredits, uint256 _periodCredits);\n\n /// @notice Emitted when Keep3rJobFundableLiquidity#forceLiquidityCreditsToJob function is called\n /// @param _job The address of the job whose credits will be updated\n /// @param _rewardedAt The time at which the job was last rewarded\n /// @param _currentCredits The current credits of the job\n event LiquidityCreditsForced(address indexed _job, uint256 _rewardedAt, uint256 _currentCredits);\n\n // Errors\n\n /// @notice Throws when the liquidity being approved has already been approved\n error LiquidityPairApproved();\n\n /// @notice Throws when the liquidity being removed has not been approved\n error LiquidityPairUnexistent();\n\n /// @notice Throws when trying to add liquidity to an unapproved pool\n error LiquidityPairUnapproved();\n\n /// @notice Throws when the job doesn't have the requested liquidity\n error JobLiquidityUnexistent();\n\n /// @notice Throws when trying to remove more liquidity than the job has\n error JobLiquidityInsufficient();\n\n /// @notice Throws when trying to add less liquidity than the minimum liquidity required\n error JobLiquidityLessThanMin();\n\n // Structs\n\n /// @notice Stores the tick information of the different liquidity pairs\n struct TickCache {\n int56 current; // Tracks the current tick\n int56 difference; // Stores the difference between the current tick and the last tick\n uint256 period; // Stores the period at which the last observation was made\n }\n\n // Variables\n\n /// @notice Lists liquidity pairs\n /// @return _list An array of addresses with all the approved liquidity pairs\n function approvedLiquidities() external view returns (address[] memory _list);\n\n /// @notice Amount of liquidity in a specified job\n /// @param _job The address of the job being checked\n /// @param _liquidity The address of the liquidity we are checking\n /// @return _amount Amount of liquidity in the specified job\n function liquidityAmount(address _job, address _liquidity) external view returns (uint256 _amount);\n\n /// @notice Last time the job was rewarded liquidity credits\n /// @param _job The address of the job being checked\n /// @return _timestamp Timestamp of the last time the job was rewarded liquidity credits\n function rewardedAt(address _job) external view returns (uint256 _timestamp);\n\n /// @notice Last time the job was worked\n /// @param _job The address of the job being checked\n /// @return _timestamp Timestamp of the last time the job was worked\n function workedAt(address _job) external view returns (uint256 _timestamp);\n\n // Methods\n\n /// @notice Returns the liquidity credits of a given job\n /// @param _job The address of the job of which we want to know the liquidity credits\n /// @return _amount The liquidity credits of a given job\n function jobLiquidityCredits(address _job) external view returns (uint256 _amount);\n\n /// @notice Returns the credits of a given job for the current period\n /// @param _job The address of the job of which we want to know the period credits\n /// @return _amount The credits the given job has at the current period\n function jobPeriodCredits(address _job) external view returns (uint256 _amount);\n\n /// @notice Calculates the total credits of a given job\n /// @param _job The address of the job of which we want to know the total credits\n /// @return _amount The total credits of the given job\n function totalJobCredits(address _job) external view returns (uint256 _amount);\n\n /// @notice Calculates how many credits should be rewarded periodically for a given liquidity amount\n /// @dev _periodCredits = underlying KP3Rs for given liquidity amount * rewardPeriod / inflationPeriod\n /// @param _liquidity The address of the liquidity to provide\n /// @param _amount The amount of liquidity to provide\n /// @return _periodCredits The amount of KP3R periodically minted for the given liquidity\n function quoteLiquidity(address _liquidity, uint256 _amount) external view returns (uint256 _periodCredits);\n\n /// @notice Observes the current state of the liquidity pair being observed and updates TickCache with the information\n /// @param _liquidity The address of the liquidity pair being observed\n /// @return _tickCache The updated TickCache\n function observeLiquidity(address _liquidity) external view returns (TickCache memory _tickCache);\n\n /// @notice Gifts liquidity credits to the specified job\n /// @param _job The address of the job being credited\n /// @param _amount The amount of liquidity credits to gift\n function forceLiquidityCreditsToJob(address _job, uint256 _amount) external;\n\n /// @notice Approve a liquidity pair for being accepted in future\n /// @param _liquidity The address of the liquidity accepted\n function approveLiquidity(address _liquidity) external;\n\n /// @notice Revoke a liquidity pair from being accepted in future\n /// @param _liquidity The liquidity no longer accepted\n function revokeLiquidity(address _liquidity) external;\n\n /// @notice Allows anyone to fund a job with liquidity\n /// @param _job The address of the job to assign liquidity to\n /// @param _liquidity The liquidity being added\n /// @param _amount The amount of liquidity tokens to add\n function addLiquidityToJob(\n address _job,\n address _liquidity,\n uint256 _amount\n ) external;\n\n /// @notice Unbond liquidity for a job\n /// @dev Can only be called by the job's owner\n /// @param _job The address of the job being unbonded from\n /// @param _liquidity The liquidity being unbonded\n /// @param _amount The amount of liquidity being removed\n function unbondLiquidityFromJob(\n address _job,\n address _liquidity,\n uint256 _amount\n ) external;\n\n /// @notice Withdraw liquidity from a job\n /// @param _job The address of the job being withdrawn from\n /// @param _liquidity The liquidity being withdrawn\n /// @param _receiver The address that will receive the withdrawn liquidity\n function withdrawLiquidityFromJob(\n address _job,\n address _liquidity,\n address _receiver\n ) external;\n}\n\n/// @title Keep3rJobMigration contract\n/// @notice Handles the migration process of jobs to different addresses\ninterface IKeep3rJobMigration is IKeep3rJobFundableCredits, IKeep3rJobFundableLiquidity {\n // Events\n\n /// @notice Emitted when Keep3rJobMigration#migrateJob function is called\n /// @param _fromJob The address of the job that requests to migrate\n /// @param _toJob The address at which the job requests to migrate\n event JobMigrationRequested(address indexed _fromJob, address _toJob);\n\n /// @notice Emitted when Keep3rJobMigration#acceptJobMigration function is called\n /// @param _fromJob The address of the job that requested to migrate\n /// @param _toJob The address at which the job had requested to migrate\n event JobMigrationSuccessful(address _fromJob, address indexed _toJob);\n\n // Errors\n\n /// @notice Throws when the address of the job that requests to migrate wants to migrate to its same address\n error JobMigrationImpossible();\n\n /// @notice Throws when the _toJob address differs from the address being tracked in the pendingJobMigrations mapping\n error JobMigrationUnavailable();\n\n /// @notice Throws when cooldown between migrations has not yet passed\n error JobMigrationLocked();\n\n // Variables\n\n /// @notice Maps the jobs that have requested a migration to the address they have requested to migrate to\n /// @return _toJob The address to which the job has requested to migrate to\n function pendingJobMigrations(address _fromJob) external view returns (address _toJob);\n\n // Methods\n\n /// @notice Initializes the migration process for a job by adding the request to the pendingJobMigrations mapping\n /// @param _fromJob The address of the job that is requesting to migrate\n /// @param _toJob The address at which the job is requesting to migrate\n function migrateJob(address _fromJob, address _toJob) external;\n\n /// @notice Completes the migration process for a job\n /// @dev Unbond/withdraw process doesn't get migrated\n /// @param _fromJob The address of the job that requested to migrate\n /// @param _toJob The address to which the job wants to migrate to\n function acceptJobMigration(address _fromJob, address _toJob) external;\n}\n\n/// @title Keep3rJobWorkable contract\n/// @notice Handles the mechanisms jobs can pay keepers with along with the restrictions jobs can put on keepers before they can work on jobs\ninterface IKeep3rJobWorkable is IKeep3rJobMigration {\n // Events\n\n /// @notice Emitted when a keeper is validated before a job\n /// @param _gasLeft The amount of gas that the transaction has left at the moment of keeper validation\n event KeeperValidation(uint256 _gasLeft);\n\n /// @notice Emitted when a keeper works a job\n /// @param _credit The address of the asset in which the keeper is paid\n /// @param _job The address of the job the keeper has worked\n /// @param _keeper The address of the keeper that has worked the job\n /// @param _payment The amount that has been paid out to the keeper in exchange for working the job\n /// @param _gasLeft The amount of gas that the transaction has left at the moment of payment\n event KeeperWork(address indexed _credit, address indexed _job, address indexed _keeper, uint256 _payment, uint256 _gasLeft);\n\n // Errors\n\n /// @notice Throws if work method was called without calling isKeeper or isBondedKeeper\n error GasNotInitialized();\n\n /// @notice Throws if the address claiming to be a job is not in the list of approved jobs\n error JobUnapproved();\n\n /// @notice Throws if the amount of funds in the job is less than the payment that must be paid to the keeper that works that job\n error InsufficientFunds();\n\n // Methods\n\n /// @notice Confirms if the current keeper is registered\n /// @dev Can be used for general (non critical) functions\n /// @param _keeper The keeper being investigated\n /// @return _isKeeper Whether the address passed as a parameter is a keeper or not\n function isKeeper(address _keeper) external returns (bool _isKeeper);\n\n /// @notice Confirms if the current keeper is registered and has a minimum bond of any asset.\n /// @dev Should be used for protected functions\n /// @param _keeper The keeper to check\n /// @param _bond The bond token being evaluated\n /// @param _minBond The minimum amount of bonded tokens\n /// @param _earned The minimum funds earned in the keepers lifetime\n /// @param _age The minimum keeper age required\n /// @return _isBondedKeeper Whether the `_keeper` meets the given requirements\n function isBondedKeeper(\n address _keeper,\n address _bond,\n uint256 _minBond,\n uint256 _earned,\n uint256 _age\n ) external returns (bool _isBondedKeeper);\n\n /// @notice Implemented by jobs to show that a keeper performed work\n /// @dev Automatically calculates the payment for the keeper and pays the keeper with bonded KP3R\n /// @param _keeper Address of the keeper that performed the work\n function worked(address _keeper) external;\n\n /// @notice Implemented by jobs to show that a keeper performed work\n /// @dev Pays the keeper that performs the work with KP3R\n /// @param _keeper Address of the keeper that performed the work\n /// @param _payment The reward that should be allocated for the job\n function bondedPayment(address _keeper, uint256 _payment) external;\n\n /// @notice Implemented by jobs to show that a keeper performed work\n /// @dev Pays the keeper that performs the work with a specific token\n /// @param _token The asset being awarded to the keeper\n /// @param _keeper Address of the keeper that performed the work\n /// @param _amount The reward that should be allocated\n function directTokenPayment(\n address _token,\n address _keeper,\n uint256 _amount\n ) external;\n}\n\n/// @title Keep3rJobDisputable contract\n/// @notice Handles the actions that can be taken on a disputed job\ninterface IKeep3rJobDisputable is IKeep3rDisputable, IKeep3rJobFundableCredits, IKeep3rJobFundableLiquidity {\n // Events\n\n /// @notice Emitted when Keep3rJobDisputable#slashTokenFromJob is called\n /// @param _job The address of the job from which the token will be slashed\n /// @param _token The address of the token being slashed\n /// @param _slasher The user that slashes the token\n /// @param _amount The amount of the token being slashed\n event JobSlashToken(address indexed _job, address _token, address indexed _slasher, uint256 _amount);\n\n /// @notice Emitted when Keep3rJobDisputable#slashLiquidityFromJob is called\n /// @param _job The address of the job from which the liquidity will be slashed\n /// @param _liquidity The address of the liquidity being slashed\n /// @param _slasher The user that slashes the liquidity\n /// @param _amount The amount of the liquidity being slashed\n event JobSlashLiquidity(address indexed _job, address _liquidity, address indexed _slasher, uint256 _amount);\n\n // Errors\n\n /// @notice Throws when the token trying to be slashed doesn't exist\n error JobTokenUnexistent();\n\n /// @notice Throws when someone tries to slash more tokens than the job has\n error JobTokenInsufficient();\n\n // Methods\n\n /// @notice Allows governance or slasher to slash a job specific token\n /// @param _job The address of the job from which the token will be slashed\n /// @param _token The address of the token that will be slashed\n /// @param _amount The amount of the token that will be slashed\n function slashTokenFromJob(\n address _job,\n address _token,\n uint256 _amount\n ) external;\n\n /// @notice Allows governance or a slasher to slash liquidity from a job\n /// @param _job The address being slashed\n /// @param _liquidity The address of the liquidity that will be slashed\n /// @param _amount The amount of liquidity that will be slashed\n function slashLiquidityFromJob(\n address _job,\n address _liquidity,\n uint256 _amount\n ) external;\n}\n\n// solhint-disable-next-line no-empty-blocks\ninterface IKeep3rJobs is IKeep3rJobWorkable, IKeep3rJobManager, IKeep3rJobDisputable {\n\n}\n" - }, - "solidity/interfaces/peripherals/IKeep3rKeepers.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport './IKeep3rDisputable.sol';\n\n/// @title Keep3rKeeperFundable contract\n/// @notice Handles the actions required to become a keeper\ninterface IKeep3rKeeperFundable {\n // Events\n\n /// @notice Emitted when Keep3rKeeperFundable#activate is called\n /// @param _keeper The keeper that has been activated\n /// @param _bond The asset the keeper has bonded\n /// @param _amount The amount of the asset the keeper has bonded\n event Activation(address indexed _keeper, address indexed _bond, uint256 _amount);\n\n /// @notice Emitted when Keep3rKeeperFundable#withdraw is called\n /// @param _keeper The caller of Keep3rKeeperFundable#withdraw function\n /// @param _bond The asset to withdraw from the bonding pool\n /// @param _amount The amount of funds withdrawn\n event Withdrawal(address indexed _keeper, address indexed _bond, uint256 _amount);\n\n // Errors\n\n /// @notice Throws when the address that is trying to register as a job is already a job\n error AlreadyAJob();\n\n // Methods\n\n /// @notice Beginning of the bonding process\n /// @param _bonding The asset being bonded\n /// @param _amount The amount of bonding asset being bonded\n function bond(address _bonding, uint256 _amount) external;\n\n /// @notice Beginning of the unbonding process\n /// @param _bonding The asset being unbonded\n /// @param _amount Allows for partial unbonding\n function unbond(address _bonding, uint256 _amount) external;\n\n /// @notice End of the bonding process after bonding time has passed\n /// @param _bonding The asset being activated as bond collateral\n function activate(address _bonding) external;\n\n /// @notice Withdraw funds after unbonding has finished\n /// @param _bonding The asset to withdraw from the bonding pool\n function withdraw(address _bonding) external;\n}\n\n/// @title Keep3rKeeperDisputable contract\n/// @notice Handles the actions that can be taken on a disputed keeper\ninterface IKeep3rKeeperDisputable is IKeep3rDisputable, IKeep3rKeeperFundable {\n // Events\n\n /// @notice Emitted when Keep3rKeeperDisputable#slash is called\n /// @param _keeper The address of the slashed keeper\n /// @param _slasher The user that called Keep3rKeeperDisputable#slash\n /// @param _amount The amount of credits slashed from the keeper\n event KeeperSlash(address indexed _keeper, address indexed _slasher, uint256 _amount);\n\n /// @notice Emitted when Keep3rKeeperDisputable#revoke is called\n /// @param _keeper The address of the revoked keeper\n /// @param _slasher The user that called Keep3rKeeperDisputable#revoke\n event KeeperRevoke(address indexed _keeper, address indexed _slasher);\n\n // Methods\n\n /// @notice Allows governance to slash a keeper based on a dispute\n /// @param _keeper The address being slashed\n /// @param _bonded The asset being slashed\n /// @param _bondAmount The bonded amount being slashed\n /// @param _unbondAmount The pending unbond amount being slashed\n function slash(\n address _keeper,\n address _bonded,\n uint256 _bondAmount,\n uint256 _unbondAmount\n ) external;\n\n /// @notice Blacklists a keeper from participating in the network\n /// @param _keeper The address being slashed\n function revoke(address _keeper) external;\n}\n\n// solhint-disable-next-line no-empty-blocks\n\n/// @title Keep3rKeepers contract\ninterface IKeep3rKeepers is IKeep3rKeeperDisputable {\n\n}\n" - }, - "solidity/interfaces/peripherals/IKeep3rParameters.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport './IKeep3rAccountance.sol';\n\n/// @title Keep3rParameters contract\n/// @notice Handles and sets all the required parameters for Keep3r\ninterface IKeep3rParameters is IKeep3rAccountance {\n // Events\n\n /// @notice Emitted when the Keep3rHelper address is changed\n /// @param _keep3rHelper The address of Keep3rHelper's contract\n event Keep3rHelperChange(address _keep3rHelper);\n\n /// @notice Emitted when the Keep3rV1 address is changed\n /// @param _keep3rV1 The address of Keep3rV1's contract\n event Keep3rV1Change(address _keep3rV1);\n\n /// @notice Emitted when the Keep3rV1Proxy address is changed\n /// @param _keep3rV1Proxy The address of Keep3rV1Proxy's contract\n event Keep3rV1ProxyChange(address _keep3rV1Proxy);\n\n /// @notice Emitted when bondTime is changed\n /// @param _bondTime The new bondTime\n event BondTimeChange(uint256 _bondTime);\n\n /// @notice Emitted when _liquidityMinimum is changed\n /// @param _liquidityMinimum The new _liquidityMinimum\n event LiquidityMinimumChange(uint256 _liquidityMinimum);\n\n /// @notice Emitted when _unbondTime is changed\n /// @param _unbondTime The new _unbondTime\n event UnbondTimeChange(uint256 _unbondTime);\n\n /// @notice Emitted when _rewardPeriodTime is changed\n /// @param _rewardPeriodTime The new _rewardPeriodTime\n event RewardPeriodTimeChange(uint256 _rewardPeriodTime);\n\n /// @notice Emitted when the inflationPeriod is changed\n /// @param _inflationPeriod The new inflationPeriod\n event InflationPeriodChange(uint256 _inflationPeriod);\n\n /// @notice Emitted when the fee is changed\n /// @param _fee The new token credits fee\n event FeeChange(uint256 _fee);\n\n // Variables\n\n /// @notice Address of Keep3rHelper's contract\n /// @return _keep3rHelper The address of Keep3rHelper's contract\n function keep3rHelper() external view returns (address _keep3rHelper);\n\n /// @notice Address of Keep3rV1's contract\n /// @return _keep3rV1 The address of Keep3rV1's contract\n function keep3rV1() external view returns (address _keep3rV1);\n\n /// @notice Address of Keep3rV1Proxy's contract\n /// @return _keep3rV1Proxy The address of Keep3rV1Proxy's contract\n function keep3rV1Proxy() external view returns (address _keep3rV1Proxy);\n\n /// @notice The amount of time required to pass after a keeper has bonded assets for it to be able to activate\n /// @return _days The required bondTime in days\n function bondTime() external view returns (uint256 _days);\n\n /// @notice The amount of time required to pass before a keeper can unbond what he has bonded\n /// @return _days The required unbondTime in days\n function unbondTime() external view returns (uint256 _days);\n\n /// @notice The minimum amount of liquidity required to fund a job per liquidity\n /// @return _amount The minimum amount of liquidity in KP3R\n function liquidityMinimum() external view returns (uint256 _amount);\n\n /// @notice The amount of time between each scheduled credits reward given to a job\n /// @return _days The reward period in days\n function rewardPeriodTime() external view returns (uint256 _days);\n\n /// @notice The inflation period is the denominator used to regulate the emission of KP3R\n /// @return _period The denominator used to regulate the emission of KP3R\n function inflationPeriod() external view returns (uint256 _period);\n\n /// @notice The fee to be sent to governance when a user adds liquidity to a job\n /// @return _amount The fee amount to be sent to governance when a user adds liquidity to a job\n function fee() external view returns (uint256 _amount);\n\n // Errors\n\n /// @notice Throws if the reward period is less than the minimum reward period time\n error MinRewardPeriod();\n\n /// @notice Throws if either a job or a keeper is disputed\n error Disputed();\n\n /// @notice Throws if there are no bonded assets\n error BondsUnexistent();\n\n /// @notice Throws if the time required to bond an asset has not passed yet\n error BondsLocked();\n\n /// @notice Throws if there are no bonds to withdraw\n error UnbondsUnexistent();\n\n /// @notice Throws if the time required to withdraw the bonds has not passed yet\n error UnbondsLocked();\n\n // Methods\n\n /// @notice Sets the Keep3rHelper address\n /// @param _keep3rHelper The Keep3rHelper address\n function setKeep3rHelper(address _keep3rHelper) external;\n\n /// @notice Sets the Keep3rV1 address\n /// @param _keep3rV1 The Keep3rV1 address\n function setKeep3rV1(address _keep3rV1) external;\n\n /// @notice Sets the Keep3rV1Proxy address\n /// @param _keep3rV1Proxy The Keep3rV1Proxy address\n function setKeep3rV1Proxy(address _keep3rV1Proxy) external;\n\n /// @notice Sets the bond time required to activate as a keeper\n /// @param _bond The new bond time\n function setBondTime(uint256 _bond) external;\n\n /// @notice Sets the unbond time required unbond what has been bonded\n /// @param _unbond The new unbond time\n function setUnbondTime(uint256 _unbond) external;\n\n /// @notice Sets the minimum amount of liquidity required to fund a job\n /// @param _liquidityMinimum The new minimum amount of liquidity\n function setLiquidityMinimum(uint256 _liquidityMinimum) external;\n\n /// @notice Sets the time required to pass between rewards for jobs\n /// @param _rewardPeriodTime The new amount of time required to pass between rewards\n function setRewardPeriodTime(uint256 _rewardPeriodTime) external;\n\n /// @notice Sets the new inflation period\n /// @param _inflationPeriod The new inflation period\n function setInflationPeriod(uint256 _inflationPeriod) external;\n\n /// @notice Sets the new fee\n /// @param _fee The new fee\n function setFee(uint256 _fee) external;\n}\n" - }, - "solidity/interfaces/peripherals/IKeep3rDisputable.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\n/// @title Keep3rDisputable contract\n/// @notice Creates/resolves disputes for jobs or keepers\n/// A disputed keeper is slashable and is not able to bond, activate, withdraw or receive direct payments\n/// A disputed job is slashable and is not able to pay the keepers, withdraw tokens or to migrate\ninterface IKeep3rDisputable {\n /// @notice Emitted when a keeper or a job is disputed\n /// @param _jobOrKeeper The address of the disputed keeper/job\n /// @param _disputer The user that called the function and disputed the keeper\n event Dispute(address indexed _jobOrKeeper, address indexed _disputer);\n\n /// @notice Emitted when a dispute is resolved\n /// @param _jobOrKeeper The address of the disputed keeper/job\n /// @param _resolver The user that called the function and resolved the dispute\n event Resolve(address indexed _jobOrKeeper, address indexed _resolver);\n\n /// @notice Throws when a job or keeper is already disputed\n error AlreadyDisputed();\n\n /// @notice Throws when a job or keeper is not disputed and someone tries to resolve the dispute\n error NotDisputed();\n\n /// @notice Allows governance to create a dispute for a given keeper/job\n /// @param _jobOrKeeper The address in dispute\n function dispute(address _jobOrKeeper) external;\n\n /// @notice Allows governance to resolve a dispute on a keeper/job\n /// @param _jobOrKeeper The address cleared\n function resolve(address _jobOrKeeper) external;\n}\n" - }, - "solidity/interfaces/peripherals/IKeep3rAccountance.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport './IKeep3rRoles.sol';\n\n/// @title Keep3rDisputable contract\n/// @notice Disputes keepers, or if they're already disputed, it can resolve the case\n/// @dev Argument `bonding` can be the address of either a token or a liquidity\ninterface IKeep3rAccountance is IKeep3rRoles {\n // Events\n\n /// @notice Emitted when the bonding process of a new keeper begins\n /// @param _keeper The caller of Keep3rKeeperFundable#bond function\n /// @param _bonding The asset the keeper has bonded\n /// @param _amount The amount the keeper has bonded\n event Bonding(address indexed _keeper, address indexed _bonding, uint256 _amount);\n\n /// @notice Emitted when a keeper or job begins the unbonding process to withdraw the funds\n /// @param _keeperOrJob The keeper or job that began the unbonding process\n /// @param _unbonding The liquidity pair or asset being unbonded\n /// @param _amount The amount being unbonded\n event Unbonding(address indexed _keeperOrJob, address indexed _unbonding, uint256 _amount);\n\n // Variables\n\n /// @notice Tracks the total KP3R earnings of a keeper since it started working\n /// @param _keeper The address of the keeper\n /// @return _workCompleted Total KP3R earnings of a keeper since it started working\n function workCompleted(address _keeper) external view returns (uint256 _workCompleted);\n\n /// @notice Tracks when a keeper was first registered\n /// @param _keeper The address of the keeper\n /// @return timestamp The time at which the keeper was first registered\n function firstSeen(address _keeper) external view returns (uint256 timestamp);\n\n /// @notice Tracks if a keeper or job has a pending dispute\n /// @param _keeperOrJob The address of the keeper or job\n /// @return _disputed Whether a keeper or job has a pending dispute\n function disputes(address _keeperOrJob) external view returns (bool _disputed);\n\n /// @notice Tracks how much a keeper has bonded of a certain token\n /// @param _keeper The address of the keeper\n /// @param _bond The address of the token being bonded\n /// @return _bonds Amount of a certain token that a keeper has bonded\n function bonds(address _keeper, address _bond) external view returns (uint256 _bonds);\n\n /// @notice The current token credits available for a job\n /// @param _job The address of the job\n /// @param _token The address of the token bonded\n /// @return _amount The amount of token credits available for a job\n function jobTokenCredits(address _job, address _token) external view returns (uint256 _amount);\n\n /// @notice Tracks the amount of assets deposited in pending bonds\n /// @param _keeper The address of the keeper\n /// @param _bonding The address of the token being bonded\n /// @return _pendingBonds Amount of a certain asset a keeper has unbonding\n function pendingBonds(address _keeper, address _bonding) external view returns (uint256 _pendingBonds);\n\n /// @notice Tracks when a bonding for a keeper can be activated\n /// @param _keeper The address of the keeper\n /// @param _bonding The address of the token being bonded\n /// @return _timestamp Time at which the bonding for a keeper can be activated\n function canActivateAfter(address _keeper, address _bonding) external view returns (uint256 _timestamp);\n\n /// @notice Tracks when keeper bonds are ready to be withdrawn\n /// @param _keeper The address of the keeper\n /// @param _bonding The address of the token being unbonded\n /// @return _timestamp Time at which the keeper bonds are ready to be withdrawn\n function canWithdrawAfter(address _keeper, address _bonding) external view returns (uint256 _timestamp);\n\n /// @notice Tracks how much keeper bonds are to be withdrawn\n /// @param _keeper The address of the keeper\n /// @param _bonding The address of the token being unbonded\n /// @return _pendingUnbonds The amount of keeper bonds that are to be withdrawn\n function pendingUnbonds(address _keeper, address _bonding) external view returns (uint256 _pendingUnbonds);\n\n /// @notice Checks whether the address has ever bonded an asset\n /// @param _keeper The address of the keeper\n /// @return _hasBonded Whether the address has ever bonded an asset\n function hasBonded(address _keeper) external view returns (bool _hasBonded);\n\n // Methods\n\n /// @notice Lists all jobs\n /// @return _jobList Array with all the jobs in _jobs\n function jobs() external view returns (address[] memory _jobList);\n\n /// @notice Lists all keepers\n /// @return _keeperList Array with all the keepers in _keepers\n function keepers() external view returns (address[] memory _keeperList);\n\n // Errors\n\n /// @notice Throws when an address is passed as a job, but that address is not a job\n error JobUnavailable();\n\n /// @notice Throws when an action that requires an undisputed job is applied on a disputed job\n error JobDisputed();\n}\n" - }, - "solidity/interfaces/peripherals/IKeep3rRoles.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport './IBaseErrors.sol';\nimport './IGovernable.sol';\nimport './IDustCollector.sol';\n\n/// @title Keep3rRoles contract\n/// @notice Manages the Keep3r specific roles\ninterface IKeep3rRoles is IBaseErrors, IDustCollector, IGovernable {\n // Events\n\n /// @notice Emitted when a slasher is added\n /// @param _slasher Address of the added slasher\n event SlasherAdded(address _slasher);\n\n /// @notice Emitted when a slasher is removed\n /// @param _slasher Address of the removed slasher\n event SlasherRemoved(address _slasher);\n\n /// @notice Emitted when a disputer is added\n /// @param _disputer Address of the added disputer\n event DisputerAdded(address _disputer);\n\n /// @notice Emitted when a disputer is removed\n /// @param _disputer Address of the removed disputer\n event DisputerRemoved(address _disputer);\n\n // Variables\n\n /// @notice Tracks whether the address is a slasher or not\n /// @param _slasher Address being checked as a slasher\n /// @return _isSlasher Whether the address is a slasher or not\n function slashers(address _slasher) external view returns (bool _isSlasher);\n\n /// @notice Tracks whether the address is a disputer or not\n /// @param _disputer Address being checked as a disputer\n /// @return _isDisputer Whether the address is a disputer or not\n function disputers(address _disputer) external view returns (bool _isDisputer);\n\n // Errors\n\n /// @notice Throws if the address is already a registered slasher\n error SlasherExistent();\n\n /// @notice Throws if caller is not a registered slasher\n error SlasherUnexistent();\n\n /// @notice Throws if the address is already a registered disputer\n error DisputerExistent();\n\n /// @notice Throws if caller is not a registered disputer\n error DisputerUnexistent();\n\n /// @notice Throws if the msg.sender is not a slasher or is not a part of governance\n error OnlySlasher();\n\n /// @notice Throws if the msg.sender is not a disputer or is not a part of governance\n error OnlyDisputer();\n\n // Methods\n\n /// @notice Registers a slasher by updating the slashers mapping\n function addSlasher(address _slasher) external;\n\n /// @notice Removes a slasher by updating the slashers mapping\n function removeSlasher(address _slasher) external;\n\n /// @notice Registers a disputer by updating the disputers mapping\n function addDisputer(address _disputer) external;\n\n /// @notice Removes a disputer by updating the disputers mapping\n function removeDisputer(address _disputer) external;\n}\n" - }, - "solidity/interfaces/peripherals/IBaseErrors.sol": { - "content": "// SPDX-License-Identifier: MIT\n\npragma solidity >=0.8.4 <0.9.0;\n\ninterface IBaseErrors {\n /// @notice Throws if a variable is assigned to the zero address\n error ZeroAddress();\n}\n" - }, - "solidity/interfaces/peripherals/IGovernable.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\n/// @title Governable contract\n/// @notice Manages the governance role\ninterface IGovernable {\n // Events\n\n /// @notice Emitted when pendingGovernance accepts to be governance\n /// @param _governance Address of the new governance\n event GovernanceSet(address _governance);\n\n /// @notice Emitted when a new governance is proposed\n /// @param _pendingGovernance Address that is proposed to be the new governance\n event GovernanceProposal(address _pendingGovernance);\n\n // Errors\n\n /// @notice Throws if the caller of the function is not governance\n error OnlyGovernance();\n\n /// @notice Throws if the caller of the function is not pendingGovernance\n error OnlyPendingGovernance();\n\n /// @notice Throws if trying to set governance to zero address\n error NoGovernanceZeroAddress();\n\n // Variables\n\n /// @notice Stores the governance address\n /// @return _governance The governance addresss\n function governance() external view returns (address _governance);\n\n /// @notice Stores the pendingGovernance address\n /// @return _pendingGovernance The pendingGovernance addresss\n function pendingGovernance() external view returns (address _pendingGovernance);\n\n // Methods\n\n /// @notice Proposes a new address to be governance\n /// @param _governance The address being proposed as the new governance\n function setGovernance(address _governance) external;\n\n /// @notice Changes the governance from the current governance to the previously proposed address\n function acceptGovernance() external;\n}\n" - }, - "solidity/interfaces/peripherals/IDustCollector.sol": { - "content": "// SPDX-License-Identifier: MIT\n\npragma solidity >=0.8.4 <0.9.0;\n\nimport './IBaseErrors.sol';\n\ninterface IDustCollector is IBaseErrors {\n /// @notice Emitted when dust is sent\n /// @param _token The token that will be transferred\n /// @param _amount The amount of the token that will be transferred\n /// @param _to The address which will receive the funds\n event DustSent(address _token, uint256 _amount, address _to);\n\n /// @notice Allows an authorized user to transfer the tokens or eth that may have been left in a contract\n /// @param _token The token that will be transferred\n /// @param _amount The amount of the token that will be transferred\n /// @param _to The address that will receive the idle funds\n function sendDust(\n address _token,\n uint256 _amount,\n address _to\n ) external;\n}\n" - }, - "solidity/contracts/peripherals/jobs/Keep3rJobManager.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport './Keep3rJobOwnership.sol';\nimport '../Keep3rAccountance.sol';\nimport '../../../interfaces/peripherals/IKeep3rJobs.sol';\n\nabstract contract Keep3rJobManager is IKeep3rJobManager, Keep3rJobOwnership, Keep3rAccountance {\n using EnumerableSet for EnumerableSet.AddressSet;\n\n /// @inheritdoc IKeep3rJobManager\n function addJob(address _job) external override {\n if (_jobs.contains(_job)) revert JobAlreadyAdded();\n if (hasBonded[_job]) revert AlreadyAKeeper();\n _jobs.add(_job);\n jobOwner[_job] = msg.sender;\n emit JobAddition(_job, msg.sender);\n }\n}\n" - }, - "solidity/contracts/peripherals/jobs/Keep3rJobWorkable.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport './Keep3rJobMigration.sol';\nimport '../../../interfaces/IKeep3rHelper.sol';\nimport '../../../interfaces/peripherals/IKeep3rJobs.sol';\n\nimport '@openzeppelin/contracts/token/ERC20/IERC20.sol';\nimport '@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol';\n\nabstract contract Keep3rJobWorkable is IKeep3rJobWorkable, Keep3rJobMigration {\n using EnumerableSet for EnumerableSet.AddressSet;\n using SafeERC20 for IERC20;\n\n uint256 internal _initialGas;\n\n /// @inheritdoc IKeep3rJobWorkable\n function isKeeper(address _keeper) external override returns (bool _isKeeper) {\n _initialGas = _getGasLeft();\n if (_keepers.contains(_keeper)) {\n emit KeeperValidation(_initialGas);\n return true;\n }\n }\n\n /// @inheritdoc IKeep3rJobWorkable\n function isBondedKeeper(\n address _keeper,\n address _bond,\n uint256 _minBond,\n uint256 _earned,\n uint256 _age\n ) external override returns (bool _isBondedKeeper) {\n _initialGas = _getGasLeft();\n if (\n _keepers.contains(_keeper) &&\n bonds[_keeper][_bond] >= _minBond &&\n workCompleted[_keeper] >= _earned &&\n block.timestamp - firstSeen[_keeper] >= _age\n ) {\n emit KeeperValidation(_initialGas);\n return true;\n }\n }\n\n /// @inheritdoc IKeep3rJobWorkable\n function worked(address _keeper) external virtual override {\n if (_initialGas == 0) revert GasNotInitialized();\n address _job = msg.sender;\n if (disputes[_job]) revert JobDisputed();\n if (!_jobs.contains(_job)) revert JobUnapproved();\n\n if (_updateJobCreditsIfNeeded(_job)) {\n emit LiquidityCreditsReward(_job, rewardedAt[_job], _jobLiquidityCredits[_job], _jobPeriodCredits[_job]);\n }\n\n (uint256 _boost, uint256 _oneEthQuote, uint256 _extraGas) = IKeep3rHelper(keep3rHelper).getPaymentParams(bonds[_keeper][keep3rV1]);\n\n uint256 _gasLeft = _getGasLeft();\n uint256 _payment = _calculatePayment(_gasLeft, _extraGas, _oneEthQuote, _boost);\n\n if (_payment > _jobLiquidityCredits[_job]) {\n _rewardJobCredits(_job);\n emit LiquidityCreditsReward(_job, rewardedAt[_job], _jobLiquidityCredits[_job], _jobPeriodCredits[_job]);\n\n _gasLeft = _getGasLeft();\n _payment = _calculatePayment(_gasLeft, _extraGas, _oneEthQuote, _boost);\n }\n\n _bondedPayment(_job, _keeper, _payment);\n delete _initialGas;\n\n emit KeeperWork(keep3rV1, _job, _keeper, _payment, _gasLeft);\n }\n\n /// @inheritdoc IKeep3rJobWorkable\n function bondedPayment(address _keeper, uint256 _payment) external override {\n address _job = msg.sender;\n\n if (disputes[_job]) revert JobDisputed();\n if (!_jobs.contains(_job)) revert JobUnapproved();\n\n if (_updateJobCreditsIfNeeded(_job)) {\n emit LiquidityCreditsReward(_job, rewardedAt[_job], _jobLiquidityCredits[_job], _jobPeriodCredits[_job]);\n }\n\n if (_payment > _jobLiquidityCredits[_job]) {\n _rewardJobCredits(_job);\n emit LiquidityCreditsReward(_job, rewardedAt[_job], _jobLiquidityCredits[_job], _jobPeriodCredits[_job]);\n }\n\n _bondedPayment(_job, _keeper, _payment);\n emit KeeperWork(keep3rV1, _job, _keeper, _payment, _getGasLeft());\n }\n\n /// @inheritdoc IKeep3rJobWorkable\n function directTokenPayment(\n address _token,\n address _keeper,\n uint256 _amount\n ) external override {\n address _job = msg.sender;\n\n if (disputes[_job]) revert JobDisputed();\n if (disputes[_keeper]) revert Disputed();\n if (!_jobs.contains(_job)) revert JobUnapproved();\n if (jobTokenCredits[_job][_token] < _amount) revert InsufficientFunds();\n jobTokenCredits[_job][_token] -= _amount;\n IERC20(_token).safeTransfer(_keeper, _amount);\n emit KeeperWork(_token, _job, _keeper, _amount, _getGasLeft());\n }\n\n function _bondedPayment(\n address _job,\n address _keeper,\n uint256 _payment\n ) internal {\n if (_payment > _jobLiquidityCredits[_job]) revert InsufficientFunds();\n\n workedAt[_job] = block.timestamp;\n _jobLiquidityCredits[_job] -= _payment;\n bonds[_keeper][keep3rV1] += _payment;\n workCompleted[_keeper] += _payment;\n }\n\n /// @notice Calculate amount to be payed in KP3R, taking into account multiple parameters\n /// @param _gasLeft Amount of gas left after working the job\n /// @param _extraGas Amount of expected unaccounted gas\n /// @param _oneEthQuote Amount of KP3R equivalent to 1 ETH\n /// @param _boost Reward given to the keeper for having bonded KP3R tokens\n /// @return _payment Amount to be payed in KP3R tokens\n function _calculatePayment(\n uint256 _gasLeft,\n uint256 _extraGas,\n uint256 _oneEthQuote,\n uint256 _boost\n ) internal view returns (uint256 _payment) {\n uint256 _accountedGas = _initialGas - _gasLeft + _extraGas;\n _payment = (((_accountedGas * _boost) / _BASE) * _oneEthQuote) / 1 ether;\n }\n\n /// @notice Return the gas left and add 1/64 in order to match real gas left at first level of depth (EIP-150)\n /// @return _gasLeft Amount of gas left recording taking into account EIP-150\n function _getGasLeft() internal view returns (uint256 _gasLeft) {\n _gasLeft = (gasleft() * 64) / 63;\n }\n}\n" - }, - "solidity/contracts/peripherals/jobs/Keep3rJobDisputable.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport './Keep3rJobFundableCredits.sol';\nimport './Keep3rJobFundableLiquidity.sol';\nimport '../Keep3rDisputable.sol';\n\nabstract contract Keep3rJobDisputable is IKeep3rJobDisputable, Keep3rDisputable, Keep3rJobFundableCredits, Keep3rJobFundableLiquidity {\n using EnumerableSet for EnumerableSet.AddressSet;\n using SafeERC20 for IERC20;\n\n /// @inheritdoc IKeep3rJobDisputable\n function slashTokenFromJob(\n address _job,\n address _token,\n uint256 _amount\n ) external override onlySlasher {\n if (!disputes[_job]) revert NotDisputed();\n if (!_jobTokens[_job].contains(_token)) revert JobTokenUnexistent();\n if (jobTokenCredits[_job][_token] < _amount) revert JobTokenInsufficient();\n\n try IERC20(_token).transfer(governance, _amount) {} catch {}\n jobTokenCredits[_job][_token] -= _amount;\n if (jobTokenCredits[_job][_token] == 0) {\n _jobTokens[_job].remove(_token);\n }\n\n emit JobSlashToken(_job, _token, msg.sender, _amount);\n }\n\n /// @inheritdoc IKeep3rJobDisputable\n function slashLiquidityFromJob(\n address _job,\n address _liquidity,\n uint256 _amount\n ) external override onlySlasher {\n if (!disputes[_job]) revert NotDisputed();\n\n _unbondLiquidityFromJob(_job, _liquidity, _amount);\n try IERC20(_liquidity).transfer(governance, _amount) {} catch {}\n emit JobSlashLiquidity(_job, _liquidity, msg.sender, _amount);\n }\n}\n" - }, - "solidity/contracts/peripherals/jobs/Keep3rJobOwnership.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../../../interfaces/peripherals/IKeep3rJobs.sol';\n\nabstract contract Keep3rJobOwnership is IKeep3rJobOwnership {\n /// @inheritdoc IKeep3rJobOwnership\n mapping(address => address) public override jobOwner;\n\n /// @inheritdoc IKeep3rJobOwnership\n mapping(address => address) public override jobPendingOwner;\n\n /// @inheritdoc IKeep3rJobOwnership\n function changeJobOwnership(address _job, address _newOwner) external override onlyJobOwner(_job) {\n jobPendingOwner[_job] = _newOwner;\n emit JobOwnershipChange(_job, jobOwner[_job], _newOwner);\n }\n\n /// @inheritdoc IKeep3rJobOwnership\n function acceptJobOwnership(address _job) external override onlyPendingJobOwner(_job) {\n address _previousOwner = jobOwner[_job];\n\n jobOwner[_job] = jobPendingOwner[_job];\n delete jobPendingOwner[_job];\n\n emit JobOwnershipAssent(msg.sender, _job, _previousOwner);\n }\n\n modifier onlyJobOwner(address _job) {\n if (msg.sender != jobOwner[_job]) revert OnlyJobOwner();\n _;\n }\n\n modifier onlyPendingJobOwner(address _job) {\n if (msg.sender != jobPendingOwner[_job]) revert OnlyPendingJobOwner();\n _;\n }\n}\n" - }, - "solidity/contracts/peripherals/Keep3rAccountance.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '@openzeppelin/contracts/utils/structs/EnumerableSet.sol';\nimport '../../interfaces/peripherals/IKeep3rAccountance.sol';\nimport './Keep3rRoles.sol';\n\nabstract contract Keep3rAccountance is IKeep3rAccountance, Keep3rRoles {\n using EnumerableSet for EnumerableSet.AddressSet;\n\n /// @notice List of all enabled keepers\n EnumerableSet.AddressSet internal _keepers;\n\n /// @inheritdoc IKeep3rAccountance\n mapping(address => uint256) public override workCompleted;\n\n /// @inheritdoc IKeep3rAccountance\n mapping(address => uint256) public override firstSeen;\n\n /// @inheritdoc IKeep3rAccountance\n mapping(address => bool) public override disputes;\n\n /// @inheritdoc IKeep3rAccountance\n /// @notice Mapping (job => bonding => amount)\n mapping(address => mapping(address => uint256)) public override bonds;\n\n /// @inheritdoc IKeep3rAccountance\n mapping(address => mapping(address => uint256)) public override jobTokenCredits;\n\n /// @notice The current liquidity credits available for a job\n mapping(address => uint256) internal _jobLiquidityCredits;\n\n /// @notice Map the address of a job to its correspondent periodCredits\n mapping(address => uint256) internal _jobPeriodCredits;\n\n /// @notice Enumerable array of Job Tokens for Credits\n mapping(address => EnumerableSet.AddressSet) internal _jobTokens;\n\n /// @notice List of liquidities that a job has (job => liquidities)\n mapping(address => EnumerableSet.AddressSet) internal _jobLiquidities;\n\n /// @notice Liquidity pool to observe\n mapping(address => address) internal _liquidityPool;\n\n /// @notice Tracks if a pool has KP3R as token0\n mapping(address => bool) internal _isKP3RToken0;\n\n /// @inheritdoc IKeep3rAccountance\n mapping(address => mapping(address => uint256)) public override pendingBonds;\n\n /// @inheritdoc IKeep3rAccountance\n mapping(address => mapping(address => uint256)) public override canActivateAfter;\n\n /// @inheritdoc IKeep3rAccountance\n mapping(address => mapping(address => uint256)) public override canWithdrawAfter;\n\n /// @inheritdoc IKeep3rAccountance\n mapping(address => mapping(address => uint256)) public override pendingUnbonds;\n\n /// @inheritdoc IKeep3rAccountance\n mapping(address => bool) public override hasBonded;\n\n /// @notice List of all enabled jobs\n EnumerableSet.AddressSet internal _jobs;\n\n /// @inheritdoc IKeep3rAccountance\n function jobs() external view override returns (address[] memory _list) {\n _list = _jobs.values();\n }\n\n /// @inheritdoc IKeep3rAccountance\n function keepers() external view override returns (address[] memory _list) {\n _list = _keepers.values();\n }\n}\n" - }, - "@openzeppelin/contracts/utils/structs/EnumerableSet.sol": { - "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Library for managing\n * https://en.wikipedia.org/wiki/Set_(abstract_data_type)[sets] of primitive\n * types.\n *\n * Sets have the following properties:\n *\n * - Elements are added, removed, and checked for existence in constant time\n * (O(1)).\n * - Elements are enumerated in O(n). No guarantees are made on the ordering.\n *\n * ```\n * contract Example {\n * // Add the library methods\n * using EnumerableSet for EnumerableSet.AddressSet;\n *\n * // Declare a set state variable\n * EnumerableSet.AddressSet private mySet;\n * }\n * ```\n *\n * As of v3.3.0, sets of type `bytes32` (`Bytes32Set`), `address` (`AddressSet`)\n * and `uint256` (`UintSet`) are supported.\n */\nlibrary EnumerableSet {\n // To implement this library for multiple types with as little code\n // repetition as possible, we write it in terms of a generic Set type with\n // bytes32 values.\n // The Set implementation uses private functions, and user-facing\n // implementations (such as AddressSet) are just wrappers around the\n // underlying Set.\n // This means that we can only create new EnumerableSets for types that fit\n // in bytes32.\n\n struct Set {\n // Storage of set values\n bytes32[] _values;\n // Position of the value in the `values` array, plus 1 because index 0\n // means a value is not in the set.\n mapping(bytes32 => uint256) _indexes;\n }\n\n /**\n * @dev Add a value to a set. O(1).\n *\n * Returns true if the value was added to the set, that is if it was not\n * already present.\n */\n function _add(Set storage set, bytes32 value) private returns (bool) {\n if (!_contains(set, value)) {\n set._values.push(value);\n // The value is stored at length-1, but we add 1 to all indexes\n // and use 0 as a sentinel value\n set._indexes[value] = set._values.length;\n return true;\n } else {\n return false;\n }\n }\n\n /**\n * @dev Removes a value from a set. O(1).\n *\n * Returns true if the value was removed from the set, that is if it was\n * present.\n */\n function _remove(Set storage set, bytes32 value) private returns (bool) {\n // We read and store the value's index to prevent multiple reads from the same storage slot\n uint256 valueIndex = set._indexes[value];\n\n if (valueIndex != 0) {\n // Equivalent to contains(set, value)\n // To delete an element from the _values array in O(1), we swap the element to delete with the last one in\n // the array, and then remove the last element (sometimes called as 'swap and pop').\n // This modifies the order of the array, as noted in {at}.\n\n uint256 toDeleteIndex = valueIndex - 1;\n uint256 lastIndex = set._values.length - 1;\n\n if (lastIndex != toDeleteIndex) {\n bytes32 lastvalue = set._values[lastIndex];\n\n // Move the last value to the index where the value to delete is\n set._values[toDeleteIndex] = lastvalue;\n // Update the index for the moved value\n set._indexes[lastvalue] = valueIndex; // Replace lastvalue's index to valueIndex\n }\n\n // Delete the slot where the moved value was stored\n set._values.pop();\n\n // Delete the index for the deleted slot\n delete set._indexes[value];\n\n return true;\n } else {\n return false;\n }\n }\n\n /**\n * @dev Returns true if the value is in the set. O(1).\n */\n function _contains(Set storage set, bytes32 value) private view returns (bool) {\n return set._indexes[value] != 0;\n }\n\n /**\n * @dev Returns the number of values on the set. O(1).\n */\n function _length(Set storage set) private view returns (uint256) {\n return set._values.length;\n }\n\n /**\n * @dev Returns the value stored at position `index` in the set. O(1).\n *\n * Note that there are no guarantees on the ordering of values inside the\n * array, and it may change when more values are added or removed.\n *\n * Requirements:\n *\n * - `index` must be strictly less than {length}.\n */\n function _at(Set storage set, uint256 index) private view returns (bytes32) {\n return set._values[index];\n }\n\n /**\n * @dev Return the entire set in an array\n *\n * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed\n * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that\n * this function has an unbounded cost, and using it as part of a state-changing function may render the function\n * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.\n */\n function _values(Set storage set) private view returns (bytes32[] memory) {\n return set._values;\n }\n\n // Bytes32Set\n\n struct Bytes32Set {\n Set _inner;\n }\n\n /**\n * @dev Add a value to a set. O(1).\n *\n * Returns true if the value was added to the set, that is if it was not\n * already present.\n */\n function add(Bytes32Set storage set, bytes32 value) internal returns (bool) {\n return _add(set._inner, value);\n }\n\n /**\n * @dev Removes a value from a set. O(1).\n *\n * Returns true if the value was removed from the set, that is if it was\n * present.\n */\n function remove(Bytes32Set storage set, bytes32 value) internal returns (bool) {\n return _remove(set._inner, value);\n }\n\n /**\n * @dev Returns true if the value is in the set. O(1).\n */\n function contains(Bytes32Set storage set, bytes32 value) internal view returns (bool) {\n return _contains(set._inner, value);\n }\n\n /**\n * @dev Returns the number of values in the set. O(1).\n */\n function length(Bytes32Set storage set) internal view returns (uint256) {\n return _length(set._inner);\n }\n\n /**\n * @dev Returns the value stored at position `index` in the set. O(1).\n *\n * Note that there are no guarantees on the ordering of values inside the\n * array, and it may change when more values are added or removed.\n *\n * Requirements:\n *\n * - `index` must be strictly less than {length}.\n */\n function at(Bytes32Set storage set, uint256 index) internal view returns (bytes32) {\n return _at(set._inner, index);\n }\n\n /**\n * @dev Return the entire set in an array\n *\n * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed\n * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that\n * this function has an unbounded cost, and using it as part of a state-changing function may render the function\n * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.\n */\n function values(Bytes32Set storage set) internal view returns (bytes32[] memory) {\n return _values(set._inner);\n }\n\n // AddressSet\n\n struct AddressSet {\n Set _inner;\n }\n\n /**\n * @dev Add a value to a set. O(1).\n *\n * Returns true if the value was added to the set, that is if it was not\n * already present.\n */\n function add(AddressSet storage set, address value) internal returns (bool) {\n return _add(set._inner, bytes32(uint256(uint160(value))));\n }\n\n /**\n * @dev Removes a value from a set. O(1).\n *\n * Returns true if the value was removed from the set, that is if it was\n * present.\n */\n function remove(AddressSet storage set, address value) internal returns (bool) {\n return _remove(set._inner, bytes32(uint256(uint160(value))));\n }\n\n /**\n * @dev Returns true if the value is in the set. O(1).\n */\n function contains(AddressSet storage set, address value) internal view returns (bool) {\n return _contains(set._inner, bytes32(uint256(uint160(value))));\n }\n\n /**\n * @dev Returns the number of values in the set. O(1).\n */\n function length(AddressSet storage set) internal view returns (uint256) {\n return _length(set._inner);\n }\n\n /**\n * @dev Returns the value stored at position `index` in the set. O(1).\n *\n * Note that there are no guarantees on the ordering of values inside the\n * array, and it may change when more values are added or removed.\n *\n * Requirements:\n *\n * - `index` must be strictly less than {length}.\n */\n function at(AddressSet storage set, uint256 index) internal view returns (address) {\n return address(uint160(uint256(_at(set._inner, index))));\n }\n\n /**\n * @dev Return the entire set in an array\n *\n * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed\n * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that\n * this function has an unbounded cost, and using it as part of a state-changing function may render the function\n * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.\n */\n function values(AddressSet storage set) internal view returns (address[] memory) {\n bytes32[] memory store = _values(set._inner);\n address[] memory result;\n\n assembly {\n result := store\n }\n\n return result;\n }\n\n // UintSet\n\n struct UintSet {\n Set _inner;\n }\n\n /**\n * @dev Add a value to a set. O(1).\n *\n * Returns true if the value was added to the set, that is if it was not\n * already present.\n */\n function add(UintSet storage set, uint256 value) internal returns (bool) {\n return _add(set._inner, bytes32(value));\n }\n\n /**\n * @dev Removes a value from a set. O(1).\n *\n * Returns true if the value was removed from the set, that is if it was\n * present.\n */\n function remove(UintSet storage set, uint256 value) internal returns (bool) {\n return _remove(set._inner, bytes32(value));\n }\n\n /**\n * @dev Returns true if the value is in the set. O(1).\n */\n function contains(UintSet storage set, uint256 value) internal view returns (bool) {\n return _contains(set._inner, bytes32(value));\n }\n\n /**\n * @dev Returns the number of values on the set. O(1).\n */\n function length(UintSet storage set) internal view returns (uint256) {\n return _length(set._inner);\n }\n\n /**\n * @dev Returns the value stored at position `index` in the set. O(1).\n *\n * Note that there are no guarantees on the ordering of values inside the\n * array, and it may change when more values are added or removed.\n *\n * Requirements:\n *\n * - `index` must be strictly less than {length}.\n */\n function at(UintSet storage set, uint256 index) internal view returns (uint256) {\n return uint256(_at(set._inner, index));\n }\n\n /**\n * @dev Return the entire set in an array\n *\n * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed\n * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that\n * this function has an unbounded cost, and using it as part of a state-changing function may render the function\n * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.\n */\n function values(UintSet storage set) internal view returns (uint256[] memory) {\n bytes32[] memory store = _values(set._inner);\n uint256[] memory result;\n\n assembly {\n result := store\n }\n\n return result;\n }\n}\n" - }, - "solidity/contracts/peripherals/Keep3rRoles.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../../interfaces/peripherals/IKeep3rRoles.sol';\nimport '@openzeppelin/contracts/utils/structs/EnumerableSet.sol';\nimport './DustCollector.sol';\nimport './Governable.sol';\n\ncontract Keep3rRoles is IKeep3rRoles, Governable, DustCollector {\n /// @inheritdoc IKeep3rRoles\n mapping(address => bool) public override slashers;\n\n /// @inheritdoc IKeep3rRoles\n mapping(address => bool) public override disputers;\n\n constructor(address _governance) Governable(_governance) DustCollector() {}\n\n /// @inheritdoc IKeep3rRoles\n function addSlasher(address _slasher) external override onlyGovernance {\n if (_slasher == address(0)) revert ZeroAddress();\n if (slashers[_slasher]) revert SlasherExistent();\n slashers[_slasher] = true;\n emit SlasherAdded(_slasher);\n }\n\n /// @inheritdoc IKeep3rRoles\n function removeSlasher(address _slasher) external override onlyGovernance {\n if (!slashers[_slasher]) revert SlasherUnexistent();\n delete slashers[_slasher];\n emit SlasherRemoved(_slasher);\n }\n\n /// @inheritdoc IKeep3rRoles\n function addDisputer(address _disputer) external override onlyGovernance {\n if (_disputer == address(0)) revert ZeroAddress();\n if (disputers[_disputer]) revert DisputerExistent();\n disputers[_disputer] = true;\n emit DisputerAdded(_disputer);\n }\n\n /// @inheritdoc IKeep3rRoles\n function removeDisputer(address _disputer) external override onlyGovernance {\n if (!disputers[_disputer]) revert DisputerUnexistent();\n delete disputers[_disputer];\n emit DisputerRemoved(_disputer);\n }\n\n /// @notice Functions with this modifier can only be called by either a slasher or governance\n modifier onlySlasher {\n if (!slashers[msg.sender]) revert OnlySlasher();\n _;\n }\n\n /// @notice Functions with this modifier can only be called by either a disputer or governance\n modifier onlyDisputer {\n if (!disputers[msg.sender]) revert OnlyDisputer();\n _;\n }\n}\n" - }, - "solidity/contracts/peripherals/Governable.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../../interfaces/peripherals/IGovernable.sol';\n\nabstract contract Governable is IGovernable {\n /// @inheritdoc IGovernable\n address public override governance;\n\n /// @inheritdoc IGovernable\n address public override pendingGovernance;\n\n constructor(address _governance) {\n if (_governance == address(0)) revert NoGovernanceZeroAddress();\n governance = _governance;\n }\n\n /// @inheritdoc IGovernable\n function setGovernance(address _governance) external override onlyGovernance {\n pendingGovernance = _governance;\n emit GovernanceProposal(_governance);\n }\n\n /// @inheritdoc IGovernable\n function acceptGovernance() external override onlyPendingGovernance {\n governance = pendingGovernance;\n delete pendingGovernance;\n emit GovernanceSet(governance);\n }\n\n /// @notice Functions with this modifier can only be called by governance\n modifier onlyGovernance {\n if (msg.sender != governance) revert OnlyGovernance();\n _;\n }\n\n /// @notice Functions with this modifier can only be called by pendingGovernance\n modifier onlyPendingGovernance {\n if (msg.sender != pendingGovernance) revert OnlyPendingGovernance();\n _;\n }\n}\n" - }, - "@openzeppelin/contracts/token/ERC20/IERC20.sol": { - "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Interface of the ERC20 standard as defined in the EIP.\n */\ninterface IERC20 {\n /**\n * @dev Returns the amount of tokens in existence.\n */\n function totalSupply() external view returns (uint256);\n\n /**\n * @dev Returns the amount of tokens owned by `account`.\n */\n function balanceOf(address account) external view returns (uint256);\n\n /**\n * @dev Moves `amount` tokens from the caller's account to `recipient`.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * Emits a {Transfer} event.\n */\n function transfer(address recipient, uint256 amount) external returns (bool);\n\n /**\n * @dev Returns the remaining number of tokens that `spender` will be\n * allowed to spend on behalf of `owner` through {transferFrom}. This is\n * zero by default.\n *\n * This value changes when {approve} or {transferFrom} are called.\n */\n function allowance(address owner, address spender) external view returns (uint256);\n\n /**\n * @dev Sets `amount` as the allowance of `spender` over the caller's tokens.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * IMPORTANT: Beware that changing an allowance with this method brings the risk\n * that someone may use both the old and the new allowance by unfortunate\n * transaction ordering. One possible solution to mitigate this race\n * condition is to first reduce the spender's allowance to 0 and set the\n * desired value afterwards:\n * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729\n *\n * Emits an {Approval} event.\n */\n function approve(address spender, uint256 amount) external returns (bool);\n\n /**\n * @dev Moves `amount` tokens from `sender` to `recipient` using the\n * allowance mechanism. `amount` is then deducted from the caller's\n * allowance.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * Emits a {Transfer} event.\n */\n function transferFrom(\n address sender,\n address recipient,\n uint256 amount\n ) external returns (bool);\n\n /**\n * @dev Emitted when `value` tokens are moved from one account (`from`) to\n * another (`to`).\n *\n * Note that `value` may be zero.\n */\n event Transfer(address indexed from, address indexed to, uint256 value);\n\n /**\n * @dev Emitted when the allowance of a `spender` for an `owner` is set by\n * a call to {approve}. `value` is the new allowance.\n */\n event Approval(address indexed owner, address indexed spender, uint256 value);\n}\n" - }, - "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol": { - "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\nimport \"../IERC20.sol\";\nimport \"../../../utils/Address.sol\";\n\n/**\n * @title SafeERC20\n * @dev Wrappers around ERC20 operations that throw on failure (when the token\n * contract returns false). Tokens that return no value (and instead revert or\n * throw on failure) are also supported, non-reverting calls are assumed to be\n * successful.\n * To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract,\n * which allows you to call the safe operations as `token.safeTransfer(...)`, etc.\n */\nlibrary SafeERC20 {\n using Address for address;\n\n function safeTransfer(\n IERC20 token,\n address to,\n uint256 value\n ) internal {\n _callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value));\n }\n\n function safeTransferFrom(\n IERC20 token,\n address from,\n address to,\n uint256 value\n ) internal {\n _callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value));\n }\n\n /**\n * @dev Deprecated. This function has issues similar to the ones found in\n * {IERC20-approve}, and its usage is discouraged.\n *\n * Whenever possible, use {safeIncreaseAllowance} and\n * {safeDecreaseAllowance} instead.\n */\n function safeApprove(\n IERC20 token,\n address spender,\n uint256 value\n ) internal {\n // safeApprove should only be called when setting an initial allowance,\n // or when resetting it to zero. To increase and decrease it, use\n // 'safeIncreaseAllowance' and 'safeDecreaseAllowance'\n require(\n (value == 0) || (token.allowance(address(this), spender) == 0),\n \"SafeERC20: approve from non-zero to non-zero allowance\"\n );\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value));\n }\n\n function safeIncreaseAllowance(\n IERC20 token,\n address spender,\n uint256 value\n ) internal {\n uint256 newAllowance = token.allowance(address(this), spender) + value;\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));\n }\n\n function safeDecreaseAllowance(\n IERC20 token,\n address spender,\n uint256 value\n ) internal {\n unchecked {\n uint256 oldAllowance = token.allowance(address(this), spender);\n require(oldAllowance >= value, \"SafeERC20: decreased allowance below zero\");\n uint256 newAllowance = oldAllowance - value;\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));\n }\n }\n\n /**\n * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement\n * on the return value: the return value is optional (but if data is returned, it must not be false).\n * @param token The token targeted by the call.\n * @param data The call data (encoded using abi.encode or one of its variants).\n */\n function _callOptionalReturn(IERC20 token, bytes memory data) private {\n // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since\n // we're implementing it ourselves. We use {Address.functionCall} to perform this call, which verifies that\n // the target address contains contract code and also asserts for success in the low-level call.\n\n bytes memory returndata = address(token).functionCall(data, \"SafeERC20: low-level call failed\");\n if (returndata.length > 0) {\n // Return data is optional\n require(abi.decode(returndata, (bool)), \"SafeERC20: ERC20 operation did not succeed\");\n }\n }\n}\n" - }, - "@openzeppelin/contracts/utils/Address.sol": { - "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Collection of functions related to the address type\n */\nlibrary Address {\n /**\n * @dev Returns true if `account` is a contract.\n *\n * [IMPORTANT]\n * ====\n * It is unsafe to assume that an address for which this function returns\n * false is an externally-owned account (EOA) and not a contract.\n *\n * Among others, `isContract` will return false for the following\n * types of addresses:\n *\n * - an externally-owned account\n * - a contract in construction\n * - an address where a contract will be created\n * - an address where a contract lived, but was destroyed\n * ====\n */\n function isContract(address account) internal view returns (bool) {\n // This method relies on extcodesize, which returns 0 for contracts in\n // construction, since the code is only stored at the end of the\n // constructor execution.\n\n uint256 size;\n assembly {\n size := extcodesize(account)\n }\n return size > 0;\n }\n\n /**\n * @dev Replacement for Solidity's `transfer`: sends `amount` wei to\n * `recipient`, forwarding all available gas and reverting on errors.\n *\n * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost\n * of certain opcodes, possibly making contracts go over the 2300 gas limit\n * imposed by `transfer`, making them unable to receive funds via\n * `transfer`. {sendValue} removes this limitation.\n *\n * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].\n *\n * IMPORTANT: because control is transferred to `recipient`, care must be\n * taken to not create reentrancy vulnerabilities. Consider using\n * {ReentrancyGuard} or the\n * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].\n */\n function sendValue(address payable recipient, uint256 amount) internal {\n require(address(this).balance >= amount, \"Address: insufficient balance\");\n\n (bool success, ) = recipient.call{value: amount}(\"\");\n require(success, \"Address: unable to send value, recipient may have reverted\");\n }\n\n /**\n * @dev Performs a Solidity function call using a low level `call`. A\n * plain `call` is an unsafe replacement for a function call: use this\n * function instead.\n *\n * If `target` reverts with a revert reason, it is bubbled up by this\n * function (like regular Solidity function calls).\n *\n * Returns the raw returned data. To convert to the expected return value,\n * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\n *\n * Requirements:\n *\n * - `target` must be a contract.\n * - calling `target` with `data` must not revert.\n *\n * _Available since v3.1._\n */\n function functionCall(address target, bytes memory data) internal returns (bytes memory) {\n return functionCall(target, data, \"Address: low-level call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with\n * `errorMessage` as a fallback revert reason when `target` reverts.\n *\n * _Available since v3.1._\n */\n function functionCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal returns (bytes memory) {\n return functionCallWithValue(target, data, 0, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but also transferring `value` wei to `target`.\n *\n * Requirements:\n *\n * - the calling contract must have an ETH balance of at least `value`.\n * - the called Solidity function must be `payable`.\n *\n * _Available since v3.1._\n */\n function functionCallWithValue(\n address target,\n bytes memory data,\n uint256 value\n ) internal returns (bytes memory) {\n return functionCallWithValue(target, data, value, \"Address: low-level call with value failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but\n * with `errorMessage` as a fallback revert reason when `target` reverts.\n *\n * _Available since v3.1._\n */\n function functionCallWithValue(\n address target,\n bytes memory data,\n uint256 value,\n string memory errorMessage\n ) internal returns (bytes memory) {\n require(address(this).balance >= value, \"Address: insufficient balance for call\");\n require(isContract(target), \"Address: call to non-contract\");\n\n (bool success, bytes memory returndata) = target.call{value: value}(data);\n return verifyCallResult(success, returndata, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but performing a static call.\n *\n * _Available since v3.3._\n */\n function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\n return functionStaticCall(target, data, \"Address: low-level static call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\n * but performing a static call.\n *\n * _Available since v3.3._\n */\n function functionStaticCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal view returns (bytes memory) {\n require(isContract(target), \"Address: static call to non-contract\");\n\n (bool success, bytes memory returndata) = target.staticcall(data);\n return verifyCallResult(success, returndata, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but performing a delegate call.\n *\n * _Available since v3.4._\n */\n function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {\n return functionDelegateCall(target, data, \"Address: low-level delegate call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\n * but performing a delegate call.\n *\n * _Available since v3.4._\n */\n function functionDelegateCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal returns (bytes memory) {\n require(isContract(target), \"Address: delegate call to non-contract\");\n\n (bool success, bytes memory returndata) = target.delegatecall(data);\n return verifyCallResult(success, returndata, errorMessage);\n }\n\n /**\n * @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the\n * revert reason using the provided one.\n *\n * _Available since v4.3._\n */\n function verifyCallResult(\n bool success,\n bytes memory returndata,\n string memory errorMessage\n ) internal pure returns (bytes memory) {\n if (success) {\n return returndata;\n } else {\n // Look for revert reason and bubble it up if present\n if (returndata.length > 0) {\n // The easiest way to bubble the revert reason is using memory via assembly\n\n assembly {\n let returndata_size := mload(returndata)\n revert(add(32, returndata), returndata_size)\n }\n } else {\n revert(errorMessage);\n }\n }\n }\n}\n" - }, - "solidity/contracts/peripherals/jobs/Keep3rJobMigration.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../../../interfaces/peripherals/IKeep3rJobs.sol';\nimport './Keep3rJobFundableCredits.sol';\nimport './Keep3rJobFundableLiquidity.sol';\n\nabstract contract Keep3rJobMigration is IKeep3rJobMigration, Keep3rJobFundableCredits, Keep3rJobFundableLiquidity {\n using EnumerableSet for EnumerableSet.AddressSet;\n\n uint256 internal constant _MIGRATION_COOLDOWN = 1 minutes;\n\n /// @inheritdoc IKeep3rJobMigration\n mapping(address => address) public override pendingJobMigrations;\n mapping(address => mapping(address => uint256)) internal _migrationCreatedAt;\n\n /// @inheritdoc IKeep3rJobMigration\n function migrateJob(address _fromJob, address _toJob) external override onlyJobOwner(_fromJob) {\n if (_fromJob == _toJob) revert JobMigrationImpossible();\n\n pendingJobMigrations[_fromJob] = _toJob;\n _migrationCreatedAt[_fromJob][_toJob] = block.timestamp;\n\n emit JobMigrationRequested(_fromJob, _toJob);\n }\n\n /// @inheritdoc IKeep3rJobMigration\n function acceptJobMigration(address _fromJob, address _toJob) external override onlyJobOwner(_toJob) {\n if (disputes[_fromJob] || disputes[_toJob]) revert JobDisputed();\n if (pendingJobMigrations[_fromJob] != _toJob) revert JobMigrationUnavailable();\n if (block.timestamp < _migrationCreatedAt[_fromJob][_toJob] + _MIGRATION_COOLDOWN) revert JobMigrationLocked();\n\n // force job credits update for both jobs\n _settleJobAccountance(_fromJob);\n _settleJobAccountance(_toJob);\n\n // migrate tokens\n while (_jobTokens[_fromJob].length() > 0) {\n address _tokenToMigrate = _jobTokens[_fromJob].at(0);\n jobTokenCredits[_toJob][_tokenToMigrate] += jobTokenCredits[_fromJob][_tokenToMigrate];\n delete jobTokenCredits[_fromJob][_tokenToMigrate];\n _jobTokens[_fromJob].remove(_tokenToMigrate);\n _jobTokens[_toJob].add(_tokenToMigrate);\n }\n\n // migrate liquidities\n while (_jobLiquidities[_fromJob].length() > 0) {\n address _liquidity = _jobLiquidities[_fromJob].at(0);\n\n liquidityAmount[_toJob][_liquidity] += liquidityAmount[_fromJob][_liquidity];\n delete liquidityAmount[_fromJob][_liquidity];\n\n _jobLiquidities[_toJob].add(_liquidity);\n _jobLiquidities[_fromJob].remove(_liquidity);\n }\n\n // migrate job balances\n _jobPeriodCredits[_toJob] += _jobPeriodCredits[_fromJob];\n delete _jobPeriodCredits[_fromJob];\n\n _jobLiquidityCredits[_toJob] += _jobLiquidityCredits[_fromJob];\n delete _jobLiquidityCredits[_fromJob];\n\n // stop _fromJob from being a job\n delete rewardedAt[_fromJob];\n _jobs.remove(_fromJob);\n\n // delete unused data slots\n delete jobOwner[_fromJob];\n delete jobPendingOwner[_fromJob];\n delete _migrationCreatedAt[_fromJob][_toJob];\n delete pendingJobMigrations[_fromJob];\n\n emit JobMigrationSuccessful(_fromJob, _toJob);\n }\n}\n" - }, - "solidity/interfaces/IKeep3rHelper.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport './IKeep3rHelperParameters.sol';\n\n/// @title Keep3rHelper contract\n/// @notice Contains all the helper functions used throughout the different files.\ninterface IKeep3rHelper is IKeep3rHelperParameters {\n // Errors\n\n /// @notice Throws when none of the tokens in the liquidity pair is KP3R\n error LiquidityPairInvalid();\n\n // Methods\n // solhint-enable func-name-mixedcase\n\n /// @notice Calculates the amount of KP3R that corresponds to the ETH passed into the function\n /// @dev This function allows us to calculate how much KP3R we should pay to a keeper for things expressed in ETH, like gas\n /// @param _eth The amount of ETH\n /// @return _amountOut The amount of KP3R\n function quote(uint256 _eth) external view returns (uint256 _amountOut);\n\n /// @notice Returns the amount of KP3R the keeper has bonded\n /// @param _keeper The address of the keeper to check\n /// @return _amountBonded The amount of KP3R the keeper has bonded\n function bonds(address _keeper) external view returns (uint256 _amountBonded);\n\n /// @notice Calculates the reward (in KP3R) that corresponds to a keeper for using gas\n /// @param _keeper The address of the keeper to check\n /// @param _gasUsed The amount of gas used that will be rewarded\n /// @return _kp3r The amount of KP3R that should be awarded to the keeper\n function getRewardAmountFor(address _keeper, uint256 _gasUsed) external view returns (uint256 _kp3r);\n\n /// @notice Calculates the boost in the reward given to a keeper based on the amount of KP3R that keeper has bonded\n /// @dev If the keeper has no bonds, boost should be +10% of gas cost, if keeper has max bonds, +20%\n /// @param _bonds The amount of KP3R tokens bonded by the keeper\n /// @return _rewardBoost The reward boost that corresponds to the keeper\n function getRewardBoostFor(uint256 _bonds) external view returns (uint256 _rewardBoost);\n\n /// @notice Calculates the reward (in KP3R) that corresponds to tx.origin for using gas\n /// @param _gasUsed The amount of gas used that will be rewarded\n /// @return _amount The amount of KP3R that should be awarded to tx.origin\n function getRewardAmount(uint256 _gasUsed) external view returns (uint256 _amount);\n\n /// @notice Given a pool address, returns the underlying tokens of the pair\n /// @param _pool Address of the correspondant pool\n /// @return _token0 Address of the first token of the pair\n /// @return _token1 Address of the second token of the pair\n function getPoolTokens(address _pool) external view returns (address _token0, address _token1);\n\n /// @notice Defines the order of the tokens in the pair for twap calculations\n /// @param _pool Address of the correspondant pool\n /// @return _isKP3RToken0 Boolean indicating the order of the tokens in the pair\n function isKP3RToken0(address _pool) external view returns (bool _isKP3RToken0);\n\n /// @notice Given an array of secondsAgo, returns UniswapV3 pool cumulatives at that moment\n /// @param _pool Address of the pool to observe\n /// @param _secondsAgo Array with time references to observe\n /// @return _tickCumulative1 Cumulative sum of ticks until first time reference\n /// @return _tickCumulative2 Cumulative sum of ticks until second time reference\n /// @return _success Boolean indicating if the observe call was succesfull\n function observe(address _pool, uint32[] memory _secondsAgo)\n external\n view\n returns (\n int56 _tickCumulative1,\n int56 _tickCumulative2,\n bool _success\n );\n\n /// @notice Get multiplier, quote, and extra, in order to calculate keeper payment\n /// @param _bonds Amount of bonded KP3R owned by the keeper\n /// @return _boost Multiplier per gas unit. Takes into account the base fee and the amount of bonded KP3R\n /// @return _oneEthQuote Amount of KP3R tokens equivalent to 1 ETH\n /// @return _extra Amount of extra gas that should be added to the gas spent\n function getPaymentParams(uint256 _bonds)\n external\n view\n returns (\n uint256 _boost,\n uint256 _oneEthQuote,\n uint256 _extra\n );\n\n /// @notice Given a tick and a liquidity amount, calculates the underlying KP3R tokens\n /// @param _liquidityAmount Amount of liquidity to be converted\n /// @param _tickDifference Tick value used to calculate the quote\n /// @param _timeInterval Time value used to calculate the quote\n /// @return _kp3rAmount Amount of KP3R tokens underlying on the given liquidity\n function getKP3RsAtTick(\n uint256 _liquidityAmount,\n int56 _tickDifference,\n uint256 _timeInterval\n ) external pure returns (uint256 _kp3rAmount);\n\n /// @notice Given a tick and a token amount, calculates the output in correspondant token\n /// @param _baseAmount Amount of token to be converted\n /// @param _tickDifference Tick value used to calculate the quote\n /// @param _timeInterval Time value used to calculate the quote\n /// @return _quoteAmount Amount of credits deserved for the baseAmount at the tick value\n function getQuoteAtTick(\n uint128 _baseAmount,\n int56 _tickDifference,\n uint256 _timeInterval\n ) external pure returns (uint256 _quoteAmount);\n}\n" - }, - "solidity/contracts/peripherals/jobs/Keep3rJobFundableCredits.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport './Keep3rJobOwnership.sol';\nimport '../Keep3rAccountance.sol';\nimport '../Keep3rParameters.sol';\nimport '../../../interfaces/peripherals/IKeep3rJobs.sol';\n\nimport '@openzeppelin/contracts/security/ReentrancyGuard.sol';\nimport '@openzeppelin/contracts/token/ERC20/IERC20.sol';\nimport '@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol';\nimport '@openzeppelin/contracts/utils/math/Math.sol';\n\nabstract contract Keep3rJobFundableCredits is IKeep3rJobFundableCredits, ReentrancyGuard, Keep3rJobOwnership, Keep3rParameters {\n using EnumerableSet for EnumerableSet.AddressSet;\n using SafeERC20 for IERC20;\n\n /// @notice Cooldown between withdrawals\n uint256 internal constant _WITHDRAW_TOKENS_COOLDOWN = 1 minutes;\n\n /// @inheritdoc IKeep3rJobFundableCredits\n mapping(address => mapping(address => uint256)) public override jobTokenCreditsAddedAt;\n\n /// @inheritdoc IKeep3rJobFundableCredits\n function addTokenCreditsToJob(\n address _job,\n address _token,\n uint256 _amount\n ) external override nonReentrant {\n if (!_jobs.contains(_job)) revert JobUnavailable();\n // KP3R shouldn't be used for direct token payments\n if (_token == keep3rV1) revert TokenUnallowed();\n uint256 _before = IERC20(_token).balanceOf(address(this));\n IERC20(_token).safeTransferFrom(msg.sender, address(this), _amount);\n uint256 _received = IERC20(_token).balanceOf(address(this)) - _before;\n uint256 _tokenFee = (_received * fee) / _BASE;\n jobTokenCredits[_job][_token] += _received - _tokenFee;\n jobTokenCreditsAddedAt[_job][_token] = block.timestamp;\n IERC20(_token).safeTransfer(governance, _tokenFee);\n _jobTokens[_job].add(_token);\n\n emit TokenCreditAddition(_job, _token, msg.sender, _received);\n }\n\n /// @inheritdoc IKeep3rJobFundableCredits\n function withdrawTokenCreditsFromJob(\n address _job,\n address _token,\n uint256 _amount,\n address _receiver\n ) external override nonReentrant onlyJobOwner(_job) {\n if (block.timestamp <= jobTokenCreditsAddedAt[_job][_token] + _WITHDRAW_TOKENS_COOLDOWN) revert JobTokenCreditsLocked();\n if (jobTokenCredits[_job][_token] < _amount) revert InsufficientJobTokenCredits();\n if (disputes[_job]) revert JobDisputed();\n\n jobTokenCredits[_job][_token] -= _amount;\n IERC20(_token).safeTransfer(_receiver, _amount);\n\n if (jobTokenCredits[_job][_token] == 0) {\n _jobTokens[_job].remove(_token);\n }\n\n emit TokenCreditWithdrawal(_job, _token, _receiver, _amount);\n }\n}\n" - }, - "solidity/contracts/peripherals/jobs/Keep3rJobFundableLiquidity.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport './Keep3rJobOwnership.sol';\nimport '../Keep3rAccountance.sol';\nimport '../Keep3rParameters.sol';\nimport '../../../interfaces/IPairManager.sol';\nimport '../../../interfaces/peripherals/IKeep3rJobs.sol';\n\nimport '../../libraries/FullMath.sol';\n\nimport '@openzeppelin/contracts/security/ReentrancyGuard.sol';\nimport '@openzeppelin/contracts/token/ERC20/IERC20.sol';\nimport '@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol';\nimport '@openzeppelin/contracts/utils/math/Math.sol';\n\nabstract contract Keep3rJobFundableLiquidity is IKeep3rJobFundableLiquidity, ReentrancyGuard, Keep3rJobOwnership, Keep3rParameters {\n using EnumerableSet for EnumerableSet.AddressSet;\n using SafeERC20 for IERC20;\n\n /// @notice List of liquidities that are accepted in the system\n EnumerableSet.AddressSet internal _approvedLiquidities;\n\n /// @inheritdoc IKeep3rJobFundableLiquidity\n mapping(address => mapping(address => uint256)) public override liquidityAmount;\n\n /// @inheritdoc IKeep3rJobFundableLiquidity\n mapping(address => uint256) public override rewardedAt;\n\n /// @inheritdoc IKeep3rJobFundableLiquidity\n mapping(address => uint256) public override workedAt;\n\n /// @notice Tracks an address and returns its TickCache\n mapping(address => TickCache) internal _tick;\n\n // Views\n\n /// @inheritdoc IKeep3rJobFundableLiquidity\n function approvedLiquidities() external view override returns (address[] memory _list) {\n _list = _approvedLiquidities.values();\n }\n\n /// @inheritdoc IKeep3rJobFundableLiquidity\n function jobPeriodCredits(address _job) public view override returns (uint256 _periodCredits) {\n for (uint256 i; i < _jobLiquidities[_job].length(); i++) {\n address _liquidity = _jobLiquidities[_job].at(i);\n if (_approvedLiquidities.contains(_liquidity)) {\n TickCache memory _tickCache = observeLiquidity(_liquidity);\n if (_tickCache.period != 0) {\n int56 _tickDifference = _isKP3RToken0[_liquidity] ? _tickCache.difference : -_tickCache.difference;\n _periodCredits += _getReward(\n IKeep3rHelper(keep3rHelper).getKP3RsAtTick(liquidityAmount[_job][_liquidity], _tickDifference, rewardPeriodTime)\n );\n }\n }\n }\n }\n\n /// @inheritdoc IKeep3rJobFundableLiquidity\n function jobLiquidityCredits(address _job) public view override returns (uint256 _liquidityCredits) {\n uint256 _periodCredits = jobPeriodCredits(_job);\n\n // If the job was rewarded in the past 1 period time\n if ((block.timestamp - rewardedAt[_job]) < rewardPeriodTime) {\n // If the job has period credits, update minted job credits to new twap\n _liquidityCredits = _periodCredits > 0\n ? (_jobLiquidityCredits[_job] * _periodCredits) / _jobPeriodCredits[_job] // If the job has period credits, return remaining job credits updated to new twap\n : _jobLiquidityCredits[_job]; // If not, return remaining credits, forced credits should not be updated\n } else {\n // Else return a full period worth of credits if current credits have expired\n _liquidityCredits = _periodCredits;\n }\n }\n\n /// @inheritdoc IKeep3rJobFundableLiquidity\n function totalJobCredits(address _job) external view override returns (uint256 _credits) {\n uint256 _periodCredits = jobPeriodCredits(_job);\n uint256 _cooldown = block.timestamp;\n\n if ((rewardedAt[_job] > _period(block.timestamp - rewardPeriodTime))) {\n // Will calculate cooldown if it outdated\n if ((block.timestamp - rewardedAt[_job]) >= rewardPeriodTime) {\n // Will calculate cooldown from last reward reference in this period\n _cooldown -= (rewardedAt[_job] + rewardPeriodTime);\n } else {\n // Will calculate cooldown from last reward timestamp\n _cooldown -= rewardedAt[_job];\n }\n } else {\n // Will calculate cooldown from period start if expired\n _cooldown -= _period(block.timestamp);\n }\n _credits = jobLiquidityCredits(_job) + _phase(_cooldown, _periodCredits);\n }\n\n /// @inheritdoc IKeep3rJobFundableLiquidity\n function quoteLiquidity(address _liquidity, uint256 _amount) external view override returns (uint256 _periodCredits) {\n if (_approvedLiquidities.contains(_liquidity)) {\n TickCache memory _tickCache = observeLiquidity(_liquidity);\n if (_tickCache.period != 0) {\n int56 _tickDifference = _isKP3RToken0[_liquidity] ? _tickCache.difference : -_tickCache.difference;\n return _getReward(IKeep3rHelper(keep3rHelper).getKP3RsAtTick(_amount, _tickDifference, rewardPeriodTime));\n }\n }\n }\n\n /// @inheritdoc IKeep3rJobFundableLiquidity\n function observeLiquidity(address _liquidity) public view virtual override returns (TickCache memory _tickCache) {\n if (_tick[_liquidity].period == _period(block.timestamp)) {\n // Will return cached twaps if liquidity is updated\n _tickCache = _tick[_liquidity];\n } else {\n bool success;\n uint256 lastPeriod = _period(block.timestamp - rewardPeriodTime);\n\n if (_tick[_liquidity].period == lastPeriod) {\n // Will only ask for current period accumulator if liquidity is outdated\n uint32[] memory _secondsAgo = new uint32[](1);\n int56 previousTick = _tick[_liquidity].current;\n\n _secondsAgo[0] = uint32(block.timestamp - _period(block.timestamp));\n\n (_tickCache.current, , success) = IKeep3rHelper(keep3rHelper).observe(_liquidityPool[_liquidity], _secondsAgo);\n\n _tickCache.difference = _tickCache.current - previousTick;\n } else if (_tick[_liquidity].period < lastPeriod) {\n // Will ask for 2 accumulators if liquidity is expired\n uint32[] memory _secondsAgo = new uint32[](2);\n\n _secondsAgo[0] = uint32(block.timestamp - _period(block.timestamp));\n _secondsAgo[1] = uint32(block.timestamp - _period(block.timestamp) + rewardPeriodTime);\n\n int56 _tickCumulative2;\n (_tickCache.current, _tickCumulative2, success) = IKeep3rHelper(keep3rHelper).observe(_liquidityPool[_liquidity], _secondsAgo);\n\n _tickCache.difference = _tickCache.current - _tickCumulative2;\n }\n if (success) {\n _tickCache.period = _period(block.timestamp);\n } else {\n delete _tickCache.period;\n }\n }\n }\n\n // Methods\n\n /// @inheritdoc IKeep3rJobFundableLiquidity\n function forceLiquidityCreditsToJob(address _job, uint256 _amount) external override onlyGovernance {\n if (!_jobs.contains(_job)) revert JobUnavailable();\n _settleJobAccountance(_job);\n _jobLiquidityCredits[_job] += _amount;\n emit LiquidityCreditsForced(_job, rewardedAt[_job], _jobLiquidityCredits[_job]);\n }\n\n /// @inheritdoc IKeep3rJobFundableLiquidity\n function approveLiquidity(address _liquidity) external virtual override onlyGovernance {\n if (!_approvedLiquidities.add(_liquidity)) revert LiquidityPairApproved();\n _liquidityPool[_liquidity] = IPairManager(_liquidity).pool();\n _isKP3RToken0[_liquidity] = IKeep3rHelper(keep3rHelper).isKP3RToken0(_liquidityPool[_liquidity]);\n _tick[_liquidity] = observeLiquidity(_liquidity);\n emit LiquidityApproval(_liquidity);\n }\n\n /// @inheritdoc IKeep3rJobFundableLiquidity\n function revokeLiquidity(address _liquidity) external override onlyGovernance {\n if (!_approvedLiquidities.remove(_liquidity)) revert LiquidityPairUnexistent();\n delete _liquidityPool[_liquidity];\n delete _isKP3RToken0[_liquidity];\n delete _tick[_liquidity];\n\n emit LiquidityRevocation(_liquidity);\n }\n\n /// @inheritdoc IKeep3rJobFundableLiquidity\n function addLiquidityToJob(\n address _job,\n address _liquidity,\n uint256 _amount\n ) external override nonReentrant {\n if (!_approvedLiquidities.contains(_liquidity)) revert LiquidityPairUnapproved();\n if (!_jobs.contains(_job)) revert JobUnavailable();\n\n _jobLiquidities[_job].add(_liquidity);\n\n _settleJobAccountance(_job);\n\n if (_quoteLiquidity(liquidityAmount[_job][_liquidity] + _amount, _liquidity) < liquidityMinimum) revert JobLiquidityLessThanMin();\n\n emit LiquidityCreditsReward(_job, rewardedAt[_job], _jobLiquidityCredits[_job], _jobPeriodCredits[_job]);\n\n IERC20(_liquidity).safeTransferFrom(msg.sender, address(this), _amount);\n liquidityAmount[_job][_liquidity] += _amount;\n _jobPeriodCredits[_job] += _getReward(_quoteLiquidity(_amount, _liquidity));\n emit LiquidityAddition(_job, _liquidity, msg.sender, _amount);\n }\n\n /// @inheritdoc IKeep3rJobFundableLiquidity\n function unbondLiquidityFromJob(\n address _job,\n address _liquidity,\n uint256 _amount\n ) external override onlyJobOwner(_job) {\n canWithdrawAfter[_job][_liquidity] = block.timestamp + unbondTime;\n pendingUnbonds[_job][_liquidity] += _amount;\n _unbondLiquidityFromJob(_job, _liquidity, _amount);\n\n uint256 _remainingLiquidity = liquidityAmount[_job][_liquidity];\n if (_remainingLiquidity > 0 && _quoteLiquidity(_remainingLiquidity, _liquidity) < liquidityMinimum) revert JobLiquidityLessThanMin();\n\n emit Unbonding(_job, _liquidity, _amount);\n }\n\n /// @inheritdoc IKeep3rJobFundableLiquidity\n function withdrawLiquidityFromJob(\n address _job,\n address _liquidity,\n address _receiver\n ) external override onlyJobOwner(_job) {\n if (_receiver == address(0)) revert ZeroAddress();\n if (pendingUnbonds[_job][_liquidity] == 0) revert UnbondsUnexistent();\n if (canWithdrawAfter[_job][_liquidity] >= block.timestamp) revert UnbondsLocked();\n if (disputes[_job]) revert Disputed();\n\n uint256 _amount = pendingUnbonds[_job][_liquidity];\n\n delete pendingUnbonds[_job][_liquidity];\n delete canWithdrawAfter[_job][_liquidity];\n\n IERC20(_liquidity).safeTransfer(_receiver, _amount);\n emit LiquidityWithdrawal(_job, _liquidity, _receiver, _amount);\n }\n\n // Internal functions\n\n /// @notice Updates or rewards job liquidity credits depending on time since last job reward\n function _updateJobCreditsIfNeeded(address _job) internal returns (bool _rewarded) {\n if (rewardedAt[_job] < _period(block.timestamp)) {\n // Will exit function if job has been rewarded in current period\n if (rewardedAt[_job] <= _period(block.timestamp - rewardPeriodTime)) {\n // Will reset job to period syncronicity if a full period passed without rewards\n _updateJobPeriod(_job);\n _jobLiquidityCredits[_job] = _jobPeriodCredits[_job];\n rewardedAt[_job] = _period(block.timestamp);\n _rewarded = true;\n } else if ((block.timestamp - rewardedAt[_job]) >= rewardPeriodTime) {\n // Will reset job's syncronicity if last reward was more than epoch ago\n _updateJobPeriod(_job);\n _jobLiquidityCredits[_job] = _jobPeriodCredits[_job];\n rewardedAt[_job] += rewardPeriodTime;\n _rewarded = true;\n } else if (workedAt[_job] < _period(block.timestamp)) {\n // First keeper on period has to update job accountance to current twaps\n uint256 previousPeriodCredits = _jobPeriodCredits[_job];\n _updateJobPeriod(_job);\n _jobLiquidityCredits[_job] = (_jobLiquidityCredits[_job] * _jobPeriodCredits[_job]) / previousPeriodCredits;\n // Updating job accountance does not reward job\n }\n }\n }\n\n /// @notice Only called if _jobLiquidityCredits < payment\n function _rewardJobCredits(address _job) internal {\n /// @notice Only way to += jobLiquidityCredits is when keeper rewarding (cannot pay work)\n /* WARNING: this allows to top up _jobLiquidityCredits to a max of 1.99 but have to spend at least 1 */\n _jobLiquidityCredits[_job] += _phase(block.timestamp - rewardedAt[_job], _jobPeriodCredits[_job]);\n rewardedAt[_job] = block.timestamp;\n }\n\n /// @notice Updates accountance for _jobPeriodCredits\n function _updateJobPeriod(address _job) internal {\n _jobPeriodCredits[_job] = _calculateJobPeriodCredits(_job);\n }\n\n /// @notice Quotes the outdated job liquidities and calculates _periodCredits\n /// @dev This function is also responsible for keeping the KP3R/WETH quote updated\n function _calculateJobPeriodCredits(address _job) internal returns (uint256 _periodCredits) {\n for (uint256 i; i < _jobLiquidities[_job].length(); i++) {\n address _liquidity = _jobLiquidities[_job].at(i);\n if (_approvedLiquidities.contains(_liquidity)) {\n if (_tick[_liquidity].period != _period(block.timestamp)) {\n // Updates liquidity cache only if needed\n _tick[_liquidity] = observeLiquidity(_liquidity);\n }\n _periodCredits += _getReward(_quoteLiquidity(liquidityAmount[_job][_liquidity], _liquidity));\n }\n }\n }\n\n /// @notice Updates job accountance calculating the impact of the unbonded liquidity amount\n function _unbondLiquidityFromJob(\n address _job,\n address _liquidity,\n uint256 _amount\n ) internal nonReentrant {\n if (!_jobLiquidities[_job].contains(_liquidity)) revert JobLiquidityUnexistent();\n if (liquidityAmount[_job][_liquidity] < _amount) revert JobLiquidityInsufficient();\n\n // Ensures current twaps in job liquidities\n _updateJobPeriod(_job);\n uint256 _periodCreditsToRemove = _getReward(_quoteLiquidity(_amount, _liquidity));\n\n // A liquidity can be revoked causing a job to have 0 periodCredits\n if (_jobPeriodCredits[_job] > 0) {\n // Removes a % correspondant to a full rewardPeriodTime for the liquidity withdrawn vs all of the liquidities\n _jobLiquidityCredits[_job] -= (_jobLiquidityCredits[_job] * _periodCreditsToRemove) / _jobPeriodCredits[_job];\n _jobPeriodCredits[_job] -= _periodCreditsToRemove;\n }\n\n liquidityAmount[_job][_liquidity] -= _amount;\n if (liquidityAmount[_job][_liquidity] == 0) {\n _jobLiquidities[_job].remove(_liquidity);\n }\n }\n\n /// @notice Returns a fraction of the multiplier or the whole multiplier if equal or more than a rewardPeriodTime has passed\n function _phase(uint256 _timePassed, uint256 _multiplier) internal view returns (uint256 _result) {\n if (_timePassed < rewardPeriodTime) {\n _result = (_timePassed * _multiplier) / rewardPeriodTime;\n } else _result = _multiplier;\n }\n\n /// @notice Returns the start of the period of the provided timestamp\n function _period(uint256 _timestamp) internal view returns (uint256 _periodTimestamp) {\n return _timestamp - (_timestamp % rewardPeriodTime);\n }\n\n /// @notice Calculates relation between rewardPeriod and inflationPeriod\n function _getReward(uint256 _baseAmount) internal view returns (uint256 _credits) {\n return FullMath.mulDiv(_baseAmount, rewardPeriodTime, inflationPeriod);\n }\n\n /// @notice Returns underlying KP3R amount for a given liquidity amount\n function _quoteLiquidity(uint256 _amount, address _liquidity) internal view returns (uint256 _quote) {\n if (_tick[_liquidity].period != 0) {\n int56 _tickDifference = _isKP3RToken0[_liquidity] ? _tick[_liquidity].difference : -_tick[_liquidity].difference;\n _quote = IKeep3rHelper(keep3rHelper).getKP3RsAtTick(_amount, _tickDifference, rewardPeriodTime);\n }\n }\n\n /// @notice Updates job credits to current quotes and rewards job's pending minted credits\n /// @dev Ensures a maximum of 1 period of credits\n function _settleJobAccountance(address _job) internal virtual {\n _updateJobCreditsIfNeeded(_job);\n _rewardJobCredits(_job);\n _jobLiquidityCredits[_job] = Math.min(_jobLiquidityCredits[_job], _jobPeriodCredits[_job]);\n }\n}\n" - }, - "solidity/contracts/peripherals/Keep3rParameters.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../../interfaces/IKeep3rHelper.sol';\nimport '../../interfaces/peripherals/IKeep3rParameters.sol';\nimport './Keep3rAccountance.sol';\n\nabstract contract Keep3rParameters is IKeep3rParameters, Keep3rAccountance {\n /// @inheritdoc IKeep3rParameters\n address public override keep3rV1;\n\n /// @inheritdoc IKeep3rParameters\n address public override keep3rV1Proxy;\n\n /// @inheritdoc IKeep3rParameters\n address public override keep3rHelper;\n\n /// @inheritdoc IKeep3rParameters\n uint256 public override bondTime = 3 days;\n\n /// @inheritdoc IKeep3rParameters\n uint256 public override unbondTime = 14 days;\n\n /// @inheritdoc IKeep3rParameters\n uint256 public override liquidityMinimum = 3 ether;\n\n /// @inheritdoc IKeep3rParameters\n uint256 public override rewardPeriodTime = 5 days;\n\n /// @inheritdoc IKeep3rParameters\n uint256 public override inflationPeriod = 34 days;\n\n /// @inheritdoc IKeep3rParameters\n uint256 public override fee = 30;\n\n /// @notice The base that will be used to calculate the fee\n uint256 internal constant _BASE = 10_000;\n\n /// @notice The minimum reward period\n uint256 internal constant _MIN_REWARD_PERIOD_TIME = 1 days;\n\n constructor(\n address _keep3rHelper,\n address _keep3rV1,\n address _keep3rV1Proxy\n ) {\n keep3rHelper = _keep3rHelper;\n keep3rV1 = _keep3rV1;\n keep3rV1Proxy = _keep3rV1Proxy;\n }\n\n /// @inheritdoc IKeep3rParameters\n function setKeep3rHelper(address _keep3rHelper) external override onlyGovernance {\n if (_keep3rHelper == address(0)) revert ZeroAddress();\n keep3rHelper = _keep3rHelper;\n emit Keep3rHelperChange(_keep3rHelper);\n }\n\n /// @inheritdoc IKeep3rParameters\n function setKeep3rV1(address _keep3rV1) external override onlyGovernance {\n if (_keep3rV1 == address(0)) revert ZeroAddress();\n keep3rV1 = _keep3rV1;\n emit Keep3rV1Change(_keep3rV1);\n }\n\n /// @inheritdoc IKeep3rParameters\n function setKeep3rV1Proxy(address _keep3rV1Proxy) external override onlyGovernance {\n if (_keep3rV1Proxy == address(0)) revert ZeroAddress();\n keep3rV1Proxy = _keep3rV1Proxy;\n emit Keep3rV1ProxyChange(_keep3rV1Proxy);\n }\n\n /// @inheritdoc IKeep3rParameters\n function setBondTime(uint256 _bondTime) external override onlyGovernance {\n bondTime = _bondTime;\n emit BondTimeChange(_bondTime);\n }\n\n /// @inheritdoc IKeep3rParameters\n function setUnbondTime(uint256 _unbondTime) external override onlyGovernance {\n unbondTime = _unbondTime;\n emit UnbondTimeChange(_unbondTime);\n }\n\n /// @inheritdoc IKeep3rParameters\n function setLiquidityMinimum(uint256 _liquidityMinimum) external override onlyGovernance {\n liquidityMinimum = _liquidityMinimum;\n emit LiquidityMinimumChange(_liquidityMinimum);\n }\n\n /// @inheritdoc IKeep3rParameters\n // TODO: check what happens to credit minting when changing this. Shouldn't we update the cached ticks?\n function setRewardPeriodTime(uint256 _rewardPeriodTime) external override onlyGovernance {\n if (_rewardPeriodTime < _MIN_REWARD_PERIOD_TIME) revert MinRewardPeriod();\n rewardPeriodTime = _rewardPeriodTime;\n emit RewardPeriodTimeChange(_rewardPeriodTime);\n }\n\n /// @inheritdoc IKeep3rParameters\n function setInflationPeriod(uint256 _inflationPeriod) external override onlyGovernance {\n inflationPeriod = _inflationPeriod;\n emit InflationPeriodChange(_inflationPeriod);\n }\n\n /// @inheritdoc IKeep3rParameters\n function setFee(uint256 _fee) external override onlyGovernance {\n fee = _fee;\n emit FeeChange(_fee);\n }\n}\n" - }, - "@openzeppelin/contracts/security/ReentrancyGuard.sol": { - "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Contract module that helps prevent reentrant calls to a function.\n *\n * Inheriting from `ReentrancyGuard` will make the {nonReentrant} modifier\n * available, which can be applied to functions to make sure there are no nested\n * (reentrant) calls to them.\n *\n * Note that because there is a single `nonReentrant` guard, functions marked as\n * `nonReentrant` may not call one another. This can be worked around by making\n * those functions `private`, and then adding `external` `nonReentrant` entry\n * points to them.\n *\n * TIP: If you would like to learn more about reentrancy and alternative ways\n * to protect against it, check out our blog post\n * https://blog.openzeppelin.com/reentrancy-after-istanbul/[Reentrancy After Istanbul].\n */\nabstract contract ReentrancyGuard {\n // Booleans are more expensive than uint256 or any type that takes up a full\n // word because each write operation emits an extra SLOAD to first read the\n // slot's contents, replace the bits taken up by the boolean, and then write\n // back. This is the compiler's defense against contract upgrades and\n // pointer aliasing, and it cannot be disabled.\n\n // The values being non-zero value makes deployment a bit more expensive,\n // but in exchange the refund on every call to nonReentrant will be lower in\n // amount. Since refunds are capped to a percentage of the total\n // transaction's gas, it is best to keep them low in cases like this one, to\n // increase the likelihood of the full refund coming into effect.\n uint256 private constant _NOT_ENTERED = 1;\n uint256 private constant _ENTERED = 2;\n\n uint256 private _status;\n\n constructor() {\n _status = _NOT_ENTERED;\n }\n\n /**\n * @dev Prevents a contract from calling itself, directly or indirectly.\n * Calling a `nonReentrant` function from another `nonReentrant`\n * function is not supported. It is possible to prevent this from happening\n * by making the `nonReentrant` function external, and make it call a\n * `private` function that does the actual work.\n */\n modifier nonReentrant() {\n // On the first call to nonReentrant, _notEntered will be true\n require(_status != _ENTERED, \"ReentrancyGuard: reentrant call\");\n\n // Any calls to nonReentrant after this point will fail\n _status = _ENTERED;\n\n _;\n\n // By storing the original value once again, a refund is triggered (see\n // https://eips.ethereum.org/EIPS/eip-2200)\n _status = _NOT_ENTERED;\n }\n}\n" - }, - "@openzeppelin/contracts/utils/math/Math.sol": { - "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Standard math utilities missing in the Solidity language.\n */\nlibrary Math {\n /**\n * @dev Returns the largest of two numbers.\n */\n function max(uint256 a, uint256 b) internal pure returns (uint256) {\n return a >= b ? a : b;\n }\n\n /**\n * @dev Returns the smallest of two numbers.\n */\n function min(uint256 a, uint256 b) internal pure returns (uint256) {\n return a < b ? a : b;\n }\n\n /**\n * @dev Returns the average of two numbers. The result is rounded towards\n * zero.\n */\n function average(uint256 a, uint256 b) internal pure returns (uint256) {\n // (a + b) / 2 can overflow.\n return (a & b) + (a ^ b) / 2;\n }\n\n /**\n * @dev Returns the ceiling of the division of two numbers.\n *\n * This differs from standard division with `/` in that it rounds up instead\n * of rounding down.\n */\n function ceilDiv(uint256 a, uint256 b) internal pure returns (uint256) {\n // (a + b - 1) / b can overflow on addition, so we distribute.\n return a / b + (a % b == 0 ? 0 : 1);\n }\n}\n" - }, - "solidity/interfaces/IKeep3rHelperParameters.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\n/// @title Keep3rHelperParameters contract\n/// @notice Contains all the helper functions used throughout the different files.\ninterface IKeep3rHelperParameters {\n // Structs\n\n /// @dev KP3R-WETH Pool address and isKP3RToken0\n /// @dev Created in order to save gas by avoiding calls to pool's token0 method\n struct TokenOraclePool {\n address poolAddress;\n bool isTKNToken0;\n }\n\n // Errors\n\n /// @notice Throws when pool does not have KP3R as token0 nor token1\n error InvalidOraclePool();\n\n // Events\n\n /// @notice Emitted when the kp3r weth pool is changed\n /// @param _address Address of the new kp3r weth pool\n /// @param _isKP3RToken0 True if calling the token0 method of the pool returns the KP3R token address\n event Kp3rWethPoolChange(address _address, bool _isKP3RToken0);\n\n /// @notice Emitted when the minimum boost multiplier is changed\n /// @param _minBoost The minimum boost multiplier\n event MinBoostChange(uint256 _minBoost);\n\n /// @notice Emitted when the maximum boost multiplier is changed\n /// @param _maxBoost The maximum boost multiplier\n event MaxBoostChange(uint256 _maxBoost);\n\n /// @notice Emitted when the target bond amount is changed\n /// @param _targetBond The target bond amount\n event TargetBondChange(uint256 _targetBond);\n\n /// @notice Emitted when the Keep3r V2 address is changed\n /// @param _keep3rV2 The address of Keep3r V2\n event Keep3rV2Change(address _keep3rV2);\n\n /// @notice Emitted when the work extra gas amount is changed\n /// @param _workExtraGas The work extra gas\n event WorkExtraGasChange(uint256 _workExtraGas);\n\n /// @notice Emitted when the quote twap time is changed\n /// @param _quoteTwapTime The twap time for quoting\n event QuoteTwapTimeChange(uint32 _quoteTwapTime);\n\n /// @notice Emitted when minimum rewarded gas fee is changed\n /// @param _minBaseFee The minimum rewarded gas fee\n event MinBaseFeeChange(uint256 _minBaseFee);\n\n /// @notice Emitted when minimum rewarded priority fee is changed\n /// @param _minPriorityFee The minimum expected fee that the keeper should pay\n event MinPriorityFeeChange(uint256 _minPriorityFee);\n\n // Variables\n\n /// @notice Address of KP3R token\n /// @return _kp3r Address of KP3R token\n // solhint-disable func-name-mixedcase\n function KP3R() external view returns (address _kp3r);\n\n /// @notice The boost base used to calculate the boost rewards for the keeper\n /// @return _base The boost base number\n function BOOST_BASE() external view returns (uint256 _base);\n\n /// @notice KP3R-WETH pool that is being used as oracle\n /// @return poolAddress Address of the pool\n /// @return isTKNToken0 True if calling the token0 method of the pool returns the KP3R token address\n function kp3rWethPool() external view returns (address poolAddress, bool isTKNToken0);\n\n /// @notice The minimum multiplier used to calculate the amount of gas paid to the Keeper for the gas used to perform a job\n /// For example: if the quoted gas used is 1000, then the minimum amount to be paid will be 1000 * minBoost / BOOST_BASE\n /// @return _multiplier The minimum boost multiplier\n function minBoost() external view returns (uint256 _multiplier);\n\n /// @notice The maximum multiplier used to calculate the amount of gas paid to the Keeper for the gas used to perform a job\n /// For example: if the quoted gas used is 1000, then the maximum amount to be paid will be 1000 * maxBoost / BOOST_BASE\n /// @return _multiplier The maximum boost multiplier\n function maxBoost() external view returns (uint256 _multiplier);\n\n /// @notice The targeted amount of bonded KP3Rs to max-up reward multiplier\n /// For example: if the amount of KP3R the keeper has bonded is targetBond or more, then the keeper will get\n /// the maximum boost possible in his rewards, if it's less, the reward boost will be proportional\n /// @return _target The amount of KP3R that comforms the targetBond\n function targetBond() external view returns (uint256 _target);\n\n /// @notice The amount of unaccounted gas that is going to be added to keeper payments\n /// @return _workExtraGas The work unaccounted gas amount\n function workExtraGas() external view returns (uint256 _workExtraGas);\n\n /// @notice The twap time for quoting\n /// @return _quoteTwapTime The twap time\n function quoteTwapTime() external view returns (uint32 _quoteTwapTime);\n\n /// @notice The minimum base fee that is used to calculate keeper rewards\n /// @return _minBaseFee The minimum rewarded gas fee\n function minBaseFee() external view returns (uint256 _minBaseFee);\n\n /// @notice The minimum priority fee that is also rewarded for keepers\n /// @return _minPriorityFee The minimum rewarded priority fee\n function minPriorityFee() external view returns (uint256 _minPriorityFee);\n\n /// @notice Address of Keep3r V2\n /// @return _keep3rV2 Address of Keep3r V2\n function keep3rV2() external view returns (address _keep3rV2);\n\n // Methods\n\n /// @notice Sets KP3R-WETH pool\n /// @param _poolAddress The address of the KP3R-WETH pool\n function setKp3rWethPool(address _poolAddress) external;\n\n /// @notice Sets the minimum boost multiplier\n /// @param _minBoost The minimum boost multiplier\n function setMinBoost(uint256 _minBoost) external;\n\n /// @notice Sets the maximum boost multiplier\n /// @param _maxBoost The maximum boost multiplier\n function setMaxBoost(uint256 _maxBoost) external;\n\n /// @notice Sets the target bond amount\n /// @param _targetBond The target bond amount\n function setTargetBond(uint256 _targetBond) external;\n\n /// @notice Sets the Keep3r V2 address\n /// @param _keep3rV2 The address of Keep3r V2\n function setKeep3rV2(address _keep3rV2) external;\n\n /// @notice Sets the work extra gas amount\n /// @param _workExtraGas The work extra gas\n function setWorkExtraGas(uint256 _workExtraGas) external;\n\n /// @notice Sets the quote twap time\n /// @param _quoteTwapTime The twap time for quoting\n function setQuoteTwapTime(uint32 _quoteTwapTime) external;\n\n /// @notice Sets the minimum rewarded gas fee\n /// @param _minBaseFee The minimum rewarded gas fee\n function setMinBaseFee(uint256 _minBaseFee) external;\n\n /// @notice Sets the minimum rewarded gas priority fee\n /// @param _minPriorityFee The minimum rewarded priority fee\n function setMinPriorityFee(uint256 _minPriorityFee) external;\n}\n" - }, - "solidity/interfaces/IPairManager.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol';\n\n/// @title Pair Manager interface\n/// @notice Generic interface for Keep3r liquidity pools (kLP)\ninterface IPairManager is IERC20Metadata {\n /// @notice Address of the factory from which the pair manager was created\n /// @return _factory The address of the PairManager Factory\n function factory() external view returns (address _factory);\n\n /// @notice Address of the pool from which the Keep3r pair manager will interact with\n /// @return _pool The address of the pool\n function pool() external view returns (address _pool);\n\n /// @notice Token0 of the pool\n /// @return _token0 The address of token0\n function token0() external view returns (address _token0);\n\n /// @notice Token1 of the pool\n /// @return _token1 The address of token1\n function token1() external view returns (address _token1);\n}\n" - }, - "solidity/contracts/libraries/FullMath.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\n/// @title Contains 512-bit math functions\n/// @notice Facilitates multiplication and division that can have overflow of an intermediate value without any loss of precision\n/// @dev Handles \"phantom overflow\" i.e., allows multiplication and division where an intermediate value overflows 256 bits\nlibrary FullMath {\n /// @notice Calculates floor(a×b÷denominator) with full precision. Throws if result overflows a uint256 or denominator == 0\n /// @param a The multiplicand\n /// @param b The multiplier\n /// @param denominator The divisor\n /// @return result The 256-bit result\n /// @dev Credit to Remco Bloemen under MIT license https://xn--2-umb.com/21/muldiv\n function mulDiv(\n uint256 a,\n uint256 b,\n uint256 denominator\n ) internal pure returns (uint256 result) {\n unchecked {\n // 512-bit multiply [prod1 prod0] = a * b\n // Compute the product mod 2**256 and mod 2**256 - 1\n // then use the Chinese Remainder Theorem to reconstruct\n // the 512 bit result. The result is stored in two 256\n // variables such that product = prod1 * 2**256 + prod0\n uint256 prod0; // Least significant 256 bits of the product\n uint256 prod1; // Most significant 256 bits of the product\n assembly {\n let mm := mulmod(a, b, not(0))\n prod0 := mul(a, b)\n prod1 := sub(sub(mm, prod0), lt(mm, prod0))\n }\n\n // Handle non-overflow cases, 256 by 256 division\n if (prod1 == 0) {\n require(denominator > 0);\n assembly {\n result := div(prod0, denominator)\n }\n return result;\n }\n\n // Make sure the result is less than 2**256.\n // Also prevents denominator == 0\n require(denominator > prod1);\n\n ///////////////////////////////////////////////\n // 512 by 256 division.\n ///////////////////////////////////////////////\n\n // Make division exact by subtracting the remainder from [prod1 prod0]\n // Compute remainder using mulmod\n uint256 remainder;\n assembly {\n remainder := mulmod(a, b, denominator)\n }\n // Subtract 256 bit number from 512 bit number\n assembly {\n prod1 := sub(prod1, gt(remainder, prod0))\n prod0 := sub(prod0, remainder)\n }\n\n // Factor powers of two out of denominator\n // Compute largest power of two divisor of denominator.\n // Always >= 1.\n uint256 twos = (~denominator + 1) & denominator;\n // Divide denominator by power of two\n assembly {\n denominator := div(denominator, twos)\n }\n\n // Divide [prod1 prod0] by the factors of two\n assembly {\n prod0 := div(prod0, twos)\n }\n // Shift in bits from prod1 into prod0. For this we need\n // to flip `twos` such that it is 2**256 / twos.\n // If twos is zero, then it becomes one\n assembly {\n twos := add(div(sub(0, twos), twos), 1)\n }\n prod0 |= prod1 * twos;\n\n // Invert denominator mod 2**256\n // Now that denominator is an odd number, it has an inverse\n // modulo 2**256 such that denominator * inv = 1 mod 2**256.\n // Compute the inverse by starting with a seed that is correct\n // correct for four bits. That is, denominator * inv = 1 mod 2**4\n uint256 inv = (3 * denominator) ^ 2;\n // Now use Newton-Raphson iteration to improve the precision.\n // Thanks to Hensel's lifting lemma, this also works in modular\n // arithmetic, doubling the correct bits in each step.\n inv *= 2 - denominator * inv; // inverse mod 2**8\n inv *= 2 - denominator * inv; // inverse mod 2**16\n inv *= 2 - denominator * inv; // inverse mod 2**32\n inv *= 2 - denominator * inv; // inverse mod 2**64\n inv *= 2 - denominator * inv; // inverse mod 2**128\n inv *= 2 - denominator * inv; // inverse mod 2**256\n\n // Because the division is now exact we can divide by multiplying\n // with the modular inverse of denominator. This will give us the\n // correct result modulo 2**256. Since the precoditions guarantee\n // that the outcome is less than 2**256, this is the final result.\n // We don't need to compute the high bits of the result and prod1\n // is no longer required.\n result = prod0 * inv;\n return result;\n }\n }\n\n /// @notice Calculates ceil(a×b÷denominator) with full precision. Throws if result overflows a uint256 or denominator == 0\n /// @param a The multiplicand\n /// @param b The multiplier\n /// @param denominator The divisor\n /// @return result The 256-bit result\n function mulDivRoundingUp(\n uint256 a,\n uint256 b,\n uint256 denominator\n ) internal pure returns (uint256 result) {\n unchecked {\n result = mulDiv(a, b, denominator);\n if (mulmod(a, b, denominator) > 0) {\n require(result < type(uint256).max);\n result++;\n }\n }\n }\n}\n" - }, - "@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol": { - "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\nimport \"../IERC20.sol\";\n\n/**\n * @dev Interface for the optional metadata functions from the ERC20 standard.\n *\n * _Available since v4.1._\n */\ninterface IERC20Metadata is IERC20 {\n /**\n * @dev Returns the name of the token.\n */\n function name() external view returns (string memory);\n\n /**\n * @dev Returns the symbol of the token.\n */\n function symbol() external view returns (string memory);\n\n /**\n * @dev Returns the decimals places of the token.\n */\n function decimals() external view returns (uint8);\n}\n" - }, - "solidity/contracts/peripherals/Keep3rDisputable.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport './Keep3rParameters.sol';\nimport '../../interfaces/peripherals/IKeep3rDisputable.sol';\n\nabstract contract Keep3rDisputable is IKeep3rDisputable, Keep3rParameters {\n /// @inheritdoc IKeep3rDisputable\n function dispute(address _jobOrKeeper) external override onlyDisputer {\n if (disputes[_jobOrKeeper]) revert AlreadyDisputed();\n disputes[_jobOrKeeper] = true;\n emit Dispute(_jobOrKeeper, msg.sender);\n }\n\n /// @inheritdoc IKeep3rDisputable\n function resolve(address _jobOrKeeper) external override onlyDisputer {\n if (!disputes[_jobOrKeeper]) revert NotDisputed();\n disputes[_jobOrKeeper] = false;\n emit Resolve(_jobOrKeeper, msg.sender);\n }\n}\n" - }, - "solidity/contracts/peripherals/keepers/Keep3rKeeperDisputable.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport './Keep3rKeeperFundable.sol';\nimport '../Keep3rDisputable.sol';\nimport '../../../interfaces/external/IKeep3rV1.sol';\nimport '../../../interfaces/peripherals/IKeep3rKeepers.sol';\n\nabstract contract Keep3rKeeperDisputable is IKeep3rKeeperDisputable, Keep3rDisputable, Keep3rKeeperFundable {\n using EnumerableSet for EnumerableSet.AddressSet;\n using SafeERC20 for IERC20;\n\n /// @inheritdoc IKeep3rKeeperDisputable\n function slash(\n address _keeper,\n address _bonded,\n uint256 _bondAmount,\n uint256 _unbondAmount\n ) external override onlySlasher {\n if (!disputes[_keeper]) revert NotDisputed();\n _slash(_keeper, _bonded, _bondAmount, _unbondAmount);\n emit KeeperSlash(_keeper, msg.sender, _bondAmount + _unbondAmount);\n }\n\n /// @inheritdoc IKeep3rKeeperDisputable\n function revoke(address _keeper) external override onlySlasher {\n if (!disputes[_keeper]) revert NotDisputed();\n _keepers.remove(_keeper);\n _slash(_keeper, keep3rV1, bonds[_keeper][keep3rV1], pendingUnbonds[_keeper][keep3rV1]);\n emit KeeperRevoke(_keeper, msg.sender);\n }\n\n function _slash(\n address _keeper,\n address _bonded,\n uint256 _bondAmount,\n uint256 _unbondAmount\n ) internal {\n if (_bonded != keep3rV1) {\n try IERC20(_bonded).transfer(governance, _bondAmount + _unbondAmount) returns (bool) {} catch (bytes memory) {}\n }\n bonds[_keeper][_bonded] -= _bondAmount;\n pendingUnbonds[_keeper][_bonded] -= _unbondAmount;\n }\n}\n" - }, - "solidity/contracts/peripherals/keepers/Keep3rKeeperFundable.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../Keep3rAccountance.sol';\nimport '../Keep3rParameters.sol';\nimport '../../../interfaces/peripherals/IKeep3rKeepers.sol';\n\nimport '../../../interfaces/external/IKeep3rV1.sol';\nimport '../../../interfaces/external/IKeep3rV1Proxy.sol';\n\nimport '@openzeppelin/contracts/security/ReentrancyGuard.sol';\nimport '@openzeppelin/contracts/token/ERC20/IERC20.sol';\nimport '@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol';\n\nabstract contract Keep3rKeeperFundable is IKeep3rKeeperFundable, ReentrancyGuard, Keep3rParameters {\n using EnumerableSet for EnumerableSet.AddressSet;\n using SafeERC20 for IERC20;\n\n /// @inheritdoc IKeep3rKeeperFundable\n function bond(address _bonding, uint256 _amount) external override nonReentrant {\n if (disputes[msg.sender]) revert Disputed();\n if (_jobs.contains(msg.sender)) revert AlreadyAJob();\n canActivateAfter[msg.sender][_bonding] = block.timestamp + bondTime;\n\n uint256 _before = IERC20(_bonding).balanceOf(address(this));\n IERC20(_bonding).safeTransferFrom(msg.sender, address(this), _amount);\n _amount = IERC20(_bonding).balanceOf(address(this)) - _before;\n\n hasBonded[msg.sender] = true;\n pendingBonds[msg.sender][_bonding] += _amount;\n\n emit Bonding(msg.sender, _bonding, _amount);\n }\n\n /// @inheritdoc IKeep3rKeeperFundable\n function activate(address _bonding) external override {\n address _keeper = msg.sender;\n if (disputes[_keeper]) revert Disputed();\n uint256 _canActivateAfter = canActivateAfter[_keeper][_bonding];\n if (_canActivateAfter == 0) revert BondsUnexistent();\n if (_canActivateAfter >= block.timestamp) revert BondsLocked();\n\n if (firstSeen[_keeper] == 0) {\n firstSeen[_keeper] = block.timestamp;\n }\n _keepers.add(_keeper);\n\n uint256 _amount = pendingBonds[_keeper][_bonding];\n delete pendingBonds[_keeper][_bonding];\n\n _activate(_keeper, _bonding, _amount);\n emit Activation(_keeper, _bonding, _amount);\n }\n\n /// @inheritdoc IKeep3rKeeperFundable\n function unbond(address _bonding, uint256 _amount) external override {\n canWithdrawAfter[msg.sender][_bonding] = block.timestamp + unbondTime;\n bonds[msg.sender][_bonding] -= _amount;\n pendingUnbonds[msg.sender][_bonding] += _amount;\n\n emit Unbonding(msg.sender, _bonding, _amount);\n }\n\n /// @inheritdoc IKeep3rKeeperFundable\n function withdraw(address _bonding) external override nonReentrant {\n if (pendingUnbonds[msg.sender][_bonding] == 0) revert UnbondsUnexistent();\n if (canWithdrawAfter[msg.sender][_bonding] >= block.timestamp) revert UnbondsLocked();\n if (disputes[msg.sender]) revert Disputed();\n\n uint256 _amount = pendingUnbonds[msg.sender][_bonding];\n\n delete pendingUnbonds[msg.sender][_bonding];\n delete canWithdrawAfter[msg.sender][_bonding];\n\n if (_bonding == keep3rV1) _mint(_amount);\n IERC20(_bonding).safeTransfer(msg.sender, _amount);\n\n emit Withdrawal(msg.sender, _bonding, _amount);\n }\n\n function _mint(uint256 _amount) internal virtual {\n IKeep3rV1Proxy(keep3rV1Proxy).mint(_amount);\n }\n\n function _activate(\n address _keeper,\n address _bonding,\n uint256 _amount\n ) internal virtual {\n // bond provided tokens\n bonds[_keeper][_bonding] += _amount;\n if (_bonding == keep3rV1) {\n IKeep3rV1(keep3rV1).burn(_amount);\n }\n }\n}\n" - }, - "solidity/interfaces/external/IKeep3rV1.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '@openzeppelin/contracts/token/ERC20/IERC20.sol';\nimport '@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol';\n\n// solhint-disable func-name-mixedcase\ninterface IKeep3rV1 is IERC20, IERC20Metadata {\n // Structs\n struct Checkpoint {\n uint32 fromBlock;\n uint256 votes;\n }\n\n // Events\n event DelegateChanged(address indexed _delegator, address indexed _fromDelegate, address indexed _toDelegate);\n event DelegateVotesChanged(address indexed _delegate, uint256 _previousBalance, uint256 _newBalance);\n event SubmitJob(address indexed _job, address indexed _liquidity, address indexed _provider, uint256 _block, uint256 _credit);\n event ApplyCredit(address indexed _job, address indexed _liquidity, address indexed _provider, uint256 _block, uint256 _credit);\n event RemoveJob(address indexed _job, address indexed _liquidity, address indexed _provider, uint256 _block, uint256 _credit);\n event UnbondJob(address indexed _job, address indexed _liquidity, address indexed _provider, uint256 _block, uint256 _credit);\n event JobAdded(address indexed _job, uint256 _block, address _governance);\n event JobRemoved(address indexed _job, uint256 _block, address _governance);\n event KeeperWorked(address indexed _credit, address indexed _job, address indexed _keeper, uint256 _block, uint256 _amount);\n event KeeperBonding(address indexed _keeper, uint256 _block, uint256 _active, uint256 _bond);\n event KeeperBonded(address indexed _keeper, uint256 _block, uint256 _activated, uint256 _bond);\n event KeeperUnbonding(address indexed _keeper, uint256 _block, uint256 _deactive, uint256 _bond);\n event KeeperUnbound(address indexed _keeper, uint256 _block, uint256 _deactivated, uint256 _bond);\n event KeeperSlashed(address indexed _keeper, address indexed _slasher, uint256 _block, uint256 _slash);\n event KeeperDispute(address indexed _keeper, uint256 _block);\n event KeeperResolved(address indexed _keeper, uint256 _block);\n event TokenCreditAddition(address indexed _credit, address indexed _job, address indexed _creditor, uint256 _block, uint256 _amount);\n\n // Variables\n function KPRH() external returns (address);\n\n function delegates(address _delegator) external view returns (address);\n\n function checkpoints(address _account, uint32 _checkpoint) external view returns (Checkpoint memory);\n\n function numCheckpoints(address _account) external view returns (uint32);\n\n function DOMAIN_TYPEHASH() external returns (bytes32);\n\n function DOMAINSEPARATOR() external returns (bytes32);\n\n function DELEGATION_TYPEHASH() external returns (bytes32);\n\n function PERMIT_TYPEHASH() external returns (bytes32);\n\n function nonces(address _user) external view returns (uint256);\n\n function BOND() external returns (uint256);\n\n function UNBOND() external returns (uint256);\n\n function LIQUIDITYBOND() external returns (uint256);\n\n function FEE() external returns (uint256);\n\n function BASE() external returns (uint256);\n\n function ETH() external returns (address);\n\n function bondings(address _user, address _bonding) external view returns (uint256);\n\n function canWithdrawAfter(address _user, address _bonding) external view returns (uint256);\n\n function pendingUnbonds(address _keeper, address _bonding) external view returns (uint256);\n\n function pendingbonds(address _keeper, address _bonding) external view returns (uint256);\n\n function bonds(address _keeper, address _bonding) external view returns (uint256);\n\n function votes(address _delegator) external view returns (uint256);\n\n function firstSeen(address _keeper) external view returns (uint256);\n\n function disputes(address _keeper) external view returns (bool);\n\n function lastJob(address _keeper) external view returns (uint256);\n\n function workCompleted(address _keeper) external view returns (uint256);\n\n function jobs(address _job) external view returns (bool);\n\n function credits(address _job, address _credit) external view returns (uint256);\n\n function liquidityProvided(\n address _provider,\n address _liquidity,\n address _job\n ) external view returns (uint256);\n\n function liquidityUnbonding(\n address _provider,\n address _liquidity,\n address _job\n ) external view returns (uint256);\n\n function liquidityAmountsUnbonding(\n address _provider,\n address _liquidity,\n address _job\n ) external view returns (uint256);\n\n function jobProposalDelay(address _job) external view returns (uint256);\n\n function liquidityApplied(\n address _provider,\n address _liquidity,\n address _job\n ) external view returns (uint256);\n\n function liquidityAmount(\n address _provider,\n address _liquidity,\n address _job\n ) external view returns (uint256);\n\n function keepers(address _keeper) external view returns (bool);\n\n function blacklist(address _keeper) external view returns (bool);\n\n function keeperList(uint256 _index) external view returns (address);\n\n function jobList(uint256 _index) external view returns (address);\n\n function governance() external returns (address);\n\n function pendingGovernance() external returns (address);\n\n function liquidityAccepted(address _liquidity) external view returns (bool);\n\n function liquidityPairs(uint256 _index) external view returns (address);\n\n // Methods\n function getCurrentVotes(address _account) external view returns (uint256);\n\n function addCreditETH(address _job) external payable;\n\n function addCredit(\n address _credit,\n address _job,\n uint256 _amount\n ) external;\n\n function addVotes(address _voter, uint256 _amount) external;\n\n function removeVotes(address _voter, uint256 _amount) external;\n\n function addKPRCredit(address _job, uint256 _amount) external;\n\n function approveLiquidity(address _liquidity) external;\n\n function revokeLiquidity(address _liquidity) external;\n\n function pairs() external view returns (address[] memory);\n\n function addLiquidityToJob(\n address _liquidity,\n address _job,\n uint256 _amount\n ) external;\n\n function applyCreditToJob(\n address _provider,\n address _liquidity,\n address _job\n ) external;\n\n function unbondLiquidityFromJob(\n address _liquidity,\n address _job,\n uint256 _amount\n ) external;\n\n function removeLiquidityFromJob(address _liquidity, address _job) external;\n\n function mint(uint256 _amount) external;\n\n function burn(uint256 _amount) external;\n\n function worked(address _keeper) external;\n\n function receipt(\n address _credit,\n address _keeper,\n uint256 _amount\n ) external;\n\n function receiptETH(address _keeper, uint256 _amount) external;\n\n function addJob(address _job) external;\n\n function getJobs() external view returns (address[] memory);\n\n function removeJob(address _job) external;\n\n function setKeep3rHelper(address _keep3rHelper) external;\n\n function setGovernance(address _governance) external;\n\n function acceptGovernance() external;\n\n function isKeeper(address _keeper) external returns (bool);\n\n function isMinKeeper(\n address _keeper,\n uint256 _minBond,\n uint256 _earned,\n uint256 _age\n ) external returns (bool);\n\n function isBondedKeeper(\n address _keeper,\n address _bond,\n uint256 _minBond,\n uint256 _earned,\n uint256 _age\n ) external returns (bool);\n\n function bond(address _bonding, uint256 _amount) external;\n\n function getKeepers() external view returns (address[] memory);\n\n function activate(address _bonding) external;\n\n function unbond(address _bonding, uint256 _amount) external;\n\n function slash(\n address _bonded,\n address _keeper,\n uint256 _amount\n ) external;\n\n function withdraw(address _bonding) external;\n\n function dispute(address _keeper) external;\n\n function revoke(address _keeper) external;\n\n function resolve(address _keeper) external;\n\n function permit(\n address _owner,\n address _spender,\n uint256 _amount,\n uint256 _deadline,\n uint8 _v,\n bytes32 _r,\n bytes32 _s\n ) external;\n}\n" - }, - "solidity/interfaces/external/IKeep3rV1Proxy.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../peripherals/IGovernable.sol';\n\ninterface IKeep3rV1Proxy is IGovernable {\n // Structs\n struct Recipient {\n address recipient;\n uint256 caps;\n }\n\n // Variables\n function keep3rV1() external view returns (address);\n\n function minter() external view returns (address);\n\n function next(address) external view returns (uint256);\n\n function caps(address) external view returns (uint256);\n\n function recipients() external view returns (address[] memory);\n\n function recipientsCaps() external view returns (Recipient[] memory);\n\n // Errors\n error Cooldown();\n error NoDrawableAmount();\n error ZeroAddress();\n error OnlyMinter();\n\n // Methods\n function addRecipient(address recipient, uint256 amount) external;\n\n function removeRecipient(address recipient) external;\n\n function draw() external returns (uint256 _amount);\n\n function setKeep3rV1(address _keep3rV1) external;\n\n function setMinter(address _minter) external;\n\n function mint(uint256 _amount) external;\n\n function mint(address _account, uint256 _amount) external;\n\n function setKeep3rV1Governance(address _governance) external;\n\n function acceptKeep3rV1Governance() external;\n\n function dispute(address _keeper) external;\n\n function slash(\n address _bonded,\n address _keeper,\n uint256 _amount\n ) external;\n\n function revoke(address _keeper) external;\n\n function resolve(address _keeper) external;\n\n function addJob(address _job) external;\n\n function removeJob(address _job) external;\n\n function addKPRCredit(address _job, uint256 _amount) external;\n\n function approveLiquidity(address _liquidity) external;\n\n function revokeLiquidity(address _liquidity) external;\n\n function setKeep3rHelper(address _keep3rHelper) external;\n\n function addVotes(address _voter, uint256 _amount) external;\n\n function removeVotes(address _voter, uint256 _amount) external;\n}\n" - }, - "solidity/for-test/testnet/Keep3rForTestnet.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../../contracts/Keep3r.sol';\n\ncontract Keep3rForTestnet is Keep3r {\n constructor(\n address _governance,\n address _keep3rHelper,\n address _keep3rV1,\n address _keep3rV1Proxy\n ) Keep3r(_governance, _keep3rHelper, _keep3rV1, _keep3rV1Proxy) {\n bondTime = 0; // allows keepers to instantly register\n unbondTime = 0; // allows keepers & jobOwners to instantly withdraw funds\n liquidityMinimum = 1; // allows job providers to add low liquidity\n rewardPeriodTime = 1 days; // reduces twap calculation period\n inflationPeriod = 5 days; // increases credit mintint\n }\n}\n" - }, - "solidity/for-test/Keep3rForTest.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../contracts/Keep3r.sol';\n\ncontract Keep3rForTest is Keep3r {\n constructor(\n address _governance,\n address _keep3rHelper,\n address _keep3rV1,\n address _keep3rV1Proxy\n ) Keep3r(_governance, _keep3rHelper, _keep3rV1, _keep3rV1Proxy) {}\n}\n" - }, - "solidity/contracts/sidechain/Keep3rSidechain.sol": { - "content": "// SPDX-License-Identifier: MIT\n\n/*\n\nCoded for The Keep3r Network with ♥ by\n\n██████╗░███████╗███████╗██╗  ░██╗░░░░░░░██╗░█████╗░███╗░░██╗██████╗░███████╗██████╗░██╗░░░░░░█████╗░███╗░░██╗██████╗░\n██╔══██╗██╔════╝██╔════╝██║  ░██║░░██╗░░██║██╔══██╗████╗░██║██╔══██╗██╔════╝██╔══██╗██║░░░░░██╔══██╗████╗░██║██╔══██╗\n██║░░██║█████╗░░█████╗░░██║  ░╚██╗████╗██╔╝██║░░██║██╔██╗██║██║░░██║█████╗░░██████╔╝██║░░░░░███████║██╔██╗██║██║░░██║\n██║░░██║██╔══╝░░██╔══╝░░██║  ░░████╔═████║░██║░░██║██║╚████║██║░░██║██╔══╝░░██╔══██╗██║░░░░░██╔══██║██║╚████║██║░░██║\n██████╔╝███████╗██║░░░░░██║  ░░╚██╔╝░╚██╔╝░╚█████╔╝██║░╚███║██████╔╝███████╗██║░░██║███████╗██║░░██║██║░╚███║██████╔╝\n╚═════╝░╚══════╝╚═╝░░░░░╚═╝  ░░░╚═╝░░░╚═╝░░░╚════╝░╚═╝░░╚══╝╚═════╝░╚══════╝╚═╝░░╚═╝╚══════╝╚═╝░░╚═╝╚═╝░░╚══╝╚═════╝░\n\nhttps://defi.sucks\n\n*/\n\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../Keep3r.sol';\nimport '../../interfaces/sidechain/IKeep3rEscrow.sol';\nimport '../../interfaces/sidechain/IKeep3rHelperSidechain.sol';\nimport '../../interfaces/sidechain/IKeep3rJobWorkableRated.sol';\nimport '../../interfaces/sidechain/IKeep3rSidechainAccountance.sol';\n\ncontract Keep3rSidechain is Keep3r, IKeep3rJobWorkableRated, IKeep3rSidechainAccountance {\n using EnumerableSet for EnumerableSet.AddressSet;\n\n /// @param _governance Address of governance\n /// @param _keep3rHelperSidechain Address of sidechain Keep3rHelper\n /// @param _wrappedKP3R Address of wrapped KP3R implementation\n /// @param _keep3rEscrow Address of sidechain Keep3rEscrow\n constructor(\n address _governance, // governance\n address _keep3rHelperSidechain, // helper\n address _wrappedKP3R, // keep3rV1\n address _keep3rEscrow // keep3rV1Proxy\n ) Keep3r(_governance, _keep3rHelperSidechain, _wrappedKP3R, _keep3rEscrow) {}\n\n // Keep3rSidechainAccountance\n\n /// @inheritdoc IKeep3rSidechainAccountance\n uint256 public override totalBonds;\n\n /// @inheritdoc IKeep3rSidechainAccountance\n function virtualReserves() external view override returns (uint256 _virtualReserves) {\n // Queries wKP3R balanceOf escrow contract minus the totalBonds\n return IERC20(keep3rV1).balanceOf(keep3rV1Proxy) - totalBonds;\n }\n\n // Keep3rJobFundableLiquidity\n\n /// @notice Sidechain implementation asks the Helper for an oracle, instead of reading it from the ERC-20\n /// @dev Function should be called after setting an oracle in Keep3rHelperSidechain\n /// @param _liquidity Address of the liquidity token being approved\n function approveLiquidity(address _liquidity) external virtual override onlyGovernance {\n if (!_approvedLiquidities.add(_liquidity)) revert LiquidityPairApproved();\n _liquidityPool[_liquidity] = IKeep3rHelperSidechain(keep3rHelper).oracle(_liquidity);\n if (_liquidityPool[_liquidity] == address(0)) revert ZeroAddress();\n _isKP3RToken0[_liquidity] = IKeep3rHelper(keep3rHelper).isKP3RToken0(_liquidityPool[_liquidity]);\n _tick[_liquidity] = observeLiquidity(_liquidity);\n emit LiquidityApproval(_liquidity);\n }\n\n /// @notice Sidechain implementation will always ask for 2 tickCumulatives instead of cacheing\n /// @param _liquidity Address of the liquidity token being observed\n function observeLiquidity(address _liquidity) public view virtual override returns (TickCache memory _tickCache) {\n if (_tick[_liquidity].period == _period(block.timestamp)) {\n // Will return cached twaps if liquidity is updated\n _tickCache = _tick[_liquidity];\n } else {\n bool success;\n\n // Will always ask for 2 accumulators in sidechain\n uint32[] memory _secondsAgo = new uint32[](2);\n\n _secondsAgo[0] = uint32(block.timestamp - _period(block.timestamp));\n _secondsAgo[1] = uint32(block.timestamp - _period(block.timestamp) + rewardPeriodTime);\n\n int56 _tickCumulative2;\n (_tickCache.current, _tickCumulative2, success) = IKeep3rHelper(keep3rHelper).observe(_liquidityPool[_liquidity], _secondsAgo);\n\n _tickCache.difference = _tickCache.current - _tickCumulative2;\n\n if (success) {\n _tickCache.period = _period(block.timestamp);\n } else {\n delete _tickCache.period;\n }\n }\n }\n\n // Keep3rJobsWorkable\n\n /// @dev Sidechain implementation deprecates worked(address) as it should come with a usdPerGasUnit parameter\n function worked(address) external pure override {\n revert Deprecated();\n }\n\n /// @notice Implemented by jobs to show that a keeper performed work\n /// @dev Uses a USD per gas unit payment mechanism\n /// @param _keeper Address of the keeper that performed the work\n /// @param _usdPerGasUnit Units of USD (in wei) per gas unit that should be rewarded to the keeper\n function worked(address _keeper, uint256 _usdPerGasUnit) external override {\n if (_initialGas == 0) revert GasNotInitialized();\n // Gas used for quote calculations & payment is not rewarded\n uint256 _gasRecord = _getGasLeft();\n\n address _job = msg.sender;\n if (disputes[_job]) revert JobDisputed();\n if (!_jobs.contains(_job)) revert JobUnapproved();\n\n if (_updateJobCreditsIfNeeded(_job)) {\n emit LiquidityCreditsReward(_job, rewardedAt[_job], _jobLiquidityCredits[_job], _jobPeriodCredits[_job]);\n }\n\n uint256 _boost = IKeep3rHelper(keep3rHelper).getRewardBoostFor(bonds[_keeper][keep3rV1]);\n uint256 _ratedPayment = (_usdPerGasUnit * (_initialGas - _gasRecord) * _boost) / _BASE;\n\n uint256 _ethPayment = IKeep3rHelperSidechain(keep3rHelper).quoteUsdToEth(_ratedPayment);\n uint256 _kp3rPayment = IKeep3rHelper(keep3rHelper).quote(_ethPayment);\n\n if (_kp3rPayment > _jobLiquidityCredits[_job]) {\n _rewardJobCredits(_job);\n emit LiquidityCreditsReward(_job, rewardedAt[_job], _jobLiquidityCredits[_job], _jobPeriodCredits[_job]);\n }\n\n totalBonds += _kp3rPayment;\n _bondedPayment(_job, _keeper, _kp3rPayment);\n delete _initialGas;\n\n emit KeeperWork(keep3rV1, _job, _keeper, _kp3rPayment, _gasRecord);\n }\n\n // Keep3rKeeperFundable\n\n /// @dev Sidechain implementation doesn't burn tokens, but deposit them in Keep3rEscrow\n function _activate(\n address _keeper,\n address _bonding,\n uint256 _amount\n ) internal virtual override {\n // bond provided tokens\n bonds[_keeper][_bonding] += _amount;\n if (_bonding == keep3rV1) {\n totalBonds += _amount;\n IKeep3rV1(keep3rV1).approve(keep3rV1Proxy, _amount);\n IKeep3rEscrow(keep3rV1Proxy).deposit(_amount);\n }\n }\n\n function _mint(uint256 _amount) internal virtual override {\n totalBonds -= _amount;\n super._mint(_amount);\n }\n}\n" - }, - "solidity/interfaces/sidechain/IKeep3rEscrow.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\n// solhint-disable-next-line no-empty-blocks\n\nimport '../peripherals/IMintable.sol';\n\n/// @title Keep3rEscrow contract\n/// @notice This contract acts as an escrow contract for wKP3R tokens on sidechains and L2s\n/// @dev Can be used as a replacement for keep3rV1Proxy in keep3r sidechain implementations\ninterface IKeep3rEscrow is IMintable {\n /// @notice Emitted when Keep3rEscrow#deposit function is called\n /// @param _wKP3R The addess of the wrapped KP3R token\n /// @param _sender The address that called the function\n /// @param _amount The amount of wKP3R the user deposited\n event wKP3RDeposited(address _wKP3R, address _sender, uint256 _amount);\n\n /// @notice Emitted when Keep3rEscrow#mint function is called\n /// @param _wKP3R The addess of the wrapped KP3R token\n /// @param _recipient The address that will received the newly minted wKP3R\n /// @param _amount The amount of wKP3R minted to the recipient\n event wKP3RMinted(address _wKP3R, address _recipient, uint256 _amount);\n\n /// @notice Emitted when Keep3rEscrow#setWKP3R function is called\n /// @param _newWKP3R The address of the wKP3R contract\n event wKP3RSet(address _newWKP3R);\n\n /// @notice Throws when minter attempts to withdraw more wKP3R than the escrow has in its balance\n error InsufficientBalance();\n\n /// @notice Lists the address of the wKP3R contract\n /// @return _wKP3RAddress The address of wKP3R\n function wKP3R() external view returns (address _wKP3RAddress);\n\n /// @notice Deposits wKP3R into the contract\n /// @param _amount The amount of wKP3R to deposit\n function deposit(uint256 _amount) external;\n\n /// @notice mints wKP3R to the recipient\n /// @param _amount The amount of wKP3R to mint\n function mint(uint256 _amount) external;\n\n /// @notice sets the wKP3R address\n /// @param _wKP3R the wKP3R address\n function setWKP3R(address _wKP3R) external;\n}\n" - }, - "solidity/interfaces/sidechain/IKeep3rHelperSidechain.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../IKeep3rHelper.sol';\n\n/// @title Keep3rHelperSidechain contract\n/// @notice Contains all the helper functions for sidechain keep3r implementations\ninterface IKeep3rHelperSidechain is IKeep3rHelper {\n // Events\n\n /// @notice The oracle for a liquidity has been saved\n /// @param _liquidity The address of the given liquidity\n /// @param _oraclePool The address of the oracle pool\n event OracleSet(address _liquidity, address _oraclePool);\n\n /// @notice Emitted when the WETH USD pool is changed\n /// @param _address Address of the new WETH USD pool\n /// @param _isWETHToken0 True if calling the token0 method of the pool returns the WETH token address\n event WethUSDPoolChange(address _address, bool _isWETHToken0);\n\n /// Variables\n\n /// @notice Ethereum mainnet WETH address used for quoting references\n /// @return _weth Address of WETH token\n // solhint-disable func-name-mixedcase\n function WETH() external view returns (address _weth);\n\n /// @return _oracle The address of the observable pool for given liquidity\n function oracle(address _liquidity) external view returns (address _oracle);\n\n /// @notice WETH-USD pool that is being used as oracle\n /// @return poolAddress Address of the pool\n /// @return isTKNToken0 True if calling the token0 method of the pool returns the WETH token address\n function wethUSDPool() external view returns (address poolAddress, bool isTKNToken0);\n\n /// @notice Quotes USD to ETH\n /// @dev Used to know how much ETH should be paid to keepers before converting it from ETH to KP3R\n /// @param _usd The amount of USD to quote to ETH\n /// @return _eth The resulting amount of ETH after quoting the USD\n function quoteUsdToEth(uint256 _usd) external returns (uint256 _eth);\n\n /// Methods\n\n /// @notice Sets an oracle for a given liquidity\n /// @param _liquidity The address of the liquidity\n /// @param _oracle The address of the pool used to quote the liquidity from\n /// @dev The oracle must contain KP3R as either token0 or token1\n function setOracle(address _liquidity, address _oracle) external;\n\n /// @notice Sets an oracle for querying WETH/USD quote\n /// @param _poolAddress The address of the pool used as oracle\n /// @dev The oracle must contain WETH as either token0 or token1\n function setWethUsdPool(address _poolAddress) external;\n}\n" - }, - "solidity/interfaces/sidechain/IKeep3rJobWorkableRated.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../peripherals/IKeep3rJobs.sol';\n\n/// @title Keep3rJobWorkableRated contract\n/// @notice Implements a quoting in USD per gas unit for Keep3r jobs\ninterface IKeep3rJobWorkableRated is IKeep3rJobs {\n /// @notice Throws when job contract calls deprecated worked(address) function\n error Deprecated();\n\n /// @notice Implemented by jobs to show that a keeper performed work and reward in stable USD quote\n /// @dev Automatically calculates the payment for the keeper and pays the keeper with bonded KP3R\n /// @param _keeper Address of the keeper that performed the work\n /// @param _usdPerGasUnit Amount of USD in wei rewarded for gas unit worked by the keeper\n function worked(address _keeper, uint256 _usdPerGasUnit) external;\n}\n" - }, - "solidity/interfaces/sidechain/IKeep3rSidechainAccountance.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\n/// @title IKeep3rSidechainAccountance interface\n/// @notice Implements a view to get the amount of credits that can be withdrawn\ninterface IKeep3rSidechainAccountance {\n /// @return _totalBonds The total amount of bonded wKP3Rs in the contract\n function totalBonds() external view returns (uint256 _totalBonds);\n\n /// @return _virtualReserves The surplus amount of wKP3Rs in escrow contract\n function virtualReserves() external view returns (uint256 _virtualReserves);\n}\n" - }, - "solidity/interfaces/peripherals/IMintable.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport './IGovernable.sol';\nimport './IBaseErrors.sol';\n\n/// @title Mintable contract\n/// @notice Manages the minter role\ninterface IMintable is IBaseErrors, IGovernable {\n // Events\n\n /// @notice Emitted when governance sets a new minter\n /// @param _minter Address of the new minter\n event MinterSet(address _minter);\n\n // Errors\n\n /// @notice Throws if the caller of the function is not the minter\n error OnlyMinter();\n\n // Variables\n\n /// @notice Stores the minter address\n /// @return _minter The minter addresss\n function minter() external view returns (address _minter);\n\n // Methods\n\n /// @notice Sets a new address to be the minter\n /// @param _minter The address set as the minter\n function setMinter(address _minter) external;\n}\n" - }, - "solidity/for-test/testnet/Keep3rSidechainForTestnet.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../../contracts/sidechain/Keep3rSidechain.sol';\n\ncontract Keep3rSidechainForTestnet is Keep3rSidechain {\n constructor(\n address _governance,\n address _keep3rHelper,\n address _keep3rV1,\n address _keep3rV1Proxy\n ) Keep3rSidechain(_governance, _keep3rHelper, _keep3rV1, _keep3rV1Proxy) {\n bondTime = 0; // allows keepers to instantly register\n unbondTime = 0; // allows keepers & jobOwners to instantly withdraw funds\n liquidityMinimum = 1; // allows job providers to add low liquidity\n rewardPeriodTime = 1 days; // reduces twap calculation period\n inflationPeriod = 5 days; // increases credit mintint\n }\n}\n" - }, - "solidity/for-test/Keep3rSidechainForTest.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../contracts/sidechain/Keep3rSidechain.sol';\n\ncontract Keep3rSidechainForTest is Keep3rSidechain {\n using EnumerableSet for EnumerableSet.AddressSet;\n\n constructor(\n address _governance,\n address _keep3rHelper,\n address _wrappedKP3R,\n address _keep3rEscrow\n ) Keep3rSidechain(_governance, _keep3rHelper, _wrappedKP3R, _keep3rEscrow) {}\n\n function setJobLiquidity(address _job, address _liquidity) external {\n _jobLiquidities[_job].add(_liquidity);\n }\n}\n" - }, - "solidity/for-test/JobRatedForTest.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../interfaces/IKeep3r.sol';\nimport '../interfaces/sidechain/IKeep3rJobWorkableRated.sol';\n\ncontract JobRatedForTest {\n error InvalidKeeper();\n address public keep3r;\n uint256 public nonce;\n uint256 public usdPerGasUnit = 1_000e9;\n\n constructor(address _keep3r) {\n keep3r = _keep3r;\n }\n\n function work() external {\n if (!IKeep3r(keep3r).isKeeper(msg.sender)) revert InvalidKeeper();\n\n for (uint256 i = 0; i < 1000; i++) {\n nonce++;\n }\n\n IKeep3rJobWorkableRated(keep3r).worked(msg.sender, usdPerGasUnit);\n }\n\n function workHard(uint256 _factor) external {\n if (!IKeep3r(keep3r).isKeeper(msg.sender)) revert InvalidKeeper();\n\n for (uint256 i = 0; i < 1000 * _factor; i++) {\n nonce++;\n }\n\n IKeep3rJobWorkableRated(keep3r).worked(msg.sender, usdPerGasUnit);\n }\n}\n" - }, - "solidity/for-test/JobForTest.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../interfaces/IKeep3r.sol';\n\ncontract JobForTest {\n error InvalidKeeper();\n address public keep3r;\n uint256 public nonce;\n\n constructor(address _keep3r) {\n keep3r = _keep3r;\n }\n\n function work() external {\n if (!IKeep3r(keep3r).isKeeper(msg.sender)) revert InvalidKeeper();\n\n for (uint256 i; i < 1000; i++) {\n nonce++;\n }\n\n IKeep3r(keep3r).worked(msg.sender);\n }\n\n function workHard(uint256 _factor) external {\n if (!IKeep3r(keep3r).isKeeper(msg.sender)) revert InvalidKeeper();\n\n for (uint256 i; i < 1000 * _factor; i++) {\n nonce++;\n }\n\n IKeep3r(keep3r).worked(msg.sender);\n }\n}\n" - }, - "solidity/for-test/BasicJob.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../interfaces/IKeep3r.sol';\n\ncontract BasicJob {\n error KeeperNotValid();\n\n address public keep3r;\n uint256 public nonce;\n uint256[] public array;\n\n constructor(address _keep3r) {\n keep3r = _keep3r;\n }\n\n function work() external upkeep {}\n\n function workHard(uint256 _howHard) external upkeep {\n for (uint256 i = nonce; i < _howHard; i++) {\n nonce++;\n }\n }\n\n function workRefund(uint256 _howHard) external upkeep {\n for (uint256 i; i < _howHard; i++) {\n array.push(i);\n }\n\n while (array.length > 0) {\n array.pop();\n }\n }\n\n modifier upkeep() {\n if (!IKeep3r(keep3r).isKeeper(msg.sender)) revert KeeperNotValid();\n _;\n IKeep3r(keep3r).worked(msg.sender);\n }\n}\n" - }, - "solidity/contracts/Keep3rHelperParameters.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.7 <0.9.0;\n\nimport './libraries/FullMath.sol';\nimport './libraries/TickMath.sol';\nimport '../interfaces/peripherals/IBaseErrors.sol';\nimport '../interfaces/IKeep3r.sol';\nimport '../interfaces/external/IKeep3rV1.sol';\nimport '../interfaces/IKeep3rHelperParameters.sol';\nimport './peripherals/Governable.sol';\nimport './Keep3rHelperParameters.sol';\n\nimport '@openzeppelin/contracts/utils/math/Math.sol';\nimport '@uniswap/v3-core/contracts/interfaces/IUniswapV3Pool.sol';\n\ncontract Keep3rHelperParameters is IKeep3rHelperParameters, IBaseErrors, Governable {\n /// @inheritdoc IKeep3rHelperParameters\n address public immutable override KP3R;\n\n /// @inheritdoc IKeep3rHelperParameters\n uint256 public constant override BOOST_BASE = 10_000;\n\n /// @inheritdoc IKeep3rHelperParameters\n uint256 public override minBoost = 11_000;\n\n /// @inheritdoc IKeep3rHelperParameters\n uint256 public override maxBoost = 12_000;\n\n /// @inheritdoc IKeep3rHelperParameters\n uint256 public override targetBond = 200 ether;\n\n /// @inheritdoc IKeep3rHelperParameters\n uint256 public override workExtraGas = 30_000;\n\n /// @inheritdoc IKeep3rHelperParameters\n uint32 public override quoteTwapTime = 10 minutes;\n\n /// @inheritdoc IKeep3rHelperParameters\n uint256 public override minBaseFee = 15e9;\n\n /// @inheritdoc IKeep3rHelperParameters\n uint256 public override minPriorityFee = 2e9;\n\n /// @inheritdoc IKeep3rHelperParameters\n address public override keep3rV2;\n\n /// @inheritdoc IKeep3rHelperParameters\n IKeep3rHelperParameters.TokenOraclePool public override kp3rWethPool;\n\n constructor(\n address _kp3r,\n address _keep3rV2,\n address _governance,\n address _kp3rWethPool\n ) Governable(_governance) {\n KP3R = _kp3r;\n keep3rV2 = _keep3rV2;\n\n // Immutable variables [KP3R] cannot be read during contract creation time [_setKp3rWethPool]\n kp3rWethPool = _validateOraclePool(_kp3rWethPool, _kp3r);\n emit Kp3rWethPoolChange(kp3rWethPool.poolAddress, kp3rWethPool.isTKNToken0);\n }\n\n /// @inheritdoc IKeep3rHelperParameters\n function setKp3rWethPool(address _poolAddress) external override onlyGovernance {\n if (_poolAddress == address(0)) revert ZeroAddress();\n _setKp3rWethPool(_poolAddress);\n }\n\n /// @inheritdoc IKeep3rHelperParameters\n function setMinBoost(uint256 _minBoost) external override onlyGovernance {\n minBoost = _minBoost;\n emit MinBoostChange(minBoost);\n }\n\n /// @inheritdoc IKeep3rHelperParameters\n function setMaxBoost(uint256 _maxBoost) external override onlyGovernance {\n maxBoost = _maxBoost;\n emit MaxBoostChange(maxBoost);\n }\n\n /// @inheritdoc IKeep3rHelperParameters\n function setTargetBond(uint256 _targetBond) external override onlyGovernance {\n targetBond = _targetBond;\n emit TargetBondChange(targetBond);\n }\n\n /// @inheritdoc IKeep3rHelperParameters\n function setKeep3rV2(address _keep3rV2) external override onlyGovernance {\n if (_keep3rV2 == address(0)) revert ZeroAddress();\n keep3rV2 = _keep3rV2;\n emit Keep3rV2Change(keep3rV2);\n }\n\n /// @inheritdoc IKeep3rHelperParameters\n function setWorkExtraGas(uint256 _workExtraGas) external override onlyGovernance {\n workExtraGas = _workExtraGas;\n emit WorkExtraGasChange(workExtraGas);\n }\n\n /// @inheritdoc IKeep3rHelperParameters\n function setQuoteTwapTime(uint32 _quoteTwapTime) external override onlyGovernance {\n _setQuoteTwapTime(_quoteTwapTime);\n }\n\n function _setQuoteTwapTime(uint32 _quoteTwapTime) internal {\n quoteTwapTime = _quoteTwapTime;\n emit QuoteTwapTimeChange(quoteTwapTime);\n }\n\n /// @inheritdoc IKeep3rHelperParameters\n function setMinBaseFee(uint256 _minBaseFee) external override onlyGovernance {\n minBaseFee = _minBaseFee;\n emit MinBaseFeeChange(minBaseFee);\n }\n\n /// @inheritdoc IKeep3rHelperParameters\n function setMinPriorityFee(uint256 _minPriorityFee) external override onlyGovernance {\n minPriorityFee = _minPriorityFee;\n emit MinPriorityFeeChange(minPriorityFee);\n }\n\n /// @notice Sets KP3R-WETH pool\n /// @param _poolAddress The address of the KP3R-WETH pool\n function _setKp3rWethPool(address _poolAddress) internal {\n kp3rWethPool = _validateOraclePool(_poolAddress, KP3R);\n emit Kp3rWethPoolChange(kp3rWethPool.poolAddress, kp3rWethPool.isTKNToken0);\n }\n\n function _validateOraclePool(address _poolAddress, address _token) internal view virtual returns (TokenOraclePool memory _oraclePool) {\n bool _isTKNToken0 = IUniswapV3Pool(_poolAddress).token0() == _token;\n\n if (!_isTKNToken0 && IUniswapV3Pool(_poolAddress).token1() != _token) revert InvalidOraclePool();\n\n return TokenOraclePool(_poolAddress, _isTKNToken0);\n }\n}\n" - }, - "solidity/contracts/libraries/TickMath.sol": { - "content": "// SPDX-License-Identifier: GPL-2.0-or-later\npragma solidity >=0.5.0;\n\n// solhint-disable\n\n/// @title Math library for computing sqrt prices from ticks and vice versa\n/// @notice Computes sqrt price for ticks of size 1.0001, i.e. sqrt(1.0001^tick) as fixed point Q64.96 numbers. Supports\n/// prices between 2**-128 and 2**128\nlibrary TickMath {\n /// @dev The minimum tick that may be passed to #getSqrtRatioAtTick computed from log base 1.0001 of 2**-128\n int24 internal constant MIN_TICK = -887272;\n /// @dev The maximum tick that may be passed to #getSqrtRatioAtTick computed from log base 1.0001 of 2**128\n int24 internal constant MAX_TICK = -MIN_TICK;\n\n /// @dev The minimum value that can be returned from #getSqrtRatioAtTick. Equivalent to getSqrtRatioAtTick(MIN_TICK)\n uint160 internal constant MIN_SQRT_RATIO = 4295128739;\n /// @dev The maximum value that can be returned from #getSqrtRatioAtTick. Equivalent to getSqrtRatioAtTick(MAX_TICK)\n uint160 internal constant MAX_SQRT_RATIO = 1461446703485210103287273052203988822378723970342;\n\n /// @notice Calculates sqrt(1.0001^tick) * 2^96\n /// @dev Throws if |tick| > max tick\n /// @param tick The input tick for the above formula\n /// @return sqrtPriceX96 A Fixed point Q64.96 number representing the sqrt of the ratio of the two assets (token1/token0)\n /// at the given tick\n function getSqrtRatioAtTick(int24 tick) internal pure returns (uint160 sqrtPriceX96) {\n uint256 absTick = tick < 0 ? uint256(-int256(tick)) : uint256(int256(tick));\n require(absTick <= uint256(int256(MAX_TICK)), 'T');\n\n uint256 ratio = absTick & 0x1 != 0 ? 0xfffcb933bd6fad37aa2d162d1a594001 : 0x100000000000000000000000000000000;\n if (absTick & 0x2 != 0) ratio = (ratio * 0xfff97272373d413259a46990580e213a) >> 128;\n if (absTick & 0x4 != 0) ratio = (ratio * 0xfff2e50f5f656932ef12357cf3c7fdcc) >> 128;\n if (absTick & 0x8 != 0) ratio = (ratio * 0xffe5caca7e10e4e61c3624eaa0941cd0) >> 128;\n if (absTick & 0x10 != 0) ratio = (ratio * 0xffcb9843d60f6159c9db58835c926644) >> 128;\n if (absTick & 0x20 != 0) ratio = (ratio * 0xff973b41fa98c081472e6896dfb254c0) >> 128;\n if (absTick & 0x40 != 0) ratio = (ratio * 0xff2ea16466c96a3843ec78b326b52861) >> 128;\n if (absTick & 0x80 != 0) ratio = (ratio * 0xfe5dee046a99a2a811c461f1969c3053) >> 128;\n if (absTick & 0x100 != 0) ratio = (ratio * 0xfcbe86c7900a88aedcffc83b479aa3a4) >> 128;\n if (absTick & 0x200 != 0) ratio = (ratio * 0xf987a7253ac413176f2b074cf7815e54) >> 128;\n if (absTick & 0x400 != 0) ratio = (ratio * 0xf3392b0822b70005940c7a398e4b70f3) >> 128;\n if (absTick & 0x800 != 0) ratio = (ratio * 0xe7159475a2c29b7443b29c7fa6e889d9) >> 128;\n if (absTick & 0x1000 != 0) ratio = (ratio * 0xd097f3bdfd2022b8845ad8f792aa5825) >> 128;\n if (absTick & 0x2000 != 0) ratio = (ratio * 0xa9f746462d870fdf8a65dc1f90e061e5) >> 128;\n if (absTick & 0x4000 != 0) ratio = (ratio * 0x70d869a156d2a1b890bb3df62baf32f7) >> 128;\n if (absTick & 0x8000 != 0) ratio = (ratio * 0x31be135f97d08fd981231505542fcfa6) >> 128;\n if (absTick & 0x10000 != 0) ratio = (ratio * 0x9aa508b5b7a84e1c677de54f3e99bc9) >> 128;\n if (absTick & 0x20000 != 0) ratio = (ratio * 0x5d6af8dedb81196699c329225ee604) >> 128;\n if (absTick & 0x40000 != 0) ratio = (ratio * 0x2216e584f5fa1ea926041bedfe98) >> 128;\n if (absTick & 0x80000 != 0) ratio = (ratio * 0x48a170391f7dc42444e8fa2) >> 128;\n\n if (tick > 0) ratio = type(uint256).max / ratio;\n\n // Divides by 1<<32 rounding up to go from a Q128.128 to a Q128.96.\n // we then downcast because we know the result always fits within 160 bits due to our tick input constraint\n // we round up in the division so getTickAtSqrtRatio of the output price is always consistent\n sqrtPriceX96 = uint160((ratio >> 32) + (ratio % (1 << 32) == 0 ? 0 : 1));\n }\n\n /// @notice Calculates the greatest tick value such that getRatioAtTick(tick) <= ratio\n /// @dev Throws in case sqrtPriceX96 < MIN_SQRT_RATIO, as MIN_SQRT_RATIO is the lowest value getRatioAtTick may ever return.\n /// @param sqrtPriceX96 The sqrt ratio for which to compute the tick as a Q64.96\n /// @return tick The greatest tick for which the ratio is less than or equal to the input ratio\n function getTickAtSqrtRatio(uint160 sqrtPriceX96) internal pure returns (int24 tick) {\n // Second inequality must be < because the price can never reach the price at the max tick\n require(sqrtPriceX96 >= MIN_SQRT_RATIO && sqrtPriceX96 < MAX_SQRT_RATIO, 'R');\n uint256 ratio = uint256(sqrtPriceX96) << 32;\n\n uint256 r = ratio;\n uint256 msb = 0;\n\n assembly {\n let f := shl(7, gt(r, 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF))\n msb := or(msb, f)\n r := shr(f, r)\n }\n assembly {\n let f := shl(6, gt(r, 0xFFFFFFFFFFFFFFFF))\n msb := or(msb, f)\n r := shr(f, r)\n }\n assembly {\n let f := shl(5, gt(r, 0xFFFFFFFF))\n msb := or(msb, f)\n r := shr(f, r)\n }\n assembly {\n let f := shl(4, gt(r, 0xFFFF))\n msb := or(msb, f)\n r := shr(f, r)\n }\n assembly {\n let f := shl(3, gt(r, 0xFF))\n msb := or(msb, f)\n r := shr(f, r)\n }\n assembly {\n let f := shl(2, gt(r, 0xF))\n msb := or(msb, f)\n r := shr(f, r)\n }\n assembly {\n let f := shl(1, gt(r, 0x3))\n msb := or(msb, f)\n r := shr(f, r)\n }\n assembly {\n let f := gt(r, 0x1)\n msb := or(msb, f)\n }\n\n if (msb >= 128) r = ratio >> (msb - 127);\n else r = ratio << (127 - msb);\n\n int256 log_2 = (int256(msb) - 128) << 64;\n\n assembly {\n r := shr(127, mul(r, r))\n let f := shr(128, r)\n log_2 := or(log_2, shl(63, f))\n r := shr(f, r)\n }\n assembly {\n r := shr(127, mul(r, r))\n let f := shr(128, r)\n log_2 := or(log_2, shl(62, f))\n r := shr(f, r)\n }\n assembly {\n r := shr(127, mul(r, r))\n let f := shr(128, r)\n log_2 := or(log_2, shl(61, f))\n r := shr(f, r)\n }\n assembly {\n r := shr(127, mul(r, r))\n let f := shr(128, r)\n log_2 := or(log_2, shl(60, f))\n r := shr(f, r)\n }\n assembly {\n r := shr(127, mul(r, r))\n let f := shr(128, r)\n log_2 := or(log_2, shl(59, f))\n r := shr(f, r)\n }\n assembly {\n r := shr(127, mul(r, r))\n let f := shr(128, r)\n log_2 := or(log_2, shl(58, f))\n r := shr(f, r)\n }\n assembly {\n r := shr(127, mul(r, r))\n let f := shr(128, r)\n log_2 := or(log_2, shl(57, f))\n r := shr(f, r)\n }\n assembly {\n r := shr(127, mul(r, r))\n let f := shr(128, r)\n log_2 := or(log_2, shl(56, f))\n r := shr(f, r)\n }\n assembly {\n r := shr(127, mul(r, r))\n let f := shr(128, r)\n log_2 := or(log_2, shl(55, f))\n r := shr(f, r)\n }\n assembly {\n r := shr(127, mul(r, r))\n let f := shr(128, r)\n log_2 := or(log_2, shl(54, f))\n r := shr(f, r)\n }\n assembly {\n r := shr(127, mul(r, r))\n let f := shr(128, r)\n log_2 := or(log_2, shl(53, f))\n r := shr(f, r)\n }\n assembly {\n r := shr(127, mul(r, r))\n let f := shr(128, r)\n log_2 := or(log_2, shl(52, f))\n r := shr(f, r)\n }\n assembly {\n r := shr(127, mul(r, r))\n let f := shr(128, r)\n log_2 := or(log_2, shl(51, f))\n r := shr(f, r)\n }\n assembly {\n r := shr(127, mul(r, r))\n let f := shr(128, r)\n log_2 := or(log_2, shl(50, f))\n }\n\n int256 log_sqrt10001 = log_2 * 255738958999603826347141; // 128.128 number\n\n int24 tickLow = int24((log_sqrt10001 - 3402992956809132418596140100660247210) >> 128);\n int24 tickHi = int24((log_sqrt10001 + 291339464771989622907027621153398088495) >> 128);\n\n tick = tickLow == tickHi ? tickLow : getSqrtRatioAtTick(tickHi) <= sqrtPriceX96 ? tickHi : tickLow;\n }\n}\n" - }, - "@uniswap/v3-core/contracts/interfaces/IUniswapV3Pool.sol": { - "content": "// SPDX-License-Identifier: GPL-2.0-or-later\npragma solidity >=0.5.0;\n\nimport './pool/IUniswapV3PoolImmutables.sol';\nimport './pool/IUniswapV3PoolState.sol';\nimport './pool/IUniswapV3PoolDerivedState.sol';\nimport './pool/IUniswapV3PoolActions.sol';\nimport './pool/IUniswapV3PoolOwnerActions.sol';\nimport './pool/IUniswapV3PoolEvents.sol';\n\n/// @title The interface for a Uniswap V3 Pool\n/// @notice A Uniswap pool facilitates swapping and automated market making between any two assets that strictly conform\n/// to the ERC20 specification\n/// @dev The pool interface is broken up into many smaller pieces\ninterface IUniswapV3Pool is\n IUniswapV3PoolImmutables,\n IUniswapV3PoolState,\n IUniswapV3PoolDerivedState,\n IUniswapV3PoolActions,\n IUniswapV3PoolOwnerActions,\n IUniswapV3PoolEvents\n{\n\n}\n" - }, - "@uniswap/v3-core/contracts/interfaces/pool/IUniswapV3PoolImmutables.sol": { - "content": "// SPDX-License-Identifier: GPL-2.0-or-later\npragma solidity >=0.5.0;\n\n/// @title Pool state that never changes\n/// @notice These parameters are fixed for a pool forever, i.e., the methods will always return the same values\ninterface IUniswapV3PoolImmutables {\n /// @notice The contract that deployed the pool, which must adhere to the IUniswapV3Factory interface\n /// @return The contract address\n function factory() external view returns (address);\n\n /// @notice The first of the two tokens of the pool, sorted by address\n /// @return The token contract address\n function token0() external view returns (address);\n\n /// @notice The second of the two tokens of the pool, sorted by address\n /// @return The token contract address\n function token1() external view returns (address);\n\n /// @notice The pool's fee in hundredths of a bip, i.e. 1e-6\n /// @return The fee\n function fee() external view returns (uint24);\n\n /// @notice The pool tick spacing\n /// @dev Ticks can only be used at multiples of this value, minimum of 1 and always positive\n /// e.g.: a tickSpacing of 3 means ticks can be initialized every 3rd tick, i.e., ..., -6, -3, 0, 3, 6, ...\n /// This value is an int24 to avoid casting even though it is always positive.\n /// @return The tick spacing\n function tickSpacing() external view returns (int24);\n\n /// @notice The maximum amount of position liquidity that can use any tick in the range\n /// @dev This parameter is enforced per tick to prevent liquidity from overflowing a uint128 at any point, and\n /// also prevents out-of-range liquidity from being used to prevent adding in-range liquidity to a pool\n /// @return The max amount of liquidity per tick\n function maxLiquidityPerTick() external view returns (uint128);\n}\n" - }, - "@uniswap/v3-core/contracts/interfaces/pool/IUniswapV3PoolState.sol": { - "content": "// SPDX-License-Identifier: GPL-2.0-or-later\npragma solidity >=0.5.0;\n\n/// @title Pool state that can change\n/// @notice These methods compose the pool's state, and can change with any frequency including multiple times\n/// per transaction\ninterface IUniswapV3PoolState {\n /// @notice The 0th storage slot in the pool stores many values, and is exposed as a single method to save gas\n /// when accessed externally.\n /// @return sqrtPriceX96 The current price of the pool as a sqrt(token1/token0) Q64.96 value\n /// tick The current tick of the pool, i.e. according to the last tick transition that was run.\n /// This value may not always be equal to SqrtTickMath.getTickAtSqrtRatio(sqrtPriceX96) if the price is on a tick\n /// boundary.\n /// observationIndex The index of the last oracle observation that was written,\n /// observationCardinality The current maximum number of observations stored in the pool,\n /// observationCardinalityNext The next maximum number of observations, to be updated when the observation.\n /// feeProtocol The protocol fee for both tokens of the pool.\n /// Encoded as two 4 bit values, where the protocol fee of token1 is shifted 4 bits and the protocol fee of token0\n /// is the lower 4 bits. Used as the denominator of a fraction of the swap fee, e.g. 4 means 1/4th of the swap fee.\n /// unlocked Whether the pool is currently locked to reentrancy\n function slot0()\n external\n view\n returns (\n uint160 sqrtPriceX96,\n int24 tick,\n uint16 observationIndex,\n uint16 observationCardinality,\n uint16 observationCardinalityNext,\n uint8 feeProtocol,\n bool unlocked\n );\n\n /// @notice The fee growth as a Q128.128 fees of token0 collected per unit of liquidity for the entire life of the pool\n /// @dev This value can overflow the uint256\n function feeGrowthGlobal0X128() external view returns (uint256);\n\n /// @notice The fee growth as a Q128.128 fees of token1 collected per unit of liquidity for the entire life of the pool\n /// @dev This value can overflow the uint256\n function feeGrowthGlobal1X128() external view returns (uint256);\n\n /// @notice The amounts of token0 and token1 that are owed to the protocol\n /// @dev Protocol fees will never exceed uint128 max in either token\n function protocolFees() external view returns (uint128 token0, uint128 token1);\n\n /// @notice The currently in range liquidity available to the pool\n /// @dev This value has no relationship to the total liquidity across all ticks\n function liquidity() external view returns (uint128);\n\n /// @notice Look up information about a specific tick in the pool\n /// @param tick The tick to look up\n /// @return liquidityGross the total amount of position liquidity that uses the pool either as tick lower or\n /// tick upper,\n /// liquidityNet how much liquidity changes when the pool price crosses the tick,\n /// feeGrowthOutside0X128 the fee growth on the other side of the tick from the current tick in token0,\n /// feeGrowthOutside1X128 the fee growth on the other side of the tick from the current tick in token1,\n /// tickCumulativeOutside the cumulative tick value on the other side of the tick from the current tick\n /// secondsPerLiquidityOutsideX128 the seconds spent per liquidity on the other side of the tick from the current tick,\n /// secondsOutside the seconds spent on the other side of the tick from the current tick,\n /// initialized Set to true if the tick is initialized, i.e. liquidityGross is greater than 0, otherwise equal to false.\n /// Outside values can only be used if the tick is initialized, i.e. if liquidityGross is greater than 0.\n /// In addition, these values are only relative and must be used only in comparison to previous snapshots for\n /// a specific position.\n function ticks(int24 tick)\n external\n view\n returns (\n uint128 liquidityGross,\n int128 liquidityNet,\n uint256 feeGrowthOutside0X128,\n uint256 feeGrowthOutside1X128,\n int56 tickCumulativeOutside,\n uint160 secondsPerLiquidityOutsideX128,\n uint32 secondsOutside,\n bool initialized\n );\n\n /// @notice Returns 256 packed tick initialized boolean values. See TickBitmap for more information\n function tickBitmap(int16 wordPosition) external view returns (uint256);\n\n /// @notice Returns the information about a position by the position's key\n /// @param key The position's key is a hash of a preimage composed by the owner, tickLower and tickUpper\n /// @return _liquidity The amount of liquidity in the position,\n /// Returns feeGrowthInside0LastX128 fee growth of token0 inside the tick range as of the last mint/burn/poke,\n /// Returns feeGrowthInside1LastX128 fee growth of token1 inside the tick range as of the last mint/burn/poke,\n /// Returns tokensOwed0 the computed amount of token0 owed to the position as of the last mint/burn/poke,\n /// Returns tokensOwed1 the computed amount of token1 owed to the position as of the last mint/burn/poke\n function positions(bytes32 key)\n external\n view\n returns (\n uint128 _liquidity,\n uint256 feeGrowthInside0LastX128,\n uint256 feeGrowthInside1LastX128,\n uint128 tokensOwed0,\n uint128 tokensOwed1\n );\n\n /// @notice Returns data about a specific observation index\n /// @param index The element of the observations array to fetch\n /// @dev You most likely want to use #observe() instead of this method to get an observation as of some amount of time\n /// ago, rather than at a specific index in the array.\n /// @return blockTimestamp The timestamp of the observation,\n /// Returns tickCumulative the tick multiplied by seconds elapsed for the life of the pool as of the observation timestamp,\n /// Returns secondsPerLiquidityCumulativeX128 the seconds per in range liquidity for the life of the pool as of the observation timestamp,\n /// Returns initialized whether the observation has been initialized and the values are safe to use\n function observations(uint256 index)\n external\n view\n returns (\n uint32 blockTimestamp,\n int56 tickCumulative,\n uint160 secondsPerLiquidityCumulativeX128,\n bool initialized\n );\n}\n" - }, - "@uniswap/v3-core/contracts/interfaces/pool/IUniswapV3PoolDerivedState.sol": { - "content": "// SPDX-License-Identifier: GPL-2.0-or-later\npragma solidity >=0.5.0;\n\n/// @title Pool state that is not stored\n/// @notice Contains view functions to provide information about the pool that is computed rather than stored on the\n/// blockchain. The functions here may have variable gas costs.\ninterface IUniswapV3PoolDerivedState {\n /// @notice Returns the cumulative tick and liquidity as of each timestamp `secondsAgo` from the current block timestamp\n /// @dev To get a time weighted average tick or liquidity-in-range, you must call this with two values, one representing\n /// the beginning of the period and another for the end of the period. E.g., to get the last hour time-weighted average tick,\n /// you must call it with secondsAgos = [3600, 0].\n /// @dev The time weighted average tick represents the geometric time weighted average price of the pool, in\n /// log base sqrt(1.0001) of token1 / token0. The TickMath library can be used to go from a tick value to a ratio.\n /// @param secondsAgos From how long ago each cumulative tick and liquidity value should be returned\n /// @return tickCumulatives Cumulative tick values as of each `secondsAgos` from the current block timestamp\n /// @return secondsPerLiquidityCumulativeX128s Cumulative seconds per liquidity-in-range value as of each `secondsAgos` from the current block\n /// timestamp\n function observe(uint32[] calldata secondsAgos)\n external\n view\n returns (int56[] memory tickCumulatives, uint160[] memory secondsPerLiquidityCumulativeX128s);\n\n /// @notice Returns a snapshot of the tick cumulative, seconds per liquidity and seconds inside a tick range\n /// @dev Snapshots must only be compared to other snapshots, taken over a period for which a position existed.\n /// I.e., snapshots cannot be compared if a position is not held for the entire period between when the first\n /// snapshot is taken and the second snapshot is taken.\n /// @param tickLower The lower tick of the range\n /// @param tickUpper The upper tick of the range\n /// @return tickCumulativeInside The snapshot of the tick accumulator for the range\n /// @return secondsPerLiquidityInsideX128 The snapshot of seconds per liquidity for the range\n /// @return secondsInside The snapshot of seconds per liquidity for the range\n function snapshotCumulativesInside(int24 tickLower, int24 tickUpper)\n external\n view\n returns (\n int56 tickCumulativeInside,\n uint160 secondsPerLiquidityInsideX128,\n uint32 secondsInside\n );\n}\n" - }, - "@uniswap/v3-core/contracts/interfaces/pool/IUniswapV3PoolActions.sol": { - "content": "// SPDX-License-Identifier: GPL-2.0-or-later\npragma solidity >=0.5.0;\n\n/// @title Permissionless pool actions\n/// @notice Contains pool methods that can be called by anyone\ninterface IUniswapV3PoolActions {\n /// @notice Sets the initial price for the pool\n /// @dev Price is represented as a sqrt(amountToken1/amountToken0) Q64.96 value\n /// @param sqrtPriceX96 the initial sqrt price of the pool as a Q64.96\n function initialize(uint160 sqrtPriceX96) external;\n\n /// @notice Adds liquidity for the given recipient/tickLower/tickUpper position\n /// @dev The caller of this method receives a callback in the form of IUniswapV3MintCallback#uniswapV3MintCallback\n /// in which they must pay any token0 or token1 owed for the liquidity. The amount of token0/token1 due depends\n /// on tickLower, tickUpper, the amount of liquidity, and the current price.\n /// @param recipient The address for which the liquidity will be created\n /// @param tickLower The lower tick of the position in which to add liquidity\n /// @param tickUpper The upper tick of the position in which to add liquidity\n /// @param amount The amount of liquidity to mint\n /// @param data Any data that should be passed through to the callback\n /// @return amount0 The amount of token0 that was paid to mint the given amount of liquidity. Matches the value in the callback\n /// @return amount1 The amount of token1 that was paid to mint the given amount of liquidity. Matches the value in the callback\n function mint(\n address recipient,\n int24 tickLower,\n int24 tickUpper,\n uint128 amount,\n bytes calldata data\n ) external returns (uint256 amount0, uint256 amount1);\n\n /// @notice Collects tokens owed to a position\n /// @dev Does not recompute fees earned, which must be done either via mint or burn of any amount of liquidity.\n /// Collect must be called by the position owner. To withdraw only token0 or only token1, amount0Requested or\n /// amount1Requested may be set to zero. To withdraw all tokens owed, caller may pass any value greater than the\n /// actual tokens owed, e.g. type(uint128).max. Tokens owed may be from accumulated swap fees or burned liquidity.\n /// @param recipient The address which should receive the fees collected\n /// @param tickLower The lower tick of the position for which to collect fees\n /// @param tickUpper The upper tick of the position for which to collect fees\n /// @param amount0Requested How much token0 should be withdrawn from the fees owed\n /// @param amount1Requested How much token1 should be withdrawn from the fees owed\n /// @return amount0 The amount of fees collected in token0\n /// @return amount1 The amount of fees collected in token1\n function collect(\n address recipient,\n int24 tickLower,\n int24 tickUpper,\n uint128 amount0Requested,\n uint128 amount1Requested\n ) external returns (uint128 amount0, uint128 amount1);\n\n /// @notice Burn liquidity from the sender and account tokens owed for the liquidity to the position\n /// @dev Can be used to trigger a recalculation of fees owed to a position by calling with an amount of 0\n /// @dev Fees must be collected separately via a call to #collect\n /// @param tickLower The lower tick of the position for which to burn liquidity\n /// @param tickUpper The upper tick of the position for which to burn liquidity\n /// @param amount How much liquidity to burn\n /// @return amount0 The amount of token0 sent to the recipient\n /// @return amount1 The amount of token1 sent to the recipient\n function burn(\n int24 tickLower,\n int24 tickUpper,\n uint128 amount\n ) external returns (uint256 amount0, uint256 amount1);\n\n /// @notice Swap token0 for token1, or token1 for token0\n /// @dev The caller of this method receives a callback in the form of IUniswapV3SwapCallback#uniswapV3SwapCallback\n /// @param recipient The address to receive the output of the swap\n /// @param zeroForOne The direction of the swap, true for token0 to token1, false for token1 to token0\n /// @param amountSpecified The amount of the swap, which implicitly configures the swap as exact input (positive), or exact output (negative)\n /// @param sqrtPriceLimitX96 The Q64.96 sqrt price limit. If zero for one, the price cannot be less than this\n /// value after the swap. If one for zero, the price cannot be greater than this value after the swap\n /// @param data Any data to be passed through to the callback\n /// @return amount0 The delta of the balance of token0 of the pool, exact when negative, minimum when positive\n /// @return amount1 The delta of the balance of token1 of the pool, exact when negative, minimum when positive\n function swap(\n address recipient,\n bool zeroForOne,\n int256 amountSpecified,\n uint160 sqrtPriceLimitX96,\n bytes calldata data\n ) external returns (int256 amount0, int256 amount1);\n\n /// @notice Receive token0 and/or token1 and pay it back, plus a fee, in the callback\n /// @dev The caller of this method receives a callback in the form of IUniswapV3FlashCallback#uniswapV3FlashCallback\n /// @dev Can be used to donate underlying tokens pro-rata to currently in-range liquidity providers by calling\n /// with 0 amount{0,1} and sending the donation amount(s) from the callback\n /// @param recipient The address which will receive the token0 and token1 amounts\n /// @param amount0 The amount of token0 to send\n /// @param amount1 The amount of token1 to send\n /// @param data Any data to be passed through to the callback\n function flash(\n address recipient,\n uint256 amount0,\n uint256 amount1,\n bytes calldata data\n ) external;\n\n /// @notice Increase the maximum number of price and liquidity observations that this pool will store\n /// @dev This method is no-op if the pool already has an observationCardinalityNext greater than or equal to\n /// the input observationCardinalityNext.\n /// @param observationCardinalityNext The desired minimum number of observations for the pool to store\n function increaseObservationCardinalityNext(uint16 observationCardinalityNext) external;\n}\n" - }, - "@uniswap/v3-core/contracts/interfaces/pool/IUniswapV3PoolOwnerActions.sol": { - "content": "// SPDX-License-Identifier: GPL-2.0-or-later\npragma solidity >=0.5.0;\n\n/// @title Permissioned pool actions\n/// @notice Contains pool methods that may only be called by the factory owner\ninterface IUniswapV3PoolOwnerActions {\n /// @notice Set the denominator of the protocol's % share of the fees\n /// @param feeProtocol0 new protocol fee for token0 of the pool\n /// @param feeProtocol1 new protocol fee for token1 of the pool\n function setFeeProtocol(uint8 feeProtocol0, uint8 feeProtocol1) external;\n\n /// @notice Collect the protocol fee accrued to the pool\n /// @param recipient The address to which collected protocol fees should be sent\n /// @param amount0Requested The maximum amount of token0 to send, can be 0 to collect fees in only token1\n /// @param amount1Requested The maximum amount of token1 to send, can be 0 to collect fees in only token0\n /// @return amount0 The protocol fee collected in token0\n /// @return amount1 The protocol fee collected in token1\n function collectProtocol(\n address recipient,\n uint128 amount0Requested,\n uint128 amount1Requested\n ) external returns (uint128 amount0, uint128 amount1);\n}\n" - }, - "@uniswap/v3-core/contracts/interfaces/pool/IUniswapV3PoolEvents.sol": { - "content": "// SPDX-License-Identifier: GPL-2.0-or-later\npragma solidity >=0.5.0;\n\n/// @title Events emitted by a pool\n/// @notice Contains all events emitted by the pool\ninterface IUniswapV3PoolEvents {\n /// @notice Emitted exactly once by a pool when #initialize is first called on the pool\n /// @dev Mint/Burn/Swap cannot be emitted by the pool before Initialize\n /// @param sqrtPriceX96 The initial sqrt price of the pool, as a Q64.96\n /// @param tick The initial tick of the pool, i.e. log base 1.0001 of the starting price of the pool\n event Initialize(uint160 sqrtPriceX96, int24 tick);\n\n /// @notice Emitted when liquidity is minted for a given position\n /// @param sender The address that minted the liquidity\n /// @param owner The owner of the position and recipient of any minted liquidity\n /// @param tickLower The lower tick of the position\n /// @param tickUpper The upper tick of the position\n /// @param amount The amount of liquidity minted to the position range\n /// @param amount0 How much token0 was required for the minted liquidity\n /// @param amount1 How much token1 was required for the minted liquidity\n event Mint(\n address sender,\n address indexed owner,\n int24 indexed tickLower,\n int24 indexed tickUpper,\n uint128 amount,\n uint256 amount0,\n uint256 amount1\n );\n\n /// @notice Emitted when fees are collected by the owner of a position\n /// @dev Collect events may be emitted with zero amount0 and amount1 when the caller chooses not to collect fees\n /// @param owner The owner of the position for which fees are collected\n /// @param tickLower The lower tick of the position\n /// @param tickUpper The upper tick of the position\n /// @param amount0 The amount of token0 fees collected\n /// @param amount1 The amount of token1 fees collected\n event Collect(\n address indexed owner,\n address recipient,\n int24 indexed tickLower,\n int24 indexed tickUpper,\n uint128 amount0,\n uint128 amount1\n );\n\n /// @notice Emitted when a position's liquidity is removed\n /// @dev Does not withdraw any fees earned by the liquidity position, which must be withdrawn via #collect\n /// @param owner The owner of the position for which liquidity is removed\n /// @param tickLower The lower tick of the position\n /// @param tickUpper The upper tick of the position\n /// @param amount The amount of liquidity to remove\n /// @param amount0 The amount of token0 withdrawn\n /// @param amount1 The amount of token1 withdrawn\n event Burn(\n address indexed owner,\n int24 indexed tickLower,\n int24 indexed tickUpper,\n uint128 amount,\n uint256 amount0,\n uint256 amount1\n );\n\n /// @notice Emitted by the pool for any swaps between token0 and token1\n /// @param sender The address that initiated the swap call, and that received the callback\n /// @param recipient The address that received the output of the swap\n /// @param amount0 The delta of the token0 balance of the pool\n /// @param amount1 The delta of the token1 balance of the pool\n /// @param sqrtPriceX96 The sqrt(price) of the pool after the swap, as a Q64.96\n /// @param liquidity The liquidity of the pool after the swap\n /// @param tick The log base 1.0001 of price of the pool after the swap\n event Swap(\n address indexed sender,\n address indexed recipient,\n int256 amount0,\n int256 amount1,\n uint160 sqrtPriceX96,\n uint128 liquidity,\n int24 tick\n );\n\n /// @notice Emitted by the pool for any flashes of token0/token1\n /// @param sender The address that initiated the swap call, and that received the callback\n /// @param recipient The address that received the tokens from flash\n /// @param amount0 The amount of token0 that was flashed\n /// @param amount1 The amount of token1 that was flashed\n /// @param paid0 The amount of token0 paid for the flash, which can exceed the amount0 plus the fee\n /// @param paid1 The amount of token1 paid for the flash, which can exceed the amount1 plus the fee\n event Flash(\n address indexed sender,\n address indexed recipient,\n uint256 amount0,\n uint256 amount1,\n uint256 paid0,\n uint256 paid1\n );\n\n /// @notice Emitted by the pool for increases to the number of observations that can be stored\n /// @dev observationCardinalityNext is not the observation cardinality until an observation is written at the index\n /// just before a mint/swap/burn.\n /// @param observationCardinalityNextOld The previous value of the next observation cardinality\n /// @param observationCardinalityNextNew The updated value of the next observation cardinality\n event IncreaseObservationCardinalityNext(\n uint16 observationCardinalityNextOld,\n uint16 observationCardinalityNextNew\n );\n\n /// @notice Emitted when the protocol fee is changed by the pool\n /// @param feeProtocol0Old The previous value of the token0 protocol fee\n /// @param feeProtocol1Old The previous value of the token1 protocol fee\n /// @param feeProtocol0New The updated value of the token0 protocol fee\n /// @param feeProtocol1New The updated value of the token1 protocol fee\n event SetFeeProtocol(uint8 feeProtocol0Old, uint8 feeProtocol1Old, uint8 feeProtocol0New, uint8 feeProtocol1New);\n\n /// @notice Emitted when the collected protocol fees are withdrawn by the factory owner\n /// @param sender The address that collects the protocol fees\n /// @param recipient The address that receives the collected protocol fees\n /// @param amount0 The amount of token0 protocol fees that is withdrawn\n /// @param amount0 The amount of token1 protocol fees that is withdrawn\n event CollectProtocol(address indexed sender, address indexed recipient, uint128 amount0, uint128 amount1);\n}\n" - }, - "solidity/for-test/UniV3PairManagerForTest.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '@openzeppelin/contracts/token/ERC20/ERC20.sol';\nimport '@uniswap/v3-core/contracts/interfaces/IUniswapV3Pool.sol';\n\nimport '../contracts/libraries/LiquidityAmounts.sol';\nimport '../contracts/libraries/PoolAddress.sol';\nimport '../contracts/libraries/FixedPoint96.sol';\nimport '../contracts/libraries/FullMath.sol';\nimport '../contracts/libraries/TickMath.sol';\nimport '../contracts/UniV3PairManager.sol';\nimport '../interfaces/external/IWeth9.sol';\nimport '../interfaces/IUniV3PairManager.sol';\n\ncontract UniV3PairManagerForTest is UniV3PairManager {\n constructor(address _pool, address _governance) UniV3PairManager(_pool, _governance) {}\n\n function internalAddLiquidity(\n uint256 amount0Desired,\n uint256 amount1Desired,\n uint256 amount0Min,\n uint256 amount1Min\n )\n external\n returns (\n uint128 liquidity,\n uint256 amount0,\n uint256 amount1\n )\n {\n return _addLiquidity(amount0Desired, amount1Desired, amount0Min, amount1Min);\n }\n\n function internalPay(\n address token,\n address payer,\n address recipient,\n uint256 value\n ) external {\n return _pay(token, payer, recipient, value);\n }\n\n function internalMint(address dst, uint256 amount) external {\n return _mint(dst, amount);\n }\n\n function internalBurn(address dst, uint256 amount) external {\n return _burn(dst, amount);\n }\n\n function internalTransferTokens(\n address src,\n address dst,\n uint256 amount\n ) external {\n _transferTokens(src, dst, amount);\n }\n\n function internalSafeTransferFrom(\n address token,\n address from,\n address to,\n uint256 value\n ) external {\n _safeTransferFrom(token, from, to, value);\n }\n\n receive() external payable {}\n}\n" - }, - "@openzeppelin/contracts/token/ERC20/ERC20.sol": { - "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\nimport \"./IERC20.sol\";\nimport \"./extensions/IERC20Metadata.sol\";\nimport \"../../utils/Context.sol\";\n\n/**\n * @dev Implementation of the {IERC20} interface.\n *\n * This implementation is agnostic to the way tokens are created. This means\n * that a supply mechanism has to be added in a derived contract using {_mint}.\n * For a generic mechanism see {ERC20PresetMinterPauser}.\n *\n * TIP: For a detailed writeup see our guide\n * https://forum.zeppelin.solutions/t/how-to-implement-erc20-supply-mechanisms/226[How\n * to implement supply mechanisms].\n *\n * We have followed general OpenZeppelin Contracts guidelines: functions revert\n * instead returning `false` on failure. This behavior is nonetheless\n * conventional and does not conflict with the expectations of ERC20\n * applications.\n *\n * Additionally, an {Approval} event is emitted on calls to {transferFrom}.\n * This allows applications to reconstruct the allowance for all accounts just\n * by listening to said events. Other implementations of the EIP may not emit\n * these events, as it isn't required by the specification.\n *\n * Finally, the non-standard {decreaseAllowance} and {increaseAllowance}\n * functions have been added to mitigate the well-known issues around setting\n * allowances. See {IERC20-approve}.\n */\ncontract ERC20 is Context, IERC20, IERC20Metadata {\n mapping(address => uint256) private _balances;\n\n mapping(address => mapping(address => uint256)) private _allowances;\n\n uint256 private _totalSupply;\n\n string private _name;\n string private _symbol;\n\n /**\n * @dev Sets the values for {name} and {symbol}.\n *\n * The default value of {decimals} is 18. To select a different value for\n * {decimals} you should overload it.\n *\n * All two of these values are immutable: they can only be set once during\n * construction.\n */\n constructor(string memory name_, string memory symbol_) {\n _name = name_;\n _symbol = symbol_;\n }\n\n /**\n * @dev Returns the name of the token.\n */\n function name() public view virtual override returns (string memory) {\n return _name;\n }\n\n /**\n * @dev Returns the symbol of the token, usually a shorter version of the\n * name.\n */\n function symbol() public view virtual override returns (string memory) {\n return _symbol;\n }\n\n /**\n * @dev Returns the number of decimals used to get its user representation.\n * For example, if `decimals` equals `2`, a balance of `505` tokens should\n * be displayed to a user as `5.05` (`505 / 10 ** 2`).\n *\n * Tokens usually opt for a value of 18, imitating the relationship between\n * Ether and Wei. This is the value {ERC20} uses, unless this function is\n * overridden;\n *\n * NOTE: This information is only used for _display_ purposes: it in\n * no way affects any of the arithmetic of the contract, including\n * {IERC20-balanceOf} and {IERC20-transfer}.\n */\n function decimals() public view virtual override returns (uint8) {\n return 18;\n }\n\n /**\n * @dev See {IERC20-totalSupply}.\n */\n function totalSupply() public view virtual override returns (uint256) {\n return _totalSupply;\n }\n\n /**\n * @dev See {IERC20-balanceOf}.\n */\n function balanceOf(address account) public view virtual override returns (uint256) {\n return _balances[account];\n }\n\n /**\n * @dev See {IERC20-transfer}.\n *\n * Requirements:\n *\n * - `recipient` cannot be the zero address.\n * - the caller must have a balance of at least `amount`.\n */\n function transfer(address recipient, uint256 amount) public virtual override returns (bool) {\n _transfer(_msgSender(), recipient, amount);\n return true;\n }\n\n /**\n * @dev See {IERC20-allowance}.\n */\n function allowance(address owner, address spender) public view virtual override returns (uint256) {\n return _allowances[owner][spender];\n }\n\n /**\n * @dev See {IERC20-approve}.\n *\n * Requirements:\n *\n * - `spender` cannot be the zero address.\n */\n function approve(address spender, uint256 amount) public virtual override returns (bool) {\n _approve(_msgSender(), spender, amount);\n return true;\n }\n\n /**\n * @dev See {IERC20-transferFrom}.\n *\n * Emits an {Approval} event indicating the updated allowance. This is not\n * required by the EIP. See the note at the beginning of {ERC20}.\n *\n * Requirements:\n *\n * - `sender` and `recipient` cannot be the zero address.\n * - `sender` must have a balance of at least `amount`.\n * - the caller must have allowance for ``sender``'s tokens of at least\n * `amount`.\n */\n function transferFrom(\n address sender,\n address recipient,\n uint256 amount\n ) public virtual override returns (bool) {\n _transfer(sender, recipient, amount);\n\n uint256 currentAllowance = _allowances[sender][_msgSender()];\n require(currentAllowance >= amount, \"ERC20: transfer amount exceeds allowance\");\n unchecked {\n _approve(sender, _msgSender(), currentAllowance - amount);\n }\n\n return true;\n }\n\n /**\n * @dev Atomically increases the allowance granted to `spender` by the caller.\n *\n * This is an alternative to {approve} that can be used as a mitigation for\n * problems described in {IERC20-approve}.\n *\n * Emits an {Approval} event indicating the updated allowance.\n *\n * Requirements:\n *\n * - `spender` cannot be the zero address.\n */\n function increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool) {\n _approve(_msgSender(), spender, _allowances[_msgSender()][spender] + addedValue);\n return true;\n }\n\n /**\n * @dev Atomically decreases the allowance granted to `spender` by the caller.\n *\n * This is an alternative to {approve} that can be used as a mitigation for\n * problems described in {IERC20-approve}.\n *\n * Emits an {Approval} event indicating the updated allowance.\n *\n * Requirements:\n *\n * - `spender` cannot be the zero address.\n * - `spender` must have allowance for the caller of at least\n * `subtractedValue`.\n */\n function decreaseAllowance(address spender, uint256 subtractedValue) public virtual returns (bool) {\n uint256 currentAllowance = _allowances[_msgSender()][spender];\n require(currentAllowance >= subtractedValue, \"ERC20: decreased allowance below zero\");\n unchecked {\n _approve(_msgSender(), spender, currentAllowance - subtractedValue);\n }\n\n return true;\n }\n\n /**\n * @dev Moves `amount` of tokens from `sender` to `recipient`.\n *\n * This internal function is equivalent to {transfer}, and can be used to\n * e.g. implement automatic token fees, slashing mechanisms, etc.\n *\n * Emits a {Transfer} event.\n *\n * Requirements:\n *\n * - `sender` cannot be the zero address.\n * - `recipient` cannot be the zero address.\n * - `sender` must have a balance of at least `amount`.\n */\n function _transfer(\n address sender,\n address recipient,\n uint256 amount\n ) internal virtual {\n require(sender != address(0), \"ERC20: transfer from the zero address\");\n require(recipient != address(0), \"ERC20: transfer to the zero address\");\n\n _beforeTokenTransfer(sender, recipient, amount);\n\n uint256 senderBalance = _balances[sender];\n require(senderBalance >= amount, \"ERC20: transfer amount exceeds balance\");\n unchecked {\n _balances[sender] = senderBalance - amount;\n }\n _balances[recipient] += amount;\n\n emit Transfer(sender, recipient, amount);\n\n _afterTokenTransfer(sender, recipient, amount);\n }\n\n /** @dev Creates `amount` tokens and assigns them to `account`, increasing\n * the total supply.\n *\n * Emits a {Transfer} event with `from` set to the zero address.\n *\n * Requirements:\n *\n * - `account` cannot be the zero address.\n */\n function _mint(address account, uint256 amount) internal virtual {\n require(account != address(0), \"ERC20: mint to the zero address\");\n\n _beforeTokenTransfer(address(0), account, amount);\n\n _totalSupply += amount;\n _balances[account] += amount;\n emit Transfer(address(0), account, amount);\n\n _afterTokenTransfer(address(0), account, amount);\n }\n\n /**\n * @dev Destroys `amount` tokens from `account`, reducing the\n * total supply.\n *\n * Emits a {Transfer} event with `to` set to the zero address.\n *\n * Requirements:\n *\n * - `account` cannot be the zero address.\n * - `account` must have at least `amount` tokens.\n */\n function _burn(address account, uint256 amount) internal virtual {\n require(account != address(0), \"ERC20: burn from the zero address\");\n\n _beforeTokenTransfer(account, address(0), amount);\n\n uint256 accountBalance = _balances[account];\n require(accountBalance >= amount, \"ERC20: burn amount exceeds balance\");\n unchecked {\n _balances[account] = accountBalance - amount;\n }\n _totalSupply -= amount;\n\n emit Transfer(account, address(0), amount);\n\n _afterTokenTransfer(account, address(0), amount);\n }\n\n /**\n * @dev Sets `amount` as the allowance of `spender` over the `owner` s tokens.\n *\n * This internal function is equivalent to `approve`, and can be used to\n * e.g. set automatic allowances for certain subsystems, etc.\n *\n * Emits an {Approval} event.\n *\n * Requirements:\n *\n * - `owner` cannot be the zero address.\n * - `spender` cannot be the zero address.\n */\n function _approve(\n address owner,\n address spender,\n uint256 amount\n ) internal virtual {\n require(owner != address(0), \"ERC20: approve from the zero address\");\n require(spender != address(0), \"ERC20: approve to the zero address\");\n\n _allowances[owner][spender] = amount;\n emit Approval(owner, spender, amount);\n }\n\n /**\n * @dev Hook that is called before any transfer of tokens. This includes\n * minting and burning.\n *\n * Calling conditions:\n *\n * - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens\n * will be transferred to `to`.\n * - when `from` is zero, `amount` tokens will be minted for `to`.\n * - when `to` is zero, `amount` of ``from``'s tokens will be burned.\n * - `from` and `to` are never both zero.\n *\n * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].\n */\n function _beforeTokenTransfer(\n address from,\n address to,\n uint256 amount\n ) internal virtual {}\n\n /**\n * @dev Hook that is called after any transfer of tokens. This includes\n * minting and burning.\n *\n * Calling conditions:\n *\n * - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens\n * has been transferred to `to`.\n * - when `from` is zero, `amount` tokens have been minted for `to`.\n * - when `to` is zero, `amount` of ``from``'s tokens have been burned.\n * - `from` and `to` are never both zero.\n *\n * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].\n */\n function _afterTokenTransfer(\n address from,\n address to,\n uint256 amount\n ) internal virtual {}\n}\n" - }, - "solidity/contracts/libraries/LiquidityAmounts.sol": { - "content": "// SPDX-License-Identifier: GPL-2.0-or-later\npragma solidity >=0.8.4 <0.9.0;\n\nimport './FullMath.sol';\nimport './FixedPoint96.sol';\n\n// solhint-disable\nlibrary LiquidityAmounts {\n function toUint128(uint256 x) private pure returns (uint128 y) {\n require((y = uint128(x)) == x);\n }\n\n function getLiquidityForAmount0(\n uint160 sqrtRatioAX96,\n uint160 sqrtRatioBX96,\n uint256 amount0\n ) internal pure returns (uint128 liquidity) {\n if (sqrtRatioAX96 > sqrtRatioBX96) (sqrtRatioAX96, sqrtRatioBX96) = (sqrtRatioBX96, sqrtRatioAX96);\n uint256 intermediate = FullMath.mulDiv(sqrtRatioAX96, sqrtRatioBX96, FixedPoint96.Q96);\n return toUint128(FullMath.mulDiv(amount0, intermediate, sqrtRatioBX96 - sqrtRatioAX96));\n }\n\n function getLiquidityForAmount1(\n uint160 sqrtRatioAX96,\n uint160 sqrtRatioBX96,\n uint256 amount1\n ) internal pure returns (uint128 liquidity) {\n if (sqrtRatioAX96 > sqrtRatioBX96) (sqrtRatioAX96, sqrtRatioBX96) = (sqrtRatioBX96, sqrtRatioAX96);\n return toUint128(FullMath.mulDiv(amount1, FixedPoint96.Q96, sqrtRatioBX96 - sqrtRatioAX96));\n }\n\n function getLiquidityForAmounts(\n uint160 sqrtRatioX96,\n uint160 sqrtRatioAX96,\n uint160 sqrtRatioBX96,\n uint256 amount0,\n uint256 amount1\n ) internal pure returns (uint128 liquidity) {\n if (sqrtRatioAX96 > sqrtRatioBX96) (sqrtRatioAX96, sqrtRatioBX96) = (sqrtRatioBX96, sqrtRatioAX96);\n\n if (sqrtRatioX96 <= sqrtRatioAX96) {\n liquidity = getLiquidityForAmount0(sqrtRatioAX96, sqrtRatioBX96, amount0);\n } else if (sqrtRatioX96 < sqrtRatioBX96) {\n uint128 liquidity0 = getLiquidityForAmount0(sqrtRatioX96, sqrtRatioBX96, amount0);\n uint128 liquidity1 = getLiquidityForAmount1(sqrtRatioAX96, sqrtRatioX96, amount1);\n\n liquidity = liquidity0 < liquidity1 ? liquidity0 : liquidity1;\n } else {\n liquidity = getLiquidityForAmount1(sqrtRatioAX96, sqrtRatioBX96, amount1);\n }\n }\n\n function getAmount0ForLiquidity(\n uint160 sqrtRatioAX96,\n uint160 sqrtRatioBX96,\n uint128 liquidity\n ) internal pure returns (uint256 amount0) {\n if (sqrtRatioAX96 > sqrtRatioBX96) (sqrtRatioAX96, sqrtRatioBX96) = (sqrtRatioBX96, sqrtRatioAX96);\n\n return FullMath.mulDiv(uint256(liquidity) << FixedPoint96.RESOLUTION, sqrtRatioBX96 - sqrtRatioAX96, sqrtRatioBX96) / sqrtRatioAX96;\n }\n\n function getAmount1ForLiquidity(\n uint160 sqrtRatioAX96,\n uint160 sqrtRatioBX96,\n uint128 liquidity\n ) internal pure returns (uint256 amount1) {\n if (sqrtRatioAX96 > sqrtRatioBX96) (sqrtRatioAX96, sqrtRatioBX96) = (sqrtRatioBX96, sqrtRatioAX96);\n\n return FullMath.mulDiv(liquidity, sqrtRatioBX96 - sqrtRatioAX96, FixedPoint96.Q96);\n }\n\n function getAmountsForLiquidity(\n uint160 sqrtRatioX96,\n uint160 sqrtRatioAX96,\n uint160 sqrtRatioBX96,\n uint128 liquidity\n ) internal pure returns (uint256 amount0, uint256 amount1) {\n if (sqrtRatioAX96 > sqrtRatioBX96) (sqrtRatioAX96, sqrtRatioBX96) = (sqrtRatioBX96, sqrtRatioAX96);\n\n if (sqrtRatioX96 <= sqrtRatioAX96) {\n amount0 = getAmount0ForLiquidity(sqrtRatioAX96, sqrtRatioBX96, liquidity);\n } else if (sqrtRatioX96 < sqrtRatioBX96) {\n amount0 = getAmount0ForLiquidity(sqrtRatioX96, sqrtRatioBX96, liquidity);\n amount1 = getAmount1ForLiquidity(sqrtRatioAX96, sqrtRatioX96, liquidity);\n } else {\n amount1 = getAmount1ForLiquidity(sqrtRatioAX96, sqrtRatioBX96, liquidity);\n }\n }\n}\n" - }, - "solidity/contracts/libraries/PoolAddress.sol": { - "content": "// SPDX-License-Identifier: GPL-2.0-or-later\npragma solidity >=0.8.4 <0.9.0;\n\nlibrary PoolAddress {\n struct PoolKey {\n address token0;\n address token1;\n uint24 fee;\n }\n}\n" - }, - "solidity/contracts/libraries/FixedPoint96.sol": { - "content": "// SPDX-License-Identifier: GPL-2.0-or-later\npragma solidity >=0.8.4 <0.9.0;\n\nlibrary FixedPoint96 {\n // solhint-disable\n uint8 internal constant RESOLUTION = 96;\n uint256 internal constant Q96 = 0x1000000000000000000000000;\n}\n" - }, - "solidity/contracts/UniV3PairManager.sol": { - "content": "// SPDX-License-Identifier: MIT\n\n/*\n\nCoded for The Keep3r Network with ♥ by\n\n██████╗░███████╗███████╗██╗  ░██╗░░░░░░░██╗░█████╗░███╗░░██╗██████╗░███████╗██████╗░██╗░░░░░░█████╗░███╗░░██╗██████╗░\n██╔══██╗██╔════╝██╔════╝██║  ░██║░░██╗░░██║██╔══██╗████╗░██║██╔══██╗██╔════╝██╔══██╗██║░░░░░██╔══██╗████╗░██║██╔══██╗\n██║░░██║█████╗░░█████╗░░██║  ░╚██╗████╗██╔╝██║░░██║██╔██╗██║██║░░██║█████╗░░██████╔╝██║░░░░░███████║██╔██╗██║██║░░██║\n██║░░██║██╔══╝░░██╔══╝░░██║  ░░████╔═████║░██║░░██║██║╚████║██║░░██║██╔══╝░░██╔══██╗██║░░░░░██╔══██║██║╚████║██║░░██║\n██████╔╝███████╗██║░░░░░██║  ░░╚██╔╝░╚██╔╝░╚█████╔╝██║░╚███║██████╔╝███████╗██║░░██║███████╗██║░░██║██║░╚███║██████╔╝\n╚═════╝░╚══════╝╚═╝░░░░░╚═╝  ░░░╚═╝░░░╚═╝░░░╚════╝░╚═╝░░╚══╝╚═════╝░╚══════╝╚═╝░░╚═╝╚══════╝╚═╝░░╚═╝╚═╝░░╚══╝╚═════╝░\n\nhttps://defi.sucks\n\n*/\n\npragma solidity >=0.8.4 <0.9.0;\n\nimport '@openzeppelin/contracts/token/ERC20/ERC20.sol';\nimport '@uniswap/v3-core/contracts/interfaces/IUniswapV3Pool.sol';\n\nimport './libraries/LiquidityAmounts.sol';\nimport './libraries/PoolAddress.sol';\nimport './libraries/FixedPoint96.sol';\nimport './libraries/FullMath.sol';\nimport './libraries/TickMath.sol';\n\nimport '../interfaces/external/IWeth9.sol';\nimport '../interfaces/IUniV3PairManager.sol';\n\nimport './peripherals/Governable.sol';\n\ncontract UniV3PairManager is IUniV3PairManager, Governable {\n /// @inheritdoc IERC20Metadata\n string public override name;\n\n /// @inheritdoc IERC20Metadata\n string public override symbol;\n\n /// @inheritdoc IERC20\n uint256 public override totalSupply;\n\n /// @inheritdoc IPairManager\n address public immutable override factory;\n\n /// @inheritdoc IPairManager\n address public immutable override token0;\n\n /// @inheritdoc IPairManager\n address public immutable override token1;\n\n /// @inheritdoc IPairManager\n address public immutable override pool;\n\n /// @inheritdoc IUniV3PairManager\n uint24 public immutable override fee;\n\n /// @inheritdoc IUniV3PairManager\n uint160 public immutable override sqrtRatioAX96;\n\n /// @inheritdoc IUniV3PairManager\n uint160 public immutable override sqrtRatioBX96;\n\n /// @inheritdoc IUniV3PairManager\n int24 public immutable override tickLower;\n\n /// @inheritdoc IUniV3PairManager\n int24 public immutable override tickUpper;\n\n /// @inheritdoc IUniV3PairManager\n int24 public immutable override tickSpacing;\n\n /// @notice Uniswap's maximum tick\n /// @dev Due to tick spacing, pools with different fees may have differences between _MAX_TICK and tickUpper. Use tickUpper to find the max tick of the pool.\n int24 private constant _MAX_TICK = 887272;\n\n /// @inheritdoc IERC20Metadata\n //solhint-disable-next-line const-name-snakecase\n uint8 public constant override decimals = 18;\n\n /// @inheritdoc IERC20\n mapping(address => mapping(address => uint256)) public override allowance;\n\n /// @inheritdoc IERC20\n mapping(address => uint256) public override balanceOf;\n\n /// @notice Struct that contains token0, token1, and fee of the Uniswap pool\n PoolAddress.PoolKey private _poolKey;\n\n constructor(address _pool, address _governance) Governable(_governance) {\n uint24 _fee = IUniswapV3Pool(_pool).fee();\n address _token0 = IUniswapV3Pool(_pool).token0();\n address _token1 = IUniswapV3Pool(_pool).token1();\n int24 _tickSpacing = IUniswapV3Pool(_pool).tickSpacing();\n int24 _tickUpper = _MAX_TICK - (_MAX_TICK % _tickSpacing);\n int24 _tickLower = -_tickUpper;\n\n factory = msg.sender;\n pool = _pool;\n fee = _fee;\n tickSpacing = _tickSpacing;\n tickUpper = _tickUpper;\n tickLower = _tickLower;\n token0 = _token0;\n token1 = _token1;\n name = string(abi.encodePacked('Keep3rLP - ', ERC20(_token0).symbol(), '/', ERC20(_token1).symbol()));\n symbol = string(abi.encodePacked('kLP-', ERC20(_token0).symbol(), '/', ERC20(_token1).symbol()));\n\n sqrtRatioAX96 = TickMath.getSqrtRatioAtTick(_tickLower);\n sqrtRatioBX96 = TickMath.getSqrtRatioAtTick(_tickUpper);\n _poolKey = PoolAddress.PoolKey({token0: _token0, token1: _token1, fee: _fee});\n }\n\n // This low-level function should be called from a contract which performs important safety checks\n /// @inheritdoc IUniV3PairManager\n function mint(\n uint256 amount0Desired,\n uint256 amount1Desired,\n uint256 amount0Min,\n uint256 amount1Min,\n address to\n ) external override returns (uint128 liquidity) {\n (liquidity, , ) = _addLiquidity(amount0Desired, amount1Desired, amount0Min, amount1Min);\n _mint(to, liquidity);\n }\n\n /// @inheritdoc IUniV3PairManager\n function uniswapV3MintCallback(\n uint256 amount0Owed,\n uint256 amount1Owed,\n bytes calldata data\n ) external override {\n MintCallbackData memory decoded = abi.decode(data, (MintCallbackData));\n if (msg.sender != pool) revert OnlyPool();\n if (amount0Owed > 0) _pay(decoded._poolKey.token0, decoded.payer, pool, amount0Owed);\n if (amount1Owed > 0) _pay(decoded._poolKey.token1, decoded.payer, pool, amount1Owed);\n }\n\n /// @inheritdoc IUniV3PairManager\n function burn(\n uint128 liquidity,\n uint256 amount0Min,\n uint256 amount1Min,\n address to\n ) external override returns (uint256 amount0, uint256 amount1) {\n (amount0, amount1) = IUniswapV3Pool(pool).burn(tickLower, tickUpper, liquidity);\n\n if (amount0 < amount0Min || amount1 < amount1Min) revert ExcessiveSlippage();\n\n IUniswapV3Pool(pool).collect(to, tickLower, tickUpper, uint128(amount0), uint128(amount1));\n _burn(msg.sender, liquidity);\n }\n\n /// @inheritdoc IUniV3PairManager\n function collect() external override onlyGovernance returns (uint256 amount0, uint256 amount1) {\n (, , , uint128 tokensOwed0, uint128 tokensOwed1) = IUniswapV3Pool(pool).positions(\n keccak256(abi.encodePacked(address(this), tickLower, tickUpper))\n );\n (amount0, amount1) = IUniswapV3Pool(pool).collect(governance, tickLower, tickUpper, tokensOwed0, tokensOwed1);\n }\n\n /// @inheritdoc IUniV3PairManager\n function position()\n external\n view\n override\n returns (\n uint128 liquidity,\n uint256 feeGrowthInside0LastX128,\n uint256 feeGrowthInside1LastX128,\n uint128 tokensOwed0,\n uint128 tokensOwed1\n )\n {\n (liquidity, feeGrowthInside0LastX128, feeGrowthInside1LastX128, tokensOwed0, tokensOwed1) = IUniswapV3Pool(pool).positions(\n keccak256(abi.encodePacked(address(this), tickLower, tickUpper))\n );\n }\n\n /// @inheritdoc IERC20\n function approve(address spender, uint256 amount) external override returns (bool) {\n allowance[msg.sender][spender] = amount;\n\n emit Approval(msg.sender, spender, amount);\n return true;\n }\n\n /// @inheritdoc IERC20\n function transfer(address to, uint256 amount) external override returns (bool) {\n _transferTokens(msg.sender, to, amount);\n return true;\n }\n\n /// @inheritdoc IERC20\n function transferFrom(\n address from,\n address to,\n uint256 amount\n ) external override returns (bool) {\n address spender = msg.sender;\n uint256 spenderAllowance = allowance[from][spender];\n\n if (spender != from && spenderAllowance != type(uint256).max) {\n uint256 newAllowance = spenderAllowance - amount;\n allowance[from][spender] = newAllowance;\n\n emit Approval(from, spender, newAllowance);\n }\n\n _transferTokens(from, to, amount);\n return true;\n }\n\n /// @notice Adds liquidity to an initialized pool\n /// @dev Reverts if the returned amount0 is less than amount0Min or if amount1 is less than amount1Min\n /// @dev This function calls the mint function of the corresponding Uniswap pool, which in turn calls UniswapV3Callback\n /// @param amount0Desired The amount of token0 we would like to provide\n /// @param amount1Desired The amount of token1 we would like to provide\n /// @param amount0Min The minimum amount of token0 we want to provide\n /// @param amount1Min The minimum amount of token1 we want to provide\n /// @return liquidity The calculated liquidity we get for the token amounts we provided\n /// @return amount0 The amount of token0 we ended up providing\n /// @return amount1 The amount of token1 we ended up providing\n function _addLiquidity(\n uint256 amount0Desired,\n uint256 amount1Desired,\n uint256 amount0Min,\n uint256 amount1Min\n )\n internal\n returns (\n uint128 liquidity,\n uint256 amount0,\n uint256 amount1\n )\n {\n (uint160 sqrtPriceX96, , , , , , ) = IUniswapV3Pool(pool).slot0();\n\n liquidity = LiquidityAmounts.getLiquidityForAmounts(sqrtPriceX96, sqrtRatioAX96, sqrtRatioBX96, amount0Desired, amount1Desired);\n\n (amount0, amount1) = IUniswapV3Pool(pool).mint(\n address(this),\n tickLower,\n tickUpper,\n liquidity,\n abi.encode(MintCallbackData({_poolKey: _poolKey, payer: msg.sender}))\n );\n\n if (amount0 < amount0Min || amount1 < amount1Min) revert ExcessiveSlippage();\n }\n\n /// @notice Transfers the passed-in token from the payer to the recipient for the corresponding value\n /// @param token The token to be transferred to the recipient\n /// @param from The address of the payer\n /// @param to The address of the passed-in tokens recipient\n /// @param value How much of that token to be transferred from payer to the recipient\n function _pay(\n address token,\n address from,\n address to,\n uint256 value\n ) internal {\n _safeTransferFrom(token, from, to, value);\n }\n\n /// @notice Mints Keep3r credits to the passed-in address of recipient and increases total supply of Keep3r credits by the corresponding amount\n /// @param to The recipient of the Keep3r credits\n /// @param amount The amount Keep3r credits to be minted to the recipient\n function _mint(address to, uint256 amount) internal {\n totalSupply += amount;\n balanceOf[to] += amount;\n emit Transfer(address(0), to, amount);\n }\n\n /// @notice Burns Keep3r credits to the passed-in address of recipient and reduces total supply of Keep3r credits by the corresponding amount\n /// @param to The address that will get its Keep3r credits burned\n /// @param amount The amount Keep3r credits to be burned from the recipient/recipient\n function _burn(address to, uint256 amount) internal {\n totalSupply -= amount;\n balanceOf[to] -= amount;\n emit Transfer(to, address(0), amount);\n }\n\n /// @notice Transfers amount of Keep3r credits between two addresses\n /// @param from The user that transfers the Keep3r credits\n /// @param to The user that receives the Keep3r credits\n /// @param amount The amount of Keep3r credits to be transferred\n function _transferTokens(\n address from,\n address to,\n uint256 amount\n ) internal {\n balanceOf[from] -= amount;\n balanceOf[to] += amount;\n\n emit Transfer(from, to, amount);\n }\n\n /// @notice Transfers the passed-in token from the specified \"from\" to the specified \"to\" for the corresponding value\n /// @dev Reverts with IUniV3PairManager#UnsuccessfulTransfer if the transfer was not successful,\n /// or if the passed data length is different than 0 and the decoded data is not a boolean\n /// @param token The token to be transferred to the specified \"to\"\n /// @param from The address which is going to transfer the tokens\n /// @param value How much of that token to be transferred from \"from\" to \"to\"\n function _safeTransferFrom(\n address token,\n address from,\n address to,\n uint256 value\n ) internal {\n // solhint-disable-next-line avoid-low-level-calls\n (bool success, bytes memory data) = token.call(abi.encodeWithSelector(IERC20.transferFrom.selector, from, to, value));\n if (!success || (data.length != 0 && !abi.decode(data, (bool)))) revert UnsuccessfulTransfer();\n }\n}\n" - }, - "solidity/interfaces/external/IWeth9.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '@openzeppelin/contracts/token/ERC20/IERC20.sol';\n\ninterface IWeth9 is IERC20 {\n function deposit() external payable;\n\n function withdraw(uint256) external;\n}\n" - }, - "solidity/interfaces/IUniV3PairManager.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport './IPairManager.sol';\nimport '../contracts/libraries/PoolAddress.sol';\nimport '@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol';\nimport './peripherals/IGovernable.sol';\n\n/// @title Pair Manager contract\n/// @notice Creates a UniswapV3 position, and tokenizes in an ERC20 manner\n/// so that the user can use it as liquidity for a Keep3rJob\ninterface IUniV3PairManager is IGovernable, IPairManager {\n // Structs\n\n /// @notice The data to be decoded by the UniswapV3MintCallback function\n struct MintCallbackData {\n PoolAddress.PoolKey _poolKey; // Struct that contains token0, token1, and fee of the pool passed into the constructor\n address payer; // The address of the payer, which will be the msg.sender of the mint function\n }\n\n // Variables\n\n /// @notice The fee of the Uniswap pool passed into the constructor\n /// @return _fee The fee of the Uniswap pool passed into the constructor\n function fee() external view returns (uint24 _fee);\n\n /// @notice Highest tick in the Uniswap's curve\n /// @return _tickUpper The highest tick in the Uniswap's curve\n function tickUpper() external view returns (int24 _tickUpper);\n\n /// @notice Lowest tick in the Uniswap's curve\n /// @return _tickLower The lower tick in the Uniswap's curve\n function tickLower() external view returns (int24 _tickLower);\n\n /// @notice The pair tick spacing\n /// @return _tickSpacing The pair tick spacing\n function tickSpacing() external view returns (int24 _tickSpacing);\n\n /// @notice The sqrtRatioAX96 at the lowest tick (-887200) of the Uniswap pool\n /// @return _sqrtPriceA96 A Fixed point Q64.96 number representing the sqrt of the ratio of the two assets (token1/token0)\n /// at the lowest tick\n function sqrtRatioAX96() external view returns (uint160 _sqrtPriceA96);\n\n /// @notice The sqrtRatioBX96 at the highest tick (887200) of the Uniswap pool\n /// @return _sqrtPriceBX96 A Fixed point Q64.96 number representing the sqrt of the ratio of the two assets (token1/token0)\n /// at the highest tick\n function sqrtRatioBX96() external view returns (uint160 _sqrtPriceBX96);\n\n // Errors\n\n /// @notice Throws when the caller of the function is not the pool\n error OnlyPool();\n\n /// @notice Throws when the slippage exceeds what the user is comfortable with\n error ExcessiveSlippage();\n\n /// @notice Throws when a transfer is unsuccessful\n error UnsuccessfulTransfer();\n\n // Methods\n\n /// @notice This function is called after a user calls IUniV3PairManager#mint function\n /// It ensures that any tokens owed to the pool are paid by the msg.sender of IUniV3PairManager#mint function\n /// @param amount0Owed The amount of token0 due to the pool for the minted liquidity\n /// @param amount1Owed The amount of token1 due to the pool for the minted liquidity\n /// @param data The encoded token0, token1, fee (_poolKey) and the payer (msg.sender) of the IUniV3PairManager#mint function\n function uniswapV3MintCallback(\n uint256 amount0Owed,\n uint256 amount1Owed,\n bytes calldata data\n ) external;\n\n /// @notice Mints kLP tokens to an address according to the liquidity the msg.sender provides to the UniswapV3 pool\n /// @dev Triggers UniV3PairManager#uniswapV3MintCallback\n /// @param amount0Desired The amount of token0 we would like to provide\n /// @param amount1Desired The amount of token1 we would like to provide\n /// @param amount0Min The minimum amount of token0 we want to provide\n /// @param amount1Min The minimum amount of token1 we want to provide\n /// @param to The address to which the kLP tokens are going to be minted to\n /// @return liquidity kLP tokens sent in exchange for the provision of tokens\n function mint(\n uint256 amount0Desired,\n uint256 amount1Desired,\n uint256 amount0Min,\n uint256 amount1Min,\n address to\n ) external returns (uint128 liquidity);\n\n /// @notice Returns the pair manager's position in the corresponding UniswapV3 pool\n /// @return liquidity The amount of liquidity provided to the UniswapV3 pool by the pair manager\n /// @return feeGrowthInside0LastX128 The fee growth of token0 as of the last action on the individual position\n /// @return feeGrowthInside1LastX128 The fee growth of token1 as of the last action on the individual position\n /// @return tokensOwed0 The uncollected amount of token0 owed to the position as of the last computation\n /// @return tokensOwed1 The uncollected amount of token1 owed to the position as of the last computation\n function position()\n external\n view\n returns (\n uint128 liquidity,\n uint256 feeGrowthInside0LastX128,\n uint256 feeGrowthInside1LastX128,\n uint128 tokensOwed0,\n uint128 tokensOwed1\n );\n\n /// @notice Calls the UniswapV3 pool's collect function, which collects up to a maximum amount of fees\n // owed to a specific position to the recipient, in this case, that recipient is the pair manager\n /// @dev The collected fees will be sent to governance\n /// @return amount0 The amount of fees collected in token0\n /// @return amount1 The amount of fees collected in token1\n function collect() external returns (uint256 amount0, uint256 amount1);\n\n /// @notice Burns the corresponding amount of kLP tokens from the msg.sender and withdraws the specified liquidity\n // in the entire range\n /// @param liquidity The amount of liquidity to be burned\n /// @param amount0Min The minimum amount of token0 we want to send to the recipient (to)\n /// @param amount1Min The minimum amount of token1 we want to send to the recipient (to)\n /// @param to The address that will receive the due fees\n /// @return amount0 The calculated amount of token0 that will be sent to the recipient\n /// @return amount1 The calculated amount of token1 that will be sent to the recipient\n function burn(\n uint128 liquidity,\n uint256 amount0Min,\n uint256 amount1Min,\n address to\n ) external returns (uint256 amount0, uint256 amount1);\n}\n" - }, - "@openzeppelin/contracts/utils/Context.sol": { - "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Provides information about the current execution context, including the\n * sender of the transaction and its data. While these are generally available\n * via msg.sender and msg.data, they should not be accessed in such a direct\n * manner, since when dealing with meta-transactions the account sending and\n * paying for execution may not be the actual sender (as far as an application\n * is concerned).\n *\n * This contract is only required for intermediate, library-like contracts.\n */\nabstract contract Context {\n function _msgSender() internal view virtual returns (address) {\n return msg.sender;\n }\n\n function _msgData() internal view virtual returns (bytes calldata) {\n return msg.data;\n }\n}\n" - }, - "solidity/interfaces/IPairManagerFactory.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport './peripherals/IGovernable.sol';\n\n/// @title Factory of Pair Managers\n/// @notice This contract creates new pair managers\ninterface IPairManagerFactory is IGovernable {\n // Variables\n\n /// @notice Maps the address of a Uniswap pool, to the address of the corresponding PairManager\n /// For example, the uniswap address of DAI-WETH, will return the Keep3r/DAI-WETH pair manager address\n /// @param _pool The address of the Uniswap pool\n /// @return _pairManager The address of the corresponding pair manager\n function pairManagers(address _pool) external view returns (address _pairManager);\n\n // Events\n\n /// @notice Emitted when a new pair manager is created\n /// @param _pool The address of the corresponding Uniswap pool\n /// @param _pairManager The address of the just-created pair manager\n event PairCreated(address _pool, address _pairManager);\n\n // Errors\n\n /// @notice Throws an error if the pair manager is already initialized\n error AlreadyInitialized();\n\n /// @notice Throws an error if the caller is not the owner\n error OnlyOwner();\n\n // Methods\n\n /// @notice Creates a new pair manager based on the address of a Uniswap pool\n /// For example, the uniswap address of DAI-WETH, will create the Keep3r/DAI-WETH pool\n /// @param _pool The address of the Uniswap pool the pair manager will be based of\n /// @return _pairManager The address of the just-created pair manager\n function createPairManager(address _pool) external returns (address _pairManager);\n}\n" - }, - "solidity/contracts/UniV3PairManagerFactory.sol": { - "content": "// SPDX-License-Identifier: MIT\n\n/*\n\nCoded for The Keep3r Network with ♥ by\n\n██████╗░███████╗███████╗██╗  ░██╗░░░░░░░██╗░█████╗░███╗░░██╗██████╗░███████╗██████╗░██╗░░░░░░█████╗░███╗░░██╗██████╗░\n██╔══██╗██╔════╝██╔════╝██║  ░██║░░██╗░░██║██╔══██╗████╗░██║██╔══██╗██╔════╝██╔══██╗██║░░░░░██╔══██╗████╗░██║██╔══██╗\n██║░░██║█████╗░░█████╗░░██║  ░╚██╗████╗██╔╝██║░░██║██╔██╗██║██║░░██║█████╗░░██████╔╝██║░░░░░███████║██╔██╗██║██║░░██║\n██║░░██║██╔══╝░░██╔══╝░░██║  ░░████╔═████║░██║░░██║██║╚████║██║░░██║██╔══╝░░██╔══██╗██║░░░░░██╔══██║██║╚████║██║░░██║\n██████╔╝███████╗██║░░░░░██║  ░░╚██╔╝░╚██╔╝░╚█████╔╝██║░╚███║██████╔╝███████╗██║░░██║███████╗██║░░██║██║░╚███║██████╔╝\n╚═════╝░╚══════╝╚═╝░░░░░╚═╝  ░░░╚═╝░░░╚═╝░░░╚════╝░╚═╝░░╚══╝╚═════╝░╚══════╝╚═╝░░╚═╝╚══════╝╚═╝░░╚═╝╚═╝░░╚══╝╚═════╝░\n\nhttps://defi.sucks\n\n*/\n\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../interfaces/IPairManagerFactory.sol';\nimport './UniV3PairManager.sol';\nimport './peripherals/Governable.sol';\n\n/// @title Factory of Pair Managers\n/// @notice This contract creates new pair managers\ncontract UniV3PairManagerFactory is IPairManagerFactory, Governable {\n mapping(address => address) public override pairManagers;\n\n constructor(address _governance) Governable(_governance) {}\n\n ///@inheritdoc IPairManagerFactory\n function createPairManager(address _pool) external override returns (address _pairManager) {\n if (pairManagers[_pool] != address(0)) revert AlreadyInitialized();\n _pairManager = address(new UniV3PairManager(_pool, governance));\n pairManagers[_pool] = _pairManager;\n emit PairCreated(_pool, _pairManager);\n }\n}\n" - }, - "solidity/for-test/peripherals/GovernableForTest.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../../contracts/peripherals/Governable.sol';\n\ncontract GovernableForTest is Governable {\n constructor(address _governor) Governable(_governor) {}\n}\n" - }, - "solidity/for-test/BridgeForTest.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.0 <0.9.0;\n\nimport '@openzeppelin/contracts/token/ERC20/ERC20.sol';\nimport '@openzeppelin/contracts/token/ERC20/IERC20.sol';\n\ncontract BridgeForTest is ERC20 {\n address public immutable kp3r;\n\n constructor(address _kp3r) ERC20('Wrapped KP3R', 'wKP3R') {\n kp3r = _kp3r;\n }\n\n function bridge(uint256 _amount) external {\n IERC20(kp3r).transferFrom(msg.sender, address(this), _amount);\n _mint(msg.sender, _amount);\n }\n\n function bridgeBack(uint256 _amount) external {\n _burn(msg.sender, _amount);\n IERC20(kp3r).transfer(msg.sender, _amount);\n }\n}\n" - }, - "solidity/for-test/ERC20ForTest.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '@openzeppelin/contracts/token/ERC20/ERC20.sol';\n\ncontract ERC20ForTest is ERC20 {\n constructor(\n string memory _name,\n string memory _symbol,\n address _initialAccount,\n uint256 _initialBalance\n ) ERC20(_name, _symbol) {\n _mint(_initialAccount, _initialBalance);\n }\n\n function mint(uint256 _amount) public {\n _mint(msg.sender, _amount);\n }\n\n function mint(address _account, uint256 _amount) public {\n _mint(_account, _amount);\n }\n\n function burn(uint256 _amount) public {\n _burn(msg.sender, _amount);\n }\n\n function burn(address _account, uint256 _amount) public {\n _burn(_account, _amount);\n }\n\n function transferInternal(\n address _from,\n address _to,\n uint256 _value\n ) public {\n _transfer(_from, _to, _value);\n }\n\n function approveInternal(\n address _owner,\n address _spender,\n uint256 _value\n ) public {\n _approve(_owner, _spender, _value);\n }\n\n function deposit() external payable {\n // Function added for compatibility with WETH\n }\n}\n" - }, - "solidity/for-test/peripherals/keepers/Keep3rKeeperFundableForTest.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../../../contracts/peripherals/keepers/Keep3rKeeperFundable.sol';\n\ncontract Keep3rKeeperFundableForTest is Keep3rKeeperFundable {\n using EnumerableSet for EnumerableSet.AddressSet;\n\n constructor(\n address _kph,\n address _keep3rV1,\n address _keep3rV1Proxy\n ) Keep3rParameters(_kph, _keep3rV1, _keep3rV1Proxy) Keep3rRoles(msg.sender) {}\n\n function isKeeper(address _keeper) external view returns (bool) {\n return _keepers.contains(_keeper);\n }\n\n function setJob(address job) external {\n _jobs.add(job);\n }\n}\n" - }, - "solidity/contracts/sidechain/Keep3rEscrow.sol": { - "content": "// SPDX-License-Identifier: MIT\n\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../peripherals/Mintable.sol';\nimport '../peripherals/DustCollector.sol';\nimport '../../interfaces/sidechain/IKeep3rEscrow.sol';\nimport '@openzeppelin/contracts/token/ERC20/IERC20.sol';\nimport '@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol';\n\ncontract Keep3rEscrow is Mintable, DustCollector, IKeep3rEscrow {\n using SafeERC20 for IERC20;\n\n /// @inheritdoc IKeep3rEscrow\n address public override wKP3R;\n\n /// @param _governance Address of governance\n /// @param _wKP3R Address of wrapped KP3R implementation\n constructor(address _governance, address _wKP3R) Mintable(_governance) {\n wKP3R = _wKP3R;\n }\n\n /// @inheritdoc IKeep3rEscrow\n function deposit(uint256 _amount) external override {\n IERC20(wKP3R).safeTransferFrom(msg.sender, address(this), _amount);\n emit wKP3RDeposited(wKP3R, msg.sender, _amount);\n }\n\n /// @inheritdoc IKeep3rEscrow\n function mint(uint256 _amount) external override onlyMinter {\n IERC20(wKP3R).safeTransfer(msg.sender, _amount);\n emit wKP3RMinted(wKP3R, msg.sender, _amount);\n }\n\n /// @inheritdoc IKeep3rEscrow\n function setWKP3R(address _wKP3R) external override onlyGovernance {\n if (_wKP3R == address(0)) revert ZeroAddress();\n wKP3R = _wKP3R;\n emit wKP3RSet(wKP3R);\n }\n}\n" - }, - "solidity/contracts/peripherals/Mintable.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../../interfaces/peripherals/IMintable.sol';\nimport './Governable.sol';\n\nabstract contract Mintable is Governable, IMintable {\n /// @inheritdoc IMintable\n address public override minter;\n\n constructor(address _governance) Governable(_governance) {}\n\n /// @inheritdoc IMintable\n function setMinter(address _minter) external override onlyGovernance {\n if (_minter == address(0)) revert ZeroAddress();\n minter = _minter;\n emit MinterSet(_minter);\n }\n\n /// @notice Functions with this modifier can only be called by the minter;\n modifier onlyMinter() {\n if (msg.sender != minter) revert OnlyMinter();\n _;\n }\n}\n" - }, - "solidity/for-test/peripherals/DustCollectorForTest.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../../contracts/peripherals/DustCollector.sol';\n\ncontract DustCollectorForTest is DustCollector {\n constructor() DustCollector() Governable(msg.sender) {}\n}\n" - }, - "solidity/for-test/peripherals/Keep3rAccountanceForTest.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../../contracts/peripherals/Keep3rAccountance.sol';\n\ncontract Keep3rAccountanceForTest is Keep3rAccountance {\n using EnumerableSet for EnumerableSet.AddressSet;\n\n constructor() Keep3rRoles(msg.sender) {}\n\n function setJob(address job) external {\n _jobs.add(job);\n }\n\n function setKeeper(address keeper) external {\n _keepers.add(keeper);\n }\n}\n" - }, - "solidity/for-test/peripherals/jobs/Keep3rJobFundableLiquidityForTest.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../../../contracts/peripherals/jobs/Keep3rJobFundableLiquidity.sol';\n\ncontract Keep3rJobFundableLiquidityForTest is Keep3rJobFundableLiquidity {\n using EnumerableSet for EnumerableSet.AddressSet;\n\n constructor(\n address _kph,\n address _keep3rV1,\n address _keep3rV1Proxy\n ) Keep3rParameters(_kph, _keep3rV1, _keep3rV1Proxy) Keep3rRoles(msg.sender) {}\n\n function setJob(address _job) external {\n _jobs.add(_job);\n }\n\n function setJobLiquidity(address _job, address _liquidity) external returns (bool) {\n return _jobLiquidities[_job].add(_liquidity);\n }\n\n function setApprovedLiquidity(address _liquidity) external {\n _approvedLiquidities.add(_liquidity);\n }\n\n function setRevokedLiquidity(address _liquidity) external {\n _approvedLiquidities.remove(_liquidity);\n }\n\n function viewTickCache(address _liquidity) external view returns (TickCache memory _tickCache) {\n _tickCache = _tick[_liquidity];\n }\n\n function viewTickOrder(address _liquidity) external view returns (bool) {\n return _isKP3RToken0[_liquidity];\n }\n\n function internalJobLiquidities(address _job) external view returns (address[] memory _list) {\n _list = _jobLiquidities[_job].values();\n }\n\n function internalSettleJobAccountance(address _job) external {\n _settleJobAccountance(_job);\n }\n}\n" - }, - "solidity/for-test/peripherals/jobs/Keep3rJobDisputableForTest.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../../../contracts/peripherals/jobs/Keep3rJobDisputable.sol';\n\ncontract Keep3rJobDisputableForTest is Keep3rJobDisputable {\n using EnumerableSet for EnumerableSet.AddressSet;\n\n constructor(\n address _kph,\n address _keep3rV1,\n address _keep3rV1Proxy\n ) Keep3rParameters(_kph, _keep3rV1, _keep3rV1Proxy) Keep3rRoles(msg.sender) {}\n\n function setJobLiquidity(address _job, address _liquidity) external {\n _jobLiquidities[_job].add(_liquidity);\n }\n\n function setJobToken(address _job, address _token) external {\n _jobTokens[_job].add(_token);\n }\n\n function setApprovedLiquidity(address _liquidity) external {\n _approvedLiquidities.add(_liquidity);\n }\n\n function setRevokedLiquidity(address _liquidity) external {\n _approvedLiquidities.remove(_liquidity);\n }\n\n function internalJobLiquidityCredits(address _job) external view returns (uint256 _credits) {\n _credits = _jobLiquidityCredits[_job];\n }\n\n function internalJobPeriodCredits(address _job) external view returns (uint256 _credits) {\n _credits = _jobPeriodCredits[_job];\n }\n\n function internalJobTokens(address _job) external view returns (address[] memory _tokens) {\n _tokens = new address[](_jobTokens[_job].length());\n for (uint256 i; i < _jobTokens[_job].length(); i++) {\n _tokens[i] = _jobTokens[_job].at(i);\n }\n }\n\n function internalJobLiquidities(address _job) external view returns (address[] memory _tokens) {\n _tokens = new address[](_jobLiquidities[_job].length());\n for (uint256 i; i < _jobLiquidities[_job].length(); i++) {\n _tokens[i] = _jobLiquidities[_job].at(i);\n }\n }\n}\n" - }, - "solidity/for-test/peripherals/Keep3rDisputableForTest.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../../contracts/peripherals/Keep3rDisputable.sol';\n\ncontract Keep3rDisputableForTest is Keep3rDisputable {\n constructor() Keep3rParameters(address(0), address(0), address(0)) Keep3rRoles(msg.sender) {}\n}\n" - }, - "solidity/for-test/peripherals/keepers/Keep3rKeeperDisputableForTest.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../../../contracts/peripherals/keepers/Keep3rKeeperDisputable.sol';\n\ncontract Keep3rKeeperDisputableForTest is Keep3rKeeperDisputable {\n using EnumerableSet for EnumerableSet.AddressSet;\n\n constructor(\n address _kph,\n address _keep3rV1,\n address _keep3rV1Proxy\n ) Keep3rParameters(_kph, _keep3rV1, _keep3rV1Proxy) Keep3rRoles(msg.sender) {}\n\n function setKeeper(address _keeper) external {\n _keepers.add(_keeper);\n }\n\n function internalSlash(\n address _bonded,\n address _keeper,\n uint256 _bondAmount,\n uint256 _unbondAmount\n ) external {\n _slash(_bonded, _keeper, _bondAmount, _unbondAmount);\n }\n\n function isKeeper(address _address) external view returns (bool _isKeeper) {\n _isKeeper = _keepers.contains(_address);\n }\n}\n" - }, - "solidity/for-test/peripherals/jobs/Keep3rJobFundableCreditsForTest.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../../../contracts/peripherals/jobs/Keep3rJobFundableCredits.sol';\n\ncontract Keep3rJobFundableCreditsForTest is Keep3rJobFundableCredits {\n using EnumerableSet for EnumerableSet.AddressSet;\n\n constructor(\n address _kph,\n address _keep3rV1,\n address _keep3rV1Proxy\n ) Keep3rParameters(_kph, _keep3rV1, _keep3rV1Proxy) Keep3rRoles(msg.sender) {}\n\n function setJob(address _job, address _jobOwner) external {\n _jobs.add(_job);\n jobOwner[_job] = _jobOwner;\n }\n\n function setJobToken(address _job, address _token) external {\n _jobTokens[_job].add(_token);\n }\n\n function isJobToken(address _job, address _token) external view returns (bool _contains) {\n _contains = _jobTokens[_job].contains(_token);\n }\n}\n" - }, - "solidity/contracts/Keep3rHelper.sol": { - "content": "// SPDX-License-Identifier: MIT\n\n/*\n\nCoded for The Keep3r Network with ♥ by\n\n██████╗░███████╗███████╗██╗  ░██╗░░░░░░░██╗░█████╗░███╗░░██╗██████╗░███████╗██████╗░██╗░░░░░░█████╗░███╗░░██╗██████╗░\n██╔══██╗██╔════╝██╔════╝██║  ░██║░░██╗░░██║██╔══██╗████╗░██║██╔══██╗██╔════╝██╔══██╗██║░░░░░██╔══██╗████╗░██║██╔══██╗\n██║░░██║█████╗░░█████╗░░██║  ░╚██╗████╗██╔╝██║░░██║██╔██╗██║██║░░██║█████╗░░██████╔╝██║░░░░░███████║██╔██╗██║██║░░██║\n██║░░██║██╔══╝░░██╔══╝░░██║  ░░████╔═████║░██║░░██║██║╚████║██║░░██║██╔══╝░░██╔══██╗██║░░░░░██╔══██║██║╚████║██║░░██║\n██████╔╝███████╗██║░░░░░██║  ░░╚██╔╝░╚██╔╝░╚█████╔╝██║░╚███║██████╔╝███████╗██║░░██║███████╗██║░░██║██║░╚███║██████╔╝\n╚═════╝░╚══════╝╚═╝░░░░░╚═╝  ░░░╚═╝░░░╚═╝░░░╚════╝░╚═╝░░╚══╝╚═════╝░╚══════╝╚═╝░░╚═╝╚══════╝╚═╝░░╚═╝╚═╝░░╚══╝╚═════╝░\n\nhttps://defi.sucks\n\n*/\n\npragma solidity >=0.8.7 <0.9.0;\n\nimport './libraries/FullMath.sol';\nimport './libraries/TickMath.sol';\nimport '../interfaces/IKeep3r.sol';\nimport '../interfaces/IKeep3rHelper.sol';\nimport './Keep3rHelperParameters.sol';\n\nimport '@openzeppelin/contracts/utils/math/Math.sol';\nimport '@uniswap/v3-core/contracts/interfaces/IUniswapV3Pool.sol';\n\ncontract Keep3rHelper is IKeep3rHelper, Keep3rHelperParameters {\n constructor(\n address _kp3r,\n address _keep3rV2,\n address _governance,\n address _kp3rWethPool\n ) Keep3rHelperParameters(_kp3r, _keep3rV2, _governance, _kp3rWethPool) {}\n\n /// @inheritdoc IKeep3rHelper\n function quote(uint256 _eth) public view override returns (uint256 _amountOut) {\n uint32[] memory _secondsAgos = new uint32[](2);\n _secondsAgos[1] = quoteTwapTime;\n\n (int56[] memory _tickCumulatives, ) = IUniswapV3Pool(kp3rWethPool.poolAddress).observe(_secondsAgos);\n int56 _difference = _tickCumulatives[0] - _tickCumulatives[1];\n _amountOut = getQuoteAtTick(uint128(_eth), kp3rWethPool.isTKNToken0 ? _difference : -_difference, quoteTwapTime);\n }\n\n /// @inheritdoc IKeep3rHelper\n function bonds(address _keeper) public view virtual override returns (uint256 _amountBonded) {\n return IKeep3r(keep3rV2).bonds(_keeper, KP3R);\n }\n\n /// @inheritdoc IKeep3rHelper\n function getRewardAmountFor(address _keeper, uint256 _gasUsed) public view override returns (uint256 _kp3r) {\n uint256 _boost = getRewardBoostFor(bonds(_keeper));\n _kp3r = quote((_gasUsed * _boost) / BOOST_BASE);\n }\n\n /// @inheritdoc IKeep3rHelper\n function getRewardAmount(uint256 _gasUsed) external view override returns (uint256 _amount) {\n // solhint-disable-next-line avoid-tx-origin\n return getRewardAmountFor(tx.origin, _gasUsed);\n }\n\n /// @inheritdoc IKeep3rHelper\n function getRewardBoostFor(uint256 _bonds) public view override returns (uint256 _rewardBoost) {\n _bonds = Math.min(_bonds, targetBond);\n uint256 _cap = minBoost + ((maxBoost - minBoost) * _bonds) / targetBond;\n _rewardBoost = _cap * _getBasefee();\n }\n\n /// @inheritdoc IKeep3rHelper\n function getPoolTokens(address _pool) public view override returns (address _token0, address _token1) {\n return (IUniswapV3Pool(_pool).token0(), IUniswapV3Pool(_pool).token1());\n }\n\n /// @inheritdoc IKeep3rHelper\n function isKP3RToken0(address _pool) external view virtual override returns (bool _isKP3RToken0) {\n address _token0;\n address _token1;\n (_token0, _token1) = getPoolTokens(_pool);\n if (_token0 == KP3R) {\n return true;\n } else if (_token1 != KP3R) {\n revert LiquidityPairInvalid();\n }\n }\n\n /// @inheritdoc IKeep3rHelper\n function observe(address _pool, uint32[] memory _secondsAgo)\n external\n view\n override\n returns (\n int56 _tickCumulative1,\n int56 _tickCumulative2,\n bool _success\n )\n {\n try IUniswapV3Pool(_pool).observe(_secondsAgo) returns (int56[] memory _uniswapResponse, uint160[] memory) {\n _tickCumulative1 = _uniswapResponse[0];\n if (_uniswapResponse.length > 1) {\n _tickCumulative2 = _uniswapResponse[1];\n }\n _success = true;\n } catch (bytes memory) {}\n }\n\n /// @inheritdoc IKeep3rHelper\n function getPaymentParams(uint256 _bonds)\n external\n view\n override\n returns (\n uint256 _boost,\n uint256 _oneEthQuote,\n uint256 _extra\n )\n {\n _oneEthQuote = quote(1 ether);\n _boost = getRewardBoostFor(_bonds);\n _extra = workExtraGas;\n }\n\n /// @inheritdoc IKeep3rHelper\n function getKP3RsAtTick(\n uint256 _liquidityAmount,\n int56 _tickDifference,\n uint256 _timeInterval\n ) external pure override returns (uint256 _kp3rAmount) {\n uint160 sqrtRatioX96 = TickMath.getSqrtRatioAtTick(int24(_tickDifference / int256(_timeInterval)));\n _kp3rAmount = FullMath.mulDiv(1 << 96, _liquidityAmount, sqrtRatioX96);\n }\n\n /// @inheritdoc IKeep3rHelper\n function getQuoteAtTick(\n uint128 _baseAmount,\n int56 _tickDifference,\n uint256 _timeInterval\n ) public pure override returns (uint256 _quoteAmount) {\n uint160 sqrtRatioX96 = TickMath.getSqrtRatioAtTick(int24(_tickDifference / int256(_timeInterval)));\n\n if (sqrtRatioX96 <= type(uint128).max) {\n uint256 ratioX192 = uint256(sqrtRatioX96) * sqrtRatioX96;\n _quoteAmount = FullMath.mulDiv(1 << 192, _baseAmount, ratioX192);\n } else {\n uint256 ratioX128 = FullMath.mulDiv(sqrtRatioX96, sqrtRatioX96, 1 << 64);\n _quoteAmount = FullMath.mulDiv(1 << 128, _baseAmount, ratioX128);\n }\n }\n\n /// @notice Gets the gas basefee cost to calculate keeper rewards\n /// @dev Keepers are required to pay a priority fee to be included, this function recognizes a minimum priority fee\n /// @return _baseFee The block's basefee + a minimum priority fee, or a preset minimum gas fee\n function _getBasefee() internal view virtual returns (uint256 _baseFee) {\n return Math.max(minBaseFee, block.basefee + minPriorityFee);\n }\n}\n" - }, - "solidity/for-test/testnet/Keep3rHelperForTestnet.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../../contracts/Keep3rHelper.sol';\n\ncontract Keep3rHelperForTestnet is Keep3rHelper {\n constructor(\n address _kp3r,\n address _keep3rV2,\n address _governance,\n address _kp3rWethPool\n ) Keep3rHelper(_kp3r, _keep3rV2, _governance, _kp3rWethPool) {}\n\n function _getBasefee() internal view override returns (uint256) {\n return 1;\n }\n\n /// @dev Overrides oracle validation that uses KP3R and WETH addresses\n function _validateOraclePool(address _poolAddress, address) internal view virtual override returns (TokenOraclePool memory _oraclePool) {\n return TokenOraclePool(_poolAddress, true);\n }\n\n /// @dev Overrides token comparison with KP3R address\n function isKP3RToken0(address) public view virtual override returns (bool) {\n return true;\n }\n}\n" - }, - "solidity/for-test/Keep3rHelperForTest.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../contracts/Keep3rHelper.sol';\n\ncontract Keep3rHelperForTest is Keep3rHelper {\n uint256 public basefee;\n\n constructor(\n address _kp3r,\n address _keep3rV2,\n address _governance,\n address _kp3rWethPool\n ) Keep3rHelper(_kp3r, _keep3rV2, _governance, _kp3rWethPool) {}\n\n function _getBasefee() internal view override returns (uint256) {\n return basefee != 0 ? (basefee + minPriorityFee) : super._getBasefee();\n }\n\n function setBaseFee(uint256 _baseFee) external {\n basefee = _baseFee;\n }\n}\n" - }, - "solidity/contracts/sidechain/Keep3rHelperSidechain.sol": { - "content": "// SPDX-License-Identifier: MIT\n\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../Keep3rHelper.sol';\nimport '../../interfaces/sidechain/IKeep3rHelperSidechain.sol';\n\ncontract Keep3rHelperSidechain is IKeep3rHelperSidechain, Keep3rHelper {\n /// @inheritdoc IKeep3rHelperSidechain\n mapping(address => address) public override oracle;\n /// @inheritdoc IKeep3rHelperSidechain\n IKeep3rHelperParameters.TokenOraclePool public override wethUSDPool;\n\n /// @notice Ethereum mainnet WETH address used for quoting references\n address public immutable override WETH;\n\n /// @param _keep3rV2 Address of sidechain Keep3r implementation\n /// @param _governance Address of governance\n /// @param _kp3rWethOracle Address of oracle used for KP3R/WETH quote\n /// @param _wethUsdOracle Address of oracle used for WETH/USD quote\n /// @dev Oracle pools should use 18 decimals tokens\n constructor(\n address _keep3rV2,\n address _governance,\n address _kp3r,\n address _weth,\n address _kp3rWethOracle,\n address _wethUsdOracle\n ) Keep3rHelper(_kp3r, _keep3rV2, _governance, _kp3rWethOracle) {\n WETH = _weth;\n wethUSDPool = _validateOraclePool(_wethUsdOracle, _weth);\n _setQuoteTwapTime(1 days);\n }\n\n /// @inheritdoc IKeep3rHelper\n /// @notice Uses valid wKP3R address from Keep3rSidechain to query keeper bonds\n function bonds(address _keeper) public view override(Keep3rHelper, IKeep3rHelper) returns (uint256 _amountBonded) {\n address wKP3R = IKeep3r(keep3rV2).keep3rV1();\n return IKeep3r(keep3rV2).bonds(_keeper, wKP3R);\n }\n\n /// @inheritdoc IKeep3rHelperSidechain\n function setOracle(address _liquidity, address _oracle) external override onlyGovernance {\n if (_liquidity == address(0) || _oracle == address(0)) revert ZeroAddress();\n oracle[_liquidity] = _oracle;\n emit OracleSet(_liquidity, _oracle);\n }\n\n /// @inheritdoc IKeep3rHelperSidechain\n function quoteUsdToEth(uint256 _usd) public view virtual override returns (uint256 _amountOut) {\n uint32[] memory _secondsAgos = new uint32[](2);\n _secondsAgos[1] = quoteTwapTime;\n\n /// @dev Oracle is compatible with IUniswapV3Pool\n (int56[] memory _tickCumulatives, ) = IUniswapV3Pool(wethUSDPool.poolAddress).observe(_secondsAgos);\n int56 _difference = _tickCumulatives[0] - _tickCumulatives[1];\n _amountOut = getQuoteAtTick(uint128(_usd), wethUSDPool.isTKNToken0 ? _difference : -_difference, quoteTwapTime);\n }\n\n /// @inheritdoc IKeep3rHelperSidechain\n function setWethUsdPool(address _poolAddress) external override onlyGovernance {\n if (_poolAddress == address(0)) revert ZeroAddress();\n _setWethUsdPool(_poolAddress);\n }\n\n function _setWethUsdPool(address _poolAddress) internal {\n wethUSDPool = _validateOraclePool(_poolAddress, WETH);\n emit WethUSDPoolChange(wethUSDPool.poolAddress, wethUSDPool.isTKNToken0);\n }\n\n /// @dev Sidechain jobs are quoted by USD/gasUnit, baseFee is set to 1\n function _getBasefee() internal view virtual override returns (uint256 _baseFee) {\n return 1;\n }\n}\n" - }, - "solidity/for-test/testnet/Keep3rHelperSidechainForTestnet.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../../contracts/sidechain/Keep3rHelperSidechain.sol';\n\ncontract Keep3rHelperSidechainForTestnet is Keep3rHelperSidechain {\n constructor(\n address _keep3rV2,\n address _governance,\n address _kp3r,\n address _weth,\n address _kp3rWethOracle,\n address _wethUsdOracle\n ) Keep3rHelperSidechain(_keep3rV2, _governance, _kp3r, _weth, _kp3rWethOracle, _wethUsdOracle) {}\n\n /// @dev Overrides oracle validation that uses KP3R and WETH addresses\n function _validateOraclePool(address _poolAddress, address) internal view virtual override returns (TokenOraclePool memory _oraclePool) {\n return TokenOraclePool(_poolAddress, true);\n }\n\n /// @dev Overrides token comparison with KP3R address\n function isKP3RToken0(address) public view virtual override returns (bool) {\n return true;\n }\n\n function quoteUsdToEth(uint256 _usd) public view virtual override returns (uint256) {\n return _usd / 1000;\n }\n}\n" - }, - "solidity/for-test/peripherals/Keep3rParametersForTest.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../../contracts/peripherals/Keep3rParameters.sol';\n\ncontract Keep3rParametersForTest is Keep3rParameters {\n constructor(\n address _keep3rHelper,\n address _keep3rV1,\n address _keep3rV1Proxy\n ) Keep3rParameters(_keep3rHelper, _keep3rV1, _keep3rV1Proxy) Keep3rRoles(msg.sender) {}\n\n function viewLiquidityPool(address _pool) public view returns (address) {\n return _liquidityPool[_pool];\n }\n\n function viewIsKP3RToken0(address _pool) public view returns (bool) {\n return _isKP3RToken0[_pool];\n }\n}\n" - }, - "solidity/for-test/peripherals/jobs/Keep3rJobWorkableForTest.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../../../contracts/peripherals/jobs/Keep3rJobWorkable.sol';\n\ncontract Keep3rJobWorkableForTest is Keep3rJobWorkable {\n using EnumerableSet for EnumerableSet.AddressSet;\n\n constructor(\n address _keep3rHelper,\n address _keep3rV1,\n address _keep3rV1Proxy\n ) Keep3rParameters(_keep3rHelper, _keep3rV1, _keep3rV1Proxy) Keep3rRoles(msg.sender) {}\n\n function setJob(address _job) external {\n _jobs.add(_job);\n }\n\n function setKeeper(address _keeper) external {\n _keepers.add(_keeper);\n }\n\n function setApprovedLiquidity(address _liquidity) external {\n _approvedLiquidities.add(_liquidity);\n }\n\n function setJobLiquidity(address _job, address _liquidity) external {\n _jobLiquidities[_job].add(_liquidity);\n }\n\n function viewJobLiquidityCredits(address _job) external view returns (uint256) {\n return _jobLiquidityCredits[_job];\n }\n\n function viewJobPeriodCredits(address _job) external view returns (uint256) {\n return _jobPeriodCredits[_job];\n }\n\n function viewTickCache(address _liquidity) external view returns (TickCache memory _tickCache) {\n _tickCache = _tick[_liquidity];\n }\n\n function viewGas() external view returns (uint256) {\n return _initialGas;\n }\n\n receive() external payable {}\n}\n" - }, - "solidity/for-test/peripherals/jobs/Keep3rJobMigrationForTest.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../../../contracts/peripherals/jobs/Keep3rJobMigration.sol';\n\ncontract Keep3rJobMigrationForTest is Keep3rJobMigration {\n using EnumerableSet for EnumerableSet.AddressSet;\n\n mapping(address => uint256) public settleJobAccountanceCallCount;\n\n constructor(\n address _kph,\n address _keep3rV1,\n address _keep3rV1Proxy\n ) Keep3rParameters(_kph, _keep3rV1, _keep3rV1Proxy) Keep3rRoles(msg.sender) {}\n\n function setJobToken(address _job, address _token) external {\n _jobTokens[_job].add(_token);\n }\n\n function setJobLiquidity(address _job, address _liquidity) external {\n _jobLiquidities[_job].add(_liquidity);\n }\n\n function viewJobTokenListLength(address _job) external view returns (uint256) {\n return _jobTokens[_job].length();\n }\n\n function viewJobLiquidityList(address _job) external view returns (address[] memory _list) {\n _list = _jobLiquidities[_job].values();\n }\n\n function viewJobPeriodCredits(address _job) external view returns (uint256) {\n return _jobPeriodCredits[_job];\n }\n\n function viewJobLiquidityCredits(address _job) external view returns (uint256) {\n return _jobLiquidityCredits[_job];\n }\n\n function viewMigrationCreatedAt(address _fromJob, address _toJob) external view returns (uint256) {\n return _migrationCreatedAt[_fromJob][_toJob];\n }\n\n function isJob(address _job) external view returns (bool) {\n return _jobs.contains(_job);\n }\n\n function _settleJobAccountance(address _job) internal override {\n settleJobAccountanceCallCount[_job]++;\n }\n}\n" - }, - "solidity/for-test/peripherals/jobs/Keep3rJobManagerForTest.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../../../contracts/peripherals/jobs/Keep3rJobManager.sol';\n\ncontract Keep3rJobManagerForTest is Keep3rJobManager {\n using EnumerableSet for EnumerableSet.AddressSet;\n\n constructor(\n address _keep3rHelper,\n address _keep3rV1,\n address _keep3rV1Proxy\n ) Keep3rRoles(msg.sender) {}\n\n function isJob(address _job) external view returns (bool _isJob) {\n _isJob = _jobs.contains(_job);\n }\n}\n" - }, - "solidity/for-test/peripherals/jobs/Keep3rJobOwnershipForTest.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../../../contracts/peripherals/jobs/Keep3rJobOwnership.sol';\n\ncontract Keep3rJobOwnershipForTest is Keep3rJobOwnership {}\n" - }, - "solidity/for-test/libraries/LiquidityAmountsForTest.sol": { - "content": "// SPDX-License-Identifier: GPL-2.0-or-later\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../../contracts/libraries/FullMath.sol';\nimport '../../contracts/libraries/FixedPoint96.sol';\n\n/// @dev Made this library into a contract to be able to calculate liquidity more precisely for tests\n\n// solhint-disable\ncontract LiquidityAmountsForTest {\n function toUint128(uint256 x) private pure returns (uint128 y) {\n require((y = uint128(x)) == x);\n }\n\n function getLiquidityForAmount0(\n uint160 sqrtRatioAX96,\n uint160 sqrtRatioBX96,\n uint256 amount0\n ) public pure returns (uint128 liquidity) {\n if (sqrtRatioAX96 > sqrtRatioBX96) (sqrtRatioAX96, sqrtRatioBX96) = (sqrtRatioBX96, sqrtRatioAX96);\n uint256 intermediate = FullMath.mulDiv(sqrtRatioAX96, sqrtRatioBX96, FixedPoint96.Q96);\n return toUint128(FullMath.mulDiv(amount0, intermediate, sqrtRatioBX96 - sqrtRatioAX96));\n }\n\n function getLiquidityForAmount1(\n uint160 sqrtRatioAX96,\n uint160 sqrtRatioBX96,\n uint256 amount1\n ) public pure returns (uint128 liquidity) {\n if (sqrtRatioAX96 > sqrtRatioBX96) (sqrtRatioAX96, sqrtRatioBX96) = (sqrtRatioBX96, sqrtRatioAX96);\n return toUint128(FullMath.mulDiv(amount1, FixedPoint96.Q96, sqrtRatioBX96 - sqrtRatioAX96));\n }\n\n function getLiquidityForAmounts(\n uint160 sqrtRatioX96,\n uint160 sqrtRatioAX96,\n uint160 sqrtRatioBX96,\n uint256 amount0,\n uint256 amount1\n ) external pure returns (uint128 liquidity) {\n if (sqrtRatioAX96 > sqrtRatioBX96) (sqrtRatioAX96, sqrtRatioBX96) = (sqrtRatioBX96, sqrtRatioAX96);\n\n if (sqrtRatioX96 <= sqrtRatioAX96) {\n liquidity = getLiquidityForAmount0(sqrtRatioAX96, sqrtRatioBX96, amount0);\n } else if (sqrtRatioX96 < sqrtRatioBX96) {\n uint128 liquidity0 = getLiquidityForAmount0(sqrtRatioX96, sqrtRatioBX96, amount0);\n uint128 liquidity1 = getLiquidityForAmount1(sqrtRatioAX96, sqrtRatioX96, amount1);\n\n liquidity = liquidity0 < liquidity1 ? liquidity0 : liquidity1;\n } else {\n liquidity = getLiquidityForAmount1(sqrtRatioAX96, sqrtRatioBX96, amount1);\n }\n }\n\n function getAmount0ForLiquidity(\n uint160 sqrtRatioAX96,\n uint160 sqrtRatioBX96,\n uint128 liquidity\n ) public pure returns (uint256 amount0) {\n if (sqrtRatioAX96 > sqrtRatioBX96) (sqrtRatioAX96, sqrtRatioBX96) = (sqrtRatioBX96, sqrtRatioAX96);\n\n return FullMath.mulDiv(uint256(liquidity) << FixedPoint96.RESOLUTION, sqrtRatioBX96 - sqrtRatioAX96, sqrtRatioBX96) / sqrtRatioAX96;\n }\n\n function getAmount1ForLiquidity(\n uint160 sqrtRatioAX96,\n uint160 sqrtRatioBX96,\n uint128 liquidity\n ) public pure returns (uint256 amount1) {\n if (sqrtRatioAX96 > sqrtRatioBX96) (sqrtRatioAX96, sqrtRatioBX96) = (sqrtRatioBX96, sqrtRatioAX96);\n\n return FullMath.mulDiv(liquidity, sqrtRatioBX96 - sqrtRatioAX96, FixedPoint96.Q96);\n }\n\n function getAmountsForLiquidity(\n uint160 sqrtRatioX96,\n uint160 sqrtRatioAX96,\n uint160 sqrtRatioBX96,\n uint128 liquidity\n ) external pure returns (uint256 amount0, uint256 amount1) {\n if (sqrtRatioAX96 > sqrtRatioBX96) (sqrtRatioAX96, sqrtRatioBX96) = (sqrtRatioBX96, sqrtRatioAX96);\n\n if (sqrtRatioX96 <= sqrtRatioAX96) {\n amount0 = getAmount0ForLiquidity(sqrtRatioAX96, sqrtRatioBX96, liquidity);\n } else if (sqrtRatioX96 < sqrtRatioBX96) {\n amount0 = getAmount0ForLiquidity(sqrtRatioX96, sqrtRatioBX96, liquidity);\n amount1 = getAmount1ForLiquidity(sqrtRatioAX96, sqrtRatioX96, liquidity);\n } else {\n amount1 = getAmount1ForLiquidity(sqrtRatioAX96, sqrtRatioBX96, liquidity);\n }\n }\n}\n" - }, - "solidity/for-test/IUniswapV3PoolForTest.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '@uniswap/v3-core/contracts/interfaces/IERC20Minimal.sol';\nimport '@uniswap/v3-core/contracts/interfaces/IUniswapV3Pool.sol';\n\n// solhint-disable-next-line no-empty-blocks\ninterface IUniswapV3PoolForTest is IERC20Minimal, IUniswapV3Pool {\n\n}\n" - }, - "@uniswap/v3-core/contracts/interfaces/IERC20Minimal.sol": { - "content": "// SPDX-License-Identifier: GPL-2.0-or-later\npragma solidity >=0.5.0;\n\n/// @title Minimal ERC20 interface for Uniswap\n/// @notice Contains a subset of the full ERC20 interface that is used in Uniswap V3\ninterface IERC20Minimal {\n /// @notice Returns the balance of a token\n /// @param account The account for which to look up the number of tokens it has, i.e. its balance\n /// @return The number of tokens held by the account\n function balanceOf(address account) external view returns (uint256);\n\n /// @notice Transfers the amount of token from the `msg.sender` to the recipient\n /// @param recipient The account that will receive the amount transferred\n /// @param amount The number of tokens to send from the sender to the recipient\n /// @return Returns true for a successful transfer, false for an unsuccessful transfer\n function transfer(address recipient, uint256 amount) external returns (bool);\n\n /// @notice Returns the current allowance given to a spender by an owner\n /// @param owner The account of the token owner\n /// @param spender The account of the token spender\n /// @return The current allowance granted by `owner` to `spender`\n function allowance(address owner, address spender) external view returns (uint256);\n\n /// @notice Sets the allowance of a spender from the `msg.sender` to the value `amount`\n /// @param spender The account which will be allowed to spend a given amount of the owners tokens\n /// @param amount The amount of tokens allowed to be used by `spender`\n /// @return Returns true for a successful approval, false for unsuccessful\n function approve(address spender, uint256 amount) external returns (bool);\n\n /// @notice Transfers `amount` tokens from `sender` to `recipient` up to the allowance given to the `msg.sender`\n /// @param sender The account from which the transfer will be initiated\n /// @param recipient The recipient of the transfer\n /// @param amount The amount of the transfer\n /// @return Returns true for a successful transfer, false for unsuccessful\n function transferFrom(\n address sender,\n address recipient,\n uint256 amount\n ) external returns (bool);\n\n /// @notice Event emitted when tokens are transferred from one address to another, either via `#transfer` or `#transferFrom`.\n /// @param from The account from which the tokens were sent, i.e. the balance decreased\n /// @param to The account to which the tokens were sent, i.e. the balance increased\n /// @param value The amount of tokens that were transferred\n event Transfer(address indexed from, address indexed to, uint256 value);\n\n /// @notice Event emitted when the approval amount for the spender of a given owner's tokens changes.\n /// @param owner The account that approved spending of its tokens\n /// @param spender The account for which the spending allowance was modified\n /// @param value The new allowance from the owner to the spender\n event Approval(address indexed owner, address indexed spender, uint256 value);\n}\n" - } - }, - "settings": { - "optimizer": { - "enabled": true, - "runs": 33 - }, - "outputSelection": { - "*": { - "*": [ - "storageLayout", - "abi", - "evm.bytecode", - "evm.deployedBytecode", - "evm.methodIdentifiers", - "metadata", - "devdoc", - "userdoc", - "evm.gasEstimates" - ], - "": [ - "ast" - ] - } - }, - "metadata": { - "useLiteralContent": true - }, - "libraries": { - "": { - "__CACHE_BREAKER__": "0x00000000d41867734bbee4c6863d9255b2b06ac1" - } - } - } -} \ No newline at end of file diff --git a/deployments/optimisticGoerli/solcInputs/8c968687fa7312972c014a5aac38beba.json b/deployments/optimisticGoerli/solcInputs/8c968687fa7312972c014a5aac38beba.json deleted file mode 100644 index a83b63d..0000000 --- a/deployments/optimisticGoerli/solcInputs/8c968687fa7312972c014a5aac38beba.json +++ /dev/null @@ -1,334 +0,0 @@ -{ - "language": "Solidity", - "sources": { - "solidity/contracts/Keep3r.sol": { - "content": "// SPDX-License-Identifier: MIT\n\n/*\n\nCoded for The Keep3r Network with ♥ by\n\n██████╗░███████╗███████╗██╗░░░██╗░░░░░░░██╗░█████╗░███╗░░██╗██████╗░███████╗██████╗░██╗░░░░░░█████╗░███╗░░██╗██████╗░\n██╔══██╗██╔════╝██╔════╝██║░░░██║░░██╗░░██║██╔══██╗████╗░██║██╔══██╗██╔════╝██╔══██╗██║░░░░░██╔══██╗████╗░██║██╔══██╗\n██║░░██║█████╗░░█████╗░░██║░░░╚██╗████╗██╔╝██║░░██║██╔██╗██║██║░░██║█████╗░░██████╔╝██║░░░░░███████║██╔██╗██║██║░░██║\n██║░░██║██╔══╝░░██╔══╝░░██║░░░░████╔═████║░██║░░██║██║╚████║██║░░██║██╔══╝░░██╔══██╗██║░░░░░██╔══██║██║╚████║██║░░██║\n██████╔╝███████╗██║░░░░░██║░░░░╚██╔╝░╚██╔╝░╚█████╔╝██║░╚███║██████╔╝███████╗██║░░██║███████╗██║░░██║██║░╚███║██████╔╝\n╚═════╝░╚══════╝╚═╝░░░░░╚═╝░░░░░╚═╝░░░╚═╝░░░╚════╝░╚═╝░░╚══╝╚═════╝░╚══════╝╚═╝░░╚═╝╚══════╝╚═╝░░╚═╝╚═╝░░╚══╝╚═════╝░\n\nhttps://defi.sucks\n\n*/\n\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../interfaces/IKeep3r.sol';\nimport './peripherals/jobs/Keep3rJobs.sol';\nimport './peripherals/keepers/Keep3rKeepers.sol';\nimport './peripherals/DustCollector.sol';\n\ncontract Keep3r is IKeep3r, Keep3rJobs, Keep3rKeepers {\n constructor(\n address _governance,\n address _keep3rHelper,\n address _keep3rV1,\n address _keep3rV1Proxy\n ) Keep3rParameters(_keep3rHelper, _keep3rV1, _keep3rV1Proxy) Keep3rRoles(_governance) {}\n}\n" - }, - "solidity/interfaces/IKeep3r.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport './peripherals/IKeep3rJobs.sol';\nimport './peripherals/IKeep3rKeepers.sol';\nimport './peripherals/IKeep3rParameters.sol';\n\n// solhint-disable-next-line no-empty-blocks\n\n/// @title Keep3rV2 contract\n/// @notice This contract inherits all the functionality of Keep3rV2\ninterface IKeep3r is IKeep3rJobs, IKeep3rKeepers, IKeep3rParameters {\n\n}\n" - }, - "solidity/contracts/peripherals/jobs/Keep3rJobs.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../../../interfaces/peripherals/IKeep3rJobs.sol';\nimport './Keep3rJobManager.sol';\nimport './Keep3rJobWorkable.sol';\nimport './Keep3rJobDisputable.sol';\n\nabstract contract Keep3rJobs is IKeep3rJobs, Keep3rJobManager, Keep3rJobWorkable, Keep3rJobDisputable {}\n" - }, - "solidity/contracts/peripherals/keepers/Keep3rKeepers.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../../../interfaces/peripherals/IKeep3rKeepers.sol';\nimport './Keep3rKeeperDisputable.sol';\n\nabstract contract Keep3rKeepers is IKeep3rKeepers, Keep3rKeeperDisputable {}\n" - }, - "solidity/contracts/peripherals/DustCollector.sol": { - "content": "// SPDX-License-Identifier: MIT\n\npragma solidity >=0.8.4 <0.9.0;\n\nimport '@openzeppelin/contracts/token/ERC20/IERC20.sol';\nimport '@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol';\nimport '../../contracts/peripherals/Governable.sol';\nimport '../../interfaces/peripherals/IDustCollector.sol';\n\nabstract contract DustCollector is IDustCollector, Governable {\n using SafeERC20 for IERC20;\n\n address internal constant _ETH_ADDRESS = 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE;\n\n function sendDust(\n address _token,\n uint256 _amount,\n address _to\n ) external override onlyGovernance {\n if (_to == address(0)) revert ZeroAddress();\n if (_token == _ETH_ADDRESS) {\n payable(_to).transfer(_amount);\n } else {\n IERC20(_token).safeTransfer(_to, _amount);\n }\n emit DustSent(_token, _amount, _to);\n }\n}\n" - }, - "solidity/interfaces/peripherals/IKeep3rJobs.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport './IKeep3rDisputable.sol';\n\n/// @title Keep3rJobOwnership contract\n/// @notice Handles the ownership of the jobs\ninterface IKeep3rJobOwnership {\n // Events\n\n /// @notice Emitted when Keep3rJobOwnership#changeJobOwnership is called\n /// @param _job The address of the job proposed to have a change of owner\n /// @param _owner The current owner of the job\n /// @param _pendingOwner The new address proposed to be the owner of the job\n event JobOwnershipChange(address indexed _job, address indexed _owner, address indexed _pendingOwner);\n\n /// @notice Emitted when Keep3rJobOwnership#JobOwnershipAssent is called\n /// @param _job The address of the job which the proposed owner will now own\n /// @param _previousOwner The previous owner of the job\n /// @param _newOwner The new owner of the job\n event JobOwnershipAssent(address indexed _job, address indexed _previousOwner, address indexed _newOwner);\n\n // Errors\n\n /// @notice Throws when the caller of the function is not the job owner\n error OnlyJobOwner();\n\n /// @notice Throws when the caller of the function is not the pending job owner\n error OnlyPendingJobOwner();\n\n // Variables\n\n /// @notice Maps the job to the owner of the job\n /// @param _job The address of the job\n /// @return _owner The address of the owner of the job\n function jobOwner(address _job) external view returns (address _owner);\n\n /// @notice Maps the job to its pending owner\n /// @param _job The address of the job\n /// @return _pendingOwner The address of the pending owner of the job\n function jobPendingOwner(address _job) external view returns (address _pendingOwner);\n\n // Methods\n\n /// @notice Proposes a new address to be the owner of the job\n /// @param _job The address of the job\n /// @param _newOwner The address of the proposed new owner\n function changeJobOwnership(address _job, address _newOwner) external;\n\n /// @notice The proposed address accepts to be the owner of the job\n /// @param _job The address of the job\n function acceptJobOwnership(address _job) external;\n}\n\n/// @title Keep3rJobManager contract\n/// @notice Handles the addition and withdrawal of credits from a job\ninterface IKeep3rJobManager is IKeep3rJobOwnership {\n // Events\n\n /// @notice Emitted when Keep3rJobManager#addJob is called\n /// @param _job The address of the job to add\n /// @param _jobOwner The job's owner\n event JobAddition(address indexed _job, address indexed _jobOwner);\n\n // Errors\n\n /// @notice Throws when trying to add a job that has already been added\n error JobAlreadyAdded();\n\n /// @notice Throws when the address that is trying to register as a keeper is already a keeper\n error AlreadyAKeeper();\n\n // Methods\n\n /// @notice Allows any caller to add a new job\n /// @param _job Address of the contract for which work should be performed\n function addJob(address _job) external;\n}\n\n/// @title Keep3rJobFundableCredits contract\n/// @notice Handles the addition and withdrawal of credits from a job\ninterface IKeep3rJobFundableCredits is IKeep3rJobOwnership {\n // Events\n\n /// @notice Emitted when Keep3rJobFundableCredits#addTokenCreditsToJob is called\n /// @param _job The address of the job being credited\n /// @param _token The address of the token being provided\n /// @param _provider The user that calls the function\n /// @param _amount The amount of credit being added to the job\n event TokenCreditAddition(address indexed _job, address indexed _token, address indexed _provider, uint256 _amount);\n\n /// @notice Emitted when Keep3rJobFundableCredits#withdrawTokenCreditsFromJob is called\n /// @param _job The address of the job from which the credits are withdrawn\n /// @param _token The credit being withdrawn from the job\n /// @param _receiver The user that receives the tokens\n /// @param _amount The amount of credit withdrawn\n event TokenCreditWithdrawal(address indexed _job, address indexed _token, address indexed _receiver, uint256 _amount);\n\n // Errors\n\n /// @notice Throws when the token is KP3R, as it should not be used for direct token payments\n error TokenUnallowed();\n\n /// @notice Throws when the token withdraw cooldown has not yet passed\n error JobTokenCreditsLocked();\n\n /// @notice Throws when the user tries to withdraw more tokens than it has\n error InsufficientJobTokenCredits();\n\n // Variables\n\n /// @notice Last block where tokens were added to the job\n /// @param _job The address of the job credited\n /// @param _token The address of the token credited\n /// @return _timestamp The last block where tokens were added to the job\n function jobTokenCreditsAddedAt(address _job, address _token) external view returns (uint256 _timestamp);\n\n // Methods\n\n /// @notice Add credit to a job to be paid out for work\n /// @param _job The address of the job being credited\n /// @param _token The address of the token being credited\n /// @param _amount The amount of credit being added\n function addTokenCreditsToJob(\n address _job,\n address _token,\n uint256 _amount\n ) external;\n\n /// @notice Withdraw credit from a job\n /// @param _job The address of the job from which the credits are withdrawn\n /// @param _token The address of the token being withdrawn\n /// @param _amount The amount of token to be withdrawn\n /// @param _receiver The user that will receive tokens\n function withdrawTokenCreditsFromJob(\n address _job,\n address _token,\n uint256 _amount,\n address _receiver\n ) external;\n}\n\n/// @title Keep3rJobFundableLiquidity contract\n/// @notice Handles the funding of jobs through specific liquidity pairs\ninterface IKeep3rJobFundableLiquidity is IKeep3rJobOwnership {\n // Events\n\n /// @notice Emitted when Keep3rJobFundableLiquidity#approveLiquidity function is called\n /// @param _liquidity The address of the liquidity pair being approved\n event LiquidityApproval(address _liquidity);\n\n /// @notice Emitted when Keep3rJobFundableLiquidity#revokeLiquidity function is called\n /// @param _liquidity The address of the liquidity pair being revoked\n event LiquidityRevocation(address _liquidity);\n\n /// @notice Emitted when IKeep3rJobFundableLiquidity#addLiquidityToJob function is called\n /// @param _job The address of the job to which liquidity will be added\n /// @param _liquidity The address of the liquidity being added\n /// @param _provider The user that calls the function\n /// @param _amount The amount of liquidity being added\n event LiquidityAddition(address indexed _job, address indexed _liquidity, address indexed _provider, uint256 _amount);\n\n /// @notice Emitted when IKeep3rJobFundableLiquidity#withdrawLiquidityFromJob function is called\n /// @param _job The address of the job of which liquidity will be withdrawn from\n /// @param _liquidity The address of the liquidity being withdrawn\n /// @param _receiver The receiver of the liquidity tokens\n /// @param _amount The amount of liquidity being withdrawn from the job\n event LiquidityWithdrawal(address indexed _job, address indexed _liquidity, address indexed _receiver, uint256 _amount);\n\n /// @notice Emitted when Keep3rJobFundableLiquidity#addLiquidityToJob function is called\n /// @param _job The address of the job whose credits will be updated\n /// @param _rewardedAt The time at which the job was last rewarded\n /// @param _currentCredits The current credits of the job\n /// @param _periodCredits The credits of the job for the current period\n event LiquidityCreditsReward(address indexed _job, uint256 _rewardedAt, uint256 _currentCredits, uint256 _periodCredits);\n\n /// @notice Emitted when Keep3rJobFundableLiquidity#forceLiquidityCreditsToJob function is called\n /// @param _job The address of the job whose credits will be updated\n /// @param _rewardedAt The time at which the job was last rewarded\n /// @param _currentCredits The current credits of the job\n event LiquidityCreditsForced(address indexed _job, uint256 _rewardedAt, uint256 _currentCredits);\n\n // Errors\n\n /// @notice Throws when the liquidity being approved has already been approved\n error LiquidityPairApproved();\n\n /// @notice Throws when the liquidity being removed has not been approved\n error LiquidityPairUnexistent();\n\n /// @notice Throws when trying to add liquidity to an unapproved pool\n error LiquidityPairUnapproved();\n\n /// @notice Throws when the job doesn't have the requested liquidity\n error JobLiquidityUnexistent();\n\n /// @notice Throws when trying to remove more liquidity than the job has\n error JobLiquidityInsufficient();\n\n /// @notice Throws when trying to add less liquidity than the minimum liquidity required\n error JobLiquidityLessThanMin();\n\n // Structs\n\n /// @notice Stores the tick information of the different liquidity pairs\n struct TickCache {\n int56 current; // Tracks the current tick\n int56 difference; // Stores the difference between the current tick and the last tick\n uint256 period; // Stores the period at which the last observation was made\n }\n\n // Variables\n\n /// @notice Lists liquidity pairs\n /// @return _list An array of addresses with all the approved liquidity pairs\n function approvedLiquidities() external view returns (address[] memory _list);\n\n /// @notice Amount of liquidity in a specified job\n /// @param _job The address of the job being checked\n /// @param _liquidity The address of the liquidity we are checking\n /// @return _amount Amount of liquidity in the specified job\n function liquidityAmount(address _job, address _liquidity) external view returns (uint256 _amount);\n\n /// @notice Last time the job was rewarded liquidity credits\n /// @param _job The address of the job being checked\n /// @return _timestamp Timestamp of the last time the job was rewarded liquidity credits\n function rewardedAt(address _job) external view returns (uint256 _timestamp);\n\n /// @notice Last time the job was worked\n /// @param _job The address of the job being checked\n /// @return _timestamp Timestamp of the last time the job was worked\n function workedAt(address _job) external view returns (uint256 _timestamp);\n\n // Methods\n\n /// @notice Returns the liquidity credits of a given job\n /// @param _job The address of the job of which we want to know the liquidity credits\n /// @return _amount The liquidity credits of a given job\n function jobLiquidityCredits(address _job) external view returns (uint256 _amount);\n\n /// @notice Returns the credits of a given job for the current period\n /// @param _job The address of the job of which we want to know the period credits\n /// @return _amount The credits the given job has at the current period\n function jobPeriodCredits(address _job) external view returns (uint256 _amount);\n\n /// @notice Calculates the total credits of a given job\n /// @param _job The address of the job of which we want to know the total credits\n /// @return _amount The total credits of the given job\n function totalJobCredits(address _job) external view returns (uint256 _amount);\n\n /// @notice Calculates how many credits should be rewarded periodically for a given liquidity amount\n /// @dev _periodCredits = underlying KP3Rs for given liquidity amount * rewardPeriod / inflationPeriod\n /// @param _liquidity The address of the liquidity to provide\n /// @param _amount The amount of liquidity to provide\n /// @return _periodCredits The amount of KP3R periodically minted for the given liquidity\n function quoteLiquidity(address _liquidity, uint256 _amount) external view returns (uint256 _periodCredits);\n\n /// @notice Observes the current state of the liquidity pair being observed and updates TickCache with the information\n /// @param _liquidity The address of the liquidity pair being observed\n /// @return _tickCache The updated TickCache\n function observeLiquidity(address _liquidity) external view returns (TickCache memory _tickCache);\n\n /// @notice Gifts liquidity credits to the specified job\n /// @param _job The address of the job being credited\n /// @param _amount The amount of liquidity credits to gift\n function forceLiquidityCreditsToJob(address _job, uint256 _amount) external;\n\n /// @notice Approve a liquidity pair for being accepted in future\n /// @param _liquidity The address of the liquidity accepted\n function approveLiquidity(address _liquidity) external;\n\n /// @notice Revoke a liquidity pair from being accepted in future\n /// @param _liquidity The liquidity no longer accepted\n function revokeLiquidity(address _liquidity) external;\n\n /// @notice Allows anyone to fund a job with liquidity\n /// @param _job The address of the job to assign liquidity to\n /// @param _liquidity The liquidity being added\n /// @param _amount The amount of liquidity tokens to add\n function addLiquidityToJob(\n address _job,\n address _liquidity,\n uint256 _amount\n ) external;\n\n /// @notice Unbond liquidity for a job\n /// @dev Can only be called by the job's owner\n /// @param _job The address of the job being unbonded from\n /// @param _liquidity The liquidity being unbonded\n /// @param _amount The amount of liquidity being removed\n function unbondLiquidityFromJob(\n address _job,\n address _liquidity,\n uint256 _amount\n ) external;\n\n /// @notice Withdraw liquidity from a job\n /// @param _job The address of the job being withdrawn from\n /// @param _liquidity The liquidity being withdrawn\n /// @param _receiver The address that will receive the withdrawn liquidity\n function withdrawLiquidityFromJob(\n address _job,\n address _liquidity,\n address _receiver\n ) external;\n}\n\n/// @title Keep3rJobMigration contract\n/// @notice Handles the migration process of jobs to different addresses\ninterface IKeep3rJobMigration is IKeep3rJobFundableCredits, IKeep3rJobFundableLiquidity {\n // Events\n\n /// @notice Emitted when Keep3rJobMigration#migrateJob function is called\n /// @param _fromJob The address of the job that requests to migrate\n /// @param _toJob The address at which the job requests to migrate\n event JobMigrationRequested(address indexed _fromJob, address _toJob);\n\n /// @notice Emitted when Keep3rJobMigration#acceptJobMigration function is called\n /// @param _fromJob The address of the job that requested to migrate\n /// @param _toJob The address at which the job had requested to migrate\n event JobMigrationSuccessful(address _fromJob, address indexed _toJob);\n\n // Errors\n\n /// @notice Throws when the address of the job that requests to migrate wants to migrate to its same address\n error JobMigrationImpossible();\n\n /// @notice Throws when the _toJob address differs from the address being tracked in the pendingJobMigrations mapping\n error JobMigrationUnavailable();\n\n /// @notice Throws when cooldown between migrations has not yet passed\n error JobMigrationLocked();\n\n // Variables\n\n /// @notice Maps the jobs that have requested a migration to the address they have requested to migrate to\n /// @return _toJob The address to which the job has requested to migrate to\n function pendingJobMigrations(address _fromJob) external view returns (address _toJob);\n\n // Methods\n\n /// @notice Initializes the migration process for a job by adding the request to the pendingJobMigrations mapping\n /// @param _fromJob The address of the job that is requesting to migrate\n /// @param _toJob The address at which the job is requesting to migrate\n function migrateJob(address _fromJob, address _toJob) external;\n\n /// @notice Completes the migration process for a job\n /// @dev Unbond/withdraw process doesn't get migrated\n /// @param _fromJob The address of the job that requested to migrate\n /// @param _toJob The address to which the job wants to migrate to\n function acceptJobMigration(address _fromJob, address _toJob) external;\n}\n\n/// @title Keep3rJobWorkable contract\n/// @notice Handles the mechanisms jobs can pay keepers with along with the restrictions jobs can put on keepers before they can work on jobs\ninterface IKeep3rJobWorkable is IKeep3rJobMigration {\n // Events\n\n /// @notice Emitted when a keeper is validated before a job\n /// @param _gasLeft The amount of gas that the transaction has left at the moment of keeper validation\n event KeeperValidation(uint256 _gasLeft);\n\n /// @notice Emitted when a keeper works a job\n /// @param _credit The address of the asset in which the keeper is paid\n /// @param _job The address of the job the keeper has worked\n /// @param _keeper The address of the keeper that has worked the job\n /// @param _payment The amount that has been paid out to the keeper in exchange for working the job\n /// @param _gasLeft The amount of gas that the transaction has left at the moment of payment\n event KeeperWork(address indexed _credit, address indexed _job, address indexed _keeper, uint256 _payment, uint256 _gasLeft);\n\n // Errors\n\n /// @notice Throws if work method was called without calling isKeeper or isBondedKeeper\n error GasNotInitialized();\n\n /// @notice Throws if the address claiming to be a job is not in the list of approved jobs\n error JobUnapproved();\n\n /// @notice Throws if the amount of funds in the job is less than the payment that must be paid to the keeper that works that job\n error InsufficientFunds();\n\n // Methods\n\n /// @notice Confirms if the current keeper is registered\n /// @dev Can be used for general (non critical) functions\n /// @param _keeper The keeper being investigated\n /// @return _isKeeper Whether the address passed as a parameter is a keeper or not\n function isKeeper(address _keeper) external returns (bool _isKeeper);\n\n /// @notice Confirms if the current keeper is registered and has a minimum bond of any asset.\n /// @dev Should be used for protected functions\n /// @param _keeper The keeper to check\n /// @param _bond The bond token being evaluated\n /// @param _minBond The minimum amount of bonded tokens\n /// @param _earned The minimum funds earned in the keepers lifetime\n /// @param _age The minimum keeper age required\n /// @return _isBondedKeeper Whether the `_keeper` meets the given requirements\n function isBondedKeeper(\n address _keeper,\n address _bond,\n uint256 _minBond,\n uint256 _earned,\n uint256 _age\n ) external returns (bool _isBondedKeeper);\n\n /// @notice Implemented by jobs to show that a keeper performed work\n /// @dev Automatically calculates the payment for the keeper and pays the keeper with bonded KP3R\n /// @param _keeper Address of the keeper that performed the work\n function worked(address _keeper) external;\n\n /// @notice Implemented by jobs to show that a keeper performed work\n /// @dev Pays the keeper that performs the work with KP3R\n /// @param _keeper Address of the keeper that performed the work\n /// @param _payment The reward that should be allocated for the job\n function bondedPayment(address _keeper, uint256 _payment) external;\n\n /// @notice Implemented by jobs to show that a keeper performed work\n /// @dev Pays the keeper that performs the work with a specific token\n /// @param _token The asset being awarded to the keeper\n /// @param _keeper Address of the keeper that performed the work\n /// @param _amount The reward that should be allocated\n function directTokenPayment(\n address _token,\n address _keeper,\n uint256 _amount\n ) external;\n}\n\n/// @title Keep3rJobDisputable contract\n/// @notice Handles the actions that can be taken on a disputed job\ninterface IKeep3rJobDisputable is IKeep3rDisputable, IKeep3rJobFundableCredits, IKeep3rJobFundableLiquidity {\n // Events\n\n /// @notice Emitted when Keep3rJobDisputable#slashTokenFromJob is called\n /// @param _job The address of the job from which the token will be slashed\n /// @param _token The address of the token being slashed\n /// @param _slasher The user that slashes the token\n /// @param _amount The amount of the token being slashed\n event JobSlashToken(address indexed _job, address _token, address indexed _slasher, uint256 _amount);\n\n /// @notice Emitted when Keep3rJobDisputable#slashLiquidityFromJob is called\n /// @param _job The address of the job from which the liquidity will be slashed\n /// @param _liquidity The address of the liquidity being slashed\n /// @param _slasher The user that slashes the liquidity\n /// @param _amount The amount of the liquidity being slashed\n event JobSlashLiquidity(address indexed _job, address _liquidity, address indexed _slasher, uint256 _amount);\n\n // Errors\n\n /// @notice Throws when the token trying to be slashed doesn't exist\n error JobTokenUnexistent();\n\n /// @notice Throws when someone tries to slash more tokens than the job has\n error JobTokenInsufficient();\n\n // Methods\n\n /// @notice Allows governance or slasher to slash a job specific token\n /// @param _job The address of the job from which the token will be slashed\n /// @param _token The address of the token that will be slashed\n /// @param _amount The amount of the token that will be slashed\n function slashTokenFromJob(\n address _job,\n address _token,\n uint256 _amount\n ) external;\n\n /// @notice Allows governance or a slasher to slash liquidity from a job\n /// @param _job The address being slashed\n /// @param _liquidity The address of the liquidity that will be slashed\n /// @param _amount The amount of liquidity that will be slashed\n function slashLiquidityFromJob(\n address _job,\n address _liquidity,\n uint256 _amount\n ) external;\n}\n\n// solhint-disable-next-line no-empty-blocks\ninterface IKeep3rJobs is IKeep3rJobWorkable, IKeep3rJobManager, IKeep3rJobDisputable {\n\n}\n" - }, - "solidity/interfaces/peripherals/IKeep3rKeepers.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport './IKeep3rDisputable.sol';\n\n/// @title Keep3rKeeperFundable contract\n/// @notice Handles the actions required to become a keeper\ninterface IKeep3rKeeperFundable {\n // Events\n\n /// @notice Emitted when Keep3rKeeperFundable#activate is called\n /// @param _keeper The keeper that has been activated\n /// @param _bond The asset the keeper has bonded\n /// @param _amount The amount of the asset the keeper has bonded\n event Activation(address indexed _keeper, address indexed _bond, uint256 _amount);\n\n /// @notice Emitted when Keep3rKeeperFundable#withdraw is called\n /// @param _keeper The caller of Keep3rKeeperFundable#withdraw function\n /// @param _bond The asset to withdraw from the bonding pool\n /// @param _amount The amount of funds withdrawn\n event Withdrawal(address indexed _keeper, address indexed _bond, uint256 _amount);\n\n // Errors\n\n /// @notice Throws when the address that is trying to register as a job is already a job\n error AlreadyAJob();\n\n // Methods\n\n /// @notice Beginning of the bonding process\n /// @param _bonding The asset being bonded\n /// @param _amount The amount of bonding asset being bonded\n function bond(address _bonding, uint256 _amount) external;\n\n /// @notice Beginning of the unbonding process\n /// @param _bonding The asset being unbonded\n /// @param _amount Allows for partial unbonding\n function unbond(address _bonding, uint256 _amount) external;\n\n /// @notice End of the bonding process after bonding time has passed\n /// @param _bonding The asset being activated as bond collateral\n function activate(address _bonding) external;\n\n /// @notice Withdraw funds after unbonding has finished\n /// @param _bonding The asset to withdraw from the bonding pool\n function withdraw(address _bonding) external;\n}\n\n/// @title Keep3rKeeperDisputable contract\n/// @notice Handles the actions that can be taken on a disputed keeper\ninterface IKeep3rKeeperDisputable is IKeep3rDisputable, IKeep3rKeeperFundable {\n // Events\n\n /// @notice Emitted when Keep3rKeeperDisputable#slash is called\n /// @param _keeper The address of the slashed keeper\n /// @param _slasher The user that called Keep3rKeeperDisputable#slash\n /// @param _amount The amount of credits slashed from the keeper\n event KeeperSlash(address indexed _keeper, address indexed _slasher, uint256 _amount);\n\n /// @notice Emitted when Keep3rKeeperDisputable#revoke is called\n /// @param _keeper The address of the revoked keeper\n /// @param _slasher The user that called Keep3rKeeperDisputable#revoke\n event KeeperRevoke(address indexed _keeper, address indexed _slasher);\n\n // Methods\n\n /// @notice Allows governance to slash a keeper based on a dispute\n /// @param _keeper The address being slashed\n /// @param _bonded The asset being slashed\n /// @param _bondAmount The bonded amount being slashed\n /// @param _unbondAmount The pending unbond amount being slashed\n function slash(\n address _keeper,\n address _bonded,\n uint256 _bondAmount,\n uint256 _unbondAmount\n ) external;\n\n /// @notice Blacklists a keeper from participating in the network\n /// @param _keeper The address being slashed\n function revoke(address _keeper) external;\n}\n\n// solhint-disable-next-line no-empty-blocks\n\n/// @title Keep3rKeepers contract\ninterface IKeep3rKeepers is IKeep3rKeeperDisputable {\n\n}\n" - }, - "solidity/interfaces/peripherals/IKeep3rParameters.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport './IKeep3rAccountance.sol';\n\n/// @title Keep3rParameters contract\n/// @notice Handles and sets all the required parameters for Keep3r\ninterface IKeep3rParameters is IKeep3rAccountance {\n // Events\n\n /// @notice Emitted when the Keep3rHelper address is changed\n /// @param _keep3rHelper The address of Keep3rHelper's contract\n event Keep3rHelperChange(address _keep3rHelper);\n\n /// @notice Emitted when the Keep3rV1 address is changed\n /// @param _keep3rV1 The address of Keep3rV1's contract\n event Keep3rV1Change(address _keep3rV1);\n\n /// @notice Emitted when the Keep3rV1Proxy address is changed\n /// @param _keep3rV1Proxy The address of Keep3rV1Proxy's contract\n event Keep3rV1ProxyChange(address _keep3rV1Proxy);\n\n /// @notice Emitted when bondTime is changed\n /// @param _bondTime The new bondTime\n event BondTimeChange(uint256 _bondTime);\n\n /// @notice Emitted when _liquidityMinimum is changed\n /// @param _liquidityMinimum The new _liquidityMinimum\n event LiquidityMinimumChange(uint256 _liquidityMinimum);\n\n /// @notice Emitted when _unbondTime is changed\n /// @param _unbondTime The new _unbondTime\n event UnbondTimeChange(uint256 _unbondTime);\n\n /// @notice Emitted when _rewardPeriodTime is changed\n /// @param _rewardPeriodTime The new _rewardPeriodTime\n event RewardPeriodTimeChange(uint256 _rewardPeriodTime);\n\n /// @notice Emitted when the inflationPeriod is changed\n /// @param _inflationPeriod The new inflationPeriod\n event InflationPeriodChange(uint256 _inflationPeriod);\n\n /// @notice Emitted when the fee is changed\n /// @param _fee The new token credits fee\n event FeeChange(uint256 _fee);\n\n // Variables\n\n /// @notice Address of Keep3rHelper's contract\n /// @return _keep3rHelper The address of Keep3rHelper's contract\n function keep3rHelper() external view returns (address _keep3rHelper);\n\n /// @notice Address of Keep3rV1's contract\n /// @return _keep3rV1 The address of Keep3rV1's contract\n function keep3rV1() external view returns (address _keep3rV1);\n\n /// @notice Address of Keep3rV1Proxy's contract\n /// @return _keep3rV1Proxy The address of Keep3rV1Proxy's contract\n function keep3rV1Proxy() external view returns (address _keep3rV1Proxy);\n\n /// @notice The amount of time required to pass after a keeper has bonded assets for it to be able to activate\n /// @return _days The required bondTime in days\n function bondTime() external view returns (uint256 _days);\n\n /// @notice The amount of time required to pass before a keeper can unbond what he has bonded\n /// @return _days The required unbondTime in days\n function unbondTime() external view returns (uint256 _days);\n\n /// @notice The minimum amount of liquidity required to fund a job per liquidity\n /// @return _amount The minimum amount of liquidity in KP3R\n function liquidityMinimum() external view returns (uint256 _amount);\n\n /// @notice The amount of time between each scheduled credits reward given to a job\n /// @return _days The reward period in days\n function rewardPeriodTime() external view returns (uint256 _days);\n\n /// @notice The inflation period is the denominator used to regulate the emission of KP3R\n /// @return _period The denominator used to regulate the emission of KP3R\n function inflationPeriod() external view returns (uint256 _period);\n\n /// @notice The fee to be sent to governance when a user adds liquidity to a job\n /// @return _amount The fee amount to be sent to governance when a user adds liquidity to a job\n function fee() external view returns (uint256 _amount);\n\n // Errors\n\n /// @notice Throws if the reward period is less than the minimum reward period time\n error MinRewardPeriod();\n\n /// @notice Throws if either a job or a keeper is disputed\n error Disputed();\n\n /// @notice Throws if there are no bonded assets\n error BondsUnexistent();\n\n /// @notice Throws if the time required to bond an asset has not passed yet\n error BondsLocked();\n\n /// @notice Throws if there are no bonds to withdraw\n error UnbondsUnexistent();\n\n /// @notice Throws if the time required to withdraw the bonds has not passed yet\n error UnbondsLocked();\n\n // Methods\n\n /// @notice Sets the Keep3rHelper address\n /// @param _keep3rHelper The Keep3rHelper address\n function setKeep3rHelper(address _keep3rHelper) external;\n\n /// @notice Sets the Keep3rV1 address\n /// @param _keep3rV1 The Keep3rV1 address\n function setKeep3rV1(address _keep3rV1) external;\n\n /// @notice Sets the Keep3rV1Proxy address\n /// @param _keep3rV1Proxy The Keep3rV1Proxy address\n function setKeep3rV1Proxy(address _keep3rV1Proxy) external;\n\n /// @notice Sets the bond time required to activate as a keeper\n /// @param _bond The new bond time\n function setBondTime(uint256 _bond) external;\n\n /// @notice Sets the unbond time required unbond what has been bonded\n /// @param _unbond The new unbond time\n function setUnbondTime(uint256 _unbond) external;\n\n /// @notice Sets the minimum amount of liquidity required to fund a job\n /// @param _liquidityMinimum The new minimum amount of liquidity\n function setLiquidityMinimum(uint256 _liquidityMinimum) external;\n\n /// @notice Sets the time required to pass between rewards for jobs\n /// @param _rewardPeriodTime The new amount of time required to pass between rewards\n function setRewardPeriodTime(uint256 _rewardPeriodTime) external;\n\n /// @notice Sets the new inflation period\n /// @param _inflationPeriod The new inflation period\n function setInflationPeriod(uint256 _inflationPeriod) external;\n\n /// @notice Sets the new fee\n /// @param _fee The new fee\n function setFee(uint256 _fee) external;\n}\n" - }, - "solidity/interfaces/peripherals/IKeep3rDisputable.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\n/// @title Keep3rDisputable contract\n/// @notice Creates/resolves disputes for jobs or keepers\n/// A disputed keeper is slashable and is not able to bond, activate, withdraw or receive direct payments\n/// A disputed job is slashable and is not able to pay the keepers, withdraw tokens or to migrate\ninterface IKeep3rDisputable {\n /// @notice Emitted when a keeper or a job is disputed\n /// @param _jobOrKeeper The address of the disputed keeper/job\n /// @param _disputer The user that called the function and disputed the keeper\n event Dispute(address indexed _jobOrKeeper, address indexed _disputer);\n\n /// @notice Emitted when a dispute is resolved\n /// @param _jobOrKeeper The address of the disputed keeper/job\n /// @param _resolver The user that called the function and resolved the dispute\n event Resolve(address indexed _jobOrKeeper, address indexed _resolver);\n\n /// @notice Throws when a job or keeper is already disputed\n error AlreadyDisputed();\n\n /// @notice Throws when a job or keeper is not disputed and someone tries to resolve the dispute\n error NotDisputed();\n\n /// @notice Allows governance to create a dispute for a given keeper/job\n /// @param _jobOrKeeper The address in dispute\n function dispute(address _jobOrKeeper) external;\n\n /// @notice Allows governance to resolve a dispute on a keeper/job\n /// @param _jobOrKeeper The address cleared\n function resolve(address _jobOrKeeper) external;\n}\n" - }, - "solidity/interfaces/peripherals/IKeep3rAccountance.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport './IKeep3rRoles.sol';\n\n/// @title Keep3rDisputable contract\n/// @notice Disputes keepers, or if they're already disputed, it can resolve the case\n/// @dev Argument `bonding` can be the address of either a token or a liquidity\ninterface IKeep3rAccountance is IKeep3rRoles {\n // Events\n\n /// @notice Emitted when the bonding process of a new keeper begins\n /// @param _keeper The caller of Keep3rKeeperFundable#bond function\n /// @param _bonding The asset the keeper has bonded\n /// @param _amount The amount the keeper has bonded\n event Bonding(address indexed _keeper, address indexed _bonding, uint256 _amount);\n\n /// @notice Emitted when a keeper or job begins the unbonding process to withdraw the funds\n /// @param _keeperOrJob The keeper or job that began the unbonding process\n /// @param _unbonding The liquidity pair or asset being unbonded\n /// @param _amount The amount being unbonded\n event Unbonding(address indexed _keeperOrJob, address indexed _unbonding, uint256 _amount);\n\n // Variables\n\n /// @notice Tracks the total amount of bonded KP3Rs in the contract\n /// @return _totalBonds The total amount of bonded KP3Rs in the contract\n function totalBonds() external view returns (uint256 _totalBonds);\n\n /// @notice Tracks the total KP3R earnings of a keeper since it started working\n /// @param _keeper The address of the keeper\n /// @return _workCompleted Total KP3R earnings of a keeper since it started working\n function workCompleted(address _keeper) external view returns (uint256 _workCompleted);\n\n /// @notice Tracks when a keeper was first registered\n /// @param _keeper The address of the keeper\n /// @return timestamp The time at which the keeper was first registered\n function firstSeen(address _keeper) external view returns (uint256 timestamp);\n\n /// @notice Tracks if a keeper or job has a pending dispute\n /// @param _keeperOrJob The address of the keeper or job\n /// @return _disputed Whether a keeper or job has a pending dispute\n function disputes(address _keeperOrJob) external view returns (bool _disputed);\n\n /// @notice Tracks how much a keeper has bonded of a certain token\n /// @param _keeper The address of the keeper\n /// @param _bond The address of the token being bonded\n /// @return _bonds Amount of a certain token that a keeper has bonded\n function bonds(address _keeper, address _bond) external view returns (uint256 _bonds);\n\n /// @notice The current token credits available for a job\n /// @param _job The address of the job\n /// @param _token The address of the token bonded\n /// @return _amount The amount of token credits available for a job\n function jobTokenCredits(address _job, address _token) external view returns (uint256 _amount);\n\n /// @notice Tracks the amount of assets deposited in pending bonds\n /// @param _keeper The address of the keeper\n /// @param _bonding The address of the token being bonded\n /// @return _pendingBonds Amount of a certain asset a keeper has unbonding\n function pendingBonds(address _keeper, address _bonding) external view returns (uint256 _pendingBonds);\n\n /// @notice Tracks when a bonding for a keeper can be activated\n /// @param _keeper The address of the keeper\n /// @param _bonding The address of the token being bonded\n /// @return _timestamp Time at which the bonding for a keeper can be activated\n function canActivateAfter(address _keeper, address _bonding) external view returns (uint256 _timestamp);\n\n /// @notice Tracks when keeper bonds are ready to be withdrawn\n /// @param _keeper The address of the keeper\n /// @param _bonding The address of the token being unbonded\n /// @return _timestamp Time at which the keeper bonds are ready to be withdrawn\n function canWithdrawAfter(address _keeper, address _bonding) external view returns (uint256 _timestamp);\n\n /// @notice Tracks how much keeper bonds are to be withdrawn\n /// @param _keeper The address of the keeper\n /// @param _bonding The address of the token being unbonded\n /// @return _pendingUnbonds The amount of keeper bonds that are to be withdrawn\n function pendingUnbonds(address _keeper, address _bonding) external view returns (uint256 _pendingUnbonds);\n\n /// @notice Checks whether the address has ever bonded an asset\n /// @param _keeper The address of the keeper\n /// @return _hasBonded Whether the address has ever bonded an asset\n function hasBonded(address _keeper) external view returns (bool _hasBonded);\n\n // Methods\n\n /// @notice Lists all jobs\n /// @return _jobList Array with all the jobs in _jobs\n function jobs() external view returns (address[] memory _jobList);\n\n /// @notice Lists all keepers\n /// @return _keeperList Array with all the keepers in _keepers\n function keepers() external view returns (address[] memory _keeperList);\n\n // Errors\n\n /// @notice Throws when an address is passed as a job, but that address is not a job\n error JobUnavailable();\n\n /// @notice Throws when an action that requires an undisputed job is applied on a disputed job\n error JobDisputed();\n}\n" - }, - "solidity/interfaces/peripherals/IKeep3rRoles.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport './IBaseErrors.sol';\nimport './IGovernable.sol';\nimport './IDustCollector.sol';\n\n/// @title Keep3rRoles contract\n/// @notice Manages the Keep3r specific roles\ninterface IKeep3rRoles is IBaseErrors, IDustCollector, IGovernable {\n // Events\n\n /// @notice Emitted when a slasher is added\n /// @param _slasher Address of the added slasher\n event SlasherAdded(address _slasher);\n\n /// @notice Emitted when a slasher is removed\n /// @param _slasher Address of the removed slasher\n event SlasherRemoved(address _slasher);\n\n /// @notice Emitted when a disputer is added\n /// @param _disputer Address of the added disputer\n event DisputerAdded(address _disputer);\n\n /// @notice Emitted when a disputer is removed\n /// @param _disputer Address of the removed disputer\n event DisputerRemoved(address _disputer);\n\n // Variables\n\n /// @notice Tracks whether the address is a slasher or not\n /// @param _slasher Address being checked as a slasher\n /// @return _isSlasher Whether the address is a slasher or not\n function slashers(address _slasher) external view returns (bool _isSlasher);\n\n /// @notice Tracks whether the address is a disputer or not\n /// @param _disputer Address being checked as a disputer\n /// @return _isDisputer Whether the address is a disputer or not\n function disputers(address _disputer) external view returns (bool _isDisputer);\n\n // Errors\n\n /// @notice Throws if the address is already a registered slasher\n error SlasherExistent();\n\n /// @notice Throws if caller is not a registered slasher\n error SlasherUnexistent();\n\n /// @notice Throws if the address is already a registered disputer\n error DisputerExistent();\n\n /// @notice Throws if caller is not a registered disputer\n error DisputerUnexistent();\n\n /// @notice Throws if the msg.sender is not a slasher or is not a part of governance\n error OnlySlasher();\n\n /// @notice Throws if the msg.sender is not a disputer or is not a part of governance\n error OnlyDisputer();\n\n // Methods\n\n /// @notice Registers a slasher by updating the slashers mapping\n function addSlasher(address _slasher) external;\n\n /// @notice Removes a slasher by updating the slashers mapping\n function removeSlasher(address _slasher) external;\n\n /// @notice Registers a disputer by updating the disputers mapping\n function addDisputer(address _disputer) external;\n\n /// @notice Removes a disputer by updating the disputers mapping\n function removeDisputer(address _disputer) external;\n}\n" - }, - "solidity/interfaces/peripherals/IBaseErrors.sol": { - "content": "// SPDX-License-Identifier: MIT\n\npragma solidity >=0.8.4 <0.9.0;\n\ninterface IBaseErrors {\n /// @notice Throws if a variable is assigned to the zero address\n error ZeroAddress();\n}\n" - }, - "solidity/interfaces/peripherals/IGovernable.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\n/// @title Governable contract\n/// @notice Manages the governance role\ninterface IGovernable {\n // Events\n\n /// @notice Emitted when pendingGovernance accepts to be governance\n /// @param _governance Address of the new governance\n event GovernanceSet(address _governance);\n\n /// @notice Emitted when a new governance is proposed\n /// @param _pendingGovernance Address that is proposed to be the new governance\n event GovernanceProposal(address _pendingGovernance);\n\n // Errors\n\n /// @notice Throws if the caller of the function is not governance\n error OnlyGovernance();\n\n /// @notice Throws if the caller of the function is not pendingGovernance\n error OnlyPendingGovernance();\n\n /// @notice Throws if trying to set governance to zero address\n error NoGovernanceZeroAddress();\n\n // Variables\n\n /// @notice Stores the governance address\n /// @return _governance The governance addresss\n function governance() external view returns (address _governance);\n\n /// @notice Stores the pendingGovernance address\n /// @return _pendingGovernance The pendingGovernance addresss\n function pendingGovernance() external view returns (address _pendingGovernance);\n\n // Methods\n\n /// @notice Proposes a new address to be governance\n /// @param _governance The address being proposed as the new governance\n function setGovernance(address _governance) external;\n\n /// @notice Changes the governance from the current governance to the previously proposed address\n function acceptGovernance() external;\n}\n" - }, - "solidity/interfaces/peripherals/IDustCollector.sol": { - "content": "// SPDX-License-Identifier: MIT\n\npragma solidity >=0.8.4 <0.9.0;\n\nimport './IBaseErrors.sol';\n\ninterface IDustCollector is IBaseErrors {\n /// @notice Emitted when dust is sent\n /// @param _token The token that will be transferred\n /// @param _amount The amount of the token that will be transferred\n /// @param _to The address which will receive the funds\n event DustSent(address _token, uint256 _amount, address _to);\n\n /// @notice Allows an authorized user to transfer the tokens or eth that may have been left in a contract\n /// @param _token The token that will be transferred\n /// @param _amount The amount of the token that will be transferred\n /// @param _to The address that will receive the idle funds\n function sendDust(\n address _token,\n uint256 _amount,\n address _to\n ) external;\n}\n" - }, - "solidity/contracts/peripherals/jobs/Keep3rJobManager.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport './Keep3rJobOwnership.sol';\nimport '../Keep3rAccountance.sol';\nimport '../../../interfaces/peripherals/IKeep3rJobs.sol';\n\nabstract contract Keep3rJobManager is IKeep3rJobManager, Keep3rJobOwnership, Keep3rAccountance {\n using EnumerableSet for EnumerableSet.AddressSet;\n\n /// @inheritdoc IKeep3rJobManager\n function addJob(address _job) external override {\n if (_jobs.contains(_job)) revert JobAlreadyAdded();\n if (hasBonded[_job]) revert AlreadyAKeeper();\n _jobs.add(_job);\n jobOwner[_job] = msg.sender;\n emit JobAddition(_job, msg.sender);\n }\n}\n" - }, - "solidity/contracts/peripherals/jobs/Keep3rJobWorkable.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport './Keep3rJobMigration.sol';\nimport '../../../interfaces/IKeep3rHelper.sol';\nimport '../../../interfaces/peripherals/IKeep3rJobs.sol';\n\nimport '@openzeppelin/contracts/token/ERC20/IERC20.sol';\nimport '@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol';\n\nabstract contract Keep3rJobWorkable is IKeep3rJobWorkable, Keep3rJobMigration {\n using EnumerableSet for EnumerableSet.AddressSet;\n using SafeERC20 for IERC20;\n\n uint256 internal _initialGas;\n\n /// @inheritdoc IKeep3rJobWorkable\n function isKeeper(address _keeper) external override returns (bool _isKeeper) {\n _initialGas = _getGasLeft();\n if (_keepers.contains(_keeper)) {\n emit KeeperValidation(_initialGas);\n return true;\n }\n }\n\n /// @inheritdoc IKeep3rJobWorkable\n function isBondedKeeper(\n address _keeper,\n address _bond,\n uint256 _minBond,\n uint256 _earned,\n uint256 _age\n ) external override returns (bool _isBondedKeeper) {\n _initialGas = _getGasLeft();\n if (\n _keepers.contains(_keeper) &&\n bonds[_keeper][_bond] >= _minBond &&\n workCompleted[_keeper] >= _earned &&\n block.timestamp - firstSeen[_keeper] >= _age\n ) {\n emit KeeperValidation(_initialGas);\n return true;\n }\n }\n\n /// @inheritdoc IKeep3rJobWorkable\n function worked(address _keeper) external virtual override {\n if (_initialGas == 0) revert GasNotInitialized();\n address _job = msg.sender;\n if (disputes[_job]) revert JobDisputed();\n if (!_jobs.contains(_job)) revert JobUnapproved();\n\n if (_updateJobCreditsIfNeeded(_job)) {\n emit LiquidityCreditsReward(_job, rewardedAt[_job], _jobLiquidityCredits[_job], _jobPeriodCredits[_job]);\n }\n\n (uint256 _boost, uint256 _oneEthQuote, uint256 _extraGas) = IKeep3rHelper(keep3rHelper).getPaymentParams(bonds[_keeper][keep3rV1]);\n\n uint256 _gasLeft = _getGasLeft();\n uint256 _payment = _calculatePayment(_gasLeft, _extraGas, _oneEthQuote, _boost);\n\n if (_payment > _jobLiquidityCredits[_job]) {\n _rewardJobCredits(_job);\n emit LiquidityCreditsReward(_job, rewardedAt[_job], _jobLiquidityCredits[_job], _jobPeriodCredits[_job]);\n\n _gasLeft = _getGasLeft();\n _payment = _calculatePayment(_gasLeft, _extraGas, _oneEthQuote, _boost);\n }\n\n _bondedPayment(_job, _keeper, _payment);\n delete _initialGas;\n\n emit KeeperWork(keep3rV1, _job, _keeper, _payment, _gasLeft);\n }\n\n /// @inheritdoc IKeep3rJobWorkable\n function bondedPayment(address _keeper, uint256 _payment) external override {\n address _job = msg.sender;\n\n if (disputes[_job]) revert JobDisputed();\n if (!_jobs.contains(_job)) revert JobUnapproved();\n\n if (_updateJobCreditsIfNeeded(_job)) {\n emit LiquidityCreditsReward(_job, rewardedAt[_job], _jobLiquidityCredits[_job], _jobPeriodCredits[_job]);\n }\n\n if (_payment > _jobLiquidityCredits[_job]) {\n _rewardJobCredits(_job);\n emit LiquidityCreditsReward(_job, rewardedAt[_job], _jobLiquidityCredits[_job], _jobPeriodCredits[_job]);\n }\n\n _bondedPayment(_job, _keeper, _payment);\n emit KeeperWork(keep3rV1, _job, _keeper, _payment, _getGasLeft());\n }\n\n /// @inheritdoc IKeep3rJobWorkable\n function directTokenPayment(\n address _token,\n address _keeper,\n uint256 _amount\n ) external override {\n address _job = msg.sender;\n\n if (disputes[_job]) revert JobDisputed();\n if (disputes[_keeper]) revert Disputed();\n if (!_jobs.contains(_job)) revert JobUnapproved();\n if (jobTokenCredits[_job][_token] < _amount) revert InsufficientFunds();\n jobTokenCredits[_job][_token] -= _amount;\n IERC20(_token).safeTransfer(_keeper, _amount);\n emit KeeperWork(_token, _job, _keeper, _amount, _getGasLeft());\n }\n\n function _bondedPayment(\n address _job,\n address _keeper,\n uint256 _payment\n ) internal {\n if (_payment > _jobLiquidityCredits[_job]) revert InsufficientFunds();\n\n workedAt[_job] = block.timestamp;\n _jobLiquidityCredits[_job] -= _payment;\n bonds[_keeper][keep3rV1] += _payment;\n workCompleted[_keeper] += _payment;\n totalBonds += _payment;\n }\n\n /// @notice Calculate amount to be payed in KP3R, taking into account multiple parameters\n /// @param _gasLeft Amount of gas left after working the job\n /// @param _extraGas Amount of expected unaccounted gas\n /// @param _oneEthQuote Amount of KP3R equivalent to 1 ETH\n /// @param _boost Reward given to the keeper for having bonded KP3R tokens\n /// @return _payment Amount to be payed in KP3R tokens\n function _calculatePayment(\n uint256 _gasLeft,\n uint256 _extraGas,\n uint256 _oneEthQuote,\n uint256 _boost\n ) internal view returns (uint256 _payment) {\n uint256 _accountedGas = _initialGas - _gasLeft + _extraGas;\n _payment = (((_accountedGas * _boost) / _BASE) * _oneEthQuote) / 1 ether;\n }\n\n /// @notice Return the gas left and add 1/64 in order to match real gas left at first level of depth (EIP-150)\n /// @return _gasLeft Amount of gas left recording taking into account EIP-150\n function _getGasLeft() internal view returns (uint256 _gasLeft) {\n _gasLeft = (gasleft() * 64) / 63;\n }\n}\n" - }, - "solidity/contracts/peripherals/jobs/Keep3rJobDisputable.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport './Keep3rJobFundableCredits.sol';\nimport './Keep3rJobFundableLiquidity.sol';\nimport '../Keep3rDisputable.sol';\n\nabstract contract Keep3rJobDisputable is IKeep3rJobDisputable, Keep3rDisputable, Keep3rJobFundableCredits, Keep3rJobFundableLiquidity {\n using EnumerableSet for EnumerableSet.AddressSet;\n using SafeERC20 for IERC20;\n\n /// @inheritdoc IKeep3rJobDisputable\n function slashTokenFromJob(\n address _job,\n address _token,\n uint256 _amount\n ) external override onlySlasher {\n if (!disputes[_job]) revert NotDisputed();\n if (!_jobTokens[_job].contains(_token)) revert JobTokenUnexistent();\n if (jobTokenCredits[_job][_token] < _amount) revert JobTokenInsufficient();\n\n try IERC20(_token).transfer(governance, _amount) {} catch {}\n jobTokenCredits[_job][_token] -= _amount;\n if (jobTokenCredits[_job][_token] == 0) {\n _jobTokens[_job].remove(_token);\n }\n\n emit JobSlashToken(_job, _token, msg.sender, _amount);\n }\n\n /// @inheritdoc IKeep3rJobDisputable\n function slashLiquidityFromJob(\n address _job,\n address _liquidity,\n uint256 _amount\n ) external override onlySlasher {\n if (!disputes[_job]) revert NotDisputed();\n\n _unbondLiquidityFromJob(_job, _liquidity, _amount);\n try IERC20(_liquidity).transfer(governance, _amount) {} catch {}\n emit JobSlashLiquidity(_job, _liquidity, msg.sender, _amount);\n }\n}\n" - }, - "solidity/contracts/peripherals/jobs/Keep3rJobOwnership.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../../../interfaces/peripherals/IKeep3rJobs.sol';\n\nabstract contract Keep3rJobOwnership is IKeep3rJobOwnership {\n /// @inheritdoc IKeep3rJobOwnership\n mapping(address => address) public override jobOwner;\n\n /// @inheritdoc IKeep3rJobOwnership\n mapping(address => address) public override jobPendingOwner;\n\n /// @inheritdoc IKeep3rJobOwnership\n function changeJobOwnership(address _job, address _newOwner) external override onlyJobOwner(_job) {\n jobPendingOwner[_job] = _newOwner;\n emit JobOwnershipChange(_job, jobOwner[_job], _newOwner);\n }\n\n /// @inheritdoc IKeep3rJobOwnership\n function acceptJobOwnership(address _job) external override onlyPendingJobOwner(_job) {\n address _previousOwner = jobOwner[_job];\n\n jobOwner[_job] = jobPendingOwner[_job];\n delete jobPendingOwner[_job];\n\n emit JobOwnershipAssent(msg.sender, _job, _previousOwner);\n }\n\n modifier onlyJobOwner(address _job) {\n if (msg.sender != jobOwner[_job]) revert OnlyJobOwner();\n _;\n }\n\n modifier onlyPendingJobOwner(address _job) {\n if (msg.sender != jobPendingOwner[_job]) revert OnlyPendingJobOwner();\n _;\n }\n}\n" - }, - "solidity/contracts/peripherals/Keep3rAccountance.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '@openzeppelin/contracts/utils/structs/EnumerableSet.sol';\nimport '../../interfaces/peripherals/IKeep3rAccountance.sol';\nimport './Keep3rRoles.sol';\n\nabstract contract Keep3rAccountance is IKeep3rAccountance, Keep3rRoles {\n using EnumerableSet for EnumerableSet.AddressSet;\n\n /// @notice List of all enabled keepers\n EnumerableSet.AddressSet internal _keepers;\n\n /// @inheritdoc IKeep3rAccountance\n uint256 public override totalBonds;\n\n /// @inheritdoc IKeep3rAccountance\n mapping(address => uint256) public override workCompleted;\n\n /// @inheritdoc IKeep3rAccountance\n mapping(address => uint256) public override firstSeen;\n\n /// @inheritdoc IKeep3rAccountance\n mapping(address => bool) public override disputes;\n\n /// @inheritdoc IKeep3rAccountance\n /// @notice Mapping (job => bonding => amount)\n mapping(address => mapping(address => uint256)) public override bonds;\n\n /// @inheritdoc IKeep3rAccountance\n mapping(address => mapping(address => uint256)) public override jobTokenCredits;\n\n /// @notice The current liquidity credits available for a job\n mapping(address => uint256) internal _jobLiquidityCredits;\n\n /// @notice Map the address of a job to its correspondent periodCredits\n mapping(address => uint256) internal _jobPeriodCredits;\n\n /// @notice Enumerable array of Job Tokens for Credits\n mapping(address => EnumerableSet.AddressSet) internal _jobTokens;\n\n /// @notice List of liquidities that a job has (job => liquidities)\n mapping(address => EnumerableSet.AddressSet) internal _jobLiquidities;\n\n /// @notice Liquidity pool to observe\n mapping(address => address) internal _liquidityPool;\n\n /// @notice Tracks if a pool has KP3R as token0\n mapping(address => bool) internal _isKP3RToken0;\n\n /// @inheritdoc IKeep3rAccountance\n mapping(address => mapping(address => uint256)) public override pendingBonds;\n\n /// @inheritdoc IKeep3rAccountance\n mapping(address => mapping(address => uint256)) public override canActivateAfter;\n\n /// @inheritdoc IKeep3rAccountance\n mapping(address => mapping(address => uint256)) public override canWithdrawAfter;\n\n /// @inheritdoc IKeep3rAccountance\n mapping(address => mapping(address => uint256)) public override pendingUnbonds;\n\n /// @inheritdoc IKeep3rAccountance\n mapping(address => bool) public override hasBonded;\n\n /// @notice List of all enabled jobs\n EnumerableSet.AddressSet internal _jobs;\n\n /// @inheritdoc IKeep3rAccountance\n function jobs() external view override returns (address[] memory _list) {\n _list = _jobs.values();\n }\n\n /// @inheritdoc IKeep3rAccountance\n function keepers() external view override returns (address[] memory _list) {\n _list = _keepers.values();\n }\n}\n" - }, - "@openzeppelin/contracts/utils/structs/EnumerableSet.sol": { - "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Library for managing\n * https://en.wikipedia.org/wiki/Set_(abstract_data_type)[sets] of primitive\n * types.\n *\n * Sets have the following properties:\n *\n * - Elements are added, removed, and checked for existence in constant time\n * (O(1)).\n * - Elements are enumerated in O(n). No guarantees are made on the ordering.\n *\n * ```\n * contract Example {\n * // Add the library methods\n * using EnumerableSet for EnumerableSet.AddressSet;\n *\n * // Declare a set state variable\n * EnumerableSet.AddressSet private mySet;\n * }\n * ```\n *\n * As of v3.3.0, sets of type `bytes32` (`Bytes32Set`), `address` (`AddressSet`)\n * and `uint256` (`UintSet`) are supported.\n */\nlibrary EnumerableSet {\n // To implement this library for multiple types with as little code\n // repetition as possible, we write it in terms of a generic Set type with\n // bytes32 values.\n // The Set implementation uses private functions, and user-facing\n // implementations (such as AddressSet) are just wrappers around the\n // underlying Set.\n // This means that we can only create new EnumerableSets for types that fit\n // in bytes32.\n\n struct Set {\n // Storage of set values\n bytes32[] _values;\n // Position of the value in the `values` array, plus 1 because index 0\n // means a value is not in the set.\n mapping(bytes32 => uint256) _indexes;\n }\n\n /**\n * @dev Add a value to a set. O(1).\n *\n * Returns true if the value was added to the set, that is if it was not\n * already present.\n */\n function _add(Set storage set, bytes32 value) private returns (bool) {\n if (!_contains(set, value)) {\n set._values.push(value);\n // The value is stored at length-1, but we add 1 to all indexes\n // and use 0 as a sentinel value\n set._indexes[value] = set._values.length;\n return true;\n } else {\n return false;\n }\n }\n\n /**\n * @dev Removes a value from a set. O(1).\n *\n * Returns true if the value was removed from the set, that is if it was\n * present.\n */\n function _remove(Set storage set, bytes32 value) private returns (bool) {\n // We read and store the value's index to prevent multiple reads from the same storage slot\n uint256 valueIndex = set._indexes[value];\n\n if (valueIndex != 0) {\n // Equivalent to contains(set, value)\n // To delete an element from the _values array in O(1), we swap the element to delete with the last one in\n // the array, and then remove the last element (sometimes called as 'swap and pop').\n // This modifies the order of the array, as noted in {at}.\n\n uint256 toDeleteIndex = valueIndex - 1;\n uint256 lastIndex = set._values.length - 1;\n\n if (lastIndex != toDeleteIndex) {\n bytes32 lastvalue = set._values[lastIndex];\n\n // Move the last value to the index where the value to delete is\n set._values[toDeleteIndex] = lastvalue;\n // Update the index for the moved value\n set._indexes[lastvalue] = valueIndex; // Replace lastvalue's index to valueIndex\n }\n\n // Delete the slot where the moved value was stored\n set._values.pop();\n\n // Delete the index for the deleted slot\n delete set._indexes[value];\n\n return true;\n } else {\n return false;\n }\n }\n\n /**\n * @dev Returns true if the value is in the set. O(1).\n */\n function _contains(Set storage set, bytes32 value) private view returns (bool) {\n return set._indexes[value] != 0;\n }\n\n /**\n * @dev Returns the number of values on the set. O(1).\n */\n function _length(Set storage set) private view returns (uint256) {\n return set._values.length;\n }\n\n /**\n * @dev Returns the value stored at position `index` in the set. O(1).\n *\n * Note that there are no guarantees on the ordering of values inside the\n * array, and it may change when more values are added or removed.\n *\n * Requirements:\n *\n * - `index` must be strictly less than {length}.\n */\n function _at(Set storage set, uint256 index) private view returns (bytes32) {\n return set._values[index];\n }\n\n /**\n * @dev Return the entire set in an array\n *\n * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed\n * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that\n * this function has an unbounded cost, and using it as part of a state-changing function may render the function\n * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.\n */\n function _values(Set storage set) private view returns (bytes32[] memory) {\n return set._values;\n }\n\n // Bytes32Set\n\n struct Bytes32Set {\n Set _inner;\n }\n\n /**\n * @dev Add a value to a set. O(1).\n *\n * Returns true if the value was added to the set, that is if it was not\n * already present.\n */\n function add(Bytes32Set storage set, bytes32 value) internal returns (bool) {\n return _add(set._inner, value);\n }\n\n /**\n * @dev Removes a value from a set. O(1).\n *\n * Returns true if the value was removed from the set, that is if it was\n * present.\n */\n function remove(Bytes32Set storage set, bytes32 value) internal returns (bool) {\n return _remove(set._inner, value);\n }\n\n /**\n * @dev Returns true if the value is in the set. O(1).\n */\n function contains(Bytes32Set storage set, bytes32 value) internal view returns (bool) {\n return _contains(set._inner, value);\n }\n\n /**\n * @dev Returns the number of values in the set. O(1).\n */\n function length(Bytes32Set storage set) internal view returns (uint256) {\n return _length(set._inner);\n }\n\n /**\n * @dev Returns the value stored at position `index` in the set. O(1).\n *\n * Note that there are no guarantees on the ordering of values inside the\n * array, and it may change when more values are added or removed.\n *\n * Requirements:\n *\n * - `index` must be strictly less than {length}.\n */\n function at(Bytes32Set storage set, uint256 index) internal view returns (bytes32) {\n return _at(set._inner, index);\n }\n\n /**\n * @dev Return the entire set in an array\n *\n * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed\n * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that\n * this function has an unbounded cost, and using it as part of a state-changing function may render the function\n * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.\n */\n function values(Bytes32Set storage set) internal view returns (bytes32[] memory) {\n return _values(set._inner);\n }\n\n // AddressSet\n\n struct AddressSet {\n Set _inner;\n }\n\n /**\n * @dev Add a value to a set. O(1).\n *\n * Returns true if the value was added to the set, that is if it was not\n * already present.\n */\n function add(AddressSet storage set, address value) internal returns (bool) {\n return _add(set._inner, bytes32(uint256(uint160(value))));\n }\n\n /**\n * @dev Removes a value from a set. O(1).\n *\n * Returns true if the value was removed from the set, that is if it was\n * present.\n */\n function remove(AddressSet storage set, address value) internal returns (bool) {\n return _remove(set._inner, bytes32(uint256(uint160(value))));\n }\n\n /**\n * @dev Returns true if the value is in the set. O(1).\n */\n function contains(AddressSet storage set, address value) internal view returns (bool) {\n return _contains(set._inner, bytes32(uint256(uint160(value))));\n }\n\n /**\n * @dev Returns the number of values in the set. O(1).\n */\n function length(AddressSet storage set) internal view returns (uint256) {\n return _length(set._inner);\n }\n\n /**\n * @dev Returns the value stored at position `index` in the set. O(1).\n *\n * Note that there are no guarantees on the ordering of values inside the\n * array, and it may change when more values are added or removed.\n *\n * Requirements:\n *\n * - `index` must be strictly less than {length}.\n */\n function at(AddressSet storage set, uint256 index) internal view returns (address) {\n return address(uint160(uint256(_at(set._inner, index))));\n }\n\n /**\n * @dev Return the entire set in an array\n *\n * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed\n * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that\n * this function has an unbounded cost, and using it as part of a state-changing function may render the function\n * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.\n */\n function values(AddressSet storage set) internal view returns (address[] memory) {\n bytes32[] memory store = _values(set._inner);\n address[] memory result;\n\n assembly {\n result := store\n }\n\n return result;\n }\n\n // UintSet\n\n struct UintSet {\n Set _inner;\n }\n\n /**\n * @dev Add a value to a set. O(1).\n *\n * Returns true if the value was added to the set, that is if it was not\n * already present.\n */\n function add(UintSet storage set, uint256 value) internal returns (bool) {\n return _add(set._inner, bytes32(value));\n }\n\n /**\n * @dev Removes a value from a set. O(1).\n *\n * Returns true if the value was removed from the set, that is if it was\n * present.\n */\n function remove(UintSet storage set, uint256 value) internal returns (bool) {\n return _remove(set._inner, bytes32(value));\n }\n\n /**\n * @dev Returns true if the value is in the set. O(1).\n */\n function contains(UintSet storage set, uint256 value) internal view returns (bool) {\n return _contains(set._inner, bytes32(value));\n }\n\n /**\n * @dev Returns the number of values on the set. O(1).\n */\n function length(UintSet storage set) internal view returns (uint256) {\n return _length(set._inner);\n }\n\n /**\n * @dev Returns the value stored at position `index` in the set. O(1).\n *\n * Note that there are no guarantees on the ordering of values inside the\n * array, and it may change when more values are added or removed.\n *\n * Requirements:\n *\n * - `index` must be strictly less than {length}.\n */\n function at(UintSet storage set, uint256 index) internal view returns (uint256) {\n return uint256(_at(set._inner, index));\n }\n\n /**\n * @dev Return the entire set in an array\n *\n * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed\n * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that\n * this function has an unbounded cost, and using it as part of a state-changing function may render the function\n * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.\n */\n function values(UintSet storage set) internal view returns (uint256[] memory) {\n bytes32[] memory store = _values(set._inner);\n uint256[] memory result;\n\n assembly {\n result := store\n }\n\n return result;\n }\n}\n" - }, - "solidity/contracts/peripherals/Keep3rRoles.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../../interfaces/peripherals/IKeep3rRoles.sol';\nimport '@openzeppelin/contracts/utils/structs/EnumerableSet.sol';\nimport './DustCollector.sol';\nimport './Governable.sol';\n\ncontract Keep3rRoles is IKeep3rRoles, Governable, DustCollector {\n /// @inheritdoc IKeep3rRoles\n mapping(address => bool) public override slashers;\n\n /// @inheritdoc IKeep3rRoles\n mapping(address => bool) public override disputers;\n\n constructor(address _governance) Governable(_governance) DustCollector() {}\n\n /// @inheritdoc IKeep3rRoles\n function addSlasher(address _slasher) external override onlyGovernance {\n if (_slasher == address(0)) revert ZeroAddress();\n if (slashers[_slasher]) revert SlasherExistent();\n slashers[_slasher] = true;\n emit SlasherAdded(_slasher);\n }\n\n /// @inheritdoc IKeep3rRoles\n function removeSlasher(address _slasher) external override onlyGovernance {\n if (!slashers[_slasher]) revert SlasherUnexistent();\n delete slashers[_slasher];\n emit SlasherRemoved(_slasher);\n }\n\n /// @inheritdoc IKeep3rRoles\n function addDisputer(address _disputer) external override onlyGovernance {\n if (_disputer == address(0)) revert ZeroAddress();\n if (disputers[_disputer]) revert DisputerExistent();\n disputers[_disputer] = true;\n emit DisputerAdded(_disputer);\n }\n\n /// @inheritdoc IKeep3rRoles\n function removeDisputer(address _disputer) external override onlyGovernance {\n if (!disputers[_disputer]) revert DisputerUnexistent();\n delete disputers[_disputer];\n emit DisputerRemoved(_disputer);\n }\n\n /// @notice Functions with this modifier can only be called by either a slasher or governance\n modifier onlySlasher {\n if (!slashers[msg.sender]) revert OnlySlasher();\n _;\n }\n\n /// @notice Functions with this modifier can only be called by either a disputer or governance\n modifier onlyDisputer {\n if (!disputers[msg.sender]) revert OnlyDisputer();\n _;\n }\n}\n" - }, - "solidity/contracts/peripherals/Governable.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../../interfaces/peripherals/IGovernable.sol';\n\nabstract contract Governable is IGovernable {\n /// @inheritdoc IGovernable\n address public override governance;\n\n /// @inheritdoc IGovernable\n address public override pendingGovernance;\n\n constructor(address _governance) {\n if (_governance == address(0)) revert NoGovernanceZeroAddress();\n governance = _governance;\n }\n\n /// @inheritdoc IGovernable\n function setGovernance(address _governance) external override onlyGovernance {\n pendingGovernance = _governance;\n emit GovernanceProposal(_governance);\n }\n\n /// @inheritdoc IGovernable\n function acceptGovernance() external override onlyPendingGovernance {\n governance = pendingGovernance;\n delete pendingGovernance;\n emit GovernanceSet(governance);\n }\n\n /// @notice Functions with this modifier can only be called by governance\n modifier onlyGovernance {\n if (msg.sender != governance) revert OnlyGovernance();\n _;\n }\n\n /// @notice Functions with this modifier can only be called by pendingGovernance\n modifier onlyPendingGovernance {\n if (msg.sender != pendingGovernance) revert OnlyPendingGovernance();\n _;\n }\n}\n" - }, - "@openzeppelin/contracts/token/ERC20/IERC20.sol": { - "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Interface of the ERC20 standard as defined in the EIP.\n */\ninterface IERC20 {\n /**\n * @dev Returns the amount of tokens in existence.\n */\n function totalSupply() external view returns (uint256);\n\n /**\n * @dev Returns the amount of tokens owned by `account`.\n */\n function balanceOf(address account) external view returns (uint256);\n\n /**\n * @dev Moves `amount` tokens from the caller's account to `recipient`.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * Emits a {Transfer} event.\n */\n function transfer(address recipient, uint256 amount) external returns (bool);\n\n /**\n * @dev Returns the remaining number of tokens that `spender` will be\n * allowed to spend on behalf of `owner` through {transferFrom}. This is\n * zero by default.\n *\n * This value changes when {approve} or {transferFrom} are called.\n */\n function allowance(address owner, address spender) external view returns (uint256);\n\n /**\n * @dev Sets `amount` as the allowance of `spender` over the caller's tokens.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * IMPORTANT: Beware that changing an allowance with this method brings the risk\n * that someone may use both the old and the new allowance by unfortunate\n * transaction ordering. One possible solution to mitigate this race\n * condition is to first reduce the spender's allowance to 0 and set the\n * desired value afterwards:\n * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729\n *\n * Emits an {Approval} event.\n */\n function approve(address spender, uint256 amount) external returns (bool);\n\n /**\n * @dev Moves `amount` tokens from `sender` to `recipient` using the\n * allowance mechanism. `amount` is then deducted from the caller's\n * allowance.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * Emits a {Transfer} event.\n */\n function transferFrom(\n address sender,\n address recipient,\n uint256 amount\n ) external returns (bool);\n\n /**\n * @dev Emitted when `value` tokens are moved from one account (`from`) to\n * another (`to`).\n *\n * Note that `value` may be zero.\n */\n event Transfer(address indexed from, address indexed to, uint256 value);\n\n /**\n * @dev Emitted when the allowance of a `spender` for an `owner` is set by\n * a call to {approve}. `value` is the new allowance.\n */\n event Approval(address indexed owner, address indexed spender, uint256 value);\n}\n" - }, - "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol": { - "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\nimport \"../IERC20.sol\";\nimport \"../../../utils/Address.sol\";\n\n/**\n * @title SafeERC20\n * @dev Wrappers around ERC20 operations that throw on failure (when the token\n * contract returns false). Tokens that return no value (and instead revert or\n * throw on failure) are also supported, non-reverting calls are assumed to be\n * successful.\n * To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract,\n * which allows you to call the safe operations as `token.safeTransfer(...)`, etc.\n */\nlibrary SafeERC20 {\n using Address for address;\n\n function safeTransfer(\n IERC20 token,\n address to,\n uint256 value\n ) internal {\n _callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value));\n }\n\n function safeTransferFrom(\n IERC20 token,\n address from,\n address to,\n uint256 value\n ) internal {\n _callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value));\n }\n\n /**\n * @dev Deprecated. This function has issues similar to the ones found in\n * {IERC20-approve}, and its usage is discouraged.\n *\n * Whenever possible, use {safeIncreaseAllowance} and\n * {safeDecreaseAllowance} instead.\n */\n function safeApprove(\n IERC20 token,\n address spender,\n uint256 value\n ) internal {\n // safeApprove should only be called when setting an initial allowance,\n // or when resetting it to zero. To increase and decrease it, use\n // 'safeIncreaseAllowance' and 'safeDecreaseAllowance'\n require(\n (value == 0) || (token.allowance(address(this), spender) == 0),\n \"SafeERC20: approve from non-zero to non-zero allowance\"\n );\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value));\n }\n\n function safeIncreaseAllowance(\n IERC20 token,\n address spender,\n uint256 value\n ) internal {\n uint256 newAllowance = token.allowance(address(this), spender) + value;\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));\n }\n\n function safeDecreaseAllowance(\n IERC20 token,\n address spender,\n uint256 value\n ) internal {\n unchecked {\n uint256 oldAllowance = token.allowance(address(this), spender);\n require(oldAllowance >= value, \"SafeERC20: decreased allowance below zero\");\n uint256 newAllowance = oldAllowance - value;\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));\n }\n }\n\n /**\n * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement\n * on the return value: the return value is optional (but if data is returned, it must not be false).\n * @param token The token targeted by the call.\n * @param data The call data (encoded using abi.encode or one of its variants).\n */\n function _callOptionalReturn(IERC20 token, bytes memory data) private {\n // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since\n // we're implementing it ourselves. We use {Address.functionCall} to perform this call, which verifies that\n // the target address contains contract code and also asserts for success in the low-level call.\n\n bytes memory returndata = address(token).functionCall(data, \"SafeERC20: low-level call failed\");\n if (returndata.length > 0) {\n // Return data is optional\n require(abi.decode(returndata, (bool)), \"SafeERC20: ERC20 operation did not succeed\");\n }\n }\n}\n" - }, - "@openzeppelin/contracts/utils/Address.sol": { - "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Collection of functions related to the address type\n */\nlibrary Address {\n /**\n * @dev Returns true if `account` is a contract.\n *\n * [IMPORTANT]\n * ====\n * It is unsafe to assume that an address for which this function returns\n * false is an externally-owned account (EOA) and not a contract.\n *\n * Among others, `isContract` will return false for the following\n * types of addresses:\n *\n * - an externally-owned account\n * - a contract in construction\n * - an address where a contract will be created\n * - an address where a contract lived, but was destroyed\n * ====\n */\n function isContract(address account) internal view returns (bool) {\n // This method relies on extcodesize, which returns 0 for contracts in\n // construction, since the code is only stored at the end of the\n // constructor execution.\n\n uint256 size;\n assembly {\n size := extcodesize(account)\n }\n return size > 0;\n }\n\n /**\n * @dev Replacement for Solidity's `transfer`: sends `amount` wei to\n * `recipient`, forwarding all available gas and reverting on errors.\n *\n * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost\n * of certain opcodes, possibly making contracts go over the 2300 gas limit\n * imposed by `transfer`, making them unable to receive funds via\n * `transfer`. {sendValue} removes this limitation.\n *\n * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].\n *\n * IMPORTANT: because control is transferred to `recipient`, care must be\n * taken to not create reentrancy vulnerabilities. Consider using\n * {ReentrancyGuard} or the\n * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].\n */\n function sendValue(address payable recipient, uint256 amount) internal {\n require(address(this).balance >= amount, \"Address: insufficient balance\");\n\n (bool success, ) = recipient.call{value: amount}(\"\");\n require(success, \"Address: unable to send value, recipient may have reverted\");\n }\n\n /**\n * @dev Performs a Solidity function call using a low level `call`. A\n * plain `call` is an unsafe replacement for a function call: use this\n * function instead.\n *\n * If `target` reverts with a revert reason, it is bubbled up by this\n * function (like regular Solidity function calls).\n *\n * Returns the raw returned data. To convert to the expected return value,\n * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\n *\n * Requirements:\n *\n * - `target` must be a contract.\n * - calling `target` with `data` must not revert.\n *\n * _Available since v3.1._\n */\n function functionCall(address target, bytes memory data) internal returns (bytes memory) {\n return functionCall(target, data, \"Address: low-level call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with\n * `errorMessage` as a fallback revert reason when `target` reverts.\n *\n * _Available since v3.1._\n */\n function functionCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal returns (bytes memory) {\n return functionCallWithValue(target, data, 0, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but also transferring `value` wei to `target`.\n *\n * Requirements:\n *\n * - the calling contract must have an ETH balance of at least `value`.\n * - the called Solidity function must be `payable`.\n *\n * _Available since v3.1._\n */\n function functionCallWithValue(\n address target,\n bytes memory data,\n uint256 value\n ) internal returns (bytes memory) {\n return functionCallWithValue(target, data, value, \"Address: low-level call with value failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but\n * with `errorMessage` as a fallback revert reason when `target` reverts.\n *\n * _Available since v3.1._\n */\n function functionCallWithValue(\n address target,\n bytes memory data,\n uint256 value,\n string memory errorMessage\n ) internal returns (bytes memory) {\n require(address(this).balance >= value, \"Address: insufficient balance for call\");\n require(isContract(target), \"Address: call to non-contract\");\n\n (bool success, bytes memory returndata) = target.call{value: value}(data);\n return verifyCallResult(success, returndata, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but performing a static call.\n *\n * _Available since v3.3._\n */\n function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\n return functionStaticCall(target, data, \"Address: low-level static call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\n * but performing a static call.\n *\n * _Available since v3.3._\n */\n function functionStaticCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal view returns (bytes memory) {\n require(isContract(target), \"Address: static call to non-contract\");\n\n (bool success, bytes memory returndata) = target.staticcall(data);\n return verifyCallResult(success, returndata, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but performing a delegate call.\n *\n * _Available since v3.4._\n */\n function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {\n return functionDelegateCall(target, data, \"Address: low-level delegate call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\n * but performing a delegate call.\n *\n * _Available since v3.4._\n */\n function functionDelegateCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal returns (bytes memory) {\n require(isContract(target), \"Address: delegate call to non-contract\");\n\n (bool success, bytes memory returndata) = target.delegatecall(data);\n return verifyCallResult(success, returndata, errorMessage);\n }\n\n /**\n * @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the\n * revert reason using the provided one.\n *\n * _Available since v4.3._\n */\n function verifyCallResult(\n bool success,\n bytes memory returndata,\n string memory errorMessage\n ) internal pure returns (bytes memory) {\n if (success) {\n return returndata;\n } else {\n // Look for revert reason and bubble it up if present\n if (returndata.length > 0) {\n // The easiest way to bubble the revert reason is using memory via assembly\n\n assembly {\n let returndata_size := mload(returndata)\n revert(add(32, returndata), returndata_size)\n }\n } else {\n revert(errorMessage);\n }\n }\n }\n}\n" - }, - "solidity/contracts/peripherals/jobs/Keep3rJobMigration.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../../../interfaces/peripherals/IKeep3rJobs.sol';\nimport './Keep3rJobFundableCredits.sol';\nimport './Keep3rJobFundableLiquidity.sol';\n\nabstract contract Keep3rJobMigration is IKeep3rJobMigration, Keep3rJobFundableCredits, Keep3rJobFundableLiquidity {\n using EnumerableSet for EnumerableSet.AddressSet;\n\n uint256 internal constant _MIGRATION_COOLDOWN = 1 minutes;\n\n /// @inheritdoc IKeep3rJobMigration\n mapping(address => address) public override pendingJobMigrations;\n mapping(address => mapping(address => uint256)) internal _migrationCreatedAt;\n\n /// @inheritdoc IKeep3rJobMigration\n function migrateJob(address _fromJob, address _toJob) external override onlyJobOwner(_fromJob) {\n if (_fromJob == _toJob) revert JobMigrationImpossible();\n\n pendingJobMigrations[_fromJob] = _toJob;\n _migrationCreatedAt[_fromJob][_toJob] = block.timestamp;\n\n emit JobMigrationRequested(_fromJob, _toJob);\n }\n\n /// @inheritdoc IKeep3rJobMigration\n function acceptJobMigration(address _fromJob, address _toJob) external override onlyJobOwner(_toJob) {\n if (disputes[_fromJob] || disputes[_toJob]) revert JobDisputed();\n if (pendingJobMigrations[_fromJob] != _toJob) revert JobMigrationUnavailable();\n if (block.timestamp < _migrationCreatedAt[_fromJob][_toJob] + _MIGRATION_COOLDOWN) revert JobMigrationLocked();\n\n // force job credits update for both jobs\n _settleJobAccountance(_fromJob);\n _settleJobAccountance(_toJob);\n\n // migrate tokens\n while (_jobTokens[_fromJob].length() > 0) {\n address _tokenToMigrate = _jobTokens[_fromJob].at(0);\n jobTokenCredits[_toJob][_tokenToMigrate] += jobTokenCredits[_fromJob][_tokenToMigrate];\n delete jobTokenCredits[_fromJob][_tokenToMigrate];\n _jobTokens[_fromJob].remove(_tokenToMigrate);\n _jobTokens[_toJob].add(_tokenToMigrate);\n }\n\n // migrate liquidities\n while (_jobLiquidities[_fromJob].length() > 0) {\n address _liquidity = _jobLiquidities[_fromJob].at(0);\n\n liquidityAmount[_toJob][_liquidity] += liquidityAmount[_fromJob][_liquidity];\n delete liquidityAmount[_fromJob][_liquidity];\n\n _jobLiquidities[_toJob].add(_liquidity);\n _jobLiquidities[_fromJob].remove(_liquidity);\n }\n\n // migrate job balances\n _jobPeriodCredits[_toJob] += _jobPeriodCredits[_fromJob];\n delete _jobPeriodCredits[_fromJob];\n\n _jobLiquidityCredits[_toJob] += _jobLiquidityCredits[_fromJob];\n delete _jobLiquidityCredits[_fromJob];\n\n // stop _fromJob from being a job\n delete rewardedAt[_fromJob];\n _jobs.remove(_fromJob);\n\n // delete unused data slots\n delete jobOwner[_fromJob];\n delete jobPendingOwner[_fromJob];\n delete _migrationCreatedAt[_fromJob][_toJob];\n delete pendingJobMigrations[_fromJob];\n\n emit JobMigrationSuccessful(_fromJob, _toJob);\n }\n}\n" - }, - "solidity/interfaces/IKeep3rHelper.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport './IKeep3rHelperParameters.sol';\n\n/// @title Keep3rHelper contract\n/// @notice Contains all the helper functions used throughout the different files.\ninterface IKeep3rHelper is IKeep3rHelperParameters {\n // Errors\n\n /// @notice Throws when none of the tokens in the liquidity pair is KP3R\n error LiquidityPairInvalid();\n\n // Methods\n // solhint-enable func-name-mixedcase\n\n /// @notice Calculates the amount of KP3R that corresponds to the ETH passed into the function\n /// @dev This function allows us to calculate how much KP3R we should pay to a keeper for things expressed in ETH, like gas\n /// @param _eth The amount of ETH\n /// @return _amountOut The amount of KP3R\n function quote(uint256 _eth) external view returns (uint256 _amountOut);\n\n /// @notice Returns the amount of KP3R the keeper has bonded\n /// @param _keeper The address of the keeper to check\n /// @return _amountBonded The amount of KP3R the keeper has bonded\n function bonds(address _keeper) external view returns (uint256 _amountBonded);\n\n /// @notice Calculates the reward (in KP3R) that corresponds to a keeper for using gas\n /// @param _keeper The address of the keeper to check\n /// @param _gasUsed The amount of gas used that will be rewarded\n /// @return _kp3r The amount of KP3R that should be awarded to the keeper\n function getRewardAmountFor(address _keeper, uint256 _gasUsed) external view returns (uint256 _kp3r);\n\n /// @notice Calculates the boost in the reward given to a keeper based on the amount of KP3R that keeper has bonded\n /// @dev If the keeper has no bonds, boost should be +10% of gas cost, if keeper has max bonds, +20%\n /// @param _bonds The amount of KP3R tokens bonded by the keeper\n /// @return _rewardBoost The reward boost that corresponds to the keeper\n function getRewardBoostFor(uint256 _bonds) external view returns (uint256 _rewardBoost);\n\n /// @notice Calculates the reward (in KP3R) that corresponds to tx.origin for using gas\n /// @param _gasUsed The amount of gas used that will be rewarded\n /// @return _amount The amount of KP3R that should be awarded to tx.origin\n function getRewardAmount(uint256 _gasUsed) external view returns (uint256 _amount);\n\n /// @notice Given a pool address, returns the underlying tokens of the pair\n /// @param _pool Address of the correspondant pool\n /// @return _token0 Address of the first token of the pair\n /// @return _token1 Address of the second token of the pair\n function getPoolTokens(address _pool) external view returns (address _token0, address _token1);\n\n /// @notice Defines the order of the tokens in the pair for twap calculations\n /// @param _pool Address of the correspondant pool\n /// @return _isKP3RToken0 Boolean indicating the order of the tokens in the pair\n function isKP3RToken0(address _pool) external view returns (bool _isKP3RToken0);\n\n /// @notice Given an array of secondsAgo, returns UniswapV3 pool cumulatives at that moment\n /// @param _pool Address of the pool to observe\n /// @param _secondsAgo Array with time references to observe\n /// @return _tickCumulative1 Cumulative sum of ticks until first time reference\n /// @return _tickCumulative2 Cumulative sum of ticks until second time reference\n /// @return _success Boolean indicating if the observe call was succesfull\n function observe(address _pool, uint32[] memory _secondsAgo)\n external\n view\n returns (\n int56 _tickCumulative1,\n int56 _tickCumulative2,\n bool _success\n );\n\n /// @notice Get multiplier, quote, and extra, in order to calculate keeper payment\n /// @param _bonds Amount of bonded KP3R owned by the keeper\n /// @return _boost Multiplier per gas unit. Takes into account the base fee and the amount of bonded KP3R\n /// @return _oneEthQuote Amount of KP3R tokens equivalent to 1 ETH\n /// @return _extra Amount of extra gas that should be added to the gas spent\n function getPaymentParams(uint256 _bonds)\n external\n view\n returns (\n uint256 _boost,\n uint256 _oneEthQuote,\n uint256 _extra\n );\n\n /// @notice Given a tick and a liquidity amount, calculates the underlying KP3R tokens\n /// @param _liquidityAmount Amount of liquidity to be converted\n /// @param _tickDifference Tick value used to calculate the quote\n /// @param _timeInterval Time value used to calculate the quote\n /// @return _kp3rAmount Amount of KP3R tokens underlying on the given liquidity\n function getKP3RsAtTick(\n uint256 _liquidityAmount,\n int56 _tickDifference,\n uint256 _timeInterval\n ) external pure returns (uint256 _kp3rAmount);\n\n /// @notice Given a tick and a token amount, calculates the output in correspondant token\n /// @param _baseAmount Amount of token to be converted\n /// @param _tickDifference Tick value used to calculate the quote\n /// @param _timeInterval Time value used to calculate the quote\n /// @return _quoteAmount Amount of credits deserved for the baseAmount at the tick value\n function getQuoteAtTick(\n uint128 _baseAmount,\n int56 _tickDifference,\n uint256 _timeInterval\n ) external pure returns (uint256 _quoteAmount);\n}\n" - }, - "solidity/contracts/peripherals/jobs/Keep3rJobFundableCredits.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport './Keep3rJobOwnership.sol';\nimport '../Keep3rAccountance.sol';\nimport '../Keep3rParameters.sol';\nimport '../../../interfaces/peripherals/IKeep3rJobs.sol';\n\nimport '@openzeppelin/contracts/security/ReentrancyGuard.sol';\nimport '@openzeppelin/contracts/token/ERC20/IERC20.sol';\nimport '@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol';\nimport '@openzeppelin/contracts/utils/math/Math.sol';\n\nabstract contract Keep3rJobFundableCredits is IKeep3rJobFundableCredits, ReentrancyGuard, Keep3rJobOwnership, Keep3rParameters {\n using EnumerableSet for EnumerableSet.AddressSet;\n using SafeERC20 for IERC20;\n\n /// @notice Cooldown between withdrawals\n uint256 internal constant _WITHDRAW_TOKENS_COOLDOWN = 1 minutes;\n\n /// @inheritdoc IKeep3rJobFundableCredits\n mapping(address => mapping(address => uint256)) public override jobTokenCreditsAddedAt;\n\n /// @inheritdoc IKeep3rJobFundableCredits\n function addTokenCreditsToJob(\n address _job,\n address _token,\n uint256 _amount\n ) external override nonReentrant {\n if (!_jobs.contains(_job)) revert JobUnavailable();\n // KP3R shouldn't be used for direct token payments\n if (_token == keep3rV1) revert TokenUnallowed();\n uint256 _before = IERC20(_token).balanceOf(address(this));\n IERC20(_token).safeTransferFrom(msg.sender, address(this), _amount);\n uint256 _received = IERC20(_token).balanceOf(address(this)) - _before;\n uint256 _tokenFee = (_received * fee) / _BASE;\n jobTokenCredits[_job][_token] += _received - _tokenFee;\n jobTokenCreditsAddedAt[_job][_token] = block.timestamp;\n IERC20(_token).safeTransfer(governance, _tokenFee);\n _jobTokens[_job].add(_token);\n\n emit TokenCreditAddition(_job, _token, msg.sender, _received);\n }\n\n /// @inheritdoc IKeep3rJobFundableCredits\n function withdrawTokenCreditsFromJob(\n address _job,\n address _token,\n uint256 _amount,\n address _receiver\n ) external override nonReentrant onlyJobOwner(_job) {\n if (block.timestamp <= jobTokenCreditsAddedAt[_job][_token] + _WITHDRAW_TOKENS_COOLDOWN) revert JobTokenCreditsLocked();\n if (jobTokenCredits[_job][_token] < _amount) revert InsufficientJobTokenCredits();\n if (disputes[_job]) revert JobDisputed();\n\n jobTokenCredits[_job][_token] -= _amount;\n IERC20(_token).safeTransfer(_receiver, _amount);\n\n if (jobTokenCredits[_job][_token] == 0) {\n _jobTokens[_job].remove(_token);\n }\n\n emit TokenCreditWithdrawal(_job, _token, _receiver, _amount);\n }\n}\n" - }, - "solidity/contracts/peripherals/jobs/Keep3rJobFundableLiquidity.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport './Keep3rJobOwnership.sol';\nimport '../Keep3rAccountance.sol';\nimport '../Keep3rParameters.sol';\nimport '../../../interfaces/IPairManager.sol';\nimport '../../../interfaces/peripherals/IKeep3rJobs.sol';\n\nimport '../../libraries/FullMath.sol';\n\nimport '@openzeppelin/contracts/security/ReentrancyGuard.sol';\nimport '@openzeppelin/contracts/token/ERC20/IERC20.sol';\nimport '@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol';\nimport '@openzeppelin/contracts/utils/math/Math.sol';\n\nabstract contract Keep3rJobFundableLiquidity is IKeep3rJobFundableLiquidity, ReentrancyGuard, Keep3rJobOwnership, Keep3rParameters {\n using EnumerableSet for EnumerableSet.AddressSet;\n using SafeERC20 for IERC20;\n\n /// @notice List of liquidities that are accepted in the system\n EnumerableSet.AddressSet internal _approvedLiquidities;\n\n /// @inheritdoc IKeep3rJobFundableLiquidity\n mapping(address => mapping(address => uint256)) public override liquidityAmount;\n\n /// @inheritdoc IKeep3rJobFundableLiquidity\n mapping(address => uint256) public override rewardedAt;\n\n /// @inheritdoc IKeep3rJobFundableLiquidity\n mapping(address => uint256) public override workedAt;\n\n /// @notice Tracks an address and returns its TickCache\n mapping(address => TickCache) internal _tick;\n\n // Views\n\n /// @inheritdoc IKeep3rJobFundableLiquidity\n function approvedLiquidities() external view override returns (address[] memory _list) {\n _list = _approvedLiquidities.values();\n }\n\n /// @inheritdoc IKeep3rJobFundableLiquidity\n function jobPeriodCredits(address _job) public view override returns (uint256 _periodCredits) {\n for (uint256 i; i < _jobLiquidities[_job].length(); i++) {\n address _liquidity = _jobLiquidities[_job].at(i);\n if (_approvedLiquidities.contains(_liquidity)) {\n TickCache memory _tickCache = observeLiquidity(_liquidity);\n if (_tickCache.period != 0) {\n int56 _tickDifference = _isKP3RToken0[_liquidity] ? _tickCache.difference : -_tickCache.difference;\n _periodCredits += _getReward(\n IKeep3rHelper(keep3rHelper).getKP3RsAtTick(liquidityAmount[_job][_liquidity], _tickDifference, rewardPeriodTime)\n );\n }\n }\n }\n }\n\n /// @inheritdoc IKeep3rJobFundableLiquidity\n function jobLiquidityCredits(address _job) public view override returns (uint256 _liquidityCredits) {\n uint256 _periodCredits = jobPeriodCredits(_job);\n\n // If the job was rewarded in the past 1 period time\n if ((block.timestamp - rewardedAt[_job]) < rewardPeriodTime) {\n // If the job has period credits, update minted job credits to new twap\n _liquidityCredits = _periodCredits > 0\n ? (_jobLiquidityCredits[_job] * _periodCredits) / _jobPeriodCredits[_job] // If the job has period credits, return remaining job credits updated to new twap\n : _jobLiquidityCredits[_job]; // If not, return remaining credits, forced credits should not be updated\n } else {\n // Else return a full period worth of credits if current credits have expired\n _liquidityCredits = _periodCredits;\n }\n }\n\n /// @inheritdoc IKeep3rJobFundableLiquidity\n function totalJobCredits(address _job) external view override returns (uint256 _credits) {\n uint256 _periodCredits = jobPeriodCredits(_job);\n uint256 _cooldown = block.timestamp;\n\n if ((rewardedAt[_job] > _period(block.timestamp - rewardPeriodTime))) {\n // Will calculate cooldown if it outdated\n if ((block.timestamp - rewardedAt[_job]) >= rewardPeriodTime) {\n // Will calculate cooldown from last reward reference in this period\n _cooldown -= (rewardedAt[_job] + rewardPeriodTime);\n } else {\n // Will calculate cooldown from last reward timestamp\n _cooldown -= rewardedAt[_job];\n }\n } else {\n // Will calculate cooldown from period start if expired\n _cooldown -= _period(block.timestamp);\n }\n _credits = jobLiquidityCredits(_job) + _phase(_cooldown, _periodCredits);\n }\n\n /// @inheritdoc IKeep3rJobFundableLiquidity\n function quoteLiquidity(address _liquidity, uint256 _amount) external view override returns (uint256 _periodCredits) {\n if (_approvedLiquidities.contains(_liquidity)) {\n TickCache memory _tickCache = observeLiquidity(_liquidity);\n if (_tickCache.period != 0) {\n int56 _tickDifference = _isKP3RToken0[_liquidity] ? _tickCache.difference : -_tickCache.difference;\n return _getReward(IKeep3rHelper(keep3rHelper).getKP3RsAtTick(_amount, _tickDifference, rewardPeriodTime));\n }\n }\n }\n\n /// @inheritdoc IKeep3rJobFundableLiquidity\n function observeLiquidity(address _liquidity) public view virtual override returns (TickCache memory _tickCache) {\n if (_tick[_liquidity].period == _period(block.timestamp)) {\n // Will return cached twaps if liquidity is updated\n _tickCache = _tick[_liquidity];\n } else {\n bool success;\n uint256 lastPeriod = _period(block.timestamp - rewardPeriodTime);\n\n if (_tick[_liquidity].period == lastPeriod) {\n // Will only ask for current period accumulator if liquidity is outdated\n uint32[] memory _secondsAgo = new uint32[](1);\n int56 previousTick = _tick[_liquidity].current;\n\n _secondsAgo[0] = uint32(block.timestamp - _period(block.timestamp));\n\n (_tickCache.current, , success) = IKeep3rHelper(keep3rHelper).observe(_liquidityPool[_liquidity], _secondsAgo);\n\n _tickCache.difference = _tickCache.current - previousTick;\n } else if (_tick[_liquidity].period < lastPeriod) {\n // Will ask for 2 accumulators if liquidity is expired\n uint32[] memory _secondsAgo = new uint32[](2);\n\n _secondsAgo[0] = uint32(block.timestamp - _period(block.timestamp));\n _secondsAgo[1] = uint32(block.timestamp - _period(block.timestamp) + rewardPeriodTime);\n\n int56 _tickCumulative2;\n (_tickCache.current, _tickCumulative2, success) = IKeep3rHelper(keep3rHelper).observe(_liquidityPool[_liquidity], _secondsAgo);\n\n _tickCache.difference = _tickCache.current - _tickCumulative2;\n }\n if (success) {\n _tickCache.period = _period(block.timestamp);\n } else {\n delete _tickCache.period;\n }\n }\n }\n\n // Methods\n\n /// @inheritdoc IKeep3rJobFundableLiquidity\n function forceLiquidityCreditsToJob(address _job, uint256 _amount) external override onlyGovernance {\n if (!_jobs.contains(_job)) revert JobUnavailable();\n _settleJobAccountance(_job);\n _jobLiquidityCredits[_job] += _amount;\n emit LiquidityCreditsForced(_job, rewardedAt[_job], _jobLiquidityCredits[_job]);\n }\n\n /// @inheritdoc IKeep3rJobFundableLiquidity\n function approveLiquidity(address _liquidity) external virtual override onlyGovernance {\n if (!_approvedLiquidities.add(_liquidity)) revert LiquidityPairApproved();\n _liquidityPool[_liquidity] = IPairManager(_liquidity).pool();\n _isKP3RToken0[_liquidity] = IKeep3rHelper(keep3rHelper).isKP3RToken0(_liquidityPool[_liquidity]);\n _tick[_liquidity] = observeLiquidity(_liquidity);\n emit LiquidityApproval(_liquidity);\n }\n\n /// @inheritdoc IKeep3rJobFundableLiquidity\n function revokeLiquidity(address _liquidity) external override onlyGovernance {\n if (!_approvedLiquidities.remove(_liquidity)) revert LiquidityPairUnexistent();\n delete _liquidityPool[_liquidity];\n delete _isKP3RToken0[_liquidity];\n delete _tick[_liquidity];\n\n emit LiquidityRevocation(_liquidity);\n }\n\n /// @inheritdoc IKeep3rJobFundableLiquidity\n function addLiquidityToJob(\n address _job,\n address _liquidity,\n uint256 _amount\n ) external override nonReentrant {\n if (!_approvedLiquidities.contains(_liquidity)) revert LiquidityPairUnapproved();\n if (!_jobs.contains(_job)) revert JobUnavailable();\n\n _jobLiquidities[_job].add(_liquidity);\n\n _settleJobAccountance(_job);\n\n if (_quoteLiquidity(liquidityAmount[_job][_liquidity] + _amount, _liquidity) < liquidityMinimum) revert JobLiquidityLessThanMin();\n\n emit LiquidityCreditsReward(_job, rewardedAt[_job], _jobLiquidityCredits[_job], _jobPeriodCredits[_job]);\n\n IERC20(_liquidity).safeTransferFrom(msg.sender, address(this), _amount);\n liquidityAmount[_job][_liquidity] += _amount;\n _jobPeriodCredits[_job] += _getReward(_quoteLiquidity(_amount, _liquidity));\n emit LiquidityAddition(_job, _liquidity, msg.sender, _amount);\n }\n\n /// @inheritdoc IKeep3rJobFundableLiquidity\n function unbondLiquidityFromJob(\n address _job,\n address _liquidity,\n uint256 _amount\n ) external override onlyJobOwner(_job) {\n canWithdrawAfter[_job][_liquidity] = block.timestamp + unbondTime;\n pendingUnbonds[_job][_liquidity] += _amount;\n _unbondLiquidityFromJob(_job, _liquidity, _amount);\n\n uint256 _remainingLiquidity = liquidityAmount[_job][_liquidity];\n if (_remainingLiquidity > 0 && _quoteLiquidity(_remainingLiquidity, _liquidity) < liquidityMinimum) revert JobLiquidityLessThanMin();\n\n emit Unbonding(_job, _liquidity, _amount);\n }\n\n /// @inheritdoc IKeep3rJobFundableLiquidity\n function withdrawLiquidityFromJob(\n address _job,\n address _liquidity,\n address _receiver\n ) external override onlyJobOwner(_job) {\n if (_receiver == address(0)) revert ZeroAddress();\n if (pendingUnbonds[_job][_liquidity] == 0) revert UnbondsUnexistent();\n if (canWithdrawAfter[_job][_liquidity] >= block.timestamp) revert UnbondsLocked();\n if (disputes[_job]) revert Disputed();\n\n uint256 _amount = pendingUnbonds[_job][_liquidity];\n\n delete pendingUnbonds[_job][_liquidity];\n delete canWithdrawAfter[_job][_liquidity];\n\n IERC20(_liquidity).safeTransfer(_receiver, _amount);\n emit LiquidityWithdrawal(_job, _liquidity, _receiver, _amount);\n }\n\n // Internal functions\n\n /// @notice Updates or rewards job liquidity credits depending on time since last job reward\n function _updateJobCreditsIfNeeded(address _job) internal returns (bool _rewarded) {\n if (rewardedAt[_job] < _period(block.timestamp)) {\n // Will exit function if job has been rewarded in current period\n if (rewardedAt[_job] <= _period(block.timestamp - rewardPeriodTime)) {\n // Will reset job to period syncronicity if a full period passed without rewards\n _updateJobPeriod(_job);\n _jobLiquidityCredits[_job] = _jobPeriodCredits[_job];\n rewardedAt[_job] = _period(block.timestamp);\n _rewarded = true;\n } else if ((block.timestamp - rewardedAt[_job]) >= rewardPeriodTime) {\n // Will reset job's syncronicity if last reward was more than epoch ago\n _updateJobPeriod(_job);\n _jobLiquidityCredits[_job] = _jobPeriodCredits[_job];\n rewardedAt[_job] += rewardPeriodTime;\n _rewarded = true;\n } else if (workedAt[_job] < _period(block.timestamp)) {\n // First keeper on period has to update job accountance to current twaps\n uint256 previousPeriodCredits = _jobPeriodCredits[_job];\n _updateJobPeriod(_job);\n _jobLiquidityCredits[_job] = (_jobLiquidityCredits[_job] * _jobPeriodCredits[_job]) / previousPeriodCredits;\n // Updating job accountance does not reward job\n }\n }\n }\n\n /// @notice Only called if _jobLiquidityCredits < payment\n function _rewardJobCredits(address _job) internal {\n /// @notice Only way to += jobLiquidityCredits is when keeper rewarding (cannot pay work)\n /* WARNING: this allows to top up _jobLiquidityCredits to a max of 1.99 but have to spend at least 1 */\n _jobLiquidityCredits[_job] += _phase(block.timestamp - rewardedAt[_job], _jobPeriodCredits[_job]);\n rewardedAt[_job] = block.timestamp;\n }\n\n /// @notice Updates accountance for _jobPeriodCredits\n function _updateJobPeriod(address _job) internal {\n _jobPeriodCredits[_job] = _calculateJobPeriodCredits(_job);\n }\n\n /// @notice Quotes the outdated job liquidities and calculates _periodCredits\n /// @dev This function is also responsible for keeping the KP3R/WETH quote updated\n function _calculateJobPeriodCredits(address _job) internal returns (uint256 _periodCredits) {\n for (uint256 i; i < _jobLiquidities[_job].length(); i++) {\n address _liquidity = _jobLiquidities[_job].at(i);\n if (_approvedLiquidities.contains(_liquidity)) {\n if (_tick[_liquidity].period != _period(block.timestamp)) {\n // Updates liquidity cache only if needed\n _tick[_liquidity] = observeLiquidity(_liquidity);\n }\n _periodCredits += _getReward(_quoteLiquidity(liquidityAmount[_job][_liquidity], _liquidity));\n }\n }\n }\n\n /// @notice Updates job accountance calculating the impact of the unbonded liquidity amount\n function _unbondLiquidityFromJob(\n address _job,\n address _liquidity,\n uint256 _amount\n ) internal nonReentrant {\n if (!_jobLiquidities[_job].contains(_liquidity)) revert JobLiquidityUnexistent();\n if (liquidityAmount[_job][_liquidity] < _amount) revert JobLiquidityInsufficient();\n\n // Ensures current twaps in job liquidities\n _updateJobPeriod(_job);\n uint256 _periodCreditsToRemove = _getReward(_quoteLiquidity(_amount, _liquidity));\n\n // A liquidity can be revoked causing a job to have 0 periodCredits\n if (_jobPeriodCredits[_job] > 0) {\n // Removes a % correspondant to a full rewardPeriodTime for the liquidity withdrawn vs all of the liquidities\n _jobLiquidityCredits[_job] -= (_jobLiquidityCredits[_job] * _periodCreditsToRemove) / _jobPeriodCredits[_job];\n _jobPeriodCredits[_job] -= _periodCreditsToRemove;\n }\n\n liquidityAmount[_job][_liquidity] -= _amount;\n if (liquidityAmount[_job][_liquidity] == 0) {\n _jobLiquidities[_job].remove(_liquidity);\n }\n }\n\n /// @notice Returns a fraction of the multiplier or the whole multiplier if equal or more than a rewardPeriodTime has passed\n function _phase(uint256 _timePassed, uint256 _multiplier) internal view returns (uint256 _result) {\n if (_timePassed < rewardPeriodTime) {\n _result = (_timePassed * _multiplier) / rewardPeriodTime;\n } else _result = _multiplier;\n }\n\n /// @notice Returns the start of the period of the provided timestamp\n function _period(uint256 _timestamp) internal view returns (uint256 _periodTimestamp) {\n return _timestamp - (_timestamp % rewardPeriodTime);\n }\n\n /// @notice Calculates relation between rewardPeriod and inflationPeriod\n function _getReward(uint256 _baseAmount) internal view returns (uint256 _credits) {\n return FullMath.mulDiv(_baseAmount, rewardPeriodTime, inflationPeriod);\n }\n\n /// @notice Returns underlying KP3R amount for a given liquidity amount\n function _quoteLiquidity(uint256 _amount, address _liquidity) internal view returns (uint256 _quote) {\n if (_tick[_liquidity].period != 0) {\n int56 _tickDifference = _isKP3RToken0[_liquidity] ? _tick[_liquidity].difference : -_tick[_liquidity].difference;\n _quote = IKeep3rHelper(keep3rHelper).getKP3RsAtTick(_amount, _tickDifference, rewardPeriodTime);\n }\n }\n\n /// @notice Updates job credits to current quotes and rewards job's pending minted credits\n /// @dev Ensures a maximum of 1 period of credits\n function _settleJobAccountance(address _job) internal virtual {\n _updateJobCreditsIfNeeded(_job);\n _rewardJobCredits(_job);\n _jobLiquidityCredits[_job] = Math.min(_jobLiquidityCredits[_job], _jobPeriodCredits[_job]);\n }\n}\n" - }, - "solidity/contracts/peripherals/Keep3rParameters.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../../interfaces/IKeep3rHelper.sol';\nimport '../../interfaces/peripherals/IKeep3rParameters.sol';\nimport '../../interfaces/external/IKeep3rV1Proxy.sol';\nimport './Keep3rAccountance.sol';\n\nabstract contract Keep3rParameters is IKeep3rParameters, Keep3rAccountance {\n /// @inheritdoc IKeep3rParameters\n address public override keep3rV1;\n\n /// @inheritdoc IKeep3rParameters\n address public override keep3rV1Proxy;\n\n /// @inheritdoc IKeep3rParameters\n address public override keep3rHelper;\n\n /// @inheritdoc IKeep3rParameters\n uint256 public override bondTime = 3 days;\n\n /// @inheritdoc IKeep3rParameters\n uint256 public override unbondTime = 14 days;\n\n /// @inheritdoc IKeep3rParameters\n uint256 public override liquidityMinimum = 3 ether;\n\n /// @inheritdoc IKeep3rParameters\n uint256 public override rewardPeriodTime = 5 days;\n\n /// @inheritdoc IKeep3rParameters\n uint256 public override inflationPeriod = 34 days;\n\n /// @inheritdoc IKeep3rParameters\n uint256 public override fee = 30;\n\n /// @notice The base that will be used to calculate the fee\n uint256 internal constant _BASE = 10_000;\n\n /// @notice The minimum reward period\n uint256 internal constant _MIN_REWARD_PERIOD_TIME = 1 days;\n\n constructor(\n address _keep3rHelper,\n address _keep3rV1,\n address _keep3rV1Proxy\n ) {\n keep3rHelper = _keep3rHelper;\n keep3rV1 = _keep3rV1;\n keep3rV1Proxy = _keep3rV1Proxy;\n }\n\n /// @inheritdoc IKeep3rParameters\n function setKeep3rHelper(address _keep3rHelper) external override onlyGovernance {\n if (_keep3rHelper == address(0)) revert ZeroAddress();\n keep3rHelper = _keep3rHelper;\n emit Keep3rHelperChange(_keep3rHelper);\n }\n\n /// @inheritdoc IKeep3rParameters\n function setKeep3rV1(address _keep3rV1) public virtual override onlyGovernance {\n if (_keep3rV1 == address(0)) revert ZeroAddress();\n _mint(totalBonds);\n\n keep3rV1 = _keep3rV1;\n emit Keep3rV1Change(_keep3rV1);\n }\n\n /// @inheritdoc IKeep3rParameters\n function setKeep3rV1Proxy(address _keep3rV1Proxy) external override onlyGovernance {\n if (_keep3rV1Proxy == address(0)) revert ZeroAddress();\n keep3rV1Proxy = _keep3rV1Proxy;\n emit Keep3rV1ProxyChange(_keep3rV1Proxy);\n }\n\n /// @inheritdoc IKeep3rParameters\n function setBondTime(uint256 _bondTime) external override onlyGovernance {\n bondTime = _bondTime;\n emit BondTimeChange(_bondTime);\n }\n\n /// @inheritdoc IKeep3rParameters\n function setUnbondTime(uint256 _unbondTime) external override onlyGovernance {\n unbondTime = _unbondTime;\n emit UnbondTimeChange(_unbondTime);\n }\n\n /// @inheritdoc IKeep3rParameters\n function setLiquidityMinimum(uint256 _liquidityMinimum) external override onlyGovernance {\n liquidityMinimum = _liquidityMinimum;\n emit LiquidityMinimumChange(_liquidityMinimum);\n }\n\n /// @inheritdoc IKeep3rParameters\n function setRewardPeriodTime(uint256 _rewardPeriodTime) external override onlyGovernance {\n if (_rewardPeriodTime < _MIN_REWARD_PERIOD_TIME) revert MinRewardPeriod();\n rewardPeriodTime = _rewardPeriodTime;\n emit RewardPeriodTimeChange(_rewardPeriodTime);\n }\n\n /// @inheritdoc IKeep3rParameters\n function setInflationPeriod(uint256 _inflationPeriod) external override onlyGovernance {\n inflationPeriod = _inflationPeriod;\n emit InflationPeriodChange(_inflationPeriod);\n }\n\n /// @inheritdoc IKeep3rParameters\n function setFee(uint256 _fee) external override onlyGovernance {\n fee = _fee;\n emit FeeChange(_fee);\n }\n\n function _mint(uint256 _amount) internal {\n totalBonds -= _amount;\n IKeep3rV1Proxy(keep3rV1Proxy).mint(_amount);\n }\n}\n" - }, - "@openzeppelin/contracts/security/ReentrancyGuard.sol": { - "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Contract module that helps prevent reentrant calls to a function.\n *\n * Inheriting from `ReentrancyGuard` will make the {nonReentrant} modifier\n * available, which can be applied to functions to make sure there are no nested\n * (reentrant) calls to them.\n *\n * Note that because there is a single `nonReentrant` guard, functions marked as\n * `nonReentrant` may not call one another. This can be worked around by making\n * those functions `private`, and then adding `external` `nonReentrant` entry\n * points to them.\n *\n * TIP: If you would like to learn more about reentrancy and alternative ways\n * to protect against it, check out our blog post\n * https://blog.openzeppelin.com/reentrancy-after-istanbul/[Reentrancy After Istanbul].\n */\nabstract contract ReentrancyGuard {\n // Booleans are more expensive than uint256 or any type that takes up a full\n // word because each write operation emits an extra SLOAD to first read the\n // slot's contents, replace the bits taken up by the boolean, and then write\n // back. This is the compiler's defense against contract upgrades and\n // pointer aliasing, and it cannot be disabled.\n\n // The values being non-zero value makes deployment a bit more expensive,\n // but in exchange the refund on every call to nonReentrant will be lower in\n // amount. Since refunds are capped to a percentage of the total\n // transaction's gas, it is best to keep them low in cases like this one, to\n // increase the likelihood of the full refund coming into effect.\n uint256 private constant _NOT_ENTERED = 1;\n uint256 private constant _ENTERED = 2;\n\n uint256 private _status;\n\n constructor() {\n _status = _NOT_ENTERED;\n }\n\n /**\n * @dev Prevents a contract from calling itself, directly or indirectly.\n * Calling a `nonReentrant` function from another `nonReentrant`\n * function is not supported. It is possible to prevent this from happening\n * by making the `nonReentrant` function external, and make it call a\n * `private` function that does the actual work.\n */\n modifier nonReentrant() {\n // On the first call to nonReentrant, _notEntered will be true\n require(_status != _ENTERED, \"ReentrancyGuard: reentrant call\");\n\n // Any calls to nonReentrant after this point will fail\n _status = _ENTERED;\n\n _;\n\n // By storing the original value once again, a refund is triggered (see\n // https://eips.ethereum.org/EIPS/eip-2200)\n _status = _NOT_ENTERED;\n }\n}\n" - }, - "@openzeppelin/contracts/utils/math/Math.sol": { - "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Standard math utilities missing in the Solidity language.\n */\nlibrary Math {\n /**\n * @dev Returns the largest of two numbers.\n */\n function max(uint256 a, uint256 b) internal pure returns (uint256) {\n return a >= b ? a : b;\n }\n\n /**\n * @dev Returns the smallest of two numbers.\n */\n function min(uint256 a, uint256 b) internal pure returns (uint256) {\n return a < b ? a : b;\n }\n\n /**\n * @dev Returns the average of two numbers. The result is rounded towards\n * zero.\n */\n function average(uint256 a, uint256 b) internal pure returns (uint256) {\n // (a + b) / 2 can overflow.\n return (a & b) + (a ^ b) / 2;\n }\n\n /**\n * @dev Returns the ceiling of the division of two numbers.\n *\n * This differs from standard division with `/` in that it rounds up instead\n * of rounding down.\n */\n function ceilDiv(uint256 a, uint256 b) internal pure returns (uint256) {\n // (a + b - 1) / b can overflow on addition, so we distribute.\n return a / b + (a % b == 0 ? 0 : 1);\n }\n}\n" - }, - "solidity/interfaces/external/IKeep3rV1Proxy.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../peripherals/IGovernable.sol';\n\ninterface IKeep3rV1Proxy is IGovernable {\n // Structs\n struct Recipient {\n address recipient;\n uint256 caps;\n }\n\n // Variables\n function keep3rV1() external view returns (address);\n\n function minter() external view returns (address);\n\n function next(address) external view returns (uint256);\n\n function caps(address) external view returns (uint256);\n\n function recipients() external view returns (address[] memory);\n\n function recipientsCaps() external view returns (Recipient[] memory);\n\n // Errors\n error Cooldown();\n error NoDrawableAmount();\n error ZeroAddress();\n error OnlyMinter();\n\n // Methods\n function addRecipient(address recipient, uint256 amount) external;\n\n function removeRecipient(address recipient) external;\n\n function draw() external returns (uint256 _amount);\n\n function setKeep3rV1(address _keep3rV1) external;\n\n function setMinter(address _minter) external;\n\n function mint(uint256 _amount) external;\n\n function mint(address _account, uint256 _amount) external;\n\n function setKeep3rV1Governance(address _governance) external;\n\n function acceptKeep3rV1Governance() external;\n\n function dispute(address _keeper) external;\n\n function slash(\n address _bonded,\n address _keeper,\n uint256 _amount\n ) external;\n\n function revoke(address _keeper) external;\n\n function resolve(address _keeper) external;\n\n function addJob(address _job) external;\n\n function removeJob(address _job) external;\n\n function addKPRCredit(address _job, uint256 _amount) external;\n\n function approveLiquidity(address _liquidity) external;\n\n function revokeLiquidity(address _liquidity) external;\n\n function setKeep3rHelper(address _keep3rHelper) external;\n\n function addVotes(address _voter, uint256 _amount) external;\n\n function removeVotes(address _voter, uint256 _amount) external;\n}\n" - }, - "solidity/interfaces/IKeep3rHelperParameters.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\n/// @title Keep3rHelperParameters contract\n/// @notice Contains all the helper functions used throughout the different files.\ninterface IKeep3rHelperParameters {\n // Structs\n\n /// @dev KP3R-WETH Pool address and isKP3RToken0\n /// @dev Created in order to save gas by avoiding calls to pool's token0 method\n struct TokenOraclePool {\n address poolAddress;\n bool isTKNToken0;\n }\n\n // Errors\n\n /// @notice Throws when pool does not have KP3R as token0 nor token1\n error InvalidOraclePool();\n\n // Events\n\n /// @notice Emitted when the kp3r weth pool is changed\n /// @param _address Address of the new kp3r weth pool\n /// @param _isKP3RToken0 True if calling the token0 method of the pool returns the KP3R token address\n event Kp3rWethPoolChange(address _address, bool _isKP3RToken0);\n\n /// @notice Emitted when the minimum boost multiplier is changed\n /// @param _minBoost The minimum boost multiplier\n event MinBoostChange(uint256 _minBoost);\n\n /// @notice Emitted when the maximum boost multiplier is changed\n /// @param _maxBoost The maximum boost multiplier\n event MaxBoostChange(uint256 _maxBoost);\n\n /// @notice Emitted when the target bond amount is changed\n /// @param _targetBond The target bond amount\n event TargetBondChange(uint256 _targetBond);\n\n /// @notice Emitted when the Keep3r V2 address is changed\n /// @param _keep3rV2 The address of Keep3r V2\n event Keep3rV2Change(address _keep3rV2);\n\n /// @notice Emitted when the work extra gas amount is changed\n /// @param _workExtraGas The work extra gas\n event WorkExtraGasChange(uint256 _workExtraGas);\n\n /// @notice Emitted when the quote twap time is changed\n /// @param _quoteTwapTime The twap time for quoting\n event QuoteTwapTimeChange(uint32 _quoteTwapTime);\n\n /// @notice Emitted when minimum rewarded gas fee is changed\n /// @param _minBaseFee The minimum rewarded gas fee\n event MinBaseFeeChange(uint256 _minBaseFee);\n\n /// @notice Emitted when minimum rewarded priority fee is changed\n /// @param _minPriorityFee The minimum expected fee that the keeper should pay\n event MinPriorityFeeChange(uint256 _minPriorityFee);\n\n // Variables\n\n /// @notice Address of KP3R token\n /// @return _kp3r Address of KP3R token\n // solhint-disable func-name-mixedcase\n function KP3R() external view returns (address _kp3r);\n\n /// @notice The boost base used to calculate the boost rewards for the keeper\n /// @return _base The boost base number\n function BOOST_BASE() external view returns (uint256 _base);\n\n /// @notice KP3R-WETH pool that is being used as oracle\n /// @return poolAddress Address of the pool\n /// @return isTKNToken0 True if calling the token0 method of the pool returns the KP3R token address\n function kp3rWethPool() external view returns (address poolAddress, bool isTKNToken0);\n\n /// @notice The minimum multiplier used to calculate the amount of gas paid to the Keeper for the gas used to perform a job\n /// For example: if the quoted gas used is 1000, then the minimum amount to be paid will be 1000 * minBoost / BOOST_BASE\n /// @return _multiplier The minimum boost multiplier\n function minBoost() external view returns (uint256 _multiplier);\n\n /// @notice The maximum multiplier used to calculate the amount of gas paid to the Keeper for the gas used to perform a job\n /// For example: if the quoted gas used is 1000, then the maximum amount to be paid will be 1000 * maxBoost / BOOST_BASE\n /// @return _multiplier The maximum boost multiplier\n function maxBoost() external view returns (uint256 _multiplier);\n\n /// @notice The targeted amount of bonded KP3Rs to max-up reward multiplier\n /// For example: if the amount of KP3R the keeper has bonded is targetBond or more, then the keeper will get\n /// the maximum boost possible in his rewards, if it's less, the reward boost will be proportional\n /// @return _target The amount of KP3R that comforms the targetBond\n function targetBond() external view returns (uint256 _target);\n\n /// @notice The amount of unaccounted gas that is going to be added to keeper payments\n /// @return _workExtraGas The work unaccounted gas amount\n function workExtraGas() external view returns (uint256 _workExtraGas);\n\n /// @notice The twap time for quoting\n /// @return _quoteTwapTime The twap time\n function quoteTwapTime() external view returns (uint32 _quoteTwapTime);\n\n /// @notice The minimum base fee that is used to calculate keeper rewards\n /// @return _minBaseFee The minimum rewarded gas fee\n function minBaseFee() external view returns (uint256 _minBaseFee);\n\n /// @notice The minimum priority fee that is also rewarded for keepers\n /// @return _minPriorityFee The minimum rewarded priority fee\n function minPriorityFee() external view returns (uint256 _minPriorityFee);\n\n /// @notice Address of Keep3r V2\n /// @return _keep3rV2 Address of Keep3r V2\n function keep3rV2() external view returns (address _keep3rV2);\n\n // Methods\n\n /// @notice Sets KP3R-WETH pool\n /// @param _poolAddress The address of the KP3R-WETH pool\n function setKp3rWethPool(address _poolAddress) external;\n\n /// @notice Sets the minimum boost multiplier\n /// @param _minBoost The minimum boost multiplier\n function setMinBoost(uint256 _minBoost) external;\n\n /// @notice Sets the maximum boost multiplier\n /// @param _maxBoost The maximum boost multiplier\n function setMaxBoost(uint256 _maxBoost) external;\n\n /// @notice Sets the target bond amount\n /// @param _targetBond The target bond amount\n function setTargetBond(uint256 _targetBond) external;\n\n /// @notice Sets the Keep3r V2 address\n /// @param _keep3rV2 The address of Keep3r V2\n function setKeep3rV2(address _keep3rV2) external;\n\n /// @notice Sets the work extra gas amount\n /// @param _workExtraGas The work extra gas\n function setWorkExtraGas(uint256 _workExtraGas) external;\n\n /// @notice Sets the quote twap time\n /// @param _quoteTwapTime The twap time for quoting\n function setQuoteTwapTime(uint32 _quoteTwapTime) external;\n\n /// @notice Sets the minimum rewarded gas fee\n /// @param _minBaseFee The minimum rewarded gas fee\n function setMinBaseFee(uint256 _minBaseFee) external;\n\n /// @notice Sets the minimum rewarded gas priority fee\n /// @param _minPriorityFee The minimum rewarded priority fee\n function setMinPriorityFee(uint256 _minPriorityFee) external;\n}\n" - }, - "solidity/interfaces/IPairManager.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol';\n\n/// @title Pair Manager interface\n/// @notice Generic interface for Keep3r liquidity pools (kLP)\ninterface IPairManager is IERC20Metadata {\n /// @notice Address of the factory from which the pair manager was created\n /// @return _factory The address of the PairManager Factory\n function factory() external view returns (address _factory);\n\n /// @notice Address of the pool from which the Keep3r pair manager will interact with\n /// @return _pool The address of the pool\n function pool() external view returns (address _pool);\n\n /// @notice Token0 of the pool\n /// @return _token0 The address of token0\n function token0() external view returns (address _token0);\n\n /// @notice Token1 of the pool\n /// @return _token1 The address of token1\n function token1() external view returns (address _token1);\n}\n" - }, - "solidity/contracts/libraries/FullMath.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\n/// @title Contains 512-bit math functions\n/// @notice Facilitates multiplication and division that can have overflow of an intermediate value without any loss of precision\n/// @dev Handles \"phantom overflow\" i.e., allows multiplication and division where an intermediate value overflows 256 bits\nlibrary FullMath {\n /// @notice Calculates floor(a×b÷denominator) with full precision. Throws if result overflows a uint256 or denominator == 0\n /// @param a The multiplicand\n /// @param b The multiplier\n /// @param denominator The divisor\n /// @return result The 256-bit result\n /// @dev Credit to Remco Bloemen under MIT license https://xn--2-umb.com/21/muldiv\n function mulDiv(\n uint256 a,\n uint256 b,\n uint256 denominator\n ) internal pure returns (uint256 result) {\n unchecked {\n // 512-bit multiply [prod1 prod0] = a * b\n // Compute the product mod 2**256 and mod 2**256 - 1\n // then use the Chinese Remainder Theorem to reconstruct\n // the 512 bit result. The result is stored in two 256\n // variables such that product = prod1 * 2**256 + prod0\n uint256 prod0; // Least significant 256 bits of the product\n uint256 prod1; // Most significant 256 bits of the product\n assembly {\n let mm := mulmod(a, b, not(0))\n prod0 := mul(a, b)\n prod1 := sub(sub(mm, prod0), lt(mm, prod0))\n }\n\n // Handle non-overflow cases, 256 by 256 division\n if (prod1 == 0) {\n require(denominator > 0);\n assembly {\n result := div(prod0, denominator)\n }\n return result;\n }\n\n // Make sure the result is less than 2**256.\n // Also prevents denominator == 0\n require(denominator > prod1);\n\n ///////////////////////////////////////////////\n // 512 by 256 division.\n ///////////////////////////////////////////////\n\n // Make division exact by subtracting the remainder from [prod1 prod0]\n // Compute remainder using mulmod\n uint256 remainder;\n assembly {\n remainder := mulmod(a, b, denominator)\n }\n // Subtract 256 bit number from 512 bit number\n assembly {\n prod1 := sub(prod1, gt(remainder, prod0))\n prod0 := sub(prod0, remainder)\n }\n\n // Factor powers of two out of denominator\n // Compute largest power of two divisor of denominator.\n // Always >= 1.\n uint256 twos = (~denominator + 1) & denominator;\n // Divide denominator by power of two\n assembly {\n denominator := div(denominator, twos)\n }\n\n // Divide [prod1 prod0] by the factors of two\n assembly {\n prod0 := div(prod0, twos)\n }\n // Shift in bits from prod1 into prod0. For this we need\n // to flip `twos` such that it is 2**256 / twos.\n // If twos is zero, then it becomes one\n assembly {\n twos := add(div(sub(0, twos), twos), 1)\n }\n prod0 |= prod1 * twos;\n\n // Invert denominator mod 2**256\n // Now that denominator is an odd number, it has an inverse\n // modulo 2**256 such that denominator * inv = 1 mod 2**256.\n // Compute the inverse by starting with a seed that is correct\n // correct for four bits. That is, denominator * inv = 1 mod 2**4\n uint256 inv = (3 * denominator) ^ 2;\n // Now use Newton-Raphson iteration to improve the precision.\n // Thanks to Hensel's lifting lemma, this also works in modular\n // arithmetic, doubling the correct bits in each step.\n inv *= 2 - denominator * inv; // inverse mod 2**8\n inv *= 2 - denominator * inv; // inverse mod 2**16\n inv *= 2 - denominator * inv; // inverse mod 2**32\n inv *= 2 - denominator * inv; // inverse mod 2**64\n inv *= 2 - denominator * inv; // inverse mod 2**128\n inv *= 2 - denominator * inv; // inverse mod 2**256\n\n // Because the division is now exact we can divide by multiplying\n // with the modular inverse of denominator. This will give us the\n // correct result modulo 2**256. Since the precoditions guarantee\n // that the outcome is less than 2**256, this is the final result.\n // We don't need to compute the high bits of the result and prod1\n // is no longer required.\n result = prod0 * inv;\n return result;\n }\n }\n\n /// @notice Calculates ceil(a×b÷denominator) with full precision. Throws if result overflows a uint256 or denominator == 0\n /// @param a The multiplicand\n /// @param b The multiplier\n /// @param denominator The divisor\n /// @return result The 256-bit result\n function mulDivRoundingUp(\n uint256 a,\n uint256 b,\n uint256 denominator\n ) internal pure returns (uint256 result) {\n unchecked {\n result = mulDiv(a, b, denominator);\n if (mulmod(a, b, denominator) > 0) {\n require(result < type(uint256).max);\n result++;\n }\n }\n }\n}\n" - }, - "@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol": { - "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\nimport \"../IERC20.sol\";\n\n/**\n * @dev Interface for the optional metadata functions from the ERC20 standard.\n *\n * _Available since v4.1._\n */\ninterface IERC20Metadata is IERC20 {\n /**\n * @dev Returns the name of the token.\n */\n function name() external view returns (string memory);\n\n /**\n * @dev Returns the symbol of the token.\n */\n function symbol() external view returns (string memory);\n\n /**\n * @dev Returns the decimals places of the token.\n */\n function decimals() external view returns (uint8);\n}\n" - }, - "solidity/contracts/peripherals/Keep3rDisputable.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport './Keep3rParameters.sol';\nimport '../../interfaces/peripherals/IKeep3rDisputable.sol';\n\nabstract contract Keep3rDisputable is IKeep3rDisputable, Keep3rParameters {\n /// @inheritdoc IKeep3rDisputable\n function dispute(address _jobOrKeeper) external override onlyDisputer {\n if (disputes[_jobOrKeeper]) revert AlreadyDisputed();\n disputes[_jobOrKeeper] = true;\n emit Dispute(_jobOrKeeper, msg.sender);\n }\n\n /// @inheritdoc IKeep3rDisputable\n function resolve(address _jobOrKeeper) external override onlyDisputer {\n if (!disputes[_jobOrKeeper]) revert NotDisputed();\n disputes[_jobOrKeeper] = false;\n emit Resolve(_jobOrKeeper, msg.sender);\n }\n}\n" - }, - "solidity/contracts/peripherals/keepers/Keep3rKeeperDisputable.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport './Keep3rKeeperFundable.sol';\nimport '../Keep3rDisputable.sol';\nimport '../../../interfaces/external/IKeep3rV1.sol';\nimport '../../../interfaces/peripherals/IKeep3rKeepers.sol';\n\nabstract contract Keep3rKeeperDisputable is IKeep3rKeeperDisputable, Keep3rDisputable, Keep3rKeeperFundable {\n using EnumerableSet for EnumerableSet.AddressSet;\n using SafeERC20 for IERC20;\n\n /// @inheritdoc IKeep3rKeeperDisputable\n function slash(\n address _keeper,\n address _bonded,\n uint256 _bondAmount,\n uint256 _unbondAmount\n ) external override onlySlasher {\n if (!disputes[_keeper]) revert NotDisputed();\n _slash(_keeper, _bonded, _bondAmount, _unbondAmount);\n emit KeeperSlash(_keeper, msg.sender, _bondAmount + _unbondAmount);\n }\n\n /// @inheritdoc IKeep3rKeeperDisputable\n function revoke(address _keeper) external override onlySlasher {\n if (!disputes[_keeper]) revert NotDisputed();\n _keepers.remove(_keeper);\n _slash(_keeper, keep3rV1, bonds[_keeper][keep3rV1], pendingUnbonds[_keeper][keep3rV1]);\n emit KeeperRevoke(_keeper, msg.sender);\n }\n\n function _slash(\n address _keeper,\n address _bonded,\n uint256 _bondAmount,\n uint256 _unbondAmount\n ) internal {\n if (_bonded != keep3rV1) {\n try IERC20(_bonded).transfer(governance, _bondAmount + _unbondAmount) returns (bool) {} catch (bytes memory) {}\n }\n bonds[_keeper][_bonded] -= _bondAmount;\n pendingUnbonds[_keeper][_bonded] -= _unbondAmount;\n }\n}\n" - }, - "solidity/contracts/peripherals/keepers/Keep3rKeeperFundable.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../Keep3rAccountance.sol';\nimport '../Keep3rParameters.sol';\nimport '../../../interfaces/peripherals/IKeep3rKeepers.sol';\n\nimport '../../../interfaces/external/IKeep3rV1.sol';\n\nimport '@openzeppelin/contracts/security/ReentrancyGuard.sol';\nimport '@openzeppelin/contracts/token/ERC20/IERC20.sol';\nimport '@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol';\n\nabstract contract Keep3rKeeperFundable is IKeep3rKeeperFundable, ReentrancyGuard, Keep3rParameters {\n using EnumerableSet for EnumerableSet.AddressSet;\n using SafeERC20 for IERC20;\n\n /// @inheritdoc IKeep3rKeeperFundable\n function bond(address _bonding, uint256 _amount) external override nonReentrant {\n if (disputes[msg.sender]) revert Disputed();\n if (_jobs.contains(msg.sender)) revert AlreadyAJob();\n canActivateAfter[msg.sender][_bonding] = block.timestamp + bondTime;\n\n uint256 _before = IERC20(_bonding).balanceOf(address(this));\n IERC20(_bonding).safeTransferFrom(msg.sender, address(this), _amount);\n _amount = IERC20(_bonding).balanceOf(address(this)) - _before;\n\n hasBonded[msg.sender] = true;\n pendingBonds[msg.sender][_bonding] += _amount;\n\n emit Bonding(msg.sender, _bonding, _amount);\n }\n\n /// @inheritdoc IKeep3rKeeperFundable\n function activate(address _bonding) external override {\n address _keeper = msg.sender;\n if (disputes[_keeper]) revert Disputed();\n uint256 _canActivateAfter = canActivateAfter[_keeper][_bonding];\n if (_canActivateAfter == 0) revert BondsUnexistent();\n if (_canActivateAfter >= block.timestamp) revert BondsLocked();\n\n if (firstSeen[_keeper] == 0) {\n firstSeen[_keeper] = block.timestamp;\n }\n _keepers.add(_keeper);\n\n uint256 _amount = pendingBonds[_keeper][_bonding];\n delete pendingBonds[_keeper][_bonding];\n\n // bond provided tokens\n bonds[_keeper][_bonding] += _amount;\n if (_bonding == keep3rV1) {\n totalBonds += _amount;\n _depositBonds(_amount);\n }\n\n emit Activation(_keeper, _bonding, _amount);\n }\n\n /// @inheritdoc IKeep3rKeeperFundable\n function unbond(address _bonding, uint256 _amount) external override {\n canWithdrawAfter[msg.sender][_bonding] = block.timestamp + unbondTime;\n bonds[msg.sender][_bonding] -= _amount;\n pendingUnbonds[msg.sender][_bonding] += _amount;\n\n emit Unbonding(msg.sender, _bonding, _amount);\n }\n\n /// @inheritdoc IKeep3rKeeperFundable\n function withdraw(address _bonding) external override nonReentrant {\n if (pendingUnbonds[msg.sender][_bonding] == 0) revert UnbondsUnexistent();\n if (canWithdrawAfter[msg.sender][_bonding] >= block.timestamp) revert UnbondsLocked();\n if (disputes[msg.sender]) revert Disputed();\n\n uint256 _amount = pendingUnbonds[msg.sender][_bonding];\n\n delete pendingUnbonds[msg.sender][_bonding];\n delete canWithdrawAfter[msg.sender][_bonding];\n\n if (_bonding == keep3rV1) _mint(_amount);\n IERC20(_bonding).safeTransfer(msg.sender, _amount);\n\n emit Withdrawal(msg.sender, _bonding, _amount);\n }\n\n function _depositBonds(uint256 _amount) internal virtual {\n IKeep3rV1(keep3rV1).burn(_amount);\n }\n}\n" - }, - "solidity/interfaces/external/IKeep3rV1.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '@openzeppelin/contracts/token/ERC20/IERC20.sol';\nimport '@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol';\n\n// solhint-disable func-name-mixedcase\ninterface IKeep3rV1 is IERC20, IERC20Metadata {\n // Structs\n struct Checkpoint {\n uint32 fromBlock;\n uint256 votes;\n }\n\n // Events\n event DelegateChanged(address indexed _delegator, address indexed _fromDelegate, address indexed _toDelegate);\n event DelegateVotesChanged(address indexed _delegate, uint256 _previousBalance, uint256 _newBalance);\n event SubmitJob(address indexed _job, address indexed _liquidity, address indexed _provider, uint256 _block, uint256 _credit);\n event ApplyCredit(address indexed _job, address indexed _liquidity, address indexed _provider, uint256 _block, uint256 _credit);\n event RemoveJob(address indexed _job, address indexed _liquidity, address indexed _provider, uint256 _block, uint256 _credit);\n event UnbondJob(address indexed _job, address indexed _liquidity, address indexed _provider, uint256 _block, uint256 _credit);\n event JobAdded(address indexed _job, uint256 _block, address _governance);\n event JobRemoved(address indexed _job, uint256 _block, address _governance);\n event KeeperWorked(address indexed _credit, address indexed _job, address indexed _keeper, uint256 _block, uint256 _amount);\n event KeeperBonding(address indexed _keeper, uint256 _block, uint256 _active, uint256 _bond);\n event KeeperBonded(address indexed _keeper, uint256 _block, uint256 _activated, uint256 _bond);\n event KeeperUnbonding(address indexed _keeper, uint256 _block, uint256 _deactive, uint256 _bond);\n event KeeperUnbound(address indexed _keeper, uint256 _block, uint256 _deactivated, uint256 _bond);\n event KeeperSlashed(address indexed _keeper, address indexed _slasher, uint256 _block, uint256 _slash);\n event KeeperDispute(address indexed _keeper, uint256 _block);\n event KeeperResolved(address indexed _keeper, uint256 _block);\n event TokenCreditAddition(address indexed _credit, address indexed _job, address indexed _creditor, uint256 _block, uint256 _amount);\n\n // Variables\n function KPRH() external returns (address);\n\n function delegates(address _delegator) external view returns (address);\n\n function checkpoints(address _account, uint32 _checkpoint) external view returns (Checkpoint memory);\n\n function numCheckpoints(address _account) external view returns (uint32);\n\n function DOMAIN_TYPEHASH() external returns (bytes32);\n\n function DOMAINSEPARATOR() external returns (bytes32);\n\n function DELEGATION_TYPEHASH() external returns (bytes32);\n\n function PERMIT_TYPEHASH() external returns (bytes32);\n\n function nonces(address _user) external view returns (uint256);\n\n function BOND() external returns (uint256);\n\n function UNBOND() external returns (uint256);\n\n function LIQUIDITYBOND() external returns (uint256);\n\n function FEE() external returns (uint256);\n\n function BASE() external returns (uint256);\n\n function ETH() external returns (address);\n\n function bondings(address _user, address _bonding) external view returns (uint256);\n\n function canWithdrawAfter(address _user, address _bonding) external view returns (uint256);\n\n function pendingUnbonds(address _keeper, address _bonding) external view returns (uint256);\n\n function pendingbonds(address _keeper, address _bonding) external view returns (uint256);\n\n function bonds(address _keeper, address _bonding) external view returns (uint256);\n\n function votes(address _delegator) external view returns (uint256);\n\n function firstSeen(address _keeper) external view returns (uint256);\n\n function disputes(address _keeper) external view returns (bool);\n\n function lastJob(address _keeper) external view returns (uint256);\n\n function workCompleted(address _keeper) external view returns (uint256);\n\n function jobs(address _job) external view returns (bool);\n\n function credits(address _job, address _credit) external view returns (uint256);\n\n function liquidityProvided(\n address _provider,\n address _liquidity,\n address _job\n ) external view returns (uint256);\n\n function liquidityUnbonding(\n address _provider,\n address _liquidity,\n address _job\n ) external view returns (uint256);\n\n function liquidityAmountsUnbonding(\n address _provider,\n address _liquidity,\n address _job\n ) external view returns (uint256);\n\n function jobProposalDelay(address _job) external view returns (uint256);\n\n function liquidityApplied(\n address _provider,\n address _liquidity,\n address _job\n ) external view returns (uint256);\n\n function liquidityAmount(\n address _provider,\n address _liquidity,\n address _job\n ) external view returns (uint256);\n\n function keepers(address _keeper) external view returns (bool);\n\n function blacklist(address _keeper) external view returns (bool);\n\n function keeperList(uint256 _index) external view returns (address);\n\n function jobList(uint256 _index) external view returns (address);\n\n function governance() external returns (address);\n\n function pendingGovernance() external returns (address);\n\n function liquidityAccepted(address _liquidity) external view returns (bool);\n\n function liquidityPairs(uint256 _index) external view returns (address);\n\n // Methods\n function getCurrentVotes(address _account) external view returns (uint256);\n\n function addCreditETH(address _job) external payable;\n\n function addCredit(\n address _credit,\n address _job,\n uint256 _amount\n ) external;\n\n function addVotes(address _voter, uint256 _amount) external;\n\n function removeVotes(address _voter, uint256 _amount) external;\n\n function addKPRCredit(address _job, uint256 _amount) external;\n\n function approveLiquidity(address _liquidity) external;\n\n function revokeLiquidity(address _liquidity) external;\n\n function pairs() external view returns (address[] memory);\n\n function addLiquidityToJob(\n address _liquidity,\n address _job,\n uint256 _amount\n ) external;\n\n function applyCreditToJob(\n address _provider,\n address _liquidity,\n address _job\n ) external;\n\n function unbondLiquidityFromJob(\n address _liquidity,\n address _job,\n uint256 _amount\n ) external;\n\n function removeLiquidityFromJob(address _liquidity, address _job) external;\n\n function mint(uint256 _amount) external;\n\n function burn(uint256 _amount) external;\n\n function worked(address _keeper) external;\n\n function receipt(\n address _credit,\n address _keeper,\n uint256 _amount\n ) external;\n\n function receiptETH(address _keeper, uint256 _amount) external;\n\n function addJob(address _job) external;\n\n function getJobs() external view returns (address[] memory);\n\n function removeJob(address _job) external;\n\n function setKeep3rHelper(address _keep3rHelper) external;\n\n function setGovernance(address _governance) external;\n\n function acceptGovernance() external;\n\n function isKeeper(address _keeper) external returns (bool);\n\n function isMinKeeper(\n address _keeper,\n uint256 _minBond,\n uint256 _earned,\n uint256 _age\n ) external returns (bool);\n\n function isBondedKeeper(\n address _keeper,\n address _bond,\n uint256 _minBond,\n uint256 _earned,\n uint256 _age\n ) external returns (bool);\n\n function bond(address _bonding, uint256 _amount) external;\n\n function getKeepers() external view returns (address[] memory);\n\n function activate(address _bonding) external;\n\n function unbond(address _bonding, uint256 _amount) external;\n\n function slash(\n address _bonded,\n address _keeper,\n uint256 _amount\n ) external;\n\n function withdraw(address _bonding) external;\n\n function dispute(address _keeper) external;\n\n function revoke(address _keeper) external;\n\n function resolve(address _keeper) external;\n\n function permit(\n address _owner,\n address _spender,\n uint256 _amount,\n uint256 _deadline,\n uint8 _v,\n bytes32 _r,\n bytes32 _s\n ) external;\n}\n" - }, - "solidity/for-test/testnet/Keep3rForTestnet.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../../contracts/Keep3r.sol';\n\ncontract Keep3rForTestnet is Keep3r {\n constructor(\n address _governance,\n address _keep3rHelper,\n address _keep3rV1,\n address _keep3rV1Proxy\n ) Keep3r(_governance, _keep3rHelper, _keep3rV1, _keep3rV1Proxy) {\n bondTime = 0; // allows keepers to instantly register\n unbondTime = 0; // allows keepers & jobOwners to instantly withdraw funds\n liquidityMinimum = 1; // allows job providers to add low liquidity\n rewardPeriodTime = 1 days; // reduces twap calculation period\n inflationPeriod = 5 days; // increases credit minting\n }\n}\n" - }, - "solidity/for-test/Keep3rForTest.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../contracts/Keep3r.sol';\n\ncontract Keep3rForTest is Keep3r {\n constructor(\n address _governance,\n address _keep3rHelper,\n address _keep3rV1,\n address _keep3rV1Proxy\n ) Keep3r(_governance, _keep3rHelper, _keep3rV1, _keep3rV1Proxy) {}\n}\n" - }, - "solidity/contracts/sidechain/Keep3rSidechain.sol": { - "content": "// SPDX-License-Identifier: MIT\n\n/*\n\nCoded for The Keep3r Network with ♥ by\n\n██████╗░███████╗███████╗██╗░░░██╗░░░░░░░██╗░█████╗░███╗░░██╗██████╗░███████╗██████╗░██╗░░░░░░█████╗░███╗░░██╗██████╗░\n██╔══██╗██╔════╝██╔════╝██║░░░██║░░██╗░░██║██╔══██╗████╗░██║██╔══██╗██╔════╝██╔══██╗██║░░░░░██╔══██╗████╗░██║██╔══██╗\n██║░░██║█████╗░░█████╗░░██║░░░╚██╗████╗██╔╝██║░░██║██╔██╗██║██║░░██║█████╗░░██████╔╝██║░░░░░███████║██╔██╗██║██║░░██║\n██║░░██║██╔══╝░░██╔══╝░░██║░░░░████╔═████║░██║░░██║██║╚████║██║░░██║██╔══╝░░██╔══██╗██║░░░░░██╔══██║██║╚████║██║░░██║\n██████╔╝███████╗██║░░░░░██║░░░░╚██╔╝░╚██╔╝░╚█████╔╝██║░╚███║██████╔╝███████╗██║░░██║███████╗██║░░██║██║░╚███║██████╔╝\n╚═════╝░╚══════╝╚═╝░░░░░╚═╝░░░░░╚═╝░░░╚═╝░░░╚════╝░╚═╝░░╚══╝╚═════╝░╚══════╝╚═╝░░╚═╝╚══════╝╚═╝░░╚═╝╚═╝░░╚══╝╚═════╝░\n\nhttps://defi.sucks\n\n*/\n\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../Keep3r.sol';\nimport '../../interfaces/sidechain/IKeep3rEscrow.sol';\nimport '../../interfaces/sidechain/IKeep3rHelperSidechain.sol';\nimport '../../interfaces/sidechain/IKeep3rJobWorkableRated.sol';\nimport '../../interfaces/sidechain/IKeep3rSidechainAccountance.sol';\n\ncontract Keep3rSidechain is Keep3r, IKeep3rJobWorkableRated, IKeep3rSidechainAccountance {\n using EnumerableSet for EnumerableSet.AddressSet;\n\n /// @param _governance Address of governance\n /// @param _keep3rHelperSidechain Address of sidechain Keep3rHelper\n /// @param _wrappedKP3R Address of wrapped KP3R implementation\n /// @param _keep3rEscrow Address of sidechain Keep3rEscrow\n constructor(\n address _governance, // governance\n address _keep3rHelperSidechain, // helper\n address _wrappedKP3R, // keep3rV1\n address _keep3rEscrow // keep3rV1Proxy\n ) Keep3r(_governance, _keep3rHelperSidechain, _wrappedKP3R, _keep3rEscrow) {}\n\n // Keep3rSidechainAccountance\n\n /// @inheritdoc IKeep3rSidechainAccountance\n function virtualReserves() external view override returns (int256 _virtualReserves) {\n // Queries wKP3R balanceOf escrow contract minus the totalBonds\n return int256(IERC20(keep3rV1).balanceOf(keep3rV1Proxy)) - int256(totalBonds);\n }\n\n // Keep3rJobFundableLiquidity\n\n /// @notice Sidechain implementation asks the Helper for an oracle, instead of reading it from the ERC-20\n /// @dev Function should be called after setting an oracle in Keep3rHelperSidechain\n /// @param _liquidity Address of the liquidity token being approved\n function approveLiquidity(address _liquidity) external virtual override onlyGovernance {\n if (!_approvedLiquidities.add(_liquidity)) revert LiquidityPairApproved();\n _liquidityPool[_liquidity] = IKeep3rHelperSidechain(keep3rHelper).oracle(_liquidity);\n if (_liquidityPool[_liquidity] == address(0)) revert ZeroAddress();\n _isKP3RToken0[_liquidity] = IKeep3rHelper(keep3rHelper).isKP3RToken0(_liquidityPool[_liquidity]);\n _tick[_liquidity] = observeLiquidity(_liquidity);\n emit LiquidityApproval(_liquidity);\n }\n\n /// @notice Sidechain implementation will always ask for 2 tickCumulatives instead of cacheing\n /// @param _liquidity Address of the liquidity token being observed\n function observeLiquidity(address _liquidity) public view virtual override returns (TickCache memory _tickCache) {\n if (_tick[_liquidity].period == _period(block.timestamp)) {\n // Will return cached twaps if liquidity is updated\n _tickCache = _tick[_liquidity];\n } else {\n bool success;\n\n // Will always ask for 2 accumulators in sidechain\n uint32[] memory _secondsAgo = new uint32[](2);\n\n _secondsAgo[0] = uint32(block.timestamp - _period(block.timestamp));\n _secondsAgo[1] = uint32(block.timestamp - _period(block.timestamp) + rewardPeriodTime);\n\n int56 _tickCumulative2;\n (_tickCache.current, _tickCumulative2, success) = IKeep3rHelper(keep3rHelper).observe(_liquidityPool[_liquidity], _secondsAgo);\n\n _tickCache.difference = _tickCache.current - _tickCumulative2;\n\n if (success) {\n _tickCache.period = _period(block.timestamp);\n } else {\n delete _tickCache.period;\n }\n }\n }\n\n // Keep3rJobsWorkable\n\n /// @dev Sidechain implementation deprecates worked(address) as it should come with a usdPerGasUnit parameter\n function worked(address) external pure override {\n revert Deprecated();\n }\n\n /// @notice Implemented by jobs to show that a keeper performed work\n /// @dev Uses a USD per gas unit payment mechanism\n /// @param _keeper Address of the keeper that performed the work\n /// @param _usdPerGasUnit Units of USD (in wei) per gas unit that should be rewarded to the keeper\n function worked(address _keeper, uint256 _usdPerGasUnit) external override {\n if (_initialGas == 0) revert GasNotInitialized();\n // Gas used for quote calculations & payment is not rewarded\n uint256 _gasLeft = _getGasLeft();\n\n address _job = msg.sender;\n if (disputes[_job]) revert JobDisputed();\n if (!_jobs.contains(_job)) revert JobUnapproved();\n\n if (_updateJobCreditsIfNeeded(_job)) {\n emit LiquidityCreditsReward(_job, rewardedAt[_job], _jobLiquidityCredits[_job], _jobPeriodCredits[_job]);\n }\n\n (uint256 _boost, uint256 _oneUsdQuote, uint256 _extraGas) = IKeep3rHelper(keep3rHelper).getPaymentParams(bonds[_keeper][keep3rV1]);\n\n uint256 _kp3rPayment = _calculatePayment(_gasLeft, _extraGas, _oneUsdQuote * _usdPerGasUnit, _boost);\n\n if (_kp3rPayment > _jobLiquidityCredits[_job]) {\n _rewardJobCredits(_job);\n emit LiquidityCreditsReward(_job, rewardedAt[_job], _jobLiquidityCredits[_job], _jobPeriodCredits[_job]);\n }\n\n _bondedPayment(_job, _keeper, _kp3rPayment);\n delete _initialGas;\n\n emit KeeperWork(keep3rV1, _job, _keeper, _kp3rPayment, _gasLeft);\n }\n\n // Keep3rKeeperFundable\n\n /// @dev Sidechain implementation doesn't burn tokens, but deposit them in Keep3rEscrow\n function _depositBonds(uint256 _amount) internal virtual override {\n IKeep3rV1(keep3rV1).approve(keep3rV1Proxy, _amount);\n IKeep3rEscrow(keep3rV1Proxy).deposit(_amount);\n }\n}\n" - }, - "solidity/interfaces/sidechain/IKeep3rEscrow.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\n// solhint-disable-next-line no-empty-blocks\n\nimport '../peripherals/IMintable.sol';\n\n/// @title Keep3rEscrow contract\n/// @notice This contract acts as an escrow contract for wKP3R tokens on sidechains and L2s\n/// @dev Can be used as a replacement for keep3rV1Proxy in keep3r sidechain implementations\ninterface IKeep3rEscrow is IMintable {\n /// @notice Emitted when Keep3rEscrow#deposit function is called\n /// @param _wKP3R The addess of the wrapped KP3R token\n /// @param _sender The address that called the function\n /// @param _amount The amount of wKP3R the user deposited\n event wKP3RDeposited(address _wKP3R, address _sender, uint256 _amount);\n\n /// @notice Emitted when Keep3rEscrow#mint function is called\n /// @param _wKP3R The addess of the wrapped KP3R token\n /// @param _recipient The address that will received the newly minted wKP3R\n /// @param _amount The amount of wKP3R minted to the recipient\n event wKP3RMinted(address _wKP3R, address _recipient, uint256 _amount);\n\n /// @notice Emitted when Keep3rEscrow#setWKP3R function is called\n /// @param _newWKP3R The address of the wKP3R contract\n event wKP3RSet(address _newWKP3R);\n\n /// @notice Throws when minter attempts to withdraw more wKP3R than the escrow has in its balance\n error InsufficientBalance();\n\n /// @notice Lists the address of the wKP3R contract\n /// @return _wKP3RAddress The address of wKP3R\n function wKP3R() external view returns (address _wKP3RAddress);\n\n /// @notice Deposits wKP3R into the contract\n /// @param _amount The amount of wKP3R to deposit\n function deposit(uint256 _amount) external;\n\n /// @notice mints wKP3R to the recipient\n /// @param _amount The amount of wKP3R to mint\n function mint(uint256 _amount) external;\n\n /// @notice sets the wKP3R address\n /// @param _wKP3R the wKP3R address\n function setWKP3R(address _wKP3R) external;\n}\n" - }, - "solidity/interfaces/sidechain/IKeep3rHelperSidechain.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../IKeep3rHelper.sol';\n\n/// @title Keep3rHelperSidechain contract\n/// @notice Contains all the helper functions for sidechain keep3r implementations\ninterface IKeep3rHelperSidechain is IKeep3rHelper {\n // Events\n\n /// @notice The oracle for a liquidity has been saved\n /// @param _liquidity The address of the given liquidity\n /// @param _oraclePool The address of the oracle pool\n event OracleSet(address _liquidity, address _oraclePool);\n\n /// @notice Emitted when the WETH USD pool is changed\n /// @param _address Address of the new WETH USD pool\n /// @param _isWETHToken0 True if calling the token0 method of the pool returns the WETH token address\n event WethUSDPoolChange(address _address, bool _isWETHToken0);\n\n /// Variables\n\n /// @notice Ethereum mainnet WETH address used for quoting references\n /// @return _weth Address of WETH token\n // solhint-disable func-name-mixedcase\n function WETH() external view returns (address _weth);\n\n /// @return _oracle The address of the observable pool for given liquidity\n function oracle(address _liquidity) external view returns (address _oracle);\n\n /// @notice WETH-USD pool that is being used as oracle\n /// @return poolAddress Address of the pool\n /// @return isTKNToken0 True if calling the token0 method of the pool returns the WETH token address\n function wethUSDPool() external view returns (address poolAddress, bool isTKNToken0);\n\n /// @notice Quotes USD to ETH\n /// @dev Used to know how much ETH should be paid to keepers before converting it from ETH to KP3R\n /// @param _usd The amount of USD to quote to ETH\n /// @return _eth The resulting amount of ETH after quoting the USD\n function quoteUsdToEth(uint256 _usd) external returns (uint256 _eth);\n\n /// Methods\n\n /// @notice Sets an oracle for a given liquidity\n /// @param _liquidity The address of the liquidity\n /// @param _oracle The address of the pool used to quote the liquidity from\n /// @dev The oracle must contain KP3R as either token0 or token1\n function setOracle(address _liquidity, address _oracle) external;\n\n /// @notice Sets an oracle for querying WETH/USD quote\n /// @param _poolAddress The address of the pool used as oracle\n /// @dev The oracle must contain WETH as either token0 or token1\n function setWethUsdPool(address _poolAddress) external;\n}\n" - }, - "solidity/interfaces/sidechain/IKeep3rJobWorkableRated.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../peripherals/IKeep3rJobs.sol';\n\n/// @title Keep3rJobWorkableRated contract\n/// @notice Implements a quoting in USD per gas unit for Keep3r jobs\ninterface IKeep3rJobWorkableRated is IKeep3rJobs {\n /// @notice Throws when job contract calls deprecated worked(address) function\n error Deprecated();\n\n /// @notice Implemented by jobs to show that a keeper performed work and reward in stable USD quote\n /// @dev Automatically calculates the payment for the keeper and pays the keeper with bonded KP3R\n /// @param _keeper Address of the keeper that performed the work\n /// @param _usdPerGasUnit Amount of USD in wei rewarded for gas unit worked by the keeper\n function worked(address _keeper, uint256 _usdPerGasUnit) external;\n}\n" - }, - "solidity/interfaces/sidechain/IKeep3rSidechainAccountance.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\n/// @title IKeep3rSidechainAccountance interface\n/// @notice Implements a view to get the amount of credits that can be withdrawn\ninterface IKeep3rSidechainAccountance {\n /// @notice The surplus amount of wKP3Rs in escrow contract\n /// @return _virtualReserves The surplus amount of wKP3Rs in escrow contract\n function virtualReserves() external view returns (int256 _virtualReserves);\n}\n" - }, - "solidity/interfaces/peripherals/IMintable.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport './IGovernable.sol';\nimport './IBaseErrors.sol';\n\n/// @title Mintable contract\n/// @notice Manages the minter role\ninterface IMintable is IBaseErrors, IGovernable {\n // Events\n\n /// @notice Emitted when governance sets a new minter\n /// @param _minter Address of the new minter\n event MinterSet(address _minter);\n\n // Errors\n\n /// @notice Throws if the caller of the function is not the minter\n error OnlyMinter();\n\n // Variables\n\n /// @notice Stores the minter address\n /// @return _minter The minter addresss\n function minter() external view returns (address _minter);\n\n // Methods\n\n /// @notice Sets a new address to be the minter\n /// @param _minter The address set as the minter\n function setMinter(address _minter) external;\n}\n" - }, - "solidity/for-test/testnet/Keep3rSidechainForTestnet.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../../contracts/sidechain/Keep3rSidechain.sol';\n\ncontract Keep3rSidechainForTestnet is Keep3rSidechain {\n constructor(\n address _governance,\n address _keep3rHelper,\n address _keep3rV1,\n address _keep3rV1Proxy\n ) Keep3rSidechain(_governance, _keep3rHelper, _keep3rV1, _keep3rV1Proxy) {\n bondTime = 0; // allows keepers to instantly register\n unbondTime = 0; // allows keepers & jobOwners to instantly withdraw funds\n liquidityMinimum = 1; // allows job providers to add low liquidity\n rewardPeriodTime = 1 days; // reduces twap calculation period\n inflationPeriod = 5 days; // increases credit minting\n }\n}\n" - }, - "solidity/for-test/Keep3rSidechainForTest.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../contracts/sidechain/Keep3rSidechain.sol';\n\ncontract Keep3rSidechainForTest is Keep3rSidechain {\n using EnumerableSet for EnumerableSet.AddressSet;\n\n constructor(\n address _governance,\n address _keep3rHelper,\n address _wrappedKP3R,\n address _keep3rEscrow\n ) Keep3rSidechain(_governance, _keep3rHelper, _wrappedKP3R, _keep3rEscrow) {}\n\n function setJobLiquidity(address _job, address _liquidity) external {\n _jobLiquidities[_job].add(_liquidity);\n }\n}\n" - }, - "solidity/for-test/JobRatedForTest.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../interfaces/IKeep3r.sol';\nimport '../interfaces/sidechain/IKeep3rJobWorkableRated.sol';\n\ncontract JobRatedForTest {\n error InvalidKeeper();\n address public keep3r;\n uint256 public nonce;\n uint256 public usdPerGasUnit = 1_000e9;\n\n constructor(address _keep3r) {\n keep3r = _keep3r;\n }\n\n function work() external {\n if (!IKeep3r(keep3r).isKeeper(msg.sender)) revert InvalidKeeper();\n\n for (uint256 i = 0; i < 1000; i++) {\n nonce++;\n }\n\n IKeep3rJobWorkableRated(keep3r).worked(msg.sender, usdPerGasUnit);\n }\n\n function workHard(uint256 _factor) external {\n if (!IKeep3r(keep3r).isKeeper(msg.sender)) revert InvalidKeeper();\n\n for (uint256 i = 0; i < 1000 * _factor; i++) {\n nonce++;\n }\n\n IKeep3rJobWorkableRated(keep3r).worked(msg.sender, usdPerGasUnit);\n }\n}\n" - }, - "solidity/for-test/JobForTest.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../interfaces/IKeep3r.sol';\n\ncontract JobForTest {\n error InvalidKeeper();\n address public keep3r;\n uint256 public nonce;\n\n constructor(address _keep3r) {\n keep3r = _keep3r;\n }\n\n function work() external {\n if (!IKeep3r(keep3r).isKeeper(msg.sender)) revert InvalidKeeper();\n\n for (uint256 i; i < 1000; i++) {\n nonce++;\n }\n\n IKeep3r(keep3r).worked(msg.sender);\n }\n\n function workHard(uint256 _factor) external {\n if (!IKeep3r(keep3r).isKeeper(msg.sender)) revert InvalidKeeper();\n\n for (uint256 i; i < 1000 * _factor; i++) {\n nonce++;\n }\n\n IKeep3r(keep3r).worked(msg.sender);\n }\n}\n" - }, - "solidity/for-test/BasicJob.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../interfaces/IKeep3r.sol';\n\ncontract BasicJob {\n error KeeperNotValid();\n\n address public keep3r;\n uint256 public nonce;\n uint256[] public array;\n\n constructor(address _keep3r) {\n keep3r = _keep3r;\n }\n\n function work() external upkeep {}\n\n function workHard(uint256 _howHard) external upkeep {\n for (uint256 i = nonce; i < _howHard; i++) {\n nonce++;\n }\n }\n\n function workRefund(uint256 _howHard) external upkeep {\n for (uint256 i; i < _howHard; i++) {\n array.push(i);\n }\n\n while (array.length > 0) {\n array.pop();\n }\n }\n\n modifier upkeep() {\n if (!IKeep3r(keep3r).isKeeper(msg.sender)) revert KeeperNotValid();\n _;\n IKeep3r(keep3r).worked(msg.sender);\n }\n}\n" - }, - "solidity/contracts/Keep3rHelperParameters.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.7 <0.9.0;\n\nimport './libraries/FullMath.sol';\nimport './libraries/TickMath.sol';\nimport '../interfaces/peripherals/IBaseErrors.sol';\nimport '../interfaces/IKeep3r.sol';\nimport '../interfaces/external/IKeep3rV1.sol';\nimport '../interfaces/IKeep3rHelperParameters.sol';\nimport './peripherals/Governable.sol';\nimport './Keep3rHelperParameters.sol';\n\nimport '@openzeppelin/contracts/utils/math/Math.sol';\nimport '@uniswap/v3-core/contracts/interfaces/IUniswapV3Pool.sol';\n\ncontract Keep3rHelperParameters is IKeep3rHelperParameters, IBaseErrors, Governable {\n /// @inheritdoc IKeep3rHelperParameters\n address public immutable override KP3R;\n\n /// @inheritdoc IKeep3rHelperParameters\n uint256 public constant override BOOST_BASE = 10_000;\n\n /// @inheritdoc IKeep3rHelperParameters\n uint256 public override minBoost = 11_000;\n\n /// @inheritdoc IKeep3rHelperParameters\n uint256 public override maxBoost = 12_000;\n\n /// @inheritdoc IKeep3rHelperParameters\n uint256 public override targetBond = 200 ether;\n\n /// @inheritdoc IKeep3rHelperParameters\n uint256 public override workExtraGas = 34_000;\n\n /// @inheritdoc IKeep3rHelperParameters\n uint32 public override quoteTwapTime = 10 minutes;\n\n /// @inheritdoc IKeep3rHelperParameters\n uint256 public override minBaseFee = 15e9;\n\n /// @inheritdoc IKeep3rHelperParameters\n uint256 public override minPriorityFee = 2e9;\n\n /// @inheritdoc IKeep3rHelperParameters\n address public override keep3rV2;\n\n /// @inheritdoc IKeep3rHelperParameters\n IKeep3rHelperParameters.TokenOraclePool public override kp3rWethPool;\n\n constructor(\n address _kp3r,\n address _keep3rV2,\n address _governance,\n address _kp3rWethPool\n ) Governable(_governance) {\n KP3R = _kp3r;\n keep3rV2 = _keep3rV2;\n\n // Immutable variables [KP3R] cannot be read during contract creation time [_setKp3rWethPool]\n kp3rWethPool = _validateOraclePool(_kp3rWethPool, _kp3r);\n emit Kp3rWethPoolChange(kp3rWethPool.poolAddress, kp3rWethPool.isTKNToken0);\n }\n\n /// @inheritdoc IKeep3rHelperParameters\n function setKp3rWethPool(address _poolAddress) external override onlyGovernance {\n if (_poolAddress == address(0)) revert ZeroAddress();\n _setKp3rWethPool(_poolAddress);\n }\n\n /// @inheritdoc IKeep3rHelperParameters\n function setMinBoost(uint256 _minBoost) external override onlyGovernance {\n minBoost = _minBoost;\n emit MinBoostChange(minBoost);\n }\n\n /// @inheritdoc IKeep3rHelperParameters\n function setMaxBoost(uint256 _maxBoost) external override onlyGovernance {\n maxBoost = _maxBoost;\n emit MaxBoostChange(maxBoost);\n }\n\n /// @inheritdoc IKeep3rHelperParameters\n function setTargetBond(uint256 _targetBond) external override onlyGovernance {\n targetBond = _targetBond;\n emit TargetBondChange(targetBond);\n }\n\n /// @inheritdoc IKeep3rHelperParameters\n function setKeep3rV2(address _keep3rV2) external override onlyGovernance {\n if (_keep3rV2 == address(0)) revert ZeroAddress();\n keep3rV2 = _keep3rV2;\n emit Keep3rV2Change(keep3rV2);\n }\n\n /// @inheritdoc IKeep3rHelperParameters\n function setWorkExtraGas(uint256 _workExtraGas) external override onlyGovernance {\n workExtraGas = _workExtraGas;\n emit WorkExtraGasChange(workExtraGas);\n }\n\n /// @inheritdoc IKeep3rHelperParameters\n function setQuoteTwapTime(uint32 _quoteTwapTime) external override onlyGovernance {\n _setQuoteTwapTime(_quoteTwapTime);\n }\n\n function _setQuoteTwapTime(uint32 _quoteTwapTime) internal {\n quoteTwapTime = _quoteTwapTime;\n emit QuoteTwapTimeChange(quoteTwapTime);\n }\n\n /// @inheritdoc IKeep3rHelperParameters\n function setMinBaseFee(uint256 _minBaseFee) external override onlyGovernance {\n minBaseFee = _minBaseFee;\n emit MinBaseFeeChange(minBaseFee);\n }\n\n /// @inheritdoc IKeep3rHelperParameters\n function setMinPriorityFee(uint256 _minPriorityFee) external override onlyGovernance {\n minPriorityFee = _minPriorityFee;\n emit MinPriorityFeeChange(minPriorityFee);\n }\n\n /// @notice Sets KP3R-WETH pool\n /// @param _poolAddress The address of the KP3R-WETH pool\n function _setKp3rWethPool(address _poolAddress) internal {\n kp3rWethPool = _validateOraclePool(_poolAddress, KP3R);\n emit Kp3rWethPoolChange(kp3rWethPool.poolAddress, kp3rWethPool.isTKNToken0);\n }\n\n function _validateOraclePool(address _poolAddress, address _token) internal view virtual returns (TokenOraclePool memory _oraclePool) {\n bool _isTKNToken0 = IUniswapV3Pool(_poolAddress).token0() == _token;\n\n if (!_isTKNToken0 && IUniswapV3Pool(_poolAddress).token1() != _token) revert InvalidOraclePool();\n\n return TokenOraclePool(_poolAddress, _isTKNToken0);\n }\n}\n" - }, - "solidity/contracts/libraries/TickMath.sol": { - "content": "// SPDX-License-Identifier: GPL-2.0-or-later\npragma solidity >=0.5.0;\n\n// solhint-disable\n\n/// @title Math library for computing sqrt prices from ticks and vice versa\n/// @notice Computes sqrt price for ticks of size 1.0001, i.e. sqrt(1.0001^tick) as fixed point Q64.96 numbers. Supports\n/// prices between 2**-128 and 2**128\nlibrary TickMath {\n /// @dev The minimum tick that may be passed to #getSqrtRatioAtTick computed from log base 1.0001 of 2**-128\n int24 internal constant MIN_TICK = -887272;\n /// @dev The maximum tick that may be passed to #getSqrtRatioAtTick computed from log base 1.0001 of 2**128\n int24 internal constant MAX_TICK = -MIN_TICK;\n\n /// @dev The minimum value that can be returned from #getSqrtRatioAtTick. Equivalent to getSqrtRatioAtTick(MIN_TICK)\n uint160 internal constant MIN_SQRT_RATIO = 4295128739;\n /// @dev The maximum value that can be returned from #getSqrtRatioAtTick. Equivalent to getSqrtRatioAtTick(MAX_TICK)\n uint160 internal constant MAX_SQRT_RATIO = 1461446703485210103287273052203988822378723970342;\n\n /// @notice Calculates sqrt(1.0001^tick) * 2^96\n /// @dev Throws if |tick| > max tick\n /// @param tick The input tick for the above formula\n /// @return sqrtPriceX96 A Fixed point Q64.96 number representing the sqrt of the ratio of the two assets (token1/token0)\n /// at the given tick\n function getSqrtRatioAtTick(int24 tick) internal pure returns (uint160 sqrtPriceX96) {\n uint256 absTick = tick < 0 ? uint256(-int256(tick)) : uint256(int256(tick));\n require(absTick <= uint256(int256(MAX_TICK)), 'T');\n\n uint256 ratio = absTick & 0x1 != 0 ? 0xfffcb933bd6fad37aa2d162d1a594001 : 0x100000000000000000000000000000000;\n if (absTick & 0x2 != 0) ratio = (ratio * 0xfff97272373d413259a46990580e213a) >> 128;\n if (absTick & 0x4 != 0) ratio = (ratio * 0xfff2e50f5f656932ef12357cf3c7fdcc) >> 128;\n if (absTick & 0x8 != 0) ratio = (ratio * 0xffe5caca7e10e4e61c3624eaa0941cd0) >> 128;\n if (absTick & 0x10 != 0) ratio = (ratio * 0xffcb9843d60f6159c9db58835c926644) >> 128;\n if (absTick & 0x20 != 0) ratio = (ratio * 0xff973b41fa98c081472e6896dfb254c0) >> 128;\n if (absTick & 0x40 != 0) ratio = (ratio * 0xff2ea16466c96a3843ec78b326b52861) >> 128;\n if (absTick & 0x80 != 0) ratio = (ratio * 0xfe5dee046a99a2a811c461f1969c3053) >> 128;\n if (absTick & 0x100 != 0) ratio = (ratio * 0xfcbe86c7900a88aedcffc83b479aa3a4) >> 128;\n if (absTick & 0x200 != 0) ratio = (ratio * 0xf987a7253ac413176f2b074cf7815e54) >> 128;\n if (absTick & 0x400 != 0) ratio = (ratio * 0xf3392b0822b70005940c7a398e4b70f3) >> 128;\n if (absTick & 0x800 != 0) ratio = (ratio * 0xe7159475a2c29b7443b29c7fa6e889d9) >> 128;\n if (absTick & 0x1000 != 0) ratio = (ratio * 0xd097f3bdfd2022b8845ad8f792aa5825) >> 128;\n if (absTick & 0x2000 != 0) ratio = (ratio * 0xa9f746462d870fdf8a65dc1f90e061e5) >> 128;\n if (absTick & 0x4000 != 0) ratio = (ratio * 0x70d869a156d2a1b890bb3df62baf32f7) >> 128;\n if (absTick & 0x8000 != 0) ratio = (ratio * 0x31be135f97d08fd981231505542fcfa6) >> 128;\n if (absTick & 0x10000 != 0) ratio = (ratio * 0x9aa508b5b7a84e1c677de54f3e99bc9) >> 128;\n if (absTick & 0x20000 != 0) ratio = (ratio * 0x5d6af8dedb81196699c329225ee604) >> 128;\n if (absTick & 0x40000 != 0) ratio = (ratio * 0x2216e584f5fa1ea926041bedfe98) >> 128;\n if (absTick & 0x80000 != 0) ratio = (ratio * 0x48a170391f7dc42444e8fa2) >> 128;\n\n if (tick > 0) ratio = type(uint256).max / ratio;\n\n // Divides by 1<<32 rounding up to go from a Q128.128 to a Q128.96.\n // we then downcast because we know the result always fits within 160 bits due to our tick input constraint\n // we round up in the division so getTickAtSqrtRatio of the output price is always consistent\n sqrtPriceX96 = uint160((ratio >> 32) + (ratio % (1 << 32) == 0 ? 0 : 1));\n }\n\n /// @notice Calculates the greatest tick value such that getRatioAtTick(tick) <= ratio\n /// @dev Throws in case sqrtPriceX96 < MIN_SQRT_RATIO, as MIN_SQRT_RATIO is the lowest value getRatioAtTick may ever return.\n /// @param sqrtPriceX96 The sqrt ratio for which to compute the tick as a Q64.96\n /// @return tick The greatest tick for which the ratio is less than or equal to the input ratio\n function getTickAtSqrtRatio(uint160 sqrtPriceX96) internal pure returns (int24 tick) {\n // Second inequality must be < because the price can never reach the price at the max tick\n require(sqrtPriceX96 >= MIN_SQRT_RATIO && sqrtPriceX96 < MAX_SQRT_RATIO, 'R');\n uint256 ratio = uint256(sqrtPriceX96) << 32;\n\n uint256 r = ratio;\n uint256 msb = 0;\n\n assembly {\n let f := shl(7, gt(r, 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF))\n msb := or(msb, f)\n r := shr(f, r)\n }\n assembly {\n let f := shl(6, gt(r, 0xFFFFFFFFFFFFFFFF))\n msb := or(msb, f)\n r := shr(f, r)\n }\n assembly {\n let f := shl(5, gt(r, 0xFFFFFFFF))\n msb := or(msb, f)\n r := shr(f, r)\n }\n assembly {\n let f := shl(4, gt(r, 0xFFFF))\n msb := or(msb, f)\n r := shr(f, r)\n }\n assembly {\n let f := shl(3, gt(r, 0xFF))\n msb := or(msb, f)\n r := shr(f, r)\n }\n assembly {\n let f := shl(2, gt(r, 0xF))\n msb := or(msb, f)\n r := shr(f, r)\n }\n assembly {\n let f := shl(1, gt(r, 0x3))\n msb := or(msb, f)\n r := shr(f, r)\n }\n assembly {\n let f := gt(r, 0x1)\n msb := or(msb, f)\n }\n\n if (msb >= 128) r = ratio >> (msb - 127);\n else r = ratio << (127 - msb);\n\n int256 log_2 = (int256(msb) - 128) << 64;\n\n assembly {\n r := shr(127, mul(r, r))\n let f := shr(128, r)\n log_2 := or(log_2, shl(63, f))\n r := shr(f, r)\n }\n assembly {\n r := shr(127, mul(r, r))\n let f := shr(128, r)\n log_2 := or(log_2, shl(62, f))\n r := shr(f, r)\n }\n assembly {\n r := shr(127, mul(r, r))\n let f := shr(128, r)\n log_2 := or(log_2, shl(61, f))\n r := shr(f, r)\n }\n assembly {\n r := shr(127, mul(r, r))\n let f := shr(128, r)\n log_2 := or(log_2, shl(60, f))\n r := shr(f, r)\n }\n assembly {\n r := shr(127, mul(r, r))\n let f := shr(128, r)\n log_2 := or(log_2, shl(59, f))\n r := shr(f, r)\n }\n assembly {\n r := shr(127, mul(r, r))\n let f := shr(128, r)\n log_2 := or(log_2, shl(58, f))\n r := shr(f, r)\n }\n assembly {\n r := shr(127, mul(r, r))\n let f := shr(128, r)\n log_2 := or(log_2, shl(57, f))\n r := shr(f, r)\n }\n assembly {\n r := shr(127, mul(r, r))\n let f := shr(128, r)\n log_2 := or(log_2, shl(56, f))\n r := shr(f, r)\n }\n assembly {\n r := shr(127, mul(r, r))\n let f := shr(128, r)\n log_2 := or(log_2, shl(55, f))\n r := shr(f, r)\n }\n assembly {\n r := shr(127, mul(r, r))\n let f := shr(128, r)\n log_2 := or(log_2, shl(54, f))\n r := shr(f, r)\n }\n assembly {\n r := shr(127, mul(r, r))\n let f := shr(128, r)\n log_2 := or(log_2, shl(53, f))\n r := shr(f, r)\n }\n assembly {\n r := shr(127, mul(r, r))\n let f := shr(128, r)\n log_2 := or(log_2, shl(52, f))\n r := shr(f, r)\n }\n assembly {\n r := shr(127, mul(r, r))\n let f := shr(128, r)\n log_2 := or(log_2, shl(51, f))\n r := shr(f, r)\n }\n assembly {\n r := shr(127, mul(r, r))\n let f := shr(128, r)\n log_2 := or(log_2, shl(50, f))\n }\n\n int256 log_sqrt10001 = log_2 * 255738958999603826347141; // 128.128 number\n\n int24 tickLow = int24((log_sqrt10001 - 3402992956809132418596140100660247210) >> 128);\n int24 tickHi = int24((log_sqrt10001 + 291339464771989622907027621153398088495) >> 128);\n\n tick = tickLow == tickHi ? tickLow : getSqrtRatioAtTick(tickHi) <= sqrtPriceX96 ? tickHi : tickLow;\n }\n}\n" - }, - "@uniswap/v3-core/contracts/interfaces/IUniswapV3Pool.sol": { - "content": "// SPDX-License-Identifier: GPL-2.0-or-later\npragma solidity >=0.5.0;\n\nimport './pool/IUniswapV3PoolImmutables.sol';\nimport './pool/IUniswapV3PoolState.sol';\nimport './pool/IUniswapV3PoolDerivedState.sol';\nimport './pool/IUniswapV3PoolActions.sol';\nimport './pool/IUniswapV3PoolOwnerActions.sol';\nimport './pool/IUniswapV3PoolEvents.sol';\n\n/// @title The interface for a Uniswap V3 Pool\n/// @notice A Uniswap pool facilitates swapping and automated market making between any two assets that strictly conform\n/// to the ERC20 specification\n/// @dev The pool interface is broken up into many smaller pieces\ninterface IUniswapV3Pool is\n IUniswapV3PoolImmutables,\n IUniswapV3PoolState,\n IUniswapV3PoolDerivedState,\n IUniswapV3PoolActions,\n IUniswapV3PoolOwnerActions,\n IUniswapV3PoolEvents\n{\n\n}\n" - }, - "@uniswap/v3-core/contracts/interfaces/pool/IUniswapV3PoolImmutables.sol": { - "content": "// SPDX-License-Identifier: GPL-2.0-or-later\npragma solidity >=0.5.0;\n\n/// @title Pool state that never changes\n/// @notice These parameters are fixed for a pool forever, i.e., the methods will always return the same values\ninterface IUniswapV3PoolImmutables {\n /// @notice The contract that deployed the pool, which must adhere to the IUniswapV3Factory interface\n /// @return The contract address\n function factory() external view returns (address);\n\n /// @notice The first of the two tokens of the pool, sorted by address\n /// @return The token contract address\n function token0() external view returns (address);\n\n /// @notice The second of the two tokens of the pool, sorted by address\n /// @return The token contract address\n function token1() external view returns (address);\n\n /// @notice The pool's fee in hundredths of a bip, i.e. 1e-6\n /// @return The fee\n function fee() external view returns (uint24);\n\n /// @notice The pool tick spacing\n /// @dev Ticks can only be used at multiples of this value, minimum of 1 and always positive\n /// e.g.: a tickSpacing of 3 means ticks can be initialized every 3rd tick, i.e., ..., -6, -3, 0, 3, 6, ...\n /// This value is an int24 to avoid casting even though it is always positive.\n /// @return The tick spacing\n function tickSpacing() external view returns (int24);\n\n /// @notice The maximum amount of position liquidity that can use any tick in the range\n /// @dev This parameter is enforced per tick to prevent liquidity from overflowing a uint128 at any point, and\n /// also prevents out-of-range liquidity from being used to prevent adding in-range liquidity to a pool\n /// @return The max amount of liquidity per tick\n function maxLiquidityPerTick() external view returns (uint128);\n}\n" - }, - "@uniswap/v3-core/contracts/interfaces/pool/IUniswapV3PoolState.sol": { - "content": "// SPDX-License-Identifier: GPL-2.0-or-later\npragma solidity >=0.5.0;\n\n/// @title Pool state that can change\n/// @notice These methods compose the pool's state, and can change with any frequency including multiple times\n/// per transaction\ninterface IUniswapV3PoolState {\n /// @notice The 0th storage slot in the pool stores many values, and is exposed as a single method to save gas\n /// when accessed externally.\n /// @return sqrtPriceX96 The current price of the pool as a sqrt(token1/token0) Q64.96 value\n /// tick The current tick of the pool, i.e. according to the last tick transition that was run.\n /// This value may not always be equal to SqrtTickMath.getTickAtSqrtRatio(sqrtPriceX96) if the price is on a tick\n /// boundary.\n /// observationIndex The index of the last oracle observation that was written,\n /// observationCardinality The current maximum number of observations stored in the pool,\n /// observationCardinalityNext The next maximum number of observations, to be updated when the observation.\n /// feeProtocol The protocol fee for both tokens of the pool.\n /// Encoded as two 4 bit values, where the protocol fee of token1 is shifted 4 bits and the protocol fee of token0\n /// is the lower 4 bits. Used as the denominator of a fraction of the swap fee, e.g. 4 means 1/4th of the swap fee.\n /// unlocked Whether the pool is currently locked to reentrancy\n function slot0()\n external\n view\n returns (\n uint160 sqrtPriceX96,\n int24 tick,\n uint16 observationIndex,\n uint16 observationCardinality,\n uint16 observationCardinalityNext,\n uint8 feeProtocol,\n bool unlocked\n );\n\n /// @notice The fee growth as a Q128.128 fees of token0 collected per unit of liquidity for the entire life of the pool\n /// @dev This value can overflow the uint256\n function feeGrowthGlobal0X128() external view returns (uint256);\n\n /// @notice The fee growth as a Q128.128 fees of token1 collected per unit of liquidity for the entire life of the pool\n /// @dev This value can overflow the uint256\n function feeGrowthGlobal1X128() external view returns (uint256);\n\n /// @notice The amounts of token0 and token1 that are owed to the protocol\n /// @dev Protocol fees will never exceed uint128 max in either token\n function protocolFees() external view returns (uint128 token0, uint128 token1);\n\n /// @notice The currently in range liquidity available to the pool\n /// @dev This value has no relationship to the total liquidity across all ticks\n function liquidity() external view returns (uint128);\n\n /// @notice Look up information about a specific tick in the pool\n /// @param tick The tick to look up\n /// @return liquidityGross the total amount of position liquidity that uses the pool either as tick lower or\n /// tick upper,\n /// liquidityNet how much liquidity changes when the pool price crosses the tick,\n /// feeGrowthOutside0X128 the fee growth on the other side of the tick from the current tick in token0,\n /// feeGrowthOutside1X128 the fee growth on the other side of the tick from the current tick in token1,\n /// tickCumulativeOutside the cumulative tick value on the other side of the tick from the current tick\n /// secondsPerLiquidityOutsideX128 the seconds spent per liquidity on the other side of the tick from the current tick,\n /// secondsOutside the seconds spent on the other side of the tick from the current tick,\n /// initialized Set to true if the tick is initialized, i.e. liquidityGross is greater than 0, otherwise equal to false.\n /// Outside values can only be used if the tick is initialized, i.e. if liquidityGross is greater than 0.\n /// In addition, these values are only relative and must be used only in comparison to previous snapshots for\n /// a specific position.\n function ticks(int24 tick)\n external\n view\n returns (\n uint128 liquidityGross,\n int128 liquidityNet,\n uint256 feeGrowthOutside0X128,\n uint256 feeGrowthOutside1X128,\n int56 tickCumulativeOutside,\n uint160 secondsPerLiquidityOutsideX128,\n uint32 secondsOutside,\n bool initialized\n );\n\n /// @notice Returns 256 packed tick initialized boolean values. See TickBitmap for more information\n function tickBitmap(int16 wordPosition) external view returns (uint256);\n\n /// @notice Returns the information about a position by the position's key\n /// @param key The position's key is a hash of a preimage composed by the owner, tickLower and tickUpper\n /// @return _liquidity The amount of liquidity in the position,\n /// Returns feeGrowthInside0LastX128 fee growth of token0 inside the tick range as of the last mint/burn/poke,\n /// Returns feeGrowthInside1LastX128 fee growth of token1 inside the tick range as of the last mint/burn/poke,\n /// Returns tokensOwed0 the computed amount of token0 owed to the position as of the last mint/burn/poke,\n /// Returns tokensOwed1 the computed amount of token1 owed to the position as of the last mint/burn/poke\n function positions(bytes32 key)\n external\n view\n returns (\n uint128 _liquidity,\n uint256 feeGrowthInside0LastX128,\n uint256 feeGrowthInside1LastX128,\n uint128 tokensOwed0,\n uint128 tokensOwed1\n );\n\n /// @notice Returns data about a specific observation index\n /// @param index The element of the observations array to fetch\n /// @dev You most likely want to use #observe() instead of this method to get an observation as of some amount of time\n /// ago, rather than at a specific index in the array.\n /// @return blockTimestamp The timestamp of the observation,\n /// Returns tickCumulative the tick multiplied by seconds elapsed for the life of the pool as of the observation timestamp,\n /// Returns secondsPerLiquidityCumulativeX128 the seconds per in range liquidity for the life of the pool as of the observation timestamp,\n /// Returns initialized whether the observation has been initialized and the values are safe to use\n function observations(uint256 index)\n external\n view\n returns (\n uint32 blockTimestamp,\n int56 tickCumulative,\n uint160 secondsPerLiquidityCumulativeX128,\n bool initialized\n );\n}\n" - }, - "@uniswap/v3-core/contracts/interfaces/pool/IUniswapV3PoolDerivedState.sol": { - "content": "// SPDX-License-Identifier: GPL-2.0-or-later\npragma solidity >=0.5.0;\n\n/// @title Pool state that is not stored\n/// @notice Contains view functions to provide information about the pool that is computed rather than stored on the\n/// blockchain. The functions here may have variable gas costs.\ninterface IUniswapV3PoolDerivedState {\n /// @notice Returns the cumulative tick and liquidity as of each timestamp `secondsAgo` from the current block timestamp\n /// @dev To get a time weighted average tick or liquidity-in-range, you must call this with two values, one representing\n /// the beginning of the period and another for the end of the period. E.g., to get the last hour time-weighted average tick,\n /// you must call it with secondsAgos = [3600, 0].\n /// @dev The time weighted average tick represents the geometric time weighted average price of the pool, in\n /// log base sqrt(1.0001) of token1 / token0. The TickMath library can be used to go from a tick value to a ratio.\n /// @param secondsAgos From how long ago each cumulative tick and liquidity value should be returned\n /// @return tickCumulatives Cumulative tick values as of each `secondsAgos` from the current block timestamp\n /// @return secondsPerLiquidityCumulativeX128s Cumulative seconds per liquidity-in-range value as of each `secondsAgos` from the current block\n /// timestamp\n function observe(uint32[] calldata secondsAgos)\n external\n view\n returns (int56[] memory tickCumulatives, uint160[] memory secondsPerLiquidityCumulativeX128s);\n\n /// @notice Returns a snapshot of the tick cumulative, seconds per liquidity and seconds inside a tick range\n /// @dev Snapshots must only be compared to other snapshots, taken over a period for which a position existed.\n /// I.e., snapshots cannot be compared if a position is not held for the entire period between when the first\n /// snapshot is taken and the second snapshot is taken.\n /// @param tickLower The lower tick of the range\n /// @param tickUpper The upper tick of the range\n /// @return tickCumulativeInside The snapshot of the tick accumulator for the range\n /// @return secondsPerLiquidityInsideX128 The snapshot of seconds per liquidity for the range\n /// @return secondsInside The snapshot of seconds per liquidity for the range\n function snapshotCumulativesInside(int24 tickLower, int24 tickUpper)\n external\n view\n returns (\n int56 tickCumulativeInside,\n uint160 secondsPerLiquidityInsideX128,\n uint32 secondsInside\n );\n}\n" - }, - "@uniswap/v3-core/contracts/interfaces/pool/IUniswapV3PoolActions.sol": { - "content": "// SPDX-License-Identifier: GPL-2.0-or-later\npragma solidity >=0.5.0;\n\n/// @title Permissionless pool actions\n/// @notice Contains pool methods that can be called by anyone\ninterface IUniswapV3PoolActions {\n /// @notice Sets the initial price for the pool\n /// @dev Price is represented as a sqrt(amountToken1/amountToken0) Q64.96 value\n /// @param sqrtPriceX96 the initial sqrt price of the pool as a Q64.96\n function initialize(uint160 sqrtPriceX96) external;\n\n /// @notice Adds liquidity for the given recipient/tickLower/tickUpper position\n /// @dev The caller of this method receives a callback in the form of IUniswapV3MintCallback#uniswapV3MintCallback\n /// in which they must pay any token0 or token1 owed for the liquidity. The amount of token0/token1 due depends\n /// on tickLower, tickUpper, the amount of liquidity, and the current price.\n /// @param recipient The address for which the liquidity will be created\n /// @param tickLower The lower tick of the position in which to add liquidity\n /// @param tickUpper The upper tick of the position in which to add liquidity\n /// @param amount The amount of liquidity to mint\n /// @param data Any data that should be passed through to the callback\n /// @return amount0 The amount of token0 that was paid to mint the given amount of liquidity. Matches the value in the callback\n /// @return amount1 The amount of token1 that was paid to mint the given amount of liquidity. Matches the value in the callback\n function mint(\n address recipient,\n int24 tickLower,\n int24 tickUpper,\n uint128 amount,\n bytes calldata data\n ) external returns (uint256 amount0, uint256 amount1);\n\n /// @notice Collects tokens owed to a position\n /// @dev Does not recompute fees earned, which must be done either via mint or burn of any amount of liquidity.\n /// Collect must be called by the position owner. To withdraw only token0 or only token1, amount0Requested or\n /// amount1Requested may be set to zero. To withdraw all tokens owed, caller may pass any value greater than the\n /// actual tokens owed, e.g. type(uint128).max. Tokens owed may be from accumulated swap fees or burned liquidity.\n /// @param recipient The address which should receive the fees collected\n /// @param tickLower The lower tick of the position for which to collect fees\n /// @param tickUpper The upper tick of the position for which to collect fees\n /// @param amount0Requested How much token0 should be withdrawn from the fees owed\n /// @param amount1Requested How much token1 should be withdrawn from the fees owed\n /// @return amount0 The amount of fees collected in token0\n /// @return amount1 The amount of fees collected in token1\n function collect(\n address recipient,\n int24 tickLower,\n int24 tickUpper,\n uint128 amount0Requested,\n uint128 amount1Requested\n ) external returns (uint128 amount0, uint128 amount1);\n\n /// @notice Burn liquidity from the sender and account tokens owed for the liquidity to the position\n /// @dev Can be used to trigger a recalculation of fees owed to a position by calling with an amount of 0\n /// @dev Fees must be collected separately via a call to #collect\n /// @param tickLower The lower tick of the position for which to burn liquidity\n /// @param tickUpper The upper tick of the position for which to burn liquidity\n /// @param amount How much liquidity to burn\n /// @return amount0 The amount of token0 sent to the recipient\n /// @return amount1 The amount of token1 sent to the recipient\n function burn(\n int24 tickLower,\n int24 tickUpper,\n uint128 amount\n ) external returns (uint256 amount0, uint256 amount1);\n\n /// @notice Swap token0 for token1, or token1 for token0\n /// @dev The caller of this method receives a callback in the form of IUniswapV3SwapCallback#uniswapV3SwapCallback\n /// @param recipient The address to receive the output of the swap\n /// @param zeroForOne The direction of the swap, true for token0 to token1, false for token1 to token0\n /// @param amountSpecified The amount of the swap, which implicitly configures the swap as exact input (positive), or exact output (negative)\n /// @param sqrtPriceLimitX96 The Q64.96 sqrt price limit. If zero for one, the price cannot be less than this\n /// value after the swap. If one for zero, the price cannot be greater than this value after the swap\n /// @param data Any data to be passed through to the callback\n /// @return amount0 The delta of the balance of token0 of the pool, exact when negative, minimum when positive\n /// @return amount1 The delta of the balance of token1 of the pool, exact when negative, minimum when positive\n function swap(\n address recipient,\n bool zeroForOne,\n int256 amountSpecified,\n uint160 sqrtPriceLimitX96,\n bytes calldata data\n ) external returns (int256 amount0, int256 amount1);\n\n /// @notice Receive token0 and/or token1 and pay it back, plus a fee, in the callback\n /// @dev The caller of this method receives a callback in the form of IUniswapV3FlashCallback#uniswapV3FlashCallback\n /// @dev Can be used to donate underlying tokens pro-rata to currently in-range liquidity providers by calling\n /// with 0 amount{0,1} and sending the donation amount(s) from the callback\n /// @param recipient The address which will receive the token0 and token1 amounts\n /// @param amount0 The amount of token0 to send\n /// @param amount1 The amount of token1 to send\n /// @param data Any data to be passed through to the callback\n function flash(\n address recipient,\n uint256 amount0,\n uint256 amount1,\n bytes calldata data\n ) external;\n\n /// @notice Increase the maximum number of price and liquidity observations that this pool will store\n /// @dev This method is no-op if the pool already has an observationCardinalityNext greater than or equal to\n /// the input observationCardinalityNext.\n /// @param observationCardinalityNext The desired minimum number of observations for the pool to store\n function increaseObservationCardinalityNext(uint16 observationCardinalityNext) external;\n}\n" - }, - "@uniswap/v3-core/contracts/interfaces/pool/IUniswapV3PoolOwnerActions.sol": { - "content": "// SPDX-License-Identifier: GPL-2.0-or-later\npragma solidity >=0.5.0;\n\n/// @title Permissioned pool actions\n/// @notice Contains pool methods that may only be called by the factory owner\ninterface IUniswapV3PoolOwnerActions {\n /// @notice Set the denominator of the protocol's % share of the fees\n /// @param feeProtocol0 new protocol fee for token0 of the pool\n /// @param feeProtocol1 new protocol fee for token1 of the pool\n function setFeeProtocol(uint8 feeProtocol0, uint8 feeProtocol1) external;\n\n /// @notice Collect the protocol fee accrued to the pool\n /// @param recipient The address to which collected protocol fees should be sent\n /// @param amount0Requested The maximum amount of token0 to send, can be 0 to collect fees in only token1\n /// @param amount1Requested The maximum amount of token1 to send, can be 0 to collect fees in only token0\n /// @return amount0 The protocol fee collected in token0\n /// @return amount1 The protocol fee collected in token1\n function collectProtocol(\n address recipient,\n uint128 amount0Requested,\n uint128 amount1Requested\n ) external returns (uint128 amount0, uint128 amount1);\n}\n" - }, - "@uniswap/v3-core/contracts/interfaces/pool/IUniswapV3PoolEvents.sol": { - "content": "// SPDX-License-Identifier: GPL-2.0-or-later\npragma solidity >=0.5.0;\n\n/// @title Events emitted by a pool\n/// @notice Contains all events emitted by the pool\ninterface IUniswapV3PoolEvents {\n /// @notice Emitted exactly once by a pool when #initialize is first called on the pool\n /// @dev Mint/Burn/Swap cannot be emitted by the pool before Initialize\n /// @param sqrtPriceX96 The initial sqrt price of the pool, as a Q64.96\n /// @param tick The initial tick of the pool, i.e. log base 1.0001 of the starting price of the pool\n event Initialize(uint160 sqrtPriceX96, int24 tick);\n\n /// @notice Emitted when liquidity is minted for a given position\n /// @param sender The address that minted the liquidity\n /// @param owner The owner of the position and recipient of any minted liquidity\n /// @param tickLower The lower tick of the position\n /// @param tickUpper The upper tick of the position\n /// @param amount The amount of liquidity minted to the position range\n /// @param amount0 How much token0 was required for the minted liquidity\n /// @param amount1 How much token1 was required for the minted liquidity\n event Mint(\n address sender,\n address indexed owner,\n int24 indexed tickLower,\n int24 indexed tickUpper,\n uint128 amount,\n uint256 amount0,\n uint256 amount1\n );\n\n /// @notice Emitted when fees are collected by the owner of a position\n /// @dev Collect events may be emitted with zero amount0 and amount1 when the caller chooses not to collect fees\n /// @param owner The owner of the position for which fees are collected\n /// @param tickLower The lower tick of the position\n /// @param tickUpper The upper tick of the position\n /// @param amount0 The amount of token0 fees collected\n /// @param amount1 The amount of token1 fees collected\n event Collect(\n address indexed owner,\n address recipient,\n int24 indexed tickLower,\n int24 indexed tickUpper,\n uint128 amount0,\n uint128 amount1\n );\n\n /// @notice Emitted when a position's liquidity is removed\n /// @dev Does not withdraw any fees earned by the liquidity position, which must be withdrawn via #collect\n /// @param owner The owner of the position for which liquidity is removed\n /// @param tickLower The lower tick of the position\n /// @param tickUpper The upper tick of the position\n /// @param amount The amount of liquidity to remove\n /// @param amount0 The amount of token0 withdrawn\n /// @param amount1 The amount of token1 withdrawn\n event Burn(\n address indexed owner,\n int24 indexed tickLower,\n int24 indexed tickUpper,\n uint128 amount,\n uint256 amount0,\n uint256 amount1\n );\n\n /// @notice Emitted by the pool for any swaps between token0 and token1\n /// @param sender The address that initiated the swap call, and that received the callback\n /// @param recipient The address that received the output of the swap\n /// @param amount0 The delta of the token0 balance of the pool\n /// @param amount1 The delta of the token1 balance of the pool\n /// @param sqrtPriceX96 The sqrt(price) of the pool after the swap, as a Q64.96\n /// @param liquidity The liquidity of the pool after the swap\n /// @param tick The log base 1.0001 of price of the pool after the swap\n event Swap(\n address indexed sender,\n address indexed recipient,\n int256 amount0,\n int256 amount1,\n uint160 sqrtPriceX96,\n uint128 liquidity,\n int24 tick\n );\n\n /// @notice Emitted by the pool for any flashes of token0/token1\n /// @param sender The address that initiated the swap call, and that received the callback\n /// @param recipient The address that received the tokens from flash\n /// @param amount0 The amount of token0 that was flashed\n /// @param amount1 The amount of token1 that was flashed\n /// @param paid0 The amount of token0 paid for the flash, which can exceed the amount0 plus the fee\n /// @param paid1 The amount of token1 paid for the flash, which can exceed the amount1 plus the fee\n event Flash(\n address indexed sender,\n address indexed recipient,\n uint256 amount0,\n uint256 amount1,\n uint256 paid0,\n uint256 paid1\n );\n\n /// @notice Emitted by the pool for increases to the number of observations that can be stored\n /// @dev observationCardinalityNext is not the observation cardinality until an observation is written at the index\n /// just before a mint/swap/burn.\n /// @param observationCardinalityNextOld The previous value of the next observation cardinality\n /// @param observationCardinalityNextNew The updated value of the next observation cardinality\n event IncreaseObservationCardinalityNext(\n uint16 observationCardinalityNextOld,\n uint16 observationCardinalityNextNew\n );\n\n /// @notice Emitted when the protocol fee is changed by the pool\n /// @param feeProtocol0Old The previous value of the token0 protocol fee\n /// @param feeProtocol1Old The previous value of the token1 protocol fee\n /// @param feeProtocol0New The updated value of the token0 protocol fee\n /// @param feeProtocol1New The updated value of the token1 protocol fee\n event SetFeeProtocol(uint8 feeProtocol0Old, uint8 feeProtocol1Old, uint8 feeProtocol0New, uint8 feeProtocol1New);\n\n /// @notice Emitted when the collected protocol fees are withdrawn by the factory owner\n /// @param sender The address that collects the protocol fees\n /// @param recipient The address that receives the collected protocol fees\n /// @param amount0 The amount of token0 protocol fees that is withdrawn\n /// @param amount0 The amount of token1 protocol fees that is withdrawn\n event CollectProtocol(address indexed sender, address indexed recipient, uint128 amount0, uint128 amount1);\n}\n" - }, - "solidity/for-test/UniV3PairManagerForTest.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '@openzeppelin/contracts/token/ERC20/ERC20.sol';\nimport '@uniswap/v3-core/contracts/interfaces/IUniswapV3Pool.sol';\n\nimport '../contracts/libraries/LiquidityAmounts.sol';\nimport '../contracts/libraries/FixedPoint96.sol';\nimport '../contracts/libraries/FullMath.sol';\nimport '../contracts/libraries/TickMath.sol';\nimport '../contracts/UniV3PairManager.sol';\nimport '../interfaces/external/IWeth9.sol';\nimport '../interfaces/IUniV3PairManager.sol';\n\ncontract UniV3PairManagerForTest is UniV3PairManager {\n constructor(address _pool, address _governance) UniV3PairManager(_pool, _governance) {}\n\n function internalAddLiquidity(\n uint256 amount0Desired,\n uint256 amount1Desired,\n uint256 amount0Min,\n uint256 amount1Min\n )\n external\n returns (\n uint128 liquidity,\n uint256 amount0,\n uint256 amount1\n )\n {\n return _addLiquidity(amount0Desired, amount1Desired, amount0Min, amount1Min);\n }\n\n function internalPay(\n address token,\n address payer,\n address recipient,\n uint256 value\n ) external {\n return _pay(token, payer, recipient, value);\n }\n\n function internalMint(address dst, uint256 amount) external {\n return _mint(dst, amount);\n }\n\n function internalBurn(address dst, uint256 amount) external {\n return _burn(dst, amount);\n }\n\n function internalTransferTokens(\n address src,\n address dst,\n uint256 amount\n ) external {\n _transferTokens(src, dst, amount);\n }\n\n function internalSafeTransferFrom(\n address token,\n address from,\n address to,\n uint256 value\n ) external {\n _safeTransferFrom(token, from, to, value);\n }\n\n receive() external payable {}\n}\n" - }, - "@openzeppelin/contracts/token/ERC20/ERC20.sol": { - "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\nimport \"./IERC20.sol\";\nimport \"./extensions/IERC20Metadata.sol\";\nimport \"../../utils/Context.sol\";\n\n/**\n * @dev Implementation of the {IERC20} interface.\n *\n * This implementation is agnostic to the way tokens are created. This means\n * that a supply mechanism has to be added in a derived contract using {_mint}.\n * For a generic mechanism see {ERC20PresetMinterPauser}.\n *\n * TIP: For a detailed writeup see our guide\n * https://forum.zeppelin.solutions/t/how-to-implement-erc20-supply-mechanisms/226[How\n * to implement supply mechanisms].\n *\n * We have followed general OpenZeppelin Contracts guidelines: functions revert\n * instead returning `false` on failure. This behavior is nonetheless\n * conventional and does not conflict with the expectations of ERC20\n * applications.\n *\n * Additionally, an {Approval} event is emitted on calls to {transferFrom}.\n * This allows applications to reconstruct the allowance for all accounts just\n * by listening to said events. Other implementations of the EIP may not emit\n * these events, as it isn't required by the specification.\n *\n * Finally, the non-standard {decreaseAllowance} and {increaseAllowance}\n * functions have been added to mitigate the well-known issues around setting\n * allowances. See {IERC20-approve}.\n */\ncontract ERC20 is Context, IERC20, IERC20Metadata {\n mapping(address => uint256) private _balances;\n\n mapping(address => mapping(address => uint256)) private _allowances;\n\n uint256 private _totalSupply;\n\n string private _name;\n string private _symbol;\n\n /**\n * @dev Sets the values for {name} and {symbol}.\n *\n * The default value of {decimals} is 18. To select a different value for\n * {decimals} you should overload it.\n *\n * All two of these values are immutable: they can only be set once during\n * construction.\n */\n constructor(string memory name_, string memory symbol_) {\n _name = name_;\n _symbol = symbol_;\n }\n\n /**\n * @dev Returns the name of the token.\n */\n function name() public view virtual override returns (string memory) {\n return _name;\n }\n\n /**\n * @dev Returns the symbol of the token, usually a shorter version of the\n * name.\n */\n function symbol() public view virtual override returns (string memory) {\n return _symbol;\n }\n\n /**\n * @dev Returns the number of decimals used to get its user representation.\n * For example, if `decimals` equals `2`, a balance of `505` tokens should\n * be displayed to a user as `5.05` (`505 / 10 ** 2`).\n *\n * Tokens usually opt for a value of 18, imitating the relationship between\n * Ether and Wei. This is the value {ERC20} uses, unless this function is\n * overridden;\n *\n * NOTE: This information is only used for _display_ purposes: it in\n * no way affects any of the arithmetic of the contract, including\n * {IERC20-balanceOf} and {IERC20-transfer}.\n */\n function decimals() public view virtual override returns (uint8) {\n return 18;\n }\n\n /**\n * @dev See {IERC20-totalSupply}.\n */\n function totalSupply() public view virtual override returns (uint256) {\n return _totalSupply;\n }\n\n /**\n * @dev See {IERC20-balanceOf}.\n */\n function balanceOf(address account) public view virtual override returns (uint256) {\n return _balances[account];\n }\n\n /**\n * @dev See {IERC20-transfer}.\n *\n * Requirements:\n *\n * - `recipient` cannot be the zero address.\n * - the caller must have a balance of at least `amount`.\n */\n function transfer(address recipient, uint256 amount) public virtual override returns (bool) {\n _transfer(_msgSender(), recipient, amount);\n return true;\n }\n\n /**\n * @dev See {IERC20-allowance}.\n */\n function allowance(address owner, address spender) public view virtual override returns (uint256) {\n return _allowances[owner][spender];\n }\n\n /**\n * @dev See {IERC20-approve}.\n *\n * Requirements:\n *\n * - `spender` cannot be the zero address.\n */\n function approve(address spender, uint256 amount) public virtual override returns (bool) {\n _approve(_msgSender(), spender, amount);\n return true;\n }\n\n /**\n * @dev See {IERC20-transferFrom}.\n *\n * Emits an {Approval} event indicating the updated allowance. This is not\n * required by the EIP. See the note at the beginning of {ERC20}.\n *\n * Requirements:\n *\n * - `sender` and `recipient` cannot be the zero address.\n * - `sender` must have a balance of at least `amount`.\n * - the caller must have allowance for ``sender``'s tokens of at least\n * `amount`.\n */\n function transferFrom(\n address sender,\n address recipient,\n uint256 amount\n ) public virtual override returns (bool) {\n _transfer(sender, recipient, amount);\n\n uint256 currentAllowance = _allowances[sender][_msgSender()];\n require(currentAllowance >= amount, \"ERC20: transfer amount exceeds allowance\");\n unchecked {\n _approve(sender, _msgSender(), currentAllowance - amount);\n }\n\n return true;\n }\n\n /**\n * @dev Atomically increases the allowance granted to `spender` by the caller.\n *\n * This is an alternative to {approve} that can be used as a mitigation for\n * problems described in {IERC20-approve}.\n *\n * Emits an {Approval} event indicating the updated allowance.\n *\n * Requirements:\n *\n * - `spender` cannot be the zero address.\n */\n function increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool) {\n _approve(_msgSender(), spender, _allowances[_msgSender()][spender] + addedValue);\n return true;\n }\n\n /**\n * @dev Atomically decreases the allowance granted to `spender` by the caller.\n *\n * This is an alternative to {approve} that can be used as a mitigation for\n * problems described in {IERC20-approve}.\n *\n * Emits an {Approval} event indicating the updated allowance.\n *\n * Requirements:\n *\n * - `spender` cannot be the zero address.\n * - `spender` must have allowance for the caller of at least\n * `subtractedValue`.\n */\n function decreaseAllowance(address spender, uint256 subtractedValue) public virtual returns (bool) {\n uint256 currentAllowance = _allowances[_msgSender()][spender];\n require(currentAllowance >= subtractedValue, \"ERC20: decreased allowance below zero\");\n unchecked {\n _approve(_msgSender(), spender, currentAllowance - subtractedValue);\n }\n\n return true;\n }\n\n /**\n * @dev Moves `amount` of tokens from `sender` to `recipient`.\n *\n * This internal function is equivalent to {transfer}, and can be used to\n * e.g. implement automatic token fees, slashing mechanisms, etc.\n *\n * Emits a {Transfer} event.\n *\n * Requirements:\n *\n * - `sender` cannot be the zero address.\n * - `recipient` cannot be the zero address.\n * - `sender` must have a balance of at least `amount`.\n */\n function _transfer(\n address sender,\n address recipient,\n uint256 amount\n ) internal virtual {\n require(sender != address(0), \"ERC20: transfer from the zero address\");\n require(recipient != address(0), \"ERC20: transfer to the zero address\");\n\n _beforeTokenTransfer(sender, recipient, amount);\n\n uint256 senderBalance = _balances[sender];\n require(senderBalance >= amount, \"ERC20: transfer amount exceeds balance\");\n unchecked {\n _balances[sender] = senderBalance - amount;\n }\n _balances[recipient] += amount;\n\n emit Transfer(sender, recipient, amount);\n\n _afterTokenTransfer(sender, recipient, amount);\n }\n\n /** @dev Creates `amount` tokens and assigns them to `account`, increasing\n * the total supply.\n *\n * Emits a {Transfer} event with `from` set to the zero address.\n *\n * Requirements:\n *\n * - `account` cannot be the zero address.\n */\n function _mint(address account, uint256 amount) internal virtual {\n require(account != address(0), \"ERC20: mint to the zero address\");\n\n _beforeTokenTransfer(address(0), account, amount);\n\n _totalSupply += amount;\n _balances[account] += amount;\n emit Transfer(address(0), account, amount);\n\n _afterTokenTransfer(address(0), account, amount);\n }\n\n /**\n * @dev Destroys `amount` tokens from `account`, reducing the\n * total supply.\n *\n * Emits a {Transfer} event with `to` set to the zero address.\n *\n * Requirements:\n *\n * - `account` cannot be the zero address.\n * - `account` must have at least `amount` tokens.\n */\n function _burn(address account, uint256 amount) internal virtual {\n require(account != address(0), \"ERC20: burn from the zero address\");\n\n _beforeTokenTransfer(account, address(0), amount);\n\n uint256 accountBalance = _balances[account];\n require(accountBalance >= amount, \"ERC20: burn amount exceeds balance\");\n unchecked {\n _balances[account] = accountBalance - amount;\n }\n _totalSupply -= amount;\n\n emit Transfer(account, address(0), amount);\n\n _afterTokenTransfer(account, address(0), amount);\n }\n\n /**\n * @dev Sets `amount` as the allowance of `spender` over the `owner` s tokens.\n *\n * This internal function is equivalent to `approve`, and can be used to\n * e.g. set automatic allowances for certain subsystems, etc.\n *\n * Emits an {Approval} event.\n *\n * Requirements:\n *\n * - `owner` cannot be the zero address.\n * - `spender` cannot be the zero address.\n */\n function _approve(\n address owner,\n address spender,\n uint256 amount\n ) internal virtual {\n require(owner != address(0), \"ERC20: approve from the zero address\");\n require(spender != address(0), \"ERC20: approve to the zero address\");\n\n _allowances[owner][spender] = amount;\n emit Approval(owner, spender, amount);\n }\n\n /**\n * @dev Hook that is called before any transfer of tokens. This includes\n * minting and burning.\n *\n * Calling conditions:\n *\n * - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens\n * will be transferred to `to`.\n * - when `from` is zero, `amount` tokens will be minted for `to`.\n * - when `to` is zero, `amount` of ``from``'s tokens will be burned.\n * - `from` and `to` are never both zero.\n *\n * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].\n */\n function _beforeTokenTransfer(\n address from,\n address to,\n uint256 amount\n ) internal virtual {}\n\n /**\n * @dev Hook that is called after any transfer of tokens. This includes\n * minting and burning.\n *\n * Calling conditions:\n *\n * - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens\n * has been transferred to `to`.\n * - when `from` is zero, `amount` tokens have been minted for `to`.\n * - when `to` is zero, `amount` of ``from``'s tokens have been burned.\n * - `from` and `to` are never both zero.\n *\n * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].\n */\n function _afterTokenTransfer(\n address from,\n address to,\n uint256 amount\n ) internal virtual {}\n}\n" - }, - "solidity/contracts/libraries/LiquidityAmounts.sol": { - "content": "// SPDX-License-Identifier: GPL-2.0-or-later\npragma solidity >=0.8.4 <0.9.0;\n\nimport './FullMath.sol';\nimport './FixedPoint96.sol';\n\n// solhint-disable\nlibrary LiquidityAmounts {\n function toUint128(uint256 x) private pure returns (uint128 y) {\n require((y = uint128(x)) == x);\n }\n\n function getLiquidityForAmount0(\n uint160 sqrtRatioAX96,\n uint160 sqrtRatioBX96,\n uint256 amount0\n ) internal pure returns (uint128 liquidity) {\n if (sqrtRatioAX96 > sqrtRatioBX96) (sqrtRatioAX96, sqrtRatioBX96) = (sqrtRatioBX96, sqrtRatioAX96);\n uint256 intermediate = FullMath.mulDiv(sqrtRatioAX96, sqrtRatioBX96, FixedPoint96.Q96);\n return toUint128(FullMath.mulDiv(amount0, intermediate, sqrtRatioBX96 - sqrtRatioAX96));\n }\n\n function getLiquidityForAmount1(\n uint160 sqrtRatioAX96,\n uint160 sqrtRatioBX96,\n uint256 amount1\n ) internal pure returns (uint128 liquidity) {\n if (sqrtRatioAX96 > sqrtRatioBX96) (sqrtRatioAX96, sqrtRatioBX96) = (sqrtRatioBX96, sqrtRatioAX96);\n return toUint128(FullMath.mulDiv(amount1, FixedPoint96.Q96, sqrtRatioBX96 - sqrtRatioAX96));\n }\n\n function getLiquidityForAmounts(\n uint160 sqrtRatioX96,\n uint160 sqrtRatioAX96,\n uint160 sqrtRatioBX96,\n uint256 amount0,\n uint256 amount1\n ) internal pure returns (uint128 liquidity) {\n if (sqrtRatioAX96 > sqrtRatioBX96) (sqrtRatioAX96, sqrtRatioBX96) = (sqrtRatioBX96, sqrtRatioAX96);\n\n if (sqrtRatioX96 <= sqrtRatioAX96) {\n liquidity = getLiquidityForAmount0(sqrtRatioAX96, sqrtRatioBX96, amount0);\n } else if (sqrtRatioX96 < sqrtRatioBX96) {\n uint128 liquidity0 = getLiquidityForAmount0(sqrtRatioX96, sqrtRatioBX96, amount0);\n uint128 liquidity1 = getLiquidityForAmount1(sqrtRatioAX96, sqrtRatioX96, amount1);\n\n liquidity = liquidity0 < liquidity1 ? liquidity0 : liquidity1;\n } else {\n liquidity = getLiquidityForAmount1(sqrtRatioAX96, sqrtRatioBX96, amount1);\n }\n }\n\n function getAmount0ForLiquidity(\n uint160 sqrtRatioAX96,\n uint160 sqrtRatioBX96,\n uint128 liquidity\n ) internal pure returns (uint256 amount0) {\n if (sqrtRatioAX96 > sqrtRatioBX96) (sqrtRatioAX96, sqrtRatioBX96) = (sqrtRatioBX96, sqrtRatioAX96);\n\n return FullMath.mulDiv(uint256(liquidity) << FixedPoint96.RESOLUTION, sqrtRatioBX96 - sqrtRatioAX96, sqrtRatioBX96) / sqrtRatioAX96;\n }\n\n function getAmount1ForLiquidity(\n uint160 sqrtRatioAX96,\n uint160 sqrtRatioBX96,\n uint128 liquidity\n ) internal pure returns (uint256 amount1) {\n if (sqrtRatioAX96 > sqrtRatioBX96) (sqrtRatioAX96, sqrtRatioBX96) = (sqrtRatioBX96, sqrtRatioAX96);\n\n return FullMath.mulDiv(liquidity, sqrtRatioBX96 - sqrtRatioAX96, FixedPoint96.Q96);\n }\n\n function getAmountsForLiquidity(\n uint160 sqrtRatioX96,\n uint160 sqrtRatioAX96,\n uint160 sqrtRatioBX96,\n uint128 liquidity\n ) internal pure returns (uint256 amount0, uint256 amount1) {\n if (sqrtRatioAX96 > sqrtRatioBX96) (sqrtRatioAX96, sqrtRatioBX96) = (sqrtRatioBX96, sqrtRatioAX96);\n\n if (sqrtRatioX96 <= sqrtRatioAX96) {\n amount0 = getAmount0ForLiquidity(sqrtRatioAX96, sqrtRatioBX96, liquidity);\n } else if (sqrtRatioX96 < sqrtRatioBX96) {\n amount0 = getAmount0ForLiquidity(sqrtRatioX96, sqrtRatioBX96, liquidity);\n amount1 = getAmount1ForLiquidity(sqrtRatioAX96, sqrtRatioX96, liquidity);\n } else {\n amount1 = getAmount1ForLiquidity(sqrtRatioAX96, sqrtRatioBX96, liquidity);\n }\n }\n}\n" - }, - "solidity/contracts/libraries/FixedPoint96.sol": { - "content": "// SPDX-License-Identifier: GPL-2.0-or-later\npragma solidity >=0.8.4 <0.9.0;\n\nlibrary FixedPoint96 {\n // solhint-disable\n uint8 internal constant RESOLUTION = 96;\n uint256 internal constant Q96 = 0x1000000000000000000000000;\n}\n" - }, - "solidity/contracts/UniV3PairManager.sol": { - "content": "// SPDX-License-Identifier: MIT\n\n/*\n\nCoded for The Keep3r Network with ♥ by\n\n██████╗░███████╗███████╗██╗  ░██╗░░░░░░░██╗░█████╗░███╗░░██╗██████╗░███████╗██████╗░██╗░░░░░░█████╗░███╗░░██╗██████╗░\n██╔══██╗██╔════╝██╔════╝██║  ░██║░░██╗░░██║██╔══██╗████╗░██║██╔══██╗██╔════╝██╔══██╗██║░░░░░██╔══██╗████╗░██║██╔══██╗\n██║░░██║█████╗░░█████╗░░██║  ░╚██╗████╗██╔╝██║░░██║██╔██╗██║██║░░██║█████╗░░██████╔╝██║░░░░░███████║██╔██╗██║██║░░██║\n██║░░██║██╔══╝░░██╔══╝░░██║  ░░████╔═████║░██║░░██║██║╚████║██║░░██║██╔══╝░░██╔══██╗██║░░░░░██╔══██║██║╚████║██║░░██║\n██████╔╝███████╗██║░░░░░██║  ░░╚██╔╝░╚██╔╝░╚█████╔╝██║░╚███║██████╔╝███████╗██║░░██║███████╗██║░░██║██║░╚███║██████╔╝\n╚═════╝░╚══════╝╚═╝░░░░░╚═╝  ░░░╚═╝░░░╚═╝░░░╚════╝░╚═╝░░╚══╝╚═════╝░╚══════╝╚═╝░░╚═╝╚══════╝╚═╝░░╚═╝╚═╝░░╚══╝╚═════╝░\n\nhttps://defi.sucks\n\n*/\n\npragma solidity >=0.8.4 <0.9.0;\n\nimport '@openzeppelin/contracts/token/ERC20/ERC20.sol';\nimport '@uniswap/v3-core/contracts/interfaces/IUniswapV3Pool.sol';\n\nimport './libraries/LiquidityAmounts.sol';\nimport './libraries/FixedPoint96.sol';\nimport './libraries/FullMath.sol';\nimport './libraries/TickMath.sol';\n\nimport '../interfaces/external/IWeth9.sol';\nimport '../interfaces/IUniV3PairManager.sol';\n\nimport './peripherals/Governable.sol';\n\ncontract UniV3PairManager is IUniV3PairManager, Governable {\n /// @inheritdoc IERC20Metadata\n string public override name;\n\n /// @inheritdoc IERC20Metadata\n string public override symbol;\n\n /// @inheritdoc IERC20\n uint256 public override totalSupply;\n\n /// @inheritdoc IPairManager\n address public immutable override factory;\n\n /// @inheritdoc IPairManager\n address public immutable override token0;\n\n /// @inheritdoc IPairManager\n address public immutable override token1;\n\n /// @inheritdoc IPairManager\n address public immutable override pool;\n\n /// @inheritdoc IUniV3PairManager\n uint24 public immutable override fee;\n\n /// @inheritdoc IUniV3PairManager\n uint160 public immutable override sqrtRatioAX96;\n\n /// @inheritdoc IUniV3PairManager\n uint160 public immutable override sqrtRatioBX96;\n\n /// @inheritdoc IUniV3PairManager\n int24 public immutable override tickLower;\n\n /// @inheritdoc IUniV3PairManager\n int24 public immutable override tickUpper;\n\n /// @inheritdoc IUniV3PairManager\n int24 public immutable override tickSpacing;\n\n /// @notice Uniswap's maximum tick\n /// @dev Due to tick spacing, pools with different fees may have differences between _MAX_TICK and tickUpper. Use tickUpper to find the max tick of the pool.\n int24 private constant _MAX_TICK = 887272;\n\n /// @inheritdoc IERC20Metadata\n //solhint-disable-next-line const-name-snakecase\n uint8 public constant override decimals = 18;\n\n /// @inheritdoc IERC20\n mapping(address => mapping(address => uint256)) public override allowance;\n\n /// @inheritdoc IERC20\n mapping(address => uint256) public override balanceOf;\n\n /// @notice Struct that contains token0, token1, and fee of the Uniswap pool\n PoolKey private _poolKey;\n\n constructor(address _pool, address _governance) Governable(_governance) {\n uint24 _fee = IUniswapV3Pool(_pool).fee();\n address _token0 = IUniswapV3Pool(_pool).token0();\n address _token1 = IUniswapV3Pool(_pool).token1();\n int24 _tickSpacing = IUniswapV3Pool(_pool).tickSpacing();\n int24 _tickUpper = _MAX_TICK - (_MAX_TICK % _tickSpacing);\n int24 _tickLower = -_tickUpper;\n\n factory = msg.sender;\n pool = _pool;\n fee = _fee;\n tickSpacing = _tickSpacing;\n tickUpper = _tickUpper;\n tickLower = _tickLower;\n token0 = _token0;\n token1 = _token1;\n name = string(abi.encodePacked('Keep3rLP - ', ERC20(_token0).symbol(), '/', ERC20(_token1).symbol()));\n symbol = string(abi.encodePacked('kLP-', ERC20(_token0).symbol(), '/', ERC20(_token1).symbol()));\n\n sqrtRatioAX96 = TickMath.getSqrtRatioAtTick(_tickLower);\n sqrtRatioBX96 = TickMath.getSqrtRatioAtTick(_tickUpper);\n _poolKey = PoolKey({token0: _token0, token1: _token1, fee: _fee});\n }\n\n // This low-level function should be called from a contract which performs important safety checks\n /// @inheritdoc IUniV3PairManager\n function mint(\n uint256 amount0Desired,\n uint256 amount1Desired,\n uint256 amount0Min,\n uint256 amount1Min,\n address to\n ) external override returns (uint128 liquidity) {\n (liquidity, , ) = _addLiquidity(amount0Desired, amount1Desired, amount0Min, amount1Min);\n _mint(to, liquidity);\n }\n\n /// @inheritdoc IUniV3PairManager\n function uniswapV3MintCallback(\n uint256 amount0Owed,\n uint256 amount1Owed,\n bytes calldata data\n ) external override {\n MintCallbackData memory decoded = abi.decode(data, (MintCallbackData));\n if (msg.sender != pool) revert OnlyPool();\n if (amount0Owed > 0) _pay(decoded._poolKey.token0, decoded.payer, pool, amount0Owed);\n if (amount1Owed > 0) _pay(decoded._poolKey.token1, decoded.payer, pool, amount1Owed);\n }\n\n /// @inheritdoc IUniV3PairManager\n function burn(\n uint128 liquidity,\n uint256 amount0Min,\n uint256 amount1Min,\n address to\n ) external override returns (uint256 amount0, uint256 amount1) {\n (amount0, amount1) = IUniswapV3Pool(pool).burn(tickLower, tickUpper, liquidity);\n\n if (amount0 < amount0Min || amount1 < amount1Min) revert ExcessiveSlippage();\n\n IUniswapV3Pool(pool).collect(to, tickLower, tickUpper, uint128(amount0), uint128(amount1));\n _burn(msg.sender, liquidity);\n }\n\n /// @inheritdoc IUniV3PairManager\n function collect() external override onlyGovernance returns (uint256 amount0, uint256 amount1) {\n (, , , uint128 tokensOwed0, uint128 tokensOwed1) = IUniswapV3Pool(pool).positions(\n keccak256(abi.encodePacked(address(this), tickLower, tickUpper))\n );\n (amount0, amount1) = IUniswapV3Pool(pool).collect(governance, tickLower, tickUpper, tokensOwed0, tokensOwed1);\n }\n\n /// @inheritdoc IUniV3PairManager\n function position()\n external\n view\n override\n returns (\n uint128 liquidity,\n uint256 feeGrowthInside0LastX128,\n uint256 feeGrowthInside1LastX128,\n uint128 tokensOwed0,\n uint128 tokensOwed1\n )\n {\n (liquidity, feeGrowthInside0LastX128, feeGrowthInside1LastX128, tokensOwed0, tokensOwed1) = IUniswapV3Pool(pool).positions(\n keccak256(abi.encodePacked(address(this), tickLower, tickUpper))\n );\n }\n\n /// @inheritdoc IERC20\n function approve(address spender, uint256 amount) external override returns (bool) {\n allowance[msg.sender][spender] = amount;\n\n emit Approval(msg.sender, spender, amount);\n return true;\n }\n\n /// @inheritdoc IERC20\n function transfer(address to, uint256 amount) external override returns (bool) {\n _transferTokens(msg.sender, to, amount);\n return true;\n }\n\n /// @inheritdoc IERC20\n function transferFrom(\n address from,\n address to,\n uint256 amount\n ) external override returns (bool) {\n address spender = msg.sender;\n uint256 spenderAllowance = allowance[from][spender];\n\n if (spender != from && spenderAllowance != type(uint256).max) {\n uint256 newAllowance = spenderAllowance - amount;\n allowance[from][spender] = newAllowance;\n\n emit Approval(from, spender, newAllowance);\n }\n\n _transferTokens(from, to, amount);\n return true;\n }\n\n /// @notice Adds liquidity to an initialized pool\n /// @dev Reverts if the returned amount0 is less than amount0Min or if amount1 is less than amount1Min\n /// @dev This function calls the mint function of the corresponding Uniswap pool, which in turn calls UniswapV3Callback\n /// @param amount0Desired The amount of token0 we would like to provide\n /// @param amount1Desired The amount of token1 we would like to provide\n /// @param amount0Min The minimum amount of token0 we want to provide\n /// @param amount1Min The minimum amount of token1 we want to provide\n /// @return liquidity The calculated liquidity we get for the token amounts we provided\n /// @return amount0 The amount of token0 we ended up providing\n /// @return amount1 The amount of token1 we ended up providing\n function _addLiquidity(\n uint256 amount0Desired,\n uint256 amount1Desired,\n uint256 amount0Min,\n uint256 amount1Min\n )\n internal\n returns (\n uint128 liquidity,\n uint256 amount0,\n uint256 amount1\n )\n {\n (uint160 sqrtPriceX96, , , , , , ) = IUniswapV3Pool(pool).slot0();\n\n liquidity = LiquidityAmounts.getLiquidityForAmounts(sqrtPriceX96, sqrtRatioAX96, sqrtRatioBX96, amount0Desired, amount1Desired);\n\n (amount0, amount1) = IUniswapV3Pool(pool).mint(\n address(this),\n tickLower,\n tickUpper,\n liquidity,\n abi.encode(MintCallbackData({_poolKey: _poolKey, payer: msg.sender}))\n );\n\n if (amount0 < amount0Min || amount1 < amount1Min) revert ExcessiveSlippage();\n }\n\n /// @notice Transfers the passed-in token from the payer to the recipient for the corresponding value\n /// @param token The token to be transferred to the recipient\n /// @param from The address of the payer\n /// @param to The address of the passed-in tokens recipient\n /// @param value How much of that token to be transferred from payer to the recipient\n function _pay(\n address token,\n address from,\n address to,\n uint256 value\n ) internal {\n _safeTransferFrom(token, from, to, value);\n }\n\n /// @notice Mints Keep3r credits to the passed-in address of recipient and increases total supply of Keep3r credits by the corresponding amount\n /// @param to The recipient of the Keep3r credits\n /// @param amount The amount Keep3r credits to be minted to the recipient\n function _mint(address to, uint256 amount) internal {\n totalSupply += amount;\n balanceOf[to] += amount;\n emit Transfer(address(0), to, amount);\n }\n\n /// @notice Burns Keep3r credits to the passed-in address of recipient and reduces total supply of Keep3r credits by the corresponding amount\n /// @param to The address that will get its Keep3r credits burned\n /// @param amount The amount Keep3r credits to be burned from the recipient/recipient\n function _burn(address to, uint256 amount) internal {\n totalSupply -= amount;\n balanceOf[to] -= amount;\n emit Transfer(to, address(0), amount);\n }\n\n /// @notice Transfers amount of Keep3r credits between two addresses\n /// @param from The user that transfers the Keep3r credits\n /// @param to The user that receives the Keep3r credits\n /// @param amount The amount of Keep3r credits to be transferred\n function _transferTokens(\n address from,\n address to,\n uint256 amount\n ) internal {\n balanceOf[from] -= amount;\n balanceOf[to] += amount;\n\n emit Transfer(from, to, amount);\n }\n\n /// @notice Transfers the passed-in token from the specified \"from\" to the specified \"to\" for the corresponding value\n /// @dev Reverts with IUniV3PairManager#UnsuccessfulTransfer if the transfer was not successful,\n /// or if the passed data length is different than 0 and the decoded data is not a boolean\n /// @param token The token to be transferred to the specified \"to\"\n /// @param from The address which is going to transfer the tokens\n /// @param value How much of that token to be transferred from \"from\" to \"to\"\n function _safeTransferFrom(\n address token,\n address from,\n address to,\n uint256 value\n ) internal {\n // solhint-disable-next-line avoid-low-level-calls\n (bool success, bytes memory data) = token.call(abi.encodeWithSelector(IERC20.transferFrom.selector, from, to, value));\n if (!success || (data.length != 0 && !abi.decode(data, (bool)))) revert UnsuccessfulTransfer();\n }\n}\n" - }, - "solidity/interfaces/external/IWeth9.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '@openzeppelin/contracts/token/ERC20/IERC20.sol';\n\ninterface IWeth9 is IERC20 {\n function deposit() external payable;\n\n function withdraw(uint256) external;\n}\n" - }, - "solidity/interfaces/IUniV3PairManager.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport './IPairManager.sol';\nimport '@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol';\nimport './peripherals/IGovernable.sol';\n\n/// @title Pair Manager contract\n/// @notice Creates a UniswapV3 position, and tokenizes in an ERC20 manner\n/// so that the user can use it as liquidity for a Keep3rJob\ninterface IUniV3PairManager is IGovernable, IPairManager {\n // Structs\n struct PoolKey {\n address token0;\n address token1;\n uint24 fee;\n }\n\n /// @notice The data to be decoded by the UniswapV3MintCallback function\n struct MintCallbackData {\n PoolKey _poolKey; // Struct that contains token0, token1, and fee of the pool passed into the constructor\n address payer; // The address of the payer, which will be the msg.sender of the mint function\n }\n\n // Variables\n\n /// @notice The fee of the Uniswap pool passed into the constructor\n /// @return _fee The fee of the Uniswap pool passed into the constructor\n function fee() external view returns (uint24 _fee);\n\n /// @notice Highest tick in the Uniswap's curve\n /// @return _tickUpper The highest tick in the Uniswap's curve\n function tickUpper() external view returns (int24 _tickUpper);\n\n /// @notice Lowest tick in the Uniswap's curve\n /// @return _tickLower The lower tick in the Uniswap's curve\n function tickLower() external view returns (int24 _tickLower);\n\n /// @notice The pair tick spacing\n /// @return _tickSpacing The pair tick spacing\n function tickSpacing() external view returns (int24 _tickSpacing);\n\n /// @notice The sqrtRatioAX96 at the lowest tick (-887200) of the Uniswap pool\n /// @return _sqrtPriceA96 A Fixed point Q64.96 number representing the sqrt of the ratio of the two assets (token1/token0)\n /// at the lowest tick\n function sqrtRatioAX96() external view returns (uint160 _sqrtPriceA96);\n\n /// @notice The sqrtRatioBX96 at the highest tick (887200) of the Uniswap pool\n /// @return _sqrtPriceBX96 A Fixed point Q64.96 number representing the sqrt of the ratio of the two assets (token1/token0)\n /// at the highest tick\n function sqrtRatioBX96() external view returns (uint160 _sqrtPriceBX96);\n\n // Errors\n\n /// @notice Throws when the caller of the function is not the pool\n error OnlyPool();\n\n /// @notice Throws when the slippage exceeds what the user is comfortable with\n error ExcessiveSlippage();\n\n /// @notice Throws when a transfer is unsuccessful\n error UnsuccessfulTransfer();\n\n // Methods\n\n /// @notice This function is called after a user calls IUniV3PairManager#mint function\n /// It ensures that any tokens owed to the pool are paid by the msg.sender of IUniV3PairManager#mint function\n /// @param amount0Owed The amount of token0 due to the pool for the minted liquidity\n /// @param amount1Owed The amount of token1 due to the pool for the minted liquidity\n /// @param data The encoded token0, token1, fee (_poolKey) and the payer (msg.sender) of the IUniV3PairManager#mint function\n function uniswapV3MintCallback(\n uint256 amount0Owed,\n uint256 amount1Owed,\n bytes calldata data\n ) external;\n\n /// @notice Mints kLP tokens to an address according to the liquidity the msg.sender provides to the UniswapV3 pool\n /// @dev Triggers UniV3PairManager#uniswapV3MintCallback\n /// @param amount0Desired The amount of token0 we would like to provide\n /// @param amount1Desired The amount of token1 we would like to provide\n /// @param amount0Min The minimum amount of token0 we want to provide\n /// @param amount1Min The minimum amount of token1 we want to provide\n /// @param to The address to which the kLP tokens are going to be minted to\n /// @return liquidity kLP tokens sent in exchange for the provision of tokens\n function mint(\n uint256 amount0Desired,\n uint256 amount1Desired,\n uint256 amount0Min,\n uint256 amount1Min,\n address to\n ) external returns (uint128 liquidity);\n\n /// @notice Returns the pair manager's position in the corresponding UniswapV3 pool\n /// @return liquidity The amount of liquidity provided to the UniswapV3 pool by the pair manager\n /// @return feeGrowthInside0LastX128 The fee growth of token0 as of the last action on the individual position\n /// @return feeGrowthInside1LastX128 The fee growth of token1 as of the last action on the individual position\n /// @return tokensOwed0 The uncollected amount of token0 owed to the position as of the last computation\n /// @return tokensOwed1 The uncollected amount of token1 owed to the position as of the last computation\n function position()\n external\n view\n returns (\n uint128 liquidity,\n uint256 feeGrowthInside0LastX128,\n uint256 feeGrowthInside1LastX128,\n uint128 tokensOwed0,\n uint128 tokensOwed1\n );\n\n /// @notice Calls the UniswapV3 pool's collect function, which collects up to a maximum amount of fees\n // owed to a specific position to the recipient, in this case, that recipient is the pair manager\n /// @dev The collected fees will be sent to governance\n /// @return amount0 The amount of fees collected in token0\n /// @return amount1 The amount of fees collected in token1\n function collect() external returns (uint256 amount0, uint256 amount1);\n\n /// @notice Burns the corresponding amount of kLP tokens from the msg.sender and withdraws the specified liquidity\n // in the entire range\n /// @param liquidity The amount of liquidity to be burned\n /// @param amount0Min The minimum amount of token0 we want to send to the recipient (to)\n /// @param amount1Min The minimum amount of token1 we want to send to the recipient (to)\n /// @param to The address that will receive the due fees\n /// @return amount0 The calculated amount of token0 that will be sent to the recipient\n /// @return amount1 The calculated amount of token1 that will be sent to the recipient\n function burn(\n uint128 liquidity,\n uint256 amount0Min,\n uint256 amount1Min,\n address to\n ) external returns (uint256 amount0, uint256 amount1);\n}\n" - }, - "@openzeppelin/contracts/utils/Context.sol": { - "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Provides information about the current execution context, including the\n * sender of the transaction and its data. While these are generally available\n * via msg.sender and msg.data, they should not be accessed in such a direct\n * manner, since when dealing with meta-transactions the account sending and\n * paying for execution may not be the actual sender (as far as an application\n * is concerned).\n *\n * This contract is only required for intermediate, library-like contracts.\n */\nabstract contract Context {\n function _msgSender() internal view virtual returns (address) {\n return msg.sender;\n }\n\n function _msgData() internal view virtual returns (bytes calldata) {\n return msg.data;\n }\n}\n" - }, - "solidity/interfaces/IPairManagerFactory.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport './peripherals/IGovernable.sol';\n\n/// @title Factory of Pair Managers\n/// @notice This contract creates new pair managers\ninterface IPairManagerFactory is IGovernable {\n // Variables\n\n /// @notice Maps the address of a Uniswap pool, to the address of the corresponding PairManager\n /// For example, the uniswap address of DAI-WETH, will return the Keep3r/DAI-WETH pair manager address\n /// @param _pool The address of the Uniswap pool\n /// @return _pairManager The address of the corresponding pair manager\n function pairManagers(address _pool) external view returns (address _pairManager);\n\n // Events\n\n /// @notice Emitted when a new pair manager is created\n /// @param _pool The address of the corresponding Uniswap pool\n /// @param _pairManager The address of the just-created pair manager\n event PairCreated(address _pool, address _pairManager);\n\n // Errors\n\n /// @notice Throws an error if the pair manager is already initialized\n error AlreadyInitialized();\n\n /// @notice Throws an error if the caller is not the owner\n error OnlyOwner();\n\n // Methods\n\n /// @notice Creates a new pair manager based on the address of a Uniswap pool\n /// For example, the uniswap address of DAI-WETH, will create the Keep3r/DAI-WETH pool\n /// @param _pool The address of the Uniswap pool the pair manager will be based of\n /// @return _pairManager The address of the just-created pair manager\n function createPairManager(address _pool) external returns (address _pairManager);\n}\n" - }, - "solidity/contracts/UniV3PairManagerFactory.sol": { - "content": "// SPDX-License-Identifier: MIT\n\n/*\n\nCoded for The Keep3r Network with ♥ by\n\n██████╗░███████╗███████╗██╗  ░██╗░░░░░░░██╗░█████╗░███╗░░██╗██████╗░███████╗██████╗░██╗░░░░░░█████╗░███╗░░██╗██████╗░\n██╔══██╗██╔════╝██╔════╝██║  ░██║░░██╗░░██║██╔══██╗████╗░██║██╔══██╗██╔════╝██╔══██╗██║░░░░░██╔══██╗████╗░██║██╔══██╗\n██║░░██║█████╗░░█████╗░░██║  ░╚██╗████╗██╔╝██║░░██║██╔██╗██║██║░░██║█████╗░░██████╔╝██║░░░░░███████║██╔██╗██║██║░░██║\n██║░░██║██╔══╝░░██╔══╝░░██║  ░░████╔═████║░██║░░██║██║╚████║██║░░██║██╔══╝░░██╔══██╗██║░░░░░██╔══██║██║╚████║██║░░██║\n██████╔╝███████╗██║░░░░░██║  ░░╚██╔╝░╚██╔╝░╚█████╔╝██║░╚███║██████╔╝███████╗██║░░██║███████╗██║░░██║██║░╚███║██████╔╝\n╚═════╝░╚══════╝╚═╝░░░░░╚═╝  ░░░╚═╝░░░╚═╝░░░╚════╝░╚═╝░░╚══╝╚═════╝░╚══════╝╚═╝░░╚═╝╚══════╝╚═╝░░╚═╝╚═╝░░╚══╝╚═════╝░\n\nhttps://defi.sucks\n\n*/\n\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../interfaces/IPairManagerFactory.sol';\nimport './UniV3PairManager.sol';\nimport './peripherals/Governable.sol';\n\n/// @title Factory of Pair Managers\n/// @notice This contract creates new pair managers\ncontract UniV3PairManagerFactory is IPairManagerFactory, Governable {\n mapping(address => address) public override pairManagers;\n\n constructor(address _governance) Governable(_governance) {}\n\n ///@inheritdoc IPairManagerFactory\n function createPairManager(address _pool) external override returns (address _pairManager) {\n if (pairManagers[_pool] != address(0)) revert AlreadyInitialized();\n _pairManager = address(new UniV3PairManager(_pool, governance));\n pairManagers[_pool] = _pairManager;\n emit PairCreated(_pool, _pairManager);\n }\n}\n" - }, - "solidity/for-test/peripherals/GovernableForTest.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../../contracts/peripherals/Governable.sol';\n\ncontract GovernableForTest is Governable {\n constructor(address _governor) Governable(_governor) {}\n}\n" - }, - "solidity/for-test/BridgeForTest.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.0 <0.9.0;\n\nimport '@openzeppelin/contracts/token/ERC20/ERC20.sol';\nimport '@openzeppelin/contracts/token/ERC20/IERC20.sol';\n\ncontract BridgeForTest is ERC20 {\n address public immutable kp3r;\n\n constructor(address _kp3r) ERC20('Wrapped KP3R', 'wKP3R') {\n kp3r = _kp3r;\n }\n\n function bridge(uint256 _amount) external {\n IERC20(kp3r).transferFrom(msg.sender, address(this), _amount);\n _mint(msg.sender, _amount);\n }\n\n function bridgeBack(uint256 _amount) external {\n _burn(msg.sender, _amount);\n IERC20(kp3r).transfer(msg.sender, _amount);\n }\n}\n" - }, - "solidity/for-test/ERC20ForTest.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '@openzeppelin/contracts/token/ERC20/ERC20.sol';\n\ncontract ERC20ForTest is ERC20 {\n constructor(\n string memory _name,\n string memory _symbol,\n address _initialAccount,\n uint256 _initialBalance\n ) ERC20(_name, _symbol) {\n _mint(_initialAccount, _initialBalance);\n }\n\n function mint(uint256 _amount) public {\n _mint(msg.sender, _amount);\n }\n\n function mint(address _account, uint256 _amount) public {\n _mint(_account, _amount);\n }\n\n function burn(uint256 _amount) public {\n _burn(msg.sender, _amount);\n }\n\n function burn(address _account, uint256 _amount) public {\n _burn(_account, _amount);\n }\n\n function transferInternal(\n address _from,\n address _to,\n uint256 _value\n ) public {\n _transfer(_from, _to, _value);\n }\n\n function approveInternal(\n address _owner,\n address _spender,\n uint256 _value\n ) public {\n _approve(_owner, _spender, _value);\n }\n\n function deposit() external payable {\n // Function added for compatibility with WETH\n }\n}\n" - }, - "solidity/for-test/peripherals/keepers/Keep3rKeeperFundableForTest.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../../../contracts/peripherals/keepers/Keep3rKeeperFundable.sol';\n\ncontract Keep3rKeeperFundableForTest is Keep3rKeeperFundable {\n using EnumerableSet for EnumerableSet.AddressSet;\n\n constructor(\n address _kph,\n address _keep3rV1,\n address _keep3rV1Proxy\n ) Keep3rParameters(_kph, _keep3rV1, _keep3rV1Proxy) Keep3rRoles(msg.sender) {}\n\n function isKeeper(address _keeper) external view returns (bool) {\n return _keepers.contains(_keeper);\n }\n\n function setJob(address job) external {\n _jobs.add(job);\n }\n}\n" - }, - "solidity/contracts/sidechain/Keep3rEscrow.sol": { - "content": "// SPDX-License-Identifier: MIT\n\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../peripherals/Mintable.sol';\nimport '../peripherals/DustCollector.sol';\nimport '../../interfaces/sidechain/IKeep3rEscrow.sol';\nimport '@openzeppelin/contracts/token/ERC20/IERC20.sol';\nimport '@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol';\n\ncontract Keep3rEscrow is Mintable, DustCollector, IKeep3rEscrow {\n using SafeERC20 for IERC20;\n\n /// @inheritdoc IKeep3rEscrow\n address public override wKP3R;\n\n /// @param _governance Address of governance\n /// @param _wKP3R Address of wrapped KP3R implementation\n constructor(address _governance, address _wKP3R) Mintable(_governance) {\n wKP3R = _wKP3R;\n }\n\n /// @inheritdoc IKeep3rEscrow\n function deposit(uint256 _amount) external override {\n IERC20(wKP3R).safeTransferFrom(msg.sender, address(this), _amount);\n emit wKP3RDeposited(wKP3R, msg.sender, _amount);\n }\n\n /// @inheritdoc IKeep3rEscrow\n function mint(uint256 _amount) external override onlyMinter {\n IERC20(wKP3R).safeTransfer(msg.sender, _amount);\n emit wKP3RMinted(wKP3R, msg.sender, _amount);\n }\n\n /// @inheritdoc IKeep3rEscrow\n function setWKP3R(address _wKP3R) external override onlyGovernance {\n if (_wKP3R == address(0)) revert ZeroAddress();\n wKP3R = _wKP3R;\n emit wKP3RSet(wKP3R);\n }\n}\n" - }, - "solidity/contracts/peripherals/Mintable.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../../interfaces/peripherals/IMintable.sol';\nimport './Governable.sol';\n\nabstract contract Mintable is Governable, IMintable {\n /// @inheritdoc IMintable\n address public override minter;\n\n constructor(address _governance) Governable(_governance) {}\n\n /// @inheritdoc IMintable\n function setMinter(address _minter) external override onlyGovernance {\n if (_minter == address(0)) revert ZeroAddress();\n minter = _minter;\n emit MinterSet(_minter);\n }\n\n /// @notice Functions with this modifier can only be called by the minter;\n modifier onlyMinter() {\n if (msg.sender != minter) revert OnlyMinter();\n _;\n }\n}\n" - }, - "solidity/for-test/peripherals/DustCollectorForTest.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../../contracts/peripherals/DustCollector.sol';\n\ncontract DustCollectorForTest is DustCollector {\n constructor() DustCollector() Governable(msg.sender) {}\n}\n" - }, - "solidity/for-test/peripherals/Keep3rAccountanceForTest.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../../contracts/peripherals/Keep3rAccountance.sol';\n\ncontract Keep3rAccountanceForTest is Keep3rAccountance {\n using EnumerableSet for EnumerableSet.AddressSet;\n\n constructor() Keep3rRoles(msg.sender) {}\n\n function setJob(address job) external {\n _jobs.add(job);\n }\n\n function setKeeper(address keeper) external {\n _keepers.add(keeper);\n }\n}\n" - }, - "solidity/for-test/peripherals/jobs/Keep3rJobFundableLiquidityForTest.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../../../contracts/peripherals/jobs/Keep3rJobFundableLiquidity.sol';\n\ncontract Keep3rJobFundableLiquidityForTest is Keep3rJobFundableLiquidity {\n using EnumerableSet for EnumerableSet.AddressSet;\n\n constructor(\n address _kph,\n address _keep3rV1,\n address _keep3rV1Proxy\n ) Keep3rParameters(_kph, _keep3rV1, _keep3rV1Proxy) Keep3rRoles(msg.sender) {}\n\n function setJob(address _job) external {\n _jobs.add(_job);\n }\n\n function setJobLiquidity(address _job, address _liquidity) external returns (bool) {\n return _jobLiquidities[_job].add(_liquidity);\n }\n\n function setApprovedLiquidity(address _liquidity) external {\n _approvedLiquidities.add(_liquidity);\n }\n\n function setRevokedLiquidity(address _liquidity) external {\n _approvedLiquidities.remove(_liquidity);\n }\n\n function viewTickCache(address _liquidity) external view returns (TickCache memory _tickCache) {\n _tickCache = _tick[_liquidity];\n }\n\n function viewTickOrder(address _liquidity) external view returns (bool) {\n return _isKP3RToken0[_liquidity];\n }\n\n function internalJobLiquidities(address _job) external view returns (address[] memory _list) {\n _list = _jobLiquidities[_job].values();\n }\n\n function internalSettleJobAccountance(address _job) external {\n _settleJobAccountance(_job);\n }\n}\n" - }, - "solidity/for-test/peripherals/jobs/Keep3rJobDisputableForTest.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../../../contracts/peripherals/jobs/Keep3rJobDisputable.sol';\n\ncontract Keep3rJobDisputableForTest is Keep3rJobDisputable {\n using EnumerableSet for EnumerableSet.AddressSet;\n\n constructor(\n address _kph,\n address _keep3rV1,\n address _keep3rV1Proxy\n ) Keep3rParameters(_kph, _keep3rV1, _keep3rV1Proxy) Keep3rRoles(msg.sender) {}\n\n function setJobLiquidity(address _job, address _liquidity) external {\n _jobLiquidities[_job].add(_liquidity);\n }\n\n function setJobToken(address _job, address _token) external {\n _jobTokens[_job].add(_token);\n }\n\n function setApprovedLiquidity(address _liquidity) external {\n _approvedLiquidities.add(_liquidity);\n }\n\n function setRevokedLiquidity(address _liquidity) external {\n _approvedLiquidities.remove(_liquidity);\n }\n\n function internalJobLiquidityCredits(address _job) external view returns (uint256 _credits) {\n _credits = _jobLiquidityCredits[_job];\n }\n\n function internalJobPeriodCredits(address _job) external view returns (uint256 _credits) {\n _credits = _jobPeriodCredits[_job];\n }\n\n function internalJobTokens(address _job) external view returns (address[] memory _tokens) {\n _tokens = new address[](_jobTokens[_job].length());\n for (uint256 i; i < _jobTokens[_job].length(); i++) {\n _tokens[i] = _jobTokens[_job].at(i);\n }\n }\n\n function internalJobLiquidities(address _job) external view returns (address[] memory _tokens) {\n _tokens = new address[](_jobLiquidities[_job].length());\n for (uint256 i; i < _jobLiquidities[_job].length(); i++) {\n _tokens[i] = _jobLiquidities[_job].at(i);\n }\n }\n}\n" - }, - "solidity/for-test/peripherals/Keep3rDisputableForTest.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../../contracts/peripherals/Keep3rDisputable.sol';\n\ncontract Keep3rDisputableForTest is Keep3rDisputable {\n constructor() Keep3rParameters(address(0), address(0), address(0)) Keep3rRoles(msg.sender) {}\n}\n" - }, - "solidity/for-test/peripherals/keepers/Keep3rKeeperDisputableForTest.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../../../contracts/peripherals/keepers/Keep3rKeeperDisputable.sol';\n\ncontract Keep3rKeeperDisputableForTest is Keep3rKeeperDisputable {\n using EnumerableSet for EnumerableSet.AddressSet;\n\n constructor(\n address _kph,\n address _keep3rV1,\n address _keep3rV1Proxy\n ) Keep3rParameters(_kph, _keep3rV1, _keep3rV1Proxy) Keep3rRoles(msg.sender) {}\n\n function setKeeper(address _keeper) external {\n _keepers.add(_keeper);\n }\n\n function internalSlash(\n address _bonded,\n address _keeper,\n uint256 _bondAmount,\n uint256 _unbondAmount\n ) external {\n _slash(_bonded, _keeper, _bondAmount, _unbondAmount);\n }\n\n function isKeeper(address _address) external view returns (bool _isKeeper) {\n _isKeeper = _keepers.contains(_address);\n }\n}\n" - }, - "solidity/for-test/peripherals/jobs/Keep3rJobFundableCreditsForTest.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../../../contracts/peripherals/jobs/Keep3rJobFundableCredits.sol';\n\ncontract Keep3rJobFundableCreditsForTest is Keep3rJobFundableCredits {\n using EnumerableSet for EnumerableSet.AddressSet;\n\n constructor(\n address _kph,\n address _keep3rV1,\n address _keep3rV1Proxy\n ) Keep3rParameters(_kph, _keep3rV1, _keep3rV1Proxy) Keep3rRoles(msg.sender) {}\n\n function setJob(address _job, address _jobOwner) external {\n _jobs.add(_job);\n jobOwner[_job] = _jobOwner;\n }\n\n function setJobToken(address _job, address _token) external {\n _jobTokens[_job].add(_token);\n }\n\n function isJobToken(address _job, address _token) external view returns (bool _contains) {\n _contains = _jobTokens[_job].contains(_token);\n }\n}\n" - }, - "solidity/contracts/Keep3rHelper.sol": { - "content": "// SPDX-License-Identifier: MIT\n\n/*\n\nCoded for The Keep3r Network with ♥ by\n\n██████╗░███████╗███████╗██╗  ░██╗░░░░░░░██╗░█████╗░███╗░░██╗██████╗░███████╗██████╗░██╗░░░░░░█████╗░███╗░░██╗██████╗░\n██╔══██╗██╔════╝██╔════╝██║  ░██║░░██╗░░██║██╔══██╗████╗░██║██╔══██╗██╔════╝██╔══██╗██║░░░░░██╔══██╗████╗░██║██╔══██╗\n██║░░██║█████╗░░█████╗░░██║  ░╚██╗████╗██╔╝██║░░██║██╔██╗██║██║░░██║█████╗░░██████╔╝██║░░░░░███████║██╔██╗██║██║░░██║\n██║░░██║██╔══╝░░██╔══╝░░██║  ░░████╔═████║░██║░░██║██║╚████║██║░░██║██╔══╝░░██╔══██╗██║░░░░░██╔══██║██║╚████║██║░░██║\n██████╔╝███████╗██║░░░░░██║  ░░╚██╔╝░╚██╔╝░╚█████╔╝██║░╚███║██████╔╝███████╗██║░░██║███████╗██║░░██║██║░╚███║██████╔╝\n╚═════╝░╚══════╝╚═╝░░░░░╚═╝  ░░░╚═╝░░░╚═╝░░░╚════╝░╚═╝░░╚══╝╚═════╝░╚══════╝╚═╝░░╚═╝╚══════╝╚═╝░░╚═╝╚═╝░░╚══╝╚═════╝░\n\nhttps://defi.sucks\n\n*/\n\npragma solidity >=0.8.7 <0.9.0;\n\nimport './libraries/FullMath.sol';\nimport './libraries/TickMath.sol';\nimport '../interfaces/IKeep3r.sol';\nimport '../interfaces/IKeep3rHelper.sol';\nimport './Keep3rHelperParameters.sol';\n\nimport '@openzeppelin/contracts/utils/math/Math.sol';\nimport '@uniswap/v3-core/contracts/interfaces/IUniswapV3Pool.sol';\n\ncontract Keep3rHelper is IKeep3rHelper, Keep3rHelperParameters {\n constructor(\n address _kp3r,\n address _keep3rV2,\n address _governance,\n address _kp3rWethPool\n ) Keep3rHelperParameters(_kp3r, _keep3rV2, _governance, _kp3rWethPool) {}\n\n /// @inheritdoc IKeep3rHelper\n function quote(uint256 _eth) public view override returns (uint256 _amountOut) {\n uint32[] memory _secondsAgos = new uint32[](2);\n _secondsAgos[1] = quoteTwapTime;\n\n (int56[] memory _tickCumulatives, ) = IUniswapV3Pool(kp3rWethPool.poolAddress).observe(_secondsAgos);\n int56 _difference = _tickCumulatives[0] - _tickCumulatives[1];\n _amountOut = getQuoteAtTick(uint128(_eth), kp3rWethPool.isTKNToken0 ? _difference : -_difference, quoteTwapTime);\n }\n\n /// @inheritdoc IKeep3rHelper\n function bonds(address _keeper) public view virtual override returns (uint256 _amountBonded) {\n return IKeep3r(keep3rV2).bonds(_keeper, KP3R);\n }\n\n /// @inheritdoc IKeep3rHelper\n function getRewardAmountFor(address _keeper, uint256 _gasUsed) public view override returns (uint256 _kp3r) {\n uint256 _boost = getRewardBoostFor(bonds(_keeper));\n _kp3r = quote((_gasUsed * _boost) / BOOST_BASE);\n }\n\n /// @inheritdoc IKeep3rHelper\n function getRewardAmount(uint256 _gasUsed) external view override returns (uint256 _amount) {\n // solhint-disable-next-line avoid-tx-origin\n return getRewardAmountFor(tx.origin, _gasUsed);\n }\n\n /// @inheritdoc IKeep3rHelper\n function getRewardBoostFor(uint256 _bonds) public view override returns (uint256 _rewardBoost) {\n _bonds = Math.min(_bonds, targetBond);\n uint256 _cap = minBoost + ((maxBoost - minBoost) * _bonds) / targetBond;\n _rewardBoost = _cap * _getBasefee();\n }\n\n /// @inheritdoc IKeep3rHelper\n function getPoolTokens(address _pool) public view override returns (address _token0, address _token1) {\n return (IUniswapV3Pool(_pool).token0(), IUniswapV3Pool(_pool).token1());\n }\n\n /// @inheritdoc IKeep3rHelper\n function isKP3RToken0(address _pool) external view virtual override returns (bool _isKP3RToken0) {\n address _token0;\n address _token1;\n (_token0, _token1) = getPoolTokens(_pool);\n if (_token0 == KP3R) {\n return true;\n } else if (_token1 != KP3R) {\n revert LiquidityPairInvalid();\n }\n }\n\n /// @inheritdoc IKeep3rHelper\n function observe(address _pool, uint32[] memory _secondsAgo)\n external\n view\n override\n returns (\n int56 _tickCumulative1,\n int56 _tickCumulative2,\n bool _success\n )\n {\n try IUniswapV3Pool(_pool).observe(_secondsAgo) returns (int56[] memory _uniswapResponse, uint160[] memory) {\n _tickCumulative1 = _uniswapResponse[0];\n if (_uniswapResponse.length > 1) {\n _tickCumulative2 = _uniswapResponse[1];\n }\n _success = true;\n } catch (bytes memory) {}\n }\n\n /// @inheritdoc IKeep3rHelper\n function getPaymentParams(uint256 _bonds)\n external\n view\n virtual\n override\n returns (\n uint256 _boost,\n uint256 _oneEthQuote,\n uint256 _extra\n )\n {\n _oneEthQuote = quote(1 ether);\n _boost = getRewardBoostFor(_bonds);\n _extra = workExtraGas;\n }\n\n /// @inheritdoc IKeep3rHelper\n function getKP3RsAtTick(\n uint256 _liquidityAmount,\n int56 _tickDifference,\n uint256 _timeInterval\n ) external pure override returns (uint256 _kp3rAmount) {\n uint160 sqrtRatioX96 = TickMath.getSqrtRatioAtTick(int24(_tickDifference / int256(_timeInterval)));\n _kp3rAmount = FullMath.mulDiv(1 << 96, _liquidityAmount, sqrtRatioX96);\n }\n\n /// @inheritdoc IKeep3rHelper\n function getQuoteAtTick(\n uint128 _baseAmount,\n int56 _tickDifference,\n uint256 _timeInterval\n ) public pure override returns (uint256 _quoteAmount) {\n uint160 sqrtRatioX96 = TickMath.getSqrtRatioAtTick(int24(_tickDifference / int256(_timeInterval)));\n\n if (sqrtRatioX96 <= type(uint128).max) {\n uint256 ratioX192 = uint256(sqrtRatioX96) * sqrtRatioX96;\n _quoteAmount = FullMath.mulDiv(1 << 192, _baseAmount, ratioX192);\n } else {\n uint256 ratioX128 = FullMath.mulDiv(sqrtRatioX96, sqrtRatioX96, 1 << 64);\n _quoteAmount = FullMath.mulDiv(1 << 128, _baseAmount, ratioX128);\n }\n }\n\n /// @notice Gets the gas basefee cost to calculate keeper rewards\n /// @dev Keepers are required to pay a priority fee to be included, this function recognizes a minimum priority fee\n /// @return _baseFee The block's basefee + a minimum priority fee, or a preset minimum gas fee\n function _getBasefee() internal view virtual returns (uint256 _baseFee) {\n return Math.max(minBaseFee, block.basefee + minPriorityFee);\n }\n}\n" - }, - "solidity/for-test/testnet/Keep3rHelperForTestnet.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../../contracts/Keep3rHelper.sol';\n\ncontract Keep3rHelperForTestnet is Keep3rHelper {\n constructor(\n address _kp3r,\n address _keep3rV2,\n address _governance,\n address _kp3rWethPool\n ) Keep3rHelper(_kp3r, _keep3rV2, _governance, _kp3rWethPool) {}\n\n function _getBasefee() internal pure override returns (uint256) {\n return 1;\n }\n\n /// @dev Overrides oracle validation that uses KP3R and WETH addresses\n function _validateOraclePool(address _poolAddress, address) internal view virtual override returns (TokenOraclePool memory _oraclePool) {\n return TokenOraclePool(_poolAddress, true);\n }\n\n /// @dev Overrides token comparison with KP3R address\n function isKP3RToken0(address) public view virtual override returns (bool) {\n return true;\n }\n}\n" - }, - "solidity/for-test/Keep3rHelperForTest.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../contracts/Keep3rHelper.sol';\n\ncontract Keep3rHelperForTest is Keep3rHelper {\n uint256 public basefee;\n\n constructor(\n address _kp3r,\n address _keep3rV2,\n address _governance,\n address _kp3rWethPool\n ) Keep3rHelper(_kp3r, _keep3rV2, _governance, _kp3rWethPool) {}\n\n function _getBasefee() internal view override returns (uint256) {\n return basefee != 0 ? (basefee + minPriorityFee) : super._getBasefee();\n }\n\n function setBaseFee(uint256 _baseFee) external {\n basefee = _baseFee;\n }\n}\n" - }, - "solidity/contracts/sidechain/Keep3rHelperSidechain.sol": { - "content": "// SPDX-License-Identifier: MIT\n\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../Keep3rHelper.sol';\nimport '../../interfaces/sidechain/IKeep3rHelperSidechain.sol';\n\ncontract Keep3rHelperSidechain is IKeep3rHelperSidechain, Keep3rHelper {\n /// @inheritdoc IKeep3rHelperSidechain\n mapping(address => address) public override oracle;\n /// @inheritdoc IKeep3rHelperSidechain\n IKeep3rHelperParameters.TokenOraclePool public override wethUSDPool;\n\n /// @notice Ethereum mainnet WETH address used for quoting references\n address public immutable override WETH;\n\n /// @param _keep3rV2 Address of sidechain Keep3r implementation\n /// @param _governance Address of governance\n /// @param _kp3rWethOracle Address of oracle used for KP3R/WETH quote\n /// @param _wethUsdOracle Address of oracle used for WETH/USD quote\n /// @dev Oracle pools should use 18 decimals tokens\n constructor(\n address _keep3rV2,\n address _governance,\n address _kp3r,\n address _weth,\n address _kp3rWethOracle,\n address _wethUsdOracle\n ) Keep3rHelper(_kp3r, _keep3rV2, _governance, _kp3rWethOracle) {\n WETH = _weth;\n wethUSDPool = _validateOraclePool(_wethUsdOracle, _weth);\n _setQuoteTwapTime(1 days);\n workExtraGas = 0;\n }\n\n /// @inheritdoc IKeep3rHelper\n /// @notice Uses valid wKP3R address from Keep3rSidechain to query keeper bonds\n function bonds(address _keeper) public view override(Keep3rHelper, IKeep3rHelper) returns (uint256 _amountBonded) {\n address wKP3R = IKeep3r(keep3rV2).keep3rV1();\n return IKeep3r(keep3rV2).bonds(_keeper, wKP3R);\n }\n\n /// @inheritdoc IKeep3rHelperSidechain\n function setOracle(address _liquidity, address _oracle) external override onlyGovernance {\n if (_liquidity == address(0) || _oracle == address(0)) revert ZeroAddress();\n oracle[_liquidity] = _oracle;\n emit OracleSet(_liquidity, _oracle);\n }\n\n /// @inheritdoc IKeep3rHelperSidechain\n function quoteUsdToEth(uint256 _usd) public view virtual override returns (uint256 _amountOut) {\n uint32[] memory _secondsAgos = new uint32[](2);\n _secondsAgos[1] = quoteTwapTime;\n\n /// @dev Oracle is compatible with IUniswapV3Pool\n (int56[] memory _tickCumulatives, ) = IUniswapV3Pool(wethUSDPool.poolAddress).observe(_secondsAgos);\n int56 _difference = _tickCumulatives[0] - _tickCumulatives[1];\n _amountOut = getQuoteAtTick(uint128(_usd), wethUSDPool.isTKNToken0 ? _difference : -_difference, quoteTwapTime);\n }\n\n /// @inheritdoc IKeep3rHelperSidechain\n function setWethUsdPool(address _poolAddress) external override onlyGovernance {\n if (_poolAddress == address(0)) revert ZeroAddress();\n _setWethUsdPool(_poolAddress);\n }\n\n /// @inheritdoc IKeep3rHelper\n function getPaymentParams(uint256 _bonds)\n external\n view\n virtual\n override(Keep3rHelper, IKeep3rHelper)\n returns (\n uint256 _boost,\n uint256 _oneUsdQuote,\n uint256 _extraGas\n )\n {\n _oneUsdQuote = quote(quoteUsdToEth(1 ether));\n _boost = getRewardBoostFor(_bonds);\n _extraGas = workExtraGas;\n }\n\n function _setWethUsdPool(address _poolAddress) internal {\n wethUSDPool = _validateOraclePool(_poolAddress, WETH);\n emit WethUSDPoolChange(wethUSDPool.poolAddress, wethUSDPool.isTKNToken0);\n }\n\n /// @dev Sidechain jobs are quoted by USD/gasUnit, baseFee is set to 1\n function _getBasefee() internal view virtual override returns (uint256 _baseFee) {\n return 1;\n }\n}\n" - }, - "solidity/for-test/testnet/Keep3rHelperSidechainForTestnet.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../../contracts/sidechain/Keep3rHelperSidechain.sol';\n\ncontract Keep3rHelperSidechainForTestnet is Keep3rHelperSidechain {\n constructor(\n address _keep3rV2,\n address _governance,\n address _kp3r,\n address _weth,\n address _kp3rWethOracle,\n address _wethUsdOracle\n ) Keep3rHelperSidechain(_keep3rV2, _governance, _kp3r, _weth, _kp3rWethOracle, _wethUsdOracle) {}\n\n /// @dev Overrides oracle validation that uses KP3R and WETH addresses\n function _validateOraclePool(address _poolAddress, address) internal view virtual override returns (TokenOraclePool memory _oraclePool) {\n return TokenOraclePool(_poolAddress, true);\n }\n\n /// @dev Overrides token comparison with KP3R address\n function isKP3RToken0(address) public view virtual override returns (bool) {\n return true;\n }\n\n function quoteUsdToEth(uint256 _usd) public view virtual override returns (uint256) {\n return _usd / 1000;\n }\n}\n" - }, - "solidity/for-test/peripherals/Keep3rParametersForTest.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../../contracts/peripherals/Keep3rParameters.sol';\n\ncontract Keep3rParametersForTest is Keep3rParameters {\n constructor(\n address _keep3rHelper,\n address _keep3rV1,\n address _keep3rV1Proxy\n ) Keep3rParameters(_keep3rHelper, _keep3rV1, _keep3rV1Proxy) Keep3rRoles(msg.sender) {}\n}\n" - }, - "solidity/for-test/peripherals/jobs/Keep3rJobWorkableForTest.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../../../contracts/peripherals/jobs/Keep3rJobWorkable.sol';\n\ncontract Keep3rJobWorkableForTest is Keep3rJobWorkable {\n using EnumerableSet for EnumerableSet.AddressSet;\n\n constructor(\n address _keep3rHelper,\n address _keep3rV1,\n address _keep3rV1Proxy\n ) Keep3rParameters(_keep3rHelper, _keep3rV1, _keep3rV1Proxy) Keep3rRoles(msg.sender) {}\n\n function setJob(address _job) external {\n _jobs.add(_job);\n }\n\n function setKeeper(address _keeper) external {\n _keepers.add(_keeper);\n }\n\n function setApprovedLiquidity(address _liquidity) external {\n _approvedLiquidities.add(_liquidity);\n }\n\n function setJobLiquidity(address _job, address _liquidity) external {\n _jobLiquidities[_job].add(_liquidity);\n }\n\n function viewJobLiquidityCredits(address _job) external view returns (uint256) {\n return _jobLiquidityCredits[_job];\n }\n\n function viewJobPeriodCredits(address _job) external view returns (uint256) {\n return _jobPeriodCredits[_job];\n }\n\n function viewTickCache(address _liquidity) external view returns (TickCache memory _tickCache) {\n _tickCache = _tick[_liquidity];\n }\n\n function viewGas() external view returns (uint256) {\n return _initialGas;\n }\n}\n" - }, - "solidity/for-test/peripherals/jobs/Keep3rJobMigrationForTest.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../../../contracts/peripherals/jobs/Keep3rJobMigration.sol';\n\ncontract Keep3rJobMigrationForTest is Keep3rJobMigration {\n using EnumerableSet for EnumerableSet.AddressSet;\n\n mapping(address => uint256) public settleJobAccountanceCallCount;\n\n constructor(\n address _kph,\n address _keep3rV1,\n address _keep3rV1Proxy\n ) Keep3rParameters(_kph, _keep3rV1, _keep3rV1Proxy) Keep3rRoles(msg.sender) {}\n\n function setJobToken(address _job, address _token) external {\n _jobTokens[_job].add(_token);\n }\n\n function setJobLiquidity(address _job, address _liquidity) external {\n _jobLiquidities[_job].add(_liquidity);\n }\n\n function viewJobTokenListLength(address _job) external view returns (uint256) {\n return _jobTokens[_job].length();\n }\n\n function viewJobLiquidityList(address _job) external view returns (address[] memory _list) {\n _list = _jobLiquidities[_job].values();\n }\n\n function viewJobPeriodCredits(address _job) external view returns (uint256) {\n return _jobPeriodCredits[_job];\n }\n\n function viewJobLiquidityCredits(address _job) external view returns (uint256) {\n return _jobLiquidityCredits[_job];\n }\n\n function viewMigrationCreatedAt(address _fromJob, address _toJob) external view returns (uint256) {\n return _migrationCreatedAt[_fromJob][_toJob];\n }\n\n function isJob(address _job) external view returns (bool) {\n return _jobs.contains(_job);\n }\n\n function _settleJobAccountance(address _job) internal override {\n settleJobAccountanceCallCount[_job]++;\n }\n}\n" - }, - "solidity/for-test/peripherals/jobs/Keep3rJobManagerForTest.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../../../contracts/peripherals/jobs/Keep3rJobManager.sol';\n\ncontract Keep3rJobManagerForTest is Keep3rJobManager {\n using EnumerableSet for EnumerableSet.AddressSet;\n\n constructor(\n address _keep3rHelper,\n address _keep3rV1,\n address _keep3rV1Proxy\n ) Keep3rRoles(msg.sender) {}\n\n function isJob(address _job) external view returns (bool _isJob) {\n _isJob = _jobs.contains(_job);\n }\n}\n" - }, - "solidity/for-test/peripherals/jobs/Keep3rJobOwnershipForTest.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../../../contracts/peripherals/jobs/Keep3rJobOwnership.sol';\n\ncontract Keep3rJobOwnershipForTest is Keep3rJobOwnership {}\n" - }, - "solidity/for-test/libraries/LiquidityAmountsForTest.sol": { - "content": "// SPDX-License-Identifier: GPL-2.0-or-later\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../../contracts/libraries/FullMath.sol';\nimport '../../contracts/libraries/FixedPoint96.sol';\n\n/// @dev Made this library into a contract to be able to calculate liquidity more precisely for tests\n\n// solhint-disable\ncontract LiquidityAmountsForTest {\n function toUint128(uint256 x) private pure returns (uint128 y) {\n require((y = uint128(x)) == x);\n }\n\n function getLiquidityForAmount0(\n uint160 sqrtRatioAX96,\n uint160 sqrtRatioBX96,\n uint256 amount0\n ) public pure returns (uint128 liquidity) {\n if (sqrtRatioAX96 > sqrtRatioBX96) (sqrtRatioAX96, sqrtRatioBX96) = (sqrtRatioBX96, sqrtRatioAX96);\n uint256 intermediate = FullMath.mulDiv(sqrtRatioAX96, sqrtRatioBX96, FixedPoint96.Q96);\n return toUint128(FullMath.mulDiv(amount0, intermediate, sqrtRatioBX96 - sqrtRatioAX96));\n }\n\n function getLiquidityForAmount1(\n uint160 sqrtRatioAX96,\n uint160 sqrtRatioBX96,\n uint256 amount1\n ) public pure returns (uint128 liquidity) {\n if (sqrtRatioAX96 > sqrtRatioBX96) (sqrtRatioAX96, sqrtRatioBX96) = (sqrtRatioBX96, sqrtRatioAX96);\n return toUint128(FullMath.mulDiv(amount1, FixedPoint96.Q96, sqrtRatioBX96 - sqrtRatioAX96));\n }\n\n function getLiquidityForAmounts(\n uint160 sqrtRatioX96,\n uint160 sqrtRatioAX96,\n uint160 sqrtRatioBX96,\n uint256 amount0,\n uint256 amount1\n ) external pure returns (uint128 liquidity) {\n if (sqrtRatioAX96 > sqrtRatioBX96) (sqrtRatioAX96, sqrtRatioBX96) = (sqrtRatioBX96, sqrtRatioAX96);\n\n if (sqrtRatioX96 <= sqrtRatioAX96) {\n liquidity = getLiquidityForAmount0(sqrtRatioAX96, sqrtRatioBX96, amount0);\n } else if (sqrtRatioX96 < sqrtRatioBX96) {\n uint128 liquidity0 = getLiquidityForAmount0(sqrtRatioX96, sqrtRatioBX96, amount0);\n uint128 liquidity1 = getLiquidityForAmount1(sqrtRatioAX96, sqrtRatioX96, amount1);\n\n liquidity = liquidity0 < liquidity1 ? liquidity0 : liquidity1;\n } else {\n liquidity = getLiquidityForAmount1(sqrtRatioAX96, sqrtRatioBX96, amount1);\n }\n }\n\n function getAmount0ForLiquidity(\n uint160 sqrtRatioAX96,\n uint160 sqrtRatioBX96,\n uint128 liquidity\n ) public pure returns (uint256 amount0) {\n if (sqrtRatioAX96 > sqrtRatioBX96) (sqrtRatioAX96, sqrtRatioBX96) = (sqrtRatioBX96, sqrtRatioAX96);\n\n return FullMath.mulDiv(uint256(liquidity) << FixedPoint96.RESOLUTION, sqrtRatioBX96 - sqrtRatioAX96, sqrtRatioBX96) / sqrtRatioAX96;\n }\n\n function getAmount1ForLiquidity(\n uint160 sqrtRatioAX96,\n uint160 sqrtRatioBX96,\n uint128 liquidity\n ) public pure returns (uint256 amount1) {\n if (sqrtRatioAX96 > sqrtRatioBX96) (sqrtRatioAX96, sqrtRatioBX96) = (sqrtRatioBX96, sqrtRatioAX96);\n\n return FullMath.mulDiv(liquidity, sqrtRatioBX96 - sqrtRatioAX96, FixedPoint96.Q96);\n }\n\n function getAmountsForLiquidity(\n uint160 sqrtRatioX96,\n uint160 sqrtRatioAX96,\n uint160 sqrtRatioBX96,\n uint128 liquidity\n ) external pure returns (uint256 amount0, uint256 amount1) {\n if (sqrtRatioAX96 > sqrtRatioBX96) (sqrtRatioAX96, sqrtRatioBX96) = (sqrtRatioBX96, sqrtRatioAX96);\n\n if (sqrtRatioX96 <= sqrtRatioAX96) {\n amount0 = getAmount0ForLiquidity(sqrtRatioAX96, sqrtRatioBX96, liquidity);\n } else if (sqrtRatioX96 < sqrtRatioBX96) {\n amount0 = getAmount0ForLiquidity(sqrtRatioX96, sqrtRatioBX96, liquidity);\n amount1 = getAmount1ForLiquidity(sqrtRatioAX96, sqrtRatioX96, liquidity);\n } else {\n amount1 = getAmount1ForLiquidity(sqrtRatioAX96, sqrtRatioBX96, liquidity);\n }\n }\n}\n" - }, - "solidity/for-test/IUniswapV3PoolForTest.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '@uniswap/v3-core/contracts/interfaces/IERC20Minimal.sol';\nimport '@uniswap/v3-core/contracts/interfaces/IUniswapV3Pool.sol';\n\n// solhint-disable-next-line no-empty-blocks\ninterface IUniswapV3PoolForTest is IERC20Minimal, IUniswapV3Pool {\n\n}\n" - }, - "@uniswap/v3-core/contracts/interfaces/IERC20Minimal.sol": { - "content": "// SPDX-License-Identifier: GPL-2.0-or-later\npragma solidity >=0.5.0;\n\n/// @title Minimal ERC20 interface for Uniswap\n/// @notice Contains a subset of the full ERC20 interface that is used in Uniswap V3\ninterface IERC20Minimal {\n /// @notice Returns the balance of a token\n /// @param account The account for which to look up the number of tokens it has, i.e. its balance\n /// @return The number of tokens held by the account\n function balanceOf(address account) external view returns (uint256);\n\n /// @notice Transfers the amount of token from the `msg.sender` to the recipient\n /// @param recipient The account that will receive the amount transferred\n /// @param amount The number of tokens to send from the sender to the recipient\n /// @return Returns true for a successful transfer, false for an unsuccessful transfer\n function transfer(address recipient, uint256 amount) external returns (bool);\n\n /// @notice Returns the current allowance given to a spender by an owner\n /// @param owner The account of the token owner\n /// @param spender The account of the token spender\n /// @return The current allowance granted by `owner` to `spender`\n function allowance(address owner, address spender) external view returns (uint256);\n\n /// @notice Sets the allowance of a spender from the `msg.sender` to the value `amount`\n /// @param spender The account which will be allowed to spend a given amount of the owners tokens\n /// @param amount The amount of tokens allowed to be used by `spender`\n /// @return Returns true for a successful approval, false for unsuccessful\n function approve(address spender, uint256 amount) external returns (bool);\n\n /// @notice Transfers `amount` tokens from `sender` to `recipient` up to the allowance given to the `msg.sender`\n /// @param sender The account from which the transfer will be initiated\n /// @param recipient The recipient of the transfer\n /// @param amount The amount of the transfer\n /// @return Returns true for a successful transfer, false for unsuccessful\n function transferFrom(\n address sender,\n address recipient,\n uint256 amount\n ) external returns (bool);\n\n /// @notice Event emitted when tokens are transferred from one address to another, either via `#transfer` or `#transferFrom`.\n /// @param from The account from which the tokens were sent, i.e. the balance decreased\n /// @param to The account to which the tokens were sent, i.e. the balance increased\n /// @param value The amount of tokens that were transferred\n event Transfer(address indexed from, address indexed to, uint256 value);\n\n /// @notice Event emitted when the approval amount for the spender of a given owner's tokens changes.\n /// @param owner The account that approved spending of its tokens\n /// @param spender The account for which the spending allowance was modified\n /// @param value The new allowance from the owner to the spender\n event Approval(address indexed owner, address indexed spender, uint256 value);\n}\n" - } - }, - "settings": { - "optimizer": { - "enabled": true, - "runs": 33 - }, - "outputSelection": { - "*": { - "*": [ - "storageLayout", - "abi", - "evm.bytecode", - "evm.deployedBytecode", - "evm.methodIdentifiers", - "metadata", - "devdoc", - "userdoc", - "evm.gasEstimates" - ], - "": [ - "ast" - ] - } - }, - "metadata": { - "useLiteralContent": true - }, - "libraries": { - "": { - "__CACHE_BREAKER__": "0x00000000d41867734bbee4c6863d9255b2b06ac1" - } - } - } -} \ No newline at end of file diff --git a/deployments/optimisticGoerli/solcInputs/a2dd8c00aab95ba5d841446478d867fa.json b/deployments/optimisticGoerli/solcInputs/a2dd8c00aab95ba5d841446478d867fa.json deleted file mode 100644 index c8e151f..0000000 --- a/deployments/optimisticGoerli/solcInputs/a2dd8c00aab95ba5d841446478d867fa.json +++ /dev/null @@ -1,337 +0,0 @@ -{ - "language": "Solidity", - "sources": { - "solidity/contracts/Keep3r.sol": { - "content": "// SPDX-License-Identifier: MIT\n\n/*\n\nCoded for The Keep3r Network with ♥ by\n\n██████╗░███████╗███████╗██╗  ░██╗░░░░░░░██╗░█████╗░███╗░░██╗██████╗░███████╗██████╗░██╗░░░░░░█████╗░███╗░░██╗██████╗░\n██╔══██╗██╔════╝██╔════╝██║  ░██║░░██╗░░██║██╔══██╗████╗░██║██╔══██╗██╔════╝██╔══██╗██║░░░░░██╔══██╗████╗░██║██╔══██╗\n██║░░██║█████╗░░█████╗░░██║  ░╚██╗████╗██╔╝██║░░██║██╔██╗██║██║░░██║█████╗░░██████╔╝██║░░░░░███████║██╔██╗██║██║░░██║\n██║░░██║██╔══╝░░██╔══╝░░██║  ░░████╔═████║░██║░░██║██║╚████║██║░░██║██╔══╝░░██╔══██╗██║░░░░░██╔══██║██║╚████║██║░░██║\n██████╔╝███████╗██║░░░░░██║  ░░╚██╔╝░╚██╔╝░╚█████╔╝██║░╚███║██████╔╝███████╗██║░░██║███████╗██║░░██║██║░╚███║██████╔╝\n╚═════╝░╚══════╝╚═╝░░░░░╚═╝  ░░░╚═╝░░░╚═╝░░░╚════╝░╚═╝░░╚══╝╚═════╝░╚══════╝╚═╝░░╚═╝╚══════╝╚═╝░░╚═╝╚═╝░░╚══╝╚═════╝░\n\nhttps://defi.sucks\n\n*/\n\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../interfaces/IKeep3r.sol';\nimport './peripherals/jobs/Keep3rJobs.sol';\nimport './peripherals/keepers/Keep3rKeepers.sol';\nimport './peripherals/DustCollector.sol';\n\ncontract Keep3r is IKeep3r, Keep3rJobs, Keep3rKeepers {\n constructor(\n address _governance,\n address _keep3rHelper,\n address _keep3rV1,\n address _keep3rV1Proxy\n ) Keep3rParameters(_keep3rHelper, _keep3rV1, _keep3rV1Proxy) Keep3rRoles(_governance) {}\n}\n" - }, - "solidity/interfaces/IKeep3r.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport './peripherals/IKeep3rJobs.sol';\nimport './peripherals/IKeep3rKeepers.sol';\nimport './peripherals/IKeep3rParameters.sol';\n\n// solhint-disable-next-line no-empty-blocks\n\n/// @title Keep3rV2 contract\n/// @notice This contract inherits all the functionality of Keep3rV2\ninterface IKeep3r is IKeep3rJobs, IKeep3rKeepers, IKeep3rParameters {\n\n}\n" - }, - "solidity/contracts/peripherals/jobs/Keep3rJobs.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../../../interfaces/peripherals/IKeep3rJobs.sol';\nimport './Keep3rJobManager.sol';\nimport './Keep3rJobWorkable.sol';\nimport './Keep3rJobDisputable.sol';\n\nabstract contract Keep3rJobs is IKeep3rJobs, Keep3rJobManager, Keep3rJobWorkable, Keep3rJobDisputable {}\n" - }, - "solidity/contracts/peripherals/keepers/Keep3rKeepers.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../../../interfaces/peripherals/IKeep3rKeepers.sol';\nimport './Keep3rKeeperDisputable.sol';\n\nabstract contract Keep3rKeepers is IKeep3rKeepers, Keep3rKeeperDisputable {}\n" - }, - "solidity/contracts/peripherals/DustCollector.sol": { - "content": "// SPDX-License-Identifier: MIT\n\npragma solidity >=0.8.4 <0.9.0;\n\nimport '@openzeppelin/contracts/token/ERC20/IERC20.sol';\nimport '@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol';\nimport '../../contracts/peripherals/Governable.sol';\nimport '../../interfaces/peripherals/IDustCollector.sol';\n\nabstract contract DustCollector is IDustCollector, Governable {\n using SafeERC20 for IERC20;\n\n address internal constant _ETH_ADDRESS = 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE;\n\n function sendDust(\n address _token,\n uint256 _amount,\n address _to\n ) external override onlyGovernance {\n if (_to == address(0)) revert ZeroAddress();\n if (_token == _ETH_ADDRESS) {\n payable(_to).transfer(_amount);\n } else {\n IERC20(_token).safeTransfer(_to, _amount);\n }\n emit DustSent(_token, _amount, _to);\n }\n}\n" - }, - "solidity/interfaces/peripherals/IKeep3rJobs.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport './IKeep3rDisputable.sol';\n\n/// @title Keep3rJobOwnership contract\n/// @notice Handles the ownership of the jobs\ninterface IKeep3rJobOwnership {\n // Events\n\n /// @notice Emitted when Keep3rJobOwnership#changeJobOwnership is called\n /// @param _job The address of the job proposed to have a change of owner\n /// @param _owner The current owner of the job\n /// @param _pendingOwner The new address proposed to be the owner of the job\n event JobOwnershipChange(address indexed _job, address indexed _owner, address indexed _pendingOwner);\n\n /// @notice Emitted when Keep3rJobOwnership#JobOwnershipAssent is called\n /// @param _job The address of the job which the proposed owner will now own\n /// @param _previousOwner The previous owner of the job\n /// @param _newOwner The new owner of the job\n event JobOwnershipAssent(address indexed _job, address indexed _previousOwner, address indexed _newOwner);\n\n // Errors\n\n /// @notice Throws when the caller of the function is not the job owner\n error OnlyJobOwner();\n\n /// @notice Throws when the caller of the function is not the pending job owner\n error OnlyPendingJobOwner();\n\n // Variables\n\n /// @notice Maps the job to the owner of the job\n /// @param _job The address of the job\n /// @return _owner The address of the owner of the job\n function jobOwner(address _job) external view returns (address _owner);\n\n /// @notice Maps the job to its pending owner\n /// @param _job The address of the job\n /// @return _pendingOwner The address of the pending owner of the job\n function jobPendingOwner(address _job) external view returns (address _pendingOwner);\n\n // Methods\n\n /// @notice Proposes a new address to be the owner of the job\n /// @param _job The address of the job\n /// @param _newOwner The address of the proposed new owner\n function changeJobOwnership(address _job, address _newOwner) external;\n\n /// @notice The proposed address accepts to be the owner of the job\n /// @param _job The address of the job\n function acceptJobOwnership(address _job) external;\n}\n\n/// @title Keep3rJobManager contract\n/// @notice Handles the addition and withdrawal of credits from a job\ninterface IKeep3rJobManager is IKeep3rJobOwnership {\n // Events\n\n /// @notice Emitted when Keep3rJobManager#addJob is called\n /// @param _job The address of the job to add\n /// @param _jobOwner The job's owner\n event JobAddition(address indexed _job, address indexed _jobOwner);\n\n // Errors\n\n /// @notice Throws when trying to add a job that has already been added\n error JobAlreadyAdded();\n\n /// @notice Throws when the address that is trying to register as a keeper is already a keeper\n error AlreadyAKeeper();\n\n // Methods\n\n /// @notice Allows any caller to add a new job\n /// @param _job Address of the contract for which work should be performed\n function addJob(address _job) external;\n}\n\n/// @title Keep3rJobFundableCredits contract\n/// @notice Handles the addition and withdrawal of credits from a job\ninterface IKeep3rJobFundableCredits is IKeep3rJobOwnership {\n // Events\n\n /// @notice Emitted when Keep3rJobFundableCredits#addTokenCreditsToJob is called\n /// @param _job The address of the job being credited\n /// @param _token The address of the token being provided\n /// @param _provider The user that calls the function\n /// @param _amount The amount of credit being added to the job\n event TokenCreditAddition(address indexed _job, address indexed _token, address indexed _provider, uint256 _amount);\n\n /// @notice Emitted when Keep3rJobFundableCredits#withdrawTokenCreditsFromJob is called\n /// @param _job The address of the job from which the credits are withdrawn\n /// @param _token The credit being withdrawn from the job\n /// @param _receiver The user that receives the tokens\n /// @param _amount The amount of credit withdrawn\n event TokenCreditWithdrawal(address indexed _job, address indexed _token, address indexed _receiver, uint256 _amount);\n\n // Errors\n\n /// @notice Throws when the token is KP3R, as it should not be used for direct token payments\n error TokenUnallowed();\n\n /// @notice Throws when the token withdraw cooldown has not yet passed\n error JobTokenCreditsLocked();\n\n /// @notice Throws when the user tries to withdraw more tokens than it has\n error InsufficientJobTokenCredits();\n\n // Variables\n\n /// @notice Last block where tokens were added to the job\n /// @param _job The address of the job credited\n /// @param _token The address of the token credited\n /// @return _timestamp The last block where tokens were added to the job\n function jobTokenCreditsAddedAt(address _job, address _token) external view returns (uint256 _timestamp);\n\n // Methods\n\n /// @notice Add credit to a job to be paid out for work\n /// @param _job The address of the job being credited\n /// @param _token The address of the token being credited\n /// @param _amount The amount of credit being added\n function addTokenCreditsToJob(\n address _job,\n address _token,\n uint256 _amount\n ) external;\n\n /// @notice Withdraw credit from a job\n /// @param _job The address of the job from which the credits are withdrawn\n /// @param _token The address of the token being withdrawn\n /// @param _amount The amount of token to be withdrawn\n /// @param _receiver The user that will receive tokens\n function withdrawTokenCreditsFromJob(\n address _job,\n address _token,\n uint256 _amount,\n address _receiver\n ) external;\n}\n\n/// @title Keep3rJobFundableLiquidity contract\n/// @notice Handles the funding of jobs through specific liquidity pairs\ninterface IKeep3rJobFundableLiquidity is IKeep3rJobOwnership {\n // Events\n\n /// @notice Emitted when Keep3rJobFundableLiquidity#approveLiquidity function is called\n /// @param _liquidity The address of the liquidity pair being approved\n event LiquidityApproval(address _liquidity);\n\n /// @notice Emitted when Keep3rJobFundableLiquidity#revokeLiquidity function is called\n /// @param _liquidity The address of the liquidity pair being revoked\n event LiquidityRevocation(address _liquidity);\n\n /// @notice Emitted when IKeep3rJobFundableLiquidity#addLiquidityToJob function is called\n /// @param _job The address of the job to which liquidity will be added\n /// @param _liquidity The address of the liquidity being added\n /// @param _provider The user that calls the function\n /// @param _amount The amount of liquidity being added\n event LiquidityAddition(address indexed _job, address indexed _liquidity, address indexed _provider, uint256 _amount);\n\n /// @notice Emitted when IKeep3rJobFundableLiquidity#withdrawLiquidityFromJob function is called\n /// @param _job The address of the job of which liquidity will be withdrawn from\n /// @param _liquidity The address of the liquidity being withdrawn\n /// @param _receiver The receiver of the liquidity tokens\n /// @param _amount The amount of liquidity being withdrawn from the job\n event LiquidityWithdrawal(address indexed _job, address indexed _liquidity, address indexed _receiver, uint256 _amount);\n\n /// @notice Emitted when Keep3rJobFundableLiquidity#addLiquidityToJob function is called\n /// @param _job The address of the job whose credits will be updated\n /// @param _rewardedAt The time at which the job was last rewarded\n /// @param _currentCredits The current credits of the job\n /// @param _periodCredits The credits of the job for the current period\n event LiquidityCreditsReward(address indexed _job, uint256 _rewardedAt, uint256 _currentCredits, uint256 _periodCredits);\n\n /// @notice Emitted when Keep3rJobFundableLiquidity#forceLiquidityCreditsToJob function is called\n /// @param _job The address of the job whose credits will be updated\n /// @param _rewardedAt The time at which the job was last rewarded\n /// @param _currentCredits The current credits of the job\n event LiquidityCreditsForced(address indexed _job, uint256 _rewardedAt, uint256 _currentCredits);\n\n // Errors\n\n /// @notice Throws when the liquidity being approved has already been approved\n error LiquidityPairApproved();\n\n /// @notice Throws when the liquidity being removed has not been approved\n error LiquidityPairUnexistent();\n\n /// @notice Throws when trying to add liquidity to an unapproved pool\n error LiquidityPairUnapproved();\n\n /// @notice Throws when the job doesn't have the requested liquidity\n error JobLiquidityUnexistent();\n\n /// @notice Throws when trying to remove more liquidity than the job has\n error JobLiquidityInsufficient();\n\n /// @notice Throws when trying to add less liquidity than the minimum liquidity required\n error JobLiquidityLessThanMin();\n\n // Structs\n\n /// @notice Stores the tick information of the different liquidity pairs\n struct TickCache {\n int56 current; // Tracks the current tick\n int56 difference; // Stores the difference between the current tick and the last tick\n uint256 period; // Stores the period at which the last observation was made\n }\n\n // Variables\n\n /// @notice Lists liquidity pairs\n /// @return _list An array of addresses with all the approved liquidity pairs\n function approvedLiquidities() external view returns (address[] memory _list);\n\n /// @notice Amount of liquidity in a specified job\n /// @param _job The address of the job being checked\n /// @param _liquidity The address of the liquidity we are checking\n /// @return _amount Amount of liquidity in the specified job\n function liquidityAmount(address _job, address _liquidity) external view returns (uint256 _amount);\n\n /// @notice Last time the job was rewarded liquidity credits\n /// @param _job The address of the job being checked\n /// @return _timestamp Timestamp of the last time the job was rewarded liquidity credits\n function rewardedAt(address _job) external view returns (uint256 _timestamp);\n\n /// @notice Last time the job was worked\n /// @param _job The address of the job being checked\n /// @return _timestamp Timestamp of the last time the job was worked\n function workedAt(address _job) external view returns (uint256 _timestamp);\n\n // Methods\n\n /// @notice Returns the liquidity credits of a given job\n /// @param _job The address of the job of which we want to know the liquidity credits\n /// @return _amount The liquidity credits of a given job\n function jobLiquidityCredits(address _job) external view returns (uint256 _amount);\n\n /// @notice Returns the credits of a given job for the current period\n /// @param _job The address of the job of which we want to know the period credits\n /// @return _amount The credits the given job has at the current period\n function jobPeriodCredits(address _job) external view returns (uint256 _amount);\n\n /// @notice Calculates the total credits of a given job\n /// @param _job The address of the job of which we want to know the total credits\n /// @return _amount The total credits of the given job\n function totalJobCredits(address _job) external view returns (uint256 _amount);\n\n /// @notice Calculates how many credits should be rewarded periodically for a given liquidity amount\n /// @dev _periodCredits = underlying KP3Rs for given liquidity amount * rewardPeriod / inflationPeriod\n /// @param _liquidity The address of the liquidity to provide\n /// @param _amount The amount of liquidity to provide\n /// @return _periodCredits The amount of KP3R periodically minted for the given liquidity\n function quoteLiquidity(address _liquidity, uint256 _amount) external view returns (uint256 _periodCredits);\n\n /// @notice Observes the current state of the liquidity pair being observed and updates TickCache with the information\n /// @param _liquidity The address of the liquidity pair being observed\n /// @return _tickCache The updated TickCache\n function observeLiquidity(address _liquidity) external view returns (TickCache memory _tickCache);\n\n /// @notice Gifts liquidity credits to the specified job\n /// @param _job The address of the job being credited\n /// @param _amount The amount of liquidity credits to gift\n function forceLiquidityCreditsToJob(address _job, uint256 _amount) external;\n\n /// @notice Approve a liquidity pair for being accepted in future\n /// @param _liquidity The address of the liquidity accepted\n function approveLiquidity(address _liquidity) external;\n\n /// @notice Revoke a liquidity pair from being accepted in future\n /// @param _liquidity The liquidity no longer accepted\n function revokeLiquidity(address _liquidity) external;\n\n /// @notice Allows anyone to fund a job with liquidity\n /// @param _job The address of the job to assign liquidity to\n /// @param _liquidity The liquidity being added\n /// @param _amount The amount of liquidity tokens to add\n function addLiquidityToJob(\n address _job,\n address _liquidity,\n uint256 _amount\n ) external;\n\n /// @notice Unbond liquidity for a job\n /// @dev Can only be called by the job's owner\n /// @param _job The address of the job being unbonded from\n /// @param _liquidity The liquidity being unbonded\n /// @param _amount The amount of liquidity being removed\n function unbondLiquidityFromJob(\n address _job,\n address _liquidity,\n uint256 _amount\n ) external;\n\n /// @notice Withdraw liquidity from a job\n /// @param _job The address of the job being withdrawn from\n /// @param _liquidity The liquidity being withdrawn\n /// @param _receiver The address that will receive the withdrawn liquidity\n function withdrawLiquidityFromJob(\n address _job,\n address _liquidity,\n address _receiver\n ) external;\n}\n\n/// @title Keep3rJobMigration contract\n/// @notice Handles the migration process of jobs to different addresses\ninterface IKeep3rJobMigration is IKeep3rJobFundableCredits, IKeep3rJobFundableLiquidity {\n // Events\n\n /// @notice Emitted when Keep3rJobMigration#migrateJob function is called\n /// @param _fromJob The address of the job that requests to migrate\n /// @param _toJob The address at which the job requests to migrate\n event JobMigrationRequested(address indexed _fromJob, address _toJob);\n\n /// @notice Emitted when Keep3rJobMigration#acceptJobMigration function is called\n /// @param _fromJob The address of the job that requested to migrate\n /// @param _toJob The address at which the job had requested to migrate\n event JobMigrationSuccessful(address _fromJob, address indexed _toJob);\n\n // Errors\n\n /// @notice Throws when the address of the job that requests to migrate wants to migrate to its same address\n error JobMigrationImpossible();\n\n /// @notice Throws when the _toJob address differs from the address being tracked in the pendingJobMigrations mapping\n error JobMigrationUnavailable();\n\n /// @notice Throws when cooldown between migrations has not yet passed\n error JobMigrationLocked();\n\n // Variables\n\n /// @notice Maps the jobs that have requested a migration to the address they have requested to migrate to\n /// @return _toJob The address to which the job has requested to migrate to\n function pendingJobMigrations(address _fromJob) external view returns (address _toJob);\n\n // Methods\n\n /// @notice Initializes the migration process for a job by adding the request to the pendingJobMigrations mapping\n /// @param _fromJob The address of the job that is requesting to migrate\n /// @param _toJob The address at which the job is requesting to migrate\n function migrateJob(address _fromJob, address _toJob) external;\n\n /// @notice Completes the migration process for a job\n /// @dev Unbond/withdraw process doesn't get migrated\n /// @param _fromJob The address of the job that requested to migrate\n /// @param _toJob The address to which the job wants to migrate to\n function acceptJobMigration(address _fromJob, address _toJob) external;\n}\n\n/// @title Keep3rJobWorkable contract\n/// @notice Handles the mechanisms jobs can pay keepers with along with the restrictions jobs can put on keepers before they can work on jobs\ninterface IKeep3rJobWorkable is IKeep3rJobMigration {\n // Events\n\n /// @notice Emitted when a keeper is validated before a job\n /// @param _gasLeft The amount of gas that the transaction has left at the moment of keeper validation\n event KeeperValidation(uint256 _gasLeft);\n\n /// @notice Emitted when a keeper works a job\n /// @param _credit The address of the asset in which the keeper is paid\n /// @param _job The address of the job the keeper has worked\n /// @param _keeper The address of the keeper that has worked the job\n /// @param _payment The amount that has been paid out to the keeper in exchange for working the job\n /// @param _gasLeft The amount of gas that the transaction has left at the moment of payment\n event KeeperWork(address indexed _credit, address indexed _job, address indexed _keeper, uint256 _payment, uint256 _gasLeft);\n\n // Errors\n\n /// @notice Throws if work method was called without calling isKeeper or isBondedKeeper\n error GasNotInitialized();\n\n /// @notice Throws if the address claiming to be a job is not in the list of approved jobs\n error JobUnapproved();\n\n /// @notice Throws if the amount of funds in the job is less than the payment that must be paid to the keeper that works that job\n error InsufficientFunds();\n\n // Methods\n\n /// @notice Confirms if the current keeper is registered\n /// @dev Can be used for general (non critical) functions\n /// @param _keeper The keeper being investigated\n /// @return _isKeeper Whether the address passed as a parameter is a keeper or not\n function isKeeper(address _keeper) external returns (bool _isKeeper);\n\n /// @notice Confirms if the current keeper is registered and has a minimum bond of any asset.\n /// @dev Should be used for protected functions\n /// @param _keeper The keeper to check\n /// @param _bond The bond token being evaluated\n /// @param _minBond The minimum amount of bonded tokens\n /// @param _earned The minimum funds earned in the keepers lifetime\n /// @param _age The minimum keeper age required\n /// @return _isBondedKeeper Whether the `_keeper` meets the given requirements\n function isBondedKeeper(\n address _keeper,\n address _bond,\n uint256 _minBond,\n uint256 _earned,\n uint256 _age\n ) external returns (bool _isBondedKeeper);\n\n /// @notice Implemented by jobs to show that a keeper performed work\n /// @dev Automatically calculates the payment for the keeper and pays the keeper with bonded KP3R\n /// @param _keeper Address of the keeper that performed the work\n function worked(address _keeper) external;\n\n /// @notice Implemented by jobs to show that a keeper performed work\n /// @dev Pays the keeper that performs the work with KP3R\n /// @param _keeper Address of the keeper that performed the work\n /// @param _payment The reward that should be allocated for the job\n function bondedPayment(address _keeper, uint256 _payment) external;\n\n /// @notice Implemented by jobs to show that a keeper performed work\n /// @dev Pays the keeper that performs the work with a specific token\n /// @param _token The asset being awarded to the keeper\n /// @param _keeper Address of the keeper that performed the work\n /// @param _amount The reward that should be allocated\n function directTokenPayment(\n address _token,\n address _keeper,\n uint256 _amount\n ) external;\n}\n\n/// @title Keep3rJobDisputable contract\n/// @notice Handles the actions that can be taken on a disputed job\ninterface IKeep3rJobDisputable is IKeep3rDisputable, IKeep3rJobFundableCredits, IKeep3rJobFundableLiquidity {\n // Events\n\n /// @notice Emitted when Keep3rJobDisputable#slashTokenFromJob is called\n /// @param _job The address of the job from which the token will be slashed\n /// @param _token The address of the token being slashed\n /// @param _slasher The user that slashes the token\n /// @param _amount The amount of the token being slashed\n event JobSlashToken(address indexed _job, address _token, address indexed _slasher, uint256 _amount);\n\n /// @notice Emitted when Keep3rJobDisputable#slashLiquidityFromJob is called\n /// @param _job The address of the job from which the liquidity will be slashed\n /// @param _liquidity The address of the liquidity being slashed\n /// @param _slasher The user that slashes the liquidity\n /// @param _amount The amount of the liquidity being slashed\n event JobSlashLiquidity(address indexed _job, address _liquidity, address indexed _slasher, uint256 _amount);\n\n // Errors\n\n /// @notice Throws when the token trying to be slashed doesn't exist\n error JobTokenUnexistent();\n\n /// @notice Throws when someone tries to slash more tokens than the job has\n error JobTokenInsufficient();\n\n // Methods\n\n /// @notice Allows governance or slasher to slash a job specific token\n /// @param _job The address of the job from which the token will be slashed\n /// @param _token The address of the token that will be slashed\n /// @param _amount The amount of the token that will be slashed\n function slashTokenFromJob(\n address _job,\n address _token,\n uint256 _amount\n ) external;\n\n /// @notice Allows governance or a slasher to slash liquidity from a job\n /// @param _job The address being slashed\n /// @param _liquidity The address of the liquidity that will be slashed\n /// @param _amount The amount of liquidity that will be slashed\n function slashLiquidityFromJob(\n address _job,\n address _liquidity,\n uint256 _amount\n ) external;\n}\n\n// solhint-disable-next-line no-empty-blocks\ninterface IKeep3rJobs is IKeep3rJobWorkable, IKeep3rJobManager, IKeep3rJobDisputable {\n\n}\n" - }, - "solidity/interfaces/peripherals/IKeep3rKeepers.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport './IKeep3rDisputable.sol';\n\n/// @title Keep3rKeeperFundable contract\n/// @notice Handles the actions required to become a keeper\ninterface IKeep3rKeeperFundable {\n // Events\n\n /// @notice Emitted when Keep3rKeeperFundable#activate is called\n /// @param _keeper The keeper that has been activated\n /// @param _bond The asset the keeper has bonded\n /// @param _amount The amount of the asset the keeper has bonded\n event Activation(address indexed _keeper, address indexed _bond, uint256 _amount);\n\n /// @notice Emitted when Keep3rKeeperFundable#withdraw is called\n /// @param _keeper The caller of Keep3rKeeperFundable#withdraw function\n /// @param _bond The asset to withdraw from the bonding pool\n /// @param _amount The amount of funds withdrawn\n event Withdrawal(address indexed _keeper, address indexed _bond, uint256 _amount);\n\n // Errors\n\n /// @notice Throws when the address that is trying to register as a job is already a job\n error AlreadyAJob();\n\n // Methods\n\n /// @notice Beginning of the bonding process\n /// @param _bonding The asset being bonded\n /// @param _amount The amount of bonding asset being bonded\n function bond(address _bonding, uint256 _amount) external;\n\n /// @notice Beginning of the unbonding process\n /// @param _bonding The asset being unbonded\n /// @param _amount Allows for partial unbonding\n function unbond(address _bonding, uint256 _amount) external;\n\n /// @notice End of the bonding process after bonding time has passed\n /// @param _bonding The asset being activated as bond collateral\n function activate(address _bonding) external;\n\n /// @notice Withdraw funds after unbonding has finished\n /// @param _bonding The asset to withdraw from the bonding pool\n function withdraw(address _bonding) external;\n}\n\n/// @title Keep3rKeeperDisputable contract\n/// @notice Handles the actions that can be taken on a disputed keeper\ninterface IKeep3rKeeperDisputable is IKeep3rDisputable, IKeep3rKeeperFundable {\n // Events\n\n /// @notice Emitted when Keep3rKeeperDisputable#slash is called\n /// @param _keeper The address of the slashed keeper\n /// @param _slasher The user that called Keep3rKeeperDisputable#slash\n /// @param _amount The amount of credits slashed from the keeper\n event KeeperSlash(address indexed _keeper, address indexed _slasher, uint256 _amount);\n\n /// @notice Emitted when Keep3rKeeperDisputable#revoke is called\n /// @param _keeper The address of the revoked keeper\n /// @param _slasher The user that called Keep3rKeeperDisputable#revoke\n event KeeperRevoke(address indexed _keeper, address indexed _slasher);\n\n // Methods\n\n /// @notice Allows governance to slash a keeper based on a dispute\n /// @param _keeper The address being slashed\n /// @param _bonded The asset being slashed\n /// @param _bondAmount The bonded amount being slashed\n /// @param _unbondAmount The pending unbond amount being slashed\n function slash(\n address _keeper,\n address _bonded,\n uint256 _bondAmount,\n uint256 _unbondAmount\n ) external;\n\n /// @notice Blacklists a keeper from participating in the network\n /// @param _keeper The address being slashed\n function revoke(address _keeper) external;\n}\n\n// solhint-disable-next-line no-empty-blocks\n\n/// @title Keep3rKeepers contract\ninterface IKeep3rKeepers is IKeep3rKeeperDisputable {\n\n}\n" - }, - "solidity/interfaces/peripherals/IKeep3rParameters.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport './IKeep3rAccountance.sol';\n\n/// @title Keep3rParameters contract\n/// @notice Handles and sets all the required parameters for Keep3r\ninterface IKeep3rParameters is IKeep3rAccountance {\n // Events\n\n /// @notice Emitted when the Keep3rHelper address is changed\n /// @param _keep3rHelper The address of Keep3rHelper's contract\n event Keep3rHelperChange(address _keep3rHelper);\n\n /// @notice Emitted when the Keep3rV1 address is changed\n /// @param _keep3rV1 The address of Keep3rV1's contract\n event Keep3rV1Change(address _keep3rV1);\n\n /// @notice Emitted when the Keep3rV1Proxy address is changed\n /// @param _keep3rV1Proxy The address of Keep3rV1Proxy's contract\n event Keep3rV1ProxyChange(address _keep3rV1Proxy);\n\n /// @notice Emitted when bondTime is changed\n /// @param _bondTime The new bondTime\n event BondTimeChange(uint256 _bondTime);\n\n /// @notice Emitted when _liquidityMinimum is changed\n /// @param _liquidityMinimum The new _liquidityMinimum\n event LiquidityMinimumChange(uint256 _liquidityMinimum);\n\n /// @notice Emitted when _unbondTime is changed\n /// @param _unbondTime The new _unbondTime\n event UnbondTimeChange(uint256 _unbondTime);\n\n /// @notice Emitted when _rewardPeriodTime is changed\n /// @param _rewardPeriodTime The new _rewardPeriodTime\n event RewardPeriodTimeChange(uint256 _rewardPeriodTime);\n\n /// @notice Emitted when the inflationPeriod is changed\n /// @param _inflationPeriod The new inflationPeriod\n event InflationPeriodChange(uint256 _inflationPeriod);\n\n /// @notice Emitted when the fee is changed\n /// @param _fee The new token credits fee\n event FeeChange(uint256 _fee);\n\n // Variables\n\n /// @notice Address of Keep3rHelper's contract\n /// @return _keep3rHelper The address of Keep3rHelper's contract\n function keep3rHelper() external view returns (address _keep3rHelper);\n\n /// @notice Address of Keep3rV1's contract\n /// @return _keep3rV1 The address of Keep3rV1's contract\n function keep3rV1() external view returns (address _keep3rV1);\n\n /// @notice Address of Keep3rV1Proxy's contract\n /// @return _keep3rV1Proxy The address of Keep3rV1Proxy's contract\n function keep3rV1Proxy() external view returns (address _keep3rV1Proxy);\n\n /// @notice The amount of time required to pass after a keeper has bonded assets for it to be able to activate\n /// @return _days The required bondTime in days\n function bondTime() external view returns (uint256 _days);\n\n /// @notice The amount of time required to pass before a keeper can unbond what he has bonded\n /// @return _days The required unbondTime in days\n function unbondTime() external view returns (uint256 _days);\n\n /// @notice The minimum amount of liquidity required to fund a job per liquidity\n /// @return _amount The minimum amount of liquidity in KP3R\n function liquidityMinimum() external view returns (uint256 _amount);\n\n /// @notice The amount of time between each scheduled credits reward given to a job\n /// @return _days The reward period in days\n function rewardPeriodTime() external view returns (uint256 _days);\n\n /// @notice The inflation period is the denominator used to regulate the emission of KP3R\n /// @return _period The denominator used to regulate the emission of KP3R\n function inflationPeriod() external view returns (uint256 _period);\n\n /// @notice The fee to be sent to governance when a user adds liquidity to a job\n /// @return _amount The fee amount to be sent to governance when a user adds liquidity to a job\n function fee() external view returns (uint256 _amount);\n\n // Errors\n\n /// @notice Throws if the reward period is less than the minimum reward period time\n error MinRewardPeriod();\n\n /// @notice Throws if either a job or a keeper is disputed\n error Disputed();\n\n /// @notice Throws if there are no bonded assets\n error BondsUnexistent();\n\n /// @notice Throws if the time required to bond an asset has not passed yet\n error BondsLocked();\n\n /// @notice Throws if there are no bonds to withdraw\n error UnbondsUnexistent();\n\n /// @notice Throws if the time required to withdraw the bonds has not passed yet\n error UnbondsLocked();\n\n // Methods\n\n /// @notice Sets the Keep3rHelper address\n /// @param _keep3rHelper The Keep3rHelper address\n function setKeep3rHelper(address _keep3rHelper) external;\n\n /// @notice Sets the Keep3rV1 address\n /// @param _keep3rV1 The Keep3rV1 address\n function setKeep3rV1(address _keep3rV1) external;\n\n /// @notice Sets the Keep3rV1Proxy address\n /// @param _keep3rV1Proxy The Keep3rV1Proxy address\n function setKeep3rV1Proxy(address _keep3rV1Proxy) external;\n\n /// @notice Sets the bond time required to activate as a keeper\n /// @param _bond The new bond time\n function setBondTime(uint256 _bond) external;\n\n /// @notice Sets the unbond time required unbond what has been bonded\n /// @param _unbond The new unbond time\n function setUnbondTime(uint256 _unbond) external;\n\n /// @notice Sets the minimum amount of liquidity required to fund a job\n /// @param _liquidityMinimum The new minimum amount of liquidity\n function setLiquidityMinimum(uint256 _liquidityMinimum) external;\n\n /// @notice Sets the time required to pass between rewards for jobs\n /// @param _rewardPeriodTime The new amount of time required to pass between rewards\n function setRewardPeriodTime(uint256 _rewardPeriodTime) external;\n\n /// @notice Sets the new inflation period\n /// @param _inflationPeriod The new inflation period\n function setInflationPeriod(uint256 _inflationPeriod) external;\n\n /// @notice Sets the new fee\n /// @param _fee The new fee\n function setFee(uint256 _fee) external;\n}\n" - }, - "solidity/interfaces/peripherals/IKeep3rDisputable.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\n/// @title Keep3rDisputable contract\n/// @notice Creates/resolves disputes for jobs or keepers\n/// A disputed keeper is slashable and is not able to bond, activate, withdraw or receive direct payments\n/// A disputed job is slashable and is not able to pay the keepers, withdraw tokens or to migrate\ninterface IKeep3rDisputable {\n /// @notice Emitted when a keeper or a job is disputed\n /// @param _jobOrKeeper The address of the disputed keeper/job\n /// @param _disputer The user that called the function and disputed the keeper\n event Dispute(address indexed _jobOrKeeper, address indexed _disputer);\n\n /// @notice Emitted when a dispute is resolved\n /// @param _jobOrKeeper The address of the disputed keeper/job\n /// @param _resolver The user that called the function and resolved the dispute\n event Resolve(address indexed _jobOrKeeper, address indexed _resolver);\n\n /// @notice Throws when a job or keeper is already disputed\n error AlreadyDisputed();\n\n /// @notice Throws when a job or keeper is not disputed and someone tries to resolve the dispute\n error NotDisputed();\n\n /// @notice Allows governance to create a dispute for a given keeper/job\n /// @param _jobOrKeeper The address in dispute\n function dispute(address _jobOrKeeper) external;\n\n /// @notice Allows governance to resolve a dispute on a keeper/job\n /// @param _jobOrKeeper The address cleared\n function resolve(address _jobOrKeeper) external;\n}\n" - }, - "solidity/interfaces/peripherals/IKeep3rAccountance.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport './IKeep3rRoles.sol';\n\n/// @title Keep3rDisputable contract\n/// @notice Disputes keepers, or if they're already disputed, it can resolve the case\n/// @dev Argument `bonding` can be the address of either a token or a liquidity\ninterface IKeep3rAccountance is IKeep3rRoles {\n // Events\n\n /// @notice Emitted when the bonding process of a new keeper begins\n /// @param _keeper The caller of Keep3rKeeperFundable#bond function\n /// @param _bonding The asset the keeper has bonded\n /// @param _amount The amount the keeper has bonded\n event Bonding(address indexed _keeper, address indexed _bonding, uint256 _amount);\n\n /// @notice Emitted when a keeper or job begins the unbonding process to withdraw the funds\n /// @param _keeperOrJob The keeper or job that began the unbonding process\n /// @param _unbonding The liquidity pair or asset being unbonded\n /// @param _amount The amount being unbonded\n event Unbonding(address indexed _keeperOrJob, address indexed _unbonding, uint256 _amount);\n\n // Variables\n\n /// @notice Tracks the total KP3R earnings of a keeper since it started working\n /// @param _keeper The address of the keeper\n /// @return _workCompleted Total KP3R earnings of a keeper since it started working\n function workCompleted(address _keeper) external view returns (uint256 _workCompleted);\n\n /// @notice Tracks when a keeper was first registered\n /// @param _keeper The address of the keeper\n /// @return timestamp The time at which the keeper was first registered\n function firstSeen(address _keeper) external view returns (uint256 timestamp);\n\n /// @notice Tracks if a keeper or job has a pending dispute\n /// @param _keeperOrJob The address of the keeper or job\n /// @return _disputed Whether a keeper or job has a pending dispute\n function disputes(address _keeperOrJob) external view returns (bool _disputed);\n\n /// @notice Tracks how much a keeper has bonded of a certain token\n /// @param _keeper The address of the keeper\n /// @param _bond The address of the token being bonded\n /// @return _bonds Amount of a certain token that a keeper has bonded\n function bonds(address _keeper, address _bond) external view returns (uint256 _bonds);\n\n /// @notice The current token credits available for a job\n /// @param _job The address of the job\n /// @param _token The address of the token bonded\n /// @return _amount The amount of token credits available for a job\n function jobTokenCredits(address _job, address _token) external view returns (uint256 _amount);\n\n /// @notice Tracks the amount of assets deposited in pending bonds\n /// @param _keeper The address of the keeper\n /// @param _bonding The address of the token being bonded\n /// @return _pendingBonds Amount of a certain asset a keeper has unbonding\n function pendingBonds(address _keeper, address _bonding) external view returns (uint256 _pendingBonds);\n\n /// @notice Tracks when a bonding for a keeper can be activated\n /// @param _keeper The address of the keeper\n /// @param _bonding The address of the token being bonded\n /// @return _timestamp Time at which the bonding for a keeper can be activated\n function canActivateAfter(address _keeper, address _bonding) external view returns (uint256 _timestamp);\n\n /// @notice Tracks when keeper bonds are ready to be withdrawn\n /// @param _keeper The address of the keeper\n /// @param _bonding The address of the token being unbonded\n /// @return _timestamp Time at which the keeper bonds are ready to be withdrawn\n function canWithdrawAfter(address _keeper, address _bonding) external view returns (uint256 _timestamp);\n\n /// @notice Tracks how much keeper bonds are to be withdrawn\n /// @param _keeper The address of the keeper\n /// @param _bonding The address of the token being unbonded\n /// @return _pendingUnbonds The amount of keeper bonds that are to be withdrawn\n function pendingUnbonds(address _keeper, address _bonding) external view returns (uint256 _pendingUnbonds);\n\n /// @notice Checks whether the address has ever bonded an asset\n /// @param _keeper The address of the keeper\n /// @return _hasBonded Whether the address has ever bonded an asset\n function hasBonded(address _keeper) external view returns (bool _hasBonded);\n\n // Methods\n\n /// @notice Lists all jobs\n /// @return _jobList Array with all the jobs in _jobs\n function jobs() external view returns (address[] memory _jobList);\n\n /// @notice Lists all keepers\n /// @return _keeperList Array with all the keepers in _keepers\n function keepers() external view returns (address[] memory _keeperList);\n\n // Errors\n\n /// @notice Throws when an address is passed as a job, but that address is not a job\n error JobUnavailable();\n\n /// @notice Throws when an action that requires an undisputed job is applied on a disputed job\n error JobDisputed();\n}\n" - }, - "solidity/interfaces/peripherals/IKeep3rRoles.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport './IBaseErrors.sol';\nimport './IGovernable.sol';\nimport './IDustCollector.sol';\n\n/// @title Keep3rRoles contract\n/// @notice Manages the Keep3r specific roles\ninterface IKeep3rRoles is IBaseErrors, IDustCollector, IGovernable {\n // Events\n\n /// @notice Emitted when a slasher is added\n /// @param _slasher Address of the added slasher\n event SlasherAdded(address _slasher);\n\n /// @notice Emitted when a slasher is removed\n /// @param _slasher Address of the removed slasher\n event SlasherRemoved(address _slasher);\n\n /// @notice Emitted when a disputer is added\n /// @param _disputer Address of the added disputer\n event DisputerAdded(address _disputer);\n\n /// @notice Emitted when a disputer is removed\n /// @param _disputer Address of the removed disputer\n event DisputerRemoved(address _disputer);\n\n // Variables\n\n /// @notice Tracks whether the address is a slasher or not\n /// @param _slasher Address being checked as a slasher\n /// @return _isSlasher Whether the address is a slasher or not\n function slashers(address _slasher) external view returns (bool _isSlasher);\n\n /// @notice Tracks whether the address is a disputer or not\n /// @param _disputer Address being checked as a disputer\n /// @return _isDisputer Whether the address is a disputer or not\n function disputers(address _disputer) external view returns (bool _isDisputer);\n\n // Errors\n\n /// @notice Throws if the address is already a registered slasher\n error SlasherExistent();\n\n /// @notice Throws if caller is not a registered slasher\n error SlasherUnexistent();\n\n /// @notice Throws if the address is already a registered disputer\n error DisputerExistent();\n\n /// @notice Throws if caller is not a registered disputer\n error DisputerUnexistent();\n\n /// @notice Throws if the msg.sender is not a slasher or is not a part of governance\n error OnlySlasher();\n\n /// @notice Throws if the msg.sender is not a disputer or is not a part of governance\n error OnlyDisputer();\n\n // Methods\n\n /// @notice Registers a slasher by updating the slashers mapping\n function addSlasher(address _slasher) external;\n\n /// @notice Removes a slasher by updating the slashers mapping\n function removeSlasher(address _slasher) external;\n\n /// @notice Registers a disputer by updating the disputers mapping\n function addDisputer(address _disputer) external;\n\n /// @notice Removes a disputer by updating the disputers mapping\n function removeDisputer(address _disputer) external;\n}\n" - }, - "solidity/interfaces/peripherals/IBaseErrors.sol": { - "content": "// SPDX-License-Identifier: MIT\n\npragma solidity >=0.8.4 <0.9.0;\n\ninterface IBaseErrors {\n /// @notice Throws if a variable is assigned to the zero address\n error ZeroAddress();\n}\n" - }, - "solidity/interfaces/peripherals/IGovernable.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\n/// @title Governable contract\n/// @notice Manages the governance role\ninterface IGovernable {\n // Events\n\n /// @notice Emitted when pendingGovernance accepts to be governance\n /// @param _governance Address of the new governance\n event GovernanceSet(address _governance);\n\n /// @notice Emitted when a new governance is proposed\n /// @param _pendingGovernance Address that is proposed to be the new governance\n event GovernanceProposal(address _pendingGovernance);\n\n // Errors\n\n /// @notice Throws if the caller of the function is not governance\n error OnlyGovernance();\n\n /// @notice Throws if the caller of the function is not pendingGovernance\n error OnlyPendingGovernance();\n\n /// @notice Throws if trying to set governance to zero address\n error NoGovernanceZeroAddress();\n\n // Variables\n\n /// @notice Stores the governance address\n /// @return _governance The governance addresss\n function governance() external view returns (address _governance);\n\n /// @notice Stores the pendingGovernance address\n /// @return _pendingGovernance The pendingGovernance addresss\n function pendingGovernance() external view returns (address _pendingGovernance);\n\n // Methods\n\n /// @notice Proposes a new address to be governance\n /// @param _governance The address being proposed as the new governance\n function setGovernance(address _governance) external;\n\n /// @notice Changes the governance from the current governance to the previously proposed address\n function acceptGovernance() external;\n}\n" - }, - "solidity/interfaces/peripherals/IDustCollector.sol": { - "content": "// SPDX-License-Identifier: MIT\n\npragma solidity >=0.8.4 <0.9.0;\n\nimport './IBaseErrors.sol';\n\ninterface IDustCollector is IBaseErrors {\n /// @notice Emitted when dust is sent\n /// @param _token The token that will be transferred\n /// @param _amount The amount of the token that will be transferred\n /// @param _to The address which will receive the funds\n event DustSent(address _token, uint256 _amount, address _to);\n\n /// @notice Allows an authorized user to transfer the tokens or eth that may have been left in a contract\n /// @param _token The token that will be transferred\n /// @param _amount The amount of the token that will be transferred\n /// @param _to The address that will receive the idle funds\n function sendDust(\n address _token,\n uint256 _amount,\n address _to\n ) external;\n}\n" - }, - "solidity/contracts/peripherals/jobs/Keep3rJobManager.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport './Keep3rJobOwnership.sol';\nimport '../Keep3rAccountance.sol';\nimport '../../../interfaces/peripherals/IKeep3rJobs.sol';\n\nabstract contract Keep3rJobManager is IKeep3rJobManager, Keep3rJobOwnership, Keep3rAccountance {\n using EnumerableSet for EnumerableSet.AddressSet;\n\n /// @inheritdoc IKeep3rJobManager\n function addJob(address _job) external override {\n if (_jobs.contains(_job)) revert JobAlreadyAdded();\n if (hasBonded[_job]) revert AlreadyAKeeper();\n _jobs.add(_job);\n jobOwner[_job] = msg.sender;\n emit JobAddition(_job, msg.sender);\n }\n}\n" - }, - "solidity/contracts/peripherals/jobs/Keep3rJobWorkable.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport './Keep3rJobMigration.sol';\nimport '../../../interfaces/IKeep3rHelper.sol';\nimport '../../../interfaces/peripherals/IKeep3rJobs.sol';\n\nimport '@openzeppelin/contracts/token/ERC20/IERC20.sol';\nimport '@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol';\n\nabstract contract Keep3rJobWorkable is IKeep3rJobWorkable, Keep3rJobMigration {\n using EnumerableSet for EnumerableSet.AddressSet;\n using SafeERC20 for IERC20;\n\n uint256 internal _initialGas;\n\n /// @inheritdoc IKeep3rJobWorkable\n function isKeeper(address _keeper) external override returns (bool _isKeeper) {\n _initialGas = _getGasLeft();\n if (_keepers.contains(_keeper)) {\n emit KeeperValidation(_initialGas);\n return true;\n }\n }\n\n /// @inheritdoc IKeep3rJobWorkable\n function isBondedKeeper(\n address _keeper,\n address _bond,\n uint256 _minBond,\n uint256 _earned,\n uint256 _age\n ) external override returns (bool _isBondedKeeper) {\n _initialGas = _getGasLeft();\n if (\n _keepers.contains(_keeper) &&\n bonds[_keeper][_bond] >= _minBond &&\n workCompleted[_keeper] >= _earned &&\n block.timestamp - firstSeen[_keeper] >= _age\n ) {\n emit KeeperValidation(_initialGas);\n return true;\n }\n }\n\n /// @inheritdoc IKeep3rJobWorkable\n function worked(address _keeper) external virtual override {\n if (_initialGas == 0) revert GasNotInitialized();\n address _job = msg.sender;\n if (disputes[_job]) revert JobDisputed();\n if (!_jobs.contains(_job)) revert JobUnapproved();\n\n if (_updateJobCreditsIfNeeded(_job)) {\n emit LiquidityCreditsReward(_job, rewardedAt[_job], _jobLiquidityCredits[_job], _jobPeriodCredits[_job]);\n }\n\n (uint256 _boost, uint256 _oneEthQuote, uint256 _extraGas) = IKeep3rHelper(keep3rHelper).getPaymentParams(bonds[_keeper][keep3rV1]);\n\n uint256 _gasLeft = _getGasLeft();\n uint256 _payment = _calculatePayment(_gasLeft, _extraGas, _oneEthQuote, _boost);\n\n if (_payment > _jobLiquidityCredits[_job]) {\n _rewardJobCredits(_job);\n emit LiquidityCreditsReward(_job, rewardedAt[_job], _jobLiquidityCredits[_job], _jobPeriodCredits[_job]);\n\n _gasLeft = _getGasLeft();\n _payment = _calculatePayment(_gasLeft, _extraGas, _oneEthQuote, _boost);\n }\n\n _bondedPayment(_job, _keeper, _payment);\n delete _initialGas;\n\n emit KeeperWork(keep3rV1, _job, _keeper, _payment, _gasLeft);\n }\n\n /// @inheritdoc IKeep3rJobWorkable\n function bondedPayment(address _keeper, uint256 _payment) external override {\n address _job = msg.sender;\n\n if (disputes[_job]) revert JobDisputed();\n if (!_jobs.contains(_job)) revert JobUnapproved();\n\n if (_updateJobCreditsIfNeeded(_job)) {\n emit LiquidityCreditsReward(_job, rewardedAt[_job], _jobLiquidityCredits[_job], _jobPeriodCredits[_job]);\n }\n\n if (_payment > _jobLiquidityCredits[_job]) {\n _rewardJobCredits(_job);\n emit LiquidityCreditsReward(_job, rewardedAt[_job], _jobLiquidityCredits[_job], _jobPeriodCredits[_job]);\n }\n\n _bondedPayment(_job, _keeper, _payment);\n emit KeeperWork(keep3rV1, _job, _keeper, _payment, _getGasLeft());\n }\n\n /// @inheritdoc IKeep3rJobWorkable\n function directTokenPayment(\n address _token,\n address _keeper,\n uint256 _amount\n ) external override {\n address _job = msg.sender;\n\n if (disputes[_job]) revert JobDisputed();\n if (disputes[_keeper]) revert Disputed();\n if (!_jobs.contains(_job)) revert JobUnapproved();\n if (jobTokenCredits[_job][_token] < _amount) revert InsufficientFunds();\n jobTokenCredits[_job][_token] -= _amount;\n IERC20(_token).safeTransfer(_keeper, _amount);\n emit KeeperWork(_token, _job, _keeper, _amount, _getGasLeft());\n }\n\n function _bondedPayment(\n address _job,\n address _keeper,\n uint256 _payment\n ) internal {\n if (_payment > _jobLiquidityCredits[_job]) revert InsufficientFunds();\n\n workedAt[_job] = block.timestamp;\n _jobLiquidityCredits[_job] -= _payment;\n bonds[_keeper][keep3rV1] += _payment;\n workCompleted[_keeper] += _payment;\n }\n\n /// @notice Calculate amount to be payed in KP3R, taking into account multiple parameters\n /// @param _gasLeft Amount of gas left after working the job\n /// @param _extraGas Amount of expected unaccounted gas\n /// @param _oneEthQuote Amount of KP3R equivalent to 1 ETH\n /// @param _boost Reward given to the keeper for having bonded KP3R tokens\n /// @return _payment Amount to be payed in KP3R tokens\n function _calculatePayment(\n uint256 _gasLeft,\n uint256 _extraGas,\n uint256 _oneEthQuote,\n uint256 _boost\n ) internal view returns (uint256 _payment) {\n uint256 _accountedGas = _initialGas - _gasLeft + _extraGas;\n _payment = (((_accountedGas * _boost) / _BASE) * _oneEthQuote) / 1 ether;\n }\n\n /// @notice Return the gas left and add 1/64 in order to match real gas left at first level of depth (EIP-150)\n /// @return _gasLeft Amount of gas left recording taking into account EIP-150\n function _getGasLeft() internal view returns (uint256 _gasLeft) {\n _gasLeft = (gasleft() * 64) / 63;\n }\n}\n" - }, - "solidity/contracts/peripherals/jobs/Keep3rJobDisputable.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport './Keep3rJobFundableCredits.sol';\nimport './Keep3rJobFundableLiquidity.sol';\nimport '../Keep3rDisputable.sol';\n\nabstract contract Keep3rJobDisputable is IKeep3rJobDisputable, Keep3rDisputable, Keep3rJobFundableCredits, Keep3rJobFundableLiquidity {\n using EnumerableSet for EnumerableSet.AddressSet;\n using SafeERC20 for IERC20;\n\n /// @inheritdoc IKeep3rJobDisputable\n function slashTokenFromJob(\n address _job,\n address _token,\n uint256 _amount\n ) external override onlySlasher {\n if (!disputes[_job]) revert NotDisputed();\n if (!_jobTokens[_job].contains(_token)) revert JobTokenUnexistent();\n if (jobTokenCredits[_job][_token] < _amount) revert JobTokenInsufficient();\n\n try IERC20(_token).transfer(governance, _amount) {} catch {}\n jobTokenCredits[_job][_token] -= _amount;\n if (jobTokenCredits[_job][_token] == 0) {\n _jobTokens[_job].remove(_token);\n }\n\n emit JobSlashToken(_job, _token, msg.sender, _amount);\n }\n\n /// @inheritdoc IKeep3rJobDisputable\n function slashLiquidityFromJob(\n address _job,\n address _liquidity,\n uint256 _amount\n ) external override onlySlasher {\n if (!disputes[_job]) revert NotDisputed();\n\n _unbondLiquidityFromJob(_job, _liquidity, _amount);\n try IERC20(_liquidity).transfer(governance, _amount) {} catch {}\n emit JobSlashLiquidity(_job, _liquidity, msg.sender, _amount);\n }\n}\n" - }, - "solidity/contracts/peripherals/jobs/Keep3rJobOwnership.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../../../interfaces/peripherals/IKeep3rJobs.sol';\n\nabstract contract Keep3rJobOwnership is IKeep3rJobOwnership {\n /// @inheritdoc IKeep3rJobOwnership\n mapping(address => address) public override jobOwner;\n\n /// @inheritdoc IKeep3rJobOwnership\n mapping(address => address) public override jobPendingOwner;\n\n /// @inheritdoc IKeep3rJobOwnership\n function changeJobOwnership(address _job, address _newOwner) external override onlyJobOwner(_job) {\n jobPendingOwner[_job] = _newOwner;\n emit JobOwnershipChange(_job, jobOwner[_job], _newOwner);\n }\n\n /// @inheritdoc IKeep3rJobOwnership\n function acceptJobOwnership(address _job) external override onlyPendingJobOwner(_job) {\n address _previousOwner = jobOwner[_job];\n\n jobOwner[_job] = jobPendingOwner[_job];\n delete jobPendingOwner[_job];\n\n emit JobOwnershipAssent(msg.sender, _job, _previousOwner);\n }\n\n modifier onlyJobOwner(address _job) {\n if (msg.sender != jobOwner[_job]) revert OnlyJobOwner();\n _;\n }\n\n modifier onlyPendingJobOwner(address _job) {\n if (msg.sender != jobPendingOwner[_job]) revert OnlyPendingJobOwner();\n _;\n }\n}\n" - }, - "solidity/contracts/peripherals/Keep3rAccountance.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '@openzeppelin/contracts/utils/structs/EnumerableSet.sol';\nimport '../../interfaces/peripherals/IKeep3rAccountance.sol';\nimport './Keep3rRoles.sol';\n\nabstract contract Keep3rAccountance is IKeep3rAccountance, Keep3rRoles {\n using EnumerableSet for EnumerableSet.AddressSet;\n\n /// @notice List of all enabled keepers\n EnumerableSet.AddressSet internal _keepers;\n\n /// @inheritdoc IKeep3rAccountance\n mapping(address => uint256) public override workCompleted;\n\n /// @inheritdoc IKeep3rAccountance\n mapping(address => uint256) public override firstSeen;\n\n /// @inheritdoc IKeep3rAccountance\n mapping(address => bool) public override disputes;\n\n /// @inheritdoc IKeep3rAccountance\n /// @notice Mapping (job => bonding => amount)\n mapping(address => mapping(address => uint256)) public override bonds;\n\n /// @inheritdoc IKeep3rAccountance\n mapping(address => mapping(address => uint256)) public override jobTokenCredits;\n\n /// @notice The current liquidity credits available for a job\n mapping(address => uint256) internal _jobLiquidityCredits;\n\n /// @notice Map the address of a job to its correspondent periodCredits\n mapping(address => uint256) internal _jobPeriodCredits;\n\n /// @notice Enumerable array of Job Tokens for Credits\n mapping(address => EnumerableSet.AddressSet) internal _jobTokens;\n\n /// @notice List of liquidities that a job has (job => liquidities)\n mapping(address => EnumerableSet.AddressSet) internal _jobLiquidities;\n\n /// @notice Liquidity pool to observe\n mapping(address => address) internal _liquidityPool;\n\n /// @notice Tracks if a pool has KP3R as token0\n mapping(address => bool) internal _isKP3RToken0;\n\n /// @inheritdoc IKeep3rAccountance\n mapping(address => mapping(address => uint256)) public override pendingBonds;\n\n /// @inheritdoc IKeep3rAccountance\n mapping(address => mapping(address => uint256)) public override canActivateAfter;\n\n /// @inheritdoc IKeep3rAccountance\n mapping(address => mapping(address => uint256)) public override canWithdrawAfter;\n\n /// @inheritdoc IKeep3rAccountance\n mapping(address => mapping(address => uint256)) public override pendingUnbonds;\n\n /// @inheritdoc IKeep3rAccountance\n mapping(address => bool) public override hasBonded;\n\n /// @notice List of all enabled jobs\n EnumerableSet.AddressSet internal _jobs;\n\n /// @inheritdoc IKeep3rAccountance\n function jobs() external view override returns (address[] memory _list) {\n _list = _jobs.values();\n }\n\n /// @inheritdoc IKeep3rAccountance\n function keepers() external view override returns (address[] memory _list) {\n _list = _keepers.values();\n }\n}\n" - }, - "@openzeppelin/contracts/utils/structs/EnumerableSet.sol": { - "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Library for managing\n * https://en.wikipedia.org/wiki/Set_(abstract_data_type)[sets] of primitive\n * types.\n *\n * Sets have the following properties:\n *\n * - Elements are added, removed, and checked for existence in constant time\n * (O(1)).\n * - Elements are enumerated in O(n). No guarantees are made on the ordering.\n *\n * ```\n * contract Example {\n * // Add the library methods\n * using EnumerableSet for EnumerableSet.AddressSet;\n *\n * // Declare a set state variable\n * EnumerableSet.AddressSet private mySet;\n * }\n * ```\n *\n * As of v3.3.0, sets of type `bytes32` (`Bytes32Set`), `address` (`AddressSet`)\n * and `uint256` (`UintSet`) are supported.\n */\nlibrary EnumerableSet {\n // To implement this library for multiple types with as little code\n // repetition as possible, we write it in terms of a generic Set type with\n // bytes32 values.\n // The Set implementation uses private functions, and user-facing\n // implementations (such as AddressSet) are just wrappers around the\n // underlying Set.\n // This means that we can only create new EnumerableSets for types that fit\n // in bytes32.\n\n struct Set {\n // Storage of set values\n bytes32[] _values;\n // Position of the value in the `values` array, plus 1 because index 0\n // means a value is not in the set.\n mapping(bytes32 => uint256) _indexes;\n }\n\n /**\n * @dev Add a value to a set. O(1).\n *\n * Returns true if the value was added to the set, that is if it was not\n * already present.\n */\n function _add(Set storage set, bytes32 value) private returns (bool) {\n if (!_contains(set, value)) {\n set._values.push(value);\n // The value is stored at length-1, but we add 1 to all indexes\n // and use 0 as a sentinel value\n set._indexes[value] = set._values.length;\n return true;\n } else {\n return false;\n }\n }\n\n /**\n * @dev Removes a value from a set. O(1).\n *\n * Returns true if the value was removed from the set, that is if it was\n * present.\n */\n function _remove(Set storage set, bytes32 value) private returns (bool) {\n // We read and store the value's index to prevent multiple reads from the same storage slot\n uint256 valueIndex = set._indexes[value];\n\n if (valueIndex != 0) {\n // Equivalent to contains(set, value)\n // To delete an element from the _values array in O(1), we swap the element to delete with the last one in\n // the array, and then remove the last element (sometimes called as 'swap and pop').\n // This modifies the order of the array, as noted in {at}.\n\n uint256 toDeleteIndex = valueIndex - 1;\n uint256 lastIndex = set._values.length - 1;\n\n if (lastIndex != toDeleteIndex) {\n bytes32 lastvalue = set._values[lastIndex];\n\n // Move the last value to the index where the value to delete is\n set._values[toDeleteIndex] = lastvalue;\n // Update the index for the moved value\n set._indexes[lastvalue] = valueIndex; // Replace lastvalue's index to valueIndex\n }\n\n // Delete the slot where the moved value was stored\n set._values.pop();\n\n // Delete the index for the deleted slot\n delete set._indexes[value];\n\n return true;\n } else {\n return false;\n }\n }\n\n /**\n * @dev Returns true if the value is in the set. O(1).\n */\n function _contains(Set storage set, bytes32 value) private view returns (bool) {\n return set._indexes[value] != 0;\n }\n\n /**\n * @dev Returns the number of values on the set. O(1).\n */\n function _length(Set storage set) private view returns (uint256) {\n return set._values.length;\n }\n\n /**\n * @dev Returns the value stored at position `index` in the set. O(1).\n *\n * Note that there are no guarantees on the ordering of values inside the\n * array, and it may change when more values are added or removed.\n *\n * Requirements:\n *\n * - `index` must be strictly less than {length}.\n */\n function _at(Set storage set, uint256 index) private view returns (bytes32) {\n return set._values[index];\n }\n\n /**\n * @dev Return the entire set in an array\n *\n * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed\n * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that\n * this function has an unbounded cost, and using it as part of a state-changing function may render the function\n * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.\n */\n function _values(Set storage set) private view returns (bytes32[] memory) {\n return set._values;\n }\n\n // Bytes32Set\n\n struct Bytes32Set {\n Set _inner;\n }\n\n /**\n * @dev Add a value to a set. O(1).\n *\n * Returns true if the value was added to the set, that is if it was not\n * already present.\n */\n function add(Bytes32Set storage set, bytes32 value) internal returns (bool) {\n return _add(set._inner, value);\n }\n\n /**\n * @dev Removes a value from a set. O(1).\n *\n * Returns true if the value was removed from the set, that is if it was\n * present.\n */\n function remove(Bytes32Set storage set, bytes32 value) internal returns (bool) {\n return _remove(set._inner, value);\n }\n\n /**\n * @dev Returns true if the value is in the set. O(1).\n */\n function contains(Bytes32Set storage set, bytes32 value) internal view returns (bool) {\n return _contains(set._inner, value);\n }\n\n /**\n * @dev Returns the number of values in the set. O(1).\n */\n function length(Bytes32Set storage set) internal view returns (uint256) {\n return _length(set._inner);\n }\n\n /**\n * @dev Returns the value stored at position `index` in the set. O(1).\n *\n * Note that there are no guarantees on the ordering of values inside the\n * array, and it may change when more values are added or removed.\n *\n * Requirements:\n *\n * - `index` must be strictly less than {length}.\n */\n function at(Bytes32Set storage set, uint256 index) internal view returns (bytes32) {\n return _at(set._inner, index);\n }\n\n /**\n * @dev Return the entire set in an array\n *\n * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed\n * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that\n * this function has an unbounded cost, and using it as part of a state-changing function may render the function\n * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.\n */\n function values(Bytes32Set storage set) internal view returns (bytes32[] memory) {\n return _values(set._inner);\n }\n\n // AddressSet\n\n struct AddressSet {\n Set _inner;\n }\n\n /**\n * @dev Add a value to a set. O(1).\n *\n * Returns true if the value was added to the set, that is if it was not\n * already present.\n */\n function add(AddressSet storage set, address value) internal returns (bool) {\n return _add(set._inner, bytes32(uint256(uint160(value))));\n }\n\n /**\n * @dev Removes a value from a set. O(1).\n *\n * Returns true if the value was removed from the set, that is if it was\n * present.\n */\n function remove(AddressSet storage set, address value) internal returns (bool) {\n return _remove(set._inner, bytes32(uint256(uint160(value))));\n }\n\n /**\n * @dev Returns true if the value is in the set. O(1).\n */\n function contains(AddressSet storage set, address value) internal view returns (bool) {\n return _contains(set._inner, bytes32(uint256(uint160(value))));\n }\n\n /**\n * @dev Returns the number of values in the set. O(1).\n */\n function length(AddressSet storage set) internal view returns (uint256) {\n return _length(set._inner);\n }\n\n /**\n * @dev Returns the value stored at position `index` in the set. O(1).\n *\n * Note that there are no guarantees on the ordering of values inside the\n * array, and it may change when more values are added or removed.\n *\n * Requirements:\n *\n * - `index` must be strictly less than {length}.\n */\n function at(AddressSet storage set, uint256 index) internal view returns (address) {\n return address(uint160(uint256(_at(set._inner, index))));\n }\n\n /**\n * @dev Return the entire set in an array\n *\n * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed\n * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that\n * this function has an unbounded cost, and using it as part of a state-changing function may render the function\n * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.\n */\n function values(AddressSet storage set) internal view returns (address[] memory) {\n bytes32[] memory store = _values(set._inner);\n address[] memory result;\n\n assembly {\n result := store\n }\n\n return result;\n }\n\n // UintSet\n\n struct UintSet {\n Set _inner;\n }\n\n /**\n * @dev Add a value to a set. O(1).\n *\n * Returns true if the value was added to the set, that is if it was not\n * already present.\n */\n function add(UintSet storage set, uint256 value) internal returns (bool) {\n return _add(set._inner, bytes32(value));\n }\n\n /**\n * @dev Removes a value from a set. O(1).\n *\n * Returns true if the value was removed from the set, that is if it was\n * present.\n */\n function remove(UintSet storage set, uint256 value) internal returns (bool) {\n return _remove(set._inner, bytes32(value));\n }\n\n /**\n * @dev Returns true if the value is in the set. O(1).\n */\n function contains(UintSet storage set, uint256 value) internal view returns (bool) {\n return _contains(set._inner, bytes32(value));\n }\n\n /**\n * @dev Returns the number of values on the set. O(1).\n */\n function length(UintSet storage set) internal view returns (uint256) {\n return _length(set._inner);\n }\n\n /**\n * @dev Returns the value stored at position `index` in the set. O(1).\n *\n * Note that there are no guarantees on the ordering of values inside the\n * array, and it may change when more values are added or removed.\n *\n * Requirements:\n *\n * - `index` must be strictly less than {length}.\n */\n function at(UintSet storage set, uint256 index) internal view returns (uint256) {\n return uint256(_at(set._inner, index));\n }\n\n /**\n * @dev Return the entire set in an array\n *\n * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed\n * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that\n * this function has an unbounded cost, and using it as part of a state-changing function may render the function\n * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.\n */\n function values(UintSet storage set) internal view returns (uint256[] memory) {\n bytes32[] memory store = _values(set._inner);\n uint256[] memory result;\n\n assembly {\n result := store\n }\n\n return result;\n }\n}\n" - }, - "solidity/contracts/peripherals/Keep3rRoles.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../../interfaces/peripherals/IKeep3rRoles.sol';\nimport '@openzeppelin/contracts/utils/structs/EnumerableSet.sol';\nimport './DustCollector.sol';\nimport './Governable.sol';\n\ncontract Keep3rRoles is IKeep3rRoles, Governable, DustCollector {\n /// @inheritdoc IKeep3rRoles\n mapping(address => bool) public override slashers;\n\n /// @inheritdoc IKeep3rRoles\n mapping(address => bool) public override disputers;\n\n constructor(address _governance) Governable(_governance) DustCollector() {}\n\n /// @inheritdoc IKeep3rRoles\n function addSlasher(address _slasher) external override onlyGovernance {\n if (_slasher == address(0)) revert ZeroAddress();\n if (slashers[_slasher]) revert SlasherExistent();\n slashers[_slasher] = true;\n emit SlasherAdded(_slasher);\n }\n\n /// @inheritdoc IKeep3rRoles\n function removeSlasher(address _slasher) external override onlyGovernance {\n if (!slashers[_slasher]) revert SlasherUnexistent();\n delete slashers[_slasher];\n emit SlasherRemoved(_slasher);\n }\n\n /// @inheritdoc IKeep3rRoles\n function addDisputer(address _disputer) external override onlyGovernance {\n if (_disputer == address(0)) revert ZeroAddress();\n if (disputers[_disputer]) revert DisputerExistent();\n disputers[_disputer] = true;\n emit DisputerAdded(_disputer);\n }\n\n /// @inheritdoc IKeep3rRoles\n function removeDisputer(address _disputer) external override onlyGovernance {\n if (!disputers[_disputer]) revert DisputerUnexistent();\n delete disputers[_disputer];\n emit DisputerRemoved(_disputer);\n }\n\n /// @notice Functions with this modifier can only be called by either a slasher or governance\n modifier onlySlasher {\n if (!slashers[msg.sender]) revert OnlySlasher();\n _;\n }\n\n /// @notice Functions with this modifier can only be called by either a disputer or governance\n modifier onlyDisputer {\n if (!disputers[msg.sender]) revert OnlyDisputer();\n _;\n }\n}\n" - }, - "solidity/contracts/peripherals/Governable.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../../interfaces/peripherals/IGovernable.sol';\n\nabstract contract Governable is IGovernable {\n /// @inheritdoc IGovernable\n address public override governance;\n\n /// @inheritdoc IGovernable\n address public override pendingGovernance;\n\n constructor(address _governance) {\n if (_governance == address(0)) revert NoGovernanceZeroAddress();\n governance = _governance;\n }\n\n /// @inheritdoc IGovernable\n function setGovernance(address _governance) external override onlyGovernance {\n pendingGovernance = _governance;\n emit GovernanceProposal(_governance);\n }\n\n /// @inheritdoc IGovernable\n function acceptGovernance() external override onlyPendingGovernance {\n governance = pendingGovernance;\n delete pendingGovernance;\n emit GovernanceSet(governance);\n }\n\n /// @notice Functions with this modifier can only be called by governance\n modifier onlyGovernance {\n if (msg.sender != governance) revert OnlyGovernance();\n _;\n }\n\n /// @notice Functions with this modifier can only be called by pendingGovernance\n modifier onlyPendingGovernance {\n if (msg.sender != pendingGovernance) revert OnlyPendingGovernance();\n _;\n }\n}\n" - }, - "@openzeppelin/contracts/token/ERC20/IERC20.sol": { - "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Interface of the ERC20 standard as defined in the EIP.\n */\ninterface IERC20 {\n /**\n * @dev Returns the amount of tokens in existence.\n */\n function totalSupply() external view returns (uint256);\n\n /**\n * @dev Returns the amount of tokens owned by `account`.\n */\n function balanceOf(address account) external view returns (uint256);\n\n /**\n * @dev Moves `amount` tokens from the caller's account to `recipient`.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * Emits a {Transfer} event.\n */\n function transfer(address recipient, uint256 amount) external returns (bool);\n\n /**\n * @dev Returns the remaining number of tokens that `spender` will be\n * allowed to spend on behalf of `owner` through {transferFrom}. This is\n * zero by default.\n *\n * This value changes when {approve} or {transferFrom} are called.\n */\n function allowance(address owner, address spender) external view returns (uint256);\n\n /**\n * @dev Sets `amount` as the allowance of `spender` over the caller's tokens.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * IMPORTANT: Beware that changing an allowance with this method brings the risk\n * that someone may use both the old and the new allowance by unfortunate\n * transaction ordering. One possible solution to mitigate this race\n * condition is to first reduce the spender's allowance to 0 and set the\n * desired value afterwards:\n * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729\n *\n * Emits an {Approval} event.\n */\n function approve(address spender, uint256 amount) external returns (bool);\n\n /**\n * @dev Moves `amount` tokens from `sender` to `recipient` using the\n * allowance mechanism. `amount` is then deducted from the caller's\n * allowance.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * Emits a {Transfer} event.\n */\n function transferFrom(\n address sender,\n address recipient,\n uint256 amount\n ) external returns (bool);\n\n /**\n * @dev Emitted when `value` tokens are moved from one account (`from`) to\n * another (`to`).\n *\n * Note that `value` may be zero.\n */\n event Transfer(address indexed from, address indexed to, uint256 value);\n\n /**\n * @dev Emitted when the allowance of a `spender` for an `owner` is set by\n * a call to {approve}. `value` is the new allowance.\n */\n event Approval(address indexed owner, address indexed spender, uint256 value);\n}\n" - }, - "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol": { - "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\nimport \"../IERC20.sol\";\nimport \"../../../utils/Address.sol\";\n\n/**\n * @title SafeERC20\n * @dev Wrappers around ERC20 operations that throw on failure (when the token\n * contract returns false). Tokens that return no value (and instead revert or\n * throw on failure) are also supported, non-reverting calls are assumed to be\n * successful.\n * To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract,\n * which allows you to call the safe operations as `token.safeTransfer(...)`, etc.\n */\nlibrary SafeERC20 {\n using Address for address;\n\n function safeTransfer(\n IERC20 token,\n address to,\n uint256 value\n ) internal {\n _callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value));\n }\n\n function safeTransferFrom(\n IERC20 token,\n address from,\n address to,\n uint256 value\n ) internal {\n _callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value));\n }\n\n /**\n * @dev Deprecated. This function has issues similar to the ones found in\n * {IERC20-approve}, and its usage is discouraged.\n *\n * Whenever possible, use {safeIncreaseAllowance} and\n * {safeDecreaseAllowance} instead.\n */\n function safeApprove(\n IERC20 token,\n address spender,\n uint256 value\n ) internal {\n // safeApprove should only be called when setting an initial allowance,\n // or when resetting it to zero. To increase and decrease it, use\n // 'safeIncreaseAllowance' and 'safeDecreaseAllowance'\n require(\n (value == 0) || (token.allowance(address(this), spender) == 0),\n \"SafeERC20: approve from non-zero to non-zero allowance\"\n );\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value));\n }\n\n function safeIncreaseAllowance(\n IERC20 token,\n address spender,\n uint256 value\n ) internal {\n uint256 newAllowance = token.allowance(address(this), spender) + value;\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));\n }\n\n function safeDecreaseAllowance(\n IERC20 token,\n address spender,\n uint256 value\n ) internal {\n unchecked {\n uint256 oldAllowance = token.allowance(address(this), spender);\n require(oldAllowance >= value, \"SafeERC20: decreased allowance below zero\");\n uint256 newAllowance = oldAllowance - value;\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));\n }\n }\n\n /**\n * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement\n * on the return value: the return value is optional (but if data is returned, it must not be false).\n * @param token The token targeted by the call.\n * @param data The call data (encoded using abi.encode or one of its variants).\n */\n function _callOptionalReturn(IERC20 token, bytes memory data) private {\n // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since\n // we're implementing it ourselves. We use {Address.functionCall} to perform this call, which verifies that\n // the target address contains contract code and also asserts for success in the low-level call.\n\n bytes memory returndata = address(token).functionCall(data, \"SafeERC20: low-level call failed\");\n if (returndata.length > 0) {\n // Return data is optional\n require(abi.decode(returndata, (bool)), \"SafeERC20: ERC20 operation did not succeed\");\n }\n }\n}\n" - }, - "@openzeppelin/contracts/utils/Address.sol": { - "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Collection of functions related to the address type\n */\nlibrary Address {\n /**\n * @dev Returns true if `account` is a contract.\n *\n * [IMPORTANT]\n * ====\n * It is unsafe to assume that an address for which this function returns\n * false is an externally-owned account (EOA) and not a contract.\n *\n * Among others, `isContract` will return false for the following\n * types of addresses:\n *\n * - an externally-owned account\n * - a contract in construction\n * - an address where a contract will be created\n * - an address where a contract lived, but was destroyed\n * ====\n */\n function isContract(address account) internal view returns (bool) {\n // This method relies on extcodesize, which returns 0 for contracts in\n // construction, since the code is only stored at the end of the\n // constructor execution.\n\n uint256 size;\n assembly {\n size := extcodesize(account)\n }\n return size > 0;\n }\n\n /**\n * @dev Replacement for Solidity's `transfer`: sends `amount` wei to\n * `recipient`, forwarding all available gas and reverting on errors.\n *\n * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost\n * of certain opcodes, possibly making contracts go over the 2300 gas limit\n * imposed by `transfer`, making them unable to receive funds via\n * `transfer`. {sendValue} removes this limitation.\n *\n * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].\n *\n * IMPORTANT: because control is transferred to `recipient`, care must be\n * taken to not create reentrancy vulnerabilities. Consider using\n * {ReentrancyGuard} or the\n * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].\n */\n function sendValue(address payable recipient, uint256 amount) internal {\n require(address(this).balance >= amount, \"Address: insufficient balance\");\n\n (bool success, ) = recipient.call{value: amount}(\"\");\n require(success, \"Address: unable to send value, recipient may have reverted\");\n }\n\n /**\n * @dev Performs a Solidity function call using a low level `call`. A\n * plain `call` is an unsafe replacement for a function call: use this\n * function instead.\n *\n * If `target` reverts with a revert reason, it is bubbled up by this\n * function (like regular Solidity function calls).\n *\n * Returns the raw returned data. To convert to the expected return value,\n * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\n *\n * Requirements:\n *\n * - `target` must be a contract.\n * - calling `target` with `data` must not revert.\n *\n * _Available since v3.1._\n */\n function functionCall(address target, bytes memory data) internal returns (bytes memory) {\n return functionCall(target, data, \"Address: low-level call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with\n * `errorMessage` as a fallback revert reason when `target` reverts.\n *\n * _Available since v3.1._\n */\n function functionCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal returns (bytes memory) {\n return functionCallWithValue(target, data, 0, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but also transferring `value` wei to `target`.\n *\n * Requirements:\n *\n * - the calling contract must have an ETH balance of at least `value`.\n * - the called Solidity function must be `payable`.\n *\n * _Available since v3.1._\n */\n function functionCallWithValue(\n address target,\n bytes memory data,\n uint256 value\n ) internal returns (bytes memory) {\n return functionCallWithValue(target, data, value, \"Address: low-level call with value failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but\n * with `errorMessage` as a fallback revert reason when `target` reverts.\n *\n * _Available since v3.1._\n */\n function functionCallWithValue(\n address target,\n bytes memory data,\n uint256 value,\n string memory errorMessage\n ) internal returns (bytes memory) {\n require(address(this).balance >= value, \"Address: insufficient balance for call\");\n require(isContract(target), \"Address: call to non-contract\");\n\n (bool success, bytes memory returndata) = target.call{value: value}(data);\n return verifyCallResult(success, returndata, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but performing a static call.\n *\n * _Available since v3.3._\n */\n function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\n return functionStaticCall(target, data, \"Address: low-level static call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\n * but performing a static call.\n *\n * _Available since v3.3._\n */\n function functionStaticCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal view returns (bytes memory) {\n require(isContract(target), \"Address: static call to non-contract\");\n\n (bool success, bytes memory returndata) = target.staticcall(data);\n return verifyCallResult(success, returndata, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but performing a delegate call.\n *\n * _Available since v3.4._\n */\n function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {\n return functionDelegateCall(target, data, \"Address: low-level delegate call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\n * but performing a delegate call.\n *\n * _Available since v3.4._\n */\n function functionDelegateCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal returns (bytes memory) {\n require(isContract(target), \"Address: delegate call to non-contract\");\n\n (bool success, bytes memory returndata) = target.delegatecall(data);\n return verifyCallResult(success, returndata, errorMessage);\n }\n\n /**\n * @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the\n * revert reason using the provided one.\n *\n * _Available since v4.3._\n */\n function verifyCallResult(\n bool success,\n bytes memory returndata,\n string memory errorMessage\n ) internal pure returns (bytes memory) {\n if (success) {\n return returndata;\n } else {\n // Look for revert reason and bubble it up if present\n if (returndata.length > 0) {\n // The easiest way to bubble the revert reason is using memory via assembly\n\n assembly {\n let returndata_size := mload(returndata)\n revert(add(32, returndata), returndata_size)\n }\n } else {\n revert(errorMessage);\n }\n }\n }\n}\n" - }, - "solidity/contracts/peripherals/jobs/Keep3rJobMigration.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../../../interfaces/peripherals/IKeep3rJobs.sol';\nimport './Keep3rJobFundableCredits.sol';\nimport './Keep3rJobFundableLiquidity.sol';\n\nabstract contract Keep3rJobMigration is IKeep3rJobMigration, Keep3rJobFundableCredits, Keep3rJobFundableLiquidity {\n using EnumerableSet for EnumerableSet.AddressSet;\n\n uint256 internal constant _MIGRATION_COOLDOWN = 1 minutes;\n\n /// @inheritdoc IKeep3rJobMigration\n mapping(address => address) public override pendingJobMigrations;\n mapping(address => mapping(address => uint256)) internal _migrationCreatedAt;\n\n /// @inheritdoc IKeep3rJobMigration\n function migrateJob(address _fromJob, address _toJob) external override onlyJobOwner(_fromJob) {\n if (_fromJob == _toJob) revert JobMigrationImpossible();\n\n pendingJobMigrations[_fromJob] = _toJob;\n _migrationCreatedAt[_fromJob][_toJob] = block.timestamp;\n\n emit JobMigrationRequested(_fromJob, _toJob);\n }\n\n /// @inheritdoc IKeep3rJobMigration\n function acceptJobMigration(address _fromJob, address _toJob) external override onlyJobOwner(_toJob) {\n if (disputes[_fromJob] || disputes[_toJob]) revert JobDisputed();\n if (pendingJobMigrations[_fromJob] != _toJob) revert JobMigrationUnavailable();\n if (block.timestamp < _migrationCreatedAt[_fromJob][_toJob] + _MIGRATION_COOLDOWN) revert JobMigrationLocked();\n\n // force job credits update for both jobs\n _settleJobAccountance(_fromJob);\n _settleJobAccountance(_toJob);\n\n // migrate tokens\n while (_jobTokens[_fromJob].length() > 0) {\n address _tokenToMigrate = _jobTokens[_fromJob].at(0);\n jobTokenCredits[_toJob][_tokenToMigrate] += jobTokenCredits[_fromJob][_tokenToMigrate];\n delete jobTokenCredits[_fromJob][_tokenToMigrate];\n _jobTokens[_fromJob].remove(_tokenToMigrate);\n _jobTokens[_toJob].add(_tokenToMigrate);\n }\n\n // migrate liquidities\n while (_jobLiquidities[_fromJob].length() > 0) {\n address _liquidity = _jobLiquidities[_fromJob].at(0);\n\n liquidityAmount[_toJob][_liquidity] += liquidityAmount[_fromJob][_liquidity];\n delete liquidityAmount[_fromJob][_liquidity];\n\n _jobLiquidities[_toJob].add(_liquidity);\n _jobLiquidities[_fromJob].remove(_liquidity);\n }\n\n // migrate job balances\n _jobPeriodCredits[_toJob] += _jobPeriodCredits[_fromJob];\n delete _jobPeriodCredits[_fromJob];\n\n _jobLiquidityCredits[_toJob] += _jobLiquidityCredits[_fromJob];\n delete _jobLiquidityCredits[_fromJob];\n\n // stop _fromJob from being a job\n delete rewardedAt[_fromJob];\n _jobs.remove(_fromJob);\n\n // delete unused data slots\n delete jobOwner[_fromJob];\n delete jobPendingOwner[_fromJob];\n delete _migrationCreatedAt[_fromJob][_toJob];\n delete pendingJobMigrations[_fromJob];\n\n emit JobMigrationSuccessful(_fromJob, _toJob);\n }\n}\n" - }, - "solidity/interfaces/IKeep3rHelper.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport './IKeep3rHelperParameters.sol';\n\n/// @title Keep3rHelper contract\n/// @notice Contains all the helper functions used throughout the different files.\ninterface IKeep3rHelper is IKeep3rHelperParameters {\n // Errors\n\n /// @notice Throws when none of the tokens in the liquidity pair is KP3R\n error LiquidityPairInvalid();\n\n // Methods\n // solhint-enable func-name-mixedcase\n\n /// @notice Calculates the amount of KP3R that corresponds to the ETH passed into the function\n /// @dev This function allows us to calculate how much KP3R we should pay to a keeper for things expressed in ETH, like gas\n /// @param _eth The amount of ETH\n /// @return _amountOut The amount of KP3R\n function quote(uint256 _eth) external view returns (uint256 _amountOut);\n\n /// @notice Returns the amount of KP3R the keeper has bonded\n /// @param _keeper The address of the keeper to check\n /// @return _amountBonded The amount of KP3R the keeper has bonded\n function bonds(address _keeper) external view returns (uint256 _amountBonded);\n\n /// @notice Calculates the reward (in KP3R) that corresponds to a keeper for using gas\n /// @param _keeper The address of the keeper to check\n /// @param _gasUsed The amount of gas used that will be rewarded\n /// @return _kp3r The amount of KP3R that should be awarded to the keeper\n function getRewardAmountFor(address _keeper, uint256 _gasUsed) external view returns (uint256 _kp3r);\n\n /// @notice Calculates the boost in the reward given to a keeper based on the amount of KP3R that keeper has bonded\n /// @dev If the keeper has no bonds, boost should be +10% of gas cost, if keeper has max bonds, +20%\n /// @param _bonds The amount of KP3R tokens bonded by the keeper\n /// @return _rewardBoost The reward boost that corresponds to the keeper\n function getRewardBoostFor(uint256 _bonds) external view returns (uint256 _rewardBoost);\n\n /// @notice Calculates the reward (in KP3R) that corresponds to tx.origin for using gas\n /// @param _gasUsed The amount of gas used that will be rewarded\n /// @return _amount The amount of KP3R that should be awarded to tx.origin\n function getRewardAmount(uint256 _gasUsed) external view returns (uint256 _amount);\n\n /// @notice Given a pool address, returns the underlying tokens of the pair\n /// @param _pool Address of the correspondant pool\n /// @return _token0 Address of the first token of the pair\n /// @return _token1 Address of the second token of the pair\n function getPoolTokens(address _pool) external view returns (address _token0, address _token1);\n\n /// @notice Defines the order of the tokens in the pair for twap calculations\n /// @param _pool Address of the correspondant pool\n /// @return _isKP3RToken0 Boolean indicating the order of the tokens in the pair\n function isKP3RToken0(address _pool) external view returns (bool _isKP3RToken0);\n\n /// @notice Given an array of secondsAgo, returns UniswapV3 pool cumulatives at that moment\n /// @param _pool Address of the pool to observe\n /// @param _secondsAgo Array with time references to observe\n /// @return _tickCumulative1 Cumulative sum of ticks until first time reference\n /// @return _tickCumulative2 Cumulative sum of ticks until second time reference\n /// @return _success Boolean indicating if the observe call was succesfull\n function observe(address _pool, uint32[] memory _secondsAgo)\n external\n view\n returns (\n int56 _tickCumulative1,\n int56 _tickCumulative2,\n bool _success\n );\n\n /// @notice Get multiplier, quote, and extra, in order to calculate keeper payment\n /// @param _bonds Amount of bonded KP3R owned by the keeper\n /// @return _boost Multiplier per gas unit. Takes into account the base fee and the amount of bonded KP3R\n /// @return _oneEthQuote Amount of KP3R tokens equivalent to 1 ETH\n /// @return _extra Amount of extra gas that should be added to the gas spent\n function getPaymentParams(uint256 _bonds)\n external\n view\n returns (\n uint256 _boost,\n uint256 _oneEthQuote,\n uint256 _extra\n );\n\n /// @notice Given a tick and a liquidity amount, calculates the underlying KP3R tokens\n /// @param _liquidityAmount Amount of liquidity to be converted\n /// @param _tickDifference Tick value used to calculate the quote\n /// @param _timeInterval Time value used to calculate the quote\n /// @return _kp3rAmount Amount of KP3R tokens underlying on the given liquidity\n function getKP3RsAtTick(\n uint256 _liquidityAmount,\n int56 _tickDifference,\n uint256 _timeInterval\n ) external pure returns (uint256 _kp3rAmount);\n\n /// @notice Given a tick and a token amount, calculates the output in correspondant token\n /// @param _baseAmount Amount of token to be converted\n /// @param _tickDifference Tick value used to calculate the quote\n /// @param _timeInterval Time value used to calculate the quote\n /// @return _quoteAmount Amount of credits deserved for the baseAmount at the tick value\n function getQuoteAtTick(\n uint128 _baseAmount,\n int56 _tickDifference,\n uint256 _timeInterval\n ) external pure returns (uint256 _quoteAmount);\n}\n" - }, - "solidity/contracts/peripherals/jobs/Keep3rJobFundableCredits.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport './Keep3rJobOwnership.sol';\nimport '../Keep3rAccountance.sol';\nimport '../Keep3rParameters.sol';\nimport '../../../interfaces/peripherals/IKeep3rJobs.sol';\n\nimport '@openzeppelin/contracts/security/ReentrancyGuard.sol';\nimport '@openzeppelin/contracts/token/ERC20/IERC20.sol';\nimport '@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol';\nimport '@openzeppelin/contracts/utils/math/Math.sol';\n\nabstract contract Keep3rJobFundableCredits is IKeep3rJobFundableCredits, ReentrancyGuard, Keep3rJobOwnership, Keep3rParameters {\n using EnumerableSet for EnumerableSet.AddressSet;\n using SafeERC20 for IERC20;\n\n /// @notice Cooldown between withdrawals\n uint256 internal constant _WITHDRAW_TOKENS_COOLDOWN = 1 minutes;\n\n /// @inheritdoc IKeep3rJobFundableCredits\n mapping(address => mapping(address => uint256)) public override jobTokenCreditsAddedAt;\n\n /// @inheritdoc IKeep3rJobFundableCredits\n function addTokenCreditsToJob(\n address _job,\n address _token,\n uint256 _amount\n ) external override nonReentrant {\n if (!_jobs.contains(_job)) revert JobUnavailable();\n // KP3R shouldn't be used for direct token payments\n if (_token == keep3rV1) revert TokenUnallowed();\n uint256 _before = IERC20(_token).balanceOf(address(this));\n IERC20(_token).safeTransferFrom(msg.sender, address(this), _amount);\n uint256 _received = IERC20(_token).balanceOf(address(this)) - _before;\n uint256 _tokenFee = (_received * fee) / _BASE;\n jobTokenCredits[_job][_token] += _received - _tokenFee;\n jobTokenCreditsAddedAt[_job][_token] = block.timestamp;\n IERC20(_token).safeTransfer(governance, _tokenFee);\n _jobTokens[_job].add(_token);\n\n emit TokenCreditAddition(_job, _token, msg.sender, _received);\n }\n\n /// @inheritdoc IKeep3rJobFundableCredits\n function withdrawTokenCreditsFromJob(\n address _job,\n address _token,\n uint256 _amount,\n address _receiver\n ) external override nonReentrant onlyJobOwner(_job) {\n if (block.timestamp <= jobTokenCreditsAddedAt[_job][_token] + _WITHDRAW_TOKENS_COOLDOWN) revert JobTokenCreditsLocked();\n if (jobTokenCredits[_job][_token] < _amount) revert InsufficientJobTokenCredits();\n if (disputes[_job]) revert JobDisputed();\n\n jobTokenCredits[_job][_token] -= _amount;\n IERC20(_token).safeTransfer(_receiver, _amount);\n\n if (jobTokenCredits[_job][_token] == 0) {\n _jobTokens[_job].remove(_token);\n }\n\n emit TokenCreditWithdrawal(_job, _token, _receiver, _amount);\n }\n}\n" - }, - "solidity/contracts/peripherals/jobs/Keep3rJobFundableLiquidity.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport './Keep3rJobOwnership.sol';\nimport '../Keep3rAccountance.sol';\nimport '../Keep3rParameters.sol';\nimport '../../../interfaces/IPairManager.sol';\nimport '../../../interfaces/peripherals/IKeep3rJobs.sol';\n\nimport '../../libraries/FullMath.sol';\n\nimport '@openzeppelin/contracts/security/ReentrancyGuard.sol';\nimport '@openzeppelin/contracts/token/ERC20/IERC20.sol';\nimport '@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol';\nimport '@openzeppelin/contracts/utils/math/Math.sol';\n\nabstract contract Keep3rJobFundableLiquidity is IKeep3rJobFundableLiquidity, ReentrancyGuard, Keep3rJobOwnership, Keep3rParameters {\n using EnumerableSet for EnumerableSet.AddressSet;\n using SafeERC20 for IERC20;\n\n /// @notice List of liquidities that are accepted in the system\n EnumerableSet.AddressSet internal _approvedLiquidities;\n\n /// @inheritdoc IKeep3rJobFundableLiquidity\n mapping(address => mapping(address => uint256)) public override liquidityAmount;\n\n /// @inheritdoc IKeep3rJobFundableLiquidity\n mapping(address => uint256) public override rewardedAt;\n\n /// @inheritdoc IKeep3rJobFundableLiquidity\n mapping(address => uint256) public override workedAt;\n\n /// @notice Tracks an address and returns its TickCache\n mapping(address => TickCache) internal _tick;\n\n // Views\n\n /// @inheritdoc IKeep3rJobFundableLiquidity\n function approvedLiquidities() external view override returns (address[] memory _list) {\n _list = _approvedLiquidities.values();\n }\n\n /// @inheritdoc IKeep3rJobFundableLiquidity\n function jobPeriodCredits(address _job) public view override returns (uint256 _periodCredits) {\n for (uint256 i; i < _jobLiquidities[_job].length(); i++) {\n address _liquidity = _jobLiquidities[_job].at(i);\n if (_approvedLiquidities.contains(_liquidity)) {\n TickCache memory _tickCache = observeLiquidity(_liquidity);\n if (_tickCache.period != 0) {\n int56 _tickDifference = _isKP3RToken0[_liquidity] ? _tickCache.difference : -_tickCache.difference;\n _periodCredits += _getReward(\n IKeep3rHelper(keep3rHelper).getKP3RsAtTick(liquidityAmount[_job][_liquidity], _tickDifference, rewardPeriodTime)\n );\n }\n }\n }\n }\n\n /// @inheritdoc IKeep3rJobFundableLiquidity\n function jobLiquidityCredits(address _job) public view override returns (uint256 _liquidityCredits) {\n uint256 _periodCredits = jobPeriodCredits(_job);\n\n // If the job was rewarded in the past 1 period time\n if ((block.timestamp - rewardedAt[_job]) < rewardPeriodTime) {\n // If the job has period credits, update minted job credits to new twap\n _liquidityCredits = _periodCredits > 0\n ? (_jobLiquidityCredits[_job] * _periodCredits) / _jobPeriodCredits[_job] // If the job has period credits, return remaining job credits updated to new twap\n : _jobLiquidityCredits[_job]; // If not, return remaining credits, forced credits should not be updated\n } else {\n // Else return a full period worth of credits if current credits have expired\n _liquidityCredits = _periodCredits;\n }\n }\n\n /// @inheritdoc IKeep3rJobFundableLiquidity\n function totalJobCredits(address _job) external view override returns (uint256 _credits) {\n uint256 _periodCredits = jobPeriodCredits(_job);\n uint256 _cooldown = block.timestamp;\n\n if ((rewardedAt[_job] > _period(block.timestamp - rewardPeriodTime))) {\n // Will calculate cooldown if it outdated\n if ((block.timestamp - rewardedAt[_job]) >= rewardPeriodTime) {\n // Will calculate cooldown from last reward reference in this period\n _cooldown -= (rewardedAt[_job] + rewardPeriodTime);\n } else {\n // Will calculate cooldown from last reward timestamp\n _cooldown -= rewardedAt[_job];\n }\n } else {\n // Will calculate cooldown from period start if expired\n _cooldown -= _period(block.timestamp);\n }\n _credits = jobLiquidityCredits(_job) + _phase(_cooldown, _periodCredits);\n }\n\n /// @inheritdoc IKeep3rJobFundableLiquidity\n function quoteLiquidity(address _liquidity, uint256 _amount) external view override returns (uint256 _periodCredits) {\n if (_approvedLiquidities.contains(_liquidity)) {\n TickCache memory _tickCache = observeLiquidity(_liquidity);\n if (_tickCache.period != 0) {\n int56 _tickDifference = _isKP3RToken0[_liquidity] ? _tickCache.difference : -_tickCache.difference;\n return _getReward(IKeep3rHelper(keep3rHelper).getKP3RsAtTick(_amount, _tickDifference, rewardPeriodTime));\n }\n }\n }\n\n /// @inheritdoc IKeep3rJobFundableLiquidity\n function observeLiquidity(address _liquidity) public view virtual override returns (TickCache memory _tickCache) {\n if (_tick[_liquidity].period == _period(block.timestamp)) {\n // Will return cached twaps if liquidity is updated\n _tickCache = _tick[_liquidity];\n } else {\n bool success;\n uint256 lastPeriod = _period(block.timestamp - rewardPeriodTime);\n\n if (_tick[_liquidity].period == lastPeriod) {\n // Will only ask for current period accumulator if liquidity is outdated\n uint32[] memory _secondsAgo = new uint32[](1);\n int56 previousTick = _tick[_liquidity].current;\n\n _secondsAgo[0] = uint32(block.timestamp - _period(block.timestamp));\n\n (_tickCache.current, , success) = IKeep3rHelper(keep3rHelper).observe(_liquidityPool[_liquidity], _secondsAgo);\n\n _tickCache.difference = _tickCache.current - previousTick;\n } else if (_tick[_liquidity].period < lastPeriod) {\n // Will ask for 2 accumulators if liquidity is expired\n uint32[] memory _secondsAgo = new uint32[](2);\n\n _secondsAgo[0] = uint32(block.timestamp - _period(block.timestamp));\n _secondsAgo[1] = uint32(block.timestamp - _period(block.timestamp) + rewardPeriodTime);\n\n int56 _tickCumulative2;\n (_tickCache.current, _tickCumulative2, success) = IKeep3rHelper(keep3rHelper).observe(_liquidityPool[_liquidity], _secondsAgo);\n\n _tickCache.difference = _tickCache.current - _tickCumulative2;\n }\n if (success) {\n _tickCache.period = _period(block.timestamp);\n } else {\n delete _tickCache.period;\n }\n }\n }\n\n // Methods\n\n /// @inheritdoc IKeep3rJobFundableLiquidity\n function forceLiquidityCreditsToJob(address _job, uint256 _amount) external override onlyGovernance {\n if (!_jobs.contains(_job)) revert JobUnavailable();\n _settleJobAccountance(_job);\n _jobLiquidityCredits[_job] += _amount;\n emit LiquidityCreditsForced(_job, rewardedAt[_job], _jobLiquidityCredits[_job]);\n }\n\n /// @inheritdoc IKeep3rJobFundableLiquidity\n function approveLiquidity(address _liquidity) external virtual override onlyGovernance {\n if (!_approvedLiquidities.add(_liquidity)) revert LiquidityPairApproved();\n _liquidityPool[_liquidity] = IPairManager(_liquidity).pool();\n _isKP3RToken0[_liquidity] = IKeep3rHelper(keep3rHelper).isKP3RToken0(_liquidityPool[_liquidity]);\n _tick[_liquidity] = observeLiquidity(_liquidity);\n emit LiquidityApproval(_liquidity);\n }\n\n /// @inheritdoc IKeep3rJobFundableLiquidity\n function revokeLiquidity(address _liquidity) external override onlyGovernance {\n if (!_approvedLiquidities.remove(_liquidity)) revert LiquidityPairUnexistent();\n delete _liquidityPool[_liquidity];\n delete _isKP3RToken0[_liquidity];\n delete _tick[_liquidity];\n\n emit LiquidityRevocation(_liquidity);\n }\n\n /// @inheritdoc IKeep3rJobFundableLiquidity\n function addLiquidityToJob(\n address _job,\n address _liquidity,\n uint256 _amount\n ) external override nonReentrant {\n if (!_approvedLiquidities.contains(_liquidity)) revert LiquidityPairUnapproved();\n if (!_jobs.contains(_job)) revert JobUnavailable();\n\n _jobLiquidities[_job].add(_liquidity);\n\n _settleJobAccountance(_job);\n\n if (_quoteLiquidity(liquidityAmount[_job][_liquidity] + _amount, _liquidity) < liquidityMinimum) revert JobLiquidityLessThanMin();\n\n emit LiquidityCreditsReward(_job, rewardedAt[_job], _jobLiquidityCredits[_job], _jobPeriodCredits[_job]);\n\n IERC20(_liquidity).safeTransferFrom(msg.sender, address(this), _amount);\n liquidityAmount[_job][_liquidity] += _amount;\n _jobPeriodCredits[_job] += _getReward(_quoteLiquidity(_amount, _liquidity));\n emit LiquidityAddition(_job, _liquidity, msg.sender, _amount);\n }\n\n /// @inheritdoc IKeep3rJobFundableLiquidity\n function unbondLiquidityFromJob(\n address _job,\n address _liquidity,\n uint256 _amount\n ) external override onlyJobOwner(_job) {\n canWithdrawAfter[_job][_liquidity] = block.timestamp + unbondTime;\n pendingUnbonds[_job][_liquidity] += _amount;\n _unbondLiquidityFromJob(_job, _liquidity, _amount);\n\n uint256 _remainingLiquidity = liquidityAmount[_job][_liquidity];\n if (_remainingLiquidity > 0 && _quoteLiquidity(_remainingLiquidity, _liquidity) < liquidityMinimum) revert JobLiquidityLessThanMin();\n\n emit Unbonding(_job, _liquidity, _amount);\n }\n\n /// @inheritdoc IKeep3rJobFundableLiquidity\n function withdrawLiquidityFromJob(\n address _job,\n address _liquidity,\n address _receiver\n ) external override onlyJobOwner(_job) {\n if (_receiver == address(0)) revert ZeroAddress();\n if (pendingUnbonds[_job][_liquidity] == 0) revert UnbondsUnexistent();\n if (canWithdrawAfter[_job][_liquidity] >= block.timestamp) revert UnbondsLocked();\n if (disputes[_job]) revert Disputed();\n\n uint256 _amount = pendingUnbonds[_job][_liquidity];\n\n delete pendingUnbonds[_job][_liquidity];\n delete canWithdrawAfter[_job][_liquidity];\n\n IERC20(_liquidity).safeTransfer(_receiver, _amount);\n emit LiquidityWithdrawal(_job, _liquidity, _receiver, _amount);\n }\n\n // Internal functions\n\n /// @notice Updates or rewards job liquidity credits depending on time since last job reward\n function _updateJobCreditsIfNeeded(address _job) internal returns (bool _rewarded) {\n if (rewardedAt[_job] < _period(block.timestamp)) {\n // Will exit function if job has been rewarded in current period\n if (rewardedAt[_job] <= _period(block.timestamp - rewardPeriodTime)) {\n // Will reset job to period syncronicity if a full period passed without rewards\n _updateJobPeriod(_job);\n _jobLiquidityCredits[_job] = _jobPeriodCredits[_job];\n rewardedAt[_job] = _period(block.timestamp);\n _rewarded = true;\n } else if ((block.timestamp - rewardedAt[_job]) >= rewardPeriodTime) {\n // Will reset job's syncronicity if last reward was more than epoch ago\n _updateJobPeriod(_job);\n _jobLiquidityCredits[_job] = _jobPeriodCredits[_job];\n rewardedAt[_job] += rewardPeriodTime;\n _rewarded = true;\n } else if (workedAt[_job] < _period(block.timestamp)) {\n // First keeper on period has to update job accountance to current twaps\n uint256 previousPeriodCredits = _jobPeriodCredits[_job];\n _updateJobPeriod(_job);\n _jobLiquidityCredits[_job] = (_jobLiquidityCredits[_job] * _jobPeriodCredits[_job]) / previousPeriodCredits;\n // Updating job accountance does not reward job\n }\n }\n }\n\n /// @notice Only called if _jobLiquidityCredits < payment\n function _rewardJobCredits(address _job) internal {\n /// @notice Only way to += jobLiquidityCredits is when keeper rewarding (cannot pay work)\n /* WARNING: this allows to top up _jobLiquidityCredits to a max of 1.99 but have to spend at least 1 */\n _jobLiquidityCredits[_job] += _phase(block.timestamp - rewardedAt[_job], _jobPeriodCredits[_job]);\n rewardedAt[_job] = block.timestamp;\n }\n\n /// @notice Updates accountance for _jobPeriodCredits\n function _updateJobPeriod(address _job) internal {\n _jobPeriodCredits[_job] = _calculateJobPeriodCredits(_job);\n }\n\n /// @notice Quotes the outdated job liquidities and calculates _periodCredits\n /// @dev This function is also responsible for keeping the KP3R/WETH quote updated\n function _calculateJobPeriodCredits(address _job) internal returns (uint256 _periodCredits) {\n for (uint256 i; i < _jobLiquidities[_job].length(); i++) {\n address _liquidity = _jobLiquidities[_job].at(i);\n if (_approvedLiquidities.contains(_liquidity)) {\n if (_tick[_liquidity].period != _period(block.timestamp)) {\n // Updates liquidity cache only if needed\n _tick[_liquidity] = observeLiquidity(_liquidity);\n }\n _periodCredits += _getReward(_quoteLiquidity(liquidityAmount[_job][_liquidity], _liquidity));\n }\n }\n }\n\n /// @notice Updates job accountance calculating the impact of the unbonded liquidity amount\n function _unbondLiquidityFromJob(\n address _job,\n address _liquidity,\n uint256 _amount\n ) internal nonReentrant {\n if (!_jobLiquidities[_job].contains(_liquidity)) revert JobLiquidityUnexistent();\n if (liquidityAmount[_job][_liquidity] < _amount) revert JobLiquidityInsufficient();\n\n // Ensures current twaps in job liquidities\n _updateJobPeriod(_job);\n uint256 _periodCreditsToRemove = _getReward(_quoteLiquidity(_amount, _liquidity));\n\n // A liquidity can be revoked causing a job to have 0 periodCredits\n if (_jobPeriodCredits[_job] > 0) {\n // Removes a % correspondant to a full rewardPeriodTime for the liquidity withdrawn vs all of the liquidities\n _jobLiquidityCredits[_job] -= (_jobLiquidityCredits[_job] * _periodCreditsToRemove) / _jobPeriodCredits[_job];\n _jobPeriodCredits[_job] -= _periodCreditsToRemove;\n }\n\n liquidityAmount[_job][_liquidity] -= _amount;\n if (liquidityAmount[_job][_liquidity] == 0) {\n _jobLiquidities[_job].remove(_liquidity);\n }\n }\n\n /// @notice Returns a fraction of the multiplier or the whole multiplier if equal or more than a rewardPeriodTime has passed\n function _phase(uint256 _timePassed, uint256 _multiplier) internal view returns (uint256 _result) {\n if (_timePassed < rewardPeriodTime) {\n _result = (_timePassed * _multiplier) / rewardPeriodTime;\n } else _result = _multiplier;\n }\n\n /// @notice Returns the start of the period of the provided timestamp\n function _period(uint256 _timestamp) internal view returns (uint256 _periodTimestamp) {\n return _timestamp - (_timestamp % rewardPeriodTime);\n }\n\n /// @notice Calculates relation between rewardPeriod and inflationPeriod\n function _getReward(uint256 _baseAmount) internal view returns (uint256 _credits) {\n return FullMath.mulDiv(_baseAmount, rewardPeriodTime, inflationPeriod);\n }\n\n /// @notice Returns underlying KP3R amount for a given liquidity amount\n function _quoteLiquidity(uint256 _amount, address _liquidity) internal view returns (uint256 _quote) {\n if (_tick[_liquidity].period != 0) {\n int56 _tickDifference = _isKP3RToken0[_liquidity] ? _tick[_liquidity].difference : -_tick[_liquidity].difference;\n _quote = IKeep3rHelper(keep3rHelper).getKP3RsAtTick(_amount, _tickDifference, rewardPeriodTime);\n }\n }\n\n /// @notice Updates job credits to current quotes and rewards job's pending minted credits\n /// @dev Ensures a maximum of 1 period of credits\n function _settleJobAccountance(address _job) internal virtual {\n _updateJobCreditsIfNeeded(_job);\n _rewardJobCredits(_job);\n _jobLiquidityCredits[_job] = Math.min(_jobLiquidityCredits[_job], _jobPeriodCredits[_job]);\n }\n}\n" - }, - "solidity/contracts/peripherals/Keep3rParameters.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../../interfaces/IKeep3rHelper.sol';\nimport '../../interfaces/peripherals/IKeep3rParameters.sol';\nimport './Keep3rAccountance.sol';\n\nabstract contract Keep3rParameters is IKeep3rParameters, Keep3rAccountance {\n /// @inheritdoc IKeep3rParameters\n address public override keep3rV1;\n\n /// @inheritdoc IKeep3rParameters\n address public override keep3rV1Proxy;\n\n /// @inheritdoc IKeep3rParameters\n address public override keep3rHelper;\n\n /// @inheritdoc IKeep3rParameters\n uint256 public override bondTime = 3 days;\n\n /// @inheritdoc IKeep3rParameters\n uint256 public override unbondTime = 14 days;\n\n /// @inheritdoc IKeep3rParameters\n uint256 public override liquidityMinimum = 3 ether;\n\n /// @inheritdoc IKeep3rParameters\n uint256 public override rewardPeriodTime = 5 days;\n\n /// @inheritdoc IKeep3rParameters\n uint256 public override inflationPeriod = 34 days;\n\n /// @inheritdoc IKeep3rParameters\n uint256 public override fee = 30;\n\n /// @notice The base that will be used to calculate the fee\n uint256 internal constant _BASE = 10_000;\n\n /// @notice The minimum reward period\n uint256 internal constant _MIN_REWARD_PERIOD_TIME = 1 days;\n\n constructor(\n address _keep3rHelper,\n address _keep3rV1,\n address _keep3rV1Proxy\n ) {\n keep3rHelper = _keep3rHelper;\n keep3rV1 = _keep3rV1;\n keep3rV1Proxy = _keep3rV1Proxy;\n }\n\n /// @inheritdoc IKeep3rParameters\n function setKeep3rHelper(address _keep3rHelper) external override onlyGovernance {\n if (_keep3rHelper == address(0)) revert ZeroAddress();\n keep3rHelper = _keep3rHelper;\n emit Keep3rHelperChange(_keep3rHelper);\n }\n\n /// @inheritdoc IKeep3rParameters\n function setKeep3rV1(address _keep3rV1) external override onlyGovernance {\n if (_keep3rV1 == address(0)) revert ZeroAddress();\n keep3rV1 = _keep3rV1;\n emit Keep3rV1Change(_keep3rV1);\n }\n\n /// @inheritdoc IKeep3rParameters\n function setKeep3rV1Proxy(address _keep3rV1Proxy) external override onlyGovernance {\n if (_keep3rV1Proxy == address(0)) revert ZeroAddress();\n keep3rV1Proxy = _keep3rV1Proxy;\n emit Keep3rV1ProxyChange(_keep3rV1Proxy);\n }\n\n /// @inheritdoc IKeep3rParameters\n function setBondTime(uint256 _bondTime) external override onlyGovernance {\n bondTime = _bondTime;\n emit BondTimeChange(_bondTime);\n }\n\n /// @inheritdoc IKeep3rParameters\n function setUnbondTime(uint256 _unbondTime) external override onlyGovernance {\n unbondTime = _unbondTime;\n emit UnbondTimeChange(_unbondTime);\n }\n\n /// @inheritdoc IKeep3rParameters\n function setLiquidityMinimum(uint256 _liquidityMinimum) external override onlyGovernance {\n liquidityMinimum = _liquidityMinimum;\n emit LiquidityMinimumChange(_liquidityMinimum);\n }\n\n /// @inheritdoc IKeep3rParameters\n // TODO: check what happens to credit minting when changing this. Shouldn't we update the cached ticks?\n function setRewardPeriodTime(uint256 _rewardPeriodTime) external override onlyGovernance {\n if (_rewardPeriodTime < _MIN_REWARD_PERIOD_TIME) revert MinRewardPeriod();\n rewardPeriodTime = _rewardPeriodTime;\n emit RewardPeriodTimeChange(_rewardPeriodTime);\n }\n\n /// @inheritdoc IKeep3rParameters\n function setInflationPeriod(uint256 _inflationPeriod) external override onlyGovernance {\n inflationPeriod = _inflationPeriod;\n emit InflationPeriodChange(_inflationPeriod);\n }\n\n /// @inheritdoc IKeep3rParameters\n function setFee(uint256 _fee) external override onlyGovernance {\n fee = _fee;\n emit FeeChange(_fee);\n }\n}\n" - }, - "@openzeppelin/contracts/security/ReentrancyGuard.sol": { - "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Contract module that helps prevent reentrant calls to a function.\n *\n * Inheriting from `ReentrancyGuard` will make the {nonReentrant} modifier\n * available, which can be applied to functions to make sure there are no nested\n * (reentrant) calls to them.\n *\n * Note that because there is a single `nonReentrant` guard, functions marked as\n * `nonReentrant` may not call one another. This can be worked around by making\n * those functions `private`, and then adding `external` `nonReentrant` entry\n * points to them.\n *\n * TIP: If you would like to learn more about reentrancy and alternative ways\n * to protect against it, check out our blog post\n * https://blog.openzeppelin.com/reentrancy-after-istanbul/[Reentrancy After Istanbul].\n */\nabstract contract ReentrancyGuard {\n // Booleans are more expensive than uint256 or any type that takes up a full\n // word because each write operation emits an extra SLOAD to first read the\n // slot's contents, replace the bits taken up by the boolean, and then write\n // back. This is the compiler's defense against contract upgrades and\n // pointer aliasing, and it cannot be disabled.\n\n // The values being non-zero value makes deployment a bit more expensive,\n // but in exchange the refund on every call to nonReentrant will be lower in\n // amount. Since refunds are capped to a percentage of the total\n // transaction's gas, it is best to keep them low in cases like this one, to\n // increase the likelihood of the full refund coming into effect.\n uint256 private constant _NOT_ENTERED = 1;\n uint256 private constant _ENTERED = 2;\n\n uint256 private _status;\n\n constructor() {\n _status = _NOT_ENTERED;\n }\n\n /**\n * @dev Prevents a contract from calling itself, directly or indirectly.\n * Calling a `nonReentrant` function from another `nonReentrant`\n * function is not supported. It is possible to prevent this from happening\n * by making the `nonReentrant` function external, and make it call a\n * `private` function that does the actual work.\n */\n modifier nonReentrant() {\n // On the first call to nonReentrant, _notEntered will be true\n require(_status != _ENTERED, \"ReentrancyGuard: reentrant call\");\n\n // Any calls to nonReentrant after this point will fail\n _status = _ENTERED;\n\n _;\n\n // By storing the original value once again, a refund is triggered (see\n // https://eips.ethereum.org/EIPS/eip-2200)\n _status = _NOT_ENTERED;\n }\n}\n" - }, - "@openzeppelin/contracts/utils/math/Math.sol": { - "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Standard math utilities missing in the Solidity language.\n */\nlibrary Math {\n /**\n * @dev Returns the largest of two numbers.\n */\n function max(uint256 a, uint256 b) internal pure returns (uint256) {\n return a >= b ? a : b;\n }\n\n /**\n * @dev Returns the smallest of two numbers.\n */\n function min(uint256 a, uint256 b) internal pure returns (uint256) {\n return a < b ? a : b;\n }\n\n /**\n * @dev Returns the average of two numbers. The result is rounded towards\n * zero.\n */\n function average(uint256 a, uint256 b) internal pure returns (uint256) {\n // (a + b) / 2 can overflow.\n return (a & b) + (a ^ b) / 2;\n }\n\n /**\n * @dev Returns the ceiling of the division of two numbers.\n *\n * This differs from standard division with `/` in that it rounds up instead\n * of rounding down.\n */\n function ceilDiv(uint256 a, uint256 b) internal pure returns (uint256) {\n // (a + b - 1) / b can overflow on addition, so we distribute.\n return a / b + (a % b == 0 ? 0 : 1);\n }\n}\n" - }, - "solidity/interfaces/IKeep3rHelperParameters.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\n/// @title Keep3rHelperParameters contract\n/// @notice Contains all the helper functions used throughout the different files.\ninterface IKeep3rHelperParameters {\n // Structs\n\n /// @dev KP3R-WETH Pool address and isKP3RToken0\n /// @dev Created in order to save gas by avoiding calls to pool's token0 method\n struct TokenOraclePool {\n address poolAddress;\n bool isTKNToken0;\n }\n\n // Errors\n\n /// @notice Throws when pool does not have KP3R as token0 nor token1\n error InvalidOraclePool();\n\n // Events\n\n /// @notice Emitted when the kp3r weth pool is changed\n /// @param _address Address of the new kp3r weth pool\n /// @param _isKP3RToken0 True if calling the token0 method of the pool returns the KP3R token address\n event Kp3rWethPoolChange(address _address, bool _isKP3RToken0);\n\n /// @notice Emitted when the minimum boost multiplier is changed\n /// @param _minBoost The minimum boost multiplier\n event MinBoostChange(uint256 _minBoost);\n\n /// @notice Emitted when the maximum boost multiplier is changed\n /// @param _maxBoost The maximum boost multiplier\n event MaxBoostChange(uint256 _maxBoost);\n\n /// @notice Emitted when the target bond amount is changed\n /// @param _targetBond The target bond amount\n event TargetBondChange(uint256 _targetBond);\n\n /// @notice Emitted when the Keep3r V2 address is changed\n /// @param _keep3rV2 The address of Keep3r V2\n event Keep3rV2Change(address _keep3rV2);\n\n /// @notice Emitted when the work extra gas amount is changed\n /// @param _workExtraGas The work extra gas\n event WorkExtraGasChange(uint256 _workExtraGas);\n\n /// @notice Emitted when the quote twap time is changed\n /// @param _quoteTwapTime The twap time for quoting\n event QuoteTwapTimeChange(uint32 _quoteTwapTime);\n\n /// @notice Emitted when minimum rewarded gas fee is changed\n /// @param _minBaseFee The minimum rewarded gas fee\n event MinBaseFeeChange(uint256 _minBaseFee);\n\n /// @notice Emitted when minimum rewarded priority fee is changed\n /// @param _minPriorityFee The minimum expected fee that the keeper should pay\n event MinPriorityFeeChange(uint256 _minPriorityFee);\n\n // Variables\n\n /// @notice Address of KP3R token\n /// @return _kp3r Address of KP3R token\n // solhint-disable func-name-mixedcase\n function KP3R() external view returns (address _kp3r);\n\n /// @notice The boost base used to calculate the boost rewards for the keeper\n /// @return _base The boost base number\n function BOOST_BASE() external view returns (uint256 _base);\n\n /// @notice KP3R-WETH pool that is being used as oracle\n /// @return poolAddress Address of the pool\n /// @return isTKNToken0 True if calling the token0 method of the pool returns the KP3R token address\n function kp3rWethPool() external view returns (address poolAddress, bool isTKNToken0);\n\n /// @notice The minimum multiplier used to calculate the amount of gas paid to the Keeper for the gas used to perform a job\n /// For example: if the quoted gas used is 1000, then the minimum amount to be paid will be 1000 * minBoost / BOOST_BASE\n /// @return _multiplier The minimum boost multiplier\n function minBoost() external view returns (uint256 _multiplier);\n\n /// @notice The maximum multiplier used to calculate the amount of gas paid to the Keeper for the gas used to perform a job\n /// For example: if the quoted gas used is 1000, then the maximum amount to be paid will be 1000 * maxBoost / BOOST_BASE\n /// @return _multiplier The maximum boost multiplier\n function maxBoost() external view returns (uint256 _multiplier);\n\n /// @notice The targeted amount of bonded KP3Rs to max-up reward multiplier\n /// For example: if the amount of KP3R the keeper has bonded is targetBond or more, then the keeper will get\n /// the maximum boost possible in his rewards, if it's less, the reward boost will be proportional\n /// @return _target The amount of KP3R that comforms the targetBond\n function targetBond() external view returns (uint256 _target);\n\n /// @notice The amount of unaccounted gas that is going to be added to keeper payments\n /// @return _workExtraGas The work unaccounted gas amount\n function workExtraGas() external view returns (uint256 _workExtraGas);\n\n /// @notice The twap time for quoting\n /// @return _quoteTwapTime The twap time\n function quoteTwapTime() external view returns (uint32 _quoteTwapTime);\n\n /// @notice The minimum base fee that is used to calculate keeper rewards\n /// @return _minBaseFee The minimum rewarded gas fee\n function minBaseFee() external view returns (uint256 _minBaseFee);\n\n /// @notice The minimum priority fee that is also rewarded for keepers\n /// @return _minPriorityFee The minimum rewarded priority fee\n function minPriorityFee() external view returns (uint256 _minPriorityFee);\n\n /// @notice Address of Keep3r V2\n /// @return _keep3rV2 Address of Keep3r V2\n function keep3rV2() external view returns (address _keep3rV2);\n\n // Methods\n\n /// @notice Sets KP3R-WETH pool\n /// @param _poolAddress The address of the KP3R-WETH pool\n function setKp3rWethPool(address _poolAddress) external;\n\n /// @notice Sets the minimum boost multiplier\n /// @param _minBoost The minimum boost multiplier\n function setMinBoost(uint256 _minBoost) external;\n\n /// @notice Sets the maximum boost multiplier\n /// @param _maxBoost The maximum boost multiplier\n function setMaxBoost(uint256 _maxBoost) external;\n\n /// @notice Sets the target bond amount\n /// @param _targetBond The target bond amount\n function setTargetBond(uint256 _targetBond) external;\n\n /// @notice Sets the Keep3r V2 address\n /// @param _keep3rV2 The address of Keep3r V2\n function setKeep3rV2(address _keep3rV2) external;\n\n /// @notice Sets the work extra gas amount\n /// @param _workExtraGas The work extra gas\n function setWorkExtraGas(uint256 _workExtraGas) external;\n\n /// @notice Sets the quote twap time\n /// @param _quoteTwapTime The twap time for quoting\n function setQuoteTwapTime(uint32 _quoteTwapTime) external;\n\n /// @notice Sets the minimum rewarded gas fee\n /// @param _minBaseFee The minimum rewarded gas fee\n function setMinBaseFee(uint256 _minBaseFee) external;\n\n /// @notice Sets the minimum rewarded gas priority fee\n /// @param _minPriorityFee The minimum rewarded priority fee\n function setMinPriorityFee(uint256 _minPriorityFee) external;\n}\n" - }, - "solidity/interfaces/IPairManager.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol';\n\n/// @title Pair Manager interface\n/// @notice Generic interface for Keep3r liquidity pools (kLP)\ninterface IPairManager is IERC20Metadata {\n /// @notice Address of the factory from which the pair manager was created\n /// @return _factory The address of the PairManager Factory\n function factory() external view returns (address _factory);\n\n /// @notice Address of the pool from which the Keep3r pair manager will interact with\n /// @return _pool The address of the pool\n function pool() external view returns (address _pool);\n\n /// @notice Token0 of the pool\n /// @return _token0 The address of token0\n function token0() external view returns (address _token0);\n\n /// @notice Token1 of the pool\n /// @return _token1 The address of token1\n function token1() external view returns (address _token1);\n}\n" - }, - "solidity/contracts/libraries/FullMath.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\n/// @title Contains 512-bit math functions\n/// @notice Facilitates multiplication and division that can have overflow of an intermediate value without any loss of precision\n/// @dev Handles \"phantom overflow\" i.e., allows multiplication and division where an intermediate value overflows 256 bits\nlibrary FullMath {\n /// @notice Calculates floor(a×b÷denominator) with full precision. Throws if result overflows a uint256 or denominator == 0\n /// @param a The multiplicand\n /// @param b The multiplier\n /// @param denominator The divisor\n /// @return result The 256-bit result\n /// @dev Credit to Remco Bloemen under MIT license https://xn--2-umb.com/21/muldiv\n function mulDiv(\n uint256 a,\n uint256 b,\n uint256 denominator\n ) internal pure returns (uint256 result) {\n unchecked {\n // 512-bit multiply [prod1 prod0] = a * b\n // Compute the product mod 2**256 and mod 2**256 - 1\n // then use the Chinese Remainder Theorem to reconstruct\n // the 512 bit result. The result is stored in two 256\n // variables such that product = prod1 * 2**256 + prod0\n uint256 prod0; // Least significant 256 bits of the product\n uint256 prod1; // Most significant 256 bits of the product\n assembly {\n let mm := mulmod(a, b, not(0))\n prod0 := mul(a, b)\n prod1 := sub(sub(mm, prod0), lt(mm, prod0))\n }\n\n // Handle non-overflow cases, 256 by 256 division\n if (prod1 == 0) {\n require(denominator > 0);\n assembly {\n result := div(prod0, denominator)\n }\n return result;\n }\n\n // Make sure the result is less than 2**256.\n // Also prevents denominator == 0\n require(denominator > prod1);\n\n ///////////////////////////////////////////////\n // 512 by 256 division.\n ///////////////////////////////////////////////\n\n // Make division exact by subtracting the remainder from [prod1 prod0]\n // Compute remainder using mulmod\n uint256 remainder;\n assembly {\n remainder := mulmod(a, b, denominator)\n }\n // Subtract 256 bit number from 512 bit number\n assembly {\n prod1 := sub(prod1, gt(remainder, prod0))\n prod0 := sub(prod0, remainder)\n }\n\n // Factor powers of two out of denominator\n // Compute largest power of two divisor of denominator.\n // Always >= 1.\n uint256 twos = (~denominator + 1) & denominator;\n // Divide denominator by power of two\n assembly {\n denominator := div(denominator, twos)\n }\n\n // Divide [prod1 prod0] by the factors of two\n assembly {\n prod0 := div(prod0, twos)\n }\n // Shift in bits from prod1 into prod0. For this we need\n // to flip `twos` such that it is 2**256 / twos.\n // If twos is zero, then it becomes one\n assembly {\n twos := add(div(sub(0, twos), twos), 1)\n }\n prod0 |= prod1 * twos;\n\n // Invert denominator mod 2**256\n // Now that denominator is an odd number, it has an inverse\n // modulo 2**256 such that denominator * inv = 1 mod 2**256.\n // Compute the inverse by starting with a seed that is correct\n // correct for four bits. That is, denominator * inv = 1 mod 2**4\n uint256 inv = (3 * denominator) ^ 2;\n // Now use Newton-Raphson iteration to improve the precision.\n // Thanks to Hensel's lifting lemma, this also works in modular\n // arithmetic, doubling the correct bits in each step.\n inv *= 2 - denominator * inv; // inverse mod 2**8\n inv *= 2 - denominator * inv; // inverse mod 2**16\n inv *= 2 - denominator * inv; // inverse mod 2**32\n inv *= 2 - denominator * inv; // inverse mod 2**64\n inv *= 2 - denominator * inv; // inverse mod 2**128\n inv *= 2 - denominator * inv; // inverse mod 2**256\n\n // Because the division is now exact we can divide by multiplying\n // with the modular inverse of denominator. This will give us the\n // correct result modulo 2**256. Since the precoditions guarantee\n // that the outcome is less than 2**256, this is the final result.\n // We don't need to compute the high bits of the result and prod1\n // is no longer required.\n result = prod0 * inv;\n return result;\n }\n }\n\n /// @notice Calculates ceil(a×b÷denominator) with full precision. Throws if result overflows a uint256 or denominator == 0\n /// @param a The multiplicand\n /// @param b The multiplier\n /// @param denominator The divisor\n /// @return result The 256-bit result\n function mulDivRoundingUp(\n uint256 a,\n uint256 b,\n uint256 denominator\n ) internal pure returns (uint256 result) {\n unchecked {\n result = mulDiv(a, b, denominator);\n if (mulmod(a, b, denominator) > 0) {\n require(result < type(uint256).max);\n result++;\n }\n }\n }\n}\n" - }, - "@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol": { - "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\nimport \"../IERC20.sol\";\n\n/**\n * @dev Interface for the optional metadata functions from the ERC20 standard.\n *\n * _Available since v4.1._\n */\ninterface IERC20Metadata is IERC20 {\n /**\n * @dev Returns the name of the token.\n */\n function name() external view returns (string memory);\n\n /**\n * @dev Returns the symbol of the token.\n */\n function symbol() external view returns (string memory);\n\n /**\n * @dev Returns the decimals places of the token.\n */\n function decimals() external view returns (uint8);\n}\n" - }, - "solidity/contracts/peripherals/Keep3rDisputable.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport './Keep3rParameters.sol';\nimport '../../interfaces/peripherals/IKeep3rDisputable.sol';\n\nabstract contract Keep3rDisputable is IKeep3rDisputable, Keep3rParameters {\n /// @inheritdoc IKeep3rDisputable\n function dispute(address _jobOrKeeper) external override onlyDisputer {\n if (disputes[_jobOrKeeper]) revert AlreadyDisputed();\n disputes[_jobOrKeeper] = true;\n emit Dispute(_jobOrKeeper, msg.sender);\n }\n\n /// @inheritdoc IKeep3rDisputable\n function resolve(address _jobOrKeeper) external override onlyDisputer {\n if (!disputes[_jobOrKeeper]) revert NotDisputed();\n disputes[_jobOrKeeper] = false;\n emit Resolve(_jobOrKeeper, msg.sender);\n }\n}\n" - }, - "solidity/contracts/peripherals/keepers/Keep3rKeeperDisputable.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport './Keep3rKeeperFundable.sol';\nimport '../Keep3rDisputable.sol';\nimport '../../../interfaces/external/IKeep3rV1.sol';\nimport '../../../interfaces/peripherals/IKeep3rKeepers.sol';\n\nabstract contract Keep3rKeeperDisputable is IKeep3rKeeperDisputable, Keep3rDisputable, Keep3rKeeperFundable {\n using EnumerableSet for EnumerableSet.AddressSet;\n using SafeERC20 for IERC20;\n\n /// @inheritdoc IKeep3rKeeperDisputable\n function slash(\n address _keeper,\n address _bonded,\n uint256 _bondAmount,\n uint256 _unbondAmount\n ) external override onlySlasher {\n if (!disputes[_keeper]) revert NotDisputed();\n _slash(_keeper, _bonded, _bondAmount, _unbondAmount);\n emit KeeperSlash(_keeper, msg.sender, _bondAmount + _unbondAmount);\n }\n\n /// @inheritdoc IKeep3rKeeperDisputable\n function revoke(address _keeper) external override onlySlasher {\n if (!disputes[_keeper]) revert NotDisputed();\n _keepers.remove(_keeper);\n _slash(_keeper, keep3rV1, bonds[_keeper][keep3rV1], pendingUnbonds[_keeper][keep3rV1]);\n emit KeeperRevoke(_keeper, msg.sender);\n }\n\n function _slash(\n address _keeper,\n address _bonded,\n uint256 _bondAmount,\n uint256 _unbondAmount\n ) internal {\n if (_bonded != keep3rV1) {\n try IERC20(_bonded).transfer(governance, _bondAmount + _unbondAmount) returns (bool) {} catch (bytes memory) {}\n }\n bonds[_keeper][_bonded] -= _bondAmount;\n pendingUnbonds[_keeper][_bonded] -= _unbondAmount;\n }\n}\n" - }, - "solidity/contracts/peripherals/keepers/Keep3rKeeperFundable.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../Keep3rAccountance.sol';\nimport '../Keep3rParameters.sol';\nimport '../../../interfaces/peripherals/IKeep3rKeepers.sol';\n\nimport '../../../interfaces/external/IKeep3rV1.sol';\nimport '../../../interfaces/external/IKeep3rV1Proxy.sol';\n\nimport '@openzeppelin/contracts/security/ReentrancyGuard.sol';\nimport '@openzeppelin/contracts/token/ERC20/IERC20.sol';\nimport '@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol';\n\nabstract contract Keep3rKeeperFundable is IKeep3rKeeperFundable, ReentrancyGuard, Keep3rParameters {\n using EnumerableSet for EnumerableSet.AddressSet;\n using SafeERC20 for IERC20;\n\n /// @inheritdoc IKeep3rKeeperFundable\n function bond(address _bonding, uint256 _amount) external override nonReentrant {\n if (disputes[msg.sender]) revert Disputed();\n if (_jobs.contains(msg.sender)) revert AlreadyAJob();\n canActivateAfter[msg.sender][_bonding] = block.timestamp + bondTime;\n\n uint256 _before = IERC20(_bonding).balanceOf(address(this));\n IERC20(_bonding).safeTransferFrom(msg.sender, address(this), _amount);\n _amount = IERC20(_bonding).balanceOf(address(this)) - _before;\n\n hasBonded[msg.sender] = true;\n pendingBonds[msg.sender][_bonding] += _amount;\n\n emit Bonding(msg.sender, _bonding, _amount);\n }\n\n /// @inheritdoc IKeep3rKeeperFundable\n function activate(address _bonding) external override {\n address _keeper = msg.sender;\n if (disputes[_keeper]) revert Disputed();\n uint256 _canActivateAfter = canActivateAfter[_keeper][_bonding];\n if (_canActivateAfter == 0) revert BondsUnexistent();\n if (_canActivateAfter >= block.timestamp) revert BondsLocked();\n\n if (firstSeen[_keeper] == 0) {\n firstSeen[_keeper] = block.timestamp;\n }\n _keepers.add(_keeper);\n\n uint256 _amount = pendingBonds[_keeper][_bonding];\n delete pendingBonds[_keeper][_bonding];\n\n _activate(_keeper, _bonding, _amount);\n emit Activation(_keeper, _bonding, _amount);\n }\n\n /// @inheritdoc IKeep3rKeeperFundable\n function unbond(address _bonding, uint256 _amount) external override {\n canWithdrawAfter[msg.sender][_bonding] = block.timestamp + unbondTime;\n bonds[msg.sender][_bonding] -= _amount;\n pendingUnbonds[msg.sender][_bonding] += _amount;\n\n emit Unbonding(msg.sender, _bonding, _amount);\n }\n\n /// @inheritdoc IKeep3rKeeperFundable\n function withdraw(address _bonding) external override nonReentrant {\n if (pendingUnbonds[msg.sender][_bonding] == 0) revert UnbondsUnexistent();\n if (canWithdrawAfter[msg.sender][_bonding] >= block.timestamp) revert UnbondsLocked();\n if (disputes[msg.sender]) revert Disputed();\n\n uint256 _amount = pendingUnbonds[msg.sender][_bonding];\n\n delete pendingUnbonds[msg.sender][_bonding];\n delete canWithdrawAfter[msg.sender][_bonding];\n\n if (_bonding == keep3rV1) _mint(_amount);\n IERC20(_bonding).safeTransfer(msg.sender, _amount);\n\n emit Withdrawal(msg.sender, _bonding, _amount);\n }\n\n function _mint(uint256 _amount) internal virtual {\n IKeep3rV1Proxy(keep3rV1Proxy).mint(_amount);\n }\n\n function _activate(\n address _keeper,\n address _bonding,\n uint256 _amount\n ) internal virtual {\n // bond provided tokens\n bonds[_keeper][_bonding] += _amount;\n if (_bonding == keep3rV1) {\n IKeep3rV1(keep3rV1).burn(_amount);\n }\n }\n}\n" - }, - "solidity/interfaces/external/IKeep3rV1.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '@openzeppelin/contracts/token/ERC20/IERC20.sol';\nimport '@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol';\n\n// solhint-disable func-name-mixedcase\ninterface IKeep3rV1 is IERC20, IERC20Metadata {\n // Structs\n struct Checkpoint {\n uint32 fromBlock;\n uint256 votes;\n }\n\n // Events\n event DelegateChanged(address indexed _delegator, address indexed _fromDelegate, address indexed _toDelegate);\n event DelegateVotesChanged(address indexed _delegate, uint256 _previousBalance, uint256 _newBalance);\n event SubmitJob(address indexed _job, address indexed _liquidity, address indexed _provider, uint256 _block, uint256 _credit);\n event ApplyCredit(address indexed _job, address indexed _liquidity, address indexed _provider, uint256 _block, uint256 _credit);\n event RemoveJob(address indexed _job, address indexed _liquidity, address indexed _provider, uint256 _block, uint256 _credit);\n event UnbondJob(address indexed _job, address indexed _liquidity, address indexed _provider, uint256 _block, uint256 _credit);\n event JobAdded(address indexed _job, uint256 _block, address _governance);\n event JobRemoved(address indexed _job, uint256 _block, address _governance);\n event KeeperWorked(address indexed _credit, address indexed _job, address indexed _keeper, uint256 _block, uint256 _amount);\n event KeeperBonding(address indexed _keeper, uint256 _block, uint256 _active, uint256 _bond);\n event KeeperBonded(address indexed _keeper, uint256 _block, uint256 _activated, uint256 _bond);\n event KeeperUnbonding(address indexed _keeper, uint256 _block, uint256 _deactive, uint256 _bond);\n event KeeperUnbound(address indexed _keeper, uint256 _block, uint256 _deactivated, uint256 _bond);\n event KeeperSlashed(address indexed _keeper, address indexed _slasher, uint256 _block, uint256 _slash);\n event KeeperDispute(address indexed _keeper, uint256 _block);\n event KeeperResolved(address indexed _keeper, uint256 _block);\n event TokenCreditAddition(address indexed _credit, address indexed _job, address indexed _creditor, uint256 _block, uint256 _amount);\n\n // Variables\n function KPRH() external returns (address);\n\n function delegates(address _delegator) external view returns (address);\n\n function checkpoints(address _account, uint32 _checkpoint) external view returns (Checkpoint memory);\n\n function numCheckpoints(address _account) external view returns (uint32);\n\n function DOMAIN_TYPEHASH() external returns (bytes32);\n\n function DOMAINSEPARATOR() external returns (bytes32);\n\n function DELEGATION_TYPEHASH() external returns (bytes32);\n\n function PERMIT_TYPEHASH() external returns (bytes32);\n\n function nonces(address _user) external view returns (uint256);\n\n function BOND() external returns (uint256);\n\n function UNBOND() external returns (uint256);\n\n function LIQUIDITYBOND() external returns (uint256);\n\n function FEE() external returns (uint256);\n\n function BASE() external returns (uint256);\n\n function ETH() external returns (address);\n\n function bondings(address _user, address _bonding) external view returns (uint256);\n\n function canWithdrawAfter(address _user, address _bonding) external view returns (uint256);\n\n function pendingUnbonds(address _keeper, address _bonding) external view returns (uint256);\n\n function pendingbonds(address _keeper, address _bonding) external view returns (uint256);\n\n function bonds(address _keeper, address _bonding) external view returns (uint256);\n\n function votes(address _delegator) external view returns (uint256);\n\n function firstSeen(address _keeper) external view returns (uint256);\n\n function disputes(address _keeper) external view returns (bool);\n\n function lastJob(address _keeper) external view returns (uint256);\n\n function workCompleted(address _keeper) external view returns (uint256);\n\n function jobs(address _job) external view returns (bool);\n\n function credits(address _job, address _credit) external view returns (uint256);\n\n function liquidityProvided(\n address _provider,\n address _liquidity,\n address _job\n ) external view returns (uint256);\n\n function liquidityUnbonding(\n address _provider,\n address _liquidity,\n address _job\n ) external view returns (uint256);\n\n function liquidityAmountsUnbonding(\n address _provider,\n address _liquidity,\n address _job\n ) external view returns (uint256);\n\n function jobProposalDelay(address _job) external view returns (uint256);\n\n function liquidityApplied(\n address _provider,\n address _liquidity,\n address _job\n ) external view returns (uint256);\n\n function liquidityAmount(\n address _provider,\n address _liquidity,\n address _job\n ) external view returns (uint256);\n\n function keepers(address _keeper) external view returns (bool);\n\n function blacklist(address _keeper) external view returns (bool);\n\n function keeperList(uint256 _index) external view returns (address);\n\n function jobList(uint256 _index) external view returns (address);\n\n function governance() external returns (address);\n\n function pendingGovernance() external returns (address);\n\n function liquidityAccepted(address _liquidity) external view returns (bool);\n\n function liquidityPairs(uint256 _index) external view returns (address);\n\n // Methods\n function getCurrentVotes(address _account) external view returns (uint256);\n\n function addCreditETH(address _job) external payable;\n\n function addCredit(\n address _credit,\n address _job,\n uint256 _amount\n ) external;\n\n function addVotes(address _voter, uint256 _amount) external;\n\n function removeVotes(address _voter, uint256 _amount) external;\n\n function addKPRCredit(address _job, uint256 _amount) external;\n\n function approveLiquidity(address _liquidity) external;\n\n function revokeLiquidity(address _liquidity) external;\n\n function pairs() external view returns (address[] memory);\n\n function addLiquidityToJob(\n address _liquidity,\n address _job,\n uint256 _amount\n ) external;\n\n function applyCreditToJob(\n address _provider,\n address _liquidity,\n address _job\n ) external;\n\n function unbondLiquidityFromJob(\n address _liquidity,\n address _job,\n uint256 _amount\n ) external;\n\n function removeLiquidityFromJob(address _liquidity, address _job) external;\n\n function mint(uint256 _amount) external;\n\n function burn(uint256 _amount) external;\n\n function worked(address _keeper) external;\n\n function receipt(\n address _credit,\n address _keeper,\n uint256 _amount\n ) external;\n\n function receiptETH(address _keeper, uint256 _amount) external;\n\n function addJob(address _job) external;\n\n function getJobs() external view returns (address[] memory);\n\n function removeJob(address _job) external;\n\n function setKeep3rHelper(address _keep3rHelper) external;\n\n function setGovernance(address _governance) external;\n\n function acceptGovernance() external;\n\n function isKeeper(address _keeper) external returns (bool);\n\n function isMinKeeper(\n address _keeper,\n uint256 _minBond,\n uint256 _earned,\n uint256 _age\n ) external returns (bool);\n\n function isBondedKeeper(\n address _keeper,\n address _bond,\n uint256 _minBond,\n uint256 _earned,\n uint256 _age\n ) external returns (bool);\n\n function bond(address _bonding, uint256 _amount) external;\n\n function getKeepers() external view returns (address[] memory);\n\n function activate(address _bonding) external;\n\n function unbond(address _bonding, uint256 _amount) external;\n\n function slash(\n address _bonded,\n address _keeper,\n uint256 _amount\n ) external;\n\n function withdraw(address _bonding) external;\n\n function dispute(address _keeper) external;\n\n function revoke(address _keeper) external;\n\n function resolve(address _keeper) external;\n\n function permit(\n address _owner,\n address _spender,\n uint256 _amount,\n uint256 _deadline,\n uint8 _v,\n bytes32 _r,\n bytes32 _s\n ) external;\n}\n" - }, - "solidity/interfaces/external/IKeep3rV1Proxy.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../peripherals/IGovernable.sol';\n\ninterface IKeep3rV1Proxy is IGovernable {\n // Structs\n struct Recipient {\n address recipient;\n uint256 caps;\n }\n\n // Variables\n function keep3rV1() external view returns (address);\n\n function minter() external view returns (address);\n\n function next(address) external view returns (uint256);\n\n function caps(address) external view returns (uint256);\n\n function recipients() external view returns (address[] memory);\n\n function recipientsCaps() external view returns (Recipient[] memory);\n\n // Errors\n error Cooldown();\n error NoDrawableAmount();\n error ZeroAddress();\n error OnlyMinter();\n\n // Methods\n function addRecipient(address recipient, uint256 amount) external;\n\n function removeRecipient(address recipient) external;\n\n function draw() external returns (uint256 _amount);\n\n function setKeep3rV1(address _keep3rV1) external;\n\n function setMinter(address _minter) external;\n\n function mint(uint256 _amount) external;\n\n function mint(address _account, uint256 _amount) external;\n\n function setKeep3rV1Governance(address _governance) external;\n\n function acceptKeep3rV1Governance() external;\n\n function dispute(address _keeper) external;\n\n function slash(\n address _bonded,\n address _keeper,\n uint256 _amount\n ) external;\n\n function revoke(address _keeper) external;\n\n function resolve(address _keeper) external;\n\n function addJob(address _job) external;\n\n function removeJob(address _job) external;\n\n function addKPRCredit(address _job, uint256 _amount) external;\n\n function approveLiquidity(address _liquidity) external;\n\n function revokeLiquidity(address _liquidity) external;\n\n function setKeep3rHelper(address _keep3rHelper) external;\n\n function addVotes(address _voter, uint256 _amount) external;\n\n function removeVotes(address _voter, uint256 _amount) external;\n}\n" - }, - "solidity/for-test/testnet/Keep3rForTestnet.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../../contracts/Keep3r.sol';\n\ncontract Keep3rForTestnet is Keep3r {\n constructor(\n address _governance,\n address _keep3rHelper,\n address _keep3rV1,\n address _keep3rV1Proxy\n ) Keep3r(_governance, _keep3rHelper, _keep3rV1, _keep3rV1Proxy) {\n bondTime = 0; // allows keepers to instantly register\n unbondTime = 0; // allows keepers & jobOwners to instantly withdraw funds\n liquidityMinimum = 1; // allows job providers to add low liquidity\n rewardPeriodTime = 1 days; // reduces twap calculation period\n inflationPeriod = 5 days; // increases credit mintint\n }\n}\n" - }, - "solidity/for-test/Keep3rForTest.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../contracts/Keep3r.sol';\n\ncontract Keep3rForTest is Keep3r {\n constructor(\n address _governance,\n address _keep3rHelper,\n address _keep3rV1,\n address _keep3rV1Proxy\n ) Keep3r(_governance, _keep3rHelper, _keep3rV1, _keep3rV1Proxy) {}\n}\n" - }, - "solidity/contracts/sidechain/Keep3rSidechain.sol": { - "content": "// SPDX-License-Identifier: MIT\n\n/*\n\nCoded for The Keep3r Network with ♥ by\n\n██████╗░███████╗███████╗██╗  ░██╗░░░░░░░██╗░█████╗░███╗░░██╗██████╗░███████╗██████╗░██╗░░░░░░█████╗░███╗░░██╗██████╗░\n██╔══██╗██╔════╝██╔════╝██║  ░██║░░██╗░░██║██╔══██╗████╗░██║██╔══██╗██╔════╝██╔══██╗██║░░░░░██╔══██╗████╗░██║██╔══██╗\n██║░░██║█████╗░░█████╗░░██║  ░╚██╗████╗██╔╝██║░░██║██╔██╗██║██║░░██║█████╗░░██████╔╝██║░░░░░███████║██╔██╗██║██║░░██║\n██║░░██║██╔══╝░░██╔══╝░░██║  ░░████╔═████║░██║░░██║██║╚████║██║░░██║██╔══╝░░██╔══██╗██║░░░░░██╔══██║██║╚████║██║░░██║\n██████╔╝███████╗██║░░░░░██║  ░░╚██╔╝░╚██╔╝░╚█████╔╝██║░╚███║██████╔╝███████╗██║░░██║███████╗██║░░██║██║░╚███║██████╔╝\n╚═════╝░╚══════╝╚═╝░░░░░╚═╝  ░░░╚═╝░░░╚═╝░░░╚════╝░╚═╝░░╚══╝╚═════╝░╚══════╝╚═╝░░╚═╝╚══════╝╚═╝░░╚═╝╚═╝░░╚══╝╚═════╝░\n\nhttps://defi.sucks\n\n*/\n\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../Keep3r.sol';\nimport '../../interfaces/sidechain/IKeep3rEscrow.sol';\nimport '../../interfaces/sidechain/IKeep3rHelperSidechain.sol';\nimport '../../interfaces/sidechain/IKeep3rJobWorkableRated.sol';\nimport '../../interfaces/sidechain/IKeep3rSidechainAccountance.sol';\n\ncontract Keep3rSidechain is Keep3r, IKeep3rJobWorkableRated, IKeep3rSidechainAccountance {\n using EnumerableSet for EnumerableSet.AddressSet;\n\n /// @param _governance Address of governance\n /// @param _keep3rHelperSidechain Address of sidechain Keep3rHelper\n /// @param _wrappedKP3R Address of wrapped KP3R implementation\n /// @param _keep3rEscrow Address of sidechain Keep3rEscrow\n constructor(\n address _governance, // governance\n address _keep3rHelperSidechain, // helper\n address _wrappedKP3R, // keep3rV1\n address _keep3rEscrow // keep3rV1Proxy\n ) Keep3r(_governance, _keep3rHelperSidechain, _wrappedKP3R, _keep3rEscrow) {}\n\n // Keep3rSidechainAccountance\n\n /// @inheritdoc IKeep3rSidechainAccountance\n uint256 public override totalBonds;\n\n /// @inheritdoc IKeep3rSidechainAccountance\n function virtualReserves() external view override returns (uint256 _virtualReserves) {\n // Queries wKP3R balanceOf escrow contract minus the totalBonds\n return IERC20(keep3rV1).balanceOf(keep3rV1Proxy) - totalBonds;\n }\n\n // Keep3rJobFundableLiquidity\n\n /// @notice Sidechain implementation asks the Helper for an oracle, instead of reading it from the ERC-20\n /// @dev Function should be called after setting an oracle in Keep3rHelperSidechain\n /// @param _liquidity Address of the liquidity token being approved\n function approveLiquidity(address _liquidity) external virtual override onlyGovernance {\n if (!_approvedLiquidities.add(_liquidity)) revert LiquidityPairApproved();\n _liquidityPool[_liquidity] = IKeep3rHelperSidechain(keep3rHelper).oracle(_liquidity);\n if (_liquidityPool[_liquidity] == address(0)) revert ZeroAddress();\n _isKP3RToken0[_liquidity] = IKeep3rHelper(keep3rHelper).isKP3RToken0(_liquidityPool[_liquidity]);\n _tick[_liquidity] = observeLiquidity(_liquidity);\n emit LiquidityApproval(_liquidity);\n }\n\n /// @notice Sidechain implementation will always ask for 2 tickCumulatives instead of cacheing\n /// @param _liquidity Address of the liquidity token being observed\n function observeLiquidity(address _liquidity) public view virtual override returns (TickCache memory _tickCache) {\n if (_tick[_liquidity].period == _period(block.timestamp)) {\n // Will return cached twaps if liquidity is updated\n _tickCache = _tick[_liquidity];\n } else {\n bool success;\n\n // Will always ask for 2 accumulators in sidechain\n uint32[] memory _secondsAgo = new uint32[](2);\n\n _secondsAgo[0] = uint32(block.timestamp - _period(block.timestamp));\n _secondsAgo[1] = uint32(block.timestamp - _period(block.timestamp) + rewardPeriodTime);\n\n int56 _tickCumulative2;\n (_tickCache.current, _tickCumulative2, success) = IKeep3rHelper(keep3rHelper).observe(_liquidityPool[_liquidity], _secondsAgo);\n\n _tickCache.difference = _tickCache.current - _tickCumulative2;\n\n if (success) {\n _tickCache.period = _period(block.timestamp);\n } else {\n delete _tickCache.period;\n }\n }\n }\n\n // Keep3rJobsWorkable\n\n /// @dev Sidechain implementation deprecates worked(address) as it should come with a usdPerGasUnit parameter\n function worked(address) external pure override {\n revert Deprecated();\n }\n\n /// @notice Implemented by jobs to show that a keeper performed work\n /// @dev Uses a USD per gas unit payment mechanism\n /// @param _keeper Address of the keeper that performed the work\n /// @param _usdPerGasUnit Units of USD (in wei) per gas unit that should be rewarded to the keeper\n function worked(address _keeper, uint256 _usdPerGasUnit) external override {\n if (_initialGas == 0) revert GasNotInitialized();\n // Gas used for quote calculations & payment is not rewarded\n uint256 _gasRecord = _getGasLeft();\n\n address _job = msg.sender;\n if (disputes[_job]) revert JobDisputed();\n if (!_jobs.contains(_job)) revert JobUnapproved();\n\n if (_updateJobCreditsIfNeeded(_job)) {\n emit LiquidityCreditsReward(_job, rewardedAt[_job], _jobLiquidityCredits[_job], _jobPeriodCredits[_job]);\n }\n\n uint256 _boost = IKeep3rHelper(keep3rHelper).getRewardBoostFor(bonds[_keeper][keep3rV1]);\n uint256 _ratedPayment = (_usdPerGasUnit * (_initialGas - _gasRecord) * _boost) / _BASE;\n\n uint256 _ethPayment = IKeep3rHelperSidechain(keep3rHelper).quoteUsdToEth(_ratedPayment);\n uint256 _kp3rPayment = IKeep3rHelper(keep3rHelper).quote(_ethPayment);\n\n if (_kp3rPayment > _jobLiquidityCredits[_job]) {\n _rewardJobCredits(_job);\n emit LiquidityCreditsReward(_job, rewardedAt[_job], _jobLiquidityCredits[_job], _jobPeriodCredits[_job]);\n }\n\n totalBonds += _kp3rPayment;\n _bondedPayment(_job, _keeper, _kp3rPayment);\n delete _initialGas;\n\n emit KeeperWork(keep3rV1, _job, _keeper, _kp3rPayment, _gasRecord);\n }\n\n // Keep3rKeeperFundable\n\n /// @dev Sidechain implementation doesn't burn tokens, but deposit them in Keep3rEscrow\n function _activate(\n address _keeper,\n address _bonding,\n uint256 _amount\n ) internal virtual override {\n // bond provided tokens\n bonds[_keeper][_bonding] += _amount;\n if (_bonding == keep3rV1) {\n totalBonds += _amount;\n IKeep3rV1(keep3rV1).approve(keep3rV1Proxy, _amount);\n IKeep3rEscrow(keep3rV1Proxy).deposit(_amount);\n }\n }\n\n function _mint(uint256 _amount) internal virtual override {\n totalBonds -= _amount;\n super._mint(_amount);\n }\n}\n" - }, - "solidity/interfaces/sidechain/IKeep3rEscrow.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\n// solhint-disable-next-line no-empty-blocks\n\nimport '../peripherals/IMintable.sol';\n\n/// @title Keep3rEscrow contract\n/// @notice This contract acts as an escrow contract for wKP3R tokens on sidechains and L2s\n/// @dev Can be used as a replacement for keep3rV1Proxy in keep3r sidechain implementations\ninterface IKeep3rEscrow is IMintable {\n /// @notice Emitted when Keep3rEscrow#deposit function is called\n /// @param _wKP3R The addess of the wrapped KP3R token\n /// @param _sender The address that called the function\n /// @param _amount The amount of wKP3R the user deposited\n event wKP3RDeposited(address _wKP3R, address _sender, uint256 _amount);\n\n /// @notice Emitted when Keep3rEscrow#mint function is called\n /// @param _wKP3R The addess of the wrapped KP3R token\n /// @param _recipient The address that will received the newly minted wKP3R\n /// @param _amount The amount of wKP3R minted to the recipient\n event wKP3RMinted(address _wKP3R, address _recipient, uint256 _amount);\n\n /// @notice Emitted when Keep3rEscrow#setWKP3R function is called\n /// @param _newWKP3R The address of the wKP3R contract\n event wKP3RSet(address _newWKP3R);\n\n /// @notice Throws when minter attempts to withdraw more wKP3R than the escrow has in its balance\n error InsufficientBalance();\n\n /// @notice Lists the address of the wKP3R contract\n /// @return _wKP3RAddress The address of wKP3R\n function wKP3R() external view returns (address _wKP3RAddress);\n\n /// @notice Deposits wKP3R into the contract\n /// @param _amount The amount of wKP3R to deposit\n function deposit(uint256 _amount) external;\n\n /// @notice mints wKP3R to the recipient\n /// @param _amount The amount of wKP3R to mint\n function mint(uint256 _amount) external;\n\n /// @notice sets the wKP3R address\n /// @param _wKP3R the wKP3R address\n function setWKP3R(address _wKP3R) external;\n}\n" - }, - "solidity/interfaces/sidechain/IKeep3rHelperSidechain.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../IKeep3rHelper.sol';\n\n/// @title Keep3rHelperSidechain contract\n/// @notice Contains all the helper functions for sidechain keep3r implementations\ninterface IKeep3rHelperSidechain is IKeep3rHelper {\n // Events\n\n /// @notice The oracle for a liquidity has been saved\n /// @param _liquidity The address of the given liquidity\n /// @param _oraclePool The address of the oracle pool\n event OracleSet(address _liquidity, address _oraclePool);\n\n /// @notice Emitted when the WETH USD pool is changed\n /// @param _address Address of the new WETH USD pool\n /// @param _isWETHToken0 True if calling the token0 method of the pool returns the WETH token address\n event WethUSDPoolChange(address _address, bool _isWETHToken0);\n\n /// Variables\n\n /// @notice Ethereum mainnet WETH address used for quoting references\n /// @return _weth Address of WETH token\n // solhint-disable func-name-mixedcase\n function WETH() external view returns (address _weth);\n\n /// @return _oracle The address of the observable pool for given liquidity\n function oracle(address _liquidity) external view returns (address _oracle);\n\n /// @notice WETH-USD pool that is being used as oracle\n /// @return poolAddress Address of the pool\n /// @return isTKNToken0 True if calling the token0 method of the pool returns the WETH token address\n function wethUSDPool() external view returns (address poolAddress, bool isTKNToken0);\n\n /// @notice Quotes USD to ETH\n /// @dev Used to know how much ETH should be paid to keepers before converting it from ETH to KP3R\n /// @param _usd The amount of USD to quote to ETH\n /// @return _eth The resulting amount of ETH after quoting the USD\n function quoteUsdToEth(uint256 _usd) external returns (uint256 _eth);\n\n /// Methods\n\n /// @notice Sets an oracle for a given liquidity\n /// @param _liquidity The address of the liquidity\n /// @param _oracle The address of the pool used to quote the liquidity from\n /// @dev The oracle must contain KP3R as either token0 or token1\n function setOracle(address _liquidity, address _oracle) external;\n\n /// @notice Sets an oracle for querying WETH/USD quote\n /// @param _poolAddress The address of the pool used as oracle\n /// @dev The oracle must contain WETH as either token0 or token1\n function setWethUsdPool(address _poolAddress) external;\n}\n" - }, - "solidity/interfaces/sidechain/IKeep3rJobWorkableRated.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../peripherals/IKeep3rJobs.sol';\n\n/// @title Keep3rJobWorkableRated contract\n/// @notice Implements a quoting in USD per gas unit for Keep3r jobs\ninterface IKeep3rJobWorkableRated is IKeep3rJobs {\n /// @notice Throws when job contract calls deprecated worked(address) function\n error Deprecated();\n\n /// @notice Implemented by jobs to show that a keeper performed work and reward in stable USD quote\n /// @dev Automatically calculates the payment for the keeper and pays the keeper with bonded KP3R\n /// @param _keeper Address of the keeper that performed the work\n /// @param _usdPerGasUnit Amount of USD in wei rewarded for gas unit worked by the keeper\n function worked(address _keeper, uint256 _usdPerGasUnit) external;\n}\n" - }, - "solidity/interfaces/sidechain/IKeep3rSidechainAccountance.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\n/// @title IKeep3rSidechainAccountance interface\n/// @notice Implements a view to get the amount of credits that can be withdrawn\ninterface IKeep3rSidechainAccountance {\n /// @return _totalBonds The total amount of bonded wKP3Rs in the contract\n function totalBonds() external view returns (uint256 _totalBonds);\n\n /// @return _virtualReserves The surplus amount of wKP3Rs in escrow contract\n function virtualReserves() external view returns (uint256 _virtualReserves);\n}\n" - }, - "solidity/interfaces/peripherals/IMintable.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport './IGovernable.sol';\nimport './IBaseErrors.sol';\n\n/// @title Mintable contract\n/// @notice Manages the minter role\ninterface IMintable is IBaseErrors, IGovernable {\n // Events\n\n /// @notice Emitted when governance sets a new minter\n /// @param _minter Address of the new minter\n event MinterSet(address _minter);\n\n // Errors\n\n /// @notice Throws if the caller of the function is not the minter\n error OnlyMinter();\n\n // Variables\n\n /// @notice Stores the minter address\n /// @return _minter The minter addresss\n function minter() external view returns (address _minter);\n\n // Methods\n\n /// @notice Sets a new address to be the minter\n /// @param _minter The address set as the minter\n function setMinter(address _minter) external;\n}\n" - }, - "solidity/for-test/testnet/Keep3rSidechainForTestnet.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../../contracts/sidechain/Keep3rSidechain.sol';\n\ncontract Keep3rSidechainForTestnet is Keep3rSidechain {\n constructor(\n address _governance,\n address _keep3rHelper,\n address _keep3rV1,\n address _keep3rV1Proxy\n ) Keep3rSidechain(_governance, _keep3rHelper, _keep3rV1, _keep3rV1Proxy) {\n bondTime = 0; // allows keepers to instantly register\n unbondTime = 0; // allows keepers & jobOwners to instantly withdraw funds\n liquidityMinimum = 1; // allows job providers to add low liquidity\n rewardPeriodTime = 1 days; // reduces twap calculation period\n inflationPeriod = 5 days; // increases credit mintint\n }\n}\n" - }, - "solidity/for-test/Keep3rSidechainForTest.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../contracts/sidechain/Keep3rSidechain.sol';\n\ncontract Keep3rSidechainForTest is Keep3rSidechain {\n using EnumerableSet for EnumerableSet.AddressSet;\n\n constructor(\n address _governance,\n address _keep3rHelper,\n address _wrappedKP3R,\n address _keep3rEscrow\n ) Keep3rSidechain(_governance, _keep3rHelper, _wrappedKP3R, _keep3rEscrow) {}\n\n function setJobLiquidity(address _job, address _liquidity) external {\n _jobLiquidities[_job].add(_liquidity);\n }\n}\n" - }, - "solidity/for-test/JobRatedForTest.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../interfaces/IKeep3r.sol';\nimport '../interfaces/sidechain/IKeep3rJobWorkableRated.sol';\n\ncontract JobRatedForTest {\n error InvalidKeeper();\n address public keep3r;\n uint256 public nonce;\n uint256 public usdPerGasUnit = 1_000e9;\n\n constructor(address _keep3r) {\n keep3r = _keep3r;\n }\n\n function work() external {\n if (!IKeep3r(keep3r).isKeeper(msg.sender)) revert InvalidKeeper();\n\n for (uint256 i = 0; i < 1000; i++) {\n nonce++;\n }\n\n IKeep3rJobWorkableRated(keep3r).worked(msg.sender, usdPerGasUnit);\n }\n\n function workHard(uint256 _factor) external {\n if (!IKeep3r(keep3r).isKeeper(msg.sender)) revert InvalidKeeper();\n\n for (uint256 i = 0; i < 1000 * _factor; i++) {\n nonce++;\n }\n\n IKeep3rJobWorkableRated(keep3r).worked(msg.sender, usdPerGasUnit);\n }\n}\n" - }, - "solidity/for-test/JobForTest.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../interfaces/IKeep3r.sol';\n\ncontract JobForTest {\n error InvalidKeeper();\n address public keep3r;\n uint256 public nonce;\n\n constructor(address _keep3r) {\n keep3r = _keep3r;\n }\n\n function work() external {\n if (!IKeep3r(keep3r).isKeeper(msg.sender)) revert InvalidKeeper();\n\n for (uint256 i; i < 1000; i++) {\n nonce++;\n }\n\n IKeep3r(keep3r).worked(msg.sender);\n }\n\n function workHard(uint256 _factor) external {\n if (!IKeep3r(keep3r).isKeeper(msg.sender)) revert InvalidKeeper();\n\n for (uint256 i; i < 1000 * _factor; i++) {\n nonce++;\n }\n\n IKeep3r(keep3r).worked(msg.sender);\n }\n}\n" - }, - "solidity/for-test/BasicJob.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../interfaces/IKeep3r.sol';\n\ncontract BasicJob {\n error KeeperNotValid();\n\n address public keep3r;\n uint256 public nonce;\n uint256[] public array;\n\n constructor(address _keep3r) {\n keep3r = _keep3r;\n }\n\n function work() external upkeep {}\n\n function workHard(uint256 _howHard) external upkeep {\n for (uint256 i = nonce; i < _howHard; i++) {\n nonce++;\n }\n }\n\n function workRefund(uint256 _howHard) external upkeep {\n for (uint256 i; i < _howHard; i++) {\n array.push(i);\n }\n\n while (array.length > 0) {\n array.pop();\n }\n }\n\n modifier upkeep() {\n if (!IKeep3r(keep3r).isKeeper(msg.sender)) revert KeeperNotValid();\n _;\n IKeep3r(keep3r).worked(msg.sender);\n }\n}\n" - }, - "solidity/contracts/Keep3rHelperParameters.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.7 <0.9.0;\n\nimport './libraries/FullMath.sol';\nimport './libraries/TickMath.sol';\nimport '../interfaces/peripherals/IBaseErrors.sol';\nimport '../interfaces/IKeep3r.sol';\nimport '../interfaces/external/IKeep3rV1.sol';\nimport '../interfaces/IKeep3rHelperParameters.sol';\nimport './peripherals/Governable.sol';\nimport './Keep3rHelperParameters.sol';\n\nimport '@openzeppelin/contracts/utils/math/Math.sol';\nimport '@uniswap/v3-core/contracts/interfaces/IUniswapV3Pool.sol';\n\ncontract Keep3rHelperParameters is IKeep3rHelperParameters, IBaseErrors, Governable {\n /// @inheritdoc IKeep3rHelperParameters\n address public immutable override KP3R;\n\n /// @inheritdoc IKeep3rHelperParameters\n uint256 public constant override BOOST_BASE = 10_000;\n\n /// @inheritdoc IKeep3rHelperParameters\n uint256 public override minBoost = 11_000;\n\n /// @inheritdoc IKeep3rHelperParameters\n uint256 public override maxBoost = 12_000;\n\n /// @inheritdoc IKeep3rHelperParameters\n uint256 public override targetBond = 200 ether;\n\n /// @inheritdoc IKeep3rHelperParameters\n uint256 public override workExtraGas = 30_000;\n\n /// @inheritdoc IKeep3rHelperParameters\n uint32 public override quoteTwapTime = 10 minutes;\n\n /// @inheritdoc IKeep3rHelperParameters\n uint256 public override minBaseFee = 15e9;\n\n /// @inheritdoc IKeep3rHelperParameters\n uint256 public override minPriorityFee = 2e9;\n\n /// @inheritdoc IKeep3rHelperParameters\n address public override keep3rV2;\n\n /// @inheritdoc IKeep3rHelperParameters\n IKeep3rHelperParameters.TokenOraclePool public override kp3rWethPool;\n\n constructor(\n address _kp3r,\n address _keep3rV2,\n address _governance,\n address _kp3rWethPool\n ) Governable(_governance) {\n KP3R = _kp3r;\n keep3rV2 = _keep3rV2;\n\n // Immutable variables [KP3R] cannot be read during contract creation time [_setKp3rWethPool]\n kp3rWethPool = _validateOraclePool(_kp3rWethPool, _kp3r);\n emit Kp3rWethPoolChange(kp3rWethPool.poolAddress, kp3rWethPool.isTKNToken0);\n }\n\n /// @inheritdoc IKeep3rHelperParameters\n function setKp3rWethPool(address _poolAddress) external override onlyGovernance {\n if (_poolAddress == address(0)) revert ZeroAddress();\n _setKp3rWethPool(_poolAddress);\n }\n\n /// @inheritdoc IKeep3rHelperParameters\n function setMinBoost(uint256 _minBoost) external override onlyGovernance {\n minBoost = _minBoost;\n emit MinBoostChange(minBoost);\n }\n\n /// @inheritdoc IKeep3rHelperParameters\n function setMaxBoost(uint256 _maxBoost) external override onlyGovernance {\n maxBoost = _maxBoost;\n emit MaxBoostChange(maxBoost);\n }\n\n /// @inheritdoc IKeep3rHelperParameters\n function setTargetBond(uint256 _targetBond) external override onlyGovernance {\n targetBond = _targetBond;\n emit TargetBondChange(targetBond);\n }\n\n /// @inheritdoc IKeep3rHelperParameters\n function setKeep3rV2(address _keep3rV2) external override onlyGovernance {\n if (_keep3rV2 == address(0)) revert ZeroAddress();\n keep3rV2 = _keep3rV2;\n emit Keep3rV2Change(keep3rV2);\n }\n\n /// @inheritdoc IKeep3rHelperParameters\n function setWorkExtraGas(uint256 _workExtraGas) external override onlyGovernance {\n workExtraGas = _workExtraGas;\n emit WorkExtraGasChange(workExtraGas);\n }\n\n /// @inheritdoc IKeep3rHelperParameters\n function setQuoteTwapTime(uint32 _quoteTwapTime) external override onlyGovernance {\n _setQuoteTwapTime(_quoteTwapTime);\n }\n\n function _setQuoteTwapTime(uint32 _quoteTwapTime) internal {\n quoteTwapTime = _quoteTwapTime;\n emit QuoteTwapTimeChange(quoteTwapTime);\n }\n\n /// @inheritdoc IKeep3rHelperParameters\n function setMinBaseFee(uint256 _minBaseFee) external override onlyGovernance {\n minBaseFee = _minBaseFee;\n emit MinBaseFeeChange(minBaseFee);\n }\n\n /// @inheritdoc IKeep3rHelperParameters\n function setMinPriorityFee(uint256 _minPriorityFee) external override onlyGovernance {\n minPriorityFee = _minPriorityFee;\n emit MinPriorityFeeChange(minPriorityFee);\n }\n\n /// @notice Sets KP3R-WETH pool\n /// @param _poolAddress The address of the KP3R-WETH pool\n function _setKp3rWethPool(address _poolAddress) internal {\n kp3rWethPool = _validateOraclePool(_poolAddress, KP3R);\n emit Kp3rWethPoolChange(kp3rWethPool.poolAddress, kp3rWethPool.isTKNToken0);\n }\n\n function _validateOraclePool(address _poolAddress, address _token) internal view virtual returns (TokenOraclePool memory _oraclePool) {\n bool _isTKNToken0 = IUniswapV3Pool(_poolAddress).token0() == _token;\n\n if (!_isTKNToken0 && IUniswapV3Pool(_poolAddress).token1() != _token) revert InvalidOraclePool();\n\n return TokenOraclePool(_poolAddress, _isTKNToken0);\n }\n}\n" - }, - "solidity/contracts/libraries/TickMath.sol": { - "content": "// SPDX-License-Identifier: GPL-2.0-or-later\npragma solidity >=0.5.0;\n\n// solhint-disable\n\n/// @title Math library for computing sqrt prices from ticks and vice versa\n/// @notice Computes sqrt price for ticks of size 1.0001, i.e. sqrt(1.0001^tick) as fixed point Q64.96 numbers. Supports\n/// prices between 2**-128 and 2**128\nlibrary TickMath {\n /// @dev The minimum tick that may be passed to #getSqrtRatioAtTick computed from log base 1.0001 of 2**-128\n int24 internal constant MIN_TICK = -887272;\n /// @dev The maximum tick that may be passed to #getSqrtRatioAtTick computed from log base 1.0001 of 2**128\n int24 internal constant MAX_TICK = -MIN_TICK;\n\n /// @dev The minimum value that can be returned from #getSqrtRatioAtTick. Equivalent to getSqrtRatioAtTick(MIN_TICK)\n uint160 internal constant MIN_SQRT_RATIO = 4295128739;\n /// @dev The maximum value that can be returned from #getSqrtRatioAtTick. Equivalent to getSqrtRatioAtTick(MAX_TICK)\n uint160 internal constant MAX_SQRT_RATIO = 1461446703485210103287273052203988822378723970342;\n\n /// @notice Calculates sqrt(1.0001^tick) * 2^96\n /// @dev Throws if |tick| > max tick\n /// @param tick The input tick for the above formula\n /// @return sqrtPriceX96 A Fixed point Q64.96 number representing the sqrt of the ratio of the two assets (token1/token0)\n /// at the given tick\n function getSqrtRatioAtTick(int24 tick) internal pure returns (uint160 sqrtPriceX96) {\n uint256 absTick = tick < 0 ? uint256(-int256(tick)) : uint256(int256(tick));\n require(absTick <= uint256(int256(MAX_TICK)), 'T');\n\n uint256 ratio = absTick & 0x1 != 0 ? 0xfffcb933bd6fad37aa2d162d1a594001 : 0x100000000000000000000000000000000;\n if (absTick & 0x2 != 0) ratio = (ratio * 0xfff97272373d413259a46990580e213a) >> 128;\n if (absTick & 0x4 != 0) ratio = (ratio * 0xfff2e50f5f656932ef12357cf3c7fdcc) >> 128;\n if (absTick & 0x8 != 0) ratio = (ratio * 0xffe5caca7e10e4e61c3624eaa0941cd0) >> 128;\n if (absTick & 0x10 != 0) ratio = (ratio * 0xffcb9843d60f6159c9db58835c926644) >> 128;\n if (absTick & 0x20 != 0) ratio = (ratio * 0xff973b41fa98c081472e6896dfb254c0) >> 128;\n if (absTick & 0x40 != 0) ratio = (ratio * 0xff2ea16466c96a3843ec78b326b52861) >> 128;\n if (absTick & 0x80 != 0) ratio = (ratio * 0xfe5dee046a99a2a811c461f1969c3053) >> 128;\n if (absTick & 0x100 != 0) ratio = (ratio * 0xfcbe86c7900a88aedcffc83b479aa3a4) >> 128;\n if (absTick & 0x200 != 0) ratio = (ratio * 0xf987a7253ac413176f2b074cf7815e54) >> 128;\n if (absTick & 0x400 != 0) ratio = (ratio * 0xf3392b0822b70005940c7a398e4b70f3) >> 128;\n if (absTick & 0x800 != 0) ratio = (ratio * 0xe7159475a2c29b7443b29c7fa6e889d9) >> 128;\n if (absTick & 0x1000 != 0) ratio = (ratio * 0xd097f3bdfd2022b8845ad8f792aa5825) >> 128;\n if (absTick & 0x2000 != 0) ratio = (ratio * 0xa9f746462d870fdf8a65dc1f90e061e5) >> 128;\n if (absTick & 0x4000 != 0) ratio = (ratio * 0x70d869a156d2a1b890bb3df62baf32f7) >> 128;\n if (absTick & 0x8000 != 0) ratio = (ratio * 0x31be135f97d08fd981231505542fcfa6) >> 128;\n if (absTick & 0x10000 != 0) ratio = (ratio * 0x9aa508b5b7a84e1c677de54f3e99bc9) >> 128;\n if (absTick & 0x20000 != 0) ratio = (ratio * 0x5d6af8dedb81196699c329225ee604) >> 128;\n if (absTick & 0x40000 != 0) ratio = (ratio * 0x2216e584f5fa1ea926041bedfe98) >> 128;\n if (absTick & 0x80000 != 0) ratio = (ratio * 0x48a170391f7dc42444e8fa2) >> 128;\n\n if (tick > 0) ratio = type(uint256).max / ratio;\n\n // Divides by 1<<32 rounding up to go from a Q128.128 to a Q128.96.\n // we then downcast because we know the result always fits within 160 bits due to our tick input constraint\n // we round up in the division so getTickAtSqrtRatio of the output price is always consistent\n sqrtPriceX96 = uint160((ratio >> 32) + (ratio % (1 << 32) == 0 ? 0 : 1));\n }\n\n /// @notice Calculates the greatest tick value such that getRatioAtTick(tick) <= ratio\n /// @dev Throws in case sqrtPriceX96 < MIN_SQRT_RATIO, as MIN_SQRT_RATIO is the lowest value getRatioAtTick may ever return.\n /// @param sqrtPriceX96 The sqrt ratio for which to compute the tick as a Q64.96\n /// @return tick The greatest tick for which the ratio is less than or equal to the input ratio\n function getTickAtSqrtRatio(uint160 sqrtPriceX96) internal pure returns (int24 tick) {\n // Second inequality must be < because the price can never reach the price at the max tick\n require(sqrtPriceX96 >= MIN_SQRT_RATIO && sqrtPriceX96 < MAX_SQRT_RATIO, 'R');\n uint256 ratio = uint256(sqrtPriceX96) << 32;\n\n uint256 r = ratio;\n uint256 msb = 0;\n\n assembly {\n let f := shl(7, gt(r, 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF))\n msb := or(msb, f)\n r := shr(f, r)\n }\n assembly {\n let f := shl(6, gt(r, 0xFFFFFFFFFFFFFFFF))\n msb := or(msb, f)\n r := shr(f, r)\n }\n assembly {\n let f := shl(5, gt(r, 0xFFFFFFFF))\n msb := or(msb, f)\n r := shr(f, r)\n }\n assembly {\n let f := shl(4, gt(r, 0xFFFF))\n msb := or(msb, f)\n r := shr(f, r)\n }\n assembly {\n let f := shl(3, gt(r, 0xFF))\n msb := or(msb, f)\n r := shr(f, r)\n }\n assembly {\n let f := shl(2, gt(r, 0xF))\n msb := or(msb, f)\n r := shr(f, r)\n }\n assembly {\n let f := shl(1, gt(r, 0x3))\n msb := or(msb, f)\n r := shr(f, r)\n }\n assembly {\n let f := gt(r, 0x1)\n msb := or(msb, f)\n }\n\n if (msb >= 128) r = ratio >> (msb - 127);\n else r = ratio << (127 - msb);\n\n int256 log_2 = (int256(msb) - 128) << 64;\n\n assembly {\n r := shr(127, mul(r, r))\n let f := shr(128, r)\n log_2 := or(log_2, shl(63, f))\n r := shr(f, r)\n }\n assembly {\n r := shr(127, mul(r, r))\n let f := shr(128, r)\n log_2 := or(log_2, shl(62, f))\n r := shr(f, r)\n }\n assembly {\n r := shr(127, mul(r, r))\n let f := shr(128, r)\n log_2 := or(log_2, shl(61, f))\n r := shr(f, r)\n }\n assembly {\n r := shr(127, mul(r, r))\n let f := shr(128, r)\n log_2 := or(log_2, shl(60, f))\n r := shr(f, r)\n }\n assembly {\n r := shr(127, mul(r, r))\n let f := shr(128, r)\n log_2 := or(log_2, shl(59, f))\n r := shr(f, r)\n }\n assembly {\n r := shr(127, mul(r, r))\n let f := shr(128, r)\n log_2 := or(log_2, shl(58, f))\n r := shr(f, r)\n }\n assembly {\n r := shr(127, mul(r, r))\n let f := shr(128, r)\n log_2 := or(log_2, shl(57, f))\n r := shr(f, r)\n }\n assembly {\n r := shr(127, mul(r, r))\n let f := shr(128, r)\n log_2 := or(log_2, shl(56, f))\n r := shr(f, r)\n }\n assembly {\n r := shr(127, mul(r, r))\n let f := shr(128, r)\n log_2 := or(log_2, shl(55, f))\n r := shr(f, r)\n }\n assembly {\n r := shr(127, mul(r, r))\n let f := shr(128, r)\n log_2 := or(log_2, shl(54, f))\n r := shr(f, r)\n }\n assembly {\n r := shr(127, mul(r, r))\n let f := shr(128, r)\n log_2 := or(log_2, shl(53, f))\n r := shr(f, r)\n }\n assembly {\n r := shr(127, mul(r, r))\n let f := shr(128, r)\n log_2 := or(log_2, shl(52, f))\n r := shr(f, r)\n }\n assembly {\n r := shr(127, mul(r, r))\n let f := shr(128, r)\n log_2 := or(log_2, shl(51, f))\n r := shr(f, r)\n }\n assembly {\n r := shr(127, mul(r, r))\n let f := shr(128, r)\n log_2 := or(log_2, shl(50, f))\n }\n\n int256 log_sqrt10001 = log_2 * 255738958999603826347141; // 128.128 number\n\n int24 tickLow = int24((log_sqrt10001 - 3402992956809132418596140100660247210) >> 128);\n int24 tickHi = int24((log_sqrt10001 + 291339464771989622907027621153398088495) >> 128);\n\n tick = tickLow == tickHi ? tickLow : getSqrtRatioAtTick(tickHi) <= sqrtPriceX96 ? tickHi : tickLow;\n }\n}\n" - }, - "@uniswap/v3-core/contracts/interfaces/IUniswapV3Pool.sol": { - "content": "// SPDX-License-Identifier: GPL-2.0-or-later\npragma solidity >=0.5.0;\n\nimport './pool/IUniswapV3PoolImmutables.sol';\nimport './pool/IUniswapV3PoolState.sol';\nimport './pool/IUniswapV3PoolDerivedState.sol';\nimport './pool/IUniswapV3PoolActions.sol';\nimport './pool/IUniswapV3PoolOwnerActions.sol';\nimport './pool/IUniswapV3PoolEvents.sol';\n\n/// @title The interface for a Uniswap V3 Pool\n/// @notice A Uniswap pool facilitates swapping and automated market making between any two assets that strictly conform\n/// to the ERC20 specification\n/// @dev The pool interface is broken up into many smaller pieces\ninterface IUniswapV3Pool is\n IUniswapV3PoolImmutables,\n IUniswapV3PoolState,\n IUniswapV3PoolDerivedState,\n IUniswapV3PoolActions,\n IUniswapV3PoolOwnerActions,\n IUniswapV3PoolEvents\n{\n\n}\n" - }, - "@uniswap/v3-core/contracts/interfaces/pool/IUniswapV3PoolImmutables.sol": { - "content": "// SPDX-License-Identifier: GPL-2.0-or-later\npragma solidity >=0.5.0;\n\n/// @title Pool state that never changes\n/// @notice These parameters are fixed for a pool forever, i.e., the methods will always return the same values\ninterface IUniswapV3PoolImmutables {\n /// @notice The contract that deployed the pool, which must adhere to the IUniswapV3Factory interface\n /// @return The contract address\n function factory() external view returns (address);\n\n /// @notice The first of the two tokens of the pool, sorted by address\n /// @return The token contract address\n function token0() external view returns (address);\n\n /// @notice The second of the two tokens of the pool, sorted by address\n /// @return The token contract address\n function token1() external view returns (address);\n\n /// @notice The pool's fee in hundredths of a bip, i.e. 1e-6\n /// @return The fee\n function fee() external view returns (uint24);\n\n /// @notice The pool tick spacing\n /// @dev Ticks can only be used at multiples of this value, minimum of 1 and always positive\n /// e.g.: a tickSpacing of 3 means ticks can be initialized every 3rd tick, i.e., ..., -6, -3, 0, 3, 6, ...\n /// This value is an int24 to avoid casting even though it is always positive.\n /// @return The tick spacing\n function tickSpacing() external view returns (int24);\n\n /// @notice The maximum amount of position liquidity that can use any tick in the range\n /// @dev This parameter is enforced per tick to prevent liquidity from overflowing a uint128 at any point, and\n /// also prevents out-of-range liquidity from being used to prevent adding in-range liquidity to a pool\n /// @return The max amount of liquidity per tick\n function maxLiquidityPerTick() external view returns (uint128);\n}\n" - }, - "@uniswap/v3-core/contracts/interfaces/pool/IUniswapV3PoolState.sol": { - "content": "// SPDX-License-Identifier: GPL-2.0-or-later\npragma solidity >=0.5.0;\n\n/// @title Pool state that can change\n/// @notice These methods compose the pool's state, and can change with any frequency including multiple times\n/// per transaction\ninterface IUniswapV3PoolState {\n /// @notice The 0th storage slot in the pool stores many values, and is exposed as a single method to save gas\n /// when accessed externally.\n /// @return sqrtPriceX96 The current price of the pool as a sqrt(token1/token0) Q64.96 value\n /// tick The current tick of the pool, i.e. according to the last tick transition that was run.\n /// This value may not always be equal to SqrtTickMath.getTickAtSqrtRatio(sqrtPriceX96) if the price is on a tick\n /// boundary.\n /// observationIndex The index of the last oracle observation that was written,\n /// observationCardinality The current maximum number of observations stored in the pool,\n /// observationCardinalityNext The next maximum number of observations, to be updated when the observation.\n /// feeProtocol The protocol fee for both tokens of the pool.\n /// Encoded as two 4 bit values, where the protocol fee of token1 is shifted 4 bits and the protocol fee of token0\n /// is the lower 4 bits. Used as the denominator of a fraction of the swap fee, e.g. 4 means 1/4th of the swap fee.\n /// unlocked Whether the pool is currently locked to reentrancy\n function slot0()\n external\n view\n returns (\n uint160 sqrtPriceX96,\n int24 tick,\n uint16 observationIndex,\n uint16 observationCardinality,\n uint16 observationCardinalityNext,\n uint8 feeProtocol,\n bool unlocked\n );\n\n /// @notice The fee growth as a Q128.128 fees of token0 collected per unit of liquidity for the entire life of the pool\n /// @dev This value can overflow the uint256\n function feeGrowthGlobal0X128() external view returns (uint256);\n\n /// @notice The fee growth as a Q128.128 fees of token1 collected per unit of liquidity for the entire life of the pool\n /// @dev This value can overflow the uint256\n function feeGrowthGlobal1X128() external view returns (uint256);\n\n /// @notice The amounts of token0 and token1 that are owed to the protocol\n /// @dev Protocol fees will never exceed uint128 max in either token\n function protocolFees() external view returns (uint128 token0, uint128 token1);\n\n /// @notice The currently in range liquidity available to the pool\n /// @dev This value has no relationship to the total liquidity across all ticks\n function liquidity() external view returns (uint128);\n\n /// @notice Look up information about a specific tick in the pool\n /// @param tick The tick to look up\n /// @return liquidityGross the total amount of position liquidity that uses the pool either as tick lower or\n /// tick upper,\n /// liquidityNet how much liquidity changes when the pool price crosses the tick,\n /// feeGrowthOutside0X128 the fee growth on the other side of the tick from the current tick in token0,\n /// feeGrowthOutside1X128 the fee growth on the other side of the tick from the current tick in token1,\n /// tickCumulativeOutside the cumulative tick value on the other side of the tick from the current tick\n /// secondsPerLiquidityOutsideX128 the seconds spent per liquidity on the other side of the tick from the current tick,\n /// secondsOutside the seconds spent on the other side of the tick from the current tick,\n /// initialized Set to true if the tick is initialized, i.e. liquidityGross is greater than 0, otherwise equal to false.\n /// Outside values can only be used if the tick is initialized, i.e. if liquidityGross is greater than 0.\n /// In addition, these values are only relative and must be used only in comparison to previous snapshots for\n /// a specific position.\n function ticks(int24 tick)\n external\n view\n returns (\n uint128 liquidityGross,\n int128 liquidityNet,\n uint256 feeGrowthOutside0X128,\n uint256 feeGrowthOutside1X128,\n int56 tickCumulativeOutside,\n uint160 secondsPerLiquidityOutsideX128,\n uint32 secondsOutside,\n bool initialized\n );\n\n /// @notice Returns 256 packed tick initialized boolean values. See TickBitmap for more information\n function tickBitmap(int16 wordPosition) external view returns (uint256);\n\n /// @notice Returns the information about a position by the position's key\n /// @param key The position's key is a hash of a preimage composed by the owner, tickLower and tickUpper\n /// @return _liquidity The amount of liquidity in the position,\n /// Returns feeGrowthInside0LastX128 fee growth of token0 inside the tick range as of the last mint/burn/poke,\n /// Returns feeGrowthInside1LastX128 fee growth of token1 inside the tick range as of the last mint/burn/poke,\n /// Returns tokensOwed0 the computed amount of token0 owed to the position as of the last mint/burn/poke,\n /// Returns tokensOwed1 the computed amount of token1 owed to the position as of the last mint/burn/poke\n function positions(bytes32 key)\n external\n view\n returns (\n uint128 _liquidity,\n uint256 feeGrowthInside0LastX128,\n uint256 feeGrowthInside1LastX128,\n uint128 tokensOwed0,\n uint128 tokensOwed1\n );\n\n /// @notice Returns data about a specific observation index\n /// @param index The element of the observations array to fetch\n /// @dev You most likely want to use #observe() instead of this method to get an observation as of some amount of time\n /// ago, rather than at a specific index in the array.\n /// @return blockTimestamp The timestamp of the observation,\n /// Returns tickCumulative the tick multiplied by seconds elapsed for the life of the pool as of the observation timestamp,\n /// Returns secondsPerLiquidityCumulativeX128 the seconds per in range liquidity for the life of the pool as of the observation timestamp,\n /// Returns initialized whether the observation has been initialized and the values are safe to use\n function observations(uint256 index)\n external\n view\n returns (\n uint32 blockTimestamp,\n int56 tickCumulative,\n uint160 secondsPerLiquidityCumulativeX128,\n bool initialized\n );\n}\n" - }, - "@uniswap/v3-core/contracts/interfaces/pool/IUniswapV3PoolDerivedState.sol": { - "content": "// SPDX-License-Identifier: GPL-2.0-or-later\npragma solidity >=0.5.0;\n\n/// @title Pool state that is not stored\n/// @notice Contains view functions to provide information about the pool that is computed rather than stored on the\n/// blockchain. The functions here may have variable gas costs.\ninterface IUniswapV3PoolDerivedState {\n /// @notice Returns the cumulative tick and liquidity as of each timestamp `secondsAgo` from the current block timestamp\n /// @dev To get a time weighted average tick or liquidity-in-range, you must call this with two values, one representing\n /// the beginning of the period and another for the end of the period. E.g., to get the last hour time-weighted average tick,\n /// you must call it with secondsAgos = [3600, 0].\n /// @dev The time weighted average tick represents the geometric time weighted average price of the pool, in\n /// log base sqrt(1.0001) of token1 / token0. The TickMath library can be used to go from a tick value to a ratio.\n /// @param secondsAgos From how long ago each cumulative tick and liquidity value should be returned\n /// @return tickCumulatives Cumulative tick values as of each `secondsAgos` from the current block timestamp\n /// @return secondsPerLiquidityCumulativeX128s Cumulative seconds per liquidity-in-range value as of each `secondsAgos` from the current block\n /// timestamp\n function observe(uint32[] calldata secondsAgos)\n external\n view\n returns (int56[] memory tickCumulatives, uint160[] memory secondsPerLiquidityCumulativeX128s);\n\n /// @notice Returns a snapshot of the tick cumulative, seconds per liquidity and seconds inside a tick range\n /// @dev Snapshots must only be compared to other snapshots, taken over a period for which a position existed.\n /// I.e., snapshots cannot be compared if a position is not held for the entire period between when the first\n /// snapshot is taken and the second snapshot is taken.\n /// @param tickLower The lower tick of the range\n /// @param tickUpper The upper tick of the range\n /// @return tickCumulativeInside The snapshot of the tick accumulator for the range\n /// @return secondsPerLiquidityInsideX128 The snapshot of seconds per liquidity for the range\n /// @return secondsInside The snapshot of seconds per liquidity for the range\n function snapshotCumulativesInside(int24 tickLower, int24 tickUpper)\n external\n view\n returns (\n int56 tickCumulativeInside,\n uint160 secondsPerLiquidityInsideX128,\n uint32 secondsInside\n );\n}\n" - }, - "@uniswap/v3-core/contracts/interfaces/pool/IUniswapV3PoolActions.sol": { - "content": "// SPDX-License-Identifier: GPL-2.0-or-later\npragma solidity >=0.5.0;\n\n/// @title Permissionless pool actions\n/// @notice Contains pool methods that can be called by anyone\ninterface IUniswapV3PoolActions {\n /// @notice Sets the initial price for the pool\n /// @dev Price is represented as a sqrt(amountToken1/amountToken0) Q64.96 value\n /// @param sqrtPriceX96 the initial sqrt price of the pool as a Q64.96\n function initialize(uint160 sqrtPriceX96) external;\n\n /// @notice Adds liquidity for the given recipient/tickLower/tickUpper position\n /// @dev The caller of this method receives a callback in the form of IUniswapV3MintCallback#uniswapV3MintCallback\n /// in which they must pay any token0 or token1 owed for the liquidity. The amount of token0/token1 due depends\n /// on tickLower, tickUpper, the amount of liquidity, and the current price.\n /// @param recipient The address for which the liquidity will be created\n /// @param tickLower The lower tick of the position in which to add liquidity\n /// @param tickUpper The upper tick of the position in which to add liquidity\n /// @param amount The amount of liquidity to mint\n /// @param data Any data that should be passed through to the callback\n /// @return amount0 The amount of token0 that was paid to mint the given amount of liquidity. Matches the value in the callback\n /// @return amount1 The amount of token1 that was paid to mint the given amount of liquidity. Matches the value in the callback\n function mint(\n address recipient,\n int24 tickLower,\n int24 tickUpper,\n uint128 amount,\n bytes calldata data\n ) external returns (uint256 amount0, uint256 amount1);\n\n /// @notice Collects tokens owed to a position\n /// @dev Does not recompute fees earned, which must be done either via mint or burn of any amount of liquidity.\n /// Collect must be called by the position owner. To withdraw only token0 or only token1, amount0Requested or\n /// amount1Requested may be set to zero. To withdraw all tokens owed, caller may pass any value greater than the\n /// actual tokens owed, e.g. type(uint128).max. Tokens owed may be from accumulated swap fees or burned liquidity.\n /// @param recipient The address which should receive the fees collected\n /// @param tickLower The lower tick of the position for which to collect fees\n /// @param tickUpper The upper tick of the position for which to collect fees\n /// @param amount0Requested How much token0 should be withdrawn from the fees owed\n /// @param amount1Requested How much token1 should be withdrawn from the fees owed\n /// @return amount0 The amount of fees collected in token0\n /// @return amount1 The amount of fees collected in token1\n function collect(\n address recipient,\n int24 tickLower,\n int24 tickUpper,\n uint128 amount0Requested,\n uint128 amount1Requested\n ) external returns (uint128 amount0, uint128 amount1);\n\n /// @notice Burn liquidity from the sender and account tokens owed for the liquidity to the position\n /// @dev Can be used to trigger a recalculation of fees owed to a position by calling with an amount of 0\n /// @dev Fees must be collected separately via a call to #collect\n /// @param tickLower The lower tick of the position for which to burn liquidity\n /// @param tickUpper The upper tick of the position for which to burn liquidity\n /// @param amount How much liquidity to burn\n /// @return amount0 The amount of token0 sent to the recipient\n /// @return amount1 The amount of token1 sent to the recipient\n function burn(\n int24 tickLower,\n int24 tickUpper,\n uint128 amount\n ) external returns (uint256 amount0, uint256 amount1);\n\n /// @notice Swap token0 for token1, or token1 for token0\n /// @dev The caller of this method receives a callback in the form of IUniswapV3SwapCallback#uniswapV3SwapCallback\n /// @param recipient The address to receive the output of the swap\n /// @param zeroForOne The direction of the swap, true for token0 to token1, false for token1 to token0\n /// @param amountSpecified The amount of the swap, which implicitly configures the swap as exact input (positive), or exact output (negative)\n /// @param sqrtPriceLimitX96 The Q64.96 sqrt price limit. If zero for one, the price cannot be less than this\n /// value after the swap. If one for zero, the price cannot be greater than this value after the swap\n /// @param data Any data to be passed through to the callback\n /// @return amount0 The delta of the balance of token0 of the pool, exact when negative, minimum when positive\n /// @return amount1 The delta of the balance of token1 of the pool, exact when negative, minimum when positive\n function swap(\n address recipient,\n bool zeroForOne,\n int256 amountSpecified,\n uint160 sqrtPriceLimitX96,\n bytes calldata data\n ) external returns (int256 amount0, int256 amount1);\n\n /// @notice Receive token0 and/or token1 and pay it back, plus a fee, in the callback\n /// @dev The caller of this method receives a callback in the form of IUniswapV3FlashCallback#uniswapV3FlashCallback\n /// @dev Can be used to donate underlying tokens pro-rata to currently in-range liquidity providers by calling\n /// with 0 amount{0,1} and sending the donation amount(s) from the callback\n /// @param recipient The address which will receive the token0 and token1 amounts\n /// @param amount0 The amount of token0 to send\n /// @param amount1 The amount of token1 to send\n /// @param data Any data to be passed through to the callback\n function flash(\n address recipient,\n uint256 amount0,\n uint256 amount1,\n bytes calldata data\n ) external;\n\n /// @notice Increase the maximum number of price and liquidity observations that this pool will store\n /// @dev This method is no-op if the pool already has an observationCardinalityNext greater than or equal to\n /// the input observationCardinalityNext.\n /// @param observationCardinalityNext The desired minimum number of observations for the pool to store\n function increaseObservationCardinalityNext(uint16 observationCardinalityNext) external;\n}\n" - }, - "@uniswap/v3-core/contracts/interfaces/pool/IUniswapV3PoolOwnerActions.sol": { - "content": "// SPDX-License-Identifier: GPL-2.0-or-later\npragma solidity >=0.5.0;\n\n/// @title Permissioned pool actions\n/// @notice Contains pool methods that may only be called by the factory owner\ninterface IUniswapV3PoolOwnerActions {\n /// @notice Set the denominator of the protocol's % share of the fees\n /// @param feeProtocol0 new protocol fee for token0 of the pool\n /// @param feeProtocol1 new protocol fee for token1 of the pool\n function setFeeProtocol(uint8 feeProtocol0, uint8 feeProtocol1) external;\n\n /// @notice Collect the protocol fee accrued to the pool\n /// @param recipient The address to which collected protocol fees should be sent\n /// @param amount0Requested The maximum amount of token0 to send, can be 0 to collect fees in only token1\n /// @param amount1Requested The maximum amount of token1 to send, can be 0 to collect fees in only token0\n /// @return amount0 The protocol fee collected in token0\n /// @return amount1 The protocol fee collected in token1\n function collectProtocol(\n address recipient,\n uint128 amount0Requested,\n uint128 amount1Requested\n ) external returns (uint128 amount0, uint128 amount1);\n}\n" - }, - "@uniswap/v3-core/contracts/interfaces/pool/IUniswapV3PoolEvents.sol": { - "content": "// SPDX-License-Identifier: GPL-2.0-or-later\npragma solidity >=0.5.0;\n\n/// @title Events emitted by a pool\n/// @notice Contains all events emitted by the pool\ninterface IUniswapV3PoolEvents {\n /// @notice Emitted exactly once by a pool when #initialize is first called on the pool\n /// @dev Mint/Burn/Swap cannot be emitted by the pool before Initialize\n /// @param sqrtPriceX96 The initial sqrt price of the pool, as a Q64.96\n /// @param tick The initial tick of the pool, i.e. log base 1.0001 of the starting price of the pool\n event Initialize(uint160 sqrtPriceX96, int24 tick);\n\n /// @notice Emitted when liquidity is minted for a given position\n /// @param sender The address that minted the liquidity\n /// @param owner The owner of the position and recipient of any minted liquidity\n /// @param tickLower The lower tick of the position\n /// @param tickUpper The upper tick of the position\n /// @param amount The amount of liquidity minted to the position range\n /// @param amount0 How much token0 was required for the minted liquidity\n /// @param amount1 How much token1 was required for the minted liquidity\n event Mint(\n address sender,\n address indexed owner,\n int24 indexed tickLower,\n int24 indexed tickUpper,\n uint128 amount,\n uint256 amount0,\n uint256 amount1\n );\n\n /// @notice Emitted when fees are collected by the owner of a position\n /// @dev Collect events may be emitted with zero amount0 and amount1 when the caller chooses not to collect fees\n /// @param owner The owner of the position for which fees are collected\n /// @param tickLower The lower tick of the position\n /// @param tickUpper The upper tick of the position\n /// @param amount0 The amount of token0 fees collected\n /// @param amount1 The amount of token1 fees collected\n event Collect(\n address indexed owner,\n address recipient,\n int24 indexed tickLower,\n int24 indexed tickUpper,\n uint128 amount0,\n uint128 amount1\n );\n\n /// @notice Emitted when a position's liquidity is removed\n /// @dev Does not withdraw any fees earned by the liquidity position, which must be withdrawn via #collect\n /// @param owner The owner of the position for which liquidity is removed\n /// @param tickLower The lower tick of the position\n /// @param tickUpper The upper tick of the position\n /// @param amount The amount of liquidity to remove\n /// @param amount0 The amount of token0 withdrawn\n /// @param amount1 The amount of token1 withdrawn\n event Burn(\n address indexed owner,\n int24 indexed tickLower,\n int24 indexed tickUpper,\n uint128 amount,\n uint256 amount0,\n uint256 amount1\n );\n\n /// @notice Emitted by the pool for any swaps between token0 and token1\n /// @param sender The address that initiated the swap call, and that received the callback\n /// @param recipient The address that received the output of the swap\n /// @param amount0 The delta of the token0 balance of the pool\n /// @param amount1 The delta of the token1 balance of the pool\n /// @param sqrtPriceX96 The sqrt(price) of the pool after the swap, as a Q64.96\n /// @param liquidity The liquidity of the pool after the swap\n /// @param tick The log base 1.0001 of price of the pool after the swap\n event Swap(\n address indexed sender,\n address indexed recipient,\n int256 amount0,\n int256 amount1,\n uint160 sqrtPriceX96,\n uint128 liquidity,\n int24 tick\n );\n\n /// @notice Emitted by the pool for any flashes of token0/token1\n /// @param sender The address that initiated the swap call, and that received the callback\n /// @param recipient The address that received the tokens from flash\n /// @param amount0 The amount of token0 that was flashed\n /// @param amount1 The amount of token1 that was flashed\n /// @param paid0 The amount of token0 paid for the flash, which can exceed the amount0 plus the fee\n /// @param paid1 The amount of token1 paid for the flash, which can exceed the amount1 plus the fee\n event Flash(\n address indexed sender,\n address indexed recipient,\n uint256 amount0,\n uint256 amount1,\n uint256 paid0,\n uint256 paid1\n );\n\n /// @notice Emitted by the pool for increases to the number of observations that can be stored\n /// @dev observationCardinalityNext is not the observation cardinality until an observation is written at the index\n /// just before a mint/swap/burn.\n /// @param observationCardinalityNextOld The previous value of the next observation cardinality\n /// @param observationCardinalityNextNew The updated value of the next observation cardinality\n event IncreaseObservationCardinalityNext(\n uint16 observationCardinalityNextOld,\n uint16 observationCardinalityNextNew\n );\n\n /// @notice Emitted when the protocol fee is changed by the pool\n /// @param feeProtocol0Old The previous value of the token0 protocol fee\n /// @param feeProtocol1Old The previous value of the token1 protocol fee\n /// @param feeProtocol0New The updated value of the token0 protocol fee\n /// @param feeProtocol1New The updated value of the token1 protocol fee\n event SetFeeProtocol(uint8 feeProtocol0Old, uint8 feeProtocol1Old, uint8 feeProtocol0New, uint8 feeProtocol1New);\n\n /// @notice Emitted when the collected protocol fees are withdrawn by the factory owner\n /// @param sender The address that collects the protocol fees\n /// @param recipient The address that receives the collected protocol fees\n /// @param amount0 The amount of token0 protocol fees that is withdrawn\n /// @param amount0 The amount of token1 protocol fees that is withdrawn\n event CollectProtocol(address indexed sender, address indexed recipient, uint128 amount0, uint128 amount1);\n}\n" - }, - "solidity/for-test/UniV3PairManagerForTest.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '@openzeppelin/contracts/token/ERC20/ERC20.sol';\nimport '@uniswap/v3-core/contracts/interfaces/IUniswapV3Pool.sol';\n\nimport '../contracts/libraries/LiquidityAmounts.sol';\nimport '../contracts/libraries/PoolAddress.sol';\nimport '../contracts/libraries/FixedPoint96.sol';\nimport '../contracts/libraries/FullMath.sol';\nimport '../contracts/libraries/TickMath.sol';\nimport '../contracts/UniV3PairManager.sol';\nimport '../interfaces/external/IWeth9.sol';\nimport '../interfaces/IUniV3PairManager.sol';\n\ncontract UniV3PairManagerForTest is UniV3PairManager {\n constructor(address _pool, address _governance) UniV3PairManager(_pool, _governance) {}\n\n function internalAddLiquidity(\n uint256 amount0Desired,\n uint256 amount1Desired,\n uint256 amount0Min,\n uint256 amount1Min\n )\n external\n returns (\n uint128 liquidity,\n uint256 amount0,\n uint256 amount1\n )\n {\n return _addLiquidity(amount0Desired, amount1Desired, amount0Min, amount1Min);\n }\n\n function internalPay(\n address token,\n address payer,\n address recipient,\n uint256 value\n ) external {\n return _pay(token, payer, recipient, value);\n }\n\n function internalMint(address dst, uint256 amount) external {\n return _mint(dst, amount);\n }\n\n function internalBurn(address dst, uint256 amount) external {\n return _burn(dst, amount);\n }\n\n function internalTransferTokens(\n address src,\n address dst,\n uint256 amount\n ) external {\n _transferTokens(src, dst, amount);\n }\n\n function internalSafeTransferFrom(\n address token,\n address from,\n address to,\n uint256 value\n ) external {\n _safeTransferFrom(token, from, to, value);\n }\n\n receive() external payable {}\n}\n" - }, - "@openzeppelin/contracts/token/ERC20/ERC20.sol": { - "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\nimport \"./IERC20.sol\";\nimport \"./extensions/IERC20Metadata.sol\";\nimport \"../../utils/Context.sol\";\n\n/**\n * @dev Implementation of the {IERC20} interface.\n *\n * This implementation is agnostic to the way tokens are created. This means\n * that a supply mechanism has to be added in a derived contract using {_mint}.\n * For a generic mechanism see {ERC20PresetMinterPauser}.\n *\n * TIP: For a detailed writeup see our guide\n * https://forum.zeppelin.solutions/t/how-to-implement-erc20-supply-mechanisms/226[How\n * to implement supply mechanisms].\n *\n * We have followed general OpenZeppelin Contracts guidelines: functions revert\n * instead returning `false` on failure. This behavior is nonetheless\n * conventional and does not conflict with the expectations of ERC20\n * applications.\n *\n * Additionally, an {Approval} event is emitted on calls to {transferFrom}.\n * This allows applications to reconstruct the allowance for all accounts just\n * by listening to said events. Other implementations of the EIP may not emit\n * these events, as it isn't required by the specification.\n *\n * Finally, the non-standard {decreaseAllowance} and {increaseAllowance}\n * functions have been added to mitigate the well-known issues around setting\n * allowances. See {IERC20-approve}.\n */\ncontract ERC20 is Context, IERC20, IERC20Metadata {\n mapping(address => uint256) private _balances;\n\n mapping(address => mapping(address => uint256)) private _allowances;\n\n uint256 private _totalSupply;\n\n string private _name;\n string private _symbol;\n\n /**\n * @dev Sets the values for {name} and {symbol}.\n *\n * The default value of {decimals} is 18. To select a different value for\n * {decimals} you should overload it.\n *\n * All two of these values are immutable: they can only be set once during\n * construction.\n */\n constructor(string memory name_, string memory symbol_) {\n _name = name_;\n _symbol = symbol_;\n }\n\n /**\n * @dev Returns the name of the token.\n */\n function name() public view virtual override returns (string memory) {\n return _name;\n }\n\n /**\n * @dev Returns the symbol of the token, usually a shorter version of the\n * name.\n */\n function symbol() public view virtual override returns (string memory) {\n return _symbol;\n }\n\n /**\n * @dev Returns the number of decimals used to get its user representation.\n * For example, if `decimals` equals `2`, a balance of `505` tokens should\n * be displayed to a user as `5.05` (`505 / 10 ** 2`).\n *\n * Tokens usually opt for a value of 18, imitating the relationship between\n * Ether and Wei. This is the value {ERC20} uses, unless this function is\n * overridden;\n *\n * NOTE: This information is only used for _display_ purposes: it in\n * no way affects any of the arithmetic of the contract, including\n * {IERC20-balanceOf} and {IERC20-transfer}.\n */\n function decimals() public view virtual override returns (uint8) {\n return 18;\n }\n\n /**\n * @dev See {IERC20-totalSupply}.\n */\n function totalSupply() public view virtual override returns (uint256) {\n return _totalSupply;\n }\n\n /**\n * @dev See {IERC20-balanceOf}.\n */\n function balanceOf(address account) public view virtual override returns (uint256) {\n return _balances[account];\n }\n\n /**\n * @dev See {IERC20-transfer}.\n *\n * Requirements:\n *\n * - `recipient` cannot be the zero address.\n * - the caller must have a balance of at least `amount`.\n */\n function transfer(address recipient, uint256 amount) public virtual override returns (bool) {\n _transfer(_msgSender(), recipient, amount);\n return true;\n }\n\n /**\n * @dev See {IERC20-allowance}.\n */\n function allowance(address owner, address spender) public view virtual override returns (uint256) {\n return _allowances[owner][spender];\n }\n\n /**\n * @dev See {IERC20-approve}.\n *\n * Requirements:\n *\n * - `spender` cannot be the zero address.\n */\n function approve(address spender, uint256 amount) public virtual override returns (bool) {\n _approve(_msgSender(), spender, amount);\n return true;\n }\n\n /**\n * @dev See {IERC20-transferFrom}.\n *\n * Emits an {Approval} event indicating the updated allowance. This is not\n * required by the EIP. See the note at the beginning of {ERC20}.\n *\n * Requirements:\n *\n * - `sender` and `recipient` cannot be the zero address.\n * - `sender` must have a balance of at least `amount`.\n * - the caller must have allowance for ``sender``'s tokens of at least\n * `amount`.\n */\n function transferFrom(\n address sender,\n address recipient,\n uint256 amount\n ) public virtual override returns (bool) {\n _transfer(sender, recipient, amount);\n\n uint256 currentAllowance = _allowances[sender][_msgSender()];\n require(currentAllowance >= amount, \"ERC20: transfer amount exceeds allowance\");\n unchecked {\n _approve(sender, _msgSender(), currentAllowance - amount);\n }\n\n return true;\n }\n\n /**\n * @dev Atomically increases the allowance granted to `spender` by the caller.\n *\n * This is an alternative to {approve} that can be used as a mitigation for\n * problems described in {IERC20-approve}.\n *\n * Emits an {Approval} event indicating the updated allowance.\n *\n * Requirements:\n *\n * - `spender` cannot be the zero address.\n */\n function increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool) {\n _approve(_msgSender(), spender, _allowances[_msgSender()][spender] + addedValue);\n return true;\n }\n\n /**\n * @dev Atomically decreases the allowance granted to `spender` by the caller.\n *\n * This is an alternative to {approve} that can be used as a mitigation for\n * problems described in {IERC20-approve}.\n *\n * Emits an {Approval} event indicating the updated allowance.\n *\n * Requirements:\n *\n * - `spender` cannot be the zero address.\n * - `spender` must have allowance for the caller of at least\n * `subtractedValue`.\n */\n function decreaseAllowance(address spender, uint256 subtractedValue) public virtual returns (bool) {\n uint256 currentAllowance = _allowances[_msgSender()][spender];\n require(currentAllowance >= subtractedValue, \"ERC20: decreased allowance below zero\");\n unchecked {\n _approve(_msgSender(), spender, currentAllowance - subtractedValue);\n }\n\n return true;\n }\n\n /**\n * @dev Moves `amount` of tokens from `sender` to `recipient`.\n *\n * This internal function is equivalent to {transfer}, and can be used to\n * e.g. implement automatic token fees, slashing mechanisms, etc.\n *\n * Emits a {Transfer} event.\n *\n * Requirements:\n *\n * - `sender` cannot be the zero address.\n * - `recipient` cannot be the zero address.\n * - `sender` must have a balance of at least `amount`.\n */\n function _transfer(\n address sender,\n address recipient,\n uint256 amount\n ) internal virtual {\n require(sender != address(0), \"ERC20: transfer from the zero address\");\n require(recipient != address(0), \"ERC20: transfer to the zero address\");\n\n _beforeTokenTransfer(sender, recipient, amount);\n\n uint256 senderBalance = _balances[sender];\n require(senderBalance >= amount, \"ERC20: transfer amount exceeds balance\");\n unchecked {\n _balances[sender] = senderBalance - amount;\n }\n _balances[recipient] += amount;\n\n emit Transfer(sender, recipient, amount);\n\n _afterTokenTransfer(sender, recipient, amount);\n }\n\n /** @dev Creates `amount` tokens and assigns them to `account`, increasing\n * the total supply.\n *\n * Emits a {Transfer} event with `from` set to the zero address.\n *\n * Requirements:\n *\n * - `account` cannot be the zero address.\n */\n function _mint(address account, uint256 amount) internal virtual {\n require(account != address(0), \"ERC20: mint to the zero address\");\n\n _beforeTokenTransfer(address(0), account, amount);\n\n _totalSupply += amount;\n _balances[account] += amount;\n emit Transfer(address(0), account, amount);\n\n _afterTokenTransfer(address(0), account, amount);\n }\n\n /**\n * @dev Destroys `amount` tokens from `account`, reducing the\n * total supply.\n *\n * Emits a {Transfer} event with `to` set to the zero address.\n *\n * Requirements:\n *\n * - `account` cannot be the zero address.\n * - `account` must have at least `amount` tokens.\n */\n function _burn(address account, uint256 amount) internal virtual {\n require(account != address(0), \"ERC20: burn from the zero address\");\n\n _beforeTokenTransfer(account, address(0), amount);\n\n uint256 accountBalance = _balances[account];\n require(accountBalance >= amount, \"ERC20: burn amount exceeds balance\");\n unchecked {\n _balances[account] = accountBalance - amount;\n }\n _totalSupply -= amount;\n\n emit Transfer(account, address(0), amount);\n\n _afterTokenTransfer(account, address(0), amount);\n }\n\n /**\n * @dev Sets `amount` as the allowance of `spender` over the `owner` s tokens.\n *\n * This internal function is equivalent to `approve`, and can be used to\n * e.g. set automatic allowances for certain subsystems, etc.\n *\n * Emits an {Approval} event.\n *\n * Requirements:\n *\n * - `owner` cannot be the zero address.\n * - `spender` cannot be the zero address.\n */\n function _approve(\n address owner,\n address spender,\n uint256 amount\n ) internal virtual {\n require(owner != address(0), \"ERC20: approve from the zero address\");\n require(spender != address(0), \"ERC20: approve to the zero address\");\n\n _allowances[owner][spender] = amount;\n emit Approval(owner, spender, amount);\n }\n\n /**\n * @dev Hook that is called before any transfer of tokens. This includes\n * minting and burning.\n *\n * Calling conditions:\n *\n * - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens\n * will be transferred to `to`.\n * - when `from` is zero, `amount` tokens will be minted for `to`.\n * - when `to` is zero, `amount` of ``from``'s tokens will be burned.\n * - `from` and `to` are never both zero.\n *\n * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].\n */\n function _beforeTokenTransfer(\n address from,\n address to,\n uint256 amount\n ) internal virtual {}\n\n /**\n * @dev Hook that is called after any transfer of tokens. This includes\n * minting and burning.\n *\n * Calling conditions:\n *\n * - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens\n * has been transferred to `to`.\n * - when `from` is zero, `amount` tokens have been minted for `to`.\n * - when `to` is zero, `amount` of ``from``'s tokens have been burned.\n * - `from` and `to` are never both zero.\n *\n * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].\n */\n function _afterTokenTransfer(\n address from,\n address to,\n uint256 amount\n ) internal virtual {}\n}\n" - }, - "solidity/contracts/libraries/LiquidityAmounts.sol": { - "content": "// SPDX-License-Identifier: GPL-2.0-or-later\npragma solidity >=0.8.4 <0.9.0;\n\nimport './FullMath.sol';\nimport './FixedPoint96.sol';\n\n// solhint-disable\nlibrary LiquidityAmounts {\n function toUint128(uint256 x) private pure returns (uint128 y) {\n require((y = uint128(x)) == x);\n }\n\n function getLiquidityForAmount0(\n uint160 sqrtRatioAX96,\n uint160 sqrtRatioBX96,\n uint256 amount0\n ) internal pure returns (uint128 liquidity) {\n if (sqrtRatioAX96 > sqrtRatioBX96) (sqrtRatioAX96, sqrtRatioBX96) = (sqrtRatioBX96, sqrtRatioAX96);\n uint256 intermediate = FullMath.mulDiv(sqrtRatioAX96, sqrtRatioBX96, FixedPoint96.Q96);\n return toUint128(FullMath.mulDiv(amount0, intermediate, sqrtRatioBX96 - sqrtRatioAX96));\n }\n\n function getLiquidityForAmount1(\n uint160 sqrtRatioAX96,\n uint160 sqrtRatioBX96,\n uint256 amount1\n ) internal pure returns (uint128 liquidity) {\n if (sqrtRatioAX96 > sqrtRatioBX96) (sqrtRatioAX96, sqrtRatioBX96) = (sqrtRatioBX96, sqrtRatioAX96);\n return toUint128(FullMath.mulDiv(amount1, FixedPoint96.Q96, sqrtRatioBX96 - sqrtRatioAX96));\n }\n\n function getLiquidityForAmounts(\n uint160 sqrtRatioX96,\n uint160 sqrtRatioAX96,\n uint160 sqrtRatioBX96,\n uint256 amount0,\n uint256 amount1\n ) internal pure returns (uint128 liquidity) {\n if (sqrtRatioAX96 > sqrtRatioBX96) (sqrtRatioAX96, sqrtRatioBX96) = (sqrtRatioBX96, sqrtRatioAX96);\n\n if (sqrtRatioX96 <= sqrtRatioAX96) {\n liquidity = getLiquidityForAmount0(sqrtRatioAX96, sqrtRatioBX96, amount0);\n } else if (sqrtRatioX96 < sqrtRatioBX96) {\n uint128 liquidity0 = getLiquidityForAmount0(sqrtRatioX96, sqrtRatioBX96, amount0);\n uint128 liquidity1 = getLiquidityForAmount1(sqrtRatioAX96, sqrtRatioX96, amount1);\n\n liquidity = liquidity0 < liquidity1 ? liquidity0 : liquidity1;\n } else {\n liquidity = getLiquidityForAmount1(sqrtRatioAX96, sqrtRatioBX96, amount1);\n }\n }\n\n function getAmount0ForLiquidity(\n uint160 sqrtRatioAX96,\n uint160 sqrtRatioBX96,\n uint128 liquidity\n ) internal pure returns (uint256 amount0) {\n if (sqrtRatioAX96 > sqrtRatioBX96) (sqrtRatioAX96, sqrtRatioBX96) = (sqrtRatioBX96, sqrtRatioAX96);\n\n return FullMath.mulDiv(uint256(liquidity) << FixedPoint96.RESOLUTION, sqrtRatioBX96 - sqrtRatioAX96, sqrtRatioBX96) / sqrtRatioAX96;\n }\n\n function getAmount1ForLiquidity(\n uint160 sqrtRatioAX96,\n uint160 sqrtRatioBX96,\n uint128 liquidity\n ) internal pure returns (uint256 amount1) {\n if (sqrtRatioAX96 > sqrtRatioBX96) (sqrtRatioAX96, sqrtRatioBX96) = (sqrtRatioBX96, sqrtRatioAX96);\n\n return FullMath.mulDiv(liquidity, sqrtRatioBX96 - sqrtRatioAX96, FixedPoint96.Q96);\n }\n\n function getAmountsForLiquidity(\n uint160 sqrtRatioX96,\n uint160 sqrtRatioAX96,\n uint160 sqrtRatioBX96,\n uint128 liquidity\n ) internal pure returns (uint256 amount0, uint256 amount1) {\n if (sqrtRatioAX96 > sqrtRatioBX96) (sqrtRatioAX96, sqrtRatioBX96) = (sqrtRatioBX96, sqrtRatioAX96);\n\n if (sqrtRatioX96 <= sqrtRatioAX96) {\n amount0 = getAmount0ForLiquidity(sqrtRatioAX96, sqrtRatioBX96, liquidity);\n } else if (sqrtRatioX96 < sqrtRatioBX96) {\n amount0 = getAmount0ForLiquidity(sqrtRatioX96, sqrtRatioBX96, liquidity);\n amount1 = getAmount1ForLiquidity(sqrtRatioAX96, sqrtRatioX96, liquidity);\n } else {\n amount1 = getAmount1ForLiquidity(sqrtRatioAX96, sqrtRatioBX96, liquidity);\n }\n }\n}\n" - }, - "solidity/contracts/libraries/PoolAddress.sol": { - "content": "// SPDX-License-Identifier: GPL-2.0-or-later\npragma solidity >=0.8.4 <0.9.0;\n\nlibrary PoolAddress {\n struct PoolKey {\n address token0;\n address token1;\n uint24 fee;\n }\n}\n" - }, - "solidity/contracts/libraries/FixedPoint96.sol": { - "content": "// SPDX-License-Identifier: GPL-2.0-or-later\npragma solidity >=0.8.4 <0.9.0;\n\nlibrary FixedPoint96 {\n // solhint-disable\n uint8 internal constant RESOLUTION = 96;\n uint256 internal constant Q96 = 0x1000000000000000000000000;\n}\n" - }, - "solidity/contracts/UniV3PairManager.sol": { - "content": "// SPDX-License-Identifier: MIT\n\n/*\n\nCoded for The Keep3r Network with ♥ by\n\n██████╗░███████╗███████╗██╗  ░██╗░░░░░░░██╗░█████╗░███╗░░██╗██████╗░███████╗██████╗░██╗░░░░░░█████╗░███╗░░██╗██████╗░\n██╔══██╗██╔════╝██╔════╝██║  ░██║░░██╗░░██║██╔══██╗████╗░██║██╔══██╗██╔════╝██╔══██╗██║░░░░░██╔══██╗████╗░██║██╔══██╗\n██║░░██║█████╗░░█████╗░░██║  ░╚██╗████╗██╔╝██║░░██║██╔██╗██║██║░░██║█████╗░░██████╔╝██║░░░░░███████║██╔██╗██║██║░░██║\n██║░░██║██╔══╝░░██╔══╝░░██║  ░░████╔═████║░██║░░██║██║╚████║██║░░██║██╔══╝░░██╔══██╗██║░░░░░██╔══██║██║╚████║██║░░██║\n██████╔╝███████╗██║░░░░░██║  ░░╚██╔╝░╚██╔╝░╚█████╔╝██║░╚███║██████╔╝███████╗██║░░██║███████╗██║░░██║██║░╚███║██████╔╝\n╚═════╝░╚══════╝╚═╝░░░░░╚═╝  ░░░╚═╝░░░╚═╝░░░╚════╝░╚═╝░░╚══╝╚═════╝░╚══════╝╚═╝░░╚═╝╚══════╝╚═╝░░╚═╝╚═╝░░╚══╝╚═════╝░\n\nhttps://defi.sucks\n\n*/\n\npragma solidity >=0.8.4 <0.9.0;\n\nimport '@openzeppelin/contracts/token/ERC20/ERC20.sol';\nimport '@uniswap/v3-core/contracts/interfaces/IUniswapV3Pool.sol';\n\nimport './libraries/LiquidityAmounts.sol';\nimport './libraries/PoolAddress.sol';\nimport './libraries/FixedPoint96.sol';\nimport './libraries/FullMath.sol';\nimport './libraries/TickMath.sol';\n\nimport '../interfaces/external/IWeth9.sol';\nimport '../interfaces/IUniV3PairManager.sol';\n\nimport './peripherals/Governable.sol';\n\ncontract UniV3PairManager is IUniV3PairManager, Governable {\n /// @inheritdoc IERC20Metadata\n string public override name;\n\n /// @inheritdoc IERC20Metadata\n string public override symbol;\n\n /// @inheritdoc IERC20\n uint256 public override totalSupply;\n\n /// @inheritdoc IPairManager\n address public immutable override factory;\n\n /// @inheritdoc IPairManager\n address public immutable override token0;\n\n /// @inheritdoc IPairManager\n address public immutable override token1;\n\n /// @inheritdoc IPairManager\n address public immutable override pool;\n\n /// @inheritdoc IUniV3PairManager\n uint24 public immutable override fee;\n\n /// @inheritdoc IUniV3PairManager\n uint160 public immutable override sqrtRatioAX96;\n\n /// @inheritdoc IUniV3PairManager\n uint160 public immutable override sqrtRatioBX96;\n\n /// @inheritdoc IUniV3PairManager\n int24 public immutable override tickLower;\n\n /// @inheritdoc IUniV3PairManager\n int24 public immutable override tickUpper;\n\n /// @inheritdoc IUniV3PairManager\n int24 public immutable override tickSpacing;\n\n /// @notice Uniswap's maximum tick\n /// @dev Due to tick spacing, pools with different fees may have differences between _MAX_TICK and tickUpper. Use tickUpper to find the max tick of the pool.\n int24 private constant _MAX_TICK = 887272;\n\n /// @inheritdoc IERC20Metadata\n //solhint-disable-next-line const-name-snakecase\n uint8 public constant override decimals = 18;\n\n /// @inheritdoc IERC20\n mapping(address => mapping(address => uint256)) public override allowance;\n\n /// @inheritdoc IERC20\n mapping(address => uint256) public override balanceOf;\n\n /// @notice Struct that contains token0, token1, and fee of the Uniswap pool\n PoolAddress.PoolKey private _poolKey;\n\n constructor(address _pool, address _governance) Governable(_governance) {\n uint24 _fee = IUniswapV3Pool(_pool).fee();\n address _token0 = IUniswapV3Pool(_pool).token0();\n address _token1 = IUniswapV3Pool(_pool).token1();\n int24 _tickSpacing = IUniswapV3Pool(_pool).tickSpacing();\n int24 _tickUpper = _MAX_TICK - (_MAX_TICK % _tickSpacing);\n int24 _tickLower = -_tickUpper;\n\n factory = msg.sender;\n pool = _pool;\n fee = _fee;\n tickSpacing = _tickSpacing;\n tickUpper = _tickUpper;\n tickLower = _tickLower;\n token0 = _token0;\n token1 = _token1;\n name = string(abi.encodePacked('Keep3rLP - ', ERC20(_token0).symbol(), '/', ERC20(_token1).symbol()));\n symbol = string(abi.encodePacked('kLP-', ERC20(_token0).symbol(), '/', ERC20(_token1).symbol()));\n\n sqrtRatioAX96 = TickMath.getSqrtRatioAtTick(_tickLower);\n sqrtRatioBX96 = TickMath.getSqrtRatioAtTick(_tickUpper);\n _poolKey = PoolAddress.PoolKey({token0: _token0, token1: _token1, fee: _fee});\n }\n\n // This low-level function should be called from a contract which performs important safety checks\n /// @inheritdoc IUniV3PairManager\n function mint(\n uint256 amount0Desired,\n uint256 amount1Desired,\n uint256 amount0Min,\n uint256 amount1Min,\n address to\n ) external override returns (uint128 liquidity) {\n (liquidity, , ) = _addLiquidity(amount0Desired, amount1Desired, amount0Min, amount1Min);\n _mint(to, liquidity);\n }\n\n /// @inheritdoc IUniV3PairManager\n function uniswapV3MintCallback(\n uint256 amount0Owed,\n uint256 amount1Owed,\n bytes calldata data\n ) external override {\n MintCallbackData memory decoded = abi.decode(data, (MintCallbackData));\n if (msg.sender != pool) revert OnlyPool();\n if (amount0Owed > 0) _pay(decoded._poolKey.token0, decoded.payer, pool, amount0Owed);\n if (amount1Owed > 0) _pay(decoded._poolKey.token1, decoded.payer, pool, amount1Owed);\n }\n\n /// @inheritdoc IUniV3PairManager\n function burn(\n uint128 liquidity,\n uint256 amount0Min,\n uint256 amount1Min,\n address to\n ) external override returns (uint256 amount0, uint256 amount1) {\n (amount0, amount1) = IUniswapV3Pool(pool).burn(tickLower, tickUpper, liquidity);\n\n if (amount0 < amount0Min || amount1 < amount1Min) revert ExcessiveSlippage();\n\n IUniswapV3Pool(pool).collect(to, tickLower, tickUpper, uint128(amount0), uint128(amount1));\n _burn(msg.sender, liquidity);\n }\n\n /// @inheritdoc IUniV3PairManager\n function collect() external override onlyGovernance returns (uint256 amount0, uint256 amount1) {\n (, , , uint128 tokensOwed0, uint128 tokensOwed1) = IUniswapV3Pool(pool).positions(\n keccak256(abi.encodePacked(address(this), tickLower, tickUpper))\n );\n (amount0, amount1) = IUniswapV3Pool(pool).collect(governance, tickLower, tickUpper, tokensOwed0, tokensOwed1);\n }\n\n /// @inheritdoc IUniV3PairManager\n function position()\n external\n view\n override\n returns (\n uint128 liquidity,\n uint256 feeGrowthInside0LastX128,\n uint256 feeGrowthInside1LastX128,\n uint128 tokensOwed0,\n uint128 tokensOwed1\n )\n {\n (liquidity, feeGrowthInside0LastX128, feeGrowthInside1LastX128, tokensOwed0, tokensOwed1) = IUniswapV3Pool(pool).positions(\n keccak256(abi.encodePacked(address(this), tickLower, tickUpper))\n );\n }\n\n /// @inheritdoc IERC20\n function approve(address spender, uint256 amount) external override returns (bool) {\n allowance[msg.sender][spender] = amount;\n\n emit Approval(msg.sender, spender, amount);\n return true;\n }\n\n /// @inheritdoc IERC20\n function transfer(address to, uint256 amount) external override returns (bool) {\n _transferTokens(msg.sender, to, amount);\n return true;\n }\n\n /// @inheritdoc IERC20\n function transferFrom(\n address from,\n address to,\n uint256 amount\n ) external override returns (bool) {\n address spender = msg.sender;\n uint256 spenderAllowance = allowance[from][spender];\n\n if (spender != from && spenderAllowance != type(uint256).max) {\n uint256 newAllowance = spenderAllowance - amount;\n allowance[from][spender] = newAllowance;\n\n emit Approval(from, spender, newAllowance);\n }\n\n _transferTokens(from, to, amount);\n return true;\n }\n\n /// @notice Adds liquidity to an initialized pool\n /// @dev Reverts if the returned amount0 is less than amount0Min or if amount1 is less than amount1Min\n /// @dev This function calls the mint function of the corresponding Uniswap pool, which in turn calls UniswapV3Callback\n /// @param amount0Desired The amount of token0 we would like to provide\n /// @param amount1Desired The amount of token1 we would like to provide\n /// @param amount0Min The minimum amount of token0 we want to provide\n /// @param amount1Min The minimum amount of token1 we want to provide\n /// @return liquidity The calculated liquidity we get for the token amounts we provided\n /// @return amount0 The amount of token0 we ended up providing\n /// @return amount1 The amount of token1 we ended up providing\n function _addLiquidity(\n uint256 amount0Desired,\n uint256 amount1Desired,\n uint256 amount0Min,\n uint256 amount1Min\n )\n internal\n returns (\n uint128 liquidity,\n uint256 amount0,\n uint256 amount1\n )\n {\n (uint160 sqrtPriceX96, , , , , , ) = IUniswapV3Pool(pool).slot0();\n\n liquidity = LiquidityAmounts.getLiquidityForAmounts(sqrtPriceX96, sqrtRatioAX96, sqrtRatioBX96, amount0Desired, amount1Desired);\n\n (amount0, amount1) = IUniswapV3Pool(pool).mint(\n address(this),\n tickLower,\n tickUpper,\n liquidity,\n abi.encode(MintCallbackData({_poolKey: _poolKey, payer: msg.sender}))\n );\n\n if (amount0 < amount0Min || amount1 < amount1Min) revert ExcessiveSlippage();\n }\n\n /// @notice Transfers the passed-in token from the payer to the recipient for the corresponding value\n /// @param token The token to be transferred to the recipient\n /// @param from The address of the payer\n /// @param to The address of the passed-in tokens recipient\n /// @param value How much of that token to be transferred from payer to the recipient\n function _pay(\n address token,\n address from,\n address to,\n uint256 value\n ) internal {\n _safeTransferFrom(token, from, to, value);\n }\n\n /// @notice Mints Keep3r credits to the passed-in address of recipient and increases total supply of Keep3r credits by the corresponding amount\n /// @param to The recipient of the Keep3r credits\n /// @param amount The amount Keep3r credits to be minted to the recipient\n function _mint(address to, uint256 amount) internal {\n totalSupply += amount;\n balanceOf[to] += amount;\n emit Transfer(address(0), to, amount);\n }\n\n /// @notice Burns Keep3r credits to the passed-in address of recipient and reduces total supply of Keep3r credits by the corresponding amount\n /// @param to The address that will get its Keep3r credits burned\n /// @param amount The amount Keep3r credits to be burned from the recipient/recipient\n function _burn(address to, uint256 amount) internal {\n totalSupply -= amount;\n balanceOf[to] -= amount;\n emit Transfer(to, address(0), amount);\n }\n\n /// @notice Transfers amount of Keep3r credits between two addresses\n /// @param from The user that transfers the Keep3r credits\n /// @param to The user that receives the Keep3r credits\n /// @param amount The amount of Keep3r credits to be transferred\n function _transferTokens(\n address from,\n address to,\n uint256 amount\n ) internal {\n balanceOf[from] -= amount;\n balanceOf[to] += amount;\n\n emit Transfer(from, to, amount);\n }\n\n /// @notice Transfers the passed-in token from the specified \"from\" to the specified \"to\" for the corresponding value\n /// @dev Reverts with IUniV3PairManager#UnsuccessfulTransfer if the transfer was not successful,\n /// or if the passed data length is different than 0 and the decoded data is not a boolean\n /// @param token The token to be transferred to the specified \"to\"\n /// @param from The address which is going to transfer the tokens\n /// @param value How much of that token to be transferred from \"from\" to \"to\"\n function _safeTransferFrom(\n address token,\n address from,\n address to,\n uint256 value\n ) internal {\n // solhint-disable-next-line avoid-low-level-calls\n (bool success, bytes memory data) = token.call(abi.encodeWithSelector(IERC20.transferFrom.selector, from, to, value));\n if (!success || (data.length != 0 && !abi.decode(data, (bool)))) revert UnsuccessfulTransfer();\n }\n}\n" - }, - "solidity/interfaces/external/IWeth9.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '@openzeppelin/contracts/token/ERC20/IERC20.sol';\n\ninterface IWeth9 is IERC20 {\n function deposit() external payable;\n\n function withdraw(uint256) external;\n}\n" - }, - "solidity/interfaces/IUniV3PairManager.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport './IPairManager.sol';\nimport '../contracts/libraries/PoolAddress.sol';\nimport '@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol';\nimport './peripherals/IGovernable.sol';\n\n/// @title Pair Manager contract\n/// @notice Creates a UniswapV3 position, and tokenizes in an ERC20 manner\n/// so that the user can use it as liquidity for a Keep3rJob\ninterface IUniV3PairManager is IGovernable, IPairManager {\n // Structs\n\n /// @notice The data to be decoded by the UniswapV3MintCallback function\n struct MintCallbackData {\n PoolAddress.PoolKey _poolKey; // Struct that contains token0, token1, and fee of the pool passed into the constructor\n address payer; // The address of the payer, which will be the msg.sender of the mint function\n }\n\n // Variables\n\n /// @notice The fee of the Uniswap pool passed into the constructor\n /// @return _fee The fee of the Uniswap pool passed into the constructor\n function fee() external view returns (uint24 _fee);\n\n /// @notice Highest tick in the Uniswap's curve\n /// @return _tickUpper The highest tick in the Uniswap's curve\n function tickUpper() external view returns (int24 _tickUpper);\n\n /// @notice Lowest tick in the Uniswap's curve\n /// @return _tickLower The lower tick in the Uniswap's curve\n function tickLower() external view returns (int24 _tickLower);\n\n /// @notice The pair tick spacing\n /// @return _tickSpacing The pair tick spacing\n function tickSpacing() external view returns (int24 _tickSpacing);\n\n /// @notice The sqrtRatioAX96 at the lowest tick (-887200) of the Uniswap pool\n /// @return _sqrtPriceA96 A Fixed point Q64.96 number representing the sqrt of the ratio of the two assets (token1/token0)\n /// at the lowest tick\n function sqrtRatioAX96() external view returns (uint160 _sqrtPriceA96);\n\n /// @notice The sqrtRatioBX96 at the highest tick (887200) of the Uniswap pool\n /// @return _sqrtPriceBX96 A Fixed point Q64.96 number representing the sqrt of the ratio of the two assets (token1/token0)\n /// at the highest tick\n function sqrtRatioBX96() external view returns (uint160 _sqrtPriceBX96);\n\n // Errors\n\n /// @notice Throws when the caller of the function is not the pool\n error OnlyPool();\n\n /// @notice Throws when the slippage exceeds what the user is comfortable with\n error ExcessiveSlippage();\n\n /// @notice Throws when a transfer is unsuccessful\n error UnsuccessfulTransfer();\n\n // Methods\n\n /// @notice This function is called after a user calls IUniV3PairManager#mint function\n /// It ensures that any tokens owed to the pool are paid by the msg.sender of IUniV3PairManager#mint function\n /// @param amount0Owed The amount of token0 due to the pool for the minted liquidity\n /// @param amount1Owed The amount of token1 due to the pool for the minted liquidity\n /// @param data The encoded token0, token1, fee (_poolKey) and the payer (msg.sender) of the IUniV3PairManager#mint function\n function uniswapV3MintCallback(\n uint256 amount0Owed,\n uint256 amount1Owed,\n bytes calldata data\n ) external;\n\n /// @notice Mints kLP tokens to an address according to the liquidity the msg.sender provides to the UniswapV3 pool\n /// @dev Triggers UniV3PairManager#uniswapV3MintCallback\n /// @param amount0Desired The amount of token0 we would like to provide\n /// @param amount1Desired The amount of token1 we would like to provide\n /// @param amount0Min The minimum amount of token0 we want to provide\n /// @param amount1Min The minimum amount of token1 we want to provide\n /// @param to The address to which the kLP tokens are going to be minted to\n /// @return liquidity kLP tokens sent in exchange for the provision of tokens\n function mint(\n uint256 amount0Desired,\n uint256 amount1Desired,\n uint256 amount0Min,\n uint256 amount1Min,\n address to\n ) external returns (uint128 liquidity);\n\n /// @notice Returns the pair manager's position in the corresponding UniswapV3 pool\n /// @return liquidity The amount of liquidity provided to the UniswapV3 pool by the pair manager\n /// @return feeGrowthInside0LastX128 The fee growth of token0 as of the last action on the individual position\n /// @return feeGrowthInside1LastX128 The fee growth of token1 as of the last action on the individual position\n /// @return tokensOwed0 The uncollected amount of token0 owed to the position as of the last computation\n /// @return tokensOwed1 The uncollected amount of token1 owed to the position as of the last computation\n function position()\n external\n view\n returns (\n uint128 liquidity,\n uint256 feeGrowthInside0LastX128,\n uint256 feeGrowthInside1LastX128,\n uint128 tokensOwed0,\n uint128 tokensOwed1\n );\n\n /// @notice Calls the UniswapV3 pool's collect function, which collects up to a maximum amount of fees\n // owed to a specific position to the recipient, in this case, that recipient is the pair manager\n /// @dev The collected fees will be sent to governance\n /// @return amount0 The amount of fees collected in token0\n /// @return amount1 The amount of fees collected in token1\n function collect() external returns (uint256 amount0, uint256 amount1);\n\n /// @notice Burns the corresponding amount of kLP tokens from the msg.sender and withdraws the specified liquidity\n // in the entire range\n /// @param liquidity The amount of liquidity to be burned\n /// @param amount0Min The minimum amount of token0 we want to send to the recipient (to)\n /// @param amount1Min The minimum amount of token1 we want to send to the recipient (to)\n /// @param to The address that will receive the due fees\n /// @return amount0 The calculated amount of token0 that will be sent to the recipient\n /// @return amount1 The calculated amount of token1 that will be sent to the recipient\n function burn(\n uint128 liquidity,\n uint256 amount0Min,\n uint256 amount1Min,\n address to\n ) external returns (uint256 amount0, uint256 amount1);\n}\n" - }, - "@openzeppelin/contracts/utils/Context.sol": { - "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Provides information about the current execution context, including the\n * sender of the transaction and its data. While these are generally available\n * via msg.sender and msg.data, they should not be accessed in such a direct\n * manner, since when dealing with meta-transactions the account sending and\n * paying for execution may not be the actual sender (as far as an application\n * is concerned).\n *\n * This contract is only required for intermediate, library-like contracts.\n */\nabstract contract Context {\n function _msgSender() internal view virtual returns (address) {\n return msg.sender;\n }\n\n function _msgData() internal view virtual returns (bytes calldata) {\n return msg.data;\n }\n}\n" - }, - "solidity/interfaces/IPairManagerFactory.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport './peripherals/IGovernable.sol';\n\n/// @title Factory of Pair Managers\n/// @notice This contract creates new pair managers\ninterface IPairManagerFactory is IGovernable {\n // Variables\n\n /// @notice Maps the address of a Uniswap pool, to the address of the corresponding PairManager\n /// For example, the uniswap address of DAI-WETH, will return the Keep3r/DAI-WETH pair manager address\n /// @param _pool The address of the Uniswap pool\n /// @return _pairManager The address of the corresponding pair manager\n function pairManagers(address _pool) external view returns (address _pairManager);\n\n // Events\n\n /// @notice Emitted when a new pair manager is created\n /// @param _pool The address of the corresponding Uniswap pool\n /// @param _pairManager The address of the just-created pair manager\n event PairCreated(address _pool, address _pairManager);\n\n // Errors\n\n /// @notice Throws an error if the pair manager is already initialized\n error AlreadyInitialized();\n\n /// @notice Throws an error if the caller is not the owner\n error OnlyOwner();\n\n // Methods\n\n /// @notice Creates a new pair manager based on the address of a Uniswap pool\n /// For example, the uniswap address of DAI-WETH, will create the Keep3r/DAI-WETH pool\n /// @param _pool The address of the Uniswap pool the pair manager will be based of\n /// @return _pairManager The address of the just-created pair manager\n function createPairManager(address _pool) external returns (address _pairManager);\n}\n" - }, - "solidity/contracts/UniV3PairManagerFactory.sol": { - "content": "// SPDX-License-Identifier: MIT\n\n/*\n\nCoded for The Keep3r Network with ♥ by\n\n██████╗░███████╗███████╗██╗  ░██╗░░░░░░░██╗░█████╗░███╗░░██╗██████╗░███████╗██████╗░██╗░░░░░░█████╗░███╗░░██╗██████╗░\n██╔══██╗██╔════╝██╔════╝██║  ░██║░░██╗░░██║██╔══██╗████╗░██║██╔══██╗██╔════╝██╔══██╗██║░░░░░██╔══██╗████╗░██║██╔══██╗\n██║░░██║█████╗░░█████╗░░██║  ░╚██╗████╗██╔╝██║░░██║██╔██╗██║██║░░██║█████╗░░██████╔╝██║░░░░░███████║██╔██╗██║██║░░██║\n██║░░██║██╔══╝░░██╔══╝░░██║  ░░████╔═████║░██║░░██║██║╚████║██║░░██║██╔══╝░░██╔══██╗██║░░░░░██╔══██║██║╚████║██║░░██║\n██████╔╝███████╗██║░░░░░██║  ░░╚██╔╝░╚██╔╝░╚█████╔╝██║░╚███║██████╔╝███████╗██║░░██║███████╗██║░░██║██║░╚███║██████╔╝\n╚═════╝░╚══════╝╚═╝░░░░░╚═╝  ░░░╚═╝░░░╚═╝░░░╚════╝░╚═╝░░╚══╝╚═════╝░╚══════╝╚═╝░░╚═╝╚══════╝╚═╝░░╚═╝╚═╝░░╚══╝╚═════╝░\n\nhttps://defi.sucks\n\n*/\n\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../interfaces/IPairManagerFactory.sol';\nimport './UniV3PairManager.sol';\nimport './peripherals/Governable.sol';\n\n/// @title Factory of Pair Managers\n/// @notice This contract creates new pair managers\ncontract UniV3PairManagerFactory is IPairManagerFactory, Governable {\n mapping(address => address) public override pairManagers;\n\n constructor(address _governance) Governable(_governance) {}\n\n ///@inheritdoc IPairManagerFactory\n function createPairManager(address _pool) external override returns (address _pairManager) {\n if (pairManagers[_pool] != address(0)) revert AlreadyInitialized();\n _pairManager = address(new UniV3PairManager(_pool, governance));\n pairManagers[_pool] = _pairManager;\n emit PairCreated(_pool, _pairManager);\n }\n}\n" - }, - "solidity/for-test/peripherals/GovernableForTest.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../../contracts/peripherals/Governable.sol';\n\ncontract GovernableForTest is Governable {\n constructor(address _governor) Governable(_governor) {}\n}\n" - }, - "solidity/for-test/BridgeForTest.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.0 <0.9.0;\n\nimport '@openzeppelin/contracts/token/ERC20/ERC20.sol';\nimport '@openzeppelin/contracts/token/ERC20/IERC20.sol';\n\ncontract BridgeForTest is ERC20 {\n address public immutable kp3r;\n\n constructor(address _kp3r) ERC20('Wrapped KP3R', 'wKP3R') {\n kp3r = _kp3r;\n }\n\n function bridge(uint256 _amount) external {\n IERC20(kp3r).transferFrom(msg.sender, address(this), _amount);\n _mint(msg.sender, _amount);\n }\n\n function bridgeBack(uint256 _amount) external {\n _burn(msg.sender, _amount);\n IERC20(kp3r).transfer(msg.sender, _amount);\n }\n}\n" - }, - "solidity/for-test/ERC20ForTest.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '@openzeppelin/contracts/token/ERC20/ERC20.sol';\n\ncontract ERC20ForTest is ERC20 {\n constructor(\n string memory _name,\n string memory _symbol,\n address _initialAccount,\n uint256 _initialBalance\n ) ERC20(_name, _symbol) {\n _mint(_initialAccount, _initialBalance);\n }\n\n function mint(uint256 _amount) public {\n _mint(msg.sender, _amount);\n }\n\n function mint(address _account, uint256 _amount) public {\n _mint(_account, _amount);\n }\n\n function burn(uint256 _amount) public {\n _burn(msg.sender, _amount);\n }\n\n function burn(address _account, uint256 _amount) public {\n _burn(_account, _amount);\n }\n\n function transferInternal(\n address _from,\n address _to,\n uint256 _value\n ) public {\n _transfer(_from, _to, _value);\n }\n\n function approveInternal(\n address _owner,\n address _spender,\n uint256 _value\n ) public {\n _approve(_owner, _spender, _value);\n }\n\n function deposit() external payable {\n // Function added for compatibility with WETH\n }\n}\n" - }, - "solidity/for-test/peripherals/keepers/Keep3rKeeperFundableForTest.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../../../contracts/peripherals/keepers/Keep3rKeeperFundable.sol';\n\ncontract Keep3rKeeperFundableForTest is Keep3rKeeperFundable {\n using EnumerableSet for EnumerableSet.AddressSet;\n\n constructor(\n address _kph,\n address _keep3rV1,\n address _keep3rV1Proxy\n ) Keep3rParameters(_kph, _keep3rV1, _keep3rV1Proxy) Keep3rRoles(msg.sender) {}\n\n function isKeeper(address _keeper) external view returns (bool) {\n return _keepers.contains(_keeper);\n }\n\n function setJob(address job) external {\n _jobs.add(job);\n }\n}\n" - }, - "solidity/contracts/sidechain/Keep3rEscrow.sol": { - "content": "// SPDX-License-Identifier: MIT\n\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../peripherals/Mintable.sol';\nimport '../peripherals/DustCollector.sol';\nimport '../../interfaces/sidechain/IKeep3rEscrow.sol';\nimport '@openzeppelin/contracts/token/ERC20/IERC20.sol';\nimport '@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol';\n\ncontract Keep3rEscrow is Mintable, DustCollector, IKeep3rEscrow {\n using SafeERC20 for IERC20;\n\n /// @inheritdoc IKeep3rEscrow\n address public override wKP3R;\n\n /// @param _governance Address of governance\n /// @param _wKP3R Address of wrapped KP3R implementation\n constructor(address _governance, address _wKP3R) Mintable(_governance) {\n wKP3R = _wKP3R;\n }\n\n /// @inheritdoc IKeep3rEscrow\n function deposit(uint256 _amount) external override {\n IERC20(wKP3R).safeTransferFrom(msg.sender, address(this), _amount);\n emit wKP3RDeposited(wKP3R, msg.sender, _amount);\n }\n\n /// @inheritdoc IKeep3rEscrow\n function mint(uint256 _amount) external override onlyMinter {\n IERC20(wKP3R).safeTransfer(msg.sender, _amount);\n emit wKP3RMinted(wKP3R, msg.sender, _amount);\n }\n\n /// @inheritdoc IKeep3rEscrow\n function setWKP3R(address _wKP3R) external override onlyGovernance {\n if (_wKP3R == address(0)) revert ZeroAddress();\n wKP3R = _wKP3R;\n emit wKP3RSet(wKP3R);\n }\n}\n" - }, - "solidity/contracts/peripherals/Mintable.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../../interfaces/peripherals/IMintable.sol';\nimport './Governable.sol';\n\nabstract contract Mintable is Governable, IMintable {\n /// @inheritdoc IMintable\n address public override minter;\n\n constructor(address _governance) Governable(_governance) {}\n\n /// @inheritdoc IMintable\n function setMinter(address _minter) external override onlyGovernance {\n if (_minter == address(0)) revert ZeroAddress();\n minter = _minter;\n emit MinterSet(_minter);\n }\n\n /// @notice Functions with this modifier can only be called by the minter;\n modifier onlyMinter() {\n if (msg.sender != minter) revert OnlyMinter();\n _;\n }\n}\n" - }, - "solidity/for-test/peripherals/DustCollectorForTest.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../../contracts/peripherals/DustCollector.sol';\n\ncontract DustCollectorForTest is DustCollector {\n constructor() DustCollector() Governable(msg.sender) {}\n}\n" - }, - "solidity/for-test/peripherals/Keep3rAccountanceForTest.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../../contracts/peripherals/Keep3rAccountance.sol';\n\ncontract Keep3rAccountanceForTest is Keep3rAccountance {\n using EnumerableSet for EnumerableSet.AddressSet;\n\n constructor() Keep3rRoles(msg.sender) {}\n\n function setJob(address job) external {\n _jobs.add(job);\n }\n\n function setKeeper(address keeper) external {\n _keepers.add(keeper);\n }\n}\n" - }, - "solidity/for-test/peripherals/jobs/Keep3rJobFundableLiquidityForTest.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../../../contracts/peripherals/jobs/Keep3rJobFundableLiquidity.sol';\n\ncontract Keep3rJobFundableLiquidityForTest is Keep3rJobFundableLiquidity {\n using EnumerableSet for EnumerableSet.AddressSet;\n\n constructor(\n address _kph,\n address _keep3rV1,\n address _keep3rV1Proxy\n ) Keep3rParameters(_kph, _keep3rV1, _keep3rV1Proxy) Keep3rRoles(msg.sender) {}\n\n function setJob(address _job) external {\n _jobs.add(_job);\n }\n\n function setJobLiquidity(address _job, address _liquidity) external returns (bool) {\n return _jobLiquidities[_job].add(_liquidity);\n }\n\n function setApprovedLiquidity(address _liquidity) external {\n _approvedLiquidities.add(_liquidity);\n }\n\n function setRevokedLiquidity(address _liquidity) external {\n _approvedLiquidities.remove(_liquidity);\n }\n\n function viewTickCache(address _liquidity) external view returns (TickCache memory _tickCache) {\n _tickCache = _tick[_liquidity];\n }\n\n function viewTickOrder(address _liquidity) external view returns (bool) {\n return _isKP3RToken0[_liquidity];\n }\n\n function internalJobLiquidities(address _job) external view returns (address[] memory _list) {\n _list = _jobLiquidities[_job].values();\n }\n\n function internalSettleJobAccountance(address _job) external {\n _settleJobAccountance(_job);\n }\n}\n" - }, - "solidity/for-test/peripherals/jobs/Keep3rJobDisputableForTest.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../../../contracts/peripherals/jobs/Keep3rJobDisputable.sol';\n\ncontract Keep3rJobDisputableForTest is Keep3rJobDisputable {\n using EnumerableSet for EnumerableSet.AddressSet;\n\n constructor(\n address _kph,\n address _keep3rV1,\n address _keep3rV1Proxy\n ) Keep3rParameters(_kph, _keep3rV1, _keep3rV1Proxy) Keep3rRoles(msg.sender) {}\n\n function setJobLiquidity(address _job, address _liquidity) external {\n _jobLiquidities[_job].add(_liquidity);\n }\n\n function setJobToken(address _job, address _token) external {\n _jobTokens[_job].add(_token);\n }\n\n function setApprovedLiquidity(address _liquidity) external {\n _approvedLiquidities.add(_liquidity);\n }\n\n function setRevokedLiquidity(address _liquidity) external {\n _approvedLiquidities.remove(_liquidity);\n }\n\n function internalJobLiquidityCredits(address _job) external view returns (uint256 _credits) {\n _credits = _jobLiquidityCredits[_job];\n }\n\n function internalJobPeriodCredits(address _job) external view returns (uint256 _credits) {\n _credits = _jobPeriodCredits[_job];\n }\n\n function internalJobTokens(address _job) external view returns (address[] memory _tokens) {\n _tokens = new address[](_jobTokens[_job].length());\n for (uint256 i; i < _jobTokens[_job].length(); i++) {\n _tokens[i] = _jobTokens[_job].at(i);\n }\n }\n\n function internalJobLiquidities(address _job) external view returns (address[] memory _tokens) {\n _tokens = new address[](_jobLiquidities[_job].length());\n for (uint256 i; i < _jobLiquidities[_job].length(); i++) {\n _tokens[i] = _jobLiquidities[_job].at(i);\n }\n }\n}\n" - }, - "solidity/for-test/peripherals/Keep3rDisputableForTest.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../../contracts/peripherals/Keep3rDisputable.sol';\n\ncontract Keep3rDisputableForTest is Keep3rDisputable {\n constructor() Keep3rParameters(address(0), address(0), address(0)) Keep3rRoles(msg.sender) {}\n}\n" - }, - "solidity/for-test/peripherals/keepers/Keep3rKeeperDisputableForTest.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../../../contracts/peripherals/keepers/Keep3rKeeperDisputable.sol';\n\ncontract Keep3rKeeperDisputableForTest is Keep3rKeeperDisputable {\n using EnumerableSet for EnumerableSet.AddressSet;\n\n constructor(\n address _kph,\n address _keep3rV1,\n address _keep3rV1Proxy\n ) Keep3rParameters(_kph, _keep3rV1, _keep3rV1Proxy) Keep3rRoles(msg.sender) {}\n\n function setKeeper(address _keeper) external {\n _keepers.add(_keeper);\n }\n\n function internalSlash(\n address _bonded,\n address _keeper,\n uint256 _bondAmount,\n uint256 _unbondAmount\n ) external {\n _slash(_bonded, _keeper, _bondAmount, _unbondAmount);\n }\n\n function isKeeper(address _address) external view returns (bool _isKeeper) {\n _isKeeper = _keepers.contains(_address);\n }\n}\n" - }, - "solidity/for-test/peripherals/jobs/Keep3rJobFundableCreditsForTest.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../../../contracts/peripherals/jobs/Keep3rJobFundableCredits.sol';\n\ncontract Keep3rJobFundableCreditsForTest is Keep3rJobFundableCredits {\n using EnumerableSet for EnumerableSet.AddressSet;\n\n constructor(\n address _kph,\n address _keep3rV1,\n address _keep3rV1Proxy\n ) Keep3rParameters(_kph, _keep3rV1, _keep3rV1Proxy) Keep3rRoles(msg.sender) {}\n\n function setJob(address _job, address _jobOwner) external {\n _jobs.add(_job);\n jobOwner[_job] = _jobOwner;\n }\n\n function setJobToken(address _job, address _token) external {\n _jobTokens[_job].add(_token);\n }\n\n function isJobToken(address _job, address _token) external view returns (bool _contains) {\n _contains = _jobTokens[_job].contains(_token);\n }\n}\n" - }, - "solidity/contracts/Keep3rHelper.sol": { - "content": "// SPDX-License-Identifier: MIT\n\n/*\n\nCoded for The Keep3r Network with ♥ by\n\n██████╗░███████╗███████╗██╗  ░██╗░░░░░░░██╗░█████╗░███╗░░██╗██████╗░███████╗██████╗░██╗░░░░░░█████╗░███╗░░██╗██████╗░\n██╔══██╗██╔════╝██╔════╝██║  ░██║░░██╗░░██║██╔══██╗████╗░██║██╔══██╗██╔════╝██╔══██╗██║░░░░░██╔══██╗████╗░██║██╔══██╗\n██║░░██║█████╗░░█████╗░░██║  ░╚██╗████╗██╔╝██║░░██║██╔██╗██║██║░░██║█████╗░░██████╔╝██║░░░░░███████║██╔██╗██║██║░░██║\n██║░░██║██╔══╝░░██╔══╝░░██║  ░░████╔═████║░██║░░██║██║╚████║██║░░██║██╔══╝░░██╔══██╗██║░░░░░██╔══██║██║╚████║██║░░██║\n██████╔╝███████╗██║░░░░░██║  ░░╚██╔╝░╚██╔╝░╚█████╔╝██║░╚███║██████╔╝███████╗██║░░██║███████╗██║░░██║██║░╚███║██████╔╝\n╚═════╝░╚══════╝╚═╝░░░░░╚═╝  ░░░╚═╝░░░╚═╝░░░╚════╝░╚═╝░░╚══╝╚═════╝░╚══════╝╚═╝░░╚═╝╚══════╝╚═╝░░╚═╝╚═╝░░╚══╝╚═════╝░\n\nhttps://defi.sucks\n\n*/\n\npragma solidity >=0.8.7 <0.9.0;\n\nimport './libraries/FullMath.sol';\nimport './libraries/TickMath.sol';\nimport '../interfaces/IKeep3r.sol';\nimport '../interfaces/IKeep3rHelper.sol';\nimport './Keep3rHelperParameters.sol';\n\nimport '@openzeppelin/contracts/utils/math/Math.sol';\nimport '@uniswap/v3-core/contracts/interfaces/IUniswapV3Pool.sol';\n\ncontract Keep3rHelper is IKeep3rHelper, Keep3rHelperParameters {\n constructor(\n address _kp3r,\n address _keep3rV2,\n address _governance,\n address _kp3rWethPool\n ) Keep3rHelperParameters(_kp3r, _keep3rV2, _governance, _kp3rWethPool) {}\n\n /// @inheritdoc IKeep3rHelper\n function quote(uint256 _eth) public view override returns (uint256 _amountOut) {\n uint32[] memory _secondsAgos = new uint32[](2);\n _secondsAgos[1] = quoteTwapTime;\n\n (int56[] memory _tickCumulatives, ) = IUniswapV3Pool(kp3rWethPool.poolAddress).observe(_secondsAgos);\n int56 _difference = _tickCumulatives[0] - _tickCumulatives[1];\n _amountOut = getQuoteAtTick(uint128(_eth), kp3rWethPool.isTKNToken0 ? _difference : -_difference, quoteTwapTime);\n }\n\n /// @inheritdoc IKeep3rHelper\n function bonds(address _keeper) public view virtual override returns (uint256 _amountBonded) {\n return IKeep3r(keep3rV2).bonds(_keeper, KP3R);\n }\n\n /// @inheritdoc IKeep3rHelper\n function getRewardAmountFor(address _keeper, uint256 _gasUsed) public view override returns (uint256 _kp3r) {\n uint256 _boost = getRewardBoostFor(bonds(_keeper));\n _kp3r = quote((_gasUsed * _boost) / BOOST_BASE);\n }\n\n /// @inheritdoc IKeep3rHelper\n function getRewardAmount(uint256 _gasUsed) external view override returns (uint256 _amount) {\n // solhint-disable-next-line avoid-tx-origin\n return getRewardAmountFor(tx.origin, _gasUsed);\n }\n\n /// @inheritdoc IKeep3rHelper\n function getRewardBoostFor(uint256 _bonds) public view override returns (uint256 _rewardBoost) {\n _bonds = Math.min(_bonds, targetBond);\n uint256 _cap = minBoost + ((maxBoost - minBoost) * _bonds) / targetBond;\n _rewardBoost = _cap * _getBasefee();\n }\n\n /// @inheritdoc IKeep3rHelper\n function getPoolTokens(address _pool) public view override returns (address _token0, address _token1) {\n return (IUniswapV3Pool(_pool).token0(), IUniswapV3Pool(_pool).token1());\n }\n\n /// @inheritdoc IKeep3rHelper\n function isKP3RToken0(address _pool) external view virtual override returns (bool _isKP3RToken0) {\n address _token0;\n address _token1;\n (_token0, _token1) = getPoolTokens(_pool);\n if (_token0 == KP3R) {\n return true;\n } else if (_token1 != KP3R) {\n revert LiquidityPairInvalid();\n }\n }\n\n /// @inheritdoc IKeep3rHelper\n function observe(address _pool, uint32[] memory _secondsAgo)\n external\n view\n override\n returns (\n int56 _tickCumulative1,\n int56 _tickCumulative2,\n bool _success\n )\n {\n try IUniswapV3Pool(_pool).observe(_secondsAgo) returns (int56[] memory _uniswapResponse, uint160[] memory) {\n _tickCumulative1 = _uniswapResponse[0];\n if (_uniswapResponse.length > 1) {\n _tickCumulative2 = _uniswapResponse[1];\n }\n _success = true;\n } catch (bytes memory) {}\n }\n\n /// @inheritdoc IKeep3rHelper\n function getPaymentParams(uint256 _bonds)\n external\n view\n override\n returns (\n uint256 _boost,\n uint256 _oneEthQuote,\n uint256 _extra\n )\n {\n _oneEthQuote = quote(1 ether);\n _boost = getRewardBoostFor(_bonds);\n _extra = workExtraGas;\n }\n\n /// @inheritdoc IKeep3rHelper\n function getKP3RsAtTick(\n uint256 _liquidityAmount,\n int56 _tickDifference,\n uint256 _timeInterval\n ) external pure override returns (uint256 _kp3rAmount) {\n uint160 sqrtRatioX96 = TickMath.getSqrtRatioAtTick(int24(_tickDifference / int256(_timeInterval)));\n _kp3rAmount = FullMath.mulDiv(1 << 96, _liquidityAmount, sqrtRatioX96);\n }\n\n /// @inheritdoc IKeep3rHelper\n function getQuoteAtTick(\n uint128 _baseAmount,\n int56 _tickDifference,\n uint256 _timeInterval\n ) public pure override returns (uint256 _quoteAmount) {\n uint160 sqrtRatioX96 = TickMath.getSqrtRatioAtTick(int24(_tickDifference / int256(_timeInterval)));\n\n if (sqrtRatioX96 <= type(uint128).max) {\n uint256 ratioX192 = uint256(sqrtRatioX96) * sqrtRatioX96;\n _quoteAmount = FullMath.mulDiv(1 << 192, _baseAmount, ratioX192);\n } else {\n uint256 ratioX128 = FullMath.mulDiv(sqrtRatioX96, sqrtRatioX96, 1 << 64);\n _quoteAmount = FullMath.mulDiv(1 << 128, _baseAmount, ratioX128);\n }\n }\n\n /// @notice Gets the gas basefee cost to calculate keeper rewards\n /// @dev Keepers are required to pay a priority fee to be included, this function recognizes a minimum priority fee\n /// @return _baseFee The block's basefee + a minimum priority fee, or a preset minimum gas fee\n function _getBasefee() internal view virtual returns (uint256 _baseFee) {\n return Math.max(minBaseFee, block.basefee + minPriorityFee);\n }\n}\n" - }, - "solidity/for-test/testnet/Keep3rHelperForTestnet.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../../contracts/Keep3rHelper.sol';\n\ncontract Keep3rHelperForTestnet is Keep3rHelper {\n constructor(\n address _kp3r,\n address _keep3rV2,\n address _governance,\n address _kp3rWethPool\n ) Keep3rHelper(_kp3r, _keep3rV2, _governance, _kp3rWethPool) {}\n\n function _getBasefee() internal view override returns (uint256) {\n return 1;\n }\n\n /// @dev Overrides oracle validation that uses KP3R and WETH addresses\n function _validateOraclePool(address _poolAddress, address) internal view virtual override returns (TokenOraclePool memory _oraclePool) {\n return TokenOraclePool(_poolAddress, true);\n }\n\n /// @dev Overrides token comparison with KP3R address\n function isKP3RToken0(address) public view virtual override returns (bool) {\n return true;\n }\n}\n" - }, - "solidity/for-test/Keep3rHelperForTest.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../contracts/Keep3rHelper.sol';\n\ncontract Keep3rHelperForTest is Keep3rHelper {\n uint256 public basefee;\n\n constructor(\n address _kp3r,\n address _keep3rV2,\n address _governance,\n address _kp3rWethPool\n ) Keep3rHelper(_kp3r, _keep3rV2, _governance, _kp3rWethPool) {}\n\n function _getBasefee() internal view override returns (uint256) {\n return basefee != 0 ? (basefee + minPriorityFee) : super._getBasefee();\n }\n\n function setBaseFee(uint256 _baseFee) external {\n basefee = _baseFee;\n }\n}\n" - }, - "solidity/contracts/sidechain/Keep3rHelperSidechain.sol": { - "content": "// SPDX-License-Identifier: MIT\n\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../Keep3rHelper.sol';\nimport '../../interfaces/sidechain/IKeep3rHelperSidechain.sol';\n\ncontract Keep3rHelperSidechain is IKeep3rHelperSidechain, Keep3rHelper {\n /// @inheritdoc IKeep3rHelperSidechain\n mapping(address => address) public override oracle;\n /// @inheritdoc IKeep3rHelperSidechain\n IKeep3rHelperParameters.TokenOraclePool public override wethUSDPool;\n\n /// @notice Ethereum mainnet WETH address used for quoting references\n address public immutable override WETH;\n\n /// @param _keep3rV2 Address of sidechain Keep3r implementation\n /// @param _governance Address of governance\n /// @param _kp3rWethOracle Address of oracle used for KP3R/WETH quote\n /// @param _wethUsdOracle Address of oracle used for WETH/USD quote\n /// @dev Oracle pools should use 18 decimals tokens\n constructor(\n address _keep3rV2,\n address _governance,\n address _kp3r,\n address _weth,\n address _kp3rWethOracle,\n address _wethUsdOracle\n ) Keep3rHelper(_kp3r, _keep3rV2, _governance, _kp3rWethOracle) {\n WETH = _weth;\n wethUSDPool = _validateOraclePool(_wethUsdOracle, _weth);\n _setQuoteTwapTime(1 days);\n }\n\n /// @inheritdoc IKeep3rHelper\n /// @notice Uses valid wKP3R address from Keep3rSidechain to query keeper bonds\n function bonds(address _keeper) public view override(Keep3rHelper, IKeep3rHelper) returns (uint256 _amountBonded) {\n address wKP3R = IKeep3r(keep3rV2).keep3rV1();\n return IKeep3r(keep3rV2).bonds(_keeper, wKP3R);\n }\n\n /// @inheritdoc IKeep3rHelperSidechain\n function setOracle(address _liquidity, address _oracle) external override onlyGovernance {\n if (_liquidity == address(0) || _oracle == address(0)) revert ZeroAddress();\n oracle[_liquidity] = _oracle;\n emit OracleSet(_liquidity, _oracle);\n }\n\n /// @inheritdoc IKeep3rHelperSidechain\n function quoteUsdToEth(uint256 _usd) public view virtual override returns (uint256 _amountOut) {\n uint32[] memory _secondsAgos = new uint32[](2);\n _secondsAgos[1] = quoteTwapTime;\n\n /// @dev Oracle is compatible with IUniswapV3Pool\n (int56[] memory _tickCumulatives, ) = IUniswapV3Pool(wethUSDPool.poolAddress).observe(_secondsAgos);\n int56 _difference = _tickCumulatives[0] - _tickCumulatives[1];\n _amountOut = getQuoteAtTick(uint128(_usd), wethUSDPool.isTKNToken0 ? _difference : -_difference, quoteTwapTime);\n }\n\n /// @inheritdoc IKeep3rHelperSidechain\n function setWethUsdPool(address _poolAddress) external override onlyGovernance {\n if (_poolAddress == address(0)) revert ZeroAddress();\n _setWethUsdPool(_poolAddress);\n }\n\n function _setWethUsdPool(address _poolAddress) internal {\n wethUSDPool = _validateOraclePool(_poolAddress, WETH);\n emit WethUSDPoolChange(wethUSDPool.poolAddress, wethUSDPool.isTKNToken0);\n }\n\n /// @dev Sidechain jobs are quoted by USD/gasUnit, baseFee is set to 1\n function _getBasefee() internal view virtual override returns (uint256 _baseFee) {\n return 1;\n }\n}\n" - }, - "solidity/for-test/testnet/Keep3rHelperSidechainForTestnet.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../../contracts/sidechain/Keep3rHelperSidechain.sol';\n\ncontract Keep3rHelperSidechainForTestnet is Keep3rHelperSidechain {\n constructor(\n address _keep3rV2,\n address _governance,\n address _kp3r,\n address _weth,\n address _kp3rWethOracle,\n address _wethUsdOracle\n ) Keep3rHelperSidechain(_keep3rV2, _governance, _kp3r, _weth, _kp3rWethOracle, _wethUsdOracle) {}\n\n /// @dev Overrides oracle validation that uses KP3R and WETH addresses\n function _validateOraclePool(address _poolAddress, address) internal view virtual override returns (TokenOraclePool memory _oraclePool) {\n return TokenOraclePool(_poolAddress, true);\n }\n\n /// @dev Overrides token comparison with KP3R address\n function isKP3RToken0(address) public view virtual override returns (bool) {\n return true;\n }\n\n function quoteUsdToEth(uint256 _usd) public view virtual override returns (uint256) {\n return _usd;\n }\n}\n" - }, - "solidity/for-test/peripherals/Keep3rParametersForTest.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../../contracts/peripherals/Keep3rParameters.sol';\n\ncontract Keep3rParametersForTest is Keep3rParameters {\n constructor(\n address _keep3rHelper,\n address _keep3rV1,\n address _keep3rV1Proxy\n ) Keep3rParameters(_keep3rHelper, _keep3rV1, _keep3rV1Proxy) Keep3rRoles(msg.sender) {}\n\n function viewLiquidityPool(address _pool) public view returns (address) {\n return _liquidityPool[_pool];\n }\n\n function viewIsKP3RToken0(address _pool) public view returns (bool) {\n return _isKP3RToken0[_pool];\n }\n}\n" - }, - "solidity/for-test/peripherals/jobs/Keep3rJobWorkableForTest.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../../../contracts/peripherals/jobs/Keep3rJobWorkable.sol';\n\ncontract Keep3rJobWorkableForTest is Keep3rJobWorkable {\n using EnumerableSet for EnumerableSet.AddressSet;\n\n constructor(\n address _keep3rHelper,\n address _keep3rV1,\n address _keep3rV1Proxy\n ) Keep3rParameters(_keep3rHelper, _keep3rV1, _keep3rV1Proxy) Keep3rRoles(msg.sender) {}\n\n function setJob(address _job) external {\n _jobs.add(_job);\n }\n\n function setKeeper(address _keeper) external {\n _keepers.add(_keeper);\n }\n\n function setApprovedLiquidity(address _liquidity) external {\n _approvedLiquidities.add(_liquidity);\n }\n\n function setJobLiquidity(address _job, address _liquidity) external {\n _jobLiquidities[_job].add(_liquidity);\n }\n\n function viewJobLiquidityCredits(address _job) external view returns (uint256) {\n return _jobLiquidityCredits[_job];\n }\n\n function viewJobPeriodCredits(address _job) external view returns (uint256) {\n return _jobPeriodCredits[_job];\n }\n\n function viewTickCache(address _liquidity) external view returns (TickCache memory _tickCache) {\n _tickCache = _tick[_liquidity];\n }\n\n function viewGas() external view returns (uint256) {\n return _initialGas;\n }\n\n receive() external payable {}\n}\n" - }, - "solidity/for-test/peripherals/jobs/Keep3rJobMigrationForTest.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../../../contracts/peripherals/jobs/Keep3rJobMigration.sol';\n\ncontract Keep3rJobMigrationForTest is Keep3rJobMigration {\n using EnumerableSet for EnumerableSet.AddressSet;\n\n mapping(address => uint256) public settleJobAccountanceCallCount;\n\n constructor(\n address _kph,\n address _keep3rV1,\n address _keep3rV1Proxy\n ) Keep3rParameters(_kph, _keep3rV1, _keep3rV1Proxy) Keep3rRoles(msg.sender) {}\n\n function setJobToken(address _job, address _token) external {\n _jobTokens[_job].add(_token);\n }\n\n function setJobLiquidity(address _job, address _liquidity) external {\n _jobLiquidities[_job].add(_liquidity);\n }\n\n function viewJobTokenListLength(address _job) external view returns (uint256) {\n return _jobTokens[_job].length();\n }\n\n function viewJobLiquidityList(address _job) external view returns (address[] memory _list) {\n _list = _jobLiquidities[_job].values();\n }\n\n function viewJobPeriodCredits(address _job) external view returns (uint256) {\n return _jobPeriodCredits[_job];\n }\n\n function viewJobLiquidityCredits(address _job) external view returns (uint256) {\n return _jobLiquidityCredits[_job];\n }\n\n function viewMigrationCreatedAt(address _fromJob, address _toJob) external view returns (uint256) {\n return _migrationCreatedAt[_fromJob][_toJob];\n }\n\n function isJob(address _job) external view returns (bool) {\n return _jobs.contains(_job);\n }\n\n function _settleJobAccountance(address _job) internal override {\n settleJobAccountanceCallCount[_job]++;\n }\n}\n" - }, - "solidity/for-test/peripherals/jobs/Keep3rJobManagerForTest.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../../../contracts/peripherals/jobs/Keep3rJobManager.sol';\n\ncontract Keep3rJobManagerForTest is Keep3rJobManager {\n using EnumerableSet for EnumerableSet.AddressSet;\n\n constructor(\n address _keep3rHelper,\n address _keep3rV1,\n address _keep3rV1Proxy\n ) Keep3rRoles(msg.sender) {}\n\n function isJob(address _job) external view returns (bool _isJob) {\n _isJob = _jobs.contains(_job);\n }\n}\n" - }, - "solidity/for-test/peripherals/jobs/Keep3rJobOwnershipForTest.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../../../contracts/peripherals/jobs/Keep3rJobOwnership.sol';\n\ncontract Keep3rJobOwnershipForTest is Keep3rJobOwnership {}\n" - }, - "solidity/for-test/libraries/LiquidityAmountsForTest.sol": { - "content": "// SPDX-License-Identifier: GPL-2.0-or-later\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../../contracts/libraries/FullMath.sol';\nimport '../../contracts/libraries/FixedPoint96.sol';\n\n/// @dev Made this library into a contract to be able to calculate liquidity more precisely for tests\n\n// solhint-disable\ncontract LiquidityAmountsForTest {\n function toUint128(uint256 x) private pure returns (uint128 y) {\n require((y = uint128(x)) == x);\n }\n\n function getLiquidityForAmount0(\n uint160 sqrtRatioAX96,\n uint160 sqrtRatioBX96,\n uint256 amount0\n ) public pure returns (uint128 liquidity) {\n if (sqrtRatioAX96 > sqrtRatioBX96) (sqrtRatioAX96, sqrtRatioBX96) = (sqrtRatioBX96, sqrtRatioAX96);\n uint256 intermediate = FullMath.mulDiv(sqrtRatioAX96, sqrtRatioBX96, FixedPoint96.Q96);\n return toUint128(FullMath.mulDiv(amount0, intermediate, sqrtRatioBX96 - sqrtRatioAX96));\n }\n\n function getLiquidityForAmount1(\n uint160 sqrtRatioAX96,\n uint160 sqrtRatioBX96,\n uint256 amount1\n ) public pure returns (uint128 liquidity) {\n if (sqrtRatioAX96 > sqrtRatioBX96) (sqrtRatioAX96, sqrtRatioBX96) = (sqrtRatioBX96, sqrtRatioAX96);\n return toUint128(FullMath.mulDiv(amount1, FixedPoint96.Q96, sqrtRatioBX96 - sqrtRatioAX96));\n }\n\n function getLiquidityForAmounts(\n uint160 sqrtRatioX96,\n uint160 sqrtRatioAX96,\n uint160 sqrtRatioBX96,\n uint256 amount0,\n uint256 amount1\n ) external pure returns (uint128 liquidity) {\n if (sqrtRatioAX96 > sqrtRatioBX96) (sqrtRatioAX96, sqrtRatioBX96) = (sqrtRatioBX96, sqrtRatioAX96);\n\n if (sqrtRatioX96 <= sqrtRatioAX96) {\n liquidity = getLiquidityForAmount0(sqrtRatioAX96, sqrtRatioBX96, amount0);\n } else if (sqrtRatioX96 < sqrtRatioBX96) {\n uint128 liquidity0 = getLiquidityForAmount0(sqrtRatioX96, sqrtRatioBX96, amount0);\n uint128 liquidity1 = getLiquidityForAmount1(sqrtRatioAX96, sqrtRatioX96, amount1);\n\n liquidity = liquidity0 < liquidity1 ? liquidity0 : liquidity1;\n } else {\n liquidity = getLiquidityForAmount1(sqrtRatioAX96, sqrtRatioBX96, amount1);\n }\n }\n\n function getAmount0ForLiquidity(\n uint160 sqrtRatioAX96,\n uint160 sqrtRatioBX96,\n uint128 liquidity\n ) public pure returns (uint256 amount0) {\n if (sqrtRatioAX96 > sqrtRatioBX96) (sqrtRatioAX96, sqrtRatioBX96) = (sqrtRatioBX96, sqrtRatioAX96);\n\n return FullMath.mulDiv(uint256(liquidity) << FixedPoint96.RESOLUTION, sqrtRatioBX96 - sqrtRatioAX96, sqrtRatioBX96) / sqrtRatioAX96;\n }\n\n function getAmount1ForLiquidity(\n uint160 sqrtRatioAX96,\n uint160 sqrtRatioBX96,\n uint128 liquidity\n ) public pure returns (uint256 amount1) {\n if (sqrtRatioAX96 > sqrtRatioBX96) (sqrtRatioAX96, sqrtRatioBX96) = (sqrtRatioBX96, sqrtRatioAX96);\n\n return FullMath.mulDiv(liquidity, sqrtRatioBX96 - sqrtRatioAX96, FixedPoint96.Q96);\n }\n\n function getAmountsForLiquidity(\n uint160 sqrtRatioX96,\n uint160 sqrtRatioAX96,\n uint160 sqrtRatioBX96,\n uint128 liquidity\n ) external pure returns (uint256 amount0, uint256 amount1) {\n if (sqrtRatioAX96 > sqrtRatioBX96) (sqrtRatioAX96, sqrtRatioBX96) = (sqrtRatioBX96, sqrtRatioAX96);\n\n if (sqrtRatioX96 <= sqrtRatioAX96) {\n amount0 = getAmount0ForLiquidity(sqrtRatioAX96, sqrtRatioBX96, liquidity);\n } else if (sqrtRatioX96 < sqrtRatioBX96) {\n amount0 = getAmount0ForLiquidity(sqrtRatioX96, sqrtRatioBX96, liquidity);\n amount1 = getAmount1ForLiquidity(sqrtRatioAX96, sqrtRatioX96, liquidity);\n } else {\n amount1 = getAmount1ForLiquidity(sqrtRatioAX96, sqrtRatioBX96, liquidity);\n }\n }\n}\n" - }, - "solidity/for-test/IUniswapV3PoolForTest.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '@uniswap/v3-core/contracts/interfaces/IERC20Minimal.sol';\nimport '@uniswap/v3-core/contracts/interfaces/IUniswapV3Pool.sol';\n\n// solhint-disable-next-line no-empty-blocks\ninterface IUniswapV3PoolForTest is IERC20Minimal, IUniswapV3Pool {\n\n}\n" - }, - "@uniswap/v3-core/contracts/interfaces/IERC20Minimal.sol": { - "content": "// SPDX-License-Identifier: GPL-2.0-or-later\npragma solidity >=0.5.0;\n\n/// @title Minimal ERC20 interface for Uniswap\n/// @notice Contains a subset of the full ERC20 interface that is used in Uniswap V3\ninterface IERC20Minimal {\n /// @notice Returns the balance of a token\n /// @param account The account for which to look up the number of tokens it has, i.e. its balance\n /// @return The number of tokens held by the account\n function balanceOf(address account) external view returns (uint256);\n\n /// @notice Transfers the amount of token from the `msg.sender` to the recipient\n /// @param recipient The account that will receive the amount transferred\n /// @param amount The number of tokens to send from the sender to the recipient\n /// @return Returns true for a successful transfer, false for an unsuccessful transfer\n function transfer(address recipient, uint256 amount) external returns (bool);\n\n /// @notice Returns the current allowance given to a spender by an owner\n /// @param owner The account of the token owner\n /// @param spender The account of the token spender\n /// @return The current allowance granted by `owner` to `spender`\n function allowance(address owner, address spender) external view returns (uint256);\n\n /// @notice Sets the allowance of a spender from the `msg.sender` to the value `amount`\n /// @param spender The account which will be allowed to spend a given amount of the owners tokens\n /// @param amount The amount of tokens allowed to be used by `spender`\n /// @return Returns true for a successful approval, false for unsuccessful\n function approve(address spender, uint256 amount) external returns (bool);\n\n /// @notice Transfers `amount` tokens from `sender` to `recipient` up to the allowance given to the `msg.sender`\n /// @param sender The account from which the transfer will be initiated\n /// @param recipient The recipient of the transfer\n /// @param amount The amount of the transfer\n /// @return Returns true for a successful transfer, false for unsuccessful\n function transferFrom(\n address sender,\n address recipient,\n uint256 amount\n ) external returns (bool);\n\n /// @notice Event emitted when tokens are transferred from one address to another, either via `#transfer` or `#transferFrom`.\n /// @param from The account from which the tokens were sent, i.e. the balance decreased\n /// @param to The account to which the tokens were sent, i.e. the balance increased\n /// @param value The amount of tokens that were transferred\n event Transfer(address indexed from, address indexed to, uint256 value);\n\n /// @notice Event emitted when the approval amount for the spender of a given owner's tokens changes.\n /// @param owner The account that approved spending of its tokens\n /// @param spender The account for which the spending allowance was modified\n /// @param value The new allowance from the owner to the spender\n event Approval(address indexed owner, address indexed spender, uint256 value);\n}\n" - } - }, - "settings": { - "optimizer": { - "enabled": true, - "runs": 33 - }, - "outputSelection": { - "*": { - "*": [ - "storageLayout", - "abi", - "evm.bytecode", - "evm.deployedBytecode", - "evm.methodIdentifiers", - "metadata", - "devdoc", - "userdoc", - "evm.gasEstimates" - ], - "": [ - "ast" - ] - } - }, - "metadata": { - "useLiteralContent": true - }, - "libraries": { - "": { - "__CACHE_BREAKER__": "0x00000000d41867734bbee4c6863d9255b2b06ac1" - } - } - } -} \ No newline at end of file diff --git a/deployments/optimisticGoerli/solcInputs/f7e3e740337524d02345ab2e7585c15c.json b/deployments/optimisticGoerli/solcInputs/f7e3e740337524d02345ab2e7585c15c.json deleted file mode 100644 index e7e246e..0000000 --- a/deployments/optimisticGoerli/solcInputs/f7e3e740337524d02345ab2e7585c15c.json +++ /dev/null @@ -1,334 +0,0 @@ -{ - "language": "Solidity", - "sources": { - "solidity/contracts/Keep3r.sol": { - "content": "// SPDX-License-Identifier: MIT\n\n/*\n\nCoded for The Keep3r Network with ♥ by\n\n██████╗░███████╗███████╗██╗░░░██╗░░░░░░░██╗░█████╗░███╗░░██╗██████╗░███████╗██████╗░██╗░░░░░░█████╗░███╗░░██╗██████╗░\n██╔══██╗██╔════╝██╔════╝██║░░░██║░░██╗░░██║██╔══██╗████╗░██║██╔══██╗██╔════╝██╔══██╗██║░░░░░██╔══██╗████╗░██║██╔══██╗\n██║░░██║█████╗░░█████╗░░██║░░░╚██╗████╗██╔╝██║░░██║██╔██╗██║██║░░██║█████╗░░██████╔╝██║░░░░░███████║██╔██╗██║██║░░██║\n██║░░██║██╔══╝░░██╔══╝░░██║░░░░████╔═████║░██║░░██║██║╚████║██║░░██║██╔══╝░░██╔══██╗██║░░░░░██╔══██║██║╚████║██║░░██║\n██████╔╝███████╗██║░░░░░██║░░░░╚██╔╝░╚██╔╝░╚█████╔╝██║░╚███║██████╔╝███████╗██║░░██║███████╗██║░░██║██║░╚███║██████╔╝\n╚═════╝░╚══════╝╚═╝░░░░░╚═╝░░░░░╚═╝░░░╚═╝░░░╚════╝░╚═╝░░╚══╝╚═════╝░╚══════╝╚═╝░░╚═╝╚══════╝╚═╝░░╚═╝╚═╝░░╚══╝╚═════╝░\n\nhttps://defi.sucks\n\n*/\n\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../interfaces/IKeep3r.sol';\nimport './peripherals/jobs/Keep3rJobs.sol';\nimport './peripherals/keepers/Keep3rKeepers.sol';\nimport './peripherals/DustCollector.sol';\n\ncontract Keep3r is IKeep3r, Keep3rJobs, Keep3rKeepers {\n constructor(\n address _governance,\n address _keep3rHelper,\n address _keep3rV1,\n address _keep3rV1Proxy\n ) Keep3rParameters(_keep3rHelper, _keep3rV1, _keep3rV1Proxy) Keep3rRoles(_governance) {}\n}\n" - }, - "solidity/interfaces/IKeep3r.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport './peripherals/IKeep3rJobs.sol';\nimport './peripherals/IKeep3rKeepers.sol';\nimport './peripherals/IKeep3rParameters.sol';\n\n// solhint-disable-next-line no-empty-blocks\n\n/// @title Keep3rV2 contract\n/// @notice This contract inherits all the functionality of Keep3rV2\ninterface IKeep3r is IKeep3rJobs, IKeep3rKeepers, IKeep3rParameters {\n\n}\n" - }, - "solidity/contracts/peripherals/jobs/Keep3rJobs.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../../../interfaces/peripherals/IKeep3rJobs.sol';\nimport './Keep3rJobManager.sol';\nimport './Keep3rJobWorkable.sol';\nimport './Keep3rJobDisputable.sol';\n\nabstract contract Keep3rJobs is IKeep3rJobs, Keep3rJobManager, Keep3rJobWorkable, Keep3rJobDisputable {}\n" - }, - "solidity/contracts/peripherals/keepers/Keep3rKeepers.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../../../interfaces/peripherals/IKeep3rKeepers.sol';\nimport './Keep3rKeeperDisputable.sol';\n\nabstract contract Keep3rKeepers is IKeep3rKeepers, Keep3rKeeperDisputable {}\n" - }, - "solidity/contracts/peripherals/DustCollector.sol": { - "content": "// SPDX-License-Identifier: MIT\n\npragma solidity >=0.8.4 <0.9.0;\n\nimport '@openzeppelin/contracts/token/ERC20/IERC20.sol';\nimport '@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol';\nimport '../../contracts/peripherals/Governable.sol';\nimport '../../interfaces/peripherals/IDustCollector.sol';\n\nabstract contract DustCollector is IDustCollector, Governable {\n using SafeERC20 for IERC20;\n\n address internal constant _ETH_ADDRESS = 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE;\n\n function sendDust(\n address _token,\n uint256 _amount,\n address _to\n ) external override onlyGovernance {\n if (_to == address(0)) revert ZeroAddress();\n if (_token == _ETH_ADDRESS) {\n payable(_to).transfer(_amount);\n } else {\n IERC20(_token).safeTransfer(_to, _amount);\n }\n emit DustSent(_token, _amount, _to);\n }\n}\n" - }, - "solidity/interfaces/peripherals/IKeep3rJobs.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport './IKeep3rDisputable.sol';\n\n/// @title Keep3rJobOwnership contract\n/// @notice Handles the ownership of the jobs\ninterface IKeep3rJobOwnership {\n // Events\n\n /// @notice Emitted when Keep3rJobOwnership#changeJobOwnership is called\n /// @param _job The address of the job proposed to have a change of owner\n /// @param _owner The current owner of the job\n /// @param _pendingOwner The new address proposed to be the owner of the job\n event JobOwnershipChange(address indexed _job, address indexed _owner, address indexed _pendingOwner);\n\n /// @notice Emitted when Keep3rJobOwnership#JobOwnershipAssent is called\n /// @param _job The address of the job which the proposed owner will now own\n /// @param _previousOwner The previous owner of the job\n /// @param _newOwner The new owner of the job\n event JobOwnershipAssent(address indexed _job, address indexed _previousOwner, address indexed _newOwner);\n\n // Errors\n\n /// @notice Throws when the caller of the function is not the job owner\n error OnlyJobOwner();\n\n /// @notice Throws when the caller of the function is not the pending job owner\n error OnlyPendingJobOwner();\n\n // Variables\n\n /// @notice Maps the job to the owner of the job\n /// @param _job The address of the job\n /// @return _owner The address of the owner of the job\n function jobOwner(address _job) external view returns (address _owner);\n\n /// @notice Maps the job to its pending owner\n /// @param _job The address of the job\n /// @return _pendingOwner The address of the pending owner of the job\n function jobPendingOwner(address _job) external view returns (address _pendingOwner);\n\n // Methods\n\n /// @notice Proposes a new address to be the owner of the job\n /// @param _job The address of the job\n /// @param _newOwner The address of the proposed new owner\n function changeJobOwnership(address _job, address _newOwner) external;\n\n /// @notice The proposed address accepts to be the owner of the job\n /// @param _job The address of the job\n function acceptJobOwnership(address _job) external;\n}\n\n/// @title Keep3rJobManager contract\n/// @notice Handles the addition and withdrawal of credits from a job\ninterface IKeep3rJobManager is IKeep3rJobOwnership {\n // Events\n\n /// @notice Emitted when Keep3rJobManager#addJob is called\n /// @param _job The address of the job to add\n /// @param _jobOwner The job's owner\n event JobAddition(address indexed _job, address indexed _jobOwner);\n\n // Errors\n\n /// @notice Throws when trying to add a job that has already been added\n error JobAlreadyAdded();\n\n /// @notice Throws when the address that is trying to register as a keeper is already a keeper\n error AlreadyAKeeper();\n\n // Methods\n\n /// @notice Allows any caller to add a new job\n /// @param _job Address of the contract for which work should be performed\n function addJob(address _job) external;\n}\n\n/// @title Keep3rJobFundableCredits contract\n/// @notice Handles the addition and withdrawal of credits from a job\ninterface IKeep3rJobFundableCredits is IKeep3rJobOwnership {\n // Events\n\n /// @notice Emitted when Keep3rJobFundableCredits#addTokenCreditsToJob is called\n /// @param _job The address of the job being credited\n /// @param _token The address of the token being provided\n /// @param _provider The user that calls the function\n /// @param _amount The amount of credit being added to the job\n event TokenCreditAddition(address indexed _job, address indexed _token, address indexed _provider, uint256 _amount);\n\n /// @notice Emitted when Keep3rJobFundableCredits#withdrawTokenCreditsFromJob is called\n /// @param _job The address of the job from which the credits are withdrawn\n /// @param _token The credit being withdrawn from the job\n /// @param _receiver The user that receives the tokens\n /// @param _amount The amount of credit withdrawn\n event TokenCreditWithdrawal(address indexed _job, address indexed _token, address indexed _receiver, uint256 _amount);\n\n // Errors\n\n /// @notice Throws when the token is KP3R, as it should not be used for direct token payments\n error TokenUnallowed();\n\n /// @notice Throws when the token withdraw cooldown has not yet passed\n error JobTokenCreditsLocked();\n\n /// @notice Throws when the user tries to withdraw more tokens than it has\n error InsufficientJobTokenCredits();\n\n // Variables\n\n /// @notice Last block where tokens were added to the job\n /// @param _job The address of the job credited\n /// @param _token The address of the token credited\n /// @return _timestamp The last block where tokens were added to the job\n function jobTokenCreditsAddedAt(address _job, address _token) external view returns (uint256 _timestamp);\n\n // Methods\n\n /// @notice Add credit to a job to be paid out for work\n /// @param _job The address of the job being credited\n /// @param _token The address of the token being credited\n /// @param _amount The amount of credit being added\n function addTokenCreditsToJob(\n address _job,\n address _token,\n uint256 _amount\n ) external;\n\n /// @notice Withdraw credit from a job\n /// @param _job The address of the job from which the credits are withdrawn\n /// @param _token The address of the token being withdrawn\n /// @param _amount The amount of token to be withdrawn\n /// @param _receiver The user that will receive tokens\n function withdrawTokenCreditsFromJob(\n address _job,\n address _token,\n uint256 _amount,\n address _receiver\n ) external;\n}\n\n/// @title Keep3rJobFundableLiquidity contract\n/// @notice Handles the funding of jobs through specific liquidity pairs\ninterface IKeep3rJobFundableLiquidity is IKeep3rJobOwnership {\n // Events\n\n /// @notice Emitted when Keep3rJobFundableLiquidity#approveLiquidity function is called\n /// @param _liquidity The address of the liquidity pair being approved\n event LiquidityApproval(address _liquidity);\n\n /// @notice Emitted when Keep3rJobFundableLiquidity#revokeLiquidity function is called\n /// @param _liquidity The address of the liquidity pair being revoked\n event LiquidityRevocation(address _liquidity);\n\n /// @notice Emitted when IKeep3rJobFundableLiquidity#addLiquidityToJob function is called\n /// @param _job The address of the job to which liquidity will be added\n /// @param _liquidity The address of the liquidity being added\n /// @param _provider The user that calls the function\n /// @param _amount The amount of liquidity being added\n event LiquidityAddition(address indexed _job, address indexed _liquidity, address indexed _provider, uint256 _amount);\n\n /// @notice Emitted when IKeep3rJobFundableLiquidity#withdrawLiquidityFromJob function is called\n /// @param _job The address of the job of which liquidity will be withdrawn from\n /// @param _liquidity The address of the liquidity being withdrawn\n /// @param _receiver The receiver of the liquidity tokens\n /// @param _amount The amount of liquidity being withdrawn from the job\n event LiquidityWithdrawal(address indexed _job, address indexed _liquidity, address indexed _receiver, uint256 _amount);\n\n /// @notice Emitted when Keep3rJobFundableLiquidity#addLiquidityToJob function is called\n /// @param _job The address of the job whose credits will be updated\n /// @param _rewardedAt The time at which the job was last rewarded\n /// @param _currentCredits The current credits of the job\n /// @param _periodCredits The credits of the job for the current period\n event LiquidityCreditsReward(address indexed _job, uint256 _rewardedAt, uint256 _currentCredits, uint256 _periodCredits);\n\n /// @notice Emitted when Keep3rJobFundableLiquidity#forceLiquidityCreditsToJob function is called\n /// @param _job The address of the job whose credits will be updated\n /// @param _rewardedAt The time at which the job was last rewarded\n /// @param _currentCredits The current credits of the job\n event LiquidityCreditsForced(address indexed _job, uint256 _rewardedAt, uint256 _currentCredits);\n\n // Errors\n\n /// @notice Throws when the liquidity being approved has already been approved\n error LiquidityPairApproved();\n\n /// @notice Throws when the liquidity being removed has not been approved\n error LiquidityPairUnexistent();\n\n /// @notice Throws when trying to add liquidity to an unapproved pool\n error LiquidityPairUnapproved();\n\n /// @notice Throws when the job doesn't have the requested liquidity\n error JobLiquidityUnexistent();\n\n /// @notice Throws when trying to remove more liquidity than the job has\n error JobLiquidityInsufficient();\n\n /// @notice Throws when trying to add less liquidity than the minimum liquidity required\n error JobLiquidityLessThanMin();\n\n // Structs\n\n /// @notice Stores the tick information of the different liquidity pairs\n struct TickCache {\n int56 current; // Tracks the current tick\n int56 difference; // Stores the difference between the current tick and the last tick\n uint256 period; // Stores the period at which the last observation was made\n }\n\n // Variables\n\n /// @notice Lists liquidity pairs\n /// @return _list An array of addresses with all the approved liquidity pairs\n function approvedLiquidities() external view returns (address[] memory _list);\n\n /// @notice Amount of liquidity in a specified job\n /// @param _job The address of the job being checked\n /// @param _liquidity The address of the liquidity we are checking\n /// @return _amount Amount of liquidity in the specified job\n function liquidityAmount(address _job, address _liquidity) external view returns (uint256 _amount);\n\n /// @notice Last time the job was rewarded liquidity credits\n /// @param _job The address of the job being checked\n /// @return _timestamp Timestamp of the last time the job was rewarded liquidity credits\n function rewardedAt(address _job) external view returns (uint256 _timestamp);\n\n /// @notice Last time the job was worked\n /// @param _job The address of the job being checked\n /// @return _timestamp Timestamp of the last time the job was worked\n function workedAt(address _job) external view returns (uint256 _timestamp);\n\n // Methods\n\n /// @notice Returns the liquidity credits of a given job\n /// @param _job The address of the job of which we want to know the liquidity credits\n /// @return _amount The liquidity credits of a given job\n function jobLiquidityCredits(address _job) external view returns (uint256 _amount);\n\n /// @notice Returns the credits of a given job for the current period\n /// @param _job The address of the job of which we want to know the period credits\n /// @return _amount The credits the given job has at the current period\n function jobPeriodCredits(address _job) external view returns (uint256 _amount);\n\n /// @notice Calculates the total credits of a given job\n /// @param _job The address of the job of which we want to know the total credits\n /// @return _amount The total credits of the given job\n function totalJobCredits(address _job) external view returns (uint256 _amount);\n\n /// @notice Calculates how many credits should be rewarded periodically for a given liquidity amount\n /// @dev _periodCredits = underlying KP3Rs for given liquidity amount * rewardPeriod / inflationPeriod\n /// @param _liquidity The address of the liquidity to provide\n /// @param _amount The amount of liquidity to provide\n /// @return _periodCredits The amount of KP3R periodically minted for the given liquidity\n function quoteLiquidity(address _liquidity, uint256 _amount) external view returns (uint256 _periodCredits);\n\n /// @notice Observes the current state of the liquidity pair being observed and updates TickCache with the information\n /// @param _liquidity The address of the liquidity pair being observed\n /// @return _tickCache The updated TickCache\n function observeLiquidity(address _liquidity) external view returns (TickCache memory _tickCache);\n\n /// @notice Gifts liquidity credits to the specified job\n /// @param _job The address of the job being credited\n /// @param _amount The amount of liquidity credits to gift\n function forceLiquidityCreditsToJob(address _job, uint256 _amount) external;\n\n /// @notice Approve a liquidity pair for being accepted in future\n /// @param _liquidity The address of the liquidity accepted\n function approveLiquidity(address _liquidity) external;\n\n /// @notice Revoke a liquidity pair from being accepted in future\n /// @param _liquidity The liquidity no longer accepted\n function revokeLiquidity(address _liquidity) external;\n\n /// @notice Allows anyone to fund a job with liquidity\n /// @param _job The address of the job to assign liquidity to\n /// @param _liquidity The liquidity being added\n /// @param _amount The amount of liquidity tokens to add\n function addLiquidityToJob(\n address _job,\n address _liquidity,\n uint256 _amount\n ) external;\n\n /// @notice Unbond liquidity for a job\n /// @dev Can only be called by the job's owner\n /// @param _job The address of the job being unbonded from\n /// @param _liquidity The liquidity being unbonded\n /// @param _amount The amount of liquidity being removed\n function unbondLiquidityFromJob(\n address _job,\n address _liquidity,\n uint256 _amount\n ) external;\n\n /// @notice Withdraw liquidity from a job\n /// @param _job The address of the job being withdrawn from\n /// @param _liquidity The liquidity being withdrawn\n /// @param _receiver The address that will receive the withdrawn liquidity\n function withdrawLiquidityFromJob(\n address _job,\n address _liquidity,\n address _receiver\n ) external;\n}\n\n/// @title Keep3rJobMigration contract\n/// @notice Handles the migration process of jobs to different addresses\ninterface IKeep3rJobMigration is IKeep3rJobFundableCredits, IKeep3rJobFundableLiquidity {\n // Events\n\n /// @notice Emitted when Keep3rJobMigration#migrateJob function is called\n /// @param _fromJob The address of the job that requests to migrate\n /// @param _toJob The address at which the job requests to migrate\n event JobMigrationRequested(address indexed _fromJob, address _toJob);\n\n /// @notice Emitted when Keep3rJobMigration#acceptJobMigration function is called\n /// @param _fromJob The address of the job that requested to migrate\n /// @param _toJob The address at which the job had requested to migrate\n event JobMigrationSuccessful(address _fromJob, address indexed _toJob);\n\n // Errors\n\n /// @notice Throws when the address of the job that requests to migrate wants to migrate to its same address\n error JobMigrationImpossible();\n\n /// @notice Throws when the _toJob address differs from the address being tracked in the pendingJobMigrations mapping\n error JobMigrationUnavailable();\n\n /// @notice Throws when cooldown between migrations has not yet passed\n error JobMigrationLocked();\n\n // Variables\n\n /// @notice Maps the jobs that have requested a migration to the address they have requested to migrate to\n /// @return _toJob The address to which the job has requested to migrate to\n function pendingJobMigrations(address _fromJob) external view returns (address _toJob);\n\n // Methods\n\n /// @notice Initializes the migration process for a job by adding the request to the pendingJobMigrations mapping\n /// @param _fromJob The address of the job that is requesting to migrate\n /// @param _toJob The address at which the job is requesting to migrate\n function migrateJob(address _fromJob, address _toJob) external;\n\n /// @notice Completes the migration process for a job\n /// @dev Unbond/withdraw process doesn't get migrated\n /// @param _fromJob The address of the job that requested to migrate\n /// @param _toJob The address to which the job wants to migrate to\n function acceptJobMigration(address _fromJob, address _toJob) external;\n}\n\n/// @title Keep3rJobWorkable contract\n/// @notice Handles the mechanisms jobs can pay keepers with along with the restrictions jobs can put on keepers before they can work on jobs\ninterface IKeep3rJobWorkable is IKeep3rJobMigration {\n // Events\n\n /// @notice Emitted when a keeper is validated before a job\n /// @param _gasLeft The amount of gas that the transaction has left at the moment of keeper validation\n event KeeperValidation(uint256 _gasLeft);\n\n /// @notice Emitted when a keeper works a job\n /// @param _credit The address of the asset in which the keeper is paid\n /// @param _job The address of the job the keeper has worked\n /// @param _keeper The address of the keeper that has worked the job\n /// @param _payment The amount that has been paid out to the keeper in exchange for working the job\n /// @param _gasLeft The amount of gas that the transaction has left at the moment of payment\n event KeeperWork(address indexed _credit, address indexed _job, address indexed _keeper, uint256 _payment, uint256 _gasLeft);\n\n // Errors\n\n /// @notice Throws if work method was called without calling isKeeper or isBondedKeeper\n error GasNotInitialized();\n\n /// @notice Throws if the address claiming to be a job is not in the list of approved jobs\n error JobUnapproved();\n\n /// @notice Throws if the amount of funds in the job is less than the payment that must be paid to the keeper that works that job\n error InsufficientFunds();\n\n // Methods\n\n /// @notice Confirms if the current keeper is registered\n /// @dev Can be used for general (non critical) functions\n /// @param _keeper The keeper being investigated\n /// @return _isKeeper Whether the address passed as a parameter is a keeper or not\n function isKeeper(address _keeper) external returns (bool _isKeeper);\n\n /// @notice Confirms if the current keeper is registered and has a minimum bond of any asset.\n /// @dev Should be used for protected functions\n /// @param _keeper The keeper to check\n /// @param _bond The bond token being evaluated\n /// @param _minBond The minimum amount of bonded tokens\n /// @param _earned The minimum funds earned in the keepers lifetime\n /// @param _age The minimum keeper age required\n /// @return _isBondedKeeper Whether the `_keeper` meets the given requirements\n function isBondedKeeper(\n address _keeper,\n address _bond,\n uint256 _minBond,\n uint256 _earned,\n uint256 _age\n ) external returns (bool _isBondedKeeper);\n\n /// @notice Implemented by jobs to show that a keeper performed work\n /// @dev Automatically calculates the payment for the keeper and pays the keeper with bonded KP3R\n /// @param _keeper Address of the keeper that performed the work\n function worked(address _keeper) external;\n\n /// @notice Implemented by jobs to show that a keeper performed work\n /// @dev Pays the keeper that performs the work with KP3R\n /// @param _keeper Address of the keeper that performed the work\n /// @param _payment The reward that should be allocated for the job\n function bondedPayment(address _keeper, uint256 _payment) external;\n\n /// @notice Implemented by jobs to show that a keeper performed work\n /// @dev Pays the keeper that performs the work with a specific token\n /// @param _token The asset being awarded to the keeper\n /// @param _keeper Address of the keeper that performed the work\n /// @param _amount The reward that should be allocated\n function directTokenPayment(\n address _token,\n address _keeper,\n uint256 _amount\n ) external;\n}\n\n/// @title Keep3rJobDisputable contract\n/// @notice Handles the actions that can be taken on a disputed job\ninterface IKeep3rJobDisputable is IKeep3rDisputable, IKeep3rJobFundableCredits, IKeep3rJobFundableLiquidity {\n // Events\n\n /// @notice Emitted when Keep3rJobDisputable#slashTokenFromJob is called\n /// @param _job The address of the job from which the token will be slashed\n /// @param _token The address of the token being slashed\n /// @param _slasher The user that slashes the token\n /// @param _amount The amount of the token being slashed\n event JobSlashToken(address indexed _job, address _token, address indexed _slasher, uint256 _amount);\n\n /// @notice Emitted when Keep3rJobDisputable#slashLiquidityFromJob is called\n /// @param _job The address of the job from which the liquidity will be slashed\n /// @param _liquidity The address of the liquidity being slashed\n /// @param _slasher The user that slashes the liquidity\n /// @param _amount The amount of the liquidity being slashed\n event JobSlashLiquidity(address indexed _job, address _liquidity, address indexed _slasher, uint256 _amount);\n\n // Errors\n\n /// @notice Throws when the token trying to be slashed doesn't exist\n error JobTokenUnexistent();\n\n /// @notice Throws when someone tries to slash more tokens than the job has\n error JobTokenInsufficient();\n\n // Methods\n\n /// @notice Allows governance or slasher to slash a job specific token\n /// @param _job The address of the job from which the token will be slashed\n /// @param _token The address of the token that will be slashed\n /// @param _amount The amount of the token that will be slashed\n function slashTokenFromJob(\n address _job,\n address _token,\n uint256 _amount\n ) external;\n\n /// @notice Allows governance or a slasher to slash liquidity from a job\n /// @param _job The address being slashed\n /// @param _liquidity The address of the liquidity that will be slashed\n /// @param _amount The amount of liquidity that will be slashed\n function slashLiquidityFromJob(\n address _job,\n address _liquidity,\n uint256 _amount\n ) external;\n}\n\n// solhint-disable-next-line no-empty-blocks\ninterface IKeep3rJobs is IKeep3rJobWorkable, IKeep3rJobManager, IKeep3rJobDisputable {\n\n}\n" - }, - "solidity/interfaces/peripherals/IKeep3rKeepers.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport './IKeep3rDisputable.sol';\n\n/// @title Keep3rKeeperFundable contract\n/// @notice Handles the actions required to become a keeper\ninterface IKeep3rKeeperFundable {\n // Events\n\n /// @notice Emitted when Keep3rKeeperFundable#activate is called\n /// @param _keeper The keeper that has been activated\n /// @param _bond The asset the keeper has bonded\n /// @param _amount The amount of the asset the keeper has bonded\n event Activation(address indexed _keeper, address indexed _bond, uint256 _amount);\n\n /// @notice Emitted when Keep3rKeeperFundable#withdraw is called\n /// @param _keeper The caller of Keep3rKeeperFundable#withdraw function\n /// @param _bond The asset to withdraw from the bonding pool\n /// @param _amount The amount of funds withdrawn\n event Withdrawal(address indexed _keeper, address indexed _bond, uint256 _amount);\n\n // Errors\n\n /// @notice Throws when the address that is trying to register as a job is already a job\n error AlreadyAJob();\n\n // Methods\n\n /// @notice Beginning of the bonding process\n /// @param _bonding The asset being bonded\n /// @param _amount The amount of bonding asset being bonded\n function bond(address _bonding, uint256 _amount) external;\n\n /// @notice Beginning of the unbonding process\n /// @param _bonding The asset being unbonded\n /// @param _amount Allows for partial unbonding\n function unbond(address _bonding, uint256 _amount) external;\n\n /// @notice End of the bonding process after bonding time has passed\n /// @param _bonding The asset being activated as bond collateral\n function activate(address _bonding) external;\n\n /// @notice Withdraw funds after unbonding has finished\n /// @param _bonding The asset to withdraw from the bonding pool\n function withdraw(address _bonding) external;\n}\n\n/// @title Keep3rKeeperDisputable contract\n/// @notice Handles the actions that can be taken on a disputed keeper\ninterface IKeep3rKeeperDisputable is IKeep3rDisputable, IKeep3rKeeperFundable {\n // Events\n\n /// @notice Emitted when Keep3rKeeperDisputable#slash is called\n /// @param _keeper The address of the slashed keeper\n /// @param _slasher The user that called Keep3rKeeperDisputable#slash\n /// @param _amount The amount of credits slashed from the keeper\n event KeeperSlash(address indexed _keeper, address indexed _slasher, uint256 _amount);\n\n /// @notice Emitted when Keep3rKeeperDisputable#revoke is called\n /// @param _keeper The address of the revoked keeper\n /// @param _slasher The user that called Keep3rKeeperDisputable#revoke\n event KeeperRevoke(address indexed _keeper, address indexed _slasher);\n\n // Methods\n\n /// @notice Allows governance to slash a keeper based on a dispute\n /// @param _keeper The address being slashed\n /// @param _bonded The asset being slashed\n /// @param _bondAmount The bonded amount being slashed\n /// @param _unbondAmount The pending unbond amount being slashed\n function slash(\n address _keeper,\n address _bonded,\n uint256 _bondAmount,\n uint256 _unbondAmount\n ) external;\n\n /// @notice Blacklists a keeper from participating in the network\n /// @param _keeper The address being slashed\n function revoke(address _keeper) external;\n}\n\n// solhint-disable-next-line no-empty-blocks\n\n/// @title Keep3rKeepers contract\ninterface IKeep3rKeepers is IKeep3rKeeperDisputable {\n\n}\n" - }, - "solidity/interfaces/peripherals/IKeep3rParameters.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport './IKeep3rAccountance.sol';\n\n/// @title Keep3rParameters contract\n/// @notice Handles and sets all the required parameters for Keep3r\ninterface IKeep3rParameters is IKeep3rAccountance {\n // Events\n\n /// @notice Emitted when the Keep3rHelper address is changed\n /// @param _keep3rHelper The address of Keep3rHelper's contract\n event Keep3rHelperChange(address _keep3rHelper);\n\n /// @notice Emitted when the Keep3rV1 address is changed\n /// @param _keep3rV1 The address of Keep3rV1's contract\n event Keep3rV1Change(address _keep3rV1);\n\n /// @notice Emitted when the Keep3rV1Proxy address is changed\n /// @param _keep3rV1Proxy The address of Keep3rV1Proxy's contract\n event Keep3rV1ProxyChange(address _keep3rV1Proxy);\n\n /// @notice Emitted when bondTime is changed\n /// @param _bondTime The new bondTime\n event BondTimeChange(uint256 _bondTime);\n\n /// @notice Emitted when _liquidityMinimum is changed\n /// @param _liquidityMinimum The new _liquidityMinimum\n event LiquidityMinimumChange(uint256 _liquidityMinimum);\n\n /// @notice Emitted when _unbondTime is changed\n /// @param _unbondTime The new _unbondTime\n event UnbondTimeChange(uint256 _unbondTime);\n\n /// @notice Emitted when _rewardPeriodTime is changed\n /// @param _rewardPeriodTime The new _rewardPeriodTime\n event RewardPeriodTimeChange(uint256 _rewardPeriodTime);\n\n /// @notice Emitted when the inflationPeriod is changed\n /// @param _inflationPeriod The new inflationPeriod\n event InflationPeriodChange(uint256 _inflationPeriod);\n\n /// @notice Emitted when the fee is changed\n /// @param _fee The new token credits fee\n event FeeChange(uint256 _fee);\n\n // Variables\n\n /// @notice Address of Keep3rHelper's contract\n /// @return _keep3rHelper The address of Keep3rHelper's contract\n function keep3rHelper() external view returns (address _keep3rHelper);\n\n /// @notice Address of Keep3rV1's contract\n /// @return _keep3rV1 The address of Keep3rV1's contract\n function keep3rV1() external view returns (address _keep3rV1);\n\n /// @notice Address of Keep3rV1Proxy's contract\n /// @return _keep3rV1Proxy The address of Keep3rV1Proxy's contract\n function keep3rV1Proxy() external view returns (address _keep3rV1Proxy);\n\n /// @notice The amount of time required to pass after a keeper has bonded assets for it to be able to activate\n /// @return _days The required bondTime in days\n function bondTime() external view returns (uint256 _days);\n\n /// @notice The amount of time required to pass before a keeper can unbond what he has bonded\n /// @return _days The required unbondTime in days\n function unbondTime() external view returns (uint256 _days);\n\n /// @notice The minimum amount of liquidity required to fund a job per liquidity\n /// @return _amount The minimum amount of liquidity in KP3R\n function liquidityMinimum() external view returns (uint256 _amount);\n\n /// @notice The amount of time between each scheduled credits reward given to a job\n /// @return _days The reward period in days\n function rewardPeriodTime() external view returns (uint256 _days);\n\n /// @notice The inflation period is the denominator used to regulate the emission of KP3R\n /// @return _period The denominator used to regulate the emission of KP3R\n function inflationPeriod() external view returns (uint256 _period);\n\n /// @notice The fee to be sent to governance when a user adds liquidity to a job\n /// @return _amount The fee amount to be sent to governance when a user adds liquidity to a job\n function fee() external view returns (uint256 _amount);\n\n // Errors\n\n /// @notice Throws if the reward period is less than the minimum reward period time\n error MinRewardPeriod();\n\n /// @notice Throws if either a job or a keeper is disputed\n error Disputed();\n\n /// @notice Throws if there are no bonded assets\n error BondsUnexistent();\n\n /// @notice Throws if the time required to bond an asset has not passed yet\n error BondsLocked();\n\n /// @notice Throws if there are no bonds to withdraw\n error UnbondsUnexistent();\n\n /// @notice Throws if the time required to withdraw the bonds has not passed yet\n error UnbondsLocked();\n\n // Methods\n\n /// @notice Sets the Keep3rHelper address\n /// @param _keep3rHelper The Keep3rHelper address\n function setKeep3rHelper(address _keep3rHelper) external;\n\n /// @notice Sets the Keep3rV1 address\n /// @param _keep3rV1 The Keep3rV1 address\n function setKeep3rV1(address _keep3rV1) external;\n\n /// @notice Sets the Keep3rV1Proxy address\n /// @param _keep3rV1Proxy The Keep3rV1Proxy address\n function setKeep3rV1Proxy(address _keep3rV1Proxy) external;\n\n /// @notice Sets the bond time required to activate as a keeper\n /// @param _bond The new bond time\n function setBondTime(uint256 _bond) external;\n\n /// @notice Sets the unbond time required unbond what has been bonded\n /// @param _unbond The new unbond time\n function setUnbondTime(uint256 _unbond) external;\n\n /// @notice Sets the minimum amount of liquidity required to fund a job\n /// @param _liquidityMinimum The new minimum amount of liquidity\n function setLiquidityMinimum(uint256 _liquidityMinimum) external;\n\n /// @notice Sets the time required to pass between rewards for jobs\n /// @param _rewardPeriodTime The new amount of time required to pass between rewards\n function setRewardPeriodTime(uint256 _rewardPeriodTime) external;\n\n /// @notice Sets the new inflation period\n /// @param _inflationPeriod The new inflation period\n function setInflationPeriod(uint256 _inflationPeriod) external;\n\n /// @notice Sets the new fee\n /// @param _fee The new fee\n function setFee(uint256 _fee) external;\n}\n" - }, - "solidity/interfaces/peripherals/IKeep3rDisputable.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\n/// @title Keep3rDisputable contract\n/// @notice Creates/resolves disputes for jobs or keepers\n/// A disputed keeper is slashable and is not able to bond, activate, withdraw or receive direct payments\n/// A disputed job is slashable and is not able to pay the keepers, withdraw tokens or to migrate\ninterface IKeep3rDisputable {\n /// @notice Emitted when a keeper or a job is disputed\n /// @param _jobOrKeeper The address of the disputed keeper/job\n /// @param _disputer The user that called the function and disputed the keeper\n event Dispute(address indexed _jobOrKeeper, address indexed _disputer);\n\n /// @notice Emitted when a dispute is resolved\n /// @param _jobOrKeeper The address of the disputed keeper/job\n /// @param _resolver The user that called the function and resolved the dispute\n event Resolve(address indexed _jobOrKeeper, address indexed _resolver);\n\n /// @notice Throws when a job or keeper is already disputed\n error AlreadyDisputed();\n\n /// @notice Throws when a job or keeper is not disputed and someone tries to resolve the dispute\n error NotDisputed();\n\n /// @notice Allows governance to create a dispute for a given keeper/job\n /// @param _jobOrKeeper The address in dispute\n function dispute(address _jobOrKeeper) external;\n\n /// @notice Allows governance to resolve a dispute on a keeper/job\n /// @param _jobOrKeeper The address cleared\n function resolve(address _jobOrKeeper) external;\n}\n" - }, - "solidity/interfaces/peripherals/IKeep3rAccountance.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport './IKeep3rRoles.sol';\n\n/// @title Keep3rDisputable contract\n/// @notice Disputes keepers, or if they're already disputed, it can resolve the case\n/// @dev Argument `bonding` can be the address of either a token or a liquidity\ninterface IKeep3rAccountance is IKeep3rRoles {\n // Events\n\n /// @notice Emitted when the bonding process of a new keeper begins\n /// @param _keeper The caller of Keep3rKeeperFundable#bond function\n /// @param _bonding The asset the keeper has bonded\n /// @param _amount The amount the keeper has bonded\n event Bonding(address indexed _keeper, address indexed _bonding, uint256 _amount);\n\n /// @notice Emitted when a keeper or job begins the unbonding process to withdraw the funds\n /// @param _keeperOrJob The keeper or job that began the unbonding process\n /// @param _unbonding The liquidity pair or asset being unbonded\n /// @param _amount The amount being unbonded\n event Unbonding(address indexed _keeperOrJob, address indexed _unbonding, uint256 _amount);\n\n // Variables\n\n /// @notice Tracks the total amount of bonded KP3Rs in the contract\n /// @return _totalBonds The total amount of bonded KP3Rs in the contract\n function totalBonds() external view returns (uint256 _totalBonds);\n\n /// @notice Tracks the total KP3R earnings of a keeper since it started working\n /// @param _keeper The address of the keeper\n /// @return _workCompleted Total KP3R earnings of a keeper since it started working\n function workCompleted(address _keeper) external view returns (uint256 _workCompleted);\n\n /// @notice Tracks when a keeper was first registered\n /// @param _keeper The address of the keeper\n /// @return timestamp The time at which the keeper was first registered\n function firstSeen(address _keeper) external view returns (uint256 timestamp);\n\n /// @notice Tracks if a keeper or job has a pending dispute\n /// @param _keeperOrJob The address of the keeper or job\n /// @return _disputed Whether a keeper or job has a pending dispute\n function disputes(address _keeperOrJob) external view returns (bool _disputed);\n\n /// @notice Tracks how much a keeper has bonded of a certain token\n /// @param _keeper The address of the keeper\n /// @param _bond The address of the token being bonded\n /// @return _bonds Amount of a certain token that a keeper has bonded\n function bonds(address _keeper, address _bond) external view returns (uint256 _bonds);\n\n /// @notice The current token credits available for a job\n /// @param _job The address of the job\n /// @param _token The address of the token bonded\n /// @return _amount The amount of token credits available for a job\n function jobTokenCredits(address _job, address _token) external view returns (uint256 _amount);\n\n /// @notice Tracks the amount of assets deposited in pending bonds\n /// @param _keeper The address of the keeper\n /// @param _bonding The address of the token being bonded\n /// @return _pendingBonds Amount of a certain asset a keeper has unbonding\n function pendingBonds(address _keeper, address _bonding) external view returns (uint256 _pendingBonds);\n\n /// @notice Tracks when a bonding for a keeper can be activated\n /// @param _keeper The address of the keeper\n /// @param _bonding The address of the token being bonded\n /// @return _timestamp Time at which the bonding for a keeper can be activated\n function canActivateAfter(address _keeper, address _bonding) external view returns (uint256 _timestamp);\n\n /// @notice Tracks when keeper bonds are ready to be withdrawn\n /// @param _keeper The address of the keeper\n /// @param _bonding The address of the token being unbonded\n /// @return _timestamp Time at which the keeper bonds are ready to be withdrawn\n function canWithdrawAfter(address _keeper, address _bonding) external view returns (uint256 _timestamp);\n\n /// @notice Tracks how much keeper bonds are to be withdrawn\n /// @param _keeper The address of the keeper\n /// @param _bonding The address of the token being unbonded\n /// @return _pendingUnbonds The amount of keeper bonds that are to be withdrawn\n function pendingUnbonds(address _keeper, address _bonding) external view returns (uint256 _pendingUnbonds);\n\n /// @notice Checks whether the address has ever bonded an asset\n /// @param _keeper The address of the keeper\n /// @return _hasBonded Whether the address has ever bonded an asset\n function hasBonded(address _keeper) external view returns (bool _hasBonded);\n\n // Methods\n\n /// @notice Lists all jobs\n /// @return _jobList Array with all the jobs in _jobs\n function jobs() external view returns (address[] memory _jobList);\n\n /// @notice Lists all keepers\n /// @return _keeperList Array with all the keepers in _keepers\n function keepers() external view returns (address[] memory _keeperList);\n\n // Errors\n\n /// @notice Throws when an address is passed as a job, but that address is not a job\n error JobUnavailable();\n\n /// @notice Throws when an action that requires an undisputed job is applied on a disputed job\n error JobDisputed();\n}\n" - }, - "solidity/interfaces/peripherals/IKeep3rRoles.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport './IBaseErrors.sol';\nimport './IGovernable.sol';\nimport './IDustCollector.sol';\n\n/// @title Keep3rRoles contract\n/// @notice Manages the Keep3r specific roles\ninterface IKeep3rRoles is IBaseErrors, IDustCollector, IGovernable {\n // Events\n\n /// @notice Emitted when a slasher is added\n /// @param _slasher Address of the added slasher\n event SlasherAdded(address _slasher);\n\n /// @notice Emitted when a slasher is removed\n /// @param _slasher Address of the removed slasher\n event SlasherRemoved(address _slasher);\n\n /// @notice Emitted when a disputer is added\n /// @param _disputer Address of the added disputer\n event DisputerAdded(address _disputer);\n\n /// @notice Emitted when a disputer is removed\n /// @param _disputer Address of the removed disputer\n event DisputerRemoved(address _disputer);\n\n // Variables\n\n /// @notice Tracks whether the address is a slasher or not\n /// @param _slasher Address being checked as a slasher\n /// @return _isSlasher Whether the address is a slasher or not\n function slashers(address _slasher) external view returns (bool _isSlasher);\n\n /// @notice Tracks whether the address is a disputer or not\n /// @param _disputer Address being checked as a disputer\n /// @return _isDisputer Whether the address is a disputer or not\n function disputers(address _disputer) external view returns (bool _isDisputer);\n\n // Errors\n\n /// @notice Throws if the address is already a registered slasher\n error SlasherExistent();\n\n /// @notice Throws if caller is not a registered slasher\n error SlasherUnexistent();\n\n /// @notice Throws if the address is already a registered disputer\n error DisputerExistent();\n\n /// @notice Throws if caller is not a registered disputer\n error DisputerUnexistent();\n\n /// @notice Throws if the msg.sender is not a slasher or is not a part of governance\n error OnlySlasher();\n\n /// @notice Throws if the msg.sender is not a disputer or is not a part of governance\n error OnlyDisputer();\n\n // Methods\n\n /// @notice Registers a slasher by updating the slashers mapping\n function addSlasher(address _slasher) external;\n\n /// @notice Removes a slasher by updating the slashers mapping\n function removeSlasher(address _slasher) external;\n\n /// @notice Registers a disputer by updating the disputers mapping\n function addDisputer(address _disputer) external;\n\n /// @notice Removes a disputer by updating the disputers mapping\n function removeDisputer(address _disputer) external;\n}\n" - }, - "solidity/interfaces/peripherals/IBaseErrors.sol": { - "content": "// SPDX-License-Identifier: MIT\n\npragma solidity >=0.8.4 <0.9.0;\n\ninterface IBaseErrors {\n /// @notice Throws if a variable is assigned to the zero address\n error ZeroAddress();\n}\n" - }, - "solidity/interfaces/peripherals/IGovernable.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\n/// @title Governable contract\n/// @notice Manages the governance role\ninterface IGovernable {\n // Events\n\n /// @notice Emitted when pendingGovernance accepts to be governance\n /// @param _governance Address of the new governance\n event GovernanceSet(address _governance);\n\n /// @notice Emitted when a new governance is proposed\n /// @param _pendingGovernance Address that is proposed to be the new governance\n event GovernanceProposal(address _pendingGovernance);\n\n // Errors\n\n /// @notice Throws if the caller of the function is not governance\n error OnlyGovernance();\n\n /// @notice Throws if the caller of the function is not pendingGovernance\n error OnlyPendingGovernance();\n\n /// @notice Throws if trying to set governance to zero address\n error NoGovernanceZeroAddress();\n\n // Variables\n\n /// @notice Stores the governance address\n /// @return _governance The governance addresss\n function governance() external view returns (address _governance);\n\n /// @notice Stores the pendingGovernance address\n /// @return _pendingGovernance The pendingGovernance addresss\n function pendingGovernance() external view returns (address _pendingGovernance);\n\n // Methods\n\n /// @notice Proposes a new address to be governance\n /// @param _governance The address being proposed as the new governance\n function setGovernance(address _governance) external;\n\n /// @notice Changes the governance from the current governance to the previously proposed address\n function acceptGovernance() external;\n}\n" - }, - "solidity/interfaces/peripherals/IDustCollector.sol": { - "content": "// SPDX-License-Identifier: MIT\n\npragma solidity >=0.8.4 <0.9.0;\n\nimport './IBaseErrors.sol';\n\ninterface IDustCollector is IBaseErrors {\n /// @notice Emitted when dust is sent\n /// @param _token The token that will be transferred\n /// @param _amount The amount of the token that will be transferred\n /// @param _to The address which will receive the funds\n event DustSent(address _token, uint256 _amount, address _to);\n\n /// @notice Allows an authorized user to transfer the tokens or eth that may have been left in a contract\n /// @param _token The token that will be transferred\n /// @param _amount The amount of the token that will be transferred\n /// @param _to The address that will receive the idle funds\n function sendDust(\n address _token,\n uint256 _amount,\n address _to\n ) external;\n}\n" - }, - "solidity/contracts/peripherals/jobs/Keep3rJobManager.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport './Keep3rJobOwnership.sol';\nimport '../Keep3rAccountance.sol';\nimport '../../../interfaces/peripherals/IKeep3rJobs.sol';\n\nabstract contract Keep3rJobManager is IKeep3rJobManager, Keep3rJobOwnership, Keep3rAccountance {\n using EnumerableSet for EnumerableSet.AddressSet;\n\n /// @inheritdoc IKeep3rJobManager\n function addJob(address _job) external override {\n if (_jobs.contains(_job)) revert JobAlreadyAdded();\n if (hasBonded[_job]) revert AlreadyAKeeper();\n _jobs.add(_job);\n jobOwner[_job] = msg.sender;\n emit JobAddition(_job, msg.sender);\n }\n}\n" - }, - "solidity/contracts/peripherals/jobs/Keep3rJobWorkable.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport './Keep3rJobMigration.sol';\nimport '../../../interfaces/IKeep3rHelper.sol';\nimport '../../../interfaces/peripherals/IKeep3rJobs.sol';\n\nimport '@openzeppelin/contracts/token/ERC20/IERC20.sol';\nimport '@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol';\n\nabstract contract Keep3rJobWorkable is IKeep3rJobWorkable, Keep3rJobMigration {\n using EnumerableSet for EnumerableSet.AddressSet;\n using SafeERC20 for IERC20;\n\n uint256 internal _initialGas;\n\n /// @inheritdoc IKeep3rJobWorkable\n function isKeeper(address _keeper) external override returns (bool _isKeeper) {\n _initialGas = _getGasLeft();\n if (_keepers.contains(_keeper)) {\n emit KeeperValidation(_initialGas);\n return true;\n }\n }\n\n /// @inheritdoc IKeep3rJobWorkable\n function isBondedKeeper(\n address _keeper,\n address _bond,\n uint256 _minBond,\n uint256 _earned,\n uint256 _age\n ) external override returns (bool _isBondedKeeper) {\n _initialGas = _getGasLeft();\n if (\n _keepers.contains(_keeper) &&\n bonds[_keeper][_bond] >= _minBond &&\n workCompleted[_keeper] >= _earned &&\n block.timestamp - firstSeen[_keeper] >= _age\n ) {\n emit KeeperValidation(_initialGas);\n return true;\n }\n }\n\n /// @inheritdoc IKeep3rJobWorkable\n function worked(address _keeper) external virtual override {\n if (_initialGas == 0) revert GasNotInitialized();\n address _job = msg.sender;\n if (disputes[_job]) revert JobDisputed();\n if (!_jobs.contains(_job)) revert JobUnapproved();\n\n if (_updateJobCreditsIfNeeded(_job)) {\n emit LiquidityCreditsReward(_job, rewardedAt[_job], _jobLiquidityCredits[_job], _jobPeriodCredits[_job]);\n }\n\n (uint256 _boost, uint256 _oneEthQuote, uint256 _extraGas) = IKeep3rHelper(keep3rHelper).getPaymentParams(bonds[_keeper][keep3rV1]);\n\n uint256 _gasLeft = _getGasLeft();\n uint256 _payment = _calculatePayment(_gasLeft, _extraGas, _oneEthQuote, _boost);\n\n if (_payment > _jobLiquidityCredits[_job]) {\n _rewardJobCredits(_job);\n emit LiquidityCreditsReward(_job, rewardedAt[_job], _jobLiquidityCredits[_job], _jobPeriodCredits[_job]);\n\n _gasLeft = _getGasLeft();\n _payment = _calculatePayment(_gasLeft, _extraGas, _oneEthQuote, _boost);\n }\n\n _bondedPayment(_job, _keeper, _payment);\n delete _initialGas;\n\n emit KeeperWork(keep3rV1, _job, _keeper, _payment, _gasLeft);\n }\n\n /// @inheritdoc IKeep3rJobWorkable\n function bondedPayment(address _keeper, uint256 _payment) external override {\n address _job = msg.sender;\n\n if (disputes[_job]) revert JobDisputed();\n if (!_jobs.contains(_job)) revert JobUnapproved();\n\n if (_updateJobCreditsIfNeeded(_job)) {\n emit LiquidityCreditsReward(_job, rewardedAt[_job], _jobLiquidityCredits[_job], _jobPeriodCredits[_job]);\n }\n\n if (_payment > _jobLiquidityCredits[_job]) {\n _rewardJobCredits(_job);\n emit LiquidityCreditsReward(_job, rewardedAt[_job], _jobLiquidityCredits[_job], _jobPeriodCredits[_job]);\n }\n\n _bondedPayment(_job, _keeper, _payment);\n emit KeeperWork(keep3rV1, _job, _keeper, _payment, _getGasLeft());\n }\n\n /// @inheritdoc IKeep3rJobWorkable\n function directTokenPayment(\n address _token,\n address _keeper,\n uint256 _amount\n ) external override {\n address _job = msg.sender;\n\n if (disputes[_job]) revert JobDisputed();\n if (disputes[_keeper]) revert Disputed();\n if (!_jobs.contains(_job)) revert JobUnapproved();\n if (jobTokenCredits[_job][_token] < _amount) revert InsufficientFunds();\n jobTokenCredits[_job][_token] -= _amount;\n IERC20(_token).safeTransfer(_keeper, _amount);\n emit KeeperWork(_token, _job, _keeper, _amount, _getGasLeft());\n }\n\n function _bondedPayment(\n address _job,\n address _keeper,\n uint256 _payment\n ) internal {\n if (_payment > _jobLiquidityCredits[_job]) revert InsufficientFunds();\n\n workedAt[_job] = block.timestamp;\n _jobLiquidityCredits[_job] -= _payment;\n bonds[_keeper][keep3rV1] += _payment;\n workCompleted[_keeper] += _payment;\n totalBonds += _payment;\n }\n\n /// @notice Calculate amount to be payed in KP3R, taking into account multiple parameters\n /// @param _gasLeft Amount of gas left after working the job\n /// @param _extraGas Amount of expected unaccounted gas\n /// @param _oneEthQuote Amount of KP3R equivalent to 1 ETH\n /// @param _boost Reward given to the keeper for having bonded KP3R tokens\n /// @return _payment Amount to be payed in KP3R tokens\n function _calculatePayment(\n uint256 _gasLeft,\n uint256 _extraGas,\n uint256 _oneEthQuote,\n uint256 _boost\n ) internal view returns (uint256 _payment) {\n uint256 _accountedGas = _initialGas - _gasLeft + _extraGas;\n _payment = (((_accountedGas * _boost) / _BASE) * _oneEthQuote) / 1 ether;\n }\n\n /// @notice Return the gas left and add 1/64 in order to match real gas left at first level of depth (EIP-150)\n /// @return _gasLeft Amount of gas left recording taking into account EIP-150\n function _getGasLeft() internal view returns (uint256 _gasLeft) {\n _gasLeft = (gasleft() * 64) / 63;\n }\n}\n" - }, - "solidity/contracts/peripherals/jobs/Keep3rJobDisputable.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport './Keep3rJobFundableCredits.sol';\nimport './Keep3rJobFundableLiquidity.sol';\nimport '../Keep3rDisputable.sol';\n\nabstract contract Keep3rJobDisputable is IKeep3rJobDisputable, Keep3rDisputable, Keep3rJobFundableCredits, Keep3rJobFundableLiquidity {\n using EnumerableSet for EnumerableSet.AddressSet;\n using SafeERC20 for IERC20;\n\n /// @inheritdoc IKeep3rJobDisputable\n function slashTokenFromJob(\n address _job,\n address _token,\n uint256 _amount\n ) external override onlySlasher {\n if (!disputes[_job]) revert NotDisputed();\n if (!_jobTokens[_job].contains(_token)) revert JobTokenUnexistent();\n if (jobTokenCredits[_job][_token] < _amount) revert JobTokenInsufficient();\n\n try IERC20(_token).transfer(governance, _amount) {} catch {}\n jobTokenCredits[_job][_token] -= _amount;\n if (jobTokenCredits[_job][_token] == 0) {\n _jobTokens[_job].remove(_token);\n }\n\n emit JobSlashToken(_job, _token, msg.sender, _amount);\n }\n\n /// @inheritdoc IKeep3rJobDisputable\n function slashLiquidityFromJob(\n address _job,\n address _liquidity,\n uint256 _amount\n ) external override onlySlasher {\n if (!disputes[_job]) revert NotDisputed();\n\n _unbondLiquidityFromJob(_job, _liquidity, _amount);\n try IERC20(_liquidity).transfer(governance, _amount) {} catch {}\n emit JobSlashLiquidity(_job, _liquidity, msg.sender, _amount);\n }\n}\n" - }, - "solidity/contracts/peripherals/jobs/Keep3rJobOwnership.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../../../interfaces/peripherals/IKeep3rJobs.sol';\n\nabstract contract Keep3rJobOwnership is IKeep3rJobOwnership {\n /// @inheritdoc IKeep3rJobOwnership\n mapping(address => address) public override jobOwner;\n\n /// @inheritdoc IKeep3rJobOwnership\n mapping(address => address) public override jobPendingOwner;\n\n /// @inheritdoc IKeep3rJobOwnership\n function changeJobOwnership(address _job, address _newOwner) external override onlyJobOwner(_job) {\n jobPendingOwner[_job] = _newOwner;\n emit JobOwnershipChange(_job, jobOwner[_job], _newOwner);\n }\n\n /// @inheritdoc IKeep3rJobOwnership\n function acceptJobOwnership(address _job) external override onlyPendingJobOwner(_job) {\n address _previousOwner = jobOwner[_job];\n\n jobOwner[_job] = jobPendingOwner[_job];\n delete jobPendingOwner[_job];\n\n emit JobOwnershipAssent(msg.sender, _job, _previousOwner);\n }\n\n modifier onlyJobOwner(address _job) {\n if (msg.sender != jobOwner[_job]) revert OnlyJobOwner();\n _;\n }\n\n modifier onlyPendingJobOwner(address _job) {\n if (msg.sender != jobPendingOwner[_job]) revert OnlyPendingJobOwner();\n _;\n }\n}\n" - }, - "solidity/contracts/peripherals/Keep3rAccountance.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '@openzeppelin/contracts/utils/structs/EnumerableSet.sol';\nimport '../../interfaces/peripherals/IKeep3rAccountance.sol';\nimport './Keep3rRoles.sol';\n\nabstract contract Keep3rAccountance is IKeep3rAccountance, Keep3rRoles {\n using EnumerableSet for EnumerableSet.AddressSet;\n\n /// @notice List of all enabled keepers\n EnumerableSet.AddressSet internal _keepers;\n\n /// @inheritdoc IKeep3rAccountance\n uint256 public override totalBonds;\n\n /// @inheritdoc IKeep3rAccountance\n mapping(address => uint256) public override workCompleted;\n\n /// @inheritdoc IKeep3rAccountance\n mapping(address => uint256) public override firstSeen;\n\n /// @inheritdoc IKeep3rAccountance\n mapping(address => bool) public override disputes;\n\n /// @inheritdoc IKeep3rAccountance\n /// @notice Mapping (job => bonding => amount)\n mapping(address => mapping(address => uint256)) public override bonds;\n\n /// @inheritdoc IKeep3rAccountance\n mapping(address => mapping(address => uint256)) public override jobTokenCredits;\n\n /// @notice The current liquidity credits available for a job\n mapping(address => uint256) internal _jobLiquidityCredits;\n\n /// @notice Map the address of a job to its correspondent periodCredits\n mapping(address => uint256) internal _jobPeriodCredits;\n\n /// @notice Enumerable array of Job Tokens for Credits\n mapping(address => EnumerableSet.AddressSet) internal _jobTokens;\n\n /// @notice List of liquidities that a job has (job => liquidities)\n mapping(address => EnumerableSet.AddressSet) internal _jobLiquidities;\n\n /// @notice Liquidity pool to observe\n mapping(address => address) internal _liquidityPool;\n\n /// @notice Tracks if a pool has KP3R as token0\n mapping(address => bool) internal _isKP3RToken0;\n\n /// @inheritdoc IKeep3rAccountance\n mapping(address => mapping(address => uint256)) public override pendingBonds;\n\n /// @inheritdoc IKeep3rAccountance\n mapping(address => mapping(address => uint256)) public override canActivateAfter;\n\n /// @inheritdoc IKeep3rAccountance\n mapping(address => mapping(address => uint256)) public override canWithdrawAfter;\n\n /// @inheritdoc IKeep3rAccountance\n mapping(address => mapping(address => uint256)) public override pendingUnbonds;\n\n /// @inheritdoc IKeep3rAccountance\n mapping(address => bool) public override hasBonded;\n\n /// @notice List of all enabled jobs\n EnumerableSet.AddressSet internal _jobs;\n\n /// @inheritdoc IKeep3rAccountance\n function jobs() external view override returns (address[] memory _list) {\n _list = _jobs.values();\n }\n\n /// @inheritdoc IKeep3rAccountance\n function keepers() external view override returns (address[] memory _list) {\n _list = _keepers.values();\n }\n}\n" - }, - "@openzeppelin/contracts/utils/structs/EnumerableSet.sol": { - "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Library for managing\n * https://en.wikipedia.org/wiki/Set_(abstract_data_type)[sets] of primitive\n * types.\n *\n * Sets have the following properties:\n *\n * - Elements are added, removed, and checked for existence in constant time\n * (O(1)).\n * - Elements are enumerated in O(n). No guarantees are made on the ordering.\n *\n * ```\n * contract Example {\n * // Add the library methods\n * using EnumerableSet for EnumerableSet.AddressSet;\n *\n * // Declare a set state variable\n * EnumerableSet.AddressSet private mySet;\n * }\n * ```\n *\n * As of v3.3.0, sets of type `bytes32` (`Bytes32Set`), `address` (`AddressSet`)\n * and `uint256` (`UintSet`) are supported.\n */\nlibrary EnumerableSet {\n // To implement this library for multiple types with as little code\n // repetition as possible, we write it in terms of a generic Set type with\n // bytes32 values.\n // The Set implementation uses private functions, and user-facing\n // implementations (such as AddressSet) are just wrappers around the\n // underlying Set.\n // This means that we can only create new EnumerableSets for types that fit\n // in bytes32.\n\n struct Set {\n // Storage of set values\n bytes32[] _values;\n // Position of the value in the `values` array, plus 1 because index 0\n // means a value is not in the set.\n mapping(bytes32 => uint256) _indexes;\n }\n\n /**\n * @dev Add a value to a set. O(1).\n *\n * Returns true if the value was added to the set, that is if it was not\n * already present.\n */\n function _add(Set storage set, bytes32 value) private returns (bool) {\n if (!_contains(set, value)) {\n set._values.push(value);\n // The value is stored at length-1, but we add 1 to all indexes\n // and use 0 as a sentinel value\n set._indexes[value] = set._values.length;\n return true;\n } else {\n return false;\n }\n }\n\n /**\n * @dev Removes a value from a set. O(1).\n *\n * Returns true if the value was removed from the set, that is if it was\n * present.\n */\n function _remove(Set storage set, bytes32 value) private returns (bool) {\n // We read and store the value's index to prevent multiple reads from the same storage slot\n uint256 valueIndex = set._indexes[value];\n\n if (valueIndex != 0) {\n // Equivalent to contains(set, value)\n // To delete an element from the _values array in O(1), we swap the element to delete with the last one in\n // the array, and then remove the last element (sometimes called as 'swap and pop').\n // This modifies the order of the array, as noted in {at}.\n\n uint256 toDeleteIndex = valueIndex - 1;\n uint256 lastIndex = set._values.length - 1;\n\n if (lastIndex != toDeleteIndex) {\n bytes32 lastvalue = set._values[lastIndex];\n\n // Move the last value to the index where the value to delete is\n set._values[toDeleteIndex] = lastvalue;\n // Update the index for the moved value\n set._indexes[lastvalue] = valueIndex; // Replace lastvalue's index to valueIndex\n }\n\n // Delete the slot where the moved value was stored\n set._values.pop();\n\n // Delete the index for the deleted slot\n delete set._indexes[value];\n\n return true;\n } else {\n return false;\n }\n }\n\n /**\n * @dev Returns true if the value is in the set. O(1).\n */\n function _contains(Set storage set, bytes32 value) private view returns (bool) {\n return set._indexes[value] != 0;\n }\n\n /**\n * @dev Returns the number of values on the set. O(1).\n */\n function _length(Set storage set) private view returns (uint256) {\n return set._values.length;\n }\n\n /**\n * @dev Returns the value stored at position `index` in the set. O(1).\n *\n * Note that there are no guarantees on the ordering of values inside the\n * array, and it may change when more values are added or removed.\n *\n * Requirements:\n *\n * - `index` must be strictly less than {length}.\n */\n function _at(Set storage set, uint256 index) private view returns (bytes32) {\n return set._values[index];\n }\n\n /**\n * @dev Return the entire set in an array\n *\n * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed\n * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that\n * this function has an unbounded cost, and using it as part of a state-changing function may render the function\n * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.\n */\n function _values(Set storage set) private view returns (bytes32[] memory) {\n return set._values;\n }\n\n // Bytes32Set\n\n struct Bytes32Set {\n Set _inner;\n }\n\n /**\n * @dev Add a value to a set. O(1).\n *\n * Returns true if the value was added to the set, that is if it was not\n * already present.\n */\n function add(Bytes32Set storage set, bytes32 value) internal returns (bool) {\n return _add(set._inner, value);\n }\n\n /**\n * @dev Removes a value from a set. O(1).\n *\n * Returns true if the value was removed from the set, that is if it was\n * present.\n */\n function remove(Bytes32Set storage set, bytes32 value) internal returns (bool) {\n return _remove(set._inner, value);\n }\n\n /**\n * @dev Returns true if the value is in the set. O(1).\n */\n function contains(Bytes32Set storage set, bytes32 value) internal view returns (bool) {\n return _contains(set._inner, value);\n }\n\n /**\n * @dev Returns the number of values in the set. O(1).\n */\n function length(Bytes32Set storage set) internal view returns (uint256) {\n return _length(set._inner);\n }\n\n /**\n * @dev Returns the value stored at position `index` in the set. O(1).\n *\n * Note that there are no guarantees on the ordering of values inside the\n * array, and it may change when more values are added or removed.\n *\n * Requirements:\n *\n * - `index` must be strictly less than {length}.\n */\n function at(Bytes32Set storage set, uint256 index) internal view returns (bytes32) {\n return _at(set._inner, index);\n }\n\n /**\n * @dev Return the entire set in an array\n *\n * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed\n * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that\n * this function has an unbounded cost, and using it as part of a state-changing function may render the function\n * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.\n */\n function values(Bytes32Set storage set) internal view returns (bytes32[] memory) {\n return _values(set._inner);\n }\n\n // AddressSet\n\n struct AddressSet {\n Set _inner;\n }\n\n /**\n * @dev Add a value to a set. O(1).\n *\n * Returns true if the value was added to the set, that is if it was not\n * already present.\n */\n function add(AddressSet storage set, address value) internal returns (bool) {\n return _add(set._inner, bytes32(uint256(uint160(value))));\n }\n\n /**\n * @dev Removes a value from a set. O(1).\n *\n * Returns true if the value was removed from the set, that is if it was\n * present.\n */\n function remove(AddressSet storage set, address value) internal returns (bool) {\n return _remove(set._inner, bytes32(uint256(uint160(value))));\n }\n\n /**\n * @dev Returns true if the value is in the set. O(1).\n */\n function contains(AddressSet storage set, address value) internal view returns (bool) {\n return _contains(set._inner, bytes32(uint256(uint160(value))));\n }\n\n /**\n * @dev Returns the number of values in the set. O(1).\n */\n function length(AddressSet storage set) internal view returns (uint256) {\n return _length(set._inner);\n }\n\n /**\n * @dev Returns the value stored at position `index` in the set. O(1).\n *\n * Note that there are no guarantees on the ordering of values inside the\n * array, and it may change when more values are added or removed.\n *\n * Requirements:\n *\n * - `index` must be strictly less than {length}.\n */\n function at(AddressSet storage set, uint256 index) internal view returns (address) {\n return address(uint160(uint256(_at(set._inner, index))));\n }\n\n /**\n * @dev Return the entire set in an array\n *\n * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed\n * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that\n * this function has an unbounded cost, and using it as part of a state-changing function may render the function\n * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.\n */\n function values(AddressSet storage set) internal view returns (address[] memory) {\n bytes32[] memory store = _values(set._inner);\n address[] memory result;\n\n assembly {\n result := store\n }\n\n return result;\n }\n\n // UintSet\n\n struct UintSet {\n Set _inner;\n }\n\n /**\n * @dev Add a value to a set. O(1).\n *\n * Returns true if the value was added to the set, that is if it was not\n * already present.\n */\n function add(UintSet storage set, uint256 value) internal returns (bool) {\n return _add(set._inner, bytes32(value));\n }\n\n /**\n * @dev Removes a value from a set. O(1).\n *\n * Returns true if the value was removed from the set, that is if it was\n * present.\n */\n function remove(UintSet storage set, uint256 value) internal returns (bool) {\n return _remove(set._inner, bytes32(value));\n }\n\n /**\n * @dev Returns true if the value is in the set. O(1).\n */\n function contains(UintSet storage set, uint256 value) internal view returns (bool) {\n return _contains(set._inner, bytes32(value));\n }\n\n /**\n * @dev Returns the number of values on the set. O(1).\n */\n function length(UintSet storage set) internal view returns (uint256) {\n return _length(set._inner);\n }\n\n /**\n * @dev Returns the value stored at position `index` in the set. O(1).\n *\n * Note that there are no guarantees on the ordering of values inside the\n * array, and it may change when more values are added or removed.\n *\n * Requirements:\n *\n * - `index` must be strictly less than {length}.\n */\n function at(UintSet storage set, uint256 index) internal view returns (uint256) {\n return uint256(_at(set._inner, index));\n }\n\n /**\n * @dev Return the entire set in an array\n *\n * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed\n * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that\n * this function has an unbounded cost, and using it as part of a state-changing function may render the function\n * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.\n */\n function values(UintSet storage set) internal view returns (uint256[] memory) {\n bytes32[] memory store = _values(set._inner);\n uint256[] memory result;\n\n assembly {\n result := store\n }\n\n return result;\n }\n}\n" - }, - "solidity/contracts/peripherals/Keep3rRoles.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../../interfaces/peripherals/IKeep3rRoles.sol';\nimport '@openzeppelin/contracts/utils/structs/EnumerableSet.sol';\nimport './DustCollector.sol';\nimport './Governable.sol';\n\ncontract Keep3rRoles is IKeep3rRoles, Governable, DustCollector {\n /// @inheritdoc IKeep3rRoles\n mapping(address => bool) public override slashers;\n\n /// @inheritdoc IKeep3rRoles\n mapping(address => bool) public override disputers;\n\n constructor(address _governance) Governable(_governance) DustCollector() {}\n\n /// @inheritdoc IKeep3rRoles\n function addSlasher(address _slasher) external override onlyGovernance {\n if (_slasher == address(0)) revert ZeroAddress();\n if (slashers[_slasher]) revert SlasherExistent();\n slashers[_slasher] = true;\n emit SlasherAdded(_slasher);\n }\n\n /// @inheritdoc IKeep3rRoles\n function removeSlasher(address _slasher) external override onlyGovernance {\n if (!slashers[_slasher]) revert SlasherUnexistent();\n delete slashers[_slasher];\n emit SlasherRemoved(_slasher);\n }\n\n /// @inheritdoc IKeep3rRoles\n function addDisputer(address _disputer) external override onlyGovernance {\n if (_disputer == address(0)) revert ZeroAddress();\n if (disputers[_disputer]) revert DisputerExistent();\n disputers[_disputer] = true;\n emit DisputerAdded(_disputer);\n }\n\n /// @inheritdoc IKeep3rRoles\n function removeDisputer(address _disputer) external override onlyGovernance {\n if (!disputers[_disputer]) revert DisputerUnexistent();\n delete disputers[_disputer];\n emit DisputerRemoved(_disputer);\n }\n\n /// @notice Functions with this modifier can only be called by either a slasher or governance\n modifier onlySlasher {\n if (!slashers[msg.sender]) revert OnlySlasher();\n _;\n }\n\n /// @notice Functions with this modifier can only be called by either a disputer or governance\n modifier onlyDisputer {\n if (!disputers[msg.sender]) revert OnlyDisputer();\n _;\n }\n}\n" - }, - "solidity/contracts/peripherals/Governable.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../../interfaces/peripherals/IGovernable.sol';\n\nabstract contract Governable is IGovernable {\n /// @inheritdoc IGovernable\n address public override governance;\n\n /// @inheritdoc IGovernable\n address public override pendingGovernance;\n\n constructor(address _governance) {\n if (_governance == address(0)) revert NoGovernanceZeroAddress();\n governance = _governance;\n }\n\n /// @inheritdoc IGovernable\n function setGovernance(address _governance) external override onlyGovernance {\n pendingGovernance = _governance;\n emit GovernanceProposal(_governance);\n }\n\n /// @inheritdoc IGovernable\n function acceptGovernance() external override onlyPendingGovernance {\n governance = pendingGovernance;\n delete pendingGovernance;\n emit GovernanceSet(governance);\n }\n\n /// @notice Functions with this modifier can only be called by governance\n modifier onlyGovernance {\n if (msg.sender != governance) revert OnlyGovernance();\n _;\n }\n\n /// @notice Functions with this modifier can only be called by pendingGovernance\n modifier onlyPendingGovernance {\n if (msg.sender != pendingGovernance) revert OnlyPendingGovernance();\n _;\n }\n}\n" - }, - "@openzeppelin/contracts/token/ERC20/IERC20.sol": { - "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Interface of the ERC20 standard as defined in the EIP.\n */\ninterface IERC20 {\n /**\n * @dev Returns the amount of tokens in existence.\n */\n function totalSupply() external view returns (uint256);\n\n /**\n * @dev Returns the amount of tokens owned by `account`.\n */\n function balanceOf(address account) external view returns (uint256);\n\n /**\n * @dev Moves `amount` tokens from the caller's account to `recipient`.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * Emits a {Transfer} event.\n */\n function transfer(address recipient, uint256 amount) external returns (bool);\n\n /**\n * @dev Returns the remaining number of tokens that `spender` will be\n * allowed to spend on behalf of `owner` through {transferFrom}. This is\n * zero by default.\n *\n * This value changes when {approve} or {transferFrom} are called.\n */\n function allowance(address owner, address spender) external view returns (uint256);\n\n /**\n * @dev Sets `amount` as the allowance of `spender` over the caller's tokens.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * IMPORTANT: Beware that changing an allowance with this method brings the risk\n * that someone may use both the old and the new allowance by unfortunate\n * transaction ordering. One possible solution to mitigate this race\n * condition is to first reduce the spender's allowance to 0 and set the\n * desired value afterwards:\n * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729\n *\n * Emits an {Approval} event.\n */\n function approve(address spender, uint256 amount) external returns (bool);\n\n /**\n * @dev Moves `amount` tokens from `sender` to `recipient` using the\n * allowance mechanism. `amount` is then deducted from the caller's\n * allowance.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * Emits a {Transfer} event.\n */\n function transferFrom(\n address sender,\n address recipient,\n uint256 amount\n ) external returns (bool);\n\n /**\n * @dev Emitted when `value` tokens are moved from one account (`from`) to\n * another (`to`).\n *\n * Note that `value` may be zero.\n */\n event Transfer(address indexed from, address indexed to, uint256 value);\n\n /**\n * @dev Emitted when the allowance of a `spender` for an `owner` is set by\n * a call to {approve}. `value` is the new allowance.\n */\n event Approval(address indexed owner, address indexed spender, uint256 value);\n}\n" - }, - "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol": { - "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\nimport \"../IERC20.sol\";\nimport \"../../../utils/Address.sol\";\n\n/**\n * @title SafeERC20\n * @dev Wrappers around ERC20 operations that throw on failure (when the token\n * contract returns false). Tokens that return no value (and instead revert or\n * throw on failure) are also supported, non-reverting calls are assumed to be\n * successful.\n * To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract,\n * which allows you to call the safe operations as `token.safeTransfer(...)`, etc.\n */\nlibrary SafeERC20 {\n using Address for address;\n\n function safeTransfer(\n IERC20 token,\n address to,\n uint256 value\n ) internal {\n _callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value));\n }\n\n function safeTransferFrom(\n IERC20 token,\n address from,\n address to,\n uint256 value\n ) internal {\n _callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value));\n }\n\n /**\n * @dev Deprecated. This function has issues similar to the ones found in\n * {IERC20-approve}, and its usage is discouraged.\n *\n * Whenever possible, use {safeIncreaseAllowance} and\n * {safeDecreaseAllowance} instead.\n */\n function safeApprove(\n IERC20 token,\n address spender,\n uint256 value\n ) internal {\n // safeApprove should only be called when setting an initial allowance,\n // or when resetting it to zero. To increase and decrease it, use\n // 'safeIncreaseAllowance' and 'safeDecreaseAllowance'\n require(\n (value == 0) || (token.allowance(address(this), spender) == 0),\n \"SafeERC20: approve from non-zero to non-zero allowance\"\n );\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value));\n }\n\n function safeIncreaseAllowance(\n IERC20 token,\n address spender,\n uint256 value\n ) internal {\n uint256 newAllowance = token.allowance(address(this), spender) + value;\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));\n }\n\n function safeDecreaseAllowance(\n IERC20 token,\n address spender,\n uint256 value\n ) internal {\n unchecked {\n uint256 oldAllowance = token.allowance(address(this), spender);\n require(oldAllowance >= value, \"SafeERC20: decreased allowance below zero\");\n uint256 newAllowance = oldAllowance - value;\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));\n }\n }\n\n /**\n * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement\n * on the return value: the return value is optional (but if data is returned, it must not be false).\n * @param token The token targeted by the call.\n * @param data The call data (encoded using abi.encode or one of its variants).\n */\n function _callOptionalReturn(IERC20 token, bytes memory data) private {\n // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since\n // we're implementing it ourselves. We use {Address.functionCall} to perform this call, which verifies that\n // the target address contains contract code and also asserts for success in the low-level call.\n\n bytes memory returndata = address(token).functionCall(data, \"SafeERC20: low-level call failed\");\n if (returndata.length > 0) {\n // Return data is optional\n require(abi.decode(returndata, (bool)), \"SafeERC20: ERC20 operation did not succeed\");\n }\n }\n}\n" - }, - "@openzeppelin/contracts/utils/Address.sol": { - "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Collection of functions related to the address type\n */\nlibrary Address {\n /**\n * @dev Returns true if `account` is a contract.\n *\n * [IMPORTANT]\n * ====\n * It is unsafe to assume that an address for which this function returns\n * false is an externally-owned account (EOA) and not a contract.\n *\n * Among others, `isContract` will return false for the following\n * types of addresses:\n *\n * - an externally-owned account\n * - a contract in construction\n * - an address where a contract will be created\n * - an address where a contract lived, but was destroyed\n * ====\n */\n function isContract(address account) internal view returns (bool) {\n // This method relies on extcodesize, which returns 0 for contracts in\n // construction, since the code is only stored at the end of the\n // constructor execution.\n\n uint256 size;\n assembly {\n size := extcodesize(account)\n }\n return size > 0;\n }\n\n /**\n * @dev Replacement for Solidity's `transfer`: sends `amount` wei to\n * `recipient`, forwarding all available gas and reverting on errors.\n *\n * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost\n * of certain opcodes, possibly making contracts go over the 2300 gas limit\n * imposed by `transfer`, making them unable to receive funds via\n * `transfer`. {sendValue} removes this limitation.\n *\n * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].\n *\n * IMPORTANT: because control is transferred to `recipient`, care must be\n * taken to not create reentrancy vulnerabilities. Consider using\n * {ReentrancyGuard} or the\n * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].\n */\n function sendValue(address payable recipient, uint256 amount) internal {\n require(address(this).balance >= amount, \"Address: insufficient balance\");\n\n (bool success, ) = recipient.call{value: amount}(\"\");\n require(success, \"Address: unable to send value, recipient may have reverted\");\n }\n\n /**\n * @dev Performs a Solidity function call using a low level `call`. A\n * plain `call` is an unsafe replacement for a function call: use this\n * function instead.\n *\n * If `target` reverts with a revert reason, it is bubbled up by this\n * function (like regular Solidity function calls).\n *\n * Returns the raw returned data. To convert to the expected return value,\n * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\n *\n * Requirements:\n *\n * - `target` must be a contract.\n * - calling `target` with `data` must not revert.\n *\n * _Available since v3.1._\n */\n function functionCall(address target, bytes memory data) internal returns (bytes memory) {\n return functionCall(target, data, \"Address: low-level call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with\n * `errorMessage` as a fallback revert reason when `target` reverts.\n *\n * _Available since v3.1._\n */\n function functionCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal returns (bytes memory) {\n return functionCallWithValue(target, data, 0, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but also transferring `value` wei to `target`.\n *\n * Requirements:\n *\n * - the calling contract must have an ETH balance of at least `value`.\n * - the called Solidity function must be `payable`.\n *\n * _Available since v3.1._\n */\n function functionCallWithValue(\n address target,\n bytes memory data,\n uint256 value\n ) internal returns (bytes memory) {\n return functionCallWithValue(target, data, value, \"Address: low-level call with value failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but\n * with `errorMessage` as a fallback revert reason when `target` reverts.\n *\n * _Available since v3.1._\n */\n function functionCallWithValue(\n address target,\n bytes memory data,\n uint256 value,\n string memory errorMessage\n ) internal returns (bytes memory) {\n require(address(this).balance >= value, \"Address: insufficient balance for call\");\n require(isContract(target), \"Address: call to non-contract\");\n\n (bool success, bytes memory returndata) = target.call{value: value}(data);\n return verifyCallResult(success, returndata, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but performing a static call.\n *\n * _Available since v3.3._\n */\n function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\n return functionStaticCall(target, data, \"Address: low-level static call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\n * but performing a static call.\n *\n * _Available since v3.3._\n */\n function functionStaticCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal view returns (bytes memory) {\n require(isContract(target), \"Address: static call to non-contract\");\n\n (bool success, bytes memory returndata) = target.staticcall(data);\n return verifyCallResult(success, returndata, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but performing a delegate call.\n *\n * _Available since v3.4._\n */\n function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {\n return functionDelegateCall(target, data, \"Address: low-level delegate call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\n * but performing a delegate call.\n *\n * _Available since v3.4._\n */\n function functionDelegateCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal returns (bytes memory) {\n require(isContract(target), \"Address: delegate call to non-contract\");\n\n (bool success, bytes memory returndata) = target.delegatecall(data);\n return verifyCallResult(success, returndata, errorMessage);\n }\n\n /**\n * @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the\n * revert reason using the provided one.\n *\n * _Available since v4.3._\n */\n function verifyCallResult(\n bool success,\n bytes memory returndata,\n string memory errorMessage\n ) internal pure returns (bytes memory) {\n if (success) {\n return returndata;\n } else {\n // Look for revert reason and bubble it up if present\n if (returndata.length > 0) {\n // The easiest way to bubble the revert reason is using memory via assembly\n\n assembly {\n let returndata_size := mload(returndata)\n revert(add(32, returndata), returndata_size)\n }\n } else {\n revert(errorMessage);\n }\n }\n }\n}\n" - }, - "solidity/contracts/peripherals/jobs/Keep3rJobMigration.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../../../interfaces/peripherals/IKeep3rJobs.sol';\nimport './Keep3rJobFundableCredits.sol';\nimport './Keep3rJobFundableLiquidity.sol';\n\nabstract contract Keep3rJobMigration is IKeep3rJobMigration, Keep3rJobFundableCredits, Keep3rJobFundableLiquidity {\n using EnumerableSet for EnumerableSet.AddressSet;\n\n uint256 internal constant _MIGRATION_COOLDOWN = 1 minutes;\n\n /// @inheritdoc IKeep3rJobMigration\n mapping(address => address) public override pendingJobMigrations;\n mapping(address => mapping(address => uint256)) internal _migrationCreatedAt;\n\n /// @inheritdoc IKeep3rJobMigration\n function migrateJob(address _fromJob, address _toJob) external override onlyJobOwner(_fromJob) {\n if (_fromJob == _toJob) revert JobMigrationImpossible();\n\n pendingJobMigrations[_fromJob] = _toJob;\n _migrationCreatedAt[_fromJob][_toJob] = block.timestamp;\n\n emit JobMigrationRequested(_fromJob, _toJob);\n }\n\n /// @inheritdoc IKeep3rJobMigration\n function acceptJobMigration(address _fromJob, address _toJob) external override onlyJobOwner(_toJob) {\n if (disputes[_fromJob] || disputes[_toJob]) revert JobDisputed();\n if (pendingJobMigrations[_fromJob] != _toJob) revert JobMigrationUnavailable();\n if (block.timestamp < _migrationCreatedAt[_fromJob][_toJob] + _MIGRATION_COOLDOWN) revert JobMigrationLocked();\n\n // force job credits update for both jobs\n _settleJobAccountance(_fromJob);\n _settleJobAccountance(_toJob);\n\n // migrate tokens\n while (_jobTokens[_fromJob].length() > 0) {\n address _tokenToMigrate = _jobTokens[_fromJob].at(0);\n jobTokenCredits[_toJob][_tokenToMigrate] += jobTokenCredits[_fromJob][_tokenToMigrate];\n delete jobTokenCredits[_fromJob][_tokenToMigrate];\n _jobTokens[_fromJob].remove(_tokenToMigrate);\n _jobTokens[_toJob].add(_tokenToMigrate);\n }\n\n // migrate liquidities\n while (_jobLiquidities[_fromJob].length() > 0) {\n address _liquidity = _jobLiquidities[_fromJob].at(0);\n\n liquidityAmount[_toJob][_liquidity] += liquidityAmount[_fromJob][_liquidity];\n delete liquidityAmount[_fromJob][_liquidity];\n\n _jobLiquidities[_toJob].add(_liquidity);\n _jobLiquidities[_fromJob].remove(_liquidity);\n }\n\n // migrate job balances\n _jobPeriodCredits[_toJob] += _jobPeriodCredits[_fromJob];\n delete _jobPeriodCredits[_fromJob];\n\n _jobLiquidityCredits[_toJob] += _jobLiquidityCredits[_fromJob];\n delete _jobLiquidityCredits[_fromJob];\n\n // stop _fromJob from being a job\n delete rewardedAt[_fromJob];\n _jobs.remove(_fromJob);\n\n // delete unused data slots\n delete jobOwner[_fromJob];\n delete jobPendingOwner[_fromJob];\n delete _migrationCreatedAt[_fromJob][_toJob];\n delete pendingJobMigrations[_fromJob];\n\n emit JobMigrationSuccessful(_fromJob, _toJob);\n }\n}\n" - }, - "solidity/interfaces/IKeep3rHelper.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport './IKeep3rHelperParameters.sol';\n\n/// @title Keep3rHelper contract\n/// @notice Contains all the helper functions used throughout the different files.\ninterface IKeep3rHelper is IKeep3rHelperParameters {\n // Errors\n\n /// @notice Throws when none of the tokens in the liquidity pair is KP3R\n error LiquidityPairInvalid();\n\n // Methods\n // solhint-enable func-name-mixedcase\n\n /// @notice Calculates the amount of KP3R that corresponds to the ETH passed into the function\n /// @dev This function allows us to calculate how much KP3R we should pay to a keeper for things expressed in ETH, like gas\n /// @param _eth The amount of ETH\n /// @return _amountOut The amount of KP3R\n function quote(uint256 _eth) external view returns (uint256 _amountOut);\n\n /// @notice Returns the amount of KP3R the keeper has bonded\n /// @param _keeper The address of the keeper to check\n /// @return _amountBonded The amount of KP3R the keeper has bonded\n function bonds(address _keeper) external view returns (uint256 _amountBonded);\n\n /// @notice Calculates the reward (in KP3R) that corresponds to a keeper for using gas\n /// @param _keeper The address of the keeper to check\n /// @param _gasUsed The amount of gas used that will be rewarded\n /// @return _kp3r The amount of KP3R that should be awarded to the keeper\n function getRewardAmountFor(address _keeper, uint256 _gasUsed) external view returns (uint256 _kp3r);\n\n /// @notice Calculates the boost in the reward given to a keeper based on the amount of KP3R that keeper has bonded\n /// @dev If the keeper has no bonds, boost should be +10% of gas cost, if keeper has max bonds, +20%\n /// @param _bonds The amount of KP3R tokens bonded by the keeper\n /// @return _rewardBoost The reward boost that corresponds to the keeper\n function getRewardBoostFor(uint256 _bonds) external view returns (uint256 _rewardBoost);\n\n /// @notice Calculates the reward (in KP3R) that corresponds to tx.origin for using gas\n /// @param _gasUsed The amount of gas used that will be rewarded\n /// @return _amount The amount of KP3R that should be awarded to tx.origin\n function getRewardAmount(uint256 _gasUsed) external view returns (uint256 _amount);\n\n /// @notice Given a pool address, returns the underlying tokens of the pair\n /// @param _pool Address of the correspondant pool\n /// @return _token0 Address of the first token of the pair\n /// @return _token1 Address of the second token of the pair\n function getPoolTokens(address _pool) external view returns (address _token0, address _token1);\n\n /// @notice Defines the order of the tokens in the pair for twap calculations\n /// @param _pool Address of the correspondant pool\n /// @return _isKP3RToken0 Boolean indicating the order of the tokens in the pair\n function isKP3RToken0(address _pool) external view returns (bool _isKP3RToken0);\n\n /// @notice Given an array of secondsAgo, returns UniswapV3 pool cumulatives at that moment\n /// @param _pool Address of the pool to observe\n /// @param _secondsAgo Array with time references to observe\n /// @return _tickCumulative1 Cumulative sum of ticks until first time reference\n /// @return _tickCumulative2 Cumulative sum of ticks until second time reference\n /// @return _success Boolean indicating if the observe call was succesfull\n function observe(address _pool, uint32[] memory _secondsAgo)\n external\n view\n returns (\n int56 _tickCumulative1,\n int56 _tickCumulative2,\n bool _success\n );\n\n /// @notice Get multiplier, quote, and extra, in order to calculate keeper payment\n /// @param _bonds Amount of bonded KP3R owned by the keeper\n /// @return _boost Multiplier per gas unit. Takes into account the base fee and the amount of bonded KP3R\n /// @return _oneEthQuote Amount of KP3R tokens equivalent to 1 ETH\n /// @return _extra Amount of extra gas that should be added to the gas spent\n function getPaymentParams(uint256 _bonds)\n external\n view\n returns (\n uint256 _boost,\n uint256 _oneEthQuote,\n uint256 _extra\n );\n\n /// @notice Given a tick and a liquidity amount, calculates the underlying KP3R tokens\n /// @param _liquidityAmount Amount of liquidity to be converted\n /// @param _tickDifference Tick value used to calculate the quote\n /// @param _timeInterval Time value used to calculate the quote\n /// @return _kp3rAmount Amount of KP3R tokens underlying on the given liquidity\n function getKP3RsAtTick(\n uint256 _liquidityAmount,\n int56 _tickDifference,\n uint256 _timeInterval\n ) external pure returns (uint256 _kp3rAmount);\n\n /// @notice Given a tick and a token amount, calculates the output in correspondant token\n /// @param _baseAmount Amount of token to be converted\n /// @param _tickDifference Tick value used to calculate the quote\n /// @param _timeInterval Time value used to calculate the quote\n /// @return _quoteAmount Amount of credits deserved for the baseAmount at the tick value\n function getQuoteAtTick(\n uint128 _baseAmount,\n int56 _tickDifference,\n uint256 _timeInterval\n ) external pure returns (uint256 _quoteAmount);\n}\n" - }, - "solidity/contracts/peripherals/jobs/Keep3rJobFundableCredits.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport './Keep3rJobOwnership.sol';\nimport '../Keep3rAccountance.sol';\nimport '../Keep3rParameters.sol';\nimport '../../../interfaces/peripherals/IKeep3rJobs.sol';\n\nimport '@openzeppelin/contracts/security/ReentrancyGuard.sol';\nimport '@openzeppelin/contracts/token/ERC20/IERC20.sol';\nimport '@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol';\nimport '@openzeppelin/contracts/utils/math/Math.sol';\n\nabstract contract Keep3rJobFundableCredits is IKeep3rJobFundableCredits, ReentrancyGuard, Keep3rJobOwnership, Keep3rParameters {\n using EnumerableSet for EnumerableSet.AddressSet;\n using SafeERC20 for IERC20;\n\n /// @notice Cooldown between withdrawals\n uint256 internal constant _WITHDRAW_TOKENS_COOLDOWN = 1 minutes;\n\n /// @inheritdoc IKeep3rJobFundableCredits\n mapping(address => mapping(address => uint256)) public override jobTokenCreditsAddedAt;\n\n /// @inheritdoc IKeep3rJobFundableCredits\n function addTokenCreditsToJob(\n address _job,\n address _token,\n uint256 _amount\n ) external override nonReentrant {\n if (!_jobs.contains(_job)) revert JobUnavailable();\n // KP3R shouldn't be used for direct token payments\n if (_token == keep3rV1) revert TokenUnallowed();\n uint256 _before = IERC20(_token).balanceOf(address(this));\n IERC20(_token).safeTransferFrom(msg.sender, address(this), _amount);\n uint256 _received = IERC20(_token).balanceOf(address(this)) - _before;\n uint256 _tokenFee = (_received * fee) / _BASE;\n jobTokenCredits[_job][_token] += _received - _tokenFee;\n jobTokenCreditsAddedAt[_job][_token] = block.timestamp;\n IERC20(_token).safeTransfer(governance, _tokenFee);\n _jobTokens[_job].add(_token);\n\n emit TokenCreditAddition(_job, _token, msg.sender, _received);\n }\n\n /// @inheritdoc IKeep3rJobFundableCredits\n function withdrawTokenCreditsFromJob(\n address _job,\n address _token,\n uint256 _amount,\n address _receiver\n ) external override nonReentrant onlyJobOwner(_job) {\n if (block.timestamp <= jobTokenCreditsAddedAt[_job][_token] + _WITHDRAW_TOKENS_COOLDOWN) revert JobTokenCreditsLocked();\n if (jobTokenCredits[_job][_token] < _amount) revert InsufficientJobTokenCredits();\n if (disputes[_job]) revert JobDisputed();\n\n jobTokenCredits[_job][_token] -= _amount;\n IERC20(_token).safeTransfer(_receiver, _amount);\n\n if (jobTokenCredits[_job][_token] == 0) {\n _jobTokens[_job].remove(_token);\n }\n\n emit TokenCreditWithdrawal(_job, _token, _receiver, _amount);\n }\n}\n" - }, - "solidity/contracts/peripherals/jobs/Keep3rJobFundableLiquidity.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport './Keep3rJobOwnership.sol';\nimport '../Keep3rAccountance.sol';\nimport '../Keep3rParameters.sol';\nimport '../../../interfaces/IPairManager.sol';\nimport '../../../interfaces/peripherals/IKeep3rJobs.sol';\n\nimport '../../libraries/FullMath.sol';\n\nimport '@openzeppelin/contracts/security/ReentrancyGuard.sol';\nimport '@openzeppelin/contracts/token/ERC20/IERC20.sol';\nimport '@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol';\nimport '@openzeppelin/contracts/utils/math/Math.sol';\n\nabstract contract Keep3rJobFundableLiquidity is IKeep3rJobFundableLiquidity, ReentrancyGuard, Keep3rJobOwnership, Keep3rParameters {\n using EnumerableSet for EnumerableSet.AddressSet;\n using SafeERC20 for IERC20;\n\n /// @notice List of liquidities that are accepted in the system\n EnumerableSet.AddressSet internal _approvedLiquidities;\n\n /// @inheritdoc IKeep3rJobFundableLiquidity\n mapping(address => mapping(address => uint256)) public override liquidityAmount;\n\n /// @inheritdoc IKeep3rJobFundableLiquidity\n mapping(address => uint256) public override rewardedAt;\n\n /// @inheritdoc IKeep3rJobFundableLiquidity\n mapping(address => uint256) public override workedAt;\n\n /// @notice Tracks an address and returns its TickCache\n mapping(address => TickCache) internal _tick;\n\n // Views\n\n /// @inheritdoc IKeep3rJobFundableLiquidity\n function approvedLiquidities() external view override returns (address[] memory _list) {\n _list = _approvedLiquidities.values();\n }\n\n /// @inheritdoc IKeep3rJobFundableLiquidity\n function jobPeriodCredits(address _job) public view override returns (uint256 _periodCredits) {\n for (uint256 i; i < _jobLiquidities[_job].length(); i++) {\n address _liquidity = _jobLiquidities[_job].at(i);\n if (_approvedLiquidities.contains(_liquidity)) {\n TickCache memory _tickCache = observeLiquidity(_liquidity);\n if (_tickCache.period != 0) {\n int56 _tickDifference = _isKP3RToken0[_liquidity] ? _tickCache.difference : -_tickCache.difference;\n _periodCredits += _getReward(\n IKeep3rHelper(keep3rHelper).getKP3RsAtTick(liquidityAmount[_job][_liquidity], _tickDifference, rewardPeriodTime)\n );\n }\n }\n }\n }\n\n /// @inheritdoc IKeep3rJobFundableLiquidity\n function jobLiquidityCredits(address _job) public view override returns (uint256 _liquidityCredits) {\n uint256 _periodCredits = jobPeriodCredits(_job);\n\n // If the job was rewarded in the past 1 period time\n if ((block.timestamp - rewardedAt[_job]) < rewardPeriodTime) {\n // If the job has period credits, update minted job credits to new twap\n _liquidityCredits = _periodCredits > 0\n ? (_jobLiquidityCredits[_job] * _periodCredits) / _jobPeriodCredits[_job] // If the job has period credits, return remaining job credits updated to new twap\n : _jobLiquidityCredits[_job]; // If not, return remaining credits, forced credits should not be updated\n } else {\n // Else return a full period worth of credits if current credits have expired\n _liquidityCredits = _periodCredits;\n }\n }\n\n /// @inheritdoc IKeep3rJobFundableLiquidity\n function totalJobCredits(address _job) external view override returns (uint256 _credits) {\n uint256 _periodCredits = jobPeriodCredits(_job);\n uint256 _cooldown = block.timestamp;\n\n if ((rewardedAt[_job] > _period(block.timestamp - rewardPeriodTime))) {\n // Will calculate cooldown if it outdated\n if ((block.timestamp - rewardedAt[_job]) >= rewardPeriodTime) {\n // Will calculate cooldown from last reward reference in this period\n _cooldown -= (rewardedAt[_job] + rewardPeriodTime);\n } else {\n // Will calculate cooldown from last reward timestamp\n _cooldown -= rewardedAt[_job];\n }\n } else {\n // Will calculate cooldown from period start if expired\n _cooldown -= _period(block.timestamp);\n }\n _credits = jobLiquidityCredits(_job) + _phase(_cooldown, _periodCredits);\n }\n\n /// @inheritdoc IKeep3rJobFundableLiquidity\n function quoteLiquidity(address _liquidity, uint256 _amount) external view override returns (uint256 _periodCredits) {\n if (_approvedLiquidities.contains(_liquidity)) {\n TickCache memory _tickCache = observeLiquidity(_liquidity);\n if (_tickCache.period != 0) {\n int56 _tickDifference = _isKP3RToken0[_liquidity] ? _tickCache.difference : -_tickCache.difference;\n return _getReward(IKeep3rHelper(keep3rHelper).getKP3RsAtTick(_amount, _tickDifference, rewardPeriodTime));\n }\n }\n }\n\n /// @inheritdoc IKeep3rJobFundableLiquidity\n function observeLiquidity(address _liquidity) public view virtual override returns (TickCache memory _tickCache) {\n if (_tick[_liquidity].period == _period(block.timestamp)) {\n // Will return cached twaps if liquidity is updated\n _tickCache = _tick[_liquidity];\n } else {\n bool success;\n uint256 lastPeriod = _period(block.timestamp - rewardPeriodTime);\n\n if (_tick[_liquidity].period == lastPeriod) {\n // Will only ask for current period accumulator if liquidity is outdated\n uint32[] memory _secondsAgo = new uint32[](1);\n int56 previousTick = _tick[_liquidity].current;\n\n _secondsAgo[0] = uint32(block.timestamp - _period(block.timestamp));\n\n (_tickCache.current, , success) = IKeep3rHelper(keep3rHelper).observe(_liquidityPool[_liquidity], _secondsAgo);\n\n _tickCache.difference = _tickCache.current - previousTick;\n } else if (_tick[_liquidity].period < lastPeriod) {\n // Will ask for 2 accumulators if liquidity is expired\n uint32[] memory _secondsAgo = new uint32[](2);\n\n _secondsAgo[0] = uint32(block.timestamp - _period(block.timestamp));\n _secondsAgo[1] = uint32(block.timestamp - _period(block.timestamp) + rewardPeriodTime);\n\n int56 _tickCumulative2;\n (_tickCache.current, _tickCumulative2, success) = IKeep3rHelper(keep3rHelper).observe(_liquidityPool[_liquidity], _secondsAgo);\n\n _tickCache.difference = _tickCache.current - _tickCumulative2;\n }\n if (success) {\n _tickCache.period = _period(block.timestamp);\n } else {\n delete _tickCache.period;\n }\n }\n }\n\n // Methods\n\n /// @inheritdoc IKeep3rJobFundableLiquidity\n function forceLiquidityCreditsToJob(address _job, uint256 _amount) external override onlyGovernance {\n if (!_jobs.contains(_job)) revert JobUnavailable();\n _settleJobAccountance(_job);\n _jobLiquidityCredits[_job] += _amount;\n emit LiquidityCreditsForced(_job, rewardedAt[_job], _jobLiquidityCredits[_job]);\n }\n\n /// @inheritdoc IKeep3rJobFundableLiquidity\n function approveLiquidity(address _liquidity) external virtual override onlyGovernance {\n if (!_approvedLiquidities.add(_liquidity)) revert LiquidityPairApproved();\n _liquidityPool[_liquidity] = IPairManager(_liquidity).pool();\n _isKP3RToken0[_liquidity] = IKeep3rHelper(keep3rHelper).isKP3RToken0(_liquidityPool[_liquidity]);\n _tick[_liquidity] = observeLiquidity(_liquidity);\n emit LiquidityApproval(_liquidity);\n }\n\n /// @inheritdoc IKeep3rJobFundableLiquidity\n function revokeLiquidity(address _liquidity) external override onlyGovernance {\n if (!_approvedLiquidities.remove(_liquidity)) revert LiquidityPairUnexistent();\n delete _liquidityPool[_liquidity];\n delete _isKP3RToken0[_liquidity];\n delete _tick[_liquidity];\n\n emit LiquidityRevocation(_liquidity);\n }\n\n /// @inheritdoc IKeep3rJobFundableLiquidity\n function addLiquidityToJob(\n address _job,\n address _liquidity,\n uint256 _amount\n ) external override nonReentrant {\n if (!_approvedLiquidities.contains(_liquidity)) revert LiquidityPairUnapproved();\n if (!_jobs.contains(_job)) revert JobUnavailable();\n\n _jobLiquidities[_job].add(_liquidity);\n\n _settleJobAccountance(_job);\n\n if (_quoteLiquidity(liquidityAmount[_job][_liquidity] + _amount, _liquidity) < liquidityMinimum) revert JobLiquidityLessThanMin();\n\n emit LiquidityCreditsReward(_job, rewardedAt[_job], _jobLiquidityCredits[_job], _jobPeriodCredits[_job]);\n\n IERC20(_liquidity).safeTransferFrom(msg.sender, address(this), _amount);\n liquidityAmount[_job][_liquidity] += _amount;\n _jobPeriodCredits[_job] += _getReward(_quoteLiquidity(_amount, _liquidity));\n emit LiquidityAddition(_job, _liquidity, msg.sender, _amount);\n }\n\n /// @inheritdoc IKeep3rJobFundableLiquidity\n function unbondLiquidityFromJob(\n address _job,\n address _liquidity,\n uint256 _amount\n ) external override onlyJobOwner(_job) {\n canWithdrawAfter[_job][_liquidity] = block.timestamp + unbondTime;\n pendingUnbonds[_job][_liquidity] += _amount;\n _unbondLiquidityFromJob(_job, _liquidity, _amount);\n\n uint256 _remainingLiquidity = liquidityAmount[_job][_liquidity];\n if (_remainingLiquidity > 0 && _quoteLiquidity(_remainingLiquidity, _liquidity) < liquidityMinimum) revert JobLiquidityLessThanMin();\n\n emit Unbonding(_job, _liquidity, _amount);\n }\n\n /// @inheritdoc IKeep3rJobFundableLiquidity\n function withdrawLiquidityFromJob(\n address _job,\n address _liquidity,\n address _receiver\n ) external override onlyJobOwner(_job) {\n if (_receiver == address(0)) revert ZeroAddress();\n if (pendingUnbonds[_job][_liquidity] == 0) revert UnbondsUnexistent();\n if (canWithdrawAfter[_job][_liquidity] >= block.timestamp) revert UnbondsLocked();\n if (disputes[_job]) revert Disputed();\n\n uint256 _amount = pendingUnbonds[_job][_liquidity];\n\n delete pendingUnbonds[_job][_liquidity];\n delete canWithdrawAfter[_job][_liquidity];\n\n IERC20(_liquidity).safeTransfer(_receiver, _amount);\n emit LiquidityWithdrawal(_job, _liquidity, _receiver, _amount);\n }\n\n // Internal functions\n\n /// @notice Updates or rewards job liquidity credits depending on time since last job reward\n function _updateJobCreditsIfNeeded(address _job) internal returns (bool _rewarded) {\n if (rewardedAt[_job] < _period(block.timestamp)) {\n // Will exit function if job has been rewarded in current period\n if (rewardedAt[_job] <= _period(block.timestamp - rewardPeriodTime)) {\n // Will reset job to period syncronicity if a full period passed without rewards\n _updateJobPeriod(_job);\n _jobLiquidityCredits[_job] = _jobPeriodCredits[_job];\n rewardedAt[_job] = _period(block.timestamp);\n _rewarded = true;\n } else if ((block.timestamp - rewardedAt[_job]) >= rewardPeriodTime) {\n // Will reset job's syncronicity if last reward was more than epoch ago\n _updateJobPeriod(_job);\n _jobLiquidityCredits[_job] = _jobPeriodCredits[_job];\n rewardedAt[_job] += rewardPeriodTime;\n _rewarded = true;\n } else if (workedAt[_job] < _period(block.timestamp)) {\n // First keeper on period has to update job accountance to current twaps\n uint256 previousPeriodCredits = _jobPeriodCredits[_job];\n _updateJobPeriod(_job);\n _jobLiquidityCredits[_job] = (_jobLiquidityCredits[_job] * _jobPeriodCredits[_job]) / previousPeriodCredits;\n // Updating job accountance does not reward job\n }\n }\n }\n\n /// @notice Only called if _jobLiquidityCredits < payment\n function _rewardJobCredits(address _job) internal {\n /// @notice Only way to += jobLiquidityCredits is when keeper rewarding (cannot pay work)\n /* WARNING: this allows to top up _jobLiquidityCredits to a max of 1.99 but have to spend at least 1 */\n _jobLiquidityCredits[_job] += _phase(block.timestamp - rewardedAt[_job], _jobPeriodCredits[_job]);\n rewardedAt[_job] = block.timestamp;\n }\n\n /// @notice Updates accountance for _jobPeriodCredits\n function _updateJobPeriod(address _job) internal {\n _jobPeriodCredits[_job] = _calculateJobPeriodCredits(_job);\n }\n\n /// @notice Quotes the outdated job liquidities and calculates _periodCredits\n /// @dev This function is also responsible for keeping the KP3R/WETH quote updated\n function _calculateJobPeriodCredits(address _job) internal returns (uint256 _periodCredits) {\n for (uint256 i; i < _jobLiquidities[_job].length(); i++) {\n address _liquidity = _jobLiquidities[_job].at(i);\n if (_approvedLiquidities.contains(_liquidity)) {\n if (_tick[_liquidity].period != _period(block.timestamp)) {\n // Updates liquidity cache only if needed\n _tick[_liquidity] = observeLiquidity(_liquidity);\n }\n _periodCredits += _getReward(_quoteLiquidity(liquidityAmount[_job][_liquidity], _liquidity));\n }\n }\n }\n\n /// @notice Updates job accountance calculating the impact of the unbonded liquidity amount\n function _unbondLiquidityFromJob(\n address _job,\n address _liquidity,\n uint256 _amount\n ) internal nonReentrant {\n if (!_jobLiquidities[_job].contains(_liquidity)) revert JobLiquidityUnexistent();\n if (liquidityAmount[_job][_liquidity] < _amount) revert JobLiquidityInsufficient();\n\n // Ensures current twaps in job liquidities\n _updateJobPeriod(_job);\n uint256 _periodCreditsToRemove = _getReward(_quoteLiquidity(_amount, _liquidity));\n\n // A liquidity can be revoked causing a job to have 0 periodCredits\n if (_jobPeriodCredits[_job] > 0) {\n // Removes a % correspondant to a full rewardPeriodTime for the liquidity withdrawn vs all of the liquidities\n _jobLiquidityCredits[_job] -= (_jobLiquidityCredits[_job] * _periodCreditsToRemove) / _jobPeriodCredits[_job];\n _jobPeriodCredits[_job] -= _periodCreditsToRemove;\n }\n\n liquidityAmount[_job][_liquidity] -= _amount;\n if (liquidityAmount[_job][_liquidity] == 0) {\n _jobLiquidities[_job].remove(_liquidity);\n }\n }\n\n /// @notice Returns a fraction of the multiplier or the whole multiplier if equal or more than a rewardPeriodTime has passed\n function _phase(uint256 _timePassed, uint256 _multiplier) internal view returns (uint256 _result) {\n if (_timePassed < rewardPeriodTime) {\n _result = (_timePassed * _multiplier) / rewardPeriodTime;\n } else _result = _multiplier;\n }\n\n /// @notice Returns the start of the period of the provided timestamp\n function _period(uint256 _timestamp) internal view returns (uint256 _periodTimestamp) {\n return _timestamp - (_timestamp % rewardPeriodTime);\n }\n\n /// @notice Calculates relation between rewardPeriod and inflationPeriod\n function _getReward(uint256 _baseAmount) internal view returns (uint256 _credits) {\n return FullMath.mulDiv(_baseAmount, rewardPeriodTime, inflationPeriod);\n }\n\n /// @notice Returns underlying KP3R amount for a given liquidity amount\n function _quoteLiquidity(uint256 _amount, address _liquidity) internal view returns (uint256 _quote) {\n if (_tick[_liquidity].period != 0) {\n int56 _tickDifference = _isKP3RToken0[_liquidity] ? _tick[_liquidity].difference : -_tick[_liquidity].difference;\n _quote = IKeep3rHelper(keep3rHelper).getKP3RsAtTick(_amount, _tickDifference, rewardPeriodTime);\n }\n }\n\n /// @notice Updates job credits to current quotes and rewards job's pending minted credits\n /// @dev Ensures a maximum of 1 period of credits\n function _settleJobAccountance(address _job) internal virtual {\n _updateJobCreditsIfNeeded(_job);\n _rewardJobCredits(_job);\n _jobLiquidityCredits[_job] = Math.min(_jobLiquidityCredits[_job], _jobPeriodCredits[_job]);\n }\n}\n" - }, - "solidity/contracts/peripherals/Keep3rParameters.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../../interfaces/IKeep3rHelper.sol';\nimport '../../interfaces/peripherals/IKeep3rParameters.sol';\nimport '../../interfaces/external/IKeep3rV1Proxy.sol';\nimport './Keep3rAccountance.sol';\n\nabstract contract Keep3rParameters is IKeep3rParameters, Keep3rAccountance {\n /// @inheritdoc IKeep3rParameters\n address public override keep3rV1;\n\n /// @inheritdoc IKeep3rParameters\n address public override keep3rV1Proxy;\n\n /// @inheritdoc IKeep3rParameters\n address public override keep3rHelper;\n\n /// @inheritdoc IKeep3rParameters\n uint256 public override bondTime = 3 days;\n\n /// @inheritdoc IKeep3rParameters\n uint256 public override unbondTime = 14 days;\n\n /// @inheritdoc IKeep3rParameters\n uint256 public override liquidityMinimum = 3 ether;\n\n /// @inheritdoc IKeep3rParameters\n uint256 public override rewardPeriodTime = 5 days;\n\n /// @inheritdoc IKeep3rParameters\n uint256 public override inflationPeriod = 34 days;\n\n /// @inheritdoc IKeep3rParameters\n uint256 public override fee = 30;\n\n /// @notice The base that will be used to calculate the fee\n uint256 internal constant _BASE = 10_000;\n\n /// @notice The minimum reward period\n uint256 internal constant _MIN_REWARD_PERIOD_TIME = 1 days;\n\n constructor(\n address _keep3rHelper,\n address _keep3rV1,\n address _keep3rV1Proxy\n ) {\n keep3rHelper = _keep3rHelper;\n keep3rV1 = _keep3rV1;\n keep3rV1Proxy = _keep3rV1Proxy;\n }\n\n /// @inheritdoc IKeep3rParameters\n function setKeep3rHelper(address _keep3rHelper) external override onlyGovernance {\n if (_keep3rHelper == address(0)) revert ZeroAddress();\n keep3rHelper = _keep3rHelper;\n emit Keep3rHelperChange(_keep3rHelper);\n }\n\n /// @inheritdoc IKeep3rParameters\n function setKeep3rV1(address _keep3rV1) public virtual override onlyGovernance {\n if (_keep3rV1 == address(0)) revert ZeroAddress();\n _mint(totalBonds);\n\n keep3rV1 = _keep3rV1;\n emit Keep3rV1Change(_keep3rV1);\n }\n\n /// @inheritdoc IKeep3rParameters\n function setKeep3rV1Proxy(address _keep3rV1Proxy) external override onlyGovernance {\n if (_keep3rV1Proxy == address(0)) revert ZeroAddress();\n keep3rV1Proxy = _keep3rV1Proxy;\n emit Keep3rV1ProxyChange(_keep3rV1Proxy);\n }\n\n /// @inheritdoc IKeep3rParameters\n function setBondTime(uint256 _bondTime) external override onlyGovernance {\n bondTime = _bondTime;\n emit BondTimeChange(_bondTime);\n }\n\n /// @inheritdoc IKeep3rParameters\n function setUnbondTime(uint256 _unbondTime) external override onlyGovernance {\n unbondTime = _unbondTime;\n emit UnbondTimeChange(_unbondTime);\n }\n\n /// @inheritdoc IKeep3rParameters\n function setLiquidityMinimum(uint256 _liquidityMinimum) external override onlyGovernance {\n liquidityMinimum = _liquidityMinimum;\n emit LiquidityMinimumChange(_liquidityMinimum);\n }\n\n /// @inheritdoc IKeep3rParameters\n function setRewardPeriodTime(uint256 _rewardPeriodTime) external override onlyGovernance {\n if (_rewardPeriodTime < _MIN_REWARD_PERIOD_TIME) revert MinRewardPeriod();\n rewardPeriodTime = _rewardPeriodTime;\n emit RewardPeriodTimeChange(_rewardPeriodTime);\n }\n\n /// @inheritdoc IKeep3rParameters\n function setInflationPeriod(uint256 _inflationPeriod) external override onlyGovernance {\n inflationPeriod = _inflationPeriod;\n emit InflationPeriodChange(_inflationPeriod);\n }\n\n /// @inheritdoc IKeep3rParameters\n function setFee(uint256 _fee) external override onlyGovernance {\n fee = _fee;\n emit FeeChange(_fee);\n }\n\n function _mint(uint256 _amount) internal {\n totalBonds -= _amount;\n IKeep3rV1Proxy(keep3rV1Proxy).mint(_amount);\n }\n}\n" - }, - "@openzeppelin/contracts/security/ReentrancyGuard.sol": { - "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Contract module that helps prevent reentrant calls to a function.\n *\n * Inheriting from `ReentrancyGuard` will make the {nonReentrant} modifier\n * available, which can be applied to functions to make sure there are no nested\n * (reentrant) calls to them.\n *\n * Note that because there is a single `nonReentrant` guard, functions marked as\n * `nonReentrant` may not call one another. This can be worked around by making\n * those functions `private`, and then adding `external` `nonReentrant` entry\n * points to them.\n *\n * TIP: If you would like to learn more about reentrancy and alternative ways\n * to protect against it, check out our blog post\n * https://blog.openzeppelin.com/reentrancy-after-istanbul/[Reentrancy After Istanbul].\n */\nabstract contract ReentrancyGuard {\n // Booleans are more expensive than uint256 or any type that takes up a full\n // word because each write operation emits an extra SLOAD to first read the\n // slot's contents, replace the bits taken up by the boolean, and then write\n // back. This is the compiler's defense against contract upgrades and\n // pointer aliasing, and it cannot be disabled.\n\n // The values being non-zero value makes deployment a bit more expensive,\n // but in exchange the refund on every call to nonReentrant will be lower in\n // amount. Since refunds are capped to a percentage of the total\n // transaction's gas, it is best to keep them low in cases like this one, to\n // increase the likelihood of the full refund coming into effect.\n uint256 private constant _NOT_ENTERED = 1;\n uint256 private constant _ENTERED = 2;\n\n uint256 private _status;\n\n constructor() {\n _status = _NOT_ENTERED;\n }\n\n /**\n * @dev Prevents a contract from calling itself, directly or indirectly.\n * Calling a `nonReentrant` function from another `nonReentrant`\n * function is not supported. It is possible to prevent this from happening\n * by making the `nonReentrant` function external, and make it call a\n * `private` function that does the actual work.\n */\n modifier nonReentrant() {\n // On the first call to nonReentrant, _notEntered will be true\n require(_status != _ENTERED, \"ReentrancyGuard: reentrant call\");\n\n // Any calls to nonReentrant after this point will fail\n _status = _ENTERED;\n\n _;\n\n // By storing the original value once again, a refund is triggered (see\n // https://eips.ethereum.org/EIPS/eip-2200)\n _status = _NOT_ENTERED;\n }\n}\n" - }, - "@openzeppelin/contracts/utils/math/Math.sol": { - "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Standard math utilities missing in the Solidity language.\n */\nlibrary Math {\n /**\n * @dev Returns the largest of two numbers.\n */\n function max(uint256 a, uint256 b) internal pure returns (uint256) {\n return a >= b ? a : b;\n }\n\n /**\n * @dev Returns the smallest of two numbers.\n */\n function min(uint256 a, uint256 b) internal pure returns (uint256) {\n return a < b ? a : b;\n }\n\n /**\n * @dev Returns the average of two numbers. The result is rounded towards\n * zero.\n */\n function average(uint256 a, uint256 b) internal pure returns (uint256) {\n // (a + b) / 2 can overflow.\n return (a & b) + (a ^ b) / 2;\n }\n\n /**\n * @dev Returns the ceiling of the division of two numbers.\n *\n * This differs from standard division with `/` in that it rounds up instead\n * of rounding down.\n */\n function ceilDiv(uint256 a, uint256 b) internal pure returns (uint256) {\n // (a + b - 1) / b can overflow on addition, so we distribute.\n return a / b + (a % b == 0 ? 0 : 1);\n }\n}\n" - }, - "solidity/interfaces/external/IKeep3rV1Proxy.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../peripherals/IGovernable.sol';\n\ninterface IKeep3rV1Proxy is IGovernable {\n // Structs\n struct Recipient {\n address recipient;\n uint256 caps;\n }\n\n // Variables\n function keep3rV1() external view returns (address);\n\n function minter() external view returns (address);\n\n function next(address) external view returns (uint256);\n\n function caps(address) external view returns (uint256);\n\n function recipients() external view returns (address[] memory);\n\n function recipientsCaps() external view returns (Recipient[] memory);\n\n // Errors\n error Cooldown();\n error NoDrawableAmount();\n error ZeroAddress();\n error OnlyMinter();\n\n // Methods\n function addRecipient(address recipient, uint256 amount) external;\n\n function removeRecipient(address recipient) external;\n\n function draw() external returns (uint256 _amount);\n\n function setKeep3rV1(address _keep3rV1) external;\n\n function setMinter(address _minter) external;\n\n function mint(uint256 _amount) external;\n\n function mint(address _account, uint256 _amount) external;\n\n function setKeep3rV1Governance(address _governance) external;\n\n function acceptKeep3rV1Governance() external;\n\n function dispute(address _keeper) external;\n\n function slash(\n address _bonded,\n address _keeper,\n uint256 _amount\n ) external;\n\n function revoke(address _keeper) external;\n\n function resolve(address _keeper) external;\n\n function addJob(address _job) external;\n\n function removeJob(address _job) external;\n\n function addKPRCredit(address _job, uint256 _amount) external;\n\n function approveLiquidity(address _liquidity) external;\n\n function revokeLiquidity(address _liquidity) external;\n\n function setKeep3rHelper(address _keep3rHelper) external;\n\n function addVotes(address _voter, uint256 _amount) external;\n\n function removeVotes(address _voter, uint256 _amount) external;\n}\n" - }, - "solidity/interfaces/IKeep3rHelperParameters.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\n/// @title Keep3rHelperParameters contract\n/// @notice Contains all the helper functions used throughout the different files.\ninterface IKeep3rHelperParameters {\n // Structs\n\n /// @dev KP3R-WETH Pool address and isKP3RToken0\n /// @dev Created in order to save gas by avoiding calls to pool's token0 method\n struct TokenOraclePool {\n address poolAddress;\n bool isTKNToken0;\n }\n\n // Errors\n\n /// @notice Throws when pool does not have KP3R as token0 nor token1\n error InvalidOraclePool();\n\n // Events\n\n /// @notice Emitted when the kp3r weth pool is changed\n /// @param _address Address of the new kp3r weth pool\n /// @param _isKP3RToken0 True if calling the token0 method of the pool returns the KP3R token address\n event Kp3rWethPoolChange(address _address, bool _isKP3RToken0);\n\n /// @notice Emitted when the minimum boost multiplier is changed\n /// @param _minBoost The minimum boost multiplier\n event MinBoostChange(uint256 _minBoost);\n\n /// @notice Emitted when the maximum boost multiplier is changed\n /// @param _maxBoost The maximum boost multiplier\n event MaxBoostChange(uint256 _maxBoost);\n\n /// @notice Emitted when the target bond amount is changed\n /// @param _targetBond The target bond amount\n event TargetBondChange(uint256 _targetBond);\n\n /// @notice Emitted when the Keep3r V2 address is changed\n /// @param _keep3rV2 The address of Keep3r V2\n event Keep3rV2Change(address _keep3rV2);\n\n /// @notice Emitted when the work extra gas amount is changed\n /// @param _workExtraGas The work extra gas\n event WorkExtraGasChange(uint256 _workExtraGas);\n\n /// @notice Emitted when the quote twap time is changed\n /// @param _quoteTwapTime The twap time for quoting\n event QuoteTwapTimeChange(uint32 _quoteTwapTime);\n\n /// @notice Emitted when minimum rewarded gas fee is changed\n /// @param _minBaseFee The minimum rewarded gas fee\n event MinBaseFeeChange(uint256 _minBaseFee);\n\n /// @notice Emitted when minimum rewarded priority fee is changed\n /// @param _minPriorityFee The minimum expected fee that the keeper should pay\n event MinPriorityFeeChange(uint256 _minPriorityFee);\n\n // Variables\n\n /// @notice Address of KP3R token\n /// @return _kp3r Address of KP3R token\n // solhint-disable func-name-mixedcase\n function KP3R() external view returns (address _kp3r);\n\n /// @notice The boost base used to calculate the boost rewards for the keeper\n /// @return _base The boost base number\n function BOOST_BASE() external view returns (uint256 _base);\n\n /// @notice KP3R-WETH pool that is being used as oracle\n /// @return poolAddress Address of the pool\n /// @return isTKNToken0 True if calling the token0 method of the pool returns the KP3R token address\n function kp3rWethPool() external view returns (address poolAddress, bool isTKNToken0);\n\n /// @notice The minimum multiplier used to calculate the amount of gas paid to the Keeper for the gas used to perform a job\n /// For example: if the quoted gas used is 1000, then the minimum amount to be paid will be 1000 * minBoost / BOOST_BASE\n /// @return _multiplier The minimum boost multiplier\n function minBoost() external view returns (uint256 _multiplier);\n\n /// @notice The maximum multiplier used to calculate the amount of gas paid to the Keeper for the gas used to perform a job\n /// For example: if the quoted gas used is 1000, then the maximum amount to be paid will be 1000 * maxBoost / BOOST_BASE\n /// @return _multiplier The maximum boost multiplier\n function maxBoost() external view returns (uint256 _multiplier);\n\n /// @notice The targeted amount of bonded KP3Rs to max-up reward multiplier\n /// For example: if the amount of KP3R the keeper has bonded is targetBond or more, then the keeper will get\n /// the maximum boost possible in his rewards, if it's less, the reward boost will be proportional\n /// @return _target The amount of KP3R that comforms the targetBond\n function targetBond() external view returns (uint256 _target);\n\n /// @notice The amount of unaccounted gas that is going to be added to keeper payments\n /// @return _workExtraGas The work unaccounted gas amount\n function workExtraGas() external view returns (uint256 _workExtraGas);\n\n /// @notice The twap time for quoting\n /// @return _quoteTwapTime The twap time\n function quoteTwapTime() external view returns (uint32 _quoteTwapTime);\n\n /// @notice The minimum base fee that is used to calculate keeper rewards\n /// @return _minBaseFee The minimum rewarded gas fee\n function minBaseFee() external view returns (uint256 _minBaseFee);\n\n /// @notice The minimum priority fee that is also rewarded for keepers\n /// @return _minPriorityFee The minimum rewarded priority fee\n function minPriorityFee() external view returns (uint256 _minPriorityFee);\n\n /// @notice Address of Keep3r V2\n /// @return _keep3rV2 Address of Keep3r V2\n function keep3rV2() external view returns (address _keep3rV2);\n\n // Methods\n\n /// @notice Sets KP3R-WETH pool\n /// @param _poolAddress The address of the KP3R-WETH pool\n function setKp3rWethPool(address _poolAddress) external;\n\n /// @notice Sets the minimum boost multiplier\n /// @param _minBoost The minimum boost multiplier\n function setMinBoost(uint256 _minBoost) external;\n\n /// @notice Sets the maximum boost multiplier\n /// @param _maxBoost The maximum boost multiplier\n function setMaxBoost(uint256 _maxBoost) external;\n\n /// @notice Sets the target bond amount\n /// @param _targetBond The target bond amount\n function setTargetBond(uint256 _targetBond) external;\n\n /// @notice Sets the Keep3r V2 address\n /// @param _keep3rV2 The address of Keep3r V2\n function setKeep3rV2(address _keep3rV2) external;\n\n /// @notice Sets the work extra gas amount\n /// @param _workExtraGas The work extra gas\n function setWorkExtraGas(uint256 _workExtraGas) external;\n\n /// @notice Sets the quote twap time\n /// @param _quoteTwapTime The twap time for quoting\n function setQuoteTwapTime(uint32 _quoteTwapTime) external;\n\n /// @notice Sets the minimum rewarded gas fee\n /// @param _minBaseFee The minimum rewarded gas fee\n function setMinBaseFee(uint256 _minBaseFee) external;\n\n /// @notice Sets the minimum rewarded gas priority fee\n /// @param _minPriorityFee The minimum rewarded priority fee\n function setMinPriorityFee(uint256 _minPriorityFee) external;\n}\n" - }, - "solidity/interfaces/IPairManager.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol';\n\n/// @title Pair Manager interface\n/// @notice Generic interface for Keep3r liquidity pools (kLP)\ninterface IPairManager is IERC20Metadata {\n /// @notice Address of the factory from which the pair manager was created\n /// @return _factory The address of the PairManager Factory\n function factory() external view returns (address _factory);\n\n /// @notice Address of the pool from which the Keep3r pair manager will interact with\n /// @return _pool The address of the pool\n function pool() external view returns (address _pool);\n\n /// @notice Token0 of the pool\n /// @return _token0 The address of token0\n function token0() external view returns (address _token0);\n\n /// @notice Token1 of the pool\n /// @return _token1 The address of token1\n function token1() external view returns (address _token1);\n}\n" - }, - "solidity/contracts/libraries/FullMath.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\n/// @title Contains 512-bit math functions\n/// @notice Facilitates multiplication and division that can have overflow of an intermediate value without any loss of precision\n/// @dev Handles \"phantom overflow\" i.e., allows multiplication and division where an intermediate value overflows 256 bits\nlibrary FullMath {\n /// @notice Calculates floor(a×b÷denominator) with full precision. Throws if result overflows a uint256 or denominator == 0\n /// @param a The multiplicand\n /// @param b The multiplier\n /// @param denominator The divisor\n /// @return result The 256-bit result\n /// @dev Credit to Remco Bloemen under MIT license https://xn--2-umb.com/21/muldiv\n function mulDiv(\n uint256 a,\n uint256 b,\n uint256 denominator\n ) internal pure returns (uint256 result) {\n unchecked {\n // 512-bit multiply [prod1 prod0] = a * b\n // Compute the product mod 2**256 and mod 2**256 - 1\n // then use the Chinese Remainder Theorem to reconstruct\n // the 512 bit result. The result is stored in two 256\n // variables such that product = prod1 * 2**256 + prod0\n uint256 prod0; // Least significant 256 bits of the product\n uint256 prod1; // Most significant 256 bits of the product\n assembly {\n let mm := mulmod(a, b, not(0))\n prod0 := mul(a, b)\n prod1 := sub(sub(mm, prod0), lt(mm, prod0))\n }\n\n // Handle non-overflow cases, 256 by 256 division\n if (prod1 == 0) {\n require(denominator > 0);\n assembly {\n result := div(prod0, denominator)\n }\n return result;\n }\n\n // Make sure the result is less than 2**256.\n // Also prevents denominator == 0\n require(denominator > prod1);\n\n ///////////////////////////////////////////////\n // 512 by 256 division.\n ///////////////////////////////////////////////\n\n // Make division exact by subtracting the remainder from [prod1 prod0]\n // Compute remainder using mulmod\n uint256 remainder;\n assembly {\n remainder := mulmod(a, b, denominator)\n }\n // Subtract 256 bit number from 512 bit number\n assembly {\n prod1 := sub(prod1, gt(remainder, prod0))\n prod0 := sub(prod0, remainder)\n }\n\n // Factor powers of two out of denominator\n // Compute largest power of two divisor of denominator.\n // Always >= 1.\n uint256 twos = (~denominator + 1) & denominator;\n // Divide denominator by power of two\n assembly {\n denominator := div(denominator, twos)\n }\n\n // Divide [prod1 prod0] by the factors of two\n assembly {\n prod0 := div(prod0, twos)\n }\n // Shift in bits from prod1 into prod0. For this we need\n // to flip `twos` such that it is 2**256 / twos.\n // If twos is zero, then it becomes one\n assembly {\n twos := add(div(sub(0, twos), twos), 1)\n }\n prod0 |= prod1 * twos;\n\n // Invert denominator mod 2**256\n // Now that denominator is an odd number, it has an inverse\n // modulo 2**256 such that denominator * inv = 1 mod 2**256.\n // Compute the inverse by starting with a seed that is correct\n // correct for four bits. That is, denominator * inv = 1 mod 2**4\n uint256 inv = (3 * denominator) ^ 2;\n // Now use Newton-Raphson iteration to improve the precision.\n // Thanks to Hensel's lifting lemma, this also works in modular\n // arithmetic, doubling the correct bits in each step.\n inv *= 2 - denominator * inv; // inverse mod 2**8\n inv *= 2 - denominator * inv; // inverse mod 2**16\n inv *= 2 - denominator * inv; // inverse mod 2**32\n inv *= 2 - denominator * inv; // inverse mod 2**64\n inv *= 2 - denominator * inv; // inverse mod 2**128\n inv *= 2 - denominator * inv; // inverse mod 2**256\n\n // Because the division is now exact we can divide by multiplying\n // with the modular inverse of denominator. This will give us the\n // correct result modulo 2**256. Since the precoditions guarantee\n // that the outcome is less than 2**256, this is the final result.\n // We don't need to compute the high bits of the result and prod1\n // is no longer required.\n result = prod0 * inv;\n return result;\n }\n }\n\n /// @notice Calculates ceil(a×b÷denominator) with full precision. Throws if result overflows a uint256 or denominator == 0\n /// @param a The multiplicand\n /// @param b The multiplier\n /// @param denominator The divisor\n /// @return result The 256-bit result\n function mulDivRoundingUp(\n uint256 a,\n uint256 b,\n uint256 denominator\n ) internal pure returns (uint256 result) {\n unchecked {\n result = mulDiv(a, b, denominator);\n if (mulmod(a, b, denominator) > 0) {\n require(result < type(uint256).max);\n result++;\n }\n }\n }\n}\n" - }, - "@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol": { - "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\nimport \"../IERC20.sol\";\n\n/**\n * @dev Interface for the optional metadata functions from the ERC20 standard.\n *\n * _Available since v4.1._\n */\ninterface IERC20Metadata is IERC20 {\n /**\n * @dev Returns the name of the token.\n */\n function name() external view returns (string memory);\n\n /**\n * @dev Returns the symbol of the token.\n */\n function symbol() external view returns (string memory);\n\n /**\n * @dev Returns the decimals places of the token.\n */\n function decimals() external view returns (uint8);\n}\n" - }, - "solidity/contracts/peripherals/Keep3rDisputable.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport './Keep3rParameters.sol';\nimport '../../interfaces/peripherals/IKeep3rDisputable.sol';\n\nabstract contract Keep3rDisputable is IKeep3rDisputable, Keep3rParameters {\n /// @inheritdoc IKeep3rDisputable\n function dispute(address _jobOrKeeper) external override onlyDisputer {\n if (disputes[_jobOrKeeper]) revert AlreadyDisputed();\n disputes[_jobOrKeeper] = true;\n emit Dispute(_jobOrKeeper, msg.sender);\n }\n\n /// @inheritdoc IKeep3rDisputable\n function resolve(address _jobOrKeeper) external override onlyDisputer {\n if (!disputes[_jobOrKeeper]) revert NotDisputed();\n disputes[_jobOrKeeper] = false;\n emit Resolve(_jobOrKeeper, msg.sender);\n }\n}\n" - }, - "solidity/contracts/peripherals/keepers/Keep3rKeeperDisputable.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport './Keep3rKeeperFundable.sol';\nimport '../Keep3rDisputable.sol';\nimport '../../../interfaces/external/IKeep3rV1.sol';\nimport '../../../interfaces/peripherals/IKeep3rKeepers.sol';\n\nabstract contract Keep3rKeeperDisputable is IKeep3rKeeperDisputable, Keep3rDisputable, Keep3rKeeperFundable {\n using EnumerableSet for EnumerableSet.AddressSet;\n using SafeERC20 for IERC20;\n\n /// @inheritdoc IKeep3rKeeperDisputable\n function slash(\n address _keeper,\n address _bonded,\n uint256 _bondAmount,\n uint256 _unbondAmount\n ) external override onlySlasher {\n if (!disputes[_keeper]) revert NotDisputed();\n _slash(_keeper, _bonded, _bondAmount, _unbondAmount);\n emit KeeperSlash(_keeper, msg.sender, _bondAmount + _unbondAmount);\n }\n\n /// @inheritdoc IKeep3rKeeperDisputable\n function revoke(address _keeper) external override onlySlasher {\n if (!disputes[_keeper]) revert NotDisputed();\n _keepers.remove(_keeper);\n _slash(_keeper, keep3rV1, bonds[_keeper][keep3rV1], pendingUnbonds[_keeper][keep3rV1]);\n emit KeeperRevoke(_keeper, msg.sender);\n }\n\n function _slash(\n address _keeper,\n address _bonded,\n uint256 _bondAmount,\n uint256 _unbondAmount\n ) internal {\n if (_bonded != keep3rV1) {\n try IERC20(_bonded).transfer(governance, _bondAmount + _unbondAmount) returns (bool) {} catch (bytes memory) {}\n }\n bonds[_keeper][_bonded] -= _bondAmount;\n pendingUnbonds[_keeper][_bonded] -= _unbondAmount;\n }\n}\n" - }, - "solidity/contracts/peripherals/keepers/Keep3rKeeperFundable.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../Keep3rAccountance.sol';\nimport '../Keep3rParameters.sol';\nimport '../../../interfaces/peripherals/IKeep3rKeepers.sol';\n\nimport '../../../interfaces/external/IKeep3rV1.sol';\n\nimport '@openzeppelin/contracts/security/ReentrancyGuard.sol';\nimport '@openzeppelin/contracts/token/ERC20/IERC20.sol';\nimport '@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol';\n\nabstract contract Keep3rKeeperFundable is IKeep3rKeeperFundable, ReentrancyGuard, Keep3rParameters {\n using EnumerableSet for EnumerableSet.AddressSet;\n using SafeERC20 for IERC20;\n\n /// @inheritdoc IKeep3rKeeperFundable\n function bond(address _bonding, uint256 _amount) external override nonReentrant {\n if (disputes[msg.sender]) revert Disputed();\n if (_jobs.contains(msg.sender)) revert AlreadyAJob();\n canActivateAfter[msg.sender][_bonding] = block.timestamp + bondTime;\n\n uint256 _before = IERC20(_bonding).balanceOf(address(this));\n IERC20(_bonding).safeTransferFrom(msg.sender, address(this), _amount);\n _amount = IERC20(_bonding).balanceOf(address(this)) - _before;\n\n hasBonded[msg.sender] = true;\n pendingBonds[msg.sender][_bonding] += _amount;\n\n emit Bonding(msg.sender, _bonding, _amount);\n }\n\n /// @inheritdoc IKeep3rKeeperFundable\n function activate(address _bonding) external override {\n address _keeper = msg.sender;\n if (disputes[_keeper]) revert Disputed();\n uint256 _canActivateAfter = canActivateAfter[_keeper][_bonding];\n if (_canActivateAfter == 0) revert BondsUnexistent();\n if (_canActivateAfter >= block.timestamp) revert BondsLocked();\n\n if (firstSeen[_keeper] == 0) {\n firstSeen[_keeper] = block.timestamp;\n }\n _keepers.add(_keeper);\n\n uint256 _amount = pendingBonds[_keeper][_bonding];\n delete pendingBonds[_keeper][_bonding];\n\n // bond provided tokens\n bonds[_keeper][_bonding] += _amount;\n if (_bonding == keep3rV1) {\n totalBonds += _amount;\n _depositBonds(_amount);\n }\n\n emit Activation(_keeper, _bonding, _amount);\n }\n\n /// @inheritdoc IKeep3rKeeperFundable\n function unbond(address _bonding, uint256 _amount) external override {\n canWithdrawAfter[msg.sender][_bonding] = block.timestamp + unbondTime;\n bonds[msg.sender][_bonding] -= _amount;\n pendingUnbonds[msg.sender][_bonding] += _amount;\n\n emit Unbonding(msg.sender, _bonding, _amount);\n }\n\n /// @inheritdoc IKeep3rKeeperFundable\n function withdraw(address _bonding) external override nonReentrant {\n if (pendingUnbonds[msg.sender][_bonding] == 0) revert UnbondsUnexistent();\n if (canWithdrawAfter[msg.sender][_bonding] >= block.timestamp) revert UnbondsLocked();\n if (disputes[msg.sender]) revert Disputed();\n\n uint256 _amount = pendingUnbonds[msg.sender][_bonding];\n\n delete pendingUnbonds[msg.sender][_bonding];\n delete canWithdrawAfter[msg.sender][_bonding];\n\n if (_bonding == keep3rV1) _mint(_amount);\n IERC20(_bonding).safeTransfer(msg.sender, _amount);\n\n emit Withdrawal(msg.sender, _bonding, _amount);\n }\n\n function _depositBonds(uint256 _amount) internal virtual {\n IKeep3rV1(keep3rV1).burn(_amount);\n }\n}\n" - }, - "solidity/interfaces/external/IKeep3rV1.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '@openzeppelin/contracts/token/ERC20/IERC20.sol';\nimport '@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol';\n\n// solhint-disable func-name-mixedcase\ninterface IKeep3rV1 is IERC20, IERC20Metadata {\n // Structs\n struct Checkpoint {\n uint32 fromBlock;\n uint256 votes;\n }\n\n // Events\n event DelegateChanged(address indexed _delegator, address indexed _fromDelegate, address indexed _toDelegate);\n event DelegateVotesChanged(address indexed _delegate, uint256 _previousBalance, uint256 _newBalance);\n event SubmitJob(address indexed _job, address indexed _liquidity, address indexed _provider, uint256 _block, uint256 _credit);\n event ApplyCredit(address indexed _job, address indexed _liquidity, address indexed _provider, uint256 _block, uint256 _credit);\n event RemoveJob(address indexed _job, address indexed _liquidity, address indexed _provider, uint256 _block, uint256 _credit);\n event UnbondJob(address indexed _job, address indexed _liquidity, address indexed _provider, uint256 _block, uint256 _credit);\n event JobAdded(address indexed _job, uint256 _block, address _governance);\n event JobRemoved(address indexed _job, uint256 _block, address _governance);\n event KeeperWorked(address indexed _credit, address indexed _job, address indexed _keeper, uint256 _block, uint256 _amount);\n event KeeperBonding(address indexed _keeper, uint256 _block, uint256 _active, uint256 _bond);\n event KeeperBonded(address indexed _keeper, uint256 _block, uint256 _activated, uint256 _bond);\n event KeeperUnbonding(address indexed _keeper, uint256 _block, uint256 _deactive, uint256 _bond);\n event KeeperUnbound(address indexed _keeper, uint256 _block, uint256 _deactivated, uint256 _bond);\n event KeeperSlashed(address indexed _keeper, address indexed _slasher, uint256 _block, uint256 _slash);\n event KeeperDispute(address indexed _keeper, uint256 _block);\n event KeeperResolved(address indexed _keeper, uint256 _block);\n event TokenCreditAddition(address indexed _credit, address indexed _job, address indexed _creditor, uint256 _block, uint256 _amount);\n\n // Variables\n function KPRH() external returns (address);\n\n function delegates(address _delegator) external view returns (address);\n\n function checkpoints(address _account, uint32 _checkpoint) external view returns (Checkpoint memory);\n\n function numCheckpoints(address _account) external view returns (uint32);\n\n function DOMAIN_TYPEHASH() external returns (bytes32);\n\n function DOMAINSEPARATOR() external returns (bytes32);\n\n function DELEGATION_TYPEHASH() external returns (bytes32);\n\n function PERMIT_TYPEHASH() external returns (bytes32);\n\n function nonces(address _user) external view returns (uint256);\n\n function BOND() external returns (uint256);\n\n function UNBOND() external returns (uint256);\n\n function LIQUIDITYBOND() external returns (uint256);\n\n function FEE() external returns (uint256);\n\n function BASE() external returns (uint256);\n\n function ETH() external returns (address);\n\n function bondings(address _user, address _bonding) external view returns (uint256);\n\n function canWithdrawAfter(address _user, address _bonding) external view returns (uint256);\n\n function pendingUnbonds(address _keeper, address _bonding) external view returns (uint256);\n\n function pendingbonds(address _keeper, address _bonding) external view returns (uint256);\n\n function bonds(address _keeper, address _bonding) external view returns (uint256);\n\n function votes(address _delegator) external view returns (uint256);\n\n function firstSeen(address _keeper) external view returns (uint256);\n\n function disputes(address _keeper) external view returns (bool);\n\n function lastJob(address _keeper) external view returns (uint256);\n\n function workCompleted(address _keeper) external view returns (uint256);\n\n function jobs(address _job) external view returns (bool);\n\n function credits(address _job, address _credit) external view returns (uint256);\n\n function liquidityProvided(\n address _provider,\n address _liquidity,\n address _job\n ) external view returns (uint256);\n\n function liquidityUnbonding(\n address _provider,\n address _liquidity,\n address _job\n ) external view returns (uint256);\n\n function liquidityAmountsUnbonding(\n address _provider,\n address _liquidity,\n address _job\n ) external view returns (uint256);\n\n function jobProposalDelay(address _job) external view returns (uint256);\n\n function liquidityApplied(\n address _provider,\n address _liquidity,\n address _job\n ) external view returns (uint256);\n\n function liquidityAmount(\n address _provider,\n address _liquidity,\n address _job\n ) external view returns (uint256);\n\n function keepers(address _keeper) external view returns (bool);\n\n function blacklist(address _keeper) external view returns (bool);\n\n function keeperList(uint256 _index) external view returns (address);\n\n function jobList(uint256 _index) external view returns (address);\n\n function governance() external returns (address);\n\n function pendingGovernance() external returns (address);\n\n function liquidityAccepted(address _liquidity) external view returns (bool);\n\n function liquidityPairs(uint256 _index) external view returns (address);\n\n // Methods\n function getCurrentVotes(address _account) external view returns (uint256);\n\n function addCreditETH(address _job) external payable;\n\n function addCredit(\n address _credit,\n address _job,\n uint256 _amount\n ) external;\n\n function addVotes(address _voter, uint256 _amount) external;\n\n function removeVotes(address _voter, uint256 _amount) external;\n\n function addKPRCredit(address _job, uint256 _amount) external;\n\n function approveLiquidity(address _liquidity) external;\n\n function revokeLiquidity(address _liquidity) external;\n\n function pairs() external view returns (address[] memory);\n\n function addLiquidityToJob(\n address _liquidity,\n address _job,\n uint256 _amount\n ) external;\n\n function applyCreditToJob(\n address _provider,\n address _liquidity,\n address _job\n ) external;\n\n function unbondLiquidityFromJob(\n address _liquidity,\n address _job,\n uint256 _amount\n ) external;\n\n function removeLiquidityFromJob(address _liquidity, address _job) external;\n\n function mint(uint256 _amount) external;\n\n function burn(uint256 _amount) external;\n\n function worked(address _keeper) external;\n\n function receipt(\n address _credit,\n address _keeper,\n uint256 _amount\n ) external;\n\n function receiptETH(address _keeper, uint256 _amount) external;\n\n function addJob(address _job) external;\n\n function getJobs() external view returns (address[] memory);\n\n function removeJob(address _job) external;\n\n function setKeep3rHelper(address _keep3rHelper) external;\n\n function setGovernance(address _governance) external;\n\n function acceptGovernance() external;\n\n function isKeeper(address _keeper) external returns (bool);\n\n function isMinKeeper(\n address _keeper,\n uint256 _minBond,\n uint256 _earned,\n uint256 _age\n ) external returns (bool);\n\n function isBondedKeeper(\n address _keeper,\n address _bond,\n uint256 _minBond,\n uint256 _earned,\n uint256 _age\n ) external returns (bool);\n\n function bond(address _bonding, uint256 _amount) external;\n\n function getKeepers() external view returns (address[] memory);\n\n function activate(address _bonding) external;\n\n function unbond(address _bonding, uint256 _amount) external;\n\n function slash(\n address _bonded,\n address _keeper,\n uint256 _amount\n ) external;\n\n function withdraw(address _bonding) external;\n\n function dispute(address _keeper) external;\n\n function revoke(address _keeper) external;\n\n function resolve(address _keeper) external;\n\n function permit(\n address _owner,\n address _spender,\n uint256 _amount,\n uint256 _deadline,\n uint8 _v,\n bytes32 _r,\n bytes32 _s\n ) external;\n}\n" - }, - "solidity/for-test/testnet/Keep3rForTestnet.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../../contracts/Keep3r.sol';\n\ncontract Keep3rForTestnet is Keep3r {\n constructor(\n address _governance,\n address _keep3rHelper,\n address _keep3rV1,\n address _keep3rV1Proxy\n ) Keep3r(_governance, _keep3rHelper, _keep3rV1, _keep3rV1Proxy) {\n bondTime = 0; // allows keepers to instantly register\n unbondTime = 0; // allows keepers & jobOwners to instantly withdraw funds\n liquidityMinimum = 1; // allows job providers to add low liquidity\n rewardPeriodTime = 1 days; // reduces twap calculation period\n inflationPeriod = 5 days; // increases credit minting\n }\n}\n" - }, - "solidity/for-test/Keep3rForTest.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../contracts/Keep3r.sol';\n\ncontract Keep3rForTest is Keep3r {\n constructor(\n address _governance,\n address _keep3rHelper,\n address _keep3rV1,\n address _keep3rV1Proxy\n ) Keep3r(_governance, _keep3rHelper, _keep3rV1, _keep3rV1Proxy) {}\n}\n" - }, - "solidity/contracts/sidechain/Keep3rSidechain.sol": { - "content": "// SPDX-License-Identifier: MIT\n\n/*\n\nCoded for The Keep3r Network with ♥ by\n\n██████╗░███████╗███████╗██╗░░░██╗░░░░░░░██╗░█████╗░███╗░░██╗██████╗░███████╗██████╗░██╗░░░░░░█████╗░███╗░░██╗██████╗░\n██╔══██╗██╔════╝██╔════╝██║░░░██║░░██╗░░██║██╔══██╗████╗░██║██╔══██╗██╔════╝██╔══██╗██║░░░░░██╔══██╗████╗░██║██╔══██╗\n██║░░██║█████╗░░█████╗░░██║░░░╚██╗████╗██╔╝██║░░██║██╔██╗██║██║░░██║█████╗░░██████╔╝██║░░░░░███████║██╔██╗██║██║░░██║\n██║░░██║██╔══╝░░██╔══╝░░██║░░░░████╔═████║░██║░░██║██║╚████║██║░░██║██╔══╝░░██╔══██╗██║░░░░░██╔══██║██║╚████║██║░░██║\n██████╔╝███████╗██║░░░░░██║░░░░╚██╔╝░╚██╔╝░╚█████╔╝██║░╚███║██████╔╝███████╗██║░░██║███████╗██║░░██║██║░╚███║██████╔╝\n╚═════╝░╚══════╝╚═╝░░░░░╚═╝░░░░░╚═╝░░░╚═╝░░░╚════╝░╚═╝░░╚══╝╚═════╝░╚══════╝╚═╝░░╚═╝╚══════╝╚═╝░░╚═╝╚═╝░░╚══╝╚═════╝░\n\nhttps://defi.sucks\n\n*/\n\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../Keep3r.sol';\nimport '../../interfaces/sidechain/IKeep3rEscrow.sol';\nimport '../../interfaces/sidechain/IKeep3rHelperSidechain.sol';\nimport '../../interfaces/sidechain/IKeep3rJobWorkableRated.sol';\nimport '../../interfaces/sidechain/IKeep3rSidechainAccountance.sol';\n\ncontract Keep3rSidechain is Keep3r, IKeep3rJobWorkableRated, IKeep3rSidechainAccountance {\n using EnumerableSet for EnumerableSet.AddressSet;\n\n /// @param _governance Address of governance\n /// @param _keep3rHelperSidechain Address of sidechain Keep3rHelper\n /// @param _wrappedKP3R Address of wrapped KP3R implementation\n /// @param _keep3rEscrow Address of sidechain Keep3rEscrow\n constructor(\n address _governance, // governance\n address _keep3rHelperSidechain, // helper\n address _wrappedKP3R, // keep3rV1\n address _keep3rEscrow // keep3rV1Proxy\n ) Keep3r(_governance, _keep3rHelperSidechain, _wrappedKP3R, _keep3rEscrow) {}\n\n // Keep3rSidechainAccountance\n\n /// @inheritdoc IKeep3rSidechainAccountance\n function virtualReserves() external view override returns (int256 _virtualReserves) {\n // Queries wKP3R balanceOf escrow contract minus the totalBonds\n return int256(IERC20(keep3rV1).balanceOf(keep3rV1Proxy)) - int256(totalBonds);\n }\n\n // Keep3rJobFundableLiquidity\n\n /// @notice Sidechain implementation asks the Helper for an oracle, instead of reading it from the ERC-20\n /// @dev Function should be called after setting an oracle in Keep3rHelperSidechain\n /// @param _liquidity Address of the liquidity token being approved\n function approveLiquidity(address _liquidity) external virtual override onlyGovernance {\n if (!_approvedLiquidities.add(_liquidity)) revert LiquidityPairApproved();\n _liquidityPool[_liquidity] = IKeep3rHelperSidechain(keep3rHelper).oracle(_liquidity);\n if (_liquidityPool[_liquidity] == address(0)) revert ZeroAddress();\n _isKP3RToken0[_liquidity] = IKeep3rHelper(keep3rHelper).isKP3RToken0(_liquidityPool[_liquidity]);\n _tick[_liquidity] = observeLiquidity(_liquidity);\n emit LiquidityApproval(_liquidity);\n }\n\n /// @notice Sidechain implementation will always ask for 2 tickCumulatives instead of cacheing\n /// @param _liquidity Address of the liquidity token being observed\n function observeLiquidity(address _liquidity) public view virtual override returns (TickCache memory _tickCache) {\n if (_tick[_liquidity].period == _period(block.timestamp)) {\n // Will return cached twaps if liquidity is updated\n _tickCache = _tick[_liquidity];\n } else {\n bool success;\n\n // Will always ask for 2 accumulators in sidechain\n uint32[] memory _secondsAgo = new uint32[](2);\n\n _secondsAgo[0] = uint32(block.timestamp - _period(block.timestamp));\n _secondsAgo[1] = uint32(block.timestamp - _period(block.timestamp) + rewardPeriodTime);\n\n int56 _tickCumulative2;\n (_tickCache.current, _tickCumulative2, success) = IKeep3rHelper(keep3rHelper).observe(_liquidityPool[_liquidity], _secondsAgo);\n\n _tickCache.difference = _tickCache.current - _tickCumulative2;\n\n if (success) {\n _tickCache.period = _period(block.timestamp);\n } else {\n delete _tickCache.period;\n }\n }\n }\n\n // Keep3rJobsWorkable\n\n /// @dev Sidechain implementation deprecates worked(address) as it should come with a usdPerGasUnit parameter\n function worked(address) external pure override {\n revert Deprecated();\n }\n\n /// @notice Implemented by jobs to show that a keeper performed work\n /// @dev Uses a USD per gas unit payment mechanism\n /// @param _keeper Address of the keeper that performed the work\n /// @param _usdPerGasUnit Units of USD (in wei) per gas unit that should be rewarded to the keeper\n function worked(address _keeper, uint256 _usdPerGasUnit) external override {\n if (_initialGas == 0) revert GasNotInitialized();\n // Gas used for quote calculations & payment is not rewarded\n uint256 _gasLeft = _getGasLeft();\n\n address _job = msg.sender;\n if (disputes[_job]) revert JobDisputed();\n if (!_jobs.contains(_job)) revert JobUnapproved();\n\n if (_updateJobCreditsIfNeeded(_job)) {\n emit LiquidityCreditsReward(_job, rewardedAt[_job], _jobLiquidityCredits[_job], _jobPeriodCredits[_job]);\n }\n\n (uint256 _boost, uint256 _oneUsdQuote, uint256 _extraGas) = IKeep3rHelper(keep3rHelper).getPaymentParams(bonds[_keeper][keep3rV1]);\n\n uint256 _kp3rPayment = _calculatePayment(_gasLeft, _extraGas, _oneUsdQuote * _usdPerGasUnit, _boost);\n\n if (_kp3rPayment > _jobLiquidityCredits[_job]) {\n _rewardJobCredits(_job);\n emit LiquidityCreditsReward(_job, rewardedAt[_job], _jobLiquidityCredits[_job], _jobPeriodCredits[_job]);\n }\n\n _bondedPayment(_job, _keeper, _kp3rPayment);\n delete _initialGas;\n\n emit KeeperWork(keep3rV1, _job, _keeper, _kp3rPayment, _gasLeft);\n }\n\n // Keep3rKeeperFundable\n\n /// @dev Sidechain implementation doesn't burn tokens, but deposit them in Keep3rEscrow\n function _depositBonds(uint256 _amount) internal virtual override {\n IKeep3rV1(keep3rV1).approve(keep3rV1Proxy, _amount);\n IKeep3rEscrow(keep3rV1Proxy).deposit(_amount);\n }\n}\n" - }, - "solidity/interfaces/sidechain/IKeep3rEscrow.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\n// solhint-disable-next-line no-empty-blocks\n\nimport '../peripherals/IMintable.sol';\n\n/// @title Keep3rEscrow contract\n/// @notice This contract acts as an escrow contract for wKP3R tokens on sidechains and L2s\n/// @dev Can be used as a replacement for keep3rV1Proxy in keep3r sidechain implementations\ninterface IKeep3rEscrow is IMintable {\n /// @notice Emitted when Keep3rEscrow#deposit function is called\n /// @param _wKP3R The addess of the wrapped KP3R token\n /// @param _sender The address that called the function\n /// @param _amount The amount of wKP3R the user deposited\n event wKP3RDeposited(address _wKP3R, address _sender, uint256 _amount);\n\n /// @notice Emitted when Keep3rEscrow#mint function is called\n /// @param _wKP3R The addess of the wrapped KP3R token\n /// @param _recipient The address that will received the newly minted wKP3R\n /// @param _amount The amount of wKP3R minted to the recipient\n event wKP3RMinted(address _wKP3R, address _recipient, uint256 _amount);\n\n /// @notice Emitted when Keep3rEscrow#setWKP3R function is called\n /// @param _newWKP3R The address of the wKP3R contract\n event wKP3RSet(address _newWKP3R);\n\n /// @notice Throws when minter attempts to withdraw more wKP3R than the escrow has in its balance\n error InsufficientBalance();\n\n /// @notice Lists the address of the wKP3R contract\n /// @return _wKP3RAddress The address of wKP3R\n function wKP3R() external view returns (address _wKP3RAddress);\n\n /// @notice Deposits wKP3R into the contract\n /// @param _amount The amount of wKP3R to deposit\n function deposit(uint256 _amount) external;\n\n /// @notice mints wKP3R to the recipient\n /// @param _amount The amount of wKP3R to mint\n function mint(uint256 _amount) external;\n\n /// @notice sets the wKP3R address\n /// @param _wKP3R the wKP3R address\n function setWKP3R(address _wKP3R) external;\n}\n" - }, - "solidity/interfaces/sidechain/IKeep3rHelperSidechain.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../IKeep3rHelper.sol';\n\n/// @title Keep3rHelperSidechain contract\n/// @notice Contains all the helper functions for sidechain keep3r implementations\ninterface IKeep3rHelperSidechain is IKeep3rHelper {\n // Events\n\n /// @notice The oracle for a liquidity has been saved\n /// @param _liquidity The address of the given liquidity\n /// @param _oraclePool The address of the oracle pool\n event OracleSet(address _liquidity, address _oraclePool);\n\n /// @notice Emitted when the WETH USD pool is changed\n /// @param _address Address of the new WETH USD pool\n /// @param _isWETHToken0 True if calling the token0 method of the pool returns the WETH token address\n event WethUSDPoolChange(address _address, bool _isWETHToken0);\n\n /// Variables\n\n /// @notice Ethereum mainnet WETH address used for quoting references\n /// @return _weth Address of WETH token\n // solhint-disable func-name-mixedcase\n function WETH() external view returns (address _weth);\n\n /// @return _oracle The address of the observable pool for given liquidity\n function oracle(address _liquidity) external view returns (address _oracle);\n\n /// @notice WETH-USD pool that is being used as oracle\n /// @return poolAddress Address of the pool\n /// @return isTKNToken0 True if calling the token0 method of the pool returns the WETH token address\n function wethUSDPool() external view returns (address poolAddress, bool isTKNToken0);\n\n /// @notice Quotes USD to ETH\n /// @dev Used to know how much ETH should be paid to keepers before converting it from ETH to KP3R\n /// @param _usd The amount of USD to quote to ETH\n /// @return _eth The resulting amount of ETH after quoting the USD\n function quoteUsdToEth(uint256 _usd) external returns (uint256 _eth);\n\n /// Methods\n\n /// @notice Sets an oracle for a given liquidity\n /// @param _liquidity The address of the liquidity\n /// @param _oracle The address of the pool used to quote the liquidity from\n /// @dev The oracle must contain KP3R as either token0 or token1\n function setOracle(address _liquidity, address _oracle) external;\n\n /// @notice Sets an oracle for querying WETH/USD quote\n /// @param _poolAddress The address of the pool used as oracle\n /// @dev The oracle must contain WETH as either token0 or token1\n function setWethUsdPool(address _poolAddress) external;\n}\n" - }, - "solidity/interfaces/sidechain/IKeep3rJobWorkableRated.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../peripherals/IKeep3rJobs.sol';\n\n/// @title Keep3rJobWorkableRated contract\n/// @notice Implements a quoting in USD per gas unit for Keep3r jobs\ninterface IKeep3rJobWorkableRated is IKeep3rJobs {\n /// @notice Throws when job contract calls deprecated worked(address) function\n error Deprecated();\n\n /// @notice Implemented by jobs to show that a keeper performed work and reward in stable USD quote\n /// @dev Automatically calculates the payment for the keeper and pays the keeper with bonded KP3R\n /// @param _keeper Address of the keeper that performed the work\n /// @param _usdPerGasUnit Amount of USD in wei rewarded for gas unit worked by the keeper\n function worked(address _keeper, uint256 _usdPerGasUnit) external;\n}\n" - }, - "solidity/interfaces/sidechain/IKeep3rSidechainAccountance.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\n/// @title IKeep3rSidechainAccountance interface\n/// @notice Implements a view to get the amount of credits that can be withdrawn\ninterface IKeep3rSidechainAccountance {\n /// @notice The surplus amount of wKP3Rs in escrow contract\n /// @return _virtualReserves The surplus amount of wKP3Rs in escrow contract\n function virtualReserves() external view returns (int256 _virtualReserves);\n}\n" - }, - "solidity/interfaces/peripherals/IMintable.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport './IGovernable.sol';\nimport './IBaseErrors.sol';\n\n/// @title Mintable contract\n/// @notice Manages the minter role\ninterface IMintable is IBaseErrors, IGovernable {\n // Events\n\n /// @notice Emitted when governance sets a new minter\n /// @param _minter Address of the new minter\n event MinterSet(address _minter);\n\n // Errors\n\n /// @notice Throws if the caller of the function is not the minter\n error OnlyMinter();\n\n // Variables\n\n /// @notice Stores the minter address\n /// @return _minter The minter addresss\n function minter() external view returns (address _minter);\n\n // Methods\n\n /// @notice Sets a new address to be the minter\n /// @param _minter The address set as the minter\n function setMinter(address _minter) external;\n}\n" - }, - "solidity/for-test/testnet/Keep3rSidechainForTestnet.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../../contracts/sidechain/Keep3rSidechain.sol';\n\ncontract Keep3rSidechainForTestnet is Keep3rSidechain {\n constructor(\n address _governance,\n address _keep3rHelper,\n address _keep3rV1,\n address _keep3rV1Proxy\n ) Keep3rSidechain(_governance, _keep3rHelper, _keep3rV1, _keep3rV1Proxy) {\n bondTime = 0; // allows keepers to instantly register\n unbondTime = 0; // allows keepers & jobOwners to instantly withdraw funds\n liquidityMinimum = 1; // allows job providers to add low liquidity\n rewardPeriodTime = 1 days; // reduces twap calculation period\n inflationPeriod = 5 days; // increases credit minting\n }\n}\n" - }, - "solidity/for-test/Keep3rSidechainForTest.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../contracts/sidechain/Keep3rSidechain.sol';\n\ncontract Keep3rSidechainForTest is Keep3rSidechain {\n using EnumerableSet for EnumerableSet.AddressSet;\n\n constructor(\n address _governance,\n address _keep3rHelper,\n address _wrappedKP3R,\n address _keep3rEscrow\n ) Keep3rSidechain(_governance, _keep3rHelper, _wrappedKP3R, _keep3rEscrow) {}\n\n function setJobLiquidity(address _job, address _liquidity) external {\n _jobLiquidities[_job].add(_liquidity);\n }\n}\n" - }, - "solidity/for-test/JobRatedForTest.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../interfaces/IKeep3r.sol';\nimport '../interfaces/sidechain/IKeep3rJobWorkableRated.sol';\n\ncontract JobRatedForTest {\n error InvalidKeeper();\n address public keep3r;\n uint256 public nonce;\n uint256 public usdPerGasUnit = 1;\n\n constructor(address _keep3r) {\n keep3r = _keep3r;\n }\n\n function work() external {\n if (!IKeep3r(keep3r).isKeeper(msg.sender)) revert InvalidKeeper();\n\n for (uint256 i = 0; i < 1000; i++) {\n nonce++;\n }\n\n IKeep3rJobWorkableRated(keep3r).worked(msg.sender, usdPerGasUnit);\n }\n\n function workHard(uint256 _factor) external {\n if (!IKeep3r(keep3r).isKeeper(msg.sender)) revert InvalidKeeper();\n\n for (uint256 i = 0; i < 1000 * _factor; i++) {\n nonce++;\n }\n\n IKeep3rJobWorkableRated(keep3r).worked(msg.sender, usdPerGasUnit);\n }\n}\n" - }, - "solidity/for-test/JobForTest.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../interfaces/IKeep3r.sol';\n\ncontract JobForTest {\n error InvalidKeeper();\n address public keep3r;\n uint256 public nonce;\n\n constructor(address _keep3r) {\n keep3r = _keep3r;\n }\n\n function work() external {\n if (!IKeep3r(keep3r).isKeeper(msg.sender)) revert InvalidKeeper();\n\n for (uint256 i; i < 1000; i++) {\n nonce++;\n }\n\n IKeep3r(keep3r).worked(msg.sender);\n }\n\n function workHard(uint256 _factor) external {\n if (!IKeep3r(keep3r).isKeeper(msg.sender)) revert InvalidKeeper();\n\n for (uint256 i; i < 1000 * _factor; i++) {\n nonce++;\n }\n\n IKeep3r(keep3r).worked(msg.sender);\n }\n}\n" - }, - "solidity/for-test/BasicJob.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../interfaces/IKeep3r.sol';\n\ncontract BasicJob {\n error KeeperNotValid();\n\n address public keep3r;\n uint256 public nonce;\n uint256[] public array;\n\n constructor(address _keep3r) {\n keep3r = _keep3r;\n }\n\n function work() external upkeep {}\n\n function workHard(uint256 _howHard) external upkeep {\n for (uint256 i = nonce; i < _howHard; i++) {\n nonce++;\n }\n }\n\n function workRefund(uint256 _howHard) external upkeep {\n for (uint256 i; i < _howHard; i++) {\n array.push(i);\n }\n\n while (array.length > 0) {\n array.pop();\n }\n }\n\n modifier upkeep() {\n if (!IKeep3r(keep3r).isKeeper(msg.sender)) revert KeeperNotValid();\n _;\n IKeep3r(keep3r).worked(msg.sender);\n }\n}\n" - }, - "solidity/contracts/Keep3rHelperParameters.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.7 <0.9.0;\n\nimport './libraries/FullMath.sol';\nimport './libraries/TickMath.sol';\nimport '../interfaces/peripherals/IBaseErrors.sol';\nimport '../interfaces/IKeep3r.sol';\nimport '../interfaces/external/IKeep3rV1.sol';\nimport '../interfaces/IKeep3rHelperParameters.sol';\nimport './peripherals/Governable.sol';\nimport './Keep3rHelperParameters.sol';\n\nimport '@openzeppelin/contracts/utils/math/Math.sol';\nimport '@uniswap/v3-core/contracts/interfaces/IUniswapV3Pool.sol';\n\ncontract Keep3rHelperParameters is IKeep3rHelperParameters, IBaseErrors, Governable {\n /// @inheritdoc IKeep3rHelperParameters\n address public immutable override KP3R;\n\n /// @inheritdoc IKeep3rHelperParameters\n uint256 public constant override BOOST_BASE = 10_000;\n\n /// @inheritdoc IKeep3rHelperParameters\n uint256 public override minBoost = 11_000;\n\n /// @inheritdoc IKeep3rHelperParameters\n uint256 public override maxBoost = 12_000;\n\n /// @inheritdoc IKeep3rHelperParameters\n uint256 public override targetBond = 200 ether;\n\n /// @inheritdoc IKeep3rHelperParameters\n uint256 public override workExtraGas = 34_000;\n\n /// @inheritdoc IKeep3rHelperParameters\n uint32 public override quoteTwapTime = 10 minutes;\n\n /// @inheritdoc IKeep3rHelperParameters\n uint256 public override minBaseFee = 15e9;\n\n /// @inheritdoc IKeep3rHelperParameters\n uint256 public override minPriorityFee = 2e9;\n\n /// @inheritdoc IKeep3rHelperParameters\n address public override keep3rV2;\n\n /// @inheritdoc IKeep3rHelperParameters\n IKeep3rHelperParameters.TokenOraclePool public override kp3rWethPool;\n\n constructor(\n address _kp3r,\n address _keep3rV2,\n address _governance,\n address _kp3rWethPool\n ) Governable(_governance) {\n KP3R = _kp3r;\n keep3rV2 = _keep3rV2;\n\n // Immutable variables [KP3R] cannot be read during contract creation time [_setKp3rWethPool]\n kp3rWethPool = _validateOraclePool(_kp3rWethPool, _kp3r);\n emit Kp3rWethPoolChange(kp3rWethPool.poolAddress, kp3rWethPool.isTKNToken0);\n }\n\n /// @inheritdoc IKeep3rHelperParameters\n function setKp3rWethPool(address _poolAddress) external override onlyGovernance {\n if (_poolAddress == address(0)) revert ZeroAddress();\n _setKp3rWethPool(_poolAddress);\n }\n\n /// @inheritdoc IKeep3rHelperParameters\n function setMinBoost(uint256 _minBoost) external override onlyGovernance {\n minBoost = _minBoost;\n emit MinBoostChange(minBoost);\n }\n\n /// @inheritdoc IKeep3rHelperParameters\n function setMaxBoost(uint256 _maxBoost) external override onlyGovernance {\n maxBoost = _maxBoost;\n emit MaxBoostChange(maxBoost);\n }\n\n /// @inheritdoc IKeep3rHelperParameters\n function setTargetBond(uint256 _targetBond) external override onlyGovernance {\n targetBond = _targetBond;\n emit TargetBondChange(targetBond);\n }\n\n /// @inheritdoc IKeep3rHelperParameters\n function setKeep3rV2(address _keep3rV2) external override onlyGovernance {\n if (_keep3rV2 == address(0)) revert ZeroAddress();\n keep3rV2 = _keep3rV2;\n emit Keep3rV2Change(keep3rV2);\n }\n\n /// @inheritdoc IKeep3rHelperParameters\n function setWorkExtraGas(uint256 _workExtraGas) external override onlyGovernance {\n workExtraGas = _workExtraGas;\n emit WorkExtraGasChange(workExtraGas);\n }\n\n /// @inheritdoc IKeep3rHelperParameters\n function setQuoteTwapTime(uint32 _quoteTwapTime) external override onlyGovernance {\n _setQuoteTwapTime(_quoteTwapTime);\n }\n\n function _setQuoteTwapTime(uint32 _quoteTwapTime) internal {\n quoteTwapTime = _quoteTwapTime;\n emit QuoteTwapTimeChange(quoteTwapTime);\n }\n\n /// @inheritdoc IKeep3rHelperParameters\n function setMinBaseFee(uint256 _minBaseFee) external override onlyGovernance {\n minBaseFee = _minBaseFee;\n emit MinBaseFeeChange(minBaseFee);\n }\n\n /// @inheritdoc IKeep3rHelperParameters\n function setMinPriorityFee(uint256 _minPriorityFee) external override onlyGovernance {\n minPriorityFee = _minPriorityFee;\n emit MinPriorityFeeChange(minPriorityFee);\n }\n\n /// @notice Sets KP3R-WETH pool\n /// @param _poolAddress The address of the KP3R-WETH pool\n function _setKp3rWethPool(address _poolAddress) internal {\n kp3rWethPool = _validateOraclePool(_poolAddress, KP3R);\n emit Kp3rWethPoolChange(kp3rWethPool.poolAddress, kp3rWethPool.isTKNToken0);\n }\n\n function _validateOraclePool(address _poolAddress, address _token) internal view virtual returns (TokenOraclePool memory _oraclePool) {\n bool _isTKNToken0 = IUniswapV3Pool(_poolAddress).token0() == _token;\n\n if (!_isTKNToken0 && IUniswapV3Pool(_poolAddress).token1() != _token) revert InvalidOraclePool();\n\n return TokenOraclePool(_poolAddress, _isTKNToken0);\n }\n}\n" - }, - "solidity/contracts/libraries/TickMath.sol": { - "content": "// SPDX-License-Identifier: GPL-2.0-or-later\npragma solidity >=0.5.0;\n\n// solhint-disable\n\n/// @title Math library for computing sqrt prices from ticks and vice versa\n/// @notice Computes sqrt price for ticks of size 1.0001, i.e. sqrt(1.0001^tick) as fixed point Q64.96 numbers. Supports\n/// prices between 2**-128 and 2**128\nlibrary TickMath {\n /// @dev The minimum tick that may be passed to #getSqrtRatioAtTick computed from log base 1.0001 of 2**-128\n int24 internal constant MIN_TICK = -887272;\n /// @dev The maximum tick that may be passed to #getSqrtRatioAtTick computed from log base 1.0001 of 2**128\n int24 internal constant MAX_TICK = -MIN_TICK;\n\n /// @dev The minimum value that can be returned from #getSqrtRatioAtTick. Equivalent to getSqrtRatioAtTick(MIN_TICK)\n uint160 internal constant MIN_SQRT_RATIO = 4295128739;\n /// @dev The maximum value that can be returned from #getSqrtRatioAtTick. Equivalent to getSqrtRatioAtTick(MAX_TICK)\n uint160 internal constant MAX_SQRT_RATIO = 1461446703485210103287273052203988822378723970342;\n\n /// @notice Calculates sqrt(1.0001^tick) * 2^96\n /// @dev Throws if |tick| > max tick\n /// @param tick The input tick for the above formula\n /// @return sqrtPriceX96 A Fixed point Q64.96 number representing the sqrt of the ratio of the two assets (token1/token0)\n /// at the given tick\n function getSqrtRatioAtTick(int24 tick) internal pure returns (uint160 sqrtPriceX96) {\n uint256 absTick = tick < 0 ? uint256(-int256(tick)) : uint256(int256(tick));\n require(absTick <= uint256(int256(MAX_TICK)), 'T');\n\n uint256 ratio = absTick & 0x1 != 0 ? 0xfffcb933bd6fad37aa2d162d1a594001 : 0x100000000000000000000000000000000;\n if (absTick & 0x2 != 0) ratio = (ratio * 0xfff97272373d413259a46990580e213a) >> 128;\n if (absTick & 0x4 != 0) ratio = (ratio * 0xfff2e50f5f656932ef12357cf3c7fdcc) >> 128;\n if (absTick & 0x8 != 0) ratio = (ratio * 0xffe5caca7e10e4e61c3624eaa0941cd0) >> 128;\n if (absTick & 0x10 != 0) ratio = (ratio * 0xffcb9843d60f6159c9db58835c926644) >> 128;\n if (absTick & 0x20 != 0) ratio = (ratio * 0xff973b41fa98c081472e6896dfb254c0) >> 128;\n if (absTick & 0x40 != 0) ratio = (ratio * 0xff2ea16466c96a3843ec78b326b52861) >> 128;\n if (absTick & 0x80 != 0) ratio = (ratio * 0xfe5dee046a99a2a811c461f1969c3053) >> 128;\n if (absTick & 0x100 != 0) ratio = (ratio * 0xfcbe86c7900a88aedcffc83b479aa3a4) >> 128;\n if (absTick & 0x200 != 0) ratio = (ratio * 0xf987a7253ac413176f2b074cf7815e54) >> 128;\n if (absTick & 0x400 != 0) ratio = (ratio * 0xf3392b0822b70005940c7a398e4b70f3) >> 128;\n if (absTick & 0x800 != 0) ratio = (ratio * 0xe7159475a2c29b7443b29c7fa6e889d9) >> 128;\n if (absTick & 0x1000 != 0) ratio = (ratio * 0xd097f3bdfd2022b8845ad8f792aa5825) >> 128;\n if (absTick & 0x2000 != 0) ratio = (ratio * 0xa9f746462d870fdf8a65dc1f90e061e5) >> 128;\n if (absTick & 0x4000 != 0) ratio = (ratio * 0x70d869a156d2a1b890bb3df62baf32f7) >> 128;\n if (absTick & 0x8000 != 0) ratio = (ratio * 0x31be135f97d08fd981231505542fcfa6) >> 128;\n if (absTick & 0x10000 != 0) ratio = (ratio * 0x9aa508b5b7a84e1c677de54f3e99bc9) >> 128;\n if (absTick & 0x20000 != 0) ratio = (ratio * 0x5d6af8dedb81196699c329225ee604) >> 128;\n if (absTick & 0x40000 != 0) ratio = (ratio * 0x2216e584f5fa1ea926041bedfe98) >> 128;\n if (absTick & 0x80000 != 0) ratio = (ratio * 0x48a170391f7dc42444e8fa2) >> 128;\n\n if (tick > 0) ratio = type(uint256).max / ratio;\n\n // Divides by 1<<32 rounding up to go from a Q128.128 to a Q128.96.\n // we then downcast because we know the result always fits within 160 bits due to our tick input constraint\n // we round up in the division so getTickAtSqrtRatio of the output price is always consistent\n sqrtPriceX96 = uint160((ratio >> 32) + (ratio % (1 << 32) == 0 ? 0 : 1));\n }\n\n /// @notice Calculates the greatest tick value such that getRatioAtTick(tick) <= ratio\n /// @dev Throws in case sqrtPriceX96 < MIN_SQRT_RATIO, as MIN_SQRT_RATIO is the lowest value getRatioAtTick may ever return.\n /// @param sqrtPriceX96 The sqrt ratio for which to compute the tick as a Q64.96\n /// @return tick The greatest tick for which the ratio is less than or equal to the input ratio\n function getTickAtSqrtRatio(uint160 sqrtPriceX96) internal pure returns (int24 tick) {\n // Second inequality must be < because the price can never reach the price at the max tick\n require(sqrtPriceX96 >= MIN_SQRT_RATIO && sqrtPriceX96 < MAX_SQRT_RATIO, 'R');\n uint256 ratio = uint256(sqrtPriceX96) << 32;\n\n uint256 r = ratio;\n uint256 msb = 0;\n\n assembly {\n let f := shl(7, gt(r, 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF))\n msb := or(msb, f)\n r := shr(f, r)\n }\n assembly {\n let f := shl(6, gt(r, 0xFFFFFFFFFFFFFFFF))\n msb := or(msb, f)\n r := shr(f, r)\n }\n assembly {\n let f := shl(5, gt(r, 0xFFFFFFFF))\n msb := or(msb, f)\n r := shr(f, r)\n }\n assembly {\n let f := shl(4, gt(r, 0xFFFF))\n msb := or(msb, f)\n r := shr(f, r)\n }\n assembly {\n let f := shl(3, gt(r, 0xFF))\n msb := or(msb, f)\n r := shr(f, r)\n }\n assembly {\n let f := shl(2, gt(r, 0xF))\n msb := or(msb, f)\n r := shr(f, r)\n }\n assembly {\n let f := shl(1, gt(r, 0x3))\n msb := or(msb, f)\n r := shr(f, r)\n }\n assembly {\n let f := gt(r, 0x1)\n msb := or(msb, f)\n }\n\n if (msb >= 128) r = ratio >> (msb - 127);\n else r = ratio << (127 - msb);\n\n int256 log_2 = (int256(msb) - 128) << 64;\n\n assembly {\n r := shr(127, mul(r, r))\n let f := shr(128, r)\n log_2 := or(log_2, shl(63, f))\n r := shr(f, r)\n }\n assembly {\n r := shr(127, mul(r, r))\n let f := shr(128, r)\n log_2 := or(log_2, shl(62, f))\n r := shr(f, r)\n }\n assembly {\n r := shr(127, mul(r, r))\n let f := shr(128, r)\n log_2 := or(log_2, shl(61, f))\n r := shr(f, r)\n }\n assembly {\n r := shr(127, mul(r, r))\n let f := shr(128, r)\n log_2 := or(log_2, shl(60, f))\n r := shr(f, r)\n }\n assembly {\n r := shr(127, mul(r, r))\n let f := shr(128, r)\n log_2 := or(log_2, shl(59, f))\n r := shr(f, r)\n }\n assembly {\n r := shr(127, mul(r, r))\n let f := shr(128, r)\n log_2 := or(log_2, shl(58, f))\n r := shr(f, r)\n }\n assembly {\n r := shr(127, mul(r, r))\n let f := shr(128, r)\n log_2 := or(log_2, shl(57, f))\n r := shr(f, r)\n }\n assembly {\n r := shr(127, mul(r, r))\n let f := shr(128, r)\n log_2 := or(log_2, shl(56, f))\n r := shr(f, r)\n }\n assembly {\n r := shr(127, mul(r, r))\n let f := shr(128, r)\n log_2 := or(log_2, shl(55, f))\n r := shr(f, r)\n }\n assembly {\n r := shr(127, mul(r, r))\n let f := shr(128, r)\n log_2 := or(log_2, shl(54, f))\n r := shr(f, r)\n }\n assembly {\n r := shr(127, mul(r, r))\n let f := shr(128, r)\n log_2 := or(log_2, shl(53, f))\n r := shr(f, r)\n }\n assembly {\n r := shr(127, mul(r, r))\n let f := shr(128, r)\n log_2 := or(log_2, shl(52, f))\n r := shr(f, r)\n }\n assembly {\n r := shr(127, mul(r, r))\n let f := shr(128, r)\n log_2 := or(log_2, shl(51, f))\n r := shr(f, r)\n }\n assembly {\n r := shr(127, mul(r, r))\n let f := shr(128, r)\n log_2 := or(log_2, shl(50, f))\n }\n\n int256 log_sqrt10001 = log_2 * 255738958999603826347141; // 128.128 number\n\n int24 tickLow = int24((log_sqrt10001 - 3402992956809132418596140100660247210) >> 128);\n int24 tickHi = int24((log_sqrt10001 + 291339464771989622907027621153398088495) >> 128);\n\n tick = tickLow == tickHi ? tickLow : getSqrtRatioAtTick(tickHi) <= sqrtPriceX96 ? tickHi : tickLow;\n }\n}\n" - }, - "@uniswap/v3-core/contracts/interfaces/IUniswapV3Pool.sol": { - "content": "// SPDX-License-Identifier: GPL-2.0-or-later\npragma solidity >=0.5.0;\n\nimport './pool/IUniswapV3PoolImmutables.sol';\nimport './pool/IUniswapV3PoolState.sol';\nimport './pool/IUniswapV3PoolDerivedState.sol';\nimport './pool/IUniswapV3PoolActions.sol';\nimport './pool/IUniswapV3PoolOwnerActions.sol';\nimport './pool/IUniswapV3PoolEvents.sol';\n\n/// @title The interface for a Uniswap V3 Pool\n/// @notice A Uniswap pool facilitates swapping and automated market making between any two assets that strictly conform\n/// to the ERC20 specification\n/// @dev The pool interface is broken up into many smaller pieces\ninterface IUniswapV3Pool is\n IUniswapV3PoolImmutables,\n IUniswapV3PoolState,\n IUniswapV3PoolDerivedState,\n IUniswapV3PoolActions,\n IUniswapV3PoolOwnerActions,\n IUniswapV3PoolEvents\n{\n\n}\n" - }, - "@uniswap/v3-core/contracts/interfaces/pool/IUniswapV3PoolImmutables.sol": { - "content": "// SPDX-License-Identifier: GPL-2.0-or-later\npragma solidity >=0.5.0;\n\n/// @title Pool state that never changes\n/// @notice These parameters are fixed for a pool forever, i.e., the methods will always return the same values\ninterface IUniswapV3PoolImmutables {\n /// @notice The contract that deployed the pool, which must adhere to the IUniswapV3Factory interface\n /// @return The contract address\n function factory() external view returns (address);\n\n /// @notice The first of the two tokens of the pool, sorted by address\n /// @return The token contract address\n function token0() external view returns (address);\n\n /// @notice The second of the two tokens of the pool, sorted by address\n /// @return The token contract address\n function token1() external view returns (address);\n\n /// @notice The pool's fee in hundredths of a bip, i.e. 1e-6\n /// @return The fee\n function fee() external view returns (uint24);\n\n /// @notice The pool tick spacing\n /// @dev Ticks can only be used at multiples of this value, minimum of 1 and always positive\n /// e.g.: a tickSpacing of 3 means ticks can be initialized every 3rd tick, i.e., ..., -6, -3, 0, 3, 6, ...\n /// This value is an int24 to avoid casting even though it is always positive.\n /// @return The tick spacing\n function tickSpacing() external view returns (int24);\n\n /// @notice The maximum amount of position liquidity that can use any tick in the range\n /// @dev This parameter is enforced per tick to prevent liquidity from overflowing a uint128 at any point, and\n /// also prevents out-of-range liquidity from being used to prevent adding in-range liquidity to a pool\n /// @return The max amount of liquidity per tick\n function maxLiquidityPerTick() external view returns (uint128);\n}\n" - }, - "@uniswap/v3-core/contracts/interfaces/pool/IUniswapV3PoolState.sol": { - "content": "// SPDX-License-Identifier: GPL-2.0-or-later\npragma solidity >=0.5.0;\n\n/// @title Pool state that can change\n/// @notice These methods compose the pool's state, and can change with any frequency including multiple times\n/// per transaction\ninterface IUniswapV3PoolState {\n /// @notice The 0th storage slot in the pool stores many values, and is exposed as a single method to save gas\n /// when accessed externally.\n /// @return sqrtPriceX96 The current price of the pool as a sqrt(token1/token0) Q64.96 value\n /// tick The current tick of the pool, i.e. according to the last tick transition that was run.\n /// This value may not always be equal to SqrtTickMath.getTickAtSqrtRatio(sqrtPriceX96) if the price is on a tick\n /// boundary.\n /// observationIndex The index of the last oracle observation that was written,\n /// observationCardinality The current maximum number of observations stored in the pool,\n /// observationCardinalityNext The next maximum number of observations, to be updated when the observation.\n /// feeProtocol The protocol fee for both tokens of the pool.\n /// Encoded as two 4 bit values, where the protocol fee of token1 is shifted 4 bits and the protocol fee of token0\n /// is the lower 4 bits. Used as the denominator of a fraction of the swap fee, e.g. 4 means 1/4th of the swap fee.\n /// unlocked Whether the pool is currently locked to reentrancy\n function slot0()\n external\n view\n returns (\n uint160 sqrtPriceX96,\n int24 tick,\n uint16 observationIndex,\n uint16 observationCardinality,\n uint16 observationCardinalityNext,\n uint8 feeProtocol,\n bool unlocked\n );\n\n /// @notice The fee growth as a Q128.128 fees of token0 collected per unit of liquidity for the entire life of the pool\n /// @dev This value can overflow the uint256\n function feeGrowthGlobal0X128() external view returns (uint256);\n\n /// @notice The fee growth as a Q128.128 fees of token1 collected per unit of liquidity for the entire life of the pool\n /// @dev This value can overflow the uint256\n function feeGrowthGlobal1X128() external view returns (uint256);\n\n /// @notice The amounts of token0 and token1 that are owed to the protocol\n /// @dev Protocol fees will never exceed uint128 max in either token\n function protocolFees() external view returns (uint128 token0, uint128 token1);\n\n /// @notice The currently in range liquidity available to the pool\n /// @dev This value has no relationship to the total liquidity across all ticks\n function liquidity() external view returns (uint128);\n\n /// @notice Look up information about a specific tick in the pool\n /// @param tick The tick to look up\n /// @return liquidityGross the total amount of position liquidity that uses the pool either as tick lower or\n /// tick upper,\n /// liquidityNet how much liquidity changes when the pool price crosses the tick,\n /// feeGrowthOutside0X128 the fee growth on the other side of the tick from the current tick in token0,\n /// feeGrowthOutside1X128 the fee growth on the other side of the tick from the current tick in token1,\n /// tickCumulativeOutside the cumulative tick value on the other side of the tick from the current tick\n /// secondsPerLiquidityOutsideX128 the seconds spent per liquidity on the other side of the tick from the current tick,\n /// secondsOutside the seconds spent on the other side of the tick from the current tick,\n /// initialized Set to true if the tick is initialized, i.e. liquidityGross is greater than 0, otherwise equal to false.\n /// Outside values can only be used if the tick is initialized, i.e. if liquidityGross is greater than 0.\n /// In addition, these values are only relative and must be used only in comparison to previous snapshots for\n /// a specific position.\n function ticks(int24 tick)\n external\n view\n returns (\n uint128 liquidityGross,\n int128 liquidityNet,\n uint256 feeGrowthOutside0X128,\n uint256 feeGrowthOutside1X128,\n int56 tickCumulativeOutside,\n uint160 secondsPerLiquidityOutsideX128,\n uint32 secondsOutside,\n bool initialized\n );\n\n /// @notice Returns 256 packed tick initialized boolean values. See TickBitmap for more information\n function tickBitmap(int16 wordPosition) external view returns (uint256);\n\n /// @notice Returns the information about a position by the position's key\n /// @param key The position's key is a hash of a preimage composed by the owner, tickLower and tickUpper\n /// @return _liquidity The amount of liquidity in the position,\n /// Returns feeGrowthInside0LastX128 fee growth of token0 inside the tick range as of the last mint/burn/poke,\n /// Returns feeGrowthInside1LastX128 fee growth of token1 inside the tick range as of the last mint/burn/poke,\n /// Returns tokensOwed0 the computed amount of token0 owed to the position as of the last mint/burn/poke,\n /// Returns tokensOwed1 the computed amount of token1 owed to the position as of the last mint/burn/poke\n function positions(bytes32 key)\n external\n view\n returns (\n uint128 _liquidity,\n uint256 feeGrowthInside0LastX128,\n uint256 feeGrowthInside1LastX128,\n uint128 tokensOwed0,\n uint128 tokensOwed1\n );\n\n /// @notice Returns data about a specific observation index\n /// @param index The element of the observations array to fetch\n /// @dev You most likely want to use #observe() instead of this method to get an observation as of some amount of time\n /// ago, rather than at a specific index in the array.\n /// @return blockTimestamp The timestamp of the observation,\n /// Returns tickCumulative the tick multiplied by seconds elapsed for the life of the pool as of the observation timestamp,\n /// Returns secondsPerLiquidityCumulativeX128 the seconds per in range liquidity for the life of the pool as of the observation timestamp,\n /// Returns initialized whether the observation has been initialized and the values are safe to use\n function observations(uint256 index)\n external\n view\n returns (\n uint32 blockTimestamp,\n int56 tickCumulative,\n uint160 secondsPerLiquidityCumulativeX128,\n bool initialized\n );\n}\n" - }, - "@uniswap/v3-core/contracts/interfaces/pool/IUniswapV3PoolDerivedState.sol": { - "content": "// SPDX-License-Identifier: GPL-2.0-or-later\npragma solidity >=0.5.0;\n\n/// @title Pool state that is not stored\n/// @notice Contains view functions to provide information about the pool that is computed rather than stored on the\n/// blockchain. The functions here may have variable gas costs.\ninterface IUniswapV3PoolDerivedState {\n /// @notice Returns the cumulative tick and liquidity as of each timestamp `secondsAgo` from the current block timestamp\n /// @dev To get a time weighted average tick or liquidity-in-range, you must call this with two values, one representing\n /// the beginning of the period and another for the end of the period. E.g., to get the last hour time-weighted average tick,\n /// you must call it with secondsAgos = [3600, 0].\n /// @dev The time weighted average tick represents the geometric time weighted average price of the pool, in\n /// log base sqrt(1.0001) of token1 / token0. The TickMath library can be used to go from a tick value to a ratio.\n /// @param secondsAgos From how long ago each cumulative tick and liquidity value should be returned\n /// @return tickCumulatives Cumulative tick values as of each `secondsAgos` from the current block timestamp\n /// @return secondsPerLiquidityCumulativeX128s Cumulative seconds per liquidity-in-range value as of each `secondsAgos` from the current block\n /// timestamp\n function observe(uint32[] calldata secondsAgos)\n external\n view\n returns (int56[] memory tickCumulatives, uint160[] memory secondsPerLiquidityCumulativeX128s);\n\n /// @notice Returns a snapshot of the tick cumulative, seconds per liquidity and seconds inside a tick range\n /// @dev Snapshots must only be compared to other snapshots, taken over a period for which a position existed.\n /// I.e., snapshots cannot be compared if a position is not held for the entire period between when the first\n /// snapshot is taken and the second snapshot is taken.\n /// @param tickLower The lower tick of the range\n /// @param tickUpper The upper tick of the range\n /// @return tickCumulativeInside The snapshot of the tick accumulator for the range\n /// @return secondsPerLiquidityInsideX128 The snapshot of seconds per liquidity for the range\n /// @return secondsInside The snapshot of seconds per liquidity for the range\n function snapshotCumulativesInside(int24 tickLower, int24 tickUpper)\n external\n view\n returns (\n int56 tickCumulativeInside,\n uint160 secondsPerLiquidityInsideX128,\n uint32 secondsInside\n );\n}\n" - }, - "@uniswap/v3-core/contracts/interfaces/pool/IUniswapV3PoolActions.sol": { - "content": "// SPDX-License-Identifier: GPL-2.0-or-later\npragma solidity >=0.5.0;\n\n/// @title Permissionless pool actions\n/// @notice Contains pool methods that can be called by anyone\ninterface IUniswapV3PoolActions {\n /// @notice Sets the initial price for the pool\n /// @dev Price is represented as a sqrt(amountToken1/amountToken0) Q64.96 value\n /// @param sqrtPriceX96 the initial sqrt price of the pool as a Q64.96\n function initialize(uint160 sqrtPriceX96) external;\n\n /// @notice Adds liquidity for the given recipient/tickLower/tickUpper position\n /// @dev The caller of this method receives a callback in the form of IUniswapV3MintCallback#uniswapV3MintCallback\n /// in which they must pay any token0 or token1 owed for the liquidity. The amount of token0/token1 due depends\n /// on tickLower, tickUpper, the amount of liquidity, and the current price.\n /// @param recipient The address for which the liquidity will be created\n /// @param tickLower The lower tick of the position in which to add liquidity\n /// @param tickUpper The upper tick of the position in which to add liquidity\n /// @param amount The amount of liquidity to mint\n /// @param data Any data that should be passed through to the callback\n /// @return amount0 The amount of token0 that was paid to mint the given amount of liquidity. Matches the value in the callback\n /// @return amount1 The amount of token1 that was paid to mint the given amount of liquidity. Matches the value in the callback\n function mint(\n address recipient,\n int24 tickLower,\n int24 tickUpper,\n uint128 amount,\n bytes calldata data\n ) external returns (uint256 amount0, uint256 amount1);\n\n /// @notice Collects tokens owed to a position\n /// @dev Does not recompute fees earned, which must be done either via mint or burn of any amount of liquidity.\n /// Collect must be called by the position owner. To withdraw only token0 or only token1, amount0Requested or\n /// amount1Requested may be set to zero. To withdraw all tokens owed, caller may pass any value greater than the\n /// actual tokens owed, e.g. type(uint128).max. Tokens owed may be from accumulated swap fees or burned liquidity.\n /// @param recipient The address which should receive the fees collected\n /// @param tickLower The lower tick of the position for which to collect fees\n /// @param tickUpper The upper tick of the position for which to collect fees\n /// @param amount0Requested How much token0 should be withdrawn from the fees owed\n /// @param amount1Requested How much token1 should be withdrawn from the fees owed\n /// @return amount0 The amount of fees collected in token0\n /// @return amount1 The amount of fees collected in token1\n function collect(\n address recipient,\n int24 tickLower,\n int24 tickUpper,\n uint128 amount0Requested,\n uint128 amount1Requested\n ) external returns (uint128 amount0, uint128 amount1);\n\n /// @notice Burn liquidity from the sender and account tokens owed for the liquidity to the position\n /// @dev Can be used to trigger a recalculation of fees owed to a position by calling with an amount of 0\n /// @dev Fees must be collected separately via a call to #collect\n /// @param tickLower The lower tick of the position for which to burn liquidity\n /// @param tickUpper The upper tick of the position for which to burn liquidity\n /// @param amount How much liquidity to burn\n /// @return amount0 The amount of token0 sent to the recipient\n /// @return amount1 The amount of token1 sent to the recipient\n function burn(\n int24 tickLower,\n int24 tickUpper,\n uint128 amount\n ) external returns (uint256 amount0, uint256 amount1);\n\n /// @notice Swap token0 for token1, or token1 for token0\n /// @dev The caller of this method receives a callback in the form of IUniswapV3SwapCallback#uniswapV3SwapCallback\n /// @param recipient The address to receive the output of the swap\n /// @param zeroForOne The direction of the swap, true for token0 to token1, false for token1 to token0\n /// @param amountSpecified The amount of the swap, which implicitly configures the swap as exact input (positive), or exact output (negative)\n /// @param sqrtPriceLimitX96 The Q64.96 sqrt price limit. If zero for one, the price cannot be less than this\n /// value after the swap. If one for zero, the price cannot be greater than this value after the swap\n /// @param data Any data to be passed through to the callback\n /// @return amount0 The delta of the balance of token0 of the pool, exact when negative, minimum when positive\n /// @return amount1 The delta of the balance of token1 of the pool, exact when negative, minimum when positive\n function swap(\n address recipient,\n bool zeroForOne,\n int256 amountSpecified,\n uint160 sqrtPriceLimitX96,\n bytes calldata data\n ) external returns (int256 amount0, int256 amount1);\n\n /// @notice Receive token0 and/or token1 and pay it back, plus a fee, in the callback\n /// @dev The caller of this method receives a callback in the form of IUniswapV3FlashCallback#uniswapV3FlashCallback\n /// @dev Can be used to donate underlying tokens pro-rata to currently in-range liquidity providers by calling\n /// with 0 amount{0,1} and sending the donation amount(s) from the callback\n /// @param recipient The address which will receive the token0 and token1 amounts\n /// @param amount0 The amount of token0 to send\n /// @param amount1 The amount of token1 to send\n /// @param data Any data to be passed through to the callback\n function flash(\n address recipient,\n uint256 amount0,\n uint256 amount1,\n bytes calldata data\n ) external;\n\n /// @notice Increase the maximum number of price and liquidity observations that this pool will store\n /// @dev This method is no-op if the pool already has an observationCardinalityNext greater than or equal to\n /// the input observationCardinalityNext.\n /// @param observationCardinalityNext The desired minimum number of observations for the pool to store\n function increaseObservationCardinalityNext(uint16 observationCardinalityNext) external;\n}\n" - }, - "@uniswap/v3-core/contracts/interfaces/pool/IUniswapV3PoolOwnerActions.sol": { - "content": "// SPDX-License-Identifier: GPL-2.0-or-later\npragma solidity >=0.5.0;\n\n/// @title Permissioned pool actions\n/// @notice Contains pool methods that may only be called by the factory owner\ninterface IUniswapV3PoolOwnerActions {\n /// @notice Set the denominator of the protocol's % share of the fees\n /// @param feeProtocol0 new protocol fee for token0 of the pool\n /// @param feeProtocol1 new protocol fee for token1 of the pool\n function setFeeProtocol(uint8 feeProtocol0, uint8 feeProtocol1) external;\n\n /// @notice Collect the protocol fee accrued to the pool\n /// @param recipient The address to which collected protocol fees should be sent\n /// @param amount0Requested The maximum amount of token0 to send, can be 0 to collect fees in only token1\n /// @param amount1Requested The maximum amount of token1 to send, can be 0 to collect fees in only token0\n /// @return amount0 The protocol fee collected in token0\n /// @return amount1 The protocol fee collected in token1\n function collectProtocol(\n address recipient,\n uint128 amount0Requested,\n uint128 amount1Requested\n ) external returns (uint128 amount0, uint128 amount1);\n}\n" - }, - "@uniswap/v3-core/contracts/interfaces/pool/IUniswapV3PoolEvents.sol": { - "content": "// SPDX-License-Identifier: GPL-2.0-or-later\npragma solidity >=0.5.0;\n\n/// @title Events emitted by a pool\n/// @notice Contains all events emitted by the pool\ninterface IUniswapV3PoolEvents {\n /// @notice Emitted exactly once by a pool when #initialize is first called on the pool\n /// @dev Mint/Burn/Swap cannot be emitted by the pool before Initialize\n /// @param sqrtPriceX96 The initial sqrt price of the pool, as a Q64.96\n /// @param tick The initial tick of the pool, i.e. log base 1.0001 of the starting price of the pool\n event Initialize(uint160 sqrtPriceX96, int24 tick);\n\n /// @notice Emitted when liquidity is minted for a given position\n /// @param sender The address that minted the liquidity\n /// @param owner The owner of the position and recipient of any minted liquidity\n /// @param tickLower The lower tick of the position\n /// @param tickUpper The upper tick of the position\n /// @param amount The amount of liquidity minted to the position range\n /// @param amount0 How much token0 was required for the minted liquidity\n /// @param amount1 How much token1 was required for the minted liquidity\n event Mint(\n address sender,\n address indexed owner,\n int24 indexed tickLower,\n int24 indexed tickUpper,\n uint128 amount,\n uint256 amount0,\n uint256 amount1\n );\n\n /// @notice Emitted when fees are collected by the owner of a position\n /// @dev Collect events may be emitted with zero amount0 and amount1 when the caller chooses not to collect fees\n /// @param owner The owner of the position for which fees are collected\n /// @param tickLower The lower tick of the position\n /// @param tickUpper The upper tick of the position\n /// @param amount0 The amount of token0 fees collected\n /// @param amount1 The amount of token1 fees collected\n event Collect(\n address indexed owner,\n address recipient,\n int24 indexed tickLower,\n int24 indexed tickUpper,\n uint128 amount0,\n uint128 amount1\n );\n\n /// @notice Emitted when a position's liquidity is removed\n /// @dev Does not withdraw any fees earned by the liquidity position, which must be withdrawn via #collect\n /// @param owner The owner of the position for which liquidity is removed\n /// @param tickLower The lower tick of the position\n /// @param tickUpper The upper tick of the position\n /// @param amount The amount of liquidity to remove\n /// @param amount0 The amount of token0 withdrawn\n /// @param amount1 The amount of token1 withdrawn\n event Burn(\n address indexed owner,\n int24 indexed tickLower,\n int24 indexed tickUpper,\n uint128 amount,\n uint256 amount0,\n uint256 amount1\n );\n\n /// @notice Emitted by the pool for any swaps between token0 and token1\n /// @param sender The address that initiated the swap call, and that received the callback\n /// @param recipient The address that received the output of the swap\n /// @param amount0 The delta of the token0 balance of the pool\n /// @param amount1 The delta of the token1 balance of the pool\n /// @param sqrtPriceX96 The sqrt(price) of the pool after the swap, as a Q64.96\n /// @param liquidity The liquidity of the pool after the swap\n /// @param tick The log base 1.0001 of price of the pool after the swap\n event Swap(\n address indexed sender,\n address indexed recipient,\n int256 amount0,\n int256 amount1,\n uint160 sqrtPriceX96,\n uint128 liquidity,\n int24 tick\n );\n\n /// @notice Emitted by the pool for any flashes of token0/token1\n /// @param sender The address that initiated the swap call, and that received the callback\n /// @param recipient The address that received the tokens from flash\n /// @param amount0 The amount of token0 that was flashed\n /// @param amount1 The amount of token1 that was flashed\n /// @param paid0 The amount of token0 paid for the flash, which can exceed the amount0 plus the fee\n /// @param paid1 The amount of token1 paid for the flash, which can exceed the amount1 plus the fee\n event Flash(\n address indexed sender,\n address indexed recipient,\n uint256 amount0,\n uint256 amount1,\n uint256 paid0,\n uint256 paid1\n );\n\n /// @notice Emitted by the pool for increases to the number of observations that can be stored\n /// @dev observationCardinalityNext is not the observation cardinality until an observation is written at the index\n /// just before a mint/swap/burn.\n /// @param observationCardinalityNextOld The previous value of the next observation cardinality\n /// @param observationCardinalityNextNew The updated value of the next observation cardinality\n event IncreaseObservationCardinalityNext(\n uint16 observationCardinalityNextOld,\n uint16 observationCardinalityNextNew\n );\n\n /// @notice Emitted when the protocol fee is changed by the pool\n /// @param feeProtocol0Old The previous value of the token0 protocol fee\n /// @param feeProtocol1Old The previous value of the token1 protocol fee\n /// @param feeProtocol0New The updated value of the token0 protocol fee\n /// @param feeProtocol1New The updated value of the token1 protocol fee\n event SetFeeProtocol(uint8 feeProtocol0Old, uint8 feeProtocol1Old, uint8 feeProtocol0New, uint8 feeProtocol1New);\n\n /// @notice Emitted when the collected protocol fees are withdrawn by the factory owner\n /// @param sender The address that collects the protocol fees\n /// @param recipient The address that receives the collected protocol fees\n /// @param amount0 The amount of token0 protocol fees that is withdrawn\n /// @param amount0 The amount of token1 protocol fees that is withdrawn\n event CollectProtocol(address indexed sender, address indexed recipient, uint128 amount0, uint128 amount1);\n}\n" - }, - "solidity/for-test/UniV3PairManagerForTest.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '@openzeppelin/contracts/token/ERC20/ERC20.sol';\nimport '@uniswap/v3-core/contracts/interfaces/IUniswapV3Pool.sol';\n\nimport '../contracts/libraries/LiquidityAmounts.sol';\nimport '../contracts/libraries/FixedPoint96.sol';\nimport '../contracts/libraries/FullMath.sol';\nimport '../contracts/libraries/TickMath.sol';\nimport '../contracts/UniV3PairManager.sol';\nimport '../interfaces/external/IWeth9.sol';\nimport '../interfaces/IUniV3PairManager.sol';\n\ncontract UniV3PairManagerForTest is UniV3PairManager {\n constructor(address _pool, address _governance) UniV3PairManager(_pool, _governance) {}\n\n function internalAddLiquidity(\n uint256 amount0Desired,\n uint256 amount1Desired,\n uint256 amount0Min,\n uint256 amount1Min\n )\n external\n returns (\n uint128 liquidity,\n uint256 amount0,\n uint256 amount1\n )\n {\n return _addLiquidity(amount0Desired, amount1Desired, amount0Min, amount1Min);\n }\n\n function internalPay(\n address token,\n address payer,\n address recipient,\n uint256 value\n ) external {\n return _pay(token, payer, recipient, value);\n }\n\n function internalMint(address dst, uint256 amount) external {\n return _mint(dst, amount);\n }\n\n function internalBurn(address dst, uint256 amount) external {\n return _burn(dst, amount);\n }\n\n function internalTransferTokens(\n address src,\n address dst,\n uint256 amount\n ) external {\n _transferTokens(src, dst, amount);\n }\n\n function internalSafeTransferFrom(\n address token,\n address from,\n address to,\n uint256 value\n ) external {\n _safeTransferFrom(token, from, to, value);\n }\n\n receive() external payable {}\n}\n" - }, - "@openzeppelin/contracts/token/ERC20/ERC20.sol": { - "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\nimport \"./IERC20.sol\";\nimport \"./extensions/IERC20Metadata.sol\";\nimport \"../../utils/Context.sol\";\n\n/**\n * @dev Implementation of the {IERC20} interface.\n *\n * This implementation is agnostic to the way tokens are created. This means\n * that a supply mechanism has to be added in a derived contract using {_mint}.\n * For a generic mechanism see {ERC20PresetMinterPauser}.\n *\n * TIP: For a detailed writeup see our guide\n * https://forum.zeppelin.solutions/t/how-to-implement-erc20-supply-mechanisms/226[How\n * to implement supply mechanisms].\n *\n * We have followed general OpenZeppelin Contracts guidelines: functions revert\n * instead returning `false` on failure. This behavior is nonetheless\n * conventional and does not conflict with the expectations of ERC20\n * applications.\n *\n * Additionally, an {Approval} event is emitted on calls to {transferFrom}.\n * This allows applications to reconstruct the allowance for all accounts just\n * by listening to said events. Other implementations of the EIP may not emit\n * these events, as it isn't required by the specification.\n *\n * Finally, the non-standard {decreaseAllowance} and {increaseAllowance}\n * functions have been added to mitigate the well-known issues around setting\n * allowances. See {IERC20-approve}.\n */\ncontract ERC20 is Context, IERC20, IERC20Metadata {\n mapping(address => uint256) private _balances;\n\n mapping(address => mapping(address => uint256)) private _allowances;\n\n uint256 private _totalSupply;\n\n string private _name;\n string private _symbol;\n\n /**\n * @dev Sets the values for {name} and {symbol}.\n *\n * The default value of {decimals} is 18. To select a different value for\n * {decimals} you should overload it.\n *\n * All two of these values are immutable: they can only be set once during\n * construction.\n */\n constructor(string memory name_, string memory symbol_) {\n _name = name_;\n _symbol = symbol_;\n }\n\n /**\n * @dev Returns the name of the token.\n */\n function name() public view virtual override returns (string memory) {\n return _name;\n }\n\n /**\n * @dev Returns the symbol of the token, usually a shorter version of the\n * name.\n */\n function symbol() public view virtual override returns (string memory) {\n return _symbol;\n }\n\n /**\n * @dev Returns the number of decimals used to get its user representation.\n * For example, if `decimals` equals `2`, a balance of `505` tokens should\n * be displayed to a user as `5.05` (`505 / 10 ** 2`).\n *\n * Tokens usually opt for a value of 18, imitating the relationship between\n * Ether and Wei. This is the value {ERC20} uses, unless this function is\n * overridden;\n *\n * NOTE: This information is only used for _display_ purposes: it in\n * no way affects any of the arithmetic of the contract, including\n * {IERC20-balanceOf} and {IERC20-transfer}.\n */\n function decimals() public view virtual override returns (uint8) {\n return 18;\n }\n\n /**\n * @dev See {IERC20-totalSupply}.\n */\n function totalSupply() public view virtual override returns (uint256) {\n return _totalSupply;\n }\n\n /**\n * @dev See {IERC20-balanceOf}.\n */\n function balanceOf(address account) public view virtual override returns (uint256) {\n return _balances[account];\n }\n\n /**\n * @dev See {IERC20-transfer}.\n *\n * Requirements:\n *\n * - `recipient` cannot be the zero address.\n * - the caller must have a balance of at least `amount`.\n */\n function transfer(address recipient, uint256 amount) public virtual override returns (bool) {\n _transfer(_msgSender(), recipient, amount);\n return true;\n }\n\n /**\n * @dev See {IERC20-allowance}.\n */\n function allowance(address owner, address spender) public view virtual override returns (uint256) {\n return _allowances[owner][spender];\n }\n\n /**\n * @dev See {IERC20-approve}.\n *\n * Requirements:\n *\n * - `spender` cannot be the zero address.\n */\n function approve(address spender, uint256 amount) public virtual override returns (bool) {\n _approve(_msgSender(), spender, amount);\n return true;\n }\n\n /**\n * @dev See {IERC20-transferFrom}.\n *\n * Emits an {Approval} event indicating the updated allowance. This is not\n * required by the EIP. See the note at the beginning of {ERC20}.\n *\n * Requirements:\n *\n * - `sender` and `recipient` cannot be the zero address.\n * - `sender` must have a balance of at least `amount`.\n * - the caller must have allowance for ``sender``'s tokens of at least\n * `amount`.\n */\n function transferFrom(\n address sender,\n address recipient,\n uint256 amount\n ) public virtual override returns (bool) {\n _transfer(sender, recipient, amount);\n\n uint256 currentAllowance = _allowances[sender][_msgSender()];\n require(currentAllowance >= amount, \"ERC20: transfer amount exceeds allowance\");\n unchecked {\n _approve(sender, _msgSender(), currentAllowance - amount);\n }\n\n return true;\n }\n\n /**\n * @dev Atomically increases the allowance granted to `spender` by the caller.\n *\n * This is an alternative to {approve} that can be used as a mitigation for\n * problems described in {IERC20-approve}.\n *\n * Emits an {Approval} event indicating the updated allowance.\n *\n * Requirements:\n *\n * - `spender` cannot be the zero address.\n */\n function increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool) {\n _approve(_msgSender(), spender, _allowances[_msgSender()][spender] + addedValue);\n return true;\n }\n\n /**\n * @dev Atomically decreases the allowance granted to `spender` by the caller.\n *\n * This is an alternative to {approve} that can be used as a mitigation for\n * problems described in {IERC20-approve}.\n *\n * Emits an {Approval} event indicating the updated allowance.\n *\n * Requirements:\n *\n * - `spender` cannot be the zero address.\n * - `spender` must have allowance for the caller of at least\n * `subtractedValue`.\n */\n function decreaseAllowance(address spender, uint256 subtractedValue) public virtual returns (bool) {\n uint256 currentAllowance = _allowances[_msgSender()][spender];\n require(currentAllowance >= subtractedValue, \"ERC20: decreased allowance below zero\");\n unchecked {\n _approve(_msgSender(), spender, currentAllowance - subtractedValue);\n }\n\n return true;\n }\n\n /**\n * @dev Moves `amount` of tokens from `sender` to `recipient`.\n *\n * This internal function is equivalent to {transfer}, and can be used to\n * e.g. implement automatic token fees, slashing mechanisms, etc.\n *\n * Emits a {Transfer} event.\n *\n * Requirements:\n *\n * - `sender` cannot be the zero address.\n * - `recipient` cannot be the zero address.\n * - `sender` must have a balance of at least `amount`.\n */\n function _transfer(\n address sender,\n address recipient,\n uint256 amount\n ) internal virtual {\n require(sender != address(0), \"ERC20: transfer from the zero address\");\n require(recipient != address(0), \"ERC20: transfer to the zero address\");\n\n _beforeTokenTransfer(sender, recipient, amount);\n\n uint256 senderBalance = _balances[sender];\n require(senderBalance >= amount, \"ERC20: transfer amount exceeds balance\");\n unchecked {\n _balances[sender] = senderBalance - amount;\n }\n _balances[recipient] += amount;\n\n emit Transfer(sender, recipient, amount);\n\n _afterTokenTransfer(sender, recipient, amount);\n }\n\n /** @dev Creates `amount` tokens and assigns them to `account`, increasing\n * the total supply.\n *\n * Emits a {Transfer} event with `from` set to the zero address.\n *\n * Requirements:\n *\n * - `account` cannot be the zero address.\n */\n function _mint(address account, uint256 amount) internal virtual {\n require(account != address(0), \"ERC20: mint to the zero address\");\n\n _beforeTokenTransfer(address(0), account, amount);\n\n _totalSupply += amount;\n _balances[account] += amount;\n emit Transfer(address(0), account, amount);\n\n _afterTokenTransfer(address(0), account, amount);\n }\n\n /**\n * @dev Destroys `amount` tokens from `account`, reducing the\n * total supply.\n *\n * Emits a {Transfer} event with `to` set to the zero address.\n *\n * Requirements:\n *\n * - `account` cannot be the zero address.\n * - `account` must have at least `amount` tokens.\n */\n function _burn(address account, uint256 amount) internal virtual {\n require(account != address(0), \"ERC20: burn from the zero address\");\n\n _beforeTokenTransfer(account, address(0), amount);\n\n uint256 accountBalance = _balances[account];\n require(accountBalance >= amount, \"ERC20: burn amount exceeds balance\");\n unchecked {\n _balances[account] = accountBalance - amount;\n }\n _totalSupply -= amount;\n\n emit Transfer(account, address(0), amount);\n\n _afterTokenTransfer(account, address(0), amount);\n }\n\n /**\n * @dev Sets `amount` as the allowance of `spender` over the `owner` s tokens.\n *\n * This internal function is equivalent to `approve`, and can be used to\n * e.g. set automatic allowances for certain subsystems, etc.\n *\n * Emits an {Approval} event.\n *\n * Requirements:\n *\n * - `owner` cannot be the zero address.\n * - `spender` cannot be the zero address.\n */\n function _approve(\n address owner,\n address spender,\n uint256 amount\n ) internal virtual {\n require(owner != address(0), \"ERC20: approve from the zero address\");\n require(spender != address(0), \"ERC20: approve to the zero address\");\n\n _allowances[owner][spender] = amount;\n emit Approval(owner, spender, amount);\n }\n\n /**\n * @dev Hook that is called before any transfer of tokens. This includes\n * minting and burning.\n *\n * Calling conditions:\n *\n * - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens\n * will be transferred to `to`.\n * - when `from` is zero, `amount` tokens will be minted for `to`.\n * - when `to` is zero, `amount` of ``from``'s tokens will be burned.\n * - `from` and `to` are never both zero.\n *\n * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].\n */\n function _beforeTokenTransfer(\n address from,\n address to,\n uint256 amount\n ) internal virtual {}\n\n /**\n * @dev Hook that is called after any transfer of tokens. This includes\n * minting and burning.\n *\n * Calling conditions:\n *\n * - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens\n * has been transferred to `to`.\n * - when `from` is zero, `amount` tokens have been minted for `to`.\n * - when `to` is zero, `amount` of ``from``'s tokens have been burned.\n * - `from` and `to` are never both zero.\n *\n * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].\n */\n function _afterTokenTransfer(\n address from,\n address to,\n uint256 amount\n ) internal virtual {}\n}\n" - }, - "solidity/contracts/libraries/LiquidityAmounts.sol": { - "content": "// SPDX-License-Identifier: GPL-2.0-or-later\npragma solidity >=0.8.4 <0.9.0;\n\nimport './FullMath.sol';\nimport './FixedPoint96.sol';\n\n// solhint-disable\nlibrary LiquidityAmounts {\n function toUint128(uint256 x) private pure returns (uint128 y) {\n require((y = uint128(x)) == x);\n }\n\n function getLiquidityForAmount0(\n uint160 sqrtRatioAX96,\n uint160 sqrtRatioBX96,\n uint256 amount0\n ) internal pure returns (uint128 liquidity) {\n if (sqrtRatioAX96 > sqrtRatioBX96) (sqrtRatioAX96, sqrtRatioBX96) = (sqrtRatioBX96, sqrtRatioAX96);\n uint256 intermediate = FullMath.mulDiv(sqrtRatioAX96, sqrtRatioBX96, FixedPoint96.Q96);\n return toUint128(FullMath.mulDiv(amount0, intermediate, sqrtRatioBX96 - sqrtRatioAX96));\n }\n\n function getLiquidityForAmount1(\n uint160 sqrtRatioAX96,\n uint160 sqrtRatioBX96,\n uint256 amount1\n ) internal pure returns (uint128 liquidity) {\n if (sqrtRatioAX96 > sqrtRatioBX96) (sqrtRatioAX96, sqrtRatioBX96) = (sqrtRatioBX96, sqrtRatioAX96);\n return toUint128(FullMath.mulDiv(amount1, FixedPoint96.Q96, sqrtRatioBX96 - sqrtRatioAX96));\n }\n\n function getLiquidityForAmounts(\n uint160 sqrtRatioX96,\n uint160 sqrtRatioAX96,\n uint160 sqrtRatioBX96,\n uint256 amount0,\n uint256 amount1\n ) internal pure returns (uint128 liquidity) {\n if (sqrtRatioAX96 > sqrtRatioBX96) (sqrtRatioAX96, sqrtRatioBX96) = (sqrtRatioBX96, sqrtRatioAX96);\n\n if (sqrtRatioX96 <= sqrtRatioAX96) {\n liquidity = getLiquidityForAmount0(sqrtRatioAX96, sqrtRatioBX96, amount0);\n } else if (sqrtRatioX96 < sqrtRatioBX96) {\n uint128 liquidity0 = getLiquidityForAmount0(sqrtRatioX96, sqrtRatioBX96, amount0);\n uint128 liquidity1 = getLiquidityForAmount1(sqrtRatioAX96, sqrtRatioX96, amount1);\n\n liquidity = liquidity0 < liquidity1 ? liquidity0 : liquidity1;\n } else {\n liquidity = getLiquidityForAmount1(sqrtRatioAX96, sqrtRatioBX96, amount1);\n }\n }\n\n function getAmount0ForLiquidity(\n uint160 sqrtRatioAX96,\n uint160 sqrtRatioBX96,\n uint128 liquidity\n ) internal pure returns (uint256 amount0) {\n if (sqrtRatioAX96 > sqrtRatioBX96) (sqrtRatioAX96, sqrtRatioBX96) = (sqrtRatioBX96, sqrtRatioAX96);\n\n return FullMath.mulDiv(uint256(liquidity) << FixedPoint96.RESOLUTION, sqrtRatioBX96 - sqrtRatioAX96, sqrtRatioBX96) / sqrtRatioAX96;\n }\n\n function getAmount1ForLiquidity(\n uint160 sqrtRatioAX96,\n uint160 sqrtRatioBX96,\n uint128 liquidity\n ) internal pure returns (uint256 amount1) {\n if (sqrtRatioAX96 > sqrtRatioBX96) (sqrtRatioAX96, sqrtRatioBX96) = (sqrtRatioBX96, sqrtRatioAX96);\n\n return FullMath.mulDiv(liquidity, sqrtRatioBX96 - sqrtRatioAX96, FixedPoint96.Q96);\n }\n\n function getAmountsForLiquidity(\n uint160 sqrtRatioX96,\n uint160 sqrtRatioAX96,\n uint160 sqrtRatioBX96,\n uint128 liquidity\n ) internal pure returns (uint256 amount0, uint256 amount1) {\n if (sqrtRatioAX96 > sqrtRatioBX96) (sqrtRatioAX96, sqrtRatioBX96) = (sqrtRatioBX96, sqrtRatioAX96);\n\n if (sqrtRatioX96 <= sqrtRatioAX96) {\n amount0 = getAmount0ForLiquidity(sqrtRatioAX96, sqrtRatioBX96, liquidity);\n } else if (sqrtRatioX96 < sqrtRatioBX96) {\n amount0 = getAmount0ForLiquidity(sqrtRatioX96, sqrtRatioBX96, liquidity);\n amount1 = getAmount1ForLiquidity(sqrtRatioAX96, sqrtRatioX96, liquidity);\n } else {\n amount1 = getAmount1ForLiquidity(sqrtRatioAX96, sqrtRatioBX96, liquidity);\n }\n }\n}\n" - }, - "solidity/contracts/libraries/FixedPoint96.sol": { - "content": "// SPDX-License-Identifier: GPL-2.0-or-later\npragma solidity >=0.8.4 <0.9.0;\n\nlibrary FixedPoint96 {\n // solhint-disable\n uint8 internal constant RESOLUTION = 96;\n uint256 internal constant Q96 = 0x1000000000000000000000000;\n}\n" - }, - "solidity/contracts/UniV3PairManager.sol": { - "content": "// SPDX-License-Identifier: MIT\n\n/*\n\nCoded for The Keep3r Network with ♥ by\n\n██████╗░███████╗███████╗██╗  ░██╗░░░░░░░██╗░█████╗░███╗░░██╗██████╗░███████╗██████╗░██╗░░░░░░█████╗░███╗░░██╗██████╗░\n██╔══██╗██╔════╝██╔════╝██║  ░██║░░██╗░░██║██╔══██╗████╗░██║██╔══██╗██╔════╝██╔══██╗██║░░░░░██╔══██╗████╗░██║██╔══██╗\n██║░░██║█████╗░░█████╗░░██║  ░╚██╗████╗██╔╝██║░░██║██╔██╗██║██║░░██║█████╗░░██████╔╝██║░░░░░███████║██╔██╗██║██║░░██║\n██║░░██║██╔══╝░░██╔══╝░░██║  ░░████╔═████║░██║░░██║██║╚████║██║░░██║██╔══╝░░██╔══██╗██║░░░░░██╔══██║██║╚████║██║░░██║\n██████╔╝███████╗██║░░░░░██║  ░░╚██╔╝░╚██╔╝░╚█████╔╝██║░╚███║██████╔╝███████╗██║░░██║███████╗██║░░██║██║░╚███║██████╔╝\n╚═════╝░╚══════╝╚═╝░░░░░╚═╝  ░░░╚═╝░░░╚═╝░░░╚════╝░╚═╝░░╚══╝╚═════╝░╚══════╝╚═╝░░╚═╝╚══════╝╚═╝░░╚═╝╚═╝░░╚══╝╚═════╝░\n\nhttps://defi.sucks\n\n*/\n\npragma solidity >=0.8.4 <0.9.0;\n\nimport '@openzeppelin/contracts/token/ERC20/ERC20.sol';\nimport '@uniswap/v3-core/contracts/interfaces/IUniswapV3Pool.sol';\n\nimport './libraries/LiquidityAmounts.sol';\nimport './libraries/FixedPoint96.sol';\nimport './libraries/FullMath.sol';\nimport './libraries/TickMath.sol';\n\nimport '../interfaces/external/IWeth9.sol';\nimport '../interfaces/IUniV3PairManager.sol';\n\nimport './peripherals/Governable.sol';\n\ncontract UniV3PairManager is IUniV3PairManager, Governable {\n /// @inheritdoc IERC20Metadata\n string public override name;\n\n /// @inheritdoc IERC20Metadata\n string public override symbol;\n\n /// @inheritdoc IERC20\n uint256 public override totalSupply;\n\n /// @inheritdoc IPairManager\n address public immutable override factory;\n\n /// @inheritdoc IPairManager\n address public immutable override token0;\n\n /// @inheritdoc IPairManager\n address public immutable override token1;\n\n /// @inheritdoc IPairManager\n address public immutable override pool;\n\n /// @inheritdoc IUniV3PairManager\n uint24 public immutable override fee;\n\n /// @inheritdoc IUniV3PairManager\n uint160 public immutable override sqrtRatioAX96;\n\n /// @inheritdoc IUniV3PairManager\n uint160 public immutable override sqrtRatioBX96;\n\n /// @inheritdoc IUniV3PairManager\n int24 public immutable override tickLower;\n\n /// @inheritdoc IUniV3PairManager\n int24 public immutable override tickUpper;\n\n /// @inheritdoc IUniV3PairManager\n int24 public immutable override tickSpacing;\n\n /// @notice Uniswap's maximum tick\n /// @dev Due to tick spacing, pools with different fees may have differences between _MAX_TICK and tickUpper. Use tickUpper to find the max tick of the pool.\n int24 private constant _MAX_TICK = 887272;\n\n /// @inheritdoc IERC20Metadata\n //solhint-disable-next-line const-name-snakecase\n uint8 public constant override decimals = 18;\n\n /// @inheritdoc IERC20\n mapping(address => mapping(address => uint256)) public override allowance;\n\n /// @inheritdoc IERC20\n mapping(address => uint256) public override balanceOf;\n\n /// @notice Struct that contains token0, token1, and fee of the Uniswap pool\n PoolKey private _poolKey;\n\n constructor(address _pool, address _governance) Governable(_governance) {\n uint24 _fee = IUniswapV3Pool(_pool).fee();\n address _token0 = IUniswapV3Pool(_pool).token0();\n address _token1 = IUniswapV3Pool(_pool).token1();\n int24 _tickSpacing = IUniswapV3Pool(_pool).tickSpacing();\n int24 _tickUpper = _MAX_TICK - (_MAX_TICK % _tickSpacing);\n int24 _tickLower = -_tickUpper;\n\n factory = msg.sender;\n pool = _pool;\n fee = _fee;\n tickSpacing = _tickSpacing;\n tickUpper = _tickUpper;\n tickLower = _tickLower;\n token0 = _token0;\n token1 = _token1;\n name = string(abi.encodePacked('Keep3rLP - ', ERC20(_token0).symbol(), '/', ERC20(_token1).symbol()));\n symbol = string(abi.encodePacked('kLP-', ERC20(_token0).symbol(), '/', ERC20(_token1).symbol()));\n\n sqrtRatioAX96 = TickMath.getSqrtRatioAtTick(_tickLower);\n sqrtRatioBX96 = TickMath.getSqrtRatioAtTick(_tickUpper);\n _poolKey = PoolKey({token0: _token0, token1: _token1, fee: _fee});\n }\n\n // This low-level function should be called from a contract which performs important safety checks\n /// @inheritdoc IUniV3PairManager\n function mint(\n uint256 amount0Desired,\n uint256 amount1Desired,\n uint256 amount0Min,\n uint256 amount1Min,\n address to\n ) external override returns (uint128 liquidity) {\n (liquidity, , ) = _addLiquidity(amount0Desired, amount1Desired, amount0Min, amount1Min);\n _mint(to, liquidity);\n }\n\n /// @inheritdoc IUniV3PairManager\n function uniswapV3MintCallback(\n uint256 amount0Owed,\n uint256 amount1Owed,\n bytes calldata data\n ) external override {\n MintCallbackData memory decoded = abi.decode(data, (MintCallbackData));\n if (msg.sender != pool) revert OnlyPool();\n if (amount0Owed > 0) _pay(decoded._poolKey.token0, decoded.payer, pool, amount0Owed);\n if (amount1Owed > 0) _pay(decoded._poolKey.token1, decoded.payer, pool, amount1Owed);\n }\n\n /// @inheritdoc IUniV3PairManager\n function burn(\n uint128 liquidity,\n uint256 amount0Min,\n uint256 amount1Min,\n address to\n ) external override returns (uint256 amount0, uint256 amount1) {\n (amount0, amount1) = IUniswapV3Pool(pool).burn(tickLower, tickUpper, liquidity);\n\n if (amount0 < amount0Min || amount1 < amount1Min) revert ExcessiveSlippage();\n\n IUniswapV3Pool(pool).collect(to, tickLower, tickUpper, uint128(amount0), uint128(amount1));\n _burn(msg.sender, liquidity);\n }\n\n /// @inheritdoc IUniV3PairManager\n function collect() external override onlyGovernance returns (uint256 amount0, uint256 amount1) {\n (, , , uint128 tokensOwed0, uint128 tokensOwed1) = IUniswapV3Pool(pool).positions(\n keccak256(abi.encodePacked(address(this), tickLower, tickUpper))\n );\n (amount0, amount1) = IUniswapV3Pool(pool).collect(governance, tickLower, tickUpper, tokensOwed0, tokensOwed1);\n }\n\n /// @inheritdoc IUniV3PairManager\n function position()\n external\n view\n override\n returns (\n uint128 liquidity,\n uint256 feeGrowthInside0LastX128,\n uint256 feeGrowthInside1LastX128,\n uint128 tokensOwed0,\n uint128 tokensOwed1\n )\n {\n (liquidity, feeGrowthInside0LastX128, feeGrowthInside1LastX128, tokensOwed0, tokensOwed1) = IUniswapV3Pool(pool).positions(\n keccak256(abi.encodePacked(address(this), tickLower, tickUpper))\n );\n }\n\n /// @inheritdoc IERC20\n function approve(address spender, uint256 amount) external override returns (bool) {\n allowance[msg.sender][spender] = amount;\n\n emit Approval(msg.sender, spender, amount);\n return true;\n }\n\n /// @inheritdoc IERC20\n function transfer(address to, uint256 amount) external override returns (bool) {\n _transferTokens(msg.sender, to, amount);\n return true;\n }\n\n /// @inheritdoc IERC20\n function transferFrom(\n address from,\n address to,\n uint256 amount\n ) external override returns (bool) {\n address spender = msg.sender;\n uint256 spenderAllowance = allowance[from][spender];\n\n if (spender != from && spenderAllowance != type(uint256).max) {\n uint256 newAllowance = spenderAllowance - amount;\n allowance[from][spender] = newAllowance;\n\n emit Approval(from, spender, newAllowance);\n }\n\n _transferTokens(from, to, amount);\n return true;\n }\n\n /// @notice Adds liquidity to an initialized pool\n /// @dev Reverts if the returned amount0 is less than amount0Min or if amount1 is less than amount1Min\n /// @dev This function calls the mint function of the corresponding Uniswap pool, which in turn calls UniswapV3Callback\n /// @param amount0Desired The amount of token0 we would like to provide\n /// @param amount1Desired The amount of token1 we would like to provide\n /// @param amount0Min The minimum amount of token0 we want to provide\n /// @param amount1Min The minimum amount of token1 we want to provide\n /// @return liquidity The calculated liquidity we get for the token amounts we provided\n /// @return amount0 The amount of token0 we ended up providing\n /// @return amount1 The amount of token1 we ended up providing\n function _addLiquidity(\n uint256 amount0Desired,\n uint256 amount1Desired,\n uint256 amount0Min,\n uint256 amount1Min\n )\n internal\n returns (\n uint128 liquidity,\n uint256 amount0,\n uint256 amount1\n )\n {\n (uint160 sqrtPriceX96, , , , , , ) = IUniswapV3Pool(pool).slot0();\n\n liquidity = LiquidityAmounts.getLiquidityForAmounts(sqrtPriceX96, sqrtRatioAX96, sqrtRatioBX96, amount0Desired, amount1Desired);\n\n (amount0, amount1) = IUniswapV3Pool(pool).mint(\n address(this),\n tickLower,\n tickUpper,\n liquidity,\n abi.encode(MintCallbackData({_poolKey: _poolKey, payer: msg.sender}))\n );\n\n if (amount0 < amount0Min || amount1 < amount1Min) revert ExcessiveSlippage();\n }\n\n /// @notice Transfers the passed-in token from the payer to the recipient for the corresponding value\n /// @param token The token to be transferred to the recipient\n /// @param from The address of the payer\n /// @param to The address of the passed-in tokens recipient\n /// @param value How much of that token to be transferred from payer to the recipient\n function _pay(\n address token,\n address from,\n address to,\n uint256 value\n ) internal {\n _safeTransferFrom(token, from, to, value);\n }\n\n /// @notice Mints Keep3r credits to the passed-in address of recipient and increases total supply of Keep3r credits by the corresponding amount\n /// @param to The recipient of the Keep3r credits\n /// @param amount The amount Keep3r credits to be minted to the recipient\n function _mint(address to, uint256 amount) internal {\n totalSupply += amount;\n balanceOf[to] += amount;\n emit Transfer(address(0), to, amount);\n }\n\n /// @notice Burns Keep3r credits to the passed-in address of recipient and reduces total supply of Keep3r credits by the corresponding amount\n /// @param to The address that will get its Keep3r credits burned\n /// @param amount The amount Keep3r credits to be burned from the recipient/recipient\n function _burn(address to, uint256 amount) internal {\n totalSupply -= amount;\n balanceOf[to] -= amount;\n emit Transfer(to, address(0), amount);\n }\n\n /// @notice Transfers amount of Keep3r credits between two addresses\n /// @param from The user that transfers the Keep3r credits\n /// @param to The user that receives the Keep3r credits\n /// @param amount The amount of Keep3r credits to be transferred\n function _transferTokens(\n address from,\n address to,\n uint256 amount\n ) internal {\n balanceOf[from] -= amount;\n balanceOf[to] += amount;\n\n emit Transfer(from, to, amount);\n }\n\n /// @notice Transfers the passed-in token from the specified \"from\" to the specified \"to\" for the corresponding value\n /// @dev Reverts with IUniV3PairManager#UnsuccessfulTransfer if the transfer was not successful,\n /// or if the passed data length is different than 0 and the decoded data is not a boolean\n /// @param token The token to be transferred to the specified \"to\"\n /// @param from The address which is going to transfer the tokens\n /// @param value How much of that token to be transferred from \"from\" to \"to\"\n function _safeTransferFrom(\n address token,\n address from,\n address to,\n uint256 value\n ) internal {\n // solhint-disable-next-line avoid-low-level-calls\n (bool success, bytes memory data) = token.call(abi.encodeWithSelector(IERC20.transferFrom.selector, from, to, value));\n if (!success || (data.length != 0 && !abi.decode(data, (bool)))) revert UnsuccessfulTransfer();\n }\n}\n" - }, - "solidity/interfaces/external/IWeth9.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '@openzeppelin/contracts/token/ERC20/IERC20.sol';\n\ninterface IWeth9 is IERC20 {\n function deposit() external payable;\n\n function withdraw(uint256) external;\n}\n" - }, - "solidity/interfaces/IUniV3PairManager.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport './IPairManager.sol';\nimport '@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol';\nimport './peripherals/IGovernable.sol';\n\n/// @title Pair Manager contract\n/// @notice Creates a UniswapV3 position, and tokenizes in an ERC20 manner\n/// so that the user can use it as liquidity for a Keep3rJob\ninterface IUniV3PairManager is IGovernable, IPairManager {\n // Structs\n struct PoolKey {\n address token0;\n address token1;\n uint24 fee;\n }\n\n /// @notice The data to be decoded by the UniswapV3MintCallback function\n struct MintCallbackData {\n PoolKey _poolKey; // Struct that contains token0, token1, and fee of the pool passed into the constructor\n address payer; // The address of the payer, which will be the msg.sender of the mint function\n }\n\n // Variables\n\n /// @notice The fee of the Uniswap pool passed into the constructor\n /// @return _fee The fee of the Uniswap pool passed into the constructor\n function fee() external view returns (uint24 _fee);\n\n /// @notice Highest tick in the Uniswap's curve\n /// @return _tickUpper The highest tick in the Uniswap's curve\n function tickUpper() external view returns (int24 _tickUpper);\n\n /// @notice Lowest tick in the Uniswap's curve\n /// @return _tickLower The lower tick in the Uniswap's curve\n function tickLower() external view returns (int24 _tickLower);\n\n /// @notice The pair tick spacing\n /// @return _tickSpacing The pair tick spacing\n function tickSpacing() external view returns (int24 _tickSpacing);\n\n /// @notice The sqrtRatioAX96 at the lowest tick (-887200) of the Uniswap pool\n /// @return _sqrtPriceA96 A Fixed point Q64.96 number representing the sqrt of the ratio of the two assets (token1/token0)\n /// at the lowest tick\n function sqrtRatioAX96() external view returns (uint160 _sqrtPriceA96);\n\n /// @notice The sqrtRatioBX96 at the highest tick (887200) of the Uniswap pool\n /// @return _sqrtPriceBX96 A Fixed point Q64.96 number representing the sqrt of the ratio of the two assets (token1/token0)\n /// at the highest tick\n function sqrtRatioBX96() external view returns (uint160 _sqrtPriceBX96);\n\n // Errors\n\n /// @notice Throws when the caller of the function is not the pool\n error OnlyPool();\n\n /// @notice Throws when the slippage exceeds what the user is comfortable with\n error ExcessiveSlippage();\n\n /// @notice Throws when a transfer is unsuccessful\n error UnsuccessfulTransfer();\n\n // Methods\n\n /// @notice This function is called after a user calls IUniV3PairManager#mint function\n /// It ensures that any tokens owed to the pool are paid by the msg.sender of IUniV3PairManager#mint function\n /// @param amount0Owed The amount of token0 due to the pool for the minted liquidity\n /// @param amount1Owed The amount of token1 due to the pool for the minted liquidity\n /// @param data The encoded token0, token1, fee (_poolKey) and the payer (msg.sender) of the IUniV3PairManager#mint function\n function uniswapV3MintCallback(\n uint256 amount0Owed,\n uint256 amount1Owed,\n bytes calldata data\n ) external;\n\n /// @notice Mints kLP tokens to an address according to the liquidity the msg.sender provides to the UniswapV3 pool\n /// @dev Triggers UniV3PairManager#uniswapV3MintCallback\n /// @param amount0Desired The amount of token0 we would like to provide\n /// @param amount1Desired The amount of token1 we would like to provide\n /// @param amount0Min The minimum amount of token0 we want to provide\n /// @param amount1Min The minimum amount of token1 we want to provide\n /// @param to The address to which the kLP tokens are going to be minted to\n /// @return liquidity kLP tokens sent in exchange for the provision of tokens\n function mint(\n uint256 amount0Desired,\n uint256 amount1Desired,\n uint256 amount0Min,\n uint256 amount1Min,\n address to\n ) external returns (uint128 liquidity);\n\n /// @notice Returns the pair manager's position in the corresponding UniswapV3 pool\n /// @return liquidity The amount of liquidity provided to the UniswapV3 pool by the pair manager\n /// @return feeGrowthInside0LastX128 The fee growth of token0 as of the last action on the individual position\n /// @return feeGrowthInside1LastX128 The fee growth of token1 as of the last action on the individual position\n /// @return tokensOwed0 The uncollected amount of token0 owed to the position as of the last computation\n /// @return tokensOwed1 The uncollected amount of token1 owed to the position as of the last computation\n function position()\n external\n view\n returns (\n uint128 liquidity,\n uint256 feeGrowthInside0LastX128,\n uint256 feeGrowthInside1LastX128,\n uint128 tokensOwed0,\n uint128 tokensOwed1\n );\n\n /// @notice Calls the UniswapV3 pool's collect function, which collects up to a maximum amount of fees\n // owed to a specific position to the recipient, in this case, that recipient is the pair manager\n /// @dev The collected fees will be sent to governance\n /// @return amount0 The amount of fees collected in token0\n /// @return amount1 The amount of fees collected in token1\n function collect() external returns (uint256 amount0, uint256 amount1);\n\n /// @notice Burns the corresponding amount of kLP tokens from the msg.sender and withdraws the specified liquidity\n // in the entire range\n /// @param liquidity The amount of liquidity to be burned\n /// @param amount0Min The minimum amount of token0 we want to send to the recipient (to)\n /// @param amount1Min The minimum amount of token1 we want to send to the recipient (to)\n /// @param to The address that will receive the due fees\n /// @return amount0 The calculated amount of token0 that will be sent to the recipient\n /// @return amount1 The calculated amount of token1 that will be sent to the recipient\n function burn(\n uint128 liquidity,\n uint256 amount0Min,\n uint256 amount1Min,\n address to\n ) external returns (uint256 amount0, uint256 amount1);\n}\n" - }, - "@openzeppelin/contracts/utils/Context.sol": { - "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Provides information about the current execution context, including the\n * sender of the transaction and its data. While these are generally available\n * via msg.sender and msg.data, they should not be accessed in such a direct\n * manner, since when dealing with meta-transactions the account sending and\n * paying for execution may not be the actual sender (as far as an application\n * is concerned).\n *\n * This contract is only required for intermediate, library-like contracts.\n */\nabstract contract Context {\n function _msgSender() internal view virtual returns (address) {\n return msg.sender;\n }\n\n function _msgData() internal view virtual returns (bytes calldata) {\n return msg.data;\n }\n}\n" - }, - "solidity/interfaces/IPairManagerFactory.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport './peripherals/IGovernable.sol';\n\n/// @title Factory of Pair Managers\n/// @notice This contract creates new pair managers\ninterface IPairManagerFactory is IGovernable {\n // Variables\n\n /// @notice Maps the address of a Uniswap pool, to the address of the corresponding PairManager\n /// For example, the uniswap address of DAI-WETH, will return the Keep3r/DAI-WETH pair manager address\n /// @param _pool The address of the Uniswap pool\n /// @return _pairManager The address of the corresponding pair manager\n function pairManagers(address _pool) external view returns (address _pairManager);\n\n // Events\n\n /// @notice Emitted when a new pair manager is created\n /// @param _pool The address of the corresponding Uniswap pool\n /// @param _pairManager The address of the just-created pair manager\n event PairCreated(address _pool, address _pairManager);\n\n // Errors\n\n /// @notice Throws an error if the pair manager is already initialized\n error AlreadyInitialized();\n\n /// @notice Throws an error if the caller is not the owner\n error OnlyOwner();\n\n // Methods\n\n /// @notice Creates a new pair manager based on the address of a Uniswap pool\n /// For example, the uniswap address of DAI-WETH, will create the Keep3r/DAI-WETH pool\n /// @param _pool The address of the Uniswap pool the pair manager will be based of\n /// @return _pairManager The address of the just-created pair manager\n function createPairManager(address _pool) external returns (address _pairManager);\n}\n" - }, - "solidity/contracts/UniV3PairManagerFactory.sol": { - "content": "// SPDX-License-Identifier: MIT\n\n/*\n\nCoded for The Keep3r Network with ♥ by\n\n██████╗░███████╗███████╗██╗  ░██╗░░░░░░░██╗░█████╗░███╗░░██╗██████╗░███████╗██████╗░██╗░░░░░░█████╗░███╗░░██╗██████╗░\n██╔══██╗██╔════╝██╔════╝██║  ░██║░░██╗░░██║██╔══██╗████╗░██║██╔══██╗██╔════╝██╔══██╗██║░░░░░██╔══██╗████╗░██║██╔══██╗\n██║░░██║█████╗░░█████╗░░██║  ░╚██╗████╗██╔╝██║░░██║██╔██╗██║██║░░██║█████╗░░██████╔╝██║░░░░░███████║██╔██╗██║██║░░██║\n██║░░██║██╔══╝░░██╔══╝░░██║  ░░████╔═████║░██║░░██║██║╚████║██║░░██║██╔══╝░░██╔══██╗██║░░░░░██╔══██║██║╚████║██║░░██║\n██████╔╝███████╗██║░░░░░██║  ░░╚██╔╝░╚██╔╝░╚█████╔╝██║░╚███║██████╔╝███████╗██║░░██║███████╗██║░░██║██║░╚███║██████╔╝\n╚═════╝░╚══════╝╚═╝░░░░░╚═╝  ░░░╚═╝░░░╚═╝░░░╚════╝░╚═╝░░╚══╝╚═════╝░╚══════╝╚═╝░░╚═╝╚══════╝╚═╝░░╚═╝╚═╝░░╚══╝╚═════╝░\n\nhttps://defi.sucks\n\n*/\n\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../interfaces/IPairManagerFactory.sol';\nimport './UniV3PairManager.sol';\nimport './peripherals/Governable.sol';\n\n/// @title Factory of Pair Managers\n/// @notice This contract creates new pair managers\ncontract UniV3PairManagerFactory is IPairManagerFactory, Governable {\n mapping(address => address) public override pairManagers;\n\n constructor(address _governance) Governable(_governance) {}\n\n ///@inheritdoc IPairManagerFactory\n function createPairManager(address _pool) external override returns (address _pairManager) {\n if (pairManagers[_pool] != address(0)) revert AlreadyInitialized();\n _pairManager = address(new UniV3PairManager(_pool, governance));\n pairManagers[_pool] = _pairManager;\n emit PairCreated(_pool, _pairManager);\n }\n}\n" - }, - "solidity/for-test/peripherals/GovernableForTest.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../../contracts/peripherals/Governable.sol';\n\ncontract GovernableForTest is Governable {\n constructor(address _governor) Governable(_governor) {}\n}\n" - }, - "solidity/for-test/BridgeForTest.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.0 <0.9.0;\n\nimport '@openzeppelin/contracts/token/ERC20/ERC20.sol';\nimport '@openzeppelin/contracts/token/ERC20/IERC20.sol';\n\ncontract BridgeForTest is ERC20 {\n address public immutable kp3r;\n\n constructor(address _kp3r) ERC20('Wrapped KP3R', 'wKP3R') {\n kp3r = _kp3r;\n }\n\n function bridge(uint256 _amount) external {\n IERC20(kp3r).transferFrom(msg.sender, address(this), _amount);\n _mint(msg.sender, _amount);\n }\n\n function bridgeBack(uint256 _amount) external {\n _burn(msg.sender, _amount);\n IERC20(kp3r).transfer(msg.sender, _amount);\n }\n}\n" - }, - "solidity/for-test/ERC20ForTest.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '@openzeppelin/contracts/token/ERC20/ERC20.sol';\n\ncontract ERC20ForTest is ERC20 {\n constructor(\n string memory _name,\n string memory _symbol,\n address _initialAccount,\n uint256 _initialBalance\n ) ERC20(_name, _symbol) {\n _mint(_initialAccount, _initialBalance);\n }\n\n function mint(uint256 _amount) public {\n _mint(msg.sender, _amount);\n }\n\n function mint(address _account, uint256 _amount) public {\n _mint(_account, _amount);\n }\n\n function burn(uint256 _amount) public {\n _burn(msg.sender, _amount);\n }\n\n function burn(address _account, uint256 _amount) public {\n _burn(_account, _amount);\n }\n\n function transferInternal(\n address _from,\n address _to,\n uint256 _value\n ) public {\n _transfer(_from, _to, _value);\n }\n\n function approveInternal(\n address _owner,\n address _spender,\n uint256 _value\n ) public {\n _approve(_owner, _spender, _value);\n }\n\n function deposit() external payable {\n // Function added for compatibility with WETH\n }\n}\n" - }, - "solidity/for-test/peripherals/keepers/Keep3rKeeperFundableForTest.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../../../contracts/peripherals/keepers/Keep3rKeeperFundable.sol';\n\ncontract Keep3rKeeperFundableForTest is Keep3rKeeperFundable {\n using EnumerableSet for EnumerableSet.AddressSet;\n\n constructor(\n address _kph,\n address _keep3rV1,\n address _keep3rV1Proxy\n ) Keep3rParameters(_kph, _keep3rV1, _keep3rV1Proxy) Keep3rRoles(msg.sender) {}\n\n function isKeeper(address _keeper) external view returns (bool) {\n return _keepers.contains(_keeper);\n }\n\n function setJob(address job) external {\n _jobs.add(job);\n }\n}\n" - }, - "solidity/contracts/sidechain/Keep3rEscrow.sol": { - "content": "// SPDX-License-Identifier: MIT\n\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../peripherals/Mintable.sol';\nimport '../peripherals/DustCollector.sol';\nimport '../../interfaces/sidechain/IKeep3rEscrow.sol';\nimport '@openzeppelin/contracts/token/ERC20/IERC20.sol';\nimport '@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol';\n\ncontract Keep3rEscrow is Mintable, DustCollector, IKeep3rEscrow {\n using SafeERC20 for IERC20;\n\n /// @inheritdoc IKeep3rEscrow\n address public override wKP3R;\n\n /// @param _governance Address of governance\n /// @param _wKP3R Address of wrapped KP3R implementation\n constructor(address _governance, address _wKP3R) Mintable(_governance) {\n wKP3R = _wKP3R;\n }\n\n /// @inheritdoc IKeep3rEscrow\n function deposit(uint256 _amount) external override {\n IERC20(wKP3R).safeTransferFrom(msg.sender, address(this), _amount);\n emit wKP3RDeposited(wKP3R, msg.sender, _amount);\n }\n\n /// @inheritdoc IKeep3rEscrow\n function mint(uint256 _amount) external override onlyMinter {\n IERC20(wKP3R).safeTransfer(msg.sender, _amount);\n emit wKP3RMinted(wKP3R, msg.sender, _amount);\n }\n\n /// @inheritdoc IKeep3rEscrow\n function setWKP3R(address _wKP3R) external override onlyGovernance {\n if (_wKP3R == address(0)) revert ZeroAddress();\n wKP3R = _wKP3R;\n emit wKP3RSet(wKP3R);\n }\n}\n" - }, - "solidity/contracts/peripherals/Mintable.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../../interfaces/peripherals/IMintable.sol';\nimport './Governable.sol';\n\nabstract contract Mintable is Governable, IMintable {\n /// @inheritdoc IMintable\n address public override minter;\n\n constructor(address _governance) Governable(_governance) {}\n\n /// @inheritdoc IMintable\n function setMinter(address _minter) external override onlyGovernance {\n if (_minter == address(0)) revert ZeroAddress();\n minter = _minter;\n emit MinterSet(_minter);\n }\n\n /// @notice Functions with this modifier can only be called by the minter;\n modifier onlyMinter() {\n if (msg.sender != minter) revert OnlyMinter();\n _;\n }\n}\n" - }, - "solidity/for-test/peripherals/DustCollectorForTest.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../../contracts/peripherals/DustCollector.sol';\n\ncontract DustCollectorForTest is DustCollector {\n constructor() DustCollector() Governable(msg.sender) {}\n}\n" - }, - "solidity/for-test/peripherals/Keep3rAccountanceForTest.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../../contracts/peripherals/Keep3rAccountance.sol';\n\ncontract Keep3rAccountanceForTest is Keep3rAccountance {\n using EnumerableSet for EnumerableSet.AddressSet;\n\n constructor() Keep3rRoles(msg.sender) {}\n\n function setJob(address job) external {\n _jobs.add(job);\n }\n\n function setKeeper(address keeper) external {\n _keepers.add(keeper);\n }\n}\n" - }, - "solidity/for-test/peripherals/jobs/Keep3rJobFundableLiquidityForTest.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../../../contracts/peripherals/jobs/Keep3rJobFundableLiquidity.sol';\n\ncontract Keep3rJobFundableLiquidityForTest is Keep3rJobFundableLiquidity {\n using EnumerableSet for EnumerableSet.AddressSet;\n\n constructor(\n address _kph,\n address _keep3rV1,\n address _keep3rV1Proxy\n ) Keep3rParameters(_kph, _keep3rV1, _keep3rV1Proxy) Keep3rRoles(msg.sender) {}\n\n function setJob(address _job) external {\n _jobs.add(_job);\n }\n\n function setJobLiquidity(address _job, address _liquidity) external returns (bool) {\n return _jobLiquidities[_job].add(_liquidity);\n }\n\n function setApprovedLiquidity(address _liquidity) external {\n _approvedLiquidities.add(_liquidity);\n }\n\n function setRevokedLiquidity(address _liquidity) external {\n _approvedLiquidities.remove(_liquidity);\n }\n\n function viewTickCache(address _liquidity) external view returns (TickCache memory _tickCache) {\n _tickCache = _tick[_liquidity];\n }\n\n function viewTickOrder(address _liquidity) external view returns (bool) {\n return _isKP3RToken0[_liquidity];\n }\n\n function internalJobLiquidities(address _job) external view returns (address[] memory _list) {\n _list = _jobLiquidities[_job].values();\n }\n\n function internalSettleJobAccountance(address _job) external {\n _settleJobAccountance(_job);\n }\n}\n" - }, - "solidity/for-test/peripherals/jobs/Keep3rJobDisputableForTest.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../../../contracts/peripherals/jobs/Keep3rJobDisputable.sol';\n\ncontract Keep3rJobDisputableForTest is Keep3rJobDisputable {\n using EnumerableSet for EnumerableSet.AddressSet;\n\n constructor(\n address _kph,\n address _keep3rV1,\n address _keep3rV1Proxy\n ) Keep3rParameters(_kph, _keep3rV1, _keep3rV1Proxy) Keep3rRoles(msg.sender) {}\n\n function setJobLiquidity(address _job, address _liquidity) external {\n _jobLiquidities[_job].add(_liquidity);\n }\n\n function setJobToken(address _job, address _token) external {\n _jobTokens[_job].add(_token);\n }\n\n function setApprovedLiquidity(address _liquidity) external {\n _approvedLiquidities.add(_liquidity);\n }\n\n function setRevokedLiquidity(address _liquidity) external {\n _approvedLiquidities.remove(_liquidity);\n }\n\n function internalJobLiquidityCredits(address _job) external view returns (uint256 _credits) {\n _credits = _jobLiquidityCredits[_job];\n }\n\n function internalJobPeriodCredits(address _job) external view returns (uint256 _credits) {\n _credits = _jobPeriodCredits[_job];\n }\n\n function internalJobTokens(address _job) external view returns (address[] memory _tokens) {\n _tokens = new address[](_jobTokens[_job].length());\n for (uint256 i; i < _jobTokens[_job].length(); i++) {\n _tokens[i] = _jobTokens[_job].at(i);\n }\n }\n\n function internalJobLiquidities(address _job) external view returns (address[] memory _tokens) {\n _tokens = new address[](_jobLiquidities[_job].length());\n for (uint256 i; i < _jobLiquidities[_job].length(); i++) {\n _tokens[i] = _jobLiquidities[_job].at(i);\n }\n }\n}\n" - }, - "solidity/for-test/peripherals/Keep3rDisputableForTest.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../../contracts/peripherals/Keep3rDisputable.sol';\n\ncontract Keep3rDisputableForTest is Keep3rDisputable {\n constructor() Keep3rParameters(address(0), address(0), address(0)) Keep3rRoles(msg.sender) {}\n}\n" - }, - "solidity/for-test/peripherals/keepers/Keep3rKeeperDisputableForTest.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../../../contracts/peripherals/keepers/Keep3rKeeperDisputable.sol';\n\ncontract Keep3rKeeperDisputableForTest is Keep3rKeeperDisputable {\n using EnumerableSet for EnumerableSet.AddressSet;\n\n constructor(\n address _kph,\n address _keep3rV1,\n address _keep3rV1Proxy\n ) Keep3rParameters(_kph, _keep3rV1, _keep3rV1Proxy) Keep3rRoles(msg.sender) {}\n\n function setKeeper(address _keeper) external {\n _keepers.add(_keeper);\n }\n\n function internalSlash(\n address _bonded,\n address _keeper,\n uint256 _bondAmount,\n uint256 _unbondAmount\n ) external {\n _slash(_bonded, _keeper, _bondAmount, _unbondAmount);\n }\n\n function isKeeper(address _address) external view returns (bool _isKeeper) {\n _isKeeper = _keepers.contains(_address);\n }\n}\n" - }, - "solidity/for-test/peripherals/jobs/Keep3rJobFundableCreditsForTest.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../../../contracts/peripherals/jobs/Keep3rJobFundableCredits.sol';\n\ncontract Keep3rJobFundableCreditsForTest is Keep3rJobFundableCredits {\n using EnumerableSet for EnumerableSet.AddressSet;\n\n constructor(\n address _kph,\n address _keep3rV1,\n address _keep3rV1Proxy\n ) Keep3rParameters(_kph, _keep3rV1, _keep3rV1Proxy) Keep3rRoles(msg.sender) {}\n\n function setJob(address _job, address _jobOwner) external {\n _jobs.add(_job);\n jobOwner[_job] = _jobOwner;\n }\n\n function setJobToken(address _job, address _token) external {\n _jobTokens[_job].add(_token);\n }\n\n function isJobToken(address _job, address _token) external view returns (bool _contains) {\n _contains = _jobTokens[_job].contains(_token);\n }\n}\n" - }, - "solidity/contracts/Keep3rHelper.sol": { - "content": "// SPDX-License-Identifier: MIT\n\n/*\n\nCoded for The Keep3r Network with ♥ by\n\n██████╗░███████╗███████╗██╗  ░██╗░░░░░░░██╗░█████╗░███╗░░██╗██████╗░███████╗██████╗░██╗░░░░░░█████╗░███╗░░██╗██████╗░\n██╔══██╗██╔════╝██╔════╝██║  ░██║░░██╗░░██║██╔══██╗████╗░██║██╔══██╗██╔════╝██╔══██╗██║░░░░░██╔══██╗████╗░██║██╔══██╗\n██║░░██║█████╗░░█████╗░░██║  ░╚██╗████╗██╔╝██║░░██║██╔██╗██║██║░░██║█████╗░░██████╔╝██║░░░░░███████║██╔██╗██║██║░░██║\n██║░░██║██╔══╝░░██╔══╝░░██║  ░░████╔═████║░██║░░██║██║╚████║██║░░██║██╔══╝░░██╔══██╗██║░░░░░██╔══██║██║╚████║██║░░██║\n██████╔╝███████╗██║░░░░░██║  ░░╚██╔╝░╚██╔╝░╚█████╔╝██║░╚███║██████╔╝███████╗██║░░██║███████╗██║░░██║██║░╚███║██████╔╝\n╚═════╝░╚══════╝╚═╝░░░░░╚═╝  ░░░╚═╝░░░╚═╝░░░╚════╝░╚═╝░░╚══╝╚═════╝░╚══════╝╚═╝░░╚═╝╚══════╝╚═╝░░╚═╝╚═╝░░╚══╝╚═════╝░\n\nhttps://defi.sucks\n\n*/\n\npragma solidity >=0.8.7 <0.9.0;\n\nimport './libraries/FullMath.sol';\nimport './libraries/TickMath.sol';\nimport '../interfaces/IKeep3r.sol';\nimport '../interfaces/IKeep3rHelper.sol';\nimport './Keep3rHelperParameters.sol';\n\nimport '@openzeppelin/contracts/utils/math/Math.sol';\nimport '@uniswap/v3-core/contracts/interfaces/IUniswapV3Pool.sol';\n\ncontract Keep3rHelper is IKeep3rHelper, Keep3rHelperParameters {\n constructor(\n address _kp3r,\n address _keep3rV2,\n address _governance,\n address _kp3rWethPool\n ) Keep3rHelperParameters(_kp3r, _keep3rV2, _governance, _kp3rWethPool) {}\n\n /// @inheritdoc IKeep3rHelper\n function quote(uint256 _eth) public view override returns (uint256 _amountOut) {\n uint32[] memory _secondsAgos = new uint32[](2);\n _secondsAgos[1] = quoteTwapTime;\n\n (int56[] memory _tickCumulatives, ) = IUniswapV3Pool(kp3rWethPool.poolAddress).observe(_secondsAgos);\n int56 _difference = _tickCumulatives[0] - _tickCumulatives[1];\n _amountOut = getQuoteAtTick(uint128(_eth), kp3rWethPool.isTKNToken0 ? _difference : -_difference, quoteTwapTime);\n }\n\n /// @inheritdoc IKeep3rHelper\n function bonds(address _keeper) public view virtual override returns (uint256 _amountBonded) {\n return IKeep3r(keep3rV2).bonds(_keeper, KP3R);\n }\n\n /// @inheritdoc IKeep3rHelper\n function getRewardAmountFor(address _keeper, uint256 _gasUsed) public view override returns (uint256 _kp3r) {\n uint256 _boost = getRewardBoostFor(bonds(_keeper));\n _kp3r = quote((_gasUsed * _boost) / BOOST_BASE);\n }\n\n /// @inheritdoc IKeep3rHelper\n function getRewardAmount(uint256 _gasUsed) external view override returns (uint256 _amount) {\n // solhint-disable-next-line avoid-tx-origin\n return getRewardAmountFor(tx.origin, _gasUsed);\n }\n\n /// @inheritdoc IKeep3rHelper\n function getRewardBoostFor(uint256 _bonds) public view override returns (uint256 _rewardBoost) {\n _bonds = Math.min(_bonds, targetBond);\n uint256 _cap = minBoost + ((maxBoost - minBoost) * _bonds) / targetBond;\n _rewardBoost = _cap * _getBasefee();\n }\n\n /// @inheritdoc IKeep3rHelper\n function getPoolTokens(address _pool) public view override returns (address _token0, address _token1) {\n return (IUniswapV3Pool(_pool).token0(), IUniswapV3Pool(_pool).token1());\n }\n\n /// @inheritdoc IKeep3rHelper\n function isKP3RToken0(address _pool) external view virtual override returns (bool _isKP3RToken0) {\n address _token0;\n address _token1;\n (_token0, _token1) = getPoolTokens(_pool);\n if (_token0 == KP3R) {\n return true;\n } else if (_token1 != KP3R) {\n revert LiquidityPairInvalid();\n }\n }\n\n /// @inheritdoc IKeep3rHelper\n function observe(address _pool, uint32[] memory _secondsAgo)\n external\n view\n override\n returns (\n int56 _tickCumulative1,\n int56 _tickCumulative2,\n bool _success\n )\n {\n try IUniswapV3Pool(_pool).observe(_secondsAgo) returns (int56[] memory _uniswapResponse, uint160[] memory) {\n _tickCumulative1 = _uniswapResponse[0];\n if (_uniswapResponse.length > 1) {\n _tickCumulative2 = _uniswapResponse[1];\n }\n _success = true;\n } catch (bytes memory) {}\n }\n\n /// @inheritdoc IKeep3rHelper\n function getPaymentParams(uint256 _bonds)\n external\n view\n virtual\n override\n returns (\n uint256 _boost,\n uint256 _oneEthQuote,\n uint256 _extra\n )\n {\n _oneEthQuote = quote(1 ether);\n _boost = getRewardBoostFor(_bonds);\n _extra = workExtraGas;\n }\n\n /// @inheritdoc IKeep3rHelper\n function getKP3RsAtTick(\n uint256 _liquidityAmount,\n int56 _tickDifference,\n uint256 _timeInterval\n ) external pure override returns (uint256 _kp3rAmount) {\n uint160 sqrtRatioX96 = TickMath.getSqrtRatioAtTick(int24(_tickDifference / int256(_timeInterval)));\n _kp3rAmount = FullMath.mulDiv(1 << 96, _liquidityAmount, sqrtRatioX96);\n }\n\n /// @inheritdoc IKeep3rHelper\n function getQuoteAtTick(\n uint128 _baseAmount,\n int56 _tickDifference,\n uint256 _timeInterval\n ) public pure override returns (uint256 _quoteAmount) {\n uint160 sqrtRatioX96 = TickMath.getSqrtRatioAtTick(int24(_tickDifference / int256(_timeInterval)));\n\n if (sqrtRatioX96 <= type(uint128).max) {\n uint256 ratioX192 = uint256(sqrtRatioX96) * sqrtRatioX96;\n _quoteAmount = FullMath.mulDiv(1 << 192, _baseAmount, ratioX192);\n } else {\n uint256 ratioX128 = FullMath.mulDiv(sqrtRatioX96, sqrtRatioX96, 1 << 64);\n _quoteAmount = FullMath.mulDiv(1 << 128, _baseAmount, ratioX128);\n }\n }\n\n /// @notice Gets the gas basefee cost to calculate keeper rewards\n /// @dev Keepers are required to pay a priority fee to be included, this function recognizes a minimum priority fee\n /// @return _baseFee The block's basefee + a minimum priority fee, or a preset minimum gas fee\n function _getBasefee() internal view virtual returns (uint256 _baseFee) {\n return Math.max(minBaseFee, block.basefee + minPriorityFee);\n }\n}\n" - }, - "solidity/for-test/testnet/Keep3rHelperForTestnet.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../../contracts/Keep3rHelper.sol';\n\ncontract Keep3rHelperForTestnet is Keep3rHelper {\n constructor(\n address _kp3r,\n address _keep3rV2,\n address _governance,\n address _kp3rWethPool\n ) Keep3rHelper(_kp3r, _keep3rV2, _governance, _kp3rWethPool) {}\n\n function _getBasefee() internal pure override returns (uint256) {\n return 1;\n }\n}\n" - }, - "solidity/for-test/Keep3rHelperForTest.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../contracts/Keep3rHelper.sol';\n\ncontract Keep3rHelperForTest is Keep3rHelper {\n uint256 public basefee;\n\n constructor(\n address _kp3r,\n address _keep3rV2,\n address _governance,\n address _kp3rWethPool\n ) Keep3rHelper(_kp3r, _keep3rV2, _governance, _kp3rWethPool) {}\n\n function _getBasefee() internal view override returns (uint256) {\n return basefee != 0 ? (basefee + minPriorityFee) : super._getBasefee();\n }\n\n function setBaseFee(uint256 _baseFee) external {\n basefee = _baseFee;\n }\n}\n" - }, - "solidity/contracts/sidechain/Keep3rHelperSidechain.sol": { - "content": "// SPDX-License-Identifier: MIT\n\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../Keep3rHelper.sol';\nimport '../../interfaces/sidechain/IKeep3rHelperSidechain.sol';\n\ncontract Keep3rHelperSidechain is IKeep3rHelperSidechain, Keep3rHelper {\n /// @inheritdoc IKeep3rHelperSidechain\n mapping(address => address) public override oracle;\n /// @inheritdoc IKeep3rHelperSidechain\n IKeep3rHelperParameters.TokenOraclePool public override wethUSDPool;\n\n /// @notice Ethereum mainnet WETH address used for quoting references\n address public immutable override WETH;\n\n /// @param _keep3rV2 Address of sidechain Keep3r implementation\n /// @param _governance Address of governance\n /// @param _kp3rWethOracle Address of oracle used for KP3R/WETH quote\n /// @param _wethUsdOracle Address of oracle used for WETH/USD quote\n /// @dev Oracle pools should use 18 decimals tokens\n constructor(\n address _keep3rV2,\n address _governance,\n address _kp3r,\n address _weth,\n address _kp3rWethOracle,\n address _wethUsdOracle\n ) Keep3rHelper(_kp3r, _keep3rV2, _governance, _kp3rWethOracle) {\n WETH = _weth;\n wethUSDPool = _validateOraclePool(_wethUsdOracle, _weth);\n _setQuoteTwapTime(1 days);\n workExtraGas = 0;\n }\n\n /// @inheritdoc IKeep3rHelper\n /// @notice Uses valid wKP3R address from Keep3rSidechain to query keeper bonds\n function bonds(address _keeper) public view override(Keep3rHelper, IKeep3rHelper) returns (uint256 _amountBonded) {\n address wKP3R = IKeep3r(keep3rV2).keep3rV1();\n return IKeep3r(keep3rV2).bonds(_keeper, wKP3R);\n }\n\n /// @inheritdoc IKeep3rHelperSidechain\n function setOracle(address _liquidity, address _oracle) external override onlyGovernance {\n if (_liquidity == address(0) || _oracle == address(0)) revert ZeroAddress();\n oracle[_liquidity] = _oracle;\n emit OracleSet(_liquidity, _oracle);\n }\n\n /// @inheritdoc IKeep3rHelperSidechain\n function quoteUsdToEth(uint256 _usd) public view virtual override returns (uint256 _amountOut) {\n uint32[] memory _secondsAgos = new uint32[](2);\n _secondsAgos[1] = quoteTwapTime;\n\n /// @dev Oracle is compatible with IUniswapV3Pool\n (int56[] memory _tickCumulatives, ) = IUniswapV3Pool(wethUSDPool.poolAddress).observe(_secondsAgos);\n int56 _difference = _tickCumulatives[0] - _tickCumulatives[1];\n _amountOut = getQuoteAtTick(uint128(_usd), wethUSDPool.isTKNToken0 ? _difference : -_difference, quoteTwapTime);\n }\n\n /// @inheritdoc IKeep3rHelperSidechain\n function setWethUsdPool(address _poolAddress) external override onlyGovernance {\n if (_poolAddress == address(0)) revert ZeroAddress();\n _setWethUsdPool(_poolAddress);\n }\n\n /// @inheritdoc IKeep3rHelper\n function getPaymentParams(uint256 _bonds)\n external\n view\n virtual\n override(Keep3rHelper, IKeep3rHelper)\n returns (\n uint256 _boost,\n uint256 _oneUsdQuote,\n uint256 _extraGas\n )\n {\n _oneUsdQuote = quote(quoteUsdToEth(1 ether));\n _boost = getRewardBoostFor(_bonds);\n _extraGas = workExtraGas;\n }\n\n function _setWethUsdPool(address _poolAddress) internal {\n wethUSDPool = _validateOraclePool(_poolAddress, WETH);\n emit WethUSDPoolChange(wethUSDPool.poolAddress, wethUSDPool.isTKNToken0);\n }\n\n /// @dev Sidechain jobs are quoted by USD/gasUnit, baseFee is set to 1\n function _getBasefee() internal view virtual override returns (uint256 _baseFee) {\n return 1;\n }\n}\n" - }, - "solidity/for-test/testnet/Keep3rHelperSidechainForTestnet.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../../contracts/sidechain/Keep3rHelperSidechain.sol';\n\ncontract Keep3rHelperSidechainForTestnet is Keep3rHelperSidechain {\n constructor(\n address _keep3rV2,\n address _governance,\n address _kp3r,\n address _weth,\n address _kp3rWethOracle,\n address _wethUsdOracle\n ) Keep3rHelperSidechain(_keep3rV2, _governance, _kp3r, _weth, _kp3rWethOracle, _wethUsdOracle) {}\n}\n" - }, - "solidity/for-test/peripherals/Keep3rParametersForTest.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../../contracts/peripherals/Keep3rParameters.sol';\n\ncontract Keep3rParametersForTest is Keep3rParameters {\n constructor(\n address _keep3rHelper,\n address _keep3rV1,\n address _keep3rV1Proxy\n ) Keep3rParameters(_keep3rHelper, _keep3rV1, _keep3rV1Proxy) Keep3rRoles(msg.sender) {}\n}\n" - }, - "solidity/for-test/peripherals/jobs/Keep3rJobWorkableForTest.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../../../contracts/peripherals/jobs/Keep3rJobWorkable.sol';\n\ncontract Keep3rJobWorkableForTest is Keep3rJobWorkable {\n using EnumerableSet for EnumerableSet.AddressSet;\n\n constructor(\n address _keep3rHelper,\n address _keep3rV1,\n address _keep3rV1Proxy\n ) Keep3rParameters(_keep3rHelper, _keep3rV1, _keep3rV1Proxy) Keep3rRoles(msg.sender) {}\n\n function setJob(address _job) external {\n _jobs.add(_job);\n }\n\n function setKeeper(address _keeper) external {\n _keepers.add(_keeper);\n }\n\n function setApprovedLiquidity(address _liquidity) external {\n _approvedLiquidities.add(_liquidity);\n }\n\n function setJobLiquidity(address _job, address _liquidity) external {\n _jobLiquidities[_job].add(_liquidity);\n }\n\n function viewJobLiquidityCredits(address _job) external view returns (uint256) {\n return _jobLiquidityCredits[_job];\n }\n\n function viewJobPeriodCredits(address _job) external view returns (uint256) {\n return _jobPeriodCredits[_job];\n }\n\n function viewTickCache(address _liquidity) external view returns (TickCache memory _tickCache) {\n _tickCache = _tick[_liquidity];\n }\n\n function viewGas() external view returns (uint256) {\n return _initialGas;\n }\n}\n" - }, - "solidity/for-test/peripherals/jobs/Keep3rJobMigrationForTest.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../../../contracts/peripherals/jobs/Keep3rJobMigration.sol';\n\ncontract Keep3rJobMigrationForTest is Keep3rJobMigration {\n using EnumerableSet for EnumerableSet.AddressSet;\n\n mapping(address => uint256) public settleJobAccountanceCallCount;\n\n constructor(\n address _kph,\n address _keep3rV1,\n address _keep3rV1Proxy\n ) Keep3rParameters(_kph, _keep3rV1, _keep3rV1Proxy) Keep3rRoles(msg.sender) {}\n\n function setJobToken(address _job, address _token) external {\n _jobTokens[_job].add(_token);\n }\n\n function setJobLiquidity(address _job, address _liquidity) external {\n _jobLiquidities[_job].add(_liquidity);\n }\n\n function viewJobTokenListLength(address _job) external view returns (uint256) {\n return _jobTokens[_job].length();\n }\n\n function viewJobLiquidityList(address _job) external view returns (address[] memory _list) {\n _list = _jobLiquidities[_job].values();\n }\n\n function viewJobPeriodCredits(address _job) external view returns (uint256) {\n return _jobPeriodCredits[_job];\n }\n\n function viewJobLiquidityCredits(address _job) external view returns (uint256) {\n return _jobLiquidityCredits[_job];\n }\n\n function viewMigrationCreatedAt(address _fromJob, address _toJob) external view returns (uint256) {\n return _migrationCreatedAt[_fromJob][_toJob];\n }\n\n function isJob(address _job) external view returns (bool) {\n return _jobs.contains(_job);\n }\n\n function _settleJobAccountance(address _job) internal override {\n settleJobAccountanceCallCount[_job]++;\n }\n}\n" - }, - "solidity/for-test/peripherals/jobs/Keep3rJobManagerForTest.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../../../contracts/peripherals/jobs/Keep3rJobManager.sol';\n\ncontract Keep3rJobManagerForTest is Keep3rJobManager {\n using EnumerableSet for EnumerableSet.AddressSet;\n\n constructor(\n address _keep3rHelper,\n address _keep3rV1,\n address _keep3rV1Proxy\n ) Keep3rRoles(msg.sender) {}\n\n function isJob(address _job) external view returns (bool _isJob) {\n _isJob = _jobs.contains(_job);\n }\n}\n" - }, - "solidity/for-test/peripherals/jobs/Keep3rJobOwnershipForTest.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../../../contracts/peripherals/jobs/Keep3rJobOwnership.sol';\n\ncontract Keep3rJobOwnershipForTest is Keep3rJobOwnership {}\n" - }, - "solidity/for-test/libraries/LiquidityAmountsForTest.sol": { - "content": "// SPDX-License-Identifier: GPL-2.0-or-later\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../../contracts/libraries/FullMath.sol';\nimport '../../contracts/libraries/FixedPoint96.sol';\n\n/// @dev Made this library into a contract to be able to calculate liquidity more precisely for tests\n\n// solhint-disable\ncontract LiquidityAmountsForTest {\n function toUint128(uint256 x) private pure returns (uint128 y) {\n require((y = uint128(x)) == x);\n }\n\n function getLiquidityForAmount0(\n uint160 sqrtRatioAX96,\n uint160 sqrtRatioBX96,\n uint256 amount0\n ) public pure returns (uint128 liquidity) {\n if (sqrtRatioAX96 > sqrtRatioBX96) (sqrtRatioAX96, sqrtRatioBX96) = (sqrtRatioBX96, sqrtRatioAX96);\n uint256 intermediate = FullMath.mulDiv(sqrtRatioAX96, sqrtRatioBX96, FixedPoint96.Q96);\n return toUint128(FullMath.mulDiv(amount0, intermediate, sqrtRatioBX96 - sqrtRatioAX96));\n }\n\n function getLiquidityForAmount1(\n uint160 sqrtRatioAX96,\n uint160 sqrtRatioBX96,\n uint256 amount1\n ) public pure returns (uint128 liquidity) {\n if (sqrtRatioAX96 > sqrtRatioBX96) (sqrtRatioAX96, sqrtRatioBX96) = (sqrtRatioBX96, sqrtRatioAX96);\n return toUint128(FullMath.mulDiv(amount1, FixedPoint96.Q96, sqrtRatioBX96 - sqrtRatioAX96));\n }\n\n function getLiquidityForAmounts(\n uint160 sqrtRatioX96,\n uint160 sqrtRatioAX96,\n uint160 sqrtRatioBX96,\n uint256 amount0,\n uint256 amount1\n ) external pure returns (uint128 liquidity) {\n if (sqrtRatioAX96 > sqrtRatioBX96) (sqrtRatioAX96, sqrtRatioBX96) = (sqrtRatioBX96, sqrtRatioAX96);\n\n if (sqrtRatioX96 <= sqrtRatioAX96) {\n liquidity = getLiquidityForAmount0(sqrtRatioAX96, sqrtRatioBX96, amount0);\n } else if (sqrtRatioX96 < sqrtRatioBX96) {\n uint128 liquidity0 = getLiquidityForAmount0(sqrtRatioX96, sqrtRatioBX96, amount0);\n uint128 liquidity1 = getLiquidityForAmount1(sqrtRatioAX96, sqrtRatioX96, amount1);\n\n liquidity = liquidity0 < liquidity1 ? liquidity0 : liquidity1;\n } else {\n liquidity = getLiquidityForAmount1(sqrtRatioAX96, sqrtRatioBX96, amount1);\n }\n }\n\n function getAmount0ForLiquidity(\n uint160 sqrtRatioAX96,\n uint160 sqrtRatioBX96,\n uint128 liquidity\n ) public pure returns (uint256 amount0) {\n if (sqrtRatioAX96 > sqrtRatioBX96) (sqrtRatioAX96, sqrtRatioBX96) = (sqrtRatioBX96, sqrtRatioAX96);\n\n return FullMath.mulDiv(uint256(liquidity) << FixedPoint96.RESOLUTION, sqrtRatioBX96 - sqrtRatioAX96, sqrtRatioBX96) / sqrtRatioAX96;\n }\n\n function getAmount1ForLiquidity(\n uint160 sqrtRatioAX96,\n uint160 sqrtRatioBX96,\n uint128 liquidity\n ) public pure returns (uint256 amount1) {\n if (sqrtRatioAX96 > sqrtRatioBX96) (sqrtRatioAX96, sqrtRatioBX96) = (sqrtRatioBX96, sqrtRatioAX96);\n\n return FullMath.mulDiv(liquidity, sqrtRatioBX96 - sqrtRatioAX96, FixedPoint96.Q96);\n }\n\n function getAmountsForLiquidity(\n uint160 sqrtRatioX96,\n uint160 sqrtRatioAX96,\n uint160 sqrtRatioBX96,\n uint128 liquidity\n ) external pure returns (uint256 amount0, uint256 amount1) {\n if (sqrtRatioAX96 > sqrtRatioBX96) (sqrtRatioAX96, sqrtRatioBX96) = (sqrtRatioBX96, sqrtRatioAX96);\n\n if (sqrtRatioX96 <= sqrtRatioAX96) {\n amount0 = getAmount0ForLiquidity(sqrtRatioAX96, sqrtRatioBX96, liquidity);\n } else if (sqrtRatioX96 < sqrtRatioBX96) {\n amount0 = getAmount0ForLiquidity(sqrtRatioX96, sqrtRatioBX96, liquidity);\n amount1 = getAmount1ForLiquidity(sqrtRatioAX96, sqrtRatioX96, liquidity);\n } else {\n amount1 = getAmount1ForLiquidity(sqrtRatioAX96, sqrtRatioBX96, liquidity);\n }\n }\n}\n" - }, - "solidity/for-test/IUniswapV3PoolForTest.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '@uniswap/v3-core/contracts/interfaces/IERC20Minimal.sol';\nimport '@uniswap/v3-core/contracts/interfaces/IUniswapV3Pool.sol';\n\n// solhint-disable-next-line no-empty-blocks\ninterface IUniswapV3PoolForTest is IERC20Minimal, IUniswapV3Pool {\n\n}\n" - }, - "@uniswap/v3-core/contracts/interfaces/IERC20Minimal.sol": { - "content": "// SPDX-License-Identifier: GPL-2.0-or-later\npragma solidity >=0.5.0;\n\n/// @title Minimal ERC20 interface for Uniswap\n/// @notice Contains a subset of the full ERC20 interface that is used in Uniswap V3\ninterface IERC20Minimal {\n /// @notice Returns the balance of a token\n /// @param account The account for which to look up the number of tokens it has, i.e. its balance\n /// @return The number of tokens held by the account\n function balanceOf(address account) external view returns (uint256);\n\n /// @notice Transfers the amount of token from the `msg.sender` to the recipient\n /// @param recipient The account that will receive the amount transferred\n /// @param amount The number of tokens to send from the sender to the recipient\n /// @return Returns true for a successful transfer, false for an unsuccessful transfer\n function transfer(address recipient, uint256 amount) external returns (bool);\n\n /// @notice Returns the current allowance given to a spender by an owner\n /// @param owner The account of the token owner\n /// @param spender The account of the token spender\n /// @return The current allowance granted by `owner` to `spender`\n function allowance(address owner, address spender) external view returns (uint256);\n\n /// @notice Sets the allowance of a spender from the `msg.sender` to the value `amount`\n /// @param spender The account which will be allowed to spend a given amount of the owners tokens\n /// @param amount The amount of tokens allowed to be used by `spender`\n /// @return Returns true for a successful approval, false for unsuccessful\n function approve(address spender, uint256 amount) external returns (bool);\n\n /// @notice Transfers `amount` tokens from `sender` to `recipient` up to the allowance given to the `msg.sender`\n /// @param sender The account from which the transfer will be initiated\n /// @param recipient The recipient of the transfer\n /// @param amount The amount of the transfer\n /// @return Returns true for a successful transfer, false for unsuccessful\n function transferFrom(\n address sender,\n address recipient,\n uint256 amount\n ) external returns (bool);\n\n /// @notice Event emitted when tokens are transferred from one address to another, either via `#transfer` or `#transferFrom`.\n /// @param from The account from which the tokens were sent, i.e. the balance decreased\n /// @param to The account to which the tokens were sent, i.e. the balance increased\n /// @param value The amount of tokens that were transferred\n event Transfer(address indexed from, address indexed to, uint256 value);\n\n /// @notice Event emitted when the approval amount for the spender of a given owner's tokens changes.\n /// @param owner The account that approved spending of its tokens\n /// @param spender The account for which the spending allowance was modified\n /// @param value The new allowance from the owner to the spender\n event Approval(address indexed owner, address indexed spender, uint256 value);\n}\n" - } - }, - "settings": { - "optimizer": { - "enabled": true, - "runs": 33 - }, - "outputSelection": { - "*": { - "*": [ - "storageLayout", - "abi", - "evm.bytecode", - "evm.deployedBytecode", - "evm.methodIdentifiers", - "metadata", - "devdoc", - "userdoc", - "evm.gasEstimates" - ], - "": [ - "ast" - ] - } - }, - "metadata": { - "useLiteralContent": true - }, - "libraries": { - "": { - "__CACHE_BREAKER__": "0x00000000d41867734bbee4c6863d9255b2b06ac1" - } - } - } -} \ No newline at end of file diff --git a/deployments/optimisticSepolia/.chainId b/deployments/optimisticSepolia/.chainId new file mode 100644 index 0000000..03f37de --- /dev/null +++ b/deployments/optimisticSepolia/.chainId @@ -0,0 +1 @@ +11155420 \ No newline at end of file diff --git a/deployments/optimisticSepolia/JobRatedForTest.json b/deployments/optimisticSepolia/JobRatedForTest.json new file mode 100644 index 0000000..3cf8a19 --- /dev/null +++ b/deployments/optimisticSepolia/JobRatedForTest.json @@ -0,0 +1,154 @@ +{ + "address": "0xbAba0774d23Cbc8CbDE744a9829c22469c1395E0", + "abi": [ + { + "inputs": [ + { + "internalType": "address", + "name": "_keep3r", + "type": "address" + } + ], + "stateMutability": "nonpayable", + "type": "constructor" + }, + { + "inputs": [], + "name": "InvalidKeeper", + "type": "error" + }, + { + "inputs": [], + "name": "keep3r", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "nonce", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "usdPerGasUnit", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "work", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "_factor", + "type": "uint256" + } + ], + "name": "workHard", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + } + ], + "transactionHash": "0xd11dc13ecb078ae420e1236000134645ac47aec81474db13bb73358f7b3f56d4", + "receipt": { + "to": null, + "from": "0x169Cf949aB1B25453b70F2Fe874e2c65c10AE0f8", + "contractAddress": "0xbAba0774d23Cbc8CbDE744a9829c22469c1395E0", + "transactionIndex": 3, + "gasUsed": "324132", + "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "blockHash": "0xb30b5897f3d9e34e4a30544114c5720822d2d8a5580496a1f6737d5ac793a35d", + "transactionHash": "0xd11dc13ecb078ae420e1236000134645ac47aec81474db13bb73358f7b3f56d4", + "logs": [], + "blockNumber": 9187433, + "cumulativeGasUsed": "3267301", + "status": 1, + "byzantium": true + }, + "args": [ + "0x948e440da673E7560DF8E27CE6f4D054fb10e4a4" + ], + "numDeployments": 1, + "solcInputHash": "c4fa7656f8525bb918f86e7450300ce1", + "metadata": "{\"compiler\":{\"version\":\"0.8.8+commit.dddeac2f\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_keep3r\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"inputs\":[],\"name\":\"InvalidKeeper\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"keep3r\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"nonce\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"usdPerGasUnit\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"work\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_factor\",\"type\":\"uint256\"}],\"name\":\"workHard\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"}],\"devdoc\":{\"kind\":\"dev\",\"methods\":{},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{},\"version\":1}},\"settings\":{\"compilationTarget\":{\"solidity/for-test/JobRatedForTest.sol\":\"JobRatedForTest\"},\"evmVersion\":\"london\",\"libraries\":{\":__CACHE_BREAKER__\":\"0x00000000d41867734bbee4c6863d9255b2b06ac1\"},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":200},\"remappings\":[]},\"sources\":{\"@defi-wonderland/solidity-utils/solidity/interfaces/IBaseErrors.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.8 <0.9.0;\\n\\ninterface IBaseErrors {\\n /// @notice Thrown if an address is invalid\\n error InvalidAddress();\\n\\n /// @notice Thrown if an amount is invalid\\n error InvalidAmount();\\n\\n /// @notice Thrown if the lengths of a set of lists mismatch\\n error LengthMismatch();\\n\\n /// @notice Thrown if an address is the zero address\\n error ZeroAddress();\\n\\n /// @notice Thrown if an amount is zero\\n error ZeroAmount();\\n}\\n\",\"keccak256\":\"0xec09b9d248b6fbf6343dee41d6978abdc15d4c8df5ed7721e8df79e8b1a558cf\",\"license\":\"MIT\"},\"@defi-wonderland/solidity-utils/solidity/interfaces/IDustCollector.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.8 <0.9.0;\\n\\nimport {IGovernable} from './IGovernable.sol';\\nimport {IBaseErrors} from './IBaseErrors.sol';\\n\\n/// @title DustCollector interface\\ninterface IDustCollector is IBaseErrors, IGovernable {\\n // STATE VARIABLES\\n\\n /// @return _ethAddress Address used to trigger a native token transfer\\n // solhint-disable-next-line func-name-mixedcase\\n function ETH_ADDRESS() external view returns (address _ethAddress);\\n\\n // EVENTS\\n\\n /// @notice Emitted when dust is sent\\n /// @param _to The address which wil received the funds\\n /// @param _token The token that will be transferred\\n /// @param _amount The amount of the token that will be transferred\\n event DustSent(address _token, uint256 _amount, address _to);\\n\\n // FUNCTIONS\\n\\n /// @notice Allows an authorized user to transfer the tokens or eth that may have been left in a contract\\n /// @param _token The token that will be transferred\\n /// @param _amount The amont of the token that will be transferred\\n /// @param _to The address that will receive the idle funds\\n function sendDust(address _token, uint256 _amount, address _to) external;\\n}\\n\",\"keccak256\":\"0xbe22cc660bd6846093504989146038bd369f511325cef40cdc647fe7e04206b1\",\"license\":\"MIT\"},\"@defi-wonderland/solidity-utils/solidity/interfaces/IGovernable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.8 <0.9.0;\\n\\nimport {IBaseErrors} from './IBaseErrors.sol';\\n\\n/// @title Governable interface\\ninterface IGovernable is IBaseErrors {\\n // STATE VARIABLES\\n\\n /// @return _governor Address of the current governor\\n function governor() external view returns (address _governor);\\n\\n /// @return _pendingGovernor Address of the current pending governor\\n function pendingGovernor() external view returns (address _pendingGovernor);\\n\\n // EVENTS\\n\\n /// @notice Emitted when a new pending governor is set\\n /// @param _governor Address of the current governor\\n /// @param _pendingGovernor Address of the proposed next governor\\n event PendingGovernorSet(address _governor, address _pendingGovernor);\\n\\n /// @notice Emitted when a new governor is set\\n /// @param _newGovernor Address of the new governor\\n event PendingGovernorAccepted(address _newGovernor);\\n\\n // ERRORS\\n\\n /// @notice Thrown if a non-governor user tries to call a OnlyGovernor function\\n error OnlyGovernor();\\n\\n /// @notice Thrown if a non-pending-governor user tries to call a OnlyPendingGovernor function\\n error OnlyPendingGovernor();\\n\\n // FUNCTIONS\\n\\n /// @notice Allows a governor to propose a new governor\\n /// @param _pendingGovernor Address of the proposed new governor\\n function setPendingGovernor(address _pendingGovernor) external;\\n\\n /// @notice Allows a proposed governor to accept the governance\\n function acceptPendingGovernor() external;\\n}\\n\",\"keccak256\":\"0x40b94706a00d2c092f620807ba84bdd0c5ed8cfa60140c924edc850427e0af13\",\"license\":\"MIT\"},\"solidity/for-test/JobRatedForTest.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4 <0.9.0;\\n\\nimport '../interfaces/IKeep3r.sol';\\nimport '../interfaces/sidechain/IKeep3rJobWorkableRated.sol';\\n\\ncontract JobRatedForTest {\\n error InvalidKeeper();\\n address public keep3r;\\n uint256 public nonce;\\n uint256 public usdPerGasUnit = 1;\\n\\n constructor(address _keep3r) {\\n keep3r = _keep3r;\\n }\\n\\n function work() external {\\n if (!IKeep3r(keep3r).isKeeper(msg.sender)) revert InvalidKeeper();\\n\\n for (uint256 i = 0; i < 1000; i++) {\\n nonce++;\\n }\\n\\n IKeep3rJobWorkableRated(keep3r).worked(msg.sender, usdPerGasUnit);\\n }\\n\\n function workHard(uint256 _factor) external {\\n if (!IKeep3r(keep3r).isKeeper(msg.sender)) revert InvalidKeeper();\\n\\n for (uint256 i = 0; i < 1000 * _factor; i++) {\\n nonce++;\\n }\\n\\n IKeep3rJobWorkableRated(keep3r).worked(msg.sender, usdPerGasUnit);\\n }\\n}\\n\",\"keccak256\":\"0x235a0959e11d21a0d729be34f808b1648d0654c5d6f3893806cba610a1f8473a\",\"license\":\"MIT\"},\"solidity/interfaces/IKeep3r.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4 <0.9.0;\\n\\nimport './peripherals/IKeep3rJobs.sol';\\nimport './peripherals/IKeep3rKeepers.sol';\\nimport './peripherals/IKeep3rParameters.sol';\\n\\n// solhint-disable-next-line no-empty-blocks\\n\\n/// @title Keep3rV2 contract\\n/// @notice This contract inherits all the functionality of Keep3rV2\\ninterface IKeep3r is IKeep3rJobs, IKeep3rKeepers, IKeep3rParameters {\\n\\n}\\n\",\"keccak256\":\"0x273a39984c1475c60182e636bb91a1b89ec98646a036cac6a87067869b3adeb9\",\"license\":\"MIT\"},\"solidity/interfaces/peripherals/IKeep3rAccountance.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4 <0.9.0;\\n\\nimport './IKeep3rRoles.sol';\\n\\n/// @title Keep3rDisputable contract\\n/// @notice Disputes keepers, or if they're already disputed, it can resolve the case\\n/// @dev Argument `bonding` can be the address of either a token or a liquidity\\ninterface IKeep3rAccountance is IKeep3rRoles {\\n // Events\\n\\n /// @notice Emitted when the bonding process of a new keeper begins\\n /// @param _keeper The caller of Keep3rKeeperFundable#bond function\\n /// @param _bonding The asset the keeper has bonded\\n /// @param _amount The amount the keeper has bonded\\n event Bonding(address indexed _keeper, address indexed _bonding, uint256 _amount);\\n\\n /// @notice Emitted when a keeper or job begins the unbonding process to withdraw the funds\\n /// @param _keeperOrJob The keeper or job that began the unbonding process\\n /// @param _unbonding The liquidity pair or asset being unbonded\\n /// @param _amount The amount being unbonded\\n event Unbonding(address indexed _keeperOrJob, address indexed _unbonding, uint256 _amount);\\n\\n // Variables\\n\\n /// @notice Tracks the total amount of bonded KP3Rs in the contract\\n /// @return _totalBonds The total amount of bonded KP3Rs in the contract\\n function totalBonds() external view returns (uint256 _totalBonds);\\n\\n /// @notice Tracks the total KP3R earnings of a keeper since it started working\\n /// @param _keeper The address of the keeper\\n /// @return _workCompleted Total KP3R earnings of a keeper since it started working\\n function workCompleted(address _keeper) external view returns (uint256 _workCompleted);\\n\\n /// @notice Tracks when a keeper was first registered\\n /// @param _keeper The address of the keeper\\n /// @return timestamp The time at which the keeper was first registered\\n function firstSeen(address _keeper) external view returns (uint256 timestamp);\\n\\n /// @notice Tracks if a keeper or job has a pending dispute\\n /// @param _keeperOrJob The address of the keeper or job\\n /// @return _disputed Whether a keeper or job has a pending dispute\\n function disputes(address _keeperOrJob) external view returns (bool _disputed);\\n\\n /// @notice Tracks how much a keeper has bonded of a certain token\\n /// @param _keeper The address of the keeper\\n /// @param _bond The address of the token being bonded\\n /// @return _bonds Amount of a certain token that a keeper has bonded\\n function bonds(address _keeper, address _bond) external view returns (uint256 _bonds);\\n\\n /// @notice The current token credits available for a job\\n /// @param _job The address of the job\\n /// @param _token The address of the token bonded\\n /// @return _amount The amount of token credits available for a job\\n function jobTokenCredits(address _job, address _token) external view returns (uint256 _amount);\\n\\n /// @notice Tracks the amount of assets deposited in pending bonds\\n /// @param _keeper The address of the keeper\\n /// @param _bonding The address of the token being bonded\\n /// @return _pendingBonds Amount of a certain asset a keeper has unbonding\\n function pendingBonds(address _keeper, address _bonding) external view returns (uint256 _pendingBonds);\\n\\n /// @notice Tracks when a bonding for a keeper can be activated\\n /// @param _keeper The address of the keeper\\n /// @param _bonding The address of the token being bonded\\n /// @return _timestamp Time at which the bonding for a keeper can be activated\\n function canActivateAfter(address _keeper, address _bonding) external view returns (uint256 _timestamp);\\n\\n /// @notice Tracks when keeper bonds are ready to be withdrawn\\n /// @param _keeper The address of the keeper\\n /// @param _bonding The address of the token being unbonded\\n /// @return _timestamp Time at which the keeper bonds are ready to be withdrawn\\n function canWithdrawAfter(address _keeper, address _bonding) external view returns (uint256 _timestamp);\\n\\n /// @notice Tracks how much keeper bonds are to be withdrawn\\n /// @param _keeper The address of the keeper\\n /// @param _bonding The address of the token being unbonded\\n /// @return _pendingUnbonds The amount of keeper bonds that are to be withdrawn\\n function pendingUnbonds(address _keeper, address _bonding) external view returns (uint256 _pendingUnbonds);\\n\\n /// @notice Checks whether the address has ever bonded an asset\\n /// @param _keeper The address of the keeper\\n /// @return _hasBonded Whether the address has ever bonded an asset\\n function hasBonded(address _keeper) external view returns (bool _hasBonded);\\n\\n // Methods\\n\\n /// @notice Lists all jobs\\n /// @return _jobList Array with all the jobs in _jobs\\n function jobs() external view returns (address[] memory _jobList);\\n\\n /// @notice Lists all keepers\\n /// @return _keeperList Array with all the keepers in _keepers\\n function keepers() external view returns (address[] memory _keeperList);\\n\\n // Errors\\n\\n /// @notice Throws when an address is passed as a job, but that address is not a job\\n error JobUnavailable();\\n\\n /// @notice Throws when an action that requires an undisputed job is applied on a disputed job\\n error JobDisputed();\\n}\\n\",\"keccak256\":\"0xf4748c236ddf409e45e7169c735e2fc54e627b2b3ccd189ebb438ad768f1deb1\",\"license\":\"MIT\"},\"solidity/interfaces/peripherals/IKeep3rDisputable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4 <0.9.0;\\n\\n/// @title Keep3rDisputable contract\\n/// @notice Creates/resolves disputes for jobs or keepers\\n/// A disputed keeper is slashable and is not able to bond, activate, withdraw or receive direct payments\\n/// A disputed job is slashable and is not able to pay the keepers, withdraw tokens or to migrate\\ninterface IKeep3rDisputable {\\n /// @notice Emitted when a keeper or a job is disputed\\n /// @param _jobOrKeeper The address of the disputed keeper/job\\n /// @param _disputer The user that called the function and disputed the keeper\\n event Dispute(address indexed _jobOrKeeper, address indexed _disputer);\\n\\n /// @notice Emitted when a dispute is resolved\\n /// @param _jobOrKeeper The address of the disputed keeper/job\\n /// @param _resolver The user that called the function and resolved the dispute\\n event Resolve(address indexed _jobOrKeeper, address indexed _resolver);\\n\\n /// @notice Throws when a job or keeper is already disputed\\n error AlreadyDisputed();\\n\\n /// @notice Throws when a job or keeper is not disputed and someone tries to resolve the dispute\\n error NotDisputed();\\n\\n /// @notice Allows governor to create a dispute for a given keeper/job\\n /// @param _jobOrKeeper The address in dispute\\n function dispute(address _jobOrKeeper) external;\\n\\n /// @notice Allows governor to resolve a dispute on a keeper/job\\n /// @param _jobOrKeeper The address cleared\\n function resolve(address _jobOrKeeper) external;\\n}\\n\",\"keccak256\":\"0xdfdabcecbed06fcb2eb1b80e6a61d681afecd1f75c58a888451de7927b10c3b2\",\"license\":\"MIT\"},\"solidity/interfaces/peripherals/IKeep3rJobs.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4 <0.9.0;\\n\\nimport './IKeep3rDisputable.sol';\\n\\n/// @title Keep3rJobOwnership contract\\n/// @notice Handles the ownership of the jobs\\ninterface IKeep3rJobOwnership {\\n // Events\\n\\n /// @notice Emitted when Keep3rJobOwnership#changeJobOwnership is called\\n /// @param _job The address of the job proposed to have a change of owner\\n /// @param _owner The current owner of the job\\n /// @param _pendingOwner The new address proposed to be the owner of the job\\n event JobOwnershipChange(address indexed _job, address indexed _owner, address indexed _pendingOwner);\\n\\n /// @notice Emitted when Keep3rJobOwnership#JobOwnershipAssent is called\\n /// @param _job The address of the job which the proposed owner will now own\\n /// @param _previousOwner The previous owner of the job\\n /// @param _newOwner The new owner of the job\\n event JobOwnershipAssent(address indexed _job, address indexed _previousOwner, address indexed _newOwner);\\n\\n // Errors\\n\\n /// @notice Throws when the caller of the function is not the job owner\\n error OnlyJobOwner();\\n\\n /// @notice Throws when the caller of the function is not the pending job owner\\n error OnlyPendingJobOwner();\\n\\n // Variables\\n\\n /// @notice Maps the job to the owner of the job\\n /// @param _job The address of the job\\n /// @return _owner The address of the owner of the job\\n function jobOwner(address _job) external view returns (address _owner);\\n\\n /// @notice Maps the job to its pending owner\\n /// @param _job The address of the job\\n /// @return _pendingOwner The address of the pending owner of the job\\n function jobPendingOwner(address _job) external view returns (address _pendingOwner);\\n\\n // Methods\\n\\n /// @notice Proposes a new address to be the owner of the job\\n /// @param _job The address of the job\\n /// @param _newOwner The address of the proposed new owner\\n function changeJobOwnership(address _job, address _newOwner) external;\\n\\n /// @notice The proposed address accepts to be the owner of the job\\n /// @param _job The address of the job\\n function acceptJobOwnership(address _job) external;\\n}\\n\\n/// @title Keep3rJobManager contract\\n/// @notice Handles the addition and withdrawal of credits from a job\\ninterface IKeep3rJobManager is IKeep3rJobOwnership {\\n // Events\\n\\n /// @notice Emitted when Keep3rJobManager#addJob is called\\n /// @param _job The address of the job to add\\n /// @param _jobOwner The job's owner\\n event JobAddition(address indexed _job, address indexed _jobOwner);\\n\\n // Errors\\n\\n /// @notice Throws when trying to add a job that has already been added\\n error JobAlreadyAdded();\\n\\n /// @notice Throws when the address that is trying to register as a keeper is already a keeper\\n error AlreadyAKeeper();\\n\\n // Methods\\n\\n /// @notice Allows any caller to add a new job\\n /// @param _job Address of the contract for which work should be performed\\n function addJob(address _job) external;\\n}\\n\\n/// @title Keep3rJobFundableCredits contract\\n/// @notice Handles the addition and withdrawal of credits from a job\\ninterface IKeep3rJobFundableCredits is IKeep3rJobOwnership {\\n // Events\\n\\n /// @notice Emitted when Keep3rJobFundableCredits#addTokenCreditsToJob is called\\n /// @param _job The address of the job being credited\\n /// @param _token The address of the token being provided\\n /// @param _provider The user that calls the function\\n /// @param _amount The amount of credit being added to the job\\n event TokenCreditAddition(address indexed _job, address indexed _token, address indexed _provider, uint256 _amount);\\n\\n /// @notice Emitted when Keep3rJobFundableCredits#withdrawTokenCreditsFromJob is called\\n /// @param _job The address of the job from which the credits are withdrawn\\n /// @param _token The credit being withdrawn from the job\\n /// @param _receiver The user that receives the tokens\\n /// @param _amount The amount of credit withdrawn\\n event TokenCreditWithdrawal(address indexed _job, address indexed _token, address indexed _receiver, uint256 _amount);\\n\\n // Errors\\n\\n /// @notice Throws when the token is KP3R, as it should not be used for direct token payments\\n error TokenUnallowed();\\n\\n /// @notice Throws when the token withdraw cooldown has not yet passed\\n error JobTokenCreditsLocked();\\n\\n /// @notice Throws when the user tries to withdraw more tokens than it has\\n error InsufficientJobTokenCredits();\\n\\n // Variables\\n\\n /// @notice Last block where tokens were added to the job\\n /// @param _job The address of the job credited\\n /// @param _token The address of the token credited\\n /// @return _timestamp The last block where tokens were added to the job\\n function jobTokenCreditsAddedAt(address _job, address _token) external view returns (uint256 _timestamp);\\n\\n // Methods\\n\\n /// @notice Add credit to a job to be paid out for work\\n /// @param _job The address of the job being credited\\n /// @param _token The address of the token being credited\\n /// @param _amount The amount of credit being added\\n function addTokenCreditsToJob(\\n address _job,\\n address _token,\\n uint256 _amount\\n ) external;\\n\\n /// @notice Withdraw credit from a job\\n /// @param _job The address of the job from which the credits are withdrawn\\n /// @param _token The address of the token being withdrawn\\n /// @param _amount The amount of token to be withdrawn\\n /// @param _receiver The user that will receive tokens\\n function withdrawTokenCreditsFromJob(\\n address _job,\\n address _token,\\n uint256 _amount,\\n address _receiver\\n ) external;\\n}\\n\\n/// @title Keep3rJobFundableLiquidity contract\\n/// @notice Handles the funding of jobs through specific liquidity pairs\\ninterface IKeep3rJobFundableLiquidity is IKeep3rJobOwnership {\\n // Events\\n\\n /// @notice Emitted when Keep3rJobFundableLiquidity#approveLiquidity function is called\\n /// @param _liquidity The address of the liquidity pair being approved\\n event LiquidityApproval(address _liquidity);\\n\\n /// @notice Emitted when Keep3rJobFundableLiquidity#revokeLiquidity function is called\\n /// @param _liquidity The address of the liquidity pair being revoked\\n event LiquidityRevocation(address _liquidity);\\n\\n /// @notice Emitted when IKeep3rJobFundableLiquidity#addLiquidityToJob function is called\\n /// @param _job The address of the job to which liquidity will be added\\n /// @param _liquidity The address of the liquidity being added\\n /// @param _provider The user that calls the function\\n /// @param _amount The amount of liquidity being added\\n event LiquidityAddition(address indexed _job, address indexed _liquidity, address indexed _provider, uint256 _amount);\\n\\n /// @notice Emitted when IKeep3rJobFundableLiquidity#withdrawLiquidityFromJob function is called\\n /// @param _job The address of the job of which liquidity will be withdrawn from\\n /// @param _liquidity The address of the liquidity being withdrawn\\n /// @param _receiver The receiver of the liquidity tokens\\n /// @param _amount The amount of liquidity being withdrawn from the job\\n event LiquidityWithdrawal(address indexed _job, address indexed _liquidity, address indexed _receiver, uint256 _amount);\\n\\n /// @notice Emitted when Keep3rJobFundableLiquidity#addLiquidityToJob function is called\\n /// @param _job The address of the job whose credits will be updated\\n /// @param _rewardedAt The time at which the job was last rewarded\\n /// @param _currentCredits The current credits of the job\\n /// @param _periodCredits The credits of the job for the current period\\n event LiquidityCreditsReward(address indexed _job, uint256 _rewardedAt, uint256 _currentCredits, uint256 _periodCredits);\\n\\n /// @notice Emitted when Keep3rJobFundableLiquidity#forceLiquidityCreditsToJob function is called\\n /// @param _job The address of the job whose credits will be updated\\n /// @param _rewardedAt The time at which the job was last rewarded\\n /// @param _currentCredits The current credits of the job\\n event LiquidityCreditsForced(address indexed _job, uint256 _rewardedAt, uint256 _currentCredits);\\n\\n // Errors\\n\\n /// @notice Throws when the liquidity being approved has already been approved\\n error LiquidityPairApproved();\\n\\n /// @notice Throws when the liquidity being removed has not been approved\\n error LiquidityPairUnexistent();\\n\\n /// @notice Throws when trying to add liquidity to an unapproved pool\\n error LiquidityPairUnapproved();\\n\\n /// @notice Throws when the job doesn't have the requested liquidity\\n error JobLiquidityUnexistent();\\n\\n /// @notice Throws when trying to remove more liquidity than the job has\\n error JobLiquidityInsufficient();\\n\\n /// @notice Throws when trying to add less liquidity than the minimum liquidity required\\n error JobLiquidityLessThanMin();\\n\\n // Structs\\n\\n /// @notice Stores the tick information of the different liquidity pairs\\n struct TickCache {\\n int56 current; // Tracks the current tick\\n int56 difference; // Stores the difference between the current tick and the last tick\\n uint256 period; // Stores the period at which the last observation was made\\n }\\n\\n // Variables\\n\\n /// @notice Lists liquidity pairs\\n /// @return _list An array of addresses with all the approved liquidity pairs\\n function approvedLiquidities() external view returns (address[] memory _list);\\n\\n /// @notice Amount of liquidity in a specified job\\n /// @param _job The address of the job being checked\\n /// @param _liquidity The address of the liquidity we are checking\\n /// @return _amount Amount of liquidity in the specified job\\n function liquidityAmount(address _job, address _liquidity) external view returns (uint256 _amount);\\n\\n /// @notice Last time the job was rewarded liquidity credits\\n /// @param _job The address of the job being checked\\n /// @return _timestamp Timestamp of the last time the job was rewarded liquidity credits\\n function rewardedAt(address _job) external view returns (uint256 _timestamp);\\n\\n /// @notice Last time the job was worked\\n /// @param _job The address of the job being checked\\n /// @return _timestamp Timestamp of the last time the job was worked\\n function workedAt(address _job) external view returns (uint256 _timestamp);\\n\\n // Methods\\n\\n /// @notice Returns the liquidity credits of a given job\\n /// @param _job The address of the job of which we want to know the liquidity credits\\n /// @return _amount The liquidity credits of a given job\\n function jobLiquidityCredits(address _job) external view returns (uint256 _amount);\\n\\n /// @notice Returns the credits of a given job for the current period\\n /// @param _job The address of the job of which we want to know the period credits\\n /// @return _amount The credits the given job has at the current period\\n function jobPeriodCredits(address _job) external view returns (uint256 _amount);\\n\\n /// @notice Calculates the total credits of a given job\\n /// @param _job The address of the job of which we want to know the total credits\\n /// @return _amount The total credits of the given job\\n function totalJobCredits(address _job) external view returns (uint256 _amount);\\n\\n /// @notice Calculates how many credits should be rewarded periodically for a given liquidity amount\\n /// @dev _periodCredits = underlying KP3Rs for given liquidity amount * rewardPeriod / inflationPeriod\\n /// @param _liquidity The address of the liquidity to provide\\n /// @param _amount The amount of liquidity to provide\\n /// @return _periodCredits The amount of KP3R periodically minted for the given liquidity\\n function quoteLiquidity(address _liquidity, uint256 _amount) external view returns (uint256 _periodCredits);\\n\\n /// @notice Observes the current state of the liquidity pair being observed and updates TickCache with the information\\n /// @param _liquidity The address of the liquidity pair being observed\\n /// @return _tickCache The updated TickCache\\n function observeLiquidity(address _liquidity) external view returns (TickCache memory _tickCache);\\n\\n /// @notice Gifts liquidity credits to the specified job\\n /// @param _job The address of the job being credited\\n /// @param _amount The amount of liquidity credits to gift\\n function forceLiquidityCreditsToJob(address _job, uint256 _amount) external;\\n\\n /// @notice Approve a liquidity pair for being accepted in future\\n /// @param _liquidity The address of the liquidity accepted\\n function approveLiquidity(address _liquidity) external;\\n\\n /// @notice Revoke a liquidity pair from being accepted in future\\n /// @param _liquidity The liquidity no longer accepted\\n function revokeLiquidity(address _liquidity) external;\\n\\n /// @notice Allows anyone to fund a job with liquidity\\n /// @param _job The address of the job to assign liquidity to\\n /// @param _liquidity The liquidity being added\\n /// @param _amount The amount of liquidity tokens to add\\n function addLiquidityToJob(\\n address _job,\\n address _liquidity,\\n uint256 _amount\\n ) external;\\n\\n /// @notice Unbond liquidity for a job\\n /// @dev Can only be called by the job's owner\\n /// @param _job The address of the job being unbonded from\\n /// @param _liquidity The liquidity being unbonded\\n /// @param _amount The amount of liquidity being removed\\n function unbondLiquidityFromJob(\\n address _job,\\n address _liquidity,\\n uint256 _amount\\n ) external;\\n\\n /// @notice Withdraw liquidity from a job\\n /// @param _job The address of the job being withdrawn from\\n /// @param _liquidity The liquidity being withdrawn\\n /// @param _receiver The address that will receive the withdrawn liquidity\\n function withdrawLiquidityFromJob(\\n address _job,\\n address _liquidity,\\n address _receiver\\n ) external;\\n}\\n\\n/// @title Keep3rJobMigration contract\\n/// @notice Handles the migration process of jobs to different addresses\\ninterface IKeep3rJobMigration is IKeep3rJobFundableCredits, IKeep3rJobFundableLiquidity {\\n // Events\\n\\n /// @notice Emitted when Keep3rJobMigration#migrateJob function is called\\n /// @param _fromJob The address of the job that requests to migrate\\n /// @param _toJob The address at which the job requests to migrate\\n event JobMigrationRequested(address indexed _fromJob, address _toJob);\\n\\n /// @notice Emitted when Keep3rJobMigration#acceptJobMigration function is called\\n /// @param _fromJob The address of the job that requested to migrate\\n /// @param _toJob The address at which the job had requested to migrate\\n event JobMigrationSuccessful(address _fromJob, address indexed _toJob);\\n\\n // Errors\\n\\n /// @notice Throws when the address of the job that requests to migrate wants to migrate to its same address\\n error JobMigrationImpossible();\\n\\n /// @notice Throws when the _toJob address differs from the address being tracked in the pendingJobMigrations mapping\\n error JobMigrationUnavailable();\\n\\n /// @notice Throws when cooldown between migrations has not yet passed\\n error JobMigrationLocked();\\n\\n // Variables\\n\\n /// @notice Maps the jobs that have requested a migration to the address they have requested to migrate to\\n /// @return _toJob The address to which the job has requested to migrate to\\n function pendingJobMigrations(address _fromJob) external view returns (address _toJob);\\n\\n // Methods\\n\\n /// @notice Initializes the migration process for a job by adding the request to the pendingJobMigrations mapping\\n /// @param _fromJob The address of the job that is requesting to migrate\\n /// @param _toJob The address at which the job is requesting to migrate\\n function migrateJob(address _fromJob, address _toJob) external;\\n\\n /// @notice Completes the migration process for a job\\n /// @dev Unbond/withdraw process doesn't get migrated\\n /// @param _fromJob The address of the job that requested to migrate\\n /// @param _toJob The address to which the job wants to migrate to\\n function acceptJobMigration(address _fromJob, address _toJob) external;\\n}\\n\\n/// @title Keep3rJobWorkable contract\\n/// @notice Handles the mechanisms jobs can pay keepers with along with the restrictions jobs can put on keepers before they can work on jobs\\ninterface IKeep3rJobWorkable is IKeep3rJobMigration {\\n // Events\\n\\n /// @notice Emitted when a keeper is validated before a job\\n /// @param _gasLeft The amount of gas that the transaction has left at the moment of keeper validation\\n event KeeperValidation(uint256 _gasLeft);\\n\\n /// @notice Emitted when a keeper works a job\\n /// @param _credit The address of the asset in which the keeper is paid\\n /// @param _job The address of the job the keeper has worked\\n /// @param _keeper The address of the keeper that has worked the job\\n /// @param _payment The amount that has been paid out to the keeper in exchange for working the job\\n /// @param _gasLeft The amount of gas that the transaction has left at the moment of payment\\n event KeeperWork(address indexed _credit, address indexed _job, address indexed _keeper, uint256 _payment, uint256 _gasLeft);\\n\\n // Errors\\n\\n /// @notice Throws if work method was called without calling isKeeper or isBondedKeeper\\n error GasNotInitialized();\\n\\n /// @notice Throws if the address claiming to be a job is not in the list of approved jobs\\n error JobUnapproved();\\n\\n /// @notice Throws if the amount of funds in the job is less than the payment that must be paid to the keeper that works that job\\n error InsufficientFunds();\\n\\n // Methods\\n\\n /// @notice Confirms if the current keeper is registered\\n /// @dev Can be used for general (non critical) functions\\n /// @param _keeper The keeper being investigated\\n /// @return _isKeeper Whether the address passed as a parameter is a keeper or not\\n function isKeeper(address _keeper) external returns (bool _isKeeper);\\n\\n /// @notice Confirms if the current keeper is registered and has a minimum bond of any asset.\\n /// @dev Should be used for protected functions\\n /// @param _keeper The keeper to check\\n /// @param _bond The bond token being evaluated\\n /// @param _minBond The minimum amount of bonded tokens\\n /// @param _earned The minimum funds earned in the keepers lifetime\\n /// @param _age The minimum keeper age required\\n /// @return _isBondedKeeper Whether the `_keeper` meets the given requirements\\n function isBondedKeeper(\\n address _keeper,\\n address _bond,\\n uint256 _minBond,\\n uint256 _earned,\\n uint256 _age\\n ) external returns (bool _isBondedKeeper);\\n\\n /// @notice Implemented by jobs to show that a keeper performed work\\n /// @dev Automatically calculates the payment for the keeper and pays the keeper with bonded KP3R\\n /// @param _keeper Address of the keeper that performed the work\\n function worked(address _keeper) external;\\n\\n /// @notice Implemented by jobs to show that a keeper performed work\\n /// @dev Pays the keeper that performs the work with KP3R\\n /// @param _keeper Address of the keeper that performed the work\\n /// @param _payment The reward that should be allocated for the job\\n function bondedPayment(address _keeper, uint256 _payment) external;\\n\\n /// @notice Implemented by jobs to show that a keeper performed work\\n /// @dev Pays the keeper that performs the work with a specific token\\n /// @param _token The asset being awarded to the keeper\\n /// @param _keeper Address of the keeper that performed the work\\n /// @param _amount The reward that should be allocated\\n function directTokenPayment(\\n address _token,\\n address _keeper,\\n uint256 _amount\\n ) external;\\n}\\n\\n/// @title Keep3rJobDisputable contract\\n/// @notice Handles the actions that can be taken on a disputed job\\ninterface IKeep3rJobDisputable is IKeep3rDisputable, IKeep3rJobFundableCredits, IKeep3rJobFundableLiquidity {\\n // Events\\n\\n /// @notice Emitted when Keep3rJobDisputable#slashTokenFromJob is called\\n /// @param _job The address of the job from which the token will be slashed\\n /// @param _token The address of the token being slashed\\n /// @param _slasher The user that slashes the token\\n /// @param _amount The amount of the token being slashed\\n event JobSlashToken(address indexed _job, address _token, address indexed _slasher, uint256 _amount);\\n\\n /// @notice Emitted when Keep3rJobDisputable#slashLiquidityFromJob is called\\n /// @param _job The address of the job from which the liquidity will be slashed\\n /// @param _liquidity The address of the liquidity being slashed\\n /// @param _slasher The user that slashes the liquidity\\n /// @param _amount The amount of the liquidity being slashed\\n event JobSlashLiquidity(address indexed _job, address _liquidity, address indexed _slasher, uint256 _amount);\\n\\n // Errors\\n\\n /// @notice Throws when the token trying to be slashed doesn't exist\\n error JobTokenUnexistent();\\n\\n /// @notice Throws when someone tries to slash more tokens than the job has\\n error JobTokenInsufficient();\\n\\n // Methods\\n\\n /// @notice Allows governor or slasher to slash a job specific token\\n /// @param _job The address of the job from which the token will be slashed\\n /// @param _token The address of the token that will be slashed\\n /// @param _amount The amount of the token that will be slashed\\n function slashTokenFromJob(\\n address _job,\\n address _token,\\n uint256 _amount\\n ) external;\\n\\n /// @notice Allows governor or slasher to slash liquidity from a job\\n /// @param _job The address being slashed\\n /// @param _liquidity The address of the liquidity that will be slashed\\n /// @param _amount The amount of liquidity that will be slashed\\n function slashLiquidityFromJob(\\n address _job,\\n address _liquidity,\\n uint256 _amount\\n ) external;\\n}\\n\\n// solhint-disable-next-line no-empty-blocks\\ninterface IKeep3rJobs is IKeep3rJobWorkable, IKeep3rJobManager, IKeep3rJobDisputable {\\n\\n}\\n\",\"keccak256\":\"0x7fb7153d88e9e65d28b278320884517d6b423b2e8cfc78ee0ee16bc04073278e\",\"license\":\"MIT\"},\"solidity/interfaces/peripherals/IKeep3rKeepers.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4 <0.9.0;\\n\\nimport './IKeep3rDisputable.sol';\\n\\n/// @title Keep3rKeeperFundable contract\\n/// @notice Handles the actions required to become a keeper\\ninterface IKeep3rKeeperFundable {\\n // Events\\n\\n /// @notice Emitted when Keep3rKeeperFundable#activate is called\\n /// @param _keeper The keeper that has been activated\\n /// @param _bond The asset the keeper has bonded\\n /// @param _amount The amount of the asset the keeper has bonded\\n event Activation(address indexed _keeper, address indexed _bond, uint256 _amount);\\n\\n /// @notice Emitted when Keep3rKeeperFundable#withdraw is called\\n /// @param _keeper The caller of Keep3rKeeperFundable#withdraw function\\n /// @param _bond The asset to withdraw from the bonding pool\\n /// @param _amount The amount of funds withdrawn\\n event Withdrawal(address indexed _keeper, address indexed _bond, uint256 _amount);\\n\\n // Errors\\n\\n /// @notice Throws when the address that is trying to register as a job is already a job\\n error AlreadyAJob();\\n\\n // Methods\\n\\n /// @notice Beginning of the bonding process\\n /// @param _bonding The asset being bonded\\n /// @param _amount The amount of bonding asset being bonded\\n function bond(address _bonding, uint256 _amount) external;\\n\\n /// @notice Beginning of the unbonding process\\n /// @param _bonding The asset being unbonded\\n /// @param _amount Allows for partial unbonding\\n function unbond(address _bonding, uint256 _amount) external;\\n\\n /// @notice End of the bonding process after bonding time has passed\\n /// @param _bonding The asset being activated as bond collateral\\n function activate(address _bonding) external;\\n\\n /// @notice Withdraw funds after unbonding has finished\\n /// @param _bonding The asset to withdraw from the bonding pool\\n function withdraw(address _bonding) external;\\n}\\n\\n/// @title Keep3rKeeperDisputable contract\\n/// @notice Handles the actions that can be taken on a disputed keeper\\ninterface IKeep3rKeeperDisputable is IKeep3rDisputable, IKeep3rKeeperFundable {\\n // Events\\n\\n /// @notice Emitted when Keep3rKeeperDisputable#slash is called\\n /// @param _keeper The address of the slashed keeper\\n /// @param _slasher The user that called Keep3rKeeperDisputable#slash\\n /// @param _amount The amount of credits slashed from the keeper\\n event KeeperSlash(address indexed _keeper, address indexed _slasher, uint256 _amount);\\n\\n /// @notice Emitted when Keep3rKeeperDisputable#revoke is called\\n /// @param _keeper The address of the revoked keeper\\n /// @param _slasher The user that called Keep3rKeeperDisputable#revoke\\n event KeeperRevoke(address indexed _keeper, address indexed _slasher);\\n\\n // Methods\\n\\n /// @notice Allows governor to slash a keeper based on a dispute\\n /// @param _keeper The address being slashed\\n /// @param _bonded The asset being slashed\\n /// @param _bondAmount The bonded amount being slashed\\n /// @param _unbondAmount The pending unbond amount being slashed\\n function slash(\\n address _keeper,\\n address _bonded,\\n uint256 _bondAmount,\\n uint256 _unbondAmount\\n ) external;\\n\\n /// @notice Blacklists a keeper from participating in the network\\n /// @param _keeper The address being slashed\\n function revoke(address _keeper) external;\\n}\\n\\n// solhint-disable-next-line no-empty-blocks\\n\\n/// @title Keep3rKeepers contract\\ninterface IKeep3rKeepers is IKeep3rKeeperDisputable {\\n\\n}\\n\",\"keccak256\":\"0x8fe10565035bb918b2b1c7d730533bcfe9ec79078f28544852f8178e76302562\",\"license\":\"MIT\"},\"solidity/interfaces/peripherals/IKeep3rParameters.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4 <0.9.0;\\n\\nimport './IKeep3rAccountance.sol';\\n\\n/// @title Keep3rParameters contract\\n/// @notice Handles and sets all the required parameters for Keep3r\\ninterface IKeep3rParameters is IKeep3rAccountance {\\n // Events\\n\\n /// @notice Emitted when the Keep3rHelper address is changed\\n /// @param _keep3rHelper The address of Keep3rHelper's contract\\n event Keep3rHelperChange(address _keep3rHelper);\\n\\n /// @notice Emitted when the Keep3rV1 address is changed\\n /// @param _keep3rV1 The address of Keep3rV1's contract\\n event Keep3rV1Change(address _keep3rV1);\\n\\n /// @notice Emitted when the Keep3rV1Proxy address is changed\\n /// @param _keep3rV1Proxy The address of Keep3rV1Proxy's contract\\n event Keep3rV1ProxyChange(address _keep3rV1Proxy);\\n\\n /// @notice Emitted when bondTime is changed\\n /// @param _bondTime The new bondTime\\n event BondTimeChange(uint256 _bondTime);\\n\\n /// @notice Emitted when _liquidityMinimum is changed\\n /// @param _liquidityMinimum The new _liquidityMinimum\\n event LiquidityMinimumChange(uint256 _liquidityMinimum);\\n\\n /// @notice Emitted when _unbondTime is changed\\n /// @param _unbondTime The new _unbondTime\\n event UnbondTimeChange(uint256 _unbondTime);\\n\\n /// @notice Emitted when _rewardPeriodTime is changed\\n /// @param _rewardPeriodTime The new _rewardPeriodTime\\n event RewardPeriodTimeChange(uint256 _rewardPeriodTime);\\n\\n /// @notice Emitted when the inflationPeriod is changed\\n /// @param _inflationPeriod The new inflationPeriod\\n event InflationPeriodChange(uint256 _inflationPeriod);\\n\\n /// @notice Emitted when the fee is changed\\n /// @param _fee The new token credits fee\\n event FeeChange(uint256 _fee);\\n\\n // Variables\\n\\n /// @notice Address of Keep3rHelper's contract\\n /// @return _keep3rHelper The address of Keep3rHelper's contract\\n function keep3rHelper() external view returns (address _keep3rHelper);\\n\\n /// @notice Address of Keep3rV1's contract\\n /// @return _keep3rV1 The address of Keep3rV1's contract\\n function keep3rV1() external view returns (address _keep3rV1);\\n\\n /// @notice Address of Keep3rV1Proxy's contract\\n /// @return _keep3rV1Proxy The address of Keep3rV1Proxy's contract\\n function keep3rV1Proxy() external view returns (address _keep3rV1Proxy);\\n\\n /// @notice The amount of time required to pass after a keeper has bonded assets for it to be able to activate\\n /// @return _days The required bondTime in days\\n function bondTime() external view returns (uint256 _days);\\n\\n /// @notice The amount of time required to pass before a keeper can unbond what he has bonded\\n /// @return _days The required unbondTime in days\\n function unbondTime() external view returns (uint256 _days);\\n\\n /// @notice The minimum amount of liquidity required to fund a job per liquidity\\n /// @return _amount The minimum amount of liquidity in KP3R\\n function liquidityMinimum() external view returns (uint256 _amount);\\n\\n /// @notice The amount of time between each scheduled credits reward given to a job\\n /// @return _days The reward period in days\\n function rewardPeriodTime() external view returns (uint256 _days);\\n\\n /// @notice The inflation period is the denominator used to regulate the emission of KP3R\\n /// @return _period The denominator used to regulate the emission of KP3R\\n function inflationPeriod() external view returns (uint256 _period);\\n\\n /// @notice The fee to be sent to governor when a user adds liquidity to a job\\n /// @return _amount The fee amount to be sent to governor when a user adds liquidity to a job\\n function fee() external view returns (uint256 _amount);\\n\\n // Errors\\n\\n /// @notice Throws if the reward period is less than the minimum reward period time\\n error MinRewardPeriod();\\n\\n /// @notice Throws if either a job or a keeper is disputed\\n error Disputed();\\n\\n /// @notice Throws if there are no bonded assets\\n error BondsUnexistent();\\n\\n /// @notice Throws if the time required to bond an asset has not passed yet\\n error BondsLocked();\\n\\n /// @notice Throws if there are no bonds to withdraw\\n error UnbondsUnexistent();\\n\\n /// @notice Throws if the time required to withdraw the bonds has not passed yet\\n error UnbondsLocked();\\n\\n // Methods\\n\\n /// @notice Sets the Keep3rHelper address\\n /// @param _keep3rHelper The Keep3rHelper address\\n function setKeep3rHelper(address _keep3rHelper) external;\\n\\n /// @notice Sets the Keep3rV1 address\\n /// @param _keep3rV1 The Keep3rV1 address\\n function setKeep3rV1(address _keep3rV1) external;\\n\\n /// @notice Sets the Keep3rV1Proxy address\\n /// @param _keep3rV1Proxy The Keep3rV1Proxy address\\n function setKeep3rV1Proxy(address _keep3rV1Proxy) external;\\n\\n /// @notice Sets the bond time required to activate as a keeper\\n /// @param _bond The new bond time\\n function setBondTime(uint256 _bond) external;\\n\\n /// @notice Sets the unbond time required unbond what has been bonded\\n /// @param _unbond The new unbond time\\n function setUnbondTime(uint256 _unbond) external;\\n\\n /// @notice Sets the minimum amount of liquidity required to fund a job\\n /// @param _liquidityMinimum The new minimum amount of liquidity\\n function setLiquidityMinimum(uint256 _liquidityMinimum) external;\\n\\n /// @notice Sets the time required to pass between rewards for jobs\\n /// @param _rewardPeriodTime The new amount of time required to pass between rewards\\n function setRewardPeriodTime(uint256 _rewardPeriodTime) external;\\n\\n /// @notice Sets the new inflation period\\n /// @param _inflationPeriod The new inflation period\\n function setInflationPeriod(uint256 _inflationPeriod) external;\\n\\n /// @notice Sets the new fee\\n /// @param _fee The new fee\\n function setFee(uint256 _fee) external;\\n}\\n\",\"keccak256\":\"0x2a847a2ab6dbee960ca84e142ad9c578d8953c4adf1d3221669400ea86c9b82e\",\"license\":\"MIT\"},\"solidity/interfaces/peripherals/IKeep3rRoles.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4 <0.9.0;\\n\\nimport '@defi-wonderland/solidity-utils/solidity/interfaces/IBaseErrors.sol';\\nimport '@defi-wonderland/solidity-utils/solidity/interfaces/IGovernable.sol';\\nimport '@defi-wonderland/solidity-utils/solidity/interfaces/IDustCollector.sol';\\n\\n/// @title Keep3rRoles contract\\n/// @notice Manages the Keep3r specific roles\\ninterface IKeep3rRoles is IBaseErrors, IGovernable, IDustCollector {\\n // Events\\n\\n /// @notice Emitted when a slasher is added\\n /// @param _slasher Address of the added slasher\\n event SlasherAdded(address _slasher);\\n\\n /// @notice Emitted when a slasher is removed\\n /// @param _slasher Address of the removed slasher\\n event SlasherRemoved(address _slasher);\\n\\n /// @notice Emitted when a disputer is added\\n /// @param _disputer Address of the added disputer\\n event DisputerAdded(address _disputer);\\n\\n /// @notice Emitted when a disputer is removed\\n /// @param _disputer Address of the removed disputer\\n event DisputerRemoved(address _disputer);\\n\\n // Variables\\n\\n /// @notice Tracks whether the address is a slasher or not\\n /// @param _slasher Address being checked as a slasher\\n /// @return _isSlasher Whether the address is a slasher or not\\n function slashers(address _slasher) external view returns (bool _isSlasher);\\n\\n /// @notice Tracks whether the address is a disputer or not\\n /// @param _disputer Address being checked as a disputer\\n /// @return _isDisputer Whether the address is a disputer or not\\n function disputers(address _disputer) external view returns (bool _isDisputer);\\n\\n // Errors\\n\\n /// @notice Throws if the address is already a registered slasher\\n error SlasherExistent();\\n\\n /// @notice Throws if caller is not a registered slasher\\n error SlasherUnexistent();\\n\\n /// @notice Throws if the address is already a registered disputer\\n error DisputerExistent();\\n\\n /// @notice Throws if caller is not a registered disputer\\n error DisputerUnexistent();\\n\\n /// @notice Throws if the msg.sender is not a slasher or is not a part of governance\\n error OnlySlasher();\\n\\n /// @notice Throws if the msg.sender is not a disputer or is not a part of governance\\n error OnlyDisputer();\\n\\n // Methods\\n\\n /// @notice Registers a slasher by updating the slashers mapping\\n function addSlasher(address _slasher) external;\\n\\n /// @notice Removes a slasher by updating the slashers mapping\\n function removeSlasher(address _slasher) external;\\n\\n /// @notice Registers a disputer by updating the disputers mapping\\n function addDisputer(address _disputer) external;\\n\\n /// @notice Removes a disputer by updating the disputers mapping\\n function removeDisputer(address _disputer) external;\\n}\\n\",\"keccak256\":\"0xc0a19b0dfac535cbffabc0d76cb0569618dedb922b0413bc12358efa47dc32bf\",\"license\":\"MIT\"},\"solidity/interfaces/sidechain/IKeep3rJobWorkableRated.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4 <0.9.0;\\n\\nimport '../peripherals/IKeep3rJobs.sol';\\n\\n/// @title Keep3rJobWorkableRated contract\\n/// @notice Implements a quoting in USD per gas unit for Keep3r jobs\\ninterface IKeep3rJobWorkableRated is IKeep3rJobs {\\n /// @notice Throws when job contract calls deprecated worked(address) function\\n error Deprecated();\\n\\n /// @notice Implemented by jobs to show that a keeper performed work and reward in stable USD quote\\n /// @dev Automatically calculates the payment for the keeper and pays the keeper with bonded KP3R\\n /// @param _keeper Address of the keeper that performed the work\\n /// @param _usdPerGasUnit Amount of USD in wei rewarded for gas unit worked by the keeper\\n function worked(address _keeper, uint256 _usdPerGasUnit) external;\\n}\\n\",\"keccak256\":\"0xce2c2721f1df7d944bf3ae20331cb628d38247e667c47bf4a33a90f0b5753884\",\"license\":\"MIT\"}},\"version\":1}", + "bytecode": "0x6080604052600160025534801561001557600080fd5b506040516104a73803806104a783398101604081905261003491610059565b600080546001600160a01b0319166001600160a01b0392909216919091179055610089565b60006020828403121561006b57600080fd5b81516001600160a01b038116811461008257600080fd5b9392505050565b61040f806100986000396000f3fe608060405234801561001057600080fd5b50600436106100575760003560e01c8063322e9f041461005c5780633bb39c3314610066578063634c7bb5146100795780639ecc0b95146100a9578063affed0e0146100c0575b600080fd5b6100646100c9565b005b610064610074366004610347565b610203565b60005461008c906001600160a01b031681565b6040516001600160a01b0390911681526020015b60405180910390f35b6100b260025481565b6040519081526020016100a0565b6100b260015481565b6000546040516335d2155560e11b81523360048201526001600160a01b0390911690636ba42aaa90602401602060405180830381600087803b15801561010e57600080fd5b505af1158015610122573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906101469190610360565b61016357604051637671ff4960e11b815260040160405180910390fd5b60005b6103e881101561019857600180549060006101808361039f565b919050555080806101909061039f565b915050610166565b5060005460025460405163b70362b960e01b815233600482015260248101919091526001600160a01b039091169063b70362b990604401600060405180830381600087803b1580156101e957600080fd5b505af11580156101fd573d6000803e3d6000fd5b50505050565b6000546040516335d2155560e11b81523360048201526001600160a01b0390911690636ba42aaa90602401602060405180830381600087803b15801561024857600080fd5b505af115801561025c573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906102809190610360565b61029d57604051637671ff4960e11b815260040160405180910390fd5b60005b6102ac826103e86103ba565b8110156102db57600180549060006102c38361039f565b919050555080806102d39061039f565b9150506102a0565b5060005460025460405163b70362b960e01b815233600482015260248101919091526001600160a01b039091169063b70362b990604401600060405180830381600087803b15801561032c57600080fd5b505af1158015610340573d6000803e3d6000fd5b5050505050565b60006020828403121561035957600080fd5b5035919050565b60006020828403121561037257600080fd5b8151801515811461038257600080fd5b9392505050565b634e487b7160e01b600052601160045260246000fd5b60006000198214156103b3576103b3610389565b5060010190565b60008160001904831182151516156103d4576103d4610389565b50029056fea26469706673582212200b3904a966d16d02dbbe26ad1ccb3b412cba5cfe56c02ad6c9991e52ac3ee55564736f6c63430008080033", + "deployedBytecode": "0x608060405234801561001057600080fd5b50600436106100575760003560e01c8063322e9f041461005c5780633bb39c3314610066578063634c7bb5146100795780639ecc0b95146100a9578063affed0e0146100c0575b600080fd5b6100646100c9565b005b610064610074366004610347565b610203565b60005461008c906001600160a01b031681565b6040516001600160a01b0390911681526020015b60405180910390f35b6100b260025481565b6040519081526020016100a0565b6100b260015481565b6000546040516335d2155560e11b81523360048201526001600160a01b0390911690636ba42aaa90602401602060405180830381600087803b15801561010e57600080fd5b505af1158015610122573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906101469190610360565b61016357604051637671ff4960e11b815260040160405180910390fd5b60005b6103e881101561019857600180549060006101808361039f565b919050555080806101909061039f565b915050610166565b5060005460025460405163b70362b960e01b815233600482015260248101919091526001600160a01b039091169063b70362b990604401600060405180830381600087803b1580156101e957600080fd5b505af11580156101fd573d6000803e3d6000fd5b50505050565b6000546040516335d2155560e11b81523360048201526001600160a01b0390911690636ba42aaa90602401602060405180830381600087803b15801561024857600080fd5b505af115801561025c573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906102809190610360565b61029d57604051637671ff4960e11b815260040160405180910390fd5b60005b6102ac826103e86103ba565b8110156102db57600180549060006102c38361039f565b919050555080806102d39061039f565b9150506102a0565b5060005460025460405163b70362b960e01b815233600482015260248101919091526001600160a01b039091169063b70362b990604401600060405180830381600087803b15801561032c57600080fd5b505af1158015610340573d6000803e3d6000fd5b5050505050565b60006020828403121561035957600080fd5b5035919050565b60006020828403121561037257600080fd5b8151801515811461038257600080fd5b9392505050565b634e487b7160e01b600052601160045260246000fd5b60006000198214156103b3576103b3610389565b5060010190565b60008160001904831182151516156103d4576103d4610389565b50029056fea26469706673582212200b3904a966d16d02dbbe26ad1ccb3b412cba5cfe56c02ad6c9991e52ac3ee55564736f6c63430008080033", + "devdoc": { + "kind": "dev", + "methods": {}, + "version": 1 + }, + "userdoc": { + "kind": "user", + "methods": {}, + "version": 1 + }, + "storageLayout": { + "storage": [ + { + "astId": 11239, + "contract": "solidity/for-test/JobRatedForTest.sol:JobRatedForTest", + "label": "keep3r", + "offset": 0, + "slot": "0", + "type": "t_address" + }, + { + "astId": 11241, + "contract": "solidity/for-test/JobRatedForTest.sol:JobRatedForTest", + "label": "nonce", + "offset": 0, + "slot": "1", + "type": "t_uint256" + }, + { + "astId": 11244, + "contract": "solidity/for-test/JobRatedForTest.sol:JobRatedForTest", + "label": "usdPerGasUnit", + "offset": 0, + "slot": "2", + "type": "t_uint256" + } + ], + "types": { + "t_address": { + "encoding": "inplace", + "label": "address", + "numberOfBytes": "20" + }, + "t_uint256": { + "encoding": "inplace", + "label": "uint256", + "numberOfBytes": "32" + } + } + } +} \ No newline at end of file diff --git a/deployments/optimisticSepolia/KP3Rv1.json b/deployments/optimisticSepolia/KP3Rv1.json new file mode 100644 index 0000000..e0f6cb0 --- /dev/null +++ b/deployments/optimisticSepolia/KP3Rv1.json @@ -0,0 +1,417 @@ +{ + "address": "0x12DA5E324EFCBDe7BB4797e1dB2B3477FC4C048f", + "abi": [ + { + "inputs": [ + { + "internalType": "string", + "name": "_name", + "type": "string" + }, + { + "internalType": "string", + "name": "_symbol", + "type": "string" + }, + { + "internalType": "address", + "name": "_initialAccount", + "type": "address" + }, + { + "internalType": "uint256", + "name": "_initialBalance", + "type": "uint256" + } + ], + "stateMutability": "nonpayable", + "type": "constructor" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "spender", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "value", + "type": "uint256" + } + ], + "name": "Approval", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "from", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "to", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "value", + "type": "uint256" + } + ], + "name": "Transfer", + "type": "event" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "internalType": "address", + "name": "spender", + "type": "address" + } + ], + "name": "allowance", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "spender", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "approve", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_owner", + "type": "address" + }, + { + "internalType": "address", + "name": "_spender", + "type": "address" + }, + { + "internalType": "uint256", + "name": "_value", + "type": "uint256" + } + ], + "name": "approveInternal", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "balanceOf", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "_amount", + "type": "uint256" + } + ], + "name": "burn", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_account", + "type": "address" + }, + { + "internalType": "uint256", + "name": "_amount", + "type": "uint256" + } + ], + "name": "burn", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "decimals", + "outputs": [ + { + "internalType": "uint8", + "name": "", + "type": "uint8" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "spender", + "type": "address" + }, + { + "internalType": "uint256", + "name": "subtractedValue", + "type": "uint256" + } + ], + "name": "decreaseAllowance", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "deposit", + "outputs": [], + "stateMutability": "payable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "spender", + "type": "address" + }, + { + "internalType": "uint256", + "name": "addedValue", + "type": "uint256" + } + ], + "name": "increaseAllowance", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_account", + "type": "address" + }, + { + "internalType": "uint256", + "name": "_amount", + "type": "uint256" + } + ], + "name": "mint", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "_amount", + "type": "uint256" + } + ], + "name": "mint", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "name", + "outputs": [ + { + "internalType": "string", + "name": "", + "type": "string" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "symbol", + "outputs": [ + { + "internalType": "string", + "name": "", + "type": "string" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "totalSupply", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "recipient", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "transfer", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "sender", + "type": "address" + }, + { + "internalType": "address", + "name": "recipient", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "transferFrom", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_from", + "type": "address" + }, + { + "internalType": "address", + "name": "_to", + "type": "address" + }, + { + "internalType": "uint256", + "name": "_value", + "type": "uint256" + } + ], + "name": "transferInternal", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + } + ], + "numDeployments": 6 +} \ No newline at end of file diff --git a/deployments/optimisticSepolia/Keep3rEscrow.json b/deployments/optimisticSepolia/Keep3rEscrow.json new file mode 100644 index 0000000..30f7eaf --- /dev/null +++ b/deployments/optimisticSepolia/Keep3rEscrow.json @@ -0,0 +1,582 @@ +{ + "address": "0x2Bd2697ce45B5cD1C75eB8483B91875E576f5662", + "abi": [ + { + "inputs": [ + { + "internalType": "address", + "name": "_governor", + "type": "address" + }, + { + "internalType": "address", + "name": "_wKP3R", + "type": "address" + } + ], + "stateMutability": "nonpayable", + "type": "constructor" + }, + { + "inputs": [], + "name": "InsufficientBalance", + "type": "error" + }, + { + "inputs": [], + "name": "InvalidAddress", + "type": "error" + }, + { + "inputs": [], + "name": "InvalidAmount", + "type": "error" + }, + { + "inputs": [], + "name": "LengthMismatch", + "type": "error" + }, + { + "inputs": [], + "name": "OnlyGovernor", + "type": "error" + }, + { + "inputs": [], + "name": "OnlyMinter", + "type": "error" + }, + { + "inputs": [], + "name": "OnlyPendingGovernor", + "type": "error" + }, + { + "inputs": [], + "name": "ZeroAddress", + "type": "error" + }, + { + "inputs": [], + "name": "ZeroAmount", + "type": "error" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "_token", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "_amount", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "address", + "name": "_to", + "type": "address" + } + ], + "name": "DustSent", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "_minter", + "type": "address" + } + ], + "name": "MinterSet", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "_newGovernor", + "type": "address" + } + ], + "name": "PendingGovernorAccepted", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "_governor", + "type": "address" + }, + { + "indexed": false, + "internalType": "address", + "name": "_pendingGovernor", + "type": "address" + } + ], + "name": "PendingGovernorSet", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "_wKP3R", + "type": "address" + }, + { + "indexed": false, + "internalType": "address", + "name": "_sender", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "_amount", + "type": "uint256" + } + ], + "name": "wKP3RDeposited", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "_wKP3R", + "type": "address" + }, + { + "indexed": false, + "internalType": "address", + "name": "_recipient", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "_amount", + "type": "uint256" + } + ], + "name": "wKP3RMinted", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "_newWKP3R", + "type": "address" + } + ], + "name": "wKP3RSet", + "type": "event" + }, + { + "inputs": [], + "name": "ETH_ADDRESS", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "acceptPendingGovernor", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "_amount", + "type": "uint256" + } + ], + "name": "deposit", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "governor", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "_amount", + "type": "uint256" + } + ], + "name": "mint", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "minter", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "pendingGovernor", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_token", + "type": "address" + }, + { + "internalType": "uint256", + "name": "_amount", + "type": "uint256" + }, + { + "internalType": "address", + "name": "_to", + "type": "address" + } + ], + "name": "sendDust", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_minter", + "type": "address" + } + ], + "name": "setMinter", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_pendingGovernor", + "type": "address" + } + ], + "name": "setPendingGovernor", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_wKP3R", + "type": "address" + } + ], + "name": "setWKP3R", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "wKP3R", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + } + ], + "transactionHash": "0xec32c3777a9d62e5ca4534a139c64da10b231baed01fdea78c74962ccd17bcbb", + "receipt": { + "to": null, + "from": "0x169Cf949aB1B25453b70F2Fe874e2c65c10AE0f8", + "contractAddress": "0x2Bd2697ce45B5cD1C75eB8483B91875E576f5662", + "transactionIndex": 2, + "gasUsed": "690499", + "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "blockHash": "0xd5373f4f96072ccc164df15943b0865cf0e06bd83e1d2596dfcc405faa3aaa32", + "transactionHash": "0xec32c3777a9d62e5ca4534a139c64da10b231baed01fdea78c74962ccd17bcbb", + "logs": [], + "blockNumber": 9186534, + "cumulativeGasUsed": "861050", + "status": 1, + "byzantium": true + }, + "args": [ + "0x169Cf949aB1B25453b70F2Fe874e2c65c10AE0f8", + "0x12DA5E324EFCBDe7BB4797e1dB2B3477FC4C048f" + ], + "numDeployments": 1, + "solcInputHash": "c4fa7656f8525bb918f86e7450300ce1", + "metadata": "{\"compiler\":{\"version\":\"0.8.8+commit.dddeac2f\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_governor\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"_wKP3R\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"inputs\":[],\"name\":\"InsufficientBalance\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"InvalidAddress\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"InvalidAmount\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"LengthMismatch\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"OnlyGovernor\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"OnlyMinter\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"OnlyPendingGovernor\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"ZeroAddress\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"ZeroAmount\",\"type\":\"error\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"_token\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"_amount\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"_to\",\"type\":\"address\"}],\"name\":\"DustSent\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"_minter\",\"type\":\"address\"}],\"name\":\"MinterSet\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"_newGovernor\",\"type\":\"address\"}],\"name\":\"PendingGovernorAccepted\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"_governor\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"_pendingGovernor\",\"type\":\"address\"}],\"name\":\"PendingGovernorSet\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"_wKP3R\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"_sender\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"_amount\",\"type\":\"uint256\"}],\"name\":\"wKP3RDeposited\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"_wKP3R\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"_recipient\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"_amount\",\"type\":\"uint256\"}],\"name\":\"wKP3RMinted\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"_newWKP3R\",\"type\":\"address\"}],\"name\":\"wKP3RSet\",\"type\":\"event\"},{\"inputs\":[],\"name\":\"ETH_ADDRESS\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"acceptPendingGovernor\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_amount\",\"type\":\"uint256\"}],\"name\":\"deposit\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"governor\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_amount\",\"type\":\"uint256\"}],\"name\":\"mint\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"minter\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"pendingGovernor\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_token\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"_amount\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"_to\",\"type\":\"address\"}],\"name\":\"sendDust\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_minter\",\"type\":\"address\"}],\"name\":\"setMinter\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_pendingGovernor\",\"type\":\"address\"}],\"name\":\"setPendingGovernor\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_wKP3R\",\"type\":\"address\"}],\"name\":\"setWKP3R\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"wKP3R\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"}],\"devdoc\":{\"kind\":\"dev\",\"methods\":{\"constructor\":{\"params\":{\"_governor\":\"Address of governor\",\"_wKP3R\":\"Address of wrapped KP3R implementation\"}},\"deposit(uint256)\":{\"params\":{\"_amount\":\"The amount of wKP3R to deposit\"}},\"mint(uint256)\":{\"params\":{\"_amount\":\"The amount of wKP3R to mint\"}},\"sendDust(address,uint256,address)\":{\"params\":{\"_amount\":\"The amont of the token that will be transferred\",\"_to\":\"The address that will receive the idle funds\",\"_token\":\"The token that will be transferred\"}},\"setMinter(address)\":{\"params\":{\"_minter\":\"The address set as the minter\"}},\"setPendingGovernor(address)\":{\"params\":{\"_pendingGovernor\":\"Address of the proposed new governor\"}},\"setWKP3R(address)\":{\"params\":{\"_wKP3R\":\"the wKP3R address\"}}},\"stateVariables\":{\"wKP3R\":{\"return\":\"_wKP3RAddress The address of wKP3R\",\"returns\":{\"_0\":\"_wKP3RAddress The address of wKP3R\"}}},\"version\":1},\"userdoc\":{\"errors\":{\"InsufficientBalance()\":[{\"notice\":\"Throws when minter attempts to withdraw more wKP3R than the escrow has in its balance\"}],\"InvalidAddress()\":[{\"notice\":\"Thrown if an address is invalid\"}],\"InvalidAmount()\":[{\"notice\":\"Thrown if an amount is invalid\"}],\"LengthMismatch()\":[{\"notice\":\"Thrown if the lengths of a set of lists mismatch\"}],\"OnlyGovernor()\":[{\"notice\":\"Thrown if a non-governor user tries to call a OnlyGovernor function\"}],\"OnlyMinter()\":[{\"notice\":\"Throws if the caller of the function is not the minter\"}],\"OnlyPendingGovernor()\":[{\"notice\":\"Thrown if a non-pending-governor user tries to call a OnlyPendingGovernor function\"}],\"ZeroAddress()\":[{\"notice\":\"Thrown if an address is the zero address\"}],\"ZeroAmount()\":[{\"notice\":\"Thrown if an amount is zero\"}]},\"events\":{\"DustSent(address,uint256,address)\":{\"notice\":\"Emitted when dust is sent\"},\"MinterSet(address)\":{\"notice\":\"Emitted when governor sets a new minter\"},\"PendingGovernorAccepted(address)\":{\"notice\":\"Emitted when a new governor is set\"},\"PendingGovernorSet(address,address)\":{\"notice\":\"Emitted when a new pending governor is set\"},\"wKP3RDeposited(address,address,uint256)\":{\"notice\":\"Emitted when Keep3rEscrow#deposit function is called\"},\"wKP3RMinted(address,address,uint256)\":{\"notice\":\"Emitted when Keep3rEscrow#mint function is called\"},\"wKP3RSet(address)\":{\"notice\":\"Emitted when Keep3rEscrow#setWKP3R function is called\"}},\"kind\":\"user\",\"methods\":{\"acceptPendingGovernor()\":{\"notice\":\"Allows a proposed governor to accept the governance\"},\"deposit(uint256)\":{\"notice\":\"Deposits wKP3R into the contract\"},\"mint(uint256)\":{\"notice\":\"mints wKP3R to the recipient\"},\"minter()\":{\"notice\":\"Stores the minter address\"},\"sendDust(address,uint256,address)\":{\"notice\":\"Allows an authorized user to transfer the tokens or eth that may have been left in a contract\"},\"setMinter(address)\":{\"notice\":\"Sets a new address to be the minter\"},\"setPendingGovernor(address)\":{\"notice\":\"Allows a governor to propose a new governor\"},\"setWKP3R(address)\":{\"notice\":\"sets the wKP3R address\"},\"wKP3R()\":{\"notice\":\"Lists the address of the wKP3R contract\"}},\"version\":1}},\"settings\":{\"compilationTarget\":{\"solidity/contracts/sidechain/Keep3rEscrow.sol\":\"Keep3rEscrow\"},\"evmVersion\":\"london\",\"libraries\":{\":__CACHE_BREAKER__\":\"0x00000000d41867734bbee4c6863d9255b2b06ac1\"},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":200},\"remappings\":[]},\"sources\":{\"@defi-wonderland/solidity-utils/solidity/contracts/DustCollector.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.8 <0.9.0;\\n\\nimport {Governable} from './Governable.sol';\\nimport {IDustCollector} from '../interfaces/IDustCollector.sol';\\nimport {IERC20} from '@openzeppelin/contracts/token/ERC20/IERC20.sol';\\nimport {SafeERC20} from '@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol';\\n\\n/// @title DustCollector contract\\nabstract contract DustCollector is IDustCollector, Governable {\\n using SafeERC20 for IERC20;\\n\\n /// @inheritdoc IDustCollector\\n address public constant ETH_ADDRESS = 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE;\\n\\n /// @inheritdoc IDustCollector\\n function sendDust(address _token, uint256 _amount, address _to) external onlyGovernor {\\n if (_to == address(0)) revert ZeroAddress();\\n if (_token == ETH_ADDRESS) payable(_to).transfer(_amount);\\n else IERC20(_token).safeTransfer(_to, _amount);\\n emit DustSent(_token, _amount, _to);\\n }\\n}\\n\",\"keccak256\":\"0xcdd6d0715406facd602770cca9320eebdc2b7b23b0e0f9e1b7b576fbc0126b47\",\"license\":\"MIT\"},\"@defi-wonderland/solidity-utils/solidity/contracts/Governable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.8 <0.9.0;\\n\\nimport {IGovernable} from '../interfaces/IGovernable.sol';\\n\\n/// @title Governable contract\\n/// @notice Manages the governor role\\nabstract contract Governable is IGovernable {\\n /// @inheritdoc IGovernable\\n address public governor;\\n\\n /// @inheritdoc IGovernable\\n address public pendingGovernor;\\n\\n constructor(address _governor) {\\n if (_governor == address(0)) revert ZeroAddress();\\n governor = _governor;\\n }\\n\\n /// @inheritdoc IGovernable\\n function setPendingGovernor(address _pendingGovernor) external onlyGovernor {\\n _setPendingGovernor(_pendingGovernor);\\n }\\n\\n /// @inheritdoc IGovernable\\n function acceptPendingGovernor() external onlyPendingGovernor {\\n _acceptPendingGovernor();\\n }\\n\\n function _setPendingGovernor(address _pendingGovernor) internal {\\n if (_pendingGovernor == address(0)) revert ZeroAddress();\\n pendingGovernor = _pendingGovernor;\\n emit PendingGovernorSet(governor, _pendingGovernor);\\n }\\n\\n function _acceptPendingGovernor() internal {\\n governor = pendingGovernor;\\n delete pendingGovernor;\\n emit PendingGovernorAccepted(governor);\\n }\\n\\n /// @notice Functions with this modifier can only be called by governor\\n modifier onlyGovernor() {\\n if (msg.sender != governor) revert OnlyGovernor();\\n _;\\n }\\n\\n /// @notice Functions with this modifier can only be called by pendingGovernor\\n modifier onlyPendingGovernor() {\\n if (msg.sender != pendingGovernor) revert OnlyPendingGovernor();\\n _;\\n }\\n}\\n\",\"keccak256\":\"0x3f11408cfcb015a99dc417e075c8ebc39b796fc2adc3e81b036487e4486881b3\",\"license\":\"MIT\"},\"@defi-wonderland/solidity-utils/solidity/interfaces/IBaseErrors.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.8 <0.9.0;\\n\\ninterface IBaseErrors {\\n /// @notice Thrown if an address is invalid\\n error InvalidAddress();\\n\\n /// @notice Thrown if an amount is invalid\\n error InvalidAmount();\\n\\n /// @notice Thrown if the lengths of a set of lists mismatch\\n error LengthMismatch();\\n\\n /// @notice Thrown if an address is the zero address\\n error ZeroAddress();\\n\\n /// @notice Thrown if an amount is zero\\n error ZeroAmount();\\n}\\n\",\"keccak256\":\"0xec09b9d248b6fbf6343dee41d6978abdc15d4c8df5ed7721e8df79e8b1a558cf\",\"license\":\"MIT\"},\"@defi-wonderland/solidity-utils/solidity/interfaces/IDustCollector.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.8 <0.9.0;\\n\\nimport {IGovernable} from './IGovernable.sol';\\nimport {IBaseErrors} from './IBaseErrors.sol';\\n\\n/// @title DustCollector interface\\ninterface IDustCollector is IBaseErrors, IGovernable {\\n // STATE VARIABLES\\n\\n /// @return _ethAddress Address used to trigger a native token transfer\\n // solhint-disable-next-line func-name-mixedcase\\n function ETH_ADDRESS() external view returns (address _ethAddress);\\n\\n // EVENTS\\n\\n /// @notice Emitted when dust is sent\\n /// @param _to The address which wil received the funds\\n /// @param _token The token that will be transferred\\n /// @param _amount The amount of the token that will be transferred\\n event DustSent(address _token, uint256 _amount, address _to);\\n\\n // FUNCTIONS\\n\\n /// @notice Allows an authorized user to transfer the tokens or eth that may have been left in a contract\\n /// @param _token The token that will be transferred\\n /// @param _amount The amont of the token that will be transferred\\n /// @param _to The address that will receive the idle funds\\n function sendDust(address _token, uint256 _amount, address _to) external;\\n}\\n\",\"keccak256\":\"0xbe22cc660bd6846093504989146038bd369f511325cef40cdc647fe7e04206b1\",\"license\":\"MIT\"},\"@defi-wonderland/solidity-utils/solidity/interfaces/IGovernable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.8 <0.9.0;\\n\\nimport {IBaseErrors} from './IBaseErrors.sol';\\n\\n/// @title Governable interface\\ninterface IGovernable is IBaseErrors {\\n // STATE VARIABLES\\n\\n /// @return _governor Address of the current governor\\n function governor() external view returns (address _governor);\\n\\n /// @return _pendingGovernor Address of the current pending governor\\n function pendingGovernor() external view returns (address _pendingGovernor);\\n\\n // EVENTS\\n\\n /// @notice Emitted when a new pending governor is set\\n /// @param _governor Address of the current governor\\n /// @param _pendingGovernor Address of the proposed next governor\\n event PendingGovernorSet(address _governor, address _pendingGovernor);\\n\\n /// @notice Emitted when a new governor is set\\n /// @param _newGovernor Address of the new governor\\n event PendingGovernorAccepted(address _newGovernor);\\n\\n // ERRORS\\n\\n /// @notice Thrown if a non-governor user tries to call a OnlyGovernor function\\n error OnlyGovernor();\\n\\n /// @notice Thrown if a non-pending-governor user tries to call a OnlyPendingGovernor function\\n error OnlyPendingGovernor();\\n\\n // FUNCTIONS\\n\\n /// @notice Allows a governor to propose a new governor\\n /// @param _pendingGovernor Address of the proposed new governor\\n function setPendingGovernor(address _pendingGovernor) external;\\n\\n /// @notice Allows a proposed governor to accept the governance\\n function acceptPendingGovernor() external;\\n}\\n\",\"keccak256\":\"0x40b94706a00d2c092f620807ba84bdd0c5ed8cfa60140c924edc850427e0af13\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC20/IERC20.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Interface of the ERC20 standard as defined in the EIP.\\n */\\ninterface IERC20 {\\n /**\\n * @dev Returns the amount of tokens in existence.\\n */\\n function totalSupply() external view returns (uint256);\\n\\n /**\\n * @dev Returns the amount of tokens owned by `account`.\\n */\\n function balanceOf(address account) external view returns (uint256);\\n\\n /**\\n * @dev Moves `amount` tokens from the caller's account to `recipient`.\\n *\\n * Returns a boolean value indicating whether the operation succeeded.\\n *\\n * Emits a {Transfer} event.\\n */\\n function transfer(address recipient, uint256 amount) external returns (bool);\\n\\n /**\\n * @dev Returns the remaining number of tokens that `spender` will be\\n * allowed to spend on behalf of `owner` through {transferFrom}. This is\\n * zero by default.\\n *\\n * This value changes when {approve} or {transferFrom} are called.\\n */\\n function allowance(address owner, address spender) external view returns (uint256);\\n\\n /**\\n * @dev Sets `amount` as the allowance of `spender` over the caller's tokens.\\n *\\n * Returns a boolean value indicating whether the operation succeeded.\\n *\\n * IMPORTANT: Beware that changing an allowance with this method brings the risk\\n * that someone may use both the old and the new allowance by unfortunate\\n * transaction ordering. One possible solution to mitigate this race\\n * condition is to first reduce the spender's allowance to 0 and set the\\n * desired value afterwards:\\n * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729\\n *\\n * Emits an {Approval} event.\\n */\\n function approve(address spender, uint256 amount) external returns (bool);\\n\\n /**\\n * @dev Moves `amount` tokens from `sender` to `recipient` using the\\n * allowance mechanism. `amount` is then deducted from the caller's\\n * allowance.\\n *\\n * Returns a boolean value indicating whether the operation succeeded.\\n *\\n * Emits a {Transfer} event.\\n */\\n function transferFrom(\\n address sender,\\n address recipient,\\n uint256 amount\\n ) external returns (bool);\\n\\n /**\\n * @dev Emitted when `value` tokens are moved from one account (`from`) to\\n * another (`to`).\\n *\\n * Note that `value` may be zero.\\n */\\n event Transfer(address indexed from, address indexed to, uint256 value);\\n\\n /**\\n * @dev Emitted when the allowance of a `spender` for an `owner` is set by\\n * a call to {approve}. `value` is the new allowance.\\n */\\n event Approval(address indexed owner, address indexed spender, uint256 value);\\n}\\n\",\"keccak256\":\"0x027b891937d20ccf213fdb9c31531574256de774bda99d3a70ecef6e1913ed2a\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../IERC20.sol\\\";\\nimport \\\"../../../utils/Address.sol\\\";\\n\\n/**\\n * @title SafeERC20\\n * @dev Wrappers around ERC20 operations that throw on failure (when the token\\n * contract returns false). Tokens that return no value (and instead revert or\\n * throw on failure) are also supported, non-reverting calls are assumed to be\\n * successful.\\n * To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract,\\n * which allows you to call the safe operations as `token.safeTransfer(...)`, etc.\\n */\\nlibrary SafeERC20 {\\n using Address for address;\\n\\n function safeTransfer(\\n IERC20 token,\\n address to,\\n uint256 value\\n ) internal {\\n _callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value));\\n }\\n\\n function safeTransferFrom(\\n IERC20 token,\\n address from,\\n address to,\\n uint256 value\\n ) internal {\\n _callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value));\\n }\\n\\n /**\\n * @dev Deprecated. This function has issues similar to the ones found in\\n * {IERC20-approve}, and its usage is discouraged.\\n *\\n * Whenever possible, use {safeIncreaseAllowance} and\\n * {safeDecreaseAllowance} instead.\\n */\\n function safeApprove(\\n IERC20 token,\\n address spender,\\n uint256 value\\n ) internal {\\n // safeApprove should only be called when setting an initial allowance,\\n // or when resetting it to zero. To increase and decrease it, use\\n // 'safeIncreaseAllowance' and 'safeDecreaseAllowance'\\n require(\\n (value == 0) || (token.allowance(address(this), spender) == 0),\\n \\\"SafeERC20: approve from non-zero to non-zero allowance\\\"\\n );\\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value));\\n }\\n\\n function safeIncreaseAllowance(\\n IERC20 token,\\n address spender,\\n uint256 value\\n ) internal {\\n uint256 newAllowance = token.allowance(address(this), spender) + value;\\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));\\n }\\n\\n function safeDecreaseAllowance(\\n IERC20 token,\\n address spender,\\n uint256 value\\n ) internal {\\n unchecked {\\n uint256 oldAllowance = token.allowance(address(this), spender);\\n require(oldAllowance >= value, \\\"SafeERC20: decreased allowance below zero\\\");\\n uint256 newAllowance = oldAllowance - value;\\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));\\n }\\n }\\n\\n /**\\n * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement\\n * on the return value: the return value is optional (but if data is returned, it must not be false).\\n * @param token The token targeted by the call.\\n * @param data The call data (encoded using abi.encode or one of its variants).\\n */\\n function _callOptionalReturn(IERC20 token, bytes memory data) private {\\n // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since\\n // we're implementing it ourselves. We use {Address.functionCall} to perform this call, which verifies that\\n // the target address contains contract code and also asserts for success in the low-level call.\\n\\n bytes memory returndata = address(token).functionCall(data, \\\"SafeERC20: low-level call failed\\\");\\n if (returndata.length > 0) {\\n // Return data is optional\\n require(abi.decode(returndata, (bool)), \\\"SafeERC20: ERC20 operation did not succeed\\\");\\n }\\n }\\n}\\n\",\"keccak256\":\"0x02348b2e4b9f3200c7e3907c5c2661643a6d8520e9f79939fbb9b4005a54894d\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/Address.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Collection of functions related to the address type\\n */\\nlibrary Address {\\n /**\\n * @dev Returns true if `account` is a contract.\\n *\\n * [IMPORTANT]\\n * ====\\n * It is unsafe to assume that an address for which this function returns\\n * false is an externally-owned account (EOA) and not a contract.\\n *\\n * Among others, `isContract` will return false for the following\\n * types of addresses:\\n *\\n * - an externally-owned account\\n * - a contract in construction\\n * - an address where a contract will be created\\n * - an address where a contract lived, but was destroyed\\n * ====\\n */\\n function isContract(address account) internal view returns (bool) {\\n // This method relies on extcodesize, which returns 0 for contracts in\\n // construction, since the code is only stored at the end of the\\n // constructor execution.\\n\\n uint256 size;\\n assembly {\\n size := extcodesize(account)\\n }\\n return size > 0;\\n }\\n\\n /**\\n * @dev Replacement for Solidity's `transfer`: sends `amount` wei to\\n * `recipient`, forwarding all available gas and reverting on errors.\\n *\\n * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost\\n * of certain opcodes, possibly making contracts go over the 2300 gas limit\\n * imposed by `transfer`, making them unable to receive funds via\\n * `transfer`. {sendValue} removes this limitation.\\n *\\n * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].\\n *\\n * IMPORTANT: because control is transferred to `recipient`, care must be\\n * taken to not create reentrancy vulnerabilities. Consider using\\n * {ReentrancyGuard} or the\\n * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].\\n */\\n function sendValue(address payable recipient, uint256 amount) internal {\\n require(address(this).balance >= amount, \\\"Address: insufficient balance\\\");\\n\\n (bool success, ) = recipient.call{value: amount}(\\\"\\\");\\n require(success, \\\"Address: unable to send value, recipient may have reverted\\\");\\n }\\n\\n /**\\n * @dev Performs a Solidity function call using a low level `call`. A\\n * plain `call` is an unsafe replacement for a function call: use this\\n * function instead.\\n *\\n * If `target` reverts with a revert reason, it is bubbled up by this\\n * function (like regular Solidity function calls).\\n *\\n * Returns the raw returned data. To convert to the expected return value,\\n * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\\n *\\n * Requirements:\\n *\\n * - `target` must be a contract.\\n * - calling `target` with `data` must not revert.\\n *\\n * _Available since v3.1._\\n */\\n function functionCall(address target, bytes memory data) internal returns (bytes memory) {\\n return functionCall(target, data, \\\"Address: low-level call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with\\n * `errorMessage` as a fallback revert reason when `target` reverts.\\n *\\n * _Available since v3.1._\\n */\\n function functionCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, 0, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but also transferring `value` wei to `target`.\\n *\\n * Requirements:\\n *\\n * - the calling contract must have an ETH balance of at least `value`.\\n * - the called Solidity function must be `payable`.\\n *\\n * _Available since v3.1._\\n */\\n function functionCallWithValue(\\n address target,\\n bytes memory data,\\n uint256 value\\n ) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, value, \\\"Address: low-level call with value failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but\\n * with `errorMessage` as a fallback revert reason when `target` reverts.\\n *\\n * _Available since v3.1._\\n */\\n function functionCallWithValue(\\n address target,\\n bytes memory data,\\n uint256 value,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n require(address(this).balance >= value, \\\"Address: insufficient balance for call\\\");\\n require(isContract(target), \\\"Address: call to non-contract\\\");\\n\\n (bool success, bytes memory returndata) = target.call{value: value}(data);\\n return verifyCallResult(success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but performing a static call.\\n *\\n * _Available since v3.3._\\n */\\n function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\\n return functionStaticCall(target, data, \\\"Address: low-level static call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\\n * but performing a static call.\\n *\\n * _Available since v3.3._\\n */\\n function functionStaticCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal view returns (bytes memory) {\\n require(isContract(target), \\\"Address: static call to non-contract\\\");\\n\\n (bool success, bytes memory returndata) = target.staticcall(data);\\n return verifyCallResult(success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but performing a delegate call.\\n *\\n * _Available since v3.4._\\n */\\n function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {\\n return functionDelegateCall(target, data, \\\"Address: low-level delegate call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\\n * but performing a delegate call.\\n *\\n * _Available since v3.4._\\n */\\n function functionDelegateCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n require(isContract(target), \\\"Address: delegate call to non-contract\\\");\\n\\n (bool success, bytes memory returndata) = target.delegatecall(data);\\n return verifyCallResult(success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the\\n * revert reason using the provided one.\\n *\\n * _Available since v4.3._\\n */\\n function verifyCallResult(\\n bool success,\\n bytes memory returndata,\\n string memory errorMessage\\n ) internal pure returns (bytes memory) {\\n if (success) {\\n return returndata;\\n } else {\\n // Look for revert reason and bubble it up if present\\n if (returndata.length > 0) {\\n // The easiest way to bubble the revert reason is using memory via assembly\\n\\n assembly {\\n let returndata_size := mload(returndata)\\n revert(add(32, returndata), returndata_size)\\n }\\n } else {\\n revert(errorMessage);\\n }\\n }\\n }\\n}\\n\",\"keccak256\":\"0x3336baae5cf23e94274d75336e2d412193be508504aee185e61dc7d58cd05c8a\",\"license\":\"MIT\"},\"solidity/contracts/peripherals/Mintable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4 <0.9.0;\\n\\nimport '../../interfaces/peripherals/IMintable.sol';\\nimport '@defi-wonderland/solidity-utils/solidity/contracts/Governable.sol';\\n\\nabstract contract Mintable is Governable, IMintable {\\n /// @inheritdoc IMintable\\n address public override minter;\\n\\n constructor(address _governor) Governable(_governor) {}\\n\\n /// @inheritdoc IMintable\\n function setMinter(address _minter) external override onlyGovernor {\\n if (_minter == address(0)) revert ZeroAddress();\\n minter = _minter;\\n emit MinterSet(_minter);\\n }\\n\\n /// @notice Functions with this modifier can only be called by the minter;\\n modifier onlyMinter() {\\n if (msg.sender != minter) revert OnlyMinter();\\n _;\\n }\\n}\\n\",\"keccak256\":\"0x6f70ca1b083865b02f0e44cc72c8c85ecab374724eda4544f3fb78555f070ea4\",\"license\":\"MIT\"},\"solidity/contracts/sidechain/Keep3rEscrow.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\n/*\\n\\nCoded for The Keep3r Network with \\u2665 by\\n\\n\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2557\\u2591\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2557\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2557\\u2588\\u2588\\u2557\\u2591\\u2591\\u2591\\u2588\\u2588\\u2557\\u2591\\u2591\\u2591\\u2591\\u2591\\u2591\\u2591\\u2588\\u2588\\u2557\\u2591\\u2588\\u2588\\u2588\\u2588\\u2588\\u2557\\u2591\\u2588\\u2588\\u2588\\u2557\\u2591\\u2591\\u2588\\u2588\\u2557\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2557\\u2591\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2557\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2557\\u2591\\u2588\\u2588\\u2557\\u2591\\u2591\\u2591\\u2591\\u2591\\u2591\\u2588\\u2588\\u2588\\u2588\\u2588\\u2557\\u2591\\u2588\\u2588\\u2588\\u2557\\u2591\\u2591\\u2588\\u2588\\u2557\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2557\\u2591\\n\\u2588\\u2588\\u2554\\u2550\\u2550\\u2588\\u2588\\u2557\\u2588\\u2588\\u2554\\u2550\\u2550\\u2550\\u2550\\u255d\\u2588\\u2588\\u2554\\u2550\\u2550\\u2550\\u2550\\u255d\\u2588\\u2588\\u2551\\u2591\\u2591\\u2591\\u2588\\u2588\\u2551\\u2591\\u2591\\u2588\\u2588\\u2557\\u2591\\u2591\\u2588\\u2588\\u2551\\u2588\\u2588\\u2554\\u2550\\u2550\\u2588\\u2588\\u2557\\u2588\\u2588\\u2588\\u2588\\u2557\\u2591\\u2588\\u2588\\u2551\\u2588\\u2588\\u2554\\u2550\\u2550\\u2588\\u2588\\u2557\\u2588\\u2588\\u2554\\u2550\\u2550\\u2550\\u2550\\u255d\\u2588\\u2588\\u2554\\u2550\\u2550\\u2588\\u2588\\u2557\\u2588\\u2588\\u2551\\u2591\\u2591\\u2591\\u2591\\u2591\\u2588\\u2588\\u2554\\u2550\\u2550\\u2588\\u2588\\u2557\\u2588\\u2588\\u2588\\u2588\\u2557\\u2591\\u2588\\u2588\\u2551\\u2588\\u2588\\u2554\\u2550\\u2550\\u2588\\u2588\\u2557\\n\\u2588\\u2588\\u2551\\u2591\\u2591\\u2588\\u2588\\u2551\\u2588\\u2588\\u2588\\u2588\\u2588\\u2557\\u2591\\u2591\\u2588\\u2588\\u2588\\u2588\\u2588\\u2557\\u2591\\u2591\\u2588\\u2588\\u2551\\u2591\\u2591\\u2591\\u255a\\u2588\\u2588\\u2557\\u2588\\u2588\\u2588\\u2588\\u2557\\u2588\\u2588\\u2554\\u255d\\u2588\\u2588\\u2551\\u2591\\u2591\\u2588\\u2588\\u2551\\u2588\\u2588\\u2554\\u2588\\u2588\\u2557\\u2588\\u2588\\u2551\\u2588\\u2588\\u2551\\u2591\\u2591\\u2588\\u2588\\u2551\\u2588\\u2588\\u2588\\u2588\\u2588\\u2557\\u2591\\u2591\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2554\\u255d\\u2588\\u2588\\u2551\\u2591\\u2591\\u2591\\u2591\\u2591\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2551\\u2588\\u2588\\u2554\\u2588\\u2588\\u2557\\u2588\\u2588\\u2551\\u2588\\u2588\\u2551\\u2591\\u2591\\u2588\\u2588\\u2551\\n\\u2588\\u2588\\u2551\\u2591\\u2591\\u2588\\u2588\\u2551\\u2588\\u2588\\u2554\\u2550\\u2550\\u255d\\u2591\\u2591\\u2588\\u2588\\u2554\\u2550\\u2550\\u255d\\u2591\\u2591\\u2588\\u2588\\u2551\\u2591\\u2591\\u2591\\u2591\\u2588\\u2588\\u2588\\u2588\\u2554\\u2550\\u2588\\u2588\\u2588\\u2588\\u2551\\u2591\\u2588\\u2588\\u2551\\u2591\\u2591\\u2588\\u2588\\u2551\\u2588\\u2588\\u2551\\u255a\\u2588\\u2588\\u2588\\u2588\\u2551\\u2588\\u2588\\u2551\\u2591\\u2591\\u2588\\u2588\\u2551\\u2588\\u2588\\u2554\\u2550\\u2550\\u255d\\u2591\\u2591\\u2588\\u2588\\u2554\\u2550\\u2550\\u2588\\u2588\\u2557\\u2588\\u2588\\u2551\\u2591\\u2591\\u2591\\u2591\\u2591\\u2588\\u2588\\u2554\\u2550\\u2550\\u2588\\u2588\\u2551\\u2588\\u2588\\u2551\\u255a\\u2588\\u2588\\u2588\\u2588\\u2551\\u2588\\u2588\\u2551\\u2591\\u2591\\u2588\\u2588\\u2551\\n\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2554\\u255d\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2557\\u2588\\u2588\\u2551\\u2591\\u2591\\u2591\\u2591\\u2591\\u2588\\u2588\\u2551\\u2591\\u2591\\u2591\\u2591\\u255a\\u2588\\u2588\\u2554\\u255d\\u2591\\u255a\\u2588\\u2588\\u2554\\u255d\\u2591\\u255a\\u2588\\u2588\\u2588\\u2588\\u2588\\u2554\\u255d\\u2588\\u2588\\u2551\\u2591\\u255a\\u2588\\u2588\\u2588\\u2551\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2554\\u255d\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2557\\u2588\\u2588\\u2551\\u2591\\u2591\\u2588\\u2588\\u2551\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2557\\u2588\\u2588\\u2551\\u2591\\u2591\\u2588\\u2588\\u2551\\u2588\\u2588\\u2551\\u2591\\u255a\\u2588\\u2588\\u2588\\u2551\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2554\\u255d\\n\\u255a\\u2550\\u2550\\u2550\\u2550\\u2550\\u255d\\u2591\\u255a\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u255d\\u255a\\u2550\\u255d\\u2591\\u2591\\u2591\\u2591\\u2591\\u255a\\u2550\\u255d\\u2591\\u2591\\u2591\\u2591\\u2591\\u255a\\u2550\\u255d\\u2591\\u2591\\u2591\\u255a\\u2550\\u255d\\u2591\\u2591\\u2591\\u255a\\u2550\\u2550\\u2550\\u2550\\u255d\\u2591\\u255a\\u2550\\u255d\\u2591\\u2591\\u255a\\u2550\\u2550\\u255d\\u255a\\u2550\\u2550\\u2550\\u2550\\u2550\\u255d\\u2591\\u255a\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u255d\\u255a\\u2550\\u255d\\u2591\\u2591\\u255a\\u2550\\u255d\\u255a\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u255d\\u255a\\u2550\\u255d\\u2591\\u2591\\u255a\\u2550\\u255d\\u255a\\u2550\\u255d\\u2591\\u2591\\u255a\\u2550\\u2550\\u255d\\u255a\\u2550\\u2550\\u2550\\u2550\\u2550\\u255d\\u2591\\n\\nhttps://defi.sucks\\n\\nCommit hash: b18e2940310077e04ec08b3026dc92e441fb08ef\\n\\n*/\\n\\npragma solidity >=0.8.4 <0.9.0;\\n\\nimport '../peripherals/Mintable.sol';\\nimport '../../interfaces/sidechain/IKeep3rEscrow.sol';\\nimport '@defi-wonderland/solidity-utils/solidity/contracts/DustCollector.sol';\\nimport '@openzeppelin/contracts/token/ERC20/IERC20.sol';\\nimport '@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol';\\n\\ncontract Keep3rEscrow is Mintable, DustCollector, IKeep3rEscrow {\\n using SafeERC20 for IERC20;\\n\\n /// @inheritdoc IKeep3rEscrow\\n address public override wKP3R;\\n\\n /// @param _governor Address of governor\\n /// @param _wKP3R Address of wrapped KP3R implementation\\n constructor(address _governor, address _wKP3R) Mintable(_governor) {\\n wKP3R = _wKP3R;\\n }\\n\\n /// @inheritdoc IKeep3rEscrow\\n function deposit(uint256 _amount) external override {\\n IERC20(wKP3R).safeTransferFrom(msg.sender, address(this), _amount);\\n emit wKP3RDeposited(wKP3R, msg.sender, _amount);\\n }\\n\\n /// @inheritdoc IKeep3rEscrow\\n function mint(uint256 _amount) external override onlyMinter {\\n IERC20(wKP3R).safeTransfer(msg.sender, _amount);\\n emit wKP3RMinted(wKP3R, msg.sender, _amount);\\n }\\n\\n /// @inheritdoc IKeep3rEscrow\\n function setWKP3R(address _wKP3R) external override onlyGovernor {\\n if (_wKP3R == address(0)) revert ZeroAddress();\\n wKP3R = _wKP3R;\\n emit wKP3RSet(wKP3R);\\n }\\n}\\n\",\"keccak256\":\"0xafdcd19a968d088199b37fc9d76484bb144e8335dcfb976921e0e2ce710e254d\",\"license\":\"MIT\"},\"solidity/interfaces/peripherals/IMintable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4 <0.9.0;\\n\\nimport '@defi-wonderland/solidity-utils/solidity/interfaces/IBaseErrors.sol';\\nimport '@defi-wonderland/solidity-utils/solidity/interfaces/IGovernable.sol';\\n\\n/// @title Mintable contract\\n/// @notice Manages the minter role\\ninterface IMintable is IBaseErrors, IGovernable {\\n // Events\\n\\n /// @notice Emitted when governor sets a new minter\\n /// @param _minter Address of the new minter\\n event MinterSet(address _minter);\\n\\n // Errors\\n\\n /// @notice Throws if the caller of the function is not the minter\\n error OnlyMinter();\\n\\n // Variables\\n\\n /// @notice Stores the minter address\\n /// @return _minter The minter addresss\\n function minter() external view returns (address _minter);\\n\\n // Methods\\n\\n /// @notice Sets a new address to be the minter\\n /// @param _minter The address set as the minter\\n function setMinter(address _minter) external;\\n}\\n\",\"keccak256\":\"0x0048c141d747eb1b0e9391ac9e13c268f858f2fec939c597992742e7a5e71597\",\"license\":\"MIT\"},\"solidity/interfaces/sidechain/IKeep3rEscrow.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4 <0.9.0;\\n\\n// solhint-disable-next-line no-empty-blocks\\n\\nimport '../peripherals/IMintable.sol';\\n\\n/// @title Keep3rEscrow contract\\n/// @notice This contract acts as an escrow contract for wKP3R tokens on sidechains and L2s\\n/// @dev Can be used as a replacement for keep3rV1Proxy in keep3r sidechain implementations\\ninterface IKeep3rEscrow is IMintable {\\n /// @notice Emitted when Keep3rEscrow#deposit function is called\\n /// @param _wKP3R The addess of the wrapped KP3R token\\n /// @param _sender The address that called the function\\n /// @param _amount The amount of wKP3R the user deposited\\n event wKP3RDeposited(address _wKP3R, address _sender, uint256 _amount);\\n\\n /// @notice Emitted when Keep3rEscrow#mint function is called\\n /// @param _wKP3R The addess of the wrapped KP3R token\\n /// @param _recipient The address that will received the newly minted wKP3R\\n /// @param _amount The amount of wKP3R minted to the recipient\\n event wKP3RMinted(address _wKP3R, address _recipient, uint256 _amount);\\n\\n /// @notice Emitted when Keep3rEscrow#setWKP3R function is called\\n /// @param _newWKP3R The address of the wKP3R contract\\n event wKP3RSet(address _newWKP3R);\\n\\n /// @notice Throws when minter attempts to withdraw more wKP3R than the escrow has in its balance\\n error InsufficientBalance();\\n\\n /// @notice Lists the address of the wKP3R contract\\n /// @return _wKP3RAddress The address of wKP3R\\n function wKP3R() external view returns (address _wKP3RAddress);\\n\\n /// @notice Deposits wKP3R into the contract\\n /// @param _amount The amount of wKP3R to deposit\\n function deposit(uint256 _amount) external;\\n\\n /// @notice mints wKP3R to the recipient\\n /// @param _amount The amount of wKP3R to mint\\n function mint(uint256 _amount) external;\\n\\n /// @notice sets the wKP3R address\\n /// @param _wKP3R the wKP3R address\\n function setWKP3R(address _wKP3R) external;\\n}\\n\",\"keccak256\":\"0xf4796dde1afba7f50805aeae92ac0a4848525aeca8355d9b1c6b36c15cca4322\",\"license\":\"MIT\"}},\"version\":1}", + "bytecode": "0x608060405234801561001057600080fd5b50604051610b92380380610b9283398101604081905261002f916100ac565b81806001600160a01b0381166100585760405163d92e233d60e01b815260040160405180910390fd5b600080546001600160a01b039283166001600160a01b0319918216179091556003805494909216931692909217909155506100df9050565b80516001600160a01b03811681146100a757600080fd5b919050565b600080604083850312156100bf57600080fd5b6100c883610090565b91506100d660208401610090565b90509250929050565b610aa4806100ee6000396000f3fe608060405234801561001057600080fd5b50600436106100b45760003560e01c8063a734f06e11610071578063a734f06e1461013e578063b509ec4514610159578063b6b55f251461016c578063e3056a341461017f578063f235757f14610192578063fca3b5aa146101a557600080fd5b806307546172146100b95780630c340a24146100e857806313f6986d146100fb5780632131606414610105578063966abd0014610118578063a0712d681461012b575b600080fd5b6002546100cc906001600160a01b031681565b6040516001600160a01b03909116815260200160405180910390f35b6000546100cc906001600160a01b031681565b6101036101b8565b005b610103610113366004610961565b6101ed565b61010361012636600461097c565b610294565b6101036101393660046109b8565b6103aa565b6100cc73eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee81565b6003546100cc906001600160a01b031681565b61010361017a3660046109b8565b610435565b6001546100cc906001600160a01b031681565b6101036101a0366004610961565b610496565b6101036101b3366004610961565b6104cd565b6001546001600160a01b031633146101e357604051639ba0305d60e01b815260040160405180910390fd5b6101eb61056d565b565b6000546001600160a01b031633146102185760405163070545c960e51b815260040160405180910390fd5b6001600160a01b03811661023f5760405163d92e233d60e01b815260040160405180910390fd5b600380546001600160a01b0319166001600160a01b0383169081179091556040519081527f8592ade84fad7cc1c020f9783980e05e1be8bf3c0b6b557f3f5d5b48b5147647906020015b60405180910390a150565b6000546001600160a01b031633146102bf5760405163070545c960e51b815260040160405180910390fd5b6001600160a01b0381166102e65760405163d92e233d60e01b815260040160405180910390fd5b6001600160a01b03831673eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee1415610347576040516001600160a01b0382169083156108fc029084906000818181858888f19350505050158015610341573d6000803e3d6000fd5b5061035b565b61035b6001600160a01b03841682846105cb565b604080516001600160a01b0385811682526020820185905283168183015290517f9a3055ded8c8b5f21bbf4946c5afab6e1fa8b3f057922658e5e1ade125fb0b1e9181900360600190a1505050565b6002546001600160a01b031633146103d557604051639cdc2ed560e01b815260040160405180910390fd5b6003546103ec906001600160a01b031633836105cb565b600354604080516001600160a01b03909216825233602083015281018290527f5c5d429f40d64606e3af1c2373aa5f5b0846566f2bb3871dcccf094850ed4fc890606001610289565b60035461044d906001600160a01b0316333084610633565b600354604080516001600160a01b03909216825233602083015281018290527fb0c9218af42df0588074c7f30948dd6d1293a5ef42e7762e83d62c5daa7c9b8490606001610289565b6000546001600160a01b031633146104c15760405163070545c960e51b815260040160405180910390fd5b6104ca81610671565b50565b6000546001600160a01b031633146104f85760405163070545c960e51b815260040160405180910390fd5b6001600160a01b03811661051f5760405163d92e233d60e01b815260040160405180910390fd5b600280546001600160a01b0319166001600160a01b0383169081179091556040519081527f726b590ef91a8c76ad05bbe91a57ef84605276528f49cd47d787f558a4e755b690602001610289565b60018054600080546001600160a01b0383166001600160a01b031991821681179092559091169091556040519081527f5d5d6e01b731c3e68060f7fe13156f6197d4aeffc2d6f498e34c717ae616b7349060200160405180910390a1565b6040516001600160a01b03831660248201526044810182905261062e90849063a9059cbb60e01b906064015b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b0319909316929092179091526106f4565b505050565b6040516001600160a01b038085166024830152831660448201526064810182905261066b9085906323b872dd60e01b906084016105f7565b50505050565b6001600160a01b0381166106985760405163d92e233d60e01b815260040160405180910390fd5b600180546001600160a01b0319166001600160a01b038381169182179092556000546040805191909316815260208101919091527f6353ec38ac394f8be94bfafcdd3580d356470599059eaeebedc3207e1cc03dec9101610289565b6000610749826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b03166107cb9092919063ffffffff16565b80519091501561062e578080602001905181019061076791906109d1565b61062e5760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b60648201526084015b60405180910390fd5b60606107da84846000856107e4565b90505b9392505050565b6060824710156108455760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f6044820152651c8818d85b1b60d21b60648201526084016107c2565b843b6108935760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e747261637400000060448201526064016107c2565b600080866001600160a01b031685876040516108af9190610a1f565b60006040518083038185875af1925050503d80600081146108ec576040519150601f19603f3d011682016040523d82523d6000602084013e6108f1565b606091505b509150915061090182828661090c565b979650505050505050565b6060831561091b5750816107dd565b82511561092b5782518084602001fd5b8160405162461bcd60e51b81526004016107c29190610a3b565b80356001600160a01b038116811461095c57600080fd5b919050565b60006020828403121561097357600080fd5b6107dd82610945565b60008060006060848603121561099157600080fd5b61099a84610945565b9250602084013591506109af60408501610945565b90509250925092565b6000602082840312156109ca57600080fd5b5035919050565b6000602082840312156109e357600080fd5b815180151581146107dd57600080fd5b60005b83811015610a0e5781810151838201526020016109f6565b8381111561066b5750506000910152565b60008251610a318184602087016109f3565b9190910192915050565b6020815260008251806020840152610a5a8160408501602087016109f3565b601f01601f1916919091016040019291505056fea26469706673582212200bb64e25ba05e0b419b12ab27ba9040065a75842a9258ef809a910013cbe85e564736f6c63430008080033", + "deployedBytecode": "0x608060405234801561001057600080fd5b50600436106100b45760003560e01c8063a734f06e11610071578063a734f06e1461013e578063b509ec4514610159578063b6b55f251461016c578063e3056a341461017f578063f235757f14610192578063fca3b5aa146101a557600080fd5b806307546172146100b95780630c340a24146100e857806313f6986d146100fb5780632131606414610105578063966abd0014610118578063a0712d681461012b575b600080fd5b6002546100cc906001600160a01b031681565b6040516001600160a01b03909116815260200160405180910390f35b6000546100cc906001600160a01b031681565b6101036101b8565b005b610103610113366004610961565b6101ed565b61010361012636600461097c565b610294565b6101036101393660046109b8565b6103aa565b6100cc73eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee81565b6003546100cc906001600160a01b031681565b61010361017a3660046109b8565b610435565b6001546100cc906001600160a01b031681565b6101036101a0366004610961565b610496565b6101036101b3366004610961565b6104cd565b6001546001600160a01b031633146101e357604051639ba0305d60e01b815260040160405180910390fd5b6101eb61056d565b565b6000546001600160a01b031633146102185760405163070545c960e51b815260040160405180910390fd5b6001600160a01b03811661023f5760405163d92e233d60e01b815260040160405180910390fd5b600380546001600160a01b0319166001600160a01b0383169081179091556040519081527f8592ade84fad7cc1c020f9783980e05e1be8bf3c0b6b557f3f5d5b48b5147647906020015b60405180910390a150565b6000546001600160a01b031633146102bf5760405163070545c960e51b815260040160405180910390fd5b6001600160a01b0381166102e65760405163d92e233d60e01b815260040160405180910390fd5b6001600160a01b03831673eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee1415610347576040516001600160a01b0382169083156108fc029084906000818181858888f19350505050158015610341573d6000803e3d6000fd5b5061035b565b61035b6001600160a01b03841682846105cb565b604080516001600160a01b0385811682526020820185905283168183015290517f9a3055ded8c8b5f21bbf4946c5afab6e1fa8b3f057922658e5e1ade125fb0b1e9181900360600190a1505050565b6002546001600160a01b031633146103d557604051639cdc2ed560e01b815260040160405180910390fd5b6003546103ec906001600160a01b031633836105cb565b600354604080516001600160a01b03909216825233602083015281018290527f5c5d429f40d64606e3af1c2373aa5f5b0846566f2bb3871dcccf094850ed4fc890606001610289565b60035461044d906001600160a01b0316333084610633565b600354604080516001600160a01b03909216825233602083015281018290527fb0c9218af42df0588074c7f30948dd6d1293a5ef42e7762e83d62c5daa7c9b8490606001610289565b6000546001600160a01b031633146104c15760405163070545c960e51b815260040160405180910390fd5b6104ca81610671565b50565b6000546001600160a01b031633146104f85760405163070545c960e51b815260040160405180910390fd5b6001600160a01b03811661051f5760405163d92e233d60e01b815260040160405180910390fd5b600280546001600160a01b0319166001600160a01b0383169081179091556040519081527f726b590ef91a8c76ad05bbe91a57ef84605276528f49cd47d787f558a4e755b690602001610289565b60018054600080546001600160a01b0383166001600160a01b031991821681179092559091169091556040519081527f5d5d6e01b731c3e68060f7fe13156f6197d4aeffc2d6f498e34c717ae616b7349060200160405180910390a1565b6040516001600160a01b03831660248201526044810182905261062e90849063a9059cbb60e01b906064015b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b0319909316929092179091526106f4565b505050565b6040516001600160a01b038085166024830152831660448201526064810182905261066b9085906323b872dd60e01b906084016105f7565b50505050565b6001600160a01b0381166106985760405163d92e233d60e01b815260040160405180910390fd5b600180546001600160a01b0319166001600160a01b038381169182179092556000546040805191909316815260208101919091527f6353ec38ac394f8be94bfafcdd3580d356470599059eaeebedc3207e1cc03dec9101610289565b6000610749826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b03166107cb9092919063ffffffff16565b80519091501561062e578080602001905181019061076791906109d1565b61062e5760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b60648201526084015b60405180910390fd5b60606107da84846000856107e4565b90505b9392505050565b6060824710156108455760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f6044820152651c8818d85b1b60d21b60648201526084016107c2565b843b6108935760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e747261637400000060448201526064016107c2565b600080866001600160a01b031685876040516108af9190610a1f565b60006040518083038185875af1925050503d80600081146108ec576040519150601f19603f3d011682016040523d82523d6000602084013e6108f1565b606091505b509150915061090182828661090c565b979650505050505050565b6060831561091b5750816107dd565b82511561092b5782518084602001fd5b8160405162461bcd60e51b81526004016107c29190610a3b565b80356001600160a01b038116811461095c57600080fd5b919050565b60006020828403121561097357600080fd5b6107dd82610945565b60008060006060848603121561099157600080fd5b61099a84610945565b9250602084013591506109af60408501610945565b90509250925092565b6000602082840312156109ca57600080fd5b5035919050565b6000602082840312156109e357600080fd5b815180151581146107dd57600080fd5b60005b83811015610a0e5781810151838201526020016109f6565b8381111561066b5750506000910152565b60008251610a318184602087016109f3565b9190910192915050565b6020815260008251806020840152610a5a8160408501602087016109f3565b601f01601f1916919091016040019291505056fea26469706673582212200bb64e25ba05e0b419b12ab27ba9040065a75842a9258ef809a910013cbe85e564736f6c63430008080033", + "devdoc": { + "kind": "dev", + "methods": { + "constructor": { + "params": { + "_governor": "Address of governor", + "_wKP3R": "Address of wrapped KP3R implementation" + } + }, + "deposit(uint256)": { + "params": { + "_amount": "The amount of wKP3R to deposit" + } + }, + "mint(uint256)": { + "params": { + "_amount": "The amount of wKP3R to mint" + } + }, + "sendDust(address,uint256,address)": { + "params": { + "_amount": "The amont of the token that will be transferred", + "_to": "The address that will receive the idle funds", + "_token": "The token that will be transferred" + } + }, + "setMinter(address)": { + "params": { + "_minter": "The address set as the minter" + } + }, + "setPendingGovernor(address)": { + "params": { + "_pendingGovernor": "Address of the proposed new governor" + } + }, + "setWKP3R(address)": { + "params": { + "_wKP3R": "the wKP3R address" + } + } + }, + "stateVariables": { + "wKP3R": { + "return": "_wKP3RAddress The address of wKP3R", + "returns": { + "_0": "_wKP3RAddress The address of wKP3R" + } + } + }, + "version": 1 + }, + "userdoc": { + "errors": { + "InsufficientBalance()": [ + { + "notice": "Throws when minter attempts to withdraw more wKP3R than the escrow has in its balance" + } + ], + "InvalidAddress()": [ + { + "notice": "Thrown if an address is invalid" + } + ], + "InvalidAmount()": [ + { + "notice": "Thrown if an amount is invalid" + } + ], + "LengthMismatch()": [ + { + "notice": "Thrown if the lengths of a set of lists mismatch" + } + ], + "OnlyGovernor()": [ + { + "notice": "Thrown if a non-governor user tries to call a OnlyGovernor function" + } + ], + "OnlyMinter()": [ + { + "notice": "Throws if the caller of the function is not the minter" + } + ], + "OnlyPendingGovernor()": [ + { + "notice": "Thrown if a non-pending-governor user tries to call a OnlyPendingGovernor function" + } + ], + "ZeroAddress()": [ + { + "notice": "Thrown if an address is the zero address" + } + ], + "ZeroAmount()": [ + { + "notice": "Thrown if an amount is zero" + } + ] + }, + "events": { + "DustSent(address,uint256,address)": { + "notice": "Emitted when dust is sent" + }, + "MinterSet(address)": { + "notice": "Emitted when governor sets a new minter" + }, + "PendingGovernorAccepted(address)": { + "notice": "Emitted when a new governor is set" + }, + "PendingGovernorSet(address,address)": { + "notice": "Emitted when a new pending governor is set" + }, + "wKP3RDeposited(address,address,uint256)": { + "notice": "Emitted when Keep3rEscrow#deposit function is called" + }, + "wKP3RMinted(address,address,uint256)": { + "notice": "Emitted when Keep3rEscrow#mint function is called" + }, + "wKP3RSet(address)": { + "notice": "Emitted when Keep3rEscrow#setWKP3R function is called" + } + }, + "kind": "user", + "methods": { + "acceptPendingGovernor()": { + "notice": "Allows a proposed governor to accept the governance" + }, + "deposit(uint256)": { + "notice": "Deposits wKP3R into the contract" + }, + "mint(uint256)": { + "notice": "mints wKP3R to the recipient" + }, + "minter()": { + "notice": "Stores the minter address" + }, + "sendDust(address,uint256,address)": { + "notice": "Allows an authorized user to transfer the tokens or eth that may have been left in a contract" + }, + "setMinter(address)": { + "notice": "Sets a new address to be the minter" + }, + "setPendingGovernor(address)": { + "notice": "Allows a governor to propose a new governor" + }, + "setWKP3R(address)": { + "notice": "sets the wKP3R address" + }, + "wKP3R()": { + "notice": "Lists the address of the wKP3R contract" + } + }, + "version": 1 + }, + "storageLayout": { + "storage": [ + { + "astId": 82, + "contract": "solidity/contracts/sidechain/Keep3rEscrow.sol:Keep3rEscrow", + "label": "governor", + "offset": 0, + "slot": "0", + "type": "t_address" + }, + { + "astId": 85, + "contract": "solidity/contracts/sidechain/Keep3rEscrow.sol:Keep3rEscrow", + "label": "pendingGovernor", + "offset": 0, + "slot": "1", + "type": "t_address" + }, + { + "astId": 6519, + "contract": "solidity/contracts/sidechain/Keep3rEscrow.sol:Keep3rEscrow", + "label": "minter", + "offset": 0, + "slot": "2", + "type": "t_address" + }, + { + "astId": 9972, + "contract": "solidity/contracts/sidechain/Keep3rEscrow.sol:Keep3rEscrow", + "label": "wKP3R", + "offset": 0, + "slot": "3", + "type": "t_address" + } + ], + "types": { + "t_address": { + "encoding": "inplace", + "label": "address", + "numberOfBytes": "20" + } + } + } +} \ No newline at end of file diff --git a/deployments/optimisticSepolia/Keep3rHelperSidechain.json b/deployments/optimisticSepolia/Keep3rHelperSidechain.json new file mode 100644 index 0000000..81cc823 --- /dev/null +++ b/deployments/optimisticSepolia/Keep3rHelperSidechain.json @@ -0,0 +1,1653 @@ +{ + "address": "0x37d9EEF8c61075C03fC7710175822dAa33Ce3e4b", + "abi": [ + { + "inputs": [ + { + "internalType": "address", + "name": "_keep3rV2", + "type": "address" + }, + { + "internalType": "address", + "name": "_governor", + "type": "address" + }, + { + "internalType": "address", + "name": "_kp3r", + "type": "address" + }, + { + "internalType": "address", + "name": "_weth", + "type": "address" + }, + { + "internalType": "address", + "name": "_kp3rWethOracle", + "type": "address" + }, + { + "internalType": "address", + "name": "_wethUsdOracle", + "type": "address" + }, + { + "internalType": "uint8", + "name": "_usdDecimals", + "type": "uint8" + } + ], + "stateMutability": "nonpayable", + "type": "constructor" + }, + { + "inputs": [], + "name": "InvalidAddress", + "type": "error" + }, + { + "inputs": [], + "name": "InvalidAmount", + "type": "error" + }, + { + "inputs": [], + "name": "InvalidOraclePool", + "type": "error" + }, + { + "inputs": [], + "name": "LengthMismatch", + "type": "error" + }, + { + "inputs": [], + "name": "LiquidityPairInvalid", + "type": "error" + }, + { + "inputs": [], + "name": "OnlyGovernor", + "type": "error" + }, + { + "inputs": [], + "name": "OnlyPendingGovernor", + "type": "error" + }, + { + "inputs": [], + "name": "ZeroAddress", + "type": "error" + }, + { + "inputs": [], + "name": "ZeroAmount", + "type": "error" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "_keep3rV2", + "type": "address" + } + ], + "name": "Keep3rV2Change", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "_address", + "type": "address" + }, + { + "indexed": false, + "internalType": "bool", + "name": "_isKP3RToken0", + "type": "bool" + } + ], + "name": "Kp3rWethPoolChange", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint256", + "name": "_maxBoost", + "type": "uint256" + } + ], + "name": "MaxBoostChange", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint256", + "name": "_minBaseFee", + "type": "uint256" + } + ], + "name": "MinBaseFeeChange", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint256", + "name": "_minBoost", + "type": "uint256" + } + ], + "name": "MinBoostChange", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint256", + "name": "_minPriorityFee", + "type": "uint256" + } + ], + "name": "MinPriorityFeeChange", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "_liquidity", + "type": "address" + }, + { + "indexed": false, + "internalType": "address", + "name": "_oraclePool", + "type": "address" + } + ], + "name": "OracleSet", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "_newGovernor", + "type": "address" + } + ], + "name": "PendingGovernorAccepted", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "_governor", + "type": "address" + }, + { + "indexed": false, + "internalType": "address", + "name": "_pendingGovernor", + "type": "address" + } + ], + "name": "PendingGovernorSet", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint32", + "name": "_quoteTwapTime", + "type": "uint32" + } + ], + "name": "QuoteTwapTimeChange", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint256", + "name": "_targetBond", + "type": "uint256" + } + ], + "name": "TargetBondChange", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "_address", + "type": "address" + }, + { + "indexed": false, + "internalType": "bool", + "name": "_isWETHToken0", + "type": "bool" + }, + { + "indexed": false, + "internalType": "uint8", + "name": "_usdDecimals", + "type": "uint8" + } + ], + "name": "WethUSDPoolChange", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint256", + "name": "_workExtraGas", + "type": "uint256" + } + ], + "name": "WorkExtraGasChange", + "type": "event" + }, + { + "inputs": [], + "name": "BOOST_BASE", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "KP3R", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "WETH", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "acceptPendingGovernor", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_keeper", + "type": "address" + } + ], + "name": "bonds", + "outputs": [ + { + "internalType": "uint256", + "name": "_amountBonded", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "_liquidityAmount", + "type": "uint256" + }, + { + "internalType": "int56", + "name": "_tickDifference", + "type": "int56" + }, + { + "internalType": "uint256", + "name": "_timeInterval", + "type": "uint256" + } + ], + "name": "getKP3RsAtTick", + "outputs": [ + { + "internalType": "uint256", + "name": "_kp3rAmount", + "type": "uint256" + } + ], + "stateMutability": "pure", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "_bonds", + "type": "uint256" + } + ], + "name": "getPaymentParams", + "outputs": [ + { + "internalType": "uint256", + "name": "_boost", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "_oneUsdQuote", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "_extraGas", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_pool", + "type": "address" + } + ], + "name": "getPoolTokens", + "outputs": [ + { + "internalType": "address", + "name": "_token0", + "type": "address" + }, + { + "internalType": "address", + "name": "_token1", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint128", + "name": "_baseAmount", + "type": "uint128" + }, + { + "internalType": "int56", + "name": "_tickDifference", + "type": "int56" + }, + { + "internalType": "uint256", + "name": "_timeInterval", + "type": "uint256" + } + ], + "name": "getQuoteAtTick", + "outputs": [ + { + "internalType": "uint256", + "name": "_quoteAmount", + "type": "uint256" + } + ], + "stateMutability": "pure", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "_gasUsed", + "type": "uint256" + } + ], + "name": "getRewardAmount", + "outputs": [ + { + "internalType": "uint256", + "name": "_amount", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_keeper", + "type": "address" + }, + { + "internalType": "uint256", + "name": "_gasUsed", + "type": "uint256" + } + ], + "name": "getRewardAmountFor", + "outputs": [ + { + "internalType": "uint256", + "name": "_kp3r", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "_bonds", + "type": "uint256" + } + ], + "name": "getRewardBoostFor", + "outputs": [ + { + "internalType": "uint256", + "name": "_rewardBoost", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "governor", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_pool", + "type": "address" + } + ], + "name": "isKP3RToken0", + "outputs": [ + { + "internalType": "bool", + "name": "_isKP3RToken0", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "keep3rV2", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "kp3rWethPool", + "outputs": [ + { + "internalType": "address", + "name": "poolAddress", + "type": "address" + }, + { + "internalType": "bool", + "name": "isKP3RToken0", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "maxBoost", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "minBaseFee", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "minBoost", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "minPriorityFee", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_pool", + "type": "address" + }, + { + "internalType": "uint32[]", + "name": "_secondsAgo", + "type": "uint32[]" + } + ], + "name": "observe", + "outputs": [ + { + "internalType": "int56", + "name": "_tickCumulative1", + "type": "int56" + }, + { + "internalType": "int56", + "name": "_tickCumulative2", + "type": "int56" + }, + { + "internalType": "bool", + "name": "_success", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "name": "oracle", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "pendingGovernor", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "_eth", + "type": "uint256" + } + ], + "name": "quote", + "outputs": [ + { + "internalType": "uint256", + "name": "_amountOut", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "quoteTwapTime", + "outputs": [ + { + "internalType": "uint32", + "name": "", + "type": "uint32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "_usd", + "type": "uint256" + } + ], + "name": "quoteUsdToEth", + "outputs": [ + { + "internalType": "uint256", + "name": "_amountOut", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_keep3rV2", + "type": "address" + } + ], + "name": "setKeep3rV2", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_poolAddress", + "type": "address" + } + ], + "name": "setKp3rWethPool", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "_maxBoost", + "type": "uint256" + } + ], + "name": "setMaxBoost", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "_minBaseFee", + "type": "uint256" + } + ], + "name": "setMinBaseFee", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "_minBoost", + "type": "uint256" + } + ], + "name": "setMinBoost", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "_minPriorityFee", + "type": "uint256" + } + ], + "name": "setMinPriorityFee", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_liquidity", + "type": "address" + }, + { + "internalType": "address", + "name": "_oracle", + "type": "address" + } + ], + "name": "setOracle", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_pendingGovernor", + "type": "address" + } + ], + "name": "setPendingGovernor", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint32", + "name": "_quoteTwapTime", + "type": "uint32" + } + ], + "name": "setQuoteTwapTime", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "_targetBond", + "type": "uint256" + } + ], + "name": "setTargetBond", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_poolAddress", + "type": "address" + }, + { + "internalType": "uint8", + "name": "_usdDecimals", + "type": "uint8" + } + ], + "name": "setWethUsdPool", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "_workExtraGas", + "type": "uint256" + } + ], + "name": "setWorkExtraGas", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "targetBond", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "wethUSDPool", + "outputs": [ + { + "internalType": "address", + "name": "poolAddress", + "type": "address" + }, + { + "internalType": "bool", + "name": "isWETHToken0", + "type": "bool" + }, + { + "internalType": "uint8", + "name": "usdDecimals", + "type": "uint8" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "workExtraGas", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + } + ], + "transactionHash": "0xa1da969c7de0695320eaf5330ffa78ba98180c186d627ad98d778f2f8870cd83", + "receipt": { + "to": null, + "from": "0x169Cf949aB1B25453b70F2Fe874e2c65c10AE0f8", + "contractAddress": "0x37d9EEF8c61075C03fC7710175822dAa33Ce3e4b", + "transactionIndex": 1, + "gasUsed": "2277295", + "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000080000000000000000000000000000020000040000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000802000000000002000000000000000000000000000000000100000000000000000200000000000000000000000000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000008000000000000000000", + "blockHash": "0x43c3204222f34a90dd33ca2869837c246c057cd6568ee3f7d25811bba87ef8ac", + "transactionHash": "0xa1da969c7de0695320eaf5330ffa78ba98180c186d627ad98d778f2f8870cd83", + "logs": [ + { + "transactionIndex": 1, + "blockNumber": 9263779, + "transactionHash": "0xa1da969c7de0695320eaf5330ffa78ba98180c186d627ad98d778f2f8870cd83", + "address": "0x37d9EEF8c61075C03fC7710175822dAa33Ce3e4b", + "topics": [ + "0x554c636366d5fc882a9ab4b7b9d5181781d1a7076abe50ed410365620dcf4108" + ], + "data": "0x0000000000000000000000008bfdd4689dc4669bd818c0551a510301f091103c0000000000000000000000000000000000000000000000000000000000000001", + "logIndex": 0, + "blockHash": "0x43c3204222f34a90dd33ca2869837c246c057cd6568ee3f7d25811bba87ef8ac" + }, + { + "transactionIndex": 1, + "blockNumber": 9263779, + "transactionHash": "0xa1da969c7de0695320eaf5330ffa78ba98180c186d627ad98d778f2f8870cd83", + "address": "0x37d9EEF8c61075C03fC7710175822dAa33Ce3e4b", + "topics": [ + "0x10e6a379d12c209d558815459d599ade7bcc91d5270a7dfca948da52aef7df34" + ], + "data": "0x0000000000000000000000008bfdd4689dc4669bd818c0551a510301f091103c00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000012", + "logIndex": 1, + "blockHash": "0x43c3204222f34a90dd33ca2869837c246c057cd6568ee3f7d25811bba87ef8ac" + }, + { + "transactionIndex": 1, + "blockNumber": 9263779, + "transactionHash": "0xa1da969c7de0695320eaf5330ffa78ba98180c186d627ad98d778f2f8870cd83", + "address": "0x37d9EEF8c61075C03fC7710175822dAa33Ce3e4b", + "topics": [ + "0xc806e26fb64e3a95f4b70abf4d87280555696244d01068b5f45b0e515aceb1de" + ], + "data": "0x0000000000000000000000000000000000000000000000000000000000015180", + "logIndex": 2, + "blockHash": "0x43c3204222f34a90dd33ca2869837c246c057cd6568ee3f7d25811bba87ef8ac" + } + ], + "blockNumber": 9263779, + "cumulativeGasUsed": "2321182", + "status": 1, + "byzantium": true + }, + "args": [ + "0xC3377b30feD174e65778e7E1DaFBb7686082B428", + "0x169Cf949aB1B25453b70F2Fe874e2c65c10AE0f8", + "0x12DA5E324EFCBDe7BB4797e1dB2B3477FC4C048f", + "0x4200000000000000000000000000000000000006", + "0x8BFdD4689dC4669bd818c0551a510301f091103C", + "0x8BFdD4689dC4669bd818c0551a510301f091103C", + "0x0000000000000000000000000000000000000012" + ], + "numDeployments": 2, + "solcInputHash": "4e9d9cfe55e24217a94485fe49438e4a", + "metadata": "{\"compiler\":{\"version\":\"0.8.8+commit.dddeac2f\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_keep3rV2\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"_governor\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"_kp3r\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"_weth\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"_kp3rWethOracle\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"_wethUsdOracle\",\"type\":\"address\"},{\"internalType\":\"uint8\",\"name\":\"_usdDecimals\",\"type\":\"uint8\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"inputs\":[],\"name\":\"InvalidAddress\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"InvalidAmount\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"InvalidOraclePool\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"LengthMismatch\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"LiquidityPairInvalid\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"OnlyGovernor\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"OnlyPendingGovernor\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"ZeroAddress\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"ZeroAmount\",\"type\":\"error\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"_keep3rV2\",\"type\":\"address\"}],\"name\":\"Keep3rV2Change\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"_address\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"bool\",\"name\":\"_isKP3RToken0\",\"type\":\"bool\"}],\"name\":\"Kp3rWethPoolChange\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"_maxBoost\",\"type\":\"uint256\"}],\"name\":\"MaxBoostChange\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"_minBaseFee\",\"type\":\"uint256\"}],\"name\":\"MinBaseFeeChange\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"_minBoost\",\"type\":\"uint256\"}],\"name\":\"MinBoostChange\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"_minPriorityFee\",\"type\":\"uint256\"}],\"name\":\"MinPriorityFeeChange\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"_liquidity\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"_oraclePool\",\"type\":\"address\"}],\"name\":\"OracleSet\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"_newGovernor\",\"type\":\"address\"}],\"name\":\"PendingGovernorAccepted\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"_governor\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"_pendingGovernor\",\"type\":\"address\"}],\"name\":\"PendingGovernorSet\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint32\",\"name\":\"_quoteTwapTime\",\"type\":\"uint32\"}],\"name\":\"QuoteTwapTimeChange\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"_targetBond\",\"type\":\"uint256\"}],\"name\":\"TargetBondChange\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"_address\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"bool\",\"name\":\"_isWETHToken0\",\"type\":\"bool\"},{\"indexed\":false,\"internalType\":\"uint8\",\"name\":\"_usdDecimals\",\"type\":\"uint8\"}],\"name\":\"WethUSDPoolChange\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"_workExtraGas\",\"type\":\"uint256\"}],\"name\":\"WorkExtraGasChange\",\"type\":\"event\"},{\"inputs\":[],\"name\":\"BOOST_BASE\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"KP3R\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"WETH\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"acceptPendingGovernor\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_keeper\",\"type\":\"address\"}],\"name\":\"bonds\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"_amountBonded\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_liquidityAmount\",\"type\":\"uint256\"},{\"internalType\":\"int56\",\"name\":\"_tickDifference\",\"type\":\"int56\"},{\"internalType\":\"uint256\",\"name\":\"_timeInterval\",\"type\":\"uint256\"}],\"name\":\"getKP3RsAtTick\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"_kp3rAmount\",\"type\":\"uint256\"}],\"stateMutability\":\"pure\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_bonds\",\"type\":\"uint256\"}],\"name\":\"getPaymentParams\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"_boost\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"_oneUsdQuote\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"_extraGas\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_pool\",\"type\":\"address\"}],\"name\":\"getPoolTokens\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"_token0\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"_token1\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint128\",\"name\":\"_baseAmount\",\"type\":\"uint128\"},{\"internalType\":\"int56\",\"name\":\"_tickDifference\",\"type\":\"int56\"},{\"internalType\":\"uint256\",\"name\":\"_timeInterval\",\"type\":\"uint256\"}],\"name\":\"getQuoteAtTick\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"_quoteAmount\",\"type\":\"uint256\"}],\"stateMutability\":\"pure\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_gasUsed\",\"type\":\"uint256\"}],\"name\":\"getRewardAmount\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"_amount\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_keeper\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"_gasUsed\",\"type\":\"uint256\"}],\"name\":\"getRewardAmountFor\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"_kp3r\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_bonds\",\"type\":\"uint256\"}],\"name\":\"getRewardBoostFor\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"_rewardBoost\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"governor\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_pool\",\"type\":\"address\"}],\"name\":\"isKP3RToken0\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"_isKP3RToken0\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"keep3rV2\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"kp3rWethPool\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"poolAddress\",\"type\":\"address\"},{\"internalType\":\"bool\",\"name\":\"isKP3RToken0\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"maxBoost\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"minBaseFee\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"minBoost\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"minPriorityFee\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_pool\",\"type\":\"address\"},{\"internalType\":\"uint32[]\",\"name\":\"_secondsAgo\",\"type\":\"uint32[]\"}],\"name\":\"observe\",\"outputs\":[{\"internalType\":\"int56\",\"name\":\"_tickCumulative1\",\"type\":\"int56\"},{\"internalType\":\"int56\",\"name\":\"_tickCumulative2\",\"type\":\"int56\"},{\"internalType\":\"bool\",\"name\":\"_success\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"oracle\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"pendingGovernor\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_eth\",\"type\":\"uint256\"}],\"name\":\"quote\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"_amountOut\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"quoteTwapTime\",\"outputs\":[{\"internalType\":\"uint32\",\"name\":\"\",\"type\":\"uint32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_usd\",\"type\":\"uint256\"}],\"name\":\"quoteUsdToEth\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"_amountOut\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_keep3rV2\",\"type\":\"address\"}],\"name\":\"setKeep3rV2\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_poolAddress\",\"type\":\"address\"}],\"name\":\"setKp3rWethPool\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_maxBoost\",\"type\":\"uint256\"}],\"name\":\"setMaxBoost\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_minBaseFee\",\"type\":\"uint256\"}],\"name\":\"setMinBaseFee\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_minBoost\",\"type\":\"uint256\"}],\"name\":\"setMinBoost\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_minPriorityFee\",\"type\":\"uint256\"}],\"name\":\"setMinPriorityFee\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_liquidity\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"_oracle\",\"type\":\"address\"}],\"name\":\"setOracle\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_pendingGovernor\",\"type\":\"address\"}],\"name\":\"setPendingGovernor\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint32\",\"name\":\"_quoteTwapTime\",\"type\":\"uint32\"}],\"name\":\"setQuoteTwapTime\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_targetBond\",\"type\":\"uint256\"}],\"name\":\"setTargetBond\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_poolAddress\",\"type\":\"address\"},{\"internalType\":\"uint8\",\"name\":\"_usdDecimals\",\"type\":\"uint8\"}],\"name\":\"setWethUsdPool\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_workExtraGas\",\"type\":\"uint256\"}],\"name\":\"setWorkExtraGas\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"targetBond\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"wethUSDPool\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"poolAddress\",\"type\":\"address\"},{\"internalType\":\"bool\",\"name\":\"isWETHToken0\",\"type\":\"bool\"},{\"internalType\":\"uint8\",\"name\":\"usdDecimals\",\"type\":\"uint8\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"workExtraGas\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"}],\"devdoc\":{\"kind\":\"dev\",\"methods\":{\"bonds(address)\":{\"params\":{\"_keeper\":\"The address of the keeper to check\"},\"returns\":{\"_amountBonded\":\"The amount of KP3R the keeper has bonded\"}},\"constructor\":{\"details\":\"Oracle pools should use 18 decimals tokens\",\"params\":{\"_governor\":\"Address of governor\",\"_keep3rV2\":\"Address of sidechain Keep3r implementation\",\"_kp3rWethOracle\":\"Address of oracle used for KP3R/WETH quote\",\"_wethUsdOracle\":\"Address of oracle used for WETH/USD quote\"}},\"getKP3RsAtTick(uint256,int56,uint256)\":{\"params\":{\"_liquidityAmount\":\"Amount of liquidity to be converted\",\"_tickDifference\":\"Tick value used to calculate the quote\",\"_timeInterval\":\"Time value used to calculate the quote\"},\"returns\":{\"_kp3rAmount\":\"Amount of KP3R tokens underlying on the given liquidity\"}},\"getPaymentParams(uint256)\":{\"params\":{\"_bonds\":\"Amount of bonded KP3R owned by the keeper\"},\"returns\":{\"_boost\":\"Multiplier per gas unit. Takes into account the base fee and the amount of bonded KP3R\",\"_extraGas\":\"Amount of extra gas that should be added to the gas spent\",\"_oneUsdQuote\":\"Amount of KP3R tokens equivalent to 1 ETH\"}},\"getPoolTokens(address)\":{\"params\":{\"_pool\":\"Address of the correspondant pool\"},\"returns\":{\"_token0\":\"Address of the first token of the pair\",\"_token1\":\"Address of the second token of the pair\"}},\"getQuoteAtTick(uint128,int56,uint256)\":{\"params\":{\"_baseAmount\":\"Amount of token to be converted\",\"_tickDifference\":\"Tick value used to calculate the quote\",\"_timeInterval\":\"Time value used to calculate the quote\"},\"returns\":{\"_quoteAmount\":\"Amount of credits deserved for the baseAmount at the tick value\"}},\"getRewardAmount(uint256)\":{\"params\":{\"_gasUsed\":\"The amount of gas used that will be rewarded\"},\"returns\":{\"_amount\":\"The amount of KP3R that should be awarded to tx.origin\"}},\"getRewardAmountFor(address,uint256)\":{\"params\":{\"_gasUsed\":\"The amount of gas used that will be rewarded\",\"_keeper\":\"The address of the keeper to check\"},\"returns\":{\"_kp3r\":\"The amount of KP3R that should be awarded to the keeper\"}},\"getRewardBoostFor(uint256)\":{\"details\":\"If the keeper has no bonds, boost should be +10% of gas cost, if keeper has max bonds, +20%\",\"params\":{\"_bonds\":\"The amount of KP3R tokens bonded by the keeper\"},\"returns\":{\"_rewardBoost\":\"The reward boost that corresponds to the keeper\"}},\"isKP3RToken0(address)\":{\"params\":{\"_pool\":\"Address of the correspondant pool\"},\"returns\":{\"_isKP3RToken0\":\"Boolean indicating the order of the tokens in the pair\"}},\"observe(address,uint32[])\":{\"params\":{\"_pool\":\"Address of the pool to observe\",\"_secondsAgo\":\"Array with time references to observe\"},\"returns\":{\"_success\":\"Boolean indicating if the observe call was succesfull\",\"_tickCumulative1\":\"Cumulative sum of ticks until first time reference\",\"_tickCumulative2\":\"Cumulative sum of ticks until second time reference\"}},\"quote(uint256)\":{\"details\":\"This function allows us to calculate how much KP3R we should pay to a keeper for things expressed in ETH, like gas\",\"params\":{\"_eth\":\"The amount of ETH\"},\"returns\":{\"_amountOut\":\"The amount of KP3R\"}},\"quoteUsdToEth(uint256)\":{\"details\":\"Used to know how much ETH should be paid to keepers before converting it from ETH to KP3R\",\"params\":{\"_usd\":\"The amount of USD to quote to ETH\"},\"returns\":{\"_amountOut\":\"The resulting amount of ETH after quoting the USD\"}},\"setKeep3rV2(address)\":{\"params\":{\"_keep3rV2\":\"The address of Keep3r V2\"}},\"setKp3rWethPool(address)\":{\"params\":{\"_poolAddress\":\"The address of the KP3R-WETH pool\"}},\"setMaxBoost(uint256)\":{\"params\":{\"_maxBoost\":\"The maximum boost multiplier\"}},\"setMinBaseFee(uint256)\":{\"params\":{\"_minBaseFee\":\"The minimum rewarded gas fee\"}},\"setMinBoost(uint256)\":{\"params\":{\"_minBoost\":\"The minimum boost multiplier\"}},\"setMinPriorityFee(uint256)\":{\"params\":{\"_minPriorityFee\":\"The minimum rewarded priority fee\"}},\"setOracle(address,address)\":{\"details\":\"The oracle must contain KP3R as either token0 or token1\",\"params\":{\"_liquidity\":\"The address of the liquidity\",\"_oracle\":\"The address of the pool used to quote the liquidity from\"}},\"setPendingGovernor(address)\":{\"params\":{\"_pendingGovernor\":\"Address of the proposed new governor\"}},\"setQuoteTwapTime(uint32)\":{\"params\":{\"_quoteTwapTime\":\"The twap time for quoting\"}},\"setTargetBond(uint256)\":{\"params\":{\"_targetBond\":\"The target bond amount\"}},\"setWethUsdPool(address,uint8)\":{\"details\":\"The oracle must contain WETH as either token0 or token1\",\"params\":{\"_poolAddress\":\"The address of the pool used as oracle\",\"_usdDecimals\":\"The amount of decimals of the USD token paired with ETH\"}},\"setWorkExtraGas(uint256)\":{\"params\":{\"_workExtraGas\":\"The work extra gas\"}}},\"stateVariables\":{\"_USD_BASE_DECIMALS\":{\"details\":\"Amount of decimals in which USD is quoted within the contract\"},\"oracle\":{\"return\":\"_oracle The address of the observable pool for given liquidity\",\"returns\":{\"_0\":\"_oracle The address of the observable pool for given liquidity\"}},\"wethUSDPool\":{\"returns\":{\"isWETHToken0\":\"True if calling the token0 method of the pool returns the WETH token address\",\"poolAddress\":\"Address of the pool\",\"usdDecimals\":\"The amount of decimals of the USD token paired with ETH\"}}},\"version\":1},\"userdoc\":{\"errors\":{\"InvalidAddress()\":[{\"notice\":\"Thrown if an address is invalid\"}],\"InvalidAmount()\":[{\"notice\":\"Thrown if an amount is invalid\"}],\"InvalidOraclePool()\":[{\"notice\":\"Throws when pool does not have KP3R as token0 nor token1\"}],\"LengthMismatch()\":[{\"notice\":\"Thrown if the lengths of a set of lists mismatch\"}],\"LiquidityPairInvalid()\":[{\"notice\":\"Throws when none of the tokens in the liquidity pair is KP3R\"}],\"OnlyGovernor()\":[{\"notice\":\"Thrown if a non-governor user tries to call a OnlyGovernor function\"}],\"OnlyPendingGovernor()\":[{\"notice\":\"Thrown if a non-pending-governor user tries to call a OnlyPendingGovernor function\"}],\"ZeroAddress()\":[{\"notice\":\"Thrown if an address is the zero address\"}],\"ZeroAmount()\":[{\"notice\":\"Thrown if an amount is zero\"}]},\"events\":{\"Keep3rV2Change(address)\":{\"notice\":\"Emitted when the Keep3r V2 address is changed\"},\"Kp3rWethPoolChange(address,bool)\":{\"notice\":\"Emitted when the kp3r weth pool is changed\"},\"MaxBoostChange(uint256)\":{\"notice\":\"Emitted when the maximum boost multiplier is changed\"},\"MinBaseFeeChange(uint256)\":{\"notice\":\"Emitted when minimum rewarded gas fee is changed\"},\"MinBoostChange(uint256)\":{\"notice\":\"Emitted when the minimum boost multiplier is changed\"},\"MinPriorityFeeChange(uint256)\":{\"notice\":\"Emitted when minimum rewarded priority fee is changed\"},\"OracleSet(address,address)\":{\"notice\":\"The oracle for a liquidity has been saved\"},\"PendingGovernorAccepted(address)\":{\"notice\":\"Emitted when a new governor is set\"},\"PendingGovernorSet(address,address)\":{\"notice\":\"Emitted when a new pending governor is set\"},\"QuoteTwapTimeChange(uint32)\":{\"notice\":\"Emitted when the quote twap time is changed\"},\"TargetBondChange(uint256)\":{\"notice\":\"Emitted when the target bond amount is changed\"},\"WethUSDPoolChange(address,bool,uint8)\":{\"notice\":\"Emitted when the WETH USD pool is changed\"},\"WorkExtraGasChange(uint256)\":{\"notice\":\"Emitted when the work extra gas amount is changed\"}},\"kind\":\"user\",\"methods\":{\"BOOST_BASE()\":{\"notice\":\"The boost base used to calculate the boost rewards for the keeper\"},\"KP3R()\":{\"notice\":\"Address of KP3R token\"},\"WETH()\":{\"notice\":\"Ethereum mainnet WETH address used for quoting references\"},\"acceptPendingGovernor()\":{\"notice\":\"Allows a proposed governor to accept the governance\"},\"bonds(address)\":{\"notice\":\"Uses valid wKP3R address from Keep3rSidechain to query keeper bonds\"},\"getKP3RsAtTick(uint256,int56,uint256)\":{\"notice\":\"Given a tick and a liquidity amount, calculates the underlying KP3R tokens\"},\"getPaymentParams(uint256)\":{\"notice\":\"Get multiplier, quote, and extra, in order to calculate keeper payment\"},\"getPoolTokens(address)\":{\"notice\":\"Given a pool address, returns the underlying tokens of the pair\"},\"getQuoteAtTick(uint128,int56,uint256)\":{\"notice\":\"Given a tick and a token amount, calculates the output in correspondant token\"},\"getRewardAmount(uint256)\":{\"notice\":\"Calculates the reward (in KP3R) that corresponds to tx.origin for using gas\"},\"getRewardAmountFor(address,uint256)\":{\"notice\":\"Calculates the reward (in KP3R) that corresponds to a keeper for using gas\"},\"getRewardBoostFor(uint256)\":{\"notice\":\"Calculates the boost in the reward given to a keeper based on the amount of KP3R that keeper has bonded\"},\"isKP3RToken0(address)\":{\"notice\":\"Defines the order of the tokens in the pair for twap calculations\"},\"keep3rV2()\":{\"notice\":\"Address of Keep3r V2\"},\"kp3rWethPool()\":{\"notice\":\"KP3R-WETH pool that is being used as oracle\"},\"maxBoost()\":{\"notice\":\"The maximum multiplier used to calculate the amount of gas paid to the Keeper for the gas used to perform a job For example: if the quoted gas used is 1000, then the maximum amount to be paid will be 1000 * maxBoost / BOOST_BASE\"},\"minBaseFee()\":{\"notice\":\"The minimum base fee that is used to calculate keeper rewards\"},\"minBoost()\":{\"notice\":\"The minimum multiplier used to calculate the amount of gas paid to the Keeper for the gas used to perform a job For example: if the quoted gas used is 1000, then the minimum amount to be paid will be 1000 * minBoost / BOOST_BASE\"},\"minPriorityFee()\":{\"notice\":\"The minimum priority fee that is also rewarded for keepers\"},\"observe(address,uint32[])\":{\"notice\":\"Given an array of secondsAgo, returns UniswapV3 pool cumulatives at that moment\"},\"quote(uint256)\":{\"notice\":\"Calculates the amount of KP3R that corresponds to the ETH passed into the function\"},\"quoteTwapTime()\":{\"notice\":\"The twap time for quoting\"},\"quoteUsdToEth(uint256)\":{\"notice\":\"Quotes USD to ETH\"},\"setKeep3rV2(address)\":{\"notice\":\"Sets the Keep3r V2 address\"},\"setKp3rWethPool(address)\":{\"notice\":\"Sets KP3R-WETH pool\"},\"setMaxBoost(uint256)\":{\"notice\":\"Sets the maximum boost multiplier\"},\"setMinBaseFee(uint256)\":{\"notice\":\"Sets the minimum rewarded gas fee\"},\"setMinBoost(uint256)\":{\"notice\":\"Sets the minimum boost multiplier\"},\"setMinPriorityFee(uint256)\":{\"notice\":\"Sets the minimum rewarded gas priority fee\"},\"setOracle(address,address)\":{\"notice\":\"Sets an oracle for a given liquidity\"},\"setPendingGovernor(address)\":{\"notice\":\"Allows a governor to propose a new governor\"},\"setQuoteTwapTime(uint32)\":{\"notice\":\"Sets the quote twap time\"},\"setTargetBond(uint256)\":{\"notice\":\"Sets the target bond amount\"},\"setWethUsdPool(address,uint8)\":{\"notice\":\"Sets an oracle for querying WETH/USD quote\"},\"setWorkExtraGas(uint256)\":{\"notice\":\"Sets the work extra gas amount\"},\"targetBond()\":{\"notice\":\"The targeted amount of bonded KP3Rs to max-up reward multiplier For example: if the amount of KP3R the keeper has bonded is targetBond or more, then the keeper will get the maximum boost possible in his rewards, if it's less, the reward boost will be proportional\"},\"wethUSDPool()\":{\"notice\":\"WETH-USD pool that is being used as oracle\"},\"workExtraGas()\":{\"notice\":\"The amount of unaccounted gas that is going to be added to keeper payments\"}},\"version\":1}},\"settings\":{\"compilationTarget\":{\"solidity/contracts/sidechain/Keep3rHelperSidechain.sol\":\"Keep3rHelperSidechain\"},\"evmVersion\":\"london\",\"libraries\":{\":__CACHE_BREAKER__\":\"0x00000000d41867734bbee4c6863d9255b2b06ac1\"},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":200},\"remappings\":[]},\"sources\":{\"@defi-wonderland/solidity-utils/solidity/contracts/Governable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.8 <0.9.0;\\n\\nimport {IGovernable} from '../interfaces/IGovernable.sol';\\n\\n/// @title Governable contract\\n/// @notice Manages the governor role\\nabstract contract Governable is IGovernable {\\n /// @inheritdoc IGovernable\\n address public governor;\\n\\n /// @inheritdoc IGovernable\\n address public pendingGovernor;\\n\\n constructor(address _governor) {\\n if (_governor == address(0)) revert ZeroAddress();\\n governor = _governor;\\n }\\n\\n /// @inheritdoc IGovernable\\n function setPendingGovernor(address _pendingGovernor) external onlyGovernor {\\n _setPendingGovernor(_pendingGovernor);\\n }\\n\\n /// @inheritdoc IGovernable\\n function acceptPendingGovernor() external onlyPendingGovernor {\\n _acceptPendingGovernor();\\n }\\n\\n function _setPendingGovernor(address _pendingGovernor) internal {\\n if (_pendingGovernor == address(0)) revert ZeroAddress();\\n pendingGovernor = _pendingGovernor;\\n emit PendingGovernorSet(governor, _pendingGovernor);\\n }\\n\\n function _acceptPendingGovernor() internal {\\n governor = pendingGovernor;\\n delete pendingGovernor;\\n emit PendingGovernorAccepted(governor);\\n }\\n\\n /// @notice Functions with this modifier can only be called by governor\\n modifier onlyGovernor() {\\n if (msg.sender != governor) revert OnlyGovernor();\\n _;\\n }\\n\\n /// @notice Functions with this modifier can only be called by pendingGovernor\\n modifier onlyPendingGovernor() {\\n if (msg.sender != pendingGovernor) revert OnlyPendingGovernor();\\n _;\\n }\\n}\\n\",\"keccak256\":\"0x3f11408cfcb015a99dc417e075c8ebc39b796fc2adc3e81b036487e4486881b3\",\"license\":\"MIT\"},\"@defi-wonderland/solidity-utils/solidity/interfaces/IBaseErrors.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.8 <0.9.0;\\n\\ninterface IBaseErrors {\\n /// @notice Thrown if an address is invalid\\n error InvalidAddress();\\n\\n /// @notice Thrown if an amount is invalid\\n error InvalidAmount();\\n\\n /// @notice Thrown if the lengths of a set of lists mismatch\\n error LengthMismatch();\\n\\n /// @notice Thrown if an address is the zero address\\n error ZeroAddress();\\n\\n /// @notice Thrown if an amount is zero\\n error ZeroAmount();\\n}\\n\",\"keccak256\":\"0xec09b9d248b6fbf6343dee41d6978abdc15d4c8df5ed7721e8df79e8b1a558cf\",\"license\":\"MIT\"},\"@defi-wonderland/solidity-utils/solidity/interfaces/IDustCollector.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.8 <0.9.0;\\n\\nimport {IGovernable} from './IGovernable.sol';\\nimport {IBaseErrors} from './IBaseErrors.sol';\\n\\n/// @title DustCollector interface\\ninterface IDustCollector is IBaseErrors, IGovernable {\\n // STATE VARIABLES\\n\\n /// @return _ethAddress Address used to trigger a native token transfer\\n // solhint-disable-next-line func-name-mixedcase\\n function ETH_ADDRESS() external view returns (address _ethAddress);\\n\\n // EVENTS\\n\\n /// @notice Emitted when dust is sent\\n /// @param _to The address which wil received the funds\\n /// @param _token The token that will be transferred\\n /// @param _amount The amount of the token that will be transferred\\n event DustSent(address _token, uint256 _amount, address _to);\\n\\n // FUNCTIONS\\n\\n /// @notice Allows an authorized user to transfer the tokens or eth that may have been left in a contract\\n /// @param _token The token that will be transferred\\n /// @param _amount The amont of the token that will be transferred\\n /// @param _to The address that will receive the idle funds\\n function sendDust(address _token, uint256 _amount, address _to) external;\\n}\\n\",\"keccak256\":\"0xbe22cc660bd6846093504989146038bd369f511325cef40cdc647fe7e04206b1\",\"license\":\"MIT\"},\"@defi-wonderland/solidity-utils/solidity/interfaces/IGovernable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.8 <0.9.0;\\n\\nimport {IBaseErrors} from './IBaseErrors.sol';\\n\\n/// @title Governable interface\\ninterface IGovernable is IBaseErrors {\\n // STATE VARIABLES\\n\\n /// @return _governor Address of the current governor\\n function governor() external view returns (address _governor);\\n\\n /// @return _pendingGovernor Address of the current pending governor\\n function pendingGovernor() external view returns (address _pendingGovernor);\\n\\n // EVENTS\\n\\n /// @notice Emitted when a new pending governor is set\\n /// @param _governor Address of the current governor\\n /// @param _pendingGovernor Address of the proposed next governor\\n event PendingGovernorSet(address _governor, address _pendingGovernor);\\n\\n /// @notice Emitted when a new governor is set\\n /// @param _newGovernor Address of the new governor\\n event PendingGovernorAccepted(address _newGovernor);\\n\\n // ERRORS\\n\\n /// @notice Thrown if a non-governor user tries to call a OnlyGovernor function\\n error OnlyGovernor();\\n\\n /// @notice Thrown if a non-pending-governor user tries to call a OnlyPendingGovernor function\\n error OnlyPendingGovernor();\\n\\n // FUNCTIONS\\n\\n /// @notice Allows a governor to propose a new governor\\n /// @param _pendingGovernor Address of the proposed new governor\\n function setPendingGovernor(address _pendingGovernor) external;\\n\\n /// @notice Allows a proposed governor to accept the governance\\n function acceptPendingGovernor() external;\\n}\\n\",\"keccak256\":\"0x40b94706a00d2c092f620807ba84bdd0c5ed8cfa60140c924edc850427e0af13\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC20/IERC20.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Interface of the ERC20 standard as defined in the EIP.\\n */\\ninterface IERC20 {\\n /**\\n * @dev Returns the amount of tokens in existence.\\n */\\n function totalSupply() external view returns (uint256);\\n\\n /**\\n * @dev Returns the amount of tokens owned by `account`.\\n */\\n function balanceOf(address account) external view returns (uint256);\\n\\n /**\\n * @dev Moves `amount` tokens from the caller's account to `recipient`.\\n *\\n * Returns a boolean value indicating whether the operation succeeded.\\n *\\n * Emits a {Transfer} event.\\n */\\n function transfer(address recipient, uint256 amount) external returns (bool);\\n\\n /**\\n * @dev Returns the remaining number of tokens that `spender` will be\\n * allowed to spend on behalf of `owner` through {transferFrom}. This is\\n * zero by default.\\n *\\n * This value changes when {approve} or {transferFrom} are called.\\n */\\n function allowance(address owner, address spender) external view returns (uint256);\\n\\n /**\\n * @dev Sets `amount` as the allowance of `spender` over the caller's tokens.\\n *\\n * Returns a boolean value indicating whether the operation succeeded.\\n *\\n * IMPORTANT: Beware that changing an allowance with this method brings the risk\\n * that someone may use both the old and the new allowance by unfortunate\\n * transaction ordering. One possible solution to mitigate this race\\n * condition is to first reduce the spender's allowance to 0 and set the\\n * desired value afterwards:\\n * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729\\n *\\n * Emits an {Approval} event.\\n */\\n function approve(address spender, uint256 amount) external returns (bool);\\n\\n /**\\n * @dev Moves `amount` tokens from `sender` to `recipient` using the\\n * allowance mechanism. `amount` is then deducted from the caller's\\n * allowance.\\n *\\n * Returns a boolean value indicating whether the operation succeeded.\\n *\\n * Emits a {Transfer} event.\\n */\\n function transferFrom(\\n address sender,\\n address recipient,\\n uint256 amount\\n ) external returns (bool);\\n\\n /**\\n * @dev Emitted when `value` tokens are moved from one account (`from`) to\\n * another (`to`).\\n *\\n * Note that `value` may be zero.\\n */\\n event Transfer(address indexed from, address indexed to, uint256 value);\\n\\n /**\\n * @dev Emitted when the allowance of a `spender` for an `owner` is set by\\n * a call to {approve}. `value` is the new allowance.\\n */\\n event Approval(address indexed owner, address indexed spender, uint256 value);\\n}\\n\",\"keccak256\":\"0x027b891937d20ccf213fdb9c31531574256de774bda99d3a70ecef6e1913ed2a\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../IERC20.sol\\\";\\n\\n/**\\n * @dev Interface for the optional metadata functions from the ERC20 standard.\\n *\\n * _Available since v4.1._\\n */\\ninterface IERC20Metadata is IERC20 {\\n /**\\n * @dev Returns the name of the token.\\n */\\n function name() external view returns (string memory);\\n\\n /**\\n * @dev Returns the symbol of the token.\\n */\\n function symbol() external view returns (string memory);\\n\\n /**\\n * @dev Returns the decimals places of the token.\\n */\\n function decimals() external view returns (uint8);\\n}\\n\",\"keccak256\":\"0x83fe24f5c04a56091e50f4a345ff504c8bff658a76d4c43b16878c8f940c53b2\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/math/Math.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Standard math utilities missing in the Solidity language.\\n */\\nlibrary Math {\\n /**\\n * @dev Returns the largest of two numbers.\\n */\\n function max(uint256 a, uint256 b) internal pure returns (uint256) {\\n return a >= b ? a : b;\\n }\\n\\n /**\\n * @dev Returns the smallest of two numbers.\\n */\\n function min(uint256 a, uint256 b) internal pure returns (uint256) {\\n return a < b ? a : b;\\n }\\n\\n /**\\n * @dev Returns the average of two numbers. The result is rounded towards\\n * zero.\\n */\\n function average(uint256 a, uint256 b) internal pure returns (uint256) {\\n // (a + b) / 2 can overflow.\\n return (a & b) + (a ^ b) / 2;\\n }\\n\\n /**\\n * @dev Returns the ceiling of the division of two numbers.\\n *\\n * This differs from standard division with `/` in that it rounds up instead\\n * of rounding down.\\n */\\n function ceilDiv(uint256 a, uint256 b) internal pure returns (uint256) {\\n // (a + b - 1) / b can overflow on addition, so we distribute.\\n return a / b + (a % b == 0 ? 0 : 1);\\n }\\n}\\n\",\"keccak256\":\"0x49ebdac5d515aebb95168564158940b79d7d5d12fbfe59cec546a00d57fee64a\",\"license\":\"MIT\"},\"@uniswap/v3-core/contracts/interfaces/IUniswapV3Pool.sol\":{\"content\":\"// SPDX-License-Identifier: GPL-2.0-or-later\\npragma solidity >=0.5.0;\\n\\nimport './pool/IUniswapV3PoolImmutables.sol';\\nimport './pool/IUniswapV3PoolState.sol';\\nimport './pool/IUniswapV3PoolDerivedState.sol';\\nimport './pool/IUniswapV3PoolActions.sol';\\nimport './pool/IUniswapV3PoolOwnerActions.sol';\\nimport './pool/IUniswapV3PoolEvents.sol';\\n\\n/// @title The interface for a Uniswap V3 Pool\\n/// @notice A Uniswap pool facilitates swapping and automated market making between any two assets that strictly conform\\n/// to the ERC20 specification\\n/// @dev The pool interface is broken up into many smaller pieces\\ninterface IUniswapV3Pool is\\n IUniswapV3PoolImmutables,\\n IUniswapV3PoolState,\\n IUniswapV3PoolDerivedState,\\n IUniswapV3PoolActions,\\n IUniswapV3PoolOwnerActions,\\n IUniswapV3PoolEvents\\n{\\n\\n}\\n\",\"keccak256\":\"0xfe6113d518466cd6652c85b111e01f33eb62157f49ae5ed7d5a3947a2044adb1\",\"license\":\"GPL-2.0-or-later\"},\"@uniswap/v3-core/contracts/interfaces/pool/IUniswapV3PoolActions.sol\":{\"content\":\"// SPDX-License-Identifier: GPL-2.0-or-later\\npragma solidity >=0.5.0;\\n\\n/// @title Permissionless pool actions\\n/// @notice Contains pool methods that can be called by anyone\\ninterface IUniswapV3PoolActions {\\n /// @notice Sets the initial price for the pool\\n /// @dev Price is represented as a sqrt(amountToken1/amountToken0) Q64.96 value\\n /// @param sqrtPriceX96 the initial sqrt price of the pool as a Q64.96\\n function initialize(uint160 sqrtPriceX96) external;\\n\\n /// @notice Adds liquidity for the given recipient/tickLower/tickUpper position\\n /// @dev The caller of this method receives a callback in the form of IUniswapV3MintCallback#uniswapV3MintCallback\\n /// in which they must pay any token0 or token1 owed for the liquidity. The amount of token0/token1 due depends\\n /// on tickLower, tickUpper, the amount of liquidity, and the current price.\\n /// @param recipient The address for which the liquidity will be created\\n /// @param tickLower The lower tick of the position in which to add liquidity\\n /// @param tickUpper The upper tick of the position in which to add liquidity\\n /// @param amount The amount of liquidity to mint\\n /// @param data Any data that should be passed through to the callback\\n /// @return amount0 The amount of token0 that was paid to mint the given amount of liquidity. Matches the value in the callback\\n /// @return amount1 The amount of token1 that was paid to mint the given amount of liquidity. Matches the value in the callback\\n function mint(\\n address recipient,\\n int24 tickLower,\\n int24 tickUpper,\\n uint128 amount,\\n bytes calldata data\\n ) external returns (uint256 amount0, uint256 amount1);\\n\\n /// @notice Collects tokens owed to a position\\n /// @dev Does not recompute fees earned, which must be done either via mint or burn of any amount of liquidity.\\n /// Collect must be called by the position owner. To withdraw only token0 or only token1, amount0Requested or\\n /// amount1Requested may be set to zero. To withdraw all tokens owed, caller may pass any value greater than the\\n /// actual tokens owed, e.g. type(uint128).max. Tokens owed may be from accumulated swap fees or burned liquidity.\\n /// @param recipient The address which should receive the fees collected\\n /// @param tickLower The lower tick of the position for which to collect fees\\n /// @param tickUpper The upper tick of the position for which to collect fees\\n /// @param amount0Requested How much token0 should be withdrawn from the fees owed\\n /// @param amount1Requested How much token1 should be withdrawn from the fees owed\\n /// @return amount0 The amount of fees collected in token0\\n /// @return amount1 The amount of fees collected in token1\\n function collect(\\n address recipient,\\n int24 tickLower,\\n int24 tickUpper,\\n uint128 amount0Requested,\\n uint128 amount1Requested\\n ) external returns (uint128 amount0, uint128 amount1);\\n\\n /// @notice Burn liquidity from the sender and account tokens owed for the liquidity to the position\\n /// @dev Can be used to trigger a recalculation of fees owed to a position by calling with an amount of 0\\n /// @dev Fees must be collected separately via a call to #collect\\n /// @param tickLower The lower tick of the position for which to burn liquidity\\n /// @param tickUpper The upper tick of the position for which to burn liquidity\\n /// @param amount How much liquidity to burn\\n /// @return amount0 The amount of token0 sent to the recipient\\n /// @return amount1 The amount of token1 sent to the recipient\\n function burn(\\n int24 tickLower,\\n int24 tickUpper,\\n uint128 amount\\n ) external returns (uint256 amount0, uint256 amount1);\\n\\n /// @notice Swap token0 for token1, or token1 for token0\\n /// @dev The caller of this method receives a callback in the form of IUniswapV3SwapCallback#uniswapV3SwapCallback\\n /// @param recipient The address to receive the output of the swap\\n /// @param zeroForOne The direction of the swap, true for token0 to token1, false for token1 to token0\\n /// @param amountSpecified The amount of the swap, which implicitly configures the swap as exact input (positive), or exact output (negative)\\n /// @param sqrtPriceLimitX96 The Q64.96 sqrt price limit. If zero for one, the price cannot be less than this\\n /// value after the swap. If one for zero, the price cannot be greater than this value after the swap\\n /// @param data Any data to be passed through to the callback\\n /// @return amount0 The delta of the balance of token0 of the pool, exact when negative, minimum when positive\\n /// @return amount1 The delta of the balance of token1 of the pool, exact when negative, minimum when positive\\n function swap(\\n address recipient,\\n bool zeroForOne,\\n int256 amountSpecified,\\n uint160 sqrtPriceLimitX96,\\n bytes calldata data\\n ) external returns (int256 amount0, int256 amount1);\\n\\n /// @notice Receive token0 and/or token1 and pay it back, plus a fee, in the callback\\n /// @dev The caller of this method receives a callback in the form of IUniswapV3FlashCallback#uniswapV3FlashCallback\\n /// @dev Can be used to donate underlying tokens pro-rata to currently in-range liquidity providers by calling\\n /// with 0 amount{0,1} and sending the donation amount(s) from the callback\\n /// @param recipient The address which will receive the token0 and token1 amounts\\n /// @param amount0 The amount of token0 to send\\n /// @param amount1 The amount of token1 to send\\n /// @param data Any data to be passed through to the callback\\n function flash(\\n address recipient,\\n uint256 amount0,\\n uint256 amount1,\\n bytes calldata data\\n ) external;\\n\\n /// @notice Increase the maximum number of price and liquidity observations that this pool will store\\n /// @dev This method is no-op if the pool already has an observationCardinalityNext greater than or equal to\\n /// the input observationCardinalityNext.\\n /// @param observationCardinalityNext The desired minimum number of observations for the pool to store\\n function increaseObservationCardinalityNext(uint16 observationCardinalityNext) external;\\n}\\n\",\"keccak256\":\"0x9453dd0e7442188667d01d9b65de3f1e14e9511ff3e303179a15f6fc267f7634\",\"license\":\"GPL-2.0-or-later\"},\"@uniswap/v3-core/contracts/interfaces/pool/IUniswapV3PoolDerivedState.sol\":{\"content\":\"// SPDX-License-Identifier: GPL-2.0-or-later\\npragma solidity >=0.5.0;\\n\\n/// @title Pool state that is not stored\\n/// @notice Contains view functions to provide information about the pool that is computed rather than stored on the\\n/// blockchain. The functions here may have variable gas costs.\\ninterface IUniswapV3PoolDerivedState {\\n /// @notice Returns the cumulative tick and liquidity as of each timestamp `secondsAgo` from the current block timestamp\\n /// @dev To get a time weighted average tick or liquidity-in-range, you must call this with two values, one representing\\n /// the beginning of the period and another for the end of the period. E.g., to get the last hour time-weighted average tick,\\n /// you must call it with secondsAgos = [3600, 0].\\n /// @dev The time weighted average tick represents the geometric time weighted average price of the pool, in\\n /// log base sqrt(1.0001) of token1 / token0. The TickMath library can be used to go from a tick value to a ratio.\\n /// @param secondsAgos From how long ago each cumulative tick and liquidity value should be returned\\n /// @return tickCumulatives Cumulative tick values as of each `secondsAgos` from the current block timestamp\\n /// @return secondsPerLiquidityCumulativeX128s Cumulative seconds per liquidity-in-range value as of each `secondsAgos` from the current block\\n /// timestamp\\n function observe(uint32[] calldata secondsAgos)\\n external\\n view\\n returns (int56[] memory tickCumulatives, uint160[] memory secondsPerLiquidityCumulativeX128s);\\n\\n /// @notice Returns a snapshot of the tick cumulative, seconds per liquidity and seconds inside a tick range\\n /// @dev Snapshots must only be compared to other snapshots, taken over a period for which a position existed.\\n /// I.e., snapshots cannot be compared if a position is not held for the entire period between when the first\\n /// snapshot is taken and the second snapshot is taken.\\n /// @param tickLower The lower tick of the range\\n /// @param tickUpper The upper tick of the range\\n /// @return tickCumulativeInside The snapshot of the tick accumulator for the range\\n /// @return secondsPerLiquidityInsideX128 The snapshot of seconds per liquidity for the range\\n /// @return secondsInside The snapshot of seconds per liquidity for the range\\n function snapshotCumulativesInside(int24 tickLower, int24 tickUpper)\\n external\\n view\\n returns (\\n int56 tickCumulativeInside,\\n uint160 secondsPerLiquidityInsideX128,\\n uint32 secondsInside\\n );\\n}\\n\",\"keccak256\":\"0xe603ac5b17ecdee73ba2b27efdf386c257a19c14206e87eee77e2017b742d9e5\",\"license\":\"GPL-2.0-or-later\"},\"@uniswap/v3-core/contracts/interfaces/pool/IUniswapV3PoolEvents.sol\":{\"content\":\"// SPDX-License-Identifier: GPL-2.0-or-later\\npragma solidity >=0.5.0;\\n\\n/// @title Events emitted by a pool\\n/// @notice Contains all events emitted by the pool\\ninterface IUniswapV3PoolEvents {\\n /// @notice Emitted exactly once by a pool when #initialize is first called on the pool\\n /// @dev Mint/Burn/Swap cannot be emitted by the pool before Initialize\\n /// @param sqrtPriceX96 The initial sqrt price of the pool, as a Q64.96\\n /// @param tick The initial tick of the pool, i.e. log base 1.0001 of the starting price of the pool\\n event Initialize(uint160 sqrtPriceX96, int24 tick);\\n\\n /// @notice Emitted when liquidity is minted for a given position\\n /// @param sender The address that minted the liquidity\\n /// @param owner The owner of the position and recipient of any minted liquidity\\n /// @param tickLower The lower tick of the position\\n /// @param tickUpper The upper tick of the position\\n /// @param amount The amount of liquidity minted to the position range\\n /// @param amount0 How much token0 was required for the minted liquidity\\n /// @param amount1 How much token1 was required for the minted liquidity\\n event Mint(\\n address sender,\\n address indexed owner,\\n int24 indexed tickLower,\\n int24 indexed tickUpper,\\n uint128 amount,\\n uint256 amount0,\\n uint256 amount1\\n );\\n\\n /// @notice Emitted when fees are collected by the owner of a position\\n /// @dev Collect events may be emitted with zero amount0 and amount1 when the caller chooses not to collect fees\\n /// @param owner The owner of the position for which fees are collected\\n /// @param tickLower The lower tick of the position\\n /// @param tickUpper The upper tick of the position\\n /// @param amount0 The amount of token0 fees collected\\n /// @param amount1 The amount of token1 fees collected\\n event Collect(\\n address indexed owner,\\n address recipient,\\n int24 indexed tickLower,\\n int24 indexed tickUpper,\\n uint128 amount0,\\n uint128 amount1\\n );\\n\\n /// @notice Emitted when a position's liquidity is removed\\n /// @dev Does not withdraw any fees earned by the liquidity position, which must be withdrawn via #collect\\n /// @param owner The owner of the position for which liquidity is removed\\n /// @param tickLower The lower tick of the position\\n /// @param tickUpper The upper tick of the position\\n /// @param amount The amount of liquidity to remove\\n /// @param amount0 The amount of token0 withdrawn\\n /// @param amount1 The amount of token1 withdrawn\\n event Burn(\\n address indexed owner,\\n int24 indexed tickLower,\\n int24 indexed tickUpper,\\n uint128 amount,\\n uint256 amount0,\\n uint256 amount1\\n );\\n\\n /// @notice Emitted by the pool for any swaps between token0 and token1\\n /// @param sender The address that initiated the swap call, and that received the callback\\n /// @param recipient The address that received the output of the swap\\n /// @param amount0 The delta of the token0 balance of the pool\\n /// @param amount1 The delta of the token1 balance of the pool\\n /// @param sqrtPriceX96 The sqrt(price) of the pool after the swap, as a Q64.96\\n /// @param liquidity The liquidity of the pool after the swap\\n /// @param tick The log base 1.0001 of price of the pool after the swap\\n event Swap(\\n address indexed sender,\\n address indexed recipient,\\n int256 amount0,\\n int256 amount1,\\n uint160 sqrtPriceX96,\\n uint128 liquidity,\\n int24 tick\\n );\\n\\n /// @notice Emitted by the pool for any flashes of token0/token1\\n /// @param sender The address that initiated the swap call, and that received the callback\\n /// @param recipient The address that received the tokens from flash\\n /// @param amount0 The amount of token0 that was flashed\\n /// @param amount1 The amount of token1 that was flashed\\n /// @param paid0 The amount of token0 paid for the flash, which can exceed the amount0 plus the fee\\n /// @param paid1 The amount of token1 paid for the flash, which can exceed the amount1 plus the fee\\n event Flash(\\n address indexed sender,\\n address indexed recipient,\\n uint256 amount0,\\n uint256 amount1,\\n uint256 paid0,\\n uint256 paid1\\n );\\n\\n /// @notice Emitted by the pool for increases to the number of observations that can be stored\\n /// @dev observationCardinalityNext is not the observation cardinality until an observation is written at the index\\n /// just before a mint/swap/burn.\\n /// @param observationCardinalityNextOld The previous value of the next observation cardinality\\n /// @param observationCardinalityNextNew The updated value of the next observation cardinality\\n event IncreaseObservationCardinalityNext(\\n uint16 observationCardinalityNextOld,\\n uint16 observationCardinalityNextNew\\n );\\n\\n /// @notice Emitted when the protocol fee is changed by the pool\\n /// @param feeProtocol0Old The previous value of the token0 protocol fee\\n /// @param feeProtocol1Old The previous value of the token1 protocol fee\\n /// @param feeProtocol0New The updated value of the token0 protocol fee\\n /// @param feeProtocol1New The updated value of the token1 protocol fee\\n event SetFeeProtocol(uint8 feeProtocol0Old, uint8 feeProtocol1Old, uint8 feeProtocol0New, uint8 feeProtocol1New);\\n\\n /// @notice Emitted when the collected protocol fees are withdrawn by the factory owner\\n /// @param sender The address that collects the protocol fees\\n /// @param recipient The address that receives the collected protocol fees\\n /// @param amount0 The amount of token0 protocol fees that is withdrawn\\n /// @param amount0 The amount of token1 protocol fees that is withdrawn\\n event CollectProtocol(address indexed sender, address indexed recipient, uint128 amount0, uint128 amount1);\\n}\\n\",\"keccak256\":\"0x8071514d0fe5d17d6fbd31c191cdfb703031c24e0ece3621d88ab10e871375cd\",\"license\":\"GPL-2.0-or-later\"},\"@uniswap/v3-core/contracts/interfaces/pool/IUniswapV3PoolImmutables.sol\":{\"content\":\"// SPDX-License-Identifier: GPL-2.0-or-later\\npragma solidity >=0.5.0;\\n\\n/// @title Pool state that never changes\\n/// @notice These parameters are fixed for a pool forever, i.e., the methods will always return the same values\\ninterface IUniswapV3PoolImmutables {\\n /// @notice The contract that deployed the pool, which must adhere to the IUniswapV3Factory interface\\n /// @return The contract address\\n function factory() external view returns (address);\\n\\n /// @notice The first of the two tokens of the pool, sorted by address\\n /// @return The token contract address\\n function token0() external view returns (address);\\n\\n /// @notice The second of the two tokens of the pool, sorted by address\\n /// @return The token contract address\\n function token1() external view returns (address);\\n\\n /// @notice The pool's fee in hundredths of a bip, i.e. 1e-6\\n /// @return The fee\\n function fee() external view returns (uint24);\\n\\n /// @notice The pool tick spacing\\n /// @dev Ticks can only be used at multiples of this value, minimum of 1 and always positive\\n /// e.g.: a tickSpacing of 3 means ticks can be initialized every 3rd tick, i.e., ..., -6, -3, 0, 3, 6, ...\\n /// This value is an int24 to avoid casting even though it is always positive.\\n /// @return The tick spacing\\n function tickSpacing() external view returns (int24);\\n\\n /// @notice The maximum amount of position liquidity that can use any tick in the range\\n /// @dev This parameter is enforced per tick to prevent liquidity from overflowing a uint128 at any point, and\\n /// also prevents out-of-range liquidity from being used to prevent adding in-range liquidity to a pool\\n /// @return The max amount of liquidity per tick\\n function maxLiquidityPerTick() external view returns (uint128);\\n}\\n\",\"keccak256\":\"0xf6e5d2cd1139c4c276bdbc8e1d2b256e456c866a91f1b868da265c6d2685c3f7\",\"license\":\"GPL-2.0-or-later\"},\"@uniswap/v3-core/contracts/interfaces/pool/IUniswapV3PoolOwnerActions.sol\":{\"content\":\"// SPDX-License-Identifier: GPL-2.0-or-later\\npragma solidity >=0.5.0;\\n\\n/// @title Permissioned pool actions\\n/// @notice Contains pool methods that may only be called by the factory owner\\ninterface IUniswapV3PoolOwnerActions {\\n /// @notice Set the denominator of the protocol's % share of the fees\\n /// @param feeProtocol0 new protocol fee for token0 of the pool\\n /// @param feeProtocol1 new protocol fee for token1 of the pool\\n function setFeeProtocol(uint8 feeProtocol0, uint8 feeProtocol1) external;\\n\\n /// @notice Collect the protocol fee accrued to the pool\\n /// @param recipient The address to which collected protocol fees should be sent\\n /// @param amount0Requested The maximum amount of token0 to send, can be 0 to collect fees in only token1\\n /// @param amount1Requested The maximum amount of token1 to send, can be 0 to collect fees in only token0\\n /// @return amount0 The protocol fee collected in token0\\n /// @return amount1 The protocol fee collected in token1\\n function collectProtocol(\\n address recipient,\\n uint128 amount0Requested,\\n uint128 amount1Requested\\n ) external returns (uint128 amount0, uint128 amount1);\\n}\\n\",\"keccak256\":\"0x759b78a2918af9e99e246dc3af084f654e48ef32bb4e4cb8a966aa3dcaece235\",\"license\":\"GPL-2.0-or-later\"},\"@uniswap/v3-core/contracts/interfaces/pool/IUniswapV3PoolState.sol\":{\"content\":\"// SPDX-License-Identifier: GPL-2.0-or-later\\npragma solidity >=0.5.0;\\n\\n/// @title Pool state that can change\\n/// @notice These methods compose the pool's state, and can change with any frequency including multiple times\\n/// per transaction\\ninterface IUniswapV3PoolState {\\n /// @notice The 0th storage slot in the pool stores many values, and is exposed as a single method to save gas\\n /// when accessed externally.\\n /// @return sqrtPriceX96 The current price of the pool as a sqrt(token1/token0) Q64.96 value\\n /// tick The current tick of the pool, i.e. according to the last tick transition that was run.\\n /// This value may not always be equal to SqrtTickMath.getTickAtSqrtRatio(sqrtPriceX96) if the price is on a tick\\n /// boundary.\\n /// observationIndex The index of the last oracle observation that was written,\\n /// observationCardinality The current maximum number of observations stored in the pool,\\n /// observationCardinalityNext The next maximum number of observations, to be updated when the observation.\\n /// feeProtocol The protocol fee for both tokens of the pool.\\n /// Encoded as two 4 bit values, where the protocol fee of token1 is shifted 4 bits and the protocol fee of token0\\n /// is the lower 4 bits. Used as the denominator of a fraction of the swap fee, e.g. 4 means 1/4th of the swap fee.\\n /// unlocked Whether the pool is currently locked to reentrancy\\n function slot0()\\n external\\n view\\n returns (\\n uint160 sqrtPriceX96,\\n int24 tick,\\n uint16 observationIndex,\\n uint16 observationCardinality,\\n uint16 observationCardinalityNext,\\n uint8 feeProtocol,\\n bool unlocked\\n );\\n\\n /// @notice The fee growth as a Q128.128 fees of token0 collected per unit of liquidity for the entire life of the pool\\n /// @dev This value can overflow the uint256\\n function feeGrowthGlobal0X128() external view returns (uint256);\\n\\n /// @notice The fee growth as a Q128.128 fees of token1 collected per unit of liquidity for the entire life of the pool\\n /// @dev This value can overflow the uint256\\n function feeGrowthGlobal1X128() external view returns (uint256);\\n\\n /// @notice The amounts of token0 and token1 that are owed to the protocol\\n /// @dev Protocol fees will never exceed uint128 max in either token\\n function protocolFees() external view returns (uint128 token0, uint128 token1);\\n\\n /// @notice The currently in range liquidity available to the pool\\n /// @dev This value has no relationship to the total liquidity across all ticks\\n function liquidity() external view returns (uint128);\\n\\n /// @notice Look up information about a specific tick in the pool\\n /// @param tick The tick to look up\\n /// @return liquidityGross the total amount of position liquidity that uses the pool either as tick lower or\\n /// tick upper,\\n /// liquidityNet how much liquidity changes when the pool price crosses the tick,\\n /// feeGrowthOutside0X128 the fee growth on the other side of the tick from the current tick in token0,\\n /// feeGrowthOutside1X128 the fee growth on the other side of the tick from the current tick in token1,\\n /// tickCumulativeOutside the cumulative tick value on the other side of the tick from the current tick\\n /// secondsPerLiquidityOutsideX128 the seconds spent per liquidity on the other side of the tick from the current tick,\\n /// secondsOutside the seconds spent on the other side of the tick from the current tick,\\n /// initialized Set to true if the tick is initialized, i.e. liquidityGross is greater than 0, otherwise equal to false.\\n /// Outside values can only be used if the tick is initialized, i.e. if liquidityGross is greater than 0.\\n /// In addition, these values are only relative and must be used only in comparison to previous snapshots for\\n /// a specific position.\\n function ticks(int24 tick)\\n external\\n view\\n returns (\\n uint128 liquidityGross,\\n int128 liquidityNet,\\n uint256 feeGrowthOutside0X128,\\n uint256 feeGrowthOutside1X128,\\n int56 tickCumulativeOutside,\\n uint160 secondsPerLiquidityOutsideX128,\\n uint32 secondsOutside,\\n bool initialized\\n );\\n\\n /// @notice Returns 256 packed tick initialized boolean values. See TickBitmap for more information\\n function tickBitmap(int16 wordPosition) external view returns (uint256);\\n\\n /// @notice Returns the information about a position by the position's key\\n /// @param key The position's key is a hash of a preimage composed by the owner, tickLower and tickUpper\\n /// @return _liquidity The amount of liquidity in the position,\\n /// Returns feeGrowthInside0LastX128 fee growth of token0 inside the tick range as of the last mint/burn/poke,\\n /// Returns feeGrowthInside1LastX128 fee growth of token1 inside the tick range as of the last mint/burn/poke,\\n /// Returns tokensOwed0 the computed amount of token0 owed to the position as of the last mint/burn/poke,\\n /// Returns tokensOwed1 the computed amount of token1 owed to the position as of the last mint/burn/poke\\n function positions(bytes32 key)\\n external\\n view\\n returns (\\n uint128 _liquidity,\\n uint256 feeGrowthInside0LastX128,\\n uint256 feeGrowthInside1LastX128,\\n uint128 tokensOwed0,\\n uint128 tokensOwed1\\n );\\n\\n /// @notice Returns data about a specific observation index\\n /// @param index The element of the observations array to fetch\\n /// @dev You most likely want to use #observe() instead of this method to get an observation as of some amount of time\\n /// ago, rather than at a specific index in the array.\\n /// @return blockTimestamp The timestamp of the observation,\\n /// Returns tickCumulative the tick multiplied by seconds elapsed for the life of the pool as of the observation timestamp,\\n /// Returns secondsPerLiquidityCumulativeX128 the seconds per in range liquidity for the life of the pool as of the observation timestamp,\\n /// Returns initialized whether the observation has been initialized and the values are safe to use\\n function observations(uint256 index)\\n external\\n view\\n returns (\\n uint32 blockTimestamp,\\n int56 tickCumulative,\\n uint160 secondsPerLiquidityCumulativeX128,\\n bool initialized\\n );\\n}\\n\",\"keccak256\":\"0x852dc1f5df7dcf7f11e7bb3eed79f0cea72ad4b25f6a9d2c35aafb48925fd49f\",\"license\":\"GPL-2.0-or-later\"},\"solidity/contracts/Keep3rHelper.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\n/*\\n\\nCoded for The Keep3r Network with \\u2665 by\\n\\n\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2557\\u2591\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2557\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2557\\u2588\\u2588\\u2557\\u2003\\u2003\\u2591\\u2588\\u2588\\u2557\\u2591\\u2591\\u2591\\u2591\\u2591\\u2591\\u2591\\u2588\\u2588\\u2557\\u2591\\u2588\\u2588\\u2588\\u2588\\u2588\\u2557\\u2591\\u2588\\u2588\\u2588\\u2557\\u2591\\u2591\\u2588\\u2588\\u2557\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2557\\u2591\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2557\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2557\\u2591\\u2588\\u2588\\u2557\\u2591\\u2591\\u2591\\u2591\\u2591\\u2591\\u2588\\u2588\\u2588\\u2588\\u2588\\u2557\\u2591\\u2588\\u2588\\u2588\\u2557\\u2591\\u2591\\u2588\\u2588\\u2557\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2557\\u2591\\n\\u2588\\u2588\\u2554\\u2550\\u2550\\u2588\\u2588\\u2557\\u2588\\u2588\\u2554\\u2550\\u2550\\u2550\\u2550\\u255d\\u2588\\u2588\\u2554\\u2550\\u2550\\u2550\\u2550\\u255d\\u2588\\u2588\\u2551\\u2003\\u2003\\u2591\\u2588\\u2588\\u2551\\u2591\\u2591\\u2588\\u2588\\u2557\\u2591\\u2591\\u2588\\u2588\\u2551\\u2588\\u2588\\u2554\\u2550\\u2550\\u2588\\u2588\\u2557\\u2588\\u2588\\u2588\\u2588\\u2557\\u2591\\u2588\\u2588\\u2551\\u2588\\u2588\\u2554\\u2550\\u2550\\u2588\\u2588\\u2557\\u2588\\u2588\\u2554\\u2550\\u2550\\u2550\\u2550\\u255d\\u2588\\u2588\\u2554\\u2550\\u2550\\u2588\\u2588\\u2557\\u2588\\u2588\\u2551\\u2591\\u2591\\u2591\\u2591\\u2591\\u2588\\u2588\\u2554\\u2550\\u2550\\u2588\\u2588\\u2557\\u2588\\u2588\\u2588\\u2588\\u2557\\u2591\\u2588\\u2588\\u2551\\u2588\\u2588\\u2554\\u2550\\u2550\\u2588\\u2588\\u2557\\n\\u2588\\u2588\\u2551\\u2591\\u2591\\u2588\\u2588\\u2551\\u2588\\u2588\\u2588\\u2588\\u2588\\u2557\\u2591\\u2591\\u2588\\u2588\\u2588\\u2588\\u2588\\u2557\\u2591\\u2591\\u2588\\u2588\\u2551\\u2003\\u2003\\u2591\\u255a\\u2588\\u2588\\u2557\\u2588\\u2588\\u2588\\u2588\\u2557\\u2588\\u2588\\u2554\\u255d\\u2588\\u2588\\u2551\\u2591\\u2591\\u2588\\u2588\\u2551\\u2588\\u2588\\u2554\\u2588\\u2588\\u2557\\u2588\\u2588\\u2551\\u2588\\u2588\\u2551\\u2591\\u2591\\u2588\\u2588\\u2551\\u2588\\u2588\\u2588\\u2588\\u2588\\u2557\\u2591\\u2591\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2554\\u255d\\u2588\\u2588\\u2551\\u2591\\u2591\\u2591\\u2591\\u2591\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2551\\u2588\\u2588\\u2554\\u2588\\u2588\\u2557\\u2588\\u2588\\u2551\\u2588\\u2588\\u2551\\u2591\\u2591\\u2588\\u2588\\u2551\\n\\u2588\\u2588\\u2551\\u2591\\u2591\\u2588\\u2588\\u2551\\u2588\\u2588\\u2554\\u2550\\u2550\\u255d\\u2591\\u2591\\u2588\\u2588\\u2554\\u2550\\u2550\\u255d\\u2591\\u2591\\u2588\\u2588\\u2551\\u2003\\u2003\\u2591\\u2591\\u2588\\u2588\\u2588\\u2588\\u2554\\u2550\\u2588\\u2588\\u2588\\u2588\\u2551\\u2591\\u2588\\u2588\\u2551\\u2591\\u2591\\u2588\\u2588\\u2551\\u2588\\u2588\\u2551\\u255a\\u2588\\u2588\\u2588\\u2588\\u2551\\u2588\\u2588\\u2551\\u2591\\u2591\\u2588\\u2588\\u2551\\u2588\\u2588\\u2554\\u2550\\u2550\\u255d\\u2591\\u2591\\u2588\\u2588\\u2554\\u2550\\u2550\\u2588\\u2588\\u2557\\u2588\\u2588\\u2551\\u2591\\u2591\\u2591\\u2591\\u2591\\u2588\\u2588\\u2554\\u2550\\u2550\\u2588\\u2588\\u2551\\u2588\\u2588\\u2551\\u255a\\u2588\\u2588\\u2588\\u2588\\u2551\\u2588\\u2588\\u2551\\u2591\\u2591\\u2588\\u2588\\u2551\\n\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2554\\u255d\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2557\\u2588\\u2588\\u2551\\u2591\\u2591\\u2591\\u2591\\u2591\\u2588\\u2588\\u2551\\u2003\\u2003\\u2591\\u2591\\u255a\\u2588\\u2588\\u2554\\u255d\\u2591\\u255a\\u2588\\u2588\\u2554\\u255d\\u2591\\u255a\\u2588\\u2588\\u2588\\u2588\\u2588\\u2554\\u255d\\u2588\\u2588\\u2551\\u2591\\u255a\\u2588\\u2588\\u2588\\u2551\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2554\\u255d\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2557\\u2588\\u2588\\u2551\\u2591\\u2591\\u2588\\u2588\\u2551\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2557\\u2588\\u2588\\u2551\\u2591\\u2591\\u2588\\u2588\\u2551\\u2588\\u2588\\u2551\\u2591\\u255a\\u2588\\u2588\\u2588\\u2551\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2554\\u255d\\n\\u255a\\u2550\\u2550\\u2550\\u2550\\u2550\\u255d\\u2591\\u255a\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u255d\\u255a\\u2550\\u255d\\u2591\\u2591\\u2591\\u2591\\u2591\\u255a\\u2550\\u255d\\u2003\\u2003\\u2591\\u2591\\u2591\\u255a\\u2550\\u255d\\u2591\\u2591\\u2591\\u255a\\u2550\\u255d\\u2591\\u2591\\u2591\\u255a\\u2550\\u2550\\u2550\\u2550\\u255d\\u2591\\u255a\\u2550\\u255d\\u2591\\u2591\\u255a\\u2550\\u2550\\u255d\\u255a\\u2550\\u2550\\u2550\\u2550\\u2550\\u255d\\u2591\\u255a\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u255d\\u255a\\u2550\\u255d\\u2591\\u2591\\u255a\\u2550\\u255d\\u255a\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u255d\\u255a\\u2550\\u255d\\u2591\\u2591\\u255a\\u2550\\u255d\\u255a\\u2550\\u255d\\u2591\\u2591\\u255a\\u2550\\u2550\\u255d\\u255a\\u2550\\u2550\\u2550\\u2550\\u2550\\u255d\\u2591\\n\\nhttps://defi.sucks\\n\\n*/\\n\\npragma solidity >=0.8.7 <0.9.0;\\n\\nimport './libraries/FullMath.sol';\\nimport './libraries/TickMath.sol';\\nimport '../interfaces/IKeep3r.sol';\\nimport '../interfaces/IKeep3rHelper.sol';\\nimport './Keep3rHelperParameters.sol';\\n\\nimport '@openzeppelin/contracts/utils/math/Math.sol';\\nimport '@uniswap/v3-core/contracts/interfaces/IUniswapV3Pool.sol';\\n\\ncontract Keep3rHelper is IKeep3rHelper, Keep3rHelperParameters {\\n constructor(\\n address _kp3r,\\n address _keep3rV2,\\n address _governor,\\n address _kp3rWethPool\\n ) Keep3rHelperParameters(_kp3r, _keep3rV2, _governor, _kp3rWethPool) {}\\n\\n /// @inheritdoc IKeep3rHelper\\n function quote(uint256 _eth) public view override returns (uint256 _amountOut) {\\n uint32[] memory _secondsAgos = new uint32[](2);\\n _secondsAgos[1] = quoteTwapTime;\\n\\n (int56[] memory _tickCumulatives, ) = IUniswapV3Pool(kp3rWethPool.poolAddress).observe(_secondsAgos);\\n int56 _difference = _tickCumulatives[0] - _tickCumulatives[1];\\n _amountOut = getQuoteAtTick(uint128(_eth), kp3rWethPool.isKP3RToken0 ? _difference : -_difference, quoteTwapTime);\\n }\\n\\n /// @inheritdoc IKeep3rHelper\\n function bonds(address _keeper) public view virtual override returns (uint256 _amountBonded) {\\n return IKeep3r(keep3rV2).bonds(_keeper, KP3R);\\n }\\n\\n /// @inheritdoc IKeep3rHelper\\n function getRewardAmountFor(address _keeper, uint256 _gasUsed) public view override returns (uint256 _kp3r) {\\n uint256 _boost = getRewardBoostFor(bonds(_keeper));\\n _kp3r = quote((_gasUsed * _boost) / BOOST_BASE);\\n }\\n\\n /// @inheritdoc IKeep3rHelper\\n function getRewardAmount(uint256 _gasUsed) external view override returns (uint256 _amount) {\\n // solhint-disable-next-line avoid-tx-origin\\n return getRewardAmountFor(tx.origin, _gasUsed);\\n }\\n\\n /// @inheritdoc IKeep3rHelper\\n function getRewardBoostFor(uint256 _bonds) public view override returns (uint256 _rewardBoost) {\\n _bonds = Math.min(_bonds, targetBond);\\n uint256 _cap = minBoost + ((maxBoost - minBoost) * _bonds) / targetBond;\\n _rewardBoost = _cap * _getBasefee();\\n }\\n\\n /// @inheritdoc IKeep3rHelper\\n function getPoolTokens(address _pool) public view override returns (address _token0, address _token1) {\\n return (IUniswapV3Pool(_pool).token0(), IUniswapV3Pool(_pool).token1());\\n }\\n\\n /// @inheritdoc IKeep3rHelper\\n function isKP3RToken0(address _pool) external view virtual override returns (bool _isKP3RToken0) {\\n address _token0;\\n address _token1;\\n (_token0, _token1) = getPoolTokens(_pool);\\n if (_token0 == KP3R) {\\n return true;\\n } else if (_token1 != KP3R) {\\n revert LiquidityPairInvalid();\\n }\\n }\\n\\n /// @inheritdoc IKeep3rHelper\\n function observe(address _pool, uint32[] memory _secondsAgo)\\n external\\n view\\n override\\n returns (\\n int56 _tickCumulative1,\\n int56 _tickCumulative2,\\n bool _success\\n )\\n {\\n try IUniswapV3Pool(_pool).observe(_secondsAgo) returns (int56[] memory _uniswapResponse, uint160[] memory) {\\n _tickCumulative1 = _uniswapResponse[0];\\n if (_uniswapResponse.length > 1) {\\n _tickCumulative2 = _uniswapResponse[1];\\n }\\n _success = true;\\n } catch (bytes memory) {}\\n }\\n\\n /// @inheritdoc IKeep3rHelper\\n function getPaymentParams(uint256 _bonds)\\n external\\n view\\n virtual\\n override\\n returns (\\n uint256 _boost,\\n uint256 _oneEthQuote,\\n uint256 _extra\\n )\\n {\\n _oneEthQuote = quote(1 ether);\\n _boost = getRewardBoostFor(_bonds);\\n _extra = workExtraGas;\\n }\\n\\n /// @inheritdoc IKeep3rHelper\\n function getKP3RsAtTick(\\n uint256 _liquidityAmount,\\n int56 _tickDifference,\\n uint256 _timeInterval\\n ) external pure override returns (uint256 _kp3rAmount) {\\n uint160 sqrtRatioX96 = TickMath.getSqrtRatioAtTick(int24(_tickDifference / int256(_timeInterval)));\\n _kp3rAmount = FullMath.mulDiv(1 << 96, _liquidityAmount, sqrtRatioX96);\\n }\\n\\n /// @inheritdoc IKeep3rHelper\\n function getQuoteAtTick(\\n uint128 _baseAmount,\\n int56 _tickDifference,\\n uint256 _timeInterval\\n ) public pure override returns (uint256 _quoteAmount) {\\n uint160 sqrtRatioX96 = TickMath.getSqrtRatioAtTick(int24(_tickDifference / int256(_timeInterval)));\\n\\n if (sqrtRatioX96 <= type(uint128).max) {\\n uint256 ratioX192 = uint256(sqrtRatioX96) * sqrtRatioX96;\\n _quoteAmount = FullMath.mulDiv(1 << 192, _baseAmount, ratioX192);\\n } else {\\n uint256 ratioX128 = FullMath.mulDiv(sqrtRatioX96, sqrtRatioX96, 1 << 64);\\n _quoteAmount = FullMath.mulDiv(1 << 128, _baseAmount, ratioX128);\\n }\\n }\\n\\n /// @notice Gets the gas basefee cost to calculate keeper rewards\\n /// @dev Keepers are required to pay a priority fee to be included, this function recognizes a minimum priority fee\\n /// @return _baseFee The block's basefee + a minimum priority fee, or a preset minimum gas fee\\n function _getBasefee() internal view virtual returns (uint256 _baseFee) {\\n return Math.max(minBaseFee, block.basefee + minPriorityFee);\\n }\\n}\\n\",\"keccak256\":\"0x442a723bdbd1011e26ef2b12fbca87788ee355221ad809f52e77a69a0b29e8cc\",\"license\":\"MIT\"},\"solidity/contracts/Keep3rHelperParameters.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.7 <0.9.0;\\n\\nimport './libraries/FullMath.sol';\\nimport './libraries/TickMath.sol';\\nimport '../interfaces/IKeep3r.sol';\\nimport '../interfaces/external/IKeep3rV1.sol';\\nimport '../interfaces/IKeep3rHelperParameters.sol';\\nimport './Keep3rHelperParameters.sol';\\n\\nimport '@openzeppelin/contracts/utils/math/Math.sol';\\nimport '@uniswap/v3-core/contracts/interfaces/IUniswapV3Pool.sol';\\nimport '@defi-wonderland/solidity-utils/solidity/interfaces/IBaseErrors.sol';\\nimport '@defi-wonderland/solidity-utils/solidity/contracts/Governable.sol';\\n\\ncontract Keep3rHelperParameters is IKeep3rHelperParameters, IBaseErrors, Governable {\\n /// @inheritdoc IKeep3rHelperParameters\\n address public immutable override KP3R;\\n\\n /// @inheritdoc IKeep3rHelperParameters\\n uint256 public constant override BOOST_BASE = 10_000;\\n\\n /// @inheritdoc IKeep3rHelperParameters\\n uint256 public override minBoost = 11_000;\\n\\n /// @inheritdoc IKeep3rHelperParameters\\n uint256 public override maxBoost = 12_000;\\n\\n /// @inheritdoc IKeep3rHelperParameters\\n uint256 public override targetBond = 200 ether;\\n\\n /// @inheritdoc IKeep3rHelperParameters\\n uint256 public override workExtraGas = 34_000;\\n\\n /// @inheritdoc IKeep3rHelperParameters\\n uint32 public override quoteTwapTime = 10 minutes;\\n\\n /// @inheritdoc IKeep3rHelperParameters\\n uint256 public override minBaseFee = 15e9;\\n\\n /// @inheritdoc IKeep3rHelperParameters\\n uint256 public override minPriorityFee = 2e9;\\n\\n /// @inheritdoc IKeep3rHelperParameters\\n address public override keep3rV2;\\n\\n /// @inheritdoc IKeep3rHelperParameters\\n IKeep3rHelperParameters.Kp3rWethOraclePool public override kp3rWethPool;\\n\\n constructor(\\n address _kp3r,\\n address _keep3rV2,\\n address _governor,\\n address _kp3rWethPool\\n ) Governable(_governor) {\\n KP3R = _kp3r;\\n keep3rV2 = _keep3rV2;\\n\\n // Immutable variables [KP3R] cannot be read during contract creation time [_setKp3rWethPool]\\n bool _isKP3RToken0 = _validateOraclePool(_kp3rWethPool, KP3R);\\n kp3rWethPool = Kp3rWethOraclePool(_kp3rWethPool, _isKP3RToken0);\\n emit Kp3rWethPoolChange(_kp3rWethPool, _isKP3RToken0);\\n }\\n\\n /// @inheritdoc IKeep3rHelperParameters\\n function setKp3rWethPool(address _poolAddress) external override onlyGovernor {\\n if (_poolAddress == address(0)) revert ZeroAddress();\\n _setKp3rWethPool(_poolAddress);\\n }\\n\\n /// @inheritdoc IKeep3rHelperParameters\\n function setMinBoost(uint256 _minBoost) external override onlyGovernor {\\n minBoost = _minBoost;\\n emit MinBoostChange(minBoost);\\n }\\n\\n /// @inheritdoc IKeep3rHelperParameters\\n function setMaxBoost(uint256 _maxBoost) external override onlyGovernor {\\n maxBoost = _maxBoost;\\n emit MaxBoostChange(maxBoost);\\n }\\n\\n /// @inheritdoc IKeep3rHelperParameters\\n function setTargetBond(uint256 _targetBond) external override onlyGovernor {\\n targetBond = _targetBond;\\n emit TargetBondChange(targetBond);\\n }\\n\\n /// @inheritdoc IKeep3rHelperParameters\\n function setKeep3rV2(address _keep3rV2) external override onlyGovernor {\\n if (_keep3rV2 == address(0)) revert ZeroAddress();\\n keep3rV2 = _keep3rV2;\\n emit Keep3rV2Change(keep3rV2);\\n }\\n\\n /// @inheritdoc IKeep3rHelperParameters\\n function setWorkExtraGas(uint256 _workExtraGas) external override onlyGovernor {\\n workExtraGas = _workExtraGas;\\n emit WorkExtraGasChange(workExtraGas);\\n }\\n\\n /// @inheritdoc IKeep3rHelperParameters\\n function setQuoteTwapTime(uint32 _quoteTwapTime) external override onlyGovernor {\\n _setQuoteTwapTime(_quoteTwapTime);\\n }\\n\\n function _setQuoteTwapTime(uint32 _quoteTwapTime) internal {\\n quoteTwapTime = _quoteTwapTime;\\n emit QuoteTwapTimeChange(quoteTwapTime);\\n }\\n\\n /// @inheritdoc IKeep3rHelperParameters\\n function setMinBaseFee(uint256 _minBaseFee) external override onlyGovernor {\\n minBaseFee = _minBaseFee;\\n emit MinBaseFeeChange(minBaseFee);\\n }\\n\\n /// @inheritdoc IKeep3rHelperParameters\\n function setMinPriorityFee(uint256 _minPriorityFee) external override onlyGovernor {\\n minPriorityFee = _minPriorityFee;\\n emit MinPriorityFeeChange(minPriorityFee);\\n }\\n\\n /// @notice Sets KP3R-WETH pool\\n /// @param _poolAddress The address of the KP3R-WETH pool\\n function _setKp3rWethPool(address _poolAddress) internal {\\n bool _isKP3RToken0 = _validateOraclePool(_poolAddress, KP3R);\\n kp3rWethPool = Kp3rWethOraclePool(_poolAddress, _isKP3RToken0);\\n emit Kp3rWethPoolChange(_poolAddress, _isKP3RToken0);\\n }\\n\\n function _validateOraclePool(address _poolAddress, address _token) internal view virtual returns (bool _isTKNToken0) {\\n _isTKNToken0 = IUniswapV3Pool(_poolAddress).token0() == _token;\\n if (!_isTKNToken0 && IUniswapV3Pool(_poolAddress).token1() != _token) revert InvalidOraclePool();\\n }\\n}\\n\",\"keccak256\":\"0x327e0b63bca4528c66038e28bf43af552e763a492944e4ce043fe07dc52f6ac8\",\"license\":\"MIT\"},\"solidity/contracts/libraries/FullMath.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4 <0.9.0;\\n\\n/// @title Contains 512-bit math functions\\n/// @notice Facilitates multiplication and division that can have overflow of an intermediate value without any loss of precision\\n/// @dev Handles \\\"phantom overflow\\\" i.e., allows multiplication and division where an intermediate value overflows 256 bits\\nlibrary FullMath {\\n /// @notice Calculates floor(a\\u00d7b\\u00f7denominator) with full precision. Throws if result overflows a uint256 or denominator == 0\\n /// @param a The multiplicand\\n /// @param b The multiplier\\n /// @param denominator The divisor\\n /// @return result The 256-bit result\\n /// @dev Credit to Remco Bloemen under MIT license https://xn--2-umb.com/21/muldiv\\n function mulDiv(\\n uint256 a,\\n uint256 b,\\n uint256 denominator\\n ) internal pure returns (uint256 result) {\\n unchecked {\\n // 512-bit multiply [prod1 prod0] = a * b\\n // Compute the product mod 2**256 and mod 2**256 - 1\\n // then use the Chinese Remainder Theorem to reconstruct\\n // the 512 bit result. The result is stored in two 256\\n // variables such that product = prod1 * 2**256 + prod0\\n uint256 prod0; // Least significant 256 bits of the product\\n uint256 prod1; // Most significant 256 bits of the product\\n assembly {\\n let mm := mulmod(a, b, not(0))\\n prod0 := mul(a, b)\\n prod1 := sub(sub(mm, prod0), lt(mm, prod0))\\n }\\n\\n // Handle non-overflow cases, 256 by 256 division\\n if (prod1 == 0) {\\n require(denominator > 0);\\n assembly {\\n result := div(prod0, denominator)\\n }\\n return result;\\n }\\n\\n // Make sure the result is less than 2**256.\\n // Also prevents denominator == 0\\n require(denominator > prod1);\\n\\n ///////////////////////////////////////////////\\n // 512 by 256 division.\\n ///////////////////////////////////////////////\\n\\n // Make division exact by subtracting the remainder from [prod1 prod0]\\n // Compute remainder using mulmod\\n uint256 remainder;\\n assembly {\\n remainder := mulmod(a, b, denominator)\\n }\\n // Subtract 256 bit number from 512 bit number\\n assembly {\\n prod1 := sub(prod1, gt(remainder, prod0))\\n prod0 := sub(prod0, remainder)\\n }\\n\\n // Factor powers of two out of denominator\\n // Compute largest power of two divisor of denominator.\\n // Always >= 1.\\n uint256 twos = (~denominator + 1) & denominator;\\n // Divide denominator by power of two\\n assembly {\\n denominator := div(denominator, twos)\\n }\\n\\n // Divide [prod1 prod0] by the factors of two\\n assembly {\\n prod0 := div(prod0, twos)\\n }\\n // Shift in bits from prod1 into prod0. For this we need\\n // to flip `twos` such that it is 2**256 / twos.\\n // If twos is zero, then it becomes one\\n assembly {\\n twos := add(div(sub(0, twos), twos), 1)\\n }\\n prod0 |= prod1 * twos;\\n\\n // Invert denominator mod 2**256\\n // Now that denominator is an odd number, it has an inverse\\n // modulo 2**256 such that denominator * inv = 1 mod 2**256.\\n // Compute the inverse by starting with a seed that is correct\\n // correct for four bits. That is, denominator * inv = 1 mod 2**4\\n uint256 inv = (3 * denominator) ^ 2;\\n // Now use Newton-Raphson iteration to improve the precision.\\n // Thanks to Hensel's lifting lemma, this also works in modular\\n // arithmetic, doubling the correct bits in each step.\\n inv *= 2 - denominator * inv; // inverse mod 2**8\\n inv *= 2 - denominator * inv; // inverse mod 2**16\\n inv *= 2 - denominator * inv; // inverse mod 2**32\\n inv *= 2 - denominator * inv; // inverse mod 2**64\\n inv *= 2 - denominator * inv; // inverse mod 2**128\\n inv *= 2 - denominator * inv; // inverse mod 2**256\\n\\n // Because the division is now exact we can divide by multiplying\\n // with the modular inverse of denominator. This will give us the\\n // correct result modulo 2**256. Since the precoditions guarantee\\n // that the outcome is less than 2**256, this is the final result.\\n // We don't need to compute the high bits of the result and prod1\\n // is no longer required.\\n result = prod0 * inv;\\n return result;\\n }\\n }\\n\\n /// @notice Calculates ceil(a\\u00d7b\\u00f7denominator) with full precision. Throws if result overflows a uint256 or denominator == 0\\n /// @param a The multiplicand\\n /// @param b The multiplier\\n /// @param denominator The divisor\\n /// @return result The 256-bit result\\n function mulDivRoundingUp(\\n uint256 a,\\n uint256 b,\\n uint256 denominator\\n ) internal pure returns (uint256 result) {\\n unchecked {\\n result = mulDiv(a, b, denominator);\\n if (mulmod(a, b, denominator) > 0) {\\n require(result < type(uint256).max);\\n result++;\\n }\\n }\\n }\\n}\\n\",\"keccak256\":\"0xe1c595da02adf8ba2ae74ac579b9b3c966d1ecb2a99c25081a62ee8550f26569\",\"license\":\"MIT\"},\"solidity/contracts/libraries/TickMath.sol\":{\"content\":\"// SPDX-License-Identifier: GPL-2.0-or-later\\npragma solidity >=0.5.0;\\n\\n// solhint-disable\\n\\n/// @title Math library for computing sqrt prices from ticks and vice versa\\n/// @notice Computes sqrt price for ticks of size 1.0001, i.e. sqrt(1.0001^tick) as fixed point Q64.96 numbers. Supports\\n/// prices between 2**-128 and 2**128\\nlibrary TickMath {\\n /// @dev The minimum tick that may be passed to #getSqrtRatioAtTick computed from log base 1.0001 of 2**-128\\n int24 internal constant MIN_TICK = -887272;\\n /// @dev The maximum tick that may be passed to #getSqrtRatioAtTick computed from log base 1.0001 of 2**128\\n int24 internal constant MAX_TICK = -MIN_TICK;\\n\\n /// @dev The minimum value that can be returned from #getSqrtRatioAtTick. Equivalent to getSqrtRatioAtTick(MIN_TICK)\\n uint160 internal constant MIN_SQRT_RATIO = 4295128739;\\n /// @dev The maximum value that can be returned from #getSqrtRatioAtTick. Equivalent to getSqrtRatioAtTick(MAX_TICK)\\n uint160 internal constant MAX_SQRT_RATIO = 1461446703485210103287273052203988822378723970342;\\n\\n /// @notice Calculates sqrt(1.0001^tick) * 2^96\\n /// @dev Throws if |tick| > max tick\\n /// @param tick The input tick for the above formula\\n /// @return sqrtPriceX96 A Fixed point Q64.96 number representing the sqrt of the ratio of the two assets (token1/token0)\\n /// at the given tick\\n function getSqrtRatioAtTick(int24 tick) internal pure returns (uint160 sqrtPriceX96) {\\n uint256 absTick = tick < 0 ? uint256(-int256(tick)) : uint256(int256(tick));\\n require(absTick <= uint256(int256(MAX_TICK)), 'T');\\n\\n uint256 ratio = absTick & 0x1 != 0 ? 0xfffcb933bd6fad37aa2d162d1a594001 : 0x100000000000000000000000000000000;\\n if (absTick & 0x2 != 0) ratio = (ratio * 0xfff97272373d413259a46990580e213a) >> 128;\\n if (absTick & 0x4 != 0) ratio = (ratio * 0xfff2e50f5f656932ef12357cf3c7fdcc) >> 128;\\n if (absTick & 0x8 != 0) ratio = (ratio * 0xffe5caca7e10e4e61c3624eaa0941cd0) >> 128;\\n if (absTick & 0x10 != 0) ratio = (ratio * 0xffcb9843d60f6159c9db58835c926644) >> 128;\\n if (absTick & 0x20 != 0) ratio = (ratio * 0xff973b41fa98c081472e6896dfb254c0) >> 128;\\n if (absTick & 0x40 != 0) ratio = (ratio * 0xff2ea16466c96a3843ec78b326b52861) >> 128;\\n if (absTick & 0x80 != 0) ratio = (ratio * 0xfe5dee046a99a2a811c461f1969c3053) >> 128;\\n if (absTick & 0x100 != 0) ratio = (ratio * 0xfcbe86c7900a88aedcffc83b479aa3a4) >> 128;\\n if (absTick & 0x200 != 0) ratio = (ratio * 0xf987a7253ac413176f2b074cf7815e54) >> 128;\\n if (absTick & 0x400 != 0) ratio = (ratio * 0xf3392b0822b70005940c7a398e4b70f3) >> 128;\\n if (absTick & 0x800 != 0) ratio = (ratio * 0xe7159475a2c29b7443b29c7fa6e889d9) >> 128;\\n if (absTick & 0x1000 != 0) ratio = (ratio * 0xd097f3bdfd2022b8845ad8f792aa5825) >> 128;\\n if (absTick & 0x2000 != 0) ratio = (ratio * 0xa9f746462d870fdf8a65dc1f90e061e5) >> 128;\\n if (absTick & 0x4000 != 0) ratio = (ratio * 0x70d869a156d2a1b890bb3df62baf32f7) >> 128;\\n if (absTick & 0x8000 != 0) ratio = (ratio * 0x31be135f97d08fd981231505542fcfa6) >> 128;\\n if (absTick & 0x10000 != 0) ratio = (ratio * 0x9aa508b5b7a84e1c677de54f3e99bc9) >> 128;\\n if (absTick & 0x20000 != 0) ratio = (ratio * 0x5d6af8dedb81196699c329225ee604) >> 128;\\n if (absTick & 0x40000 != 0) ratio = (ratio * 0x2216e584f5fa1ea926041bedfe98) >> 128;\\n if (absTick & 0x80000 != 0) ratio = (ratio * 0x48a170391f7dc42444e8fa2) >> 128;\\n\\n if (tick > 0) ratio = type(uint256).max / ratio;\\n\\n // Divides by 1<<32 rounding up to go from a Q128.128 to a Q128.96.\\n // we then downcast because we know the result always fits within 160 bits due to our tick input constraint\\n // we round up in the division so getTickAtSqrtRatio of the output price is always consistent\\n sqrtPriceX96 = uint160((ratio >> 32) + (ratio % (1 << 32) == 0 ? 0 : 1));\\n }\\n\\n /// @notice Calculates the greatest tick value such that getRatioAtTick(tick) <= ratio\\n /// @dev Throws in case sqrtPriceX96 < MIN_SQRT_RATIO, as MIN_SQRT_RATIO is the lowest value getRatioAtTick may ever return.\\n /// @param sqrtPriceX96 The sqrt ratio for which to compute the tick as a Q64.96\\n /// @return tick The greatest tick for which the ratio is less than or equal to the input ratio\\n function getTickAtSqrtRatio(uint160 sqrtPriceX96) internal pure returns (int24 tick) {\\n // Second inequality must be < because the price can never reach the price at the max tick\\n require(sqrtPriceX96 >= MIN_SQRT_RATIO && sqrtPriceX96 < MAX_SQRT_RATIO, 'R');\\n uint256 ratio = uint256(sqrtPriceX96) << 32;\\n\\n uint256 r = ratio;\\n uint256 msb = 0;\\n\\n assembly {\\n let f := shl(7, gt(r, 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF))\\n msb := or(msb, f)\\n r := shr(f, r)\\n }\\n assembly {\\n let f := shl(6, gt(r, 0xFFFFFFFFFFFFFFFF))\\n msb := or(msb, f)\\n r := shr(f, r)\\n }\\n assembly {\\n let f := shl(5, gt(r, 0xFFFFFFFF))\\n msb := or(msb, f)\\n r := shr(f, r)\\n }\\n assembly {\\n let f := shl(4, gt(r, 0xFFFF))\\n msb := or(msb, f)\\n r := shr(f, r)\\n }\\n assembly {\\n let f := shl(3, gt(r, 0xFF))\\n msb := or(msb, f)\\n r := shr(f, r)\\n }\\n assembly {\\n let f := shl(2, gt(r, 0xF))\\n msb := or(msb, f)\\n r := shr(f, r)\\n }\\n assembly {\\n let f := shl(1, gt(r, 0x3))\\n msb := or(msb, f)\\n r := shr(f, r)\\n }\\n assembly {\\n let f := gt(r, 0x1)\\n msb := or(msb, f)\\n }\\n\\n if (msb >= 128) r = ratio >> (msb - 127);\\n else r = ratio << (127 - msb);\\n\\n int256 log_2 = (int256(msb) - 128) << 64;\\n\\n assembly {\\n r := shr(127, mul(r, r))\\n let f := shr(128, r)\\n log_2 := or(log_2, shl(63, f))\\n r := shr(f, r)\\n }\\n assembly {\\n r := shr(127, mul(r, r))\\n let f := shr(128, r)\\n log_2 := or(log_2, shl(62, f))\\n r := shr(f, r)\\n }\\n assembly {\\n r := shr(127, mul(r, r))\\n let f := shr(128, r)\\n log_2 := or(log_2, shl(61, f))\\n r := shr(f, r)\\n }\\n assembly {\\n r := shr(127, mul(r, r))\\n let f := shr(128, r)\\n log_2 := or(log_2, shl(60, f))\\n r := shr(f, r)\\n }\\n assembly {\\n r := shr(127, mul(r, r))\\n let f := shr(128, r)\\n log_2 := or(log_2, shl(59, f))\\n r := shr(f, r)\\n }\\n assembly {\\n r := shr(127, mul(r, r))\\n let f := shr(128, r)\\n log_2 := or(log_2, shl(58, f))\\n r := shr(f, r)\\n }\\n assembly {\\n r := shr(127, mul(r, r))\\n let f := shr(128, r)\\n log_2 := or(log_2, shl(57, f))\\n r := shr(f, r)\\n }\\n assembly {\\n r := shr(127, mul(r, r))\\n let f := shr(128, r)\\n log_2 := or(log_2, shl(56, f))\\n r := shr(f, r)\\n }\\n assembly {\\n r := shr(127, mul(r, r))\\n let f := shr(128, r)\\n log_2 := or(log_2, shl(55, f))\\n r := shr(f, r)\\n }\\n assembly {\\n r := shr(127, mul(r, r))\\n let f := shr(128, r)\\n log_2 := or(log_2, shl(54, f))\\n r := shr(f, r)\\n }\\n assembly {\\n r := shr(127, mul(r, r))\\n let f := shr(128, r)\\n log_2 := or(log_2, shl(53, f))\\n r := shr(f, r)\\n }\\n assembly {\\n r := shr(127, mul(r, r))\\n let f := shr(128, r)\\n log_2 := or(log_2, shl(52, f))\\n r := shr(f, r)\\n }\\n assembly {\\n r := shr(127, mul(r, r))\\n let f := shr(128, r)\\n log_2 := or(log_2, shl(51, f))\\n r := shr(f, r)\\n }\\n assembly {\\n r := shr(127, mul(r, r))\\n let f := shr(128, r)\\n log_2 := or(log_2, shl(50, f))\\n }\\n\\n int256 log_sqrt10001 = log_2 * 255738958999603826347141; // 128.128 number\\n\\n int24 tickLow = int24((log_sqrt10001 - 3402992956809132418596140100660247210) >> 128);\\n int24 tickHi = int24((log_sqrt10001 + 291339464771989622907027621153398088495) >> 128);\\n\\n tick = tickLow == tickHi ? tickLow : getSqrtRatioAtTick(tickHi) <= sqrtPriceX96 ? tickHi : tickLow;\\n }\\n}\\n\",\"keccak256\":\"0x11b965ba576ff91b4a6e9533c0f334f2b7b6024ee1c54e36d21799de5580899d\",\"license\":\"GPL-2.0-or-later\"},\"solidity/contracts/sidechain/Keep3rHelperSidechain.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\n/*\\n\\nCoded for The Keep3r Network with \\u2665 by\\n\\n\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2557\\u2591\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2557\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2557\\u2588\\u2588\\u2557\\u2591\\u2591\\u2591\\u2588\\u2588\\u2557\\u2591\\u2591\\u2591\\u2591\\u2591\\u2591\\u2591\\u2588\\u2588\\u2557\\u2591\\u2588\\u2588\\u2588\\u2588\\u2588\\u2557\\u2591\\u2588\\u2588\\u2588\\u2557\\u2591\\u2591\\u2588\\u2588\\u2557\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2557\\u2591\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2557\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2557\\u2591\\u2588\\u2588\\u2557\\u2591\\u2591\\u2591\\u2591\\u2591\\u2591\\u2588\\u2588\\u2588\\u2588\\u2588\\u2557\\u2591\\u2588\\u2588\\u2588\\u2557\\u2591\\u2591\\u2588\\u2588\\u2557\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2557\\u2591\\n\\u2588\\u2588\\u2554\\u2550\\u2550\\u2588\\u2588\\u2557\\u2588\\u2588\\u2554\\u2550\\u2550\\u2550\\u2550\\u255d\\u2588\\u2588\\u2554\\u2550\\u2550\\u2550\\u2550\\u255d\\u2588\\u2588\\u2551\\u2591\\u2591\\u2591\\u2588\\u2588\\u2551\\u2591\\u2591\\u2588\\u2588\\u2557\\u2591\\u2591\\u2588\\u2588\\u2551\\u2588\\u2588\\u2554\\u2550\\u2550\\u2588\\u2588\\u2557\\u2588\\u2588\\u2588\\u2588\\u2557\\u2591\\u2588\\u2588\\u2551\\u2588\\u2588\\u2554\\u2550\\u2550\\u2588\\u2588\\u2557\\u2588\\u2588\\u2554\\u2550\\u2550\\u2550\\u2550\\u255d\\u2588\\u2588\\u2554\\u2550\\u2550\\u2588\\u2588\\u2557\\u2588\\u2588\\u2551\\u2591\\u2591\\u2591\\u2591\\u2591\\u2588\\u2588\\u2554\\u2550\\u2550\\u2588\\u2588\\u2557\\u2588\\u2588\\u2588\\u2588\\u2557\\u2591\\u2588\\u2588\\u2551\\u2588\\u2588\\u2554\\u2550\\u2550\\u2588\\u2588\\u2557\\n\\u2588\\u2588\\u2551\\u2591\\u2591\\u2588\\u2588\\u2551\\u2588\\u2588\\u2588\\u2588\\u2588\\u2557\\u2591\\u2591\\u2588\\u2588\\u2588\\u2588\\u2588\\u2557\\u2591\\u2591\\u2588\\u2588\\u2551\\u2591\\u2591\\u2591\\u255a\\u2588\\u2588\\u2557\\u2588\\u2588\\u2588\\u2588\\u2557\\u2588\\u2588\\u2554\\u255d\\u2588\\u2588\\u2551\\u2591\\u2591\\u2588\\u2588\\u2551\\u2588\\u2588\\u2554\\u2588\\u2588\\u2557\\u2588\\u2588\\u2551\\u2588\\u2588\\u2551\\u2591\\u2591\\u2588\\u2588\\u2551\\u2588\\u2588\\u2588\\u2588\\u2588\\u2557\\u2591\\u2591\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2554\\u255d\\u2588\\u2588\\u2551\\u2591\\u2591\\u2591\\u2591\\u2591\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2551\\u2588\\u2588\\u2554\\u2588\\u2588\\u2557\\u2588\\u2588\\u2551\\u2588\\u2588\\u2551\\u2591\\u2591\\u2588\\u2588\\u2551\\n\\u2588\\u2588\\u2551\\u2591\\u2591\\u2588\\u2588\\u2551\\u2588\\u2588\\u2554\\u2550\\u2550\\u255d\\u2591\\u2591\\u2588\\u2588\\u2554\\u2550\\u2550\\u255d\\u2591\\u2591\\u2588\\u2588\\u2551\\u2591\\u2591\\u2591\\u2591\\u2588\\u2588\\u2588\\u2588\\u2554\\u2550\\u2588\\u2588\\u2588\\u2588\\u2551\\u2591\\u2588\\u2588\\u2551\\u2591\\u2591\\u2588\\u2588\\u2551\\u2588\\u2588\\u2551\\u255a\\u2588\\u2588\\u2588\\u2588\\u2551\\u2588\\u2588\\u2551\\u2591\\u2591\\u2588\\u2588\\u2551\\u2588\\u2588\\u2554\\u2550\\u2550\\u255d\\u2591\\u2591\\u2588\\u2588\\u2554\\u2550\\u2550\\u2588\\u2588\\u2557\\u2588\\u2588\\u2551\\u2591\\u2591\\u2591\\u2591\\u2591\\u2588\\u2588\\u2554\\u2550\\u2550\\u2588\\u2588\\u2551\\u2588\\u2588\\u2551\\u255a\\u2588\\u2588\\u2588\\u2588\\u2551\\u2588\\u2588\\u2551\\u2591\\u2591\\u2588\\u2588\\u2551\\n\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2554\\u255d\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2557\\u2588\\u2588\\u2551\\u2591\\u2591\\u2591\\u2591\\u2591\\u2588\\u2588\\u2551\\u2591\\u2591\\u2591\\u2591\\u255a\\u2588\\u2588\\u2554\\u255d\\u2591\\u255a\\u2588\\u2588\\u2554\\u255d\\u2591\\u255a\\u2588\\u2588\\u2588\\u2588\\u2588\\u2554\\u255d\\u2588\\u2588\\u2551\\u2591\\u255a\\u2588\\u2588\\u2588\\u2551\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2554\\u255d\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2557\\u2588\\u2588\\u2551\\u2591\\u2591\\u2588\\u2588\\u2551\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2557\\u2588\\u2588\\u2551\\u2591\\u2591\\u2588\\u2588\\u2551\\u2588\\u2588\\u2551\\u2591\\u255a\\u2588\\u2588\\u2588\\u2551\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2554\\u255d\\n\\u255a\\u2550\\u2550\\u2550\\u2550\\u2550\\u255d\\u2591\\u255a\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u255d\\u255a\\u2550\\u255d\\u2591\\u2591\\u2591\\u2591\\u2591\\u255a\\u2550\\u255d\\u2591\\u2591\\u2591\\u2591\\u2591\\u255a\\u2550\\u255d\\u2591\\u2591\\u2591\\u255a\\u2550\\u255d\\u2591\\u2591\\u2591\\u255a\\u2550\\u2550\\u2550\\u2550\\u255d\\u2591\\u255a\\u2550\\u255d\\u2591\\u2591\\u255a\\u2550\\u2550\\u255d\\u255a\\u2550\\u2550\\u2550\\u2550\\u2550\\u255d\\u2591\\u255a\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u255d\\u255a\\u2550\\u255d\\u2591\\u2591\\u255a\\u2550\\u255d\\u255a\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u255d\\u255a\\u2550\\u255d\\u2591\\u2591\\u255a\\u2550\\u255d\\u255a\\u2550\\u255d\\u2591\\u2591\\u255a\\u2550\\u2550\\u255d\\u255a\\u2550\\u2550\\u2550\\u2550\\u2550\\u255d\\u2591\\n\\nhttps://defi.sucks\\n\\nCommit hash: b18e2940310077e04ec08b3026dc92e441fb08ef\\n\\n*/\\n\\npragma solidity >=0.8.4 <0.9.0;\\n\\nimport '../Keep3rHelper.sol';\\nimport '../../interfaces/sidechain/IKeep3rHelperSidechain.sol';\\n\\ncontract Keep3rHelperSidechain is IKeep3rHelperSidechain, Keep3rHelper {\\n /// @inheritdoc IKeep3rHelperSidechain\\n mapping(address => address) public override oracle;\\n /// @inheritdoc IKeep3rHelperSidechain\\n IKeep3rHelperSidechain.WethUsdOraclePool public override wethUSDPool;\\n\\n /// @notice Ethereum mainnet WETH address used for quoting references\\n address public immutable override WETH;\\n\\n /// @dev Amount of decimals in which USD is quoted within the contract\\n uint256 constant _USD_BASE_DECIMALS = 18;\\n\\n /// @param _keep3rV2 Address of sidechain Keep3r implementation\\n /// @param _governor Address of governor\\n /// @param _kp3rWethOracle Address of oracle used for KP3R/WETH quote\\n /// @param _wethUsdOracle Address of oracle used for WETH/USD quote\\n /// @dev Oracle pools should use 18 decimals tokens\\n constructor(\\n address _keep3rV2,\\n address _governor,\\n address _kp3r,\\n address _weth,\\n address _kp3rWethOracle,\\n address _wethUsdOracle,\\n uint8 _usdDecimals\\n ) Keep3rHelper(_kp3r, _keep3rV2, _governor, _kp3rWethOracle) {\\n WETH = _weth;\\n\\n // Immutable variables [KP3R] cannot be read during contract creation time [_setKp3rWethPool]\\n bool _isWETHToken0 = _validateOraclePool(_wethUsdOracle, WETH);\\n wethUSDPool = WethUsdOraclePool(_wethUsdOracle, _isWETHToken0, _usdDecimals);\\n emit WethUSDPoolChange(wethUSDPool.poolAddress, wethUSDPool.isWETHToken0, _usdDecimals);\\n\\n _setQuoteTwapTime(1 days);\\n workExtraGas = 0;\\n }\\n\\n /// @inheritdoc IKeep3rHelper\\n /// @notice Uses valid wKP3R address from Keep3rSidechain to query keeper bonds\\n function bonds(address _keeper) public view override(Keep3rHelper, IKeep3rHelper) returns (uint256 _amountBonded) {\\n address wKP3R = IKeep3r(keep3rV2).keep3rV1();\\n return IKeep3r(keep3rV2).bonds(_keeper, wKP3R);\\n }\\n\\n /// @inheritdoc IKeep3rHelperSidechain\\n function setOracle(address _liquidity, address _oracle) external override onlyGovernor {\\n if (_liquidity == address(0) || _oracle == address(0)) revert ZeroAddress();\\n oracle[_liquidity] = _oracle;\\n emit OracleSet(_liquidity, _oracle);\\n }\\n\\n /// @inheritdoc IKeep3rHelperSidechain\\n function quoteUsdToEth(uint256 _usd) public view virtual override returns (uint256 _amountOut) {\\n uint32[] memory _secondsAgos = new uint32[](2);\\n _secondsAgos[1] = quoteTwapTime;\\n _usd = _usd / 10**(_USD_BASE_DECIMALS - wethUSDPool.usdDecimals);\\n\\n /// @dev Oracle is compatible with IUniswapV3Pool\\n (int56[] memory _tickCumulatives, ) = IUniswapV3Pool(wethUSDPool.poolAddress).observe(_secondsAgos);\\n int56 _difference = _tickCumulatives[0] - _tickCumulatives[1];\\n _amountOut = getQuoteAtTick(uint128(_usd), wethUSDPool.isWETHToken0 ? _difference : -_difference, quoteTwapTime);\\n }\\n\\n /// @inheritdoc IKeep3rHelperSidechain\\n function setWethUsdPool(address _poolAddress, uint8 _usdDecimals) external override onlyGovernor {\\n if (_poolAddress == address(0)) revert ZeroAddress();\\n _setWethUsdPool(_poolAddress, _usdDecimals);\\n }\\n\\n /// @inheritdoc IKeep3rHelper\\n function getPaymentParams(uint256 _bonds)\\n external\\n view\\n virtual\\n override(Keep3rHelper, IKeep3rHelper)\\n returns (\\n uint256 _boost,\\n uint256 _oneUsdQuote,\\n uint256 _extraGas\\n )\\n {\\n _oneUsdQuote = quote(quoteUsdToEth(1 ether));\\n _boost = getRewardBoostFor(_bonds);\\n _extraGas = workExtraGas;\\n }\\n\\n function _setWethUsdPool(address _poolAddress, uint8 _usdDecimals) internal {\\n bool _isWETHToken0 = _validateOraclePool(_poolAddress, WETH);\\n wethUSDPool = WethUsdOraclePool(_poolAddress, _isWETHToken0, _usdDecimals);\\n emit WethUSDPoolChange(wethUSDPool.poolAddress, wethUSDPool.isWETHToken0, _usdDecimals);\\n }\\n\\n /// @dev Sidechain jobs are quoted by USD/gasUnit, baseFee is set to 1\\n function _getBasefee() internal view virtual override returns (uint256 _baseFee) {\\n return 1;\\n }\\n}\\n\",\"keccak256\":\"0x9f63b8be6f40570d34a8ca9eeb947412cf0683545fdb678633614ce54288c3b4\",\"license\":\"MIT\"},\"solidity/interfaces/IKeep3r.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4 <0.9.0;\\n\\nimport './peripherals/IKeep3rJobs.sol';\\nimport './peripherals/IKeep3rKeepers.sol';\\nimport './peripherals/IKeep3rParameters.sol';\\n\\n// solhint-disable-next-line no-empty-blocks\\n\\n/// @title Keep3rV2 contract\\n/// @notice This contract inherits all the functionality of Keep3rV2\\ninterface IKeep3r is IKeep3rJobs, IKeep3rKeepers, IKeep3rParameters {\\n\\n}\\n\",\"keccak256\":\"0x273a39984c1475c60182e636bb91a1b89ec98646a036cac6a87067869b3adeb9\",\"license\":\"MIT\"},\"solidity/interfaces/IKeep3rHelper.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4 <0.9.0;\\n\\nimport './IKeep3rHelperParameters.sol';\\n\\n/// @title Keep3rHelper contract\\n/// @notice Contains all the helper functions used throughout the different files.\\ninterface IKeep3rHelper is IKeep3rHelperParameters {\\n // Errors\\n\\n /// @notice Throws when none of the tokens in the liquidity pair is KP3R\\n error LiquidityPairInvalid();\\n\\n // Methods\\n // solhint-enable func-name-mixedcase\\n\\n /// @notice Calculates the amount of KP3R that corresponds to the ETH passed into the function\\n /// @dev This function allows us to calculate how much KP3R we should pay to a keeper for things expressed in ETH, like gas\\n /// @param _eth The amount of ETH\\n /// @return _amountOut The amount of KP3R\\n function quote(uint256 _eth) external view returns (uint256 _amountOut);\\n\\n /// @notice Returns the amount of KP3R the keeper has bonded\\n /// @param _keeper The address of the keeper to check\\n /// @return _amountBonded The amount of KP3R the keeper has bonded\\n function bonds(address _keeper) external view returns (uint256 _amountBonded);\\n\\n /// @notice Calculates the reward (in KP3R) that corresponds to a keeper for using gas\\n /// @param _keeper The address of the keeper to check\\n /// @param _gasUsed The amount of gas used that will be rewarded\\n /// @return _kp3r The amount of KP3R that should be awarded to the keeper\\n function getRewardAmountFor(address _keeper, uint256 _gasUsed) external view returns (uint256 _kp3r);\\n\\n /// @notice Calculates the boost in the reward given to a keeper based on the amount of KP3R that keeper has bonded\\n /// @dev If the keeper has no bonds, boost should be +10% of gas cost, if keeper has max bonds, +20%\\n /// @param _bonds The amount of KP3R tokens bonded by the keeper\\n /// @return _rewardBoost The reward boost that corresponds to the keeper\\n function getRewardBoostFor(uint256 _bonds) external view returns (uint256 _rewardBoost);\\n\\n /// @notice Calculates the reward (in KP3R) that corresponds to tx.origin for using gas\\n /// @param _gasUsed The amount of gas used that will be rewarded\\n /// @return _amount The amount of KP3R that should be awarded to tx.origin\\n function getRewardAmount(uint256 _gasUsed) external view returns (uint256 _amount);\\n\\n /// @notice Given a pool address, returns the underlying tokens of the pair\\n /// @param _pool Address of the correspondant pool\\n /// @return _token0 Address of the first token of the pair\\n /// @return _token1 Address of the second token of the pair\\n function getPoolTokens(address _pool) external view returns (address _token0, address _token1);\\n\\n /// @notice Defines the order of the tokens in the pair for twap calculations\\n /// @param _pool Address of the correspondant pool\\n /// @return _isKP3RToken0 Boolean indicating the order of the tokens in the pair\\n function isKP3RToken0(address _pool) external view returns (bool _isKP3RToken0);\\n\\n /// @notice Given an array of secondsAgo, returns UniswapV3 pool cumulatives at that moment\\n /// @param _pool Address of the pool to observe\\n /// @param _secondsAgo Array with time references to observe\\n /// @return _tickCumulative1 Cumulative sum of ticks until first time reference\\n /// @return _tickCumulative2 Cumulative sum of ticks until second time reference\\n /// @return _success Boolean indicating if the observe call was succesfull\\n function observe(address _pool, uint32[] memory _secondsAgo)\\n external\\n view\\n returns (\\n int56 _tickCumulative1,\\n int56 _tickCumulative2,\\n bool _success\\n );\\n\\n /// @notice Get multiplier, quote, and extra, in order to calculate keeper payment\\n /// @param _bonds Amount of bonded KP3R owned by the keeper\\n /// @return _boost Multiplier per gas unit. Takes into account the base fee and the amount of bonded KP3R\\n /// @return _oneEthQuote Amount of KP3R tokens equivalent to 1 ETH\\n /// @return _extra Amount of extra gas that should be added to the gas spent\\n function getPaymentParams(uint256 _bonds)\\n external\\n view\\n returns (\\n uint256 _boost,\\n uint256 _oneEthQuote,\\n uint256 _extra\\n );\\n\\n /// @notice Given a tick and a liquidity amount, calculates the underlying KP3R tokens\\n /// @param _liquidityAmount Amount of liquidity to be converted\\n /// @param _tickDifference Tick value used to calculate the quote\\n /// @param _timeInterval Time value used to calculate the quote\\n /// @return _kp3rAmount Amount of KP3R tokens underlying on the given liquidity\\n function getKP3RsAtTick(\\n uint256 _liquidityAmount,\\n int56 _tickDifference,\\n uint256 _timeInterval\\n ) external pure returns (uint256 _kp3rAmount);\\n\\n /// @notice Given a tick and a token amount, calculates the output in correspondant token\\n /// @param _baseAmount Amount of token to be converted\\n /// @param _tickDifference Tick value used to calculate the quote\\n /// @param _timeInterval Time value used to calculate the quote\\n /// @return _quoteAmount Amount of credits deserved for the baseAmount at the tick value\\n function getQuoteAtTick(\\n uint128 _baseAmount,\\n int56 _tickDifference,\\n uint256 _timeInterval\\n ) external pure returns (uint256 _quoteAmount);\\n}\\n\",\"keccak256\":\"0x67817dc98fde9b3a917e25bc16fe60a91772dd5a77e0ce22a208b66b29d3ad8e\",\"license\":\"MIT\"},\"solidity/interfaces/IKeep3rHelperParameters.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4 <0.9.0;\\n\\n/// @title Keep3rHelperParameters contract\\n/// @notice Contains all the helper functions used throughout the different files.\\ninterface IKeep3rHelperParameters {\\n // Structs\\n\\n /// @dev KP3R-WETH Pool address and isKP3RToken0\\n /// @dev Created in order to save gas by avoiding calls to pool's token0 method\\n struct Kp3rWethOraclePool {\\n address poolAddress;\\n bool isKP3RToken0;\\n }\\n\\n // Errors\\n\\n /// @notice Throws when pool does not have KP3R as token0 nor token1\\n error InvalidOraclePool();\\n\\n // Events\\n\\n /// @notice Emitted when the kp3r weth pool is changed\\n /// @param _address Address of the new kp3r weth pool\\n /// @param _isKP3RToken0 True if calling the token0 method of the pool returns the KP3R token address\\n event Kp3rWethPoolChange(address _address, bool _isKP3RToken0);\\n\\n /// @notice Emitted when the minimum boost multiplier is changed\\n /// @param _minBoost The minimum boost multiplier\\n event MinBoostChange(uint256 _minBoost);\\n\\n /// @notice Emitted when the maximum boost multiplier is changed\\n /// @param _maxBoost The maximum boost multiplier\\n event MaxBoostChange(uint256 _maxBoost);\\n\\n /// @notice Emitted when the target bond amount is changed\\n /// @param _targetBond The target bond amount\\n event TargetBondChange(uint256 _targetBond);\\n\\n /// @notice Emitted when the Keep3r V2 address is changed\\n /// @param _keep3rV2 The address of Keep3r V2\\n event Keep3rV2Change(address _keep3rV2);\\n\\n /// @notice Emitted when the work extra gas amount is changed\\n /// @param _workExtraGas The work extra gas\\n event WorkExtraGasChange(uint256 _workExtraGas);\\n\\n /// @notice Emitted when the quote twap time is changed\\n /// @param _quoteTwapTime The twap time for quoting\\n event QuoteTwapTimeChange(uint32 _quoteTwapTime);\\n\\n /// @notice Emitted when minimum rewarded gas fee is changed\\n /// @param _minBaseFee The minimum rewarded gas fee\\n event MinBaseFeeChange(uint256 _minBaseFee);\\n\\n /// @notice Emitted when minimum rewarded priority fee is changed\\n /// @param _minPriorityFee The minimum expected fee that the keeper should pay\\n event MinPriorityFeeChange(uint256 _minPriorityFee);\\n\\n // Variables\\n\\n /// @notice Address of KP3R token\\n /// @return _kp3r Address of KP3R token\\n // solhint-disable func-name-mixedcase\\n function KP3R() external view returns (address _kp3r);\\n\\n /// @notice The boost base used to calculate the boost rewards for the keeper\\n /// @return _base The boost base number\\n function BOOST_BASE() external view returns (uint256 _base);\\n\\n /// @notice KP3R-WETH pool that is being used as oracle\\n /// @return poolAddress Address of the pool\\n /// @return isKP3RToken0 True if calling the token0 method of the pool returns the KP3R token address\\n function kp3rWethPool() external view returns (address poolAddress, bool isKP3RToken0);\\n\\n /// @notice The minimum multiplier used to calculate the amount of gas paid to the Keeper for the gas used to perform a job\\n /// For example: if the quoted gas used is 1000, then the minimum amount to be paid will be 1000 * minBoost / BOOST_BASE\\n /// @return _multiplier The minimum boost multiplier\\n function minBoost() external view returns (uint256 _multiplier);\\n\\n /// @notice The maximum multiplier used to calculate the amount of gas paid to the Keeper for the gas used to perform a job\\n /// For example: if the quoted gas used is 1000, then the maximum amount to be paid will be 1000 * maxBoost / BOOST_BASE\\n /// @return _multiplier The maximum boost multiplier\\n function maxBoost() external view returns (uint256 _multiplier);\\n\\n /// @notice The targeted amount of bonded KP3Rs to max-up reward multiplier\\n /// For example: if the amount of KP3R the keeper has bonded is targetBond or more, then the keeper will get\\n /// the maximum boost possible in his rewards, if it's less, the reward boost will be proportional\\n /// @return _target The amount of KP3R that comforms the targetBond\\n function targetBond() external view returns (uint256 _target);\\n\\n /// @notice The amount of unaccounted gas that is going to be added to keeper payments\\n /// @return _workExtraGas The work unaccounted gas amount\\n function workExtraGas() external view returns (uint256 _workExtraGas);\\n\\n /// @notice The twap time for quoting\\n /// @return _quoteTwapTime The twap time\\n function quoteTwapTime() external view returns (uint32 _quoteTwapTime);\\n\\n /// @notice The minimum base fee that is used to calculate keeper rewards\\n /// @return _minBaseFee The minimum rewarded gas fee\\n function minBaseFee() external view returns (uint256 _minBaseFee);\\n\\n /// @notice The minimum priority fee that is also rewarded for keepers\\n /// @return _minPriorityFee The minimum rewarded priority fee\\n function minPriorityFee() external view returns (uint256 _minPriorityFee);\\n\\n /// @notice Address of Keep3r V2\\n /// @return _keep3rV2 Address of Keep3r V2\\n function keep3rV2() external view returns (address _keep3rV2);\\n\\n // Methods\\n\\n /// @notice Sets KP3R-WETH pool\\n /// @param _poolAddress The address of the KP3R-WETH pool\\n function setKp3rWethPool(address _poolAddress) external;\\n\\n /// @notice Sets the minimum boost multiplier\\n /// @param _minBoost The minimum boost multiplier\\n function setMinBoost(uint256 _minBoost) external;\\n\\n /// @notice Sets the maximum boost multiplier\\n /// @param _maxBoost The maximum boost multiplier\\n function setMaxBoost(uint256 _maxBoost) external;\\n\\n /// @notice Sets the target bond amount\\n /// @param _targetBond The target bond amount\\n function setTargetBond(uint256 _targetBond) external;\\n\\n /// @notice Sets the Keep3r V2 address\\n /// @param _keep3rV2 The address of Keep3r V2\\n function setKeep3rV2(address _keep3rV2) external;\\n\\n /// @notice Sets the work extra gas amount\\n /// @param _workExtraGas The work extra gas\\n function setWorkExtraGas(uint256 _workExtraGas) external;\\n\\n /// @notice Sets the quote twap time\\n /// @param _quoteTwapTime The twap time for quoting\\n function setQuoteTwapTime(uint32 _quoteTwapTime) external;\\n\\n /// @notice Sets the minimum rewarded gas fee\\n /// @param _minBaseFee The minimum rewarded gas fee\\n function setMinBaseFee(uint256 _minBaseFee) external;\\n\\n /// @notice Sets the minimum rewarded gas priority fee\\n /// @param _minPriorityFee The minimum rewarded priority fee\\n function setMinPriorityFee(uint256 _minPriorityFee) external;\\n}\\n\",\"keccak256\":\"0xc571e913c0e3c02f4aa0b27090ca1608c85c68768dc2ab979f8aef7c731f60b2\",\"license\":\"MIT\"},\"solidity/interfaces/external/IKeep3rV1.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4 <0.9.0;\\n\\nimport '@openzeppelin/contracts/token/ERC20/IERC20.sol';\\nimport '@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol';\\n\\n// solhint-disable func-name-mixedcase\\ninterface IKeep3rV1 is IERC20, IERC20Metadata {\\n // Structs\\n struct Checkpoint {\\n uint32 fromBlock;\\n uint256 votes;\\n }\\n\\n // Events\\n event DelegateChanged(address indexed _delegator, address indexed _fromDelegate, address indexed _toDelegate);\\n event DelegateVotesChanged(address indexed _delegate, uint256 _previousBalance, uint256 _newBalance);\\n event SubmitJob(address indexed _job, address indexed _liquidity, address indexed _provider, uint256 _block, uint256 _credit);\\n event ApplyCredit(address indexed _job, address indexed _liquidity, address indexed _provider, uint256 _block, uint256 _credit);\\n event RemoveJob(address indexed _job, address indexed _liquidity, address indexed _provider, uint256 _block, uint256 _credit);\\n event UnbondJob(address indexed _job, address indexed _liquidity, address indexed _provider, uint256 _block, uint256 _credit);\\n event JobAdded(address indexed _job, uint256 _block, address _governance);\\n event JobRemoved(address indexed _job, uint256 _block, address _governance);\\n event KeeperWorked(address indexed _credit, address indexed _job, address indexed _keeper, uint256 _block, uint256 _amount);\\n event KeeperBonding(address indexed _keeper, uint256 _block, uint256 _active, uint256 _bond);\\n event KeeperBonded(address indexed _keeper, uint256 _block, uint256 _activated, uint256 _bond);\\n event KeeperUnbonding(address indexed _keeper, uint256 _block, uint256 _deactive, uint256 _bond);\\n event KeeperUnbound(address indexed _keeper, uint256 _block, uint256 _deactivated, uint256 _bond);\\n event KeeperSlashed(address indexed _keeper, address indexed _slasher, uint256 _block, uint256 _slash);\\n event KeeperDispute(address indexed _keeper, uint256 _block);\\n event KeeperResolved(address indexed _keeper, uint256 _block);\\n event TokenCreditAddition(address indexed _credit, address indexed _job, address indexed _creditor, uint256 _block, uint256 _amount);\\n\\n // Variables\\n function KPRH() external returns (address);\\n\\n function delegates(address _delegator) external view returns (address);\\n\\n function checkpoints(address _account, uint32 _checkpoint) external view returns (Checkpoint memory);\\n\\n function numCheckpoints(address _account) external view returns (uint32);\\n\\n function DOMAIN_TYPEHASH() external returns (bytes32);\\n\\n function DOMAINSEPARATOR() external returns (bytes32);\\n\\n function DELEGATION_TYPEHASH() external returns (bytes32);\\n\\n function PERMIT_TYPEHASH() external returns (bytes32);\\n\\n function nonces(address _user) external view returns (uint256);\\n\\n function BOND() external returns (uint256);\\n\\n function UNBOND() external returns (uint256);\\n\\n function LIQUIDITYBOND() external returns (uint256);\\n\\n function FEE() external returns (uint256);\\n\\n function BASE() external returns (uint256);\\n\\n function ETH() external returns (address);\\n\\n function bondings(address _user, address _bonding) external view returns (uint256);\\n\\n function canWithdrawAfter(address _user, address _bonding) external view returns (uint256);\\n\\n function pendingUnbonds(address _keeper, address _bonding) external view returns (uint256);\\n\\n function pendingbonds(address _keeper, address _bonding) external view returns (uint256);\\n\\n function bonds(address _keeper, address _bonding) external view returns (uint256);\\n\\n function votes(address _delegator) external view returns (uint256);\\n\\n function firstSeen(address _keeper) external view returns (uint256);\\n\\n function disputes(address _keeper) external view returns (bool);\\n\\n function lastJob(address _keeper) external view returns (uint256);\\n\\n function workCompleted(address _keeper) external view returns (uint256);\\n\\n function jobs(address _job) external view returns (bool);\\n\\n function credits(address _job, address _credit) external view returns (uint256);\\n\\n function liquidityProvided(\\n address _provider,\\n address _liquidity,\\n address _job\\n ) external view returns (uint256);\\n\\n function liquidityUnbonding(\\n address _provider,\\n address _liquidity,\\n address _job\\n ) external view returns (uint256);\\n\\n function liquidityAmountsUnbonding(\\n address _provider,\\n address _liquidity,\\n address _job\\n ) external view returns (uint256);\\n\\n function jobProposalDelay(address _job) external view returns (uint256);\\n\\n function liquidityApplied(\\n address _provider,\\n address _liquidity,\\n address _job\\n ) external view returns (uint256);\\n\\n function liquidityAmount(\\n address _provider,\\n address _liquidity,\\n address _job\\n ) external view returns (uint256);\\n\\n function keepers(address _keeper) external view returns (bool);\\n\\n function blacklist(address _keeper) external view returns (bool);\\n\\n function keeperList(uint256 _index) external view returns (address);\\n\\n function jobList(uint256 _index) external view returns (address);\\n\\n function governance() external returns (address);\\n\\n function pendingGovernance() external returns (address);\\n\\n function liquidityAccepted(address _liquidity) external view returns (bool);\\n\\n function liquidityPairs(uint256 _index) external view returns (address);\\n\\n // Methods\\n function getCurrentVotes(address _account) external view returns (uint256);\\n\\n function addCreditETH(address _job) external payable;\\n\\n function addCredit(\\n address _credit,\\n address _job,\\n uint256 _amount\\n ) external;\\n\\n function addVotes(address _voter, uint256 _amount) external;\\n\\n function removeVotes(address _voter, uint256 _amount) external;\\n\\n function addKPRCredit(address _job, uint256 _amount) external;\\n\\n function approveLiquidity(address _liquidity) external;\\n\\n function revokeLiquidity(address _liquidity) external;\\n\\n function pairs() external view returns (address[] memory);\\n\\n function addLiquidityToJob(\\n address _liquidity,\\n address _job,\\n uint256 _amount\\n ) external;\\n\\n function applyCreditToJob(\\n address _provider,\\n address _liquidity,\\n address _job\\n ) external;\\n\\n function unbondLiquidityFromJob(\\n address _liquidity,\\n address _job,\\n uint256 _amount\\n ) external;\\n\\n function removeLiquidityFromJob(address _liquidity, address _job) external;\\n\\n function mint(uint256 _amount) external;\\n\\n function burn(uint256 _amount) external;\\n\\n function worked(address _keeper) external;\\n\\n function receipt(\\n address _credit,\\n address _keeper,\\n uint256 _amount\\n ) external;\\n\\n function receiptETH(address _keeper, uint256 _amount) external;\\n\\n function addJob(address _job) external;\\n\\n function getJobs() external view returns (address[] memory);\\n\\n function removeJob(address _job) external;\\n\\n function setKeep3rHelper(address _keep3rHelper) external;\\n\\n function setGovernance(address _governance) external;\\n\\n function acceptGovernance() external;\\n\\n function isKeeper(address _keeper) external returns (bool);\\n\\n function isMinKeeper(\\n address _keeper,\\n uint256 _minBond,\\n uint256 _earned,\\n uint256 _age\\n ) external returns (bool);\\n\\n function isBondedKeeper(\\n address _keeper,\\n address _bond,\\n uint256 _minBond,\\n uint256 _earned,\\n uint256 _age\\n ) external returns (bool);\\n\\n function bond(address _bonding, uint256 _amount) external;\\n\\n function getKeepers() external view returns (address[] memory);\\n\\n function activate(address _bonding) external;\\n\\n function unbond(address _bonding, uint256 _amount) external;\\n\\n function slash(\\n address _bonded,\\n address _keeper,\\n uint256 _amount\\n ) external;\\n\\n function withdraw(address _bonding) external;\\n\\n function dispute(address _keeper) external;\\n\\n function revoke(address _keeper) external;\\n\\n function resolve(address _keeper) external;\\n\\n function permit(\\n address _owner,\\n address _spender,\\n uint256 _amount,\\n uint256 _deadline,\\n uint8 _v,\\n bytes32 _r,\\n bytes32 _s\\n ) external;\\n}\\n\",\"keccak256\":\"0xa9806cd6666ab1b7375ef72446964a72397fd4cefc7cc8c5b37caa7c50df0246\",\"license\":\"MIT\"},\"solidity/interfaces/peripherals/IKeep3rAccountance.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4 <0.9.0;\\n\\nimport './IKeep3rRoles.sol';\\n\\n/// @title Keep3rDisputable contract\\n/// @notice Disputes keepers, or if they're already disputed, it can resolve the case\\n/// @dev Argument `bonding` can be the address of either a token or a liquidity\\ninterface IKeep3rAccountance is IKeep3rRoles {\\n // Events\\n\\n /// @notice Emitted when the bonding process of a new keeper begins\\n /// @param _keeper The caller of Keep3rKeeperFundable#bond function\\n /// @param _bonding The asset the keeper has bonded\\n /// @param _amount The amount the keeper has bonded\\n event Bonding(address indexed _keeper, address indexed _bonding, uint256 _amount);\\n\\n /// @notice Emitted when a keeper or job begins the unbonding process to withdraw the funds\\n /// @param _keeperOrJob The keeper or job that began the unbonding process\\n /// @param _unbonding The liquidity pair or asset being unbonded\\n /// @param _amount The amount being unbonded\\n event Unbonding(address indexed _keeperOrJob, address indexed _unbonding, uint256 _amount);\\n\\n // Variables\\n\\n /// @notice Tracks the total amount of bonded KP3Rs in the contract\\n /// @return _totalBonds The total amount of bonded KP3Rs in the contract\\n function totalBonds() external view returns (uint256 _totalBonds);\\n\\n /// @notice Tracks the total KP3R earnings of a keeper since it started working\\n /// @param _keeper The address of the keeper\\n /// @return _workCompleted Total KP3R earnings of a keeper since it started working\\n function workCompleted(address _keeper) external view returns (uint256 _workCompleted);\\n\\n /// @notice Tracks when a keeper was first registered\\n /// @param _keeper The address of the keeper\\n /// @return timestamp The time at which the keeper was first registered\\n function firstSeen(address _keeper) external view returns (uint256 timestamp);\\n\\n /// @notice Tracks if a keeper or job has a pending dispute\\n /// @param _keeperOrJob The address of the keeper or job\\n /// @return _disputed Whether a keeper or job has a pending dispute\\n function disputes(address _keeperOrJob) external view returns (bool _disputed);\\n\\n /// @notice Tracks how much a keeper has bonded of a certain token\\n /// @param _keeper The address of the keeper\\n /// @param _bond The address of the token being bonded\\n /// @return _bonds Amount of a certain token that a keeper has bonded\\n function bonds(address _keeper, address _bond) external view returns (uint256 _bonds);\\n\\n /// @notice The current token credits available for a job\\n /// @param _job The address of the job\\n /// @param _token The address of the token bonded\\n /// @return _amount The amount of token credits available for a job\\n function jobTokenCredits(address _job, address _token) external view returns (uint256 _amount);\\n\\n /// @notice Tracks the amount of assets deposited in pending bonds\\n /// @param _keeper The address of the keeper\\n /// @param _bonding The address of the token being bonded\\n /// @return _pendingBonds Amount of a certain asset a keeper has unbonding\\n function pendingBonds(address _keeper, address _bonding) external view returns (uint256 _pendingBonds);\\n\\n /// @notice Tracks when a bonding for a keeper can be activated\\n /// @param _keeper The address of the keeper\\n /// @param _bonding The address of the token being bonded\\n /// @return _timestamp Time at which the bonding for a keeper can be activated\\n function canActivateAfter(address _keeper, address _bonding) external view returns (uint256 _timestamp);\\n\\n /// @notice Tracks when keeper bonds are ready to be withdrawn\\n /// @param _keeper The address of the keeper\\n /// @param _bonding The address of the token being unbonded\\n /// @return _timestamp Time at which the keeper bonds are ready to be withdrawn\\n function canWithdrawAfter(address _keeper, address _bonding) external view returns (uint256 _timestamp);\\n\\n /// @notice Tracks how much keeper bonds are to be withdrawn\\n /// @param _keeper The address of the keeper\\n /// @param _bonding The address of the token being unbonded\\n /// @return _pendingUnbonds The amount of keeper bonds that are to be withdrawn\\n function pendingUnbonds(address _keeper, address _bonding) external view returns (uint256 _pendingUnbonds);\\n\\n /// @notice Checks whether the address has ever bonded an asset\\n /// @param _keeper The address of the keeper\\n /// @return _hasBonded Whether the address has ever bonded an asset\\n function hasBonded(address _keeper) external view returns (bool _hasBonded);\\n\\n // Methods\\n\\n /// @notice Lists all jobs\\n /// @return _jobList Array with all the jobs in _jobs\\n function jobs() external view returns (address[] memory _jobList);\\n\\n /// @notice Lists all keepers\\n /// @return _keeperList Array with all the keepers in _keepers\\n function keepers() external view returns (address[] memory _keeperList);\\n\\n // Errors\\n\\n /// @notice Throws when an address is passed as a job, but that address is not a job\\n error JobUnavailable();\\n\\n /// @notice Throws when an action that requires an undisputed job is applied on a disputed job\\n error JobDisputed();\\n}\\n\",\"keccak256\":\"0xf4748c236ddf409e45e7169c735e2fc54e627b2b3ccd189ebb438ad768f1deb1\",\"license\":\"MIT\"},\"solidity/interfaces/peripherals/IKeep3rDisputable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4 <0.9.0;\\n\\n/// @title Keep3rDisputable contract\\n/// @notice Creates/resolves disputes for jobs or keepers\\n/// A disputed keeper is slashable and is not able to bond, activate, withdraw or receive direct payments\\n/// A disputed job is slashable and is not able to pay the keepers, withdraw tokens or to migrate\\ninterface IKeep3rDisputable {\\n /// @notice Emitted when a keeper or a job is disputed\\n /// @param _jobOrKeeper The address of the disputed keeper/job\\n /// @param _disputer The user that called the function and disputed the keeper\\n event Dispute(address indexed _jobOrKeeper, address indexed _disputer);\\n\\n /// @notice Emitted when a dispute is resolved\\n /// @param _jobOrKeeper The address of the disputed keeper/job\\n /// @param _resolver The user that called the function and resolved the dispute\\n event Resolve(address indexed _jobOrKeeper, address indexed _resolver);\\n\\n /// @notice Throws when a job or keeper is already disputed\\n error AlreadyDisputed();\\n\\n /// @notice Throws when a job or keeper is not disputed and someone tries to resolve the dispute\\n error NotDisputed();\\n\\n /// @notice Allows governor to create a dispute for a given keeper/job\\n /// @param _jobOrKeeper The address in dispute\\n function dispute(address _jobOrKeeper) external;\\n\\n /// @notice Allows governor to resolve a dispute on a keeper/job\\n /// @param _jobOrKeeper The address cleared\\n function resolve(address _jobOrKeeper) external;\\n}\\n\",\"keccak256\":\"0xdfdabcecbed06fcb2eb1b80e6a61d681afecd1f75c58a888451de7927b10c3b2\",\"license\":\"MIT\"},\"solidity/interfaces/peripherals/IKeep3rJobs.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4 <0.9.0;\\n\\nimport './IKeep3rDisputable.sol';\\n\\n/// @title Keep3rJobOwnership contract\\n/// @notice Handles the ownership of the jobs\\ninterface IKeep3rJobOwnership {\\n // Events\\n\\n /// @notice Emitted when Keep3rJobOwnership#changeJobOwnership is called\\n /// @param _job The address of the job proposed to have a change of owner\\n /// @param _owner The current owner of the job\\n /// @param _pendingOwner The new address proposed to be the owner of the job\\n event JobOwnershipChange(address indexed _job, address indexed _owner, address indexed _pendingOwner);\\n\\n /// @notice Emitted when Keep3rJobOwnership#JobOwnershipAssent is called\\n /// @param _job The address of the job which the proposed owner will now own\\n /// @param _previousOwner The previous owner of the job\\n /// @param _newOwner The new owner of the job\\n event JobOwnershipAssent(address indexed _job, address indexed _previousOwner, address indexed _newOwner);\\n\\n // Errors\\n\\n /// @notice Throws when the caller of the function is not the job owner\\n error OnlyJobOwner();\\n\\n /// @notice Throws when the caller of the function is not the pending job owner\\n error OnlyPendingJobOwner();\\n\\n // Variables\\n\\n /// @notice Maps the job to the owner of the job\\n /// @param _job The address of the job\\n /// @return _owner The address of the owner of the job\\n function jobOwner(address _job) external view returns (address _owner);\\n\\n /// @notice Maps the job to its pending owner\\n /// @param _job The address of the job\\n /// @return _pendingOwner The address of the pending owner of the job\\n function jobPendingOwner(address _job) external view returns (address _pendingOwner);\\n\\n // Methods\\n\\n /// @notice Proposes a new address to be the owner of the job\\n /// @param _job The address of the job\\n /// @param _newOwner The address of the proposed new owner\\n function changeJobOwnership(address _job, address _newOwner) external;\\n\\n /// @notice The proposed address accepts to be the owner of the job\\n /// @param _job The address of the job\\n function acceptJobOwnership(address _job) external;\\n}\\n\\n/// @title Keep3rJobManager contract\\n/// @notice Handles the addition and withdrawal of credits from a job\\ninterface IKeep3rJobManager is IKeep3rJobOwnership {\\n // Events\\n\\n /// @notice Emitted when Keep3rJobManager#addJob is called\\n /// @param _job The address of the job to add\\n /// @param _jobOwner The job's owner\\n event JobAddition(address indexed _job, address indexed _jobOwner);\\n\\n // Errors\\n\\n /// @notice Throws when trying to add a job that has already been added\\n error JobAlreadyAdded();\\n\\n /// @notice Throws when the address that is trying to register as a keeper is already a keeper\\n error AlreadyAKeeper();\\n\\n // Methods\\n\\n /// @notice Allows any caller to add a new job\\n /// @param _job Address of the contract for which work should be performed\\n function addJob(address _job) external;\\n}\\n\\n/// @title Keep3rJobFundableCredits contract\\n/// @notice Handles the addition and withdrawal of credits from a job\\ninterface IKeep3rJobFundableCredits is IKeep3rJobOwnership {\\n // Events\\n\\n /// @notice Emitted when Keep3rJobFundableCredits#addTokenCreditsToJob is called\\n /// @param _job The address of the job being credited\\n /// @param _token The address of the token being provided\\n /// @param _provider The user that calls the function\\n /// @param _amount The amount of credit being added to the job\\n event TokenCreditAddition(address indexed _job, address indexed _token, address indexed _provider, uint256 _amount);\\n\\n /// @notice Emitted when Keep3rJobFundableCredits#withdrawTokenCreditsFromJob is called\\n /// @param _job The address of the job from which the credits are withdrawn\\n /// @param _token The credit being withdrawn from the job\\n /// @param _receiver The user that receives the tokens\\n /// @param _amount The amount of credit withdrawn\\n event TokenCreditWithdrawal(address indexed _job, address indexed _token, address indexed _receiver, uint256 _amount);\\n\\n // Errors\\n\\n /// @notice Throws when the token is KP3R, as it should not be used for direct token payments\\n error TokenUnallowed();\\n\\n /// @notice Throws when the token withdraw cooldown has not yet passed\\n error JobTokenCreditsLocked();\\n\\n /// @notice Throws when the user tries to withdraw more tokens than it has\\n error InsufficientJobTokenCredits();\\n\\n // Variables\\n\\n /// @notice Last block where tokens were added to the job\\n /// @param _job The address of the job credited\\n /// @param _token The address of the token credited\\n /// @return _timestamp The last block where tokens were added to the job\\n function jobTokenCreditsAddedAt(address _job, address _token) external view returns (uint256 _timestamp);\\n\\n // Methods\\n\\n /// @notice Add credit to a job to be paid out for work\\n /// @param _job The address of the job being credited\\n /// @param _token The address of the token being credited\\n /// @param _amount The amount of credit being added\\n function addTokenCreditsToJob(\\n address _job,\\n address _token,\\n uint256 _amount\\n ) external;\\n\\n /// @notice Withdraw credit from a job\\n /// @param _job The address of the job from which the credits are withdrawn\\n /// @param _token The address of the token being withdrawn\\n /// @param _amount The amount of token to be withdrawn\\n /// @param _receiver The user that will receive tokens\\n function withdrawTokenCreditsFromJob(\\n address _job,\\n address _token,\\n uint256 _amount,\\n address _receiver\\n ) external;\\n}\\n\\n/// @title Keep3rJobFundableLiquidity contract\\n/// @notice Handles the funding of jobs through specific liquidity pairs\\ninterface IKeep3rJobFundableLiquidity is IKeep3rJobOwnership {\\n // Events\\n\\n /// @notice Emitted when Keep3rJobFundableLiquidity#approveLiquidity function is called\\n /// @param _liquidity The address of the liquidity pair being approved\\n event LiquidityApproval(address _liquidity);\\n\\n /// @notice Emitted when Keep3rJobFundableLiquidity#revokeLiquidity function is called\\n /// @param _liquidity The address of the liquidity pair being revoked\\n event LiquidityRevocation(address _liquidity);\\n\\n /// @notice Emitted when IKeep3rJobFundableLiquidity#addLiquidityToJob function is called\\n /// @param _job The address of the job to which liquidity will be added\\n /// @param _liquidity The address of the liquidity being added\\n /// @param _provider The user that calls the function\\n /// @param _amount The amount of liquidity being added\\n event LiquidityAddition(address indexed _job, address indexed _liquidity, address indexed _provider, uint256 _amount);\\n\\n /// @notice Emitted when IKeep3rJobFundableLiquidity#withdrawLiquidityFromJob function is called\\n /// @param _job The address of the job of which liquidity will be withdrawn from\\n /// @param _liquidity The address of the liquidity being withdrawn\\n /// @param _receiver The receiver of the liquidity tokens\\n /// @param _amount The amount of liquidity being withdrawn from the job\\n event LiquidityWithdrawal(address indexed _job, address indexed _liquidity, address indexed _receiver, uint256 _amount);\\n\\n /// @notice Emitted when Keep3rJobFundableLiquidity#addLiquidityToJob function is called\\n /// @param _job The address of the job whose credits will be updated\\n /// @param _rewardedAt The time at which the job was last rewarded\\n /// @param _currentCredits The current credits of the job\\n /// @param _periodCredits The credits of the job for the current period\\n event LiquidityCreditsReward(address indexed _job, uint256 _rewardedAt, uint256 _currentCredits, uint256 _periodCredits);\\n\\n /// @notice Emitted when Keep3rJobFundableLiquidity#forceLiquidityCreditsToJob function is called\\n /// @param _job The address of the job whose credits will be updated\\n /// @param _rewardedAt The time at which the job was last rewarded\\n /// @param _currentCredits The current credits of the job\\n event LiquidityCreditsForced(address indexed _job, uint256 _rewardedAt, uint256 _currentCredits);\\n\\n // Errors\\n\\n /// @notice Throws when the liquidity being approved has already been approved\\n error LiquidityPairApproved();\\n\\n /// @notice Throws when the liquidity being removed has not been approved\\n error LiquidityPairUnexistent();\\n\\n /// @notice Throws when trying to add liquidity to an unapproved pool\\n error LiquidityPairUnapproved();\\n\\n /// @notice Throws when the job doesn't have the requested liquidity\\n error JobLiquidityUnexistent();\\n\\n /// @notice Throws when trying to remove more liquidity than the job has\\n error JobLiquidityInsufficient();\\n\\n /// @notice Throws when trying to add less liquidity than the minimum liquidity required\\n error JobLiquidityLessThanMin();\\n\\n // Structs\\n\\n /// @notice Stores the tick information of the different liquidity pairs\\n struct TickCache {\\n int56 current; // Tracks the current tick\\n int56 difference; // Stores the difference between the current tick and the last tick\\n uint256 period; // Stores the period at which the last observation was made\\n }\\n\\n // Variables\\n\\n /// @notice Lists liquidity pairs\\n /// @return _list An array of addresses with all the approved liquidity pairs\\n function approvedLiquidities() external view returns (address[] memory _list);\\n\\n /// @notice Amount of liquidity in a specified job\\n /// @param _job The address of the job being checked\\n /// @param _liquidity The address of the liquidity we are checking\\n /// @return _amount Amount of liquidity in the specified job\\n function liquidityAmount(address _job, address _liquidity) external view returns (uint256 _amount);\\n\\n /// @notice Last time the job was rewarded liquidity credits\\n /// @param _job The address of the job being checked\\n /// @return _timestamp Timestamp of the last time the job was rewarded liquidity credits\\n function rewardedAt(address _job) external view returns (uint256 _timestamp);\\n\\n /// @notice Last time the job was worked\\n /// @param _job The address of the job being checked\\n /// @return _timestamp Timestamp of the last time the job was worked\\n function workedAt(address _job) external view returns (uint256 _timestamp);\\n\\n // Methods\\n\\n /// @notice Returns the liquidity credits of a given job\\n /// @param _job The address of the job of which we want to know the liquidity credits\\n /// @return _amount The liquidity credits of a given job\\n function jobLiquidityCredits(address _job) external view returns (uint256 _amount);\\n\\n /// @notice Returns the credits of a given job for the current period\\n /// @param _job The address of the job of which we want to know the period credits\\n /// @return _amount The credits the given job has at the current period\\n function jobPeriodCredits(address _job) external view returns (uint256 _amount);\\n\\n /// @notice Calculates the total credits of a given job\\n /// @param _job The address of the job of which we want to know the total credits\\n /// @return _amount The total credits of the given job\\n function totalJobCredits(address _job) external view returns (uint256 _amount);\\n\\n /// @notice Calculates how many credits should be rewarded periodically for a given liquidity amount\\n /// @dev _periodCredits = underlying KP3Rs for given liquidity amount * rewardPeriod / inflationPeriod\\n /// @param _liquidity The address of the liquidity to provide\\n /// @param _amount The amount of liquidity to provide\\n /// @return _periodCredits The amount of KP3R periodically minted for the given liquidity\\n function quoteLiquidity(address _liquidity, uint256 _amount) external view returns (uint256 _periodCredits);\\n\\n /// @notice Observes the current state of the liquidity pair being observed and updates TickCache with the information\\n /// @param _liquidity The address of the liquidity pair being observed\\n /// @return _tickCache The updated TickCache\\n function observeLiquidity(address _liquidity) external view returns (TickCache memory _tickCache);\\n\\n /// @notice Gifts liquidity credits to the specified job\\n /// @param _job The address of the job being credited\\n /// @param _amount The amount of liquidity credits to gift\\n function forceLiquidityCreditsToJob(address _job, uint256 _amount) external;\\n\\n /// @notice Approve a liquidity pair for being accepted in future\\n /// @param _liquidity The address of the liquidity accepted\\n function approveLiquidity(address _liquidity) external;\\n\\n /// @notice Revoke a liquidity pair from being accepted in future\\n /// @param _liquidity The liquidity no longer accepted\\n function revokeLiquidity(address _liquidity) external;\\n\\n /// @notice Allows anyone to fund a job with liquidity\\n /// @param _job The address of the job to assign liquidity to\\n /// @param _liquidity The liquidity being added\\n /// @param _amount The amount of liquidity tokens to add\\n function addLiquidityToJob(\\n address _job,\\n address _liquidity,\\n uint256 _amount\\n ) external;\\n\\n /// @notice Unbond liquidity for a job\\n /// @dev Can only be called by the job's owner\\n /// @param _job The address of the job being unbonded from\\n /// @param _liquidity The liquidity being unbonded\\n /// @param _amount The amount of liquidity being removed\\n function unbondLiquidityFromJob(\\n address _job,\\n address _liquidity,\\n uint256 _amount\\n ) external;\\n\\n /// @notice Withdraw liquidity from a job\\n /// @param _job The address of the job being withdrawn from\\n /// @param _liquidity The liquidity being withdrawn\\n /// @param _receiver The address that will receive the withdrawn liquidity\\n function withdrawLiquidityFromJob(\\n address _job,\\n address _liquidity,\\n address _receiver\\n ) external;\\n}\\n\\n/// @title Keep3rJobMigration contract\\n/// @notice Handles the migration process of jobs to different addresses\\ninterface IKeep3rJobMigration is IKeep3rJobFundableCredits, IKeep3rJobFundableLiquidity {\\n // Events\\n\\n /// @notice Emitted when Keep3rJobMigration#migrateJob function is called\\n /// @param _fromJob The address of the job that requests to migrate\\n /// @param _toJob The address at which the job requests to migrate\\n event JobMigrationRequested(address indexed _fromJob, address _toJob);\\n\\n /// @notice Emitted when Keep3rJobMigration#acceptJobMigration function is called\\n /// @param _fromJob The address of the job that requested to migrate\\n /// @param _toJob The address at which the job had requested to migrate\\n event JobMigrationSuccessful(address _fromJob, address indexed _toJob);\\n\\n // Errors\\n\\n /// @notice Throws when the address of the job that requests to migrate wants to migrate to its same address\\n error JobMigrationImpossible();\\n\\n /// @notice Throws when the _toJob address differs from the address being tracked in the pendingJobMigrations mapping\\n error JobMigrationUnavailable();\\n\\n /// @notice Throws when cooldown between migrations has not yet passed\\n error JobMigrationLocked();\\n\\n // Variables\\n\\n /// @notice Maps the jobs that have requested a migration to the address they have requested to migrate to\\n /// @return _toJob The address to which the job has requested to migrate to\\n function pendingJobMigrations(address _fromJob) external view returns (address _toJob);\\n\\n // Methods\\n\\n /// @notice Initializes the migration process for a job by adding the request to the pendingJobMigrations mapping\\n /// @param _fromJob The address of the job that is requesting to migrate\\n /// @param _toJob The address at which the job is requesting to migrate\\n function migrateJob(address _fromJob, address _toJob) external;\\n\\n /// @notice Completes the migration process for a job\\n /// @dev Unbond/withdraw process doesn't get migrated\\n /// @param _fromJob The address of the job that requested to migrate\\n /// @param _toJob The address to which the job wants to migrate to\\n function acceptJobMigration(address _fromJob, address _toJob) external;\\n}\\n\\n/// @title Keep3rJobWorkable contract\\n/// @notice Handles the mechanisms jobs can pay keepers with along with the restrictions jobs can put on keepers before they can work on jobs\\ninterface IKeep3rJobWorkable is IKeep3rJobMigration {\\n // Events\\n\\n /// @notice Emitted when a keeper is validated before a job\\n /// @param _gasLeft The amount of gas that the transaction has left at the moment of keeper validation\\n event KeeperValidation(uint256 _gasLeft);\\n\\n /// @notice Emitted when a keeper works a job\\n /// @param _credit The address of the asset in which the keeper is paid\\n /// @param _job The address of the job the keeper has worked\\n /// @param _keeper The address of the keeper that has worked the job\\n /// @param _payment The amount that has been paid out to the keeper in exchange for working the job\\n /// @param _gasLeft The amount of gas that the transaction has left at the moment of payment\\n event KeeperWork(address indexed _credit, address indexed _job, address indexed _keeper, uint256 _payment, uint256 _gasLeft);\\n\\n // Errors\\n\\n /// @notice Throws if work method was called without calling isKeeper or isBondedKeeper\\n error GasNotInitialized();\\n\\n /// @notice Throws if the address claiming to be a job is not in the list of approved jobs\\n error JobUnapproved();\\n\\n /// @notice Throws if the amount of funds in the job is less than the payment that must be paid to the keeper that works that job\\n error InsufficientFunds();\\n\\n // Methods\\n\\n /// @notice Confirms if the current keeper is registered\\n /// @dev Can be used for general (non critical) functions\\n /// @param _keeper The keeper being investigated\\n /// @return _isKeeper Whether the address passed as a parameter is a keeper or not\\n function isKeeper(address _keeper) external returns (bool _isKeeper);\\n\\n /// @notice Confirms if the current keeper is registered and has a minimum bond of any asset.\\n /// @dev Should be used for protected functions\\n /// @param _keeper The keeper to check\\n /// @param _bond The bond token being evaluated\\n /// @param _minBond The minimum amount of bonded tokens\\n /// @param _earned The minimum funds earned in the keepers lifetime\\n /// @param _age The minimum keeper age required\\n /// @return _isBondedKeeper Whether the `_keeper` meets the given requirements\\n function isBondedKeeper(\\n address _keeper,\\n address _bond,\\n uint256 _minBond,\\n uint256 _earned,\\n uint256 _age\\n ) external returns (bool _isBondedKeeper);\\n\\n /// @notice Implemented by jobs to show that a keeper performed work\\n /// @dev Automatically calculates the payment for the keeper and pays the keeper with bonded KP3R\\n /// @param _keeper Address of the keeper that performed the work\\n function worked(address _keeper) external;\\n\\n /// @notice Implemented by jobs to show that a keeper performed work\\n /// @dev Pays the keeper that performs the work with KP3R\\n /// @param _keeper Address of the keeper that performed the work\\n /// @param _payment The reward that should be allocated for the job\\n function bondedPayment(address _keeper, uint256 _payment) external;\\n\\n /// @notice Implemented by jobs to show that a keeper performed work\\n /// @dev Pays the keeper that performs the work with a specific token\\n /// @param _token The asset being awarded to the keeper\\n /// @param _keeper Address of the keeper that performed the work\\n /// @param _amount The reward that should be allocated\\n function directTokenPayment(\\n address _token,\\n address _keeper,\\n uint256 _amount\\n ) external;\\n}\\n\\n/// @title Keep3rJobDisputable contract\\n/// @notice Handles the actions that can be taken on a disputed job\\ninterface IKeep3rJobDisputable is IKeep3rDisputable, IKeep3rJobFundableCredits, IKeep3rJobFundableLiquidity {\\n // Events\\n\\n /// @notice Emitted when Keep3rJobDisputable#slashTokenFromJob is called\\n /// @param _job The address of the job from which the token will be slashed\\n /// @param _token The address of the token being slashed\\n /// @param _slasher The user that slashes the token\\n /// @param _amount The amount of the token being slashed\\n event JobSlashToken(address indexed _job, address _token, address indexed _slasher, uint256 _amount);\\n\\n /// @notice Emitted when Keep3rJobDisputable#slashLiquidityFromJob is called\\n /// @param _job The address of the job from which the liquidity will be slashed\\n /// @param _liquidity The address of the liquidity being slashed\\n /// @param _slasher The user that slashes the liquidity\\n /// @param _amount The amount of the liquidity being slashed\\n event JobSlashLiquidity(address indexed _job, address _liquidity, address indexed _slasher, uint256 _amount);\\n\\n // Errors\\n\\n /// @notice Throws when the token trying to be slashed doesn't exist\\n error JobTokenUnexistent();\\n\\n /// @notice Throws when someone tries to slash more tokens than the job has\\n error JobTokenInsufficient();\\n\\n // Methods\\n\\n /// @notice Allows governor or slasher to slash a job specific token\\n /// @param _job The address of the job from which the token will be slashed\\n /// @param _token The address of the token that will be slashed\\n /// @param _amount The amount of the token that will be slashed\\n function slashTokenFromJob(\\n address _job,\\n address _token,\\n uint256 _amount\\n ) external;\\n\\n /// @notice Allows governor or slasher to slash liquidity from a job\\n /// @param _job The address being slashed\\n /// @param _liquidity The address of the liquidity that will be slashed\\n /// @param _amount The amount of liquidity that will be slashed\\n function slashLiquidityFromJob(\\n address _job,\\n address _liquidity,\\n uint256 _amount\\n ) external;\\n}\\n\\n// solhint-disable-next-line no-empty-blocks\\ninterface IKeep3rJobs is IKeep3rJobWorkable, IKeep3rJobManager, IKeep3rJobDisputable {\\n\\n}\\n\",\"keccak256\":\"0x7fb7153d88e9e65d28b278320884517d6b423b2e8cfc78ee0ee16bc04073278e\",\"license\":\"MIT\"},\"solidity/interfaces/peripherals/IKeep3rKeepers.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4 <0.9.0;\\n\\nimport './IKeep3rDisputable.sol';\\n\\n/// @title Keep3rKeeperFundable contract\\n/// @notice Handles the actions required to become a keeper\\ninterface IKeep3rKeeperFundable {\\n // Events\\n\\n /// @notice Emitted when Keep3rKeeperFundable#activate is called\\n /// @param _keeper The keeper that has been activated\\n /// @param _bond The asset the keeper has bonded\\n /// @param _amount The amount of the asset the keeper has bonded\\n event Activation(address indexed _keeper, address indexed _bond, uint256 _amount);\\n\\n /// @notice Emitted when Keep3rKeeperFundable#withdraw is called\\n /// @param _keeper The caller of Keep3rKeeperFundable#withdraw function\\n /// @param _bond The asset to withdraw from the bonding pool\\n /// @param _amount The amount of funds withdrawn\\n event Withdrawal(address indexed _keeper, address indexed _bond, uint256 _amount);\\n\\n // Errors\\n\\n /// @notice Throws when the address that is trying to register as a job is already a job\\n error AlreadyAJob();\\n\\n // Methods\\n\\n /// @notice Beginning of the bonding process\\n /// @param _bonding The asset being bonded\\n /// @param _amount The amount of bonding asset being bonded\\n function bond(address _bonding, uint256 _amount) external;\\n\\n /// @notice Beginning of the unbonding process\\n /// @param _bonding The asset being unbonded\\n /// @param _amount Allows for partial unbonding\\n function unbond(address _bonding, uint256 _amount) external;\\n\\n /// @notice End of the bonding process after bonding time has passed\\n /// @param _bonding The asset being activated as bond collateral\\n function activate(address _bonding) external;\\n\\n /// @notice Withdraw funds after unbonding has finished\\n /// @param _bonding The asset to withdraw from the bonding pool\\n function withdraw(address _bonding) external;\\n}\\n\\n/// @title Keep3rKeeperDisputable contract\\n/// @notice Handles the actions that can be taken on a disputed keeper\\ninterface IKeep3rKeeperDisputable is IKeep3rDisputable, IKeep3rKeeperFundable {\\n // Events\\n\\n /// @notice Emitted when Keep3rKeeperDisputable#slash is called\\n /// @param _keeper The address of the slashed keeper\\n /// @param _slasher The user that called Keep3rKeeperDisputable#slash\\n /// @param _amount The amount of credits slashed from the keeper\\n event KeeperSlash(address indexed _keeper, address indexed _slasher, uint256 _amount);\\n\\n /// @notice Emitted when Keep3rKeeperDisputable#revoke is called\\n /// @param _keeper The address of the revoked keeper\\n /// @param _slasher The user that called Keep3rKeeperDisputable#revoke\\n event KeeperRevoke(address indexed _keeper, address indexed _slasher);\\n\\n // Methods\\n\\n /// @notice Allows governor to slash a keeper based on a dispute\\n /// @param _keeper The address being slashed\\n /// @param _bonded The asset being slashed\\n /// @param _bondAmount The bonded amount being slashed\\n /// @param _unbondAmount The pending unbond amount being slashed\\n function slash(\\n address _keeper,\\n address _bonded,\\n uint256 _bondAmount,\\n uint256 _unbondAmount\\n ) external;\\n\\n /// @notice Blacklists a keeper from participating in the network\\n /// @param _keeper The address being slashed\\n function revoke(address _keeper) external;\\n}\\n\\n// solhint-disable-next-line no-empty-blocks\\n\\n/// @title Keep3rKeepers contract\\ninterface IKeep3rKeepers is IKeep3rKeeperDisputable {\\n\\n}\\n\",\"keccak256\":\"0x8fe10565035bb918b2b1c7d730533bcfe9ec79078f28544852f8178e76302562\",\"license\":\"MIT\"},\"solidity/interfaces/peripherals/IKeep3rParameters.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4 <0.9.0;\\n\\nimport './IKeep3rAccountance.sol';\\n\\n/// @title Keep3rParameters contract\\n/// @notice Handles and sets all the required parameters for Keep3r\\ninterface IKeep3rParameters is IKeep3rAccountance {\\n // Events\\n\\n /// @notice Emitted when the Keep3rHelper address is changed\\n /// @param _keep3rHelper The address of Keep3rHelper's contract\\n event Keep3rHelperChange(address _keep3rHelper);\\n\\n /// @notice Emitted when the Keep3rV1 address is changed\\n /// @param _keep3rV1 The address of Keep3rV1's contract\\n event Keep3rV1Change(address _keep3rV1);\\n\\n /// @notice Emitted when the Keep3rV1Proxy address is changed\\n /// @param _keep3rV1Proxy The address of Keep3rV1Proxy's contract\\n event Keep3rV1ProxyChange(address _keep3rV1Proxy);\\n\\n /// @notice Emitted when bondTime is changed\\n /// @param _bondTime The new bondTime\\n event BondTimeChange(uint256 _bondTime);\\n\\n /// @notice Emitted when _liquidityMinimum is changed\\n /// @param _liquidityMinimum The new _liquidityMinimum\\n event LiquidityMinimumChange(uint256 _liquidityMinimum);\\n\\n /// @notice Emitted when _unbondTime is changed\\n /// @param _unbondTime The new _unbondTime\\n event UnbondTimeChange(uint256 _unbondTime);\\n\\n /// @notice Emitted when _rewardPeriodTime is changed\\n /// @param _rewardPeriodTime The new _rewardPeriodTime\\n event RewardPeriodTimeChange(uint256 _rewardPeriodTime);\\n\\n /// @notice Emitted when the inflationPeriod is changed\\n /// @param _inflationPeriod The new inflationPeriod\\n event InflationPeriodChange(uint256 _inflationPeriod);\\n\\n /// @notice Emitted when the fee is changed\\n /// @param _fee The new token credits fee\\n event FeeChange(uint256 _fee);\\n\\n // Variables\\n\\n /// @notice Address of Keep3rHelper's contract\\n /// @return _keep3rHelper The address of Keep3rHelper's contract\\n function keep3rHelper() external view returns (address _keep3rHelper);\\n\\n /// @notice Address of Keep3rV1's contract\\n /// @return _keep3rV1 The address of Keep3rV1's contract\\n function keep3rV1() external view returns (address _keep3rV1);\\n\\n /// @notice Address of Keep3rV1Proxy's contract\\n /// @return _keep3rV1Proxy The address of Keep3rV1Proxy's contract\\n function keep3rV1Proxy() external view returns (address _keep3rV1Proxy);\\n\\n /// @notice The amount of time required to pass after a keeper has bonded assets for it to be able to activate\\n /// @return _days The required bondTime in days\\n function bondTime() external view returns (uint256 _days);\\n\\n /// @notice The amount of time required to pass before a keeper can unbond what he has bonded\\n /// @return _days The required unbondTime in days\\n function unbondTime() external view returns (uint256 _days);\\n\\n /// @notice The minimum amount of liquidity required to fund a job per liquidity\\n /// @return _amount The minimum amount of liquidity in KP3R\\n function liquidityMinimum() external view returns (uint256 _amount);\\n\\n /// @notice The amount of time between each scheduled credits reward given to a job\\n /// @return _days The reward period in days\\n function rewardPeriodTime() external view returns (uint256 _days);\\n\\n /// @notice The inflation period is the denominator used to regulate the emission of KP3R\\n /// @return _period The denominator used to regulate the emission of KP3R\\n function inflationPeriod() external view returns (uint256 _period);\\n\\n /// @notice The fee to be sent to governor when a user adds liquidity to a job\\n /// @return _amount The fee amount to be sent to governor when a user adds liquidity to a job\\n function fee() external view returns (uint256 _amount);\\n\\n // Errors\\n\\n /// @notice Throws if the reward period is less than the minimum reward period time\\n error MinRewardPeriod();\\n\\n /// @notice Throws if either a job or a keeper is disputed\\n error Disputed();\\n\\n /// @notice Throws if there are no bonded assets\\n error BondsUnexistent();\\n\\n /// @notice Throws if the time required to bond an asset has not passed yet\\n error BondsLocked();\\n\\n /// @notice Throws if there are no bonds to withdraw\\n error UnbondsUnexistent();\\n\\n /// @notice Throws if the time required to withdraw the bonds has not passed yet\\n error UnbondsLocked();\\n\\n // Methods\\n\\n /// @notice Sets the Keep3rHelper address\\n /// @param _keep3rHelper The Keep3rHelper address\\n function setKeep3rHelper(address _keep3rHelper) external;\\n\\n /// @notice Sets the Keep3rV1 address\\n /// @param _keep3rV1 The Keep3rV1 address\\n function setKeep3rV1(address _keep3rV1) external;\\n\\n /// @notice Sets the Keep3rV1Proxy address\\n /// @param _keep3rV1Proxy The Keep3rV1Proxy address\\n function setKeep3rV1Proxy(address _keep3rV1Proxy) external;\\n\\n /// @notice Sets the bond time required to activate as a keeper\\n /// @param _bond The new bond time\\n function setBondTime(uint256 _bond) external;\\n\\n /// @notice Sets the unbond time required unbond what has been bonded\\n /// @param _unbond The new unbond time\\n function setUnbondTime(uint256 _unbond) external;\\n\\n /// @notice Sets the minimum amount of liquidity required to fund a job\\n /// @param _liquidityMinimum The new minimum amount of liquidity\\n function setLiquidityMinimum(uint256 _liquidityMinimum) external;\\n\\n /// @notice Sets the time required to pass between rewards for jobs\\n /// @param _rewardPeriodTime The new amount of time required to pass between rewards\\n function setRewardPeriodTime(uint256 _rewardPeriodTime) external;\\n\\n /// @notice Sets the new inflation period\\n /// @param _inflationPeriod The new inflation period\\n function setInflationPeriod(uint256 _inflationPeriod) external;\\n\\n /// @notice Sets the new fee\\n /// @param _fee The new fee\\n function setFee(uint256 _fee) external;\\n}\\n\",\"keccak256\":\"0x2a847a2ab6dbee960ca84e142ad9c578d8953c4adf1d3221669400ea86c9b82e\",\"license\":\"MIT\"},\"solidity/interfaces/peripherals/IKeep3rRoles.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4 <0.9.0;\\n\\nimport '@defi-wonderland/solidity-utils/solidity/interfaces/IBaseErrors.sol';\\nimport '@defi-wonderland/solidity-utils/solidity/interfaces/IGovernable.sol';\\nimport '@defi-wonderland/solidity-utils/solidity/interfaces/IDustCollector.sol';\\n\\n/// @title Keep3rRoles contract\\n/// @notice Manages the Keep3r specific roles\\ninterface IKeep3rRoles is IBaseErrors, IGovernable, IDustCollector {\\n // Events\\n\\n /// @notice Emitted when a slasher is added\\n /// @param _slasher Address of the added slasher\\n event SlasherAdded(address _slasher);\\n\\n /// @notice Emitted when a slasher is removed\\n /// @param _slasher Address of the removed slasher\\n event SlasherRemoved(address _slasher);\\n\\n /// @notice Emitted when a disputer is added\\n /// @param _disputer Address of the added disputer\\n event DisputerAdded(address _disputer);\\n\\n /// @notice Emitted when a disputer is removed\\n /// @param _disputer Address of the removed disputer\\n event DisputerRemoved(address _disputer);\\n\\n // Variables\\n\\n /// @notice Tracks whether the address is a slasher or not\\n /// @param _slasher Address being checked as a slasher\\n /// @return _isSlasher Whether the address is a slasher or not\\n function slashers(address _slasher) external view returns (bool _isSlasher);\\n\\n /// @notice Tracks whether the address is a disputer or not\\n /// @param _disputer Address being checked as a disputer\\n /// @return _isDisputer Whether the address is a disputer or not\\n function disputers(address _disputer) external view returns (bool _isDisputer);\\n\\n // Errors\\n\\n /// @notice Throws if the address is already a registered slasher\\n error SlasherExistent();\\n\\n /// @notice Throws if caller is not a registered slasher\\n error SlasherUnexistent();\\n\\n /// @notice Throws if the address is already a registered disputer\\n error DisputerExistent();\\n\\n /// @notice Throws if caller is not a registered disputer\\n error DisputerUnexistent();\\n\\n /// @notice Throws if the msg.sender is not a slasher or is not a part of governance\\n error OnlySlasher();\\n\\n /// @notice Throws if the msg.sender is not a disputer or is not a part of governance\\n error OnlyDisputer();\\n\\n // Methods\\n\\n /// @notice Registers a slasher by updating the slashers mapping\\n function addSlasher(address _slasher) external;\\n\\n /// @notice Removes a slasher by updating the slashers mapping\\n function removeSlasher(address _slasher) external;\\n\\n /// @notice Registers a disputer by updating the disputers mapping\\n function addDisputer(address _disputer) external;\\n\\n /// @notice Removes a disputer by updating the disputers mapping\\n function removeDisputer(address _disputer) external;\\n}\\n\",\"keccak256\":\"0xc0a19b0dfac535cbffabc0d76cb0569618dedb922b0413bc12358efa47dc32bf\",\"license\":\"MIT\"},\"solidity/interfaces/sidechain/IKeep3rHelperSidechain.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4 <0.9.0;\\n\\nimport '../IKeep3rHelper.sol';\\n\\n/// @title Keep3rHelperSidechain contract\\n/// @notice Contains all the helper functions for sidechain keep3r implementations\\ninterface IKeep3rHelperSidechain is IKeep3rHelper {\\n // Structs\\n\\n /// @dev WETH-USD Pool address, isWETHToken0 and usdDecimals\\n /// @dev Created in order to quote any kind of USD tokens\\n struct WethUsdOraclePool {\\n address poolAddress;\\n bool isWETHToken0;\\n uint8 usdDecimals;\\n }\\n\\n // Events\\n\\n /// @notice The oracle for a liquidity has been saved\\n /// @param _liquidity The address of the given liquidity\\n /// @param _oraclePool The address of the oracle pool\\n event OracleSet(address _liquidity, address _oraclePool);\\n\\n /// @notice Emitted when the WETH USD pool is changed\\n /// @param _address Address of the new WETH USD pool\\n /// @param _isWETHToken0 True if calling the token0 method of the pool returns the WETH token address\\n /// @param _usdDecimals The amount of decimals of the USD token paired with ETH\\n event WethUSDPoolChange(address _address, bool _isWETHToken0, uint8 _usdDecimals);\\n\\n /// Variables\\n\\n /// @notice Ethereum mainnet WETH address used for quoting references\\n /// @return _weth Address of WETH token\\n // solhint-disable func-name-mixedcase\\n function WETH() external view returns (address _weth);\\n\\n /// @return _oracle The address of the observable pool for given liquidity\\n function oracle(address _liquidity) external view returns (address _oracle);\\n\\n /// @notice WETH-USD pool that is being used as oracle\\n /// @return poolAddress Address of the pool\\n /// @return isWETHToken0 True if calling the token0 method of the pool returns the WETH token address\\n /// @return usdDecimals The amount of decimals of the USD token paired with ETH\\n function wethUSDPool()\\n external\\n view\\n returns (\\n address poolAddress,\\n bool isWETHToken0,\\n uint8 usdDecimals\\n );\\n\\n /// @notice Quotes USD to ETH\\n /// @dev Used to know how much ETH should be paid to keepers before converting it from ETH to KP3R\\n /// @param _usd The amount of USD to quote to ETH\\n /// @return _eth The resulting amount of ETH after quoting the USD\\n function quoteUsdToEth(uint256 _usd) external returns (uint256 _eth);\\n\\n /// Methods\\n\\n /// @notice Sets an oracle for a given liquidity\\n /// @param _liquidity The address of the liquidity\\n /// @param _oracle The address of the pool used to quote the liquidity from\\n /// @dev The oracle must contain KP3R as either token0 or token1\\n function setOracle(address _liquidity, address _oracle) external;\\n\\n /// @notice Sets an oracle for querying WETH/USD quote\\n /// @param _poolAddress The address of the pool used as oracle\\n /// @param _usdDecimals The amount of decimals of the USD token paired with ETH\\n /// @dev The oracle must contain WETH as either token0 or token1\\n function setWethUsdPool(address _poolAddress, uint8 _usdDecimals) external;\\n}\\n\",\"keccak256\":\"0xf354f6c4182f4f91ccb3cabe823bc28cdc1a8cb20c40266e6b6e277279fc7b56\",\"license\":\"MIT\"}},\"version\":1}", + "bytecode": "0x60c0604052612af8600255612ee0600355680ad78ebc5ac62000006004556184d06005556006805463ffffffff191661025817905564037e11d60060075563773594006008553480156200005257600080fd5b50604051620028c6380380620028c683398101604081905262000075916200041c565b8487878583838383816001600160a01b038116620000a65760405163d92e233d60e01b815260040160405180910390fd5b600080546001600160a01b03199081166001600160a01b03938416178255606087901b6001600160601b0319166080526009805490911686841617905590620000f390839087166200026b565b6040805180820182526001600160a01b0385168082528315156020928301819052600a80546001600160a81b0319168317600160a01b83021790558351918252918101919091529192507f554c636366d5fc882a9ab4b7b9d5181781d1a7076abe50ed410365620dcf4108910160405180910390a15050505050606088901b6001600160601b03191660a05250600092506200019d91508490506001600160a01b0387166200026b565b60408051606080820183526001600160a01b03878116808452851515602080860182905260ff8a8116968801879052600c80546001600160a81b031916909417600160a01b9384021760ff60a81b198116600160a81b890290811795869055895191871696169590951785529190920416151590820152928301919091529192507f10e6a379d12c209d558815459d599ade7bcc91d5270a7dfca948da52aef7df34910160405180910390a16200025762015180620003b1565b5050600060055550620004df945050505050565b6000816001600160a01b0316836001600160a01b0316630dfe16816040518163ffffffff1660e01b815260040160206040518083038186803b158015620002b157600080fd5b505afa158015620002c6573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190620002ec9190620004ba565b6001600160a01b03161490508015816200038c5750816001600160a01b0316836001600160a01b031663d21220a76040518163ffffffff1660e01b815260040160206040518083038186803b1580156200034557600080fd5b505afa1580156200035a573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190620003809190620004ba565b6001600160a01b031614155b15620003ab5760405163db60809d60e01b815260040160405180910390fd5b92915050565b6006805463ffffffff191663ffffffff83169081179091556040519081527fc806e26fb64e3a95f4b70abf4d87280555696244d01068b5f45b0e515aceb1de9060200160405180910390a150565b80516001600160a01b03811681146200041757600080fd5b919050565b600080600080600080600060e0888a0312156200043857600080fd5b6200044388620003ff565b96506200045360208901620003ff565b95506200046360408901620003ff565b94506200047360608901620003ff565b93506200048360808901620003ff565b92506200049360a08901620003ff565b915060c088015160ff81168114620004aa57600080fd5b8091505092959891949750929550565b600060208284031215620004cd57600080fd5b620004d882620003ff565b9392505050565b60805160601c60a05160601c61239f620005276000396000818161051a01526113ca01526000818161025d01528181610c6201528181610ca60152611505015261239f6000f3fe608060405234801561001057600080fd5b50600436106102535760003560e01c8063696a437b11610146578063b2e0df96116100c3578063e244208b11610087578063e244208b146105e0578063e3056a34146105f3578063eb37d34914610606578063ed1bd76c1461062f578063f235757f14610642578063fe10d7741461065557600080fd5b8063b2e0df961461053c578063b93f5af01461054f578063c84993af14610562578063ca4f280314610575578063dc686d91146105a857600080fd5b8063a0d271071161010a578063a0d27107146104d3578063a62611a2146104e6578063ab5dce00146104ef578063ab8cedc514610502578063ad5c46481461051557600080fd5b8063696a437b1461043b5780637b40c9131461045e5780638561579c1461049c5780638a9b1b09146104a55780639aaad679146104ae57600080fd5b80632750c0f9116101d45780633facf242116101985780633facf242146103cb578063435b21c1146103d4578063516c3323146104025780635c38eb3a14610415578063607e48d41461042857600080fd5b80632750c0f914610338578063289adb441461038957806337090c2f1461039c5780633b67c3bd146103a55780633cc7ab30146103b857600080fd5b806313f6986d1161021b57806313f6986d146102ea578063160e1e31146102f25780632248e82d1461030557806325f09e61146103265780632742b9e71461032f57600080fd5b806305e0b9a0146102585780630c340a241461029c5780630c525835146102af578063117cfc1b146102c457806311a6e1c7146102d7575b600080fd5b61027f7f000000000000000000000000000000000000000000000000000000000000000081565b6040516001600160a01b0390911681526020015b60405180910390f35b60005461027f906001600160a01b031681565b6102c26102bd366004611c79565b610668565b005b60095461027f906001600160a01b031681565b6102c26102e5366004611ca7565b6106cf565b6102c261072f565b6102c2610300366004611ce6565b610764565b610318610313366004611d03565b6107c2565b604051908152602001610293565b61031861271081565b61031860045481565b600c54610361906001600160a01b0381169060ff600160a01b8204811691600160a81b90041683565b604080516001600160a01b039094168452911515602084015260ff1690820152606001610293565b6102c2610397366004611c79565b6107f5565b61031860035481565b6103186103b3366004611c79565b610855565b6102c26103c6366004611ce6565b6109ec565b61031860055481565b6103e76103e2366004611c79565b610a8c565b60408051938452602084019290925290820152606001610293565b610318610410366004611c79565b610abd565b6102c2610423366004611d2f565b610b18565b6102c2610436366004611c79565b610bea565b61044e610449366004611ce6565b610c4a565b6040519015158152602001610293565b600a5461047d906001600160a01b03811690600160a01b900460ff1682565b604080516001600160a01b039093168352901515602083015201610293565b61031860025481565b61031860085481565b6006546104be9063ffffffff1681565b60405163ffffffff9091168152602001610293565b6103186104e1366004611d6c565b610cfd565b61031860075481565b6102c26104fd366004611c79565b610d30565b610318610510366004611da4565b610d90565b61027f7f000000000000000000000000000000000000000000000000000000000000000081565b6102c261054a366004611c79565b610e39565b6102c261055d366004611df9565b610e99565b610318610570366004611c79565b610ecd565b610588610583366004611ce6565b610edf565b604080516001600160a01b03938416815292909116602083015201610293565b6105bb6105b6366004611e7f565b610fcd565b60408051600694850b81529290930b6020830152151591810191909152606001610293565b6102c26105ee366004611c79565b6110d8565b60015461027f906001600160a01b031681565b61027f610614366004611ce6565b600b602052600090815260409020546001600160a01b031681565b61031861063d366004611c79565b611138565b6102c2610650366004611ce6565b61127e565b610318610663366004611ce6565b6112b2565b6000546001600160a01b031633146106935760405163070545c960e51b815260040160405180910390fd5b60028190556040518181527f0919fdaaac0f59c6bc7eeef4f975d6163475220f1e4820d0bce99c84c51cac1d906020015b60405180910390a150565b6000546001600160a01b031633146106fa5760405163070545c960e51b815260040160405180910390fd5b6001600160a01b0382166107215760405163d92e233d60e01b815260040160405180910390fd5b61072b82826113c2565b5050565b6001546001600160a01b0316331461075a57604051639ba0305d60e01b815260040160405180910390fd5b61076261149f565b565b6000546001600160a01b0316331461078f5760405163070545c960e51b815260040160405180910390fd5b6001600160a01b0381166107b65760405163d92e233d60e01b815260040160405180910390fd5b6107bf816114fd565b50565b6000806107d1610410856112b2565b90506107ed6127106107e38386611f47565b61063d9190611f7c565b949350505050565b6000546001600160a01b031633146108205760405163070545c960e51b815260040160405180910390fd5b60058190556040518181527fed847bdbab1a30becee18585f23c759bd06156561390d2e7fbffd18e74b56c9b906020016106c4565b604080516002808252606082018352600092839291906020830190803683375050600654825192935063ffffffff1691839150600190811061089957610899611f90565b63ffffffff90921660209283029190910190910152600c546108c79060ff600160a81b909104166012611fa6565b6108d290600a6120a1565b6108dc9084611f7c565b600c5460405163883bdbfd60e01b81529194506000916001600160a01b039091169063883bdbfd906109129085906004016120ad565b60006040518083038186803b15801561092a57600080fd5b505afa15801561093e573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526109669190810190612166565b50905060008160018151811061097e5761097e611f90565b60200260200101518260008151811061099957610999611f90565b60200260200101516109ab919061222b565b600c549091506109e3908690600160a01b900460ff166109d3576109ce8361227b565b6109d5565b825b60065463ffffffff16610d90565b95945050505050565b6000546001600160a01b03163314610a175760405163070545c960e51b815260040160405180910390fd5b6001600160a01b038116610a3e5760405163d92e233d60e01b815260040160405180910390fd5b600980546001600160a01b0319166001600160a01b0383169081179091556040519081527fcf744e4fc39d49b6d8103035078629b8a3be95adc007b0d663e96bdff777b10a906020016106c4565b6000806000610aa561063d670de0b6b3a7640000610855565b9150610ab084610abd565b6005549095929450925050565b6000610acb8260045461159b565b9150600060045483600254600354610ae39190611fa6565b610aed9190611f47565b610af79190611f7c565b600254610b0491906122a2565b9050610b11600182611f47565b9392505050565b6000546001600160a01b03163314610b435760405163070545c960e51b815260040160405180910390fd5b6001600160a01b0382161580610b6057506001600160a01b038116155b15610b7e5760405163d92e233d60e01b815260040160405180910390fd5b6001600160a01b038281166000818152600b602090815260409182902080546001600160a01b031916948616948517905581519283528201929092527fc1d3048301c0d23629a2532c8defa6d68f8e1a0e4157918769e9fb1b2eeb888e91015b60405180910390a15050565b6000546001600160a01b03163314610c155760405163070545c960e51b815260040160405180910390fd5b60078190556040518181527ff1443dcc693c421058f429cf588bc37e5c8de2275c3771a810a5e4bf0a908a4b906020016106c4565b6000806000610c5884610edf565b80925081935050507f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316826001600160a01b03161415610ca4575060019392505050565b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316816001600160a01b031614610cf657604051637d7c8f2760e11b815260040160405180910390fd5b5050919050565b600080610d16610d1184600687900b6122ba565b6115b1565b90506109e3600160601b86836001600160a01b03166119ca565b6000546001600160a01b03163314610d5b5760405163070545c960e51b815260040160405180910390fd5b60048190556040518181527feac367d684b6ac6c6ae7e3e852c06f17e6354e0f1e7122832c3e6d17e0a2b71e906020016106c4565b600080610da4610d1184600687900b6122ba565b90506001600160801b036001600160a01b03821611610df4576000610dd26001600160a01b03831680611f47565b9050610dec600160c01b876001600160801b0316836119ca565b925050610e31565b6000610e136001600160a01b03831680680100000000000000006119ca565b9050610e2d600160801b876001600160801b0316836119ca565b9250505b509392505050565b6000546001600160a01b03163314610e645760405163070545c960e51b815260040160405180910390fd5b60038190556040518181527fa1292b4e7a0d916ccfd2bc83858b05f328e344d1f0f507d97ac66723ac7c2aaa906020016106c4565b6000546001600160a01b03163314610ec45760405163070545c960e51b815260040160405180910390fd5b6107bf81611a78565b6000610ed932836107c2565b92915050565b600080826001600160a01b0316630dfe16816040518163ffffffff1660e01b815260040160206040518083038186803b158015610f1b57600080fd5b505afa158015610f2f573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610f5391906122e8565b836001600160a01b031663d21220a76040518163ffffffff1660e01b815260040160206040518083038186803b158015610f8c57600080fd5b505afa158015610fa0573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610fc491906122e8565b91509150915091565b6000806000846001600160a01b031663883bdbfd856040518263ffffffff1660e01b8152600401610ffe91906120ad565b60006040518083038186803b15801561101657600080fd5b505afa92505050801561104b57506040513d6000823e601f3d908101601f191682016040526110489190810190612166565b60015b611085573d808015611079576040519150601f19603f3d011682016040523d82523d6000602084013e61107e565b606091505b50506110d1565b8160008151811061109857611098611f90565b602002602001015194506001825111156110ca57816001815181106110bf576110bf611f90565b602002602001015193505b6001925050505b9250925092565b6000546001600160a01b031633146111035760405163070545c960e51b815260040160405180910390fd5b60088190556040518181527f403b461d2c3bcad840d570faac033e4e69e5649645ce89f3c5b4e28d54159221906020016106c4565b604080516002808252606082018352600092839291906020830190803683375050600654825192935063ffffffff1691839150600190811061117c5761117c611f90565b63ffffffff90921660209283029190910190910152600a5460405163883bdbfd60e01b81526000916001600160a01b03169063883bdbfd906111c29085906004016120ad565b60006040518083038186803b1580156111da57600080fd5b505afa1580156111ee573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526112169190810190612166565b50905060008160018151811061122e5761122e611f90565b60200260200101518260008151811061124957611249611f90565b602002602001015161125b919061222b565b600a549091506109e3908690600160a01b900460ff166109d3576109ce8361227b565b6000546001600160a01b031633146112a95760405163070545c960e51b815260040160405180910390fd5b6107bf81611ac0565b600080600960009054906101000a90046001600160a01b03166001600160a01b0316631ef94b916040518163ffffffff1660e01b815260040160206040518083038186803b15801561130357600080fd5b505afa158015611317573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061133b91906122e8565b60095460405163a39744b560e01b81526001600160a01b038681166004830152808416602483015292935091169063a39744b59060440160206040518083038186803b15801561138a57600080fd5b505afa15801561139e573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610b119190612305565b60006113ee837f0000000000000000000000000000000000000000000000000000000000000000611b43565b60408051606080820183526001600160a01b03878116808452851515602080860182905260ff8a8116968801879052600c80546001600160a81b031916909417600160a01b9384021760ff60a81b198116600160a81b890290811795869055895191871696169590951785529190920416151590820152928301919091529192507f10e6a379d12c209d558815459d599ade7bcc91d5270a7dfca948da52aef7df34910160405180910390a1505050565b60018054600080546001600160a01b0383166001600160a01b031991821681179092559091169091556040519081527f5d5d6e01b731c3e68060f7fe13156f6197d4aeffc2d6f498e34c717ae616b7349060200160405180910390a1565b6000611529827f0000000000000000000000000000000000000000000000000000000000000000611b43565b6040805180820182526001600160a01b0385168082528315156020928301819052600a80546001600160a81b0319168317600160a01b83021790558351918252918101919091529192507f554c636366d5fc882a9ab4b7b9d5181781d1a7076abe50ed410365620dcf41089101610bde565b60008183106115aa5781610b11565b5090919050565b60008060008360020b126115c8578260020b6115d5565b8260020b6115d59061231e565b90506115e4620d89e71961233b565b60020b81111561161e5760405162461bcd60e51b81526020600482015260016024820152601560fa1b604482015260640160405180910390fd5b60006001821661163257600160801b611644565b6ffffcb933bd6fad37aa2d162d1a5940015b70ffffffffffffffffffffffffffffffffff169050600282161561168357608061167e826ffff97272373d413259a46990580e213a611f47565b901c90505b60048216156116ad5760806116a8826ffff2e50f5f656932ef12357cf3c7fdcc611f47565b901c90505b60088216156116d75760806116d2826fffe5caca7e10e4e61c3624eaa0941cd0611f47565b901c90505b60108216156117015760806116fc826fffcb9843d60f6159c9db58835c926644611f47565b901c90505b602082161561172b576080611726826fff973b41fa98c081472e6896dfb254c0611f47565b901c90505b6040821615611755576080611750826fff2ea16466c96a3843ec78b326b52861611f47565b901c90505b608082161561177f57608061177a826ffe5dee046a99a2a811c461f1969c3053611f47565b901c90505b6101008216156117aa5760806117a5826ffcbe86c7900a88aedcffc83b479aa3a4611f47565b901c90505b6102008216156117d55760806117d0826ff987a7253ac413176f2b074cf7815e54611f47565b901c90505b6104008216156118005760806117fb826ff3392b0822b70005940c7a398e4b70f3611f47565b901c90505b61080082161561182b576080611826826fe7159475a2c29b7443b29c7fa6e889d9611f47565b901c90505b611000821615611856576080611851826fd097f3bdfd2022b8845ad8f792aa5825611f47565b901c90505b61200082161561188157608061187c826fa9f746462d870fdf8a65dc1f90e061e5611f47565b901c90505b6140008216156118ac5760806118a7826f70d869a156d2a1b890bb3df62baf32f7611f47565b901c90505b6180008216156118d75760806118d2826f31be135f97d08fd981231505542fcfa6611f47565b901c90505b620100008216156119035760806118fe826f09aa508b5b7a84e1c677de54f3e99bc9611f47565b901c90505b6202000082161561192e576080611929826e5d6af8dedb81196699c329225ee604611f47565b901c90505b62040000821615611958576080611953826d2216e584f5fa1ea926041bedfe98611f47565b901c90505b6208000082161561198057608061197b826b048a170391f7dc42444e8fa2611f47565b901c90505b60008460020b131561199b5761199881600019611f7c565b90505b6119aa64010000000082612355565b156119b65760016119b9565b60005b6107ed9060ff16602083901c6122a2565b600080806000198587098587029250828110838203039150508060001415611a0457600084116119f957600080fd5b508290049050610b11565b808411611a1057600080fd5b600084868809600260036001881981018916988990049182028318808302840302808302840302808302840302808302840302808302840302918202909203026000889003889004909101858311909403939093029303949094049190911702949350505050565b6006805463ffffffff191663ffffffff83169081179091556040519081527fc806e26fb64e3a95f4b70abf4d87280555696244d01068b5f45b0e515aceb1de906020016106c4565b6001600160a01b038116611ae75760405163d92e233d60e01b815260040160405180910390fd5b600180546001600160a01b0319166001600160a01b038381169182179092556000546040805191909316815260208101919091527f6353ec38ac394f8be94bfafcdd3580d356470599059eaeebedc3207e1cc03dec91016106c4565b6000816001600160a01b0316836001600160a01b0316630dfe16816040518163ffffffff1660e01b815260040160206040518083038186803b158015611b8857600080fd5b505afa158015611b9c573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611bc091906122e8565b6001600160a01b0316149050801581611c5b5750816001600160a01b0316836001600160a01b031663d21220a76040518163ffffffff1660e01b815260040160206040518083038186803b158015611c1757600080fd5b505afa158015611c2b573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611c4f91906122e8565b6001600160a01b031614155b15610ed95760405163db60809d60e01b815260040160405180910390fd5b600060208284031215611c8b57600080fd5b5035919050565b6001600160a01b03811681146107bf57600080fd5b60008060408385031215611cba57600080fd5b8235611cc581611c92565b9150602083013560ff81168114611cdb57600080fd5b809150509250929050565b600060208284031215611cf857600080fd5b8135610b1181611c92565b60008060408385031215611d1657600080fd5b8235611d2181611c92565b946020939093013593505050565b60008060408385031215611d4257600080fd5b8235611d4d81611c92565b91506020830135611cdb81611c92565b8060060b81146107bf57600080fd5b600080600060608486031215611d8157600080fd5b833592506020840135611d9381611d5d565b929592945050506040919091013590565b600080600060608486031215611db957600080fd5b83356001600160801b0381168114611dd057600080fd5b92506020840135611d9381611d5d565b803563ffffffff81168114611df457600080fd5b919050565b600060208284031215611e0b57600080fd5b610b1182611de0565b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f1916810167ffffffffffffffff81118282101715611e5357611e53611e14565b604052919050565b600067ffffffffffffffff821115611e7557611e75611e14565b5060051b60200190565b60008060408385031215611e9257600080fd5b8235611e9d81611c92565b915060208381013567ffffffffffffffff811115611eba57600080fd5b8401601f81018613611ecb57600080fd5b8035611ede611ed982611e5b565b611e2a565b81815260059190911b82018301908381019088831115611efd57600080fd5b928401925b82841015611f2257611f1384611de0565b82529284019290840190611f02565b80955050505050509250929050565b634e487b7160e01b600052601160045260246000fd5b6000816000190483118215151615611f6157611f61611f31565b500290565b634e487b7160e01b600052601260045260246000fd5b600082611f8b57611f8b611f66565b500490565b634e487b7160e01b600052603260045260246000fd5b600082821015611fb857611fb8611f31565b500390565b600181815b80851115611ff8578160001904821115611fde57611fde611f31565b80851615611feb57918102915b93841c9390800290611fc2565b509250929050565b60008261200f57506001610ed9565b8161201c57506000610ed9565b8160018114612032576002811461203c57612058565b6001915050610ed9565b60ff84111561204d5761204d611f31565b50506001821b610ed9565b5060208310610133831016604e8410600b841016171561207b575081810a610ed9565b6120858383611fbd565b806000190482111561209957612099611f31565b029392505050565b6000610b118383612000565b6020808252825182820181905260009190848201906040850190845b818110156120eb57835163ffffffff16835292840192918401916001016120c9565b50909695505050505050565b600082601f83011261210857600080fd5b81516020612118611ed983611e5b565b82815260059290921b8401810191818101908684111561213757600080fd5b8286015b8481101561215b57805161214e81611c92565b835291830191830161213b565b509695505050505050565b6000806040838503121561217957600080fd5b825167ffffffffffffffff8082111561219157600080fd5b818501915085601f8301126121a557600080fd5b815160206121b5611ed983611e5b565b82815260059290921b840181019181810190898411156121d457600080fd5b948201945b838610156121fb5785516121ec81611d5d565b825294820194908201906121d9565b9188015191965090935050508082111561221457600080fd5b50612221858286016120f7565b9150509250929050565b60008160060b8360060b6000811281667fffffffffffff190183128115161561225657612256611f31565b81667fffffffffffff01831381161561227157612271611f31565b5090039392505050565b60008160060b667fffffffffffff1981141561229957612299611f31565b60000392915050565b600082198211156122b5576122b5611f31565b500190565b6000826122c9576122c9611f66565b600160ff1b8214600019841416156122e3576122e3611f31565b500590565b6000602082840312156122fa57600080fd5b8151610b1181611c92565b60006020828403121561231757600080fd5b5051919050565b6000600160ff1b82141561233457612334611f31565b5060000390565b60008160020b627fffff1981141561229957612299611f31565b60008261236457612364611f66565b50069056fea2646970667358221220aad359367590b339a15d93e3a969afb2c379caf9f8f9523362bd71439fa37e9064736f6c63430008080033", + "deployedBytecode": "0x608060405234801561001057600080fd5b50600436106102535760003560e01c8063696a437b11610146578063b2e0df96116100c3578063e244208b11610087578063e244208b146105e0578063e3056a34146105f3578063eb37d34914610606578063ed1bd76c1461062f578063f235757f14610642578063fe10d7741461065557600080fd5b8063b2e0df961461053c578063b93f5af01461054f578063c84993af14610562578063ca4f280314610575578063dc686d91146105a857600080fd5b8063a0d271071161010a578063a0d27107146104d3578063a62611a2146104e6578063ab5dce00146104ef578063ab8cedc514610502578063ad5c46481461051557600080fd5b8063696a437b1461043b5780637b40c9131461045e5780638561579c1461049c5780638a9b1b09146104a55780639aaad679146104ae57600080fd5b80632750c0f9116101d45780633facf242116101985780633facf242146103cb578063435b21c1146103d4578063516c3323146104025780635c38eb3a14610415578063607e48d41461042857600080fd5b80632750c0f914610338578063289adb441461038957806337090c2f1461039c5780633b67c3bd146103a55780633cc7ab30146103b857600080fd5b806313f6986d1161021b57806313f6986d146102ea578063160e1e31146102f25780632248e82d1461030557806325f09e61146103265780632742b9e71461032f57600080fd5b806305e0b9a0146102585780630c340a241461029c5780630c525835146102af578063117cfc1b146102c457806311a6e1c7146102d7575b600080fd5b61027f7f000000000000000000000000000000000000000000000000000000000000000081565b6040516001600160a01b0390911681526020015b60405180910390f35b60005461027f906001600160a01b031681565b6102c26102bd366004611c79565b610668565b005b60095461027f906001600160a01b031681565b6102c26102e5366004611ca7565b6106cf565b6102c261072f565b6102c2610300366004611ce6565b610764565b610318610313366004611d03565b6107c2565b604051908152602001610293565b61031861271081565b61031860045481565b600c54610361906001600160a01b0381169060ff600160a01b8204811691600160a81b90041683565b604080516001600160a01b039094168452911515602084015260ff1690820152606001610293565b6102c2610397366004611c79565b6107f5565b61031860035481565b6103186103b3366004611c79565b610855565b6102c26103c6366004611ce6565b6109ec565b61031860055481565b6103e76103e2366004611c79565b610a8c565b60408051938452602084019290925290820152606001610293565b610318610410366004611c79565b610abd565b6102c2610423366004611d2f565b610b18565b6102c2610436366004611c79565b610bea565b61044e610449366004611ce6565b610c4a565b6040519015158152602001610293565b600a5461047d906001600160a01b03811690600160a01b900460ff1682565b604080516001600160a01b039093168352901515602083015201610293565b61031860025481565b61031860085481565b6006546104be9063ffffffff1681565b60405163ffffffff9091168152602001610293565b6103186104e1366004611d6c565b610cfd565b61031860075481565b6102c26104fd366004611c79565b610d30565b610318610510366004611da4565b610d90565b61027f7f000000000000000000000000000000000000000000000000000000000000000081565b6102c261054a366004611c79565b610e39565b6102c261055d366004611df9565b610e99565b610318610570366004611c79565b610ecd565b610588610583366004611ce6565b610edf565b604080516001600160a01b03938416815292909116602083015201610293565b6105bb6105b6366004611e7f565b610fcd565b60408051600694850b81529290930b6020830152151591810191909152606001610293565b6102c26105ee366004611c79565b6110d8565b60015461027f906001600160a01b031681565b61027f610614366004611ce6565b600b602052600090815260409020546001600160a01b031681565b61031861063d366004611c79565b611138565b6102c2610650366004611ce6565b61127e565b610318610663366004611ce6565b6112b2565b6000546001600160a01b031633146106935760405163070545c960e51b815260040160405180910390fd5b60028190556040518181527f0919fdaaac0f59c6bc7eeef4f975d6163475220f1e4820d0bce99c84c51cac1d906020015b60405180910390a150565b6000546001600160a01b031633146106fa5760405163070545c960e51b815260040160405180910390fd5b6001600160a01b0382166107215760405163d92e233d60e01b815260040160405180910390fd5b61072b82826113c2565b5050565b6001546001600160a01b0316331461075a57604051639ba0305d60e01b815260040160405180910390fd5b61076261149f565b565b6000546001600160a01b0316331461078f5760405163070545c960e51b815260040160405180910390fd5b6001600160a01b0381166107b65760405163d92e233d60e01b815260040160405180910390fd5b6107bf816114fd565b50565b6000806107d1610410856112b2565b90506107ed6127106107e38386611f47565b61063d9190611f7c565b949350505050565b6000546001600160a01b031633146108205760405163070545c960e51b815260040160405180910390fd5b60058190556040518181527fed847bdbab1a30becee18585f23c759bd06156561390d2e7fbffd18e74b56c9b906020016106c4565b604080516002808252606082018352600092839291906020830190803683375050600654825192935063ffffffff1691839150600190811061089957610899611f90565b63ffffffff90921660209283029190910190910152600c546108c79060ff600160a81b909104166012611fa6565b6108d290600a6120a1565b6108dc9084611f7c565b600c5460405163883bdbfd60e01b81529194506000916001600160a01b039091169063883bdbfd906109129085906004016120ad565b60006040518083038186803b15801561092a57600080fd5b505afa15801561093e573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526109669190810190612166565b50905060008160018151811061097e5761097e611f90565b60200260200101518260008151811061099957610999611f90565b60200260200101516109ab919061222b565b600c549091506109e3908690600160a01b900460ff166109d3576109ce8361227b565b6109d5565b825b60065463ffffffff16610d90565b95945050505050565b6000546001600160a01b03163314610a175760405163070545c960e51b815260040160405180910390fd5b6001600160a01b038116610a3e5760405163d92e233d60e01b815260040160405180910390fd5b600980546001600160a01b0319166001600160a01b0383169081179091556040519081527fcf744e4fc39d49b6d8103035078629b8a3be95adc007b0d663e96bdff777b10a906020016106c4565b6000806000610aa561063d670de0b6b3a7640000610855565b9150610ab084610abd565b6005549095929450925050565b6000610acb8260045461159b565b9150600060045483600254600354610ae39190611fa6565b610aed9190611f47565b610af79190611f7c565b600254610b0491906122a2565b9050610b11600182611f47565b9392505050565b6000546001600160a01b03163314610b435760405163070545c960e51b815260040160405180910390fd5b6001600160a01b0382161580610b6057506001600160a01b038116155b15610b7e5760405163d92e233d60e01b815260040160405180910390fd5b6001600160a01b038281166000818152600b602090815260409182902080546001600160a01b031916948616948517905581519283528201929092527fc1d3048301c0d23629a2532c8defa6d68f8e1a0e4157918769e9fb1b2eeb888e91015b60405180910390a15050565b6000546001600160a01b03163314610c155760405163070545c960e51b815260040160405180910390fd5b60078190556040518181527ff1443dcc693c421058f429cf588bc37e5c8de2275c3771a810a5e4bf0a908a4b906020016106c4565b6000806000610c5884610edf565b80925081935050507f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316826001600160a01b03161415610ca4575060019392505050565b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316816001600160a01b031614610cf657604051637d7c8f2760e11b815260040160405180910390fd5b5050919050565b600080610d16610d1184600687900b6122ba565b6115b1565b90506109e3600160601b86836001600160a01b03166119ca565b6000546001600160a01b03163314610d5b5760405163070545c960e51b815260040160405180910390fd5b60048190556040518181527feac367d684b6ac6c6ae7e3e852c06f17e6354e0f1e7122832c3e6d17e0a2b71e906020016106c4565b600080610da4610d1184600687900b6122ba565b90506001600160801b036001600160a01b03821611610df4576000610dd26001600160a01b03831680611f47565b9050610dec600160c01b876001600160801b0316836119ca565b925050610e31565b6000610e136001600160a01b03831680680100000000000000006119ca565b9050610e2d600160801b876001600160801b0316836119ca565b9250505b509392505050565b6000546001600160a01b03163314610e645760405163070545c960e51b815260040160405180910390fd5b60038190556040518181527fa1292b4e7a0d916ccfd2bc83858b05f328e344d1f0f507d97ac66723ac7c2aaa906020016106c4565b6000546001600160a01b03163314610ec45760405163070545c960e51b815260040160405180910390fd5b6107bf81611a78565b6000610ed932836107c2565b92915050565b600080826001600160a01b0316630dfe16816040518163ffffffff1660e01b815260040160206040518083038186803b158015610f1b57600080fd5b505afa158015610f2f573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610f5391906122e8565b836001600160a01b031663d21220a76040518163ffffffff1660e01b815260040160206040518083038186803b158015610f8c57600080fd5b505afa158015610fa0573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610fc491906122e8565b91509150915091565b6000806000846001600160a01b031663883bdbfd856040518263ffffffff1660e01b8152600401610ffe91906120ad565b60006040518083038186803b15801561101657600080fd5b505afa92505050801561104b57506040513d6000823e601f3d908101601f191682016040526110489190810190612166565b60015b611085573d808015611079576040519150601f19603f3d011682016040523d82523d6000602084013e61107e565b606091505b50506110d1565b8160008151811061109857611098611f90565b602002602001015194506001825111156110ca57816001815181106110bf576110bf611f90565b602002602001015193505b6001925050505b9250925092565b6000546001600160a01b031633146111035760405163070545c960e51b815260040160405180910390fd5b60088190556040518181527f403b461d2c3bcad840d570faac033e4e69e5649645ce89f3c5b4e28d54159221906020016106c4565b604080516002808252606082018352600092839291906020830190803683375050600654825192935063ffffffff1691839150600190811061117c5761117c611f90565b63ffffffff90921660209283029190910190910152600a5460405163883bdbfd60e01b81526000916001600160a01b03169063883bdbfd906111c29085906004016120ad565b60006040518083038186803b1580156111da57600080fd5b505afa1580156111ee573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526112169190810190612166565b50905060008160018151811061122e5761122e611f90565b60200260200101518260008151811061124957611249611f90565b602002602001015161125b919061222b565b600a549091506109e3908690600160a01b900460ff166109d3576109ce8361227b565b6000546001600160a01b031633146112a95760405163070545c960e51b815260040160405180910390fd5b6107bf81611ac0565b600080600960009054906101000a90046001600160a01b03166001600160a01b0316631ef94b916040518163ffffffff1660e01b815260040160206040518083038186803b15801561130357600080fd5b505afa158015611317573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061133b91906122e8565b60095460405163a39744b560e01b81526001600160a01b038681166004830152808416602483015292935091169063a39744b59060440160206040518083038186803b15801561138a57600080fd5b505afa15801561139e573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610b119190612305565b60006113ee837f0000000000000000000000000000000000000000000000000000000000000000611b43565b60408051606080820183526001600160a01b03878116808452851515602080860182905260ff8a8116968801879052600c80546001600160a81b031916909417600160a01b9384021760ff60a81b198116600160a81b890290811795869055895191871696169590951785529190920416151590820152928301919091529192507f10e6a379d12c209d558815459d599ade7bcc91d5270a7dfca948da52aef7df34910160405180910390a1505050565b60018054600080546001600160a01b0383166001600160a01b031991821681179092559091169091556040519081527f5d5d6e01b731c3e68060f7fe13156f6197d4aeffc2d6f498e34c717ae616b7349060200160405180910390a1565b6000611529827f0000000000000000000000000000000000000000000000000000000000000000611b43565b6040805180820182526001600160a01b0385168082528315156020928301819052600a80546001600160a81b0319168317600160a01b83021790558351918252918101919091529192507f554c636366d5fc882a9ab4b7b9d5181781d1a7076abe50ed410365620dcf41089101610bde565b60008183106115aa5781610b11565b5090919050565b60008060008360020b126115c8578260020b6115d5565b8260020b6115d59061231e565b90506115e4620d89e71961233b565b60020b81111561161e5760405162461bcd60e51b81526020600482015260016024820152601560fa1b604482015260640160405180910390fd5b60006001821661163257600160801b611644565b6ffffcb933bd6fad37aa2d162d1a5940015b70ffffffffffffffffffffffffffffffffff169050600282161561168357608061167e826ffff97272373d413259a46990580e213a611f47565b901c90505b60048216156116ad5760806116a8826ffff2e50f5f656932ef12357cf3c7fdcc611f47565b901c90505b60088216156116d75760806116d2826fffe5caca7e10e4e61c3624eaa0941cd0611f47565b901c90505b60108216156117015760806116fc826fffcb9843d60f6159c9db58835c926644611f47565b901c90505b602082161561172b576080611726826fff973b41fa98c081472e6896dfb254c0611f47565b901c90505b6040821615611755576080611750826fff2ea16466c96a3843ec78b326b52861611f47565b901c90505b608082161561177f57608061177a826ffe5dee046a99a2a811c461f1969c3053611f47565b901c90505b6101008216156117aa5760806117a5826ffcbe86c7900a88aedcffc83b479aa3a4611f47565b901c90505b6102008216156117d55760806117d0826ff987a7253ac413176f2b074cf7815e54611f47565b901c90505b6104008216156118005760806117fb826ff3392b0822b70005940c7a398e4b70f3611f47565b901c90505b61080082161561182b576080611826826fe7159475a2c29b7443b29c7fa6e889d9611f47565b901c90505b611000821615611856576080611851826fd097f3bdfd2022b8845ad8f792aa5825611f47565b901c90505b61200082161561188157608061187c826fa9f746462d870fdf8a65dc1f90e061e5611f47565b901c90505b6140008216156118ac5760806118a7826f70d869a156d2a1b890bb3df62baf32f7611f47565b901c90505b6180008216156118d75760806118d2826f31be135f97d08fd981231505542fcfa6611f47565b901c90505b620100008216156119035760806118fe826f09aa508b5b7a84e1c677de54f3e99bc9611f47565b901c90505b6202000082161561192e576080611929826e5d6af8dedb81196699c329225ee604611f47565b901c90505b62040000821615611958576080611953826d2216e584f5fa1ea926041bedfe98611f47565b901c90505b6208000082161561198057608061197b826b048a170391f7dc42444e8fa2611f47565b901c90505b60008460020b131561199b5761199881600019611f7c565b90505b6119aa64010000000082612355565b156119b65760016119b9565b60005b6107ed9060ff16602083901c6122a2565b600080806000198587098587029250828110838203039150508060001415611a0457600084116119f957600080fd5b508290049050610b11565b808411611a1057600080fd5b600084868809600260036001881981018916988990049182028318808302840302808302840302808302840302808302840302808302840302918202909203026000889003889004909101858311909403939093029303949094049190911702949350505050565b6006805463ffffffff191663ffffffff83169081179091556040519081527fc806e26fb64e3a95f4b70abf4d87280555696244d01068b5f45b0e515aceb1de906020016106c4565b6001600160a01b038116611ae75760405163d92e233d60e01b815260040160405180910390fd5b600180546001600160a01b0319166001600160a01b038381169182179092556000546040805191909316815260208101919091527f6353ec38ac394f8be94bfafcdd3580d356470599059eaeebedc3207e1cc03dec91016106c4565b6000816001600160a01b0316836001600160a01b0316630dfe16816040518163ffffffff1660e01b815260040160206040518083038186803b158015611b8857600080fd5b505afa158015611b9c573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611bc091906122e8565b6001600160a01b0316149050801581611c5b5750816001600160a01b0316836001600160a01b031663d21220a76040518163ffffffff1660e01b815260040160206040518083038186803b158015611c1757600080fd5b505afa158015611c2b573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611c4f91906122e8565b6001600160a01b031614155b15610ed95760405163db60809d60e01b815260040160405180910390fd5b600060208284031215611c8b57600080fd5b5035919050565b6001600160a01b03811681146107bf57600080fd5b60008060408385031215611cba57600080fd5b8235611cc581611c92565b9150602083013560ff81168114611cdb57600080fd5b809150509250929050565b600060208284031215611cf857600080fd5b8135610b1181611c92565b60008060408385031215611d1657600080fd5b8235611d2181611c92565b946020939093013593505050565b60008060408385031215611d4257600080fd5b8235611d4d81611c92565b91506020830135611cdb81611c92565b8060060b81146107bf57600080fd5b600080600060608486031215611d8157600080fd5b833592506020840135611d9381611d5d565b929592945050506040919091013590565b600080600060608486031215611db957600080fd5b83356001600160801b0381168114611dd057600080fd5b92506020840135611d9381611d5d565b803563ffffffff81168114611df457600080fd5b919050565b600060208284031215611e0b57600080fd5b610b1182611de0565b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f1916810167ffffffffffffffff81118282101715611e5357611e53611e14565b604052919050565b600067ffffffffffffffff821115611e7557611e75611e14565b5060051b60200190565b60008060408385031215611e9257600080fd5b8235611e9d81611c92565b915060208381013567ffffffffffffffff811115611eba57600080fd5b8401601f81018613611ecb57600080fd5b8035611ede611ed982611e5b565b611e2a565b81815260059190911b82018301908381019088831115611efd57600080fd5b928401925b82841015611f2257611f1384611de0565b82529284019290840190611f02565b80955050505050509250929050565b634e487b7160e01b600052601160045260246000fd5b6000816000190483118215151615611f6157611f61611f31565b500290565b634e487b7160e01b600052601260045260246000fd5b600082611f8b57611f8b611f66565b500490565b634e487b7160e01b600052603260045260246000fd5b600082821015611fb857611fb8611f31565b500390565b600181815b80851115611ff8578160001904821115611fde57611fde611f31565b80851615611feb57918102915b93841c9390800290611fc2565b509250929050565b60008261200f57506001610ed9565b8161201c57506000610ed9565b8160018114612032576002811461203c57612058565b6001915050610ed9565b60ff84111561204d5761204d611f31565b50506001821b610ed9565b5060208310610133831016604e8410600b841016171561207b575081810a610ed9565b6120858383611fbd565b806000190482111561209957612099611f31565b029392505050565b6000610b118383612000565b6020808252825182820181905260009190848201906040850190845b818110156120eb57835163ffffffff16835292840192918401916001016120c9565b50909695505050505050565b600082601f83011261210857600080fd5b81516020612118611ed983611e5b565b82815260059290921b8401810191818101908684111561213757600080fd5b8286015b8481101561215b57805161214e81611c92565b835291830191830161213b565b509695505050505050565b6000806040838503121561217957600080fd5b825167ffffffffffffffff8082111561219157600080fd5b818501915085601f8301126121a557600080fd5b815160206121b5611ed983611e5b565b82815260059290921b840181019181810190898411156121d457600080fd5b948201945b838610156121fb5785516121ec81611d5d565b825294820194908201906121d9565b9188015191965090935050508082111561221457600080fd5b50612221858286016120f7565b9150509250929050565b60008160060b8360060b6000811281667fffffffffffff190183128115161561225657612256611f31565b81667fffffffffffff01831381161561227157612271611f31565b5090039392505050565b60008160060b667fffffffffffff1981141561229957612299611f31565b60000392915050565b600082198211156122b5576122b5611f31565b500190565b6000826122c9576122c9611f66565b600160ff1b8214600019841416156122e3576122e3611f31565b500590565b6000602082840312156122fa57600080fd5b8151610b1181611c92565b60006020828403121561231757600080fd5b5051919050565b6000600160ff1b82141561233457612334611f31565b5060000390565b60008160020b627fffff1981141561229957612299611f31565b60008261236457612364611f66565b50069056fea2646970667358221220aad359367590b339a15d93e3a969afb2c379caf9f8f9523362bd71439fa37e9064736f6c63430008080033", + "devdoc": { + "kind": "dev", + "methods": { + "bonds(address)": { + "params": { + "_keeper": "The address of the keeper to check" + }, + "returns": { + "_amountBonded": "The amount of KP3R the keeper has bonded" + } + }, + "constructor": { + "details": "Oracle pools should use 18 decimals tokens", + "params": { + "_governor": "Address of governor", + "_keep3rV2": "Address of sidechain Keep3r implementation", + "_kp3rWethOracle": "Address of oracle used for KP3R/WETH quote", + "_wethUsdOracle": "Address of oracle used for WETH/USD quote" + } + }, + "getKP3RsAtTick(uint256,int56,uint256)": { + "params": { + "_liquidityAmount": "Amount of liquidity to be converted", + "_tickDifference": "Tick value used to calculate the quote", + "_timeInterval": "Time value used to calculate the quote" + }, + "returns": { + "_kp3rAmount": "Amount of KP3R tokens underlying on the given liquidity" + } + }, + "getPaymentParams(uint256)": { + "params": { + "_bonds": "Amount of bonded KP3R owned by the keeper" + }, + "returns": { + "_boost": "Multiplier per gas unit. Takes into account the base fee and the amount of bonded KP3R", + "_extraGas": "Amount of extra gas that should be added to the gas spent", + "_oneUsdQuote": "Amount of KP3R tokens equivalent to 1 ETH" + } + }, + "getPoolTokens(address)": { + "params": { + "_pool": "Address of the correspondant pool" + }, + "returns": { + "_token0": "Address of the first token of the pair", + "_token1": "Address of the second token of the pair" + } + }, + "getQuoteAtTick(uint128,int56,uint256)": { + "params": { + "_baseAmount": "Amount of token to be converted", + "_tickDifference": "Tick value used to calculate the quote", + "_timeInterval": "Time value used to calculate the quote" + }, + "returns": { + "_quoteAmount": "Amount of credits deserved for the baseAmount at the tick value" + } + }, + "getRewardAmount(uint256)": { + "params": { + "_gasUsed": "The amount of gas used that will be rewarded" + }, + "returns": { + "_amount": "The amount of KP3R that should be awarded to tx.origin" + } + }, + "getRewardAmountFor(address,uint256)": { + "params": { + "_gasUsed": "The amount of gas used that will be rewarded", + "_keeper": "The address of the keeper to check" + }, + "returns": { + "_kp3r": "The amount of KP3R that should be awarded to the keeper" + } + }, + "getRewardBoostFor(uint256)": { + "details": "If the keeper has no bonds, boost should be +10% of gas cost, if keeper has max bonds, +20%", + "params": { + "_bonds": "The amount of KP3R tokens bonded by the keeper" + }, + "returns": { + "_rewardBoost": "The reward boost that corresponds to the keeper" + } + }, + "isKP3RToken0(address)": { + "params": { + "_pool": "Address of the correspondant pool" + }, + "returns": { + "_isKP3RToken0": "Boolean indicating the order of the tokens in the pair" + } + }, + "observe(address,uint32[])": { + "params": { + "_pool": "Address of the pool to observe", + "_secondsAgo": "Array with time references to observe" + }, + "returns": { + "_success": "Boolean indicating if the observe call was succesfull", + "_tickCumulative1": "Cumulative sum of ticks until first time reference", + "_tickCumulative2": "Cumulative sum of ticks until second time reference" + } + }, + "quote(uint256)": { + "details": "This function allows us to calculate how much KP3R we should pay to a keeper for things expressed in ETH, like gas", + "params": { + "_eth": "The amount of ETH" + }, + "returns": { + "_amountOut": "The amount of KP3R" + } + }, + "quoteUsdToEth(uint256)": { + "details": "Used to know how much ETH should be paid to keepers before converting it from ETH to KP3R", + "params": { + "_usd": "The amount of USD to quote to ETH" + }, + "returns": { + "_amountOut": "The resulting amount of ETH after quoting the USD" + } + }, + "setKeep3rV2(address)": { + "params": { + "_keep3rV2": "The address of Keep3r V2" + } + }, + "setKp3rWethPool(address)": { + "params": { + "_poolAddress": "The address of the KP3R-WETH pool" + } + }, + "setMaxBoost(uint256)": { + "params": { + "_maxBoost": "The maximum boost multiplier" + } + }, + "setMinBaseFee(uint256)": { + "params": { + "_minBaseFee": "The minimum rewarded gas fee" + } + }, + "setMinBoost(uint256)": { + "params": { + "_minBoost": "The minimum boost multiplier" + } + }, + "setMinPriorityFee(uint256)": { + "params": { + "_minPriorityFee": "The minimum rewarded priority fee" + } + }, + "setOracle(address,address)": { + "details": "The oracle must contain KP3R as either token0 or token1", + "params": { + "_liquidity": "The address of the liquidity", + "_oracle": "The address of the pool used to quote the liquidity from" + } + }, + "setPendingGovernor(address)": { + "params": { + "_pendingGovernor": "Address of the proposed new governor" + } + }, + "setQuoteTwapTime(uint32)": { + "params": { + "_quoteTwapTime": "The twap time for quoting" + } + }, + "setTargetBond(uint256)": { + "params": { + "_targetBond": "The target bond amount" + } + }, + "setWethUsdPool(address,uint8)": { + "details": "The oracle must contain WETH as either token0 or token1", + "params": { + "_poolAddress": "The address of the pool used as oracle", + "_usdDecimals": "The amount of decimals of the USD token paired with ETH" + } + }, + "setWorkExtraGas(uint256)": { + "params": { + "_workExtraGas": "The work extra gas" + } + } + }, + "stateVariables": { + "_USD_BASE_DECIMALS": { + "details": "Amount of decimals in which USD is quoted within the contract" + }, + "oracle": { + "return": "_oracle The address of the observable pool for given liquidity", + "returns": { + "_0": "_oracle The address of the observable pool for given liquidity" + } + }, + "wethUSDPool": { + "returns": { + "isWETHToken0": "True if calling the token0 method of the pool returns the WETH token address", + "poolAddress": "Address of the pool", + "usdDecimals": "The amount of decimals of the USD token paired with ETH" + } + } + }, + "version": 1 + }, + "userdoc": { + "errors": { + "InvalidAddress()": [ + { + "notice": "Thrown if an address is invalid" + } + ], + "InvalidAmount()": [ + { + "notice": "Thrown if an amount is invalid" + } + ], + "InvalidOraclePool()": [ + { + "notice": "Throws when pool does not have KP3R as token0 nor token1" + } + ], + "LengthMismatch()": [ + { + "notice": "Thrown if the lengths of a set of lists mismatch" + } + ], + "LiquidityPairInvalid()": [ + { + "notice": "Throws when none of the tokens in the liquidity pair is KP3R" + } + ], + "OnlyGovernor()": [ + { + "notice": "Thrown if a non-governor user tries to call a OnlyGovernor function" + } + ], + "OnlyPendingGovernor()": [ + { + "notice": "Thrown if a non-pending-governor user tries to call a OnlyPendingGovernor function" + } + ], + "ZeroAddress()": [ + { + "notice": "Thrown if an address is the zero address" + } + ], + "ZeroAmount()": [ + { + "notice": "Thrown if an amount is zero" + } + ] + }, + "events": { + "Keep3rV2Change(address)": { + "notice": "Emitted when the Keep3r V2 address is changed" + }, + "Kp3rWethPoolChange(address,bool)": { + "notice": "Emitted when the kp3r weth pool is changed" + }, + "MaxBoostChange(uint256)": { + "notice": "Emitted when the maximum boost multiplier is changed" + }, + "MinBaseFeeChange(uint256)": { + "notice": "Emitted when minimum rewarded gas fee is changed" + }, + "MinBoostChange(uint256)": { + "notice": "Emitted when the minimum boost multiplier is changed" + }, + "MinPriorityFeeChange(uint256)": { + "notice": "Emitted when minimum rewarded priority fee is changed" + }, + "OracleSet(address,address)": { + "notice": "The oracle for a liquidity has been saved" + }, + "PendingGovernorAccepted(address)": { + "notice": "Emitted when a new governor is set" + }, + "PendingGovernorSet(address,address)": { + "notice": "Emitted when a new pending governor is set" + }, + "QuoteTwapTimeChange(uint32)": { + "notice": "Emitted when the quote twap time is changed" + }, + "TargetBondChange(uint256)": { + "notice": "Emitted when the target bond amount is changed" + }, + "WethUSDPoolChange(address,bool,uint8)": { + "notice": "Emitted when the WETH USD pool is changed" + }, + "WorkExtraGasChange(uint256)": { + "notice": "Emitted when the work extra gas amount is changed" + } + }, + "kind": "user", + "methods": { + "BOOST_BASE()": { + "notice": "The boost base used to calculate the boost rewards for the keeper" + }, + "KP3R()": { + "notice": "Address of KP3R token" + }, + "WETH()": { + "notice": "Ethereum mainnet WETH address used for quoting references" + }, + "acceptPendingGovernor()": { + "notice": "Allows a proposed governor to accept the governance" + }, + "bonds(address)": { + "notice": "Uses valid wKP3R address from Keep3rSidechain to query keeper bonds" + }, + "getKP3RsAtTick(uint256,int56,uint256)": { + "notice": "Given a tick and a liquidity amount, calculates the underlying KP3R tokens" + }, + "getPaymentParams(uint256)": { + "notice": "Get multiplier, quote, and extra, in order to calculate keeper payment" + }, + "getPoolTokens(address)": { + "notice": "Given a pool address, returns the underlying tokens of the pair" + }, + "getQuoteAtTick(uint128,int56,uint256)": { + "notice": "Given a tick and a token amount, calculates the output in correspondant token" + }, + "getRewardAmount(uint256)": { + "notice": "Calculates the reward (in KP3R) that corresponds to tx.origin for using gas" + }, + "getRewardAmountFor(address,uint256)": { + "notice": "Calculates the reward (in KP3R) that corresponds to a keeper for using gas" + }, + "getRewardBoostFor(uint256)": { + "notice": "Calculates the boost in the reward given to a keeper based on the amount of KP3R that keeper has bonded" + }, + "isKP3RToken0(address)": { + "notice": "Defines the order of the tokens in the pair for twap calculations" + }, + "keep3rV2()": { + "notice": "Address of Keep3r V2" + }, + "kp3rWethPool()": { + "notice": "KP3R-WETH pool that is being used as oracle" + }, + "maxBoost()": { + "notice": "The maximum multiplier used to calculate the amount of gas paid to the Keeper for the gas used to perform a job For example: if the quoted gas used is 1000, then the maximum amount to be paid will be 1000 * maxBoost / BOOST_BASE" + }, + "minBaseFee()": { + "notice": "The minimum base fee that is used to calculate keeper rewards" + }, + "minBoost()": { + "notice": "The minimum multiplier used to calculate the amount of gas paid to the Keeper for the gas used to perform a job For example: if the quoted gas used is 1000, then the minimum amount to be paid will be 1000 * minBoost / BOOST_BASE" + }, + "minPriorityFee()": { + "notice": "The minimum priority fee that is also rewarded for keepers" + }, + "observe(address,uint32[])": { + "notice": "Given an array of secondsAgo, returns UniswapV3 pool cumulatives at that moment" + }, + "quote(uint256)": { + "notice": "Calculates the amount of KP3R that corresponds to the ETH passed into the function" + }, + "quoteTwapTime()": { + "notice": "The twap time for quoting" + }, + "quoteUsdToEth(uint256)": { + "notice": "Quotes USD to ETH" + }, + "setKeep3rV2(address)": { + "notice": "Sets the Keep3r V2 address" + }, + "setKp3rWethPool(address)": { + "notice": "Sets KP3R-WETH pool" + }, + "setMaxBoost(uint256)": { + "notice": "Sets the maximum boost multiplier" + }, + "setMinBaseFee(uint256)": { + "notice": "Sets the minimum rewarded gas fee" + }, + "setMinBoost(uint256)": { + "notice": "Sets the minimum boost multiplier" + }, + "setMinPriorityFee(uint256)": { + "notice": "Sets the minimum rewarded gas priority fee" + }, + "setOracle(address,address)": { + "notice": "Sets an oracle for a given liquidity" + }, + "setPendingGovernor(address)": { + "notice": "Allows a governor to propose a new governor" + }, + "setQuoteTwapTime(uint32)": { + "notice": "Sets the quote twap time" + }, + "setTargetBond(uint256)": { + "notice": "Sets the target bond amount" + }, + "setWethUsdPool(address,uint8)": { + "notice": "Sets an oracle for querying WETH/USD quote" + }, + "setWorkExtraGas(uint256)": { + "notice": "Sets the work extra gas amount" + }, + "targetBond()": { + "notice": "The targeted amount of bonded KP3Rs to max-up reward multiplier For example: if the amount of KP3R the keeper has bonded is targetBond or more, then the keeper will get the maximum boost possible in his rewards, if it's less, the reward boost will be proportional" + }, + "wethUSDPool()": { + "notice": "WETH-USD pool that is being used as oracle" + }, + "workExtraGas()": { + "notice": "The amount of unaccounted gas that is going to be added to keeper payments" + } + }, + "version": 1 + }, + "storageLayout": { + "storage": [ + { + "astId": 82, + "contract": "solidity/contracts/sidechain/Keep3rHelperSidechain.sol:Keep3rHelperSidechain", + "label": "governor", + "offset": 0, + "slot": "0", + "type": "t_address" + }, + { + "astId": 85, + "contract": "solidity/contracts/sidechain/Keep3rHelperSidechain.sol:Keep3rHelperSidechain", + "label": "pendingGovernor", + "offset": 0, + "slot": "1", + "type": "t_address" + }, + { + "astId": 3485, + "contract": "solidity/contracts/sidechain/Keep3rHelperSidechain.sol:Keep3rHelperSidechain", + "label": "minBoost", + "offset": 0, + "slot": "2", + "type": "t_uint256" + }, + { + "astId": 3490, + "contract": "solidity/contracts/sidechain/Keep3rHelperSidechain.sol:Keep3rHelperSidechain", + "label": "maxBoost", + "offset": 0, + "slot": "3", + "type": "t_uint256" + }, + { + "astId": 3495, + "contract": "solidity/contracts/sidechain/Keep3rHelperSidechain.sol:Keep3rHelperSidechain", + "label": "targetBond", + "offset": 0, + "slot": "4", + "type": "t_uint256" + }, + { + "astId": 3500, + "contract": "solidity/contracts/sidechain/Keep3rHelperSidechain.sol:Keep3rHelperSidechain", + "label": "workExtraGas", + "offset": 0, + "slot": "5", + "type": "t_uint256" + }, + { + "astId": 3505, + "contract": "solidity/contracts/sidechain/Keep3rHelperSidechain.sol:Keep3rHelperSidechain", + "label": "quoteTwapTime", + "offset": 0, + "slot": "6", + "type": "t_uint32" + }, + { + "astId": 3510, + "contract": "solidity/contracts/sidechain/Keep3rHelperSidechain.sol:Keep3rHelperSidechain", + "label": "minBaseFee", + "offset": 0, + "slot": "7", + "type": "t_uint256" + }, + { + "astId": 3515, + "contract": "solidity/contracts/sidechain/Keep3rHelperSidechain.sol:Keep3rHelperSidechain", + "label": "minPriorityFee", + "offset": 0, + "slot": "8", + "type": "t_uint256" + }, + { + "astId": 3519, + "contract": "solidity/contracts/sidechain/Keep3rHelperSidechain.sol:Keep3rHelperSidechain", + "label": "keep3rV2", + "offset": 0, + "slot": "9", + "type": "t_address" + }, + { + "astId": 3524, + "contract": "solidity/contracts/sidechain/Keep3rHelperSidechain.sol:Keep3rHelperSidechain", + "label": "kp3rWethPool", + "offset": 0, + "slot": "10", + "type": "t_struct(Kp3rWethOraclePool)13118_storage" + }, + { + "astId": 10085, + "contract": "solidity/contracts/sidechain/Keep3rHelperSidechain.sol:Keep3rHelperSidechain", + "label": "oracle", + "offset": 0, + "slot": "11", + "type": "t_mapping(t_address,t_address)" + }, + { + "astId": 10090, + "contract": "solidity/contracts/sidechain/Keep3rHelperSidechain.sol:Keep3rHelperSidechain", + "label": "wethUSDPool", + "offset": 0, + "slot": "12", + "type": "t_struct(WethUsdOraclePool)15691_storage" + } + ], + "types": { + "t_address": { + "encoding": "inplace", + "label": "address", + "numberOfBytes": "20" + }, + "t_bool": { + "encoding": "inplace", + "label": "bool", + "numberOfBytes": "1" + }, + "t_mapping(t_address,t_address)": { + "encoding": "mapping", + "key": "t_address", + "label": "mapping(address => address)", + "numberOfBytes": "32", + "value": "t_address" + }, + "t_struct(Kp3rWethOraclePool)13118_storage": { + "encoding": "inplace", + "label": "struct IKeep3rHelperParameters.Kp3rWethOraclePool", + "members": [ + { + "astId": 13115, + "contract": "solidity/contracts/sidechain/Keep3rHelperSidechain.sol:Keep3rHelperSidechain", + "label": "poolAddress", + "offset": 0, + "slot": "0", + "type": "t_address" + }, + { + "astId": 13117, + "contract": "solidity/contracts/sidechain/Keep3rHelperSidechain.sol:Keep3rHelperSidechain", + "label": "isKP3RToken0", + "offset": 20, + "slot": "0", + "type": "t_bool" + } + ], + "numberOfBytes": "32" + }, + "t_struct(WethUsdOraclePool)15691_storage": { + "encoding": "inplace", + "label": "struct IKeep3rHelperSidechain.WethUsdOraclePool", + "members": [ + { + "astId": 15686, + "contract": "solidity/contracts/sidechain/Keep3rHelperSidechain.sol:Keep3rHelperSidechain", + "label": "poolAddress", + "offset": 0, + "slot": "0", + "type": "t_address" + }, + { + "astId": 15688, + "contract": "solidity/contracts/sidechain/Keep3rHelperSidechain.sol:Keep3rHelperSidechain", + "label": "isWETHToken0", + "offset": 20, + "slot": "0", + "type": "t_bool" + }, + { + "astId": 15690, + "contract": "solidity/contracts/sidechain/Keep3rHelperSidechain.sol:Keep3rHelperSidechain", + "label": "usdDecimals", + "offset": 21, + "slot": "0", + "type": "t_uint8" + } + ], + "numberOfBytes": "32" + }, + "t_uint256": { + "encoding": "inplace", + "label": "uint256", + "numberOfBytes": "32" + }, + "t_uint32": { + "encoding": "inplace", + "label": "uint32", + "numberOfBytes": "4" + }, + "t_uint8": { + "encoding": "inplace", + "label": "uint8", + "numberOfBytes": "1" + } + } + } +} \ No newline at end of file diff --git a/deployments/optimisticSepolia/Keep3rSidechainForTestnet.json b/deployments/optimisticSepolia/Keep3rSidechainForTestnet.json new file mode 100644 index 0000000..7d4c7b7 --- /dev/null +++ b/deployments/optimisticSepolia/Keep3rSidechainForTestnet.json @@ -0,0 +1,4048 @@ +{ + "address": "0xC3377b30feD174e65778e7E1DaFBb7686082B428", + "abi": [ + { + "inputs": [ + { + "internalType": "address", + "name": "_governor", + "type": "address" + }, + { + "internalType": "address", + "name": "_keep3rHelper", + "type": "address" + }, + { + "internalType": "address", + "name": "_keep3rV1", + "type": "address" + }, + { + "internalType": "address", + "name": "_keep3rV1Proxy", + "type": "address" + } + ], + "stateMutability": "nonpayable", + "type": "constructor" + }, + { + "inputs": [], + "name": "AlreadyAJob", + "type": "error" + }, + { + "inputs": [], + "name": "AlreadyAKeeper", + "type": "error" + }, + { + "inputs": [], + "name": "AlreadyDisputed", + "type": "error" + }, + { + "inputs": [], + "name": "BondsLocked", + "type": "error" + }, + { + "inputs": [], + "name": "BondsUnexistent", + "type": "error" + }, + { + "inputs": [], + "name": "Deprecated", + "type": "error" + }, + { + "inputs": [], + "name": "Disputed", + "type": "error" + }, + { + "inputs": [], + "name": "DisputerExistent", + "type": "error" + }, + { + "inputs": [], + "name": "DisputerUnexistent", + "type": "error" + }, + { + "inputs": [], + "name": "GasNotInitialized", + "type": "error" + }, + { + "inputs": [], + "name": "InsufficientFunds", + "type": "error" + }, + { + "inputs": [], + "name": "InsufficientJobTokenCredits", + "type": "error" + }, + { + "inputs": [], + "name": "InvalidAddress", + "type": "error" + }, + { + "inputs": [], + "name": "InvalidAmount", + "type": "error" + }, + { + "inputs": [], + "name": "JobAlreadyAdded", + "type": "error" + }, + { + "inputs": [], + "name": "JobDisputed", + "type": "error" + }, + { + "inputs": [], + "name": "JobLiquidityInsufficient", + "type": "error" + }, + { + "inputs": [], + "name": "JobLiquidityLessThanMin", + "type": "error" + }, + { + "inputs": [], + "name": "JobLiquidityUnexistent", + "type": "error" + }, + { + "inputs": [], + "name": "JobMigrationImpossible", + "type": "error" + }, + { + "inputs": [], + "name": "JobMigrationLocked", + "type": "error" + }, + { + "inputs": [], + "name": "JobMigrationUnavailable", + "type": "error" + }, + { + "inputs": [], + "name": "JobTokenCreditsLocked", + "type": "error" + }, + { + "inputs": [], + "name": "JobTokenInsufficient", + "type": "error" + }, + { + "inputs": [], + "name": "JobTokenUnexistent", + "type": "error" + }, + { + "inputs": [], + "name": "JobUnapproved", + "type": "error" + }, + { + "inputs": [], + "name": "JobUnavailable", + "type": "error" + }, + { + "inputs": [], + "name": "LengthMismatch", + "type": "error" + }, + { + "inputs": [], + "name": "LiquidityPairApproved", + "type": "error" + }, + { + "inputs": [], + "name": "LiquidityPairUnapproved", + "type": "error" + }, + { + "inputs": [], + "name": "LiquidityPairUnexistent", + "type": "error" + }, + { + "inputs": [], + "name": "MinRewardPeriod", + "type": "error" + }, + { + "inputs": [], + "name": "NotDisputed", + "type": "error" + }, + { + "inputs": [], + "name": "OnlyDisputer", + "type": "error" + }, + { + "inputs": [], + "name": "OnlyGovernor", + "type": "error" + }, + { + "inputs": [], + "name": "OnlyJobOwner", + "type": "error" + }, + { + "inputs": [], + "name": "OnlyPendingGovernor", + "type": "error" + }, + { + "inputs": [], + "name": "OnlyPendingJobOwner", + "type": "error" + }, + { + "inputs": [], + "name": "OnlySlasher", + "type": "error" + }, + { + "inputs": [], + "name": "SlasherExistent", + "type": "error" + }, + { + "inputs": [], + "name": "SlasherUnexistent", + "type": "error" + }, + { + "inputs": [], + "name": "TokenUnallowed", + "type": "error" + }, + { + "inputs": [], + "name": "UnbondsLocked", + "type": "error" + }, + { + "inputs": [], + "name": "UnbondsUnexistent", + "type": "error" + }, + { + "inputs": [], + "name": "ZeroAddress", + "type": "error" + }, + { + "inputs": [], + "name": "ZeroAmount", + "type": "error" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "_keeper", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "_bond", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "_amount", + "type": "uint256" + } + ], + "name": "Activation", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint256", + "name": "_bondTime", + "type": "uint256" + } + ], + "name": "BondTimeChange", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "_keeper", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "_bonding", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "_amount", + "type": "uint256" + } + ], + "name": "Bonding", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "_jobOrKeeper", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "_disputer", + "type": "address" + } + ], + "name": "Dispute", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "_disputer", + "type": "address" + } + ], + "name": "DisputerAdded", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "_disputer", + "type": "address" + } + ], + "name": "DisputerRemoved", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "_token", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "_amount", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "address", + "name": "_to", + "type": "address" + } + ], + "name": "DustSent", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint256", + "name": "_fee", + "type": "uint256" + } + ], + "name": "FeeChange", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint256", + "name": "_inflationPeriod", + "type": "uint256" + } + ], + "name": "InflationPeriodChange", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "_job", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "_jobOwner", + "type": "address" + } + ], + "name": "JobAddition", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "_fromJob", + "type": "address" + }, + { + "indexed": false, + "internalType": "address", + "name": "_toJob", + "type": "address" + } + ], + "name": "JobMigrationRequested", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "_fromJob", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "_toJob", + "type": "address" + } + ], + "name": "JobMigrationSuccessful", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "_job", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "_previousOwner", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "_newOwner", + "type": "address" + } + ], + "name": "JobOwnershipAssent", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "_job", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "_owner", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "_pendingOwner", + "type": "address" + } + ], + "name": "JobOwnershipChange", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "_job", + "type": "address" + }, + { + "indexed": false, + "internalType": "address", + "name": "_liquidity", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "_slasher", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "_amount", + "type": "uint256" + } + ], + "name": "JobSlashLiquidity", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "_job", + "type": "address" + }, + { + "indexed": false, + "internalType": "address", + "name": "_token", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "_slasher", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "_amount", + "type": "uint256" + } + ], + "name": "JobSlashToken", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "_keep3rHelper", + "type": "address" + } + ], + "name": "Keep3rHelperChange", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "_keep3rV1", + "type": "address" + } + ], + "name": "Keep3rV1Change", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "_keep3rV1Proxy", + "type": "address" + } + ], + "name": "Keep3rV1ProxyChange", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "_keeper", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "_slasher", + "type": "address" + } + ], + "name": "KeeperRevoke", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "_keeper", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "_slasher", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "_amount", + "type": "uint256" + } + ], + "name": "KeeperSlash", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint256", + "name": "_gasLeft", + "type": "uint256" + } + ], + "name": "KeeperValidation", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "_credit", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "_job", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "_keeper", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "_payment", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "_gasLeft", + "type": "uint256" + } + ], + "name": "KeeperWork", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "_job", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "_liquidity", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "_provider", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "_amount", + "type": "uint256" + } + ], + "name": "LiquidityAddition", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "_liquidity", + "type": "address" + } + ], + "name": "LiquidityApproval", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "_job", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "_rewardedAt", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "_currentCredits", + "type": "uint256" + } + ], + "name": "LiquidityCreditsForced", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "_job", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "_rewardedAt", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "_currentCredits", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "_periodCredits", + "type": "uint256" + } + ], + "name": "LiquidityCreditsReward", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint256", + "name": "_liquidityMinimum", + "type": "uint256" + } + ], + "name": "LiquidityMinimumChange", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "_liquidity", + "type": "address" + } + ], + "name": "LiquidityRevocation", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "_job", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "_liquidity", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "_receiver", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "_amount", + "type": "uint256" + } + ], + "name": "LiquidityWithdrawal", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "_newGovernor", + "type": "address" + } + ], + "name": "PendingGovernorAccepted", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "_governor", + "type": "address" + }, + { + "indexed": false, + "internalType": "address", + "name": "_pendingGovernor", + "type": "address" + } + ], + "name": "PendingGovernorSet", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "_jobOrKeeper", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "_resolver", + "type": "address" + } + ], + "name": "Resolve", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint256", + "name": "_rewardPeriodTime", + "type": "uint256" + } + ], + "name": "RewardPeriodTimeChange", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "_slasher", + "type": "address" + } + ], + "name": "SlasherAdded", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "_slasher", + "type": "address" + } + ], + "name": "SlasherRemoved", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "_job", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "_token", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "_provider", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "_amount", + "type": "uint256" + } + ], + "name": "TokenCreditAddition", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "_job", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "_token", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "_receiver", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "_amount", + "type": "uint256" + } + ], + "name": "TokenCreditWithdrawal", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint256", + "name": "_unbondTime", + "type": "uint256" + } + ], + "name": "UnbondTimeChange", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "_keeperOrJob", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "_unbonding", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "_amount", + "type": "uint256" + } + ], + "name": "Unbonding", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "_keeper", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "_bond", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "_amount", + "type": "uint256" + } + ], + "name": "Withdrawal", + "type": "event" + }, + { + "inputs": [], + "name": "ETH_ADDRESS", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_fromJob", + "type": "address" + }, + { + "internalType": "address", + "name": "_toJob", + "type": "address" + } + ], + "name": "acceptJobMigration", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_job", + "type": "address" + } + ], + "name": "acceptJobOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "acceptPendingGovernor", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_bonding", + "type": "address" + } + ], + "name": "activate", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_disputer", + "type": "address" + } + ], + "name": "addDisputer", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_job", + "type": "address" + } + ], + "name": "addJob", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_job", + "type": "address" + }, + { + "internalType": "address", + "name": "_liquidity", + "type": "address" + }, + { + "internalType": "uint256", + "name": "_amount", + "type": "uint256" + } + ], + "name": "addLiquidityToJob", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_slasher", + "type": "address" + } + ], + "name": "addSlasher", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_job", + "type": "address" + }, + { + "internalType": "address", + "name": "_token", + "type": "address" + }, + { + "internalType": "uint256", + "name": "_amount", + "type": "uint256" + } + ], + "name": "addTokenCreditsToJob", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_liquidity", + "type": "address" + } + ], + "name": "approveLiquidity", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "approvedLiquidities", + "outputs": [ + { + "internalType": "address[]", + "name": "_list", + "type": "address[]" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_bonding", + "type": "address" + }, + { + "internalType": "uint256", + "name": "_amount", + "type": "uint256" + } + ], + "name": "bond", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "bondTime", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_keeper", + "type": "address" + }, + { + "internalType": "uint256", + "name": "_payment", + "type": "uint256" + } + ], + "name": "bondedPayment", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + }, + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "name": "bonds", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + }, + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "name": "canActivateAfter", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + }, + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "name": "canWithdrawAfter", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_job", + "type": "address" + }, + { + "internalType": "address", + "name": "_newOwner", + "type": "address" + } + ], + "name": "changeJobOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_token", + "type": "address" + }, + { + "internalType": "address", + "name": "_keeper", + "type": "address" + }, + { + "internalType": "uint256", + "name": "_amount", + "type": "uint256" + } + ], + "name": "directTokenPayment", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_jobOrKeeper", + "type": "address" + } + ], + "name": "dispute", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "name": "disputers", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "name": "disputes", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "fee", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "name": "firstSeen", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_job", + "type": "address" + }, + { + "internalType": "uint256", + "name": "_amount", + "type": "uint256" + } + ], + "name": "forceLiquidityCreditsToJob", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "governor", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "name": "hasBonded", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "inflationPeriod", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_keeper", + "type": "address" + }, + { + "internalType": "address", + "name": "_bond", + "type": "address" + }, + { + "internalType": "uint256", + "name": "_minBond", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "_earned", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "_age", + "type": "uint256" + } + ], + "name": "isBondedKeeper", + "outputs": [ + { + "internalType": "bool", + "name": "_isBondedKeeper", + "type": "bool" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_keeper", + "type": "address" + } + ], + "name": "isKeeper", + "outputs": [ + { + "internalType": "bool", + "name": "_isKeeper", + "type": "bool" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_job", + "type": "address" + } + ], + "name": "jobLiquidityCredits", + "outputs": [ + { + "internalType": "uint256", + "name": "_liquidityCredits", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "name": "jobOwner", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "name": "jobPendingOwner", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_job", + "type": "address" + } + ], + "name": "jobPeriodCredits", + "outputs": [ + { + "internalType": "uint256", + "name": "_periodCredits", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + }, + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "name": "jobTokenCredits", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + }, + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "name": "jobTokenCreditsAddedAt", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "jobs", + "outputs": [ + { + "internalType": "address[]", + "name": "_list", + "type": "address[]" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "keep3rHelper", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "keep3rV1", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "keep3rV1Proxy", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "keepers", + "outputs": [ + { + "internalType": "address[]", + "name": "_list", + "type": "address[]" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + }, + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "name": "liquidityAmount", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "liquidityMinimum", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_fromJob", + "type": "address" + }, + { + "internalType": "address", + "name": "_toJob", + "type": "address" + } + ], + "name": "migrateJob", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_liquidity", + "type": "address" + } + ], + "name": "observeLiquidity", + "outputs": [ + { + "components": [ + { + "internalType": "int56", + "name": "current", + "type": "int56" + }, + { + "internalType": "int56", + "name": "difference", + "type": "int56" + }, + { + "internalType": "uint256", + "name": "period", + "type": "uint256" + } + ], + "internalType": "struct IKeep3rJobFundableLiquidity.TickCache", + "name": "_tickCache", + "type": "tuple" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + }, + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "name": "pendingBonds", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "pendingGovernor", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "name": "pendingJobMigrations", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + }, + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "name": "pendingUnbonds", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_liquidity", + "type": "address" + }, + { + "internalType": "uint256", + "name": "_amount", + "type": "uint256" + } + ], + "name": "quoteLiquidity", + "outputs": [ + { + "internalType": "uint256", + "name": "_periodCredits", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_disputer", + "type": "address" + } + ], + "name": "removeDisputer", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_slasher", + "type": "address" + } + ], + "name": "removeSlasher", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_jobOrKeeper", + "type": "address" + } + ], + "name": "resolve", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_keeper", + "type": "address" + } + ], + "name": "revoke", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_liquidity", + "type": "address" + } + ], + "name": "revokeLiquidity", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "rewardPeriodTime", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "name": "rewardedAt", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_token", + "type": "address" + }, + { + "internalType": "uint256", + "name": "_amount", + "type": "uint256" + }, + { + "internalType": "address", + "name": "_to", + "type": "address" + } + ], + "name": "sendDust", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "_bondTime", + "type": "uint256" + } + ], + "name": "setBondTime", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "_fee", + "type": "uint256" + } + ], + "name": "setFee", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "_inflationPeriod", + "type": "uint256" + } + ], + "name": "setInflationPeriod", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_keep3rHelper", + "type": "address" + } + ], + "name": "setKeep3rHelper", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_keep3rV1", + "type": "address" + } + ], + "name": "setKeep3rV1", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_keep3rV1Proxy", + "type": "address" + } + ], + "name": "setKeep3rV1Proxy", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "_liquidityMinimum", + "type": "uint256" + } + ], + "name": "setLiquidityMinimum", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_pendingGovernor", + "type": "address" + } + ], + "name": "setPendingGovernor", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "_rewardPeriodTime", + "type": "uint256" + } + ], + "name": "setRewardPeriodTime", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "_unbondTime", + "type": "uint256" + } + ], + "name": "setUnbondTime", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_keeper", + "type": "address" + }, + { + "internalType": "address", + "name": "_bonded", + "type": "address" + }, + { + "internalType": "uint256", + "name": "_bondAmount", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "_unbondAmount", + "type": "uint256" + } + ], + "name": "slash", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_job", + "type": "address" + }, + { + "internalType": "address", + "name": "_liquidity", + "type": "address" + }, + { + "internalType": "uint256", + "name": "_amount", + "type": "uint256" + } + ], + "name": "slashLiquidityFromJob", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_job", + "type": "address" + }, + { + "internalType": "address", + "name": "_token", + "type": "address" + }, + { + "internalType": "uint256", + "name": "_amount", + "type": "uint256" + } + ], + "name": "slashTokenFromJob", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "name": "slashers", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "totalBonds", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_job", + "type": "address" + } + ], + "name": "totalJobCredits", + "outputs": [ + { + "internalType": "uint256", + "name": "_credits", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_bonding", + "type": "address" + }, + { + "internalType": "uint256", + "name": "_amount", + "type": "uint256" + } + ], + "name": "unbond", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_job", + "type": "address" + }, + { + "internalType": "address", + "name": "_liquidity", + "type": "address" + }, + { + "internalType": "uint256", + "name": "_amount", + "type": "uint256" + } + ], + "name": "unbondLiquidityFromJob", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "unbondTime", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "virtualReserves", + "outputs": [ + { + "internalType": "int256", + "name": "_virtualReserves", + "type": "int256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_bonding", + "type": "address" + } + ], + "name": "withdraw", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_job", + "type": "address" + }, + { + "internalType": "address", + "name": "_liquidity", + "type": "address" + }, + { + "internalType": "address", + "name": "_receiver", + "type": "address" + } + ], + "name": "withdrawLiquidityFromJob", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_job", + "type": "address" + }, + { + "internalType": "address", + "name": "_token", + "type": "address" + }, + { + "internalType": "uint256", + "name": "_amount", + "type": "uint256" + }, + { + "internalType": "address", + "name": "_receiver", + "type": "address" + } + ], + "name": "withdrawTokenCreditsFromJob", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "name": "workCompleted", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "name": "worked", + "outputs": [], + "stateMutability": "pure", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_keeper", + "type": "address" + }, + { + "internalType": "uint256", + "name": "_usdPerGasUnit", + "type": "uint256" + } + ], + "name": "worked", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "name": "workedAt", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + } + ], + "transactionHash": "0xae5a3273bf386fa7825416989b39b5a1cf043984c5038809125e2010e0c30224", + "receipt": { + "to": null, + "from": "0x169Cf949aB1B25453b70F2Fe874e2c65c10AE0f8", + "contractAddress": "0xC3377b30feD174e65778e7E1DaFBb7686082B428", + "transactionIndex": 2, + "gasUsed": "5549397", + "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "blockHash": "0x5c54478f0c5fa2b7d75daa121c8058a9c61b3762b4f7bda3628ffc54bd2f0600", + "transactionHash": "0xae5a3273bf386fa7825416989b39b5a1cf043984c5038809125e2010e0c30224", + "logs": [], + "blockNumber": 9263784, + "cumulativeGasUsed": "5614284", + "status": 1, + "byzantium": true + }, + "args": [ + "0x169Cf949aB1B25453b70F2Fe874e2c65c10AE0f8", + "0x37d9EEF8c61075C03fC7710175822dAa33Ce3e4b", + "0x12DA5E324EFCBDe7BB4797e1dB2B3477FC4C048f", + "0x2Bd2697ce45B5cD1C75eB8483B91875E576f5662" + ], + "numDeployments": 2, + "solcInputHash": "4e9d9cfe55e24217a94485fe49438e4a", + "metadata": "{\"compiler\":{\"version\":\"0.8.8+commit.dddeac2f\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_governor\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"_keep3rHelper\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"_keep3rV1\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"_keep3rV1Proxy\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"inputs\":[],\"name\":\"AlreadyAJob\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"AlreadyAKeeper\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"AlreadyDisputed\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"BondsLocked\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"BondsUnexistent\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"Deprecated\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"Disputed\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"DisputerExistent\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"DisputerUnexistent\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"GasNotInitialized\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"InsufficientFunds\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"InsufficientJobTokenCredits\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"InvalidAddress\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"InvalidAmount\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"JobAlreadyAdded\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"JobDisputed\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"JobLiquidityInsufficient\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"JobLiquidityLessThanMin\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"JobLiquidityUnexistent\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"JobMigrationImpossible\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"JobMigrationLocked\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"JobMigrationUnavailable\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"JobTokenCreditsLocked\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"JobTokenInsufficient\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"JobTokenUnexistent\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"JobUnapproved\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"JobUnavailable\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"LengthMismatch\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"LiquidityPairApproved\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"LiquidityPairUnapproved\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"LiquidityPairUnexistent\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"MinRewardPeriod\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"NotDisputed\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"OnlyDisputer\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"OnlyGovernor\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"OnlyJobOwner\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"OnlyPendingGovernor\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"OnlyPendingJobOwner\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"OnlySlasher\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"SlasherExistent\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"SlasherUnexistent\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"TokenUnallowed\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"UnbondsLocked\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"UnbondsUnexistent\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"ZeroAddress\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"ZeroAmount\",\"type\":\"error\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"_keeper\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"_bond\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"_amount\",\"type\":\"uint256\"}],\"name\":\"Activation\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"_bondTime\",\"type\":\"uint256\"}],\"name\":\"BondTimeChange\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"_keeper\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"_bonding\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"_amount\",\"type\":\"uint256\"}],\"name\":\"Bonding\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"_jobOrKeeper\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"_disputer\",\"type\":\"address\"}],\"name\":\"Dispute\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"_disputer\",\"type\":\"address\"}],\"name\":\"DisputerAdded\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"_disputer\",\"type\":\"address\"}],\"name\":\"DisputerRemoved\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"_token\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"_amount\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"_to\",\"type\":\"address\"}],\"name\":\"DustSent\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"_fee\",\"type\":\"uint256\"}],\"name\":\"FeeChange\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"_inflationPeriod\",\"type\":\"uint256\"}],\"name\":\"InflationPeriodChange\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"_job\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"_jobOwner\",\"type\":\"address\"}],\"name\":\"JobAddition\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"_fromJob\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"_toJob\",\"type\":\"address\"}],\"name\":\"JobMigrationRequested\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"_fromJob\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"_toJob\",\"type\":\"address\"}],\"name\":\"JobMigrationSuccessful\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"_job\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"_previousOwner\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"_newOwner\",\"type\":\"address\"}],\"name\":\"JobOwnershipAssent\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"_job\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"_owner\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"_pendingOwner\",\"type\":\"address\"}],\"name\":\"JobOwnershipChange\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"_job\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"_liquidity\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"_slasher\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"_amount\",\"type\":\"uint256\"}],\"name\":\"JobSlashLiquidity\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"_job\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"_token\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"_slasher\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"_amount\",\"type\":\"uint256\"}],\"name\":\"JobSlashToken\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"_keep3rHelper\",\"type\":\"address\"}],\"name\":\"Keep3rHelperChange\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"_keep3rV1\",\"type\":\"address\"}],\"name\":\"Keep3rV1Change\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"_keep3rV1Proxy\",\"type\":\"address\"}],\"name\":\"Keep3rV1ProxyChange\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"_keeper\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"_slasher\",\"type\":\"address\"}],\"name\":\"KeeperRevoke\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"_keeper\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"_slasher\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"_amount\",\"type\":\"uint256\"}],\"name\":\"KeeperSlash\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"_gasLeft\",\"type\":\"uint256\"}],\"name\":\"KeeperValidation\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"_credit\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"_job\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"_keeper\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"_payment\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"_gasLeft\",\"type\":\"uint256\"}],\"name\":\"KeeperWork\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"_job\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"_liquidity\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"_provider\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"_amount\",\"type\":\"uint256\"}],\"name\":\"LiquidityAddition\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"_liquidity\",\"type\":\"address\"}],\"name\":\"LiquidityApproval\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"_job\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"_rewardedAt\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"_currentCredits\",\"type\":\"uint256\"}],\"name\":\"LiquidityCreditsForced\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"_job\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"_rewardedAt\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"_currentCredits\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"_periodCredits\",\"type\":\"uint256\"}],\"name\":\"LiquidityCreditsReward\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"_liquidityMinimum\",\"type\":\"uint256\"}],\"name\":\"LiquidityMinimumChange\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"_liquidity\",\"type\":\"address\"}],\"name\":\"LiquidityRevocation\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"_job\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"_liquidity\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"_receiver\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"_amount\",\"type\":\"uint256\"}],\"name\":\"LiquidityWithdrawal\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"_newGovernor\",\"type\":\"address\"}],\"name\":\"PendingGovernorAccepted\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"_governor\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"_pendingGovernor\",\"type\":\"address\"}],\"name\":\"PendingGovernorSet\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"_jobOrKeeper\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"_resolver\",\"type\":\"address\"}],\"name\":\"Resolve\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"_rewardPeriodTime\",\"type\":\"uint256\"}],\"name\":\"RewardPeriodTimeChange\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"_slasher\",\"type\":\"address\"}],\"name\":\"SlasherAdded\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"_slasher\",\"type\":\"address\"}],\"name\":\"SlasherRemoved\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"_job\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"_token\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"_provider\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"_amount\",\"type\":\"uint256\"}],\"name\":\"TokenCreditAddition\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"_job\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"_token\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"_receiver\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"_amount\",\"type\":\"uint256\"}],\"name\":\"TokenCreditWithdrawal\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"_unbondTime\",\"type\":\"uint256\"}],\"name\":\"UnbondTimeChange\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"_keeperOrJob\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"_unbonding\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"_amount\",\"type\":\"uint256\"}],\"name\":\"Unbonding\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"_keeper\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"_bond\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"_amount\",\"type\":\"uint256\"}],\"name\":\"Withdrawal\",\"type\":\"event\"},{\"inputs\":[],\"name\":\"ETH_ADDRESS\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_fromJob\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"_toJob\",\"type\":\"address\"}],\"name\":\"acceptJobMigration\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_job\",\"type\":\"address\"}],\"name\":\"acceptJobOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"acceptPendingGovernor\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_bonding\",\"type\":\"address\"}],\"name\":\"activate\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_disputer\",\"type\":\"address\"}],\"name\":\"addDisputer\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_job\",\"type\":\"address\"}],\"name\":\"addJob\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_job\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"_liquidity\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"_amount\",\"type\":\"uint256\"}],\"name\":\"addLiquidityToJob\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_slasher\",\"type\":\"address\"}],\"name\":\"addSlasher\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_job\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"_token\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"_amount\",\"type\":\"uint256\"}],\"name\":\"addTokenCreditsToJob\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_liquidity\",\"type\":\"address\"}],\"name\":\"approveLiquidity\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"approvedLiquidities\",\"outputs\":[{\"internalType\":\"address[]\",\"name\":\"_list\",\"type\":\"address[]\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_bonding\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"_amount\",\"type\":\"uint256\"}],\"name\":\"bond\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"bondTime\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_keeper\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"_payment\",\"type\":\"uint256\"}],\"name\":\"bondedPayment\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"bonds\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"canActivateAfter\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"canWithdrawAfter\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_job\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"_newOwner\",\"type\":\"address\"}],\"name\":\"changeJobOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_token\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"_keeper\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"_amount\",\"type\":\"uint256\"}],\"name\":\"directTokenPayment\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_jobOrKeeper\",\"type\":\"address\"}],\"name\":\"dispute\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"disputers\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"disputes\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"fee\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"firstSeen\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_job\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"_amount\",\"type\":\"uint256\"}],\"name\":\"forceLiquidityCreditsToJob\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"governor\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"hasBonded\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"inflationPeriod\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_keeper\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"_bond\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"_minBond\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"_earned\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"_age\",\"type\":\"uint256\"}],\"name\":\"isBondedKeeper\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"_isBondedKeeper\",\"type\":\"bool\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_keeper\",\"type\":\"address\"}],\"name\":\"isKeeper\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"_isKeeper\",\"type\":\"bool\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_job\",\"type\":\"address\"}],\"name\":\"jobLiquidityCredits\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"_liquidityCredits\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"jobOwner\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"jobPendingOwner\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_job\",\"type\":\"address\"}],\"name\":\"jobPeriodCredits\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"_periodCredits\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"jobTokenCredits\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"jobTokenCreditsAddedAt\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"jobs\",\"outputs\":[{\"internalType\":\"address[]\",\"name\":\"_list\",\"type\":\"address[]\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"keep3rHelper\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"keep3rV1\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"keep3rV1Proxy\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"keepers\",\"outputs\":[{\"internalType\":\"address[]\",\"name\":\"_list\",\"type\":\"address[]\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"liquidityAmount\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"liquidityMinimum\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_fromJob\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"_toJob\",\"type\":\"address\"}],\"name\":\"migrateJob\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_liquidity\",\"type\":\"address\"}],\"name\":\"observeLiquidity\",\"outputs\":[{\"components\":[{\"internalType\":\"int56\",\"name\":\"current\",\"type\":\"int56\"},{\"internalType\":\"int56\",\"name\":\"difference\",\"type\":\"int56\"},{\"internalType\":\"uint256\",\"name\":\"period\",\"type\":\"uint256\"}],\"internalType\":\"struct IKeep3rJobFundableLiquidity.TickCache\",\"name\":\"_tickCache\",\"type\":\"tuple\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"pendingBonds\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"pendingGovernor\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"pendingJobMigrations\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"pendingUnbonds\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_liquidity\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"_amount\",\"type\":\"uint256\"}],\"name\":\"quoteLiquidity\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"_periodCredits\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_disputer\",\"type\":\"address\"}],\"name\":\"removeDisputer\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_slasher\",\"type\":\"address\"}],\"name\":\"removeSlasher\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_jobOrKeeper\",\"type\":\"address\"}],\"name\":\"resolve\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_keeper\",\"type\":\"address\"}],\"name\":\"revoke\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_liquidity\",\"type\":\"address\"}],\"name\":\"revokeLiquidity\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"rewardPeriodTime\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"rewardedAt\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_token\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"_amount\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"_to\",\"type\":\"address\"}],\"name\":\"sendDust\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_bondTime\",\"type\":\"uint256\"}],\"name\":\"setBondTime\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_fee\",\"type\":\"uint256\"}],\"name\":\"setFee\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_inflationPeriod\",\"type\":\"uint256\"}],\"name\":\"setInflationPeriod\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_keep3rHelper\",\"type\":\"address\"}],\"name\":\"setKeep3rHelper\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_keep3rV1\",\"type\":\"address\"}],\"name\":\"setKeep3rV1\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_keep3rV1Proxy\",\"type\":\"address\"}],\"name\":\"setKeep3rV1Proxy\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_liquidityMinimum\",\"type\":\"uint256\"}],\"name\":\"setLiquidityMinimum\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_pendingGovernor\",\"type\":\"address\"}],\"name\":\"setPendingGovernor\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_rewardPeriodTime\",\"type\":\"uint256\"}],\"name\":\"setRewardPeriodTime\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_unbondTime\",\"type\":\"uint256\"}],\"name\":\"setUnbondTime\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_keeper\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"_bonded\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"_bondAmount\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"_unbondAmount\",\"type\":\"uint256\"}],\"name\":\"slash\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_job\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"_liquidity\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"_amount\",\"type\":\"uint256\"}],\"name\":\"slashLiquidityFromJob\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_job\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"_token\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"_amount\",\"type\":\"uint256\"}],\"name\":\"slashTokenFromJob\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"slashers\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"totalBonds\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_job\",\"type\":\"address\"}],\"name\":\"totalJobCredits\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"_credits\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_bonding\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"_amount\",\"type\":\"uint256\"}],\"name\":\"unbond\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_job\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"_liquidity\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"_amount\",\"type\":\"uint256\"}],\"name\":\"unbondLiquidityFromJob\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"unbondTime\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"virtualReserves\",\"outputs\":[{\"internalType\":\"int256\",\"name\":\"_virtualReserves\",\"type\":\"int256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_bonding\",\"type\":\"address\"}],\"name\":\"withdraw\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_job\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"_liquidity\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"_receiver\",\"type\":\"address\"}],\"name\":\"withdrawLiquidityFromJob\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_job\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"_token\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"_amount\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"_receiver\",\"type\":\"address\"}],\"name\":\"withdrawTokenCreditsFromJob\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"workCompleted\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"worked\",\"outputs\":[],\"stateMutability\":\"pure\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_keeper\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"_usdPerGasUnit\",\"type\":\"uint256\"}],\"name\":\"worked\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"workedAt\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"}],\"devdoc\":{\"kind\":\"dev\",\"methods\":{\"acceptJobMigration(address,address)\":{\"details\":\"Unbond/withdraw process doesn't get migrated\",\"params\":{\"_fromJob\":\"The address of the job that requested to migrate\",\"_toJob\":\"The address to which the job wants to migrate to\"}},\"acceptJobOwnership(address)\":{\"params\":{\"_job\":\"The address of the job\"}},\"activate(address)\":{\"params\":{\"_bonding\":\"The asset being activated as bond collateral\"}},\"addJob(address)\":{\"params\":{\"_job\":\"Address of the contract for which work should be performed\"}},\"addLiquidityToJob(address,address,uint256)\":{\"params\":{\"_amount\":\"The amount of liquidity tokens to add\",\"_job\":\"The address of the job to assign liquidity to\",\"_liquidity\":\"The liquidity being added\"}},\"addTokenCreditsToJob(address,address,uint256)\":{\"params\":{\"_amount\":\"The amount of credit being added\",\"_job\":\"The address of the job being credited\",\"_token\":\"The address of the token being credited\"}},\"approveLiquidity(address)\":{\"details\":\"Function should be called after setting an oracle in Keep3rHelperSidechain\",\"params\":{\"_liquidity\":\"Address of the liquidity token being approved\"}},\"approvedLiquidities()\":{\"returns\":{\"_list\":\"An array of addresses with all the approved liquidity pairs\"}},\"bond(address,uint256)\":{\"params\":{\"_amount\":\"The amount of bonding asset being bonded\",\"_bonding\":\"The asset being bonded\"}},\"bondedPayment(address,uint256)\":{\"details\":\"Pays the keeper that performs the work with KP3R\",\"params\":{\"_keeper\":\"Address of the keeper that performed the work\",\"_payment\":\"The reward that should be allocated for the job\"}},\"changeJobOwnership(address,address)\":{\"params\":{\"_job\":\"The address of the job\",\"_newOwner\":\"The address of the proposed new owner\"}},\"directTokenPayment(address,address,uint256)\":{\"details\":\"Pays the keeper that performs the work with a specific token\",\"params\":{\"_amount\":\"The reward that should be allocated\",\"_keeper\":\"Address of the keeper that performed the work\",\"_token\":\"The asset being awarded to the keeper\"}},\"dispute(address)\":{\"params\":{\"_jobOrKeeper\":\"The address in dispute\"}},\"forceLiquidityCreditsToJob(address,uint256)\":{\"params\":{\"_amount\":\"The amount of liquidity credits to gift\",\"_job\":\"The address of the job being credited\"}},\"isBondedKeeper(address,address,uint256,uint256,uint256)\":{\"details\":\"Should be used for protected functions\",\"params\":{\"_age\":\"The minimum keeper age required\",\"_bond\":\"The bond token being evaluated\",\"_earned\":\"The minimum funds earned in the keepers lifetime\",\"_keeper\":\"The keeper to check\",\"_minBond\":\"The minimum amount of bonded tokens\"},\"returns\":{\"_isBondedKeeper\":\"Whether the `_keeper` meets the given requirements\"}},\"isKeeper(address)\":{\"details\":\"Can be used for general (non critical) functions\",\"params\":{\"_keeper\":\"The keeper being investigated\"},\"returns\":{\"_isKeeper\":\"Whether the address passed as a parameter is a keeper or not\"}},\"jobLiquidityCredits(address)\":{\"params\":{\"_job\":\"The address of the job of which we want to know the liquidity credits\"},\"returns\":{\"_liquidityCredits\":\"The liquidity credits of a given job\"}},\"jobPeriodCredits(address)\":{\"params\":{\"_job\":\"The address of the job of which we want to know the period credits\"},\"returns\":{\"_periodCredits\":\"The credits the given job has at the current period\"}},\"jobs()\":{\"returns\":{\"_list\":\"Array with all the jobs in _jobs\"}},\"keepers()\":{\"returns\":{\"_list\":\"Array with all the keepers in _keepers\"}},\"migrateJob(address,address)\":{\"params\":{\"_fromJob\":\"The address of the job that is requesting to migrate\",\"_toJob\":\"The address at which the job is requesting to migrate\"}},\"observeLiquidity(address)\":{\"params\":{\"_liquidity\":\"Address of the liquidity token being observed\"}},\"quoteLiquidity(address,uint256)\":{\"details\":\"_periodCredits = underlying KP3Rs for given liquidity amount * rewardPeriod / inflationPeriod\",\"params\":{\"_amount\":\"The amount of liquidity to provide\",\"_liquidity\":\"The address of the liquidity to provide\"},\"returns\":{\"_periodCredits\":\"The amount of KP3R periodically minted for the given liquidity\"}},\"resolve(address)\":{\"params\":{\"_jobOrKeeper\":\"The address cleared\"}},\"revoke(address)\":{\"params\":{\"_keeper\":\"The address being slashed\"}},\"revokeLiquidity(address)\":{\"params\":{\"_liquidity\":\"The liquidity no longer accepted\"}},\"sendDust(address,uint256,address)\":{\"params\":{\"_amount\":\"The amont of the token that will be transferred\",\"_to\":\"The address that will receive the idle funds\",\"_token\":\"The token that will be transferred\"}},\"setBondTime(uint256)\":{\"params\":{\"_bond\":\"The new bond time\"}},\"setFee(uint256)\":{\"params\":{\"_fee\":\"The new fee\"}},\"setInflationPeriod(uint256)\":{\"params\":{\"_inflationPeriod\":\"The new inflation period\"}},\"setKeep3rHelper(address)\":{\"params\":{\"_keep3rHelper\":\"The Keep3rHelper address\"}},\"setKeep3rV1(address)\":{\"params\":{\"_keep3rV1\":\"The Keep3rV1 address\"}},\"setKeep3rV1Proxy(address)\":{\"params\":{\"_keep3rV1Proxy\":\"The Keep3rV1Proxy address\"}},\"setLiquidityMinimum(uint256)\":{\"params\":{\"_liquidityMinimum\":\"The new minimum amount of liquidity\"}},\"setPendingGovernor(address)\":{\"params\":{\"_pendingGovernor\":\"Address of the proposed new governor\"}},\"setRewardPeriodTime(uint256)\":{\"params\":{\"_rewardPeriodTime\":\"The new amount of time required to pass between rewards\"}},\"setUnbondTime(uint256)\":{\"params\":{\"_unbond\":\"The new unbond time\"}},\"slash(address,address,uint256,uint256)\":{\"params\":{\"_bondAmount\":\"The bonded amount being slashed\",\"_bonded\":\"The asset being slashed\",\"_keeper\":\"The address being slashed\",\"_unbondAmount\":\"The pending unbond amount being slashed\"}},\"slashLiquidityFromJob(address,address,uint256)\":{\"params\":{\"_amount\":\"The amount of liquidity that will be slashed\",\"_job\":\"The address being slashed\",\"_liquidity\":\"The address of the liquidity that will be slashed\"}},\"slashTokenFromJob(address,address,uint256)\":{\"params\":{\"_amount\":\"The amount of the token that will be slashed\",\"_job\":\"The address of the job from which the token will be slashed\",\"_token\":\"The address of the token that will be slashed\"}},\"totalJobCredits(address)\":{\"params\":{\"_job\":\"The address of the job of which we want to know the total credits\"},\"returns\":{\"_credits\":\"The total credits of the given job\"}},\"unbond(address,uint256)\":{\"params\":{\"_amount\":\"Allows for partial unbonding\",\"_bonding\":\"The asset being unbonded\"}},\"unbondLiquidityFromJob(address,address,uint256)\":{\"details\":\"Can only be called by the job's owner\",\"params\":{\"_amount\":\"The amount of liquidity being removed\",\"_job\":\"The address of the job being unbonded from\",\"_liquidity\":\"The liquidity being unbonded\"}},\"virtualReserves()\":{\"returns\":{\"_virtualReserves\":\"The surplus amount of wKP3Rs in escrow contract\"}},\"withdraw(address)\":{\"params\":{\"_bonding\":\"The asset to withdraw from the bonding pool\"}},\"withdrawLiquidityFromJob(address,address,address)\":{\"params\":{\"_job\":\"The address of the job being withdrawn from\",\"_liquidity\":\"The liquidity being withdrawn\",\"_receiver\":\"The address that will receive the withdrawn liquidity\"}},\"withdrawTokenCreditsFromJob(address,address,uint256,address)\":{\"params\":{\"_amount\":\"The amount of token to be withdrawn\",\"_job\":\"The address of the job from which the credits are withdrawn\",\"_receiver\":\"The user that will receive tokens\",\"_token\":\"The address of the token being withdrawn\"}},\"worked(address)\":{\"details\":\"Sidechain implementation deprecates worked(address) as it should come with a usdPerGasUnit parameter\"},\"worked(address,uint256)\":{\"details\":\"Uses a USD per gas unit payment mechanism\",\"params\":{\"_keeper\":\"Address of the keeper that performed the work\",\"_usdPerGasUnit\":\"Units of USD (in wei) per gas unit that should be rewarded to the keeper\"}}},\"version\":1},\"userdoc\":{\"errors\":{\"AlreadyAJob()\":[{\"notice\":\"Throws when the address that is trying to register as a job is already a job\"}],\"AlreadyAKeeper()\":[{\"notice\":\"Throws when the address that is trying to register as a keeper is already a keeper\"}],\"AlreadyDisputed()\":[{\"notice\":\"Throws when a job or keeper is already disputed\"}],\"BondsLocked()\":[{\"notice\":\"Throws if the time required to bond an asset has not passed yet\"}],\"BondsUnexistent()\":[{\"notice\":\"Throws if there are no bonded assets\"}],\"Deprecated()\":[{\"notice\":\"Throws when job contract calls deprecated worked(address) function\"}],\"Disputed()\":[{\"notice\":\"Throws if either a job or a keeper is disputed\"}],\"DisputerExistent()\":[{\"notice\":\"Throws if the address is already a registered disputer\"}],\"DisputerUnexistent()\":[{\"notice\":\"Throws if caller is not a registered disputer\"}],\"GasNotInitialized()\":[{\"notice\":\"Throws if work method was called without calling isKeeper or isBondedKeeper\"}],\"InsufficientFunds()\":[{\"notice\":\"Throws if the amount of funds in the job is less than the payment that must be paid to the keeper that works that job\"}],\"InsufficientJobTokenCredits()\":[{\"notice\":\"Throws when the user tries to withdraw more tokens than it has\"}],\"InvalidAddress()\":[{\"notice\":\"Thrown if an address is invalid\"}],\"InvalidAmount()\":[{\"notice\":\"Thrown if an amount is invalid\"}],\"JobAlreadyAdded()\":[{\"notice\":\"Throws when trying to add a job that has already been added\"}],\"JobDisputed()\":[{\"notice\":\"Throws when an action that requires an undisputed job is applied on a disputed job\"}],\"JobLiquidityInsufficient()\":[{\"notice\":\"Throws when trying to remove more liquidity than the job has\"}],\"JobLiquidityLessThanMin()\":[{\"notice\":\"Throws when trying to add less liquidity than the minimum liquidity required\"}],\"JobLiquidityUnexistent()\":[{\"notice\":\"Throws when the job doesn't have the requested liquidity\"}],\"JobMigrationImpossible()\":[{\"notice\":\"Throws when the address of the job that requests to migrate wants to migrate to its same address\"}],\"JobMigrationLocked()\":[{\"notice\":\"Throws when cooldown between migrations has not yet passed\"}],\"JobMigrationUnavailable()\":[{\"notice\":\"Throws when the _toJob address differs from the address being tracked in the pendingJobMigrations mapping\"}],\"JobTokenCreditsLocked()\":[{\"notice\":\"Throws when the token withdraw cooldown has not yet passed\"}],\"JobTokenInsufficient()\":[{\"notice\":\"Throws when someone tries to slash more tokens than the job has\"}],\"JobTokenUnexistent()\":[{\"notice\":\"Throws when the token trying to be slashed doesn't exist\"}],\"JobUnapproved()\":[{\"notice\":\"Throws if the address claiming to be a job is not in the list of approved jobs\"}],\"JobUnavailable()\":[{\"notice\":\"Throws when an address is passed as a job, but that address is not a job\"}],\"LengthMismatch()\":[{\"notice\":\"Thrown if the lengths of a set of lists mismatch\"}],\"LiquidityPairApproved()\":[{\"notice\":\"Throws when the liquidity being approved has already been approved\"}],\"LiquidityPairUnapproved()\":[{\"notice\":\"Throws when trying to add liquidity to an unapproved pool\"}],\"LiquidityPairUnexistent()\":[{\"notice\":\"Throws when the liquidity being removed has not been approved\"}],\"MinRewardPeriod()\":[{\"notice\":\"Throws if the reward period is less than the minimum reward period time\"}],\"NotDisputed()\":[{\"notice\":\"Throws when a job or keeper is not disputed and someone tries to resolve the dispute\"}],\"OnlyDisputer()\":[{\"notice\":\"Throws if the msg.sender is not a disputer or is not a part of governance\"}],\"OnlyGovernor()\":[{\"notice\":\"Thrown if a non-governor user tries to call a OnlyGovernor function\"}],\"OnlyJobOwner()\":[{\"notice\":\"Throws when the caller of the function is not the job owner\"}],\"OnlyPendingGovernor()\":[{\"notice\":\"Thrown if a non-pending-governor user tries to call a OnlyPendingGovernor function\"}],\"OnlyPendingJobOwner()\":[{\"notice\":\"Throws when the caller of the function is not the pending job owner\"}],\"OnlySlasher()\":[{\"notice\":\"Throws if the msg.sender is not a slasher or is not a part of governance\"}],\"SlasherExistent()\":[{\"notice\":\"Throws if the address is already a registered slasher\"}],\"SlasherUnexistent()\":[{\"notice\":\"Throws if caller is not a registered slasher\"}],\"TokenUnallowed()\":[{\"notice\":\"Throws when the token is KP3R, as it should not be used for direct token payments\"}],\"UnbondsLocked()\":[{\"notice\":\"Throws if the time required to withdraw the bonds has not passed yet\"}],\"UnbondsUnexistent()\":[{\"notice\":\"Throws if there are no bonds to withdraw\"}],\"ZeroAddress()\":[{\"notice\":\"Thrown if an address is the zero address\"}],\"ZeroAmount()\":[{\"notice\":\"Thrown if an amount is zero\"}]},\"events\":{\"Activation(address,address,uint256)\":{\"notice\":\"Emitted when Keep3rKeeperFundable#activate is called\"},\"BondTimeChange(uint256)\":{\"notice\":\"Emitted when bondTime is changed\"},\"Bonding(address,address,uint256)\":{\"notice\":\"Emitted when the bonding process of a new keeper begins\"},\"Dispute(address,address)\":{\"notice\":\"Emitted when a keeper or a job is disputed\"},\"DisputerAdded(address)\":{\"notice\":\"Emitted when a disputer is added\"},\"DisputerRemoved(address)\":{\"notice\":\"Emitted when a disputer is removed\"},\"DustSent(address,uint256,address)\":{\"notice\":\"Emitted when dust is sent\"},\"FeeChange(uint256)\":{\"notice\":\"Emitted when the fee is changed\"},\"InflationPeriodChange(uint256)\":{\"notice\":\"Emitted when the inflationPeriod is changed\"},\"JobAddition(address,address)\":{\"notice\":\"Emitted when Keep3rJobManager#addJob is called\"},\"JobMigrationRequested(address,address)\":{\"notice\":\"Emitted when Keep3rJobMigration#migrateJob function is called\"},\"JobMigrationSuccessful(address,address)\":{\"notice\":\"Emitted when Keep3rJobMigration#acceptJobMigration function is called\"},\"JobOwnershipAssent(address,address,address)\":{\"notice\":\"Emitted when Keep3rJobOwnership#JobOwnershipAssent is called\"},\"JobOwnershipChange(address,address,address)\":{\"notice\":\"Emitted when Keep3rJobOwnership#changeJobOwnership is called\"},\"JobSlashLiquidity(address,address,address,uint256)\":{\"notice\":\"Emitted when Keep3rJobDisputable#slashLiquidityFromJob is called\"},\"JobSlashToken(address,address,address,uint256)\":{\"notice\":\"Emitted when Keep3rJobDisputable#slashTokenFromJob is called\"},\"Keep3rHelperChange(address)\":{\"notice\":\"Emitted when the Keep3rHelper address is changed\"},\"Keep3rV1Change(address)\":{\"notice\":\"Emitted when the Keep3rV1 address is changed\"},\"Keep3rV1ProxyChange(address)\":{\"notice\":\"Emitted when the Keep3rV1Proxy address is changed\"},\"KeeperRevoke(address,address)\":{\"notice\":\"Emitted when Keep3rKeeperDisputable#revoke is called\"},\"KeeperSlash(address,address,uint256)\":{\"notice\":\"Emitted when Keep3rKeeperDisputable#slash is called\"},\"KeeperValidation(uint256)\":{\"notice\":\"Emitted when a keeper is validated before a job\"},\"KeeperWork(address,address,address,uint256,uint256)\":{\"notice\":\"Emitted when a keeper works a job\"},\"LiquidityAddition(address,address,address,uint256)\":{\"notice\":\"Emitted when IKeep3rJobFundableLiquidity#addLiquidityToJob function is called\"},\"LiquidityApproval(address)\":{\"notice\":\"Emitted when Keep3rJobFundableLiquidity#approveLiquidity function is called\"},\"LiquidityCreditsForced(address,uint256,uint256)\":{\"notice\":\"Emitted when Keep3rJobFundableLiquidity#forceLiquidityCreditsToJob function is called\"},\"LiquidityCreditsReward(address,uint256,uint256,uint256)\":{\"notice\":\"Emitted when Keep3rJobFundableLiquidity#addLiquidityToJob function is called\"},\"LiquidityMinimumChange(uint256)\":{\"notice\":\"Emitted when _liquidityMinimum is changed\"},\"LiquidityRevocation(address)\":{\"notice\":\"Emitted when Keep3rJobFundableLiquidity#revokeLiquidity function is called\"},\"LiquidityWithdrawal(address,address,address,uint256)\":{\"notice\":\"Emitted when IKeep3rJobFundableLiquidity#withdrawLiquidityFromJob function is called\"},\"PendingGovernorAccepted(address)\":{\"notice\":\"Emitted when a new governor is set\"},\"PendingGovernorSet(address,address)\":{\"notice\":\"Emitted when a new pending governor is set\"},\"Resolve(address,address)\":{\"notice\":\"Emitted when a dispute is resolved\"},\"RewardPeriodTimeChange(uint256)\":{\"notice\":\"Emitted when _rewardPeriodTime is changed\"},\"SlasherAdded(address)\":{\"notice\":\"Emitted when a slasher is added\"},\"SlasherRemoved(address)\":{\"notice\":\"Emitted when a slasher is removed\"},\"TokenCreditAddition(address,address,address,uint256)\":{\"notice\":\"Emitted when Keep3rJobFundableCredits#addTokenCreditsToJob is called\"},\"TokenCreditWithdrawal(address,address,address,uint256)\":{\"notice\":\"Emitted when Keep3rJobFundableCredits#withdrawTokenCreditsFromJob is called\"},\"UnbondTimeChange(uint256)\":{\"notice\":\"Emitted when _unbondTime is changed\"},\"Unbonding(address,address,uint256)\":{\"notice\":\"Emitted when a keeper or job begins the unbonding process to withdraw the funds\"},\"Withdrawal(address,address,uint256)\":{\"notice\":\"Emitted when Keep3rKeeperFundable#withdraw is called\"}},\"kind\":\"user\",\"methods\":{\"acceptJobMigration(address,address)\":{\"notice\":\"Completes the migration process for a job\"},\"acceptJobOwnership(address)\":{\"notice\":\"The proposed address accepts to be the owner of the job\"},\"acceptPendingGovernor()\":{\"notice\":\"Allows a proposed governor to accept the governance\"},\"activate(address)\":{\"notice\":\"End of the bonding process after bonding time has passed\"},\"addDisputer(address)\":{\"notice\":\"Registers a disputer by updating the disputers mapping\"},\"addJob(address)\":{\"notice\":\"Allows any caller to add a new job\"},\"addLiquidityToJob(address,address,uint256)\":{\"notice\":\"Allows anyone to fund a job with liquidity\"},\"addSlasher(address)\":{\"notice\":\"Registers a slasher by updating the slashers mapping\"},\"addTokenCreditsToJob(address,address,uint256)\":{\"notice\":\"Add credit to a job to be paid out for work\"},\"approveLiquidity(address)\":{\"notice\":\"Sidechain implementation asks the Helper for an oracle, instead of reading it from the ERC-20\"},\"approvedLiquidities()\":{\"notice\":\"Lists liquidity pairs\"},\"bond(address,uint256)\":{\"notice\":\"Beginning of the bonding process\"},\"bondTime()\":{\"notice\":\"The amount of time required to pass after a keeper has bonded assets for it to be able to activate\"},\"bondedPayment(address,uint256)\":{\"notice\":\"Implemented by jobs to show that a keeper performed work\"},\"bonds(address,address)\":{\"notice\":\"Mapping (job => bonding => amount)\"},\"canActivateAfter(address,address)\":{\"notice\":\"Tracks when a bonding for a keeper can be activated\"},\"canWithdrawAfter(address,address)\":{\"notice\":\"Tracks when keeper bonds are ready to be withdrawn\"},\"changeJobOwnership(address,address)\":{\"notice\":\"Proposes a new address to be the owner of the job\"},\"directTokenPayment(address,address,uint256)\":{\"notice\":\"Implemented by jobs to show that a keeper performed work\"},\"dispute(address)\":{\"notice\":\"Allows governor to create a dispute for a given keeper/job\"},\"disputers(address)\":{\"notice\":\"Tracks whether the address is a disputer or not\"},\"disputes(address)\":{\"notice\":\"Tracks if a keeper or job has a pending dispute\"},\"fee()\":{\"notice\":\"The fee to be sent to governor when a user adds liquidity to a job\"},\"firstSeen(address)\":{\"notice\":\"Tracks when a keeper was first registered\"},\"forceLiquidityCreditsToJob(address,uint256)\":{\"notice\":\"Gifts liquidity credits to the specified job\"},\"hasBonded(address)\":{\"notice\":\"Checks whether the address has ever bonded an asset\"},\"inflationPeriod()\":{\"notice\":\"The inflation period is the denominator used to regulate the emission of KP3R\"},\"isBondedKeeper(address,address,uint256,uint256,uint256)\":{\"notice\":\"Confirms if the current keeper is registered and has a minimum bond of any asset.\"},\"isKeeper(address)\":{\"notice\":\"Confirms if the current keeper is registered\"},\"jobLiquidityCredits(address)\":{\"notice\":\"Returns the liquidity credits of a given job\"},\"jobOwner(address)\":{\"notice\":\"Maps the job to the owner of the job\"},\"jobPendingOwner(address)\":{\"notice\":\"Maps the job to its pending owner\"},\"jobPeriodCredits(address)\":{\"notice\":\"Returns the credits of a given job for the current period\"},\"jobTokenCredits(address,address)\":{\"notice\":\"The current token credits available for a job\"},\"jobTokenCreditsAddedAt(address,address)\":{\"notice\":\"Last block where tokens were added to the job\"},\"jobs()\":{\"notice\":\"Lists all jobs\"},\"keep3rHelper()\":{\"notice\":\"Address of Keep3rHelper's contract\"},\"keep3rV1()\":{\"notice\":\"Address of Keep3rV1's contract\"},\"keep3rV1Proxy()\":{\"notice\":\"Address of Keep3rV1Proxy's contract\"},\"keepers()\":{\"notice\":\"Lists all keepers\"},\"liquidityAmount(address,address)\":{\"notice\":\"Amount of liquidity in a specified job\"},\"liquidityMinimum()\":{\"notice\":\"The minimum amount of liquidity required to fund a job per liquidity\"},\"migrateJob(address,address)\":{\"notice\":\"Initializes the migration process for a job by adding the request to the pendingJobMigrations mapping\"},\"observeLiquidity(address)\":{\"notice\":\"Sidechain implementation will always ask for 2 tickCumulatives instead of cacheing\"},\"pendingBonds(address,address)\":{\"notice\":\"Tracks the amount of assets deposited in pending bonds\"},\"pendingJobMigrations(address)\":{\"notice\":\"Maps the jobs that have requested a migration to the address they have requested to migrate to\"},\"pendingUnbonds(address,address)\":{\"notice\":\"Tracks how much keeper bonds are to be withdrawn\"},\"quoteLiquidity(address,uint256)\":{\"notice\":\"Calculates how many credits should be rewarded periodically for a given liquidity amount\"},\"removeDisputer(address)\":{\"notice\":\"Removes a disputer by updating the disputers mapping\"},\"removeSlasher(address)\":{\"notice\":\"Removes a slasher by updating the slashers mapping\"},\"resolve(address)\":{\"notice\":\"Allows governor to resolve a dispute on a keeper/job\"},\"revoke(address)\":{\"notice\":\"Blacklists a keeper from participating in the network\"},\"revokeLiquidity(address)\":{\"notice\":\"Revoke a liquidity pair from being accepted in future\"},\"rewardPeriodTime()\":{\"notice\":\"The amount of time between each scheduled credits reward given to a job\"},\"rewardedAt(address)\":{\"notice\":\"Last time the job was rewarded liquidity credits\"},\"sendDust(address,uint256,address)\":{\"notice\":\"Allows an authorized user to transfer the tokens or eth that may have been left in a contract\"},\"setBondTime(uint256)\":{\"notice\":\"Sets the bond time required to activate as a keeper\"},\"setFee(uint256)\":{\"notice\":\"Sets the new fee\"},\"setInflationPeriod(uint256)\":{\"notice\":\"Sets the new inflation period\"},\"setKeep3rHelper(address)\":{\"notice\":\"Sets the Keep3rHelper address\"},\"setKeep3rV1(address)\":{\"notice\":\"Sets the Keep3rV1 address\"},\"setKeep3rV1Proxy(address)\":{\"notice\":\"Sets the Keep3rV1Proxy address\"},\"setLiquidityMinimum(uint256)\":{\"notice\":\"Sets the minimum amount of liquidity required to fund a job\"},\"setPendingGovernor(address)\":{\"notice\":\"Allows a governor to propose a new governor\"},\"setRewardPeriodTime(uint256)\":{\"notice\":\"Sets the time required to pass between rewards for jobs\"},\"setUnbondTime(uint256)\":{\"notice\":\"Sets the unbond time required unbond what has been bonded\"},\"slash(address,address,uint256,uint256)\":{\"notice\":\"Allows governor to slash a keeper based on a dispute\"},\"slashLiquidityFromJob(address,address,uint256)\":{\"notice\":\"Allows governor or slasher to slash liquidity from a job\"},\"slashTokenFromJob(address,address,uint256)\":{\"notice\":\"Allows governor or slasher to slash a job specific token\"},\"slashers(address)\":{\"notice\":\"Tracks whether the address is a slasher or not\"},\"totalBonds()\":{\"notice\":\"Tracks the total amount of bonded KP3Rs in the contract\"},\"totalJobCredits(address)\":{\"notice\":\"Calculates the total credits of a given job\"},\"unbond(address,uint256)\":{\"notice\":\"Beginning of the unbonding process\"},\"unbondLiquidityFromJob(address,address,uint256)\":{\"notice\":\"Unbond liquidity for a job\"},\"unbondTime()\":{\"notice\":\"The amount of time required to pass before a keeper can unbond what he has bonded\"},\"virtualReserves()\":{\"notice\":\"The surplus amount of wKP3Rs in escrow contract\"},\"withdraw(address)\":{\"notice\":\"Withdraw funds after unbonding has finished\"},\"withdrawLiquidityFromJob(address,address,address)\":{\"notice\":\"Withdraw liquidity from a job\"},\"withdrawTokenCreditsFromJob(address,address,uint256,address)\":{\"notice\":\"Withdraw credit from a job\"},\"workCompleted(address)\":{\"notice\":\"Tracks the total KP3R earnings of a keeper since it started working\"},\"worked(address,uint256)\":{\"notice\":\"Implemented by jobs to show that a keeper performed work\"},\"workedAt(address)\":{\"notice\":\"Last time the job was worked\"}},\"version\":1}},\"settings\":{\"compilationTarget\":{\"solidity/for-test/testnet/Keep3rSidechainForTestnet.sol\":\"Keep3rSidechainForTestnet\"},\"evmVersion\":\"london\",\"libraries\":{\":__CACHE_BREAKER__\":\"0x00000000d41867734bbee4c6863d9255b2b06ac1\"},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":200},\"remappings\":[]},\"sources\":{\"@defi-wonderland/solidity-utils/solidity/contracts/DustCollector.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.8 <0.9.0;\\n\\nimport {Governable} from './Governable.sol';\\nimport {IDustCollector} from '../interfaces/IDustCollector.sol';\\nimport {IERC20} from '@openzeppelin/contracts/token/ERC20/IERC20.sol';\\nimport {SafeERC20} from '@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol';\\n\\n/// @title DustCollector contract\\nabstract contract DustCollector is IDustCollector, Governable {\\n using SafeERC20 for IERC20;\\n\\n /// @inheritdoc IDustCollector\\n address public constant ETH_ADDRESS = 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE;\\n\\n /// @inheritdoc IDustCollector\\n function sendDust(address _token, uint256 _amount, address _to) external onlyGovernor {\\n if (_to == address(0)) revert ZeroAddress();\\n if (_token == ETH_ADDRESS) payable(_to).transfer(_amount);\\n else IERC20(_token).safeTransfer(_to, _amount);\\n emit DustSent(_token, _amount, _to);\\n }\\n}\\n\",\"keccak256\":\"0xcdd6d0715406facd602770cca9320eebdc2b7b23b0e0f9e1b7b576fbc0126b47\",\"license\":\"MIT\"},\"@defi-wonderland/solidity-utils/solidity/contracts/Governable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.8 <0.9.0;\\n\\nimport {IGovernable} from '../interfaces/IGovernable.sol';\\n\\n/// @title Governable contract\\n/// @notice Manages the governor role\\nabstract contract Governable is IGovernable {\\n /// @inheritdoc IGovernable\\n address public governor;\\n\\n /// @inheritdoc IGovernable\\n address public pendingGovernor;\\n\\n constructor(address _governor) {\\n if (_governor == address(0)) revert ZeroAddress();\\n governor = _governor;\\n }\\n\\n /// @inheritdoc IGovernable\\n function setPendingGovernor(address _pendingGovernor) external onlyGovernor {\\n _setPendingGovernor(_pendingGovernor);\\n }\\n\\n /// @inheritdoc IGovernable\\n function acceptPendingGovernor() external onlyPendingGovernor {\\n _acceptPendingGovernor();\\n }\\n\\n function _setPendingGovernor(address _pendingGovernor) internal {\\n if (_pendingGovernor == address(0)) revert ZeroAddress();\\n pendingGovernor = _pendingGovernor;\\n emit PendingGovernorSet(governor, _pendingGovernor);\\n }\\n\\n function _acceptPendingGovernor() internal {\\n governor = pendingGovernor;\\n delete pendingGovernor;\\n emit PendingGovernorAccepted(governor);\\n }\\n\\n /// @notice Functions with this modifier can only be called by governor\\n modifier onlyGovernor() {\\n if (msg.sender != governor) revert OnlyGovernor();\\n _;\\n }\\n\\n /// @notice Functions with this modifier can only be called by pendingGovernor\\n modifier onlyPendingGovernor() {\\n if (msg.sender != pendingGovernor) revert OnlyPendingGovernor();\\n _;\\n }\\n}\\n\",\"keccak256\":\"0x3f11408cfcb015a99dc417e075c8ebc39b796fc2adc3e81b036487e4486881b3\",\"license\":\"MIT\"},\"@defi-wonderland/solidity-utils/solidity/interfaces/IBaseErrors.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.8 <0.9.0;\\n\\ninterface IBaseErrors {\\n /// @notice Thrown if an address is invalid\\n error InvalidAddress();\\n\\n /// @notice Thrown if an amount is invalid\\n error InvalidAmount();\\n\\n /// @notice Thrown if the lengths of a set of lists mismatch\\n error LengthMismatch();\\n\\n /// @notice Thrown if an address is the zero address\\n error ZeroAddress();\\n\\n /// @notice Thrown if an amount is zero\\n error ZeroAmount();\\n}\\n\",\"keccak256\":\"0xec09b9d248b6fbf6343dee41d6978abdc15d4c8df5ed7721e8df79e8b1a558cf\",\"license\":\"MIT\"},\"@defi-wonderland/solidity-utils/solidity/interfaces/IDustCollector.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.8 <0.9.0;\\n\\nimport {IGovernable} from './IGovernable.sol';\\nimport {IBaseErrors} from './IBaseErrors.sol';\\n\\n/// @title DustCollector interface\\ninterface IDustCollector is IBaseErrors, IGovernable {\\n // STATE VARIABLES\\n\\n /// @return _ethAddress Address used to trigger a native token transfer\\n // solhint-disable-next-line func-name-mixedcase\\n function ETH_ADDRESS() external view returns (address _ethAddress);\\n\\n // EVENTS\\n\\n /// @notice Emitted when dust is sent\\n /// @param _to The address which wil received the funds\\n /// @param _token The token that will be transferred\\n /// @param _amount The amount of the token that will be transferred\\n event DustSent(address _token, uint256 _amount, address _to);\\n\\n // FUNCTIONS\\n\\n /// @notice Allows an authorized user to transfer the tokens or eth that may have been left in a contract\\n /// @param _token The token that will be transferred\\n /// @param _amount The amont of the token that will be transferred\\n /// @param _to The address that will receive the idle funds\\n function sendDust(address _token, uint256 _amount, address _to) external;\\n}\\n\",\"keccak256\":\"0xbe22cc660bd6846093504989146038bd369f511325cef40cdc647fe7e04206b1\",\"license\":\"MIT\"},\"@defi-wonderland/solidity-utils/solidity/interfaces/IGovernable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.8 <0.9.0;\\n\\nimport {IBaseErrors} from './IBaseErrors.sol';\\n\\n/// @title Governable interface\\ninterface IGovernable is IBaseErrors {\\n // STATE VARIABLES\\n\\n /// @return _governor Address of the current governor\\n function governor() external view returns (address _governor);\\n\\n /// @return _pendingGovernor Address of the current pending governor\\n function pendingGovernor() external view returns (address _pendingGovernor);\\n\\n // EVENTS\\n\\n /// @notice Emitted when a new pending governor is set\\n /// @param _governor Address of the current governor\\n /// @param _pendingGovernor Address of the proposed next governor\\n event PendingGovernorSet(address _governor, address _pendingGovernor);\\n\\n /// @notice Emitted when a new governor is set\\n /// @param _newGovernor Address of the new governor\\n event PendingGovernorAccepted(address _newGovernor);\\n\\n // ERRORS\\n\\n /// @notice Thrown if a non-governor user tries to call a OnlyGovernor function\\n error OnlyGovernor();\\n\\n /// @notice Thrown if a non-pending-governor user tries to call a OnlyPendingGovernor function\\n error OnlyPendingGovernor();\\n\\n // FUNCTIONS\\n\\n /// @notice Allows a governor to propose a new governor\\n /// @param _pendingGovernor Address of the proposed new governor\\n function setPendingGovernor(address _pendingGovernor) external;\\n\\n /// @notice Allows a proposed governor to accept the governance\\n function acceptPendingGovernor() external;\\n}\\n\",\"keccak256\":\"0x40b94706a00d2c092f620807ba84bdd0c5ed8cfa60140c924edc850427e0af13\",\"license\":\"MIT\"},\"@openzeppelin/contracts/security/ReentrancyGuard.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Contract module that helps prevent reentrant calls to a function.\\n *\\n * Inheriting from `ReentrancyGuard` will make the {nonReentrant} modifier\\n * available, which can be applied to functions to make sure there are no nested\\n * (reentrant) calls to them.\\n *\\n * Note that because there is a single `nonReentrant` guard, functions marked as\\n * `nonReentrant` may not call one another. This can be worked around by making\\n * those functions `private`, and then adding `external` `nonReentrant` entry\\n * points to them.\\n *\\n * TIP: If you would like to learn more about reentrancy and alternative ways\\n * to protect against it, check out our blog post\\n * https://blog.openzeppelin.com/reentrancy-after-istanbul/[Reentrancy After Istanbul].\\n */\\nabstract contract ReentrancyGuard {\\n // Booleans are more expensive than uint256 or any type that takes up a full\\n // word because each write operation emits an extra SLOAD to first read the\\n // slot's contents, replace the bits taken up by the boolean, and then write\\n // back. This is the compiler's defense against contract upgrades and\\n // pointer aliasing, and it cannot be disabled.\\n\\n // The values being non-zero value makes deployment a bit more expensive,\\n // but in exchange the refund on every call to nonReentrant will be lower in\\n // amount. Since refunds are capped to a percentage of the total\\n // transaction's gas, it is best to keep them low in cases like this one, to\\n // increase the likelihood of the full refund coming into effect.\\n uint256 private constant _NOT_ENTERED = 1;\\n uint256 private constant _ENTERED = 2;\\n\\n uint256 private _status;\\n\\n constructor() {\\n _status = _NOT_ENTERED;\\n }\\n\\n /**\\n * @dev Prevents a contract from calling itself, directly or indirectly.\\n * Calling a `nonReentrant` function from another `nonReentrant`\\n * function is not supported. It is possible to prevent this from happening\\n * by making the `nonReentrant` function external, and make it call a\\n * `private` function that does the actual work.\\n */\\n modifier nonReentrant() {\\n // On the first call to nonReentrant, _notEntered will be true\\n require(_status != _ENTERED, \\\"ReentrancyGuard: reentrant call\\\");\\n\\n // Any calls to nonReentrant after this point will fail\\n _status = _ENTERED;\\n\\n _;\\n\\n // By storing the original value once again, a refund is triggered (see\\n // https://eips.ethereum.org/EIPS/eip-2200)\\n _status = _NOT_ENTERED;\\n }\\n}\\n\",\"keccak256\":\"0x842ccf9a6cd33e17b7acef8372ca42090755217b358fe0c44c98e951ea549d3a\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC20/IERC20.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Interface of the ERC20 standard as defined in the EIP.\\n */\\ninterface IERC20 {\\n /**\\n * @dev Returns the amount of tokens in existence.\\n */\\n function totalSupply() external view returns (uint256);\\n\\n /**\\n * @dev Returns the amount of tokens owned by `account`.\\n */\\n function balanceOf(address account) external view returns (uint256);\\n\\n /**\\n * @dev Moves `amount` tokens from the caller's account to `recipient`.\\n *\\n * Returns a boolean value indicating whether the operation succeeded.\\n *\\n * Emits a {Transfer} event.\\n */\\n function transfer(address recipient, uint256 amount) external returns (bool);\\n\\n /**\\n * @dev Returns the remaining number of tokens that `spender` will be\\n * allowed to spend on behalf of `owner` through {transferFrom}. This is\\n * zero by default.\\n *\\n * This value changes when {approve} or {transferFrom} are called.\\n */\\n function allowance(address owner, address spender) external view returns (uint256);\\n\\n /**\\n * @dev Sets `amount` as the allowance of `spender` over the caller's tokens.\\n *\\n * Returns a boolean value indicating whether the operation succeeded.\\n *\\n * IMPORTANT: Beware that changing an allowance with this method brings the risk\\n * that someone may use both the old and the new allowance by unfortunate\\n * transaction ordering. One possible solution to mitigate this race\\n * condition is to first reduce the spender's allowance to 0 and set the\\n * desired value afterwards:\\n * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729\\n *\\n * Emits an {Approval} event.\\n */\\n function approve(address spender, uint256 amount) external returns (bool);\\n\\n /**\\n * @dev Moves `amount` tokens from `sender` to `recipient` using the\\n * allowance mechanism. `amount` is then deducted from the caller's\\n * allowance.\\n *\\n * Returns a boolean value indicating whether the operation succeeded.\\n *\\n * Emits a {Transfer} event.\\n */\\n function transferFrom(\\n address sender,\\n address recipient,\\n uint256 amount\\n ) external returns (bool);\\n\\n /**\\n * @dev Emitted when `value` tokens are moved from one account (`from`) to\\n * another (`to`).\\n *\\n * Note that `value` may be zero.\\n */\\n event Transfer(address indexed from, address indexed to, uint256 value);\\n\\n /**\\n * @dev Emitted when the allowance of a `spender` for an `owner` is set by\\n * a call to {approve}. `value` is the new allowance.\\n */\\n event Approval(address indexed owner, address indexed spender, uint256 value);\\n}\\n\",\"keccak256\":\"0x027b891937d20ccf213fdb9c31531574256de774bda99d3a70ecef6e1913ed2a\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../IERC20.sol\\\";\\n\\n/**\\n * @dev Interface for the optional metadata functions from the ERC20 standard.\\n *\\n * _Available since v4.1._\\n */\\ninterface IERC20Metadata is IERC20 {\\n /**\\n * @dev Returns the name of the token.\\n */\\n function name() external view returns (string memory);\\n\\n /**\\n * @dev Returns the symbol of the token.\\n */\\n function symbol() external view returns (string memory);\\n\\n /**\\n * @dev Returns the decimals places of the token.\\n */\\n function decimals() external view returns (uint8);\\n}\\n\",\"keccak256\":\"0x83fe24f5c04a56091e50f4a345ff504c8bff658a76d4c43b16878c8f940c53b2\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../IERC20.sol\\\";\\nimport \\\"../../../utils/Address.sol\\\";\\n\\n/**\\n * @title SafeERC20\\n * @dev Wrappers around ERC20 operations that throw on failure (when the token\\n * contract returns false). Tokens that return no value (and instead revert or\\n * throw on failure) are also supported, non-reverting calls are assumed to be\\n * successful.\\n * To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract,\\n * which allows you to call the safe operations as `token.safeTransfer(...)`, etc.\\n */\\nlibrary SafeERC20 {\\n using Address for address;\\n\\n function safeTransfer(\\n IERC20 token,\\n address to,\\n uint256 value\\n ) internal {\\n _callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value));\\n }\\n\\n function safeTransferFrom(\\n IERC20 token,\\n address from,\\n address to,\\n uint256 value\\n ) internal {\\n _callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value));\\n }\\n\\n /**\\n * @dev Deprecated. This function has issues similar to the ones found in\\n * {IERC20-approve}, and its usage is discouraged.\\n *\\n * Whenever possible, use {safeIncreaseAllowance} and\\n * {safeDecreaseAllowance} instead.\\n */\\n function safeApprove(\\n IERC20 token,\\n address spender,\\n uint256 value\\n ) internal {\\n // safeApprove should only be called when setting an initial allowance,\\n // or when resetting it to zero. To increase and decrease it, use\\n // 'safeIncreaseAllowance' and 'safeDecreaseAllowance'\\n require(\\n (value == 0) || (token.allowance(address(this), spender) == 0),\\n \\\"SafeERC20: approve from non-zero to non-zero allowance\\\"\\n );\\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value));\\n }\\n\\n function safeIncreaseAllowance(\\n IERC20 token,\\n address spender,\\n uint256 value\\n ) internal {\\n uint256 newAllowance = token.allowance(address(this), spender) + value;\\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));\\n }\\n\\n function safeDecreaseAllowance(\\n IERC20 token,\\n address spender,\\n uint256 value\\n ) internal {\\n unchecked {\\n uint256 oldAllowance = token.allowance(address(this), spender);\\n require(oldAllowance >= value, \\\"SafeERC20: decreased allowance below zero\\\");\\n uint256 newAllowance = oldAllowance - value;\\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));\\n }\\n }\\n\\n /**\\n * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement\\n * on the return value: the return value is optional (but if data is returned, it must not be false).\\n * @param token The token targeted by the call.\\n * @param data The call data (encoded using abi.encode or one of its variants).\\n */\\n function _callOptionalReturn(IERC20 token, bytes memory data) private {\\n // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since\\n // we're implementing it ourselves. We use {Address.functionCall} to perform this call, which verifies that\\n // the target address contains contract code and also asserts for success in the low-level call.\\n\\n bytes memory returndata = address(token).functionCall(data, \\\"SafeERC20: low-level call failed\\\");\\n if (returndata.length > 0) {\\n // Return data is optional\\n require(abi.decode(returndata, (bool)), \\\"SafeERC20: ERC20 operation did not succeed\\\");\\n }\\n }\\n}\\n\",\"keccak256\":\"0x02348b2e4b9f3200c7e3907c5c2661643a6d8520e9f79939fbb9b4005a54894d\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/Address.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Collection of functions related to the address type\\n */\\nlibrary Address {\\n /**\\n * @dev Returns true if `account` is a contract.\\n *\\n * [IMPORTANT]\\n * ====\\n * It is unsafe to assume that an address for which this function returns\\n * false is an externally-owned account (EOA) and not a contract.\\n *\\n * Among others, `isContract` will return false for the following\\n * types of addresses:\\n *\\n * - an externally-owned account\\n * - a contract in construction\\n * - an address where a contract will be created\\n * - an address where a contract lived, but was destroyed\\n * ====\\n */\\n function isContract(address account) internal view returns (bool) {\\n // This method relies on extcodesize, which returns 0 for contracts in\\n // construction, since the code is only stored at the end of the\\n // constructor execution.\\n\\n uint256 size;\\n assembly {\\n size := extcodesize(account)\\n }\\n return size > 0;\\n }\\n\\n /**\\n * @dev Replacement for Solidity's `transfer`: sends `amount` wei to\\n * `recipient`, forwarding all available gas and reverting on errors.\\n *\\n * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost\\n * of certain opcodes, possibly making contracts go over the 2300 gas limit\\n * imposed by `transfer`, making them unable to receive funds via\\n * `transfer`. {sendValue} removes this limitation.\\n *\\n * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].\\n *\\n * IMPORTANT: because control is transferred to `recipient`, care must be\\n * taken to not create reentrancy vulnerabilities. Consider using\\n * {ReentrancyGuard} or the\\n * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].\\n */\\n function sendValue(address payable recipient, uint256 amount) internal {\\n require(address(this).balance >= amount, \\\"Address: insufficient balance\\\");\\n\\n (bool success, ) = recipient.call{value: amount}(\\\"\\\");\\n require(success, \\\"Address: unable to send value, recipient may have reverted\\\");\\n }\\n\\n /**\\n * @dev Performs a Solidity function call using a low level `call`. A\\n * plain `call` is an unsafe replacement for a function call: use this\\n * function instead.\\n *\\n * If `target` reverts with a revert reason, it is bubbled up by this\\n * function (like regular Solidity function calls).\\n *\\n * Returns the raw returned data. To convert to the expected return value,\\n * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\\n *\\n * Requirements:\\n *\\n * - `target` must be a contract.\\n * - calling `target` with `data` must not revert.\\n *\\n * _Available since v3.1._\\n */\\n function functionCall(address target, bytes memory data) internal returns (bytes memory) {\\n return functionCall(target, data, \\\"Address: low-level call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with\\n * `errorMessage` as a fallback revert reason when `target` reverts.\\n *\\n * _Available since v3.1._\\n */\\n function functionCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, 0, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but also transferring `value` wei to `target`.\\n *\\n * Requirements:\\n *\\n * - the calling contract must have an ETH balance of at least `value`.\\n * - the called Solidity function must be `payable`.\\n *\\n * _Available since v3.1._\\n */\\n function functionCallWithValue(\\n address target,\\n bytes memory data,\\n uint256 value\\n ) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, value, \\\"Address: low-level call with value failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but\\n * with `errorMessage` as a fallback revert reason when `target` reverts.\\n *\\n * _Available since v3.1._\\n */\\n function functionCallWithValue(\\n address target,\\n bytes memory data,\\n uint256 value,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n require(address(this).balance >= value, \\\"Address: insufficient balance for call\\\");\\n require(isContract(target), \\\"Address: call to non-contract\\\");\\n\\n (bool success, bytes memory returndata) = target.call{value: value}(data);\\n return verifyCallResult(success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but performing a static call.\\n *\\n * _Available since v3.3._\\n */\\n function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\\n return functionStaticCall(target, data, \\\"Address: low-level static call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\\n * but performing a static call.\\n *\\n * _Available since v3.3._\\n */\\n function functionStaticCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal view returns (bytes memory) {\\n require(isContract(target), \\\"Address: static call to non-contract\\\");\\n\\n (bool success, bytes memory returndata) = target.staticcall(data);\\n return verifyCallResult(success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but performing a delegate call.\\n *\\n * _Available since v3.4._\\n */\\n function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {\\n return functionDelegateCall(target, data, \\\"Address: low-level delegate call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\\n * but performing a delegate call.\\n *\\n * _Available since v3.4._\\n */\\n function functionDelegateCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n require(isContract(target), \\\"Address: delegate call to non-contract\\\");\\n\\n (bool success, bytes memory returndata) = target.delegatecall(data);\\n return verifyCallResult(success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the\\n * revert reason using the provided one.\\n *\\n * _Available since v4.3._\\n */\\n function verifyCallResult(\\n bool success,\\n bytes memory returndata,\\n string memory errorMessage\\n ) internal pure returns (bytes memory) {\\n if (success) {\\n return returndata;\\n } else {\\n // Look for revert reason and bubble it up if present\\n if (returndata.length > 0) {\\n // The easiest way to bubble the revert reason is using memory via assembly\\n\\n assembly {\\n let returndata_size := mload(returndata)\\n revert(add(32, returndata), returndata_size)\\n }\\n } else {\\n revert(errorMessage);\\n }\\n }\\n }\\n}\\n\",\"keccak256\":\"0x3336baae5cf23e94274d75336e2d412193be508504aee185e61dc7d58cd05c8a\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/math/Math.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Standard math utilities missing in the Solidity language.\\n */\\nlibrary Math {\\n /**\\n * @dev Returns the largest of two numbers.\\n */\\n function max(uint256 a, uint256 b) internal pure returns (uint256) {\\n return a >= b ? a : b;\\n }\\n\\n /**\\n * @dev Returns the smallest of two numbers.\\n */\\n function min(uint256 a, uint256 b) internal pure returns (uint256) {\\n return a < b ? a : b;\\n }\\n\\n /**\\n * @dev Returns the average of two numbers. The result is rounded towards\\n * zero.\\n */\\n function average(uint256 a, uint256 b) internal pure returns (uint256) {\\n // (a + b) / 2 can overflow.\\n return (a & b) + (a ^ b) / 2;\\n }\\n\\n /**\\n * @dev Returns the ceiling of the division of two numbers.\\n *\\n * This differs from standard division with `/` in that it rounds up instead\\n * of rounding down.\\n */\\n function ceilDiv(uint256 a, uint256 b) internal pure returns (uint256) {\\n // (a + b - 1) / b can overflow on addition, so we distribute.\\n return a / b + (a % b == 0 ? 0 : 1);\\n }\\n}\\n\",\"keccak256\":\"0x49ebdac5d515aebb95168564158940b79d7d5d12fbfe59cec546a00d57fee64a\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/structs/EnumerableSet.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Library for managing\\n * https://en.wikipedia.org/wiki/Set_(abstract_data_type)[sets] of primitive\\n * types.\\n *\\n * Sets have the following properties:\\n *\\n * - Elements are added, removed, and checked for existence in constant time\\n * (O(1)).\\n * - Elements are enumerated in O(n). No guarantees are made on the ordering.\\n *\\n * ```\\n * contract Example {\\n * // Add the library methods\\n * using EnumerableSet for EnumerableSet.AddressSet;\\n *\\n * // Declare a set state variable\\n * EnumerableSet.AddressSet private mySet;\\n * }\\n * ```\\n *\\n * As of v3.3.0, sets of type `bytes32` (`Bytes32Set`), `address` (`AddressSet`)\\n * and `uint256` (`UintSet`) are supported.\\n */\\nlibrary EnumerableSet {\\n // To implement this library for multiple types with as little code\\n // repetition as possible, we write it in terms of a generic Set type with\\n // bytes32 values.\\n // The Set implementation uses private functions, and user-facing\\n // implementations (such as AddressSet) are just wrappers around the\\n // underlying Set.\\n // This means that we can only create new EnumerableSets for types that fit\\n // in bytes32.\\n\\n struct Set {\\n // Storage of set values\\n bytes32[] _values;\\n // Position of the value in the `values` array, plus 1 because index 0\\n // means a value is not in the set.\\n mapping(bytes32 => uint256) _indexes;\\n }\\n\\n /**\\n * @dev Add a value to a set. O(1).\\n *\\n * Returns true if the value was added to the set, that is if it was not\\n * already present.\\n */\\n function _add(Set storage set, bytes32 value) private returns (bool) {\\n if (!_contains(set, value)) {\\n set._values.push(value);\\n // The value is stored at length-1, but we add 1 to all indexes\\n // and use 0 as a sentinel value\\n set._indexes[value] = set._values.length;\\n return true;\\n } else {\\n return false;\\n }\\n }\\n\\n /**\\n * @dev Removes a value from a set. O(1).\\n *\\n * Returns true if the value was removed from the set, that is if it was\\n * present.\\n */\\n function _remove(Set storage set, bytes32 value) private returns (bool) {\\n // We read and store the value's index to prevent multiple reads from the same storage slot\\n uint256 valueIndex = set._indexes[value];\\n\\n if (valueIndex != 0) {\\n // Equivalent to contains(set, value)\\n // To delete an element from the _values array in O(1), we swap the element to delete with the last one in\\n // the array, and then remove the last element (sometimes called as 'swap and pop').\\n // This modifies the order of the array, as noted in {at}.\\n\\n uint256 toDeleteIndex = valueIndex - 1;\\n uint256 lastIndex = set._values.length - 1;\\n\\n if (lastIndex != toDeleteIndex) {\\n bytes32 lastvalue = set._values[lastIndex];\\n\\n // Move the last value to the index where the value to delete is\\n set._values[toDeleteIndex] = lastvalue;\\n // Update the index for the moved value\\n set._indexes[lastvalue] = valueIndex; // Replace lastvalue's index to valueIndex\\n }\\n\\n // Delete the slot where the moved value was stored\\n set._values.pop();\\n\\n // Delete the index for the deleted slot\\n delete set._indexes[value];\\n\\n return true;\\n } else {\\n return false;\\n }\\n }\\n\\n /**\\n * @dev Returns true if the value is in the set. O(1).\\n */\\n function _contains(Set storage set, bytes32 value) private view returns (bool) {\\n return set._indexes[value] != 0;\\n }\\n\\n /**\\n * @dev Returns the number of values on the set. O(1).\\n */\\n function _length(Set storage set) private view returns (uint256) {\\n return set._values.length;\\n }\\n\\n /**\\n * @dev Returns the value stored at position `index` in the set. O(1).\\n *\\n * Note that there are no guarantees on the ordering of values inside the\\n * array, and it may change when more values are added or removed.\\n *\\n * Requirements:\\n *\\n * - `index` must be strictly less than {length}.\\n */\\n function _at(Set storage set, uint256 index) private view returns (bytes32) {\\n return set._values[index];\\n }\\n\\n /**\\n * @dev Return the entire set in an array\\n *\\n * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed\\n * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that\\n * this function has an unbounded cost, and using it as part of a state-changing function may render the function\\n * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.\\n */\\n function _values(Set storage set) private view returns (bytes32[] memory) {\\n return set._values;\\n }\\n\\n // Bytes32Set\\n\\n struct Bytes32Set {\\n Set _inner;\\n }\\n\\n /**\\n * @dev Add a value to a set. O(1).\\n *\\n * Returns true if the value was added to the set, that is if it was not\\n * already present.\\n */\\n function add(Bytes32Set storage set, bytes32 value) internal returns (bool) {\\n return _add(set._inner, value);\\n }\\n\\n /**\\n * @dev Removes a value from a set. O(1).\\n *\\n * Returns true if the value was removed from the set, that is if it was\\n * present.\\n */\\n function remove(Bytes32Set storage set, bytes32 value) internal returns (bool) {\\n return _remove(set._inner, value);\\n }\\n\\n /**\\n * @dev Returns true if the value is in the set. O(1).\\n */\\n function contains(Bytes32Set storage set, bytes32 value) internal view returns (bool) {\\n return _contains(set._inner, value);\\n }\\n\\n /**\\n * @dev Returns the number of values in the set. O(1).\\n */\\n function length(Bytes32Set storage set) internal view returns (uint256) {\\n return _length(set._inner);\\n }\\n\\n /**\\n * @dev Returns the value stored at position `index` in the set. O(1).\\n *\\n * Note that there are no guarantees on the ordering of values inside the\\n * array, and it may change when more values are added or removed.\\n *\\n * Requirements:\\n *\\n * - `index` must be strictly less than {length}.\\n */\\n function at(Bytes32Set storage set, uint256 index) internal view returns (bytes32) {\\n return _at(set._inner, index);\\n }\\n\\n /**\\n * @dev Return the entire set in an array\\n *\\n * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed\\n * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that\\n * this function has an unbounded cost, and using it as part of a state-changing function may render the function\\n * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.\\n */\\n function values(Bytes32Set storage set) internal view returns (bytes32[] memory) {\\n return _values(set._inner);\\n }\\n\\n // AddressSet\\n\\n struct AddressSet {\\n Set _inner;\\n }\\n\\n /**\\n * @dev Add a value to a set. O(1).\\n *\\n * Returns true if the value was added to the set, that is if it was not\\n * already present.\\n */\\n function add(AddressSet storage set, address value) internal returns (bool) {\\n return _add(set._inner, bytes32(uint256(uint160(value))));\\n }\\n\\n /**\\n * @dev Removes a value from a set. O(1).\\n *\\n * Returns true if the value was removed from the set, that is if it was\\n * present.\\n */\\n function remove(AddressSet storage set, address value) internal returns (bool) {\\n return _remove(set._inner, bytes32(uint256(uint160(value))));\\n }\\n\\n /**\\n * @dev Returns true if the value is in the set. O(1).\\n */\\n function contains(AddressSet storage set, address value) internal view returns (bool) {\\n return _contains(set._inner, bytes32(uint256(uint160(value))));\\n }\\n\\n /**\\n * @dev Returns the number of values in the set. O(1).\\n */\\n function length(AddressSet storage set) internal view returns (uint256) {\\n return _length(set._inner);\\n }\\n\\n /**\\n * @dev Returns the value stored at position `index` in the set. O(1).\\n *\\n * Note that there are no guarantees on the ordering of values inside the\\n * array, and it may change when more values are added or removed.\\n *\\n * Requirements:\\n *\\n * - `index` must be strictly less than {length}.\\n */\\n function at(AddressSet storage set, uint256 index) internal view returns (address) {\\n return address(uint160(uint256(_at(set._inner, index))));\\n }\\n\\n /**\\n * @dev Return the entire set in an array\\n *\\n * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed\\n * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that\\n * this function has an unbounded cost, and using it as part of a state-changing function may render the function\\n * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.\\n */\\n function values(AddressSet storage set) internal view returns (address[] memory) {\\n bytes32[] memory store = _values(set._inner);\\n address[] memory result;\\n\\n assembly {\\n result := store\\n }\\n\\n return result;\\n }\\n\\n // UintSet\\n\\n struct UintSet {\\n Set _inner;\\n }\\n\\n /**\\n * @dev Add a value to a set. O(1).\\n *\\n * Returns true if the value was added to the set, that is if it was not\\n * already present.\\n */\\n function add(UintSet storage set, uint256 value) internal returns (bool) {\\n return _add(set._inner, bytes32(value));\\n }\\n\\n /**\\n * @dev Removes a value from a set. O(1).\\n *\\n * Returns true if the value was removed from the set, that is if it was\\n * present.\\n */\\n function remove(UintSet storage set, uint256 value) internal returns (bool) {\\n return _remove(set._inner, bytes32(value));\\n }\\n\\n /**\\n * @dev Returns true if the value is in the set. O(1).\\n */\\n function contains(UintSet storage set, uint256 value) internal view returns (bool) {\\n return _contains(set._inner, bytes32(value));\\n }\\n\\n /**\\n * @dev Returns the number of values on the set. O(1).\\n */\\n function length(UintSet storage set) internal view returns (uint256) {\\n return _length(set._inner);\\n }\\n\\n /**\\n * @dev Returns the value stored at position `index` in the set. O(1).\\n *\\n * Note that there are no guarantees on the ordering of values inside the\\n * array, and it may change when more values are added or removed.\\n *\\n * Requirements:\\n *\\n * - `index` must be strictly less than {length}.\\n */\\n function at(UintSet storage set, uint256 index) internal view returns (uint256) {\\n return uint256(_at(set._inner, index));\\n }\\n\\n /**\\n * @dev Return the entire set in an array\\n *\\n * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed\\n * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that\\n * this function has an unbounded cost, and using it as part of a state-changing function may render the function\\n * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.\\n */\\n function values(UintSet storage set) internal view returns (uint256[] memory) {\\n bytes32[] memory store = _values(set._inner);\\n uint256[] memory result;\\n\\n assembly {\\n result := store\\n }\\n\\n return result;\\n }\\n}\\n\",\"keccak256\":\"0x3778dc944f4a696335878bad8beca60f38b7c79b7a0bd8ddbeb618bd502a95ae\",\"license\":\"MIT\"},\"solidity/contracts/Keep3r.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\n/*\\n\\nCoded for The Keep3r Network with \\u2665 by\\n\\n\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2557\\u2591\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2557\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2557\\u2588\\u2588\\u2557\\u2591\\u2591\\u2591\\u2588\\u2588\\u2557\\u2591\\u2591\\u2591\\u2591\\u2591\\u2591\\u2591\\u2588\\u2588\\u2557\\u2591\\u2588\\u2588\\u2588\\u2588\\u2588\\u2557\\u2591\\u2588\\u2588\\u2588\\u2557\\u2591\\u2591\\u2588\\u2588\\u2557\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2557\\u2591\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2557\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2557\\u2591\\u2588\\u2588\\u2557\\u2591\\u2591\\u2591\\u2591\\u2591\\u2591\\u2588\\u2588\\u2588\\u2588\\u2588\\u2557\\u2591\\u2588\\u2588\\u2588\\u2557\\u2591\\u2591\\u2588\\u2588\\u2557\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2557\\u2591\\n\\u2588\\u2588\\u2554\\u2550\\u2550\\u2588\\u2588\\u2557\\u2588\\u2588\\u2554\\u2550\\u2550\\u2550\\u2550\\u255d\\u2588\\u2588\\u2554\\u2550\\u2550\\u2550\\u2550\\u255d\\u2588\\u2588\\u2551\\u2591\\u2591\\u2591\\u2588\\u2588\\u2551\\u2591\\u2591\\u2588\\u2588\\u2557\\u2591\\u2591\\u2588\\u2588\\u2551\\u2588\\u2588\\u2554\\u2550\\u2550\\u2588\\u2588\\u2557\\u2588\\u2588\\u2588\\u2588\\u2557\\u2591\\u2588\\u2588\\u2551\\u2588\\u2588\\u2554\\u2550\\u2550\\u2588\\u2588\\u2557\\u2588\\u2588\\u2554\\u2550\\u2550\\u2550\\u2550\\u255d\\u2588\\u2588\\u2554\\u2550\\u2550\\u2588\\u2588\\u2557\\u2588\\u2588\\u2551\\u2591\\u2591\\u2591\\u2591\\u2591\\u2588\\u2588\\u2554\\u2550\\u2550\\u2588\\u2588\\u2557\\u2588\\u2588\\u2588\\u2588\\u2557\\u2591\\u2588\\u2588\\u2551\\u2588\\u2588\\u2554\\u2550\\u2550\\u2588\\u2588\\u2557\\n\\u2588\\u2588\\u2551\\u2591\\u2591\\u2588\\u2588\\u2551\\u2588\\u2588\\u2588\\u2588\\u2588\\u2557\\u2591\\u2591\\u2588\\u2588\\u2588\\u2588\\u2588\\u2557\\u2591\\u2591\\u2588\\u2588\\u2551\\u2591\\u2591\\u2591\\u255a\\u2588\\u2588\\u2557\\u2588\\u2588\\u2588\\u2588\\u2557\\u2588\\u2588\\u2554\\u255d\\u2588\\u2588\\u2551\\u2591\\u2591\\u2588\\u2588\\u2551\\u2588\\u2588\\u2554\\u2588\\u2588\\u2557\\u2588\\u2588\\u2551\\u2588\\u2588\\u2551\\u2591\\u2591\\u2588\\u2588\\u2551\\u2588\\u2588\\u2588\\u2588\\u2588\\u2557\\u2591\\u2591\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2554\\u255d\\u2588\\u2588\\u2551\\u2591\\u2591\\u2591\\u2591\\u2591\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2551\\u2588\\u2588\\u2554\\u2588\\u2588\\u2557\\u2588\\u2588\\u2551\\u2588\\u2588\\u2551\\u2591\\u2591\\u2588\\u2588\\u2551\\n\\u2588\\u2588\\u2551\\u2591\\u2591\\u2588\\u2588\\u2551\\u2588\\u2588\\u2554\\u2550\\u2550\\u255d\\u2591\\u2591\\u2588\\u2588\\u2554\\u2550\\u2550\\u255d\\u2591\\u2591\\u2588\\u2588\\u2551\\u2591\\u2591\\u2591\\u2591\\u2588\\u2588\\u2588\\u2588\\u2554\\u2550\\u2588\\u2588\\u2588\\u2588\\u2551\\u2591\\u2588\\u2588\\u2551\\u2591\\u2591\\u2588\\u2588\\u2551\\u2588\\u2588\\u2551\\u255a\\u2588\\u2588\\u2588\\u2588\\u2551\\u2588\\u2588\\u2551\\u2591\\u2591\\u2588\\u2588\\u2551\\u2588\\u2588\\u2554\\u2550\\u2550\\u255d\\u2591\\u2591\\u2588\\u2588\\u2554\\u2550\\u2550\\u2588\\u2588\\u2557\\u2588\\u2588\\u2551\\u2591\\u2591\\u2591\\u2591\\u2591\\u2588\\u2588\\u2554\\u2550\\u2550\\u2588\\u2588\\u2551\\u2588\\u2588\\u2551\\u255a\\u2588\\u2588\\u2588\\u2588\\u2551\\u2588\\u2588\\u2551\\u2591\\u2591\\u2588\\u2588\\u2551\\n\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2554\\u255d\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2557\\u2588\\u2588\\u2551\\u2591\\u2591\\u2591\\u2591\\u2591\\u2588\\u2588\\u2551\\u2591\\u2591\\u2591\\u2591\\u255a\\u2588\\u2588\\u2554\\u255d\\u2591\\u255a\\u2588\\u2588\\u2554\\u255d\\u2591\\u255a\\u2588\\u2588\\u2588\\u2588\\u2588\\u2554\\u255d\\u2588\\u2588\\u2551\\u2591\\u255a\\u2588\\u2588\\u2588\\u2551\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2554\\u255d\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2557\\u2588\\u2588\\u2551\\u2591\\u2591\\u2588\\u2588\\u2551\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2557\\u2588\\u2588\\u2551\\u2591\\u2591\\u2588\\u2588\\u2551\\u2588\\u2588\\u2551\\u2591\\u255a\\u2588\\u2588\\u2588\\u2551\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2554\\u255d\\n\\u255a\\u2550\\u2550\\u2550\\u2550\\u2550\\u255d\\u2591\\u255a\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u255d\\u255a\\u2550\\u255d\\u2591\\u2591\\u2591\\u2591\\u2591\\u255a\\u2550\\u255d\\u2591\\u2591\\u2591\\u2591\\u2591\\u255a\\u2550\\u255d\\u2591\\u2591\\u2591\\u255a\\u2550\\u255d\\u2591\\u2591\\u2591\\u255a\\u2550\\u2550\\u2550\\u2550\\u255d\\u2591\\u255a\\u2550\\u255d\\u2591\\u2591\\u255a\\u2550\\u2550\\u255d\\u255a\\u2550\\u2550\\u2550\\u2550\\u2550\\u255d\\u2591\\u255a\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u255d\\u255a\\u2550\\u255d\\u2591\\u2591\\u255a\\u2550\\u255d\\u255a\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u255d\\u255a\\u2550\\u255d\\u2591\\u2591\\u255a\\u2550\\u255d\\u255a\\u2550\\u255d\\u2591\\u2591\\u255a\\u2550\\u2550\\u255d\\u255a\\u2550\\u2550\\u2550\\u2550\\u2550\\u255d\\u2591\\n\\nhttps://defi.sucks\\n\\n*/\\n\\npragma solidity >=0.8.4 <0.9.0;\\n\\nimport '../interfaces/IKeep3r.sol';\\nimport './peripherals/jobs/Keep3rJobs.sol';\\nimport './peripherals/keepers/Keep3rKeepers.sol';\\nimport '@defi-wonderland/solidity-utils/solidity/contracts/DustCollector.sol';\\n\\ncontract Keep3r is IKeep3r, Keep3rJobs, Keep3rKeepers {\\n constructor(\\n address _governor,\\n address _keep3rHelper,\\n address _keep3rV1,\\n address _keep3rV1Proxy\\n ) Keep3rParameters(_keep3rHelper, _keep3rV1, _keep3rV1Proxy) Keep3rRoles(_governor) {}\\n}\\n\",\"keccak256\":\"0x21c3fd585303fbb3686a9f11e13da71ef98c24eb14cf6a9721eee30b03a75ffa\",\"license\":\"MIT\"},\"solidity/contracts/libraries/FullMath.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4 <0.9.0;\\n\\n/// @title Contains 512-bit math functions\\n/// @notice Facilitates multiplication and division that can have overflow of an intermediate value without any loss of precision\\n/// @dev Handles \\\"phantom overflow\\\" i.e., allows multiplication and division where an intermediate value overflows 256 bits\\nlibrary FullMath {\\n /// @notice Calculates floor(a\\u00d7b\\u00f7denominator) with full precision. Throws if result overflows a uint256 or denominator == 0\\n /// @param a The multiplicand\\n /// @param b The multiplier\\n /// @param denominator The divisor\\n /// @return result The 256-bit result\\n /// @dev Credit to Remco Bloemen under MIT license https://xn--2-umb.com/21/muldiv\\n function mulDiv(\\n uint256 a,\\n uint256 b,\\n uint256 denominator\\n ) internal pure returns (uint256 result) {\\n unchecked {\\n // 512-bit multiply [prod1 prod0] = a * b\\n // Compute the product mod 2**256 and mod 2**256 - 1\\n // then use the Chinese Remainder Theorem to reconstruct\\n // the 512 bit result. The result is stored in two 256\\n // variables such that product = prod1 * 2**256 + prod0\\n uint256 prod0; // Least significant 256 bits of the product\\n uint256 prod1; // Most significant 256 bits of the product\\n assembly {\\n let mm := mulmod(a, b, not(0))\\n prod0 := mul(a, b)\\n prod1 := sub(sub(mm, prod0), lt(mm, prod0))\\n }\\n\\n // Handle non-overflow cases, 256 by 256 division\\n if (prod1 == 0) {\\n require(denominator > 0);\\n assembly {\\n result := div(prod0, denominator)\\n }\\n return result;\\n }\\n\\n // Make sure the result is less than 2**256.\\n // Also prevents denominator == 0\\n require(denominator > prod1);\\n\\n ///////////////////////////////////////////////\\n // 512 by 256 division.\\n ///////////////////////////////////////////////\\n\\n // Make division exact by subtracting the remainder from [prod1 prod0]\\n // Compute remainder using mulmod\\n uint256 remainder;\\n assembly {\\n remainder := mulmod(a, b, denominator)\\n }\\n // Subtract 256 bit number from 512 bit number\\n assembly {\\n prod1 := sub(prod1, gt(remainder, prod0))\\n prod0 := sub(prod0, remainder)\\n }\\n\\n // Factor powers of two out of denominator\\n // Compute largest power of two divisor of denominator.\\n // Always >= 1.\\n uint256 twos = (~denominator + 1) & denominator;\\n // Divide denominator by power of two\\n assembly {\\n denominator := div(denominator, twos)\\n }\\n\\n // Divide [prod1 prod0] by the factors of two\\n assembly {\\n prod0 := div(prod0, twos)\\n }\\n // Shift in bits from prod1 into prod0. For this we need\\n // to flip `twos` such that it is 2**256 / twos.\\n // If twos is zero, then it becomes one\\n assembly {\\n twos := add(div(sub(0, twos), twos), 1)\\n }\\n prod0 |= prod1 * twos;\\n\\n // Invert denominator mod 2**256\\n // Now that denominator is an odd number, it has an inverse\\n // modulo 2**256 such that denominator * inv = 1 mod 2**256.\\n // Compute the inverse by starting with a seed that is correct\\n // correct for four bits. That is, denominator * inv = 1 mod 2**4\\n uint256 inv = (3 * denominator) ^ 2;\\n // Now use Newton-Raphson iteration to improve the precision.\\n // Thanks to Hensel's lifting lemma, this also works in modular\\n // arithmetic, doubling the correct bits in each step.\\n inv *= 2 - denominator * inv; // inverse mod 2**8\\n inv *= 2 - denominator * inv; // inverse mod 2**16\\n inv *= 2 - denominator * inv; // inverse mod 2**32\\n inv *= 2 - denominator * inv; // inverse mod 2**64\\n inv *= 2 - denominator * inv; // inverse mod 2**128\\n inv *= 2 - denominator * inv; // inverse mod 2**256\\n\\n // Because the division is now exact we can divide by multiplying\\n // with the modular inverse of denominator. This will give us the\\n // correct result modulo 2**256. Since the precoditions guarantee\\n // that the outcome is less than 2**256, this is the final result.\\n // We don't need to compute the high bits of the result and prod1\\n // is no longer required.\\n result = prod0 * inv;\\n return result;\\n }\\n }\\n\\n /// @notice Calculates ceil(a\\u00d7b\\u00f7denominator) with full precision. Throws if result overflows a uint256 or denominator == 0\\n /// @param a The multiplicand\\n /// @param b The multiplier\\n /// @param denominator The divisor\\n /// @return result The 256-bit result\\n function mulDivRoundingUp(\\n uint256 a,\\n uint256 b,\\n uint256 denominator\\n ) internal pure returns (uint256 result) {\\n unchecked {\\n result = mulDiv(a, b, denominator);\\n if (mulmod(a, b, denominator) > 0) {\\n require(result < type(uint256).max);\\n result++;\\n }\\n }\\n }\\n}\\n\",\"keccak256\":\"0xe1c595da02adf8ba2ae74ac579b9b3c966d1ecb2a99c25081a62ee8550f26569\",\"license\":\"MIT\"},\"solidity/contracts/peripherals/Keep3rAccountance.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4 <0.9.0;\\n\\nimport '@openzeppelin/contracts/utils/structs/EnumerableSet.sol';\\nimport '../../interfaces/peripherals/IKeep3rAccountance.sol';\\nimport './Keep3rRoles.sol';\\n\\nabstract contract Keep3rAccountance is IKeep3rAccountance, Keep3rRoles {\\n using EnumerableSet for EnumerableSet.AddressSet;\\n\\n /// @notice List of all enabled keepers\\n EnumerableSet.AddressSet internal _keepers;\\n\\n /// @inheritdoc IKeep3rAccountance\\n uint256 public override totalBonds;\\n\\n /// @inheritdoc IKeep3rAccountance\\n mapping(address => uint256) public override workCompleted;\\n\\n /// @inheritdoc IKeep3rAccountance\\n mapping(address => uint256) public override firstSeen;\\n\\n /// @inheritdoc IKeep3rAccountance\\n mapping(address => bool) public override disputes;\\n\\n /// @inheritdoc IKeep3rAccountance\\n /// @notice Mapping (job => bonding => amount)\\n mapping(address => mapping(address => uint256)) public override bonds;\\n\\n /// @inheritdoc IKeep3rAccountance\\n mapping(address => mapping(address => uint256)) public override jobTokenCredits;\\n\\n /// @notice The current liquidity credits available for a job\\n mapping(address => uint256) internal _jobLiquidityCredits;\\n\\n /// @notice Map the address of a job to its correspondent periodCredits\\n mapping(address => uint256) internal _jobPeriodCredits;\\n\\n /// @notice Enumerable array of Job Tokens for Credits\\n mapping(address => EnumerableSet.AddressSet) internal _jobTokens;\\n\\n /// @notice List of liquidities that a job has (job => liquidities)\\n mapping(address => EnumerableSet.AddressSet) internal _jobLiquidities;\\n\\n /// @notice Liquidity pool to observe\\n mapping(address => address) internal _liquidityPool;\\n\\n /// @notice Tracks if a pool has KP3R as token0\\n mapping(address => bool) internal _isKP3RToken0;\\n\\n /// @inheritdoc IKeep3rAccountance\\n mapping(address => mapping(address => uint256)) public override pendingBonds;\\n\\n /// @inheritdoc IKeep3rAccountance\\n mapping(address => mapping(address => uint256)) public override canActivateAfter;\\n\\n /// @inheritdoc IKeep3rAccountance\\n mapping(address => mapping(address => uint256)) public override canWithdrawAfter;\\n\\n /// @inheritdoc IKeep3rAccountance\\n mapping(address => mapping(address => uint256)) public override pendingUnbonds;\\n\\n /// @inheritdoc IKeep3rAccountance\\n mapping(address => bool) public override hasBonded;\\n\\n /// @notice List of all enabled jobs\\n EnumerableSet.AddressSet internal _jobs;\\n\\n /// @inheritdoc IKeep3rAccountance\\n function jobs() external view override returns (address[] memory _list) {\\n _list = _jobs.values();\\n }\\n\\n /// @inheritdoc IKeep3rAccountance\\n function keepers() external view override returns (address[] memory _list) {\\n _list = _keepers.values();\\n }\\n}\\n\",\"keccak256\":\"0xcd2a525e6567eea4f2a7f93e8eb686e484d2a078686f2744dde35a8383881730\",\"license\":\"MIT\"},\"solidity/contracts/peripherals/Keep3rDisputable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4 <0.9.0;\\n\\nimport './Keep3rParameters.sol';\\nimport '../../interfaces/peripherals/IKeep3rDisputable.sol';\\n\\nabstract contract Keep3rDisputable is IKeep3rDisputable, Keep3rParameters {\\n /// @inheritdoc IKeep3rDisputable\\n function dispute(address _jobOrKeeper) external override onlyDisputer {\\n if (disputes[_jobOrKeeper]) revert AlreadyDisputed();\\n disputes[_jobOrKeeper] = true;\\n emit Dispute(_jobOrKeeper, msg.sender);\\n }\\n\\n /// @inheritdoc IKeep3rDisputable\\n function resolve(address _jobOrKeeper) external override onlyDisputer {\\n if (!disputes[_jobOrKeeper]) revert NotDisputed();\\n disputes[_jobOrKeeper] = false;\\n emit Resolve(_jobOrKeeper, msg.sender);\\n }\\n}\\n\",\"keccak256\":\"0x664b54040aa4e734f68a01fcfb5bf67cbb1a70efd03862cd3a456457536b1fb4\",\"license\":\"MIT\"},\"solidity/contracts/peripherals/Keep3rParameters.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4 <0.9.0;\\n\\nimport '../../interfaces/IKeep3rHelper.sol';\\nimport '../../interfaces/peripherals/IKeep3rParameters.sol';\\nimport '../../interfaces/external/IKeep3rV1Proxy.sol';\\nimport './Keep3rAccountance.sol';\\n\\nabstract contract Keep3rParameters is IKeep3rParameters, Keep3rAccountance {\\n /// @inheritdoc IKeep3rParameters\\n address public override keep3rV1;\\n\\n /// @inheritdoc IKeep3rParameters\\n address public override keep3rV1Proxy;\\n\\n /// @inheritdoc IKeep3rParameters\\n address public override keep3rHelper;\\n\\n /// @inheritdoc IKeep3rParameters\\n uint256 public override bondTime = 3 days;\\n\\n /// @inheritdoc IKeep3rParameters\\n uint256 public override unbondTime = 14 days;\\n\\n /// @inheritdoc IKeep3rParameters\\n uint256 public override liquidityMinimum = 3 ether;\\n\\n /// @inheritdoc IKeep3rParameters\\n uint256 public override rewardPeriodTime = 5 days;\\n\\n /// @inheritdoc IKeep3rParameters\\n uint256 public override inflationPeriod = 34 days;\\n\\n /// @inheritdoc IKeep3rParameters\\n uint256 public override fee = 30;\\n\\n /// @notice The base that will be used to calculate the fee\\n uint256 internal constant _BASE = 10_000;\\n\\n /// @notice The minimum reward period\\n uint256 internal constant _MIN_REWARD_PERIOD_TIME = 1 days;\\n\\n constructor(\\n address _keep3rHelper,\\n address _keep3rV1,\\n address _keep3rV1Proxy\\n ) {\\n keep3rHelper = _keep3rHelper;\\n keep3rV1 = _keep3rV1;\\n keep3rV1Proxy = _keep3rV1Proxy;\\n }\\n\\n /// @inheritdoc IKeep3rParameters\\n function setKeep3rHelper(address _keep3rHelper) external override onlyGovernor {\\n if (_keep3rHelper == address(0)) revert ZeroAddress();\\n keep3rHelper = _keep3rHelper;\\n emit Keep3rHelperChange(_keep3rHelper);\\n }\\n\\n /// @inheritdoc IKeep3rParameters\\n function setKeep3rV1(address _keep3rV1) public virtual override onlyGovernor {\\n if (_keep3rV1 == address(0)) revert ZeroAddress();\\n _mint(totalBonds);\\n\\n keep3rV1 = _keep3rV1;\\n emit Keep3rV1Change(_keep3rV1);\\n }\\n\\n /// @inheritdoc IKeep3rParameters\\n function setKeep3rV1Proxy(address _keep3rV1Proxy) external override onlyGovernor {\\n if (_keep3rV1Proxy == address(0)) revert ZeroAddress();\\n keep3rV1Proxy = _keep3rV1Proxy;\\n emit Keep3rV1ProxyChange(_keep3rV1Proxy);\\n }\\n\\n /// @inheritdoc IKeep3rParameters\\n function setBondTime(uint256 _bondTime) external override onlyGovernor {\\n bondTime = _bondTime;\\n emit BondTimeChange(_bondTime);\\n }\\n\\n /// @inheritdoc IKeep3rParameters\\n function setUnbondTime(uint256 _unbondTime) external override onlyGovernor {\\n unbondTime = _unbondTime;\\n emit UnbondTimeChange(_unbondTime);\\n }\\n\\n /// @inheritdoc IKeep3rParameters\\n function setLiquidityMinimum(uint256 _liquidityMinimum) external override onlyGovernor {\\n liquidityMinimum = _liquidityMinimum;\\n emit LiquidityMinimumChange(_liquidityMinimum);\\n }\\n\\n /// @inheritdoc IKeep3rParameters\\n function setRewardPeriodTime(uint256 _rewardPeriodTime) external override onlyGovernor {\\n if (_rewardPeriodTime < _MIN_REWARD_PERIOD_TIME) revert MinRewardPeriod();\\n rewardPeriodTime = _rewardPeriodTime;\\n emit RewardPeriodTimeChange(_rewardPeriodTime);\\n }\\n\\n /// @inheritdoc IKeep3rParameters\\n function setInflationPeriod(uint256 _inflationPeriod) external override onlyGovernor {\\n inflationPeriod = _inflationPeriod;\\n emit InflationPeriodChange(_inflationPeriod);\\n }\\n\\n /// @inheritdoc IKeep3rParameters\\n function setFee(uint256 _fee) external override onlyGovernor {\\n fee = _fee;\\n emit FeeChange(_fee);\\n }\\n\\n function _mint(uint256 _amount) internal {\\n totalBonds -= _amount;\\n IKeep3rV1Proxy(keep3rV1Proxy).mint(_amount);\\n }\\n}\\n\",\"keccak256\":\"0xcbc3784d997d3433461741e68f0119f197fa9e595e79939e540d810f4a76cde6\",\"license\":\"MIT\"},\"solidity/contracts/peripherals/Keep3rRoles.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4 <0.9.0;\\n\\nimport '../../interfaces/peripherals/IKeep3rRoles.sol';\\nimport '@openzeppelin/contracts/utils/structs/EnumerableSet.sol';\\nimport '@defi-wonderland/solidity-utils/solidity/contracts/DustCollector.sol';\\nimport '@defi-wonderland/solidity-utils/solidity/contracts/Governable.sol';\\n\\ncontract Keep3rRoles is IKeep3rRoles, Governable, DustCollector {\\n /// @inheritdoc IKeep3rRoles\\n mapping(address => bool) public override slashers;\\n\\n /// @inheritdoc IKeep3rRoles\\n mapping(address => bool) public override disputers;\\n\\n constructor(address _governor) Governable(_governor) DustCollector() {}\\n\\n /// @inheritdoc IKeep3rRoles\\n function addSlasher(address _slasher) external override onlyGovernor {\\n if (_slasher == address(0)) revert ZeroAddress();\\n if (slashers[_slasher]) revert SlasherExistent();\\n slashers[_slasher] = true;\\n emit SlasherAdded(_slasher);\\n }\\n\\n /// @inheritdoc IKeep3rRoles\\n function removeSlasher(address _slasher) external override onlyGovernor {\\n if (!slashers[_slasher]) revert SlasherUnexistent();\\n delete slashers[_slasher];\\n emit SlasherRemoved(_slasher);\\n }\\n\\n /// @inheritdoc IKeep3rRoles\\n function addDisputer(address _disputer) external override onlyGovernor {\\n if (_disputer == address(0)) revert ZeroAddress();\\n if (disputers[_disputer]) revert DisputerExistent();\\n disputers[_disputer] = true;\\n emit DisputerAdded(_disputer);\\n }\\n\\n /// @inheritdoc IKeep3rRoles\\n function removeDisputer(address _disputer) external override onlyGovernor {\\n if (!disputers[_disputer]) revert DisputerUnexistent();\\n delete disputers[_disputer];\\n emit DisputerRemoved(_disputer);\\n }\\n\\n /// @notice Functions with this modifier can only be called by either a slasher or governance\\n modifier onlySlasher {\\n if (!slashers[msg.sender]) revert OnlySlasher();\\n _;\\n }\\n\\n /// @notice Functions with this modifier can only be called by either a disputer or governance\\n modifier onlyDisputer {\\n if (!disputers[msg.sender]) revert OnlyDisputer();\\n _;\\n }\\n}\\n\",\"keccak256\":\"0x80a56902f12536731155ceff8be13081f940991fdd03b38eccf4f241cb61f23a\",\"license\":\"MIT\"},\"solidity/contracts/peripherals/jobs/Keep3rJobDisputable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4 <0.9.0;\\n\\nimport './Keep3rJobFundableCredits.sol';\\nimport './Keep3rJobFundableLiquidity.sol';\\nimport '../Keep3rDisputable.sol';\\n\\nabstract contract Keep3rJobDisputable is IKeep3rJobDisputable, Keep3rDisputable, Keep3rJobFundableCredits, Keep3rJobFundableLiquidity {\\n using EnumerableSet for EnumerableSet.AddressSet;\\n using SafeERC20 for IERC20;\\n\\n /// @inheritdoc IKeep3rJobDisputable\\n function slashTokenFromJob(\\n address _job,\\n address _token,\\n uint256 _amount\\n ) external override onlySlasher {\\n if (!disputes[_job]) revert NotDisputed();\\n if (!_jobTokens[_job].contains(_token)) revert JobTokenUnexistent();\\n if (jobTokenCredits[_job][_token] < _amount) revert JobTokenInsufficient();\\n\\n try IERC20(_token).transfer(governor, _amount) {} catch {}\\n jobTokenCredits[_job][_token] -= _amount;\\n if (jobTokenCredits[_job][_token] == 0) {\\n _jobTokens[_job].remove(_token);\\n }\\n\\n emit JobSlashToken(_job, _token, msg.sender, _amount);\\n }\\n\\n /// @inheritdoc IKeep3rJobDisputable\\n function slashLiquidityFromJob(\\n address _job,\\n address _liquidity,\\n uint256 _amount\\n ) external override onlySlasher {\\n if (!disputes[_job]) revert NotDisputed();\\n\\n _unbondLiquidityFromJob(_job, _liquidity, _amount);\\n try IERC20(_liquidity).transfer(governor, _amount) {} catch {}\\n emit JobSlashLiquidity(_job, _liquidity, msg.sender, _amount);\\n }\\n}\\n\",\"keccak256\":\"0x545db29f913063a93e35148c49d1498206d8429f9def33bbea6bb735c4e97dde\",\"license\":\"MIT\"},\"solidity/contracts/peripherals/jobs/Keep3rJobFundableCredits.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4 <0.9.0;\\n\\nimport './Keep3rJobOwnership.sol';\\nimport '../Keep3rAccountance.sol';\\nimport '../Keep3rParameters.sol';\\nimport '../../../interfaces/peripherals/IKeep3rJobs.sol';\\n\\nimport '@openzeppelin/contracts/security/ReentrancyGuard.sol';\\nimport '@openzeppelin/contracts/token/ERC20/IERC20.sol';\\nimport '@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol';\\nimport '@openzeppelin/contracts/utils/math/Math.sol';\\n\\nabstract contract Keep3rJobFundableCredits is IKeep3rJobFundableCredits, ReentrancyGuard, Keep3rJobOwnership, Keep3rParameters {\\n using EnumerableSet for EnumerableSet.AddressSet;\\n using SafeERC20 for IERC20;\\n\\n /// @notice Cooldown between withdrawals\\n uint256 internal constant _WITHDRAW_TOKENS_COOLDOWN = 1 minutes;\\n\\n /// @inheritdoc IKeep3rJobFundableCredits\\n mapping(address => mapping(address => uint256)) public override jobTokenCreditsAddedAt;\\n\\n /// @inheritdoc IKeep3rJobFundableCredits\\n function addTokenCreditsToJob(\\n address _job,\\n address _token,\\n uint256 _amount\\n ) external override nonReentrant {\\n if (!_jobs.contains(_job)) revert JobUnavailable();\\n // KP3R shouldn't be used for direct token payments\\n if (_token == keep3rV1) revert TokenUnallowed();\\n uint256 _before = IERC20(_token).balanceOf(address(this));\\n IERC20(_token).safeTransferFrom(msg.sender, address(this), _amount);\\n uint256 _received = IERC20(_token).balanceOf(address(this)) - _before;\\n uint256 _tokenFee = (_received * fee) / _BASE;\\n jobTokenCredits[_job][_token] += _received - _tokenFee;\\n jobTokenCreditsAddedAt[_job][_token] = block.timestamp;\\n IERC20(_token).safeTransfer(governor, _tokenFee);\\n _jobTokens[_job].add(_token);\\n\\n emit TokenCreditAddition(_job, _token, msg.sender, _received);\\n }\\n\\n /// @inheritdoc IKeep3rJobFundableCredits\\n function withdrawTokenCreditsFromJob(\\n address _job,\\n address _token,\\n uint256 _amount,\\n address _receiver\\n ) external override nonReentrant onlyJobOwner(_job) {\\n if (block.timestamp <= jobTokenCreditsAddedAt[_job][_token] + _WITHDRAW_TOKENS_COOLDOWN) revert JobTokenCreditsLocked();\\n if (jobTokenCredits[_job][_token] < _amount) revert InsufficientJobTokenCredits();\\n if (disputes[_job]) revert JobDisputed();\\n\\n jobTokenCredits[_job][_token] -= _amount;\\n IERC20(_token).safeTransfer(_receiver, _amount);\\n\\n if (jobTokenCredits[_job][_token] == 0) {\\n _jobTokens[_job].remove(_token);\\n }\\n\\n emit TokenCreditWithdrawal(_job, _token, _receiver, _amount);\\n }\\n}\\n\",\"keccak256\":\"0x39eae0b2b1e1f19d18d5574a7ada277d694f45991742b4f7410266eca7c50899\",\"license\":\"MIT\"},\"solidity/contracts/peripherals/jobs/Keep3rJobFundableLiquidity.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4 <0.9.0;\\n\\nimport './Keep3rJobOwnership.sol';\\nimport '../Keep3rAccountance.sol';\\nimport '../Keep3rParameters.sol';\\nimport '../../../interfaces/IPairManager.sol';\\nimport '../../../interfaces/peripherals/IKeep3rJobs.sol';\\n\\nimport '../../libraries/FullMath.sol';\\n\\nimport '@openzeppelin/contracts/security/ReentrancyGuard.sol';\\nimport '@openzeppelin/contracts/token/ERC20/IERC20.sol';\\nimport '@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol';\\nimport '@openzeppelin/contracts/utils/math/Math.sol';\\n\\nabstract contract Keep3rJobFundableLiquidity is IKeep3rJobFundableLiquidity, ReentrancyGuard, Keep3rJobOwnership, Keep3rParameters {\\n using EnumerableSet for EnumerableSet.AddressSet;\\n using SafeERC20 for IERC20;\\n\\n /// @notice List of liquidities that are accepted in the system\\n EnumerableSet.AddressSet internal _approvedLiquidities;\\n\\n /// @inheritdoc IKeep3rJobFundableLiquidity\\n mapping(address => mapping(address => uint256)) public override liquidityAmount;\\n\\n /// @inheritdoc IKeep3rJobFundableLiquidity\\n mapping(address => uint256) public override rewardedAt;\\n\\n /// @inheritdoc IKeep3rJobFundableLiquidity\\n mapping(address => uint256) public override workedAt;\\n\\n /// @notice Tracks an address and returns its TickCache\\n mapping(address => TickCache) internal _tick;\\n\\n // Views\\n\\n /// @inheritdoc IKeep3rJobFundableLiquidity\\n function approvedLiquidities() external view override returns (address[] memory _list) {\\n _list = _approvedLiquidities.values();\\n }\\n\\n /// @inheritdoc IKeep3rJobFundableLiquidity\\n function jobPeriodCredits(address _job) public view override returns (uint256 _periodCredits) {\\n for (uint256 i; i < _jobLiquidities[_job].length(); i++) {\\n address _liquidity = _jobLiquidities[_job].at(i);\\n if (_approvedLiquidities.contains(_liquidity)) {\\n TickCache memory _tickCache = observeLiquidity(_liquidity);\\n if (_tickCache.period != 0) {\\n int56 _tickDifference = _isKP3RToken0[_liquidity] ? _tickCache.difference : -_tickCache.difference;\\n _periodCredits += _getReward(\\n IKeep3rHelper(keep3rHelper).getKP3RsAtTick(liquidityAmount[_job][_liquidity], _tickDifference, rewardPeriodTime)\\n );\\n }\\n }\\n }\\n }\\n\\n /// @inheritdoc IKeep3rJobFundableLiquidity\\n function jobLiquidityCredits(address _job) public view override returns (uint256 _liquidityCredits) {\\n uint256 _periodCredits = jobPeriodCredits(_job);\\n\\n // If the job was rewarded in the past 1 period time\\n if ((block.timestamp - rewardedAt[_job]) < rewardPeriodTime) {\\n // If the job has period credits, update minted job credits to new twap\\n _liquidityCredits = _periodCredits > 0\\n ? (_jobLiquidityCredits[_job] * _periodCredits) / _jobPeriodCredits[_job] // If the job has period credits, return remaining job credits updated to new twap\\n : _jobLiquidityCredits[_job]; // If not, return remaining credits, forced credits should not be updated\\n } else {\\n // Else return a full period worth of credits if current credits have expired\\n _liquidityCredits = _periodCredits;\\n }\\n }\\n\\n /// @inheritdoc IKeep3rJobFundableLiquidity\\n function totalJobCredits(address _job) external view override returns (uint256 _credits) {\\n uint256 _periodCredits = jobPeriodCredits(_job);\\n uint256 _cooldown = block.timestamp;\\n\\n if ((rewardedAt[_job] > _period(block.timestamp - rewardPeriodTime))) {\\n // Will calculate cooldown if it outdated\\n if ((block.timestamp - rewardedAt[_job]) >= rewardPeriodTime) {\\n // Will calculate cooldown from last reward reference in this period\\n _cooldown -= (rewardedAt[_job] + rewardPeriodTime);\\n } else {\\n // Will calculate cooldown from last reward timestamp\\n _cooldown -= rewardedAt[_job];\\n }\\n } else {\\n // Will calculate cooldown from period start if expired\\n _cooldown -= _period(block.timestamp);\\n }\\n _credits = jobLiquidityCredits(_job) + _phase(_cooldown, _periodCredits);\\n }\\n\\n /// @inheritdoc IKeep3rJobFundableLiquidity\\n function quoteLiquidity(address _liquidity, uint256 _amount) external view override returns (uint256 _periodCredits) {\\n if (_approvedLiquidities.contains(_liquidity)) {\\n TickCache memory _tickCache = observeLiquidity(_liquidity);\\n if (_tickCache.period != 0) {\\n int56 _tickDifference = _isKP3RToken0[_liquidity] ? _tickCache.difference : -_tickCache.difference;\\n return _getReward(IKeep3rHelper(keep3rHelper).getKP3RsAtTick(_amount, _tickDifference, rewardPeriodTime));\\n }\\n }\\n }\\n\\n /// @inheritdoc IKeep3rJobFundableLiquidity\\n function observeLiquidity(address _liquidity) public view virtual override returns (TickCache memory _tickCache) {\\n if (_tick[_liquidity].period == _period(block.timestamp)) {\\n // Will return cached twaps if liquidity is updated\\n _tickCache = _tick[_liquidity];\\n } else {\\n bool success;\\n uint256 lastPeriod = _period(block.timestamp - rewardPeriodTime);\\n\\n if (_tick[_liquidity].period == lastPeriod) {\\n // Will only ask for current period accumulator if liquidity is outdated\\n uint32[] memory _secondsAgo = new uint32[](1);\\n int56 previousTick = _tick[_liquidity].current;\\n\\n _secondsAgo[0] = uint32(block.timestamp - _period(block.timestamp));\\n\\n (_tickCache.current, , success) = IKeep3rHelper(keep3rHelper).observe(_liquidityPool[_liquidity], _secondsAgo);\\n\\n _tickCache.difference = _tickCache.current - previousTick;\\n } else if (_tick[_liquidity].period < lastPeriod) {\\n // Will ask for 2 accumulators if liquidity is expired\\n uint32[] memory _secondsAgo = new uint32[](2);\\n\\n _secondsAgo[0] = uint32(block.timestamp - _period(block.timestamp));\\n _secondsAgo[1] = uint32(block.timestamp - _period(block.timestamp) + rewardPeriodTime);\\n\\n int56 _tickCumulative2;\\n (_tickCache.current, _tickCumulative2, success) = IKeep3rHelper(keep3rHelper).observe(_liquidityPool[_liquidity], _secondsAgo);\\n\\n _tickCache.difference = _tickCache.current - _tickCumulative2;\\n }\\n if (success) {\\n _tickCache.period = _period(block.timestamp);\\n } else {\\n delete _tickCache.period;\\n }\\n }\\n }\\n\\n // Methods\\n\\n /// @inheritdoc IKeep3rJobFundableLiquidity\\n function forceLiquidityCreditsToJob(address _job, uint256 _amount) external override onlyGovernor {\\n if (!_jobs.contains(_job)) revert JobUnavailable();\\n _settleJobAccountance(_job);\\n _jobLiquidityCredits[_job] += _amount;\\n emit LiquidityCreditsForced(_job, rewardedAt[_job], _jobLiquidityCredits[_job]);\\n }\\n\\n /// @inheritdoc IKeep3rJobFundableLiquidity\\n function approveLiquidity(address _liquidity) external virtual override onlyGovernor {\\n if (!_approvedLiquidities.add(_liquidity)) revert LiquidityPairApproved();\\n _liquidityPool[_liquidity] = IPairManager(_liquidity).pool();\\n _isKP3RToken0[_liquidity] = IKeep3rHelper(keep3rHelper).isKP3RToken0(_liquidityPool[_liquidity]);\\n _tick[_liquidity] = observeLiquidity(_liquidity);\\n emit LiquidityApproval(_liquidity);\\n }\\n\\n /// @inheritdoc IKeep3rJobFundableLiquidity\\n function revokeLiquidity(address _liquidity) external override onlyGovernor {\\n if (!_approvedLiquidities.remove(_liquidity)) revert LiquidityPairUnexistent();\\n delete _liquidityPool[_liquidity];\\n delete _isKP3RToken0[_liquidity];\\n delete _tick[_liquidity];\\n\\n emit LiquidityRevocation(_liquidity);\\n }\\n\\n /// @inheritdoc IKeep3rJobFundableLiquidity\\n function addLiquidityToJob(\\n address _job,\\n address _liquidity,\\n uint256 _amount\\n ) external override nonReentrant {\\n if (!_approvedLiquidities.contains(_liquidity)) revert LiquidityPairUnapproved();\\n if (!_jobs.contains(_job)) revert JobUnavailable();\\n\\n _jobLiquidities[_job].add(_liquidity);\\n\\n _settleJobAccountance(_job);\\n\\n if (_quoteLiquidity(liquidityAmount[_job][_liquidity] + _amount, _liquidity) < liquidityMinimum) revert JobLiquidityLessThanMin();\\n\\n emit LiquidityCreditsReward(_job, rewardedAt[_job], _jobLiquidityCredits[_job], _jobPeriodCredits[_job]);\\n\\n IERC20(_liquidity).safeTransferFrom(msg.sender, address(this), _amount);\\n liquidityAmount[_job][_liquidity] += _amount;\\n _jobPeriodCredits[_job] += _getReward(_quoteLiquidity(_amount, _liquidity));\\n emit LiquidityAddition(_job, _liquidity, msg.sender, _amount);\\n }\\n\\n /// @inheritdoc IKeep3rJobFundableLiquidity\\n function unbondLiquidityFromJob(\\n address _job,\\n address _liquidity,\\n uint256 _amount\\n ) external override onlyJobOwner(_job) {\\n canWithdrawAfter[_job][_liquidity] = block.timestamp + unbondTime;\\n pendingUnbonds[_job][_liquidity] += _amount;\\n _unbondLiquidityFromJob(_job, _liquidity, _amount);\\n\\n uint256 _remainingLiquidity = liquidityAmount[_job][_liquidity];\\n if (_remainingLiquidity > 0 && _quoteLiquidity(_remainingLiquidity, _liquidity) < liquidityMinimum) revert JobLiquidityLessThanMin();\\n\\n emit Unbonding(_job, _liquidity, _amount);\\n }\\n\\n /// @inheritdoc IKeep3rJobFundableLiquidity\\n function withdrawLiquidityFromJob(\\n address _job,\\n address _liquidity,\\n address _receiver\\n ) external override onlyJobOwner(_job) {\\n if (_receiver == address(0)) revert ZeroAddress();\\n if (pendingUnbonds[_job][_liquidity] == 0) revert UnbondsUnexistent();\\n if (canWithdrawAfter[_job][_liquidity] >= block.timestamp) revert UnbondsLocked();\\n if (disputes[_job]) revert Disputed();\\n\\n uint256 _amount = pendingUnbonds[_job][_liquidity];\\n\\n delete pendingUnbonds[_job][_liquidity];\\n delete canWithdrawAfter[_job][_liquidity];\\n\\n IERC20(_liquidity).safeTransfer(_receiver, _amount);\\n emit LiquidityWithdrawal(_job, _liquidity, _receiver, _amount);\\n }\\n\\n // Internal functions\\n\\n /// @notice Updates or rewards job liquidity credits depending on time since last job reward\\n function _updateJobCreditsIfNeeded(address _job) internal returns (bool _rewarded) {\\n if (rewardedAt[_job] < _period(block.timestamp)) {\\n // Will exit function if job has been rewarded in current period\\n if (rewardedAt[_job] <= _period(block.timestamp - rewardPeriodTime)) {\\n // Will reset job to period syncronicity if a full period passed without rewards\\n _updateJobPeriod(_job);\\n _jobLiquidityCredits[_job] = _jobPeriodCredits[_job];\\n rewardedAt[_job] = _period(block.timestamp);\\n _rewarded = true;\\n } else if ((block.timestamp - rewardedAt[_job]) >= rewardPeriodTime) {\\n // Will reset job's syncronicity if last reward was more than epoch ago\\n _updateJobPeriod(_job);\\n _jobLiquidityCredits[_job] = _jobPeriodCredits[_job];\\n rewardedAt[_job] += rewardPeriodTime;\\n _rewarded = true;\\n } else if (workedAt[_job] < _period(block.timestamp)) {\\n // First keeper on period has to update job accountance to current twaps\\n uint256 previousPeriodCredits = _jobPeriodCredits[_job];\\n _updateJobPeriod(_job);\\n _jobLiquidityCredits[_job] = (_jobLiquidityCredits[_job] * _jobPeriodCredits[_job]) / previousPeriodCredits;\\n // Updating job accountance does not reward job\\n }\\n }\\n }\\n\\n /// @notice Only called if _jobLiquidityCredits < payment\\n function _rewardJobCredits(address _job) internal {\\n /// @notice Only way to += jobLiquidityCredits is when keeper rewarding (cannot pay work)\\n /* WARNING: this allows to top up _jobLiquidityCredits to a max of 1.99 but have to spend at least 1 */\\n _jobLiquidityCredits[_job] += _phase(block.timestamp - rewardedAt[_job], _jobPeriodCredits[_job]);\\n rewardedAt[_job] = block.timestamp;\\n }\\n\\n /// @notice Updates accountance for _jobPeriodCredits\\n function _updateJobPeriod(address _job) internal {\\n _jobPeriodCredits[_job] = _calculateJobPeriodCredits(_job);\\n }\\n\\n /// @notice Quotes the outdated job liquidities and calculates _periodCredits\\n /// @dev This function is also responsible for keeping the KP3R/WETH quote updated\\n function _calculateJobPeriodCredits(address _job) internal returns (uint256 _periodCredits) {\\n for (uint256 i; i < _jobLiquidities[_job].length(); i++) {\\n address _liquidity = _jobLiquidities[_job].at(i);\\n if (_approvedLiquidities.contains(_liquidity)) {\\n if (_tick[_liquidity].period != _period(block.timestamp)) {\\n // Updates liquidity cache only if needed\\n _tick[_liquidity] = observeLiquidity(_liquidity);\\n }\\n _periodCredits += _getReward(_quoteLiquidity(liquidityAmount[_job][_liquidity], _liquidity));\\n }\\n }\\n }\\n\\n /// @notice Updates job accountance calculating the impact of the unbonded liquidity amount\\n function _unbondLiquidityFromJob(\\n address _job,\\n address _liquidity,\\n uint256 _amount\\n ) internal nonReentrant {\\n if (!_jobLiquidities[_job].contains(_liquidity)) revert JobLiquidityUnexistent();\\n if (liquidityAmount[_job][_liquidity] < _amount) revert JobLiquidityInsufficient();\\n\\n // Ensures current twaps in job liquidities\\n _updateJobPeriod(_job);\\n uint256 _periodCreditsToRemove = _getReward(_quoteLiquidity(_amount, _liquidity));\\n\\n // A liquidity can be revoked causing a job to have 0 periodCredits\\n if (_jobPeriodCredits[_job] > 0) {\\n // Removes a % correspondant to a full rewardPeriodTime for the liquidity withdrawn vs all of the liquidities\\n _jobLiquidityCredits[_job] -= (_jobLiquidityCredits[_job] * _periodCreditsToRemove) / _jobPeriodCredits[_job];\\n _jobPeriodCredits[_job] -= _periodCreditsToRemove;\\n }\\n\\n liquidityAmount[_job][_liquidity] -= _amount;\\n if (liquidityAmount[_job][_liquidity] == 0) {\\n _jobLiquidities[_job].remove(_liquidity);\\n }\\n }\\n\\n /// @notice Returns a fraction of the multiplier or the whole multiplier if equal or more than a rewardPeriodTime has passed\\n function _phase(uint256 _timePassed, uint256 _multiplier) internal view returns (uint256 _result) {\\n if (_timePassed < rewardPeriodTime) {\\n _result = (_timePassed * _multiplier) / rewardPeriodTime;\\n } else _result = _multiplier;\\n }\\n\\n /// @notice Returns the start of the period of the provided timestamp\\n function _period(uint256 _timestamp) internal view returns (uint256 _periodTimestamp) {\\n return _timestamp - (_timestamp % rewardPeriodTime);\\n }\\n\\n /// @notice Calculates relation between rewardPeriod and inflationPeriod\\n function _getReward(uint256 _baseAmount) internal view returns (uint256 _credits) {\\n return FullMath.mulDiv(_baseAmount, rewardPeriodTime, inflationPeriod);\\n }\\n\\n /// @notice Returns underlying KP3R amount for a given liquidity amount\\n function _quoteLiquidity(uint256 _amount, address _liquidity) internal view returns (uint256 _quote) {\\n if (_tick[_liquidity].period != 0) {\\n int56 _tickDifference = _isKP3RToken0[_liquidity] ? _tick[_liquidity].difference : -_tick[_liquidity].difference;\\n _quote = IKeep3rHelper(keep3rHelper).getKP3RsAtTick(_amount, _tickDifference, rewardPeriodTime);\\n }\\n }\\n\\n /// @notice Updates job credits to current quotes and rewards job's pending minted credits\\n /// @dev Ensures a maximum of 1 period of credits\\n function _settleJobAccountance(address _job) internal virtual {\\n _updateJobCreditsIfNeeded(_job);\\n _rewardJobCredits(_job);\\n _jobLiquidityCredits[_job] = Math.min(_jobLiquidityCredits[_job], _jobPeriodCredits[_job]);\\n }\\n}\\n\",\"keccak256\":\"0x376ccb8e49a29f87104732bfef03fbbb72e3d3d0b92c5cfe1256e718412c5073\",\"license\":\"MIT\"},\"solidity/contracts/peripherals/jobs/Keep3rJobManager.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4 <0.9.0;\\n\\nimport './Keep3rJobOwnership.sol';\\nimport '../Keep3rAccountance.sol';\\nimport '../../../interfaces/peripherals/IKeep3rJobs.sol';\\n\\nabstract contract Keep3rJobManager is IKeep3rJobManager, Keep3rJobOwnership, Keep3rAccountance {\\n using EnumerableSet for EnumerableSet.AddressSet;\\n\\n /// @inheritdoc IKeep3rJobManager\\n function addJob(address _job) external override {\\n if (_jobs.contains(_job)) revert JobAlreadyAdded();\\n if (hasBonded[_job]) revert AlreadyAKeeper();\\n _jobs.add(_job);\\n jobOwner[_job] = msg.sender;\\n emit JobAddition(_job, msg.sender);\\n }\\n}\\n\",\"keccak256\":\"0xf6e1577a6a34b674ca34a6d7530dc81349e3ad13d321281c37e0b25b7325d013\",\"license\":\"MIT\"},\"solidity/contracts/peripherals/jobs/Keep3rJobMigration.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4 <0.9.0;\\n\\nimport '../../../interfaces/peripherals/IKeep3rJobs.sol';\\nimport './Keep3rJobFundableCredits.sol';\\nimport './Keep3rJobFundableLiquidity.sol';\\n\\nabstract contract Keep3rJobMigration is IKeep3rJobMigration, Keep3rJobFundableCredits, Keep3rJobFundableLiquidity {\\n using EnumerableSet for EnumerableSet.AddressSet;\\n\\n uint256 internal constant _MIGRATION_COOLDOWN = 1 minutes;\\n\\n /// @inheritdoc IKeep3rJobMigration\\n mapping(address => address) public override pendingJobMigrations;\\n mapping(address => mapping(address => uint256)) internal _migrationCreatedAt;\\n\\n /// @inheritdoc IKeep3rJobMigration\\n function migrateJob(address _fromJob, address _toJob) external override onlyJobOwner(_fromJob) {\\n if (_fromJob == _toJob) revert JobMigrationImpossible();\\n\\n pendingJobMigrations[_fromJob] = _toJob;\\n _migrationCreatedAt[_fromJob][_toJob] = block.timestamp;\\n\\n emit JobMigrationRequested(_fromJob, _toJob);\\n }\\n\\n /// @inheritdoc IKeep3rJobMigration\\n function acceptJobMigration(address _fromJob, address _toJob) external override onlyJobOwner(_toJob) {\\n if (disputes[_fromJob] || disputes[_toJob]) revert JobDisputed();\\n if (pendingJobMigrations[_fromJob] != _toJob) revert JobMigrationUnavailable();\\n if (block.timestamp < _migrationCreatedAt[_fromJob][_toJob] + _MIGRATION_COOLDOWN) revert JobMigrationLocked();\\n\\n // force job credits update for both jobs\\n _settleJobAccountance(_fromJob);\\n _settleJobAccountance(_toJob);\\n\\n // migrate tokens\\n while (_jobTokens[_fromJob].length() > 0) {\\n address _tokenToMigrate = _jobTokens[_fromJob].at(0);\\n jobTokenCredits[_toJob][_tokenToMigrate] += jobTokenCredits[_fromJob][_tokenToMigrate];\\n delete jobTokenCredits[_fromJob][_tokenToMigrate];\\n _jobTokens[_fromJob].remove(_tokenToMigrate);\\n _jobTokens[_toJob].add(_tokenToMigrate);\\n }\\n\\n // migrate liquidities\\n while (_jobLiquidities[_fromJob].length() > 0) {\\n address _liquidity = _jobLiquidities[_fromJob].at(0);\\n\\n liquidityAmount[_toJob][_liquidity] += liquidityAmount[_fromJob][_liquidity];\\n delete liquidityAmount[_fromJob][_liquidity];\\n\\n _jobLiquidities[_toJob].add(_liquidity);\\n _jobLiquidities[_fromJob].remove(_liquidity);\\n }\\n\\n // migrate job balances\\n _jobPeriodCredits[_toJob] += _jobPeriodCredits[_fromJob];\\n delete _jobPeriodCredits[_fromJob];\\n\\n _jobLiquidityCredits[_toJob] += _jobLiquidityCredits[_fromJob];\\n delete _jobLiquidityCredits[_fromJob];\\n\\n // stop _fromJob from being a job\\n delete rewardedAt[_fromJob];\\n _jobs.remove(_fromJob);\\n\\n // delete unused data slots\\n delete jobOwner[_fromJob];\\n delete jobPendingOwner[_fromJob];\\n delete _migrationCreatedAt[_fromJob][_toJob];\\n delete pendingJobMigrations[_fromJob];\\n\\n emit JobMigrationSuccessful(_fromJob, _toJob);\\n }\\n}\\n\",\"keccak256\":\"0xd46c3c9ce970098d8d75f11966894a341824aceb40583fcfbbc0ebda93d869f9\",\"license\":\"MIT\"},\"solidity/contracts/peripherals/jobs/Keep3rJobOwnership.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4 <0.9.0;\\n\\nimport '../../../interfaces/peripherals/IKeep3rJobs.sol';\\n\\nabstract contract Keep3rJobOwnership is IKeep3rJobOwnership {\\n /// @inheritdoc IKeep3rJobOwnership\\n mapping(address => address) public override jobOwner;\\n\\n /// @inheritdoc IKeep3rJobOwnership\\n mapping(address => address) public override jobPendingOwner;\\n\\n /// @inheritdoc IKeep3rJobOwnership\\n function changeJobOwnership(address _job, address _newOwner) external override onlyJobOwner(_job) {\\n jobPendingOwner[_job] = _newOwner;\\n emit JobOwnershipChange(_job, jobOwner[_job], _newOwner);\\n }\\n\\n /// @inheritdoc IKeep3rJobOwnership\\n function acceptJobOwnership(address _job) external override onlyPendingJobOwner(_job) {\\n address _previousOwner = jobOwner[_job];\\n\\n jobOwner[_job] = jobPendingOwner[_job];\\n delete jobPendingOwner[_job];\\n\\n emit JobOwnershipAssent(msg.sender, _job, _previousOwner);\\n }\\n\\n modifier onlyJobOwner(address _job) {\\n if (msg.sender != jobOwner[_job]) revert OnlyJobOwner();\\n _;\\n }\\n\\n modifier onlyPendingJobOwner(address _job) {\\n if (msg.sender != jobPendingOwner[_job]) revert OnlyPendingJobOwner();\\n _;\\n }\\n}\\n\",\"keccak256\":\"0xa837590ade9cd5d25690e3f2d8b9a63e7202f7179b32e42eab4fa4c4324b9728\",\"license\":\"MIT\"},\"solidity/contracts/peripherals/jobs/Keep3rJobWorkable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4 <0.9.0;\\n\\nimport './Keep3rJobMigration.sol';\\nimport '../../../interfaces/IKeep3rHelper.sol';\\nimport '../../../interfaces/peripherals/IKeep3rJobs.sol';\\n\\nimport '@openzeppelin/contracts/token/ERC20/IERC20.sol';\\nimport '@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol';\\n\\nabstract contract Keep3rJobWorkable is IKeep3rJobWorkable, Keep3rJobMigration {\\n using EnumerableSet for EnumerableSet.AddressSet;\\n using SafeERC20 for IERC20;\\n\\n uint256 internal _initialGas;\\n\\n /// @inheritdoc IKeep3rJobWorkable\\n function isKeeper(address _keeper) external override returns (bool _isKeeper) {\\n _initialGas = _getGasLeft();\\n if (_keepers.contains(_keeper)) {\\n emit KeeperValidation(_initialGas);\\n return true;\\n }\\n }\\n\\n /// @inheritdoc IKeep3rJobWorkable\\n function isBondedKeeper(\\n address _keeper,\\n address _bond,\\n uint256 _minBond,\\n uint256 _earned,\\n uint256 _age\\n ) external override returns (bool _isBondedKeeper) {\\n _initialGas = _getGasLeft();\\n if (\\n _keepers.contains(_keeper) &&\\n bonds[_keeper][_bond] >= _minBond &&\\n workCompleted[_keeper] >= _earned &&\\n block.timestamp - firstSeen[_keeper] >= _age\\n ) {\\n emit KeeperValidation(_initialGas);\\n return true;\\n }\\n }\\n\\n /// @inheritdoc IKeep3rJobWorkable\\n function worked(address _keeper) external virtual override {\\n if (_initialGas == 0) revert GasNotInitialized();\\n address _job = msg.sender;\\n if (disputes[_job]) revert JobDisputed();\\n if (!_jobs.contains(_job)) revert JobUnapproved();\\n\\n if (_updateJobCreditsIfNeeded(_job)) {\\n emit LiquidityCreditsReward(_job, rewardedAt[_job], _jobLiquidityCredits[_job], _jobPeriodCredits[_job]);\\n }\\n\\n (uint256 _boost, uint256 _oneEthQuote, uint256 _extraGas) = IKeep3rHelper(keep3rHelper).getPaymentParams(bonds[_keeper][keep3rV1]);\\n\\n uint256 _gasLeft = _getGasLeft();\\n uint256 _payment = _calculatePayment(_gasLeft, _extraGas, _oneEthQuote, _boost);\\n\\n if (_payment > _jobLiquidityCredits[_job]) {\\n _rewardJobCredits(_job);\\n emit LiquidityCreditsReward(_job, rewardedAt[_job], _jobLiquidityCredits[_job], _jobPeriodCredits[_job]);\\n\\n _gasLeft = _getGasLeft();\\n _payment = _calculatePayment(_gasLeft, _extraGas, _oneEthQuote, _boost);\\n }\\n\\n _bondedPayment(_job, _keeper, _payment);\\n delete _initialGas;\\n\\n emit KeeperWork(keep3rV1, _job, _keeper, _payment, _gasLeft);\\n }\\n\\n /// @inheritdoc IKeep3rJobWorkable\\n function bondedPayment(address _keeper, uint256 _payment) external override {\\n address _job = msg.sender;\\n\\n if (disputes[_job]) revert JobDisputed();\\n if (!_jobs.contains(_job)) revert JobUnapproved();\\n\\n if (_updateJobCreditsIfNeeded(_job)) {\\n emit LiquidityCreditsReward(_job, rewardedAt[_job], _jobLiquidityCredits[_job], _jobPeriodCredits[_job]);\\n }\\n\\n if (_payment > _jobLiquidityCredits[_job]) {\\n _rewardJobCredits(_job);\\n emit LiquidityCreditsReward(_job, rewardedAt[_job], _jobLiquidityCredits[_job], _jobPeriodCredits[_job]);\\n }\\n\\n _bondedPayment(_job, _keeper, _payment);\\n emit KeeperWork(keep3rV1, _job, _keeper, _payment, _getGasLeft());\\n }\\n\\n /// @inheritdoc IKeep3rJobWorkable\\n function directTokenPayment(\\n address _token,\\n address _keeper,\\n uint256 _amount\\n ) external override {\\n address _job = msg.sender;\\n\\n if (disputes[_job]) revert JobDisputed();\\n if (disputes[_keeper]) revert Disputed();\\n if (!_jobs.contains(_job)) revert JobUnapproved();\\n if (jobTokenCredits[_job][_token] < _amount) revert InsufficientFunds();\\n jobTokenCredits[_job][_token] -= _amount;\\n IERC20(_token).safeTransfer(_keeper, _amount);\\n emit KeeperWork(_token, _job, _keeper, _amount, _getGasLeft());\\n }\\n\\n function _bondedPayment(\\n address _job,\\n address _keeper,\\n uint256 _payment\\n ) internal {\\n if (_payment > _jobLiquidityCredits[_job]) revert InsufficientFunds();\\n\\n workedAt[_job] = block.timestamp;\\n _jobLiquidityCredits[_job] -= _payment;\\n bonds[_keeper][keep3rV1] += _payment;\\n workCompleted[_keeper] += _payment;\\n totalBonds += _payment;\\n }\\n\\n /// @notice Calculate amount to be payed in KP3R, taking into account multiple parameters\\n /// @param _gasLeft Amount of gas left after working the job\\n /// @param _extraGas Amount of expected unaccounted gas\\n /// @param _oneEthQuote Amount of KP3R equivalent to 1 ETH\\n /// @param _boost Reward given to the keeper for having bonded KP3R tokens\\n /// @return _payment Amount to be payed in KP3R tokens\\n function _calculatePayment(\\n uint256 _gasLeft,\\n uint256 _extraGas,\\n uint256 _oneEthQuote,\\n uint256 _boost\\n ) internal view returns (uint256 _payment) {\\n uint256 _accountedGas = _initialGas - _gasLeft + _extraGas;\\n _payment = (((_accountedGas * _boost) / _BASE) * _oneEthQuote) / 1 ether;\\n }\\n\\n /// @notice Return the gas left and add 1/64 in order to match real gas left at first level of depth (EIP-150)\\n /// @return _gasLeft Amount of gas left recording taking into account EIP-150\\n function _getGasLeft() internal view returns (uint256 _gasLeft) {\\n _gasLeft = (gasleft() * 64) / 63;\\n }\\n}\\n\",\"keccak256\":\"0x7e113a0815d9125e760ee75c9d9c55fc93192ae2535afccdb8835984d17b510f\",\"license\":\"MIT\"},\"solidity/contracts/peripherals/jobs/Keep3rJobs.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4 <0.9.0;\\n\\nimport '../../../interfaces/peripherals/IKeep3rJobs.sol';\\nimport './Keep3rJobManager.sol';\\nimport './Keep3rJobWorkable.sol';\\nimport './Keep3rJobDisputable.sol';\\n\\nabstract contract Keep3rJobs is IKeep3rJobs, Keep3rJobManager, Keep3rJobWorkable, Keep3rJobDisputable {}\\n\",\"keccak256\":\"0x882e1a19891795de04c4c891dc58d50034ca0a32c8b61651aaf0f47d0bc321d4\",\"license\":\"MIT\"},\"solidity/contracts/peripherals/keepers/Keep3rKeeperDisputable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4 <0.9.0;\\n\\nimport './Keep3rKeeperFundable.sol';\\nimport '../Keep3rDisputable.sol';\\nimport '../../../interfaces/external/IKeep3rV1.sol';\\nimport '../../../interfaces/peripherals/IKeep3rKeepers.sol';\\n\\nabstract contract Keep3rKeeperDisputable is IKeep3rKeeperDisputable, Keep3rDisputable, Keep3rKeeperFundable {\\n using EnumerableSet for EnumerableSet.AddressSet;\\n using SafeERC20 for IERC20;\\n\\n /// @inheritdoc IKeep3rKeeperDisputable\\n function slash(\\n address _keeper,\\n address _bonded,\\n uint256 _bondAmount,\\n uint256 _unbondAmount\\n ) external override onlySlasher {\\n if (!disputes[_keeper]) revert NotDisputed();\\n _slash(_keeper, _bonded, _bondAmount, _unbondAmount);\\n emit KeeperSlash(_keeper, msg.sender, _bondAmount + _unbondAmount);\\n }\\n\\n /// @inheritdoc IKeep3rKeeperDisputable\\n function revoke(address _keeper) external override onlySlasher {\\n if (!disputes[_keeper]) revert NotDisputed();\\n _keepers.remove(_keeper);\\n _slash(_keeper, keep3rV1, bonds[_keeper][keep3rV1], pendingUnbonds[_keeper][keep3rV1]);\\n emit KeeperRevoke(_keeper, msg.sender);\\n }\\n\\n function _slash(\\n address _keeper,\\n address _bonded,\\n uint256 _bondAmount,\\n uint256 _unbondAmount\\n ) internal {\\n if (_bonded != keep3rV1) {\\n try IERC20(_bonded).transfer(governor, _bondAmount + _unbondAmount) returns (bool) {} catch (bytes memory) {}\\n }\\n bonds[_keeper][_bonded] -= _bondAmount;\\n pendingUnbonds[_keeper][_bonded] -= _unbondAmount;\\n }\\n}\\n\",\"keccak256\":\"0x4dba80c119fa75a3fa13b2c910b8e949154453ac9f1158539ec3f1149830890b\",\"license\":\"MIT\"},\"solidity/contracts/peripherals/keepers/Keep3rKeeperFundable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4 <0.9.0;\\n\\nimport '../Keep3rAccountance.sol';\\nimport '../Keep3rParameters.sol';\\nimport '../../../interfaces/peripherals/IKeep3rKeepers.sol';\\n\\nimport '../../../interfaces/external/IKeep3rV1.sol';\\n\\nimport '@openzeppelin/contracts/security/ReentrancyGuard.sol';\\nimport '@openzeppelin/contracts/token/ERC20/IERC20.sol';\\nimport '@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol';\\n\\nabstract contract Keep3rKeeperFundable is IKeep3rKeeperFundable, ReentrancyGuard, Keep3rParameters {\\n using EnumerableSet for EnumerableSet.AddressSet;\\n using SafeERC20 for IERC20;\\n\\n /// @inheritdoc IKeep3rKeeperFundable\\n function bond(address _bonding, uint256 _amount) external override nonReentrant {\\n if (disputes[msg.sender]) revert Disputed();\\n if (_jobs.contains(msg.sender)) revert AlreadyAJob();\\n canActivateAfter[msg.sender][_bonding] = block.timestamp + bondTime;\\n\\n uint256 _before = IERC20(_bonding).balanceOf(address(this));\\n IERC20(_bonding).safeTransferFrom(msg.sender, address(this), _amount);\\n _amount = IERC20(_bonding).balanceOf(address(this)) - _before;\\n\\n hasBonded[msg.sender] = true;\\n pendingBonds[msg.sender][_bonding] += _amount;\\n\\n emit Bonding(msg.sender, _bonding, _amount);\\n }\\n\\n /// @inheritdoc IKeep3rKeeperFundable\\n function activate(address _bonding) external override {\\n address _keeper = msg.sender;\\n if (disputes[_keeper]) revert Disputed();\\n uint256 _canActivateAfter = canActivateAfter[_keeper][_bonding];\\n if (_canActivateAfter == 0) revert BondsUnexistent();\\n if (_canActivateAfter >= block.timestamp) revert BondsLocked();\\n\\n if (firstSeen[_keeper] == 0) {\\n firstSeen[_keeper] = block.timestamp;\\n }\\n _keepers.add(_keeper);\\n\\n uint256 _amount = pendingBonds[_keeper][_bonding];\\n delete pendingBonds[_keeper][_bonding];\\n\\n // bond provided tokens\\n bonds[_keeper][_bonding] += _amount;\\n if (_bonding == keep3rV1) {\\n totalBonds += _amount;\\n _depositBonds(_amount);\\n }\\n\\n emit Activation(_keeper, _bonding, _amount);\\n }\\n\\n /// @inheritdoc IKeep3rKeeperFundable\\n function unbond(address _bonding, uint256 _amount) external override {\\n canWithdrawAfter[msg.sender][_bonding] = block.timestamp + unbondTime;\\n bonds[msg.sender][_bonding] -= _amount;\\n pendingUnbonds[msg.sender][_bonding] += _amount;\\n\\n emit Unbonding(msg.sender, _bonding, _amount);\\n }\\n\\n /// @inheritdoc IKeep3rKeeperFundable\\n function withdraw(address _bonding) external override nonReentrant {\\n if (pendingUnbonds[msg.sender][_bonding] == 0) revert UnbondsUnexistent();\\n if (canWithdrawAfter[msg.sender][_bonding] >= block.timestamp) revert UnbondsLocked();\\n if (disputes[msg.sender]) revert Disputed();\\n\\n uint256 _amount = pendingUnbonds[msg.sender][_bonding];\\n\\n delete pendingUnbonds[msg.sender][_bonding];\\n delete canWithdrawAfter[msg.sender][_bonding];\\n\\n if (_bonding == keep3rV1) _mint(_amount);\\n IERC20(_bonding).safeTransfer(msg.sender, _amount);\\n\\n emit Withdrawal(msg.sender, _bonding, _amount);\\n }\\n\\n function _depositBonds(uint256 _amount) internal virtual {\\n IKeep3rV1(keep3rV1).burn(_amount);\\n }\\n}\\n\",\"keccak256\":\"0x121dc11fa555731679912d54da3bb8282d26ad425deffae6d4d7085ef3c9290d\",\"license\":\"MIT\"},\"solidity/contracts/peripherals/keepers/Keep3rKeepers.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4 <0.9.0;\\n\\nimport '../../../interfaces/peripherals/IKeep3rKeepers.sol';\\nimport './Keep3rKeeperDisputable.sol';\\n\\nabstract contract Keep3rKeepers is IKeep3rKeepers, Keep3rKeeperDisputable {}\\n\",\"keccak256\":\"0xfc762d9fd6ff478acba446c3ab6fc19c7d49a85de097dc35f02c56e928153c5e\",\"license\":\"MIT\"},\"solidity/contracts/sidechain/Keep3rSidechain.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\n/*\\n\\nCoded for The Keep3r Network with \\u2665 by\\n\\n\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2557\\u2591\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2557\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2557\\u2588\\u2588\\u2557\\u2591\\u2591\\u2591\\u2588\\u2588\\u2557\\u2591\\u2591\\u2591\\u2591\\u2591\\u2591\\u2591\\u2588\\u2588\\u2557\\u2591\\u2588\\u2588\\u2588\\u2588\\u2588\\u2557\\u2591\\u2588\\u2588\\u2588\\u2557\\u2591\\u2591\\u2588\\u2588\\u2557\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2557\\u2591\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2557\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2557\\u2591\\u2588\\u2588\\u2557\\u2591\\u2591\\u2591\\u2591\\u2591\\u2591\\u2588\\u2588\\u2588\\u2588\\u2588\\u2557\\u2591\\u2588\\u2588\\u2588\\u2557\\u2591\\u2591\\u2588\\u2588\\u2557\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2557\\u2591\\n\\u2588\\u2588\\u2554\\u2550\\u2550\\u2588\\u2588\\u2557\\u2588\\u2588\\u2554\\u2550\\u2550\\u2550\\u2550\\u255d\\u2588\\u2588\\u2554\\u2550\\u2550\\u2550\\u2550\\u255d\\u2588\\u2588\\u2551\\u2591\\u2591\\u2591\\u2588\\u2588\\u2551\\u2591\\u2591\\u2588\\u2588\\u2557\\u2591\\u2591\\u2588\\u2588\\u2551\\u2588\\u2588\\u2554\\u2550\\u2550\\u2588\\u2588\\u2557\\u2588\\u2588\\u2588\\u2588\\u2557\\u2591\\u2588\\u2588\\u2551\\u2588\\u2588\\u2554\\u2550\\u2550\\u2588\\u2588\\u2557\\u2588\\u2588\\u2554\\u2550\\u2550\\u2550\\u2550\\u255d\\u2588\\u2588\\u2554\\u2550\\u2550\\u2588\\u2588\\u2557\\u2588\\u2588\\u2551\\u2591\\u2591\\u2591\\u2591\\u2591\\u2588\\u2588\\u2554\\u2550\\u2550\\u2588\\u2588\\u2557\\u2588\\u2588\\u2588\\u2588\\u2557\\u2591\\u2588\\u2588\\u2551\\u2588\\u2588\\u2554\\u2550\\u2550\\u2588\\u2588\\u2557\\n\\u2588\\u2588\\u2551\\u2591\\u2591\\u2588\\u2588\\u2551\\u2588\\u2588\\u2588\\u2588\\u2588\\u2557\\u2591\\u2591\\u2588\\u2588\\u2588\\u2588\\u2588\\u2557\\u2591\\u2591\\u2588\\u2588\\u2551\\u2591\\u2591\\u2591\\u255a\\u2588\\u2588\\u2557\\u2588\\u2588\\u2588\\u2588\\u2557\\u2588\\u2588\\u2554\\u255d\\u2588\\u2588\\u2551\\u2591\\u2591\\u2588\\u2588\\u2551\\u2588\\u2588\\u2554\\u2588\\u2588\\u2557\\u2588\\u2588\\u2551\\u2588\\u2588\\u2551\\u2591\\u2591\\u2588\\u2588\\u2551\\u2588\\u2588\\u2588\\u2588\\u2588\\u2557\\u2591\\u2591\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2554\\u255d\\u2588\\u2588\\u2551\\u2591\\u2591\\u2591\\u2591\\u2591\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2551\\u2588\\u2588\\u2554\\u2588\\u2588\\u2557\\u2588\\u2588\\u2551\\u2588\\u2588\\u2551\\u2591\\u2591\\u2588\\u2588\\u2551\\n\\u2588\\u2588\\u2551\\u2591\\u2591\\u2588\\u2588\\u2551\\u2588\\u2588\\u2554\\u2550\\u2550\\u255d\\u2591\\u2591\\u2588\\u2588\\u2554\\u2550\\u2550\\u255d\\u2591\\u2591\\u2588\\u2588\\u2551\\u2591\\u2591\\u2591\\u2591\\u2588\\u2588\\u2588\\u2588\\u2554\\u2550\\u2588\\u2588\\u2588\\u2588\\u2551\\u2591\\u2588\\u2588\\u2551\\u2591\\u2591\\u2588\\u2588\\u2551\\u2588\\u2588\\u2551\\u255a\\u2588\\u2588\\u2588\\u2588\\u2551\\u2588\\u2588\\u2551\\u2591\\u2591\\u2588\\u2588\\u2551\\u2588\\u2588\\u2554\\u2550\\u2550\\u255d\\u2591\\u2591\\u2588\\u2588\\u2554\\u2550\\u2550\\u2588\\u2588\\u2557\\u2588\\u2588\\u2551\\u2591\\u2591\\u2591\\u2591\\u2591\\u2588\\u2588\\u2554\\u2550\\u2550\\u2588\\u2588\\u2551\\u2588\\u2588\\u2551\\u255a\\u2588\\u2588\\u2588\\u2588\\u2551\\u2588\\u2588\\u2551\\u2591\\u2591\\u2588\\u2588\\u2551\\n\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2554\\u255d\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2557\\u2588\\u2588\\u2551\\u2591\\u2591\\u2591\\u2591\\u2591\\u2588\\u2588\\u2551\\u2591\\u2591\\u2591\\u2591\\u255a\\u2588\\u2588\\u2554\\u255d\\u2591\\u255a\\u2588\\u2588\\u2554\\u255d\\u2591\\u255a\\u2588\\u2588\\u2588\\u2588\\u2588\\u2554\\u255d\\u2588\\u2588\\u2551\\u2591\\u255a\\u2588\\u2588\\u2588\\u2551\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2554\\u255d\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2557\\u2588\\u2588\\u2551\\u2591\\u2591\\u2588\\u2588\\u2551\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2557\\u2588\\u2588\\u2551\\u2591\\u2591\\u2588\\u2588\\u2551\\u2588\\u2588\\u2551\\u2591\\u255a\\u2588\\u2588\\u2588\\u2551\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2554\\u255d\\n\\u255a\\u2550\\u2550\\u2550\\u2550\\u2550\\u255d\\u2591\\u255a\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u255d\\u255a\\u2550\\u255d\\u2591\\u2591\\u2591\\u2591\\u2591\\u255a\\u2550\\u255d\\u2591\\u2591\\u2591\\u2591\\u2591\\u255a\\u2550\\u255d\\u2591\\u2591\\u2591\\u255a\\u2550\\u255d\\u2591\\u2591\\u2591\\u255a\\u2550\\u2550\\u2550\\u2550\\u255d\\u2591\\u255a\\u2550\\u255d\\u2591\\u2591\\u255a\\u2550\\u2550\\u255d\\u255a\\u2550\\u2550\\u2550\\u2550\\u2550\\u255d\\u2591\\u255a\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u255d\\u255a\\u2550\\u255d\\u2591\\u2591\\u255a\\u2550\\u255d\\u255a\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u255d\\u255a\\u2550\\u255d\\u2591\\u2591\\u255a\\u2550\\u255d\\u255a\\u2550\\u255d\\u2591\\u2591\\u255a\\u2550\\u2550\\u255d\\u255a\\u2550\\u2550\\u2550\\u2550\\u2550\\u255d\\u2591\\n\\nhttps://defi.sucks\\n\\nCommit hash: b18e2940310077e04ec08b3026dc92e441fb08ef\\n\\n*/\\n\\npragma solidity >=0.8.4 <0.9.0;\\n\\nimport '../Keep3r.sol';\\nimport '../../interfaces/sidechain/IKeep3rEscrow.sol';\\nimport '../../interfaces/sidechain/IKeep3rHelperSidechain.sol';\\nimport '../../interfaces/sidechain/IKeep3rJobWorkableRated.sol';\\nimport '../../interfaces/sidechain/IKeep3rSidechainAccountance.sol';\\n\\ncontract Keep3rSidechain is Keep3r, IKeep3rJobWorkableRated, IKeep3rSidechainAccountance {\\n using EnumerableSet for EnumerableSet.AddressSet;\\n\\n /// @param _governor Address of governor\\n /// @param _keep3rHelperSidechain Address of sidechain Keep3rHelper\\n /// @param _wrappedKP3R Address of wrapped KP3R implementation\\n /// @param _keep3rEscrow Address of sidechain Keep3rEscrow\\n constructor(\\n address _governor, // governor\\n address _keep3rHelperSidechain, // helper\\n address _wrappedKP3R, // keep3rV1\\n address _keep3rEscrow // keep3rV1Proxy\\n ) Keep3r(_governor, _keep3rHelperSidechain, _wrappedKP3R, _keep3rEscrow) {}\\n\\n // Keep3rSidechainAccountance\\n\\n /// @inheritdoc IKeep3rSidechainAccountance\\n function virtualReserves() external view override returns (int256 _virtualReserves) {\\n // Queries wKP3R balanceOf escrow contract minus the totalBonds\\n return int256(IERC20(keep3rV1).balanceOf(keep3rV1Proxy)) - int256(totalBonds);\\n }\\n\\n // Keep3rJobFundableLiquidity\\n\\n /// @notice Sidechain implementation asks the Helper for an oracle, instead of reading it from the ERC-20\\n /// @dev Function should be called after setting an oracle in Keep3rHelperSidechain\\n /// @param _liquidity Address of the liquidity token being approved\\n function approveLiquidity(address _liquidity) external virtual override onlyGovernor {\\n if (!_approvedLiquidities.add(_liquidity)) revert LiquidityPairApproved();\\n _liquidityPool[_liquidity] = IKeep3rHelperSidechain(keep3rHelper).oracle(_liquidity);\\n if (_liquidityPool[_liquidity] == address(0)) revert ZeroAddress();\\n _isKP3RToken0[_liquidity] = IKeep3rHelper(keep3rHelper).isKP3RToken0(_liquidityPool[_liquidity]);\\n _tick[_liquidity] = observeLiquidity(_liquidity);\\n emit LiquidityApproval(_liquidity);\\n }\\n\\n /// @notice Sidechain implementation will always ask for 2 tickCumulatives instead of cacheing\\n /// @param _liquidity Address of the liquidity token being observed\\n function observeLiquidity(address _liquidity) public view virtual override returns (TickCache memory _tickCache) {\\n if (_tick[_liquidity].period == _period(block.timestamp)) {\\n // Will return cached twaps if liquidity is updated\\n _tickCache = _tick[_liquidity];\\n } else {\\n bool success;\\n\\n // Will always ask for 2 accumulators in sidechain\\n uint32[] memory _secondsAgo = new uint32[](2);\\n\\n _secondsAgo[0] = uint32(block.timestamp - _period(block.timestamp));\\n _secondsAgo[1] = uint32(block.timestamp - _period(block.timestamp) + rewardPeriodTime);\\n\\n int56 _tickCumulative2;\\n (_tickCache.current, _tickCumulative2, success) = IKeep3rHelper(keep3rHelper).observe(_liquidityPool[_liquidity], _secondsAgo);\\n\\n _tickCache.difference = _tickCache.current - _tickCumulative2;\\n\\n if (success) {\\n _tickCache.period = _period(block.timestamp);\\n } else {\\n delete _tickCache.period;\\n }\\n }\\n }\\n\\n // Keep3rJobsWorkable\\n\\n /// @dev Sidechain implementation deprecates worked(address) as it should come with a usdPerGasUnit parameter\\n function worked(address) external pure override {\\n revert Deprecated();\\n }\\n\\n /// @notice Implemented by jobs to show that a keeper performed work\\n /// @dev Uses a USD per gas unit payment mechanism\\n /// @param _keeper Address of the keeper that performed the work\\n /// @param _usdPerGasUnit Units of USD (in wei) per gas unit that should be rewarded to the keeper\\n function worked(address _keeper, uint256 _usdPerGasUnit) external override {\\n if (_initialGas == 0) revert GasNotInitialized();\\n // Gas used for quote calculations & payment is not rewarded\\n uint256 _gasLeft = _getGasLeft();\\n\\n address _job = msg.sender;\\n if (disputes[_job]) revert JobDisputed();\\n if (!_jobs.contains(_job)) revert JobUnapproved();\\n\\n if (_updateJobCreditsIfNeeded(_job)) {\\n emit LiquidityCreditsReward(_job, rewardedAt[_job], _jobLiquidityCredits[_job], _jobPeriodCredits[_job]);\\n }\\n\\n (uint256 _boost, uint256 _oneUsdQuote, uint256 _extraGas) = IKeep3rHelper(keep3rHelper).getPaymentParams(bonds[_keeper][keep3rV1]);\\n\\n uint256 _kp3rPayment = _calculatePayment(_gasLeft, _extraGas, _oneUsdQuote * _usdPerGasUnit, _boost);\\n\\n if (_kp3rPayment > _jobLiquidityCredits[_job]) {\\n _rewardJobCredits(_job);\\n emit LiquidityCreditsReward(_job, rewardedAt[_job], _jobLiquidityCredits[_job], _jobPeriodCredits[_job]);\\n }\\n\\n _bondedPayment(_job, _keeper, _kp3rPayment);\\n delete _initialGas;\\n\\n emit KeeperWork(keep3rV1, _job, _keeper, _kp3rPayment, _gasLeft);\\n }\\n\\n // Keep3rKeeperFundable\\n\\n /// @dev Sidechain implementation doesn't burn tokens, but deposit them in Keep3rEscrow\\n function _depositBonds(uint256 _amount) internal virtual override {\\n IKeep3rV1(keep3rV1).approve(keep3rV1Proxy, _amount);\\n IKeep3rEscrow(keep3rV1Proxy).deposit(_amount);\\n }\\n}\\n\",\"keccak256\":\"0xac6fb409ae0b779221879701d1b786d17d32bea0afc85c3baa7aab01f3cbd2ca\",\"license\":\"MIT\"},\"solidity/for-test/testnet/Keep3rSidechainForTestnet.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4 <0.9.0;\\n\\nimport '../../contracts/sidechain/Keep3rSidechain.sol';\\n\\ncontract Keep3rSidechainForTestnet is Keep3rSidechain {\\n constructor(\\n address _governor,\\n address _keep3rHelper,\\n address _keep3rV1,\\n address _keep3rV1Proxy\\n ) Keep3rSidechain(_governor, _keep3rHelper, _keep3rV1, _keep3rV1Proxy) {\\n bondTime = 0; // allows keepers to instantly register\\n unbondTime = 0; // allows keepers & jobOwners to instantly withdraw funds\\n liquidityMinimum = 1; // allows job providers to add low liquidity\\n rewardPeriodTime = 1 days; // reduces twap calculation period\\n inflationPeriod = 5 days; // increases credit minting\\n }\\n}\\n\",\"keccak256\":\"0x12505a8d59870efacdad241d8487a9cec659109d5efd562119769cccd8ef9038\",\"license\":\"MIT\"},\"solidity/interfaces/IKeep3r.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4 <0.9.0;\\n\\nimport './peripherals/IKeep3rJobs.sol';\\nimport './peripherals/IKeep3rKeepers.sol';\\nimport './peripherals/IKeep3rParameters.sol';\\n\\n// solhint-disable-next-line no-empty-blocks\\n\\n/// @title Keep3rV2 contract\\n/// @notice This contract inherits all the functionality of Keep3rV2\\ninterface IKeep3r is IKeep3rJobs, IKeep3rKeepers, IKeep3rParameters {\\n\\n}\\n\",\"keccak256\":\"0x273a39984c1475c60182e636bb91a1b89ec98646a036cac6a87067869b3adeb9\",\"license\":\"MIT\"},\"solidity/interfaces/IKeep3rHelper.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4 <0.9.0;\\n\\nimport './IKeep3rHelperParameters.sol';\\n\\n/// @title Keep3rHelper contract\\n/// @notice Contains all the helper functions used throughout the different files.\\ninterface IKeep3rHelper is IKeep3rHelperParameters {\\n // Errors\\n\\n /// @notice Throws when none of the tokens in the liquidity pair is KP3R\\n error LiquidityPairInvalid();\\n\\n // Methods\\n // solhint-enable func-name-mixedcase\\n\\n /// @notice Calculates the amount of KP3R that corresponds to the ETH passed into the function\\n /// @dev This function allows us to calculate how much KP3R we should pay to a keeper for things expressed in ETH, like gas\\n /// @param _eth The amount of ETH\\n /// @return _amountOut The amount of KP3R\\n function quote(uint256 _eth) external view returns (uint256 _amountOut);\\n\\n /// @notice Returns the amount of KP3R the keeper has bonded\\n /// @param _keeper The address of the keeper to check\\n /// @return _amountBonded The amount of KP3R the keeper has bonded\\n function bonds(address _keeper) external view returns (uint256 _amountBonded);\\n\\n /// @notice Calculates the reward (in KP3R) that corresponds to a keeper for using gas\\n /// @param _keeper The address of the keeper to check\\n /// @param _gasUsed The amount of gas used that will be rewarded\\n /// @return _kp3r The amount of KP3R that should be awarded to the keeper\\n function getRewardAmountFor(address _keeper, uint256 _gasUsed) external view returns (uint256 _kp3r);\\n\\n /// @notice Calculates the boost in the reward given to a keeper based on the amount of KP3R that keeper has bonded\\n /// @dev If the keeper has no bonds, boost should be +10% of gas cost, if keeper has max bonds, +20%\\n /// @param _bonds The amount of KP3R tokens bonded by the keeper\\n /// @return _rewardBoost The reward boost that corresponds to the keeper\\n function getRewardBoostFor(uint256 _bonds) external view returns (uint256 _rewardBoost);\\n\\n /// @notice Calculates the reward (in KP3R) that corresponds to tx.origin for using gas\\n /// @param _gasUsed The amount of gas used that will be rewarded\\n /// @return _amount The amount of KP3R that should be awarded to tx.origin\\n function getRewardAmount(uint256 _gasUsed) external view returns (uint256 _amount);\\n\\n /// @notice Given a pool address, returns the underlying tokens of the pair\\n /// @param _pool Address of the correspondant pool\\n /// @return _token0 Address of the first token of the pair\\n /// @return _token1 Address of the second token of the pair\\n function getPoolTokens(address _pool) external view returns (address _token0, address _token1);\\n\\n /// @notice Defines the order of the tokens in the pair for twap calculations\\n /// @param _pool Address of the correspondant pool\\n /// @return _isKP3RToken0 Boolean indicating the order of the tokens in the pair\\n function isKP3RToken0(address _pool) external view returns (bool _isKP3RToken0);\\n\\n /// @notice Given an array of secondsAgo, returns UniswapV3 pool cumulatives at that moment\\n /// @param _pool Address of the pool to observe\\n /// @param _secondsAgo Array with time references to observe\\n /// @return _tickCumulative1 Cumulative sum of ticks until first time reference\\n /// @return _tickCumulative2 Cumulative sum of ticks until second time reference\\n /// @return _success Boolean indicating if the observe call was succesfull\\n function observe(address _pool, uint32[] memory _secondsAgo)\\n external\\n view\\n returns (\\n int56 _tickCumulative1,\\n int56 _tickCumulative2,\\n bool _success\\n );\\n\\n /// @notice Get multiplier, quote, and extra, in order to calculate keeper payment\\n /// @param _bonds Amount of bonded KP3R owned by the keeper\\n /// @return _boost Multiplier per gas unit. Takes into account the base fee and the amount of bonded KP3R\\n /// @return _oneEthQuote Amount of KP3R tokens equivalent to 1 ETH\\n /// @return _extra Amount of extra gas that should be added to the gas spent\\n function getPaymentParams(uint256 _bonds)\\n external\\n view\\n returns (\\n uint256 _boost,\\n uint256 _oneEthQuote,\\n uint256 _extra\\n );\\n\\n /// @notice Given a tick and a liquidity amount, calculates the underlying KP3R tokens\\n /// @param _liquidityAmount Amount of liquidity to be converted\\n /// @param _tickDifference Tick value used to calculate the quote\\n /// @param _timeInterval Time value used to calculate the quote\\n /// @return _kp3rAmount Amount of KP3R tokens underlying on the given liquidity\\n function getKP3RsAtTick(\\n uint256 _liquidityAmount,\\n int56 _tickDifference,\\n uint256 _timeInterval\\n ) external pure returns (uint256 _kp3rAmount);\\n\\n /// @notice Given a tick and a token amount, calculates the output in correspondant token\\n /// @param _baseAmount Amount of token to be converted\\n /// @param _tickDifference Tick value used to calculate the quote\\n /// @param _timeInterval Time value used to calculate the quote\\n /// @return _quoteAmount Amount of credits deserved for the baseAmount at the tick value\\n function getQuoteAtTick(\\n uint128 _baseAmount,\\n int56 _tickDifference,\\n uint256 _timeInterval\\n ) external pure returns (uint256 _quoteAmount);\\n}\\n\",\"keccak256\":\"0x67817dc98fde9b3a917e25bc16fe60a91772dd5a77e0ce22a208b66b29d3ad8e\",\"license\":\"MIT\"},\"solidity/interfaces/IKeep3rHelperParameters.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4 <0.9.0;\\n\\n/// @title Keep3rHelperParameters contract\\n/// @notice Contains all the helper functions used throughout the different files.\\ninterface IKeep3rHelperParameters {\\n // Structs\\n\\n /// @dev KP3R-WETH Pool address and isKP3RToken0\\n /// @dev Created in order to save gas by avoiding calls to pool's token0 method\\n struct Kp3rWethOraclePool {\\n address poolAddress;\\n bool isKP3RToken0;\\n }\\n\\n // Errors\\n\\n /// @notice Throws when pool does not have KP3R as token0 nor token1\\n error InvalidOraclePool();\\n\\n // Events\\n\\n /// @notice Emitted when the kp3r weth pool is changed\\n /// @param _address Address of the new kp3r weth pool\\n /// @param _isKP3RToken0 True if calling the token0 method of the pool returns the KP3R token address\\n event Kp3rWethPoolChange(address _address, bool _isKP3RToken0);\\n\\n /// @notice Emitted when the minimum boost multiplier is changed\\n /// @param _minBoost The minimum boost multiplier\\n event MinBoostChange(uint256 _minBoost);\\n\\n /// @notice Emitted when the maximum boost multiplier is changed\\n /// @param _maxBoost The maximum boost multiplier\\n event MaxBoostChange(uint256 _maxBoost);\\n\\n /// @notice Emitted when the target bond amount is changed\\n /// @param _targetBond The target bond amount\\n event TargetBondChange(uint256 _targetBond);\\n\\n /// @notice Emitted when the Keep3r V2 address is changed\\n /// @param _keep3rV2 The address of Keep3r V2\\n event Keep3rV2Change(address _keep3rV2);\\n\\n /// @notice Emitted when the work extra gas amount is changed\\n /// @param _workExtraGas The work extra gas\\n event WorkExtraGasChange(uint256 _workExtraGas);\\n\\n /// @notice Emitted when the quote twap time is changed\\n /// @param _quoteTwapTime The twap time for quoting\\n event QuoteTwapTimeChange(uint32 _quoteTwapTime);\\n\\n /// @notice Emitted when minimum rewarded gas fee is changed\\n /// @param _minBaseFee The minimum rewarded gas fee\\n event MinBaseFeeChange(uint256 _minBaseFee);\\n\\n /// @notice Emitted when minimum rewarded priority fee is changed\\n /// @param _minPriorityFee The minimum expected fee that the keeper should pay\\n event MinPriorityFeeChange(uint256 _minPriorityFee);\\n\\n // Variables\\n\\n /// @notice Address of KP3R token\\n /// @return _kp3r Address of KP3R token\\n // solhint-disable func-name-mixedcase\\n function KP3R() external view returns (address _kp3r);\\n\\n /// @notice The boost base used to calculate the boost rewards for the keeper\\n /// @return _base The boost base number\\n function BOOST_BASE() external view returns (uint256 _base);\\n\\n /// @notice KP3R-WETH pool that is being used as oracle\\n /// @return poolAddress Address of the pool\\n /// @return isKP3RToken0 True if calling the token0 method of the pool returns the KP3R token address\\n function kp3rWethPool() external view returns (address poolAddress, bool isKP3RToken0);\\n\\n /// @notice The minimum multiplier used to calculate the amount of gas paid to the Keeper for the gas used to perform a job\\n /// For example: if the quoted gas used is 1000, then the minimum amount to be paid will be 1000 * minBoost / BOOST_BASE\\n /// @return _multiplier The minimum boost multiplier\\n function minBoost() external view returns (uint256 _multiplier);\\n\\n /// @notice The maximum multiplier used to calculate the amount of gas paid to the Keeper for the gas used to perform a job\\n /// For example: if the quoted gas used is 1000, then the maximum amount to be paid will be 1000 * maxBoost / BOOST_BASE\\n /// @return _multiplier The maximum boost multiplier\\n function maxBoost() external view returns (uint256 _multiplier);\\n\\n /// @notice The targeted amount of bonded KP3Rs to max-up reward multiplier\\n /// For example: if the amount of KP3R the keeper has bonded is targetBond or more, then the keeper will get\\n /// the maximum boost possible in his rewards, if it's less, the reward boost will be proportional\\n /// @return _target The amount of KP3R that comforms the targetBond\\n function targetBond() external view returns (uint256 _target);\\n\\n /// @notice The amount of unaccounted gas that is going to be added to keeper payments\\n /// @return _workExtraGas The work unaccounted gas amount\\n function workExtraGas() external view returns (uint256 _workExtraGas);\\n\\n /// @notice The twap time for quoting\\n /// @return _quoteTwapTime The twap time\\n function quoteTwapTime() external view returns (uint32 _quoteTwapTime);\\n\\n /// @notice The minimum base fee that is used to calculate keeper rewards\\n /// @return _minBaseFee The minimum rewarded gas fee\\n function minBaseFee() external view returns (uint256 _minBaseFee);\\n\\n /// @notice The minimum priority fee that is also rewarded for keepers\\n /// @return _minPriorityFee The minimum rewarded priority fee\\n function minPriorityFee() external view returns (uint256 _minPriorityFee);\\n\\n /// @notice Address of Keep3r V2\\n /// @return _keep3rV2 Address of Keep3r V2\\n function keep3rV2() external view returns (address _keep3rV2);\\n\\n // Methods\\n\\n /// @notice Sets KP3R-WETH pool\\n /// @param _poolAddress The address of the KP3R-WETH pool\\n function setKp3rWethPool(address _poolAddress) external;\\n\\n /// @notice Sets the minimum boost multiplier\\n /// @param _minBoost The minimum boost multiplier\\n function setMinBoost(uint256 _minBoost) external;\\n\\n /// @notice Sets the maximum boost multiplier\\n /// @param _maxBoost The maximum boost multiplier\\n function setMaxBoost(uint256 _maxBoost) external;\\n\\n /// @notice Sets the target bond amount\\n /// @param _targetBond The target bond amount\\n function setTargetBond(uint256 _targetBond) external;\\n\\n /// @notice Sets the Keep3r V2 address\\n /// @param _keep3rV2 The address of Keep3r V2\\n function setKeep3rV2(address _keep3rV2) external;\\n\\n /// @notice Sets the work extra gas amount\\n /// @param _workExtraGas The work extra gas\\n function setWorkExtraGas(uint256 _workExtraGas) external;\\n\\n /// @notice Sets the quote twap time\\n /// @param _quoteTwapTime The twap time for quoting\\n function setQuoteTwapTime(uint32 _quoteTwapTime) external;\\n\\n /// @notice Sets the minimum rewarded gas fee\\n /// @param _minBaseFee The minimum rewarded gas fee\\n function setMinBaseFee(uint256 _minBaseFee) external;\\n\\n /// @notice Sets the minimum rewarded gas priority fee\\n /// @param _minPriorityFee The minimum rewarded priority fee\\n function setMinPriorityFee(uint256 _minPriorityFee) external;\\n}\\n\",\"keccak256\":\"0xc571e913c0e3c02f4aa0b27090ca1608c85c68768dc2ab979f8aef7c731f60b2\",\"license\":\"MIT\"},\"solidity/interfaces/IPairManager.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4 <0.9.0;\\n\\nimport '@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol';\\n\\n/// @title Pair Manager interface\\n/// @notice Generic interface for Keep3r liquidity pools (kLP)\\ninterface IPairManager is IERC20Metadata {\\n /// @notice Address of the factory from which the pair manager was created\\n /// @return _factory The address of the PairManager Factory\\n function factory() external view returns (address _factory);\\n\\n /// @notice Address of the pool from which the Keep3r pair manager will interact with\\n /// @return _pool The address of the pool\\n function pool() external view returns (address _pool);\\n\\n /// @notice Token0 of the pool\\n /// @return _token0 The address of token0\\n function token0() external view returns (address _token0);\\n\\n /// @notice Token1 of the pool\\n /// @return _token1 The address of token1\\n function token1() external view returns (address _token1);\\n}\\n\",\"keccak256\":\"0x345c312b340c5775fb8f68d89ce851c7f75522940bd9bc64f2301a3f8312636a\",\"license\":\"MIT\"},\"solidity/interfaces/external/IKeep3rV1.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4 <0.9.0;\\n\\nimport '@openzeppelin/contracts/token/ERC20/IERC20.sol';\\nimport '@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol';\\n\\n// solhint-disable func-name-mixedcase\\ninterface IKeep3rV1 is IERC20, IERC20Metadata {\\n // Structs\\n struct Checkpoint {\\n uint32 fromBlock;\\n uint256 votes;\\n }\\n\\n // Events\\n event DelegateChanged(address indexed _delegator, address indexed _fromDelegate, address indexed _toDelegate);\\n event DelegateVotesChanged(address indexed _delegate, uint256 _previousBalance, uint256 _newBalance);\\n event SubmitJob(address indexed _job, address indexed _liquidity, address indexed _provider, uint256 _block, uint256 _credit);\\n event ApplyCredit(address indexed _job, address indexed _liquidity, address indexed _provider, uint256 _block, uint256 _credit);\\n event RemoveJob(address indexed _job, address indexed _liquidity, address indexed _provider, uint256 _block, uint256 _credit);\\n event UnbondJob(address indexed _job, address indexed _liquidity, address indexed _provider, uint256 _block, uint256 _credit);\\n event JobAdded(address indexed _job, uint256 _block, address _governance);\\n event JobRemoved(address indexed _job, uint256 _block, address _governance);\\n event KeeperWorked(address indexed _credit, address indexed _job, address indexed _keeper, uint256 _block, uint256 _amount);\\n event KeeperBonding(address indexed _keeper, uint256 _block, uint256 _active, uint256 _bond);\\n event KeeperBonded(address indexed _keeper, uint256 _block, uint256 _activated, uint256 _bond);\\n event KeeperUnbonding(address indexed _keeper, uint256 _block, uint256 _deactive, uint256 _bond);\\n event KeeperUnbound(address indexed _keeper, uint256 _block, uint256 _deactivated, uint256 _bond);\\n event KeeperSlashed(address indexed _keeper, address indexed _slasher, uint256 _block, uint256 _slash);\\n event KeeperDispute(address indexed _keeper, uint256 _block);\\n event KeeperResolved(address indexed _keeper, uint256 _block);\\n event TokenCreditAddition(address indexed _credit, address indexed _job, address indexed _creditor, uint256 _block, uint256 _amount);\\n\\n // Variables\\n function KPRH() external returns (address);\\n\\n function delegates(address _delegator) external view returns (address);\\n\\n function checkpoints(address _account, uint32 _checkpoint) external view returns (Checkpoint memory);\\n\\n function numCheckpoints(address _account) external view returns (uint32);\\n\\n function DOMAIN_TYPEHASH() external returns (bytes32);\\n\\n function DOMAINSEPARATOR() external returns (bytes32);\\n\\n function DELEGATION_TYPEHASH() external returns (bytes32);\\n\\n function PERMIT_TYPEHASH() external returns (bytes32);\\n\\n function nonces(address _user) external view returns (uint256);\\n\\n function BOND() external returns (uint256);\\n\\n function UNBOND() external returns (uint256);\\n\\n function LIQUIDITYBOND() external returns (uint256);\\n\\n function FEE() external returns (uint256);\\n\\n function BASE() external returns (uint256);\\n\\n function ETH() external returns (address);\\n\\n function bondings(address _user, address _bonding) external view returns (uint256);\\n\\n function canWithdrawAfter(address _user, address _bonding) external view returns (uint256);\\n\\n function pendingUnbonds(address _keeper, address _bonding) external view returns (uint256);\\n\\n function pendingbonds(address _keeper, address _bonding) external view returns (uint256);\\n\\n function bonds(address _keeper, address _bonding) external view returns (uint256);\\n\\n function votes(address _delegator) external view returns (uint256);\\n\\n function firstSeen(address _keeper) external view returns (uint256);\\n\\n function disputes(address _keeper) external view returns (bool);\\n\\n function lastJob(address _keeper) external view returns (uint256);\\n\\n function workCompleted(address _keeper) external view returns (uint256);\\n\\n function jobs(address _job) external view returns (bool);\\n\\n function credits(address _job, address _credit) external view returns (uint256);\\n\\n function liquidityProvided(\\n address _provider,\\n address _liquidity,\\n address _job\\n ) external view returns (uint256);\\n\\n function liquidityUnbonding(\\n address _provider,\\n address _liquidity,\\n address _job\\n ) external view returns (uint256);\\n\\n function liquidityAmountsUnbonding(\\n address _provider,\\n address _liquidity,\\n address _job\\n ) external view returns (uint256);\\n\\n function jobProposalDelay(address _job) external view returns (uint256);\\n\\n function liquidityApplied(\\n address _provider,\\n address _liquidity,\\n address _job\\n ) external view returns (uint256);\\n\\n function liquidityAmount(\\n address _provider,\\n address _liquidity,\\n address _job\\n ) external view returns (uint256);\\n\\n function keepers(address _keeper) external view returns (bool);\\n\\n function blacklist(address _keeper) external view returns (bool);\\n\\n function keeperList(uint256 _index) external view returns (address);\\n\\n function jobList(uint256 _index) external view returns (address);\\n\\n function governance() external returns (address);\\n\\n function pendingGovernance() external returns (address);\\n\\n function liquidityAccepted(address _liquidity) external view returns (bool);\\n\\n function liquidityPairs(uint256 _index) external view returns (address);\\n\\n // Methods\\n function getCurrentVotes(address _account) external view returns (uint256);\\n\\n function addCreditETH(address _job) external payable;\\n\\n function addCredit(\\n address _credit,\\n address _job,\\n uint256 _amount\\n ) external;\\n\\n function addVotes(address _voter, uint256 _amount) external;\\n\\n function removeVotes(address _voter, uint256 _amount) external;\\n\\n function addKPRCredit(address _job, uint256 _amount) external;\\n\\n function approveLiquidity(address _liquidity) external;\\n\\n function revokeLiquidity(address _liquidity) external;\\n\\n function pairs() external view returns (address[] memory);\\n\\n function addLiquidityToJob(\\n address _liquidity,\\n address _job,\\n uint256 _amount\\n ) external;\\n\\n function applyCreditToJob(\\n address _provider,\\n address _liquidity,\\n address _job\\n ) external;\\n\\n function unbondLiquidityFromJob(\\n address _liquidity,\\n address _job,\\n uint256 _amount\\n ) external;\\n\\n function removeLiquidityFromJob(address _liquidity, address _job) external;\\n\\n function mint(uint256 _amount) external;\\n\\n function burn(uint256 _amount) external;\\n\\n function worked(address _keeper) external;\\n\\n function receipt(\\n address _credit,\\n address _keeper,\\n uint256 _amount\\n ) external;\\n\\n function receiptETH(address _keeper, uint256 _amount) external;\\n\\n function addJob(address _job) external;\\n\\n function getJobs() external view returns (address[] memory);\\n\\n function removeJob(address _job) external;\\n\\n function setKeep3rHelper(address _keep3rHelper) external;\\n\\n function setGovernance(address _governance) external;\\n\\n function acceptGovernance() external;\\n\\n function isKeeper(address _keeper) external returns (bool);\\n\\n function isMinKeeper(\\n address _keeper,\\n uint256 _minBond,\\n uint256 _earned,\\n uint256 _age\\n ) external returns (bool);\\n\\n function isBondedKeeper(\\n address _keeper,\\n address _bond,\\n uint256 _minBond,\\n uint256 _earned,\\n uint256 _age\\n ) external returns (bool);\\n\\n function bond(address _bonding, uint256 _amount) external;\\n\\n function getKeepers() external view returns (address[] memory);\\n\\n function activate(address _bonding) external;\\n\\n function unbond(address _bonding, uint256 _amount) external;\\n\\n function slash(\\n address _bonded,\\n address _keeper,\\n uint256 _amount\\n ) external;\\n\\n function withdraw(address _bonding) external;\\n\\n function dispute(address _keeper) external;\\n\\n function revoke(address _keeper) external;\\n\\n function resolve(address _keeper) external;\\n\\n function permit(\\n address _owner,\\n address _spender,\\n uint256 _amount,\\n uint256 _deadline,\\n uint8 _v,\\n bytes32 _r,\\n bytes32 _s\\n ) external;\\n}\\n\",\"keccak256\":\"0xa9806cd6666ab1b7375ef72446964a72397fd4cefc7cc8c5b37caa7c50df0246\",\"license\":\"MIT\"},\"solidity/interfaces/external/IKeep3rV1Proxy.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4 <0.9.0;\\n\\nimport '@defi-wonderland/solidity-utils/solidity/interfaces/IBaseErrors.sol';\\n\\ninterface IKeep3rV1Proxy is IBaseErrors {\\n // Structs\\n struct Recipient {\\n address recipient;\\n uint256 caps;\\n }\\n\\n // Variables\\n function keep3rV1() external view returns (address);\\n\\n function governance() external view returns (address);\\n\\n function pendingGovernance() external view returns (address);\\n\\n function minter() external view returns (address);\\n\\n function next(address) external view returns (uint256);\\n\\n function caps(address) external view returns (uint256);\\n\\n function recipients() external view returns (address[] memory);\\n\\n function recipientsCaps() external view returns (Recipient[] memory);\\n\\n // Errors\\n error Cooldown();\\n error NoDrawableAmount();\\n error OnlyMinter();\\n error OnlyGovernance();\\n error OnlyPendingGovernance();\\n\\n // Methods\\n function addRecipient(address recipient, uint256 amount) external;\\n\\n function removeRecipient(address recipient) external;\\n\\n function draw() external returns (uint256 _amount);\\n\\n function setKeep3rV1(address _keep3rV1) external;\\n\\n function setMinter(address _minter) external;\\n\\n function mint(uint256 _amount) external;\\n\\n function mint(address _account, uint256 _amount) external;\\n\\n function setGovernance(address _governance) external;\\n\\n function acceptGovernance() external;\\n\\n function setKeep3rV1Governance(address _governance) external;\\n\\n function acceptKeep3rV1Governance() external;\\n\\n function dispute(address _keeper) external;\\n\\n function slash(\\n address _bonded,\\n address _keeper,\\n uint256 _amount\\n ) external;\\n\\n function revoke(address _keeper) external;\\n\\n function resolve(address _keeper) external;\\n\\n function addJob(address _job) external;\\n\\n function removeJob(address _job) external;\\n\\n function addKPRCredit(address _job, uint256 _amount) external;\\n\\n function approveLiquidity(address _liquidity) external;\\n\\n function revokeLiquidity(address _liquidity) external;\\n\\n function setKeep3rHelper(address _keep3rHelper) external;\\n\\n function addVotes(address _voter, uint256 _amount) external;\\n\\n function removeVotes(address _voter, uint256 _amount) external;\\n}\\n\",\"keccak256\":\"0x8d00752ec08a8e550cbcccd7c1032a4cb95e58cdfa9f977cf7f1e00b637f0d95\",\"license\":\"MIT\"},\"solidity/interfaces/peripherals/IKeep3rAccountance.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4 <0.9.0;\\n\\nimport './IKeep3rRoles.sol';\\n\\n/// @title Keep3rDisputable contract\\n/// @notice Disputes keepers, or if they're already disputed, it can resolve the case\\n/// @dev Argument `bonding` can be the address of either a token or a liquidity\\ninterface IKeep3rAccountance is IKeep3rRoles {\\n // Events\\n\\n /// @notice Emitted when the bonding process of a new keeper begins\\n /// @param _keeper The caller of Keep3rKeeperFundable#bond function\\n /// @param _bonding The asset the keeper has bonded\\n /// @param _amount The amount the keeper has bonded\\n event Bonding(address indexed _keeper, address indexed _bonding, uint256 _amount);\\n\\n /// @notice Emitted when a keeper or job begins the unbonding process to withdraw the funds\\n /// @param _keeperOrJob The keeper or job that began the unbonding process\\n /// @param _unbonding The liquidity pair or asset being unbonded\\n /// @param _amount The amount being unbonded\\n event Unbonding(address indexed _keeperOrJob, address indexed _unbonding, uint256 _amount);\\n\\n // Variables\\n\\n /// @notice Tracks the total amount of bonded KP3Rs in the contract\\n /// @return _totalBonds The total amount of bonded KP3Rs in the contract\\n function totalBonds() external view returns (uint256 _totalBonds);\\n\\n /// @notice Tracks the total KP3R earnings of a keeper since it started working\\n /// @param _keeper The address of the keeper\\n /// @return _workCompleted Total KP3R earnings of a keeper since it started working\\n function workCompleted(address _keeper) external view returns (uint256 _workCompleted);\\n\\n /// @notice Tracks when a keeper was first registered\\n /// @param _keeper The address of the keeper\\n /// @return timestamp The time at which the keeper was first registered\\n function firstSeen(address _keeper) external view returns (uint256 timestamp);\\n\\n /// @notice Tracks if a keeper or job has a pending dispute\\n /// @param _keeperOrJob The address of the keeper or job\\n /// @return _disputed Whether a keeper or job has a pending dispute\\n function disputes(address _keeperOrJob) external view returns (bool _disputed);\\n\\n /// @notice Tracks how much a keeper has bonded of a certain token\\n /// @param _keeper The address of the keeper\\n /// @param _bond The address of the token being bonded\\n /// @return _bonds Amount of a certain token that a keeper has bonded\\n function bonds(address _keeper, address _bond) external view returns (uint256 _bonds);\\n\\n /// @notice The current token credits available for a job\\n /// @param _job The address of the job\\n /// @param _token The address of the token bonded\\n /// @return _amount The amount of token credits available for a job\\n function jobTokenCredits(address _job, address _token) external view returns (uint256 _amount);\\n\\n /// @notice Tracks the amount of assets deposited in pending bonds\\n /// @param _keeper The address of the keeper\\n /// @param _bonding The address of the token being bonded\\n /// @return _pendingBonds Amount of a certain asset a keeper has unbonding\\n function pendingBonds(address _keeper, address _bonding) external view returns (uint256 _pendingBonds);\\n\\n /// @notice Tracks when a bonding for a keeper can be activated\\n /// @param _keeper The address of the keeper\\n /// @param _bonding The address of the token being bonded\\n /// @return _timestamp Time at which the bonding for a keeper can be activated\\n function canActivateAfter(address _keeper, address _bonding) external view returns (uint256 _timestamp);\\n\\n /// @notice Tracks when keeper bonds are ready to be withdrawn\\n /// @param _keeper The address of the keeper\\n /// @param _bonding The address of the token being unbonded\\n /// @return _timestamp Time at which the keeper bonds are ready to be withdrawn\\n function canWithdrawAfter(address _keeper, address _bonding) external view returns (uint256 _timestamp);\\n\\n /// @notice Tracks how much keeper bonds are to be withdrawn\\n /// @param _keeper The address of the keeper\\n /// @param _bonding The address of the token being unbonded\\n /// @return _pendingUnbonds The amount of keeper bonds that are to be withdrawn\\n function pendingUnbonds(address _keeper, address _bonding) external view returns (uint256 _pendingUnbonds);\\n\\n /// @notice Checks whether the address has ever bonded an asset\\n /// @param _keeper The address of the keeper\\n /// @return _hasBonded Whether the address has ever bonded an asset\\n function hasBonded(address _keeper) external view returns (bool _hasBonded);\\n\\n // Methods\\n\\n /// @notice Lists all jobs\\n /// @return _jobList Array with all the jobs in _jobs\\n function jobs() external view returns (address[] memory _jobList);\\n\\n /// @notice Lists all keepers\\n /// @return _keeperList Array with all the keepers in _keepers\\n function keepers() external view returns (address[] memory _keeperList);\\n\\n // Errors\\n\\n /// @notice Throws when an address is passed as a job, but that address is not a job\\n error JobUnavailable();\\n\\n /// @notice Throws when an action that requires an undisputed job is applied on a disputed job\\n error JobDisputed();\\n}\\n\",\"keccak256\":\"0xf4748c236ddf409e45e7169c735e2fc54e627b2b3ccd189ebb438ad768f1deb1\",\"license\":\"MIT\"},\"solidity/interfaces/peripherals/IKeep3rDisputable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4 <0.9.0;\\n\\n/// @title Keep3rDisputable contract\\n/// @notice Creates/resolves disputes for jobs or keepers\\n/// A disputed keeper is slashable and is not able to bond, activate, withdraw or receive direct payments\\n/// A disputed job is slashable and is not able to pay the keepers, withdraw tokens or to migrate\\ninterface IKeep3rDisputable {\\n /// @notice Emitted when a keeper or a job is disputed\\n /// @param _jobOrKeeper The address of the disputed keeper/job\\n /// @param _disputer The user that called the function and disputed the keeper\\n event Dispute(address indexed _jobOrKeeper, address indexed _disputer);\\n\\n /// @notice Emitted when a dispute is resolved\\n /// @param _jobOrKeeper The address of the disputed keeper/job\\n /// @param _resolver The user that called the function and resolved the dispute\\n event Resolve(address indexed _jobOrKeeper, address indexed _resolver);\\n\\n /// @notice Throws when a job or keeper is already disputed\\n error AlreadyDisputed();\\n\\n /// @notice Throws when a job or keeper is not disputed and someone tries to resolve the dispute\\n error NotDisputed();\\n\\n /// @notice Allows governor to create a dispute for a given keeper/job\\n /// @param _jobOrKeeper The address in dispute\\n function dispute(address _jobOrKeeper) external;\\n\\n /// @notice Allows governor to resolve a dispute on a keeper/job\\n /// @param _jobOrKeeper The address cleared\\n function resolve(address _jobOrKeeper) external;\\n}\\n\",\"keccak256\":\"0xdfdabcecbed06fcb2eb1b80e6a61d681afecd1f75c58a888451de7927b10c3b2\",\"license\":\"MIT\"},\"solidity/interfaces/peripherals/IKeep3rJobs.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4 <0.9.0;\\n\\nimport './IKeep3rDisputable.sol';\\n\\n/// @title Keep3rJobOwnership contract\\n/// @notice Handles the ownership of the jobs\\ninterface IKeep3rJobOwnership {\\n // Events\\n\\n /// @notice Emitted when Keep3rJobOwnership#changeJobOwnership is called\\n /// @param _job The address of the job proposed to have a change of owner\\n /// @param _owner The current owner of the job\\n /// @param _pendingOwner The new address proposed to be the owner of the job\\n event JobOwnershipChange(address indexed _job, address indexed _owner, address indexed _pendingOwner);\\n\\n /// @notice Emitted when Keep3rJobOwnership#JobOwnershipAssent is called\\n /// @param _job The address of the job which the proposed owner will now own\\n /// @param _previousOwner The previous owner of the job\\n /// @param _newOwner The new owner of the job\\n event JobOwnershipAssent(address indexed _job, address indexed _previousOwner, address indexed _newOwner);\\n\\n // Errors\\n\\n /// @notice Throws when the caller of the function is not the job owner\\n error OnlyJobOwner();\\n\\n /// @notice Throws when the caller of the function is not the pending job owner\\n error OnlyPendingJobOwner();\\n\\n // Variables\\n\\n /// @notice Maps the job to the owner of the job\\n /// @param _job The address of the job\\n /// @return _owner The address of the owner of the job\\n function jobOwner(address _job) external view returns (address _owner);\\n\\n /// @notice Maps the job to its pending owner\\n /// @param _job The address of the job\\n /// @return _pendingOwner The address of the pending owner of the job\\n function jobPendingOwner(address _job) external view returns (address _pendingOwner);\\n\\n // Methods\\n\\n /// @notice Proposes a new address to be the owner of the job\\n /// @param _job The address of the job\\n /// @param _newOwner The address of the proposed new owner\\n function changeJobOwnership(address _job, address _newOwner) external;\\n\\n /// @notice The proposed address accepts to be the owner of the job\\n /// @param _job The address of the job\\n function acceptJobOwnership(address _job) external;\\n}\\n\\n/// @title Keep3rJobManager contract\\n/// @notice Handles the addition and withdrawal of credits from a job\\ninterface IKeep3rJobManager is IKeep3rJobOwnership {\\n // Events\\n\\n /// @notice Emitted when Keep3rJobManager#addJob is called\\n /// @param _job The address of the job to add\\n /// @param _jobOwner The job's owner\\n event JobAddition(address indexed _job, address indexed _jobOwner);\\n\\n // Errors\\n\\n /// @notice Throws when trying to add a job that has already been added\\n error JobAlreadyAdded();\\n\\n /// @notice Throws when the address that is trying to register as a keeper is already a keeper\\n error AlreadyAKeeper();\\n\\n // Methods\\n\\n /// @notice Allows any caller to add a new job\\n /// @param _job Address of the contract for which work should be performed\\n function addJob(address _job) external;\\n}\\n\\n/// @title Keep3rJobFundableCredits contract\\n/// @notice Handles the addition and withdrawal of credits from a job\\ninterface IKeep3rJobFundableCredits is IKeep3rJobOwnership {\\n // Events\\n\\n /// @notice Emitted when Keep3rJobFundableCredits#addTokenCreditsToJob is called\\n /// @param _job The address of the job being credited\\n /// @param _token The address of the token being provided\\n /// @param _provider The user that calls the function\\n /// @param _amount The amount of credit being added to the job\\n event TokenCreditAddition(address indexed _job, address indexed _token, address indexed _provider, uint256 _amount);\\n\\n /// @notice Emitted when Keep3rJobFundableCredits#withdrawTokenCreditsFromJob is called\\n /// @param _job The address of the job from which the credits are withdrawn\\n /// @param _token The credit being withdrawn from the job\\n /// @param _receiver The user that receives the tokens\\n /// @param _amount The amount of credit withdrawn\\n event TokenCreditWithdrawal(address indexed _job, address indexed _token, address indexed _receiver, uint256 _amount);\\n\\n // Errors\\n\\n /// @notice Throws when the token is KP3R, as it should not be used for direct token payments\\n error TokenUnallowed();\\n\\n /// @notice Throws when the token withdraw cooldown has not yet passed\\n error JobTokenCreditsLocked();\\n\\n /// @notice Throws when the user tries to withdraw more tokens than it has\\n error InsufficientJobTokenCredits();\\n\\n // Variables\\n\\n /// @notice Last block where tokens were added to the job\\n /// @param _job The address of the job credited\\n /// @param _token The address of the token credited\\n /// @return _timestamp The last block where tokens were added to the job\\n function jobTokenCreditsAddedAt(address _job, address _token) external view returns (uint256 _timestamp);\\n\\n // Methods\\n\\n /// @notice Add credit to a job to be paid out for work\\n /// @param _job The address of the job being credited\\n /// @param _token The address of the token being credited\\n /// @param _amount The amount of credit being added\\n function addTokenCreditsToJob(\\n address _job,\\n address _token,\\n uint256 _amount\\n ) external;\\n\\n /// @notice Withdraw credit from a job\\n /// @param _job The address of the job from which the credits are withdrawn\\n /// @param _token The address of the token being withdrawn\\n /// @param _amount The amount of token to be withdrawn\\n /// @param _receiver The user that will receive tokens\\n function withdrawTokenCreditsFromJob(\\n address _job,\\n address _token,\\n uint256 _amount,\\n address _receiver\\n ) external;\\n}\\n\\n/// @title Keep3rJobFundableLiquidity contract\\n/// @notice Handles the funding of jobs through specific liquidity pairs\\ninterface IKeep3rJobFundableLiquidity is IKeep3rJobOwnership {\\n // Events\\n\\n /// @notice Emitted when Keep3rJobFundableLiquidity#approveLiquidity function is called\\n /// @param _liquidity The address of the liquidity pair being approved\\n event LiquidityApproval(address _liquidity);\\n\\n /// @notice Emitted when Keep3rJobFundableLiquidity#revokeLiquidity function is called\\n /// @param _liquidity The address of the liquidity pair being revoked\\n event LiquidityRevocation(address _liquidity);\\n\\n /// @notice Emitted when IKeep3rJobFundableLiquidity#addLiquidityToJob function is called\\n /// @param _job The address of the job to which liquidity will be added\\n /// @param _liquidity The address of the liquidity being added\\n /// @param _provider The user that calls the function\\n /// @param _amount The amount of liquidity being added\\n event LiquidityAddition(address indexed _job, address indexed _liquidity, address indexed _provider, uint256 _amount);\\n\\n /// @notice Emitted when IKeep3rJobFundableLiquidity#withdrawLiquidityFromJob function is called\\n /// @param _job The address of the job of which liquidity will be withdrawn from\\n /// @param _liquidity The address of the liquidity being withdrawn\\n /// @param _receiver The receiver of the liquidity tokens\\n /// @param _amount The amount of liquidity being withdrawn from the job\\n event LiquidityWithdrawal(address indexed _job, address indexed _liquidity, address indexed _receiver, uint256 _amount);\\n\\n /// @notice Emitted when Keep3rJobFundableLiquidity#addLiquidityToJob function is called\\n /// @param _job The address of the job whose credits will be updated\\n /// @param _rewardedAt The time at which the job was last rewarded\\n /// @param _currentCredits The current credits of the job\\n /// @param _periodCredits The credits of the job for the current period\\n event LiquidityCreditsReward(address indexed _job, uint256 _rewardedAt, uint256 _currentCredits, uint256 _periodCredits);\\n\\n /// @notice Emitted when Keep3rJobFundableLiquidity#forceLiquidityCreditsToJob function is called\\n /// @param _job The address of the job whose credits will be updated\\n /// @param _rewardedAt The time at which the job was last rewarded\\n /// @param _currentCredits The current credits of the job\\n event LiquidityCreditsForced(address indexed _job, uint256 _rewardedAt, uint256 _currentCredits);\\n\\n // Errors\\n\\n /// @notice Throws when the liquidity being approved has already been approved\\n error LiquidityPairApproved();\\n\\n /// @notice Throws when the liquidity being removed has not been approved\\n error LiquidityPairUnexistent();\\n\\n /// @notice Throws when trying to add liquidity to an unapproved pool\\n error LiquidityPairUnapproved();\\n\\n /// @notice Throws when the job doesn't have the requested liquidity\\n error JobLiquidityUnexistent();\\n\\n /// @notice Throws when trying to remove more liquidity than the job has\\n error JobLiquidityInsufficient();\\n\\n /// @notice Throws when trying to add less liquidity than the minimum liquidity required\\n error JobLiquidityLessThanMin();\\n\\n // Structs\\n\\n /// @notice Stores the tick information of the different liquidity pairs\\n struct TickCache {\\n int56 current; // Tracks the current tick\\n int56 difference; // Stores the difference between the current tick and the last tick\\n uint256 period; // Stores the period at which the last observation was made\\n }\\n\\n // Variables\\n\\n /// @notice Lists liquidity pairs\\n /// @return _list An array of addresses with all the approved liquidity pairs\\n function approvedLiquidities() external view returns (address[] memory _list);\\n\\n /// @notice Amount of liquidity in a specified job\\n /// @param _job The address of the job being checked\\n /// @param _liquidity The address of the liquidity we are checking\\n /// @return _amount Amount of liquidity in the specified job\\n function liquidityAmount(address _job, address _liquidity) external view returns (uint256 _amount);\\n\\n /// @notice Last time the job was rewarded liquidity credits\\n /// @param _job The address of the job being checked\\n /// @return _timestamp Timestamp of the last time the job was rewarded liquidity credits\\n function rewardedAt(address _job) external view returns (uint256 _timestamp);\\n\\n /// @notice Last time the job was worked\\n /// @param _job The address of the job being checked\\n /// @return _timestamp Timestamp of the last time the job was worked\\n function workedAt(address _job) external view returns (uint256 _timestamp);\\n\\n // Methods\\n\\n /// @notice Returns the liquidity credits of a given job\\n /// @param _job The address of the job of which we want to know the liquidity credits\\n /// @return _amount The liquidity credits of a given job\\n function jobLiquidityCredits(address _job) external view returns (uint256 _amount);\\n\\n /// @notice Returns the credits of a given job for the current period\\n /// @param _job The address of the job of which we want to know the period credits\\n /// @return _amount The credits the given job has at the current period\\n function jobPeriodCredits(address _job) external view returns (uint256 _amount);\\n\\n /// @notice Calculates the total credits of a given job\\n /// @param _job The address of the job of which we want to know the total credits\\n /// @return _amount The total credits of the given job\\n function totalJobCredits(address _job) external view returns (uint256 _amount);\\n\\n /// @notice Calculates how many credits should be rewarded periodically for a given liquidity amount\\n /// @dev _periodCredits = underlying KP3Rs for given liquidity amount * rewardPeriod / inflationPeriod\\n /// @param _liquidity The address of the liquidity to provide\\n /// @param _amount The amount of liquidity to provide\\n /// @return _periodCredits The amount of KP3R periodically minted for the given liquidity\\n function quoteLiquidity(address _liquidity, uint256 _amount) external view returns (uint256 _periodCredits);\\n\\n /// @notice Observes the current state of the liquidity pair being observed and updates TickCache with the information\\n /// @param _liquidity The address of the liquidity pair being observed\\n /// @return _tickCache The updated TickCache\\n function observeLiquidity(address _liquidity) external view returns (TickCache memory _tickCache);\\n\\n /// @notice Gifts liquidity credits to the specified job\\n /// @param _job The address of the job being credited\\n /// @param _amount The amount of liquidity credits to gift\\n function forceLiquidityCreditsToJob(address _job, uint256 _amount) external;\\n\\n /// @notice Approve a liquidity pair for being accepted in future\\n /// @param _liquidity The address of the liquidity accepted\\n function approveLiquidity(address _liquidity) external;\\n\\n /// @notice Revoke a liquidity pair from being accepted in future\\n /// @param _liquidity The liquidity no longer accepted\\n function revokeLiquidity(address _liquidity) external;\\n\\n /// @notice Allows anyone to fund a job with liquidity\\n /// @param _job The address of the job to assign liquidity to\\n /// @param _liquidity The liquidity being added\\n /// @param _amount The amount of liquidity tokens to add\\n function addLiquidityToJob(\\n address _job,\\n address _liquidity,\\n uint256 _amount\\n ) external;\\n\\n /// @notice Unbond liquidity for a job\\n /// @dev Can only be called by the job's owner\\n /// @param _job The address of the job being unbonded from\\n /// @param _liquidity The liquidity being unbonded\\n /// @param _amount The amount of liquidity being removed\\n function unbondLiquidityFromJob(\\n address _job,\\n address _liquidity,\\n uint256 _amount\\n ) external;\\n\\n /// @notice Withdraw liquidity from a job\\n /// @param _job The address of the job being withdrawn from\\n /// @param _liquidity The liquidity being withdrawn\\n /// @param _receiver The address that will receive the withdrawn liquidity\\n function withdrawLiquidityFromJob(\\n address _job,\\n address _liquidity,\\n address _receiver\\n ) external;\\n}\\n\\n/// @title Keep3rJobMigration contract\\n/// @notice Handles the migration process of jobs to different addresses\\ninterface IKeep3rJobMigration is IKeep3rJobFundableCredits, IKeep3rJobFundableLiquidity {\\n // Events\\n\\n /// @notice Emitted when Keep3rJobMigration#migrateJob function is called\\n /// @param _fromJob The address of the job that requests to migrate\\n /// @param _toJob The address at which the job requests to migrate\\n event JobMigrationRequested(address indexed _fromJob, address _toJob);\\n\\n /// @notice Emitted when Keep3rJobMigration#acceptJobMigration function is called\\n /// @param _fromJob The address of the job that requested to migrate\\n /// @param _toJob The address at which the job had requested to migrate\\n event JobMigrationSuccessful(address _fromJob, address indexed _toJob);\\n\\n // Errors\\n\\n /// @notice Throws when the address of the job that requests to migrate wants to migrate to its same address\\n error JobMigrationImpossible();\\n\\n /// @notice Throws when the _toJob address differs from the address being tracked in the pendingJobMigrations mapping\\n error JobMigrationUnavailable();\\n\\n /// @notice Throws when cooldown between migrations has not yet passed\\n error JobMigrationLocked();\\n\\n // Variables\\n\\n /// @notice Maps the jobs that have requested a migration to the address they have requested to migrate to\\n /// @return _toJob The address to which the job has requested to migrate to\\n function pendingJobMigrations(address _fromJob) external view returns (address _toJob);\\n\\n // Methods\\n\\n /// @notice Initializes the migration process for a job by adding the request to the pendingJobMigrations mapping\\n /// @param _fromJob The address of the job that is requesting to migrate\\n /// @param _toJob The address at which the job is requesting to migrate\\n function migrateJob(address _fromJob, address _toJob) external;\\n\\n /// @notice Completes the migration process for a job\\n /// @dev Unbond/withdraw process doesn't get migrated\\n /// @param _fromJob The address of the job that requested to migrate\\n /// @param _toJob The address to which the job wants to migrate to\\n function acceptJobMigration(address _fromJob, address _toJob) external;\\n}\\n\\n/// @title Keep3rJobWorkable contract\\n/// @notice Handles the mechanisms jobs can pay keepers with along with the restrictions jobs can put on keepers before they can work on jobs\\ninterface IKeep3rJobWorkable is IKeep3rJobMigration {\\n // Events\\n\\n /// @notice Emitted when a keeper is validated before a job\\n /// @param _gasLeft The amount of gas that the transaction has left at the moment of keeper validation\\n event KeeperValidation(uint256 _gasLeft);\\n\\n /// @notice Emitted when a keeper works a job\\n /// @param _credit The address of the asset in which the keeper is paid\\n /// @param _job The address of the job the keeper has worked\\n /// @param _keeper The address of the keeper that has worked the job\\n /// @param _payment The amount that has been paid out to the keeper in exchange for working the job\\n /// @param _gasLeft The amount of gas that the transaction has left at the moment of payment\\n event KeeperWork(address indexed _credit, address indexed _job, address indexed _keeper, uint256 _payment, uint256 _gasLeft);\\n\\n // Errors\\n\\n /// @notice Throws if work method was called without calling isKeeper or isBondedKeeper\\n error GasNotInitialized();\\n\\n /// @notice Throws if the address claiming to be a job is not in the list of approved jobs\\n error JobUnapproved();\\n\\n /// @notice Throws if the amount of funds in the job is less than the payment that must be paid to the keeper that works that job\\n error InsufficientFunds();\\n\\n // Methods\\n\\n /// @notice Confirms if the current keeper is registered\\n /// @dev Can be used for general (non critical) functions\\n /// @param _keeper The keeper being investigated\\n /// @return _isKeeper Whether the address passed as a parameter is a keeper or not\\n function isKeeper(address _keeper) external returns (bool _isKeeper);\\n\\n /// @notice Confirms if the current keeper is registered and has a minimum bond of any asset.\\n /// @dev Should be used for protected functions\\n /// @param _keeper The keeper to check\\n /// @param _bond The bond token being evaluated\\n /// @param _minBond The minimum amount of bonded tokens\\n /// @param _earned The minimum funds earned in the keepers lifetime\\n /// @param _age The minimum keeper age required\\n /// @return _isBondedKeeper Whether the `_keeper` meets the given requirements\\n function isBondedKeeper(\\n address _keeper,\\n address _bond,\\n uint256 _minBond,\\n uint256 _earned,\\n uint256 _age\\n ) external returns (bool _isBondedKeeper);\\n\\n /// @notice Implemented by jobs to show that a keeper performed work\\n /// @dev Automatically calculates the payment for the keeper and pays the keeper with bonded KP3R\\n /// @param _keeper Address of the keeper that performed the work\\n function worked(address _keeper) external;\\n\\n /// @notice Implemented by jobs to show that a keeper performed work\\n /// @dev Pays the keeper that performs the work with KP3R\\n /// @param _keeper Address of the keeper that performed the work\\n /// @param _payment The reward that should be allocated for the job\\n function bondedPayment(address _keeper, uint256 _payment) external;\\n\\n /// @notice Implemented by jobs to show that a keeper performed work\\n /// @dev Pays the keeper that performs the work with a specific token\\n /// @param _token The asset being awarded to the keeper\\n /// @param _keeper Address of the keeper that performed the work\\n /// @param _amount The reward that should be allocated\\n function directTokenPayment(\\n address _token,\\n address _keeper,\\n uint256 _amount\\n ) external;\\n}\\n\\n/// @title Keep3rJobDisputable contract\\n/// @notice Handles the actions that can be taken on a disputed job\\ninterface IKeep3rJobDisputable is IKeep3rDisputable, IKeep3rJobFundableCredits, IKeep3rJobFundableLiquidity {\\n // Events\\n\\n /// @notice Emitted when Keep3rJobDisputable#slashTokenFromJob is called\\n /// @param _job The address of the job from which the token will be slashed\\n /// @param _token The address of the token being slashed\\n /// @param _slasher The user that slashes the token\\n /// @param _amount The amount of the token being slashed\\n event JobSlashToken(address indexed _job, address _token, address indexed _slasher, uint256 _amount);\\n\\n /// @notice Emitted when Keep3rJobDisputable#slashLiquidityFromJob is called\\n /// @param _job The address of the job from which the liquidity will be slashed\\n /// @param _liquidity The address of the liquidity being slashed\\n /// @param _slasher The user that slashes the liquidity\\n /// @param _amount The amount of the liquidity being slashed\\n event JobSlashLiquidity(address indexed _job, address _liquidity, address indexed _slasher, uint256 _amount);\\n\\n // Errors\\n\\n /// @notice Throws when the token trying to be slashed doesn't exist\\n error JobTokenUnexistent();\\n\\n /// @notice Throws when someone tries to slash more tokens than the job has\\n error JobTokenInsufficient();\\n\\n // Methods\\n\\n /// @notice Allows governor or slasher to slash a job specific token\\n /// @param _job The address of the job from which the token will be slashed\\n /// @param _token The address of the token that will be slashed\\n /// @param _amount The amount of the token that will be slashed\\n function slashTokenFromJob(\\n address _job,\\n address _token,\\n uint256 _amount\\n ) external;\\n\\n /// @notice Allows governor or slasher to slash liquidity from a job\\n /// @param _job The address being slashed\\n /// @param _liquidity The address of the liquidity that will be slashed\\n /// @param _amount The amount of liquidity that will be slashed\\n function slashLiquidityFromJob(\\n address _job,\\n address _liquidity,\\n uint256 _amount\\n ) external;\\n}\\n\\n// solhint-disable-next-line no-empty-blocks\\ninterface IKeep3rJobs is IKeep3rJobWorkable, IKeep3rJobManager, IKeep3rJobDisputable {\\n\\n}\\n\",\"keccak256\":\"0x7fb7153d88e9e65d28b278320884517d6b423b2e8cfc78ee0ee16bc04073278e\",\"license\":\"MIT\"},\"solidity/interfaces/peripherals/IKeep3rKeepers.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4 <0.9.0;\\n\\nimport './IKeep3rDisputable.sol';\\n\\n/// @title Keep3rKeeperFundable contract\\n/// @notice Handles the actions required to become a keeper\\ninterface IKeep3rKeeperFundable {\\n // Events\\n\\n /// @notice Emitted when Keep3rKeeperFundable#activate is called\\n /// @param _keeper The keeper that has been activated\\n /// @param _bond The asset the keeper has bonded\\n /// @param _amount The amount of the asset the keeper has bonded\\n event Activation(address indexed _keeper, address indexed _bond, uint256 _amount);\\n\\n /// @notice Emitted when Keep3rKeeperFundable#withdraw is called\\n /// @param _keeper The caller of Keep3rKeeperFundable#withdraw function\\n /// @param _bond The asset to withdraw from the bonding pool\\n /// @param _amount The amount of funds withdrawn\\n event Withdrawal(address indexed _keeper, address indexed _bond, uint256 _amount);\\n\\n // Errors\\n\\n /// @notice Throws when the address that is trying to register as a job is already a job\\n error AlreadyAJob();\\n\\n // Methods\\n\\n /// @notice Beginning of the bonding process\\n /// @param _bonding The asset being bonded\\n /// @param _amount The amount of bonding asset being bonded\\n function bond(address _bonding, uint256 _amount) external;\\n\\n /// @notice Beginning of the unbonding process\\n /// @param _bonding The asset being unbonded\\n /// @param _amount Allows for partial unbonding\\n function unbond(address _bonding, uint256 _amount) external;\\n\\n /// @notice End of the bonding process after bonding time has passed\\n /// @param _bonding The asset being activated as bond collateral\\n function activate(address _bonding) external;\\n\\n /// @notice Withdraw funds after unbonding has finished\\n /// @param _bonding The asset to withdraw from the bonding pool\\n function withdraw(address _bonding) external;\\n}\\n\\n/// @title Keep3rKeeperDisputable contract\\n/// @notice Handles the actions that can be taken on a disputed keeper\\ninterface IKeep3rKeeperDisputable is IKeep3rDisputable, IKeep3rKeeperFundable {\\n // Events\\n\\n /// @notice Emitted when Keep3rKeeperDisputable#slash is called\\n /// @param _keeper The address of the slashed keeper\\n /// @param _slasher The user that called Keep3rKeeperDisputable#slash\\n /// @param _amount The amount of credits slashed from the keeper\\n event KeeperSlash(address indexed _keeper, address indexed _slasher, uint256 _amount);\\n\\n /// @notice Emitted when Keep3rKeeperDisputable#revoke is called\\n /// @param _keeper The address of the revoked keeper\\n /// @param _slasher The user that called Keep3rKeeperDisputable#revoke\\n event KeeperRevoke(address indexed _keeper, address indexed _slasher);\\n\\n // Methods\\n\\n /// @notice Allows governor to slash a keeper based on a dispute\\n /// @param _keeper The address being slashed\\n /// @param _bonded The asset being slashed\\n /// @param _bondAmount The bonded amount being slashed\\n /// @param _unbondAmount The pending unbond amount being slashed\\n function slash(\\n address _keeper,\\n address _bonded,\\n uint256 _bondAmount,\\n uint256 _unbondAmount\\n ) external;\\n\\n /// @notice Blacklists a keeper from participating in the network\\n /// @param _keeper The address being slashed\\n function revoke(address _keeper) external;\\n}\\n\\n// solhint-disable-next-line no-empty-blocks\\n\\n/// @title Keep3rKeepers contract\\ninterface IKeep3rKeepers is IKeep3rKeeperDisputable {\\n\\n}\\n\",\"keccak256\":\"0x8fe10565035bb918b2b1c7d730533bcfe9ec79078f28544852f8178e76302562\",\"license\":\"MIT\"},\"solidity/interfaces/peripherals/IKeep3rParameters.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4 <0.9.0;\\n\\nimport './IKeep3rAccountance.sol';\\n\\n/// @title Keep3rParameters contract\\n/// @notice Handles and sets all the required parameters for Keep3r\\ninterface IKeep3rParameters is IKeep3rAccountance {\\n // Events\\n\\n /// @notice Emitted when the Keep3rHelper address is changed\\n /// @param _keep3rHelper The address of Keep3rHelper's contract\\n event Keep3rHelperChange(address _keep3rHelper);\\n\\n /// @notice Emitted when the Keep3rV1 address is changed\\n /// @param _keep3rV1 The address of Keep3rV1's contract\\n event Keep3rV1Change(address _keep3rV1);\\n\\n /// @notice Emitted when the Keep3rV1Proxy address is changed\\n /// @param _keep3rV1Proxy The address of Keep3rV1Proxy's contract\\n event Keep3rV1ProxyChange(address _keep3rV1Proxy);\\n\\n /// @notice Emitted when bondTime is changed\\n /// @param _bondTime The new bondTime\\n event BondTimeChange(uint256 _bondTime);\\n\\n /// @notice Emitted when _liquidityMinimum is changed\\n /// @param _liquidityMinimum The new _liquidityMinimum\\n event LiquidityMinimumChange(uint256 _liquidityMinimum);\\n\\n /// @notice Emitted when _unbondTime is changed\\n /// @param _unbondTime The new _unbondTime\\n event UnbondTimeChange(uint256 _unbondTime);\\n\\n /// @notice Emitted when _rewardPeriodTime is changed\\n /// @param _rewardPeriodTime The new _rewardPeriodTime\\n event RewardPeriodTimeChange(uint256 _rewardPeriodTime);\\n\\n /// @notice Emitted when the inflationPeriod is changed\\n /// @param _inflationPeriod The new inflationPeriod\\n event InflationPeriodChange(uint256 _inflationPeriod);\\n\\n /// @notice Emitted when the fee is changed\\n /// @param _fee The new token credits fee\\n event FeeChange(uint256 _fee);\\n\\n // Variables\\n\\n /// @notice Address of Keep3rHelper's contract\\n /// @return _keep3rHelper The address of Keep3rHelper's contract\\n function keep3rHelper() external view returns (address _keep3rHelper);\\n\\n /// @notice Address of Keep3rV1's contract\\n /// @return _keep3rV1 The address of Keep3rV1's contract\\n function keep3rV1() external view returns (address _keep3rV1);\\n\\n /// @notice Address of Keep3rV1Proxy's contract\\n /// @return _keep3rV1Proxy The address of Keep3rV1Proxy's contract\\n function keep3rV1Proxy() external view returns (address _keep3rV1Proxy);\\n\\n /// @notice The amount of time required to pass after a keeper has bonded assets for it to be able to activate\\n /// @return _days The required bondTime in days\\n function bondTime() external view returns (uint256 _days);\\n\\n /// @notice The amount of time required to pass before a keeper can unbond what he has bonded\\n /// @return _days The required unbondTime in days\\n function unbondTime() external view returns (uint256 _days);\\n\\n /// @notice The minimum amount of liquidity required to fund a job per liquidity\\n /// @return _amount The minimum amount of liquidity in KP3R\\n function liquidityMinimum() external view returns (uint256 _amount);\\n\\n /// @notice The amount of time between each scheduled credits reward given to a job\\n /// @return _days The reward period in days\\n function rewardPeriodTime() external view returns (uint256 _days);\\n\\n /// @notice The inflation period is the denominator used to regulate the emission of KP3R\\n /// @return _period The denominator used to regulate the emission of KP3R\\n function inflationPeriod() external view returns (uint256 _period);\\n\\n /// @notice The fee to be sent to governor when a user adds liquidity to a job\\n /// @return _amount The fee amount to be sent to governor when a user adds liquidity to a job\\n function fee() external view returns (uint256 _amount);\\n\\n // Errors\\n\\n /// @notice Throws if the reward period is less than the minimum reward period time\\n error MinRewardPeriod();\\n\\n /// @notice Throws if either a job or a keeper is disputed\\n error Disputed();\\n\\n /// @notice Throws if there are no bonded assets\\n error BondsUnexistent();\\n\\n /// @notice Throws if the time required to bond an asset has not passed yet\\n error BondsLocked();\\n\\n /// @notice Throws if there are no bonds to withdraw\\n error UnbondsUnexistent();\\n\\n /// @notice Throws if the time required to withdraw the bonds has not passed yet\\n error UnbondsLocked();\\n\\n // Methods\\n\\n /// @notice Sets the Keep3rHelper address\\n /// @param _keep3rHelper The Keep3rHelper address\\n function setKeep3rHelper(address _keep3rHelper) external;\\n\\n /// @notice Sets the Keep3rV1 address\\n /// @param _keep3rV1 The Keep3rV1 address\\n function setKeep3rV1(address _keep3rV1) external;\\n\\n /// @notice Sets the Keep3rV1Proxy address\\n /// @param _keep3rV1Proxy The Keep3rV1Proxy address\\n function setKeep3rV1Proxy(address _keep3rV1Proxy) external;\\n\\n /// @notice Sets the bond time required to activate as a keeper\\n /// @param _bond The new bond time\\n function setBondTime(uint256 _bond) external;\\n\\n /// @notice Sets the unbond time required unbond what has been bonded\\n /// @param _unbond The new unbond time\\n function setUnbondTime(uint256 _unbond) external;\\n\\n /// @notice Sets the minimum amount of liquidity required to fund a job\\n /// @param _liquidityMinimum The new minimum amount of liquidity\\n function setLiquidityMinimum(uint256 _liquidityMinimum) external;\\n\\n /// @notice Sets the time required to pass between rewards for jobs\\n /// @param _rewardPeriodTime The new amount of time required to pass between rewards\\n function setRewardPeriodTime(uint256 _rewardPeriodTime) external;\\n\\n /// @notice Sets the new inflation period\\n /// @param _inflationPeriod The new inflation period\\n function setInflationPeriod(uint256 _inflationPeriod) external;\\n\\n /// @notice Sets the new fee\\n /// @param _fee The new fee\\n function setFee(uint256 _fee) external;\\n}\\n\",\"keccak256\":\"0x2a847a2ab6dbee960ca84e142ad9c578d8953c4adf1d3221669400ea86c9b82e\",\"license\":\"MIT\"},\"solidity/interfaces/peripherals/IKeep3rRoles.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4 <0.9.0;\\n\\nimport '@defi-wonderland/solidity-utils/solidity/interfaces/IBaseErrors.sol';\\nimport '@defi-wonderland/solidity-utils/solidity/interfaces/IGovernable.sol';\\nimport '@defi-wonderland/solidity-utils/solidity/interfaces/IDustCollector.sol';\\n\\n/// @title Keep3rRoles contract\\n/// @notice Manages the Keep3r specific roles\\ninterface IKeep3rRoles is IBaseErrors, IGovernable, IDustCollector {\\n // Events\\n\\n /// @notice Emitted when a slasher is added\\n /// @param _slasher Address of the added slasher\\n event SlasherAdded(address _slasher);\\n\\n /// @notice Emitted when a slasher is removed\\n /// @param _slasher Address of the removed slasher\\n event SlasherRemoved(address _slasher);\\n\\n /// @notice Emitted when a disputer is added\\n /// @param _disputer Address of the added disputer\\n event DisputerAdded(address _disputer);\\n\\n /// @notice Emitted when a disputer is removed\\n /// @param _disputer Address of the removed disputer\\n event DisputerRemoved(address _disputer);\\n\\n // Variables\\n\\n /// @notice Tracks whether the address is a slasher or not\\n /// @param _slasher Address being checked as a slasher\\n /// @return _isSlasher Whether the address is a slasher or not\\n function slashers(address _slasher) external view returns (bool _isSlasher);\\n\\n /// @notice Tracks whether the address is a disputer or not\\n /// @param _disputer Address being checked as a disputer\\n /// @return _isDisputer Whether the address is a disputer or not\\n function disputers(address _disputer) external view returns (bool _isDisputer);\\n\\n // Errors\\n\\n /// @notice Throws if the address is already a registered slasher\\n error SlasherExistent();\\n\\n /// @notice Throws if caller is not a registered slasher\\n error SlasherUnexistent();\\n\\n /// @notice Throws if the address is already a registered disputer\\n error DisputerExistent();\\n\\n /// @notice Throws if caller is not a registered disputer\\n error DisputerUnexistent();\\n\\n /// @notice Throws if the msg.sender is not a slasher or is not a part of governance\\n error OnlySlasher();\\n\\n /// @notice Throws if the msg.sender is not a disputer or is not a part of governance\\n error OnlyDisputer();\\n\\n // Methods\\n\\n /// @notice Registers a slasher by updating the slashers mapping\\n function addSlasher(address _slasher) external;\\n\\n /// @notice Removes a slasher by updating the slashers mapping\\n function removeSlasher(address _slasher) external;\\n\\n /// @notice Registers a disputer by updating the disputers mapping\\n function addDisputer(address _disputer) external;\\n\\n /// @notice Removes a disputer by updating the disputers mapping\\n function removeDisputer(address _disputer) external;\\n}\\n\",\"keccak256\":\"0xc0a19b0dfac535cbffabc0d76cb0569618dedb922b0413bc12358efa47dc32bf\",\"license\":\"MIT\"},\"solidity/interfaces/peripherals/IMintable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4 <0.9.0;\\n\\nimport '@defi-wonderland/solidity-utils/solidity/interfaces/IBaseErrors.sol';\\nimport '@defi-wonderland/solidity-utils/solidity/interfaces/IGovernable.sol';\\n\\n/// @title Mintable contract\\n/// @notice Manages the minter role\\ninterface IMintable is IBaseErrors, IGovernable {\\n // Events\\n\\n /// @notice Emitted when governor sets a new minter\\n /// @param _minter Address of the new minter\\n event MinterSet(address _minter);\\n\\n // Errors\\n\\n /// @notice Throws if the caller of the function is not the minter\\n error OnlyMinter();\\n\\n // Variables\\n\\n /// @notice Stores the minter address\\n /// @return _minter The minter addresss\\n function minter() external view returns (address _minter);\\n\\n // Methods\\n\\n /// @notice Sets a new address to be the minter\\n /// @param _minter The address set as the minter\\n function setMinter(address _minter) external;\\n}\\n\",\"keccak256\":\"0x0048c141d747eb1b0e9391ac9e13c268f858f2fec939c597992742e7a5e71597\",\"license\":\"MIT\"},\"solidity/interfaces/sidechain/IKeep3rEscrow.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4 <0.9.0;\\n\\n// solhint-disable-next-line no-empty-blocks\\n\\nimport '../peripherals/IMintable.sol';\\n\\n/// @title Keep3rEscrow contract\\n/// @notice This contract acts as an escrow contract for wKP3R tokens on sidechains and L2s\\n/// @dev Can be used as a replacement for keep3rV1Proxy in keep3r sidechain implementations\\ninterface IKeep3rEscrow is IMintable {\\n /// @notice Emitted when Keep3rEscrow#deposit function is called\\n /// @param _wKP3R The addess of the wrapped KP3R token\\n /// @param _sender The address that called the function\\n /// @param _amount The amount of wKP3R the user deposited\\n event wKP3RDeposited(address _wKP3R, address _sender, uint256 _amount);\\n\\n /// @notice Emitted when Keep3rEscrow#mint function is called\\n /// @param _wKP3R The addess of the wrapped KP3R token\\n /// @param _recipient The address that will received the newly minted wKP3R\\n /// @param _amount The amount of wKP3R minted to the recipient\\n event wKP3RMinted(address _wKP3R, address _recipient, uint256 _amount);\\n\\n /// @notice Emitted when Keep3rEscrow#setWKP3R function is called\\n /// @param _newWKP3R The address of the wKP3R contract\\n event wKP3RSet(address _newWKP3R);\\n\\n /// @notice Throws when minter attempts to withdraw more wKP3R than the escrow has in its balance\\n error InsufficientBalance();\\n\\n /// @notice Lists the address of the wKP3R contract\\n /// @return _wKP3RAddress The address of wKP3R\\n function wKP3R() external view returns (address _wKP3RAddress);\\n\\n /// @notice Deposits wKP3R into the contract\\n /// @param _amount The amount of wKP3R to deposit\\n function deposit(uint256 _amount) external;\\n\\n /// @notice mints wKP3R to the recipient\\n /// @param _amount The amount of wKP3R to mint\\n function mint(uint256 _amount) external;\\n\\n /// @notice sets the wKP3R address\\n /// @param _wKP3R the wKP3R address\\n function setWKP3R(address _wKP3R) external;\\n}\\n\",\"keccak256\":\"0xf4796dde1afba7f50805aeae92ac0a4848525aeca8355d9b1c6b36c15cca4322\",\"license\":\"MIT\"},\"solidity/interfaces/sidechain/IKeep3rHelperSidechain.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4 <0.9.0;\\n\\nimport '../IKeep3rHelper.sol';\\n\\n/// @title Keep3rHelperSidechain contract\\n/// @notice Contains all the helper functions for sidechain keep3r implementations\\ninterface IKeep3rHelperSidechain is IKeep3rHelper {\\n // Structs\\n\\n /// @dev WETH-USD Pool address, isWETHToken0 and usdDecimals\\n /// @dev Created in order to quote any kind of USD tokens\\n struct WethUsdOraclePool {\\n address poolAddress;\\n bool isWETHToken0;\\n uint8 usdDecimals;\\n }\\n\\n // Events\\n\\n /// @notice The oracle for a liquidity has been saved\\n /// @param _liquidity The address of the given liquidity\\n /// @param _oraclePool The address of the oracle pool\\n event OracleSet(address _liquidity, address _oraclePool);\\n\\n /// @notice Emitted when the WETH USD pool is changed\\n /// @param _address Address of the new WETH USD pool\\n /// @param _isWETHToken0 True if calling the token0 method of the pool returns the WETH token address\\n /// @param _usdDecimals The amount of decimals of the USD token paired with ETH\\n event WethUSDPoolChange(address _address, bool _isWETHToken0, uint8 _usdDecimals);\\n\\n /// Variables\\n\\n /// @notice Ethereum mainnet WETH address used for quoting references\\n /// @return _weth Address of WETH token\\n // solhint-disable func-name-mixedcase\\n function WETH() external view returns (address _weth);\\n\\n /// @return _oracle The address of the observable pool for given liquidity\\n function oracle(address _liquidity) external view returns (address _oracle);\\n\\n /// @notice WETH-USD pool that is being used as oracle\\n /// @return poolAddress Address of the pool\\n /// @return isWETHToken0 True if calling the token0 method of the pool returns the WETH token address\\n /// @return usdDecimals The amount of decimals of the USD token paired with ETH\\n function wethUSDPool()\\n external\\n view\\n returns (\\n address poolAddress,\\n bool isWETHToken0,\\n uint8 usdDecimals\\n );\\n\\n /// @notice Quotes USD to ETH\\n /// @dev Used to know how much ETH should be paid to keepers before converting it from ETH to KP3R\\n /// @param _usd The amount of USD to quote to ETH\\n /// @return _eth The resulting amount of ETH after quoting the USD\\n function quoteUsdToEth(uint256 _usd) external returns (uint256 _eth);\\n\\n /// Methods\\n\\n /// @notice Sets an oracle for a given liquidity\\n /// @param _liquidity The address of the liquidity\\n /// @param _oracle The address of the pool used to quote the liquidity from\\n /// @dev The oracle must contain KP3R as either token0 or token1\\n function setOracle(address _liquidity, address _oracle) external;\\n\\n /// @notice Sets an oracle for querying WETH/USD quote\\n /// @param _poolAddress The address of the pool used as oracle\\n /// @param _usdDecimals The amount of decimals of the USD token paired with ETH\\n /// @dev The oracle must contain WETH as either token0 or token1\\n function setWethUsdPool(address _poolAddress, uint8 _usdDecimals) external;\\n}\\n\",\"keccak256\":\"0xf354f6c4182f4f91ccb3cabe823bc28cdc1a8cb20c40266e6b6e277279fc7b56\",\"license\":\"MIT\"},\"solidity/interfaces/sidechain/IKeep3rJobWorkableRated.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4 <0.9.0;\\n\\nimport '../peripherals/IKeep3rJobs.sol';\\n\\n/// @title Keep3rJobWorkableRated contract\\n/// @notice Implements a quoting in USD per gas unit for Keep3r jobs\\ninterface IKeep3rJobWorkableRated is IKeep3rJobs {\\n /// @notice Throws when job contract calls deprecated worked(address) function\\n error Deprecated();\\n\\n /// @notice Implemented by jobs to show that a keeper performed work and reward in stable USD quote\\n /// @dev Automatically calculates the payment for the keeper and pays the keeper with bonded KP3R\\n /// @param _keeper Address of the keeper that performed the work\\n /// @param _usdPerGasUnit Amount of USD in wei rewarded for gas unit worked by the keeper\\n function worked(address _keeper, uint256 _usdPerGasUnit) external;\\n}\\n\",\"keccak256\":\"0xce2c2721f1df7d944bf3ae20331cb628d38247e667c47bf4a33a90f0b5753884\",\"license\":\"MIT\"},\"solidity/interfaces/sidechain/IKeep3rSidechainAccountance.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4 <0.9.0;\\n\\n/// @title IKeep3rSidechainAccountance interface\\n/// @notice Implements a view to get the amount of credits that can be withdrawn\\ninterface IKeep3rSidechainAccountance {\\n /// @notice The surplus amount of wKP3Rs in escrow contract\\n /// @return _virtualReserves The surplus amount of wKP3Rs in escrow contract\\n function virtualReserves() external view returns (int256 _virtualReserves);\\n}\\n\",\"keccak256\":\"0x4c11242f13d72b5db97e89672d09a771abb903e795ff85588d02c8e11fdc435e\",\"license\":\"MIT\"}},\"version\":1}", + "bytecode": "0x60806040526203f480601f55621275006020556729a2241af62c000060215562069780602255622cd300602355601e6024553480156200003e57600080fd5b506040516200612738038062006127833981016040819052620000619162000134565b6001600055838383838383838382828286806001600160a01b0381166200009b5760405163d92e233d60e01b815260040160405180910390fd5b600380546001600160a01b03199081166001600160a01b0393841617909155601e8054821696831696909617909555601c805486169482169490941790935550601d8054909316911617905550506000601f81905560205550506001602155505062015180602255505062069780602355506200019192505050565b80516001600160a01b03811681146200012f57600080fd5b919050565b600080600080608085870312156200014b57600080fd5b620001568562000117565b9350620001666020860162000117565b9250620001766040860162000117565b9150620001866060860162000117565b905092959194509250565b615f8680620001a16000396000f3fe608060405234801561001057600080fd5b50600436106104c25760003560e01c806398e90a0f11610278578063c7ae40d01161015c578063ec8ca643116100ce578063f25e311b11610092578063f25e311b14610c40578063f263c47014610c53578063f75f9f7b14610c5c578063f9d46cf214610c6f578063fc253d2b14610c82578063fe75bc4614610c8b57600080fd5b8063ec8ca64314610bbe578063f0f346b914610be7578063f11a1d1a14610bfa578063f136a09d14610c0d578063f235757f14610c2d57600080fd5b8063dd2080d611610120578063dd2080d614610b49578063ddca3f4314610b5c578063e3056a3414610b65578063e326ac4314610b78578063ebbb619414610b98578063ec00cdfc14610bab57600080fd5b8063c7ae40d014610ad2578063cb4be2bb14610ae5578063cb54694d14610af8578063cd22af1b14610b0b578063d55995fe14610b3657600080fd5b8063af320e81116101f5578063b600702a116101b9578063b600702a14610a50578063b70362b914610a63578063b7e7734014610a76578063b87fcbff14610a89578063c20297f014610aac578063c5198abc14610abf57600080fd5b8063af320e81146109d4578063b0103b1a146109e7578063b0f328f114610a0a578063b239223314610a12578063b440027f14610a2557600080fd5b8063a5d059ca1161023c578063a5d059ca1461096a578063a676f9ff1461097d578063a734f06e1461099d578063a7d2e784146109b8578063aac6aa9c146109c157600080fd5b806398e90a0f146108dd5780639d5c33d814610906578063a214580914610919578063a39744b51461092c578063a515366a1461095757600080fd5b806359a2255e116103aa57806372da828a1161031c5780638bb6dfa8116102e05780638bb6dfa8146108665780638cb22b76146108795780638fe204dd1461089c57806390a4684e146108af578063951dc22c146108c2578063966abd00146108ca57600080fd5b806372da828a1461080657806374a8f10314610819578063768b5d901461082c5780637c8fce2314610835578063878c723e1461083d57600080fd5b806368a9f19c1161036e57806368a9f19c1461077c578063694798e61461078f57806369fe0e2d146107ba5780636ba42aaa146107cd5780636cf262bc146107e05780636e2a9ca6146107f357600080fd5b806359a2255e146107315780635ebe23f0146107445780635feeb7941461074d578063633fb68f1461076057806364bb43ee1461076957600080fd5b8063168f92e711610443578063274a8db411610407578063274a8db41461069f57806351cff8d9146106d257806352a4de29146106e557806355ea6c47146106f8578063575288bf1461070b578063594a3a931461071e57600080fd5b8063168f92e7146106035780631b44555e1461062e5780631c5a9d9c1461064e5780631ef94b911461066157806321040b011461067457600080fd5b80631101eb411161048a5780631101eb411461056b57806311466d721461058057806313f6986d1461059357806315006b821461059b578063165e62e7146105c657600080fd5b8063034d4c61146104c757806307b435c2146104ed5780630c340a24146105185780630c620bce146105435780630d6a1f8714610558575b600080fd5b6104da6104d536600461590a565b610c9e565b6040519081526020015b60405180910390f35b6104da6104fb366004615927565b601760209081526000928352604080842090915290825290205481565b60035461052b906001600160a01b031681565b6040516001600160a01b0390911681526020016104e4565b61054b610da4565b6040516104e49190615960565b6104da6105663660046159ad565b610db5565b61057e6105793660046159d9565b610ec8565b005b61057e61058e3660046159ad565b611022565b61057e6111c7565b6104da6105a9366004615927565b601560209081526000928352604080842090915290825290205481565b6105d96105d436600461590a565b6111fc565b604080518251600690810b825260208085015190910b9082015291810151908201526060016104e4565b6104da610611366004615927565b600e60209081526000928352604080842090915290825290205481565b6104da61063c36600461590a565b600a6020526000908152604090205481565b61057e61065c36600461590a565b61141b565b601c5461052b906001600160a01b031681565b6104da610682366004615927565b601860209081526000928352604080842090915290825290205481565b6106c26106ad36600461590a565b60066020526000908152604090205460ff1681565b60405190151581526020016104e4565b61057e6106e036600461590a565b6115d6565b61057e6106f33660046159d9565b61176e565b61057e61070636600461590a565b6119a1565b61057e6107193660046159d9565b611a55565b61057e61072c366004615927565b611d10565b61057e61073f36600461590a565b611db5565b6104da601f5481565b61057e61075b36600461590a565b611e67565b6104da60215481565b61057e61077736600461590a565b611e80565b61057e61078a36600461590a565b611f5b565b6104da61079d366004615927565b602860209081526000928352604080842090915290825290205481565b61057e6107c8366004615a1a565b61203b565b6106c26107db36600461590a565b61209b565b6104da6107ee36600461590a565b6120fb565b61057e6108013660046159d9565b612243565b61057e61081436600461590a565b61238f565b61057e61082736600461590a565b61242f565b6104da60225481565b61054b61252a565b61052b61084b36600461590a565b6001602052600090815260409020546001600160a01b031681565b6104da61087436600461590a565b612536565b6106c261088736600461590a565b60196020526000908152604090205460ff1681565b61057e6108aa366004615a1a565b6125d9565b61057e6108bd366004615927565b612637565b61054b612721565b61057e6108d8366004615a33565b61272d565b61052b6108eb36600461590a565b6002602052600090815260409020546001600160a01b031681565b61057e61091436600461590a565b612843565b61057e610927366004615a75565b612923565b6104da61093a366004615927565b600d60209081526000928352604080842090915290825290205481565b61057e6109653660046159ad565b612af3565b61057e6109783660046159ad565b612d4a565b6104da61098b36600461590a565b60296020526000908152604090205481565b61052b73eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee81565b6104da60205481565b61057e6109cf36600461590a565b612e24565b61057e6109e2366004615927565b612ed9565b6106c26109f536600461590a565b600c6020526000908152604090205460ff1681565b6104da613356565b61057e610a20366004615a1a565b6133e8565b6104da610a33366004615927565b602560209081526000928352604080842090915290825290205481565b61057e610a5e36600461590a565b613448565b61057e610a713660046159ad565b6136a5565b61057e610a84366004615a1a565b61393f565b6106c2610a9736600461590a565b60056020526000908152604090205460ff1681565b61057e610aba366004615ab5565b61399f565b61057e610acd36600461590a565b613a58565b601d5461052b906001600160a01b031681565b61057e610af336600461590a565b613b1e565b61057e610b06366004615a1a565b613bbe565b6104da610b19366004615927565b601660209081526000928352604080842090915290825290205481565b61057e610b44366004615afb565b613c42565b61057e610b573660046159d9565b613e79565b6104da60245481565b60045461052b906001600160a01b031681565b6104da610b8636600461590a565b600b6020526000908152604090205481565b61057e610ba6366004615a1a565b614008565b61057e610bb936600461590a565b614068565b61052b610bcc36600461590a565b602c602052600090815260409020546001600160a01b031681565b61057e610bf536600461590a565b614113565b601e5461052b906001600160a01b031681565b6104da610c1b36600461590a565b602a6020526000908152604090205481565b61057e610c3b36600461590a565b6141c8565b61057e610c4e3660046159d9565b6141ff565b6104da60095481565b61057e610c6a36600461590a565b614445565b6106c2610c7d366004615b4e565b6144fd565b6104da60235481565b61057e610c993660046159ad565b6145e6565b600080610caa836120fb565b6022549091504290610cc590610cc09083615bb5565b6146d6565b6001600160a01b0385166000908152602960205260409020541115610d69576022546001600160a01b038516600090815260296020526040902054610d0a9042615bb5565b10610d46576022546001600160a01b038516600090815260296020526040902054610d359190615bcc565b610d3f9082615bb5565b9050610d7f565b6001600160a01b038416600090815260296020526040902054610d3f9082615bb5565b610d72426146d6565b610d7c9082615bb5565b90505b610d8981836146f0565b610d9285612536565b610d9c9190615bcc565b949350505050565b6060610db0602661471a565b905090565b6000610dc260268461472e565b15610ec2576000610dd2846111fc565b90508060400151600014610ec0576001600160a01b03841660009081526014602052604081205460ff16610e13578160200151610e0e90615be4565b610e19565b81602001515b601e5460225460405163a0d2710760e01b815260048101889052600684900b60248201526044810191909152919250610eb7916001600160a01b039091169063a0d27107906064015b60206040518083038186803b158015610e7a57600080fd5b505afa158015610e8e573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610eb29190615c0b565b614750565b92505050610ec2565b505b92915050565b6001600160a01b038381166000908152600160205260409020548491163314610f0457604051636efb4f4160e11b815260040160405180910390fd5b602054610f119042615bcc565b6001600160a01b03808616600081815260176020908152604080832094891680845294825280832095909555918152601882528381209281529190529081208054849290610f60908490615bcc565b90915550610f719050848484614761565b6001600160a01b038085166000908152602860209081526040808320938716835292905220548015801590610fb05750602154610fae828661496f565b105b15610fce57604051636f447fcd60e11b815260040160405180910390fd5b836001600160a01b0316856001600160a01b03167f9aaab310d247ad45aef26bbdefc4ebf20c728fdb84c92b95b2b05d21826940de8560405161101391815260200190565b60405180910390a35050505050565b336000818152600c602052604090205460ff16156110535760405163ad2fdf3b60e01b815260040160405180910390fd5b61105e601a8261472e565b61107a5760405162941a5760e11b815260040160405180910390fd5b61108381614a97565b156110e0576001600160a01b038116600081815260296020908152604080832054600f835281842054601084529382902054825191825292810193909352820152600080516020615f318339815191529060600160405180910390a25b6001600160a01b0381166000908152600f60205260409020548211156111615761110981614c6d565b6001600160a01b038116600081815260296020908152604080832054600f835281842054601084529382902054825191825292810193909352820152600080516020615f318339815191529060600160405180910390a25b61116c818484614cfb565b601c546001600160a01b038085169183821691167f46f2180879a7123a197cc3828c28955d70d661c70acbdc02450daf5f9a9c1cfa856111aa614df8565b6040805192835260208301919091520160405180910390a4505050565b6004546001600160a01b031633146111f257604051639ba0305d60e01b815260040160405180910390fd5b6111fa614e12565b565b6040805160608101825260008082526020820181905291810191909152611222426146d6565b6001600160a01b0383166000908152602b6020526040902060010154141561129057506001600160a01b03166000908152602b602090815260409182902082516060810184528154600681810b8352600160381b909104900b92810192909252600101549181019190915290565b604080516002808252606082018352600092839291906020830190803683370190505090506112be426146d6565b6112c89042615bb5565b816000815181106112db576112db615c24565b602002602001019063ffffffff16908163ffffffff1681525050602254611301426146d6565b61130b9042615bb5565b6113159190615bcc565b8160018151811061132857611328615c24565b63ffffffff909216602092830291909101820152601e546001600160a01b0386811660009081526013909352604080842054905163dc686d9160e01b81529282169263dc686d91926113809216908690600401615c3a565b60606040518083038186803b15801561139857600080fd5b505afa1580156113ac573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906113d09190615cb8565b60069290920b80875291945091506113e9908290615cfb565b60060b6020850152821561140a57611400426146d6565b6040850152611412565b600060408501525b5050505b919050565b336000818152600c602052604090205460ff161561144c576040516362e6201d60e01b815260040160405180910390fd5b6001600160a01b038082166000908152601660209081526040808320938616835292905220548061149057604051636258f48160e01b815260040160405180910390fd5b4281106114b057604051630fd0eeef60e11b815260040160405180910390fd5b6001600160a01b0382166000908152600b60205260409020546114e9576001600160a01b0382166000908152600b602052604090204290555b6114f4600783614e70565b506001600160a01b038083166000818152601560209081526040808320948816808452948252808320805490849055938352600d8252808320948352939052918220805491928392611547908490615bcc565b9091555050601c546001600160a01b03858116911614156115835780600960008282546115749190615bcc565b90915550611583905081614e85565b836001600160a01b0316836001600160a01b03167f3673530133b6da67e9854f605b0cfa7bb9798cd33c18036dfc10d8da7c4d4a75836040516115c891815260200190565b60405180910390a350505050565b600260005414156116025760405162461bcd60e51b81526004016115f990615d4b565b60405180910390fd5b600260009081553381526018602090815260408083206001600160a01b03851684529091529020546116475760405163184c088160e21b815260040160405180910390fd5b3360009081526017602090815260408083206001600160a01b0385168452909152902054421161168a576040516327cfdcb760e01b815260040160405180910390fd5b336000908152600c602052604090205460ff16156116bb576040516362e6201d60e01b815260040160405180910390fd5b3360008181526018602090815260408083206001600160a01b038681168086529184528285208054908690559585526017845282852082865290935290832092909255601c541614156117115761171181614f70565b6117256001600160a01b0383163383614fb8565b6040518181526001600160a01b0383169033907f2717ead6b9200dd235aad468c9809ea400fe33ac69b5bfaa6d3e90fc922b63989060200160405180910390a350506001600055565b600260005414156117915760405162461bcd60e51b81526004016115f990615d4b565b60026000556117a160268361472e565b6117be5760405163e0b6aead60e01b815260040160405180910390fd5b6117c9601a8461472e565b6117e657604051636211d34960e01b815260040160405180910390fd5b6001600160a01b03831660009081526012602052604090206118089083614e70565b5061181283615020565b6021546001600160a01b038085166000908152602860209081526040808320938716835292905220546118509061184a908490615bcc565b8461496f565b101561186f57604051636f447fcd60e11b815260040160405180910390fd5b6001600160a01b038316600081815260296020908152604080832054600f835281842054601084529382902054825191825292810193909352820152600080516020615f318339815191529060600160405180910390a26118db6001600160a01b03831633308461507e565b6001600160a01b03808416600090815260286020908152604080832093861683529290529081208054839290611912908490615bcc565b909155506119259050610eb2828461496f565b6001600160a01b0384166000908152601060205260408120805490919061194d908490615bcc565b909155505060405181815233906001600160a01b0384811691908616907f4e186bc75a2220191b826baff3ee63c3e970e94e58a9007ff94c9a7b8e6ebb3f9060200160405180910390a45050600160005550565b3360009081526006602052604090205460ff166119d157604051630942721960e31b815260040160405180910390fd5b6001600160a01b0381166000908152600c602052604090205460ff16611a0a576040516310cec38560e21b815260040160405180910390fd5b6001600160a01b0381166000818152600c6020526040808220805460ff19169055513392917fe02b2375d8fb4aef3e5bc5d53bffcf70b6f185c5c93e69dcbe8b6cfc58e837e291a350565b60026000541415611a785760405162461bcd60e51b81526004016115f990615d4b565b6002600055611a88601a8461472e565b611aa557604051636211d34960e01b815260040160405180910390fd5b601c546001600160a01b0383811691161415611ad35760405162822d9760e71b815260040160405180910390fd5b6040516370a0823160e01b81523060048201526000906001600160a01b038416906370a082319060240160206040518083038186803b158015611b1557600080fd5b505afa158015611b29573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611b4d9190615c0b565b9050611b646001600160a01b03841633308561507e565b6040516370a0823160e01b815230600482015260009082906001600160a01b038616906370a082319060240160206040518083038186803b158015611ba857600080fd5b505afa158015611bbc573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611be09190615c0b565b611bea9190615bb5565b9050600061271060245483611bff9190615d82565b611c099190615db7565b9050611c158183615bb5565b6001600160a01b038088166000908152600e60209081526040808320938a1683529290529081208054909190611c4c908490615bcc565b90915550506001600160a01b0380871660009081526025602090815260408083208985168085529252909120429055600354611c89921683614fb8565b6001600160a01b0386166000908152601160205260409020611cab9086614e70565b50336001600160a01b0316856001600160a01b0316876001600160a01b03167fec1a37d4a331a5059081e0fb5da1735e7890900cd215a4fb1e9f2779fd7b83eb85604051611cfb91815260200190565b60405180910390a45050600160005550505050565b6001600160a01b038281166000908152600160205260409020548391163314611d4c57604051636efb4f4160e11b815260040160405180910390fd5b6001600160a01b03838116600081815260026020908152604080832080546001600160a01b031916888716908117909155600190925280832054905191941692917fa8bad3f0b781e1d954af9945167d5f80bfe5e57930f17c93843187c77557a6b891a4505050565b6001600160a01b038181166000908152600260205260409020548291163314611df15760405163cfe9663360e01b815260040160405180910390fd5b6001600160a01b03828116600081815260016020908152604080832080546002909352818420805487166001600160a01b031980861691909117909255805490911690555193169283929133917fcf30c54296d5eee76168b564c59c50578d49c271733a470f32707c8cfbc88a8b9190a4505050565b6040516331cee75f60e21b815260040160405180910390fd5b6003546001600160a01b03163314611eab5760405163070545c960e51b815260040160405180910390fd5b611eb66026826150bc565b611ed357604051630a8d08b160e01b815260040160405180910390fd5b6001600160a01b038116600081815260136020908152604080832080546001600160a01b031916905560148252808320805460ff19169055602b825280832080546001600160701b03191681556001019290925590519182527f51199d699bdfd516fa88dd0d2f8487c40c147b4867acaa23adc8d4df6b098e5691015b60405180910390a150565b6003546001600160a01b03163314611f865760405163070545c960e51b815260040160405180910390fd5b6001600160a01b038116611fad5760405163d92e233d60e01b815260040160405180910390fd5b6001600160a01b03811660009081526005602052604090205460ff1615611fe75760405163546da66560e11b815260040160405180910390fd5b6001600160a01b038116600081815260056020908152604091829020805460ff1916600117905590519182527f049ccb28ab796d3225573a065712f6e7754487ced56056cda8889c337511807b9101611f50565b6003546001600160a01b031633146120665760405163070545c960e51b815260040160405180910390fd5b60248190556040518181527f4c10ca068ff7002cf5da78f2f697d1e91f6f0ac27f7344b28e8ef25263f87e5d90602001611f50565b60006120a5614df8565b602e556120b360078361472e565b15611416577f4851cad52e624c8f7a1d44c28a80db05988ba2451fc0db6b0ec338d8eca95afb602e546040516120eb91815260200190565b60405180910390a1506001919050565b6000805b6001600160a01b0383166000908152601260205260409020612120906150d1565b81101561223d576001600160a01b038316600090815260126020526040812061214990836150db565b905061215660268261472e565b1561222a576000612166826111fc565b90508060400151600014612228576001600160a01b03821660009081526014602052604081205460ff166121a75781602001516121a290615be4565b6121ad565b81602001515b601e546001600160a01b03888116600090815260286020908152604080832089851684529091529081902054602254915163a0d2710760e01b81526004810191909152600685900b6024820152604481019190915292935061221a9291169063a0d2710790606401610e62565b6122249086615bcc565b9450505b505b508061223581615dcb565b9150506120ff565b50919050565b3360009081526005602052604090205460ff1661227357604051637e57b1e160e01b815260040160405180910390fd5b6001600160a01b0383166000908152600c602052604090205460ff166122ac576040516310cec38560e21b815260040160405180910390fd5b6122b7838383614761565b60035460405163a9059cbb60e01b81526001600160a01b039182166004820152602481018390529083169063a9059cbb90604401602060405180830381600087803b15801561230557600080fd5b505af1925050508015612335575060408051601f3d908101601f1916820190925261233291810190615de6565b60015b61233e57612340565b505b604080516001600160a01b038481168252602082018490523392908616917f6e10247c3c094d220ee99436c164b7f38d63b335a20ed817cbefaee4bb02d20e91015b60405180910390a3505050565b6003546001600160a01b031633146123ba5760405163070545c960e51b815260040160405180910390fd5b6001600160a01b0381166123e15760405163d92e233d60e01b815260040160405180910390fd5b601e80546001600160a01b0319166001600160a01b0383169081179091556040519081527f71973fd672e51deb8f739b1f7e1eab991936645acd6f83e2bde6eeeaff5490b090602001611f50565b3360009081526005602052604090205460ff1661245f57604051637e57b1e160e01b815260040160405180910390fd5b6001600160a01b0381166000908152600c602052604090205460ff16612498576040516310cec38560e21b815260040160405180910390fd5b6124a36007826150bc565b50601c546001600160a01b038083166000818152600d60209081526040808320949095168083529381528482205492825260188152848220848352905292909220546124f1928492916150e7565b60405133906001600160a01b038316907f038a17b9b553c0c3fc2ed14b957a5d8420a1666fd2efe5c1b3fe5f23eea61bb390600090a350565b6060610db0601a61471a565b600080612542836120fb565b6022546001600160a01b0385166000908152602960205260409020549192509061256c9042615bb5565b1015610ec25760008111612598576001600160a01b0383166000908152600f60205260409020546125d2565b6001600160a01b038316600090815260106020908152604080832054600f909252909120546125c8908390615d82565b6125d29190615db7565b915061223d565b6003546001600160a01b031633146126045760405163070545c960e51b815260040160405180910390fd5b60208181556040518281527fc8d443472c9783cc36f8f5f5091f08ce9f37fc2f9e6d79cf1d9aaf40a433fee29101611f50565b6001600160a01b03828116600090815260016020526040902054839116331461267357604051636efb4f4160e11b815260040160405180910390fd5b816001600160a01b0316836001600160a01b031614156126a65760405163afe7ad4960e01b815260040160405180910390fd5b6001600160a01b038381166000818152602c6020908152604080832080546001600160a01b0319169588169586179055602d8252808320858452825291829020429055905192835290917fff0456758201108de53c0ff04c69988d4678ff455b2ce6f733328cf85722c04c91015b60405180910390a2505050565b6060610db0600761471a565b6003546001600160a01b031633146127585760405163070545c960e51b815260040160405180910390fd5b6001600160a01b03811661277f5760405163d92e233d60e01b815260040160405180910390fd5b6001600160a01b03831673eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee14156127e0576040516001600160a01b0382169083156108fc029084906000818181858888f193505050501580156127da573d6000803e3d6000fd5b506127f4565b6127f46001600160a01b0384168284614fb8565b604080516001600160a01b0385811682526020820185905283168183015290517f9a3055ded8c8b5f21bbf4946c5afab6e1fa8b3f057922658e5e1ade125fb0b1e9181900360600190a1505050565b6003546001600160a01b0316331461286e5760405163070545c960e51b815260040160405180910390fd5b6001600160a01b0381166128955760405163d92e233d60e01b815260040160405180910390fd5b6001600160a01b03811660009081526006602052604090205460ff16156128cf5760405163274e25dd60e11b815260040160405180910390fd5b6001600160a01b038116600081815260066020908152604091829020805460ff1916600117905590519182527f8addc69f897ecca0e41d70ed4ff9d75a9148a615a0fbda8597e53aea2684302f9101611f50565b6001600160a01b03838116600090815260016020526040902054849116331461295f57604051636efb4f4160e11b815260040160405180910390fd5b6001600160a01b0382166129865760405163d92e233d60e01b815260040160405180910390fd5b6001600160a01b038085166000908152601860209081526040808320938716835292905220546129c95760405163184c088160e21b815260040160405180910390fd5b6001600160a01b038085166000908152601760209081526040808320938716835292905220544211612a0e576040516327cfdcb760e01b815260040160405180910390fd5b6001600160a01b0384166000908152600c602052604090205460ff1615612a48576040516362e6201d60e01b815260040160405180910390fd5b6001600160a01b0380851660008181526018602090815260408083209488168084529482528083208054908490559383526017825280832085845290915281205590612a95908483614fb8565b826001600160a01b0316846001600160a01b0316866001600160a01b03167ffdb7893bf11f50c621e59cc7f1cf540e94295cb27ca869ec7ed7618ca792886284604051612ae491815260200190565b60405180910390a45050505050565b60026000541415612b165760405162461bcd60e51b81526004016115f990615d4b565b60026000908155338152600c602052604090205460ff1615612b4b576040516362e6201d60e01b815260040160405180910390fd5b612b56601a3361472e565b15612b745760405163d7229c4360e01b815260040160405180910390fd5b601f54612b819042615bcc565b3360009081526016602090815260408083206001600160a01b03871680855292528083209390935591516370a0823160e01b81523060048201529091906370a082319060240160206040518083038186803b158015612bdf57600080fd5b505afa158015612bf3573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612c179190615c0b565b9050612c2e6001600160a01b03841633308561507e565b6040516370a0823160e01b815230600482015281906001600160a01b038516906370a082319060240160206040518083038186803b158015612c6f57600080fd5b505afa158015612c83573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612ca79190615c0b565b612cb19190615bb5565b336000908152601960209081526040808320805460ff19166001179055601582528083206001600160a01b0388168452909152812080549294508492909190612cfb908490615bcc565b90915550506040518281526001600160a01b0384169033907fa7e66869262026842e8d81f5e6806cdc8d846e27c824e2e22f4fe51442771b349060200160405180910390a35050600160005550565b602054612d579042615bcc565b3360008181526017602090815260408083206001600160a01b03881680855290835281842095909555928252600d81528282209382529290925281208054839290612da3908490615bb5565b90915550503360009081526018602090815260408083206001600160a01b038616845290915281208054839290612ddb908490615bcc565b90915550506040518181526001600160a01b0383169033907f9aaab310d247ad45aef26bbdefc4ebf20c728fdb84c92b95b2b05d21826940de9060200160405180910390a35050565b6003546001600160a01b03163314612e4f5760405163070545c960e51b815260040160405180910390fd5b6001600160a01b03811660009081526005602052604090205460ff16612e88576040516336fe17e760e21b815260040160405180910390fd5b6001600160a01b038116600081815260056020908152604091829020805460ff1916905590519182527f3ed8cbce8cab40e59282f1743e2b607effa08b5cbe0111bb4721134f2f80d0259101611f50565b6001600160a01b038181166000908152600160205260409020548291163314612f1557604051636efb4f4160e11b815260040160405180910390fd5b6001600160a01b0383166000908152600c602052604090205460ff1680612f5457506001600160a01b0382166000908152600c602052604090205460ff165b15612f725760405163ad2fdf3b60e01b815260040160405180910390fd5b6001600160a01b038381166000908152602c6020526040902054811690831614612faf57604051630ced616b60e21b815260040160405180910390fd5b6001600160a01b038084166000908152602d6020908152604080832093861683529290522054612fe190603c90615bcc565b421015613001576040516356248e9760e01b815260040160405180910390fd5b61300a83615020565b61301382615020565b6001600160a01b0383166000908152601160205260408120613034906150d1565b1115613116576001600160a01b038316600090815260116020526040812061305c90826150db565b6001600160a01b038086166000908152600e6020818152604080842085871680865290835281852054958a1685529282528084209284529190528120805493945091926130aa908490615bcc565b90915550506001600160a01b038085166000818152600e6020908152604080832094861683529381528382208290559181526011909152206130ec90826150bc565b506001600160a01b038316600090815260116020526040902061310f9082614e70565b5050613013565b6001600160a01b0383166000908152601260205260408120613137906150d1565b1115613219576001600160a01b038316600090815260126020526040812061315f90826150db565b6001600160a01b03808616600090815260286020818152604080842085871680865290835281852054958a1685529282528084209284529190528120805493945091926131ad908490615bcc565b90915550506001600160a01b03808516600090815260286020908152604080832085851684528252808320839055928616825260129052206131ef9082614e70565b506001600160a01b038416600090815260126020526040902061321290826150bc565b5050613116565b6001600160a01b038084166000908152601060205260408082205492851682528120805490919061324b908490615bcc565b90915550506001600160a01b038084166000908152601060209081526040808320839055600f9091528082205492851682528120805490919061328f908490615bcc565b90915550506001600160a01b0383166000908152600f6020908152604080832083905560299091528120556132c5601a846150bc565b506001600160a01b03838116600081815260016020908152604080832080546001600160a01b031990811690915560028352818420805482169055602d8352818420958816808552958352818420849055848452602c835292819020805490931690925590519182527f9b712b63e3fb1325fa042d3c238ce8144937875065900528ea1e4f3b00f379f29101612714565b600954601c54601d546040516370a0823160e01b81526001600160a01b0391821660048201526000939291909116906370a082319060240160206040518083038186803b1580156133a657600080fd5b505afa1580156133ba573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906133de9190615c0b565b610db09190615e01565b6003546001600160a01b031633146134135760405163070545c960e51b815260040160405180910390fd5b60238190556040518181527fbdcfd7b8482f31cff6a87c362d9e2e3887f4cdc2018c7c485d8e78a7b2fadb6990602001611f50565b6003546001600160a01b031633146134735760405163070545c960e51b815260040160405180910390fd5b61347e602682614e70565b61349b5760405163f25e6b9f60e01b815260040160405180910390fd5b601e5460405163eb37d34960e01b81526001600160a01b0383811660048301529091169063eb37d3499060240160206040518083038186803b1580156134e057600080fd5b505afa1580156134f4573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906135189190615e40565b6001600160a01b03828116600090815260136020526040902080546001600160a01b0319169290911691821790556135635760405163d92e233d60e01b815260040160405180910390fd5b601e546001600160a01b038281166000908152601360205260409081902054905163696a437b60e01b8152908216600482015291169063696a437b9060240160206040518083038186803b1580156135ba57600080fd5b505afa1580156135ce573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906135f29190615de6565b6001600160a01b0382166000908152601460205260409020805460ff1916911515919091179055613622816111fc565b6001600160a01b0382166000818152602b6020908152604091829020845181548684015166ffffffffffffff908116600160381b026001600160701b031990921692169190911717815593820151600190940193909355519081527fabfa8db4d238fa78bf4e15fcc91328dd35f3978f200e2857a56bb719732b7b0b9101611f50565b602e546136c557604051630262ab9b60e61b815260040160405180910390fd5b60006136cf614df8565b336000818152600c60205260409020549192509060ff16156137045760405163ad2fdf3b60e01b815260040160405180910390fd5b61370f601a8261472e565b61372b5760405162941a5760e11b815260040160405180910390fd5b61373481614a97565b15613791576001600160a01b038116600081815260296020908152604080832054600f835281842054601084529382902054825191825292810193909352820152600080516020615f318339815191529060600160405180910390a25b601e546001600160a01b038581166000908152600d60209081526040808320601c548516845290915280822054905163435b21c160e01b8152600481019190915290928392839291169063435b21c19060240160606040518083038186803b1580156137fc57600080fd5b505afa158015613810573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906138349190615e5d565b919450925090506000613852868361384c8a87615d82565b8761524c565b6001600160a01b0386166000908152600f60205260409020549091508111156138d65761387e85614c6d565b6001600160a01b038516600081815260296020908152604080832054600f835281842054601084529382902054825191825292810193909352820152600080516020615f318339815191529060600160405180910390a25b6138e1858983614cfb565b6000602e55601c5460408051838152602081018990526001600160a01b038b811693898216939116917f46f2180879a7123a197cc3828c28955d70d661c70acbdc02450daf5f9a9c1cfa910160405180910390a45050505050505050565b6003546001600160a01b0316331461396a5760405163070545c960e51b815260040160405180910390fd5b601f8190556040518181527fd319ef78d2b690bb773fcccc2d096306bac7c9222dd0bb6b300f461e4a376b4390602001611f50565b3360009081526005602052604090205460ff166139cf57604051637e57b1e160e01b815260040160405180910390fd5b6001600160a01b0384166000908152600c602052604090205460ff16613a08576040516310cec38560e21b815260040160405180910390fd5b613a14848484846150e7565b336001600160a01b0385167f10a73de7ab6e9023aa6e2bc23f7abf4dcef591487e7e55f44c00e34fe60d56db613a4a8486615bcc565b6040519081526020016115c8565b613a63601a8261472e565b15613a8157604051630809740d60e01b815260040160405180910390fd5b6001600160a01b03811660009081526019602052604090205460ff1615613abb57604051632f3d320560e01b815260040160405180910390fd5b613ac6601a82614e70565b506001600160a01b03811660008181526001602052604080822080546001600160a01b0319163390811790915590519092917fed3faef50715743626cd57de74281a2b17cdbfc11c0486feda541fb911e0293d91a350565b6003546001600160a01b03163314613b495760405163070545c960e51b815260040160405180910390fd5b6001600160a01b038116613b705760405163d92e233d60e01b815260040160405180910390fd5b601d80546001600160a01b0319166001600160a01b0383169081179091556040519081527feb931b4b5a98d20a6b1e6693a7c59d8e337a06e2f1473bb776e19251db7ae25090602001611f50565b6003546001600160a01b03163314613be95760405163070545c960e51b815260040160405180910390fd5b62015180811015613c0d57604051633f384aad60e21b815260040160405180910390fd5b60228190556040518181527f54aafa56429e22230b52f1495588ffc632277d74f3a85ec755e13ac50c1584d990602001611f50565b60026000541415613c655760405162461bcd60e51b81526004016115f990615d4b565b600260009081556001600160a01b03858116825260016020526040909120548591163314613ca657604051636efb4f4160e11b815260040160405180910390fd5b6001600160a01b03808616600090815260256020908152604080832093881683529290522054613cd890603c90615bcc565b4211613cf757604051631e0b407560e01b815260040160405180910390fd5b6001600160a01b038086166000908152600e6020908152604080832093881683529290522054831115613d3d5760405163024ae82d60e61b815260040160405180910390fd5b6001600160a01b0385166000908152600c602052604090205460ff1615613d775760405163ad2fdf3b60e01b815260040160405180910390fd5b6001600160a01b038086166000908152600e6020908152604080832093881683529290529081208054859290613dae908490615bb5565b90915550613dc890506001600160a01b0385168385614fb8565b6001600160a01b038086166000908152600e6020908152604080832093881683529290522054613e16576001600160a01b0385166000908152601160205260409020613e1490856150bc565b505b816001600160a01b0316846001600160a01b0316866001600160a01b03167f53e982dd9ec088d634c74c98fbbc161f808b4b6469a26c657120b9a31cb34bfe86604051613e6591815260200190565b60405180910390a450506001600055505050565b336000818152600c602052604090205460ff1615613eaa5760405163ad2fdf3b60e01b815260040160405180910390fd5b6001600160a01b0383166000908152600c602052604090205460ff1615613ee4576040516362e6201d60e01b815260040160405180910390fd5b613eef601a8261472e565b613f0b5760405162941a5760e11b815260040160405180910390fd5b6001600160a01b038082166000908152600e6020908152604080832093881683529290522054821115613f515760405163356680b760e01b815260040160405180910390fd5b6001600160a01b038082166000908152600e6020908152604080832093881683529290529081208054849290613f88908490615bb5565b90915550613fa290506001600160a01b0385168484614fb8565b826001600160a01b0316816001600160a01b0316856001600160a01b03167f46f2180879a7123a197cc3828c28955d70d661c70acbdc02450daf5f9a9c1cfa85613fea614df8565b6040805192835260208301919091520160405180910390a450505050565b6003546001600160a01b031633146140335760405163070545c960e51b815260040160405180910390fd5b60218190556040518181527f24d51b415694a791b1c77df7817c075ac82b83ce611bcd8627d2e66cf37aa3e790602001611f50565b6003546001600160a01b031633146140935760405163070545c960e51b815260040160405180910390fd5b6001600160a01b0381166140ba5760405163d92e233d60e01b815260040160405180910390fd5b6140c5600954614f70565b601c80546001600160a01b0319166001600160a01b0383169081179091556040519081527f1d1a3e7caf0717056e48dc8aefa54d806c7af86324fece4e5d49f8e1f01f84bf90602001611f50565b6003546001600160a01b0316331461413e5760405163070545c960e51b815260040160405180910390fd5b6001600160a01b03811660009081526006602052604090205460ff1661417757604051633ca0d42760e11b815260040160405180910390fd5b6001600160a01b038116600081815260066020908152604091829020805460ff1916905590519182527f5e8bd21d0a98cb2caf33706e56139ff40ffbdca7ec5d9d412a0a2292496dc70e9101611f50565b6003546001600160a01b031633146141f35760405163070545c960e51b815260040160405180910390fd5b6141fc816152a9565b50565b3360009081526005602052604090205460ff1661422f57604051637e57b1e160e01b815260040160405180910390fd5b6001600160a01b0383166000908152600c602052604090205460ff16614268576040516310cec38560e21b815260040160405180910390fd5b6001600160a01b038316600090815260116020526040902061428a908361472e565b6142a757604051632eda7a1160e01b815260040160405180910390fd5b6001600160a01b038084166000908152600e60209081526040808320938616835292905220548111156142ec5760405162919bed60e01b815260040160405180910390fd5b60035460405163a9059cbb60e01b81526001600160a01b039182166004820152602481018390529083169063a9059cbb90604401602060405180830381600087803b15801561433a57600080fd5b505af192505050801561436a575060408051601f3d908101601f1916820190925261436791810190615de6565b60015b61437357614375565b505b6001600160a01b038084166000908152600e60209081526040808320938616835292905290812080548392906143ac908490615bb5565b90915550506001600160a01b038084166000908152600e60209081526040808320938616835292905220546143ff576001600160a01b03831660009081526011602052604090206143fd90836150bc565b505b604080516001600160a01b038481168252602082018490523392908616917f20262b97130b5cb8f80624eed2733df2b05db4a0789b4a3d0157e1d3183331049101612382565b3360009081526006602052604090205460ff1661447557604051630942721960e31b815260040160405180910390fd5b6001600160a01b0381166000908152600c602052604090205460ff16156144af576040516304ee891b60e11b815260040160405180910390fd5b6001600160a01b0381166000818152600c6020526040808220805460ff19166001179055513392917f070125a1c0f5202217aae14ec399abfaaa13c2fd98a91d43bd3a897dd4751e8091a350565b6000614507614df8565b602e5561451560078761472e565b801561454657506001600160a01b038087166000908152600d60209081526040808320938916835292905220548411155b801561456a57506001600160a01b0386166000908152600a60205260409020548311155b801561459957506001600160a01b0386166000908152600b602052604090205482906145969042615bb5565b10155b156145dd577f4851cad52e624c8f7a1d44c28a80db05988ba2451fc0db6b0ec338d8eca95afb602e546040516145d191815260200190565b60405180910390a15060015b95945050505050565b6003546001600160a01b031633146146115760405163070545c960e51b815260040160405180910390fd5b61461c601a8361472e565b61463957604051636211d34960e01b815260040160405180910390fd5b61464282615020565b6001600160a01b0382166000908152600f60205260408120805483929061466a908490615bcc565b90915550506001600160a01b038216600081815260296020908152604080832054600f909252918290205491517f5abcf5031fdbd3badb9d1e09094208de329aee72730e87650f346584205d23d1926146ca928252602082015260400190565b60405180910390a25050565b6000602254826146e69190615e8b565b610ec29083615bb5565b600060225483101561223d576022546147098385615d82565b6147139190615db7565b9050610ec2565b606060006147278361532c565b9392505050565b6001600160a01b03811660009081526001830160205260408120541515614727565b6000610ec282602254602354615388565b600260005414156147845760405162461bcd60e51b81526004016115f990615d4b565b600260009081556001600160a01b03841681526012602052604090206147aa908361472e565b6147c6576040516241cfa560e21b815260040160405180910390fd5b6001600160a01b0380841660009081526028602090815260408083209386168352929052205481111561480c5760405163435b562560e01b815260040160405180910390fd5b61481583615436565b6000614824610eb2838561496f565b6001600160a01b038516600090815260106020526040902054909150156148da576001600160a01b038416600090815260106020908152604080832054600f90925290912054614875908390615d82565b61487f9190615db7565b6001600160a01b0385166000908152600f6020526040812080549091906148a7908490615bb5565b90915550506001600160a01b038416600090815260106020526040812080548392906148d4908490615bb5565b90915550505b6001600160a01b03808516600090815260286020908152604080832093871683529290529081208054849290614911908490615bb5565b90915550506001600160a01b03808516600090815260286020908152604080832093871683529290522054614964576001600160a01b038416600090815260126020526040902061496290846150bc565b505b505060016000555050565b6001600160a01b0381166000908152602b602052604081206001015415610ec2576001600160a01b03821660009081526014602052604081205460ff166149e1576001600160a01b0383166000908152602b60205260409020546149dc90600160381b900460060b615be4565b614a05565b6001600160a01b0383166000908152602b6020526040902054600160381b900460060b5b601e5460225460405163a0d2710760e01b815260048101889052600684900b602482015260448101919091529192506001600160a01b03169063a0d271079060640160206040518083038186803b158015614a5f57600080fd5b505afa158015614a73573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d9c9190615c0b565b6000614aa2426146d6565b6001600160a01b038316600090815260296020526040902054101561141657614ad260225442610cc09190615bb5565b6001600160a01b03831660009081526029602052604090205411614b4857614af982615436565b6001600160a01b038216600090815260106020908152604080832054600f90925290912055614b27426146d6565b6001600160a01b038316600090815260296020526040902055506001919050565b6022546001600160a01b038316600090815260296020526040902054614b6e9042615bb5565b10614bca57614b7c82615436565b6001600160a01b038216600090815260106020908152604080832054600f83528184205560225460299092528220805491929091614bbb908490615bcc565b90915550600191506114169050565b614bd3426146d6565b6001600160a01b0383166000908152602a60205260409020541015611416576001600160a01b038216600090815260106020526040902054614c1483615436565b6001600160a01b038316600090815260106020908152604080832054600f909252909120548291614c4491615d82565b614c4e9190615db7565b6001600160a01b0384166000908152600f602052604090205550919050565b6001600160a01b038116600090815260296020526040902054614cb290614c949042615bb5565b6001600160a01b0383166000908152601060205260409020546146f0565b6001600160a01b0382166000908152600f602052604081208054909190614cda908490615bcc565b90915550506001600160a01b03166000908152602960205260409020429055565b6001600160a01b0383166000908152600f6020526040902054811115614d345760405163356680b760e01b815260040160405180910390fd5b6001600160a01b0383166000908152602a60209081526040808320429055600f90915281208054839290614d69908490615bb5565b90915550506001600160a01b038083166000908152600d60209081526040808320601c5490941683529290529081208054839290614da8908490615bcc565b90915550506001600160a01b0382166000908152600a602052604081208054839290614dd5908490615bcc565b925050819055508060096000828254614dee9190615bcc565b9091555050505050565b6000603f5a614e08906040615d82565b610db09190615db7565b60048054600380546001600160a01b0383166001600160a01b031991821681179092559091169091556040519081527f5d5d6e01b731c3e68060f7fe13156f6197d4aeffc2d6f498e34c717ae616b7349060200160405180910390a1565b6000614727836001600160a01b03841661545b565b601c54601d5460405163095ea7b360e01b81526001600160a01b0391821660048201526024810184905291169063095ea7b390604401602060405180830381600087803b158015614ed557600080fd5b505af1158015614ee9573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190614f0d9190615de6565b50601d5460405163b6b55f2560e01b8152600481018390526001600160a01b039091169063b6b55f25906024015b600060405180830381600087803b158015614f5557600080fd5b505af1158015614f69573d6000803e3d6000fd5b5050505050565b8060096000828254614f829190615bb5565b9091555050601d5460405163140e25ad60e31b8152600481018390526001600160a01b039091169063a0712d6890602401614f3b565b6040516001600160a01b03831660248201526044810182905261501b90849063a9059cbb60e01b906064015b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b0319909316929092179091526154aa565b505050565b61502981614a97565b5061503381614c6d565b6001600160a01b0381166000908152600f6020908152604080832054601090925290912054615062919061557c565b6001600160a01b039091166000908152600f6020526040902055565b6040516001600160a01b03808516602483015283166044820152606481018290526150b69085906323b872dd60e01b90608401614fe4565b50505050565b6000614727836001600160a01b038416615592565b6000610ec2825490565b60006147278383615685565b601c546001600160a01b038481169116146151ce576003546001600160a01b038085169163a9059cbb911661511c8486615bcc565b6040516001600160e01b031960e085901b1681526001600160a01b0390921660048301526024820152604401602060405180830381600087803b15801561516257600080fd5b505af1925050508015615192575060408051601f3d908101601f1916820190925261518f91810190615de6565b60015b6151cc573d8080156151c0576040519150601f19603f3d011682016040523d82523d6000602084013e6151c5565b606091505b50506151ce565b505b6001600160a01b038085166000908152600d6020908152604080832093871683529290529081208054849290615205908490615bb5565b90915550506001600160a01b03808516600090815260186020908152604080832093871683529290529081208054839290615241908490615bb5565b909155505050505050565b6000808486602e5461525e9190615bb5565b6152689190615bcc565b9050670de0b6b3a7640000846127106152818685615d82565b61528b9190615db7565b6152959190615d82565b61529f9190615db7565b9695505050505050565b6001600160a01b0381166152d05760405163d92e233d60e01b815260040160405180910390fd5b600480546001600160a01b0319166001600160a01b038381169182179092556003546040805191909316815260208101919091527f6353ec38ac394f8be94bfafcdd3580d356470599059eaeebedc3207e1cc03dec9101611f50565b60608160000180548060200260200160405190810160405280929190818152602001828054801561537c57602002820191906000526020600020905b815481526020019060010190808311615368575b50505050509050919050565b6000808060001985870985870292508281108382030391505080600014156153c257600084116153b757600080fd5b508290049050614727565b8084116153ce57600080fd5b600084868809600260036001881981018916988990049182028318808302840302808302840302808302840302808302840302808302840302918202909203026000889003889004909101858311909403939093029303949094049190911702949350505050565b61543f816156af565b6001600160a01b03909116600090815260106020526040902055565b60008181526001830160205260408120546154a257508154600181810184556000848152602080822090930184905584548482528286019093526040902091909155610ec2565b506000610ec2565b60006154ff826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b03166157ea9092919063ffffffff16565b80519091501561501b578080602001905181019061551d9190615de6565b61501b5760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b60648201526084016115f9565b600081831061558b5781614727565b5090919050565b6000818152600183016020526040812054801561567b5760006155b6600183615bb5565b85549091506000906155ca90600190615bb5565b905081811461562f5760008660000182815481106155ea576155ea615c24565b906000526020600020015490508087600001848154811061560d5761560d615c24565b6000918252602080832090910192909255918252600188019052604090208390555b855486908061564057615640615e9f565b600190038181906000526020600020016000905590558560010160008681526020019081526020016000206000905560019350505050610ec2565b6000915050610ec2565b600082600001828154811061569c5761569c615c24565b9060005260206000200154905092915050565b6000805b6001600160a01b03831660009081526012602052604090206156d4906150d1565b81101561223d576001600160a01b03831660009081526012602052604081206156fd90836150db565b905061570a60268261472e565b156157d757615718426146d6565b6001600160a01b0382166000908152602b60205260409020600101541461579657615742816111fc565b6001600160a01b0382166000908152602b6020908152604091829020835181549285015166ffffffffffffff908116600160381b026001600160701b03199094169116179190911781559101516001909101555b6001600160a01b038085166000908152602860209081526040808320938516835292905220546157ca90610eb2908361496f565b6157d49084615bcc565b92505b50806157e281615dcb565b9150506156b3565b6060610d9c848460008585843b6158435760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e747261637400000060448201526064016115f9565b600080866001600160a01b0316858760405161585f9190615ee1565b60006040518083038185875af1925050503d806000811461589c576040519150601f19603f3d011682016040523d82523d6000602084013e6158a1565b606091505b50915091506158b18282866158bc565b979650505050505050565b606083156158cb575081614727565b8251156158db5782518084602001fd5b8160405162461bcd60e51b81526004016115f99190615efd565b6001600160a01b03811681146141fc57600080fd5b60006020828403121561591c57600080fd5b8135614727816158f5565b6000806040838503121561593a57600080fd5b8235615945816158f5565b91506020830135615955816158f5565b809150509250929050565b6020808252825182820181905260009190848201906040850190845b818110156159a15783516001600160a01b03168352928401929184019160010161597c565b50909695505050505050565b600080604083850312156159c057600080fd5b82356159cb816158f5565b946020939093013593505050565b6000806000606084860312156159ee57600080fd5b83356159f9816158f5565b92506020840135615a09816158f5565b929592945050506040919091013590565b600060208284031215615a2c57600080fd5b5035919050565b600080600060608486031215615a4857600080fd5b8335615a53816158f5565b9250602084013591506040840135615a6a816158f5565b809150509250925092565b600080600060608486031215615a8a57600080fd5b8335615a95816158f5565b92506020840135615aa5816158f5565b91506040840135615a6a816158f5565b60008060008060808587031215615acb57600080fd5b8435615ad6816158f5565b93506020850135615ae6816158f5565b93969395505050506040820135916060013590565b60008060008060808587031215615b1157600080fd5b8435615b1c816158f5565b93506020850135615b2c816158f5565b9250604085013591506060850135615b43816158f5565b939692955090935050565b600080600080600060a08688031215615b6657600080fd5b8535615b71816158f5565b94506020860135615b81816158f5565b94979496505050506040830135926060810135926080909101359150565b634e487b7160e01b600052601160045260246000fd5b600082821015615bc757615bc7615b9f565b500390565b60008219821115615bdf57615bdf615b9f565b500190565b60008160060b667fffffffffffff19811415615c0257615c02615b9f565b60000392915050565b600060208284031215615c1d57600080fd5b5051919050565b634e487b7160e01b600052603260045260246000fd5b6001600160a01b038316815260406020808301829052835191830182905260009184820191906060850190845b81811015615c8957845163ffffffff1683529383019391830191600101615c67565b5090979650505050505050565b8051600681900b811461141657600080fd5b8051801515811461141657600080fd5b600080600060608486031215615ccd57600080fd5b615cd684615c96565b9250615ce460208501615c96565b9150615cf260408501615ca8565b90509250925092565b60008160060b8360060b6000811281667fffffffffffff1901831281151615615d2657615d26615b9f565b81667fffffffffffff018313811615615d4157615d41615b9f565b5090039392505050565b6020808252601f908201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604082015260600190565b6000816000190483118215151615615d9c57615d9c615b9f565b500290565b634e487b7160e01b600052601260045260246000fd5b600082615dc657615dc6615da1565b500490565b6000600019821415615ddf57615ddf615b9f565b5060010190565b600060208284031215615df857600080fd5b61472782615ca8565b60008083128015600160ff1b850184121615615e1f57615e1f615b9f565b6001600160ff1b0384018313811615615e3a57615e3a615b9f565b50500390565b600060208284031215615e5257600080fd5b8151614727816158f5565b600080600060608486031215615e7257600080fd5b8351925060208401519150604084015190509250925092565b600082615e9a57615e9a615da1565b500690565b634e487b7160e01b600052603160045260246000fd5b60005b83811015615ed0578181015183820152602001615eb8565b838111156150b65750506000910152565b60008251615ef3818460208701615eb5565b9190910192915050565b6020815260008251806020840152615f1c816040850160208701615eb5565b601f01601f1916919091016040019291505056feee3f0daba9837d1ab0597acf34328550e4832d02e24e467825e7c2dd318c3820a2646970667358221220ea34d4a4c7cc458a72d55d6a67078e26d27a67e8afd37f220aad290c0eca863b64736f6c63430008080033", + "deployedBytecode": "0x608060405234801561001057600080fd5b50600436106104c25760003560e01c806398e90a0f11610278578063c7ae40d01161015c578063ec8ca643116100ce578063f25e311b11610092578063f25e311b14610c40578063f263c47014610c53578063f75f9f7b14610c5c578063f9d46cf214610c6f578063fc253d2b14610c82578063fe75bc4614610c8b57600080fd5b8063ec8ca64314610bbe578063f0f346b914610be7578063f11a1d1a14610bfa578063f136a09d14610c0d578063f235757f14610c2d57600080fd5b8063dd2080d611610120578063dd2080d614610b49578063ddca3f4314610b5c578063e3056a3414610b65578063e326ac4314610b78578063ebbb619414610b98578063ec00cdfc14610bab57600080fd5b8063c7ae40d014610ad2578063cb4be2bb14610ae5578063cb54694d14610af8578063cd22af1b14610b0b578063d55995fe14610b3657600080fd5b8063af320e81116101f5578063b600702a116101b9578063b600702a14610a50578063b70362b914610a63578063b7e7734014610a76578063b87fcbff14610a89578063c20297f014610aac578063c5198abc14610abf57600080fd5b8063af320e81146109d4578063b0103b1a146109e7578063b0f328f114610a0a578063b239223314610a12578063b440027f14610a2557600080fd5b8063a5d059ca1161023c578063a5d059ca1461096a578063a676f9ff1461097d578063a734f06e1461099d578063a7d2e784146109b8578063aac6aa9c146109c157600080fd5b806398e90a0f146108dd5780639d5c33d814610906578063a214580914610919578063a39744b51461092c578063a515366a1461095757600080fd5b806359a2255e116103aa57806372da828a1161031c5780638bb6dfa8116102e05780638bb6dfa8146108665780638cb22b76146108795780638fe204dd1461089c57806390a4684e146108af578063951dc22c146108c2578063966abd00146108ca57600080fd5b806372da828a1461080657806374a8f10314610819578063768b5d901461082c5780637c8fce2314610835578063878c723e1461083d57600080fd5b806368a9f19c1161036e57806368a9f19c1461077c578063694798e61461078f57806369fe0e2d146107ba5780636ba42aaa146107cd5780636cf262bc146107e05780636e2a9ca6146107f357600080fd5b806359a2255e146107315780635ebe23f0146107445780635feeb7941461074d578063633fb68f1461076057806364bb43ee1461076957600080fd5b8063168f92e711610443578063274a8db411610407578063274a8db41461069f57806351cff8d9146106d257806352a4de29146106e557806355ea6c47146106f8578063575288bf1461070b578063594a3a931461071e57600080fd5b8063168f92e7146106035780631b44555e1461062e5780631c5a9d9c1461064e5780631ef94b911461066157806321040b011461067457600080fd5b80631101eb411161048a5780631101eb411461056b57806311466d721461058057806313f6986d1461059357806315006b821461059b578063165e62e7146105c657600080fd5b8063034d4c61146104c757806307b435c2146104ed5780630c340a24146105185780630c620bce146105435780630d6a1f8714610558575b600080fd5b6104da6104d536600461590a565b610c9e565b6040519081526020015b60405180910390f35b6104da6104fb366004615927565b601760209081526000928352604080842090915290825290205481565b60035461052b906001600160a01b031681565b6040516001600160a01b0390911681526020016104e4565b61054b610da4565b6040516104e49190615960565b6104da6105663660046159ad565b610db5565b61057e6105793660046159d9565b610ec8565b005b61057e61058e3660046159ad565b611022565b61057e6111c7565b6104da6105a9366004615927565b601560209081526000928352604080842090915290825290205481565b6105d96105d436600461590a565b6111fc565b604080518251600690810b825260208085015190910b9082015291810151908201526060016104e4565b6104da610611366004615927565b600e60209081526000928352604080842090915290825290205481565b6104da61063c36600461590a565b600a6020526000908152604090205481565b61057e61065c36600461590a565b61141b565b601c5461052b906001600160a01b031681565b6104da610682366004615927565b601860209081526000928352604080842090915290825290205481565b6106c26106ad36600461590a565b60066020526000908152604090205460ff1681565b60405190151581526020016104e4565b61057e6106e036600461590a565b6115d6565b61057e6106f33660046159d9565b61176e565b61057e61070636600461590a565b6119a1565b61057e6107193660046159d9565b611a55565b61057e61072c366004615927565b611d10565b61057e61073f36600461590a565b611db5565b6104da601f5481565b61057e61075b36600461590a565b611e67565b6104da60215481565b61057e61077736600461590a565b611e80565b61057e61078a36600461590a565b611f5b565b6104da61079d366004615927565b602860209081526000928352604080842090915290825290205481565b61057e6107c8366004615a1a565b61203b565b6106c26107db36600461590a565b61209b565b6104da6107ee36600461590a565b6120fb565b61057e6108013660046159d9565b612243565b61057e61081436600461590a565b61238f565b61057e61082736600461590a565b61242f565b6104da60225481565b61054b61252a565b61052b61084b36600461590a565b6001602052600090815260409020546001600160a01b031681565b6104da61087436600461590a565b612536565b6106c261088736600461590a565b60196020526000908152604090205460ff1681565b61057e6108aa366004615a1a565b6125d9565b61057e6108bd366004615927565b612637565b61054b612721565b61057e6108d8366004615a33565b61272d565b61052b6108eb36600461590a565b6002602052600090815260409020546001600160a01b031681565b61057e61091436600461590a565b612843565b61057e610927366004615a75565b612923565b6104da61093a366004615927565b600d60209081526000928352604080842090915290825290205481565b61057e6109653660046159ad565b612af3565b61057e6109783660046159ad565b612d4a565b6104da61098b36600461590a565b60296020526000908152604090205481565b61052b73eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee81565b6104da60205481565b61057e6109cf36600461590a565b612e24565b61057e6109e2366004615927565b612ed9565b6106c26109f536600461590a565b600c6020526000908152604090205460ff1681565b6104da613356565b61057e610a20366004615a1a565b6133e8565b6104da610a33366004615927565b602560209081526000928352604080842090915290825290205481565b61057e610a5e36600461590a565b613448565b61057e610a713660046159ad565b6136a5565b61057e610a84366004615a1a565b61393f565b6106c2610a9736600461590a565b60056020526000908152604090205460ff1681565b61057e610aba366004615ab5565b61399f565b61057e610acd36600461590a565b613a58565b601d5461052b906001600160a01b031681565b61057e610af336600461590a565b613b1e565b61057e610b06366004615a1a565b613bbe565b6104da610b19366004615927565b601660209081526000928352604080842090915290825290205481565b61057e610b44366004615afb565b613c42565b61057e610b573660046159d9565b613e79565b6104da60245481565b60045461052b906001600160a01b031681565b6104da610b8636600461590a565b600b6020526000908152604090205481565b61057e610ba6366004615a1a565b614008565b61057e610bb936600461590a565b614068565b61052b610bcc36600461590a565b602c602052600090815260409020546001600160a01b031681565b61057e610bf536600461590a565b614113565b601e5461052b906001600160a01b031681565b6104da610c1b36600461590a565b602a6020526000908152604090205481565b61057e610c3b36600461590a565b6141c8565b61057e610c4e3660046159d9565b6141ff565b6104da60095481565b61057e610c6a36600461590a565b614445565b6106c2610c7d366004615b4e565b6144fd565b6104da60235481565b61057e610c993660046159ad565b6145e6565b600080610caa836120fb565b6022549091504290610cc590610cc09083615bb5565b6146d6565b6001600160a01b0385166000908152602960205260409020541115610d69576022546001600160a01b038516600090815260296020526040902054610d0a9042615bb5565b10610d46576022546001600160a01b038516600090815260296020526040902054610d359190615bcc565b610d3f9082615bb5565b9050610d7f565b6001600160a01b038416600090815260296020526040902054610d3f9082615bb5565b610d72426146d6565b610d7c9082615bb5565b90505b610d8981836146f0565b610d9285612536565b610d9c9190615bcc565b949350505050565b6060610db0602661471a565b905090565b6000610dc260268461472e565b15610ec2576000610dd2846111fc565b90508060400151600014610ec0576001600160a01b03841660009081526014602052604081205460ff16610e13578160200151610e0e90615be4565b610e19565b81602001515b601e5460225460405163a0d2710760e01b815260048101889052600684900b60248201526044810191909152919250610eb7916001600160a01b039091169063a0d27107906064015b60206040518083038186803b158015610e7a57600080fd5b505afa158015610e8e573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610eb29190615c0b565b614750565b92505050610ec2565b505b92915050565b6001600160a01b038381166000908152600160205260409020548491163314610f0457604051636efb4f4160e11b815260040160405180910390fd5b602054610f119042615bcc565b6001600160a01b03808616600081815260176020908152604080832094891680845294825280832095909555918152601882528381209281529190529081208054849290610f60908490615bcc565b90915550610f719050848484614761565b6001600160a01b038085166000908152602860209081526040808320938716835292905220548015801590610fb05750602154610fae828661496f565b105b15610fce57604051636f447fcd60e11b815260040160405180910390fd5b836001600160a01b0316856001600160a01b03167f9aaab310d247ad45aef26bbdefc4ebf20c728fdb84c92b95b2b05d21826940de8560405161101391815260200190565b60405180910390a35050505050565b336000818152600c602052604090205460ff16156110535760405163ad2fdf3b60e01b815260040160405180910390fd5b61105e601a8261472e565b61107a5760405162941a5760e11b815260040160405180910390fd5b61108381614a97565b156110e0576001600160a01b038116600081815260296020908152604080832054600f835281842054601084529382902054825191825292810193909352820152600080516020615f318339815191529060600160405180910390a25b6001600160a01b0381166000908152600f60205260409020548211156111615761110981614c6d565b6001600160a01b038116600081815260296020908152604080832054600f835281842054601084529382902054825191825292810193909352820152600080516020615f318339815191529060600160405180910390a25b61116c818484614cfb565b601c546001600160a01b038085169183821691167f46f2180879a7123a197cc3828c28955d70d661c70acbdc02450daf5f9a9c1cfa856111aa614df8565b6040805192835260208301919091520160405180910390a4505050565b6004546001600160a01b031633146111f257604051639ba0305d60e01b815260040160405180910390fd5b6111fa614e12565b565b6040805160608101825260008082526020820181905291810191909152611222426146d6565b6001600160a01b0383166000908152602b6020526040902060010154141561129057506001600160a01b03166000908152602b602090815260409182902082516060810184528154600681810b8352600160381b909104900b92810192909252600101549181019190915290565b604080516002808252606082018352600092839291906020830190803683370190505090506112be426146d6565b6112c89042615bb5565b816000815181106112db576112db615c24565b602002602001019063ffffffff16908163ffffffff1681525050602254611301426146d6565b61130b9042615bb5565b6113159190615bcc565b8160018151811061132857611328615c24565b63ffffffff909216602092830291909101820152601e546001600160a01b0386811660009081526013909352604080842054905163dc686d9160e01b81529282169263dc686d91926113809216908690600401615c3a565b60606040518083038186803b15801561139857600080fd5b505afa1580156113ac573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906113d09190615cb8565b60069290920b80875291945091506113e9908290615cfb565b60060b6020850152821561140a57611400426146d6565b6040850152611412565b600060408501525b5050505b919050565b336000818152600c602052604090205460ff161561144c576040516362e6201d60e01b815260040160405180910390fd5b6001600160a01b038082166000908152601660209081526040808320938616835292905220548061149057604051636258f48160e01b815260040160405180910390fd5b4281106114b057604051630fd0eeef60e11b815260040160405180910390fd5b6001600160a01b0382166000908152600b60205260409020546114e9576001600160a01b0382166000908152600b602052604090204290555b6114f4600783614e70565b506001600160a01b038083166000818152601560209081526040808320948816808452948252808320805490849055938352600d8252808320948352939052918220805491928392611547908490615bcc565b9091555050601c546001600160a01b03858116911614156115835780600960008282546115749190615bcc565b90915550611583905081614e85565b836001600160a01b0316836001600160a01b03167f3673530133b6da67e9854f605b0cfa7bb9798cd33c18036dfc10d8da7c4d4a75836040516115c891815260200190565b60405180910390a350505050565b600260005414156116025760405162461bcd60e51b81526004016115f990615d4b565b60405180910390fd5b600260009081553381526018602090815260408083206001600160a01b03851684529091529020546116475760405163184c088160e21b815260040160405180910390fd5b3360009081526017602090815260408083206001600160a01b0385168452909152902054421161168a576040516327cfdcb760e01b815260040160405180910390fd5b336000908152600c602052604090205460ff16156116bb576040516362e6201d60e01b815260040160405180910390fd5b3360008181526018602090815260408083206001600160a01b038681168086529184528285208054908690559585526017845282852082865290935290832092909255601c541614156117115761171181614f70565b6117256001600160a01b0383163383614fb8565b6040518181526001600160a01b0383169033907f2717ead6b9200dd235aad468c9809ea400fe33ac69b5bfaa6d3e90fc922b63989060200160405180910390a350506001600055565b600260005414156117915760405162461bcd60e51b81526004016115f990615d4b565b60026000556117a160268361472e565b6117be5760405163e0b6aead60e01b815260040160405180910390fd5b6117c9601a8461472e565b6117e657604051636211d34960e01b815260040160405180910390fd5b6001600160a01b03831660009081526012602052604090206118089083614e70565b5061181283615020565b6021546001600160a01b038085166000908152602860209081526040808320938716835292905220546118509061184a908490615bcc565b8461496f565b101561186f57604051636f447fcd60e11b815260040160405180910390fd5b6001600160a01b038316600081815260296020908152604080832054600f835281842054601084529382902054825191825292810193909352820152600080516020615f318339815191529060600160405180910390a26118db6001600160a01b03831633308461507e565b6001600160a01b03808416600090815260286020908152604080832093861683529290529081208054839290611912908490615bcc565b909155506119259050610eb2828461496f565b6001600160a01b0384166000908152601060205260408120805490919061194d908490615bcc565b909155505060405181815233906001600160a01b0384811691908616907f4e186bc75a2220191b826baff3ee63c3e970e94e58a9007ff94c9a7b8e6ebb3f9060200160405180910390a45050600160005550565b3360009081526006602052604090205460ff166119d157604051630942721960e31b815260040160405180910390fd5b6001600160a01b0381166000908152600c602052604090205460ff16611a0a576040516310cec38560e21b815260040160405180910390fd5b6001600160a01b0381166000818152600c6020526040808220805460ff19169055513392917fe02b2375d8fb4aef3e5bc5d53bffcf70b6f185c5c93e69dcbe8b6cfc58e837e291a350565b60026000541415611a785760405162461bcd60e51b81526004016115f990615d4b565b6002600055611a88601a8461472e565b611aa557604051636211d34960e01b815260040160405180910390fd5b601c546001600160a01b0383811691161415611ad35760405162822d9760e71b815260040160405180910390fd5b6040516370a0823160e01b81523060048201526000906001600160a01b038416906370a082319060240160206040518083038186803b158015611b1557600080fd5b505afa158015611b29573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611b4d9190615c0b565b9050611b646001600160a01b03841633308561507e565b6040516370a0823160e01b815230600482015260009082906001600160a01b038616906370a082319060240160206040518083038186803b158015611ba857600080fd5b505afa158015611bbc573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611be09190615c0b565b611bea9190615bb5565b9050600061271060245483611bff9190615d82565b611c099190615db7565b9050611c158183615bb5565b6001600160a01b038088166000908152600e60209081526040808320938a1683529290529081208054909190611c4c908490615bcc565b90915550506001600160a01b0380871660009081526025602090815260408083208985168085529252909120429055600354611c89921683614fb8565b6001600160a01b0386166000908152601160205260409020611cab9086614e70565b50336001600160a01b0316856001600160a01b0316876001600160a01b03167fec1a37d4a331a5059081e0fb5da1735e7890900cd215a4fb1e9f2779fd7b83eb85604051611cfb91815260200190565b60405180910390a45050600160005550505050565b6001600160a01b038281166000908152600160205260409020548391163314611d4c57604051636efb4f4160e11b815260040160405180910390fd5b6001600160a01b03838116600081815260026020908152604080832080546001600160a01b031916888716908117909155600190925280832054905191941692917fa8bad3f0b781e1d954af9945167d5f80bfe5e57930f17c93843187c77557a6b891a4505050565b6001600160a01b038181166000908152600260205260409020548291163314611df15760405163cfe9663360e01b815260040160405180910390fd5b6001600160a01b03828116600081815260016020908152604080832080546002909352818420805487166001600160a01b031980861691909117909255805490911690555193169283929133917fcf30c54296d5eee76168b564c59c50578d49c271733a470f32707c8cfbc88a8b9190a4505050565b6040516331cee75f60e21b815260040160405180910390fd5b6003546001600160a01b03163314611eab5760405163070545c960e51b815260040160405180910390fd5b611eb66026826150bc565b611ed357604051630a8d08b160e01b815260040160405180910390fd5b6001600160a01b038116600081815260136020908152604080832080546001600160a01b031916905560148252808320805460ff19169055602b825280832080546001600160701b03191681556001019290925590519182527f51199d699bdfd516fa88dd0d2f8487c40c147b4867acaa23adc8d4df6b098e5691015b60405180910390a150565b6003546001600160a01b03163314611f865760405163070545c960e51b815260040160405180910390fd5b6001600160a01b038116611fad5760405163d92e233d60e01b815260040160405180910390fd5b6001600160a01b03811660009081526005602052604090205460ff1615611fe75760405163546da66560e11b815260040160405180910390fd5b6001600160a01b038116600081815260056020908152604091829020805460ff1916600117905590519182527f049ccb28ab796d3225573a065712f6e7754487ced56056cda8889c337511807b9101611f50565b6003546001600160a01b031633146120665760405163070545c960e51b815260040160405180910390fd5b60248190556040518181527f4c10ca068ff7002cf5da78f2f697d1e91f6f0ac27f7344b28e8ef25263f87e5d90602001611f50565b60006120a5614df8565b602e556120b360078361472e565b15611416577f4851cad52e624c8f7a1d44c28a80db05988ba2451fc0db6b0ec338d8eca95afb602e546040516120eb91815260200190565b60405180910390a1506001919050565b6000805b6001600160a01b0383166000908152601260205260409020612120906150d1565b81101561223d576001600160a01b038316600090815260126020526040812061214990836150db565b905061215660268261472e565b1561222a576000612166826111fc565b90508060400151600014612228576001600160a01b03821660009081526014602052604081205460ff166121a75781602001516121a290615be4565b6121ad565b81602001515b601e546001600160a01b03888116600090815260286020908152604080832089851684529091529081902054602254915163a0d2710760e01b81526004810191909152600685900b6024820152604481019190915292935061221a9291169063a0d2710790606401610e62565b6122249086615bcc565b9450505b505b508061223581615dcb565b9150506120ff565b50919050565b3360009081526005602052604090205460ff1661227357604051637e57b1e160e01b815260040160405180910390fd5b6001600160a01b0383166000908152600c602052604090205460ff166122ac576040516310cec38560e21b815260040160405180910390fd5b6122b7838383614761565b60035460405163a9059cbb60e01b81526001600160a01b039182166004820152602481018390529083169063a9059cbb90604401602060405180830381600087803b15801561230557600080fd5b505af1925050508015612335575060408051601f3d908101601f1916820190925261233291810190615de6565b60015b61233e57612340565b505b604080516001600160a01b038481168252602082018490523392908616917f6e10247c3c094d220ee99436c164b7f38d63b335a20ed817cbefaee4bb02d20e91015b60405180910390a3505050565b6003546001600160a01b031633146123ba5760405163070545c960e51b815260040160405180910390fd5b6001600160a01b0381166123e15760405163d92e233d60e01b815260040160405180910390fd5b601e80546001600160a01b0319166001600160a01b0383169081179091556040519081527f71973fd672e51deb8f739b1f7e1eab991936645acd6f83e2bde6eeeaff5490b090602001611f50565b3360009081526005602052604090205460ff1661245f57604051637e57b1e160e01b815260040160405180910390fd5b6001600160a01b0381166000908152600c602052604090205460ff16612498576040516310cec38560e21b815260040160405180910390fd5b6124a36007826150bc565b50601c546001600160a01b038083166000818152600d60209081526040808320949095168083529381528482205492825260188152848220848352905292909220546124f1928492916150e7565b60405133906001600160a01b038316907f038a17b9b553c0c3fc2ed14b957a5d8420a1666fd2efe5c1b3fe5f23eea61bb390600090a350565b6060610db0601a61471a565b600080612542836120fb565b6022546001600160a01b0385166000908152602960205260409020549192509061256c9042615bb5565b1015610ec25760008111612598576001600160a01b0383166000908152600f60205260409020546125d2565b6001600160a01b038316600090815260106020908152604080832054600f909252909120546125c8908390615d82565b6125d29190615db7565b915061223d565b6003546001600160a01b031633146126045760405163070545c960e51b815260040160405180910390fd5b60208181556040518281527fc8d443472c9783cc36f8f5f5091f08ce9f37fc2f9e6d79cf1d9aaf40a433fee29101611f50565b6001600160a01b03828116600090815260016020526040902054839116331461267357604051636efb4f4160e11b815260040160405180910390fd5b816001600160a01b0316836001600160a01b031614156126a65760405163afe7ad4960e01b815260040160405180910390fd5b6001600160a01b038381166000818152602c6020908152604080832080546001600160a01b0319169588169586179055602d8252808320858452825291829020429055905192835290917fff0456758201108de53c0ff04c69988d4678ff455b2ce6f733328cf85722c04c91015b60405180910390a2505050565b6060610db0600761471a565b6003546001600160a01b031633146127585760405163070545c960e51b815260040160405180910390fd5b6001600160a01b03811661277f5760405163d92e233d60e01b815260040160405180910390fd5b6001600160a01b03831673eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee14156127e0576040516001600160a01b0382169083156108fc029084906000818181858888f193505050501580156127da573d6000803e3d6000fd5b506127f4565b6127f46001600160a01b0384168284614fb8565b604080516001600160a01b0385811682526020820185905283168183015290517f9a3055ded8c8b5f21bbf4946c5afab6e1fa8b3f057922658e5e1ade125fb0b1e9181900360600190a1505050565b6003546001600160a01b0316331461286e5760405163070545c960e51b815260040160405180910390fd5b6001600160a01b0381166128955760405163d92e233d60e01b815260040160405180910390fd5b6001600160a01b03811660009081526006602052604090205460ff16156128cf5760405163274e25dd60e11b815260040160405180910390fd5b6001600160a01b038116600081815260066020908152604091829020805460ff1916600117905590519182527f8addc69f897ecca0e41d70ed4ff9d75a9148a615a0fbda8597e53aea2684302f9101611f50565b6001600160a01b03838116600090815260016020526040902054849116331461295f57604051636efb4f4160e11b815260040160405180910390fd5b6001600160a01b0382166129865760405163d92e233d60e01b815260040160405180910390fd5b6001600160a01b038085166000908152601860209081526040808320938716835292905220546129c95760405163184c088160e21b815260040160405180910390fd5b6001600160a01b038085166000908152601760209081526040808320938716835292905220544211612a0e576040516327cfdcb760e01b815260040160405180910390fd5b6001600160a01b0384166000908152600c602052604090205460ff1615612a48576040516362e6201d60e01b815260040160405180910390fd5b6001600160a01b0380851660008181526018602090815260408083209488168084529482528083208054908490559383526017825280832085845290915281205590612a95908483614fb8565b826001600160a01b0316846001600160a01b0316866001600160a01b03167ffdb7893bf11f50c621e59cc7f1cf540e94295cb27ca869ec7ed7618ca792886284604051612ae491815260200190565b60405180910390a45050505050565b60026000541415612b165760405162461bcd60e51b81526004016115f990615d4b565b60026000908155338152600c602052604090205460ff1615612b4b576040516362e6201d60e01b815260040160405180910390fd5b612b56601a3361472e565b15612b745760405163d7229c4360e01b815260040160405180910390fd5b601f54612b819042615bcc565b3360009081526016602090815260408083206001600160a01b03871680855292528083209390935591516370a0823160e01b81523060048201529091906370a082319060240160206040518083038186803b158015612bdf57600080fd5b505afa158015612bf3573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612c179190615c0b565b9050612c2e6001600160a01b03841633308561507e565b6040516370a0823160e01b815230600482015281906001600160a01b038516906370a082319060240160206040518083038186803b158015612c6f57600080fd5b505afa158015612c83573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612ca79190615c0b565b612cb19190615bb5565b336000908152601960209081526040808320805460ff19166001179055601582528083206001600160a01b0388168452909152812080549294508492909190612cfb908490615bcc565b90915550506040518281526001600160a01b0384169033907fa7e66869262026842e8d81f5e6806cdc8d846e27c824e2e22f4fe51442771b349060200160405180910390a35050600160005550565b602054612d579042615bcc565b3360008181526017602090815260408083206001600160a01b03881680855290835281842095909555928252600d81528282209382529290925281208054839290612da3908490615bb5565b90915550503360009081526018602090815260408083206001600160a01b038616845290915281208054839290612ddb908490615bcc565b90915550506040518181526001600160a01b0383169033907f9aaab310d247ad45aef26bbdefc4ebf20c728fdb84c92b95b2b05d21826940de9060200160405180910390a35050565b6003546001600160a01b03163314612e4f5760405163070545c960e51b815260040160405180910390fd5b6001600160a01b03811660009081526005602052604090205460ff16612e88576040516336fe17e760e21b815260040160405180910390fd5b6001600160a01b038116600081815260056020908152604091829020805460ff1916905590519182527f3ed8cbce8cab40e59282f1743e2b607effa08b5cbe0111bb4721134f2f80d0259101611f50565b6001600160a01b038181166000908152600160205260409020548291163314612f1557604051636efb4f4160e11b815260040160405180910390fd5b6001600160a01b0383166000908152600c602052604090205460ff1680612f5457506001600160a01b0382166000908152600c602052604090205460ff165b15612f725760405163ad2fdf3b60e01b815260040160405180910390fd5b6001600160a01b038381166000908152602c6020526040902054811690831614612faf57604051630ced616b60e21b815260040160405180910390fd5b6001600160a01b038084166000908152602d6020908152604080832093861683529290522054612fe190603c90615bcc565b421015613001576040516356248e9760e01b815260040160405180910390fd5b61300a83615020565b61301382615020565b6001600160a01b0383166000908152601160205260408120613034906150d1565b1115613116576001600160a01b038316600090815260116020526040812061305c90826150db565b6001600160a01b038086166000908152600e6020818152604080842085871680865290835281852054958a1685529282528084209284529190528120805493945091926130aa908490615bcc565b90915550506001600160a01b038085166000818152600e6020908152604080832094861683529381528382208290559181526011909152206130ec90826150bc565b506001600160a01b038316600090815260116020526040902061310f9082614e70565b5050613013565b6001600160a01b0383166000908152601260205260408120613137906150d1565b1115613219576001600160a01b038316600090815260126020526040812061315f90826150db565b6001600160a01b03808616600090815260286020818152604080842085871680865290835281852054958a1685529282528084209284529190528120805493945091926131ad908490615bcc565b90915550506001600160a01b03808516600090815260286020908152604080832085851684528252808320839055928616825260129052206131ef9082614e70565b506001600160a01b038416600090815260126020526040902061321290826150bc565b5050613116565b6001600160a01b038084166000908152601060205260408082205492851682528120805490919061324b908490615bcc565b90915550506001600160a01b038084166000908152601060209081526040808320839055600f9091528082205492851682528120805490919061328f908490615bcc565b90915550506001600160a01b0383166000908152600f6020908152604080832083905560299091528120556132c5601a846150bc565b506001600160a01b03838116600081815260016020908152604080832080546001600160a01b031990811690915560028352818420805482169055602d8352818420958816808552958352818420849055848452602c835292819020805490931690925590519182527f9b712b63e3fb1325fa042d3c238ce8144937875065900528ea1e4f3b00f379f29101612714565b600954601c54601d546040516370a0823160e01b81526001600160a01b0391821660048201526000939291909116906370a082319060240160206040518083038186803b1580156133a657600080fd5b505afa1580156133ba573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906133de9190615c0b565b610db09190615e01565b6003546001600160a01b031633146134135760405163070545c960e51b815260040160405180910390fd5b60238190556040518181527fbdcfd7b8482f31cff6a87c362d9e2e3887f4cdc2018c7c485d8e78a7b2fadb6990602001611f50565b6003546001600160a01b031633146134735760405163070545c960e51b815260040160405180910390fd5b61347e602682614e70565b61349b5760405163f25e6b9f60e01b815260040160405180910390fd5b601e5460405163eb37d34960e01b81526001600160a01b0383811660048301529091169063eb37d3499060240160206040518083038186803b1580156134e057600080fd5b505afa1580156134f4573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906135189190615e40565b6001600160a01b03828116600090815260136020526040902080546001600160a01b0319169290911691821790556135635760405163d92e233d60e01b815260040160405180910390fd5b601e546001600160a01b038281166000908152601360205260409081902054905163696a437b60e01b8152908216600482015291169063696a437b9060240160206040518083038186803b1580156135ba57600080fd5b505afa1580156135ce573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906135f29190615de6565b6001600160a01b0382166000908152601460205260409020805460ff1916911515919091179055613622816111fc565b6001600160a01b0382166000818152602b6020908152604091829020845181548684015166ffffffffffffff908116600160381b026001600160701b031990921692169190911717815593820151600190940193909355519081527fabfa8db4d238fa78bf4e15fcc91328dd35f3978f200e2857a56bb719732b7b0b9101611f50565b602e546136c557604051630262ab9b60e61b815260040160405180910390fd5b60006136cf614df8565b336000818152600c60205260409020549192509060ff16156137045760405163ad2fdf3b60e01b815260040160405180910390fd5b61370f601a8261472e565b61372b5760405162941a5760e11b815260040160405180910390fd5b61373481614a97565b15613791576001600160a01b038116600081815260296020908152604080832054600f835281842054601084529382902054825191825292810193909352820152600080516020615f318339815191529060600160405180910390a25b601e546001600160a01b038581166000908152600d60209081526040808320601c548516845290915280822054905163435b21c160e01b8152600481019190915290928392839291169063435b21c19060240160606040518083038186803b1580156137fc57600080fd5b505afa158015613810573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906138349190615e5d565b919450925090506000613852868361384c8a87615d82565b8761524c565b6001600160a01b0386166000908152600f60205260409020549091508111156138d65761387e85614c6d565b6001600160a01b038516600081815260296020908152604080832054600f835281842054601084529382902054825191825292810193909352820152600080516020615f318339815191529060600160405180910390a25b6138e1858983614cfb565b6000602e55601c5460408051838152602081018990526001600160a01b038b811693898216939116917f46f2180879a7123a197cc3828c28955d70d661c70acbdc02450daf5f9a9c1cfa910160405180910390a45050505050505050565b6003546001600160a01b0316331461396a5760405163070545c960e51b815260040160405180910390fd5b601f8190556040518181527fd319ef78d2b690bb773fcccc2d096306bac7c9222dd0bb6b300f461e4a376b4390602001611f50565b3360009081526005602052604090205460ff166139cf57604051637e57b1e160e01b815260040160405180910390fd5b6001600160a01b0384166000908152600c602052604090205460ff16613a08576040516310cec38560e21b815260040160405180910390fd5b613a14848484846150e7565b336001600160a01b0385167f10a73de7ab6e9023aa6e2bc23f7abf4dcef591487e7e55f44c00e34fe60d56db613a4a8486615bcc565b6040519081526020016115c8565b613a63601a8261472e565b15613a8157604051630809740d60e01b815260040160405180910390fd5b6001600160a01b03811660009081526019602052604090205460ff1615613abb57604051632f3d320560e01b815260040160405180910390fd5b613ac6601a82614e70565b506001600160a01b03811660008181526001602052604080822080546001600160a01b0319163390811790915590519092917fed3faef50715743626cd57de74281a2b17cdbfc11c0486feda541fb911e0293d91a350565b6003546001600160a01b03163314613b495760405163070545c960e51b815260040160405180910390fd5b6001600160a01b038116613b705760405163d92e233d60e01b815260040160405180910390fd5b601d80546001600160a01b0319166001600160a01b0383169081179091556040519081527feb931b4b5a98d20a6b1e6693a7c59d8e337a06e2f1473bb776e19251db7ae25090602001611f50565b6003546001600160a01b03163314613be95760405163070545c960e51b815260040160405180910390fd5b62015180811015613c0d57604051633f384aad60e21b815260040160405180910390fd5b60228190556040518181527f54aafa56429e22230b52f1495588ffc632277d74f3a85ec755e13ac50c1584d990602001611f50565b60026000541415613c655760405162461bcd60e51b81526004016115f990615d4b565b600260009081556001600160a01b03858116825260016020526040909120548591163314613ca657604051636efb4f4160e11b815260040160405180910390fd5b6001600160a01b03808616600090815260256020908152604080832093881683529290522054613cd890603c90615bcc565b4211613cf757604051631e0b407560e01b815260040160405180910390fd5b6001600160a01b038086166000908152600e6020908152604080832093881683529290522054831115613d3d5760405163024ae82d60e61b815260040160405180910390fd5b6001600160a01b0385166000908152600c602052604090205460ff1615613d775760405163ad2fdf3b60e01b815260040160405180910390fd5b6001600160a01b038086166000908152600e6020908152604080832093881683529290529081208054859290613dae908490615bb5565b90915550613dc890506001600160a01b0385168385614fb8565b6001600160a01b038086166000908152600e6020908152604080832093881683529290522054613e16576001600160a01b0385166000908152601160205260409020613e1490856150bc565b505b816001600160a01b0316846001600160a01b0316866001600160a01b03167f53e982dd9ec088d634c74c98fbbc161f808b4b6469a26c657120b9a31cb34bfe86604051613e6591815260200190565b60405180910390a450506001600055505050565b336000818152600c602052604090205460ff1615613eaa5760405163ad2fdf3b60e01b815260040160405180910390fd5b6001600160a01b0383166000908152600c602052604090205460ff1615613ee4576040516362e6201d60e01b815260040160405180910390fd5b613eef601a8261472e565b613f0b5760405162941a5760e11b815260040160405180910390fd5b6001600160a01b038082166000908152600e6020908152604080832093881683529290522054821115613f515760405163356680b760e01b815260040160405180910390fd5b6001600160a01b038082166000908152600e6020908152604080832093881683529290529081208054849290613f88908490615bb5565b90915550613fa290506001600160a01b0385168484614fb8565b826001600160a01b0316816001600160a01b0316856001600160a01b03167f46f2180879a7123a197cc3828c28955d70d661c70acbdc02450daf5f9a9c1cfa85613fea614df8565b6040805192835260208301919091520160405180910390a450505050565b6003546001600160a01b031633146140335760405163070545c960e51b815260040160405180910390fd5b60218190556040518181527f24d51b415694a791b1c77df7817c075ac82b83ce611bcd8627d2e66cf37aa3e790602001611f50565b6003546001600160a01b031633146140935760405163070545c960e51b815260040160405180910390fd5b6001600160a01b0381166140ba5760405163d92e233d60e01b815260040160405180910390fd5b6140c5600954614f70565b601c80546001600160a01b0319166001600160a01b0383169081179091556040519081527f1d1a3e7caf0717056e48dc8aefa54d806c7af86324fece4e5d49f8e1f01f84bf90602001611f50565b6003546001600160a01b0316331461413e5760405163070545c960e51b815260040160405180910390fd5b6001600160a01b03811660009081526006602052604090205460ff1661417757604051633ca0d42760e11b815260040160405180910390fd5b6001600160a01b038116600081815260066020908152604091829020805460ff1916905590519182527f5e8bd21d0a98cb2caf33706e56139ff40ffbdca7ec5d9d412a0a2292496dc70e9101611f50565b6003546001600160a01b031633146141f35760405163070545c960e51b815260040160405180910390fd5b6141fc816152a9565b50565b3360009081526005602052604090205460ff1661422f57604051637e57b1e160e01b815260040160405180910390fd5b6001600160a01b0383166000908152600c602052604090205460ff16614268576040516310cec38560e21b815260040160405180910390fd5b6001600160a01b038316600090815260116020526040902061428a908361472e565b6142a757604051632eda7a1160e01b815260040160405180910390fd5b6001600160a01b038084166000908152600e60209081526040808320938616835292905220548111156142ec5760405162919bed60e01b815260040160405180910390fd5b60035460405163a9059cbb60e01b81526001600160a01b039182166004820152602481018390529083169063a9059cbb90604401602060405180830381600087803b15801561433a57600080fd5b505af192505050801561436a575060408051601f3d908101601f1916820190925261436791810190615de6565b60015b61437357614375565b505b6001600160a01b038084166000908152600e60209081526040808320938616835292905290812080548392906143ac908490615bb5565b90915550506001600160a01b038084166000908152600e60209081526040808320938616835292905220546143ff576001600160a01b03831660009081526011602052604090206143fd90836150bc565b505b604080516001600160a01b038481168252602082018490523392908616917f20262b97130b5cb8f80624eed2733df2b05db4a0789b4a3d0157e1d3183331049101612382565b3360009081526006602052604090205460ff1661447557604051630942721960e31b815260040160405180910390fd5b6001600160a01b0381166000908152600c602052604090205460ff16156144af576040516304ee891b60e11b815260040160405180910390fd5b6001600160a01b0381166000818152600c6020526040808220805460ff19166001179055513392917f070125a1c0f5202217aae14ec399abfaaa13c2fd98a91d43bd3a897dd4751e8091a350565b6000614507614df8565b602e5561451560078761472e565b801561454657506001600160a01b038087166000908152600d60209081526040808320938916835292905220548411155b801561456a57506001600160a01b0386166000908152600a60205260409020548311155b801561459957506001600160a01b0386166000908152600b602052604090205482906145969042615bb5565b10155b156145dd577f4851cad52e624c8f7a1d44c28a80db05988ba2451fc0db6b0ec338d8eca95afb602e546040516145d191815260200190565b60405180910390a15060015b95945050505050565b6003546001600160a01b031633146146115760405163070545c960e51b815260040160405180910390fd5b61461c601a8361472e565b61463957604051636211d34960e01b815260040160405180910390fd5b61464282615020565b6001600160a01b0382166000908152600f60205260408120805483929061466a908490615bcc565b90915550506001600160a01b038216600081815260296020908152604080832054600f909252918290205491517f5abcf5031fdbd3badb9d1e09094208de329aee72730e87650f346584205d23d1926146ca928252602082015260400190565b60405180910390a25050565b6000602254826146e69190615e8b565b610ec29083615bb5565b600060225483101561223d576022546147098385615d82565b6147139190615db7565b9050610ec2565b606060006147278361532c565b9392505050565b6001600160a01b03811660009081526001830160205260408120541515614727565b6000610ec282602254602354615388565b600260005414156147845760405162461bcd60e51b81526004016115f990615d4b565b600260009081556001600160a01b03841681526012602052604090206147aa908361472e565b6147c6576040516241cfa560e21b815260040160405180910390fd5b6001600160a01b0380841660009081526028602090815260408083209386168352929052205481111561480c5760405163435b562560e01b815260040160405180910390fd5b61481583615436565b6000614824610eb2838561496f565b6001600160a01b038516600090815260106020526040902054909150156148da576001600160a01b038416600090815260106020908152604080832054600f90925290912054614875908390615d82565b61487f9190615db7565b6001600160a01b0385166000908152600f6020526040812080549091906148a7908490615bb5565b90915550506001600160a01b038416600090815260106020526040812080548392906148d4908490615bb5565b90915550505b6001600160a01b03808516600090815260286020908152604080832093871683529290529081208054849290614911908490615bb5565b90915550506001600160a01b03808516600090815260286020908152604080832093871683529290522054614964576001600160a01b038416600090815260126020526040902061496290846150bc565b505b505060016000555050565b6001600160a01b0381166000908152602b602052604081206001015415610ec2576001600160a01b03821660009081526014602052604081205460ff166149e1576001600160a01b0383166000908152602b60205260409020546149dc90600160381b900460060b615be4565b614a05565b6001600160a01b0383166000908152602b6020526040902054600160381b900460060b5b601e5460225460405163a0d2710760e01b815260048101889052600684900b602482015260448101919091529192506001600160a01b03169063a0d271079060640160206040518083038186803b158015614a5f57600080fd5b505afa158015614a73573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d9c9190615c0b565b6000614aa2426146d6565b6001600160a01b038316600090815260296020526040902054101561141657614ad260225442610cc09190615bb5565b6001600160a01b03831660009081526029602052604090205411614b4857614af982615436565b6001600160a01b038216600090815260106020908152604080832054600f90925290912055614b27426146d6565b6001600160a01b038316600090815260296020526040902055506001919050565b6022546001600160a01b038316600090815260296020526040902054614b6e9042615bb5565b10614bca57614b7c82615436565b6001600160a01b038216600090815260106020908152604080832054600f83528184205560225460299092528220805491929091614bbb908490615bcc565b90915550600191506114169050565b614bd3426146d6565b6001600160a01b0383166000908152602a60205260409020541015611416576001600160a01b038216600090815260106020526040902054614c1483615436565b6001600160a01b038316600090815260106020908152604080832054600f909252909120548291614c4491615d82565b614c4e9190615db7565b6001600160a01b0384166000908152600f602052604090205550919050565b6001600160a01b038116600090815260296020526040902054614cb290614c949042615bb5565b6001600160a01b0383166000908152601060205260409020546146f0565b6001600160a01b0382166000908152600f602052604081208054909190614cda908490615bcc565b90915550506001600160a01b03166000908152602960205260409020429055565b6001600160a01b0383166000908152600f6020526040902054811115614d345760405163356680b760e01b815260040160405180910390fd5b6001600160a01b0383166000908152602a60209081526040808320429055600f90915281208054839290614d69908490615bb5565b90915550506001600160a01b038083166000908152600d60209081526040808320601c5490941683529290529081208054839290614da8908490615bcc565b90915550506001600160a01b0382166000908152600a602052604081208054839290614dd5908490615bcc565b925050819055508060096000828254614dee9190615bcc565b9091555050505050565b6000603f5a614e08906040615d82565b610db09190615db7565b60048054600380546001600160a01b0383166001600160a01b031991821681179092559091169091556040519081527f5d5d6e01b731c3e68060f7fe13156f6197d4aeffc2d6f498e34c717ae616b7349060200160405180910390a1565b6000614727836001600160a01b03841661545b565b601c54601d5460405163095ea7b360e01b81526001600160a01b0391821660048201526024810184905291169063095ea7b390604401602060405180830381600087803b158015614ed557600080fd5b505af1158015614ee9573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190614f0d9190615de6565b50601d5460405163b6b55f2560e01b8152600481018390526001600160a01b039091169063b6b55f25906024015b600060405180830381600087803b158015614f5557600080fd5b505af1158015614f69573d6000803e3d6000fd5b5050505050565b8060096000828254614f829190615bb5565b9091555050601d5460405163140e25ad60e31b8152600481018390526001600160a01b039091169063a0712d6890602401614f3b565b6040516001600160a01b03831660248201526044810182905261501b90849063a9059cbb60e01b906064015b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b0319909316929092179091526154aa565b505050565b61502981614a97565b5061503381614c6d565b6001600160a01b0381166000908152600f6020908152604080832054601090925290912054615062919061557c565b6001600160a01b039091166000908152600f6020526040902055565b6040516001600160a01b03808516602483015283166044820152606481018290526150b69085906323b872dd60e01b90608401614fe4565b50505050565b6000614727836001600160a01b038416615592565b6000610ec2825490565b60006147278383615685565b601c546001600160a01b038481169116146151ce576003546001600160a01b038085169163a9059cbb911661511c8486615bcc565b6040516001600160e01b031960e085901b1681526001600160a01b0390921660048301526024820152604401602060405180830381600087803b15801561516257600080fd5b505af1925050508015615192575060408051601f3d908101601f1916820190925261518f91810190615de6565b60015b6151cc573d8080156151c0576040519150601f19603f3d011682016040523d82523d6000602084013e6151c5565b606091505b50506151ce565b505b6001600160a01b038085166000908152600d6020908152604080832093871683529290529081208054849290615205908490615bb5565b90915550506001600160a01b03808516600090815260186020908152604080832093871683529290529081208054839290615241908490615bb5565b909155505050505050565b6000808486602e5461525e9190615bb5565b6152689190615bcc565b9050670de0b6b3a7640000846127106152818685615d82565b61528b9190615db7565b6152959190615d82565b61529f9190615db7565b9695505050505050565b6001600160a01b0381166152d05760405163d92e233d60e01b815260040160405180910390fd5b600480546001600160a01b0319166001600160a01b038381169182179092556003546040805191909316815260208101919091527f6353ec38ac394f8be94bfafcdd3580d356470599059eaeebedc3207e1cc03dec9101611f50565b60608160000180548060200260200160405190810160405280929190818152602001828054801561537c57602002820191906000526020600020905b815481526020019060010190808311615368575b50505050509050919050565b6000808060001985870985870292508281108382030391505080600014156153c257600084116153b757600080fd5b508290049050614727565b8084116153ce57600080fd5b600084868809600260036001881981018916988990049182028318808302840302808302840302808302840302808302840302808302840302918202909203026000889003889004909101858311909403939093029303949094049190911702949350505050565b61543f816156af565b6001600160a01b03909116600090815260106020526040902055565b60008181526001830160205260408120546154a257508154600181810184556000848152602080822090930184905584548482528286019093526040902091909155610ec2565b506000610ec2565b60006154ff826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b03166157ea9092919063ffffffff16565b80519091501561501b578080602001905181019061551d9190615de6565b61501b5760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b60648201526084016115f9565b600081831061558b5781614727565b5090919050565b6000818152600183016020526040812054801561567b5760006155b6600183615bb5565b85549091506000906155ca90600190615bb5565b905081811461562f5760008660000182815481106155ea576155ea615c24565b906000526020600020015490508087600001848154811061560d5761560d615c24565b6000918252602080832090910192909255918252600188019052604090208390555b855486908061564057615640615e9f565b600190038181906000526020600020016000905590558560010160008681526020019081526020016000206000905560019350505050610ec2565b6000915050610ec2565b600082600001828154811061569c5761569c615c24565b9060005260206000200154905092915050565b6000805b6001600160a01b03831660009081526012602052604090206156d4906150d1565b81101561223d576001600160a01b03831660009081526012602052604081206156fd90836150db565b905061570a60268261472e565b156157d757615718426146d6565b6001600160a01b0382166000908152602b60205260409020600101541461579657615742816111fc565b6001600160a01b0382166000908152602b6020908152604091829020835181549285015166ffffffffffffff908116600160381b026001600160701b03199094169116179190911781559101516001909101555b6001600160a01b038085166000908152602860209081526040808320938516835292905220546157ca90610eb2908361496f565b6157d49084615bcc565b92505b50806157e281615dcb565b9150506156b3565b6060610d9c848460008585843b6158435760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e747261637400000060448201526064016115f9565b600080866001600160a01b0316858760405161585f9190615ee1565b60006040518083038185875af1925050503d806000811461589c576040519150601f19603f3d011682016040523d82523d6000602084013e6158a1565b606091505b50915091506158b18282866158bc565b979650505050505050565b606083156158cb575081614727565b8251156158db5782518084602001fd5b8160405162461bcd60e51b81526004016115f99190615efd565b6001600160a01b03811681146141fc57600080fd5b60006020828403121561591c57600080fd5b8135614727816158f5565b6000806040838503121561593a57600080fd5b8235615945816158f5565b91506020830135615955816158f5565b809150509250929050565b6020808252825182820181905260009190848201906040850190845b818110156159a15783516001600160a01b03168352928401929184019160010161597c565b50909695505050505050565b600080604083850312156159c057600080fd5b82356159cb816158f5565b946020939093013593505050565b6000806000606084860312156159ee57600080fd5b83356159f9816158f5565b92506020840135615a09816158f5565b929592945050506040919091013590565b600060208284031215615a2c57600080fd5b5035919050565b600080600060608486031215615a4857600080fd5b8335615a53816158f5565b9250602084013591506040840135615a6a816158f5565b809150509250925092565b600080600060608486031215615a8a57600080fd5b8335615a95816158f5565b92506020840135615aa5816158f5565b91506040840135615a6a816158f5565b60008060008060808587031215615acb57600080fd5b8435615ad6816158f5565b93506020850135615ae6816158f5565b93969395505050506040820135916060013590565b60008060008060808587031215615b1157600080fd5b8435615b1c816158f5565b93506020850135615b2c816158f5565b9250604085013591506060850135615b43816158f5565b939692955090935050565b600080600080600060a08688031215615b6657600080fd5b8535615b71816158f5565b94506020860135615b81816158f5565b94979496505050506040830135926060810135926080909101359150565b634e487b7160e01b600052601160045260246000fd5b600082821015615bc757615bc7615b9f565b500390565b60008219821115615bdf57615bdf615b9f565b500190565b60008160060b667fffffffffffff19811415615c0257615c02615b9f565b60000392915050565b600060208284031215615c1d57600080fd5b5051919050565b634e487b7160e01b600052603260045260246000fd5b6001600160a01b038316815260406020808301829052835191830182905260009184820191906060850190845b81811015615c8957845163ffffffff1683529383019391830191600101615c67565b5090979650505050505050565b8051600681900b811461141657600080fd5b8051801515811461141657600080fd5b600080600060608486031215615ccd57600080fd5b615cd684615c96565b9250615ce460208501615c96565b9150615cf260408501615ca8565b90509250925092565b60008160060b8360060b6000811281667fffffffffffff1901831281151615615d2657615d26615b9f565b81667fffffffffffff018313811615615d4157615d41615b9f565b5090039392505050565b6020808252601f908201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604082015260600190565b6000816000190483118215151615615d9c57615d9c615b9f565b500290565b634e487b7160e01b600052601260045260246000fd5b600082615dc657615dc6615da1565b500490565b6000600019821415615ddf57615ddf615b9f565b5060010190565b600060208284031215615df857600080fd5b61472782615ca8565b60008083128015600160ff1b850184121615615e1f57615e1f615b9f565b6001600160ff1b0384018313811615615e3a57615e3a615b9f565b50500390565b600060208284031215615e5257600080fd5b8151614727816158f5565b600080600060608486031215615e7257600080fd5b8351925060208401519150604084015190509250925092565b600082615e9a57615e9a615da1565b500690565b634e487b7160e01b600052603160045260246000fd5b60005b83811015615ed0578181015183820152602001615eb8565b838111156150b65750506000910152565b60008251615ef3818460208701615eb5565b9190910192915050565b6020815260008251806020840152615f1c816040850160208701615eb5565b601f01601f1916919091016040019291505056feee3f0daba9837d1ab0597acf34328550e4832d02e24e467825e7c2dd318c3820a2646970667358221220ea34d4a4c7cc458a72d55d6a67078e26d27a67e8afd37f220aad290c0eca863b64736f6c63430008080033", + "devdoc": { + "kind": "dev", + "methods": { + "acceptJobMigration(address,address)": { + "details": "Unbond/withdraw process doesn't get migrated", + "params": { + "_fromJob": "The address of the job that requested to migrate", + "_toJob": "The address to which the job wants to migrate to" + } + }, + "acceptJobOwnership(address)": { + "params": { + "_job": "The address of the job" + } + }, + "activate(address)": { + "params": { + "_bonding": "The asset being activated as bond collateral" + } + }, + "addJob(address)": { + "params": { + "_job": "Address of the contract for which work should be performed" + } + }, + "addLiquidityToJob(address,address,uint256)": { + "params": { + "_amount": "The amount of liquidity tokens to add", + "_job": "The address of the job to assign liquidity to", + "_liquidity": "The liquidity being added" + } + }, + "addTokenCreditsToJob(address,address,uint256)": { + "params": { + "_amount": "The amount of credit being added", + "_job": "The address of the job being credited", + "_token": "The address of the token being credited" + } + }, + "approveLiquidity(address)": { + "details": "Function should be called after setting an oracle in Keep3rHelperSidechain", + "params": { + "_liquidity": "Address of the liquidity token being approved" + } + }, + "approvedLiquidities()": { + "returns": { + "_list": "An array of addresses with all the approved liquidity pairs" + } + }, + "bond(address,uint256)": { + "params": { + "_amount": "The amount of bonding asset being bonded", + "_bonding": "The asset being bonded" + } + }, + "bondedPayment(address,uint256)": { + "details": "Pays the keeper that performs the work with KP3R", + "params": { + "_keeper": "Address of the keeper that performed the work", + "_payment": "The reward that should be allocated for the job" + } + }, + "changeJobOwnership(address,address)": { + "params": { + "_job": "The address of the job", + "_newOwner": "The address of the proposed new owner" + } + }, + "directTokenPayment(address,address,uint256)": { + "details": "Pays the keeper that performs the work with a specific token", + "params": { + "_amount": "The reward that should be allocated", + "_keeper": "Address of the keeper that performed the work", + "_token": "The asset being awarded to the keeper" + } + }, + "dispute(address)": { + "params": { + "_jobOrKeeper": "The address in dispute" + } + }, + "forceLiquidityCreditsToJob(address,uint256)": { + "params": { + "_amount": "The amount of liquidity credits to gift", + "_job": "The address of the job being credited" + } + }, + "isBondedKeeper(address,address,uint256,uint256,uint256)": { + "details": "Should be used for protected functions", + "params": { + "_age": "The minimum keeper age required", + "_bond": "The bond token being evaluated", + "_earned": "The minimum funds earned in the keepers lifetime", + "_keeper": "The keeper to check", + "_minBond": "The minimum amount of bonded tokens" + }, + "returns": { + "_isBondedKeeper": "Whether the `_keeper` meets the given requirements" + } + }, + "isKeeper(address)": { + "details": "Can be used for general (non critical) functions", + "params": { + "_keeper": "The keeper being investigated" + }, + "returns": { + "_isKeeper": "Whether the address passed as a parameter is a keeper or not" + } + }, + "jobLiquidityCredits(address)": { + "params": { + "_job": "The address of the job of which we want to know the liquidity credits" + }, + "returns": { + "_liquidityCredits": "The liquidity credits of a given job" + } + }, + "jobPeriodCredits(address)": { + "params": { + "_job": "The address of the job of which we want to know the period credits" + }, + "returns": { + "_periodCredits": "The credits the given job has at the current period" + } + }, + "jobs()": { + "returns": { + "_list": "Array with all the jobs in _jobs" + } + }, + "keepers()": { + "returns": { + "_list": "Array with all the keepers in _keepers" + } + }, + "migrateJob(address,address)": { + "params": { + "_fromJob": "The address of the job that is requesting to migrate", + "_toJob": "The address at which the job is requesting to migrate" + } + }, + "observeLiquidity(address)": { + "params": { + "_liquidity": "Address of the liquidity token being observed" + } + }, + "quoteLiquidity(address,uint256)": { + "details": "_periodCredits = underlying KP3Rs for given liquidity amount * rewardPeriod / inflationPeriod", + "params": { + "_amount": "The amount of liquidity to provide", + "_liquidity": "The address of the liquidity to provide" + }, + "returns": { + "_periodCredits": "The amount of KP3R periodically minted for the given liquidity" + } + }, + "resolve(address)": { + "params": { + "_jobOrKeeper": "The address cleared" + } + }, + "revoke(address)": { + "params": { + "_keeper": "The address being slashed" + } + }, + "revokeLiquidity(address)": { + "params": { + "_liquidity": "The liquidity no longer accepted" + } + }, + "sendDust(address,uint256,address)": { + "params": { + "_amount": "The amont of the token that will be transferred", + "_to": "The address that will receive the idle funds", + "_token": "The token that will be transferred" + } + }, + "setBondTime(uint256)": { + "params": { + "_bond": "The new bond time" + } + }, + "setFee(uint256)": { + "params": { + "_fee": "The new fee" + } + }, + "setInflationPeriod(uint256)": { + "params": { + "_inflationPeriod": "The new inflation period" + } + }, + "setKeep3rHelper(address)": { + "params": { + "_keep3rHelper": "The Keep3rHelper address" + } + }, + "setKeep3rV1(address)": { + "params": { + "_keep3rV1": "The Keep3rV1 address" + } + }, + "setKeep3rV1Proxy(address)": { + "params": { + "_keep3rV1Proxy": "The Keep3rV1Proxy address" + } + }, + "setLiquidityMinimum(uint256)": { + "params": { + "_liquidityMinimum": "The new minimum amount of liquidity" + } + }, + "setPendingGovernor(address)": { + "params": { + "_pendingGovernor": "Address of the proposed new governor" + } + }, + "setRewardPeriodTime(uint256)": { + "params": { + "_rewardPeriodTime": "The new amount of time required to pass between rewards" + } + }, + "setUnbondTime(uint256)": { + "params": { + "_unbond": "The new unbond time" + } + }, + "slash(address,address,uint256,uint256)": { + "params": { + "_bondAmount": "The bonded amount being slashed", + "_bonded": "The asset being slashed", + "_keeper": "The address being slashed", + "_unbondAmount": "The pending unbond amount being slashed" + } + }, + "slashLiquidityFromJob(address,address,uint256)": { + "params": { + "_amount": "The amount of liquidity that will be slashed", + "_job": "The address being slashed", + "_liquidity": "The address of the liquidity that will be slashed" + } + }, + "slashTokenFromJob(address,address,uint256)": { + "params": { + "_amount": "The amount of the token that will be slashed", + "_job": "The address of the job from which the token will be slashed", + "_token": "The address of the token that will be slashed" + } + }, + "totalJobCredits(address)": { + "params": { + "_job": "The address of the job of which we want to know the total credits" + }, + "returns": { + "_credits": "The total credits of the given job" + } + }, + "unbond(address,uint256)": { + "params": { + "_amount": "Allows for partial unbonding", + "_bonding": "The asset being unbonded" + } + }, + "unbondLiquidityFromJob(address,address,uint256)": { + "details": "Can only be called by the job's owner", + "params": { + "_amount": "The amount of liquidity being removed", + "_job": "The address of the job being unbonded from", + "_liquidity": "The liquidity being unbonded" + } + }, + "virtualReserves()": { + "returns": { + "_virtualReserves": "The surplus amount of wKP3Rs in escrow contract" + } + }, + "withdraw(address)": { + "params": { + "_bonding": "The asset to withdraw from the bonding pool" + } + }, + "withdrawLiquidityFromJob(address,address,address)": { + "params": { + "_job": "The address of the job being withdrawn from", + "_liquidity": "The liquidity being withdrawn", + "_receiver": "The address that will receive the withdrawn liquidity" + } + }, + "withdrawTokenCreditsFromJob(address,address,uint256,address)": { + "params": { + "_amount": "The amount of token to be withdrawn", + "_job": "The address of the job from which the credits are withdrawn", + "_receiver": "The user that will receive tokens", + "_token": "The address of the token being withdrawn" + } + }, + "worked(address)": { + "details": "Sidechain implementation deprecates worked(address) as it should come with a usdPerGasUnit parameter" + }, + "worked(address,uint256)": { + "details": "Uses a USD per gas unit payment mechanism", + "params": { + "_keeper": "Address of the keeper that performed the work", + "_usdPerGasUnit": "Units of USD (in wei) per gas unit that should be rewarded to the keeper" + } + } + }, + "version": 1 + }, + "userdoc": { + "errors": { + "AlreadyAJob()": [ + { + "notice": "Throws when the address that is trying to register as a job is already a job" + } + ], + "AlreadyAKeeper()": [ + { + "notice": "Throws when the address that is trying to register as a keeper is already a keeper" + } + ], + "AlreadyDisputed()": [ + { + "notice": "Throws when a job or keeper is already disputed" + } + ], + "BondsLocked()": [ + { + "notice": "Throws if the time required to bond an asset has not passed yet" + } + ], + "BondsUnexistent()": [ + { + "notice": "Throws if there are no bonded assets" + } + ], + "Deprecated()": [ + { + "notice": "Throws when job contract calls deprecated worked(address) function" + } + ], + "Disputed()": [ + { + "notice": "Throws if either a job or a keeper is disputed" + } + ], + "DisputerExistent()": [ + { + "notice": "Throws if the address is already a registered disputer" + } + ], + "DisputerUnexistent()": [ + { + "notice": "Throws if caller is not a registered disputer" + } + ], + "GasNotInitialized()": [ + { + "notice": "Throws if work method was called without calling isKeeper or isBondedKeeper" + } + ], + "InsufficientFunds()": [ + { + "notice": "Throws if the amount of funds in the job is less than the payment that must be paid to the keeper that works that job" + } + ], + "InsufficientJobTokenCredits()": [ + { + "notice": "Throws when the user tries to withdraw more tokens than it has" + } + ], + "InvalidAddress()": [ + { + "notice": "Thrown if an address is invalid" + } + ], + "InvalidAmount()": [ + { + "notice": "Thrown if an amount is invalid" + } + ], + "JobAlreadyAdded()": [ + { + "notice": "Throws when trying to add a job that has already been added" + } + ], + "JobDisputed()": [ + { + "notice": "Throws when an action that requires an undisputed job is applied on a disputed job" + } + ], + "JobLiquidityInsufficient()": [ + { + "notice": "Throws when trying to remove more liquidity than the job has" + } + ], + "JobLiquidityLessThanMin()": [ + { + "notice": "Throws when trying to add less liquidity than the minimum liquidity required" + } + ], + "JobLiquidityUnexistent()": [ + { + "notice": "Throws when the job doesn't have the requested liquidity" + } + ], + "JobMigrationImpossible()": [ + { + "notice": "Throws when the address of the job that requests to migrate wants to migrate to its same address" + } + ], + "JobMigrationLocked()": [ + { + "notice": "Throws when cooldown between migrations has not yet passed" + } + ], + "JobMigrationUnavailable()": [ + { + "notice": "Throws when the _toJob address differs from the address being tracked in the pendingJobMigrations mapping" + } + ], + "JobTokenCreditsLocked()": [ + { + "notice": "Throws when the token withdraw cooldown has not yet passed" + } + ], + "JobTokenInsufficient()": [ + { + "notice": "Throws when someone tries to slash more tokens than the job has" + } + ], + "JobTokenUnexistent()": [ + { + "notice": "Throws when the token trying to be slashed doesn't exist" + } + ], + "JobUnapproved()": [ + { + "notice": "Throws if the address claiming to be a job is not in the list of approved jobs" + } + ], + "JobUnavailable()": [ + { + "notice": "Throws when an address is passed as a job, but that address is not a job" + } + ], + "LengthMismatch()": [ + { + "notice": "Thrown if the lengths of a set of lists mismatch" + } + ], + "LiquidityPairApproved()": [ + { + "notice": "Throws when the liquidity being approved has already been approved" + } + ], + "LiquidityPairUnapproved()": [ + { + "notice": "Throws when trying to add liquidity to an unapproved pool" + } + ], + "LiquidityPairUnexistent()": [ + { + "notice": "Throws when the liquidity being removed has not been approved" + } + ], + "MinRewardPeriod()": [ + { + "notice": "Throws if the reward period is less than the minimum reward period time" + } + ], + "NotDisputed()": [ + { + "notice": "Throws when a job or keeper is not disputed and someone tries to resolve the dispute" + } + ], + "OnlyDisputer()": [ + { + "notice": "Throws if the msg.sender is not a disputer or is not a part of governance" + } + ], + "OnlyGovernor()": [ + { + "notice": "Thrown if a non-governor user tries to call a OnlyGovernor function" + } + ], + "OnlyJobOwner()": [ + { + "notice": "Throws when the caller of the function is not the job owner" + } + ], + "OnlyPendingGovernor()": [ + { + "notice": "Thrown if a non-pending-governor user tries to call a OnlyPendingGovernor function" + } + ], + "OnlyPendingJobOwner()": [ + { + "notice": "Throws when the caller of the function is not the pending job owner" + } + ], + "OnlySlasher()": [ + { + "notice": "Throws if the msg.sender is not a slasher or is not a part of governance" + } + ], + "SlasherExistent()": [ + { + "notice": "Throws if the address is already a registered slasher" + } + ], + "SlasherUnexistent()": [ + { + "notice": "Throws if caller is not a registered slasher" + } + ], + "TokenUnallowed()": [ + { + "notice": "Throws when the token is KP3R, as it should not be used for direct token payments" + } + ], + "UnbondsLocked()": [ + { + "notice": "Throws if the time required to withdraw the bonds has not passed yet" + } + ], + "UnbondsUnexistent()": [ + { + "notice": "Throws if there are no bonds to withdraw" + } + ], + "ZeroAddress()": [ + { + "notice": "Thrown if an address is the zero address" + } + ], + "ZeroAmount()": [ + { + "notice": "Thrown if an amount is zero" + } + ] + }, + "events": { + "Activation(address,address,uint256)": { + "notice": "Emitted when Keep3rKeeperFundable#activate is called" + }, + "BondTimeChange(uint256)": { + "notice": "Emitted when bondTime is changed" + }, + "Bonding(address,address,uint256)": { + "notice": "Emitted when the bonding process of a new keeper begins" + }, + "Dispute(address,address)": { + "notice": "Emitted when a keeper or a job is disputed" + }, + "DisputerAdded(address)": { + "notice": "Emitted when a disputer is added" + }, + "DisputerRemoved(address)": { + "notice": "Emitted when a disputer is removed" + }, + "DustSent(address,uint256,address)": { + "notice": "Emitted when dust is sent" + }, + "FeeChange(uint256)": { + "notice": "Emitted when the fee is changed" + }, + "InflationPeriodChange(uint256)": { + "notice": "Emitted when the inflationPeriod is changed" + }, + "JobAddition(address,address)": { + "notice": "Emitted when Keep3rJobManager#addJob is called" + }, + "JobMigrationRequested(address,address)": { + "notice": "Emitted when Keep3rJobMigration#migrateJob function is called" + }, + "JobMigrationSuccessful(address,address)": { + "notice": "Emitted when Keep3rJobMigration#acceptJobMigration function is called" + }, + "JobOwnershipAssent(address,address,address)": { + "notice": "Emitted when Keep3rJobOwnership#JobOwnershipAssent is called" + }, + "JobOwnershipChange(address,address,address)": { + "notice": "Emitted when Keep3rJobOwnership#changeJobOwnership is called" + }, + "JobSlashLiquidity(address,address,address,uint256)": { + "notice": "Emitted when Keep3rJobDisputable#slashLiquidityFromJob is called" + }, + "JobSlashToken(address,address,address,uint256)": { + "notice": "Emitted when Keep3rJobDisputable#slashTokenFromJob is called" + }, + "Keep3rHelperChange(address)": { + "notice": "Emitted when the Keep3rHelper address is changed" + }, + "Keep3rV1Change(address)": { + "notice": "Emitted when the Keep3rV1 address is changed" + }, + "Keep3rV1ProxyChange(address)": { + "notice": "Emitted when the Keep3rV1Proxy address is changed" + }, + "KeeperRevoke(address,address)": { + "notice": "Emitted when Keep3rKeeperDisputable#revoke is called" + }, + "KeeperSlash(address,address,uint256)": { + "notice": "Emitted when Keep3rKeeperDisputable#slash is called" + }, + "KeeperValidation(uint256)": { + "notice": "Emitted when a keeper is validated before a job" + }, + "KeeperWork(address,address,address,uint256,uint256)": { + "notice": "Emitted when a keeper works a job" + }, + "LiquidityAddition(address,address,address,uint256)": { + "notice": "Emitted when IKeep3rJobFundableLiquidity#addLiquidityToJob function is called" + }, + "LiquidityApproval(address)": { + "notice": "Emitted when Keep3rJobFundableLiquidity#approveLiquidity function is called" + }, + "LiquidityCreditsForced(address,uint256,uint256)": { + "notice": "Emitted when Keep3rJobFundableLiquidity#forceLiquidityCreditsToJob function is called" + }, + "LiquidityCreditsReward(address,uint256,uint256,uint256)": { + "notice": "Emitted when Keep3rJobFundableLiquidity#addLiquidityToJob function is called" + }, + "LiquidityMinimumChange(uint256)": { + "notice": "Emitted when _liquidityMinimum is changed" + }, + "LiquidityRevocation(address)": { + "notice": "Emitted when Keep3rJobFundableLiquidity#revokeLiquidity function is called" + }, + "LiquidityWithdrawal(address,address,address,uint256)": { + "notice": "Emitted when IKeep3rJobFundableLiquidity#withdrawLiquidityFromJob function is called" + }, + "PendingGovernorAccepted(address)": { + "notice": "Emitted when a new governor is set" + }, + "PendingGovernorSet(address,address)": { + "notice": "Emitted when a new pending governor is set" + }, + "Resolve(address,address)": { + "notice": "Emitted when a dispute is resolved" + }, + "RewardPeriodTimeChange(uint256)": { + "notice": "Emitted when _rewardPeriodTime is changed" + }, + "SlasherAdded(address)": { + "notice": "Emitted when a slasher is added" + }, + "SlasherRemoved(address)": { + "notice": "Emitted when a slasher is removed" + }, + "TokenCreditAddition(address,address,address,uint256)": { + "notice": "Emitted when Keep3rJobFundableCredits#addTokenCreditsToJob is called" + }, + "TokenCreditWithdrawal(address,address,address,uint256)": { + "notice": "Emitted when Keep3rJobFundableCredits#withdrawTokenCreditsFromJob is called" + }, + "UnbondTimeChange(uint256)": { + "notice": "Emitted when _unbondTime is changed" + }, + "Unbonding(address,address,uint256)": { + "notice": "Emitted when a keeper or job begins the unbonding process to withdraw the funds" + }, + "Withdrawal(address,address,uint256)": { + "notice": "Emitted when Keep3rKeeperFundable#withdraw is called" + } + }, + "kind": "user", + "methods": { + "acceptJobMigration(address,address)": { + "notice": "Completes the migration process for a job" + }, + "acceptJobOwnership(address)": { + "notice": "The proposed address accepts to be the owner of the job" + }, + "acceptPendingGovernor()": { + "notice": "Allows a proposed governor to accept the governance" + }, + "activate(address)": { + "notice": "End of the bonding process after bonding time has passed" + }, + "addDisputer(address)": { + "notice": "Registers a disputer by updating the disputers mapping" + }, + "addJob(address)": { + "notice": "Allows any caller to add a new job" + }, + "addLiquidityToJob(address,address,uint256)": { + "notice": "Allows anyone to fund a job with liquidity" + }, + "addSlasher(address)": { + "notice": "Registers a slasher by updating the slashers mapping" + }, + "addTokenCreditsToJob(address,address,uint256)": { + "notice": "Add credit to a job to be paid out for work" + }, + "approveLiquidity(address)": { + "notice": "Sidechain implementation asks the Helper for an oracle, instead of reading it from the ERC-20" + }, + "approvedLiquidities()": { + "notice": "Lists liquidity pairs" + }, + "bond(address,uint256)": { + "notice": "Beginning of the bonding process" + }, + "bondTime()": { + "notice": "The amount of time required to pass after a keeper has bonded assets for it to be able to activate" + }, + "bondedPayment(address,uint256)": { + "notice": "Implemented by jobs to show that a keeper performed work" + }, + "bonds(address,address)": { + "notice": "Mapping (job => bonding => amount)" + }, + "canActivateAfter(address,address)": { + "notice": "Tracks when a bonding for a keeper can be activated" + }, + "canWithdrawAfter(address,address)": { + "notice": "Tracks when keeper bonds are ready to be withdrawn" + }, + "changeJobOwnership(address,address)": { + "notice": "Proposes a new address to be the owner of the job" + }, + "directTokenPayment(address,address,uint256)": { + "notice": "Implemented by jobs to show that a keeper performed work" + }, + "dispute(address)": { + "notice": "Allows governor to create a dispute for a given keeper/job" + }, + "disputers(address)": { + "notice": "Tracks whether the address is a disputer or not" + }, + "disputes(address)": { + "notice": "Tracks if a keeper or job has a pending dispute" + }, + "fee()": { + "notice": "The fee to be sent to governor when a user adds liquidity to a job" + }, + "firstSeen(address)": { + "notice": "Tracks when a keeper was first registered" + }, + "forceLiquidityCreditsToJob(address,uint256)": { + "notice": "Gifts liquidity credits to the specified job" + }, + "hasBonded(address)": { + "notice": "Checks whether the address has ever bonded an asset" + }, + "inflationPeriod()": { + "notice": "The inflation period is the denominator used to regulate the emission of KP3R" + }, + "isBondedKeeper(address,address,uint256,uint256,uint256)": { + "notice": "Confirms if the current keeper is registered and has a minimum bond of any asset." + }, + "isKeeper(address)": { + "notice": "Confirms if the current keeper is registered" + }, + "jobLiquidityCredits(address)": { + "notice": "Returns the liquidity credits of a given job" + }, + "jobOwner(address)": { + "notice": "Maps the job to the owner of the job" + }, + "jobPendingOwner(address)": { + "notice": "Maps the job to its pending owner" + }, + "jobPeriodCredits(address)": { + "notice": "Returns the credits of a given job for the current period" + }, + "jobTokenCredits(address,address)": { + "notice": "The current token credits available for a job" + }, + "jobTokenCreditsAddedAt(address,address)": { + "notice": "Last block where tokens were added to the job" + }, + "jobs()": { + "notice": "Lists all jobs" + }, + "keep3rHelper()": { + "notice": "Address of Keep3rHelper's contract" + }, + "keep3rV1()": { + "notice": "Address of Keep3rV1's contract" + }, + "keep3rV1Proxy()": { + "notice": "Address of Keep3rV1Proxy's contract" + }, + "keepers()": { + "notice": "Lists all keepers" + }, + "liquidityAmount(address,address)": { + "notice": "Amount of liquidity in a specified job" + }, + "liquidityMinimum()": { + "notice": "The minimum amount of liquidity required to fund a job per liquidity" + }, + "migrateJob(address,address)": { + "notice": "Initializes the migration process for a job by adding the request to the pendingJobMigrations mapping" + }, + "observeLiquidity(address)": { + "notice": "Sidechain implementation will always ask for 2 tickCumulatives instead of cacheing" + }, + "pendingBonds(address,address)": { + "notice": "Tracks the amount of assets deposited in pending bonds" + }, + "pendingJobMigrations(address)": { + "notice": "Maps the jobs that have requested a migration to the address they have requested to migrate to" + }, + "pendingUnbonds(address,address)": { + "notice": "Tracks how much keeper bonds are to be withdrawn" + }, + "quoteLiquidity(address,uint256)": { + "notice": "Calculates how many credits should be rewarded periodically for a given liquidity amount" + }, + "removeDisputer(address)": { + "notice": "Removes a disputer by updating the disputers mapping" + }, + "removeSlasher(address)": { + "notice": "Removes a slasher by updating the slashers mapping" + }, + "resolve(address)": { + "notice": "Allows governor to resolve a dispute on a keeper/job" + }, + "revoke(address)": { + "notice": "Blacklists a keeper from participating in the network" + }, + "revokeLiquidity(address)": { + "notice": "Revoke a liquidity pair from being accepted in future" + }, + "rewardPeriodTime()": { + "notice": "The amount of time between each scheduled credits reward given to a job" + }, + "rewardedAt(address)": { + "notice": "Last time the job was rewarded liquidity credits" + }, + "sendDust(address,uint256,address)": { + "notice": "Allows an authorized user to transfer the tokens or eth that may have been left in a contract" + }, + "setBondTime(uint256)": { + "notice": "Sets the bond time required to activate as a keeper" + }, + "setFee(uint256)": { + "notice": "Sets the new fee" + }, + "setInflationPeriod(uint256)": { + "notice": "Sets the new inflation period" + }, + "setKeep3rHelper(address)": { + "notice": "Sets the Keep3rHelper address" + }, + "setKeep3rV1(address)": { + "notice": "Sets the Keep3rV1 address" + }, + "setKeep3rV1Proxy(address)": { + "notice": "Sets the Keep3rV1Proxy address" + }, + "setLiquidityMinimum(uint256)": { + "notice": "Sets the minimum amount of liquidity required to fund a job" + }, + "setPendingGovernor(address)": { + "notice": "Allows a governor to propose a new governor" + }, + "setRewardPeriodTime(uint256)": { + "notice": "Sets the time required to pass between rewards for jobs" + }, + "setUnbondTime(uint256)": { + "notice": "Sets the unbond time required unbond what has been bonded" + }, + "slash(address,address,uint256,uint256)": { + "notice": "Allows governor to slash a keeper based on a dispute" + }, + "slashLiquidityFromJob(address,address,uint256)": { + "notice": "Allows governor or slasher to slash liquidity from a job" + }, + "slashTokenFromJob(address,address,uint256)": { + "notice": "Allows governor or slasher to slash a job specific token" + }, + "slashers(address)": { + "notice": "Tracks whether the address is a slasher or not" + }, + "totalBonds()": { + "notice": "Tracks the total amount of bonded KP3Rs in the contract" + }, + "totalJobCredits(address)": { + "notice": "Calculates the total credits of a given job" + }, + "unbond(address,uint256)": { + "notice": "Beginning of the unbonding process" + }, + "unbondLiquidityFromJob(address,address,uint256)": { + "notice": "Unbond liquidity for a job" + }, + "unbondTime()": { + "notice": "The amount of time required to pass before a keeper can unbond what he has bonded" + }, + "virtualReserves()": { + "notice": "The surplus amount of wKP3Rs in escrow contract" + }, + "withdraw(address)": { + "notice": "Withdraw funds after unbonding has finished" + }, + "withdrawLiquidityFromJob(address,address,address)": { + "notice": "Withdraw liquidity from a job" + }, + "withdrawTokenCreditsFromJob(address,address,uint256,address)": { + "notice": "Withdraw credit from a job" + }, + "workCompleted(address)": { + "notice": "Tracks the total KP3R earnings of a keeper since it started working" + }, + "worked(address,uint256)": { + "notice": "Implemented by jobs to show that a keeper performed work" + }, + "workedAt(address)": { + "notice": "Last time the job was worked" + } + }, + "version": 1 + }, + "storageLayout": { + "storage": [ + { + "astId": 309, + "contract": "solidity/for-test/testnet/Keep3rSidechainForTestnet.sol:Keep3rSidechainForTestnet", + "label": "_status", + "offset": 0, + "slot": "0", + "type": "t_uint256" + }, + { + "astId": 8765, + "contract": "solidity/for-test/testnet/Keep3rSidechainForTestnet.sol:Keep3rSidechainForTestnet", + "label": "jobOwner", + "offset": 0, + "slot": "1", + "type": "t_mapping(t_address,t_address)" + }, + { + "astId": 8771, + "contract": "solidity/for-test/testnet/Keep3rSidechainForTestnet.sol:Keep3rSidechainForTestnet", + "label": "jobPendingOwner", + "offset": 0, + "slot": "2", + "type": "t_mapping(t_address,t_address)" + }, + { + "astId": 82, + "contract": "solidity/for-test/testnet/Keep3rSidechainForTestnet.sol:Keep3rSidechainForTestnet", + "label": "governor", + "offset": 0, + "slot": "3", + "type": "t_address" + }, + { + "astId": 85, + "contract": "solidity/for-test/testnet/Keep3rSidechainForTestnet.sol:Keep3rSidechainForTestnet", + "label": "pendingGovernor", + "offset": 0, + "slot": "4", + "type": "t_address" + }, + { + "astId": 6333, + "contract": "solidity/for-test/testnet/Keep3rSidechainForTestnet.sol:Keep3rSidechainForTestnet", + "label": "slashers", + "offset": 0, + "slot": "5", + "type": "t_mapping(t_address,t_bool)" + }, + { + "astId": 6339, + "contract": "solidity/for-test/testnet/Keep3rSidechainForTestnet.sol:Keep3rSidechainForTestnet", + "label": "disputers", + "offset": 0, + "slot": "6", + "type": "t_mapping(t_address,t_bool)" + }, + { + "astId": 5801, + "contract": "solidity/for-test/testnet/Keep3rSidechainForTestnet.sol:Keep3rSidechainForTestnet", + "label": "_keepers", + "offset": 0, + "slot": "7", + "type": "t_struct(AddressSet)1930_storage" + }, + { + "astId": 5805, + "contract": "solidity/for-test/testnet/Keep3rSidechainForTestnet.sol:Keep3rSidechainForTestnet", + "label": "totalBonds", + "offset": 0, + "slot": "9", + "type": "t_uint256" + }, + { + "astId": 5811, + "contract": "solidity/for-test/testnet/Keep3rSidechainForTestnet.sol:Keep3rSidechainForTestnet", + "label": "workCompleted", + "offset": 0, + "slot": "10", + "type": "t_mapping(t_address,t_uint256)" + }, + { + "astId": 5817, + "contract": "solidity/for-test/testnet/Keep3rSidechainForTestnet.sol:Keep3rSidechainForTestnet", + "label": "firstSeen", + "offset": 0, + "slot": "11", + "type": "t_mapping(t_address,t_uint256)" + }, + { + "astId": 5823, + "contract": "solidity/for-test/testnet/Keep3rSidechainForTestnet.sol:Keep3rSidechainForTestnet", + "label": "disputes", + "offset": 0, + "slot": "12", + "type": "t_mapping(t_address,t_bool)" + }, + { + "astId": 5831, + "contract": "solidity/for-test/testnet/Keep3rSidechainForTestnet.sol:Keep3rSidechainForTestnet", + "label": "bonds", + "offset": 0, + "slot": "13", + "type": "t_mapping(t_address,t_mapping(t_address,t_uint256))" + }, + { + "astId": 5839, + "contract": "solidity/for-test/testnet/Keep3rSidechainForTestnet.sol:Keep3rSidechainForTestnet", + "label": "jobTokenCredits", + "offset": 0, + "slot": "14", + "type": "t_mapping(t_address,t_mapping(t_address,t_uint256))" + }, + { + "astId": 5844, + "contract": "solidity/for-test/testnet/Keep3rSidechainForTestnet.sol:Keep3rSidechainForTestnet", + "label": "_jobLiquidityCredits", + "offset": 0, + "slot": "15", + "type": "t_mapping(t_address,t_uint256)" + }, + { + "astId": 5849, + "contract": "solidity/for-test/testnet/Keep3rSidechainForTestnet.sol:Keep3rSidechainForTestnet", + "label": "_jobPeriodCredits", + "offset": 0, + "slot": "16", + "type": "t_mapping(t_address,t_uint256)" + }, + { + "astId": 5855, + "contract": "solidity/for-test/testnet/Keep3rSidechainForTestnet.sol:Keep3rSidechainForTestnet", + "label": "_jobTokens", + "offset": 0, + "slot": "17", + "type": "t_mapping(t_address,t_struct(AddressSet)1930_storage)" + }, + { + "astId": 5861, + "contract": "solidity/for-test/testnet/Keep3rSidechainForTestnet.sol:Keep3rSidechainForTestnet", + "label": "_jobLiquidities", + "offset": 0, + "slot": "18", + "type": "t_mapping(t_address,t_struct(AddressSet)1930_storage)" + }, + { + "astId": 5866, + "contract": "solidity/for-test/testnet/Keep3rSidechainForTestnet.sol:Keep3rSidechainForTestnet", + "label": "_liquidityPool", + "offset": 0, + "slot": "19", + "type": "t_mapping(t_address,t_address)" + }, + { + "astId": 5871, + "contract": "solidity/for-test/testnet/Keep3rSidechainForTestnet.sol:Keep3rSidechainForTestnet", + "label": "_isKP3RToken0", + "offset": 0, + "slot": "20", + "type": "t_mapping(t_address,t_bool)" + }, + { + "astId": 5879, + "contract": "solidity/for-test/testnet/Keep3rSidechainForTestnet.sol:Keep3rSidechainForTestnet", + "label": "pendingBonds", + "offset": 0, + "slot": "21", + "type": "t_mapping(t_address,t_mapping(t_address,t_uint256))" + }, + { + "astId": 5887, + "contract": "solidity/for-test/testnet/Keep3rSidechainForTestnet.sol:Keep3rSidechainForTestnet", + "label": "canActivateAfter", + "offset": 0, + "slot": "22", + "type": "t_mapping(t_address,t_mapping(t_address,t_uint256))" + }, + { + "astId": 5895, + "contract": "solidity/for-test/testnet/Keep3rSidechainForTestnet.sol:Keep3rSidechainForTestnet", + "label": "canWithdrawAfter", + "offset": 0, + "slot": "23", + "type": "t_mapping(t_address,t_mapping(t_address,t_uint256))" + }, + { + "astId": 5903, + "contract": "solidity/for-test/testnet/Keep3rSidechainForTestnet.sol:Keep3rSidechainForTestnet", + "label": "pendingUnbonds", + "offset": 0, + "slot": "24", + "type": "t_mapping(t_address,t_mapping(t_address,t_uint256))" + }, + { + "astId": 5909, + "contract": "solidity/for-test/testnet/Keep3rSidechainForTestnet.sol:Keep3rSidechainForTestnet", + "label": "hasBonded", + "offset": 0, + "slot": "25", + "type": "t_mapping(t_address,t_bool)" + }, + { + "astId": 5913, + "contract": "solidity/for-test/testnet/Keep3rSidechainForTestnet.sol:Keep3rSidechainForTestnet", + "label": "_jobs", + "offset": 0, + "slot": "26", + "type": "t_struct(AddressSet)1930_storage" + }, + { + "astId": 6026, + "contract": "solidity/for-test/testnet/Keep3rSidechainForTestnet.sol:Keep3rSidechainForTestnet", + "label": "keep3rV1", + "offset": 0, + "slot": "28", + "type": "t_address" + }, + { + "astId": 6030, + "contract": "solidity/for-test/testnet/Keep3rSidechainForTestnet.sol:Keep3rSidechainForTestnet", + "label": "keep3rV1Proxy", + "offset": 0, + "slot": "29", + "type": "t_address" + }, + { + "astId": 6034, + "contract": "solidity/for-test/testnet/Keep3rSidechainForTestnet.sol:Keep3rSidechainForTestnet", + "label": "keep3rHelper", + "offset": 0, + "slot": "30", + "type": "t_address" + }, + { + "astId": 6039, + "contract": "solidity/for-test/testnet/Keep3rSidechainForTestnet.sol:Keep3rSidechainForTestnet", + "label": "bondTime", + "offset": 0, + "slot": "31", + "type": "t_uint256" + }, + { + "astId": 6044, + "contract": "solidity/for-test/testnet/Keep3rSidechainForTestnet.sol:Keep3rSidechainForTestnet", + "label": "unbondTime", + "offset": 0, + "slot": "32", + "type": "t_uint256" + }, + { + "astId": 6049, + "contract": "solidity/for-test/testnet/Keep3rSidechainForTestnet.sol:Keep3rSidechainForTestnet", + "label": "liquidityMinimum", + "offset": 0, + "slot": "33", + "type": "t_uint256" + }, + { + "astId": 6054, + "contract": "solidity/for-test/testnet/Keep3rSidechainForTestnet.sol:Keep3rSidechainForTestnet", + "label": "rewardPeriodTime", + "offset": 0, + "slot": "34", + "type": "t_uint256" + }, + { + "astId": 6059, + "contract": "solidity/for-test/testnet/Keep3rSidechainForTestnet.sol:Keep3rSidechainForTestnet", + "label": "inflationPeriod", + "offset": 0, + "slot": "35", + "type": "t_uint256" + }, + { + "astId": 6064, + "contract": "solidity/for-test/testnet/Keep3rSidechainForTestnet.sol:Keep3rSidechainForTestnet", + "label": "fee", + "offset": 0, + "slot": "36", + "type": "t_uint256" + }, + { + "astId": 6766, + "contract": "solidity/for-test/testnet/Keep3rSidechainForTestnet.sol:Keep3rSidechainForTestnet", + "label": "jobTokenCreditsAddedAt", + "offset": 0, + "slot": "37", + "type": "t_mapping(t_address,t_mapping(t_address,t_uint256))" + }, + { + "astId": 7009, + "contract": "solidity/for-test/testnet/Keep3rSidechainForTestnet.sol:Keep3rSidechainForTestnet", + "label": "_approvedLiquidities", + "offset": 0, + "slot": "38", + "type": "t_struct(AddressSet)1930_storage" + }, + { + "astId": 7017, + "contract": "solidity/for-test/testnet/Keep3rSidechainForTestnet.sol:Keep3rSidechainForTestnet", + "label": "liquidityAmount", + "offset": 0, + "slot": "40", + "type": "t_mapping(t_address,t_mapping(t_address,t_uint256))" + }, + { + "astId": 7023, + "contract": "solidity/for-test/testnet/Keep3rSidechainForTestnet.sol:Keep3rSidechainForTestnet", + "label": "rewardedAt", + "offset": 0, + "slot": "41", + "type": "t_mapping(t_address,t_uint256)" + }, + { + "astId": 7029, + "contract": "solidity/for-test/testnet/Keep3rSidechainForTestnet.sol:Keep3rSidechainForTestnet", + "label": "workedAt", + "offset": 0, + "slot": "42", + "type": "t_mapping(t_address,t_uint256)" + }, + { + "astId": 7035, + "contract": "solidity/for-test/testnet/Keep3rSidechainForTestnet.sol:Keep3rSidechainForTestnet", + "label": "_tick", + "offset": 0, + "slot": "43", + "type": "t_mapping(t_address,t_struct(TickCache)14902_storage)" + }, + { + "astId": 8486, + "contract": "solidity/for-test/testnet/Keep3rSidechainForTestnet.sol:Keep3rSidechainForTestnet", + "label": "pendingJobMigrations", + "offset": 0, + "slot": "44", + "type": "t_mapping(t_address,t_address)" + }, + { + "astId": 8492, + "contract": "solidity/for-test/testnet/Keep3rSidechainForTestnet.sol:Keep3rSidechainForTestnet", + "label": "_migrationCreatedAt", + "offset": 0, + "slot": "45", + "type": "t_mapping(t_address,t_mapping(t_address,t_uint256))" + }, + { + "astId": 8889, + "contract": "solidity/for-test/testnet/Keep3rSidechainForTestnet.sol:Keep3rSidechainForTestnet", + "label": "_initialGas", + "offset": 0, + "slot": "46", + "type": "t_uint256" + } + ], + "types": { + "t_address": { + "encoding": "inplace", + "label": "address", + "numberOfBytes": "20" + }, + "t_array(t_bytes32)dyn_storage": { + "base": "t_bytes32", + "encoding": "dynamic_array", + "label": "bytes32[]", + "numberOfBytes": "32" + }, + "t_bool": { + "encoding": "inplace", + "label": "bool", + "numberOfBytes": "1" + }, + "t_bytes32": { + "encoding": "inplace", + "label": "bytes32", + "numberOfBytes": "32" + }, + "t_int56": { + "encoding": "inplace", + "label": "int56", + "numberOfBytes": "7" + }, + "t_mapping(t_address,t_address)": { + "encoding": "mapping", + "key": "t_address", + "label": "mapping(address => address)", + "numberOfBytes": "32", + "value": "t_address" + }, + "t_mapping(t_address,t_bool)": { + "encoding": "mapping", + "key": "t_address", + "label": "mapping(address => bool)", + "numberOfBytes": "32", + "value": "t_bool" + }, + "t_mapping(t_address,t_mapping(t_address,t_uint256))": { + "encoding": "mapping", + "key": "t_address", + "label": "mapping(address => mapping(address => uint256))", + "numberOfBytes": "32", + "value": "t_mapping(t_address,t_uint256)" + }, + "t_mapping(t_address,t_struct(AddressSet)1930_storage)": { + "encoding": "mapping", + "key": "t_address", + "label": "mapping(address => struct EnumerableSet.AddressSet)", + "numberOfBytes": "32", + "value": "t_struct(AddressSet)1930_storage" + }, + "t_mapping(t_address,t_struct(TickCache)14902_storage)": { + "encoding": "mapping", + "key": "t_address", + "label": "mapping(address => struct IKeep3rJobFundableLiquidity.TickCache)", + "numberOfBytes": "32", + "value": "t_struct(TickCache)14902_storage" + }, + "t_mapping(t_address,t_uint256)": { + "encoding": "mapping", + "key": "t_address", + "label": "mapping(address => uint256)", + "numberOfBytes": "32", + "value": "t_uint256" + }, + "t_mapping(t_bytes32,t_uint256)": { + "encoding": "mapping", + "key": "t_bytes32", + "label": "mapping(bytes32 => uint256)", + "numberOfBytes": "32", + "value": "t_uint256" + }, + "t_struct(AddressSet)1930_storage": { + "encoding": "inplace", + "label": "struct EnumerableSet.AddressSet", + "members": [ + { + "astId": 1929, + "contract": "solidity/for-test/testnet/Keep3rSidechainForTestnet.sol:Keep3rSidechainForTestnet", + "label": "_inner", + "offset": 0, + "slot": "0", + "type": "t_struct(Set)1629_storage" + } + ], + "numberOfBytes": "64" + }, + "t_struct(Set)1629_storage": { + "encoding": "inplace", + "label": "struct EnumerableSet.Set", + "members": [ + { + "astId": 1624, + "contract": "solidity/for-test/testnet/Keep3rSidechainForTestnet.sol:Keep3rSidechainForTestnet", + "label": "_values", + "offset": 0, + "slot": "0", + "type": "t_array(t_bytes32)dyn_storage" + }, + { + "astId": 1628, + "contract": "solidity/for-test/testnet/Keep3rSidechainForTestnet.sol:Keep3rSidechainForTestnet", + "label": "_indexes", + "offset": 0, + "slot": "1", + "type": "t_mapping(t_bytes32,t_uint256)" + } + ], + "numberOfBytes": "64" + }, + "t_struct(TickCache)14902_storage": { + "encoding": "inplace", + "label": "struct IKeep3rJobFundableLiquidity.TickCache", + "members": [ + { + "astId": 14897, + "contract": "solidity/for-test/testnet/Keep3rSidechainForTestnet.sol:Keep3rSidechainForTestnet", + "label": "current", + "offset": 0, + "slot": "0", + "type": "t_int56" + }, + { + "astId": 14899, + "contract": "solidity/for-test/testnet/Keep3rSidechainForTestnet.sol:Keep3rSidechainForTestnet", + "label": "difference", + "offset": 7, + "slot": "0", + "type": "t_int56" + }, + { + "astId": 14901, + "contract": "solidity/for-test/testnet/Keep3rSidechainForTestnet.sol:Keep3rSidechainForTestnet", + "label": "period", + "offset": 0, + "slot": "1", + "type": "t_uint256" + } + ], + "numberOfBytes": "64" + }, + "t_uint256": { + "encoding": "inplace", + "label": "uint256", + "numberOfBytes": "32" + } + } + } +} \ No newline at end of file diff --git a/deployments/optimisticGoerli/Kp3rWethOracle.json b/deployments/optimisticSepolia/Kp3rWethOracle.json similarity index 99% rename from deployments/optimisticGoerli/Kp3rWethOracle.json rename to deployments/optimisticSepolia/Kp3rWethOracle.json index baee156..e6c6fd3 100644 --- a/deployments/optimisticGoerli/Kp3rWethOracle.json +++ b/deployments/optimisticSepolia/Kp3rWethOracle.json @@ -1,5 +1,5 @@ { - "address": "0x4ECFF2c532d47D7be3D957E4a332AB134cad1fd9", + "address": "0x8BFdD4689dC4669bd818c0551a510301f091103C", "abi": [ { "anonymous": false, @@ -983,5 +983,5 @@ "type": "function" } ], - "numDeployments": 4 + "numDeployments": 5 } \ No newline at end of file diff --git a/deployments/goerli/UniV3Factory.json b/deployments/optimisticSepolia/UniV3Factory.json similarity index 98% rename from deployments/goerli/UniV3Factory.json rename to deployments/optimisticSepolia/UniV3Factory.json index 6f35160..4a2e100 100644 --- a/deployments/goerli/UniV3Factory.json +++ b/deployments/optimisticSepolia/UniV3Factory.json @@ -1,5 +1,5 @@ { - "address": "0x1f98431c8ad98523631ae4a59f267346ea31f984", + "address": "0x8CE191193D15ea94e11d327b4c7ad8bbE520f6aF", "abi": [ { "anonymous": false, @@ -198,5 +198,5 @@ "type": "function" } ], - "numDeployments": 3 + "numDeployments": 6 } \ No newline at end of file diff --git a/deployments/optimisticSepolia/UniV3PairManager.json b/deployments/optimisticSepolia/UniV3PairManager.json new file mode 100644 index 0000000..9e0254b --- /dev/null +++ b/deployments/optimisticSepolia/UniV3PairManager.json @@ -0,0 +1,1075 @@ +{ + "address": "0x15059B1659Ca78FE48b7fbc96425b8F4fA359a36", + "abi": [ + { + "inputs": [ + { + "internalType": "address", + "name": "_pool", + "type": "address" + }, + { + "internalType": "address", + "name": "_governor", + "type": "address" + } + ], + "stateMutability": "nonpayable", + "type": "constructor" + }, + { + "inputs": [], + "name": "ExcessiveSlippage", + "type": "error" + }, + { + "inputs": [], + "name": "InvalidAddress", + "type": "error" + }, + { + "inputs": [], + "name": "InvalidAmount", + "type": "error" + }, + { + "inputs": [], + "name": "LengthMismatch", + "type": "error" + }, + { + "inputs": [], + "name": "OnlyGovernor", + "type": "error" + }, + { + "inputs": [], + "name": "OnlyPendingGovernor", + "type": "error" + }, + { + "inputs": [], + "name": "OnlyPool", + "type": "error" + }, + { + "inputs": [], + "name": "UnsuccessfulTransfer", + "type": "error" + }, + { + "inputs": [], + "name": "ZeroAddress", + "type": "error" + }, + { + "inputs": [], + "name": "ZeroAmount", + "type": "error" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "spender", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "value", + "type": "uint256" + } + ], + "name": "Approval", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "_newGovernor", + "type": "address" + } + ], + "name": "PendingGovernorAccepted", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "_governor", + "type": "address" + }, + { + "indexed": false, + "internalType": "address", + "name": "_pendingGovernor", + "type": "address" + } + ], + "name": "PendingGovernorSet", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "from", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "to", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "value", + "type": "uint256" + } + ], + "name": "Transfer", + "type": "event" + }, + { + "inputs": [], + "name": "acceptPendingGovernor", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + }, + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "name": "allowance", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "spender", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "approve", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "name": "balanceOf", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint128", + "name": "liquidity", + "type": "uint128" + }, + { + "internalType": "uint256", + "name": "amount0Min", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "amount1Min", + "type": "uint256" + }, + { + "internalType": "address", + "name": "to", + "type": "address" + } + ], + "name": "burn", + "outputs": [ + { + "internalType": "uint256", + "name": "amount0", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "amount1", + "type": "uint256" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "collect", + "outputs": [ + { + "internalType": "uint256", + "name": "amount0", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "amount1", + "type": "uint256" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "decimals", + "outputs": [ + { + "internalType": "uint8", + "name": "", + "type": "uint8" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "factory", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "fee", + "outputs": [ + { + "internalType": "uint24", + "name": "", + "type": "uint24" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "governor", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "amount0Desired", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "amount1Desired", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "amount0Min", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "amount1Min", + "type": "uint256" + }, + { + "internalType": "address", + "name": "to", + "type": "address" + } + ], + "name": "mint", + "outputs": [ + { + "internalType": "uint128", + "name": "liquidity", + "type": "uint128" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "name", + "outputs": [ + { + "internalType": "string", + "name": "", + "type": "string" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "pendingGovernor", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "pool", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "position", + "outputs": [ + { + "internalType": "uint128", + "name": "liquidity", + "type": "uint128" + }, + { + "internalType": "uint256", + "name": "feeGrowthInside0LastX128", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "feeGrowthInside1LastX128", + "type": "uint256" + }, + { + "internalType": "uint128", + "name": "tokensOwed0", + "type": "uint128" + }, + { + "internalType": "uint128", + "name": "tokensOwed1", + "type": "uint128" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_pendingGovernor", + "type": "address" + } + ], + "name": "setPendingGovernor", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "sqrtRatioAX96", + "outputs": [ + { + "internalType": "uint160", + "name": "", + "type": "uint160" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "sqrtRatioBX96", + "outputs": [ + { + "internalType": "uint160", + "name": "", + "type": "uint160" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "symbol", + "outputs": [ + { + "internalType": "string", + "name": "", + "type": "string" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "tickLower", + "outputs": [ + { + "internalType": "int24", + "name": "", + "type": "int24" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "tickSpacing", + "outputs": [ + { + "internalType": "int24", + "name": "", + "type": "int24" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "tickUpper", + "outputs": [ + { + "internalType": "int24", + "name": "", + "type": "int24" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "token0", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "token1", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "totalSupply", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "to", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "transfer", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "from", + "type": "address" + }, + { + "internalType": "address", + "name": "to", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "transferFrom", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "amount0Owed", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "amount1Owed", + "type": "uint256" + }, + { + "internalType": "bytes", + "name": "data", + "type": "bytes" + } + ], + "name": "uniswapV3MintCallback", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + } + ], + "transactionHash": "0xe96e6dd6f46d0c3762ef9994096db5041a136f94031563cc0e71cb30469a4094", + "receipt": { + "to": null, + "from": "0x169Cf949aB1B25453b70F2Fe874e2c65c10AE0f8", + "contractAddress": "0x15059B1659Ca78FE48b7fbc96425b8F4fA359a36", + "transactionIndex": 3, + "gasUsed": "2129010", + "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "blockHash": "0xe85d630fc1abee237163b8d03290ad6f52c103c25b92b6256fd4c216da63c32e", + "transactionHash": "0xe96e6dd6f46d0c3762ef9994096db5041a136f94031563cc0e71cb30469a4094", + "logs": [], + "blockNumber": 9270557, + "cumulativeGasUsed": "2357673", + "status": 1, + "byzantium": true + }, + "args": [ + "0x8BFdD4689dC4669bd818c0551a510301f091103C", + "0x169Cf949aB1B25453b70F2Fe874e2c65c10AE0f8" + ], + "numDeployments": 1, + "solcInputHash": "4e9d9cfe55e24217a94485fe49438e4a", + "metadata": "{\"compiler\":{\"version\":\"0.8.8+commit.dddeac2f\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_pool\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"_governor\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"inputs\":[],\"name\":\"ExcessiveSlippage\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"InvalidAddress\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"InvalidAmount\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"LengthMismatch\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"OnlyGovernor\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"OnlyPendingGovernor\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"OnlyPool\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"UnsuccessfulTransfer\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"ZeroAddress\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"ZeroAmount\",\"type\":\"error\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"owner\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"spender\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"value\",\"type\":\"uint256\"}],\"name\":\"Approval\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"_newGovernor\",\"type\":\"address\"}],\"name\":\"PendingGovernorAccepted\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"_governor\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"_pendingGovernor\",\"type\":\"address\"}],\"name\":\"PendingGovernorSet\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"from\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"value\",\"type\":\"uint256\"}],\"name\":\"Transfer\",\"type\":\"event\"},{\"inputs\":[],\"name\":\"acceptPendingGovernor\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"allowance\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"spender\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"approve\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"balanceOf\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint128\",\"name\":\"liquidity\",\"type\":\"uint128\"},{\"internalType\":\"uint256\",\"name\":\"amount0Min\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"amount1Min\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"}],\"name\":\"burn\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"amount0\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"amount1\",\"type\":\"uint256\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"collect\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"amount0\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"amount1\",\"type\":\"uint256\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"decimals\",\"outputs\":[{\"internalType\":\"uint8\",\"name\":\"\",\"type\":\"uint8\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"factory\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"fee\",\"outputs\":[{\"internalType\":\"uint24\",\"name\":\"\",\"type\":\"uint24\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"governor\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"amount0Desired\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"amount1Desired\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"amount0Min\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"amount1Min\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"}],\"name\":\"mint\",\"outputs\":[{\"internalType\":\"uint128\",\"name\":\"liquidity\",\"type\":\"uint128\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"name\",\"outputs\":[{\"internalType\":\"string\",\"name\":\"\",\"type\":\"string\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"pendingGovernor\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"pool\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"position\",\"outputs\":[{\"internalType\":\"uint128\",\"name\":\"liquidity\",\"type\":\"uint128\"},{\"internalType\":\"uint256\",\"name\":\"feeGrowthInside0LastX128\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"feeGrowthInside1LastX128\",\"type\":\"uint256\"},{\"internalType\":\"uint128\",\"name\":\"tokensOwed0\",\"type\":\"uint128\"},{\"internalType\":\"uint128\",\"name\":\"tokensOwed1\",\"type\":\"uint128\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_pendingGovernor\",\"type\":\"address\"}],\"name\":\"setPendingGovernor\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"sqrtRatioAX96\",\"outputs\":[{\"internalType\":\"uint160\",\"name\":\"\",\"type\":\"uint160\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"sqrtRatioBX96\",\"outputs\":[{\"internalType\":\"uint160\",\"name\":\"\",\"type\":\"uint160\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"symbol\",\"outputs\":[{\"internalType\":\"string\",\"name\":\"\",\"type\":\"string\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"tickLower\",\"outputs\":[{\"internalType\":\"int24\",\"name\":\"\",\"type\":\"int24\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"tickSpacing\",\"outputs\":[{\"internalType\":\"int24\",\"name\":\"\",\"type\":\"int24\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"tickUpper\",\"outputs\":[{\"internalType\":\"int24\",\"name\":\"\",\"type\":\"int24\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"token0\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"token1\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"totalSupply\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"transfer\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"from\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"transferFrom\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"amount0Owed\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"amount1Owed\",\"type\":\"uint256\"},{\"internalType\":\"bytes\",\"name\":\"data\",\"type\":\"bytes\"}],\"name\":\"uniswapV3MintCallback\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"}],\"devdoc\":{\"kind\":\"dev\",\"methods\":{\"approve(address,uint256)\":{\"details\":\"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.\"},\"burn(uint128,uint256,uint256,address)\":{\"params\":{\"amount0Min\":\"The minimum amount of token0 we want to send to the recipient (to)\",\"amount1Min\":\"The minimum amount of token1 we want to send to the recipient (to)\",\"liquidity\":\"The amount of liquidity to be burned\",\"to\":\"The address that will receive the due fees\"},\"returns\":{\"amount0\":\"The calculated amount of token0 that will be sent to the recipient\",\"amount1\":\"The calculated amount of token1 that will be sent to the recipient\"}},\"collect()\":{\"details\":\"The collected fees will be sent to governor\",\"returns\":{\"amount0\":\"The amount of fees collected in token0\",\"amount1\":\"The amount of fees collected in token1\"}},\"mint(uint256,uint256,uint256,uint256,address)\":{\"details\":\"Triggers UniV3PairManager#uniswapV3MintCallback\",\"params\":{\"amount0Desired\":\"The amount of token0 we would like to provide\",\"amount0Min\":\"The minimum amount of token0 we want to provide\",\"amount1Desired\":\"The amount of token1 we would like to provide\",\"amount1Min\":\"The minimum amount of token1 we want to provide\",\"to\":\"The address to which the kLP tokens are going to be minted to\"},\"returns\":{\"liquidity\":\"kLP tokens sent in exchange for the provision of tokens\"}},\"position()\":{\"returns\":{\"feeGrowthInside0LastX128\":\"The fee growth of token0 as of the last action on the individual position\",\"feeGrowthInside1LastX128\":\"The fee growth of token1 as of the last action on the individual position\",\"liquidity\":\"The amount of liquidity provided to the UniswapV3 pool by the pair manager\",\"tokensOwed0\":\"The uncollected amount of token0 owed to the position as of the last computation\",\"tokensOwed1\":\"The uncollected amount of token1 owed to the position as of the last computation\"}},\"setPendingGovernor(address)\":{\"params\":{\"_pendingGovernor\":\"Address of the proposed new governor\"}},\"transfer(address,uint256)\":{\"details\":\"Moves `amount` tokens from the caller's account to `recipient`. Returns a boolean value indicating whether the operation succeeded. Emits a {Transfer} event.\"},\"transferFrom(address,address,uint256)\":{\"details\":\"Moves `amount` tokens from `sender` to `recipient` 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.\"},\"uniswapV3MintCallback(uint256,uint256,bytes)\":{\"params\":{\"amount0Owed\":\"The amount of token0 due to the pool for the minted liquidity\",\"amount1Owed\":\"The amount of token1 due to the pool for the minted liquidity\",\"data\":\"The encoded token0, token1, fee (_poolKey) and the payer (msg.sender) of the IUniV3PairManager#mint function\"}}},\"stateVariables\":{\"_MAX_TICK\":{\"details\":\"Due to tick spacing, pools with different fees may have differences between _MAX_TICK and tickUpper. Use tickUpper to find the max tick of the pool.\"},\"allowance\":{\"details\":\"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.\"},\"balanceOf\":{\"details\":\"Returns the amount of tokens owned by `account`.\"},\"decimals\":{\"details\":\"Returns the decimals places of the token.\"},\"factory\":{\"return\":\"_factory The address of the PairManager Factory\",\"returns\":{\"_0\":\"_factory The address of the PairManager Factory\"}},\"fee\":{\"return\":\"_fee The fee of the Uniswap pool passed into the constructor\",\"returns\":{\"_0\":\"_fee The fee of the Uniswap pool passed into the constructor\"}},\"name\":{\"details\":\"Returns the name of the token.\"},\"pool\":{\"return\":\"_pool The address of the pool\",\"returns\":{\"_0\":\"_pool The address of the pool\"}},\"sqrtRatioAX96\":{\"return\":\"_sqrtPriceA96 A Fixed point Q64.96 number representing the sqrt of the ratio of the two assets (token1/token0) at the lowest tick\",\"returns\":{\"_0\":\"_sqrtPriceA96 A Fixed point Q64.96 number representing the sqrt of the ratio of the two assets (token1/token0) at the lowest tick\"}},\"sqrtRatioBX96\":{\"return\":\"_sqrtPriceBX96 A Fixed point Q64.96 number representing the sqrt of the ratio of the two assets (token1/token0) at the highest tick\",\"returns\":{\"_0\":\"_sqrtPriceBX96 A Fixed point Q64.96 number representing the sqrt of the ratio of the two assets (token1/token0) at the highest tick\"}},\"symbol\":{\"details\":\"Returns the symbol of the token.\"},\"tickLower\":{\"return\":\"_tickLower The lower tick in the Uniswap's curve\",\"returns\":{\"_0\":\"_tickLower The lower tick in the Uniswap's curve\"}},\"tickSpacing\":{\"return\":\"_tickSpacing The pair tick spacing\",\"returns\":{\"_0\":\"_tickSpacing The pair tick spacing\"}},\"tickUpper\":{\"return\":\"_tickUpper The highest tick in the Uniswap's curve\",\"returns\":{\"_0\":\"_tickUpper The highest tick in the Uniswap's curve\"}},\"token0\":{\"return\":\"_token0 The address of token0\",\"returns\":{\"_0\":\"_token0 The address of token0\"}},\"token1\":{\"return\":\"_token1 The address of token1\",\"returns\":{\"_0\":\"_token1 The address of token1\"}},\"totalSupply\":{\"details\":\"Returns the amount of tokens in existence.\"}},\"version\":1},\"userdoc\":{\"errors\":{\"ExcessiveSlippage()\":[{\"notice\":\"Throws when the slippage exceeds what the user is comfortable with\"}],\"InvalidAddress()\":[{\"notice\":\"Thrown if an address is invalid\"}],\"InvalidAmount()\":[{\"notice\":\"Thrown if an amount is invalid\"}],\"LengthMismatch()\":[{\"notice\":\"Thrown if the lengths of a set of lists mismatch\"}],\"OnlyGovernor()\":[{\"notice\":\"Thrown if a non-governor user tries to call a OnlyGovernor function\"}],\"OnlyPendingGovernor()\":[{\"notice\":\"Thrown if a non-pending-governor user tries to call a OnlyPendingGovernor function\"}],\"OnlyPool()\":[{\"notice\":\"Throws when the caller of the function is not the pool\"}],\"UnsuccessfulTransfer()\":[{\"notice\":\"Throws when a transfer is unsuccessful\"}],\"ZeroAddress()\":[{\"notice\":\"Thrown if an address is the zero address\"}],\"ZeroAmount()\":[{\"notice\":\"Thrown if an amount is zero\"}]},\"events\":{\"PendingGovernorAccepted(address)\":{\"notice\":\"Emitted when a new governor is set\"},\"PendingGovernorSet(address,address)\":{\"notice\":\"Emitted when a new pending governor is set\"}},\"kind\":\"user\",\"methods\":{\"acceptPendingGovernor()\":{\"notice\":\"Allows a proposed governor to accept the governance\"},\"factory()\":{\"notice\":\"Address of the factory from which the pair manager was created\"},\"fee()\":{\"notice\":\"The fee of the Uniswap pool passed into the constructor\"},\"mint(uint256,uint256,uint256,uint256,address)\":{\"notice\":\"Mints kLP tokens to an address according to the liquidity the msg.sender provides to the UniswapV3 pool\"},\"pool()\":{\"notice\":\"Address of the pool from which the Keep3r pair manager will interact with\"},\"position()\":{\"notice\":\"Returns the pair manager's position in the corresponding UniswapV3 pool\"},\"setPendingGovernor(address)\":{\"notice\":\"Allows a governor to propose a new governor\"},\"sqrtRatioAX96()\":{\"notice\":\"The sqrtRatioAX96 at the lowest tick (-887200) of the Uniswap pool\"},\"sqrtRatioBX96()\":{\"notice\":\"The sqrtRatioBX96 at the highest tick (887200) of the Uniswap pool\"},\"tickLower()\":{\"notice\":\"Lowest tick in the Uniswap's curve\"},\"tickSpacing()\":{\"notice\":\"The pair tick spacing\"},\"tickUpper()\":{\"notice\":\"Highest tick in the Uniswap's curve\"},\"token0()\":{\"notice\":\"Token0 of the pool\"},\"token1()\":{\"notice\":\"Token1 of the pool\"},\"uniswapV3MintCallback(uint256,uint256,bytes)\":{\"notice\":\"This function is called after a user calls IUniV3PairManager#mint function It ensures that any tokens owed to the pool are paid by the msg.sender of IUniV3PairManager#mint function\"}},\"version\":1}},\"settings\":{\"compilationTarget\":{\"solidity/contracts/UniV3PairManager.sol\":\"UniV3PairManager\"},\"evmVersion\":\"london\",\"libraries\":{\":__CACHE_BREAKER__\":\"0x00000000d41867734bbee4c6863d9255b2b06ac1\"},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":200},\"remappings\":[]},\"sources\":{\"@defi-wonderland/solidity-utils/solidity/contracts/Governable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.8 <0.9.0;\\n\\nimport {IGovernable} from '../interfaces/IGovernable.sol';\\n\\n/// @title Governable contract\\n/// @notice Manages the governor role\\nabstract contract Governable is IGovernable {\\n /// @inheritdoc IGovernable\\n address public governor;\\n\\n /// @inheritdoc IGovernable\\n address public pendingGovernor;\\n\\n constructor(address _governor) {\\n if (_governor == address(0)) revert ZeroAddress();\\n governor = _governor;\\n }\\n\\n /// @inheritdoc IGovernable\\n function setPendingGovernor(address _pendingGovernor) external onlyGovernor {\\n _setPendingGovernor(_pendingGovernor);\\n }\\n\\n /// @inheritdoc IGovernable\\n function acceptPendingGovernor() external onlyPendingGovernor {\\n _acceptPendingGovernor();\\n }\\n\\n function _setPendingGovernor(address _pendingGovernor) internal {\\n if (_pendingGovernor == address(0)) revert ZeroAddress();\\n pendingGovernor = _pendingGovernor;\\n emit PendingGovernorSet(governor, _pendingGovernor);\\n }\\n\\n function _acceptPendingGovernor() internal {\\n governor = pendingGovernor;\\n delete pendingGovernor;\\n emit PendingGovernorAccepted(governor);\\n }\\n\\n /// @notice Functions with this modifier can only be called by governor\\n modifier onlyGovernor() {\\n if (msg.sender != governor) revert OnlyGovernor();\\n _;\\n }\\n\\n /// @notice Functions with this modifier can only be called by pendingGovernor\\n modifier onlyPendingGovernor() {\\n if (msg.sender != pendingGovernor) revert OnlyPendingGovernor();\\n _;\\n }\\n}\\n\",\"keccak256\":\"0x3f11408cfcb015a99dc417e075c8ebc39b796fc2adc3e81b036487e4486881b3\",\"license\":\"MIT\"},\"@defi-wonderland/solidity-utils/solidity/interfaces/IBaseErrors.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.8 <0.9.0;\\n\\ninterface IBaseErrors {\\n /// @notice Thrown if an address is invalid\\n error InvalidAddress();\\n\\n /// @notice Thrown if an amount is invalid\\n error InvalidAmount();\\n\\n /// @notice Thrown if the lengths of a set of lists mismatch\\n error LengthMismatch();\\n\\n /// @notice Thrown if an address is the zero address\\n error ZeroAddress();\\n\\n /// @notice Thrown if an amount is zero\\n error ZeroAmount();\\n}\\n\",\"keccak256\":\"0xec09b9d248b6fbf6343dee41d6978abdc15d4c8df5ed7721e8df79e8b1a558cf\",\"license\":\"MIT\"},\"@defi-wonderland/solidity-utils/solidity/interfaces/IGovernable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.8 <0.9.0;\\n\\nimport {IBaseErrors} from './IBaseErrors.sol';\\n\\n/// @title Governable interface\\ninterface IGovernable is IBaseErrors {\\n // STATE VARIABLES\\n\\n /// @return _governor Address of the current governor\\n function governor() external view returns (address _governor);\\n\\n /// @return _pendingGovernor Address of the current pending governor\\n function pendingGovernor() external view returns (address _pendingGovernor);\\n\\n // EVENTS\\n\\n /// @notice Emitted when a new pending governor is set\\n /// @param _governor Address of the current governor\\n /// @param _pendingGovernor Address of the proposed next governor\\n event PendingGovernorSet(address _governor, address _pendingGovernor);\\n\\n /// @notice Emitted when a new governor is set\\n /// @param _newGovernor Address of the new governor\\n event PendingGovernorAccepted(address _newGovernor);\\n\\n // ERRORS\\n\\n /// @notice Thrown if a non-governor user tries to call a OnlyGovernor function\\n error OnlyGovernor();\\n\\n /// @notice Thrown if a non-pending-governor user tries to call a OnlyPendingGovernor function\\n error OnlyPendingGovernor();\\n\\n // FUNCTIONS\\n\\n /// @notice Allows a governor to propose a new governor\\n /// @param _pendingGovernor Address of the proposed new governor\\n function setPendingGovernor(address _pendingGovernor) external;\\n\\n /// @notice Allows a proposed governor to accept the governance\\n function acceptPendingGovernor() external;\\n}\\n\",\"keccak256\":\"0x40b94706a00d2c092f620807ba84bdd0c5ed8cfa60140c924edc850427e0af13\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC20/ERC20.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"./IERC20.sol\\\";\\nimport \\\"./extensions/IERC20Metadata.sol\\\";\\nimport \\\"../../utils/Context.sol\\\";\\n\\n/**\\n * @dev Implementation of the {IERC20} interface.\\n *\\n * This implementation is agnostic to the way tokens are created. This means\\n * that a supply mechanism has to be added in a derived contract using {_mint}.\\n * For a generic mechanism see {ERC20PresetMinterPauser}.\\n *\\n * TIP: For a detailed writeup see our guide\\n * https://forum.zeppelin.solutions/t/how-to-implement-erc20-supply-mechanisms/226[How\\n * to implement supply mechanisms].\\n *\\n * We have followed general OpenZeppelin Contracts guidelines: functions revert\\n * instead returning `false` on failure. This behavior is nonetheless\\n * conventional and does not conflict with the expectations of ERC20\\n * applications.\\n *\\n * Additionally, an {Approval} event is emitted on calls to {transferFrom}.\\n * This allows applications to reconstruct the allowance for all accounts just\\n * by listening to said events. Other implementations of the EIP may not emit\\n * these events, as it isn't required by the specification.\\n *\\n * Finally, the non-standard {decreaseAllowance} and {increaseAllowance}\\n * functions have been added to mitigate the well-known issues around setting\\n * allowances. See {IERC20-approve}.\\n */\\ncontract ERC20 is Context, IERC20, IERC20Metadata {\\n mapping(address => uint256) private _balances;\\n\\n mapping(address => mapping(address => uint256)) private _allowances;\\n\\n uint256 private _totalSupply;\\n\\n string private _name;\\n string private _symbol;\\n\\n /**\\n * @dev Sets the values for {name} and {symbol}.\\n *\\n * The default value of {decimals} is 18. To select a different value for\\n * {decimals} you should overload it.\\n *\\n * All two of these values are immutable: they can only be set once during\\n * construction.\\n */\\n constructor(string memory name_, string memory symbol_) {\\n _name = name_;\\n _symbol = symbol_;\\n }\\n\\n /**\\n * @dev Returns the name of the token.\\n */\\n function name() public view virtual override returns (string memory) {\\n return _name;\\n }\\n\\n /**\\n * @dev Returns the symbol of the token, usually a shorter version of the\\n * name.\\n */\\n function symbol() public view virtual override returns (string memory) {\\n return _symbol;\\n }\\n\\n /**\\n * @dev Returns the number of decimals used to get its user representation.\\n * For example, if `decimals` equals `2`, a balance of `505` tokens should\\n * be displayed to a user as `5.05` (`505 / 10 ** 2`).\\n *\\n * Tokens usually opt for a value of 18, imitating the relationship between\\n * Ether and Wei. This is the value {ERC20} uses, unless this function is\\n * overridden;\\n *\\n * NOTE: This information is only used for _display_ purposes: it in\\n * no way affects any of the arithmetic of the contract, including\\n * {IERC20-balanceOf} and {IERC20-transfer}.\\n */\\n function decimals() public view virtual override returns (uint8) {\\n return 18;\\n }\\n\\n /**\\n * @dev See {IERC20-totalSupply}.\\n */\\n function totalSupply() public view virtual override returns (uint256) {\\n return _totalSupply;\\n }\\n\\n /**\\n * @dev See {IERC20-balanceOf}.\\n */\\n function balanceOf(address account) public view virtual override returns (uint256) {\\n return _balances[account];\\n }\\n\\n /**\\n * @dev See {IERC20-transfer}.\\n *\\n * Requirements:\\n *\\n * - `recipient` cannot be the zero address.\\n * - the caller must have a balance of at least `amount`.\\n */\\n function transfer(address recipient, uint256 amount) public virtual override returns (bool) {\\n _transfer(_msgSender(), recipient, amount);\\n return true;\\n }\\n\\n /**\\n * @dev See {IERC20-allowance}.\\n */\\n function allowance(address owner, address spender) public view virtual override returns (uint256) {\\n return _allowances[owner][spender];\\n }\\n\\n /**\\n * @dev See {IERC20-approve}.\\n *\\n * Requirements:\\n *\\n * - `spender` cannot be the zero address.\\n */\\n function approve(address spender, uint256 amount) public virtual override returns (bool) {\\n _approve(_msgSender(), spender, amount);\\n return true;\\n }\\n\\n /**\\n * @dev See {IERC20-transferFrom}.\\n *\\n * Emits an {Approval} event indicating the updated allowance. This is not\\n * required by the EIP. See the note at the beginning of {ERC20}.\\n *\\n * Requirements:\\n *\\n * - `sender` and `recipient` cannot be the zero address.\\n * - `sender` must have a balance of at least `amount`.\\n * - the caller must have allowance for ``sender``'s tokens of at least\\n * `amount`.\\n */\\n function transferFrom(\\n address sender,\\n address recipient,\\n uint256 amount\\n ) public virtual override returns (bool) {\\n _transfer(sender, recipient, amount);\\n\\n uint256 currentAllowance = _allowances[sender][_msgSender()];\\n require(currentAllowance >= amount, \\\"ERC20: transfer amount exceeds allowance\\\");\\n unchecked {\\n _approve(sender, _msgSender(), currentAllowance - amount);\\n }\\n\\n return true;\\n }\\n\\n /**\\n * @dev Atomically increases the allowance granted to `spender` by the caller.\\n *\\n * This is an alternative to {approve} that can be used as a mitigation for\\n * problems described in {IERC20-approve}.\\n *\\n * Emits an {Approval} event indicating the updated allowance.\\n *\\n * Requirements:\\n *\\n * - `spender` cannot be the zero address.\\n */\\n function increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool) {\\n _approve(_msgSender(), spender, _allowances[_msgSender()][spender] + addedValue);\\n return true;\\n }\\n\\n /**\\n * @dev Atomically decreases the allowance granted to `spender` by the caller.\\n *\\n * This is an alternative to {approve} that can be used as a mitigation for\\n * problems described in {IERC20-approve}.\\n *\\n * Emits an {Approval} event indicating the updated allowance.\\n *\\n * Requirements:\\n *\\n * - `spender` cannot be the zero address.\\n * - `spender` must have allowance for the caller of at least\\n * `subtractedValue`.\\n */\\n function decreaseAllowance(address spender, uint256 subtractedValue) public virtual returns (bool) {\\n uint256 currentAllowance = _allowances[_msgSender()][spender];\\n require(currentAllowance >= subtractedValue, \\\"ERC20: decreased allowance below zero\\\");\\n unchecked {\\n _approve(_msgSender(), spender, currentAllowance - subtractedValue);\\n }\\n\\n return true;\\n }\\n\\n /**\\n * @dev Moves `amount` of tokens from `sender` to `recipient`.\\n *\\n * This internal function is equivalent to {transfer}, and can be used to\\n * e.g. implement automatic token fees, slashing mechanisms, etc.\\n *\\n * Emits a {Transfer} event.\\n *\\n * Requirements:\\n *\\n * - `sender` cannot be the zero address.\\n * - `recipient` cannot be the zero address.\\n * - `sender` must have a balance of at least `amount`.\\n */\\n function _transfer(\\n address sender,\\n address recipient,\\n uint256 amount\\n ) internal virtual {\\n require(sender != address(0), \\\"ERC20: transfer from the zero address\\\");\\n require(recipient != address(0), \\\"ERC20: transfer to the zero address\\\");\\n\\n _beforeTokenTransfer(sender, recipient, amount);\\n\\n uint256 senderBalance = _balances[sender];\\n require(senderBalance >= amount, \\\"ERC20: transfer amount exceeds balance\\\");\\n unchecked {\\n _balances[sender] = senderBalance - amount;\\n }\\n _balances[recipient] += amount;\\n\\n emit Transfer(sender, recipient, amount);\\n\\n _afterTokenTransfer(sender, recipient, amount);\\n }\\n\\n /** @dev Creates `amount` tokens and assigns them to `account`, increasing\\n * the total supply.\\n *\\n * Emits a {Transfer} event with `from` set to the zero address.\\n *\\n * Requirements:\\n *\\n * - `account` cannot be the zero address.\\n */\\n function _mint(address account, uint256 amount) internal virtual {\\n require(account != address(0), \\\"ERC20: mint to the zero address\\\");\\n\\n _beforeTokenTransfer(address(0), account, amount);\\n\\n _totalSupply += amount;\\n _balances[account] += amount;\\n emit Transfer(address(0), account, amount);\\n\\n _afterTokenTransfer(address(0), account, amount);\\n }\\n\\n /**\\n * @dev Destroys `amount` tokens from `account`, reducing the\\n * total supply.\\n *\\n * Emits a {Transfer} event with `to` set to the zero address.\\n *\\n * Requirements:\\n *\\n * - `account` cannot be the zero address.\\n * - `account` must have at least `amount` tokens.\\n */\\n function _burn(address account, uint256 amount) internal virtual {\\n require(account != address(0), \\\"ERC20: burn from the zero address\\\");\\n\\n _beforeTokenTransfer(account, address(0), amount);\\n\\n uint256 accountBalance = _balances[account];\\n require(accountBalance >= amount, \\\"ERC20: burn amount exceeds balance\\\");\\n unchecked {\\n _balances[account] = accountBalance - amount;\\n }\\n _totalSupply -= amount;\\n\\n emit Transfer(account, address(0), amount);\\n\\n _afterTokenTransfer(account, address(0), amount);\\n }\\n\\n /**\\n * @dev Sets `amount` as the allowance of `spender` over the `owner` s tokens.\\n *\\n * This internal function is equivalent to `approve`, and can be used to\\n * e.g. set automatic allowances for certain subsystems, etc.\\n *\\n * Emits an {Approval} event.\\n *\\n * Requirements:\\n *\\n * - `owner` cannot be the zero address.\\n * - `spender` cannot be the zero address.\\n */\\n function _approve(\\n address owner,\\n address spender,\\n uint256 amount\\n ) internal virtual {\\n require(owner != address(0), \\\"ERC20: approve from the zero address\\\");\\n require(spender != address(0), \\\"ERC20: approve to the zero address\\\");\\n\\n _allowances[owner][spender] = amount;\\n emit Approval(owner, spender, amount);\\n }\\n\\n /**\\n * @dev Hook that is called before any transfer of tokens. This includes\\n * minting and burning.\\n *\\n * Calling conditions:\\n *\\n * - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens\\n * will be transferred to `to`.\\n * - when `from` is zero, `amount` tokens will be minted for `to`.\\n * - when `to` is zero, `amount` of ``from``'s tokens will be burned.\\n * - `from` and `to` are never both zero.\\n *\\n * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].\\n */\\n function _beforeTokenTransfer(\\n address from,\\n address to,\\n uint256 amount\\n ) internal virtual {}\\n\\n /**\\n * @dev Hook that is called after any transfer of tokens. This includes\\n * minting and burning.\\n *\\n * Calling conditions:\\n *\\n * - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens\\n * has been transferred to `to`.\\n * - when `from` is zero, `amount` tokens have been minted for `to`.\\n * - when `to` is zero, `amount` of ``from``'s tokens have been burned.\\n * - `from` and `to` are never both zero.\\n *\\n * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].\\n */\\n function _afterTokenTransfer(\\n address from,\\n address to,\\n uint256 amount\\n ) internal virtual {}\\n}\\n\",\"keccak256\":\"0xb03df8481a954604ad0c9125680893b2e3f7ff770fe470e38b89ac61b84e8072\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC20/IERC20.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Interface of the ERC20 standard as defined in the EIP.\\n */\\ninterface IERC20 {\\n /**\\n * @dev Returns the amount of tokens in existence.\\n */\\n function totalSupply() external view returns (uint256);\\n\\n /**\\n * @dev Returns the amount of tokens owned by `account`.\\n */\\n function balanceOf(address account) external view returns (uint256);\\n\\n /**\\n * @dev Moves `amount` tokens from the caller's account to `recipient`.\\n *\\n * Returns a boolean value indicating whether the operation succeeded.\\n *\\n * Emits a {Transfer} event.\\n */\\n function transfer(address recipient, uint256 amount) external returns (bool);\\n\\n /**\\n * @dev Returns the remaining number of tokens that `spender` will be\\n * allowed to spend on behalf of `owner` through {transferFrom}. This is\\n * zero by default.\\n *\\n * This value changes when {approve} or {transferFrom} are called.\\n */\\n function allowance(address owner, address spender) external view returns (uint256);\\n\\n /**\\n * @dev Sets `amount` as the allowance of `spender` over the caller's tokens.\\n *\\n * Returns a boolean value indicating whether the operation succeeded.\\n *\\n * IMPORTANT: Beware that changing an allowance with this method brings the risk\\n * that someone may use both the old and the new allowance by unfortunate\\n * transaction ordering. One possible solution to mitigate this race\\n * condition is to first reduce the spender's allowance to 0 and set the\\n * desired value afterwards:\\n * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729\\n *\\n * Emits an {Approval} event.\\n */\\n function approve(address spender, uint256 amount) external returns (bool);\\n\\n /**\\n * @dev Moves `amount` tokens from `sender` to `recipient` using the\\n * allowance mechanism. `amount` is then deducted from the caller's\\n * allowance.\\n *\\n * Returns a boolean value indicating whether the operation succeeded.\\n *\\n * Emits a {Transfer} event.\\n */\\n function transferFrom(\\n address sender,\\n address recipient,\\n uint256 amount\\n ) external returns (bool);\\n\\n /**\\n * @dev Emitted when `value` tokens are moved from one account (`from`) to\\n * another (`to`).\\n *\\n * Note that `value` may be zero.\\n */\\n event Transfer(address indexed from, address indexed to, uint256 value);\\n\\n /**\\n * @dev Emitted when the allowance of a `spender` for an `owner` is set by\\n * a call to {approve}. `value` is the new allowance.\\n */\\n event Approval(address indexed owner, address indexed spender, uint256 value);\\n}\\n\",\"keccak256\":\"0x027b891937d20ccf213fdb9c31531574256de774bda99d3a70ecef6e1913ed2a\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../IERC20.sol\\\";\\n\\n/**\\n * @dev Interface for the optional metadata functions from the ERC20 standard.\\n *\\n * _Available since v4.1._\\n */\\ninterface IERC20Metadata is IERC20 {\\n /**\\n * @dev Returns the name of the token.\\n */\\n function name() external view returns (string memory);\\n\\n /**\\n * @dev Returns the symbol of the token.\\n */\\n function symbol() external view returns (string memory);\\n\\n /**\\n * @dev Returns the decimals places of the token.\\n */\\n function decimals() external view returns (uint8);\\n}\\n\",\"keccak256\":\"0x83fe24f5c04a56091e50f4a345ff504c8bff658a76d4c43b16878c8f940c53b2\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/Context.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Provides information about the current execution context, including the\\n * sender of the transaction and its data. While these are generally available\\n * via msg.sender and msg.data, they should not be accessed in such a direct\\n * manner, since when dealing with meta-transactions the account sending and\\n * paying for execution may not be the actual sender (as far as an application\\n * is concerned).\\n *\\n * This contract is only required for intermediate, library-like contracts.\\n */\\nabstract contract Context {\\n function _msgSender() internal view virtual returns (address) {\\n return msg.sender;\\n }\\n\\n function _msgData() internal view virtual returns (bytes calldata) {\\n return msg.data;\\n }\\n}\\n\",\"keccak256\":\"0x90565a39ae45c80f0468dc96c7b20d0afc3055f344c8203a0c9258239f350b9f\",\"license\":\"MIT\"},\"@uniswap/v3-core/contracts/interfaces/IUniswapV3Pool.sol\":{\"content\":\"// SPDX-License-Identifier: GPL-2.0-or-later\\npragma solidity >=0.5.0;\\n\\nimport './pool/IUniswapV3PoolImmutables.sol';\\nimport './pool/IUniswapV3PoolState.sol';\\nimport './pool/IUniswapV3PoolDerivedState.sol';\\nimport './pool/IUniswapV3PoolActions.sol';\\nimport './pool/IUniswapV3PoolOwnerActions.sol';\\nimport './pool/IUniswapV3PoolEvents.sol';\\n\\n/// @title The interface for a Uniswap V3 Pool\\n/// @notice A Uniswap pool facilitates swapping and automated market making between any two assets that strictly conform\\n/// to the ERC20 specification\\n/// @dev The pool interface is broken up into many smaller pieces\\ninterface IUniswapV3Pool is\\n IUniswapV3PoolImmutables,\\n IUniswapV3PoolState,\\n IUniswapV3PoolDerivedState,\\n IUniswapV3PoolActions,\\n IUniswapV3PoolOwnerActions,\\n IUniswapV3PoolEvents\\n{\\n\\n}\\n\",\"keccak256\":\"0xfe6113d518466cd6652c85b111e01f33eb62157f49ae5ed7d5a3947a2044adb1\",\"license\":\"GPL-2.0-or-later\"},\"@uniswap/v3-core/contracts/interfaces/pool/IUniswapV3PoolActions.sol\":{\"content\":\"// SPDX-License-Identifier: GPL-2.0-or-later\\npragma solidity >=0.5.0;\\n\\n/// @title Permissionless pool actions\\n/// @notice Contains pool methods that can be called by anyone\\ninterface IUniswapV3PoolActions {\\n /// @notice Sets the initial price for the pool\\n /// @dev Price is represented as a sqrt(amountToken1/amountToken0) Q64.96 value\\n /// @param sqrtPriceX96 the initial sqrt price of the pool as a Q64.96\\n function initialize(uint160 sqrtPriceX96) external;\\n\\n /// @notice Adds liquidity for the given recipient/tickLower/tickUpper position\\n /// @dev The caller of this method receives a callback in the form of IUniswapV3MintCallback#uniswapV3MintCallback\\n /// in which they must pay any token0 or token1 owed for the liquidity. The amount of token0/token1 due depends\\n /// on tickLower, tickUpper, the amount of liquidity, and the current price.\\n /// @param recipient The address for which the liquidity will be created\\n /// @param tickLower The lower tick of the position in which to add liquidity\\n /// @param tickUpper The upper tick of the position in which to add liquidity\\n /// @param amount The amount of liquidity to mint\\n /// @param data Any data that should be passed through to the callback\\n /// @return amount0 The amount of token0 that was paid to mint the given amount of liquidity. Matches the value in the callback\\n /// @return amount1 The amount of token1 that was paid to mint the given amount of liquidity. Matches the value in the callback\\n function mint(\\n address recipient,\\n int24 tickLower,\\n int24 tickUpper,\\n uint128 amount,\\n bytes calldata data\\n ) external returns (uint256 amount0, uint256 amount1);\\n\\n /// @notice Collects tokens owed to a position\\n /// @dev Does not recompute fees earned, which must be done either via mint or burn of any amount of liquidity.\\n /// Collect must be called by the position owner. To withdraw only token0 or only token1, amount0Requested or\\n /// amount1Requested may be set to zero. To withdraw all tokens owed, caller may pass any value greater than the\\n /// actual tokens owed, e.g. type(uint128).max. Tokens owed may be from accumulated swap fees or burned liquidity.\\n /// @param recipient The address which should receive the fees collected\\n /// @param tickLower The lower tick of the position for which to collect fees\\n /// @param tickUpper The upper tick of the position for which to collect fees\\n /// @param amount0Requested How much token0 should be withdrawn from the fees owed\\n /// @param amount1Requested How much token1 should be withdrawn from the fees owed\\n /// @return amount0 The amount of fees collected in token0\\n /// @return amount1 The amount of fees collected in token1\\n function collect(\\n address recipient,\\n int24 tickLower,\\n int24 tickUpper,\\n uint128 amount0Requested,\\n uint128 amount1Requested\\n ) external returns (uint128 amount0, uint128 amount1);\\n\\n /// @notice Burn liquidity from the sender and account tokens owed for the liquidity to the position\\n /// @dev Can be used to trigger a recalculation of fees owed to a position by calling with an amount of 0\\n /// @dev Fees must be collected separately via a call to #collect\\n /// @param tickLower The lower tick of the position for which to burn liquidity\\n /// @param tickUpper The upper tick of the position for which to burn liquidity\\n /// @param amount How much liquidity to burn\\n /// @return amount0 The amount of token0 sent to the recipient\\n /// @return amount1 The amount of token1 sent to the recipient\\n function burn(\\n int24 tickLower,\\n int24 tickUpper,\\n uint128 amount\\n ) external returns (uint256 amount0, uint256 amount1);\\n\\n /// @notice Swap token0 for token1, or token1 for token0\\n /// @dev The caller of this method receives a callback in the form of IUniswapV3SwapCallback#uniswapV3SwapCallback\\n /// @param recipient The address to receive the output of the swap\\n /// @param zeroForOne The direction of the swap, true for token0 to token1, false for token1 to token0\\n /// @param amountSpecified The amount of the swap, which implicitly configures the swap as exact input (positive), or exact output (negative)\\n /// @param sqrtPriceLimitX96 The Q64.96 sqrt price limit. If zero for one, the price cannot be less than this\\n /// value after the swap. If one for zero, the price cannot be greater than this value after the swap\\n /// @param data Any data to be passed through to the callback\\n /// @return amount0 The delta of the balance of token0 of the pool, exact when negative, minimum when positive\\n /// @return amount1 The delta of the balance of token1 of the pool, exact when negative, minimum when positive\\n function swap(\\n address recipient,\\n bool zeroForOne,\\n int256 amountSpecified,\\n uint160 sqrtPriceLimitX96,\\n bytes calldata data\\n ) external returns (int256 amount0, int256 amount1);\\n\\n /// @notice Receive token0 and/or token1 and pay it back, plus a fee, in the callback\\n /// @dev The caller of this method receives a callback in the form of IUniswapV3FlashCallback#uniswapV3FlashCallback\\n /// @dev Can be used to donate underlying tokens pro-rata to currently in-range liquidity providers by calling\\n /// with 0 amount{0,1} and sending the donation amount(s) from the callback\\n /// @param recipient The address which will receive the token0 and token1 amounts\\n /// @param amount0 The amount of token0 to send\\n /// @param amount1 The amount of token1 to send\\n /// @param data Any data to be passed through to the callback\\n function flash(\\n address recipient,\\n uint256 amount0,\\n uint256 amount1,\\n bytes calldata data\\n ) external;\\n\\n /// @notice Increase the maximum number of price and liquidity observations that this pool will store\\n /// @dev This method is no-op if the pool already has an observationCardinalityNext greater than or equal to\\n /// the input observationCardinalityNext.\\n /// @param observationCardinalityNext The desired minimum number of observations for the pool to store\\n function increaseObservationCardinalityNext(uint16 observationCardinalityNext) external;\\n}\\n\",\"keccak256\":\"0x9453dd0e7442188667d01d9b65de3f1e14e9511ff3e303179a15f6fc267f7634\",\"license\":\"GPL-2.0-or-later\"},\"@uniswap/v3-core/contracts/interfaces/pool/IUniswapV3PoolDerivedState.sol\":{\"content\":\"// SPDX-License-Identifier: GPL-2.0-or-later\\npragma solidity >=0.5.0;\\n\\n/// @title Pool state that is not stored\\n/// @notice Contains view functions to provide information about the pool that is computed rather than stored on the\\n/// blockchain. The functions here may have variable gas costs.\\ninterface IUniswapV3PoolDerivedState {\\n /// @notice Returns the cumulative tick and liquidity as of each timestamp `secondsAgo` from the current block timestamp\\n /// @dev To get a time weighted average tick or liquidity-in-range, you must call this with two values, one representing\\n /// the beginning of the period and another for the end of the period. E.g., to get the last hour time-weighted average tick,\\n /// you must call it with secondsAgos = [3600, 0].\\n /// @dev The time weighted average tick represents the geometric time weighted average price of the pool, in\\n /// log base sqrt(1.0001) of token1 / token0. The TickMath library can be used to go from a tick value to a ratio.\\n /// @param secondsAgos From how long ago each cumulative tick and liquidity value should be returned\\n /// @return tickCumulatives Cumulative tick values as of each `secondsAgos` from the current block timestamp\\n /// @return secondsPerLiquidityCumulativeX128s Cumulative seconds per liquidity-in-range value as of each `secondsAgos` from the current block\\n /// timestamp\\n function observe(uint32[] calldata secondsAgos)\\n external\\n view\\n returns (int56[] memory tickCumulatives, uint160[] memory secondsPerLiquidityCumulativeX128s);\\n\\n /// @notice Returns a snapshot of the tick cumulative, seconds per liquidity and seconds inside a tick range\\n /// @dev Snapshots must only be compared to other snapshots, taken over a period for which a position existed.\\n /// I.e., snapshots cannot be compared if a position is not held for the entire period between when the first\\n /// snapshot is taken and the second snapshot is taken.\\n /// @param tickLower The lower tick of the range\\n /// @param tickUpper The upper tick of the range\\n /// @return tickCumulativeInside The snapshot of the tick accumulator for the range\\n /// @return secondsPerLiquidityInsideX128 The snapshot of seconds per liquidity for the range\\n /// @return secondsInside The snapshot of seconds per liquidity for the range\\n function snapshotCumulativesInside(int24 tickLower, int24 tickUpper)\\n external\\n view\\n returns (\\n int56 tickCumulativeInside,\\n uint160 secondsPerLiquidityInsideX128,\\n uint32 secondsInside\\n );\\n}\\n\",\"keccak256\":\"0xe603ac5b17ecdee73ba2b27efdf386c257a19c14206e87eee77e2017b742d9e5\",\"license\":\"GPL-2.0-or-later\"},\"@uniswap/v3-core/contracts/interfaces/pool/IUniswapV3PoolEvents.sol\":{\"content\":\"// SPDX-License-Identifier: GPL-2.0-or-later\\npragma solidity >=0.5.0;\\n\\n/// @title Events emitted by a pool\\n/// @notice Contains all events emitted by the pool\\ninterface IUniswapV3PoolEvents {\\n /// @notice Emitted exactly once by a pool when #initialize is first called on the pool\\n /// @dev Mint/Burn/Swap cannot be emitted by the pool before Initialize\\n /// @param sqrtPriceX96 The initial sqrt price of the pool, as a Q64.96\\n /// @param tick The initial tick of the pool, i.e. log base 1.0001 of the starting price of the pool\\n event Initialize(uint160 sqrtPriceX96, int24 tick);\\n\\n /// @notice Emitted when liquidity is minted for a given position\\n /// @param sender The address that minted the liquidity\\n /// @param owner The owner of the position and recipient of any minted liquidity\\n /// @param tickLower The lower tick of the position\\n /// @param tickUpper The upper tick of the position\\n /// @param amount The amount of liquidity minted to the position range\\n /// @param amount0 How much token0 was required for the minted liquidity\\n /// @param amount1 How much token1 was required for the minted liquidity\\n event Mint(\\n address sender,\\n address indexed owner,\\n int24 indexed tickLower,\\n int24 indexed tickUpper,\\n uint128 amount,\\n uint256 amount0,\\n uint256 amount1\\n );\\n\\n /// @notice Emitted when fees are collected by the owner of a position\\n /// @dev Collect events may be emitted with zero amount0 and amount1 when the caller chooses not to collect fees\\n /// @param owner The owner of the position for which fees are collected\\n /// @param tickLower The lower tick of the position\\n /// @param tickUpper The upper tick of the position\\n /// @param amount0 The amount of token0 fees collected\\n /// @param amount1 The amount of token1 fees collected\\n event Collect(\\n address indexed owner,\\n address recipient,\\n int24 indexed tickLower,\\n int24 indexed tickUpper,\\n uint128 amount0,\\n uint128 amount1\\n );\\n\\n /// @notice Emitted when a position's liquidity is removed\\n /// @dev Does not withdraw any fees earned by the liquidity position, which must be withdrawn via #collect\\n /// @param owner The owner of the position for which liquidity is removed\\n /// @param tickLower The lower tick of the position\\n /// @param tickUpper The upper tick of the position\\n /// @param amount The amount of liquidity to remove\\n /// @param amount0 The amount of token0 withdrawn\\n /// @param amount1 The amount of token1 withdrawn\\n event Burn(\\n address indexed owner,\\n int24 indexed tickLower,\\n int24 indexed tickUpper,\\n uint128 amount,\\n uint256 amount0,\\n uint256 amount1\\n );\\n\\n /// @notice Emitted by the pool for any swaps between token0 and token1\\n /// @param sender The address that initiated the swap call, and that received the callback\\n /// @param recipient The address that received the output of the swap\\n /// @param amount0 The delta of the token0 balance of the pool\\n /// @param amount1 The delta of the token1 balance of the pool\\n /// @param sqrtPriceX96 The sqrt(price) of the pool after the swap, as a Q64.96\\n /// @param liquidity The liquidity of the pool after the swap\\n /// @param tick The log base 1.0001 of price of the pool after the swap\\n event Swap(\\n address indexed sender,\\n address indexed recipient,\\n int256 amount0,\\n int256 amount1,\\n uint160 sqrtPriceX96,\\n uint128 liquidity,\\n int24 tick\\n );\\n\\n /// @notice Emitted by the pool for any flashes of token0/token1\\n /// @param sender The address that initiated the swap call, and that received the callback\\n /// @param recipient The address that received the tokens from flash\\n /// @param amount0 The amount of token0 that was flashed\\n /// @param amount1 The amount of token1 that was flashed\\n /// @param paid0 The amount of token0 paid for the flash, which can exceed the amount0 plus the fee\\n /// @param paid1 The amount of token1 paid for the flash, which can exceed the amount1 plus the fee\\n event Flash(\\n address indexed sender,\\n address indexed recipient,\\n uint256 amount0,\\n uint256 amount1,\\n uint256 paid0,\\n uint256 paid1\\n );\\n\\n /// @notice Emitted by the pool for increases to the number of observations that can be stored\\n /// @dev observationCardinalityNext is not the observation cardinality until an observation is written at the index\\n /// just before a mint/swap/burn.\\n /// @param observationCardinalityNextOld The previous value of the next observation cardinality\\n /// @param observationCardinalityNextNew The updated value of the next observation cardinality\\n event IncreaseObservationCardinalityNext(\\n uint16 observationCardinalityNextOld,\\n uint16 observationCardinalityNextNew\\n );\\n\\n /// @notice Emitted when the protocol fee is changed by the pool\\n /// @param feeProtocol0Old The previous value of the token0 protocol fee\\n /// @param feeProtocol1Old The previous value of the token1 protocol fee\\n /// @param feeProtocol0New The updated value of the token0 protocol fee\\n /// @param feeProtocol1New The updated value of the token1 protocol fee\\n event SetFeeProtocol(uint8 feeProtocol0Old, uint8 feeProtocol1Old, uint8 feeProtocol0New, uint8 feeProtocol1New);\\n\\n /// @notice Emitted when the collected protocol fees are withdrawn by the factory owner\\n /// @param sender The address that collects the protocol fees\\n /// @param recipient The address that receives the collected protocol fees\\n /// @param amount0 The amount of token0 protocol fees that is withdrawn\\n /// @param amount0 The amount of token1 protocol fees that is withdrawn\\n event CollectProtocol(address indexed sender, address indexed recipient, uint128 amount0, uint128 amount1);\\n}\\n\",\"keccak256\":\"0x8071514d0fe5d17d6fbd31c191cdfb703031c24e0ece3621d88ab10e871375cd\",\"license\":\"GPL-2.0-or-later\"},\"@uniswap/v3-core/contracts/interfaces/pool/IUniswapV3PoolImmutables.sol\":{\"content\":\"// SPDX-License-Identifier: GPL-2.0-or-later\\npragma solidity >=0.5.0;\\n\\n/// @title Pool state that never changes\\n/// @notice These parameters are fixed for a pool forever, i.e., the methods will always return the same values\\ninterface IUniswapV3PoolImmutables {\\n /// @notice The contract that deployed the pool, which must adhere to the IUniswapV3Factory interface\\n /// @return The contract address\\n function factory() external view returns (address);\\n\\n /// @notice The first of the two tokens of the pool, sorted by address\\n /// @return The token contract address\\n function token0() external view returns (address);\\n\\n /// @notice The second of the two tokens of the pool, sorted by address\\n /// @return The token contract address\\n function token1() external view returns (address);\\n\\n /// @notice The pool's fee in hundredths of a bip, i.e. 1e-6\\n /// @return The fee\\n function fee() external view returns (uint24);\\n\\n /// @notice The pool tick spacing\\n /// @dev Ticks can only be used at multiples of this value, minimum of 1 and always positive\\n /// e.g.: a tickSpacing of 3 means ticks can be initialized every 3rd tick, i.e., ..., -6, -3, 0, 3, 6, ...\\n /// This value is an int24 to avoid casting even though it is always positive.\\n /// @return The tick spacing\\n function tickSpacing() external view returns (int24);\\n\\n /// @notice The maximum amount of position liquidity that can use any tick in the range\\n /// @dev This parameter is enforced per tick to prevent liquidity from overflowing a uint128 at any point, and\\n /// also prevents out-of-range liquidity from being used to prevent adding in-range liquidity to a pool\\n /// @return The max amount of liquidity per tick\\n function maxLiquidityPerTick() external view returns (uint128);\\n}\\n\",\"keccak256\":\"0xf6e5d2cd1139c4c276bdbc8e1d2b256e456c866a91f1b868da265c6d2685c3f7\",\"license\":\"GPL-2.0-or-later\"},\"@uniswap/v3-core/contracts/interfaces/pool/IUniswapV3PoolOwnerActions.sol\":{\"content\":\"// SPDX-License-Identifier: GPL-2.0-or-later\\npragma solidity >=0.5.0;\\n\\n/// @title Permissioned pool actions\\n/// @notice Contains pool methods that may only be called by the factory owner\\ninterface IUniswapV3PoolOwnerActions {\\n /// @notice Set the denominator of the protocol's % share of the fees\\n /// @param feeProtocol0 new protocol fee for token0 of the pool\\n /// @param feeProtocol1 new protocol fee for token1 of the pool\\n function setFeeProtocol(uint8 feeProtocol0, uint8 feeProtocol1) external;\\n\\n /// @notice Collect the protocol fee accrued to the pool\\n /// @param recipient The address to which collected protocol fees should be sent\\n /// @param amount0Requested The maximum amount of token0 to send, can be 0 to collect fees in only token1\\n /// @param amount1Requested The maximum amount of token1 to send, can be 0 to collect fees in only token0\\n /// @return amount0 The protocol fee collected in token0\\n /// @return amount1 The protocol fee collected in token1\\n function collectProtocol(\\n address recipient,\\n uint128 amount0Requested,\\n uint128 amount1Requested\\n ) external returns (uint128 amount0, uint128 amount1);\\n}\\n\",\"keccak256\":\"0x759b78a2918af9e99e246dc3af084f654e48ef32bb4e4cb8a966aa3dcaece235\",\"license\":\"GPL-2.0-or-later\"},\"@uniswap/v3-core/contracts/interfaces/pool/IUniswapV3PoolState.sol\":{\"content\":\"// SPDX-License-Identifier: GPL-2.0-or-later\\npragma solidity >=0.5.0;\\n\\n/// @title Pool state that can change\\n/// @notice These methods compose the pool's state, and can change with any frequency including multiple times\\n/// per transaction\\ninterface IUniswapV3PoolState {\\n /// @notice The 0th storage slot in the pool stores many values, and is exposed as a single method to save gas\\n /// when accessed externally.\\n /// @return sqrtPriceX96 The current price of the pool as a sqrt(token1/token0) Q64.96 value\\n /// tick The current tick of the pool, i.e. according to the last tick transition that was run.\\n /// This value may not always be equal to SqrtTickMath.getTickAtSqrtRatio(sqrtPriceX96) if the price is on a tick\\n /// boundary.\\n /// observationIndex The index of the last oracle observation that was written,\\n /// observationCardinality The current maximum number of observations stored in the pool,\\n /// observationCardinalityNext The next maximum number of observations, to be updated when the observation.\\n /// feeProtocol The protocol fee for both tokens of the pool.\\n /// Encoded as two 4 bit values, where the protocol fee of token1 is shifted 4 bits and the protocol fee of token0\\n /// is the lower 4 bits. Used as the denominator of a fraction of the swap fee, e.g. 4 means 1/4th of the swap fee.\\n /// unlocked Whether the pool is currently locked to reentrancy\\n function slot0()\\n external\\n view\\n returns (\\n uint160 sqrtPriceX96,\\n int24 tick,\\n uint16 observationIndex,\\n uint16 observationCardinality,\\n uint16 observationCardinalityNext,\\n uint8 feeProtocol,\\n bool unlocked\\n );\\n\\n /// @notice The fee growth as a Q128.128 fees of token0 collected per unit of liquidity for the entire life of the pool\\n /// @dev This value can overflow the uint256\\n function feeGrowthGlobal0X128() external view returns (uint256);\\n\\n /// @notice The fee growth as a Q128.128 fees of token1 collected per unit of liquidity for the entire life of the pool\\n /// @dev This value can overflow the uint256\\n function feeGrowthGlobal1X128() external view returns (uint256);\\n\\n /// @notice The amounts of token0 and token1 that are owed to the protocol\\n /// @dev Protocol fees will never exceed uint128 max in either token\\n function protocolFees() external view returns (uint128 token0, uint128 token1);\\n\\n /// @notice The currently in range liquidity available to the pool\\n /// @dev This value has no relationship to the total liquidity across all ticks\\n function liquidity() external view returns (uint128);\\n\\n /// @notice Look up information about a specific tick in the pool\\n /// @param tick The tick to look up\\n /// @return liquidityGross the total amount of position liquidity that uses the pool either as tick lower or\\n /// tick upper,\\n /// liquidityNet how much liquidity changes when the pool price crosses the tick,\\n /// feeGrowthOutside0X128 the fee growth on the other side of the tick from the current tick in token0,\\n /// feeGrowthOutside1X128 the fee growth on the other side of the tick from the current tick in token1,\\n /// tickCumulativeOutside the cumulative tick value on the other side of the tick from the current tick\\n /// secondsPerLiquidityOutsideX128 the seconds spent per liquidity on the other side of the tick from the current tick,\\n /// secondsOutside the seconds spent on the other side of the tick from the current tick,\\n /// initialized Set to true if the tick is initialized, i.e. liquidityGross is greater than 0, otherwise equal to false.\\n /// Outside values can only be used if the tick is initialized, i.e. if liquidityGross is greater than 0.\\n /// In addition, these values are only relative and must be used only in comparison to previous snapshots for\\n /// a specific position.\\n function ticks(int24 tick)\\n external\\n view\\n returns (\\n uint128 liquidityGross,\\n int128 liquidityNet,\\n uint256 feeGrowthOutside0X128,\\n uint256 feeGrowthOutside1X128,\\n int56 tickCumulativeOutside,\\n uint160 secondsPerLiquidityOutsideX128,\\n uint32 secondsOutside,\\n bool initialized\\n );\\n\\n /// @notice Returns 256 packed tick initialized boolean values. See TickBitmap for more information\\n function tickBitmap(int16 wordPosition) external view returns (uint256);\\n\\n /// @notice Returns the information about a position by the position's key\\n /// @param key The position's key is a hash of a preimage composed by the owner, tickLower and tickUpper\\n /// @return _liquidity The amount of liquidity in the position,\\n /// Returns feeGrowthInside0LastX128 fee growth of token0 inside the tick range as of the last mint/burn/poke,\\n /// Returns feeGrowthInside1LastX128 fee growth of token1 inside the tick range as of the last mint/burn/poke,\\n /// Returns tokensOwed0 the computed amount of token0 owed to the position as of the last mint/burn/poke,\\n /// Returns tokensOwed1 the computed amount of token1 owed to the position as of the last mint/burn/poke\\n function positions(bytes32 key)\\n external\\n view\\n returns (\\n uint128 _liquidity,\\n uint256 feeGrowthInside0LastX128,\\n uint256 feeGrowthInside1LastX128,\\n uint128 tokensOwed0,\\n uint128 tokensOwed1\\n );\\n\\n /// @notice Returns data about a specific observation index\\n /// @param index The element of the observations array to fetch\\n /// @dev You most likely want to use #observe() instead of this method to get an observation as of some amount of time\\n /// ago, rather than at a specific index in the array.\\n /// @return blockTimestamp The timestamp of the observation,\\n /// Returns tickCumulative the tick multiplied by seconds elapsed for the life of the pool as of the observation timestamp,\\n /// Returns secondsPerLiquidityCumulativeX128 the seconds per in range liquidity for the life of the pool as of the observation timestamp,\\n /// Returns initialized whether the observation has been initialized and the values are safe to use\\n function observations(uint256 index)\\n external\\n view\\n returns (\\n uint32 blockTimestamp,\\n int56 tickCumulative,\\n uint160 secondsPerLiquidityCumulativeX128,\\n bool initialized\\n );\\n}\\n\",\"keccak256\":\"0x852dc1f5df7dcf7f11e7bb3eed79f0cea72ad4b25f6a9d2c35aafb48925fd49f\",\"license\":\"GPL-2.0-or-later\"},\"solidity/contracts/UniV3PairManager.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\n/*\\n\\nCoded for The Keep3r Network with \\u2665 by\\n\\n\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2557\\u2591\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2557\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2557\\u2588\\u2588\\u2557\\u2003\\u2003\\u2591\\u2588\\u2588\\u2557\\u2591\\u2591\\u2591\\u2591\\u2591\\u2591\\u2591\\u2588\\u2588\\u2557\\u2591\\u2588\\u2588\\u2588\\u2588\\u2588\\u2557\\u2591\\u2588\\u2588\\u2588\\u2557\\u2591\\u2591\\u2588\\u2588\\u2557\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2557\\u2591\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2557\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2557\\u2591\\u2588\\u2588\\u2557\\u2591\\u2591\\u2591\\u2591\\u2591\\u2591\\u2588\\u2588\\u2588\\u2588\\u2588\\u2557\\u2591\\u2588\\u2588\\u2588\\u2557\\u2591\\u2591\\u2588\\u2588\\u2557\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2557\\u2591\\n\\u2588\\u2588\\u2554\\u2550\\u2550\\u2588\\u2588\\u2557\\u2588\\u2588\\u2554\\u2550\\u2550\\u2550\\u2550\\u255d\\u2588\\u2588\\u2554\\u2550\\u2550\\u2550\\u2550\\u255d\\u2588\\u2588\\u2551\\u2003\\u2003\\u2591\\u2588\\u2588\\u2551\\u2591\\u2591\\u2588\\u2588\\u2557\\u2591\\u2591\\u2588\\u2588\\u2551\\u2588\\u2588\\u2554\\u2550\\u2550\\u2588\\u2588\\u2557\\u2588\\u2588\\u2588\\u2588\\u2557\\u2591\\u2588\\u2588\\u2551\\u2588\\u2588\\u2554\\u2550\\u2550\\u2588\\u2588\\u2557\\u2588\\u2588\\u2554\\u2550\\u2550\\u2550\\u2550\\u255d\\u2588\\u2588\\u2554\\u2550\\u2550\\u2588\\u2588\\u2557\\u2588\\u2588\\u2551\\u2591\\u2591\\u2591\\u2591\\u2591\\u2588\\u2588\\u2554\\u2550\\u2550\\u2588\\u2588\\u2557\\u2588\\u2588\\u2588\\u2588\\u2557\\u2591\\u2588\\u2588\\u2551\\u2588\\u2588\\u2554\\u2550\\u2550\\u2588\\u2588\\u2557\\n\\u2588\\u2588\\u2551\\u2591\\u2591\\u2588\\u2588\\u2551\\u2588\\u2588\\u2588\\u2588\\u2588\\u2557\\u2591\\u2591\\u2588\\u2588\\u2588\\u2588\\u2588\\u2557\\u2591\\u2591\\u2588\\u2588\\u2551\\u2003\\u2003\\u2591\\u255a\\u2588\\u2588\\u2557\\u2588\\u2588\\u2588\\u2588\\u2557\\u2588\\u2588\\u2554\\u255d\\u2588\\u2588\\u2551\\u2591\\u2591\\u2588\\u2588\\u2551\\u2588\\u2588\\u2554\\u2588\\u2588\\u2557\\u2588\\u2588\\u2551\\u2588\\u2588\\u2551\\u2591\\u2591\\u2588\\u2588\\u2551\\u2588\\u2588\\u2588\\u2588\\u2588\\u2557\\u2591\\u2591\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2554\\u255d\\u2588\\u2588\\u2551\\u2591\\u2591\\u2591\\u2591\\u2591\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2551\\u2588\\u2588\\u2554\\u2588\\u2588\\u2557\\u2588\\u2588\\u2551\\u2588\\u2588\\u2551\\u2591\\u2591\\u2588\\u2588\\u2551\\n\\u2588\\u2588\\u2551\\u2591\\u2591\\u2588\\u2588\\u2551\\u2588\\u2588\\u2554\\u2550\\u2550\\u255d\\u2591\\u2591\\u2588\\u2588\\u2554\\u2550\\u2550\\u255d\\u2591\\u2591\\u2588\\u2588\\u2551\\u2003\\u2003\\u2591\\u2591\\u2588\\u2588\\u2588\\u2588\\u2554\\u2550\\u2588\\u2588\\u2588\\u2588\\u2551\\u2591\\u2588\\u2588\\u2551\\u2591\\u2591\\u2588\\u2588\\u2551\\u2588\\u2588\\u2551\\u255a\\u2588\\u2588\\u2588\\u2588\\u2551\\u2588\\u2588\\u2551\\u2591\\u2591\\u2588\\u2588\\u2551\\u2588\\u2588\\u2554\\u2550\\u2550\\u255d\\u2591\\u2591\\u2588\\u2588\\u2554\\u2550\\u2550\\u2588\\u2588\\u2557\\u2588\\u2588\\u2551\\u2591\\u2591\\u2591\\u2591\\u2591\\u2588\\u2588\\u2554\\u2550\\u2550\\u2588\\u2588\\u2551\\u2588\\u2588\\u2551\\u255a\\u2588\\u2588\\u2588\\u2588\\u2551\\u2588\\u2588\\u2551\\u2591\\u2591\\u2588\\u2588\\u2551\\n\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2554\\u255d\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2557\\u2588\\u2588\\u2551\\u2591\\u2591\\u2591\\u2591\\u2591\\u2588\\u2588\\u2551\\u2003\\u2003\\u2591\\u2591\\u255a\\u2588\\u2588\\u2554\\u255d\\u2591\\u255a\\u2588\\u2588\\u2554\\u255d\\u2591\\u255a\\u2588\\u2588\\u2588\\u2588\\u2588\\u2554\\u255d\\u2588\\u2588\\u2551\\u2591\\u255a\\u2588\\u2588\\u2588\\u2551\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2554\\u255d\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2557\\u2588\\u2588\\u2551\\u2591\\u2591\\u2588\\u2588\\u2551\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2557\\u2588\\u2588\\u2551\\u2591\\u2591\\u2588\\u2588\\u2551\\u2588\\u2588\\u2551\\u2591\\u255a\\u2588\\u2588\\u2588\\u2551\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2554\\u255d\\n\\u255a\\u2550\\u2550\\u2550\\u2550\\u2550\\u255d\\u2591\\u255a\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u255d\\u255a\\u2550\\u255d\\u2591\\u2591\\u2591\\u2591\\u2591\\u255a\\u2550\\u255d\\u2003\\u2003\\u2591\\u2591\\u2591\\u255a\\u2550\\u255d\\u2591\\u2591\\u2591\\u255a\\u2550\\u255d\\u2591\\u2591\\u2591\\u255a\\u2550\\u2550\\u2550\\u2550\\u255d\\u2591\\u255a\\u2550\\u255d\\u2591\\u2591\\u255a\\u2550\\u2550\\u255d\\u255a\\u2550\\u2550\\u2550\\u2550\\u2550\\u255d\\u2591\\u255a\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u255d\\u255a\\u2550\\u255d\\u2591\\u2591\\u255a\\u2550\\u255d\\u255a\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u255d\\u255a\\u2550\\u255d\\u2591\\u2591\\u255a\\u2550\\u255d\\u255a\\u2550\\u255d\\u2591\\u2591\\u255a\\u2550\\u2550\\u255d\\u255a\\u2550\\u2550\\u2550\\u2550\\u2550\\u255d\\u2591\\n\\nhttps://defi.sucks\\n\\n*/\\n\\npragma solidity >=0.8.4 <0.9.0;\\n\\nimport '@defi-wonderland/solidity-utils/solidity/contracts/Governable.sol';\\nimport '@openzeppelin/contracts/token/ERC20/ERC20.sol';\\nimport '@uniswap/v3-core/contracts/interfaces/IUniswapV3Pool.sol';\\n\\nimport './libraries/LiquidityAmounts.sol';\\nimport './libraries/FixedPoint96.sol';\\nimport './libraries/FullMath.sol';\\nimport './libraries/TickMath.sol';\\n\\nimport '../interfaces/external/IWeth9.sol';\\nimport '../interfaces/IUniV3PairManager.sol';\\n\\ncontract UniV3PairManager is IUniV3PairManager, Governable {\\n /// @inheritdoc IERC20Metadata\\n string public override name;\\n\\n /// @inheritdoc IERC20Metadata\\n string public override symbol;\\n\\n /// @inheritdoc IERC20\\n uint256 public override totalSupply;\\n\\n /// @inheritdoc IPairManager\\n address public immutable override factory;\\n\\n /// @inheritdoc IPairManager\\n address public immutable override token0;\\n\\n /// @inheritdoc IPairManager\\n address public immutable override token1;\\n\\n /// @inheritdoc IPairManager\\n address public immutable override pool;\\n\\n /// @inheritdoc IUniV3PairManager\\n uint24 public immutable override fee;\\n\\n /// @inheritdoc IUniV3PairManager\\n uint160 public immutable override sqrtRatioAX96;\\n\\n /// @inheritdoc IUniV3PairManager\\n uint160 public immutable override sqrtRatioBX96;\\n\\n /// @inheritdoc IUniV3PairManager\\n int24 public immutable override tickLower;\\n\\n /// @inheritdoc IUniV3PairManager\\n int24 public immutable override tickUpper;\\n\\n /// @inheritdoc IUniV3PairManager\\n int24 public immutable override tickSpacing;\\n\\n /// @notice Uniswap's maximum tick\\n /// @dev Due to tick spacing, pools with different fees may have differences between _MAX_TICK and tickUpper. Use tickUpper to find the max tick of the pool.\\n int24 private constant _MAX_TICK = 887272;\\n\\n /// @inheritdoc IERC20Metadata\\n //solhint-disable-next-line const-name-snakecase\\n uint8 public constant override decimals = 18;\\n\\n /// @inheritdoc IERC20\\n mapping(address => mapping(address => uint256)) public override allowance;\\n\\n /// @inheritdoc IERC20\\n mapping(address => uint256) public override balanceOf;\\n\\n /// @notice Struct that contains token0, token1, and fee of the Uniswap pool\\n PoolKey private _poolKey;\\n\\n constructor(address _pool, address _governor) Governable(_governor) {\\n uint24 _fee = IUniswapV3Pool(_pool).fee();\\n address _token0 = IUniswapV3Pool(_pool).token0();\\n address _token1 = IUniswapV3Pool(_pool).token1();\\n int24 _tickSpacing = IUniswapV3Pool(_pool).tickSpacing();\\n int24 _tickUpper = _MAX_TICK - (_MAX_TICK % _tickSpacing);\\n int24 _tickLower = -_tickUpper;\\n\\n factory = msg.sender;\\n pool = _pool;\\n fee = _fee;\\n tickSpacing = _tickSpacing;\\n tickUpper = _tickUpper;\\n tickLower = _tickLower;\\n token0 = _token0;\\n token1 = _token1;\\n name = string(abi.encodePacked('Keep3rLP - ', ERC20(_token0).symbol(), '/', ERC20(_token1).symbol()));\\n symbol = string(abi.encodePacked('kLP-', ERC20(_token0).symbol(), '/', ERC20(_token1).symbol()));\\n\\n sqrtRatioAX96 = TickMath.getSqrtRatioAtTick(_tickLower);\\n sqrtRatioBX96 = TickMath.getSqrtRatioAtTick(_tickUpper);\\n _poolKey = PoolKey({token0: _token0, token1: _token1, fee: _fee});\\n }\\n\\n // This low-level function should be called from a contract which performs important safety checks\\n /// @inheritdoc IUniV3PairManager\\n function mint(\\n uint256 amount0Desired,\\n uint256 amount1Desired,\\n uint256 amount0Min,\\n uint256 amount1Min,\\n address to\\n ) external override returns (uint128 liquidity) {\\n (liquidity, , ) = _addLiquidity(amount0Desired, amount1Desired, amount0Min, amount1Min);\\n _mint(to, liquidity);\\n }\\n\\n /// @inheritdoc IUniV3PairManager\\n function uniswapV3MintCallback(\\n uint256 amount0Owed,\\n uint256 amount1Owed,\\n bytes calldata data\\n ) external override {\\n MintCallbackData memory decoded = abi.decode(data, (MintCallbackData));\\n if (msg.sender != pool) revert OnlyPool();\\n if (amount0Owed > 0) _pay(decoded._poolKey.token0, decoded.payer, pool, amount0Owed);\\n if (amount1Owed > 0) _pay(decoded._poolKey.token1, decoded.payer, pool, amount1Owed);\\n }\\n\\n /// @inheritdoc IUniV3PairManager\\n function burn(\\n uint128 liquidity,\\n uint256 amount0Min,\\n uint256 amount1Min,\\n address to\\n ) external override returns (uint256 amount0, uint256 amount1) {\\n (amount0, amount1) = IUniswapV3Pool(pool).burn(tickLower, tickUpper, liquidity);\\n\\n if (amount0 < amount0Min || amount1 < amount1Min) revert ExcessiveSlippage();\\n\\n IUniswapV3Pool(pool).collect(to, tickLower, tickUpper, uint128(amount0), uint128(amount1));\\n _burn(msg.sender, liquidity);\\n }\\n\\n /// @inheritdoc IUniV3PairManager\\n function collect() external override onlyGovernor returns (uint256 amount0, uint256 amount1) {\\n (, , , uint128 tokensOwed0, uint128 tokensOwed1) = IUniswapV3Pool(pool).positions(\\n keccak256(abi.encodePacked(address(this), tickLower, tickUpper))\\n );\\n (amount0, amount1) = IUniswapV3Pool(pool).collect(governor, tickLower, tickUpper, tokensOwed0, tokensOwed1);\\n }\\n\\n /// @inheritdoc IUniV3PairManager\\n function position()\\n external\\n view\\n override\\n returns (\\n uint128 liquidity,\\n uint256 feeGrowthInside0LastX128,\\n uint256 feeGrowthInside1LastX128,\\n uint128 tokensOwed0,\\n uint128 tokensOwed1\\n )\\n {\\n (liquidity, feeGrowthInside0LastX128, feeGrowthInside1LastX128, tokensOwed0, tokensOwed1) = IUniswapV3Pool(pool).positions(\\n keccak256(abi.encodePacked(address(this), tickLower, tickUpper))\\n );\\n }\\n\\n /// @inheritdoc IERC20\\n function approve(address spender, uint256 amount) external override returns (bool) {\\n allowance[msg.sender][spender] = amount;\\n\\n emit Approval(msg.sender, spender, amount);\\n return true;\\n }\\n\\n /// @inheritdoc IERC20\\n function transfer(address to, uint256 amount) external override returns (bool) {\\n _transferTokens(msg.sender, to, amount);\\n return true;\\n }\\n\\n /// @inheritdoc IERC20\\n function transferFrom(\\n address from,\\n address to,\\n uint256 amount\\n ) external override returns (bool) {\\n address spender = msg.sender;\\n uint256 spenderAllowance = allowance[from][spender];\\n\\n if (spender != from && spenderAllowance != type(uint256).max) {\\n uint256 newAllowance = spenderAllowance - amount;\\n allowance[from][spender] = newAllowance;\\n\\n emit Approval(from, spender, newAllowance);\\n }\\n\\n _transferTokens(from, to, amount);\\n return true;\\n }\\n\\n /// @notice Adds liquidity to an initialized pool\\n /// @dev Reverts if the returned amount0 is less than amount0Min or if amount1 is less than amount1Min\\n /// @dev This function calls the mint function of the corresponding Uniswap pool, which in turn calls UniswapV3Callback\\n /// @param amount0Desired The amount of token0 we would like to provide\\n /// @param amount1Desired The amount of token1 we would like to provide\\n /// @param amount0Min The minimum amount of token0 we want to provide\\n /// @param amount1Min The minimum amount of token1 we want to provide\\n /// @return liquidity The calculated liquidity we get for the token amounts we provided\\n /// @return amount0 The amount of token0 we ended up providing\\n /// @return amount1 The amount of token1 we ended up providing\\n function _addLiquidity(\\n uint256 amount0Desired,\\n uint256 amount1Desired,\\n uint256 amount0Min,\\n uint256 amount1Min\\n )\\n internal\\n returns (\\n uint128 liquidity,\\n uint256 amount0,\\n uint256 amount1\\n )\\n {\\n (uint160 sqrtPriceX96, , , , , , ) = IUniswapV3Pool(pool).slot0();\\n\\n liquidity = LiquidityAmounts.getLiquidityForAmounts(sqrtPriceX96, sqrtRatioAX96, sqrtRatioBX96, amount0Desired, amount1Desired);\\n\\n (amount0, amount1) = IUniswapV3Pool(pool).mint(\\n address(this),\\n tickLower,\\n tickUpper,\\n liquidity,\\n abi.encode(MintCallbackData({_poolKey: _poolKey, payer: msg.sender}))\\n );\\n\\n if (amount0 < amount0Min || amount1 < amount1Min) revert ExcessiveSlippage();\\n }\\n\\n /// @notice Transfers the passed-in token from the payer to the recipient for the corresponding value\\n /// @param token The token to be transferred to the recipient\\n /// @param from The address of the payer\\n /// @param to The address of the passed-in tokens recipient\\n /// @param value How much of that token to be transferred from payer to the recipient\\n function _pay(\\n address token,\\n address from,\\n address to,\\n uint256 value\\n ) internal {\\n _safeTransferFrom(token, from, to, value);\\n }\\n\\n /// @notice Mints Keep3r credits to the passed-in address of recipient and increases total supply of Keep3r credits by the corresponding amount\\n /// @param to The recipient of the Keep3r credits\\n /// @param amount The amount Keep3r credits to be minted to the recipient\\n function _mint(address to, uint256 amount) internal {\\n totalSupply += amount;\\n balanceOf[to] += amount;\\n emit Transfer(address(0), to, amount);\\n }\\n\\n /// @notice Burns Keep3r credits to the passed-in address of recipient and reduces total supply of Keep3r credits by the corresponding amount\\n /// @param to The address that will get its Keep3r credits burned\\n /// @param amount The amount Keep3r credits to be burned from the recipient/recipient\\n function _burn(address to, uint256 amount) internal {\\n totalSupply -= amount;\\n balanceOf[to] -= amount;\\n emit Transfer(to, address(0), amount);\\n }\\n\\n /// @notice Transfers amount of Keep3r credits between two addresses\\n /// @param from The user that transfers the Keep3r credits\\n /// @param to The user that receives the Keep3r credits\\n /// @param amount The amount of Keep3r credits to be transferred\\n function _transferTokens(\\n address from,\\n address to,\\n uint256 amount\\n ) internal {\\n balanceOf[from] -= amount;\\n balanceOf[to] += amount;\\n\\n emit Transfer(from, to, amount);\\n }\\n\\n /// @notice Transfers the passed-in token from the specified \\\"from\\\" to the specified \\\"to\\\" for the corresponding value\\n /// @dev Reverts with IUniV3PairManager#UnsuccessfulTransfer if the transfer was not successful,\\n /// or if the passed data length is different than 0 and the decoded data is not a boolean\\n /// @param token The token to be transferred to the specified \\\"to\\\"\\n /// @param from The address which is going to transfer the tokens\\n /// @param value How much of that token to be transferred from \\\"from\\\" to \\\"to\\\"\\n function _safeTransferFrom(\\n address token,\\n address from,\\n address to,\\n uint256 value\\n ) internal {\\n // solhint-disable-next-line avoid-low-level-calls\\n (bool success, bytes memory data) = token.call(abi.encodeWithSelector(IERC20.transferFrom.selector, from, to, value));\\n if (!success || (data.length != 0 && !abi.decode(data, (bool)))) revert UnsuccessfulTransfer();\\n }\\n}\\n\",\"keccak256\":\"0xefe854535e94158ebe950e1017d9c45c3b81e8eefc00091398a3eb0e5eec4dde\",\"license\":\"MIT\"},\"solidity/contracts/libraries/FixedPoint96.sol\":{\"content\":\"// SPDX-License-Identifier: GPL-2.0-or-later\\npragma solidity >=0.8.4 <0.9.0;\\n\\nlibrary FixedPoint96 {\\n // solhint-disable\\n uint8 internal constant RESOLUTION = 96;\\n uint256 internal constant Q96 = 0x1000000000000000000000000;\\n}\\n\",\"keccak256\":\"0x32a5c51474a7a83b902ffd6f54f8407e2b98d1142c9b06914fb75d50dd9c573c\",\"license\":\"GPL-2.0-or-later\"},\"solidity/contracts/libraries/FullMath.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4 <0.9.0;\\n\\n/// @title Contains 512-bit math functions\\n/// @notice Facilitates multiplication and division that can have overflow of an intermediate value without any loss of precision\\n/// @dev Handles \\\"phantom overflow\\\" i.e., allows multiplication and division where an intermediate value overflows 256 bits\\nlibrary FullMath {\\n /// @notice Calculates floor(a\\u00d7b\\u00f7denominator) with full precision. Throws if result overflows a uint256 or denominator == 0\\n /// @param a The multiplicand\\n /// @param b The multiplier\\n /// @param denominator The divisor\\n /// @return result The 256-bit result\\n /// @dev Credit to Remco Bloemen under MIT license https://xn--2-umb.com/21/muldiv\\n function mulDiv(\\n uint256 a,\\n uint256 b,\\n uint256 denominator\\n ) internal pure returns (uint256 result) {\\n unchecked {\\n // 512-bit multiply [prod1 prod0] = a * b\\n // Compute the product mod 2**256 and mod 2**256 - 1\\n // then use the Chinese Remainder Theorem to reconstruct\\n // the 512 bit result. The result is stored in two 256\\n // variables such that product = prod1 * 2**256 + prod0\\n uint256 prod0; // Least significant 256 bits of the product\\n uint256 prod1; // Most significant 256 bits of the product\\n assembly {\\n let mm := mulmod(a, b, not(0))\\n prod0 := mul(a, b)\\n prod1 := sub(sub(mm, prod0), lt(mm, prod0))\\n }\\n\\n // Handle non-overflow cases, 256 by 256 division\\n if (prod1 == 0) {\\n require(denominator > 0);\\n assembly {\\n result := div(prod0, denominator)\\n }\\n return result;\\n }\\n\\n // Make sure the result is less than 2**256.\\n // Also prevents denominator == 0\\n require(denominator > prod1);\\n\\n ///////////////////////////////////////////////\\n // 512 by 256 division.\\n ///////////////////////////////////////////////\\n\\n // Make division exact by subtracting the remainder from [prod1 prod0]\\n // Compute remainder using mulmod\\n uint256 remainder;\\n assembly {\\n remainder := mulmod(a, b, denominator)\\n }\\n // Subtract 256 bit number from 512 bit number\\n assembly {\\n prod1 := sub(prod1, gt(remainder, prod0))\\n prod0 := sub(prod0, remainder)\\n }\\n\\n // Factor powers of two out of denominator\\n // Compute largest power of two divisor of denominator.\\n // Always >= 1.\\n uint256 twos = (~denominator + 1) & denominator;\\n // Divide denominator by power of two\\n assembly {\\n denominator := div(denominator, twos)\\n }\\n\\n // Divide [prod1 prod0] by the factors of two\\n assembly {\\n prod0 := div(prod0, twos)\\n }\\n // Shift in bits from prod1 into prod0. For this we need\\n // to flip `twos` such that it is 2**256 / twos.\\n // If twos is zero, then it becomes one\\n assembly {\\n twos := add(div(sub(0, twos), twos), 1)\\n }\\n prod0 |= prod1 * twos;\\n\\n // Invert denominator mod 2**256\\n // Now that denominator is an odd number, it has an inverse\\n // modulo 2**256 such that denominator * inv = 1 mod 2**256.\\n // Compute the inverse by starting with a seed that is correct\\n // correct for four bits. That is, denominator * inv = 1 mod 2**4\\n uint256 inv = (3 * denominator) ^ 2;\\n // Now use Newton-Raphson iteration to improve the precision.\\n // Thanks to Hensel's lifting lemma, this also works in modular\\n // arithmetic, doubling the correct bits in each step.\\n inv *= 2 - denominator * inv; // inverse mod 2**8\\n inv *= 2 - denominator * inv; // inverse mod 2**16\\n inv *= 2 - denominator * inv; // inverse mod 2**32\\n inv *= 2 - denominator * inv; // inverse mod 2**64\\n inv *= 2 - denominator * inv; // inverse mod 2**128\\n inv *= 2 - denominator * inv; // inverse mod 2**256\\n\\n // Because the division is now exact we can divide by multiplying\\n // with the modular inverse of denominator. This will give us the\\n // correct result modulo 2**256. Since the precoditions guarantee\\n // that the outcome is less than 2**256, this is the final result.\\n // We don't need to compute the high bits of the result and prod1\\n // is no longer required.\\n result = prod0 * inv;\\n return result;\\n }\\n }\\n\\n /// @notice Calculates ceil(a\\u00d7b\\u00f7denominator) with full precision. Throws if result overflows a uint256 or denominator == 0\\n /// @param a The multiplicand\\n /// @param b The multiplier\\n /// @param denominator The divisor\\n /// @return result The 256-bit result\\n function mulDivRoundingUp(\\n uint256 a,\\n uint256 b,\\n uint256 denominator\\n ) internal pure returns (uint256 result) {\\n unchecked {\\n result = mulDiv(a, b, denominator);\\n if (mulmod(a, b, denominator) > 0) {\\n require(result < type(uint256).max);\\n result++;\\n }\\n }\\n }\\n}\\n\",\"keccak256\":\"0xe1c595da02adf8ba2ae74ac579b9b3c966d1ecb2a99c25081a62ee8550f26569\",\"license\":\"MIT\"},\"solidity/contracts/libraries/LiquidityAmounts.sol\":{\"content\":\"// SPDX-License-Identifier: GPL-2.0-or-later\\npragma solidity >=0.8.4 <0.9.0;\\n\\nimport './FullMath.sol';\\nimport './FixedPoint96.sol';\\n\\n// solhint-disable\\nlibrary LiquidityAmounts {\\n function toUint128(uint256 x) private pure returns (uint128 y) {\\n require((y = uint128(x)) == x);\\n }\\n\\n function getLiquidityForAmount0(\\n uint160 sqrtRatioAX96,\\n uint160 sqrtRatioBX96,\\n uint256 amount0\\n ) internal pure returns (uint128 liquidity) {\\n if (sqrtRatioAX96 > sqrtRatioBX96) (sqrtRatioAX96, sqrtRatioBX96) = (sqrtRatioBX96, sqrtRatioAX96);\\n uint256 intermediate = FullMath.mulDiv(sqrtRatioAX96, sqrtRatioBX96, FixedPoint96.Q96);\\n return toUint128(FullMath.mulDiv(amount0, intermediate, sqrtRatioBX96 - sqrtRatioAX96));\\n }\\n\\n function getLiquidityForAmount1(\\n uint160 sqrtRatioAX96,\\n uint160 sqrtRatioBX96,\\n uint256 amount1\\n ) internal pure returns (uint128 liquidity) {\\n if (sqrtRatioAX96 > sqrtRatioBX96) (sqrtRatioAX96, sqrtRatioBX96) = (sqrtRatioBX96, sqrtRatioAX96);\\n return toUint128(FullMath.mulDiv(amount1, FixedPoint96.Q96, sqrtRatioBX96 - sqrtRatioAX96));\\n }\\n\\n function getLiquidityForAmounts(\\n uint160 sqrtRatioX96,\\n uint160 sqrtRatioAX96,\\n uint160 sqrtRatioBX96,\\n uint256 amount0,\\n uint256 amount1\\n ) internal pure returns (uint128 liquidity) {\\n if (sqrtRatioAX96 > sqrtRatioBX96) (sqrtRatioAX96, sqrtRatioBX96) = (sqrtRatioBX96, sqrtRatioAX96);\\n\\n if (sqrtRatioX96 <= sqrtRatioAX96) {\\n liquidity = getLiquidityForAmount0(sqrtRatioAX96, sqrtRatioBX96, amount0);\\n } else if (sqrtRatioX96 < sqrtRatioBX96) {\\n uint128 liquidity0 = getLiquidityForAmount0(sqrtRatioX96, sqrtRatioBX96, amount0);\\n uint128 liquidity1 = getLiquidityForAmount1(sqrtRatioAX96, sqrtRatioX96, amount1);\\n\\n liquidity = liquidity0 < liquidity1 ? liquidity0 : liquidity1;\\n } else {\\n liquidity = getLiquidityForAmount1(sqrtRatioAX96, sqrtRatioBX96, amount1);\\n }\\n }\\n\\n function getAmount0ForLiquidity(\\n uint160 sqrtRatioAX96,\\n uint160 sqrtRatioBX96,\\n uint128 liquidity\\n ) internal pure returns (uint256 amount0) {\\n if (sqrtRatioAX96 > sqrtRatioBX96) (sqrtRatioAX96, sqrtRatioBX96) = (sqrtRatioBX96, sqrtRatioAX96);\\n\\n return FullMath.mulDiv(uint256(liquidity) << FixedPoint96.RESOLUTION, sqrtRatioBX96 - sqrtRatioAX96, sqrtRatioBX96) / sqrtRatioAX96;\\n }\\n\\n function getAmount1ForLiquidity(\\n uint160 sqrtRatioAX96,\\n uint160 sqrtRatioBX96,\\n uint128 liquidity\\n ) internal pure returns (uint256 amount1) {\\n if (sqrtRatioAX96 > sqrtRatioBX96) (sqrtRatioAX96, sqrtRatioBX96) = (sqrtRatioBX96, sqrtRatioAX96);\\n\\n return FullMath.mulDiv(liquidity, sqrtRatioBX96 - sqrtRatioAX96, FixedPoint96.Q96);\\n }\\n\\n function getAmountsForLiquidity(\\n uint160 sqrtRatioX96,\\n uint160 sqrtRatioAX96,\\n uint160 sqrtRatioBX96,\\n uint128 liquidity\\n ) internal pure returns (uint256 amount0, uint256 amount1) {\\n if (sqrtRatioAX96 > sqrtRatioBX96) (sqrtRatioAX96, sqrtRatioBX96) = (sqrtRatioBX96, sqrtRatioAX96);\\n\\n if (sqrtRatioX96 <= sqrtRatioAX96) {\\n amount0 = getAmount0ForLiquidity(sqrtRatioAX96, sqrtRatioBX96, liquidity);\\n } else if (sqrtRatioX96 < sqrtRatioBX96) {\\n amount0 = getAmount0ForLiquidity(sqrtRatioX96, sqrtRatioBX96, liquidity);\\n amount1 = getAmount1ForLiquidity(sqrtRatioAX96, sqrtRatioX96, liquidity);\\n } else {\\n amount1 = getAmount1ForLiquidity(sqrtRatioAX96, sqrtRatioBX96, liquidity);\\n }\\n }\\n}\\n\",\"keccak256\":\"0x33666cfb046e29d6a9539e552b7aace75daab08f0449fec13de7282bac84f786\",\"license\":\"GPL-2.0-or-later\"},\"solidity/contracts/libraries/TickMath.sol\":{\"content\":\"// SPDX-License-Identifier: GPL-2.0-or-later\\npragma solidity >=0.5.0;\\n\\n// solhint-disable\\n\\n/// @title Math library for computing sqrt prices from ticks and vice versa\\n/// @notice Computes sqrt price for ticks of size 1.0001, i.e. sqrt(1.0001^tick) as fixed point Q64.96 numbers. Supports\\n/// prices between 2**-128 and 2**128\\nlibrary TickMath {\\n /// @dev The minimum tick that may be passed to #getSqrtRatioAtTick computed from log base 1.0001 of 2**-128\\n int24 internal constant MIN_TICK = -887272;\\n /// @dev The maximum tick that may be passed to #getSqrtRatioAtTick computed from log base 1.0001 of 2**128\\n int24 internal constant MAX_TICK = -MIN_TICK;\\n\\n /// @dev The minimum value that can be returned from #getSqrtRatioAtTick. Equivalent to getSqrtRatioAtTick(MIN_TICK)\\n uint160 internal constant MIN_SQRT_RATIO = 4295128739;\\n /// @dev The maximum value that can be returned from #getSqrtRatioAtTick. Equivalent to getSqrtRatioAtTick(MAX_TICK)\\n uint160 internal constant MAX_SQRT_RATIO = 1461446703485210103287273052203988822378723970342;\\n\\n /// @notice Calculates sqrt(1.0001^tick) * 2^96\\n /// @dev Throws if |tick| > max tick\\n /// @param tick The input tick for the above formula\\n /// @return sqrtPriceX96 A Fixed point Q64.96 number representing the sqrt of the ratio of the two assets (token1/token0)\\n /// at the given tick\\n function getSqrtRatioAtTick(int24 tick) internal pure returns (uint160 sqrtPriceX96) {\\n uint256 absTick = tick < 0 ? uint256(-int256(tick)) : uint256(int256(tick));\\n require(absTick <= uint256(int256(MAX_TICK)), 'T');\\n\\n uint256 ratio = absTick & 0x1 != 0 ? 0xfffcb933bd6fad37aa2d162d1a594001 : 0x100000000000000000000000000000000;\\n if (absTick & 0x2 != 0) ratio = (ratio * 0xfff97272373d413259a46990580e213a) >> 128;\\n if (absTick & 0x4 != 0) ratio = (ratio * 0xfff2e50f5f656932ef12357cf3c7fdcc) >> 128;\\n if (absTick & 0x8 != 0) ratio = (ratio * 0xffe5caca7e10e4e61c3624eaa0941cd0) >> 128;\\n if (absTick & 0x10 != 0) ratio = (ratio * 0xffcb9843d60f6159c9db58835c926644) >> 128;\\n if (absTick & 0x20 != 0) ratio = (ratio * 0xff973b41fa98c081472e6896dfb254c0) >> 128;\\n if (absTick & 0x40 != 0) ratio = (ratio * 0xff2ea16466c96a3843ec78b326b52861) >> 128;\\n if (absTick & 0x80 != 0) ratio = (ratio * 0xfe5dee046a99a2a811c461f1969c3053) >> 128;\\n if (absTick & 0x100 != 0) ratio = (ratio * 0xfcbe86c7900a88aedcffc83b479aa3a4) >> 128;\\n if (absTick & 0x200 != 0) ratio = (ratio * 0xf987a7253ac413176f2b074cf7815e54) >> 128;\\n if (absTick & 0x400 != 0) ratio = (ratio * 0xf3392b0822b70005940c7a398e4b70f3) >> 128;\\n if (absTick & 0x800 != 0) ratio = (ratio * 0xe7159475a2c29b7443b29c7fa6e889d9) >> 128;\\n if (absTick & 0x1000 != 0) ratio = (ratio * 0xd097f3bdfd2022b8845ad8f792aa5825) >> 128;\\n if (absTick & 0x2000 != 0) ratio = (ratio * 0xa9f746462d870fdf8a65dc1f90e061e5) >> 128;\\n if (absTick & 0x4000 != 0) ratio = (ratio * 0x70d869a156d2a1b890bb3df62baf32f7) >> 128;\\n if (absTick & 0x8000 != 0) ratio = (ratio * 0x31be135f97d08fd981231505542fcfa6) >> 128;\\n if (absTick & 0x10000 != 0) ratio = (ratio * 0x9aa508b5b7a84e1c677de54f3e99bc9) >> 128;\\n if (absTick & 0x20000 != 0) ratio = (ratio * 0x5d6af8dedb81196699c329225ee604) >> 128;\\n if (absTick & 0x40000 != 0) ratio = (ratio * 0x2216e584f5fa1ea926041bedfe98) >> 128;\\n if (absTick & 0x80000 != 0) ratio = (ratio * 0x48a170391f7dc42444e8fa2) >> 128;\\n\\n if (tick > 0) ratio = type(uint256).max / ratio;\\n\\n // Divides by 1<<32 rounding up to go from a Q128.128 to a Q128.96.\\n // we then downcast because we know the result always fits within 160 bits due to our tick input constraint\\n // we round up in the division so getTickAtSqrtRatio of the output price is always consistent\\n sqrtPriceX96 = uint160((ratio >> 32) + (ratio % (1 << 32) == 0 ? 0 : 1));\\n }\\n\\n /// @notice Calculates the greatest tick value such that getRatioAtTick(tick) <= ratio\\n /// @dev Throws in case sqrtPriceX96 < MIN_SQRT_RATIO, as MIN_SQRT_RATIO is the lowest value getRatioAtTick may ever return.\\n /// @param sqrtPriceX96 The sqrt ratio for which to compute the tick as a Q64.96\\n /// @return tick The greatest tick for which the ratio is less than or equal to the input ratio\\n function getTickAtSqrtRatio(uint160 sqrtPriceX96) internal pure returns (int24 tick) {\\n // Second inequality must be < because the price can never reach the price at the max tick\\n require(sqrtPriceX96 >= MIN_SQRT_RATIO && sqrtPriceX96 < MAX_SQRT_RATIO, 'R');\\n uint256 ratio = uint256(sqrtPriceX96) << 32;\\n\\n uint256 r = ratio;\\n uint256 msb = 0;\\n\\n assembly {\\n let f := shl(7, gt(r, 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF))\\n msb := or(msb, f)\\n r := shr(f, r)\\n }\\n assembly {\\n let f := shl(6, gt(r, 0xFFFFFFFFFFFFFFFF))\\n msb := or(msb, f)\\n r := shr(f, r)\\n }\\n assembly {\\n let f := shl(5, gt(r, 0xFFFFFFFF))\\n msb := or(msb, f)\\n r := shr(f, r)\\n }\\n assembly {\\n let f := shl(4, gt(r, 0xFFFF))\\n msb := or(msb, f)\\n r := shr(f, r)\\n }\\n assembly {\\n let f := shl(3, gt(r, 0xFF))\\n msb := or(msb, f)\\n r := shr(f, r)\\n }\\n assembly {\\n let f := shl(2, gt(r, 0xF))\\n msb := or(msb, f)\\n r := shr(f, r)\\n }\\n assembly {\\n let f := shl(1, gt(r, 0x3))\\n msb := or(msb, f)\\n r := shr(f, r)\\n }\\n assembly {\\n let f := gt(r, 0x1)\\n msb := or(msb, f)\\n }\\n\\n if (msb >= 128) r = ratio >> (msb - 127);\\n else r = ratio << (127 - msb);\\n\\n int256 log_2 = (int256(msb) - 128) << 64;\\n\\n assembly {\\n r := shr(127, mul(r, r))\\n let f := shr(128, r)\\n log_2 := or(log_2, shl(63, f))\\n r := shr(f, r)\\n }\\n assembly {\\n r := shr(127, mul(r, r))\\n let f := shr(128, r)\\n log_2 := or(log_2, shl(62, f))\\n r := shr(f, r)\\n }\\n assembly {\\n r := shr(127, mul(r, r))\\n let f := shr(128, r)\\n log_2 := or(log_2, shl(61, f))\\n r := shr(f, r)\\n }\\n assembly {\\n r := shr(127, mul(r, r))\\n let f := shr(128, r)\\n log_2 := or(log_2, shl(60, f))\\n r := shr(f, r)\\n }\\n assembly {\\n r := shr(127, mul(r, r))\\n let f := shr(128, r)\\n log_2 := or(log_2, shl(59, f))\\n r := shr(f, r)\\n }\\n assembly {\\n r := shr(127, mul(r, r))\\n let f := shr(128, r)\\n log_2 := or(log_2, shl(58, f))\\n r := shr(f, r)\\n }\\n assembly {\\n r := shr(127, mul(r, r))\\n let f := shr(128, r)\\n log_2 := or(log_2, shl(57, f))\\n r := shr(f, r)\\n }\\n assembly {\\n r := shr(127, mul(r, r))\\n let f := shr(128, r)\\n log_2 := or(log_2, shl(56, f))\\n r := shr(f, r)\\n }\\n assembly {\\n r := shr(127, mul(r, r))\\n let f := shr(128, r)\\n log_2 := or(log_2, shl(55, f))\\n r := shr(f, r)\\n }\\n assembly {\\n r := shr(127, mul(r, r))\\n let f := shr(128, r)\\n log_2 := or(log_2, shl(54, f))\\n r := shr(f, r)\\n }\\n assembly {\\n r := shr(127, mul(r, r))\\n let f := shr(128, r)\\n log_2 := or(log_2, shl(53, f))\\n r := shr(f, r)\\n }\\n assembly {\\n r := shr(127, mul(r, r))\\n let f := shr(128, r)\\n log_2 := or(log_2, shl(52, f))\\n r := shr(f, r)\\n }\\n assembly {\\n r := shr(127, mul(r, r))\\n let f := shr(128, r)\\n log_2 := or(log_2, shl(51, f))\\n r := shr(f, r)\\n }\\n assembly {\\n r := shr(127, mul(r, r))\\n let f := shr(128, r)\\n log_2 := or(log_2, shl(50, f))\\n }\\n\\n int256 log_sqrt10001 = log_2 * 255738958999603826347141; // 128.128 number\\n\\n int24 tickLow = int24((log_sqrt10001 - 3402992956809132418596140100660247210) >> 128);\\n int24 tickHi = int24((log_sqrt10001 + 291339464771989622907027621153398088495) >> 128);\\n\\n tick = tickLow == tickHi ? tickLow : getSqrtRatioAtTick(tickHi) <= sqrtPriceX96 ? tickHi : tickLow;\\n }\\n}\\n\",\"keccak256\":\"0x11b965ba576ff91b4a6e9533c0f334f2b7b6024ee1c54e36d21799de5580899d\",\"license\":\"GPL-2.0-or-later\"},\"solidity/interfaces/IPairManager.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4 <0.9.0;\\n\\nimport '@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol';\\n\\n/// @title Pair Manager interface\\n/// @notice Generic interface for Keep3r liquidity pools (kLP)\\ninterface IPairManager is IERC20Metadata {\\n /// @notice Address of the factory from which the pair manager was created\\n /// @return _factory The address of the PairManager Factory\\n function factory() external view returns (address _factory);\\n\\n /// @notice Address of the pool from which the Keep3r pair manager will interact with\\n /// @return _pool The address of the pool\\n function pool() external view returns (address _pool);\\n\\n /// @notice Token0 of the pool\\n /// @return _token0 The address of token0\\n function token0() external view returns (address _token0);\\n\\n /// @notice Token1 of the pool\\n /// @return _token1 The address of token1\\n function token1() external view returns (address _token1);\\n}\\n\",\"keccak256\":\"0x345c312b340c5775fb8f68d89ce851c7f75522940bd9bc64f2301a3f8312636a\",\"license\":\"MIT\"},\"solidity/interfaces/IUniV3PairManager.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4 <0.9.0;\\n\\nimport './IPairManager.sol';\\nimport '@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol';\\nimport '@defi-wonderland/solidity-utils/solidity/interfaces/IGovernable.sol';\\n\\n/// @title Pair Manager contract\\n/// @notice Creates a UniswapV3 position, and tokenizes in an ERC20 manner\\n/// so that the user can use it as liquidity for a Keep3rJob\\ninterface IUniV3PairManager is IGovernable, IPairManager {\\n // Structs\\n struct PoolKey {\\n address token0;\\n address token1;\\n uint24 fee;\\n }\\n\\n /// @notice The data to be decoded by the UniswapV3MintCallback function\\n struct MintCallbackData {\\n PoolKey _poolKey; // Struct that contains token0, token1, and fee of the pool passed into the constructor\\n address payer; // The address of the payer, which will be the msg.sender of the mint function\\n }\\n\\n // Variables\\n\\n /// @notice The fee of the Uniswap pool passed into the constructor\\n /// @return _fee The fee of the Uniswap pool passed into the constructor\\n function fee() external view returns (uint24 _fee);\\n\\n /// @notice Highest tick in the Uniswap's curve\\n /// @return _tickUpper The highest tick in the Uniswap's curve\\n function tickUpper() external view returns (int24 _tickUpper);\\n\\n /// @notice Lowest tick in the Uniswap's curve\\n /// @return _tickLower The lower tick in the Uniswap's curve\\n function tickLower() external view returns (int24 _tickLower);\\n\\n /// @notice The pair tick spacing\\n /// @return _tickSpacing The pair tick spacing\\n function tickSpacing() external view returns (int24 _tickSpacing);\\n\\n /// @notice The sqrtRatioAX96 at the lowest tick (-887200) of the Uniswap pool\\n /// @return _sqrtPriceA96 A Fixed point Q64.96 number representing the sqrt of the ratio of the two assets (token1/token0)\\n /// at the lowest tick\\n function sqrtRatioAX96() external view returns (uint160 _sqrtPriceA96);\\n\\n /// @notice The sqrtRatioBX96 at the highest tick (887200) of the Uniswap pool\\n /// @return _sqrtPriceBX96 A Fixed point Q64.96 number representing the sqrt of the ratio of the two assets (token1/token0)\\n /// at the highest tick\\n function sqrtRatioBX96() external view returns (uint160 _sqrtPriceBX96);\\n\\n // Errors\\n\\n /// @notice Throws when the caller of the function is not the pool\\n error OnlyPool();\\n\\n /// @notice Throws when the slippage exceeds what the user is comfortable with\\n error ExcessiveSlippage();\\n\\n /// @notice Throws when a transfer is unsuccessful\\n error UnsuccessfulTransfer();\\n\\n // Methods\\n\\n /// @notice This function is called after a user calls IUniV3PairManager#mint function\\n /// It ensures that any tokens owed to the pool are paid by the msg.sender of IUniV3PairManager#mint function\\n /// @param amount0Owed The amount of token0 due to the pool for the minted liquidity\\n /// @param amount1Owed The amount of token1 due to the pool for the minted liquidity\\n /// @param data The encoded token0, token1, fee (_poolKey) and the payer (msg.sender) of the IUniV3PairManager#mint function\\n function uniswapV3MintCallback(\\n uint256 amount0Owed,\\n uint256 amount1Owed,\\n bytes calldata data\\n ) external;\\n\\n /// @notice Mints kLP tokens to an address according to the liquidity the msg.sender provides to the UniswapV3 pool\\n /// @dev Triggers UniV3PairManager#uniswapV3MintCallback\\n /// @param amount0Desired The amount of token0 we would like to provide\\n /// @param amount1Desired The amount of token1 we would like to provide\\n /// @param amount0Min The minimum amount of token0 we want to provide\\n /// @param amount1Min The minimum amount of token1 we want to provide\\n /// @param to The address to which the kLP tokens are going to be minted to\\n /// @return liquidity kLP tokens sent in exchange for the provision of tokens\\n function mint(\\n uint256 amount0Desired,\\n uint256 amount1Desired,\\n uint256 amount0Min,\\n uint256 amount1Min,\\n address to\\n ) external returns (uint128 liquidity);\\n\\n /// @notice Returns the pair manager's position in the corresponding UniswapV3 pool\\n /// @return liquidity The amount of liquidity provided to the UniswapV3 pool by the pair manager\\n /// @return feeGrowthInside0LastX128 The fee growth of token0 as of the last action on the individual position\\n /// @return feeGrowthInside1LastX128 The fee growth of token1 as of the last action on the individual position\\n /// @return tokensOwed0 The uncollected amount of token0 owed to the position as of the last computation\\n /// @return tokensOwed1 The uncollected amount of token1 owed to the position as of the last computation\\n function position()\\n external\\n view\\n returns (\\n uint128 liquidity,\\n uint256 feeGrowthInside0LastX128,\\n uint256 feeGrowthInside1LastX128,\\n uint128 tokensOwed0,\\n uint128 tokensOwed1\\n );\\n\\n /// @notice Calls the UniswapV3 pool's collect function, which collects up to a maximum amount of fees\\n // owed to a specific position to the recipient, in this case, that recipient is the pair manager\\n /// @dev The collected fees will be sent to governor\\n /// @return amount0 The amount of fees collected in token0\\n /// @return amount1 The amount of fees collected in token1\\n function collect() external returns (uint256 amount0, uint256 amount1);\\n\\n /// @notice Burns the corresponding amount of kLP tokens from the msg.sender and withdraws the specified liquidity\\n // in the entire range\\n /// @param liquidity The amount of liquidity to be burned\\n /// @param amount0Min The minimum amount of token0 we want to send to the recipient (to)\\n /// @param amount1Min The minimum amount of token1 we want to send to the recipient (to)\\n /// @param to The address that will receive the due fees\\n /// @return amount0 The calculated amount of token0 that will be sent to the recipient\\n /// @return amount1 The calculated amount of token1 that will be sent to the recipient\\n function burn(\\n uint128 liquidity,\\n uint256 amount0Min,\\n uint256 amount1Min,\\n address to\\n ) external returns (uint256 amount0, uint256 amount1);\\n}\\n\",\"keccak256\":\"0xcb9c86a0bed59a73c8427710d1b27922c2f9fb5173057b8d3a9fe77cd2c8ff94\",\"license\":\"MIT\"},\"solidity/interfaces/external/IWeth9.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4 <0.9.0;\\n\\nimport '@openzeppelin/contracts/token/ERC20/IERC20.sol';\\n\\ninterface IWeth9 is IERC20 {\\n function deposit() external payable;\\n\\n function withdraw(uint256) external;\\n}\\n\",\"keccak256\":\"0x62b6fd021e9fef703f5c77705d8da9ee1967e34e00a0c8a827ee3c0f973399a5\",\"license\":\"MIT\"}},\"version\":1}", + "bytecode": "0x6101c06040523480156200001257600080fd5b506040516200326138038062003261833981016040819052620000359162000b2f565b806001600160a01b0381166200005e5760405163d92e233d60e01b815260040160405180910390fd5b600080546001600160a01b0319166001600160a01b039283161781556040805163ddca3f4360e01b81529051919285169163ddca3f4391600480820192602092909190829003018186803b158015620000b657600080fd5b505afa158015620000cb573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190620000f1919062000b67565b90506000836001600160a01b0316630dfe16816040518163ffffffff1660e01b815260040160206040518083038186803b1580156200012f57600080fd5b505afa15801562000144573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906200016a919062000b95565b90506000846001600160a01b031663d21220a76040518163ffffffff1660e01b815260040160206040518083038186803b158015620001a857600080fd5b505afa158015620001bd573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190620001e3919062000b95565b90506000856001600160a01b031663d0c93a7c6040518163ffffffff1660e01b815260040160206040518083038186803b1580156200022157600080fd5b505afa15801562000236573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906200025c919062000bb3565b905060006200026f82620d89e862000bee565b6200027e90620d89e862000c29565b905060006200028d8262000c77565b33606090811b60805289811b6001600160601b031990811660e05260e889811b6001600160e81b0319166101005286811b6101a05285811b6101805283901b6101605287821b811660a0529086901b1660c052604080516395d89b4160e01b815290519192506001600160a01b038716916395d89b4191600480820192600092909190829003018186803b1580156200032557600080fd5b505afa1580156200033a573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f1916820160405262000364919081019062000ce6565b846001600160a01b03166395d89b416040518163ffffffff1660e01b815260040160006040518083038186803b1580156200039e57600080fd5b505afa158015620003b3573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052620003dd919081019062000ce6565b604051602001620003f092919062000d9e565b604051602081830303815290604052600290805190602001906200041692919062000a6c565b50846001600160a01b03166395d89b416040518163ffffffff1660e01b815260040160006040518083038186803b1580156200045157600080fd5b505afa15801562000466573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f1916820160405262000490919081019062000ce6565b846001600160a01b03166395d89b416040518163ffffffff1660e01b815260040160006040518083038186803b158015620004ca57600080fd5b505afa158015620004df573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f1916820160405262000509919081019062000ce6565b6040516020016200051c92919062000df5565b604051602081830303815290604052600390805190602001906200054292919062000a6c565b5062000559816200060a60201b62000e911760201c565b6001600160a01b0316610120816001600160a01b031660601b815250506200058c826200060a60201b62000e911760201c565b606090811b6001600160601b031916610140526040805191820181526001600160a01b03968716808352959096166020820181905262ffffff9790971695018590525050600780546001600160a01b03191690921790915550600880546001600160b81b031916909217600160a01b9091021790555062000f0d9050565b60008060008360020b1262000623578260020b62000632565b8260020b620006329062000e45565b905062000643620d89e71962000c77565b60020b8111156200067e5760405162461bcd60e51b81526020600482015260016024820152601560fa1b604482015260640160405180910390fd5b6000600182166200069457600160801b620006a6565b6ffffcb933bd6fad37aa2d162d1a5940015b6001600160881b031690506002821615620006de576080620006d9826ffff97272373d413259a46990580e213a62000e65565b901c90505b60048216156200070b57608062000706826ffff2e50f5f656932ef12357cf3c7fdcc62000e65565b901c90505b60088216156200073857608062000733826fffe5caca7e10e4e61c3624eaa0941cd062000e65565b901c90505b60108216156200076557608062000760826fffcb9843d60f6159c9db58835c92664462000e65565b901c90505b6020821615620007925760806200078d826fff973b41fa98c081472e6896dfb254c062000e65565b901c90505b6040821615620007bf576080620007ba826fff2ea16466c96a3843ec78b326b5286162000e65565b901c90505b6080821615620007ec576080620007e7826ffe5dee046a99a2a811c461f1969c305362000e65565b901c90505b6101008216156200081a57608062000815826ffcbe86c7900a88aedcffc83b479aa3a462000e65565b901c90505b6102008216156200084857608062000843826ff987a7253ac413176f2b074cf7815e5462000e65565b901c90505b6104008216156200087657608062000871826ff3392b0822b70005940c7a398e4b70f362000e65565b901c90505b610800821615620008a45760806200089f826fe7159475a2c29b7443b29c7fa6e889d962000e65565b901c90505b611000821615620008d2576080620008cd826fd097f3bdfd2022b8845ad8f792aa582562000e65565b901c90505b61200082161562000900576080620008fb826fa9f746462d870fdf8a65dc1f90e061e562000e65565b901c90505b6140008216156200092e57608062000929826f70d869a156d2a1b890bb3df62baf32f762000e65565b901c90505b6180008216156200095c57608062000957826f31be135f97d08fd981231505542fcfa662000e65565b901c90505b620100008216156200098b57608062000986826f09aa508b5b7a84e1c677de54f3e99bc962000e65565b901c90505b62020000821615620009b9576080620009b4826e5d6af8dedb81196699c329225ee60462000e65565b901c90505b62040000821615620009e6576080620009e1826d2216e584f5fa1ea926041bedfe9862000e65565b901c90505b6208000082161562000a1157608062000a0c826b048a170391f7dc42444e8fa262000e65565b901c90505b60008460020b131562000a2f5762000a2c8160001962000e87565b90505b62000a406401000000008262000e9e565b1562000a4e57600162000a51565b60005b62000a649060ff16602083901c62000eb5565b949350505050565b82805462000a7a9062000ed0565b90600052602060002090601f01602090048101928262000a9e576000855562000ae9565b82601f1062000ab957805160ff191683800117855562000ae9565b8280016001018555821562000ae9579182015b8281111562000ae957825182559160200191906001019062000acc565b5062000af792915062000afb565b5090565b5b8082111562000af7576000815560010162000afc565b80516001600160a01b038116811462000b2a57600080fd5b919050565b6000806040838503121562000b4357600080fd5b62000b4e8362000b12565b915062000b5e6020840162000b12565b90509250929050565b60006020828403121562000b7a57600080fd5b815162ffffff8116811462000b8e57600080fd5b9392505050565b60006020828403121562000ba857600080fd5b62000b8e8262000b12565b60006020828403121562000bc657600080fd5b81518060020b811462000b8e57600080fd5b634e487b7160e01b600052601260045260246000fd5b60008260020b8062000c045762000c0462000bd8565b808360020b0791505092915050565b634e487b7160e01b600052601160045260246000fd5b60008160020b8360020b6000811281627fffff190183128115161562000c535762000c5362000c13565b81627fffff01831381161562000c6d5762000c6d62000c13565b5090039392505050565b60008160020b627fffff1981141562000c945762000c9462000c13565b60000392915050565b634e487b7160e01b600052604160045260246000fd5b60005b8381101562000cd057818101518382015260200162000cb6565b8381111562000ce0576000848401525b50505050565b60006020828403121562000cf957600080fd5b81516001600160401b038082111562000d1157600080fd5b818401915084601f83011262000d2657600080fd5b81518181111562000d3b5762000d3b62000c9d565b604051601f8201601f19908116603f0116810190838211818310171562000d665762000d6662000c9d565b8160405282815287602084870101111562000d8057600080fd5b62000d9383602083016020880162000cb3565b979650505050505050565b6a025b2b2b819b926281016960ad1b81526000835162000dc681600b85016020880162000cb3565b602f60f81b600b91840191820152835162000de981600c84016020880162000cb3565b01600c01949350505050565b636b4c502d60e01b81526000835162000e1681600485016020880162000cb3565b602f60f81b600491840191820152835162000e3981600584016020880162000cb3565b01600501949350505050565b6000600160ff1b82141562000e5e5762000e5e62000c13565b5060000390565b600081600019048311821515161562000e825762000e8262000c13565b500290565b60008262000e995762000e9962000bd8565b500490565b60008262000eb05762000eb062000bd8565b500690565b6000821982111562000ecb5762000ecb62000c13565b500190565b600181811c9082168062000ee557607f821691505b6020821081141562000f0757634e487b7160e01b600052602260045260246000fd5b50919050565b60805160601c60a05160601c60c05160601c60e05160601c6101005160e81c6101205160601c6101405160601c6101605160e81c6101805160e81c6101a05160e81c6122126200104f600039600061047801526000818161033b0152818161063e0152818161092f01528181610a8601528181610c6f01528181610dc7015261158e015260008181610375015281816106130152818161090401528181610a6401528181610c4401528181610da5015261156c01526000818161042901526114840152600081816102fa0152611463015260006105040152600081816102a9015281816106790152818161097301528181610a3501528181610b3c01528181610b8f01528181610bcd01528181610ca401528181610d72015281816113c6015261153b0152600061049f015260006102780152600061040201526122126000f3fe608060405234801561001057600080fd5b50600436106101c45760003560e01c806395d89b41116100f9578063d21220a711610097578063ddca3f4311610071578063ddca3f43146104ff578063e3056a341461053a578063e52253811461054d578063f235757f1461055557600080fd5b8063d21220a71461049a578063d3487997146104c1578063dd62ed3e146104d457600080fd5b8063c45a0155116100d3578063c45a0155146103fd578063c627526114610424578063cf51148d1461044b578063d0c93a7c1461047357600080fd5b806395d89b41146103b7578063a3e6dc28146103bf578063a9059cbb146103ea57600080fd5b806318160ddd11610166578063313ce56711610140578063313ce5671461031c57806355b812a81461033657806359c4f9051461037057806370a082311461039757600080fd5b806318160ddd146102cb57806323b872dd146102e25780632ea28f5b146102f557600080fd5b80630c340a24116101a25780630c340a24146102485780630dfe16811461027357806313f6986d1461029a57806316f0115b146102a457600080fd5b806306fdde03146101c957806309218e91146101e7578063095ea7b314610225575b600080fd5b6101d1610568565b6040516101de9190611b6a565b60405180910390f35b6101ef6105f6565b604080516001600160801b039687168152602081019590955284019290925283166060830152909116608082015260a0016101de565b610238610233366004611b92565b610738565b60405190151581526020016101de565b60005461025b906001600160a01b031681565b6040516001600160a01b0390911681526020016101de565b61025b7f000000000000000000000000000000000000000000000000000000000000000081565b6102a26107a4565b005b61025b7f000000000000000000000000000000000000000000000000000000000000000081565b6102d460045481565b6040519081526020016101de565b6102386102f0366004611bbe565b6107d9565b61025b7f000000000000000000000000000000000000000000000000000000000000000081565b610324601281565b60405160ff90911681526020016101de565b61035d7f000000000000000000000000000000000000000000000000000000000000000081565b60405160029190910b81526020016101de565b61035d7f000000000000000000000000000000000000000000000000000000000000000081565b6102d46103a5366004611bff565b60066020526000908152604090205481565b6101d16108a2565b6103d26103cd366004611c1c565b6108af565b6040516001600160801b0390911681526020016101de565b6102386103f8366004611b92565b6108df565b61025b7f000000000000000000000000000000000000000000000000000000000000000081565b61025b7f000000000000000000000000000000000000000000000000000000000000000081565b61045e610459366004611c7e565b6108f5565b604080519283526020830191909152016101de565b61035d7f000000000000000000000000000000000000000000000000000000000000000081565b61025b7f000000000000000000000000000000000000000000000000000000000000000081565b6102a26104cf366004611cc8565b610b21565b6102d46104e2366004611d48565b600560209081526000928352604080842090915290825290205481565b6105267f000000000000000000000000000000000000000000000000000000000000000081565b60405162ffffff90911681526020016101de565b60015461025b906001600160a01b031681565b61045e610bf9565b6102a2610563366004611bff565b610e5a565b6002805461057590611d81565b80601f01602080910402602001604051908101604052809291908181526020018280546105a190611d81565b80156105ee5780601f106105c3576101008083540402835291602001916105ee565b820191906000526020600020905b8154815290600101906020018083116105d157829003601f168201915b505050505081565b6040516bffffffffffffffffffffffff193060601b1660208201527f000000000000000000000000000000000000000000000000000000000000000060e890811b60348301527f0000000000000000000000000000000000000000000000000000000000000000901b603782015260009081908190819081906001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000169063514ea4bf90603a01604051602081830303815290604052805190602001206040518263ffffffff1660e01b81526004016106d791815260200190565b60a06040518083038186803b1580156106ef57600080fd5b505afa158015610703573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107279190611dbc565b939992985090965094509092509050565b3360008181526005602090815260408083206001600160a01b038716808552925280832085905551919290917f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925906107939086815260200190565b60405180910390a350600192915050565b6001546001600160a01b031633146107cf57604051639ba0305d60e01b815260040160405180910390fd5b6107d76112b2565b565b6001600160a01b03831660008181526005602090815260408083203380855292528220549192909190821480159061081357506000198114155b156108895760006108248583611e26565b6001600160a01b038881166000818152600560209081526040808320948916808452948252918290208590559051848152939450919290917f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505b610894868686611310565b6001925050505b9392505050565b6003805461057590611d81565b60006108bd868686866113be565b509091506108d69050826001600160801b038316611645565b95945050505050565b60006108ec338484611310565b50600192915050565b60405163a34123a760e01b81527f0000000000000000000000000000000000000000000000000000000000000000600290810b60048301527f0000000000000000000000000000000000000000000000000000000000000000900b60248201526001600160801b038516604482015260009081906001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000169063a34123a7906064016040805180830381600087803b1580156109b657600080fd5b505af11580156109ca573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109ee9190611e3d565b909250905084821080610a0057508381105b15610a1e576040516397c7f53760e01b815260040160405180910390fd5b6040516309e3d67b60e31b81526001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001690634f1eb3d890610ab29086907f0000000000000000000000000000000000000000000000000000000000000000907f00000000000000000000000000000000000000000000000000000000000000009088908890600401611e61565b6040805180830381600087803b158015610acb57600080fd5b505af1158015610adf573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610b039190611e9e565b5050610b1833876001600160801b03166116cf565b94509492505050565b6000610b2f82840184611f04565b9050336001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001614610b7a57604051634b60273560e01b815260040160405180910390fd5b8415610bb4578051516020820151610bb491907f000000000000000000000000000000000000000000000000000000000000000088611751565b8315610bf257610bf281600001516020015182602001517f000000000000000000000000000000000000000000000000000000000000000087611751565b5050505050565b6000805481906001600160a01b03163314610c275760405163070545c960e51b815260040160405180910390fd5b6040516bffffffffffffffffffffffff193060601b1660208201527f000000000000000000000000000000000000000000000000000000000000000060e890811b60348301527f0000000000000000000000000000000000000000000000000000000000000000901b603782015260009081906001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000169063514ea4bf90603a01604051602081830303815290604052805190602001206040518263ffffffff1660e01b8152600401610d0291815260200190565b60a06040518083038186803b158015610d1a57600080fd5b505afa158015610d2e573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d529190611dbc565b6000546040516309e3d67b60e31b81529297509095506001600160a01b037f000000000000000000000000000000000000000000000000000000000000000081169550634f1eb3d89450610df3935016907f0000000000000000000000000000000000000000000000000000000000000000907f00000000000000000000000000000000000000000000000000000000000000009088908890600401611e61565b6040805180830381600087803b158015610e0c57600080fd5b505af1158015610e20573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e449190611e9e565b6001600160801b03918216969116945092505050565b6000546001600160a01b03163314610e855760405163070545c960e51b815260040160405180910390fd5b610e8e81611763565b50565b60008060008360020b12610ea8578260020b610eb5565b8260020b610eb590611fbf565b9050610ec4620d89e719611fdc565b60020b811115610efe5760405162461bcd60e51b81526020600482015260016024820152601560fa1b604482015260640160405180910390fd5b600060018216610f1257600160801b610f24565b6ffffcb933bd6fad37aa2d162d1a5940015b70ffffffffffffffffffffffffffffffffff1690506002821615610f63576080610f5e826ffff97272373d413259a46990580e213a611fff565b901c90505b6004821615610f8d576080610f88826ffff2e50f5f656932ef12357cf3c7fdcc611fff565b901c90505b6008821615610fb7576080610fb2826fffe5caca7e10e4e61c3624eaa0941cd0611fff565b901c90505b6010821615610fe1576080610fdc826fffcb9843d60f6159c9db58835c926644611fff565b901c90505b602082161561100b576080611006826fff973b41fa98c081472e6896dfb254c0611fff565b901c90505b6040821615611035576080611030826fff2ea16466c96a3843ec78b326b52861611fff565b901c90505b608082161561105f57608061105a826ffe5dee046a99a2a811c461f1969c3053611fff565b901c90505b61010082161561108a576080611085826ffcbe86c7900a88aedcffc83b479aa3a4611fff565b901c90505b6102008216156110b55760806110b0826ff987a7253ac413176f2b074cf7815e54611fff565b901c90505b6104008216156110e05760806110db826ff3392b0822b70005940c7a398e4b70f3611fff565b901c90505b61080082161561110b576080611106826fe7159475a2c29b7443b29c7fa6e889d9611fff565b901c90505b611000821615611136576080611131826fd097f3bdfd2022b8845ad8f792aa5825611fff565b901c90505b61200082161561116157608061115c826fa9f746462d870fdf8a65dc1f90e061e5611fff565b901c90505b61400082161561118c576080611187826f70d869a156d2a1b890bb3df62baf32f7611fff565b901c90505b6180008216156111b75760806111b2826f31be135f97d08fd981231505542fcfa6611fff565b901c90505b620100008216156111e35760806111de826f09aa508b5b7a84e1c677de54f3e99bc9611fff565b901c90505b6202000082161561120e576080611209826e5d6af8dedb81196699c329225ee604611fff565b901c90505b62040000821615611238576080611233826d2216e584f5fa1ea926041bedfe98611fff565b901c90505b6208000082161561126057608061125b826b048a170391f7dc42444e8fa2611fff565b901c90505b60008460020b131561127b5761127881600019612034565b90505b61128a64010000000082612048565b15611296576001611299565b60005b6112aa9060ff16602083901c61205c565b949350505050565b60018054600080546001600160a01b0383166001600160a01b031991821681179092559091169091556040519081527f5d5d6e01b731c3e68060f7fe13156f6197d4aeffc2d6f498e34c717ae616b7349060200160405180910390a1565b6001600160a01b03831660009081526006602052604081208054839290611338908490611e26565b90915550506001600160a01b0382166000908152600660205260408120805483929061136590849061205c565b92505081905550816001600160a01b0316836001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef836040516113b191815260200190565b60405180910390a3505050565b6000806000807f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316633850c7bd6040518163ffffffff1660e01b815260040160e06040518083038186803b15801561141d57600080fd5b505afa158015611431573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906114559190612096565b50505050505090506114aa817f00000000000000000000000000000000000000000000000000000000000000007f00000000000000000000000000000000000000000000000000000000000000008b8b6117ec565b6040805160a080820183526007546001600160a01b039081168385018181526008548084166060808801918252600160a01b90920462ffffff9081166080808a01918252948952336020998a019081528a51998a019690965291518616888a01529051169086015290518216848201528451808503909101815291830193849052633c8a7d8d60e01b9093529296507f000000000000000000000000000000000000000000000000000000000000000090911691633c8a7d8d916115b99130917f0000000000000000000000000000000000000000000000000000000000000000917f0000000000000000000000000000000000000000000000000000000000000000918b919060a401612130565b6040805180830381600087803b1580156115d257600080fd5b505af11580156115e6573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061160a9190611e3d565b90935091508583108061161c57508482105b1561163a576040516397c7f53760e01b815260040160405180910390fd5b509450945094915050565b8060046000828254611657919061205c565b90915550506001600160a01b0382166000908152600660205260408120805483929061168490849061205c565b90915550506040518181526001600160a01b038316906000907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef906020015b60405180910390a35050565b80600460008282546116e19190611e26565b90915550506001600160a01b0382166000908152600660205260408120805483929061170e908490611e26565b90915550506040518181526000906001600160a01b038416907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef906020016116c3565b61175d848484846118ae565b50505050565b6001600160a01b03811661178a5760405163d92e233d60e01b815260040160405180910390fd5b600180546001600160a01b0319166001600160a01b038381169182179092556000546040805191909316815260208101919091527f6353ec38ac394f8be94bfafcdd3580d356470599059eaeebedc3207e1cc03dec910160405180910390a150565b6000836001600160a01b0316856001600160a01b0316111561180c579293925b846001600160a01b0316866001600160a01b031611611837576118308585856119a8565b90506108d6565b836001600160a01b0316866001600160a01b0316101561189957600061185e8786866119a8565b9050600061186d878986611a12565b9050806001600160801b0316826001600160801b03161061188e5780611890565b815b925050506108d6565b6118a4858584611a12565b9695505050505050565b604080516001600160a01b0385811660248301528481166044830152606480830185905283518084039091018152608490920183526020820180516001600160e01b03166323b872dd60e01b1790529151600092839290881691611912919061217d565b6000604051808303816000865af19150503d806000811461194f576040519150601f19603f3d011682016040523d82523d6000602084013e611954565b606091505b509150915081158061198257508051158015906119825750808060200190518101906119809190612199565b155b156119a0576040516316369daf60e31b815260040160405180910390fd5b505050505050565b6000826001600160a01b0316846001600160a01b031611156119c8579192915b60006119eb856001600160a01b0316856001600160a01b0316600160601b611a48565b90506108d6611a0d84836119ff89896121b4565b6001600160a01b0316611a48565b611af7565b6000826001600160a01b0316846001600160a01b03161115611a32579192915b6112aa611a0d83600160601b6119ff88886121b4565b600080806000198587098587029250828110838203039150508060001415611a825760008411611a7757600080fd5b50829004905061089b565b808411611a8e57600080fd5b60008486880960026001871981018816978890046003810283188082028403028082028403028082028403028082028403028082028403029081029092039091026000889003889004909101858311909403939093029303949094049190911702949350505050565b806001600160801b0381168114611b0d57600080fd5b919050565b60005b83811015611b2d578181015183820152602001611b15565b8381111561175d5750506000910152565b60008151808452611b56816020860160208601611b12565b601f01601f19169290920160200192915050565b60208152600061089b6020830184611b3e565b6001600160a01b0381168114610e8e57600080fd5b60008060408385031215611ba557600080fd5b8235611bb081611b7d565b946020939093013593505050565b600080600060608486031215611bd357600080fd5b8335611bde81611b7d565b92506020840135611bee81611b7d565b929592945050506040919091013590565b600060208284031215611c1157600080fd5b813561089b81611b7d565b600080600080600060a08688031215611c3457600080fd5b853594506020860135935060408601359250606086013591506080860135611c5b81611b7d565b809150509295509295909350565b6001600160801b0381168114610e8e57600080fd5b60008060008060808587031215611c9457600080fd5b8435611c9f81611c69565b935060208501359250604085013591506060850135611cbd81611b7d565b939692955090935050565b60008060008060608587031215611cde57600080fd5b8435935060208501359250604085013567ffffffffffffffff80821115611d0457600080fd5b818701915087601f830112611d1857600080fd5b813581811115611d2757600080fd5b886020828501011115611d3957600080fd5b95989497505060200194505050565b60008060408385031215611d5b57600080fd5b8235611d6681611b7d565b91506020830135611d7681611b7d565b809150509250929050565b600181811c90821680611d9557607f821691505b60208210811415611db657634e487b7160e01b600052602260045260246000fd5b50919050565b600080600080600060a08688031215611dd457600080fd5b8551611ddf81611c69565b8095505060208601519350604086015192506060860151611dff81611c69565b6080870151909250611c5b81611c69565b634e487b7160e01b600052601160045260246000fd5b600082821015611e3857611e38611e10565b500390565b60008060408385031215611e5057600080fd5b505080516020909101519092909150565b6001600160a01b03959095168552600293840b60208601529190920b60408401526001600160801b03918216606084015216608082015260a00190565b60008060408385031215611eb157600080fd5b8251611ebc81611c69565b6020840151909250611d7681611c69565b6040516060810167ffffffffffffffff81118282101715611efe57634e487b7160e01b600052604160045260246000fd5b60405290565b60008183036080811215611f1757600080fd5b6040516040810181811067ffffffffffffffff82111715611f4857634e487b7160e01b600052604160045260246000fd5b6040526060821215611f5957600080fd5b611f61611ecd565b91508335611f6e81611b7d565b82526020840135611f7e81611b7d565b6020830152604084013562ffffff81168114611f9957600080fd5b6040830152908152606083013590611fb082611b7d565b60208101919091529392505050565b6000600160ff1b821415611fd557611fd5611e10565b5060000390565b60008160020b627fffff19811415611ff657611ff6611e10565b60000392915050565b600081600019048311821515161561201957612019611e10565b500290565b634e487b7160e01b600052601260045260246000fd5b6000826120435761204361201e565b500490565b6000826120575761205761201e565b500690565b6000821982111561206f5761206f611e10565b500190565b805161ffff81168114611b0d57600080fd5b80518015158114611b0d57600080fd5b600080600080600080600060e0888a0312156120b157600080fd5b87516120bc81611b7d565b8097505060208801518060020b81146120d457600080fd5b95506120e260408901612074565b94506120f060608901612074565b93506120fe60808901612074565b925060a088015160ff8116811461211457600080fd5b915061212260c08901612086565b905092959891949750929550565b60018060a01b03861681528460020b60208201528360020b60408201526001600160801b038316606082015260a06080820152600061217260a0830184611b3e565b979650505050505050565b6000825161218f818460208701611b12565b9190910192915050565b6000602082840312156121ab57600080fd5b61089b82612086565b60006001600160a01b03838116908316818110156121d4576121d4611e10565b03939250505056fea2646970667358221220a5cf752f3a9624b2bde030ec682170656211d5a7c372ef46b65ffb00bb78c39e64736f6c63430008080033", + "deployedBytecode": "0x608060405234801561001057600080fd5b50600436106101c45760003560e01c806395d89b41116100f9578063d21220a711610097578063ddca3f4311610071578063ddca3f43146104ff578063e3056a341461053a578063e52253811461054d578063f235757f1461055557600080fd5b8063d21220a71461049a578063d3487997146104c1578063dd62ed3e146104d457600080fd5b8063c45a0155116100d3578063c45a0155146103fd578063c627526114610424578063cf51148d1461044b578063d0c93a7c1461047357600080fd5b806395d89b41146103b7578063a3e6dc28146103bf578063a9059cbb146103ea57600080fd5b806318160ddd11610166578063313ce56711610140578063313ce5671461031c57806355b812a81461033657806359c4f9051461037057806370a082311461039757600080fd5b806318160ddd146102cb57806323b872dd146102e25780632ea28f5b146102f557600080fd5b80630c340a24116101a25780630c340a24146102485780630dfe16811461027357806313f6986d1461029a57806316f0115b146102a457600080fd5b806306fdde03146101c957806309218e91146101e7578063095ea7b314610225575b600080fd5b6101d1610568565b6040516101de9190611b6a565b60405180910390f35b6101ef6105f6565b604080516001600160801b039687168152602081019590955284019290925283166060830152909116608082015260a0016101de565b610238610233366004611b92565b610738565b60405190151581526020016101de565b60005461025b906001600160a01b031681565b6040516001600160a01b0390911681526020016101de565b61025b7f000000000000000000000000000000000000000000000000000000000000000081565b6102a26107a4565b005b61025b7f000000000000000000000000000000000000000000000000000000000000000081565b6102d460045481565b6040519081526020016101de565b6102386102f0366004611bbe565b6107d9565b61025b7f000000000000000000000000000000000000000000000000000000000000000081565b610324601281565b60405160ff90911681526020016101de565b61035d7f000000000000000000000000000000000000000000000000000000000000000081565b60405160029190910b81526020016101de565b61035d7f000000000000000000000000000000000000000000000000000000000000000081565b6102d46103a5366004611bff565b60066020526000908152604090205481565b6101d16108a2565b6103d26103cd366004611c1c565b6108af565b6040516001600160801b0390911681526020016101de565b6102386103f8366004611b92565b6108df565b61025b7f000000000000000000000000000000000000000000000000000000000000000081565b61025b7f000000000000000000000000000000000000000000000000000000000000000081565b61045e610459366004611c7e565b6108f5565b604080519283526020830191909152016101de565b61035d7f000000000000000000000000000000000000000000000000000000000000000081565b61025b7f000000000000000000000000000000000000000000000000000000000000000081565b6102a26104cf366004611cc8565b610b21565b6102d46104e2366004611d48565b600560209081526000928352604080842090915290825290205481565b6105267f000000000000000000000000000000000000000000000000000000000000000081565b60405162ffffff90911681526020016101de565b60015461025b906001600160a01b031681565b61045e610bf9565b6102a2610563366004611bff565b610e5a565b6002805461057590611d81565b80601f01602080910402602001604051908101604052809291908181526020018280546105a190611d81565b80156105ee5780601f106105c3576101008083540402835291602001916105ee565b820191906000526020600020905b8154815290600101906020018083116105d157829003601f168201915b505050505081565b6040516bffffffffffffffffffffffff193060601b1660208201527f000000000000000000000000000000000000000000000000000000000000000060e890811b60348301527f0000000000000000000000000000000000000000000000000000000000000000901b603782015260009081908190819081906001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000169063514ea4bf90603a01604051602081830303815290604052805190602001206040518263ffffffff1660e01b81526004016106d791815260200190565b60a06040518083038186803b1580156106ef57600080fd5b505afa158015610703573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107279190611dbc565b939992985090965094509092509050565b3360008181526005602090815260408083206001600160a01b038716808552925280832085905551919290917f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925906107939086815260200190565b60405180910390a350600192915050565b6001546001600160a01b031633146107cf57604051639ba0305d60e01b815260040160405180910390fd5b6107d76112b2565b565b6001600160a01b03831660008181526005602090815260408083203380855292528220549192909190821480159061081357506000198114155b156108895760006108248583611e26565b6001600160a01b038881166000818152600560209081526040808320948916808452948252918290208590559051848152939450919290917f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505b610894868686611310565b6001925050505b9392505050565b6003805461057590611d81565b60006108bd868686866113be565b509091506108d69050826001600160801b038316611645565b95945050505050565b60006108ec338484611310565b50600192915050565b60405163a34123a760e01b81527f0000000000000000000000000000000000000000000000000000000000000000600290810b60048301527f0000000000000000000000000000000000000000000000000000000000000000900b60248201526001600160801b038516604482015260009081906001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000169063a34123a7906064016040805180830381600087803b1580156109b657600080fd5b505af11580156109ca573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109ee9190611e3d565b909250905084821080610a0057508381105b15610a1e576040516397c7f53760e01b815260040160405180910390fd5b6040516309e3d67b60e31b81526001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001690634f1eb3d890610ab29086907f0000000000000000000000000000000000000000000000000000000000000000907f00000000000000000000000000000000000000000000000000000000000000009088908890600401611e61565b6040805180830381600087803b158015610acb57600080fd5b505af1158015610adf573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610b039190611e9e565b5050610b1833876001600160801b03166116cf565b94509492505050565b6000610b2f82840184611f04565b9050336001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001614610b7a57604051634b60273560e01b815260040160405180910390fd5b8415610bb4578051516020820151610bb491907f000000000000000000000000000000000000000000000000000000000000000088611751565b8315610bf257610bf281600001516020015182602001517f000000000000000000000000000000000000000000000000000000000000000087611751565b5050505050565b6000805481906001600160a01b03163314610c275760405163070545c960e51b815260040160405180910390fd5b6040516bffffffffffffffffffffffff193060601b1660208201527f000000000000000000000000000000000000000000000000000000000000000060e890811b60348301527f0000000000000000000000000000000000000000000000000000000000000000901b603782015260009081906001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000169063514ea4bf90603a01604051602081830303815290604052805190602001206040518263ffffffff1660e01b8152600401610d0291815260200190565b60a06040518083038186803b158015610d1a57600080fd5b505afa158015610d2e573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d529190611dbc565b6000546040516309e3d67b60e31b81529297509095506001600160a01b037f000000000000000000000000000000000000000000000000000000000000000081169550634f1eb3d89450610df3935016907f0000000000000000000000000000000000000000000000000000000000000000907f00000000000000000000000000000000000000000000000000000000000000009088908890600401611e61565b6040805180830381600087803b158015610e0c57600080fd5b505af1158015610e20573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e449190611e9e565b6001600160801b03918216969116945092505050565b6000546001600160a01b03163314610e855760405163070545c960e51b815260040160405180910390fd5b610e8e81611763565b50565b60008060008360020b12610ea8578260020b610eb5565b8260020b610eb590611fbf565b9050610ec4620d89e719611fdc565b60020b811115610efe5760405162461bcd60e51b81526020600482015260016024820152601560fa1b604482015260640160405180910390fd5b600060018216610f1257600160801b610f24565b6ffffcb933bd6fad37aa2d162d1a5940015b70ffffffffffffffffffffffffffffffffff1690506002821615610f63576080610f5e826ffff97272373d413259a46990580e213a611fff565b901c90505b6004821615610f8d576080610f88826ffff2e50f5f656932ef12357cf3c7fdcc611fff565b901c90505b6008821615610fb7576080610fb2826fffe5caca7e10e4e61c3624eaa0941cd0611fff565b901c90505b6010821615610fe1576080610fdc826fffcb9843d60f6159c9db58835c926644611fff565b901c90505b602082161561100b576080611006826fff973b41fa98c081472e6896dfb254c0611fff565b901c90505b6040821615611035576080611030826fff2ea16466c96a3843ec78b326b52861611fff565b901c90505b608082161561105f57608061105a826ffe5dee046a99a2a811c461f1969c3053611fff565b901c90505b61010082161561108a576080611085826ffcbe86c7900a88aedcffc83b479aa3a4611fff565b901c90505b6102008216156110b55760806110b0826ff987a7253ac413176f2b074cf7815e54611fff565b901c90505b6104008216156110e05760806110db826ff3392b0822b70005940c7a398e4b70f3611fff565b901c90505b61080082161561110b576080611106826fe7159475a2c29b7443b29c7fa6e889d9611fff565b901c90505b611000821615611136576080611131826fd097f3bdfd2022b8845ad8f792aa5825611fff565b901c90505b61200082161561116157608061115c826fa9f746462d870fdf8a65dc1f90e061e5611fff565b901c90505b61400082161561118c576080611187826f70d869a156d2a1b890bb3df62baf32f7611fff565b901c90505b6180008216156111b75760806111b2826f31be135f97d08fd981231505542fcfa6611fff565b901c90505b620100008216156111e35760806111de826f09aa508b5b7a84e1c677de54f3e99bc9611fff565b901c90505b6202000082161561120e576080611209826e5d6af8dedb81196699c329225ee604611fff565b901c90505b62040000821615611238576080611233826d2216e584f5fa1ea926041bedfe98611fff565b901c90505b6208000082161561126057608061125b826b048a170391f7dc42444e8fa2611fff565b901c90505b60008460020b131561127b5761127881600019612034565b90505b61128a64010000000082612048565b15611296576001611299565b60005b6112aa9060ff16602083901c61205c565b949350505050565b60018054600080546001600160a01b0383166001600160a01b031991821681179092559091169091556040519081527f5d5d6e01b731c3e68060f7fe13156f6197d4aeffc2d6f498e34c717ae616b7349060200160405180910390a1565b6001600160a01b03831660009081526006602052604081208054839290611338908490611e26565b90915550506001600160a01b0382166000908152600660205260408120805483929061136590849061205c565b92505081905550816001600160a01b0316836001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef836040516113b191815260200190565b60405180910390a3505050565b6000806000807f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316633850c7bd6040518163ffffffff1660e01b815260040160e06040518083038186803b15801561141d57600080fd5b505afa158015611431573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906114559190612096565b50505050505090506114aa817f00000000000000000000000000000000000000000000000000000000000000007f00000000000000000000000000000000000000000000000000000000000000008b8b6117ec565b6040805160a080820183526007546001600160a01b039081168385018181526008548084166060808801918252600160a01b90920462ffffff9081166080808a01918252948952336020998a019081528a51998a019690965291518616888a01529051169086015290518216848201528451808503909101815291830193849052633c8a7d8d60e01b9093529296507f000000000000000000000000000000000000000000000000000000000000000090911691633c8a7d8d916115b99130917f0000000000000000000000000000000000000000000000000000000000000000917f0000000000000000000000000000000000000000000000000000000000000000918b919060a401612130565b6040805180830381600087803b1580156115d257600080fd5b505af11580156115e6573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061160a9190611e3d565b90935091508583108061161c57508482105b1561163a576040516397c7f53760e01b815260040160405180910390fd5b509450945094915050565b8060046000828254611657919061205c565b90915550506001600160a01b0382166000908152600660205260408120805483929061168490849061205c565b90915550506040518181526001600160a01b038316906000907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef906020015b60405180910390a35050565b80600460008282546116e19190611e26565b90915550506001600160a01b0382166000908152600660205260408120805483929061170e908490611e26565b90915550506040518181526000906001600160a01b038416907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef906020016116c3565b61175d848484846118ae565b50505050565b6001600160a01b03811661178a5760405163d92e233d60e01b815260040160405180910390fd5b600180546001600160a01b0319166001600160a01b038381169182179092556000546040805191909316815260208101919091527f6353ec38ac394f8be94bfafcdd3580d356470599059eaeebedc3207e1cc03dec910160405180910390a150565b6000836001600160a01b0316856001600160a01b0316111561180c579293925b846001600160a01b0316866001600160a01b031611611837576118308585856119a8565b90506108d6565b836001600160a01b0316866001600160a01b0316101561189957600061185e8786866119a8565b9050600061186d878986611a12565b9050806001600160801b0316826001600160801b03161061188e5780611890565b815b925050506108d6565b6118a4858584611a12565b9695505050505050565b604080516001600160a01b0385811660248301528481166044830152606480830185905283518084039091018152608490920183526020820180516001600160e01b03166323b872dd60e01b1790529151600092839290881691611912919061217d565b6000604051808303816000865af19150503d806000811461194f576040519150601f19603f3d011682016040523d82523d6000602084013e611954565b606091505b509150915081158061198257508051158015906119825750808060200190518101906119809190612199565b155b156119a0576040516316369daf60e31b815260040160405180910390fd5b505050505050565b6000826001600160a01b0316846001600160a01b031611156119c8579192915b60006119eb856001600160a01b0316856001600160a01b0316600160601b611a48565b90506108d6611a0d84836119ff89896121b4565b6001600160a01b0316611a48565b611af7565b6000826001600160a01b0316846001600160a01b03161115611a32579192915b6112aa611a0d83600160601b6119ff88886121b4565b600080806000198587098587029250828110838203039150508060001415611a825760008411611a7757600080fd5b50829004905061089b565b808411611a8e57600080fd5b60008486880960026001871981018816978890046003810283188082028403028082028403028082028403028082028403028082028403029081029092039091026000889003889004909101858311909403939093029303949094049190911702949350505050565b806001600160801b0381168114611b0d57600080fd5b919050565b60005b83811015611b2d578181015183820152602001611b15565b8381111561175d5750506000910152565b60008151808452611b56816020860160208601611b12565b601f01601f19169290920160200192915050565b60208152600061089b6020830184611b3e565b6001600160a01b0381168114610e8e57600080fd5b60008060408385031215611ba557600080fd5b8235611bb081611b7d565b946020939093013593505050565b600080600060608486031215611bd357600080fd5b8335611bde81611b7d565b92506020840135611bee81611b7d565b929592945050506040919091013590565b600060208284031215611c1157600080fd5b813561089b81611b7d565b600080600080600060a08688031215611c3457600080fd5b853594506020860135935060408601359250606086013591506080860135611c5b81611b7d565b809150509295509295909350565b6001600160801b0381168114610e8e57600080fd5b60008060008060808587031215611c9457600080fd5b8435611c9f81611c69565b935060208501359250604085013591506060850135611cbd81611b7d565b939692955090935050565b60008060008060608587031215611cde57600080fd5b8435935060208501359250604085013567ffffffffffffffff80821115611d0457600080fd5b818701915087601f830112611d1857600080fd5b813581811115611d2757600080fd5b886020828501011115611d3957600080fd5b95989497505060200194505050565b60008060408385031215611d5b57600080fd5b8235611d6681611b7d565b91506020830135611d7681611b7d565b809150509250929050565b600181811c90821680611d9557607f821691505b60208210811415611db657634e487b7160e01b600052602260045260246000fd5b50919050565b600080600080600060a08688031215611dd457600080fd5b8551611ddf81611c69565b8095505060208601519350604086015192506060860151611dff81611c69565b6080870151909250611c5b81611c69565b634e487b7160e01b600052601160045260246000fd5b600082821015611e3857611e38611e10565b500390565b60008060408385031215611e5057600080fd5b505080516020909101519092909150565b6001600160a01b03959095168552600293840b60208601529190920b60408401526001600160801b03918216606084015216608082015260a00190565b60008060408385031215611eb157600080fd5b8251611ebc81611c69565b6020840151909250611d7681611c69565b6040516060810167ffffffffffffffff81118282101715611efe57634e487b7160e01b600052604160045260246000fd5b60405290565b60008183036080811215611f1757600080fd5b6040516040810181811067ffffffffffffffff82111715611f4857634e487b7160e01b600052604160045260246000fd5b6040526060821215611f5957600080fd5b611f61611ecd565b91508335611f6e81611b7d565b82526020840135611f7e81611b7d565b6020830152604084013562ffffff81168114611f9957600080fd5b6040830152908152606083013590611fb082611b7d565b60208101919091529392505050565b6000600160ff1b821415611fd557611fd5611e10565b5060000390565b60008160020b627fffff19811415611ff657611ff6611e10565b60000392915050565b600081600019048311821515161561201957612019611e10565b500290565b634e487b7160e01b600052601260045260246000fd5b6000826120435761204361201e565b500490565b6000826120575761205761201e565b500690565b6000821982111561206f5761206f611e10565b500190565b805161ffff81168114611b0d57600080fd5b80518015158114611b0d57600080fd5b600080600080600080600060e0888a0312156120b157600080fd5b87516120bc81611b7d565b8097505060208801518060020b81146120d457600080fd5b95506120e260408901612074565b94506120f060608901612074565b93506120fe60808901612074565b925060a088015160ff8116811461211457600080fd5b915061212260c08901612086565b905092959891949750929550565b60018060a01b03861681528460020b60208201528360020b60408201526001600160801b038316606082015260a06080820152600061217260a0830184611b3e565b979650505050505050565b6000825161218f818460208701611b12565b9190910192915050565b6000602082840312156121ab57600080fd5b61089b82612086565b60006001600160a01b03838116908316818110156121d4576121d4611e10565b03939250505056fea2646970667358221220a5cf752f3a9624b2bde030ec682170656211d5a7c372ef46b65ffb00bb78c39e64736f6c63430008080033", + "devdoc": { + "kind": "dev", + "methods": { + "approve(address,uint256)": { + "details": "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." + }, + "burn(uint128,uint256,uint256,address)": { + "params": { + "amount0Min": "The minimum amount of token0 we want to send to the recipient (to)", + "amount1Min": "The minimum amount of token1 we want to send to the recipient (to)", + "liquidity": "The amount of liquidity to be burned", + "to": "The address that will receive the due fees" + }, + "returns": { + "amount0": "The calculated amount of token0 that will be sent to the recipient", + "amount1": "The calculated amount of token1 that will be sent to the recipient" + } + }, + "collect()": { + "details": "The collected fees will be sent to governor", + "returns": { + "amount0": "The amount of fees collected in token0", + "amount1": "The amount of fees collected in token1" + } + }, + "mint(uint256,uint256,uint256,uint256,address)": { + "details": "Triggers UniV3PairManager#uniswapV3MintCallback", + "params": { + "amount0Desired": "The amount of token0 we would like to provide", + "amount0Min": "The minimum amount of token0 we want to provide", + "amount1Desired": "The amount of token1 we would like to provide", + "amount1Min": "The minimum amount of token1 we want to provide", + "to": "The address to which the kLP tokens are going to be minted to" + }, + "returns": { + "liquidity": "kLP tokens sent in exchange for the provision of tokens" + } + }, + "position()": { + "returns": { + "feeGrowthInside0LastX128": "The fee growth of token0 as of the last action on the individual position", + "feeGrowthInside1LastX128": "The fee growth of token1 as of the last action on the individual position", + "liquidity": "The amount of liquidity provided to the UniswapV3 pool by the pair manager", + "tokensOwed0": "The uncollected amount of token0 owed to the position as of the last computation", + "tokensOwed1": "The uncollected amount of token1 owed to the position as of the last computation" + } + }, + "setPendingGovernor(address)": { + "params": { + "_pendingGovernor": "Address of the proposed new governor" + } + }, + "transfer(address,uint256)": { + "details": "Moves `amount` tokens from the caller's account to `recipient`. Returns a boolean value indicating whether the operation succeeded. Emits a {Transfer} event." + }, + "transferFrom(address,address,uint256)": { + "details": "Moves `amount` tokens from `sender` to `recipient` 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." + }, + "uniswapV3MintCallback(uint256,uint256,bytes)": { + "params": { + "amount0Owed": "The amount of token0 due to the pool for the minted liquidity", + "amount1Owed": "The amount of token1 due to the pool for the minted liquidity", + "data": "The encoded token0, token1, fee (_poolKey) and the payer (msg.sender) of the IUniV3PairManager#mint function" + } + } + }, + "stateVariables": { + "_MAX_TICK": { + "details": "Due to tick spacing, pools with different fees may have differences between _MAX_TICK and tickUpper. Use tickUpper to find the max tick of the pool." + }, + "allowance": { + "details": "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." + }, + "balanceOf": { + "details": "Returns the amount of tokens owned by `account`." + }, + "decimals": { + "details": "Returns the decimals places of the token." + }, + "factory": { + "return": "_factory The address of the PairManager Factory", + "returns": { + "_0": "_factory The address of the PairManager Factory" + } + }, + "fee": { + "return": "_fee The fee of the Uniswap pool passed into the constructor", + "returns": { + "_0": "_fee The fee of the Uniswap pool passed into the constructor" + } + }, + "name": { + "details": "Returns the name of the token." + }, + "pool": { + "return": "_pool The address of the pool", + "returns": { + "_0": "_pool The address of the pool" + } + }, + "sqrtRatioAX96": { + "return": "_sqrtPriceA96 A Fixed point Q64.96 number representing the sqrt of the ratio of the two assets (token1/token0) at the lowest tick", + "returns": { + "_0": "_sqrtPriceA96 A Fixed point Q64.96 number representing the sqrt of the ratio of the two assets (token1/token0) at the lowest tick" + } + }, + "sqrtRatioBX96": { + "return": "_sqrtPriceBX96 A Fixed point Q64.96 number representing the sqrt of the ratio of the two assets (token1/token0) at the highest tick", + "returns": { + "_0": "_sqrtPriceBX96 A Fixed point Q64.96 number representing the sqrt of the ratio of the two assets (token1/token0) at the highest tick" + } + }, + "symbol": { + "details": "Returns the symbol of the token." + }, + "tickLower": { + "return": "_tickLower The lower tick in the Uniswap's curve", + "returns": { + "_0": "_tickLower The lower tick in the Uniswap's curve" + } + }, + "tickSpacing": { + "return": "_tickSpacing The pair tick spacing", + "returns": { + "_0": "_tickSpacing The pair tick spacing" + } + }, + "tickUpper": { + "return": "_tickUpper The highest tick in the Uniswap's curve", + "returns": { + "_0": "_tickUpper The highest tick in the Uniswap's curve" + } + }, + "token0": { + "return": "_token0 The address of token0", + "returns": { + "_0": "_token0 The address of token0" + } + }, + "token1": { + "return": "_token1 The address of token1", + "returns": { + "_0": "_token1 The address of token1" + } + }, + "totalSupply": { + "details": "Returns the amount of tokens in existence." + } + }, + "version": 1 + }, + "userdoc": { + "errors": { + "ExcessiveSlippage()": [ + { + "notice": "Throws when the slippage exceeds what the user is comfortable with" + } + ], + "InvalidAddress()": [ + { + "notice": "Thrown if an address is invalid" + } + ], + "InvalidAmount()": [ + { + "notice": "Thrown if an amount is invalid" + } + ], + "LengthMismatch()": [ + { + "notice": "Thrown if the lengths of a set of lists mismatch" + } + ], + "OnlyGovernor()": [ + { + "notice": "Thrown if a non-governor user tries to call a OnlyGovernor function" + } + ], + "OnlyPendingGovernor()": [ + { + "notice": "Thrown if a non-pending-governor user tries to call a OnlyPendingGovernor function" + } + ], + "OnlyPool()": [ + { + "notice": "Throws when the caller of the function is not the pool" + } + ], + "UnsuccessfulTransfer()": [ + { + "notice": "Throws when a transfer is unsuccessful" + } + ], + "ZeroAddress()": [ + { + "notice": "Thrown if an address is the zero address" + } + ], + "ZeroAmount()": [ + { + "notice": "Thrown if an amount is zero" + } + ] + }, + "events": { + "PendingGovernorAccepted(address)": { + "notice": "Emitted when a new governor is set" + }, + "PendingGovernorSet(address,address)": { + "notice": "Emitted when a new pending governor is set" + } + }, + "kind": "user", + "methods": { + "acceptPendingGovernor()": { + "notice": "Allows a proposed governor to accept the governance" + }, + "factory()": { + "notice": "Address of the factory from which the pair manager was created" + }, + "fee()": { + "notice": "The fee of the Uniswap pool passed into the constructor" + }, + "mint(uint256,uint256,uint256,uint256,address)": { + "notice": "Mints kLP tokens to an address according to the liquidity the msg.sender provides to the UniswapV3 pool" + }, + "pool()": { + "notice": "Address of the pool from which the Keep3r pair manager will interact with" + }, + "position()": { + "notice": "Returns the pair manager's position in the corresponding UniswapV3 pool" + }, + "setPendingGovernor(address)": { + "notice": "Allows a governor to propose a new governor" + }, + "sqrtRatioAX96()": { + "notice": "The sqrtRatioAX96 at the lowest tick (-887200) of the Uniswap pool" + }, + "sqrtRatioBX96()": { + "notice": "The sqrtRatioBX96 at the highest tick (887200) of the Uniswap pool" + }, + "tickLower()": { + "notice": "Lowest tick in the Uniswap's curve" + }, + "tickSpacing()": { + "notice": "The pair tick spacing" + }, + "tickUpper()": { + "notice": "Highest tick in the Uniswap's curve" + }, + "token0()": { + "notice": "Token0 of the pool" + }, + "token1()": { + "notice": "Token1 of the pool" + }, + "uniswapV3MintCallback(uint256,uint256,bytes)": { + "notice": "This function is called after a user calls IUniV3PairManager#mint function It ensures that any tokens owed to the pool are paid by the msg.sender of IUniV3PairManager#mint function" + } + }, + "version": 1 + }, + "storageLayout": { + "storage": [ + { + "astId": 82, + "contract": "solidity/contracts/UniV3PairManager.sol:UniV3PairManager", + "label": "governor", + "offset": 0, + "slot": "0", + "type": "t_address" + }, + { + "astId": 85, + "contract": "solidity/contracts/UniV3PairManager.sol:UniV3PairManager", + "label": "pendingGovernor", + "offset": 0, + "slot": "1", + "type": "t_address" + }, + { + "astId": 3834, + "contract": "solidity/contracts/UniV3PairManager.sol:UniV3PairManager", + "label": "name", + "offset": 0, + "slot": "2", + "type": "t_string_storage" + }, + { + "astId": 3838, + "contract": "solidity/contracts/UniV3PairManager.sol:UniV3PairManager", + "label": "symbol", + "offset": 0, + "slot": "3", + "type": "t_string_storage" + }, + { + "astId": 3842, + "contract": "solidity/contracts/UniV3PairManager.sol:UniV3PairManager", + "label": "totalSupply", + "offset": 0, + "slot": "4", + "type": "t_uint256" + }, + { + "astId": 3899, + "contract": "solidity/contracts/UniV3PairManager.sol:UniV3PairManager", + "label": "allowance", + "offset": 0, + "slot": "5", + "type": "t_mapping(t_address,t_mapping(t_address,t_uint256))" + }, + { + "astId": 3905, + "contract": "solidity/contracts/UniV3PairManager.sol:UniV3PairManager", + "label": "balanceOf", + "offset": 0, + "slot": "6", + "type": "t_mapping(t_address,t_uint256)" + }, + { + "astId": 3909, + "contract": "solidity/contracts/UniV3PairManager.sol:UniV3PairManager", + "label": "_poolKey", + "offset": 0, + "slot": "7", + "type": "t_struct(PoolKey)13375_storage" + } + ], + "types": { + "t_address": { + "encoding": "inplace", + "label": "address", + "numberOfBytes": "20" + }, + "t_mapping(t_address,t_mapping(t_address,t_uint256))": { + "encoding": "mapping", + "key": "t_address", + "label": "mapping(address => mapping(address => uint256))", + "numberOfBytes": "32", + "value": "t_mapping(t_address,t_uint256)" + }, + "t_mapping(t_address,t_uint256)": { + "encoding": "mapping", + "key": "t_address", + "label": "mapping(address => uint256)", + "numberOfBytes": "32", + "value": "t_uint256" + }, + "t_string_storage": { + "encoding": "bytes", + "label": "string", + "numberOfBytes": "32" + }, + "t_struct(PoolKey)13375_storage": { + "encoding": "inplace", + "label": "struct IUniV3PairManager.PoolKey", + "members": [ + { + "astId": 13370, + "contract": "solidity/contracts/UniV3PairManager.sol:UniV3PairManager", + "label": "token0", + "offset": 0, + "slot": "0", + "type": "t_address" + }, + { + "astId": 13372, + "contract": "solidity/contracts/UniV3PairManager.sol:UniV3PairManager", + "label": "token1", + "offset": 0, + "slot": "1", + "type": "t_address" + }, + { + "astId": 13374, + "contract": "solidity/contracts/UniV3PairManager.sol:UniV3PairManager", + "label": "fee", + "offset": 20, + "slot": "1", + "type": "t_uint24" + } + ], + "numberOfBytes": "64" + }, + "t_uint24": { + "encoding": "inplace", + "label": "uint24", + "numberOfBytes": "3" + }, + "t_uint256": { + "encoding": "inplace", + "label": "uint256", + "numberOfBytes": "32" + } + } + } +} \ No newline at end of file diff --git a/deployments/goerli/UniV3Pool.json b/deployments/optimisticSepolia/UniV3Pool.json similarity index 99% rename from deployments/goerli/UniV3Pool.json rename to deployments/optimisticSepolia/UniV3Pool.json index f513052..cd286c4 100644 --- a/deployments/goerli/UniV3Pool.json +++ b/deployments/optimisticSepolia/UniV3Pool.json @@ -1,5 +1,5 @@ { - "address": "0x317ceCd3eB02158f97DF0B67B788edCda4E066e5", + "address": "0x8BFdD4689dC4669bd818c0551a510301f091103C", "abi": [ { "anonymous": false, @@ -983,5 +983,5 @@ "type": "function" } ], - "numDeployments": 3 + "numDeployments": 1 } \ No newline at end of file diff --git a/deployments/goerli/WETH.json b/deployments/optimisticSepolia/WETH.json similarity index 99% rename from deployments/goerli/WETH.json rename to deployments/optimisticSepolia/WETH.json index ad60f60..2776462 100644 --- a/deployments/goerli/WETH.json +++ b/deployments/optimisticSepolia/WETH.json @@ -1,5 +1,5 @@ { - "address": "0xB4FBF271143F4FBf7B91A5ded31805e42b2208d6", + "address": "0x4200000000000000000000000000000000000006", "abi": [ { "inputs": [ @@ -413,5 +413,5 @@ "type": "function" } ], - "numDeployments": 3 + "numDeployments": 6 } \ No newline at end of file diff --git a/deployments/optimisticGoerli/WethUsdOracle.json b/deployments/optimisticSepolia/WethUsdOracle.json similarity index 99% rename from deployments/optimisticGoerli/WethUsdOracle.json rename to deployments/optimisticSepolia/WethUsdOracle.json index baee156..e6c6fd3 100644 --- a/deployments/optimisticGoerli/WethUsdOracle.json +++ b/deployments/optimisticSepolia/WethUsdOracle.json @@ -1,5 +1,5 @@ { - "address": "0x4ECFF2c532d47D7be3D957E4a332AB134cad1fd9", + "address": "0x8BFdD4689dC4669bd818c0551a510301f091103C", "abi": [ { "anonymous": false, @@ -983,5 +983,5 @@ "type": "function" } ], - "numDeployments": 4 + "numDeployments": 5 } \ No newline at end of file diff --git a/deployments/optimisticGoerli/wkLP.json b/deployments/optimisticSepolia/wkLP.json similarity index 97% rename from deployments/optimisticGoerli/wkLP.json rename to deployments/optimisticSepolia/wkLP.json index 96691da..583260c 100644 --- a/deployments/optimisticGoerli/wkLP.json +++ b/deployments/optimisticSepolia/wkLP.json @@ -1,5 +1,5 @@ { - "address": "0xA437aC90d360c7645f25f30ddE201a94fe137Af5", + "address": "0x12DA5E324EFCBDe7BB4797e1dB2B3477FC4C048f", "abi": [ { "anonymous": false, @@ -185,5 +185,5 @@ "type": "function" } ], - "numDeployments": 3 + "numDeployments": 1 } \ No newline at end of file diff --git a/deployments/polygon/solcInputs/3a869c3b827b38468356d50761a61b47.json b/deployments/polygon/solcInputs/3a869c3b827b38468356d50761a61b47.json deleted file mode 100644 index 35e21ab..0000000 --- a/deployments/polygon/solcInputs/3a869c3b827b38468356d50761a61b47.json +++ /dev/null @@ -1,325 +0,0 @@ -{ - "language": "Solidity", - "sources": { - "solidity/contracts/Keep3r.sol": { - "content": "// SPDX-License-Identifier: MIT\n\n/*\n\nCoded for The Keep3r Network with ♥ by\n\n██████╗░███████╗███████╗██╗░░░██╗░░░░░░░██╗░█████╗░███╗░░██╗██████╗░███████╗██████╗░██╗░░░░░░█████╗░███╗░░██╗██████╗░\n██╔══██╗██╔════╝██╔════╝██║░░░██║░░██╗░░██║██╔══██╗████╗░██║██╔══██╗██╔════╝██╔══██╗██║░░░░░██╔══██╗████╗░██║██╔══██╗\n██║░░██║█████╗░░█████╗░░██║░░░╚██╗████╗██╔╝██║░░██║██╔██╗██║██║░░██║█████╗░░██████╔╝██║░░░░░███████║██╔██╗██║██║░░██║\n██║░░██║██╔══╝░░██╔══╝░░██║░░░░████╔═████║░██║░░██║██║╚████║██║░░██║██╔══╝░░██╔══██╗██║░░░░░██╔══██║██║╚████║██║░░██║\n██████╔╝███████╗██║░░░░░██║░░░░╚██╔╝░╚██╔╝░╚█████╔╝██║░╚███║██████╔╝███████╗██║░░██║███████╗██║░░██║██║░╚███║██████╔╝\n╚═════╝░╚══════╝╚═╝░░░░░╚═╝░░░░░╚═╝░░░╚═╝░░░╚════╝░╚═╝░░╚══╝╚═════╝░╚══════╝╚═╝░░╚═╝╚══════╝╚═╝░░╚═╝╚═╝░░╚══╝╚═════╝░\n\nhttps://defi.sucks\n\n*/\n\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../interfaces/IKeep3r.sol';\nimport './peripherals/jobs/Keep3rJobs.sol';\nimport './peripherals/keepers/Keep3rKeepers.sol';\nimport '@defi-wonderland/solidity-utils/solidity/contracts/DustCollector.sol';\n\ncontract Keep3r is IKeep3r, Keep3rJobs, Keep3rKeepers {\n constructor(\n address _governor,\n address _keep3rHelper,\n address _keep3rV1,\n address _keep3rV1Proxy\n ) Keep3rParameters(_keep3rHelper, _keep3rV1, _keep3rV1Proxy) Keep3rRoles(_governor) {}\n}\n" - }, - "solidity/interfaces/IKeep3r.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport './peripherals/IKeep3rJobs.sol';\nimport './peripherals/IKeep3rKeepers.sol';\nimport './peripherals/IKeep3rParameters.sol';\n\n// solhint-disable-next-line no-empty-blocks\n\n/// @title Keep3rV2 contract\n/// @notice This contract inherits all the functionality of Keep3rV2\ninterface IKeep3r is IKeep3rJobs, IKeep3rKeepers, IKeep3rParameters {\n\n}\n" - }, - "solidity/contracts/peripherals/jobs/Keep3rJobs.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../../../interfaces/peripherals/IKeep3rJobs.sol';\nimport './Keep3rJobManager.sol';\nimport './Keep3rJobWorkable.sol';\nimport './Keep3rJobDisputable.sol';\n\nabstract contract Keep3rJobs is IKeep3rJobs, Keep3rJobManager, Keep3rJobWorkable, Keep3rJobDisputable {}\n" - }, - "solidity/contracts/peripherals/keepers/Keep3rKeepers.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../../../interfaces/peripherals/IKeep3rKeepers.sol';\nimport './Keep3rKeeperDisputable.sol';\n\nabstract contract Keep3rKeepers is IKeep3rKeepers, Keep3rKeeperDisputable {}\n" - }, - "@defi-wonderland/solidity-utils/solidity/contracts/DustCollector.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.8 <0.9.0;\n\nimport {Governable} from './Governable.sol';\nimport {IDustCollector} from '../interfaces/IDustCollector.sol';\nimport {IERC20} from '@openzeppelin/contracts/token/ERC20/IERC20.sol';\nimport {SafeERC20} from '@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol';\n\n/// @title DustCollector contract\nabstract contract DustCollector is IDustCollector, Governable {\n using SafeERC20 for IERC20;\n\n /// @inheritdoc IDustCollector\n address public constant ETH_ADDRESS = 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE;\n\n /// @inheritdoc IDustCollector\n function sendDust(address _token, uint256 _amount, address _to) external onlyGovernor {\n if (_to == address(0)) revert ZeroAddress();\n if (_token == ETH_ADDRESS) payable(_to).transfer(_amount);\n else IERC20(_token).safeTransfer(_to, _amount);\n emit DustSent(_token, _amount, _to);\n }\n}\n" - }, - "solidity/interfaces/peripherals/IKeep3rJobs.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport './IKeep3rDisputable.sol';\n\n/// @title Keep3rJobOwnership contract\n/// @notice Handles the ownership of the jobs\ninterface IKeep3rJobOwnership {\n // Events\n\n /// @notice Emitted when Keep3rJobOwnership#changeJobOwnership is called\n /// @param _job The address of the job proposed to have a change of owner\n /// @param _owner The current owner of the job\n /// @param _pendingOwner The new address proposed to be the owner of the job\n event JobOwnershipChange(address indexed _job, address indexed _owner, address indexed _pendingOwner);\n\n /// @notice Emitted when Keep3rJobOwnership#JobOwnershipAssent is called\n /// @param _job The address of the job which the proposed owner will now own\n /// @param _previousOwner The previous owner of the job\n /// @param _newOwner The new owner of the job\n event JobOwnershipAssent(address indexed _job, address indexed _previousOwner, address indexed _newOwner);\n\n // Errors\n\n /// @notice Throws when the caller of the function is not the job owner\n error OnlyJobOwner();\n\n /// @notice Throws when the caller of the function is not the pending job owner\n error OnlyPendingJobOwner();\n\n // Variables\n\n /// @notice Maps the job to the owner of the job\n /// @param _job The address of the job\n /// @return _owner The address of the owner of the job\n function jobOwner(address _job) external view returns (address _owner);\n\n /// @notice Maps the job to its pending owner\n /// @param _job The address of the job\n /// @return _pendingOwner The address of the pending owner of the job\n function jobPendingOwner(address _job) external view returns (address _pendingOwner);\n\n // Methods\n\n /// @notice Proposes a new address to be the owner of the job\n /// @param _job The address of the job\n /// @param _newOwner The address of the proposed new owner\n function changeJobOwnership(address _job, address _newOwner) external;\n\n /// @notice The proposed address accepts to be the owner of the job\n /// @param _job The address of the job\n function acceptJobOwnership(address _job) external;\n}\n\n/// @title Keep3rJobManager contract\n/// @notice Handles the addition and withdrawal of credits from a job\ninterface IKeep3rJobManager is IKeep3rJobOwnership {\n // Events\n\n /// @notice Emitted when Keep3rJobManager#addJob is called\n /// @param _job The address of the job to add\n /// @param _jobOwner The job's owner\n event JobAddition(address indexed _job, address indexed _jobOwner);\n\n // Errors\n\n /// @notice Throws when trying to add a job that has already been added\n error JobAlreadyAdded();\n\n /// @notice Throws when the address that is trying to register as a keeper is already a keeper\n error AlreadyAKeeper();\n\n // Methods\n\n /// @notice Allows any caller to add a new job\n /// @param _job Address of the contract for which work should be performed\n function addJob(address _job) external;\n}\n\n/// @title Keep3rJobFundableCredits contract\n/// @notice Handles the addition and withdrawal of credits from a job\ninterface IKeep3rJobFundableCredits is IKeep3rJobOwnership {\n // Events\n\n /// @notice Emitted when Keep3rJobFundableCredits#addTokenCreditsToJob is called\n /// @param _job The address of the job being credited\n /// @param _token The address of the token being provided\n /// @param _provider The user that calls the function\n /// @param _amount The amount of credit being added to the job\n event TokenCreditAddition(address indexed _job, address indexed _token, address indexed _provider, uint256 _amount);\n\n /// @notice Emitted when Keep3rJobFundableCredits#withdrawTokenCreditsFromJob is called\n /// @param _job The address of the job from which the credits are withdrawn\n /// @param _token The credit being withdrawn from the job\n /// @param _receiver The user that receives the tokens\n /// @param _amount The amount of credit withdrawn\n event TokenCreditWithdrawal(address indexed _job, address indexed _token, address indexed _receiver, uint256 _amount);\n\n // Errors\n\n /// @notice Throws when the token is KP3R, as it should not be used for direct token payments\n error TokenUnallowed();\n\n /// @notice Throws when the token withdraw cooldown has not yet passed\n error JobTokenCreditsLocked();\n\n /// @notice Throws when the user tries to withdraw more tokens than it has\n error InsufficientJobTokenCredits();\n\n // Variables\n\n /// @notice Last block where tokens were added to the job\n /// @param _job The address of the job credited\n /// @param _token The address of the token credited\n /// @return _timestamp The last block where tokens were added to the job\n function jobTokenCreditsAddedAt(address _job, address _token) external view returns (uint256 _timestamp);\n\n // Methods\n\n /// @notice Add credit to a job to be paid out for work\n /// @param _job The address of the job being credited\n /// @param _token The address of the token being credited\n /// @param _amount The amount of credit being added\n function addTokenCreditsToJob(\n address _job,\n address _token,\n uint256 _amount\n ) external;\n\n /// @notice Withdraw credit from a job\n /// @param _job The address of the job from which the credits are withdrawn\n /// @param _token The address of the token being withdrawn\n /// @param _amount The amount of token to be withdrawn\n /// @param _receiver The user that will receive tokens\n function withdrawTokenCreditsFromJob(\n address _job,\n address _token,\n uint256 _amount,\n address _receiver\n ) external;\n}\n\n/// @title Keep3rJobFundableLiquidity contract\n/// @notice Handles the funding of jobs through specific liquidity pairs\ninterface IKeep3rJobFundableLiquidity is IKeep3rJobOwnership {\n // Events\n\n /// @notice Emitted when Keep3rJobFundableLiquidity#approveLiquidity function is called\n /// @param _liquidity The address of the liquidity pair being approved\n event LiquidityApproval(address _liquidity);\n\n /// @notice Emitted when Keep3rJobFundableLiquidity#revokeLiquidity function is called\n /// @param _liquidity The address of the liquidity pair being revoked\n event LiquidityRevocation(address _liquidity);\n\n /// @notice Emitted when IKeep3rJobFundableLiquidity#addLiquidityToJob function is called\n /// @param _job The address of the job to which liquidity will be added\n /// @param _liquidity The address of the liquidity being added\n /// @param _provider The user that calls the function\n /// @param _amount The amount of liquidity being added\n event LiquidityAddition(address indexed _job, address indexed _liquidity, address indexed _provider, uint256 _amount);\n\n /// @notice Emitted when IKeep3rJobFundableLiquidity#withdrawLiquidityFromJob function is called\n /// @param _job The address of the job of which liquidity will be withdrawn from\n /// @param _liquidity The address of the liquidity being withdrawn\n /// @param _receiver The receiver of the liquidity tokens\n /// @param _amount The amount of liquidity being withdrawn from the job\n event LiquidityWithdrawal(address indexed _job, address indexed _liquidity, address indexed _receiver, uint256 _amount);\n\n /// @notice Emitted when Keep3rJobFundableLiquidity#addLiquidityToJob function is called\n /// @param _job The address of the job whose credits will be updated\n /// @param _rewardedAt The time at which the job was last rewarded\n /// @param _currentCredits The current credits of the job\n /// @param _periodCredits The credits of the job for the current period\n event LiquidityCreditsReward(address indexed _job, uint256 _rewardedAt, uint256 _currentCredits, uint256 _periodCredits);\n\n /// @notice Emitted when Keep3rJobFundableLiquidity#forceLiquidityCreditsToJob function is called\n /// @param _job The address of the job whose credits will be updated\n /// @param _rewardedAt The time at which the job was last rewarded\n /// @param _currentCredits The current credits of the job\n event LiquidityCreditsForced(address indexed _job, uint256 _rewardedAt, uint256 _currentCredits);\n\n // Errors\n\n /// @notice Throws when the liquidity being approved has already been approved\n error LiquidityPairApproved();\n\n /// @notice Throws when the liquidity being removed has not been approved\n error LiquidityPairUnexistent();\n\n /// @notice Throws when trying to add liquidity to an unapproved pool\n error LiquidityPairUnapproved();\n\n /// @notice Throws when the job doesn't have the requested liquidity\n error JobLiquidityUnexistent();\n\n /// @notice Throws when trying to remove more liquidity than the job has\n error JobLiquidityInsufficient();\n\n /// @notice Throws when trying to add less liquidity than the minimum liquidity required\n error JobLiquidityLessThanMin();\n\n // Structs\n\n /// @notice Stores the tick information of the different liquidity pairs\n struct TickCache {\n int56 current; // Tracks the current tick\n int56 difference; // Stores the difference between the current tick and the last tick\n uint256 period; // Stores the period at which the last observation was made\n }\n\n // Variables\n\n /// @notice Lists liquidity pairs\n /// @return _list An array of addresses with all the approved liquidity pairs\n function approvedLiquidities() external view returns (address[] memory _list);\n\n /// @notice Amount of liquidity in a specified job\n /// @param _job The address of the job being checked\n /// @param _liquidity The address of the liquidity we are checking\n /// @return _amount Amount of liquidity in the specified job\n function liquidityAmount(address _job, address _liquidity) external view returns (uint256 _amount);\n\n /// @notice Last time the job was rewarded liquidity credits\n /// @param _job The address of the job being checked\n /// @return _timestamp Timestamp of the last time the job was rewarded liquidity credits\n function rewardedAt(address _job) external view returns (uint256 _timestamp);\n\n /// @notice Last time the job was worked\n /// @param _job The address of the job being checked\n /// @return _timestamp Timestamp of the last time the job was worked\n function workedAt(address _job) external view returns (uint256 _timestamp);\n\n // Methods\n\n /// @notice Returns the liquidity credits of a given job\n /// @param _job The address of the job of which we want to know the liquidity credits\n /// @return _amount The liquidity credits of a given job\n function jobLiquidityCredits(address _job) external view returns (uint256 _amount);\n\n /// @notice Returns the credits of a given job for the current period\n /// @param _job The address of the job of which we want to know the period credits\n /// @return _amount The credits the given job has at the current period\n function jobPeriodCredits(address _job) external view returns (uint256 _amount);\n\n /// @notice Calculates the total credits of a given job\n /// @param _job The address of the job of which we want to know the total credits\n /// @return _amount The total credits of the given job\n function totalJobCredits(address _job) external view returns (uint256 _amount);\n\n /// @notice Calculates how many credits should be rewarded periodically for a given liquidity amount\n /// @dev _periodCredits = underlying KP3Rs for given liquidity amount * rewardPeriod / inflationPeriod\n /// @param _liquidity The address of the liquidity to provide\n /// @param _amount The amount of liquidity to provide\n /// @return _periodCredits The amount of KP3R periodically minted for the given liquidity\n function quoteLiquidity(address _liquidity, uint256 _amount) external view returns (uint256 _periodCredits);\n\n /// @notice Observes the current state of the liquidity pair being observed and updates TickCache with the information\n /// @param _liquidity The address of the liquidity pair being observed\n /// @return _tickCache The updated TickCache\n function observeLiquidity(address _liquidity) external view returns (TickCache memory _tickCache);\n\n /// @notice Gifts liquidity credits to the specified job\n /// @param _job The address of the job being credited\n /// @param _amount The amount of liquidity credits to gift\n function forceLiquidityCreditsToJob(address _job, uint256 _amount) external;\n\n /// @notice Approve a liquidity pair for being accepted in future\n /// @param _liquidity The address of the liquidity accepted\n function approveLiquidity(address _liquidity) external;\n\n /// @notice Revoke a liquidity pair from being accepted in future\n /// @param _liquidity The liquidity no longer accepted\n function revokeLiquidity(address _liquidity) external;\n\n /// @notice Allows anyone to fund a job with liquidity\n /// @param _job The address of the job to assign liquidity to\n /// @param _liquidity The liquidity being added\n /// @param _amount The amount of liquidity tokens to add\n function addLiquidityToJob(\n address _job,\n address _liquidity,\n uint256 _amount\n ) external;\n\n /// @notice Unbond liquidity for a job\n /// @dev Can only be called by the job's owner\n /// @param _job The address of the job being unbonded from\n /// @param _liquidity The liquidity being unbonded\n /// @param _amount The amount of liquidity being removed\n function unbondLiquidityFromJob(\n address _job,\n address _liquidity,\n uint256 _amount\n ) external;\n\n /// @notice Withdraw liquidity from a job\n /// @param _job The address of the job being withdrawn from\n /// @param _liquidity The liquidity being withdrawn\n /// @param _receiver The address that will receive the withdrawn liquidity\n function withdrawLiquidityFromJob(\n address _job,\n address _liquidity,\n address _receiver\n ) external;\n}\n\n/// @title Keep3rJobMigration contract\n/// @notice Handles the migration process of jobs to different addresses\ninterface IKeep3rJobMigration is IKeep3rJobFundableCredits, IKeep3rJobFundableLiquidity {\n // Events\n\n /// @notice Emitted when Keep3rJobMigration#migrateJob function is called\n /// @param _fromJob The address of the job that requests to migrate\n /// @param _toJob The address at which the job requests to migrate\n event JobMigrationRequested(address indexed _fromJob, address _toJob);\n\n /// @notice Emitted when Keep3rJobMigration#acceptJobMigration function is called\n /// @param _fromJob The address of the job that requested to migrate\n /// @param _toJob The address at which the job had requested to migrate\n event JobMigrationSuccessful(address _fromJob, address indexed _toJob);\n\n // Errors\n\n /// @notice Throws when the address of the job that requests to migrate wants to migrate to its same address\n error JobMigrationImpossible();\n\n /// @notice Throws when the _toJob address differs from the address being tracked in the pendingJobMigrations mapping\n error JobMigrationUnavailable();\n\n /// @notice Throws when cooldown between migrations has not yet passed\n error JobMigrationLocked();\n\n // Variables\n\n /// @notice Maps the jobs that have requested a migration to the address they have requested to migrate to\n /// @return _toJob The address to which the job has requested to migrate to\n function pendingJobMigrations(address _fromJob) external view returns (address _toJob);\n\n // Methods\n\n /// @notice Initializes the migration process for a job by adding the request to the pendingJobMigrations mapping\n /// @param _fromJob The address of the job that is requesting to migrate\n /// @param _toJob The address at which the job is requesting to migrate\n function migrateJob(address _fromJob, address _toJob) external;\n\n /// @notice Completes the migration process for a job\n /// @dev Unbond/withdraw process doesn't get migrated\n /// @param _fromJob The address of the job that requested to migrate\n /// @param _toJob The address to which the job wants to migrate to\n function acceptJobMigration(address _fromJob, address _toJob) external;\n}\n\n/// @title Keep3rJobWorkable contract\n/// @notice Handles the mechanisms jobs can pay keepers with along with the restrictions jobs can put on keepers before they can work on jobs\ninterface IKeep3rJobWorkable is IKeep3rJobMigration {\n // Events\n\n /// @notice Emitted when a keeper is validated before a job\n /// @param _gasLeft The amount of gas that the transaction has left at the moment of keeper validation\n event KeeperValidation(uint256 _gasLeft);\n\n /// @notice Emitted when a keeper works a job\n /// @param _credit The address of the asset in which the keeper is paid\n /// @param _job The address of the job the keeper has worked\n /// @param _keeper The address of the keeper that has worked the job\n /// @param _payment The amount that has been paid out to the keeper in exchange for working the job\n /// @param _gasLeft The amount of gas that the transaction has left at the moment of payment\n event KeeperWork(address indexed _credit, address indexed _job, address indexed _keeper, uint256 _payment, uint256 _gasLeft);\n\n // Errors\n\n /// @notice Throws if work method was called without calling isKeeper or isBondedKeeper\n error GasNotInitialized();\n\n /// @notice Throws if the address claiming to be a job is not in the list of approved jobs\n error JobUnapproved();\n\n /// @notice Throws if the amount of funds in the job is less than the payment that must be paid to the keeper that works that job\n error InsufficientFunds();\n\n // Methods\n\n /// @notice Confirms if the current keeper is registered\n /// @dev Can be used for general (non critical) functions\n /// @param _keeper The keeper being investigated\n /// @return _isKeeper Whether the address passed as a parameter is a keeper or not\n function isKeeper(address _keeper) external returns (bool _isKeeper);\n\n /// @notice Confirms if the current keeper is registered and has a minimum bond of any asset.\n /// @dev Should be used for protected functions\n /// @param _keeper The keeper to check\n /// @param _bond The bond token being evaluated\n /// @param _minBond The minimum amount of bonded tokens\n /// @param _earned The minimum funds earned in the keepers lifetime\n /// @param _age The minimum keeper age required\n /// @return _isBondedKeeper Whether the `_keeper` meets the given requirements\n function isBondedKeeper(\n address _keeper,\n address _bond,\n uint256 _minBond,\n uint256 _earned,\n uint256 _age\n ) external returns (bool _isBondedKeeper);\n\n /// @notice Implemented by jobs to show that a keeper performed work\n /// @dev Automatically calculates the payment for the keeper and pays the keeper with bonded KP3R\n /// @param _keeper Address of the keeper that performed the work\n function worked(address _keeper) external;\n\n /// @notice Implemented by jobs to show that a keeper performed work\n /// @dev Pays the keeper that performs the work with KP3R\n /// @param _keeper Address of the keeper that performed the work\n /// @param _payment The reward that should be allocated for the job\n function bondedPayment(address _keeper, uint256 _payment) external;\n\n /// @notice Implemented by jobs to show that a keeper performed work\n /// @dev Pays the keeper that performs the work with a specific token\n /// @param _token The asset being awarded to the keeper\n /// @param _keeper Address of the keeper that performed the work\n /// @param _amount The reward that should be allocated\n function directTokenPayment(\n address _token,\n address _keeper,\n uint256 _amount\n ) external;\n}\n\n/// @title Keep3rJobDisputable contract\n/// @notice Handles the actions that can be taken on a disputed job\ninterface IKeep3rJobDisputable is IKeep3rDisputable, IKeep3rJobFundableCredits, IKeep3rJobFundableLiquidity {\n // Events\n\n /// @notice Emitted when Keep3rJobDisputable#slashTokenFromJob is called\n /// @param _job The address of the job from which the token will be slashed\n /// @param _token The address of the token being slashed\n /// @param _slasher The user that slashes the token\n /// @param _amount The amount of the token being slashed\n event JobSlashToken(address indexed _job, address _token, address indexed _slasher, uint256 _amount);\n\n /// @notice Emitted when Keep3rJobDisputable#slashLiquidityFromJob is called\n /// @param _job The address of the job from which the liquidity will be slashed\n /// @param _liquidity The address of the liquidity being slashed\n /// @param _slasher The user that slashes the liquidity\n /// @param _amount The amount of the liquidity being slashed\n event JobSlashLiquidity(address indexed _job, address _liquidity, address indexed _slasher, uint256 _amount);\n\n // Errors\n\n /// @notice Throws when the token trying to be slashed doesn't exist\n error JobTokenUnexistent();\n\n /// @notice Throws when someone tries to slash more tokens than the job has\n error JobTokenInsufficient();\n\n // Methods\n\n /// @notice Allows governor or slasher to slash a job specific token\n /// @param _job The address of the job from which the token will be slashed\n /// @param _token The address of the token that will be slashed\n /// @param _amount The amount of the token that will be slashed\n function slashTokenFromJob(\n address _job,\n address _token,\n uint256 _amount\n ) external;\n\n /// @notice Allows governor or slasher to slash liquidity from a job\n /// @param _job The address being slashed\n /// @param _liquidity The address of the liquidity that will be slashed\n /// @param _amount The amount of liquidity that will be slashed\n function slashLiquidityFromJob(\n address _job,\n address _liquidity,\n uint256 _amount\n ) external;\n}\n\n// solhint-disable-next-line no-empty-blocks\ninterface IKeep3rJobs is IKeep3rJobWorkable, IKeep3rJobManager, IKeep3rJobDisputable {\n\n}\n" - }, - "solidity/interfaces/peripherals/IKeep3rKeepers.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport './IKeep3rDisputable.sol';\n\n/// @title Keep3rKeeperFundable contract\n/// @notice Handles the actions required to become a keeper\ninterface IKeep3rKeeperFundable {\n // Events\n\n /// @notice Emitted when Keep3rKeeperFundable#activate is called\n /// @param _keeper The keeper that has been activated\n /// @param _bond The asset the keeper has bonded\n /// @param _amount The amount of the asset the keeper has bonded\n event Activation(address indexed _keeper, address indexed _bond, uint256 _amount);\n\n /// @notice Emitted when Keep3rKeeperFundable#withdraw is called\n /// @param _keeper The caller of Keep3rKeeperFundable#withdraw function\n /// @param _bond The asset to withdraw from the bonding pool\n /// @param _amount The amount of funds withdrawn\n event Withdrawal(address indexed _keeper, address indexed _bond, uint256 _amount);\n\n // Errors\n\n /// @notice Throws when the address that is trying to register as a job is already a job\n error AlreadyAJob();\n\n // Methods\n\n /// @notice Beginning of the bonding process\n /// @param _bonding The asset being bonded\n /// @param _amount The amount of bonding asset being bonded\n function bond(address _bonding, uint256 _amount) external;\n\n /// @notice Beginning of the unbonding process\n /// @param _bonding The asset being unbonded\n /// @param _amount Allows for partial unbonding\n function unbond(address _bonding, uint256 _amount) external;\n\n /// @notice End of the bonding process after bonding time has passed\n /// @param _bonding The asset being activated as bond collateral\n function activate(address _bonding) external;\n\n /// @notice Withdraw funds after unbonding has finished\n /// @param _bonding The asset to withdraw from the bonding pool\n function withdraw(address _bonding) external;\n}\n\n/// @title Keep3rKeeperDisputable contract\n/// @notice Handles the actions that can be taken on a disputed keeper\ninterface IKeep3rKeeperDisputable is IKeep3rDisputable, IKeep3rKeeperFundable {\n // Events\n\n /// @notice Emitted when Keep3rKeeperDisputable#slash is called\n /// @param _keeper The address of the slashed keeper\n /// @param _slasher The user that called Keep3rKeeperDisputable#slash\n /// @param _amount The amount of credits slashed from the keeper\n event KeeperSlash(address indexed _keeper, address indexed _slasher, uint256 _amount);\n\n /// @notice Emitted when Keep3rKeeperDisputable#revoke is called\n /// @param _keeper The address of the revoked keeper\n /// @param _slasher The user that called Keep3rKeeperDisputable#revoke\n event KeeperRevoke(address indexed _keeper, address indexed _slasher);\n\n // Methods\n\n /// @notice Allows governor to slash a keeper based on a dispute\n /// @param _keeper The address being slashed\n /// @param _bonded The asset being slashed\n /// @param _bondAmount The bonded amount being slashed\n /// @param _unbondAmount The pending unbond amount being slashed\n function slash(\n address _keeper,\n address _bonded,\n uint256 _bondAmount,\n uint256 _unbondAmount\n ) external;\n\n /// @notice Blacklists a keeper from participating in the network\n /// @param _keeper The address being slashed\n function revoke(address _keeper) external;\n}\n\n// solhint-disable-next-line no-empty-blocks\n\n/// @title Keep3rKeepers contract\ninterface IKeep3rKeepers is IKeep3rKeeperDisputable {\n\n}\n" - }, - "solidity/interfaces/peripherals/IKeep3rParameters.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport './IKeep3rAccountance.sol';\n\n/// @title Keep3rParameters contract\n/// @notice Handles and sets all the required parameters for Keep3r\ninterface IKeep3rParameters is IKeep3rAccountance {\n // Events\n\n /// @notice Emitted when the Keep3rHelper address is changed\n /// @param _keep3rHelper The address of Keep3rHelper's contract\n event Keep3rHelperChange(address _keep3rHelper);\n\n /// @notice Emitted when the Keep3rV1 address is changed\n /// @param _keep3rV1 The address of Keep3rV1's contract\n event Keep3rV1Change(address _keep3rV1);\n\n /// @notice Emitted when the Keep3rV1Proxy address is changed\n /// @param _keep3rV1Proxy The address of Keep3rV1Proxy's contract\n event Keep3rV1ProxyChange(address _keep3rV1Proxy);\n\n /// @notice Emitted when bondTime is changed\n /// @param _bondTime The new bondTime\n event BondTimeChange(uint256 _bondTime);\n\n /// @notice Emitted when _liquidityMinimum is changed\n /// @param _liquidityMinimum The new _liquidityMinimum\n event LiquidityMinimumChange(uint256 _liquidityMinimum);\n\n /// @notice Emitted when _unbondTime is changed\n /// @param _unbondTime The new _unbondTime\n event UnbondTimeChange(uint256 _unbondTime);\n\n /// @notice Emitted when _rewardPeriodTime is changed\n /// @param _rewardPeriodTime The new _rewardPeriodTime\n event RewardPeriodTimeChange(uint256 _rewardPeriodTime);\n\n /// @notice Emitted when the inflationPeriod is changed\n /// @param _inflationPeriod The new inflationPeriod\n event InflationPeriodChange(uint256 _inflationPeriod);\n\n /// @notice Emitted when the fee is changed\n /// @param _fee The new token credits fee\n event FeeChange(uint256 _fee);\n\n // Variables\n\n /// @notice Address of Keep3rHelper's contract\n /// @return _keep3rHelper The address of Keep3rHelper's contract\n function keep3rHelper() external view returns (address _keep3rHelper);\n\n /// @notice Address of Keep3rV1's contract\n /// @return _keep3rV1 The address of Keep3rV1's contract\n function keep3rV1() external view returns (address _keep3rV1);\n\n /// @notice Address of Keep3rV1Proxy's contract\n /// @return _keep3rV1Proxy The address of Keep3rV1Proxy's contract\n function keep3rV1Proxy() external view returns (address _keep3rV1Proxy);\n\n /// @notice The amount of time required to pass after a keeper has bonded assets for it to be able to activate\n /// @return _days The required bondTime in days\n function bondTime() external view returns (uint256 _days);\n\n /// @notice The amount of time required to pass before a keeper can unbond what he has bonded\n /// @return _days The required unbondTime in days\n function unbondTime() external view returns (uint256 _days);\n\n /// @notice The minimum amount of liquidity required to fund a job per liquidity\n /// @return _amount The minimum amount of liquidity in KP3R\n function liquidityMinimum() external view returns (uint256 _amount);\n\n /// @notice The amount of time between each scheduled credits reward given to a job\n /// @return _days The reward period in days\n function rewardPeriodTime() external view returns (uint256 _days);\n\n /// @notice The inflation period is the denominator used to regulate the emission of KP3R\n /// @return _period The denominator used to regulate the emission of KP3R\n function inflationPeriod() external view returns (uint256 _period);\n\n /// @notice The fee to be sent to governor when a user adds liquidity to a job\n /// @return _amount The fee amount to be sent to governor when a user adds liquidity to a job\n function fee() external view returns (uint256 _amount);\n\n // Errors\n\n /// @notice Throws if the reward period is less than the minimum reward period time\n error MinRewardPeriod();\n\n /// @notice Throws if either a job or a keeper is disputed\n error Disputed();\n\n /// @notice Throws if there are no bonded assets\n error BondsUnexistent();\n\n /// @notice Throws if the time required to bond an asset has not passed yet\n error BondsLocked();\n\n /// @notice Throws if there are no bonds to withdraw\n error UnbondsUnexistent();\n\n /// @notice Throws if the time required to withdraw the bonds has not passed yet\n error UnbondsLocked();\n\n // Methods\n\n /// @notice Sets the Keep3rHelper address\n /// @param _keep3rHelper The Keep3rHelper address\n function setKeep3rHelper(address _keep3rHelper) external;\n\n /// @notice Sets the Keep3rV1 address\n /// @param _keep3rV1 The Keep3rV1 address\n function setKeep3rV1(address _keep3rV1) external;\n\n /// @notice Sets the Keep3rV1Proxy address\n /// @param _keep3rV1Proxy The Keep3rV1Proxy address\n function setKeep3rV1Proxy(address _keep3rV1Proxy) external;\n\n /// @notice Sets the bond time required to activate as a keeper\n /// @param _bond The new bond time\n function setBondTime(uint256 _bond) external;\n\n /// @notice Sets the unbond time required unbond what has been bonded\n /// @param _unbond The new unbond time\n function setUnbondTime(uint256 _unbond) external;\n\n /// @notice Sets the minimum amount of liquidity required to fund a job\n /// @param _liquidityMinimum The new minimum amount of liquidity\n function setLiquidityMinimum(uint256 _liquidityMinimum) external;\n\n /// @notice Sets the time required to pass between rewards for jobs\n /// @param _rewardPeriodTime The new amount of time required to pass between rewards\n function setRewardPeriodTime(uint256 _rewardPeriodTime) external;\n\n /// @notice Sets the new inflation period\n /// @param _inflationPeriod The new inflation period\n function setInflationPeriod(uint256 _inflationPeriod) external;\n\n /// @notice Sets the new fee\n /// @param _fee The new fee\n function setFee(uint256 _fee) external;\n}\n" - }, - "solidity/interfaces/peripherals/IKeep3rDisputable.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\n/// @title Keep3rDisputable contract\n/// @notice Creates/resolves disputes for jobs or keepers\n/// A disputed keeper is slashable and is not able to bond, activate, withdraw or receive direct payments\n/// A disputed job is slashable and is not able to pay the keepers, withdraw tokens or to migrate\ninterface IKeep3rDisputable {\n /// @notice Emitted when a keeper or a job is disputed\n /// @param _jobOrKeeper The address of the disputed keeper/job\n /// @param _disputer The user that called the function and disputed the keeper\n event Dispute(address indexed _jobOrKeeper, address indexed _disputer);\n\n /// @notice Emitted when a dispute is resolved\n /// @param _jobOrKeeper The address of the disputed keeper/job\n /// @param _resolver The user that called the function and resolved the dispute\n event Resolve(address indexed _jobOrKeeper, address indexed _resolver);\n\n /// @notice Throws when a job or keeper is already disputed\n error AlreadyDisputed();\n\n /// @notice Throws when a job or keeper is not disputed and someone tries to resolve the dispute\n error NotDisputed();\n\n /// @notice Allows governor to create a dispute for a given keeper/job\n /// @param _jobOrKeeper The address in dispute\n function dispute(address _jobOrKeeper) external;\n\n /// @notice Allows governor to resolve a dispute on a keeper/job\n /// @param _jobOrKeeper The address cleared\n function resolve(address _jobOrKeeper) external;\n}\n" - }, - "solidity/interfaces/peripherals/IKeep3rAccountance.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport './IKeep3rRoles.sol';\n\n/// @title Keep3rDisputable contract\n/// @notice Disputes keepers, or if they're already disputed, it can resolve the case\n/// @dev Argument `bonding` can be the address of either a token or a liquidity\ninterface IKeep3rAccountance is IKeep3rRoles {\n // Events\n\n /// @notice Emitted when the bonding process of a new keeper begins\n /// @param _keeper The caller of Keep3rKeeperFundable#bond function\n /// @param _bonding The asset the keeper has bonded\n /// @param _amount The amount the keeper has bonded\n event Bonding(address indexed _keeper, address indexed _bonding, uint256 _amount);\n\n /// @notice Emitted when a keeper or job begins the unbonding process to withdraw the funds\n /// @param _keeperOrJob The keeper or job that began the unbonding process\n /// @param _unbonding The liquidity pair or asset being unbonded\n /// @param _amount The amount being unbonded\n event Unbonding(address indexed _keeperOrJob, address indexed _unbonding, uint256 _amount);\n\n // Variables\n\n /// @notice Tracks the total amount of bonded KP3Rs in the contract\n /// @return _totalBonds The total amount of bonded KP3Rs in the contract\n function totalBonds() external view returns (uint256 _totalBonds);\n\n /// @notice Tracks the total KP3R earnings of a keeper since it started working\n /// @param _keeper The address of the keeper\n /// @return _workCompleted Total KP3R earnings of a keeper since it started working\n function workCompleted(address _keeper) external view returns (uint256 _workCompleted);\n\n /// @notice Tracks when a keeper was first registered\n /// @param _keeper The address of the keeper\n /// @return timestamp The time at which the keeper was first registered\n function firstSeen(address _keeper) external view returns (uint256 timestamp);\n\n /// @notice Tracks if a keeper or job has a pending dispute\n /// @param _keeperOrJob The address of the keeper or job\n /// @return _disputed Whether a keeper or job has a pending dispute\n function disputes(address _keeperOrJob) external view returns (bool _disputed);\n\n /// @notice Tracks how much a keeper has bonded of a certain token\n /// @param _keeper The address of the keeper\n /// @param _bond The address of the token being bonded\n /// @return _bonds Amount of a certain token that a keeper has bonded\n function bonds(address _keeper, address _bond) external view returns (uint256 _bonds);\n\n /// @notice The current token credits available for a job\n /// @param _job The address of the job\n /// @param _token The address of the token bonded\n /// @return _amount The amount of token credits available for a job\n function jobTokenCredits(address _job, address _token) external view returns (uint256 _amount);\n\n /// @notice Tracks the amount of assets deposited in pending bonds\n /// @param _keeper The address of the keeper\n /// @param _bonding The address of the token being bonded\n /// @return _pendingBonds Amount of a certain asset a keeper has unbonding\n function pendingBonds(address _keeper, address _bonding) external view returns (uint256 _pendingBonds);\n\n /// @notice Tracks when a bonding for a keeper can be activated\n /// @param _keeper The address of the keeper\n /// @param _bonding The address of the token being bonded\n /// @return _timestamp Time at which the bonding for a keeper can be activated\n function canActivateAfter(address _keeper, address _bonding) external view returns (uint256 _timestamp);\n\n /// @notice Tracks when keeper bonds are ready to be withdrawn\n /// @param _keeper The address of the keeper\n /// @param _bonding The address of the token being unbonded\n /// @return _timestamp Time at which the keeper bonds are ready to be withdrawn\n function canWithdrawAfter(address _keeper, address _bonding) external view returns (uint256 _timestamp);\n\n /// @notice Tracks how much keeper bonds are to be withdrawn\n /// @param _keeper The address of the keeper\n /// @param _bonding The address of the token being unbonded\n /// @return _pendingUnbonds The amount of keeper bonds that are to be withdrawn\n function pendingUnbonds(address _keeper, address _bonding) external view returns (uint256 _pendingUnbonds);\n\n /// @notice Checks whether the address has ever bonded an asset\n /// @param _keeper The address of the keeper\n /// @return _hasBonded Whether the address has ever bonded an asset\n function hasBonded(address _keeper) external view returns (bool _hasBonded);\n\n // Methods\n\n /// @notice Lists all jobs\n /// @return _jobList Array with all the jobs in _jobs\n function jobs() external view returns (address[] memory _jobList);\n\n /// @notice Lists all keepers\n /// @return _keeperList Array with all the keepers in _keepers\n function keepers() external view returns (address[] memory _keeperList);\n\n // Errors\n\n /// @notice Throws when an address is passed as a job, but that address is not a job\n error JobUnavailable();\n\n /// @notice Throws when an action that requires an undisputed job is applied on a disputed job\n error JobDisputed();\n}\n" - }, - "solidity/interfaces/peripherals/IKeep3rRoles.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '@defi-wonderland/solidity-utils/solidity/interfaces/IBaseErrors.sol';\nimport '@defi-wonderland/solidity-utils/solidity/interfaces/IGovernable.sol';\nimport '@defi-wonderland/solidity-utils/solidity/interfaces/IDustCollector.sol';\n\n/// @title Keep3rRoles contract\n/// @notice Manages the Keep3r specific roles\ninterface IKeep3rRoles is IBaseErrors, IGovernable, IDustCollector {\n // Events\n\n /// @notice Emitted when a slasher is added\n /// @param _slasher Address of the added slasher\n event SlasherAdded(address _slasher);\n\n /// @notice Emitted when a slasher is removed\n /// @param _slasher Address of the removed slasher\n event SlasherRemoved(address _slasher);\n\n /// @notice Emitted when a disputer is added\n /// @param _disputer Address of the added disputer\n event DisputerAdded(address _disputer);\n\n /// @notice Emitted when a disputer is removed\n /// @param _disputer Address of the removed disputer\n event DisputerRemoved(address _disputer);\n\n // Variables\n\n /// @notice Tracks whether the address is a slasher or not\n /// @param _slasher Address being checked as a slasher\n /// @return _isSlasher Whether the address is a slasher or not\n function slashers(address _slasher) external view returns (bool _isSlasher);\n\n /// @notice Tracks whether the address is a disputer or not\n /// @param _disputer Address being checked as a disputer\n /// @return _isDisputer Whether the address is a disputer or not\n function disputers(address _disputer) external view returns (bool _isDisputer);\n\n // Errors\n\n /// @notice Throws if the address is already a registered slasher\n error SlasherExistent();\n\n /// @notice Throws if caller is not a registered slasher\n error SlasherUnexistent();\n\n /// @notice Throws if the address is already a registered disputer\n error DisputerExistent();\n\n /// @notice Throws if caller is not a registered disputer\n error DisputerUnexistent();\n\n /// @notice Throws if the msg.sender is not a slasher or is not a part of governance\n error OnlySlasher();\n\n /// @notice Throws if the msg.sender is not a disputer or is not a part of governance\n error OnlyDisputer();\n\n // Methods\n\n /// @notice Registers a slasher by updating the slashers mapping\n function addSlasher(address _slasher) external;\n\n /// @notice Removes a slasher by updating the slashers mapping\n function removeSlasher(address _slasher) external;\n\n /// @notice Registers a disputer by updating the disputers mapping\n function addDisputer(address _disputer) external;\n\n /// @notice Removes a disputer by updating the disputers mapping\n function removeDisputer(address _disputer) external;\n}\n" - }, - "@defi-wonderland/solidity-utils/solidity/interfaces/IBaseErrors.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.8 <0.9.0;\n\ninterface IBaseErrors {\n /// @notice Thrown if an address is invalid\n error InvalidAddress();\n\n /// @notice Thrown if an amount is invalid\n error InvalidAmount();\n\n /// @notice Thrown if the lengths of a set of lists mismatch\n error LengthMismatch();\n\n /// @notice Thrown if an address is the zero address\n error ZeroAddress();\n\n /// @notice Thrown if an amount is zero\n error ZeroAmount();\n}\n" - }, - "@defi-wonderland/solidity-utils/solidity/interfaces/IGovernable.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.8 <0.9.0;\n\nimport {IBaseErrors} from './IBaseErrors.sol';\n\n/// @title Governable interface\ninterface IGovernable is IBaseErrors {\n // STATE VARIABLES\n\n /// @return _governor Address of the current governor\n function governor() external view returns (address _governor);\n\n /// @return _pendingGovernor Address of the current pending governor\n function pendingGovernor() external view returns (address _pendingGovernor);\n\n // EVENTS\n\n /// @notice Emitted when a new pending governor is set\n /// @param _governor Address of the current governor\n /// @param _pendingGovernor Address of the proposed next governor\n event PendingGovernorSet(address _governor, address _pendingGovernor);\n\n /// @notice Emitted when a new governor is set\n /// @param _newGovernor Address of the new governor\n event PendingGovernorAccepted(address _newGovernor);\n\n // ERRORS\n\n /// @notice Thrown if a non-governor user tries to call a OnlyGovernor function\n error OnlyGovernor();\n\n /// @notice Thrown if a non-pending-governor user tries to call a OnlyPendingGovernor function\n error OnlyPendingGovernor();\n\n // FUNCTIONS\n\n /// @notice Allows a governor to propose a new governor\n /// @param _pendingGovernor Address of the proposed new governor\n function setPendingGovernor(address _pendingGovernor) external;\n\n /// @notice Allows a proposed governor to accept the governance\n function acceptPendingGovernor() external;\n}\n" - }, - "@defi-wonderland/solidity-utils/solidity/interfaces/IDustCollector.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.8 <0.9.0;\n\nimport {IGovernable} from './IGovernable.sol';\nimport {IBaseErrors} from './IBaseErrors.sol';\n\n/// @title DustCollector interface\ninterface IDustCollector is IBaseErrors, IGovernable {\n // STATE VARIABLES\n\n /// @return _ethAddress Address used to trigger a native token transfer\n // solhint-disable-next-line func-name-mixedcase\n function ETH_ADDRESS() external view returns (address _ethAddress);\n\n // EVENTS\n\n /// @notice Emitted when dust is sent\n /// @param _to The address which wil received the funds\n /// @param _token The token that will be transferred\n /// @param _amount The amount of the token that will be transferred\n event DustSent(address _token, uint256 _amount, address _to);\n\n // FUNCTIONS\n\n /// @notice Allows an authorized user to transfer the tokens or eth that may have been left in a contract\n /// @param _token The token that will be transferred\n /// @param _amount The amont of the token that will be transferred\n /// @param _to The address that will receive the idle funds\n function sendDust(address _token, uint256 _amount, address _to) external;\n}\n" - }, - "solidity/contracts/peripherals/jobs/Keep3rJobManager.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport './Keep3rJobOwnership.sol';\nimport '../Keep3rAccountance.sol';\nimport '../../../interfaces/peripherals/IKeep3rJobs.sol';\n\nabstract contract Keep3rJobManager is IKeep3rJobManager, Keep3rJobOwnership, Keep3rAccountance {\n using EnumerableSet for EnumerableSet.AddressSet;\n\n /// @inheritdoc IKeep3rJobManager\n function addJob(address _job) external override {\n if (_jobs.contains(_job)) revert JobAlreadyAdded();\n if (hasBonded[_job]) revert AlreadyAKeeper();\n _jobs.add(_job);\n jobOwner[_job] = msg.sender;\n emit JobAddition(_job, msg.sender);\n }\n}\n" - }, - "solidity/contracts/peripherals/jobs/Keep3rJobWorkable.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport './Keep3rJobMigration.sol';\nimport '../../../interfaces/IKeep3rHelper.sol';\nimport '../../../interfaces/peripherals/IKeep3rJobs.sol';\n\nimport '@openzeppelin/contracts/token/ERC20/IERC20.sol';\nimport '@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol';\n\nabstract contract Keep3rJobWorkable is IKeep3rJobWorkable, Keep3rJobMigration {\n using EnumerableSet for EnumerableSet.AddressSet;\n using SafeERC20 for IERC20;\n\n uint256 internal _initialGas;\n\n /// @inheritdoc IKeep3rJobWorkable\n function isKeeper(address _keeper) external override returns (bool _isKeeper) {\n _initialGas = _getGasLeft();\n if (_keepers.contains(_keeper)) {\n emit KeeperValidation(_initialGas);\n return true;\n }\n }\n\n /// @inheritdoc IKeep3rJobWorkable\n function isBondedKeeper(\n address _keeper,\n address _bond,\n uint256 _minBond,\n uint256 _earned,\n uint256 _age\n ) external override returns (bool _isBondedKeeper) {\n _initialGas = _getGasLeft();\n if (\n _keepers.contains(_keeper) &&\n bonds[_keeper][_bond] >= _minBond &&\n workCompleted[_keeper] >= _earned &&\n block.timestamp - firstSeen[_keeper] >= _age\n ) {\n emit KeeperValidation(_initialGas);\n return true;\n }\n }\n\n /// @inheritdoc IKeep3rJobWorkable\n function worked(address _keeper) external virtual override {\n if (_initialGas == 0) revert GasNotInitialized();\n address _job = msg.sender;\n if (disputes[_job]) revert JobDisputed();\n if (!_jobs.contains(_job)) revert JobUnapproved();\n\n if (_updateJobCreditsIfNeeded(_job)) {\n emit LiquidityCreditsReward(_job, rewardedAt[_job], _jobLiquidityCredits[_job], _jobPeriodCredits[_job]);\n }\n\n (uint256 _boost, uint256 _oneEthQuote, uint256 _extraGas) = IKeep3rHelper(keep3rHelper).getPaymentParams(bonds[_keeper][keep3rV1]);\n\n uint256 _gasLeft = _getGasLeft();\n uint256 _payment = _calculatePayment(_gasLeft, _extraGas, _oneEthQuote, _boost);\n\n if (_payment > _jobLiquidityCredits[_job]) {\n _rewardJobCredits(_job);\n emit LiquidityCreditsReward(_job, rewardedAt[_job], _jobLiquidityCredits[_job], _jobPeriodCredits[_job]);\n\n _gasLeft = _getGasLeft();\n _payment = _calculatePayment(_gasLeft, _extraGas, _oneEthQuote, _boost);\n }\n\n _bondedPayment(_job, _keeper, _payment);\n delete _initialGas;\n\n emit KeeperWork(keep3rV1, _job, _keeper, _payment, _gasLeft);\n }\n\n /// @inheritdoc IKeep3rJobWorkable\n function bondedPayment(address _keeper, uint256 _payment) external override {\n address _job = msg.sender;\n\n if (disputes[_job]) revert JobDisputed();\n if (!_jobs.contains(_job)) revert JobUnapproved();\n\n if (_updateJobCreditsIfNeeded(_job)) {\n emit LiquidityCreditsReward(_job, rewardedAt[_job], _jobLiquidityCredits[_job], _jobPeriodCredits[_job]);\n }\n\n if (_payment > _jobLiquidityCredits[_job]) {\n _rewardJobCredits(_job);\n emit LiquidityCreditsReward(_job, rewardedAt[_job], _jobLiquidityCredits[_job], _jobPeriodCredits[_job]);\n }\n\n _bondedPayment(_job, _keeper, _payment);\n emit KeeperWork(keep3rV1, _job, _keeper, _payment, _getGasLeft());\n }\n\n /// @inheritdoc IKeep3rJobWorkable\n function directTokenPayment(\n address _token,\n address _keeper,\n uint256 _amount\n ) external override {\n address _job = msg.sender;\n\n if (disputes[_job]) revert JobDisputed();\n if (disputes[_keeper]) revert Disputed();\n if (!_jobs.contains(_job)) revert JobUnapproved();\n if (jobTokenCredits[_job][_token] < _amount) revert InsufficientFunds();\n jobTokenCredits[_job][_token] -= _amount;\n IERC20(_token).safeTransfer(_keeper, _amount);\n emit KeeperWork(_token, _job, _keeper, _amount, _getGasLeft());\n }\n\n function _bondedPayment(\n address _job,\n address _keeper,\n uint256 _payment\n ) internal {\n if (_payment > _jobLiquidityCredits[_job]) revert InsufficientFunds();\n\n workedAt[_job] = block.timestamp;\n _jobLiquidityCredits[_job] -= _payment;\n bonds[_keeper][keep3rV1] += _payment;\n workCompleted[_keeper] += _payment;\n totalBonds += _payment;\n }\n\n /// @notice Calculate amount to be payed in KP3R, taking into account multiple parameters\n /// @param _gasLeft Amount of gas left after working the job\n /// @param _extraGas Amount of expected unaccounted gas\n /// @param _oneEthQuote Amount of KP3R equivalent to 1 ETH\n /// @param _boost Reward given to the keeper for having bonded KP3R tokens\n /// @return _payment Amount to be payed in KP3R tokens\n function _calculatePayment(\n uint256 _gasLeft,\n uint256 _extraGas,\n uint256 _oneEthQuote,\n uint256 _boost\n ) internal view returns (uint256 _payment) {\n uint256 _accountedGas = _initialGas - _gasLeft + _extraGas;\n _payment = (((_accountedGas * _boost) / _BASE) * _oneEthQuote) / 1 ether;\n }\n\n /// @notice Return the gas left and add 1/64 in order to match real gas left at first level of depth (EIP-150)\n /// @return _gasLeft Amount of gas left recording taking into account EIP-150\n function _getGasLeft() internal view returns (uint256 _gasLeft) {\n _gasLeft = (gasleft() * 64) / 63;\n }\n}\n" - }, - "solidity/contracts/peripherals/jobs/Keep3rJobDisputable.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport './Keep3rJobFundableCredits.sol';\nimport './Keep3rJobFundableLiquidity.sol';\nimport '../Keep3rDisputable.sol';\n\nabstract contract Keep3rJobDisputable is IKeep3rJobDisputable, Keep3rDisputable, Keep3rJobFundableCredits, Keep3rJobFundableLiquidity {\n using EnumerableSet for EnumerableSet.AddressSet;\n using SafeERC20 for IERC20;\n\n /// @inheritdoc IKeep3rJobDisputable\n function slashTokenFromJob(\n address _job,\n address _token,\n uint256 _amount\n ) external override onlySlasher {\n if (!disputes[_job]) revert NotDisputed();\n if (!_jobTokens[_job].contains(_token)) revert JobTokenUnexistent();\n if (jobTokenCredits[_job][_token] < _amount) revert JobTokenInsufficient();\n\n try IERC20(_token).transfer(governor, _amount) {} catch {}\n jobTokenCredits[_job][_token] -= _amount;\n if (jobTokenCredits[_job][_token] == 0) {\n _jobTokens[_job].remove(_token);\n }\n\n emit JobSlashToken(_job, _token, msg.sender, _amount);\n }\n\n /// @inheritdoc IKeep3rJobDisputable\n function slashLiquidityFromJob(\n address _job,\n address _liquidity,\n uint256 _amount\n ) external override onlySlasher {\n if (!disputes[_job]) revert NotDisputed();\n\n _unbondLiquidityFromJob(_job, _liquidity, _amount);\n try IERC20(_liquidity).transfer(governor, _amount) {} catch {}\n emit JobSlashLiquidity(_job, _liquidity, msg.sender, _amount);\n }\n}\n" - }, - "solidity/contracts/peripherals/jobs/Keep3rJobOwnership.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../../../interfaces/peripherals/IKeep3rJobs.sol';\n\nabstract contract Keep3rJobOwnership is IKeep3rJobOwnership {\n /// @inheritdoc IKeep3rJobOwnership\n mapping(address => address) public override jobOwner;\n\n /// @inheritdoc IKeep3rJobOwnership\n mapping(address => address) public override jobPendingOwner;\n\n /// @inheritdoc IKeep3rJobOwnership\n function changeJobOwnership(address _job, address _newOwner) external override onlyJobOwner(_job) {\n jobPendingOwner[_job] = _newOwner;\n emit JobOwnershipChange(_job, jobOwner[_job], _newOwner);\n }\n\n /// @inheritdoc IKeep3rJobOwnership\n function acceptJobOwnership(address _job) external override onlyPendingJobOwner(_job) {\n address _previousOwner = jobOwner[_job];\n\n jobOwner[_job] = jobPendingOwner[_job];\n delete jobPendingOwner[_job];\n\n emit JobOwnershipAssent(msg.sender, _job, _previousOwner);\n }\n\n modifier onlyJobOwner(address _job) {\n if (msg.sender != jobOwner[_job]) revert OnlyJobOwner();\n _;\n }\n\n modifier onlyPendingJobOwner(address _job) {\n if (msg.sender != jobPendingOwner[_job]) revert OnlyPendingJobOwner();\n _;\n }\n}\n" - }, - "solidity/contracts/peripherals/Keep3rAccountance.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '@openzeppelin/contracts/utils/structs/EnumerableSet.sol';\nimport '../../interfaces/peripherals/IKeep3rAccountance.sol';\nimport './Keep3rRoles.sol';\n\nabstract contract Keep3rAccountance is IKeep3rAccountance, Keep3rRoles {\n using EnumerableSet for EnumerableSet.AddressSet;\n\n /// @notice List of all enabled keepers\n EnumerableSet.AddressSet internal _keepers;\n\n /// @inheritdoc IKeep3rAccountance\n uint256 public override totalBonds;\n\n /// @inheritdoc IKeep3rAccountance\n mapping(address => uint256) public override workCompleted;\n\n /// @inheritdoc IKeep3rAccountance\n mapping(address => uint256) public override firstSeen;\n\n /// @inheritdoc IKeep3rAccountance\n mapping(address => bool) public override disputes;\n\n /// @inheritdoc IKeep3rAccountance\n /// @notice Mapping (job => bonding => amount)\n mapping(address => mapping(address => uint256)) public override bonds;\n\n /// @inheritdoc IKeep3rAccountance\n mapping(address => mapping(address => uint256)) public override jobTokenCredits;\n\n /// @notice The current liquidity credits available for a job\n mapping(address => uint256) internal _jobLiquidityCredits;\n\n /// @notice Map the address of a job to its correspondent periodCredits\n mapping(address => uint256) internal _jobPeriodCredits;\n\n /// @notice Enumerable array of Job Tokens for Credits\n mapping(address => EnumerableSet.AddressSet) internal _jobTokens;\n\n /// @notice List of liquidities that a job has (job => liquidities)\n mapping(address => EnumerableSet.AddressSet) internal _jobLiquidities;\n\n /// @notice Liquidity pool to observe\n mapping(address => address) internal _liquidityPool;\n\n /// @notice Tracks if a pool has KP3R as token0\n mapping(address => bool) internal _isKP3RToken0;\n\n /// @inheritdoc IKeep3rAccountance\n mapping(address => mapping(address => uint256)) public override pendingBonds;\n\n /// @inheritdoc IKeep3rAccountance\n mapping(address => mapping(address => uint256)) public override canActivateAfter;\n\n /// @inheritdoc IKeep3rAccountance\n mapping(address => mapping(address => uint256)) public override canWithdrawAfter;\n\n /// @inheritdoc IKeep3rAccountance\n mapping(address => mapping(address => uint256)) public override pendingUnbonds;\n\n /// @inheritdoc IKeep3rAccountance\n mapping(address => bool) public override hasBonded;\n\n /// @notice List of all enabled jobs\n EnumerableSet.AddressSet internal _jobs;\n\n /// @inheritdoc IKeep3rAccountance\n function jobs() external view override returns (address[] memory _list) {\n _list = _jobs.values();\n }\n\n /// @inheritdoc IKeep3rAccountance\n function keepers() external view override returns (address[] memory _list) {\n _list = _keepers.values();\n }\n}\n" - }, - "@openzeppelin/contracts/utils/structs/EnumerableSet.sol": { - "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Library for managing\n * https://en.wikipedia.org/wiki/Set_(abstract_data_type)[sets] of primitive\n * types.\n *\n * Sets have the following properties:\n *\n * - Elements are added, removed, and checked for existence in constant time\n * (O(1)).\n * - Elements are enumerated in O(n). No guarantees are made on the ordering.\n *\n * ```\n * contract Example {\n * // Add the library methods\n * using EnumerableSet for EnumerableSet.AddressSet;\n *\n * // Declare a set state variable\n * EnumerableSet.AddressSet private mySet;\n * }\n * ```\n *\n * As of v3.3.0, sets of type `bytes32` (`Bytes32Set`), `address` (`AddressSet`)\n * and `uint256` (`UintSet`) are supported.\n */\nlibrary EnumerableSet {\n // To implement this library for multiple types with as little code\n // repetition as possible, we write it in terms of a generic Set type with\n // bytes32 values.\n // The Set implementation uses private functions, and user-facing\n // implementations (such as AddressSet) are just wrappers around the\n // underlying Set.\n // This means that we can only create new EnumerableSets for types that fit\n // in bytes32.\n\n struct Set {\n // Storage of set values\n bytes32[] _values;\n // Position of the value in the `values` array, plus 1 because index 0\n // means a value is not in the set.\n mapping(bytes32 => uint256) _indexes;\n }\n\n /**\n * @dev Add a value to a set. O(1).\n *\n * Returns true if the value was added to the set, that is if it was not\n * already present.\n */\n function _add(Set storage set, bytes32 value) private returns (bool) {\n if (!_contains(set, value)) {\n set._values.push(value);\n // The value is stored at length-1, but we add 1 to all indexes\n // and use 0 as a sentinel value\n set._indexes[value] = set._values.length;\n return true;\n } else {\n return false;\n }\n }\n\n /**\n * @dev Removes a value from a set. O(1).\n *\n * Returns true if the value was removed from the set, that is if it was\n * present.\n */\n function _remove(Set storage set, bytes32 value) private returns (bool) {\n // We read and store the value's index to prevent multiple reads from the same storage slot\n uint256 valueIndex = set._indexes[value];\n\n if (valueIndex != 0) {\n // Equivalent to contains(set, value)\n // To delete an element from the _values array in O(1), we swap the element to delete with the last one in\n // the array, and then remove the last element (sometimes called as 'swap and pop').\n // This modifies the order of the array, as noted in {at}.\n\n uint256 toDeleteIndex = valueIndex - 1;\n uint256 lastIndex = set._values.length - 1;\n\n if (lastIndex != toDeleteIndex) {\n bytes32 lastvalue = set._values[lastIndex];\n\n // Move the last value to the index where the value to delete is\n set._values[toDeleteIndex] = lastvalue;\n // Update the index for the moved value\n set._indexes[lastvalue] = valueIndex; // Replace lastvalue's index to valueIndex\n }\n\n // Delete the slot where the moved value was stored\n set._values.pop();\n\n // Delete the index for the deleted slot\n delete set._indexes[value];\n\n return true;\n } else {\n return false;\n }\n }\n\n /**\n * @dev Returns true if the value is in the set. O(1).\n */\n function _contains(Set storage set, bytes32 value) private view returns (bool) {\n return set._indexes[value] != 0;\n }\n\n /**\n * @dev Returns the number of values on the set. O(1).\n */\n function _length(Set storage set) private view returns (uint256) {\n return set._values.length;\n }\n\n /**\n * @dev Returns the value stored at position `index` in the set. O(1).\n *\n * Note that there are no guarantees on the ordering of values inside the\n * array, and it may change when more values are added or removed.\n *\n * Requirements:\n *\n * - `index` must be strictly less than {length}.\n */\n function _at(Set storage set, uint256 index) private view returns (bytes32) {\n return set._values[index];\n }\n\n /**\n * @dev Return the entire set in an array\n *\n * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed\n * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that\n * this function has an unbounded cost, and using it as part of a state-changing function may render the function\n * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.\n */\n function _values(Set storage set) private view returns (bytes32[] memory) {\n return set._values;\n }\n\n // Bytes32Set\n\n struct Bytes32Set {\n Set _inner;\n }\n\n /**\n * @dev Add a value to a set. O(1).\n *\n * Returns true if the value was added to the set, that is if it was not\n * already present.\n */\n function add(Bytes32Set storage set, bytes32 value) internal returns (bool) {\n return _add(set._inner, value);\n }\n\n /**\n * @dev Removes a value from a set. O(1).\n *\n * Returns true if the value was removed from the set, that is if it was\n * present.\n */\n function remove(Bytes32Set storage set, bytes32 value) internal returns (bool) {\n return _remove(set._inner, value);\n }\n\n /**\n * @dev Returns true if the value is in the set. O(1).\n */\n function contains(Bytes32Set storage set, bytes32 value) internal view returns (bool) {\n return _contains(set._inner, value);\n }\n\n /**\n * @dev Returns the number of values in the set. O(1).\n */\n function length(Bytes32Set storage set) internal view returns (uint256) {\n return _length(set._inner);\n }\n\n /**\n * @dev Returns the value stored at position `index` in the set. O(1).\n *\n * Note that there are no guarantees on the ordering of values inside the\n * array, and it may change when more values are added or removed.\n *\n * Requirements:\n *\n * - `index` must be strictly less than {length}.\n */\n function at(Bytes32Set storage set, uint256 index) internal view returns (bytes32) {\n return _at(set._inner, index);\n }\n\n /**\n * @dev Return the entire set in an array\n *\n * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed\n * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that\n * this function has an unbounded cost, and using it as part of a state-changing function may render the function\n * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.\n */\n function values(Bytes32Set storage set) internal view returns (bytes32[] memory) {\n return _values(set._inner);\n }\n\n // AddressSet\n\n struct AddressSet {\n Set _inner;\n }\n\n /**\n * @dev Add a value to a set. O(1).\n *\n * Returns true if the value was added to the set, that is if it was not\n * already present.\n */\n function add(AddressSet storage set, address value) internal returns (bool) {\n return _add(set._inner, bytes32(uint256(uint160(value))));\n }\n\n /**\n * @dev Removes a value from a set. O(1).\n *\n * Returns true if the value was removed from the set, that is if it was\n * present.\n */\n function remove(AddressSet storage set, address value) internal returns (bool) {\n return _remove(set._inner, bytes32(uint256(uint160(value))));\n }\n\n /**\n * @dev Returns true if the value is in the set. O(1).\n */\n function contains(AddressSet storage set, address value) internal view returns (bool) {\n return _contains(set._inner, bytes32(uint256(uint160(value))));\n }\n\n /**\n * @dev Returns the number of values in the set. O(1).\n */\n function length(AddressSet storage set) internal view returns (uint256) {\n return _length(set._inner);\n }\n\n /**\n * @dev Returns the value stored at position `index` in the set. O(1).\n *\n * Note that there are no guarantees on the ordering of values inside the\n * array, and it may change when more values are added or removed.\n *\n * Requirements:\n *\n * - `index` must be strictly less than {length}.\n */\n function at(AddressSet storage set, uint256 index) internal view returns (address) {\n return address(uint160(uint256(_at(set._inner, index))));\n }\n\n /**\n * @dev Return the entire set in an array\n *\n * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed\n * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that\n * this function has an unbounded cost, and using it as part of a state-changing function may render the function\n * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.\n */\n function values(AddressSet storage set) internal view returns (address[] memory) {\n bytes32[] memory store = _values(set._inner);\n address[] memory result;\n\n assembly {\n result := store\n }\n\n return result;\n }\n\n // UintSet\n\n struct UintSet {\n Set _inner;\n }\n\n /**\n * @dev Add a value to a set. O(1).\n *\n * Returns true if the value was added to the set, that is if it was not\n * already present.\n */\n function add(UintSet storage set, uint256 value) internal returns (bool) {\n return _add(set._inner, bytes32(value));\n }\n\n /**\n * @dev Removes a value from a set. O(1).\n *\n * Returns true if the value was removed from the set, that is if it was\n * present.\n */\n function remove(UintSet storage set, uint256 value) internal returns (bool) {\n return _remove(set._inner, bytes32(value));\n }\n\n /**\n * @dev Returns true if the value is in the set. O(1).\n */\n function contains(UintSet storage set, uint256 value) internal view returns (bool) {\n return _contains(set._inner, bytes32(value));\n }\n\n /**\n * @dev Returns the number of values on the set. O(1).\n */\n function length(UintSet storage set) internal view returns (uint256) {\n return _length(set._inner);\n }\n\n /**\n * @dev Returns the value stored at position `index` in the set. O(1).\n *\n * Note that there are no guarantees on the ordering of values inside the\n * array, and it may change when more values are added or removed.\n *\n * Requirements:\n *\n * - `index` must be strictly less than {length}.\n */\n function at(UintSet storage set, uint256 index) internal view returns (uint256) {\n return uint256(_at(set._inner, index));\n }\n\n /**\n * @dev Return the entire set in an array\n *\n * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed\n * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that\n * this function has an unbounded cost, and using it as part of a state-changing function may render the function\n * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.\n */\n function values(UintSet storage set) internal view returns (uint256[] memory) {\n bytes32[] memory store = _values(set._inner);\n uint256[] memory result;\n\n assembly {\n result := store\n }\n\n return result;\n }\n}\n" - }, - "solidity/contracts/peripherals/Keep3rRoles.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../../interfaces/peripherals/IKeep3rRoles.sol';\nimport '@openzeppelin/contracts/utils/structs/EnumerableSet.sol';\nimport '@defi-wonderland/solidity-utils/solidity/contracts/DustCollector.sol';\nimport '@defi-wonderland/solidity-utils/solidity/contracts/Governable.sol';\n\ncontract Keep3rRoles is IKeep3rRoles, Governable, DustCollector {\n /// @inheritdoc IKeep3rRoles\n mapping(address => bool) public override slashers;\n\n /// @inheritdoc IKeep3rRoles\n mapping(address => bool) public override disputers;\n\n constructor(address _governor) Governable(_governor) DustCollector() {}\n\n /// @inheritdoc IKeep3rRoles\n function addSlasher(address _slasher) external override onlyGovernor {\n if (_slasher == address(0)) revert ZeroAddress();\n if (slashers[_slasher]) revert SlasherExistent();\n slashers[_slasher] = true;\n emit SlasherAdded(_slasher);\n }\n\n /// @inheritdoc IKeep3rRoles\n function removeSlasher(address _slasher) external override onlyGovernor {\n if (!slashers[_slasher]) revert SlasherUnexistent();\n delete slashers[_slasher];\n emit SlasherRemoved(_slasher);\n }\n\n /// @inheritdoc IKeep3rRoles\n function addDisputer(address _disputer) external override onlyGovernor {\n if (_disputer == address(0)) revert ZeroAddress();\n if (disputers[_disputer]) revert DisputerExistent();\n disputers[_disputer] = true;\n emit DisputerAdded(_disputer);\n }\n\n /// @inheritdoc IKeep3rRoles\n function removeDisputer(address _disputer) external override onlyGovernor {\n if (!disputers[_disputer]) revert DisputerUnexistent();\n delete disputers[_disputer];\n emit DisputerRemoved(_disputer);\n }\n\n /// @notice Functions with this modifier can only be called by either a slasher or governance\n modifier onlySlasher {\n if (!slashers[msg.sender]) revert OnlySlasher();\n _;\n }\n\n /// @notice Functions with this modifier can only be called by either a disputer or governance\n modifier onlyDisputer {\n if (!disputers[msg.sender]) revert OnlyDisputer();\n _;\n }\n}\n" - }, - "@defi-wonderland/solidity-utils/solidity/contracts/Governable.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.8 <0.9.0;\n\nimport {IGovernable} from '../interfaces/IGovernable.sol';\n\n/// @title Governable contract\n/// @notice Manages the governor role\nabstract contract Governable is IGovernable {\n /// @inheritdoc IGovernable\n address public governor;\n\n /// @inheritdoc IGovernable\n address public pendingGovernor;\n\n constructor(address _governor) {\n if (_governor == address(0)) revert ZeroAddress();\n governor = _governor;\n }\n\n /// @inheritdoc IGovernable\n function setPendingGovernor(address _pendingGovernor) external onlyGovernor {\n _setPendingGovernor(_pendingGovernor);\n }\n\n /// @inheritdoc IGovernable\n function acceptPendingGovernor() external onlyPendingGovernor {\n _acceptPendingGovernor();\n }\n\n function _setPendingGovernor(address _pendingGovernor) internal {\n if (_pendingGovernor == address(0)) revert ZeroAddress();\n pendingGovernor = _pendingGovernor;\n emit PendingGovernorSet(governor, _pendingGovernor);\n }\n\n function _acceptPendingGovernor() internal {\n governor = pendingGovernor;\n delete pendingGovernor;\n emit PendingGovernorAccepted(governor);\n }\n\n /// @notice Functions with this modifier can only be called by governor\n modifier onlyGovernor() {\n if (msg.sender != governor) revert OnlyGovernor();\n _;\n }\n\n /// @notice Functions with this modifier can only be called by pendingGovernor\n modifier onlyPendingGovernor() {\n if (msg.sender != pendingGovernor) revert OnlyPendingGovernor();\n _;\n }\n}\n" - }, - "@openzeppelin/contracts/token/ERC20/IERC20.sol": { - "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Interface of the ERC20 standard as defined in the EIP.\n */\ninterface IERC20 {\n /**\n * @dev Returns the amount of tokens in existence.\n */\n function totalSupply() external view returns (uint256);\n\n /**\n * @dev Returns the amount of tokens owned by `account`.\n */\n function balanceOf(address account) external view returns (uint256);\n\n /**\n * @dev Moves `amount` tokens from the caller's account to `recipient`.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * Emits a {Transfer} event.\n */\n function transfer(address recipient, uint256 amount) external returns (bool);\n\n /**\n * @dev Returns the remaining number of tokens that `spender` will be\n * allowed to spend on behalf of `owner` through {transferFrom}. This is\n * zero by default.\n *\n * This value changes when {approve} or {transferFrom} are called.\n */\n function allowance(address owner, address spender) external view returns (uint256);\n\n /**\n * @dev Sets `amount` as the allowance of `spender` over the caller's tokens.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * IMPORTANT: Beware that changing an allowance with this method brings the risk\n * that someone may use both the old and the new allowance by unfortunate\n * transaction ordering. One possible solution to mitigate this race\n * condition is to first reduce the spender's allowance to 0 and set the\n * desired value afterwards:\n * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729\n *\n * Emits an {Approval} event.\n */\n function approve(address spender, uint256 amount) external returns (bool);\n\n /**\n * @dev Moves `amount` tokens from `sender` to `recipient` using the\n * allowance mechanism. `amount` is then deducted from the caller's\n * allowance.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * Emits a {Transfer} event.\n */\n function transferFrom(\n address sender,\n address recipient,\n uint256 amount\n ) external returns (bool);\n\n /**\n * @dev Emitted when `value` tokens are moved from one account (`from`) to\n * another (`to`).\n *\n * Note that `value` may be zero.\n */\n event Transfer(address indexed from, address indexed to, uint256 value);\n\n /**\n * @dev Emitted when the allowance of a `spender` for an `owner` is set by\n * a call to {approve}. `value` is the new allowance.\n */\n event Approval(address indexed owner, address indexed spender, uint256 value);\n}\n" - }, - "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol": { - "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\nimport \"../IERC20.sol\";\nimport \"../../../utils/Address.sol\";\n\n/**\n * @title SafeERC20\n * @dev Wrappers around ERC20 operations that throw on failure (when the token\n * contract returns false). Tokens that return no value (and instead revert or\n * throw on failure) are also supported, non-reverting calls are assumed to be\n * successful.\n * To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract,\n * which allows you to call the safe operations as `token.safeTransfer(...)`, etc.\n */\nlibrary SafeERC20 {\n using Address for address;\n\n function safeTransfer(\n IERC20 token,\n address to,\n uint256 value\n ) internal {\n _callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value));\n }\n\n function safeTransferFrom(\n IERC20 token,\n address from,\n address to,\n uint256 value\n ) internal {\n _callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value));\n }\n\n /**\n * @dev Deprecated. This function has issues similar to the ones found in\n * {IERC20-approve}, and its usage is discouraged.\n *\n * Whenever possible, use {safeIncreaseAllowance} and\n * {safeDecreaseAllowance} instead.\n */\n function safeApprove(\n IERC20 token,\n address spender,\n uint256 value\n ) internal {\n // safeApprove should only be called when setting an initial allowance,\n // or when resetting it to zero. To increase and decrease it, use\n // 'safeIncreaseAllowance' and 'safeDecreaseAllowance'\n require(\n (value == 0) || (token.allowance(address(this), spender) == 0),\n \"SafeERC20: approve from non-zero to non-zero allowance\"\n );\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value));\n }\n\n function safeIncreaseAllowance(\n IERC20 token,\n address spender,\n uint256 value\n ) internal {\n uint256 newAllowance = token.allowance(address(this), spender) + value;\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));\n }\n\n function safeDecreaseAllowance(\n IERC20 token,\n address spender,\n uint256 value\n ) internal {\n unchecked {\n uint256 oldAllowance = token.allowance(address(this), spender);\n require(oldAllowance >= value, \"SafeERC20: decreased allowance below zero\");\n uint256 newAllowance = oldAllowance - value;\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));\n }\n }\n\n /**\n * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement\n * on the return value: the return value is optional (but if data is returned, it must not be false).\n * @param token The token targeted by the call.\n * @param data The call data (encoded using abi.encode or one of its variants).\n */\n function _callOptionalReturn(IERC20 token, bytes memory data) private {\n // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since\n // we're implementing it ourselves. We use {Address.functionCall} to perform this call, which verifies that\n // the target address contains contract code and also asserts for success in the low-level call.\n\n bytes memory returndata = address(token).functionCall(data, \"SafeERC20: low-level call failed\");\n if (returndata.length > 0) {\n // Return data is optional\n require(abi.decode(returndata, (bool)), \"SafeERC20: ERC20 operation did not succeed\");\n }\n }\n}\n" - }, - "@openzeppelin/contracts/utils/Address.sol": { - "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Collection of functions related to the address type\n */\nlibrary Address {\n /**\n * @dev Returns true if `account` is a contract.\n *\n * [IMPORTANT]\n * ====\n * It is unsafe to assume that an address for which this function returns\n * false is an externally-owned account (EOA) and not a contract.\n *\n * Among others, `isContract` will return false for the following\n * types of addresses:\n *\n * - an externally-owned account\n * - a contract in construction\n * - an address where a contract will be created\n * - an address where a contract lived, but was destroyed\n * ====\n */\n function isContract(address account) internal view returns (bool) {\n // This method relies on extcodesize, which returns 0 for contracts in\n // construction, since the code is only stored at the end of the\n // constructor execution.\n\n uint256 size;\n assembly {\n size := extcodesize(account)\n }\n return size > 0;\n }\n\n /**\n * @dev Replacement for Solidity's `transfer`: sends `amount` wei to\n * `recipient`, forwarding all available gas and reverting on errors.\n *\n * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost\n * of certain opcodes, possibly making contracts go over the 2300 gas limit\n * imposed by `transfer`, making them unable to receive funds via\n * `transfer`. {sendValue} removes this limitation.\n *\n * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].\n *\n * IMPORTANT: because control is transferred to `recipient`, care must be\n * taken to not create reentrancy vulnerabilities. Consider using\n * {ReentrancyGuard} or the\n * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].\n */\n function sendValue(address payable recipient, uint256 amount) internal {\n require(address(this).balance >= amount, \"Address: insufficient balance\");\n\n (bool success, ) = recipient.call{value: amount}(\"\");\n require(success, \"Address: unable to send value, recipient may have reverted\");\n }\n\n /**\n * @dev Performs a Solidity function call using a low level `call`. A\n * plain `call` is an unsafe replacement for a function call: use this\n * function instead.\n *\n * If `target` reverts with a revert reason, it is bubbled up by this\n * function (like regular Solidity function calls).\n *\n * Returns the raw returned data. To convert to the expected return value,\n * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\n *\n * Requirements:\n *\n * - `target` must be a contract.\n * - calling `target` with `data` must not revert.\n *\n * _Available since v3.1._\n */\n function functionCall(address target, bytes memory data) internal returns (bytes memory) {\n return functionCall(target, data, \"Address: low-level call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with\n * `errorMessage` as a fallback revert reason when `target` reverts.\n *\n * _Available since v3.1._\n */\n function functionCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal returns (bytes memory) {\n return functionCallWithValue(target, data, 0, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but also transferring `value` wei to `target`.\n *\n * Requirements:\n *\n * - the calling contract must have an ETH balance of at least `value`.\n * - the called Solidity function must be `payable`.\n *\n * _Available since v3.1._\n */\n function functionCallWithValue(\n address target,\n bytes memory data,\n uint256 value\n ) internal returns (bytes memory) {\n return functionCallWithValue(target, data, value, \"Address: low-level call with value failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but\n * with `errorMessage` as a fallback revert reason when `target` reverts.\n *\n * _Available since v3.1._\n */\n function functionCallWithValue(\n address target,\n bytes memory data,\n uint256 value,\n string memory errorMessage\n ) internal returns (bytes memory) {\n require(address(this).balance >= value, \"Address: insufficient balance for call\");\n require(isContract(target), \"Address: call to non-contract\");\n\n (bool success, bytes memory returndata) = target.call{value: value}(data);\n return verifyCallResult(success, returndata, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but performing a static call.\n *\n * _Available since v3.3._\n */\n function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\n return functionStaticCall(target, data, \"Address: low-level static call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\n * but performing a static call.\n *\n * _Available since v3.3._\n */\n function functionStaticCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal view returns (bytes memory) {\n require(isContract(target), \"Address: static call to non-contract\");\n\n (bool success, bytes memory returndata) = target.staticcall(data);\n return verifyCallResult(success, returndata, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but performing a delegate call.\n *\n * _Available since v3.4._\n */\n function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {\n return functionDelegateCall(target, data, \"Address: low-level delegate call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\n * but performing a delegate call.\n *\n * _Available since v3.4._\n */\n function functionDelegateCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal returns (bytes memory) {\n require(isContract(target), \"Address: delegate call to non-contract\");\n\n (bool success, bytes memory returndata) = target.delegatecall(data);\n return verifyCallResult(success, returndata, errorMessage);\n }\n\n /**\n * @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the\n * revert reason using the provided one.\n *\n * _Available since v4.3._\n */\n function verifyCallResult(\n bool success,\n bytes memory returndata,\n string memory errorMessage\n ) internal pure returns (bytes memory) {\n if (success) {\n return returndata;\n } else {\n // Look for revert reason and bubble it up if present\n if (returndata.length > 0) {\n // The easiest way to bubble the revert reason is using memory via assembly\n\n assembly {\n let returndata_size := mload(returndata)\n revert(add(32, returndata), returndata_size)\n }\n } else {\n revert(errorMessage);\n }\n }\n }\n}\n" - }, - "solidity/contracts/peripherals/jobs/Keep3rJobMigration.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../../../interfaces/peripherals/IKeep3rJobs.sol';\nimport './Keep3rJobFundableCredits.sol';\nimport './Keep3rJobFundableLiquidity.sol';\n\nabstract contract Keep3rJobMigration is IKeep3rJobMigration, Keep3rJobFundableCredits, Keep3rJobFundableLiquidity {\n using EnumerableSet for EnumerableSet.AddressSet;\n\n uint256 internal constant _MIGRATION_COOLDOWN = 1 minutes;\n\n /// @inheritdoc IKeep3rJobMigration\n mapping(address => address) public override pendingJobMigrations;\n mapping(address => mapping(address => uint256)) internal _migrationCreatedAt;\n\n /// @inheritdoc IKeep3rJobMigration\n function migrateJob(address _fromJob, address _toJob) external override onlyJobOwner(_fromJob) {\n if (_fromJob == _toJob) revert JobMigrationImpossible();\n\n pendingJobMigrations[_fromJob] = _toJob;\n _migrationCreatedAt[_fromJob][_toJob] = block.timestamp;\n\n emit JobMigrationRequested(_fromJob, _toJob);\n }\n\n /// @inheritdoc IKeep3rJobMigration\n function acceptJobMigration(address _fromJob, address _toJob) external override onlyJobOwner(_toJob) {\n if (disputes[_fromJob] || disputes[_toJob]) revert JobDisputed();\n if (pendingJobMigrations[_fromJob] != _toJob) revert JobMigrationUnavailable();\n if (block.timestamp < _migrationCreatedAt[_fromJob][_toJob] + _MIGRATION_COOLDOWN) revert JobMigrationLocked();\n\n // force job credits update for both jobs\n _settleJobAccountance(_fromJob);\n _settleJobAccountance(_toJob);\n\n // migrate tokens\n while (_jobTokens[_fromJob].length() > 0) {\n address _tokenToMigrate = _jobTokens[_fromJob].at(0);\n jobTokenCredits[_toJob][_tokenToMigrate] += jobTokenCredits[_fromJob][_tokenToMigrate];\n delete jobTokenCredits[_fromJob][_tokenToMigrate];\n _jobTokens[_fromJob].remove(_tokenToMigrate);\n _jobTokens[_toJob].add(_tokenToMigrate);\n }\n\n // migrate liquidities\n while (_jobLiquidities[_fromJob].length() > 0) {\n address _liquidity = _jobLiquidities[_fromJob].at(0);\n\n liquidityAmount[_toJob][_liquidity] += liquidityAmount[_fromJob][_liquidity];\n delete liquidityAmount[_fromJob][_liquidity];\n\n _jobLiquidities[_toJob].add(_liquidity);\n _jobLiquidities[_fromJob].remove(_liquidity);\n }\n\n // migrate job balances\n _jobPeriodCredits[_toJob] += _jobPeriodCredits[_fromJob];\n delete _jobPeriodCredits[_fromJob];\n\n _jobLiquidityCredits[_toJob] += _jobLiquidityCredits[_fromJob];\n delete _jobLiquidityCredits[_fromJob];\n\n // stop _fromJob from being a job\n delete rewardedAt[_fromJob];\n _jobs.remove(_fromJob);\n\n // delete unused data slots\n delete jobOwner[_fromJob];\n delete jobPendingOwner[_fromJob];\n delete _migrationCreatedAt[_fromJob][_toJob];\n delete pendingJobMigrations[_fromJob];\n\n emit JobMigrationSuccessful(_fromJob, _toJob);\n }\n}\n" - }, - "solidity/interfaces/IKeep3rHelper.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport './IKeep3rHelperParameters.sol';\n\n/// @title Keep3rHelper contract\n/// @notice Contains all the helper functions used throughout the different files.\ninterface IKeep3rHelper is IKeep3rHelperParameters {\n // Errors\n\n /// @notice Throws when none of the tokens in the liquidity pair is KP3R\n error LiquidityPairInvalid();\n\n // Methods\n // solhint-enable func-name-mixedcase\n\n /// @notice Calculates the amount of KP3R that corresponds to the ETH passed into the function\n /// @dev This function allows us to calculate how much KP3R we should pay to a keeper for things expressed in ETH, like gas\n /// @param _eth The amount of ETH\n /// @return _amountOut The amount of KP3R\n function quote(uint256 _eth) external view returns (uint256 _amountOut);\n\n /// @notice Returns the amount of KP3R the keeper has bonded\n /// @param _keeper The address of the keeper to check\n /// @return _amountBonded The amount of KP3R the keeper has bonded\n function bonds(address _keeper) external view returns (uint256 _amountBonded);\n\n /// @notice Calculates the reward (in KP3R) that corresponds to a keeper for using gas\n /// @param _keeper The address of the keeper to check\n /// @param _gasUsed The amount of gas used that will be rewarded\n /// @return _kp3r The amount of KP3R that should be awarded to the keeper\n function getRewardAmountFor(address _keeper, uint256 _gasUsed) external view returns (uint256 _kp3r);\n\n /// @notice Calculates the boost in the reward given to a keeper based on the amount of KP3R that keeper has bonded\n /// @dev If the keeper has no bonds, boost should be +10% of gas cost, if keeper has max bonds, +20%\n /// @param _bonds The amount of KP3R tokens bonded by the keeper\n /// @return _rewardBoost The reward boost that corresponds to the keeper\n function getRewardBoostFor(uint256 _bonds) external view returns (uint256 _rewardBoost);\n\n /// @notice Calculates the reward (in KP3R) that corresponds to tx.origin for using gas\n /// @param _gasUsed The amount of gas used that will be rewarded\n /// @return _amount The amount of KP3R that should be awarded to tx.origin\n function getRewardAmount(uint256 _gasUsed) external view returns (uint256 _amount);\n\n /// @notice Given a pool address, returns the underlying tokens of the pair\n /// @param _pool Address of the correspondant pool\n /// @return _token0 Address of the first token of the pair\n /// @return _token1 Address of the second token of the pair\n function getPoolTokens(address _pool) external view returns (address _token0, address _token1);\n\n /// @notice Defines the order of the tokens in the pair for twap calculations\n /// @param _pool Address of the correspondant pool\n /// @return _isKP3RToken0 Boolean indicating the order of the tokens in the pair\n function isKP3RToken0(address _pool) external view returns (bool _isKP3RToken0);\n\n /// @notice Given an array of secondsAgo, returns UniswapV3 pool cumulatives at that moment\n /// @param _pool Address of the pool to observe\n /// @param _secondsAgo Array with time references to observe\n /// @return _tickCumulative1 Cumulative sum of ticks until first time reference\n /// @return _tickCumulative2 Cumulative sum of ticks until second time reference\n /// @return _success Boolean indicating if the observe call was succesfull\n function observe(address _pool, uint32[] memory _secondsAgo)\n external\n view\n returns (\n int56 _tickCumulative1,\n int56 _tickCumulative2,\n bool _success\n );\n\n /// @notice Get multiplier, quote, and extra, in order to calculate keeper payment\n /// @param _bonds Amount of bonded KP3R owned by the keeper\n /// @return _boost Multiplier per gas unit. Takes into account the base fee and the amount of bonded KP3R\n /// @return _oneEthQuote Amount of KP3R tokens equivalent to 1 ETH\n /// @return _extra Amount of extra gas that should be added to the gas spent\n function getPaymentParams(uint256 _bonds)\n external\n view\n returns (\n uint256 _boost,\n uint256 _oneEthQuote,\n uint256 _extra\n );\n\n /// @notice Given a tick and a liquidity amount, calculates the underlying KP3R tokens\n /// @param _liquidityAmount Amount of liquidity to be converted\n /// @param _tickDifference Tick value used to calculate the quote\n /// @param _timeInterval Time value used to calculate the quote\n /// @return _kp3rAmount Amount of KP3R tokens underlying on the given liquidity\n function getKP3RsAtTick(\n uint256 _liquidityAmount,\n int56 _tickDifference,\n uint256 _timeInterval\n ) external pure returns (uint256 _kp3rAmount);\n\n /// @notice Given a tick and a token amount, calculates the output in correspondant token\n /// @param _baseAmount Amount of token to be converted\n /// @param _tickDifference Tick value used to calculate the quote\n /// @param _timeInterval Time value used to calculate the quote\n /// @return _quoteAmount Amount of credits deserved for the baseAmount at the tick value\n function getQuoteAtTick(\n uint128 _baseAmount,\n int56 _tickDifference,\n uint256 _timeInterval\n ) external pure returns (uint256 _quoteAmount);\n}\n" - }, - "solidity/contracts/peripherals/jobs/Keep3rJobFundableCredits.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport './Keep3rJobOwnership.sol';\nimport '../Keep3rAccountance.sol';\nimport '../Keep3rParameters.sol';\nimport '../../../interfaces/peripherals/IKeep3rJobs.sol';\n\nimport '@openzeppelin/contracts/security/ReentrancyGuard.sol';\nimport '@openzeppelin/contracts/token/ERC20/IERC20.sol';\nimport '@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol';\nimport '@openzeppelin/contracts/utils/math/Math.sol';\n\nabstract contract Keep3rJobFundableCredits is IKeep3rJobFundableCredits, ReentrancyGuard, Keep3rJobOwnership, Keep3rParameters {\n using EnumerableSet for EnumerableSet.AddressSet;\n using SafeERC20 for IERC20;\n\n /// @notice Cooldown between withdrawals\n uint256 internal constant _WITHDRAW_TOKENS_COOLDOWN = 1 minutes;\n\n /// @inheritdoc IKeep3rJobFundableCredits\n mapping(address => mapping(address => uint256)) public override jobTokenCreditsAddedAt;\n\n /// @inheritdoc IKeep3rJobFundableCredits\n function addTokenCreditsToJob(\n address _job,\n address _token,\n uint256 _amount\n ) external override nonReentrant {\n if (!_jobs.contains(_job)) revert JobUnavailable();\n // KP3R shouldn't be used for direct token payments\n if (_token == keep3rV1) revert TokenUnallowed();\n uint256 _before = IERC20(_token).balanceOf(address(this));\n IERC20(_token).safeTransferFrom(msg.sender, address(this), _amount);\n uint256 _received = IERC20(_token).balanceOf(address(this)) - _before;\n uint256 _tokenFee = (_received * fee) / _BASE;\n jobTokenCredits[_job][_token] += _received - _tokenFee;\n jobTokenCreditsAddedAt[_job][_token] = block.timestamp;\n IERC20(_token).safeTransfer(governor, _tokenFee);\n _jobTokens[_job].add(_token);\n\n emit TokenCreditAddition(_job, _token, msg.sender, _received);\n }\n\n /// @inheritdoc IKeep3rJobFundableCredits\n function withdrawTokenCreditsFromJob(\n address _job,\n address _token,\n uint256 _amount,\n address _receiver\n ) external override nonReentrant onlyJobOwner(_job) {\n if (block.timestamp <= jobTokenCreditsAddedAt[_job][_token] + _WITHDRAW_TOKENS_COOLDOWN) revert JobTokenCreditsLocked();\n if (jobTokenCredits[_job][_token] < _amount) revert InsufficientJobTokenCredits();\n if (disputes[_job]) revert JobDisputed();\n\n jobTokenCredits[_job][_token] -= _amount;\n IERC20(_token).safeTransfer(_receiver, _amount);\n\n if (jobTokenCredits[_job][_token] == 0) {\n _jobTokens[_job].remove(_token);\n }\n\n emit TokenCreditWithdrawal(_job, _token, _receiver, _amount);\n }\n}\n" - }, - "solidity/contracts/peripherals/jobs/Keep3rJobFundableLiquidity.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport './Keep3rJobOwnership.sol';\nimport '../Keep3rAccountance.sol';\nimport '../Keep3rParameters.sol';\nimport '../../../interfaces/IPairManager.sol';\nimport '../../../interfaces/peripherals/IKeep3rJobs.sol';\n\nimport '../../libraries/FullMath.sol';\n\nimport '@openzeppelin/contracts/security/ReentrancyGuard.sol';\nimport '@openzeppelin/contracts/token/ERC20/IERC20.sol';\nimport '@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol';\nimport '@openzeppelin/contracts/utils/math/Math.sol';\n\nabstract contract Keep3rJobFundableLiquidity is IKeep3rJobFundableLiquidity, ReentrancyGuard, Keep3rJobOwnership, Keep3rParameters {\n using EnumerableSet for EnumerableSet.AddressSet;\n using SafeERC20 for IERC20;\n\n /// @notice List of liquidities that are accepted in the system\n EnumerableSet.AddressSet internal _approvedLiquidities;\n\n /// @inheritdoc IKeep3rJobFundableLiquidity\n mapping(address => mapping(address => uint256)) public override liquidityAmount;\n\n /// @inheritdoc IKeep3rJobFundableLiquidity\n mapping(address => uint256) public override rewardedAt;\n\n /// @inheritdoc IKeep3rJobFundableLiquidity\n mapping(address => uint256) public override workedAt;\n\n /// @notice Tracks an address and returns its TickCache\n mapping(address => TickCache) internal _tick;\n\n // Views\n\n /// @inheritdoc IKeep3rJobFundableLiquidity\n function approvedLiquidities() external view override returns (address[] memory _list) {\n _list = _approvedLiquidities.values();\n }\n\n /// @inheritdoc IKeep3rJobFundableLiquidity\n function jobPeriodCredits(address _job) public view override returns (uint256 _periodCredits) {\n for (uint256 i; i < _jobLiquidities[_job].length(); i++) {\n address _liquidity = _jobLiquidities[_job].at(i);\n if (_approvedLiquidities.contains(_liquidity)) {\n TickCache memory _tickCache = observeLiquidity(_liquidity);\n if (_tickCache.period != 0) {\n int56 _tickDifference = _isKP3RToken0[_liquidity] ? _tickCache.difference : -_tickCache.difference;\n _periodCredits += _getReward(\n IKeep3rHelper(keep3rHelper).getKP3RsAtTick(liquidityAmount[_job][_liquidity], _tickDifference, rewardPeriodTime)\n );\n }\n }\n }\n }\n\n /// @inheritdoc IKeep3rJobFundableLiquidity\n function jobLiquidityCredits(address _job) public view override returns (uint256 _liquidityCredits) {\n uint256 _periodCredits = jobPeriodCredits(_job);\n\n // If the job was rewarded in the past 1 period time\n if ((block.timestamp - rewardedAt[_job]) < rewardPeriodTime) {\n // If the job has period credits, update minted job credits to new twap\n _liquidityCredits = _periodCredits > 0\n ? (_jobLiquidityCredits[_job] * _periodCredits) / _jobPeriodCredits[_job] // If the job has period credits, return remaining job credits updated to new twap\n : _jobLiquidityCredits[_job]; // If not, return remaining credits, forced credits should not be updated\n } else {\n // Else return a full period worth of credits if current credits have expired\n _liquidityCredits = _periodCredits;\n }\n }\n\n /// @inheritdoc IKeep3rJobFundableLiquidity\n function totalJobCredits(address _job) external view override returns (uint256 _credits) {\n uint256 _periodCredits = jobPeriodCredits(_job);\n uint256 _cooldown = block.timestamp;\n\n if ((rewardedAt[_job] > _period(block.timestamp - rewardPeriodTime))) {\n // Will calculate cooldown if it outdated\n if ((block.timestamp - rewardedAt[_job]) >= rewardPeriodTime) {\n // Will calculate cooldown from last reward reference in this period\n _cooldown -= (rewardedAt[_job] + rewardPeriodTime);\n } else {\n // Will calculate cooldown from last reward timestamp\n _cooldown -= rewardedAt[_job];\n }\n } else {\n // Will calculate cooldown from period start if expired\n _cooldown -= _period(block.timestamp);\n }\n _credits = jobLiquidityCredits(_job) + _phase(_cooldown, _periodCredits);\n }\n\n /// @inheritdoc IKeep3rJobFundableLiquidity\n function quoteLiquidity(address _liquidity, uint256 _amount) external view override returns (uint256 _periodCredits) {\n if (_approvedLiquidities.contains(_liquidity)) {\n TickCache memory _tickCache = observeLiquidity(_liquidity);\n if (_tickCache.period != 0) {\n int56 _tickDifference = _isKP3RToken0[_liquidity] ? _tickCache.difference : -_tickCache.difference;\n return _getReward(IKeep3rHelper(keep3rHelper).getKP3RsAtTick(_amount, _tickDifference, rewardPeriodTime));\n }\n }\n }\n\n /// @inheritdoc IKeep3rJobFundableLiquidity\n function observeLiquidity(address _liquidity) public view virtual override returns (TickCache memory _tickCache) {\n if (_tick[_liquidity].period == _period(block.timestamp)) {\n // Will return cached twaps if liquidity is updated\n _tickCache = _tick[_liquidity];\n } else {\n bool success;\n uint256 lastPeriod = _period(block.timestamp - rewardPeriodTime);\n\n if (_tick[_liquidity].period == lastPeriod) {\n // Will only ask for current period accumulator if liquidity is outdated\n uint32[] memory _secondsAgo = new uint32[](1);\n int56 previousTick = _tick[_liquidity].current;\n\n _secondsAgo[0] = uint32(block.timestamp - _period(block.timestamp));\n\n (_tickCache.current, , success) = IKeep3rHelper(keep3rHelper).observe(_liquidityPool[_liquidity], _secondsAgo);\n\n _tickCache.difference = _tickCache.current - previousTick;\n } else if (_tick[_liquidity].period < lastPeriod) {\n // Will ask for 2 accumulators if liquidity is expired\n uint32[] memory _secondsAgo = new uint32[](2);\n\n _secondsAgo[0] = uint32(block.timestamp - _period(block.timestamp));\n _secondsAgo[1] = uint32(block.timestamp - _period(block.timestamp) + rewardPeriodTime);\n\n int56 _tickCumulative2;\n (_tickCache.current, _tickCumulative2, success) = IKeep3rHelper(keep3rHelper).observe(_liquidityPool[_liquidity], _secondsAgo);\n\n _tickCache.difference = _tickCache.current - _tickCumulative2;\n }\n if (success) {\n _tickCache.period = _period(block.timestamp);\n } else {\n delete _tickCache.period;\n }\n }\n }\n\n // Methods\n\n /// @inheritdoc IKeep3rJobFundableLiquidity\n function forceLiquidityCreditsToJob(address _job, uint256 _amount) external override onlyGovernor {\n if (!_jobs.contains(_job)) revert JobUnavailable();\n _settleJobAccountance(_job);\n _jobLiquidityCredits[_job] += _amount;\n emit LiquidityCreditsForced(_job, rewardedAt[_job], _jobLiquidityCredits[_job]);\n }\n\n /// @inheritdoc IKeep3rJobFundableLiquidity\n function approveLiquidity(address _liquidity) external virtual override onlyGovernor {\n if (!_approvedLiquidities.add(_liquidity)) revert LiquidityPairApproved();\n _liquidityPool[_liquidity] = IPairManager(_liquidity).pool();\n _isKP3RToken0[_liquidity] = IKeep3rHelper(keep3rHelper).isKP3RToken0(_liquidityPool[_liquidity]);\n _tick[_liquidity] = observeLiquidity(_liquidity);\n emit LiquidityApproval(_liquidity);\n }\n\n /// @inheritdoc IKeep3rJobFundableLiquidity\n function revokeLiquidity(address _liquidity) external override onlyGovernor {\n if (!_approvedLiquidities.remove(_liquidity)) revert LiquidityPairUnexistent();\n delete _liquidityPool[_liquidity];\n delete _isKP3RToken0[_liquidity];\n delete _tick[_liquidity];\n\n emit LiquidityRevocation(_liquidity);\n }\n\n /// @inheritdoc IKeep3rJobFundableLiquidity\n function addLiquidityToJob(\n address _job,\n address _liquidity,\n uint256 _amount\n ) external override nonReentrant {\n if (!_approvedLiquidities.contains(_liquidity)) revert LiquidityPairUnapproved();\n if (!_jobs.contains(_job)) revert JobUnavailable();\n\n _jobLiquidities[_job].add(_liquidity);\n\n _settleJobAccountance(_job);\n\n if (_quoteLiquidity(liquidityAmount[_job][_liquidity] + _amount, _liquidity) < liquidityMinimum) revert JobLiquidityLessThanMin();\n\n emit LiquidityCreditsReward(_job, rewardedAt[_job], _jobLiquidityCredits[_job], _jobPeriodCredits[_job]);\n\n IERC20(_liquidity).safeTransferFrom(msg.sender, address(this), _amount);\n liquidityAmount[_job][_liquidity] += _amount;\n _jobPeriodCredits[_job] += _getReward(_quoteLiquidity(_amount, _liquidity));\n emit LiquidityAddition(_job, _liquidity, msg.sender, _amount);\n }\n\n /// @inheritdoc IKeep3rJobFundableLiquidity\n function unbondLiquidityFromJob(\n address _job,\n address _liquidity,\n uint256 _amount\n ) external override onlyJobOwner(_job) {\n canWithdrawAfter[_job][_liquidity] = block.timestamp + unbondTime;\n pendingUnbonds[_job][_liquidity] += _amount;\n _unbondLiquidityFromJob(_job, _liquidity, _amount);\n\n uint256 _remainingLiquidity = liquidityAmount[_job][_liquidity];\n if (_remainingLiquidity > 0 && _quoteLiquidity(_remainingLiquidity, _liquidity) < liquidityMinimum) revert JobLiquidityLessThanMin();\n\n emit Unbonding(_job, _liquidity, _amount);\n }\n\n /// @inheritdoc IKeep3rJobFundableLiquidity\n function withdrawLiquidityFromJob(\n address _job,\n address _liquidity,\n address _receiver\n ) external override onlyJobOwner(_job) {\n if (_receiver == address(0)) revert ZeroAddress();\n if (pendingUnbonds[_job][_liquidity] == 0) revert UnbondsUnexistent();\n if (canWithdrawAfter[_job][_liquidity] >= block.timestamp) revert UnbondsLocked();\n if (disputes[_job]) revert Disputed();\n\n uint256 _amount = pendingUnbonds[_job][_liquidity];\n\n delete pendingUnbonds[_job][_liquidity];\n delete canWithdrawAfter[_job][_liquidity];\n\n IERC20(_liquidity).safeTransfer(_receiver, _amount);\n emit LiquidityWithdrawal(_job, _liquidity, _receiver, _amount);\n }\n\n // Internal functions\n\n /// @notice Updates or rewards job liquidity credits depending on time since last job reward\n function _updateJobCreditsIfNeeded(address _job) internal returns (bool _rewarded) {\n if (rewardedAt[_job] < _period(block.timestamp)) {\n // Will exit function if job has been rewarded in current period\n if (rewardedAt[_job] <= _period(block.timestamp - rewardPeriodTime)) {\n // Will reset job to period syncronicity if a full period passed without rewards\n _updateJobPeriod(_job);\n _jobLiquidityCredits[_job] = _jobPeriodCredits[_job];\n rewardedAt[_job] = _period(block.timestamp);\n _rewarded = true;\n } else if ((block.timestamp - rewardedAt[_job]) >= rewardPeriodTime) {\n // Will reset job's syncronicity if last reward was more than epoch ago\n _updateJobPeriod(_job);\n _jobLiquidityCredits[_job] = _jobPeriodCredits[_job];\n rewardedAt[_job] += rewardPeriodTime;\n _rewarded = true;\n } else if (workedAt[_job] < _period(block.timestamp)) {\n // First keeper on period has to update job accountance to current twaps\n uint256 previousPeriodCredits = _jobPeriodCredits[_job];\n _updateJobPeriod(_job);\n _jobLiquidityCredits[_job] = (_jobLiquidityCredits[_job] * _jobPeriodCredits[_job]) / previousPeriodCredits;\n // Updating job accountance does not reward job\n }\n }\n }\n\n /// @notice Only called if _jobLiquidityCredits < payment\n function _rewardJobCredits(address _job) internal {\n /// @notice Only way to += jobLiquidityCredits is when keeper rewarding (cannot pay work)\n /* WARNING: this allows to top up _jobLiquidityCredits to a max of 1.99 but have to spend at least 1 */\n _jobLiquidityCredits[_job] += _phase(block.timestamp - rewardedAt[_job], _jobPeriodCredits[_job]);\n rewardedAt[_job] = block.timestamp;\n }\n\n /// @notice Updates accountance for _jobPeriodCredits\n function _updateJobPeriod(address _job) internal {\n _jobPeriodCredits[_job] = _calculateJobPeriodCredits(_job);\n }\n\n /// @notice Quotes the outdated job liquidities and calculates _periodCredits\n /// @dev This function is also responsible for keeping the KP3R/WETH quote updated\n function _calculateJobPeriodCredits(address _job) internal returns (uint256 _periodCredits) {\n for (uint256 i; i < _jobLiquidities[_job].length(); i++) {\n address _liquidity = _jobLiquidities[_job].at(i);\n if (_approvedLiquidities.contains(_liquidity)) {\n if (_tick[_liquidity].period != _period(block.timestamp)) {\n // Updates liquidity cache only if needed\n _tick[_liquidity] = observeLiquidity(_liquidity);\n }\n _periodCredits += _getReward(_quoteLiquidity(liquidityAmount[_job][_liquidity], _liquidity));\n }\n }\n }\n\n /// @notice Updates job accountance calculating the impact of the unbonded liquidity amount\n function _unbondLiquidityFromJob(\n address _job,\n address _liquidity,\n uint256 _amount\n ) internal nonReentrant {\n if (!_jobLiquidities[_job].contains(_liquidity)) revert JobLiquidityUnexistent();\n if (liquidityAmount[_job][_liquidity] < _amount) revert JobLiquidityInsufficient();\n\n // Ensures current twaps in job liquidities\n _updateJobPeriod(_job);\n uint256 _periodCreditsToRemove = _getReward(_quoteLiquidity(_amount, _liquidity));\n\n // A liquidity can be revoked causing a job to have 0 periodCredits\n if (_jobPeriodCredits[_job] > 0) {\n // Removes a % correspondant to a full rewardPeriodTime for the liquidity withdrawn vs all of the liquidities\n _jobLiquidityCredits[_job] -= (_jobLiquidityCredits[_job] * _periodCreditsToRemove) / _jobPeriodCredits[_job];\n _jobPeriodCredits[_job] -= _periodCreditsToRemove;\n }\n\n liquidityAmount[_job][_liquidity] -= _amount;\n if (liquidityAmount[_job][_liquidity] == 0) {\n _jobLiquidities[_job].remove(_liquidity);\n }\n }\n\n /// @notice Returns a fraction of the multiplier or the whole multiplier if equal or more than a rewardPeriodTime has passed\n function _phase(uint256 _timePassed, uint256 _multiplier) internal view returns (uint256 _result) {\n if (_timePassed < rewardPeriodTime) {\n _result = (_timePassed * _multiplier) / rewardPeriodTime;\n } else _result = _multiplier;\n }\n\n /// @notice Returns the start of the period of the provided timestamp\n function _period(uint256 _timestamp) internal view returns (uint256 _periodTimestamp) {\n return _timestamp - (_timestamp % rewardPeriodTime);\n }\n\n /// @notice Calculates relation between rewardPeriod and inflationPeriod\n function _getReward(uint256 _baseAmount) internal view returns (uint256 _credits) {\n return FullMath.mulDiv(_baseAmount, rewardPeriodTime, inflationPeriod);\n }\n\n /// @notice Returns underlying KP3R amount for a given liquidity amount\n function _quoteLiquidity(uint256 _amount, address _liquidity) internal view returns (uint256 _quote) {\n if (_tick[_liquidity].period != 0) {\n int56 _tickDifference = _isKP3RToken0[_liquidity] ? _tick[_liquidity].difference : -_tick[_liquidity].difference;\n _quote = IKeep3rHelper(keep3rHelper).getKP3RsAtTick(_amount, _tickDifference, rewardPeriodTime);\n }\n }\n\n /// @notice Updates job credits to current quotes and rewards job's pending minted credits\n /// @dev Ensures a maximum of 1 period of credits\n function _settleJobAccountance(address _job) internal virtual {\n _updateJobCreditsIfNeeded(_job);\n _rewardJobCredits(_job);\n _jobLiquidityCredits[_job] = Math.min(_jobLiquidityCredits[_job], _jobPeriodCredits[_job]);\n }\n}\n" - }, - "solidity/contracts/peripherals/Keep3rParameters.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../../interfaces/IKeep3rHelper.sol';\nimport '../../interfaces/peripherals/IKeep3rParameters.sol';\nimport '../../interfaces/external/IKeep3rV1Proxy.sol';\nimport './Keep3rAccountance.sol';\n\nabstract contract Keep3rParameters is IKeep3rParameters, Keep3rAccountance {\n /// @inheritdoc IKeep3rParameters\n address public override keep3rV1;\n\n /// @inheritdoc IKeep3rParameters\n address public override keep3rV1Proxy;\n\n /// @inheritdoc IKeep3rParameters\n address public override keep3rHelper;\n\n /// @inheritdoc IKeep3rParameters\n uint256 public override bondTime = 3 days;\n\n /// @inheritdoc IKeep3rParameters\n uint256 public override unbondTime = 14 days;\n\n /// @inheritdoc IKeep3rParameters\n uint256 public override liquidityMinimum = 3 ether;\n\n /// @inheritdoc IKeep3rParameters\n uint256 public override rewardPeriodTime = 5 days;\n\n /// @inheritdoc IKeep3rParameters\n uint256 public override inflationPeriod = 34 days;\n\n /// @inheritdoc IKeep3rParameters\n uint256 public override fee = 30;\n\n /// @notice The base that will be used to calculate the fee\n uint256 internal constant _BASE = 10_000;\n\n /// @notice The minimum reward period\n uint256 internal constant _MIN_REWARD_PERIOD_TIME = 1 days;\n\n constructor(\n address _keep3rHelper,\n address _keep3rV1,\n address _keep3rV1Proxy\n ) {\n keep3rHelper = _keep3rHelper;\n keep3rV1 = _keep3rV1;\n keep3rV1Proxy = _keep3rV1Proxy;\n }\n\n /// @inheritdoc IKeep3rParameters\n function setKeep3rHelper(address _keep3rHelper) external override onlyGovernor {\n if (_keep3rHelper == address(0)) revert ZeroAddress();\n keep3rHelper = _keep3rHelper;\n emit Keep3rHelperChange(_keep3rHelper);\n }\n\n /// @inheritdoc IKeep3rParameters\n function setKeep3rV1(address _keep3rV1) public virtual override onlyGovernor {\n if (_keep3rV1 == address(0)) revert ZeroAddress();\n _mint(totalBonds);\n\n keep3rV1 = _keep3rV1;\n emit Keep3rV1Change(_keep3rV1);\n }\n\n /// @inheritdoc IKeep3rParameters\n function setKeep3rV1Proxy(address _keep3rV1Proxy) external override onlyGovernor {\n if (_keep3rV1Proxy == address(0)) revert ZeroAddress();\n keep3rV1Proxy = _keep3rV1Proxy;\n emit Keep3rV1ProxyChange(_keep3rV1Proxy);\n }\n\n /// @inheritdoc IKeep3rParameters\n function setBondTime(uint256 _bondTime) external override onlyGovernor {\n bondTime = _bondTime;\n emit BondTimeChange(_bondTime);\n }\n\n /// @inheritdoc IKeep3rParameters\n function setUnbondTime(uint256 _unbondTime) external override onlyGovernor {\n unbondTime = _unbondTime;\n emit UnbondTimeChange(_unbondTime);\n }\n\n /// @inheritdoc IKeep3rParameters\n function setLiquidityMinimum(uint256 _liquidityMinimum) external override onlyGovernor {\n liquidityMinimum = _liquidityMinimum;\n emit LiquidityMinimumChange(_liquidityMinimum);\n }\n\n /// @inheritdoc IKeep3rParameters\n function setRewardPeriodTime(uint256 _rewardPeriodTime) external override onlyGovernor {\n if (_rewardPeriodTime < _MIN_REWARD_PERIOD_TIME) revert MinRewardPeriod();\n rewardPeriodTime = _rewardPeriodTime;\n emit RewardPeriodTimeChange(_rewardPeriodTime);\n }\n\n /// @inheritdoc IKeep3rParameters\n function setInflationPeriod(uint256 _inflationPeriod) external override onlyGovernor {\n inflationPeriod = _inflationPeriod;\n emit InflationPeriodChange(_inflationPeriod);\n }\n\n /// @inheritdoc IKeep3rParameters\n function setFee(uint256 _fee) external override onlyGovernor {\n fee = _fee;\n emit FeeChange(_fee);\n }\n\n function _mint(uint256 _amount) internal {\n totalBonds -= _amount;\n IKeep3rV1Proxy(keep3rV1Proxy).mint(_amount);\n }\n}\n" - }, - "@openzeppelin/contracts/security/ReentrancyGuard.sol": { - "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Contract module that helps prevent reentrant calls to a function.\n *\n * Inheriting from `ReentrancyGuard` will make the {nonReentrant} modifier\n * available, which can be applied to functions to make sure there are no nested\n * (reentrant) calls to them.\n *\n * Note that because there is a single `nonReentrant` guard, functions marked as\n * `nonReentrant` may not call one another. This can be worked around by making\n * those functions `private`, and then adding `external` `nonReentrant` entry\n * points to them.\n *\n * TIP: If you would like to learn more about reentrancy and alternative ways\n * to protect against it, check out our blog post\n * https://blog.openzeppelin.com/reentrancy-after-istanbul/[Reentrancy After Istanbul].\n */\nabstract contract ReentrancyGuard {\n // Booleans are more expensive than uint256 or any type that takes up a full\n // word because each write operation emits an extra SLOAD to first read the\n // slot's contents, replace the bits taken up by the boolean, and then write\n // back. This is the compiler's defense against contract upgrades and\n // pointer aliasing, and it cannot be disabled.\n\n // The values being non-zero value makes deployment a bit more expensive,\n // but in exchange the refund on every call to nonReentrant will be lower in\n // amount. Since refunds are capped to a percentage of the total\n // transaction's gas, it is best to keep them low in cases like this one, to\n // increase the likelihood of the full refund coming into effect.\n uint256 private constant _NOT_ENTERED = 1;\n uint256 private constant _ENTERED = 2;\n\n uint256 private _status;\n\n constructor() {\n _status = _NOT_ENTERED;\n }\n\n /**\n * @dev Prevents a contract from calling itself, directly or indirectly.\n * Calling a `nonReentrant` function from another `nonReentrant`\n * function is not supported. It is possible to prevent this from happening\n * by making the `nonReentrant` function external, and make it call a\n * `private` function that does the actual work.\n */\n modifier nonReentrant() {\n // On the first call to nonReentrant, _notEntered will be true\n require(_status != _ENTERED, \"ReentrancyGuard: reentrant call\");\n\n // Any calls to nonReentrant after this point will fail\n _status = _ENTERED;\n\n _;\n\n // By storing the original value once again, a refund is triggered (see\n // https://eips.ethereum.org/EIPS/eip-2200)\n _status = _NOT_ENTERED;\n }\n}\n" - }, - "@openzeppelin/contracts/utils/math/Math.sol": { - "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Standard math utilities missing in the Solidity language.\n */\nlibrary Math {\n /**\n * @dev Returns the largest of two numbers.\n */\n function max(uint256 a, uint256 b) internal pure returns (uint256) {\n return a >= b ? a : b;\n }\n\n /**\n * @dev Returns the smallest of two numbers.\n */\n function min(uint256 a, uint256 b) internal pure returns (uint256) {\n return a < b ? a : b;\n }\n\n /**\n * @dev Returns the average of two numbers. The result is rounded towards\n * zero.\n */\n function average(uint256 a, uint256 b) internal pure returns (uint256) {\n // (a + b) / 2 can overflow.\n return (a & b) + (a ^ b) / 2;\n }\n\n /**\n * @dev Returns the ceiling of the division of two numbers.\n *\n * This differs from standard division with `/` in that it rounds up instead\n * of rounding down.\n */\n function ceilDiv(uint256 a, uint256 b) internal pure returns (uint256) {\n // (a + b - 1) / b can overflow on addition, so we distribute.\n return a / b + (a % b == 0 ? 0 : 1);\n }\n}\n" - }, - "solidity/interfaces/external/IKeep3rV1Proxy.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '@defi-wonderland/solidity-utils/solidity/interfaces/IBaseErrors.sol';\n\ninterface IKeep3rV1Proxy is IBaseErrors {\n // Structs\n struct Recipient {\n address recipient;\n uint256 caps;\n }\n\n // Variables\n function keep3rV1() external view returns (address);\n\n function governance() external view returns (address);\n\n function pendingGovernance() external view returns (address);\n\n function minter() external view returns (address);\n\n function next(address) external view returns (uint256);\n\n function caps(address) external view returns (uint256);\n\n function recipients() external view returns (address[] memory);\n\n function recipientsCaps() external view returns (Recipient[] memory);\n\n // Errors\n error Cooldown();\n error NoDrawableAmount();\n error OnlyMinter();\n error OnlyGovernance();\n error OnlyPendingGovernance();\n\n // Methods\n function addRecipient(address recipient, uint256 amount) external;\n\n function removeRecipient(address recipient) external;\n\n function draw() external returns (uint256 _amount);\n\n function setKeep3rV1(address _keep3rV1) external;\n\n function setMinter(address _minter) external;\n\n function mint(uint256 _amount) external;\n\n function mint(address _account, uint256 _amount) external;\n\n function setGovernance(address _governance) external;\n\n function acceptGovernance() external;\n\n function setKeep3rV1Governance(address _governance) external;\n\n function acceptKeep3rV1Governance() external;\n\n function dispute(address _keeper) external;\n\n function slash(\n address _bonded,\n address _keeper,\n uint256 _amount\n ) external;\n\n function revoke(address _keeper) external;\n\n function resolve(address _keeper) external;\n\n function addJob(address _job) external;\n\n function removeJob(address _job) external;\n\n function addKPRCredit(address _job, uint256 _amount) external;\n\n function approveLiquidity(address _liquidity) external;\n\n function revokeLiquidity(address _liquidity) external;\n\n function setKeep3rHelper(address _keep3rHelper) external;\n\n function addVotes(address _voter, uint256 _amount) external;\n\n function removeVotes(address _voter, uint256 _amount) external;\n}\n" - }, - "solidity/interfaces/IKeep3rHelperParameters.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\n/// @title Keep3rHelperParameters contract\n/// @notice Contains all the helper functions used throughout the different files.\ninterface IKeep3rHelperParameters {\n // Structs\n\n /// @dev KP3R-WETH Pool address and isKP3RToken0\n /// @dev Created in order to save gas by avoiding calls to pool's token0 method\n struct Kp3rWethOraclePool {\n address poolAddress;\n bool isKP3RToken0;\n }\n\n // Errors\n\n /// @notice Throws when pool does not have KP3R as token0 nor token1\n error InvalidOraclePool();\n\n // Events\n\n /// @notice Emitted when the kp3r weth pool is changed\n /// @param _address Address of the new kp3r weth pool\n /// @param _isKP3RToken0 True if calling the token0 method of the pool returns the KP3R token address\n event Kp3rWethPoolChange(address _address, bool _isKP3RToken0);\n\n /// @notice Emitted when the minimum boost multiplier is changed\n /// @param _minBoost The minimum boost multiplier\n event MinBoostChange(uint256 _minBoost);\n\n /// @notice Emitted when the maximum boost multiplier is changed\n /// @param _maxBoost The maximum boost multiplier\n event MaxBoostChange(uint256 _maxBoost);\n\n /// @notice Emitted when the target bond amount is changed\n /// @param _targetBond The target bond amount\n event TargetBondChange(uint256 _targetBond);\n\n /// @notice Emitted when the Keep3r V2 address is changed\n /// @param _keep3rV2 The address of Keep3r V2\n event Keep3rV2Change(address _keep3rV2);\n\n /// @notice Emitted when the work extra gas amount is changed\n /// @param _workExtraGas The work extra gas\n event WorkExtraGasChange(uint256 _workExtraGas);\n\n /// @notice Emitted when the quote twap time is changed\n /// @param _quoteTwapTime The twap time for quoting\n event QuoteTwapTimeChange(uint32 _quoteTwapTime);\n\n /// @notice Emitted when minimum rewarded gas fee is changed\n /// @param _minBaseFee The minimum rewarded gas fee\n event MinBaseFeeChange(uint256 _minBaseFee);\n\n /// @notice Emitted when minimum rewarded priority fee is changed\n /// @param _minPriorityFee The minimum expected fee that the keeper should pay\n event MinPriorityFeeChange(uint256 _minPriorityFee);\n\n // Variables\n\n /// @notice Address of KP3R token\n /// @return _kp3r Address of KP3R token\n // solhint-disable func-name-mixedcase\n function KP3R() external view returns (address _kp3r);\n\n /// @notice The boost base used to calculate the boost rewards for the keeper\n /// @return _base The boost base number\n function BOOST_BASE() external view returns (uint256 _base);\n\n /// @notice KP3R-WETH pool that is being used as oracle\n /// @return poolAddress Address of the pool\n /// @return isKP3RToken0 True if calling the token0 method of the pool returns the KP3R token address\n function kp3rWethPool() external view returns (address poolAddress, bool isKP3RToken0);\n\n /// @notice The minimum multiplier used to calculate the amount of gas paid to the Keeper for the gas used to perform a job\n /// For example: if the quoted gas used is 1000, then the minimum amount to be paid will be 1000 * minBoost / BOOST_BASE\n /// @return _multiplier The minimum boost multiplier\n function minBoost() external view returns (uint256 _multiplier);\n\n /// @notice The maximum multiplier used to calculate the amount of gas paid to the Keeper for the gas used to perform a job\n /// For example: if the quoted gas used is 1000, then the maximum amount to be paid will be 1000 * maxBoost / BOOST_BASE\n /// @return _multiplier The maximum boost multiplier\n function maxBoost() external view returns (uint256 _multiplier);\n\n /// @notice The targeted amount of bonded KP3Rs to max-up reward multiplier\n /// For example: if the amount of KP3R the keeper has bonded is targetBond or more, then the keeper will get\n /// the maximum boost possible in his rewards, if it's less, the reward boost will be proportional\n /// @return _target The amount of KP3R that comforms the targetBond\n function targetBond() external view returns (uint256 _target);\n\n /// @notice The amount of unaccounted gas that is going to be added to keeper payments\n /// @return _workExtraGas The work unaccounted gas amount\n function workExtraGas() external view returns (uint256 _workExtraGas);\n\n /// @notice The twap time for quoting\n /// @return _quoteTwapTime The twap time\n function quoteTwapTime() external view returns (uint32 _quoteTwapTime);\n\n /// @notice The minimum base fee that is used to calculate keeper rewards\n /// @return _minBaseFee The minimum rewarded gas fee\n function minBaseFee() external view returns (uint256 _minBaseFee);\n\n /// @notice The minimum priority fee that is also rewarded for keepers\n /// @return _minPriorityFee The minimum rewarded priority fee\n function minPriorityFee() external view returns (uint256 _minPriorityFee);\n\n /// @notice Address of Keep3r V2\n /// @return _keep3rV2 Address of Keep3r V2\n function keep3rV2() external view returns (address _keep3rV2);\n\n // Methods\n\n /// @notice Sets KP3R-WETH pool\n /// @param _poolAddress The address of the KP3R-WETH pool\n function setKp3rWethPool(address _poolAddress) external;\n\n /// @notice Sets the minimum boost multiplier\n /// @param _minBoost The minimum boost multiplier\n function setMinBoost(uint256 _minBoost) external;\n\n /// @notice Sets the maximum boost multiplier\n /// @param _maxBoost The maximum boost multiplier\n function setMaxBoost(uint256 _maxBoost) external;\n\n /// @notice Sets the target bond amount\n /// @param _targetBond The target bond amount\n function setTargetBond(uint256 _targetBond) external;\n\n /// @notice Sets the Keep3r V2 address\n /// @param _keep3rV2 The address of Keep3r V2\n function setKeep3rV2(address _keep3rV2) external;\n\n /// @notice Sets the work extra gas amount\n /// @param _workExtraGas The work extra gas\n function setWorkExtraGas(uint256 _workExtraGas) external;\n\n /// @notice Sets the quote twap time\n /// @param _quoteTwapTime The twap time for quoting\n function setQuoteTwapTime(uint32 _quoteTwapTime) external;\n\n /// @notice Sets the minimum rewarded gas fee\n /// @param _minBaseFee The minimum rewarded gas fee\n function setMinBaseFee(uint256 _minBaseFee) external;\n\n /// @notice Sets the minimum rewarded gas priority fee\n /// @param _minPriorityFee The minimum rewarded priority fee\n function setMinPriorityFee(uint256 _minPriorityFee) external;\n}\n" - }, - "solidity/interfaces/IPairManager.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol';\n\n/// @title Pair Manager interface\n/// @notice Generic interface for Keep3r liquidity pools (kLP)\ninterface IPairManager is IERC20Metadata {\n /// @notice Address of the factory from which the pair manager was created\n /// @return _factory The address of the PairManager Factory\n function factory() external view returns (address _factory);\n\n /// @notice Address of the pool from which the Keep3r pair manager will interact with\n /// @return _pool The address of the pool\n function pool() external view returns (address _pool);\n\n /// @notice Token0 of the pool\n /// @return _token0 The address of token0\n function token0() external view returns (address _token0);\n\n /// @notice Token1 of the pool\n /// @return _token1 The address of token1\n function token1() external view returns (address _token1);\n}\n" - }, - "solidity/contracts/libraries/FullMath.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\n/// @title Contains 512-bit math functions\n/// @notice Facilitates multiplication and division that can have overflow of an intermediate value without any loss of precision\n/// @dev Handles \"phantom overflow\" i.e., allows multiplication and division where an intermediate value overflows 256 bits\nlibrary FullMath {\n /// @notice Calculates floor(a×b÷denominator) with full precision. Throws if result overflows a uint256 or denominator == 0\n /// @param a The multiplicand\n /// @param b The multiplier\n /// @param denominator The divisor\n /// @return result The 256-bit result\n /// @dev Credit to Remco Bloemen under MIT license https://xn--2-umb.com/21/muldiv\n function mulDiv(\n uint256 a,\n uint256 b,\n uint256 denominator\n ) internal pure returns (uint256 result) {\n unchecked {\n // 512-bit multiply [prod1 prod0] = a * b\n // Compute the product mod 2**256 and mod 2**256 - 1\n // then use the Chinese Remainder Theorem to reconstruct\n // the 512 bit result. The result is stored in two 256\n // variables such that product = prod1 * 2**256 + prod0\n uint256 prod0; // Least significant 256 bits of the product\n uint256 prod1; // Most significant 256 bits of the product\n assembly {\n let mm := mulmod(a, b, not(0))\n prod0 := mul(a, b)\n prod1 := sub(sub(mm, prod0), lt(mm, prod0))\n }\n\n // Handle non-overflow cases, 256 by 256 division\n if (prod1 == 0) {\n require(denominator > 0);\n assembly {\n result := div(prod0, denominator)\n }\n return result;\n }\n\n // Make sure the result is less than 2**256.\n // Also prevents denominator == 0\n require(denominator > prod1);\n\n ///////////////////////////////////////////////\n // 512 by 256 division.\n ///////////////////////////////////////////////\n\n // Make division exact by subtracting the remainder from [prod1 prod0]\n // Compute remainder using mulmod\n uint256 remainder;\n assembly {\n remainder := mulmod(a, b, denominator)\n }\n // Subtract 256 bit number from 512 bit number\n assembly {\n prod1 := sub(prod1, gt(remainder, prod0))\n prod0 := sub(prod0, remainder)\n }\n\n // Factor powers of two out of denominator\n // Compute largest power of two divisor of denominator.\n // Always >= 1.\n uint256 twos = (~denominator + 1) & denominator;\n // Divide denominator by power of two\n assembly {\n denominator := div(denominator, twos)\n }\n\n // Divide [prod1 prod0] by the factors of two\n assembly {\n prod0 := div(prod0, twos)\n }\n // Shift in bits from prod1 into prod0. For this we need\n // to flip `twos` such that it is 2**256 / twos.\n // If twos is zero, then it becomes one\n assembly {\n twos := add(div(sub(0, twos), twos), 1)\n }\n prod0 |= prod1 * twos;\n\n // Invert denominator mod 2**256\n // Now that denominator is an odd number, it has an inverse\n // modulo 2**256 such that denominator * inv = 1 mod 2**256.\n // Compute the inverse by starting with a seed that is correct\n // correct for four bits. That is, denominator * inv = 1 mod 2**4\n uint256 inv = (3 * denominator) ^ 2;\n // Now use Newton-Raphson iteration to improve the precision.\n // Thanks to Hensel's lifting lemma, this also works in modular\n // arithmetic, doubling the correct bits in each step.\n inv *= 2 - denominator * inv; // inverse mod 2**8\n inv *= 2 - denominator * inv; // inverse mod 2**16\n inv *= 2 - denominator * inv; // inverse mod 2**32\n inv *= 2 - denominator * inv; // inverse mod 2**64\n inv *= 2 - denominator * inv; // inverse mod 2**128\n inv *= 2 - denominator * inv; // inverse mod 2**256\n\n // Because the division is now exact we can divide by multiplying\n // with the modular inverse of denominator. This will give us the\n // correct result modulo 2**256. Since the precoditions guarantee\n // that the outcome is less than 2**256, this is the final result.\n // We don't need to compute the high bits of the result and prod1\n // is no longer required.\n result = prod0 * inv;\n return result;\n }\n }\n\n /// @notice Calculates ceil(a×b÷denominator) with full precision. Throws if result overflows a uint256 or denominator == 0\n /// @param a The multiplicand\n /// @param b The multiplier\n /// @param denominator The divisor\n /// @return result The 256-bit result\n function mulDivRoundingUp(\n uint256 a,\n uint256 b,\n uint256 denominator\n ) internal pure returns (uint256 result) {\n unchecked {\n result = mulDiv(a, b, denominator);\n if (mulmod(a, b, denominator) > 0) {\n require(result < type(uint256).max);\n result++;\n }\n }\n }\n}\n" - }, - "@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol": { - "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\nimport \"../IERC20.sol\";\n\n/**\n * @dev Interface for the optional metadata functions from the ERC20 standard.\n *\n * _Available since v4.1._\n */\ninterface IERC20Metadata is IERC20 {\n /**\n * @dev Returns the name of the token.\n */\n function name() external view returns (string memory);\n\n /**\n * @dev Returns the symbol of the token.\n */\n function symbol() external view returns (string memory);\n\n /**\n * @dev Returns the decimals places of the token.\n */\n function decimals() external view returns (uint8);\n}\n" - }, - "solidity/contracts/peripherals/Keep3rDisputable.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport './Keep3rParameters.sol';\nimport '../../interfaces/peripherals/IKeep3rDisputable.sol';\n\nabstract contract Keep3rDisputable is IKeep3rDisputable, Keep3rParameters {\n /// @inheritdoc IKeep3rDisputable\n function dispute(address _jobOrKeeper) external override onlyDisputer {\n if (disputes[_jobOrKeeper]) revert AlreadyDisputed();\n disputes[_jobOrKeeper] = true;\n emit Dispute(_jobOrKeeper, msg.sender);\n }\n\n /// @inheritdoc IKeep3rDisputable\n function resolve(address _jobOrKeeper) external override onlyDisputer {\n if (!disputes[_jobOrKeeper]) revert NotDisputed();\n disputes[_jobOrKeeper] = false;\n emit Resolve(_jobOrKeeper, msg.sender);\n }\n}\n" - }, - "solidity/contracts/peripherals/keepers/Keep3rKeeperDisputable.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport './Keep3rKeeperFundable.sol';\nimport '../Keep3rDisputable.sol';\nimport '../../../interfaces/external/IKeep3rV1.sol';\nimport '../../../interfaces/peripherals/IKeep3rKeepers.sol';\n\nabstract contract Keep3rKeeperDisputable is IKeep3rKeeperDisputable, Keep3rDisputable, Keep3rKeeperFundable {\n using EnumerableSet for EnumerableSet.AddressSet;\n using SafeERC20 for IERC20;\n\n /// @inheritdoc IKeep3rKeeperDisputable\n function slash(\n address _keeper,\n address _bonded,\n uint256 _bondAmount,\n uint256 _unbondAmount\n ) external override onlySlasher {\n if (!disputes[_keeper]) revert NotDisputed();\n _slash(_keeper, _bonded, _bondAmount, _unbondAmount);\n emit KeeperSlash(_keeper, msg.sender, _bondAmount + _unbondAmount);\n }\n\n /// @inheritdoc IKeep3rKeeperDisputable\n function revoke(address _keeper) external override onlySlasher {\n if (!disputes[_keeper]) revert NotDisputed();\n _keepers.remove(_keeper);\n _slash(_keeper, keep3rV1, bonds[_keeper][keep3rV1], pendingUnbonds[_keeper][keep3rV1]);\n emit KeeperRevoke(_keeper, msg.sender);\n }\n\n function _slash(\n address _keeper,\n address _bonded,\n uint256 _bondAmount,\n uint256 _unbondAmount\n ) internal {\n if (_bonded != keep3rV1) {\n try IERC20(_bonded).transfer(governor, _bondAmount + _unbondAmount) returns (bool) {} catch (bytes memory) {}\n }\n bonds[_keeper][_bonded] -= _bondAmount;\n pendingUnbonds[_keeper][_bonded] -= _unbondAmount;\n }\n}\n" - }, - "solidity/contracts/peripherals/keepers/Keep3rKeeperFundable.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../Keep3rAccountance.sol';\nimport '../Keep3rParameters.sol';\nimport '../../../interfaces/peripherals/IKeep3rKeepers.sol';\n\nimport '../../../interfaces/external/IKeep3rV1.sol';\n\nimport '@openzeppelin/contracts/security/ReentrancyGuard.sol';\nimport '@openzeppelin/contracts/token/ERC20/IERC20.sol';\nimport '@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol';\n\nabstract contract Keep3rKeeperFundable is IKeep3rKeeperFundable, ReentrancyGuard, Keep3rParameters {\n using EnumerableSet for EnumerableSet.AddressSet;\n using SafeERC20 for IERC20;\n\n /// @inheritdoc IKeep3rKeeperFundable\n function bond(address _bonding, uint256 _amount) external override nonReentrant {\n if (disputes[msg.sender]) revert Disputed();\n if (_jobs.contains(msg.sender)) revert AlreadyAJob();\n canActivateAfter[msg.sender][_bonding] = block.timestamp + bondTime;\n\n uint256 _before = IERC20(_bonding).balanceOf(address(this));\n IERC20(_bonding).safeTransferFrom(msg.sender, address(this), _amount);\n _amount = IERC20(_bonding).balanceOf(address(this)) - _before;\n\n hasBonded[msg.sender] = true;\n pendingBonds[msg.sender][_bonding] += _amount;\n\n emit Bonding(msg.sender, _bonding, _amount);\n }\n\n /// @inheritdoc IKeep3rKeeperFundable\n function activate(address _bonding) external override {\n address _keeper = msg.sender;\n if (disputes[_keeper]) revert Disputed();\n uint256 _canActivateAfter = canActivateAfter[_keeper][_bonding];\n if (_canActivateAfter == 0) revert BondsUnexistent();\n if (_canActivateAfter >= block.timestamp) revert BondsLocked();\n\n if (firstSeen[_keeper] == 0) {\n firstSeen[_keeper] = block.timestamp;\n }\n _keepers.add(_keeper);\n\n uint256 _amount = pendingBonds[_keeper][_bonding];\n delete pendingBonds[_keeper][_bonding];\n\n // bond provided tokens\n bonds[_keeper][_bonding] += _amount;\n if (_bonding == keep3rV1) {\n totalBonds += _amount;\n _depositBonds(_amount);\n }\n\n emit Activation(_keeper, _bonding, _amount);\n }\n\n /// @inheritdoc IKeep3rKeeperFundable\n function unbond(address _bonding, uint256 _amount) external override {\n canWithdrawAfter[msg.sender][_bonding] = block.timestamp + unbondTime;\n bonds[msg.sender][_bonding] -= _amount;\n pendingUnbonds[msg.sender][_bonding] += _amount;\n\n emit Unbonding(msg.sender, _bonding, _amount);\n }\n\n /// @inheritdoc IKeep3rKeeperFundable\n function withdraw(address _bonding) external override nonReentrant {\n if (pendingUnbonds[msg.sender][_bonding] == 0) revert UnbondsUnexistent();\n if (canWithdrawAfter[msg.sender][_bonding] >= block.timestamp) revert UnbondsLocked();\n if (disputes[msg.sender]) revert Disputed();\n\n uint256 _amount = pendingUnbonds[msg.sender][_bonding];\n\n delete pendingUnbonds[msg.sender][_bonding];\n delete canWithdrawAfter[msg.sender][_bonding];\n\n if (_bonding == keep3rV1) _mint(_amount);\n IERC20(_bonding).safeTransfer(msg.sender, _amount);\n\n emit Withdrawal(msg.sender, _bonding, _amount);\n }\n\n function _depositBonds(uint256 _amount) internal virtual {\n IKeep3rV1(keep3rV1).burn(_amount);\n }\n}\n" - }, - "solidity/interfaces/external/IKeep3rV1.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '@openzeppelin/contracts/token/ERC20/IERC20.sol';\nimport '@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol';\n\n// solhint-disable func-name-mixedcase\ninterface IKeep3rV1 is IERC20, IERC20Metadata {\n // Structs\n struct Checkpoint {\n uint32 fromBlock;\n uint256 votes;\n }\n\n // Events\n event DelegateChanged(address indexed _delegator, address indexed _fromDelegate, address indexed _toDelegate);\n event DelegateVotesChanged(address indexed _delegate, uint256 _previousBalance, uint256 _newBalance);\n event SubmitJob(address indexed _job, address indexed _liquidity, address indexed _provider, uint256 _block, uint256 _credit);\n event ApplyCredit(address indexed _job, address indexed _liquidity, address indexed _provider, uint256 _block, uint256 _credit);\n event RemoveJob(address indexed _job, address indexed _liquidity, address indexed _provider, uint256 _block, uint256 _credit);\n event UnbondJob(address indexed _job, address indexed _liquidity, address indexed _provider, uint256 _block, uint256 _credit);\n event JobAdded(address indexed _job, uint256 _block, address _governance);\n event JobRemoved(address indexed _job, uint256 _block, address _governance);\n event KeeperWorked(address indexed _credit, address indexed _job, address indexed _keeper, uint256 _block, uint256 _amount);\n event KeeperBonding(address indexed _keeper, uint256 _block, uint256 _active, uint256 _bond);\n event KeeperBonded(address indexed _keeper, uint256 _block, uint256 _activated, uint256 _bond);\n event KeeperUnbonding(address indexed _keeper, uint256 _block, uint256 _deactive, uint256 _bond);\n event KeeperUnbound(address indexed _keeper, uint256 _block, uint256 _deactivated, uint256 _bond);\n event KeeperSlashed(address indexed _keeper, address indexed _slasher, uint256 _block, uint256 _slash);\n event KeeperDispute(address indexed _keeper, uint256 _block);\n event KeeperResolved(address indexed _keeper, uint256 _block);\n event TokenCreditAddition(address indexed _credit, address indexed _job, address indexed _creditor, uint256 _block, uint256 _amount);\n\n // Variables\n function KPRH() external returns (address);\n\n function delegates(address _delegator) external view returns (address);\n\n function checkpoints(address _account, uint32 _checkpoint) external view returns (Checkpoint memory);\n\n function numCheckpoints(address _account) external view returns (uint32);\n\n function DOMAIN_TYPEHASH() external returns (bytes32);\n\n function DOMAINSEPARATOR() external returns (bytes32);\n\n function DELEGATION_TYPEHASH() external returns (bytes32);\n\n function PERMIT_TYPEHASH() external returns (bytes32);\n\n function nonces(address _user) external view returns (uint256);\n\n function BOND() external returns (uint256);\n\n function UNBOND() external returns (uint256);\n\n function LIQUIDITYBOND() external returns (uint256);\n\n function FEE() external returns (uint256);\n\n function BASE() external returns (uint256);\n\n function ETH() external returns (address);\n\n function bondings(address _user, address _bonding) external view returns (uint256);\n\n function canWithdrawAfter(address _user, address _bonding) external view returns (uint256);\n\n function pendingUnbonds(address _keeper, address _bonding) external view returns (uint256);\n\n function pendingbonds(address _keeper, address _bonding) external view returns (uint256);\n\n function bonds(address _keeper, address _bonding) external view returns (uint256);\n\n function votes(address _delegator) external view returns (uint256);\n\n function firstSeen(address _keeper) external view returns (uint256);\n\n function disputes(address _keeper) external view returns (bool);\n\n function lastJob(address _keeper) external view returns (uint256);\n\n function workCompleted(address _keeper) external view returns (uint256);\n\n function jobs(address _job) external view returns (bool);\n\n function credits(address _job, address _credit) external view returns (uint256);\n\n function liquidityProvided(\n address _provider,\n address _liquidity,\n address _job\n ) external view returns (uint256);\n\n function liquidityUnbonding(\n address _provider,\n address _liquidity,\n address _job\n ) external view returns (uint256);\n\n function liquidityAmountsUnbonding(\n address _provider,\n address _liquidity,\n address _job\n ) external view returns (uint256);\n\n function jobProposalDelay(address _job) external view returns (uint256);\n\n function liquidityApplied(\n address _provider,\n address _liquidity,\n address _job\n ) external view returns (uint256);\n\n function liquidityAmount(\n address _provider,\n address _liquidity,\n address _job\n ) external view returns (uint256);\n\n function keepers(address _keeper) external view returns (bool);\n\n function blacklist(address _keeper) external view returns (bool);\n\n function keeperList(uint256 _index) external view returns (address);\n\n function jobList(uint256 _index) external view returns (address);\n\n function governance() external returns (address);\n\n function pendingGovernance() external returns (address);\n\n function liquidityAccepted(address _liquidity) external view returns (bool);\n\n function liquidityPairs(uint256 _index) external view returns (address);\n\n // Methods\n function getCurrentVotes(address _account) external view returns (uint256);\n\n function addCreditETH(address _job) external payable;\n\n function addCredit(\n address _credit,\n address _job,\n uint256 _amount\n ) external;\n\n function addVotes(address _voter, uint256 _amount) external;\n\n function removeVotes(address _voter, uint256 _amount) external;\n\n function addKPRCredit(address _job, uint256 _amount) external;\n\n function approveLiquidity(address _liquidity) external;\n\n function revokeLiquidity(address _liquidity) external;\n\n function pairs() external view returns (address[] memory);\n\n function addLiquidityToJob(\n address _liquidity,\n address _job,\n uint256 _amount\n ) external;\n\n function applyCreditToJob(\n address _provider,\n address _liquidity,\n address _job\n ) external;\n\n function unbondLiquidityFromJob(\n address _liquidity,\n address _job,\n uint256 _amount\n ) external;\n\n function removeLiquidityFromJob(address _liquidity, address _job) external;\n\n function mint(uint256 _amount) external;\n\n function burn(uint256 _amount) external;\n\n function worked(address _keeper) external;\n\n function receipt(\n address _credit,\n address _keeper,\n uint256 _amount\n ) external;\n\n function receiptETH(address _keeper, uint256 _amount) external;\n\n function addJob(address _job) external;\n\n function getJobs() external view returns (address[] memory);\n\n function removeJob(address _job) external;\n\n function setKeep3rHelper(address _keep3rHelper) external;\n\n function setGovernance(address _governance) external;\n\n function acceptGovernance() external;\n\n function isKeeper(address _keeper) external returns (bool);\n\n function isMinKeeper(\n address _keeper,\n uint256 _minBond,\n uint256 _earned,\n uint256 _age\n ) external returns (bool);\n\n function isBondedKeeper(\n address _keeper,\n address _bond,\n uint256 _minBond,\n uint256 _earned,\n uint256 _age\n ) external returns (bool);\n\n function bond(address _bonding, uint256 _amount) external;\n\n function getKeepers() external view returns (address[] memory);\n\n function activate(address _bonding) external;\n\n function unbond(address _bonding, uint256 _amount) external;\n\n function slash(\n address _bonded,\n address _keeper,\n uint256 _amount\n ) external;\n\n function withdraw(address _bonding) external;\n\n function dispute(address _keeper) external;\n\n function revoke(address _keeper) external;\n\n function resolve(address _keeper) external;\n\n function permit(\n address _owner,\n address _spender,\n uint256 _amount,\n uint256 _deadline,\n uint8 _v,\n bytes32 _r,\n bytes32 _s\n ) external;\n}\n" - }, - "solidity/for-test/testnet/Keep3rForTestnet.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../../contracts/Keep3r.sol';\n\ncontract Keep3rForTestnet is Keep3r {\n constructor(\n address _governor,\n address _keep3rHelper,\n address _keep3rV1,\n address _keep3rV1Proxy\n ) Keep3r(_governor, _keep3rHelper, _keep3rV1, _keep3rV1Proxy) {\n bondTime = 0; // allows keepers to instantly register\n unbondTime = 0; // allows keepers & jobOwners to instantly withdraw funds\n liquidityMinimum = 1; // allows job providers to add low liquidity\n rewardPeriodTime = 1 days; // reduces twap calculation period\n inflationPeriod = 5 days; // increases credit minting\n }\n}\n" - }, - "solidity/for-test/Keep3rForTest.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../contracts/Keep3r.sol';\n\ncontract Keep3rForTest is Keep3r {\n constructor(\n address _governor,\n address _keep3rHelper,\n address _keep3rV1,\n address _keep3rV1Proxy\n ) Keep3r(_governor, _keep3rHelper, _keep3rV1, _keep3rV1Proxy) {}\n}\n" - }, - "solidity/contracts/sidechain/Keep3rSidechain.sol": { - "content": "// SPDX-License-Identifier: MIT\n\n/*\n\nCoded for The Keep3r Network with ♥ by\n\n██████╗░███████╗███████╗██╗░░░██╗░░░░░░░██╗░█████╗░███╗░░██╗██████╗░███████╗██████╗░██╗░░░░░░█████╗░███╗░░██╗██████╗░\n██╔══██╗██╔════╝██╔════╝██║░░░██║░░██╗░░██║██╔══██╗████╗░██║██╔══██╗██╔════╝██╔══██╗██║░░░░░██╔══██╗████╗░██║██╔══██╗\n██║░░██║█████╗░░█████╗░░██║░░░╚██╗████╗██╔╝██║░░██║██╔██╗██║██║░░██║█████╗░░██████╔╝██║░░░░░███████║██╔██╗██║██║░░██║\n██║░░██║██╔══╝░░██╔══╝░░██║░░░░████╔═████║░██║░░██║██║╚████║██║░░██║██╔══╝░░██╔══██╗██║░░░░░██╔══██║██║╚████║██║░░██║\n██████╔╝███████╗██║░░░░░██║░░░░╚██╔╝░╚██╔╝░╚█████╔╝██║░╚███║██████╔╝███████╗██║░░██║███████╗██║░░██║██║░╚███║██████╔╝\n╚═════╝░╚══════╝╚═╝░░░░░╚═╝░░░░░╚═╝░░░╚═╝░░░╚════╝░╚═╝░░╚══╝╚═════╝░╚══════╝╚═╝░░╚═╝╚══════╝╚═╝░░╚═╝╚═╝░░╚══╝╚═════╝░\n\nhttps://defi.sucks\n\nCommit hash: ead559c8dc4361349b7222741c2399447e255d8e\n\n*/\n\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../Keep3r.sol';\nimport '../../interfaces/sidechain/IKeep3rEscrow.sol';\nimport '../../interfaces/sidechain/IKeep3rHelperSidechain.sol';\nimport '../../interfaces/sidechain/IKeep3rJobWorkableRated.sol';\nimport '../../interfaces/sidechain/IKeep3rSidechainAccountance.sol';\n\ncontract Keep3rSidechain is Keep3r, IKeep3rJobWorkableRated, IKeep3rSidechainAccountance {\n using EnumerableSet for EnumerableSet.AddressSet;\n\n /// @param _governor Address of governor\n /// @param _keep3rHelperSidechain Address of sidechain Keep3rHelper\n /// @param _wrappedKP3R Address of wrapped KP3R implementation\n /// @param _keep3rEscrow Address of sidechain Keep3rEscrow\n constructor(\n address _governor, // governor\n address _keep3rHelperSidechain, // helper\n address _wrappedKP3R, // keep3rV1\n address _keep3rEscrow // keep3rV1Proxy\n ) Keep3r(_governor, _keep3rHelperSidechain, _wrappedKP3R, _keep3rEscrow) {}\n\n // Keep3rSidechainAccountance\n\n /// @inheritdoc IKeep3rSidechainAccountance\n function virtualReserves() external view override returns (int256 _virtualReserves) {\n // Queries wKP3R balanceOf escrow contract minus the totalBonds\n return int256(IERC20(keep3rV1).balanceOf(keep3rV1Proxy)) - int256(totalBonds);\n }\n\n // Keep3rJobFundableLiquidity\n\n /// @notice Sidechain implementation asks the Helper for an oracle, instead of reading it from the ERC-20\n /// @dev Function should be called after setting an oracle in Keep3rHelperSidechain\n /// @param _liquidity Address of the liquidity token being approved\n function approveLiquidity(address _liquidity) external virtual override onlyGovernor {\n if (!_approvedLiquidities.add(_liquidity)) revert LiquidityPairApproved();\n _liquidityPool[_liquidity] = IKeep3rHelperSidechain(keep3rHelper).oracle(_liquidity);\n if (_liquidityPool[_liquidity] == address(0)) revert ZeroAddress();\n _isKP3RToken0[_liquidity] = IKeep3rHelper(keep3rHelper).isKP3RToken0(_liquidityPool[_liquidity]);\n _tick[_liquidity] = observeLiquidity(_liquidity);\n emit LiquidityApproval(_liquidity);\n }\n\n /// @notice Sidechain implementation will always ask for 2 tickCumulatives instead of cacheing\n /// @param _liquidity Address of the liquidity token being observed\n function observeLiquidity(address _liquidity) public view virtual override returns (TickCache memory _tickCache) {\n if (_tick[_liquidity].period == _period(block.timestamp)) {\n // Will return cached twaps if liquidity is updated\n _tickCache = _tick[_liquidity];\n } else {\n bool success;\n\n // Will always ask for 2 accumulators in sidechain\n uint32[] memory _secondsAgo = new uint32[](2);\n\n _secondsAgo[0] = uint32(block.timestamp - _period(block.timestamp));\n _secondsAgo[1] = uint32(block.timestamp - _period(block.timestamp) + rewardPeriodTime);\n\n int56 _tickCumulative2;\n (_tickCache.current, _tickCumulative2, success) = IKeep3rHelper(keep3rHelper).observe(_liquidityPool[_liquidity], _secondsAgo);\n\n _tickCache.difference = _tickCache.current - _tickCumulative2;\n\n if (success) {\n _tickCache.period = _period(block.timestamp);\n } else {\n delete _tickCache.period;\n }\n }\n }\n\n // Keep3rJobsWorkable\n\n /// @dev Sidechain implementation deprecates worked(address) as it should come with a usdPerGasUnit parameter\n function worked(address) external pure override {\n revert Deprecated();\n }\n\n /// @notice Implemented by jobs to show that a keeper performed work\n /// @dev Uses a USD per gas unit payment mechanism\n /// @param _keeper Address of the keeper that performed the work\n /// @param _usdPerGasUnit Units of USD (in wei) per gas unit that should be rewarded to the keeper\n function worked(address _keeper, uint256 _usdPerGasUnit) external override {\n if (_initialGas == 0) revert GasNotInitialized();\n // Gas used for quote calculations & payment is not rewarded\n uint256 _gasLeft = _getGasLeft();\n\n address _job = msg.sender;\n if (disputes[_job]) revert JobDisputed();\n if (!_jobs.contains(_job)) revert JobUnapproved();\n\n if (_updateJobCreditsIfNeeded(_job)) {\n emit LiquidityCreditsReward(_job, rewardedAt[_job], _jobLiquidityCredits[_job], _jobPeriodCredits[_job]);\n }\n\n (uint256 _boost, uint256 _oneUsdQuote, uint256 _extraGas) = IKeep3rHelper(keep3rHelper).getPaymentParams(bonds[_keeper][keep3rV1]);\n\n uint256 _kp3rPayment = _calculatePayment(_gasLeft, _extraGas, _oneUsdQuote * _usdPerGasUnit, _boost);\n\n if (_kp3rPayment > _jobLiquidityCredits[_job]) {\n _rewardJobCredits(_job);\n emit LiquidityCreditsReward(_job, rewardedAt[_job], _jobLiquidityCredits[_job], _jobPeriodCredits[_job]);\n }\n\n _bondedPayment(_job, _keeper, _kp3rPayment);\n delete _initialGas;\n\n emit KeeperWork(keep3rV1, _job, _keeper, _kp3rPayment, _gasLeft);\n }\n\n // Keep3rKeeperFundable\n\n /// @dev Sidechain implementation doesn't burn tokens, but deposit them in Keep3rEscrow\n function _depositBonds(uint256 _amount) internal virtual override {\n IKeep3rV1(keep3rV1).approve(keep3rV1Proxy, _amount);\n IKeep3rEscrow(keep3rV1Proxy).deposit(_amount);\n }\n}\n" - }, - "solidity/interfaces/sidechain/IKeep3rEscrow.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\n// solhint-disable-next-line no-empty-blocks\n\nimport '../peripherals/IMintable.sol';\n\n/// @title Keep3rEscrow contract\n/// @notice This contract acts as an escrow contract for wKP3R tokens on sidechains and L2s\n/// @dev Can be used as a replacement for keep3rV1Proxy in keep3r sidechain implementations\ninterface IKeep3rEscrow is IMintable {\n /// @notice Emitted when Keep3rEscrow#deposit function is called\n /// @param _wKP3R The addess of the wrapped KP3R token\n /// @param _sender The address that called the function\n /// @param _amount The amount of wKP3R the user deposited\n event wKP3RDeposited(address _wKP3R, address _sender, uint256 _amount);\n\n /// @notice Emitted when Keep3rEscrow#mint function is called\n /// @param _wKP3R The addess of the wrapped KP3R token\n /// @param _recipient The address that will received the newly minted wKP3R\n /// @param _amount The amount of wKP3R minted to the recipient\n event wKP3RMinted(address _wKP3R, address _recipient, uint256 _amount);\n\n /// @notice Emitted when Keep3rEscrow#setWKP3R function is called\n /// @param _newWKP3R The address of the wKP3R contract\n event wKP3RSet(address _newWKP3R);\n\n /// @notice Throws when minter attempts to withdraw more wKP3R than the escrow has in its balance\n error InsufficientBalance();\n\n /// @notice Lists the address of the wKP3R contract\n /// @return _wKP3RAddress The address of wKP3R\n function wKP3R() external view returns (address _wKP3RAddress);\n\n /// @notice Deposits wKP3R into the contract\n /// @param _amount The amount of wKP3R to deposit\n function deposit(uint256 _amount) external;\n\n /// @notice mints wKP3R to the recipient\n /// @param _amount The amount of wKP3R to mint\n function mint(uint256 _amount) external;\n\n /// @notice sets the wKP3R address\n /// @param _wKP3R the wKP3R address\n function setWKP3R(address _wKP3R) external;\n}\n" - }, - "solidity/interfaces/sidechain/IKeep3rHelperSidechain.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../IKeep3rHelper.sol';\n\n/// @title Keep3rHelperSidechain contract\n/// @notice Contains all the helper functions for sidechain keep3r implementations\ninterface IKeep3rHelperSidechain is IKeep3rHelper {\n // Structs\n\n /// @dev WETH-USD Pool address, isWETHToken0 and usdDecimals\n /// @dev Created in order to quote any kind of USD tokens\n struct WethUsdOraclePool {\n address poolAddress;\n bool isWETHToken0;\n uint8 usdDecimals;\n }\n\n // Events\n\n /// @notice The oracle for a liquidity has been saved\n /// @param _liquidity The address of the given liquidity\n /// @param _oraclePool The address of the oracle pool\n event OracleSet(address _liquidity, address _oraclePool);\n\n /// @notice Emitted when the WETH USD pool is changed\n /// @param _address Address of the new WETH USD pool\n /// @param _isWETHToken0 True if calling the token0 method of the pool returns the WETH token address\n /// @param _usdDecimals The amount of decimals of the USD token paired with ETH\n event WethUSDPoolChange(address _address, bool _isWETHToken0, uint8 _usdDecimals);\n\n /// Variables\n\n /// @notice Ethereum mainnet WETH address used for quoting references\n /// @return _weth Address of WETH token\n // solhint-disable func-name-mixedcase\n function WETH() external view returns (address _weth);\n\n /// @return _oracle The address of the observable pool for given liquidity\n function oracle(address _liquidity) external view returns (address _oracle);\n\n /// @notice WETH-USD pool that is being used as oracle\n /// @return poolAddress Address of the pool\n /// @return isWETHToken0 True if calling the token0 method of the pool returns the WETH token address\n /// @return usdDecimals The amount of decimals of the USD token paired with ETH\n function wethUSDPool()\n external\n view\n returns (\n address poolAddress,\n bool isWETHToken0,\n uint8 usdDecimals\n );\n\n /// @notice Quotes USD to ETH\n /// @dev Used to know how much ETH should be paid to keepers before converting it from ETH to KP3R\n /// @param _usd The amount of USD to quote to ETH\n /// @return _eth The resulting amount of ETH after quoting the USD\n function quoteUsdToEth(uint256 _usd) external returns (uint256 _eth);\n\n /// Methods\n\n /// @notice Sets an oracle for a given liquidity\n /// @param _liquidity The address of the liquidity\n /// @param _oracle The address of the pool used to quote the liquidity from\n /// @dev The oracle must contain KP3R as either token0 or token1\n function setOracle(address _liquidity, address _oracle) external;\n\n /// @notice Sets an oracle for querying WETH/USD quote\n /// @param _poolAddress The address of the pool used as oracle\n /// @param _usdDecimals The amount of decimals of the USD token paired with ETH\n /// @dev The oracle must contain WETH as either token0 or token1\n function setWethUsdPool(address _poolAddress, uint8 _usdDecimals) external;\n}\n" - }, - "solidity/interfaces/sidechain/IKeep3rJobWorkableRated.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../peripherals/IKeep3rJobs.sol';\n\n/// @title Keep3rJobWorkableRated contract\n/// @notice Implements a quoting in USD per gas unit for Keep3r jobs\ninterface IKeep3rJobWorkableRated is IKeep3rJobs {\n /// @notice Throws when job contract calls deprecated worked(address) function\n error Deprecated();\n\n /// @notice Implemented by jobs to show that a keeper performed work and reward in stable USD quote\n /// @dev Automatically calculates the payment for the keeper and pays the keeper with bonded KP3R\n /// @param _keeper Address of the keeper that performed the work\n /// @param _usdPerGasUnit Amount of USD in wei rewarded for gas unit worked by the keeper\n function worked(address _keeper, uint256 _usdPerGasUnit) external;\n}\n" - }, - "solidity/interfaces/sidechain/IKeep3rSidechainAccountance.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\n/// @title IKeep3rSidechainAccountance interface\n/// @notice Implements a view to get the amount of credits that can be withdrawn\ninterface IKeep3rSidechainAccountance {\n /// @notice The surplus amount of wKP3Rs in escrow contract\n /// @return _virtualReserves The surplus amount of wKP3Rs in escrow contract\n function virtualReserves() external view returns (int256 _virtualReserves);\n}\n" - }, - "solidity/interfaces/peripherals/IMintable.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '@defi-wonderland/solidity-utils/solidity/interfaces/IBaseErrors.sol';\nimport '@defi-wonderland/solidity-utils/solidity/interfaces/IGovernable.sol';\n\n/// @title Mintable contract\n/// @notice Manages the minter role\ninterface IMintable is IBaseErrors, IGovernable {\n // Events\n\n /// @notice Emitted when governor sets a new minter\n /// @param _minter Address of the new minter\n event MinterSet(address _minter);\n\n // Errors\n\n /// @notice Throws if the caller of the function is not the minter\n error OnlyMinter();\n\n // Variables\n\n /// @notice Stores the minter address\n /// @return _minter The minter addresss\n function minter() external view returns (address _minter);\n\n // Methods\n\n /// @notice Sets a new address to be the minter\n /// @param _minter The address set as the minter\n function setMinter(address _minter) external;\n}\n" - }, - "solidity/for-test/testnet/Keep3rSidechainForTestnet.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../../contracts/sidechain/Keep3rSidechain.sol';\n\ncontract Keep3rSidechainForTestnet is Keep3rSidechain {\n constructor(\n address _governor,\n address _keep3rHelper,\n address _keep3rV1,\n address _keep3rV1Proxy\n ) Keep3rSidechain(_governor, _keep3rHelper, _keep3rV1, _keep3rV1Proxy) {\n bondTime = 0; // allows keepers to instantly register\n unbondTime = 0; // allows keepers & jobOwners to instantly withdraw funds\n liquidityMinimum = 1; // allows job providers to add low liquidity\n rewardPeriodTime = 1 days; // reduces twap calculation period\n inflationPeriod = 5 days; // increases credit minting\n }\n}\n" - }, - "solidity/for-test/Keep3rSidechainForTest.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../contracts/sidechain/Keep3rSidechain.sol';\n\ncontract Keep3rSidechainForTest is Keep3rSidechain {\n using EnumerableSet for EnumerableSet.AddressSet;\n\n constructor(\n address _governor,\n address _keep3rHelper,\n address _wrappedKP3R,\n address _keep3rEscrow\n ) Keep3rSidechain(_governor, _keep3rHelper, _wrappedKP3R, _keep3rEscrow) {}\n\n function setJobLiquidity(address _job, address _liquidity) external {\n _jobLiquidities[_job].add(_liquidity);\n }\n}\n" - }, - "solidity/for-test/JobRatedForTest.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../interfaces/IKeep3r.sol';\nimport '../interfaces/sidechain/IKeep3rJobWorkableRated.sol';\n\ncontract JobRatedForTest {\n error InvalidKeeper();\n address public keep3r;\n uint256 public nonce;\n uint256 public usdPerGasUnit = 1;\n\n constructor(address _keep3r) {\n keep3r = _keep3r;\n }\n\n function work() external {\n if (!IKeep3r(keep3r).isKeeper(msg.sender)) revert InvalidKeeper();\n\n for (uint256 i = 0; i < 1000; i++) {\n nonce++;\n }\n\n IKeep3rJobWorkableRated(keep3r).worked(msg.sender, usdPerGasUnit);\n }\n\n function workHard(uint256 _factor) external {\n if (!IKeep3r(keep3r).isKeeper(msg.sender)) revert InvalidKeeper();\n\n for (uint256 i = 0; i < 1000 * _factor; i++) {\n nonce++;\n }\n\n IKeep3rJobWorkableRated(keep3r).worked(msg.sender, usdPerGasUnit);\n }\n}\n" - }, - "solidity/for-test/JobForTest.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../interfaces/IKeep3r.sol';\n\ncontract JobForTest {\n error InvalidKeeper();\n address public keep3r;\n uint256 public nonce;\n\n constructor(address _keep3r) {\n keep3r = _keep3r;\n }\n\n function work() external {\n if (!IKeep3r(keep3r).isKeeper(msg.sender)) revert InvalidKeeper();\n\n for (uint256 i; i < 1000; i++) {\n nonce++;\n }\n\n IKeep3r(keep3r).worked(msg.sender);\n }\n\n function workHard(uint256 _factor) external {\n if (!IKeep3r(keep3r).isKeeper(msg.sender)) revert InvalidKeeper();\n\n for (uint256 i; i < 1000 * _factor; i++) {\n nonce++;\n }\n\n IKeep3r(keep3r).worked(msg.sender);\n }\n}\n" - }, - "solidity/for-test/BasicJob.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../interfaces/IKeep3r.sol';\n\ncontract BasicJob {\n error KeeperNotValid();\n\n address public keep3r;\n uint256 public nonce;\n uint256[] public array;\n\n constructor(address _keep3r) {\n keep3r = _keep3r;\n }\n\n function work() external upkeep {}\n\n function workHard(uint256 _howHard) external upkeep {\n for (uint256 i = nonce; i < _howHard; i++) {\n nonce++;\n }\n }\n\n function workRefund(uint256 _howHard) external upkeep {\n for (uint256 i; i < _howHard; i++) {\n array.push(i);\n }\n\n while (array.length > 0) {\n array.pop();\n }\n }\n\n modifier upkeep() {\n if (!IKeep3r(keep3r).isKeeper(msg.sender)) revert KeeperNotValid();\n _;\n IKeep3r(keep3r).worked(msg.sender);\n }\n}\n" - }, - "solidity/contracts/Keep3rHelperParameters.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.7 <0.9.0;\n\nimport './libraries/FullMath.sol';\nimport './libraries/TickMath.sol';\nimport '../interfaces/IKeep3r.sol';\nimport '../interfaces/external/IKeep3rV1.sol';\nimport '../interfaces/IKeep3rHelperParameters.sol';\nimport './Keep3rHelperParameters.sol';\n\nimport '@openzeppelin/contracts/utils/math/Math.sol';\nimport '@uniswap/v3-core/contracts/interfaces/IUniswapV3Pool.sol';\nimport '@defi-wonderland/solidity-utils/solidity/interfaces/IBaseErrors.sol';\nimport '@defi-wonderland/solidity-utils/solidity/contracts/Governable.sol';\n\ncontract Keep3rHelperParameters is IKeep3rHelperParameters, IBaseErrors, Governable {\n /// @inheritdoc IKeep3rHelperParameters\n address public immutable override KP3R;\n\n /// @inheritdoc IKeep3rHelperParameters\n uint256 public constant override BOOST_BASE = 10_000;\n\n /// @inheritdoc IKeep3rHelperParameters\n uint256 public override minBoost = 11_000;\n\n /// @inheritdoc IKeep3rHelperParameters\n uint256 public override maxBoost = 12_000;\n\n /// @inheritdoc IKeep3rHelperParameters\n uint256 public override targetBond = 200 ether;\n\n /// @inheritdoc IKeep3rHelperParameters\n uint256 public override workExtraGas = 34_000;\n\n /// @inheritdoc IKeep3rHelperParameters\n uint32 public override quoteTwapTime = 10 minutes;\n\n /// @inheritdoc IKeep3rHelperParameters\n uint256 public override minBaseFee = 15e9;\n\n /// @inheritdoc IKeep3rHelperParameters\n uint256 public override minPriorityFee = 2e9;\n\n /// @inheritdoc IKeep3rHelperParameters\n address public override keep3rV2;\n\n /// @inheritdoc IKeep3rHelperParameters\n IKeep3rHelperParameters.Kp3rWethOraclePool public override kp3rWethPool;\n\n constructor(\n address _kp3r,\n address _keep3rV2,\n address _governor,\n address _kp3rWethPool\n ) Governable(_governor) {\n KP3R = _kp3r;\n keep3rV2 = _keep3rV2;\n\n // Immutable variables [KP3R] cannot be read during contract creation time [_setKp3rWethPool]\n bool _isKP3RToken0 = _validateOraclePool(_kp3rWethPool, KP3R);\n kp3rWethPool = Kp3rWethOraclePool(_kp3rWethPool, _isKP3RToken0);\n emit Kp3rWethPoolChange(_kp3rWethPool, _isKP3RToken0);\n }\n\n /// @inheritdoc IKeep3rHelperParameters\n function setKp3rWethPool(address _poolAddress) external override onlyGovernor {\n if (_poolAddress == address(0)) revert ZeroAddress();\n _setKp3rWethPool(_poolAddress);\n }\n\n /// @inheritdoc IKeep3rHelperParameters\n function setMinBoost(uint256 _minBoost) external override onlyGovernor {\n minBoost = _minBoost;\n emit MinBoostChange(minBoost);\n }\n\n /// @inheritdoc IKeep3rHelperParameters\n function setMaxBoost(uint256 _maxBoost) external override onlyGovernor {\n maxBoost = _maxBoost;\n emit MaxBoostChange(maxBoost);\n }\n\n /// @inheritdoc IKeep3rHelperParameters\n function setTargetBond(uint256 _targetBond) external override onlyGovernor {\n targetBond = _targetBond;\n emit TargetBondChange(targetBond);\n }\n\n /// @inheritdoc IKeep3rHelperParameters\n function setKeep3rV2(address _keep3rV2) external override onlyGovernor {\n if (_keep3rV2 == address(0)) revert ZeroAddress();\n keep3rV2 = _keep3rV2;\n emit Keep3rV2Change(keep3rV2);\n }\n\n /// @inheritdoc IKeep3rHelperParameters\n function setWorkExtraGas(uint256 _workExtraGas) external override onlyGovernor {\n workExtraGas = _workExtraGas;\n emit WorkExtraGasChange(workExtraGas);\n }\n\n /// @inheritdoc IKeep3rHelperParameters\n function setQuoteTwapTime(uint32 _quoteTwapTime) external override onlyGovernor {\n _setQuoteTwapTime(_quoteTwapTime);\n }\n\n function _setQuoteTwapTime(uint32 _quoteTwapTime) internal {\n quoteTwapTime = _quoteTwapTime;\n emit QuoteTwapTimeChange(quoteTwapTime);\n }\n\n /// @inheritdoc IKeep3rHelperParameters\n function setMinBaseFee(uint256 _minBaseFee) external override onlyGovernor {\n minBaseFee = _minBaseFee;\n emit MinBaseFeeChange(minBaseFee);\n }\n\n /// @inheritdoc IKeep3rHelperParameters\n function setMinPriorityFee(uint256 _minPriorityFee) external override onlyGovernor {\n minPriorityFee = _minPriorityFee;\n emit MinPriorityFeeChange(minPriorityFee);\n }\n\n /// @notice Sets KP3R-WETH pool\n /// @param _poolAddress The address of the KP3R-WETH pool\n function _setKp3rWethPool(address _poolAddress) internal {\n bool _isKP3RToken0 = _validateOraclePool(_poolAddress, KP3R);\n kp3rWethPool = Kp3rWethOraclePool(_poolAddress, _isKP3RToken0);\n emit Kp3rWethPoolChange(_poolAddress, _isKP3RToken0);\n }\n\n function _validateOraclePool(address _poolAddress, address _token) internal view virtual returns (bool _isTKNToken0) {\n _isTKNToken0 = IUniswapV3Pool(_poolAddress).token0() == _token;\n if (!_isTKNToken0 && IUniswapV3Pool(_poolAddress).token1() != _token) revert InvalidOraclePool();\n }\n}\n" - }, - "solidity/contracts/libraries/TickMath.sol": { - "content": "// SPDX-License-Identifier: GPL-2.0-or-later\npragma solidity >=0.5.0;\n\n// solhint-disable\n\n/// @title Math library for computing sqrt prices from ticks and vice versa\n/// @notice Computes sqrt price for ticks of size 1.0001, i.e. sqrt(1.0001^tick) as fixed point Q64.96 numbers. Supports\n/// prices between 2**-128 and 2**128\nlibrary TickMath {\n /// @dev The minimum tick that may be passed to #getSqrtRatioAtTick computed from log base 1.0001 of 2**-128\n int24 internal constant MIN_TICK = -887272;\n /// @dev The maximum tick that may be passed to #getSqrtRatioAtTick computed from log base 1.0001 of 2**128\n int24 internal constant MAX_TICK = -MIN_TICK;\n\n /// @dev The minimum value that can be returned from #getSqrtRatioAtTick. Equivalent to getSqrtRatioAtTick(MIN_TICK)\n uint160 internal constant MIN_SQRT_RATIO = 4295128739;\n /// @dev The maximum value that can be returned from #getSqrtRatioAtTick. Equivalent to getSqrtRatioAtTick(MAX_TICK)\n uint160 internal constant MAX_SQRT_RATIO = 1461446703485210103287273052203988822378723970342;\n\n /// @notice Calculates sqrt(1.0001^tick) * 2^96\n /// @dev Throws if |tick| > max tick\n /// @param tick The input tick for the above formula\n /// @return sqrtPriceX96 A Fixed point Q64.96 number representing the sqrt of the ratio of the two assets (token1/token0)\n /// at the given tick\n function getSqrtRatioAtTick(int24 tick) internal pure returns (uint160 sqrtPriceX96) {\n uint256 absTick = tick < 0 ? uint256(-int256(tick)) : uint256(int256(tick));\n require(absTick <= uint256(int256(MAX_TICK)), 'T');\n\n uint256 ratio = absTick & 0x1 != 0 ? 0xfffcb933bd6fad37aa2d162d1a594001 : 0x100000000000000000000000000000000;\n if (absTick & 0x2 != 0) ratio = (ratio * 0xfff97272373d413259a46990580e213a) >> 128;\n if (absTick & 0x4 != 0) ratio = (ratio * 0xfff2e50f5f656932ef12357cf3c7fdcc) >> 128;\n if (absTick & 0x8 != 0) ratio = (ratio * 0xffe5caca7e10e4e61c3624eaa0941cd0) >> 128;\n if (absTick & 0x10 != 0) ratio = (ratio * 0xffcb9843d60f6159c9db58835c926644) >> 128;\n if (absTick & 0x20 != 0) ratio = (ratio * 0xff973b41fa98c081472e6896dfb254c0) >> 128;\n if (absTick & 0x40 != 0) ratio = (ratio * 0xff2ea16466c96a3843ec78b326b52861) >> 128;\n if (absTick & 0x80 != 0) ratio = (ratio * 0xfe5dee046a99a2a811c461f1969c3053) >> 128;\n if (absTick & 0x100 != 0) ratio = (ratio * 0xfcbe86c7900a88aedcffc83b479aa3a4) >> 128;\n if (absTick & 0x200 != 0) ratio = (ratio * 0xf987a7253ac413176f2b074cf7815e54) >> 128;\n if (absTick & 0x400 != 0) ratio = (ratio * 0xf3392b0822b70005940c7a398e4b70f3) >> 128;\n if (absTick & 0x800 != 0) ratio = (ratio * 0xe7159475a2c29b7443b29c7fa6e889d9) >> 128;\n if (absTick & 0x1000 != 0) ratio = (ratio * 0xd097f3bdfd2022b8845ad8f792aa5825) >> 128;\n if (absTick & 0x2000 != 0) ratio = (ratio * 0xa9f746462d870fdf8a65dc1f90e061e5) >> 128;\n if (absTick & 0x4000 != 0) ratio = (ratio * 0x70d869a156d2a1b890bb3df62baf32f7) >> 128;\n if (absTick & 0x8000 != 0) ratio = (ratio * 0x31be135f97d08fd981231505542fcfa6) >> 128;\n if (absTick & 0x10000 != 0) ratio = (ratio * 0x9aa508b5b7a84e1c677de54f3e99bc9) >> 128;\n if (absTick & 0x20000 != 0) ratio = (ratio * 0x5d6af8dedb81196699c329225ee604) >> 128;\n if (absTick & 0x40000 != 0) ratio = (ratio * 0x2216e584f5fa1ea926041bedfe98) >> 128;\n if (absTick & 0x80000 != 0) ratio = (ratio * 0x48a170391f7dc42444e8fa2) >> 128;\n\n if (tick > 0) ratio = type(uint256).max / ratio;\n\n // Divides by 1<<32 rounding up to go from a Q128.128 to a Q128.96.\n // we then downcast because we know the result always fits within 160 bits due to our tick input constraint\n // we round up in the division so getTickAtSqrtRatio of the output price is always consistent\n sqrtPriceX96 = uint160((ratio >> 32) + (ratio % (1 << 32) == 0 ? 0 : 1));\n }\n\n /// @notice Calculates the greatest tick value such that getRatioAtTick(tick) <= ratio\n /// @dev Throws in case sqrtPriceX96 < MIN_SQRT_RATIO, as MIN_SQRT_RATIO is the lowest value getRatioAtTick may ever return.\n /// @param sqrtPriceX96 The sqrt ratio for which to compute the tick as a Q64.96\n /// @return tick The greatest tick for which the ratio is less than or equal to the input ratio\n function getTickAtSqrtRatio(uint160 sqrtPriceX96) internal pure returns (int24 tick) {\n // Second inequality must be < because the price can never reach the price at the max tick\n require(sqrtPriceX96 >= MIN_SQRT_RATIO && sqrtPriceX96 < MAX_SQRT_RATIO, 'R');\n uint256 ratio = uint256(sqrtPriceX96) << 32;\n\n uint256 r = ratio;\n uint256 msb = 0;\n\n assembly {\n let f := shl(7, gt(r, 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF))\n msb := or(msb, f)\n r := shr(f, r)\n }\n assembly {\n let f := shl(6, gt(r, 0xFFFFFFFFFFFFFFFF))\n msb := or(msb, f)\n r := shr(f, r)\n }\n assembly {\n let f := shl(5, gt(r, 0xFFFFFFFF))\n msb := or(msb, f)\n r := shr(f, r)\n }\n assembly {\n let f := shl(4, gt(r, 0xFFFF))\n msb := or(msb, f)\n r := shr(f, r)\n }\n assembly {\n let f := shl(3, gt(r, 0xFF))\n msb := or(msb, f)\n r := shr(f, r)\n }\n assembly {\n let f := shl(2, gt(r, 0xF))\n msb := or(msb, f)\n r := shr(f, r)\n }\n assembly {\n let f := shl(1, gt(r, 0x3))\n msb := or(msb, f)\n r := shr(f, r)\n }\n assembly {\n let f := gt(r, 0x1)\n msb := or(msb, f)\n }\n\n if (msb >= 128) r = ratio >> (msb - 127);\n else r = ratio << (127 - msb);\n\n int256 log_2 = (int256(msb) - 128) << 64;\n\n assembly {\n r := shr(127, mul(r, r))\n let f := shr(128, r)\n log_2 := or(log_2, shl(63, f))\n r := shr(f, r)\n }\n assembly {\n r := shr(127, mul(r, r))\n let f := shr(128, r)\n log_2 := or(log_2, shl(62, f))\n r := shr(f, r)\n }\n assembly {\n r := shr(127, mul(r, r))\n let f := shr(128, r)\n log_2 := or(log_2, shl(61, f))\n r := shr(f, r)\n }\n assembly {\n r := shr(127, mul(r, r))\n let f := shr(128, r)\n log_2 := or(log_2, shl(60, f))\n r := shr(f, r)\n }\n assembly {\n r := shr(127, mul(r, r))\n let f := shr(128, r)\n log_2 := or(log_2, shl(59, f))\n r := shr(f, r)\n }\n assembly {\n r := shr(127, mul(r, r))\n let f := shr(128, r)\n log_2 := or(log_2, shl(58, f))\n r := shr(f, r)\n }\n assembly {\n r := shr(127, mul(r, r))\n let f := shr(128, r)\n log_2 := or(log_2, shl(57, f))\n r := shr(f, r)\n }\n assembly {\n r := shr(127, mul(r, r))\n let f := shr(128, r)\n log_2 := or(log_2, shl(56, f))\n r := shr(f, r)\n }\n assembly {\n r := shr(127, mul(r, r))\n let f := shr(128, r)\n log_2 := or(log_2, shl(55, f))\n r := shr(f, r)\n }\n assembly {\n r := shr(127, mul(r, r))\n let f := shr(128, r)\n log_2 := or(log_2, shl(54, f))\n r := shr(f, r)\n }\n assembly {\n r := shr(127, mul(r, r))\n let f := shr(128, r)\n log_2 := or(log_2, shl(53, f))\n r := shr(f, r)\n }\n assembly {\n r := shr(127, mul(r, r))\n let f := shr(128, r)\n log_2 := or(log_2, shl(52, f))\n r := shr(f, r)\n }\n assembly {\n r := shr(127, mul(r, r))\n let f := shr(128, r)\n log_2 := or(log_2, shl(51, f))\n r := shr(f, r)\n }\n assembly {\n r := shr(127, mul(r, r))\n let f := shr(128, r)\n log_2 := or(log_2, shl(50, f))\n }\n\n int256 log_sqrt10001 = log_2 * 255738958999603826347141; // 128.128 number\n\n int24 tickLow = int24((log_sqrt10001 - 3402992956809132418596140100660247210) >> 128);\n int24 tickHi = int24((log_sqrt10001 + 291339464771989622907027621153398088495) >> 128);\n\n tick = tickLow == tickHi ? tickLow : getSqrtRatioAtTick(tickHi) <= sqrtPriceX96 ? tickHi : tickLow;\n }\n}\n" - }, - "@uniswap/v3-core/contracts/interfaces/IUniswapV3Pool.sol": { - "content": "// SPDX-License-Identifier: GPL-2.0-or-later\npragma solidity >=0.5.0;\n\nimport './pool/IUniswapV3PoolImmutables.sol';\nimport './pool/IUniswapV3PoolState.sol';\nimport './pool/IUniswapV3PoolDerivedState.sol';\nimport './pool/IUniswapV3PoolActions.sol';\nimport './pool/IUniswapV3PoolOwnerActions.sol';\nimport './pool/IUniswapV3PoolEvents.sol';\n\n/// @title The interface for a Uniswap V3 Pool\n/// @notice A Uniswap pool facilitates swapping and automated market making between any two assets that strictly conform\n/// to the ERC20 specification\n/// @dev The pool interface is broken up into many smaller pieces\ninterface IUniswapV3Pool is\n IUniswapV3PoolImmutables,\n IUniswapV3PoolState,\n IUniswapV3PoolDerivedState,\n IUniswapV3PoolActions,\n IUniswapV3PoolOwnerActions,\n IUniswapV3PoolEvents\n{\n\n}\n" - }, - "@uniswap/v3-core/contracts/interfaces/pool/IUniswapV3PoolImmutables.sol": { - "content": "// SPDX-License-Identifier: GPL-2.0-or-later\npragma solidity >=0.5.0;\n\n/// @title Pool state that never changes\n/// @notice These parameters are fixed for a pool forever, i.e., the methods will always return the same values\ninterface IUniswapV3PoolImmutables {\n /// @notice The contract that deployed the pool, which must adhere to the IUniswapV3Factory interface\n /// @return The contract address\n function factory() external view returns (address);\n\n /// @notice The first of the two tokens of the pool, sorted by address\n /// @return The token contract address\n function token0() external view returns (address);\n\n /// @notice The second of the two tokens of the pool, sorted by address\n /// @return The token contract address\n function token1() external view returns (address);\n\n /// @notice The pool's fee in hundredths of a bip, i.e. 1e-6\n /// @return The fee\n function fee() external view returns (uint24);\n\n /// @notice The pool tick spacing\n /// @dev Ticks can only be used at multiples of this value, minimum of 1 and always positive\n /// e.g.: a tickSpacing of 3 means ticks can be initialized every 3rd tick, i.e., ..., -6, -3, 0, 3, 6, ...\n /// This value is an int24 to avoid casting even though it is always positive.\n /// @return The tick spacing\n function tickSpacing() external view returns (int24);\n\n /// @notice The maximum amount of position liquidity that can use any tick in the range\n /// @dev This parameter is enforced per tick to prevent liquidity from overflowing a uint128 at any point, and\n /// also prevents out-of-range liquidity from being used to prevent adding in-range liquidity to a pool\n /// @return The max amount of liquidity per tick\n function maxLiquidityPerTick() external view returns (uint128);\n}\n" - }, - "@uniswap/v3-core/contracts/interfaces/pool/IUniswapV3PoolState.sol": { - "content": "// SPDX-License-Identifier: GPL-2.0-or-later\npragma solidity >=0.5.0;\n\n/// @title Pool state that can change\n/// @notice These methods compose the pool's state, and can change with any frequency including multiple times\n/// per transaction\ninterface IUniswapV3PoolState {\n /// @notice The 0th storage slot in the pool stores many values, and is exposed as a single method to save gas\n /// when accessed externally.\n /// @return sqrtPriceX96 The current price of the pool as a sqrt(token1/token0) Q64.96 value\n /// tick The current tick of the pool, i.e. according to the last tick transition that was run.\n /// This value may not always be equal to SqrtTickMath.getTickAtSqrtRatio(sqrtPriceX96) if the price is on a tick\n /// boundary.\n /// observationIndex The index of the last oracle observation that was written,\n /// observationCardinality The current maximum number of observations stored in the pool,\n /// observationCardinalityNext The next maximum number of observations, to be updated when the observation.\n /// feeProtocol The protocol fee for both tokens of the pool.\n /// Encoded as two 4 bit values, where the protocol fee of token1 is shifted 4 bits and the protocol fee of token0\n /// is the lower 4 bits. Used as the denominator of a fraction of the swap fee, e.g. 4 means 1/4th of the swap fee.\n /// unlocked Whether the pool is currently locked to reentrancy\n function slot0()\n external\n view\n returns (\n uint160 sqrtPriceX96,\n int24 tick,\n uint16 observationIndex,\n uint16 observationCardinality,\n uint16 observationCardinalityNext,\n uint8 feeProtocol,\n bool unlocked\n );\n\n /// @notice The fee growth as a Q128.128 fees of token0 collected per unit of liquidity for the entire life of the pool\n /// @dev This value can overflow the uint256\n function feeGrowthGlobal0X128() external view returns (uint256);\n\n /// @notice The fee growth as a Q128.128 fees of token1 collected per unit of liquidity for the entire life of the pool\n /// @dev This value can overflow the uint256\n function feeGrowthGlobal1X128() external view returns (uint256);\n\n /// @notice The amounts of token0 and token1 that are owed to the protocol\n /// @dev Protocol fees will never exceed uint128 max in either token\n function protocolFees() external view returns (uint128 token0, uint128 token1);\n\n /// @notice The currently in range liquidity available to the pool\n /// @dev This value has no relationship to the total liquidity across all ticks\n function liquidity() external view returns (uint128);\n\n /// @notice Look up information about a specific tick in the pool\n /// @param tick The tick to look up\n /// @return liquidityGross the total amount of position liquidity that uses the pool either as tick lower or\n /// tick upper,\n /// liquidityNet how much liquidity changes when the pool price crosses the tick,\n /// feeGrowthOutside0X128 the fee growth on the other side of the tick from the current tick in token0,\n /// feeGrowthOutside1X128 the fee growth on the other side of the tick from the current tick in token1,\n /// tickCumulativeOutside the cumulative tick value on the other side of the tick from the current tick\n /// secondsPerLiquidityOutsideX128 the seconds spent per liquidity on the other side of the tick from the current tick,\n /// secondsOutside the seconds spent on the other side of the tick from the current tick,\n /// initialized Set to true if the tick is initialized, i.e. liquidityGross is greater than 0, otherwise equal to false.\n /// Outside values can only be used if the tick is initialized, i.e. if liquidityGross is greater than 0.\n /// In addition, these values are only relative and must be used only in comparison to previous snapshots for\n /// a specific position.\n function ticks(int24 tick)\n external\n view\n returns (\n uint128 liquidityGross,\n int128 liquidityNet,\n uint256 feeGrowthOutside0X128,\n uint256 feeGrowthOutside1X128,\n int56 tickCumulativeOutside,\n uint160 secondsPerLiquidityOutsideX128,\n uint32 secondsOutside,\n bool initialized\n );\n\n /// @notice Returns 256 packed tick initialized boolean values. See TickBitmap for more information\n function tickBitmap(int16 wordPosition) external view returns (uint256);\n\n /// @notice Returns the information about a position by the position's key\n /// @param key The position's key is a hash of a preimage composed by the owner, tickLower and tickUpper\n /// @return _liquidity The amount of liquidity in the position,\n /// Returns feeGrowthInside0LastX128 fee growth of token0 inside the tick range as of the last mint/burn/poke,\n /// Returns feeGrowthInside1LastX128 fee growth of token1 inside the tick range as of the last mint/burn/poke,\n /// Returns tokensOwed0 the computed amount of token0 owed to the position as of the last mint/burn/poke,\n /// Returns tokensOwed1 the computed amount of token1 owed to the position as of the last mint/burn/poke\n function positions(bytes32 key)\n external\n view\n returns (\n uint128 _liquidity,\n uint256 feeGrowthInside0LastX128,\n uint256 feeGrowthInside1LastX128,\n uint128 tokensOwed0,\n uint128 tokensOwed1\n );\n\n /// @notice Returns data about a specific observation index\n /// @param index The element of the observations array to fetch\n /// @dev You most likely want to use #observe() instead of this method to get an observation as of some amount of time\n /// ago, rather than at a specific index in the array.\n /// @return blockTimestamp The timestamp of the observation,\n /// Returns tickCumulative the tick multiplied by seconds elapsed for the life of the pool as of the observation timestamp,\n /// Returns secondsPerLiquidityCumulativeX128 the seconds per in range liquidity for the life of the pool as of the observation timestamp,\n /// Returns initialized whether the observation has been initialized and the values are safe to use\n function observations(uint256 index)\n external\n view\n returns (\n uint32 blockTimestamp,\n int56 tickCumulative,\n uint160 secondsPerLiquidityCumulativeX128,\n bool initialized\n );\n}\n" - }, - "@uniswap/v3-core/contracts/interfaces/pool/IUniswapV3PoolDerivedState.sol": { - "content": "// SPDX-License-Identifier: GPL-2.0-or-later\npragma solidity >=0.5.0;\n\n/// @title Pool state that is not stored\n/// @notice Contains view functions to provide information about the pool that is computed rather than stored on the\n/// blockchain. The functions here may have variable gas costs.\ninterface IUniswapV3PoolDerivedState {\n /// @notice Returns the cumulative tick and liquidity as of each timestamp `secondsAgo` from the current block timestamp\n /// @dev To get a time weighted average tick or liquidity-in-range, you must call this with two values, one representing\n /// the beginning of the period and another for the end of the period. E.g., to get the last hour time-weighted average tick,\n /// you must call it with secondsAgos = [3600, 0].\n /// @dev The time weighted average tick represents the geometric time weighted average price of the pool, in\n /// log base sqrt(1.0001) of token1 / token0. The TickMath library can be used to go from a tick value to a ratio.\n /// @param secondsAgos From how long ago each cumulative tick and liquidity value should be returned\n /// @return tickCumulatives Cumulative tick values as of each `secondsAgos` from the current block timestamp\n /// @return secondsPerLiquidityCumulativeX128s Cumulative seconds per liquidity-in-range value as of each `secondsAgos` from the current block\n /// timestamp\n function observe(uint32[] calldata secondsAgos)\n external\n view\n returns (int56[] memory tickCumulatives, uint160[] memory secondsPerLiquidityCumulativeX128s);\n\n /// @notice Returns a snapshot of the tick cumulative, seconds per liquidity and seconds inside a tick range\n /// @dev Snapshots must only be compared to other snapshots, taken over a period for which a position existed.\n /// I.e., snapshots cannot be compared if a position is not held for the entire period between when the first\n /// snapshot is taken and the second snapshot is taken.\n /// @param tickLower The lower tick of the range\n /// @param tickUpper The upper tick of the range\n /// @return tickCumulativeInside The snapshot of the tick accumulator for the range\n /// @return secondsPerLiquidityInsideX128 The snapshot of seconds per liquidity for the range\n /// @return secondsInside The snapshot of seconds per liquidity for the range\n function snapshotCumulativesInside(int24 tickLower, int24 tickUpper)\n external\n view\n returns (\n int56 tickCumulativeInside,\n uint160 secondsPerLiquidityInsideX128,\n uint32 secondsInside\n );\n}\n" - }, - "@uniswap/v3-core/contracts/interfaces/pool/IUniswapV3PoolActions.sol": { - "content": "// SPDX-License-Identifier: GPL-2.0-or-later\npragma solidity >=0.5.0;\n\n/// @title Permissionless pool actions\n/// @notice Contains pool methods that can be called by anyone\ninterface IUniswapV3PoolActions {\n /// @notice Sets the initial price for the pool\n /// @dev Price is represented as a sqrt(amountToken1/amountToken0) Q64.96 value\n /// @param sqrtPriceX96 the initial sqrt price of the pool as a Q64.96\n function initialize(uint160 sqrtPriceX96) external;\n\n /// @notice Adds liquidity for the given recipient/tickLower/tickUpper position\n /// @dev The caller of this method receives a callback in the form of IUniswapV3MintCallback#uniswapV3MintCallback\n /// in which they must pay any token0 or token1 owed for the liquidity. The amount of token0/token1 due depends\n /// on tickLower, tickUpper, the amount of liquidity, and the current price.\n /// @param recipient The address for which the liquidity will be created\n /// @param tickLower The lower tick of the position in which to add liquidity\n /// @param tickUpper The upper tick of the position in which to add liquidity\n /// @param amount The amount of liquidity to mint\n /// @param data Any data that should be passed through to the callback\n /// @return amount0 The amount of token0 that was paid to mint the given amount of liquidity. Matches the value in the callback\n /// @return amount1 The amount of token1 that was paid to mint the given amount of liquidity. Matches the value in the callback\n function mint(\n address recipient,\n int24 tickLower,\n int24 tickUpper,\n uint128 amount,\n bytes calldata data\n ) external returns (uint256 amount0, uint256 amount1);\n\n /// @notice Collects tokens owed to a position\n /// @dev Does not recompute fees earned, which must be done either via mint or burn of any amount of liquidity.\n /// Collect must be called by the position owner. To withdraw only token0 or only token1, amount0Requested or\n /// amount1Requested may be set to zero. To withdraw all tokens owed, caller may pass any value greater than the\n /// actual tokens owed, e.g. type(uint128).max. Tokens owed may be from accumulated swap fees or burned liquidity.\n /// @param recipient The address which should receive the fees collected\n /// @param tickLower The lower tick of the position for which to collect fees\n /// @param tickUpper The upper tick of the position for which to collect fees\n /// @param amount0Requested How much token0 should be withdrawn from the fees owed\n /// @param amount1Requested How much token1 should be withdrawn from the fees owed\n /// @return amount0 The amount of fees collected in token0\n /// @return amount1 The amount of fees collected in token1\n function collect(\n address recipient,\n int24 tickLower,\n int24 tickUpper,\n uint128 amount0Requested,\n uint128 amount1Requested\n ) external returns (uint128 amount0, uint128 amount1);\n\n /// @notice Burn liquidity from the sender and account tokens owed for the liquidity to the position\n /// @dev Can be used to trigger a recalculation of fees owed to a position by calling with an amount of 0\n /// @dev Fees must be collected separately via a call to #collect\n /// @param tickLower The lower tick of the position for which to burn liquidity\n /// @param tickUpper The upper tick of the position for which to burn liquidity\n /// @param amount How much liquidity to burn\n /// @return amount0 The amount of token0 sent to the recipient\n /// @return amount1 The amount of token1 sent to the recipient\n function burn(\n int24 tickLower,\n int24 tickUpper,\n uint128 amount\n ) external returns (uint256 amount0, uint256 amount1);\n\n /// @notice Swap token0 for token1, or token1 for token0\n /// @dev The caller of this method receives a callback in the form of IUniswapV3SwapCallback#uniswapV3SwapCallback\n /// @param recipient The address to receive the output of the swap\n /// @param zeroForOne The direction of the swap, true for token0 to token1, false for token1 to token0\n /// @param amountSpecified The amount of the swap, which implicitly configures the swap as exact input (positive), or exact output (negative)\n /// @param sqrtPriceLimitX96 The Q64.96 sqrt price limit. If zero for one, the price cannot be less than this\n /// value after the swap. If one for zero, the price cannot be greater than this value after the swap\n /// @param data Any data to be passed through to the callback\n /// @return amount0 The delta of the balance of token0 of the pool, exact when negative, minimum when positive\n /// @return amount1 The delta of the balance of token1 of the pool, exact when negative, minimum when positive\n function swap(\n address recipient,\n bool zeroForOne,\n int256 amountSpecified,\n uint160 sqrtPriceLimitX96,\n bytes calldata data\n ) external returns (int256 amount0, int256 amount1);\n\n /// @notice Receive token0 and/or token1 and pay it back, plus a fee, in the callback\n /// @dev The caller of this method receives a callback in the form of IUniswapV3FlashCallback#uniswapV3FlashCallback\n /// @dev Can be used to donate underlying tokens pro-rata to currently in-range liquidity providers by calling\n /// with 0 amount{0,1} and sending the donation amount(s) from the callback\n /// @param recipient The address which will receive the token0 and token1 amounts\n /// @param amount0 The amount of token0 to send\n /// @param amount1 The amount of token1 to send\n /// @param data Any data to be passed through to the callback\n function flash(\n address recipient,\n uint256 amount0,\n uint256 amount1,\n bytes calldata data\n ) external;\n\n /// @notice Increase the maximum number of price and liquidity observations that this pool will store\n /// @dev This method is no-op if the pool already has an observationCardinalityNext greater than or equal to\n /// the input observationCardinalityNext.\n /// @param observationCardinalityNext The desired minimum number of observations for the pool to store\n function increaseObservationCardinalityNext(uint16 observationCardinalityNext) external;\n}\n" - }, - "@uniswap/v3-core/contracts/interfaces/pool/IUniswapV3PoolOwnerActions.sol": { - "content": "// SPDX-License-Identifier: GPL-2.0-or-later\npragma solidity >=0.5.0;\n\n/// @title Permissioned pool actions\n/// @notice Contains pool methods that may only be called by the factory owner\ninterface IUniswapV3PoolOwnerActions {\n /// @notice Set the denominator of the protocol's % share of the fees\n /// @param feeProtocol0 new protocol fee for token0 of the pool\n /// @param feeProtocol1 new protocol fee for token1 of the pool\n function setFeeProtocol(uint8 feeProtocol0, uint8 feeProtocol1) external;\n\n /// @notice Collect the protocol fee accrued to the pool\n /// @param recipient The address to which collected protocol fees should be sent\n /// @param amount0Requested The maximum amount of token0 to send, can be 0 to collect fees in only token1\n /// @param amount1Requested The maximum amount of token1 to send, can be 0 to collect fees in only token0\n /// @return amount0 The protocol fee collected in token0\n /// @return amount1 The protocol fee collected in token1\n function collectProtocol(\n address recipient,\n uint128 amount0Requested,\n uint128 amount1Requested\n ) external returns (uint128 amount0, uint128 amount1);\n}\n" - }, - "@uniswap/v3-core/contracts/interfaces/pool/IUniswapV3PoolEvents.sol": { - "content": "// SPDX-License-Identifier: GPL-2.0-or-later\npragma solidity >=0.5.0;\n\n/// @title Events emitted by a pool\n/// @notice Contains all events emitted by the pool\ninterface IUniswapV3PoolEvents {\n /// @notice Emitted exactly once by a pool when #initialize is first called on the pool\n /// @dev Mint/Burn/Swap cannot be emitted by the pool before Initialize\n /// @param sqrtPriceX96 The initial sqrt price of the pool, as a Q64.96\n /// @param tick The initial tick of the pool, i.e. log base 1.0001 of the starting price of the pool\n event Initialize(uint160 sqrtPriceX96, int24 tick);\n\n /// @notice Emitted when liquidity is minted for a given position\n /// @param sender The address that minted the liquidity\n /// @param owner The owner of the position and recipient of any minted liquidity\n /// @param tickLower The lower tick of the position\n /// @param tickUpper The upper tick of the position\n /// @param amount The amount of liquidity minted to the position range\n /// @param amount0 How much token0 was required for the minted liquidity\n /// @param amount1 How much token1 was required for the minted liquidity\n event Mint(\n address sender,\n address indexed owner,\n int24 indexed tickLower,\n int24 indexed tickUpper,\n uint128 amount,\n uint256 amount0,\n uint256 amount1\n );\n\n /// @notice Emitted when fees are collected by the owner of a position\n /// @dev Collect events may be emitted with zero amount0 and amount1 when the caller chooses not to collect fees\n /// @param owner The owner of the position for which fees are collected\n /// @param tickLower The lower tick of the position\n /// @param tickUpper The upper tick of the position\n /// @param amount0 The amount of token0 fees collected\n /// @param amount1 The amount of token1 fees collected\n event Collect(\n address indexed owner,\n address recipient,\n int24 indexed tickLower,\n int24 indexed tickUpper,\n uint128 amount0,\n uint128 amount1\n );\n\n /// @notice Emitted when a position's liquidity is removed\n /// @dev Does not withdraw any fees earned by the liquidity position, which must be withdrawn via #collect\n /// @param owner The owner of the position for which liquidity is removed\n /// @param tickLower The lower tick of the position\n /// @param tickUpper The upper tick of the position\n /// @param amount The amount of liquidity to remove\n /// @param amount0 The amount of token0 withdrawn\n /// @param amount1 The amount of token1 withdrawn\n event Burn(\n address indexed owner,\n int24 indexed tickLower,\n int24 indexed tickUpper,\n uint128 amount,\n uint256 amount0,\n uint256 amount1\n );\n\n /// @notice Emitted by the pool for any swaps between token0 and token1\n /// @param sender The address that initiated the swap call, and that received the callback\n /// @param recipient The address that received the output of the swap\n /// @param amount0 The delta of the token0 balance of the pool\n /// @param amount1 The delta of the token1 balance of the pool\n /// @param sqrtPriceX96 The sqrt(price) of the pool after the swap, as a Q64.96\n /// @param liquidity The liquidity of the pool after the swap\n /// @param tick The log base 1.0001 of price of the pool after the swap\n event Swap(\n address indexed sender,\n address indexed recipient,\n int256 amount0,\n int256 amount1,\n uint160 sqrtPriceX96,\n uint128 liquidity,\n int24 tick\n );\n\n /// @notice Emitted by the pool for any flashes of token0/token1\n /// @param sender The address that initiated the swap call, and that received the callback\n /// @param recipient The address that received the tokens from flash\n /// @param amount0 The amount of token0 that was flashed\n /// @param amount1 The amount of token1 that was flashed\n /// @param paid0 The amount of token0 paid for the flash, which can exceed the amount0 plus the fee\n /// @param paid1 The amount of token1 paid for the flash, which can exceed the amount1 plus the fee\n event Flash(\n address indexed sender,\n address indexed recipient,\n uint256 amount0,\n uint256 amount1,\n uint256 paid0,\n uint256 paid1\n );\n\n /// @notice Emitted by the pool for increases to the number of observations that can be stored\n /// @dev observationCardinalityNext is not the observation cardinality until an observation is written at the index\n /// just before a mint/swap/burn.\n /// @param observationCardinalityNextOld The previous value of the next observation cardinality\n /// @param observationCardinalityNextNew The updated value of the next observation cardinality\n event IncreaseObservationCardinalityNext(\n uint16 observationCardinalityNextOld,\n uint16 observationCardinalityNextNew\n );\n\n /// @notice Emitted when the protocol fee is changed by the pool\n /// @param feeProtocol0Old The previous value of the token0 protocol fee\n /// @param feeProtocol1Old The previous value of the token1 protocol fee\n /// @param feeProtocol0New The updated value of the token0 protocol fee\n /// @param feeProtocol1New The updated value of the token1 protocol fee\n event SetFeeProtocol(uint8 feeProtocol0Old, uint8 feeProtocol1Old, uint8 feeProtocol0New, uint8 feeProtocol1New);\n\n /// @notice Emitted when the collected protocol fees are withdrawn by the factory owner\n /// @param sender The address that collects the protocol fees\n /// @param recipient The address that receives the collected protocol fees\n /// @param amount0 The amount of token0 protocol fees that is withdrawn\n /// @param amount0 The amount of token1 protocol fees that is withdrawn\n event CollectProtocol(address indexed sender, address indexed recipient, uint128 amount0, uint128 amount1);\n}\n" - }, - "solidity/contracts/UniV3PairManagerFactory.sol": { - "content": "// SPDX-License-Identifier: MIT\n\n/*\n\nCoded for The Keep3r Network with ♥ by\n\n██████╗░███████╗███████╗██╗  ░██╗░░░░░░░██╗░█████╗░███╗░░██╗██████╗░███████╗██████╗░██╗░░░░░░█████╗░███╗░░██╗██████╗░\n██╔══██╗██╔════╝██╔════╝██║  ░██║░░██╗░░██║██╔══██╗████╗░██║██╔══██╗██╔════╝██╔══██╗██║░░░░░██╔══██╗████╗░██║██╔══██╗\n██║░░██║█████╗░░█████╗░░██║  ░╚██╗████╗██╔╝██║░░██║██╔██╗██║██║░░██║█████╗░░██████╔╝██║░░░░░███████║██╔██╗██║██║░░██║\n██║░░██║██╔══╝░░██╔══╝░░██║  ░░████╔═████║░██║░░██║██║╚████║██║░░██║██╔══╝░░██╔══██╗██║░░░░░██╔══██║██║╚████║██║░░██║\n██████╔╝███████╗██║░░░░░██║  ░░╚██╔╝░╚██╔╝░╚█████╔╝██║░╚███║██████╔╝███████╗██║░░██║███████╗██║░░██║██║░╚███║██████╔╝\n╚═════╝░╚══════╝╚═╝░░░░░╚═╝  ░░░╚═╝░░░╚═╝░░░╚════╝░╚═╝░░╚══╝╚═════╝░╚══════╝╚═╝░░╚═╝╚══════╝╚═╝░░╚═╝╚═╝░░╚══╝╚═════╝░\n\nhttps://defi.sucks\n\n*/\n\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../interfaces/IPairManagerFactory.sol';\nimport './UniV3PairManager.sol';\nimport '@defi-wonderland/solidity-utils/solidity/contracts/Governable.sol';\n\n/// @title Factory of Pair Managers\n/// @notice This contract creates new pair managers\ncontract UniV3PairManagerFactory is IPairManagerFactory, Governable {\n mapping(address => address) public override pairManagers;\n\n constructor(address _governor) Governable(_governor) {}\n\n ///@inheritdoc IPairManagerFactory\n function createPairManager(address _pool) external override returns (address _pairManager) {\n if (pairManagers[_pool] != address(0)) revert AlreadyInitialized();\n _pairManager = address(new UniV3PairManager(_pool, governor));\n pairManagers[_pool] = _pairManager;\n emit PairCreated(_pool, _pairManager);\n }\n}\n" - }, - "solidity/interfaces/IPairManagerFactory.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '@defi-wonderland/solidity-utils/solidity/interfaces/IGovernable.sol';\n\n/// @title Factory of Pair Managers\n/// @notice This contract creates new pair managers\ninterface IPairManagerFactory is IGovernable {\n // Variables\n\n /// @notice Maps the address of a Uniswap pool, to the address of the corresponding PairManager\n /// For example, the uniswap address of DAI-WETH, will return the Keep3r/DAI-WETH pair manager address\n /// @param _pool The address of the Uniswap pool\n /// @return _pairManager The address of the corresponding pair manager\n function pairManagers(address _pool) external view returns (address _pairManager);\n\n // Events\n\n /// @notice Emitted when a new pair manager is created\n /// @param _pool The address of the corresponding Uniswap pool\n /// @param _pairManager The address of the just-created pair manager\n event PairCreated(address _pool, address _pairManager);\n\n // Errors\n\n /// @notice Throws an error if the pair manager is already initialized\n error AlreadyInitialized();\n\n /// @notice Throws an error if the caller is not the owner\n error OnlyOwner();\n\n // Methods\n\n /// @notice Creates a new pair manager based on the address of a Uniswap pool\n /// For example, the uniswap address of DAI-WETH, will create the Keep3r/DAI-WETH pool\n /// @param _pool The address of the Uniswap pool the pair manager will be based of\n /// @return _pairManager The address of the just-created pair manager\n function createPairManager(address _pool) external returns (address _pairManager);\n}\n" - }, - "solidity/contracts/UniV3PairManager.sol": { - "content": "// SPDX-License-Identifier: MIT\n\n/*\n\nCoded for The Keep3r Network with ♥ by\n\n██████╗░███████╗███████╗██╗  ░██╗░░░░░░░██╗░█████╗░███╗░░██╗██████╗░███████╗██████╗░██╗░░░░░░█████╗░███╗░░██╗██████╗░\n██╔══██╗██╔════╝██╔════╝██║  ░██║░░██╗░░██║██╔══██╗████╗░██║██╔══██╗██╔════╝██╔══██╗██║░░░░░██╔══██╗████╗░██║██╔══██╗\n██║░░██║█████╗░░█████╗░░██║  ░╚██╗████╗██╔╝██║░░██║██╔██╗██║██║░░██║█████╗░░██████╔╝██║░░░░░███████║██╔██╗██║██║░░██║\n██║░░██║██╔══╝░░██╔══╝░░██║  ░░████╔═████║░██║░░██║██║╚████║██║░░██║██╔══╝░░██╔══██╗██║░░░░░██╔══██║██║╚████║██║░░██║\n██████╔╝███████╗██║░░░░░██║  ░░╚██╔╝░╚██╔╝░╚█████╔╝██║░╚███║██████╔╝███████╗██║░░██║███████╗██║░░██║██║░╚███║██████╔╝\n╚═════╝░╚══════╝╚═╝░░░░░╚═╝  ░░░╚═╝░░░╚═╝░░░╚════╝░╚═╝░░╚══╝╚═════╝░╚══════╝╚═╝░░╚═╝╚══════╝╚═╝░░╚═╝╚═╝░░╚══╝╚═════╝░\n\nhttps://defi.sucks\n\n*/\n\npragma solidity >=0.8.4 <0.9.0;\n\nimport '@defi-wonderland/solidity-utils/solidity/contracts/Governable.sol';\nimport '@openzeppelin/contracts/token/ERC20/ERC20.sol';\nimport '@uniswap/v3-core/contracts/interfaces/IUniswapV3Pool.sol';\n\nimport './libraries/LiquidityAmounts.sol';\nimport './libraries/FixedPoint96.sol';\nimport './libraries/FullMath.sol';\nimport './libraries/TickMath.sol';\n\nimport '../interfaces/external/IWeth9.sol';\nimport '../interfaces/IUniV3PairManager.sol';\n\ncontract UniV3PairManager is IUniV3PairManager, Governable {\n /// @inheritdoc IERC20Metadata\n string public override name;\n\n /// @inheritdoc IERC20Metadata\n string public override symbol;\n\n /// @inheritdoc IERC20\n uint256 public override totalSupply;\n\n /// @inheritdoc IPairManager\n address public immutable override factory;\n\n /// @inheritdoc IPairManager\n address public immutable override token0;\n\n /// @inheritdoc IPairManager\n address public immutable override token1;\n\n /// @inheritdoc IPairManager\n address public immutable override pool;\n\n /// @inheritdoc IUniV3PairManager\n uint24 public immutable override fee;\n\n /// @inheritdoc IUniV3PairManager\n uint160 public immutable override sqrtRatioAX96;\n\n /// @inheritdoc IUniV3PairManager\n uint160 public immutable override sqrtRatioBX96;\n\n /// @inheritdoc IUniV3PairManager\n int24 public immutable override tickLower;\n\n /// @inheritdoc IUniV3PairManager\n int24 public immutable override tickUpper;\n\n /// @inheritdoc IUniV3PairManager\n int24 public immutable override tickSpacing;\n\n /// @notice Uniswap's maximum tick\n /// @dev Due to tick spacing, pools with different fees may have differences between _MAX_TICK and tickUpper. Use tickUpper to find the max tick of the pool.\n int24 private constant _MAX_TICK = 887272;\n\n /// @inheritdoc IERC20Metadata\n //solhint-disable-next-line const-name-snakecase\n uint8 public constant override decimals = 18;\n\n /// @inheritdoc IERC20\n mapping(address => mapping(address => uint256)) public override allowance;\n\n /// @inheritdoc IERC20\n mapping(address => uint256) public override balanceOf;\n\n /// @notice Struct that contains token0, token1, and fee of the Uniswap pool\n PoolKey private _poolKey;\n\n constructor(address _pool, address _governor) Governable(_governor) {\n uint24 _fee = IUniswapV3Pool(_pool).fee();\n address _token0 = IUniswapV3Pool(_pool).token0();\n address _token1 = IUniswapV3Pool(_pool).token1();\n int24 _tickSpacing = IUniswapV3Pool(_pool).tickSpacing();\n int24 _tickUpper = _MAX_TICK - (_MAX_TICK % _tickSpacing);\n int24 _tickLower = -_tickUpper;\n\n factory = msg.sender;\n pool = _pool;\n fee = _fee;\n tickSpacing = _tickSpacing;\n tickUpper = _tickUpper;\n tickLower = _tickLower;\n token0 = _token0;\n token1 = _token1;\n name = string(abi.encodePacked('Keep3rLP - ', ERC20(_token0).symbol(), '/', ERC20(_token1).symbol()));\n symbol = string(abi.encodePacked('kLP-', ERC20(_token0).symbol(), '/', ERC20(_token1).symbol()));\n\n sqrtRatioAX96 = TickMath.getSqrtRatioAtTick(_tickLower);\n sqrtRatioBX96 = TickMath.getSqrtRatioAtTick(_tickUpper);\n _poolKey = PoolKey({token0: _token0, token1: _token1, fee: _fee});\n }\n\n // This low-level function should be called from a contract which performs important safety checks\n /// @inheritdoc IUniV3PairManager\n function mint(\n uint256 amount0Desired,\n uint256 amount1Desired,\n uint256 amount0Min,\n uint256 amount1Min,\n address to\n ) external override returns (uint128 liquidity) {\n (liquidity, , ) = _addLiquidity(amount0Desired, amount1Desired, amount0Min, amount1Min);\n _mint(to, liquidity);\n }\n\n /// @inheritdoc IUniV3PairManager\n function uniswapV3MintCallback(\n uint256 amount0Owed,\n uint256 amount1Owed,\n bytes calldata data\n ) external override {\n MintCallbackData memory decoded = abi.decode(data, (MintCallbackData));\n if (msg.sender != pool) revert OnlyPool();\n if (amount0Owed > 0) _pay(decoded._poolKey.token0, decoded.payer, pool, amount0Owed);\n if (amount1Owed > 0) _pay(decoded._poolKey.token1, decoded.payer, pool, amount1Owed);\n }\n\n /// @inheritdoc IUniV3PairManager\n function burn(\n uint128 liquidity,\n uint256 amount0Min,\n uint256 amount1Min,\n address to\n ) external override returns (uint256 amount0, uint256 amount1) {\n (amount0, amount1) = IUniswapV3Pool(pool).burn(tickLower, tickUpper, liquidity);\n\n if (amount0 < amount0Min || amount1 < amount1Min) revert ExcessiveSlippage();\n\n IUniswapV3Pool(pool).collect(to, tickLower, tickUpper, uint128(amount0), uint128(amount1));\n _burn(msg.sender, liquidity);\n }\n\n /// @inheritdoc IUniV3PairManager\n function collect() external override onlyGovernor returns (uint256 amount0, uint256 amount1) {\n (, , , uint128 tokensOwed0, uint128 tokensOwed1) = IUniswapV3Pool(pool).positions(\n keccak256(abi.encodePacked(address(this), tickLower, tickUpper))\n );\n (amount0, amount1) = IUniswapV3Pool(pool).collect(governor, tickLower, tickUpper, tokensOwed0, tokensOwed1);\n }\n\n /// @inheritdoc IUniV3PairManager\n function position()\n external\n view\n override\n returns (\n uint128 liquidity,\n uint256 feeGrowthInside0LastX128,\n uint256 feeGrowthInside1LastX128,\n uint128 tokensOwed0,\n uint128 tokensOwed1\n )\n {\n (liquidity, feeGrowthInside0LastX128, feeGrowthInside1LastX128, tokensOwed0, tokensOwed1) = IUniswapV3Pool(pool).positions(\n keccak256(abi.encodePacked(address(this), tickLower, tickUpper))\n );\n }\n\n /// @inheritdoc IERC20\n function approve(address spender, uint256 amount) external override returns (bool) {\n allowance[msg.sender][spender] = amount;\n\n emit Approval(msg.sender, spender, amount);\n return true;\n }\n\n /// @inheritdoc IERC20\n function transfer(address to, uint256 amount) external override returns (bool) {\n _transferTokens(msg.sender, to, amount);\n return true;\n }\n\n /// @inheritdoc IERC20\n function transferFrom(\n address from,\n address to,\n uint256 amount\n ) external override returns (bool) {\n address spender = msg.sender;\n uint256 spenderAllowance = allowance[from][spender];\n\n if (spender != from && spenderAllowance != type(uint256).max) {\n uint256 newAllowance = spenderAllowance - amount;\n allowance[from][spender] = newAllowance;\n\n emit Approval(from, spender, newAllowance);\n }\n\n _transferTokens(from, to, amount);\n return true;\n }\n\n /// @notice Adds liquidity to an initialized pool\n /// @dev Reverts if the returned amount0 is less than amount0Min or if amount1 is less than amount1Min\n /// @dev This function calls the mint function of the corresponding Uniswap pool, which in turn calls UniswapV3Callback\n /// @param amount0Desired The amount of token0 we would like to provide\n /// @param amount1Desired The amount of token1 we would like to provide\n /// @param amount0Min The minimum amount of token0 we want to provide\n /// @param amount1Min The minimum amount of token1 we want to provide\n /// @return liquidity The calculated liquidity we get for the token amounts we provided\n /// @return amount0 The amount of token0 we ended up providing\n /// @return amount1 The amount of token1 we ended up providing\n function _addLiquidity(\n uint256 amount0Desired,\n uint256 amount1Desired,\n uint256 amount0Min,\n uint256 amount1Min\n )\n internal\n returns (\n uint128 liquidity,\n uint256 amount0,\n uint256 amount1\n )\n {\n (uint160 sqrtPriceX96, , , , , , ) = IUniswapV3Pool(pool).slot0();\n\n liquidity = LiquidityAmounts.getLiquidityForAmounts(sqrtPriceX96, sqrtRatioAX96, sqrtRatioBX96, amount0Desired, amount1Desired);\n\n (amount0, amount1) = IUniswapV3Pool(pool).mint(\n address(this),\n tickLower,\n tickUpper,\n liquidity,\n abi.encode(MintCallbackData({_poolKey: _poolKey, payer: msg.sender}))\n );\n\n if (amount0 < amount0Min || amount1 < amount1Min) revert ExcessiveSlippage();\n }\n\n /// @notice Transfers the passed-in token from the payer to the recipient for the corresponding value\n /// @param token The token to be transferred to the recipient\n /// @param from The address of the payer\n /// @param to The address of the passed-in tokens recipient\n /// @param value How much of that token to be transferred from payer to the recipient\n function _pay(\n address token,\n address from,\n address to,\n uint256 value\n ) internal {\n _safeTransferFrom(token, from, to, value);\n }\n\n /// @notice Mints Keep3r credits to the passed-in address of recipient and increases total supply of Keep3r credits by the corresponding amount\n /// @param to The recipient of the Keep3r credits\n /// @param amount The amount Keep3r credits to be minted to the recipient\n function _mint(address to, uint256 amount) internal {\n totalSupply += amount;\n balanceOf[to] += amount;\n emit Transfer(address(0), to, amount);\n }\n\n /// @notice Burns Keep3r credits to the passed-in address of recipient and reduces total supply of Keep3r credits by the corresponding amount\n /// @param to The address that will get its Keep3r credits burned\n /// @param amount The amount Keep3r credits to be burned from the recipient/recipient\n function _burn(address to, uint256 amount) internal {\n totalSupply -= amount;\n balanceOf[to] -= amount;\n emit Transfer(to, address(0), amount);\n }\n\n /// @notice Transfers amount of Keep3r credits between two addresses\n /// @param from The user that transfers the Keep3r credits\n /// @param to The user that receives the Keep3r credits\n /// @param amount The amount of Keep3r credits to be transferred\n function _transferTokens(\n address from,\n address to,\n uint256 amount\n ) internal {\n balanceOf[from] -= amount;\n balanceOf[to] += amount;\n\n emit Transfer(from, to, amount);\n }\n\n /// @notice Transfers the passed-in token from the specified \"from\" to the specified \"to\" for the corresponding value\n /// @dev Reverts with IUniV3PairManager#UnsuccessfulTransfer if the transfer was not successful,\n /// or if the passed data length is different than 0 and the decoded data is not a boolean\n /// @param token The token to be transferred to the specified \"to\"\n /// @param from The address which is going to transfer the tokens\n /// @param value How much of that token to be transferred from \"from\" to \"to\"\n function _safeTransferFrom(\n address token,\n address from,\n address to,\n uint256 value\n ) internal {\n // solhint-disable-next-line avoid-low-level-calls\n (bool success, bytes memory data) = token.call(abi.encodeWithSelector(IERC20.transferFrom.selector, from, to, value));\n if (!success || (data.length != 0 && !abi.decode(data, (bool)))) revert UnsuccessfulTransfer();\n }\n}\n" - }, - "@openzeppelin/contracts/token/ERC20/ERC20.sol": { - "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\nimport \"./IERC20.sol\";\nimport \"./extensions/IERC20Metadata.sol\";\nimport \"../../utils/Context.sol\";\n\n/**\n * @dev Implementation of the {IERC20} interface.\n *\n * This implementation is agnostic to the way tokens are created. This means\n * that a supply mechanism has to be added in a derived contract using {_mint}.\n * For a generic mechanism see {ERC20PresetMinterPauser}.\n *\n * TIP: For a detailed writeup see our guide\n * https://forum.zeppelin.solutions/t/how-to-implement-erc20-supply-mechanisms/226[How\n * to implement supply mechanisms].\n *\n * We have followed general OpenZeppelin Contracts guidelines: functions revert\n * instead returning `false` on failure. This behavior is nonetheless\n * conventional and does not conflict with the expectations of ERC20\n * applications.\n *\n * Additionally, an {Approval} event is emitted on calls to {transferFrom}.\n * This allows applications to reconstruct the allowance for all accounts just\n * by listening to said events. Other implementations of the EIP may not emit\n * these events, as it isn't required by the specification.\n *\n * Finally, the non-standard {decreaseAllowance} and {increaseAllowance}\n * functions have been added to mitigate the well-known issues around setting\n * allowances. See {IERC20-approve}.\n */\ncontract ERC20 is Context, IERC20, IERC20Metadata {\n mapping(address => uint256) private _balances;\n\n mapping(address => mapping(address => uint256)) private _allowances;\n\n uint256 private _totalSupply;\n\n string private _name;\n string private _symbol;\n\n /**\n * @dev Sets the values for {name} and {symbol}.\n *\n * The default value of {decimals} is 18. To select a different value for\n * {decimals} you should overload it.\n *\n * All two of these values are immutable: they can only be set once during\n * construction.\n */\n constructor(string memory name_, string memory symbol_) {\n _name = name_;\n _symbol = symbol_;\n }\n\n /**\n * @dev Returns the name of the token.\n */\n function name() public view virtual override returns (string memory) {\n return _name;\n }\n\n /**\n * @dev Returns the symbol of the token, usually a shorter version of the\n * name.\n */\n function symbol() public view virtual override returns (string memory) {\n return _symbol;\n }\n\n /**\n * @dev Returns the number of decimals used to get its user representation.\n * For example, if `decimals` equals `2`, a balance of `505` tokens should\n * be displayed to a user as `5.05` (`505 / 10 ** 2`).\n *\n * Tokens usually opt for a value of 18, imitating the relationship between\n * Ether and Wei. This is the value {ERC20} uses, unless this function is\n * overridden;\n *\n * NOTE: This information is only used for _display_ purposes: it in\n * no way affects any of the arithmetic of the contract, including\n * {IERC20-balanceOf} and {IERC20-transfer}.\n */\n function decimals() public view virtual override returns (uint8) {\n return 18;\n }\n\n /**\n * @dev See {IERC20-totalSupply}.\n */\n function totalSupply() public view virtual override returns (uint256) {\n return _totalSupply;\n }\n\n /**\n * @dev See {IERC20-balanceOf}.\n */\n function balanceOf(address account) public view virtual override returns (uint256) {\n return _balances[account];\n }\n\n /**\n * @dev See {IERC20-transfer}.\n *\n * Requirements:\n *\n * - `recipient` cannot be the zero address.\n * - the caller must have a balance of at least `amount`.\n */\n function transfer(address recipient, uint256 amount) public virtual override returns (bool) {\n _transfer(_msgSender(), recipient, amount);\n return true;\n }\n\n /**\n * @dev See {IERC20-allowance}.\n */\n function allowance(address owner, address spender) public view virtual override returns (uint256) {\n return _allowances[owner][spender];\n }\n\n /**\n * @dev See {IERC20-approve}.\n *\n * Requirements:\n *\n * - `spender` cannot be the zero address.\n */\n function approve(address spender, uint256 amount) public virtual override returns (bool) {\n _approve(_msgSender(), spender, amount);\n return true;\n }\n\n /**\n * @dev See {IERC20-transferFrom}.\n *\n * Emits an {Approval} event indicating the updated allowance. This is not\n * required by the EIP. See the note at the beginning of {ERC20}.\n *\n * Requirements:\n *\n * - `sender` and `recipient` cannot be the zero address.\n * - `sender` must have a balance of at least `amount`.\n * - the caller must have allowance for ``sender``'s tokens of at least\n * `amount`.\n */\n function transferFrom(\n address sender,\n address recipient,\n uint256 amount\n ) public virtual override returns (bool) {\n _transfer(sender, recipient, amount);\n\n uint256 currentAllowance = _allowances[sender][_msgSender()];\n require(currentAllowance >= amount, \"ERC20: transfer amount exceeds allowance\");\n unchecked {\n _approve(sender, _msgSender(), currentAllowance - amount);\n }\n\n return true;\n }\n\n /**\n * @dev Atomically increases the allowance granted to `spender` by the caller.\n *\n * This is an alternative to {approve} that can be used as a mitigation for\n * problems described in {IERC20-approve}.\n *\n * Emits an {Approval} event indicating the updated allowance.\n *\n * Requirements:\n *\n * - `spender` cannot be the zero address.\n */\n function increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool) {\n _approve(_msgSender(), spender, _allowances[_msgSender()][spender] + addedValue);\n return true;\n }\n\n /**\n * @dev Atomically decreases the allowance granted to `spender` by the caller.\n *\n * This is an alternative to {approve} that can be used as a mitigation for\n * problems described in {IERC20-approve}.\n *\n * Emits an {Approval} event indicating the updated allowance.\n *\n * Requirements:\n *\n * - `spender` cannot be the zero address.\n * - `spender` must have allowance for the caller of at least\n * `subtractedValue`.\n */\n function decreaseAllowance(address spender, uint256 subtractedValue) public virtual returns (bool) {\n uint256 currentAllowance = _allowances[_msgSender()][spender];\n require(currentAllowance >= subtractedValue, \"ERC20: decreased allowance below zero\");\n unchecked {\n _approve(_msgSender(), spender, currentAllowance - subtractedValue);\n }\n\n return true;\n }\n\n /**\n * @dev Moves `amount` of tokens from `sender` to `recipient`.\n *\n * This internal function is equivalent to {transfer}, and can be used to\n * e.g. implement automatic token fees, slashing mechanisms, etc.\n *\n * Emits a {Transfer} event.\n *\n * Requirements:\n *\n * - `sender` cannot be the zero address.\n * - `recipient` cannot be the zero address.\n * - `sender` must have a balance of at least `amount`.\n */\n function _transfer(\n address sender,\n address recipient,\n uint256 amount\n ) internal virtual {\n require(sender != address(0), \"ERC20: transfer from the zero address\");\n require(recipient != address(0), \"ERC20: transfer to the zero address\");\n\n _beforeTokenTransfer(sender, recipient, amount);\n\n uint256 senderBalance = _balances[sender];\n require(senderBalance >= amount, \"ERC20: transfer amount exceeds balance\");\n unchecked {\n _balances[sender] = senderBalance - amount;\n }\n _balances[recipient] += amount;\n\n emit Transfer(sender, recipient, amount);\n\n _afterTokenTransfer(sender, recipient, amount);\n }\n\n /** @dev Creates `amount` tokens and assigns them to `account`, increasing\n * the total supply.\n *\n * Emits a {Transfer} event with `from` set to the zero address.\n *\n * Requirements:\n *\n * - `account` cannot be the zero address.\n */\n function _mint(address account, uint256 amount) internal virtual {\n require(account != address(0), \"ERC20: mint to the zero address\");\n\n _beforeTokenTransfer(address(0), account, amount);\n\n _totalSupply += amount;\n _balances[account] += amount;\n emit Transfer(address(0), account, amount);\n\n _afterTokenTransfer(address(0), account, amount);\n }\n\n /**\n * @dev Destroys `amount` tokens from `account`, reducing the\n * total supply.\n *\n * Emits a {Transfer} event with `to` set to the zero address.\n *\n * Requirements:\n *\n * - `account` cannot be the zero address.\n * - `account` must have at least `amount` tokens.\n */\n function _burn(address account, uint256 amount) internal virtual {\n require(account != address(0), \"ERC20: burn from the zero address\");\n\n _beforeTokenTransfer(account, address(0), amount);\n\n uint256 accountBalance = _balances[account];\n require(accountBalance >= amount, \"ERC20: burn amount exceeds balance\");\n unchecked {\n _balances[account] = accountBalance - amount;\n }\n _totalSupply -= amount;\n\n emit Transfer(account, address(0), amount);\n\n _afterTokenTransfer(account, address(0), amount);\n }\n\n /**\n * @dev Sets `amount` as the allowance of `spender` over the `owner` s tokens.\n *\n * This internal function is equivalent to `approve`, and can be used to\n * e.g. set automatic allowances for certain subsystems, etc.\n *\n * Emits an {Approval} event.\n *\n * Requirements:\n *\n * - `owner` cannot be the zero address.\n * - `spender` cannot be the zero address.\n */\n function _approve(\n address owner,\n address spender,\n uint256 amount\n ) internal virtual {\n require(owner != address(0), \"ERC20: approve from the zero address\");\n require(spender != address(0), \"ERC20: approve to the zero address\");\n\n _allowances[owner][spender] = amount;\n emit Approval(owner, spender, amount);\n }\n\n /**\n * @dev Hook that is called before any transfer of tokens. This includes\n * minting and burning.\n *\n * Calling conditions:\n *\n * - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens\n * will be transferred to `to`.\n * - when `from` is zero, `amount` tokens will be minted for `to`.\n * - when `to` is zero, `amount` of ``from``'s tokens will be burned.\n * - `from` and `to` are never both zero.\n *\n * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].\n */\n function _beforeTokenTransfer(\n address from,\n address to,\n uint256 amount\n ) internal virtual {}\n\n /**\n * @dev Hook that is called after any transfer of tokens. This includes\n * minting and burning.\n *\n * Calling conditions:\n *\n * - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens\n * has been transferred to `to`.\n * - when `from` is zero, `amount` tokens have been minted for `to`.\n * - when `to` is zero, `amount` of ``from``'s tokens have been burned.\n * - `from` and `to` are never both zero.\n *\n * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].\n */\n function _afterTokenTransfer(\n address from,\n address to,\n uint256 amount\n ) internal virtual {}\n}\n" - }, - "solidity/contracts/libraries/LiquidityAmounts.sol": { - "content": "// SPDX-License-Identifier: GPL-2.0-or-later\npragma solidity >=0.8.4 <0.9.0;\n\nimport './FullMath.sol';\nimport './FixedPoint96.sol';\n\n// solhint-disable\nlibrary LiquidityAmounts {\n function toUint128(uint256 x) private pure returns (uint128 y) {\n require((y = uint128(x)) == x);\n }\n\n function getLiquidityForAmount0(\n uint160 sqrtRatioAX96,\n uint160 sqrtRatioBX96,\n uint256 amount0\n ) internal pure returns (uint128 liquidity) {\n if (sqrtRatioAX96 > sqrtRatioBX96) (sqrtRatioAX96, sqrtRatioBX96) = (sqrtRatioBX96, sqrtRatioAX96);\n uint256 intermediate = FullMath.mulDiv(sqrtRatioAX96, sqrtRatioBX96, FixedPoint96.Q96);\n return toUint128(FullMath.mulDiv(amount0, intermediate, sqrtRatioBX96 - sqrtRatioAX96));\n }\n\n function getLiquidityForAmount1(\n uint160 sqrtRatioAX96,\n uint160 sqrtRatioBX96,\n uint256 amount1\n ) internal pure returns (uint128 liquidity) {\n if (sqrtRatioAX96 > sqrtRatioBX96) (sqrtRatioAX96, sqrtRatioBX96) = (sqrtRatioBX96, sqrtRatioAX96);\n return toUint128(FullMath.mulDiv(amount1, FixedPoint96.Q96, sqrtRatioBX96 - sqrtRatioAX96));\n }\n\n function getLiquidityForAmounts(\n uint160 sqrtRatioX96,\n uint160 sqrtRatioAX96,\n uint160 sqrtRatioBX96,\n uint256 amount0,\n uint256 amount1\n ) internal pure returns (uint128 liquidity) {\n if (sqrtRatioAX96 > sqrtRatioBX96) (sqrtRatioAX96, sqrtRatioBX96) = (sqrtRatioBX96, sqrtRatioAX96);\n\n if (sqrtRatioX96 <= sqrtRatioAX96) {\n liquidity = getLiquidityForAmount0(sqrtRatioAX96, sqrtRatioBX96, amount0);\n } else if (sqrtRatioX96 < sqrtRatioBX96) {\n uint128 liquidity0 = getLiquidityForAmount0(sqrtRatioX96, sqrtRatioBX96, amount0);\n uint128 liquidity1 = getLiquidityForAmount1(sqrtRatioAX96, sqrtRatioX96, amount1);\n\n liquidity = liquidity0 < liquidity1 ? liquidity0 : liquidity1;\n } else {\n liquidity = getLiquidityForAmount1(sqrtRatioAX96, sqrtRatioBX96, amount1);\n }\n }\n\n function getAmount0ForLiquidity(\n uint160 sqrtRatioAX96,\n uint160 sqrtRatioBX96,\n uint128 liquidity\n ) internal pure returns (uint256 amount0) {\n if (sqrtRatioAX96 > sqrtRatioBX96) (sqrtRatioAX96, sqrtRatioBX96) = (sqrtRatioBX96, sqrtRatioAX96);\n\n return FullMath.mulDiv(uint256(liquidity) << FixedPoint96.RESOLUTION, sqrtRatioBX96 - sqrtRatioAX96, sqrtRatioBX96) / sqrtRatioAX96;\n }\n\n function getAmount1ForLiquidity(\n uint160 sqrtRatioAX96,\n uint160 sqrtRatioBX96,\n uint128 liquidity\n ) internal pure returns (uint256 amount1) {\n if (sqrtRatioAX96 > sqrtRatioBX96) (sqrtRatioAX96, sqrtRatioBX96) = (sqrtRatioBX96, sqrtRatioAX96);\n\n return FullMath.mulDiv(liquidity, sqrtRatioBX96 - sqrtRatioAX96, FixedPoint96.Q96);\n }\n\n function getAmountsForLiquidity(\n uint160 sqrtRatioX96,\n uint160 sqrtRatioAX96,\n uint160 sqrtRatioBX96,\n uint128 liquidity\n ) internal pure returns (uint256 amount0, uint256 amount1) {\n if (sqrtRatioAX96 > sqrtRatioBX96) (sqrtRatioAX96, sqrtRatioBX96) = (sqrtRatioBX96, sqrtRatioAX96);\n\n if (sqrtRatioX96 <= sqrtRatioAX96) {\n amount0 = getAmount0ForLiquidity(sqrtRatioAX96, sqrtRatioBX96, liquidity);\n } else if (sqrtRatioX96 < sqrtRatioBX96) {\n amount0 = getAmount0ForLiquidity(sqrtRatioX96, sqrtRatioBX96, liquidity);\n amount1 = getAmount1ForLiquidity(sqrtRatioAX96, sqrtRatioX96, liquidity);\n } else {\n amount1 = getAmount1ForLiquidity(sqrtRatioAX96, sqrtRatioBX96, liquidity);\n }\n }\n}\n" - }, - "solidity/contracts/libraries/FixedPoint96.sol": { - "content": "// SPDX-License-Identifier: GPL-2.0-or-later\npragma solidity >=0.8.4 <0.9.0;\n\nlibrary FixedPoint96 {\n // solhint-disable\n uint8 internal constant RESOLUTION = 96;\n uint256 internal constant Q96 = 0x1000000000000000000000000;\n}\n" - }, - "solidity/interfaces/external/IWeth9.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '@openzeppelin/contracts/token/ERC20/IERC20.sol';\n\ninterface IWeth9 is IERC20 {\n function deposit() external payable;\n\n function withdraw(uint256) external;\n}\n" - }, - "solidity/interfaces/IUniV3PairManager.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport './IPairManager.sol';\nimport '@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol';\nimport '@defi-wonderland/solidity-utils/solidity/interfaces/IGovernable.sol';\n\n/// @title Pair Manager contract\n/// @notice Creates a UniswapV3 position, and tokenizes in an ERC20 manner\n/// so that the user can use it as liquidity for a Keep3rJob\ninterface IUniV3PairManager is IGovernable, IPairManager {\n // Structs\n struct PoolKey {\n address token0;\n address token1;\n uint24 fee;\n }\n\n /// @notice The data to be decoded by the UniswapV3MintCallback function\n struct MintCallbackData {\n PoolKey _poolKey; // Struct that contains token0, token1, and fee of the pool passed into the constructor\n address payer; // The address of the payer, which will be the msg.sender of the mint function\n }\n\n // Variables\n\n /// @notice The fee of the Uniswap pool passed into the constructor\n /// @return _fee The fee of the Uniswap pool passed into the constructor\n function fee() external view returns (uint24 _fee);\n\n /// @notice Highest tick in the Uniswap's curve\n /// @return _tickUpper The highest tick in the Uniswap's curve\n function tickUpper() external view returns (int24 _tickUpper);\n\n /// @notice Lowest tick in the Uniswap's curve\n /// @return _tickLower The lower tick in the Uniswap's curve\n function tickLower() external view returns (int24 _tickLower);\n\n /// @notice The pair tick spacing\n /// @return _tickSpacing The pair tick spacing\n function tickSpacing() external view returns (int24 _tickSpacing);\n\n /// @notice The sqrtRatioAX96 at the lowest tick (-887200) of the Uniswap pool\n /// @return _sqrtPriceA96 A Fixed point Q64.96 number representing the sqrt of the ratio of the two assets (token1/token0)\n /// at the lowest tick\n function sqrtRatioAX96() external view returns (uint160 _sqrtPriceA96);\n\n /// @notice The sqrtRatioBX96 at the highest tick (887200) of the Uniswap pool\n /// @return _sqrtPriceBX96 A Fixed point Q64.96 number representing the sqrt of the ratio of the two assets (token1/token0)\n /// at the highest tick\n function sqrtRatioBX96() external view returns (uint160 _sqrtPriceBX96);\n\n // Errors\n\n /// @notice Throws when the caller of the function is not the pool\n error OnlyPool();\n\n /// @notice Throws when the slippage exceeds what the user is comfortable with\n error ExcessiveSlippage();\n\n /// @notice Throws when a transfer is unsuccessful\n error UnsuccessfulTransfer();\n\n // Methods\n\n /// @notice This function is called after a user calls IUniV3PairManager#mint function\n /// It ensures that any tokens owed to the pool are paid by the msg.sender of IUniV3PairManager#mint function\n /// @param amount0Owed The amount of token0 due to the pool for the minted liquidity\n /// @param amount1Owed The amount of token1 due to the pool for the minted liquidity\n /// @param data The encoded token0, token1, fee (_poolKey) and the payer (msg.sender) of the IUniV3PairManager#mint function\n function uniswapV3MintCallback(\n uint256 amount0Owed,\n uint256 amount1Owed,\n bytes calldata data\n ) external;\n\n /// @notice Mints kLP tokens to an address according to the liquidity the msg.sender provides to the UniswapV3 pool\n /// @dev Triggers UniV3PairManager#uniswapV3MintCallback\n /// @param amount0Desired The amount of token0 we would like to provide\n /// @param amount1Desired The amount of token1 we would like to provide\n /// @param amount0Min The minimum amount of token0 we want to provide\n /// @param amount1Min The minimum amount of token1 we want to provide\n /// @param to The address to which the kLP tokens are going to be minted to\n /// @return liquidity kLP tokens sent in exchange for the provision of tokens\n function mint(\n uint256 amount0Desired,\n uint256 amount1Desired,\n uint256 amount0Min,\n uint256 amount1Min,\n address to\n ) external returns (uint128 liquidity);\n\n /// @notice Returns the pair manager's position in the corresponding UniswapV3 pool\n /// @return liquidity The amount of liquidity provided to the UniswapV3 pool by the pair manager\n /// @return feeGrowthInside0LastX128 The fee growth of token0 as of the last action on the individual position\n /// @return feeGrowthInside1LastX128 The fee growth of token1 as of the last action on the individual position\n /// @return tokensOwed0 The uncollected amount of token0 owed to the position as of the last computation\n /// @return tokensOwed1 The uncollected amount of token1 owed to the position as of the last computation\n function position()\n external\n view\n returns (\n uint128 liquidity,\n uint256 feeGrowthInside0LastX128,\n uint256 feeGrowthInside1LastX128,\n uint128 tokensOwed0,\n uint128 tokensOwed1\n );\n\n /// @notice Calls the UniswapV3 pool's collect function, which collects up to a maximum amount of fees\n // owed to a specific position to the recipient, in this case, that recipient is the pair manager\n /// @dev The collected fees will be sent to governor\n /// @return amount0 The amount of fees collected in token0\n /// @return amount1 The amount of fees collected in token1\n function collect() external returns (uint256 amount0, uint256 amount1);\n\n /// @notice Burns the corresponding amount of kLP tokens from the msg.sender and withdraws the specified liquidity\n // in the entire range\n /// @param liquidity The amount of liquidity to be burned\n /// @param amount0Min The minimum amount of token0 we want to send to the recipient (to)\n /// @param amount1Min The minimum amount of token1 we want to send to the recipient (to)\n /// @param to The address that will receive the due fees\n /// @return amount0 The calculated amount of token0 that will be sent to the recipient\n /// @return amount1 The calculated amount of token1 that will be sent to the recipient\n function burn(\n uint128 liquidity,\n uint256 amount0Min,\n uint256 amount1Min,\n address to\n ) external returns (uint256 amount0, uint256 amount1);\n}\n" - }, - "@openzeppelin/contracts/utils/Context.sol": { - "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Provides information about the current execution context, including the\n * sender of the transaction and its data. While these are generally available\n * via msg.sender and msg.data, they should not be accessed in such a direct\n * manner, since when dealing with meta-transactions the account sending and\n * paying for execution may not be the actual sender (as far as an application\n * is concerned).\n *\n * This contract is only required for intermediate, library-like contracts.\n */\nabstract contract Context {\n function _msgSender() internal view virtual returns (address) {\n return msg.sender;\n }\n\n function _msgData() internal view virtual returns (bytes calldata) {\n return msg.data;\n }\n}\n" - }, - "solidity/for-test/UniV3PairManagerForTest.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '@openzeppelin/contracts/token/ERC20/ERC20.sol';\nimport '@uniswap/v3-core/contracts/interfaces/IUniswapV3Pool.sol';\n\nimport '../contracts/libraries/LiquidityAmounts.sol';\nimport '../contracts/libraries/FixedPoint96.sol';\nimport '../contracts/libraries/FullMath.sol';\nimport '../contracts/libraries/TickMath.sol';\nimport '../contracts/UniV3PairManager.sol';\nimport '../interfaces/external/IWeth9.sol';\nimport '../interfaces/IUniV3PairManager.sol';\n\ncontract UniV3PairManagerForTest is UniV3PairManager {\n constructor(address _pool, address _governor) UniV3PairManager(_pool, _governor) {}\n\n function internalAddLiquidity(\n uint256 amount0Desired,\n uint256 amount1Desired,\n uint256 amount0Min,\n uint256 amount1Min\n )\n external\n returns (\n uint128 liquidity,\n uint256 amount0,\n uint256 amount1\n )\n {\n return _addLiquidity(amount0Desired, amount1Desired, amount0Min, amount1Min);\n }\n\n function internalPay(\n address token,\n address payer,\n address recipient,\n uint256 value\n ) external {\n return _pay(token, payer, recipient, value);\n }\n\n function internalMint(address dst, uint256 amount) external {\n return _mint(dst, amount);\n }\n\n function internalBurn(address dst, uint256 amount) external {\n return _burn(dst, amount);\n }\n\n function internalTransferTokens(\n address src,\n address dst,\n uint256 amount\n ) external {\n _transferTokens(src, dst, amount);\n }\n\n function internalSafeTransferFrom(\n address token,\n address from,\n address to,\n uint256 value\n ) external {\n _safeTransferFrom(token, from, to, value);\n }\n\n receive() external payable {}\n}\n" - }, - "solidity/contracts/sidechain/Keep3rEscrow.sol": { - "content": "// SPDX-License-Identifier: MIT\n\n/*\n\nCoded for The Keep3r Network with ♥ by\n\n██████╗░███████╗███████╗██╗░░░██╗░░░░░░░██╗░█████╗░███╗░░██╗██████╗░███████╗██████╗░██╗░░░░░░█████╗░███╗░░██╗██████╗░\n██╔══██╗██╔════╝██╔════╝██║░░░██║░░██╗░░██║██╔══██╗████╗░██║██╔══██╗██╔════╝██╔══██╗██║░░░░░██╔══██╗████╗░██║██╔══██╗\n██║░░██║█████╗░░█████╗░░██║░░░╚██╗████╗██╔╝██║░░██║██╔██╗██║██║░░██║█████╗░░██████╔╝██║░░░░░███████║██╔██╗██║██║░░██║\n██║░░██║██╔══╝░░██╔══╝░░██║░░░░████╔═████║░██║░░██║██║╚████║██║░░██║██╔══╝░░██╔══██╗██║░░░░░██╔══██║██║╚████║██║░░██║\n██████╔╝███████╗██║░░░░░██║░░░░╚██╔╝░╚██╔╝░╚█████╔╝██║░╚███║██████╔╝███████╗██║░░██║███████╗██║░░██║██║░╚███║██████╔╝\n╚═════╝░╚══════╝╚═╝░░░░░╚═╝░░░░░╚═╝░░░╚═╝░░░╚════╝░╚═╝░░╚══╝╚═════╝░╚══════╝╚═╝░░╚═╝╚══════╝╚═╝░░╚═╝╚═╝░░╚══╝╚═════╝░\n\nhttps://defi.sucks\n\nCommit hash: ead559c8dc4361349b7222741c2399447e255d8e\n\n*/\n\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../peripherals/Mintable.sol';\nimport '../../interfaces/sidechain/IKeep3rEscrow.sol';\nimport '@defi-wonderland/solidity-utils/solidity/contracts/DustCollector.sol';\nimport '@openzeppelin/contracts/token/ERC20/IERC20.sol';\nimport '@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol';\n\ncontract Keep3rEscrow is Mintable, DustCollector, IKeep3rEscrow {\n using SafeERC20 for IERC20;\n\n /// @inheritdoc IKeep3rEscrow\n address public override wKP3R;\n\n /// @param _governor Address of governor\n /// @param _wKP3R Address of wrapped KP3R implementation\n constructor(address _governor, address _wKP3R) Mintable(_governor) {\n wKP3R = _wKP3R;\n }\n\n /// @inheritdoc IKeep3rEscrow\n function deposit(uint256 _amount) external override {\n IERC20(wKP3R).safeTransferFrom(msg.sender, address(this), _amount);\n emit wKP3RDeposited(wKP3R, msg.sender, _amount);\n }\n\n /// @inheritdoc IKeep3rEscrow\n function mint(uint256 _amount) external override onlyMinter {\n IERC20(wKP3R).safeTransfer(msg.sender, _amount);\n emit wKP3RMinted(wKP3R, msg.sender, _amount);\n }\n\n /// @inheritdoc IKeep3rEscrow\n function setWKP3R(address _wKP3R) external override onlyGovernor {\n if (_wKP3R == address(0)) revert ZeroAddress();\n wKP3R = _wKP3R;\n emit wKP3RSet(wKP3R);\n }\n}\n" - }, - "solidity/contracts/peripherals/Mintable.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../../interfaces/peripherals/IMintable.sol';\nimport '@defi-wonderland/solidity-utils/solidity/contracts/Governable.sol';\n\nabstract contract Mintable is Governable, IMintable {\n /// @inheritdoc IMintable\n address public override minter;\n\n constructor(address _governor) Governable(_governor) {}\n\n /// @inheritdoc IMintable\n function setMinter(address _minter) external override onlyGovernor {\n if (_minter == address(0)) revert ZeroAddress();\n minter = _minter;\n emit MinterSet(_minter);\n }\n\n /// @notice Functions with this modifier can only be called by the minter;\n modifier onlyMinter() {\n if (msg.sender != minter) revert OnlyMinter();\n _;\n }\n}\n" - }, - "solidity/for-test/peripherals/keepers/Keep3rKeeperFundableForTest.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../../../contracts/peripherals/keepers/Keep3rKeeperFundable.sol';\n\ncontract Keep3rKeeperFundableForTest is Keep3rKeeperFundable {\n using EnumerableSet for EnumerableSet.AddressSet;\n\n constructor(\n address _kph,\n address _keep3rV1,\n address _keep3rV1Proxy\n ) Keep3rParameters(_kph, _keep3rV1, _keep3rV1Proxy) Keep3rRoles(msg.sender) {}\n\n function isKeeper(address _keeper) external view returns (bool) {\n return _keepers.contains(_keeper);\n }\n\n function setJob(address job) external {\n _jobs.add(job);\n }\n}\n" - }, - "solidity/for-test/BridgeForTest.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.0 <0.9.0;\n\nimport '@openzeppelin/contracts/token/ERC20/ERC20.sol';\nimport '@openzeppelin/contracts/token/ERC20/IERC20.sol';\n\ncontract BridgeForTest is ERC20 {\n address public immutable kp3r;\n\n constructor(address _kp3r) ERC20('Wrapped KP3R', 'wKP3R') {\n kp3r = _kp3r;\n }\n\n function bridge(uint256 _amount) external {\n IERC20(kp3r).transferFrom(msg.sender, address(this), _amount);\n _mint(msg.sender, _amount);\n }\n\n function bridgeBack(uint256 _amount) external {\n _burn(msg.sender, _amount);\n IERC20(kp3r).transfer(msg.sender, _amount);\n }\n}\n" - }, - "solidity/for-test/ERC20ForTest.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '@openzeppelin/contracts/token/ERC20/ERC20.sol';\n\ncontract ERC20ForTest is ERC20 {\n constructor(\n string memory _name,\n string memory _symbol,\n address _initialAccount,\n uint256 _initialBalance\n ) ERC20(_name, _symbol) {\n _mint(_initialAccount, _initialBalance);\n }\n\n function mint(uint256 _amount) public {\n _mint(msg.sender, _amount);\n }\n\n function mint(address _account, uint256 _amount) public {\n _mint(_account, _amount);\n }\n\n function burn(uint256 _amount) public {\n _burn(msg.sender, _amount);\n }\n\n function burn(address _account, uint256 _amount) public {\n _burn(_account, _amount);\n }\n\n function transferInternal(\n address _from,\n address _to,\n uint256 _value\n ) public {\n _transfer(_from, _to, _value);\n }\n\n function approveInternal(\n address _owner,\n address _spender,\n uint256 _value\n ) public {\n _approve(_owner, _spender, _value);\n }\n\n function deposit() external payable {\n // Function added for compatibility with WETH\n }\n}\n" - }, - "solidity/for-test/peripherals/keepers/Keep3rKeeperDisputableForTest.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../../../contracts/peripherals/keepers/Keep3rKeeperDisputable.sol';\n\ncontract Keep3rKeeperDisputableForTest is Keep3rKeeperDisputable {\n using EnumerableSet for EnumerableSet.AddressSet;\n\n constructor(\n address _kph,\n address _keep3rV1,\n address _keep3rV1Proxy\n ) Keep3rParameters(_kph, _keep3rV1, _keep3rV1Proxy) Keep3rRoles(msg.sender) {}\n\n function setKeeper(address _keeper) external {\n _keepers.add(_keeper);\n }\n\n function internalSlash(\n address _bonded,\n address _keeper,\n uint256 _bondAmount,\n uint256 _unbondAmount\n ) external {\n _slash(_bonded, _keeper, _bondAmount, _unbondAmount);\n }\n\n function isKeeper(address _address) external view returns (bool _isKeeper) {\n _isKeeper = _keepers.contains(_address);\n }\n}\n" - }, - "solidity/for-test/peripherals/Keep3rDisputableForTest.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../../contracts/peripherals/Keep3rDisputable.sol';\n\ncontract Keep3rDisputableForTest is Keep3rDisputable {\n constructor() Keep3rParameters(address(0), address(0), address(0)) Keep3rRoles(msg.sender) {}\n}\n" - }, - "solidity/for-test/peripherals/Keep3rParametersForTest.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../../contracts/peripherals/Keep3rParameters.sol';\n\ncontract Keep3rParametersForTest is Keep3rParameters {\n constructor(\n address _keep3rHelper,\n address _keep3rV1,\n address _keep3rV1Proxy\n ) Keep3rParameters(_keep3rHelper, _keep3rV1, _keep3rV1Proxy) Keep3rRoles(msg.sender) {}\n}\n" - }, - "solidity/for-test/peripherals/jobs/Keep3rJobFundableLiquidityForTest.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../../../contracts/peripherals/jobs/Keep3rJobFundableLiquidity.sol';\n\ncontract Keep3rJobFundableLiquidityForTest is Keep3rJobFundableLiquidity {\n using EnumerableSet for EnumerableSet.AddressSet;\n\n constructor(\n address _kph,\n address _keep3rV1,\n address _keep3rV1Proxy\n ) Keep3rParameters(_kph, _keep3rV1, _keep3rV1Proxy) Keep3rRoles(msg.sender) {}\n\n function setJob(address _job) external {\n _jobs.add(_job);\n }\n\n function setJobLiquidity(address _job, address _liquidity) external returns (bool) {\n return _jobLiquidities[_job].add(_liquidity);\n }\n\n function setApprovedLiquidity(address _liquidity) external {\n _approvedLiquidities.add(_liquidity);\n }\n\n function setRevokedLiquidity(address _liquidity) external {\n _approvedLiquidities.remove(_liquidity);\n }\n\n function viewTickCache(address _liquidity) external view returns (TickCache memory _tickCache) {\n _tickCache = _tick[_liquidity];\n }\n\n function viewTickOrder(address _liquidity) external view returns (bool) {\n return _isKP3RToken0[_liquidity];\n }\n\n function internalJobLiquidities(address _job) external view returns (address[] memory _list) {\n _list = _jobLiquidities[_job].values();\n }\n\n function internalSettleJobAccountance(address _job) external {\n _settleJobAccountance(_job);\n }\n}\n" - }, - "solidity/for-test/peripherals/jobs/Keep3rJobDisputableForTest.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../../../contracts/peripherals/jobs/Keep3rJobDisputable.sol';\n\ncontract Keep3rJobDisputableForTest is Keep3rJobDisputable {\n using EnumerableSet for EnumerableSet.AddressSet;\n\n constructor(\n address _kph,\n address _keep3rV1,\n address _keep3rV1Proxy\n ) Keep3rParameters(_kph, _keep3rV1, _keep3rV1Proxy) Keep3rRoles(msg.sender) {}\n\n function setJobLiquidity(address _job, address _liquidity) external {\n _jobLiquidities[_job].add(_liquidity);\n }\n\n function setJobToken(address _job, address _token) external {\n _jobTokens[_job].add(_token);\n }\n\n function setApprovedLiquidity(address _liquidity) external {\n _approvedLiquidities.add(_liquidity);\n }\n\n function setRevokedLiquidity(address _liquidity) external {\n _approvedLiquidities.remove(_liquidity);\n }\n\n function internalJobLiquidityCredits(address _job) external view returns (uint256 _credits) {\n _credits = _jobLiquidityCredits[_job];\n }\n\n function internalJobPeriodCredits(address _job) external view returns (uint256 _credits) {\n _credits = _jobPeriodCredits[_job];\n }\n\n function internalJobTokens(address _job) external view returns (address[] memory _tokens) {\n _tokens = new address[](_jobTokens[_job].length());\n for (uint256 i; i < _jobTokens[_job].length(); i++) {\n _tokens[i] = _jobTokens[_job].at(i);\n }\n }\n\n function internalJobLiquidities(address _job) external view returns (address[] memory _tokens) {\n _tokens = new address[](_jobLiquidities[_job].length());\n for (uint256 i; i < _jobLiquidities[_job].length(); i++) {\n _tokens[i] = _jobLiquidities[_job].at(i);\n }\n }\n}\n" - }, - "solidity/for-test/peripherals/jobs/Keep3rJobFundableCreditsForTest.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../../../contracts/peripherals/jobs/Keep3rJobFundableCredits.sol';\n\ncontract Keep3rJobFundableCreditsForTest is Keep3rJobFundableCredits {\n using EnumerableSet for EnumerableSet.AddressSet;\n\n constructor(\n address _kph,\n address _keep3rV1,\n address _keep3rV1Proxy\n ) Keep3rParameters(_kph, _keep3rV1, _keep3rV1Proxy) Keep3rRoles(msg.sender) {}\n\n function setJob(address _job, address _jobOwner) external {\n _jobs.add(_job);\n jobOwner[_job] = _jobOwner;\n }\n\n function setJobToken(address _job, address _token) external {\n _jobTokens[_job].add(_token);\n }\n\n function isJobToken(address _job, address _token) external view returns (bool _contains) {\n _contains = _jobTokens[_job].contains(_token);\n }\n}\n" - }, - "solidity/contracts/Keep3rHelper.sol": { - "content": "// SPDX-License-Identifier: MIT\n\n/*\n\nCoded for The Keep3r Network with ♥ by\n\n██████╗░███████╗███████╗██╗  ░██╗░░░░░░░██╗░█████╗░███╗░░██╗██████╗░███████╗██████╗░██╗░░░░░░█████╗░███╗░░██╗██████╗░\n██╔══██╗██╔════╝██╔════╝██║  ░██║░░██╗░░██║██╔══██╗████╗░██║██╔══██╗██╔════╝██╔══██╗██║░░░░░██╔══██╗████╗░██║██╔══██╗\n██║░░██║█████╗░░█████╗░░██║  ░╚██╗████╗██╔╝██║░░██║██╔██╗██║██║░░██║█████╗░░██████╔╝██║░░░░░███████║██╔██╗██║██║░░██║\n██║░░██║██╔══╝░░██╔══╝░░██║  ░░████╔═████║░██║░░██║██║╚████║██║░░██║██╔══╝░░██╔══██╗██║░░░░░██╔══██║██║╚████║██║░░██║\n██████╔╝███████╗██║░░░░░██║  ░░╚██╔╝░╚██╔╝░╚█████╔╝██║░╚███║██████╔╝███████╗██║░░██║███████╗██║░░██║██║░╚███║██████╔╝\n╚═════╝░╚══════╝╚═╝░░░░░╚═╝  ░░░╚═╝░░░╚═╝░░░╚════╝░╚═╝░░╚══╝╚═════╝░╚══════╝╚═╝░░╚═╝╚══════╝╚═╝░░╚═╝╚═╝░░╚══╝╚═════╝░\n\nhttps://defi.sucks\n\n*/\n\npragma solidity >=0.8.7 <0.9.0;\n\nimport './libraries/FullMath.sol';\nimport './libraries/TickMath.sol';\nimport '../interfaces/IKeep3r.sol';\nimport '../interfaces/IKeep3rHelper.sol';\nimport './Keep3rHelperParameters.sol';\n\nimport '@openzeppelin/contracts/utils/math/Math.sol';\nimport '@uniswap/v3-core/contracts/interfaces/IUniswapV3Pool.sol';\n\ncontract Keep3rHelper is IKeep3rHelper, Keep3rHelperParameters {\n constructor(\n address _kp3r,\n address _keep3rV2,\n address _governor,\n address _kp3rWethPool\n ) Keep3rHelperParameters(_kp3r, _keep3rV2, _governor, _kp3rWethPool) {}\n\n /// @inheritdoc IKeep3rHelper\n function quote(uint256 _eth) public view override returns (uint256 _amountOut) {\n uint32[] memory _secondsAgos = new uint32[](2);\n _secondsAgos[1] = quoteTwapTime;\n\n (int56[] memory _tickCumulatives, ) = IUniswapV3Pool(kp3rWethPool.poolAddress).observe(_secondsAgos);\n int56 _difference = _tickCumulatives[0] - _tickCumulatives[1];\n _amountOut = getQuoteAtTick(uint128(_eth), kp3rWethPool.isKP3RToken0 ? _difference : -_difference, quoteTwapTime);\n }\n\n /// @inheritdoc IKeep3rHelper\n function bonds(address _keeper) public view virtual override returns (uint256 _amountBonded) {\n return IKeep3r(keep3rV2).bonds(_keeper, KP3R);\n }\n\n /// @inheritdoc IKeep3rHelper\n function getRewardAmountFor(address _keeper, uint256 _gasUsed) public view override returns (uint256 _kp3r) {\n uint256 _boost = getRewardBoostFor(bonds(_keeper));\n _kp3r = quote((_gasUsed * _boost) / BOOST_BASE);\n }\n\n /// @inheritdoc IKeep3rHelper\n function getRewardAmount(uint256 _gasUsed) external view override returns (uint256 _amount) {\n // solhint-disable-next-line avoid-tx-origin\n return getRewardAmountFor(tx.origin, _gasUsed);\n }\n\n /// @inheritdoc IKeep3rHelper\n function getRewardBoostFor(uint256 _bonds) public view override returns (uint256 _rewardBoost) {\n _bonds = Math.min(_bonds, targetBond);\n uint256 _cap = minBoost + ((maxBoost - minBoost) * _bonds) / targetBond;\n _rewardBoost = _cap * _getBasefee();\n }\n\n /// @inheritdoc IKeep3rHelper\n function getPoolTokens(address _pool) public view override returns (address _token0, address _token1) {\n return (IUniswapV3Pool(_pool).token0(), IUniswapV3Pool(_pool).token1());\n }\n\n /// @inheritdoc IKeep3rHelper\n function isKP3RToken0(address _pool) external view virtual override returns (bool _isKP3RToken0) {\n address _token0;\n address _token1;\n (_token0, _token1) = getPoolTokens(_pool);\n if (_token0 == KP3R) {\n return true;\n } else if (_token1 != KP3R) {\n revert LiquidityPairInvalid();\n }\n }\n\n /// @inheritdoc IKeep3rHelper\n function observe(address _pool, uint32[] memory _secondsAgo)\n external\n view\n override\n returns (\n int56 _tickCumulative1,\n int56 _tickCumulative2,\n bool _success\n )\n {\n try IUniswapV3Pool(_pool).observe(_secondsAgo) returns (int56[] memory _uniswapResponse, uint160[] memory) {\n _tickCumulative1 = _uniswapResponse[0];\n if (_uniswapResponse.length > 1) {\n _tickCumulative2 = _uniswapResponse[1];\n }\n _success = true;\n } catch (bytes memory) {}\n }\n\n /// @inheritdoc IKeep3rHelper\n function getPaymentParams(uint256 _bonds)\n external\n view\n virtual\n override\n returns (\n uint256 _boost,\n uint256 _oneEthQuote,\n uint256 _extra\n )\n {\n _oneEthQuote = quote(1 ether);\n _boost = getRewardBoostFor(_bonds);\n _extra = workExtraGas;\n }\n\n /// @inheritdoc IKeep3rHelper\n function getKP3RsAtTick(\n uint256 _liquidityAmount,\n int56 _tickDifference,\n uint256 _timeInterval\n ) external pure override returns (uint256 _kp3rAmount) {\n uint160 sqrtRatioX96 = TickMath.getSqrtRatioAtTick(int24(_tickDifference / int256(_timeInterval)));\n _kp3rAmount = FullMath.mulDiv(1 << 96, _liquidityAmount, sqrtRatioX96);\n }\n\n /// @inheritdoc IKeep3rHelper\n function getQuoteAtTick(\n uint128 _baseAmount,\n int56 _tickDifference,\n uint256 _timeInterval\n ) public pure override returns (uint256 _quoteAmount) {\n uint160 sqrtRatioX96 = TickMath.getSqrtRatioAtTick(int24(_tickDifference / int256(_timeInterval)));\n\n if (sqrtRatioX96 <= type(uint128).max) {\n uint256 ratioX192 = uint256(sqrtRatioX96) * sqrtRatioX96;\n _quoteAmount = FullMath.mulDiv(1 << 192, _baseAmount, ratioX192);\n } else {\n uint256 ratioX128 = FullMath.mulDiv(sqrtRatioX96, sqrtRatioX96, 1 << 64);\n _quoteAmount = FullMath.mulDiv(1 << 128, _baseAmount, ratioX128);\n }\n }\n\n /// @notice Gets the gas basefee cost to calculate keeper rewards\n /// @dev Keepers are required to pay a priority fee to be included, this function recognizes a minimum priority fee\n /// @return _baseFee The block's basefee + a minimum priority fee, or a preset minimum gas fee\n function _getBasefee() internal view virtual returns (uint256 _baseFee) {\n return Math.max(minBaseFee, block.basefee + minPriorityFee);\n }\n}\n" - }, - "solidity/for-test/testnet/Keep3rHelperForTestnet.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../../contracts/Keep3rHelper.sol';\n\ncontract Keep3rHelperForTestnet is Keep3rHelper {\n constructor(\n address _kp3r,\n address _keep3rV2,\n address _governor,\n address _kp3rWethPool\n ) Keep3rHelper(_kp3r, _keep3rV2, _governor, _kp3rWethPool) {}\n\n function _getBasefee() internal pure override returns (uint256) {\n return 1;\n }\n}\n" - }, - "solidity/for-test/Keep3rHelperForTest.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../contracts/Keep3rHelper.sol';\n\ncontract Keep3rHelperForTest is Keep3rHelper {\n uint256 public basefee;\n\n constructor(\n address _kp3r,\n address _keep3rV2,\n address _governor,\n address _kp3rWethPool\n ) Keep3rHelper(_kp3r, _keep3rV2, _governor, _kp3rWethPool) {}\n\n function _getBasefee() internal view override returns (uint256) {\n return basefee != 0 ? (basefee + minPriorityFee) : super._getBasefee();\n }\n\n function setBaseFee(uint256 _baseFee) external {\n basefee = _baseFee;\n }\n}\n" - }, - "solidity/contracts/sidechain/Keep3rHelperSidechain.sol": { - "content": "// SPDX-License-Identifier: MIT\n\n/*\n\nCoded for The Keep3r Network with ♥ by\n\n██████╗░███████╗███████╗██╗░░░██╗░░░░░░░██╗░█████╗░███╗░░██╗██████╗░███████╗██████╗░██╗░░░░░░█████╗░███╗░░██╗██████╗░\n██╔══██╗██╔════╝██╔════╝██║░░░██║░░██╗░░██║██╔══██╗████╗░██║██╔══██╗██╔════╝██╔══██╗██║░░░░░██╔══██╗████╗░██║██╔══██╗\n██║░░██║█████╗░░█████╗░░██║░░░╚██╗████╗██╔╝██║░░██║██╔██╗██║██║░░██║█████╗░░██████╔╝██║░░░░░███████║██╔██╗██║██║░░██║\n██║░░██║██╔══╝░░██╔══╝░░██║░░░░████╔═████║░██║░░██║██║╚████║██║░░██║██╔══╝░░██╔══██╗██║░░░░░██╔══██║██║╚████║██║░░██║\n██████╔╝███████╗██║░░░░░██║░░░░╚██╔╝░╚██╔╝░╚█████╔╝██║░╚███║██████╔╝███████╗██║░░██║███████╗██║░░██║██║░╚███║██████╔╝\n╚═════╝░╚══════╝╚═╝░░░░░╚═╝░░░░░╚═╝░░░╚═╝░░░╚════╝░╚═╝░░╚══╝╚═════╝░╚══════╝╚═╝░░╚═╝╚══════╝╚═╝░░╚═╝╚═╝░░╚══╝╚═════╝░\n\nhttps://defi.sucks\n\nCommit hash: ead559c8dc4361349b7222741c2399447e255d8e\n\n*/\n\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../Keep3rHelper.sol';\nimport '../../interfaces/sidechain/IKeep3rHelperSidechain.sol';\n\ncontract Keep3rHelperSidechain is IKeep3rHelperSidechain, Keep3rHelper {\n /// @inheritdoc IKeep3rHelperSidechain\n mapping(address => address) public override oracle;\n /// @inheritdoc IKeep3rHelperSidechain\n IKeep3rHelperSidechain.WethUsdOraclePool public override wethUSDPool;\n\n /// @notice Ethereum mainnet WETH address used for quoting references\n address public immutable override WETH;\n\n /// @dev Amount of decimals in which USD is quoted within the contract\n uint256 constant _USD_BASE_DECIMALS = 18;\n\n /// @param _keep3rV2 Address of sidechain Keep3r implementation\n /// @param _governor Address of governor\n /// @param _kp3rWethOracle Address of oracle used for KP3R/WETH quote\n /// @param _wethUsdOracle Address of oracle used for WETH/USD quote\n /// @dev Oracle pools should use 18 decimals tokens\n constructor(\n address _keep3rV2,\n address _governor,\n address _kp3r,\n address _weth,\n address _kp3rWethOracle,\n address _wethUsdOracle,\n uint8 _usdDecimals\n ) Keep3rHelper(_kp3r, _keep3rV2, _governor, _kp3rWethOracle) {\n WETH = _weth;\n\n // Immutable variables [KP3R] cannot be read during contract creation time [_setKp3rWethPool]\n bool _isWETHToken0 = _validateOraclePool(_wethUsdOracle, WETH);\n wethUSDPool = WethUsdOraclePool(_wethUsdOracle, _isWETHToken0, _usdDecimals);\n emit WethUSDPoolChange(wethUSDPool.poolAddress, wethUSDPool.isWETHToken0, _usdDecimals);\n\n _setQuoteTwapTime(1 days);\n workExtraGas = 0;\n }\n\n /// @inheritdoc IKeep3rHelper\n /// @notice Uses valid wKP3R address from Keep3rSidechain to query keeper bonds\n function bonds(address _keeper) public view override(Keep3rHelper, IKeep3rHelper) returns (uint256 _amountBonded) {\n address wKP3R = IKeep3r(keep3rV2).keep3rV1();\n return IKeep3r(keep3rV2).bonds(_keeper, wKP3R);\n }\n\n /// @inheritdoc IKeep3rHelperSidechain\n function setOracle(address _liquidity, address _oracle) external override onlyGovernor {\n if (_liquidity == address(0) || _oracle == address(0)) revert ZeroAddress();\n oracle[_liquidity] = _oracle;\n emit OracleSet(_liquidity, _oracle);\n }\n\n /// @inheritdoc IKeep3rHelperSidechain\n function quoteUsdToEth(uint256 _usd) public view virtual override returns (uint256 _amountOut) {\n uint32[] memory _secondsAgos = new uint32[](2);\n _secondsAgos[1] = quoteTwapTime;\n _usd = _usd / 10**(_USD_BASE_DECIMALS - wethUSDPool.usdDecimals);\n\n /// @dev Oracle is compatible with IUniswapV3Pool\n (int56[] memory _tickCumulatives, ) = IUniswapV3Pool(wethUSDPool.poolAddress).observe(_secondsAgos);\n int56 _difference = _tickCumulatives[0] - _tickCumulatives[1];\n _amountOut = getQuoteAtTick(uint128(_usd), wethUSDPool.isWETHToken0 ? _difference : -_difference, quoteTwapTime);\n }\n\n /// @inheritdoc IKeep3rHelperSidechain\n function setWethUsdPool(address _poolAddress, uint8 _usdDecimals) external override onlyGovernor {\n if (_poolAddress == address(0)) revert ZeroAddress();\n _setWethUsdPool(_poolAddress, _usdDecimals);\n }\n\n /// @inheritdoc IKeep3rHelper\n function getPaymentParams(uint256 _bonds)\n external\n view\n virtual\n override(Keep3rHelper, IKeep3rHelper)\n returns (\n uint256 _boost,\n uint256 _oneUsdQuote,\n uint256 _extraGas\n )\n {\n _oneUsdQuote = quote(quoteUsdToEth(1 ether));\n _boost = getRewardBoostFor(_bonds);\n _extraGas = workExtraGas;\n }\n\n function _setWethUsdPool(address _poolAddress, uint8 _usdDecimals) internal {\n bool _isWETHToken0 = _validateOraclePool(_poolAddress, WETH);\n wethUSDPool = WethUsdOraclePool(_poolAddress, _isWETHToken0, _usdDecimals);\n emit WethUSDPoolChange(wethUSDPool.poolAddress, wethUSDPool.isWETHToken0, _usdDecimals);\n }\n\n /// @dev Sidechain jobs are quoted by USD/gasUnit, baseFee is set to 1\n function _getBasefee() internal view virtual override returns (uint256 _baseFee) {\n return 1;\n }\n}\n" - }, - "solidity/for-test/peripherals/jobs/Keep3rJobWorkableForTest.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../../../contracts/peripherals/jobs/Keep3rJobWorkable.sol';\n\ncontract Keep3rJobWorkableForTest is Keep3rJobWorkable {\n using EnumerableSet for EnumerableSet.AddressSet;\n\n constructor(\n address _keep3rHelper,\n address _keep3rV1,\n address _keep3rV1Proxy\n ) Keep3rParameters(_keep3rHelper, _keep3rV1, _keep3rV1Proxy) Keep3rRoles(msg.sender) {}\n\n function setJob(address _job) external {\n _jobs.add(_job);\n }\n\n function setKeeper(address _keeper) external {\n _keepers.add(_keeper);\n }\n\n function setApprovedLiquidity(address _liquidity) external {\n _approvedLiquidities.add(_liquidity);\n }\n\n function setJobLiquidity(address _job, address _liquidity) external {\n _jobLiquidities[_job].add(_liquidity);\n }\n\n function viewJobLiquidityCredits(address _job) external view returns (uint256) {\n return _jobLiquidityCredits[_job];\n }\n\n function viewJobPeriodCredits(address _job) external view returns (uint256) {\n return _jobPeriodCredits[_job];\n }\n\n function viewTickCache(address _liquidity) external view returns (TickCache memory _tickCache) {\n _tickCache = _tick[_liquidity];\n }\n\n function viewGas() external view returns (uint256) {\n return _initialGas;\n }\n}\n" - }, - "solidity/for-test/peripherals/jobs/Keep3rJobMigrationForTest.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../../../contracts/peripherals/jobs/Keep3rJobMigration.sol';\n\ncontract Keep3rJobMigrationForTest is Keep3rJobMigration {\n using EnumerableSet for EnumerableSet.AddressSet;\n\n mapping(address => uint256) public settleJobAccountanceCallCount;\n\n constructor(\n address _kph,\n address _keep3rV1,\n address _keep3rV1Proxy\n ) Keep3rParameters(_kph, _keep3rV1, _keep3rV1Proxy) Keep3rRoles(msg.sender) {}\n\n function setJobToken(address _job, address _token) external {\n _jobTokens[_job].add(_token);\n }\n\n function setJobLiquidity(address _job, address _liquidity) external {\n _jobLiquidities[_job].add(_liquidity);\n }\n\n function viewJobTokenListLength(address _job) external view returns (uint256) {\n return _jobTokens[_job].length();\n }\n\n function viewJobLiquidityList(address _job) external view returns (address[] memory _list) {\n _list = _jobLiquidities[_job].values();\n }\n\n function viewJobPeriodCredits(address _job) external view returns (uint256) {\n return _jobPeriodCredits[_job];\n }\n\n function viewJobLiquidityCredits(address _job) external view returns (uint256) {\n return _jobLiquidityCredits[_job];\n }\n\n function viewMigrationCreatedAt(address _fromJob, address _toJob) external view returns (uint256) {\n return _migrationCreatedAt[_fromJob][_toJob];\n }\n\n function isJob(address _job) external view returns (bool) {\n return _jobs.contains(_job);\n }\n\n function _settleJobAccountance(address _job) internal override {\n settleJobAccountanceCallCount[_job]++;\n }\n}\n" - }, - "solidity/for-test/peripherals/jobs/Keep3rJobOwnershipForTest.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../../../contracts/peripherals/jobs/Keep3rJobOwnership.sol';\n\ncontract Keep3rJobOwnershipForTest is Keep3rJobOwnership {}\n" - }, - "solidity/for-test/peripherals/jobs/Keep3rJobManagerForTest.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../../../contracts/peripherals/jobs/Keep3rJobManager.sol';\n\ncontract Keep3rJobManagerForTest is Keep3rJobManager {\n using EnumerableSet for EnumerableSet.AddressSet;\n\n constructor(\n address _keep3rHelper,\n address _keep3rV1,\n address _keep3rV1Proxy\n ) Keep3rRoles(msg.sender) {}\n\n function isJob(address _job) external view returns (bool _isJob) {\n _isJob = _jobs.contains(_job);\n }\n}\n" - }, - "solidity/for-test/peripherals/Keep3rAccountanceForTest.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../../contracts/peripherals/Keep3rAccountance.sol';\n\ncontract Keep3rAccountanceForTest is Keep3rAccountance {\n using EnumerableSet for EnumerableSet.AddressSet;\n\n constructor() Keep3rRoles(msg.sender) {}\n\n function setJob(address job) external {\n _jobs.add(job);\n }\n\n function setKeeper(address keeper) external {\n _keepers.add(keeper);\n }\n}\n" - }, - "solidity/for-test/IUniswapV3PoolForTest.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4 <0.9.0;\n\nimport '@uniswap/v3-core/contracts/interfaces/IERC20Minimal.sol';\nimport '@uniswap/v3-core/contracts/interfaces/IUniswapV3Pool.sol';\n\n// solhint-disable-next-line no-empty-blocks\ninterface IUniswapV3PoolForTest is IERC20Minimal, IUniswapV3Pool {\n\n}\n" - }, - "@uniswap/v3-core/contracts/interfaces/IERC20Minimal.sol": { - "content": "// SPDX-License-Identifier: GPL-2.0-or-later\npragma solidity >=0.5.0;\n\n/// @title Minimal ERC20 interface for Uniswap\n/// @notice Contains a subset of the full ERC20 interface that is used in Uniswap V3\ninterface IERC20Minimal {\n /// @notice Returns the balance of a token\n /// @param account The account for which to look up the number of tokens it has, i.e. its balance\n /// @return The number of tokens held by the account\n function balanceOf(address account) external view returns (uint256);\n\n /// @notice Transfers the amount of token from the `msg.sender` to the recipient\n /// @param recipient The account that will receive the amount transferred\n /// @param amount The number of tokens to send from the sender to the recipient\n /// @return Returns true for a successful transfer, false for an unsuccessful transfer\n function transfer(address recipient, uint256 amount) external returns (bool);\n\n /// @notice Returns the current allowance given to a spender by an owner\n /// @param owner The account of the token owner\n /// @param spender The account of the token spender\n /// @return The current allowance granted by `owner` to `spender`\n function allowance(address owner, address spender) external view returns (uint256);\n\n /// @notice Sets the allowance of a spender from the `msg.sender` to the value `amount`\n /// @param spender The account which will be allowed to spend a given amount of the owners tokens\n /// @param amount The amount of tokens allowed to be used by `spender`\n /// @return Returns true for a successful approval, false for unsuccessful\n function approve(address spender, uint256 amount) external returns (bool);\n\n /// @notice Transfers `amount` tokens from `sender` to `recipient` up to the allowance given to the `msg.sender`\n /// @param sender The account from which the transfer will be initiated\n /// @param recipient The recipient of the transfer\n /// @param amount The amount of the transfer\n /// @return Returns true for a successful transfer, false for unsuccessful\n function transferFrom(\n address sender,\n address recipient,\n uint256 amount\n ) external returns (bool);\n\n /// @notice Event emitted when tokens are transferred from one address to another, either via `#transfer` or `#transferFrom`.\n /// @param from The account from which the tokens were sent, i.e. the balance decreased\n /// @param to The account to which the tokens were sent, i.e. the balance increased\n /// @param value The amount of tokens that were transferred\n event Transfer(address indexed from, address indexed to, uint256 value);\n\n /// @notice Event emitted when the approval amount for the spender of a given owner's tokens changes.\n /// @param owner The account that approved spending of its tokens\n /// @param spender The account for which the spending allowance was modified\n /// @param value The new allowance from the owner to the spender\n event Approval(address indexed owner, address indexed spender, uint256 value);\n}\n" - }, - "solidity/for-test/libraries/LiquidityAmountsForTest.sol": { - "content": "// SPDX-License-Identifier: GPL-2.0-or-later\npragma solidity >=0.8.4 <0.9.0;\n\nimport '../../contracts/libraries/FullMath.sol';\nimport '../../contracts/libraries/FixedPoint96.sol';\n\n/// @dev Made this library into a contract to be able to calculate liquidity more precisely for tests\n\n// solhint-disable\ncontract LiquidityAmountsForTest {\n function toUint128(uint256 x) private pure returns (uint128 y) {\n require((y = uint128(x)) == x);\n }\n\n function getLiquidityForAmount0(\n uint160 sqrtRatioAX96,\n uint160 sqrtRatioBX96,\n uint256 amount0\n ) public pure returns (uint128 liquidity) {\n if (sqrtRatioAX96 > sqrtRatioBX96) (sqrtRatioAX96, sqrtRatioBX96) = (sqrtRatioBX96, sqrtRatioAX96);\n uint256 intermediate = FullMath.mulDiv(sqrtRatioAX96, sqrtRatioBX96, FixedPoint96.Q96);\n return toUint128(FullMath.mulDiv(amount0, intermediate, sqrtRatioBX96 - sqrtRatioAX96));\n }\n\n function getLiquidityForAmount1(\n uint160 sqrtRatioAX96,\n uint160 sqrtRatioBX96,\n uint256 amount1\n ) public pure returns (uint128 liquidity) {\n if (sqrtRatioAX96 > sqrtRatioBX96) (sqrtRatioAX96, sqrtRatioBX96) = (sqrtRatioBX96, sqrtRatioAX96);\n return toUint128(FullMath.mulDiv(amount1, FixedPoint96.Q96, sqrtRatioBX96 - sqrtRatioAX96));\n }\n\n function getLiquidityForAmounts(\n uint160 sqrtRatioX96,\n uint160 sqrtRatioAX96,\n uint160 sqrtRatioBX96,\n uint256 amount0,\n uint256 amount1\n ) external pure returns (uint128 liquidity) {\n if (sqrtRatioAX96 > sqrtRatioBX96) (sqrtRatioAX96, sqrtRatioBX96) = (sqrtRatioBX96, sqrtRatioAX96);\n\n if (sqrtRatioX96 <= sqrtRatioAX96) {\n liquidity = getLiquidityForAmount0(sqrtRatioAX96, sqrtRatioBX96, amount0);\n } else if (sqrtRatioX96 < sqrtRatioBX96) {\n uint128 liquidity0 = getLiquidityForAmount0(sqrtRatioX96, sqrtRatioBX96, amount0);\n uint128 liquidity1 = getLiquidityForAmount1(sqrtRatioAX96, sqrtRatioX96, amount1);\n\n liquidity = liquidity0 < liquidity1 ? liquidity0 : liquidity1;\n } else {\n liquidity = getLiquidityForAmount1(sqrtRatioAX96, sqrtRatioBX96, amount1);\n }\n }\n\n function getAmount0ForLiquidity(\n uint160 sqrtRatioAX96,\n uint160 sqrtRatioBX96,\n uint128 liquidity\n ) public pure returns (uint256 amount0) {\n if (sqrtRatioAX96 > sqrtRatioBX96) (sqrtRatioAX96, sqrtRatioBX96) = (sqrtRatioBX96, sqrtRatioAX96);\n\n return FullMath.mulDiv(uint256(liquidity) << FixedPoint96.RESOLUTION, sqrtRatioBX96 - sqrtRatioAX96, sqrtRatioBX96) / sqrtRatioAX96;\n }\n\n function getAmount1ForLiquidity(\n uint160 sqrtRatioAX96,\n uint160 sqrtRatioBX96,\n uint128 liquidity\n ) public pure returns (uint256 amount1) {\n if (sqrtRatioAX96 > sqrtRatioBX96) (sqrtRatioAX96, sqrtRatioBX96) = (sqrtRatioBX96, sqrtRatioAX96);\n\n return FullMath.mulDiv(liquidity, sqrtRatioBX96 - sqrtRatioAX96, FixedPoint96.Q96);\n }\n\n function getAmountsForLiquidity(\n uint160 sqrtRatioX96,\n uint160 sqrtRatioAX96,\n uint160 sqrtRatioBX96,\n uint128 liquidity\n ) external pure returns (uint256 amount0, uint256 amount1) {\n if (sqrtRatioAX96 > sqrtRatioBX96) (sqrtRatioAX96, sqrtRatioBX96) = (sqrtRatioBX96, sqrtRatioAX96);\n\n if (sqrtRatioX96 <= sqrtRatioAX96) {\n amount0 = getAmount0ForLiquidity(sqrtRatioAX96, sqrtRatioBX96, liquidity);\n } else if (sqrtRatioX96 < sqrtRatioBX96) {\n amount0 = getAmount0ForLiquidity(sqrtRatioX96, sqrtRatioBX96, liquidity);\n amount1 = getAmount1ForLiquidity(sqrtRatioAX96, sqrtRatioX96, liquidity);\n } else {\n amount1 = getAmount1ForLiquidity(sqrtRatioAX96, sqrtRatioBX96, liquidity);\n }\n }\n}\n" - } - }, - "settings": { - "optimizer": { - "enabled": true, - "runs": 200 - }, - "outputSelection": { - "*": { - "*": [ - "storageLayout", - "abi", - "evm.bytecode", - "evm.deployedBytecode", - "evm.methodIdentifiers", - "metadata", - "devdoc", - "userdoc", - "evm.gasEstimates" - ], - "": [ - "ast" - ] - } - }, - "metadata": { - "useLiteralContent": true - }, - "libraries": { - "": { - "__CACHE_BREAKER__": "0x00000000d41867734bbee4c6863d9255b2b06ac1" - } - } - } -} \ No newline at end of file diff --git a/deployments/sepolia/.chainId b/deployments/sepolia/.chainId new file mode 100644 index 0000000..bd8d1cd --- /dev/null +++ b/deployments/sepolia/.chainId @@ -0,0 +1 @@ +11155111 \ No newline at end of file diff --git a/deployments/sepolia/.pendingTransactions b/deployments/sepolia/.pendingTransactions new file mode 100644 index 0000000..d396bf0 --- /dev/null +++ b/deployments/sepolia/.pendingTransactions @@ -0,0 +1,19 @@ +{ + "0x23dce779482d6fb369b96be6d9bac81dec10dc5ad7fb4f05951583247659aeb4": { + "decoded": { + "from": "0x169Cf949aB1B25453b70F2Fe874e2c65c10AE0f8", + "gasPrice": "6929119120", + "maxFeePerGas": "6929119120", + "maxPriorityFeePerGas": "1281852824", + "gasLimit": "1000000", + "to": "0x0676fb8D6d8c46D0542c28375dB4EaA84DedFc92", + "value": "0", + "nonce": 384, + "data": "0x322e9f04", + "r": "0xa2fc5ebe4a2c565f4fb063787fa6ab08f8e8b574b60bf05c2d8ebd480d497372", + "s": "0x3190cb3506c693f42c64e37132ebd2e3f48f212db23816652033e986ce2799be", + "v": 1, + "chainId": 11155111 + } + } +} \ No newline at end of file diff --git a/deployments/sepolia/JobForTest.json b/deployments/sepolia/JobForTest.json new file mode 100644 index 0000000..297d4f9 --- /dev/null +++ b/deployments/sepolia/JobForTest.json @@ -0,0 +1,133 @@ +{ + "address": "0x0676fb8D6d8c46D0542c28375dB4EaA84DedFc92", + "abi": [ + { + "inputs": [ + { + "internalType": "address", + "name": "_keep3r", + "type": "address" + } + ], + "stateMutability": "nonpayable", + "type": "constructor" + }, + { + "inputs": [], + "name": "InvalidKeeper", + "type": "error" + }, + { + "inputs": [], + "name": "keep3r", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "nonce", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "work", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "_factor", + "type": "uint256" + } + ], + "name": "workHard", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + } + ], + "transactionHash": "0x2cf2c3b5754490c72c8fea07e1d2ca12c5cc3a335a5ba2fdacce54b8ea512251", + "receipt": { + "to": null, + "from": "0x169Cf949aB1B25453b70F2Fe874e2c65c10AE0f8", + "contractAddress": "0x0676fb8D6d8c46D0542c28375dB4EaA84DedFc92", + "transactionIndex": 38, + "gasUsed": "292876", + "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "blockHash": "0xd41345db09079310925fc9d4717f55795abcf013280fc64932e37ea97af277dd", + "transactionHash": "0x2cf2c3b5754490c72c8fea07e1d2ca12c5cc3a335a5ba2fdacce54b8ea512251", + "logs": [], + "blockNumber": 6046937, + "cumulativeGasUsed": "6918691", + "status": 1, + "byzantium": true + }, + "args": [ + "0xbC855B9Ad7398360999Bd176edBC98EB53F9E26F" + ], + "numDeployments": 1, + "solcInputHash": "7e487ffac6cc746418dd55e44916bb6b", + "metadata": "{\"compiler\":{\"version\":\"0.8.8+commit.dddeac2f\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_keep3r\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"inputs\":[],\"name\":\"InvalidKeeper\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"keep3r\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"nonce\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"work\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_factor\",\"type\":\"uint256\"}],\"name\":\"workHard\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"}],\"devdoc\":{\"kind\":\"dev\",\"methods\":{},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{},\"version\":1}},\"settings\":{\"compilationTarget\":{\"solidity/for-test/JobForTest.sol\":\"JobForTest\"},\"evmVersion\":\"london\",\"libraries\":{\":__CACHE_BREAKER__\":\"0x00000000d41867734bbee4c6863d9255b2b06ac1\"},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":200},\"remappings\":[]},\"sources\":{\"@defi-wonderland/solidity-utils/solidity/interfaces/IBaseErrors.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.8 <0.9.0;\\n\\ninterface IBaseErrors {\\n /// @notice Thrown if an address is invalid\\n error InvalidAddress();\\n\\n /// @notice Thrown if an amount is invalid\\n error InvalidAmount();\\n\\n /// @notice Thrown if the lengths of a set of lists mismatch\\n error LengthMismatch();\\n\\n /// @notice Thrown if an address is the zero address\\n error ZeroAddress();\\n\\n /// @notice Thrown if an amount is zero\\n error ZeroAmount();\\n}\\n\",\"keccak256\":\"0xec09b9d248b6fbf6343dee41d6978abdc15d4c8df5ed7721e8df79e8b1a558cf\",\"license\":\"MIT\"},\"@defi-wonderland/solidity-utils/solidity/interfaces/IDustCollector.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.8 <0.9.0;\\n\\nimport {IGovernable} from './IGovernable.sol';\\nimport {IBaseErrors} from './IBaseErrors.sol';\\n\\n/// @title DustCollector interface\\ninterface IDustCollector is IBaseErrors, IGovernable {\\n // STATE VARIABLES\\n\\n /// @return _ethAddress Address used to trigger a native token transfer\\n // solhint-disable-next-line func-name-mixedcase\\n function ETH_ADDRESS() external view returns (address _ethAddress);\\n\\n // EVENTS\\n\\n /// @notice Emitted when dust is sent\\n /// @param _to The address which wil received the funds\\n /// @param _token The token that will be transferred\\n /// @param _amount The amount of the token that will be transferred\\n event DustSent(address _token, uint256 _amount, address _to);\\n\\n // FUNCTIONS\\n\\n /// @notice Allows an authorized user to transfer the tokens or eth that may have been left in a contract\\n /// @param _token The token that will be transferred\\n /// @param _amount The amont of the token that will be transferred\\n /// @param _to The address that will receive the idle funds\\n function sendDust(address _token, uint256 _amount, address _to) external;\\n}\\n\",\"keccak256\":\"0xbe22cc660bd6846093504989146038bd369f511325cef40cdc647fe7e04206b1\",\"license\":\"MIT\"},\"@defi-wonderland/solidity-utils/solidity/interfaces/IGovernable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.8 <0.9.0;\\n\\nimport {IBaseErrors} from './IBaseErrors.sol';\\n\\n/// @title Governable interface\\ninterface IGovernable is IBaseErrors {\\n // STATE VARIABLES\\n\\n /// @return _governor Address of the current governor\\n function governor() external view returns (address _governor);\\n\\n /// @return _pendingGovernor Address of the current pending governor\\n function pendingGovernor() external view returns (address _pendingGovernor);\\n\\n // EVENTS\\n\\n /// @notice Emitted when a new pending governor is set\\n /// @param _governor Address of the current governor\\n /// @param _pendingGovernor Address of the proposed next governor\\n event PendingGovernorSet(address _governor, address _pendingGovernor);\\n\\n /// @notice Emitted when a new governor is set\\n /// @param _newGovernor Address of the new governor\\n event PendingGovernorAccepted(address _newGovernor);\\n\\n // ERRORS\\n\\n /// @notice Thrown if a non-governor user tries to call a OnlyGovernor function\\n error OnlyGovernor();\\n\\n /// @notice Thrown if a non-pending-governor user tries to call a OnlyPendingGovernor function\\n error OnlyPendingGovernor();\\n\\n // FUNCTIONS\\n\\n /// @notice Allows a governor to propose a new governor\\n /// @param _pendingGovernor Address of the proposed new governor\\n function setPendingGovernor(address _pendingGovernor) external;\\n\\n /// @notice Allows a proposed governor to accept the governance\\n function acceptPendingGovernor() external;\\n}\\n\",\"keccak256\":\"0x40b94706a00d2c092f620807ba84bdd0c5ed8cfa60140c924edc850427e0af13\",\"license\":\"MIT\"},\"solidity/for-test/JobForTest.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4 <0.9.0;\\n\\nimport \\\"../interfaces/IKeep3r.sol\\\";\\n\\ncontract JobForTest {\\n error InvalidKeeper();\\n\\n address public keep3r;\\n uint256 public nonce;\\n\\n constructor(address _keep3r) {\\n keep3r = _keep3r;\\n }\\n\\n function work() external {\\n if (!IKeep3r(keep3r).isKeeper(msg.sender)) revert InvalidKeeper();\\n\\n for (uint256 i; i < 1000; i++) {\\n nonce++;\\n }\\n\\n IKeep3r(keep3r).worked(msg.sender);\\n }\\n\\n function workHard(uint256 _factor) external {\\n if (!IKeep3r(keep3r).isKeeper(msg.sender)) revert InvalidKeeper();\\n\\n for (uint256 i; i < 1000 * _factor; i++) {\\n nonce++;\\n }\\n\\n IKeep3r(keep3r).worked(msg.sender);\\n }\\n}\\n\",\"keccak256\":\"0x7cfdceb054e5076bec139b827733b4a621130417addc26f4b52d8ad4d83df23f\",\"license\":\"MIT\"},\"solidity/interfaces/IKeep3r.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4 <0.9.0;\\n\\nimport './peripherals/IKeep3rJobs.sol';\\nimport './peripherals/IKeep3rKeepers.sol';\\nimport './peripherals/IKeep3rParameters.sol';\\n\\n// solhint-disable-next-line no-empty-blocks\\n\\n/// @title Keep3rV2 contract\\n/// @notice This contract inherits all the functionality of Keep3rV2\\ninterface IKeep3r is IKeep3rJobs, IKeep3rKeepers, IKeep3rParameters {\\n\\n}\\n\",\"keccak256\":\"0x273a39984c1475c60182e636bb91a1b89ec98646a036cac6a87067869b3adeb9\",\"license\":\"MIT\"},\"solidity/interfaces/peripherals/IKeep3rAccountance.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4 <0.9.0;\\n\\nimport './IKeep3rRoles.sol';\\n\\n/// @title Keep3rDisputable contract\\n/// @notice Disputes keepers, or if they're already disputed, it can resolve the case\\n/// @dev Argument `bonding` can be the address of either a token or a liquidity\\ninterface IKeep3rAccountance is IKeep3rRoles {\\n // Events\\n\\n /// @notice Emitted when the bonding process of a new keeper begins\\n /// @param _keeper The caller of Keep3rKeeperFundable#bond function\\n /// @param _bonding The asset the keeper has bonded\\n /// @param _amount The amount the keeper has bonded\\n event Bonding(address indexed _keeper, address indexed _bonding, uint256 _amount);\\n\\n /// @notice Emitted when a keeper or job begins the unbonding process to withdraw the funds\\n /// @param _keeperOrJob The keeper or job that began the unbonding process\\n /// @param _unbonding The liquidity pair or asset being unbonded\\n /// @param _amount The amount being unbonded\\n event Unbonding(address indexed _keeperOrJob, address indexed _unbonding, uint256 _amount);\\n\\n // Variables\\n\\n /// @notice Tracks the total amount of bonded KP3Rs in the contract\\n /// @return _totalBonds The total amount of bonded KP3Rs in the contract\\n function totalBonds() external view returns (uint256 _totalBonds);\\n\\n /// @notice Tracks the total KP3R earnings of a keeper since it started working\\n /// @param _keeper The address of the keeper\\n /// @return _workCompleted Total KP3R earnings of a keeper since it started working\\n function workCompleted(address _keeper) external view returns (uint256 _workCompleted);\\n\\n /// @notice Tracks when a keeper was first registered\\n /// @param _keeper The address of the keeper\\n /// @return timestamp The time at which the keeper was first registered\\n function firstSeen(address _keeper) external view returns (uint256 timestamp);\\n\\n /// @notice Tracks if a keeper or job has a pending dispute\\n /// @param _keeperOrJob The address of the keeper or job\\n /// @return _disputed Whether a keeper or job has a pending dispute\\n function disputes(address _keeperOrJob) external view returns (bool _disputed);\\n\\n /// @notice Tracks how much a keeper has bonded of a certain token\\n /// @param _keeper The address of the keeper\\n /// @param _bond The address of the token being bonded\\n /// @return _bonds Amount of a certain token that a keeper has bonded\\n function bonds(address _keeper, address _bond) external view returns (uint256 _bonds);\\n\\n /// @notice The current token credits available for a job\\n /// @param _job The address of the job\\n /// @param _token The address of the token bonded\\n /// @return _amount The amount of token credits available for a job\\n function jobTokenCredits(address _job, address _token) external view returns (uint256 _amount);\\n\\n /// @notice Tracks the amount of assets deposited in pending bonds\\n /// @param _keeper The address of the keeper\\n /// @param _bonding The address of the token being bonded\\n /// @return _pendingBonds Amount of a certain asset a keeper has unbonding\\n function pendingBonds(address _keeper, address _bonding) external view returns (uint256 _pendingBonds);\\n\\n /// @notice Tracks when a bonding for a keeper can be activated\\n /// @param _keeper The address of the keeper\\n /// @param _bonding The address of the token being bonded\\n /// @return _timestamp Time at which the bonding for a keeper can be activated\\n function canActivateAfter(address _keeper, address _bonding) external view returns (uint256 _timestamp);\\n\\n /// @notice Tracks when keeper bonds are ready to be withdrawn\\n /// @param _keeper The address of the keeper\\n /// @param _bonding The address of the token being unbonded\\n /// @return _timestamp Time at which the keeper bonds are ready to be withdrawn\\n function canWithdrawAfter(address _keeper, address _bonding) external view returns (uint256 _timestamp);\\n\\n /// @notice Tracks how much keeper bonds are to be withdrawn\\n /// @param _keeper The address of the keeper\\n /// @param _bonding The address of the token being unbonded\\n /// @return _pendingUnbonds The amount of keeper bonds that are to be withdrawn\\n function pendingUnbonds(address _keeper, address _bonding) external view returns (uint256 _pendingUnbonds);\\n\\n /// @notice Checks whether the address has ever bonded an asset\\n /// @param _keeper The address of the keeper\\n /// @return _hasBonded Whether the address has ever bonded an asset\\n function hasBonded(address _keeper) external view returns (bool _hasBonded);\\n\\n // Methods\\n\\n /// @notice Lists all jobs\\n /// @return _jobList Array with all the jobs in _jobs\\n function jobs() external view returns (address[] memory _jobList);\\n\\n /// @notice Lists all keepers\\n /// @return _keeperList Array with all the keepers in _keepers\\n function keepers() external view returns (address[] memory _keeperList);\\n\\n // Errors\\n\\n /// @notice Throws when an address is passed as a job, but that address is not a job\\n error JobUnavailable();\\n\\n /// @notice Throws when an action that requires an undisputed job is applied on a disputed job\\n error JobDisputed();\\n}\\n\",\"keccak256\":\"0xf4748c236ddf409e45e7169c735e2fc54e627b2b3ccd189ebb438ad768f1deb1\",\"license\":\"MIT\"},\"solidity/interfaces/peripherals/IKeep3rDisputable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4 <0.9.0;\\n\\n/// @title Keep3rDisputable contract\\n/// @notice Creates/resolves disputes for jobs or keepers\\n/// A disputed keeper is slashable and is not able to bond, activate, withdraw or receive direct payments\\n/// A disputed job is slashable and is not able to pay the keepers, withdraw tokens or to migrate\\ninterface IKeep3rDisputable {\\n /// @notice Emitted when a keeper or a job is disputed\\n /// @param _jobOrKeeper The address of the disputed keeper/job\\n /// @param _disputer The user that called the function and disputed the keeper\\n event Dispute(address indexed _jobOrKeeper, address indexed _disputer);\\n\\n /// @notice Emitted when a dispute is resolved\\n /// @param _jobOrKeeper The address of the disputed keeper/job\\n /// @param _resolver The user that called the function and resolved the dispute\\n event Resolve(address indexed _jobOrKeeper, address indexed _resolver);\\n\\n /// @notice Throws when a job or keeper is already disputed\\n error AlreadyDisputed();\\n\\n /// @notice Throws when a job or keeper is not disputed and someone tries to resolve the dispute\\n error NotDisputed();\\n\\n /// @notice Allows governor to create a dispute for a given keeper/job\\n /// @param _jobOrKeeper The address in dispute\\n function dispute(address _jobOrKeeper) external;\\n\\n /// @notice Allows governor to resolve a dispute on a keeper/job\\n /// @param _jobOrKeeper The address cleared\\n function resolve(address _jobOrKeeper) external;\\n}\\n\",\"keccak256\":\"0xdfdabcecbed06fcb2eb1b80e6a61d681afecd1f75c58a888451de7927b10c3b2\",\"license\":\"MIT\"},\"solidity/interfaces/peripherals/IKeep3rJobs.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4 <0.9.0;\\n\\nimport './IKeep3rDisputable.sol';\\n\\n/// @title Keep3rJobOwnership contract\\n/// @notice Handles the ownership of the jobs\\ninterface IKeep3rJobOwnership {\\n // Events\\n\\n /// @notice Emitted when Keep3rJobOwnership#changeJobOwnership is called\\n /// @param _job The address of the job proposed to have a change of owner\\n /// @param _owner The current owner of the job\\n /// @param _pendingOwner The new address proposed to be the owner of the job\\n event JobOwnershipChange(address indexed _job, address indexed _owner, address indexed _pendingOwner);\\n\\n /// @notice Emitted when Keep3rJobOwnership#JobOwnershipAssent is called\\n /// @param _job The address of the job which the proposed owner will now own\\n /// @param _previousOwner The previous owner of the job\\n /// @param _newOwner The new owner of the job\\n event JobOwnershipAssent(address indexed _job, address indexed _previousOwner, address indexed _newOwner);\\n\\n // Errors\\n\\n /// @notice Throws when the caller of the function is not the job owner\\n error OnlyJobOwner();\\n\\n /// @notice Throws when the caller of the function is not the pending job owner\\n error OnlyPendingJobOwner();\\n\\n // Variables\\n\\n /// @notice Maps the job to the owner of the job\\n /// @param _job The address of the job\\n /// @return _owner The address of the owner of the job\\n function jobOwner(address _job) external view returns (address _owner);\\n\\n /// @notice Maps the job to its pending owner\\n /// @param _job The address of the job\\n /// @return _pendingOwner The address of the pending owner of the job\\n function jobPendingOwner(address _job) external view returns (address _pendingOwner);\\n\\n // Methods\\n\\n /// @notice Proposes a new address to be the owner of the job\\n /// @param _job The address of the job\\n /// @param _newOwner The address of the proposed new owner\\n function changeJobOwnership(address _job, address _newOwner) external;\\n\\n /// @notice The proposed address accepts to be the owner of the job\\n /// @param _job The address of the job\\n function acceptJobOwnership(address _job) external;\\n}\\n\\n/// @title Keep3rJobManager contract\\n/// @notice Handles the addition and withdrawal of credits from a job\\ninterface IKeep3rJobManager is IKeep3rJobOwnership {\\n // Events\\n\\n /// @notice Emitted when Keep3rJobManager#addJob is called\\n /// @param _job The address of the job to add\\n /// @param _jobOwner The job's owner\\n event JobAddition(address indexed _job, address indexed _jobOwner);\\n\\n // Errors\\n\\n /// @notice Throws when trying to add a job that has already been added\\n error JobAlreadyAdded();\\n\\n /// @notice Throws when the address that is trying to register as a keeper is already a keeper\\n error AlreadyAKeeper();\\n\\n // Methods\\n\\n /// @notice Allows any caller to add a new job\\n /// @param _job Address of the contract for which work should be performed\\n function addJob(address _job) external;\\n}\\n\\n/// @title Keep3rJobFundableCredits contract\\n/// @notice Handles the addition and withdrawal of credits from a job\\ninterface IKeep3rJobFundableCredits is IKeep3rJobOwnership {\\n // Events\\n\\n /// @notice Emitted when Keep3rJobFundableCredits#addTokenCreditsToJob is called\\n /// @param _job The address of the job being credited\\n /// @param _token The address of the token being provided\\n /// @param _provider The user that calls the function\\n /// @param _amount The amount of credit being added to the job\\n event TokenCreditAddition(address indexed _job, address indexed _token, address indexed _provider, uint256 _amount);\\n\\n /// @notice Emitted when Keep3rJobFundableCredits#withdrawTokenCreditsFromJob is called\\n /// @param _job The address of the job from which the credits are withdrawn\\n /// @param _token The credit being withdrawn from the job\\n /// @param _receiver The user that receives the tokens\\n /// @param _amount The amount of credit withdrawn\\n event TokenCreditWithdrawal(address indexed _job, address indexed _token, address indexed _receiver, uint256 _amount);\\n\\n // Errors\\n\\n /// @notice Throws when the token is KP3R, as it should not be used for direct token payments\\n error TokenUnallowed();\\n\\n /// @notice Throws when the token withdraw cooldown has not yet passed\\n error JobTokenCreditsLocked();\\n\\n /// @notice Throws when the user tries to withdraw more tokens than it has\\n error InsufficientJobTokenCredits();\\n\\n // Variables\\n\\n /// @notice Last block where tokens were added to the job\\n /// @param _job The address of the job credited\\n /// @param _token The address of the token credited\\n /// @return _timestamp The last block where tokens were added to the job\\n function jobTokenCreditsAddedAt(address _job, address _token) external view returns (uint256 _timestamp);\\n\\n // Methods\\n\\n /// @notice Add credit to a job to be paid out for work\\n /// @param _job The address of the job being credited\\n /// @param _token The address of the token being credited\\n /// @param _amount The amount of credit being added\\n function addTokenCreditsToJob(\\n address _job,\\n address _token,\\n uint256 _amount\\n ) external;\\n\\n /// @notice Withdraw credit from a job\\n /// @param _job The address of the job from which the credits are withdrawn\\n /// @param _token The address of the token being withdrawn\\n /// @param _amount The amount of token to be withdrawn\\n /// @param _receiver The user that will receive tokens\\n function withdrawTokenCreditsFromJob(\\n address _job,\\n address _token,\\n uint256 _amount,\\n address _receiver\\n ) external;\\n}\\n\\n/// @title Keep3rJobFundableLiquidity contract\\n/// @notice Handles the funding of jobs through specific liquidity pairs\\ninterface IKeep3rJobFundableLiquidity is IKeep3rJobOwnership {\\n // Events\\n\\n /// @notice Emitted when Keep3rJobFundableLiquidity#approveLiquidity function is called\\n /// @param _liquidity The address of the liquidity pair being approved\\n event LiquidityApproval(address _liquidity);\\n\\n /// @notice Emitted when Keep3rJobFundableLiquidity#revokeLiquidity function is called\\n /// @param _liquidity The address of the liquidity pair being revoked\\n event LiquidityRevocation(address _liquidity);\\n\\n /// @notice Emitted when IKeep3rJobFundableLiquidity#addLiquidityToJob function is called\\n /// @param _job The address of the job to which liquidity will be added\\n /// @param _liquidity The address of the liquidity being added\\n /// @param _provider The user that calls the function\\n /// @param _amount The amount of liquidity being added\\n event LiquidityAddition(address indexed _job, address indexed _liquidity, address indexed _provider, uint256 _amount);\\n\\n /// @notice Emitted when IKeep3rJobFundableLiquidity#withdrawLiquidityFromJob function is called\\n /// @param _job The address of the job of which liquidity will be withdrawn from\\n /// @param _liquidity The address of the liquidity being withdrawn\\n /// @param _receiver The receiver of the liquidity tokens\\n /// @param _amount The amount of liquidity being withdrawn from the job\\n event LiquidityWithdrawal(address indexed _job, address indexed _liquidity, address indexed _receiver, uint256 _amount);\\n\\n /// @notice Emitted when Keep3rJobFundableLiquidity#addLiquidityToJob function is called\\n /// @param _job The address of the job whose credits will be updated\\n /// @param _rewardedAt The time at which the job was last rewarded\\n /// @param _currentCredits The current credits of the job\\n /// @param _periodCredits The credits of the job for the current period\\n event LiquidityCreditsReward(address indexed _job, uint256 _rewardedAt, uint256 _currentCredits, uint256 _periodCredits);\\n\\n /// @notice Emitted when Keep3rJobFundableLiquidity#forceLiquidityCreditsToJob function is called\\n /// @param _job The address of the job whose credits will be updated\\n /// @param _rewardedAt The time at which the job was last rewarded\\n /// @param _currentCredits The current credits of the job\\n event LiquidityCreditsForced(address indexed _job, uint256 _rewardedAt, uint256 _currentCredits);\\n\\n // Errors\\n\\n /// @notice Throws when the liquidity being approved has already been approved\\n error LiquidityPairApproved();\\n\\n /// @notice Throws when the liquidity being removed has not been approved\\n error LiquidityPairUnexistent();\\n\\n /// @notice Throws when trying to add liquidity to an unapproved pool\\n error LiquidityPairUnapproved();\\n\\n /// @notice Throws when the job doesn't have the requested liquidity\\n error JobLiquidityUnexistent();\\n\\n /// @notice Throws when trying to remove more liquidity than the job has\\n error JobLiquidityInsufficient();\\n\\n /// @notice Throws when trying to add less liquidity than the minimum liquidity required\\n error JobLiquidityLessThanMin();\\n\\n // Structs\\n\\n /// @notice Stores the tick information of the different liquidity pairs\\n struct TickCache {\\n int56 current; // Tracks the current tick\\n int56 difference; // Stores the difference between the current tick and the last tick\\n uint256 period; // Stores the period at which the last observation was made\\n }\\n\\n // Variables\\n\\n /// @notice Lists liquidity pairs\\n /// @return _list An array of addresses with all the approved liquidity pairs\\n function approvedLiquidities() external view returns (address[] memory _list);\\n\\n /// @notice Amount of liquidity in a specified job\\n /// @param _job The address of the job being checked\\n /// @param _liquidity The address of the liquidity we are checking\\n /// @return _amount Amount of liquidity in the specified job\\n function liquidityAmount(address _job, address _liquidity) external view returns (uint256 _amount);\\n\\n /// @notice Last time the job was rewarded liquidity credits\\n /// @param _job The address of the job being checked\\n /// @return _timestamp Timestamp of the last time the job was rewarded liquidity credits\\n function rewardedAt(address _job) external view returns (uint256 _timestamp);\\n\\n /// @notice Last time the job was worked\\n /// @param _job The address of the job being checked\\n /// @return _timestamp Timestamp of the last time the job was worked\\n function workedAt(address _job) external view returns (uint256 _timestamp);\\n\\n // Methods\\n\\n /// @notice Returns the liquidity credits of a given job\\n /// @param _job The address of the job of which we want to know the liquidity credits\\n /// @return _amount The liquidity credits of a given job\\n function jobLiquidityCredits(address _job) external view returns (uint256 _amount);\\n\\n /// @notice Returns the credits of a given job for the current period\\n /// @param _job The address of the job of which we want to know the period credits\\n /// @return _amount The credits the given job has at the current period\\n function jobPeriodCredits(address _job) external view returns (uint256 _amount);\\n\\n /// @notice Calculates the total credits of a given job\\n /// @param _job The address of the job of which we want to know the total credits\\n /// @return _amount The total credits of the given job\\n function totalJobCredits(address _job) external view returns (uint256 _amount);\\n\\n /// @notice Calculates how many credits should be rewarded periodically for a given liquidity amount\\n /// @dev _periodCredits = underlying KP3Rs for given liquidity amount * rewardPeriod / inflationPeriod\\n /// @param _liquidity The address of the liquidity to provide\\n /// @param _amount The amount of liquidity to provide\\n /// @return _periodCredits The amount of KP3R periodically minted for the given liquidity\\n function quoteLiquidity(address _liquidity, uint256 _amount) external view returns (uint256 _periodCredits);\\n\\n /// @notice Observes the current state of the liquidity pair being observed and updates TickCache with the information\\n /// @param _liquidity The address of the liquidity pair being observed\\n /// @return _tickCache The updated TickCache\\n function observeLiquidity(address _liquidity) external view returns (TickCache memory _tickCache);\\n\\n /// @notice Gifts liquidity credits to the specified job\\n /// @param _job The address of the job being credited\\n /// @param _amount The amount of liquidity credits to gift\\n function forceLiquidityCreditsToJob(address _job, uint256 _amount) external;\\n\\n /// @notice Approve a liquidity pair for being accepted in future\\n /// @param _liquidity The address of the liquidity accepted\\n function approveLiquidity(address _liquidity) external;\\n\\n /// @notice Revoke a liquidity pair from being accepted in future\\n /// @param _liquidity The liquidity no longer accepted\\n function revokeLiquidity(address _liquidity) external;\\n\\n /// @notice Allows anyone to fund a job with liquidity\\n /// @param _job The address of the job to assign liquidity to\\n /// @param _liquidity The liquidity being added\\n /// @param _amount The amount of liquidity tokens to add\\n function addLiquidityToJob(\\n address _job,\\n address _liquidity,\\n uint256 _amount\\n ) external;\\n\\n /// @notice Unbond liquidity for a job\\n /// @dev Can only be called by the job's owner\\n /// @param _job The address of the job being unbonded from\\n /// @param _liquidity The liquidity being unbonded\\n /// @param _amount The amount of liquidity being removed\\n function unbondLiquidityFromJob(\\n address _job,\\n address _liquidity,\\n uint256 _amount\\n ) external;\\n\\n /// @notice Withdraw liquidity from a job\\n /// @param _job The address of the job being withdrawn from\\n /// @param _liquidity The liquidity being withdrawn\\n /// @param _receiver The address that will receive the withdrawn liquidity\\n function withdrawLiquidityFromJob(\\n address _job,\\n address _liquidity,\\n address _receiver\\n ) external;\\n}\\n\\n/// @title Keep3rJobMigration contract\\n/// @notice Handles the migration process of jobs to different addresses\\ninterface IKeep3rJobMigration is IKeep3rJobFundableCredits, IKeep3rJobFundableLiquidity {\\n // Events\\n\\n /// @notice Emitted when Keep3rJobMigration#migrateJob function is called\\n /// @param _fromJob The address of the job that requests to migrate\\n /// @param _toJob The address at which the job requests to migrate\\n event JobMigrationRequested(address indexed _fromJob, address _toJob);\\n\\n /// @notice Emitted when Keep3rJobMigration#acceptJobMigration function is called\\n /// @param _fromJob The address of the job that requested to migrate\\n /// @param _toJob The address at which the job had requested to migrate\\n event JobMigrationSuccessful(address _fromJob, address indexed _toJob);\\n\\n // Errors\\n\\n /// @notice Throws when the address of the job that requests to migrate wants to migrate to its same address\\n error JobMigrationImpossible();\\n\\n /// @notice Throws when the _toJob address differs from the address being tracked in the pendingJobMigrations mapping\\n error JobMigrationUnavailable();\\n\\n /// @notice Throws when cooldown between migrations has not yet passed\\n error JobMigrationLocked();\\n\\n // Variables\\n\\n /// @notice Maps the jobs that have requested a migration to the address they have requested to migrate to\\n /// @return _toJob The address to which the job has requested to migrate to\\n function pendingJobMigrations(address _fromJob) external view returns (address _toJob);\\n\\n // Methods\\n\\n /// @notice Initializes the migration process for a job by adding the request to the pendingJobMigrations mapping\\n /// @param _fromJob The address of the job that is requesting to migrate\\n /// @param _toJob The address at which the job is requesting to migrate\\n function migrateJob(address _fromJob, address _toJob) external;\\n\\n /// @notice Completes the migration process for a job\\n /// @dev Unbond/withdraw process doesn't get migrated\\n /// @param _fromJob The address of the job that requested to migrate\\n /// @param _toJob The address to which the job wants to migrate to\\n function acceptJobMigration(address _fromJob, address _toJob) external;\\n}\\n\\n/// @title Keep3rJobWorkable contract\\n/// @notice Handles the mechanisms jobs can pay keepers with along with the restrictions jobs can put on keepers before they can work on jobs\\ninterface IKeep3rJobWorkable is IKeep3rJobMigration {\\n // Events\\n\\n /// @notice Emitted when a keeper is validated before a job\\n /// @param _gasLeft The amount of gas that the transaction has left at the moment of keeper validation\\n event KeeperValidation(uint256 _gasLeft);\\n\\n /// @notice Emitted when a keeper works a job\\n /// @param _credit The address of the asset in which the keeper is paid\\n /// @param _job The address of the job the keeper has worked\\n /// @param _keeper The address of the keeper that has worked the job\\n /// @param _payment The amount that has been paid out to the keeper in exchange for working the job\\n /// @param _gasLeft The amount of gas that the transaction has left at the moment of payment\\n event KeeperWork(address indexed _credit, address indexed _job, address indexed _keeper, uint256 _payment, uint256 _gasLeft);\\n\\n // Errors\\n\\n /// @notice Throws if work method was called without calling isKeeper or isBondedKeeper\\n error GasNotInitialized();\\n\\n /// @notice Throws if the address claiming to be a job is not in the list of approved jobs\\n error JobUnapproved();\\n\\n /// @notice Throws if the amount of funds in the job is less than the payment that must be paid to the keeper that works that job\\n error InsufficientFunds();\\n\\n // Methods\\n\\n /// @notice Confirms if the current keeper is registered\\n /// @dev Can be used for general (non critical) functions\\n /// @param _keeper The keeper being investigated\\n /// @return _isKeeper Whether the address passed as a parameter is a keeper or not\\n function isKeeper(address _keeper) external returns (bool _isKeeper);\\n\\n /// @notice Confirms if the current keeper is registered and has a minimum bond of any asset.\\n /// @dev Should be used for protected functions\\n /// @param _keeper The keeper to check\\n /// @param _bond The bond token being evaluated\\n /// @param _minBond The minimum amount of bonded tokens\\n /// @param _earned The minimum funds earned in the keepers lifetime\\n /// @param _age The minimum keeper age required\\n /// @return _isBondedKeeper Whether the `_keeper` meets the given requirements\\n function isBondedKeeper(\\n address _keeper,\\n address _bond,\\n uint256 _minBond,\\n uint256 _earned,\\n uint256 _age\\n ) external returns (bool _isBondedKeeper);\\n\\n /// @notice Implemented by jobs to show that a keeper performed work\\n /// @dev Automatically calculates the payment for the keeper and pays the keeper with bonded KP3R\\n /// @param _keeper Address of the keeper that performed the work\\n function worked(address _keeper) external;\\n\\n /// @notice Implemented by jobs to show that a keeper performed work\\n /// @dev Pays the keeper that performs the work with KP3R\\n /// @param _keeper Address of the keeper that performed the work\\n /// @param _payment The reward that should be allocated for the job\\n function bondedPayment(address _keeper, uint256 _payment) external;\\n\\n /// @notice Implemented by jobs to show that a keeper performed work\\n /// @dev Pays the keeper that performs the work with a specific token\\n /// @param _token The asset being awarded to the keeper\\n /// @param _keeper Address of the keeper that performed the work\\n /// @param _amount The reward that should be allocated\\n function directTokenPayment(\\n address _token,\\n address _keeper,\\n uint256 _amount\\n ) external;\\n}\\n\\n/// @title Keep3rJobDisputable contract\\n/// @notice Handles the actions that can be taken on a disputed job\\ninterface IKeep3rJobDisputable is IKeep3rDisputable, IKeep3rJobFundableCredits, IKeep3rJobFundableLiquidity {\\n // Events\\n\\n /// @notice Emitted when Keep3rJobDisputable#slashTokenFromJob is called\\n /// @param _job The address of the job from which the token will be slashed\\n /// @param _token The address of the token being slashed\\n /// @param _slasher The user that slashes the token\\n /// @param _amount The amount of the token being slashed\\n event JobSlashToken(address indexed _job, address _token, address indexed _slasher, uint256 _amount);\\n\\n /// @notice Emitted when Keep3rJobDisputable#slashLiquidityFromJob is called\\n /// @param _job The address of the job from which the liquidity will be slashed\\n /// @param _liquidity The address of the liquidity being slashed\\n /// @param _slasher The user that slashes the liquidity\\n /// @param _amount The amount of the liquidity being slashed\\n event JobSlashLiquidity(address indexed _job, address _liquidity, address indexed _slasher, uint256 _amount);\\n\\n // Errors\\n\\n /// @notice Throws when the token trying to be slashed doesn't exist\\n error JobTokenUnexistent();\\n\\n /// @notice Throws when someone tries to slash more tokens than the job has\\n error JobTokenInsufficient();\\n\\n // Methods\\n\\n /// @notice Allows governor or slasher to slash a job specific token\\n /// @param _job The address of the job from which the token will be slashed\\n /// @param _token The address of the token that will be slashed\\n /// @param _amount The amount of the token that will be slashed\\n function slashTokenFromJob(\\n address _job,\\n address _token,\\n uint256 _amount\\n ) external;\\n\\n /// @notice Allows governor or slasher to slash liquidity from a job\\n /// @param _job The address being slashed\\n /// @param _liquidity The address of the liquidity that will be slashed\\n /// @param _amount The amount of liquidity that will be slashed\\n function slashLiquidityFromJob(\\n address _job,\\n address _liquidity,\\n uint256 _amount\\n ) external;\\n}\\n\\n// solhint-disable-next-line no-empty-blocks\\ninterface IKeep3rJobs is IKeep3rJobWorkable, IKeep3rJobManager, IKeep3rJobDisputable {\\n\\n}\\n\",\"keccak256\":\"0x7fb7153d88e9e65d28b278320884517d6b423b2e8cfc78ee0ee16bc04073278e\",\"license\":\"MIT\"},\"solidity/interfaces/peripherals/IKeep3rKeepers.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4 <0.9.0;\\n\\nimport './IKeep3rDisputable.sol';\\n\\n/// @title Keep3rKeeperFundable contract\\n/// @notice Handles the actions required to become a keeper\\ninterface IKeep3rKeeperFundable {\\n // Events\\n\\n /// @notice Emitted when Keep3rKeeperFundable#activate is called\\n /// @param _keeper The keeper that has been activated\\n /// @param _bond The asset the keeper has bonded\\n /// @param _amount The amount of the asset the keeper has bonded\\n event Activation(address indexed _keeper, address indexed _bond, uint256 _amount);\\n\\n /// @notice Emitted when Keep3rKeeperFundable#withdraw is called\\n /// @param _keeper The caller of Keep3rKeeperFundable#withdraw function\\n /// @param _bond The asset to withdraw from the bonding pool\\n /// @param _amount The amount of funds withdrawn\\n event Withdrawal(address indexed _keeper, address indexed _bond, uint256 _amount);\\n\\n // Errors\\n\\n /// @notice Throws when the address that is trying to register as a job is already a job\\n error AlreadyAJob();\\n\\n // Methods\\n\\n /// @notice Beginning of the bonding process\\n /// @param _bonding The asset being bonded\\n /// @param _amount The amount of bonding asset being bonded\\n function bond(address _bonding, uint256 _amount) external;\\n\\n /// @notice Beginning of the unbonding process\\n /// @param _bonding The asset being unbonded\\n /// @param _amount Allows for partial unbonding\\n function unbond(address _bonding, uint256 _amount) external;\\n\\n /// @notice End of the bonding process after bonding time has passed\\n /// @param _bonding The asset being activated as bond collateral\\n function activate(address _bonding) external;\\n\\n /// @notice Withdraw funds after unbonding has finished\\n /// @param _bonding The asset to withdraw from the bonding pool\\n function withdraw(address _bonding) external;\\n}\\n\\n/// @title Keep3rKeeperDisputable contract\\n/// @notice Handles the actions that can be taken on a disputed keeper\\ninterface IKeep3rKeeperDisputable is IKeep3rDisputable, IKeep3rKeeperFundable {\\n // Events\\n\\n /// @notice Emitted when Keep3rKeeperDisputable#slash is called\\n /// @param _keeper The address of the slashed keeper\\n /// @param _slasher The user that called Keep3rKeeperDisputable#slash\\n /// @param _amount The amount of credits slashed from the keeper\\n event KeeperSlash(address indexed _keeper, address indexed _slasher, uint256 _amount);\\n\\n /// @notice Emitted when Keep3rKeeperDisputable#revoke is called\\n /// @param _keeper The address of the revoked keeper\\n /// @param _slasher The user that called Keep3rKeeperDisputable#revoke\\n event KeeperRevoke(address indexed _keeper, address indexed _slasher);\\n\\n // Methods\\n\\n /// @notice Allows governor to slash a keeper based on a dispute\\n /// @param _keeper The address being slashed\\n /// @param _bonded The asset being slashed\\n /// @param _bondAmount The bonded amount being slashed\\n /// @param _unbondAmount The pending unbond amount being slashed\\n function slash(\\n address _keeper,\\n address _bonded,\\n uint256 _bondAmount,\\n uint256 _unbondAmount\\n ) external;\\n\\n /// @notice Blacklists a keeper from participating in the network\\n /// @param _keeper The address being slashed\\n function revoke(address _keeper) external;\\n}\\n\\n// solhint-disable-next-line no-empty-blocks\\n\\n/// @title Keep3rKeepers contract\\ninterface IKeep3rKeepers is IKeep3rKeeperDisputable {\\n\\n}\\n\",\"keccak256\":\"0x8fe10565035bb918b2b1c7d730533bcfe9ec79078f28544852f8178e76302562\",\"license\":\"MIT\"},\"solidity/interfaces/peripherals/IKeep3rParameters.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4 <0.9.0;\\n\\nimport './IKeep3rAccountance.sol';\\n\\n/// @title Keep3rParameters contract\\n/// @notice Handles and sets all the required parameters for Keep3r\\ninterface IKeep3rParameters is IKeep3rAccountance {\\n // Events\\n\\n /// @notice Emitted when the Keep3rHelper address is changed\\n /// @param _keep3rHelper The address of Keep3rHelper's contract\\n event Keep3rHelperChange(address _keep3rHelper);\\n\\n /// @notice Emitted when the Keep3rV1 address is changed\\n /// @param _keep3rV1 The address of Keep3rV1's contract\\n event Keep3rV1Change(address _keep3rV1);\\n\\n /// @notice Emitted when the Keep3rV1Proxy address is changed\\n /// @param _keep3rV1Proxy The address of Keep3rV1Proxy's contract\\n event Keep3rV1ProxyChange(address _keep3rV1Proxy);\\n\\n /// @notice Emitted when bondTime is changed\\n /// @param _bondTime The new bondTime\\n event BondTimeChange(uint256 _bondTime);\\n\\n /// @notice Emitted when _liquidityMinimum is changed\\n /// @param _liquidityMinimum The new _liquidityMinimum\\n event LiquidityMinimumChange(uint256 _liquidityMinimum);\\n\\n /// @notice Emitted when _unbondTime is changed\\n /// @param _unbondTime The new _unbondTime\\n event UnbondTimeChange(uint256 _unbondTime);\\n\\n /// @notice Emitted when _rewardPeriodTime is changed\\n /// @param _rewardPeriodTime The new _rewardPeriodTime\\n event RewardPeriodTimeChange(uint256 _rewardPeriodTime);\\n\\n /// @notice Emitted when the inflationPeriod is changed\\n /// @param _inflationPeriod The new inflationPeriod\\n event InflationPeriodChange(uint256 _inflationPeriod);\\n\\n /// @notice Emitted when the fee is changed\\n /// @param _fee The new token credits fee\\n event FeeChange(uint256 _fee);\\n\\n // Variables\\n\\n /// @notice Address of Keep3rHelper's contract\\n /// @return _keep3rHelper The address of Keep3rHelper's contract\\n function keep3rHelper() external view returns (address _keep3rHelper);\\n\\n /// @notice Address of Keep3rV1's contract\\n /// @return _keep3rV1 The address of Keep3rV1's contract\\n function keep3rV1() external view returns (address _keep3rV1);\\n\\n /// @notice Address of Keep3rV1Proxy's contract\\n /// @return _keep3rV1Proxy The address of Keep3rV1Proxy's contract\\n function keep3rV1Proxy() external view returns (address _keep3rV1Proxy);\\n\\n /// @notice The amount of time required to pass after a keeper has bonded assets for it to be able to activate\\n /// @return _days The required bondTime in days\\n function bondTime() external view returns (uint256 _days);\\n\\n /// @notice The amount of time required to pass before a keeper can unbond what he has bonded\\n /// @return _days The required unbondTime in days\\n function unbondTime() external view returns (uint256 _days);\\n\\n /// @notice The minimum amount of liquidity required to fund a job per liquidity\\n /// @return _amount The minimum amount of liquidity in KP3R\\n function liquidityMinimum() external view returns (uint256 _amount);\\n\\n /// @notice The amount of time between each scheduled credits reward given to a job\\n /// @return _days The reward period in days\\n function rewardPeriodTime() external view returns (uint256 _days);\\n\\n /// @notice The inflation period is the denominator used to regulate the emission of KP3R\\n /// @return _period The denominator used to regulate the emission of KP3R\\n function inflationPeriod() external view returns (uint256 _period);\\n\\n /// @notice The fee to be sent to governor when a user adds liquidity to a job\\n /// @return _amount The fee amount to be sent to governor when a user adds liquidity to a job\\n function fee() external view returns (uint256 _amount);\\n\\n // Errors\\n\\n /// @notice Throws if the reward period is less than the minimum reward period time\\n error MinRewardPeriod();\\n\\n /// @notice Throws if either a job or a keeper is disputed\\n error Disputed();\\n\\n /// @notice Throws if there are no bonded assets\\n error BondsUnexistent();\\n\\n /// @notice Throws if the time required to bond an asset has not passed yet\\n error BondsLocked();\\n\\n /// @notice Throws if there are no bonds to withdraw\\n error UnbondsUnexistent();\\n\\n /// @notice Throws if the time required to withdraw the bonds has not passed yet\\n error UnbondsLocked();\\n\\n // Methods\\n\\n /// @notice Sets the Keep3rHelper address\\n /// @param _keep3rHelper The Keep3rHelper address\\n function setKeep3rHelper(address _keep3rHelper) external;\\n\\n /// @notice Sets the Keep3rV1 address\\n /// @param _keep3rV1 The Keep3rV1 address\\n function setKeep3rV1(address _keep3rV1) external;\\n\\n /// @notice Sets the Keep3rV1Proxy address\\n /// @param _keep3rV1Proxy The Keep3rV1Proxy address\\n function setKeep3rV1Proxy(address _keep3rV1Proxy) external;\\n\\n /// @notice Sets the bond time required to activate as a keeper\\n /// @param _bond The new bond time\\n function setBondTime(uint256 _bond) external;\\n\\n /// @notice Sets the unbond time required unbond what has been bonded\\n /// @param _unbond The new unbond time\\n function setUnbondTime(uint256 _unbond) external;\\n\\n /// @notice Sets the minimum amount of liquidity required to fund a job\\n /// @param _liquidityMinimum The new minimum amount of liquidity\\n function setLiquidityMinimum(uint256 _liquidityMinimum) external;\\n\\n /// @notice Sets the time required to pass between rewards for jobs\\n /// @param _rewardPeriodTime The new amount of time required to pass between rewards\\n function setRewardPeriodTime(uint256 _rewardPeriodTime) external;\\n\\n /// @notice Sets the new inflation period\\n /// @param _inflationPeriod The new inflation period\\n function setInflationPeriod(uint256 _inflationPeriod) external;\\n\\n /// @notice Sets the new fee\\n /// @param _fee The new fee\\n function setFee(uint256 _fee) external;\\n}\\n\",\"keccak256\":\"0x2a847a2ab6dbee960ca84e142ad9c578d8953c4adf1d3221669400ea86c9b82e\",\"license\":\"MIT\"},\"solidity/interfaces/peripherals/IKeep3rRoles.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4 <0.9.0;\\n\\nimport '@defi-wonderland/solidity-utils/solidity/interfaces/IBaseErrors.sol';\\nimport '@defi-wonderland/solidity-utils/solidity/interfaces/IGovernable.sol';\\nimport '@defi-wonderland/solidity-utils/solidity/interfaces/IDustCollector.sol';\\n\\n/// @title Keep3rRoles contract\\n/// @notice Manages the Keep3r specific roles\\ninterface IKeep3rRoles is IBaseErrors, IGovernable, IDustCollector {\\n // Events\\n\\n /// @notice Emitted when a slasher is added\\n /// @param _slasher Address of the added slasher\\n event SlasherAdded(address _slasher);\\n\\n /// @notice Emitted when a slasher is removed\\n /// @param _slasher Address of the removed slasher\\n event SlasherRemoved(address _slasher);\\n\\n /// @notice Emitted when a disputer is added\\n /// @param _disputer Address of the added disputer\\n event DisputerAdded(address _disputer);\\n\\n /// @notice Emitted when a disputer is removed\\n /// @param _disputer Address of the removed disputer\\n event DisputerRemoved(address _disputer);\\n\\n // Variables\\n\\n /// @notice Tracks whether the address is a slasher or not\\n /// @param _slasher Address being checked as a slasher\\n /// @return _isSlasher Whether the address is a slasher or not\\n function slashers(address _slasher) external view returns (bool _isSlasher);\\n\\n /// @notice Tracks whether the address is a disputer or not\\n /// @param _disputer Address being checked as a disputer\\n /// @return _isDisputer Whether the address is a disputer or not\\n function disputers(address _disputer) external view returns (bool _isDisputer);\\n\\n // Errors\\n\\n /// @notice Throws if the address is already a registered slasher\\n error SlasherExistent();\\n\\n /// @notice Throws if caller is not a registered slasher\\n error SlasherUnexistent();\\n\\n /// @notice Throws if the address is already a registered disputer\\n error DisputerExistent();\\n\\n /// @notice Throws if caller is not a registered disputer\\n error DisputerUnexistent();\\n\\n /// @notice Throws if the msg.sender is not a slasher or is not a part of governance\\n error OnlySlasher();\\n\\n /// @notice Throws if the msg.sender is not a disputer or is not a part of governance\\n error OnlyDisputer();\\n\\n // Methods\\n\\n /// @notice Registers a slasher by updating the slashers mapping\\n function addSlasher(address _slasher) external;\\n\\n /// @notice Removes a slasher by updating the slashers mapping\\n function removeSlasher(address _slasher) external;\\n\\n /// @notice Registers a disputer by updating the disputers mapping\\n function addDisputer(address _disputer) external;\\n\\n /// @notice Removes a disputer by updating the disputers mapping\\n function removeDisputer(address _disputer) external;\\n}\\n\",\"keccak256\":\"0xc0a19b0dfac535cbffabc0d76cb0569618dedb922b0413bc12358efa47dc32bf\",\"license\":\"MIT\"}},\"version\":1}", + "bytecode": "0x608060405234801561001057600080fd5b5060405161047838038061047883398101604081905261002f91610054565b600080546001600160a01b0319166001600160a01b0392909216919091179055610084565b60006020828403121561006657600080fd5b81516001600160a01b038116811461007d57600080fd5b9392505050565b6103e5806100936000396000f3fe608060405234801561001057600080fd5b506004361061004c5760003560e01c8063322e9f04146100515780633bb39c331461005b578063634c7bb51461006e578063affed0e01461009e575b600080fd5b6100596100b5565b005b61005961006936600461031d565b6101e4565b600054610081906001600160a01b031681565b6040516001600160a01b0390911681526020015b60405180910390f35b6100a760015481565b604051908152602001610095565b6000546040516335d2155560e11b81523360048201526001600160a01b0390911690636ba42aaa90602401602060405180830381600087803b1580156100fa57600080fd5b505af115801561010e573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906101329190610336565b61014f57604051637671ff4960e11b815260040160405180910390fd5b60005b6103e8811015610184576001805490600061016c83610375565b9190505550808061017c90610375565b915050610152565b506000546040516317fbade560e21b81523360048201526001600160a01b0390911690635feeb79490602401600060405180830381600087803b1580156101ca57600080fd5b505af11580156101de573d6000803e3d6000fd5b50505050565b6000546040516335d2155560e11b81523360048201526001600160a01b0390911690636ba42aaa90602401602060405180830381600087803b15801561022957600080fd5b505af115801561023d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906102619190610336565b61027e57604051637671ff4960e11b815260040160405180910390fd5b60005b61028d826103e8610390565b8110156102bc57600180549060006102a483610375565b919050555080806102b490610375565b915050610281565b506000546040516317fbade560e21b81523360048201526001600160a01b0390911690635feeb79490602401600060405180830381600087803b15801561030257600080fd5b505af1158015610316573d6000803e3d6000fd5b5050505050565b60006020828403121561032f57600080fd5b5035919050565b60006020828403121561034857600080fd5b8151801515811461035857600080fd5b9392505050565b634e487b7160e01b600052601160045260246000fd5b60006000198214156103895761038961035f565b5060010190565b60008160001904831182151516156103aa576103aa61035f565b50029056fea26469706673582212201d7b50b8ee97940be0dd795874aba913e68ddf7d02f0a36553857cda2d98413964736f6c63430008080033", + "deployedBytecode": "0x608060405234801561001057600080fd5b506004361061004c5760003560e01c8063322e9f04146100515780633bb39c331461005b578063634c7bb51461006e578063affed0e01461009e575b600080fd5b6100596100b5565b005b61005961006936600461031d565b6101e4565b600054610081906001600160a01b031681565b6040516001600160a01b0390911681526020015b60405180910390f35b6100a760015481565b604051908152602001610095565b6000546040516335d2155560e11b81523360048201526001600160a01b0390911690636ba42aaa90602401602060405180830381600087803b1580156100fa57600080fd5b505af115801561010e573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906101329190610336565b61014f57604051637671ff4960e11b815260040160405180910390fd5b60005b6103e8811015610184576001805490600061016c83610375565b9190505550808061017c90610375565b915050610152565b506000546040516317fbade560e21b81523360048201526001600160a01b0390911690635feeb79490602401600060405180830381600087803b1580156101ca57600080fd5b505af11580156101de573d6000803e3d6000fd5b50505050565b6000546040516335d2155560e11b81523360048201526001600160a01b0390911690636ba42aaa90602401602060405180830381600087803b15801561022957600080fd5b505af115801561023d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906102619190610336565b61027e57604051637671ff4960e11b815260040160405180910390fd5b60005b61028d826103e8610390565b8110156102bc57600180549060006102a483610375565b919050555080806102b490610375565b915050610281565b506000546040516317fbade560e21b81523360048201526001600160a01b0390911690635feeb79490602401600060405180830381600087803b15801561030257600080fd5b505af1158015610316573d6000803e3d6000fd5b5050505050565b60006020828403121561032f57600080fd5b5035919050565b60006020828403121561034857600080fd5b8151801515811461035857600080fd5b9392505050565b634e487b7160e01b600052601160045260246000fd5b60006000198214156103895761038961035f565b5060010190565b60008160001904831182151516156103aa576103aa61035f565b50029056fea26469706673582212201d7b50b8ee97940be0dd795874aba913e68ddf7d02f0a36553857cda2d98413964736f6c63430008080033", + "devdoc": { + "kind": "dev", + "methods": {}, + "version": 1 + }, + "userdoc": { + "kind": "user", + "methods": {}, + "version": 1 + }, + "storageLayout": { + "storage": [ + { + "astId": 10853, + "contract": "solidity/for-test/JobForTest.sol:JobForTest", + "label": "keep3r", + "offset": 0, + "slot": "0", + "type": "t_address" + }, + { + "astId": 10855, + "contract": "solidity/for-test/JobForTest.sol:JobForTest", + "label": "nonce", + "offset": 0, + "slot": "1", + "type": "t_uint256" + } + ], + "types": { + "t_address": { + "encoding": "inplace", + "label": "address", + "numberOfBytes": "20" + }, + "t_uint256": { + "encoding": "inplace", + "label": "uint256", + "numberOfBytes": "32" + } + } + } +} \ No newline at end of file diff --git a/deployments/sepolia/KP3Rv1.json b/deployments/sepolia/KP3Rv1.json new file mode 100644 index 0000000..4439eac --- /dev/null +++ b/deployments/sepolia/KP3Rv1.json @@ -0,0 +1,417 @@ +{ + "address": "0x80B4327021946fF962d570c808B6aaC47224AeF1", + "abi": [ + { + "inputs": [ + { + "internalType": "string", + "name": "_name", + "type": "string" + }, + { + "internalType": "string", + "name": "_symbol", + "type": "string" + }, + { + "internalType": "address", + "name": "_initialAccount", + "type": "address" + }, + { + "internalType": "uint256", + "name": "_initialBalance", + "type": "uint256" + } + ], + "stateMutability": "nonpayable", + "type": "constructor" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "spender", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "value", + "type": "uint256" + } + ], + "name": "Approval", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "from", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "to", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "value", + "type": "uint256" + } + ], + "name": "Transfer", + "type": "event" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "internalType": "address", + "name": "spender", + "type": "address" + } + ], + "name": "allowance", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "spender", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "approve", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_owner", + "type": "address" + }, + { + "internalType": "address", + "name": "_spender", + "type": "address" + }, + { + "internalType": "uint256", + "name": "_value", + "type": "uint256" + } + ], + "name": "approveInternal", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "balanceOf", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "_amount", + "type": "uint256" + } + ], + "name": "burn", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_account", + "type": "address" + }, + { + "internalType": "uint256", + "name": "_amount", + "type": "uint256" + } + ], + "name": "burn", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "decimals", + "outputs": [ + { + "internalType": "uint8", + "name": "", + "type": "uint8" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "spender", + "type": "address" + }, + { + "internalType": "uint256", + "name": "subtractedValue", + "type": "uint256" + } + ], + "name": "decreaseAllowance", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "deposit", + "outputs": [], + "stateMutability": "payable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "spender", + "type": "address" + }, + { + "internalType": "uint256", + "name": "addedValue", + "type": "uint256" + } + ], + "name": "increaseAllowance", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_account", + "type": "address" + }, + { + "internalType": "uint256", + "name": "_amount", + "type": "uint256" + } + ], + "name": "mint", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "_amount", + "type": "uint256" + } + ], + "name": "mint", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "name", + "outputs": [ + { + "internalType": "string", + "name": "", + "type": "string" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "symbol", + "outputs": [ + { + "internalType": "string", + "name": "", + "type": "string" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "totalSupply", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "recipient", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "transfer", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "sender", + "type": "address" + }, + { + "internalType": "address", + "name": "recipient", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "transferFrom", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_from", + "type": "address" + }, + { + "internalType": "address", + "name": "_to", + "type": "address" + }, + { + "internalType": "uint256", + "name": "_value", + "type": "uint256" + } + ], + "name": "transferInternal", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + } + ], + "numDeployments": 53 +} \ No newline at end of file diff --git a/deployments/sepolia/Keep3rEscrow.json b/deployments/sepolia/Keep3rEscrow.json new file mode 100644 index 0000000..966f3d4 --- /dev/null +++ b/deployments/sepolia/Keep3rEscrow.json @@ -0,0 +1,582 @@ +{ + "address": "0x39C77C9d1671e6d9615D8e5F4BdA546A6b907dCe", + "abi": [ + { + "inputs": [ + { + "internalType": "address", + "name": "_governor", + "type": "address" + }, + { + "internalType": "address", + "name": "_wKP3R", + "type": "address" + } + ], + "stateMutability": "nonpayable", + "type": "constructor" + }, + { + "inputs": [], + "name": "InsufficientBalance", + "type": "error" + }, + { + "inputs": [], + "name": "InvalidAddress", + "type": "error" + }, + { + "inputs": [], + "name": "InvalidAmount", + "type": "error" + }, + { + "inputs": [], + "name": "LengthMismatch", + "type": "error" + }, + { + "inputs": [], + "name": "OnlyGovernor", + "type": "error" + }, + { + "inputs": [], + "name": "OnlyMinter", + "type": "error" + }, + { + "inputs": [], + "name": "OnlyPendingGovernor", + "type": "error" + }, + { + "inputs": [], + "name": "ZeroAddress", + "type": "error" + }, + { + "inputs": [], + "name": "ZeroAmount", + "type": "error" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "_token", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "_amount", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "address", + "name": "_to", + "type": "address" + } + ], + "name": "DustSent", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "_minter", + "type": "address" + } + ], + "name": "MinterSet", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "_newGovernor", + "type": "address" + } + ], + "name": "PendingGovernorAccepted", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "_governor", + "type": "address" + }, + { + "indexed": false, + "internalType": "address", + "name": "_pendingGovernor", + "type": "address" + } + ], + "name": "PendingGovernorSet", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "_wKP3R", + "type": "address" + }, + { + "indexed": false, + "internalType": "address", + "name": "_sender", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "_amount", + "type": "uint256" + } + ], + "name": "wKP3RDeposited", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "_wKP3R", + "type": "address" + }, + { + "indexed": false, + "internalType": "address", + "name": "_recipient", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "_amount", + "type": "uint256" + } + ], + "name": "wKP3RMinted", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "_newWKP3R", + "type": "address" + } + ], + "name": "wKP3RSet", + "type": "event" + }, + { + "inputs": [], + "name": "ETH_ADDRESS", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "acceptPendingGovernor", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "_amount", + "type": "uint256" + } + ], + "name": "deposit", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "governor", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "_amount", + "type": "uint256" + } + ], + "name": "mint", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "minter", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "pendingGovernor", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_token", + "type": "address" + }, + { + "internalType": "uint256", + "name": "_amount", + "type": "uint256" + }, + { + "internalType": "address", + "name": "_to", + "type": "address" + } + ], + "name": "sendDust", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_minter", + "type": "address" + } + ], + "name": "setMinter", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_pendingGovernor", + "type": "address" + } + ], + "name": "setPendingGovernor", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_wKP3R", + "type": "address" + } + ], + "name": "setWKP3R", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "wKP3R", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + } + ], + "transactionHash": "0xf9bf49b0d965d6aa7b6731f7afc98168696e37af6e74298cf28d77f8b803abe6", + "receipt": { + "to": null, + "from": "0x169Cf949aB1B25453b70F2Fe874e2c65c10AE0f8", + "contractAddress": "0x39C77C9d1671e6d9615D8e5F4BdA546A6b907dCe", + "transactionIndex": 25, + "gasUsed": "690499", + "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "blockHash": "0xe9f4c8c445437cade0e459bb4c7450867bd45156082458e796f9435e916f8bcb", + "transactionHash": "0xf9bf49b0d965d6aa7b6731f7afc98168696e37af6e74298cf28d77f8b803abe6", + "logs": [], + "blockNumber": 5465674, + "cumulativeGasUsed": "3014722", + "status": 1, + "byzantium": true + }, + "args": [ + "0x169Cf949aB1B25453b70F2Fe874e2c65c10AE0f8", + "0x80B4327021946fF962d570c808B6aaC47224AeF1" + ], + "numDeployments": 1, + "solcInputHash": "c4fa7656f8525bb918f86e7450300ce1", + "metadata": "{\"compiler\":{\"version\":\"0.8.8+commit.dddeac2f\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_governor\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"_wKP3R\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"inputs\":[],\"name\":\"InsufficientBalance\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"InvalidAddress\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"InvalidAmount\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"LengthMismatch\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"OnlyGovernor\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"OnlyMinter\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"OnlyPendingGovernor\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"ZeroAddress\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"ZeroAmount\",\"type\":\"error\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"_token\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"_amount\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"_to\",\"type\":\"address\"}],\"name\":\"DustSent\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"_minter\",\"type\":\"address\"}],\"name\":\"MinterSet\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"_newGovernor\",\"type\":\"address\"}],\"name\":\"PendingGovernorAccepted\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"_governor\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"_pendingGovernor\",\"type\":\"address\"}],\"name\":\"PendingGovernorSet\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"_wKP3R\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"_sender\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"_amount\",\"type\":\"uint256\"}],\"name\":\"wKP3RDeposited\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"_wKP3R\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"_recipient\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"_amount\",\"type\":\"uint256\"}],\"name\":\"wKP3RMinted\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"_newWKP3R\",\"type\":\"address\"}],\"name\":\"wKP3RSet\",\"type\":\"event\"},{\"inputs\":[],\"name\":\"ETH_ADDRESS\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"acceptPendingGovernor\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_amount\",\"type\":\"uint256\"}],\"name\":\"deposit\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"governor\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_amount\",\"type\":\"uint256\"}],\"name\":\"mint\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"minter\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"pendingGovernor\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_token\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"_amount\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"_to\",\"type\":\"address\"}],\"name\":\"sendDust\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_minter\",\"type\":\"address\"}],\"name\":\"setMinter\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_pendingGovernor\",\"type\":\"address\"}],\"name\":\"setPendingGovernor\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_wKP3R\",\"type\":\"address\"}],\"name\":\"setWKP3R\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"wKP3R\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"}],\"devdoc\":{\"kind\":\"dev\",\"methods\":{\"constructor\":{\"params\":{\"_governor\":\"Address of governor\",\"_wKP3R\":\"Address of wrapped KP3R implementation\"}},\"deposit(uint256)\":{\"params\":{\"_amount\":\"The amount of wKP3R to deposit\"}},\"mint(uint256)\":{\"params\":{\"_amount\":\"The amount of wKP3R to mint\"}},\"sendDust(address,uint256,address)\":{\"params\":{\"_amount\":\"The amont of the token that will be transferred\",\"_to\":\"The address that will receive the idle funds\",\"_token\":\"The token that will be transferred\"}},\"setMinter(address)\":{\"params\":{\"_minter\":\"The address set as the minter\"}},\"setPendingGovernor(address)\":{\"params\":{\"_pendingGovernor\":\"Address of the proposed new governor\"}},\"setWKP3R(address)\":{\"params\":{\"_wKP3R\":\"the wKP3R address\"}}},\"stateVariables\":{\"wKP3R\":{\"return\":\"_wKP3RAddress The address of wKP3R\",\"returns\":{\"_0\":\"_wKP3RAddress The address of wKP3R\"}}},\"version\":1},\"userdoc\":{\"errors\":{\"InsufficientBalance()\":[{\"notice\":\"Throws when minter attempts to withdraw more wKP3R than the escrow has in its balance\"}],\"InvalidAddress()\":[{\"notice\":\"Thrown if an address is invalid\"}],\"InvalidAmount()\":[{\"notice\":\"Thrown if an amount is invalid\"}],\"LengthMismatch()\":[{\"notice\":\"Thrown if the lengths of a set of lists mismatch\"}],\"OnlyGovernor()\":[{\"notice\":\"Thrown if a non-governor user tries to call a OnlyGovernor function\"}],\"OnlyMinter()\":[{\"notice\":\"Throws if the caller of the function is not the minter\"}],\"OnlyPendingGovernor()\":[{\"notice\":\"Thrown if a non-pending-governor user tries to call a OnlyPendingGovernor function\"}],\"ZeroAddress()\":[{\"notice\":\"Thrown if an address is the zero address\"}],\"ZeroAmount()\":[{\"notice\":\"Thrown if an amount is zero\"}]},\"events\":{\"DustSent(address,uint256,address)\":{\"notice\":\"Emitted when dust is sent\"},\"MinterSet(address)\":{\"notice\":\"Emitted when governor sets a new minter\"},\"PendingGovernorAccepted(address)\":{\"notice\":\"Emitted when a new governor is set\"},\"PendingGovernorSet(address,address)\":{\"notice\":\"Emitted when a new pending governor is set\"},\"wKP3RDeposited(address,address,uint256)\":{\"notice\":\"Emitted when Keep3rEscrow#deposit function is called\"},\"wKP3RMinted(address,address,uint256)\":{\"notice\":\"Emitted when Keep3rEscrow#mint function is called\"},\"wKP3RSet(address)\":{\"notice\":\"Emitted when Keep3rEscrow#setWKP3R function is called\"}},\"kind\":\"user\",\"methods\":{\"acceptPendingGovernor()\":{\"notice\":\"Allows a proposed governor to accept the governance\"},\"deposit(uint256)\":{\"notice\":\"Deposits wKP3R into the contract\"},\"mint(uint256)\":{\"notice\":\"mints wKP3R to the recipient\"},\"minter()\":{\"notice\":\"Stores the minter address\"},\"sendDust(address,uint256,address)\":{\"notice\":\"Allows an authorized user to transfer the tokens or eth that may have been left in a contract\"},\"setMinter(address)\":{\"notice\":\"Sets a new address to be the minter\"},\"setPendingGovernor(address)\":{\"notice\":\"Allows a governor to propose a new governor\"},\"setWKP3R(address)\":{\"notice\":\"sets the wKP3R address\"},\"wKP3R()\":{\"notice\":\"Lists the address of the wKP3R contract\"}},\"version\":1}},\"settings\":{\"compilationTarget\":{\"solidity/contracts/sidechain/Keep3rEscrow.sol\":\"Keep3rEscrow\"},\"evmVersion\":\"london\",\"libraries\":{\":__CACHE_BREAKER__\":\"0x00000000d41867734bbee4c6863d9255b2b06ac1\"},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":200},\"remappings\":[]},\"sources\":{\"@defi-wonderland/solidity-utils/solidity/contracts/DustCollector.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.8 <0.9.0;\\n\\nimport {Governable} from './Governable.sol';\\nimport {IDustCollector} from '../interfaces/IDustCollector.sol';\\nimport {IERC20} from '@openzeppelin/contracts/token/ERC20/IERC20.sol';\\nimport {SafeERC20} from '@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol';\\n\\n/// @title DustCollector contract\\nabstract contract DustCollector is IDustCollector, Governable {\\n using SafeERC20 for IERC20;\\n\\n /// @inheritdoc IDustCollector\\n address public constant ETH_ADDRESS = 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE;\\n\\n /// @inheritdoc IDustCollector\\n function sendDust(address _token, uint256 _amount, address _to) external onlyGovernor {\\n if (_to == address(0)) revert ZeroAddress();\\n if (_token == ETH_ADDRESS) payable(_to).transfer(_amount);\\n else IERC20(_token).safeTransfer(_to, _amount);\\n emit DustSent(_token, _amount, _to);\\n }\\n}\\n\",\"keccak256\":\"0xcdd6d0715406facd602770cca9320eebdc2b7b23b0e0f9e1b7b576fbc0126b47\",\"license\":\"MIT\"},\"@defi-wonderland/solidity-utils/solidity/contracts/Governable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.8 <0.9.0;\\n\\nimport {IGovernable} from '../interfaces/IGovernable.sol';\\n\\n/// @title Governable contract\\n/// @notice Manages the governor role\\nabstract contract Governable is IGovernable {\\n /// @inheritdoc IGovernable\\n address public governor;\\n\\n /// @inheritdoc IGovernable\\n address public pendingGovernor;\\n\\n constructor(address _governor) {\\n if (_governor == address(0)) revert ZeroAddress();\\n governor = _governor;\\n }\\n\\n /// @inheritdoc IGovernable\\n function setPendingGovernor(address _pendingGovernor) external onlyGovernor {\\n _setPendingGovernor(_pendingGovernor);\\n }\\n\\n /// @inheritdoc IGovernable\\n function acceptPendingGovernor() external onlyPendingGovernor {\\n _acceptPendingGovernor();\\n }\\n\\n function _setPendingGovernor(address _pendingGovernor) internal {\\n if (_pendingGovernor == address(0)) revert ZeroAddress();\\n pendingGovernor = _pendingGovernor;\\n emit PendingGovernorSet(governor, _pendingGovernor);\\n }\\n\\n function _acceptPendingGovernor() internal {\\n governor = pendingGovernor;\\n delete pendingGovernor;\\n emit PendingGovernorAccepted(governor);\\n }\\n\\n /// @notice Functions with this modifier can only be called by governor\\n modifier onlyGovernor() {\\n if (msg.sender != governor) revert OnlyGovernor();\\n _;\\n }\\n\\n /// @notice Functions with this modifier can only be called by pendingGovernor\\n modifier onlyPendingGovernor() {\\n if (msg.sender != pendingGovernor) revert OnlyPendingGovernor();\\n _;\\n }\\n}\\n\",\"keccak256\":\"0x3f11408cfcb015a99dc417e075c8ebc39b796fc2adc3e81b036487e4486881b3\",\"license\":\"MIT\"},\"@defi-wonderland/solidity-utils/solidity/interfaces/IBaseErrors.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.8 <0.9.0;\\n\\ninterface IBaseErrors {\\n /// @notice Thrown if an address is invalid\\n error InvalidAddress();\\n\\n /// @notice Thrown if an amount is invalid\\n error InvalidAmount();\\n\\n /// @notice Thrown if the lengths of a set of lists mismatch\\n error LengthMismatch();\\n\\n /// @notice Thrown if an address is the zero address\\n error ZeroAddress();\\n\\n /// @notice Thrown if an amount is zero\\n error ZeroAmount();\\n}\\n\",\"keccak256\":\"0xec09b9d248b6fbf6343dee41d6978abdc15d4c8df5ed7721e8df79e8b1a558cf\",\"license\":\"MIT\"},\"@defi-wonderland/solidity-utils/solidity/interfaces/IDustCollector.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.8 <0.9.0;\\n\\nimport {IGovernable} from './IGovernable.sol';\\nimport {IBaseErrors} from './IBaseErrors.sol';\\n\\n/// @title DustCollector interface\\ninterface IDustCollector is IBaseErrors, IGovernable {\\n // STATE VARIABLES\\n\\n /// @return _ethAddress Address used to trigger a native token transfer\\n // solhint-disable-next-line func-name-mixedcase\\n function ETH_ADDRESS() external view returns (address _ethAddress);\\n\\n // EVENTS\\n\\n /// @notice Emitted when dust is sent\\n /// @param _to The address which wil received the funds\\n /// @param _token The token that will be transferred\\n /// @param _amount The amount of the token that will be transferred\\n event DustSent(address _token, uint256 _amount, address _to);\\n\\n // FUNCTIONS\\n\\n /// @notice Allows an authorized user to transfer the tokens or eth that may have been left in a contract\\n /// @param _token The token that will be transferred\\n /// @param _amount The amont of the token that will be transferred\\n /// @param _to The address that will receive the idle funds\\n function sendDust(address _token, uint256 _amount, address _to) external;\\n}\\n\",\"keccak256\":\"0xbe22cc660bd6846093504989146038bd369f511325cef40cdc647fe7e04206b1\",\"license\":\"MIT\"},\"@defi-wonderland/solidity-utils/solidity/interfaces/IGovernable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.8 <0.9.0;\\n\\nimport {IBaseErrors} from './IBaseErrors.sol';\\n\\n/// @title Governable interface\\ninterface IGovernable is IBaseErrors {\\n // STATE VARIABLES\\n\\n /// @return _governor Address of the current governor\\n function governor() external view returns (address _governor);\\n\\n /// @return _pendingGovernor Address of the current pending governor\\n function pendingGovernor() external view returns (address _pendingGovernor);\\n\\n // EVENTS\\n\\n /// @notice Emitted when a new pending governor is set\\n /// @param _governor Address of the current governor\\n /// @param _pendingGovernor Address of the proposed next governor\\n event PendingGovernorSet(address _governor, address _pendingGovernor);\\n\\n /// @notice Emitted when a new governor is set\\n /// @param _newGovernor Address of the new governor\\n event PendingGovernorAccepted(address _newGovernor);\\n\\n // ERRORS\\n\\n /// @notice Thrown if a non-governor user tries to call a OnlyGovernor function\\n error OnlyGovernor();\\n\\n /// @notice Thrown if a non-pending-governor user tries to call a OnlyPendingGovernor function\\n error OnlyPendingGovernor();\\n\\n // FUNCTIONS\\n\\n /// @notice Allows a governor to propose a new governor\\n /// @param _pendingGovernor Address of the proposed new governor\\n function setPendingGovernor(address _pendingGovernor) external;\\n\\n /// @notice Allows a proposed governor to accept the governance\\n function acceptPendingGovernor() external;\\n}\\n\",\"keccak256\":\"0x40b94706a00d2c092f620807ba84bdd0c5ed8cfa60140c924edc850427e0af13\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC20/IERC20.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Interface of the ERC20 standard as defined in the EIP.\\n */\\ninterface IERC20 {\\n /**\\n * @dev Returns the amount of tokens in existence.\\n */\\n function totalSupply() external view returns (uint256);\\n\\n /**\\n * @dev Returns the amount of tokens owned by `account`.\\n */\\n function balanceOf(address account) external view returns (uint256);\\n\\n /**\\n * @dev Moves `amount` tokens from the caller's account to `recipient`.\\n *\\n * Returns a boolean value indicating whether the operation succeeded.\\n *\\n * Emits a {Transfer} event.\\n */\\n function transfer(address recipient, uint256 amount) external returns (bool);\\n\\n /**\\n * @dev Returns the remaining number of tokens that `spender` will be\\n * allowed to spend on behalf of `owner` through {transferFrom}. This is\\n * zero by default.\\n *\\n * This value changes when {approve} or {transferFrom} are called.\\n */\\n function allowance(address owner, address spender) external view returns (uint256);\\n\\n /**\\n * @dev Sets `amount` as the allowance of `spender` over the caller's tokens.\\n *\\n * Returns a boolean value indicating whether the operation succeeded.\\n *\\n * IMPORTANT: Beware that changing an allowance with this method brings the risk\\n * that someone may use both the old and the new allowance by unfortunate\\n * transaction ordering. One possible solution to mitigate this race\\n * condition is to first reduce the spender's allowance to 0 and set the\\n * desired value afterwards:\\n * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729\\n *\\n * Emits an {Approval} event.\\n */\\n function approve(address spender, uint256 amount) external returns (bool);\\n\\n /**\\n * @dev Moves `amount` tokens from `sender` to `recipient` using the\\n * allowance mechanism. `amount` is then deducted from the caller's\\n * allowance.\\n *\\n * Returns a boolean value indicating whether the operation succeeded.\\n *\\n * Emits a {Transfer} event.\\n */\\n function transferFrom(\\n address sender,\\n address recipient,\\n uint256 amount\\n ) external returns (bool);\\n\\n /**\\n * @dev Emitted when `value` tokens are moved from one account (`from`) to\\n * another (`to`).\\n *\\n * Note that `value` may be zero.\\n */\\n event Transfer(address indexed from, address indexed to, uint256 value);\\n\\n /**\\n * @dev Emitted when the allowance of a `spender` for an `owner` is set by\\n * a call to {approve}. `value` is the new allowance.\\n */\\n event Approval(address indexed owner, address indexed spender, uint256 value);\\n}\\n\",\"keccak256\":\"0x027b891937d20ccf213fdb9c31531574256de774bda99d3a70ecef6e1913ed2a\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../IERC20.sol\\\";\\nimport \\\"../../../utils/Address.sol\\\";\\n\\n/**\\n * @title SafeERC20\\n * @dev Wrappers around ERC20 operations that throw on failure (when the token\\n * contract returns false). Tokens that return no value (and instead revert or\\n * throw on failure) are also supported, non-reverting calls are assumed to be\\n * successful.\\n * To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract,\\n * which allows you to call the safe operations as `token.safeTransfer(...)`, etc.\\n */\\nlibrary SafeERC20 {\\n using Address for address;\\n\\n function safeTransfer(\\n IERC20 token,\\n address to,\\n uint256 value\\n ) internal {\\n _callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value));\\n }\\n\\n function safeTransferFrom(\\n IERC20 token,\\n address from,\\n address to,\\n uint256 value\\n ) internal {\\n _callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value));\\n }\\n\\n /**\\n * @dev Deprecated. This function has issues similar to the ones found in\\n * {IERC20-approve}, and its usage is discouraged.\\n *\\n * Whenever possible, use {safeIncreaseAllowance} and\\n * {safeDecreaseAllowance} instead.\\n */\\n function safeApprove(\\n IERC20 token,\\n address spender,\\n uint256 value\\n ) internal {\\n // safeApprove should only be called when setting an initial allowance,\\n // or when resetting it to zero. To increase and decrease it, use\\n // 'safeIncreaseAllowance' and 'safeDecreaseAllowance'\\n require(\\n (value == 0) || (token.allowance(address(this), spender) == 0),\\n \\\"SafeERC20: approve from non-zero to non-zero allowance\\\"\\n );\\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value));\\n }\\n\\n function safeIncreaseAllowance(\\n IERC20 token,\\n address spender,\\n uint256 value\\n ) internal {\\n uint256 newAllowance = token.allowance(address(this), spender) + value;\\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));\\n }\\n\\n function safeDecreaseAllowance(\\n IERC20 token,\\n address spender,\\n uint256 value\\n ) internal {\\n unchecked {\\n uint256 oldAllowance = token.allowance(address(this), spender);\\n require(oldAllowance >= value, \\\"SafeERC20: decreased allowance below zero\\\");\\n uint256 newAllowance = oldAllowance - value;\\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));\\n }\\n }\\n\\n /**\\n * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement\\n * on the return value: the return value is optional (but if data is returned, it must not be false).\\n * @param token The token targeted by the call.\\n * @param data The call data (encoded using abi.encode or one of its variants).\\n */\\n function _callOptionalReturn(IERC20 token, bytes memory data) private {\\n // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since\\n // we're implementing it ourselves. We use {Address.functionCall} to perform this call, which verifies that\\n // the target address contains contract code and also asserts for success in the low-level call.\\n\\n bytes memory returndata = address(token).functionCall(data, \\\"SafeERC20: low-level call failed\\\");\\n if (returndata.length > 0) {\\n // Return data is optional\\n require(abi.decode(returndata, (bool)), \\\"SafeERC20: ERC20 operation did not succeed\\\");\\n }\\n }\\n}\\n\",\"keccak256\":\"0x02348b2e4b9f3200c7e3907c5c2661643a6d8520e9f79939fbb9b4005a54894d\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/Address.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Collection of functions related to the address type\\n */\\nlibrary Address {\\n /**\\n * @dev Returns true if `account` is a contract.\\n *\\n * [IMPORTANT]\\n * ====\\n * It is unsafe to assume that an address for which this function returns\\n * false is an externally-owned account (EOA) and not a contract.\\n *\\n * Among others, `isContract` will return false for the following\\n * types of addresses:\\n *\\n * - an externally-owned account\\n * - a contract in construction\\n * - an address where a contract will be created\\n * - an address where a contract lived, but was destroyed\\n * ====\\n */\\n function isContract(address account) internal view returns (bool) {\\n // This method relies on extcodesize, which returns 0 for contracts in\\n // construction, since the code is only stored at the end of the\\n // constructor execution.\\n\\n uint256 size;\\n assembly {\\n size := extcodesize(account)\\n }\\n return size > 0;\\n }\\n\\n /**\\n * @dev Replacement for Solidity's `transfer`: sends `amount` wei to\\n * `recipient`, forwarding all available gas and reverting on errors.\\n *\\n * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost\\n * of certain opcodes, possibly making contracts go over the 2300 gas limit\\n * imposed by `transfer`, making them unable to receive funds via\\n * `transfer`. {sendValue} removes this limitation.\\n *\\n * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].\\n *\\n * IMPORTANT: because control is transferred to `recipient`, care must be\\n * taken to not create reentrancy vulnerabilities. Consider using\\n * {ReentrancyGuard} or the\\n * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].\\n */\\n function sendValue(address payable recipient, uint256 amount) internal {\\n require(address(this).balance >= amount, \\\"Address: insufficient balance\\\");\\n\\n (bool success, ) = recipient.call{value: amount}(\\\"\\\");\\n require(success, \\\"Address: unable to send value, recipient may have reverted\\\");\\n }\\n\\n /**\\n * @dev Performs a Solidity function call using a low level `call`. A\\n * plain `call` is an unsafe replacement for a function call: use this\\n * function instead.\\n *\\n * If `target` reverts with a revert reason, it is bubbled up by this\\n * function (like regular Solidity function calls).\\n *\\n * Returns the raw returned data. To convert to the expected return value,\\n * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\\n *\\n * Requirements:\\n *\\n * - `target` must be a contract.\\n * - calling `target` with `data` must not revert.\\n *\\n * _Available since v3.1._\\n */\\n function functionCall(address target, bytes memory data) internal returns (bytes memory) {\\n return functionCall(target, data, \\\"Address: low-level call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with\\n * `errorMessage` as a fallback revert reason when `target` reverts.\\n *\\n * _Available since v3.1._\\n */\\n function functionCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, 0, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but also transferring `value` wei to `target`.\\n *\\n * Requirements:\\n *\\n * - the calling contract must have an ETH balance of at least `value`.\\n * - the called Solidity function must be `payable`.\\n *\\n * _Available since v3.1._\\n */\\n function functionCallWithValue(\\n address target,\\n bytes memory data,\\n uint256 value\\n ) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, value, \\\"Address: low-level call with value failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but\\n * with `errorMessage` as a fallback revert reason when `target` reverts.\\n *\\n * _Available since v3.1._\\n */\\n function functionCallWithValue(\\n address target,\\n bytes memory data,\\n uint256 value,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n require(address(this).balance >= value, \\\"Address: insufficient balance for call\\\");\\n require(isContract(target), \\\"Address: call to non-contract\\\");\\n\\n (bool success, bytes memory returndata) = target.call{value: value}(data);\\n return verifyCallResult(success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but performing a static call.\\n *\\n * _Available since v3.3._\\n */\\n function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\\n return functionStaticCall(target, data, \\\"Address: low-level static call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\\n * but performing a static call.\\n *\\n * _Available since v3.3._\\n */\\n function functionStaticCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal view returns (bytes memory) {\\n require(isContract(target), \\\"Address: static call to non-contract\\\");\\n\\n (bool success, bytes memory returndata) = target.staticcall(data);\\n return verifyCallResult(success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but performing a delegate call.\\n *\\n * _Available since v3.4._\\n */\\n function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {\\n return functionDelegateCall(target, data, \\\"Address: low-level delegate call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\\n * but performing a delegate call.\\n *\\n * _Available since v3.4._\\n */\\n function functionDelegateCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n require(isContract(target), \\\"Address: delegate call to non-contract\\\");\\n\\n (bool success, bytes memory returndata) = target.delegatecall(data);\\n return verifyCallResult(success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the\\n * revert reason using the provided one.\\n *\\n * _Available since v4.3._\\n */\\n function verifyCallResult(\\n bool success,\\n bytes memory returndata,\\n string memory errorMessage\\n ) internal pure returns (bytes memory) {\\n if (success) {\\n return returndata;\\n } else {\\n // Look for revert reason and bubble it up if present\\n if (returndata.length > 0) {\\n // The easiest way to bubble the revert reason is using memory via assembly\\n\\n assembly {\\n let returndata_size := mload(returndata)\\n revert(add(32, returndata), returndata_size)\\n }\\n } else {\\n revert(errorMessage);\\n }\\n }\\n }\\n}\\n\",\"keccak256\":\"0x3336baae5cf23e94274d75336e2d412193be508504aee185e61dc7d58cd05c8a\",\"license\":\"MIT\"},\"solidity/contracts/peripherals/Mintable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4 <0.9.0;\\n\\nimport '../../interfaces/peripherals/IMintable.sol';\\nimport '@defi-wonderland/solidity-utils/solidity/contracts/Governable.sol';\\n\\nabstract contract Mintable is Governable, IMintable {\\n /// @inheritdoc IMintable\\n address public override minter;\\n\\n constructor(address _governor) Governable(_governor) {}\\n\\n /// @inheritdoc IMintable\\n function setMinter(address _minter) external override onlyGovernor {\\n if (_minter == address(0)) revert ZeroAddress();\\n minter = _minter;\\n emit MinterSet(_minter);\\n }\\n\\n /// @notice Functions with this modifier can only be called by the minter;\\n modifier onlyMinter() {\\n if (msg.sender != minter) revert OnlyMinter();\\n _;\\n }\\n}\\n\",\"keccak256\":\"0x6f70ca1b083865b02f0e44cc72c8c85ecab374724eda4544f3fb78555f070ea4\",\"license\":\"MIT\"},\"solidity/contracts/sidechain/Keep3rEscrow.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\n/*\\n\\nCoded for The Keep3r Network with \\u2665 by\\n\\n\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2557\\u2591\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2557\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2557\\u2588\\u2588\\u2557\\u2591\\u2591\\u2591\\u2588\\u2588\\u2557\\u2591\\u2591\\u2591\\u2591\\u2591\\u2591\\u2591\\u2588\\u2588\\u2557\\u2591\\u2588\\u2588\\u2588\\u2588\\u2588\\u2557\\u2591\\u2588\\u2588\\u2588\\u2557\\u2591\\u2591\\u2588\\u2588\\u2557\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2557\\u2591\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2557\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2557\\u2591\\u2588\\u2588\\u2557\\u2591\\u2591\\u2591\\u2591\\u2591\\u2591\\u2588\\u2588\\u2588\\u2588\\u2588\\u2557\\u2591\\u2588\\u2588\\u2588\\u2557\\u2591\\u2591\\u2588\\u2588\\u2557\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2557\\u2591\\n\\u2588\\u2588\\u2554\\u2550\\u2550\\u2588\\u2588\\u2557\\u2588\\u2588\\u2554\\u2550\\u2550\\u2550\\u2550\\u255d\\u2588\\u2588\\u2554\\u2550\\u2550\\u2550\\u2550\\u255d\\u2588\\u2588\\u2551\\u2591\\u2591\\u2591\\u2588\\u2588\\u2551\\u2591\\u2591\\u2588\\u2588\\u2557\\u2591\\u2591\\u2588\\u2588\\u2551\\u2588\\u2588\\u2554\\u2550\\u2550\\u2588\\u2588\\u2557\\u2588\\u2588\\u2588\\u2588\\u2557\\u2591\\u2588\\u2588\\u2551\\u2588\\u2588\\u2554\\u2550\\u2550\\u2588\\u2588\\u2557\\u2588\\u2588\\u2554\\u2550\\u2550\\u2550\\u2550\\u255d\\u2588\\u2588\\u2554\\u2550\\u2550\\u2588\\u2588\\u2557\\u2588\\u2588\\u2551\\u2591\\u2591\\u2591\\u2591\\u2591\\u2588\\u2588\\u2554\\u2550\\u2550\\u2588\\u2588\\u2557\\u2588\\u2588\\u2588\\u2588\\u2557\\u2591\\u2588\\u2588\\u2551\\u2588\\u2588\\u2554\\u2550\\u2550\\u2588\\u2588\\u2557\\n\\u2588\\u2588\\u2551\\u2591\\u2591\\u2588\\u2588\\u2551\\u2588\\u2588\\u2588\\u2588\\u2588\\u2557\\u2591\\u2591\\u2588\\u2588\\u2588\\u2588\\u2588\\u2557\\u2591\\u2591\\u2588\\u2588\\u2551\\u2591\\u2591\\u2591\\u255a\\u2588\\u2588\\u2557\\u2588\\u2588\\u2588\\u2588\\u2557\\u2588\\u2588\\u2554\\u255d\\u2588\\u2588\\u2551\\u2591\\u2591\\u2588\\u2588\\u2551\\u2588\\u2588\\u2554\\u2588\\u2588\\u2557\\u2588\\u2588\\u2551\\u2588\\u2588\\u2551\\u2591\\u2591\\u2588\\u2588\\u2551\\u2588\\u2588\\u2588\\u2588\\u2588\\u2557\\u2591\\u2591\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2554\\u255d\\u2588\\u2588\\u2551\\u2591\\u2591\\u2591\\u2591\\u2591\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2551\\u2588\\u2588\\u2554\\u2588\\u2588\\u2557\\u2588\\u2588\\u2551\\u2588\\u2588\\u2551\\u2591\\u2591\\u2588\\u2588\\u2551\\n\\u2588\\u2588\\u2551\\u2591\\u2591\\u2588\\u2588\\u2551\\u2588\\u2588\\u2554\\u2550\\u2550\\u255d\\u2591\\u2591\\u2588\\u2588\\u2554\\u2550\\u2550\\u255d\\u2591\\u2591\\u2588\\u2588\\u2551\\u2591\\u2591\\u2591\\u2591\\u2588\\u2588\\u2588\\u2588\\u2554\\u2550\\u2588\\u2588\\u2588\\u2588\\u2551\\u2591\\u2588\\u2588\\u2551\\u2591\\u2591\\u2588\\u2588\\u2551\\u2588\\u2588\\u2551\\u255a\\u2588\\u2588\\u2588\\u2588\\u2551\\u2588\\u2588\\u2551\\u2591\\u2591\\u2588\\u2588\\u2551\\u2588\\u2588\\u2554\\u2550\\u2550\\u255d\\u2591\\u2591\\u2588\\u2588\\u2554\\u2550\\u2550\\u2588\\u2588\\u2557\\u2588\\u2588\\u2551\\u2591\\u2591\\u2591\\u2591\\u2591\\u2588\\u2588\\u2554\\u2550\\u2550\\u2588\\u2588\\u2551\\u2588\\u2588\\u2551\\u255a\\u2588\\u2588\\u2588\\u2588\\u2551\\u2588\\u2588\\u2551\\u2591\\u2591\\u2588\\u2588\\u2551\\n\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2554\\u255d\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2557\\u2588\\u2588\\u2551\\u2591\\u2591\\u2591\\u2591\\u2591\\u2588\\u2588\\u2551\\u2591\\u2591\\u2591\\u2591\\u255a\\u2588\\u2588\\u2554\\u255d\\u2591\\u255a\\u2588\\u2588\\u2554\\u255d\\u2591\\u255a\\u2588\\u2588\\u2588\\u2588\\u2588\\u2554\\u255d\\u2588\\u2588\\u2551\\u2591\\u255a\\u2588\\u2588\\u2588\\u2551\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2554\\u255d\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2557\\u2588\\u2588\\u2551\\u2591\\u2591\\u2588\\u2588\\u2551\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2557\\u2588\\u2588\\u2551\\u2591\\u2591\\u2588\\u2588\\u2551\\u2588\\u2588\\u2551\\u2591\\u255a\\u2588\\u2588\\u2588\\u2551\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2554\\u255d\\n\\u255a\\u2550\\u2550\\u2550\\u2550\\u2550\\u255d\\u2591\\u255a\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u255d\\u255a\\u2550\\u255d\\u2591\\u2591\\u2591\\u2591\\u2591\\u255a\\u2550\\u255d\\u2591\\u2591\\u2591\\u2591\\u2591\\u255a\\u2550\\u255d\\u2591\\u2591\\u2591\\u255a\\u2550\\u255d\\u2591\\u2591\\u2591\\u255a\\u2550\\u2550\\u2550\\u2550\\u255d\\u2591\\u255a\\u2550\\u255d\\u2591\\u2591\\u255a\\u2550\\u2550\\u255d\\u255a\\u2550\\u2550\\u2550\\u2550\\u2550\\u255d\\u2591\\u255a\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u255d\\u255a\\u2550\\u255d\\u2591\\u2591\\u255a\\u2550\\u255d\\u255a\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u255d\\u255a\\u2550\\u255d\\u2591\\u2591\\u255a\\u2550\\u255d\\u255a\\u2550\\u255d\\u2591\\u2591\\u255a\\u2550\\u2550\\u255d\\u255a\\u2550\\u2550\\u2550\\u2550\\u2550\\u255d\\u2591\\n\\nhttps://defi.sucks\\n\\nCommit hash: b18e2940310077e04ec08b3026dc92e441fb08ef\\n\\n*/\\n\\npragma solidity >=0.8.4 <0.9.0;\\n\\nimport '../peripherals/Mintable.sol';\\nimport '../../interfaces/sidechain/IKeep3rEscrow.sol';\\nimport '@defi-wonderland/solidity-utils/solidity/contracts/DustCollector.sol';\\nimport '@openzeppelin/contracts/token/ERC20/IERC20.sol';\\nimport '@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol';\\n\\ncontract Keep3rEscrow is Mintable, DustCollector, IKeep3rEscrow {\\n using SafeERC20 for IERC20;\\n\\n /// @inheritdoc IKeep3rEscrow\\n address public override wKP3R;\\n\\n /// @param _governor Address of governor\\n /// @param _wKP3R Address of wrapped KP3R implementation\\n constructor(address _governor, address _wKP3R) Mintable(_governor) {\\n wKP3R = _wKP3R;\\n }\\n\\n /// @inheritdoc IKeep3rEscrow\\n function deposit(uint256 _amount) external override {\\n IERC20(wKP3R).safeTransferFrom(msg.sender, address(this), _amount);\\n emit wKP3RDeposited(wKP3R, msg.sender, _amount);\\n }\\n\\n /// @inheritdoc IKeep3rEscrow\\n function mint(uint256 _amount) external override onlyMinter {\\n IERC20(wKP3R).safeTransfer(msg.sender, _amount);\\n emit wKP3RMinted(wKP3R, msg.sender, _amount);\\n }\\n\\n /// @inheritdoc IKeep3rEscrow\\n function setWKP3R(address _wKP3R) external override onlyGovernor {\\n if (_wKP3R == address(0)) revert ZeroAddress();\\n wKP3R = _wKP3R;\\n emit wKP3RSet(wKP3R);\\n }\\n}\\n\",\"keccak256\":\"0xafdcd19a968d088199b37fc9d76484bb144e8335dcfb976921e0e2ce710e254d\",\"license\":\"MIT\"},\"solidity/interfaces/peripherals/IMintable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4 <0.9.0;\\n\\nimport '@defi-wonderland/solidity-utils/solidity/interfaces/IBaseErrors.sol';\\nimport '@defi-wonderland/solidity-utils/solidity/interfaces/IGovernable.sol';\\n\\n/// @title Mintable contract\\n/// @notice Manages the minter role\\ninterface IMintable is IBaseErrors, IGovernable {\\n // Events\\n\\n /// @notice Emitted when governor sets a new minter\\n /// @param _minter Address of the new minter\\n event MinterSet(address _minter);\\n\\n // Errors\\n\\n /// @notice Throws if the caller of the function is not the minter\\n error OnlyMinter();\\n\\n // Variables\\n\\n /// @notice Stores the minter address\\n /// @return _minter The minter addresss\\n function minter() external view returns (address _minter);\\n\\n // Methods\\n\\n /// @notice Sets a new address to be the minter\\n /// @param _minter The address set as the minter\\n function setMinter(address _minter) external;\\n}\\n\",\"keccak256\":\"0x0048c141d747eb1b0e9391ac9e13c268f858f2fec939c597992742e7a5e71597\",\"license\":\"MIT\"},\"solidity/interfaces/sidechain/IKeep3rEscrow.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4 <0.9.0;\\n\\n// solhint-disable-next-line no-empty-blocks\\n\\nimport '../peripherals/IMintable.sol';\\n\\n/// @title Keep3rEscrow contract\\n/// @notice This contract acts as an escrow contract for wKP3R tokens on sidechains and L2s\\n/// @dev Can be used as a replacement for keep3rV1Proxy in keep3r sidechain implementations\\ninterface IKeep3rEscrow is IMintable {\\n /// @notice Emitted when Keep3rEscrow#deposit function is called\\n /// @param _wKP3R The addess of the wrapped KP3R token\\n /// @param _sender The address that called the function\\n /// @param _amount The amount of wKP3R the user deposited\\n event wKP3RDeposited(address _wKP3R, address _sender, uint256 _amount);\\n\\n /// @notice Emitted when Keep3rEscrow#mint function is called\\n /// @param _wKP3R The addess of the wrapped KP3R token\\n /// @param _recipient The address that will received the newly minted wKP3R\\n /// @param _amount The amount of wKP3R minted to the recipient\\n event wKP3RMinted(address _wKP3R, address _recipient, uint256 _amount);\\n\\n /// @notice Emitted when Keep3rEscrow#setWKP3R function is called\\n /// @param _newWKP3R The address of the wKP3R contract\\n event wKP3RSet(address _newWKP3R);\\n\\n /// @notice Throws when minter attempts to withdraw more wKP3R than the escrow has in its balance\\n error InsufficientBalance();\\n\\n /// @notice Lists the address of the wKP3R contract\\n /// @return _wKP3RAddress The address of wKP3R\\n function wKP3R() external view returns (address _wKP3RAddress);\\n\\n /// @notice Deposits wKP3R into the contract\\n /// @param _amount The amount of wKP3R to deposit\\n function deposit(uint256 _amount) external;\\n\\n /// @notice mints wKP3R to the recipient\\n /// @param _amount The amount of wKP3R to mint\\n function mint(uint256 _amount) external;\\n\\n /// @notice sets the wKP3R address\\n /// @param _wKP3R the wKP3R address\\n function setWKP3R(address _wKP3R) external;\\n}\\n\",\"keccak256\":\"0xf4796dde1afba7f50805aeae92ac0a4848525aeca8355d9b1c6b36c15cca4322\",\"license\":\"MIT\"}},\"version\":1}", + "bytecode": "0x608060405234801561001057600080fd5b50604051610b92380380610b9283398101604081905261002f916100ac565b81806001600160a01b0381166100585760405163d92e233d60e01b815260040160405180910390fd5b600080546001600160a01b039283166001600160a01b0319918216179091556003805494909216931692909217909155506100df9050565b80516001600160a01b03811681146100a757600080fd5b919050565b600080604083850312156100bf57600080fd5b6100c883610090565b91506100d660208401610090565b90509250929050565b610aa4806100ee6000396000f3fe608060405234801561001057600080fd5b50600436106100b45760003560e01c8063a734f06e11610071578063a734f06e1461013e578063b509ec4514610159578063b6b55f251461016c578063e3056a341461017f578063f235757f14610192578063fca3b5aa146101a557600080fd5b806307546172146100b95780630c340a24146100e857806313f6986d146100fb5780632131606414610105578063966abd0014610118578063a0712d681461012b575b600080fd5b6002546100cc906001600160a01b031681565b6040516001600160a01b03909116815260200160405180910390f35b6000546100cc906001600160a01b031681565b6101036101b8565b005b610103610113366004610961565b6101ed565b61010361012636600461097c565b610294565b6101036101393660046109b8565b6103aa565b6100cc73eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee81565b6003546100cc906001600160a01b031681565b61010361017a3660046109b8565b610435565b6001546100cc906001600160a01b031681565b6101036101a0366004610961565b610496565b6101036101b3366004610961565b6104cd565b6001546001600160a01b031633146101e357604051639ba0305d60e01b815260040160405180910390fd5b6101eb61056d565b565b6000546001600160a01b031633146102185760405163070545c960e51b815260040160405180910390fd5b6001600160a01b03811661023f5760405163d92e233d60e01b815260040160405180910390fd5b600380546001600160a01b0319166001600160a01b0383169081179091556040519081527f8592ade84fad7cc1c020f9783980e05e1be8bf3c0b6b557f3f5d5b48b5147647906020015b60405180910390a150565b6000546001600160a01b031633146102bf5760405163070545c960e51b815260040160405180910390fd5b6001600160a01b0381166102e65760405163d92e233d60e01b815260040160405180910390fd5b6001600160a01b03831673eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee1415610347576040516001600160a01b0382169083156108fc029084906000818181858888f19350505050158015610341573d6000803e3d6000fd5b5061035b565b61035b6001600160a01b03841682846105cb565b604080516001600160a01b0385811682526020820185905283168183015290517f9a3055ded8c8b5f21bbf4946c5afab6e1fa8b3f057922658e5e1ade125fb0b1e9181900360600190a1505050565b6002546001600160a01b031633146103d557604051639cdc2ed560e01b815260040160405180910390fd5b6003546103ec906001600160a01b031633836105cb565b600354604080516001600160a01b03909216825233602083015281018290527f5c5d429f40d64606e3af1c2373aa5f5b0846566f2bb3871dcccf094850ed4fc890606001610289565b60035461044d906001600160a01b0316333084610633565b600354604080516001600160a01b03909216825233602083015281018290527fb0c9218af42df0588074c7f30948dd6d1293a5ef42e7762e83d62c5daa7c9b8490606001610289565b6000546001600160a01b031633146104c15760405163070545c960e51b815260040160405180910390fd5b6104ca81610671565b50565b6000546001600160a01b031633146104f85760405163070545c960e51b815260040160405180910390fd5b6001600160a01b03811661051f5760405163d92e233d60e01b815260040160405180910390fd5b600280546001600160a01b0319166001600160a01b0383169081179091556040519081527f726b590ef91a8c76ad05bbe91a57ef84605276528f49cd47d787f558a4e755b690602001610289565b60018054600080546001600160a01b0383166001600160a01b031991821681179092559091169091556040519081527f5d5d6e01b731c3e68060f7fe13156f6197d4aeffc2d6f498e34c717ae616b7349060200160405180910390a1565b6040516001600160a01b03831660248201526044810182905261062e90849063a9059cbb60e01b906064015b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b0319909316929092179091526106f4565b505050565b6040516001600160a01b038085166024830152831660448201526064810182905261066b9085906323b872dd60e01b906084016105f7565b50505050565b6001600160a01b0381166106985760405163d92e233d60e01b815260040160405180910390fd5b600180546001600160a01b0319166001600160a01b038381169182179092556000546040805191909316815260208101919091527f6353ec38ac394f8be94bfafcdd3580d356470599059eaeebedc3207e1cc03dec9101610289565b6000610749826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b03166107cb9092919063ffffffff16565b80519091501561062e578080602001905181019061076791906109d1565b61062e5760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b60648201526084015b60405180910390fd5b60606107da84846000856107e4565b90505b9392505050565b6060824710156108455760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f6044820152651c8818d85b1b60d21b60648201526084016107c2565b843b6108935760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e747261637400000060448201526064016107c2565b600080866001600160a01b031685876040516108af9190610a1f565b60006040518083038185875af1925050503d80600081146108ec576040519150601f19603f3d011682016040523d82523d6000602084013e6108f1565b606091505b509150915061090182828661090c565b979650505050505050565b6060831561091b5750816107dd565b82511561092b5782518084602001fd5b8160405162461bcd60e51b81526004016107c29190610a3b565b80356001600160a01b038116811461095c57600080fd5b919050565b60006020828403121561097357600080fd5b6107dd82610945565b60008060006060848603121561099157600080fd5b61099a84610945565b9250602084013591506109af60408501610945565b90509250925092565b6000602082840312156109ca57600080fd5b5035919050565b6000602082840312156109e357600080fd5b815180151581146107dd57600080fd5b60005b83811015610a0e5781810151838201526020016109f6565b8381111561066b5750506000910152565b60008251610a318184602087016109f3565b9190910192915050565b6020815260008251806020840152610a5a8160408501602087016109f3565b601f01601f1916919091016040019291505056fea26469706673582212200bb64e25ba05e0b419b12ab27ba9040065a75842a9258ef809a910013cbe85e564736f6c63430008080033", + "deployedBytecode": "0x608060405234801561001057600080fd5b50600436106100b45760003560e01c8063a734f06e11610071578063a734f06e1461013e578063b509ec4514610159578063b6b55f251461016c578063e3056a341461017f578063f235757f14610192578063fca3b5aa146101a557600080fd5b806307546172146100b95780630c340a24146100e857806313f6986d146100fb5780632131606414610105578063966abd0014610118578063a0712d681461012b575b600080fd5b6002546100cc906001600160a01b031681565b6040516001600160a01b03909116815260200160405180910390f35b6000546100cc906001600160a01b031681565b6101036101b8565b005b610103610113366004610961565b6101ed565b61010361012636600461097c565b610294565b6101036101393660046109b8565b6103aa565b6100cc73eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee81565b6003546100cc906001600160a01b031681565b61010361017a3660046109b8565b610435565b6001546100cc906001600160a01b031681565b6101036101a0366004610961565b610496565b6101036101b3366004610961565b6104cd565b6001546001600160a01b031633146101e357604051639ba0305d60e01b815260040160405180910390fd5b6101eb61056d565b565b6000546001600160a01b031633146102185760405163070545c960e51b815260040160405180910390fd5b6001600160a01b03811661023f5760405163d92e233d60e01b815260040160405180910390fd5b600380546001600160a01b0319166001600160a01b0383169081179091556040519081527f8592ade84fad7cc1c020f9783980e05e1be8bf3c0b6b557f3f5d5b48b5147647906020015b60405180910390a150565b6000546001600160a01b031633146102bf5760405163070545c960e51b815260040160405180910390fd5b6001600160a01b0381166102e65760405163d92e233d60e01b815260040160405180910390fd5b6001600160a01b03831673eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee1415610347576040516001600160a01b0382169083156108fc029084906000818181858888f19350505050158015610341573d6000803e3d6000fd5b5061035b565b61035b6001600160a01b03841682846105cb565b604080516001600160a01b0385811682526020820185905283168183015290517f9a3055ded8c8b5f21bbf4946c5afab6e1fa8b3f057922658e5e1ade125fb0b1e9181900360600190a1505050565b6002546001600160a01b031633146103d557604051639cdc2ed560e01b815260040160405180910390fd5b6003546103ec906001600160a01b031633836105cb565b600354604080516001600160a01b03909216825233602083015281018290527f5c5d429f40d64606e3af1c2373aa5f5b0846566f2bb3871dcccf094850ed4fc890606001610289565b60035461044d906001600160a01b0316333084610633565b600354604080516001600160a01b03909216825233602083015281018290527fb0c9218af42df0588074c7f30948dd6d1293a5ef42e7762e83d62c5daa7c9b8490606001610289565b6000546001600160a01b031633146104c15760405163070545c960e51b815260040160405180910390fd5b6104ca81610671565b50565b6000546001600160a01b031633146104f85760405163070545c960e51b815260040160405180910390fd5b6001600160a01b03811661051f5760405163d92e233d60e01b815260040160405180910390fd5b600280546001600160a01b0319166001600160a01b0383169081179091556040519081527f726b590ef91a8c76ad05bbe91a57ef84605276528f49cd47d787f558a4e755b690602001610289565b60018054600080546001600160a01b0383166001600160a01b031991821681179092559091169091556040519081527f5d5d6e01b731c3e68060f7fe13156f6197d4aeffc2d6f498e34c717ae616b7349060200160405180910390a1565b6040516001600160a01b03831660248201526044810182905261062e90849063a9059cbb60e01b906064015b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b0319909316929092179091526106f4565b505050565b6040516001600160a01b038085166024830152831660448201526064810182905261066b9085906323b872dd60e01b906084016105f7565b50505050565b6001600160a01b0381166106985760405163d92e233d60e01b815260040160405180910390fd5b600180546001600160a01b0319166001600160a01b038381169182179092556000546040805191909316815260208101919091527f6353ec38ac394f8be94bfafcdd3580d356470599059eaeebedc3207e1cc03dec9101610289565b6000610749826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b03166107cb9092919063ffffffff16565b80519091501561062e578080602001905181019061076791906109d1565b61062e5760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b60648201526084015b60405180910390fd5b60606107da84846000856107e4565b90505b9392505050565b6060824710156108455760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f6044820152651c8818d85b1b60d21b60648201526084016107c2565b843b6108935760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e747261637400000060448201526064016107c2565b600080866001600160a01b031685876040516108af9190610a1f565b60006040518083038185875af1925050503d80600081146108ec576040519150601f19603f3d011682016040523d82523d6000602084013e6108f1565b606091505b509150915061090182828661090c565b979650505050505050565b6060831561091b5750816107dd565b82511561092b5782518084602001fd5b8160405162461bcd60e51b81526004016107c29190610a3b565b80356001600160a01b038116811461095c57600080fd5b919050565b60006020828403121561097357600080fd5b6107dd82610945565b60008060006060848603121561099157600080fd5b61099a84610945565b9250602084013591506109af60408501610945565b90509250925092565b6000602082840312156109ca57600080fd5b5035919050565b6000602082840312156109e357600080fd5b815180151581146107dd57600080fd5b60005b83811015610a0e5781810151838201526020016109f6565b8381111561066b5750506000910152565b60008251610a318184602087016109f3565b9190910192915050565b6020815260008251806020840152610a5a8160408501602087016109f3565b601f01601f1916919091016040019291505056fea26469706673582212200bb64e25ba05e0b419b12ab27ba9040065a75842a9258ef809a910013cbe85e564736f6c63430008080033", + "devdoc": { + "kind": "dev", + "methods": { + "constructor": { + "params": { + "_governor": "Address of governor", + "_wKP3R": "Address of wrapped KP3R implementation" + } + }, + "deposit(uint256)": { + "params": { + "_amount": "The amount of wKP3R to deposit" + } + }, + "mint(uint256)": { + "params": { + "_amount": "The amount of wKP3R to mint" + } + }, + "sendDust(address,uint256,address)": { + "params": { + "_amount": "The amont of the token that will be transferred", + "_to": "The address that will receive the idle funds", + "_token": "The token that will be transferred" + } + }, + "setMinter(address)": { + "params": { + "_minter": "The address set as the minter" + } + }, + "setPendingGovernor(address)": { + "params": { + "_pendingGovernor": "Address of the proposed new governor" + } + }, + "setWKP3R(address)": { + "params": { + "_wKP3R": "the wKP3R address" + } + } + }, + "stateVariables": { + "wKP3R": { + "return": "_wKP3RAddress The address of wKP3R", + "returns": { + "_0": "_wKP3RAddress The address of wKP3R" + } + } + }, + "version": 1 + }, + "userdoc": { + "errors": { + "InsufficientBalance()": [ + { + "notice": "Throws when minter attempts to withdraw more wKP3R than the escrow has in its balance" + } + ], + "InvalidAddress()": [ + { + "notice": "Thrown if an address is invalid" + } + ], + "InvalidAmount()": [ + { + "notice": "Thrown if an amount is invalid" + } + ], + "LengthMismatch()": [ + { + "notice": "Thrown if the lengths of a set of lists mismatch" + } + ], + "OnlyGovernor()": [ + { + "notice": "Thrown if a non-governor user tries to call a OnlyGovernor function" + } + ], + "OnlyMinter()": [ + { + "notice": "Throws if the caller of the function is not the minter" + } + ], + "OnlyPendingGovernor()": [ + { + "notice": "Thrown if a non-pending-governor user tries to call a OnlyPendingGovernor function" + } + ], + "ZeroAddress()": [ + { + "notice": "Thrown if an address is the zero address" + } + ], + "ZeroAmount()": [ + { + "notice": "Thrown if an amount is zero" + } + ] + }, + "events": { + "DustSent(address,uint256,address)": { + "notice": "Emitted when dust is sent" + }, + "MinterSet(address)": { + "notice": "Emitted when governor sets a new minter" + }, + "PendingGovernorAccepted(address)": { + "notice": "Emitted when a new governor is set" + }, + "PendingGovernorSet(address,address)": { + "notice": "Emitted when a new pending governor is set" + }, + "wKP3RDeposited(address,address,uint256)": { + "notice": "Emitted when Keep3rEscrow#deposit function is called" + }, + "wKP3RMinted(address,address,uint256)": { + "notice": "Emitted when Keep3rEscrow#mint function is called" + }, + "wKP3RSet(address)": { + "notice": "Emitted when Keep3rEscrow#setWKP3R function is called" + } + }, + "kind": "user", + "methods": { + "acceptPendingGovernor()": { + "notice": "Allows a proposed governor to accept the governance" + }, + "deposit(uint256)": { + "notice": "Deposits wKP3R into the contract" + }, + "mint(uint256)": { + "notice": "mints wKP3R to the recipient" + }, + "minter()": { + "notice": "Stores the minter address" + }, + "sendDust(address,uint256,address)": { + "notice": "Allows an authorized user to transfer the tokens or eth that may have been left in a contract" + }, + "setMinter(address)": { + "notice": "Sets a new address to be the minter" + }, + "setPendingGovernor(address)": { + "notice": "Allows a governor to propose a new governor" + }, + "setWKP3R(address)": { + "notice": "sets the wKP3R address" + }, + "wKP3R()": { + "notice": "Lists the address of the wKP3R contract" + } + }, + "version": 1 + }, + "storageLayout": { + "storage": [ + { + "astId": 82, + "contract": "solidity/contracts/sidechain/Keep3rEscrow.sol:Keep3rEscrow", + "label": "governor", + "offset": 0, + "slot": "0", + "type": "t_address" + }, + { + "astId": 85, + "contract": "solidity/contracts/sidechain/Keep3rEscrow.sol:Keep3rEscrow", + "label": "pendingGovernor", + "offset": 0, + "slot": "1", + "type": "t_address" + }, + { + "astId": 6519, + "contract": "solidity/contracts/sidechain/Keep3rEscrow.sol:Keep3rEscrow", + "label": "minter", + "offset": 0, + "slot": "2", + "type": "t_address" + }, + { + "astId": 9972, + "contract": "solidity/contracts/sidechain/Keep3rEscrow.sol:Keep3rEscrow", + "label": "wKP3R", + "offset": 0, + "slot": "3", + "type": "t_address" + } + ], + "types": { + "t_address": { + "encoding": "inplace", + "label": "address", + "numberOfBytes": "20" + } + } + } +} \ No newline at end of file diff --git a/deployments/sepolia/Keep3rForTestnet.json b/deployments/sepolia/Keep3rForTestnet.json new file mode 100644 index 0000000..3c6ccc7 --- /dev/null +++ b/deployments/sepolia/Keep3rForTestnet.json @@ -0,0 +1,3997 @@ +{ + "address": "0xbC855B9Ad7398360999Bd176edBC98EB53F9E26F", + "abi": [ + { + "inputs": [ + { + "internalType": "address", + "name": "_governor", + "type": "address" + }, + { + "internalType": "address", + "name": "_keep3rHelper", + "type": "address" + }, + { + "internalType": "address", + "name": "_keep3rV1", + "type": "address" + }, + { + "internalType": "address", + "name": "_keep3rV1Proxy", + "type": "address" + } + ], + "stateMutability": "nonpayable", + "type": "constructor" + }, + { + "inputs": [], + "name": "AlreadyAJob", + "type": "error" + }, + { + "inputs": [], + "name": "AlreadyAKeeper", + "type": "error" + }, + { + "inputs": [], + "name": "AlreadyDisputed", + "type": "error" + }, + { + "inputs": [], + "name": "BondsLocked", + "type": "error" + }, + { + "inputs": [], + "name": "BondsUnexistent", + "type": "error" + }, + { + "inputs": [], + "name": "Disputed", + "type": "error" + }, + { + "inputs": [], + "name": "DisputerExistent", + "type": "error" + }, + { + "inputs": [], + "name": "DisputerUnexistent", + "type": "error" + }, + { + "inputs": [], + "name": "GasNotInitialized", + "type": "error" + }, + { + "inputs": [], + "name": "InsufficientFunds", + "type": "error" + }, + { + "inputs": [], + "name": "InsufficientJobTokenCredits", + "type": "error" + }, + { + "inputs": [], + "name": "InvalidAddress", + "type": "error" + }, + { + "inputs": [], + "name": "InvalidAmount", + "type": "error" + }, + { + "inputs": [], + "name": "JobAlreadyAdded", + "type": "error" + }, + { + "inputs": [], + "name": "JobDisputed", + "type": "error" + }, + { + "inputs": [], + "name": "JobLiquidityInsufficient", + "type": "error" + }, + { + "inputs": [], + "name": "JobLiquidityLessThanMin", + "type": "error" + }, + { + "inputs": [], + "name": "JobLiquidityUnexistent", + "type": "error" + }, + { + "inputs": [], + "name": "JobMigrationImpossible", + "type": "error" + }, + { + "inputs": [], + "name": "JobMigrationLocked", + "type": "error" + }, + { + "inputs": [], + "name": "JobMigrationUnavailable", + "type": "error" + }, + { + "inputs": [], + "name": "JobTokenCreditsLocked", + "type": "error" + }, + { + "inputs": [], + "name": "JobTokenInsufficient", + "type": "error" + }, + { + "inputs": [], + "name": "JobTokenUnexistent", + "type": "error" + }, + { + "inputs": [], + "name": "JobUnapproved", + "type": "error" + }, + { + "inputs": [], + "name": "JobUnavailable", + "type": "error" + }, + { + "inputs": [], + "name": "LengthMismatch", + "type": "error" + }, + { + "inputs": [], + "name": "LiquidityPairApproved", + "type": "error" + }, + { + "inputs": [], + "name": "LiquidityPairUnapproved", + "type": "error" + }, + { + "inputs": [], + "name": "LiquidityPairUnexistent", + "type": "error" + }, + { + "inputs": [], + "name": "MinRewardPeriod", + "type": "error" + }, + { + "inputs": [], + "name": "NotDisputed", + "type": "error" + }, + { + "inputs": [], + "name": "OnlyDisputer", + "type": "error" + }, + { + "inputs": [], + "name": "OnlyGovernor", + "type": "error" + }, + { + "inputs": [], + "name": "OnlyJobOwner", + "type": "error" + }, + { + "inputs": [], + "name": "OnlyPendingGovernor", + "type": "error" + }, + { + "inputs": [], + "name": "OnlyPendingJobOwner", + "type": "error" + }, + { + "inputs": [], + "name": "OnlySlasher", + "type": "error" + }, + { + "inputs": [], + "name": "SlasherExistent", + "type": "error" + }, + { + "inputs": [], + "name": "SlasherUnexistent", + "type": "error" + }, + { + "inputs": [], + "name": "TokenUnallowed", + "type": "error" + }, + { + "inputs": [], + "name": "UnbondsLocked", + "type": "error" + }, + { + "inputs": [], + "name": "UnbondsUnexistent", + "type": "error" + }, + { + "inputs": [], + "name": "ZeroAddress", + "type": "error" + }, + { + "inputs": [], + "name": "ZeroAmount", + "type": "error" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "_keeper", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "_bond", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "_amount", + "type": "uint256" + } + ], + "name": "Activation", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint256", + "name": "_bondTime", + "type": "uint256" + } + ], + "name": "BondTimeChange", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "_keeper", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "_bonding", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "_amount", + "type": "uint256" + } + ], + "name": "Bonding", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "_jobOrKeeper", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "_disputer", + "type": "address" + } + ], + "name": "Dispute", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "_disputer", + "type": "address" + } + ], + "name": "DisputerAdded", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "_disputer", + "type": "address" + } + ], + "name": "DisputerRemoved", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "_token", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "_amount", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "address", + "name": "_to", + "type": "address" + } + ], + "name": "DustSent", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint256", + "name": "_fee", + "type": "uint256" + } + ], + "name": "FeeChange", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint256", + "name": "_inflationPeriod", + "type": "uint256" + } + ], + "name": "InflationPeriodChange", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "_job", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "_jobOwner", + "type": "address" + } + ], + "name": "JobAddition", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "_fromJob", + "type": "address" + }, + { + "indexed": false, + "internalType": "address", + "name": "_toJob", + "type": "address" + } + ], + "name": "JobMigrationRequested", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "_fromJob", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "_toJob", + "type": "address" + } + ], + "name": "JobMigrationSuccessful", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "_job", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "_previousOwner", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "_newOwner", + "type": "address" + } + ], + "name": "JobOwnershipAssent", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "_job", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "_owner", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "_pendingOwner", + "type": "address" + } + ], + "name": "JobOwnershipChange", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "_job", + "type": "address" + }, + { + "indexed": false, + "internalType": "address", + "name": "_liquidity", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "_slasher", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "_amount", + "type": "uint256" + } + ], + "name": "JobSlashLiquidity", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "_job", + "type": "address" + }, + { + "indexed": false, + "internalType": "address", + "name": "_token", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "_slasher", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "_amount", + "type": "uint256" + } + ], + "name": "JobSlashToken", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "_keep3rHelper", + "type": "address" + } + ], + "name": "Keep3rHelperChange", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "_keep3rV1", + "type": "address" + } + ], + "name": "Keep3rV1Change", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "_keep3rV1Proxy", + "type": "address" + } + ], + "name": "Keep3rV1ProxyChange", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "_keeper", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "_slasher", + "type": "address" + } + ], + "name": "KeeperRevoke", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "_keeper", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "_slasher", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "_amount", + "type": "uint256" + } + ], + "name": "KeeperSlash", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint256", + "name": "_gasLeft", + "type": "uint256" + } + ], + "name": "KeeperValidation", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "_credit", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "_job", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "_keeper", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "_payment", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "_gasLeft", + "type": "uint256" + } + ], + "name": "KeeperWork", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "_job", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "_liquidity", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "_provider", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "_amount", + "type": "uint256" + } + ], + "name": "LiquidityAddition", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "_liquidity", + "type": "address" + } + ], + "name": "LiquidityApproval", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "_job", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "_rewardedAt", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "_currentCredits", + "type": "uint256" + } + ], + "name": "LiquidityCreditsForced", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "_job", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "_rewardedAt", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "_currentCredits", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "_periodCredits", + "type": "uint256" + } + ], + "name": "LiquidityCreditsReward", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint256", + "name": "_liquidityMinimum", + "type": "uint256" + } + ], + "name": "LiquidityMinimumChange", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "_liquidity", + "type": "address" + } + ], + "name": "LiquidityRevocation", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "_job", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "_liquidity", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "_receiver", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "_amount", + "type": "uint256" + } + ], + "name": "LiquidityWithdrawal", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "_newGovernor", + "type": "address" + } + ], + "name": "PendingGovernorAccepted", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "_governor", + "type": "address" + }, + { + "indexed": false, + "internalType": "address", + "name": "_pendingGovernor", + "type": "address" + } + ], + "name": "PendingGovernorSet", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "_jobOrKeeper", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "_resolver", + "type": "address" + } + ], + "name": "Resolve", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint256", + "name": "_rewardPeriodTime", + "type": "uint256" + } + ], + "name": "RewardPeriodTimeChange", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "_slasher", + "type": "address" + } + ], + "name": "SlasherAdded", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "_slasher", + "type": "address" + } + ], + "name": "SlasherRemoved", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "_job", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "_token", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "_provider", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "_amount", + "type": "uint256" + } + ], + "name": "TokenCreditAddition", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "_job", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "_token", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "_receiver", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "_amount", + "type": "uint256" + } + ], + "name": "TokenCreditWithdrawal", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint256", + "name": "_unbondTime", + "type": "uint256" + } + ], + "name": "UnbondTimeChange", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "_keeperOrJob", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "_unbonding", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "_amount", + "type": "uint256" + } + ], + "name": "Unbonding", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "_keeper", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "_bond", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "_amount", + "type": "uint256" + } + ], + "name": "Withdrawal", + "type": "event" + }, + { + "inputs": [], + "name": "ETH_ADDRESS", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_fromJob", + "type": "address" + }, + { + "internalType": "address", + "name": "_toJob", + "type": "address" + } + ], + "name": "acceptJobMigration", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_job", + "type": "address" + } + ], + "name": "acceptJobOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "acceptPendingGovernor", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_bonding", + "type": "address" + } + ], + "name": "activate", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_disputer", + "type": "address" + } + ], + "name": "addDisputer", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_job", + "type": "address" + } + ], + "name": "addJob", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_job", + "type": "address" + }, + { + "internalType": "address", + "name": "_liquidity", + "type": "address" + }, + { + "internalType": "uint256", + "name": "_amount", + "type": "uint256" + } + ], + "name": "addLiquidityToJob", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_slasher", + "type": "address" + } + ], + "name": "addSlasher", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_job", + "type": "address" + }, + { + "internalType": "address", + "name": "_token", + "type": "address" + }, + { + "internalType": "uint256", + "name": "_amount", + "type": "uint256" + } + ], + "name": "addTokenCreditsToJob", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_liquidity", + "type": "address" + } + ], + "name": "approveLiquidity", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "approvedLiquidities", + "outputs": [ + { + "internalType": "address[]", + "name": "_list", + "type": "address[]" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_bonding", + "type": "address" + }, + { + "internalType": "uint256", + "name": "_amount", + "type": "uint256" + } + ], + "name": "bond", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "bondTime", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_keeper", + "type": "address" + }, + { + "internalType": "uint256", + "name": "_payment", + "type": "uint256" + } + ], + "name": "bondedPayment", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + }, + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "name": "bonds", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + }, + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "name": "canActivateAfter", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + }, + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "name": "canWithdrawAfter", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_job", + "type": "address" + }, + { + "internalType": "address", + "name": "_newOwner", + "type": "address" + } + ], + "name": "changeJobOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_token", + "type": "address" + }, + { + "internalType": "address", + "name": "_keeper", + "type": "address" + }, + { + "internalType": "uint256", + "name": "_amount", + "type": "uint256" + } + ], + "name": "directTokenPayment", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_jobOrKeeper", + "type": "address" + } + ], + "name": "dispute", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "name": "disputers", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "name": "disputes", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "fee", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "name": "firstSeen", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_job", + "type": "address" + }, + { + "internalType": "uint256", + "name": "_amount", + "type": "uint256" + } + ], + "name": "forceLiquidityCreditsToJob", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "governor", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "name": "hasBonded", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "inflationPeriod", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_keeper", + "type": "address" + }, + { + "internalType": "address", + "name": "_bond", + "type": "address" + }, + { + "internalType": "uint256", + "name": "_minBond", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "_earned", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "_age", + "type": "uint256" + } + ], + "name": "isBondedKeeper", + "outputs": [ + { + "internalType": "bool", + "name": "_isBondedKeeper", + "type": "bool" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_keeper", + "type": "address" + } + ], + "name": "isKeeper", + "outputs": [ + { + "internalType": "bool", + "name": "_isKeeper", + "type": "bool" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_job", + "type": "address" + } + ], + "name": "jobLiquidityCredits", + "outputs": [ + { + "internalType": "uint256", + "name": "_liquidityCredits", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "name": "jobOwner", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "name": "jobPendingOwner", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_job", + "type": "address" + } + ], + "name": "jobPeriodCredits", + "outputs": [ + { + "internalType": "uint256", + "name": "_periodCredits", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + }, + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "name": "jobTokenCredits", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + }, + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "name": "jobTokenCreditsAddedAt", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "jobs", + "outputs": [ + { + "internalType": "address[]", + "name": "_list", + "type": "address[]" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "keep3rHelper", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "keep3rV1", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "keep3rV1Proxy", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "keepers", + "outputs": [ + { + "internalType": "address[]", + "name": "_list", + "type": "address[]" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + }, + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "name": "liquidityAmount", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "liquidityMinimum", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_fromJob", + "type": "address" + }, + { + "internalType": "address", + "name": "_toJob", + "type": "address" + } + ], + "name": "migrateJob", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_liquidity", + "type": "address" + } + ], + "name": "observeLiquidity", + "outputs": [ + { + "components": [ + { + "internalType": "int56", + "name": "current", + "type": "int56" + }, + { + "internalType": "int56", + "name": "difference", + "type": "int56" + }, + { + "internalType": "uint256", + "name": "period", + "type": "uint256" + } + ], + "internalType": "struct IKeep3rJobFundableLiquidity.TickCache", + "name": "_tickCache", + "type": "tuple" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + }, + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "name": "pendingBonds", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "pendingGovernor", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "name": "pendingJobMigrations", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + }, + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "name": "pendingUnbonds", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_liquidity", + "type": "address" + }, + { + "internalType": "uint256", + "name": "_amount", + "type": "uint256" + } + ], + "name": "quoteLiquidity", + "outputs": [ + { + "internalType": "uint256", + "name": "_periodCredits", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_disputer", + "type": "address" + } + ], + "name": "removeDisputer", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_slasher", + "type": "address" + } + ], + "name": "removeSlasher", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_jobOrKeeper", + "type": "address" + } + ], + "name": "resolve", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_keeper", + "type": "address" + } + ], + "name": "revoke", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_liquidity", + "type": "address" + } + ], + "name": "revokeLiquidity", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "rewardPeriodTime", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "name": "rewardedAt", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_token", + "type": "address" + }, + { + "internalType": "uint256", + "name": "_amount", + "type": "uint256" + }, + { + "internalType": "address", + "name": "_to", + "type": "address" + } + ], + "name": "sendDust", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "_bondTime", + "type": "uint256" + } + ], + "name": "setBondTime", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "_fee", + "type": "uint256" + } + ], + "name": "setFee", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "_inflationPeriod", + "type": "uint256" + } + ], + "name": "setInflationPeriod", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_keep3rHelper", + "type": "address" + } + ], + "name": "setKeep3rHelper", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_keep3rV1", + "type": "address" + } + ], + "name": "setKeep3rV1", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_keep3rV1Proxy", + "type": "address" + } + ], + "name": "setKeep3rV1Proxy", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "_liquidityMinimum", + "type": "uint256" + } + ], + "name": "setLiquidityMinimum", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_pendingGovernor", + "type": "address" + } + ], + "name": "setPendingGovernor", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "_rewardPeriodTime", + "type": "uint256" + } + ], + "name": "setRewardPeriodTime", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "_unbondTime", + "type": "uint256" + } + ], + "name": "setUnbondTime", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_keeper", + "type": "address" + }, + { + "internalType": "address", + "name": "_bonded", + "type": "address" + }, + { + "internalType": "uint256", + "name": "_bondAmount", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "_unbondAmount", + "type": "uint256" + } + ], + "name": "slash", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_job", + "type": "address" + }, + { + "internalType": "address", + "name": "_liquidity", + "type": "address" + }, + { + "internalType": "uint256", + "name": "_amount", + "type": "uint256" + } + ], + "name": "slashLiquidityFromJob", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_job", + "type": "address" + }, + { + "internalType": "address", + "name": "_token", + "type": "address" + }, + { + "internalType": "uint256", + "name": "_amount", + "type": "uint256" + } + ], + "name": "slashTokenFromJob", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "name": "slashers", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "totalBonds", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_job", + "type": "address" + } + ], + "name": "totalJobCredits", + "outputs": [ + { + "internalType": "uint256", + "name": "_credits", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_bonding", + "type": "address" + }, + { + "internalType": "uint256", + "name": "_amount", + "type": "uint256" + } + ], + "name": "unbond", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_job", + "type": "address" + }, + { + "internalType": "address", + "name": "_liquidity", + "type": "address" + }, + { + "internalType": "uint256", + "name": "_amount", + "type": "uint256" + } + ], + "name": "unbondLiquidityFromJob", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "unbondTime", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_bonding", + "type": "address" + } + ], + "name": "withdraw", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_job", + "type": "address" + }, + { + "internalType": "address", + "name": "_liquidity", + "type": "address" + }, + { + "internalType": "address", + "name": "_receiver", + "type": "address" + } + ], + "name": "withdrawLiquidityFromJob", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_job", + "type": "address" + }, + { + "internalType": "address", + "name": "_token", + "type": "address" + }, + { + "internalType": "uint256", + "name": "_amount", + "type": "uint256" + }, + { + "internalType": "address", + "name": "_receiver", + "type": "address" + } + ], + "name": "withdrawTokenCreditsFromJob", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "name": "workCompleted", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_keeper", + "type": "address" + } + ], + "name": "worked", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "name": "workedAt", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + } + ], + "transactionHash": "0x291b72577b3a75984c23f3bef4205e246b7d8a3981fc9212b7ced31632bba133", + "receipt": { + "to": null, + "from": "0x169Cf949aB1B25453b70F2Fe874e2c65c10AE0f8", + "contractAddress": "0xbC855B9Ad7398360999Bd176edBC98EB53F9E26F", + "transactionIndex": 36, + "gasUsed": "5532985", + "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "blockHash": "0x4c6c84872da6d9fbe3fd7415c91211cd6cecd7d4a688403b4c2f640a7082c92b", + "transactionHash": "0x291b72577b3a75984c23f3bef4205e246b7d8a3981fc9212b7ced31632bba133", + "logs": [], + "blockNumber": 6046503, + "cumulativeGasUsed": "16974954", + "status": 1, + "byzantium": true + }, + "args": [ + "0x169Cf949aB1B25453b70F2Fe874e2c65c10AE0f8", + "0x5e07658C7B5F66a3698103b8A74a941E14DF1F30", + "0x80B4327021946fF962d570c808B6aaC47224AeF1", + "0x80B4327021946fF962d570c808B6aaC47224AeF1" + ], + "numDeployments": 4, + "solcInputHash": "4e9d9cfe55e24217a94485fe49438e4a", + "metadata": "{\"compiler\":{\"version\":\"0.8.8+commit.dddeac2f\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_governor\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"_keep3rHelper\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"_keep3rV1\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"_keep3rV1Proxy\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"inputs\":[],\"name\":\"AlreadyAJob\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"AlreadyAKeeper\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"AlreadyDisputed\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"BondsLocked\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"BondsUnexistent\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"Disputed\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"DisputerExistent\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"DisputerUnexistent\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"GasNotInitialized\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"InsufficientFunds\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"InsufficientJobTokenCredits\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"InvalidAddress\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"InvalidAmount\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"JobAlreadyAdded\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"JobDisputed\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"JobLiquidityInsufficient\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"JobLiquidityLessThanMin\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"JobLiquidityUnexistent\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"JobMigrationImpossible\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"JobMigrationLocked\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"JobMigrationUnavailable\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"JobTokenCreditsLocked\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"JobTokenInsufficient\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"JobTokenUnexistent\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"JobUnapproved\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"JobUnavailable\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"LengthMismatch\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"LiquidityPairApproved\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"LiquidityPairUnapproved\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"LiquidityPairUnexistent\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"MinRewardPeriod\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"NotDisputed\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"OnlyDisputer\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"OnlyGovernor\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"OnlyJobOwner\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"OnlyPendingGovernor\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"OnlyPendingJobOwner\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"OnlySlasher\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"SlasherExistent\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"SlasherUnexistent\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"TokenUnallowed\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"UnbondsLocked\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"UnbondsUnexistent\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"ZeroAddress\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"ZeroAmount\",\"type\":\"error\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"_keeper\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"_bond\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"_amount\",\"type\":\"uint256\"}],\"name\":\"Activation\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"_bondTime\",\"type\":\"uint256\"}],\"name\":\"BondTimeChange\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"_keeper\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"_bonding\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"_amount\",\"type\":\"uint256\"}],\"name\":\"Bonding\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"_jobOrKeeper\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"_disputer\",\"type\":\"address\"}],\"name\":\"Dispute\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"_disputer\",\"type\":\"address\"}],\"name\":\"DisputerAdded\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"_disputer\",\"type\":\"address\"}],\"name\":\"DisputerRemoved\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"_token\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"_amount\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"_to\",\"type\":\"address\"}],\"name\":\"DustSent\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"_fee\",\"type\":\"uint256\"}],\"name\":\"FeeChange\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"_inflationPeriod\",\"type\":\"uint256\"}],\"name\":\"InflationPeriodChange\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"_job\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"_jobOwner\",\"type\":\"address\"}],\"name\":\"JobAddition\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"_fromJob\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"_toJob\",\"type\":\"address\"}],\"name\":\"JobMigrationRequested\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"_fromJob\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"_toJob\",\"type\":\"address\"}],\"name\":\"JobMigrationSuccessful\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"_job\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"_previousOwner\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"_newOwner\",\"type\":\"address\"}],\"name\":\"JobOwnershipAssent\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"_job\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"_owner\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"_pendingOwner\",\"type\":\"address\"}],\"name\":\"JobOwnershipChange\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"_job\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"_liquidity\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"_slasher\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"_amount\",\"type\":\"uint256\"}],\"name\":\"JobSlashLiquidity\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"_job\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"_token\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"_slasher\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"_amount\",\"type\":\"uint256\"}],\"name\":\"JobSlashToken\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"_keep3rHelper\",\"type\":\"address\"}],\"name\":\"Keep3rHelperChange\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"_keep3rV1\",\"type\":\"address\"}],\"name\":\"Keep3rV1Change\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"_keep3rV1Proxy\",\"type\":\"address\"}],\"name\":\"Keep3rV1ProxyChange\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"_keeper\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"_slasher\",\"type\":\"address\"}],\"name\":\"KeeperRevoke\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"_keeper\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"_slasher\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"_amount\",\"type\":\"uint256\"}],\"name\":\"KeeperSlash\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"_gasLeft\",\"type\":\"uint256\"}],\"name\":\"KeeperValidation\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"_credit\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"_job\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"_keeper\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"_payment\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"_gasLeft\",\"type\":\"uint256\"}],\"name\":\"KeeperWork\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"_job\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"_liquidity\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"_provider\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"_amount\",\"type\":\"uint256\"}],\"name\":\"LiquidityAddition\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"_liquidity\",\"type\":\"address\"}],\"name\":\"LiquidityApproval\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"_job\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"_rewardedAt\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"_currentCredits\",\"type\":\"uint256\"}],\"name\":\"LiquidityCreditsForced\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"_job\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"_rewardedAt\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"_currentCredits\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"_periodCredits\",\"type\":\"uint256\"}],\"name\":\"LiquidityCreditsReward\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"_liquidityMinimum\",\"type\":\"uint256\"}],\"name\":\"LiquidityMinimumChange\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"_liquidity\",\"type\":\"address\"}],\"name\":\"LiquidityRevocation\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"_job\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"_liquidity\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"_receiver\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"_amount\",\"type\":\"uint256\"}],\"name\":\"LiquidityWithdrawal\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"_newGovernor\",\"type\":\"address\"}],\"name\":\"PendingGovernorAccepted\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"_governor\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"_pendingGovernor\",\"type\":\"address\"}],\"name\":\"PendingGovernorSet\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"_jobOrKeeper\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"_resolver\",\"type\":\"address\"}],\"name\":\"Resolve\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"_rewardPeriodTime\",\"type\":\"uint256\"}],\"name\":\"RewardPeriodTimeChange\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"_slasher\",\"type\":\"address\"}],\"name\":\"SlasherAdded\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"_slasher\",\"type\":\"address\"}],\"name\":\"SlasherRemoved\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"_job\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"_token\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"_provider\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"_amount\",\"type\":\"uint256\"}],\"name\":\"TokenCreditAddition\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"_job\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"_token\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"_receiver\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"_amount\",\"type\":\"uint256\"}],\"name\":\"TokenCreditWithdrawal\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"_unbondTime\",\"type\":\"uint256\"}],\"name\":\"UnbondTimeChange\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"_keeperOrJob\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"_unbonding\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"_amount\",\"type\":\"uint256\"}],\"name\":\"Unbonding\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"_keeper\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"_bond\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"_amount\",\"type\":\"uint256\"}],\"name\":\"Withdrawal\",\"type\":\"event\"},{\"inputs\":[],\"name\":\"ETH_ADDRESS\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_fromJob\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"_toJob\",\"type\":\"address\"}],\"name\":\"acceptJobMigration\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_job\",\"type\":\"address\"}],\"name\":\"acceptJobOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"acceptPendingGovernor\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_bonding\",\"type\":\"address\"}],\"name\":\"activate\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_disputer\",\"type\":\"address\"}],\"name\":\"addDisputer\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_job\",\"type\":\"address\"}],\"name\":\"addJob\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_job\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"_liquidity\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"_amount\",\"type\":\"uint256\"}],\"name\":\"addLiquidityToJob\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_slasher\",\"type\":\"address\"}],\"name\":\"addSlasher\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_job\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"_token\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"_amount\",\"type\":\"uint256\"}],\"name\":\"addTokenCreditsToJob\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_liquidity\",\"type\":\"address\"}],\"name\":\"approveLiquidity\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"approvedLiquidities\",\"outputs\":[{\"internalType\":\"address[]\",\"name\":\"_list\",\"type\":\"address[]\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_bonding\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"_amount\",\"type\":\"uint256\"}],\"name\":\"bond\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"bondTime\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_keeper\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"_payment\",\"type\":\"uint256\"}],\"name\":\"bondedPayment\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"bonds\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"canActivateAfter\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"canWithdrawAfter\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_job\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"_newOwner\",\"type\":\"address\"}],\"name\":\"changeJobOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_token\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"_keeper\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"_amount\",\"type\":\"uint256\"}],\"name\":\"directTokenPayment\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_jobOrKeeper\",\"type\":\"address\"}],\"name\":\"dispute\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"disputers\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"disputes\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"fee\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"firstSeen\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_job\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"_amount\",\"type\":\"uint256\"}],\"name\":\"forceLiquidityCreditsToJob\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"governor\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"hasBonded\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"inflationPeriod\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_keeper\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"_bond\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"_minBond\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"_earned\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"_age\",\"type\":\"uint256\"}],\"name\":\"isBondedKeeper\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"_isBondedKeeper\",\"type\":\"bool\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_keeper\",\"type\":\"address\"}],\"name\":\"isKeeper\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"_isKeeper\",\"type\":\"bool\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_job\",\"type\":\"address\"}],\"name\":\"jobLiquidityCredits\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"_liquidityCredits\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"jobOwner\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"jobPendingOwner\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_job\",\"type\":\"address\"}],\"name\":\"jobPeriodCredits\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"_periodCredits\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"jobTokenCredits\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"jobTokenCreditsAddedAt\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"jobs\",\"outputs\":[{\"internalType\":\"address[]\",\"name\":\"_list\",\"type\":\"address[]\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"keep3rHelper\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"keep3rV1\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"keep3rV1Proxy\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"keepers\",\"outputs\":[{\"internalType\":\"address[]\",\"name\":\"_list\",\"type\":\"address[]\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"liquidityAmount\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"liquidityMinimum\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_fromJob\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"_toJob\",\"type\":\"address\"}],\"name\":\"migrateJob\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_liquidity\",\"type\":\"address\"}],\"name\":\"observeLiquidity\",\"outputs\":[{\"components\":[{\"internalType\":\"int56\",\"name\":\"current\",\"type\":\"int56\"},{\"internalType\":\"int56\",\"name\":\"difference\",\"type\":\"int56\"},{\"internalType\":\"uint256\",\"name\":\"period\",\"type\":\"uint256\"}],\"internalType\":\"struct IKeep3rJobFundableLiquidity.TickCache\",\"name\":\"_tickCache\",\"type\":\"tuple\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"pendingBonds\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"pendingGovernor\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"pendingJobMigrations\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"pendingUnbonds\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_liquidity\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"_amount\",\"type\":\"uint256\"}],\"name\":\"quoteLiquidity\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"_periodCredits\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_disputer\",\"type\":\"address\"}],\"name\":\"removeDisputer\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_slasher\",\"type\":\"address\"}],\"name\":\"removeSlasher\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_jobOrKeeper\",\"type\":\"address\"}],\"name\":\"resolve\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_keeper\",\"type\":\"address\"}],\"name\":\"revoke\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_liquidity\",\"type\":\"address\"}],\"name\":\"revokeLiquidity\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"rewardPeriodTime\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"rewardedAt\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_token\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"_amount\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"_to\",\"type\":\"address\"}],\"name\":\"sendDust\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_bondTime\",\"type\":\"uint256\"}],\"name\":\"setBondTime\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_fee\",\"type\":\"uint256\"}],\"name\":\"setFee\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_inflationPeriod\",\"type\":\"uint256\"}],\"name\":\"setInflationPeriod\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_keep3rHelper\",\"type\":\"address\"}],\"name\":\"setKeep3rHelper\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_keep3rV1\",\"type\":\"address\"}],\"name\":\"setKeep3rV1\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_keep3rV1Proxy\",\"type\":\"address\"}],\"name\":\"setKeep3rV1Proxy\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_liquidityMinimum\",\"type\":\"uint256\"}],\"name\":\"setLiquidityMinimum\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_pendingGovernor\",\"type\":\"address\"}],\"name\":\"setPendingGovernor\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_rewardPeriodTime\",\"type\":\"uint256\"}],\"name\":\"setRewardPeriodTime\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_unbondTime\",\"type\":\"uint256\"}],\"name\":\"setUnbondTime\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_keeper\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"_bonded\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"_bondAmount\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"_unbondAmount\",\"type\":\"uint256\"}],\"name\":\"slash\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_job\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"_liquidity\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"_amount\",\"type\":\"uint256\"}],\"name\":\"slashLiquidityFromJob\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_job\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"_token\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"_amount\",\"type\":\"uint256\"}],\"name\":\"slashTokenFromJob\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"slashers\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"totalBonds\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_job\",\"type\":\"address\"}],\"name\":\"totalJobCredits\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"_credits\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_bonding\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"_amount\",\"type\":\"uint256\"}],\"name\":\"unbond\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_job\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"_liquidity\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"_amount\",\"type\":\"uint256\"}],\"name\":\"unbondLiquidityFromJob\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"unbondTime\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_bonding\",\"type\":\"address\"}],\"name\":\"withdraw\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_job\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"_liquidity\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"_receiver\",\"type\":\"address\"}],\"name\":\"withdrawLiquidityFromJob\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_job\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"_token\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"_amount\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"_receiver\",\"type\":\"address\"}],\"name\":\"withdrawTokenCreditsFromJob\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"workCompleted\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_keeper\",\"type\":\"address\"}],\"name\":\"worked\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"workedAt\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"}],\"devdoc\":{\"kind\":\"dev\",\"methods\":{\"acceptJobMigration(address,address)\":{\"details\":\"Unbond/withdraw process doesn't get migrated\",\"params\":{\"_fromJob\":\"The address of the job that requested to migrate\",\"_toJob\":\"The address to which the job wants to migrate to\"}},\"acceptJobOwnership(address)\":{\"params\":{\"_job\":\"The address of the job\"}},\"activate(address)\":{\"params\":{\"_bonding\":\"The asset being activated as bond collateral\"}},\"addJob(address)\":{\"params\":{\"_job\":\"Address of the contract for which work should be performed\"}},\"addLiquidityToJob(address,address,uint256)\":{\"params\":{\"_amount\":\"The amount of liquidity tokens to add\",\"_job\":\"The address of the job to assign liquidity to\",\"_liquidity\":\"The liquidity being added\"}},\"addTokenCreditsToJob(address,address,uint256)\":{\"params\":{\"_amount\":\"The amount of credit being added\",\"_job\":\"The address of the job being credited\",\"_token\":\"The address of the token being credited\"}},\"approveLiquidity(address)\":{\"params\":{\"_liquidity\":\"The address of the liquidity accepted\"}},\"approvedLiquidities()\":{\"returns\":{\"_list\":\"An array of addresses with all the approved liquidity pairs\"}},\"bond(address,uint256)\":{\"params\":{\"_amount\":\"The amount of bonding asset being bonded\",\"_bonding\":\"The asset being bonded\"}},\"bondedPayment(address,uint256)\":{\"details\":\"Pays the keeper that performs the work with KP3R\",\"params\":{\"_keeper\":\"Address of the keeper that performed the work\",\"_payment\":\"The reward that should be allocated for the job\"}},\"changeJobOwnership(address,address)\":{\"params\":{\"_job\":\"The address of the job\",\"_newOwner\":\"The address of the proposed new owner\"}},\"directTokenPayment(address,address,uint256)\":{\"details\":\"Pays the keeper that performs the work with a specific token\",\"params\":{\"_amount\":\"The reward that should be allocated\",\"_keeper\":\"Address of the keeper that performed the work\",\"_token\":\"The asset being awarded to the keeper\"}},\"dispute(address)\":{\"params\":{\"_jobOrKeeper\":\"The address in dispute\"}},\"forceLiquidityCreditsToJob(address,uint256)\":{\"params\":{\"_amount\":\"The amount of liquidity credits to gift\",\"_job\":\"The address of the job being credited\"}},\"isBondedKeeper(address,address,uint256,uint256,uint256)\":{\"details\":\"Should be used for protected functions\",\"params\":{\"_age\":\"The minimum keeper age required\",\"_bond\":\"The bond token being evaluated\",\"_earned\":\"The minimum funds earned in the keepers lifetime\",\"_keeper\":\"The keeper to check\",\"_minBond\":\"The minimum amount of bonded tokens\"},\"returns\":{\"_isBondedKeeper\":\"Whether the `_keeper` meets the given requirements\"}},\"isKeeper(address)\":{\"details\":\"Can be used for general (non critical) functions\",\"params\":{\"_keeper\":\"The keeper being investigated\"},\"returns\":{\"_isKeeper\":\"Whether the address passed as a parameter is a keeper or not\"}},\"jobLiquidityCredits(address)\":{\"params\":{\"_job\":\"The address of the job of which we want to know the liquidity credits\"},\"returns\":{\"_liquidityCredits\":\"The liquidity credits of a given job\"}},\"jobPeriodCredits(address)\":{\"params\":{\"_job\":\"The address of the job of which we want to know the period credits\"},\"returns\":{\"_periodCredits\":\"The credits the given job has at the current period\"}},\"jobs()\":{\"returns\":{\"_list\":\"Array with all the jobs in _jobs\"}},\"keepers()\":{\"returns\":{\"_list\":\"Array with all the keepers in _keepers\"}},\"migrateJob(address,address)\":{\"params\":{\"_fromJob\":\"The address of the job that is requesting to migrate\",\"_toJob\":\"The address at which the job is requesting to migrate\"}},\"observeLiquidity(address)\":{\"params\":{\"_liquidity\":\"The address of the liquidity pair being observed\"},\"returns\":{\"_tickCache\":\"The updated TickCache\"}},\"quoteLiquidity(address,uint256)\":{\"details\":\"_periodCredits = underlying KP3Rs for given liquidity amount * rewardPeriod / inflationPeriod\",\"params\":{\"_amount\":\"The amount of liquidity to provide\",\"_liquidity\":\"The address of the liquidity to provide\"},\"returns\":{\"_periodCredits\":\"The amount of KP3R periodically minted for the given liquidity\"}},\"resolve(address)\":{\"params\":{\"_jobOrKeeper\":\"The address cleared\"}},\"revoke(address)\":{\"params\":{\"_keeper\":\"The address being slashed\"}},\"revokeLiquidity(address)\":{\"params\":{\"_liquidity\":\"The liquidity no longer accepted\"}},\"sendDust(address,uint256,address)\":{\"params\":{\"_amount\":\"The amont of the token that will be transferred\",\"_to\":\"The address that will receive the idle funds\",\"_token\":\"The token that will be transferred\"}},\"setBondTime(uint256)\":{\"params\":{\"_bond\":\"The new bond time\"}},\"setFee(uint256)\":{\"params\":{\"_fee\":\"The new fee\"}},\"setInflationPeriod(uint256)\":{\"params\":{\"_inflationPeriod\":\"The new inflation period\"}},\"setKeep3rHelper(address)\":{\"params\":{\"_keep3rHelper\":\"The Keep3rHelper address\"}},\"setKeep3rV1(address)\":{\"params\":{\"_keep3rV1\":\"The Keep3rV1 address\"}},\"setKeep3rV1Proxy(address)\":{\"params\":{\"_keep3rV1Proxy\":\"The Keep3rV1Proxy address\"}},\"setLiquidityMinimum(uint256)\":{\"params\":{\"_liquidityMinimum\":\"The new minimum amount of liquidity\"}},\"setPendingGovernor(address)\":{\"params\":{\"_pendingGovernor\":\"Address of the proposed new governor\"}},\"setRewardPeriodTime(uint256)\":{\"params\":{\"_rewardPeriodTime\":\"The new amount of time required to pass between rewards\"}},\"setUnbondTime(uint256)\":{\"params\":{\"_unbond\":\"The new unbond time\"}},\"slash(address,address,uint256,uint256)\":{\"params\":{\"_bondAmount\":\"The bonded amount being slashed\",\"_bonded\":\"The asset being slashed\",\"_keeper\":\"The address being slashed\",\"_unbondAmount\":\"The pending unbond amount being slashed\"}},\"slashLiquidityFromJob(address,address,uint256)\":{\"params\":{\"_amount\":\"The amount of liquidity that will be slashed\",\"_job\":\"The address being slashed\",\"_liquidity\":\"The address of the liquidity that will be slashed\"}},\"slashTokenFromJob(address,address,uint256)\":{\"params\":{\"_amount\":\"The amount of the token that will be slashed\",\"_job\":\"The address of the job from which the token will be slashed\",\"_token\":\"The address of the token that will be slashed\"}},\"totalJobCredits(address)\":{\"params\":{\"_job\":\"The address of the job of which we want to know the total credits\"},\"returns\":{\"_credits\":\"The total credits of the given job\"}},\"unbond(address,uint256)\":{\"params\":{\"_amount\":\"Allows for partial unbonding\",\"_bonding\":\"The asset being unbonded\"}},\"unbondLiquidityFromJob(address,address,uint256)\":{\"details\":\"Can only be called by the job's owner\",\"params\":{\"_amount\":\"The amount of liquidity being removed\",\"_job\":\"The address of the job being unbonded from\",\"_liquidity\":\"The liquidity being unbonded\"}},\"withdraw(address)\":{\"params\":{\"_bonding\":\"The asset to withdraw from the bonding pool\"}},\"withdrawLiquidityFromJob(address,address,address)\":{\"params\":{\"_job\":\"The address of the job being withdrawn from\",\"_liquidity\":\"The liquidity being withdrawn\",\"_receiver\":\"The address that will receive the withdrawn liquidity\"}},\"withdrawTokenCreditsFromJob(address,address,uint256,address)\":{\"params\":{\"_amount\":\"The amount of token to be withdrawn\",\"_job\":\"The address of the job from which the credits are withdrawn\",\"_receiver\":\"The user that will receive tokens\",\"_token\":\"The address of the token being withdrawn\"}},\"worked(address)\":{\"details\":\"Automatically calculates the payment for the keeper and pays the keeper with bonded KP3R\",\"params\":{\"_keeper\":\"Address of the keeper that performed the work\"}}},\"version\":1},\"userdoc\":{\"errors\":{\"AlreadyAJob()\":[{\"notice\":\"Throws when the address that is trying to register as a job is already a job\"}],\"AlreadyAKeeper()\":[{\"notice\":\"Throws when the address that is trying to register as a keeper is already a keeper\"}],\"AlreadyDisputed()\":[{\"notice\":\"Throws when a job or keeper is already disputed\"}],\"BondsLocked()\":[{\"notice\":\"Throws if the time required to bond an asset has not passed yet\"}],\"BondsUnexistent()\":[{\"notice\":\"Throws if there are no bonded assets\"}],\"Disputed()\":[{\"notice\":\"Throws if either a job or a keeper is disputed\"}],\"DisputerExistent()\":[{\"notice\":\"Throws if the address is already a registered disputer\"}],\"DisputerUnexistent()\":[{\"notice\":\"Throws if caller is not a registered disputer\"}],\"GasNotInitialized()\":[{\"notice\":\"Throws if work method was called without calling isKeeper or isBondedKeeper\"}],\"InsufficientFunds()\":[{\"notice\":\"Throws if the amount of funds in the job is less than the payment that must be paid to the keeper that works that job\"}],\"InsufficientJobTokenCredits()\":[{\"notice\":\"Throws when the user tries to withdraw more tokens than it has\"}],\"InvalidAddress()\":[{\"notice\":\"Thrown if an address is invalid\"}],\"InvalidAmount()\":[{\"notice\":\"Thrown if an amount is invalid\"}],\"JobAlreadyAdded()\":[{\"notice\":\"Throws when trying to add a job that has already been added\"}],\"JobDisputed()\":[{\"notice\":\"Throws when an action that requires an undisputed job is applied on a disputed job\"}],\"JobLiquidityInsufficient()\":[{\"notice\":\"Throws when trying to remove more liquidity than the job has\"}],\"JobLiquidityLessThanMin()\":[{\"notice\":\"Throws when trying to add less liquidity than the minimum liquidity required\"}],\"JobLiquidityUnexistent()\":[{\"notice\":\"Throws when the job doesn't have the requested liquidity\"}],\"JobMigrationImpossible()\":[{\"notice\":\"Throws when the address of the job that requests to migrate wants to migrate to its same address\"}],\"JobMigrationLocked()\":[{\"notice\":\"Throws when cooldown between migrations has not yet passed\"}],\"JobMigrationUnavailable()\":[{\"notice\":\"Throws when the _toJob address differs from the address being tracked in the pendingJobMigrations mapping\"}],\"JobTokenCreditsLocked()\":[{\"notice\":\"Throws when the token withdraw cooldown has not yet passed\"}],\"JobTokenInsufficient()\":[{\"notice\":\"Throws when someone tries to slash more tokens than the job has\"}],\"JobTokenUnexistent()\":[{\"notice\":\"Throws when the token trying to be slashed doesn't exist\"}],\"JobUnapproved()\":[{\"notice\":\"Throws if the address claiming to be a job is not in the list of approved jobs\"}],\"JobUnavailable()\":[{\"notice\":\"Throws when an address is passed as a job, but that address is not a job\"}],\"LengthMismatch()\":[{\"notice\":\"Thrown if the lengths of a set of lists mismatch\"}],\"LiquidityPairApproved()\":[{\"notice\":\"Throws when the liquidity being approved has already been approved\"}],\"LiquidityPairUnapproved()\":[{\"notice\":\"Throws when trying to add liquidity to an unapproved pool\"}],\"LiquidityPairUnexistent()\":[{\"notice\":\"Throws when the liquidity being removed has not been approved\"}],\"MinRewardPeriod()\":[{\"notice\":\"Throws if the reward period is less than the minimum reward period time\"}],\"NotDisputed()\":[{\"notice\":\"Throws when a job or keeper is not disputed and someone tries to resolve the dispute\"}],\"OnlyDisputer()\":[{\"notice\":\"Throws if the msg.sender is not a disputer or is not a part of governance\"}],\"OnlyGovernor()\":[{\"notice\":\"Thrown if a non-governor user tries to call a OnlyGovernor function\"}],\"OnlyJobOwner()\":[{\"notice\":\"Throws when the caller of the function is not the job owner\"}],\"OnlyPendingGovernor()\":[{\"notice\":\"Thrown if a non-pending-governor user tries to call a OnlyPendingGovernor function\"}],\"OnlyPendingJobOwner()\":[{\"notice\":\"Throws when the caller of the function is not the pending job owner\"}],\"OnlySlasher()\":[{\"notice\":\"Throws if the msg.sender is not a slasher or is not a part of governance\"}],\"SlasherExistent()\":[{\"notice\":\"Throws if the address is already a registered slasher\"}],\"SlasherUnexistent()\":[{\"notice\":\"Throws if caller is not a registered slasher\"}],\"TokenUnallowed()\":[{\"notice\":\"Throws when the token is KP3R, as it should not be used for direct token payments\"}],\"UnbondsLocked()\":[{\"notice\":\"Throws if the time required to withdraw the bonds has not passed yet\"}],\"UnbondsUnexistent()\":[{\"notice\":\"Throws if there are no bonds to withdraw\"}],\"ZeroAddress()\":[{\"notice\":\"Thrown if an address is the zero address\"}],\"ZeroAmount()\":[{\"notice\":\"Thrown if an amount is zero\"}]},\"events\":{\"Activation(address,address,uint256)\":{\"notice\":\"Emitted when Keep3rKeeperFundable#activate is called\"},\"BondTimeChange(uint256)\":{\"notice\":\"Emitted when bondTime is changed\"},\"Bonding(address,address,uint256)\":{\"notice\":\"Emitted when the bonding process of a new keeper begins\"},\"Dispute(address,address)\":{\"notice\":\"Emitted when a keeper or a job is disputed\"},\"DisputerAdded(address)\":{\"notice\":\"Emitted when a disputer is added\"},\"DisputerRemoved(address)\":{\"notice\":\"Emitted when a disputer is removed\"},\"DustSent(address,uint256,address)\":{\"notice\":\"Emitted when dust is sent\"},\"FeeChange(uint256)\":{\"notice\":\"Emitted when the fee is changed\"},\"InflationPeriodChange(uint256)\":{\"notice\":\"Emitted when the inflationPeriod is changed\"},\"JobAddition(address,address)\":{\"notice\":\"Emitted when Keep3rJobManager#addJob is called\"},\"JobMigrationRequested(address,address)\":{\"notice\":\"Emitted when Keep3rJobMigration#migrateJob function is called\"},\"JobMigrationSuccessful(address,address)\":{\"notice\":\"Emitted when Keep3rJobMigration#acceptJobMigration function is called\"},\"JobOwnershipAssent(address,address,address)\":{\"notice\":\"Emitted when Keep3rJobOwnership#JobOwnershipAssent is called\"},\"JobOwnershipChange(address,address,address)\":{\"notice\":\"Emitted when Keep3rJobOwnership#changeJobOwnership is called\"},\"JobSlashLiquidity(address,address,address,uint256)\":{\"notice\":\"Emitted when Keep3rJobDisputable#slashLiquidityFromJob is called\"},\"JobSlashToken(address,address,address,uint256)\":{\"notice\":\"Emitted when Keep3rJobDisputable#slashTokenFromJob is called\"},\"Keep3rHelperChange(address)\":{\"notice\":\"Emitted when the Keep3rHelper address is changed\"},\"Keep3rV1Change(address)\":{\"notice\":\"Emitted when the Keep3rV1 address is changed\"},\"Keep3rV1ProxyChange(address)\":{\"notice\":\"Emitted when the Keep3rV1Proxy address is changed\"},\"KeeperRevoke(address,address)\":{\"notice\":\"Emitted when Keep3rKeeperDisputable#revoke is called\"},\"KeeperSlash(address,address,uint256)\":{\"notice\":\"Emitted when Keep3rKeeperDisputable#slash is called\"},\"KeeperValidation(uint256)\":{\"notice\":\"Emitted when a keeper is validated before a job\"},\"KeeperWork(address,address,address,uint256,uint256)\":{\"notice\":\"Emitted when a keeper works a job\"},\"LiquidityAddition(address,address,address,uint256)\":{\"notice\":\"Emitted when IKeep3rJobFundableLiquidity#addLiquidityToJob function is called\"},\"LiquidityApproval(address)\":{\"notice\":\"Emitted when Keep3rJobFundableLiquidity#approveLiquidity function is called\"},\"LiquidityCreditsForced(address,uint256,uint256)\":{\"notice\":\"Emitted when Keep3rJobFundableLiquidity#forceLiquidityCreditsToJob function is called\"},\"LiquidityCreditsReward(address,uint256,uint256,uint256)\":{\"notice\":\"Emitted when Keep3rJobFundableLiquidity#addLiquidityToJob function is called\"},\"LiquidityMinimumChange(uint256)\":{\"notice\":\"Emitted when _liquidityMinimum is changed\"},\"LiquidityRevocation(address)\":{\"notice\":\"Emitted when Keep3rJobFundableLiquidity#revokeLiquidity function is called\"},\"LiquidityWithdrawal(address,address,address,uint256)\":{\"notice\":\"Emitted when IKeep3rJobFundableLiquidity#withdrawLiquidityFromJob function is called\"},\"PendingGovernorAccepted(address)\":{\"notice\":\"Emitted when a new governor is set\"},\"PendingGovernorSet(address,address)\":{\"notice\":\"Emitted when a new pending governor is set\"},\"Resolve(address,address)\":{\"notice\":\"Emitted when a dispute is resolved\"},\"RewardPeriodTimeChange(uint256)\":{\"notice\":\"Emitted when _rewardPeriodTime is changed\"},\"SlasherAdded(address)\":{\"notice\":\"Emitted when a slasher is added\"},\"SlasherRemoved(address)\":{\"notice\":\"Emitted when a slasher is removed\"},\"TokenCreditAddition(address,address,address,uint256)\":{\"notice\":\"Emitted when Keep3rJobFundableCredits#addTokenCreditsToJob is called\"},\"TokenCreditWithdrawal(address,address,address,uint256)\":{\"notice\":\"Emitted when Keep3rJobFundableCredits#withdrawTokenCreditsFromJob is called\"},\"UnbondTimeChange(uint256)\":{\"notice\":\"Emitted when _unbondTime is changed\"},\"Unbonding(address,address,uint256)\":{\"notice\":\"Emitted when a keeper or job begins the unbonding process to withdraw the funds\"},\"Withdrawal(address,address,uint256)\":{\"notice\":\"Emitted when Keep3rKeeperFundable#withdraw is called\"}},\"kind\":\"user\",\"methods\":{\"acceptJobMigration(address,address)\":{\"notice\":\"Completes the migration process for a job\"},\"acceptJobOwnership(address)\":{\"notice\":\"The proposed address accepts to be the owner of the job\"},\"acceptPendingGovernor()\":{\"notice\":\"Allows a proposed governor to accept the governance\"},\"activate(address)\":{\"notice\":\"End of the bonding process after bonding time has passed\"},\"addDisputer(address)\":{\"notice\":\"Registers a disputer by updating the disputers mapping\"},\"addJob(address)\":{\"notice\":\"Allows any caller to add a new job\"},\"addLiquidityToJob(address,address,uint256)\":{\"notice\":\"Allows anyone to fund a job with liquidity\"},\"addSlasher(address)\":{\"notice\":\"Registers a slasher by updating the slashers mapping\"},\"addTokenCreditsToJob(address,address,uint256)\":{\"notice\":\"Add credit to a job to be paid out for work\"},\"approveLiquidity(address)\":{\"notice\":\"Approve a liquidity pair for being accepted in future\"},\"approvedLiquidities()\":{\"notice\":\"Lists liquidity pairs\"},\"bond(address,uint256)\":{\"notice\":\"Beginning of the bonding process\"},\"bondTime()\":{\"notice\":\"The amount of time required to pass after a keeper has bonded assets for it to be able to activate\"},\"bondedPayment(address,uint256)\":{\"notice\":\"Implemented by jobs to show that a keeper performed work\"},\"bonds(address,address)\":{\"notice\":\"Mapping (job => bonding => amount)\"},\"canActivateAfter(address,address)\":{\"notice\":\"Tracks when a bonding for a keeper can be activated\"},\"canWithdrawAfter(address,address)\":{\"notice\":\"Tracks when keeper bonds are ready to be withdrawn\"},\"changeJobOwnership(address,address)\":{\"notice\":\"Proposes a new address to be the owner of the job\"},\"directTokenPayment(address,address,uint256)\":{\"notice\":\"Implemented by jobs to show that a keeper performed work\"},\"dispute(address)\":{\"notice\":\"Allows governor to create a dispute for a given keeper/job\"},\"disputers(address)\":{\"notice\":\"Tracks whether the address is a disputer or not\"},\"disputes(address)\":{\"notice\":\"Tracks if a keeper or job has a pending dispute\"},\"fee()\":{\"notice\":\"The fee to be sent to governor when a user adds liquidity to a job\"},\"firstSeen(address)\":{\"notice\":\"Tracks when a keeper was first registered\"},\"forceLiquidityCreditsToJob(address,uint256)\":{\"notice\":\"Gifts liquidity credits to the specified job\"},\"hasBonded(address)\":{\"notice\":\"Checks whether the address has ever bonded an asset\"},\"inflationPeriod()\":{\"notice\":\"The inflation period is the denominator used to regulate the emission of KP3R\"},\"isBondedKeeper(address,address,uint256,uint256,uint256)\":{\"notice\":\"Confirms if the current keeper is registered and has a minimum bond of any asset.\"},\"isKeeper(address)\":{\"notice\":\"Confirms if the current keeper is registered\"},\"jobLiquidityCredits(address)\":{\"notice\":\"Returns the liquidity credits of a given job\"},\"jobOwner(address)\":{\"notice\":\"Maps the job to the owner of the job\"},\"jobPendingOwner(address)\":{\"notice\":\"Maps the job to its pending owner\"},\"jobPeriodCredits(address)\":{\"notice\":\"Returns the credits of a given job for the current period\"},\"jobTokenCredits(address,address)\":{\"notice\":\"The current token credits available for a job\"},\"jobTokenCreditsAddedAt(address,address)\":{\"notice\":\"Last block where tokens were added to the job\"},\"jobs()\":{\"notice\":\"Lists all jobs\"},\"keep3rHelper()\":{\"notice\":\"Address of Keep3rHelper's contract\"},\"keep3rV1()\":{\"notice\":\"Address of Keep3rV1's contract\"},\"keep3rV1Proxy()\":{\"notice\":\"Address of Keep3rV1Proxy's contract\"},\"keepers()\":{\"notice\":\"Lists all keepers\"},\"liquidityAmount(address,address)\":{\"notice\":\"Amount of liquidity in a specified job\"},\"liquidityMinimum()\":{\"notice\":\"The minimum amount of liquidity required to fund a job per liquidity\"},\"migrateJob(address,address)\":{\"notice\":\"Initializes the migration process for a job by adding the request to the pendingJobMigrations mapping\"},\"observeLiquidity(address)\":{\"notice\":\"Observes the current state of the liquidity pair being observed and updates TickCache with the information\"},\"pendingBonds(address,address)\":{\"notice\":\"Tracks the amount of assets deposited in pending bonds\"},\"pendingJobMigrations(address)\":{\"notice\":\"Maps the jobs that have requested a migration to the address they have requested to migrate to\"},\"pendingUnbonds(address,address)\":{\"notice\":\"Tracks how much keeper bonds are to be withdrawn\"},\"quoteLiquidity(address,uint256)\":{\"notice\":\"Calculates how many credits should be rewarded periodically for a given liquidity amount\"},\"removeDisputer(address)\":{\"notice\":\"Removes a disputer by updating the disputers mapping\"},\"removeSlasher(address)\":{\"notice\":\"Removes a slasher by updating the slashers mapping\"},\"resolve(address)\":{\"notice\":\"Allows governor to resolve a dispute on a keeper/job\"},\"revoke(address)\":{\"notice\":\"Blacklists a keeper from participating in the network\"},\"revokeLiquidity(address)\":{\"notice\":\"Revoke a liquidity pair from being accepted in future\"},\"rewardPeriodTime()\":{\"notice\":\"The amount of time between each scheduled credits reward given to a job\"},\"rewardedAt(address)\":{\"notice\":\"Last time the job was rewarded liquidity credits\"},\"sendDust(address,uint256,address)\":{\"notice\":\"Allows an authorized user to transfer the tokens or eth that may have been left in a contract\"},\"setBondTime(uint256)\":{\"notice\":\"Sets the bond time required to activate as a keeper\"},\"setFee(uint256)\":{\"notice\":\"Sets the new fee\"},\"setInflationPeriod(uint256)\":{\"notice\":\"Sets the new inflation period\"},\"setKeep3rHelper(address)\":{\"notice\":\"Sets the Keep3rHelper address\"},\"setKeep3rV1(address)\":{\"notice\":\"Sets the Keep3rV1 address\"},\"setKeep3rV1Proxy(address)\":{\"notice\":\"Sets the Keep3rV1Proxy address\"},\"setLiquidityMinimum(uint256)\":{\"notice\":\"Sets the minimum amount of liquidity required to fund a job\"},\"setPendingGovernor(address)\":{\"notice\":\"Allows a governor to propose a new governor\"},\"setRewardPeriodTime(uint256)\":{\"notice\":\"Sets the time required to pass between rewards for jobs\"},\"setUnbondTime(uint256)\":{\"notice\":\"Sets the unbond time required unbond what has been bonded\"},\"slash(address,address,uint256,uint256)\":{\"notice\":\"Allows governor to slash a keeper based on a dispute\"},\"slashLiquidityFromJob(address,address,uint256)\":{\"notice\":\"Allows governor or slasher to slash liquidity from a job\"},\"slashTokenFromJob(address,address,uint256)\":{\"notice\":\"Allows governor or slasher to slash a job specific token\"},\"slashers(address)\":{\"notice\":\"Tracks whether the address is a slasher or not\"},\"totalBonds()\":{\"notice\":\"Tracks the total amount of bonded KP3Rs in the contract\"},\"totalJobCredits(address)\":{\"notice\":\"Calculates the total credits of a given job\"},\"unbond(address,uint256)\":{\"notice\":\"Beginning of the unbonding process\"},\"unbondLiquidityFromJob(address,address,uint256)\":{\"notice\":\"Unbond liquidity for a job\"},\"unbondTime()\":{\"notice\":\"The amount of time required to pass before a keeper can unbond what he has bonded\"},\"withdraw(address)\":{\"notice\":\"Withdraw funds after unbonding has finished\"},\"withdrawLiquidityFromJob(address,address,address)\":{\"notice\":\"Withdraw liquidity from a job\"},\"withdrawTokenCreditsFromJob(address,address,uint256,address)\":{\"notice\":\"Withdraw credit from a job\"},\"workCompleted(address)\":{\"notice\":\"Tracks the total KP3R earnings of a keeper since it started working\"},\"worked(address)\":{\"notice\":\"Implemented by jobs to show that a keeper performed work\"},\"workedAt(address)\":{\"notice\":\"Last time the job was worked\"}},\"version\":1}},\"settings\":{\"compilationTarget\":{\"solidity/for-test/testnet/Keep3rForTestnet.sol\":\"Keep3rForTestnet\"},\"evmVersion\":\"london\",\"libraries\":{\":__CACHE_BREAKER__\":\"0x00000000d41867734bbee4c6863d9255b2b06ac1\"},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":200},\"remappings\":[]},\"sources\":{\"@defi-wonderland/solidity-utils/solidity/contracts/DustCollector.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.8 <0.9.0;\\n\\nimport {Governable} from './Governable.sol';\\nimport {IDustCollector} from '../interfaces/IDustCollector.sol';\\nimport {IERC20} from '@openzeppelin/contracts/token/ERC20/IERC20.sol';\\nimport {SafeERC20} from '@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol';\\n\\n/// @title DustCollector contract\\nabstract contract DustCollector is IDustCollector, Governable {\\n using SafeERC20 for IERC20;\\n\\n /// @inheritdoc IDustCollector\\n address public constant ETH_ADDRESS = 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE;\\n\\n /// @inheritdoc IDustCollector\\n function sendDust(address _token, uint256 _amount, address _to) external onlyGovernor {\\n if (_to == address(0)) revert ZeroAddress();\\n if (_token == ETH_ADDRESS) payable(_to).transfer(_amount);\\n else IERC20(_token).safeTransfer(_to, _amount);\\n emit DustSent(_token, _amount, _to);\\n }\\n}\\n\",\"keccak256\":\"0xcdd6d0715406facd602770cca9320eebdc2b7b23b0e0f9e1b7b576fbc0126b47\",\"license\":\"MIT\"},\"@defi-wonderland/solidity-utils/solidity/contracts/Governable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.8 <0.9.0;\\n\\nimport {IGovernable} from '../interfaces/IGovernable.sol';\\n\\n/// @title Governable contract\\n/// @notice Manages the governor role\\nabstract contract Governable is IGovernable {\\n /// @inheritdoc IGovernable\\n address public governor;\\n\\n /// @inheritdoc IGovernable\\n address public pendingGovernor;\\n\\n constructor(address _governor) {\\n if (_governor == address(0)) revert ZeroAddress();\\n governor = _governor;\\n }\\n\\n /// @inheritdoc IGovernable\\n function setPendingGovernor(address _pendingGovernor) external onlyGovernor {\\n _setPendingGovernor(_pendingGovernor);\\n }\\n\\n /// @inheritdoc IGovernable\\n function acceptPendingGovernor() external onlyPendingGovernor {\\n _acceptPendingGovernor();\\n }\\n\\n function _setPendingGovernor(address _pendingGovernor) internal {\\n if (_pendingGovernor == address(0)) revert ZeroAddress();\\n pendingGovernor = _pendingGovernor;\\n emit PendingGovernorSet(governor, _pendingGovernor);\\n }\\n\\n function _acceptPendingGovernor() internal {\\n governor = pendingGovernor;\\n delete pendingGovernor;\\n emit PendingGovernorAccepted(governor);\\n }\\n\\n /// @notice Functions with this modifier can only be called by governor\\n modifier onlyGovernor() {\\n if (msg.sender != governor) revert OnlyGovernor();\\n _;\\n }\\n\\n /// @notice Functions with this modifier can only be called by pendingGovernor\\n modifier onlyPendingGovernor() {\\n if (msg.sender != pendingGovernor) revert OnlyPendingGovernor();\\n _;\\n }\\n}\\n\",\"keccak256\":\"0x3f11408cfcb015a99dc417e075c8ebc39b796fc2adc3e81b036487e4486881b3\",\"license\":\"MIT\"},\"@defi-wonderland/solidity-utils/solidity/interfaces/IBaseErrors.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.8 <0.9.0;\\n\\ninterface IBaseErrors {\\n /// @notice Thrown if an address is invalid\\n error InvalidAddress();\\n\\n /// @notice Thrown if an amount is invalid\\n error InvalidAmount();\\n\\n /// @notice Thrown if the lengths of a set of lists mismatch\\n error LengthMismatch();\\n\\n /// @notice Thrown if an address is the zero address\\n error ZeroAddress();\\n\\n /// @notice Thrown if an amount is zero\\n error ZeroAmount();\\n}\\n\",\"keccak256\":\"0xec09b9d248b6fbf6343dee41d6978abdc15d4c8df5ed7721e8df79e8b1a558cf\",\"license\":\"MIT\"},\"@defi-wonderland/solidity-utils/solidity/interfaces/IDustCollector.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.8 <0.9.0;\\n\\nimport {IGovernable} from './IGovernable.sol';\\nimport {IBaseErrors} from './IBaseErrors.sol';\\n\\n/// @title DustCollector interface\\ninterface IDustCollector is IBaseErrors, IGovernable {\\n // STATE VARIABLES\\n\\n /// @return _ethAddress Address used to trigger a native token transfer\\n // solhint-disable-next-line func-name-mixedcase\\n function ETH_ADDRESS() external view returns (address _ethAddress);\\n\\n // EVENTS\\n\\n /// @notice Emitted when dust is sent\\n /// @param _to The address which wil received the funds\\n /// @param _token The token that will be transferred\\n /// @param _amount The amount of the token that will be transferred\\n event DustSent(address _token, uint256 _amount, address _to);\\n\\n // FUNCTIONS\\n\\n /// @notice Allows an authorized user to transfer the tokens or eth that may have been left in a contract\\n /// @param _token The token that will be transferred\\n /// @param _amount The amont of the token that will be transferred\\n /// @param _to The address that will receive the idle funds\\n function sendDust(address _token, uint256 _amount, address _to) external;\\n}\\n\",\"keccak256\":\"0xbe22cc660bd6846093504989146038bd369f511325cef40cdc647fe7e04206b1\",\"license\":\"MIT\"},\"@defi-wonderland/solidity-utils/solidity/interfaces/IGovernable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.8 <0.9.0;\\n\\nimport {IBaseErrors} from './IBaseErrors.sol';\\n\\n/// @title Governable interface\\ninterface IGovernable is IBaseErrors {\\n // STATE VARIABLES\\n\\n /// @return _governor Address of the current governor\\n function governor() external view returns (address _governor);\\n\\n /// @return _pendingGovernor Address of the current pending governor\\n function pendingGovernor() external view returns (address _pendingGovernor);\\n\\n // EVENTS\\n\\n /// @notice Emitted when a new pending governor is set\\n /// @param _governor Address of the current governor\\n /// @param _pendingGovernor Address of the proposed next governor\\n event PendingGovernorSet(address _governor, address _pendingGovernor);\\n\\n /// @notice Emitted when a new governor is set\\n /// @param _newGovernor Address of the new governor\\n event PendingGovernorAccepted(address _newGovernor);\\n\\n // ERRORS\\n\\n /// @notice Thrown if a non-governor user tries to call a OnlyGovernor function\\n error OnlyGovernor();\\n\\n /// @notice Thrown if a non-pending-governor user tries to call a OnlyPendingGovernor function\\n error OnlyPendingGovernor();\\n\\n // FUNCTIONS\\n\\n /// @notice Allows a governor to propose a new governor\\n /// @param _pendingGovernor Address of the proposed new governor\\n function setPendingGovernor(address _pendingGovernor) external;\\n\\n /// @notice Allows a proposed governor to accept the governance\\n function acceptPendingGovernor() external;\\n}\\n\",\"keccak256\":\"0x40b94706a00d2c092f620807ba84bdd0c5ed8cfa60140c924edc850427e0af13\",\"license\":\"MIT\"},\"@openzeppelin/contracts/security/ReentrancyGuard.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Contract module that helps prevent reentrant calls to a function.\\n *\\n * Inheriting from `ReentrancyGuard` will make the {nonReentrant} modifier\\n * available, which can be applied to functions to make sure there are no nested\\n * (reentrant) calls to them.\\n *\\n * Note that because there is a single `nonReentrant` guard, functions marked as\\n * `nonReentrant` may not call one another. This can be worked around by making\\n * those functions `private`, and then adding `external` `nonReentrant` entry\\n * points to them.\\n *\\n * TIP: If you would like to learn more about reentrancy and alternative ways\\n * to protect against it, check out our blog post\\n * https://blog.openzeppelin.com/reentrancy-after-istanbul/[Reentrancy After Istanbul].\\n */\\nabstract contract ReentrancyGuard {\\n // Booleans are more expensive than uint256 or any type that takes up a full\\n // word because each write operation emits an extra SLOAD to first read the\\n // slot's contents, replace the bits taken up by the boolean, and then write\\n // back. This is the compiler's defense against contract upgrades and\\n // pointer aliasing, and it cannot be disabled.\\n\\n // The values being non-zero value makes deployment a bit more expensive,\\n // but in exchange the refund on every call to nonReentrant will be lower in\\n // amount. Since refunds are capped to a percentage of the total\\n // transaction's gas, it is best to keep them low in cases like this one, to\\n // increase the likelihood of the full refund coming into effect.\\n uint256 private constant _NOT_ENTERED = 1;\\n uint256 private constant _ENTERED = 2;\\n\\n uint256 private _status;\\n\\n constructor() {\\n _status = _NOT_ENTERED;\\n }\\n\\n /**\\n * @dev Prevents a contract from calling itself, directly or indirectly.\\n * Calling a `nonReentrant` function from another `nonReentrant`\\n * function is not supported. It is possible to prevent this from happening\\n * by making the `nonReentrant` function external, and make it call a\\n * `private` function that does the actual work.\\n */\\n modifier nonReentrant() {\\n // On the first call to nonReentrant, _notEntered will be true\\n require(_status != _ENTERED, \\\"ReentrancyGuard: reentrant call\\\");\\n\\n // Any calls to nonReentrant after this point will fail\\n _status = _ENTERED;\\n\\n _;\\n\\n // By storing the original value once again, a refund is triggered (see\\n // https://eips.ethereum.org/EIPS/eip-2200)\\n _status = _NOT_ENTERED;\\n }\\n}\\n\",\"keccak256\":\"0x842ccf9a6cd33e17b7acef8372ca42090755217b358fe0c44c98e951ea549d3a\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC20/IERC20.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Interface of the ERC20 standard as defined in the EIP.\\n */\\ninterface IERC20 {\\n /**\\n * @dev Returns the amount of tokens in existence.\\n */\\n function totalSupply() external view returns (uint256);\\n\\n /**\\n * @dev Returns the amount of tokens owned by `account`.\\n */\\n function balanceOf(address account) external view returns (uint256);\\n\\n /**\\n * @dev Moves `amount` tokens from the caller's account to `recipient`.\\n *\\n * Returns a boolean value indicating whether the operation succeeded.\\n *\\n * Emits a {Transfer} event.\\n */\\n function transfer(address recipient, uint256 amount) external returns (bool);\\n\\n /**\\n * @dev Returns the remaining number of tokens that `spender` will be\\n * allowed to spend on behalf of `owner` through {transferFrom}. This is\\n * zero by default.\\n *\\n * This value changes when {approve} or {transferFrom} are called.\\n */\\n function allowance(address owner, address spender) external view returns (uint256);\\n\\n /**\\n * @dev Sets `amount` as the allowance of `spender` over the caller's tokens.\\n *\\n * Returns a boolean value indicating whether the operation succeeded.\\n *\\n * IMPORTANT: Beware that changing an allowance with this method brings the risk\\n * that someone may use both the old and the new allowance by unfortunate\\n * transaction ordering. One possible solution to mitigate this race\\n * condition is to first reduce the spender's allowance to 0 and set the\\n * desired value afterwards:\\n * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729\\n *\\n * Emits an {Approval} event.\\n */\\n function approve(address spender, uint256 amount) external returns (bool);\\n\\n /**\\n * @dev Moves `amount` tokens from `sender` to `recipient` using the\\n * allowance mechanism. `amount` is then deducted from the caller's\\n * allowance.\\n *\\n * Returns a boolean value indicating whether the operation succeeded.\\n *\\n * Emits a {Transfer} event.\\n */\\n function transferFrom(\\n address sender,\\n address recipient,\\n uint256 amount\\n ) external returns (bool);\\n\\n /**\\n * @dev Emitted when `value` tokens are moved from one account (`from`) to\\n * another (`to`).\\n *\\n * Note that `value` may be zero.\\n */\\n event Transfer(address indexed from, address indexed to, uint256 value);\\n\\n /**\\n * @dev Emitted when the allowance of a `spender` for an `owner` is set by\\n * a call to {approve}. `value` is the new allowance.\\n */\\n event Approval(address indexed owner, address indexed spender, uint256 value);\\n}\\n\",\"keccak256\":\"0x027b891937d20ccf213fdb9c31531574256de774bda99d3a70ecef6e1913ed2a\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../IERC20.sol\\\";\\n\\n/**\\n * @dev Interface for the optional metadata functions from the ERC20 standard.\\n *\\n * _Available since v4.1._\\n */\\ninterface IERC20Metadata is IERC20 {\\n /**\\n * @dev Returns the name of the token.\\n */\\n function name() external view returns (string memory);\\n\\n /**\\n * @dev Returns the symbol of the token.\\n */\\n function symbol() external view returns (string memory);\\n\\n /**\\n * @dev Returns the decimals places of the token.\\n */\\n function decimals() external view returns (uint8);\\n}\\n\",\"keccak256\":\"0x83fe24f5c04a56091e50f4a345ff504c8bff658a76d4c43b16878c8f940c53b2\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../IERC20.sol\\\";\\nimport \\\"../../../utils/Address.sol\\\";\\n\\n/**\\n * @title SafeERC20\\n * @dev Wrappers around ERC20 operations that throw on failure (when the token\\n * contract returns false). Tokens that return no value (and instead revert or\\n * throw on failure) are also supported, non-reverting calls are assumed to be\\n * successful.\\n * To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract,\\n * which allows you to call the safe operations as `token.safeTransfer(...)`, etc.\\n */\\nlibrary SafeERC20 {\\n using Address for address;\\n\\n function safeTransfer(\\n IERC20 token,\\n address to,\\n uint256 value\\n ) internal {\\n _callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value));\\n }\\n\\n function safeTransferFrom(\\n IERC20 token,\\n address from,\\n address to,\\n uint256 value\\n ) internal {\\n _callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value));\\n }\\n\\n /**\\n * @dev Deprecated. This function has issues similar to the ones found in\\n * {IERC20-approve}, and its usage is discouraged.\\n *\\n * Whenever possible, use {safeIncreaseAllowance} and\\n * {safeDecreaseAllowance} instead.\\n */\\n function safeApprove(\\n IERC20 token,\\n address spender,\\n uint256 value\\n ) internal {\\n // safeApprove should only be called when setting an initial allowance,\\n // or when resetting it to zero. To increase and decrease it, use\\n // 'safeIncreaseAllowance' and 'safeDecreaseAllowance'\\n require(\\n (value == 0) || (token.allowance(address(this), spender) == 0),\\n \\\"SafeERC20: approve from non-zero to non-zero allowance\\\"\\n );\\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value));\\n }\\n\\n function safeIncreaseAllowance(\\n IERC20 token,\\n address spender,\\n uint256 value\\n ) internal {\\n uint256 newAllowance = token.allowance(address(this), spender) + value;\\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));\\n }\\n\\n function safeDecreaseAllowance(\\n IERC20 token,\\n address spender,\\n uint256 value\\n ) internal {\\n unchecked {\\n uint256 oldAllowance = token.allowance(address(this), spender);\\n require(oldAllowance >= value, \\\"SafeERC20: decreased allowance below zero\\\");\\n uint256 newAllowance = oldAllowance - value;\\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));\\n }\\n }\\n\\n /**\\n * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement\\n * on the return value: the return value is optional (but if data is returned, it must not be false).\\n * @param token The token targeted by the call.\\n * @param data The call data (encoded using abi.encode or one of its variants).\\n */\\n function _callOptionalReturn(IERC20 token, bytes memory data) private {\\n // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since\\n // we're implementing it ourselves. We use {Address.functionCall} to perform this call, which verifies that\\n // the target address contains contract code and also asserts for success in the low-level call.\\n\\n bytes memory returndata = address(token).functionCall(data, \\\"SafeERC20: low-level call failed\\\");\\n if (returndata.length > 0) {\\n // Return data is optional\\n require(abi.decode(returndata, (bool)), \\\"SafeERC20: ERC20 operation did not succeed\\\");\\n }\\n }\\n}\\n\",\"keccak256\":\"0x02348b2e4b9f3200c7e3907c5c2661643a6d8520e9f79939fbb9b4005a54894d\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/Address.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Collection of functions related to the address type\\n */\\nlibrary Address {\\n /**\\n * @dev Returns true if `account` is a contract.\\n *\\n * [IMPORTANT]\\n * ====\\n * It is unsafe to assume that an address for which this function returns\\n * false is an externally-owned account (EOA) and not a contract.\\n *\\n * Among others, `isContract` will return false for the following\\n * types of addresses:\\n *\\n * - an externally-owned account\\n * - a contract in construction\\n * - an address where a contract will be created\\n * - an address where a contract lived, but was destroyed\\n * ====\\n */\\n function isContract(address account) internal view returns (bool) {\\n // This method relies on extcodesize, which returns 0 for contracts in\\n // construction, since the code is only stored at the end of the\\n // constructor execution.\\n\\n uint256 size;\\n assembly {\\n size := extcodesize(account)\\n }\\n return size > 0;\\n }\\n\\n /**\\n * @dev Replacement for Solidity's `transfer`: sends `amount` wei to\\n * `recipient`, forwarding all available gas and reverting on errors.\\n *\\n * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost\\n * of certain opcodes, possibly making contracts go over the 2300 gas limit\\n * imposed by `transfer`, making them unable to receive funds via\\n * `transfer`. {sendValue} removes this limitation.\\n *\\n * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].\\n *\\n * IMPORTANT: because control is transferred to `recipient`, care must be\\n * taken to not create reentrancy vulnerabilities. Consider using\\n * {ReentrancyGuard} or the\\n * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].\\n */\\n function sendValue(address payable recipient, uint256 amount) internal {\\n require(address(this).balance >= amount, \\\"Address: insufficient balance\\\");\\n\\n (bool success, ) = recipient.call{value: amount}(\\\"\\\");\\n require(success, \\\"Address: unable to send value, recipient may have reverted\\\");\\n }\\n\\n /**\\n * @dev Performs a Solidity function call using a low level `call`. A\\n * plain `call` is an unsafe replacement for a function call: use this\\n * function instead.\\n *\\n * If `target` reverts with a revert reason, it is bubbled up by this\\n * function (like regular Solidity function calls).\\n *\\n * Returns the raw returned data. To convert to the expected return value,\\n * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\\n *\\n * Requirements:\\n *\\n * - `target` must be a contract.\\n * - calling `target` with `data` must not revert.\\n *\\n * _Available since v3.1._\\n */\\n function functionCall(address target, bytes memory data) internal returns (bytes memory) {\\n return functionCall(target, data, \\\"Address: low-level call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with\\n * `errorMessage` as a fallback revert reason when `target` reverts.\\n *\\n * _Available since v3.1._\\n */\\n function functionCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, 0, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but also transferring `value` wei to `target`.\\n *\\n * Requirements:\\n *\\n * - the calling contract must have an ETH balance of at least `value`.\\n * - the called Solidity function must be `payable`.\\n *\\n * _Available since v3.1._\\n */\\n function functionCallWithValue(\\n address target,\\n bytes memory data,\\n uint256 value\\n ) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, value, \\\"Address: low-level call with value failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but\\n * with `errorMessage` as a fallback revert reason when `target` reverts.\\n *\\n * _Available since v3.1._\\n */\\n function functionCallWithValue(\\n address target,\\n bytes memory data,\\n uint256 value,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n require(address(this).balance >= value, \\\"Address: insufficient balance for call\\\");\\n require(isContract(target), \\\"Address: call to non-contract\\\");\\n\\n (bool success, bytes memory returndata) = target.call{value: value}(data);\\n return verifyCallResult(success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but performing a static call.\\n *\\n * _Available since v3.3._\\n */\\n function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\\n return functionStaticCall(target, data, \\\"Address: low-level static call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\\n * but performing a static call.\\n *\\n * _Available since v3.3._\\n */\\n function functionStaticCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal view returns (bytes memory) {\\n require(isContract(target), \\\"Address: static call to non-contract\\\");\\n\\n (bool success, bytes memory returndata) = target.staticcall(data);\\n return verifyCallResult(success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but performing a delegate call.\\n *\\n * _Available since v3.4._\\n */\\n function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {\\n return functionDelegateCall(target, data, \\\"Address: low-level delegate call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\\n * but performing a delegate call.\\n *\\n * _Available since v3.4._\\n */\\n function functionDelegateCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n require(isContract(target), \\\"Address: delegate call to non-contract\\\");\\n\\n (bool success, bytes memory returndata) = target.delegatecall(data);\\n return verifyCallResult(success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the\\n * revert reason using the provided one.\\n *\\n * _Available since v4.3._\\n */\\n function verifyCallResult(\\n bool success,\\n bytes memory returndata,\\n string memory errorMessage\\n ) internal pure returns (bytes memory) {\\n if (success) {\\n return returndata;\\n } else {\\n // Look for revert reason and bubble it up if present\\n if (returndata.length > 0) {\\n // The easiest way to bubble the revert reason is using memory via assembly\\n\\n assembly {\\n let returndata_size := mload(returndata)\\n revert(add(32, returndata), returndata_size)\\n }\\n } else {\\n revert(errorMessage);\\n }\\n }\\n }\\n}\\n\",\"keccak256\":\"0x3336baae5cf23e94274d75336e2d412193be508504aee185e61dc7d58cd05c8a\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/math/Math.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Standard math utilities missing in the Solidity language.\\n */\\nlibrary Math {\\n /**\\n * @dev Returns the largest of two numbers.\\n */\\n function max(uint256 a, uint256 b) internal pure returns (uint256) {\\n return a >= b ? a : b;\\n }\\n\\n /**\\n * @dev Returns the smallest of two numbers.\\n */\\n function min(uint256 a, uint256 b) internal pure returns (uint256) {\\n return a < b ? a : b;\\n }\\n\\n /**\\n * @dev Returns the average of two numbers. The result is rounded towards\\n * zero.\\n */\\n function average(uint256 a, uint256 b) internal pure returns (uint256) {\\n // (a + b) / 2 can overflow.\\n return (a & b) + (a ^ b) / 2;\\n }\\n\\n /**\\n * @dev Returns the ceiling of the division of two numbers.\\n *\\n * This differs from standard division with `/` in that it rounds up instead\\n * of rounding down.\\n */\\n function ceilDiv(uint256 a, uint256 b) internal pure returns (uint256) {\\n // (a + b - 1) / b can overflow on addition, so we distribute.\\n return a / b + (a % b == 0 ? 0 : 1);\\n }\\n}\\n\",\"keccak256\":\"0x49ebdac5d515aebb95168564158940b79d7d5d12fbfe59cec546a00d57fee64a\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/structs/EnumerableSet.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Library for managing\\n * https://en.wikipedia.org/wiki/Set_(abstract_data_type)[sets] of primitive\\n * types.\\n *\\n * Sets have the following properties:\\n *\\n * - Elements are added, removed, and checked for existence in constant time\\n * (O(1)).\\n * - Elements are enumerated in O(n). No guarantees are made on the ordering.\\n *\\n * ```\\n * contract Example {\\n * // Add the library methods\\n * using EnumerableSet for EnumerableSet.AddressSet;\\n *\\n * // Declare a set state variable\\n * EnumerableSet.AddressSet private mySet;\\n * }\\n * ```\\n *\\n * As of v3.3.0, sets of type `bytes32` (`Bytes32Set`), `address` (`AddressSet`)\\n * and `uint256` (`UintSet`) are supported.\\n */\\nlibrary EnumerableSet {\\n // To implement this library for multiple types with as little code\\n // repetition as possible, we write it in terms of a generic Set type with\\n // bytes32 values.\\n // The Set implementation uses private functions, and user-facing\\n // implementations (such as AddressSet) are just wrappers around the\\n // underlying Set.\\n // This means that we can only create new EnumerableSets for types that fit\\n // in bytes32.\\n\\n struct Set {\\n // Storage of set values\\n bytes32[] _values;\\n // Position of the value in the `values` array, plus 1 because index 0\\n // means a value is not in the set.\\n mapping(bytes32 => uint256) _indexes;\\n }\\n\\n /**\\n * @dev Add a value to a set. O(1).\\n *\\n * Returns true if the value was added to the set, that is if it was not\\n * already present.\\n */\\n function _add(Set storage set, bytes32 value) private returns (bool) {\\n if (!_contains(set, value)) {\\n set._values.push(value);\\n // The value is stored at length-1, but we add 1 to all indexes\\n // and use 0 as a sentinel value\\n set._indexes[value] = set._values.length;\\n return true;\\n } else {\\n return false;\\n }\\n }\\n\\n /**\\n * @dev Removes a value from a set. O(1).\\n *\\n * Returns true if the value was removed from the set, that is if it was\\n * present.\\n */\\n function _remove(Set storage set, bytes32 value) private returns (bool) {\\n // We read and store the value's index to prevent multiple reads from the same storage slot\\n uint256 valueIndex = set._indexes[value];\\n\\n if (valueIndex != 0) {\\n // Equivalent to contains(set, value)\\n // To delete an element from the _values array in O(1), we swap the element to delete with the last one in\\n // the array, and then remove the last element (sometimes called as 'swap and pop').\\n // This modifies the order of the array, as noted in {at}.\\n\\n uint256 toDeleteIndex = valueIndex - 1;\\n uint256 lastIndex = set._values.length - 1;\\n\\n if (lastIndex != toDeleteIndex) {\\n bytes32 lastvalue = set._values[lastIndex];\\n\\n // Move the last value to the index where the value to delete is\\n set._values[toDeleteIndex] = lastvalue;\\n // Update the index for the moved value\\n set._indexes[lastvalue] = valueIndex; // Replace lastvalue's index to valueIndex\\n }\\n\\n // Delete the slot where the moved value was stored\\n set._values.pop();\\n\\n // Delete the index for the deleted slot\\n delete set._indexes[value];\\n\\n return true;\\n } else {\\n return false;\\n }\\n }\\n\\n /**\\n * @dev Returns true if the value is in the set. O(1).\\n */\\n function _contains(Set storage set, bytes32 value) private view returns (bool) {\\n return set._indexes[value] != 0;\\n }\\n\\n /**\\n * @dev Returns the number of values on the set. O(1).\\n */\\n function _length(Set storage set) private view returns (uint256) {\\n return set._values.length;\\n }\\n\\n /**\\n * @dev Returns the value stored at position `index` in the set. O(1).\\n *\\n * Note that there are no guarantees on the ordering of values inside the\\n * array, and it may change when more values are added or removed.\\n *\\n * Requirements:\\n *\\n * - `index` must be strictly less than {length}.\\n */\\n function _at(Set storage set, uint256 index) private view returns (bytes32) {\\n return set._values[index];\\n }\\n\\n /**\\n * @dev Return the entire set in an array\\n *\\n * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed\\n * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that\\n * this function has an unbounded cost, and using it as part of a state-changing function may render the function\\n * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.\\n */\\n function _values(Set storage set) private view returns (bytes32[] memory) {\\n return set._values;\\n }\\n\\n // Bytes32Set\\n\\n struct Bytes32Set {\\n Set _inner;\\n }\\n\\n /**\\n * @dev Add a value to a set. O(1).\\n *\\n * Returns true if the value was added to the set, that is if it was not\\n * already present.\\n */\\n function add(Bytes32Set storage set, bytes32 value) internal returns (bool) {\\n return _add(set._inner, value);\\n }\\n\\n /**\\n * @dev Removes a value from a set. O(1).\\n *\\n * Returns true if the value was removed from the set, that is if it was\\n * present.\\n */\\n function remove(Bytes32Set storage set, bytes32 value) internal returns (bool) {\\n return _remove(set._inner, value);\\n }\\n\\n /**\\n * @dev Returns true if the value is in the set. O(1).\\n */\\n function contains(Bytes32Set storage set, bytes32 value) internal view returns (bool) {\\n return _contains(set._inner, value);\\n }\\n\\n /**\\n * @dev Returns the number of values in the set. O(1).\\n */\\n function length(Bytes32Set storage set) internal view returns (uint256) {\\n return _length(set._inner);\\n }\\n\\n /**\\n * @dev Returns the value stored at position `index` in the set. O(1).\\n *\\n * Note that there are no guarantees on the ordering of values inside the\\n * array, and it may change when more values are added or removed.\\n *\\n * Requirements:\\n *\\n * - `index` must be strictly less than {length}.\\n */\\n function at(Bytes32Set storage set, uint256 index) internal view returns (bytes32) {\\n return _at(set._inner, index);\\n }\\n\\n /**\\n * @dev Return the entire set in an array\\n *\\n * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed\\n * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that\\n * this function has an unbounded cost, and using it as part of a state-changing function may render the function\\n * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.\\n */\\n function values(Bytes32Set storage set) internal view returns (bytes32[] memory) {\\n return _values(set._inner);\\n }\\n\\n // AddressSet\\n\\n struct AddressSet {\\n Set _inner;\\n }\\n\\n /**\\n * @dev Add a value to a set. O(1).\\n *\\n * Returns true if the value was added to the set, that is if it was not\\n * already present.\\n */\\n function add(AddressSet storage set, address value) internal returns (bool) {\\n return _add(set._inner, bytes32(uint256(uint160(value))));\\n }\\n\\n /**\\n * @dev Removes a value from a set. O(1).\\n *\\n * Returns true if the value was removed from the set, that is if it was\\n * present.\\n */\\n function remove(AddressSet storage set, address value) internal returns (bool) {\\n return _remove(set._inner, bytes32(uint256(uint160(value))));\\n }\\n\\n /**\\n * @dev Returns true if the value is in the set. O(1).\\n */\\n function contains(AddressSet storage set, address value) internal view returns (bool) {\\n return _contains(set._inner, bytes32(uint256(uint160(value))));\\n }\\n\\n /**\\n * @dev Returns the number of values in the set. O(1).\\n */\\n function length(AddressSet storage set) internal view returns (uint256) {\\n return _length(set._inner);\\n }\\n\\n /**\\n * @dev Returns the value stored at position `index` in the set. O(1).\\n *\\n * Note that there are no guarantees on the ordering of values inside the\\n * array, and it may change when more values are added or removed.\\n *\\n * Requirements:\\n *\\n * - `index` must be strictly less than {length}.\\n */\\n function at(AddressSet storage set, uint256 index) internal view returns (address) {\\n return address(uint160(uint256(_at(set._inner, index))));\\n }\\n\\n /**\\n * @dev Return the entire set in an array\\n *\\n * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed\\n * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that\\n * this function has an unbounded cost, and using it as part of a state-changing function may render the function\\n * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.\\n */\\n function values(AddressSet storage set) internal view returns (address[] memory) {\\n bytes32[] memory store = _values(set._inner);\\n address[] memory result;\\n\\n assembly {\\n result := store\\n }\\n\\n return result;\\n }\\n\\n // UintSet\\n\\n struct UintSet {\\n Set _inner;\\n }\\n\\n /**\\n * @dev Add a value to a set. O(1).\\n *\\n * Returns true if the value was added to the set, that is if it was not\\n * already present.\\n */\\n function add(UintSet storage set, uint256 value) internal returns (bool) {\\n return _add(set._inner, bytes32(value));\\n }\\n\\n /**\\n * @dev Removes a value from a set. O(1).\\n *\\n * Returns true if the value was removed from the set, that is if it was\\n * present.\\n */\\n function remove(UintSet storage set, uint256 value) internal returns (bool) {\\n return _remove(set._inner, bytes32(value));\\n }\\n\\n /**\\n * @dev Returns true if the value is in the set. O(1).\\n */\\n function contains(UintSet storage set, uint256 value) internal view returns (bool) {\\n return _contains(set._inner, bytes32(value));\\n }\\n\\n /**\\n * @dev Returns the number of values on the set. O(1).\\n */\\n function length(UintSet storage set) internal view returns (uint256) {\\n return _length(set._inner);\\n }\\n\\n /**\\n * @dev Returns the value stored at position `index` in the set. O(1).\\n *\\n * Note that there are no guarantees on the ordering of values inside the\\n * array, and it may change when more values are added or removed.\\n *\\n * Requirements:\\n *\\n * - `index` must be strictly less than {length}.\\n */\\n function at(UintSet storage set, uint256 index) internal view returns (uint256) {\\n return uint256(_at(set._inner, index));\\n }\\n\\n /**\\n * @dev Return the entire set in an array\\n *\\n * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed\\n * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that\\n * this function has an unbounded cost, and using it as part of a state-changing function may render the function\\n * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.\\n */\\n function values(UintSet storage set) internal view returns (uint256[] memory) {\\n bytes32[] memory store = _values(set._inner);\\n uint256[] memory result;\\n\\n assembly {\\n result := store\\n }\\n\\n return result;\\n }\\n}\\n\",\"keccak256\":\"0x3778dc944f4a696335878bad8beca60f38b7c79b7a0bd8ddbeb618bd502a95ae\",\"license\":\"MIT\"},\"solidity/contracts/Keep3r.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\n/*\\n\\nCoded for The Keep3r Network with \\u2665 by\\n\\n\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2557\\u2591\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2557\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2557\\u2588\\u2588\\u2557\\u2591\\u2591\\u2591\\u2588\\u2588\\u2557\\u2591\\u2591\\u2591\\u2591\\u2591\\u2591\\u2591\\u2588\\u2588\\u2557\\u2591\\u2588\\u2588\\u2588\\u2588\\u2588\\u2557\\u2591\\u2588\\u2588\\u2588\\u2557\\u2591\\u2591\\u2588\\u2588\\u2557\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2557\\u2591\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2557\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2557\\u2591\\u2588\\u2588\\u2557\\u2591\\u2591\\u2591\\u2591\\u2591\\u2591\\u2588\\u2588\\u2588\\u2588\\u2588\\u2557\\u2591\\u2588\\u2588\\u2588\\u2557\\u2591\\u2591\\u2588\\u2588\\u2557\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2557\\u2591\\n\\u2588\\u2588\\u2554\\u2550\\u2550\\u2588\\u2588\\u2557\\u2588\\u2588\\u2554\\u2550\\u2550\\u2550\\u2550\\u255d\\u2588\\u2588\\u2554\\u2550\\u2550\\u2550\\u2550\\u255d\\u2588\\u2588\\u2551\\u2591\\u2591\\u2591\\u2588\\u2588\\u2551\\u2591\\u2591\\u2588\\u2588\\u2557\\u2591\\u2591\\u2588\\u2588\\u2551\\u2588\\u2588\\u2554\\u2550\\u2550\\u2588\\u2588\\u2557\\u2588\\u2588\\u2588\\u2588\\u2557\\u2591\\u2588\\u2588\\u2551\\u2588\\u2588\\u2554\\u2550\\u2550\\u2588\\u2588\\u2557\\u2588\\u2588\\u2554\\u2550\\u2550\\u2550\\u2550\\u255d\\u2588\\u2588\\u2554\\u2550\\u2550\\u2588\\u2588\\u2557\\u2588\\u2588\\u2551\\u2591\\u2591\\u2591\\u2591\\u2591\\u2588\\u2588\\u2554\\u2550\\u2550\\u2588\\u2588\\u2557\\u2588\\u2588\\u2588\\u2588\\u2557\\u2591\\u2588\\u2588\\u2551\\u2588\\u2588\\u2554\\u2550\\u2550\\u2588\\u2588\\u2557\\n\\u2588\\u2588\\u2551\\u2591\\u2591\\u2588\\u2588\\u2551\\u2588\\u2588\\u2588\\u2588\\u2588\\u2557\\u2591\\u2591\\u2588\\u2588\\u2588\\u2588\\u2588\\u2557\\u2591\\u2591\\u2588\\u2588\\u2551\\u2591\\u2591\\u2591\\u255a\\u2588\\u2588\\u2557\\u2588\\u2588\\u2588\\u2588\\u2557\\u2588\\u2588\\u2554\\u255d\\u2588\\u2588\\u2551\\u2591\\u2591\\u2588\\u2588\\u2551\\u2588\\u2588\\u2554\\u2588\\u2588\\u2557\\u2588\\u2588\\u2551\\u2588\\u2588\\u2551\\u2591\\u2591\\u2588\\u2588\\u2551\\u2588\\u2588\\u2588\\u2588\\u2588\\u2557\\u2591\\u2591\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2554\\u255d\\u2588\\u2588\\u2551\\u2591\\u2591\\u2591\\u2591\\u2591\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2551\\u2588\\u2588\\u2554\\u2588\\u2588\\u2557\\u2588\\u2588\\u2551\\u2588\\u2588\\u2551\\u2591\\u2591\\u2588\\u2588\\u2551\\n\\u2588\\u2588\\u2551\\u2591\\u2591\\u2588\\u2588\\u2551\\u2588\\u2588\\u2554\\u2550\\u2550\\u255d\\u2591\\u2591\\u2588\\u2588\\u2554\\u2550\\u2550\\u255d\\u2591\\u2591\\u2588\\u2588\\u2551\\u2591\\u2591\\u2591\\u2591\\u2588\\u2588\\u2588\\u2588\\u2554\\u2550\\u2588\\u2588\\u2588\\u2588\\u2551\\u2591\\u2588\\u2588\\u2551\\u2591\\u2591\\u2588\\u2588\\u2551\\u2588\\u2588\\u2551\\u255a\\u2588\\u2588\\u2588\\u2588\\u2551\\u2588\\u2588\\u2551\\u2591\\u2591\\u2588\\u2588\\u2551\\u2588\\u2588\\u2554\\u2550\\u2550\\u255d\\u2591\\u2591\\u2588\\u2588\\u2554\\u2550\\u2550\\u2588\\u2588\\u2557\\u2588\\u2588\\u2551\\u2591\\u2591\\u2591\\u2591\\u2591\\u2588\\u2588\\u2554\\u2550\\u2550\\u2588\\u2588\\u2551\\u2588\\u2588\\u2551\\u255a\\u2588\\u2588\\u2588\\u2588\\u2551\\u2588\\u2588\\u2551\\u2591\\u2591\\u2588\\u2588\\u2551\\n\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2554\\u255d\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2557\\u2588\\u2588\\u2551\\u2591\\u2591\\u2591\\u2591\\u2591\\u2588\\u2588\\u2551\\u2591\\u2591\\u2591\\u2591\\u255a\\u2588\\u2588\\u2554\\u255d\\u2591\\u255a\\u2588\\u2588\\u2554\\u255d\\u2591\\u255a\\u2588\\u2588\\u2588\\u2588\\u2588\\u2554\\u255d\\u2588\\u2588\\u2551\\u2591\\u255a\\u2588\\u2588\\u2588\\u2551\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2554\\u255d\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2557\\u2588\\u2588\\u2551\\u2591\\u2591\\u2588\\u2588\\u2551\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2557\\u2588\\u2588\\u2551\\u2591\\u2591\\u2588\\u2588\\u2551\\u2588\\u2588\\u2551\\u2591\\u255a\\u2588\\u2588\\u2588\\u2551\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2554\\u255d\\n\\u255a\\u2550\\u2550\\u2550\\u2550\\u2550\\u255d\\u2591\\u255a\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u255d\\u255a\\u2550\\u255d\\u2591\\u2591\\u2591\\u2591\\u2591\\u255a\\u2550\\u255d\\u2591\\u2591\\u2591\\u2591\\u2591\\u255a\\u2550\\u255d\\u2591\\u2591\\u2591\\u255a\\u2550\\u255d\\u2591\\u2591\\u2591\\u255a\\u2550\\u2550\\u2550\\u2550\\u255d\\u2591\\u255a\\u2550\\u255d\\u2591\\u2591\\u255a\\u2550\\u2550\\u255d\\u255a\\u2550\\u2550\\u2550\\u2550\\u2550\\u255d\\u2591\\u255a\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u255d\\u255a\\u2550\\u255d\\u2591\\u2591\\u255a\\u2550\\u255d\\u255a\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u255d\\u255a\\u2550\\u255d\\u2591\\u2591\\u255a\\u2550\\u255d\\u255a\\u2550\\u255d\\u2591\\u2591\\u255a\\u2550\\u2550\\u255d\\u255a\\u2550\\u2550\\u2550\\u2550\\u2550\\u255d\\u2591\\n\\nhttps://defi.sucks\\n\\n*/\\n\\npragma solidity >=0.8.4 <0.9.0;\\n\\nimport '../interfaces/IKeep3r.sol';\\nimport './peripherals/jobs/Keep3rJobs.sol';\\nimport './peripherals/keepers/Keep3rKeepers.sol';\\nimport '@defi-wonderland/solidity-utils/solidity/contracts/DustCollector.sol';\\n\\ncontract Keep3r is IKeep3r, Keep3rJobs, Keep3rKeepers {\\n constructor(\\n address _governor,\\n address _keep3rHelper,\\n address _keep3rV1,\\n address _keep3rV1Proxy\\n ) Keep3rParameters(_keep3rHelper, _keep3rV1, _keep3rV1Proxy) Keep3rRoles(_governor) {}\\n}\\n\",\"keccak256\":\"0x21c3fd585303fbb3686a9f11e13da71ef98c24eb14cf6a9721eee30b03a75ffa\",\"license\":\"MIT\"},\"solidity/contracts/libraries/FullMath.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4 <0.9.0;\\n\\n/// @title Contains 512-bit math functions\\n/// @notice Facilitates multiplication and division that can have overflow of an intermediate value without any loss of precision\\n/// @dev Handles \\\"phantom overflow\\\" i.e., allows multiplication and division where an intermediate value overflows 256 bits\\nlibrary FullMath {\\n /// @notice Calculates floor(a\\u00d7b\\u00f7denominator) with full precision. Throws if result overflows a uint256 or denominator == 0\\n /// @param a The multiplicand\\n /// @param b The multiplier\\n /// @param denominator The divisor\\n /// @return result The 256-bit result\\n /// @dev Credit to Remco Bloemen under MIT license https://xn--2-umb.com/21/muldiv\\n function mulDiv(\\n uint256 a,\\n uint256 b,\\n uint256 denominator\\n ) internal pure returns (uint256 result) {\\n unchecked {\\n // 512-bit multiply [prod1 prod0] = a * b\\n // Compute the product mod 2**256 and mod 2**256 - 1\\n // then use the Chinese Remainder Theorem to reconstruct\\n // the 512 bit result. The result is stored in two 256\\n // variables such that product = prod1 * 2**256 + prod0\\n uint256 prod0; // Least significant 256 bits of the product\\n uint256 prod1; // Most significant 256 bits of the product\\n assembly {\\n let mm := mulmod(a, b, not(0))\\n prod0 := mul(a, b)\\n prod1 := sub(sub(mm, prod0), lt(mm, prod0))\\n }\\n\\n // Handle non-overflow cases, 256 by 256 division\\n if (prod1 == 0) {\\n require(denominator > 0);\\n assembly {\\n result := div(prod0, denominator)\\n }\\n return result;\\n }\\n\\n // Make sure the result is less than 2**256.\\n // Also prevents denominator == 0\\n require(denominator > prod1);\\n\\n ///////////////////////////////////////////////\\n // 512 by 256 division.\\n ///////////////////////////////////////////////\\n\\n // Make division exact by subtracting the remainder from [prod1 prod0]\\n // Compute remainder using mulmod\\n uint256 remainder;\\n assembly {\\n remainder := mulmod(a, b, denominator)\\n }\\n // Subtract 256 bit number from 512 bit number\\n assembly {\\n prod1 := sub(prod1, gt(remainder, prod0))\\n prod0 := sub(prod0, remainder)\\n }\\n\\n // Factor powers of two out of denominator\\n // Compute largest power of two divisor of denominator.\\n // Always >= 1.\\n uint256 twos = (~denominator + 1) & denominator;\\n // Divide denominator by power of two\\n assembly {\\n denominator := div(denominator, twos)\\n }\\n\\n // Divide [prod1 prod0] by the factors of two\\n assembly {\\n prod0 := div(prod0, twos)\\n }\\n // Shift in bits from prod1 into prod0. For this we need\\n // to flip `twos` such that it is 2**256 / twos.\\n // If twos is zero, then it becomes one\\n assembly {\\n twos := add(div(sub(0, twos), twos), 1)\\n }\\n prod0 |= prod1 * twos;\\n\\n // Invert denominator mod 2**256\\n // Now that denominator is an odd number, it has an inverse\\n // modulo 2**256 such that denominator * inv = 1 mod 2**256.\\n // Compute the inverse by starting with a seed that is correct\\n // correct for four bits. That is, denominator * inv = 1 mod 2**4\\n uint256 inv = (3 * denominator) ^ 2;\\n // Now use Newton-Raphson iteration to improve the precision.\\n // Thanks to Hensel's lifting lemma, this also works in modular\\n // arithmetic, doubling the correct bits in each step.\\n inv *= 2 - denominator * inv; // inverse mod 2**8\\n inv *= 2 - denominator * inv; // inverse mod 2**16\\n inv *= 2 - denominator * inv; // inverse mod 2**32\\n inv *= 2 - denominator * inv; // inverse mod 2**64\\n inv *= 2 - denominator * inv; // inverse mod 2**128\\n inv *= 2 - denominator * inv; // inverse mod 2**256\\n\\n // Because the division is now exact we can divide by multiplying\\n // with the modular inverse of denominator. This will give us the\\n // correct result modulo 2**256. Since the precoditions guarantee\\n // that the outcome is less than 2**256, this is the final result.\\n // We don't need to compute the high bits of the result and prod1\\n // is no longer required.\\n result = prod0 * inv;\\n return result;\\n }\\n }\\n\\n /// @notice Calculates ceil(a\\u00d7b\\u00f7denominator) with full precision. Throws if result overflows a uint256 or denominator == 0\\n /// @param a The multiplicand\\n /// @param b The multiplier\\n /// @param denominator The divisor\\n /// @return result The 256-bit result\\n function mulDivRoundingUp(\\n uint256 a,\\n uint256 b,\\n uint256 denominator\\n ) internal pure returns (uint256 result) {\\n unchecked {\\n result = mulDiv(a, b, denominator);\\n if (mulmod(a, b, denominator) > 0) {\\n require(result < type(uint256).max);\\n result++;\\n }\\n }\\n }\\n}\\n\",\"keccak256\":\"0xe1c595da02adf8ba2ae74ac579b9b3c966d1ecb2a99c25081a62ee8550f26569\",\"license\":\"MIT\"},\"solidity/contracts/peripherals/Keep3rAccountance.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4 <0.9.0;\\n\\nimport '@openzeppelin/contracts/utils/structs/EnumerableSet.sol';\\nimport '../../interfaces/peripherals/IKeep3rAccountance.sol';\\nimport './Keep3rRoles.sol';\\n\\nabstract contract Keep3rAccountance is IKeep3rAccountance, Keep3rRoles {\\n using EnumerableSet for EnumerableSet.AddressSet;\\n\\n /// @notice List of all enabled keepers\\n EnumerableSet.AddressSet internal _keepers;\\n\\n /// @inheritdoc IKeep3rAccountance\\n uint256 public override totalBonds;\\n\\n /// @inheritdoc IKeep3rAccountance\\n mapping(address => uint256) public override workCompleted;\\n\\n /// @inheritdoc IKeep3rAccountance\\n mapping(address => uint256) public override firstSeen;\\n\\n /// @inheritdoc IKeep3rAccountance\\n mapping(address => bool) public override disputes;\\n\\n /// @inheritdoc IKeep3rAccountance\\n /// @notice Mapping (job => bonding => amount)\\n mapping(address => mapping(address => uint256)) public override bonds;\\n\\n /// @inheritdoc IKeep3rAccountance\\n mapping(address => mapping(address => uint256)) public override jobTokenCredits;\\n\\n /// @notice The current liquidity credits available for a job\\n mapping(address => uint256) internal _jobLiquidityCredits;\\n\\n /// @notice Map the address of a job to its correspondent periodCredits\\n mapping(address => uint256) internal _jobPeriodCredits;\\n\\n /// @notice Enumerable array of Job Tokens for Credits\\n mapping(address => EnumerableSet.AddressSet) internal _jobTokens;\\n\\n /// @notice List of liquidities that a job has (job => liquidities)\\n mapping(address => EnumerableSet.AddressSet) internal _jobLiquidities;\\n\\n /// @notice Liquidity pool to observe\\n mapping(address => address) internal _liquidityPool;\\n\\n /// @notice Tracks if a pool has KP3R as token0\\n mapping(address => bool) internal _isKP3RToken0;\\n\\n /// @inheritdoc IKeep3rAccountance\\n mapping(address => mapping(address => uint256)) public override pendingBonds;\\n\\n /// @inheritdoc IKeep3rAccountance\\n mapping(address => mapping(address => uint256)) public override canActivateAfter;\\n\\n /// @inheritdoc IKeep3rAccountance\\n mapping(address => mapping(address => uint256)) public override canWithdrawAfter;\\n\\n /// @inheritdoc IKeep3rAccountance\\n mapping(address => mapping(address => uint256)) public override pendingUnbonds;\\n\\n /// @inheritdoc IKeep3rAccountance\\n mapping(address => bool) public override hasBonded;\\n\\n /// @notice List of all enabled jobs\\n EnumerableSet.AddressSet internal _jobs;\\n\\n /// @inheritdoc IKeep3rAccountance\\n function jobs() external view override returns (address[] memory _list) {\\n _list = _jobs.values();\\n }\\n\\n /// @inheritdoc IKeep3rAccountance\\n function keepers() external view override returns (address[] memory _list) {\\n _list = _keepers.values();\\n }\\n}\\n\",\"keccak256\":\"0xcd2a525e6567eea4f2a7f93e8eb686e484d2a078686f2744dde35a8383881730\",\"license\":\"MIT\"},\"solidity/contracts/peripherals/Keep3rDisputable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4 <0.9.0;\\n\\nimport './Keep3rParameters.sol';\\nimport '../../interfaces/peripherals/IKeep3rDisputable.sol';\\n\\nabstract contract Keep3rDisputable is IKeep3rDisputable, Keep3rParameters {\\n /// @inheritdoc IKeep3rDisputable\\n function dispute(address _jobOrKeeper) external override onlyDisputer {\\n if (disputes[_jobOrKeeper]) revert AlreadyDisputed();\\n disputes[_jobOrKeeper] = true;\\n emit Dispute(_jobOrKeeper, msg.sender);\\n }\\n\\n /// @inheritdoc IKeep3rDisputable\\n function resolve(address _jobOrKeeper) external override onlyDisputer {\\n if (!disputes[_jobOrKeeper]) revert NotDisputed();\\n disputes[_jobOrKeeper] = false;\\n emit Resolve(_jobOrKeeper, msg.sender);\\n }\\n}\\n\",\"keccak256\":\"0x664b54040aa4e734f68a01fcfb5bf67cbb1a70efd03862cd3a456457536b1fb4\",\"license\":\"MIT\"},\"solidity/contracts/peripherals/Keep3rParameters.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4 <0.9.0;\\n\\nimport '../../interfaces/IKeep3rHelper.sol';\\nimport '../../interfaces/peripherals/IKeep3rParameters.sol';\\nimport '../../interfaces/external/IKeep3rV1Proxy.sol';\\nimport './Keep3rAccountance.sol';\\n\\nabstract contract Keep3rParameters is IKeep3rParameters, Keep3rAccountance {\\n /// @inheritdoc IKeep3rParameters\\n address public override keep3rV1;\\n\\n /// @inheritdoc IKeep3rParameters\\n address public override keep3rV1Proxy;\\n\\n /// @inheritdoc IKeep3rParameters\\n address public override keep3rHelper;\\n\\n /// @inheritdoc IKeep3rParameters\\n uint256 public override bondTime = 3 days;\\n\\n /// @inheritdoc IKeep3rParameters\\n uint256 public override unbondTime = 14 days;\\n\\n /// @inheritdoc IKeep3rParameters\\n uint256 public override liquidityMinimum = 3 ether;\\n\\n /// @inheritdoc IKeep3rParameters\\n uint256 public override rewardPeriodTime = 5 days;\\n\\n /// @inheritdoc IKeep3rParameters\\n uint256 public override inflationPeriod = 34 days;\\n\\n /// @inheritdoc IKeep3rParameters\\n uint256 public override fee = 30;\\n\\n /// @notice The base that will be used to calculate the fee\\n uint256 internal constant _BASE = 10_000;\\n\\n /// @notice The minimum reward period\\n uint256 internal constant _MIN_REWARD_PERIOD_TIME = 1 days;\\n\\n constructor(\\n address _keep3rHelper,\\n address _keep3rV1,\\n address _keep3rV1Proxy\\n ) {\\n keep3rHelper = _keep3rHelper;\\n keep3rV1 = _keep3rV1;\\n keep3rV1Proxy = _keep3rV1Proxy;\\n }\\n\\n /// @inheritdoc IKeep3rParameters\\n function setKeep3rHelper(address _keep3rHelper) external override onlyGovernor {\\n if (_keep3rHelper == address(0)) revert ZeroAddress();\\n keep3rHelper = _keep3rHelper;\\n emit Keep3rHelperChange(_keep3rHelper);\\n }\\n\\n /// @inheritdoc IKeep3rParameters\\n function setKeep3rV1(address _keep3rV1) public virtual override onlyGovernor {\\n if (_keep3rV1 == address(0)) revert ZeroAddress();\\n _mint(totalBonds);\\n\\n keep3rV1 = _keep3rV1;\\n emit Keep3rV1Change(_keep3rV1);\\n }\\n\\n /// @inheritdoc IKeep3rParameters\\n function setKeep3rV1Proxy(address _keep3rV1Proxy) external override onlyGovernor {\\n if (_keep3rV1Proxy == address(0)) revert ZeroAddress();\\n keep3rV1Proxy = _keep3rV1Proxy;\\n emit Keep3rV1ProxyChange(_keep3rV1Proxy);\\n }\\n\\n /// @inheritdoc IKeep3rParameters\\n function setBondTime(uint256 _bondTime) external override onlyGovernor {\\n bondTime = _bondTime;\\n emit BondTimeChange(_bondTime);\\n }\\n\\n /// @inheritdoc IKeep3rParameters\\n function setUnbondTime(uint256 _unbondTime) external override onlyGovernor {\\n unbondTime = _unbondTime;\\n emit UnbondTimeChange(_unbondTime);\\n }\\n\\n /// @inheritdoc IKeep3rParameters\\n function setLiquidityMinimum(uint256 _liquidityMinimum) external override onlyGovernor {\\n liquidityMinimum = _liquidityMinimum;\\n emit LiquidityMinimumChange(_liquidityMinimum);\\n }\\n\\n /// @inheritdoc IKeep3rParameters\\n function setRewardPeriodTime(uint256 _rewardPeriodTime) external override onlyGovernor {\\n if (_rewardPeriodTime < _MIN_REWARD_PERIOD_TIME) revert MinRewardPeriod();\\n rewardPeriodTime = _rewardPeriodTime;\\n emit RewardPeriodTimeChange(_rewardPeriodTime);\\n }\\n\\n /// @inheritdoc IKeep3rParameters\\n function setInflationPeriod(uint256 _inflationPeriod) external override onlyGovernor {\\n inflationPeriod = _inflationPeriod;\\n emit InflationPeriodChange(_inflationPeriod);\\n }\\n\\n /// @inheritdoc IKeep3rParameters\\n function setFee(uint256 _fee) external override onlyGovernor {\\n fee = _fee;\\n emit FeeChange(_fee);\\n }\\n\\n function _mint(uint256 _amount) internal {\\n totalBonds -= _amount;\\n IKeep3rV1Proxy(keep3rV1Proxy).mint(_amount);\\n }\\n}\\n\",\"keccak256\":\"0xcbc3784d997d3433461741e68f0119f197fa9e595e79939e540d810f4a76cde6\",\"license\":\"MIT\"},\"solidity/contracts/peripherals/Keep3rRoles.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4 <0.9.0;\\n\\nimport '../../interfaces/peripherals/IKeep3rRoles.sol';\\nimport '@openzeppelin/contracts/utils/structs/EnumerableSet.sol';\\nimport '@defi-wonderland/solidity-utils/solidity/contracts/DustCollector.sol';\\nimport '@defi-wonderland/solidity-utils/solidity/contracts/Governable.sol';\\n\\ncontract Keep3rRoles is IKeep3rRoles, Governable, DustCollector {\\n /// @inheritdoc IKeep3rRoles\\n mapping(address => bool) public override slashers;\\n\\n /// @inheritdoc IKeep3rRoles\\n mapping(address => bool) public override disputers;\\n\\n constructor(address _governor) Governable(_governor) DustCollector() {}\\n\\n /// @inheritdoc IKeep3rRoles\\n function addSlasher(address _slasher) external override onlyGovernor {\\n if (_slasher == address(0)) revert ZeroAddress();\\n if (slashers[_slasher]) revert SlasherExistent();\\n slashers[_slasher] = true;\\n emit SlasherAdded(_slasher);\\n }\\n\\n /// @inheritdoc IKeep3rRoles\\n function removeSlasher(address _slasher) external override onlyGovernor {\\n if (!slashers[_slasher]) revert SlasherUnexistent();\\n delete slashers[_slasher];\\n emit SlasherRemoved(_slasher);\\n }\\n\\n /// @inheritdoc IKeep3rRoles\\n function addDisputer(address _disputer) external override onlyGovernor {\\n if (_disputer == address(0)) revert ZeroAddress();\\n if (disputers[_disputer]) revert DisputerExistent();\\n disputers[_disputer] = true;\\n emit DisputerAdded(_disputer);\\n }\\n\\n /// @inheritdoc IKeep3rRoles\\n function removeDisputer(address _disputer) external override onlyGovernor {\\n if (!disputers[_disputer]) revert DisputerUnexistent();\\n delete disputers[_disputer];\\n emit DisputerRemoved(_disputer);\\n }\\n\\n /// @notice Functions with this modifier can only be called by either a slasher or governance\\n modifier onlySlasher {\\n if (!slashers[msg.sender]) revert OnlySlasher();\\n _;\\n }\\n\\n /// @notice Functions with this modifier can only be called by either a disputer or governance\\n modifier onlyDisputer {\\n if (!disputers[msg.sender]) revert OnlyDisputer();\\n _;\\n }\\n}\\n\",\"keccak256\":\"0x80a56902f12536731155ceff8be13081f940991fdd03b38eccf4f241cb61f23a\",\"license\":\"MIT\"},\"solidity/contracts/peripherals/jobs/Keep3rJobDisputable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4 <0.9.0;\\n\\nimport './Keep3rJobFundableCredits.sol';\\nimport './Keep3rJobFundableLiquidity.sol';\\nimport '../Keep3rDisputable.sol';\\n\\nabstract contract Keep3rJobDisputable is IKeep3rJobDisputable, Keep3rDisputable, Keep3rJobFundableCredits, Keep3rJobFundableLiquidity {\\n using EnumerableSet for EnumerableSet.AddressSet;\\n using SafeERC20 for IERC20;\\n\\n /// @inheritdoc IKeep3rJobDisputable\\n function slashTokenFromJob(\\n address _job,\\n address _token,\\n uint256 _amount\\n ) external override onlySlasher {\\n if (!disputes[_job]) revert NotDisputed();\\n if (!_jobTokens[_job].contains(_token)) revert JobTokenUnexistent();\\n if (jobTokenCredits[_job][_token] < _amount) revert JobTokenInsufficient();\\n\\n try IERC20(_token).transfer(governor, _amount) {} catch {}\\n jobTokenCredits[_job][_token] -= _amount;\\n if (jobTokenCredits[_job][_token] == 0) {\\n _jobTokens[_job].remove(_token);\\n }\\n\\n emit JobSlashToken(_job, _token, msg.sender, _amount);\\n }\\n\\n /// @inheritdoc IKeep3rJobDisputable\\n function slashLiquidityFromJob(\\n address _job,\\n address _liquidity,\\n uint256 _amount\\n ) external override onlySlasher {\\n if (!disputes[_job]) revert NotDisputed();\\n\\n _unbondLiquidityFromJob(_job, _liquidity, _amount);\\n try IERC20(_liquidity).transfer(governor, _amount) {} catch {}\\n emit JobSlashLiquidity(_job, _liquidity, msg.sender, _amount);\\n }\\n}\\n\",\"keccak256\":\"0x545db29f913063a93e35148c49d1498206d8429f9def33bbea6bb735c4e97dde\",\"license\":\"MIT\"},\"solidity/contracts/peripherals/jobs/Keep3rJobFundableCredits.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4 <0.9.0;\\n\\nimport './Keep3rJobOwnership.sol';\\nimport '../Keep3rAccountance.sol';\\nimport '../Keep3rParameters.sol';\\nimport '../../../interfaces/peripherals/IKeep3rJobs.sol';\\n\\nimport '@openzeppelin/contracts/security/ReentrancyGuard.sol';\\nimport '@openzeppelin/contracts/token/ERC20/IERC20.sol';\\nimport '@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol';\\nimport '@openzeppelin/contracts/utils/math/Math.sol';\\n\\nabstract contract Keep3rJobFundableCredits is IKeep3rJobFundableCredits, ReentrancyGuard, Keep3rJobOwnership, Keep3rParameters {\\n using EnumerableSet for EnumerableSet.AddressSet;\\n using SafeERC20 for IERC20;\\n\\n /// @notice Cooldown between withdrawals\\n uint256 internal constant _WITHDRAW_TOKENS_COOLDOWN = 1 minutes;\\n\\n /// @inheritdoc IKeep3rJobFundableCredits\\n mapping(address => mapping(address => uint256)) public override jobTokenCreditsAddedAt;\\n\\n /// @inheritdoc IKeep3rJobFundableCredits\\n function addTokenCreditsToJob(\\n address _job,\\n address _token,\\n uint256 _amount\\n ) external override nonReentrant {\\n if (!_jobs.contains(_job)) revert JobUnavailable();\\n // KP3R shouldn't be used for direct token payments\\n if (_token == keep3rV1) revert TokenUnallowed();\\n uint256 _before = IERC20(_token).balanceOf(address(this));\\n IERC20(_token).safeTransferFrom(msg.sender, address(this), _amount);\\n uint256 _received = IERC20(_token).balanceOf(address(this)) - _before;\\n uint256 _tokenFee = (_received * fee) / _BASE;\\n jobTokenCredits[_job][_token] += _received - _tokenFee;\\n jobTokenCreditsAddedAt[_job][_token] = block.timestamp;\\n IERC20(_token).safeTransfer(governor, _tokenFee);\\n _jobTokens[_job].add(_token);\\n\\n emit TokenCreditAddition(_job, _token, msg.sender, _received);\\n }\\n\\n /// @inheritdoc IKeep3rJobFundableCredits\\n function withdrawTokenCreditsFromJob(\\n address _job,\\n address _token,\\n uint256 _amount,\\n address _receiver\\n ) external override nonReentrant onlyJobOwner(_job) {\\n if (block.timestamp <= jobTokenCreditsAddedAt[_job][_token] + _WITHDRAW_TOKENS_COOLDOWN) revert JobTokenCreditsLocked();\\n if (jobTokenCredits[_job][_token] < _amount) revert InsufficientJobTokenCredits();\\n if (disputes[_job]) revert JobDisputed();\\n\\n jobTokenCredits[_job][_token] -= _amount;\\n IERC20(_token).safeTransfer(_receiver, _amount);\\n\\n if (jobTokenCredits[_job][_token] == 0) {\\n _jobTokens[_job].remove(_token);\\n }\\n\\n emit TokenCreditWithdrawal(_job, _token, _receiver, _amount);\\n }\\n}\\n\",\"keccak256\":\"0x39eae0b2b1e1f19d18d5574a7ada277d694f45991742b4f7410266eca7c50899\",\"license\":\"MIT\"},\"solidity/contracts/peripherals/jobs/Keep3rJobFundableLiquidity.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4 <0.9.0;\\n\\nimport './Keep3rJobOwnership.sol';\\nimport '../Keep3rAccountance.sol';\\nimport '../Keep3rParameters.sol';\\nimport '../../../interfaces/IPairManager.sol';\\nimport '../../../interfaces/peripherals/IKeep3rJobs.sol';\\n\\nimport '../../libraries/FullMath.sol';\\n\\nimport '@openzeppelin/contracts/security/ReentrancyGuard.sol';\\nimport '@openzeppelin/contracts/token/ERC20/IERC20.sol';\\nimport '@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol';\\nimport '@openzeppelin/contracts/utils/math/Math.sol';\\n\\nabstract contract Keep3rJobFundableLiquidity is IKeep3rJobFundableLiquidity, ReentrancyGuard, Keep3rJobOwnership, Keep3rParameters {\\n using EnumerableSet for EnumerableSet.AddressSet;\\n using SafeERC20 for IERC20;\\n\\n /// @notice List of liquidities that are accepted in the system\\n EnumerableSet.AddressSet internal _approvedLiquidities;\\n\\n /// @inheritdoc IKeep3rJobFundableLiquidity\\n mapping(address => mapping(address => uint256)) public override liquidityAmount;\\n\\n /// @inheritdoc IKeep3rJobFundableLiquidity\\n mapping(address => uint256) public override rewardedAt;\\n\\n /// @inheritdoc IKeep3rJobFundableLiquidity\\n mapping(address => uint256) public override workedAt;\\n\\n /// @notice Tracks an address and returns its TickCache\\n mapping(address => TickCache) internal _tick;\\n\\n // Views\\n\\n /// @inheritdoc IKeep3rJobFundableLiquidity\\n function approvedLiquidities() external view override returns (address[] memory _list) {\\n _list = _approvedLiquidities.values();\\n }\\n\\n /// @inheritdoc IKeep3rJobFundableLiquidity\\n function jobPeriodCredits(address _job) public view override returns (uint256 _periodCredits) {\\n for (uint256 i; i < _jobLiquidities[_job].length(); i++) {\\n address _liquidity = _jobLiquidities[_job].at(i);\\n if (_approvedLiquidities.contains(_liquidity)) {\\n TickCache memory _tickCache = observeLiquidity(_liquidity);\\n if (_tickCache.period != 0) {\\n int56 _tickDifference = _isKP3RToken0[_liquidity] ? _tickCache.difference : -_tickCache.difference;\\n _periodCredits += _getReward(\\n IKeep3rHelper(keep3rHelper).getKP3RsAtTick(liquidityAmount[_job][_liquidity], _tickDifference, rewardPeriodTime)\\n );\\n }\\n }\\n }\\n }\\n\\n /// @inheritdoc IKeep3rJobFundableLiquidity\\n function jobLiquidityCredits(address _job) public view override returns (uint256 _liquidityCredits) {\\n uint256 _periodCredits = jobPeriodCredits(_job);\\n\\n // If the job was rewarded in the past 1 period time\\n if ((block.timestamp - rewardedAt[_job]) < rewardPeriodTime) {\\n // If the job has period credits, update minted job credits to new twap\\n _liquidityCredits = _periodCredits > 0\\n ? (_jobLiquidityCredits[_job] * _periodCredits) / _jobPeriodCredits[_job] // If the job has period credits, return remaining job credits updated to new twap\\n : _jobLiquidityCredits[_job]; // If not, return remaining credits, forced credits should not be updated\\n } else {\\n // Else return a full period worth of credits if current credits have expired\\n _liquidityCredits = _periodCredits;\\n }\\n }\\n\\n /// @inheritdoc IKeep3rJobFundableLiquidity\\n function totalJobCredits(address _job) external view override returns (uint256 _credits) {\\n uint256 _periodCredits = jobPeriodCredits(_job);\\n uint256 _cooldown = block.timestamp;\\n\\n if ((rewardedAt[_job] > _period(block.timestamp - rewardPeriodTime))) {\\n // Will calculate cooldown if it outdated\\n if ((block.timestamp - rewardedAt[_job]) >= rewardPeriodTime) {\\n // Will calculate cooldown from last reward reference in this period\\n _cooldown -= (rewardedAt[_job] + rewardPeriodTime);\\n } else {\\n // Will calculate cooldown from last reward timestamp\\n _cooldown -= rewardedAt[_job];\\n }\\n } else {\\n // Will calculate cooldown from period start if expired\\n _cooldown -= _period(block.timestamp);\\n }\\n _credits = jobLiquidityCredits(_job) + _phase(_cooldown, _periodCredits);\\n }\\n\\n /// @inheritdoc IKeep3rJobFundableLiquidity\\n function quoteLiquidity(address _liquidity, uint256 _amount) external view override returns (uint256 _periodCredits) {\\n if (_approvedLiquidities.contains(_liquidity)) {\\n TickCache memory _tickCache = observeLiquidity(_liquidity);\\n if (_tickCache.period != 0) {\\n int56 _tickDifference = _isKP3RToken0[_liquidity] ? _tickCache.difference : -_tickCache.difference;\\n return _getReward(IKeep3rHelper(keep3rHelper).getKP3RsAtTick(_amount, _tickDifference, rewardPeriodTime));\\n }\\n }\\n }\\n\\n /// @inheritdoc IKeep3rJobFundableLiquidity\\n function observeLiquidity(address _liquidity) public view virtual override returns (TickCache memory _tickCache) {\\n if (_tick[_liquidity].period == _period(block.timestamp)) {\\n // Will return cached twaps if liquidity is updated\\n _tickCache = _tick[_liquidity];\\n } else {\\n bool success;\\n uint256 lastPeriod = _period(block.timestamp - rewardPeriodTime);\\n\\n if (_tick[_liquidity].period == lastPeriod) {\\n // Will only ask for current period accumulator if liquidity is outdated\\n uint32[] memory _secondsAgo = new uint32[](1);\\n int56 previousTick = _tick[_liquidity].current;\\n\\n _secondsAgo[0] = uint32(block.timestamp - _period(block.timestamp));\\n\\n (_tickCache.current, , success) = IKeep3rHelper(keep3rHelper).observe(_liquidityPool[_liquidity], _secondsAgo);\\n\\n _tickCache.difference = _tickCache.current - previousTick;\\n } else if (_tick[_liquidity].period < lastPeriod) {\\n // Will ask for 2 accumulators if liquidity is expired\\n uint32[] memory _secondsAgo = new uint32[](2);\\n\\n _secondsAgo[0] = uint32(block.timestamp - _period(block.timestamp));\\n _secondsAgo[1] = uint32(block.timestamp - _period(block.timestamp) + rewardPeriodTime);\\n\\n int56 _tickCumulative2;\\n (_tickCache.current, _tickCumulative2, success) = IKeep3rHelper(keep3rHelper).observe(_liquidityPool[_liquidity], _secondsAgo);\\n\\n _tickCache.difference = _tickCache.current - _tickCumulative2;\\n }\\n if (success) {\\n _tickCache.period = _period(block.timestamp);\\n } else {\\n delete _tickCache.period;\\n }\\n }\\n }\\n\\n // Methods\\n\\n /// @inheritdoc IKeep3rJobFundableLiquidity\\n function forceLiquidityCreditsToJob(address _job, uint256 _amount) external override onlyGovernor {\\n if (!_jobs.contains(_job)) revert JobUnavailable();\\n _settleJobAccountance(_job);\\n _jobLiquidityCredits[_job] += _amount;\\n emit LiquidityCreditsForced(_job, rewardedAt[_job], _jobLiquidityCredits[_job]);\\n }\\n\\n /// @inheritdoc IKeep3rJobFundableLiquidity\\n function approveLiquidity(address _liquidity) external virtual override onlyGovernor {\\n if (!_approvedLiquidities.add(_liquidity)) revert LiquidityPairApproved();\\n _liquidityPool[_liquidity] = IPairManager(_liquidity).pool();\\n _isKP3RToken0[_liquidity] = IKeep3rHelper(keep3rHelper).isKP3RToken0(_liquidityPool[_liquidity]);\\n _tick[_liquidity] = observeLiquidity(_liquidity);\\n emit LiquidityApproval(_liquidity);\\n }\\n\\n /// @inheritdoc IKeep3rJobFundableLiquidity\\n function revokeLiquidity(address _liquidity) external override onlyGovernor {\\n if (!_approvedLiquidities.remove(_liquidity)) revert LiquidityPairUnexistent();\\n delete _liquidityPool[_liquidity];\\n delete _isKP3RToken0[_liquidity];\\n delete _tick[_liquidity];\\n\\n emit LiquidityRevocation(_liquidity);\\n }\\n\\n /// @inheritdoc IKeep3rJobFundableLiquidity\\n function addLiquidityToJob(\\n address _job,\\n address _liquidity,\\n uint256 _amount\\n ) external override nonReentrant {\\n if (!_approvedLiquidities.contains(_liquidity)) revert LiquidityPairUnapproved();\\n if (!_jobs.contains(_job)) revert JobUnavailable();\\n\\n _jobLiquidities[_job].add(_liquidity);\\n\\n _settleJobAccountance(_job);\\n\\n if (_quoteLiquidity(liquidityAmount[_job][_liquidity] + _amount, _liquidity) < liquidityMinimum) revert JobLiquidityLessThanMin();\\n\\n emit LiquidityCreditsReward(_job, rewardedAt[_job], _jobLiquidityCredits[_job], _jobPeriodCredits[_job]);\\n\\n IERC20(_liquidity).safeTransferFrom(msg.sender, address(this), _amount);\\n liquidityAmount[_job][_liquidity] += _amount;\\n _jobPeriodCredits[_job] += _getReward(_quoteLiquidity(_amount, _liquidity));\\n emit LiquidityAddition(_job, _liquidity, msg.sender, _amount);\\n }\\n\\n /// @inheritdoc IKeep3rJobFundableLiquidity\\n function unbondLiquidityFromJob(\\n address _job,\\n address _liquidity,\\n uint256 _amount\\n ) external override onlyJobOwner(_job) {\\n canWithdrawAfter[_job][_liquidity] = block.timestamp + unbondTime;\\n pendingUnbonds[_job][_liquidity] += _amount;\\n _unbondLiquidityFromJob(_job, _liquidity, _amount);\\n\\n uint256 _remainingLiquidity = liquidityAmount[_job][_liquidity];\\n if (_remainingLiquidity > 0 && _quoteLiquidity(_remainingLiquidity, _liquidity) < liquidityMinimum) revert JobLiquidityLessThanMin();\\n\\n emit Unbonding(_job, _liquidity, _amount);\\n }\\n\\n /// @inheritdoc IKeep3rJobFundableLiquidity\\n function withdrawLiquidityFromJob(\\n address _job,\\n address _liquidity,\\n address _receiver\\n ) external override onlyJobOwner(_job) {\\n if (_receiver == address(0)) revert ZeroAddress();\\n if (pendingUnbonds[_job][_liquidity] == 0) revert UnbondsUnexistent();\\n if (canWithdrawAfter[_job][_liquidity] >= block.timestamp) revert UnbondsLocked();\\n if (disputes[_job]) revert Disputed();\\n\\n uint256 _amount = pendingUnbonds[_job][_liquidity];\\n\\n delete pendingUnbonds[_job][_liquidity];\\n delete canWithdrawAfter[_job][_liquidity];\\n\\n IERC20(_liquidity).safeTransfer(_receiver, _amount);\\n emit LiquidityWithdrawal(_job, _liquidity, _receiver, _amount);\\n }\\n\\n // Internal functions\\n\\n /// @notice Updates or rewards job liquidity credits depending on time since last job reward\\n function _updateJobCreditsIfNeeded(address _job) internal returns (bool _rewarded) {\\n if (rewardedAt[_job] < _period(block.timestamp)) {\\n // Will exit function if job has been rewarded in current period\\n if (rewardedAt[_job] <= _period(block.timestamp - rewardPeriodTime)) {\\n // Will reset job to period syncronicity if a full period passed without rewards\\n _updateJobPeriod(_job);\\n _jobLiquidityCredits[_job] = _jobPeriodCredits[_job];\\n rewardedAt[_job] = _period(block.timestamp);\\n _rewarded = true;\\n } else if ((block.timestamp - rewardedAt[_job]) >= rewardPeriodTime) {\\n // Will reset job's syncronicity if last reward was more than epoch ago\\n _updateJobPeriod(_job);\\n _jobLiquidityCredits[_job] = _jobPeriodCredits[_job];\\n rewardedAt[_job] += rewardPeriodTime;\\n _rewarded = true;\\n } else if (workedAt[_job] < _period(block.timestamp)) {\\n // First keeper on period has to update job accountance to current twaps\\n uint256 previousPeriodCredits = _jobPeriodCredits[_job];\\n _updateJobPeriod(_job);\\n _jobLiquidityCredits[_job] = (_jobLiquidityCredits[_job] * _jobPeriodCredits[_job]) / previousPeriodCredits;\\n // Updating job accountance does not reward job\\n }\\n }\\n }\\n\\n /// @notice Only called if _jobLiquidityCredits < payment\\n function _rewardJobCredits(address _job) internal {\\n /// @notice Only way to += jobLiquidityCredits is when keeper rewarding (cannot pay work)\\n /* WARNING: this allows to top up _jobLiquidityCredits to a max of 1.99 but have to spend at least 1 */\\n _jobLiquidityCredits[_job] += _phase(block.timestamp - rewardedAt[_job], _jobPeriodCredits[_job]);\\n rewardedAt[_job] = block.timestamp;\\n }\\n\\n /// @notice Updates accountance for _jobPeriodCredits\\n function _updateJobPeriod(address _job) internal {\\n _jobPeriodCredits[_job] = _calculateJobPeriodCredits(_job);\\n }\\n\\n /// @notice Quotes the outdated job liquidities and calculates _periodCredits\\n /// @dev This function is also responsible for keeping the KP3R/WETH quote updated\\n function _calculateJobPeriodCredits(address _job) internal returns (uint256 _periodCredits) {\\n for (uint256 i; i < _jobLiquidities[_job].length(); i++) {\\n address _liquidity = _jobLiquidities[_job].at(i);\\n if (_approvedLiquidities.contains(_liquidity)) {\\n if (_tick[_liquidity].period != _period(block.timestamp)) {\\n // Updates liquidity cache only if needed\\n _tick[_liquidity] = observeLiquidity(_liquidity);\\n }\\n _periodCredits += _getReward(_quoteLiquidity(liquidityAmount[_job][_liquidity], _liquidity));\\n }\\n }\\n }\\n\\n /// @notice Updates job accountance calculating the impact of the unbonded liquidity amount\\n function _unbondLiquidityFromJob(\\n address _job,\\n address _liquidity,\\n uint256 _amount\\n ) internal nonReentrant {\\n if (!_jobLiquidities[_job].contains(_liquidity)) revert JobLiquidityUnexistent();\\n if (liquidityAmount[_job][_liquidity] < _amount) revert JobLiquidityInsufficient();\\n\\n // Ensures current twaps in job liquidities\\n _updateJobPeriod(_job);\\n uint256 _periodCreditsToRemove = _getReward(_quoteLiquidity(_amount, _liquidity));\\n\\n // A liquidity can be revoked causing a job to have 0 periodCredits\\n if (_jobPeriodCredits[_job] > 0) {\\n // Removes a % correspondant to a full rewardPeriodTime for the liquidity withdrawn vs all of the liquidities\\n _jobLiquidityCredits[_job] -= (_jobLiquidityCredits[_job] * _periodCreditsToRemove) / _jobPeriodCredits[_job];\\n _jobPeriodCredits[_job] -= _periodCreditsToRemove;\\n }\\n\\n liquidityAmount[_job][_liquidity] -= _amount;\\n if (liquidityAmount[_job][_liquidity] == 0) {\\n _jobLiquidities[_job].remove(_liquidity);\\n }\\n }\\n\\n /// @notice Returns a fraction of the multiplier or the whole multiplier if equal or more than a rewardPeriodTime has passed\\n function _phase(uint256 _timePassed, uint256 _multiplier) internal view returns (uint256 _result) {\\n if (_timePassed < rewardPeriodTime) {\\n _result = (_timePassed * _multiplier) / rewardPeriodTime;\\n } else _result = _multiplier;\\n }\\n\\n /// @notice Returns the start of the period of the provided timestamp\\n function _period(uint256 _timestamp) internal view returns (uint256 _periodTimestamp) {\\n return _timestamp - (_timestamp % rewardPeriodTime);\\n }\\n\\n /// @notice Calculates relation between rewardPeriod and inflationPeriod\\n function _getReward(uint256 _baseAmount) internal view returns (uint256 _credits) {\\n return FullMath.mulDiv(_baseAmount, rewardPeriodTime, inflationPeriod);\\n }\\n\\n /// @notice Returns underlying KP3R amount for a given liquidity amount\\n function _quoteLiquidity(uint256 _amount, address _liquidity) internal view returns (uint256 _quote) {\\n if (_tick[_liquidity].period != 0) {\\n int56 _tickDifference = _isKP3RToken0[_liquidity] ? _tick[_liquidity].difference : -_tick[_liquidity].difference;\\n _quote = IKeep3rHelper(keep3rHelper).getKP3RsAtTick(_amount, _tickDifference, rewardPeriodTime);\\n }\\n }\\n\\n /// @notice Updates job credits to current quotes and rewards job's pending minted credits\\n /// @dev Ensures a maximum of 1 period of credits\\n function _settleJobAccountance(address _job) internal virtual {\\n _updateJobCreditsIfNeeded(_job);\\n _rewardJobCredits(_job);\\n _jobLiquidityCredits[_job] = Math.min(_jobLiquidityCredits[_job], _jobPeriodCredits[_job]);\\n }\\n}\\n\",\"keccak256\":\"0x376ccb8e49a29f87104732bfef03fbbb72e3d3d0b92c5cfe1256e718412c5073\",\"license\":\"MIT\"},\"solidity/contracts/peripherals/jobs/Keep3rJobManager.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4 <0.9.0;\\n\\nimport './Keep3rJobOwnership.sol';\\nimport '../Keep3rAccountance.sol';\\nimport '../../../interfaces/peripherals/IKeep3rJobs.sol';\\n\\nabstract contract Keep3rJobManager is IKeep3rJobManager, Keep3rJobOwnership, Keep3rAccountance {\\n using EnumerableSet for EnumerableSet.AddressSet;\\n\\n /// @inheritdoc IKeep3rJobManager\\n function addJob(address _job) external override {\\n if (_jobs.contains(_job)) revert JobAlreadyAdded();\\n if (hasBonded[_job]) revert AlreadyAKeeper();\\n _jobs.add(_job);\\n jobOwner[_job] = msg.sender;\\n emit JobAddition(_job, msg.sender);\\n }\\n}\\n\",\"keccak256\":\"0xf6e1577a6a34b674ca34a6d7530dc81349e3ad13d321281c37e0b25b7325d013\",\"license\":\"MIT\"},\"solidity/contracts/peripherals/jobs/Keep3rJobMigration.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4 <0.9.0;\\n\\nimport '../../../interfaces/peripherals/IKeep3rJobs.sol';\\nimport './Keep3rJobFundableCredits.sol';\\nimport './Keep3rJobFundableLiquidity.sol';\\n\\nabstract contract Keep3rJobMigration is IKeep3rJobMigration, Keep3rJobFundableCredits, Keep3rJobFundableLiquidity {\\n using EnumerableSet for EnumerableSet.AddressSet;\\n\\n uint256 internal constant _MIGRATION_COOLDOWN = 1 minutes;\\n\\n /// @inheritdoc IKeep3rJobMigration\\n mapping(address => address) public override pendingJobMigrations;\\n mapping(address => mapping(address => uint256)) internal _migrationCreatedAt;\\n\\n /// @inheritdoc IKeep3rJobMigration\\n function migrateJob(address _fromJob, address _toJob) external override onlyJobOwner(_fromJob) {\\n if (_fromJob == _toJob) revert JobMigrationImpossible();\\n\\n pendingJobMigrations[_fromJob] = _toJob;\\n _migrationCreatedAt[_fromJob][_toJob] = block.timestamp;\\n\\n emit JobMigrationRequested(_fromJob, _toJob);\\n }\\n\\n /// @inheritdoc IKeep3rJobMigration\\n function acceptJobMigration(address _fromJob, address _toJob) external override onlyJobOwner(_toJob) {\\n if (disputes[_fromJob] || disputes[_toJob]) revert JobDisputed();\\n if (pendingJobMigrations[_fromJob] != _toJob) revert JobMigrationUnavailable();\\n if (block.timestamp < _migrationCreatedAt[_fromJob][_toJob] + _MIGRATION_COOLDOWN) revert JobMigrationLocked();\\n\\n // force job credits update for both jobs\\n _settleJobAccountance(_fromJob);\\n _settleJobAccountance(_toJob);\\n\\n // migrate tokens\\n while (_jobTokens[_fromJob].length() > 0) {\\n address _tokenToMigrate = _jobTokens[_fromJob].at(0);\\n jobTokenCredits[_toJob][_tokenToMigrate] += jobTokenCredits[_fromJob][_tokenToMigrate];\\n delete jobTokenCredits[_fromJob][_tokenToMigrate];\\n _jobTokens[_fromJob].remove(_tokenToMigrate);\\n _jobTokens[_toJob].add(_tokenToMigrate);\\n }\\n\\n // migrate liquidities\\n while (_jobLiquidities[_fromJob].length() > 0) {\\n address _liquidity = _jobLiquidities[_fromJob].at(0);\\n\\n liquidityAmount[_toJob][_liquidity] += liquidityAmount[_fromJob][_liquidity];\\n delete liquidityAmount[_fromJob][_liquidity];\\n\\n _jobLiquidities[_toJob].add(_liquidity);\\n _jobLiquidities[_fromJob].remove(_liquidity);\\n }\\n\\n // migrate job balances\\n _jobPeriodCredits[_toJob] += _jobPeriodCredits[_fromJob];\\n delete _jobPeriodCredits[_fromJob];\\n\\n _jobLiquidityCredits[_toJob] += _jobLiquidityCredits[_fromJob];\\n delete _jobLiquidityCredits[_fromJob];\\n\\n // stop _fromJob from being a job\\n delete rewardedAt[_fromJob];\\n _jobs.remove(_fromJob);\\n\\n // delete unused data slots\\n delete jobOwner[_fromJob];\\n delete jobPendingOwner[_fromJob];\\n delete _migrationCreatedAt[_fromJob][_toJob];\\n delete pendingJobMigrations[_fromJob];\\n\\n emit JobMigrationSuccessful(_fromJob, _toJob);\\n }\\n}\\n\",\"keccak256\":\"0xd46c3c9ce970098d8d75f11966894a341824aceb40583fcfbbc0ebda93d869f9\",\"license\":\"MIT\"},\"solidity/contracts/peripherals/jobs/Keep3rJobOwnership.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4 <0.9.0;\\n\\nimport '../../../interfaces/peripherals/IKeep3rJobs.sol';\\n\\nabstract contract Keep3rJobOwnership is IKeep3rJobOwnership {\\n /// @inheritdoc IKeep3rJobOwnership\\n mapping(address => address) public override jobOwner;\\n\\n /// @inheritdoc IKeep3rJobOwnership\\n mapping(address => address) public override jobPendingOwner;\\n\\n /// @inheritdoc IKeep3rJobOwnership\\n function changeJobOwnership(address _job, address _newOwner) external override onlyJobOwner(_job) {\\n jobPendingOwner[_job] = _newOwner;\\n emit JobOwnershipChange(_job, jobOwner[_job], _newOwner);\\n }\\n\\n /// @inheritdoc IKeep3rJobOwnership\\n function acceptJobOwnership(address _job) external override onlyPendingJobOwner(_job) {\\n address _previousOwner = jobOwner[_job];\\n\\n jobOwner[_job] = jobPendingOwner[_job];\\n delete jobPendingOwner[_job];\\n\\n emit JobOwnershipAssent(msg.sender, _job, _previousOwner);\\n }\\n\\n modifier onlyJobOwner(address _job) {\\n if (msg.sender != jobOwner[_job]) revert OnlyJobOwner();\\n _;\\n }\\n\\n modifier onlyPendingJobOwner(address _job) {\\n if (msg.sender != jobPendingOwner[_job]) revert OnlyPendingJobOwner();\\n _;\\n }\\n}\\n\",\"keccak256\":\"0xa837590ade9cd5d25690e3f2d8b9a63e7202f7179b32e42eab4fa4c4324b9728\",\"license\":\"MIT\"},\"solidity/contracts/peripherals/jobs/Keep3rJobWorkable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4 <0.9.0;\\n\\nimport './Keep3rJobMigration.sol';\\nimport '../../../interfaces/IKeep3rHelper.sol';\\nimport '../../../interfaces/peripherals/IKeep3rJobs.sol';\\n\\nimport '@openzeppelin/contracts/token/ERC20/IERC20.sol';\\nimport '@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol';\\n\\nabstract contract Keep3rJobWorkable is IKeep3rJobWorkable, Keep3rJobMigration {\\n using EnumerableSet for EnumerableSet.AddressSet;\\n using SafeERC20 for IERC20;\\n\\n uint256 internal _initialGas;\\n\\n /// @inheritdoc IKeep3rJobWorkable\\n function isKeeper(address _keeper) external override returns (bool _isKeeper) {\\n _initialGas = _getGasLeft();\\n if (_keepers.contains(_keeper)) {\\n emit KeeperValidation(_initialGas);\\n return true;\\n }\\n }\\n\\n /// @inheritdoc IKeep3rJobWorkable\\n function isBondedKeeper(\\n address _keeper,\\n address _bond,\\n uint256 _minBond,\\n uint256 _earned,\\n uint256 _age\\n ) external override returns (bool _isBondedKeeper) {\\n _initialGas = _getGasLeft();\\n if (\\n _keepers.contains(_keeper) &&\\n bonds[_keeper][_bond] >= _minBond &&\\n workCompleted[_keeper] >= _earned &&\\n block.timestamp - firstSeen[_keeper] >= _age\\n ) {\\n emit KeeperValidation(_initialGas);\\n return true;\\n }\\n }\\n\\n /// @inheritdoc IKeep3rJobWorkable\\n function worked(address _keeper) external virtual override {\\n if (_initialGas == 0) revert GasNotInitialized();\\n address _job = msg.sender;\\n if (disputes[_job]) revert JobDisputed();\\n if (!_jobs.contains(_job)) revert JobUnapproved();\\n\\n if (_updateJobCreditsIfNeeded(_job)) {\\n emit LiquidityCreditsReward(_job, rewardedAt[_job], _jobLiquidityCredits[_job], _jobPeriodCredits[_job]);\\n }\\n\\n (uint256 _boost, uint256 _oneEthQuote, uint256 _extraGas) = IKeep3rHelper(keep3rHelper).getPaymentParams(bonds[_keeper][keep3rV1]);\\n\\n uint256 _gasLeft = _getGasLeft();\\n uint256 _payment = _calculatePayment(_gasLeft, _extraGas, _oneEthQuote, _boost);\\n\\n if (_payment > _jobLiquidityCredits[_job]) {\\n _rewardJobCredits(_job);\\n emit LiquidityCreditsReward(_job, rewardedAt[_job], _jobLiquidityCredits[_job], _jobPeriodCredits[_job]);\\n\\n _gasLeft = _getGasLeft();\\n _payment = _calculatePayment(_gasLeft, _extraGas, _oneEthQuote, _boost);\\n }\\n\\n _bondedPayment(_job, _keeper, _payment);\\n delete _initialGas;\\n\\n emit KeeperWork(keep3rV1, _job, _keeper, _payment, _gasLeft);\\n }\\n\\n /// @inheritdoc IKeep3rJobWorkable\\n function bondedPayment(address _keeper, uint256 _payment) external override {\\n address _job = msg.sender;\\n\\n if (disputes[_job]) revert JobDisputed();\\n if (!_jobs.contains(_job)) revert JobUnapproved();\\n\\n if (_updateJobCreditsIfNeeded(_job)) {\\n emit LiquidityCreditsReward(_job, rewardedAt[_job], _jobLiquidityCredits[_job], _jobPeriodCredits[_job]);\\n }\\n\\n if (_payment > _jobLiquidityCredits[_job]) {\\n _rewardJobCredits(_job);\\n emit LiquidityCreditsReward(_job, rewardedAt[_job], _jobLiquidityCredits[_job], _jobPeriodCredits[_job]);\\n }\\n\\n _bondedPayment(_job, _keeper, _payment);\\n emit KeeperWork(keep3rV1, _job, _keeper, _payment, _getGasLeft());\\n }\\n\\n /// @inheritdoc IKeep3rJobWorkable\\n function directTokenPayment(\\n address _token,\\n address _keeper,\\n uint256 _amount\\n ) external override {\\n address _job = msg.sender;\\n\\n if (disputes[_job]) revert JobDisputed();\\n if (disputes[_keeper]) revert Disputed();\\n if (!_jobs.contains(_job)) revert JobUnapproved();\\n if (jobTokenCredits[_job][_token] < _amount) revert InsufficientFunds();\\n jobTokenCredits[_job][_token] -= _amount;\\n IERC20(_token).safeTransfer(_keeper, _amount);\\n emit KeeperWork(_token, _job, _keeper, _amount, _getGasLeft());\\n }\\n\\n function _bondedPayment(\\n address _job,\\n address _keeper,\\n uint256 _payment\\n ) internal {\\n if (_payment > _jobLiquidityCredits[_job]) revert InsufficientFunds();\\n\\n workedAt[_job] = block.timestamp;\\n _jobLiquidityCredits[_job] -= _payment;\\n bonds[_keeper][keep3rV1] += _payment;\\n workCompleted[_keeper] += _payment;\\n totalBonds += _payment;\\n }\\n\\n /// @notice Calculate amount to be payed in KP3R, taking into account multiple parameters\\n /// @param _gasLeft Amount of gas left after working the job\\n /// @param _extraGas Amount of expected unaccounted gas\\n /// @param _oneEthQuote Amount of KP3R equivalent to 1 ETH\\n /// @param _boost Reward given to the keeper for having bonded KP3R tokens\\n /// @return _payment Amount to be payed in KP3R tokens\\n function _calculatePayment(\\n uint256 _gasLeft,\\n uint256 _extraGas,\\n uint256 _oneEthQuote,\\n uint256 _boost\\n ) internal view returns (uint256 _payment) {\\n uint256 _accountedGas = _initialGas - _gasLeft + _extraGas;\\n _payment = (((_accountedGas * _boost) / _BASE) * _oneEthQuote) / 1 ether;\\n }\\n\\n /// @notice Return the gas left and add 1/64 in order to match real gas left at first level of depth (EIP-150)\\n /// @return _gasLeft Amount of gas left recording taking into account EIP-150\\n function _getGasLeft() internal view returns (uint256 _gasLeft) {\\n _gasLeft = (gasleft() * 64) / 63;\\n }\\n}\\n\",\"keccak256\":\"0x7e113a0815d9125e760ee75c9d9c55fc93192ae2535afccdb8835984d17b510f\",\"license\":\"MIT\"},\"solidity/contracts/peripherals/jobs/Keep3rJobs.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4 <0.9.0;\\n\\nimport '../../../interfaces/peripherals/IKeep3rJobs.sol';\\nimport './Keep3rJobManager.sol';\\nimport './Keep3rJobWorkable.sol';\\nimport './Keep3rJobDisputable.sol';\\n\\nabstract contract Keep3rJobs is IKeep3rJobs, Keep3rJobManager, Keep3rJobWorkable, Keep3rJobDisputable {}\\n\",\"keccak256\":\"0x882e1a19891795de04c4c891dc58d50034ca0a32c8b61651aaf0f47d0bc321d4\",\"license\":\"MIT\"},\"solidity/contracts/peripherals/keepers/Keep3rKeeperDisputable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4 <0.9.0;\\n\\nimport './Keep3rKeeperFundable.sol';\\nimport '../Keep3rDisputable.sol';\\nimport '../../../interfaces/external/IKeep3rV1.sol';\\nimport '../../../interfaces/peripherals/IKeep3rKeepers.sol';\\n\\nabstract contract Keep3rKeeperDisputable is IKeep3rKeeperDisputable, Keep3rDisputable, Keep3rKeeperFundable {\\n using EnumerableSet for EnumerableSet.AddressSet;\\n using SafeERC20 for IERC20;\\n\\n /// @inheritdoc IKeep3rKeeperDisputable\\n function slash(\\n address _keeper,\\n address _bonded,\\n uint256 _bondAmount,\\n uint256 _unbondAmount\\n ) external override onlySlasher {\\n if (!disputes[_keeper]) revert NotDisputed();\\n _slash(_keeper, _bonded, _bondAmount, _unbondAmount);\\n emit KeeperSlash(_keeper, msg.sender, _bondAmount + _unbondAmount);\\n }\\n\\n /// @inheritdoc IKeep3rKeeperDisputable\\n function revoke(address _keeper) external override onlySlasher {\\n if (!disputes[_keeper]) revert NotDisputed();\\n _keepers.remove(_keeper);\\n _slash(_keeper, keep3rV1, bonds[_keeper][keep3rV1], pendingUnbonds[_keeper][keep3rV1]);\\n emit KeeperRevoke(_keeper, msg.sender);\\n }\\n\\n function _slash(\\n address _keeper,\\n address _bonded,\\n uint256 _bondAmount,\\n uint256 _unbondAmount\\n ) internal {\\n if (_bonded != keep3rV1) {\\n try IERC20(_bonded).transfer(governor, _bondAmount + _unbondAmount) returns (bool) {} catch (bytes memory) {}\\n }\\n bonds[_keeper][_bonded] -= _bondAmount;\\n pendingUnbonds[_keeper][_bonded] -= _unbondAmount;\\n }\\n}\\n\",\"keccak256\":\"0x4dba80c119fa75a3fa13b2c910b8e949154453ac9f1158539ec3f1149830890b\",\"license\":\"MIT\"},\"solidity/contracts/peripherals/keepers/Keep3rKeeperFundable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4 <0.9.0;\\n\\nimport '../Keep3rAccountance.sol';\\nimport '../Keep3rParameters.sol';\\nimport '../../../interfaces/peripherals/IKeep3rKeepers.sol';\\n\\nimport '../../../interfaces/external/IKeep3rV1.sol';\\n\\nimport '@openzeppelin/contracts/security/ReentrancyGuard.sol';\\nimport '@openzeppelin/contracts/token/ERC20/IERC20.sol';\\nimport '@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol';\\n\\nabstract contract Keep3rKeeperFundable is IKeep3rKeeperFundable, ReentrancyGuard, Keep3rParameters {\\n using EnumerableSet for EnumerableSet.AddressSet;\\n using SafeERC20 for IERC20;\\n\\n /// @inheritdoc IKeep3rKeeperFundable\\n function bond(address _bonding, uint256 _amount) external override nonReentrant {\\n if (disputes[msg.sender]) revert Disputed();\\n if (_jobs.contains(msg.sender)) revert AlreadyAJob();\\n canActivateAfter[msg.sender][_bonding] = block.timestamp + bondTime;\\n\\n uint256 _before = IERC20(_bonding).balanceOf(address(this));\\n IERC20(_bonding).safeTransferFrom(msg.sender, address(this), _amount);\\n _amount = IERC20(_bonding).balanceOf(address(this)) - _before;\\n\\n hasBonded[msg.sender] = true;\\n pendingBonds[msg.sender][_bonding] += _amount;\\n\\n emit Bonding(msg.sender, _bonding, _amount);\\n }\\n\\n /// @inheritdoc IKeep3rKeeperFundable\\n function activate(address _bonding) external override {\\n address _keeper = msg.sender;\\n if (disputes[_keeper]) revert Disputed();\\n uint256 _canActivateAfter = canActivateAfter[_keeper][_bonding];\\n if (_canActivateAfter == 0) revert BondsUnexistent();\\n if (_canActivateAfter >= block.timestamp) revert BondsLocked();\\n\\n if (firstSeen[_keeper] == 0) {\\n firstSeen[_keeper] = block.timestamp;\\n }\\n _keepers.add(_keeper);\\n\\n uint256 _amount = pendingBonds[_keeper][_bonding];\\n delete pendingBonds[_keeper][_bonding];\\n\\n // bond provided tokens\\n bonds[_keeper][_bonding] += _amount;\\n if (_bonding == keep3rV1) {\\n totalBonds += _amount;\\n _depositBonds(_amount);\\n }\\n\\n emit Activation(_keeper, _bonding, _amount);\\n }\\n\\n /// @inheritdoc IKeep3rKeeperFundable\\n function unbond(address _bonding, uint256 _amount) external override {\\n canWithdrawAfter[msg.sender][_bonding] = block.timestamp + unbondTime;\\n bonds[msg.sender][_bonding] -= _amount;\\n pendingUnbonds[msg.sender][_bonding] += _amount;\\n\\n emit Unbonding(msg.sender, _bonding, _amount);\\n }\\n\\n /// @inheritdoc IKeep3rKeeperFundable\\n function withdraw(address _bonding) external override nonReentrant {\\n if (pendingUnbonds[msg.sender][_bonding] == 0) revert UnbondsUnexistent();\\n if (canWithdrawAfter[msg.sender][_bonding] >= block.timestamp) revert UnbondsLocked();\\n if (disputes[msg.sender]) revert Disputed();\\n\\n uint256 _amount = pendingUnbonds[msg.sender][_bonding];\\n\\n delete pendingUnbonds[msg.sender][_bonding];\\n delete canWithdrawAfter[msg.sender][_bonding];\\n\\n if (_bonding == keep3rV1) _mint(_amount);\\n IERC20(_bonding).safeTransfer(msg.sender, _amount);\\n\\n emit Withdrawal(msg.sender, _bonding, _amount);\\n }\\n\\n function _depositBonds(uint256 _amount) internal virtual {\\n IKeep3rV1(keep3rV1).burn(_amount);\\n }\\n}\\n\",\"keccak256\":\"0x121dc11fa555731679912d54da3bb8282d26ad425deffae6d4d7085ef3c9290d\",\"license\":\"MIT\"},\"solidity/contracts/peripherals/keepers/Keep3rKeepers.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4 <0.9.0;\\n\\nimport '../../../interfaces/peripherals/IKeep3rKeepers.sol';\\nimport './Keep3rKeeperDisputable.sol';\\n\\nabstract contract Keep3rKeepers is IKeep3rKeepers, Keep3rKeeperDisputable {}\\n\",\"keccak256\":\"0xfc762d9fd6ff478acba446c3ab6fc19c7d49a85de097dc35f02c56e928153c5e\",\"license\":\"MIT\"},\"solidity/for-test/testnet/Keep3rForTestnet.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4 <0.9.0;\\n\\nimport '../../contracts/Keep3r.sol';\\n\\ncontract Keep3rForTestnet is Keep3r {\\n constructor(\\n address _governor,\\n address _keep3rHelper,\\n address _keep3rV1,\\n address _keep3rV1Proxy\\n ) Keep3r(_governor, _keep3rHelper, _keep3rV1, _keep3rV1Proxy) {\\n bondTime = 0; // allows keepers to instantly register\\n unbondTime = 0; // allows keepers & jobOwners to instantly withdraw funds\\n liquidityMinimum = 1; // allows job providers to add low liquidity\\n rewardPeriodTime = 1 days; // reduces twap calculation period\\n inflationPeriod = 5 days; // increases credit minting\\n }\\n}\\n\",\"keccak256\":\"0x503da15cbb0ecd0d74624613583033cd259de3e4d220c9092c26f836a5918f80\",\"license\":\"MIT\"},\"solidity/interfaces/IKeep3r.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4 <0.9.0;\\n\\nimport './peripherals/IKeep3rJobs.sol';\\nimport './peripherals/IKeep3rKeepers.sol';\\nimport './peripherals/IKeep3rParameters.sol';\\n\\n// solhint-disable-next-line no-empty-blocks\\n\\n/// @title Keep3rV2 contract\\n/// @notice This contract inherits all the functionality of Keep3rV2\\ninterface IKeep3r is IKeep3rJobs, IKeep3rKeepers, IKeep3rParameters {\\n\\n}\\n\",\"keccak256\":\"0x273a39984c1475c60182e636bb91a1b89ec98646a036cac6a87067869b3adeb9\",\"license\":\"MIT\"},\"solidity/interfaces/IKeep3rHelper.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4 <0.9.0;\\n\\nimport './IKeep3rHelperParameters.sol';\\n\\n/// @title Keep3rHelper contract\\n/// @notice Contains all the helper functions used throughout the different files.\\ninterface IKeep3rHelper is IKeep3rHelperParameters {\\n // Errors\\n\\n /// @notice Throws when none of the tokens in the liquidity pair is KP3R\\n error LiquidityPairInvalid();\\n\\n // Methods\\n // solhint-enable func-name-mixedcase\\n\\n /// @notice Calculates the amount of KP3R that corresponds to the ETH passed into the function\\n /// @dev This function allows us to calculate how much KP3R we should pay to a keeper for things expressed in ETH, like gas\\n /// @param _eth The amount of ETH\\n /// @return _amountOut The amount of KP3R\\n function quote(uint256 _eth) external view returns (uint256 _amountOut);\\n\\n /// @notice Returns the amount of KP3R the keeper has bonded\\n /// @param _keeper The address of the keeper to check\\n /// @return _amountBonded The amount of KP3R the keeper has bonded\\n function bonds(address _keeper) external view returns (uint256 _amountBonded);\\n\\n /// @notice Calculates the reward (in KP3R) that corresponds to a keeper for using gas\\n /// @param _keeper The address of the keeper to check\\n /// @param _gasUsed The amount of gas used that will be rewarded\\n /// @return _kp3r The amount of KP3R that should be awarded to the keeper\\n function getRewardAmountFor(address _keeper, uint256 _gasUsed) external view returns (uint256 _kp3r);\\n\\n /// @notice Calculates the boost in the reward given to a keeper based on the amount of KP3R that keeper has bonded\\n /// @dev If the keeper has no bonds, boost should be +10% of gas cost, if keeper has max bonds, +20%\\n /// @param _bonds The amount of KP3R tokens bonded by the keeper\\n /// @return _rewardBoost The reward boost that corresponds to the keeper\\n function getRewardBoostFor(uint256 _bonds) external view returns (uint256 _rewardBoost);\\n\\n /// @notice Calculates the reward (in KP3R) that corresponds to tx.origin for using gas\\n /// @param _gasUsed The amount of gas used that will be rewarded\\n /// @return _amount The amount of KP3R that should be awarded to tx.origin\\n function getRewardAmount(uint256 _gasUsed) external view returns (uint256 _amount);\\n\\n /// @notice Given a pool address, returns the underlying tokens of the pair\\n /// @param _pool Address of the correspondant pool\\n /// @return _token0 Address of the first token of the pair\\n /// @return _token1 Address of the second token of the pair\\n function getPoolTokens(address _pool) external view returns (address _token0, address _token1);\\n\\n /// @notice Defines the order of the tokens in the pair for twap calculations\\n /// @param _pool Address of the correspondant pool\\n /// @return _isKP3RToken0 Boolean indicating the order of the tokens in the pair\\n function isKP3RToken0(address _pool) external view returns (bool _isKP3RToken0);\\n\\n /// @notice Given an array of secondsAgo, returns UniswapV3 pool cumulatives at that moment\\n /// @param _pool Address of the pool to observe\\n /// @param _secondsAgo Array with time references to observe\\n /// @return _tickCumulative1 Cumulative sum of ticks until first time reference\\n /// @return _tickCumulative2 Cumulative sum of ticks until second time reference\\n /// @return _success Boolean indicating if the observe call was succesfull\\n function observe(address _pool, uint32[] memory _secondsAgo)\\n external\\n view\\n returns (\\n int56 _tickCumulative1,\\n int56 _tickCumulative2,\\n bool _success\\n );\\n\\n /// @notice Get multiplier, quote, and extra, in order to calculate keeper payment\\n /// @param _bonds Amount of bonded KP3R owned by the keeper\\n /// @return _boost Multiplier per gas unit. Takes into account the base fee and the amount of bonded KP3R\\n /// @return _oneEthQuote Amount of KP3R tokens equivalent to 1 ETH\\n /// @return _extra Amount of extra gas that should be added to the gas spent\\n function getPaymentParams(uint256 _bonds)\\n external\\n view\\n returns (\\n uint256 _boost,\\n uint256 _oneEthQuote,\\n uint256 _extra\\n );\\n\\n /// @notice Given a tick and a liquidity amount, calculates the underlying KP3R tokens\\n /// @param _liquidityAmount Amount of liquidity to be converted\\n /// @param _tickDifference Tick value used to calculate the quote\\n /// @param _timeInterval Time value used to calculate the quote\\n /// @return _kp3rAmount Amount of KP3R tokens underlying on the given liquidity\\n function getKP3RsAtTick(\\n uint256 _liquidityAmount,\\n int56 _tickDifference,\\n uint256 _timeInterval\\n ) external pure returns (uint256 _kp3rAmount);\\n\\n /// @notice Given a tick and a token amount, calculates the output in correspondant token\\n /// @param _baseAmount Amount of token to be converted\\n /// @param _tickDifference Tick value used to calculate the quote\\n /// @param _timeInterval Time value used to calculate the quote\\n /// @return _quoteAmount Amount of credits deserved for the baseAmount at the tick value\\n function getQuoteAtTick(\\n uint128 _baseAmount,\\n int56 _tickDifference,\\n uint256 _timeInterval\\n ) external pure returns (uint256 _quoteAmount);\\n}\\n\",\"keccak256\":\"0x67817dc98fde9b3a917e25bc16fe60a91772dd5a77e0ce22a208b66b29d3ad8e\",\"license\":\"MIT\"},\"solidity/interfaces/IKeep3rHelperParameters.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4 <0.9.0;\\n\\n/// @title Keep3rHelperParameters contract\\n/// @notice Contains all the helper functions used throughout the different files.\\ninterface IKeep3rHelperParameters {\\n // Structs\\n\\n /// @dev KP3R-WETH Pool address and isKP3RToken0\\n /// @dev Created in order to save gas by avoiding calls to pool's token0 method\\n struct Kp3rWethOraclePool {\\n address poolAddress;\\n bool isKP3RToken0;\\n }\\n\\n // Errors\\n\\n /// @notice Throws when pool does not have KP3R as token0 nor token1\\n error InvalidOraclePool();\\n\\n // Events\\n\\n /// @notice Emitted when the kp3r weth pool is changed\\n /// @param _address Address of the new kp3r weth pool\\n /// @param _isKP3RToken0 True if calling the token0 method of the pool returns the KP3R token address\\n event Kp3rWethPoolChange(address _address, bool _isKP3RToken0);\\n\\n /// @notice Emitted when the minimum boost multiplier is changed\\n /// @param _minBoost The minimum boost multiplier\\n event MinBoostChange(uint256 _minBoost);\\n\\n /// @notice Emitted when the maximum boost multiplier is changed\\n /// @param _maxBoost The maximum boost multiplier\\n event MaxBoostChange(uint256 _maxBoost);\\n\\n /// @notice Emitted when the target bond amount is changed\\n /// @param _targetBond The target bond amount\\n event TargetBondChange(uint256 _targetBond);\\n\\n /// @notice Emitted when the Keep3r V2 address is changed\\n /// @param _keep3rV2 The address of Keep3r V2\\n event Keep3rV2Change(address _keep3rV2);\\n\\n /// @notice Emitted when the work extra gas amount is changed\\n /// @param _workExtraGas The work extra gas\\n event WorkExtraGasChange(uint256 _workExtraGas);\\n\\n /// @notice Emitted when the quote twap time is changed\\n /// @param _quoteTwapTime The twap time for quoting\\n event QuoteTwapTimeChange(uint32 _quoteTwapTime);\\n\\n /// @notice Emitted when minimum rewarded gas fee is changed\\n /// @param _minBaseFee The minimum rewarded gas fee\\n event MinBaseFeeChange(uint256 _minBaseFee);\\n\\n /// @notice Emitted when minimum rewarded priority fee is changed\\n /// @param _minPriorityFee The minimum expected fee that the keeper should pay\\n event MinPriorityFeeChange(uint256 _minPriorityFee);\\n\\n // Variables\\n\\n /// @notice Address of KP3R token\\n /// @return _kp3r Address of KP3R token\\n // solhint-disable func-name-mixedcase\\n function KP3R() external view returns (address _kp3r);\\n\\n /// @notice The boost base used to calculate the boost rewards for the keeper\\n /// @return _base The boost base number\\n function BOOST_BASE() external view returns (uint256 _base);\\n\\n /// @notice KP3R-WETH pool that is being used as oracle\\n /// @return poolAddress Address of the pool\\n /// @return isKP3RToken0 True if calling the token0 method of the pool returns the KP3R token address\\n function kp3rWethPool() external view returns (address poolAddress, bool isKP3RToken0);\\n\\n /// @notice The minimum multiplier used to calculate the amount of gas paid to the Keeper for the gas used to perform a job\\n /// For example: if the quoted gas used is 1000, then the minimum amount to be paid will be 1000 * minBoost / BOOST_BASE\\n /// @return _multiplier The minimum boost multiplier\\n function minBoost() external view returns (uint256 _multiplier);\\n\\n /// @notice The maximum multiplier used to calculate the amount of gas paid to the Keeper for the gas used to perform a job\\n /// For example: if the quoted gas used is 1000, then the maximum amount to be paid will be 1000 * maxBoost / BOOST_BASE\\n /// @return _multiplier The maximum boost multiplier\\n function maxBoost() external view returns (uint256 _multiplier);\\n\\n /// @notice The targeted amount of bonded KP3Rs to max-up reward multiplier\\n /// For example: if the amount of KP3R the keeper has bonded is targetBond or more, then the keeper will get\\n /// the maximum boost possible in his rewards, if it's less, the reward boost will be proportional\\n /// @return _target The amount of KP3R that comforms the targetBond\\n function targetBond() external view returns (uint256 _target);\\n\\n /// @notice The amount of unaccounted gas that is going to be added to keeper payments\\n /// @return _workExtraGas The work unaccounted gas amount\\n function workExtraGas() external view returns (uint256 _workExtraGas);\\n\\n /// @notice The twap time for quoting\\n /// @return _quoteTwapTime The twap time\\n function quoteTwapTime() external view returns (uint32 _quoteTwapTime);\\n\\n /// @notice The minimum base fee that is used to calculate keeper rewards\\n /// @return _minBaseFee The minimum rewarded gas fee\\n function minBaseFee() external view returns (uint256 _minBaseFee);\\n\\n /// @notice The minimum priority fee that is also rewarded for keepers\\n /// @return _minPriorityFee The minimum rewarded priority fee\\n function minPriorityFee() external view returns (uint256 _minPriorityFee);\\n\\n /// @notice Address of Keep3r V2\\n /// @return _keep3rV2 Address of Keep3r V2\\n function keep3rV2() external view returns (address _keep3rV2);\\n\\n // Methods\\n\\n /// @notice Sets KP3R-WETH pool\\n /// @param _poolAddress The address of the KP3R-WETH pool\\n function setKp3rWethPool(address _poolAddress) external;\\n\\n /// @notice Sets the minimum boost multiplier\\n /// @param _minBoost The minimum boost multiplier\\n function setMinBoost(uint256 _minBoost) external;\\n\\n /// @notice Sets the maximum boost multiplier\\n /// @param _maxBoost The maximum boost multiplier\\n function setMaxBoost(uint256 _maxBoost) external;\\n\\n /// @notice Sets the target bond amount\\n /// @param _targetBond The target bond amount\\n function setTargetBond(uint256 _targetBond) external;\\n\\n /// @notice Sets the Keep3r V2 address\\n /// @param _keep3rV2 The address of Keep3r V2\\n function setKeep3rV2(address _keep3rV2) external;\\n\\n /// @notice Sets the work extra gas amount\\n /// @param _workExtraGas The work extra gas\\n function setWorkExtraGas(uint256 _workExtraGas) external;\\n\\n /// @notice Sets the quote twap time\\n /// @param _quoteTwapTime The twap time for quoting\\n function setQuoteTwapTime(uint32 _quoteTwapTime) external;\\n\\n /// @notice Sets the minimum rewarded gas fee\\n /// @param _minBaseFee The minimum rewarded gas fee\\n function setMinBaseFee(uint256 _minBaseFee) external;\\n\\n /// @notice Sets the minimum rewarded gas priority fee\\n /// @param _minPriorityFee The minimum rewarded priority fee\\n function setMinPriorityFee(uint256 _minPriorityFee) external;\\n}\\n\",\"keccak256\":\"0xc571e913c0e3c02f4aa0b27090ca1608c85c68768dc2ab979f8aef7c731f60b2\",\"license\":\"MIT\"},\"solidity/interfaces/IPairManager.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4 <0.9.0;\\n\\nimport '@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol';\\n\\n/// @title Pair Manager interface\\n/// @notice Generic interface for Keep3r liquidity pools (kLP)\\ninterface IPairManager is IERC20Metadata {\\n /// @notice Address of the factory from which the pair manager was created\\n /// @return _factory The address of the PairManager Factory\\n function factory() external view returns (address _factory);\\n\\n /// @notice Address of the pool from which the Keep3r pair manager will interact with\\n /// @return _pool The address of the pool\\n function pool() external view returns (address _pool);\\n\\n /// @notice Token0 of the pool\\n /// @return _token0 The address of token0\\n function token0() external view returns (address _token0);\\n\\n /// @notice Token1 of the pool\\n /// @return _token1 The address of token1\\n function token1() external view returns (address _token1);\\n}\\n\",\"keccak256\":\"0x345c312b340c5775fb8f68d89ce851c7f75522940bd9bc64f2301a3f8312636a\",\"license\":\"MIT\"},\"solidity/interfaces/external/IKeep3rV1.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4 <0.9.0;\\n\\nimport '@openzeppelin/contracts/token/ERC20/IERC20.sol';\\nimport '@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol';\\n\\n// solhint-disable func-name-mixedcase\\ninterface IKeep3rV1 is IERC20, IERC20Metadata {\\n // Structs\\n struct Checkpoint {\\n uint32 fromBlock;\\n uint256 votes;\\n }\\n\\n // Events\\n event DelegateChanged(address indexed _delegator, address indexed _fromDelegate, address indexed _toDelegate);\\n event DelegateVotesChanged(address indexed _delegate, uint256 _previousBalance, uint256 _newBalance);\\n event SubmitJob(address indexed _job, address indexed _liquidity, address indexed _provider, uint256 _block, uint256 _credit);\\n event ApplyCredit(address indexed _job, address indexed _liquidity, address indexed _provider, uint256 _block, uint256 _credit);\\n event RemoveJob(address indexed _job, address indexed _liquidity, address indexed _provider, uint256 _block, uint256 _credit);\\n event UnbondJob(address indexed _job, address indexed _liquidity, address indexed _provider, uint256 _block, uint256 _credit);\\n event JobAdded(address indexed _job, uint256 _block, address _governance);\\n event JobRemoved(address indexed _job, uint256 _block, address _governance);\\n event KeeperWorked(address indexed _credit, address indexed _job, address indexed _keeper, uint256 _block, uint256 _amount);\\n event KeeperBonding(address indexed _keeper, uint256 _block, uint256 _active, uint256 _bond);\\n event KeeperBonded(address indexed _keeper, uint256 _block, uint256 _activated, uint256 _bond);\\n event KeeperUnbonding(address indexed _keeper, uint256 _block, uint256 _deactive, uint256 _bond);\\n event KeeperUnbound(address indexed _keeper, uint256 _block, uint256 _deactivated, uint256 _bond);\\n event KeeperSlashed(address indexed _keeper, address indexed _slasher, uint256 _block, uint256 _slash);\\n event KeeperDispute(address indexed _keeper, uint256 _block);\\n event KeeperResolved(address indexed _keeper, uint256 _block);\\n event TokenCreditAddition(address indexed _credit, address indexed _job, address indexed _creditor, uint256 _block, uint256 _amount);\\n\\n // Variables\\n function KPRH() external returns (address);\\n\\n function delegates(address _delegator) external view returns (address);\\n\\n function checkpoints(address _account, uint32 _checkpoint) external view returns (Checkpoint memory);\\n\\n function numCheckpoints(address _account) external view returns (uint32);\\n\\n function DOMAIN_TYPEHASH() external returns (bytes32);\\n\\n function DOMAINSEPARATOR() external returns (bytes32);\\n\\n function DELEGATION_TYPEHASH() external returns (bytes32);\\n\\n function PERMIT_TYPEHASH() external returns (bytes32);\\n\\n function nonces(address _user) external view returns (uint256);\\n\\n function BOND() external returns (uint256);\\n\\n function UNBOND() external returns (uint256);\\n\\n function LIQUIDITYBOND() external returns (uint256);\\n\\n function FEE() external returns (uint256);\\n\\n function BASE() external returns (uint256);\\n\\n function ETH() external returns (address);\\n\\n function bondings(address _user, address _bonding) external view returns (uint256);\\n\\n function canWithdrawAfter(address _user, address _bonding) external view returns (uint256);\\n\\n function pendingUnbonds(address _keeper, address _bonding) external view returns (uint256);\\n\\n function pendingbonds(address _keeper, address _bonding) external view returns (uint256);\\n\\n function bonds(address _keeper, address _bonding) external view returns (uint256);\\n\\n function votes(address _delegator) external view returns (uint256);\\n\\n function firstSeen(address _keeper) external view returns (uint256);\\n\\n function disputes(address _keeper) external view returns (bool);\\n\\n function lastJob(address _keeper) external view returns (uint256);\\n\\n function workCompleted(address _keeper) external view returns (uint256);\\n\\n function jobs(address _job) external view returns (bool);\\n\\n function credits(address _job, address _credit) external view returns (uint256);\\n\\n function liquidityProvided(\\n address _provider,\\n address _liquidity,\\n address _job\\n ) external view returns (uint256);\\n\\n function liquidityUnbonding(\\n address _provider,\\n address _liquidity,\\n address _job\\n ) external view returns (uint256);\\n\\n function liquidityAmountsUnbonding(\\n address _provider,\\n address _liquidity,\\n address _job\\n ) external view returns (uint256);\\n\\n function jobProposalDelay(address _job) external view returns (uint256);\\n\\n function liquidityApplied(\\n address _provider,\\n address _liquidity,\\n address _job\\n ) external view returns (uint256);\\n\\n function liquidityAmount(\\n address _provider,\\n address _liquidity,\\n address _job\\n ) external view returns (uint256);\\n\\n function keepers(address _keeper) external view returns (bool);\\n\\n function blacklist(address _keeper) external view returns (bool);\\n\\n function keeperList(uint256 _index) external view returns (address);\\n\\n function jobList(uint256 _index) external view returns (address);\\n\\n function governance() external returns (address);\\n\\n function pendingGovernance() external returns (address);\\n\\n function liquidityAccepted(address _liquidity) external view returns (bool);\\n\\n function liquidityPairs(uint256 _index) external view returns (address);\\n\\n // Methods\\n function getCurrentVotes(address _account) external view returns (uint256);\\n\\n function addCreditETH(address _job) external payable;\\n\\n function addCredit(\\n address _credit,\\n address _job,\\n uint256 _amount\\n ) external;\\n\\n function addVotes(address _voter, uint256 _amount) external;\\n\\n function removeVotes(address _voter, uint256 _amount) external;\\n\\n function addKPRCredit(address _job, uint256 _amount) external;\\n\\n function approveLiquidity(address _liquidity) external;\\n\\n function revokeLiquidity(address _liquidity) external;\\n\\n function pairs() external view returns (address[] memory);\\n\\n function addLiquidityToJob(\\n address _liquidity,\\n address _job,\\n uint256 _amount\\n ) external;\\n\\n function applyCreditToJob(\\n address _provider,\\n address _liquidity,\\n address _job\\n ) external;\\n\\n function unbondLiquidityFromJob(\\n address _liquidity,\\n address _job,\\n uint256 _amount\\n ) external;\\n\\n function removeLiquidityFromJob(address _liquidity, address _job) external;\\n\\n function mint(uint256 _amount) external;\\n\\n function burn(uint256 _amount) external;\\n\\n function worked(address _keeper) external;\\n\\n function receipt(\\n address _credit,\\n address _keeper,\\n uint256 _amount\\n ) external;\\n\\n function receiptETH(address _keeper, uint256 _amount) external;\\n\\n function addJob(address _job) external;\\n\\n function getJobs() external view returns (address[] memory);\\n\\n function removeJob(address _job) external;\\n\\n function setKeep3rHelper(address _keep3rHelper) external;\\n\\n function setGovernance(address _governance) external;\\n\\n function acceptGovernance() external;\\n\\n function isKeeper(address _keeper) external returns (bool);\\n\\n function isMinKeeper(\\n address _keeper,\\n uint256 _minBond,\\n uint256 _earned,\\n uint256 _age\\n ) external returns (bool);\\n\\n function isBondedKeeper(\\n address _keeper,\\n address _bond,\\n uint256 _minBond,\\n uint256 _earned,\\n uint256 _age\\n ) external returns (bool);\\n\\n function bond(address _bonding, uint256 _amount) external;\\n\\n function getKeepers() external view returns (address[] memory);\\n\\n function activate(address _bonding) external;\\n\\n function unbond(address _bonding, uint256 _amount) external;\\n\\n function slash(\\n address _bonded,\\n address _keeper,\\n uint256 _amount\\n ) external;\\n\\n function withdraw(address _bonding) external;\\n\\n function dispute(address _keeper) external;\\n\\n function revoke(address _keeper) external;\\n\\n function resolve(address _keeper) external;\\n\\n function permit(\\n address _owner,\\n address _spender,\\n uint256 _amount,\\n uint256 _deadline,\\n uint8 _v,\\n bytes32 _r,\\n bytes32 _s\\n ) external;\\n}\\n\",\"keccak256\":\"0xa9806cd6666ab1b7375ef72446964a72397fd4cefc7cc8c5b37caa7c50df0246\",\"license\":\"MIT\"},\"solidity/interfaces/external/IKeep3rV1Proxy.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4 <0.9.0;\\n\\nimport '@defi-wonderland/solidity-utils/solidity/interfaces/IBaseErrors.sol';\\n\\ninterface IKeep3rV1Proxy is IBaseErrors {\\n // Structs\\n struct Recipient {\\n address recipient;\\n uint256 caps;\\n }\\n\\n // Variables\\n function keep3rV1() external view returns (address);\\n\\n function governance() external view returns (address);\\n\\n function pendingGovernance() external view returns (address);\\n\\n function minter() external view returns (address);\\n\\n function next(address) external view returns (uint256);\\n\\n function caps(address) external view returns (uint256);\\n\\n function recipients() external view returns (address[] memory);\\n\\n function recipientsCaps() external view returns (Recipient[] memory);\\n\\n // Errors\\n error Cooldown();\\n error NoDrawableAmount();\\n error OnlyMinter();\\n error OnlyGovernance();\\n error OnlyPendingGovernance();\\n\\n // Methods\\n function addRecipient(address recipient, uint256 amount) external;\\n\\n function removeRecipient(address recipient) external;\\n\\n function draw() external returns (uint256 _amount);\\n\\n function setKeep3rV1(address _keep3rV1) external;\\n\\n function setMinter(address _minter) external;\\n\\n function mint(uint256 _amount) external;\\n\\n function mint(address _account, uint256 _amount) external;\\n\\n function setGovernance(address _governance) external;\\n\\n function acceptGovernance() external;\\n\\n function setKeep3rV1Governance(address _governance) external;\\n\\n function acceptKeep3rV1Governance() external;\\n\\n function dispute(address _keeper) external;\\n\\n function slash(\\n address _bonded,\\n address _keeper,\\n uint256 _amount\\n ) external;\\n\\n function revoke(address _keeper) external;\\n\\n function resolve(address _keeper) external;\\n\\n function addJob(address _job) external;\\n\\n function removeJob(address _job) external;\\n\\n function addKPRCredit(address _job, uint256 _amount) external;\\n\\n function approveLiquidity(address _liquidity) external;\\n\\n function revokeLiquidity(address _liquidity) external;\\n\\n function setKeep3rHelper(address _keep3rHelper) external;\\n\\n function addVotes(address _voter, uint256 _amount) external;\\n\\n function removeVotes(address _voter, uint256 _amount) external;\\n}\\n\",\"keccak256\":\"0x8d00752ec08a8e550cbcccd7c1032a4cb95e58cdfa9f977cf7f1e00b637f0d95\",\"license\":\"MIT\"},\"solidity/interfaces/peripherals/IKeep3rAccountance.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4 <0.9.0;\\n\\nimport './IKeep3rRoles.sol';\\n\\n/// @title Keep3rDisputable contract\\n/// @notice Disputes keepers, or if they're already disputed, it can resolve the case\\n/// @dev Argument `bonding` can be the address of either a token or a liquidity\\ninterface IKeep3rAccountance is IKeep3rRoles {\\n // Events\\n\\n /// @notice Emitted when the bonding process of a new keeper begins\\n /// @param _keeper The caller of Keep3rKeeperFundable#bond function\\n /// @param _bonding The asset the keeper has bonded\\n /// @param _amount The amount the keeper has bonded\\n event Bonding(address indexed _keeper, address indexed _bonding, uint256 _amount);\\n\\n /// @notice Emitted when a keeper or job begins the unbonding process to withdraw the funds\\n /// @param _keeperOrJob The keeper or job that began the unbonding process\\n /// @param _unbonding The liquidity pair or asset being unbonded\\n /// @param _amount The amount being unbonded\\n event Unbonding(address indexed _keeperOrJob, address indexed _unbonding, uint256 _amount);\\n\\n // Variables\\n\\n /// @notice Tracks the total amount of bonded KP3Rs in the contract\\n /// @return _totalBonds The total amount of bonded KP3Rs in the contract\\n function totalBonds() external view returns (uint256 _totalBonds);\\n\\n /// @notice Tracks the total KP3R earnings of a keeper since it started working\\n /// @param _keeper The address of the keeper\\n /// @return _workCompleted Total KP3R earnings of a keeper since it started working\\n function workCompleted(address _keeper) external view returns (uint256 _workCompleted);\\n\\n /// @notice Tracks when a keeper was first registered\\n /// @param _keeper The address of the keeper\\n /// @return timestamp The time at which the keeper was first registered\\n function firstSeen(address _keeper) external view returns (uint256 timestamp);\\n\\n /// @notice Tracks if a keeper or job has a pending dispute\\n /// @param _keeperOrJob The address of the keeper or job\\n /// @return _disputed Whether a keeper or job has a pending dispute\\n function disputes(address _keeperOrJob) external view returns (bool _disputed);\\n\\n /// @notice Tracks how much a keeper has bonded of a certain token\\n /// @param _keeper The address of the keeper\\n /// @param _bond The address of the token being bonded\\n /// @return _bonds Amount of a certain token that a keeper has bonded\\n function bonds(address _keeper, address _bond) external view returns (uint256 _bonds);\\n\\n /// @notice The current token credits available for a job\\n /// @param _job The address of the job\\n /// @param _token The address of the token bonded\\n /// @return _amount The amount of token credits available for a job\\n function jobTokenCredits(address _job, address _token) external view returns (uint256 _amount);\\n\\n /// @notice Tracks the amount of assets deposited in pending bonds\\n /// @param _keeper The address of the keeper\\n /// @param _bonding The address of the token being bonded\\n /// @return _pendingBonds Amount of a certain asset a keeper has unbonding\\n function pendingBonds(address _keeper, address _bonding) external view returns (uint256 _pendingBonds);\\n\\n /// @notice Tracks when a bonding for a keeper can be activated\\n /// @param _keeper The address of the keeper\\n /// @param _bonding The address of the token being bonded\\n /// @return _timestamp Time at which the bonding for a keeper can be activated\\n function canActivateAfter(address _keeper, address _bonding) external view returns (uint256 _timestamp);\\n\\n /// @notice Tracks when keeper bonds are ready to be withdrawn\\n /// @param _keeper The address of the keeper\\n /// @param _bonding The address of the token being unbonded\\n /// @return _timestamp Time at which the keeper bonds are ready to be withdrawn\\n function canWithdrawAfter(address _keeper, address _bonding) external view returns (uint256 _timestamp);\\n\\n /// @notice Tracks how much keeper bonds are to be withdrawn\\n /// @param _keeper The address of the keeper\\n /// @param _bonding The address of the token being unbonded\\n /// @return _pendingUnbonds The amount of keeper bonds that are to be withdrawn\\n function pendingUnbonds(address _keeper, address _bonding) external view returns (uint256 _pendingUnbonds);\\n\\n /// @notice Checks whether the address has ever bonded an asset\\n /// @param _keeper The address of the keeper\\n /// @return _hasBonded Whether the address has ever bonded an asset\\n function hasBonded(address _keeper) external view returns (bool _hasBonded);\\n\\n // Methods\\n\\n /// @notice Lists all jobs\\n /// @return _jobList Array with all the jobs in _jobs\\n function jobs() external view returns (address[] memory _jobList);\\n\\n /// @notice Lists all keepers\\n /// @return _keeperList Array with all the keepers in _keepers\\n function keepers() external view returns (address[] memory _keeperList);\\n\\n // Errors\\n\\n /// @notice Throws when an address is passed as a job, but that address is not a job\\n error JobUnavailable();\\n\\n /// @notice Throws when an action that requires an undisputed job is applied on a disputed job\\n error JobDisputed();\\n}\\n\",\"keccak256\":\"0xf4748c236ddf409e45e7169c735e2fc54e627b2b3ccd189ebb438ad768f1deb1\",\"license\":\"MIT\"},\"solidity/interfaces/peripherals/IKeep3rDisputable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4 <0.9.0;\\n\\n/// @title Keep3rDisputable contract\\n/// @notice Creates/resolves disputes for jobs or keepers\\n/// A disputed keeper is slashable and is not able to bond, activate, withdraw or receive direct payments\\n/// A disputed job is slashable and is not able to pay the keepers, withdraw tokens or to migrate\\ninterface IKeep3rDisputable {\\n /// @notice Emitted when a keeper or a job is disputed\\n /// @param _jobOrKeeper The address of the disputed keeper/job\\n /// @param _disputer The user that called the function and disputed the keeper\\n event Dispute(address indexed _jobOrKeeper, address indexed _disputer);\\n\\n /// @notice Emitted when a dispute is resolved\\n /// @param _jobOrKeeper The address of the disputed keeper/job\\n /// @param _resolver The user that called the function and resolved the dispute\\n event Resolve(address indexed _jobOrKeeper, address indexed _resolver);\\n\\n /// @notice Throws when a job or keeper is already disputed\\n error AlreadyDisputed();\\n\\n /// @notice Throws when a job or keeper is not disputed and someone tries to resolve the dispute\\n error NotDisputed();\\n\\n /// @notice Allows governor to create a dispute for a given keeper/job\\n /// @param _jobOrKeeper The address in dispute\\n function dispute(address _jobOrKeeper) external;\\n\\n /// @notice Allows governor to resolve a dispute on a keeper/job\\n /// @param _jobOrKeeper The address cleared\\n function resolve(address _jobOrKeeper) external;\\n}\\n\",\"keccak256\":\"0xdfdabcecbed06fcb2eb1b80e6a61d681afecd1f75c58a888451de7927b10c3b2\",\"license\":\"MIT\"},\"solidity/interfaces/peripherals/IKeep3rJobs.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4 <0.9.0;\\n\\nimport './IKeep3rDisputable.sol';\\n\\n/// @title Keep3rJobOwnership contract\\n/// @notice Handles the ownership of the jobs\\ninterface IKeep3rJobOwnership {\\n // Events\\n\\n /// @notice Emitted when Keep3rJobOwnership#changeJobOwnership is called\\n /// @param _job The address of the job proposed to have a change of owner\\n /// @param _owner The current owner of the job\\n /// @param _pendingOwner The new address proposed to be the owner of the job\\n event JobOwnershipChange(address indexed _job, address indexed _owner, address indexed _pendingOwner);\\n\\n /// @notice Emitted when Keep3rJobOwnership#JobOwnershipAssent is called\\n /// @param _job The address of the job which the proposed owner will now own\\n /// @param _previousOwner The previous owner of the job\\n /// @param _newOwner The new owner of the job\\n event JobOwnershipAssent(address indexed _job, address indexed _previousOwner, address indexed _newOwner);\\n\\n // Errors\\n\\n /// @notice Throws when the caller of the function is not the job owner\\n error OnlyJobOwner();\\n\\n /// @notice Throws when the caller of the function is not the pending job owner\\n error OnlyPendingJobOwner();\\n\\n // Variables\\n\\n /// @notice Maps the job to the owner of the job\\n /// @param _job The address of the job\\n /// @return _owner The address of the owner of the job\\n function jobOwner(address _job) external view returns (address _owner);\\n\\n /// @notice Maps the job to its pending owner\\n /// @param _job The address of the job\\n /// @return _pendingOwner The address of the pending owner of the job\\n function jobPendingOwner(address _job) external view returns (address _pendingOwner);\\n\\n // Methods\\n\\n /// @notice Proposes a new address to be the owner of the job\\n /// @param _job The address of the job\\n /// @param _newOwner The address of the proposed new owner\\n function changeJobOwnership(address _job, address _newOwner) external;\\n\\n /// @notice The proposed address accepts to be the owner of the job\\n /// @param _job The address of the job\\n function acceptJobOwnership(address _job) external;\\n}\\n\\n/// @title Keep3rJobManager contract\\n/// @notice Handles the addition and withdrawal of credits from a job\\ninterface IKeep3rJobManager is IKeep3rJobOwnership {\\n // Events\\n\\n /// @notice Emitted when Keep3rJobManager#addJob is called\\n /// @param _job The address of the job to add\\n /// @param _jobOwner The job's owner\\n event JobAddition(address indexed _job, address indexed _jobOwner);\\n\\n // Errors\\n\\n /// @notice Throws when trying to add a job that has already been added\\n error JobAlreadyAdded();\\n\\n /// @notice Throws when the address that is trying to register as a keeper is already a keeper\\n error AlreadyAKeeper();\\n\\n // Methods\\n\\n /// @notice Allows any caller to add a new job\\n /// @param _job Address of the contract for which work should be performed\\n function addJob(address _job) external;\\n}\\n\\n/// @title Keep3rJobFundableCredits contract\\n/// @notice Handles the addition and withdrawal of credits from a job\\ninterface IKeep3rJobFundableCredits is IKeep3rJobOwnership {\\n // Events\\n\\n /// @notice Emitted when Keep3rJobFundableCredits#addTokenCreditsToJob is called\\n /// @param _job The address of the job being credited\\n /// @param _token The address of the token being provided\\n /// @param _provider The user that calls the function\\n /// @param _amount The amount of credit being added to the job\\n event TokenCreditAddition(address indexed _job, address indexed _token, address indexed _provider, uint256 _amount);\\n\\n /// @notice Emitted when Keep3rJobFundableCredits#withdrawTokenCreditsFromJob is called\\n /// @param _job The address of the job from which the credits are withdrawn\\n /// @param _token The credit being withdrawn from the job\\n /// @param _receiver The user that receives the tokens\\n /// @param _amount The amount of credit withdrawn\\n event TokenCreditWithdrawal(address indexed _job, address indexed _token, address indexed _receiver, uint256 _amount);\\n\\n // Errors\\n\\n /// @notice Throws when the token is KP3R, as it should not be used for direct token payments\\n error TokenUnallowed();\\n\\n /// @notice Throws when the token withdraw cooldown has not yet passed\\n error JobTokenCreditsLocked();\\n\\n /// @notice Throws when the user tries to withdraw more tokens than it has\\n error InsufficientJobTokenCredits();\\n\\n // Variables\\n\\n /// @notice Last block where tokens were added to the job\\n /// @param _job The address of the job credited\\n /// @param _token The address of the token credited\\n /// @return _timestamp The last block where tokens were added to the job\\n function jobTokenCreditsAddedAt(address _job, address _token) external view returns (uint256 _timestamp);\\n\\n // Methods\\n\\n /// @notice Add credit to a job to be paid out for work\\n /// @param _job The address of the job being credited\\n /// @param _token The address of the token being credited\\n /// @param _amount The amount of credit being added\\n function addTokenCreditsToJob(\\n address _job,\\n address _token,\\n uint256 _amount\\n ) external;\\n\\n /// @notice Withdraw credit from a job\\n /// @param _job The address of the job from which the credits are withdrawn\\n /// @param _token The address of the token being withdrawn\\n /// @param _amount The amount of token to be withdrawn\\n /// @param _receiver The user that will receive tokens\\n function withdrawTokenCreditsFromJob(\\n address _job,\\n address _token,\\n uint256 _amount,\\n address _receiver\\n ) external;\\n}\\n\\n/// @title Keep3rJobFundableLiquidity contract\\n/// @notice Handles the funding of jobs through specific liquidity pairs\\ninterface IKeep3rJobFundableLiquidity is IKeep3rJobOwnership {\\n // Events\\n\\n /// @notice Emitted when Keep3rJobFundableLiquidity#approveLiquidity function is called\\n /// @param _liquidity The address of the liquidity pair being approved\\n event LiquidityApproval(address _liquidity);\\n\\n /// @notice Emitted when Keep3rJobFundableLiquidity#revokeLiquidity function is called\\n /// @param _liquidity The address of the liquidity pair being revoked\\n event LiquidityRevocation(address _liquidity);\\n\\n /// @notice Emitted when IKeep3rJobFundableLiquidity#addLiquidityToJob function is called\\n /// @param _job The address of the job to which liquidity will be added\\n /// @param _liquidity The address of the liquidity being added\\n /// @param _provider The user that calls the function\\n /// @param _amount The amount of liquidity being added\\n event LiquidityAddition(address indexed _job, address indexed _liquidity, address indexed _provider, uint256 _amount);\\n\\n /// @notice Emitted when IKeep3rJobFundableLiquidity#withdrawLiquidityFromJob function is called\\n /// @param _job The address of the job of which liquidity will be withdrawn from\\n /// @param _liquidity The address of the liquidity being withdrawn\\n /// @param _receiver The receiver of the liquidity tokens\\n /// @param _amount The amount of liquidity being withdrawn from the job\\n event LiquidityWithdrawal(address indexed _job, address indexed _liquidity, address indexed _receiver, uint256 _amount);\\n\\n /// @notice Emitted when Keep3rJobFundableLiquidity#addLiquidityToJob function is called\\n /// @param _job The address of the job whose credits will be updated\\n /// @param _rewardedAt The time at which the job was last rewarded\\n /// @param _currentCredits The current credits of the job\\n /// @param _periodCredits The credits of the job for the current period\\n event LiquidityCreditsReward(address indexed _job, uint256 _rewardedAt, uint256 _currentCredits, uint256 _periodCredits);\\n\\n /// @notice Emitted when Keep3rJobFundableLiquidity#forceLiquidityCreditsToJob function is called\\n /// @param _job The address of the job whose credits will be updated\\n /// @param _rewardedAt The time at which the job was last rewarded\\n /// @param _currentCredits The current credits of the job\\n event LiquidityCreditsForced(address indexed _job, uint256 _rewardedAt, uint256 _currentCredits);\\n\\n // Errors\\n\\n /// @notice Throws when the liquidity being approved has already been approved\\n error LiquidityPairApproved();\\n\\n /// @notice Throws when the liquidity being removed has not been approved\\n error LiquidityPairUnexistent();\\n\\n /// @notice Throws when trying to add liquidity to an unapproved pool\\n error LiquidityPairUnapproved();\\n\\n /// @notice Throws when the job doesn't have the requested liquidity\\n error JobLiquidityUnexistent();\\n\\n /// @notice Throws when trying to remove more liquidity than the job has\\n error JobLiquidityInsufficient();\\n\\n /// @notice Throws when trying to add less liquidity than the minimum liquidity required\\n error JobLiquidityLessThanMin();\\n\\n // Structs\\n\\n /// @notice Stores the tick information of the different liquidity pairs\\n struct TickCache {\\n int56 current; // Tracks the current tick\\n int56 difference; // Stores the difference between the current tick and the last tick\\n uint256 period; // Stores the period at which the last observation was made\\n }\\n\\n // Variables\\n\\n /// @notice Lists liquidity pairs\\n /// @return _list An array of addresses with all the approved liquidity pairs\\n function approvedLiquidities() external view returns (address[] memory _list);\\n\\n /// @notice Amount of liquidity in a specified job\\n /// @param _job The address of the job being checked\\n /// @param _liquidity The address of the liquidity we are checking\\n /// @return _amount Amount of liquidity in the specified job\\n function liquidityAmount(address _job, address _liquidity) external view returns (uint256 _amount);\\n\\n /// @notice Last time the job was rewarded liquidity credits\\n /// @param _job The address of the job being checked\\n /// @return _timestamp Timestamp of the last time the job was rewarded liquidity credits\\n function rewardedAt(address _job) external view returns (uint256 _timestamp);\\n\\n /// @notice Last time the job was worked\\n /// @param _job The address of the job being checked\\n /// @return _timestamp Timestamp of the last time the job was worked\\n function workedAt(address _job) external view returns (uint256 _timestamp);\\n\\n // Methods\\n\\n /// @notice Returns the liquidity credits of a given job\\n /// @param _job The address of the job of which we want to know the liquidity credits\\n /// @return _amount The liquidity credits of a given job\\n function jobLiquidityCredits(address _job) external view returns (uint256 _amount);\\n\\n /// @notice Returns the credits of a given job for the current period\\n /// @param _job The address of the job of which we want to know the period credits\\n /// @return _amount The credits the given job has at the current period\\n function jobPeriodCredits(address _job) external view returns (uint256 _amount);\\n\\n /// @notice Calculates the total credits of a given job\\n /// @param _job The address of the job of which we want to know the total credits\\n /// @return _amount The total credits of the given job\\n function totalJobCredits(address _job) external view returns (uint256 _amount);\\n\\n /// @notice Calculates how many credits should be rewarded periodically for a given liquidity amount\\n /// @dev _periodCredits = underlying KP3Rs for given liquidity amount * rewardPeriod / inflationPeriod\\n /// @param _liquidity The address of the liquidity to provide\\n /// @param _amount The amount of liquidity to provide\\n /// @return _periodCredits The amount of KP3R periodically minted for the given liquidity\\n function quoteLiquidity(address _liquidity, uint256 _amount) external view returns (uint256 _periodCredits);\\n\\n /// @notice Observes the current state of the liquidity pair being observed and updates TickCache with the information\\n /// @param _liquidity The address of the liquidity pair being observed\\n /// @return _tickCache The updated TickCache\\n function observeLiquidity(address _liquidity) external view returns (TickCache memory _tickCache);\\n\\n /// @notice Gifts liquidity credits to the specified job\\n /// @param _job The address of the job being credited\\n /// @param _amount The amount of liquidity credits to gift\\n function forceLiquidityCreditsToJob(address _job, uint256 _amount) external;\\n\\n /// @notice Approve a liquidity pair for being accepted in future\\n /// @param _liquidity The address of the liquidity accepted\\n function approveLiquidity(address _liquidity) external;\\n\\n /// @notice Revoke a liquidity pair from being accepted in future\\n /// @param _liquidity The liquidity no longer accepted\\n function revokeLiquidity(address _liquidity) external;\\n\\n /// @notice Allows anyone to fund a job with liquidity\\n /// @param _job The address of the job to assign liquidity to\\n /// @param _liquidity The liquidity being added\\n /// @param _amount The amount of liquidity tokens to add\\n function addLiquidityToJob(\\n address _job,\\n address _liquidity,\\n uint256 _amount\\n ) external;\\n\\n /// @notice Unbond liquidity for a job\\n /// @dev Can only be called by the job's owner\\n /// @param _job The address of the job being unbonded from\\n /// @param _liquidity The liquidity being unbonded\\n /// @param _amount The amount of liquidity being removed\\n function unbondLiquidityFromJob(\\n address _job,\\n address _liquidity,\\n uint256 _amount\\n ) external;\\n\\n /// @notice Withdraw liquidity from a job\\n /// @param _job The address of the job being withdrawn from\\n /// @param _liquidity The liquidity being withdrawn\\n /// @param _receiver The address that will receive the withdrawn liquidity\\n function withdrawLiquidityFromJob(\\n address _job,\\n address _liquidity,\\n address _receiver\\n ) external;\\n}\\n\\n/// @title Keep3rJobMigration contract\\n/// @notice Handles the migration process of jobs to different addresses\\ninterface IKeep3rJobMigration is IKeep3rJobFundableCredits, IKeep3rJobFundableLiquidity {\\n // Events\\n\\n /// @notice Emitted when Keep3rJobMigration#migrateJob function is called\\n /// @param _fromJob The address of the job that requests to migrate\\n /// @param _toJob The address at which the job requests to migrate\\n event JobMigrationRequested(address indexed _fromJob, address _toJob);\\n\\n /// @notice Emitted when Keep3rJobMigration#acceptJobMigration function is called\\n /// @param _fromJob The address of the job that requested to migrate\\n /// @param _toJob The address at which the job had requested to migrate\\n event JobMigrationSuccessful(address _fromJob, address indexed _toJob);\\n\\n // Errors\\n\\n /// @notice Throws when the address of the job that requests to migrate wants to migrate to its same address\\n error JobMigrationImpossible();\\n\\n /// @notice Throws when the _toJob address differs from the address being tracked in the pendingJobMigrations mapping\\n error JobMigrationUnavailable();\\n\\n /// @notice Throws when cooldown between migrations has not yet passed\\n error JobMigrationLocked();\\n\\n // Variables\\n\\n /// @notice Maps the jobs that have requested a migration to the address they have requested to migrate to\\n /// @return _toJob The address to which the job has requested to migrate to\\n function pendingJobMigrations(address _fromJob) external view returns (address _toJob);\\n\\n // Methods\\n\\n /// @notice Initializes the migration process for a job by adding the request to the pendingJobMigrations mapping\\n /// @param _fromJob The address of the job that is requesting to migrate\\n /// @param _toJob The address at which the job is requesting to migrate\\n function migrateJob(address _fromJob, address _toJob) external;\\n\\n /// @notice Completes the migration process for a job\\n /// @dev Unbond/withdraw process doesn't get migrated\\n /// @param _fromJob The address of the job that requested to migrate\\n /// @param _toJob The address to which the job wants to migrate to\\n function acceptJobMigration(address _fromJob, address _toJob) external;\\n}\\n\\n/// @title Keep3rJobWorkable contract\\n/// @notice Handles the mechanisms jobs can pay keepers with along with the restrictions jobs can put on keepers before they can work on jobs\\ninterface IKeep3rJobWorkable is IKeep3rJobMigration {\\n // Events\\n\\n /// @notice Emitted when a keeper is validated before a job\\n /// @param _gasLeft The amount of gas that the transaction has left at the moment of keeper validation\\n event KeeperValidation(uint256 _gasLeft);\\n\\n /// @notice Emitted when a keeper works a job\\n /// @param _credit The address of the asset in which the keeper is paid\\n /// @param _job The address of the job the keeper has worked\\n /// @param _keeper The address of the keeper that has worked the job\\n /// @param _payment The amount that has been paid out to the keeper in exchange for working the job\\n /// @param _gasLeft The amount of gas that the transaction has left at the moment of payment\\n event KeeperWork(address indexed _credit, address indexed _job, address indexed _keeper, uint256 _payment, uint256 _gasLeft);\\n\\n // Errors\\n\\n /// @notice Throws if work method was called without calling isKeeper or isBondedKeeper\\n error GasNotInitialized();\\n\\n /// @notice Throws if the address claiming to be a job is not in the list of approved jobs\\n error JobUnapproved();\\n\\n /// @notice Throws if the amount of funds in the job is less than the payment that must be paid to the keeper that works that job\\n error InsufficientFunds();\\n\\n // Methods\\n\\n /// @notice Confirms if the current keeper is registered\\n /// @dev Can be used for general (non critical) functions\\n /// @param _keeper The keeper being investigated\\n /// @return _isKeeper Whether the address passed as a parameter is a keeper or not\\n function isKeeper(address _keeper) external returns (bool _isKeeper);\\n\\n /// @notice Confirms if the current keeper is registered and has a minimum bond of any asset.\\n /// @dev Should be used for protected functions\\n /// @param _keeper The keeper to check\\n /// @param _bond The bond token being evaluated\\n /// @param _minBond The minimum amount of bonded tokens\\n /// @param _earned The minimum funds earned in the keepers lifetime\\n /// @param _age The minimum keeper age required\\n /// @return _isBondedKeeper Whether the `_keeper` meets the given requirements\\n function isBondedKeeper(\\n address _keeper,\\n address _bond,\\n uint256 _minBond,\\n uint256 _earned,\\n uint256 _age\\n ) external returns (bool _isBondedKeeper);\\n\\n /// @notice Implemented by jobs to show that a keeper performed work\\n /// @dev Automatically calculates the payment for the keeper and pays the keeper with bonded KP3R\\n /// @param _keeper Address of the keeper that performed the work\\n function worked(address _keeper) external;\\n\\n /// @notice Implemented by jobs to show that a keeper performed work\\n /// @dev Pays the keeper that performs the work with KP3R\\n /// @param _keeper Address of the keeper that performed the work\\n /// @param _payment The reward that should be allocated for the job\\n function bondedPayment(address _keeper, uint256 _payment) external;\\n\\n /// @notice Implemented by jobs to show that a keeper performed work\\n /// @dev Pays the keeper that performs the work with a specific token\\n /// @param _token The asset being awarded to the keeper\\n /// @param _keeper Address of the keeper that performed the work\\n /// @param _amount The reward that should be allocated\\n function directTokenPayment(\\n address _token,\\n address _keeper,\\n uint256 _amount\\n ) external;\\n}\\n\\n/// @title Keep3rJobDisputable contract\\n/// @notice Handles the actions that can be taken on a disputed job\\ninterface IKeep3rJobDisputable is IKeep3rDisputable, IKeep3rJobFundableCredits, IKeep3rJobFundableLiquidity {\\n // Events\\n\\n /// @notice Emitted when Keep3rJobDisputable#slashTokenFromJob is called\\n /// @param _job The address of the job from which the token will be slashed\\n /// @param _token The address of the token being slashed\\n /// @param _slasher The user that slashes the token\\n /// @param _amount The amount of the token being slashed\\n event JobSlashToken(address indexed _job, address _token, address indexed _slasher, uint256 _amount);\\n\\n /// @notice Emitted when Keep3rJobDisputable#slashLiquidityFromJob is called\\n /// @param _job The address of the job from which the liquidity will be slashed\\n /// @param _liquidity The address of the liquidity being slashed\\n /// @param _slasher The user that slashes the liquidity\\n /// @param _amount The amount of the liquidity being slashed\\n event JobSlashLiquidity(address indexed _job, address _liquidity, address indexed _slasher, uint256 _amount);\\n\\n // Errors\\n\\n /// @notice Throws when the token trying to be slashed doesn't exist\\n error JobTokenUnexistent();\\n\\n /// @notice Throws when someone tries to slash more tokens than the job has\\n error JobTokenInsufficient();\\n\\n // Methods\\n\\n /// @notice Allows governor or slasher to slash a job specific token\\n /// @param _job The address of the job from which the token will be slashed\\n /// @param _token The address of the token that will be slashed\\n /// @param _amount The amount of the token that will be slashed\\n function slashTokenFromJob(\\n address _job,\\n address _token,\\n uint256 _amount\\n ) external;\\n\\n /// @notice Allows governor or slasher to slash liquidity from a job\\n /// @param _job The address being slashed\\n /// @param _liquidity The address of the liquidity that will be slashed\\n /// @param _amount The amount of liquidity that will be slashed\\n function slashLiquidityFromJob(\\n address _job,\\n address _liquidity,\\n uint256 _amount\\n ) external;\\n}\\n\\n// solhint-disable-next-line no-empty-blocks\\ninterface IKeep3rJobs is IKeep3rJobWorkable, IKeep3rJobManager, IKeep3rJobDisputable {\\n\\n}\\n\",\"keccak256\":\"0x7fb7153d88e9e65d28b278320884517d6b423b2e8cfc78ee0ee16bc04073278e\",\"license\":\"MIT\"},\"solidity/interfaces/peripherals/IKeep3rKeepers.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4 <0.9.0;\\n\\nimport './IKeep3rDisputable.sol';\\n\\n/// @title Keep3rKeeperFundable contract\\n/// @notice Handles the actions required to become a keeper\\ninterface IKeep3rKeeperFundable {\\n // Events\\n\\n /// @notice Emitted when Keep3rKeeperFundable#activate is called\\n /// @param _keeper The keeper that has been activated\\n /// @param _bond The asset the keeper has bonded\\n /// @param _amount The amount of the asset the keeper has bonded\\n event Activation(address indexed _keeper, address indexed _bond, uint256 _amount);\\n\\n /// @notice Emitted when Keep3rKeeperFundable#withdraw is called\\n /// @param _keeper The caller of Keep3rKeeperFundable#withdraw function\\n /// @param _bond The asset to withdraw from the bonding pool\\n /// @param _amount The amount of funds withdrawn\\n event Withdrawal(address indexed _keeper, address indexed _bond, uint256 _amount);\\n\\n // Errors\\n\\n /// @notice Throws when the address that is trying to register as a job is already a job\\n error AlreadyAJob();\\n\\n // Methods\\n\\n /// @notice Beginning of the bonding process\\n /// @param _bonding The asset being bonded\\n /// @param _amount The amount of bonding asset being bonded\\n function bond(address _bonding, uint256 _amount) external;\\n\\n /// @notice Beginning of the unbonding process\\n /// @param _bonding The asset being unbonded\\n /// @param _amount Allows for partial unbonding\\n function unbond(address _bonding, uint256 _amount) external;\\n\\n /// @notice End of the bonding process after bonding time has passed\\n /// @param _bonding The asset being activated as bond collateral\\n function activate(address _bonding) external;\\n\\n /// @notice Withdraw funds after unbonding has finished\\n /// @param _bonding The asset to withdraw from the bonding pool\\n function withdraw(address _bonding) external;\\n}\\n\\n/// @title Keep3rKeeperDisputable contract\\n/// @notice Handles the actions that can be taken on a disputed keeper\\ninterface IKeep3rKeeperDisputable is IKeep3rDisputable, IKeep3rKeeperFundable {\\n // Events\\n\\n /// @notice Emitted when Keep3rKeeperDisputable#slash is called\\n /// @param _keeper The address of the slashed keeper\\n /// @param _slasher The user that called Keep3rKeeperDisputable#slash\\n /// @param _amount The amount of credits slashed from the keeper\\n event KeeperSlash(address indexed _keeper, address indexed _slasher, uint256 _amount);\\n\\n /// @notice Emitted when Keep3rKeeperDisputable#revoke is called\\n /// @param _keeper The address of the revoked keeper\\n /// @param _slasher The user that called Keep3rKeeperDisputable#revoke\\n event KeeperRevoke(address indexed _keeper, address indexed _slasher);\\n\\n // Methods\\n\\n /// @notice Allows governor to slash a keeper based on a dispute\\n /// @param _keeper The address being slashed\\n /// @param _bonded The asset being slashed\\n /// @param _bondAmount The bonded amount being slashed\\n /// @param _unbondAmount The pending unbond amount being slashed\\n function slash(\\n address _keeper,\\n address _bonded,\\n uint256 _bondAmount,\\n uint256 _unbondAmount\\n ) external;\\n\\n /// @notice Blacklists a keeper from participating in the network\\n /// @param _keeper The address being slashed\\n function revoke(address _keeper) external;\\n}\\n\\n// solhint-disable-next-line no-empty-blocks\\n\\n/// @title Keep3rKeepers contract\\ninterface IKeep3rKeepers is IKeep3rKeeperDisputable {\\n\\n}\\n\",\"keccak256\":\"0x8fe10565035bb918b2b1c7d730533bcfe9ec79078f28544852f8178e76302562\",\"license\":\"MIT\"},\"solidity/interfaces/peripherals/IKeep3rParameters.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4 <0.9.0;\\n\\nimport './IKeep3rAccountance.sol';\\n\\n/// @title Keep3rParameters contract\\n/// @notice Handles and sets all the required parameters for Keep3r\\ninterface IKeep3rParameters is IKeep3rAccountance {\\n // Events\\n\\n /// @notice Emitted when the Keep3rHelper address is changed\\n /// @param _keep3rHelper The address of Keep3rHelper's contract\\n event Keep3rHelperChange(address _keep3rHelper);\\n\\n /// @notice Emitted when the Keep3rV1 address is changed\\n /// @param _keep3rV1 The address of Keep3rV1's contract\\n event Keep3rV1Change(address _keep3rV1);\\n\\n /// @notice Emitted when the Keep3rV1Proxy address is changed\\n /// @param _keep3rV1Proxy The address of Keep3rV1Proxy's contract\\n event Keep3rV1ProxyChange(address _keep3rV1Proxy);\\n\\n /// @notice Emitted when bondTime is changed\\n /// @param _bondTime The new bondTime\\n event BondTimeChange(uint256 _bondTime);\\n\\n /// @notice Emitted when _liquidityMinimum is changed\\n /// @param _liquidityMinimum The new _liquidityMinimum\\n event LiquidityMinimumChange(uint256 _liquidityMinimum);\\n\\n /// @notice Emitted when _unbondTime is changed\\n /// @param _unbondTime The new _unbondTime\\n event UnbondTimeChange(uint256 _unbondTime);\\n\\n /// @notice Emitted when _rewardPeriodTime is changed\\n /// @param _rewardPeriodTime The new _rewardPeriodTime\\n event RewardPeriodTimeChange(uint256 _rewardPeriodTime);\\n\\n /// @notice Emitted when the inflationPeriod is changed\\n /// @param _inflationPeriod The new inflationPeriod\\n event InflationPeriodChange(uint256 _inflationPeriod);\\n\\n /// @notice Emitted when the fee is changed\\n /// @param _fee The new token credits fee\\n event FeeChange(uint256 _fee);\\n\\n // Variables\\n\\n /// @notice Address of Keep3rHelper's contract\\n /// @return _keep3rHelper The address of Keep3rHelper's contract\\n function keep3rHelper() external view returns (address _keep3rHelper);\\n\\n /// @notice Address of Keep3rV1's contract\\n /// @return _keep3rV1 The address of Keep3rV1's contract\\n function keep3rV1() external view returns (address _keep3rV1);\\n\\n /// @notice Address of Keep3rV1Proxy's contract\\n /// @return _keep3rV1Proxy The address of Keep3rV1Proxy's contract\\n function keep3rV1Proxy() external view returns (address _keep3rV1Proxy);\\n\\n /// @notice The amount of time required to pass after a keeper has bonded assets for it to be able to activate\\n /// @return _days The required bondTime in days\\n function bondTime() external view returns (uint256 _days);\\n\\n /// @notice The amount of time required to pass before a keeper can unbond what he has bonded\\n /// @return _days The required unbondTime in days\\n function unbondTime() external view returns (uint256 _days);\\n\\n /// @notice The minimum amount of liquidity required to fund a job per liquidity\\n /// @return _amount The minimum amount of liquidity in KP3R\\n function liquidityMinimum() external view returns (uint256 _amount);\\n\\n /// @notice The amount of time between each scheduled credits reward given to a job\\n /// @return _days The reward period in days\\n function rewardPeriodTime() external view returns (uint256 _days);\\n\\n /// @notice The inflation period is the denominator used to regulate the emission of KP3R\\n /// @return _period The denominator used to regulate the emission of KP3R\\n function inflationPeriod() external view returns (uint256 _period);\\n\\n /// @notice The fee to be sent to governor when a user adds liquidity to a job\\n /// @return _amount The fee amount to be sent to governor when a user adds liquidity to a job\\n function fee() external view returns (uint256 _amount);\\n\\n // Errors\\n\\n /// @notice Throws if the reward period is less than the minimum reward period time\\n error MinRewardPeriod();\\n\\n /// @notice Throws if either a job or a keeper is disputed\\n error Disputed();\\n\\n /// @notice Throws if there are no bonded assets\\n error BondsUnexistent();\\n\\n /// @notice Throws if the time required to bond an asset has not passed yet\\n error BondsLocked();\\n\\n /// @notice Throws if there are no bonds to withdraw\\n error UnbondsUnexistent();\\n\\n /// @notice Throws if the time required to withdraw the bonds has not passed yet\\n error UnbondsLocked();\\n\\n // Methods\\n\\n /// @notice Sets the Keep3rHelper address\\n /// @param _keep3rHelper The Keep3rHelper address\\n function setKeep3rHelper(address _keep3rHelper) external;\\n\\n /// @notice Sets the Keep3rV1 address\\n /// @param _keep3rV1 The Keep3rV1 address\\n function setKeep3rV1(address _keep3rV1) external;\\n\\n /// @notice Sets the Keep3rV1Proxy address\\n /// @param _keep3rV1Proxy The Keep3rV1Proxy address\\n function setKeep3rV1Proxy(address _keep3rV1Proxy) external;\\n\\n /// @notice Sets the bond time required to activate as a keeper\\n /// @param _bond The new bond time\\n function setBondTime(uint256 _bond) external;\\n\\n /// @notice Sets the unbond time required unbond what has been bonded\\n /// @param _unbond The new unbond time\\n function setUnbondTime(uint256 _unbond) external;\\n\\n /// @notice Sets the minimum amount of liquidity required to fund a job\\n /// @param _liquidityMinimum The new minimum amount of liquidity\\n function setLiquidityMinimum(uint256 _liquidityMinimum) external;\\n\\n /// @notice Sets the time required to pass between rewards for jobs\\n /// @param _rewardPeriodTime The new amount of time required to pass between rewards\\n function setRewardPeriodTime(uint256 _rewardPeriodTime) external;\\n\\n /// @notice Sets the new inflation period\\n /// @param _inflationPeriod The new inflation period\\n function setInflationPeriod(uint256 _inflationPeriod) external;\\n\\n /// @notice Sets the new fee\\n /// @param _fee The new fee\\n function setFee(uint256 _fee) external;\\n}\\n\",\"keccak256\":\"0x2a847a2ab6dbee960ca84e142ad9c578d8953c4adf1d3221669400ea86c9b82e\",\"license\":\"MIT\"},\"solidity/interfaces/peripherals/IKeep3rRoles.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4 <0.9.0;\\n\\nimport '@defi-wonderland/solidity-utils/solidity/interfaces/IBaseErrors.sol';\\nimport '@defi-wonderland/solidity-utils/solidity/interfaces/IGovernable.sol';\\nimport '@defi-wonderland/solidity-utils/solidity/interfaces/IDustCollector.sol';\\n\\n/// @title Keep3rRoles contract\\n/// @notice Manages the Keep3r specific roles\\ninterface IKeep3rRoles is IBaseErrors, IGovernable, IDustCollector {\\n // Events\\n\\n /// @notice Emitted when a slasher is added\\n /// @param _slasher Address of the added slasher\\n event SlasherAdded(address _slasher);\\n\\n /// @notice Emitted when a slasher is removed\\n /// @param _slasher Address of the removed slasher\\n event SlasherRemoved(address _slasher);\\n\\n /// @notice Emitted when a disputer is added\\n /// @param _disputer Address of the added disputer\\n event DisputerAdded(address _disputer);\\n\\n /// @notice Emitted when a disputer is removed\\n /// @param _disputer Address of the removed disputer\\n event DisputerRemoved(address _disputer);\\n\\n // Variables\\n\\n /// @notice Tracks whether the address is a slasher or not\\n /// @param _slasher Address being checked as a slasher\\n /// @return _isSlasher Whether the address is a slasher or not\\n function slashers(address _slasher) external view returns (bool _isSlasher);\\n\\n /// @notice Tracks whether the address is a disputer or not\\n /// @param _disputer Address being checked as a disputer\\n /// @return _isDisputer Whether the address is a disputer or not\\n function disputers(address _disputer) external view returns (bool _isDisputer);\\n\\n // Errors\\n\\n /// @notice Throws if the address is already a registered slasher\\n error SlasherExistent();\\n\\n /// @notice Throws if caller is not a registered slasher\\n error SlasherUnexistent();\\n\\n /// @notice Throws if the address is already a registered disputer\\n error DisputerExistent();\\n\\n /// @notice Throws if caller is not a registered disputer\\n error DisputerUnexistent();\\n\\n /// @notice Throws if the msg.sender is not a slasher or is not a part of governance\\n error OnlySlasher();\\n\\n /// @notice Throws if the msg.sender is not a disputer or is not a part of governance\\n error OnlyDisputer();\\n\\n // Methods\\n\\n /// @notice Registers a slasher by updating the slashers mapping\\n function addSlasher(address _slasher) external;\\n\\n /// @notice Removes a slasher by updating the slashers mapping\\n function removeSlasher(address _slasher) external;\\n\\n /// @notice Registers a disputer by updating the disputers mapping\\n function addDisputer(address _disputer) external;\\n\\n /// @notice Removes a disputer by updating the disputers mapping\\n function removeDisputer(address _disputer) external;\\n}\\n\",\"keccak256\":\"0xc0a19b0dfac535cbffabc0d76cb0569618dedb922b0413bc12358efa47dc32bf\",\"license\":\"MIT\"}},\"version\":1}", + "bytecode": "0x60806040526203f480601f55621275006020556729a2241af62c000060215562069780602255622cd300602355601e6024553480156200003e57600080fd5b50604051620060d3380380620060d383398101604081905262000061916200012b565b60016000558383838382828286806001600160a01b038116620000975760405163d92e233d60e01b815260040160405180910390fd5b600380546001600160a01b03199081166001600160a01b0393841617909155601e8054821696831696909617909555601c805486169482169490941790935550601d8054909316911617905550506000601f8190556020555050600160215550506201518060225550506206978060235562000188565b80516001600160a01b03811681146200012657600080fd5b919050565b600080600080608085870312156200014257600080fd5b6200014d856200010e565b93506200015d602086016200010e565b92506200016d604086016200010e565b91506200017d606086016200010e565b905092959194509250565b615f3b80620001986000396000f3fe608060405234801561001057600080fd5b50600436106104ac5760003560e01c8063966abd001161026d578063cb4be2bb11610151578063ec8ca643116100ce578063f25e311b11610092578063f25e311b14610c0f578063f263c47014610c22578063f75f9f7b14610c2b578063f9d46cf214610c3e578063fc253d2b14610c51578063fe75bc4614610c5a57600080fd5b8063ec8ca64314610b8d578063f0f346b914610bb6578063f11a1d1a14610bc9578063f136a09d14610bdc578063f235757f14610bfc57600080fd5b8063ddca3f4311610115578063ddca3f4314610b2b578063e3056a3414610b34578063e326ac4314610b47578063ebbb619414610b67578063ec00cdfc14610b7a57600080fd5b8063cb4be2bb14610ab4578063cb54694d14610ac7578063cd22af1b14610ada578063d55995fe14610b05578063dd2080d614610b1857600080fd5b8063aac6aa9c116101ea578063b600702a116101ae578063b600702a14610a32578063b7e7734014610a45578063b87fcbff14610a58578063c20297f014610a7b578063c5198abc14610a8e578063c7ae40d014610aa157600080fd5b8063aac6aa9c146109ab578063af320e81146109be578063b0103b1a146109d1578063b2392233146109f4578063b440027f14610a0757600080fd5b8063a515366a11610231578063a515366a14610941578063a5d059ca14610954578063a676f9ff14610967578063a734f06e14610987578063a7d2e784146109a257600080fd5b8063966abd00146108b457806398e90a0f146108c75780639d5c33d8146108f0578063a214580914610903578063a39744b51461091657600080fd5b806359a2255e116103945780636e2a9ca611610311578063878c723e116102d5578063878c723e146108275780638bb6dfa8146108505780638cb22b76146108635780638fe204dd1461088657806390a4684e14610899578063951dc22c146108ac57600080fd5b80636e2a9ca6146107dd57806372da828a146107f057806374a8f10314610803578063768b5d90146108165780637c8fce231461081f57600080fd5b806368a9f19c1161035857806368a9f19c14610766578063694798e61461077957806369fe0e2d146107a45780636ba42aaa146107b75780636cf262bc146107ca57600080fd5b806359a2255e1461071b5780635ebe23f01461072e5780635feeb79414610737578063633fb68f1461074a57806364bb43ee1461075357600080fd5b8063168f92e71161042d578063274a8db4116103f1578063274a8db41461068957806351cff8d9146106bc57806352a4de29146106cf57806355ea6c47146106e2578063575288bf146106f5578063594a3a931461070857600080fd5b8063168f92e7146105ed5780631b44555e146106185780631c5a9d9c146106385780631ef94b911461064b57806321040b011461065e57600080fd5b80631101eb41116104745780631101eb411461055557806311466d721461056a57806313f6986d1461057d57806315006b8214610585578063165e62e7146105b057600080fd5b8063034d4c61146104b157806307b435c2146104d75780630c340a24146105025780630c620bce1461052d5780630d6a1f8714610542575b600080fd5b6104c46104bf3660046158fe565b610c6d565b6040519081526020015b60405180910390f35b6104c46104e536600461591b565b601760209081526000928352604080842090915290825290205481565b600354610515906001600160a01b031681565b6040516001600160a01b0390911681526020016104ce565b610535610d73565b6040516104ce9190615954565b6104c46105503660046159a1565b610d84565b6105686105633660046159cd565b610e97565b005b6105686105783660046159a1565b610ff1565b610568611196565b6104c461059336600461591b565b601560209081526000928352604080842090915290825290205481565b6105c36105be3660046158fe565b6111cb565b604080518251600690810b825260208085015190910b9082015291810151908201526060016104ce565b6104c46105fb36600461591b565b600e60209081526000928352604080842090915290825290205481565b6104c46106263660046158fe565b600a6020526000908152604090205481565b6105686106463660046158fe565b61157d565b601c54610515906001600160a01b031681565b6104c461066c36600461591b565b601860209081526000928352604080842090915290825290205481565b6106ac6106973660046158fe565b60066020526000908152604090205460ff1681565b60405190151581526020016104ce565b6105686106ca3660046158fe565b611738565b6105686106dd3660046159cd565b6118d0565b6105686106f03660046158fe565b611b03565b6105686107033660046159cd565b611bb7565b61056861071636600461591b565b611e72565b6105686107293660046158fe565b611f17565b6104c4601f5481565b6105686107453660046158fe565b611fc9565b6104c460215481565b6105686107613660046158fe565b61226e565b6105686107743660046158fe565b612349565b6104c461078736600461591b565b602860209081526000928352604080842090915290825290205481565b6105686107b2366004615a0e565b612429565b6106ac6107c53660046158fe565b612489565b6104c46107d83660046158fe565b6124e9565b6105686107eb3660046159cd565b612631565b6105686107fe3660046158fe565b61277d565b6105686108113660046158fe565b61281d565b6104c460225481565b610535612918565b6105156108353660046158fe565b6001602052600090815260409020546001600160a01b031681565b6104c461085e3660046158fe565b612924565b6106ac6108713660046158fe565b60196020526000908152604090205460ff1681565b610568610894366004615a0e565b6129c7565b6105686108a736600461591b565b612a25565b610535612b0f565b6105686108c2366004615a27565b612b1b565b6105156108d53660046158fe565b6002602052600090815260409020546001600160a01b031681565b6105686108fe3660046158fe565b612c31565b610568610911366004615a69565b612d11565b6104c461092436600461591b565b600d60209081526000928352604080842090915290825290205481565b61056861094f3660046159a1565b612ee1565b6105686109623660046159a1565b613138565b6104c46109753660046158fe565b60296020526000908152604090205481565b61051573eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee81565b6104c460205481565b6105686109b93660046158fe565b613212565b6105686109cc36600461591b565b6132c7565b6106ac6109df3660046158fe565b600c6020526000908152604090205460ff1681565b610568610a02366004615a0e565b613744565b6104c4610a1536600461591b565b602560209081526000928352604080842090915290825290205481565b610568610a403660046158fe565b6137a4565b610568610a53366004615a0e565b6139bc565b6106ac610a663660046158fe565b60056020526000908152604090205460ff1681565b610568610a89366004615aa9565b613a1c565b610568610a9c3660046158fe565b613ad5565b601d54610515906001600160a01b031681565b610568610ac23660046158fe565b613b9b565b610568610ad5366004615a0e565b613c3b565b6104c4610ae836600461591b565b601660209081526000928352604080842090915290825290205481565b610568610b13366004615aef565b613cbf565b610568610b263660046159cd565b613ef6565b6104c460245481565b600454610515906001600160a01b031681565b6104c4610b553660046158fe565b600b6020526000908152604090205481565b610568610b75366004615a0e565b614085565b610568610b883660046158fe565b6140e5565b610515610b9b3660046158fe565b602c602052600090815260409020546001600160a01b031681565b610568610bc43660046158fe565b614190565b601e54610515906001600160a01b031681565b6104c4610bea3660046158fe565b602a6020526000908152604090205481565b610568610c0a3660046158fe565b614245565b610568610c1d3660046159cd565b61427c565b6104c460095481565b610568610c393660046158fe565b6144c2565b6106ac610c4c366004615b42565b61457a565b6104c460235481565b610568610c683660046159a1565b614663565b600080610c79836124e9565b6022549091504290610c9490610c8f9083615ba9565b614753565b6001600160a01b0385166000908152602960205260409020541115610d38576022546001600160a01b038516600090815260296020526040902054610cd99042615ba9565b10610d15576022546001600160a01b038516600090815260296020526040902054610d049190615bc0565b610d0e9082615ba9565b9050610d4e565b6001600160a01b038416600090815260296020526040902054610d0e9082615ba9565b610d4142614753565b610d4b9082615ba9565b90505b610d58818361476d565b610d6185612924565b610d6b9190615bc0565b949350505050565b6060610d7f6026614797565b905090565b6000610d916026846147ab565b15610e91576000610da1846111cb565b90508060400151600014610e8f576001600160a01b03841660009081526014602052604081205460ff16610de2578160200151610ddd90615bd8565b610de8565b81602001515b601e5460225460405163a0d2710760e01b815260048101889052600684900b60248201526044810191909152919250610e86916001600160a01b039091169063a0d27107906064015b60206040518083038186803b158015610e4957600080fd5b505afa158015610e5d573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e819190615bff565b6147cd565b92505050610e91565b505b92915050565b6001600160a01b038381166000908152600160205260409020548491163314610ed357604051636efb4f4160e11b815260040160405180910390fd5b602054610ee09042615bc0565b6001600160a01b03808616600081815260176020908152604080832094891680845294825280832095909555918152601882528381209281529190529081208054849290610f2f908490615bc0565b90915550610f4090508484846147de565b6001600160a01b038085166000908152602860209081526040808320938716835292905220548015801590610f7f5750602154610f7d82866149ec565b105b15610f9d57604051636f447fcd60e11b815260040160405180910390fd5b836001600160a01b0316856001600160a01b03167f9aaab310d247ad45aef26bbdefc4ebf20c728fdb84c92b95b2b05d21826940de85604051610fe291815260200190565b60405180910390a35050505050565b336000818152600c602052604090205460ff16156110225760405163ad2fdf3b60e01b815260040160405180910390fd5b61102d601a826147ab565b6110495760405162941a5760e11b815260040160405180910390fd5b61105281614b14565b156110af576001600160a01b038116600081815260296020908152604080832054600f835281842054601084529382902054825191825292810193909352820152600080516020615ee68339815191529060600160405180910390a25b6001600160a01b0381166000908152600f6020526040902054821115611130576110d881614cea565b6001600160a01b038116600081815260296020908152604080832054600f835281842054601084529382902054825191825292810193909352820152600080516020615ee68339815191529060600160405180910390a25b61113b818484614d78565b601c546001600160a01b038085169183821691167f46f2180879a7123a197cc3828c28955d70d661c70acbdc02450daf5f9a9c1cfa85611179614e75565b6040805192835260208301919091520160405180910390a4505050565b6004546001600160a01b031633146111c157604051639ba0305d60e01b815260040160405180910390fd5b6111c9614e8f565b565b60408051606081018252600080825260208201819052918101919091526111f142614753565b6001600160a01b0383166000908152602b6020526040902060010154141561125f57506001600160a01b03166000908152602b602090815260409182902082516060810184528154600681810b8352600160381b909104900b92810192909252600101549181019190915290565b60008061127360225442610c8f9190615ba9565b6001600160a01b0385166000908152602b60205260409020600101549091508114156113d157604080516001808252818301909252600091602080830190803683375050506001600160a01b0386166000908152602b602052604090205490915060060b6112e042614753565b6112ea9042615ba9565b826000815181106112fd576112fd615c18565b63ffffffff909216602092830291909101820152601e546001600160a01b038881166000908152601390935260409283902054925163dc686d9160e01b81529181169263dc686d91926113599291909116908690600401615c2e565b60606040518083038186803b15801561137157600080fd5b505afa158015611385573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906113a99190615cac565b60069290920b8088529195506113c191839150615cef565b60060b6020860152506115549050565b6001600160a01b0384166000908152602b60205260409020600101548111156115545760408051600280825260608201835260009260208301908036833701905050905061141e42614753565b6114289042615ba9565b8160008151811061143b5761143b615c18565b602002602001019063ffffffff16908163ffffffff168152505060225461146142614753565b61146b9042615ba9565b6114759190615bc0565b8160018151811061148857611488615c18565b63ffffffff909216602092830291909101820152601e546001600160a01b0387811660009081526013909352604080842054905163dc686d9160e01b81529282169263dc686d91926114e09216908690600401615c2e565b60606040518083038186803b1580156114f857600080fd5b505afa15801561150c573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906115309190615cac565b60069290920b8088529195509150611549908290615cef565b60060b602086015250505b811561156d5761156342614753565b6040840152611575565b600060408401525b50505b919050565b336000818152600c602052604090205460ff16156115ae576040516362e6201d60e01b815260040160405180910390fd5b6001600160a01b03808216600090815260166020908152604080832093861683529290522054806115f257604051636258f48160e01b815260040160405180910390fd5b42811061161257604051630fd0eeef60e11b815260040160405180910390fd5b6001600160a01b0382166000908152600b602052604090205461164b576001600160a01b0382166000908152600b602052604090204290555b611656600783614eed565b506001600160a01b038083166000818152601560209081526040808320948816808452948252808320805490849055938352600d82528083209483529390529182208054919283926116a9908490615bc0565b9091555050601c546001600160a01b03858116911614156116e55780600960008282546116d69190615bc0565b909155506116e5905081614f02565b836001600160a01b0316836001600160a01b03167f3673530133b6da67e9854f605b0cfa7bb9798cd33c18036dfc10d8da7c4d4a758360405161172a91815260200190565b60405180910390a350505050565b600260005414156117645760405162461bcd60e51b815260040161175b90615d3f565b60405180910390fd5b600260009081553381526018602090815260408083206001600160a01b03851684529091529020546117a95760405163184c088160e21b815260040160405180910390fd5b3360009081526017602090815260408083206001600160a01b038516845290915290205442116117ec576040516327cfdcb760e01b815260040160405180910390fd5b336000908152600c602052604090205460ff161561181d576040516362e6201d60e01b815260040160405180910390fd5b3360008181526018602090815260408083206001600160a01b038681168086529184528285208054908690559585526017845282852082865290935290832092909255601c541614156118735761187381614f64565b6118876001600160a01b0383163383614fac565b6040518181526001600160a01b0383169033907f2717ead6b9200dd235aad468c9809ea400fe33ac69b5bfaa6d3e90fc922b63989060200160405180910390a350506001600055565b600260005414156118f35760405162461bcd60e51b815260040161175b90615d3f565b60026000556119036026836147ab565b6119205760405163e0b6aead60e01b815260040160405180910390fd5b61192b601a846147ab565b61194857604051636211d34960e01b815260040160405180910390fd5b6001600160a01b038316600090815260126020526040902061196a9083614eed565b5061197483615014565b6021546001600160a01b038085166000908152602860209081526040808320938716835292905220546119b2906119ac908490615bc0565b846149ec565b10156119d157604051636f447fcd60e11b815260040160405180910390fd5b6001600160a01b038316600081815260296020908152604080832054600f835281842054601084529382902054825191825292810193909352820152600080516020615ee68339815191529060600160405180910390a2611a3d6001600160a01b038316333084615072565b6001600160a01b03808416600090815260286020908152604080832093861683529290529081208054839290611a74908490615bc0565b90915550611a879050610e8182846149ec565b6001600160a01b03841660009081526010602052604081208054909190611aaf908490615bc0565b909155505060405181815233906001600160a01b0384811691908616907f4e186bc75a2220191b826baff3ee63c3e970e94e58a9007ff94c9a7b8e6ebb3f9060200160405180910390a45050600160005550565b3360009081526006602052604090205460ff16611b3357604051630942721960e31b815260040160405180910390fd5b6001600160a01b0381166000908152600c602052604090205460ff16611b6c576040516310cec38560e21b815260040160405180910390fd5b6001600160a01b0381166000818152600c6020526040808220805460ff19169055513392917fe02b2375d8fb4aef3e5bc5d53bffcf70b6f185c5c93e69dcbe8b6cfc58e837e291a350565b60026000541415611bda5760405162461bcd60e51b815260040161175b90615d3f565b6002600055611bea601a846147ab565b611c0757604051636211d34960e01b815260040160405180910390fd5b601c546001600160a01b0383811691161415611c355760405162822d9760e71b815260040160405180910390fd5b6040516370a0823160e01b81523060048201526000906001600160a01b038416906370a082319060240160206040518083038186803b158015611c7757600080fd5b505afa158015611c8b573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611caf9190615bff565b9050611cc66001600160a01b038416333085615072565b6040516370a0823160e01b815230600482015260009082906001600160a01b038616906370a082319060240160206040518083038186803b158015611d0a57600080fd5b505afa158015611d1e573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611d429190615bff565b611d4c9190615ba9565b9050600061271060245483611d619190615d76565b611d6b9190615dab565b9050611d778183615ba9565b6001600160a01b038088166000908152600e60209081526040808320938a1683529290529081208054909190611dae908490615bc0565b90915550506001600160a01b0380871660009081526025602090815260408083208985168085529252909120429055600354611deb921683614fac565b6001600160a01b0386166000908152601160205260409020611e0d9086614eed565b50336001600160a01b0316856001600160a01b0316876001600160a01b03167fec1a37d4a331a5059081e0fb5da1735e7890900cd215a4fb1e9f2779fd7b83eb85604051611e5d91815260200190565b60405180910390a45050600160005550505050565b6001600160a01b038281166000908152600160205260409020548391163314611eae57604051636efb4f4160e11b815260040160405180910390fd5b6001600160a01b03838116600081815260026020908152604080832080546001600160a01b031916888716908117909155600190925280832054905191941692917fa8bad3f0b781e1d954af9945167d5f80bfe5e57930f17c93843187c77557a6b891a4505050565b6001600160a01b038181166000908152600260205260409020548291163314611f535760405163cfe9663360e01b815260040160405180910390fd5b6001600160a01b03828116600081815260016020908152604080832080546002909352818420805487166001600160a01b031980861691909117909255805490911690555193169283929133917fcf30c54296d5eee76168b564c59c50578d49c271733a470f32707c8cfbc88a8b9190a4505050565b602e54611fe957604051630262ab9b60e61b815260040160405180910390fd5b336000818152600c602052604090205460ff161561201a5760405163ad2fdf3b60e01b815260040160405180910390fd5b612025601a826147ab565b6120415760405162941a5760e11b815260040160405180910390fd5b61204a81614b14565b156120a7576001600160a01b038116600081815260296020908152604080832054600f835281842054601084529382902054825191825292810193909352820152600080516020615ee68339815191529060600160405180910390a25b601e546001600160a01b038381166000908152600d60209081526040808320601c548516845290915280822054905163435b21c160e01b8152600481019190915290928392839291169063435b21c19060240160606040518083038186803b15801561211257600080fd5b505afa158015612126573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061214a9190615dbf565b925092509250600061215a614e75565b9050600061216a828486886150b0565b6001600160a01b0387166000908152600f60205260409020549091508111156122065761219686614cea565b6001600160a01b038616600081815260296020908152604080832054600f835281842054601084529382902054825191825292810193909352820152600080516020615ee68339815191529060600160405180910390a26121f5614e75565b9150612203828486886150b0565b90505b612211868883614d78565b6000602e55601c5460408051838152602081018590526001600160a01b038a8116938a8216939116917f46f2180879a7123a197cc3828c28955d70d661c70acbdc02450daf5f9a9c1cfa910160405180910390a450505050505050565b6003546001600160a01b031633146122995760405163070545c960e51b815260040160405180910390fd5b6122a460268261510d565b6122c157604051630a8d08b160e01b815260040160405180910390fd5b6001600160a01b038116600081815260136020908152604080832080546001600160a01b031916905560148252808320805460ff19169055602b825280832080546001600160701b03191681556001019290925590519182527f51199d699bdfd516fa88dd0d2f8487c40c147b4867acaa23adc8d4df6b098e5691015b60405180910390a150565b6003546001600160a01b031633146123745760405163070545c960e51b815260040160405180910390fd5b6001600160a01b03811661239b5760405163d92e233d60e01b815260040160405180910390fd5b6001600160a01b03811660009081526005602052604090205460ff16156123d55760405163546da66560e11b815260040160405180910390fd5b6001600160a01b038116600081815260056020908152604091829020805460ff1916600117905590519182527f049ccb28ab796d3225573a065712f6e7754487ced56056cda8889c337511807b910161233e565b6003546001600160a01b031633146124545760405163070545c960e51b815260040160405180910390fd5b60248190556040518181527f4c10ca068ff7002cf5da78f2f697d1e91f6f0ac27f7344b28e8ef25263f87e5d9060200161233e565b6000612493614e75565b602e556124a16007836147ab565b15611578577f4851cad52e624c8f7a1d44c28a80db05988ba2451fc0db6b0ec338d8eca95afb602e546040516124d991815260200190565b60405180910390a1506001919050565b6000805b6001600160a01b038316600090815260126020526040902061250e90615122565b81101561262b576001600160a01b0383166000908152601260205260408120612537908361512c565b90506125446026826147ab565b15612618576000612554826111cb565b90508060400151600014612616576001600160a01b03821660009081526014602052604081205460ff1661259557816020015161259090615bd8565b61259b565b81602001515b601e546001600160a01b03888116600090815260286020908152604080832089851684529091529081902054602254915163a0d2710760e01b81526004810191909152600685900b602482015260448101919091529293506126089291169063a0d2710790606401610e31565b6126129086615bc0565b9450505b505b508061262381615ded565b9150506124ed565b50919050565b3360009081526005602052604090205460ff1661266157604051637e57b1e160e01b815260040160405180910390fd5b6001600160a01b0383166000908152600c602052604090205460ff1661269a576040516310cec38560e21b815260040160405180910390fd5b6126a58383836147de565b60035460405163a9059cbb60e01b81526001600160a01b039182166004820152602481018390529083169063a9059cbb90604401602060405180830381600087803b1580156126f357600080fd5b505af1925050508015612723575060408051601f3d908101601f1916820190925261272091810190615e08565b60015b61272c5761272e565b505b604080516001600160a01b038481168252602082018490523392908616917f6e10247c3c094d220ee99436c164b7f38d63b335a20ed817cbefaee4bb02d20e91015b60405180910390a3505050565b6003546001600160a01b031633146127a85760405163070545c960e51b815260040160405180910390fd5b6001600160a01b0381166127cf5760405163d92e233d60e01b815260040160405180910390fd5b601e80546001600160a01b0319166001600160a01b0383169081179091556040519081527f71973fd672e51deb8f739b1f7e1eab991936645acd6f83e2bde6eeeaff5490b09060200161233e565b3360009081526005602052604090205460ff1661284d57604051637e57b1e160e01b815260040160405180910390fd5b6001600160a01b0381166000908152600c602052604090205460ff16612886576040516310cec38560e21b815260040160405180910390fd5b61289160078261510d565b50601c546001600160a01b038083166000818152600d60209081526040808320949095168083529381528482205492825260188152848220848352905292909220546128df92849291615138565b60405133906001600160a01b038316907f038a17b9b553c0c3fc2ed14b957a5d8420a1666fd2efe5c1b3fe5f23eea61bb390600090a350565b6060610d7f601a614797565b600080612930836124e9565b6022546001600160a01b0385166000908152602960205260409020549192509061295a9042615ba9565b1015610e915760008111612986576001600160a01b0383166000908152600f60205260409020546129c0565b6001600160a01b038316600090815260106020908152604080832054600f909252909120546129b6908390615d76565b6129c09190615dab565b915061262b565b6003546001600160a01b031633146129f25760405163070545c960e51b815260040160405180910390fd5b60208181556040518281527fc8d443472c9783cc36f8f5f5091f08ce9f37fc2f9e6d79cf1d9aaf40a433fee2910161233e565b6001600160a01b038281166000908152600160205260409020548391163314612a6157604051636efb4f4160e11b815260040160405180910390fd5b816001600160a01b0316836001600160a01b03161415612a945760405163afe7ad4960e01b815260040160405180910390fd5b6001600160a01b038381166000818152602c6020908152604080832080546001600160a01b0319169588169586179055602d8252808320858452825291829020429055905192835290917fff0456758201108de53c0ff04c69988d4678ff455b2ce6f733328cf85722c04c91015b60405180910390a2505050565b6060610d7f6007614797565b6003546001600160a01b03163314612b465760405163070545c960e51b815260040160405180910390fd5b6001600160a01b038116612b6d5760405163d92e233d60e01b815260040160405180910390fd5b6001600160a01b03831673eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee1415612bce576040516001600160a01b0382169083156108fc029084906000818181858888f19350505050158015612bc8573d6000803e3d6000fd5b50612be2565b612be26001600160a01b0384168284614fac565b604080516001600160a01b0385811682526020820185905283168183015290517f9a3055ded8c8b5f21bbf4946c5afab6e1fa8b3f057922658e5e1ade125fb0b1e9181900360600190a1505050565b6003546001600160a01b03163314612c5c5760405163070545c960e51b815260040160405180910390fd5b6001600160a01b038116612c835760405163d92e233d60e01b815260040160405180910390fd5b6001600160a01b03811660009081526006602052604090205460ff1615612cbd5760405163274e25dd60e11b815260040160405180910390fd5b6001600160a01b038116600081815260066020908152604091829020805460ff1916600117905590519182527f8addc69f897ecca0e41d70ed4ff9d75a9148a615a0fbda8597e53aea2684302f910161233e565b6001600160a01b038381166000908152600160205260409020548491163314612d4d57604051636efb4f4160e11b815260040160405180910390fd5b6001600160a01b038216612d745760405163d92e233d60e01b815260040160405180910390fd5b6001600160a01b03808516600090815260186020908152604080832093871683529290522054612db75760405163184c088160e21b815260040160405180910390fd5b6001600160a01b038085166000908152601760209081526040808320938716835292905220544211612dfc576040516327cfdcb760e01b815260040160405180910390fd5b6001600160a01b0384166000908152600c602052604090205460ff1615612e36576040516362e6201d60e01b815260040160405180910390fd5b6001600160a01b0380851660008181526018602090815260408083209488168084529482528083208054908490559383526017825280832085845290915281205590612e83908483614fac565b826001600160a01b0316846001600160a01b0316866001600160a01b03167ffdb7893bf11f50c621e59cc7f1cf540e94295cb27ca869ec7ed7618ca792886284604051612ed291815260200190565b60405180910390a45050505050565b60026000541415612f045760405162461bcd60e51b815260040161175b90615d3f565b60026000908155338152600c602052604090205460ff1615612f39576040516362e6201d60e01b815260040160405180910390fd5b612f44601a336147ab565b15612f625760405163d7229c4360e01b815260040160405180910390fd5b601f54612f6f9042615bc0565b3360009081526016602090815260408083206001600160a01b03871680855292528083209390935591516370a0823160e01b81523060048201529091906370a082319060240160206040518083038186803b158015612fcd57600080fd5b505afa158015612fe1573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906130059190615bff565b905061301c6001600160a01b038416333085615072565b6040516370a0823160e01b815230600482015281906001600160a01b038516906370a082319060240160206040518083038186803b15801561305d57600080fd5b505afa158015613071573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906130959190615bff565b61309f9190615ba9565b336000908152601960209081526040808320805460ff19166001179055601582528083206001600160a01b03881684529091528120805492945084929091906130e9908490615bc0565b90915550506040518281526001600160a01b0384169033907fa7e66869262026842e8d81f5e6806cdc8d846e27c824e2e22f4fe51442771b349060200160405180910390a35050600160005550565b6020546131459042615bc0565b3360008181526017602090815260408083206001600160a01b03881680855290835281842095909555928252600d81528282209382529290925281208054839290613191908490615ba9565b90915550503360009081526018602090815260408083206001600160a01b0386168452909152812080548392906131c9908490615bc0565b90915550506040518181526001600160a01b0383169033907f9aaab310d247ad45aef26bbdefc4ebf20c728fdb84c92b95b2b05d21826940de9060200160405180910390a35050565b6003546001600160a01b0316331461323d5760405163070545c960e51b815260040160405180910390fd5b6001600160a01b03811660009081526005602052604090205460ff16613276576040516336fe17e760e21b815260040160405180910390fd5b6001600160a01b038116600081815260056020908152604091829020805460ff1916905590519182527f3ed8cbce8cab40e59282f1743e2b607effa08b5cbe0111bb4721134f2f80d025910161233e565b6001600160a01b03818116600090815260016020526040902054829116331461330357604051636efb4f4160e11b815260040160405180910390fd5b6001600160a01b0383166000908152600c602052604090205460ff168061334257506001600160a01b0382166000908152600c602052604090205460ff165b156133605760405163ad2fdf3b60e01b815260040160405180910390fd5b6001600160a01b038381166000908152602c602052604090205481169083161461339d57604051630ced616b60e21b815260040160405180910390fd5b6001600160a01b038084166000908152602d60209081526040808320938616835292905220546133cf90603c90615bc0565b4210156133ef576040516356248e9760e01b815260040160405180910390fd5b6133f883615014565b61340182615014565b6001600160a01b038316600090815260116020526040812061342290615122565b1115613504576001600160a01b038316600090815260116020526040812061344a908261512c565b6001600160a01b038086166000908152600e6020818152604080842085871680865290835281852054958a168552928252808420928452919052812080549394509192613498908490615bc0565b90915550506001600160a01b038085166000818152600e6020908152604080832094861683529381528382208290559181526011909152206134da908261510d565b506001600160a01b03831660009081526011602052604090206134fd9082614eed565b5050613401565b6001600160a01b038316600090815260126020526040812061352590615122565b1115613607576001600160a01b038316600090815260126020526040812061354d908261512c565b6001600160a01b03808616600090815260286020818152604080842085871680865290835281852054958a16855292825280842092845291905281208054939450919261359b908490615bc0565b90915550506001600160a01b03808516600090815260286020908152604080832085851684528252808320839055928616825260129052206135dd9082614eed565b506001600160a01b0384166000908152601260205260409020613600908261510d565b5050613504565b6001600160a01b0380841660009081526010602052604080822054928516825281208054909190613639908490615bc0565b90915550506001600160a01b038084166000908152601060209081526040808320839055600f9091528082205492851682528120805490919061367d908490615bc0565b90915550506001600160a01b0383166000908152600f6020908152604080832083905560299091528120556136b3601a8461510d565b506001600160a01b03838116600081815260016020908152604080832080546001600160a01b031990811690915560028352818420805482169055602d8352818420958816808552958352818420849055848452602c835292819020805490931690925590519182527f9b712b63e3fb1325fa042d3c238ce8144937875065900528ea1e4f3b00f379f29101612b02565b6003546001600160a01b0316331461376f5760405163070545c960e51b815260040160405180910390fd5b60238190556040518181527fbdcfd7b8482f31cff6a87c362d9e2e3887f4cdc2018c7c485d8e78a7b2fadb699060200161233e565b6003546001600160a01b031633146137cf5760405163070545c960e51b815260040160405180910390fd5b6137da602682614eed565b6137f75760405163f25e6b9f60e01b815260040160405180910390fd5b806001600160a01b03166316f0115b6040518163ffffffff1660e01b815260040160206040518083038186803b15801561383057600080fd5b505afa158015613844573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906138689190615e23565b6001600160a01b038281166000908152601360205260409081902080546001600160a01b0319169383169384179055601e54905163696a437b60e01b81526004810193909352169063696a437b9060240160206040518083038186803b1580156138d157600080fd5b505afa1580156138e5573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906139099190615e08565b6001600160a01b0382166000908152601460205260409020805460ff1916911515919091179055613939816111cb565b6001600160a01b0382166000818152602b6020908152604091829020845181548684015166ffffffffffffff908116600160381b026001600160701b031990921692169190911717815593820151600190940193909355519081527fabfa8db4d238fa78bf4e15fcc91328dd35f3978f200e2857a56bb719732b7b0b910161233e565b6003546001600160a01b031633146139e75760405163070545c960e51b815260040160405180910390fd5b601f8190556040518181527fd319ef78d2b690bb773fcccc2d096306bac7c9222dd0bb6b300f461e4a376b439060200161233e565b3360009081526005602052604090205460ff16613a4c57604051637e57b1e160e01b815260040160405180910390fd5b6001600160a01b0384166000908152600c602052604090205460ff16613a85576040516310cec38560e21b815260040160405180910390fd5b613a9184848484615138565b336001600160a01b0385167f10a73de7ab6e9023aa6e2bc23f7abf4dcef591487e7e55f44c00e34fe60d56db613ac78486615bc0565b60405190815260200161172a565b613ae0601a826147ab565b15613afe57604051630809740d60e01b815260040160405180910390fd5b6001600160a01b03811660009081526019602052604090205460ff1615613b3857604051632f3d320560e01b815260040160405180910390fd5b613b43601a82614eed565b506001600160a01b03811660008181526001602052604080822080546001600160a01b0319163390811790915590519092917fed3faef50715743626cd57de74281a2b17cdbfc11c0486feda541fb911e0293d91a350565b6003546001600160a01b03163314613bc65760405163070545c960e51b815260040160405180910390fd5b6001600160a01b038116613bed5760405163d92e233d60e01b815260040160405180910390fd5b601d80546001600160a01b0319166001600160a01b0383169081179091556040519081527feb931b4b5a98d20a6b1e6693a7c59d8e337a06e2f1473bb776e19251db7ae2509060200161233e565b6003546001600160a01b03163314613c665760405163070545c960e51b815260040160405180910390fd5b62015180811015613c8a57604051633f384aad60e21b815260040160405180910390fd5b60228190556040518181527f54aafa56429e22230b52f1495588ffc632277d74f3a85ec755e13ac50c1584d99060200161233e565b60026000541415613ce25760405162461bcd60e51b815260040161175b90615d3f565b600260009081556001600160a01b03858116825260016020526040909120548591163314613d2357604051636efb4f4160e11b815260040160405180910390fd5b6001600160a01b03808616600090815260256020908152604080832093881683529290522054613d5590603c90615bc0565b4211613d7457604051631e0b407560e01b815260040160405180910390fd5b6001600160a01b038086166000908152600e6020908152604080832093881683529290522054831115613dba5760405163024ae82d60e61b815260040160405180910390fd5b6001600160a01b0385166000908152600c602052604090205460ff1615613df45760405163ad2fdf3b60e01b815260040160405180910390fd5b6001600160a01b038086166000908152600e6020908152604080832093881683529290529081208054859290613e2b908490615ba9565b90915550613e4590506001600160a01b0385168385614fac565b6001600160a01b038086166000908152600e6020908152604080832093881683529290522054613e93576001600160a01b0385166000908152601160205260409020613e91908561510d565b505b816001600160a01b0316846001600160a01b0316866001600160a01b03167f53e982dd9ec088d634c74c98fbbc161f808b4b6469a26c657120b9a31cb34bfe86604051613ee291815260200190565b60405180910390a450506001600055505050565b336000818152600c602052604090205460ff1615613f275760405163ad2fdf3b60e01b815260040160405180910390fd5b6001600160a01b0383166000908152600c602052604090205460ff1615613f61576040516362e6201d60e01b815260040160405180910390fd5b613f6c601a826147ab565b613f885760405162941a5760e11b815260040160405180910390fd5b6001600160a01b038082166000908152600e6020908152604080832093881683529290522054821115613fce5760405163356680b760e01b815260040160405180910390fd5b6001600160a01b038082166000908152600e6020908152604080832093881683529290529081208054849290614005908490615ba9565b9091555061401f90506001600160a01b0385168484614fac565b826001600160a01b0316816001600160a01b0316856001600160a01b03167f46f2180879a7123a197cc3828c28955d70d661c70acbdc02450daf5f9a9c1cfa85614067614e75565b6040805192835260208301919091520160405180910390a450505050565b6003546001600160a01b031633146140b05760405163070545c960e51b815260040160405180910390fd5b60218190556040518181527f24d51b415694a791b1c77df7817c075ac82b83ce611bcd8627d2e66cf37aa3e79060200161233e565b6003546001600160a01b031633146141105760405163070545c960e51b815260040160405180910390fd5b6001600160a01b0381166141375760405163d92e233d60e01b815260040160405180910390fd5b614142600954614f64565b601c80546001600160a01b0319166001600160a01b0383169081179091556040519081527f1d1a3e7caf0717056e48dc8aefa54d806c7af86324fece4e5d49f8e1f01f84bf9060200161233e565b6003546001600160a01b031633146141bb5760405163070545c960e51b815260040160405180910390fd5b6001600160a01b03811660009081526006602052604090205460ff166141f457604051633ca0d42760e11b815260040160405180910390fd5b6001600160a01b038116600081815260066020908152604091829020805460ff1916905590519182527f5e8bd21d0a98cb2caf33706e56139ff40ffbdca7ec5d9d412a0a2292496dc70e910161233e565b6003546001600160a01b031633146142705760405163070545c960e51b815260040160405180910390fd5b6142798161529d565b50565b3360009081526005602052604090205460ff166142ac57604051637e57b1e160e01b815260040160405180910390fd5b6001600160a01b0383166000908152600c602052604090205460ff166142e5576040516310cec38560e21b815260040160405180910390fd5b6001600160a01b038316600090815260116020526040902061430790836147ab565b61432457604051632eda7a1160e01b815260040160405180910390fd5b6001600160a01b038084166000908152600e60209081526040808320938616835292905220548111156143695760405162919bed60e01b815260040160405180910390fd5b60035460405163a9059cbb60e01b81526001600160a01b039182166004820152602481018390529083169063a9059cbb90604401602060405180830381600087803b1580156143b757600080fd5b505af19250505080156143e7575060408051601f3d908101601f191682019092526143e491810190615e08565b60015b6143f0576143f2565b505b6001600160a01b038084166000908152600e6020908152604080832093861683529290529081208054839290614429908490615ba9565b90915550506001600160a01b038084166000908152600e602090815260408083209386168352929052205461447c576001600160a01b038316600090815260116020526040902061447a908361510d565b505b604080516001600160a01b038481168252602082018490523392908616917f20262b97130b5cb8f80624eed2733df2b05db4a0789b4a3d0157e1d3183331049101612770565b3360009081526006602052604090205460ff166144f257604051630942721960e31b815260040160405180910390fd5b6001600160a01b0381166000908152600c602052604090205460ff161561452c576040516304ee891b60e11b815260040160405180910390fd5b6001600160a01b0381166000818152600c6020526040808220805460ff19166001179055513392917f070125a1c0f5202217aae14ec399abfaaa13c2fd98a91d43bd3a897dd4751e8091a350565b6000614584614e75565b602e556145926007876147ab565b80156145c357506001600160a01b038087166000908152600d60209081526040808320938916835292905220548411155b80156145e757506001600160a01b0386166000908152600a60205260409020548311155b801561461657506001600160a01b0386166000908152600b602052604090205482906146139042615ba9565b10155b1561465a577f4851cad52e624c8f7a1d44c28a80db05988ba2451fc0db6b0ec338d8eca95afb602e5460405161464e91815260200190565b60405180910390a15060015b95945050505050565b6003546001600160a01b0316331461468e5760405163070545c960e51b815260040160405180910390fd5b614699601a836147ab565b6146b657604051636211d34960e01b815260040160405180910390fd5b6146bf82615014565b6001600160a01b0382166000908152600f6020526040812080548392906146e7908490615bc0565b90915550506001600160a01b038216600081815260296020908152604080832054600f909252918290205491517f5abcf5031fdbd3badb9d1e09094208de329aee72730e87650f346584205d23d192614747928252602082015260400190565b60405180910390a25050565b6000602254826147639190615e40565b610e919083615ba9565b600060225483101561262b576022546147868385615d76565b6147909190615dab565b9050610e91565b606060006147a483615320565b9392505050565b6001600160a01b038116600090815260018301602052604081205415156147a4565b6000610e918260225460235461537c565b600260005414156148015760405162461bcd60e51b815260040161175b90615d3f565b600260009081556001600160a01b038416815260126020526040902061482790836147ab565b614843576040516241cfa560e21b815260040160405180910390fd5b6001600160a01b038084166000908152602860209081526040808320938616835292905220548111156148895760405163435b562560e01b815260040160405180910390fd5b6148928361542a565b60006148a1610e8183856149ec565b6001600160a01b03851660009081526010602052604090205490915015614957576001600160a01b038416600090815260106020908152604080832054600f909252909120546148f2908390615d76565b6148fc9190615dab565b6001600160a01b0385166000908152600f602052604081208054909190614924908490615ba9565b90915550506001600160a01b03841660009081526010602052604081208054839290614951908490615ba9565b90915550505b6001600160a01b0380851660009081526028602090815260408083209387168352929052908120805484929061498e908490615ba9565b90915550506001600160a01b038085166000908152602860209081526040808320938716835292905220546149e1576001600160a01b03841660009081526012602052604090206149df908461510d565b505b505060016000555050565b6001600160a01b0381166000908152602b602052604081206001015415610e91576001600160a01b03821660009081526014602052604081205460ff16614a5e576001600160a01b0383166000908152602b6020526040902054614a5990600160381b900460060b615bd8565b614a82565b6001600160a01b0383166000908152602b6020526040902054600160381b900460060b5b601e5460225460405163a0d2710760e01b815260048101889052600684900b602482015260448101919091529192506001600160a01b03169063a0d271079060640160206040518083038186803b158015614adc57600080fd5b505afa158015614af0573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d6b9190615bff565b6000614b1f42614753565b6001600160a01b038316600090815260296020526040902054101561157857614b4f60225442610c8f9190615ba9565b6001600160a01b03831660009081526029602052604090205411614bc557614b768261542a565b6001600160a01b038216600090815260106020908152604080832054600f90925290912055614ba442614753565b6001600160a01b038316600090815260296020526040902055506001919050565b6022546001600160a01b038316600090815260296020526040902054614beb9042615ba9565b10614c4757614bf98261542a565b6001600160a01b038216600090815260106020908152604080832054600f83528184205560225460299092528220805491929091614c38908490615bc0565b90915550600191506115789050565b614c5042614753565b6001600160a01b0383166000908152602a60205260409020541015611578576001600160a01b038216600090815260106020526040902054614c918361542a565b6001600160a01b038316600090815260106020908152604080832054600f909252909120548291614cc191615d76565b614ccb9190615dab565b6001600160a01b0384166000908152600f602052604090205550919050565b6001600160a01b038116600090815260296020526040902054614d2f90614d119042615ba9565b6001600160a01b03831660009081526010602052604090205461476d565b6001600160a01b0382166000908152600f602052604081208054909190614d57908490615bc0565b90915550506001600160a01b03166000908152602960205260409020429055565b6001600160a01b0383166000908152600f6020526040902054811115614db15760405163356680b760e01b815260040160405180910390fd5b6001600160a01b0383166000908152602a60209081526040808320429055600f90915281208054839290614de6908490615ba9565b90915550506001600160a01b038083166000908152600d60209081526040808320601c5490941683529290529081208054839290614e25908490615bc0565b90915550506001600160a01b0382166000908152600a602052604081208054839290614e52908490615bc0565b925050819055508060096000828254614e6b9190615bc0565b9091555050505050565b6000603f5a614e85906040615d76565b610d7f9190615dab565b60048054600380546001600160a01b0383166001600160a01b031991821681179092559091169091556040519081527f5d5d6e01b731c3e68060f7fe13156f6197d4aeffc2d6f498e34c717ae616b7349060200160405180910390a1565b60006147a4836001600160a01b03841661544f565b601c54604051630852cd8d60e31b8152600481018390526001600160a01b03909116906342966c68906024015b600060405180830381600087803b158015614f4957600080fd5b505af1158015614f5d573d6000803e3d6000fd5b5050505050565b8060096000828254614f769190615ba9565b9091555050601d5460405163140e25ad60e31b8152600481018390526001600160a01b039091169063a0712d6890602401614f2f565b6040516001600160a01b03831660248201526044810182905261500f90849063a9059cbb60e01b906064015b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b03199093169290921790915261549e565b505050565b61501d81614b14565b5061502781614cea565b6001600160a01b0381166000908152600f60209081526040808320546010909252909120546150569190615570565b6001600160a01b039091166000908152600f6020526040902055565b6040516001600160a01b03808516602483015283166044820152606481018290526150aa9085906323b872dd60e01b90608401614fd8565b50505050565b6000808486602e546150c29190615ba9565b6150cc9190615bc0565b9050670de0b6b3a7640000846127106150e58685615d76565b6150ef9190615dab565b6150f99190615d76565b6151039190615dab565b9695505050505050565b60006147a4836001600160a01b038416615586565b6000610e91825490565b60006147a48383615679565b601c546001600160a01b0384811691161461521f576003546001600160a01b038085169163a9059cbb911661516d8486615bc0565b6040516001600160e01b031960e085901b1681526001600160a01b0390921660048301526024820152604401602060405180830381600087803b1580156151b357600080fd5b505af19250505080156151e3575060408051601f3d908101601f191682019092526151e091810190615e08565b60015b61521d573d808015615211576040519150601f19603f3d011682016040523d82523d6000602084013e615216565b606091505b505061521f565b505b6001600160a01b038085166000908152600d6020908152604080832093871683529290529081208054849290615256908490615ba9565b90915550506001600160a01b03808516600090815260186020908152604080832093871683529290529081208054839290615292908490615ba9565b909155505050505050565b6001600160a01b0381166152c45760405163d92e233d60e01b815260040160405180910390fd5b600480546001600160a01b0319166001600160a01b038381169182179092556003546040805191909316815260208101919091527f6353ec38ac394f8be94bfafcdd3580d356470599059eaeebedc3207e1cc03dec910161233e565b60608160000180548060200260200160405190810160405280929190818152602001828054801561537057602002820191906000526020600020905b81548152602001906001019080831161535c575b50505050509050919050565b6000808060001985870985870292508281108382030391505080600014156153b657600084116153ab57600080fd5b5082900490506147a4565b8084116153c257600080fd5b600084868809600260036001881981018916988990049182028318808302840302808302840302808302840302808302840302808302840302918202909203026000889003889004909101858311909403939093029303949094049190911702949350505050565b615433816156a3565b6001600160a01b03909116600090815260106020526040902055565b600081815260018301602052604081205461549657508154600181810184556000848152602080822090930184905584548482528286019093526040902091909155610e91565b506000610e91565b60006154f3826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b03166157de9092919063ffffffff16565b80519091501561500f57808060200190518101906155119190615e08565b61500f5760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b606482015260840161175b565b600081831061557f57816147a4565b5090919050565b6000818152600183016020526040812054801561566f5760006155aa600183615ba9565b85549091506000906155be90600190615ba9565b90508181146156235760008660000182815481106155de576155de615c18565b906000526020600020015490508087600001848154811061560157615601615c18565b6000918252602080832090910192909255918252600188019052604090208390555b855486908061563457615634615e54565b600190038181906000526020600020016000905590558560010160008681526020019081526020016000206000905560019350505050610e91565b6000915050610e91565b600082600001828154811061569057615690615c18565b9060005260206000200154905092915050565b6000805b6001600160a01b03831660009081526012602052604090206156c890615122565b81101561262b576001600160a01b03831660009081526012602052604081206156f1908361512c565b90506156fe6026826147ab565b156157cb5761570c42614753565b6001600160a01b0382166000908152602b60205260409020600101541461578a57615736816111cb565b6001600160a01b0382166000908152602b6020908152604091829020835181549285015166ffffffffffffff908116600160381b026001600160701b03199094169116179190911781559101516001909101555b6001600160a01b038085166000908152602860209081526040808320938516835292905220546157be90610e8190836149ec565b6157c89084615bc0565b92505b50806157d681615ded565b9150506156a7565b6060610d6b848460008585843b6158375760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e7472616374000000604482015260640161175b565b600080866001600160a01b031685876040516158539190615e96565b60006040518083038185875af1925050503d8060008114615890576040519150601f19603f3d011682016040523d82523d6000602084013e615895565b606091505b50915091506158a58282866158b0565b979650505050505050565b606083156158bf5750816147a4565b8251156158cf5782518084602001fd5b8160405162461bcd60e51b815260040161175b9190615eb2565b6001600160a01b038116811461427957600080fd5b60006020828403121561591057600080fd5b81356147a4816158e9565b6000806040838503121561592e57600080fd5b8235615939816158e9565b91506020830135615949816158e9565b809150509250929050565b6020808252825182820181905260009190848201906040850190845b818110156159955783516001600160a01b031683529284019291840191600101615970565b50909695505050505050565b600080604083850312156159b457600080fd5b82356159bf816158e9565b946020939093013593505050565b6000806000606084860312156159e257600080fd5b83356159ed816158e9565b925060208401356159fd816158e9565b929592945050506040919091013590565b600060208284031215615a2057600080fd5b5035919050565b600080600060608486031215615a3c57600080fd5b8335615a47816158e9565b9250602084013591506040840135615a5e816158e9565b809150509250925092565b600080600060608486031215615a7e57600080fd5b8335615a89816158e9565b92506020840135615a99816158e9565b91506040840135615a5e816158e9565b60008060008060808587031215615abf57600080fd5b8435615aca816158e9565b93506020850135615ada816158e9565b93969395505050506040820135916060013590565b60008060008060808587031215615b0557600080fd5b8435615b10816158e9565b93506020850135615b20816158e9565b9250604085013591506060850135615b37816158e9565b939692955090935050565b600080600080600060a08688031215615b5a57600080fd5b8535615b65816158e9565b94506020860135615b75816158e9565b94979496505050506040830135926060810135926080909101359150565b634e487b7160e01b600052601160045260246000fd5b600082821015615bbb57615bbb615b93565b500390565b60008219821115615bd357615bd3615b93565b500190565b60008160060b667fffffffffffff19811415615bf657615bf6615b93565b60000392915050565b600060208284031215615c1157600080fd5b5051919050565b634e487b7160e01b600052603260045260246000fd5b6001600160a01b038316815260406020808301829052835191830182905260009184820191906060850190845b81811015615c7d57845163ffffffff1683529383019391830191600101615c5b565b5090979650505050505050565b8051600681900b811461157857600080fd5b8051801515811461157857600080fd5b600080600060608486031215615cc157600080fd5b615cca84615c8a565b9250615cd860208501615c8a565b9150615ce660408501615c9c565b90509250925092565b60008160060b8360060b6000811281667fffffffffffff1901831281151615615d1a57615d1a615b93565b81667fffffffffffff018313811615615d3557615d35615b93565b5090039392505050565b6020808252601f908201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604082015260600190565b6000816000190483118215151615615d9057615d90615b93565b500290565b634e487b7160e01b600052601260045260246000fd5b600082615dba57615dba615d95565b500490565b600080600060608486031215615dd457600080fd5b8351925060208401519150604084015190509250925092565b6000600019821415615e0157615e01615b93565b5060010190565b600060208284031215615e1a57600080fd5b6147a482615c9c565b600060208284031215615e3557600080fd5b81516147a4816158e9565b600082615e4f57615e4f615d95565b500690565b634e487b7160e01b600052603160045260246000fd5b60005b83811015615e85578181015183820152602001615e6d565b838111156150aa5750506000910152565b60008251615ea8818460208701615e6a565b9190910192915050565b6020815260008251806020840152615ed1816040850160208701615e6a565b601f01601f1916919091016040019291505056feee3f0daba9837d1ab0597acf34328550e4832d02e24e467825e7c2dd318c3820a26469706673582212206e1483b7a07adf244c4dcbc9db3b152c8ccb794dfa115f57fff41dd9b9e218ca64736f6c63430008080033", + "deployedBytecode": "0x608060405234801561001057600080fd5b50600436106104ac5760003560e01c8063966abd001161026d578063cb4be2bb11610151578063ec8ca643116100ce578063f25e311b11610092578063f25e311b14610c0f578063f263c47014610c22578063f75f9f7b14610c2b578063f9d46cf214610c3e578063fc253d2b14610c51578063fe75bc4614610c5a57600080fd5b8063ec8ca64314610b8d578063f0f346b914610bb6578063f11a1d1a14610bc9578063f136a09d14610bdc578063f235757f14610bfc57600080fd5b8063ddca3f4311610115578063ddca3f4314610b2b578063e3056a3414610b34578063e326ac4314610b47578063ebbb619414610b67578063ec00cdfc14610b7a57600080fd5b8063cb4be2bb14610ab4578063cb54694d14610ac7578063cd22af1b14610ada578063d55995fe14610b05578063dd2080d614610b1857600080fd5b8063aac6aa9c116101ea578063b600702a116101ae578063b600702a14610a32578063b7e7734014610a45578063b87fcbff14610a58578063c20297f014610a7b578063c5198abc14610a8e578063c7ae40d014610aa157600080fd5b8063aac6aa9c146109ab578063af320e81146109be578063b0103b1a146109d1578063b2392233146109f4578063b440027f14610a0757600080fd5b8063a515366a11610231578063a515366a14610941578063a5d059ca14610954578063a676f9ff14610967578063a734f06e14610987578063a7d2e784146109a257600080fd5b8063966abd00146108b457806398e90a0f146108c75780639d5c33d8146108f0578063a214580914610903578063a39744b51461091657600080fd5b806359a2255e116103945780636e2a9ca611610311578063878c723e116102d5578063878c723e146108275780638bb6dfa8146108505780638cb22b76146108635780638fe204dd1461088657806390a4684e14610899578063951dc22c146108ac57600080fd5b80636e2a9ca6146107dd57806372da828a146107f057806374a8f10314610803578063768b5d90146108165780637c8fce231461081f57600080fd5b806368a9f19c1161035857806368a9f19c14610766578063694798e61461077957806369fe0e2d146107a45780636ba42aaa146107b75780636cf262bc146107ca57600080fd5b806359a2255e1461071b5780635ebe23f01461072e5780635feeb79414610737578063633fb68f1461074a57806364bb43ee1461075357600080fd5b8063168f92e71161042d578063274a8db4116103f1578063274a8db41461068957806351cff8d9146106bc57806352a4de29146106cf57806355ea6c47146106e2578063575288bf146106f5578063594a3a931461070857600080fd5b8063168f92e7146105ed5780631b44555e146106185780631c5a9d9c146106385780631ef94b911461064b57806321040b011461065e57600080fd5b80631101eb41116104745780631101eb411461055557806311466d721461056a57806313f6986d1461057d57806315006b8214610585578063165e62e7146105b057600080fd5b8063034d4c61146104b157806307b435c2146104d75780630c340a24146105025780630c620bce1461052d5780630d6a1f8714610542575b600080fd5b6104c46104bf3660046158fe565b610c6d565b6040519081526020015b60405180910390f35b6104c46104e536600461591b565b601760209081526000928352604080842090915290825290205481565b600354610515906001600160a01b031681565b6040516001600160a01b0390911681526020016104ce565b610535610d73565b6040516104ce9190615954565b6104c46105503660046159a1565b610d84565b6105686105633660046159cd565b610e97565b005b6105686105783660046159a1565b610ff1565b610568611196565b6104c461059336600461591b565b601560209081526000928352604080842090915290825290205481565b6105c36105be3660046158fe565b6111cb565b604080518251600690810b825260208085015190910b9082015291810151908201526060016104ce565b6104c46105fb36600461591b565b600e60209081526000928352604080842090915290825290205481565b6104c46106263660046158fe565b600a6020526000908152604090205481565b6105686106463660046158fe565b61157d565b601c54610515906001600160a01b031681565b6104c461066c36600461591b565b601860209081526000928352604080842090915290825290205481565b6106ac6106973660046158fe565b60066020526000908152604090205460ff1681565b60405190151581526020016104ce565b6105686106ca3660046158fe565b611738565b6105686106dd3660046159cd565b6118d0565b6105686106f03660046158fe565b611b03565b6105686107033660046159cd565b611bb7565b61056861071636600461591b565b611e72565b6105686107293660046158fe565b611f17565b6104c4601f5481565b6105686107453660046158fe565b611fc9565b6104c460215481565b6105686107613660046158fe565b61226e565b6105686107743660046158fe565b612349565b6104c461078736600461591b565b602860209081526000928352604080842090915290825290205481565b6105686107b2366004615a0e565b612429565b6106ac6107c53660046158fe565b612489565b6104c46107d83660046158fe565b6124e9565b6105686107eb3660046159cd565b612631565b6105686107fe3660046158fe565b61277d565b6105686108113660046158fe565b61281d565b6104c460225481565b610535612918565b6105156108353660046158fe565b6001602052600090815260409020546001600160a01b031681565b6104c461085e3660046158fe565b612924565b6106ac6108713660046158fe565b60196020526000908152604090205460ff1681565b610568610894366004615a0e565b6129c7565b6105686108a736600461591b565b612a25565b610535612b0f565b6105686108c2366004615a27565b612b1b565b6105156108d53660046158fe565b6002602052600090815260409020546001600160a01b031681565b6105686108fe3660046158fe565b612c31565b610568610911366004615a69565b612d11565b6104c461092436600461591b565b600d60209081526000928352604080842090915290825290205481565b61056861094f3660046159a1565b612ee1565b6105686109623660046159a1565b613138565b6104c46109753660046158fe565b60296020526000908152604090205481565b61051573eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee81565b6104c460205481565b6105686109b93660046158fe565b613212565b6105686109cc36600461591b565b6132c7565b6106ac6109df3660046158fe565b600c6020526000908152604090205460ff1681565b610568610a02366004615a0e565b613744565b6104c4610a1536600461591b565b602560209081526000928352604080842090915290825290205481565b610568610a403660046158fe565b6137a4565b610568610a53366004615a0e565b6139bc565b6106ac610a663660046158fe565b60056020526000908152604090205460ff1681565b610568610a89366004615aa9565b613a1c565b610568610a9c3660046158fe565b613ad5565b601d54610515906001600160a01b031681565b610568610ac23660046158fe565b613b9b565b610568610ad5366004615a0e565b613c3b565b6104c4610ae836600461591b565b601660209081526000928352604080842090915290825290205481565b610568610b13366004615aef565b613cbf565b610568610b263660046159cd565b613ef6565b6104c460245481565b600454610515906001600160a01b031681565b6104c4610b553660046158fe565b600b6020526000908152604090205481565b610568610b75366004615a0e565b614085565b610568610b883660046158fe565b6140e5565b610515610b9b3660046158fe565b602c602052600090815260409020546001600160a01b031681565b610568610bc43660046158fe565b614190565b601e54610515906001600160a01b031681565b6104c4610bea3660046158fe565b602a6020526000908152604090205481565b610568610c0a3660046158fe565b614245565b610568610c1d3660046159cd565b61427c565b6104c460095481565b610568610c393660046158fe565b6144c2565b6106ac610c4c366004615b42565b61457a565b6104c460235481565b610568610c683660046159a1565b614663565b600080610c79836124e9565b6022549091504290610c9490610c8f9083615ba9565b614753565b6001600160a01b0385166000908152602960205260409020541115610d38576022546001600160a01b038516600090815260296020526040902054610cd99042615ba9565b10610d15576022546001600160a01b038516600090815260296020526040902054610d049190615bc0565b610d0e9082615ba9565b9050610d4e565b6001600160a01b038416600090815260296020526040902054610d0e9082615ba9565b610d4142614753565b610d4b9082615ba9565b90505b610d58818361476d565b610d6185612924565b610d6b9190615bc0565b949350505050565b6060610d7f6026614797565b905090565b6000610d916026846147ab565b15610e91576000610da1846111cb565b90508060400151600014610e8f576001600160a01b03841660009081526014602052604081205460ff16610de2578160200151610ddd90615bd8565b610de8565b81602001515b601e5460225460405163a0d2710760e01b815260048101889052600684900b60248201526044810191909152919250610e86916001600160a01b039091169063a0d27107906064015b60206040518083038186803b158015610e4957600080fd5b505afa158015610e5d573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e819190615bff565b6147cd565b92505050610e91565b505b92915050565b6001600160a01b038381166000908152600160205260409020548491163314610ed357604051636efb4f4160e11b815260040160405180910390fd5b602054610ee09042615bc0565b6001600160a01b03808616600081815260176020908152604080832094891680845294825280832095909555918152601882528381209281529190529081208054849290610f2f908490615bc0565b90915550610f4090508484846147de565b6001600160a01b038085166000908152602860209081526040808320938716835292905220548015801590610f7f5750602154610f7d82866149ec565b105b15610f9d57604051636f447fcd60e11b815260040160405180910390fd5b836001600160a01b0316856001600160a01b03167f9aaab310d247ad45aef26bbdefc4ebf20c728fdb84c92b95b2b05d21826940de85604051610fe291815260200190565b60405180910390a35050505050565b336000818152600c602052604090205460ff16156110225760405163ad2fdf3b60e01b815260040160405180910390fd5b61102d601a826147ab565b6110495760405162941a5760e11b815260040160405180910390fd5b61105281614b14565b156110af576001600160a01b038116600081815260296020908152604080832054600f835281842054601084529382902054825191825292810193909352820152600080516020615ee68339815191529060600160405180910390a25b6001600160a01b0381166000908152600f6020526040902054821115611130576110d881614cea565b6001600160a01b038116600081815260296020908152604080832054600f835281842054601084529382902054825191825292810193909352820152600080516020615ee68339815191529060600160405180910390a25b61113b818484614d78565b601c546001600160a01b038085169183821691167f46f2180879a7123a197cc3828c28955d70d661c70acbdc02450daf5f9a9c1cfa85611179614e75565b6040805192835260208301919091520160405180910390a4505050565b6004546001600160a01b031633146111c157604051639ba0305d60e01b815260040160405180910390fd5b6111c9614e8f565b565b60408051606081018252600080825260208201819052918101919091526111f142614753565b6001600160a01b0383166000908152602b6020526040902060010154141561125f57506001600160a01b03166000908152602b602090815260409182902082516060810184528154600681810b8352600160381b909104900b92810192909252600101549181019190915290565b60008061127360225442610c8f9190615ba9565b6001600160a01b0385166000908152602b60205260409020600101549091508114156113d157604080516001808252818301909252600091602080830190803683375050506001600160a01b0386166000908152602b602052604090205490915060060b6112e042614753565b6112ea9042615ba9565b826000815181106112fd576112fd615c18565b63ffffffff909216602092830291909101820152601e546001600160a01b038881166000908152601390935260409283902054925163dc686d9160e01b81529181169263dc686d91926113599291909116908690600401615c2e565b60606040518083038186803b15801561137157600080fd5b505afa158015611385573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906113a99190615cac565b60069290920b8088529195506113c191839150615cef565b60060b6020860152506115549050565b6001600160a01b0384166000908152602b60205260409020600101548111156115545760408051600280825260608201835260009260208301908036833701905050905061141e42614753565b6114289042615ba9565b8160008151811061143b5761143b615c18565b602002602001019063ffffffff16908163ffffffff168152505060225461146142614753565b61146b9042615ba9565b6114759190615bc0565b8160018151811061148857611488615c18565b63ffffffff909216602092830291909101820152601e546001600160a01b0387811660009081526013909352604080842054905163dc686d9160e01b81529282169263dc686d91926114e09216908690600401615c2e565b60606040518083038186803b1580156114f857600080fd5b505afa15801561150c573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906115309190615cac565b60069290920b8088529195509150611549908290615cef565b60060b602086015250505b811561156d5761156342614753565b6040840152611575565b600060408401525b50505b919050565b336000818152600c602052604090205460ff16156115ae576040516362e6201d60e01b815260040160405180910390fd5b6001600160a01b03808216600090815260166020908152604080832093861683529290522054806115f257604051636258f48160e01b815260040160405180910390fd5b42811061161257604051630fd0eeef60e11b815260040160405180910390fd5b6001600160a01b0382166000908152600b602052604090205461164b576001600160a01b0382166000908152600b602052604090204290555b611656600783614eed565b506001600160a01b038083166000818152601560209081526040808320948816808452948252808320805490849055938352600d82528083209483529390529182208054919283926116a9908490615bc0565b9091555050601c546001600160a01b03858116911614156116e55780600960008282546116d69190615bc0565b909155506116e5905081614f02565b836001600160a01b0316836001600160a01b03167f3673530133b6da67e9854f605b0cfa7bb9798cd33c18036dfc10d8da7c4d4a758360405161172a91815260200190565b60405180910390a350505050565b600260005414156117645760405162461bcd60e51b815260040161175b90615d3f565b60405180910390fd5b600260009081553381526018602090815260408083206001600160a01b03851684529091529020546117a95760405163184c088160e21b815260040160405180910390fd5b3360009081526017602090815260408083206001600160a01b038516845290915290205442116117ec576040516327cfdcb760e01b815260040160405180910390fd5b336000908152600c602052604090205460ff161561181d576040516362e6201d60e01b815260040160405180910390fd5b3360008181526018602090815260408083206001600160a01b038681168086529184528285208054908690559585526017845282852082865290935290832092909255601c541614156118735761187381614f64565b6118876001600160a01b0383163383614fac565b6040518181526001600160a01b0383169033907f2717ead6b9200dd235aad468c9809ea400fe33ac69b5bfaa6d3e90fc922b63989060200160405180910390a350506001600055565b600260005414156118f35760405162461bcd60e51b815260040161175b90615d3f565b60026000556119036026836147ab565b6119205760405163e0b6aead60e01b815260040160405180910390fd5b61192b601a846147ab565b61194857604051636211d34960e01b815260040160405180910390fd5b6001600160a01b038316600090815260126020526040902061196a9083614eed565b5061197483615014565b6021546001600160a01b038085166000908152602860209081526040808320938716835292905220546119b2906119ac908490615bc0565b846149ec565b10156119d157604051636f447fcd60e11b815260040160405180910390fd5b6001600160a01b038316600081815260296020908152604080832054600f835281842054601084529382902054825191825292810193909352820152600080516020615ee68339815191529060600160405180910390a2611a3d6001600160a01b038316333084615072565b6001600160a01b03808416600090815260286020908152604080832093861683529290529081208054839290611a74908490615bc0565b90915550611a879050610e8182846149ec565b6001600160a01b03841660009081526010602052604081208054909190611aaf908490615bc0565b909155505060405181815233906001600160a01b0384811691908616907f4e186bc75a2220191b826baff3ee63c3e970e94e58a9007ff94c9a7b8e6ebb3f9060200160405180910390a45050600160005550565b3360009081526006602052604090205460ff16611b3357604051630942721960e31b815260040160405180910390fd5b6001600160a01b0381166000908152600c602052604090205460ff16611b6c576040516310cec38560e21b815260040160405180910390fd5b6001600160a01b0381166000818152600c6020526040808220805460ff19169055513392917fe02b2375d8fb4aef3e5bc5d53bffcf70b6f185c5c93e69dcbe8b6cfc58e837e291a350565b60026000541415611bda5760405162461bcd60e51b815260040161175b90615d3f565b6002600055611bea601a846147ab565b611c0757604051636211d34960e01b815260040160405180910390fd5b601c546001600160a01b0383811691161415611c355760405162822d9760e71b815260040160405180910390fd5b6040516370a0823160e01b81523060048201526000906001600160a01b038416906370a082319060240160206040518083038186803b158015611c7757600080fd5b505afa158015611c8b573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611caf9190615bff565b9050611cc66001600160a01b038416333085615072565b6040516370a0823160e01b815230600482015260009082906001600160a01b038616906370a082319060240160206040518083038186803b158015611d0a57600080fd5b505afa158015611d1e573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611d429190615bff565b611d4c9190615ba9565b9050600061271060245483611d619190615d76565b611d6b9190615dab565b9050611d778183615ba9565b6001600160a01b038088166000908152600e60209081526040808320938a1683529290529081208054909190611dae908490615bc0565b90915550506001600160a01b0380871660009081526025602090815260408083208985168085529252909120429055600354611deb921683614fac565b6001600160a01b0386166000908152601160205260409020611e0d9086614eed565b50336001600160a01b0316856001600160a01b0316876001600160a01b03167fec1a37d4a331a5059081e0fb5da1735e7890900cd215a4fb1e9f2779fd7b83eb85604051611e5d91815260200190565b60405180910390a45050600160005550505050565b6001600160a01b038281166000908152600160205260409020548391163314611eae57604051636efb4f4160e11b815260040160405180910390fd5b6001600160a01b03838116600081815260026020908152604080832080546001600160a01b031916888716908117909155600190925280832054905191941692917fa8bad3f0b781e1d954af9945167d5f80bfe5e57930f17c93843187c77557a6b891a4505050565b6001600160a01b038181166000908152600260205260409020548291163314611f535760405163cfe9663360e01b815260040160405180910390fd5b6001600160a01b03828116600081815260016020908152604080832080546002909352818420805487166001600160a01b031980861691909117909255805490911690555193169283929133917fcf30c54296d5eee76168b564c59c50578d49c271733a470f32707c8cfbc88a8b9190a4505050565b602e54611fe957604051630262ab9b60e61b815260040160405180910390fd5b336000818152600c602052604090205460ff161561201a5760405163ad2fdf3b60e01b815260040160405180910390fd5b612025601a826147ab565b6120415760405162941a5760e11b815260040160405180910390fd5b61204a81614b14565b156120a7576001600160a01b038116600081815260296020908152604080832054600f835281842054601084529382902054825191825292810193909352820152600080516020615ee68339815191529060600160405180910390a25b601e546001600160a01b038381166000908152600d60209081526040808320601c548516845290915280822054905163435b21c160e01b8152600481019190915290928392839291169063435b21c19060240160606040518083038186803b15801561211257600080fd5b505afa158015612126573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061214a9190615dbf565b925092509250600061215a614e75565b9050600061216a828486886150b0565b6001600160a01b0387166000908152600f60205260409020549091508111156122065761219686614cea565b6001600160a01b038616600081815260296020908152604080832054600f835281842054601084529382902054825191825292810193909352820152600080516020615ee68339815191529060600160405180910390a26121f5614e75565b9150612203828486886150b0565b90505b612211868883614d78565b6000602e55601c5460408051838152602081018590526001600160a01b038a8116938a8216939116917f46f2180879a7123a197cc3828c28955d70d661c70acbdc02450daf5f9a9c1cfa910160405180910390a450505050505050565b6003546001600160a01b031633146122995760405163070545c960e51b815260040160405180910390fd5b6122a460268261510d565b6122c157604051630a8d08b160e01b815260040160405180910390fd5b6001600160a01b038116600081815260136020908152604080832080546001600160a01b031916905560148252808320805460ff19169055602b825280832080546001600160701b03191681556001019290925590519182527f51199d699bdfd516fa88dd0d2f8487c40c147b4867acaa23adc8d4df6b098e5691015b60405180910390a150565b6003546001600160a01b031633146123745760405163070545c960e51b815260040160405180910390fd5b6001600160a01b03811661239b5760405163d92e233d60e01b815260040160405180910390fd5b6001600160a01b03811660009081526005602052604090205460ff16156123d55760405163546da66560e11b815260040160405180910390fd5b6001600160a01b038116600081815260056020908152604091829020805460ff1916600117905590519182527f049ccb28ab796d3225573a065712f6e7754487ced56056cda8889c337511807b910161233e565b6003546001600160a01b031633146124545760405163070545c960e51b815260040160405180910390fd5b60248190556040518181527f4c10ca068ff7002cf5da78f2f697d1e91f6f0ac27f7344b28e8ef25263f87e5d9060200161233e565b6000612493614e75565b602e556124a16007836147ab565b15611578577f4851cad52e624c8f7a1d44c28a80db05988ba2451fc0db6b0ec338d8eca95afb602e546040516124d991815260200190565b60405180910390a1506001919050565b6000805b6001600160a01b038316600090815260126020526040902061250e90615122565b81101561262b576001600160a01b0383166000908152601260205260408120612537908361512c565b90506125446026826147ab565b15612618576000612554826111cb565b90508060400151600014612616576001600160a01b03821660009081526014602052604081205460ff1661259557816020015161259090615bd8565b61259b565b81602001515b601e546001600160a01b03888116600090815260286020908152604080832089851684529091529081902054602254915163a0d2710760e01b81526004810191909152600685900b602482015260448101919091529293506126089291169063a0d2710790606401610e31565b6126129086615bc0565b9450505b505b508061262381615ded565b9150506124ed565b50919050565b3360009081526005602052604090205460ff1661266157604051637e57b1e160e01b815260040160405180910390fd5b6001600160a01b0383166000908152600c602052604090205460ff1661269a576040516310cec38560e21b815260040160405180910390fd5b6126a58383836147de565b60035460405163a9059cbb60e01b81526001600160a01b039182166004820152602481018390529083169063a9059cbb90604401602060405180830381600087803b1580156126f357600080fd5b505af1925050508015612723575060408051601f3d908101601f1916820190925261272091810190615e08565b60015b61272c5761272e565b505b604080516001600160a01b038481168252602082018490523392908616917f6e10247c3c094d220ee99436c164b7f38d63b335a20ed817cbefaee4bb02d20e91015b60405180910390a3505050565b6003546001600160a01b031633146127a85760405163070545c960e51b815260040160405180910390fd5b6001600160a01b0381166127cf5760405163d92e233d60e01b815260040160405180910390fd5b601e80546001600160a01b0319166001600160a01b0383169081179091556040519081527f71973fd672e51deb8f739b1f7e1eab991936645acd6f83e2bde6eeeaff5490b09060200161233e565b3360009081526005602052604090205460ff1661284d57604051637e57b1e160e01b815260040160405180910390fd5b6001600160a01b0381166000908152600c602052604090205460ff16612886576040516310cec38560e21b815260040160405180910390fd5b61289160078261510d565b50601c546001600160a01b038083166000818152600d60209081526040808320949095168083529381528482205492825260188152848220848352905292909220546128df92849291615138565b60405133906001600160a01b038316907f038a17b9b553c0c3fc2ed14b957a5d8420a1666fd2efe5c1b3fe5f23eea61bb390600090a350565b6060610d7f601a614797565b600080612930836124e9565b6022546001600160a01b0385166000908152602960205260409020549192509061295a9042615ba9565b1015610e915760008111612986576001600160a01b0383166000908152600f60205260409020546129c0565b6001600160a01b038316600090815260106020908152604080832054600f909252909120546129b6908390615d76565b6129c09190615dab565b915061262b565b6003546001600160a01b031633146129f25760405163070545c960e51b815260040160405180910390fd5b60208181556040518281527fc8d443472c9783cc36f8f5f5091f08ce9f37fc2f9e6d79cf1d9aaf40a433fee2910161233e565b6001600160a01b038281166000908152600160205260409020548391163314612a6157604051636efb4f4160e11b815260040160405180910390fd5b816001600160a01b0316836001600160a01b03161415612a945760405163afe7ad4960e01b815260040160405180910390fd5b6001600160a01b038381166000818152602c6020908152604080832080546001600160a01b0319169588169586179055602d8252808320858452825291829020429055905192835290917fff0456758201108de53c0ff04c69988d4678ff455b2ce6f733328cf85722c04c91015b60405180910390a2505050565b6060610d7f6007614797565b6003546001600160a01b03163314612b465760405163070545c960e51b815260040160405180910390fd5b6001600160a01b038116612b6d5760405163d92e233d60e01b815260040160405180910390fd5b6001600160a01b03831673eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee1415612bce576040516001600160a01b0382169083156108fc029084906000818181858888f19350505050158015612bc8573d6000803e3d6000fd5b50612be2565b612be26001600160a01b0384168284614fac565b604080516001600160a01b0385811682526020820185905283168183015290517f9a3055ded8c8b5f21bbf4946c5afab6e1fa8b3f057922658e5e1ade125fb0b1e9181900360600190a1505050565b6003546001600160a01b03163314612c5c5760405163070545c960e51b815260040160405180910390fd5b6001600160a01b038116612c835760405163d92e233d60e01b815260040160405180910390fd5b6001600160a01b03811660009081526006602052604090205460ff1615612cbd5760405163274e25dd60e11b815260040160405180910390fd5b6001600160a01b038116600081815260066020908152604091829020805460ff1916600117905590519182527f8addc69f897ecca0e41d70ed4ff9d75a9148a615a0fbda8597e53aea2684302f910161233e565b6001600160a01b038381166000908152600160205260409020548491163314612d4d57604051636efb4f4160e11b815260040160405180910390fd5b6001600160a01b038216612d745760405163d92e233d60e01b815260040160405180910390fd5b6001600160a01b03808516600090815260186020908152604080832093871683529290522054612db75760405163184c088160e21b815260040160405180910390fd5b6001600160a01b038085166000908152601760209081526040808320938716835292905220544211612dfc576040516327cfdcb760e01b815260040160405180910390fd5b6001600160a01b0384166000908152600c602052604090205460ff1615612e36576040516362e6201d60e01b815260040160405180910390fd5b6001600160a01b0380851660008181526018602090815260408083209488168084529482528083208054908490559383526017825280832085845290915281205590612e83908483614fac565b826001600160a01b0316846001600160a01b0316866001600160a01b03167ffdb7893bf11f50c621e59cc7f1cf540e94295cb27ca869ec7ed7618ca792886284604051612ed291815260200190565b60405180910390a45050505050565b60026000541415612f045760405162461bcd60e51b815260040161175b90615d3f565b60026000908155338152600c602052604090205460ff1615612f39576040516362e6201d60e01b815260040160405180910390fd5b612f44601a336147ab565b15612f625760405163d7229c4360e01b815260040160405180910390fd5b601f54612f6f9042615bc0565b3360009081526016602090815260408083206001600160a01b03871680855292528083209390935591516370a0823160e01b81523060048201529091906370a082319060240160206040518083038186803b158015612fcd57600080fd5b505afa158015612fe1573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906130059190615bff565b905061301c6001600160a01b038416333085615072565b6040516370a0823160e01b815230600482015281906001600160a01b038516906370a082319060240160206040518083038186803b15801561305d57600080fd5b505afa158015613071573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906130959190615bff565b61309f9190615ba9565b336000908152601960209081526040808320805460ff19166001179055601582528083206001600160a01b03881684529091528120805492945084929091906130e9908490615bc0565b90915550506040518281526001600160a01b0384169033907fa7e66869262026842e8d81f5e6806cdc8d846e27c824e2e22f4fe51442771b349060200160405180910390a35050600160005550565b6020546131459042615bc0565b3360008181526017602090815260408083206001600160a01b03881680855290835281842095909555928252600d81528282209382529290925281208054839290613191908490615ba9565b90915550503360009081526018602090815260408083206001600160a01b0386168452909152812080548392906131c9908490615bc0565b90915550506040518181526001600160a01b0383169033907f9aaab310d247ad45aef26bbdefc4ebf20c728fdb84c92b95b2b05d21826940de9060200160405180910390a35050565b6003546001600160a01b0316331461323d5760405163070545c960e51b815260040160405180910390fd5b6001600160a01b03811660009081526005602052604090205460ff16613276576040516336fe17e760e21b815260040160405180910390fd5b6001600160a01b038116600081815260056020908152604091829020805460ff1916905590519182527f3ed8cbce8cab40e59282f1743e2b607effa08b5cbe0111bb4721134f2f80d025910161233e565b6001600160a01b03818116600090815260016020526040902054829116331461330357604051636efb4f4160e11b815260040160405180910390fd5b6001600160a01b0383166000908152600c602052604090205460ff168061334257506001600160a01b0382166000908152600c602052604090205460ff165b156133605760405163ad2fdf3b60e01b815260040160405180910390fd5b6001600160a01b038381166000908152602c602052604090205481169083161461339d57604051630ced616b60e21b815260040160405180910390fd5b6001600160a01b038084166000908152602d60209081526040808320938616835292905220546133cf90603c90615bc0565b4210156133ef576040516356248e9760e01b815260040160405180910390fd5b6133f883615014565b61340182615014565b6001600160a01b038316600090815260116020526040812061342290615122565b1115613504576001600160a01b038316600090815260116020526040812061344a908261512c565b6001600160a01b038086166000908152600e6020818152604080842085871680865290835281852054958a168552928252808420928452919052812080549394509192613498908490615bc0565b90915550506001600160a01b038085166000818152600e6020908152604080832094861683529381528382208290559181526011909152206134da908261510d565b506001600160a01b03831660009081526011602052604090206134fd9082614eed565b5050613401565b6001600160a01b038316600090815260126020526040812061352590615122565b1115613607576001600160a01b038316600090815260126020526040812061354d908261512c565b6001600160a01b03808616600090815260286020818152604080842085871680865290835281852054958a16855292825280842092845291905281208054939450919261359b908490615bc0565b90915550506001600160a01b03808516600090815260286020908152604080832085851684528252808320839055928616825260129052206135dd9082614eed565b506001600160a01b0384166000908152601260205260409020613600908261510d565b5050613504565b6001600160a01b0380841660009081526010602052604080822054928516825281208054909190613639908490615bc0565b90915550506001600160a01b038084166000908152601060209081526040808320839055600f9091528082205492851682528120805490919061367d908490615bc0565b90915550506001600160a01b0383166000908152600f6020908152604080832083905560299091528120556136b3601a8461510d565b506001600160a01b03838116600081815260016020908152604080832080546001600160a01b031990811690915560028352818420805482169055602d8352818420958816808552958352818420849055848452602c835292819020805490931690925590519182527f9b712b63e3fb1325fa042d3c238ce8144937875065900528ea1e4f3b00f379f29101612b02565b6003546001600160a01b0316331461376f5760405163070545c960e51b815260040160405180910390fd5b60238190556040518181527fbdcfd7b8482f31cff6a87c362d9e2e3887f4cdc2018c7c485d8e78a7b2fadb699060200161233e565b6003546001600160a01b031633146137cf5760405163070545c960e51b815260040160405180910390fd5b6137da602682614eed565b6137f75760405163f25e6b9f60e01b815260040160405180910390fd5b806001600160a01b03166316f0115b6040518163ffffffff1660e01b815260040160206040518083038186803b15801561383057600080fd5b505afa158015613844573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906138689190615e23565b6001600160a01b038281166000908152601360205260409081902080546001600160a01b0319169383169384179055601e54905163696a437b60e01b81526004810193909352169063696a437b9060240160206040518083038186803b1580156138d157600080fd5b505afa1580156138e5573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906139099190615e08565b6001600160a01b0382166000908152601460205260409020805460ff1916911515919091179055613939816111cb565b6001600160a01b0382166000818152602b6020908152604091829020845181548684015166ffffffffffffff908116600160381b026001600160701b031990921692169190911717815593820151600190940193909355519081527fabfa8db4d238fa78bf4e15fcc91328dd35f3978f200e2857a56bb719732b7b0b910161233e565b6003546001600160a01b031633146139e75760405163070545c960e51b815260040160405180910390fd5b601f8190556040518181527fd319ef78d2b690bb773fcccc2d096306bac7c9222dd0bb6b300f461e4a376b439060200161233e565b3360009081526005602052604090205460ff16613a4c57604051637e57b1e160e01b815260040160405180910390fd5b6001600160a01b0384166000908152600c602052604090205460ff16613a85576040516310cec38560e21b815260040160405180910390fd5b613a9184848484615138565b336001600160a01b0385167f10a73de7ab6e9023aa6e2bc23f7abf4dcef591487e7e55f44c00e34fe60d56db613ac78486615bc0565b60405190815260200161172a565b613ae0601a826147ab565b15613afe57604051630809740d60e01b815260040160405180910390fd5b6001600160a01b03811660009081526019602052604090205460ff1615613b3857604051632f3d320560e01b815260040160405180910390fd5b613b43601a82614eed565b506001600160a01b03811660008181526001602052604080822080546001600160a01b0319163390811790915590519092917fed3faef50715743626cd57de74281a2b17cdbfc11c0486feda541fb911e0293d91a350565b6003546001600160a01b03163314613bc65760405163070545c960e51b815260040160405180910390fd5b6001600160a01b038116613bed5760405163d92e233d60e01b815260040160405180910390fd5b601d80546001600160a01b0319166001600160a01b0383169081179091556040519081527feb931b4b5a98d20a6b1e6693a7c59d8e337a06e2f1473bb776e19251db7ae2509060200161233e565b6003546001600160a01b03163314613c665760405163070545c960e51b815260040160405180910390fd5b62015180811015613c8a57604051633f384aad60e21b815260040160405180910390fd5b60228190556040518181527f54aafa56429e22230b52f1495588ffc632277d74f3a85ec755e13ac50c1584d99060200161233e565b60026000541415613ce25760405162461bcd60e51b815260040161175b90615d3f565b600260009081556001600160a01b03858116825260016020526040909120548591163314613d2357604051636efb4f4160e11b815260040160405180910390fd5b6001600160a01b03808616600090815260256020908152604080832093881683529290522054613d5590603c90615bc0565b4211613d7457604051631e0b407560e01b815260040160405180910390fd5b6001600160a01b038086166000908152600e6020908152604080832093881683529290522054831115613dba5760405163024ae82d60e61b815260040160405180910390fd5b6001600160a01b0385166000908152600c602052604090205460ff1615613df45760405163ad2fdf3b60e01b815260040160405180910390fd5b6001600160a01b038086166000908152600e6020908152604080832093881683529290529081208054859290613e2b908490615ba9565b90915550613e4590506001600160a01b0385168385614fac565b6001600160a01b038086166000908152600e6020908152604080832093881683529290522054613e93576001600160a01b0385166000908152601160205260409020613e91908561510d565b505b816001600160a01b0316846001600160a01b0316866001600160a01b03167f53e982dd9ec088d634c74c98fbbc161f808b4b6469a26c657120b9a31cb34bfe86604051613ee291815260200190565b60405180910390a450506001600055505050565b336000818152600c602052604090205460ff1615613f275760405163ad2fdf3b60e01b815260040160405180910390fd5b6001600160a01b0383166000908152600c602052604090205460ff1615613f61576040516362e6201d60e01b815260040160405180910390fd5b613f6c601a826147ab565b613f885760405162941a5760e11b815260040160405180910390fd5b6001600160a01b038082166000908152600e6020908152604080832093881683529290522054821115613fce5760405163356680b760e01b815260040160405180910390fd5b6001600160a01b038082166000908152600e6020908152604080832093881683529290529081208054849290614005908490615ba9565b9091555061401f90506001600160a01b0385168484614fac565b826001600160a01b0316816001600160a01b0316856001600160a01b03167f46f2180879a7123a197cc3828c28955d70d661c70acbdc02450daf5f9a9c1cfa85614067614e75565b6040805192835260208301919091520160405180910390a450505050565b6003546001600160a01b031633146140b05760405163070545c960e51b815260040160405180910390fd5b60218190556040518181527f24d51b415694a791b1c77df7817c075ac82b83ce611bcd8627d2e66cf37aa3e79060200161233e565b6003546001600160a01b031633146141105760405163070545c960e51b815260040160405180910390fd5b6001600160a01b0381166141375760405163d92e233d60e01b815260040160405180910390fd5b614142600954614f64565b601c80546001600160a01b0319166001600160a01b0383169081179091556040519081527f1d1a3e7caf0717056e48dc8aefa54d806c7af86324fece4e5d49f8e1f01f84bf9060200161233e565b6003546001600160a01b031633146141bb5760405163070545c960e51b815260040160405180910390fd5b6001600160a01b03811660009081526006602052604090205460ff166141f457604051633ca0d42760e11b815260040160405180910390fd5b6001600160a01b038116600081815260066020908152604091829020805460ff1916905590519182527f5e8bd21d0a98cb2caf33706e56139ff40ffbdca7ec5d9d412a0a2292496dc70e910161233e565b6003546001600160a01b031633146142705760405163070545c960e51b815260040160405180910390fd5b6142798161529d565b50565b3360009081526005602052604090205460ff166142ac57604051637e57b1e160e01b815260040160405180910390fd5b6001600160a01b0383166000908152600c602052604090205460ff166142e5576040516310cec38560e21b815260040160405180910390fd5b6001600160a01b038316600090815260116020526040902061430790836147ab565b61432457604051632eda7a1160e01b815260040160405180910390fd5b6001600160a01b038084166000908152600e60209081526040808320938616835292905220548111156143695760405162919bed60e01b815260040160405180910390fd5b60035460405163a9059cbb60e01b81526001600160a01b039182166004820152602481018390529083169063a9059cbb90604401602060405180830381600087803b1580156143b757600080fd5b505af19250505080156143e7575060408051601f3d908101601f191682019092526143e491810190615e08565b60015b6143f0576143f2565b505b6001600160a01b038084166000908152600e6020908152604080832093861683529290529081208054839290614429908490615ba9565b90915550506001600160a01b038084166000908152600e602090815260408083209386168352929052205461447c576001600160a01b038316600090815260116020526040902061447a908361510d565b505b604080516001600160a01b038481168252602082018490523392908616917f20262b97130b5cb8f80624eed2733df2b05db4a0789b4a3d0157e1d3183331049101612770565b3360009081526006602052604090205460ff166144f257604051630942721960e31b815260040160405180910390fd5b6001600160a01b0381166000908152600c602052604090205460ff161561452c576040516304ee891b60e11b815260040160405180910390fd5b6001600160a01b0381166000818152600c6020526040808220805460ff19166001179055513392917f070125a1c0f5202217aae14ec399abfaaa13c2fd98a91d43bd3a897dd4751e8091a350565b6000614584614e75565b602e556145926007876147ab565b80156145c357506001600160a01b038087166000908152600d60209081526040808320938916835292905220548411155b80156145e757506001600160a01b0386166000908152600a60205260409020548311155b801561461657506001600160a01b0386166000908152600b602052604090205482906146139042615ba9565b10155b1561465a577f4851cad52e624c8f7a1d44c28a80db05988ba2451fc0db6b0ec338d8eca95afb602e5460405161464e91815260200190565b60405180910390a15060015b95945050505050565b6003546001600160a01b0316331461468e5760405163070545c960e51b815260040160405180910390fd5b614699601a836147ab565b6146b657604051636211d34960e01b815260040160405180910390fd5b6146bf82615014565b6001600160a01b0382166000908152600f6020526040812080548392906146e7908490615bc0565b90915550506001600160a01b038216600081815260296020908152604080832054600f909252918290205491517f5abcf5031fdbd3badb9d1e09094208de329aee72730e87650f346584205d23d192614747928252602082015260400190565b60405180910390a25050565b6000602254826147639190615e40565b610e919083615ba9565b600060225483101561262b576022546147868385615d76565b6147909190615dab565b9050610e91565b606060006147a483615320565b9392505050565b6001600160a01b038116600090815260018301602052604081205415156147a4565b6000610e918260225460235461537c565b600260005414156148015760405162461bcd60e51b815260040161175b90615d3f565b600260009081556001600160a01b038416815260126020526040902061482790836147ab565b614843576040516241cfa560e21b815260040160405180910390fd5b6001600160a01b038084166000908152602860209081526040808320938616835292905220548111156148895760405163435b562560e01b815260040160405180910390fd5b6148928361542a565b60006148a1610e8183856149ec565b6001600160a01b03851660009081526010602052604090205490915015614957576001600160a01b038416600090815260106020908152604080832054600f909252909120546148f2908390615d76565b6148fc9190615dab565b6001600160a01b0385166000908152600f602052604081208054909190614924908490615ba9565b90915550506001600160a01b03841660009081526010602052604081208054839290614951908490615ba9565b90915550505b6001600160a01b0380851660009081526028602090815260408083209387168352929052908120805484929061498e908490615ba9565b90915550506001600160a01b038085166000908152602860209081526040808320938716835292905220546149e1576001600160a01b03841660009081526012602052604090206149df908461510d565b505b505060016000555050565b6001600160a01b0381166000908152602b602052604081206001015415610e91576001600160a01b03821660009081526014602052604081205460ff16614a5e576001600160a01b0383166000908152602b6020526040902054614a5990600160381b900460060b615bd8565b614a82565b6001600160a01b0383166000908152602b6020526040902054600160381b900460060b5b601e5460225460405163a0d2710760e01b815260048101889052600684900b602482015260448101919091529192506001600160a01b03169063a0d271079060640160206040518083038186803b158015614adc57600080fd5b505afa158015614af0573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d6b9190615bff565b6000614b1f42614753565b6001600160a01b038316600090815260296020526040902054101561157857614b4f60225442610c8f9190615ba9565b6001600160a01b03831660009081526029602052604090205411614bc557614b768261542a565b6001600160a01b038216600090815260106020908152604080832054600f90925290912055614ba442614753565b6001600160a01b038316600090815260296020526040902055506001919050565b6022546001600160a01b038316600090815260296020526040902054614beb9042615ba9565b10614c4757614bf98261542a565b6001600160a01b038216600090815260106020908152604080832054600f83528184205560225460299092528220805491929091614c38908490615bc0565b90915550600191506115789050565b614c5042614753565b6001600160a01b0383166000908152602a60205260409020541015611578576001600160a01b038216600090815260106020526040902054614c918361542a565b6001600160a01b038316600090815260106020908152604080832054600f909252909120548291614cc191615d76565b614ccb9190615dab565b6001600160a01b0384166000908152600f602052604090205550919050565b6001600160a01b038116600090815260296020526040902054614d2f90614d119042615ba9565b6001600160a01b03831660009081526010602052604090205461476d565b6001600160a01b0382166000908152600f602052604081208054909190614d57908490615bc0565b90915550506001600160a01b03166000908152602960205260409020429055565b6001600160a01b0383166000908152600f6020526040902054811115614db15760405163356680b760e01b815260040160405180910390fd5b6001600160a01b0383166000908152602a60209081526040808320429055600f90915281208054839290614de6908490615ba9565b90915550506001600160a01b038083166000908152600d60209081526040808320601c5490941683529290529081208054839290614e25908490615bc0565b90915550506001600160a01b0382166000908152600a602052604081208054839290614e52908490615bc0565b925050819055508060096000828254614e6b9190615bc0565b9091555050505050565b6000603f5a614e85906040615d76565b610d7f9190615dab565b60048054600380546001600160a01b0383166001600160a01b031991821681179092559091169091556040519081527f5d5d6e01b731c3e68060f7fe13156f6197d4aeffc2d6f498e34c717ae616b7349060200160405180910390a1565b60006147a4836001600160a01b03841661544f565b601c54604051630852cd8d60e31b8152600481018390526001600160a01b03909116906342966c68906024015b600060405180830381600087803b158015614f4957600080fd5b505af1158015614f5d573d6000803e3d6000fd5b5050505050565b8060096000828254614f769190615ba9565b9091555050601d5460405163140e25ad60e31b8152600481018390526001600160a01b039091169063a0712d6890602401614f2f565b6040516001600160a01b03831660248201526044810182905261500f90849063a9059cbb60e01b906064015b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b03199093169290921790915261549e565b505050565b61501d81614b14565b5061502781614cea565b6001600160a01b0381166000908152600f60209081526040808320546010909252909120546150569190615570565b6001600160a01b039091166000908152600f6020526040902055565b6040516001600160a01b03808516602483015283166044820152606481018290526150aa9085906323b872dd60e01b90608401614fd8565b50505050565b6000808486602e546150c29190615ba9565b6150cc9190615bc0565b9050670de0b6b3a7640000846127106150e58685615d76565b6150ef9190615dab565b6150f99190615d76565b6151039190615dab565b9695505050505050565b60006147a4836001600160a01b038416615586565b6000610e91825490565b60006147a48383615679565b601c546001600160a01b0384811691161461521f576003546001600160a01b038085169163a9059cbb911661516d8486615bc0565b6040516001600160e01b031960e085901b1681526001600160a01b0390921660048301526024820152604401602060405180830381600087803b1580156151b357600080fd5b505af19250505080156151e3575060408051601f3d908101601f191682019092526151e091810190615e08565b60015b61521d573d808015615211576040519150601f19603f3d011682016040523d82523d6000602084013e615216565b606091505b505061521f565b505b6001600160a01b038085166000908152600d6020908152604080832093871683529290529081208054849290615256908490615ba9565b90915550506001600160a01b03808516600090815260186020908152604080832093871683529290529081208054839290615292908490615ba9565b909155505050505050565b6001600160a01b0381166152c45760405163d92e233d60e01b815260040160405180910390fd5b600480546001600160a01b0319166001600160a01b038381169182179092556003546040805191909316815260208101919091527f6353ec38ac394f8be94bfafcdd3580d356470599059eaeebedc3207e1cc03dec910161233e565b60608160000180548060200260200160405190810160405280929190818152602001828054801561537057602002820191906000526020600020905b81548152602001906001019080831161535c575b50505050509050919050565b6000808060001985870985870292508281108382030391505080600014156153b657600084116153ab57600080fd5b5082900490506147a4565b8084116153c257600080fd5b600084868809600260036001881981018916988990049182028318808302840302808302840302808302840302808302840302808302840302918202909203026000889003889004909101858311909403939093029303949094049190911702949350505050565b615433816156a3565b6001600160a01b03909116600090815260106020526040902055565b600081815260018301602052604081205461549657508154600181810184556000848152602080822090930184905584548482528286019093526040902091909155610e91565b506000610e91565b60006154f3826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b03166157de9092919063ffffffff16565b80519091501561500f57808060200190518101906155119190615e08565b61500f5760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b606482015260840161175b565b600081831061557f57816147a4565b5090919050565b6000818152600183016020526040812054801561566f5760006155aa600183615ba9565b85549091506000906155be90600190615ba9565b90508181146156235760008660000182815481106155de576155de615c18565b906000526020600020015490508087600001848154811061560157615601615c18565b6000918252602080832090910192909255918252600188019052604090208390555b855486908061563457615634615e54565b600190038181906000526020600020016000905590558560010160008681526020019081526020016000206000905560019350505050610e91565b6000915050610e91565b600082600001828154811061569057615690615c18565b9060005260206000200154905092915050565b6000805b6001600160a01b03831660009081526012602052604090206156c890615122565b81101561262b576001600160a01b03831660009081526012602052604081206156f1908361512c565b90506156fe6026826147ab565b156157cb5761570c42614753565b6001600160a01b0382166000908152602b60205260409020600101541461578a57615736816111cb565b6001600160a01b0382166000908152602b6020908152604091829020835181549285015166ffffffffffffff908116600160381b026001600160701b03199094169116179190911781559101516001909101555b6001600160a01b038085166000908152602860209081526040808320938516835292905220546157be90610e8190836149ec565b6157c89084615bc0565b92505b50806157d681615ded565b9150506156a7565b6060610d6b848460008585843b6158375760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e7472616374000000604482015260640161175b565b600080866001600160a01b031685876040516158539190615e96565b60006040518083038185875af1925050503d8060008114615890576040519150601f19603f3d011682016040523d82523d6000602084013e615895565b606091505b50915091506158a58282866158b0565b979650505050505050565b606083156158bf5750816147a4565b8251156158cf5782518084602001fd5b8160405162461bcd60e51b815260040161175b9190615eb2565b6001600160a01b038116811461427957600080fd5b60006020828403121561591057600080fd5b81356147a4816158e9565b6000806040838503121561592e57600080fd5b8235615939816158e9565b91506020830135615949816158e9565b809150509250929050565b6020808252825182820181905260009190848201906040850190845b818110156159955783516001600160a01b031683529284019291840191600101615970565b50909695505050505050565b600080604083850312156159b457600080fd5b82356159bf816158e9565b946020939093013593505050565b6000806000606084860312156159e257600080fd5b83356159ed816158e9565b925060208401356159fd816158e9565b929592945050506040919091013590565b600060208284031215615a2057600080fd5b5035919050565b600080600060608486031215615a3c57600080fd5b8335615a47816158e9565b9250602084013591506040840135615a5e816158e9565b809150509250925092565b600080600060608486031215615a7e57600080fd5b8335615a89816158e9565b92506020840135615a99816158e9565b91506040840135615a5e816158e9565b60008060008060808587031215615abf57600080fd5b8435615aca816158e9565b93506020850135615ada816158e9565b93969395505050506040820135916060013590565b60008060008060808587031215615b0557600080fd5b8435615b10816158e9565b93506020850135615b20816158e9565b9250604085013591506060850135615b37816158e9565b939692955090935050565b600080600080600060a08688031215615b5a57600080fd5b8535615b65816158e9565b94506020860135615b75816158e9565b94979496505050506040830135926060810135926080909101359150565b634e487b7160e01b600052601160045260246000fd5b600082821015615bbb57615bbb615b93565b500390565b60008219821115615bd357615bd3615b93565b500190565b60008160060b667fffffffffffff19811415615bf657615bf6615b93565b60000392915050565b600060208284031215615c1157600080fd5b5051919050565b634e487b7160e01b600052603260045260246000fd5b6001600160a01b038316815260406020808301829052835191830182905260009184820191906060850190845b81811015615c7d57845163ffffffff1683529383019391830191600101615c5b565b5090979650505050505050565b8051600681900b811461157857600080fd5b8051801515811461157857600080fd5b600080600060608486031215615cc157600080fd5b615cca84615c8a565b9250615cd860208501615c8a565b9150615ce660408501615c9c565b90509250925092565b60008160060b8360060b6000811281667fffffffffffff1901831281151615615d1a57615d1a615b93565b81667fffffffffffff018313811615615d3557615d35615b93565b5090039392505050565b6020808252601f908201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604082015260600190565b6000816000190483118215151615615d9057615d90615b93565b500290565b634e487b7160e01b600052601260045260246000fd5b600082615dba57615dba615d95565b500490565b600080600060608486031215615dd457600080fd5b8351925060208401519150604084015190509250925092565b6000600019821415615e0157615e01615b93565b5060010190565b600060208284031215615e1a57600080fd5b6147a482615c9c565b600060208284031215615e3557600080fd5b81516147a4816158e9565b600082615e4f57615e4f615d95565b500690565b634e487b7160e01b600052603160045260246000fd5b60005b83811015615e85578181015183820152602001615e6d565b838111156150aa5750506000910152565b60008251615ea8818460208701615e6a565b9190910192915050565b6020815260008251806020840152615ed1816040850160208701615e6a565b601f01601f1916919091016040019291505056feee3f0daba9837d1ab0597acf34328550e4832d02e24e467825e7c2dd318c3820a26469706673582212206e1483b7a07adf244c4dcbc9db3b152c8ccb794dfa115f57fff41dd9b9e218ca64736f6c63430008080033", + "devdoc": { + "kind": "dev", + "methods": { + "acceptJobMigration(address,address)": { + "details": "Unbond/withdraw process doesn't get migrated", + "params": { + "_fromJob": "The address of the job that requested to migrate", + "_toJob": "The address to which the job wants to migrate to" + } + }, + "acceptJobOwnership(address)": { + "params": { + "_job": "The address of the job" + } + }, + "activate(address)": { + "params": { + "_bonding": "The asset being activated as bond collateral" + } + }, + "addJob(address)": { + "params": { + "_job": "Address of the contract for which work should be performed" + } + }, + "addLiquidityToJob(address,address,uint256)": { + "params": { + "_amount": "The amount of liquidity tokens to add", + "_job": "The address of the job to assign liquidity to", + "_liquidity": "The liquidity being added" + } + }, + "addTokenCreditsToJob(address,address,uint256)": { + "params": { + "_amount": "The amount of credit being added", + "_job": "The address of the job being credited", + "_token": "The address of the token being credited" + } + }, + "approveLiquidity(address)": { + "params": { + "_liquidity": "The address of the liquidity accepted" + } + }, + "approvedLiquidities()": { + "returns": { + "_list": "An array of addresses with all the approved liquidity pairs" + } + }, + "bond(address,uint256)": { + "params": { + "_amount": "The amount of bonding asset being bonded", + "_bonding": "The asset being bonded" + } + }, + "bondedPayment(address,uint256)": { + "details": "Pays the keeper that performs the work with KP3R", + "params": { + "_keeper": "Address of the keeper that performed the work", + "_payment": "The reward that should be allocated for the job" + } + }, + "changeJobOwnership(address,address)": { + "params": { + "_job": "The address of the job", + "_newOwner": "The address of the proposed new owner" + } + }, + "directTokenPayment(address,address,uint256)": { + "details": "Pays the keeper that performs the work with a specific token", + "params": { + "_amount": "The reward that should be allocated", + "_keeper": "Address of the keeper that performed the work", + "_token": "The asset being awarded to the keeper" + } + }, + "dispute(address)": { + "params": { + "_jobOrKeeper": "The address in dispute" + } + }, + "forceLiquidityCreditsToJob(address,uint256)": { + "params": { + "_amount": "The amount of liquidity credits to gift", + "_job": "The address of the job being credited" + } + }, + "isBondedKeeper(address,address,uint256,uint256,uint256)": { + "details": "Should be used for protected functions", + "params": { + "_age": "The minimum keeper age required", + "_bond": "The bond token being evaluated", + "_earned": "The minimum funds earned in the keepers lifetime", + "_keeper": "The keeper to check", + "_minBond": "The minimum amount of bonded tokens" + }, + "returns": { + "_isBondedKeeper": "Whether the `_keeper` meets the given requirements" + } + }, + "isKeeper(address)": { + "details": "Can be used for general (non critical) functions", + "params": { + "_keeper": "The keeper being investigated" + }, + "returns": { + "_isKeeper": "Whether the address passed as a parameter is a keeper or not" + } + }, + "jobLiquidityCredits(address)": { + "params": { + "_job": "The address of the job of which we want to know the liquidity credits" + }, + "returns": { + "_liquidityCredits": "The liquidity credits of a given job" + } + }, + "jobPeriodCredits(address)": { + "params": { + "_job": "The address of the job of which we want to know the period credits" + }, + "returns": { + "_periodCredits": "The credits the given job has at the current period" + } + }, + "jobs()": { + "returns": { + "_list": "Array with all the jobs in _jobs" + } + }, + "keepers()": { + "returns": { + "_list": "Array with all the keepers in _keepers" + } + }, + "migrateJob(address,address)": { + "params": { + "_fromJob": "The address of the job that is requesting to migrate", + "_toJob": "The address at which the job is requesting to migrate" + } + }, + "observeLiquidity(address)": { + "params": { + "_liquidity": "The address of the liquidity pair being observed" + }, + "returns": { + "_tickCache": "The updated TickCache" + } + }, + "quoteLiquidity(address,uint256)": { + "details": "_periodCredits = underlying KP3Rs for given liquidity amount * rewardPeriod / inflationPeriod", + "params": { + "_amount": "The amount of liquidity to provide", + "_liquidity": "The address of the liquidity to provide" + }, + "returns": { + "_periodCredits": "The amount of KP3R periodically minted for the given liquidity" + } + }, + "resolve(address)": { + "params": { + "_jobOrKeeper": "The address cleared" + } + }, + "revoke(address)": { + "params": { + "_keeper": "The address being slashed" + } + }, + "revokeLiquidity(address)": { + "params": { + "_liquidity": "The liquidity no longer accepted" + } + }, + "sendDust(address,uint256,address)": { + "params": { + "_amount": "The amont of the token that will be transferred", + "_to": "The address that will receive the idle funds", + "_token": "The token that will be transferred" + } + }, + "setBondTime(uint256)": { + "params": { + "_bond": "The new bond time" + } + }, + "setFee(uint256)": { + "params": { + "_fee": "The new fee" + } + }, + "setInflationPeriod(uint256)": { + "params": { + "_inflationPeriod": "The new inflation period" + } + }, + "setKeep3rHelper(address)": { + "params": { + "_keep3rHelper": "The Keep3rHelper address" + } + }, + "setKeep3rV1(address)": { + "params": { + "_keep3rV1": "The Keep3rV1 address" + } + }, + "setKeep3rV1Proxy(address)": { + "params": { + "_keep3rV1Proxy": "The Keep3rV1Proxy address" + } + }, + "setLiquidityMinimum(uint256)": { + "params": { + "_liquidityMinimum": "The new minimum amount of liquidity" + } + }, + "setPendingGovernor(address)": { + "params": { + "_pendingGovernor": "Address of the proposed new governor" + } + }, + "setRewardPeriodTime(uint256)": { + "params": { + "_rewardPeriodTime": "The new amount of time required to pass between rewards" + } + }, + "setUnbondTime(uint256)": { + "params": { + "_unbond": "The new unbond time" + } + }, + "slash(address,address,uint256,uint256)": { + "params": { + "_bondAmount": "The bonded amount being slashed", + "_bonded": "The asset being slashed", + "_keeper": "The address being slashed", + "_unbondAmount": "The pending unbond amount being slashed" + } + }, + "slashLiquidityFromJob(address,address,uint256)": { + "params": { + "_amount": "The amount of liquidity that will be slashed", + "_job": "The address being slashed", + "_liquidity": "The address of the liquidity that will be slashed" + } + }, + "slashTokenFromJob(address,address,uint256)": { + "params": { + "_amount": "The amount of the token that will be slashed", + "_job": "The address of the job from which the token will be slashed", + "_token": "The address of the token that will be slashed" + } + }, + "totalJobCredits(address)": { + "params": { + "_job": "The address of the job of which we want to know the total credits" + }, + "returns": { + "_credits": "The total credits of the given job" + } + }, + "unbond(address,uint256)": { + "params": { + "_amount": "Allows for partial unbonding", + "_bonding": "The asset being unbonded" + } + }, + "unbondLiquidityFromJob(address,address,uint256)": { + "details": "Can only be called by the job's owner", + "params": { + "_amount": "The amount of liquidity being removed", + "_job": "The address of the job being unbonded from", + "_liquidity": "The liquidity being unbonded" + } + }, + "withdraw(address)": { + "params": { + "_bonding": "The asset to withdraw from the bonding pool" + } + }, + "withdrawLiquidityFromJob(address,address,address)": { + "params": { + "_job": "The address of the job being withdrawn from", + "_liquidity": "The liquidity being withdrawn", + "_receiver": "The address that will receive the withdrawn liquidity" + } + }, + "withdrawTokenCreditsFromJob(address,address,uint256,address)": { + "params": { + "_amount": "The amount of token to be withdrawn", + "_job": "The address of the job from which the credits are withdrawn", + "_receiver": "The user that will receive tokens", + "_token": "The address of the token being withdrawn" + } + }, + "worked(address)": { + "details": "Automatically calculates the payment for the keeper and pays the keeper with bonded KP3R", + "params": { + "_keeper": "Address of the keeper that performed the work" + } + } + }, + "version": 1 + }, + "userdoc": { + "errors": { + "AlreadyAJob()": [ + { + "notice": "Throws when the address that is trying to register as a job is already a job" + } + ], + "AlreadyAKeeper()": [ + { + "notice": "Throws when the address that is trying to register as a keeper is already a keeper" + } + ], + "AlreadyDisputed()": [ + { + "notice": "Throws when a job or keeper is already disputed" + } + ], + "BondsLocked()": [ + { + "notice": "Throws if the time required to bond an asset has not passed yet" + } + ], + "BondsUnexistent()": [ + { + "notice": "Throws if there are no bonded assets" + } + ], + "Disputed()": [ + { + "notice": "Throws if either a job or a keeper is disputed" + } + ], + "DisputerExistent()": [ + { + "notice": "Throws if the address is already a registered disputer" + } + ], + "DisputerUnexistent()": [ + { + "notice": "Throws if caller is not a registered disputer" + } + ], + "GasNotInitialized()": [ + { + "notice": "Throws if work method was called without calling isKeeper or isBondedKeeper" + } + ], + "InsufficientFunds()": [ + { + "notice": "Throws if the amount of funds in the job is less than the payment that must be paid to the keeper that works that job" + } + ], + "InsufficientJobTokenCredits()": [ + { + "notice": "Throws when the user tries to withdraw more tokens than it has" + } + ], + "InvalidAddress()": [ + { + "notice": "Thrown if an address is invalid" + } + ], + "InvalidAmount()": [ + { + "notice": "Thrown if an amount is invalid" + } + ], + "JobAlreadyAdded()": [ + { + "notice": "Throws when trying to add a job that has already been added" + } + ], + "JobDisputed()": [ + { + "notice": "Throws when an action that requires an undisputed job is applied on a disputed job" + } + ], + "JobLiquidityInsufficient()": [ + { + "notice": "Throws when trying to remove more liquidity than the job has" + } + ], + "JobLiquidityLessThanMin()": [ + { + "notice": "Throws when trying to add less liquidity than the minimum liquidity required" + } + ], + "JobLiquidityUnexistent()": [ + { + "notice": "Throws when the job doesn't have the requested liquidity" + } + ], + "JobMigrationImpossible()": [ + { + "notice": "Throws when the address of the job that requests to migrate wants to migrate to its same address" + } + ], + "JobMigrationLocked()": [ + { + "notice": "Throws when cooldown between migrations has not yet passed" + } + ], + "JobMigrationUnavailable()": [ + { + "notice": "Throws when the _toJob address differs from the address being tracked in the pendingJobMigrations mapping" + } + ], + "JobTokenCreditsLocked()": [ + { + "notice": "Throws when the token withdraw cooldown has not yet passed" + } + ], + "JobTokenInsufficient()": [ + { + "notice": "Throws when someone tries to slash more tokens than the job has" + } + ], + "JobTokenUnexistent()": [ + { + "notice": "Throws when the token trying to be slashed doesn't exist" + } + ], + "JobUnapproved()": [ + { + "notice": "Throws if the address claiming to be a job is not in the list of approved jobs" + } + ], + "JobUnavailable()": [ + { + "notice": "Throws when an address is passed as a job, but that address is not a job" + } + ], + "LengthMismatch()": [ + { + "notice": "Thrown if the lengths of a set of lists mismatch" + } + ], + "LiquidityPairApproved()": [ + { + "notice": "Throws when the liquidity being approved has already been approved" + } + ], + "LiquidityPairUnapproved()": [ + { + "notice": "Throws when trying to add liquidity to an unapproved pool" + } + ], + "LiquidityPairUnexistent()": [ + { + "notice": "Throws when the liquidity being removed has not been approved" + } + ], + "MinRewardPeriod()": [ + { + "notice": "Throws if the reward period is less than the minimum reward period time" + } + ], + "NotDisputed()": [ + { + "notice": "Throws when a job or keeper is not disputed and someone tries to resolve the dispute" + } + ], + "OnlyDisputer()": [ + { + "notice": "Throws if the msg.sender is not a disputer or is not a part of governance" + } + ], + "OnlyGovernor()": [ + { + "notice": "Thrown if a non-governor user tries to call a OnlyGovernor function" + } + ], + "OnlyJobOwner()": [ + { + "notice": "Throws when the caller of the function is not the job owner" + } + ], + "OnlyPendingGovernor()": [ + { + "notice": "Thrown if a non-pending-governor user tries to call a OnlyPendingGovernor function" + } + ], + "OnlyPendingJobOwner()": [ + { + "notice": "Throws when the caller of the function is not the pending job owner" + } + ], + "OnlySlasher()": [ + { + "notice": "Throws if the msg.sender is not a slasher or is not a part of governance" + } + ], + "SlasherExistent()": [ + { + "notice": "Throws if the address is already a registered slasher" + } + ], + "SlasherUnexistent()": [ + { + "notice": "Throws if caller is not a registered slasher" + } + ], + "TokenUnallowed()": [ + { + "notice": "Throws when the token is KP3R, as it should not be used for direct token payments" + } + ], + "UnbondsLocked()": [ + { + "notice": "Throws if the time required to withdraw the bonds has not passed yet" + } + ], + "UnbondsUnexistent()": [ + { + "notice": "Throws if there are no bonds to withdraw" + } + ], + "ZeroAddress()": [ + { + "notice": "Thrown if an address is the zero address" + } + ], + "ZeroAmount()": [ + { + "notice": "Thrown if an amount is zero" + } + ] + }, + "events": { + "Activation(address,address,uint256)": { + "notice": "Emitted when Keep3rKeeperFundable#activate is called" + }, + "BondTimeChange(uint256)": { + "notice": "Emitted when bondTime is changed" + }, + "Bonding(address,address,uint256)": { + "notice": "Emitted when the bonding process of a new keeper begins" + }, + "Dispute(address,address)": { + "notice": "Emitted when a keeper or a job is disputed" + }, + "DisputerAdded(address)": { + "notice": "Emitted when a disputer is added" + }, + "DisputerRemoved(address)": { + "notice": "Emitted when a disputer is removed" + }, + "DustSent(address,uint256,address)": { + "notice": "Emitted when dust is sent" + }, + "FeeChange(uint256)": { + "notice": "Emitted when the fee is changed" + }, + "InflationPeriodChange(uint256)": { + "notice": "Emitted when the inflationPeriod is changed" + }, + "JobAddition(address,address)": { + "notice": "Emitted when Keep3rJobManager#addJob is called" + }, + "JobMigrationRequested(address,address)": { + "notice": "Emitted when Keep3rJobMigration#migrateJob function is called" + }, + "JobMigrationSuccessful(address,address)": { + "notice": "Emitted when Keep3rJobMigration#acceptJobMigration function is called" + }, + "JobOwnershipAssent(address,address,address)": { + "notice": "Emitted when Keep3rJobOwnership#JobOwnershipAssent is called" + }, + "JobOwnershipChange(address,address,address)": { + "notice": "Emitted when Keep3rJobOwnership#changeJobOwnership is called" + }, + "JobSlashLiquidity(address,address,address,uint256)": { + "notice": "Emitted when Keep3rJobDisputable#slashLiquidityFromJob is called" + }, + "JobSlashToken(address,address,address,uint256)": { + "notice": "Emitted when Keep3rJobDisputable#slashTokenFromJob is called" + }, + "Keep3rHelperChange(address)": { + "notice": "Emitted when the Keep3rHelper address is changed" + }, + "Keep3rV1Change(address)": { + "notice": "Emitted when the Keep3rV1 address is changed" + }, + "Keep3rV1ProxyChange(address)": { + "notice": "Emitted when the Keep3rV1Proxy address is changed" + }, + "KeeperRevoke(address,address)": { + "notice": "Emitted when Keep3rKeeperDisputable#revoke is called" + }, + "KeeperSlash(address,address,uint256)": { + "notice": "Emitted when Keep3rKeeperDisputable#slash is called" + }, + "KeeperValidation(uint256)": { + "notice": "Emitted when a keeper is validated before a job" + }, + "KeeperWork(address,address,address,uint256,uint256)": { + "notice": "Emitted when a keeper works a job" + }, + "LiquidityAddition(address,address,address,uint256)": { + "notice": "Emitted when IKeep3rJobFundableLiquidity#addLiquidityToJob function is called" + }, + "LiquidityApproval(address)": { + "notice": "Emitted when Keep3rJobFundableLiquidity#approveLiquidity function is called" + }, + "LiquidityCreditsForced(address,uint256,uint256)": { + "notice": "Emitted when Keep3rJobFundableLiquidity#forceLiquidityCreditsToJob function is called" + }, + "LiquidityCreditsReward(address,uint256,uint256,uint256)": { + "notice": "Emitted when Keep3rJobFundableLiquidity#addLiquidityToJob function is called" + }, + "LiquidityMinimumChange(uint256)": { + "notice": "Emitted when _liquidityMinimum is changed" + }, + "LiquidityRevocation(address)": { + "notice": "Emitted when Keep3rJobFundableLiquidity#revokeLiquidity function is called" + }, + "LiquidityWithdrawal(address,address,address,uint256)": { + "notice": "Emitted when IKeep3rJobFundableLiquidity#withdrawLiquidityFromJob function is called" + }, + "PendingGovernorAccepted(address)": { + "notice": "Emitted when a new governor is set" + }, + "PendingGovernorSet(address,address)": { + "notice": "Emitted when a new pending governor is set" + }, + "Resolve(address,address)": { + "notice": "Emitted when a dispute is resolved" + }, + "RewardPeriodTimeChange(uint256)": { + "notice": "Emitted when _rewardPeriodTime is changed" + }, + "SlasherAdded(address)": { + "notice": "Emitted when a slasher is added" + }, + "SlasherRemoved(address)": { + "notice": "Emitted when a slasher is removed" + }, + "TokenCreditAddition(address,address,address,uint256)": { + "notice": "Emitted when Keep3rJobFundableCredits#addTokenCreditsToJob is called" + }, + "TokenCreditWithdrawal(address,address,address,uint256)": { + "notice": "Emitted when Keep3rJobFundableCredits#withdrawTokenCreditsFromJob is called" + }, + "UnbondTimeChange(uint256)": { + "notice": "Emitted when _unbondTime is changed" + }, + "Unbonding(address,address,uint256)": { + "notice": "Emitted when a keeper or job begins the unbonding process to withdraw the funds" + }, + "Withdrawal(address,address,uint256)": { + "notice": "Emitted when Keep3rKeeperFundable#withdraw is called" + } + }, + "kind": "user", + "methods": { + "acceptJobMigration(address,address)": { + "notice": "Completes the migration process for a job" + }, + "acceptJobOwnership(address)": { + "notice": "The proposed address accepts to be the owner of the job" + }, + "acceptPendingGovernor()": { + "notice": "Allows a proposed governor to accept the governance" + }, + "activate(address)": { + "notice": "End of the bonding process after bonding time has passed" + }, + "addDisputer(address)": { + "notice": "Registers a disputer by updating the disputers mapping" + }, + "addJob(address)": { + "notice": "Allows any caller to add a new job" + }, + "addLiquidityToJob(address,address,uint256)": { + "notice": "Allows anyone to fund a job with liquidity" + }, + "addSlasher(address)": { + "notice": "Registers a slasher by updating the slashers mapping" + }, + "addTokenCreditsToJob(address,address,uint256)": { + "notice": "Add credit to a job to be paid out for work" + }, + "approveLiquidity(address)": { + "notice": "Approve a liquidity pair for being accepted in future" + }, + "approvedLiquidities()": { + "notice": "Lists liquidity pairs" + }, + "bond(address,uint256)": { + "notice": "Beginning of the bonding process" + }, + "bondTime()": { + "notice": "The amount of time required to pass after a keeper has bonded assets for it to be able to activate" + }, + "bondedPayment(address,uint256)": { + "notice": "Implemented by jobs to show that a keeper performed work" + }, + "bonds(address,address)": { + "notice": "Mapping (job => bonding => amount)" + }, + "canActivateAfter(address,address)": { + "notice": "Tracks when a bonding for a keeper can be activated" + }, + "canWithdrawAfter(address,address)": { + "notice": "Tracks when keeper bonds are ready to be withdrawn" + }, + "changeJobOwnership(address,address)": { + "notice": "Proposes a new address to be the owner of the job" + }, + "directTokenPayment(address,address,uint256)": { + "notice": "Implemented by jobs to show that a keeper performed work" + }, + "dispute(address)": { + "notice": "Allows governor to create a dispute for a given keeper/job" + }, + "disputers(address)": { + "notice": "Tracks whether the address is a disputer or not" + }, + "disputes(address)": { + "notice": "Tracks if a keeper or job has a pending dispute" + }, + "fee()": { + "notice": "The fee to be sent to governor when a user adds liquidity to a job" + }, + "firstSeen(address)": { + "notice": "Tracks when a keeper was first registered" + }, + "forceLiquidityCreditsToJob(address,uint256)": { + "notice": "Gifts liquidity credits to the specified job" + }, + "hasBonded(address)": { + "notice": "Checks whether the address has ever bonded an asset" + }, + "inflationPeriod()": { + "notice": "The inflation period is the denominator used to regulate the emission of KP3R" + }, + "isBondedKeeper(address,address,uint256,uint256,uint256)": { + "notice": "Confirms if the current keeper is registered and has a minimum bond of any asset." + }, + "isKeeper(address)": { + "notice": "Confirms if the current keeper is registered" + }, + "jobLiquidityCredits(address)": { + "notice": "Returns the liquidity credits of a given job" + }, + "jobOwner(address)": { + "notice": "Maps the job to the owner of the job" + }, + "jobPendingOwner(address)": { + "notice": "Maps the job to its pending owner" + }, + "jobPeriodCredits(address)": { + "notice": "Returns the credits of a given job for the current period" + }, + "jobTokenCredits(address,address)": { + "notice": "The current token credits available for a job" + }, + "jobTokenCreditsAddedAt(address,address)": { + "notice": "Last block where tokens were added to the job" + }, + "jobs()": { + "notice": "Lists all jobs" + }, + "keep3rHelper()": { + "notice": "Address of Keep3rHelper's contract" + }, + "keep3rV1()": { + "notice": "Address of Keep3rV1's contract" + }, + "keep3rV1Proxy()": { + "notice": "Address of Keep3rV1Proxy's contract" + }, + "keepers()": { + "notice": "Lists all keepers" + }, + "liquidityAmount(address,address)": { + "notice": "Amount of liquidity in a specified job" + }, + "liquidityMinimum()": { + "notice": "The minimum amount of liquidity required to fund a job per liquidity" + }, + "migrateJob(address,address)": { + "notice": "Initializes the migration process for a job by adding the request to the pendingJobMigrations mapping" + }, + "observeLiquidity(address)": { + "notice": "Observes the current state of the liquidity pair being observed and updates TickCache with the information" + }, + "pendingBonds(address,address)": { + "notice": "Tracks the amount of assets deposited in pending bonds" + }, + "pendingJobMigrations(address)": { + "notice": "Maps the jobs that have requested a migration to the address they have requested to migrate to" + }, + "pendingUnbonds(address,address)": { + "notice": "Tracks how much keeper bonds are to be withdrawn" + }, + "quoteLiquidity(address,uint256)": { + "notice": "Calculates how many credits should be rewarded periodically for a given liquidity amount" + }, + "removeDisputer(address)": { + "notice": "Removes a disputer by updating the disputers mapping" + }, + "removeSlasher(address)": { + "notice": "Removes a slasher by updating the slashers mapping" + }, + "resolve(address)": { + "notice": "Allows governor to resolve a dispute on a keeper/job" + }, + "revoke(address)": { + "notice": "Blacklists a keeper from participating in the network" + }, + "revokeLiquidity(address)": { + "notice": "Revoke a liquidity pair from being accepted in future" + }, + "rewardPeriodTime()": { + "notice": "The amount of time between each scheduled credits reward given to a job" + }, + "rewardedAt(address)": { + "notice": "Last time the job was rewarded liquidity credits" + }, + "sendDust(address,uint256,address)": { + "notice": "Allows an authorized user to transfer the tokens or eth that may have been left in a contract" + }, + "setBondTime(uint256)": { + "notice": "Sets the bond time required to activate as a keeper" + }, + "setFee(uint256)": { + "notice": "Sets the new fee" + }, + "setInflationPeriod(uint256)": { + "notice": "Sets the new inflation period" + }, + "setKeep3rHelper(address)": { + "notice": "Sets the Keep3rHelper address" + }, + "setKeep3rV1(address)": { + "notice": "Sets the Keep3rV1 address" + }, + "setKeep3rV1Proxy(address)": { + "notice": "Sets the Keep3rV1Proxy address" + }, + "setLiquidityMinimum(uint256)": { + "notice": "Sets the minimum amount of liquidity required to fund a job" + }, + "setPendingGovernor(address)": { + "notice": "Allows a governor to propose a new governor" + }, + "setRewardPeriodTime(uint256)": { + "notice": "Sets the time required to pass between rewards for jobs" + }, + "setUnbondTime(uint256)": { + "notice": "Sets the unbond time required unbond what has been bonded" + }, + "slash(address,address,uint256,uint256)": { + "notice": "Allows governor to slash a keeper based on a dispute" + }, + "slashLiquidityFromJob(address,address,uint256)": { + "notice": "Allows governor or slasher to slash liquidity from a job" + }, + "slashTokenFromJob(address,address,uint256)": { + "notice": "Allows governor or slasher to slash a job specific token" + }, + "slashers(address)": { + "notice": "Tracks whether the address is a slasher or not" + }, + "totalBonds()": { + "notice": "Tracks the total amount of bonded KP3Rs in the contract" + }, + "totalJobCredits(address)": { + "notice": "Calculates the total credits of a given job" + }, + "unbond(address,uint256)": { + "notice": "Beginning of the unbonding process" + }, + "unbondLiquidityFromJob(address,address,uint256)": { + "notice": "Unbond liquidity for a job" + }, + "unbondTime()": { + "notice": "The amount of time required to pass before a keeper can unbond what he has bonded" + }, + "withdraw(address)": { + "notice": "Withdraw funds after unbonding has finished" + }, + "withdrawLiquidityFromJob(address,address,address)": { + "notice": "Withdraw liquidity from a job" + }, + "withdrawTokenCreditsFromJob(address,address,uint256,address)": { + "notice": "Withdraw credit from a job" + }, + "workCompleted(address)": { + "notice": "Tracks the total KP3R earnings of a keeper since it started working" + }, + "worked(address)": { + "notice": "Implemented by jobs to show that a keeper performed work" + }, + "workedAt(address)": { + "notice": "Last time the job was worked" + } + }, + "version": 1 + }, + "storageLayout": { + "storage": [ + { + "astId": 309, + "contract": "solidity/for-test/testnet/Keep3rForTestnet.sol:Keep3rForTestnet", + "label": "_status", + "offset": 0, + "slot": "0", + "type": "t_uint256" + }, + { + "astId": 8765, + "contract": "solidity/for-test/testnet/Keep3rForTestnet.sol:Keep3rForTestnet", + "label": "jobOwner", + "offset": 0, + "slot": "1", + "type": "t_mapping(t_address,t_address)" + }, + { + "astId": 8771, + "contract": "solidity/for-test/testnet/Keep3rForTestnet.sol:Keep3rForTestnet", + "label": "jobPendingOwner", + "offset": 0, + "slot": "2", + "type": "t_mapping(t_address,t_address)" + }, + { + "astId": 82, + "contract": "solidity/for-test/testnet/Keep3rForTestnet.sol:Keep3rForTestnet", + "label": "governor", + "offset": 0, + "slot": "3", + "type": "t_address" + }, + { + "astId": 85, + "contract": "solidity/for-test/testnet/Keep3rForTestnet.sol:Keep3rForTestnet", + "label": "pendingGovernor", + "offset": 0, + "slot": "4", + "type": "t_address" + }, + { + "astId": 6333, + "contract": "solidity/for-test/testnet/Keep3rForTestnet.sol:Keep3rForTestnet", + "label": "slashers", + "offset": 0, + "slot": "5", + "type": "t_mapping(t_address,t_bool)" + }, + { + "astId": 6339, + "contract": "solidity/for-test/testnet/Keep3rForTestnet.sol:Keep3rForTestnet", + "label": "disputers", + "offset": 0, + "slot": "6", + "type": "t_mapping(t_address,t_bool)" + }, + { + "astId": 5801, + "contract": "solidity/for-test/testnet/Keep3rForTestnet.sol:Keep3rForTestnet", + "label": "_keepers", + "offset": 0, + "slot": "7", + "type": "t_struct(AddressSet)1930_storage" + }, + { + "astId": 5805, + "contract": "solidity/for-test/testnet/Keep3rForTestnet.sol:Keep3rForTestnet", + "label": "totalBonds", + "offset": 0, + "slot": "9", + "type": "t_uint256" + }, + { + "astId": 5811, + "contract": "solidity/for-test/testnet/Keep3rForTestnet.sol:Keep3rForTestnet", + "label": "workCompleted", + "offset": 0, + "slot": "10", + "type": "t_mapping(t_address,t_uint256)" + }, + { + "astId": 5817, + "contract": "solidity/for-test/testnet/Keep3rForTestnet.sol:Keep3rForTestnet", + "label": "firstSeen", + "offset": 0, + "slot": "11", + "type": "t_mapping(t_address,t_uint256)" + }, + { + "astId": 5823, + "contract": "solidity/for-test/testnet/Keep3rForTestnet.sol:Keep3rForTestnet", + "label": "disputes", + "offset": 0, + "slot": "12", + "type": "t_mapping(t_address,t_bool)" + }, + { + "astId": 5831, + "contract": "solidity/for-test/testnet/Keep3rForTestnet.sol:Keep3rForTestnet", + "label": "bonds", + "offset": 0, + "slot": "13", + "type": "t_mapping(t_address,t_mapping(t_address,t_uint256))" + }, + { + "astId": 5839, + "contract": "solidity/for-test/testnet/Keep3rForTestnet.sol:Keep3rForTestnet", + "label": "jobTokenCredits", + "offset": 0, + "slot": "14", + "type": "t_mapping(t_address,t_mapping(t_address,t_uint256))" + }, + { + "astId": 5844, + "contract": "solidity/for-test/testnet/Keep3rForTestnet.sol:Keep3rForTestnet", + "label": "_jobLiquidityCredits", + "offset": 0, + "slot": "15", + "type": "t_mapping(t_address,t_uint256)" + }, + { + "astId": 5849, + "contract": "solidity/for-test/testnet/Keep3rForTestnet.sol:Keep3rForTestnet", + "label": "_jobPeriodCredits", + "offset": 0, + "slot": "16", + "type": "t_mapping(t_address,t_uint256)" + }, + { + "astId": 5855, + "contract": "solidity/for-test/testnet/Keep3rForTestnet.sol:Keep3rForTestnet", + "label": "_jobTokens", + "offset": 0, + "slot": "17", + "type": "t_mapping(t_address,t_struct(AddressSet)1930_storage)" + }, + { + "astId": 5861, + "contract": "solidity/for-test/testnet/Keep3rForTestnet.sol:Keep3rForTestnet", + "label": "_jobLiquidities", + "offset": 0, + "slot": "18", + "type": "t_mapping(t_address,t_struct(AddressSet)1930_storage)" + }, + { + "astId": 5866, + "contract": "solidity/for-test/testnet/Keep3rForTestnet.sol:Keep3rForTestnet", + "label": "_liquidityPool", + "offset": 0, + "slot": "19", + "type": "t_mapping(t_address,t_address)" + }, + { + "astId": 5871, + "contract": "solidity/for-test/testnet/Keep3rForTestnet.sol:Keep3rForTestnet", + "label": "_isKP3RToken0", + "offset": 0, + "slot": "20", + "type": "t_mapping(t_address,t_bool)" + }, + { + "astId": 5879, + "contract": "solidity/for-test/testnet/Keep3rForTestnet.sol:Keep3rForTestnet", + "label": "pendingBonds", + "offset": 0, + "slot": "21", + "type": "t_mapping(t_address,t_mapping(t_address,t_uint256))" + }, + { + "astId": 5887, + "contract": "solidity/for-test/testnet/Keep3rForTestnet.sol:Keep3rForTestnet", + "label": "canActivateAfter", + "offset": 0, + "slot": "22", + "type": "t_mapping(t_address,t_mapping(t_address,t_uint256))" + }, + { + "astId": 5895, + "contract": "solidity/for-test/testnet/Keep3rForTestnet.sol:Keep3rForTestnet", + "label": "canWithdrawAfter", + "offset": 0, + "slot": "23", + "type": "t_mapping(t_address,t_mapping(t_address,t_uint256))" + }, + { + "astId": 5903, + "contract": "solidity/for-test/testnet/Keep3rForTestnet.sol:Keep3rForTestnet", + "label": "pendingUnbonds", + "offset": 0, + "slot": "24", + "type": "t_mapping(t_address,t_mapping(t_address,t_uint256))" + }, + { + "astId": 5909, + "contract": "solidity/for-test/testnet/Keep3rForTestnet.sol:Keep3rForTestnet", + "label": "hasBonded", + "offset": 0, + "slot": "25", + "type": "t_mapping(t_address,t_bool)" + }, + { + "astId": 5913, + "contract": "solidity/for-test/testnet/Keep3rForTestnet.sol:Keep3rForTestnet", + "label": "_jobs", + "offset": 0, + "slot": "26", + "type": "t_struct(AddressSet)1930_storage" + }, + { + "astId": 6026, + "contract": "solidity/for-test/testnet/Keep3rForTestnet.sol:Keep3rForTestnet", + "label": "keep3rV1", + "offset": 0, + "slot": "28", + "type": "t_address" + }, + { + "astId": 6030, + "contract": "solidity/for-test/testnet/Keep3rForTestnet.sol:Keep3rForTestnet", + "label": "keep3rV1Proxy", + "offset": 0, + "slot": "29", + "type": "t_address" + }, + { + "astId": 6034, + "contract": "solidity/for-test/testnet/Keep3rForTestnet.sol:Keep3rForTestnet", + "label": "keep3rHelper", + "offset": 0, + "slot": "30", + "type": "t_address" + }, + { + "astId": 6039, + "contract": "solidity/for-test/testnet/Keep3rForTestnet.sol:Keep3rForTestnet", + "label": "bondTime", + "offset": 0, + "slot": "31", + "type": "t_uint256" + }, + { + "astId": 6044, + "contract": "solidity/for-test/testnet/Keep3rForTestnet.sol:Keep3rForTestnet", + "label": "unbondTime", + "offset": 0, + "slot": "32", + "type": "t_uint256" + }, + { + "astId": 6049, + "contract": "solidity/for-test/testnet/Keep3rForTestnet.sol:Keep3rForTestnet", + "label": "liquidityMinimum", + "offset": 0, + "slot": "33", + "type": "t_uint256" + }, + { + "astId": 6054, + "contract": "solidity/for-test/testnet/Keep3rForTestnet.sol:Keep3rForTestnet", + "label": "rewardPeriodTime", + "offset": 0, + "slot": "34", + "type": "t_uint256" + }, + { + "astId": 6059, + "contract": "solidity/for-test/testnet/Keep3rForTestnet.sol:Keep3rForTestnet", + "label": "inflationPeriod", + "offset": 0, + "slot": "35", + "type": "t_uint256" + }, + { + "astId": 6064, + "contract": "solidity/for-test/testnet/Keep3rForTestnet.sol:Keep3rForTestnet", + "label": "fee", + "offset": 0, + "slot": "36", + "type": "t_uint256" + }, + { + "astId": 6766, + "contract": "solidity/for-test/testnet/Keep3rForTestnet.sol:Keep3rForTestnet", + "label": "jobTokenCreditsAddedAt", + "offset": 0, + "slot": "37", + "type": "t_mapping(t_address,t_mapping(t_address,t_uint256))" + }, + { + "astId": 7009, + "contract": "solidity/for-test/testnet/Keep3rForTestnet.sol:Keep3rForTestnet", + "label": "_approvedLiquidities", + "offset": 0, + "slot": "38", + "type": "t_struct(AddressSet)1930_storage" + }, + { + "astId": 7017, + "contract": "solidity/for-test/testnet/Keep3rForTestnet.sol:Keep3rForTestnet", + "label": "liquidityAmount", + "offset": 0, + "slot": "40", + "type": "t_mapping(t_address,t_mapping(t_address,t_uint256))" + }, + { + "astId": 7023, + "contract": "solidity/for-test/testnet/Keep3rForTestnet.sol:Keep3rForTestnet", + "label": "rewardedAt", + "offset": 0, + "slot": "41", + "type": "t_mapping(t_address,t_uint256)" + }, + { + "astId": 7029, + "contract": "solidity/for-test/testnet/Keep3rForTestnet.sol:Keep3rForTestnet", + "label": "workedAt", + "offset": 0, + "slot": "42", + "type": "t_mapping(t_address,t_uint256)" + }, + { + "astId": 7035, + "contract": "solidity/for-test/testnet/Keep3rForTestnet.sol:Keep3rForTestnet", + "label": "_tick", + "offset": 0, + "slot": "43", + "type": "t_mapping(t_address,t_struct(TickCache)14902_storage)" + }, + { + "astId": 8486, + "contract": "solidity/for-test/testnet/Keep3rForTestnet.sol:Keep3rForTestnet", + "label": "pendingJobMigrations", + "offset": 0, + "slot": "44", + "type": "t_mapping(t_address,t_address)" + }, + { + "astId": 8492, + "contract": "solidity/for-test/testnet/Keep3rForTestnet.sol:Keep3rForTestnet", + "label": "_migrationCreatedAt", + "offset": 0, + "slot": "45", + "type": "t_mapping(t_address,t_mapping(t_address,t_uint256))" + }, + { + "astId": 8889, + "contract": "solidity/for-test/testnet/Keep3rForTestnet.sol:Keep3rForTestnet", + "label": "_initialGas", + "offset": 0, + "slot": "46", + "type": "t_uint256" + } + ], + "types": { + "t_address": { + "encoding": "inplace", + "label": "address", + "numberOfBytes": "20" + }, + "t_array(t_bytes32)dyn_storage": { + "base": "t_bytes32", + "encoding": "dynamic_array", + "label": "bytes32[]", + "numberOfBytes": "32" + }, + "t_bool": { + "encoding": "inplace", + "label": "bool", + "numberOfBytes": "1" + }, + "t_bytes32": { + "encoding": "inplace", + "label": "bytes32", + "numberOfBytes": "32" + }, + "t_int56": { + "encoding": "inplace", + "label": "int56", + "numberOfBytes": "7" + }, + "t_mapping(t_address,t_address)": { + "encoding": "mapping", + "key": "t_address", + "label": "mapping(address => address)", + "numberOfBytes": "32", + "value": "t_address" + }, + "t_mapping(t_address,t_bool)": { + "encoding": "mapping", + "key": "t_address", + "label": "mapping(address => bool)", + "numberOfBytes": "32", + "value": "t_bool" + }, + "t_mapping(t_address,t_mapping(t_address,t_uint256))": { + "encoding": "mapping", + "key": "t_address", + "label": "mapping(address => mapping(address => uint256))", + "numberOfBytes": "32", + "value": "t_mapping(t_address,t_uint256)" + }, + "t_mapping(t_address,t_struct(AddressSet)1930_storage)": { + "encoding": "mapping", + "key": "t_address", + "label": "mapping(address => struct EnumerableSet.AddressSet)", + "numberOfBytes": "32", + "value": "t_struct(AddressSet)1930_storage" + }, + "t_mapping(t_address,t_struct(TickCache)14902_storage)": { + "encoding": "mapping", + "key": "t_address", + "label": "mapping(address => struct IKeep3rJobFundableLiquidity.TickCache)", + "numberOfBytes": "32", + "value": "t_struct(TickCache)14902_storage" + }, + "t_mapping(t_address,t_uint256)": { + "encoding": "mapping", + "key": "t_address", + "label": "mapping(address => uint256)", + "numberOfBytes": "32", + "value": "t_uint256" + }, + "t_mapping(t_bytes32,t_uint256)": { + "encoding": "mapping", + "key": "t_bytes32", + "label": "mapping(bytes32 => uint256)", + "numberOfBytes": "32", + "value": "t_uint256" + }, + "t_struct(AddressSet)1930_storage": { + "encoding": "inplace", + "label": "struct EnumerableSet.AddressSet", + "members": [ + { + "astId": 1929, + "contract": "solidity/for-test/testnet/Keep3rForTestnet.sol:Keep3rForTestnet", + "label": "_inner", + "offset": 0, + "slot": "0", + "type": "t_struct(Set)1629_storage" + } + ], + "numberOfBytes": "64" + }, + "t_struct(Set)1629_storage": { + "encoding": "inplace", + "label": "struct EnumerableSet.Set", + "members": [ + { + "astId": 1624, + "contract": "solidity/for-test/testnet/Keep3rForTestnet.sol:Keep3rForTestnet", + "label": "_values", + "offset": 0, + "slot": "0", + "type": "t_array(t_bytes32)dyn_storage" + }, + { + "astId": 1628, + "contract": "solidity/for-test/testnet/Keep3rForTestnet.sol:Keep3rForTestnet", + "label": "_indexes", + "offset": 0, + "slot": "1", + "type": "t_mapping(t_bytes32,t_uint256)" + } + ], + "numberOfBytes": "64" + }, + "t_struct(TickCache)14902_storage": { + "encoding": "inplace", + "label": "struct IKeep3rJobFundableLiquidity.TickCache", + "members": [ + { + "astId": 14897, + "contract": "solidity/for-test/testnet/Keep3rForTestnet.sol:Keep3rForTestnet", + "label": "current", + "offset": 0, + "slot": "0", + "type": "t_int56" + }, + { + "astId": 14899, + "contract": "solidity/for-test/testnet/Keep3rForTestnet.sol:Keep3rForTestnet", + "label": "difference", + "offset": 7, + "slot": "0", + "type": "t_int56" + }, + { + "astId": 14901, + "contract": "solidity/for-test/testnet/Keep3rForTestnet.sol:Keep3rForTestnet", + "label": "period", + "offset": 0, + "slot": "1", + "type": "t_uint256" + } + ], + "numberOfBytes": "64" + }, + "t_uint256": { + "encoding": "inplace", + "label": "uint256", + "numberOfBytes": "32" + } + } + } +} \ No newline at end of file diff --git a/deployments/sepolia/Keep3rHelperForTestnet.json b/deployments/sepolia/Keep3rHelperForTestnet.json new file mode 100644 index 0000000..17ba372 --- /dev/null +++ b/deployments/sepolia/Keep3rHelperForTestnet.json @@ -0,0 +1,1327 @@ +{ + "address": "0x5e07658C7B5F66a3698103b8A74a941E14DF1F30", + "abi": [ + { + "inputs": [ + { + "internalType": "address", + "name": "_kp3r", + "type": "address" + }, + { + "internalType": "address", + "name": "_keep3rV2", + "type": "address" + }, + { + "internalType": "address", + "name": "_governor", + "type": "address" + }, + { + "internalType": "address", + "name": "_kp3rWethPool", + "type": "address" + } + ], + "stateMutability": "nonpayable", + "type": "constructor" + }, + { + "inputs": [], + "name": "InvalidAddress", + "type": "error" + }, + { + "inputs": [], + "name": "InvalidAmount", + "type": "error" + }, + { + "inputs": [], + "name": "InvalidOraclePool", + "type": "error" + }, + { + "inputs": [], + "name": "LengthMismatch", + "type": "error" + }, + { + "inputs": [], + "name": "LiquidityPairInvalid", + "type": "error" + }, + { + "inputs": [], + "name": "OnlyGovernor", + "type": "error" + }, + { + "inputs": [], + "name": "OnlyPendingGovernor", + "type": "error" + }, + { + "inputs": [], + "name": "ZeroAddress", + "type": "error" + }, + { + "inputs": [], + "name": "ZeroAmount", + "type": "error" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "_keep3rV2", + "type": "address" + } + ], + "name": "Keep3rV2Change", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "_address", + "type": "address" + }, + { + "indexed": false, + "internalType": "bool", + "name": "_isKP3RToken0", + "type": "bool" + } + ], + "name": "Kp3rWethPoolChange", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint256", + "name": "_maxBoost", + "type": "uint256" + } + ], + "name": "MaxBoostChange", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint256", + "name": "_minBaseFee", + "type": "uint256" + } + ], + "name": "MinBaseFeeChange", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint256", + "name": "_minBoost", + "type": "uint256" + } + ], + "name": "MinBoostChange", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint256", + "name": "_minPriorityFee", + "type": "uint256" + } + ], + "name": "MinPriorityFeeChange", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "_newGovernor", + "type": "address" + } + ], + "name": "PendingGovernorAccepted", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "_governor", + "type": "address" + }, + { + "indexed": false, + "internalType": "address", + "name": "_pendingGovernor", + "type": "address" + } + ], + "name": "PendingGovernorSet", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint32", + "name": "_quoteTwapTime", + "type": "uint32" + } + ], + "name": "QuoteTwapTimeChange", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint256", + "name": "_targetBond", + "type": "uint256" + } + ], + "name": "TargetBondChange", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint256", + "name": "_workExtraGas", + "type": "uint256" + } + ], + "name": "WorkExtraGasChange", + "type": "event" + }, + { + "inputs": [], + "name": "BOOST_BASE", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "KP3R", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "acceptPendingGovernor", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_keeper", + "type": "address" + } + ], + "name": "bonds", + "outputs": [ + { + "internalType": "uint256", + "name": "_amountBonded", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "_liquidityAmount", + "type": "uint256" + }, + { + "internalType": "int56", + "name": "_tickDifference", + "type": "int56" + }, + { + "internalType": "uint256", + "name": "_timeInterval", + "type": "uint256" + } + ], + "name": "getKP3RsAtTick", + "outputs": [ + { + "internalType": "uint256", + "name": "_kp3rAmount", + "type": "uint256" + } + ], + "stateMutability": "pure", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "_bonds", + "type": "uint256" + } + ], + "name": "getPaymentParams", + "outputs": [ + { + "internalType": "uint256", + "name": "_boost", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "_oneEthQuote", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "_extra", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_pool", + "type": "address" + } + ], + "name": "getPoolTokens", + "outputs": [ + { + "internalType": "address", + "name": "_token0", + "type": "address" + }, + { + "internalType": "address", + "name": "_token1", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint128", + "name": "_baseAmount", + "type": "uint128" + }, + { + "internalType": "int56", + "name": "_tickDifference", + "type": "int56" + }, + { + "internalType": "uint256", + "name": "_timeInterval", + "type": "uint256" + } + ], + "name": "getQuoteAtTick", + "outputs": [ + { + "internalType": "uint256", + "name": "_quoteAmount", + "type": "uint256" + } + ], + "stateMutability": "pure", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "_gasUsed", + "type": "uint256" + } + ], + "name": "getRewardAmount", + "outputs": [ + { + "internalType": "uint256", + "name": "_amount", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_keeper", + "type": "address" + }, + { + "internalType": "uint256", + "name": "_gasUsed", + "type": "uint256" + } + ], + "name": "getRewardAmountFor", + "outputs": [ + { + "internalType": "uint256", + "name": "_kp3r", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "_bonds", + "type": "uint256" + } + ], + "name": "getRewardBoostFor", + "outputs": [ + { + "internalType": "uint256", + "name": "_rewardBoost", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "governor", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_pool", + "type": "address" + } + ], + "name": "isKP3RToken0", + "outputs": [ + { + "internalType": "bool", + "name": "_isKP3RToken0", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "keep3rV2", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "kp3rWethPool", + "outputs": [ + { + "internalType": "address", + "name": "poolAddress", + "type": "address" + }, + { + "internalType": "bool", + "name": "isKP3RToken0", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "maxBoost", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "minBaseFee", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "minBoost", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "minPriorityFee", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_pool", + "type": "address" + }, + { + "internalType": "uint32[]", + "name": "_secondsAgo", + "type": "uint32[]" + } + ], + "name": "observe", + "outputs": [ + { + "internalType": "int56", + "name": "_tickCumulative1", + "type": "int56" + }, + { + "internalType": "int56", + "name": "_tickCumulative2", + "type": "int56" + }, + { + "internalType": "bool", + "name": "_success", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "pendingGovernor", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "_eth", + "type": "uint256" + } + ], + "name": "quote", + "outputs": [ + { + "internalType": "uint256", + "name": "_amountOut", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "quoteTwapTime", + "outputs": [ + { + "internalType": "uint32", + "name": "", + "type": "uint32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_keep3rV2", + "type": "address" + } + ], + "name": "setKeep3rV2", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_poolAddress", + "type": "address" + } + ], + "name": "setKp3rWethPool", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "_maxBoost", + "type": "uint256" + } + ], + "name": "setMaxBoost", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "_minBaseFee", + "type": "uint256" + } + ], + "name": "setMinBaseFee", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "_minBoost", + "type": "uint256" + } + ], + "name": "setMinBoost", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "_minPriorityFee", + "type": "uint256" + } + ], + "name": "setMinPriorityFee", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_pendingGovernor", + "type": "address" + } + ], + "name": "setPendingGovernor", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint32", + "name": "_quoteTwapTime", + "type": "uint32" + } + ], + "name": "setQuoteTwapTime", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "_targetBond", + "type": "uint256" + } + ], + "name": "setTargetBond", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "_workExtraGas", + "type": "uint256" + } + ], + "name": "setWorkExtraGas", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "targetBond", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "workExtraGas", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + } + ], + "transactionHash": "0xb913e45768fb6e2388a480efcf99b943f0b19a4803a8083ffa36effe23dbe766", + "receipt": { + "to": null, + "from": "0x169Cf949aB1B25453b70F2Fe874e2c65c10AE0f8", + "contractAddress": "0x5e07658C7B5F66a3698103b8A74a941E14DF1F30", + "transactionIndex": 37, + "gasUsed": "1908941", + "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000040000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000000000000000000000000000800000000000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000200000000000000000000000000000000000000100000000000000000000", + "blockHash": "0xfb1c37a885fc26ec6c32329b9716de8c815b9d577179d5d9e1a084dec904d766", + "transactionHash": "0xb913e45768fb6e2388a480efcf99b943f0b19a4803a8083ffa36effe23dbe766", + "logs": [ + { + "transactionIndex": 37, + "blockNumber": 6046502, + "transactionHash": "0xb913e45768fb6e2388a480efcf99b943f0b19a4803a8083ffa36effe23dbe766", + "address": "0x5e07658C7B5F66a3698103b8A74a941E14DF1F30", + "topics": [ + "0x554c636366d5fc882a9ab4b7b9d5181781d1a7076abe50ed410365620dcf4108" + ], + "data": "0x000000000000000000000000b39dea2246ac99575eebc86a2590badf046eda910000000000000000000000000000000000000000000000000000000000000001", + "logIndex": 84, + "blockHash": "0xfb1c37a885fc26ec6c32329b9716de8c815b9d577179d5d9e1a084dec904d766" + } + ], + "blockNumber": 6046502, + "cumulativeGasUsed": "4763101", + "status": 1, + "byzantium": true + }, + "args": [ + "0x80B4327021946fF962d570c808B6aaC47224AeF1", + "0xbC855B9Ad7398360999Bd176edBC98EB53F9E26F", + "0x169Cf949aB1B25453b70F2Fe874e2c65c10AE0f8", + "0xb39Dea2246Ac99575eebc86A2590BADF046eda91" + ], + "numDeployments": 4, + "solcInputHash": "4e9d9cfe55e24217a94485fe49438e4a", + "metadata": "{\"compiler\":{\"version\":\"0.8.8+commit.dddeac2f\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_kp3r\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"_keep3rV2\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"_governor\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"_kp3rWethPool\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"inputs\":[],\"name\":\"InvalidAddress\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"InvalidAmount\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"InvalidOraclePool\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"LengthMismatch\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"LiquidityPairInvalid\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"OnlyGovernor\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"OnlyPendingGovernor\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"ZeroAddress\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"ZeroAmount\",\"type\":\"error\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"_keep3rV2\",\"type\":\"address\"}],\"name\":\"Keep3rV2Change\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"_address\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"bool\",\"name\":\"_isKP3RToken0\",\"type\":\"bool\"}],\"name\":\"Kp3rWethPoolChange\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"_maxBoost\",\"type\":\"uint256\"}],\"name\":\"MaxBoostChange\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"_minBaseFee\",\"type\":\"uint256\"}],\"name\":\"MinBaseFeeChange\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"_minBoost\",\"type\":\"uint256\"}],\"name\":\"MinBoostChange\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"_minPriorityFee\",\"type\":\"uint256\"}],\"name\":\"MinPriorityFeeChange\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"_newGovernor\",\"type\":\"address\"}],\"name\":\"PendingGovernorAccepted\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"_governor\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"_pendingGovernor\",\"type\":\"address\"}],\"name\":\"PendingGovernorSet\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint32\",\"name\":\"_quoteTwapTime\",\"type\":\"uint32\"}],\"name\":\"QuoteTwapTimeChange\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"_targetBond\",\"type\":\"uint256\"}],\"name\":\"TargetBondChange\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"_workExtraGas\",\"type\":\"uint256\"}],\"name\":\"WorkExtraGasChange\",\"type\":\"event\"},{\"inputs\":[],\"name\":\"BOOST_BASE\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"KP3R\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"acceptPendingGovernor\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_keeper\",\"type\":\"address\"}],\"name\":\"bonds\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"_amountBonded\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_liquidityAmount\",\"type\":\"uint256\"},{\"internalType\":\"int56\",\"name\":\"_tickDifference\",\"type\":\"int56\"},{\"internalType\":\"uint256\",\"name\":\"_timeInterval\",\"type\":\"uint256\"}],\"name\":\"getKP3RsAtTick\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"_kp3rAmount\",\"type\":\"uint256\"}],\"stateMutability\":\"pure\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_bonds\",\"type\":\"uint256\"}],\"name\":\"getPaymentParams\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"_boost\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"_oneEthQuote\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"_extra\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_pool\",\"type\":\"address\"}],\"name\":\"getPoolTokens\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"_token0\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"_token1\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint128\",\"name\":\"_baseAmount\",\"type\":\"uint128\"},{\"internalType\":\"int56\",\"name\":\"_tickDifference\",\"type\":\"int56\"},{\"internalType\":\"uint256\",\"name\":\"_timeInterval\",\"type\":\"uint256\"}],\"name\":\"getQuoteAtTick\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"_quoteAmount\",\"type\":\"uint256\"}],\"stateMutability\":\"pure\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_gasUsed\",\"type\":\"uint256\"}],\"name\":\"getRewardAmount\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"_amount\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_keeper\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"_gasUsed\",\"type\":\"uint256\"}],\"name\":\"getRewardAmountFor\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"_kp3r\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_bonds\",\"type\":\"uint256\"}],\"name\":\"getRewardBoostFor\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"_rewardBoost\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"governor\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_pool\",\"type\":\"address\"}],\"name\":\"isKP3RToken0\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"_isKP3RToken0\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"keep3rV2\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"kp3rWethPool\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"poolAddress\",\"type\":\"address\"},{\"internalType\":\"bool\",\"name\":\"isKP3RToken0\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"maxBoost\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"minBaseFee\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"minBoost\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"minPriorityFee\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_pool\",\"type\":\"address\"},{\"internalType\":\"uint32[]\",\"name\":\"_secondsAgo\",\"type\":\"uint32[]\"}],\"name\":\"observe\",\"outputs\":[{\"internalType\":\"int56\",\"name\":\"_tickCumulative1\",\"type\":\"int56\"},{\"internalType\":\"int56\",\"name\":\"_tickCumulative2\",\"type\":\"int56\"},{\"internalType\":\"bool\",\"name\":\"_success\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"pendingGovernor\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_eth\",\"type\":\"uint256\"}],\"name\":\"quote\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"_amountOut\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"quoteTwapTime\",\"outputs\":[{\"internalType\":\"uint32\",\"name\":\"\",\"type\":\"uint32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_keep3rV2\",\"type\":\"address\"}],\"name\":\"setKeep3rV2\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_poolAddress\",\"type\":\"address\"}],\"name\":\"setKp3rWethPool\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_maxBoost\",\"type\":\"uint256\"}],\"name\":\"setMaxBoost\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_minBaseFee\",\"type\":\"uint256\"}],\"name\":\"setMinBaseFee\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_minBoost\",\"type\":\"uint256\"}],\"name\":\"setMinBoost\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_minPriorityFee\",\"type\":\"uint256\"}],\"name\":\"setMinPriorityFee\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_pendingGovernor\",\"type\":\"address\"}],\"name\":\"setPendingGovernor\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint32\",\"name\":\"_quoteTwapTime\",\"type\":\"uint32\"}],\"name\":\"setQuoteTwapTime\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_targetBond\",\"type\":\"uint256\"}],\"name\":\"setTargetBond\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_workExtraGas\",\"type\":\"uint256\"}],\"name\":\"setWorkExtraGas\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"targetBond\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"workExtraGas\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"}],\"devdoc\":{\"kind\":\"dev\",\"methods\":{\"bonds(address)\":{\"params\":{\"_keeper\":\"The address of the keeper to check\"},\"returns\":{\"_amountBonded\":\"The amount of KP3R the keeper has bonded\"}},\"getKP3RsAtTick(uint256,int56,uint256)\":{\"params\":{\"_liquidityAmount\":\"Amount of liquidity to be converted\",\"_tickDifference\":\"Tick value used to calculate the quote\",\"_timeInterval\":\"Time value used to calculate the quote\"},\"returns\":{\"_kp3rAmount\":\"Amount of KP3R tokens underlying on the given liquidity\"}},\"getPaymentParams(uint256)\":{\"params\":{\"_bonds\":\"Amount of bonded KP3R owned by the keeper\"},\"returns\":{\"_boost\":\"Multiplier per gas unit. Takes into account the base fee and the amount of bonded KP3R\",\"_extra\":\"Amount of extra gas that should be added to the gas spent\",\"_oneEthQuote\":\"Amount of KP3R tokens equivalent to 1 ETH\"}},\"getPoolTokens(address)\":{\"params\":{\"_pool\":\"Address of the correspondant pool\"},\"returns\":{\"_token0\":\"Address of the first token of the pair\",\"_token1\":\"Address of the second token of the pair\"}},\"getQuoteAtTick(uint128,int56,uint256)\":{\"params\":{\"_baseAmount\":\"Amount of token to be converted\",\"_tickDifference\":\"Tick value used to calculate the quote\",\"_timeInterval\":\"Time value used to calculate the quote\"},\"returns\":{\"_quoteAmount\":\"Amount of credits deserved for the baseAmount at the tick value\"}},\"getRewardAmount(uint256)\":{\"params\":{\"_gasUsed\":\"The amount of gas used that will be rewarded\"},\"returns\":{\"_amount\":\"The amount of KP3R that should be awarded to tx.origin\"}},\"getRewardAmountFor(address,uint256)\":{\"params\":{\"_gasUsed\":\"The amount of gas used that will be rewarded\",\"_keeper\":\"The address of the keeper to check\"},\"returns\":{\"_kp3r\":\"The amount of KP3R that should be awarded to the keeper\"}},\"getRewardBoostFor(uint256)\":{\"details\":\"If the keeper has no bonds, boost should be +10% of gas cost, if keeper has max bonds, +20%\",\"params\":{\"_bonds\":\"The amount of KP3R tokens bonded by the keeper\"},\"returns\":{\"_rewardBoost\":\"The reward boost that corresponds to the keeper\"}},\"isKP3RToken0(address)\":{\"params\":{\"_pool\":\"Address of the correspondant pool\"},\"returns\":{\"_isKP3RToken0\":\"Boolean indicating the order of the tokens in the pair\"}},\"observe(address,uint32[])\":{\"params\":{\"_pool\":\"Address of the pool to observe\",\"_secondsAgo\":\"Array with time references to observe\"},\"returns\":{\"_success\":\"Boolean indicating if the observe call was succesfull\",\"_tickCumulative1\":\"Cumulative sum of ticks until first time reference\",\"_tickCumulative2\":\"Cumulative sum of ticks until second time reference\"}},\"quote(uint256)\":{\"details\":\"This function allows us to calculate how much KP3R we should pay to a keeper for things expressed in ETH, like gas\",\"params\":{\"_eth\":\"The amount of ETH\"},\"returns\":{\"_amountOut\":\"The amount of KP3R\"}},\"setKeep3rV2(address)\":{\"params\":{\"_keep3rV2\":\"The address of Keep3r V2\"}},\"setKp3rWethPool(address)\":{\"params\":{\"_poolAddress\":\"The address of the KP3R-WETH pool\"}},\"setMaxBoost(uint256)\":{\"params\":{\"_maxBoost\":\"The maximum boost multiplier\"}},\"setMinBaseFee(uint256)\":{\"params\":{\"_minBaseFee\":\"The minimum rewarded gas fee\"}},\"setMinBoost(uint256)\":{\"params\":{\"_minBoost\":\"The minimum boost multiplier\"}},\"setMinPriorityFee(uint256)\":{\"params\":{\"_minPriorityFee\":\"The minimum rewarded priority fee\"}},\"setPendingGovernor(address)\":{\"params\":{\"_pendingGovernor\":\"Address of the proposed new governor\"}},\"setQuoteTwapTime(uint32)\":{\"params\":{\"_quoteTwapTime\":\"The twap time for quoting\"}},\"setTargetBond(uint256)\":{\"params\":{\"_targetBond\":\"The target bond amount\"}},\"setWorkExtraGas(uint256)\":{\"params\":{\"_workExtraGas\":\"The work extra gas\"}}},\"version\":1},\"userdoc\":{\"errors\":{\"InvalidAddress()\":[{\"notice\":\"Thrown if an address is invalid\"}],\"InvalidAmount()\":[{\"notice\":\"Thrown if an amount is invalid\"}],\"InvalidOraclePool()\":[{\"notice\":\"Throws when pool does not have KP3R as token0 nor token1\"}],\"LengthMismatch()\":[{\"notice\":\"Thrown if the lengths of a set of lists mismatch\"}],\"LiquidityPairInvalid()\":[{\"notice\":\"Throws when none of the tokens in the liquidity pair is KP3R\"}],\"OnlyGovernor()\":[{\"notice\":\"Thrown if a non-governor user tries to call a OnlyGovernor function\"}],\"OnlyPendingGovernor()\":[{\"notice\":\"Thrown if a non-pending-governor user tries to call a OnlyPendingGovernor function\"}],\"ZeroAddress()\":[{\"notice\":\"Thrown if an address is the zero address\"}],\"ZeroAmount()\":[{\"notice\":\"Thrown if an amount is zero\"}]},\"events\":{\"Keep3rV2Change(address)\":{\"notice\":\"Emitted when the Keep3r V2 address is changed\"},\"Kp3rWethPoolChange(address,bool)\":{\"notice\":\"Emitted when the kp3r weth pool is changed\"},\"MaxBoostChange(uint256)\":{\"notice\":\"Emitted when the maximum boost multiplier is changed\"},\"MinBaseFeeChange(uint256)\":{\"notice\":\"Emitted when minimum rewarded gas fee is changed\"},\"MinBoostChange(uint256)\":{\"notice\":\"Emitted when the minimum boost multiplier is changed\"},\"MinPriorityFeeChange(uint256)\":{\"notice\":\"Emitted when minimum rewarded priority fee is changed\"},\"PendingGovernorAccepted(address)\":{\"notice\":\"Emitted when a new governor is set\"},\"PendingGovernorSet(address,address)\":{\"notice\":\"Emitted when a new pending governor is set\"},\"QuoteTwapTimeChange(uint32)\":{\"notice\":\"Emitted when the quote twap time is changed\"},\"TargetBondChange(uint256)\":{\"notice\":\"Emitted when the target bond amount is changed\"},\"WorkExtraGasChange(uint256)\":{\"notice\":\"Emitted when the work extra gas amount is changed\"}},\"kind\":\"user\",\"methods\":{\"BOOST_BASE()\":{\"notice\":\"The boost base used to calculate the boost rewards for the keeper\"},\"KP3R()\":{\"notice\":\"Address of KP3R token\"},\"acceptPendingGovernor()\":{\"notice\":\"Allows a proposed governor to accept the governance\"},\"bonds(address)\":{\"notice\":\"Returns the amount of KP3R the keeper has bonded\"},\"getKP3RsAtTick(uint256,int56,uint256)\":{\"notice\":\"Given a tick and a liquidity amount, calculates the underlying KP3R tokens\"},\"getPaymentParams(uint256)\":{\"notice\":\"Get multiplier, quote, and extra, in order to calculate keeper payment\"},\"getPoolTokens(address)\":{\"notice\":\"Given a pool address, returns the underlying tokens of the pair\"},\"getQuoteAtTick(uint128,int56,uint256)\":{\"notice\":\"Given a tick and a token amount, calculates the output in correspondant token\"},\"getRewardAmount(uint256)\":{\"notice\":\"Calculates the reward (in KP3R) that corresponds to tx.origin for using gas\"},\"getRewardAmountFor(address,uint256)\":{\"notice\":\"Calculates the reward (in KP3R) that corresponds to a keeper for using gas\"},\"getRewardBoostFor(uint256)\":{\"notice\":\"Calculates the boost in the reward given to a keeper based on the amount of KP3R that keeper has bonded\"},\"isKP3RToken0(address)\":{\"notice\":\"Defines the order of the tokens in the pair for twap calculations\"},\"keep3rV2()\":{\"notice\":\"Address of Keep3r V2\"},\"kp3rWethPool()\":{\"notice\":\"KP3R-WETH pool that is being used as oracle\"},\"maxBoost()\":{\"notice\":\"The maximum multiplier used to calculate the amount of gas paid to the Keeper for the gas used to perform a job For example: if the quoted gas used is 1000, then the maximum amount to be paid will be 1000 * maxBoost / BOOST_BASE\"},\"minBaseFee()\":{\"notice\":\"The minimum base fee that is used to calculate keeper rewards\"},\"minBoost()\":{\"notice\":\"The minimum multiplier used to calculate the amount of gas paid to the Keeper for the gas used to perform a job For example: if the quoted gas used is 1000, then the minimum amount to be paid will be 1000 * minBoost / BOOST_BASE\"},\"minPriorityFee()\":{\"notice\":\"The minimum priority fee that is also rewarded for keepers\"},\"observe(address,uint32[])\":{\"notice\":\"Given an array of secondsAgo, returns UniswapV3 pool cumulatives at that moment\"},\"quote(uint256)\":{\"notice\":\"Calculates the amount of KP3R that corresponds to the ETH passed into the function\"},\"quoteTwapTime()\":{\"notice\":\"The twap time for quoting\"},\"setKeep3rV2(address)\":{\"notice\":\"Sets the Keep3r V2 address\"},\"setKp3rWethPool(address)\":{\"notice\":\"Sets KP3R-WETH pool\"},\"setMaxBoost(uint256)\":{\"notice\":\"Sets the maximum boost multiplier\"},\"setMinBaseFee(uint256)\":{\"notice\":\"Sets the minimum rewarded gas fee\"},\"setMinBoost(uint256)\":{\"notice\":\"Sets the minimum boost multiplier\"},\"setMinPriorityFee(uint256)\":{\"notice\":\"Sets the minimum rewarded gas priority fee\"},\"setPendingGovernor(address)\":{\"notice\":\"Allows a governor to propose a new governor\"},\"setQuoteTwapTime(uint32)\":{\"notice\":\"Sets the quote twap time\"},\"setTargetBond(uint256)\":{\"notice\":\"Sets the target bond amount\"},\"setWorkExtraGas(uint256)\":{\"notice\":\"Sets the work extra gas amount\"},\"targetBond()\":{\"notice\":\"The targeted amount of bonded KP3Rs to max-up reward multiplier For example: if the amount of KP3R the keeper has bonded is targetBond or more, then the keeper will get the maximum boost possible in his rewards, if it's less, the reward boost will be proportional\"},\"workExtraGas()\":{\"notice\":\"The amount of unaccounted gas that is going to be added to keeper payments\"}},\"version\":1}},\"settings\":{\"compilationTarget\":{\"solidity/for-test/testnet/Keep3rHelperForTestnet.sol\":\"Keep3rHelperForTestnet\"},\"evmVersion\":\"london\",\"libraries\":{\":__CACHE_BREAKER__\":\"0x00000000d41867734bbee4c6863d9255b2b06ac1\"},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":200},\"remappings\":[]},\"sources\":{\"@defi-wonderland/solidity-utils/solidity/contracts/Governable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.8 <0.9.0;\\n\\nimport {IGovernable} from '../interfaces/IGovernable.sol';\\n\\n/// @title Governable contract\\n/// @notice Manages the governor role\\nabstract contract Governable is IGovernable {\\n /// @inheritdoc IGovernable\\n address public governor;\\n\\n /// @inheritdoc IGovernable\\n address public pendingGovernor;\\n\\n constructor(address _governor) {\\n if (_governor == address(0)) revert ZeroAddress();\\n governor = _governor;\\n }\\n\\n /// @inheritdoc IGovernable\\n function setPendingGovernor(address _pendingGovernor) external onlyGovernor {\\n _setPendingGovernor(_pendingGovernor);\\n }\\n\\n /// @inheritdoc IGovernable\\n function acceptPendingGovernor() external onlyPendingGovernor {\\n _acceptPendingGovernor();\\n }\\n\\n function _setPendingGovernor(address _pendingGovernor) internal {\\n if (_pendingGovernor == address(0)) revert ZeroAddress();\\n pendingGovernor = _pendingGovernor;\\n emit PendingGovernorSet(governor, _pendingGovernor);\\n }\\n\\n function _acceptPendingGovernor() internal {\\n governor = pendingGovernor;\\n delete pendingGovernor;\\n emit PendingGovernorAccepted(governor);\\n }\\n\\n /// @notice Functions with this modifier can only be called by governor\\n modifier onlyGovernor() {\\n if (msg.sender != governor) revert OnlyGovernor();\\n _;\\n }\\n\\n /// @notice Functions with this modifier can only be called by pendingGovernor\\n modifier onlyPendingGovernor() {\\n if (msg.sender != pendingGovernor) revert OnlyPendingGovernor();\\n _;\\n }\\n}\\n\",\"keccak256\":\"0x3f11408cfcb015a99dc417e075c8ebc39b796fc2adc3e81b036487e4486881b3\",\"license\":\"MIT\"},\"@defi-wonderland/solidity-utils/solidity/interfaces/IBaseErrors.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.8 <0.9.0;\\n\\ninterface IBaseErrors {\\n /// @notice Thrown if an address is invalid\\n error InvalidAddress();\\n\\n /// @notice Thrown if an amount is invalid\\n error InvalidAmount();\\n\\n /// @notice Thrown if the lengths of a set of lists mismatch\\n error LengthMismatch();\\n\\n /// @notice Thrown if an address is the zero address\\n error ZeroAddress();\\n\\n /// @notice Thrown if an amount is zero\\n error ZeroAmount();\\n}\\n\",\"keccak256\":\"0xec09b9d248b6fbf6343dee41d6978abdc15d4c8df5ed7721e8df79e8b1a558cf\",\"license\":\"MIT\"},\"@defi-wonderland/solidity-utils/solidity/interfaces/IDustCollector.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.8 <0.9.0;\\n\\nimport {IGovernable} from './IGovernable.sol';\\nimport {IBaseErrors} from './IBaseErrors.sol';\\n\\n/// @title DustCollector interface\\ninterface IDustCollector is IBaseErrors, IGovernable {\\n // STATE VARIABLES\\n\\n /// @return _ethAddress Address used to trigger a native token transfer\\n // solhint-disable-next-line func-name-mixedcase\\n function ETH_ADDRESS() external view returns (address _ethAddress);\\n\\n // EVENTS\\n\\n /// @notice Emitted when dust is sent\\n /// @param _to The address which wil received the funds\\n /// @param _token The token that will be transferred\\n /// @param _amount The amount of the token that will be transferred\\n event DustSent(address _token, uint256 _amount, address _to);\\n\\n // FUNCTIONS\\n\\n /// @notice Allows an authorized user to transfer the tokens or eth that may have been left in a contract\\n /// @param _token The token that will be transferred\\n /// @param _amount The amont of the token that will be transferred\\n /// @param _to The address that will receive the idle funds\\n function sendDust(address _token, uint256 _amount, address _to) external;\\n}\\n\",\"keccak256\":\"0xbe22cc660bd6846093504989146038bd369f511325cef40cdc647fe7e04206b1\",\"license\":\"MIT\"},\"@defi-wonderland/solidity-utils/solidity/interfaces/IGovernable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.8 <0.9.0;\\n\\nimport {IBaseErrors} from './IBaseErrors.sol';\\n\\n/// @title Governable interface\\ninterface IGovernable is IBaseErrors {\\n // STATE VARIABLES\\n\\n /// @return _governor Address of the current governor\\n function governor() external view returns (address _governor);\\n\\n /// @return _pendingGovernor Address of the current pending governor\\n function pendingGovernor() external view returns (address _pendingGovernor);\\n\\n // EVENTS\\n\\n /// @notice Emitted when a new pending governor is set\\n /// @param _governor Address of the current governor\\n /// @param _pendingGovernor Address of the proposed next governor\\n event PendingGovernorSet(address _governor, address _pendingGovernor);\\n\\n /// @notice Emitted when a new governor is set\\n /// @param _newGovernor Address of the new governor\\n event PendingGovernorAccepted(address _newGovernor);\\n\\n // ERRORS\\n\\n /// @notice Thrown if a non-governor user tries to call a OnlyGovernor function\\n error OnlyGovernor();\\n\\n /// @notice Thrown if a non-pending-governor user tries to call a OnlyPendingGovernor function\\n error OnlyPendingGovernor();\\n\\n // FUNCTIONS\\n\\n /// @notice Allows a governor to propose a new governor\\n /// @param _pendingGovernor Address of the proposed new governor\\n function setPendingGovernor(address _pendingGovernor) external;\\n\\n /// @notice Allows a proposed governor to accept the governance\\n function acceptPendingGovernor() external;\\n}\\n\",\"keccak256\":\"0x40b94706a00d2c092f620807ba84bdd0c5ed8cfa60140c924edc850427e0af13\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC20/IERC20.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Interface of the ERC20 standard as defined in the EIP.\\n */\\ninterface IERC20 {\\n /**\\n * @dev Returns the amount of tokens in existence.\\n */\\n function totalSupply() external view returns (uint256);\\n\\n /**\\n * @dev Returns the amount of tokens owned by `account`.\\n */\\n function balanceOf(address account) external view returns (uint256);\\n\\n /**\\n * @dev Moves `amount` tokens from the caller's account to `recipient`.\\n *\\n * Returns a boolean value indicating whether the operation succeeded.\\n *\\n * Emits a {Transfer} event.\\n */\\n function transfer(address recipient, uint256 amount) external returns (bool);\\n\\n /**\\n * @dev Returns the remaining number of tokens that `spender` will be\\n * allowed to spend on behalf of `owner` through {transferFrom}. This is\\n * zero by default.\\n *\\n * This value changes when {approve} or {transferFrom} are called.\\n */\\n function allowance(address owner, address spender) external view returns (uint256);\\n\\n /**\\n * @dev Sets `amount` as the allowance of `spender` over the caller's tokens.\\n *\\n * Returns a boolean value indicating whether the operation succeeded.\\n *\\n * IMPORTANT: Beware that changing an allowance with this method brings the risk\\n * that someone may use both the old and the new allowance by unfortunate\\n * transaction ordering. One possible solution to mitigate this race\\n * condition is to first reduce the spender's allowance to 0 and set the\\n * desired value afterwards:\\n * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729\\n *\\n * Emits an {Approval} event.\\n */\\n function approve(address spender, uint256 amount) external returns (bool);\\n\\n /**\\n * @dev Moves `amount` tokens from `sender` to `recipient` using the\\n * allowance mechanism. `amount` is then deducted from the caller's\\n * allowance.\\n *\\n * Returns a boolean value indicating whether the operation succeeded.\\n *\\n * Emits a {Transfer} event.\\n */\\n function transferFrom(\\n address sender,\\n address recipient,\\n uint256 amount\\n ) external returns (bool);\\n\\n /**\\n * @dev Emitted when `value` tokens are moved from one account (`from`) to\\n * another (`to`).\\n *\\n * Note that `value` may be zero.\\n */\\n event Transfer(address indexed from, address indexed to, uint256 value);\\n\\n /**\\n * @dev Emitted when the allowance of a `spender` for an `owner` is set by\\n * a call to {approve}. `value` is the new allowance.\\n */\\n event Approval(address indexed owner, address indexed spender, uint256 value);\\n}\\n\",\"keccak256\":\"0x027b891937d20ccf213fdb9c31531574256de774bda99d3a70ecef6e1913ed2a\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../IERC20.sol\\\";\\n\\n/**\\n * @dev Interface for the optional metadata functions from the ERC20 standard.\\n *\\n * _Available since v4.1._\\n */\\ninterface IERC20Metadata is IERC20 {\\n /**\\n * @dev Returns the name of the token.\\n */\\n function name() external view returns (string memory);\\n\\n /**\\n * @dev Returns the symbol of the token.\\n */\\n function symbol() external view returns (string memory);\\n\\n /**\\n * @dev Returns the decimals places of the token.\\n */\\n function decimals() external view returns (uint8);\\n}\\n\",\"keccak256\":\"0x83fe24f5c04a56091e50f4a345ff504c8bff658a76d4c43b16878c8f940c53b2\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/math/Math.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Standard math utilities missing in the Solidity language.\\n */\\nlibrary Math {\\n /**\\n * @dev Returns the largest of two numbers.\\n */\\n function max(uint256 a, uint256 b) internal pure returns (uint256) {\\n return a >= b ? a : b;\\n }\\n\\n /**\\n * @dev Returns the smallest of two numbers.\\n */\\n function min(uint256 a, uint256 b) internal pure returns (uint256) {\\n return a < b ? a : b;\\n }\\n\\n /**\\n * @dev Returns the average of two numbers. The result is rounded towards\\n * zero.\\n */\\n function average(uint256 a, uint256 b) internal pure returns (uint256) {\\n // (a + b) / 2 can overflow.\\n return (a & b) + (a ^ b) / 2;\\n }\\n\\n /**\\n * @dev Returns the ceiling of the division of two numbers.\\n *\\n * This differs from standard division with `/` in that it rounds up instead\\n * of rounding down.\\n */\\n function ceilDiv(uint256 a, uint256 b) internal pure returns (uint256) {\\n // (a + b - 1) / b can overflow on addition, so we distribute.\\n return a / b + (a % b == 0 ? 0 : 1);\\n }\\n}\\n\",\"keccak256\":\"0x49ebdac5d515aebb95168564158940b79d7d5d12fbfe59cec546a00d57fee64a\",\"license\":\"MIT\"},\"@uniswap/v3-core/contracts/interfaces/IUniswapV3Pool.sol\":{\"content\":\"// SPDX-License-Identifier: GPL-2.0-or-later\\npragma solidity >=0.5.0;\\n\\nimport './pool/IUniswapV3PoolImmutables.sol';\\nimport './pool/IUniswapV3PoolState.sol';\\nimport './pool/IUniswapV3PoolDerivedState.sol';\\nimport './pool/IUniswapV3PoolActions.sol';\\nimport './pool/IUniswapV3PoolOwnerActions.sol';\\nimport './pool/IUniswapV3PoolEvents.sol';\\n\\n/// @title The interface for a Uniswap V3 Pool\\n/// @notice A Uniswap pool facilitates swapping and automated market making between any two assets that strictly conform\\n/// to the ERC20 specification\\n/// @dev The pool interface is broken up into many smaller pieces\\ninterface IUniswapV3Pool is\\n IUniswapV3PoolImmutables,\\n IUniswapV3PoolState,\\n IUniswapV3PoolDerivedState,\\n IUniswapV3PoolActions,\\n IUniswapV3PoolOwnerActions,\\n IUniswapV3PoolEvents\\n{\\n\\n}\\n\",\"keccak256\":\"0xfe6113d518466cd6652c85b111e01f33eb62157f49ae5ed7d5a3947a2044adb1\",\"license\":\"GPL-2.0-or-later\"},\"@uniswap/v3-core/contracts/interfaces/pool/IUniswapV3PoolActions.sol\":{\"content\":\"// SPDX-License-Identifier: GPL-2.0-or-later\\npragma solidity >=0.5.0;\\n\\n/// @title Permissionless pool actions\\n/// @notice Contains pool methods that can be called by anyone\\ninterface IUniswapV3PoolActions {\\n /// @notice Sets the initial price for the pool\\n /// @dev Price is represented as a sqrt(amountToken1/amountToken0) Q64.96 value\\n /// @param sqrtPriceX96 the initial sqrt price of the pool as a Q64.96\\n function initialize(uint160 sqrtPriceX96) external;\\n\\n /// @notice Adds liquidity for the given recipient/tickLower/tickUpper position\\n /// @dev The caller of this method receives a callback in the form of IUniswapV3MintCallback#uniswapV3MintCallback\\n /// in which they must pay any token0 or token1 owed for the liquidity. The amount of token0/token1 due depends\\n /// on tickLower, tickUpper, the amount of liquidity, and the current price.\\n /// @param recipient The address for which the liquidity will be created\\n /// @param tickLower The lower tick of the position in which to add liquidity\\n /// @param tickUpper The upper tick of the position in which to add liquidity\\n /// @param amount The amount of liquidity to mint\\n /// @param data Any data that should be passed through to the callback\\n /// @return amount0 The amount of token0 that was paid to mint the given amount of liquidity. Matches the value in the callback\\n /// @return amount1 The amount of token1 that was paid to mint the given amount of liquidity. Matches the value in the callback\\n function mint(\\n address recipient,\\n int24 tickLower,\\n int24 tickUpper,\\n uint128 amount,\\n bytes calldata data\\n ) external returns (uint256 amount0, uint256 amount1);\\n\\n /// @notice Collects tokens owed to a position\\n /// @dev Does not recompute fees earned, which must be done either via mint or burn of any amount of liquidity.\\n /// Collect must be called by the position owner. To withdraw only token0 or only token1, amount0Requested or\\n /// amount1Requested may be set to zero. To withdraw all tokens owed, caller may pass any value greater than the\\n /// actual tokens owed, e.g. type(uint128).max. Tokens owed may be from accumulated swap fees or burned liquidity.\\n /// @param recipient The address which should receive the fees collected\\n /// @param tickLower The lower tick of the position for which to collect fees\\n /// @param tickUpper The upper tick of the position for which to collect fees\\n /// @param amount0Requested How much token0 should be withdrawn from the fees owed\\n /// @param amount1Requested How much token1 should be withdrawn from the fees owed\\n /// @return amount0 The amount of fees collected in token0\\n /// @return amount1 The amount of fees collected in token1\\n function collect(\\n address recipient,\\n int24 tickLower,\\n int24 tickUpper,\\n uint128 amount0Requested,\\n uint128 amount1Requested\\n ) external returns (uint128 amount0, uint128 amount1);\\n\\n /// @notice Burn liquidity from the sender and account tokens owed for the liquidity to the position\\n /// @dev Can be used to trigger a recalculation of fees owed to a position by calling with an amount of 0\\n /// @dev Fees must be collected separately via a call to #collect\\n /// @param tickLower The lower tick of the position for which to burn liquidity\\n /// @param tickUpper The upper tick of the position for which to burn liquidity\\n /// @param amount How much liquidity to burn\\n /// @return amount0 The amount of token0 sent to the recipient\\n /// @return amount1 The amount of token1 sent to the recipient\\n function burn(\\n int24 tickLower,\\n int24 tickUpper,\\n uint128 amount\\n ) external returns (uint256 amount0, uint256 amount1);\\n\\n /// @notice Swap token0 for token1, or token1 for token0\\n /// @dev The caller of this method receives a callback in the form of IUniswapV3SwapCallback#uniswapV3SwapCallback\\n /// @param recipient The address to receive the output of the swap\\n /// @param zeroForOne The direction of the swap, true for token0 to token1, false for token1 to token0\\n /// @param amountSpecified The amount of the swap, which implicitly configures the swap as exact input (positive), or exact output (negative)\\n /// @param sqrtPriceLimitX96 The Q64.96 sqrt price limit. If zero for one, the price cannot be less than this\\n /// value after the swap. If one for zero, the price cannot be greater than this value after the swap\\n /// @param data Any data to be passed through to the callback\\n /// @return amount0 The delta of the balance of token0 of the pool, exact when negative, minimum when positive\\n /// @return amount1 The delta of the balance of token1 of the pool, exact when negative, minimum when positive\\n function swap(\\n address recipient,\\n bool zeroForOne,\\n int256 amountSpecified,\\n uint160 sqrtPriceLimitX96,\\n bytes calldata data\\n ) external returns (int256 amount0, int256 amount1);\\n\\n /// @notice Receive token0 and/or token1 and pay it back, plus a fee, in the callback\\n /// @dev The caller of this method receives a callback in the form of IUniswapV3FlashCallback#uniswapV3FlashCallback\\n /// @dev Can be used to donate underlying tokens pro-rata to currently in-range liquidity providers by calling\\n /// with 0 amount{0,1} and sending the donation amount(s) from the callback\\n /// @param recipient The address which will receive the token0 and token1 amounts\\n /// @param amount0 The amount of token0 to send\\n /// @param amount1 The amount of token1 to send\\n /// @param data Any data to be passed through to the callback\\n function flash(\\n address recipient,\\n uint256 amount0,\\n uint256 amount1,\\n bytes calldata data\\n ) external;\\n\\n /// @notice Increase the maximum number of price and liquidity observations that this pool will store\\n /// @dev This method is no-op if the pool already has an observationCardinalityNext greater than or equal to\\n /// the input observationCardinalityNext.\\n /// @param observationCardinalityNext The desired minimum number of observations for the pool to store\\n function increaseObservationCardinalityNext(uint16 observationCardinalityNext) external;\\n}\\n\",\"keccak256\":\"0x9453dd0e7442188667d01d9b65de3f1e14e9511ff3e303179a15f6fc267f7634\",\"license\":\"GPL-2.0-or-later\"},\"@uniswap/v3-core/contracts/interfaces/pool/IUniswapV3PoolDerivedState.sol\":{\"content\":\"// SPDX-License-Identifier: GPL-2.0-or-later\\npragma solidity >=0.5.0;\\n\\n/// @title Pool state that is not stored\\n/// @notice Contains view functions to provide information about the pool that is computed rather than stored on the\\n/// blockchain. The functions here may have variable gas costs.\\ninterface IUniswapV3PoolDerivedState {\\n /// @notice Returns the cumulative tick and liquidity as of each timestamp `secondsAgo` from the current block timestamp\\n /// @dev To get a time weighted average tick or liquidity-in-range, you must call this with two values, one representing\\n /// the beginning of the period and another for the end of the period. E.g., to get the last hour time-weighted average tick,\\n /// you must call it with secondsAgos = [3600, 0].\\n /// @dev The time weighted average tick represents the geometric time weighted average price of the pool, in\\n /// log base sqrt(1.0001) of token1 / token0. The TickMath library can be used to go from a tick value to a ratio.\\n /// @param secondsAgos From how long ago each cumulative tick and liquidity value should be returned\\n /// @return tickCumulatives Cumulative tick values as of each `secondsAgos` from the current block timestamp\\n /// @return secondsPerLiquidityCumulativeX128s Cumulative seconds per liquidity-in-range value as of each `secondsAgos` from the current block\\n /// timestamp\\n function observe(uint32[] calldata secondsAgos)\\n external\\n view\\n returns (int56[] memory tickCumulatives, uint160[] memory secondsPerLiquidityCumulativeX128s);\\n\\n /// @notice Returns a snapshot of the tick cumulative, seconds per liquidity and seconds inside a tick range\\n /// @dev Snapshots must only be compared to other snapshots, taken over a period for which a position existed.\\n /// I.e., snapshots cannot be compared if a position is not held for the entire period between when the first\\n /// snapshot is taken and the second snapshot is taken.\\n /// @param tickLower The lower tick of the range\\n /// @param tickUpper The upper tick of the range\\n /// @return tickCumulativeInside The snapshot of the tick accumulator for the range\\n /// @return secondsPerLiquidityInsideX128 The snapshot of seconds per liquidity for the range\\n /// @return secondsInside The snapshot of seconds per liquidity for the range\\n function snapshotCumulativesInside(int24 tickLower, int24 tickUpper)\\n external\\n view\\n returns (\\n int56 tickCumulativeInside,\\n uint160 secondsPerLiquidityInsideX128,\\n uint32 secondsInside\\n );\\n}\\n\",\"keccak256\":\"0xe603ac5b17ecdee73ba2b27efdf386c257a19c14206e87eee77e2017b742d9e5\",\"license\":\"GPL-2.0-or-later\"},\"@uniswap/v3-core/contracts/interfaces/pool/IUniswapV3PoolEvents.sol\":{\"content\":\"// SPDX-License-Identifier: GPL-2.0-or-later\\npragma solidity >=0.5.0;\\n\\n/// @title Events emitted by a pool\\n/// @notice Contains all events emitted by the pool\\ninterface IUniswapV3PoolEvents {\\n /// @notice Emitted exactly once by a pool when #initialize is first called on the pool\\n /// @dev Mint/Burn/Swap cannot be emitted by the pool before Initialize\\n /// @param sqrtPriceX96 The initial sqrt price of the pool, as a Q64.96\\n /// @param tick The initial tick of the pool, i.e. log base 1.0001 of the starting price of the pool\\n event Initialize(uint160 sqrtPriceX96, int24 tick);\\n\\n /// @notice Emitted when liquidity is minted for a given position\\n /// @param sender The address that minted the liquidity\\n /// @param owner The owner of the position and recipient of any minted liquidity\\n /// @param tickLower The lower tick of the position\\n /// @param tickUpper The upper tick of the position\\n /// @param amount The amount of liquidity minted to the position range\\n /// @param amount0 How much token0 was required for the minted liquidity\\n /// @param amount1 How much token1 was required for the minted liquidity\\n event Mint(\\n address sender,\\n address indexed owner,\\n int24 indexed tickLower,\\n int24 indexed tickUpper,\\n uint128 amount,\\n uint256 amount0,\\n uint256 amount1\\n );\\n\\n /// @notice Emitted when fees are collected by the owner of a position\\n /// @dev Collect events may be emitted with zero amount0 and amount1 when the caller chooses not to collect fees\\n /// @param owner The owner of the position for which fees are collected\\n /// @param tickLower The lower tick of the position\\n /// @param tickUpper The upper tick of the position\\n /// @param amount0 The amount of token0 fees collected\\n /// @param amount1 The amount of token1 fees collected\\n event Collect(\\n address indexed owner,\\n address recipient,\\n int24 indexed tickLower,\\n int24 indexed tickUpper,\\n uint128 amount0,\\n uint128 amount1\\n );\\n\\n /// @notice Emitted when a position's liquidity is removed\\n /// @dev Does not withdraw any fees earned by the liquidity position, which must be withdrawn via #collect\\n /// @param owner The owner of the position for which liquidity is removed\\n /// @param tickLower The lower tick of the position\\n /// @param tickUpper The upper tick of the position\\n /// @param amount The amount of liquidity to remove\\n /// @param amount0 The amount of token0 withdrawn\\n /// @param amount1 The amount of token1 withdrawn\\n event Burn(\\n address indexed owner,\\n int24 indexed tickLower,\\n int24 indexed tickUpper,\\n uint128 amount,\\n uint256 amount0,\\n uint256 amount1\\n );\\n\\n /// @notice Emitted by the pool for any swaps between token0 and token1\\n /// @param sender The address that initiated the swap call, and that received the callback\\n /// @param recipient The address that received the output of the swap\\n /// @param amount0 The delta of the token0 balance of the pool\\n /// @param amount1 The delta of the token1 balance of the pool\\n /// @param sqrtPriceX96 The sqrt(price) of the pool after the swap, as a Q64.96\\n /// @param liquidity The liquidity of the pool after the swap\\n /// @param tick The log base 1.0001 of price of the pool after the swap\\n event Swap(\\n address indexed sender,\\n address indexed recipient,\\n int256 amount0,\\n int256 amount1,\\n uint160 sqrtPriceX96,\\n uint128 liquidity,\\n int24 tick\\n );\\n\\n /// @notice Emitted by the pool for any flashes of token0/token1\\n /// @param sender The address that initiated the swap call, and that received the callback\\n /// @param recipient The address that received the tokens from flash\\n /// @param amount0 The amount of token0 that was flashed\\n /// @param amount1 The amount of token1 that was flashed\\n /// @param paid0 The amount of token0 paid for the flash, which can exceed the amount0 plus the fee\\n /// @param paid1 The amount of token1 paid for the flash, which can exceed the amount1 plus the fee\\n event Flash(\\n address indexed sender,\\n address indexed recipient,\\n uint256 amount0,\\n uint256 amount1,\\n uint256 paid0,\\n uint256 paid1\\n );\\n\\n /// @notice Emitted by the pool for increases to the number of observations that can be stored\\n /// @dev observationCardinalityNext is not the observation cardinality until an observation is written at the index\\n /// just before a mint/swap/burn.\\n /// @param observationCardinalityNextOld The previous value of the next observation cardinality\\n /// @param observationCardinalityNextNew The updated value of the next observation cardinality\\n event IncreaseObservationCardinalityNext(\\n uint16 observationCardinalityNextOld,\\n uint16 observationCardinalityNextNew\\n );\\n\\n /// @notice Emitted when the protocol fee is changed by the pool\\n /// @param feeProtocol0Old The previous value of the token0 protocol fee\\n /// @param feeProtocol1Old The previous value of the token1 protocol fee\\n /// @param feeProtocol0New The updated value of the token0 protocol fee\\n /// @param feeProtocol1New The updated value of the token1 protocol fee\\n event SetFeeProtocol(uint8 feeProtocol0Old, uint8 feeProtocol1Old, uint8 feeProtocol0New, uint8 feeProtocol1New);\\n\\n /// @notice Emitted when the collected protocol fees are withdrawn by the factory owner\\n /// @param sender The address that collects the protocol fees\\n /// @param recipient The address that receives the collected protocol fees\\n /// @param amount0 The amount of token0 protocol fees that is withdrawn\\n /// @param amount0 The amount of token1 protocol fees that is withdrawn\\n event CollectProtocol(address indexed sender, address indexed recipient, uint128 amount0, uint128 amount1);\\n}\\n\",\"keccak256\":\"0x8071514d0fe5d17d6fbd31c191cdfb703031c24e0ece3621d88ab10e871375cd\",\"license\":\"GPL-2.0-or-later\"},\"@uniswap/v3-core/contracts/interfaces/pool/IUniswapV3PoolImmutables.sol\":{\"content\":\"// SPDX-License-Identifier: GPL-2.0-or-later\\npragma solidity >=0.5.0;\\n\\n/// @title Pool state that never changes\\n/// @notice These parameters are fixed for a pool forever, i.e., the methods will always return the same values\\ninterface IUniswapV3PoolImmutables {\\n /// @notice The contract that deployed the pool, which must adhere to the IUniswapV3Factory interface\\n /// @return The contract address\\n function factory() external view returns (address);\\n\\n /// @notice The first of the two tokens of the pool, sorted by address\\n /// @return The token contract address\\n function token0() external view returns (address);\\n\\n /// @notice The second of the two tokens of the pool, sorted by address\\n /// @return The token contract address\\n function token1() external view returns (address);\\n\\n /// @notice The pool's fee in hundredths of a bip, i.e. 1e-6\\n /// @return The fee\\n function fee() external view returns (uint24);\\n\\n /// @notice The pool tick spacing\\n /// @dev Ticks can only be used at multiples of this value, minimum of 1 and always positive\\n /// e.g.: a tickSpacing of 3 means ticks can be initialized every 3rd tick, i.e., ..., -6, -3, 0, 3, 6, ...\\n /// This value is an int24 to avoid casting even though it is always positive.\\n /// @return The tick spacing\\n function tickSpacing() external view returns (int24);\\n\\n /// @notice The maximum amount of position liquidity that can use any tick in the range\\n /// @dev This parameter is enforced per tick to prevent liquidity from overflowing a uint128 at any point, and\\n /// also prevents out-of-range liquidity from being used to prevent adding in-range liquidity to a pool\\n /// @return The max amount of liquidity per tick\\n function maxLiquidityPerTick() external view returns (uint128);\\n}\\n\",\"keccak256\":\"0xf6e5d2cd1139c4c276bdbc8e1d2b256e456c866a91f1b868da265c6d2685c3f7\",\"license\":\"GPL-2.0-or-later\"},\"@uniswap/v3-core/contracts/interfaces/pool/IUniswapV3PoolOwnerActions.sol\":{\"content\":\"// SPDX-License-Identifier: GPL-2.0-or-later\\npragma solidity >=0.5.0;\\n\\n/// @title Permissioned pool actions\\n/// @notice Contains pool methods that may only be called by the factory owner\\ninterface IUniswapV3PoolOwnerActions {\\n /// @notice Set the denominator of the protocol's % share of the fees\\n /// @param feeProtocol0 new protocol fee for token0 of the pool\\n /// @param feeProtocol1 new protocol fee for token1 of the pool\\n function setFeeProtocol(uint8 feeProtocol0, uint8 feeProtocol1) external;\\n\\n /// @notice Collect the protocol fee accrued to the pool\\n /// @param recipient The address to which collected protocol fees should be sent\\n /// @param amount0Requested The maximum amount of token0 to send, can be 0 to collect fees in only token1\\n /// @param amount1Requested The maximum amount of token1 to send, can be 0 to collect fees in only token0\\n /// @return amount0 The protocol fee collected in token0\\n /// @return amount1 The protocol fee collected in token1\\n function collectProtocol(\\n address recipient,\\n uint128 amount0Requested,\\n uint128 amount1Requested\\n ) external returns (uint128 amount0, uint128 amount1);\\n}\\n\",\"keccak256\":\"0x759b78a2918af9e99e246dc3af084f654e48ef32bb4e4cb8a966aa3dcaece235\",\"license\":\"GPL-2.0-or-later\"},\"@uniswap/v3-core/contracts/interfaces/pool/IUniswapV3PoolState.sol\":{\"content\":\"// SPDX-License-Identifier: GPL-2.0-or-later\\npragma solidity >=0.5.0;\\n\\n/// @title Pool state that can change\\n/// @notice These methods compose the pool's state, and can change with any frequency including multiple times\\n/// per transaction\\ninterface IUniswapV3PoolState {\\n /// @notice The 0th storage slot in the pool stores many values, and is exposed as a single method to save gas\\n /// when accessed externally.\\n /// @return sqrtPriceX96 The current price of the pool as a sqrt(token1/token0) Q64.96 value\\n /// tick The current tick of the pool, i.e. according to the last tick transition that was run.\\n /// This value may not always be equal to SqrtTickMath.getTickAtSqrtRatio(sqrtPriceX96) if the price is on a tick\\n /// boundary.\\n /// observationIndex The index of the last oracle observation that was written,\\n /// observationCardinality The current maximum number of observations stored in the pool,\\n /// observationCardinalityNext The next maximum number of observations, to be updated when the observation.\\n /// feeProtocol The protocol fee for both tokens of the pool.\\n /// Encoded as two 4 bit values, where the protocol fee of token1 is shifted 4 bits and the protocol fee of token0\\n /// is the lower 4 bits. Used as the denominator of a fraction of the swap fee, e.g. 4 means 1/4th of the swap fee.\\n /// unlocked Whether the pool is currently locked to reentrancy\\n function slot0()\\n external\\n view\\n returns (\\n uint160 sqrtPriceX96,\\n int24 tick,\\n uint16 observationIndex,\\n uint16 observationCardinality,\\n uint16 observationCardinalityNext,\\n uint8 feeProtocol,\\n bool unlocked\\n );\\n\\n /// @notice The fee growth as a Q128.128 fees of token0 collected per unit of liquidity for the entire life of the pool\\n /// @dev This value can overflow the uint256\\n function feeGrowthGlobal0X128() external view returns (uint256);\\n\\n /// @notice The fee growth as a Q128.128 fees of token1 collected per unit of liquidity for the entire life of the pool\\n /// @dev This value can overflow the uint256\\n function feeGrowthGlobal1X128() external view returns (uint256);\\n\\n /// @notice The amounts of token0 and token1 that are owed to the protocol\\n /// @dev Protocol fees will never exceed uint128 max in either token\\n function protocolFees() external view returns (uint128 token0, uint128 token1);\\n\\n /// @notice The currently in range liquidity available to the pool\\n /// @dev This value has no relationship to the total liquidity across all ticks\\n function liquidity() external view returns (uint128);\\n\\n /// @notice Look up information about a specific tick in the pool\\n /// @param tick The tick to look up\\n /// @return liquidityGross the total amount of position liquidity that uses the pool either as tick lower or\\n /// tick upper,\\n /// liquidityNet how much liquidity changes when the pool price crosses the tick,\\n /// feeGrowthOutside0X128 the fee growth on the other side of the tick from the current tick in token0,\\n /// feeGrowthOutside1X128 the fee growth on the other side of the tick from the current tick in token1,\\n /// tickCumulativeOutside the cumulative tick value on the other side of the tick from the current tick\\n /// secondsPerLiquidityOutsideX128 the seconds spent per liquidity on the other side of the tick from the current tick,\\n /// secondsOutside the seconds spent on the other side of the tick from the current tick,\\n /// initialized Set to true if the tick is initialized, i.e. liquidityGross is greater than 0, otherwise equal to false.\\n /// Outside values can only be used if the tick is initialized, i.e. if liquidityGross is greater than 0.\\n /// In addition, these values are only relative and must be used only in comparison to previous snapshots for\\n /// a specific position.\\n function ticks(int24 tick)\\n external\\n view\\n returns (\\n uint128 liquidityGross,\\n int128 liquidityNet,\\n uint256 feeGrowthOutside0X128,\\n uint256 feeGrowthOutside1X128,\\n int56 tickCumulativeOutside,\\n uint160 secondsPerLiquidityOutsideX128,\\n uint32 secondsOutside,\\n bool initialized\\n );\\n\\n /// @notice Returns 256 packed tick initialized boolean values. See TickBitmap for more information\\n function tickBitmap(int16 wordPosition) external view returns (uint256);\\n\\n /// @notice Returns the information about a position by the position's key\\n /// @param key The position's key is a hash of a preimage composed by the owner, tickLower and tickUpper\\n /// @return _liquidity The amount of liquidity in the position,\\n /// Returns feeGrowthInside0LastX128 fee growth of token0 inside the tick range as of the last mint/burn/poke,\\n /// Returns feeGrowthInside1LastX128 fee growth of token1 inside the tick range as of the last mint/burn/poke,\\n /// Returns tokensOwed0 the computed amount of token0 owed to the position as of the last mint/burn/poke,\\n /// Returns tokensOwed1 the computed amount of token1 owed to the position as of the last mint/burn/poke\\n function positions(bytes32 key)\\n external\\n view\\n returns (\\n uint128 _liquidity,\\n uint256 feeGrowthInside0LastX128,\\n uint256 feeGrowthInside1LastX128,\\n uint128 tokensOwed0,\\n uint128 tokensOwed1\\n );\\n\\n /// @notice Returns data about a specific observation index\\n /// @param index The element of the observations array to fetch\\n /// @dev You most likely want to use #observe() instead of this method to get an observation as of some amount of time\\n /// ago, rather than at a specific index in the array.\\n /// @return blockTimestamp The timestamp of the observation,\\n /// Returns tickCumulative the tick multiplied by seconds elapsed for the life of the pool as of the observation timestamp,\\n /// Returns secondsPerLiquidityCumulativeX128 the seconds per in range liquidity for the life of the pool as of the observation timestamp,\\n /// Returns initialized whether the observation has been initialized and the values are safe to use\\n function observations(uint256 index)\\n external\\n view\\n returns (\\n uint32 blockTimestamp,\\n int56 tickCumulative,\\n uint160 secondsPerLiquidityCumulativeX128,\\n bool initialized\\n );\\n}\\n\",\"keccak256\":\"0x852dc1f5df7dcf7f11e7bb3eed79f0cea72ad4b25f6a9d2c35aafb48925fd49f\",\"license\":\"GPL-2.0-or-later\"},\"solidity/contracts/Keep3rHelper.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\n/*\\n\\nCoded for The Keep3r Network with \\u2665 by\\n\\n\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2557\\u2591\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2557\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2557\\u2588\\u2588\\u2557\\u2003\\u2003\\u2591\\u2588\\u2588\\u2557\\u2591\\u2591\\u2591\\u2591\\u2591\\u2591\\u2591\\u2588\\u2588\\u2557\\u2591\\u2588\\u2588\\u2588\\u2588\\u2588\\u2557\\u2591\\u2588\\u2588\\u2588\\u2557\\u2591\\u2591\\u2588\\u2588\\u2557\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2557\\u2591\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2557\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2557\\u2591\\u2588\\u2588\\u2557\\u2591\\u2591\\u2591\\u2591\\u2591\\u2591\\u2588\\u2588\\u2588\\u2588\\u2588\\u2557\\u2591\\u2588\\u2588\\u2588\\u2557\\u2591\\u2591\\u2588\\u2588\\u2557\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2557\\u2591\\n\\u2588\\u2588\\u2554\\u2550\\u2550\\u2588\\u2588\\u2557\\u2588\\u2588\\u2554\\u2550\\u2550\\u2550\\u2550\\u255d\\u2588\\u2588\\u2554\\u2550\\u2550\\u2550\\u2550\\u255d\\u2588\\u2588\\u2551\\u2003\\u2003\\u2591\\u2588\\u2588\\u2551\\u2591\\u2591\\u2588\\u2588\\u2557\\u2591\\u2591\\u2588\\u2588\\u2551\\u2588\\u2588\\u2554\\u2550\\u2550\\u2588\\u2588\\u2557\\u2588\\u2588\\u2588\\u2588\\u2557\\u2591\\u2588\\u2588\\u2551\\u2588\\u2588\\u2554\\u2550\\u2550\\u2588\\u2588\\u2557\\u2588\\u2588\\u2554\\u2550\\u2550\\u2550\\u2550\\u255d\\u2588\\u2588\\u2554\\u2550\\u2550\\u2588\\u2588\\u2557\\u2588\\u2588\\u2551\\u2591\\u2591\\u2591\\u2591\\u2591\\u2588\\u2588\\u2554\\u2550\\u2550\\u2588\\u2588\\u2557\\u2588\\u2588\\u2588\\u2588\\u2557\\u2591\\u2588\\u2588\\u2551\\u2588\\u2588\\u2554\\u2550\\u2550\\u2588\\u2588\\u2557\\n\\u2588\\u2588\\u2551\\u2591\\u2591\\u2588\\u2588\\u2551\\u2588\\u2588\\u2588\\u2588\\u2588\\u2557\\u2591\\u2591\\u2588\\u2588\\u2588\\u2588\\u2588\\u2557\\u2591\\u2591\\u2588\\u2588\\u2551\\u2003\\u2003\\u2591\\u255a\\u2588\\u2588\\u2557\\u2588\\u2588\\u2588\\u2588\\u2557\\u2588\\u2588\\u2554\\u255d\\u2588\\u2588\\u2551\\u2591\\u2591\\u2588\\u2588\\u2551\\u2588\\u2588\\u2554\\u2588\\u2588\\u2557\\u2588\\u2588\\u2551\\u2588\\u2588\\u2551\\u2591\\u2591\\u2588\\u2588\\u2551\\u2588\\u2588\\u2588\\u2588\\u2588\\u2557\\u2591\\u2591\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2554\\u255d\\u2588\\u2588\\u2551\\u2591\\u2591\\u2591\\u2591\\u2591\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2551\\u2588\\u2588\\u2554\\u2588\\u2588\\u2557\\u2588\\u2588\\u2551\\u2588\\u2588\\u2551\\u2591\\u2591\\u2588\\u2588\\u2551\\n\\u2588\\u2588\\u2551\\u2591\\u2591\\u2588\\u2588\\u2551\\u2588\\u2588\\u2554\\u2550\\u2550\\u255d\\u2591\\u2591\\u2588\\u2588\\u2554\\u2550\\u2550\\u255d\\u2591\\u2591\\u2588\\u2588\\u2551\\u2003\\u2003\\u2591\\u2591\\u2588\\u2588\\u2588\\u2588\\u2554\\u2550\\u2588\\u2588\\u2588\\u2588\\u2551\\u2591\\u2588\\u2588\\u2551\\u2591\\u2591\\u2588\\u2588\\u2551\\u2588\\u2588\\u2551\\u255a\\u2588\\u2588\\u2588\\u2588\\u2551\\u2588\\u2588\\u2551\\u2591\\u2591\\u2588\\u2588\\u2551\\u2588\\u2588\\u2554\\u2550\\u2550\\u255d\\u2591\\u2591\\u2588\\u2588\\u2554\\u2550\\u2550\\u2588\\u2588\\u2557\\u2588\\u2588\\u2551\\u2591\\u2591\\u2591\\u2591\\u2591\\u2588\\u2588\\u2554\\u2550\\u2550\\u2588\\u2588\\u2551\\u2588\\u2588\\u2551\\u255a\\u2588\\u2588\\u2588\\u2588\\u2551\\u2588\\u2588\\u2551\\u2591\\u2591\\u2588\\u2588\\u2551\\n\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2554\\u255d\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2557\\u2588\\u2588\\u2551\\u2591\\u2591\\u2591\\u2591\\u2591\\u2588\\u2588\\u2551\\u2003\\u2003\\u2591\\u2591\\u255a\\u2588\\u2588\\u2554\\u255d\\u2591\\u255a\\u2588\\u2588\\u2554\\u255d\\u2591\\u255a\\u2588\\u2588\\u2588\\u2588\\u2588\\u2554\\u255d\\u2588\\u2588\\u2551\\u2591\\u255a\\u2588\\u2588\\u2588\\u2551\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2554\\u255d\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2557\\u2588\\u2588\\u2551\\u2591\\u2591\\u2588\\u2588\\u2551\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2557\\u2588\\u2588\\u2551\\u2591\\u2591\\u2588\\u2588\\u2551\\u2588\\u2588\\u2551\\u2591\\u255a\\u2588\\u2588\\u2588\\u2551\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2554\\u255d\\n\\u255a\\u2550\\u2550\\u2550\\u2550\\u2550\\u255d\\u2591\\u255a\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u255d\\u255a\\u2550\\u255d\\u2591\\u2591\\u2591\\u2591\\u2591\\u255a\\u2550\\u255d\\u2003\\u2003\\u2591\\u2591\\u2591\\u255a\\u2550\\u255d\\u2591\\u2591\\u2591\\u255a\\u2550\\u255d\\u2591\\u2591\\u2591\\u255a\\u2550\\u2550\\u2550\\u2550\\u255d\\u2591\\u255a\\u2550\\u255d\\u2591\\u2591\\u255a\\u2550\\u2550\\u255d\\u255a\\u2550\\u2550\\u2550\\u2550\\u2550\\u255d\\u2591\\u255a\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u255d\\u255a\\u2550\\u255d\\u2591\\u2591\\u255a\\u2550\\u255d\\u255a\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u255d\\u255a\\u2550\\u255d\\u2591\\u2591\\u255a\\u2550\\u255d\\u255a\\u2550\\u255d\\u2591\\u2591\\u255a\\u2550\\u2550\\u255d\\u255a\\u2550\\u2550\\u2550\\u2550\\u2550\\u255d\\u2591\\n\\nhttps://defi.sucks\\n\\n*/\\n\\npragma solidity >=0.8.7 <0.9.0;\\n\\nimport './libraries/FullMath.sol';\\nimport './libraries/TickMath.sol';\\nimport '../interfaces/IKeep3r.sol';\\nimport '../interfaces/IKeep3rHelper.sol';\\nimport './Keep3rHelperParameters.sol';\\n\\nimport '@openzeppelin/contracts/utils/math/Math.sol';\\nimport '@uniswap/v3-core/contracts/interfaces/IUniswapV3Pool.sol';\\n\\ncontract Keep3rHelper is IKeep3rHelper, Keep3rHelperParameters {\\n constructor(\\n address _kp3r,\\n address _keep3rV2,\\n address _governor,\\n address _kp3rWethPool\\n ) Keep3rHelperParameters(_kp3r, _keep3rV2, _governor, _kp3rWethPool) {}\\n\\n /// @inheritdoc IKeep3rHelper\\n function quote(uint256 _eth) public view override returns (uint256 _amountOut) {\\n uint32[] memory _secondsAgos = new uint32[](2);\\n _secondsAgos[1] = quoteTwapTime;\\n\\n (int56[] memory _tickCumulatives, ) = IUniswapV3Pool(kp3rWethPool.poolAddress).observe(_secondsAgos);\\n int56 _difference = _tickCumulatives[0] - _tickCumulatives[1];\\n _amountOut = getQuoteAtTick(uint128(_eth), kp3rWethPool.isKP3RToken0 ? _difference : -_difference, quoteTwapTime);\\n }\\n\\n /// @inheritdoc IKeep3rHelper\\n function bonds(address _keeper) public view virtual override returns (uint256 _amountBonded) {\\n return IKeep3r(keep3rV2).bonds(_keeper, KP3R);\\n }\\n\\n /// @inheritdoc IKeep3rHelper\\n function getRewardAmountFor(address _keeper, uint256 _gasUsed) public view override returns (uint256 _kp3r) {\\n uint256 _boost = getRewardBoostFor(bonds(_keeper));\\n _kp3r = quote((_gasUsed * _boost) / BOOST_BASE);\\n }\\n\\n /// @inheritdoc IKeep3rHelper\\n function getRewardAmount(uint256 _gasUsed) external view override returns (uint256 _amount) {\\n // solhint-disable-next-line avoid-tx-origin\\n return getRewardAmountFor(tx.origin, _gasUsed);\\n }\\n\\n /// @inheritdoc IKeep3rHelper\\n function getRewardBoostFor(uint256 _bonds) public view override returns (uint256 _rewardBoost) {\\n _bonds = Math.min(_bonds, targetBond);\\n uint256 _cap = minBoost + ((maxBoost - minBoost) * _bonds) / targetBond;\\n _rewardBoost = _cap * _getBasefee();\\n }\\n\\n /// @inheritdoc IKeep3rHelper\\n function getPoolTokens(address _pool) public view override returns (address _token0, address _token1) {\\n return (IUniswapV3Pool(_pool).token0(), IUniswapV3Pool(_pool).token1());\\n }\\n\\n /// @inheritdoc IKeep3rHelper\\n function isKP3RToken0(address _pool) external view virtual override returns (bool _isKP3RToken0) {\\n address _token0;\\n address _token1;\\n (_token0, _token1) = getPoolTokens(_pool);\\n if (_token0 == KP3R) {\\n return true;\\n } else if (_token1 != KP3R) {\\n revert LiquidityPairInvalid();\\n }\\n }\\n\\n /// @inheritdoc IKeep3rHelper\\n function observe(address _pool, uint32[] memory _secondsAgo)\\n external\\n view\\n override\\n returns (\\n int56 _tickCumulative1,\\n int56 _tickCumulative2,\\n bool _success\\n )\\n {\\n try IUniswapV3Pool(_pool).observe(_secondsAgo) returns (int56[] memory _uniswapResponse, uint160[] memory) {\\n _tickCumulative1 = _uniswapResponse[0];\\n if (_uniswapResponse.length > 1) {\\n _tickCumulative2 = _uniswapResponse[1];\\n }\\n _success = true;\\n } catch (bytes memory) {}\\n }\\n\\n /// @inheritdoc IKeep3rHelper\\n function getPaymentParams(uint256 _bonds)\\n external\\n view\\n virtual\\n override\\n returns (\\n uint256 _boost,\\n uint256 _oneEthQuote,\\n uint256 _extra\\n )\\n {\\n _oneEthQuote = quote(1 ether);\\n _boost = getRewardBoostFor(_bonds);\\n _extra = workExtraGas;\\n }\\n\\n /// @inheritdoc IKeep3rHelper\\n function getKP3RsAtTick(\\n uint256 _liquidityAmount,\\n int56 _tickDifference,\\n uint256 _timeInterval\\n ) external pure override returns (uint256 _kp3rAmount) {\\n uint160 sqrtRatioX96 = TickMath.getSqrtRatioAtTick(int24(_tickDifference / int256(_timeInterval)));\\n _kp3rAmount = FullMath.mulDiv(1 << 96, _liquidityAmount, sqrtRatioX96);\\n }\\n\\n /// @inheritdoc IKeep3rHelper\\n function getQuoteAtTick(\\n uint128 _baseAmount,\\n int56 _tickDifference,\\n uint256 _timeInterval\\n ) public pure override returns (uint256 _quoteAmount) {\\n uint160 sqrtRatioX96 = TickMath.getSqrtRatioAtTick(int24(_tickDifference / int256(_timeInterval)));\\n\\n if (sqrtRatioX96 <= type(uint128).max) {\\n uint256 ratioX192 = uint256(sqrtRatioX96) * sqrtRatioX96;\\n _quoteAmount = FullMath.mulDiv(1 << 192, _baseAmount, ratioX192);\\n } else {\\n uint256 ratioX128 = FullMath.mulDiv(sqrtRatioX96, sqrtRatioX96, 1 << 64);\\n _quoteAmount = FullMath.mulDiv(1 << 128, _baseAmount, ratioX128);\\n }\\n }\\n\\n /// @notice Gets the gas basefee cost to calculate keeper rewards\\n /// @dev Keepers are required to pay a priority fee to be included, this function recognizes a minimum priority fee\\n /// @return _baseFee The block's basefee + a minimum priority fee, or a preset minimum gas fee\\n function _getBasefee() internal view virtual returns (uint256 _baseFee) {\\n return Math.max(minBaseFee, block.basefee + minPriorityFee);\\n }\\n}\\n\",\"keccak256\":\"0x442a723bdbd1011e26ef2b12fbca87788ee355221ad809f52e77a69a0b29e8cc\",\"license\":\"MIT\"},\"solidity/contracts/Keep3rHelperParameters.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.7 <0.9.0;\\n\\nimport './libraries/FullMath.sol';\\nimport './libraries/TickMath.sol';\\nimport '../interfaces/IKeep3r.sol';\\nimport '../interfaces/external/IKeep3rV1.sol';\\nimport '../interfaces/IKeep3rHelperParameters.sol';\\nimport './Keep3rHelperParameters.sol';\\n\\nimport '@openzeppelin/contracts/utils/math/Math.sol';\\nimport '@uniswap/v3-core/contracts/interfaces/IUniswapV3Pool.sol';\\nimport '@defi-wonderland/solidity-utils/solidity/interfaces/IBaseErrors.sol';\\nimport '@defi-wonderland/solidity-utils/solidity/contracts/Governable.sol';\\n\\ncontract Keep3rHelperParameters is IKeep3rHelperParameters, IBaseErrors, Governable {\\n /// @inheritdoc IKeep3rHelperParameters\\n address public immutable override KP3R;\\n\\n /// @inheritdoc IKeep3rHelperParameters\\n uint256 public constant override BOOST_BASE = 10_000;\\n\\n /// @inheritdoc IKeep3rHelperParameters\\n uint256 public override minBoost = 11_000;\\n\\n /// @inheritdoc IKeep3rHelperParameters\\n uint256 public override maxBoost = 12_000;\\n\\n /// @inheritdoc IKeep3rHelperParameters\\n uint256 public override targetBond = 200 ether;\\n\\n /// @inheritdoc IKeep3rHelperParameters\\n uint256 public override workExtraGas = 34_000;\\n\\n /// @inheritdoc IKeep3rHelperParameters\\n uint32 public override quoteTwapTime = 10 minutes;\\n\\n /// @inheritdoc IKeep3rHelperParameters\\n uint256 public override minBaseFee = 15e9;\\n\\n /// @inheritdoc IKeep3rHelperParameters\\n uint256 public override minPriorityFee = 2e9;\\n\\n /// @inheritdoc IKeep3rHelperParameters\\n address public override keep3rV2;\\n\\n /// @inheritdoc IKeep3rHelperParameters\\n IKeep3rHelperParameters.Kp3rWethOraclePool public override kp3rWethPool;\\n\\n constructor(\\n address _kp3r,\\n address _keep3rV2,\\n address _governor,\\n address _kp3rWethPool\\n ) Governable(_governor) {\\n KP3R = _kp3r;\\n keep3rV2 = _keep3rV2;\\n\\n // Immutable variables [KP3R] cannot be read during contract creation time [_setKp3rWethPool]\\n bool _isKP3RToken0 = _validateOraclePool(_kp3rWethPool, KP3R);\\n kp3rWethPool = Kp3rWethOraclePool(_kp3rWethPool, _isKP3RToken0);\\n emit Kp3rWethPoolChange(_kp3rWethPool, _isKP3RToken0);\\n }\\n\\n /// @inheritdoc IKeep3rHelperParameters\\n function setKp3rWethPool(address _poolAddress) external override onlyGovernor {\\n if (_poolAddress == address(0)) revert ZeroAddress();\\n _setKp3rWethPool(_poolAddress);\\n }\\n\\n /// @inheritdoc IKeep3rHelperParameters\\n function setMinBoost(uint256 _minBoost) external override onlyGovernor {\\n minBoost = _minBoost;\\n emit MinBoostChange(minBoost);\\n }\\n\\n /// @inheritdoc IKeep3rHelperParameters\\n function setMaxBoost(uint256 _maxBoost) external override onlyGovernor {\\n maxBoost = _maxBoost;\\n emit MaxBoostChange(maxBoost);\\n }\\n\\n /// @inheritdoc IKeep3rHelperParameters\\n function setTargetBond(uint256 _targetBond) external override onlyGovernor {\\n targetBond = _targetBond;\\n emit TargetBondChange(targetBond);\\n }\\n\\n /// @inheritdoc IKeep3rHelperParameters\\n function setKeep3rV2(address _keep3rV2) external override onlyGovernor {\\n if (_keep3rV2 == address(0)) revert ZeroAddress();\\n keep3rV2 = _keep3rV2;\\n emit Keep3rV2Change(keep3rV2);\\n }\\n\\n /// @inheritdoc IKeep3rHelperParameters\\n function setWorkExtraGas(uint256 _workExtraGas) external override onlyGovernor {\\n workExtraGas = _workExtraGas;\\n emit WorkExtraGasChange(workExtraGas);\\n }\\n\\n /// @inheritdoc IKeep3rHelperParameters\\n function setQuoteTwapTime(uint32 _quoteTwapTime) external override onlyGovernor {\\n _setQuoteTwapTime(_quoteTwapTime);\\n }\\n\\n function _setQuoteTwapTime(uint32 _quoteTwapTime) internal {\\n quoteTwapTime = _quoteTwapTime;\\n emit QuoteTwapTimeChange(quoteTwapTime);\\n }\\n\\n /// @inheritdoc IKeep3rHelperParameters\\n function setMinBaseFee(uint256 _minBaseFee) external override onlyGovernor {\\n minBaseFee = _minBaseFee;\\n emit MinBaseFeeChange(minBaseFee);\\n }\\n\\n /// @inheritdoc IKeep3rHelperParameters\\n function setMinPriorityFee(uint256 _minPriorityFee) external override onlyGovernor {\\n minPriorityFee = _minPriorityFee;\\n emit MinPriorityFeeChange(minPriorityFee);\\n }\\n\\n /// @notice Sets KP3R-WETH pool\\n /// @param _poolAddress The address of the KP3R-WETH pool\\n function _setKp3rWethPool(address _poolAddress) internal {\\n bool _isKP3RToken0 = _validateOraclePool(_poolAddress, KP3R);\\n kp3rWethPool = Kp3rWethOraclePool(_poolAddress, _isKP3RToken0);\\n emit Kp3rWethPoolChange(_poolAddress, _isKP3RToken0);\\n }\\n\\n function _validateOraclePool(address _poolAddress, address _token) internal view virtual returns (bool _isTKNToken0) {\\n _isTKNToken0 = IUniswapV3Pool(_poolAddress).token0() == _token;\\n if (!_isTKNToken0 && IUniswapV3Pool(_poolAddress).token1() != _token) revert InvalidOraclePool();\\n }\\n}\\n\",\"keccak256\":\"0x327e0b63bca4528c66038e28bf43af552e763a492944e4ce043fe07dc52f6ac8\",\"license\":\"MIT\"},\"solidity/contracts/libraries/FullMath.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4 <0.9.0;\\n\\n/// @title Contains 512-bit math functions\\n/// @notice Facilitates multiplication and division that can have overflow of an intermediate value without any loss of precision\\n/// @dev Handles \\\"phantom overflow\\\" i.e., allows multiplication and division where an intermediate value overflows 256 bits\\nlibrary FullMath {\\n /// @notice Calculates floor(a\\u00d7b\\u00f7denominator) with full precision. Throws if result overflows a uint256 or denominator == 0\\n /// @param a The multiplicand\\n /// @param b The multiplier\\n /// @param denominator The divisor\\n /// @return result The 256-bit result\\n /// @dev Credit to Remco Bloemen under MIT license https://xn--2-umb.com/21/muldiv\\n function mulDiv(\\n uint256 a,\\n uint256 b,\\n uint256 denominator\\n ) internal pure returns (uint256 result) {\\n unchecked {\\n // 512-bit multiply [prod1 prod0] = a * b\\n // Compute the product mod 2**256 and mod 2**256 - 1\\n // then use the Chinese Remainder Theorem to reconstruct\\n // the 512 bit result. The result is stored in two 256\\n // variables such that product = prod1 * 2**256 + prod0\\n uint256 prod0; // Least significant 256 bits of the product\\n uint256 prod1; // Most significant 256 bits of the product\\n assembly {\\n let mm := mulmod(a, b, not(0))\\n prod0 := mul(a, b)\\n prod1 := sub(sub(mm, prod0), lt(mm, prod0))\\n }\\n\\n // Handle non-overflow cases, 256 by 256 division\\n if (prod1 == 0) {\\n require(denominator > 0);\\n assembly {\\n result := div(prod0, denominator)\\n }\\n return result;\\n }\\n\\n // Make sure the result is less than 2**256.\\n // Also prevents denominator == 0\\n require(denominator > prod1);\\n\\n ///////////////////////////////////////////////\\n // 512 by 256 division.\\n ///////////////////////////////////////////////\\n\\n // Make division exact by subtracting the remainder from [prod1 prod0]\\n // Compute remainder using mulmod\\n uint256 remainder;\\n assembly {\\n remainder := mulmod(a, b, denominator)\\n }\\n // Subtract 256 bit number from 512 bit number\\n assembly {\\n prod1 := sub(prod1, gt(remainder, prod0))\\n prod0 := sub(prod0, remainder)\\n }\\n\\n // Factor powers of two out of denominator\\n // Compute largest power of two divisor of denominator.\\n // Always >= 1.\\n uint256 twos = (~denominator + 1) & denominator;\\n // Divide denominator by power of two\\n assembly {\\n denominator := div(denominator, twos)\\n }\\n\\n // Divide [prod1 prod0] by the factors of two\\n assembly {\\n prod0 := div(prod0, twos)\\n }\\n // Shift in bits from prod1 into prod0. For this we need\\n // to flip `twos` such that it is 2**256 / twos.\\n // If twos is zero, then it becomes one\\n assembly {\\n twos := add(div(sub(0, twos), twos), 1)\\n }\\n prod0 |= prod1 * twos;\\n\\n // Invert denominator mod 2**256\\n // Now that denominator is an odd number, it has an inverse\\n // modulo 2**256 such that denominator * inv = 1 mod 2**256.\\n // Compute the inverse by starting with a seed that is correct\\n // correct for four bits. That is, denominator * inv = 1 mod 2**4\\n uint256 inv = (3 * denominator) ^ 2;\\n // Now use Newton-Raphson iteration to improve the precision.\\n // Thanks to Hensel's lifting lemma, this also works in modular\\n // arithmetic, doubling the correct bits in each step.\\n inv *= 2 - denominator * inv; // inverse mod 2**8\\n inv *= 2 - denominator * inv; // inverse mod 2**16\\n inv *= 2 - denominator * inv; // inverse mod 2**32\\n inv *= 2 - denominator * inv; // inverse mod 2**64\\n inv *= 2 - denominator * inv; // inverse mod 2**128\\n inv *= 2 - denominator * inv; // inverse mod 2**256\\n\\n // Because the division is now exact we can divide by multiplying\\n // with the modular inverse of denominator. This will give us the\\n // correct result modulo 2**256. Since the precoditions guarantee\\n // that the outcome is less than 2**256, this is the final result.\\n // We don't need to compute the high bits of the result and prod1\\n // is no longer required.\\n result = prod0 * inv;\\n return result;\\n }\\n }\\n\\n /// @notice Calculates ceil(a\\u00d7b\\u00f7denominator) with full precision. Throws if result overflows a uint256 or denominator == 0\\n /// @param a The multiplicand\\n /// @param b The multiplier\\n /// @param denominator The divisor\\n /// @return result The 256-bit result\\n function mulDivRoundingUp(\\n uint256 a,\\n uint256 b,\\n uint256 denominator\\n ) internal pure returns (uint256 result) {\\n unchecked {\\n result = mulDiv(a, b, denominator);\\n if (mulmod(a, b, denominator) > 0) {\\n require(result < type(uint256).max);\\n result++;\\n }\\n }\\n }\\n}\\n\",\"keccak256\":\"0xe1c595da02adf8ba2ae74ac579b9b3c966d1ecb2a99c25081a62ee8550f26569\",\"license\":\"MIT\"},\"solidity/contracts/libraries/TickMath.sol\":{\"content\":\"// SPDX-License-Identifier: GPL-2.0-or-later\\npragma solidity >=0.5.0;\\n\\n// solhint-disable\\n\\n/// @title Math library for computing sqrt prices from ticks and vice versa\\n/// @notice Computes sqrt price for ticks of size 1.0001, i.e. sqrt(1.0001^tick) as fixed point Q64.96 numbers. Supports\\n/// prices between 2**-128 and 2**128\\nlibrary TickMath {\\n /// @dev The minimum tick that may be passed to #getSqrtRatioAtTick computed from log base 1.0001 of 2**-128\\n int24 internal constant MIN_TICK = -887272;\\n /// @dev The maximum tick that may be passed to #getSqrtRatioAtTick computed from log base 1.0001 of 2**128\\n int24 internal constant MAX_TICK = -MIN_TICK;\\n\\n /// @dev The minimum value that can be returned from #getSqrtRatioAtTick. Equivalent to getSqrtRatioAtTick(MIN_TICK)\\n uint160 internal constant MIN_SQRT_RATIO = 4295128739;\\n /// @dev The maximum value that can be returned from #getSqrtRatioAtTick. Equivalent to getSqrtRatioAtTick(MAX_TICK)\\n uint160 internal constant MAX_SQRT_RATIO = 1461446703485210103287273052203988822378723970342;\\n\\n /// @notice Calculates sqrt(1.0001^tick) * 2^96\\n /// @dev Throws if |tick| > max tick\\n /// @param tick The input tick for the above formula\\n /// @return sqrtPriceX96 A Fixed point Q64.96 number representing the sqrt of the ratio of the two assets (token1/token0)\\n /// at the given tick\\n function getSqrtRatioAtTick(int24 tick) internal pure returns (uint160 sqrtPriceX96) {\\n uint256 absTick = tick < 0 ? uint256(-int256(tick)) : uint256(int256(tick));\\n require(absTick <= uint256(int256(MAX_TICK)), 'T');\\n\\n uint256 ratio = absTick & 0x1 != 0 ? 0xfffcb933bd6fad37aa2d162d1a594001 : 0x100000000000000000000000000000000;\\n if (absTick & 0x2 != 0) ratio = (ratio * 0xfff97272373d413259a46990580e213a) >> 128;\\n if (absTick & 0x4 != 0) ratio = (ratio * 0xfff2e50f5f656932ef12357cf3c7fdcc) >> 128;\\n if (absTick & 0x8 != 0) ratio = (ratio * 0xffe5caca7e10e4e61c3624eaa0941cd0) >> 128;\\n if (absTick & 0x10 != 0) ratio = (ratio * 0xffcb9843d60f6159c9db58835c926644) >> 128;\\n if (absTick & 0x20 != 0) ratio = (ratio * 0xff973b41fa98c081472e6896dfb254c0) >> 128;\\n if (absTick & 0x40 != 0) ratio = (ratio * 0xff2ea16466c96a3843ec78b326b52861) >> 128;\\n if (absTick & 0x80 != 0) ratio = (ratio * 0xfe5dee046a99a2a811c461f1969c3053) >> 128;\\n if (absTick & 0x100 != 0) ratio = (ratio * 0xfcbe86c7900a88aedcffc83b479aa3a4) >> 128;\\n if (absTick & 0x200 != 0) ratio = (ratio * 0xf987a7253ac413176f2b074cf7815e54) >> 128;\\n if (absTick & 0x400 != 0) ratio = (ratio * 0xf3392b0822b70005940c7a398e4b70f3) >> 128;\\n if (absTick & 0x800 != 0) ratio = (ratio * 0xe7159475a2c29b7443b29c7fa6e889d9) >> 128;\\n if (absTick & 0x1000 != 0) ratio = (ratio * 0xd097f3bdfd2022b8845ad8f792aa5825) >> 128;\\n if (absTick & 0x2000 != 0) ratio = (ratio * 0xa9f746462d870fdf8a65dc1f90e061e5) >> 128;\\n if (absTick & 0x4000 != 0) ratio = (ratio * 0x70d869a156d2a1b890bb3df62baf32f7) >> 128;\\n if (absTick & 0x8000 != 0) ratio = (ratio * 0x31be135f97d08fd981231505542fcfa6) >> 128;\\n if (absTick & 0x10000 != 0) ratio = (ratio * 0x9aa508b5b7a84e1c677de54f3e99bc9) >> 128;\\n if (absTick & 0x20000 != 0) ratio = (ratio * 0x5d6af8dedb81196699c329225ee604) >> 128;\\n if (absTick & 0x40000 != 0) ratio = (ratio * 0x2216e584f5fa1ea926041bedfe98) >> 128;\\n if (absTick & 0x80000 != 0) ratio = (ratio * 0x48a170391f7dc42444e8fa2) >> 128;\\n\\n if (tick > 0) ratio = type(uint256).max / ratio;\\n\\n // Divides by 1<<32 rounding up to go from a Q128.128 to a Q128.96.\\n // we then downcast because we know the result always fits within 160 bits due to our tick input constraint\\n // we round up in the division so getTickAtSqrtRatio of the output price is always consistent\\n sqrtPriceX96 = uint160((ratio >> 32) + (ratio % (1 << 32) == 0 ? 0 : 1));\\n }\\n\\n /// @notice Calculates the greatest tick value such that getRatioAtTick(tick) <= ratio\\n /// @dev Throws in case sqrtPriceX96 < MIN_SQRT_RATIO, as MIN_SQRT_RATIO is the lowest value getRatioAtTick may ever return.\\n /// @param sqrtPriceX96 The sqrt ratio for which to compute the tick as a Q64.96\\n /// @return tick The greatest tick for which the ratio is less than or equal to the input ratio\\n function getTickAtSqrtRatio(uint160 sqrtPriceX96) internal pure returns (int24 tick) {\\n // Second inequality must be < because the price can never reach the price at the max tick\\n require(sqrtPriceX96 >= MIN_SQRT_RATIO && sqrtPriceX96 < MAX_SQRT_RATIO, 'R');\\n uint256 ratio = uint256(sqrtPriceX96) << 32;\\n\\n uint256 r = ratio;\\n uint256 msb = 0;\\n\\n assembly {\\n let f := shl(7, gt(r, 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF))\\n msb := or(msb, f)\\n r := shr(f, r)\\n }\\n assembly {\\n let f := shl(6, gt(r, 0xFFFFFFFFFFFFFFFF))\\n msb := or(msb, f)\\n r := shr(f, r)\\n }\\n assembly {\\n let f := shl(5, gt(r, 0xFFFFFFFF))\\n msb := or(msb, f)\\n r := shr(f, r)\\n }\\n assembly {\\n let f := shl(4, gt(r, 0xFFFF))\\n msb := or(msb, f)\\n r := shr(f, r)\\n }\\n assembly {\\n let f := shl(3, gt(r, 0xFF))\\n msb := or(msb, f)\\n r := shr(f, r)\\n }\\n assembly {\\n let f := shl(2, gt(r, 0xF))\\n msb := or(msb, f)\\n r := shr(f, r)\\n }\\n assembly {\\n let f := shl(1, gt(r, 0x3))\\n msb := or(msb, f)\\n r := shr(f, r)\\n }\\n assembly {\\n let f := gt(r, 0x1)\\n msb := or(msb, f)\\n }\\n\\n if (msb >= 128) r = ratio >> (msb - 127);\\n else r = ratio << (127 - msb);\\n\\n int256 log_2 = (int256(msb) - 128) << 64;\\n\\n assembly {\\n r := shr(127, mul(r, r))\\n let f := shr(128, r)\\n log_2 := or(log_2, shl(63, f))\\n r := shr(f, r)\\n }\\n assembly {\\n r := shr(127, mul(r, r))\\n let f := shr(128, r)\\n log_2 := or(log_2, shl(62, f))\\n r := shr(f, r)\\n }\\n assembly {\\n r := shr(127, mul(r, r))\\n let f := shr(128, r)\\n log_2 := or(log_2, shl(61, f))\\n r := shr(f, r)\\n }\\n assembly {\\n r := shr(127, mul(r, r))\\n let f := shr(128, r)\\n log_2 := or(log_2, shl(60, f))\\n r := shr(f, r)\\n }\\n assembly {\\n r := shr(127, mul(r, r))\\n let f := shr(128, r)\\n log_2 := or(log_2, shl(59, f))\\n r := shr(f, r)\\n }\\n assembly {\\n r := shr(127, mul(r, r))\\n let f := shr(128, r)\\n log_2 := or(log_2, shl(58, f))\\n r := shr(f, r)\\n }\\n assembly {\\n r := shr(127, mul(r, r))\\n let f := shr(128, r)\\n log_2 := or(log_2, shl(57, f))\\n r := shr(f, r)\\n }\\n assembly {\\n r := shr(127, mul(r, r))\\n let f := shr(128, r)\\n log_2 := or(log_2, shl(56, f))\\n r := shr(f, r)\\n }\\n assembly {\\n r := shr(127, mul(r, r))\\n let f := shr(128, r)\\n log_2 := or(log_2, shl(55, f))\\n r := shr(f, r)\\n }\\n assembly {\\n r := shr(127, mul(r, r))\\n let f := shr(128, r)\\n log_2 := or(log_2, shl(54, f))\\n r := shr(f, r)\\n }\\n assembly {\\n r := shr(127, mul(r, r))\\n let f := shr(128, r)\\n log_2 := or(log_2, shl(53, f))\\n r := shr(f, r)\\n }\\n assembly {\\n r := shr(127, mul(r, r))\\n let f := shr(128, r)\\n log_2 := or(log_2, shl(52, f))\\n r := shr(f, r)\\n }\\n assembly {\\n r := shr(127, mul(r, r))\\n let f := shr(128, r)\\n log_2 := or(log_2, shl(51, f))\\n r := shr(f, r)\\n }\\n assembly {\\n r := shr(127, mul(r, r))\\n let f := shr(128, r)\\n log_2 := or(log_2, shl(50, f))\\n }\\n\\n int256 log_sqrt10001 = log_2 * 255738958999603826347141; // 128.128 number\\n\\n int24 tickLow = int24((log_sqrt10001 - 3402992956809132418596140100660247210) >> 128);\\n int24 tickHi = int24((log_sqrt10001 + 291339464771989622907027621153398088495) >> 128);\\n\\n tick = tickLow == tickHi ? tickLow : getSqrtRatioAtTick(tickHi) <= sqrtPriceX96 ? tickHi : tickLow;\\n }\\n}\\n\",\"keccak256\":\"0x11b965ba576ff91b4a6e9533c0f334f2b7b6024ee1c54e36d21799de5580899d\",\"license\":\"GPL-2.0-or-later\"},\"solidity/for-test/testnet/Keep3rHelperForTestnet.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4 <0.9.0;\\n\\nimport '../../contracts/Keep3rHelper.sol';\\n\\ncontract Keep3rHelperForTestnet is Keep3rHelper {\\n constructor(\\n address _kp3r,\\n address _keep3rV2,\\n address _governor,\\n address _kp3rWethPool\\n ) Keep3rHelper(_kp3r, _keep3rV2, _governor, _kp3rWethPool) {}\\n\\n function _getBasefee() internal pure override returns (uint256) {\\n return 1;\\n }\\n}\\n\",\"keccak256\":\"0xe189d08892042c925f5e78904ec99fa99a541dd83237821c6d106f3f1cda6776\",\"license\":\"MIT\"},\"solidity/interfaces/IKeep3r.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4 <0.9.0;\\n\\nimport './peripherals/IKeep3rJobs.sol';\\nimport './peripherals/IKeep3rKeepers.sol';\\nimport './peripherals/IKeep3rParameters.sol';\\n\\n// solhint-disable-next-line no-empty-blocks\\n\\n/// @title Keep3rV2 contract\\n/// @notice This contract inherits all the functionality of Keep3rV2\\ninterface IKeep3r is IKeep3rJobs, IKeep3rKeepers, IKeep3rParameters {\\n\\n}\\n\",\"keccak256\":\"0x273a39984c1475c60182e636bb91a1b89ec98646a036cac6a87067869b3adeb9\",\"license\":\"MIT\"},\"solidity/interfaces/IKeep3rHelper.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4 <0.9.0;\\n\\nimport './IKeep3rHelperParameters.sol';\\n\\n/// @title Keep3rHelper contract\\n/// @notice Contains all the helper functions used throughout the different files.\\ninterface IKeep3rHelper is IKeep3rHelperParameters {\\n // Errors\\n\\n /// @notice Throws when none of the tokens in the liquidity pair is KP3R\\n error LiquidityPairInvalid();\\n\\n // Methods\\n // solhint-enable func-name-mixedcase\\n\\n /// @notice Calculates the amount of KP3R that corresponds to the ETH passed into the function\\n /// @dev This function allows us to calculate how much KP3R we should pay to a keeper for things expressed in ETH, like gas\\n /// @param _eth The amount of ETH\\n /// @return _amountOut The amount of KP3R\\n function quote(uint256 _eth) external view returns (uint256 _amountOut);\\n\\n /// @notice Returns the amount of KP3R the keeper has bonded\\n /// @param _keeper The address of the keeper to check\\n /// @return _amountBonded The amount of KP3R the keeper has bonded\\n function bonds(address _keeper) external view returns (uint256 _amountBonded);\\n\\n /// @notice Calculates the reward (in KP3R) that corresponds to a keeper for using gas\\n /// @param _keeper The address of the keeper to check\\n /// @param _gasUsed The amount of gas used that will be rewarded\\n /// @return _kp3r The amount of KP3R that should be awarded to the keeper\\n function getRewardAmountFor(address _keeper, uint256 _gasUsed) external view returns (uint256 _kp3r);\\n\\n /// @notice Calculates the boost in the reward given to a keeper based on the amount of KP3R that keeper has bonded\\n /// @dev If the keeper has no bonds, boost should be +10% of gas cost, if keeper has max bonds, +20%\\n /// @param _bonds The amount of KP3R tokens bonded by the keeper\\n /// @return _rewardBoost The reward boost that corresponds to the keeper\\n function getRewardBoostFor(uint256 _bonds) external view returns (uint256 _rewardBoost);\\n\\n /// @notice Calculates the reward (in KP3R) that corresponds to tx.origin for using gas\\n /// @param _gasUsed The amount of gas used that will be rewarded\\n /// @return _amount The amount of KP3R that should be awarded to tx.origin\\n function getRewardAmount(uint256 _gasUsed) external view returns (uint256 _amount);\\n\\n /// @notice Given a pool address, returns the underlying tokens of the pair\\n /// @param _pool Address of the correspondant pool\\n /// @return _token0 Address of the first token of the pair\\n /// @return _token1 Address of the second token of the pair\\n function getPoolTokens(address _pool) external view returns (address _token0, address _token1);\\n\\n /// @notice Defines the order of the tokens in the pair for twap calculations\\n /// @param _pool Address of the correspondant pool\\n /// @return _isKP3RToken0 Boolean indicating the order of the tokens in the pair\\n function isKP3RToken0(address _pool) external view returns (bool _isKP3RToken0);\\n\\n /// @notice Given an array of secondsAgo, returns UniswapV3 pool cumulatives at that moment\\n /// @param _pool Address of the pool to observe\\n /// @param _secondsAgo Array with time references to observe\\n /// @return _tickCumulative1 Cumulative sum of ticks until first time reference\\n /// @return _tickCumulative2 Cumulative sum of ticks until second time reference\\n /// @return _success Boolean indicating if the observe call was succesfull\\n function observe(address _pool, uint32[] memory _secondsAgo)\\n external\\n view\\n returns (\\n int56 _tickCumulative1,\\n int56 _tickCumulative2,\\n bool _success\\n );\\n\\n /// @notice Get multiplier, quote, and extra, in order to calculate keeper payment\\n /// @param _bonds Amount of bonded KP3R owned by the keeper\\n /// @return _boost Multiplier per gas unit. Takes into account the base fee and the amount of bonded KP3R\\n /// @return _oneEthQuote Amount of KP3R tokens equivalent to 1 ETH\\n /// @return _extra Amount of extra gas that should be added to the gas spent\\n function getPaymentParams(uint256 _bonds)\\n external\\n view\\n returns (\\n uint256 _boost,\\n uint256 _oneEthQuote,\\n uint256 _extra\\n );\\n\\n /// @notice Given a tick and a liquidity amount, calculates the underlying KP3R tokens\\n /// @param _liquidityAmount Amount of liquidity to be converted\\n /// @param _tickDifference Tick value used to calculate the quote\\n /// @param _timeInterval Time value used to calculate the quote\\n /// @return _kp3rAmount Amount of KP3R tokens underlying on the given liquidity\\n function getKP3RsAtTick(\\n uint256 _liquidityAmount,\\n int56 _tickDifference,\\n uint256 _timeInterval\\n ) external pure returns (uint256 _kp3rAmount);\\n\\n /// @notice Given a tick and a token amount, calculates the output in correspondant token\\n /// @param _baseAmount Amount of token to be converted\\n /// @param _tickDifference Tick value used to calculate the quote\\n /// @param _timeInterval Time value used to calculate the quote\\n /// @return _quoteAmount Amount of credits deserved for the baseAmount at the tick value\\n function getQuoteAtTick(\\n uint128 _baseAmount,\\n int56 _tickDifference,\\n uint256 _timeInterval\\n ) external pure returns (uint256 _quoteAmount);\\n}\\n\",\"keccak256\":\"0x67817dc98fde9b3a917e25bc16fe60a91772dd5a77e0ce22a208b66b29d3ad8e\",\"license\":\"MIT\"},\"solidity/interfaces/IKeep3rHelperParameters.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4 <0.9.0;\\n\\n/// @title Keep3rHelperParameters contract\\n/// @notice Contains all the helper functions used throughout the different files.\\ninterface IKeep3rHelperParameters {\\n // Structs\\n\\n /// @dev KP3R-WETH Pool address and isKP3RToken0\\n /// @dev Created in order to save gas by avoiding calls to pool's token0 method\\n struct Kp3rWethOraclePool {\\n address poolAddress;\\n bool isKP3RToken0;\\n }\\n\\n // Errors\\n\\n /// @notice Throws when pool does not have KP3R as token0 nor token1\\n error InvalidOraclePool();\\n\\n // Events\\n\\n /// @notice Emitted when the kp3r weth pool is changed\\n /// @param _address Address of the new kp3r weth pool\\n /// @param _isKP3RToken0 True if calling the token0 method of the pool returns the KP3R token address\\n event Kp3rWethPoolChange(address _address, bool _isKP3RToken0);\\n\\n /// @notice Emitted when the minimum boost multiplier is changed\\n /// @param _minBoost The minimum boost multiplier\\n event MinBoostChange(uint256 _minBoost);\\n\\n /// @notice Emitted when the maximum boost multiplier is changed\\n /// @param _maxBoost The maximum boost multiplier\\n event MaxBoostChange(uint256 _maxBoost);\\n\\n /// @notice Emitted when the target bond amount is changed\\n /// @param _targetBond The target bond amount\\n event TargetBondChange(uint256 _targetBond);\\n\\n /// @notice Emitted when the Keep3r V2 address is changed\\n /// @param _keep3rV2 The address of Keep3r V2\\n event Keep3rV2Change(address _keep3rV2);\\n\\n /// @notice Emitted when the work extra gas amount is changed\\n /// @param _workExtraGas The work extra gas\\n event WorkExtraGasChange(uint256 _workExtraGas);\\n\\n /// @notice Emitted when the quote twap time is changed\\n /// @param _quoteTwapTime The twap time for quoting\\n event QuoteTwapTimeChange(uint32 _quoteTwapTime);\\n\\n /// @notice Emitted when minimum rewarded gas fee is changed\\n /// @param _minBaseFee The minimum rewarded gas fee\\n event MinBaseFeeChange(uint256 _minBaseFee);\\n\\n /// @notice Emitted when minimum rewarded priority fee is changed\\n /// @param _minPriorityFee The minimum expected fee that the keeper should pay\\n event MinPriorityFeeChange(uint256 _minPriorityFee);\\n\\n // Variables\\n\\n /// @notice Address of KP3R token\\n /// @return _kp3r Address of KP3R token\\n // solhint-disable func-name-mixedcase\\n function KP3R() external view returns (address _kp3r);\\n\\n /// @notice The boost base used to calculate the boost rewards for the keeper\\n /// @return _base The boost base number\\n function BOOST_BASE() external view returns (uint256 _base);\\n\\n /// @notice KP3R-WETH pool that is being used as oracle\\n /// @return poolAddress Address of the pool\\n /// @return isKP3RToken0 True if calling the token0 method of the pool returns the KP3R token address\\n function kp3rWethPool() external view returns (address poolAddress, bool isKP3RToken0);\\n\\n /// @notice The minimum multiplier used to calculate the amount of gas paid to the Keeper for the gas used to perform a job\\n /// For example: if the quoted gas used is 1000, then the minimum amount to be paid will be 1000 * minBoost / BOOST_BASE\\n /// @return _multiplier The minimum boost multiplier\\n function minBoost() external view returns (uint256 _multiplier);\\n\\n /// @notice The maximum multiplier used to calculate the amount of gas paid to the Keeper for the gas used to perform a job\\n /// For example: if the quoted gas used is 1000, then the maximum amount to be paid will be 1000 * maxBoost / BOOST_BASE\\n /// @return _multiplier The maximum boost multiplier\\n function maxBoost() external view returns (uint256 _multiplier);\\n\\n /// @notice The targeted amount of bonded KP3Rs to max-up reward multiplier\\n /// For example: if the amount of KP3R the keeper has bonded is targetBond or more, then the keeper will get\\n /// the maximum boost possible in his rewards, if it's less, the reward boost will be proportional\\n /// @return _target The amount of KP3R that comforms the targetBond\\n function targetBond() external view returns (uint256 _target);\\n\\n /// @notice The amount of unaccounted gas that is going to be added to keeper payments\\n /// @return _workExtraGas The work unaccounted gas amount\\n function workExtraGas() external view returns (uint256 _workExtraGas);\\n\\n /// @notice The twap time for quoting\\n /// @return _quoteTwapTime The twap time\\n function quoteTwapTime() external view returns (uint32 _quoteTwapTime);\\n\\n /// @notice The minimum base fee that is used to calculate keeper rewards\\n /// @return _minBaseFee The minimum rewarded gas fee\\n function minBaseFee() external view returns (uint256 _minBaseFee);\\n\\n /// @notice The minimum priority fee that is also rewarded for keepers\\n /// @return _minPriorityFee The minimum rewarded priority fee\\n function minPriorityFee() external view returns (uint256 _minPriorityFee);\\n\\n /// @notice Address of Keep3r V2\\n /// @return _keep3rV2 Address of Keep3r V2\\n function keep3rV2() external view returns (address _keep3rV2);\\n\\n // Methods\\n\\n /// @notice Sets KP3R-WETH pool\\n /// @param _poolAddress The address of the KP3R-WETH pool\\n function setKp3rWethPool(address _poolAddress) external;\\n\\n /// @notice Sets the minimum boost multiplier\\n /// @param _minBoost The minimum boost multiplier\\n function setMinBoost(uint256 _minBoost) external;\\n\\n /// @notice Sets the maximum boost multiplier\\n /// @param _maxBoost The maximum boost multiplier\\n function setMaxBoost(uint256 _maxBoost) external;\\n\\n /// @notice Sets the target bond amount\\n /// @param _targetBond The target bond amount\\n function setTargetBond(uint256 _targetBond) external;\\n\\n /// @notice Sets the Keep3r V2 address\\n /// @param _keep3rV2 The address of Keep3r V2\\n function setKeep3rV2(address _keep3rV2) external;\\n\\n /// @notice Sets the work extra gas amount\\n /// @param _workExtraGas The work extra gas\\n function setWorkExtraGas(uint256 _workExtraGas) external;\\n\\n /// @notice Sets the quote twap time\\n /// @param _quoteTwapTime The twap time for quoting\\n function setQuoteTwapTime(uint32 _quoteTwapTime) external;\\n\\n /// @notice Sets the minimum rewarded gas fee\\n /// @param _minBaseFee The minimum rewarded gas fee\\n function setMinBaseFee(uint256 _minBaseFee) external;\\n\\n /// @notice Sets the minimum rewarded gas priority fee\\n /// @param _minPriorityFee The minimum rewarded priority fee\\n function setMinPriorityFee(uint256 _minPriorityFee) external;\\n}\\n\",\"keccak256\":\"0xc571e913c0e3c02f4aa0b27090ca1608c85c68768dc2ab979f8aef7c731f60b2\",\"license\":\"MIT\"},\"solidity/interfaces/external/IKeep3rV1.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4 <0.9.0;\\n\\nimport '@openzeppelin/contracts/token/ERC20/IERC20.sol';\\nimport '@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol';\\n\\n// solhint-disable func-name-mixedcase\\ninterface IKeep3rV1 is IERC20, IERC20Metadata {\\n // Structs\\n struct Checkpoint {\\n uint32 fromBlock;\\n uint256 votes;\\n }\\n\\n // Events\\n event DelegateChanged(address indexed _delegator, address indexed _fromDelegate, address indexed _toDelegate);\\n event DelegateVotesChanged(address indexed _delegate, uint256 _previousBalance, uint256 _newBalance);\\n event SubmitJob(address indexed _job, address indexed _liquidity, address indexed _provider, uint256 _block, uint256 _credit);\\n event ApplyCredit(address indexed _job, address indexed _liquidity, address indexed _provider, uint256 _block, uint256 _credit);\\n event RemoveJob(address indexed _job, address indexed _liquidity, address indexed _provider, uint256 _block, uint256 _credit);\\n event UnbondJob(address indexed _job, address indexed _liquidity, address indexed _provider, uint256 _block, uint256 _credit);\\n event JobAdded(address indexed _job, uint256 _block, address _governance);\\n event JobRemoved(address indexed _job, uint256 _block, address _governance);\\n event KeeperWorked(address indexed _credit, address indexed _job, address indexed _keeper, uint256 _block, uint256 _amount);\\n event KeeperBonding(address indexed _keeper, uint256 _block, uint256 _active, uint256 _bond);\\n event KeeperBonded(address indexed _keeper, uint256 _block, uint256 _activated, uint256 _bond);\\n event KeeperUnbonding(address indexed _keeper, uint256 _block, uint256 _deactive, uint256 _bond);\\n event KeeperUnbound(address indexed _keeper, uint256 _block, uint256 _deactivated, uint256 _bond);\\n event KeeperSlashed(address indexed _keeper, address indexed _slasher, uint256 _block, uint256 _slash);\\n event KeeperDispute(address indexed _keeper, uint256 _block);\\n event KeeperResolved(address indexed _keeper, uint256 _block);\\n event TokenCreditAddition(address indexed _credit, address indexed _job, address indexed _creditor, uint256 _block, uint256 _amount);\\n\\n // Variables\\n function KPRH() external returns (address);\\n\\n function delegates(address _delegator) external view returns (address);\\n\\n function checkpoints(address _account, uint32 _checkpoint) external view returns (Checkpoint memory);\\n\\n function numCheckpoints(address _account) external view returns (uint32);\\n\\n function DOMAIN_TYPEHASH() external returns (bytes32);\\n\\n function DOMAINSEPARATOR() external returns (bytes32);\\n\\n function DELEGATION_TYPEHASH() external returns (bytes32);\\n\\n function PERMIT_TYPEHASH() external returns (bytes32);\\n\\n function nonces(address _user) external view returns (uint256);\\n\\n function BOND() external returns (uint256);\\n\\n function UNBOND() external returns (uint256);\\n\\n function LIQUIDITYBOND() external returns (uint256);\\n\\n function FEE() external returns (uint256);\\n\\n function BASE() external returns (uint256);\\n\\n function ETH() external returns (address);\\n\\n function bondings(address _user, address _bonding) external view returns (uint256);\\n\\n function canWithdrawAfter(address _user, address _bonding) external view returns (uint256);\\n\\n function pendingUnbonds(address _keeper, address _bonding) external view returns (uint256);\\n\\n function pendingbonds(address _keeper, address _bonding) external view returns (uint256);\\n\\n function bonds(address _keeper, address _bonding) external view returns (uint256);\\n\\n function votes(address _delegator) external view returns (uint256);\\n\\n function firstSeen(address _keeper) external view returns (uint256);\\n\\n function disputes(address _keeper) external view returns (bool);\\n\\n function lastJob(address _keeper) external view returns (uint256);\\n\\n function workCompleted(address _keeper) external view returns (uint256);\\n\\n function jobs(address _job) external view returns (bool);\\n\\n function credits(address _job, address _credit) external view returns (uint256);\\n\\n function liquidityProvided(\\n address _provider,\\n address _liquidity,\\n address _job\\n ) external view returns (uint256);\\n\\n function liquidityUnbonding(\\n address _provider,\\n address _liquidity,\\n address _job\\n ) external view returns (uint256);\\n\\n function liquidityAmountsUnbonding(\\n address _provider,\\n address _liquidity,\\n address _job\\n ) external view returns (uint256);\\n\\n function jobProposalDelay(address _job) external view returns (uint256);\\n\\n function liquidityApplied(\\n address _provider,\\n address _liquidity,\\n address _job\\n ) external view returns (uint256);\\n\\n function liquidityAmount(\\n address _provider,\\n address _liquidity,\\n address _job\\n ) external view returns (uint256);\\n\\n function keepers(address _keeper) external view returns (bool);\\n\\n function blacklist(address _keeper) external view returns (bool);\\n\\n function keeperList(uint256 _index) external view returns (address);\\n\\n function jobList(uint256 _index) external view returns (address);\\n\\n function governance() external returns (address);\\n\\n function pendingGovernance() external returns (address);\\n\\n function liquidityAccepted(address _liquidity) external view returns (bool);\\n\\n function liquidityPairs(uint256 _index) external view returns (address);\\n\\n // Methods\\n function getCurrentVotes(address _account) external view returns (uint256);\\n\\n function addCreditETH(address _job) external payable;\\n\\n function addCredit(\\n address _credit,\\n address _job,\\n uint256 _amount\\n ) external;\\n\\n function addVotes(address _voter, uint256 _amount) external;\\n\\n function removeVotes(address _voter, uint256 _amount) external;\\n\\n function addKPRCredit(address _job, uint256 _amount) external;\\n\\n function approveLiquidity(address _liquidity) external;\\n\\n function revokeLiquidity(address _liquidity) external;\\n\\n function pairs() external view returns (address[] memory);\\n\\n function addLiquidityToJob(\\n address _liquidity,\\n address _job,\\n uint256 _amount\\n ) external;\\n\\n function applyCreditToJob(\\n address _provider,\\n address _liquidity,\\n address _job\\n ) external;\\n\\n function unbondLiquidityFromJob(\\n address _liquidity,\\n address _job,\\n uint256 _amount\\n ) external;\\n\\n function removeLiquidityFromJob(address _liquidity, address _job) external;\\n\\n function mint(uint256 _amount) external;\\n\\n function burn(uint256 _amount) external;\\n\\n function worked(address _keeper) external;\\n\\n function receipt(\\n address _credit,\\n address _keeper,\\n uint256 _amount\\n ) external;\\n\\n function receiptETH(address _keeper, uint256 _amount) external;\\n\\n function addJob(address _job) external;\\n\\n function getJobs() external view returns (address[] memory);\\n\\n function removeJob(address _job) external;\\n\\n function setKeep3rHelper(address _keep3rHelper) external;\\n\\n function setGovernance(address _governance) external;\\n\\n function acceptGovernance() external;\\n\\n function isKeeper(address _keeper) external returns (bool);\\n\\n function isMinKeeper(\\n address _keeper,\\n uint256 _minBond,\\n uint256 _earned,\\n uint256 _age\\n ) external returns (bool);\\n\\n function isBondedKeeper(\\n address _keeper,\\n address _bond,\\n uint256 _minBond,\\n uint256 _earned,\\n uint256 _age\\n ) external returns (bool);\\n\\n function bond(address _bonding, uint256 _amount) external;\\n\\n function getKeepers() external view returns (address[] memory);\\n\\n function activate(address _bonding) external;\\n\\n function unbond(address _bonding, uint256 _amount) external;\\n\\n function slash(\\n address _bonded,\\n address _keeper,\\n uint256 _amount\\n ) external;\\n\\n function withdraw(address _bonding) external;\\n\\n function dispute(address _keeper) external;\\n\\n function revoke(address _keeper) external;\\n\\n function resolve(address _keeper) external;\\n\\n function permit(\\n address _owner,\\n address _spender,\\n uint256 _amount,\\n uint256 _deadline,\\n uint8 _v,\\n bytes32 _r,\\n bytes32 _s\\n ) external;\\n}\\n\",\"keccak256\":\"0xa9806cd6666ab1b7375ef72446964a72397fd4cefc7cc8c5b37caa7c50df0246\",\"license\":\"MIT\"},\"solidity/interfaces/peripherals/IKeep3rAccountance.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4 <0.9.0;\\n\\nimport './IKeep3rRoles.sol';\\n\\n/// @title Keep3rDisputable contract\\n/// @notice Disputes keepers, or if they're already disputed, it can resolve the case\\n/// @dev Argument `bonding` can be the address of either a token or a liquidity\\ninterface IKeep3rAccountance is IKeep3rRoles {\\n // Events\\n\\n /// @notice Emitted when the bonding process of a new keeper begins\\n /// @param _keeper The caller of Keep3rKeeperFundable#bond function\\n /// @param _bonding The asset the keeper has bonded\\n /// @param _amount The amount the keeper has bonded\\n event Bonding(address indexed _keeper, address indexed _bonding, uint256 _amount);\\n\\n /// @notice Emitted when a keeper or job begins the unbonding process to withdraw the funds\\n /// @param _keeperOrJob The keeper or job that began the unbonding process\\n /// @param _unbonding The liquidity pair or asset being unbonded\\n /// @param _amount The amount being unbonded\\n event Unbonding(address indexed _keeperOrJob, address indexed _unbonding, uint256 _amount);\\n\\n // Variables\\n\\n /// @notice Tracks the total amount of bonded KP3Rs in the contract\\n /// @return _totalBonds The total amount of bonded KP3Rs in the contract\\n function totalBonds() external view returns (uint256 _totalBonds);\\n\\n /// @notice Tracks the total KP3R earnings of a keeper since it started working\\n /// @param _keeper The address of the keeper\\n /// @return _workCompleted Total KP3R earnings of a keeper since it started working\\n function workCompleted(address _keeper) external view returns (uint256 _workCompleted);\\n\\n /// @notice Tracks when a keeper was first registered\\n /// @param _keeper The address of the keeper\\n /// @return timestamp The time at which the keeper was first registered\\n function firstSeen(address _keeper) external view returns (uint256 timestamp);\\n\\n /// @notice Tracks if a keeper or job has a pending dispute\\n /// @param _keeperOrJob The address of the keeper or job\\n /// @return _disputed Whether a keeper or job has a pending dispute\\n function disputes(address _keeperOrJob) external view returns (bool _disputed);\\n\\n /// @notice Tracks how much a keeper has bonded of a certain token\\n /// @param _keeper The address of the keeper\\n /// @param _bond The address of the token being bonded\\n /// @return _bonds Amount of a certain token that a keeper has bonded\\n function bonds(address _keeper, address _bond) external view returns (uint256 _bonds);\\n\\n /// @notice The current token credits available for a job\\n /// @param _job The address of the job\\n /// @param _token The address of the token bonded\\n /// @return _amount The amount of token credits available for a job\\n function jobTokenCredits(address _job, address _token) external view returns (uint256 _amount);\\n\\n /// @notice Tracks the amount of assets deposited in pending bonds\\n /// @param _keeper The address of the keeper\\n /// @param _bonding The address of the token being bonded\\n /// @return _pendingBonds Amount of a certain asset a keeper has unbonding\\n function pendingBonds(address _keeper, address _bonding) external view returns (uint256 _pendingBonds);\\n\\n /// @notice Tracks when a bonding for a keeper can be activated\\n /// @param _keeper The address of the keeper\\n /// @param _bonding The address of the token being bonded\\n /// @return _timestamp Time at which the bonding for a keeper can be activated\\n function canActivateAfter(address _keeper, address _bonding) external view returns (uint256 _timestamp);\\n\\n /// @notice Tracks when keeper bonds are ready to be withdrawn\\n /// @param _keeper The address of the keeper\\n /// @param _bonding The address of the token being unbonded\\n /// @return _timestamp Time at which the keeper bonds are ready to be withdrawn\\n function canWithdrawAfter(address _keeper, address _bonding) external view returns (uint256 _timestamp);\\n\\n /// @notice Tracks how much keeper bonds are to be withdrawn\\n /// @param _keeper The address of the keeper\\n /// @param _bonding The address of the token being unbonded\\n /// @return _pendingUnbonds The amount of keeper bonds that are to be withdrawn\\n function pendingUnbonds(address _keeper, address _bonding) external view returns (uint256 _pendingUnbonds);\\n\\n /// @notice Checks whether the address has ever bonded an asset\\n /// @param _keeper The address of the keeper\\n /// @return _hasBonded Whether the address has ever bonded an asset\\n function hasBonded(address _keeper) external view returns (bool _hasBonded);\\n\\n // Methods\\n\\n /// @notice Lists all jobs\\n /// @return _jobList Array with all the jobs in _jobs\\n function jobs() external view returns (address[] memory _jobList);\\n\\n /// @notice Lists all keepers\\n /// @return _keeperList Array with all the keepers in _keepers\\n function keepers() external view returns (address[] memory _keeperList);\\n\\n // Errors\\n\\n /// @notice Throws when an address is passed as a job, but that address is not a job\\n error JobUnavailable();\\n\\n /// @notice Throws when an action that requires an undisputed job is applied on a disputed job\\n error JobDisputed();\\n}\\n\",\"keccak256\":\"0xf4748c236ddf409e45e7169c735e2fc54e627b2b3ccd189ebb438ad768f1deb1\",\"license\":\"MIT\"},\"solidity/interfaces/peripherals/IKeep3rDisputable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4 <0.9.0;\\n\\n/// @title Keep3rDisputable contract\\n/// @notice Creates/resolves disputes for jobs or keepers\\n/// A disputed keeper is slashable and is not able to bond, activate, withdraw or receive direct payments\\n/// A disputed job is slashable and is not able to pay the keepers, withdraw tokens or to migrate\\ninterface IKeep3rDisputable {\\n /// @notice Emitted when a keeper or a job is disputed\\n /// @param _jobOrKeeper The address of the disputed keeper/job\\n /// @param _disputer The user that called the function and disputed the keeper\\n event Dispute(address indexed _jobOrKeeper, address indexed _disputer);\\n\\n /// @notice Emitted when a dispute is resolved\\n /// @param _jobOrKeeper The address of the disputed keeper/job\\n /// @param _resolver The user that called the function and resolved the dispute\\n event Resolve(address indexed _jobOrKeeper, address indexed _resolver);\\n\\n /// @notice Throws when a job or keeper is already disputed\\n error AlreadyDisputed();\\n\\n /// @notice Throws when a job or keeper is not disputed and someone tries to resolve the dispute\\n error NotDisputed();\\n\\n /// @notice Allows governor to create a dispute for a given keeper/job\\n /// @param _jobOrKeeper The address in dispute\\n function dispute(address _jobOrKeeper) external;\\n\\n /// @notice Allows governor to resolve a dispute on a keeper/job\\n /// @param _jobOrKeeper The address cleared\\n function resolve(address _jobOrKeeper) external;\\n}\\n\",\"keccak256\":\"0xdfdabcecbed06fcb2eb1b80e6a61d681afecd1f75c58a888451de7927b10c3b2\",\"license\":\"MIT\"},\"solidity/interfaces/peripherals/IKeep3rJobs.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4 <0.9.0;\\n\\nimport './IKeep3rDisputable.sol';\\n\\n/// @title Keep3rJobOwnership contract\\n/// @notice Handles the ownership of the jobs\\ninterface IKeep3rJobOwnership {\\n // Events\\n\\n /// @notice Emitted when Keep3rJobOwnership#changeJobOwnership is called\\n /// @param _job The address of the job proposed to have a change of owner\\n /// @param _owner The current owner of the job\\n /// @param _pendingOwner The new address proposed to be the owner of the job\\n event JobOwnershipChange(address indexed _job, address indexed _owner, address indexed _pendingOwner);\\n\\n /// @notice Emitted when Keep3rJobOwnership#JobOwnershipAssent is called\\n /// @param _job The address of the job which the proposed owner will now own\\n /// @param _previousOwner The previous owner of the job\\n /// @param _newOwner The new owner of the job\\n event JobOwnershipAssent(address indexed _job, address indexed _previousOwner, address indexed _newOwner);\\n\\n // Errors\\n\\n /// @notice Throws when the caller of the function is not the job owner\\n error OnlyJobOwner();\\n\\n /// @notice Throws when the caller of the function is not the pending job owner\\n error OnlyPendingJobOwner();\\n\\n // Variables\\n\\n /// @notice Maps the job to the owner of the job\\n /// @param _job The address of the job\\n /// @return _owner The address of the owner of the job\\n function jobOwner(address _job) external view returns (address _owner);\\n\\n /// @notice Maps the job to its pending owner\\n /// @param _job The address of the job\\n /// @return _pendingOwner The address of the pending owner of the job\\n function jobPendingOwner(address _job) external view returns (address _pendingOwner);\\n\\n // Methods\\n\\n /// @notice Proposes a new address to be the owner of the job\\n /// @param _job The address of the job\\n /// @param _newOwner The address of the proposed new owner\\n function changeJobOwnership(address _job, address _newOwner) external;\\n\\n /// @notice The proposed address accepts to be the owner of the job\\n /// @param _job The address of the job\\n function acceptJobOwnership(address _job) external;\\n}\\n\\n/// @title Keep3rJobManager contract\\n/// @notice Handles the addition and withdrawal of credits from a job\\ninterface IKeep3rJobManager is IKeep3rJobOwnership {\\n // Events\\n\\n /// @notice Emitted when Keep3rJobManager#addJob is called\\n /// @param _job The address of the job to add\\n /// @param _jobOwner The job's owner\\n event JobAddition(address indexed _job, address indexed _jobOwner);\\n\\n // Errors\\n\\n /// @notice Throws when trying to add a job that has already been added\\n error JobAlreadyAdded();\\n\\n /// @notice Throws when the address that is trying to register as a keeper is already a keeper\\n error AlreadyAKeeper();\\n\\n // Methods\\n\\n /// @notice Allows any caller to add a new job\\n /// @param _job Address of the contract for which work should be performed\\n function addJob(address _job) external;\\n}\\n\\n/// @title Keep3rJobFundableCredits contract\\n/// @notice Handles the addition and withdrawal of credits from a job\\ninterface IKeep3rJobFundableCredits is IKeep3rJobOwnership {\\n // Events\\n\\n /// @notice Emitted when Keep3rJobFundableCredits#addTokenCreditsToJob is called\\n /// @param _job The address of the job being credited\\n /// @param _token The address of the token being provided\\n /// @param _provider The user that calls the function\\n /// @param _amount The amount of credit being added to the job\\n event TokenCreditAddition(address indexed _job, address indexed _token, address indexed _provider, uint256 _amount);\\n\\n /// @notice Emitted when Keep3rJobFundableCredits#withdrawTokenCreditsFromJob is called\\n /// @param _job The address of the job from which the credits are withdrawn\\n /// @param _token The credit being withdrawn from the job\\n /// @param _receiver The user that receives the tokens\\n /// @param _amount The amount of credit withdrawn\\n event TokenCreditWithdrawal(address indexed _job, address indexed _token, address indexed _receiver, uint256 _amount);\\n\\n // Errors\\n\\n /// @notice Throws when the token is KP3R, as it should not be used for direct token payments\\n error TokenUnallowed();\\n\\n /// @notice Throws when the token withdraw cooldown has not yet passed\\n error JobTokenCreditsLocked();\\n\\n /// @notice Throws when the user tries to withdraw more tokens than it has\\n error InsufficientJobTokenCredits();\\n\\n // Variables\\n\\n /// @notice Last block where tokens were added to the job\\n /// @param _job The address of the job credited\\n /// @param _token The address of the token credited\\n /// @return _timestamp The last block where tokens were added to the job\\n function jobTokenCreditsAddedAt(address _job, address _token) external view returns (uint256 _timestamp);\\n\\n // Methods\\n\\n /// @notice Add credit to a job to be paid out for work\\n /// @param _job The address of the job being credited\\n /// @param _token The address of the token being credited\\n /// @param _amount The amount of credit being added\\n function addTokenCreditsToJob(\\n address _job,\\n address _token,\\n uint256 _amount\\n ) external;\\n\\n /// @notice Withdraw credit from a job\\n /// @param _job The address of the job from which the credits are withdrawn\\n /// @param _token The address of the token being withdrawn\\n /// @param _amount The amount of token to be withdrawn\\n /// @param _receiver The user that will receive tokens\\n function withdrawTokenCreditsFromJob(\\n address _job,\\n address _token,\\n uint256 _amount,\\n address _receiver\\n ) external;\\n}\\n\\n/// @title Keep3rJobFundableLiquidity contract\\n/// @notice Handles the funding of jobs through specific liquidity pairs\\ninterface IKeep3rJobFundableLiquidity is IKeep3rJobOwnership {\\n // Events\\n\\n /// @notice Emitted when Keep3rJobFundableLiquidity#approveLiquidity function is called\\n /// @param _liquidity The address of the liquidity pair being approved\\n event LiquidityApproval(address _liquidity);\\n\\n /// @notice Emitted when Keep3rJobFundableLiquidity#revokeLiquidity function is called\\n /// @param _liquidity The address of the liquidity pair being revoked\\n event LiquidityRevocation(address _liquidity);\\n\\n /// @notice Emitted when IKeep3rJobFundableLiquidity#addLiquidityToJob function is called\\n /// @param _job The address of the job to which liquidity will be added\\n /// @param _liquidity The address of the liquidity being added\\n /// @param _provider The user that calls the function\\n /// @param _amount The amount of liquidity being added\\n event LiquidityAddition(address indexed _job, address indexed _liquidity, address indexed _provider, uint256 _amount);\\n\\n /// @notice Emitted when IKeep3rJobFundableLiquidity#withdrawLiquidityFromJob function is called\\n /// @param _job The address of the job of which liquidity will be withdrawn from\\n /// @param _liquidity The address of the liquidity being withdrawn\\n /// @param _receiver The receiver of the liquidity tokens\\n /// @param _amount The amount of liquidity being withdrawn from the job\\n event LiquidityWithdrawal(address indexed _job, address indexed _liquidity, address indexed _receiver, uint256 _amount);\\n\\n /// @notice Emitted when Keep3rJobFundableLiquidity#addLiquidityToJob function is called\\n /// @param _job The address of the job whose credits will be updated\\n /// @param _rewardedAt The time at which the job was last rewarded\\n /// @param _currentCredits The current credits of the job\\n /// @param _periodCredits The credits of the job for the current period\\n event LiquidityCreditsReward(address indexed _job, uint256 _rewardedAt, uint256 _currentCredits, uint256 _periodCredits);\\n\\n /// @notice Emitted when Keep3rJobFundableLiquidity#forceLiquidityCreditsToJob function is called\\n /// @param _job The address of the job whose credits will be updated\\n /// @param _rewardedAt The time at which the job was last rewarded\\n /// @param _currentCredits The current credits of the job\\n event LiquidityCreditsForced(address indexed _job, uint256 _rewardedAt, uint256 _currentCredits);\\n\\n // Errors\\n\\n /// @notice Throws when the liquidity being approved has already been approved\\n error LiquidityPairApproved();\\n\\n /// @notice Throws when the liquidity being removed has not been approved\\n error LiquidityPairUnexistent();\\n\\n /// @notice Throws when trying to add liquidity to an unapproved pool\\n error LiquidityPairUnapproved();\\n\\n /// @notice Throws when the job doesn't have the requested liquidity\\n error JobLiquidityUnexistent();\\n\\n /// @notice Throws when trying to remove more liquidity than the job has\\n error JobLiquidityInsufficient();\\n\\n /// @notice Throws when trying to add less liquidity than the minimum liquidity required\\n error JobLiquidityLessThanMin();\\n\\n // Structs\\n\\n /// @notice Stores the tick information of the different liquidity pairs\\n struct TickCache {\\n int56 current; // Tracks the current tick\\n int56 difference; // Stores the difference between the current tick and the last tick\\n uint256 period; // Stores the period at which the last observation was made\\n }\\n\\n // Variables\\n\\n /// @notice Lists liquidity pairs\\n /// @return _list An array of addresses with all the approved liquidity pairs\\n function approvedLiquidities() external view returns (address[] memory _list);\\n\\n /// @notice Amount of liquidity in a specified job\\n /// @param _job The address of the job being checked\\n /// @param _liquidity The address of the liquidity we are checking\\n /// @return _amount Amount of liquidity in the specified job\\n function liquidityAmount(address _job, address _liquidity) external view returns (uint256 _amount);\\n\\n /// @notice Last time the job was rewarded liquidity credits\\n /// @param _job The address of the job being checked\\n /// @return _timestamp Timestamp of the last time the job was rewarded liquidity credits\\n function rewardedAt(address _job) external view returns (uint256 _timestamp);\\n\\n /// @notice Last time the job was worked\\n /// @param _job The address of the job being checked\\n /// @return _timestamp Timestamp of the last time the job was worked\\n function workedAt(address _job) external view returns (uint256 _timestamp);\\n\\n // Methods\\n\\n /// @notice Returns the liquidity credits of a given job\\n /// @param _job The address of the job of which we want to know the liquidity credits\\n /// @return _amount The liquidity credits of a given job\\n function jobLiquidityCredits(address _job) external view returns (uint256 _amount);\\n\\n /// @notice Returns the credits of a given job for the current period\\n /// @param _job The address of the job of which we want to know the period credits\\n /// @return _amount The credits the given job has at the current period\\n function jobPeriodCredits(address _job) external view returns (uint256 _amount);\\n\\n /// @notice Calculates the total credits of a given job\\n /// @param _job The address of the job of which we want to know the total credits\\n /// @return _amount The total credits of the given job\\n function totalJobCredits(address _job) external view returns (uint256 _amount);\\n\\n /// @notice Calculates how many credits should be rewarded periodically for a given liquidity amount\\n /// @dev _periodCredits = underlying KP3Rs for given liquidity amount * rewardPeriod / inflationPeriod\\n /// @param _liquidity The address of the liquidity to provide\\n /// @param _amount The amount of liquidity to provide\\n /// @return _periodCredits The amount of KP3R periodically minted for the given liquidity\\n function quoteLiquidity(address _liquidity, uint256 _amount) external view returns (uint256 _periodCredits);\\n\\n /// @notice Observes the current state of the liquidity pair being observed and updates TickCache with the information\\n /// @param _liquidity The address of the liquidity pair being observed\\n /// @return _tickCache The updated TickCache\\n function observeLiquidity(address _liquidity) external view returns (TickCache memory _tickCache);\\n\\n /// @notice Gifts liquidity credits to the specified job\\n /// @param _job The address of the job being credited\\n /// @param _amount The amount of liquidity credits to gift\\n function forceLiquidityCreditsToJob(address _job, uint256 _amount) external;\\n\\n /// @notice Approve a liquidity pair for being accepted in future\\n /// @param _liquidity The address of the liquidity accepted\\n function approveLiquidity(address _liquidity) external;\\n\\n /// @notice Revoke a liquidity pair from being accepted in future\\n /// @param _liquidity The liquidity no longer accepted\\n function revokeLiquidity(address _liquidity) external;\\n\\n /// @notice Allows anyone to fund a job with liquidity\\n /// @param _job The address of the job to assign liquidity to\\n /// @param _liquidity The liquidity being added\\n /// @param _amount The amount of liquidity tokens to add\\n function addLiquidityToJob(\\n address _job,\\n address _liquidity,\\n uint256 _amount\\n ) external;\\n\\n /// @notice Unbond liquidity for a job\\n /// @dev Can only be called by the job's owner\\n /// @param _job The address of the job being unbonded from\\n /// @param _liquidity The liquidity being unbonded\\n /// @param _amount The amount of liquidity being removed\\n function unbondLiquidityFromJob(\\n address _job,\\n address _liquidity,\\n uint256 _amount\\n ) external;\\n\\n /// @notice Withdraw liquidity from a job\\n /// @param _job The address of the job being withdrawn from\\n /// @param _liquidity The liquidity being withdrawn\\n /// @param _receiver The address that will receive the withdrawn liquidity\\n function withdrawLiquidityFromJob(\\n address _job,\\n address _liquidity,\\n address _receiver\\n ) external;\\n}\\n\\n/// @title Keep3rJobMigration contract\\n/// @notice Handles the migration process of jobs to different addresses\\ninterface IKeep3rJobMigration is IKeep3rJobFundableCredits, IKeep3rJobFundableLiquidity {\\n // Events\\n\\n /// @notice Emitted when Keep3rJobMigration#migrateJob function is called\\n /// @param _fromJob The address of the job that requests to migrate\\n /// @param _toJob The address at which the job requests to migrate\\n event JobMigrationRequested(address indexed _fromJob, address _toJob);\\n\\n /// @notice Emitted when Keep3rJobMigration#acceptJobMigration function is called\\n /// @param _fromJob The address of the job that requested to migrate\\n /// @param _toJob The address at which the job had requested to migrate\\n event JobMigrationSuccessful(address _fromJob, address indexed _toJob);\\n\\n // Errors\\n\\n /// @notice Throws when the address of the job that requests to migrate wants to migrate to its same address\\n error JobMigrationImpossible();\\n\\n /// @notice Throws when the _toJob address differs from the address being tracked in the pendingJobMigrations mapping\\n error JobMigrationUnavailable();\\n\\n /// @notice Throws when cooldown between migrations has not yet passed\\n error JobMigrationLocked();\\n\\n // Variables\\n\\n /// @notice Maps the jobs that have requested a migration to the address they have requested to migrate to\\n /// @return _toJob The address to which the job has requested to migrate to\\n function pendingJobMigrations(address _fromJob) external view returns (address _toJob);\\n\\n // Methods\\n\\n /// @notice Initializes the migration process for a job by adding the request to the pendingJobMigrations mapping\\n /// @param _fromJob The address of the job that is requesting to migrate\\n /// @param _toJob The address at which the job is requesting to migrate\\n function migrateJob(address _fromJob, address _toJob) external;\\n\\n /// @notice Completes the migration process for a job\\n /// @dev Unbond/withdraw process doesn't get migrated\\n /// @param _fromJob The address of the job that requested to migrate\\n /// @param _toJob The address to which the job wants to migrate to\\n function acceptJobMigration(address _fromJob, address _toJob) external;\\n}\\n\\n/// @title Keep3rJobWorkable contract\\n/// @notice Handles the mechanisms jobs can pay keepers with along with the restrictions jobs can put on keepers before they can work on jobs\\ninterface IKeep3rJobWorkable is IKeep3rJobMigration {\\n // Events\\n\\n /// @notice Emitted when a keeper is validated before a job\\n /// @param _gasLeft The amount of gas that the transaction has left at the moment of keeper validation\\n event KeeperValidation(uint256 _gasLeft);\\n\\n /// @notice Emitted when a keeper works a job\\n /// @param _credit The address of the asset in which the keeper is paid\\n /// @param _job The address of the job the keeper has worked\\n /// @param _keeper The address of the keeper that has worked the job\\n /// @param _payment The amount that has been paid out to the keeper in exchange for working the job\\n /// @param _gasLeft The amount of gas that the transaction has left at the moment of payment\\n event KeeperWork(address indexed _credit, address indexed _job, address indexed _keeper, uint256 _payment, uint256 _gasLeft);\\n\\n // Errors\\n\\n /// @notice Throws if work method was called without calling isKeeper or isBondedKeeper\\n error GasNotInitialized();\\n\\n /// @notice Throws if the address claiming to be a job is not in the list of approved jobs\\n error JobUnapproved();\\n\\n /// @notice Throws if the amount of funds in the job is less than the payment that must be paid to the keeper that works that job\\n error InsufficientFunds();\\n\\n // Methods\\n\\n /// @notice Confirms if the current keeper is registered\\n /// @dev Can be used for general (non critical) functions\\n /// @param _keeper The keeper being investigated\\n /// @return _isKeeper Whether the address passed as a parameter is a keeper or not\\n function isKeeper(address _keeper) external returns (bool _isKeeper);\\n\\n /// @notice Confirms if the current keeper is registered and has a minimum bond of any asset.\\n /// @dev Should be used for protected functions\\n /// @param _keeper The keeper to check\\n /// @param _bond The bond token being evaluated\\n /// @param _minBond The minimum amount of bonded tokens\\n /// @param _earned The minimum funds earned in the keepers lifetime\\n /// @param _age The minimum keeper age required\\n /// @return _isBondedKeeper Whether the `_keeper` meets the given requirements\\n function isBondedKeeper(\\n address _keeper,\\n address _bond,\\n uint256 _minBond,\\n uint256 _earned,\\n uint256 _age\\n ) external returns (bool _isBondedKeeper);\\n\\n /// @notice Implemented by jobs to show that a keeper performed work\\n /// @dev Automatically calculates the payment for the keeper and pays the keeper with bonded KP3R\\n /// @param _keeper Address of the keeper that performed the work\\n function worked(address _keeper) external;\\n\\n /// @notice Implemented by jobs to show that a keeper performed work\\n /// @dev Pays the keeper that performs the work with KP3R\\n /// @param _keeper Address of the keeper that performed the work\\n /// @param _payment The reward that should be allocated for the job\\n function bondedPayment(address _keeper, uint256 _payment) external;\\n\\n /// @notice Implemented by jobs to show that a keeper performed work\\n /// @dev Pays the keeper that performs the work with a specific token\\n /// @param _token The asset being awarded to the keeper\\n /// @param _keeper Address of the keeper that performed the work\\n /// @param _amount The reward that should be allocated\\n function directTokenPayment(\\n address _token,\\n address _keeper,\\n uint256 _amount\\n ) external;\\n}\\n\\n/// @title Keep3rJobDisputable contract\\n/// @notice Handles the actions that can be taken on a disputed job\\ninterface IKeep3rJobDisputable is IKeep3rDisputable, IKeep3rJobFundableCredits, IKeep3rJobFundableLiquidity {\\n // Events\\n\\n /// @notice Emitted when Keep3rJobDisputable#slashTokenFromJob is called\\n /// @param _job The address of the job from which the token will be slashed\\n /// @param _token The address of the token being slashed\\n /// @param _slasher The user that slashes the token\\n /// @param _amount The amount of the token being slashed\\n event JobSlashToken(address indexed _job, address _token, address indexed _slasher, uint256 _amount);\\n\\n /// @notice Emitted when Keep3rJobDisputable#slashLiquidityFromJob is called\\n /// @param _job The address of the job from which the liquidity will be slashed\\n /// @param _liquidity The address of the liquidity being slashed\\n /// @param _slasher The user that slashes the liquidity\\n /// @param _amount The amount of the liquidity being slashed\\n event JobSlashLiquidity(address indexed _job, address _liquidity, address indexed _slasher, uint256 _amount);\\n\\n // Errors\\n\\n /// @notice Throws when the token trying to be slashed doesn't exist\\n error JobTokenUnexistent();\\n\\n /// @notice Throws when someone tries to slash more tokens than the job has\\n error JobTokenInsufficient();\\n\\n // Methods\\n\\n /// @notice Allows governor or slasher to slash a job specific token\\n /// @param _job The address of the job from which the token will be slashed\\n /// @param _token The address of the token that will be slashed\\n /// @param _amount The amount of the token that will be slashed\\n function slashTokenFromJob(\\n address _job,\\n address _token,\\n uint256 _amount\\n ) external;\\n\\n /// @notice Allows governor or slasher to slash liquidity from a job\\n /// @param _job The address being slashed\\n /// @param _liquidity The address of the liquidity that will be slashed\\n /// @param _amount The amount of liquidity that will be slashed\\n function slashLiquidityFromJob(\\n address _job,\\n address _liquidity,\\n uint256 _amount\\n ) external;\\n}\\n\\n// solhint-disable-next-line no-empty-blocks\\ninterface IKeep3rJobs is IKeep3rJobWorkable, IKeep3rJobManager, IKeep3rJobDisputable {\\n\\n}\\n\",\"keccak256\":\"0x7fb7153d88e9e65d28b278320884517d6b423b2e8cfc78ee0ee16bc04073278e\",\"license\":\"MIT\"},\"solidity/interfaces/peripherals/IKeep3rKeepers.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4 <0.9.0;\\n\\nimport './IKeep3rDisputable.sol';\\n\\n/// @title Keep3rKeeperFundable contract\\n/// @notice Handles the actions required to become a keeper\\ninterface IKeep3rKeeperFundable {\\n // Events\\n\\n /// @notice Emitted when Keep3rKeeperFundable#activate is called\\n /// @param _keeper The keeper that has been activated\\n /// @param _bond The asset the keeper has bonded\\n /// @param _amount The amount of the asset the keeper has bonded\\n event Activation(address indexed _keeper, address indexed _bond, uint256 _amount);\\n\\n /// @notice Emitted when Keep3rKeeperFundable#withdraw is called\\n /// @param _keeper The caller of Keep3rKeeperFundable#withdraw function\\n /// @param _bond The asset to withdraw from the bonding pool\\n /// @param _amount The amount of funds withdrawn\\n event Withdrawal(address indexed _keeper, address indexed _bond, uint256 _amount);\\n\\n // Errors\\n\\n /// @notice Throws when the address that is trying to register as a job is already a job\\n error AlreadyAJob();\\n\\n // Methods\\n\\n /// @notice Beginning of the bonding process\\n /// @param _bonding The asset being bonded\\n /// @param _amount The amount of bonding asset being bonded\\n function bond(address _bonding, uint256 _amount) external;\\n\\n /// @notice Beginning of the unbonding process\\n /// @param _bonding The asset being unbonded\\n /// @param _amount Allows for partial unbonding\\n function unbond(address _bonding, uint256 _amount) external;\\n\\n /// @notice End of the bonding process after bonding time has passed\\n /// @param _bonding The asset being activated as bond collateral\\n function activate(address _bonding) external;\\n\\n /// @notice Withdraw funds after unbonding has finished\\n /// @param _bonding The asset to withdraw from the bonding pool\\n function withdraw(address _bonding) external;\\n}\\n\\n/// @title Keep3rKeeperDisputable contract\\n/// @notice Handles the actions that can be taken on a disputed keeper\\ninterface IKeep3rKeeperDisputable is IKeep3rDisputable, IKeep3rKeeperFundable {\\n // Events\\n\\n /// @notice Emitted when Keep3rKeeperDisputable#slash is called\\n /// @param _keeper The address of the slashed keeper\\n /// @param _slasher The user that called Keep3rKeeperDisputable#slash\\n /// @param _amount The amount of credits slashed from the keeper\\n event KeeperSlash(address indexed _keeper, address indexed _slasher, uint256 _amount);\\n\\n /// @notice Emitted when Keep3rKeeperDisputable#revoke is called\\n /// @param _keeper The address of the revoked keeper\\n /// @param _slasher The user that called Keep3rKeeperDisputable#revoke\\n event KeeperRevoke(address indexed _keeper, address indexed _slasher);\\n\\n // Methods\\n\\n /// @notice Allows governor to slash a keeper based on a dispute\\n /// @param _keeper The address being slashed\\n /// @param _bonded The asset being slashed\\n /// @param _bondAmount The bonded amount being slashed\\n /// @param _unbondAmount The pending unbond amount being slashed\\n function slash(\\n address _keeper,\\n address _bonded,\\n uint256 _bondAmount,\\n uint256 _unbondAmount\\n ) external;\\n\\n /// @notice Blacklists a keeper from participating in the network\\n /// @param _keeper The address being slashed\\n function revoke(address _keeper) external;\\n}\\n\\n// solhint-disable-next-line no-empty-blocks\\n\\n/// @title Keep3rKeepers contract\\ninterface IKeep3rKeepers is IKeep3rKeeperDisputable {\\n\\n}\\n\",\"keccak256\":\"0x8fe10565035bb918b2b1c7d730533bcfe9ec79078f28544852f8178e76302562\",\"license\":\"MIT\"},\"solidity/interfaces/peripherals/IKeep3rParameters.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4 <0.9.0;\\n\\nimport './IKeep3rAccountance.sol';\\n\\n/// @title Keep3rParameters contract\\n/// @notice Handles and sets all the required parameters for Keep3r\\ninterface IKeep3rParameters is IKeep3rAccountance {\\n // Events\\n\\n /// @notice Emitted when the Keep3rHelper address is changed\\n /// @param _keep3rHelper The address of Keep3rHelper's contract\\n event Keep3rHelperChange(address _keep3rHelper);\\n\\n /// @notice Emitted when the Keep3rV1 address is changed\\n /// @param _keep3rV1 The address of Keep3rV1's contract\\n event Keep3rV1Change(address _keep3rV1);\\n\\n /// @notice Emitted when the Keep3rV1Proxy address is changed\\n /// @param _keep3rV1Proxy The address of Keep3rV1Proxy's contract\\n event Keep3rV1ProxyChange(address _keep3rV1Proxy);\\n\\n /// @notice Emitted when bondTime is changed\\n /// @param _bondTime The new bondTime\\n event BondTimeChange(uint256 _bondTime);\\n\\n /// @notice Emitted when _liquidityMinimum is changed\\n /// @param _liquidityMinimum The new _liquidityMinimum\\n event LiquidityMinimumChange(uint256 _liquidityMinimum);\\n\\n /// @notice Emitted when _unbondTime is changed\\n /// @param _unbondTime The new _unbondTime\\n event UnbondTimeChange(uint256 _unbondTime);\\n\\n /// @notice Emitted when _rewardPeriodTime is changed\\n /// @param _rewardPeriodTime The new _rewardPeriodTime\\n event RewardPeriodTimeChange(uint256 _rewardPeriodTime);\\n\\n /// @notice Emitted when the inflationPeriod is changed\\n /// @param _inflationPeriod The new inflationPeriod\\n event InflationPeriodChange(uint256 _inflationPeriod);\\n\\n /// @notice Emitted when the fee is changed\\n /// @param _fee The new token credits fee\\n event FeeChange(uint256 _fee);\\n\\n // Variables\\n\\n /// @notice Address of Keep3rHelper's contract\\n /// @return _keep3rHelper The address of Keep3rHelper's contract\\n function keep3rHelper() external view returns (address _keep3rHelper);\\n\\n /// @notice Address of Keep3rV1's contract\\n /// @return _keep3rV1 The address of Keep3rV1's contract\\n function keep3rV1() external view returns (address _keep3rV1);\\n\\n /// @notice Address of Keep3rV1Proxy's contract\\n /// @return _keep3rV1Proxy The address of Keep3rV1Proxy's contract\\n function keep3rV1Proxy() external view returns (address _keep3rV1Proxy);\\n\\n /// @notice The amount of time required to pass after a keeper has bonded assets for it to be able to activate\\n /// @return _days The required bondTime in days\\n function bondTime() external view returns (uint256 _days);\\n\\n /// @notice The amount of time required to pass before a keeper can unbond what he has bonded\\n /// @return _days The required unbondTime in days\\n function unbondTime() external view returns (uint256 _days);\\n\\n /// @notice The minimum amount of liquidity required to fund a job per liquidity\\n /// @return _amount The minimum amount of liquidity in KP3R\\n function liquidityMinimum() external view returns (uint256 _amount);\\n\\n /// @notice The amount of time between each scheduled credits reward given to a job\\n /// @return _days The reward period in days\\n function rewardPeriodTime() external view returns (uint256 _days);\\n\\n /// @notice The inflation period is the denominator used to regulate the emission of KP3R\\n /// @return _period The denominator used to regulate the emission of KP3R\\n function inflationPeriod() external view returns (uint256 _period);\\n\\n /// @notice The fee to be sent to governor when a user adds liquidity to a job\\n /// @return _amount The fee amount to be sent to governor when a user adds liquidity to a job\\n function fee() external view returns (uint256 _amount);\\n\\n // Errors\\n\\n /// @notice Throws if the reward period is less than the minimum reward period time\\n error MinRewardPeriod();\\n\\n /// @notice Throws if either a job or a keeper is disputed\\n error Disputed();\\n\\n /// @notice Throws if there are no bonded assets\\n error BondsUnexistent();\\n\\n /// @notice Throws if the time required to bond an asset has not passed yet\\n error BondsLocked();\\n\\n /// @notice Throws if there are no bonds to withdraw\\n error UnbondsUnexistent();\\n\\n /// @notice Throws if the time required to withdraw the bonds has not passed yet\\n error UnbondsLocked();\\n\\n // Methods\\n\\n /// @notice Sets the Keep3rHelper address\\n /// @param _keep3rHelper The Keep3rHelper address\\n function setKeep3rHelper(address _keep3rHelper) external;\\n\\n /// @notice Sets the Keep3rV1 address\\n /// @param _keep3rV1 The Keep3rV1 address\\n function setKeep3rV1(address _keep3rV1) external;\\n\\n /// @notice Sets the Keep3rV1Proxy address\\n /// @param _keep3rV1Proxy The Keep3rV1Proxy address\\n function setKeep3rV1Proxy(address _keep3rV1Proxy) external;\\n\\n /// @notice Sets the bond time required to activate as a keeper\\n /// @param _bond The new bond time\\n function setBondTime(uint256 _bond) external;\\n\\n /// @notice Sets the unbond time required unbond what has been bonded\\n /// @param _unbond The new unbond time\\n function setUnbondTime(uint256 _unbond) external;\\n\\n /// @notice Sets the minimum amount of liquidity required to fund a job\\n /// @param _liquidityMinimum The new minimum amount of liquidity\\n function setLiquidityMinimum(uint256 _liquidityMinimum) external;\\n\\n /// @notice Sets the time required to pass between rewards for jobs\\n /// @param _rewardPeriodTime The new amount of time required to pass between rewards\\n function setRewardPeriodTime(uint256 _rewardPeriodTime) external;\\n\\n /// @notice Sets the new inflation period\\n /// @param _inflationPeriod The new inflation period\\n function setInflationPeriod(uint256 _inflationPeriod) external;\\n\\n /// @notice Sets the new fee\\n /// @param _fee The new fee\\n function setFee(uint256 _fee) external;\\n}\\n\",\"keccak256\":\"0x2a847a2ab6dbee960ca84e142ad9c578d8953c4adf1d3221669400ea86c9b82e\",\"license\":\"MIT\"},\"solidity/interfaces/peripherals/IKeep3rRoles.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4 <0.9.0;\\n\\nimport '@defi-wonderland/solidity-utils/solidity/interfaces/IBaseErrors.sol';\\nimport '@defi-wonderland/solidity-utils/solidity/interfaces/IGovernable.sol';\\nimport '@defi-wonderland/solidity-utils/solidity/interfaces/IDustCollector.sol';\\n\\n/// @title Keep3rRoles contract\\n/// @notice Manages the Keep3r specific roles\\ninterface IKeep3rRoles is IBaseErrors, IGovernable, IDustCollector {\\n // Events\\n\\n /// @notice Emitted when a slasher is added\\n /// @param _slasher Address of the added slasher\\n event SlasherAdded(address _slasher);\\n\\n /// @notice Emitted when a slasher is removed\\n /// @param _slasher Address of the removed slasher\\n event SlasherRemoved(address _slasher);\\n\\n /// @notice Emitted when a disputer is added\\n /// @param _disputer Address of the added disputer\\n event DisputerAdded(address _disputer);\\n\\n /// @notice Emitted when a disputer is removed\\n /// @param _disputer Address of the removed disputer\\n event DisputerRemoved(address _disputer);\\n\\n // Variables\\n\\n /// @notice Tracks whether the address is a slasher or not\\n /// @param _slasher Address being checked as a slasher\\n /// @return _isSlasher Whether the address is a slasher or not\\n function slashers(address _slasher) external view returns (bool _isSlasher);\\n\\n /// @notice Tracks whether the address is a disputer or not\\n /// @param _disputer Address being checked as a disputer\\n /// @return _isDisputer Whether the address is a disputer or not\\n function disputers(address _disputer) external view returns (bool _isDisputer);\\n\\n // Errors\\n\\n /// @notice Throws if the address is already a registered slasher\\n error SlasherExistent();\\n\\n /// @notice Throws if caller is not a registered slasher\\n error SlasherUnexistent();\\n\\n /// @notice Throws if the address is already a registered disputer\\n error DisputerExistent();\\n\\n /// @notice Throws if caller is not a registered disputer\\n error DisputerUnexistent();\\n\\n /// @notice Throws if the msg.sender is not a slasher or is not a part of governance\\n error OnlySlasher();\\n\\n /// @notice Throws if the msg.sender is not a disputer or is not a part of governance\\n error OnlyDisputer();\\n\\n // Methods\\n\\n /// @notice Registers a slasher by updating the slashers mapping\\n function addSlasher(address _slasher) external;\\n\\n /// @notice Removes a slasher by updating the slashers mapping\\n function removeSlasher(address _slasher) external;\\n\\n /// @notice Registers a disputer by updating the disputers mapping\\n function addDisputer(address _disputer) external;\\n\\n /// @notice Removes a disputer by updating the disputers mapping\\n function removeDisputer(address _disputer) external;\\n}\\n\",\"keccak256\":\"0xc0a19b0dfac535cbffabc0d76cb0569618dedb922b0413bc12358efa47dc32bf\",\"license\":\"MIT\"}},\"version\":1}", + "bytecode": "0x60a0604052612af8600255612ee0600355680ad78ebc5ac62000006004556184d06005556006805463ffffffff191661025817905564037e11d60060075563773594006008553480156200005257600080fd5b50604051620020d3380380620020d38339810160408190526200007591620002de565b8383838383838383816001600160a01b038116620000a65760405163d92e233d60e01b815260040160405180910390fd5b600080546001600160a01b03199081166001600160a01b03938416178255606087901b6001600160601b0319166080526009805490911686841617905590620000f390839087166200017b565b6040805180820182526001600160a01b0385168082528315156020928301819052600a80546001600160a81b0319168317600160a01b83021790558351918252918101919091529192507f554c636366d5fc882a9ab4b7b9d5181781d1a7076abe50ed410365620dcf4108910160405180910390a15050505050505050505050505062000360565b6000816001600160a01b0316836001600160a01b0316630dfe16816040518163ffffffff1660e01b815260040160206040518083038186803b158015620001c157600080fd5b505afa158015620001d6573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190620001fc91906200033b565b6001600160a01b03161490508015816200029c5750816001600160a01b0316836001600160a01b031663d21220a76040518163ffffffff1660e01b815260040160206040518083038186803b1580156200025557600080fd5b505afa1580156200026a573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906200029091906200033b565b6001600160a01b031614155b15620002bb5760405163db60809d60e01b815260040160405180910390fd5b92915050565b80516001600160a01b0381168114620002d957600080fd5b919050565b60008060008060808587031215620002f557600080fd5b6200030085620002c1565b93506200031060208601620002c1565b92506200032060408601620002c1565b91506200033060608601620002c1565b905092959194509250565b6000602082840312156200034e57600080fd5b6200035982620002c1565b9392505050565b60805160601c611d386200039b6000396000818161021b0152818161087a015281816108be01528181610f0a0152610ff40152611d386000f3fe608060405234801561001057600080fd5b50600436106102115760003560e01c80637b40c91311610125578063b93f5af0116100ad578063e244208b1161007c578063e244208b146104ed578063e3056a3414610500578063ed1bd76c14610513578063f235757f14610526578063fe10d7741461053957600080fd5b8063b93f5af01461045c578063c84993af1461046f578063ca4f280314610482578063dc686d91146104b557600080fd5b8063a0d27107116100f4578063a0d2710714610407578063a62611a21461041a578063ab5dce0014610423578063ab8cedc514610436578063b2e0df961461044957600080fd5b80637b40c913146103925780638561579c146103d05780638a9b1b09146103d95780639aaad679146103e257600080fd5b80632742b9e7116101a85780633facf242116101775780633facf24214610312578063435b21c11461031b578063516c332314610349578063607e48d41461035c578063696a437b1461036f57600080fd5b80632742b9e7146102da578063289adb44146102e357806337090c2f146102f65780633cc7ab30146102ff57600080fd5b806313f6986d116101e457806313f6986d14610295578063160e1e311461029d5780632248e82d146102b057806325f09e61146102d157600080fd5b806305e0b9a0146102165780630c340a241461025a5780630c5258351461026d578063117cfc1b14610282575b600080fd5b61023d7f000000000000000000000000000000000000000000000000000000000000000081565b6040516001600160a01b0390911681526020015b60405180910390f35b60005461023d906001600160a01b031681565b61028061027b36600461176f565b61054c565b005b60095461023d906001600160a01b031681565b6102806105b3565b6102806102ab36600461179d565b6105e8565b6102c36102be3660046117ba565b610646565b604051908152602001610251565b6102c361271081565b6102c360045481565b6102806102f136600461176f565b610679565b6102c360035481565b61028061030d36600461179d565b6106d9565b6102c360055481565b61032e61032936600461176f565b610779565b60408051938452602084019290925290820152606001610251565b6102c361035736600461176f565b6107a7565b61028061036a36600461176f565b610802565b61038261037d36600461179d565b610862565b6040519015158152602001610251565b600a546103b1906001600160a01b03811690600160a01b900460ff1682565b604080516001600160a01b039093168352901515602083015201610251565b6102c360025481565b6102c360085481565b6006546103f29063ffffffff1681565b60405163ffffffff9091168152602001610251565b6102c36104153660046117f5565b610915565b6102c360075481565b61028061043136600461176f565b610951565b6102c361044436600461182d565b6109b1565b61028061045736600461176f565b610a5a565b61028061046a366004611882565b610aba565b6102c361047d36600461176f565b610aee565b61049561049036600461179d565b610b00565b604080516001600160a01b03938416815292909116602083015201610251565b6104c86104c3366004611908565b610bee565b60408051600694850b81529290930b6020830152151591810191909152606001610251565b6102806104fb36600461176f565b610cf9565b60015461023d906001600160a01b031681565b6102c361052136600461176f565b610d59565b61028061053436600461179d565b610eb4565b6102c361054736600461179d565b610ee8565b6000546001600160a01b031633146105775760405163070545c960e51b815260040160405180910390fd5b60028190556040518181527f0919fdaaac0f59c6bc7eeef4f975d6163475220f1e4820d0bce99c84c51cac1d906020015b60405180910390a150565b6001546001600160a01b031633146105de57604051639ba0305d60e01b815260040160405180910390fd5b6105e6610f8e565b565b6000546001600160a01b031633146106135760405163070545c960e51b815260040160405180910390fd5b6001600160a01b03811661063a5760405163d92e233d60e01b815260040160405180910390fd5b61064381610fec565b50565b60008061065561035785610ee8565b905061067161271061066783866119d0565b6105219190611a05565b949350505050565b6000546001600160a01b031633146106a45760405163070545c960e51b815260040160405180910390fd5b60058190556040518181527fed847bdbab1a30becee18585f23c759bd06156561390d2e7fbffd18e74b56c9b906020016105a8565b6000546001600160a01b031633146107045760405163070545c960e51b815260040160405180910390fd5b6001600160a01b03811661072b5760405163d92e233d60e01b815260040160405180910390fd5b600980546001600160a01b0319166001600160a01b0383169081179091556040519081527fcf744e4fc39d49b6d8103035078629b8a3be95adc007b0d663e96bdff777b10a906020016105a8565b600080600061078f670de0b6b3a7640000610d59565b915061079a846107a7565b6005549095929450925050565b60006107b582600454611091565b91506000600454836002546003546107cd9190611a19565b6107d791906119d0565b6107e19190611a05565b6002546107ee9190611a30565b90506107fb6001826119d0565b9392505050565b6000546001600160a01b0316331461082d5760405163070545c960e51b815260040160405180910390fd5b60078190556040518181527ff1443dcc693c421058f429cf588bc37e5c8de2275c3771a810a5e4bf0a908a4b906020016105a8565b600080600061087084610b00565b80925081935050507f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316826001600160a01b031614156108bc575060019392505050565b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316816001600160a01b03161461090e57604051637d7c8f2760e11b815260040160405180910390fd5b5050919050565b60008061092e61092984600687900b611a48565b6110a7565b9050610948600160601b86836001600160a01b03166114c0565b95945050505050565b6000546001600160a01b0316331461097c5760405163070545c960e51b815260040160405180910390fd5b60048190556040518181527feac367d684b6ac6c6ae7e3e852c06f17e6354e0f1e7122832c3e6d17e0a2b71e906020016105a8565b6000806109c561092984600687900b611a48565b90506001600160801b036001600160a01b03821611610a155760006109f36001600160a01b038316806119d0565b9050610a0d600160c01b876001600160801b0316836114c0565b925050610a52565b6000610a346001600160a01b03831680680100000000000000006114c0565b9050610a4e600160801b876001600160801b0316836114c0565b9250505b509392505050565b6000546001600160a01b03163314610a855760405163070545c960e51b815260040160405180910390fd5b60038190556040518181527fa1292b4e7a0d916ccfd2bc83858b05f328e344d1f0f507d97ac66723ac7c2aaa906020016105a8565b6000546001600160a01b03163314610ae55760405163070545c960e51b815260040160405180910390fd5b6106438161156e565b6000610afa3283610646565b92915050565b600080826001600160a01b0316630dfe16816040518163ffffffff1660e01b815260040160206040518083038186803b158015610b3c57600080fd5b505afa158015610b50573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610b749190611a76565b836001600160a01b031663d21220a76040518163ffffffff1660e01b815260040160206040518083038186803b158015610bad57600080fd5b505afa158015610bc1573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610be59190611a76565b91509150915091565b6000806000846001600160a01b031663883bdbfd856040518263ffffffff1660e01b8152600401610c1f9190611a93565b60006040518083038186803b158015610c3757600080fd5b505afa925050508015610c6c57506040513d6000823e601f3d908101601f19168201604052610c699190810190611b4c565b60015b610ca6573d808015610c9a576040519150601f19603f3d011682016040523d82523d6000602084013e610c9f565b606091505b5050610cf2565b81600081518110610cb957610cb9611c11565b60200260200101519450600182511115610ceb5781600181518110610ce057610ce0611c11565b602002602001015193505b6001925050505b9250925092565b6000546001600160a01b03163314610d245760405163070545c960e51b815260040160405180910390fd5b60088190556040518181527f403b461d2c3bcad840d570faac033e4e69e5649645ce89f3c5b4e28d54159221906020016105a8565b604080516002808252606082018352600092839291906020830190803683375050600654825192935063ffffffff16918391506001908110610d9d57610d9d611c11565b63ffffffff90921660209283029190910190910152600a5460405163883bdbfd60e01b81526000916001600160a01b03169063883bdbfd90610de3908590600401611a93565b60006040518083038186803b158015610dfb57600080fd5b505afa158015610e0f573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052610e379190810190611b4c565b509050600081600181518110610e4f57610e4f611c11565b602002602001015182600081518110610e6a57610e6a611c11565b6020026020010151610e7c9190611c27565b600a54909150610948908690600160a01b900460ff16610ea457610e9f83611c77565b610ea6565b825b60065463ffffffff166109b1565b6000546001600160a01b03163314610edf5760405163070545c960e51b815260040160405180910390fd5b610643816115b6565b60095460405163a39744b560e01b81526001600160a01b0383811660048301527f000000000000000000000000000000000000000000000000000000000000000081166024830152600092169063a39744b59060440160206040518083038186803b158015610f5657600080fd5b505afa158015610f6a573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610afa9190611c9e565b60018054600080546001600160a01b0383166001600160a01b031991821681179092559091169091556040519081527f5d5d6e01b731c3e68060f7fe13156f6197d4aeffc2d6f498e34c717ae616b7349060200160405180910390a1565b6000611018827f0000000000000000000000000000000000000000000000000000000000000000611639565b6040805180820182526001600160a01b0385168082528315156020928301819052600a80546001600160a81b0319168317600160a01b83021790558351918252918101919091529192507f554c636366d5fc882a9ab4b7b9d5181781d1a7076abe50ed410365620dcf4108910160405180910390a15050565b60008183106110a057816107fb565b5090919050565b60008060008360020b126110be578260020b6110cb565b8260020b6110cb90611cb7565b90506110da620d89e719611cd4565b60020b8111156111145760405162461bcd60e51b81526020600482015260016024820152601560fa1b604482015260640160405180910390fd5b60006001821661112857600160801b61113a565b6ffffcb933bd6fad37aa2d162d1a5940015b70ffffffffffffffffffffffffffffffffff1690506002821615611179576080611174826ffff97272373d413259a46990580e213a6119d0565b901c90505b60048216156111a357608061119e826ffff2e50f5f656932ef12357cf3c7fdcc6119d0565b901c90505b60088216156111cd5760806111c8826fffe5caca7e10e4e61c3624eaa0941cd06119d0565b901c90505b60108216156111f75760806111f2826fffcb9843d60f6159c9db58835c9266446119d0565b901c90505b602082161561122157608061121c826fff973b41fa98c081472e6896dfb254c06119d0565b901c90505b604082161561124b576080611246826fff2ea16466c96a3843ec78b326b528616119d0565b901c90505b6080821615611275576080611270826ffe5dee046a99a2a811c461f1969c30536119d0565b901c90505b6101008216156112a057608061129b826ffcbe86c7900a88aedcffc83b479aa3a46119d0565b901c90505b6102008216156112cb5760806112c6826ff987a7253ac413176f2b074cf7815e546119d0565b901c90505b6104008216156112f65760806112f1826ff3392b0822b70005940c7a398e4b70f36119d0565b901c90505b61080082161561132157608061131c826fe7159475a2c29b7443b29c7fa6e889d96119d0565b901c90505b61100082161561134c576080611347826fd097f3bdfd2022b8845ad8f792aa58256119d0565b901c90505b612000821615611377576080611372826fa9f746462d870fdf8a65dc1f90e061e56119d0565b901c90505b6140008216156113a257608061139d826f70d869a156d2a1b890bb3df62baf32f76119d0565b901c90505b6180008216156113cd5760806113c8826f31be135f97d08fd981231505542fcfa66119d0565b901c90505b620100008216156113f95760806113f4826f09aa508b5b7a84e1c677de54f3e99bc96119d0565b901c90505b6202000082161561142457608061141f826e5d6af8dedb81196699c329225ee6046119d0565b901c90505b6204000082161561144e576080611449826d2216e584f5fa1ea926041bedfe986119d0565b901c90505b62080000821615611476576080611471826b048a170391f7dc42444e8fa26119d0565b901c90505b60008460020b13156114915761148e81600019611a05565b90505b6114a064010000000082611cee565b156114ac5760016114af565b60005b6106719060ff16602083901c611a30565b6000808060001985870985870292508281108382030391505080600014156114fa57600084116114ef57600080fd5b5082900490506107fb565b80841161150657600080fd5b600084868809600260036001881981018916988990049182028318808302840302808302840302808302840302808302840302808302840302918202909203026000889003889004909101858311909403939093029303949094049190911702949350505050565b6006805463ffffffff191663ffffffff83169081179091556040519081527fc806e26fb64e3a95f4b70abf4d87280555696244d01068b5f45b0e515aceb1de906020016105a8565b6001600160a01b0381166115dd5760405163d92e233d60e01b815260040160405180910390fd5b600180546001600160a01b0319166001600160a01b038381169182179092556000546040805191909316815260208101919091527f6353ec38ac394f8be94bfafcdd3580d356470599059eaeebedc3207e1cc03dec91016105a8565b6000816001600160a01b0316836001600160a01b0316630dfe16816040518163ffffffff1660e01b815260040160206040518083038186803b15801561167e57600080fd5b505afa158015611692573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906116b69190611a76565b6001600160a01b03161490508015816117515750816001600160a01b0316836001600160a01b031663d21220a76040518163ffffffff1660e01b815260040160206040518083038186803b15801561170d57600080fd5b505afa158015611721573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906117459190611a76565b6001600160a01b031614155b15610afa5760405163db60809d60e01b815260040160405180910390fd5b60006020828403121561178157600080fd5b5035919050565b6001600160a01b038116811461064357600080fd5b6000602082840312156117af57600080fd5b81356107fb81611788565b600080604083850312156117cd57600080fd5b82356117d881611788565b946020939093013593505050565b8060060b811461064357600080fd5b60008060006060848603121561180a57600080fd5b83359250602084013561181c816117e6565b929592945050506040919091013590565b60008060006060848603121561184257600080fd5b83356001600160801b038116811461185957600080fd5b9250602084013561181c816117e6565b803563ffffffff8116811461187d57600080fd5b919050565b60006020828403121561189457600080fd5b6107fb82611869565b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f1916810167ffffffffffffffff811182821017156118dc576118dc61189d565b604052919050565b600067ffffffffffffffff8211156118fe576118fe61189d565b5060051b60200190565b6000806040838503121561191b57600080fd5b823561192681611788565b915060208381013567ffffffffffffffff81111561194357600080fd5b8401601f8101861361195457600080fd5b8035611967611962826118e4565b6118b3565b81815260059190911b8201830190838101908883111561198657600080fd5b928401925b828410156119ab5761199c84611869565b8252928401929084019061198b565b80955050505050509250929050565b634e487b7160e01b600052601160045260246000fd5b60008160001904831182151516156119ea576119ea6119ba565b500290565b634e487b7160e01b600052601260045260246000fd5b600082611a1457611a146119ef565b500490565b600082821015611a2b57611a2b6119ba565b500390565b60008219821115611a4357611a436119ba565b500190565b600082611a5757611a576119ef565b600160ff1b821460001984141615611a7157611a716119ba565b500590565b600060208284031215611a8857600080fd5b81516107fb81611788565b6020808252825182820181905260009190848201906040850190845b81811015611ad157835163ffffffff1683529284019291840191600101611aaf565b50909695505050505050565b600082601f830112611aee57600080fd5b81516020611afe611962836118e4565b82815260059290921b84018101918181019086841115611b1d57600080fd5b8286015b84811015611b41578051611b3481611788565b8352918301918301611b21565b509695505050505050565b60008060408385031215611b5f57600080fd5b825167ffffffffffffffff80821115611b7757600080fd5b818501915085601f830112611b8b57600080fd5b81516020611b9b611962836118e4565b82815260059290921b84018101918181019089841115611bba57600080fd5b948201945b83861015611be1578551611bd2816117e6565b82529482019490820190611bbf565b91880151919650909350505080821115611bfa57600080fd5b50611c0785828601611add565b9150509250929050565b634e487b7160e01b600052603260045260246000fd5b60008160060b8360060b6000811281667fffffffffffff1901831281151615611c5257611c526119ba565b81667fffffffffffff018313811615611c6d57611c6d6119ba565b5090039392505050565b60008160060b667fffffffffffff19811415611c9557611c956119ba565b60000392915050565b600060208284031215611cb057600080fd5b5051919050565b6000600160ff1b821415611ccd57611ccd6119ba565b5060000390565b60008160020b627fffff19811415611c9557611c956119ba565b600082611cfd57611cfd6119ef565b50069056fea26469706673582212200d3afc685c176654c8969d9c4e3359274abb6ab62d8b1824a8abaf7ea2d8536364736f6c63430008080033", + "deployedBytecode": "0x608060405234801561001057600080fd5b50600436106102115760003560e01c80637b40c91311610125578063b93f5af0116100ad578063e244208b1161007c578063e244208b146104ed578063e3056a3414610500578063ed1bd76c14610513578063f235757f14610526578063fe10d7741461053957600080fd5b8063b93f5af01461045c578063c84993af1461046f578063ca4f280314610482578063dc686d91146104b557600080fd5b8063a0d27107116100f4578063a0d2710714610407578063a62611a21461041a578063ab5dce0014610423578063ab8cedc514610436578063b2e0df961461044957600080fd5b80637b40c913146103925780638561579c146103d05780638a9b1b09146103d95780639aaad679146103e257600080fd5b80632742b9e7116101a85780633facf242116101775780633facf24214610312578063435b21c11461031b578063516c332314610349578063607e48d41461035c578063696a437b1461036f57600080fd5b80632742b9e7146102da578063289adb44146102e357806337090c2f146102f65780633cc7ab30146102ff57600080fd5b806313f6986d116101e457806313f6986d14610295578063160e1e311461029d5780632248e82d146102b057806325f09e61146102d157600080fd5b806305e0b9a0146102165780630c340a241461025a5780630c5258351461026d578063117cfc1b14610282575b600080fd5b61023d7f000000000000000000000000000000000000000000000000000000000000000081565b6040516001600160a01b0390911681526020015b60405180910390f35b60005461023d906001600160a01b031681565b61028061027b36600461176f565b61054c565b005b60095461023d906001600160a01b031681565b6102806105b3565b6102806102ab36600461179d565b6105e8565b6102c36102be3660046117ba565b610646565b604051908152602001610251565b6102c361271081565b6102c360045481565b6102806102f136600461176f565b610679565b6102c360035481565b61028061030d36600461179d565b6106d9565b6102c360055481565b61032e61032936600461176f565b610779565b60408051938452602084019290925290820152606001610251565b6102c361035736600461176f565b6107a7565b61028061036a36600461176f565b610802565b61038261037d36600461179d565b610862565b6040519015158152602001610251565b600a546103b1906001600160a01b03811690600160a01b900460ff1682565b604080516001600160a01b039093168352901515602083015201610251565b6102c360025481565b6102c360085481565b6006546103f29063ffffffff1681565b60405163ffffffff9091168152602001610251565b6102c36104153660046117f5565b610915565b6102c360075481565b61028061043136600461176f565b610951565b6102c361044436600461182d565b6109b1565b61028061045736600461176f565b610a5a565b61028061046a366004611882565b610aba565b6102c361047d36600461176f565b610aee565b61049561049036600461179d565b610b00565b604080516001600160a01b03938416815292909116602083015201610251565b6104c86104c3366004611908565b610bee565b60408051600694850b81529290930b6020830152151591810191909152606001610251565b6102806104fb36600461176f565b610cf9565b60015461023d906001600160a01b031681565b6102c361052136600461176f565b610d59565b61028061053436600461179d565b610eb4565b6102c361054736600461179d565b610ee8565b6000546001600160a01b031633146105775760405163070545c960e51b815260040160405180910390fd5b60028190556040518181527f0919fdaaac0f59c6bc7eeef4f975d6163475220f1e4820d0bce99c84c51cac1d906020015b60405180910390a150565b6001546001600160a01b031633146105de57604051639ba0305d60e01b815260040160405180910390fd5b6105e6610f8e565b565b6000546001600160a01b031633146106135760405163070545c960e51b815260040160405180910390fd5b6001600160a01b03811661063a5760405163d92e233d60e01b815260040160405180910390fd5b61064381610fec565b50565b60008061065561035785610ee8565b905061067161271061066783866119d0565b6105219190611a05565b949350505050565b6000546001600160a01b031633146106a45760405163070545c960e51b815260040160405180910390fd5b60058190556040518181527fed847bdbab1a30becee18585f23c759bd06156561390d2e7fbffd18e74b56c9b906020016105a8565b6000546001600160a01b031633146107045760405163070545c960e51b815260040160405180910390fd5b6001600160a01b03811661072b5760405163d92e233d60e01b815260040160405180910390fd5b600980546001600160a01b0319166001600160a01b0383169081179091556040519081527fcf744e4fc39d49b6d8103035078629b8a3be95adc007b0d663e96bdff777b10a906020016105a8565b600080600061078f670de0b6b3a7640000610d59565b915061079a846107a7565b6005549095929450925050565b60006107b582600454611091565b91506000600454836002546003546107cd9190611a19565b6107d791906119d0565b6107e19190611a05565b6002546107ee9190611a30565b90506107fb6001826119d0565b9392505050565b6000546001600160a01b0316331461082d5760405163070545c960e51b815260040160405180910390fd5b60078190556040518181527ff1443dcc693c421058f429cf588bc37e5c8de2275c3771a810a5e4bf0a908a4b906020016105a8565b600080600061087084610b00565b80925081935050507f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316826001600160a01b031614156108bc575060019392505050565b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316816001600160a01b03161461090e57604051637d7c8f2760e11b815260040160405180910390fd5b5050919050565b60008061092e61092984600687900b611a48565b6110a7565b9050610948600160601b86836001600160a01b03166114c0565b95945050505050565b6000546001600160a01b0316331461097c5760405163070545c960e51b815260040160405180910390fd5b60048190556040518181527feac367d684b6ac6c6ae7e3e852c06f17e6354e0f1e7122832c3e6d17e0a2b71e906020016105a8565b6000806109c561092984600687900b611a48565b90506001600160801b036001600160a01b03821611610a155760006109f36001600160a01b038316806119d0565b9050610a0d600160c01b876001600160801b0316836114c0565b925050610a52565b6000610a346001600160a01b03831680680100000000000000006114c0565b9050610a4e600160801b876001600160801b0316836114c0565b9250505b509392505050565b6000546001600160a01b03163314610a855760405163070545c960e51b815260040160405180910390fd5b60038190556040518181527fa1292b4e7a0d916ccfd2bc83858b05f328e344d1f0f507d97ac66723ac7c2aaa906020016105a8565b6000546001600160a01b03163314610ae55760405163070545c960e51b815260040160405180910390fd5b6106438161156e565b6000610afa3283610646565b92915050565b600080826001600160a01b0316630dfe16816040518163ffffffff1660e01b815260040160206040518083038186803b158015610b3c57600080fd5b505afa158015610b50573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610b749190611a76565b836001600160a01b031663d21220a76040518163ffffffff1660e01b815260040160206040518083038186803b158015610bad57600080fd5b505afa158015610bc1573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610be59190611a76565b91509150915091565b6000806000846001600160a01b031663883bdbfd856040518263ffffffff1660e01b8152600401610c1f9190611a93565b60006040518083038186803b158015610c3757600080fd5b505afa925050508015610c6c57506040513d6000823e601f3d908101601f19168201604052610c699190810190611b4c565b60015b610ca6573d808015610c9a576040519150601f19603f3d011682016040523d82523d6000602084013e610c9f565b606091505b5050610cf2565b81600081518110610cb957610cb9611c11565b60200260200101519450600182511115610ceb5781600181518110610ce057610ce0611c11565b602002602001015193505b6001925050505b9250925092565b6000546001600160a01b03163314610d245760405163070545c960e51b815260040160405180910390fd5b60088190556040518181527f403b461d2c3bcad840d570faac033e4e69e5649645ce89f3c5b4e28d54159221906020016105a8565b604080516002808252606082018352600092839291906020830190803683375050600654825192935063ffffffff16918391506001908110610d9d57610d9d611c11565b63ffffffff90921660209283029190910190910152600a5460405163883bdbfd60e01b81526000916001600160a01b03169063883bdbfd90610de3908590600401611a93565b60006040518083038186803b158015610dfb57600080fd5b505afa158015610e0f573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052610e379190810190611b4c565b509050600081600181518110610e4f57610e4f611c11565b602002602001015182600081518110610e6a57610e6a611c11565b6020026020010151610e7c9190611c27565b600a54909150610948908690600160a01b900460ff16610ea457610e9f83611c77565b610ea6565b825b60065463ffffffff166109b1565b6000546001600160a01b03163314610edf5760405163070545c960e51b815260040160405180910390fd5b610643816115b6565b60095460405163a39744b560e01b81526001600160a01b0383811660048301527f000000000000000000000000000000000000000000000000000000000000000081166024830152600092169063a39744b59060440160206040518083038186803b158015610f5657600080fd5b505afa158015610f6a573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610afa9190611c9e565b60018054600080546001600160a01b0383166001600160a01b031991821681179092559091169091556040519081527f5d5d6e01b731c3e68060f7fe13156f6197d4aeffc2d6f498e34c717ae616b7349060200160405180910390a1565b6000611018827f0000000000000000000000000000000000000000000000000000000000000000611639565b6040805180820182526001600160a01b0385168082528315156020928301819052600a80546001600160a81b0319168317600160a01b83021790558351918252918101919091529192507f554c636366d5fc882a9ab4b7b9d5181781d1a7076abe50ed410365620dcf4108910160405180910390a15050565b60008183106110a057816107fb565b5090919050565b60008060008360020b126110be578260020b6110cb565b8260020b6110cb90611cb7565b90506110da620d89e719611cd4565b60020b8111156111145760405162461bcd60e51b81526020600482015260016024820152601560fa1b604482015260640160405180910390fd5b60006001821661112857600160801b61113a565b6ffffcb933bd6fad37aa2d162d1a5940015b70ffffffffffffffffffffffffffffffffff1690506002821615611179576080611174826ffff97272373d413259a46990580e213a6119d0565b901c90505b60048216156111a357608061119e826ffff2e50f5f656932ef12357cf3c7fdcc6119d0565b901c90505b60088216156111cd5760806111c8826fffe5caca7e10e4e61c3624eaa0941cd06119d0565b901c90505b60108216156111f75760806111f2826fffcb9843d60f6159c9db58835c9266446119d0565b901c90505b602082161561122157608061121c826fff973b41fa98c081472e6896dfb254c06119d0565b901c90505b604082161561124b576080611246826fff2ea16466c96a3843ec78b326b528616119d0565b901c90505b6080821615611275576080611270826ffe5dee046a99a2a811c461f1969c30536119d0565b901c90505b6101008216156112a057608061129b826ffcbe86c7900a88aedcffc83b479aa3a46119d0565b901c90505b6102008216156112cb5760806112c6826ff987a7253ac413176f2b074cf7815e546119d0565b901c90505b6104008216156112f65760806112f1826ff3392b0822b70005940c7a398e4b70f36119d0565b901c90505b61080082161561132157608061131c826fe7159475a2c29b7443b29c7fa6e889d96119d0565b901c90505b61100082161561134c576080611347826fd097f3bdfd2022b8845ad8f792aa58256119d0565b901c90505b612000821615611377576080611372826fa9f746462d870fdf8a65dc1f90e061e56119d0565b901c90505b6140008216156113a257608061139d826f70d869a156d2a1b890bb3df62baf32f76119d0565b901c90505b6180008216156113cd5760806113c8826f31be135f97d08fd981231505542fcfa66119d0565b901c90505b620100008216156113f95760806113f4826f09aa508b5b7a84e1c677de54f3e99bc96119d0565b901c90505b6202000082161561142457608061141f826e5d6af8dedb81196699c329225ee6046119d0565b901c90505b6204000082161561144e576080611449826d2216e584f5fa1ea926041bedfe986119d0565b901c90505b62080000821615611476576080611471826b048a170391f7dc42444e8fa26119d0565b901c90505b60008460020b13156114915761148e81600019611a05565b90505b6114a064010000000082611cee565b156114ac5760016114af565b60005b6106719060ff16602083901c611a30565b6000808060001985870985870292508281108382030391505080600014156114fa57600084116114ef57600080fd5b5082900490506107fb565b80841161150657600080fd5b600084868809600260036001881981018916988990049182028318808302840302808302840302808302840302808302840302808302840302918202909203026000889003889004909101858311909403939093029303949094049190911702949350505050565b6006805463ffffffff191663ffffffff83169081179091556040519081527fc806e26fb64e3a95f4b70abf4d87280555696244d01068b5f45b0e515aceb1de906020016105a8565b6001600160a01b0381166115dd5760405163d92e233d60e01b815260040160405180910390fd5b600180546001600160a01b0319166001600160a01b038381169182179092556000546040805191909316815260208101919091527f6353ec38ac394f8be94bfafcdd3580d356470599059eaeebedc3207e1cc03dec91016105a8565b6000816001600160a01b0316836001600160a01b0316630dfe16816040518163ffffffff1660e01b815260040160206040518083038186803b15801561167e57600080fd5b505afa158015611692573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906116b69190611a76565b6001600160a01b03161490508015816117515750816001600160a01b0316836001600160a01b031663d21220a76040518163ffffffff1660e01b815260040160206040518083038186803b15801561170d57600080fd5b505afa158015611721573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906117459190611a76565b6001600160a01b031614155b15610afa5760405163db60809d60e01b815260040160405180910390fd5b60006020828403121561178157600080fd5b5035919050565b6001600160a01b038116811461064357600080fd5b6000602082840312156117af57600080fd5b81356107fb81611788565b600080604083850312156117cd57600080fd5b82356117d881611788565b946020939093013593505050565b8060060b811461064357600080fd5b60008060006060848603121561180a57600080fd5b83359250602084013561181c816117e6565b929592945050506040919091013590565b60008060006060848603121561184257600080fd5b83356001600160801b038116811461185957600080fd5b9250602084013561181c816117e6565b803563ffffffff8116811461187d57600080fd5b919050565b60006020828403121561189457600080fd5b6107fb82611869565b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f1916810167ffffffffffffffff811182821017156118dc576118dc61189d565b604052919050565b600067ffffffffffffffff8211156118fe576118fe61189d565b5060051b60200190565b6000806040838503121561191b57600080fd5b823561192681611788565b915060208381013567ffffffffffffffff81111561194357600080fd5b8401601f8101861361195457600080fd5b8035611967611962826118e4565b6118b3565b81815260059190911b8201830190838101908883111561198657600080fd5b928401925b828410156119ab5761199c84611869565b8252928401929084019061198b565b80955050505050509250929050565b634e487b7160e01b600052601160045260246000fd5b60008160001904831182151516156119ea576119ea6119ba565b500290565b634e487b7160e01b600052601260045260246000fd5b600082611a1457611a146119ef565b500490565b600082821015611a2b57611a2b6119ba565b500390565b60008219821115611a4357611a436119ba565b500190565b600082611a5757611a576119ef565b600160ff1b821460001984141615611a7157611a716119ba565b500590565b600060208284031215611a8857600080fd5b81516107fb81611788565b6020808252825182820181905260009190848201906040850190845b81811015611ad157835163ffffffff1683529284019291840191600101611aaf565b50909695505050505050565b600082601f830112611aee57600080fd5b81516020611afe611962836118e4565b82815260059290921b84018101918181019086841115611b1d57600080fd5b8286015b84811015611b41578051611b3481611788565b8352918301918301611b21565b509695505050505050565b60008060408385031215611b5f57600080fd5b825167ffffffffffffffff80821115611b7757600080fd5b818501915085601f830112611b8b57600080fd5b81516020611b9b611962836118e4565b82815260059290921b84018101918181019089841115611bba57600080fd5b948201945b83861015611be1578551611bd2816117e6565b82529482019490820190611bbf565b91880151919650909350505080821115611bfa57600080fd5b50611c0785828601611add565b9150509250929050565b634e487b7160e01b600052603260045260246000fd5b60008160060b8360060b6000811281667fffffffffffff1901831281151615611c5257611c526119ba565b81667fffffffffffff018313811615611c6d57611c6d6119ba565b5090039392505050565b60008160060b667fffffffffffff19811415611c9557611c956119ba565b60000392915050565b600060208284031215611cb057600080fd5b5051919050565b6000600160ff1b821415611ccd57611ccd6119ba565b5060000390565b60008160020b627fffff19811415611c9557611c956119ba565b600082611cfd57611cfd6119ef565b50069056fea26469706673582212200d3afc685c176654c8969d9c4e3359274abb6ab62d8b1824a8abaf7ea2d8536364736f6c63430008080033", + "devdoc": { + "kind": "dev", + "methods": { + "bonds(address)": { + "params": { + "_keeper": "The address of the keeper to check" + }, + "returns": { + "_amountBonded": "The amount of KP3R the keeper has bonded" + } + }, + "getKP3RsAtTick(uint256,int56,uint256)": { + "params": { + "_liquidityAmount": "Amount of liquidity to be converted", + "_tickDifference": "Tick value used to calculate the quote", + "_timeInterval": "Time value used to calculate the quote" + }, + "returns": { + "_kp3rAmount": "Amount of KP3R tokens underlying on the given liquidity" + } + }, + "getPaymentParams(uint256)": { + "params": { + "_bonds": "Amount of bonded KP3R owned by the keeper" + }, + "returns": { + "_boost": "Multiplier per gas unit. Takes into account the base fee and the amount of bonded KP3R", + "_extra": "Amount of extra gas that should be added to the gas spent", + "_oneEthQuote": "Amount of KP3R tokens equivalent to 1 ETH" + } + }, + "getPoolTokens(address)": { + "params": { + "_pool": "Address of the correspondant pool" + }, + "returns": { + "_token0": "Address of the first token of the pair", + "_token1": "Address of the second token of the pair" + } + }, + "getQuoteAtTick(uint128,int56,uint256)": { + "params": { + "_baseAmount": "Amount of token to be converted", + "_tickDifference": "Tick value used to calculate the quote", + "_timeInterval": "Time value used to calculate the quote" + }, + "returns": { + "_quoteAmount": "Amount of credits deserved for the baseAmount at the tick value" + } + }, + "getRewardAmount(uint256)": { + "params": { + "_gasUsed": "The amount of gas used that will be rewarded" + }, + "returns": { + "_amount": "The amount of KP3R that should be awarded to tx.origin" + } + }, + "getRewardAmountFor(address,uint256)": { + "params": { + "_gasUsed": "The amount of gas used that will be rewarded", + "_keeper": "The address of the keeper to check" + }, + "returns": { + "_kp3r": "The amount of KP3R that should be awarded to the keeper" + } + }, + "getRewardBoostFor(uint256)": { + "details": "If the keeper has no bonds, boost should be +10% of gas cost, if keeper has max bonds, +20%", + "params": { + "_bonds": "The amount of KP3R tokens bonded by the keeper" + }, + "returns": { + "_rewardBoost": "The reward boost that corresponds to the keeper" + } + }, + "isKP3RToken0(address)": { + "params": { + "_pool": "Address of the correspondant pool" + }, + "returns": { + "_isKP3RToken0": "Boolean indicating the order of the tokens in the pair" + } + }, + "observe(address,uint32[])": { + "params": { + "_pool": "Address of the pool to observe", + "_secondsAgo": "Array with time references to observe" + }, + "returns": { + "_success": "Boolean indicating if the observe call was succesfull", + "_tickCumulative1": "Cumulative sum of ticks until first time reference", + "_tickCumulative2": "Cumulative sum of ticks until second time reference" + } + }, + "quote(uint256)": { + "details": "This function allows us to calculate how much KP3R we should pay to a keeper for things expressed in ETH, like gas", + "params": { + "_eth": "The amount of ETH" + }, + "returns": { + "_amountOut": "The amount of KP3R" + } + }, + "setKeep3rV2(address)": { + "params": { + "_keep3rV2": "The address of Keep3r V2" + } + }, + "setKp3rWethPool(address)": { + "params": { + "_poolAddress": "The address of the KP3R-WETH pool" + } + }, + "setMaxBoost(uint256)": { + "params": { + "_maxBoost": "The maximum boost multiplier" + } + }, + "setMinBaseFee(uint256)": { + "params": { + "_minBaseFee": "The minimum rewarded gas fee" + } + }, + "setMinBoost(uint256)": { + "params": { + "_minBoost": "The minimum boost multiplier" + } + }, + "setMinPriorityFee(uint256)": { + "params": { + "_minPriorityFee": "The minimum rewarded priority fee" + } + }, + "setPendingGovernor(address)": { + "params": { + "_pendingGovernor": "Address of the proposed new governor" + } + }, + "setQuoteTwapTime(uint32)": { + "params": { + "_quoteTwapTime": "The twap time for quoting" + } + }, + "setTargetBond(uint256)": { + "params": { + "_targetBond": "The target bond amount" + } + }, + "setWorkExtraGas(uint256)": { + "params": { + "_workExtraGas": "The work extra gas" + } + } + }, + "version": 1 + }, + "userdoc": { + "errors": { + "InvalidAddress()": [ + { + "notice": "Thrown if an address is invalid" + } + ], + "InvalidAmount()": [ + { + "notice": "Thrown if an amount is invalid" + } + ], + "InvalidOraclePool()": [ + { + "notice": "Throws when pool does not have KP3R as token0 nor token1" + } + ], + "LengthMismatch()": [ + { + "notice": "Thrown if the lengths of a set of lists mismatch" + } + ], + "LiquidityPairInvalid()": [ + { + "notice": "Throws when none of the tokens in the liquidity pair is KP3R" + } + ], + "OnlyGovernor()": [ + { + "notice": "Thrown if a non-governor user tries to call a OnlyGovernor function" + } + ], + "OnlyPendingGovernor()": [ + { + "notice": "Thrown if a non-pending-governor user tries to call a OnlyPendingGovernor function" + } + ], + "ZeroAddress()": [ + { + "notice": "Thrown if an address is the zero address" + } + ], + "ZeroAmount()": [ + { + "notice": "Thrown if an amount is zero" + } + ] + }, + "events": { + "Keep3rV2Change(address)": { + "notice": "Emitted when the Keep3r V2 address is changed" + }, + "Kp3rWethPoolChange(address,bool)": { + "notice": "Emitted when the kp3r weth pool is changed" + }, + "MaxBoostChange(uint256)": { + "notice": "Emitted when the maximum boost multiplier is changed" + }, + "MinBaseFeeChange(uint256)": { + "notice": "Emitted when minimum rewarded gas fee is changed" + }, + "MinBoostChange(uint256)": { + "notice": "Emitted when the minimum boost multiplier is changed" + }, + "MinPriorityFeeChange(uint256)": { + "notice": "Emitted when minimum rewarded priority fee is changed" + }, + "PendingGovernorAccepted(address)": { + "notice": "Emitted when a new governor is set" + }, + "PendingGovernorSet(address,address)": { + "notice": "Emitted when a new pending governor is set" + }, + "QuoteTwapTimeChange(uint32)": { + "notice": "Emitted when the quote twap time is changed" + }, + "TargetBondChange(uint256)": { + "notice": "Emitted when the target bond amount is changed" + }, + "WorkExtraGasChange(uint256)": { + "notice": "Emitted when the work extra gas amount is changed" + } + }, + "kind": "user", + "methods": { + "BOOST_BASE()": { + "notice": "The boost base used to calculate the boost rewards for the keeper" + }, + "KP3R()": { + "notice": "Address of KP3R token" + }, + "acceptPendingGovernor()": { + "notice": "Allows a proposed governor to accept the governance" + }, + "bonds(address)": { + "notice": "Returns the amount of KP3R the keeper has bonded" + }, + "getKP3RsAtTick(uint256,int56,uint256)": { + "notice": "Given a tick and a liquidity amount, calculates the underlying KP3R tokens" + }, + "getPaymentParams(uint256)": { + "notice": "Get multiplier, quote, and extra, in order to calculate keeper payment" + }, + "getPoolTokens(address)": { + "notice": "Given a pool address, returns the underlying tokens of the pair" + }, + "getQuoteAtTick(uint128,int56,uint256)": { + "notice": "Given a tick and a token amount, calculates the output in correspondant token" + }, + "getRewardAmount(uint256)": { + "notice": "Calculates the reward (in KP3R) that corresponds to tx.origin for using gas" + }, + "getRewardAmountFor(address,uint256)": { + "notice": "Calculates the reward (in KP3R) that corresponds to a keeper for using gas" + }, + "getRewardBoostFor(uint256)": { + "notice": "Calculates the boost in the reward given to a keeper based on the amount of KP3R that keeper has bonded" + }, + "isKP3RToken0(address)": { + "notice": "Defines the order of the tokens in the pair for twap calculations" + }, + "keep3rV2()": { + "notice": "Address of Keep3r V2" + }, + "kp3rWethPool()": { + "notice": "KP3R-WETH pool that is being used as oracle" + }, + "maxBoost()": { + "notice": "The maximum multiplier used to calculate the amount of gas paid to the Keeper for the gas used to perform a job For example: if the quoted gas used is 1000, then the maximum amount to be paid will be 1000 * maxBoost / BOOST_BASE" + }, + "minBaseFee()": { + "notice": "The minimum base fee that is used to calculate keeper rewards" + }, + "minBoost()": { + "notice": "The minimum multiplier used to calculate the amount of gas paid to the Keeper for the gas used to perform a job For example: if the quoted gas used is 1000, then the minimum amount to be paid will be 1000 * minBoost / BOOST_BASE" + }, + "minPriorityFee()": { + "notice": "The minimum priority fee that is also rewarded for keepers" + }, + "observe(address,uint32[])": { + "notice": "Given an array of secondsAgo, returns UniswapV3 pool cumulatives at that moment" + }, + "quote(uint256)": { + "notice": "Calculates the amount of KP3R that corresponds to the ETH passed into the function" + }, + "quoteTwapTime()": { + "notice": "The twap time for quoting" + }, + "setKeep3rV2(address)": { + "notice": "Sets the Keep3r V2 address" + }, + "setKp3rWethPool(address)": { + "notice": "Sets KP3R-WETH pool" + }, + "setMaxBoost(uint256)": { + "notice": "Sets the maximum boost multiplier" + }, + "setMinBaseFee(uint256)": { + "notice": "Sets the minimum rewarded gas fee" + }, + "setMinBoost(uint256)": { + "notice": "Sets the minimum boost multiplier" + }, + "setMinPriorityFee(uint256)": { + "notice": "Sets the minimum rewarded gas priority fee" + }, + "setPendingGovernor(address)": { + "notice": "Allows a governor to propose a new governor" + }, + "setQuoteTwapTime(uint32)": { + "notice": "Sets the quote twap time" + }, + "setTargetBond(uint256)": { + "notice": "Sets the target bond amount" + }, + "setWorkExtraGas(uint256)": { + "notice": "Sets the work extra gas amount" + }, + "targetBond()": { + "notice": "The targeted amount of bonded KP3Rs to max-up reward multiplier For example: if the amount of KP3R the keeper has bonded is targetBond or more, then the keeper will get the maximum boost possible in his rewards, if it's less, the reward boost will be proportional" + }, + "workExtraGas()": { + "notice": "The amount of unaccounted gas that is going to be added to keeper payments" + } + }, + "version": 1 + }, + "storageLayout": { + "storage": [ + { + "astId": 82, + "contract": "solidity/for-test/testnet/Keep3rHelperForTestnet.sol:Keep3rHelperForTestnet", + "label": "governor", + "offset": 0, + "slot": "0", + "type": "t_address" + }, + { + "astId": 85, + "contract": "solidity/for-test/testnet/Keep3rHelperForTestnet.sol:Keep3rHelperForTestnet", + "label": "pendingGovernor", + "offset": 0, + "slot": "1", + "type": "t_address" + }, + { + "astId": 3485, + "contract": "solidity/for-test/testnet/Keep3rHelperForTestnet.sol:Keep3rHelperForTestnet", + "label": "minBoost", + "offset": 0, + "slot": "2", + "type": "t_uint256" + }, + { + "astId": 3490, + "contract": "solidity/for-test/testnet/Keep3rHelperForTestnet.sol:Keep3rHelperForTestnet", + "label": "maxBoost", + "offset": 0, + "slot": "3", + "type": "t_uint256" + }, + { + "astId": 3495, + "contract": "solidity/for-test/testnet/Keep3rHelperForTestnet.sol:Keep3rHelperForTestnet", + "label": "targetBond", + "offset": 0, + "slot": "4", + "type": "t_uint256" + }, + { + "astId": 3500, + "contract": "solidity/for-test/testnet/Keep3rHelperForTestnet.sol:Keep3rHelperForTestnet", + "label": "workExtraGas", + "offset": 0, + "slot": "5", + "type": "t_uint256" + }, + { + "astId": 3505, + "contract": "solidity/for-test/testnet/Keep3rHelperForTestnet.sol:Keep3rHelperForTestnet", + "label": "quoteTwapTime", + "offset": 0, + "slot": "6", + "type": "t_uint32" + }, + { + "astId": 3510, + "contract": "solidity/for-test/testnet/Keep3rHelperForTestnet.sol:Keep3rHelperForTestnet", + "label": "minBaseFee", + "offset": 0, + "slot": "7", + "type": "t_uint256" + }, + { + "astId": 3515, + "contract": "solidity/for-test/testnet/Keep3rHelperForTestnet.sol:Keep3rHelperForTestnet", + "label": "minPriorityFee", + "offset": 0, + "slot": "8", + "type": "t_uint256" + }, + { + "astId": 3519, + "contract": "solidity/for-test/testnet/Keep3rHelperForTestnet.sol:Keep3rHelperForTestnet", + "label": "keep3rV2", + "offset": 0, + "slot": "9", + "type": "t_address" + }, + { + "astId": 3524, + "contract": "solidity/for-test/testnet/Keep3rHelperForTestnet.sol:Keep3rHelperForTestnet", + "label": "kp3rWethPool", + "offset": 0, + "slot": "10", + "type": "t_struct(Kp3rWethOraclePool)13118_storage" + } + ], + "types": { + "t_address": { + "encoding": "inplace", + "label": "address", + "numberOfBytes": "20" + }, + "t_bool": { + "encoding": "inplace", + "label": "bool", + "numberOfBytes": "1" + }, + "t_struct(Kp3rWethOraclePool)13118_storage": { + "encoding": "inplace", + "label": "struct IKeep3rHelperParameters.Kp3rWethOraclePool", + "members": [ + { + "astId": 13115, + "contract": "solidity/for-test/testnet/Keep3rHelperForTestnet.sol:Keep3rHelperForTestnet", + "label": "poolAddress", + "offset": 0, + "slot": "0", + "type": "t_address" + }, + { + "astId": 13117, + "contract": "solidity/for-test/testnet/Keep3rHelperForTestnet.sol:Keep3rHelperForTestnet", + "label": "isKP3RToken0", + "offset": 20, + "slot": "0", + "type": "t_bool" + } + ], + "numberOfBytes": "32" + }, + "t_uint256": { + "encoding": "inplace", + "label": "uint256", + "numberOfBytes": "32" + }, + "t_uint32": { + "encoding": "inplace", + "label": "uint32", + "numberOfBytes": "4" + } + } + } +} \ No newline at end of file diff --git a/deployments/sepolia/Kp3rWethOracle.json b/deployments/sepolia/Kp3rWethOracle.json new file mode 100644 index 0000000..9d66253 --- /dev/null +++ b/deployments/sepolia/Kp3rWethOracle.json @@ -0,0 +1,987 @@ +{ + "address": "0xb39Dea2246Ac99575eebc86A2590BADF046eda91", + "abi": [ + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "indexed": true, + "internalType": "int24", + "name": "tickLower", + "type": "int24" + }, + { + "indexed": true, + "internalType": "int24", + "name": "tickUpper", + "type": "int24" + }, + { + "indexed": false, + "internalType": "uint128", + "name": "amount", + "type": "uint128" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "amount0", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "amount1", + "type": "uint256" + } + ], + "name": "Burn", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "indexed": false, + "internalType": "address", + "name": "recipient", + "type": "address" + }, + { + "indexed": true, + "internalType": "int24", + "name": "tickLower", + "type": "int24" + }, + { + "indexed": true, + "internalType": "int24", + "name": "tickUpper", + "type": "int24" + }, + { + "indexed": false, + "internalType": "uint128", + "name": "amount0", + "type": "uint128" + }, + { + "indexed": false, + "internalType": "uint128", + "name": "amount1", + "type": "uint128" + } + ], + "name": "Collect", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "sender", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "recipient", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint128", + "name": "amount0", + "type": "uint128" + }, + { + "indexed": false, + "internalType": "uint128", + "name": "amount1", + "type": "uint128" + } + ], + "name": "CollectProtocol", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "sender", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "recipient", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "amount0", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "amount1", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "paid0", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "paid1", + "type": "uint256" + } + ], + "name": "Flash", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint16", + "name": "observationCardinalityNextOld", + "type": "uint16" + }, + { + "indexed": false, + "internalType": "uint16", + "name": "observationCardinalityNextNew", + "type": "uint16" + } + ], + "name": "IncreaseObservationCardinalityNext", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint160", + "name": "sqrtPriceX96", + "type": "uint160" + }, + { + "indexed": false, + "internalType": "int24", + "name": "tick", + "type": "int24" + } + ], + "name": "Initialize", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "sender", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "indexed": true, + "internalType": "int24", + "name": "tickLower", + "type": "int24" + }, + { + "indexed": true, + "internalType": "int24", + "name": "tickUpper", + "type": "int24" + }, + { + "indexed": false, + "internalType": "uint128", + "name": "amount", + "type": "uint128" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "amount0", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "amount1", + "type": "uint256" + } + ], + "name": "Mint", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint8", + "name": "feeProtocol0Old", + "type": "uint8" + }, + { + "indexed": false, + "internalType": "uint8", + "name": "feeProtocol1Old", + "type": "uint8" + }, + { + "indexed": false, + "internalType": "uint8", + "name": "feeProtocol0New", + "type": "uint8" + }, + { + "indexed": false, + "internalType": "uint8", + "name": "feeProtocol1New", + "type": "uint8" + } + ], + "name": "SetFeeProtocol", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "sender", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "recipient", + "type": "address" + }, + { + "indexed": false, + "internalType": "int256", + "name": "amount0", + "type": "int256" + }, + { + "indexed": false, + "internalType": "int256", + "name": "amount1", + "type": "int256" + }, + { + "indexed": false, + "internalType": "uint160", + "name": "sqrtPriceX96", + "type": "uint160" + }, + { + "indexed": false, + "internalType": "uint128", + "name": "liquidity", + "type": "uint128" + }, + { + "indexed": false, + "internalType": "int24", + "name": "tick", + "type": "int24" + } + ], + "name": "Swap", + "type": "event" + }, + { + "inputs": [ + { + "internalType": "int24", + "name": "tickLower", + "type": "int24" + }, + { + "internalType": "int24", + "name": "tickUpper", + "type": "int24" + }, + { + "internalType": "uint128", + "name": "amount", + "type": "uint128" + } + ], + "name": "burn", + "outputs": [ + { + "internalType": "uint256", + "name": "amount0", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "amount1", + "type": "uint256" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "recipient", + "type": "address" + }, + { + "internalType": "int24", + "name": "tickLower", + "type": "int24" + }, + { + "internalType": "int24", + "name": "tickUpper", + "type": "int24" + }, + { + "internalType": "uint128", + "name": "amount0Requested", + "type": "uint128" + }, + { + "internalType": "uint128", + "name": "amount1Requested", + "type": "uint128" + } + ], + "name": "collect", + "outputs": [ + { + "internalType": "uint128", + "name": "amount0", + "type": "uint128" + }, + { + "internalType": "uint128", + "name": "amount1", + "type": "uint128" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "recipient", + "type": "address" + }, + { + "internalType": "uint128", + "name": "amount0Requested", + "type": "uint128" + }, + { + "internalType": "uint128", + "name": "amount1Requested", + "type": "uint128" + } + ], + "name": "collectProtocol", + "outputs": [ + { + "internalType": "uint128", + "name": "amount0", + "type": "uint128" + }, + { + "internalType": "uint128", + "name": "amount1", + "type": "uint128" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "factory", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "fee", + "outputs": [ + { + "internalType": "uint24", + "name": "", + "type": "uint24" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "feeGrowthGlobal0X128", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "feeGrowthGlobal1X128", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "recipient", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amount0", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "amount1", + "type": "uint256" + }, + { + "internalType": "bytes", + "name": "data", + "type": "bytes" + } + ], + "name": "flash", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint16", + "name": "observationCardinalityNext", + "type": "uint16" + } + ], + "name": "increaseObservationCardinalityNext", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint160", + "name": "sqrtPriceX96", + "type": "uint160" + } + ], + "name": "initialize", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "liquidity", + "outputs": [ + { + "internalType": "uint128", + "name": "", + "type": "uint128" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "maxLiquidityPerTick", + "outputs": [ + { + "internalType": "uint128", + "name": "", + "type": "uint128" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "recipient", + "type": "address" + }, + { + "internalType": "int24", + "name": "tickLower", + "type": "int24" + }, + { + "internalType": "int24", + "name": "tickUpper", + "type": "int24" + }, + { + "internalType": "uint128", + "name": "amount", + "type": "uint128" + }, + { + "internalType": "bytes", + "name": "data", + "type": "bytes" + } + ], + "name": "mint", + "outputs": [ + { + "internalType": "uint256", + "name": "amount0", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "amount1", + "type": "uint256" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "index", + "type": "uint256" + } + ], + "name": "observations", + "outputs": [ + { + "internalType": "uint32", + "name": "blockTimestamp", + "type": "uint32" + }, + { + "internalType": "int56", + "name": "tickCumulative", + "type": "int56" + }, + { + "internalType": "uint160", + "name": "secondsPerLiquidityCumulativeX128", + "type": "uint160" + }, + { + "internalType": "bool", + "name": "initialized", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint32[]", + "name": "secondsAgos", + "type": "uint32[]" + } + ], + "name": "observe", + "outputs": [ + { + "internalType": "int56[]", + "name": "tickCumulatives", + "type": "int56[]" + }, + { + "internalType": "uint160[]", + "name": "secondsPerLiquidityCumulativeX128s", + "type": "uint160[]" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "key", + "type": "bytes32" + } + ], + "name": "positions", + "outputs": [ + { + "internalType": "uint128", + "name": "_liquidity", + "type": "uint128" + }, + { + "internalType": "uint256", + "name": "feeGrowthInside0LastX128", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "feeGrowthInside1LastX128", + "type": "uint256" + }, + { + "internalType": "uint128", + "name": "tokensOwed0", + "type": "uint128" + }, + { + "internalType": "uint128", + "name": "tokensOwed1", + "type": "uint128" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "protocolFees", + "outputs": [ + { + "internalType": "uint128", + "name": "token0", + "type": "uint128" + }, + { + "internalType": "uint128", + "name": "token1", + "type": "uint128" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint8", + "name": "feeProtocol0", + "type": "uint8" + }, + { + "internalType": "uint8", + "name": "feeProtocol1", + "type": "uint8" + } + ], + "name": "setFeeProtocol", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "slot0", + "outputs": [ + { + "internalType": "uint160", + "name": "sqrtPriceX96", + "type": "uint160" + }, + { + "internalType": "int24", + "name": "tick", + "type": "int24" + }, + { + "internalType": "uint16", + "name": "observationIndex", + "type": "uint16" + }, + { + "internalType": "uint16", + "name": "observationCardinality", + "type": "uint16" + }, + { + "internalType": "uint16", + "name": "observationCardinalityNext", + "type": "uint16" + }, + { + "internalType": "uint8", + "name": "feeProtocol", + "type": "uint8" + }, + { + "internalType": "bool", + "name": "unlocked", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "int24", + "name": "tickLower", + "type": "int24" + }, + { + "internalType": "int24", + "name": "tickUpper", + "type": "int24" + } + ], + "name": "snapshotCumulativesInside", + "outputs": [ + { + "internalType": "int56", + "name": "tickCumulativeInside", + "type": "int56" + }, + { + "internalType": "uint160", + "name": "secondsPerLiquidityInsideX128", + "type": "uint160" + }, + { + "internalType": "uint32", + "name": "secondsInside", + "type": "uint32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "recipient", + "type": "address" + }, + { + "internalType": "bool", + "name": "zeroForOne", + "type": "bool" + }, + { + "internalType": "int256", + "name": "amountSpecified", + "type": "int256" + }, + { + "internalType": "uint160", + "name": "sqrtPriceLimitX96", + "type": "uint160" + }, + { + "internalType": "bytes", + "name": "data", + "type": "bytes" + } + ], + "name": "swap", + "outputs": [ + { + "internalType": "int256", + "name": "amount0", + "type": "int256" + }, + { + "internalType": "int256", + "name": "amount1", + "type": "int256" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "int16", + "name": "wordPosition", + "type": "int16" + } + ], + "name": "tickBitmap", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "tickSpacing", + "outputs": [ + { + "internalType": "int24", + "name": "", + "type": "int24" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "int24", + "name": "tick", + "type": "int24" + } + ], + "name": "ticks", + "outputs": [ + { + "internalType": "uint128", + "name": "liquidityGross", + "type": "uint128" + }, + { + "internalType": "int128", + "name": "liquidityNet", + "type": "int128" + }, + { + "internalType": "uint256", + "name": "feeGrowthOutside0X128", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "feeGrowthOutside1X128", + "type": "uint256" + }, + { + "internalType": "int56", + "name": "tickCumulativeOutside", + "type": "int56" + }, + { + "internalType": "uint160", + "name": "secondsPerLiquidityOutsideX128", + "type": "uint160" + }, + { + "internalType": "uint32", + "name": "secondsOutside", + "type": "uint32" + }, + { + "internalType": "bool", + "name": "initialized", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "token0", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "token1", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + } + ], + "numDeployments": 1 +} \ No newline at end of file diff --git a/deployments/optimisticGoerli/KP3Rv1.json b/deployments/sepolia/UniV3Factory.json similarity index 54% rename from deployments/optimisticGoerli/KP3Rv1.json rename to deployments/sepolia/UniV3Factory.json index 043d796..3390bf3 100644 --- a/deployments/optimisticGoerli/KP3Rv1.json +++ b/deployments/sepolia/UniV3Factory.json @@ -1,29 +1,42 @@ { - "address": "0x3Db593146464816F10d4eBA4743C76A5A4D08425", + "address": "0x0227628f3F023bb0B980b67D528571c95c6DaC1c", "abi": [ { "anonymous": false, "inputs": [ { "indexed": true, - "internalType": "address", - "name": "owner", - "type": "address" + "internalType": "uint24", + "name": "fee", + "type": "uint24" }, + { + "indexed": true, + "internalType": "int24", + "name": "tickSpacing", + "type": "int24" + } + ], + "name": "FeeAmountEnabled", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ { "indexed": true, "internalType": "address", - "name": "spender", + "name": "oldOwner", "type": "address" }, { - "indexed": false, - "internalType": "uint256", - "name": "value", - "type": "uint256" + "indexed": true, + "internalType": "address", + "name": "newOwner", + "type": "address" } ], - "name": "Approval", + "name": "OwnerChanged", "type": "event" }, { @@ -32,100 +45,98 @@ { "indexed": true, "internalType": "address", - "name": "from", + "name": "token0", "type": "address" }, { "indexed": true, "internalType": "address", - "name": "to", + "name": "token1", "type": "address" }, + { + "indexed": true, + "internalType": "uint24", + "name": "fee", + "type": "uint24" + }, { "indexed": false, - "internalType": "uint256", - "name": "value", - "type": "uint256" + "internalType": "int24", + "name": "tickSpacing", + "type": "int24" + }, + { + "indexed": false, + "internalType": "address", + "name": "pool", + "type": "address" } ], - "name": "Transfer", + "name": "PoolCreated", "type": "event" }, { "inputs": [ { "internalType": "address", - "name": "owner", + "name": "tokenA", "type": "address" }, { "internalType": "address", - "name": "spender", + "name": "tokenB", "type": "address" + }, + { + "internalType": "uint24", + "name": "fee", + "type": "uint24" } ], - "name": "allowance", + "name": "createPool", "outputs": [ { - "internalType": "uint256", - "name": "", - "type": "uint256" + "internalType": "address", + "name": "pool", + "type": "address" } ], - "stateMutability": "view", + "stateMutability": "nonpayable", "type": "function" }, { "inputs": [ { - "internalType": "address", - "name": "spender", - "type": "address" + "internalType": "uint24", + "name": "fee", + "type": "uint24" }, { - "internalType": "uint256", - "name": "amount", - "type": "uint256" - } - ], - "name": "approve", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" + "internalType": "int24", + "name": "tickSpacing", + "type": "int24" } ], + "name": "enableFeeAmount", + "outputs": [], "stateMutability": "nonpayable", "type": "function" }, { "inputs": [ { - "internalType": "address", - "name": "account", - "type": "address" + "internalType": "uint24", + "name": "fee", + "type": "uint24" } ], - "name": "balanceOf", + "name": "feeAmountTickSpacing", "outputs": [ { - "internalType": "uint256", + "internalType": "int24", "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "totalSupply", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" + "type": "int24" } ], "stateMutability": "view", @@ -135,55 +146,57 @@ "inputs": [ { "internalType": "address", - "name": "recipient", + "name": "tokenA", "type": "address" }, { - "internalType": "uint256", - "name": "amount", - "type": "uint256" + "internalType": "address", + "name": "tokenB", + "type": "address" + }, + { + "internalType": "uint24", + "name": "fee", + "type": "uint24" } ], - "name": "transfer", + "name": "getPool", "outputs": [ { - "internalType": "bool", - "name": "", - "type": "bool" + "internalType": "address", + "name": "pool", + "type": "address" } ], - "stateMutability": "nonpayable", + "stateMutability": "view", "type": "function" }, { - "inputs": [ - { - "internalType": "address", - "name": "sender", - "type": "address" - }, + "inputs": [], + "name": "owner", + "outputs": [ { "internalType": "address", - "name": "recipient", + "name": "", "type": "address" - }, - { - "internalType": "uint256", - "name": "amount", - "type": "uint256" } ], - "name": "transferFrom", - "outputs": [ + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ { - "internalType": "bool", - "name": "", - "type": "bool" + "internalType": "address", + "name": "_owner", + "type": "address" } ], + "name": "setOwner", + "outputs": [], "stateMutability": "nonpayable", "type": "function" } ], - "numDeployments": 5 + "numDeployments": 57 } \ No newline at end of file diff --git a/deployments/sepolia/UniV3PairManager.json b/deployments/sepolia/UniV3PairManager.json new file mode 100644 index 0000000..c09b34c --- /dev/null +++ b/deployments/sepolia/UniV3PairManager.json @@ -0,0 +1,1075 @@ +{ + "address": "0xf10fF1eec2DE6549df9D371B12e504E1c3810E82", + "abi": [ + { + "inputs": [ + { + "internalType": "address", + "name": "_pool", + "type": "address" + }, + { + "internalType": "address", + "name": "_governor", + "type": "address" + } + ], + "stateMutability": "nonpayable", + "type": "constructor" + }, + { + "inputs": [], + "name": "ExcessiveSlippage", + "type": "error" + }, + { + "inputs": [], + "name": "InvalidAddress", + "type": "error" + }, + { + "inputs": [], + "name": "InvalidAmount", + "type": "error" + }, + { + "inputs": [], + "name": "LengthMismatch", + "type": "error" + }, + { + "inputs": [], + "name": "OnlyGovernor", + "type": "error" + }, + { + "inputs": [], + "name": "OnlyPendingGovernor", + "type": "error" + }, + { + "inputs": [], + "name": "OnlyPool", + "type": "error" + }, + { + "inputs": [], + "name": "UnsuccessfulTransfer", + "type": "error" + }, + { + "inputs": [], + "name": "ZeroAddress", + "type": "error" + }, + { + "inputs": [], + "name": "ZeroAmount", + "type": "error" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "spender", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "value", + "type": "uint256" + } + ], + "name": "Approval", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "_newGovernor", + "type": "address" + } + ], + "name": "PendingGovernorAccepted", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "_governor", + "type": "address" + }, + { + "indexed": false, + "internalType": "address", + "name": "_pendingGovernor", + "type": "address" + } + ], + "name": "PendingGovernorSet", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "from", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "to", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "value", + "type": "uint256" + } + ], + "name": "Transfer", + "type": "event" + }, + { + "inputs": [], + "name": "acceptPendingGovernor", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + }, + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "name": "allowance", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "spender", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "approve", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "name": "balanceOf", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint128", + "name": "liquidity", + "type": "uint128" + }, + { + "internalType": "uint256", + "name": "amount0Min", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "amount1Min", + "type": "uint256" + }, + { + "internalType": "address", + "name": "to", + "type": "address" + } + ], + "name": "burn", + "outputs": [ + { + "internalType": "uint256", + "name": "amount0", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "amount1", + "type": "uint256" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "collect", + "outputs": [ + { + "internalType": "uint256", + "name": "amount0", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "amount1", + "type": "uint256" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "decimals", + "outputs": [ + { + "internalType": "uint8", + "name": "", + "type": "uint8" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "factory", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "fee", + "outputs": [ + { + "internalType": "uint24", + "name": "", + "type": "uint24" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "governor", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "amount0Desired", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "amount1Desired", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "amount0Min", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "amount1Min", + "type": "uint256" + }, + { + "internalType": "address", + "name": "to", + "type": "address" + } + ], + "name": "mint", + "outputs": [ + { + "internalType": "uint128", + "name": "liquidity", + "type": "uint128" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "name", + "outputs": [ + { + "internalType": "string", + "name": "", + "type": "string" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "pendingGovernor", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "pool", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "position", + "outputs": [ + { + "internalType": "uint128", + "name": "liquidity", + "type": "uint128" + }, + { + "internalType": "uint256", + "name": "feeGrowthInside0LastX128", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "feeGrowthInside1LastX128", + "type": "uint256" + }, + { + "internalType": "uint128", + "name": "tokensOwed0", + "type": "uint128" + }, + { + "internalType": "uint128", + "name": "tokensOwed1", + "type": "uint128" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_pendingGovernor", + "type": "address" + } + ], + "name": "setPendingGovernor", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "sqrtRatioAX96", + "outputs": [ + { + "internalType": "uint160", + "name": "", + "type": "uint160" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "sqrtRatioBX96", + "outputs": [ + { + "internalType": "uint160", + "name": "", + "type": "uint160" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "symbol", + "outputs": [ + { + "internalType": "string", + "name": "", + "type": "string" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "tickLower", + "outputs": [ + { + "internalType": "int24", + "name": "", + "type": "int24" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "tickSpacing", + "outputs": [ + { + "internalType": "int24", + "name": "", + "type": "int24" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "tickUpper", + "outputs": [ + { + "internalType": "int24", + "name": "", + "type": "int24" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "token0", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "token1", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "totalSupply", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "to", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "transfer", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "from", + "type": "address" + }, + { + "internalType": "address", + "name": "to", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "transferFrom", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "amount0Owed", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "amount1Owed", + "type": "uint256" + }, + { + "internalType": "bytes", + "name": "data", + "type": "bytes" + } + ], + "name": "uniswapV3MintCallback", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + } + ], + "transactionHash": "0x6d1a4e4e12edc22d0059c3e6feed8714323101e68a0e714387e48e5595c53c80", + "receipt": { + "to": null, + "from": "0x169Cf949aB1B25453b70F2Fe874e2c65c10AE0f8", + "contractAddress": "0xf10fF1eec2DE6549df9D371B12e504E1c3810E82", + "transactionIndex": 107, + "gasUsed": "2129422", + "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "blockHash": "0xca4682c352e00af7cd403aca89d6df48608d60adaa81344b0fdaf7628adbf79d", + "transactionHash": "0x6d1a4e4e12edc22d0059c3e6feed8714323101e68a0e714387e48e5595c53c80", + "logs": [], + "blockNumber": 5470570, + "cumulativeGasUsed": "18487132", + "status": 1, + "byzantium": true + }, + "args": [ + "0xb39Dea2246Ac99575eebc86A2590BADF046eda91", + "0x169Cf949aB1B25453b70F2Fe874e2c65c10AE0f8" + ], + "numDeployments": 2, + "solcInputHash": "4e9d9cfe55e24217a94485fe49438e4a", + "metadata": "{\"compiler\":{\"version\":\"0.8.8+commit.dddeac2f\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_pool\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"_governor\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"inputs\":[],\"name\":\"ExcessiveSlippage\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"InvalidAddress\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"InvalidAmount\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"LengthMismatch\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"OnlyGovernor\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"OnlyPendingGovernor\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"OnlyPool\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"UnsuccessfulTransfer\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"ZeroAddress\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"ZeroAmount\",\"type\":\"error\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"owner\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"spender\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"value\",\"type\":\"uint256\"}],\"name\":\"Approval\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"_newGovernor\",\"type\":\"address\"}],\"name\":\"PendingGovernorAccepted\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"_governor\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"_pendingGovernor\",\"type\":\"address\"}],\"name\":\"PendingGovernorSet\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"from\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"value\",\"type\":\"uint256\"}],\"name\":\"Transfer\",\"type\":\"event\"},{\"inputs\":[],\"name\":\"acceptPendingGovernor\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"allowance\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"spender\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"approve\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"balanceOf\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint128\",\"name\":\"liquidity\",\"type\":\"uint128\"},{\"internalType\":\"uint256\",\"name\":\"amount0Min\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"amount1Min\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"}],\"name\":\"burn\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"amount0\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"amount1\",\"type\":\"uint256\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"collect\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"amount0\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"amount1\",\"type\":\"uint256\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"decimals\",\"outputs\":[{\"internalType\":\"uint8\",\"name\":\"\",\"type\":\"uint8\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"factory\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"fee\",\"outputs\":[{\"internalType\":\"uint24\",\"name\":\"\",\"type\":\"uint24\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"governor\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"amount0Desired\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"amount1Desired\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"amount0Min\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"amount1Min\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"}],\"name\":\"mint\",\"outputs\":[{\"internalType\":\"uint128\",\"name\":\"liquidity\",\"type\":\"uint128\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"name\",\"outputs\":[{\"internalType\":\"string\",\"name\":\"\",\"type\":\"string\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"pendingGovernor\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"pool\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"position\",\"outputs\":[{\"internalType\":\"uint128\",\"name\":\"liquidity\",\"type\":\"uint128\"},{\"internalType\":\"uint256\",\"name\":\"feeGrowthInside0LastX128\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"feeGrowthInside1LastX128\",\"type\":\"uint256\"},{\"internalType\":\"uint128\",\"name\":\"tokensOwed0\",\"type\":\"uint128\"},{\"internalType\":\"uint128\",\"name\":\"tokensOwed1\",\"type\":\"uint128\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_pendingGovernor\",\"type\":\"address\"}],\"name\":\"setPendingGovernor\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"sqrtRatioAX96\",\"outputs\":[{\"internalType\":\"uint160\",\"name\":\"\",\"type\":\"uint160\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"sqrtRatioBX96\",\"outputs\":[{\"internalType\":\"uint160\",\"name\":\"\",\"type\":\"uint160\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"symbol\",\"outputs\":[{\"internalType\":\"string\",\"name\":\"\",\"type\":\"string\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"tickLower\",\"outputs\":[{\"internalType\":\"int24\",\"name\":\"\",\"type\":\"int24\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"tickSpacing\",\"outputs\":[{\"internalType\":\"int24\",\"name\":\"\",\"type\":\"int24\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"tickUpper\",\"outputs\":[{\"internalType\":\"int24\",\"name\":\"\",\"type\":\"int24\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"token0\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"token1\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"totalSupply\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"transfer\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"from\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"transferFrom\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"amount0Owed\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"amount1Owed\",\"type\":\"uint256\"},{\"internalType\":\"bytes\",\"name\":\"data\",\"type\":\"bytes\"}],\"name\":\"uniswapV3MintCallback\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"}],\"devdoc\":{\"kind\":\"dev\",\"methods\":{\"approve(address,uint256)\":{\"details\":\"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.\"},\"burn(uint128,uint256,uint256,address)\":{\"params\":{\"amount0Min\":\"The minimum amount of token0 we want to send to the recipient (to)\",\"amount1Min\":\"The minimum amount of token1 we want to send to the recipient (to)\",\"liquidity\":\"The amount of liquidity to be burned\",\"to\":\"The address that will receive the due fees\"},\"returns\":{\"amount0\":\"The calculated amount of token0 that will be sent to the recipient\",\"amount1\":\"The calculated amount of token1 that will be sent to the recipient\"}},\"collect()\":{\"details\":\"The collected fees will be sent to governor\",\"returns\":{\"amount0\":\"The amount of fees collected in token0\",\"amount1\":\"The amount of fees collected in token1\"}},\"mint(uint256,uint256,uint256,uint256,address)\":{\"details\":\"Triggers UniV3PairManager#uniswapV3MintCallback\",\"params\":{\"amount0Desired\":\"The amount of token0 we would like to provide\",\"amount0Min\":\"The minimum amount of token0 we want to provide\",\"amount1Desired\":\"The amount of token1 we would like to provide\",\"amount1Min\":\"The minimum amount of token1 we want to provide\",\"to\":\"The address to which the kLP tokens are going to be minted to\"},\"returns\":{\"liquidity\":\"kLP tokens sent in exchange for the provision of tokens\"}},\"position()\":{\"returns\":{\"feeGrowthInside0LastX128\":\"The fee growth of token0 as of the last action on the individual position\",\"feeGrowthInside1LastX128\":\"The fee growth of token1 as of the last action on the individual position\",\"liquidity\":\"The amount of liquidity provided to the UniswapV3 pool by the pair manager\",\"tokensOwed0\":\"The uncollected amount of token0 owed to the position as of the last computation\",\"tokensOwed1\":\"The uncollected amount of token1 owed to the position as of the last computation\"}},\"setPendingGovernor(address)\":{\"params\":{\"_pendingGovernor\":\"Address of the proposed new governor\"}},\"transfer(address,uint256)\":{\"details\":\"Moves `amount` tokens from the caller's account to `recipient`. Returns a boolean value indicating whether the operation succeeded. Emits a {Transfer} event.\"},\"transferFrom(address,address,uint256)\":{\"details\":\"Moves `amount` tokens from `sender` to `recipient` 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.\"},\"uniswapV3MintCallback(uint256,uint256,bytes)\":{\"params\":{\"amount0Owed\":\"The amount of token0 due to the pool for the minted liquidity\",\"amount1Owed\":\"The amount of token1 due to the pool for the minted liquidity\",\"data\":\"The encoded token0, token1, fee (_poolKey) and the payer (msg.sender) of the IUniV3PairManager#mint function\"}}},\"stateVariables\":{\"_MAX_TICK\":{\"details\":\"Due to tick spacing, pools with different fees may have differences between _MAX_TICK and tickUpper. Use tickUpper to find the max tick of the pool.\"},\"allowance\":{\"details\":\"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.\"},\"balanceOf\":{\"details\":\"Returns the amount of tokens owned by `account`.\"},\"decimals\":{\"details\":\"Returns the decimals places of the token.\"},\"factory\":{\"return\":\"_factory The address of the PairManager Factory\",\"returns\":{\"_0\":\"_factory The address of the PairManager Factory\"}},\"fee\":{\"return\":\"_fee The fee of the Uniswap pool passed into the constructor\",\"returns\":{\"_0\":\"_fee The fee of the Uniswap pool passed into the constructor\"}},\"name\":{\"details\":\"Returns the name of the token.\"},\"pool\":{\"return\":\"_pool The address of the pool\",\"returns\":{\"_0\":\"_pool The address of the pool\"}},\"sqrtRatioAX96\":{\"return\":\"_sqrtPriceA96 A Fixed point Q64.96 number representing the sqrt of the ratio of the two assets (token1/token0) at the lowest tick\",\"returns\":{\"_0\":\"_sqrtPriceA96 A Fixed point Q64.96 number representing the sqrt of the ratio of the two assets (token1/token0) at the lowest tick\"}},\"sqrtRatioBX96\":{\"return\":\"_sqrtPriceBX96 A Fixed point Q64.96 number representing the sqrt of the ratio of the two assets (token1/token0) at the highest tick\",\"returns\":{\"_0\":\"_sqrtPriceBX96 A Fixed point Q64.96 number representing the sqrt of the ratio of the two assets (token1/token0) at the highest tick\"}},\"symbol\":{\"details\":\"Returns the symbol of the token.\"},\"tickLower\":{\"return\":\"_tickLower The lower tick in the Uniswap's curve\",\"returns\":{\"_0\":\"_tickLower The lower tick in the Uniswap's curve\"}},\"tickSpacing\":{\"return\":\"_tickSpacing The pair tick spacing\",\"returns\":{\"_0\":\"_tickSpacing The pair tick spacing\"}},\"tickUpper\":{\"return\":\"_tickUpper The highest tick in the Uniswap's curve\",\"returns\":{\"_0\":\"_tickUpper The highest tick in the Uniswap's curve\"}},\"token0\":{\"return\":\"_token0 The address of token0\",\"returns\":{\"_0\":\"_token0 The address of token0\"}},\"token1\":{\"return\":\"_token1 The address of token1\",\"returns\":{\"_0\":\"_token1 The address of token1\"}},\"totalSupply\":{\"details\":\"Returns the amount of tokens in existence.\"}},\"version\":1},\"userdoc\":{\"errors\":{\"ExcessiveSlippage()\":[{\"notice\":\"Throws when the slippage exceeds what the user is comfortable with\"}],\"InvalidAddress()\":[{\"notice\":\"Thrown if an address is invalid\"}],\"InvalidAmount()\":[{\"notice\":\"Thrown if an amount is invalid\"}],\"LengthMismatch()\":[{\"notice\":\"Thrown if the lengths of a set of lists mismatch\"}],\"OnlyGovernor()\":[{\"notice\":\"Thrown if a non-governor user tries to call a OnlyGovernor function\"}],\"OnlyPendingGovernor()\":[{\"notice\":\"Thrown if a non-pending-governor user tries to call a OnlyPendingGovernor function\"}],\"OnlyPool()\":[{\"notice\":\"Throws when the caller of the function is not the pool\"}],\"UnsuccessfulTransfer()\":[{\"notice\":\"Throws when a transfer is unsuccessful\"}],\"ZeroAddress()\":[{\"notice\":\"Thrown if an address is the zero address\"}],\"ZeroAmount()\":[{\"notice\":\"Thrown if an amount is zero\"}]},\"events\":{\"PendingGovernorAccepted(address)\":{\"notice\":\"Emitted when a new governor is set\"},\"PendingGovernorSet(address,address)\":{\"notice\":\"Emitted when a new pending governor is set\"}},\"kind\":\"user\",\"methods\":{\"acceptPendingGovernor()\":{\"notice\":\"Allows a proposed governor to accept the governance\"},\"factory()\":{\"notice\":\"Address of the factory from which the pair manager was created\"},\"fee()\":{\"notice\":\"The fee of the Uniswap pool passed into the constructor\"},\"mint(uint256,uint256,uint256,uint256,address)\":{\"notice\":\"Mints kLP tokens to an address according to the liquidity the msg.sender provides to the UniswapV3 pool\"},\"pool()\":{\"notice\":\"Address of the pool from which the Keep3r pair manager will interact with\"},\"position()\":{\"notice\":\"Returns the pair manager's position in the corresponding UniswapV3 pool\"},\"setPendingGovernor(address)\":{\"notice\":\"Allows a governor to propose a new governor\"},\"sqrtRatioAX96()\":{\"notice\":\"The sqrtRatioAX96 at the lowest tick (-887200) of the Uniswap pool\"},\"sqrtRatioBX96()\":{\"notice\":\"The sqrtRatioBX96 at the highest tick (887200) of the Uniswap pool\"},\"tickLower()\":{\"notice\":\"Lowest tick in the Uniswap's curve\"},\"tickSpacing()\":{\"notice\":\"The pair tick spacing\"},\"tickUpper()\":{\"notice\":\"Highest tick in the Uniswap's curve\"},\"token0()\":{\"notice\":\"Token0 of the pool\"},\"token1()\":{\"notice\":\"Token1 of the pool\"},\"uniswapV3MintCallback(uint256,uint256,bytes)\":{\"notice\":\"This function is called after a user calls IUniV3PairManager#mint function It ensures that any tokens owed to the pool are paid by the msg.sender of IUniV3PairManager#mint function\"}},\"version\":1}},\"settings\":{\"compilationTarget\":{\"solidity/contracts/UniV3PairManager.sol\":\"UniV3PairManager\"},\"evmVersion\":\"london\",\"libraries\":{\":__CACHE_BREAKER__\":\"0x00000000d41867734bbee4c6863d9255b2b06ac1\"},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":200},\"remappings\":[]},\"sources\":{\"@defi-wonderland/solidity-utils/solidity/contracts/Governable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.8 <0.9.0;\\n\\nimport {IGovernable} from '../interfaces/IGovernable.sol';\\n\\n/// @title Governable contract\\n/// @notice Manages the governor role\\nabstract contract Governable is IGovernable {\\n /// @inheritdoc IGovernable\\n address public governor;\\n\\n /// @inheritdoc IGovernable\\n address public pendingGovernor;\\n\\n constructor(address _governor) {\\n if (_governor == address(0)) revert ZeroAddress();\\n governor = _governor;\\n }\\n\\n /// @inheritdoc IGovernable\\n function setPendingGovernor(address _pendingGovernor) external onlyGovernor {\\n _setPendingGovernor(_pendingGovernor);\\n }\\n\\n /// @inheritdoc IGovernable\\n function acceptPendingGovernor() external onlyPendingGovernor {\\n _acceptPendingGovernor();\\n }\\n\\n function _setPendingGovernor(address _pendingGovernor) internal {\\n if (_pendingGovernor == address(0)) revert ZeroAddress();\\n pendingGovernor = _pendingGovernor;\\n emit PendingGovernorSet(governor, _pendingGovernor);\\n }\\n\\n function _acceptPendingGovernor() internal {\\n governor = pendingGovernor;\\n delete pendingGovernor;\\n emit PendingGovernorAccepted(governor);\\n }\\n\\n /// @notice Functions with this modifier can only be called by governor\\n modifier onlyGovernor() {\\n if (msg.sender != governor) revert OnlyGovernor();\\n _;\\n }\\n\\n /// @notice Functions with this modifier can only be called by pendingGovernor\\n modifier onlyPendingGovernor() {\\n if (msg.sender != pendingGovernor) revert OnlyPendingGovernor();\\n _;\\n }\\n}\\n\",\"keccak256\":\"0x3f11408cfcb015a99dc417e075c8ebc39b796fc2adc3e81b036487e4486881b3\",\"license\":\"MIT\"},\"@defi-wonderland/solidity-utils/solidity/interfaces/IBaseErrors.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.8 <0.9.0;\\n\\ninterface IBaseErrors {\\n /// @notice Thrown if an address is invalid\\n error InvalidAddress();\\n\\n /// @notice Thrown if an amount is invalid\\n error InvalidAmount();\\n\\n /// @notice Thrown if the lengths of a set of lists mismatch\\n error LengthMismatch();\\n\\n /// @notice Thrown if an address is the zero address\\n error ZeroAddress();\\n\\n /// @notice Thrown if an amount is zero\\n error ZeroAmount();\\n}\\n\",\"keccak256\":\"0xec09b9d248b6fbf6343dee41d6978abdc15d4c8df5ed7721e8df79e8b1a558cf\",\"license\":\"MIT\"},\"@defi-wonderland/solidity-utils/solidity/interfaces/IGovernable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.8 <0.9.0;\\n\\nimport {IBaseErrors} from './IBaseErrors.sol';\\n\\n/// @title Governable interface\\ninterface IGovernable is IBaseErrors {\\n // STATE VARIABLES\\n\\n /// @return _governor Address of the current governor\\n function governor() external view returns (address _governor);\\n\\n /// @return _pendingGovernor Address of the current pending governor\\n function pendingGovernor() external view returns (address _pendingGovernor);\\n\\n // EVENTS\\n\\n /// @notice Emitted when a new pending governor is set\\n /// @param _governor Address of the current governor\\n /// @param _pendingGovernor Address of the proposed next governor\\n event PendingGovernorSet(address _governor, address _pendingGovernor);\\n\\n /// @notice Emitted when a new governor is set\\n /// @param _newGovernor Address of the new governor\\n event PendingGovernorAccepted(address _newGovernor);\\n\\n // ERRORS\\n\\n /// @notice Thrown if a non-governor user tries to call a OnlyGovernor function\\n error OnlyGovernor();\\n\\n /// @notice Thrown if a non-pending-governor user tries to call a OnlyPendingGovernor function\\n error OnlyPendingGovernor();\\n\\n // FUNCTIONS\\n\\n /// @notice Allows a governor to propose a new governor\\n /// @param _pendingGovernor Address of the proposed new governor\\n function setPendingGovernor(address _pendingGovernor) external;\\n\\n /// @notice Allows a proposed governor to accept the governance\\n function acceptPendingGovernor() external;\\n}\\n\",\"keccak256\":\"0x40b94706a00d2c092f620807ba84bdd0c5ed8cfa60140c924edc850427e0af13\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC20/ERC20.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"./IERC20.sol\\\";\\nimport \\\"./extensions/IERC20Metadata.sol\\\";\\nimport \\\"../../utils/Context.sol\\\";\\n\\n/**\\n * @dev Implementation of the {IERC20} interface.\\n *\\n * This implementation is agnostic to the way tokens are created. This means\\n * that a supply mechanism has to be added in a derived contract using {_mint}.\\n * For a generic mechanism see {ERC20PresetMinterPauser}.\\n *\\n * TIP: For a detailed writeup see our guide\\n * https://forum.zeppelin.solutions/t/how-to-implement-erc20-supply-mechanisms/226[How\\n * to implement supply mechanisms].\\n *\\n * We have followed general OpenZeppelin Contracts guidelines: functions revert\\n * instead returning `false` on failure. This behavior is nonetheless\\n * conventional and does not conflict with the expectations of ERC20\\n * applications.\\n *\\n * Additionally, an {Approval} event is emitted on calls to {transferFrom}.\\n * This allows applications to reconstruct the allowance for all accounts just\\n * by listening to said events. Other implementations of the EIP may not emit\\n * these events, as it isn't required by the specification.\\n *\\n * Finally, the non-standard {decreaseAllowance} and {increaseAllowance}\\n * functions have been added to mitigate the well-known issues around setting\\n * allowances. See {IERC20-approve}.\\n */\\ncontract ERC20 is Context, IERC20, IERC20Metadata {\\n mapping(address => uint256) private _balances;\\n\\n mapping(address => mapping(address => uint256)) private _allowances;\\n\\n uint256 private _totalSupply;\\n\\n string private _name;\\n string private _symbol;\\n\\n /**\\n * @dev Sets the values for {name} and {symbol}.\\n *\\n * The default value of {decimals} is 18. To select a different value for\\n * {decimals} you should overload it.\\n *\\n * All two of these values are immutable: they can only be set once during\\n * construction.\\n */\\n constructor(string memory name_, string memory symbol_) {\\n _name = name_;\\n _symbol = symbol_;\\n }\\n\\n /**\\n * @dev Returns the name of the token.\\n */\\n function name() public view virtual override returns (string memory) {\\n return _name;\\n }\\n\\n /**\\n * @dev Returns the symbol of the token, usually a shorter version of the\\n * name.\\n */\\n function symbol() public view virtual override returns (string memory) {\\n return _symbol;\\n }\\n\\n /**\\n * @dev Returns the number of decimals used to get its user representation.\\n * For example, if `decimals` equals `2`, a balance of `505` tokens should\\n * be displayed to a user as `5.05` (`505 / 10 ** 2`).\\n *\\n * Tokens usually opt for a value of 18, imitating the relationship between\\n * Ether and Wei. This is the value {ERC20} uses, unless this function is\\n * overridden;\\n *\\n * NOTE: This information is only used for _display_ purposes: it in\\n * no way affects any of the arithmetic of the contract, including\\n * {IERC20-balanceOf} and {IERC20-transfer}.\\n */\\n function decimals() public view virtual override returns (uint8) {\\n return 18;\\n }\\n\\n /**\\n * @dev See {IERC20-totalSupply}.\\n */\\n function totalSupply() public view virtual override returns (uint256) {\\n return _totalSupply;\\n }\\n\\n /**\\n * @dev See {IERC20-balanceOf}.\\n */\\n function balanceOf(address account) public view virtual override returns (uint256) {\\n return _balances[account];\\n }\\n\\n /**\\n * @dev See {IERC20-transfer}.\\n *\\n * Requirements:\\n *\\n * - `recipient` cannot be the zero address.\\n * - the caller must have a balance of at least `amount`.\\n */\\n function transfer(address recipient, uint256 amount) public virtual override returns (bool) {\\n _transfer(_msgSender(), recipient, amount);\\n return true;\\n }\\n\\n /**\\n * @dev See {IERC20-allowance}.\\n */\\n function allowance(address owner, address spender) public view virtual override returns (uint256) {\\n return _allowances[owner][spender];\\n }\\n\\n /**\\n * @dev See {IERC20-approve}.\\n *\\n * Requirements:\\n *\\n * - `spender` cannot be the zero address.\\n */\\n function approve(address spender, uint256 amount) public virtual override returns (bool) {\\n _approve(_msgSender(), spender, amount);\\n return true;\\n }\\n\\n /**\\n * @dev See {IERC20-transferFrom}.\\n *\\n * Emits an {Approval} event indicating the updated allowance. This is not\\n * required by the EIP. See the note at the beginning of {ERC20}.\\n *\\n * Requirements:\\n *\\n * - `sender` and `recipient` cannot be the zero address.\\n * - `sender` must have a balance of at least `amount`.\\n * - the caller must have allowance for ``sender``'s tokens of at least\\n * `amount`.\\n */\\n function transferFrom(\\n address sender,\\n address recipient,\\n uint256 amount\\n ) public virtual override returns (bool) {\\n _transfer(sender, recipient, amount);\\n\\n uint256 currentAllowance = _allowances[sender][_msgSender()];\\n require(currentAllowance >= amount, \\\"ERC20: transfer amount exceeds allowance\\\");\\n unchecked {\\n _approve(sender, _msgSender(), currentAllowance - amount);\\n }\\n\\n return true;\\n }\\n\\n /**\\n * @dev Atomically increases the allowance granted to `spender` by the caller.\\n *\\n * This is an alternative to {approve} that can be used as a mitigation for\\n * problems described in {IERC20-approve}.\\n *\\n * Emits an {Approval} event indicating the updated allowance.\\n *\\n * Requirements:\\n *\\n * - `spender` cannot be the zero address.\\n */\\n function increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool) {\\n _approve(_msgSender(), spender, _allowances[_msgSender()][spender] + addedValue);\\n return true;\\n }\\n\\n /**\\n * @dev Atomically decreases the allowance granted to `spender` by the caller.\\n *\\n * This is an alternative to {approve} that can be used as a mitigation for\\n * problems described in {IERC20-approve}.\\n *\\n * Emits an {Approval} event indicating the updated allowance.\\n *\\n * Requirements:\\n *\\n * - `spender` cannot be the zero address.\\n * - `spender` must have allowance for the caller of at least\\n * `subtractedValue`.\\n */\\n function decreaseAllowance(address spender, uint256 subtractedValue) public virtual returns (bool) {\\n uint256 currentAllowance = _allowances[_msgSender()][spender];\\n require(currentAllowance >= subtractedValue, \\\"ERC20: decreased allowance below zero\\\");\\n unchecked {\\n _approve(_msgSender(), spender, currentAllowance - subtractedValue);\\n }\\n\\n return true;\\n }\\n\\n /**\\n * @dev Moves `amount` of tokens from `sender` to `recipient`.\\n *\\n * This internal function is equivalent to {transfer}, and can be used to\\n * e.g. implement automatic token fees, slashing mechanisms, etc.\\n *\\n * Emits a {Transfer} event.\\n *\\n * Requirements:\\n *\\n * - `sender` cannot be the zero address.\\n * - `recipient` cannot be the zero address.\\n * - `sender` must have a balance of at least `amount`.\\n */\\n function _transfer(\\n address sender,\\n address recipient,\\n uint256 amount\\n ) internal virtual {\\n require(sender != address(0), \\\"ERC20: transfer from the zero address\\\");\\n require(recipient != address(0), \\\"ERC20: transfer to the zero address\\\");\\n\\n _beforeTokenTransfer(sender, recipient, amount);\\n\\n uint256 senderBalance = _balances[sender];\\n require(senderBalance >= amount, \\\"ERC20: transfer amount exceeds balance\\\");\\n unchecked {\\n _balances[sender] = senderBalance - amount;\\n }\\n _balances[recipient] += amount;\\n\\n emit Transfer(sender, recipient, amount);\\n\\n _afterTokenTransfer(sender, recipient, amount);\\n }\\n\\n /** @dev Creates `amount` tokens and assigns them to `account`, increasing\\n * the total supply.\\n *\\n * Emits a {Transfer} event with `from` set to the zero address.\\n *\\n * Requirements:\\n *\\n * - `account` cannot be the zero address.\\n */\\n function _mint(address account, uint256 amount) internal virtual {\\n require(account != address(0), \\\"ERC20: mint to the zero address\\\");\\n\\n _beforeTokenTransfer(address(0), account, amount);\\n\\n _totalSupply += amount;\\n _balances[account] += amount;\\n emit Transfer(address(0), account, amount);\\n\\n _afterTokenTransfer(address(0), account, amount);\\n }\\n\\n /**\\n * @dev Destroys `amount` tokens from `account`, reducing the\\n * total supply.\\n *\\n * Emits a {Transfer} event with `to` set to the zero address.\\n *\\n * Requirements:\\n *\\n * - `account` cannot be the zero address.\\n * - `account` must have at least `amount` tokens.\\n */\\n function _burn(address account, uint256 amount) internal virtual {\\n require(account != address(0), \\\"ERC20: burn from the zero address\\\");\\n\\n _beforeTokenTransfer(account, address(0), amount);\\n\\n uint256 accountBalance = _balances[account];\\n require(accountBalance >= amount, \\\"ERC20: burn amount exceeds balance\\\");\\n unchecked {\\n _balances[account] = accountBalance - amount;\\n }\\n _totalSupply -= amount;\\n\\n emit Transfer(account, address(0), amount);\\n\\n _afterTokenTransfer(account, address(0), amount);\\n }\\n\\n /**\\n * @dev Sets `amount` as the allowance of `spender` over the `owner` s tokens.\\n *\\n * This internal function is equivalent to `approve`, and can be used to\\n * e.g. set automatic allowances for certain subsystems, etc.\\n *\\n * Emits an {Approval} event.\\n *\\n * Requirements:\\n *\\n * - `owner` cannot be the zero address.\\n * - `spender` cannot be the zero address.\\n */\\n function _approve(\\n address owner,\\n address spender,\\n uint256 amount\\n ) internal virtual {\\n require(owner != address(0), \\\"ERC20: approve from the zero address\\\");\\n require(spender != address(0), \\\"ERC20: approve to the zero address\\\");\\n\\n _allowances[owner][spender] = amount;\\n emit Approval(owner, spender, amount);\\n }\\n\\n /**\\n * @dev Hook that is called before any transfer of tokens. This includes\\n * minting and burning.\\n *\\n * Calling conditions:\\n *\\n * - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens\\n * will be transferred to `to`.\\n * - when `from` is zero, `amount` tokens will be minted for `to`.\\n * - when `to` is zero, `amount` of ``from``'s tokens will be burned.\\n * - `from` and `to` are never both zero.\\n *\\n * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].\\n */\\n function _beforeTokenTransfer(\\n address from,\\n address to,\\n uint256 amount\\n ) internal virtual {}\\n\\n /**\\n * @dev Hook that is called after any transfer of tokens. This includes\\n * minting and burning.\\n *\\n * Calling conditions:\\n *\\n * - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens\\n * has been transferred to `to`.\\n * - when `from` is zero, `amount` tokens have been minted for `to`.\\n * - when `to` is zero, `amount` of ``from``'s tokens have been burned.\\n * - `from` and `to` are never both zero.\\n *\\n * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].\\n */\\n function _afterTokenTransfer(\\n address from,\\n address to,\\n uint256 amount\\n ) internal virtual {}\\n}\\n\",\"keccak256\":\"0xb03df8481a954604ad0c9125680893b2e3f7ff770fe470e38b89ac61b84e8072\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC20/IERC20.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Interface of the ERC20 standard as defined in the EIP.\\n */\\ninterface IERC20 {\\n /**\\n * @dev Returns the amount of tokens in existence.\\n */\\n function totalSupply() external view returns (uint256);\\n\\n /**\\n * @dev Returns the amount of tokens owned by `account`.\\n */\\n function balanceOf(address account) external view returns (uint256);\\n\\n /**\\n * @dev Moves `amount` tokens from the caller's account to `recipient`.\\n *\\n * Returns a boolean value indicating whether the operation succeeded.\\n *\\n * Emits a {Transfer} event.\\n */\\n function transfer(address recipient, uint256 amount) external returns (bool);\\n\\n /**\\n * @dev Returns the remaining number of tokens that `spender` will be\\n * allowed to spend on behalf of `owner` through {transferFrom}. This is\\n * zero by default.\\n *\\n * This value changes when {approve} or {transferFrom} are called.\\n */\\n function allowance(address owner, address spender) external view returns (uint256);\\n\\n /**\\n * @dev Sets `amount` as the allowance of `spender` over the caller's tokens.\\n *\\n * Returns a boolean value indicating whether the operation succeeded.\\n *\\n * IMPORTANT: Beware that changing an allowance with this method brings the risk\\n * that someone may use both the old and the new allowance by unfortunate\\n * transaction ordering. One possible solution to mitigate this race\\n * condition is to first reduce the spender's allowance to 0 and set the\\n * desired value afterwards:\\n * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729\\n *\\n * Emits an {Approval} event.\\n */\\n function approve(address spender, uint256 amount) external returns (bool);\\n\\n /**\\n * @dev Moves `amount` tokens from `sender` to `recipient` using the\\n * allowance mechanism. `amount` is then deducted from the caller's\\n * allowance.\\n *\\n * Returns a boolean value indicating whether the operation succeeded.\\n *\\n * Emits a {Transfer} event.\\n */\\n function transferFrom(\\n address sender,\\n address recipient,\\n uint256 amount\\n ) external returns (bool);\\n\\n /**\\n * @dev Emitted when `value` tokens are moved from one account (`from`) to\\n * another (`to`).\\n *\\n * Note that `value` may be zero.\\n */\\n event Transfer(address indexed from, address indexed to, uint256 value);\\n\\n /**\\n * @dev Emitted when the allowance of a `spender` for an `owner` is set by\\n * a call to {approve}. `value` is the new allowance.\\n */\\n event Approval(address indexed owner, address indexed spender, uint256 value);\\n}\\n\",\"keccak256\":\"0x027b891937d20ccf213fdb9c31531574256de774bda99d3a70ecef6e1913ed2a\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../IERC20.sol\\\";\\n\\n/**\\n * @dev Interface for the optional metadata functions from the ERC20 standard.\\n *\\n * _Available since v4.1._\\n */\\ninterface IERC20Metadata is IERC20 {\\n /**\\n * @dev Returns the name of the token.\\n */\\n function name() external view returns (string memory);\\n\\n /**\\n * @dev Returns the symbol of the token.\\n */\\n function symbol() external view returns (string memory);\\n\\n /**\\n * @dev Returns the decimals places of the token.\\n */\\n function decimals() external view returns (uint8);\\n}\\n\",\"keccak256\":\"0x83fe24f5c04a56091e50f4a345ff504c8bff658a76d4c43b16878c8f940c53b2\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/Context.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Provides information about the current execution context, including the\\n * sender of the transaction and its data. While these are generally available\\n * via msg.sender and msg.data, they should not be accessed in such a direct\\n * manner, since when dealing with meta-transactions the account sending and\\n * paying for execution may not be the actual sender (as far as an application\\n * is concerned).\\n *\\n * This contract is only required for intermediate, library-like contracts.\\n */\\nabstract contract Context {\\n function _msgSender() internal view virtual returns (address) {\\n return msg.sender;\\n }\\n\\n function _msgData() internal view virtual returns (bytes calldata) {\\n return msg.data;\\n }\\n}\\n\",\"keccak256\":\"0x90565a39ae45c80f0468dc96c7b20d0afc3055f344c8203a0c9258239f350b9f\",\"license\":\"MIT\"},\"@uniswap/v3-core/contracts/interfaces/IUniswapV3Pool.sol\":{\"content\":\"// SPDX-License-Identifier: GPL-2.0-or-later\\npragma solidity >=0.5.0;\\n\\nimport './pool/IUniswapV3PoolImmutables.sol';\\nimport './pool/IUniswapV3PoolState.sol';\\nimport './pool/IUniswapV3PoolDerivedState.sol';\\nimport './pool/IUniswapV3PoolActions.sol';\\nimport './pool/IUniswapV3PoolOwnerActions.sol';\\nimport './pool/IUniswapV3PoolEvents.sol';\\n\\n/// @title The interface for a Uniswap V3 Pool\\n/// @notice A Uniswap pool facilitates swapping and automated market making between any two assets that strictly conform\\n/// to the ERC20 specification\\n/// @dev The pool interface is broken up into many smaller pieces\\ninterface IUniswapV3Pool is\\n IUniswapV3PoolImmutables,\\n IUniswapV3PoolState,\\n IUniswapV3PoolDerivedState,\\n IUniswapV3PoolActions,\\n IUniswapV3PoolOwnerActions,\\n IUniswapV3PoolEvents\\n{\\n\\n}\\n\",\"keccak256\":\"0xfe6113d518466cd6652c85b111e01f33eb62157f49ae5ed7d5a3947a2044adb1\",\"license\":\"GPL-2.0-or-later\"},\"@uniswap/v3-core/contracts/interfaces/pool/IUniswapV3PoolActions.sol\":{\"content\":\"// SPDX-License-Identifier: GPL-2.0-or-later\\npragma solidity >=0.5.0;\\n\\n/// @title Permissionless pool actions\\n/// @notice Contains pool methods that can be called by anyone\\ninterface IUniswapV3PoolActions {\\n /// @notice Sets the initial price for the pool\\n /// @dev Price is represented as a sqrt(amountToken1/amountToken0) Q64.96 value\\n /// @param sqrtPriceX96 the initial sqrt price of the pool as a Q64.96\\n function initialize(uint160 sqrtPriceX96) external;\\n\\n /// @notice Adds liquidity for the given recipient/tickLower/tickUpper position\\n /// @dev The caller of this method receives a callback in the form of IUniswapV3MintCallback#uniswapV3MintCallback\\n /// in which they must pay any token0 or token1 owed for the liquidity. The amount of token0/token1 due depends\\n /// on tickLower, tickUpper, the amount of liquidity, and the current price.\\n /// @param recipient The address for which the liquidity will be created\\n /// @param tickLower The lower tick of the position in which to add liquidity\\n /// @param tickUpper The upper tick of the position in which to add liquidity\\n /// @param amount The amount of liquidity to mint\\n /// @param data Any data that should be passed through to the callback\\n /// @return amount0 The amount of token0 that was paid to mint the given amount of liquidity. Matches the value in the callback\\n /// @return amount1 The amount of token1 that was paid to mint the given amount of liquidity. Matches the value in the callback\\n function mint(\\n address recipient,\\n int24 tickLower,\\n int24 tickUpper,\\n uint128 amount,\\n bytes calldata data\\n ) external returns (uint256 amount0, uint256 amount1);\\n\\n /// @notice Collects tokens owed to a position\\n /// @dev Does not recompute fees earned, which must be done either via mint or burn of any amount of liquidity.\\n /// Collect must be called by the position owner. To withdraw only token0 or only token1, amount0Requested or\\n /// amount1Requested may be set to zero. To withdraw all tokens owed, caller may pass any value greater than the\\n /// actual tokens owed, e.g. type(uint128).max. Tokens owed may be from accumulated swap fees or burned liquidity.\\n /// @param recipient The address which should receive the fees collected\\n /// @param tickLower The lower tick of the position for which to collect fees\\n /// @param tickUpper The upper tick of the position for which to collect fees\\n /// @param amount0Requested How much token0 should be withdrawn from the fees owed\\n /// @param amount1Requested How much token1 should be withdrawn from the fees owed\\n /// @return amount0 The amount of fees collected in token0\\n /// @return amount1 The amount of fees collected in token1\\n function collect(\\n address recipient,\\n int24 tickLower,\\n int24 tickUpper,\\n uint128 amount0Requested,\\n uint128 amount1Requested\\n ) external returns (uint128 amount0, uint128 amount1);\\n\\n /// @notice Burn liquidity from the sender and account tokens owed for the liquidity to the position\\n /// @dev Can be used to trigger a recalculation of fees owed to a position by calling with an amount of 0\\n /// @dev Fees must be collected separately via a call to #collect\\n /// @param tickLower The lower tick of the position for which to burn liquidity\\n /// @param tickUpper The upper tick of the position for which to burn liquidity\\n /// @param amount How much liquidity to burn\\n /// @return amount0 The amount of token0 sent to the recipient\\n /// @return amount1 The amount of token1 sent to the recipient\\n function burn(\\n int24 tickLower,\\n int24 tickUpper,\\n uint128 amount\\n ) external returns (uint256 amount0, uint256 amount1);\\n\\n /// @notice Swap token0 for token1, or token1 for token0\\n /// @dev The caller of this method receives a callback in the form of IUniswapV3SwapCallback#uniswapV3SwapCallback\\n /// @param recipient The address to receive the output of the swap\\n /// @param zeroForOne The direction of the swap, true for token0 to token1, false for token1 to token0\\n /// @param amountSpecified The amount of the swap, which implicitly configures the swap as exact input (positive), or exact output (negative)\\n /// @param sqrtPriceLimitX96 The Q64.96 sqrt price limit. If zero for one, the price cannot be less than this\\n /// value after the swap. If one for zero, the price cannot be greater than this value after the swap\\n /// @param data Any data to be passed through to the callback\\n /// @return amount0 The delta of the balance of token0 of the pool, exact when negative, minimum when positive\\n /// @return amount1 The delta of the balance of token1 of the pool, exact when negative, minimum when positive\\n function swap(\\n address recipient,\\n bool zeroForOne,\\n int256 amountSpecified,\\n uint160 sqrtPriceLimitX96,\\n bytes calldata data\\n ) external returns (int256 amount0, int256 amount1);\\n\\n /// @notice Receive token0 and/or token1 and pay it back, plus a fee, in the callback\\n /// @dev The caller of this method receives a callback in the form of IUniswapV3FlashCallback#uniswapV3FlashCallback\\n /// @dev Can be used to donate underlying tokens pro-rata to currently in-range liquidity providers by calling\\n /// with 0 amount{0,1} and sending the donation amount(s) from the callback\\n /// @param recipient The address which will receive the token0 and token1 amounts\\n /// @param amount0 The amount of token0 to send\\n /// @param amount1 The amount of token1 to send\\n /// @param data Any data to be passed through to the callback\\n function flash(\\n address recipient,\\n uint256 amount0,\\n uint256 amount1,\\n bytes calldata data\\n ) external;\\n\\n /// @notice Increase the maximum number of price and liquidity observations that this pool will store\\n /// @dev This method is no-op if the pool already has an observationCardinalityNext greater than or equal to\\n /// the input observationCardinalityNext.\\n /// @param observationCardinalityNext The desired minimum number of observations for the pool to store\\n function increaseObservationCardinalityNext(uint16 observationCardinalityNext) external;\\n}\\n\",\"keccak256\":\"0x9453dd0e7442188667d01d9b65de3f1e14e9511ff3e303179a15f6fc267f7634\",\"license\":\"GPL-2.0-or-later\"},\"@uniswap/v3-core/contracts/interfaces/pool/IUniswapV3PoolDerivedState.sol\":{\"content\":\"// SPDX-License-Identifier: GPL-2.0-or-later\\npragma solidity >=0.5.0;\\n\\n/// @title Pool state that is not stored\\n/// @notice Contains view functions to provide information about the pool that is computed rather than stored on the\\n/// blockchain. The functions here may have variable gas costs.\\ninterface IUniswapV3PoolDerivedState {\\n /// @notice Returns the cumulative tick and liquidity as of each timestamp `secondsAgo` from the current block timestamp\\n /// @dev To get a time weighted average tick or liquidity-in-range, you must call this with two values, one representing\\n /// the beginning of the period and another for the end of the period. E.g., to get the last hour time-weighted average tick,\\n /// you must call it with secondsAgos = [3600, 0].\\n /// @dev The time weighted average tick represents the geometric time weighted average price of the pool, in\\n /// log base sqrt(1.0001) of token1 / token0. The TickMath library can be used to go from a tick value to a ratio.\\n /// @param secondsAgos From how long ago each cumulative tick and liquidity value should be returned\\n /// @return tickCumulatives Cumulative tick values as of each `secondsAgos` from the current block timestamp\\n /// @return secondsPerLiquidityCumulativeX128s Cumulative seconds per liquidity-in-range value as of each `secondsAgos` from the current block\\n /// timestamp\\n function observe(uint32[] calldata secondsAgos)\\n external\\n view\\n returns (int56[] memory tickCumulatives, uint160[] memory secondsPerLiquidityCumulativeX128s);\\n\\n /// @notice Returns a snapshot of the tick cumulative, seconds per liquidity and seconds inside a tick range\\n /// @dev Snapshots must only be compared to other snapshots, taken over a period for which a position existed.\\n /// I.e., snapshots cannot be compared if a position is not held for the entire period between when the first\\n /// snapshot is taken and the second snapshot is taken.\\n /// @param tickLower The lower tick of the range\\n /// @param tickUpper The upper tick of the range\\n /// @return tickCumulativeInside The snapshot of the tick accumulator for the range\\n /// @return secondsPerLiquidityInsideX128 The snapshot of seconds per liquidity for the range\\n /// @return secondsInside The snapshot of seconds per liquidity for the range\\n function snapshotCumulativesInside(int24 tickLower, int24 tickUpper)\\n external\\n view\\n returns (\\n int56 tickCumulativeInside,\\n uint160 secondsPerLiquidityInsideX128,\\n uint32 secondsInside\\n );\\n}\\n\",\"keccak256\":\"0xe603ac5b17ecdee73ba2b27efdf386c257a19c14206e87eee77e2017b742d9e5\",\"license\":\"GPL-2.0-or-later\"},\"@uniswap/v3-core/contracts/interfaces/pool/IUniswapV3PoolEvents.sol\":{\"content\":\"// SPDX-License-Identifier: GPL-2.0-or-later\\npragma solidity >=0.5.0;\\n\\n/// @title Events emitted by a pool\\n/// @notice Contains all events emitted by the pool\\ninterface IUniswapV3PoolEvents {\\n /// @notice Emitted exactly once by a pool when #initialize is first called on the pool\\n /// @dev Mint/Burn/Swap cannot be emitted by the pool before Initialize\\n /// @param sqrtPriceX96 The initial sqrt price of the pool, as a Q64.96\\n /// @param tick The initial tick of the pool, i.e. log base 1.0001 of the starting price of the pool\\n event Initialize(uint160 sqrtPriceX96, int24 tick);\\n\\n /// @notice Emitted when liquidity is minted for a given position\\n /// @param sender The address that minted the liquidity\\n /// @param owner The owner of the position and recipient of any minted liquidity\\n /// @param tickLower The lower tick of the position\\n /// @param tickUpper The upper tick of the position\\n /// @param amount The amount of liquidity minted to the position range\\n /// @param amount0 How much token0 was required for the minted liquidity\\n /// @param amount1 How much token1 was required for the minted liquidity\\n event Mint(\\n address sender,\\n address indexed owner,\\n int24 indexed tickLower,\\n int24 indexed tickUpper,\\n uint128 amount,\\n uint256 amount0,\\n uint256 amount1\\n );\\n\\n /// @notice Emitted when fees are collected by the owner of a position\\n /// @dev Collect events may be emitted with zero amount0 and amount1 when the caller chooses not to collect fees\\n /// @param owner The owner of the position for which fees are collected\\n /// @param tickLower The lower tick of the position\\n /// @param tickUpper The upper tick of the position\\n /// @param amount0 The amount of token0 fees collected\\n /// @param amount1 The amount of token1 fees collected\\n event Collect(\\n address indexed owner,\\n address recipient,\\n int24 indexed tickLower,\\n int24 indexed tickUpper,\\n uint128 amount0,\\n uint128 amount1\\n );\\n\\n /// @notice Emitted when a position's liquidity is removed\\n /// @dev Does not withdraw any fees earned by the liquidity position, which must be withdrawn via #collect\\n /// @param owner The owner of the position for which liquidity is removed\\n /// @param tickLower The lower tick of the position\\n /// @param tickUpper The upper tick of the position\\n /// @param amount The amount of liquidity to remove\\n /// @param amount0 The amount of token0 withdrawn\\n /// @param amount1 The amount of token1 withdrawn\\n event Burn(\\n address indexed owner,\\n int24 indexed tickLower,\\n int24 indexed tickUpper,\\n uint128 amount,\\n uint256 amount0,\\n uint256 amount1\\n );\\n\\n /// @notice Emitted by the pool for any swaps between token0 and token1\\n /// @param sender The address that initiated the swap call, and that received the callback\\n /// @param recipient The address that received the output of the swap\\n /// @param amount0 The delta of the token0 balance of the pool\\n /// @param amount1 The delta of the token1 balance of the pool\\n /// @param sqrtPriceX96 The sqrt(price) of the pool after the swap, as a Q64.96\\n /// @param liquidity The liquidity of the pool after the swap\\n /// @param tick The log base 1.0001 of price of the pool after the swap\\n event Swap(\\n address indexed sender,\\n address indexed recipient,\\n int256 amount0,\\n int256 amount1,\\n uint160 sqrtPriceX96,\\n uint128 liquidity,\\n int24 tick\\n );\\n\\n /// @notice Emitted by the pool for any flashes of token0/token1\\n /// @param sender The address that initiated the swap call, and that received the callback\\n /// @param recipient The address that received the tokens from flash\\n /// @param amount0 The amount of token0 that was flashed\\n /// @param amount1 The amount of token1 that was flashed\\n /// @param paid0 The amount of token0 paid for the flash, which can exceed the amount0 plus the fee\\n /// @param paid1 The amount of token1 paid for the flash, which can exceed the amount1 plus the fee\\n event Flash(\\n address indexed sender,\\n address indexed recipient,\\n uint256 amount0,\\n uint256 amount1,\\n uint256 paid0,\\n uint256 paid1\\n );\\n\\n /// @notice Emitted by the pool for increases to the number of observations that can be stored\\n /// @dev observationCardinalityNext is not the observation cardinality until an observation is written at the index\\n /// just before a mint/swap/burn.\\n /// @param observationCardinalityNextOld The previous value of the next observation cardinality\\n /// @param observationCardinalityNextNew The updated value of the next observation cardinality\\n event IncreaseObservationCardinalityNext(\\n uint16 observationCardinalityNextOld,\\n uint16 observationCardinalityNextNew\\n );\\n\\n /// @notice Emitted when the protocol fee is changed by the pool\\n /// @param feeProtocol0Old The previous value of the token0 protocol fee\\n /// @param feeProtocol1Old The previous value of the token1 protocol fee\\n /// @param feeProtocol0New The updated value of the token0 protocol fee\\n /// @param feeProtocol1New The updated value of the token1 protocol fee\\n event SetFeeProtocol(uint8 feeProtocol0Old, uint8 feeProtocol1Old, uint8 feeProtocol0New, uint8 feeProtocol1New);\\n\\n /// @notice Emitted when the collected protocol fees are withdrawn by the factory owner\\n /// @param sender The address that collects the protocol fees\\n /// @param recipient The address that receives the collected protocol fees\\n /// @param amount0 The amount of token0 protocol fees that is withdrawn\\n /// @param amount0 The amount of token1 protocol fees that is withdrawn\\n event CollectProtocol(address indexed sender, address indexed recipient, uint128 amount0, uint128 amount1);\\n}\\n\",\"keccak256\":\"0x8071514d0fe5d17d6fbd31c191cdfb703031c24e0ece3621d88ab10e871375cd\",\"license\":\"GPL-2.0-or-later\"},\"@uniswap/v3-core/contracts/interfaces/pool/IUniswapV3PoolImmutables.sol\":{\"content\":\"// SPDX-License-Identifier: GPL-2.0-or-later\\npragma solidity >=0.5.0;\\n\\n/// @title Pool state that never changes\\n/// @notice These parameters are fixed for a pool forever, i.e., the methods will always return the same values\\ninterface IUniswapV3PoolImmutables {\\n /// @notice The contract that deployed the pool, which must adhere to the IUniswapV3Factory interface\\n /// @return The contract address\\n function factory() external view returns (address);\\n\\n /// @notice The first of the two tokens of the pool, sorted by address\\n /// @return The token contract address\\n function token0() external view returns (address);\\n\\n /// @notice The second of the two tokens of the pool, sorted by address\\n /// @return The token contract address\\n function token1() external view returns (address);\\n\\n /// @notice The pool's fee in hundredths of a bip, i.e. 1e-6\\n /// @return The fee\\n function fee() external view returns (uint24);\\n\\n /// @notice The pool tick spacing\\n /// @dev Ticks can only be used at multiples of this value, minimum of 1 and always positive\\n /// e.g.: a tickSpacing of 3 means ticks can be initialized every 3rd tick, i.e., ..., -6, -3, 0, 3, 6, ...\\n /// This value is an int24 to avoid casting even though it is always positive.\\n /// @return The tick spacing\\n function tickSpacing() external view returns (int24);\\n\\n /// @notice The maximum amount of position liquidity that can use any tick in the range\\n /// @dev This parameter is enforced per tick to prevent liquidity from overflowing a uint128 at any point, and\\n /// also prevents out-of-range liquidity from being used to prevent adding in-range liquidity to a pool\\n /// @return The max amount of liquidity per tick\\n function maxLiquidityPerTick() external view returns (uint128);\\n}\\n\",\"keccak256\":\"0xf6e5d2cd1139c4c276bdbc8e1d2b256e456c866a91f1b868da265c6d2685c3f7\",\"license\":\"GPL-2.0-or-later\"},\"@uniswap/v3-core/contracts/interfaces/pool/IUniswapV3PoolOwnerActions.sol\":{\"content\":\"// SPDX-License-Identifier: GPL-2.0-or-later\\npragma solidity >=0.5.0;\\n\\n/// @title Permissioned pool actions\\n/// @notice Contains pool methods that may only be called by the factory owner\\ninterface IUniswapV3PoolOwnerActions {\\n /// @notice Set the denominator of the protocol's % share of the fees\\n /// @param feeProtocol0 new protocol fee for token0 of the pool\\n /// @param feeProtocol1 new protocol fee for token1 of the pool\\n function setFeeProtocol(uint8 feeProtocol0, uint8 feeProtocol1) external;\\n\\n /// @notice Collect the protocol fee accrued to the pool\\n /// @param recipient The address to which collected protocol fees should be sent\\n /// @param amount0Requested The maximum amount of token0 to send, can be 0 to collect fees in only token1\\n /// @param amount1Requested The maximum amount of token1 to send, can be 0 to collect fees in only token0\\n /// @return amount0 The protocol fee collected in token0\\n /// @return amount1 The protocol fee collected in token1\\n function collectProtocol(\\n address recipient,\\n uint128 amount0Requested,\\n uint128 amount1Requested\\n ) external returns (uint128 amount0, uint128 amount1);\\n}\\n\",\"keccak256\":\"0x759b78a2918af9e99e246dc3af084f654e48ef32bb4e4cb8a966aa3dcaece235\",\"license\":\"GPL-2.0-or-later\"},\"@uniswap/v3-core/contracts/interfaces/pool/IUniswapV3PoolState.sol\":{\"content\":\"// SPDX-License-Identifier: GPL-2.0-or-later\\npragma solidity >=0.5.0;\\n\\n/// @title Pool state that can change\\n/// @notice These methods compose the pool's state, and can change with any frequency including multiple times\\n/// per transaction\\ninterface IUniswapV3PoolState {\\n /// @notice The 0th storage slot in the pool stores many values, and is exposed as a single method to save gas\\n /// when accessed externally.\\n /// @return sqrtPriceX96 The current price of the pool as a sqrt(token1/token0) Q64.96 value\\n /// tick The current tick of the pool, i.e. according to the last tick transition that was run.\\n /// This value may not always be equal to SqrtTickMath.getTickAtSqrtRatio(sqrtPriceX96) if the price is on a tick\\n /// boundary.\\n /// observationIndex The index of the last oracle observation that was written,\\n /// observationCardinality The current maximum number of observations stored in the pool,\\n /// observationCardinalityNext The next maximum number of observations, to be updated when the observation.\\n /// feeProtocol The protocol fee for both tokens of the pool.\\n /// Encoded as two 4 bit values, where the protocol fee of token1 is shifted 4 bits and the protocol fee of token0\\n /// is the lower 4 bits. Used as the denominator of a fraction of the swap fee, e.g. 4 means 1/4th of the swap fee.\\n /// unlocked Whether the pool is currently locked to reentrancy\\n function slot0()\\n external\\n view\\n returns (\\n uint160 sqrtPriceX96,\\n int24 tick,\\n uint16 observationIndex,\\n uint16 observationCardinality,\\n uint16 observationCardinalityNext,\\n uint8 feeProtocol,\\n bool unlocked\\n );\\n\\n /// @notice The fee growth as a Q128.128 fees of token0 collected per unit of liquidity for the entire life of the pool\\n /// @dev This value can overflow the uint256\\n function feeGrowthGlobal0X128() external view returns (uint256);\\n\\n /// @notice The fee growth as a Q128.128 fees of token1 collected per unit of liquidity for the entire life of the pool\\n /// @dev This value can overflow the uint256\\n function feeGrowthGlobal1X128() external view returns (uint256);\\n\\n /// @notice The amounts of token0 and token1 that are owed to the protocol\\n /// @dev Protocol fees will never exceed uint128 max in either token\\n function protocolFees() external view returns (uint128 token0, uint128 token1);\\n\\n /// @notice The currently in range liquidity available to the pool\\n /// @dev This value has no relationship to the total liquidity across all ticks\\n function liquidity() external view returns (uint128);\\n\\n /// @notice Look up information about a specific tick in the pool\\n /// @param tick The tick to look up\\n /// @return liquidityGross the total amount of position liquidity that uses the pool either as tick lower or\\n /// tick upper,\\n /// liquidityNet how much liquidity changes when the pool price crosses the tick,\\n /// feeGrowthOutside0X128 the fee growth on the other side of the tick from the current tick in token0,\\n /// feeGrowthOutside1X128 the fee growth on the other side of the tick from the current tick in token1,\\n /// tickCumulativeOutside the cumulative tick value on the other side of the tick from the current tick\\n /// secondsPerLiquidityOutsideX128 the seconds spent per liquidity on the other side of the tick from the current tick,\\n /// secondsOutside the seconds spent on the other side of the tick from the current tick,\\n /// initialized Set to true if the tick is initialized, i.e. liquidityGross is greater than 0, otherwise equal to false.\\n /// Outside values can only be used if the tick is initialized, i.e. if liquidityGross is greater than 0.\\n /// In addition, these values are only relative and must be used only in comparison to previous snapshots for\\n /// a specific position.\\n function ticks(int24 tick)\\n external\\n view\\n returns (\\n uint128 liquidityGross,\\n int128 liquidityNet,\\n uint256 feeGrowthOutside0X128,\\n uint256 feeGrowthOutside1X128,\\n int56 tickCumulativeOutside,\\n uint160 secondsPerLiquidityOutsideX128,\\n uint32 secondsOutside,\\n bool initialized\\n );\\n\\n /// @notice Returns 256 packed tick initialized boolean values. See TickBitmap for more information\\n function tickBitmap(int16 wordPosition) external view returns (uint256);\\n\\n /// @notice Returns the information about a position by the position's key\\n /// @param key The position's key is a hash of a preimage composed by the owner, tickLower and tickUpper\\n /// @return _liquidity The amount of liquidity in the position,\\n /// Returns feeGrowthInside0LastX128 fee growth of token0 inside the tick range as of the last mint/burn/poke,\\n /// Returns feeGrowthInside1LastX128 fee growth of token1 inside the tick range as of the last mint/burn/poke,\\n /// Returns tokensOwed0 the computed amount of token0 owed to the position as of the last mint/burn/poke,\\n /// Returns tokensOwed1 the computed amount of token1 owed to the position as of the last mint/burn/poke\\n function positions(bytes32 key)\\n external\\n view\\n returns (\\n uint128 _liquidity,\\n uint256 feeGrowthInside0LastX128,\\n uint256 feeGrowthInside1LastX128,\\n uint128 tokensOwed0,\\n uint128 tokensOwed1\\n );\\n\\n /// @notice Returns data about a specific observation index\\n /// @param index The element of the observations array to fetch\\n /// @dev You most likely want to use #observe() instead of this method to get an observation as of some amount of time\\n /// ago, rather than at a specific index in the array.\\n /// @return blockTimestamp The timestamp of the observation,\\n /// Returns tickCumulative the tick multiplied by seconds elapsed for the life of the pool as of the observation timestamp,\\n /// Returns secondsPerLiquidityCumulativeX128 the seconds per in range liquidity for the life of the pool as of the observation timestamp,\\n /// Returns initialized whether the observation has been initialized and the values are safe to use\\n function observations(uint256 index)\\n external\\n view\\n returns (\\n uint32 blockTimestamp,\\n int56 tickCumulative,\\n uint160 secondsPerLiquidityCumulativeX128,\\n bool initialized\\n );\\n}\\n\",\"keccak256\":\"0x852dc1f5df7dcf7f11e7bb3eed79f0cea72ad4b25f6a9d2c35aafb48925fd49f\",\"license\":\"GPL-2.0-or-later\"},\"solidity/contracts/UniV3PairManager.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\n/*\\n\\nCoded for The Keep3r Network with \\u2665 by\\n\\n\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2557\\u2591\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2557\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2557\\u2588\\u2588\\u2557\\u2003\\u2003\\u2591\\u2588\\u2588\\u2557\\u2591\\u2591\\u2591\\u2591\\u2591\\u2591\\u2591\\u2588\\u2588\\u2557\\u2591\\u2588\\u2588\\u2588\\u2588\\u2588\\u2557\\u2591\\u2588\\u2588\\u2588\\u2557\\u2591\\u2591\\u2588\\u2588\\u2557\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2557\\u2591\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2557\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2557\\u2591\\u2588\\u2588\\u2557\\u2591\\u2591\\u2591\\u2591\\u2591\\u2591\\u2588\\u2588\\u2588\\u2588\\u2588\\u2557\\u2591\\u2588\\u2588\\u2588\\u2557\\u2591\\u2591\\u2588\\u2588\\u2557\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2557\\u2591\\n\\u2588\\u2588\\u2554\\u2550\\u2550\\u2588\\u2588\\u2557\\u2588\\u2588\\u2554\\u2550\\u2550\\u2550\\u2550\\u255d\\u2588\\u2588\\u2554\\u2550\\u2550\\u2550\\u2550\\u255d\\u2588\\u2588\\u2551\\u2003\\u2003\\u2591\\u2588\\u2588\\u2551\\u2591\\u2591\\u2588\\u2588\\u2557\\u2591\\u2591\\u2588\\u2588\\u2551\\u2588\\u2588\\u2554\\u2550\\u2550\\u2588\\u2588\\u2557\\u2588\\u2588\\u2588\\u2588\\u2557\\u2591\\u2588\\u2588\\u2551\\u2588\\u2588\\u2554\\u2550\\u2550\\u2588\\u2588\\u2557\\u2588\\u2588\\u2554\\u2550\\u2550\\u2550\\u2550\\u255d\\u2588\\u2588\\u2554\\u2550\\u2550\\u2588\\u2588\\u2557\\u2588\\u2588\\u2551\\u2591\\u2591\\u2591\\u2591\\u2591\\u2588\\u2588\\u2554\\u2550\\u2550\\u2588\\u2588\\u2557\\u2588\\u2588\\u2588\\u2588\\u2557\\u2591\\u2588\\u2588\\u2551\\u2588\\u2588\\u2554\\u2550\\u2550\\u2588\\u2588\\u2557\\n\\u2588\\u2588\\u2551\\u2591\\u2591\\u2588\\u2588\\u2551\\u2588\\u2588\\u2588\\u2588\\u2588\\u2557\\u2591\\u2591\\u2588\\u2588\\u2588\\u2588\\u2588\\u2557\\u2591\\u2591\\u2588\\u2588\\u2551\\u2003\\u2003\\u2591\\u255a\\u2588\\u2588\\u2557\\u2588\\u2588\\u2588\\u2588\\u2557\\u2588\\u2588\\u2554\\u255d\\u2588\\u2588\\u2551\\u2591\\u2591\\u2588\\u2588\\u2551\\u2588\\u2588\\u2554\\u2588\\u2588\\u2557\\u2588\\u2588\\u2551\\u2588\\u2588\\u2551\\u2591\\u2591\\u2588\\u2588\\u2551\\u2588\\u2588\\u2588\\u2588\\u2588\\u2557\\u2591\\u2591\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2554\\u255d\\u2588\\u2588\\u2551\\u2591\\u2591\\u2591\\u2591\\u2591\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2551\\u2588\\u2588\\u2554\\u2588\\u2588\\u2557\\u2588\\u2588\\u2551\\u2588\\u2588\\u2551\\u2591\\u2591\\u2588\\u2588\\u2551\\n\\u2588\\u2588\\u2551\\u2591\\u2591\\u2588\\u2588\\u2551\\u2588\\u2588\\u2554\\u2550\\u2550\\u255d\\u2591\\u2591\\u2588\\u2588\\u2554\\u2550\\u2550\\u255d\\u2591\\u2591\\u2588\\u2588\\u2551\\u2003\\u2003\\u2591\\u2591\\u2588\\u2588\\u2588\\u2588\\u2554\\u2550\\u2588\\u2588\\u2588\\u2588\\u2551\\u2591\\u2588\\u2588\\u2551\\u2591\\u2591\\u2588\\u2588\\u2551\\u2588\\u2588\\u2551\\u255a\\u2588\\u2588\\u2588\\u2588\\u2551\\u2588\\u2588\\u2551\\u2591\\u2591\\u2588\\u2588\\u2551\\u2588\\u2588\\u2554\\u2550\\u2550\\u255d\\u2591\\u2591\\u2588\\u2588\\u2554\\u2550\\u2550\\u2588\\u2588\\u2557\\u2588\\u2588\\u2551\\u2591\\u2591\\u2591\\u2591\\u2591\\u2588\\u2588\\u2554\\u2550\\u2550\\u2588\\u2588\\u2551\\u2588\\u2588\\u2551\\u255a\\u2588\\u2588\\u2588\\u2588\\u2551\\u2588\\u2588\\u2551\\u2591\\u2591\\u2588\\u2588\\u2551\\n\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2554\\u255d\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2557\\u2588\\u2588\\u2551\\u2591\\u2591\\u2591\\u2591\\u2591\\u2588\\u2588\\u2551\\u2003\\u2003\\u2591\\u2591\\u255a\\u2588\\u2588\\u2554\\u255d\\u2591\\u255a\\u2588\\u2588\\u2554\\u255d\\u2591\\u255a\\u2588\\u2588\\u2588\\u2588\\u2588\\u2554\\u255d\\u2588\\u2588\\u2551\\u2591\\u255a\\u2588\\u2588\\u2588\\u2551\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2554\\u255d\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2557\\u2588\\u2588\\u2551\\u2591\\u2591\\u2588\\u2588\\u2551\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2557\\u2588\\u2588\\u2551\\u2591\\u2591\\u2588\\u2588\\u2551\\u2588\\u2588\\u2551\\u2591\\u255a\\u2588\\u2588\\u2588\\u2551\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2554\\u255d\\n\\u255a\\u2550\\u2550\\u2550\\u2550\\u2550\\u255d\\u2591\\u255a\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u255d\\u255a\\u2550\\u255d\\u2591\\u2591\\u2591\\u2591\\u2591\\u255a\\u2550\\u255d\\u2003\\u2003\\u2591\\u2591\\u2591\\u255a\\u2550\\u255d\\u2591\\u2591\\u2591\\u255a\\u2550\\u255d\\u2591\\u2591\\u2591\\u255a\\u2550\\u2550\\u2550\\u2550\\u255d\\u2591\\u255a\\u2550\\u255d\\u2591\\u2591\\u255a\\u2550\\u2550\\u255d\\u255a\\u2550\\u2550\\u2550\\u2550\\u2550\\u255d\\u2591\\u255a\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u255d\\u255a\\u2550\\u255d\\u2591\\u2591\\u255a\\u2550\\u255d\\u255a\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u255d\\u255a\\u2550\\u255d\\u2591\\u2591\\u255a\\u2550\\u255d\\u255a\\u2550\\u255d\\u2591\\u2591\\u255a\\u2550\\u2550\\u255d\\u255a\\u2550\\u2550\\u2550\\u2550\\u2550\\u255d\\u2591\\n\\nhttps://defi.sucks\\n\\n*/\\n\\npragma solidity >=0.8.4 <0.9.0;\\n\\nimport '@defi-wonderland/solidity-utils/solidity/contracts/Governable.sol';\\nimport '@openzeppelin/contracts/token/ERC20/ERC20.sol';\\nimport '@uniswap/v3-core/contracts/interfaces/IUniswapV3Pool.sol';\\n\\nimport './libraries/LiquidityAmounts.sol';\\nimport './libraries/FixedPoint96.sol';\\nimport './libraries/FullMath.sol';\\nimport './libraries/TickMath.sol';\\n\\nimport '../interfaces/external/IWeth9.sol';\\nimport '../interfaces/IUniV3PairManager.sol';\\n\\ncontract UniV3PairManager is IUniV3PairManager, Governable {\\n /// @inheritdoc IERC20Metadata\\n string public override name;\\n\\n /// @inheritdoc IERC20Metadata\\n string public override symbol;\\n\\n /// @inheritdoc IERC20\\n uint256 public override totalSupply;\\n\\n /// @inheritdoc IPairManager\\n address public immutable override factory;\\n\\n /// @inheritdoc IPairManager\\n address public immutable override token0;\\n\\n /// @inheritdoc IPairManager\\n address public immutable override token1;\\n\\n /// @inheritdoc IPairManager\\n address public immutable override pool;\\n\\n /// @inheritdoc IUniV3PairManager\\n uint24 public immutable override fee;\\n\\n /// @inheritdoc IUniV3PairManager\\n uint160 public immutable override sqrtRatioAX96;\\n\\n /// @inheritdoc IUniV3PairManager\\n uint160 public immutable override sqrtRatioBX96;\\n\\n /// @inheritdoc IUniV3PairManager\\n int24 public immutable override tickLower;\\n\\n /// @inheritdoc IUniV3PairManager\\n int24 public immutable override tickUpper;\\n\\n /// @inheritdoc IUniV3PairManager\\n int24 public immutable override tickSpacing;\\n\\n /// @notice Uniswap's maximum tick\\n /// @dev Due to tick spacing, pools with different fees may have differences between _MAX_TICK and tickUpper. Use tickUpper to find the max tick of the pool.\\n int24 private constant _MAX_TICK = 887272;\\n\\n /// @inheritdoc IERC20Metadata\\n //solhint-disable-next-line const-name-snakecase\\n uint8 public constant override decimals = 18;\\n\\n /// @inheritdoc IERC20\\n mapping(address => mapping(address => uint256)) public override allowance;\\n\\n /// @inheritdoc IERC20\\n mapping(address => uint256) public override balanceOf;\\n\\n /// @notice Struct that contains token0, token1, and fee of the Uniswap pool\\n PoolKey private _poolKey;\\n\\n constructor(address _pool, address _governor) Governable(_governor) {\\n uint24 _fee = IUniswapV3Pool(_pool).fee();\\n address _token0 = IUniswapV3Pool(_pool).token0();\\n address _token1 = IUniswapV3Pool(_pool).token1();\\n int24 _tickSpacing = IUniswapV3Pool(_pool).tickSpacing();\\n int24 _tickUpper = _MAX_TICK - (_MAX_TICK % _tickSpacing);\\n int24 _tickLower = -_tickUpper;\\n\\n factory = msg.sender;\\n pool = _pool;\\n fee = _fee;\\n tickSpacing = _tickSpacing;\\n tickUpper = _tickUpper;\\n tickLower = _tickLower;\\n token0 = _token0;\\n token1 = _token1;\\n name = string(abi.encodePacked('Keep3rLP - ', ERC20(_token0).symbol(), '/', ERC20(_token1).symbol()));\\n symbol = string(abi.encodePacked('kLP-', ERC20(_token0).symbol(), '/', ERC20(_token1).symbol()));\\n\\n sqrtRatioAX96 = TickMath.getSqrtRatioAtTick(_tickLower);\\n sqrtRatioBX96 = TickMath.getSqrtRatioAtTick(_tickUpper);\\n _poolKey = PoolKey({token0: _token0, token1: _token1, fee: _fee});\\n }\\n\\n // This low-level function should be called from a contract which performs important safety checks\\n /// @inheritdoc IUniV3PairManager\\n function mint(\\n uint256 amount0Desired,\\n uint256 amount1Desired,\\n uint256 amount0Min,\\n uint256 amount1Min,\\n address to\\n ) external override returns (uint128 liquidity) {\\n (liquidity, , ) = _addLiquidity(amount0Desired, amount1Desired, amount0Min, amount1Min);\\n _mint(to, liquidity);\\n }\\n\\n /// @inheritdoc IUniV3PairManager\\n function uniswapV3MintCallback(\\n uint256 amount0Owed,\\n uint256 amount1Owed,\\n bytes calldata data\\n ) external override {\\n MintCallbackData memory decoded = abi.decode(data, (MintCallbackData));\\n if (msg.sender != pool) revert OnlyPool();\\n if (amount0Owed > 0) _pay(decoded._poolKey.token0, decoded.payer, pool, amount0Owed);\\n if (amount1Owed > 0) _pay(decoded._poolKey.token1, decoded.payer, pool, amount1Owed);\\n }\\n\\n /// @inheritdoc IUniV3PairManager\\n function burn(\\n uint128 liquidity,\\n uint256 amount0Min,\\n uint256 amount1Min,\\n address to\\n ) external override returns (uint256 amount0, uint256 amount1) {\\n (amount0, amount1) = IUniswapV3Pool(pool).burn(tickLower, tickUpper, liquidity);\\n\\n if (amount0 < amount0Min || amount1 < amount1Min) revert ExcessiveSlippage();\\n\\n IUniswapV3Pool(pool).collect(to, tickLower, tickUpper, uint128(amount0), uint128(amount1));\\n _burn(msg.sender, liquidity);\\n }\\n\\n /// @inheritdoc IUniV3PairManager\\n function collect() external override onlyGovernor returns (uint256 amount0, uint256 amount1) {\\n (, , , uint128 tokensOwed0, uint128 tokensOwed1) = IUniswapV3Pool(pool).positions(\\n keccak256(abi.encodePacked(address(this), tickLower, tickUpper))\\n );\\n (amount0, amount1) = IUniswapV3Pool(pool).collect(governor, tickLower, tickUpper, tokensOwed0, tokensOwed1);\\n }\\n\\n /// @inheritdoc IUniV3PairManager\\n function position()\\n external\\n view\\n override\\n returns (\\n uint128 liquidity,\\n uint256 feeGrowthInside0LastX128,\\n uint256 feeGrowthInside1LastX128,\\n uint128 tokensOwed0,\\n uint128 tokensOwed1\\n )\\n {\\n (liquidity, feeGrowthInside0LastX128, feeGrowthInside1LastX128, tokensOwed0, tokensOwed1) = IUniswapV3Pool(pool).positions(\\n keccak256(abi.encodePacked(address(this), tickLower, tickUpper))\\n );\\n }\\n\\n /// @inheritdoc IERC20\\n function approve(address spender, uint256 amount) external override returns (bool) {\\n allowance[msg.sender][spender] = amount;\\n\\n emit Approval(msg.sender, spender, amount);\\n return true;\\n }\\n\\n /// @inheritdoc IERC20\\n function transfer(address to, uint256 amount) external override returns (bool) {\\n _transferTokens(msg.sender, to, amount);\\n return true;\\n }\\n\\n /// @inheritdoc IERC20\\n function transferFrom(\\n address from,\\n address to,\\n uint256 amount\\n ) external override returns (bool) {\\n address spender = msg.sender;\\n uint256 spenderAllowance = allowance[from][spender];\\n\\n if (spender != from && spenderAllowance != type(uint256).max) {\\n uint256 newAllowance = spenderAllowance - amount;\\n allowance[from][spender] = newAllowance;\\n\\n emit Approval(from, spender, newAllowance);\\n }\\n\\n _transferTokens(from, to, amount);\\n return true;\\n }\\n\\n /// @notice Adds liquidity to an initialized pool\\n /// @dev Reverts if the returned amount0 is less than amount0Min or if amount1 is less than amount1Min\\n /// @dev This function calls the mint function of the corresponding Uniswap pool, which in turn calls UniswapV3Callback\\n /// @param amount0Desired The amount of token0 we would like to provide\\n /// @param amount1Desired The amount of token1 we would like to provide\\n /// @param amount0Min The minimum amount of token0 we want to provide\\n /// @param amount1Min The minimum amount of token1 we want to provide\\n /// @return liquidity The calculated liquidity we get for the token amounts we provided\\n /// @return amount0 The amount of token0 we ended up providing\\n /// @return amount1 The amount of token1 we ended up providing\\n function _addLiquidity(\\n uint256 amount0Desired,\\n uint256 amount1Desired,\\n uint256 amount0Min,\\n uint256 amount1Min\\n )\\n internal\\n returns (\\n uint128 liquidity,\\n uint256 amount0,\\n uint256 amount1\\n )\\n {\\n (uint160 sqrtPriceX96, , , , , , ) = IUniswapV3Pool(pool).slot0();\\n\\n liquidity = LiquidityAmounts.getLiquidityForAmounts(sqrtPriceX96, sqrtRatioAX96, sqrtRatioBX96, amount0Desired, amount1Desired);\\n\\n (amount0, amount1) = IUniswapV3Pool(pool).mint(\\n address(this),\\n tickLower,\\n tickUpper,\\n liquidity,\\n abi.encode(MintCallbackData({_poolKey: _poolKey, payer: msg.sender}))\\n );\\n\\n if (amount0 < amount0Min || amount1 < amount1Min) revert ExcessiveSlippage();\\n }\\n\\n /// @notice Transfers the passed-in token from the payer to the recipient for the corresponding value\\n /// @param token The token to be transferred to the recipient\\n /// @param from The address of the payer\\n /// @param to The address of the passed-in tokens recipient\\n /// @param value How much of that token to be transferred from payer to the recipient\\n function _pay(\\n address token,\\n address from,\\n address to,\\n uint256 value\\n ) internal {\\n _safeTransferFrom(token, from, to, value);\\n }\\n\\n /// @notice Mints Keep3r credits to the passed-in address of recipient and increases total supply of Keep3r credits by the corresponding amount\\n /// @param to The recipient of the Keep3r credits\\n /// @param amount The amount Keep3r credits to be minted to the recipient\\n function _mint(address to, uint256 amount) internal {\\n totalSupply += amount;\\n balanceOf[to] += amount;\\n emit Transfer(address(0), to, amount);\\n }\\n\\n /// @notice Burns Keep3r credits to the passed-in address of recipient and reduces total supply of Keep3r credits by the corresponding amount\\n /// @param to The address that will get its Keep3r credits burned\\n /// @param amount The amount Keep3r credits to be burned from the recipient/recipient\\n function _burn(address to, uint256 amount) internal {\\n totalSupply -= amount;\\n balanceOf[to] -= amount;\\n emit Transfer(to, address(0), amount);\\n }\\n\\n /// @notice Transfers amount of Keep3r credits between two addresses\\n /// @param from The user that transfers the Keep3r credits\\n /// @param to The user that receives the Keep3r credits\\n /// @param amount The amount of Keep3r credits to be transferred\\n function _transferTokens(\\n address from,\\n address to,\\n uint256 amount\\n ) internal {\\n balanceOf[from] -= amount;\\n balanceOf[to] += amount;\\n\\n emit Transfer(from, to, amount);\\n }\\n\\n /// @notice Transfers the passed-in token from the specified \\\"from\\\" to the specified \\\"to\\\" for the corresponding value\\n /// @dev Reverts with IUniV3PairManager#UnsuccessfulTransfer if the transfer was not successful,\\n /// or if the passed data length is different than 0 and the decoded data is not a boolean\\n /// @param token The token to be transferred to the specified \\\"to\\\"\\n /// @param from The address which is going to transfer the tokens\\n /// @param value How much of that token to be transferred from \\\"from\\\" to \\\"to\\\"\\n function _safeTransferFrom(\\n address token,\\n address from,\\n address to,\\n uint256 value\\n ) internal {\\n // solhint-disable-next-line avoid-low-level-calls\\n (bool success, bytes memory data) = token.call(abi.encodeWithSelector(IERC20.transferFrom.selector, from, to, value));\\n if (!success || (data.length != 0 && !abi.decode(data, (bool)))) revert UnsuccessfulTransfer();\\n }\\n}\\n\",\"keccak256\":\"0xefe854535e94158ebe950e1017d9c45c3b81e8eefc00091398a3eb0e5eec4dde\",\"license\":\"MIT\"},\"solidity/contracts/libraries/FixedPoint96.sol\":{\"content\":\"// SPDX-License-Identifier: GPL-2.0-or-later\\npragma solidity >=0.8.4 <0.9.0;\\n\\nlibrary FixedPoint96 {\\n // solhint-disable\\n uint8 internal constant RESOLUTION = 96;\\n uint256 internal constant Q96 = 0x1000000000000000000000000;\\n}\\n\",\"keccak256\":\"0x32a5c51474a7a83b902ffd6f54f8407e2b98d1142c9b06914fb75d50dd9c573c\",\"license\":\"GPL-2.0-or-later\"},\"solidity/contracts/libraries/FullMath.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4 <0.9.0;\\n\\n/// @title Contains 512-bit math functions\\n/// @notice Facilitates multiplication and division that can have overflow of an intermediate value without any loss of precision\\n/// @dev Handles \\\"phantom overflow\\\" i.e., allows multiplication and division where an intermediate value overflows 256 bits\\nlibrary FullMath {\\n /// @notice Calculates floor(a\\u00d7b\\u00f7denominator) with full precision. Throws if result overflows a uint256 or denominator == 0\\n /// @param a The multiplicand\\n /// @param b The multiplier\\n /// @param denominator The divisor\\n /// @return result The 256-bit result\\n /// @dev Credit to Remco Bloemen under MIT license https://xn--2-umb.com/21/muldiv\\n function mulDiv(\\n uint256 a,\\n uint256 b,\\n uint256 denominator\\n ) internal pure returns (uint256 result) {\\n unchecked {\\n // 512-bit multiply [prod1 prod0] = a * b\\n // Compute the product mod 2**256 and mod 2**256 - 1\\n // then use the Chinese Remainder Theorem to reconstruct\\n // the 512 bit result. The result is stored in two 256\\n // variables such that product = prod1 * 2**256 + prod0\\n uint256 prod0; // Least significant 256 bits of the product\\n uint256 prod1; // Most significant 256 bits of the product\\n assembly {\\n let mm := mulmod(a, b, not(0))\\n prod0 := mul(a, b)\\n prod1 := sub(sub(mm, prod0), lt(mm, prod0))\\n }\\n\\n // Handle non-overflow cases, 256 by 256 division\\n if (prod1 == 0) {\\n require(denominator > 0);\\n assembly {\\n result := div(prod0, denominator)\\n }\\n return result;\\n }\\n\\n // Make sure the result is less than 2**256.\\n // Also prevents denominator == 0\\n require(denominator > prod1);\\n\\n ///////////////////////////////////////////////\\n // 512 by 256 division.\\n ///////////////////////////////////////////////\\n\\n // Make division exact by subtracting the remainder from [prod1 prod0]\\n // Compute remainder using mulmod\\n uint256 remainder;\\n assembly {\\n remainder := mulmod(a, b, denominator)\\n }\\n // Subtract 256 bit number from 512 bit number\\n assembly {\\n prod1 := sub(prod1, gt(remainder, prod0))\\n prod0 := sub(prod0, remainder)\\n }\\n\\n // Factor powers of two out of denominator\\n // Compute largest power of two divisor of denominator.\\n // Always >= 1.\\n uint256 twos = (~denominator + 1) & denominator;\\n // Divide denominator by power of two\\n assembly {\\n denominator := div(denominator, twos)\\n }\\n\\n // Divide [prod1 prod0] by the factors of two\\n assembly {\\n prod0 := div(prod0, twos)\\n }\\n // Shift in bits from prod1 into prod0. For this we need\\n // to flip `twos` such that it is 2**256 / twos.\\n // If twos is zero, then it becomes one\\n assembly {\\n twos := add(div(sub(0, twos), twos), 1)\\n }\\n prod0 |= prod1 * twos;\\n\\n // Invert denominator mod 2**256\\n // Now that denominator is an odd number, it has an inverse\\n // modulo 2**256 such that denominator * inv = 1 mod 2**256.\\n // Compute the inverse by starting with a seed that is correct\\n // correct for four bits. That is, denominator * inv = 1 mod 2**4\\n uint256 inv = (3 * denominator) ^ 2;\\n // Now use Newton-Raphson iteration to improve the precision.\\n // Thanks to Hensel's lifting lemma, this also works in modular\\n // arithmetic, doubling the correct bits in each step.\\n inv *= 2 - denominator * inv; // inverse mod 2**8\\n inv *= 2 - denominator * inv; // inverse mod 2**16\\n inv *= 2 - denominator * inv; // inverse mod 2**32\\n inv *= 2 - denominator * inv; // inverse mod 2**64\\n inv *= 2 - denominator * inv; // inverse mod 2**128\\n inv *= 2 - denominator * inv; // inverse mod 2**256\\n\\n // Because the division is now exact we can divide by multiplying\\n // with the modular inverse of denominator. This will give us the\\n // correct result modulo 2**256. Since the precoditions guarantee\\n // that the outcome is less than 2**256, this is the final result.\\n // We don't need to compute the high bits of the result and prod1\\n // is no longer required.\\n result = prod0 * inv;\\n return result;\\n }\\n }\\n\\n /// @notice Calculates ceil(a\\u00d7b\\u00f7denominator) with full precision. Throws if result overflows a uint256 or denominator == 0\\n /// @param a The multiplicand\\n /// @param b The multiplier\\n /// @param denominator The divisor\\n /// @return result The 256-bit result\\n function mulDivRoundingUp(\\n uint256 a,\\n uint256 b,\\n uint256 denominator\\n ) internal pure returns (uint256 result) {\\n unchecked {\\n result = mulDiv(a, b, denominator);\\n if (mulmod(a, b, denominator) > 0) {\\n require(result < type(uint256).max);\\n result++;\\n }\\n }\\n }\\n}\\n\",\"keccak256\":\"0xe1c595da02adf8ba2ae74ac579b9b3c966d1ecb2a99c25081a62ee8550f26569\",\"license\":\"MIT\"},\"solidity/contracts/libraries/LiquidityAmounts.sol\":{\"content\":\"// SPDX-License-Identifier: GPL-2.0-or-later\\npragma solidity >=0.8.4 <0.9.0;\\n\\nimport './FullMath.sol';\\nimport './FixedPoint96.sol';\\n\\n// solhint-disable\\nlibrary LiquidityAmounts {\\n function toUint128(uint256 x) private pure returns (uint128 y) {\\n require((y = uint128(x)) == x);\\n }\\n\\n function getLiquidityForAmount0(\\n uint160 sqrtRatioAX96,\\n uint160 sqrtRatioBX96,\\n uint256 amount0\\n ) internal pure returns (uint128 liquidity) {\\n if (sqrtRatioAX96 > sqrtRatioBX96) (sqrtRatioAX96, sqrtRatioBX96) = (sqrtRatioBX96, sqrtRatioAX96);\\n uint256 intermediate = FullMath.mulDiv(sqrtRatioAX96, sqrtRatioBX96, FixedPoint96.Q96);\\n return toUint128(FullMath.mulDiv(amount0, intermediate, sqrtRatioBX96 - sqrtRatioAX96));\\n }\\n\\n function getLiquidityForAmount1(\\n uint160 sqrtRatioAX96,\\n uint160 sqrtRatioBX96,\\n uint256 amount1\\n ) internal pure returns (uint128 liquidity) {\\n if (sqrtRatioAX96 > sqrtRatioBX96) (sqrtRatioAX96, sqrtRatioBX96) = (sqrtRatioBX96, sqrtRatioAX96);\\n return toUint128(FullMath.mulDiv(amount1, FixedPoint96.Q96, sqrtRatioBX96 - sqrtRatioAX96));\\n }\\n\\n function getLiquidityForAmounts(\\n uint160 sqrtRatioX96,\\n uint160 sqrtRatioAX96,\\n uint160 sqrtRatioBX96,\\n uint256 amount0,\\n uint256 amount1\\n ) internal pure returns (uint128 liquidity) {\\n if (sqrtRatioAX96 > sqrtRatioBX96) (sqrtRatioAX96, sqrtRatioBX96) = (sqrtRatioBX96, sqrtRatioAX96);\\n\\n if (sqrtRatioX96 <= sqrtRatioAX96) {\\n liquidity = getLiquidityForAmount0(sqrtRatioAX96, sqrtRatioBX96, amount0);\\n } else if (sqrtRatioX96 < sqrtRatioBX96) {\\n uint128 liquidity0 = getLiquidityForAmount0(sqrtRatioX96, sqrtRatioBX96, amount0);\\n uint128 liquidity1 = getLiquidityForAmount1(sqrtRatioAX96, sqrtRatioX96, amount1);\\n\\n liquidity = liquidity0 < liquidity1 ? liquidity0 : liquidity1;\\n } else {\\n liquidity = getLiquidityForAmount1(sqrtRatioAX96, sqrtRatioBX96, amount1);\\n }\\n }\\n\\n function getAmount0ForLiquidity(\\n uint160 sqrtRatioAX96,\\n uint160 sqrtRatioBX96,\\n uint128 liquidity\\n ) internal pure returns (uint256 amount0) {\\n if (sqrtRatioAX96 > sqrtRatioBX96) (sqrtRatioAX96, sqrtRatioBX96) = (sqrtRatioBX96, sqrtRatioAX96);\\n\\n return FullMath.mulDiv(uint256(liquidity) << FixedPoint96.RESOLUTION, sqrtRatioBX96 - sqrtRatioAX96, sqrtRatioBX96) / sqrtRatioAX96;\\n }\\n\\n function getAmount1ForLiquidity(\\n uint160 sqrtRatioAX96,\\n uint160 sqrtRatioBX96,\\n uint128 liquidity\\n ) internal pure returns (uint256 amount1) {\\n if (sqrtRatioAX96 > sqrtRatioBX96) (sqrtRatioAX96, sqrtRatioBX96) = (sqrtRatioBX96, sqrtRatioAX96);\\n\\n return FullMath.mulDiv(liquidity, sqrtRatioBX96 - sqrtRatioAX96, FixedPoint96.Q96);\\n }\\n\\n function getAmountsForLiquidity(\\n uint160 sqrtRatioX96,\\n uint160 sqrtRatioAX96,\\n uint160 sqrtRatioBX96,\\n uint128 liquidity\\n ) internal pure returns (uint256 amount0, uint256 amount1) {\\n if (sqrtRatioAX96 > sqrtRatioBX96) (sqrtRatioAX96, sqrtRatioBX96) = (sqrtRatioBX96, sqrtRatioAX96);\\n\\n if (sqrtRatioX96 <= sqrtRatioAX96) {\\n amount0 = getAmount0ForLiquidity(sqrtRatioAX96, sqrtRatioBX96, liquidity);\\n } else if (sqrtRatioX96 < sqrtRatioBX96) {\\n amount0 = getAmount0ForLiquidity(sqrtRatioX96, sqrtRatioBX96, liquidity);\\n amount1 = getAmount1ForLiquidity(sqrtRatioAX96, sqrtRatioX96, liquidity);\\n } else {\\n amount1 = getAmount1ForLiquidity(sqrtRatioAX96, sqrtRatioBX96, liquidity);\\n }\\n }\\n}\\n\",\"keccak256\":\"0x33666cfb046e29d6a9539e552b7aace75daab08f0449fec13de7282bac84f786\",\"license\":\"GPL-2.0-or-later\"},\"solidity/contracts/libraries/TickMath.sol\":{\"content\":\"// SPDX-License-Identifier: GPL-2.0-or-later\\npragma solidity >=0.5.0;\\n\\n// solhint-disable\\n\\n/// @title Math library for computing sqrt prices from ticks and vice versa\\n/// @notice Computes sqrt price for ticks of size 1.0001, i.e. sqrt(1.0001^tick) as fixed point Q64.96 numbers. Supports\\n/// prices between 2**-128 and 2**128\\nlibrary TickMath {\\n /// @dev The minimum tick that may be passed to #getSqrtRatioAtTick computed from log base 1.0001 of 2**-128\\n int24 internal constant MIN_TICK = -887272;\\n /// @dev The maximum tick that may be passed to #getSqrtRatioAtTick computed from log base 1.0001 of 2**128\\n int24 internal constant MAX_TICK = -MIN_TICK;\\n\\n /// @dev The minimum value that can be returned from #getSqrtRatioAtTick. Equivalent to getSqrtRatioAtTick(MIN_TICK)\\n uint160 internal constant MIN_SQRT_RATIO = 4295128739;\\n /// @dev The maximum value that can be returned from #getSqrtRatioAtTick. Equivalent to getSqrtRatioAtTick(MAX_TICK)\\n uint160 internal constant MAX_SQRT_RATIO = 1461446703485210103287273052203988822378723970342;\\n\\n /// @notice Calculates sqrt(1.0001^tick) * 2^96\\n /// @dev Throws if |tick| > max tick\\n /// @param tick The input tick for the above formula\\n /// @return sqrtPriceX96 A Fixed point Q64.96 number representing the sqrt of the ratio of the two assets (token1/token0)\\n /// at the given tick\\n function getSqrtRatioAtTick(int24 tick) internal pure returns (uint160 sqrtPriceX96) {\\n uint256 absTick = tick < 0 ? uint256(-int256(tick)) : uint256(int256(tick));\\n require(absTick <= uint256(int256(MAX_TICK)), 'T');\\n\\n uint256 ratio = absTick & 0x1 != 0 ? 0xfffcb933bd6fad37aa2d162d1a594001 : 0x100000000000000000000000000000000;\\n if (absTick & 0x2 != 0) ratio = (ratio * 0xfff97272373d413259a46990580e213a) >> 128;\\n if (absTick & 0x4 != 0) ratio = (ratio * 0xfff2e50f5f656932ef12357cf3c7fdcc) >> 128;\\n if (absTick & 0x8 != 0) ratio = (ratio * 0xffe5caca7e10e4e61c3624eaa0941cd0) >> 128;\\n if (absTick & 0x10 != 0) ratio = (ratio * 0xffcb9843d60f6159c9db58835c926644) >> 128;\\n if (absTick & 0x20 != 0) ratio = (ratio * 0xff973b41fa98c081472e6896dfb254c0) >> 128;\\n if (absTick & 0x40 != 0) ratio = (ratio * 0xff2ea16466c96a3843ec78b326b52861) >> 128;\\n if (absTick & 0x80 != 0) ratio = (ratio * 0xfe5dee046a99a2a811c461f1969c3053) >> 128;\\n if (absTick & 0x100 != 0) ratio = (ratio * 0xfcbe86c7900a88aedcffc83b479aa3a4) >> 128;\\n if (absTick & 0x200 != 0) ratio = (ratio * 0xf987a7253ac413176f2b074cf7815e54) >> 128;\\n if (absTick & 0x400 != 0) ratio = (ratio * 0xf3392b0822b70005940c7a398e4b70f3) >> 128;\\n if (absTick & 0x800 != 0) ratio = (ratio * 0xe7159475a2c29b7443b29c7fa6e889d9) >> 128;\\n if (absTick & 0x1000 != 0) ratio = (ratio * 0xd097f3bdfd2022b8845ad8f792aa5825) >> 128;\\n if (absTick & 0x2000 != 0) ratio = (ratio * 0xa9f746462d870fdf8a65dc1f90e061e5) >> 128;\\n if (absTick & 0x4000 != 0) ratio = (ratio * 0x70d869a156d2a1b890bb3df62baf32f7) >> 128;\\n if (absTick & 0x8000 != 0) ratio = (ratio * 0x31be135f97d08fd981231505542fcfa6) >> 128;\\n if (absTick & 0x10000 != 0) ratio = (ratio * 0x9aa508b5b7a84e1c677de54f3e99bc9) >> 128;\\n if (absTick & 0x20000 != 0) ratio = (ratio * 0x5d6af8dedb81196699c329225ee604) >> 128;\\n if (absTick & 0x40000 != 0) ratio = (ratio * 0x2216e584f5fa1ea926041bedfe98) >> 128;\\n if (absTick & 0x80000 != 0) ratio = (ratio * 0x48a170391f7dc42444e8fa2) >> 128;\\n\\n if (tick > 0) ratio = type(uint256).max / ratio;\\n\\n // Divides by 1<<32 rounding up to go from a Q128.128 to a Q128.96.\\n // we then downcast because we know the result always fits within 160 bits due to our tick input constraint\\n // we round up in the division so getTickAtSqrtRatio of the output price is always consistent\\n sqrtPriceX96 = uint160((ratio >> 32) + (ratio % (1 << 32) == 0 ? 0 : 1));\\n }\\n\\n /// @notice Calculates the greatest tick value such that getRatioAtTick(tick) <= ratio\\n /// @dev Throws in case sqrtPriceX96 < MIN_SQRT_RATIO, as MIN_SQRT_RATIO is the lowest value getRatioAtTick may ever return.\\n /// @param sqrtPriceX96 The sqrt ratio for which to compute the tick as a Q64.96\\n /// @return tick The greatest tick for which the ratio is less than or equal to the input ratio\\n function getTickAtSqrtRatio(uint160 sqrtPriceX96) internal pure returns (int24 tick) {\\n // Second inequality must be < because the price can never reach the price at the max tick\\n require(sqrtPriceX96 >= MIN_SQRT_RATIO && sqrtPriceX96 < MAX_SQRT_RATIO, 'R');\\n uint256 ratio = uint256(sqrtPriceX96) << 32;\\n\\n uint256 r = ratio;\\n uint256 msb = 0;\\n\\n assembly {\\n let f := shl(7, gt(r, 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF))\\n msb := or(msb, f)\\n r := shr(f, r)\\n }\\n assembly {\\n let f := shl(6, gt(r, 0xFFFFFFFFFFFFFFFF))\\n msb := or(msb, f)\\n r := shr(f, r)\\n }\\n assembly {\\n let f := shl(5, gt(r, 0xFFFFFFFF))\\n msb := or(msb, f)\\n r := shr(f, r)\\n }\\n assembly {\\n let f := shl(4, gt(r, 0xFFFF))\\n msb := or(msb, f)\\n r := shr(f, r)\\n }\\n assembly {\\n let f := shl(3, gt(r, 0xFF))\\n msb := or(msb, f)\\n r := shr(f, r)\\n }\\n assembly {\\n let f := shl(2, gt(r, 0xF))\\n msb := or(msb, f)\\n r := shr(f, r)\\n }\\n assembly {\\n let f := shl(1, gt(r, 0x3))\\n msb := or(msb, f)\\n r := shr(f, r)\\n }\\n assembly {\\n let f := gt(r, 0x1)\\n msb := or(msb, f)\\n }\\n\\n if (msb >= 128) r = ratio >> (msb - 127);\\n else r = ratio << (127 - msb);\\n\\n int256 log_2 = (int256(msb) - 128) << 64;\\n\\n assembly {\\n r := shr(127, mul(r, r))\\n let f := shr(128, r)\\n log_2 := or(log_2, shl(63, f))\\n r := shr(f, r)\\n }\\n assembly {\\n r := shr(127, mul(r, r))\\n let f := shr(128, r)\\n log_2 := or(log_2, shl(62, f))\\n r := shr(f, r)\\n }\\n assembly {\\n r := shr(127, mul(r, r))\\n let f := shr(128, r)\\n log_2 := or(log_2, shl(61, f))\\n r := shr(f, r)\\n }\\n assembly {\\n r := shr(127, mul(r, r))\\n let f := shr(128, r)\\n log_2 := or(log_2, shl(60, f))\\n r := shr(f, r)\\n }\\n assembly {\\n r := shr(127, mul(r, r))\\n let f := shr(128, r)\\n log_2 := or(log_2, shl(59, f))\\n r := shr(f, r)\\n }\\n assembly {\\n r := shr(127, mul(r, r))\\n let f := shr(128, r)\\n log_2 := or(log_2, shl(58, f))\\n r := shr(f, r)\\n }\\n assembly {\\n r := shr(127, mul(r, r))\\n let f := shr(128, r)\\n log_2 := or(log_2, shl(57, f))\\n r := shr(f, r)\\n }\\n assembly {\\n r := shr(127, mul(r, r))\\n let f := shr(128, r)\\n log_2 := or(log_2, shl(56, f))\\n r := shr(f, r)\\n }\\n assembly {\\n r := shr(127, mul(r, r))\\n let f := shr(128, r)\\n log_2 := or(log_2, shl(55, f))\\n r := shr(f, r)\\n }\\n assembly {\\n r := shr(127, mul(r, r))\\n let f := shr(128, r)\\n log_2 := or(log_2, shl(54, f))\\n r := shr(f, r)\\n }\\n assembly {\\n r := shr(127, mul(r, r))\\n let f := shr(128, r)\\n log_2 := or(log_2, shl(53, f))\\n r := shr(f, r)\\n }\\n assembly {\\n r := shr(127, mul(r, r))\\n let f := shr(128, r)\\n log_2 := or(log_2, shl(52, f))\\n r := shr(f, r)\\n }\\n assembly {\\n r := shr(127, mul(r, r))\\n let f := shr(128, r)\\n log_2 := or(log_2, shl(51, f))\\n r := shr(f, r)\\n }\\n assembly {\\n r := shr(127, mul(r, r))\\n let f := shr(128, r)\\n log_2 := or(log_2, shl(50, f))\\n }\\n\\n int256 log_sqrt10001 = log_2 * 255738958999603826347141; // 128.128 number\\n\\n int24 tickLow = int24((log_sqrt10001 - 3402992956809132418596140100660247210) >> 128);\\n int24 tickHi = int24((log_sqrt10001 + 291339464771989622907027621153398088495) >> 128);\\n\\n tick = tickLow == tickHi ? tickLow : getSqrtRatioAtTick(tickHi) <= sqrtPriceX96 ? tickHi : tickLow;\\n }\\n}\\n\",\"keccak256\":\"0x11b965ba576ff91b4a6e9533c0f334f2b7b6024ee1c54e36d21799de5580899d\",\"license\":\"GPL-2.0-or-later\"},\"solidity/interfaces/IPairManager.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4 <0.9.0;\\n\\nimport '@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol';\\n\\n/// @title Pair Manager interface\\n/// @notice Generic interface for Keep3r liquidity pools (kLP)\\ninterface IPairManager is IERC20Metadata {\\n /// @notice Address of the factory from which the pair manager was created\\n /// @return _factory The address of the PairManager Factory\\n function factory() external view returns (address _factory);\\n\\n /// @notice Address of the pool from which the Keep3r pair manager will interact with\\n /// @return _pool The address of the pool\\n function pool() external view returns (address _pool);\\n\\n /// @notice Token0 of the pool\\n /// @return _token0 The address of token0\\n function token0() external view returns (address _token0);\\n\\n /// @notice Token1 of the pool\\n /// @return _token1 The address of token1\\n function token1() external view returns (address _token1);\\n}\\n\",\"keccak256\":\"0x345c312b340c5775fb8f68d89ce851c7f75522940bd9bc64f2301a3f8312636a\",\"license\":\"MIT\"},\"solidity/interfaces/IUniV3PairManager.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4 <0.9.0;\\n\\nimport './IPairManager.sol';\\nimport '@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol';\\nimport '@defi-wonderland/solidity-utils/solidity/interfaces/IGovernable.sol';\\n\\n/// @title Pair Manager contract\\n/// @notice Creates a UniswapV3 position, and tokenizes in an ERC20 manner\\n/// so that the user can use it as liquidity for a Keep3rJob\\ninterface IUniV3PairManager is IGovernable, IPairManager {\\n // Structs\\n struct PoolKey {\\n address token0;\\n address token1;\\n uint24 fee;\\n }\\n\\n /// @notice The data to be decoded by the UniswapV3MintCallback function\\n struct MintCallbackData {\\n PoolKey _poolKey; // Struct that contains token0, token1, and fee of the pool passed into the constructor\\n address payer; // The address of the payer, which will be the msg.sender of the mint function\\n }\\n\\n // Variables\\n\\n /// @notice The fee of the Uniswap pool passed into the constructor\\n /// @return _fee The fee of the Uniswap pool passed into the constructor\\n function fee() external view returns (uint24 _fee);\\n\\n /// @notice Highest tick in the Uniswap's curve\\n /// @return _tickUpper The highest tick in the Uniswap's curve\\n function tickUpper() external view returns (int24 _tickUpper);\\n\\n /// @notice Lowest tick in the Uniswap's curve\\n /// @return _tickLower The lower tick in the Uniswap's curve\\n function tickLower() external view returns (int24 _tickLower);\\n\\n /// @notice The pair tick spacing\\n /// @return _tickSpacing The pair tick spacing\\n function tickSpacing() external view returns (int24 _tickSpacing);\\n\\n /// @notice The sqrtRatioAX96 at the lowest tick (-887200) of the Uniswap pool\\n /// @return _sqrtPriceA96 A Fixed point Q64.96 number representing the sqrt of the ratio of the two assets (token1/token0)\\n /// at the lowest tick\\n function sqrtRatioAX96() external view returns (uint160 _sqrtPriceA96);\\n\\n /// @notice The sqrtRatioBX96 at the highest tick (887200) of the Uniswap pool\\n /// @return _sqrtPriceBX96 A Fixed point Q64.96 number representing the sqrt of the ratio of the two assets (token1/token0)\\n /// at the highest tick\\n function sqrtRatioBX96() external view returns (uint160 _sqrtPriceBX96);\\n\\n // Errors\\n\\n /// @notice Throws when the caller of the function is not the pool\\n error OnlyPool();\\n\\n /// @notice Throws when the slippage exceeds what the user is comfortable with\\n error ExcessiveSlippage();\\n\\n /// @notice Throws when a transfer is unsuccessful\\n error UnsuccessfulTransfer();\\n\\n // Methods\\n\\n /// @notice This function is called after a user calls IUniV3PairManager#mint function\\n /// It ensures that any tokens owed to the pool are paid by the msg.sender of IUniV3PairManager#mint function\\n /// @param amount0Owed The amount of token0 due to the pool for the minted liquidity\\n /// @param amount1Owed The amount of token1 due to the pool for the minted liquidity\\n /// @param data The encoded token0, token1, fee (_poolKey) and the payer (msg.sender) of the IUniV3PairManager#mint function\\n function uniswapV3MintCallback(\\n uint256 amount0Owed,\\n uint256 amount1Owed,\\n bytes calldata data\\n ) external;\\n\\n /// @notice Mints kLP tokens to an address according to the liquidity the msg.sender provides to the UniswapV3 pool\\n /// @dev Triggers UniV3PairManager#uniswapV3MintCallback\\n /// @param amount0Desired The amount of token0 we would like to provide\\n /// @param amount1Desired The amount of token1 we would like to provide\\n /// @param amount0Min The minimum amount of token0 we want to provide\\n /// @param amount1Min The minimum amount of token1 we want to provide\\n /// @param to The address to which the kLP tokens are going to be minted to\\n /// @return liquidity kLP tokens sent in exchange for the provision of tokens\\n function mint(\\n uint256 amount0Desired,\\n uint256 amount1Desired,\\n uint256 amount0Min,\\n uint256 amount1Min,\\n address to\\n ) external returns (uint128 liquidity);\\n\\n /// @notice Returns the pair manager's position in the corresponding UniswapV3 pool\\n /// @return liquidity The amount of liquidity provided to the UniswapV3 pool by the pair manager\\n /// @return feeGrowthInside0LastX128 The fee growth of token0 as of the last action on the individual position\\n /// @return feeGrowthInside1LastX128 The fee growth of token1 as of the last action on the individual position\\n /// @return tokensOwed0 The uncollected amount of token0 owed to the position as of the last computation\\n /// @return tokensOwed1 The uncollected amount of token1 owed to the position as of the last computation\\n function position()\\n external\\n view\\n returns (\\n uint128 liquidity,\\n uint256 feeGrowthInside0LastX128,\\n uint256 feeGrowthInside1LastX128,\\n uint128 tokensOwed0,\\n uint128 tokensOwed1\\n );\\n\\n /// @notice Calls the UniswapV3 pool's collect function, which collects up to a maximum amount of fees\\n // owed to a specific position to the recipient, in this case, that recipient is the pair manager\\n /// @dev The collected fees will be sent to governor\\n /// @return amount0 The amount of fees collected in token0\\n /// @return amount1 The amount of fees collected in token1\\n function collect() external returns (uint256 amount0, uint256 amount1);\\n\\n /// @notice Burns the corresponding amount of kLP tokens from the msg.sender and withdraws the specified liquidity\\n // in the entire range\\n /// @param liquidity The amount of liquidity to be burned\\n /// @param amount0Min The minimum amount of token0 we want to send to the recipient (to)\\n /// @param amount1Min The minimum amount of token1 we want to send to the recipient (to)\\n /// @param to The address that will receive the due fees\\n /// @return amount0 The calculated amount of token0 that will be sent to the recipient\\n /// @return amount1 The calculated amount of token1 that will be sent to the recipient\\n function burn(\\n uint128 liquidity,\\n uint256 amount0Min,\\n uint256 amount1Min,\\n address to\\n ) external returns (uint256 amount0, uint256 amount1);\\n}\\n\",\"keccak256\":\"0xcb9c86a0bed59a73c8427710d1b27922c2f9fb5173057b8d3a9fe77cd2c8ff94\",\"license\":\"MIT\"},\"solidity/interfaces/external/IWeth9.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.4 <0.9.0;\\n\\nimport '@openzeppelin/contracts/token/ERC20/IERC20.sol';\\n\\ninterface IWeth9 is IERC20 {\\n function deposit() external payable;\\n\\n function withdraw(uint256) external;\\n}\\n\",\"keccak256\":\"0x62b6fd021e9fef703f5c77705d8da9ee1967e34e00a0c8a827ee3c0f973399a5\",\"license\":\"MIT\"}},\"version\":1}", + "bytecode": "0x6101c06040523480156200001257600080fd5b506040516200326138038062003261833981016040819052620000359162000b2f565b806001600160a01b0381166200005e5760405163d92e233d60e01b815260040160405180910390fd5b600080546001600160a01b0319166001600160a01b039283161781556040805163ddca3f4360e01b81529051919285169163ddca3f4391600480820192602092909190829003018186803b158015620000b657600080fd5b505afa158015620000cb573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190620000f1919062000b67565b90506000836001600160a01b0316630dfe16816040518163ffffffff1660e01b815260040160206040518083038186803b1580156200012f57600080fd5b505afa15801562000144573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906200016a919062000b95565b90506000846001600160a01b031663d21220a76040518163ffffffff1660e01b815260040160206040518083038186803b158015620001a857600080fd5b505afa158015620001bd573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190620001e3919062000b95565b90506000856001600160a01b031663d0c93a7c6040518163ffffffff1660e01b815260040160206040518083038186803b1580156200022157600080fd5b505afa15801562000236573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906200025c919062000bb3565b905060006200026f82620d89e862000bee565b6200027e90620d89e862000c29565b905060006200028d8262000c77565b33606090811b60805289811b6001600160601b031990811660e05260e889811b6001600160e81b0319166101005286811b6101a05285811b6101805283901b6101605287821b811660a0529086901b1660c052604080516395d89b4160e01b815290519192506001600160a01b038716916395d89b4191600480820192600092909190829003018186803b1580156200032557600080fd5b505afa1580156200033a573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f1916820160405262000364919081019062000ce6565b846001600160a01b03166395d89b416040518163ffffffff1660e01b815260040160006040518083038186803b1580156200039e57600080fd5b505afa158015620003b3573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052620003dd919081019062000ce6565b604051602001620003f092919062000d9e565b604051602081830303815290604052600290805190602001906200041692919062000a6c565b50846001600160a01b03166395d89b416040518163ffffffff1660e01b815260040160006040518083038186803b1580156200045157600080fd5b505afa15801562000466573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f1916820160405262000490919081019062000ce6565b846001600160a01b03166395d89b416040518163ffffffff1660e01b815260040160006040518083038186803b158015620004ca57600080fd5b505afa158015620004df573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f1916820160405262000509919081019062000ce6565b6040516020016200051c92919062000df5565b604051602081830303815290604052600390805190602001906200054292919062000a6c565b5062000559816200060a60201b62000e911760201c565b6001600160a01b0316610120816001600160a01b031660601b815250506200058c826200060a60201b62000e911760201c565b606090811b6001600160601b031916610140526040805191820181526001600160a01b03968716808352959096166020820181905262ffffff9790971695018590525050600780546001600160a01b03191690921790915550600880546001600160b81b031916909217600160a01b9091021790555062000f0d9050565b60008060008360020b1262000623578260020b62000632565b8260020b620006329062000e45565b905062000643620d89e71962000c77565b60020b8111156200067e5760405162461bcd60e51b81526020600482015260016024820152601560fa1b604482015260640160405180910390fd5b6000600182166200069457600160801b620006a6565b6ffffcb933bd6fad37aa2d162d1a5940015b6001600160881b031690506002821615620006de576080620006d9826ffff97272373d413259a46990580e213a62000e65565b901c90505b60048216156200070b57608062000706826ffff2e50f5f656932ef12357cf3c7fdcc62000e65565b901c90505b60088216156200073857608062000733826fffe5caca7e10e4e61c3624eaa0941cd062000e65565b901c90505b60108216156200076557608062000760826fffcb9843d60f6159c9db58835c92664462000e65565b901c90505b6020821615620007925760806200078d826fff973b41fa98c081472e6896dfb254c062000e65565b901c90505b6040821615620007bf576080620007ba826fff2ea16466c96a3843ec78b326b5286162000e65565b901c90505b6080821615620007ec576080620007e7826ffe5dee046a99a2a811c461f1969c305362000e65565b901c90505b6101008216156200081a57608062000815826ffcbe86c7900a88aedcffc83b479aa3a462000e65565b901c90505b6102008216156200084857608062000843826ff987a7253ac413176f2b074cf7815e5462000e65565b901c90505b6104008216156200087657608062000871826ff3392b0822b70005940c7a398e4b70f362000e65565b901c90505b610800821615620008a45760806200089f826fe7159475a2c29b7443b29c7fa6e889d962000e65565b901c90505b611000821615620008d2576080620008cd826fd097f3bdfd2022b8845ad8f792aa582562000e65565b901c90505b61200082161562000900576080620008fb826fa9f746462d870fdf8a65dc1f90e061e562000e65565b901c90505b6140008216156200092e57608062000929826f70d869a156d2a1b890bb3df62baf32f762000e65565b901c90505b6180008216156200095c57608062000957826f31be135f97d08fd981231505542fcfa662000e65565b901c90505b620100008216156200098b57608062000986826f09aa508b5b7a84e1c677de54f3e99bc962000e65565b901c90505b62020000821615620009b9576080620009b4826e5d6af8dedb81196699c329225ee60462000e65565b901c90505b62040000821615620009e6576080620009e1826d2216e584f5fa1ea926041bedfe9862000e65565b901c90505b6208000082161562000a1157608062000a0c826b048a170391f7dc42444e8fa262000e65565b901c90505b60008460020b131562000a2f5762000a2c8160001962000e87565b90505b62000a406401000000008262000e9e565b1562000a4e57600162000a51565b60005b62000a649060ff16602083901c62000eb5565b949350505050565b82805462000a7a9062000ed0565b90600052602060002090601f01602090048101928262000a9e576000855562000ae9565b82601f1062000ab957805160ff191683800117855562000ae9565b8280016001018555821562000ae9579182015b8281111562000ae957825182559160200191906001019062000acc565b5062000af792915062000afb565b5090565b5b8082111562000af7576000815560010162000afc565b80516001600160a01b038116811462000b2a57600080fd5b919050565b6000806040838503121562000b4357600080fd5b62000b4e8362000b12565b915062000b5e6020840162000b12565b90509250929050565b60006020828403121562000b7a57600080fd5b815162ffffff8116811462000b8e57600080fd5b9392505050565b60006020828403121562000ba857600080fd5b62000b8e8262000b12565b60006020828403121562000bc657600080fd5b81518060020b811462000b8e57600080fd5b634e487b7160e01b600052601260045260246000fd5b60008260020b8062000c045762000c0462000bd8565b808360020b0791505092915050565b634e487b7160e01b600052601160045260246000fd5b60008160020b8360020b6000811281627fffff190183128115161562000c535762000c5362000c13565b81627fffff01831381161562000c6d5762000c6d62000c13565b5090039392505050565b60008160020b627fffff1981141562000c945762000c9462000c13565b60000392915050565b634e487b7160e01b600052604160045260246000fd5b60005b8381101562000cd057818101518382015260200162000cb6565b8381111562000ce0576000848401525b50505050565b60006020828403121562000cf957600080fd5b81516001600160401b038082111562000d1157600080fd5b818401915084601f83011262000d2657600080fd5b81518181111562000d3b5762000d3b62000c9d565b604051601f8201601f19908116603f0116810190838211818310171562000d665762000d6662000c9d565b8160405282815287602084870101111562000d8057600080fd5b62000d9383602083016020880162000cb3565b979650505050505050565b6a025b2b2b819b926281016960ad1b81526000835162000dc681600b85016020880162000cb3565b602f60f81b600b91840191820152835162000de981600c84016020880162000cb3565b01600c01949350505050565b636b4c502d60e01b81526000835162000e1681600485016020880162000cb3565b602f60f81b600491840191820152835162000e3981600584016020880162000cb3565b01600501949350505050565b6000600160ff1b82141562000e5e5762000e5e62000c13565b5060000390565b600081600019048311821515161562000e825762000e8262000c13565b500290565b60008262000e995762000e9962000bd8565b500490565b60008262000eb05762000eb062000bd8565b500690565b6000821982111562000ecb5762000ecb62000c13565b500190565b600181811c9082168062000ee557607f821691505b6020821081141562000f0757634e487b7160e01b600052602260045260246000fd5b50919050565b60805160601c60a05160601c60c05160601c60e05160601c6101005160e81c6101205160601c6101405160601c6101605160e81c6101805160e81c6101a05160e81c6122126200104f600039600061047801526000818161033b0152818161063e0152818161092f01528181610a8601528181610c6f01528181610dc7015261158e015260008181610375015281816106130152818161090401528181610a6401528181610c4401528181610da5015261156c01526000818161042901526114840152600081816102fa0152611463015260006105040152600081816102a9015281816106790152818161097301528181610a3501528181610b3c01528181610b8f01528181610bcd01528181610ca401528181610d72015281816113c6015261153b0152600061049f015260006102780152600061040201526122126000f3fe608060405234801561001057600080fd5b50600436106101c45760003560e01c806395d89b41116100f9578063d21220a711610097578063ddca3f4311610071578063ddca3f43146104ff578063e3056a341461053a578063e52253811461054d578063f235757f1461055557600080fd5b8063d21220a71461049a578063d3487997146104c1578063dd62ed3e146104d457600080fd5b8063c45a0155116100d3578063c45a0155146103fd578063c627526114610424578063cf51148d1461044b578063d0c93a7c1461047357600080fd5b806395d89b41146103b7578063a3e6dc28146103bf578063a9059cbb146103ea57600080fd5b806318160ddd11610166578063313ce56711610140578063313ce5671461031c57806355b812a81461033657806359c4f9051461037057806370a082311461039757600080fd5b806318160ddd146102cb57806323b872dd146102e25780632ea28f5b146102f557600080fd5b80630c340a24116101a25780630c340a24146102485780630dfe16811461027357806313f6986d1461029a57806316f0115b146102a457600080fd5b806306fdde03146101c957806309218e91146101e7578063095ea7b314610225575b600080fd5b6101d1610568565b6040516101de9190611b6a565b60405180910390f35b6101ef6105f6565b604080516001600160801b039687168152602081019590955284019290925283166060830152909116608082015260a0016101de565b610238610233366004611b92565b610738565b60405190151581526020016101de565b60005461025b906001600160a01b031681565b6040516001600160a01b0390911681526020016101de565b61025b7f000000000000000000000000000000000000000000000000000000000000000081565b6102a26107a4565b005b61025b7f000000000000000000000000000000000000000000000000000000000000000081565b6102d460045481565b6040519081526020016101de565b6102386102f0366004611bbe565b6107d9565b61025b7f000000000000000000000000000000000000000000000000000000000000000081565b610324601281565b60405160ff90911681526020016101de565b61035d7f000000000000000000000000000000000000000000000000000000000000000081565b60405160029190910b81526020016101de565b61035d7f000000000000000000000000000000000000000000000000000000000000000081565b6102d46103a5366004611bff565b60066020526000908152604090205481565b6101d16108a2565b6103d26103cd366004611c1c565b6108af565b6040516001600160801b0390911681526020016101de565b6102386103f8366004611b92565b6108df565b61025b7f000000000000000000000000000000000000000000000000000000000000000081565b61025b7f000000000000000000000000000000000000000000000000000000000000000081565b61045e610459366004611c7e565b6108f5565b604080519283526020830191909152016101de565b61035d7f000000000000000000000000000000000000000000000000000000000000000081565b61025b7f000000000000000000000000000000000000000000000000000000000000000081565b6102a26104cf366004611cc8565b610b21565b6102d46104e2366004611d48565b600560209081526000928352604080842090915290825290205481565b6105267f000000000000000000000000000000000000000000000000000000000000000081565b60405162ffffff90911681526020016101de565b60015461025b906001600160a01b031681565b61045e610bf9565b6102a2610563366004611bff565b610e5a565b6002805461057590611d81565b80601f01602080910402602001604051908101604052809291908181526020018280546105a190611d81565b80156105ee5780601f106105c3576101008083540402835291602001916105ee565b820191906000526020600020905b8154815290600101906020018083116105d157829003601f168201915b505050505081565b6040516bffffffffffffffffffffffff193060601b1660208201527f000000000000000000000000000000000000000000000000000000000000000060e890811b60348301527f0000000000000000000000000000000000000000000000000000000000000000901b603782015260009081908190819081906001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000169063514ea4bf90603a01604051602081830303815290604052805190602001206040518263ffffffff1660e01b81526004016106d791815260200190565b60a06040518083038186803b1580156106ef57600080fd5b505afa158015610703573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107279190611dbc565b939992985090965094509092509050565b3360008181526005602090815260408083206001600160a01b038716808552925280832085905551919290917f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925906107939086815260200190565b60405180910390a350600192915050565b6001546001600160a01b031633146107cf57604051639ba0305d60e01b815260040160405180910390fd5b6107d76112b2565b565b6001600160a01b03831660008181526005602090815260408083203380855292528220549192909190821480159061081357506000198114155b156108895760006108248583611e26565b6001600160a01b038881166000818152600560209081526040808320948916808452948252918290208590559051848152939450919290917f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505b610894868686611310565b6001925050505b9392505050565b6003805461057590611d81565b60006108bd868686866113be565b509091506108d69050826001600160801b038316611645565b95945050505050565b60006108ec338484611310565b50600192915050565b60405163a34123a760e01b81527f0000000000000000000000000000000000000000000000000000000000000000600290810b60048301527f0000000000000000000000000000000000000000000000000000000000000000900b60248201526001600160801b038516604482015260009081906001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000169063a34123a7906064016040805180830381600087803b1580156109b657600080fd5b505af11580156109ca573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109ee9190611e3d565b909250905084821080610a0057508381105b15610a1e576040516397c7f53760e01b815260040160405180910390fd5b6040516309e3d67b60e31b81526001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001690634f1eb3d890610ab29086907f0000000000000000000000000000000000000000000000000000000000000000907f00000000000000000000000000000000000000000000000000000000000000009088908890600401611e61565b6040805180830381600087803b158015610acb57600080fd5b505af1158015610adf573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610b039190611e9e565b5050610b1833876001600160801b03166116cf565b94509492505050565b6000610b2f82840184611f04565b9050336001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001614610b7a57604051634b60273560e01b815260040160405180910390fd5b8415610bb4578051516020820151610bb491907f000000000000000000000000000000000000000000000000000000000000000088611751565b8315610bf257610bf281600001516020015182602001517f000000000000000000000000000000000000000000000000000000000000000087611751565b5050505050565b6000805481906001600160a01b03163314610c275760405163070545c960e51b815260040160405180910390fd5b6040516bffffffffffffffffffffffff193060601b1660208201527f000000000000000000000000000000000000000000000000000000000000000060e890811b60348301527f0000000000000000000000000000000000000000000000000000000000000000901b603782015260009081906001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000169063514ea4bf90603a01604051602081830303815290604052805190602001206040518263ffffffff1660e01b8152600401610d0291815260200190565b60a06040518083038186803b158015610d1a57600080fd5b505afa158015610d2e573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d529190611dbc565b6000546040516309e3d67b60e31b81529297509095506001600160a01b037f000000000000000000000000000000000000000000000000000000000000000081169550634f1eb3d89450610df3935016907f0000000000000000000000000000000000000000000000000000000000000000907f00000000000000000000000000000000000000000000000000000000000000009088908890600401611e61565b6040805180830381600087803b158015610e0c57600080fd5b505af1158015610e20573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e449190611e9e565b6001600160801b03918216969116945092505050565b6000546001600160a01b03163314610e855760405163070545c960e51b815260040160405180910390fd5b610e8e81611763565b50565b60008060008360020b12610ea8578260020b610eb5565b8260020b610eb590611fbf565b9050610ec4620d89e719611fdc565b60020b811115610efe5760405162461bcd60e51b81526020600482015260016024820152601560fa1b604482015260640160405180910390fd5b600060018216610f1257600160801b610f24565b6ffffcb933bd6fad37aa2d162d1a5940015b70ffffffffffffffffffffffffffffffffff1690506002821615610f63576080610f5e826ffff97272373d413259a46990580e213a611fff565b901c90505b6004821615610f8d576080610f88826ffff2e50f5f656932ef12357cf3c7fdcc611fff565b901c90505b6008821615610fb7576080610fb2826fffe5caca7e10e4e61c3624eaa0941cd0611fff565b901c90505b6010821615610fe1576080610fdc826fffcb9843d60f6159c9db58835c926644611fff565b901c90505b602082161561100b576080611006826fff973b41fa98c081472e6896dfb254c0611fff565b901c90505b6040821615611035576080611030826fff2ea16466c96a3843ec78b326b52861611fff565b901c90505b608082161561105f57608061105a826ffe5dee046a99a2a811c461f1969c3053611fff565b901c90505b61010082161561108a576080611085826ffcbe86c7900a88aedcffc83b479aa3a4611fff565b901c90505b6102008216156110b55760806110b0826ff987a7253ac413176f2b074cf7815e54611fff565b901c90505b6104008216156110e05760806110db826ff3392b0822b70005940c7a398e4b70f3611fff565b901c90505b61080082161561110b576080611106826fe7159475a2c29b7443b29c7fa6e889d9611fff565b901c90505b611000821615611136576080611131826fd097f3bdfd2022b8845ad8f792aa5825611fff565b901c90505b61200082161561116157608061115c826fa9f746462d870fdf8a65dc1f90e061e5611fff565b901c90505b61400082161561118c576080611187826f70d869a156d2a1b890bb3df62baf32f7611fff565b901c90505b6180008216156111b75760806111b2826f31be135f97d08fd981231505542fcfa6611fff565b901c90505b620100008216156111e35760806111de826f09aa508b5b7a84e1c677de54f3e99bc9611fff565b901c90505b6202000082161561120e576080611209826e5d6af8dedb81196699c329225ee604611fff565b901c90505b62040000821615611238576080611233826d2216e584f5fa1ea926041bedfe98611fff565b901c90505b6208000082161561126057608061125b826b048a170391f7dc42444e8fa2611fff565b901c90505b60008460020b131561127b5761127881600019612034565b90505b61128a64010000000082612048565b15611296576001611299565b60005b6112aa9060ff16602083901c61205c565b949350505050565b60018054600080546001600160a01b0383166001600160a01b031991821681179092559091169091556040519081527f5d5d6e01b731c3e68060f7fe13156f6197d4aeffc2d6f498e34c717ae616b7349060200160405180910390a1565b6001600160a01b03831660009081526006602052604081208054839290611338908490611e26565b90915550506001600160a01b0382166000908152600660205260408120805483929061136590849061205c565b92505081905550816001600160a01b0316836001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef836040516113b191815260200190565b60405180910390a3505050565b6000806000807f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316633850c7bd6040518163ffffffff1660e01b815260040160e06040518083038186803b15801561141d57600080fd5b505afa158015611431573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906114559190612096565b50505050505090506114aa817f00000000000000000000000000000000000000000000000000000000000000007f00000000000000000000000000000000000000000000000000000000000000008b8b6117ec565b6040805160a080820183526007546001600160a01b039081168385018181526008548084166060808801918252600160a01b90920462ffffff9081166080808a01918252948952336020998a019081528a51998a019690965291518616888a01529051169086015290518216848201528451808503909101815291830193849052633c8a7d8d60e01b9093529296507f000000000000000000000000000000000000000000000000000000000000000090911691633c8a7d8d916115b99130917f0000000000000000000000000000000000000000000000000000000000000000917f0000000000000000000000000000000000000000000000000000000000000000918b919060a401612130565b6040805180830381600087803b1580156115d257600080fd5b505af11580156115e6573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061160a9190611e3d565b90935091508583108061161c57508482105b1561163a576040516397c7f53760e01b815260040160405180910390fd5b509450945094915050565b8060046000828254611657919061205c565b90915550506001600160a01b0382166000908152600660205260408120805483929061168490849061205c565b90915550506040518181526001600160a01b038316906000907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef906020015b60405180910390a35050565b80600460008282546116e19190611e26565b90915550506001600160a01b0382166000908152600660205260408120805483929061170e908490611e26565b90915550506040518181526000906001600160a01b038416907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef906020016116c3565b61175d848484846118ae565b50505050565b6001600160a01b03811661178a5760405163d92e233d60e01b815260040160405180910390fd5b600180546001600160a01b0319166001600160a01b038381169182179092556000546040805191909316815260208101919091527f6353ec38ac394f8be94bfafcdd3580d356470599059eaeebedc3207e1cc03dec910160405180910390a150565b6000836001600160a01b0316856001600160a01b0316111561180c579293925b846001600160a01b0316866001600160a01b031611611837576118308585856119a8565b90506108d6565b836001600160a01b0316866001600160a01b0316101561189957600061185e8786866119a8565b9050600061186d878986611a12565b9050806001600160801b0316826001600160801b03161061188e5780611890565b815b925050506108d6565b6118a4858584611a12565b9695505050505050565b604080516001600160a01b0385811660248301528481166044830152606480830185905283518084039091018152608490920183526020820180516001600160e01b03166323b872dd60e01b1790529151600092839290881691611912919061217d565b6000604051808303816000865af19150503d806000811461194f576040519150601f19603f3d011682016040523d82523d6000602084013e611954565b606091505b509150915081158061198257508051158015906119825750808060200190518101906119809190612199565b155b156119a0576040516316369daf60e31b815260040160405180910390fd5b505050505050565b6000826001600160a01b0316846001600160a01b031611156119c8579192915b60006119eb856001600160a01b0316856001600160a01b0316600160601b611a48565b90506108d6611a0d84836119ff89896121b4565b6001600160a01b0316611a48565b611af7565b6000826001600160a01b0316846001600160a01b03161115611a32579192915b6112aa611a0d83600160601b6119ff88886121b4565b600080806000198587098587029250828110838203039150508060001415611a825760008411611a7757600080fd5b50829004905061089b565b808411611a8e57600080fd5b60008486880960026001871981018816978890046003810283188082028403028082028403028082028403028082028403028082028403029081029092039091026000889003889004909101858311909403939093029303949094049190911702949350505050565b806001600160801b0381168114611b0d57600080fd5b919050565b60005b83811015611b2d578181015183820152602001611b15565b8381111561175d5750506000910152565b60008151808452611b56816020860160208601611b12565b601f01601f19169290920160200192915050565b60208152600061089b6020830184611b3e565b6001600160a01b0381168114610e8e57600080fd5b60008060408385031215611ba557600080fd5b8235611bb081611b7d565b946020939093013593505050565b600080600060608486031215611bd357600080fd5b8335611bde81611b7d565b92506020840135611bee81611b7d565b929592945050506040919091013590565b600060208284031215611c1157600080fd5b813561089b81611b7d565b600080600080600060a08688031215611c3457600080fd5b853594506020860135935060408601359250606086013591506080860135611c5b81611b7d565b809150509295509295909350565b6001600160801b0381168114610e8e57600080fd5b60008060008060808587031215611c9457600080fd5b8435611c9f81611c69565b935060208501359250604085013591506060850135611cbd81611b7d565b939692955090935050565b60008060008060608587031215611cde57600080fd5b8435935060208501359250604085013567ffffffffffffffff80821115611d0457600080fd5b818701915087601f830112611d1857600080fd5b813581811115611d2757600080fd5b886020828501011115611d3957600080fd5b95989497505060200194505050565b60008060408385031215611d5b57600080fd5b8235611d6681611b7d565b91506020830135611d7681611b7d565b809150509250929050565b600181811c90821680611d9557607f821691505b60208210811415611db657634e487b7160e01b600052602260045260246000fd5b50919050565b600080600080600060a08688031215611dd457600080fd5b8551611ddf81611c69565b8095505060208601519350604086015192506060860151611dff81611c69565b6080870151909250611c5b81611c69565b634e487b7160e01b600052601160045260246000fd5b600082821015611e3857611e38611e10565b500390565b60008060408385031215611e5057600080fd5b505080516020909101519092909150565b6001600160a01b03959095168552600293840b60208601529190920b60408401526001600160801b03918216606084015216608082015260a00190565b60008060408385031215611eb157600080fd5b8251611ebc81611c69565b6020840151909250611d7681611c69565b6040516060810167ffffffffffffffff81118282101715611efe57634e487b7160e01b600052604160045260246000fd5b60405290565b60008183036080811215611f1757600080fd5b6040516040810181811067ffffffffffffffff82111715611f4857634e487b7160e01b600052604160045260246000fd5b6040526060821215611f5957600080fd5b611f61611ecd565b91508335611f6e81611b7d565b82526020840135611f7e81611b7d565b6020830152604084013562ffffff81168114611f9957600080fd5b6040830152908152606083013590611fb082611b7d565b60208101919091529392505050565b6000600160ff1b821415611fd557611fd5611e10565b5060000390565b60008160020b627fffff19811415611ff657611ff6611e10565b60000392915050565b600081600019048311821515161561201957612019611e10565b500290565b634e487b7160e01b600052601260045260246000fd5b6000826120435761204361201e565b500490565b6000826120575761205761201e565b500690565b6000821982111561206f5761206f611e10565b500190565b805161ffff81168114611b0d57600080fd5b80518015158114611b0d57600080fd5b600080600080600080600060e0888a0312156120b157600080fd5b87516120bc81611b7d565b8097505060208801518060020b81146120d457600080fd5b95506120e260408901612074565b94506120f060608901612074565b93506120fe60808901612074565b925060a088015160ff8116811461211457600080fd5b915061212260c08901612086565b905092959891949750929550565b60018060a01b03861681528460020b60208201528360020b60408201526001600160801b038316606082015260a06080820152600061217260a0830184611b3e565b979650505050505050565b6000825161218f818460208701611b12565b9190910192915050565b6000602082840312156121ab57600080fd5b61089b82612086565b60006001600160a01b03838116908316818110156121d4576121d4611e10565b03939250505056fea2646970667358221220a5cf752f3a9624b2bde030ec682170656211d5a7c372ef46b65ffb00bb78c39e64736f6c63430008080033", + "deployedBytecode": "0x608060405234801561001057600080fd5b50600436106101c45760003560e01c806395d89b41116100f9578063d21220a711610097578063ddca3f4311610071578063ddca3f43146104ff578063e3056a341461053a578063e52253811461054d578063f235757f1461055557600080fd5b8063d21220a71461049a578063d3487997146104c1578063dd62ed3e146104d457600080fd5b8063c45a0155116100d3578063c45a0155146103fd578063c627526114610424578063cf51148d1461044b578063d0c93a7c1461047357600080fd5b806395d89b41146103b7578063a3e6dc28146103bf578063a9059cbb146103ea57600080fd5b806318160ddd11610166578063313ce56711610140578063313ce5671461031c57806355b812a81461033657806359c4f9051461037057806370a082311461039757600080fd5b806318160ddd146102cb57806323b872dd146102e25780632ea28f5b146102f557600080fd5b80630c340a24116101a25780630c340a24146102485780630dfe16811461027357806313f6986d1461029a57806316f0115b146102a457600080fd5b806306fdde03146101c957806309218e91146101e7578063095ea7b314610225575b600080fd5b6101d1610568565b6040516101de9190611b6a565b60405180910390f35b6101ef6105f6565b604080516001600160801b039687168152602081019590955284019290925283166060830152909116608082015260a0016101de565b610238610233366004611b92565b610738565b60405190151581526020016101de565b60005461025b906001600160a01b031681565b6040516001600160a01b0390911681526020016101de565b61025b7f000000000000000000000000000000000000000000000000000000000000000081565b6102a26107a4565b005b61025b7f000000000000000000000000000000000000000000000000000000000000000081565b6102d460045481565b6040519081526020016101de565b6102386102f0366004611bbe565b6107d9565b61025b7f000000000000000000000000000000000000000000000000000000000000000081565b610324601281565b60405160ff90911681526020016101de565b61035d7f000000000000000000000000000000000000000000000000000000000000000081565b60405160029190910b81526020016101de565b61035d7f000000000000000000000000000000000000000000000000000000000000000081565b6102d46103a5366004611bff565b60066020526000908152604090205481565b6101d16108a2565b6103d26103cd366004611c1c565b6108af565b6040516001600160801b0390911681526020016101de565b6102386103f8366004611b92565b6108df565b61025b7f000000000000000000000000000000000000000000000000000000000000000081565b61025b7f000000000000000000000000000000000000000000000000000000000000000081565b61045e610459366004611c7e565b6108f5565b604080519283526020830191909152016101de565b61035d7f000000000000000000000000000000000000000000000000000000000000000081565b61025b7f000000000000000000000000000000000000000000000000000000000000000081565b6102a26104cf366004611cc8565b610b21565b6102d46104e2366004611d48565b600560209081526000928352604080842090915290825290205481565b6105267f000000000000000000000000000000000000000000000000000000000000000081565b60405162ffffff90911681526020016101de565b60015461025b906001600160a01b031681565b61045e610bf9565b6102a2610563366004611bff565b610e5a565b6002805461057590611d81565b80601f01602080910402602001604051908101604052809291908181526020018280546105a190611d81565b80156105ee5780601f106105c3576101008083540402835291602001916105ee565b820191906000526020600020905b8154815290600101906020018083116105d157829003601f168201915b505050505081565b6040516bffffffffffffffffffffffff193060601b1660208201527f000000000000000000000000000000000000000000000000000000000000000060e890811b60348301527f0000000000000000000000000000000000000000000000000000000000000000901b603782015260009081908190819081906001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000169063514ea4bf90603a01604051602081830303815290604052805190602001206040518263ffffffff1660e01b81526004016106d791815260200190565b60a06040518083038186803b1580156106ef57600080fd5b505afa158015610703573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107279190611dbc565b939992985090965094509092509050565b3360008181526005602090815260408083206001600160a01b038716808552925280832085905551919290917f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925906107939086815260200190565b60405180910390a350600192915050565b6001546001600160a01b031633146107cf57604051639ba0305d60e01b815260040160405180910390fd5b6107d76112b2565b565b6001600160a01b03831660008181526005602090815260408083203380855292528220549192909190821480159061081357506000198114155b156108895760006108248583611e26565b6001600160a01b038881166000818152600560209081526040808320948916808452948252918290208590559051848152939450919290917f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505b610894868686611310565b6001925050505b9392505050565b6003805461057590611d81565b60006108bd868686866113be565b509091506108d69050826001600160801b038316611645565b95945050505050565b60006108ec338484611310565b50600192915050565b60405163a34123a760e01b81527f0000000000000000000000000000000000000000000000000000000000000000600290810b60048301527f0000000000000000000000000000000000000000000000000000000000000000900b60248201526001600160801b038516604482015260009081906001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000169063a34123a7906064016040805180830381600087803b1580156109b657600080fd5b505af11580156109ca573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109ee9190611e3d565b909250905084821080610a0057508381105b15610a1e576040516397c7f53760e01b815260040160405180910390fd5b6040516309e3d67b60e31b81526001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001690634f1eb3d890610ab29086907f0000000000000000000000000000000000000000000000000000000000000000907f00000000000000000000000000000000000000000000000000000000000000009088908890600401611e61565b6040805180830381600087803b158015610acb57600080fd5b505af1158015610adf573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610b039190611e9e565b5050610b1833876001600160801b03166116cf565b94509492505050565b6000610b2f82840184611f04565b9050336001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001614610b7a57604051634b60273560e01b815260040160405180910390fd5b8415610bb4578051516020820151610bb491907f000000000000000000000000000000000000000000000000000000000000000088611751565b8315610bf257610bf281600001516020015182602001517f000000000000000000000000000000000000000000000000000000000000000087611751565b5050505050565b6000805481906001600160a01b03163314610c275760405163070545c960e51b815260040160405180910390fd5b6040516bffffffffffffffffffffffff193060601b1660208201527f000000000000000000000000000000000000000000000000000000000000000060e890811b60348301527f0000000000000000000000000000000000000000000000000000000000000000901b603782015260009081906001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000169063514ea4bf90603a01604051602081830303815290604052805190602001206040518263ffffffff1660e01b8152600401610d0291815260200190565b60a06040518083038186803b158015610d1a57600080fd5b505afa158015610d2e573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d529190611dbc565b6000546040516309e3d67b60e31b81529297509095506001600160a01b037f000000000000000000000000000000000000000000000000000000000000000081169550634f1eb3d89450610df3935016907f0000000000000000000000000000000000000000000000000000000000000000907f00000000000000000000000000000000000000000000000000000000000000009088908890600401611e61565b6040805180830381600087803b158015610e0c57600080fd5b505af1158015610e20573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e449190611e9e565b6001600160801b03918216969116945092505050565b6000546001600160a01b03163314610e855760405163070545c960e51b815260040160405180910390fd5b610e8e81611763565b50565b60008060008360020b12610ea8578260020b610eb5565b8260020b610eb590611fbf565b9050610ec4620d89e719611fdc565b60020b811115610efe5760405162461bcd60e51b81526020600482015260016024820152601560fa1b604482015260640160405180910390fd5b600060018216610f1257600160801b610f24565b6ffffcb933bd6fad37aa2d162d1a5940015b70ffffffffffffffffffffffffffffffffff1690506002821615610f63576080610f5e826ffff97272373d413259a46990580e213a611fff565b901c90505b6004821615610f8d576080610f88826ffff2e50f5f656932ef12357cf3c7fdcc611fff565b901c90505b6008821615610fb7576080610fb2826fffe5caca7e10e4e61c3624eaa0941cd0611fff565b901c90505b6010821615610fe1576080610fdc826fffcb9843d60f6159c9db58835c926644611fff565b901c90505b602082161561100b576080611006826fff973b41fa98c081472e6896dfb254c0611fff565b901c90505b6040821615611035576080611030826fff2ea16466c96a3843ec78b326b52861611fff565b901c90505b608082161561105f57608061105a826ffe5dee046a99a2a811c461f1969c3053611fff565b901c90505b61010082161561108a576080611085826ffcbe86c7900a88aedcffc83b479aa3a4611fff565b901c90505b6102008216156110b55760806110b0826ff987a7253ac413176f2b074cf7815e54611fff565b901c90505b6104008216156110e05760806110db826ff3392b0822b70005940c7a398e4b70f3611fff565b901c90505b61080082161561110b576080611106826fe7159475a2c29b7443b29c7fa6e889d9611fff565b901c90505b611000821615611136576080611131826fd097f3bdfd2022b8845ad8f792aa5825611fff565b901c90505b61200082161561116157608061115c826fa9f746462d870fdf8a65dc1f90e061e5611fff565b901c90505b61400082161561118c576080611187826f70d869a156d2a1b890bb3df62baf32f7611fff565b901c90505b6180008216156111b75760806111b2826f31be135f97d08fd981231505542fcfa6611fff565b901c90505b620100008216156111e35760806111de826f09aa508b5b7a84e1c677de54f3e99bc9611fff565b901c90505b6202000082161561120e576080611209826e5d6af8dedb81196699c329225ee604611fff565b901c90505b62040000821615611238576080611233826d2216e584f5fa1ea926041bedfe98611fff565b901c90505b6208000082161561126057608061125b826b048a170391f7dc42444e8fa2611fff565b901c90505b60008460020b131561127b5761127881600019612034565b90505b61128a64010000000082612048565b15611296576001611299565b60005b6112aa9060ff16602083901c61205c565b949350505050565b60018054600080546001600160a01b0383166001600160a01b031991821681179092559091169091556040519081527f5d5d6e01b731c3e68060f7fe13156f6197d4aeffc2d6f498e34c717ae616b7349060200160405180910390a1565b6001600160a01b03831660009081526006602052604081208054839290611338908490611e26565b90915550506001600160a01b0382166000908152600660205260408120805483929061136590849061205c565b92505081905550816001600160a01b0316836001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef836040516113b191815260200190565b60405180910390a3505050565b6000806000807f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316633850c7bd6040518163ffffffff1660e01b815260040160e06040518083038186803b15801561141d57600080fd5b505afa158015611431573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906114559190612096565b50505050505090506114aa817f00000000000000000000000000000000000000000000000000000000000000007f00000000000000000000000000000000000000000000000000000000000000008b8b6117ec565b6040805160a080820183526007546001600160a01b039081168385018181526008548084166060808801918252600160a01b90920462ffffff9081166080808a01918252948952336020998a019081528a51998a019690965291518616888a01529051169086015290518216848201528451808503909101815291830193849052633c8a7d8d60e01b9093529296507f000000000000000000000000000000000000000000000000000000000000000090911691633c8a7d8d916115b99130917f0000000000000000000000000000000000000000000000000000000000000000917f0000000000000000000000000000000000000000000000000000000000000000918b919060a401612130565b6040805180830381600087803b1580156115d257600080fd5b505af11580156115e6573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061160a9190611e3d565b90935091508583108061161c57508482105b1561163a576040516397c7f53760e01b815260040160405180910390fd5b509450945094915050565b8060046000828254611657919061205c565b90915550506001600160a01b0382166000908152600660205260408120805483929061168490849061205c565b90915550506040518181526001600160a01b038316906000907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef906020015b60405180910390a35050565b80600460008282546116e19190611e26565b90915550506001600160a01b0382166000908152600660205260408120805483929061170e908490611e26565b90915550506040518181526000906001600160a01b038416907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef906020016116c3565b61175d848484846118ae565b50505050565b6001600160a01b03811661178a5760405163d92e233d60e01b815260040160405180910390fd5b600180546001600160a01b0319166001600160a01b038381169182179092556000546040805191909316815260208101919091527f6353ec38ac394f8be94bfafcdd3580d356470599059eaeebedc3207e1cc03dec910160405180910390a150565b6000836001600160a01b0316856001600160a01b0316111561180c579293925b846001600160a01b0316866001600160a01b031611611837576118308585856119a8565b90506108d6565b836001600160a01b0316866001600160a01b0316101561189957600061185e8786866119a8565b9050600061186d878986611a12565b9050806001600160801b0316826001600160801b03161061188e5780611890565b815b925050506108d6565b6118a4858584611a12565b9695505050505050565b604080516001600160a01b0385811660248301528481166044830152606480830185905283518084039091018152608490920183526020820180516001600160e01b03166323b872dd60e01b1790529151600092839290881691611912919061217d565b6000604051808303816000865af19150503d806000811461194f576040519150601f19603f3d011682016040523d82523d6000602084013e611954565b606091505b509150915081158061198257508051158015906119825750808060200190518101906119809190612199565b155b156119a0576040516316369daf60e31b815260040160405180910390fd5b505050505050565b6000826001600160a01b0316846001600160a01b031611156119c8579192915b60006119eb856001600160a01b0316856001600160a01b0316600160601b611a48565b90506108d6611a0d84836119ff89896121b4565b6001600160a01b0316611a48565b611af7565b6000826001600160a01b0316846001600160a01b03161115611a32579192915b6112aa611a0d83600160601b6119ff88886121b4565b600080806000198587098587029250828110838203039150508060001415611a825760008411611a7757600080fd5b50829004905061089b565b808411611a8e57600080fd5b60008486880960026001871981018816978890046003810283188082028403028082028403028082028403028082028403028082028403029081029092039091026000889003889004909101858311909403939093029303949094049190911702949350505050565b806001600160801b0381168114611b0d57600080fd5b919050565b60005b83811015611b2d578181015183820152602001611b15565b8381111561175d5750506000910152565b60008151808452611b56816020860160208601611b12565b601f01601f19169290920160200192915050565b60208152600061089b6020830184611b3e565b6001600160a01b0381168114610e8e57600080fd5b60008060408385031215611ba557600080fd5b8235611bb081611b7d565b946020939093013593505050565b600080600060608486031215611bd357600080fd5b8335611bde81611b7d565b92506020840135611bee81611b7d565b929592945050506040919091013590565b600060208284031215611c1157600080fd5b813561089b81611b7d565b600080600080600060a08688031215611c3457600080fd5b853594506020860135935060408601359250606086013591506080860135611c5b81611b7d565b809150509295509295909350565b6001600160801b0381168114610e8e57600080fd5b60008060008060808587031215611c9457600080fd5b8435611c9f81611c69565b935060208501359250604085013591506060850135611cbd81611b7d565b939692955090935050565b60008060008060608587031215611cde57600080fd5b8435935060208501359250604085013567ffffffffffffffff80821115611d0457600080fd5b818701915087601f830112611d1857600080fd5b813581811115611d2757600080fd5b886020828501011115611d3957600080fd5b95989497505060200194505050565b60008060408385031215611d5b57600080fd5b8235611d6681611b7d565b91506020830135611d7681611b7d565b809150509250929050565b600181811c90821680611d9557607f821691505b60208210811415611db657634e487b7160e01b600052602260045260246000fd5b50919050565b600080600080600060a08688031215611dd457600080fd5b8551611ddf81611c69565b8095505060208601519350604086015192506060860151611dff81611c69565b6080870151909250611c5b81611c69565b634e487b7160e01b600052601160045260246000fd5b600082821015611e3857611e38611e10565b500390565b60008060408385031215611e5057600080fd5b505080516020909101519092909150565b6001600160a01b03959095168552600293840b60208601529190920b60408401526001600160801b03918216606084015216608082015260a00190565b60008060408385031215611eb157600080fd5b8251611ebc81611c69565b6020840151909250611d7681611c69565b6040516060810167ffffffffffffffff81118282101715611efe57634e487b7160e01b600052604160045260246000fd5b60405290565b60008183036080811215611f1757600080fd5b6040516040810181811067ffffffffffffffff82111715611f4857634e487b7160e01b600052604160045260246000fd5b6040526060821215611f5957600080fd5b611f61611ecd565b91508335611f6e81611b7d565b82526020840135611f7e81611b7d565b6020830152604084013562ffffff81168114611f9957600080fd5b6040830152908152606083013590611fb082611b7d565b60208101919091529392505050565b6000600160ff1b821415611fd557611fd5611e10565b5060000390565b60008160020b627fffff19811415611ff657611ff6611e10565b60000392915050565b600081600019048311821515161561201957612019611e10565b500290565b634e487b7160e01b600052601260045260246000fd5b6000826120435761204361201e565b500490565b6000826120575761205761201e565b500690565b6000821982111561206f5761206f611e10565b500190565b805161ffff81168114611b0d57600080fd5b80518015158114611b0d57600080fd5b600080600080600080600060e0888a0312156120b157600080fd5b87516120bc81611b7d565b8097505060208801518060020b81146120d457600080fd5b95506120e260408901612074565b94506120f060608901612074565b93506120fe60808901612074565b925060a088015160ff8116811461211457600080fd5b915061212260c08901612086565b905092959891949750929550565b60018060a01b03861681528460020b60208201528360020b60408201526001600160801b038316606082015260a06080820152600061217260a0830184611b3e565b979650505050505050565b6000825161218f818460208701611b12565b9190910192915050565b6000602082840312156121ab57600080fd5b61089b82612086565b60006001600160a01b03838116908316818110156121d4576121d4611e10565b03939250505056fea2646970667358221220a5cf752f3a9624b2bde030ec682170656211d5a7c372ef46b65ffb00bb78c39e64736f6c63430008080033", + "devdoc": { + "kind": "dev", + "methods": { + "approve(address,uint256)": { + "details": "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." + }, + "burn(uint128,uint256,uint256,address)": { + "params": { + "amount0Min": "The minimum amount of token0 we want to send to the recipient (to)", + "amount1Min": "The minimum amount of token1 we want to send to the recipient (to)", + "liquidity": "The amount of liquidity to be burned", + "to": "The address that will receive the due fees" + }, + "returns": { + "amount0": "The calculated amount of token0 that will be sent to the recipient", + "amount1": "The calculated amount of token1 that will be sent to the recipient" + } + }, + "collect()": { + "details": "The collected fees will be sent to governor", + "returns": { + "amount0": "The amount of fees collected in token0", + "amount1": "The amount of fees collected in token1" + } + }, + "mint(uint256,uint256,uint256,uint256,address)": { + "details": "Triggers UniV3PairManager#uniswapV3MintCallback", + "params": { + "amount0Desired": "The amount of token0 we would like to provide", + "amount0Min": "The minimum amount of token0 we want to provide", + "amount1Desired": "The amount of token1 we would like to provide", + "amount1Min": "The minimum amount of token1 we want to provide", + "to": "The address to which the kLP tokens are going to be minted to" + }, + "returns": { + "liquidity": "kLP tokens sent in exchange for the provision of tokens" + } + }, + "position()": { + "returns": { + "feeGrowthInside0LastX128": "The fee growth of token0 as of the last action on the individual position", + "feeGrowthInside1LastX128": "The fee growth of token1 as of the last action on the individual position", + "liquidity": "The amount of liquidity provided to the UniswapV3 pool by the pair manager", + "tokensOwed0": "The uncollected amount of token0 owed to the position as of the last computation", + "tokensOwed1": "The uncollected amount of token1 owed to the position as of the last computation" + } + }, + "setPendingGovernor(address)": { + "params": { + "_pendingGovernor": "Address of the proposed new governor" + } + }, + "transfer(address,uint256)": { + "details": "Moves `amount` tokens from the caller's account to `recipient`. Returns a boolean value indicating whether the operation succeeded. Emits a {Transfer} event." + }, + "transferFrom(address,address,uint256)": { + "details": "Moves `amount` tokens from `sender` to `recipient` 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." + }, + "uniswapV3MintCallback(uint256,uint256,bytes)": { + "params": { + "amount0Owed": "The amount of token0 due to the pool for the minted liquidity", + "amount1Owed": "The amount of token1 due to the pool for the minted liquidity", + "data": "The encoded token0, token1, fee (_poolKey) and the payer (msg.sender) of the IUniV3PairManager#mint function" + } + } + }, + "stateVariables": { + "_MAX_TICK": { + "details": "Due to tick spacing, pools with different fees may have differences between _MAX_TICK and tickUpper. Use tickUpper to find the max tick of the pool." + }, + "allowance": { + "details": "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." + }, + "balanceOf": { + "details": "Returns the amount of tokens owned by `account`." + }, + "decimals": { + "details": "Returns the decimals places of the token." + }, + "factory": { + "return": "_factory The address of the PairManager Factory", + "returns": { + "_0": "_factory The address of the PairManager Factory" + } + }, + "fee": { + "return": "_fee The fee of the Uniswap pool passed into the constructor", + "returns": { + "_0": "_fee The fee of the Uniswap pool passed into the constructor" + } + }, + "name": { + "details": "Returns the name of the token." + }, + "pool": { + "return": "_pool The address of the pool", + "returns": { + "_0": "_pool The address of the pool" + } + }, + "sqrtRatioAX96": { + "return": "_sqrtPriceA96 A Fixed point Q64.96 number representing the sqrt of the ratio of the two assets (token1/token0) at the lowest tick", + "returns": { + "_0": "_sqrtPriceA96 A Fixed point Q64.96 number representing the sqrt of the ratio of the two assets (token1/token0) at the lowest tick" + } + }, + "sqrtRatioBX96": { + "return": "_sqrtPriceBX96 A Fixed point Q64.96 number representing the sqrt of the ratio of the two assets (token1/token0) at the highest tick", + "returns": { + "_0": "_sqrtPriceBX96 A Fixed point Q64.96 number representing the sqrt of the ratio of the two assets (token1/token0) at the highest tick" + } + }, + "symbol": { + "details": "Returns the symbol of the token." + }, + "tickLower": { + "return": "_tickLower The lower tick in the Uniswap's curve", + "returns": { + "_0": "_tickLower The lower tick in the Uniswap's curve" + } + }, + "tickSpacing": { + "return": "_tickSpacing The pair tick spacing", + "returns": { + "_0": "_tickSpacing The pair tick spacing" + } + }, + "tickUpper": { + "return": "_tickUpper The highest tick in the Uniswap's curve", + "returns": { + "_0": "_tickUpper The highest tick in the Uniswap's curve" + } + }, + "token0": { + "return": "_token0 The address of token0", + "returns": { + "_0": "_token0 The address of token0" + } + }, + "token1": { + "return": "_token1 The address of token1", + "returns": { + "_0": "_token1 The address of token1" + } + }, + "totalSupply": { + "details": "Returns the amount of tokens in existence." + } + }, + "version": 1 + }, + "userdoc": { + "errors": { + "ExcessiveSlippage()": [ + { + "notice": "Throws when the slippage exceeds what the user is comfortable with" + } + ], + "InvalidAddress()": [ + { + "notice": "Thrown if an address is invalid" + } + ], + "InvalidAmount()": [ + { + "notice": "Thrown if an amount is invalid" + } + ], + "LengthMismatch()": [ + { + "notice": "Thrown if the lengths of a set of lists mismatch" + } + ], + "OnlyGovernor()": [ + { + "notice": "Thrown if a non-governor user tries to call a OnlyGovernor function" + } + ], + "OnlyPendingGovernor()": [ + { + "notice": "Thrown if a non-pending-governor user tries to call a OnlyPendingGovernor function" + } + ], + "OnlyPool()": [ + { + "notice": "Throws when the caller of the function is not the pool" + } + ], + "UnsuccessfulTransfer()": [ + { + "notice": "Throws when a transfer is unsuccessful" + } + ], + "ZeroAddress()": [ + { + "notice": "Thrown if an address is the zero address" + } + ], + "ZeroAmount()": [ + { + "notice": "Thrown if an amount is zero" + } + ] + }, + "events": { + "PendingGovernorAccepted(address)": { + "notice": "Emitted when a new governor is set" + }, + "PendingGovernorSet(address,address)": { + "notice": "Emitted when a new pending governor is set" + } + }, + "kind": "user", + "methods": { + "acceptPendingGovernor()": { + "notice": "Allows a proposed governor to accept the governance" + }, + "factory()": { + "notice": "Address of the factory from which the pair manager was created" + }, + "fee()": { + "notice": "The fee of the Uniswap pool passed into the constructor" + }, + "mint(uint256,uint256,uint256,uint256,address)": { + "notice": "Mints kLP tokens to an address according to the liquidity the msg.sender provides to the UniswapV3 pool" + }, + "pool()": { + "notice": "Address of the pool from which the Keep3r pair manager will interact with" + }, + "position()": { + "notice": "Returns the pair manager's position in the corresponding UniswapV3 pool" + }, + "setPendingGovernor(address)": { + "notice": "Allows a governor to propose a new governor" + }, + "sqrtRatioAX96()": { + "notice": "The sqrtRatioAX96 at the lowest tick (-887200) of the Uniswap pool" + }, + "sqrtRatioBX96()": { + "notice": "The sqrtRatioBX96 at the highest tick (887200) of the Uniswap pool" + }, + "tickLower()": { + "notice": "Lowest tick in the Uniswap's curve" + }, + "tickSpacing()": { + "notice": "The pair tick spacing" + }, + "tickUpper()": { + "notice": "Highest tick in the Uniswap's curve" + }, + "token0()": { + "notice": "Token0 of the pool" + }, + "token1()": { + "notice": "Token1 of the pool" + }, + "uniswapV3MintCallback(uint256,uint256,bytes)": { + "notice": "This function is called after a user calls IUniV3PairManager#mint function It ensures that any tokens owed to the pool are paid by the msg.sender of IUniV3PairManager#mint function" + } + }, + "version": 1 + }, + "storageLayout": { + "storage": [ + { + "astId": 82, + "contract": "solidity/contracts/UniV3PairManager.sol:UniV3PairManager", + "label": "governor", + "offset": 0, + "slot": "0", + "type": "t_address" + }, + { + "astId": 85, + "contract": "solidity/contracts/UniV3PairManager.sol:UniV3PairManager", + "label": "pendingGovernor", + "offset": 0, + "slot": "1", + "type": "t_address" + }, + { + "astId": 3834, + "contract": "solidity/contracts/UniV3PairManager.sol:UniV3PairManager", + "label": "name", + "offset": 0, + "slot": "2", + "type": "t_string_storage" + }, + { + "astId": 3838, + "contract": "solidity/contracts/UniV3PairManager.sol:UniV3PairManager", + "label": "symbol", + "offset": 0, + "slot": "3", + "type": "t_string_storage" + }, + { + "astId": 3842, + "contract": "solidity/contracts/UniV3PairManager.sol:UniV3PairManager", + "label": "totalSupply", + "offset": 0, + "slot": "4", + "type": "t_uint256" + }, + { + "astId": 3899, + "contract": "solidity/contracts/UniV3PairManager.sol:UniV3PairManager", + "label": "allowance", + "offset": 0, + "slot": "5", + "type": "t_mapping(t_address,t_mapping(t_address,t_uint256))" + }, + { + "astId": 3905, + "contract": "solidity/contracts/UniV3PairManager.sol:UniV3PairManager", + "label": "balanceOf", + "offset": 0, + "slot": "6", + "type": "t_mapping(t_address,t_uint256)" + }, + { + "astId": 3909, + "contract": "solidity/contracts/UniV3PairManager.sol:UniV3PairManager", + "label": "_poolKey", + "offset": 0, + "slot": "7", + "type": "t_struct(PoolKey)13375_storage" + } + ], + "types": { + "t_address": { + "encoding": "inplace", + "label": "address", + "numberOfBytes": "20" + }, + "t_mapping(t_address,t_mapping(t_address,t_uint256))": { + "encoding": "mapping", + "key": "t_address", + "label": "mapping(address => mapping(address => uint256))", + "numberOfBytes": "32", + "value": "t_mapping(t_address,t_uint256)" + }, + "t_mapping(t_address,t_uint256)": { + "encoding": "mapping", + "key": "t_address", + "label": "mapping(address => uint256)", + "numberOfBytes": "32", + "value": "t_uint256" + }, + "t_string_storage": { + "encoding": "bytes", + "label": "string", + "numberOfBytes": "32" + }, + "t_struct(PoolKey)13375_storage": { + "encoding": "inplace", + "label": "struct IUniV3PairManager.PoolKey", + "members": [ + { + "astId": 13370, + "contract": "solidity/contracts/UniV3PairManager.sol:UniV3PairManager", + "label": "token0", + "offset": 0, + "slot": "0", + "type": "t_address" + }, + { + "astId": 13372, + "contract": "solidity/contracts/UniV3PairManager.sol:UniV3PairManager", + "label": "token1", + "offset": 0, + "slot": "1", + "type": "t_address" + }, + { + "astId": 13374, + "contract": "solidity/contracts/UniV3PairManager.sol:UniV3PairManager", + "label": "fee", + "offset": 20, + "slot": "1", + "type": "t_uint24" + } + ], + "numberOfBytes": "64" + }, + "t_uint24": { + "encoding": "inplace", + "label": "uint24", + "numberOfBytes": "3" + }, + "t_uint256": { + "encoding": "inplace", + "label": "uint256", + "numberOfBytes": "32" + } + } + } +} \ No newline at end of file diff --git a/deployments/sepolia/UniV3Pool.json b/deployments/sepolia/UniV3Pool.json new file mode 100644 index 0000000..1289b6b --- /dev/null +++ b/deployments/sepolia/UniV3Pool.json @@ -0,0 +1,987 @@ +{ + "address": "0xb39Dea2246Ac99575eebc86A2590BADF046eda91", + "abi": [ + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "indexed": true, + "internalType": "int24", + "name": "tickLower", + "type": "int24" + }, + { + "indexed": true, + "internalType": "int24", + "name": "tickUpper", + "type": "int24" + }, + { + "indexed": false, + "internalType": "uint128", + "name": "amount", + "type": "uint128" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "amount0", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "amount1", + "type": "uint256" + } + ], + "name": "Burn", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "indexed": false, + "internalType": "address", + "name": "recipient", + "type": "address" + }, + { + "indexed": true, + "internalType": "int24", + "name": "tickLower", + "type": "int24" + }, + { + "indexed": true, + "internalType": "int24", + "name": "tickUpper", + "type": "int24" + }, + { + "indexed": false, + "internalType": "uint128", + "name": "amount0", + "type": "uint128" + }, + { + "indexed": false, + "internalType": "uint128", + "name": "amount1", + "type": "uint128" + } + ], + "name": "Collect", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "sender", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "recipient", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint128", + "name": "amount0", + "type": "uint128" + }, + { + "indexed": false, + "internalType": "uint128", + "name": "amount1", + "type": "uint128" + } + ], + "name": "CollectProtocol", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "sender", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "recipient", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "amount0", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "amount1", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "paid0", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "paid1", + "type": "uint256" + } + ], + "name": "Flash", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint16", + "name": "observationCardinalityNextOld", + "type": "uint16" + }, + { + "indexed": false, + "internalType": "uint16", + "name": "observationCardinalityNextNew", + "type": "uint16" + } + ], + "name": "IncreaseObservationCardinalityNext", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint160", + "name": "sqrtPriceX96", + "type": "uint160" + }, + { + "indexed": false, + "internalType": "int24", + "name": "tick", + "type": "int24" + } + ], + "name": "Initialize", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "sender", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "indexed": true, + "internalType": "int24", + "name": "tickLower", + "type": "int24" + }, + { + "indexed": true, + "internalType": "int24", + "name": "tickUpper", + "type": "int24" + }, + { + "indexed": false, + "internalType": "uint128", + "name": "amount", + "type": "uint128" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "amount0", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "amount1", + "type": "uint256" + } + ], + "name": "Mint", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint8", + "name": "feeProtocol0Old", + "type": "uint8" + }, + { + "indexed": false, + "internalType": "uint8", + "name": "feeProtocol1Old", + "type": "uint8" + }, + { + "indexed": false, + "internalType": "uint8", + "name": "feeProtocol0New", + "type": "uint8" + }, + { + "indexed": false, + "internalType": "uint8", + "name": "feeProtocol1New", + "type": "uint8" + } + ], + "name": "SetFeeProtocol", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "sender", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "recipient", + "type": "address" + }, + { + "indexed": false, + "internalType": "int256", + "name": "amount0", + "type": "int256" + }, + { + "indexed": false, + "internalType": "int256", + "name": "amount1", + "type": "int256" + }, + { + "indexed": false, + "internalType": "uint160", + "name": "sqrtPriceX96", + "type": "uint160" + }, + { + "indexed": false, + "internalType": "uint128", + "name": "liquidity", + "type": "uint128" + }, + { + "indexed": false, + "internalType": "int24", + "name": "tick", + "type": "int24" + } + ], + "name": "Swap", + "type": "event" + }, + { + "inputs": [ + { + "internalType": "int24", + "name": "tickLower", + "type": "int24" + }, + { + "internalType": "int24", + "name": "tickUpper", + "type": "int24" + }, + { + "internalType": "uint128", + "name": "amount", + "type": "uint128" + } + ], + "name": "burn", + "outputs": [ + { + "internalType": "uint256", + "name": "amount0", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "amount1", + "type": "uint256" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "recipient", + "type": "address" + }, + { + "internalType": "int24", + "name": "tickLower", + "type": "int24" + }, + { + "internalType": "int24", + "name": "tickUpper", + "type": "int24" + }, + { + "internalType": "uint128", + "name": "amount0Requested", + "type": "uint128" + }, + { + "internalType": "uint128", + "name": "amount1Requested", + "type": "uint128" + } + ], + "name": "collect", + "outputs": [ + { + "internalType": "uint128", + "name": "amount0", + "type": "uint128" + }, + { + "internalType": "uint128", + "name": "amount1", + "type": "uint128" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "recipient", + "type": "address" + }, + { + "internalType": "uint128", + "name": "amount0Requested", + "type": "uint128" + }, + { + "internalType": "uint128", + "name": "amount1Requested", + "type": "uint128" + } + ], + "name": "collectProtocol", + "outputs": [ + { + "internalType": "uint128", + "name": "amount0", + "type": "uint128" + }, + { + "internalType": "uint128", + "name": "amount1", + "type": "uint128" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "factory", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "fee", + "outputs": [ + { + "internalType": "uint24", + "name": "", + "type": "uint24" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "feeGrowthGlobal0X128", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "feeGrowthGlobal1X128", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "recipient", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amount0", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "amount1", + "type": "uint256" + }, + { + "internalType": "bytes", + "name": "data", + "type": "bytes" + } + ], + "name": "flash", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint16", + "name": "observationCardinalityNext", + "type": "uint16" + } + ], + "name": "increaseObservationCardinalityNext", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint160", + "name": "sqrtPriceX96", + "type": "uint160" + } + ], + "name": "initialize", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "liquidity", + "outputs": [ + { + "internalType": "uint128", + "name": "", + "type": "uint128" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "maxLiquidityPerTick", + "outputs": [ + { + "internalType": "uint128", + "name": "", + "type": "uint128" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "recipient", + "type": "address" + }, + { + "internalType": "int24", + "name": "tickLower", + "type": "int24" + }, + { + "internalType": "int24", + "name": "tickUpper", + "type": "int24" + }, + { + "internalType": "uint128", + "name": "amount", + "type": "uint128" + }, + { + "internalType": "bytes", + "name": "data", + "type": "bytes" + } + ], + "name": "mint", + "outputs": [ + { + "internalType": "uint256", + "name": "amount0", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "amount1", + "type": "uint256" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "index", + "type": "uint256" + } + ], + "name": "observations", + "outputs": [ + { + "internalType": "uint32", + "name": "blockTimestamp", + "type": "uint32" + }, + { + "internalType": "int56", + "name": "tickCumulative", + "type": "int56" + }, + { + "internalType": "uint160", + "name": "secondsPerLiquidityCumulativeX128", + "type": "uint160" + }, + { + "internalType": "bool", + "name": "initialized", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint32[]", + "name": "secondsAgos", + "type": "uint32[]" + } + ], + "name": "observe", + "outputs": [ + { + "internalType": "int56[]", + "name": "tickCumulatives", + "type": "int56[]" + }, + { + "internalType": "uint160[]", + "name": "secondsPerLiquidityCumulativeX128s", + "type": "uint160[]" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "key", + "type": "bytes32" + } + ], + "name": "positions", + "outputs": [ + { + "internalType": "uint128", + "name": "_liquidity", + "type": "uint128" + }, + { + "internalType": "uint256", + "name": "feeGrowthInside0LastX128", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "feeGrowthInside1LastX128", + "type": "uint256" + }, + { + "internalType": "uint128", + "name": "tokensOwed0", + "type": "uint128" + }, + { + "internalType": "uint128", + "name": "tokensOwed1", + "type": "uint128" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "protocolFees", + "outputs": [ + { + "internalType": "uint128", + "name": "token0", + "type": "uint128" + }, + { + "internalType": "uint128", + "name": "token1", + "type": "uint128" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint8", + "name": "feeProtocol0", + "type": "uint8" + }, + { + "internalType": "uint8", + "name": "feeProtocol1", + "type": "uint8" + } + ], + "name": "setFeeProtocol", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "slot0", + "outputs": [ + { + "internalType": "uint160", + "name": "sqrtPriceX96", + "type": "uint160" + }, + { + "internalType": "int24", + "name": "tick", + "type": "int24" + }, + { + "internalType": "uint16", + "name": "observationIndex", + "type": "uint16" + }, + { + "internalType": "uint16", + "name": "observationCardinality", + "type": "uint16" + }, + { + "internalType": "uint16", + "name": "observationCardinalityNext", + "type": "uint16" + }, + { + "internalType": "uint8", + "name": "feeProtocol", + "type": "uint8" + }, + { + "internalType": "bool", + "name": "unlocked", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "int24", + "name": "tickLower", + "type": "int24" + }, + { + "internalType": "int24", + "name": "tickUpper", + "type": "int24" + } + ], + "name": "snapshotCumulativesInside", + "outputs": [ + { + "internalType": "int56", + "name": "tickCumulativeInside", + "type": "int56" + }, + { + "internalType": "uint160", + "name": "secondsPerLiquidityInsideX128", + "type": "uint160" + }, + { + "internalType": "uint32", + "name": "secondsInside", + "type": "uint32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "recipient", + "type": "address" + }, + { + "internalType": "bool", + "name": "zeroForOne", + "type": "bool" + }, + { + "internalType": "int256", + "name": "amountSpecified", + "type": "int256" + }, + { + "internalType": "uint160", + "name": "sqrtPriceLimitX96", + "type": "uint160" + }, + { + "internalType": "bytes", + "name": "data", + "type": "bytes" + } + ], + "name": "swap", + "outputs": [ + { + "internalType": "int256", + "name": "amount0", + "type": "int256" + }, + { + "internalType": "int256", + "name": "amount1", + "type": "int256" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "int16", + "name": "wordPosition", + "type": "int16" + } + ], + "name": "tickBitmap", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "tickSpacing", + "outputs": [ + { + "internalType": "int24", + "name": "", + "type": "int24" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "int24", + "name": "tick", + "type": "int24" + } + ], + "name": "ticks", + "outputs": [ + { + "internalType": "uint128", + "name": "liquidityGross", + "type": "uint128" + }, + { + "internalType": "int128", + "name": "liquidityNet", + "type": "int128" + }, + { + "internalType": "uint256", + "name": "feeGrowthOutside0X128", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "feeGrowthOutside1X128", + "type": "uint256" + }, + { + "internalType": "int56", + "name": "tickCumulativeOutside", + "type": "int56" + }, + { + "internalType": "uint160", + "name": "secondsPerLiquidityOutsideX128", + "type": "uint160" + }, + { + "internalType": "uint32", + "name": "secondsOutside", + "type": "uint32" + }, + { + "internalType": "bool", + "name": "initialized", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "token0", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "token1", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + } + ], + "numDeployments": 32 +} \ No newline at end of file diff --git a/deployments/sepolia/WETH.json b/deployments/sepolia/WETH.json new file mode 100644 index 0000000..209ad4c --- /dev/null +++ b/deployments/sepolia/WETH.json @@ -0,0 +1,417 @@ +{ + "address": "0xfFf9976782d46CC05630D1f6eBAb18b2324d6B14", + "abi": [ + { + "inputs": [ + { + "internalType": "string", + "name": "_name", + "type": "string" + }, + { + "internalType": "string", + "name": "_symbol", + "type": "string" + }, + { + "internalType": "address", + "name": "_initialAccount", + "type": "address" + }, + { + "internalType": "uint256", + "name": "_initialBalance", + "type": "uint256" + } + ], + "stateMutability": "nonpayable", + "type": "constructor" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "spender", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "value", + "type": "uint256" + } + ], + "name": "Approval", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "from", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "to", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "value", + "type": "uint256" + } + ], + "name": "Transfer", + "type": "event" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "internalType": "address", + "name": "spender", + "type": "address" + } + ], + "name": "allowance", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "spender", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "approve", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_owner", + "type": "address" + }, + { + "internalType": "address", + "name": "_spender", + "type": "address" + }, + { + "internalType": "uint256", + "name": "_value", + "type": "uint256" + } + ], + "name": "approveInternal", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "balanceOf", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "_amount", + "type": "uint256" + } + ], + "name": "burn", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_account", + "type": "address" + }, + { + "internalType": "uint256", + "name": "_amount", + "type": "uint256" + } + ], + "name": "burn", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "decimals", + "outputs": [ + { + "internalType": "uint8", + "name": "", + "type": "uint8" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "spender", + "type": "address" + }, + { + "internalType": "uint256", + "name": "subtractedValue", + "type": "uint256" + } + ], + "name": "decreaseAllowance", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "deposit", + "outputs": [], + "stateMutability": "payable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "spender", + "type": "address" + }, + { + "internalType": "uint256", + "name": "addedValue", + "type": "uint256" + } + ], + "name": "increaseAllowance", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_account", + "type": "address" + }, + { + "internalType": "uint256", + "name": "_amount", + "type": "uint256" + } + ], + "name": "mint", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "_amount", + "type": "uint256" + } + ], + "name": "mint", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "name", + "outputs": [ + { + "internalType": "string", + "name": "", + "type": "string" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "symbol", + "outputs": [ + { + "internalType": "string", + "name": "", + "type": "string" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "totalSupply", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "recipient", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "transfer", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "sender", + "type": "address" + }, + { + "internalType": "address", + "name": "recipient", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "transferFrom", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_from", + "type": "address" + }, + { + "internalType": "address", + "name": "_to", + "type": "address" + }, + { + "internalType": "uint256", + "name": "_value", + "type": "uint256" + } + ], + "name": "transferInternal", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + } + ], + "numDeployments": 57 +} \ No newline at end of file diff --git a/deployments/sepolia/WethUsdOracle.json b/deployments/sepolia/WethUsdOracle.json new file mode 100644 index 0000000..1c189bf --- /dev/null +++ b/deployments/sepolia/WethUsdOracle.json @@ -0,0 +1,986 @@ +{ + "abi": [ + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "indexed": true, + "internalType": "int24", + "name": "tickLower", + "type": "int24" + }, + { + "indexed": true, + "internalType": "int24", + "name": "tickUpper", + "type": "int24" + }, + { + "indexed": false, + "internalType": "uint128", + "name": "amount", + "type": "uint128" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "amount0", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "amount1", + "type": "uint256" + } + ], + "name": "Burn", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "indexed": false, + "internalType": "address", + "name": "recipient", + "type": "address" + }, + { + "indexed": true, + "internalType": "int24", + "name": "tickLower", + "type": "int24" + }, + { + "indexed": true, + "internalType": "int24", + "name": "tickUpper", + "type": "int24" + }, + { + "indexed": false, + "internalType": "uint128", + "name": "amount0", + "type": "uint128" + }, + { + "indexed": false, + "internalType": "uint128", + "name": "amount1", + "type": "uint128" + } + ], + "name": "Collect", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "sender", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "recipient", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint128", + "name": "amount0", + "type": "uint128" + }, + { + "indexed": false, + "internalType": "uint128", + "name": "amount1", + "type": "uint128" + } + ], + "name": "CollectProtocol", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "sender", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "recipient", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "amount0", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "amount1", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "paid0", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "paid1", + "type": "uint256" + } + ], + "name": "Flash", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint16", + "name": "observationCardinalityNextOld", + "type": "uint16" + }, + { + "indexed": false, + "internalType": "uint16", + "name": "observationCardinalityNextNew", + "type": "uint16" + } + ], + "name": "IncreaseObservationCardinalityNext", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint160", + "name": "sqrtPriceX96", + "type": "uint160" + }, + { + "indexed": false, + "internalType": "int24", + "name": "tick", + "type": "int24" + } + ], + "name": "Initialize", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "sender", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "indexed": true, + "internalType": "int24", + "name": "tickLower", + "type": "int24" + }, + { + "indexed": true, + "internalType": "int24", + "name": "tickUpper", + "type": "int24" + }, + { + "indexed": false, + "internalType": "uint128", + "name": "amount", + "type": "uint128" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "amount0", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "amount1", + "type": "uint256" + } + ], + "name": "Mint", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint8", + "name": "feeProtocol0Old", + "type": "uint8" + }, + { + "indexed": false, + "internalType": "uint8", + "name": "feeProtocol1Old", + "type": "uint8" + }, + { + "indexed": false, + "internalType": "uint8", + "name": "feeProtocol0New", + "type": "uint8" + }, + { + "indexed": false, + "internalType": "uint8", + "name": "feeProtocol1New", + "type": "uint8" + } + ], + "name": "SetFeeProtocol", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "sender", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "recipient", + "type": "address" + }, + { + "indexed": false, + "internalType": "int256", + "name": "amount0", + "type": "int256" + }, + { + "indexed": false, + "internalType": "int256", + "name": "amount1", + "type": "int256" + }, + { + "indexed": false, + "internalType": "uint160", + "name": "sqrtPriceX96", + "type": "uint160" + }, + { + "indexed": false, + "internalType": "uint128", + "name": "liquidity", + "type": "uint128" + }, + { + "indexed": false, + "internalType": "int24", + "name": "tick", + "type": "int24" + } + ], + "name": "Swap", + "type": "event" + }, + { + "inputs": [ + { + "internalType": "int24", + "name": "tickLower", + "type": "int24" + }, + { + "internalType": "int24", + "name": "tickUpper", + "type": "int24" + }, + { + "internalType": "uint128", + "name": "amount", + "type": "uint128" + } + ], + "name": "burn", + "outputs": [ + { + "internalType": "uint256", + "name": "amount0", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "amount1", + "type": "uint256" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "recipient", + "type": "address" + }, + { + "internalType": "int24", + "name": "tickLower", + "type": "int24" + }, + { + "internalType": "int24", + "name": "tickUpper", + "type": "int24" + }, + { + "internalType": "uint128", + "name": "amount0Requested", + "type": "uint128" + }, + { + "internalType": "uint128", + "name": "amount1Requested", + "type": "uint128" + } + ], + "name": "collect", + "outputs": [ + { + "internalType": "uint128", + "name": "amount0", + "type": "uint128" + }, + { + "internalType": "uint128", + "name": "amount1", + "type": "uint128" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "recipient", + "type": "address" + }, + { + "internalType": "uint128", + "name": "amount0Requested", + "type": "uint128" + }, + { + "internalType": "uint128", + "name": "amount1Requested", + "type": "uint128" + } + ], + "name": "collectProtocol", + "outputs": [ + { + "internalType": "uint128", + "name": "amount0", + "type": "uint128" + }, + { + "internalType": "uint128", + "name": "amount1", + "type": "uint128" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "factory", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "fee", + "outputs": [ + { + "internalType": "uint24", + "name": "", + "type": "uint24" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "feeGrowthGlobal0X128", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "feeGrowthGlobal1X128", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "recipient", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amount0", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "amount1", + "type": "uint256" + }, + { + "internalType": "bytes", + "name": "data", + "type": "bytes" + } + ], + "name": "flash", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint16", + "name": "observationCardinalityNext", + "type": "uint16" + } + ], + "name": "increaseObservationCardinalityNext", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint160", + "name": "sqrtPriceX96", + "type": "uint160" + } + ], + "name": "initialize", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "liquidity", + "outputs": [ + { + "internalType": "uint128", + "name": "", + "type": "uint128" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "maxLiquidityPerTick", + "outputs": [ + { + "internalType": "uint128", + "name": "", + "type": "uint128" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "recipient", + "type": "address" + }, + { + "internalType": "int24", + "name": "tickLower", + "type": "int24" + }, + { + "internalType": "int24", + "name": "tickUpper", + "type": "int24" + }, + { + "internalType": "uint128", + "name": "amount", + "type": "uint128" + }, + { + "internalType": "bytes", + "name": "data", + "type": "bytes" + } + ], + "name": "mint", + "outputs": [ + { + "internalType": "uint256", + "name": "amount0", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "amount1", + "type": "uint256" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "index", + "type": "uint256" + } + ], + "name": "observations", + "outputs": [ + { + "internalType": "uint32", + "name": "blockTimestamp", + "type": "uint32" + }, + { + "internalType": "int56", + "name": "tickCumulative", + "type": "int56" + }, + { + "internalType": "uint160", + "name": "secondsPerLiquidityCumulativeX128", + "type": "uint160" + }, + { + "internalType": "bool", + "name": "initialized", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint32[]", + "name": "secondsAgos", + "type": "uint32[]" + } + ], + "name": "observe", + "outputs": [ + { + "internalType": "int56[]", + "name": "tickCumulatives", + "type": "int56[]" + }, + { + "internalType": "uint160[]", + "name": "secondsPerLiquidityCumulativeX128s", + "type": "uint160[]" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "key", + "type": "bytes32" + } + ], + "name": "positions", + "outputs": [ + { + "internalType": "uint128", + "name": "_liquidity", + "type": "uint128" + }, + { + "internalType": "uint256", + "name": "feeGrowthInside0LastX128", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "feeGrowthInside1LastX128", + "type": "uint256" + }, + { + "internalType": "uint128", + "name": "tokensOwed0", + "type": "uint128" + }, + { + "internalType": "uint128", + "name": "tokensOwed1", + "type": "uint128" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "protocolFees", + "outputs": [ + { + "internalType": "uint128", + "name": "token0", + "type": "uint128" + }, + { + "internalType": "uint128", + "name": "token1", + "type": "uint128" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint8", + "name": "feeProtocol0", + "type": "uint8" + }, + { + "internalType": "uint8", + "name": "feeProtocol1", + "type": "uint8" + } + ], + "name": "setFeeProtocol", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "slot0", + "outputs": [ + { + "internalType": "uint160", + "name": "sqrtPriceX96", + "type": "uint160" + }, + { + "internalType": "int24", + "name": "tick", + "type": "int24" + }, + { + "internalType": "uint16", + "name": "observationIndex", + "type": "uint16" + }, + { + "internalType": "uint16", + "name": "observationCardinality", + "type": "uint16" + }, + { + "internalType": "uint16", + "name": "observationCardinalityNext", + "type": "uint16" + }, + { + "internalType": "uint8", + "name": "feeProtocol", + "type": "uint8" + }, + { + "internalType": "bool", + "name": "unlocked", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "int24", + "name": "tickLower", + "type": "int24" + }, + { + "internalType": "int24", + "name": "tickUpper", + "type": "int24" + } + ], + "name": "snapshotCumulativesInside", + "outputs": [ + { + "internalType": "int56", + "name": "tickCumulativeInside", + "type": "int56" + }, + { + "internalType": "uint160", + "name": "secondsPerLiquidityInsideX128", + "type": "uint160" + }, + { + "internalType": "uint32", + "name": "secondsInside", + "type": "uint32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "recipient", + "type": "address" + }, + { + "internalType": "bool", + "name": "zeroForOne", + "type": "bool" + }, + { + "internalType": "int256", + "name": "amountSpecified", + "type": "int256" + }, + { + "internalType": "uint160", + "name": "sqrtPriceLimitX96", + "type": "uint160" + }, + { + "internalType": "bytes", + "name": "data", + "type": "bytes" + } + ], + "name": "swap", + "outputs": [ + { + "internalType": "int256", + "name": "amount0", + "type": "int256" + }, + { + "internalType": "int256", + "name": "amount1", + "type": "int256" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "int16", + "name": "wordPosition", + "type": "int16" + } + ], + "name": "tickBitmap", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "tickSpacing", + "outputs": [ + { + "internalType": "int24", + "name": "", + "type": "int24" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "int24", + "name": "tick", + "type": "int24" + } + ], + "name": "ticks", + "outputs": [ + { + "internalType": "uint128", + "name": "liquidityGross", + "type": "uint128" + }, + { + "internalType": "int128", + "name": "liquidityNet", + "type": "int128" + }, + { + "internalType": "uint256", + "name": "feeGrowthOutside0X128", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "feeGrowthOutside1X128", + "type": "uint256" + }, + { + "internalType": "int56", + "name": "tickCumulativeOutside", + "type": "int56" + }, + { + "internalType": "uint160", + "name": "secondsPerLiquidityOutsideX128", + "type": "uint160" + }, + { + "internalType": "uint32", + "name": "secondsOutside", + "type": "uint32" + }, + { + "internalType": "bool", + "name": "initialized", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "token0", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "token1", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + } + ], + "numDeployments": 1 +} \ No newline at end of file diff --git a/docs/README.md b/docs/README.md index 0a162e0..bf3223e 100644 --- a/docs/README.md +++ b/docs/README.md @@ -25,14 +25,14 @@ The Keep3r Network also supports staking in Optimism and Polygon, where the paym | -------- | -------- | -------- | | Ethereum (`1`) | Keep3r | `0xeb02addCfD8B773A5FFA6B9d1FE99c566f8c44CC` | | Optimism (`10`) | Keep3rSidechain | `0x745a50320B6eB8FF281f1664Fc6713991661B129` | -| Polygon (`137`) | Keep3rSidechain | `TBD` | +| Polygon (`137`) | Keep3rSidechain | `0x745a50320B6eB8FF281f1664Fc6713991661B129` | #### Testnet environment | Chain (`chainId`) | Implementation | Address | | -------- | -------- | -------- | -| Goerli (`5`) | Keep3rForTestnet | `0x85063437C02Ba7F4f82F898859e4992380DEd3bb` | -| Goerli (`5`) | JobForTest | `0xa2c7A15FFc02e00cdeedBba56c41dAaed84f8734` | -| OPGoerli (`420`) | Keep3rSidechainForTestnet | `0x85063437C02Ba7F4f82F898859e4992380DEd3bb` | -| OPGoerli (`420`) | JobRatedForTest | `0x9abB5cfF47b9F604351a6f0730d9fe39Fb620B2b` | +| Sepolia (`11155111`) | Keep3rForTestnet | `0xbC855B9Ad7398360999Bd176edBC98EB53F9E26F` | +| Sepolia (`11155111`) | JobForTest | `0x0676fb8D6d8c46D0542c28375dB4EaA84DedFc92` | +| OPSepolia (`11155420`) | Keep3rSidechainForTestnet | `0xC3377b30feD174e65778e7E1DaFBb7686082B428` | +| OPSepolia (`11155420`) | JobRatedForTest | `0xbAba0774d23Cbc8CbDE744a9829c22469c1395E0` | > ForTestnet implementations allow instant bonding and unbonding, and use a free-to-mint ERC20 as KP3Rv1. diff --git a/hardhat.config.ts b/hardhat.config.ts index dd5cad3..12bf640 100644 --- a/hardhat.config.ts +++ b/hardhat.config.ts @@ -50,16 +50,13 @@ const config: HardhatUserConfig = { mainnet: 'mainnet', }, }, - goerli: { - url: process.env.GOERLI_HTTPS_URL, - accounts: [process.env.GOERLI_PRIVATE_KEY as string], + sepolia: { + url: process.env.SEPOLIA_HTTPS_URL, + accounts: [process.env.SEPOLIA_PRIVATE_KEY as string], }, - optimisticGoerli: { - url: process.env.OP_GOERLI_HTTPS_URL, - accounts: [process.env.OP_GOERLI_PRIVATE_KEY as string], - companionNetworks: { - mainnet: 'goerli', - }, + optimisticSepolia: { + url: process.env.OP_SEPOLIA_HTTPS_URL, + accounts: [process.env.OP_SEPOLIA_PRIVATE_KEY as string], }, }, solidity: { @@ -93,9 +90,19 @@ const config: HardhatUserConfig = { mainnet: process.env.ETHERSCAN_API_KEY as string, optimisticEthereum: process.env.OPTIMISTIC_ETHERSCAN_API_KEY as string, polygon: process.env.POLYGON_ETHERSCAN_API_KEY as string, - goerli: process.env.GOERLI_ETHERSCAN_API_KEY as string, - optimisticGoerli: process.env.OP_GOERLI_ETHERSCAN_API_KEY as string, + sepolia: process.env.SEPOLIA_ETHERSCAN_API_KEY as string, + optimisticSepolia: process.env.OP_SEPOLIA_ETHERSCAN_API_KEY as string, }, + customChains: [ + { + network: 'optimisticSepolia', + chainId: 11155420, + urls: { + apiURL: 'https://api-sepolia-optimistic.etherscan.io/api', + browserURL: 'https://sepolia-optimism.etherscan.io/', + }, + }, + ], }, typechain: { outDir: 'types', diff --git a/package.json b/package.json index c85708f..0e67fff 100644 --- a/package.json +++ b/package.json @@ -38,12 +38,12 @@ "coverage": "TEST=true hardhat coverage", "docs": "./docgen.sh", "deploy": "hardhat deploy", - "deploy:testnet": "yarn deploy --network goerli --tags job-for-test", - "deploy:testnet:verify": "yarn deploy --network goerli --tags verify-testnet", + "deploy:testnet": "yarn deploy --network sepolia --tags job-for-test", + "deploy:testnet:verify": "yarn deploy --network sepolia --tags verify-testnet", "deploy:sidechain": "yarn deploy --network optimisticEthereum --tags keep3r-sidechain", "deploy:sidechain:verify": "yarn deploy --network optimisticEthereum --tags verify-sidechain", - "deploy:sidechain:testnet": "yarn deploy --network optimisticGoerli --tags job-rated-for-test", - "deploy:sidechain:testnet:verify": "yarn deploy --network optimisticGoerli --tags verify-sidechain-testnet", + "deploy:sidechain:testnet": "yarn deploy --network optimisticSepolia --tags job-rated-for-test", + "deploy:sidechain:testnet:verify": "yarn deploy --network optimisticSepolia --tags verify-sidechain-testnet", "fork:node": "cross-env FORK=true hardhat node", "fork:script": "cross-env FORK=true hardhat run", "lint:check": "cross-env solhint 'contracts/**/*.sol' 'interfaces/**/*.sol' && cross-env prettier --check './**'", diff --git a/solidity/for-test/JobForTest.sol b/solidity/for-test/JobForTest.sol index aa5f5e2..f5a720c 100644 --- a/solidity/for-test/JobForTest.sol +++ b/solidity/for-test/JobForTest.sol @@ -5,6 +5,7 @@ import '../interfaces/IKeep3r.sol'; contract JobForTest { error InvalidKeeper(); + address public keep3r; uint256 public nonce; diff --git a/test/e2e/deployment-fixtures.spec.ts b/test/e2e/deployment-fixtures.spec.ts index ed5fde1..68fd7a1 100644 --- a/test/e2e/deployment-fixtures.spec.ts +++ b/test/e2e/deployment-fixtures.spec.ts @@ -175,14 +175,14 @@ describe('@skip-on-coverage Fixture', () => { it('should deploy a workable job', async () => { await deployments.fixture(['job-for-test']); - const jobForTest = (await getContractFromFixture('BasicJob', 'JobForTest')) as Type.BasicJob; + const jobForTest = (await getContractFromFixture('JobForTest', 'JobForTest')) as Type.BasicJob; await evm.advanceTimeAndBlock(86400); await jobForTest.workHard(10); }); }); - describe('Keep3rSidechainForTestnet', () => { + describe.only('Keep3rSidechainForTestnet', () => { beforeEach(async () => { await deployments.fixture(['testnet-keep3r-sidechain']); @@ -235,7 +235,7 @@ describe('@skip-on-coverage Fixture', () => { await evm.advanceTimeAndBlock(86400); await deployments.fixture(['job-rated-for-test'], { keepExistingDeployments: true }); - const jobForTest = (await getContractFromFixture('BasicJob', 'JobRatedForTest')) as Type.BasicJob; + const jobForTest = (await getContractFromFixture('JobRatedForTest', 'JobRatedForTest')) as Type.BasicJob; await jobForTest.work(); }); diff --git a/utils/constants.ts b/utils/constants.ts index 378f5a2..d12de96 100644 --- a/utils/constants.ts +++ b/utils/constants.ts @@ -4,36 +4,36 @@ export const addressRegistry = { 1: '0x1ceb5cb57c4d4e2b2433641b95dd330a33185a44', // Keep3rV1 10: '0xca87472DBfB041c2e5a2672d319eA6184Ad9755e', // nextKP3R 137: '0x4a2bE2075588BcE6A7E072574698a7DbbAc39b08', // nextKP3R - 5: '0x16F63C5036d3F48A239358656a8f123eCE85789C', // KP3RforTest - 420: '0x3Db593146464816F10d4eBA4743C76A5A4D08425', // wKP3RforTest + 11155111: '0x80B4327021946fF962d570c808B6aaC47224AeF1', // ERC20ForTest + 11155420: '0x12DA5E324EFCBDe7BB4797e1dB2B3477FC4C048f', // ERC20ForTest 31337: '0x1ceb5cb57c4d4e2b2433641b95dd330a33185a44', }, weth: { 1: '0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2', 10: '0x4200000000000000000000000000000000000006', 137: '0x7ceB23fD6bC0adD59E62ac25578270cFf1b9f619', - 5: '0xb4fbf271143f4fbf7b91a5ded31805e42b2208d6', - 420: '0xb4fbf271143f4fbf7b91a5ded31805e42b2208d6', + 11155111: '0xfff9976782d46cc05630d1f6ebab18b2324d6b14', + 11155420: '0x4200000000000000000000000000000000000006', 31337: '0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2', }, kp3rFaucet: { 1: '0x976b01c02c636Dd5901444B941442FD70b86dcd5', // Keep3rV1Proxy - 5: '0x16F63C5036d3F48A239358656a8f123eCE85789C', // KP3RforTest + 11155111: '0x80B4327021946fF962d570c808B6aaC47224AeF1', // ERC20ForTest 31337: '0x976b01c02c636Dd5901444B941442FD70b86dcd5', }, wkLP: { 10: '0xf232D1Afbed9Df3880143d4FAD095f3698c4d1c6', // nextKLP 137: '0x7cf93c434260519537184631A347eE8AD0Bc68Cb', // nextKLP - 420: '0xA437aC90d360c7645f25f30ddE201a94fe137Af5', // wkLP - 31337: '0x1ceb5cb57c4d4e2b2433641b95dd330a33185a44', // kLP + 11155420: '0x12DA5E324EFCBDe7BB4797e1dB2B3477FC4C048f', // ERC20ForTest + 31337: '0x1ceb5cb57c4d4e2b2433641b95dd330a33185a44', // wkLP }, // GOVERNANCE governor: { 1: '0x0D5Dc686d0a2ABBfDaFDFb4D0533E886517d4E83', 10: '0x7d6daDb31dBeBc68c8A0b2cCfE5C1f26F24bD41d', 137: '0x9A040a31bc38919D50FD740973dBB6F8fdee1426', - 5: 0, // deployer - 420: 0, + 11155111: 0, // deployer + 11155420: 0, // deployer 31337: 0, }, // ORACLES @@ -41,20 +41,25 @@ export const addressRegistry = { 1: '0x11b7a6bc0259ed6cf9db8f499988f9ecc7167bf5', // UniV3Pool 10: '0x6A060BF6579318c15138160Ee1f1d225fcC9D409', // SidechainOracle 137: '0x6A060BF6579318c15138160Ee1f1d225fcC9D409', // SidechainOracle - 5: '0x317ceCd3eB02158f97DF0B67B788edCda4E066e5', // UniV3Pool - 420: '0x4ECFF2c532d47D7be3D957E4a332AB134cad1fd9', // SidechainOracle + 11155111: '0xb39Dea2246Ac99575eebc86A2590BADF046eda91', // UniV3Pool + 11155420: '0x8BFdD4689dC4669bd818c0551a510301f091103C', // UniV3Pool 31337: '0x11b7a6bc0259ed6cf9db8f499988f9ecc7167bf5', }, wethUsdOracle: { 10: '0x03af20bdaaffb4cc0a521796a223f7d85e2aac31', // WETH-DAI 0.3% 137: '0x45dda9cb7c25131df268515131f647d726f50608', // WETH-USDC 0.05% - 420: '0x4ECFF2c532d47D7be3D957E4a332AB134cad1fd9', // SidechainOracle + 11155420: '0x8BFdD4689dC4669bd818c0551a510301f091103C', // UniV3Pool 31337: '0x60594a405d53811d3bc4766596efd80fd545a270', // UniV3Pool }, usdDecimals: { 10: '0x0000000000000000000000000000000000000012', // 18 137: '0x0000000000000000000000000000000000000006', // USDC uses 6 decimals - 420: '0x0000000000000000000000000000000000000012', // 18 31337: '0x0000000000000000000000000000000000000012', // 18 + 11155420: '0x0000000000000000000000000000000000000012', // 18 + }, + uniV3Factory: { + 1: '0x1f98431c8ad98523631ae4a59f267346ea31f984', + 11155111: '0x0227628f3F023bb0B980b67D528571c95c6DaC1c', + 31337: '0x1f98431c8ad98523631ae4a59f267346ea31f984', }, }; diff --git a/yarn.lock b/yarn.lock index 2dcfea1..17279b5 100644 --- a/yarn.lock +++ b/yarn.lock @@ -4285,9 +4285,9 @@ drbg.js@^1.0.1: create-hash "^1.1.2" create-hmac "^1.1.4" -"ds-test@git+https://github.com/dapphub/ds-test.git": +"ds-test@https://github.com/dapphub/ds-test": version "1.0.0" - resolved "git+https://github.com/dapphub/ds-test.git#cd98eff28324bfac652e63a239a60632a761790b" + resolved "https://github.com/dapphub/ds-test#e282159d5170298eb2455a6c05280ab5a73a4ef0" duplexer3@^0.1.4: version "0.1.4" @@ -5520,9 +5520,9 @@ forever-agent@~0.6.1: resolved "https://registry.yarnpkg.com/forever-agent/-/forever-agent-0.6.1.tgz#fbc71f0c41adeb37f96c577ad1ed42d8fdacca91" integrity sha1-+8cfDEGt6zf5bFd60e1C2P2sypE= -"forge-std@git+https://github.com/foundry-rs/forge-std.git": - version "1.2.0" - resolved "git+https://github.com/foundry-rs/forge-std.git#4a79aca83f8075f8b1b4fe9153945fef08375630" +"forge-std@https://github.com/foundry-rs/forge-std": + version "1.8.2" + resolved "https://github.com/foundry-rs/forge-std#52715a217dc51d0de15877878ab8213f6cbbbab5" form-data@^2.2.0: version "2.5.1"